amis-rpc-design/node_modules/prettier/plugins/glimmer.mjs

31 lines
129 KiB
JavaScript
Raw Normal View History

2023-10-07 19:42:30 +08:00
var Jn=Object.defineProperty;var zt=(t,e)=>{for(var r in e)Jn(t,r,{get:e[r],enumerable:!0})};var Br=(t,e,r)=>{if(!e.has(t))throw TypeError("Cannot "+r)};var $=(t,e,r)=>(Br(t,e,"read from private field"),r?r.call(t):e.get(t)),Rr=(t,e,r)=>{if(e.has(t))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(t):e.set(t,r)},qr=(t,e,r,n)=>(Br(t,e,"write to private field"),n?n.call(t,r):e.set(t,r),r);var _r={};zt(_r,{languages:()=>Yn,parsers:()=>Ar,printers:()=>$s});var Xn=(t,e,r,n)=>{if(!(t&&e==null))return e.replaceAll?e.replaceAll(r,n):r.global?e.replace(r,n):e.split(r).join(n)},Wt=Xn;var ze="string",We="array",Ke="cursor",De="indent",Oe="align",je="trim",Ie="group",Be="fill",Re="if-break",Qe="indent-if-break",Je="line-suffix",Xe="line-suffix-boundary",Z="line",$e="label",qe="break-parent",pt=new Set([Ke,De,Oe,je,Ie,Be,Re,Qe,Je,Xe,Z,$e,qe]);function $n(t){if(typeof t=="string")return ze;if(Array.isArray(t))return We;if(!t)return;let{type:e}=t;if(pt.has(e))return e}var Ze=$n;var Zn=t=>new Intl.ListFormat("en-US",{type:"disjunction"}).format(t);function ei(t){let e=t===null?"null":typeof t;if(e!=="string"&&e!=="object")return`Unexpected doc '${e}',
Expected it to be 'string' or 'object'.`;if(Ze(t))throw new Error("doc is valid.");let r=Object.prototype.toString.call(t);if(r!=="[object Object]")return`Unexpected doc '${r}'.`;let n=Zn([...pt].map(i=>`'${i}'`));return`Unexpected doc.type '${t.type}'.
Expected it to be ${n}.`}var Kt=class extends Error{name="InvalidDocError";constructor(e){super(ei(e)),this.doc=e}},jt=Kt;var Vr=()=>{},Te=Vr,ft=Vr;function O(t){return Te(t),{type:De,contents:t}}function ti(t,e){return Te(e),{type:Oe,contents:e,n:t}}function I(t,e={}){return Te(t),ft(e.expandedStates,!0),{type:Ie,id:e.id,contents:t,break:!!e.shouldBreak,expandedStates:e.expandedStates}}function Qt(t){return ti(-1,t)}function Jt(t){return ft(t),{type:Be,parts:t}}function Xt(t,e="",r={}){return Te(t),e!==""&&Te(e),{type:Re,breakContents:t,flatContents:e,groupId:r.groupId}}var Hr={type:qe};var ri={type:Z,hard:!0},ni={type:Z,hard:!0,literal:!0},_={type:Z},M={type:Z,soft:!0},ve=[ri,Hr],Ur=[ni,Hr];function we(t,e){Te(t),ft(e);let r=[];for(let n=0;n<e.length;n++)n!==0&&r.push(t),r.push(e[n]);return r}var ii=(t,e,r)=>{if(!(t&&e==null))return Array.isArray(e)||typeof e=="string"?e[r<0?e.length+r:r]:e.at(r)},he=ii;function si(t,e){if(typeof t=="string")return e(t);let r=new Map;return n(t);function n(s){if(r.has(s))return r.get(s);let a=i(s);return r.set(s,a),a}function i(s){switch(Ze(s)){case We:return e(s.map(n));case Be:return e({...s,parts:s.parts.map(n)});case Re:return e({...s,breakContents:n(s.breakContents),flatContents:n(s.flatContents)});case Ie:{let{expandedStates:a,contents:l}=s;return a?(a=a.map(n),l=a[0]):l=n(l),e({...s,contents:l,expandedStates:a})}case Oe:case De:case Qe:case $e:case Je:return e({...s,contents:n(s.contents)});case ze:case Ke:case je:case Xe:case Z:case qe:return e(s);default:throw new jt(s)}}}function Fr(t,e=Ur){return si(t,r=>typeof r=="string"?we(e,r.split(`
`)):r)}var dt="'",Mr='"';function ai(t,e){let r=e===!0||e===dt?dt:Mr,n=r===dt?Mr:dt,i=0,s=0;for(let a of t)a===r?i++:a===n&&s++;return i>s?n:r}var mt=ai;function oi(t){return Array.isArray(t)&&t.length>0}var et=oi;var $t=class extends Error{name="UnexpectedNodeError";constructor(e,r,n="type"){super(`Unexpected ${r} node ${n}: ${JSON.stringify(e[n])}.`),this.node=e}},Gr=$t;function Zt(t){if(typeof t!="string")throw new TypeError("Expected a string");return t.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}var U,er=class{constructor(e){Rr(this,U,void 0);qr(this,U,new Set(e))}getLeadingWhitespaceCount(e){let r=$(this,U),n=0;for(let i=0;i<e.length&&r.has(e.charAt(i));i++)n++;return n}getTrailingWhitespaceCount(e){let r=$(this,U),n=0;for(let i=e.length-1;i>=0&&r.has(e.charAt(i));i--)n++;return n}getLeadingWhitespace(e){let r=this.getLeadingWhitespaceCount(e);return e.slice(0,r)}getTrailingWhitespace(e){let r=this.getTrailingWhitespaceCount(e);return e.slice(e.length-r)}hasLeadingWhitespace(e){return $(this,U).has(e.charAt(0))}hasTrailingWhitespace(e){return $(this,U).has(he(!1,e,-1))}trimStart(e){let r=this.getLeadingWhitespaceCount(e);return e.slice(r)}trimEnd(e){let r=this.getTrailingWhitespaceCount(e);return e.slice(0,e.length-r)}trim(e){return this.trimEnd(this.trimStart(e))}split(e,r=!1){let n=`[${Zt([...$(this,U)].join(""))}]+`,i=new RegExp(r?`(${n})`:n);return e.split(i)}hasWhitespaceCharacter(e){let r=$(this,U);return Array.prototype.some.call(e,n=>r.has(n))}hasNonWhitespaceCharacter(e){let r=$(this,U);return Array.prototype.some.call(e,n=>!r.has(n))}isWhitespaceOnly(e){let r=$(this,U);return Array.prototype.every.call(e,n=>r.has(n))}};U=new WeakMap;var Yr=er;var li=[" ",`
`,"\f","\r"," "],ci=new Yr(li),G=ci;function xe(t){return t.loc.start.offset}function tt(t){return t.loc.end.offset}function zr(t,e){if(t.type==="TextNode"){let r=t.chars.trim();if(!r)return null;e.chars=G.split(r).join(" ")}t.type==="AttrNode"&&t.name.toLowerCase()==="class"&&delete e.value}zr.ignoredProperties=new Set(["loc","selfClosing"]);var Wr=zr;var Kr=["area","base","br","col","command","embed","hr","img","input","keygen","link","meta","param","source","track","wbr"];function Qr(t){return t.toUpperCase()===t}function ui(t){return t.type==="ElementNode"&&typeof t.tag=="string"&&!t.tag.startsWith(":")&&(Qr(t.tag[0])||t.tag.includes("."))}var hi=new Set(Kr);function pi(t){return hi.has(t.toLowerCase())&&!Qr(t[0])}function tr(t){return t.selfClosing===!0||pi(t.tag)||ui(t)&&t.children.every(e=>gt(e))}function gt(t){return t.type==="TextNode"&&!/\S/.test(t.chars)}function jr(t){return(t==null?void 0:t.type)==="MustacheCommentStatement"&&typeof t.value=="string"&&t.value.trim()==="prettier-ignore"}function Jr(t){return jr(t.node)||t.isInArray&&(t.key==="children"||t.key==="body"||t.key==="parts")&&jr(t.siblings[t.index-2])}var rt=null;function nt(t){if(rt!==null&&typeof rt.property){let e=rt;return rt=nt.prototype=null,e}return rt=nt.prototype=t??Object.create(null),new nt}var fi=10;for(let t=0;t<=fi;t++)nt();function rr(t){return nt(t)}function di(t,e="type"){rr(t);function r(n){let i=n[e],s=t[i];if(!Array.isArray(s))throw Object.assign(new Error(`Missing visitor keys for '${i}'.`),{node:n});return s}return r}var Xr=di;var $r={Program:["body"],Template:["body"],Block:["body"],MustacheStatement:["path","params","hash"],BlockStatement:["path","params","hash","program","inverse"],ElementModifierStatement:["path","params","hash"],PartialStatement:["name","params","hash"],CommentStatement:[],MustacheCommentStatement:[],ElementNode:["attributes","modifiers","children","comments"],AttrNode:["value"],TextNode:[],ConcatStatement:["parts"],SubExpression:["path","params","hash"],PathExpression:[],PathHead:[],StringLiteral:[],BooleanLiteral:[],NumberLiteral:[],NullLiteral:[],UndefinedLiteral:[],Hash:["pairs"],HashPair:["value"],NamedBlock:["attributes","modifiers","children","comments"],SimpleElement:["attributes","modifiers","children","comments"],Component:["head","attributes","modifiers","children","comments"]};var mi=Xr($r),Zr=mi;var ln=2;function gi(t,e,r){var i,s,a,l,c,h,g,y,F;let{node:n}=t;switch(n.type){case"Block":case"Program":case"Template":return I(t.map(r,"body"));case"ElementNode":{let b=I(yi(t,r)),k=e.htmlWhitespaceSensitivity==="ignore"&&((i=t.next)==null?void 0:i.type)==="ElementNode"?M:"";if(tr(n))return[b,k];let N=["</",n.tag,">"];return n.children.length===0?[b,O(N),k]:e.htmlWhitespaceSensitivity==="ignore"?[b,O(en(t,e,r)),ve,O(N),k]:[b,O(I(en(t,e,r))),O(N),k]}case"BlockStatement":return xi(t)?[ki(t,r),nn(t,r,e),sn(t,r,e)]:[vi(t,r),I([nn(t,r,e),sn(t,r,e),Pi(t,r,e)])];case"ElementModifierStatement":return I(["{{",on(t,r),"}}"]);case"MustacheStatement":return I([bt(n),on(t,r),yt(n)]);case"SubExpression":return I(["(",Oi(t,r),M,")"]);case"AttrNode":{let{name:b,value:k}=n,N=k.type==="TextNode";if(N&&k.chars===""&&xe(k)===tt(k))return b;let w=N?mt(k.chars,e.singleQuote):k.type==="ConcatStatement"?mt(k.parts.map(R=>R.type==="TextNode"?R.chars:"").join(""),e.singleQuote):"",se=r("value");return[b,"=",w,b==="class"&&w?I(O(se)):se,w]}case"ConcatStatement":return t.map(r,"parts");case"Hash":return we(_,t.map(r,"pairs"));case"HashPair":return[n.key,"=",r("value")];case"TextNode":{let b=Wt(!1,n.chars,"{{","\\{{"),k=Ci(t);if(k){if(k==="class"){let J=b.trim().split(/\s+/).join(" "),ae=!1,q=!1;return t.parent.type==="ConcatStatement"&&(((s=t.previous)==null?void 0:s.type)==="MustacheStatement"&&/^\s/.test(b)&&(ae=!0),((a=t.next)==null?void 0:a.type)==="MustacheStatement"&&/\s$/.test(b)&&J!==""&&(q=!0)),[ae?_:"",J,q?_:""]}return Fr(b)}let N=G.isWhitespaceOnly(b),{isFirst:B,isLast:w}=t;if(e.htmlWhitespaceSensitivity!=="ignore"){let J=w&&t.parent.type==="Template",ae=B&&t.parent.type==="Template";if(N){if(ae||J)return"";let A=[
`).length-1}function Ai(t){t=typeof t=="string"?t:"";let e=(t.match(/^([^\S\n\r]*[\n\r])+/g)||[])[0]||"";return Ve(e)}function _i(t){t=typeof t=="string"?t:"";let e=(t.match(/([\n\r][^\S\n\r]*)+$/g)||[])[0]||"";return Ve(e)}function it(t=0){return Array.from({length:Math.min(t,ln)}).fill(ve)}function Li(t,e){let{node:{value:r}}=t,n=mt(r,Di(t)?!e.singleQuote:e.singleQuote);return[n,Wt(!1,r,n,`\\${n}`),n]}function Di(t){let{ancestors:e}=t,r=e.findIndex(n=>n.type!=="SubExpression");return r!==-1&&e[r+1].type==="ConcatStatement"&&e[r+2].type==="AttrNode"}function Oi(t,e){let r=nr(t,e),n=St(t,e);return n?O([r,_,I(n)]):r}function on(t,e){let r=nr(t,e),n=St(t,e);return n?[O([r,_,n]),M]:r}function nr(t,e){return e("path")}function St(t,e){var i;let{node:r}=t,n=[];return r.params.length>0&&n.push(...t.map(e,"params")),((i=r.hash)==null?void 0:i.pairs.length)>0&&n.push(e("hash")),n.length===0?"":we(_,n)}function ir(t){return["as |",t.blockParams.join(" "),"|"]}var Ii={print:gi,massageAstNode:Wr,hasPrettierIgnore:Jr,getVisitorKeys:Zr},fn=Ii;var Ar={};zt(Ar,{glimmer:()=>Xs});var Bi=Object.freeze([]);function dn(){return Bi}var co=dn(),uo=dn();var pe=Object.assign;var vo=function(){return typeof Symbol!="function"?!1:typeof Symbol()=="symbol"}();var T=(...t)=>t;function qi(t){return t&-536870913}function Vi(t){return t|536870912}function Hi(t){return~t}function Ui(t){return~t}function Fi(t){return t|=0,t<0?qi(t):Hi(t)}function Mi(t){return t|=0,t>-536870913?Ui(t):Vi(t)}[1,2,3].forEach(t=>t);[1,-1].forEach(t=>Mi(Fi(t)));function He(t){return t.length>0}function mn(t,e="unexpected empty list"){if(!He(t))throw new Error(e)}var Gi;if(!1){let t=n=>{let i=n.name;if(i===void 0){let s=Function.prototype.toString.call(n).match(/function (\w+)\s*\(/);i=s&&s[1]||""}return i.replace(/^bound /,"")},e=n=>{let i,s;return n.constructor&&typeof n.constructor=="function"&&(s=t(n.constructor)),"toString"in n&&n.toString!==Object.prototype.toString&&n.toString!==Function.prototype.toString&&(i=n.toString()),i&&i.match(/<.*:ember\d+>/)&&s&&s[0]!=="_"&&s.length>2&&s!=="Class"?i.replace(/<.*:/,`<${s}:`):i||s},r=n=>String(n);Gi=n=>typeof n=="function"?t(n)||"(unknown function)":typeof n=="object"&&n!==null?e(n)||"(unknown object)":r(n)}var gn=console;function bn(t,e="unexpected unreachable branch"){throw gn.log("unreachable",t),gn.log(`${e} :: ${JSON.stringify(t)} (${t})`),new Error("code reached unreachable")}var Yi=function(){var t=function(ce,p,m,f){for(m=m||{},f=ce.length;f--;m[ce[f]]=p);return m},e=[2,44],r=[1,20],n=[5,14,15,19,29,34,39,44,47,48,52,56,60],i=[1,35],s=[1,38],a=[1,30],l=[1,31],c=[1,32],h=[1,33],g=[1,34],y=[1,37],F=[14,15,19,29,34,39,44,47,48,52,56,60],b=[14,15,19,29,34,44,47,48,52,56,60],k=[15,18],N=[14,15,19,29,34,47,48,52,56,60],B=[33,64,71,79,80,81,82,83,84],w=[23,33,55,64,67,71,74,79,80,81,82,83,84],se=[1,51],R=[23,33,55,64,67,71,74,79,80,81,82,83,84,86],Q=[2,43],Ne=[55,64,71,79,80,81,82,83,84],Ce=[1,58],J=[1,59],ae=[1,66],q=[33,64,71,74,79,80,81,82,83,84],Ae=[23,64,71,79,80,81,82,83,84],V=[1,76],oe=[64,67,71,79,80,81,82,83,84],A=[33,74],le=[23,33,55,67,71,74],ct=[1,106],qt=[1,118],Lr=[71,76],Vt={trace:function(){},yy:{},symbols_:{error:2,root:3,program:4,EOF:5,program_repetition0:6,statement:7,mustache:8,block:9,rawBlock:10,partial:11,partialBlock:12,content:13,COMMENT:14,CONTENT:15,openRawBlock:16,rawBlock_repetition0:17,END_RAW_BLOCK:18,OPEN_RAW_BLOCK:19,helperName:20,openRawBlock_repetition0:21,openRawBlock_option0:22,CLOSE_RAW_BLOCK:23,openBlock:24,block_option0:25,closeBlock:26,openInverse:27,block_option1:28,OPEN_BLOCK:29,openBlock_repetition0:30,openBlock_option0:31,openBlock_option1:32,CLOSE:33,OPEN_INVERSE:34,openInverse_repetition0:35,openInverse_option0:36,openInverse_option1:37,openInverseChain:38,OPEN_INVERSE_CHAIN:39,openInverseChain_repetition0:40,openInverseChain_option0:41,openInverseChain_option1:42,inverseAndProgram:43,INVERSE:44,inverseChain:45,inverseChain_option0:46,OPEN_ENDBLOCK:47,OPEN:48,expr:49,mustache_repetition0:50,mustache_option0:51,OPEN_UNESCAPED:52,mustache_repetition1:53,mustache_option1:54,CLOSE_UN
`+C.showPosition()+`
Expecting `+ht.join(", ")+", got '"+(this.terminals_[D]||D)+"'":Yt="Parse error on line "+(ue+1)+": Unexpected "+(D==Or?"end of input":"'"+(this.terminals_[D]||D)+"'"),this.parseError(Yt,{text:C.match,token:this.terminals_[D]||D,line:C.yylineno,loc:Ft,expected:ht})}if(H[0]instanceof Array&&H.length>1)throw new Error("Parse Error: multiple actions possible at state: "+Ee+", token: "+D);switch(H[0]){case 1:f.push(D),v.push(C.yytext),o.push(C.yylloc),f.push(H[1]),D=null,Mt?(D=Mt,Mt=null):(Ye=C.yyleng,u=C.yytext,ue=C.yylineno,Ft=C.yylloc,Dr>0&&Dr--);break;case 2:if(X=this.productions_[H[1]][1],Le.$=v[v.length-X],Le._$={first_line:o[o.length-(X||1)].first_line,last_line:o[o.length-1].last_line,first_column:o[o.length-(X||1)].first_column,last_column:o[o.length-1].last_column},jn&&(Le._$.range=[o[o.length-(X||1)].range[0],o[o.length-1].range[1]]),Gt=this.performAction.apply(Le,[u,Ye,ue,Se.yy,H[1],v,o].concat(Kn)),typeof Gt<"u")return Gt;X&&(f=f.slice(0,-1*X*2),v=v.slice(0,-1*X),o=o.slice(0,-1*X)),f.push(this.productions_[H[1]][0]),v.push(Le.$),o.push(Le._$),Ir=_e[f[f.length-2]][f[f.length-1]],f.push(Ir);break;case 3:return!0}}return!0}},zn=function(){var ce={EOF:1,parseError:function(m,f){if(this.yy.parser)this.yy.parser.parseError(m,f);else throw new Error(m)},setInput:function(p,m){return this.yy=m||this.yy||{},this._input=p,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},input:function(){var p=this._input[0];this.yytext+=p,this.yyleng++,this.offset++,this.match+=p,this.matched+=p;var m=p.match(/(?:\r\n?|\n).*/g);return m?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),p},unput:function(p){var m=p.length,f=p.split(/(?:\r\n?|\n)/g);this._input=p+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-m),this.offset-=m;var d=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),f.length-1&&(this.yylineno-=f.length-1);var v=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:f?(f.length===d.length?this.yylloc.first_column:0)+d[d.length-f.length].length-f[0].length:this.yylloc.first_column-m},this.options.ranges&&(this.yylloc.range=[v[0],v[0]+this.yyleng-m]),this.yyleng=this.yytext.length,this},more:function(){return this._more=!0,this},reject:function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).
`+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},less:function(p){this.unput(this.match.slice(p))},pastInput:function(){var p=this.matched.substr(0,this.matched.length-this.match.length);return(p.length>20?"...":"")+p.substr(-20).replace(/\n/g,"")},upcomingInput:function(){var p=this.match;return p.length<20&&(p+=this._input.substr(0,20-p.length)),(p.substr(0,20)+(p.length>20?"...":"")).replace(/\n/g,"")},showPosition:function(){var p=this.pastInput(),m=new Array(p.length+1).join("-");return p+this.upcomingInput()+`
`+m+"^"},test_match:function(p,m){var f,d,v;if(this.options.backtrack_lexer&&(v={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges&&(v.yylloc.range=this.yylloc.range.slice(0))),d=p[0].match(/(?:\r\n?|\n).*/g),d&&(this.yylineno+=d.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:d?d[d.length-1].length-d[d.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+p[0].length},this.yytext+=p[0],this.match+=p[0],this.matches=p,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(p[0].length),this.matched+=p[0],f=this.performAction.call(this,this.yy,this,m,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),f)return f;if(this._backtrack){for(var o in v)this[o]=v[o];return!1}return!1},next:function(){if(this.done)return this.EOF;this._input||(this.done=!0);var p,m,f,d;this._more||(this.yytext="",this.match="");for(var v=this._currentRules(),o=0;o<v.length;o++)if(f=this._input.match(this.rules[v[o]]),f&&(!m||f[0].length>m[0].length)){if(m=f,d=o,this.options.backtrack_lexer){if(p=this.test_match(f,v[o]),p!==!1)return p;if(this._backtrack){m=!1;continue}else return!1}else if(!this.options.flex)break}return m?(p=this.test_match(m,v[d]),p!==!1?p:!1):this._input===""?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+`. Unrecognized text.
`+this.showPosition(),{text:"",token:null,line:this.yylineno})},lex:function(){var m=this.next();return m||this.lex()},begin:function(m){this.conditionStack.push(m)},popState:function(){var m=this.conditionStack.length-1;return m>0?this.conditionStack.pop():this.conditionStack[0]},_currentRules:function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},topState:function(m){return m=this.conditionStack.length-1-Math.abs(m||0),m>=0?this.conditionStack[m]:"INITIAL"},pushState:function(m){this.begin(m)},stateStackSize:function(){return this.conditionStack.length},options:{},performAction:function(m,f,d,v){function o(u,ue){return f.yytext=f.yytext.substring(u,f.yyleng-ue+u)}var _e=v;switch(d){case 0:if(f.yytext.slice(-2)==="\\\\"?(o(0,1),this.begin("mu")):f.yytext.slice(-1)==="\\"?(o(0,1),this.begin("emu")):this.begin("mu"),f.yytext)return 15;break;case 1:return 15;case 2:return this.popState(),15;break;case 3:return this.begin("raw"),15;break;case 4:return this.popState(),this.conditionStack[this.conditionStack.length-1]==="raw"?15:(o(5,9),18);case 5:return 15;case 6:return this.popState(),14;break;case 7:return 64;case 8:return 67;case 9:return 19;case 10:return this.popState(),this.begin("raw"),23;break;case 11:return 56;case 12:return 60;case 13:return 29;case 14:return 47;case 15:return this.popState(),44;break;case 16:return this.popState(),44;break;case 17:return 34;case 18:return 39;case 19:return 52;case 20:return 48;case 21:this.unput(f.yytext),this.popState(),this.begin("com");break;case 22:return this.popState(),14;break;case 23:return 48;case 24:return 72;case 25:return 71;case 26:return 71;case 27:return 86;case 28:break;case 29:return this.popState(),55;break;case 30:return this.popState(),33;break;case 31:return f.yytext=o(1,2).replace(/\\"/g,'"'),79;break;case 32:return f.yytext=o(1,2).replace(/\\'/g,"'"),79;break;case 33:return 84;case 34:return 81;case 35:return 81;case 36:return 82;case 37:return 83;case 38:return 80;case 39:return 74;case 40:return 76;case 41:return 71;case 42:return f.yytext=f.yytext.replace(/\\([\\\]])/g,"$1"),71;break;case 43:return"INVALID";case 44:return 5}},rules:[/^(?:[^\x00]*?(?=(\{\{)))/,/^(?:[^\x00]+)/,/^(?:[^\x00]{2,}?(?=(\{\{|\\\{\{|\\\\\{\{|$)))/,/^(?:\{\{\{\{(?=[^/]))/,/^(?:\{\{\{\{\/[^\s!"#%-,\.\/;->@\[-\^`\{-~]+(?=[=}\s\/.])\}\}\}\})/,/^(?:[^\x00]+?(?=(\{\{\{\{)))/,/^(?:[\s\S]*?--(~)?\}\})/,/^(?:\()/,/^(?:\))/,/^(?:\{\{\{\{)/,/^(?:\}\}\}\})/,/^(?:\{\{(~)?>)/,/^(?:\{\{(~)?#>)/,/^(?:\{\{(~)?#\*?)/,/^(?:\{\{(~)?\/)/,/^(?:\{\{(~)?\^\s*(~)?\}\})/,/^(?:\{\{(~)?\s*else\s*(~)?\}\})/,/^(?:\{\{(~)?\^)/,/^(?:\{\{(~)?\s*else\b)/,/^(?:\{\{(~)?\{)/,/^(?:\{\{(~)?&)/,/^(?:\{\{(~)?!--)/,/^(?:\{\{(~)?![\s\S]*?\}\})/,/^(?:\{\{(~)?\*?)/,/^(?:=)/,/^(?:\.\.)/,/^(?:\.(?=([=~}\s\/.)|])))/,/^(?:[\/.])/,/^(?:\s+)/,/^(?:\}(~)?\}\})/,/^(?:(~)?\}\})/,/^(?:"(\\["]|[^"])*")/,/^(?:'(\\[']|[^'])*')/,/^(?:@)/,/^(?:true(?=([~}\s)])))/,/^(?:false(?=([~}\s)])))/,/^(?:undefined(?=([~}\s)])))/,/^(?:null(?=([~}\s)])))/,/^(?:-?[0-9]+(?:\.[0-9]+)?(?=([~}\s)])))/,/^(?:as\s+\|)/,/^(?:\|)/,/^(?:([^\s!"#%-,\.\/;->@\[-\^`\{-~]+(?=([=~}\s\/.)|]))))/,/^(?:\[(\\\]|[^\]])*\])/,/^(?:.)/,/^(?:$)/],conditions:{mu:{rules:[7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44],inclusive:!1},emu:{rules:[2],inclusive:!1},com:{rules:[6],inclusive:!1},raw:{rules:[3,4,5],inclusive:!1},INITIAL:{rules:[0,1,44],inclusive:!0}}};return ce}();Vt.lexer=zn;function Ht(){this.yy={}}return Ht.prototype=Vt,Vt.Parser=Ht,new Ht}(),Et=Yi;var sr=["description","fileName","lineNumber","endLineNumber","message","name","number","stack"];function ar(t,e){var r=e&&e.loc,n,i,s,a;r&&(n=r.start.line,i=r.end.line,s=r.start.column,a=r.end.column,t+=" - "+n+":"+s);for(var l=Error.prototype.constructor.call(this,t),c=0;c<sr.length;c++)this[sr[c]]=l[sr[c]];Error.captureStackTrace&&Error.captureStackTrace(this,ar);try{r&&(this.lineNumber=n,this.endLineNumber=i,Objec
`,nexist:"\u2204",nexists:"\u2204",Nfr:"\u{1D511}",nfr:"\u{1D52B}",ngE:"\u2267\u0338",nge:"\u2271",ngeq:"\u2271",ngeqq:"\u2267\u0338",ngeqslant:"\u2A7E\u0338",nges:"\u2A7E\u0338",nGg:"\u22D9\u0338",ngsim:"\u2275",nGt:"\u226B\u20D2",ngt:"\u226F",ngtr:"\u226F",nGtv:"\u226B\u0338",nharr:"\u21AE",nhArr:"\u21CE",nhpar:"\u2AF2",ni:"\u220B",nis:"\u22FC",nisd:"\u22FA",niv:"\u220B",NJcy:"\u040A",njcy:"\u045A",nlarr:"\u219A",nlArr:"\u21CD",nldr:"\u2025",nlE:"\u2266\u0338",nle:"\u2270",nleftarrow:"\u219A",nLeftarrow:"\u21CD",nleftrightarrow:"\u21AE",nLeftrightarrow:"\u21CE",nleq:"\u2270",nleqq:"\u2266\u0338",nleqslant:"\u2A7D\u0338",nles:"\u2A7D\u0338",nless:"\u226E",nLl:"\u22D8\u0338",nlsim:"\u2274",nLt:"\u226A\u20D2",nlt:"\u226E",nltri:"\u22EA",nltrie:"\u22EC",nLtv:"\u226A\u0338",nmid:"\u2224",NoBreak:"\u2060",NonBreakingSpace:"\xA0",nopf:"\u{1D55F}",Nopf:"\u2115",Not:"\u2AEC",not:"\xAC",NotCongruent:"\u2262",NotCupCap:"\u226D",NotDoubleVerticalBar:"\u2226",NotElement:"\u2209",NotEqual:"\u2260",NotEqualTilde:"\u2242\u0338",NotExists:"\u2204",NotGreater:"\u226F",NotGreaterEqual:"\u2271",NotGreaterFullEqual:"\u2267\u0338",NotGreaterGreater:"\u226B\u0338",NotGreaterLess:"\u2279",NotGreaterSlantEqual:"\u2A7E\u0338",NotGreaterTilde:"\u2275",NotHumpDownHump:"\u224E\u0338",NotHumpEqual:"\u224F\u0338",notin:"\u2209",notindot:"\u22F5\u0338",notinE:"\u22F9\u0338",notinva:"\u2209",notinvb:"\u22F7",notinvc:"\u22F6",NotLeftTriangleBar:"\u29CF\u0338",NotLeftTriangle:"\u22EA",NotLeftTriangleEqual:"\u22EC",NotLess:"\u226E",NotLessEqual:"\u2270",NotLessGreater:"\u2278",NotLessLess:"\u226A\u0338",NotLessSlantEqual:"\u2A7D\u0338",NotLessTilde:"\u2274",NotNestedGreaterGreater:"\u2AA2\u0338",NotNestedLessLess:"\u2AA1\u0338",notni:"\u220C",notniva:"\u220C",notnivb:"\u22FE",notnivc:"\u22FD",NotPrecedes:"\u2280",NotPrecedesEqual:"\u2AAF\u0338",NotPrecedesSlantEqual:"\u22E0",NotReverseElement:"\u220C",NotRightTriangleBar:"\u29D0\u0338",NotRightTriangle:"\u22EB",NotRightTriangleEqual:"\u22ED",NotSquareSubset:"\u228F\u0338",NotSquareSubsetEqual:"\u22E2",NotSquareSuperset:"\u2290\u0338",NotSquareSupersetEqual:"\u22E3",NotSubset:"\u2282\u20D2",NotSubsetEqual:"\u2288",NotSucceeds:"\u2281",NotSucceedsEqual:"\u2AB0\u0338",NotSucceedsSlantEqual:"\u22E1",NotSucceedsTilde:"\u227F\u0338",NotSuperset:"\u2283\u20D2",NotSupersetEqual:"\u2289",NotTilde:"\u2241",NotTildeEqual:"\u2244",NotTildeFullEqual:"\u2247",NotTildeTilde:"\u2249",NotVerticalBar:"\u2224",nparallel:"\u2226",npar:"\u2226",nparsl:"\u2AFD\u20E5",npart:"\u2202\u0338",npolint:"\u2A14",npr:"\u2280",nprcue:"\u22E0",nprec:"\u2280",npreceq:"\u2AAF\u0338",npre:"\u2AAF\u0338",nrarrc:"\u2933\u0338",nrarr:"\u219B",nrArr:"\u21CF",nrarrw:"\u219D\u0338",nrightarrow:"\u219B",nRightarrow:"\u21CF",nrtri:"\u22EB",nrtrie:"\u22ED",nsc:"\u2281",nsccue:"\u22E1",nsce:"\u2AB0\u0338",Nscr:"\u{1D4A9}",nscr:"\u{1D4C3}",nshortmid:"\u2224",nshortparallel:"\u2226",nsim:"\u2241",nsime:"\u2244",nsimeq:"\u2244",nsmid:"\u2224",nspar:"\u2226",nsqsube:"\u22E2",nsqsupe:"\u22E3",nsub:"\u2284",nsubE:"\u2AC5\u0338",nsube:"\u2288",nsubset:"\u2282\u20D2",nsubseteq:"\u2288",nsubseteqq:"\u2AC5\u0338",nsucc:"\u2281",nsucceq:"\u2AB0\u0338",nsup:"\u2285",nsupE:"\u2AC6\u0338",nsupe:"\u2289",nsupset:"\u2283\u20D2",nsupseteq:"\u2289",nsupseteqq:"\u2AC6\u0338",ntgl:"\u2279",Ntilde:"\xD1",ntilde:"\xF1",ntlg:"\u2278",ntriangleleft:"\u22EA",ntrianglelefteq:"\u22EC",ntriangleright:"\u22EB",ntrianglerighteq:"\u22ED",Nu:"\u039D",nu:"\u03BD",num:"#",numero:"\u2116",numsp:"\u2007",nvap:"\u224D\u20D2",nvdash:"\u22AC",nvDash:"\u22AD",nVdash:"\u22AE",nVDash:"\u22AF",nvge:"\u2265\u20D2",nvgt:">\u20D2",nvHarr:"\u2904",nvinfin:"\u29DE",nvlArr:"\u2902",nvle:"\u2264\u20D2",nvlt:"<\u20D2",nvltrie:"\u22B4\u20D2",nvrArr:"\u2903",nvrtrie:"\u22B5\u20D2",nvsim:"\u223C\u20D2",nwarhk:"\u2923",nwarr:"\u2196",nwArr:"\u21D6",nwarrow:"\u2196",nwnear:"\u2927",Oacute:"\xD3",oacute:"\xF3",oast:"\u229B",Ocirc:"\xD4",ocirc:"\xF4",ocir:"\u229A",Ocy:"\u041E",ocy:"\u043E",odash:"\u229D",Odblac:"\u0150",odblac:"\u0151",odiv:"\u2A38",odot:"\u2299",odsold:"\u29BC",OElig:"\u0152",oelig:"\u01
`)}var pr=function(){function t(e,r,n){n===void 0&&(n="precompile"),this.delegate=e,this.entityParser=r,this.mode=n,this.state="beforeData",this.line=-1,this.column=-1,this.input="",this.index=-1,this.tagNameBuffer="",this.states={beforeData:function(){var i=this.peek();if(i==="<"&&!this.isIgnoredEndTag())this.transitionTo("tagOpen"),this.markTagStart(),this.consume();else{if(this.mode==="precompile"&&i===`
`){var s=this.tagNameBuffer.toLowerCase();(s==="pre"||s==="textarea")&&this.consume()}this.transitionTo("data"),this.delegate.beginData()}},data:function(){var i=this.peek(),s=this.tagNameBuffer;i==="<"&&!this.isIgnoredEndTag()?(this.delegate.finishData(),this.transitionTo("tagOpen"),this.markTagStart(),this.consume()):i==="&"&&s!=="script"&&s!=="style"?(this.consume(),this.delegate.appendToData(this.consumeCharRef()||"&")):(this.consume(),this.delegate.appendToData(i))},tagOpen:function(){var i=this.consume();i==="!"?this.transitionTo("markupDeclarationOpen"):i==="/"?this.transitionTo("endTagOpen"):(i==="@"||i===":"||wn(i))&&(this.transitionTo("tagName"),this.tagNameBuffer="",this.delegate.beginStartTag(),this.appendToTagName(i))},markupDeclarationOpen:function(){var i=this.consume();if(i==="-"&&this.peek()==="-")this.consume(),this.transitionTo("commentStart"),this.delegate.beginComment();else{var s=i.toUpperCase()+this.input.substring(this.index,this.index+6).toUpperCase();s==="DOCTYPE"&&(this.consume(),this.consume(),this.consume(),this.consume(),this.consume(),this.consume(),this.transitionTo("doctype"),this.delegate.beginDoctype&&this.delegate.beginDoctype())}},doctype:function(){var i=this.consume();L(i)&&this.transitionTo("beforeDoctypeName")},beforeDoctypeName:function(){var i=this.consume();L(i)||(this.transitionTo("doctypeName"),this.delegate.appendToDoctypeName&&this.delegate.appendToDoctypeName(i.toLowerCase()))},doctypeName:function(){var i=this.consume();L(i)?this.transitionTo("afterDoctypeName"):i===">"?(this.delegate.endDoctype&&this.delegate.endDoctype(),this.transitionTo("beforeData")):this.delegate.appendToDoctypeName&&this.delegate.appendToDoctypeName(i.toLowerCase())},afterDoctypeName:function(){var i=this.consume();if(!L(i))if(i===">")this.delegate.endDoctype&&this.delegate.endDoctype(),this.transitionTo("beforeData");else{var s=i.toUpperCase()+this.input.substring(this.index,this.index+5).toUpperCase(),a=s.toUpperCase()==="PUBLIC",l=s.toUpperCase()==="SYSTEM";(a||l)&&(this.consume(),this.consume(),this.consume(),this.consume(),this.consume(),this.consume()),a?this.transitionTo("afterDoctypePublicKeyword"):l&&this.transitionTo("afterDoctypeSystemKeyword")}},afterDoctypePublicKeyword:function(){var i=this.peek();L(i)?(this.transitionTo("beforeDoctypePublicIdentifier"),this.consume()):i==='"'?(this.transitionTo("doctypePublicIdentifierDoubleQuoted"),this.consume()):i==="'"?(this.transitionTo("doctypePublicIdentifierSingleQuoted"),this.consume()):i===">"&&(this.consume(),this.delegate.endDoctype&&this.delegate.endDoctype(),this.transitionTo("beforeData"))},doctypePublicIdentifierDoubleQuoted:function(){var i=this.consume();i==='"'?this.transitionTo("afterDoctypePublicIdentifier"):i===">"?(this.delegate.endDoctype&&this.delegate.endDoctype(),this.transitionTo("beforeData")):this.delegate.appendToDoctypePublicIdentifier&&this.delegate.appendToDoctypePublicIdentifier(i)},doctypePublicIdentifierSingleQuoted:function(){var i=this.consume();i==="'"?this.transitionTo("afterDoctypePublicIdentifier"):i===">"?(this.delegate.endDoctype&&this.delegate.endDoctype(),this.transitionTo("beforeData")):this.delegate.appendToDoctypePublicIdentifier&&this.delegate.appendToDoctypePublicIdentifier(i)},afterDoctypePublicIdentifier:function(){var i=this.consume();L(i)?this.transitionTo("betweenDoctypePublicAndSystemIdentifiers"):i===">"?(this.delegate.endDoctype&&this.delegate.endDoctype(),this.transitionTo("beforeData")):i==='"'?this.transitionTo("doctypeSystemIdentifierDoubleQuoted"):i==="'"&&this.transitionTo("doctypeSystemIdentifierSingleQuoted")},betweenDoctypePublicAndSystemIdentifiers:function(){var i=this.consume();L(i)||(i===">"?(this.delegate.endDoctype&&this.delegate.endDoctype(),this.transitionTo("beforeData")):i==='"'?this.transitionTo("doctypeSystemIdentifierDoubleQuoted"):i==="'"&&this.transitionTo("doctypeSystemIdentifierSingleQuoted"))},doctypeSystemIdentifierDoubleQuoted:function(){var i=this.consume();i==='"'?this.transitionTo("afterDoctypeSystemIdentifier"):i===">"?(this.delegate.endDoctype&&this.delegat
`?(this.line++,this.column=0):this.column++,e},t.prototype.consumeCharRef=function(){var e=this.input.indexOf(";",this.index);if(e!==-1){var r=this.input.slice(this.index,e),n=this.entityParser.parse(r);if(n){for(var i=r.length;i;)this.consume(),i--;return this.consume(),n}}},t.prototype.markTagStart=function(){this.delegate.tagOpen()},t.prototype.appendToTagName=function(e){this.tagNameBuffer+=e,this.delegate.appendToTagName(e)},t.prototype.isIgnoredEndTag=function(){var e=this.tagNameBuffer;return e==="title"&&this.input.substring(this.index,this.index+8)!=="</title>"||e==="style"&&this.input.substring(this.index,this.index+8)!=="</style>"||e==="script"&&this.input.substring(this.index,this.index+9)!=="<\/script>"},t}(),Ul=function(){function t(e,r){r===void 0&&(r={}),this.options=r,this.token=null,this.startLine=1,this.startColumn=0,this.tokens=[],this.tokenizer=new pr(this,e,r.mode),this._currentAttribute=void 0}return t.prototype.tokenize=function(e){return this.tokens=[],this.tokenizer.tokenize(e),this.tokens},t.prototype.tokenizePart=function(e){return this.tokens=[],this.tokenizer.tokenizePart(e),this.tokens},t.prototype.tokenizeEOF=function(){return this.tokens=[],this.tokenizer.tokenizeEOF(),this.tokens[0]},t.prototype.reset=function(){this.token=null,this.startLine=1,this.startColumn=0},t.prototype.current=function(){var e=this.token;if(e===null)throw new Error("token was unexpectedly null");if(arguments.length===0)return e;for(var r=0;r<arguments.length;r++)if(e.type===arguments[r])return e;throw new Error("token type was unexpectedly "+e.type)},t.prototype.push=function(e){this.token=e,this.tokens.push(e)},t.prototype.currentAttribute=function(){return this._currentAttribute},t.prototype.addLocInfo=function(){this.options.loc&&(this.current().loc={start:{line:this.startLine,column:this.startColumn},end:{line:this.tokenizer.line,column:this.tokenizer.column}}),this.startLine=this.tokenizer.line,this.startColumn=this.tokenizer.column},t.prototype.beginDoctype=function(){this.push({type:"Doctype",name:""})},t.prototype.appendToDoctypeName=function(e){this.current("Doctype").name+=e},t.prototype.appendToDoctypePublicIdentifier=function(e){var r=this.current("Doctype");r.publicIdentifier===void 0?r.publicIdentifier=e:r.publicIdentifier+=e},t.prototype.appendToDoctypeSystemIdentifier=function(e){var r=this.current("Doctype");r.systemIdentifier===void 0?r.systemIdentifier=e:r.systemIdentifier+=e},t.prototype.endDoctype=function(){this.addLocInfo()},t.prototype.beginData=function(){this.push({type:"Chars",chars:""})},t.prototype.appendToData=function(e){this.current("Chars").chars+=e},t.prototype.finishData=function(){this.addLocInfo()},t.prototype.beginComment=function(){this.push({type:"Comment",chars:""})},t.prototype.appendToCommentData=function(e){this.current("Comment").chars+=e},t.prototype.finishComment=function(){this.addLocInfo()},t.prototype.tagOpen=function(){},t.prototype.beginStartTag=function(){this.push({type:"StartTag",tagName:"",attributes:[],selfClosing:!1})},t.prototype.beginEndTag=function(){this.push({type:"EndTag",tagName:""})},t.prototype.finishTag=function(){this.addLocInfo()},t.prototype.markTagAsSelfClosing=function(){this.current("StartTag").selfClosing=!0},t.prototype.appendToTagName=function(e){this.current("StartTag","EndTag").tagName+=e},t.prototype.beginAttribute=function(){this._currentAttribute=["","",!1]},t.prototype.appendToAttributeName=function(e){this.currentAttribute()[0]+=e},t.prototype.beginAttributeValue=function(e){this.currentAttribute()[2]=e},t.prototype.appendToAttributeValue=function(e){this.currentAttribute()[1]+=e},t.prototype.finishAttributeValue=function(){this.current("StartTag").attributes.push(this._currentAttribute)},t.prototype.reportSyntaxError=function(e){this.current().syntaxError=e},t}();var os=/[\xA0"&]/,Ml=new RegExp(os.source,"g"),ls=/[\xA0&<>]/,Gl=new RegExp(ls.source,"g");var Pt=Object.create(null),cs="area base br col command embed hr img input keygen link meta param source track wbr";cs.split(" ").forEach(t=>{Pt[t]=!0});var Y=Object.freeze({line:1
`,n);if(e<=i||i===-1)return{line:r+1,column:e-n};r+=1,n=i+1}}charPosFor(e){let{line:r,column:n}=e,s=this.source.length,a=0,l=0;for(;;){if(l>=s)return s;let c=this.source.indexOf(`
`,l);if(c===-1&&(c=this.source.length),a===r-1){if(l+n>c)return c;if(!1){let h=this.hbsPosFor(l+n)}return l+n}else{if(c===-1)return 0;a+=1,l=c+1}}}};function S(t,e){let{module:r,loc:n}=e,{line:i,column:s}=n.start,a=e.asString(),l=a?`
|
| ${a.split(`
`).join(`
| `)}
|
`:"",c=new Error(`${t}: ${l}(error occurred in '${r}' @ line ${i} : column ${s})`);return c.name="SyntaxError",c.location=e,c.code=a,c}var ps={Program:T("body"),Template:T("body"),Block:T("body"),MustacheStatement:T("path","params","hash"),BlockStatement:T("path","params","hash","program","inverse"),ElementModifierStatement:T("path","params","hash"),PartialStatement:T("name","params","hash"),CommentStatement:T(),MustacheCommentStatement:T(),ElementNode:T("attributes","modifiers","children","comments"),AttrNode:T("value"),TextNode:T(),ConcatStatement:T("parts"),SubExpression:T("path","params","hash"),PathExpression:T(),PathHead:T(),StringLiteral:T(),BooleanLiteral:T(),NumberLiteral:T(),NullLiteral:T(),UndefinedLiteral:T(),Hash:T("pairs"),HashPair:T("value"),NamedBlock:T("attributes","modifiers","children","comments"),SimpleElement:T("attributes","modifiers","children","comments"),Component:T("head","attributes","modifiers","children","comments")},Pn=ps;var mr=function(){t.prototype=Object.create(Error.prototype),t.prototype.constructor=t;function t(e,r,n,i){let s=Error.call(this,e);this.key=i,this.message=e,this.node=r,this.parent=n,this.stack=s.stack}return t}();function gr(t,e,r){return new mr("Cannot remove a node unless it is part of an array",t,e,r)}function Nn(t,e,r){return new mr("Cannot replace a node with multiple nodes unless it is part of an array",t,e,r)}function br(t,e){return new mr("Replacing and removing in key handlers is not yet supported.",t,null,e)}var be=class{constructor(e,r=null,n=null){this.node=e,this.parent=r,this.parentKey=n}get parentNode(){return this.parent?this.parent.node:null}parents(){return{[Symbol.iterator]:()=>new yr(this)}}},yr=class{constructor(e){this.path=e}next(){return this.path.parent?(this.path=this.path.parent,{done:!1,value:this.path}):{done:!0,value:null}}};function An(t){return typeof t=="function"?t:t.enter}function _n(t){if(typeof t!="function")return t.exit}function fs(t,e){let r=typeof t!="function"?t.keys:void 0;if(r===void 0)return;let n=r[e];return n!==void 0?n:r.All}function ds(t,e){if((e==="Template"||e==="Block")&&t.Program)return t.Program;let r=t[e];return r!==void 0?r:t.All}function Lt(t,e){let{node:r,parent:n,parentKey:i}=e,s=ds(t,r.type),a,l;s!==void 0&&(a=An(s),l=_n(s));let c;if(a!==void 0&&(c=a(r,e)),c!=null)if(JSON.stringify(r)===JSON.stringify(c))c=void 0;else{if(Array.isArray(c))return Ln(t,c,n,i),c;{let h=new be(c,n,i);return Lt(t,h)||c}}if(c===void 0){let h=Pn[r.type];for(let g=0;g<h.length;g++){let y=h[g];gs(t,s,e,y)}l!==void 0&&(c=l(r,e))}return c}function ms(t,e){return t[e]}function Cn(t,e,r){t[e]=r}function gs(t,e,r,n){let{node:i}=r,s=ms(i,n);if(!s)return;let a,l;if(e!==void 0){let c=fs(e,n);c!==void 0&&(a=An(c),l=_n(c))}if(a!==void 0&&a(i,n)!==void 0)throw br(i,n);if(Array.isArray(s))Ln(t,s,r,n);else{let c=new be(s,r,n),h=Lt(t,c);h!==void 0&&bs(i,n,s,h)}if(l!==void 0&&l(i,n)!==void 0)throw br(i,n)}function Ln(t,e,r,n){for(let i=0;i<e.length;i++){let s=e[i],a=new be(s,r,n),l=Lt(t,a);l!==void 0&&(i+=ys(e,i,l)-1)}}function bs(t,e,r,n){if(n===null)throw gr(r,t,e);if(Array.isArray(n))if(n.length===1)Cn(t,e,n[0]);else throw n.length===0?gr(r,t,e):Nn(r,t,e);else Cn(t,e,n)}function ys(t,e,r){return r===null?(t.splice(e,1),0):Array.isArray(r)?(t.splice(e,1,...r),r.length):(t.splice(e,1,r),1)}function Sr(t,e){let r=new be(t);Lt(e,r)}var Ss=/[!"#%-,\.\/;->@\[-\^`\{-~]/;function Dn(t){let e=Es(t);e&&(t.blockParams=e)}function Es(t){let e=t.attributes.length,r=[];for(let i=0;i<e;i++)r.push(t.attributes[i].name);let n=r.indexOf("as");if(n===-1&&r.length>0&&r[r.length-1].charAt(0)==="|")throw S("Block parameters must be preceded by the `as` keyword, detected block parameters without `as`",t.loc);if(n!==-1&&e>n&&r[n+1].charAt(0)==="|"){let i=r.slice(n).join(" ");if(i.charAt(i.length-1)!=="|"||i.match(/\|/g).length!==2)throw S("Invalid block parameters syntax, '"+i+"'",t.loc);let s=[];for(let a=n+1;a<e;a++){let l=r[a].replace(/\|/g,"");if(l!==""){if(Ss.test(l))throw S("Invalid identifier for block parameters, '"+l+"'",t.loc);s.push(l)}}if(s.length===0)throw S("C
`)}};var Bt=class extends It{get isTopLevel(){return this.elementStack.length===0}Program(e){let r=[],n;this.isTopLevel?n=x.template({body:r,blockParams:e.blockParams,loc:this.source.spanFor(e.loc)}):n=x.blockItself({body:r,blockParams:e.blockParams,chained:e.chained,loc:this.source.spanFor(e.loc)});let i,s=e.body.length;if(this.elementStack.push(n),s===0)return this.elementStack.pop();for(i=0;i<s;i++)this.acceptNode(e.body[i]);let a=this.elementStack.pop();if(a!==n){let l=a;throw S(`Unclosed element \`${l.tag}\``,l.loc)}return n}BlockStatement(e){if(this.tokenizer.state==="comment"){this.appendToCommentData(this.sourceForNode(e));return}if(this.tokenizer.state!=="data"&&this.tokenizer.state!=="beforeData")throw S("A block may only be used inside an HTML element or another block.",this.source.spanFor(e.loc));let{path:r,params:n,hash:i}=kr(this,e);e.program.loc||(e.program.loc=Fe),e.inverse&&!e.inverse.loc&&(e.inverse.loc=Fe);let s=this.Program(e.program),a=e.inverse?this.Program(e.inverse):null,l=x.block({path:r,params:n,hash:i,defaultBlock:s,elseBlock:a,loc:this.source.spanFor(e.loc),openStrip:e.openStrip,inverseStrip:e.inverseStrip,closeStrip:e.closeStrip}),c=this.currentElement();ye(c,l)}MustacheStatement(e){let{tokenizer:r}=this;if(r.state==="comment"){this.appendToCommentData(this.sourceForNode(e));return}let n,{escaped:i,loc:s,strip:a}=e;if(Er(e.path))n=x.mustache({path:this.acceptNode(e.path),params:[],hash:x.hash([],this.source.spanFor(e.path.loc).collapse("end")),trusting:!i,loc:this.source.spanFor(s),strip:a});else{let{path:l,params:c,hash:h}=kr(this,e);n=x.mustache({path:l,params:c,hash:h,trusting:!i,loc:this.source.spanFor(s),strip:a})}switch(r.state){case"tagOpen":case"tagName":throw S("Cannot use mustaches in an elements tagname",n.loc);case"beforeAttributeName":Pr(this.currentStartTag,n);break;case"attributeName":case"afterAttributeName":this.beginAttributeValue(!1),this.finishAttributeValue(),Pr(this.currentStartTag,n),r.transitionTo("beforeAttributeName");break;case"afterAttributeValueQuoted":Pr(this.currentStartTag,n),r.transitionTo("beforeAttributeName");break;case"beforeAttributeValue":this.beginAttributeValue(!1),this.appendDynamicAttributeValuePart(n),r.transitionTo("attributeValueUnquoted");break;case"attributeValueDoubleQuoted":case"attributeValueSingleQuoted":case"attributeValueUnquoted":this.appendDynamicAttributeValuePart(n);break;default:ye(this.currentElement(),n)}return n}appendDynamicAttributeValuePart(e){this.finalizeTextPart();let r=this.currentAttr;r.isDynamic=!0,r.parts.push(e)}finalizeTextPart(){let r=this.currentAttr.currentPart;r!==null&&(this.currentAttr.parts.push(r),this.startTextPart())}startTextPart(){this.currentAttr.currentPart=null}ContentStatement(e){Gs(this.tokenizer,e),this.tokenizer.tokenizePart(e.value),this.tokenizer.flushData()}CommentStatement(e){let{tokenizer:r}=this;if(r.state==="comment")return this.appendToCommentData(this.sourceForNode(e)),null;let{value:n,loc:i}=e,s=x.mustacheComment(n,this.source.spanFor(i));switch(r.state){case"beforeAttributeName":case"afterAttributeName":this.currentStartTag.comments.push(s);break;case"beforeData":case"data":ye(this.currentElement(),s);break;default:throw S(`Using a Handlebars comment when in the \`${r.state}\` state is not supported`,this.source.spanFor(e.loc))}return s}PartialStatement(e){throw S("Handlebars partials are not supported",this.source.spanFor(e.loc))}PartialBlockStatement(e){throw S("Handlebars partial blocks are not supported",this.source.spanFor(e.loc))}Decorator(e){throw S("Handlebars decorators are not supported",this.source.spanFor(e.loc))}DecoratorBlock(e){throw S("Handlebars decorator blocks are not supported",this.source.spanFor(e.loc))}SubExpression(e){let{path:r,params:n,hash:i}=kr(this,e);return x.sexpr({path:r,params:n,hash:i,loc:this.source.spanFor(e.loc)})}PathExpression(e){let{original:r}=e,n;if(r.indexOf("/")!==-1){if(r.slice(0,2)==="./")throw S('Using "./" is not supported in Glimmer and unnecessary',this.source.spanFor(e.loc));if(r.slice(0,3)==="../")throw S('Changing context using "../" is
`).length-1,columns:0};let n=t.split(e)[0].split(/\n/),i=n.length-1;return{lines:i,columns:n[i].length}}function Gs(t,e){let r=e.loc.start.line,n=e.loc.start.column,i=Ms(e.original,e.value);r=r+i.lines,i.lines?n=i.columns:n=n+i.columns,t.line=r,t.column=n}function kr(t,e){if(e.path.type.endsWith("Literal")){let a=e.path,l="";throw a.type==="BooleanLiteral"?l=a.original.toString():a.type==="StringLiteral"?l=`"${a.original}"`:a.type==="NullLiteral"?l="null":a.type==="NumberLiteral"?l=a.value.toString():l="undefined",S(`${a.type} "${a.type==="StringLiteral"?a.original:l}" cannot be called as a sub-expression, replace (${l}) with ${l}`,t.source.spanFor(a.loc))}let r=e.path.type==="PathExpression"?t.PathExpression(e.path):t.SubExpression(e.path),n=e.params?e.params.map(a=>t.acceptNode(a)):[],i=n.length>0?n[n.length-1].loc:r.loc,s=e.hash?t.Hash(e.hash):{type:"Hash",pairs:[],loc:t.source.spanFor(i).collapse("end")};return{path:r,params:n,hash:s}}function Pr(t,e){let{path:r,params:n,hash:i,loc:s}=e;if(Er(r)){let l=`{{${On(r)}}}`,c=`<${t.name} ... ${l} ...`;throw S(`In ${c}, ${l} is not a valid modifier`,e.loc)}let a=x.elementModifier({path:r,params:n,hash:i,loc:s});t.modifiers.push(a)}var Nr=class extends Bt{constructor(){super(...arguments),this.tagOpenLine=0,this.tagOpenColumn=0}reset(){this.currentNode=null}beginComment(){this.currentNode=x.comment("",this.source.offsetFor(this.tagOpenLine,this.tagOpenColumn))}appendToCommentData(e){this.currentComment.value+=e}finishComment(){ye(this.currentElement(),this.finish(this.currentComment))}beginData(){this.currentNode=x.text({chars:"",loc:this.offset().collapsed()})}appendToData(e){this.currentData.chars+=e}finishData(){this.currentData.loc=this.currentData.loc.withEnd(this.offset()),ye(this.currentElement(),this.currentData)}tagOpen(){this.tagOpenLine=this.tokenizer.line,this.tagOpenColumn=this.tokenizer.column}beginStartTag(){this.currentNode={type:"StartTag",name:"",attributes:[],modifiers:[],comments:[],selfClosing:!1,loc:this.source.offsetFor(this.tagOpenLine,this.tagOpenColumn)}}beginEndTag(){this.currentNode={type:"EndTag",name:"",attributes:[],modifiers:[],comments:[],selfClosing:!1,loc:this.source.offsetFor(this.tagOpenLine,this.tagOpenColumn)}}finishTag(){let e=this.finish(this.currentTag);if(e.type==="StartTag"){if(this.finishStartTag(),e.name===":")throw S("Invalid named block named detected, you may have created a named block without a name, or you may have began your name with a number. Named blocks must have names that are at least one character long, and begin with a lower case letter",this.source.spanFor({start:this.currentTag.loc.toJSON(),end:this.offset().toJSON()}));(Pt[e.name]||e.selfClosing)&&this.finishEndTag(!0)}else e.type==="EndTag"&&this.finishEndTag(!1)}finishStartTag(){let{name:e,attributes:r,modifiers:n,comments:i,selfClosing:s,loc:a}=this.finish(this.currentStartTag),l=x.element({tag:e,selfClosing:s,attrs:r,modifiers:n,comments:i,children:[],blockParams:[],loc:a});this.elementStack.push(l)}finishEndTag(e){let r=this.finish(this.currentTag),n=this.elementStack.pop(),i=this.currentElement();this.validateEndTag(r,n,e),n.loc=n.loc.withEnd(this.offset()),Dn(n),ye(i,n)}markTagAsSelfClosing(){this.currentTag.selfClosing=!0}appendToTagName(e){this.currentTag.name+=e}beginAttribute(){let e=this.offset();this.currentAttribute={name:"",parts:[],currentPart:null,isQuoted:!1,isDynamic:!1,start:e,valueSpan:e.collapsed()}}appendToAttributeName(e){this.currentAttr.name+=e}beginAttributeValue(e){this.currentAttr.isQuoted=e,this.startTextPart(),this.currentAttr.valueSpan=this.offset().collapsed()}appendToAttributeValue(e){let r=this.currentAttr.parts,n=r[r.length-1],i=this.currentAttr.currentPart;if(i)i.chars+=e,i.loc=i.loc.withEnd(this.offset());else{let s=this.offset();e===`
`?s=n?n.loc.getEnd():this.currentAttr.valueSpan.getStart():s=s.move(-1),this.currentAttr.currentPart=x.text({chars:e,loc:s.collapsed()})}}finishAttributeValue(){this.finalizeTextPart();let e=this.currentTag,r=this.offset();if(e.type==="EndTag")throw S("Invalid end tag: closing tag must not have attributes",this.source.spanFor({start:e.loc.toJSON(),end:r.toJSON()}));let{name:n,parts:i,start:s,isQuoted:a,isDynamic:l,valueSpan:c}=this.currentAttr,h=this.assembleAttributeValue(i,a,l,s.until(r));h.loc=c.withEnd(r);let g=x.attr({name:n,value:h,loc:s.until(r)});this.currentStartTag.attributes.push(g)}reportSyntaxError(e){throw S(e,this.offset().collapsed())}assembleConcatenatedValue(e){for(let i=0;i<e.length;i++){let s=e[i];if(s.type!=="MustacheStatement"&&s.type!=="TextNode")throw S("Unsupported node in quoted attribute value: "+s.type,s.loc)}mn(e,"the concatenation parts of an element should not be empty");let r=e[0],n=e[e.length-1];return x.concat(e,this.source.spanFor(r.loc).extend(this.source.spanFor(n.loc)))}validateEndTag(e,r,n){let i;if(Pt[e.name]&&!n?i=`<${e.name}> elements do not need end tags. You should remove it`:r.tag===void 0?i=`Closing tag </${e.name}> without an open tag`:r.tag!==e.name&&(i=`Closing tag </${e.name}> did not match last open tag <${r.tag}> (on line ${r.loc.startPosition.line})`),i)throw S(i,e.loc)}assembleAttributeValue(e,r,n,i){if(n){if(r)return this.assembleConcatenatedValue(e);if(e.length===1||e.length===2&&e[1].type==="TextNode"&&e[1].chars==="/")return e[0];throw S("An unquoted attribute value must be a string or a mustache, preceded by whitespace or a '=' character, and followed by whitespace, a '>' character, or '/>'",i)}else return e.length>0?e[0]:x.text({chars:"",loc:i})}},Ys={},Cr=class extends kt{constructor(){super({})}parse(){}};function Un(t,e={}){var r,n,i;let s=e.mode||"precompile",a,l;typeof t=="string"?(a=new ie(t,(r=e.meta)===null||r===void 0?void 0:r.moduleName),s==="codemod"?l=xt(t,e.parseOptions):l=hr(t,e.parseOptions)):t instanceof ie?(a=t,s==="codemod"?l=xt(t.source,e.parseOptions):l=hr(t.source,e.parseOptions)):(a=new ie("",(n=e.meta)===null||n===void 0?void 0:n.moduleName),l=t);let c;s==="codemod"&&(c=new Cr);let h=P.forCharPositions(a,0,a.source.length);l.loc={source:"(program)",start:h.startPosition,end:h.endPosition};let g=new Nr(a,c,s).acceptTemplate(l);if(e.strictMode&&(g.blockParams=(i=e.locals)!==null&&i!==void 0?i:[]),e&&e.plugins&&e.plugins.ast)for(let y=0,F=e.plugins.ast.length;y<F;y++){let b=e.plugins.ast[y],k=pe({},e,{syntax:Ys},{plugins:void 0}),N=b(k);Sr(g,N.visitor)}return g}var Rt=`
`,Fn="\r",Mn=function(){function t(e){this.length=e.length;for(var r=[0],n=0;n<e.length;)switch(e[n]){case Rt:n+=Rt.length,r.push(n);break;case Fn:n+=Fn.length,e[n]===Rt&&(n+=Rt.length),r.push(n);break;default:n++;break}this.offsets=r}return t.prototype.locationForIndex=function(e){if(e<0||e>this.length)return null;for(var r=0,n=this.offsets;n[r+1]<=e;)r++;var i=e-n[r];return{line:r,column:i}},t.prototype.indexForLocation=function(e){var r=e.line,n=e.column;return r<0||r>=this.offsets.length||n<0||n>this.lengthOfLine(r)?null:this.offsets[r]+n},t.prototype.lengthOfLine=function(e){var r=this.offsets[e],n=e===this.offsets.length-1?this.length:this.offsets[e+1];return n-r},t}();function zs(t,e){let r=new SyntaxError(t+" ("+e.loc.start.line+":"+e.loc.start.column+")");return Object.assign(r,e)}var Gn=zs;function Ws(t){let e=t.children??t.body;if(e)for(let r=0;r<e.length-1;r++)e[r].type==="TextNode"&&e[r+1].type==="MustacheStatement"&&(e[r].chars=e[r].chars.replace(/\\$/,"\\\\"))}function Ks(t){let e=new Mn(t),r=({line:i,column:s})=>e.indexForLocation({line:i-1,column:s}),n=i=>{let{start:s,end:a}=i.loc;s.offset=r(s),a.offset=r(a)};return()=>({name:"prettierParsePlugin",visitor:{All(i){n(i),Ws(i)}}})}function js(t){let e;try{e=Un(t,{mode:"codemod",plugins:{ast:[Ks(t)]}})}catch(r){let n=Js(r);if(n){let i=Qs(r);throw Gn(i,{loc:n,cause:r})}throw r}return e}function Qs(t){let{message:e}=t,r=e.split(`
`);return r.length>=4&&/^Parse error on line \d+:$/.test(r[0])&&/^-*\^$/.test(he(!1,r,-2))?he(!1,r,-1):r.length>=4&&/:\s?$/.test(r[0])&&/^\(error occurred in '.*?' @ line \d+ : column \d+\)$/.test(he(!1,r,-1))&&r[1]===""&&he(!1,r,-2)===""&&r.slice(2,-2).every(n=>n.startsWith("|"))?r[0].trim().slice(0,-1):e}function Js(t){let{location:e,hash:r}=t;if(e){let{start:n,end:i}=e;return typeof i.line!="number"?{start:n}:e}if(r){let{loc:{last_line:n,last_column:i}}=r;return{start:{line:n,column:i+1}}}}var Xs={parse:js,astFormat:"glimmer",locStart:xe,locEnd:tt};var Yn=[{linguistLanguageId:155,name:"Handlebars",type:"markup",color:"#f7931e",aliases:["hbs","htmlbars"],extensions:[".handlebars",".hbs"],tmScope:"text.html.handlebars",aceMode:"handlebars",parsers:["glimmer"],vscodeLanguageIds:["handlebars"]}];var $s={glimmer:fn};var Fu=_r;export{Fu as default,Yn as languages,Ar as parsers,$s as printers};