@lifeart/gxt
Version:
<img align="right" width="95" height="95" alt="Philosopher’s stone, logo of PostCSS" src="./public/logo.png">
1 lines • 91.8 kB
JavaScript
function e(e){return"object"==typeof e&&null!==e&&"_nodeType"in e&&"element"===e._nodeType}function t(e){return"object"==typeof e&&null!==e&&"_nodeType"in e&&"control"===e._nodeType}function n(e){return"object"==typeof e&&null!==e&&"kind"in e&&"string"==typeof e.kind}function r(e){return"object"==typeof e&&null!==e&&"runtime"===e.type}function s(e,t){return{kind:"literal",value:e,sourceRange:t}}function o(e,t=!1,n,r,s){return r&&r.length>0?{kind:"path",expression:e,isArg:t,sourceRange:n,parts:r,rootRange:s}:{kind:"path",expression:e,isArg:t,sourceRange:n}}function i(e,t){return{kind:"raw",code:e,sourceRange:t}}function a(e,t=[],n=/* @__PURE__ */new Map,r,s){return{kind:"helper",name:e,positional:t,named:n,sourceRange:r,pathRange:s}}function c(e,t){return{kind:"getter",value:e,sourceRange:t}}function u(e){if(!e||!e.trim())throw Error("RuntimeTag symbol cannot be empty");return{type:"runtime",symbol:e}}function l(e,t){const n=Math.max(0,Math.min(t,e.length));let r=1,s=1;for(let o=0;o<n;o++)"\n"===e[o]?(r++,s=1):s++;return{line:r,column:s}}function p(e,t,n){let r=1,s=0;for(;r<t&&s<e.length;)"\n"===e[s]&&r++,s++;return Math.min(s+n,e.length)}function f(e){return Bt[e]}function m(e,t,n){if(!e.sourceRange)return{message:e.message,code:e.code,hint:f(e.code)};const{start:r,end:s}=e.sourceRange,o=n?.baseOffset??0,i=0!==o?{start:r+o,end:s+o}:e.sourceRange,a=l(t,r),c=s-r,u=n?.contextLines??2,p=e.message.match(/\(on line (\d+)\)/),m=p?parseInt(p[1],10):void 0,g=function(e,t,n=0,r){const s=e.split("\n"),o=l(e,t.start),i=l(e,t.end),a=Math.max(1,o.line-n),c=Math.min(s.length,i.line+n),u=[];let p=-1;if(r&&r>0&&r<a){const e=(c+"").length,t=(r+"").padStart(e," "),n=s[r-1]??"";u.push(`${t} | ${n}`),u.push(" ".repeat(e)+" : ...")}const f=(c+"").length;for(let l=a;l<=c;l++){l===o.line&&(p=u.length);const e=(l+"").padStart(f," "),t=s[l-1]??"";u.push(`${e} | ${t}`)}if(r&&r>c){u.push(" ".repeat(f)+" : ...");const e=(r+"").padStart(f," "),t=s[r-1]??"";u.push(`${e} | ${t}`)}return{lines:u,startLine:a,column:o.column,errorLineIndex:p}}(t,e.sourceRange,u,m),h=g.lines[g.lines.length-1].match(/^\s*(\d+)\s*\|/),y=h?h[1].length:0,b=-1!==g.errorLineIndex?function(e,t,n){return" ".repeat(n+3+e-1)+"^".repeat(Math.max(1,t))}(a.column,c,y):void 0,_=[...g.lines];return b&&-1!==g.errorLineIndex&&_.splice(g.errorLineIndex+1,0,b),{message:e.message,code:e.code,sourceRange:i,snippet:_.join("\n"),pointer:b,hint:f(e.code),line:a.line,column:a.column,lexicalContext:d(t,e.sourceRange),filename:n?.filename}}function d(e,t){const n=Math.max(0,t.start-5),r=Math.min(e.length,t.end+5);let s="";return n>0&&(s+="..."),s+=`${e.slice(n,t.start).replace(/\n/g," ")}[${e.slice(t.start,t.end).replace(/\n/g," ")}]${e.slice(t.end,r).replace(/\n/g," ")}`,r<e.length&&(s+="..."),s}function g(e){return function(e){const t=[];let n=e.message;if(n.includes(" (error occurred in")&&(n=n.split(" (error occurred in")[0]),e.hint&&(n=e.hint.split(". ")[0],n.endsWith(".")||(n+=".")),t.push(`error: ${n} (${e.code})`),void 0!==e.line&&void 0!==e.column){const n=e.filename?e.filename+":":"";t.push(` --\x3e ${n}${e.line}:${e.column}`)}if(e.snippet&&(t.push(" |"),t.push(e.snippet),t.push(" |")),e.hint){const n=e.hint.split(". ");n.length>1&&t.push(" help: "+n.slice(1).join(". "))}let r=e.message;return r.includes(" (error occurred in")&&(r=r.split(" (error occurred in")[0]),(r&&e.hint&&!r.includes(e.hint.split(". ")[0])||!e.hint&&r)&&t.push(" note: "+r),t.join("\n")}(e)}function h(e){const t="string"==typeof e?e:e.message;if(t.includes("Unclosed element"))return"E006";if(t.includes("did not match last open tag"))return"E007";if(t.includes("Invalid end tag")||t.includes("closing tag must not have attributes"))return"E016";if(t.includes("valid character within attribute names"))return"E009";if(t.includes("Lexical error"))return"E014";if(t.includes("doesn't match"))return"E012";if(t.includes("Unexpected content")||t.includes("Expecting 'OPEN_TAG_End'"))return"E008";if(t.includes("Invalid attribute")||t.includes("unquoted attribute value"))return"E009";if(t.includes("Invalid mustache")||t.includes("Got 'INVALID'")||"INVALID"===e.hash?.token)return"E010";if(t.includes("Parse error")){const n=e.hash?.expected;return t.includes("Expected:")&&t.includes("'CLOSE_BLOCK_PARAMS'")||n?.includes("'CLOSE_BLOCK_PARAMS'")?"E015":n&&n.includes("'OPEN_ENDBLOCK'")||t.includes("Expected:")&&t.includes("OPEN_ENDBLOCK")?"E011":t.toLowerCase().includes("got 'open_endblock'")?"E012":"E013"}return"E005"}function y(e){return Object.prototype.hasOwnProperty.call(Cn,e)?Cn[e]:null}function b(e,t,n,r){const s=function(e,t){return m(e,t,void 0)}({message:t,code:n,sourceRange:r},e.source);e.warnings.push(s)}function _(e,t,n){const r=e.elementContext;e.elementContext=t;try{return n()}finally{e.elementContext=r}}function v(e,t){return{type:"literal",value:e,sourceRange:t}}function R(e,t){return{type:"literal",value:e,sourceRange:t,quote:"'"}}function k(e,t){return{type:"literal",value:e,sourceRange:t}}function $(e,t){return{type:"literal",value:e,sourceRange:t}}function S(e){return{type:"literal",value:null,sourceRange:e}}function E(e){return{type:"literal",value:void 0,sourceRange:e}}function M(e,t,n,r){return{type:"identifier",name:e,sourceRange:t,sourceNode:n,mappingName:r}}function x(e,t,n,r){return{type:"member",object:e,property:t,optional:!1,computed:!1,sourceRange:n,propertySourceRange:r}}function C(e,t,n,r){return{type:"member",object:e,property:t,optional:!0,computed:!1,sourceRange:n,propertySourceRange:r}}function L(e,t,n,r=!1){return{type:"member",object:e,property:t,optional:r,computed:!0,sourceRange:n}}function T(e,t,n,r,s){return{type:"call",callee:"string"==typeof e?M(e):e,arguments:t,sourceRange:n,formatted:r,mappingSource:s}}function O(e,t,n,r){return{type:"methodCall",object:e,method:t,arguments:n,sourceRange:r}}function A(e,t,n){return{type:"arrow",params:e,body:t,expression:!0,sourceRange:n}}function P(e,t){return A([],e,t)}function I(e,t,n,r,s){return{type:"function",name:n,params:e,body:t,sourceRange:r,formatted:s}}function w(e,t,n){return{type:"array",elements:e,sourceRange:t,mappingSource:n}}function N(e,t){return{type:"object",properties:e,sourceRange:t}}function j(e,t,n=!1,r,s){return{key:e,value:t,computed:n,shorthand:!1,sourceRange:r,keySourceRange:s}}function G(e,t){return{type:"spread",argument:e,sourceRange:t}}function B(e,t){return{type:"raw",code:e,sourceRange:t}}function W(e,t){return{type:"runtimeRef",symbol:e,sourceRange:t}}function z(e,t){return{type:"reactiveGetter",expression:e,sourceRange:t}}function D(e,t,n,r){return{type:"varDecl",kind:e,name:t,init:n,sourceRange:r}}function H(e,t,n){return D("const",e,t,n)}function V(e,t){return{type:"return",argument:e,sourceRange:t}}function U(e,t){return{type:"exprStmt",expression:e,sourceRange:t}}function Z(){return w([])}function q(){return N([])}function F(e,t=!0,n){return{type:"formattedArray",elements:e,multiline:t,sourceRange:n}}function J(e,t,n,r){const s=T(x(x(M(n.LOCAL_NODE),"style"),"setProperty"),[v(e),M(n.LOCAL_VALUE)]),o=I([n.LOCAL_VALUE,n.LOCAL_NODE],[U(s)]),i=T(n.TO_VALUE,[t]);return function(e,t,n=[],r){return{type:"methodBinding",fn:e,thisArg:t,boundArgs:n,sourceRange:r}}(o,S(),[i],r)}function K(e,t,n){return I(["args"],[U(T(t.GET_ARGS,[M("this"),M("arguments")])),H(t.LOCAL_FW,T(t.GET_FW,[M("this"),M("arguments")])),H(t.LOCAL_SLOTS,T(t.GET_SLOTS,[M("this"),M("arguments")])),V(T(t.FINALIZE_COMPONENT,[F([T(t.TAG,[e,M(t.LOCAL_FW),M("this"),F([A([],T(t.SLOT,[v("default"),A([],w([])),M(t.LOCAL_SLOTS),M("this")]))],!0)])],!0),M("this")]))],void 0,n,!0)}function Y(e){return/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(e)}function Q(e){return Y(e)?e:JSON.stringify(e)}function X(e,t={}){const n=t.streaming??void 0!==t.emitter,r=t.format??!1,s={emitter:t.emitter,indent:t.indent??" ",indentLevel:t.indentLevel??0,format:r,streaming:n,emitPure:t.emitPure??!r,baseIndent:t.baseIndent??""};if(n&&s.emitter)return te(e,s),s.emitter.getCode();const o=ee(e,s);return s.emitter&&s.emitter.emit(o),o}function ee(e,t){switch(e.type){case"literal":return function(e,t){let n;return n=null===e.value?"null":void 0===e.value?"undefined":"string"==typeof e.value?ne(e.value,e.quote):(e.value,e.value+""),ue(n,t,e.sourceRange)}(e,t);case"identifier":return function(e,t){return ue(e.name,t,e.sourceRange)}(e,t);case"member":return function(e,t){const n=ee(e.object,t);if(e.computed){const r=ee(e.property,t);return ue(e.optional?`${n}?.[${r}]`:`${n}[${r}]`,t,e.sourceRange)}const r=e.property;return Y(r)?ue(`${n}${e.optional?"?.":"."}${r}`,t,e.sourceRange):ue(e.optional?`${n}?.[${JSON.stringify(r)}]`:`${n}[${JSON.stringify(r)}]`,t,e.sourceRange)}(e,t);case"call":return function(e,t){const n=ee(e.callee,t),r=t.emitPure&&wn.has(n)?"/*#__PURE__*/":"";if(e.formatted&&e.arguments.length>1){t.indentLevel++;const s=t.indent.repeat(t.indentLevel),o="\n"+t.baseIndent,i=e.arguments.map(e=>s+ee(e,t)).join(","+o);return t.indentLevel--,ue(`${r}${n}(${o}${i}${o}${t.indent.repeat(t.indentLevel)})`,t,e.sourceRange)}const s=e.arguments.map(e=>ee(e,t)).join(", ");return ue(`${r}${"arrow"===e.callee.type?`(${n})`:n}(${s})`,t,e.sourceRange)}(e,t);case"methodCall":return function(e,t){const n=ee(e.object,t),r=e.arguments.map(e=>ee(e,t)).join(", ");return ue(`${n}.${e.method}(${r})`,t,e.sourceRange)}(e,t);case"arrow":return function(e,t){const n=1===e.params.length?se(e.params[0]):`(${ae(e.params)})`,r=t.emitPure?{...t,emitPure:!1}:t;let s;if(e.expression)s=ee(e.body,r);else{const t=e.body.map(e=>ee(e,r)).join(function(e){return e.format?"\n":""}(r));s=`{ ${t} }`}return ue(`${n} => ${s}`,t,e.sourceRange)}(e,t);case"function":return function(e,t){const n=e.name||"",r=ae(e.params),s=t.emitPure?{...t,emitPure:!1}:t;if(e.formatted||t.format&&e.body.length>1){s.indentLevel++;const o=s.indent.repeat(s.indentLevel),i="\n"+s.baseIndent,a=e.body.map(e=>`${o}${ee(e,s)}`).join(i);return s.indentLevel--,ue(`function${n?" "+n:""}(${r}){${i}${a}${i}${s.indent.repeat(s.indentLevel)}}`,t,e.sourceRange)}return ue(`function${n?" "+n:""}(${r}){${e.body.map(e=>ee(e,s)).join("")}}`,t,e.sourceRange)}(e,t);case"array":return function(e,t){if(0===e.elements.length)return ue("[]",t,e.sourceRange);const n=e.elements.map(e=>ee(e,t));if(t.format&&n.length>2){t.indentLevel++;const r=t.indent.repeat(t.indentLevel),s="\n"+t.baseIndent,o=n.map(e=>`${r}${e}`).join(","+s);return t.indentLevel--,ue(`[${s}${o}${s}${t.indent.repeat(t.indentLevel)}]`,t,e.sourceRange)}return ue(`[${n.join(", ")}]`,t,e.sourceRange)}(e,t);case"object":return function(e,t){if(0===e.properties.length)return ue("{}",t,e.sourceRange);const n=e.properties.map(e=>function(e,t){if(e.shorthand)return e.key;if(e.computed){const n=e.value;return`[${ee(n.elements[0],t)}]: ${ee(n.elements[1],t)}`}return`${Y(e.key)?e.key:JSON.stringify(e.key)}: ${ee(e.value,t)}`}(e,t));if(t.format&&n.length>2){t.indentLevel++;const r=t.indent.repeat(t.indentLevel),s="\n"+t.baseIndent,o=n.map(e=>`${r}${e}`).join(","+s);return t.indentLevel--,ue(`{${s}${o}${s}${t.indent.repeat(t.indentLevel)}}`,t,e.sourceRange)}return ue(`{ ${n.join(", ")} }`,t,e.sourceRange)}(e,t);case"spread":return function(e,t){return ue("..."+ee(e.argument,t),t,e.sourceRange)}(e,t);case"binary":return function(e,t){const n=ee(e.left,t),r=ee(e.right,t);return ue(`${n} ${e.operator} ${r}`,t,e.sourceRange)}(e,t);case"conditional":return function(e,t){return ue(`${ee(e.test,t)} ? ${ee(e.consequent,t)} : ${ee(e.alternate,t)}`,t,e.sourceRange)}(e,t);case"raw":return function(e,t){return ue(e.code,t,e.sourceRange)}(e,t);case"runtimeRef":return function(e,t){return ue(e.symbol,t,e.sourceRange,"PathExpression",!1)}(e,t);case"reactiveGetter":return function(e,t){return"() => "+ee(e.expression,t)}(e,t);case"methodBinding":return function(e,t){return ue(`${ee(e.fn,t)}.bind(${[ee(e.thisArg,t),...e.boundArgs.map(e=>ee(e,t))].join(", ")})`,t,e.sourceRange)}(e,t);case"iife":return function(e,t){return ue(`(function(${ae(e.params)}){${e.body.map(e=>ee(e,t)).join("")}})(${e.args.map(e=>ee(e,t)).join(", ")})`,t,e.sourceRange)}(e,t);case"formattedArray":return function(e,t){if(0===e.elements.length)return ue("[]",t,e.sourceRange);if(e.multiline){t.indentLevel++;const n=t.indent.repeat(t.indentLevel),r="\n"+t.baseIndent,s=e.elements.map(e=>ee(e,t)).map(e=>`${n}${e}`).join(","+r);return t.indentLevel--,ue(`[${r}${s}${r}${t.indent.repeat(t.indentLevel)}]`,t,e.sourceRange)}return ue(`[${e.elements.map(e=>ee(e,t)).join(", ")}]`,t,e.sourceRange)}(e,t);case"varDecl":return function(e,t){const n=e.init?" = "+ee(e.init,t):"";return ue(`${e.kind} ${e.name}${n};`,t,e.sourceRange)}(e,t);case"return":return function(e,t){return ue(`return${e.argument?" "+ee(e.argument,t):""};`,t,e.sourceRange)}(e,t);case"exprStmt":return function(e,t){return ue(ee(e.expression,t)+";",t,e.sourceRange)}(e,t);default:throw Error("Unknown node type: "+e.type)}}function te(e,t){switch(e.type){case"literal":!function(e,t){const n=t.emitter;let r,s;null===e.value?(r="null",s="NullLiteral"):void 0===e.value?(r="undefined",s="UndefinedLiteral"):"string"==typeof e.value?(r=ne(e.value,e.quote),s="StringLiteral"):"boolean"==typeof e.value?(r=e.value+"",s="BooleanLiteral"):(r=e.value+"",s="NumberLiteral"),e.sourceRange?n.emitMapped(r,e.sourceRange,s):n.emit(r)}(e,t);break;case"identifier":re(e,t);break;case"member":!function(e,t){const n=t.emitter;if(te(e.object,t),e.computed)n.emit(e.optional?"?.[":"["),te(e.property,t),n.emit("]");else{const t=e.property;if(Y(t)){const r=e.optional?"?.":".";n.emit(r),e.propertySourceRange?n.emitMapped(t,e.propertySourceRange,"PathExpression",t):n.emit(t)}else n.emit(e.optional?"?.[":"["),e.propertySourceRange?n.emitMapped(JSON.stringify(t),e.propertySourceRange,"PathExpression",t):n.emit(JSON.stringify(t)),n.emit("]")}}(e,t);break;case"call":!function(e,t){const n=t.emitter,r=ee(e.callee,{...t,streaming:!1}),s=t.emitPure&&wn.has(r)?"/*#__PURE__*/":"";s&&n.emit(s),e.sourceRange&&n.pushScope(e.sourceRange,e.mappingSource||"SubExpression");const o="arrow"===e.callee.type;if(o&&n.emit("("),te(e.callee,t),o&&n.emit(")"),e.formatted&&e.arguments.length>1){t.indentLevel++;const r=le(t);n.emit("("+pe(t));for(let s=0;s<e.arguments.length;s++)n.emit(r),te(e.arguments[s],t),s<e.arguments.length-1?n.emit(","+pe(t)):n.emit(pe(t));t.indentLevel--,n.emit(le(t)+")")}else{n.emit("(");for(let r=0;r<e.arguments.length;r++)r>0&&n.emit(", "),te(e.arguments[r],t);n.emit(")")}e.sourceRange&&n.popScope()}(e,t);break;case"methodCall":!function(e,t){const n=t.emitter;e.sourceRange&&n.pushScope(e.sourceRange,"SubExpression"),te(e.object,t),n.emit("."+e.method+"(");for(let r=0;r<e.arguments.length;r++)r>0&&n.emit(", "),te(e.arguments[r],t);n.emit(")"),e.sourceRange&&n.popScope()}(e,t);break;case"arrow":!function(e,t){const n=t.emitter;e.sourceRange&&n.pushScope(e.sourceRange,"Synthetic");const r=1!==e.params.length;ie(e.params,t,r),n.emit(" => ");const s=t.emitPure?{...t,emitPure:!1}:t;if(e.expression)te(e.body,s);else{n.emit("{ ");const t=e.body;for(let e=0;e<t.length;e++)e>0&&n.emit(" "),te(t[e],s);n.emit(" }")}e.sourceRange&&n.popScope()}(e,t);break;case"function":!function(e,t){const n=t.emitter,r=e.name||"";e.sourceRange&&n.pushScope(e.sourceRange,"Synthetic");const s=t.emitPure?{...t,emitPure:!1}:t,o="function"+(r?" "+r:"");if(e.formatted||t.format&&e.body.length>1){s.indentLevel++;const t=le(s);n.emit(o),ie(e.params,s,!0),n.emit("{"+pe(s));for(let r=0;r<e.body.length;r++)n.emit(t),te(e.body[r],s),n.emit(pe(s));s.indentLevel--,n.emit(le(s)+"}")}else{n.emit(o),ie(e.params,s,!0),n.emit("{");for(const t of e.body)te(t,s);n.emit("}")}e.sourceRange&&n.popScope()}(e,t);break;case"array":!function(e,t){const n=t.emitter;if(e.sourceRange&&n.pushScope(e.sourceRange,e.mappingSource||"Synthetic"),0===e.elements.length)n.emit("[]");else if(t.format&&e.elements.length>2){t.indentLevel++;const r=le(t);n.emit("["+pe(t));for(let s=0;s<e.elements.length;s++)n.emit(r),te(e.elements[s],t),s<e.elements.length-1?n.emit(","+pe(t)):n.emit(pe(t));t.indentLevel--,n.emit(le(t)+"]")}else{n.emit("[");for(let r=0;r<e.elements.length;r++)r>0&&n.emit(", "),te(e.elements[r],t);n.emit("]")}e.sourceRange&&n.popScope()}(e,t);break;case"object":!function(e,t){const n=t.emitter;if(e.sourceRange&&n.pushScope(e.sourceRange,"Synthetic"),0===e.properties.length)n.emit("{}");else if(t.format&&e.properties.length>2){t.indentLevel++;const r=le(t);n.emit("{"+pe(t));for(let s=0;s<e.properties.length;s++)n.emit(r),ce(e.properties[s],t),s<e.properties.length-1?n.emit(","+pe(t)):n.emit(pe(t));t.indentLevel--,n.emit(le(t)+"}")}else{n.emit("{ ");for(let r=0;r<e.properties.length;r++)r>0&&n.emit(", "),ce(e.properties[r],t);n.emit(" }")}e.sourceRange&&n.popScope()}(e,t);break;case"spread":!function(e,t){t.emitter.emit("..."),te(e.argument,t)}(e,t);break;case"binary":!function(e,t){const n=t.emitter;e.sourceRange&&n.pushScope(e.sourceRange,"Synthetic"),te(e.left,t),n.emit(" "+e.operator+" "),te(e.right,t),e.sourceRange&&n.popScope()}(e,t);break;case"conditional":!function(e,t){const n=t.emitter;e.sourceRange&&n.pushScope(e.sourceRange,"Synthetic"),te(e.test,t),n.emit(" ? "),te(e.consequent,t),n.emit(" : "),te(e.alternate,t),e.sourceRange&&n.popScope()}(e,t);break;case"raw":!function(e,t){const n=t.emitter;e.sourceRange?n.emitMapped(e.code,e.sourceRange,"Synthetic"):n.emit(e.code)}(e,t);break;case"runtimeRef":!function(e,t){const n=t.emitter;e.sourceRange?n.emitMapped(e.symbol,e.sourceRange,"PathExpression",e.symbol):n.emit(e.symbol)}(e,t);break;case"reactiveGetter":!function(e,t){t.emitter.emit("() => "),te(e.expression,t)}(e,t);break;case"methodBinding":!function(e,t){const n=t.emitter;e.sourceRange&&n.pushScope(e.sourceRange,"Synthetic"),te(e.fn,t),n.emit(".bind("),te(e.thisArg,t);for(const r of e.boundArgs)n.emit(", "),te(r,t);n.emit(")"),e.sourceRange&&n.popScope()}(e,t);break;case"iife":!function(e,t){const n=t.emitter;e.sourceRange&&n.pushScope(e.sourceRange,"Synthetic"),n.emit("(function"),ie(e.params,t,!0),n.emit("{");for(const r of e.body)te(r,t);n.emit("})(");for(let r=0;r<e.args.length;r++)r>0&&n.emit(", "),te(e.args[r],t);n.emit(")"),e.sourceRange&&n.popScope()}(e,t);break;case"formattedArray":!function(e,t){const n=t.emitter;if(e.sourceRange&&n.pushScope(e.sourceRange,"Synthetic"),0===e.elements.length)n.emit("[]");else if(e.multiline){t.indentLevel++;const r=le(t);n.emit("["+pe(t));for(let s=0;s<e.elements.length;s++)n.emit(r),te(e.elements[s],t),s<e.elements.length-1?n.emit(","+pe(t)):n.emit(pe(t));t.indentLevel--,n.emit(le(t)+"]")}else{n.emit("[");for(let r=0;r<e.elements.length;r++)r>0&&n.emit(", "),te(e.elements[r],t);n.emit("]")}e.sourceRange&&n.popScope()}(e,t);break;case"varDecl":!function(e,t){const n=t.emitter;n.emit(`${e.kind} ${e.name}`),e.init&&(n.emit(" = "),te(e.init,t)),n.emit(";")}(e,t);break;case"return":!function(e,t){const n=t.emitter;n.emit("return"),e.argument&&(n.emit(" "),te(e.argument,t)),n.emit(";")}(e,t);break;case"exprStmt":!function(e,t){const n=t.emitter;te(e.expression,t),n.emit(";")}(e,t);break;default:throw Error("Unknown node type: "+e.type)}}function ne(e,t){return"'"===t?`'${JSON.stringify(e).slice(1,-1).replace(/'/g,"\\'")}'`:JSON.stringify(e)}function re(e,t){const n=t.emitter;if(e.sourceRange){const t=e.mappingName??e.name;n.emitMapped(e.name,e.sourceRange,e.sourceNode||"PathExpression",t)}else n.emit(e.name)}function se(e){return"string"==typeof e?e:e.name}function oe(e,t){const n=t.emitter;"string"==typeof e?n.emit(e):re(e,t)}function ie(e,t,n){const r=t.emitter;n&&r.emit("(");for(let s=0;s<e.length;s++)s>0&&r.emit(", "),oe(e[s],t);n&&r.emit(")")}function ae(e){return e.map(se).join(", ")}function ce(e,t){const n=t.emitter;if(e.sourceRange&&n.pushScope(e.sourceRange,"HashPair"),e.shorthand)e.keySourceRange?n.emitMapped(e.key,e.keySourceRange,"HashPair",e.key):n.emit(e.key);else if(e.computed){const r=e.value;n.emit("["),te(r.elements[0],t),n.emit("]: "),te(r.elements[1],t)}else{const r=Y(e.key)?e.key:JSON.stringify(e.key);e.keySourceRange?n.emitMapped(r,e.keySourceRange,"HashPair",e.key):n.emit(r),n.emit(": "),te(e.value,t)}e.sourceRange&&n.popScope()}function ue(e,t,n,r,s=!1){return s&&t.emitter&&n&&t.emitter.emitMapped(e,n,r||"Synthetic"),e}function le(e){return e.indent.repeat(e.indentLevel)}function pe(e){return"\n"+e.baseIndent}function fe(e){const t=[0];for(let n=0;n<e.length;n++)"\n"===e[n]&&t.push(n+1);return t}function me(e,t,n){jn!==e&&(jn=e,Gn=fe(e));const r=t-1;return r<0||r>=Gn.length?n:Gn[r]+n}function de(e){if(e.loc&&jn)return{start:me(jn,e.loc.start.line,e.loc.start.column),end:me(jn,e.loc.end.line,e.loc.end.column)}}function ge(e){if(!e.loc||!jn)return;const t=me(jn,e.loc.start.line,e.loc.start.column);return{start:t,end:t+e.name.length}}function he(e){const t=e.head;let n="";if("ThisHead"===t.type)n="this";else if("AtHead"===t.type){const e=t.name??t.original;n=e.startsWith("@")?e:"@"+e}else n=t.name??t.original;return e.tail&&e.tail.length>0?`${n}.${e.tail.join(".")}`:n}function ye(e){if(!e.loc||!jn)return null;const t=me(jn,e.loc.start.line,e.loc.start.column),n=me(jn,e.loc.end.line,e.loc.end.column),r=jn.slice(t,n);if(r.includes("[")||r.includes("]")||r.includes("/"))return null;const s="AtHead"===e.head.type,o=[he(e).split(".")[0]??"",...e.tail??[]];if(0===o.length)return null;const i=o.map((e,t)=>({name:0===t&&s?e.replace(/^@/,""):e}));let a,c=0;for(let u=0;u<o.length&&u<i.length;u++){const e=o[u],n=r.indexOf(e,c);if(-1===n)return null;const l=t+n,p=l+e.length;if(0===u&&s&&e.startsWith("@")){const t=l+1,n=e.slice(1);i[u]={name:n,range:{start:t,end:p}},a={start:l,end:p}}else i[u]={name:i[u].name,range:{start:l,end:p}},0===u&&(a={start:l,end:p});c=n+e.length}return{parts:i,rootRange:a}}function be(e){if(!e.loc||!jn)return null;const t=e.program.blockParams;if(!t||0===t.length)return null;if(e.program.params&&e.program.params.length===t.length){const n=[];for(const t of e.program.params){if(!t.loc){n.length=0;break}const e=me(jn,t.loc.start.line,t.loc.start.column),r=me(jn,t.loc.end.line,t.loc.end.column);n.push({start:e,end:r})}if(n.length===t.length)return n}const n=me(jn,e.loc.start.line,e.loc.start.column);let r=-1;if(e.program?.loc){const t=me(jn,e.program.loc.start.line,e.program.loc.start.column);t>n&&(r=jn.lastIndexOf("}}",t))}if(-1===r&&(r=jn.indexOf("}}",n)),-1===r)return null;const s=[...jn.slice(n,r+2).matchAll(/\bas\s*\|([^|]*)\|/gm)],o=s.length>0?s[s.length-1]:null;if(!o)return null;const i=o[1],a=n+(o.index+o[0].indexOf(i)),c=[...i.matchAll(/[A-Za-z_$][A-Za-z0-9_$]*/g)];if(0===c.length)return null;const u=c.map(e=>({name:e[0],range:{start:a+e.index,end:a+e.index+e[0].length}}));if(u.length===t.length){const e=[];for(let n=0;n<t.length&&u[n].name===t[n];n++)e.push(u[n].range);if(e.length===t.length)return e}const l=[];let p=0;for(const f of t){let e=-1;for(let t=p;t<u.length;t++)if(u[t].name===f){e=t;break}if(-1===e)return null;l.push(u[e].range),p=e+1}return l.length>0?l:null}function _e(e){if("string"!=typeof e)return e;if(e.includes("'")||e.includes('"'))return e;if(e.includes("$_"))return e;if(e.includes("?."))return e;if(e.split(".").length<3)return e;let t=e.split("...").map(e=>e.split(".").join("?.")).join("...");t.includes("this?.")&&(t=t.split("this?.").join("this."));const n=`this[${un}]?.`,r=`this[${un}].`;return t.includes(n)&&(t=t.split(n).join(r)),t}function ve(e,t){if(t.startsWith("@")){const e=t.slice(1),n=e.split("."),r=n[0];let s;return/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(r)?s=`${ln}.${e}`:(s=`${ln}["${r}"]`,n.length>1&&(s+="."+n.slice(1).join("."))),_e(s)}if(e.flags.IS_GLIMMER_COMPAT_MODE&&t.startsWith("this.attrs."))return ve(e,"@"+t.slice(11));if(t.startsWith("this.")||"this"===t)return _e(t);const n=t.split(".")[0];return e.scopeTracker.hasBinding(n),_e(t)}function Re(e){switch(e.kind){case"literal":return void 0===e.value?"undefined":null===e.value?"null":"string"==typeof e.value?JSON.stringify(e.value):e.value+"";case"path":return function(e){if(e.includes("?."))return e;const t=e.split(".");if(0===t.length)return e;let n=t[0];for(let r=1;r<t.length;r++){const e=t[r];Y(e)?n+="."+e:n+=`[${JSON.stringify(e)}]`}return n}(e.expression);case"spread":return e.expression;case"raw":return e.code;case"helper":return $e(e);case"getter":return"() => "+Re(e.value);case"concat":return`[${e.parts.map(e=>Re(e)).join(",")}].join('')`;default:throw Error("Unknown value kind: "+e.kind)}}function ke(e){switch(e.kind){case"literal":return void 0===e.value?E(e.sourceRange):null===e.value?S(e.sourceRange):"string"==typeof e.value?v(e.value,e.sourceRange):"boolean"==typeof e.value?$(e.value,e.sourceRange):k(e.value,e.sourceRange);case"path":return W(e.expression,e.sourceRange);case"spread":return G(W(e.expression,e.sourceRange),e.sourceRange);case"raw":return B(e.code,e.sourceRange);case"helper":switch(e.name){case In:return function(e){const t=e.positional[0];let n;return n=t?"literal"===t.kind||"getter"===t.kind?ke(t):z(ke(t)):v("div"),K(n,{GET_ARGS:tn,GET_FW:nn,GET_SLOTS:en,FINALIZE_COMPONENT:Vt,TAG:Ht,SLOT:Jt,LOCAL_FW:sn,LOCAL_SLOTS:on},e.sourceRange)}(e);case On:return function(e){const[t,...n]=e.positional,r=t?ke(t):S(),s=n.map(e=>ke(e));return A(["$e","$n"],T(r,[M("$e"),M("$n"),...s]),e.sourceRange)}(e);case An:return function(e){const[t,...n]=e.positional,r=t?ke(t):S(),s=n.map(e=>ke(e));return A(["$n"],T(r,[M("$n"),...s]),e.sourceRange)}(e);case Pn:return function(e){const[t,n]=e.positional;return J(t&&"literal"===t.kind&&"string"==typeof t.value?t.value:"",n?ke(n):S(),{TO_VALUE:rn,LOCAL_VALUE:an,LOCAL_NODE:cn},e.sourceRange)}(e);default:return B($e(e))}case"getter":return z(ke(e.value),e.sourceRange);case"concat":return O(w(e.parts.map(e=>ke(e))),"join",[v("")],e.sourceRange);default:return B("")}}function $e(e){let t=[],n=e.name;if(n===In||n===On||n===An||n===Pn)return X(ke(e));if(n.startsWith("@")){const e=n.slice(1);n=/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(e)?`this[${un}].${e}`:`this[${un}]["${e}"]`}if("unless"===e.name)if(n="if",e.positional.length>=2)t.push(Re(e.positional[0])),e.positional.length>=3?(t.push(Re(e.positional[2])),t.push(Re(e.positional[1]))):(t.push('""'),t.push(Re(e.positional[1])));else for(const s of e.positional)t.push(Re(s));else for(const s of e.positional)t.push(Re(s));const r=y(n)??n;if(r===Sn){const t=[];for(const[n,r]of e.named)t.push(`${Q(n)}: () => ${Re(r)}`);return`${r}({ ${t.join(", ")} })`}if(e.named.size>0){const n=[];for(const[t,r]of e.named)n.push(`${Q(t)}: ${Re(r)}`);t.push(`{ ${n.join(", ")} }`)}if(r===hn||r===yn)return`${r}.bind(this, $slots)(${t.join(", ")})`;if(r===Mn)return`${r}.call(this${t.length>0?", "+t.join(", "):""})`;if(r===pn||r===mn||r===fn){const t=e.positional.map(e=>Re(e)),n=[];for(const[r,o]of e.named)n.push(`${Q(r)}: ${Re(o)}`);const s=n.length>0?`{ ${n.join(", ")} }`:"{}";return`${r}([${t.join(", ")}], ${s})`}return`${r}(${t.join(", ")})`}function Se(e){return 0===e.trim().length&&(e.includes("\n")||e.length>1)}function Ee(e){if(e.visitors?.visit)return e.visitors.visit;throw Error("No visit function available. Call initializeVisitors first.")}function Me(e){return e.split("-").map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join("")}function xe(e,t,n){return{_nodeType:"element",tag:e,selfClosing:!0,blockParams:[],hasStableChild:!1,attributes:t,properties:[],events:[],children:[],sourceRange:n}}function Ce(e){if(e.visitors?.visit)return e.visitors.visit;throw Error("No visit function available. Call initializeVisitors first.")}function Le(e){if(e.visitors?.visitChildren)return e.visitors.visitChildren;throw Error("No visitChildren function available. Call initializeVisitors first.")}function Te(e){return e.split("-").map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join("")}function Oe(e,t){["window","document","console","this","arguments","eval","undefined","null","true","false"].includes(t)&&b(e,`"${t}" is a reserved name and may cause unexpected behavior`,"W002")}function Ae(e){if(e.visitors?.visit)return e.visitors.visit;throw Error("No visit function available. Call initializeVisitors first.")}function Pe(e){if(e.visitors?.visitChildren)return e.visitors.visitChildren;throw Error("No visitChildren function available. Call initializeVisitors first.")}function Ie(e){return!!(Dn.has(e)||e.startsWith("aria-")||e.startsWith("data-")||"@oncreated"!==e&&"@textContent"!==e&&(e.startsWith("@")||"...attributes"===e))}function we(e){return e.children.some(e=>"ElementNode"===e.type||"TextNode"===e.type)}function Ne(e){return e[0]>="A"&&e[0]<="Z"||!!e.includes(".")||!!e.startsWith("@")||!!e.startsWith(":")}function je(e,t){["window","document","console","this"].includes(t)&&b(e,`"${t}" is a reserved binding name`,"W002")}function Ge(e,t){const n=t.attributes.filter(e=>e.name.startsWith("style.")),r=t.attributes.filter(e=>!e.name.startsWith("style."));return{styleEvents:n.map(t=>{const n=t.name.split(".").pop(),r=De(e,t.value),o=de(t),i=ge(t),c=i?{start:i.start+t.name.indexOf(n),end:i.start+t.name.indexOf(n)+n.length}:void 0,u=a(Pn,[s(n,c),r],/* @__PURE__ */new Map,o);return[Un,u,o]}),regularAttrs:r}}function Be(e,t,n=!1){return t.filter(e=>!(!Ie(e.name)||n&&"class"===e.name)).map(t=>{const n=De(e,t.value),r=ge(t);return[t.name,n,de(t),r]})}function We(e){return"@oncreated"===e||"@textContent"===e}function ze(e,t,n=!1){const r=[];for(const o of t){if(n&&"class"===o.name){const t=De(e,o.value);r.push(["",t,de(o)]);continue}if(Ie(o.name)||We(o.name))continue;const t=De(e,o.value);if(Hn.has(o.name)&&"TextNode"===o.value.type&&""===o.value.chars){const e=Vn[o.name]||o.name;r.push([e,s(!0),de(o)]);continue}const i=Vn[o.name]||o.name;r.push([i,t,de(o)])}return r}function De(e,t){if("TextNode"===t.type)return s(t.chars,de(t));if("MustacheStatement"===t.type){if(e.flags.IS_GLIMMER_COMPAT_MODE&&"SubExpression"===t.path.type){const r=t.path;if("PathExpression"===r.path.type){const o=he(r.path);if("has-block"===o||"has-block-params"===o){const o=Ae(e)(e,r,!1);if(null!==o&&n(o)){const e=de(t);return c(a("if",[o,s("true"),s("false")],/* @__PURE__ */new Map,e),e)}}}}const r=Ae(e)(e,t,!0);return null!==r&&n(r)?r:s(null)}if("ConcatStatement"===t.type){const r=Ae(e)(e,t,!1);return null!==r&&n(r)?r:s("")}return s(null)}function He(e,t,r){const o=[...r];for(const i of t.attributes)if("@oncreated"===i.name||"@textContent"===i.name){const t=de(i),r=De(e,i.value);if("@oncreated"===i.name){const e=r&&n(r)?r:s(null),i=a(An,[e],/* @__PURE__ */new Map,t);o.push([Un,i,t])}else o.push([Zn,r,t])}for(const i of t.modifiers){if(e.flags.IS_GLIMMER_COMPAT_MODE&&"SubExpression"===i.path.type){const t=i.path;if("PathExpression"===t.path.type&&"modifier"===he(t.path)){const r=t.params[0];if(r&&"StringLiteral"===r.type){const c=de(i),u=de(t.path),l=r.value,p=[];for(const r of t.params.slice(1)){const t=Ae(e)(e,r,!1);p.push(t&&n(t)?t:s(null))}for(const t of i.params){const r=Ae(e)(e,t,!1);p.push(r&&n(r)?r:s(null))}const f=/* @__PURE__ */new Map;for(const r of t.hash.pairs){const t=Ae(e)(e,r.value,!1);t&&n(t)&&f.set(r.key,t)}for(const t of i.hash.pairs){const r=Ae(e)(e,t.value,!1);r&&n(r)&&f.set(t.key,r)}const m=a(l,p,f,c,u);o.push([Un,m,c]);continue}}}if("PathExpression"!==i.path.type)continue;const t=de(i),r=de(i.path),c=he(i.path);if("on"===c){const r=i.params[0];if("StringLiteral"===r?.type){const c=i.params[1],u=c?Ae(e)(e,c,!1):null,l=[];u&&n(u)?l.push(u):"string"==typeof u?l.push(s(u)):l.push(s(null));for(const t of i.params.slice(2)){const r=Ae(e)(e,t,!1);r&&n(r)?l.push(r):"string"==typeof r?l.push(s(r)):l.push(s(null))}o.push([r.value,a(On,l,/* @__PURE__ */new Map,t),t])}}else{const u=i.params.map(t=>{const r=Ae(e)(e,t,!1);return r&&n(r)?r:s(null)}),l=/* @__PURE__ */new Map;for(const t of i.hash.pairs){const r=Ae(e)(e,t.value,!1);r&&n(r)&&l.set(t.key,r)}const p=a(c,u,l,t,r);o.push([Un,p,t])}}return o}function Ve(e,t){const r={children:t,additionalEvents:[]};if(1!==t.length)return r;const o=t[0];if("string"!=typeof o&&!n(o))return r;if(e.startsWith(":")||e.toLowerCase()!==e)return r;const i="string"==typeof o?o:Re(o);if(i.includes("SLOT")||i.includes("..."))return r;const a="string"==typeof o?s(o):o;return{children:[],additionalEvents:[[Zn,a]]}}function Ue(e){let t="";for(let n=0;n<e.length;n++){const r=e[n];if(r>="A"&&r<="Z"){if(n>0){const r=e[n-1]>="A"&&e[n-1]<="Z",s=n+1<e.length&&e[n+1]>="A"&&e[n+1]<="Z";r&&s||(t+="-")}t+=r.toLowerCase()}else t+=r}return t}function Ze(t,r,l=!0){t.seenNodes.add(r);const p=de(r);switch(r.type){case"UndefinedLiteral":return s(void 0,p);case"NullLiteral":return s(null,p);case"BooleanLiteral":case"NumberLiteral":case"StringLiteral":return s(r.value,p);case"TextNode":return function(e,t){const n=t.chars;return Se(n)?null:function(e){let t=e;for(const[n,r]of Object.entries(Bn))t=t.split(n).join(r);return t=t.replace(/&#(\d+);/g,(e,t)=>String.fromCharCode(parseInt(t,10))),t=t.replace(/&#x([0-9a-fA-F]+);/g,(e,t)=>String.fromCharCode(parseInt(t,16))),t}(n)}(0,r);case"PathExpression":return function(e,t,n,r){let s=he(t),i="AtHead"===t.head.type;e.flags.IS_GLIMMER_COMPAT_MODE&&"ThisHead"===t.head.type&&t.tail.length>=2&&"attrs"===t.tail[0]&&(s="@"+t.tail.slice(1).join("."),i=!0);const a=ve(e,s),c=ye(t);return o(a,i,r,c?.parts,c?.rootRange)}(t,r,0,p);case"ConcatStatement":return function(e,t){const r=[];for(const i of t.parts)if("TextNode"===i.type)e.seenNodes.add(i),r.push(s(i.chars));else{const t=Ze(e,i,!1);null!==t&&n(t)?r.push(t):r.push(s(""))}const o=de(t);return c(function(e,t){return{kind:"concat",parts:e,sourceRange:t}}(r,o),o)}(t,r);case"SubExpression":return function(e,t,r){if("PathExpression"!==t.path.type)return null;const o=he(t.path),u=de(t);if(e.flags.IS_GLIMMER_COMPAT_MODE&&"mut"===o&&1===t.params.length){const o=t.params[0];if("SubExpression"===o.type&&"PathExpression"===o.path.type&&"get"===he(o.path)){const l=o.params.map(t=>{const r=Ze(e,t,!1);return null===r?s(null):"string"==typeof r?s(r):n(r)?r:i(JSON.stringify(r))}),p=de(t.path),f=a("__mutGet",l,/* @__PURE__ */new Map,u,p);return r?c(f,u):f}}if(e.flags.IS_GLIMMER_COMPAT_MODE&&"mut"===o&&1===t.params.length){const i=t.params[0];if("PathExpression"===i.type){const l=he(i);if(l.startsWith("this.")||l.startsWith("@")){const p=Ze(e,i,!1),f=[p&&n(p)?p:s(null),s(l)],m=/* @__PURE__ */new Map;for(const r of t.hash.pairs){const t=Ze(e,r.value,!1);null!==t&&n(t)?m.set(r.key,t):"string"==typeof t&&m.set(r.key,s(t))}const d=a(o,f,m,u,de(t.path));return r?c(d,u):d}}}if("element"===o){const r=t.params[0],o=r?Ze(e,r,!1):s("div"),i=o&&n(o)?o:s("div"),c=de(t.path);return a(In,[i],/* @__PURE__ */new Map,u,c)}const l=t.params.map(t=>{const r=Ze(e,t,!1);return null===r?s(null):"string"==typeof r?s(r):n(r)?r:i(JSON.stringify(r))}),p=/* @__PURE__ */new Map;for(const i of t.hash.pairs){const t=Ze(e,i.value,!1);null!==t&&n(t)?p.set(i.key,t):"string"==typeof t&&p.set(i.key,s(t))}const f=a(o,l,p,u,de(t.path));return r&&"has-block"!==o&&"has-block-params"!==o?c(f,u):f}(t,r,l);case"MustacheStatement":return function(e,t,r=!0){const u=de(t);if("PathExpression"!==t.path.type)return function(e,t,r,o){const i=t.path;if("BooleanLiteral"===i.type||"UndefinedLiteral"===i.type||"NullLiteral"===i.type)return s(i.value,o);if("NumberLiteral"===i.type)return s(i.value,o);if("StringLiteral"===i.type)return s(i.value,o);if("SubExpression"===i.type){const t=Ee(e)(e,i,!1);return null===t?null:n(t)?r?c(t,o):t:null}return null}(e,t,r,u);const l=he(t.path);if("mount"===l&&e.flags.IS_GLIMMER_COMPAT_MODE)return function(e,t,r){const o=[];if(t.params.length>0){const e=t.params[0];"StringLiteral"===e.type&&o.push(["data-engine",s(e.value)])}const i=t.hash.pairs.find(e=>"model"===e.key);if(i){const t=Ee(e)(e,i.value,!1);null!==t&&n(t)&&o.push(["@model",c(t,r)])}return{_nodeType:"element",tag:"ember-mount",selfClosing:!0,blockParams:[],hasStableChild:!1,attributes:o,properties:[],events:[],children:[],sourceRange:r}}(e,t,u);if("component"===l&&e.flags.IS_GLIMMER_COMPAT_MODE){const r=t.params[0];if(!r||"SubExpression"!==r.type)return function(e,t,r){if(0===t.params.length)return null;const o=t.params[0];let i,a=!1;if("StringLiteral"===o.type)i=Me(o.value),a=!0;else{if("PathExpression"!==o.type)return o.type,null;i=he(o)}const u=[];a&&u.push(["@__fromComponentHelper__",s(!0)]);const l=t.params.slice(1);for(let s=0;s<l.length;s++){const t=l[s],o=Ee(e)(e,t,!1);null!==o&&n(o)&&u.push([`@__pos${s}__`,c(o,r)])}l.length>0&&u.push(["@__posCount__",s(l.length)]);for(const s of t.hash.pairs){const t=Ee(e)(e,s.value,!1);null!==t&&n(t)&&u.push(["@"+s.key,c(t,r)])}return{_nodeType:"element",tag:i,selfClosing:!0,blockParams:[],hasStableChild:!1,attributes:u,properties:[],events:[],children:[],sourceRange:r}}(e,t,u)}if(e.flags.IS_GLIMMER_COMPAT_MODE&&"mut"===l&&1===t.params.length){const o=t.params[0];if("SubExpression"===o.type&&"PathExpression"===o.path.type&&"get"===he(o.path)){const l=o.params.map(t=>{const r=Ee(e)(e,t,!1);return null===r?s(null):"string"==typeof r?s(r):n(r)?r:i(JSON.stringify(r))}),p=de(t.path),f=a("__mutGet",l,/* @__PURE__ */new Map,u,p);return r?c(f,u):f}}if(e.flags.IS_GLIMMER_COMPAT_MODE&&"PathExpression"===t.path.type&&"ThisHead"===t.path.head.type&&0===t.path.tail.length&&0===t.params.length&&0===t.hash.pairs.length)return o(ve(e,"this.__gxtSelfString__"),!1,de(t.path));if(("input"===l||"textarea"===l)&&e.flags.IS_GLIMMER_COMPAT_MODE)return function(e,t,r,s){const o="input"===r?"Input":"Textarea",i=[];for(const a of t.hash.pairs){const t=Ee(e)(e,a.value,!1);null!==t&&n(t)&&i.push(["@"+a.key,c(t,s)])}return{_nodeType:"element",tag:o,selfClosing:!0,blockParams:[],hasStableChild:!1,attributes:i,properties:[],events:[],children:[],sourceRange:s}}(e,t,l,u);if(e.flags.IS_GLIMMER_COMPAT_MODE&&function(e,t,n){if(!n.includes("-"))return!1;const r=t.path;return!("VarHead"!==r.head.type||r.tail.length>0||t.params.length>0||Wn.has(n)||e.scopeTracker.hasBinding(n)||0===t.hash.pairs.length)}(e,t,l))return function(e,t,r,o){const i=[];for(const s of t.hash.pairs){const t=Ee(e)(e,s.value,!1);null!==t&&n(t)&&i.push(["@"+s.key,c(t,o)])}for(let s=0;s<t.params.length;s++){const r=Ee(e)(e,t.params[s],!1);null!==r&&n(r)&&i.push([`@__pos${s}__`,c(r,o)])}return t.params.length>0&&i.push(["@__posCount__",s(t.params.length)]),xe(Me(r),i,o)}(e,t,l,u);if(e.flags.IS_GLIMMER_COMPAT_MODE&&"PathExpression"===t.path.type){const r=t.path.head;if("VarHead"===r.type&&t.path.tail.length>0){const o=r.name??r.original,i=e.scopeTracker.resolve(o);if(i&&"let-binding"===i.kind&&(t.hash.pairs.length>0||t.params.length>0))return function(e,t,r,o){const i=[];for(const s of t.hash.pairs){const t=Ee(e)(e,s.value,!1);null!==t&&n(t)&&i.push(["@"+s.key,c(t,o)])}for(let s=0;s<t.params.length;s++){const r=Ee(e)(e,t.params[s],!1);null!==r&&n(r)&&i.push([`@__pos${s}__`,c(r,o)])}return t.params.length>0&&i.push(["@__posCount__",s(t.params.length)]),xe(r,i,o)}(e,t,l,u)}}if("yield"===l||"outlet"===l)return function(e,t,r){let o="default";const i=t.hash.pairs.find(e=>"to"===e.key);if(i)if("StringLiteral"===i.value.type)o=i.value.value;else{const t=Ee(e)(e,i.value,!1);null!==t&&n(t)&&(o=Re(t))}const a=t.params.map(t=>{const r=Ee(e)(e,t,!1);return null===r?"":"string"==typeof r?r:n(r)?Re(r):""});return{_nodeType:"control",type:"yield",condition:s(""),blockParams:a,children:[],inverse:null,key:o,isSync:!0,sourceRange:r}}(e,t,u);const p=function(e,t){const r=/* @__PURE__ */new Map;for(const o of t){const t=Ee(e)(e,o.value,!1);null!==t&&(n(t)?r.set(o.key,t):"string"==typeof t&&r.set(o.key,s(t)))}return r}(e,t.hash.pairs);return 0===t.params.length?function(e,t,n,r,s){const i=t.path,c=he(i),u=i.head,l="ThisHead"===u.type;let p="AtHead"===u.type;e.flags.IS_GLIMMER_COMPAT_MODE&&l&&i.tail.length>=2&&"attrs"===i.tail[0]&&(p=!0);let f="this";"ThisHead"!==u.type&&(f=u.name??u.original);const m=!p&&!l&&e.scopeTracker.hasBinding(f),d=l||p||m,g=de(i);if(0===n.size){if(d){const t=ve(e,c),n=ye(i);return o(t,p,g,n?.parts,n?.rootRange)}return a(c,[],/* @__PURE__ */new Map,s,g)}return a(c,[],n,s,g)}(e,t,p,0,u):function(e,t,r,o,u){const l=t.path,p=a(he(l),t.params.map(t=>{const r=Ee(e)(e,t,!1);return null===r?s(null):"string"==typeof r?s(r):n(r)?r:i(JSON.stringify(r))}),r,u,de(l));return o?c(p,u):p}(e,t,p,r,u)}(t,r,l);case"BlockStatement":return function(t,r){const o=de(r);if(function(e,t){if("PathExpression"!==t.path.type)return!1;const n=he(t.path);return!(!e.scopeTracker.hasBinding(n)&&(zn.has(n)||!n.includes(".")&&(!e.flags.IS_GLIMMER_COMPAT_MODE||!n.includes("-"))))}(t,r))return function(t,r,o){const i=r.path,a=he(i),u=de(i),l=t.flags.IS_GLIMMER_COMPAT_MODE&&a.includes("-")?Te(a):a;t.flags.IS_GLIMMER_COMPAT_MODE&&a.includes("-")&&!t.scopeTracker.hasBinding(l)&&t.scopeTracker.addBinding(l,{kind:"compat-component",name:l});const p=r.hash.pairs.map(e=>{const r=Ce(t)(t,e.value,!1),o=null!==r&&n(r)?r:s(null);return["@"+e.key,o]}),f=zn.has(a);if((t.flags.IS_GLIMMER_COMPAT_MODE&&a.includes("-")||f)&&r.params.length>0){for(let e=0;e<r.params.length;e++){const s=r.params[e],i=Ce(t)(t,s,!1);null!==i&&n(i)&&p.push([`@__pos${e}__`,c(i,o)])}p.push(["@__posCount__",s(r.params.length)])}else r.params.length>0&&b(t,`Positional parameters are not supported on component block "{{#${l}}}" and will be ignored`,"W005");const m=r.program.blockParams,d=be(r);t.scopeTracker.enterScope("component-block");for(const e of m)Oe(t,e),t.scopeTracker.addBinding(e,{kind:"block-param",name:e});const g=Le(t)(t,r.program.body);t.scopeTracker.exitScope();let h,y=null;if(r.inverse?.body){const n=r.inverse.blockParams??[];t.scopeTracker.enterScope("component-inverse");for(const e of n)Oe(t,e),t.scopeTracker.addBinding(e,{kind:"block-param",name:e});const s=Le(t)(t,r.inverse.body);t.scopeTracker.exitScope(),y={_nodeType:"element",tag:":inverse",attributes:[],properties:[],events:[],children:s,blockParams:n,blockParamRanges:void 0,selfClosing:!1,hasStableChild:s.some(t=>"string"==typeof t||e(t))}}h=y?[{_nodeType:"element",tag:":default",attributes:[],properties:[],events:[],children:g,blockParams:m,blockParamRanges:d??void 0,selfClosing:!1,hasStableChild:g.some(t=>"string"==typeof t||e(t))},y]:g;const _=h.some(t=>"string"==typeof t||e(t));return{_nodeType:"element",tag:l,attributes:p,properties:[],events:[],children:h,blockParams:m,blockParamRanges:d??void 0,selfClosing:!1,hasStableChild:_,sourceRange:o,tagRange:u}}(t,r,o);if(t.flags.IS_GLIMMER_COMPAT_MODE&&"PathExpression"===r.path.type&&"component"===he(r.path)&&r.params.length>0)return function(t,r,o){const i=r.params[0];let a;if("StringLiteral"===i.type)a=Te(i.value);else{if("PathExpression"!==i.type)return null;a=he(i)}const u=r.hash.pairs.map(e=>{const r=Ce(t)(t,e.value,!1),i=null!==r&&n(r)?r:s(null);return["@"+e.key,c(i,o)]}),l=r.params.slice(1);for(let e=0;e<l.length;e++){const r=l[e],s=Ce(t)(t,r,!1);null!==s&&n(s)&&u.push([`@__pos${e}__`,c(s,o)])}l.length>0&&u.push(["@__posCount__",s(l.length)]);const p=r.program.blockParams,f=be(r);t.scopeTracker.enterScope("component-helper-block");for(const e of p)Oe(t,e),t.scopeTracker.addBinding(e,{kind:"block-param",name:e});const m=Le(t)(t,r.program.body);t.scopeTracker.exitScope();const d=m.some(t=>"string"==typeof t||e(t));return{_nodeType:"element",tag:a,attributes:u,properties:[],events:[],children:m,blockParams:p,blockParamRanges:f??void 0,selfClosing:!1,hasStableChild:d,sourceRange:o}}(t,r,o);if(!r.params.length)return null;if("PathExpression"!==r.path.type)return null;const i=he(r.path);if("let"===i)return function(e,t,r){const o=t.program.blockParams,i=t.params.map((t,r)=>{const i=o[r],a="StringLiteral"===t.type||"BooleanLiteral"===t.type||"NumberLiteral"===t.type||"NullLiteral"===t.type||"UndefinedLiteral"===t.type,c=Ce(e)(e,t,!1);return{name:i,value:null!==c&&n(c)?c:s(null),isPrimitive:a}});e.scopeTracker.enterScope("let");for(const n of o)Oe(e,n),e.scopeTracker.addBinding(n,{kind:"let-binding",name:n});const a=Le(e)(e,t.program.body);return e.scopeTracker.exitScope(),a.length?{_nodeType:"control",type:"let",condition:s(null),blockParams:o,children:a,inverse:null,key:null,isSync:!1,letBindings:i,sourceRange:r}:null}(t,r,o);const a=r.program.blockParams,u=be(r);t.scopeTracker.enterScope(i);for(const e of a)Oe(t,e),t.scopeTracker.addBinding(e,{kind:"block-param",name:e});const l=Le(t)(t,r.program.body);t.scopeTracker.exitScope();let p=null;if(r.inverse?.body){const e=r.inverse.blockParams??[];t.scopeTracker.enterScope(i+"-inverse");for(const n of e)Oe(t,n),t.scopeTracker.addBinding(n,{kind:"block-param",name:n});p=Le(t)(t,r.inverse.body),t.scopeTracker.exitScope()}if(!l.length&&!p?.length)return null;const{keyValue:f,syncValue:m}=function(e,t){let r=null,s=!1;const o=t.hash.pairs.find(e=>"key"===e.key),i=t.hash.pairs.find(e=>"sync"===e.key);if(o)if("StringLiteral"===o.value.type)r=o.value.original;else{const t=Ce(e)(e,o.value,!1);null!==t&&n(t)&&(r=Re(t))}if(i)if("BooleanLiteral"===i.value.type)s=i.value.value;else{const t=Ce(e)(e,i.value,!1);null!==t&&"boolean"==typeof t&&(s=t)}return{keyValue:r,syncValue:s}}(t,r);switch(i){case"in-element":return function(e,t,r,o){const i=Ce(e)(e,t.params[0],!0);return{_nodeType:"control",type:"in-element",condition:null!==i&&n(i)?i:s(null),blockParams:[],children:r,inverse:null,key:null,isSync:!0,sourceRange:o}}(t,r,l,o);case"unless":return function(e,t,r,o,i,a,c,u,l){const p=Ce(e)(e,t.params[0],!0);return{_nodeType:"control",type:"if",condition:null!==p&&n(p)?p:s(null),blockParams:i,blockParamRanges:a??void 0,children:o??[],inverse:r,key:c,isSync:u,sourceRange:l}}(t,r,l,p,a,u,f,m,o);default:return function(e,t,r,o,i,a,c,u,l,p){const f=Ce(e)(e,t.params[0],!0);return{_nodeType:"control",type:r,condition:null!==f&&n(f)?f:s(null),blockParams:a,blockParamRanges:c??void 0,children:o,inverse:i,key:u,isSync:l,sourceRange:p}}(t,r,i,l,p,a,u,f,m,o)}}(t,r);case"ElementNode":return function(e,t){const n=de(t);let r=t.tag;if(e.flags.IS_GLIMMER_COMPAT_MODE&&-1!==r.indexOf("::")&&(r=function(e){return e.split("::").map(Ue).join("--")}(r)),e.flags.IS_GLIMMER_COMPAT_MODE&&(r=function(e){return Fn[e]??e}(r),t.tag=r),e.flags.IS_GLIMMER_COMPAT_MODE&&!t.selfClosing&&0===t.children.length&&(Ne(r)||r.includes("-"))&&(t.attributes.some(e=>"@__hasBlock__"===e.name)||t.attributes.push({type:"AttrNode",name:"@__hasBlock__",value:{type:"TextNode",chars:"default",loc:t.loc},loc:t.loc})),e.customizeComponentName&&Ne(r)&&(r=e.customizeComponentName(r)),"math"===t.tag||"svg"===t.tag)return function(e,t,n){const r="math"===t.tag?"mathml":"svg",s="math"===t.tag?u(Dt):u(zt);return _(e,{namespace:r,parentNamespace:e.elementContext.namespace},()=>{const r={...t,tag:`__wrapped_${t.tag}__`},o=function(e,t,n){let r=t.tag;"__wrapped_math__"===t.tag?r="math":"__wrapped_svg__"===t.tag&&(r="svg"),e.scopeTracker.enterScope("element-block");for(const d of t.blockParams)je(e,d),e.scopeTracker.addBinding(d,{kind:"block-param",name:d});const s=Pe(e)(e,t.children);e.scopeTracker.exitScope();const{styleEvents:o,regularAttrs:i}=Ge(e,t),a=Be(e,i),c=ze(e,i),u=He(e,t,o),{children:l,additionalEvents:p}=Ve(r,s),f=[...u,...p],m=n?{start:n.start+1,end:n.start+1+t.tag.length}:void 0;return e.customizeComponentName&&Ne(r)&&(r=e.customizeComponentName(r)),{_nodeType:"element",tag:r,selfClosing:t.selfClosing,blockParams:t.blockParams,hasStableChild:we(t),attributes:a,properties:c,events:f,children:l,sourceRange:n,tagRange:m}}(e,r,n);return{_nodeType:"element",tag:s,selfClosing:!1,blockParams:[],hasStableChild:!0,attributes:[],properties:[],events:[],children:[o],sourceRange:n}})}(e,t,n);if("foreignObject"===t.tag)return function(e,t,n){const r=_(e,{namespace:"html",parentNamespace:e.elementContext.namespace},()=>Pe(e)(e,t.children)),{styleEvents:s,regularAttrs:o}=Ge(e,t),i=Be(e,o),a=ze(e,o),c=He(e,t,s),l=r.length>0?[{_nodeType:"element",tag:u(Wt),selfClosing:!1,blockParams:[],hasStableChild:!0,attributes:[],properties:[],events:[],children:r,sourceRange:void 0}]:[];return{_nodeType:"element",tag:"foreignObject",selfClosing:t.selfClosing,blockParams:[],hasStableChild:we(t),attributes:i,properties:a,events:c,children:l,sourceRange:n}}(e,t,n);"__wrapped_math__"===t.tag?r="math":"__wrapped_svg__"===t.tag&&(r="svg"),e.flags.IS_GLIMMER_COMPAT_MODE&&function(e){const t=[];for(let n=0;n<e.attributes.length;n++){const r=e.attributes[n],s=r.name.toLowerCase();if(!s.startsWith("on")||s.length<=2)continue;const o=s.slice(2);if(!qn.has(o))continue;if("MustacheStatement"!==r.value.type)continue;const i=r.value,a={type:"ElementModifierStatement",path:{type:"PathExpression",original:"on",parts:["on"],head:{type:"VarHead",name:"on",original:"on",loc:r.loc},tail:[],this:!1,data:!1,loc:r.loc},params:[{type:"StringLiteral",value:o,original:o,loc:r.loc},i.path],hash:{type:"Hash",pairs:[],loc:r.loc},loc:r.loc};e.modifiers.push(a),t.push(n)}for(let n=t.length-1;n>=0;n--)e.attributes.splice(t[n],1)}(t),e.flags.IS_GLIMMER_COMPAT_MODE&&function(e){let t=-1;for(let o=0;o<e.attributes.length;o++)if("...attributes"===e.attributes[o].name){t=o;break}if(-1===t)return;const n=[];let r=!1;for(let o=t+1;o<e.attributes.length;o++){const t=e.attributes[o].name;t.startsWith("@")||"__splatLocal__"===t||("class"===t?r=!0:n.push(t))}if(0===n.length&&!r)return;const s=[...n];r&&s.push("__class__"),e.attributes.some(e=>"__splatLocal__"===e.name)||e.attributes.push({type:"AttrNode",name:"__splatLocal__",value:{type:"TextNode",chars:s.join(","),loc:e.loc},loc:e.loc})}(t),e.scopeTracker.enterScope("element-block");for(const u of t.blockParams)je(e,u),e.scopeTracker.addBinding(u,{kind:"block-param",name:u});const s=Pe(e)(e,t.children);e.scopeTracker.exitScope();const{styleEvents:o,regularAttrs:i}=Ge(e,t),a=t.attributes.some(e=>"...attributes"===e.name),c=function(e){if(!jn)return null;if(!e.params||0===e.params.length)return null;if(e.blockParams.length!==e.params.length)return null;const t=[];for(const n of e.params){if(!n.loc)return null;const e=me(jn,n.loc.start.line,n.loc.start.column),r=me(jn,n.loc.end.line,n.loc.end.column);t.push({start:e,end:r})}return t}(t),l=Be(e,i,a),p=ze(e,i,a),f=He(e,t,o),{children:m,additionalEvents:d}=Ve(r,s),g=[...f,...d],h=n?{start:n.start+1,end:n.start+1+t.tag.length}:void 0;return e.customizeComponentName&&