fediversity.eu/node_modules/prettier/plugins/glimmer.mjs

31 lines
134 KiB
JavaScript
Raw Normal View History

2024-03-26 16:28:28 +01:00
var es=Object.defineProperty;var Yt=(t,e)=>{for(var r in e)es(t,r,{get:e[r],enumerable:!0})};var Ur=(t,e,r)=>{if(!e.has(t))throw TypeError("Cannot "+r)};var W=(t,e,r)=>(Ur(t,e,"read from private field"),r?r.call(t):e.get(t)),zt=(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)},Wt=(t,e,r,n)=>(Ur(t,e,"write to private field"),n?n.call(t,r):e.set(t,r),r);var Rr={};Yt(Rr,{languages:()=>yn,parsers:()=>Ir,printers:()=>pa});var ts=(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)},Kt=ts;var Me="string",Ge="array",Ye="cursor",Le="indent",_e="align",ze="trim",De="group",Oe="fill",Be="if-break",We="indent-if-break",Ke="line-suffix",je="line-suffix-boundary",J="line",$e="label",Ie="break-parent",ft=new Set([Ye,Le,_e,ze,De,Oe,Be,We,Ke,je,J,$e,Ie]);function rs(t){if(typeof t=="string")return Me;if(Array.isArray(t))return Ge;if(!t)return;let{type:e}=t;if(ft.has(e))return e}var Qe=rs;var ns=t=>new Intl.ListFormat("en-US",{type:"disjunction"}).format(t);function ss(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(Qe(t))throw new Error("doc is valid.");let r=Object.prototype.toString.call(t);if(r!=="[object Object]")return`Unexpected doc '${r}'.`;let n=ns([...ft].map(s=>`'${s}'`));return`Unexpected doc.type '${t.type}'.
Expected it to be ${n}.`}var jt=class extends Error{name="InvalidDocError";constructor(e){super(ss(e)),this.doc=e}},$t=jt;var Mr=()=>{},ge=Mr,dt=Mr;function O(t){return ge(t),{type:Le,contents:t}}function is(t,e){return ge(e),{type:_e,contents:e,n:t}}function B(t,e={}){return ge(t),dt(e.expandedStates,!0),{type:De,id:e.id,contents:t,break:!!e.shouldBreak,expandedStates:e.expandedStates}}function Qt(t){return is(-1,t)}function Xt(t){return dt(t),{type:Oe,parts:t}}function Jt(t,e="",r={}){return ge(t),e!==""&&ge(e),{type:Be,breakContents:t,flatContents:e,groupId:r.groupId}}var Gr={type:Ie};var as={type:J,hard:!0},os={type:J,hard:!0,literal:!0},C={type:J},G={type:J,soft:!0},be=[as,Gr],Yr=[os,Gr];function ye(t,e){ge(t),dt(e);let r=[];for(let n=0;n<e.length;n++)n!==0&&r.push(t),r.push(e[n]);return r}var ls=(t,e,r)=>{if(!(t&&e==null))return Array.isArray(e)||typeof e=="string"?e[r<0?e.length+r:r]:e.at(r)},oe=ls;function cs(t,e){if(typeof t=="string")return e(t);let r=new Map;return n(t);function n(i){if(r.has(i))return r.get(i);let a=s(i);return r.set(i,a),a}function s(i){switch(Qe(i)){case Ge:return e(i.map(n));case Oe:return e({...i,parts:i.parts.map(n)});case Be:return e({...i,breakContents:n(i.breakContents),flatContents:n(i.flatContents)});case De:{let{expandedStates:a,contents:o}=i;return a?(a=a.map(n),o=a[0]):o=n(o),e({...i,contents:o,expandedStates:a})}case _e:case Le:case We:case $e:case Ke:return e({...i,contents:n(i.contents)});case Me:case Ye:case ze:case je:case J:case Ie:return e(i);default:throw new $t(i)}}}function zr(t,e=Yr){return cs(t,r=>typeof r=="string"?ye(e,r.split(`
`)):r)}var mt="'",Wr='"';function us(t,e){let r=e===!0||e===mt?mt:Wr,n=r===mt?Wr:mt,s=0,i=0;for(let a of t)a===r?s++:a===n&&i++;return s>i?n:r}var gt=us;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){zt(this,U,void 0);Wt(this,U,new Set(e))}getLeadingWhitespaceCount(e){let r=W(this,U),n=0;for(let s=0;s<e.length&&r.has(e.charAt(s));s++)n++;return n}getTrailingWhitespaceCount(e){let r=W(this,U),n=0;for(let s=e.length-1;s>=0&&r.has(e.charAt(s));s--)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 W(this,U).has(e.charAt(0))}hasTrailingWhitespace(e){return W(this,U).has(oe(!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([...W(this,U)].join(""))}]+`,s=new RegExp(r?`(${n})`:n);return e.split(s)}hasWhitespaceCharacter(e){let r=W(this,U);return Array.prototype.some.call(e,n=>r.has(n))}hasNonWhitespaceCharacter(e){let r=W(this,U);return Array.prototype.some.call(e,n=>!r.has(n))}isWhitespaceOnly(e){let r=W(this,U);return Array.prototype.every.call(e,n=>r.has(n))}};U=new WeakMap;var Kr=er;var hs=[" ",`
`,"\f","\r"," "],ps=new Kr(hs),Y=ps;function fs(t){return Array.isArray(t)&&t.length>0}var Xe=fs;var tr=class extends Error{name="UnexpectedNodeError";constructor(e,r,n="type"){super(`Unexpected ${r} node ${n}: ${JSON.stringify(e[n])}.`),this.node=e}},jr=tr;function $r(t,e){if(t.type==="TextNode"){let r=t.chars.trim();if(!r)return null;e.chars=Y.split(r).join(" ")}t.type==="ElementNode"&&(delete e.startTag,delete e.parts,delete e.endTag,delete e.nameNode),(t.type==="Block"||t.type==="ElementNode")&&delete e.blockParamNodes,t.type==="AttrNode"&&t.name.toLowerCase()==="class"&&delete e.value}$r.ignoredProperties=new Set(["loc","selfClosing"]);var Qr=$r;var Je=null;function Ze(t){if(Je!==null&&typeof Je.property){let e=Je;return Je=Ze.prototype=null,e}return Je=Ze.prototype=t??Object.create(null),new Ze}var ds=10;for(let t=0;t<=ds;t++)Ze();function rr(t){return Ze(t)}function ms(t,e="type"){rr(t);function r(n){let s=n[e],i=t[s];if(!Array.isArray(i))throw Object.assign(new Error(`Missing visitor keys for '${s}'.`),{node:n});return i}return r}var Xr=ms;var Jr={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 gs=Xr(Jr),Zr=gs;function Ee(t){return t.loc.start.offset}function et(t){return t.loc.end.offset}var en=new Set(["area","base","br","col","command","embed","hr","img","input","keygen","link","meta","param","source","track","wbr"]);function rn(t){return t.toUpperCase()===t}function bs(t){return t.type==="ElementNode"&&typeof t.tag=="string"&&!t.tag.startsWith(":")&&(rn(t.tag[0])||t.tag.includes("."))}function ys(t){return en.has(t.toLowerCase())&&!rn(t[0])}function nr(t){return t.selfClosing===!0||ys(t.tag)||bs(t)&&t.children.every(e=>bt(e))}function bt(t){return t.type==="TextNode"&&!/\S/.test(t.chars)}function tn(t){return(t==null?void 0:t.type)==="MustacheCommentStatement"&&typeof t.value=="string"&&t.value.trim()==="prettier-ignore"}function nn(t){return tn(t.node)||t.isInArray&&(t.key==="children"||t.key==="body"||t.key==="parts")&&tn(t.siblings[t.index-2])}var pn=2;function Es(t,e,r){var s,i,a,o,c,h,g,E,M;let{node:n}=t;switch(n.type){case"Block":case"Program":case"Template":return B(t.map(r,"body"));case"ElementNode":{let b=B(ks(t,r)),v=e.htmlWhitespaceSensitivity==="ignore"&&((s=t.next)==null?void 0:s.type)==="ElementNode"?G:"";if(nr(n))return[b,v];let L=["</",n.tag,">"];return n.children.length===0?[b,O(L),v]:e.htmlWhitespaceSensitivity==="ignore"?[b,O(sn(t,e,r)),be,O(L),v]:[b,O(B(sn(t,e,r))),O(L),v]}case"BlockStatement":return Ps(t)?[xs(t,r),ln(t,r,e),cn(t,r,e)]:[vs(t,r),B([ln(t,r,e),cn(t,r,e),Cs(t,r,e)])];case"ElementModifierStatement":return B(["{{",hn(t,r),"}}"]);case"MustacheStatement":return B([yt(n),hn(t,r),Et(n)]);case"SubExpression":return B(["(",Rs(t,r),G,")"]);case"AttrNode":{let{name:b,value:v}=n,L=v.type==="TextNode";if(L&&v.chars===""&&Ee(v)===et(v))return b;let T=L?gt(v.chars,e.singleQuote):v.type==="ConcatStatement"?gt(v.parts.map(H=>H.type==="TextNode"?H.chars:"").join(""),e.singleQuote):"",te=r("value");return[b,"=",T,b==="class"&&T?B(O(te)):te,T]}case"ConcatStatement":return t.map(r,"parts");case"Hash":return ye(C,t.map(r,"pairs"));case"HashPair":return[n.key,"=",r("value")];case"TextNode":{let b=Kt(!1,n.chars,"{{","\\{{"),v=_s(t);if(v){if(v==="class"){let Q=b.trim().split(/\s+/).join(" "),re=!1,q=!1;return t.parent.type==="ConcatStatement"&&(((i=t.previous)==null?
`).length-1}function Ds(t){t=typeof t=="string"?t:"";let e=(t.match(/^([^\S\n\r]*[\n\r])+/g)||[])[0]||"";return Re(e)}function Os(t){t=typeof t=="string"?t:"";let e=(t.match(/([\n\r][^\S\n\r]*)+$/g)||[])[0]||"";return Re(e)}function tt(t=0){return Array.from({length:Math.min(t,pn)}).fill(be)}function Bs(t,e){let{node:{value:r}}=t,n=gt(r,Is(t)?!e.singleQuote:e.singleQuote);return[n,Kt(!1,r,n,`\\${n}`),n]}function Is(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 Rs(t,e){let r=sr(t,e),n=St(t,e);return n?O([r,C,B(n)]):r}function hn(t,e){let r=sr(t,e),n=St(t,e);return n?[O([r,C,n]),G]:r}function sr(t,e){return e("path")}function St(t,e){var s;let{node:r}=t,n=[];return r.params.length>0&&n.push(...t.map(e,"params")),((s=r.hash)==null?void 0:s.pairs.length)>0&&n.push(e("hash")),n.length===0?"":ye(C,n)}function ir(t){return["as |",t.blockParams.join(" "),"|"]}var Hs=new Set("!\"#%&'()*+,./;<=>@[\\]^`{|}~"),qs=new Set(["true","false","null","undefined"]),Vs=(t,e)=>e!==0&&qs.has(t)||/\s/.test(t)||/^\d/.test(t)||Array.prototype.some.call(t,r=>Hs.has(r));function Fs(t){if(t.data||t.parts.length===1&&t.original.includes("/"))return t.original;let{parts:e}=t;return t.this&&(e=["this",...e]),e.map((r,n)=>Vs(r,n)?`[${r}]`:r).join(".")}var Us={print:Es,massageAstNode:Qr,hasPrettierIgnore:nn,getVisitorKeys:Zr},bn=Us;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 Ir={};Yt(Ir,{glimmer:()=>ha});var Ms=Object.freeze([]);function Sn(){return Ms}var Po=Sn(),xo=Sn();function P(t,e){if(!t)throw new Error(e||"assertion failure")}function Z(t){if(t==null)throw new Error("Expected value to be present");return t}function ar(t,e){if(t==null)throw new Error(e);return t}function Se(t){return t.length>0}function rt(t,e="unexpected empty list"){if(!Se(t))throw new Error(e)}function wt(t,e="unexpected empty list"){return rt(t,e),t}function Tt(t){return t.length===0?void 0:t[t.length-1]}function Nt(t){return t.length===0?void 0:t[0]}var Gs;if(!1){let t=n=>{let s=n.name;if(s===void 0){let i=/function (\w+)\s*\(/u.exec(String(n));s=i&&i[1]||""}return s.replace(/^bound /u,"")},e=n=>{let s,i;return n.constructor&&typeof n.constructor=="function"&&(i=t(n.constructor)),"toString"in n&&n.toString!==Object.prototype.toString&&n.toString!==Function.prototype.toString&&(s=n.toString()),s&&/<.*:ember\d+>/u.test(s)&&i&&i[0]!=="_"&&i.length>2&&i!=="Class"?s.replace(/<.*:/u,`<${i}:`):s||i},r=n=>String(n);Gs=n=>typeof n=="function"?t(n)||"(unknown function)":typeof n=="object"&&n!==null?e(n)||"(unknown object)":r(n)}var or=function(t){return t[t.MAX_SMI=1073741823]="MAX_SMI",t[t.MIN_SMI=-1073741824]="MIN_SMI",t[t.SIGN_BIT=-536870913]="SIGN_BIT",t[t.MAX_INT=536870911]="MAX_INT",t[t.MIN_INT=-536870912]="MIN_INT",t[t.FALSE_HANDLE=0]="FALSE_HANDLE",t[t.TRUE_HANDLE=1]="TRUE_HANDLE",t[t.NULL_HANDLE=2]="NULL_HANDLE",t[t.UNDEFINED_HANDLE=3]="UNDEFINED_HANDLE",t[t.ENCODED_FALSE_HANDLE=0]="ENCODED_FALSE_HANDLE",t[t.ENCODED_TRUE_HANDLE=1]="ENCODED_TRUE_HANDLE",t[t.ENCODED_NULL_HANDLE=2]="ENCODED_NULL_HANDLE",t[t.ENCODED_UNDEFINED_HANDLE=3]="ENCODED_UNDEFINED_HANDLE",t}({});function Ys(t){return t&or.SIGN_BIT}function zs(t){return t|~or.SIGN_BIT}function Ws(t){return~t}function Ks(t){return~t}function js(t){return t|=0,t<0?Ys(t):Ws(t)}function $s(t){return t|=0,t>or.SIGN_BIT?Ks(t):zs(t)}[1,-1].forEach(t=>$s(js(t)));var nt=Object.assign;var En=console;function kn(t,e="unexpected unreachable branch"){throw En.log("unreachable",t),En.log(`${e} :: ${JSON.stringify(t)} (${t})`),new Error("code reached unreachable")}var Qs=function(){var t=function(ie,p,m,f){for(m=m||{},f=ie.length;f--;m[ie[f]]=p);return m},e=[2,44],r=[1,20],n=[5,14,15,19,29,34,39,44,47,48,52,56,60],s=[1,35],i=[1,38],a=[1,30],o=[1,31],c=[1,32],h=[1,33],g=[1,34],E=[1,37],M=[14,15,19,29,34,39,44,47,48,52,56,60],b=[14,15,19,
`+A.showPosition()+`
Expecting `+pt.join(", ")+", got '"+(this.terminals_[D]||D)+"'":Gt="Parse error on line "+(ae+1)+": Unexpected "+(D==Vr?"end of input":"'"+(this.terminals_[D]||D)+"'"),this.parseError(Gt,{text:A.match,token:this.terminals_[D]||D,line:A.yylineno,loc:Ft,expected:pt})}if(F[0]instanceof Array&&F.length>1)throw new Error("Parse Error: multiple actions possible at state: "+me+", token: "+D);switch(F[0]){case 1:f.push(D),w.push(A.yytext),l.push(A.yylloc),f.push(F[1]),D=null,Ut?(D=Ut,Ut=null):(Ue=A.yyleng,u=A.yytext,ae=A.yylineno,Ft=A.yylloc,qr>0&&qr--);break;case 2:if(X=this.productions_[F[1]][1],Ce.$=w[w.length-X],Ce._$={first_line:l[l.length-(X||1)].first_line,last_line:l[l.length-1].last_line,first_column:l[l.length-(X||1)].first_column,last_column:l[l.length-1].last_column},Jn&&(Ce._$.range=[l[l.length-(X||1)].range[0],l[l.length-1].range[1]]),Mt=this.performAction.apply(Ce,[u,Ue,ae,de.yy,F[1],w,l].concat(Xn)),typeof Mt<"u")return Mt;X&&(f=f.slice(0,-1*X*2),w=w.slice(0,-1*X),l=l.slice(0,-1*X)),f.push(this.productions_[F[1]][0]),w.push(Ce.$),l.push(Ce._$),Fr=xe[f[f.length-2]][f[f.length-1]],f.push(Fr);break;case 3:return!0}}return!0}},$n=function(){var ie={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 w=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=[w[0],w[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,w;if(this.options.backtrack_lexer&&(w={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&&(w.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 l in w)this[l]=w[l];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 w=this._currentRules(),l=0;l<w.length;l++)if(f=this._input.match(this.rules[w[l]]),f&&(!m||f[0].length>m[0].length)){if(m=f,d=l,this.options.backtrack_lexer){if(p=this.test_match(f,w[l]),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,w[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,w){function l(u,ae){return f.yytext=f.yytext.substring(u,f.yyleng-ae+u)}var xe=w;switch(d){case 0:if(f.yytext.slice(-2)==="\\\\"?(l(0,1),this.begin("mu")):f.yytext.slice(-1)==="\\"?(l(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:(l(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=l(1,2).replace(/\\"/g,'"'),79;break;case 32:return f.yytext=l(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 ie}();Ht.lexer=$n;function qt(){this.yy={}}return qt.prototype=Ht,Ht.Parser=qt,new qt}(),vt=Qs;var lr=["description","fileName","lineNumber","endLineNumber","message","name","number","stack"];function cr(t,e){var r=e&&e.loc,n,s,i,a;r&&(n=r.start.line,s=r.end.line,i=r.start.column,a=r.end.column,t+=" - "+n+":"+i);for(var o=Error.prototype.constructor.call(this,t),c=0;c<lr.length;c++)this[lr[c]]=o[lr[c]];Error.captureStackTrace&&Error.captureStackTrace(this,cr);try{r&&(this.lineNumber=n,this.endLineNumber=s,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 gr=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 s=this.peek();if(s==="<"&&!this.isIgnoredEndTag())this.transitionTo("tagOpen"),this.markTagStart(),this.consume();else{if(this.mode==="precompile"&&s===`
`){var i=this.tagNameBuffer.toLowerCase();(i==="pre"||i==="textarea")&&this.consume()}this.transitionTo("data"),this.delegate.beginData()}},data:function(){var s=this.peek(),i=this.tagNameBuffer;s==="<"&&!this.isIgnoredEndTag()?(this.delegate.finishData(),this.transitionTo("tagOpen"),this.markTagStart(),this.consume()):s==="&"&&i!=="script"&&i!=="style"?(this.consume(),this.delegate.appendToData(this.consumeCharRef()||"&")):(this.consume(),this.delegate.appendToData(s))},tagOpen:function(){var s=this.consume();s==="!"?this.transitionTo("markupDeclarationOpen"):s==="/"?this.transitionTo("endTagOpen"):(s==="@"||s===":"||Pn(s))&&(this.transitionTo("tagName"),this.tagNameBuffer="",this.delegate.beginStartTag(),this.appendToTagName(s))},markupDeclarationOpen:function(){var s=this.consume();if(s==="-"&&this.peek()==="-")this.consume(),this.transitionTo("commentStart"),this.delegate.beginComment();else{var i=s.toUpperCase()+this.input.substring(this.index,this.index+6).toUpperCase();i==="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 s=this.consume();_(s)&&this.transitionTo("beforeDoctypeName")},beforeDoctypeName:function(){var s=this.consume();_(s)||(this.transitionTo("doctypeName"),this.delegate.appendToDoctypeName&&this.delegate.appendToDoctypeName(s.toLowerCase()))},doctypeName:function(){var s=this.consume();_(s)?this.transitionTo("afterDoctypeName"):s===">"?(this.delegate.endDoctype&&this.delegate.endDoctype(),this.transitionTo("beforeData")):this.delegate.appendToDoctypeName&&this.delegate.appendToDoctypeName(s.toLowerCase())},afterDoctypeName:function(){var s=this.consume();if(!_(s))if(s===">")this.delegate.endDoctype&&this.delegate.endDoctype(),this.transitionTo("beforeData");else{var i=s.toUpperCase()+this.input.substring(this.index,this.index+5).toUpperCase(),a=i.toUpperCase()==="PUBLIC",o=i.toUpperCase()==="SYSTEM";(a||o)&&(this.consume(),this.consume(),this.consume(),this.consume(),this.consume(),this.consume()),a?this.transitionTo("afterDoctypePublicKeyword"):o&&this.transitionTo("afterDoctypeSystemKeyword")}},afterDoctypePublicKeyword:function(){var s=this.peek();_(s)?(this.transitionTo("beforeDoctypePublicIdentifier"),this.consume()):s==='"'?(this.transitionTo("doctypePublicIdentifierDoubleQuoted"),this.consume()):s==="'"?(this.transitionTo("doctypePublicIdentifierSingleQuoted"),this.consume()):s===">"&&(this.consume(),this.delegate.endDoctype&&this.delegate.endDoctype(),this.transitionTo("beforeData"))},doctypePublicIdentifierDoubleQuoted:function(){var s=this.consume();s==='"'?this.transitionTo("afterDoctypePublicIdentifier"):s===">"?(this.delegate.endDoctype&&this.delegate.endDoctype(),this.transitionTo("beforeData")):this.delegate.appendToDoctypePublicIdentifier&&this.delegate.appendToDoctypePublicIdentifier(s)},doctypePublicIdentifierSingleQuoted:function(){var s=this.consume();s==="'"?this.transitionTo("afterDoctypePublicIdentifier"):s===">"?(this.delegate.endDoctype&&this.delegate.endDoctype(),this.transitionTo("beforeData")):this.delegate.appendToDoctypePublicIdentifier&&this.delegate.appendToDoctypePublicIdentifier(s)},afterDoctypePublicIdentifier:function(){var s=this.consume();_(s)?this.transitionTo("betweenDoctypePublicAndSystemIdentifiers"):s===">"?(this.delegate.endDoctype&&this.delegate.endDoctype(),this.transitionTo("beforeData")):s==='"'?this.transitionTo("doctypeSystemIdentifierDoubleQuoted"):s==="'"&&this.transitionTo("doctypeSystemIdentifierSingleQuoted")},betweenDoctypePublicAndSystemIdentifiers:function(){var s=this.consume();_(s)||(s===">"?(this.delegate.endDoctype&&this.delegate.endDoctype(),this.transitionTo("beforeData")):s==='"'?this.transitionTo("doctypeSystemIdentifierDoubleQuoted"):s==="'"&&this.transitionTo("doctypeSystemIdentifierSingleQuoted"))},doctypeSystemIdentifierDoubleQuoted:function(){var s=this.consume();s==='"'?this.transitionTo("afterDoctypeSystemIdentifier"):s===">"?(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 s=r.length;s;)this.consume(),s--;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}(),Fo=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 gr(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 br={Append:1,TrustingAppend:2,Comment:3,Modifier:4,StrictModifier:5,Block:6,StrictBlock:7,Component:8,OpenElement:10,OpenElementWithSplat:11,FlushElement:12,CloseElement:13,StaticAttr:14,DynamicAttr:15,ComponentAttr:16,AttrSplat:17,Yield:18,DynamicArg:20,StaticArg:21
`,n);if(e<=s||s===-1)return{line:r+1,column:e-n};r+=1,n=s+1}}charPosFor(e){let{line:r,column:n}=e,i=this.source.length,a=0,o=0;for(;o<i;){let c=this.source.indexOf(`
`,o);if(c===-1&&(c=this.source.length),a===r-1){if(o+n>c)return c;if(!1){let h=this.hbsPosFor(o+n);P(h!==null,"the returned offset failed to round-trip"),P(h.line===r,"the round-tripped line didn't match the original line"),P(h.column===n,"the round-tripped column didn't match the original column")}return o+n}else{if(c===-1)return 0;a+=1,o=c+1}}return i}};function S(t,e){let{module:r,loc:n}=e,{line:s,column:i}=n.start,a=e.asString(),o=a?`
|
| ${a.split(`
`).join(`
| `)}
|
`:"",c=new Error(`${t}: ${o}(error occurred in '${r}' @ line ${s} : column ${i})`);return c.name="SyntaxError",c.location=e,c.code=a,c}var yi={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"],ElementStartNode:[],ElementPartNode:[],ElementEndNode:[],ElementNameNode:[],AttrNode:["value"],TextNode:[],ConcatStatement:["parts"],SubExpression:["path","params","hash"],PathExpression:[],PathHead:[],StringLiteral:[],BooleanLiteral:[],NumberLiteral:[],NullLiteral:[],UndefinedLiteral:[],Hash:["pairs"],HashPair:["value"],BlockParam:[],NamedBlock:["attributes","modifiers","children","comments"],SimpleElement:["attributes","modifiers","children","comments"],Component:["head","attributes","modifiers","children","comments"]},Or=function(){t.prototype=Object.create(Error.prototype),t.prototype.constructor=t;function t(e,r,n,s){let i=Error.call(this,e);this.key=s,this.message=e,this.node=r,this.parent=n,i.stack&&(this.stack=i.stack)}return t}();function _n(t,e,r){return new Or("Cannot remove a node unless it is part of an array",t,e,r)}function Ei(t,e,r){return new Or("Cannot replace a node with multiple nodes unless it is part of an array",t,e,r)}function Dn(t,e){return new Or("Replacing and removing in key handlers is not yet supported.",t,null,e)}var Ve=class{node;parent;parentKey;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 Pr(this)}}},Pr=class{path;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 Hn(t){return typeof t=="function"?t:t.enter}function qn(t){if(typeof t!="function")return t.exit}function Si(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 ki(t,e){if((e==="Template"||e==="Block")&&t.Program)return t.Program;let r=t[e];return r!==void 0?r:t.All}function Bt(t,e){let{node:r,parent:n,parentKey:s}=e,i=ki(t,r.type),a,o;i!==void 0&&(a=Hn(i),o=qn(i));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 Vn(t,c,n,s),c;{let h=new Ve(c,n,s);return Bt(t,h)||c}}if(c===void 0){let h=yi[r.type];for(let g=0;g<h.length;g++){let E=h[g];Ti(t,i,e,E)}o!==void 0&&(c=o(r,e))}return c}function wi(t,e){return t[e]}function On(t,e,r){t[e]=r}function Ti(t,e,r,n){let{node:s}=r,i=wi(s,n);if(!i)return;let a,o;if(e!==void 0){let c=Si(e,n);c!==void 0&&(a=Hn(c),o=qn(c))}if(a!==void 0&&a(s,n)!==void 0)throw Dn(s,n);if(Array.isArray(i))Vn(t,i,r,n);else{let c=new Ve(i,r,n),h=Bt(t,c);h!==void 0&&Ni(s,n,i,h)}if(o!==void 0&&o(s,n)!==void 0)throw Dn(s,n)}function Vn(t,e,r,n){for(let s=0;s<e.length;s++){let i=Z(e[s]),a=new Ve(i,r,n),o=Bt(t,a);o!==void 0&&(s+=vi(e,s,o)-1)}}function Ni(t,e,r,n){if(n===null)throw _n(r,t,e);if(Array.isArray(n))if(n.length===1)On(t,e,n[0]);else throw n.length===0?_n(r,t,e):Ei(r,t,e);else On(t,e,n)}function vi(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 Ai(t,e){let r=new Ve(t);Bt(e,r)}var Pi=/[!"#%&'()*+./;<=>@[\\\]^`{|}~]/u;function xi(t){let e=_i(t);e&&(t.blockParamNodes=e,t.blockParams=e.map(r=>r.value))}function Ci(t,e){let r=[e.loc.getStart().offset,e.loc.getEnd().offset],n=t.slice(...r),s=r[0],i=n.indexOf("|")+1;s+=i,n=n.slice(i,-1),i=n.indexOf("|"),n=n.slice(0,i);for(let a of e.program.blockParamNodes){let c=new RegExp(`\\b${a.value}\\b`).exec(n),h=[s+c.index,0];h[1]=h[0]+a.value.length,a.loc=t.spanFor({start:t.hbsPosFor(h[0]),end:t.hbsPosFor(h[1])})}}function Li(t,e){let r=[e.loc.getStart().offset,e.loc.getEnd().offset],n=r[0],s=t.slice(...r);for(let i of e.parts){let a=s.indexOf(i.value),o=[n+a,0];o[1]=o[
`)}},In="beforeAttributeName",ta="attributeValueUnquoted",Lr=class extends Cr{get isTopLevel(){return this.elementStack.length===0}Program(e){let r=[],n;this.isTopLevel?n=N.template({body:r,blockParams:e.blockParams,loc:this.source.spanFor(e.loc)}):n=N.blockItself({body:r,blockParams:e.blockParams,chained:e.chained,loc:this.source.spanFor(e.loc)});let s,i=e.body.length;if(this.elementStack.push(n),i===0)return this.elementStack.pop();for(s=0;s<i;s++)this.acceptNode(Z(e.body[s]));let a=this.elementStack.pop();if(a!==n){let o=a;throw S(`Unclosed element \`${o.tag}\``,o.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:s}=kr(this,e);e.program.loc||(e.program.loc=Dt),e.inverse&&!e.inverse.loc&&(e.inverse.loc=Dt);let i=this.Program(e.program),a=e.inverse?this.Program(e.inverse):null,o=N.block({path:r,params:n,hash:s,defaultBlock:i,elseBlock:a,loc:this.source.spanFor(e.loc),openStrip:e.openStrip,inverseStrip:e.inverseStrip,closeStrip:e.closeStrip});Ci(this.source,o);let c=this.currentElement();He(c,o)}MustacheStatement(e){let{tokenizer:r}=this;if(r.state==="comment"){this.appendToCommentData(this.sourceForNode(e));return}let n,{escaped:s,loc:i,strip:a}=e;if(Fn(e.path))n=N.mustache({path:this.acceptNode(e.path),params:[],hash:N.hash([],this.source.spanFor(e.path.loc).collapse("end")),trusting:!s,loc:this.source.spanFor(i),strip:a});else{let{path:o,params:c,hash:h}=kr(this,e);n=N.mustache({path:o,params:c,hash:h,trusting:!s,loc:this.source.spanFor(i),strip:a})}switch(r.state){case"tagOpen":case"tagName":throw S("Cannot use mustaches in an elements tagname",n.loc);case"beforeAttributeName":wr(this.currentStartTag,n);break;case"attributeName":case"afterAttributeName":this.beginAttributeValue(!1),this.finishAttributeValue(),wr(this.currentStartTag,n),r.transitionTo(In);break;case"afterAttributeValueQuoted":wr(this.currentStartTag,n),r.transitionTo(In);break;case"beforeAttributeValue":this.beginAttributeValue(!1),this.appendDynamicAttributeValuePart(n),r.transitionTo(ta);break;case"attributeValueDoubleQuoted":case"attributeValueSingleQuoted":case"attributeValueUnquoted":this.appendDynamicAttributeValuePart(n);break;default:He(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){na(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:s}=e,i=N.mustacheComment(n,this.source.spanFor(s));switch(r.state){case"beforeAttributeName":case"afterAttributeName":this.currentStartTag.comments.push(i);break;case"beforeData":case"data":He(this.currentElement(),i);break;default:throw S(`Using a Handlebars comment when in the \`${r.state}\` state is not supported`,this.source.spanFor(e.loc))}return i}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:s}=kr(this,e);return N.sexpr({path:r,params:n,hash:s,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 u
`).length-1,columns:0};let[r]=t.split(e),n=r.split(/\n/u),s=n.length-1;return{lines:s,columns:Z(n[s]).length}}function na(t,e){let r=e.loc.start.line,n=e.loc.start.column,s=ra(e.original,e.value);r=r+s.lines,s.lines?n=s.columns:n=n+s.columns,t.line=r,t.column=n}function kr(t,e){if(e.path.type.endsWith("Literal")){let a=e.path,o="";throw a.type==="BooleanLiteral"?o=a.original.toString():a.type==="StringLiteral"?o=`"${a.original}"`:a.type==="NullLiteral"?o="null":a.type==="NumberLiteral"?o=a.value.toString():o="undefined",S(`${a.type} "${a.type==="StringLiteral"?a.original:o}" cannot be called as a sub-expression, replace (${o}) with ${o}`,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)):[],s=Se(n)?Tt(n).loc:r.loc,i=e.hash?t.Hash(e.hash):{type:"Hash",pairs:[],loc:t.source.spanFor(s).collapse("end")};return{path:r,params:n,hash:i}}function wr(t,e){let{path:r,params:n,hash:s,loc:i}=e;if(Fn(r)){let o=`{{${Oi(r)}}}`,c=`<${t.name} ... ${o} ...`;throw S(`In ${c}, ${o} is not a valid modifier`,e.loc)}let a=N.elementModifier({path:r,params:n,hash:s,loc:i});t.modifiers.push(a)}var _r=class extends Lr{tagOpenLine=0;tagOpenColumn=0;reset(){this.currentNode=null}beginComment(){this.currentNode=N.comment("",this.source.offsetFor(this.tagOpenLine,this.tagOpenColumn))}appendToCommentData(e){this.currentComment.value+=e}finishComment(){He(this.currentElement(),this.finish(this.currentComment))}beginData(){this.currentNode=N.text({chars:"",loc:this.offset().collapsed()})}appendToData(e){this.currentData.chars+=e}finishData(){this.currentData.loc=this.currentData.loc.withEnd(this.offset()),He(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()}));(Ln.has(e.name)||e.selfClosing)&&this.finishEndTag(!0)}else e.type==="EndTag"&&this.finishEndTag(!1)}finishStartTag(){let{name:e,attributes:r,modifiers:n,comments:s,selfClosing:i,loc:a}=this.finish(this.currentStartTag),o=N.element({tag:e,selfClosing:i,attrs:r,modifiers:n,comments:s,children:[],blockParams:[],loc:a});o.startTag={type:"ElementStartNode",value:e,loc:a},o.nameNode={type:"ElementNameNode",value:e,loc:a.withStart(this.source.offsetFor(a.startPosition.line,a.startPosition.column+1)).withEnd(this.source.offsetFor(a.startPosition.line,a.startPosition.column+1+e.length))},Li(this.source,o),this.elementStack.push(o)}finishEndTag(e){let r=this.finish(this.currentTag),n=this.elementStack.pop();n.endTag={type:"ElementEndNode",loc:r.loc,value:n.selfClosing?"":r.name},this.validateEndTag(r,n,e);let s=this.currentElement();n.loc=n.loc.withEnd(this.offset()),xi(n),He(s,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],s=this.currentAttr.currentPart;if(s)s.chars+=e,s.loc=s.loc.withEnd(this.offset());else{let i
`?i=n?n.loc.getEnd():this.currentAttr.valueSpan.getStart():i=i.move(-1),this.currentAttr.currentPart=N.text({chars:e,loc:i.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:s,start:i,isQuoted:a,isDynamic:o,valueSpan:c}=this.currentAttr,h=this.assembleAttributeValue(s,a,o,i.until(r));h.loc=c.withEnd(r);let g=N.attr({name:n,value:h,loc:i.until(r)});this.currentStartTag.attributes.push(g)}reportSyntaxError(e){throw S(e,this.offset().collapsed())}assembleConcatenatedValue(e){for(let s of e)if(s.type!=="MustacheStatement"&&s.type!=="TextNode")throw S(`Unsupported node in quoted attribute value: ${s.type}`,s.loc);rt(e,"the concatenation parts of an element should not be empty");let r=Nt(e),n=Tt(e);return N.concat(e,this.source.spanFor(r.loc).extend(this.source.spanFor(n.loc)))}validateEndTag(e,r,n){if(Ln.has(e.name)&&!n)throw S(`<${e.name}> elements do not need end tags. You should remove it`,e.loc);if(r.tag===void 0)throw S(`Closing tag </${e.name}> without an open tag`,e.loc);if(r.tag!==e.name)throw S(`Closing tag </${e.name}> did not match last open tag <${r.tag}> (on line ${r.loc.startPosition.line})`,e.loc)}assembleAttributeValue(e,r,n,s){if(n){if(r)return this.assembleConcatenatedValue(e);{rt(e);let[i,a]=e;if(a===void 0||a.type==="TextNode"&&a.chars==="/")return i;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 '/>'",s)}}else return Se(e)?e[0]:N.text({chars:"",loc:s})}},sa={},Dr=class extends mr{constructor(){super({})}parse(){}};function zn(t,e={}){var c,h;let r=e.mode||"precompile",n,s;typeof t=="string"?(n=new we(t,(c=e.meta)==null?void 0:c.moduleName),r==="codemod"?s=Ct(t,e.parseOptions):s=dr(t,e.parseOptions)):t instanceof we?(n=t,r==="codemod"?s=Ct(t.source,e.parseOptions):s=dr(t.source,e.parseOptions)):(n=new we("",(h=e.meta)==null?void 0:h.moduleName),s=t);let i;r==="codemod"&&(i=new Dr);let a=I.forCharPositions(n,0,n.source.length);s.loc={source:"(program)",start:a.startPosition,end:a.endPosition};let o=new _r(n,i,r).acceptTemplate(s);if(e.strictMode&&(o.blockParams=e.locals??[]),e&&e.plugins&&e.plugins.ast)for(let g of e.plugins.ast){let E=nt({},e,{syntax:sa},{plugins:void 0}),M=g(E);Ai(o,M.visitor)}return o}var Br=function(t){return t.Helper="Helper",t.Modifier="Modifier",t.Component="Component",t}({}),tl=Br.Helper,rl=Br.Modifier,nl=Br.Component;var It=`
`,Wn="\r",Kn=function(){function t(e){this.length=e.length;for(var r=[0],n=0;n<e.length;)switch(e[n]){case It:n+=It.length,r.push(n);break;case Wn:n+=Wn.length,e[n]===It&&(n+=It.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 s=e-n[r];return{line:r,column:s}},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 ia(t,e){let r=new SyntaxError(t+" ("+e.loc.start.line+":"+e.loc.start.column+")");return Object.assign(r,e)}var jn=ia;function aa(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 oa(t){let e=new Kn(t),r=({line:s,column:i})=>e.indexForLocation({line:s-1,column:i}),n=s=>{let{start:i,end:a}=s.loc;i.offset=r(i),a.offset=r(a)};return()=>({name:"prettierParsePlugin",visitor:{All(s){n(s),aa(s)}}})}function la(t){let e;try{e=zn(t,{mode:"codemod",plugins:{ast:[oa(t)]}})}catch(r){let n=ua(r);if(n){let s=ca(r);throw jn(s,{loc:n,cause:r})}throw r}return e}function ca(t){let{message:e}=t,r=e.split(`
`);return r.length>=4&&/^Parse error on line \d+:$/.test(r[0])&&/^-*\^$/.test(oe(!1,r,-2))?oe(!1,r,-1):r.length>=4&&/:\s?$/.test(r[0])&&/^\(error occurred in '.*?' @ line \d+ : column \d+\)$/.test(oe(!1,r,-1))&&r[1]===""&&oe(!1,r,-2)===""&&r.slice(2,-2).every(n=>n.startsWith("|"))?r[0].trim().slice(0,-1):e}function ua(t){let{location:e,hash:r}=t;if(e){let{start:n,end:s}=e;return typeof s.line!="number"?{start:n}:e}if(r){let{loc:{last_line:n,last_column:s}}=r;return{start:{line:n,column:s+1}}}}var ha={parse:la,astFormat:"glimmer",locStart:Ee,locEnd:et};var pa={glimmer:bn};var bl=Rr;export{bl as default,yn as languages,Ir as parsers,pa as printers};