版博士V2.0程序
Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

1 год назад
123456
  1. /*!
  2. * message-compiler v9.3.0-beta.17
  3. * (c) 2023 kazuya kawaguchi
  4. * Released under the MIT License.
  5. */
  6. const assign=Object.assign,isString=e=>"string"==typeof e,CompileErrorCodes={EXPECTED_TOKEN:1,INVALID_TOKEN_IN_PLACEHOLDER:2,UNTERMINATED_SINGLE_QUOTE_IN_PLACEHOLDER:3,UNKNOWN_ESCAPE_SEQUENCE:4,INVALID_UNICODE_ESCAPE_SEQUENCE:5,UNBALANCED_CLOSING_BRACE:6,UNTERMINATED_CLOSING_BRACE:7,EMPTY_PLACEHOLDER:8,NOT_ALLOW_NEST_PLACEHOLDER:9,INVALID_LINKED_FORMAT:10,MUST_HAVE_MESSAGES_IN_PLURAL:11,UNEXPECTED_EMPTY_LINKED_MODIFIER:12,UNEXPECTED_EMPTY_LINKED_KEY:13,UNEXPECTED_LEXICAL_ANALYSIS:14,__EXTEND_POINT__:15},errorMessages={[CompileErrorCodes.EXPECTED_TOKEN]:"Expected token: '{0}'",[CompileErrorCodes.INVALID_TOKEN_IN_PLACEHOLDER]:"Invalid token in placeholder: '{0}'",[CompileErrorCodes.UNTERMINATED_SINGLE_QUOTE_IN_PLACEHOLDER]:"Unterminated single quote in placeholder",[CompileErrorCodes.UNKNOWN_ESCAPE_SEQUENCE]:"Unknown escape sequence: \\{0}",[CompileErrorCodes.INVALID_UNICODE_ESCAPE_SEQUENCE]:"Invalid unicode escape sequence: {0}",[CompileErrorCodes.UNBALANCED_CLOSING_BRACE]:"Unbalanced closing brace",[CompileErrorCodes.UNTERMINATED_CLOSING_BRACE]:"Unterminated closing brace",[CompileErrorCodes.EMPTY_PLACEHOLDER]:"Empty placeholder",[CompileErrorCodes.NOT_ALLOW_NEST_PLACEHOLDER]:"Not allowed nest placeholder",[CompileErrorCodes.INVALID_LINKED_FORMAT]:"Invalid linked format",[CompileErrorCodes.MUST_HAVE_MESSAGES_IN_PLURAL]:"Plural must have messages",[CompileErrorCodes.UNEXPECTED_EMPTY_LINKED_MODIFIER]:"Unexpected empty linked modifier",[CompileErrorCodes.UNEXPECTED_EMPTY_LINKED_KEY]:"Unexpected empty linked key",[CompileErrorCodes.UNEXPECTED_LEXICAL_ANALYSIS]:"Unexpected lexical analysis in token: '{0}'"};function createCompileError(e,t,r={}){const{domain:n,messages:o,args:c}=r,s=new SyntaxError(String(e));return s.code=e,t&&(s.location=t),s.domain=n,s}function defaultOnError(e){throw e}const RE_HTML_TAG=/<\/?[\w\s="/.':;#-\/]+>/,detectHtmlTag=e=>RE_HTML_TAG.test(e),LocationStub={start:{line:1,column:1,offset:0},end:{line:1,column:1,offset:0}};function createPosition(e,t,r){return{line:e,column:t,offset:r}}function createLocation(e,t,r){const n={start:e,end:t};return null!=r&&(n.source=r),n}const CHAR_SP=" ",CHAR_CR="\r",CHAR_LF="\n",CHAR_LS=String.fromCharCode(8232),CHAR_PS=String.fromCharCode(8233);function createScanner(e){const t=e;let r=0,n=1,o=1,c=0;const s=e=>t[e]===CHAR_CR&&t[e+1]===CHAR_LF,u=e=>t[e]===CHAR_PS,a=e=>t[e]===CHAR_LS,i=e=>s(e)||(e=>t[e]===CHAR_LF)(e)||u(e)||a(e),E=e=>s(e)||u(e)||a(e)?CHAR_LF:t[e];function l(){return c=0,i(r)&&(n++,o=0),s(r)&&r++,r++,o++,t[r]}return{index:()=>r,line:()=>n,column:()=>o,peekOffset:()=>c,charAt:E,currentChar:()=>E(r),currentPeek:()=>E(r+c),next:l,peek:function(){return s(r+c)&&c++,c++,t[r+c]},reset:function(){r=0,n=1,o=1,c=0},resetPeek:function(e=0){c=e},skipToPeek:function(){const e=r+c;for(;e!==r;)l();c=0}}}const EOF=void 0,LITERAL_DELIMITER="'",ERROR_DOMAIN$1="tokenizer";function createTokenizer(e,t={}){const r=!1!==t.location,n=createScanner(e),o=()=>n.index(),c=()=>createPosition(n.line(),n.column(),n.index()),s=c(),u=o(),a={currentType:14,offset:u,startLoc:s,endLoc:s,lastType:14,lastOffset:u,lastStartLoc:s,lastEndLoc:s,braceNest:0,inLinked:!1,text:""},i=()=>a,{onError:E}=t;function l(e,t,n){e.endLoc=c(),e.currentType=t;const o={type:t};return r&&(o.loc=createLocation(e.startLoc,e.endLoc)),null!=n&&(o.value=n),o}const C=e=>l(e,14);function f(e,t){return e.currentChar()===t?(e.next(),t):(CompileErrorCodes.EXPECTED_TOKEN,c(),"")}function d(e){let t="";for(;e.currentPeek()===CHAR_SP||e.currentPeek()===CHAR_LF;)t+=e.currentPeek(),e.peek();return t}function L(e){const t=d(e);return e.skipToPeek(),t}function p(e){if(e===EOF)return!1;const t=e.charCodeAt(0);return t>=97&&t<=122||t>=65&&t<=90||95===t}function _(e,t){const{currentType:r}=t;if(2!==r)return!1;d(e);const n=function(e){if(e===EOF)return!1;const t=e.charCodeAt(0);return t>=48&&t<=57}("-"===e.currentPeek()?e.peek():e.currentPeek());return e.resetPeek(),n}function N(e){d(e);const t="|"===e.currentPeek();return e.resetPeek(),t}function A(e,t=!0){const r=(t=!1,n="",o=!1)=>{const c=e.currentPeek();return"{"===c?"%"!==n&&t:"@"!==c&&c?"%"===c?(e.peek(),r(t,"%",!0)):"|"===c?!("%"!==n&&!o)||!(n===CHAR_SP||n===CHAR_LF):c===CHAR_SP?(e.peek(),r(!0,CHAR_SP,o)):c!==CHAR_LF||(e.peek(),r(!0,CHAR_LF,o)):"%"===n||t},n=r();return t&&e.resetPeek(),n}function T(e,t){const r=e.currentChar();return r===EOF?EOF:t(r)?(e.next(),r):null}function k(e){return T(e,(e=>{const t=e.charCodeAt(0);return t>=97&&t<=122||t>=65&&t<=90||t>=48&&t<=57||95===t||36===t}))}function I(e){return T(e,(e=>{const t=e.charCodeAt(0);return t>=48&&t<=57}))}function S(e){return T(e,(e=>{const t=e.charCodeAt(0);return t>=48&&t<=57||t>=65&&t<=70||t>=97&&t<=102}))}function m(e){let t="",r="";for(;t=I(e);)r+=t;return r}function P(e){let t="";for(;;){const r=e.currentChar();if("{"===r||"}"===r||"@"===r||"|"===r||!r)break;if("%"===r){if(!A(e))break;t+=r,e.next()}else if(r===CHAR_SP||r===CHAR_LF)if(A(e))t+=r,e.next();else{if(N(e))break;t+=r,e.next()}else t+=r,e.next()}return t}function h(e){const t=e.currentChar();switch(t){case"\\":case"'":return e.next(),`\\${t}`;case"u":return O(e,t,4);case"U":return O(e,t,6);default:return CompileErrorCodes.UNKNOWN_ESCAPE_SEQUENCE,c(),""}}function O(e,t,r){f(e,t);let n="";for(let o=0;o<r;o++){const t=S(e);if(!t){CompileErrorCodes.INVALID_UNICODE_ESCAPE_SEQUENCE,c(),e.currentChar();break}n+=t}return`\\${t}${n}`}function R(e){L(e);const t=f(e,"|");return L(e),t}function D(e,t){let r=null;switch(e.currentChar()){case"{":return t.braceNest>=1&&(CompileErrorCodes.NOT_ALLOW_NEST_PLACEHOLDER,c()),e.next(),r=l(t,2,"{"),L(e),t.braceNest++,r;case"}":return t.braceNest>0&&2===t.currentType&&(CompileErrorCodes.EMPTY_PLACEHOLDER,c()),e.next(),r=l(t,3,"}"),t.braceNest--,t.braceNest>0&&L(e),t.inLinked&&0===t.braceNest&&(t.inLinked=!1),r;case"@":return t.braceNest>0&&(CompileErrorCodes.UNTERMINATED_CLOSING_BRACE,c()),r=g(e,t)||C(t),t.braceNest=0,r;default:let n=!0,o=!0,s=!0;if(N(e))return t.braceNest>0&&(CompileErrorCodes.UNTERMINATED_CLOSING_BRACE,c()),r=l(t,1,R(e)),t.braceNest=0,t.inLinked=!1,r;if(t.braceNest>0&&(5===t.currentType||6===t.currentType||7===t.currentType))return CompileErrorCodes.UNTERMINATED_CLOSING_BRACE,c(),t.braceNest=0,x(e,t);if(n=function(e,t){const{currentType:r}=t;if(2!==r)return!1;d(e);const n=p(e.currentPeek());return e.resetPeek(),n}(e,t))return r=l(t,5,function(e){L(e);let t="",r="";for(;t=k(e);)r+=t;return e.currentChar()===EOF&&(CompileErrorCodes.UNTERMINATED_CLOSING_BRACE,c()),r}(e)),L(e),r;if(o=_(e,t))return r=l(t,6,function(e){L(e);let t="";return"-"===e.currentChar()?(e.next(),t+=`-${m(e)}`):t+=m(e),e.currentChar()===EOF&&(CompileErrorCodes.UNTERMINATED_CLOSING_BRACE,c()),t}(e)),L(e),r;if(s=function(e,t){const{currentType:r}=t;if(2!==r)return!1;d(e);const n=e.currentPeek()===LITERAL_DELIMITER;return e.resetPeek(),n}(e,t))return r=l(t,7,function(e){L(e),f(e,"'");let t="",r="";const n=e=>e!==LITERAL_DELIMITER&&e!==CHAR_LF;for(;t=T(e,n);)r+="\\"===t?h(e):t;const o=e.currentChar();return o===CHAR_LF||o===EOF?(CompileErrorCodes.UNTERMINATED_SINGLE_QUOTE_IN_PLACEHOLDER,c(),o===CHAR_LF&&(e.next(),f(e,"'")),r):(f(e,"'"),r)}(e)),L(e),r;if(!n&&!o&&!s)return r=l(t,13,function(e){L(e);let t="",r="";const n=e=>"{"!==e&&"}"!==e&&e!==CHAR_SP&&e!==CHAR_LF;for(;t=T(e,n);)r+=t;return r}(e)),CompileErrorCodes.INVALID_TOKEN_IN_PLACEHOLDER,c(),r.value,L(e),r}return r}function g(e,t){const{currentType:r}=t;let n=null;const o=e.currentChar();switch(8!==r&&9!==r&&12!==r&&10!==r||o!==CHAR_LF&&o!==CHAR_SP||(CompileErrorCodes.INVALID_LINKED_FORMAT,c()),o){case"@":return e.next(),n=l(t,8,"@"),t.inLinked=!0,n;case".":return L(e),e.next(),l(t,9,".");case":":return L(e),e.next(),l(t,10,":");default:return N(e)?(n=l(t,1,R(e)),t.braceNest=0,t.inLinked=!1,n):function(e,t){const{currentType:r}=t;if(8!==r)return!1;d(e);const n="."===e.currentPeek();return e.resetPeek(),n}(e,t)||function(e,t){const{currentType:r}=t;if(8!==r&&12!==r)return!1;d(e);const n=":"===e.currentPeek();return e.resetPeek(),n}(e,t)?(L(e),g(e,t)):function(e,t){const{currentType:r}=t;if(9!==r)return!1;d(e);const n=p(e.currentPeek());return e.resetPeek(),n}(e,t)?(L(e),l(t,12,function(e){let t="",r="";for(;t=k(e);)r+=t;return r}(e))):function(e,t){const{currentType:r}=t;if(10!==r)return!1;const n=()=>{const t=e.currentPeek();return"{"===t?p(e.peek()):!("@"===t||"%"===t||"|"===t||":"===t||"."===t||t===CHAR_SP||!t)&&(t===CHAR_LF?(e.peek(),n()):p(t))},o=n();return e.resetPeek(),o}(e,t)?(L(e),"{"===o?D(e,t)||n:l(t,11,function(e){const t=(r=!1,n)=>{const o=e.currentChar();return"{"!==o&&"%"!==o&&"@"!==o&&"|"!==o&&o?o===CHAR_SP?n:o===CHAR_LF?(n+=o,e.next(),t(r,n)):(n+=o,e.next(),t(!0,n)):n};return t(!1,"")}(e))):(8===r&&(CompileErrorCodes.INVALID_LINKED_FORMAT,c()),t.braceNest=0,t.inLinked=!1,x(e,t))}}function x(e,t){let r={type:14};if(t.braceNest>0)return D(e,t)||C(t);if(t.inLinked)return g(e,t)||C(t);switch(e.currentChar()){case"{":return D(e,t)||C(t);case"}":return CompileErrorCodes.UNBALANCED_CLOSING_BRACE,c(),e.next(),l(t,3,"}");case"@":return g(e,t)||C(t);default:if(N(e))return r=l(t,1,R(e)),t.braceNest=0,t.inLinked=!1,r;const{isModulo:n,hasSpace:o}=function(e){const t=d(e),r="%"===e.currentPeek()&&"{"===e.peek();return e.resetPeek(),{isModulo:r,hasSpace:t.length>0}}(e);if(n)return o?l(t,0,P(e)):l(t,4,function(e){L(e);const t=e.currentChar();return"%"!==t&&(CompileErrorCodes.EXPECTED_TOKEN,c()),e.next(),"%"}(e));if(A(e))return l(t,0,P(e))}return r}return{nextToken:function(){const{currentType:e,offset:t,startLoc:r,endLoc:s}=a;return a.lastType=e,a.lastOffset=t,a.lastStartLoc=r,a.lastEndLoc=s,a.offset=o(),a.startLoc=c(),n.currentChar()===EOF?l(a,14):x(n,a)},currentOffset:o,currentPosition:c,context:i}}const ERROR_DOMAIN="parser",KNOWN_ESCAPES=/(?:\\\\|\\'|\\u([0-9a-fA-F]{4})|\\U([0-9a-fA-F]{6}))/g;function fromEscapeSequence(e,t,r){switch(e){case"\\\\":return"\\";case"\\'":return"'";default:{const e=parseInt(t||r,16);return e<=55295||e>=57344?String.fromCodePoint(e):"�"}}}function createParser(e={}){const t=!1!==e.location,{onError:r}=e;function n(e,r,n){const o={type:e,start:r,end:r};return t&&(o.loc={start:n,end:n}),o}function o(e,r,n,o){e.end=r,o&&(e.type=o),t&&e.loc&&(e.loc.end=n)}function c(e,t){const r=e.context(),c=n(3,r.offset,r.startLoc);return c.value=t,o(c,e.currentOffset(),e.currentPosition()),c}function s(e,t){const r=e.context(),{lastOffset:c,lastStartLoc:s}=r,u=n(5,c,s);return u.index=parseInt(t,10),e.nextToken(),o(u,e.currentOffset(),e.currentPosition()),u}function u(e,t){const r=e.context(),{lastOffset:c,lastStartLoc:s}=r,u=n(4,c,s);return u.key=t,e.nextToken(),o(u,e.currentOffset(),e.currentPosition()),u}function a(e,t){const r=e.context(),{lastOffset:c,lastStartLoc:s}=r,u=n(9,c,s);return u.value=t.replace(KNOWN_ESCAPES,fromEscapeSequence),e.nextToken(),o(u,e.currentOffset(),e.currentPosition()),u}function i(e){const t=e.context(),r=n(6,t.offset,t.startLoc);let c=e.nextToken();if(9===c.type){const t=function(e){const t=e.nextToken(),r=e.context(),{lastOffset:c,lastStartLoc:s}=r,u=n(8,c,s);return 12!==t.type?(CompileErrorCodes.UNEXPECTED_EMPTY_LINKED_MODIFIER,r.lastStartLoc,u.value="",o(u,c,s),{nextConsumeToken:t,node:u}):(null==t.value&&(CompileErrorCodes.UNEXPECTED_LEXICAL_ANALYSIS,r.lastStartLoc,getTokenCaption(t)),u.value=t.value||"",o(u,e.currentOffset(),e.currentPosition()),{node:u})}(e);r.modifier=t.node,c=t.nextConsumeToken||e.nextToken()}switch(10!==c.type&&(CompileErrorCodes.UNEXPECTED_LEXICAL_ANALYSIS,t.lastStartLoc,getTokenCaption(c)),c=e.nextToken(),2===c.type&&(c=e.nextToken()),c.type){case 11:null==c.value&&(CompileErrorCodes.UNEXPECTED_LEXICAL_ANALYSIS,t.lastStartLoc,getTokenCaption(c)),r.key=function(e,t){const r=e.context(),c=n(7,r.offset,r.startLoc);return c.value=t,o(c,e.currentOffset(),e.currentPosition()),c}(e,c.value||"");break;case 5:null==c.value&&(CompileErrorCodes.UNEXPECTED_LEXICAL_ANALYSIS,t.lastStartLoc,getTokenCaption(c)),r.key=u(e,c.value||"");break;case 6:null==c.value&&(CompileErrorCodes.UNEXPECTED_LEXICAL_ANALYSIS,t.lastStartLoc,getTokenCaption(c)),r.key=s(e,c.value||"");break;case 7:null==c.value&&(CompileErrorCodes.UNEXPECTED_LEXICAL_ANALYSIS,t.lastStartLoc,getTokenCaption(c)),r.key=a(e,c.value||"");break;default:CompileErrorCodes.UNEXPECTED_EMPTY_LINKED_KEY,t.lastStartLoc;const i=e.context(),E=n(7,i.offset,i.startLoc);return E.value="",o(E,i.offset,i.startLoc),r.key=E,o(r,i.offset,i.startLoc),{nextConsumeToken:c,node:r}}return o(r,e.currentOffset(),e.currentPosition()),{node:r}}function E(e){const t=e.context(),r=n(2,1===t.currentType?e.currentOffset():t.offset,1===t.currentType?t.endLoc:t.startLoc);r.items=[];let E=null;do{const n=E||e.nextToken();switch(E=null,n.type){case 0:null==n.value&&(CompileErrorCodes.UNEXPECTED_LEXICAL_ANALYSIS,t.lastStartLoc,getTokenCaption(n)),r.items.push(c(e,n.value||""));break;case 6:null==n.value&&(CompileErrorCodes.UNEXPECTED_LEXICAL_ANALYSIS,t.lastStartLoc,getTokenCaption(n)),r.items.push(s(e,n.value||""));break;case 5:null==n.value&&(CompileErrorCodes.UNEXPECTED_LEXICAL_ANALYSIS,t.lastStartLoc,getTokenCaption(n)),r.items.push(u(e,n.value||""));break;case 7:null==n.value&&(CompileErrorCodes.UNEXPECTED_LEXICAL_ANALYSIS,t.lastStartLoc,getTokenCaption(n)),r.items.push(a(e,n.value||""));break;case 8:const o=i(e);r.items.push(o.node),E=o.nextConsumeToken||null}}while(14!==t.currentType&&1!==t.currentType);return o(r,1===t.currentType?t.lastOffset:e.currentOffset(),1===t.currentType?t.lastEndLoc:e.currentPosition()),r}function l(e){const t=e.context(),{offset:r,startLoc:c}=t,s=E(e);return 14===t.currentType?s:function(e,t,r,c){const s=e.context();let u=0===c.items.length;const a=n(1,t,r);a.cases=[],a.cases.push(c);do{const t=E(e);u||(u=0===t.items.length),a.cases.push(t)}while(14!==s.currentType);return u&&CompileErrorCodes.MUST_HAVE_MESSAGES_IN_PLURAL,o(a,e.currentOffset(),e.currentPosition()),a}(e,r,c,s)}return{parse:function(r){const c=createTokenizer(r,assign({},e)),s=c.context(),u=n(0,s.offset,s.startLoc);return t&&u.loc&&(u.loc.source=r),u.body=l(c),14!==s.currentType&&(CompileErrorCodes.UNEXPECTED_LEXICAL_ANALYSIS,s.lastStartLoc,r[s.offset]),o(u,c.currentOffset(),c.currentPosition()),u}}}function getTokenCaption(e){if(14===e.type)return"EOF";const t=(e.value||"").replace(/\r?\n/gu,"\\n");return t.length>10?t.slice(0,9)+"…":t}function createTransformer(e,t={}){const r={ast:e,helpers:new Set};return{context:()=>r,helper:e=>(r.helpers.add(e),e)}}function traverseNodes(e,t){for(let r=0;r<e.length;r++)traverseNode(e[r],t)}function traverseNode(e,t){switch(e.type){case 1:traverseNodes(e.cases,t),t.helper("plural");break;case 2:traverseNodes(e.items,t);break;case 6:traverseNode(e.key,t),t.helper("linked"),t.helper("type");break;case 5:t.helper("interpolate"),t.helper("list");break;case 4:t.helper("interpolate"),t.helper("named")}}function transform(e,t={}){const r=createTransformer(e);r.helper("normalize"),e.body&&traverseNode(e.body,r);const n=r.context();e.helpers=Array.from(n.helpers)}function createCodeGenerator(e,t){const{sourceMap:r,filename:n,breakLineCode:o,needIndent:c}=t,s={source:e.loc.source,filename:n,code:"",column:1,line:1,offset:0,map:void 0,breakLineCode:o,needIndent:c,indentLevel:0};function u(e,t){s.code+=e}function a(e,t=!0){const r=t?o:"";u(c?r+" ".repeat(e):r)}return{context:()=>s,push:u,indent:function(e=!0){const t=++s.indentLevel;e&&a(t)},deindent:function(e=!0){const t=--s.indentLevel;e&&a(t)},newline:function(){a(s.indentLevel)},helper:e=>`_${e}`,needIndent:()=>s.needIndent}}function generateLinkedNode(e,t){const{helper:r}=e;e.push(`${r("linked")}(`),generateNode(e,t.key),t.modifier?(e.push(", "),generateNode(e,t.modifier),e.push(", _type")):e.push(", undefined, _type"),e.push(")")}function generateMessageNode(e,t){const{helper:r,needIndent:n}=e;e.push(`${r("normalize")}([`),e.indent(n());const o=t.items.length;for(let c=0;c<o&&(generateNode(e,t.items[c]),c!==o-1);c++)e.push(", ");e.deindent(n()),e.push("])")}function generatePluralNode(e,t){const{helper:r,needIndent:n}=e;if(t.cases.length>1){e.push(`${r("plural")}([`),e.indent(n());const o=t.cases.length;for(let r=0;r<o&&(generateNode(e,t.cases[r]),r!==o-1);r++)e.push(", ");e.deindent(n()),e.push("])")}}function generateResource(e,t){t.body?generateNode(e,t.body):e.push("null")}function generateNode(e,t){const{helper:r}=e;switch(t.type){case 0:generateResource(e,t);break;case 1:generatePluralNode(e,t);break;case 2:generateMessageNode(e,t);break;case 6:generateLinkedNode(e,t);break;case 8:case 7:case 9:case 3:e.push(JSON.stringify(t.value),t);break;case 5:e.push(`${r("interpolate")}(${r("list")}(${t.index}))`,t);break;case 4:e.push(`${r("interpolate")}(${r("named")}(${JSON.stringify(t.key)}))`,t)}}const generate=(e,t={})=>{const r=isString(t.mode)?t.mode:"normal",n=isString(t.filename)?t.filename:"message.intl",o=!!t.sourceMap,c=null!=t.breakLineCode?t.breakLineCode:"arrow"===r?";":"\n",s=t.needIndent?t.needIndent:"arrow"!==r,u=e.helpers||[],a=createCodeGenerator(e,{mode:r,filename:n,sourceMap:o,breakLineCode:c,needIndent:s});a.push("normal"===r?"function __msg__ (ctx) {":"(ctx) => {"),a.indent(s),u.length>0&&(a.push(`const { ${u.map((e=>`${e}: _${e}`)).join(", ")} } = ctx`),a.newline()),a.push("return "),generateNode(a,e),a.deindent(s),a.push("}");const{code:i,map:E}=a.context();return{ast:e,code:i,map:E?E.toJSON():void 0}};function baseCompile(e,t={}){const r=assign({},t),n=createParser(r).parse(e);return transform(n,r),generate(n,r)}export{CompileErrorCodes,ERROR_DOMAIN,LocationStub,baseCompile,createCompileError,createLocation,createParser,createPosition,defaultOnError,detectHtmlTag,errorMessages};