prettier 3.0.0-alpha.4 → 3.0.0-alpha.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +849 -415
- package/README.md +3 -3
- package/doc.d.ts +248 -0
- package/doc.js +274 -199
- package/doc.mjs +269 -194
- package/index.cjs +380 -201
- package/index.d.ts +903 -0
- package/index.mjs +7539 -5795
- package/internal/cli.mjs +2025 -3219
- package/internal/third-party.mjs +2948 -5593
- package/package.json +32 -1
- package/plugins/acorn-and-espree.d.ts +10 -0
- package/plugins/acorn-and-espree.js +12 -12
- package/plugins/acorn-and-espree.mjs +12 -12
- package/plugins/angular.d.ts +12 -0
- package/plugins/angular.js +2 -2
- package/plugins/angular.mjs +2 -2
- package/plugins/babel.d.ts +17 -0
- package/plugins/babel.js +13 -13
- package/plugins/babel.mjs +13 -13
- package/plugins/flow.d.ts +9 -0
- package/plugins/flow.js +20 -20
- package/plugins/flow.mjs +20 -20
- package/plugins/glimmer.d.ts +9 -0
- package/plugins/glimmer.js +18 -17
- package/plugins/glimmer.mjs +18 -17
- package/plugins/graphql.d.ts +9 -0
- package/plugins/graphql.js +7 -7
- package/plugins/graphql.mjs +7 -7
- package/plugins/html.d.ts +12 -0
- package/plugins/html.js +17 -28
- package/plugins/html.mjs +17 -28
- package/plugins/markdown.d.ts +11 -0
- package/plugins/markdown.js +28 -29
- package/plugins/markdown.mjs +28 -29
- package/plugins/meriyah.d.ts +9 -0
- package/plugins/meriyah.js +5 -6
- package/plugins/meriyah.mjs +5 -6
- package/plugins/postcss.d.ts +11 -0
- package/plugins/postcss.js +32 -43
- package/plugins/postcss.mjs +32 -43
- package/plugins/typescript.d.ts +9 -0
- package/plugins/typescript.js +18 -27
- package/plugins/typescript.mjs +18 -27
- package/plugins/yaml.d.ts +9 -0
- package/plugins/yaml.js +108 -108
- package/plugins/yaml.mjs +108 -108
- package/standalone.d.ts +33 -0
- package/standalone.js +74 -80
- package/standalone.mjs +74 -80
package/plugins/angular.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
(function(
|
|
2
|
-
`,ut="\r",lt=function(){function r(e){this.length=e.length;for(var t=[0],s=0;s<e.length;)switch(e[s]){case Ae:s+=Ae.length,t.push(s);break;case ut:s+=ut.length,e[s]===Ae&&(s+=Ae.length),t.push(s);break;default:s++;break}this.offsets=t}return r.prototype.locationForIndex=function(e){if(e<0||e>this.length)return null;for(var t=0,s=this.offsets;s[t+1]<=e;)t++;var n=e-s[t];return{line:t,column:n}},r.prototype.indexForLocation=function(e){var t=e.line,s=e.column;return t<0||t>=this.offsets.length||s<0||s>this.lengthOfLine(t)?null:this.offsets[t]+s},r.prototype.lengthOfLine=function(e){var t=this.offsets[e],s=e===this.offsets.length-1?this.length:this.offsets[e+1];return s-t},r}()});var xe,De,ft=$(()=>{g();xt();xe=class{constructor(e){Ee(this,"text");Ee(this,"locator");this.text=e,this.locator=new De(this.text)}},De=class{constructor(e){Ee(this,"_linesAndColumns");this._linesAndColumns=new lt(e)}locationForIndex(e){let{line:t,column:s}=this._linesAndColumns.locationForIndex(e);return{line:t+1,column:s,index:e}}}});var W,K,w,Q,C,T,$e,j,H,M,z,q,X,Ce,Z,J,O,Y,ee,Oe,N,L,te,re,se,ne,b,B,F,ie,Ne,dt,Ge=$(()=>{g();W=class{constructor(e,t,s,n){this.input=t,this.errLocation=s,this.ctxLocation=n,this.message=`Parser Error: ${e} ${s} [${t}] in ${n}`}},K=class{constructor(e,t){this.start=e,this.end=t}toAbsolute(e){return new b(e+this.start,e+this.end)}},w=class{constructor(e,t){this.span=e,this.sourceSpan=t}toString(){return"AST"}},Q=class extends w{constructor(e,t,s){super(e,t),this.nameSpan=s}},C=class extends w{visit(e,t=null){}},T=class extends w{visit(e,t=null){return e.visitImplicitReceiver(this,t)}},$e=class extends T{visit(e,t=null){var s;return(s=e.visitThisReceiver)==null?void 0:s.call(e,this,t)}},j=class extends w{constructor(e,t,s){super(e,t),this.expressions=s}visit(e,t=null){return e.visitChain(this,t)}},H=class extends w{constructor(e,t,s,n,i){super(e,t),this.condition=s,this.trueExp=n,this.falseExp=i}visit(e,t=null){return e.visitConditional(this,t)}},M=class extends Q{constructor(e,t,s,n,i){super(e,t,s),this.receiver=n,this.name=i}visit(e,t=null){return e.visitPropertyRead(this,t)}},z=class extends Q{constructor(e,t,s,n,i,a){super(e,t,s),this.receiver=n,this.name=i,this.value=a}visit(e,t=null){return e.visitPropertyWrite(this,t)}},q=class extends Q{constructor(e,t,s,n,i){super(e,t,s),this.receiver=n,this.name=i}visit(e,t=null){return e.visitSafePropertyRead(this,t)}},X=class extends w{constructor(e,t,s,n){super(e,t),this.receiver=s,this.key=n}visit(e,t=null){return e.visitKeyedRead(this,t)}},Ce=class extends w{constructor(e,t,s,n){super(e,t),this.receiver=s,this.key=n}visit(e,t=null){return e.visitSafeKeyedRead(this,t)}},Z=class extends w{constructor(e,t,s,n,i){super(e,t),this.receiver=s,this.key=n,this.value=i}visit(e,t=null){return e.visitKeyedWrite(this,t)}},J=class extends Q{constructor(e,t,s,n,i,a){super(e,t,a),this.exp=s,this.name=n,this.args=i}visit(e,t=null){return e.visitPipe(this,t)}},O=class extends w{constructor(e,t,s){super(e,t),this.value=s}visit(e,t=null){return e.visitLiteralPrimitive(this,t)}},Y=class extends w{constructor(e,t,s){super(e,t),this.expressions=s}visit(e,t=null){return e.visitLiteralArray(this,t)}},ee=class extends w{constructor(e,t,s,n){super(e,t),this.keys=s,this.values=n}visit(e,t=null){return e.visitLiteralMap(this,t)}},Oe=class extends w{constructor(e,t,s,n){super(e,t),this.strings=s,this.expressions=n}visit(e,t=null){return e.visitInterpolation(this,t)}},N=class extends w{constructor(e,t,s,n,i){super(e,t),this.operation=s,this.left=n,this.right=i}visit(e,t=null){return e.visitBinary(this,t)}},L=class extends N{constructor(e,t,s,n,i,a,h){super(e,t,i,a,h),this.operator=s,this.expr=n,this.left=null,this.right=null,this.operation=null}static createMinus(e,t,s){return new L(e,t,"-",s,"-",new O(e,t,0),s)}static createPlus(e,t,s){return new L(e,t,"+",s,"-",s,new O(e,t,0))}visit(e,t=null){return e.visitUnary!==void 0?e.visitUnary(this,t):e.visitBinary(this,t)}},te=class extends w{constructor(e,t,s){super(e,t),this.expression=s}visit(e,t=null){return e.visitPrefixNot(this,t)}},re=class extends w{constructor(e,t,s){super(e,t),this.expression=s}visit(e,t=null){return e.visitNonNullAssert(this,t)}},se=class extends w{constructor(e,t,s,n,i){super(e,t),this.receiver=s,this.args=n,this.argumentSpan=i}visit(e,t=null){return e.visitCall(this,t)}},ne=class extends w{constructor(e,t,s,n,i){super(e,t),this.receiver=s,this.args=n,this.argumentSpan=i}visit(e,t=null){return e.visitSafeCall(this,t)}},b=class{constructor(e,t){this.start=e,this.end=t}},B=class extends w{constructor(e,t,s,n,i){super(new K(0,t===null?0:t.length),new b(n,t===null?n:n+t.length)),this.ast=e,this.source=t,this.location=s,this.errors=i}visit(e,t=null){return e.visitASTWithSource?e.visitASTWithSource(this,t):this.ast.visit(e,t)}toString(){return`${this.source} in ${this.location}`}},F=class{constructor(e,t,s){this.sourceSpan=e,this.key=t,this.value=s}},ie=class{constructor(e,t,s){this.sourceSpan=e,this.key=t,this.value=s}},Ne=class{visit(e,t){e.visit(this,t)}visitUnary(e,t){this.visit(e.expr,t)}visitBinary(e,t){this.visit(e.left,t),this.visit(e.right,t)}visitChain(e,t){this.visitAll(e.expressions,t)}visitConditional(e,t){this.visit(e.condition,t),this.visit(e.trueExp,t),this.visit(e.falseExp,t)}visitPipe(e,t){this.visit(e.exp,t),this.visitAll(e.args,t)}visitImplicitReceiver(e,t){}visitThisReceiver(e,t){}visitInterpolation(e,t){this.visitAll(e.expressions,t)}visitKeyedRead(e,t){this.visit(e.receiver,t),this.visit(e.key,t)}visitKeyedWrite(e,t){this.visit(e.receiver,t),this.visit(e.key,t),this.visit(e.value,t)}visitLiteralArray(e,t){this.visitAll(e.expressions,t)}visitLiteralMap(e,t){this.visitAll(e.values,t)}visitLiteralPrimitive(e,t){}visitPrefixNot(e,t){this.visit(e.expression,t)}visitNonNullAssert(e,t){this.visit(e.expression,t)}visitPropertyRead(e,t){this.visit(e.receiver,t)}visitPropertyWrite(e,t){this.visit(e.receiver,t),this.visit(e.value,t)}visitSafePropertyRead(e,t){this.visit(e.receiver,t)}visitSafeKeyedRead(e,t){this.visit(e.receiver,t),this.visit(e.key,t)}visitCall(e,t){this.visit(e.receiver,t),this.visitAll(e.args,t)}visitSafeCall(e,t){this.visit(e.receiver,t),this.visitAll(e.args,t)}visitAll(e,t){for(let s of e)this.visit(s,t)}};(function(r){r[r.DEFAULT=0]="DEFAULT",r[r.LITERAL_ATTR=1]="LITERAL_ATTR",r[r.ANIMATION=2]="ANIMATION"})(dt||(dt={}))});function vt(r){return r>=9&&r<=32||r==160}function _(r){return 48<=r&&r<=57}function gt(r){return r>=97&&r<=122||r>=65&&r<=90}function Ve(r){return r===39||r===34||r===96}var We=$(()=>{g();});function Et(r,e,t){return new P(r,e,v.Character,t,String.fromCharCode(t))}function Br(r,e,t){return new P(r,e,v.Identifier,0,t)}function Kr(r,e,t){return new P(r,e,v.PrivateIdentifier,0,t)}function Tr(r,e,t){return new P(r,e,v.Keyword,0,t)}function je(r,e,t){return new P(r,e,v.Operator,0,t)}function _r(r,e,t){return new P(r,e,v.String,0,t)}function Mr(r,e,t){return new P(r,e,v.Number,t,"")}function Fr(r,e,t){return new P(r,e,v.Error,0,t)}function At(r){return 97<=r&&r<=122||65<=r&&r<=90||r==95||r==36}function $t(r){return gt(r)||_(r)||r==95||r==36}function Ur(r){return r==101||r==69}function Dr(r){return r==45||r==43}function Gr(r){switch(r){case 110:return 10;case 102:return 12;case 114:return 13;case 116:return 9;case 118:return 11;default:return r}}function Vr(r){let e=parseInt(r);if(isNaN(e))throw new Error("Invalid integer literal when parsing "+r);return e}var v,br,fe,P,Re,He,qe=$(()=>{g();We();(function(r){r[r.Character=0]="Character",r[r.Identifier=1]="Identifier",r[r.PrivateIdentifier=2]="PrivateIdentifier",r[r.Keyword=3]="Keyword",r[r.String=4]="String",r[r.Operator=5]="Operator",r[r.Number=6]="Number",r[r.Error=7]="Error"})(v||(v={}));br=["var","let","as","null","undefined","true","false","if","else","this"],fe=class{tokenize(e){let t=new He(e),s=[],n=t.scanToken();for(;n!=null;)s.push(n),n=t.scanToken();return s}},P=class{constructor(e,t,s,n,i){this.index=e,this.end=t,this.type=s,this.numValue=n,this.strValue=i}isCharacter(e){return this.type==v.Character&&this.numValue==e}isNumber(){return this.type==v.Number}isString(){return this.type==v.String}isOperator(e){return this.type==v.Operator&&this.strValue==e}isIdentifier(){return this.type==v.Identifier}isPrivateIdentifier(){return this.type==v.PrivateIdentifier}isKeyword(){return this.type==v.Keyword}isKeywordLet(){return this.type==v.Keyword&&this.strValue=="let"}isKeywordAs(){return this.type==v.Keyword&&this.strValue=="as"}isKeywordNull(){return this.type==v.Keyword&&this.strValue=="null"}isKeywordUndefined(){return this.type==v.Keyword&&this.strValue=="undefined"}isKeywordTrue(){return this.type==v.Keyword&&this.strValue=="true"}isKeywordFalse(){return this.type==v.Keyword&&this.strValue=="false"}isKeywordThis(){return this.type==v.Keyword&&this.strValue=="this"}isError(){return this.type==v.Error}toNumber(){return this.type==v.Number?this.numValue:-1}toString(){switch(this.type){case v.Character:case v.Identifier:case v.Keyword:case v.Operator:case v.PrivateIdentifier:case v.String:case v.Error:return this.strValue;case v.Number:return this.numValue.toString();default:return null}}};Re=new P(-1,-1,v.Character,0,""),He=class{constructor(e){this.input=e,this.peek=0,this.index=-1,this.length=e.length,this.advance()}advance(){this.peek=++this.index>=this.length?0:this.input.charCodeAt(this.index)}scanToken(){let e=this.input,t=this.length,s=this.peek,n=this.index;for(;s<=32;)if(++n>=t){s=0;break}else s=e.charCodeAt(n);if(this.peek=s,this.index=n,n>=t)return null;if(At(s))return this.scanIdentifier();if(_(s))return this.scanNumber(n);let i=n;switch(s){case 46:return this.advance(),_(this.peek)?this.scanNumber(i):Et(i,this.index,46);case 40:case 41:case 123:case 125:case 91:case 93:case 44:case 58:case 59:return this.scanCharacter(i,s);case 39:case 34:return this.scanString();case 35:return this.scanPrivateIdentifier();case 43:case 45:case 42:case 47:case 37:case 94:return this.scanOperator(i,String.fromCharCode(s));case 63:return this.scanQuestion(i);case 60:case 62:return this.scanComplexOperator(i,String.fromCharCode(s),61,"=");case 33:case 61:return this.scanComplexOperator(i,String.fromCharCode(s),61,"=",61,"=");case 38:return this.scanComplexOperator(i,"&",38,"&");case 124:return this.scanComplexOperator(i,"|",124,"|");case 160:for(;vt(this.peek);)this.advance();return this.scanToken()}return this.advance(),this.error(`Unexpected character [${String.fromCharCode(s)}]`,0)}scanCharacter(e,t){return this.advance(),Et(e,this.index,t)}scanOperator(e,t){return this.advance(),je(e,this.index,t)}scanComplexOperator(e,t,s,n,i,a){this.advance();let h=t;return this.peek==s&&(this.advance(),h+=n),i!=null&&this.peek==i&&(this.advance(),h+=a),je(e,this.index,h)}scanIdentifier(){let e=this.index;for(this.advance();$t(this.peek);)this.advance();let t=this.input.substring(e,this.index);return br.indexOf(t)>-1?Tr(e,this.index,t):Br(e,this.index,t)}scanPrivateIdentifier(){let e=this.index;if(this.advance(),!At(this.peek))return this.error("Invalid character [#]",-1);for(;$t(this.peek);)this.advance();let t=this.input.substring(e,this.index);return Kr(e,this.index,t)}scanNumber(e){let t=this.index===e,s=!1;for(this.advance();;){if(!_(this.peek))if(this.peek===95){if(!_(this.input.charCodeAt(this.index-1))||!_(this.input.charCodeAt(this.index+1)))return this.error("Invalid numeric separator",0);s=!0}else if(this.peek===46)t=!1;else if(Ur(this.peek)){if(this.advance(),Dr(this.peek)&&this.advance(),!_(this.peek))return this.error("Invalid exponent",-1);t=!1}else break;this.advance()}let n=this.input.substring(e,this.index);s&&(n=n.replace(/_/g,""));let i=t?Vr(n):parseFloat(n);return Mr(e,this.index,i)}scanString(){let e=this.index,t=this.peek;this.advance();let s="",n=this.index,i=this.input;for(;this.peek!=t;)if(this.peek==92){s+=i.substring(n,this.index),this.advance();let h;if(this.peek=this.peek,this.peek==117){let d=i.substring(this.index+1,this.index+5);if(/^[0-9a-f]+$/i.test(d))h=parseInt(d,16);else return this.error(`Invalid unicode escape [\\u${d}]`,0);for(let f=0;f<5;f++)this.advance()}else h=Gr(this.peek),this.advance();s+=String.fromCharCode(h),n=this.index}else{if(this.peek==0)return this.error("Unterminated quote",0);this.advance()}let a=i.substring(n,this.index);return this.advance(),_r(e,this.index,s+a)}scanQuestion(e){this.advance();let t="?";return(this.peek===63||this.peek===46)&&(t+=this.peek===46?".":"?",this.advance()),je(e,this.index,t)}error(e,t){let s=this.index+t;return Fr(s,this.index,`Lexer Error: ${e} at column ${s} in expression [${this.input}]`)}}});function kt(r,e){if(e!=null&&!(Array.isArray(e)&&e.length==2))throw new Error(`Expected '${r}' to be an array, [start, end].`);if(e!=null){let t=e[0],s=e[1];Wr.forEach(n=>{if(n.test(t)||n.test(s))throw new Error(`['${t}', '${s}'] contains unusable interpolation symbol.`)})}}var Wr,It=$(()=>{g();Wr=[/^\s*$/,/[<>]/,/^[{}]$/,/&(#|[a-z])/i,/^\/\//]});var me,G,Pt=$(()=>{g();It();me=class{constructor(e,t){this.start=e,this.end=t}static fromArray(e){return e?(kt("interpolation",e),new me(e[0],e[1])):G}},G=new me("{{","}}")});function Qr(r){let e=new Map,t=0,s=0,n=0;for(;n<r.length;){let i=r[n];if(i.type===9){let[a,h]=i.parts;t+=h.length,s+=a.length}else{let a=i.parts.reduce((h,d)=>h+d.length,0);s+=a,t+=a}e.set(s,t),n++}return e}var Xe,Ze,Se,pe,V,Je,Rt=$(()=>{g();We();Pt();Ge();qe();Xe=class{constructor(e,t,s){this.strings=e,this.expressions=t,this.offsets=s}},Ze=class{constructor(e,t,s){this.templateBindings=e,this.warnings=t,this.errors=s}},Se=class{constructor(e){this._lexer=e,this.errors=[]}parseAction(e,t,s,n,i=G){this._checkNoInterpolation(e,s,i);let a=this._stripComments(e),h=this._lexer.tokenize(a),d=1;t&&(d|=2);let f=new V(e,s,n,h,d,this.errors,0).parseChain();return new B(f,e,s,n,this.errors)}parseBinding(e,t,s,n=G){let i=this._parseBindingAst(e,t,s,n);return new B(i,e,t,s,this.errors)}checkSimpleExpression(e){let t=new Je;return e.visit(t),t.errors}parseSimpleBinding(e,t,s,n=G){let i=this._parseBindingAst(e,t,s,n),a=this.checkSimpleExpression(i);return a.length>0&&this._reportError(`Host binding expression cannot contain ${a.join(" ")}`,e,t),new B(i,e,t,s,this.errors)}_reportError(e,t,s,n){this.errors.push(new W(e,t,s,n))}_parseBindingAst(e,t,s,n){this._checkNoInterpolation(e,t,n);let i=this._stripComments(e),a=this._lexer.tokenize(i);return new V(e,t,s,a,0,this.errors,0).parseChain()}parseTemplateBindings(e,t,s,n,i){let a=this._lexer.tokenize(t);return new V(t,s,i,a,0,this.errors,0).parseTemplateBindings({source:e,span:new b(n,n+e.length)})}parseInterpolation(e,t,s,n,i=G){let{strings:a,expressions:h,offsets:d}=this.splitInterpolation(e,t,n,i);if(h.length===0)return null;let f=[];for(let S=0;S<h.length;++S){let R=h[S].text,k=this._stripComments(R),E=this._lexer.tokenize(k),y=new V(e,t,s,E,0,this.errors,d[S]).parseChain();f.push(y)}return this.createInterpolationAst(a.map(S=>S.text),f,e,t,s)}parseInterpolationExpression(e,t,s){let n=this._stripComments(e),i=this._lexer.tokenize(n),a=new V(e,t,s,i,0,this.errors,0).parseChain(),h=["",""];return this.createInterpolationAst(h,[a],e,t,s)}createInterpolationAst(e,t,s,n,i){let a=new K(0,s.length),h=new Oe(a,a.toAbsolute(i),e,t);return new B(h,s,n,i,this.errors)}splitInterpolation(e,t,s,n=G){var y;let i=[],a=[],h=[],d=s?Qr(s):null,f=0,S=!1,R=!1,{start:k,end:E}=n;for(;f<e.length;)if(S){let o=f,c=o+k.length,x=this._getInterpolationEndIndex(e,E,c);if(x===-1){S=!1,R=!0;break}let u=x+E.length,l=e.substring(c,x);l.trim().length===0&&this._reportError("Blank expressions are not allowed in interpolated strings",e,`at column ${f} in`,t),a.push({text:l,start:o,end:u});let p=((y=d==null?void 0:d.get(o))!=null?y:o)+k.length;h.push(p),f=u,S=!1}else{let o=f;f=e.indexOf(k,f),f===-1&&(f=e.length);let c=e.substring(o,f);i.push({text:c,start:o,end:f}),S=!0}if(!S)if(R){let o=i[i.length-1];o.text+=e.substring(f),o.end=e.length}else i.push({text:e.substring(f),start:f,end:e.length});return new Xe(i,a,h)}wrapLiteralPrimitive(e,t,s){let n=new K(0,e==null?0:e.length);return new B(new O(n,n.toAbsolute(s),e),e,t,s,this.errors)}_stripComments(e){let t=this._commentStart(e);return t!=null?e.substring(0,t):e}_commentStart(e){let t=null;for(let s=0;s<e.length-1;s++){let n=e.charCodeAt(s),i=e.charCodeAt(s+1);if(n===47&&i==47&&t==null)return s;t===n?t=null:t==null&&Ve(n)&&(t=n)}return null}_checkNoInterpolation(e,t,{start:s,end:n}){let i=-1,a=-1;for(let h of this._forEachUnquotedChar(e,0))if(i===-1)e.startsWith(s)&&(i=h);else if(a=this._getInterpolationEndIndex(e,n,h),a>-1)break;i>-1&&a>-1&&this._reportError(`Got interpolation (${s}${n}) where expression was expected`,e,`at column ${i} in`,t)}_getInterpolationEndIndex(e,t,s){for(let n of this._forEachUnquotedChar(e,s)){if(e.startsWith(t,n))return n;if(e.startsWith("//",n))return e.indexOf(t,n)}return-1}*_forEachUnquotedChar(e,t){let s=null,n=0;for(let i=t;i<e.length;i++){let a=e[i];Ve(e.charCodeAt(i))&&(s===null||s===a)&&n%2===0?s=s===null?a:null:s===null&&(yield i),n=a==="\\"?n+1:0}}};(function(r){r[r.None=0]="None",r[r.Writable=1]="Writable"})(pe||(pe={}));V=class{constructor(e,t,s,n,i,a,h){this.input=e,this.location=t,this.absoluteOffset=s,this.tokens=n,this.parseFlags=i,this.errors=a,this.offset=h,this.rparensExpected=0,this.rbracketsExpected=0,this.rbracesExpected=0,this.context=pe.None,this.sourceSpanCache=new Map,this.index=0}peek(e){let t=this.index+e;return t<this.tokens.length?this.tokens[t]:Re}get next(){return this.peek(0)}get atEOF(){return this.index>=this.tokens.length}get inputIndex(){return this.atEOF?this.currentEndIndex:this.next.index+this.offset}get currentEndIndex(){return this.index>0?this.peek(-1).end+this.offset:this.tokens.length===0?this.input.length+this.offset:this.next.index+this.offset}get currentAbsoluteOffset(){return this.absoluteOffset+this.inputIndex}span(e,t){let s=this.currentEndIndex;if(t!==void 0&&t>this.currentEndIndex&&(s=t),e>s){let n=s;s=e,e=n}return new K(e,s)}sourceSpan(e,t){let s=`${e}@${this.inputIndex}:${t}`;return this.sourceSpanCache.has(s)||this.sourceSpanCache.set(s,this.span(e,t).toAbsolute(this.absoluteOffset)),this.sourceSpanCache.get(s)}advance(){this.index++}withContext(e,t){this.context|=e;let s=t();return this.context^=e,s}consumeOptionalCharacter(e){return this.next.isCharacter(e)?(this.advance(),!0):!1}peekKeywordLet(){return this.next.isKeywordLet()}peekKeywordAs(){return this.next.isKeywordAs()}expectCharacter(e){this.consumeOptionalCharacter(e)||this.error(`Missing expected ${String.fromCharCode(e)}`)}consumeOptionalOperator(e){return this.next.isOperator(e)?(this.advance(),!0):!1}expectOperator(e){this.consumeOptionalOperator(e)||this.error(`Missing expected operator ${e}`)}prettyPrintToken(e){return e===Re?"end of input":`token ${e}`}expectIdentifierOrKeyword(){let e=this.next;return!e.isIdentifier()&&!e.isKeyword()?(e.isPrivateIdentifier()?this._reportErrorForPrivateIdentifier(e,"expected identifier or keyword"):this.error(`Unexpected ${this.prettyPrintToken(e)}, expected identifier or keyword`),null):(this.advance(),e.toString())}expectIdentifierOrKeywordOrString(){let e=this.next;return!e.isIdentifier()&&!e.isKeyword()&&!e.isString()?(e.isPrivateIdentifier()?this._reportErrorForPrivateIdentifier(e,"expected identifier, keyword or string"):this.error(`Unexpected ${this.prettyPrintToken(e)}, expected identifier, keyword, or string`),""):(this.advance(),e.toString())}parseChain(){let e=[],t=this.inputIndex;for(;this.index<this.tokens.length;){let s=this.parsePipe();if(e.push(s),this.consumeOptionalCharacter(59))for(this.parseFlags&1||this.error("Binding expression cannot contain chained expression");this.consumeOptionalCharacter(59););else if(this.index<this.tokens.length){let n=this.index;if(this.error(`Unexpected token '${this.next}'`),this.index===n)break}}if(e.length===0){let s=this.offset,n=this.offset+this.input.length;return new C(this.span(s,n),this.sourceSpan(s,n))}return e.length==1?e[0]:new j(this.span(t),this.sourceSpan(t),e)}parsePipe(){let e=this.inputIndex,t=this.parseExpression();if(this.consumeOptionalOperator("|")){this.parseFlags&1&&this.error("Cannot have a pipe in an action expression");do{let s=this.inputIndex,n=this.expectIdentifierOrKeyword(),i,a;n!==null?i=this.sourceSpan(s):(n="",a=this.next.index!==-1?this.next.index:this.input.length+this.offset,i=new K(a,a).toAbsolute(this.absoluteOffset));let h=[];for(;this.consumeOptionalCharacter(58);)h.push(this.parseExpression());t=new J(this.span(e),this.sourceSpan(e,a),t,n,h,i)}while(this.consumeOptionalOperator("|"))}return t}parseExpression(){return this.parseConditional()}parseConditional(){let e=this.inputIndex,t=this.parseLogicalOr();if(this.consumeOptionalOperator("?")){let s=this.parsePipe(),n;if(this.consumeOptionalCharacter(58))n=this.parsePipe();else{let i=this.inputIndex,a=this.input.substring(e,i);this.error(`Conditional expression ${a} requires all 3 expressions`),n=new C(this.span(e),this.sourceSpan(e))}return new H(this.span(e),this.sourceSpan(e),t,s,n)}else return t}parseLogicalOr(){let e=this.inputIndex,t=this.parseLogicalAnd();for(;this.consumeOptionalOperator("||");){let s=this.parseLogicalAnd();t=new N(this.span(e),this.sourceSpan(e),"||",t,s)}return t}parseLogicalAnd(){let e=this.inputIndex,t=this.parseNullishCoalescing();for(;this.consumeOptionalOperator("&&");){let s=this.parseNullishCoalescing();t=new N(this.span(e),this.sourceSpan(e),"&&",t,s)}return t}parseNullishCoalescing(){let e=this.inputIndex,t=this.parseEquality();for(;this.consumeOptionalOperator("??");){let s=this.parseEquality();t=new N(this.span(e),this.sourceSpan(e),"??",t,s)}return t}parseEquality(){let e=this.inputIndex,t=this.parseRelational();for(;this.next.type==v.Operator;){let s=this.next.strValue;switch(s){case"==":case"===":case"!=":case"!==":this.advance();let n=this.parseRelational();t=new N(this.span(e),this.sourceSpan(e),s,t,n);continue}break}return t}parseRelational(){let e=this.inputIndex,t=this.parseAdditive();for(;this.next.type==v.Operator;){let s=this.next.strValue;switch(s){case"<":case">":case"<=":case">=":this.advance();let n=this.parseAdditive();t=new N(this.span(e),this.sourceSpan(e),s,t,n);continue}break}return t}parseAdditive(){let e=this.inputIndex,t=this.parseMultiplicative();for(;this.next.type==v.Operator;){let s=this.next.strValue;switch(s){case"+":case"-":this.advance();let n=this.parseMultiplicative();t=new N(this.span(e),this.sourceSpan(e),s,t,n);continue}break}return t}parseMultiplicative(){let e=this.inputIndex,t=this.parsePrefix();for(;this.next.type==v.Operator;){let s=this.next.strValue;switch(s){case"*":case"%":case"/":this.advance();let n=this.parsePrefix();t=new N(this.span(e),this.sourceSpan(e),s,t,n);continue}break}return t}parsePrefix(){if(this.next.type==v.Operator){let e=this.inputIndex,t=this.next.strValue,s;switch(t){case"+":return this.advance(),s=this.parsePrefix(),L.createPlus(this.span(e),this.sourceSpan(e),s);case"-":return this.advance(),s=this.parsePrefix(),L.createMinus(this.span(e),this.sourceSpan(e),s);case"!":return this.advance(),s=this.parsePrefix(),new te(this.span(e),this.sourceSpan(e),s)}}return this.parseCallChain()}parseCallChain(){let e=this.inputIndex,t=this.parsePrimary();for(;;)if(this.consumeOptionalCharacter(46))t=this.parseAccessMember(t,e,!1);else if(this.consumeOptionalOperator("?."))this.consumeOptionalCharacter(40)?t=this.parseCall(t,e,!0):t=this.consumeOptionalCharacter(91)?this.parseKeyedReadOrWrite(t,e,!0):this.parseAccessMember(t,e,!0);else if(this.consumeOptionalCharacter(91))t=this.parseKeyedReadOrWrite(t,e,!1);else if(this.consumeOptionalCharacter(40))t=this.parseCall(t,e,!1);else if(this.consumeOptionalOperator("!"))t=new re(this.span(e),this.sourceSpan(e),t);else return t}parsePrimary(){let e=this.inputIndex;if(this.consumeOptionalCharacter(40)){this.rparensExpected++;let t=this.parsePipe();return this.rparensExpected--,this.expectCharacter(41),t}else{if(this.next.isKeywordNull())return this.advance(),new O(this.span(e),this.sourceSpan(e),null);if(this.next.isKeywordUndefined())return this.advance(),new O(this.span(e),this.sourceSpan(e),void 0);if(this.next.isKeywordTrue())return this.advance(),new O(this.span(e),this.sourceSpan(e),!0);if(this.next.isKeywordFalse())return this.advance(),new O(this.span(e),this.sourceSpan(e),!1);if(this.next.isKeywordThis())return this.advance(),new $e(this.span(e),this.sourceSpan(e));if(this.consumeOptionalCharacter(91)){this.rbracketsExpected++;let t=this.parseExpressionList(93);return this.rbracketsExpected--,this.expectCharacter(93),new Y(this.span(e),this.sourceSpan(e),t)}else{if(this.next.isCharacter(123))return this.parseLiteralMap();if(this.next.isIdentifier())return this.parseAccessMember(new T(this.span(e),this.sourceSpan(e)),e,!1);if(this.next.isNumber()){let t=this.next.toNumber();return this.advance(),new O(this.span(e),this.sourceSpan(e),t)}else if(this.next.isString()){let t=this.next.toString();return this.advance(),new O(this.span(e),this.sourceSpan(e),t)}else return this.next.isPrivateIdentifier()?(this._reportErrorForPrivateIdentifier(this.next,null),new C(this.span(e),this.sourceSpan(e))):this.index>=this.tokens.length?(this.error(`Unexpected end of expression: ${this.input}`),new C(this.span(e),this.sourceSpan(e))):(this.error(`Unexpected token ${this.next}`),new C(this.span(e),this.sourceSpan(e)))}}}parseExpressionList(e){let t=[];do if(!this.next.isCharacter(e))t.push(this.parsePipe());else break;while(this.consumeOptionalCharacter(44));return t}parseLiteralMap(){let e=[],t=[],s=this.inputIndex;if(this.expectCharacter(123),!this.consumeOptionalCharacter(125)){this.rbracesExpected++;do{let n=this.inputIndex,i=this.next.isString(),a=this.expectIdentifierOrKeywordOrString();if(e.push({key:a,quoted:i}),i)this.expectCharacter(58),t.push(this.parsePipe());else if(this.consumeOptionalCharacter(58))t.push(this.parsePipe());else{let h=this.span(n),d=this.sourceSpan(n);t.push(new M(h,d,d,new T(h,d),a))}}while(this.consumeOptionalCharacter(44));this.rbracesExpected--,this.expectCharacter(125)}return new ee(this.span(s),this.sourceSpan(s),e,t)}parseAccessMember(e,t,s){let n=this.inputIndex,i=this.withContext(pe.Writable,()=>{var f;let d=(f=this.expectIdentifierOrKeyword())!=null?f:"";return d.length===0&&this.error("Expected identifier for property access",e.span.end),d}),a=this.sourceSpan(n),h;if(s)this.consumeOptionalAssignment()?(this.error("The '?.' operator cannot be used in the assignment"),h=new C(this.span(t),this.sourceSpan(t))):h=new q(this.span(t),this.sourceSpan(t),a,e,i);else if(this.consumeOptionalAssignment()){if(!(this.parseFlags&1))return this.error("Bindings cannot contain assignments"),new C(this.span(t),this.sourceSpan(t));let d=this.parseConditional();h=new z(this.span(t),this.sourceSpan(t),a,e,i,d)}else h=new M(this.span(t),this.sourceSpan(t),a,e,i);return h}parseCall(e,t,s){let n=this.inputIndex;this.rparensExpected++;let i=this.parseCallArguments(),a=this.span(n,this.inputIndex).toAbsolute(this.absoluteOffset);this.expectCharacter(41),this.rparensExpected--;let h=this.span(t),d=this.sourceSpan(t);return s?new ne(h,d,e,i,a):new se(h,d,e,i,a)}consumeOptionalAssignment(){return this.parseFlags&2&&this.next.isOperator("!")&&this.peek(1).isOperator("=")?(this.advance(),this.advance(),!0):this.consumeOptionalOperator("=")}parseCallArguments(){if(this.next.isCharacter(41))return[];let e=[];do e.push(this.parsePipe());while(this.consumeOptionalCharacter(44));return e}expectTemplateBindingKey(){let e="",t=!1,s=this.currentAbsoluteOffset;do e+=this.expectIdentifierOrKeywordOrString(),t=this.consumeOptionalOperator("-"),t&&(e+="-");while(t);return{source:e,span:new b(s,s+e.length)}}parseTemplateBindings(e){let t=[];for(t.push(...this.parseDirectiveKeywordBindings(e));this.index<this.tokens.length;){let s=this.parseLetBinding();if(s)t.push(s);else{let n=this.expectTemplateBindingKey(),i=this.parseAsBinding(n);i?t.push(i):(n.source=e.source+n.source.charAt(0).toUpperCase()+n.source.substring(1),t.push(...this.parseDirectiveKeywordBindings(n)))}this.consumeStatementTerminator()}return new Ze(t,[],this.errors)}parseKeyedReadOrWrite(e,t,s){return this.withContext(pe.Writable,()=>{this.rbracketsExpected++;let n=this.parsePipe();if(n instanceof C&&this.error("Key access cannot be empty"),this.rbracketsExpected--,this.expectCharacter(93),this.consumeOptionalOperator("="))if(s)this.error("The '?.' operator cannot be used in the assignment");else{let i=this.parseConditional();return new Z(this.span(t),this.sourceSpan(t),e,n,i)}else return s?new Ce(this.span(t),this.sourceSpan(t),e,n):new X(this.span(t),this.sourceSpan(t),e,n);return new C(this.span(t),this.sourceSpan(t))})}parseDirectiveKeywordBindings(e){let t=[];this.consumeOptionalCharacter(58);let s=this.getDirectiveBoundTarget(),n=this.currentAbsoluteOffset,i=this.parseAsBinding(e);i||(this.consumeStatementTerminator(),n=this.currentAbsoluteOffset);let a=new b(e.span.start,n);return t.push(new ie(a,e,s)),i&&t.push(i),t}getDirectiveBoundTarget(){if(this.next===Re||this.peekKeywordAs()||this.peekKeywordLet())return null;let e=this.parsePipe(),{start:t,end:s}=e.span,n=this.input.substring(t,s);return new B(e,n,this.location,this.absoluteOffset+t,this.errors)}parseAsBinding(e){if(!this.peekKeywordAs())return null;this.advance();let t=this.expectTemplateBindingKey();this.consumeStatementTerminator();let s=new b(e.span.start,this.currentAbsoluteOffset);return new F(s,t,e)}parseLetBinding(){if(!this.peekKeywordLet())return null;let e=this.currentAbsoluteOffset;this.advance();let t=this.expectTemplateBindingKey(),s=null;this.consumeOptionalOperator("=")&&(s=this.expectTemplateBindingKey()),this.consumeStatementTerminator();let n=new b(e,this.currentAbsoluteOffset);return new F(n,t,s)}consumeStatementTerminator(){this.consumeOptionalCharacter(59)||this.consumeOptionalCharacter(44)}error(e,t=null){this.errors.push(new W(e,this.input,this.locationText(t),this.location)),this.skip()}locationText(e=null){return e==null&&(e=this.index),e<this.tokens.length?`at column ${this.tokens[e].index+1} in`:"at the end of the expression"}_reportErrorForPrivateIdentifier(e,t){let s=`Private identifiers are not supported. Unexpected private identifier: ${e}`;t!==null&&(s+=`, ${t}`),this.error(s)}skip(){let e=this.next;for(;this.index<this.tokens.length&&!e.isCharacter(59)&&!e.isOperator("|")&&(this.rparensExpected<=0||!e.isCharacter(41))&&(this.rbracesExpected<=0||!e.isCharacter(125))&&(this.rbracketsExpected<=0||!e.isCharacter(93))&&(!(this.context&pe.Writable)||!e.isOperator("="));)this.next.isError()&&this.errors.push(new W(this.next.toString(),this.input,this.locationText(),this.location)),this.advance(),e=this.next}},Je=class extends Ne{constructor(){super(...arguments),this.errors=[]}visitPipe(){this.errors.push("pipes")}}});var Le=$(()=>{g();Ge();qe();Rt()});function rt(){return new Se(new fe)}function st(r,e){let t=rt(),{astInput:s,comments:n}=Ft(r,t),{ast:i,errors:a}=e(s,t);return nt(a),{ast:i,comments:n}}function Bt(r){return st(r,(e,t)=>t.parseBinding(e,...be))}function Kt(r){return st(r,(e,t)=>t.parseSimpleBinding(e,...be))}function Tt(r){return st(r,(e,t)=>t.parseAction(e,!1,...be))}function _t(r){let e=rt(),{templateBindings:t,errors:s}=e.parseTemplateBindings(tt,r,bt,Ye,Ye);return nt(s),t}function Mt(r){let e=rt(),{astInput:t,comments:s}=Ft(r,e),n="{{",i="}}",{ast:a,errors:h}=e.parseInterpolation(n+t+i,...be,null);nt(h);let d=a.expressions[0],f=new Set;return et(d,S=>{f.has(S)||(S.start-=n.length,S.end-=n.length,f.add(S))}),{ast:d,comments:s}}function et(r,e){if(!(!r||typeof r!="object")){if(Array.isArray(r))return r.forEach(t=>et(t,e));for(let t of Object.keys(r)){let s=r[t];t==="span"?e(s):et(s,e)}}}function nt(r){if(r.length!==0){let[{message:e}]=r;throw new SyntaxError(e.replace(/^Parser Error: | at column \d+ in [^]*$/g,""))}}function Ft(r,e){let t=e._commentStart(r);return t===null?{astInput:r,comments:[]}:{astInput:r.slice(0,t),comments:[{type:"Comment",value:r.slice(t+2),span:{start:t,end:r.length}}]}}function Ut(r){return r instanceof L?"Unary":r instanceof N?"Binary":r instanceof J?"BindingPipe":r instanceof se?"Call":r instanceof j?"Chain":r instanceof H?"Conditional":r instanceof C?"EmptyExpr":r instanceof T?"ImplicitReceiver":r instanceof X?"KeyedRead":r instanceof Z?"KeyedWrite":r instanceof Y?"LiteralArray":r instanceof ee?"LiteralMap":r instanceof O?"LiteralPrimitive":r instanceof re?"NonNullAssert":r instanceof te?"PrefixNot":r instanceof M?"PropertyRead":r instanceof z?"PropertyWrite":r instanceof ne?"SafeCall":r instanceof q?"SafePropertyRead":r.type}function Lt({start:r,end:e},t){let s=r,n=e;for(;n!==s&&/\s/.test(t[n-1]);)n--;for(;s!==n&&/\s/.test(t[s]);)s++;return{start:s,end:n}}function Hr({start:r,end:e},t){let s=r,n=e;for(;n!==t.length&&/\s/.test(t[n]);)n++;for(;s!==0&&/\s/.test(t[s-1]);)s--;return{start:s,end:n}}function zr(r,e){return e[r.start-1]==="("&&e[r.end]===")"?{start:r.start-1,end:r.end+1}:r}function Dt(r,e,t){let s=0,n={start:r.start,end:r.end};for(;;){let i=Hr(n,e),a=zr(i,e);if(i.start===a.start&&i.end===a.end)break;n.start=a.start,n.end=a.end,s++}return{hasParens:(t?s-1:s)!==0,outerSpan:Lt(t?{start:n.start+1,end:n.end-1}:n,e),innerSpan:Lt(r,e)}}function Gt(r,e,t){let s=e;for(;!r.test(t[s]);)if(--s<0)throw new Error(`Cannot find front char ${r} from index ${e} in ${JSON.stringify(t)}`);return s}function Be(r,e,t){let s=e;for(;!r.test(t[s]);)if(++s>=t.length)throw new Error(`Cannot find back char ${r} from index ${e} in ${JSON.stringify(t)}`);return s}function Vt(r){return r.slice(0,1).toLowerCase()+r.slice(1)}function Wt(r){return r.length===0?void 0:r[r.length-1]}var bt,tt,Ye,be,Ke=$(()=>{g();Le();Le();bt="angular-estree-parser",tt="NgEstreeParser",Ye=0,be=[bt,Ye]});function Te(r,e,t=!1,s=!1){if(!t){let{start:h,end:d}=r;return{start:h,end:d,loc:{start:e.locator.locationForIndex(h),end:e.locator.locationForIndex(d)}}}let{outerSpan:n,innerSpan:i,hasParens:a}=Dt(r,e.text,s);return{start:i.start,end:i.end,loc:{start:e.locator.locationForIndex(i.start),end:e.locator.locationForIndex(i.end)},...a&&{extra:{parenthesized:!0,parenStart:n.start,parenEnd:n.end}}}}var ue,it=$(()=>{g();Ke();ue=(r,e,t=!1)=>{let s=Ut(r);switch(s){case"Unary":{let{operator:o,expr:c}=r,x=n(c);return a("UnaryExpression",{prefix:!0,argument:x,operator:o},r.span,{hasParentParens:t})}case"Binary":{let{left:o,operation:c,right:x}=r,u=n(o),l=n(x);return a(c==="&&"||c==="||"?"LogicalExpression":"BinaryExpression",{left:u,right:l,operator:c},{start:E(u),end:y(l)},{hasParentParens:t})}case"BindingPipe":{let{exp:o,name:c,args:x}=r,u=n(o),l=f(/\S/,f(/\|/,y(u))+1),m=a("Identifier",{name:c},{start:l,end:l+c.length}),p=x.map(n);return a("NGPipeExpression",{left:u,right:m,arguments:p},{start:E(u),end:y(p.length===0?m:Wt(p))},{hasParentParens:t})}case"Chain":{let{expressions:o}=r;return a("NGChainedExpression",{expressions:o.map(n)},r.span,{hasParentParens:t})}case"Comment":{let{value:o}=r;return a("CommentLine",{value:o},r.span,{processSpan:!1})}case"Conditional":{let{condition:o,trueExp:c,falseExp:x}=r,u=n(o),l=n(c),m=n(x);return a("ConditionalExpression",{test:u,consequent:l,alternate:m},{start:E(u),end:y(m)},{hasParentParens:t})}case"EmptyExpr":return a("NGEmptyExpression",{},r.span,{hasParentParens:t});case"ImplicitReceiver":return a("ThisExpression",{},r.span,{hasParentParens:t});case"KeyedRead":{let{key:o}=r,c=Object.prototype.hasOwnProperty.call(r,"receiver")?r.receiver:r.obj,x=n(o);return h(c,x,{computed:!0,optional:!1},{end:r.span.end,hasParentParens:t})}case"LiteralArray":{let{expressions:o}=r;return a("ArrayExpression",{elements:o.map(n)},r.span,{hasParentParens:t})}case"LiteralMap":{let{keys:o,values:c}=r,x=c.map(l=>n(l)),u=o.map(({key:l,quoted:m},p)=>{let I=x[p],le=E(I),at=y(I),Fe=f(/\S/,p===0?r.span.start+1:f(/,/,y(x[p-1]))+1),qt=le===Fe?at:d(/\S/,d(/:/,le-1)-1)+1,ot={start:Fe,end:qt},we=m?a("StringLiteral",{value:l},ot):a("Identifier",{name:l},ot),Xt=we.end<we.start||Fe===le;return a("ObjectProperty",{key:we,value:I,method:!1,shorthand:Xt,computed:!1},{start:E(we),end:at})});return a("ObjectExpression",{properties:u},r.span,{hasParentParens:t})}case"LiteralPrimitive":{let{value:o}=r;switch(typeof o){case"boolean":return a("BooleanLiteral",{value:o},r.span,{hasParentParens:t});case"number":return a("NumericLiteral",{value:o},r.span,{hasParentParens:t});case"object":return a("NullLiteral",{},r.span,{hasParentParens:t});case"string":return a("StringLiteral",{value:o},r.span,{hasParentParens:t});case"undefined":return a("Identifier",{name:"undefined"},r.span,{hasParentParens:t});default:throw new Error(`Unexpected LiteralPrimitive value type ${typeof o}`)}}case"Call":case"SafeCall":{let o=s==="SafeCall",{receiver:c,args:x}=r,u=x.length===1?[i(x[0])]:x.map(n),l=n(c),m=R(l),p=o||m?"OptionalCallExpression":"CallExpression";return a(p,{callee:l,arguments:u,optional:p==="OptionalCallExpression"?o:void 0},{start:E(l),end:r.span.end},{hasParentParens:t})}case"NonNullAssert":{let{expression:o}=r,c=n(o);return a("TSNonNullExpression",{expression:c},{start:E(c),end:r.span.end},{hasParentParens:t})}case"PrefixNot":{let{expression:o}=r,c=n(o);return a("UnaryExpression",{prefix:!0,operator:"!",argument:c},{start:r.span.start,end:y(c)},{hasParentParens:t})}case"PropertyRead":case"SafePropertyRead":{let o=s==="SafePropertyRead",{receiver:c,name:x}=r,u=d(/\S/,r.span.end-1)+1,l=a("Identifier",{name:x},{start:u-x.length,end:u},S(c)?{hasParentParens:t}:{});return h(c,l,{computed:!1,optional:o},{hasParentParens:t})}case"KeyedWrite":{let{key:o,value:c}=r,x=Object.prototype.hasOwnProperty.call(r,"receiver")?r.receiver:r.obj,u=n(o),l=n(c),m=h(x,u,{computed:!0,optional:!1},{end:f(/\]/,y(u))+1});return a("AssignmentExpression",{left:m,operator:"=",right:l},{start:E(m),end:y(l)},{hasParentParens:t})}case"PropertyWrite":{let{receiver:o,name:c,value:x}=r,u=n(x),l=d(/\S/,d(/=/,E(u)-1)-1)+1,m=a("Identifier",{name:c},{start:l-c.length,end:l}),p=h(o,m,{computed:!1,optional:!1});return a("AssignmentExpression",{left:p,operator:"=",right:u},{start:E(p),end:y(u)},{hasParentParens:t})}default:throw new Error(`Unexpected node ${s}`)}function n(o){return ue(o,e)}function i(o){return ue(o,e,!0)}function a(o,c,x,{processSpan:u=!0,hasParentParens:l=!1}={}){let m={type:o,...Te(x,e,u,l),...c};switch(o){case"Identifier":{let p=m;p.loc.identifierName=p.name;break}case"NumericLiteral":{let p=m;p.extra={...p.extra,raw:e.text.slice(p.start,p.end),rawValue:p.value};break}case"StringLiteral":{let p=m;p.extra={...p.extra,raw:e.text.slice(p.start,p.end),rawValue:p.value};break}case"ObjectProperty":{let p=m;p.shorthand&&(p.extra={...p.extra,shorthand:p.shorthand});break}}return m}function h(o,c,x,{end:u=y(c),hasParentParens:l=!1}={}){if(S(o)||o.span.start===c.start)return c;let m=n(o),p=R(m);return a(x.optional||p?"OptionalMemberExpression":"MemberExpression",{object:m,property:c,computed:x.computed,...x.optional?{optional:!0}:p?{optional:!1}:null},{start:E(m),end:u},{hasParentParens:l})}function d(o,c){return Gt(o,c,e.text)}function f(o,c){return Be(o,c,e.text)}function S(o){return o.span.start>=o.span.end||/^\s+$/.test(e.text.slice(o.span.start,o.span.end))}function R(o){return(o.type==="OptionalCallExpression"||o.type==="OptionalMemberExpression")&&!k(o)}function k(o){return o.extra&&o.extra.parenthesized}function E(o){return k(o)?o.extra.parenStart:o.start}function y(o){return k(o)?o.extra.parenEnd:o.end}}});function Qt(r,e){r.forEach(E);let[t]=r,{key:s}=t,n=e.text.slice(t.sourceSpan.start,t.sourceSpan.end).trim().length===0?r.slice(1):r,i=[],a=null;for(let c=0;c<n.length;c++){let x=n[c];if(a&&R(a)&&k(x)&&x.value&&x.value.source===a.key.source){let u=f("NGMicrosyntaxKey",{name:x.key.source},x.key.span),l=(I,le)=>({...I,...Te({start:I.start,end:le},e)}),m=I=>({...l(I,u.end),alias:u}),p=i.pop();if(p.type==="NGMicrosyntaxExpression")i.push(m(p));else if(p.type==="NGMicrosyntaxKeyedExpression"){let I=m(p.expression);i.push(l({...p,expression:I},I.end))}else throw new Error(`Unexpected type ${p.type}`)}else i.push(h(x,c));a=x}return f("NGMicrosyntax",{body:i},i.length===0?r[0].sourceSpan:{start:i[0].start,end:i[i.length-1].end});function h(c,x){if(R(c)){let{key:u,value:l}=c;return l?x===0?f("NGMicrosyntaxExpression",{expression:d(l.ast),alias:null},l.sourceSpan):f("NGMicrosyntaxKeyedExpression",{key:f("NGMicrosyntaxKey",{name:S(u.source)},u.span),expression:f("NGMicrosyntaxExpression",{expression:d(l.ast),alias:null},l.sourceSpan)},{start:u.span.start,end:l.sourceSpan.end}):f("NGMicrosyntaxKey",{name:S(u.source)},u.span)}else{let{key:u,sourceSpan:l}=c;if(/^let\s$/.test(e.text.slice(l.start,l.start+4))){let{value:p}=c;return f("NGMicrosyntaxLet",{key:f("NGMicrosyntaxKey",{name:u.source},u.span),value:p?f("NGMicrosyntaxKey",{name:p.source},p.span):null},{start:l.start,end:p?p.span.end:u.span.end})}else{let p=o(c);return f("NGMicrosyntaxAs",{key:f("NGMicrosyntaxKey",{name:p.source},p.span),alias:f("NGMicrosyntaxKey",{name:u.source},u.span)},{start:p.span.start,end:u.span.end})}}}function d(c){return ue(c,e)}function f(c,x,u,l=!0){return{type:c,...Te(u,e,l),...x}}function S(c){return Vt(c.slice(s.source.length))}function R(c){return c instanceof ie}function k(c){return c instanceof F}function E(c){y(c.key.span),k(c)&&c.value&&y(c.value.span)}function y(c){if(e.text[c.start]!=='"'&&e.text[c.start]!=="'")return;let x=e.text[c.start],u=!1;for(let l=c.start+1;l<e.text.length;l++)switch(e.text[l]){case x:if(!u){c.end=l+1;return}default:u=!1;break;case"\\":u=!u;break}}function o(c){if(!c.value||c.value.source!==tt)return c.value;let x=Be(/\S/,c.sourceSpan.start,e.text);return{source:"$implicit",span:{start:x,end:x}}}}var jt=$(()=>{g();Le();it();Ke()});var Ht={};ct(Ht,{parseAction:()=>Jr,parseBinding:()=>qr,parseInterpolation:()=>Zr,parseSimpleBinding:()=>Xr,parseTemplateBindings:()=>Yr});function _e(r,e){let{ast:t,comments:s}=e(r),n=new xe(r),i=h=>ue(h,n),a=i(t);return a.comments=s.map(h=>i(h)),a}function qr(r){return _e(r,Bt)}function Xr(r){return _e(r,Kt)}function Zr(r){return _e(r,Mt)}function Jr(r){return _e(r,Tt)}function Yr(r){return Qt(_t(r),new xe(r))}var zt=$(()=>{g();ft();it();jt();Ke()});var rs={};ct(rs,{default:()=>ts});g();g();g();function sr(r){return Array.isArray(r)&&r.length>0}var ht=sr;function Ue(r,e){let{ignoreDecorators:t}=e||{};if(!t){let s=r.declaration&&r.declaration.decorators||r.decorators;if(ht(s))return Ue(s[0])}return r.range?r.range[0]:r.start}function pt(r){return r.range?r.range[1]:r.end}function Me(r){return{astFormat:"estree",parse:async(t,s)=>{let n=await Promise.resolve().then(()=>(zt(),Ht)),i=r(t,n);return{type:"NGRoot",node:s.parser==="__ng_action"&&i.type!=="NGChainedExpression"?{...i,type:"NGChainedExpression",expressions:[i]}:i}},locStart:Ue,locEnd:pt}}var es={parsers:{__ng_action:Me((r,e)=>e.parseAction(r)),__ng_binding:Me((r,e)=>e.parseBinding(r)),__ng_interpolation:Me((r,e)=>e.parseInterpolation(r)),__ng_directive:Me((r,e)=>e.parseTemplateBindings(r))}},ts=es;return rr(rs);});
|
|
1
|
+
(function(n){function e(){var i=n();return i.default||i}if(typeof exports=="object"&&typeof module=="object")module.exports=e();else if(typeof define=="function"&&define.amd)define(e);else{var t=typeof globalThis<"u"?globalThis:typeof global<"u"?global:typeof self<"u"?self:this||{};t.prettierPlugins=t.prettierPlugins||{},t.prettierPlugins.angular=e()}})(function(){"use strict";var Re=Object.defineProperty;var bt=Object.getOwnPropertyDescriptor;var Bt=Object.getOwnPropertyNames;var Kt=Object.prototype.hasOwnProperty;var Tt=(s,e)=>{for(var t in e)Re(s,t,{get:e[t],enumerable:!0})},_t=(s,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of Bt(e))!Kt.call(s,n)&&n!==t&&Re(s,n,{get:()=>e[n],enumerable:!(r=bt(e,n))||r.enumerable});return s};var Mt=s=>_t(Re({},"__esModule",{value:!0}),s);var Br={};Tt(Br,{default:()=>br});var me=`
|
|
2
|
+
`,Xe="\r",Ze=function(){function s(e){this.length=e.length;for(var t=[0],r=0;r<e.length;)switch(e[r]){case me:r+=me.length,t.push(r);break;case Xe:r+=Xe.length,e[r]===me&&(r+=me.length),t.push(r);break;default:r++;break}this.offsets=t}return s.prototype.locationForIndex=function(e){if(e<0||e>this.length)return null;for(var t=0,r=this.offsets;r[t+1]<=e;)t++;var n=e-r[t];return{line:t,column:n}},s.prototype.indexForLocation=function(e){var t=e.line,r=e.column;return t<0||t>=this.offsets.length||r<0||r>this.lengthOfLine(t)?null:this.offsets[t]+r},s.prototype.lengthOfLine=function(e){var t=this.offsets[e],r=e===this.offsets.length-1?this.length:this.offsets[e+1];return r-t},s}();var pe=class{text;locator;constructor(e){this.text=e,this.locator=new Le(this.text)}},Le=class{_linesAndColumns;constructor(e){this._linesAndColumns=new Ze(e)}locationForIndex(e){let{line:t,column:r}=this._linesAndColumns.locationForIndex(e);return{line:t+1,column:r,index:e}}};var G=class{constructor(e,t,r,n){this.input=t,this.errLocation=r,this.ctxLocation=n,this.message=`Parser Error: ${e} ${r} [${t}] in ${n}`}},L=class{constructor(e,t){this.start=e,this.end=t}toAbsolute(e){return new P(e+this.start,e+this.end)}},S=class{constructor(e,t){this.span=e,this.sourceSpan=t}toString(){return"AST"}},D=class extends S{constructor(e,t,r){super(e,t),this.nameSpan=r}},E=class extends S{visit(e,t=null){}},b=class extends S{visit(e,t=null){return e.visitImplicitReceiver(this,t)}},Se=class extends b{visit(e,t=null){var r;return(r=e.visitThisReceiver)==null?void 0:r.call(e,this,t)}},V=class extends S{constructor(e,t,r){super(e,t),this.expressions=r}visit(e,t=null){return e.visitChain(this,t)}},W=class extends S{constructor(e,t,r,n,i){super(e,t),this.condition=r,this.trueExp=n,this.falseExp=i}visit(e,t=null){return e.visitConditional(this,t)}},K=class extends D{constructor(e,t,r,n,i){super(e,t,r),this.receiver=n,this.name=i}visit(e,t=null){return e.visitPropertyRead(this,t)}},Q=class extends D{constructor(e,t,r,n,i,a){super(e,t,r),this.receiver=n,this.name=i,this.value=a}visit(e,t=null){return e.visitPropertyWrite(this,t)}},H=class extends D{constructor(e,t,r,n,i){super(e,t,r),this.receiver=n,this.name=i}visit(e,t=null){return e.visitSafePropertyRead(this,t)}},j=class extends S{constructor(e,t,r,n){super(e,t),this.receiver=r,this.key=n}visit(e,t=null){return e.visitKeyedRead(this,t)}},we=class extends S{constructor(e,t,r,n){super(e,t),this.receiver=r,this.key=n}visit(e,t=null){return e.visitSafeKeyedRead(this,t)}},z=class extends S{constructor(e,t,r,n,i){super(e,t),this.receiver=r,this.key=n,this.value=i}visit(e,t=null){return e.visitKeyedWrite(this,t)}},q=class extends D{constructor(e,t,r,n,i,a){super(e,t,a),this.exp=r,this.name=n,this.args=i}visit(e,t=null){return e.visitPipe(this,t)}},A=class extends S{constructor(e,t,r){super(e,t),this.value=r}visit(e,t=null){return e.visitLiteralPrimitive(this,t)}},X=class extends S{constructor(e,t,r){super(e,t),this.expressions=r}visit(e,t=null){return e.visitLiteralArray(this,t)}},Z=class extends S{constructor(e,t,r,n){super(e,t),this.keys=r,this.values=n}visit(e,t=null){return e.visitLiteralMap(this,t)}},ye=class extends S{constructor(e,t,r,n){super(e,t),this.strings=r,this.expressions=n}visit(e,t=null){return e.visitInterpolation(this,t)}},$=class extends S{constructor(e,t,r,n,i){super(e,t),this.operation=r,this.left=n,this.right=i}visit(e,t=null){return e.visitBinary(this,t)}},I=class extends ${static createMinus(e,t,r){return new I(e,t,"-",r,"-",new A(e,t,0),r)}static createPlus(e,t,r){return new I(e,t,"+",r,"-",r,new A(e,t,0))}constructor(e,t,r,n,i,a,h){super(e,t,i,a,h),this.operator=r,this.expr=n,this.left=null,this.right=null,this.operation=null}visit(e,t=null){return e.visitUnary!==void 0?e.visitUnary(this,t):e.visitBinary(this,t)}},J=class extends S{constructor(e,t,r){super(e,t),this.expression=r}visit(e,t=null){return e.visitPrefixNot(this,t)}},Y=class extends S{constructor(e,t,r){super(e,t),this.expression=r}visit(e,t=null){return e.visitNonNullAssert(this,t)}},ee=class extends S{constructor(e,t,r,n,i){super(e,t),this.receiver=r,this.args=n,this.argumentSpan=i}visit(e,t=null){return e.visitCall(this,t)}},te=class extends S{constructor(e,t,r,n,i){super(e,t),this.receiver=r,this.args=n,this.argumentSpan=i}visit(e,t=null){return e.visitSafeCall(this,t)}},P=class{constructor(e,t){this.start=e,this.end=t}},R=class extends S{constructor(e,t,r,n,i){super(new L(0,t===null?0:t.length),new P(n,t===null?n:n+t.length)),this.ast=e,this.source=t,this.location=r,this.errors=i}visit(e,t=null){return e.visitASTWithSource?e.visitASTWithSource(this,t):this.ast.visit(e,t)}toString(){return`${this.source} in ${this.location}`}},T=class{constructor(e,t,r){this.sourceSpan=e,this.key=t,this.value=r}},re=class{constructor(e,t,r){this.sourceSpan=e,this.key=t,this.value=r}},Ee=class{visit(e,t){e.visit(this,t)}visitUnary(e,t){this.visit(e.expr,t)}visitBinary(e,t){this.visit(e.left,t),this.visit(e.right,t)}visitChain(e,t){this.visitAll(e.expressions,t)}visitConditional(e,t){this.visit(e.condition,t),this.visit(e.trueExp,t),this.visit(e.falseExp,t)}visitPipe(e,t){this.visit(e.exp,t),this.visitAll(e.args,t)}visitImplicitReceiver(e,t){}visitThisReceiver(e,t){}visitInterpolation(e,t){this.visitAll(e.expressions,t)}visitKeyedRead(e,t){this.visit(e.receiver,t),this.visit(e.key,t)}visitKeyedWrite(e,t){this.visit(e.receiver,t),this.visit(e.key,t),this.visit(e.value,t)}visitLiteralArray(e,t){this.visitAll(e.expressions,t)}visitLiteralMap(e,t){this.visitAll(e.values,t)}visitLiteralPrimitive(e,t){}visitPrefixNot(e,t){this.visit(e.expression,t)}visitNonNullAssert(e,t){this.visit(e.expression,t)}visitPropertyRead(e,t){this.visit(e.receiver,t)}visitPropertyWrite(e,t){this.visit(e.receiver,t),this.visit(e.value,t)}visitSafePropertyRead(e,t){this.visit(e.receiver,t)}visitSafeKeyedRead(e,t){this.visit(e.receiver,t),this.visit(e.key,t)}visitCall(e,t){this.visit(e.receiver,t),this.visitAll(e.args,t)}visitSafeCall(e,t){this.visit(e.receiver,t),this.visitAll(e.args,t)}visitAll(e,t){for(let r of e)this.visit(r,t)}};var Je;(function(s){s[s.DEFAULT=0]="DEFAULT",s[s.LITERAL_ATTR=1]="LITERAL_ATTR",s[s.ANIMATION=2]="ANIMATION"})(Je||(Je={}));function Ye(s){return s>=9&&s<=32||s==160}function B(s){return 48<=s&&s<=57}function et(s){return s>=97&&s<=122||s>=65&&s<=90}function be(s){return s===39||s===34||s===96}var d;(function(s){s[s.Character=0]="Character",s[s.Identifier=1]="Identifier",s[s.PrivateIdentifier=2]="PrivateIdentifier",s[s.Keyword=3]="Keyword",s[s.String=4]="String",s[s.Operator=5]="Operator",s[s.Number=6]="Number",s[s.Error=7]="Error"})(d||(d={}));var fr=["var","let","as","null","undefined","true","false","if","else","this"],ue=class{tokenize(e){let t=new Te(e),r=[],n=t.scanToken();for(;n!=null;)r.push(n),n=t.scanToken();return r}},N=class{constructor(e,t,r,n,i){this.index=e,this.end=t,this.type=r,this.numValue=n,this.strValue=i}isCharacter(e){return this.type==d.Character&&this.numValue==e}isNumber(){return this.type==d.Number}isString(){return this.type==d.String}isOperator(e){return this.type==d.Operator&&this.strValue==e}isIdentifier(){return this.type==d.Identifier}isPrivateIdentifier(){return this.type==d.PrivateIdentifier}isKeyword(){return this.type==d.Keyword}isKeywordLet(){return this.type==d.Keyword&&this.strValue=="let"}isKeywordAs(){return this.type==d.Keyword&&this.strValue=="as"}isKeywordNull(){return this.type==d.Keyword&&this.strValue=="null"}isKeywordUndefined(){return this.type==d.Keyword&&this.strValue=="undefined"}isKeywordTrue(){return this.type==d.Keyword&&this.strValue=="true"}isKeywordFalse(){return this.type==d.Keyword&&this.strValue=="false"}isKeywordThis(){return this.type==d.Keyword&&this.strValue=="this"}isError(){return this.type==d.Error}toNumber(){return this.type==d.Number?this.numValue:-1}toString(){switch(this.type){case d.Character:case d.Identifier:case d.Keyword:case d.Operator:case d.PrivateIdentifier:case d.String:case d.Error:return this.strValue;case d.Number:return this.numValue.toString();default:return null}}};function it(s,e,t){return new N(s,e,d.Character,t,String.fromCharCode(t))}function dr(s,e,t){return new N(s,e,d.Identifier,0,t)}function vr(s,e,t){return new N(s,e,d.PrivateIdentifier,0,t)}function gr(s,e,t){return new N(s,e,d.Keyword,0,t)}function Ke(s,e,t){return new N(s,e,d.Operator,0,t)}function mr(s,e,t){return new N(s,e,d.String,0,t)}function Sr(s,e,t){return new N(s,e,d.Number,t,"")}function wr(s,e,t){return new N(s,e,d.Error,0,t)}var Oe=new N(-1,-1,d.Character,0,""),Te=class{constructor(e){this.input=e,this.peek=0,this.index=-1,this.length=e.length,this.advance()}advance(){this.peek=++this.index>=this.length?0:this.input.charCodeAt(this.index)}scanToken(){let e=this.input,t=this.length,r=this.peek,n=this.index;for(;r<=32;)if(++n>=t){r=0;break}else r=e.charCodeAt(n);if(this.peek=r,this.index=n,n>=t)return null;if(at(r))return this.scanIdentifier();if(B(r))return this.scanNumber(n);let i=n;switch(r){case 46:return this.advance(),B(this.peek)?this.scanNumber(i):it(i,this.index,46);case 40:case 41:case 123:case 125:case 91:case 93:case 44:case 58:case 59:return this.scanCharacter(i,r);case 39:case 34:return this.scanString();case 35:return this.scanPrivateIdentifier();case 43:case 45:case 42:case 47:case 37:case 94:return this.scanOperator(i,String.fromCharCode(r));case 63:return this.scanQuestion(i);case 60:case 62:return this.scanComplexOperator(i,String.fromCharCode(r),61,"=");case 33:case 61:return this.scanComplexOperator(i,String.fromCharCode(r),61,"=",61,"=");case 38:return this.scanComplexOperator(i,"&",38,"&");case 124:return this.scanComplexOperator(i,"|",124,"|");case 160:for(;Ye(this.peek);)this.advance();return this.scanToken()}return this.advance(),this.error(`Unexpected character [${String.fromCharCode(r)}]`,0)}scanCharacter(e,t){return this.advance(),it(e,this.index,t)}scanOperator(e,t){return this.advance(),Ke(e,this.index,t)}scanComplexOperator(e,t,r,n,i,a){this.advance();let h=t;return this.peek==r&&(this.advance(),h+=n),i!=null&&this.peek==i&&(this.advance(),h+=a),Ke(e,this.index,h)}scanIdentifier(){let e=this.index;for(this.advance();ot(this.peek);)this.advance();let t=this.input.substring(e,this.index);return fr.indexOf(t)>-1?gr(e,this.index,t):dr(e,this.index,t)}scanPrivateIdentifier(){let e=this.index;if(this.advance(),!at(this.peek))return this.error("Invalid character [#]",-1);for(;ot(this.peek);)this.advance();let t=this.input.substring(e,this.index);return vr(e,this.index,t)}scanNumber(e){let t=this.index===e,r=!1;for(this.advance();;){if(!B(this.peek))if(this.peek===95){if(!B(this.input.charCodeAt(this.index-1))||!B(this.input.charCodeAt(this.index+1)))return this.error("Invalid numeric separator",0);r=!0}else if(this.peek===46)t=!1;else if(yr(this.peek)){if(this.advance(),Er(this.peek)&&this.advance(),!B(this.peek))return this.error("Invalid exponent",-1);t=!1}else break;this.advance()}let n=this.input.substring(e,this.index);r&&(n=n.replace(/_/g,""));let i=t?$r(n):parseFloat(n);return Sr(e,this.index,i)}scanString(){let e=this.index,t=this.peek;this.advance();let r="",n=this.index,i=this.input;for(;this.peek!=t;)if(this.peek==92){r+=i.substring(n,this.index);let h;if(this.advance(),this.peek==117){let v=i.substring(this.index+1,this.index+5);if(/^[0-9a-f]+$/i.test(v))h=parseInt(v,16);else return this.error(`Invalid unicode escape [\\u${v}]`,0);for(let f=0;f<5;f++)this.advance()}else h=Ar(this.peek),this.advance();r+=String.fromCharCode(h),n=this.index}else{if(this.peek==0)return this.error("Unterminated quote",0);this.advance()}let a=i.substring(n,this.index);return this.advance(),mr(e,this.index,r+a)}scanQuestion(e){this.advance();let t="?";return(this.peek===63||this.peek===46)&&(t+=this.peek===46?".":"?",this.advance()),Ke(e,this.index,t)}error(e,t){let r=this.index+t;return wr(r,this.index,`Lexer Error: ${e} at column ${r} in expression [${this.input}]`)}};function at(s){return 97<=s&&s<=122||65<=s&&s<=90||s==95||s==36}function ot(s){return et(s)||B(s)||s==95||s==36}function yr(s){return s==101||s==69}function Er(s){return s==45||s==43}function Ar(s){switch(s){case 110:return 10;case 102:return 12;case 114:return 13;case 116:return 9;case 118:return 11;default:return s}}function $r(s){let e=parseInt(s);if(isNaN(e))throw new Error("Invalid integer literal when parsing "+s);return e}var Cr=[/^\s*$/,/[<>]/,/^[{}]$/,/&(#|[a-z])/i,/^\/\//];function ut(s,e){if(e!=null&&!(Array.isArray(e)&&e.length==2))throw new Error(`Expected '${s}' to be an array, [start, end].`);if(e!=null){let t=e[0],r=e[1];Cr.forEach(n=>{if(n.test(t)||n.test(r))throw new Error(`['${t}', '${r}'] contains unusable interpolation symbol.`)})}}var de=class{static fromArray(e){return e?(ut("interpolation",e),new de(e[0],e[1])):F}constructor(e,t){this.start=e,this.end=t}},F=new de("{{","}}");var Me=class{constructor(e,t,r){this.strings=e,this.expressions=t,this.offsets=r}},Fe=class{constructor(e,t,r){this.templateBindings=e,this.warnings=t,this.errors=r}},ve=class{constructor(e){this._lexer=e,this.errors=[]}parseAction(e,t,r,n,i=F){this._checkNoInterpolation(e,r,i);let a=this._stripComments(e),h=this._lexer.tokenize(a),v=1;t&&(v|=2);let f=new U(e,r,n,h,v,this.errors,0).parseChain();return new R(f,e,r,n,this.errors)}parseBinding(e,t,r,n=F){let i=this._parseBindingAst(e,t,r,n);return new R(i,e,t,r,this.errors)}checkSimpleExpression(e){let t=new Ue;return e.visit(t),t.errors}parseSimpleBinding(e,t,r,n=F){let i=this._parseBindingAst(e,t,r,n),a=this.checkSimpleExpression(i);return a.length>0&&this._reportError(`Host binding expression cannot contain ${a.join(" ")}`,e,t),new R(i,e,t,r,this.errors)}_reportError(e,t,r,n){this.errors.push(new G(e,t,r,n))}_parseBindingAst(e,t,r,n){this._checkNoInterpolation(e,t,n);let i=this._stripComments(e),a=this._lexer.tokenize(i);return new U(e,t,r,a,0,this.errors,0).parseChain()}parseTemplateBindings(e,t,r,n,i){let a=this._lexer.tokenize(t);return new U(t,r,i,a,0,this.errors,0).parseTemplateBindings({source:e,span:new P(n,n+e.length)})}parseInterpolation(e,t,r,n,i=F){let{strings:a,expressions:h,offsets:v}=this.splitInterpolation(e,t,n,i);if(h.length===0)return null;let f=[];for(let w=0;w<h.length;++w){let k=h[w].text,C=this._stripComments(k),y=this._lexer.tokenize(C),m=new U(e,t,r,y,0,this.errors,v[w]).parseChain();f.push(m)}return this.createInterpolationAst(a.map(w=>w.text),f,e,t,r)}parseInterpolationExpression(e,t,r){let n=this._stripComments(e),i=this._lexer.tokenize(n),a=new U(e,t,r,i,0,this.errors,0).parseChain(),h=["",""];return this.createInterpolationAst(h,[a],e,t,r)}createInterpolationAst(e,t,r,n,i){let a=new L(0,r.length),h=new ye(a,a.toAbsolute(i),e,t);return new R(h,r,n,i,this.errors)}splitInterpolation(e,t,r,n=F){let i=[],a=[],h=[],v=r?Or(r):null,f=0,w=!1,k=!1,{start:C,end:y}=n;for(;f<e.length;)if(w){let m=f,c=m+C.length,o=this._getInterpolationEndIndex(e,y,c);if(o===-1){w=!1,k=!0;break}let x=o+y.length,p=e.substring(c,o);p.trim().length===0&&this._reportError("Blank expressions are not allowed in interpolated strings",e,`at column ${f} in`,t),a.push({text:p,start:m,end:x});let g=((v==null?void 0:v.get(m))??m)+C.length;h.push(g),f=x,w=!1}else{let m=f;f=e.indexOf(C,f),f===-1&&(f=e.length);let c=e.substring(m,f);i.push({text:c,start:m,end:f}),w=!0}if(!w)if(k){let m=i[i.length-1];m.text+=e.substring(f),m.end=e.length}else i.push({text:e.substring(f),start:f,end:e.length});return new Me(i,a,h)}wrapLiteralPrimitive(e,t,r){let n=new L(0,e==null?0:e.length);return new R(new A(n,n.toAbsolute(r),e),e,t,r,this.errors)}_stripComments(e){let t=this._commentStart(e);return t!=null?e.substring(0,t):e}_commentStart(e){let t=null;for(let r=0;r<e.length-1;r++){let n=e.charCodeAt(r),i=e.charCodeAt(r+1);if(n===47&&i==47&&t==null)return r;t===n?t=null:t==null&&be(n)&&(t=n)}return null}_checkNoInterpolation(e,t,{start:r,end:n}){let i=-1,a=-1;for(let h of this._forEachUnquotedChar(e,0))if(i===-1)e.startsWith(r)&&(i=h);else if(a=this._getInterpolationEndIndex(e,n,h),a>-1)break;i>-1&&a>-1&&this._reportError(`Got interpolation (${r}${n}) where expression was expected`,e,`at column ${i} in`,t)}_getInterpolationEndIndex(e,t,r){for(let n of this._forEachUnquotedChar(e,r)){if(e.startsWith(t,n))return n;if(e.startsWith("//",n))return e.indexOf(t,n)}return-1}*_forEachUnquotedChar(e,t){let r=null,n=0;for(let i=t;i<e.length;i++){let a=e[i];be(e.charCodeAt(i))&&(r===null||r===a)&&n%2===0?r=r===null?a:null:r===null&&(yield i),n=a==="\\"?n+1:0}}},oe;(function(s){s[s.None=0]="None",s[s.Writable=1]="Writable"})(oe||(oe={}));var U=class{constructor(e,t,r,n,i,a,h){this.input=e,this.location=t,this.absoluteOffset=r,this.tokens=n,this.parseFlags=i,this.errors=a,this.offset=h,this.rparensExpected=0,this.rbracketsExpected=0,this.rbracesExpected=0,this.context=oe.None,this.sourceSpanCache=new Map,this.index=0}peek(e){let t=this.index+e;return t<this.tokens.length?this.tokens[t]:Oe}get next(){return this.peek(0)}get atEOF(){return this.index>=this.tokens.length}get inputIndex(){return this.atEOF?this.currentEndIndex:this.next.index+this.offset}get currentEndIndex(){return this.index>0?this.peek(-1).end+this.offset:this.tokens.length===0?this.input.length+this.offset:this.next.index+this.offset}get currentAbsoluteOffset(){return this.absoluteOffset+this.inputIndex}span(e,t){let r=this.currentEndIndex;if(t!==void 0&&t>this.currentEndIndex&&(r=t),e>r){let n=r;r=e,e=n}return new L(e,r)}sourceSpan(e,t){let r=`${e}@${this.inputIndex}:${t}`;return this.sourceSpanCache.has(r)||this.sourceSpanCache.set(r,this.span(e,t).toAbsolute(this.absoluteOffset)),this.sourceSpanCache.get(r)}advance(){this.index++}withContext(e,t){this.context|=e;let r=t();return this.context^=e,r}consumeOptionalCharacter(e){return this.next.isCharacter(e)?(this.advance(),!0):!1}peekKeywordLet(){return this.next.isKeywordLet()}peekKeywordAs(){return this.next.isKeywordAs()}expectCharacter(e){this.consumeOptionalCharacter(e)||this.error(`Missing expected ${String.fromCharCode(e)}`)}consumeOptionalOperator(e){return this.next.isOperator(e)?(this.advance(),!0):!1}expectOperator(e){this.consumeOptionalOperator(e)||this.error(`Missing expected operator ${e}`)}prettyPrintToken(e){return e===Oe?"end of input":`token ${e}`}expectIdentifierOrKeyword(){let e=this.next;return!e.isIdentifier()&&!e.isKeyword()?(e.isPrivateIdentifier()?this._reportErrorForPrivateIdentifier(e,"expected identifier or keyword"):this.error(`Unexpected ${this.prettyPrintToken(e)}, expected identifier or keyword`),null):(this.advance(),e.toString())}expectIdentifierOrKeywordOrString(){let e=this.next;return!e.isIdentifier()&&!e.isKeyword()&&!e.isString()?(e.isPrivateIdentifier()?this._reportErrorForPrivateIdentifier(e,"expected identifier, keyword or string"):this.error(`Unexpected ${this.prettyPrintToken(e)}, expected identifier, keyword, or string`),""):(this.advance(),e.toString())}parseChain(){let e=[],t=this.inputIndex;for(;this.index<this.tokens.length;){let r=this.parsePipe();if(e.push(r),this.consumeOptionalCharacter(59))for(this.parseFlags&1||this.error("Binding expression cannot contain chained expression");this.consumeOptionalCharacter(59););else if(this.index<this.tokens.length){let n=this.index;if(this.error(`Unexpected token '${this.next}'`),this.index===n)break}}if(e.length===0){let r=this.offset,n=this.offset+this.input.length;return new E(this.span(r,n),this.sourceSpan(r,n))}return e.length==1?e[0]:new V(this.span(t),this.sourceSpan(t),e)}parsePipe(){let e=this.inputIndex,t=this.parseExpression();if(this.consumeOptionalOperator("|")){this.parseFlags&1&&this.error("Cannot have a pipe in an action expression");do{let r=this.inputIndex,n=this.expectIdentifierOrKeyword(),i,a;n!==null?i=this.sourceSpan(r):(n="",a=this.next.index!==-1?this.next.index:this.input.length+this.offset,i=new L(a,a).toAbsolute(this.absoluteOffset));let h=[];for(;this.consumeOptionalCharacter(58);)h.push(this.parseExpression());t=new q(this.span(e),this.sourceSpan(e,a),t,n,h,i)}while(this.consumeOptionalOperator("|"))}return t}parseExpression(){return this.parseConditional()}parseConditional(){let e=this.inputIndex,t=this.parseLogicalOr();if(this.consumeOptionalOperator("?")){let r=this.parsePipe(),n;if(this.consumeOptionalCharacter(58))n=this.parsePipe();else{let i=this.inputIndex,a=this.input.substring(e,i);this.error(`Conditional expression ${a} requires all 3 expressions`),n=new E(this.span(e),this.sourceSpan(e))}return new W(this.span(e),this.sourceSpan(e),t,r,n)}else return t}parseLogicalOr(){let e=this.inputIndex,t=this.parseLogicalAnd();for(;this.consumeOptionalOperator("||");){let r=this.parseLogicalAnd();t=new $(this.span(e),this.sourceSpan(e),"||",t,r)}return t}parseLogicalAnd(){let e=this.inputIndex,t=this.parseNullishCoalescing();for(;this.consumeOptionalOperator("&&");){let r=this.parseNullishCoalescing();t=new $(this.span(e),this.sourceSpan(e),"&&",t,r)}return t}parseNullishCoalescing(){let e=this.inputIndex,t=this.parseEquality();for(;this.consumeOptionalOperator("??");){let r=this.parseEquality();t=new $(this.span(e),this.sourceSpan(e),"??",t,r)}return t}parseEquality(){let e=this.inputIndex,t=this.parseRelational();for(;this.next.type==d.Operator;){let r=this.next.strValue;switch(r){case"==":case"===":case"!=":case"!==":this.advance();let n=this.parseRelational();t=new $(this.span(e),this.sourceSpan(e),r,t,n);continue}break}return t}parseRelational(){let e=this.inputIndex,t=this.parseAdditive();for(;this.next.type==d.Operator;){let r=this.next.strValue;switch(r){case"<":case">":case"<=":case">=":this.advance();let n=this.parseAdditive();t=new $(this.span(e),this.sourceSpan(e),r,t,n);continue}break}return t}parseAdditive(){let e=this.inputIndex,t=this.parseMultiplicative();for(;this.next.type==d.Operator;){let r=this.next.strValue;switch(r){case"+":case"-":this.advance();let n=this.parseMultiplicative();t=new $(this.span(e),this.sourceSpan(e),r,t,n);continue}break}return t}parseMultiplicative(){let e=this.inputIndex,t=this.parsePrefix();for(;this.next.type==d.Operator;){let r=this.next.strValue;switch(r){case"*":case"%":case"/":this.advance();let n=this.parsePrefix();t=new $(this.span(e),this.sourceSpan(e),r,t,n);continue}break}return t}parsePrefix(){if(this.next.type==d.Operator){let e=this.inputIndex,t=this.next.strValue,r;switch(t){case"+":return this.advance(),r=this.parsePrefix(),I.createPlus(this.span(e),this.sourceSpan(e),r);case"-":return this.advance(),r=this.parsePrefix(),I.createMinus(this.span(e),this.sourceSpan(e),r);case"!":return this.advance(),r=this.parsePrefix(),new J(this.span(e),this.sourceSpan(e),r)}}return this.parseCallChain()}parseCallChain(){let e=this.inputIndex,t=this.parsePrimary();for(;;)if(this.consumeOptionalCharacter(46))t=this.parseAccessMember(t,e,!1);else if(this.consumeOptionalOperator("?."))this.consumeOptionalCharacter(40)?t=this.parseCall(t,e,!0):t=this.consumeOptionalCharacter(91)?this.parseKeyedReadOrWrite(t,e,!0):this.parseAccessMember(t,e,!0);else if(this.consumeOptionalCharacter(91))t=this.parseKeyedReadOrWrite(t,e,!1);else if(this.consumeOptionalCharacter(40))t=this.parseCall(t,e,!1);else if(this.consumeOptionalOperator("!"))t=new Y(this.span(e),this.sourceSpan(e),t);else return t}parsePrimary(){let e=this.inputIndex;if(this.consumeOptionalCharacter(40)){this.rparensExpected++;let t=this.parsePipe();return this.rparensExpected--,this.expectCharacter(41),t}else{if(this.next.isKeywordNull())return this.advance(),new A(this.span(e),this.sourceSpan(e),null);if(this.next.isKeywordUndefined())return this.advance(),new A(this.span(e),this.sourceSpan(e),void 0);if(this.next.isKeywordTrue())return this.advance(),new A(this.span(e),this.sourceSpan(e),!0);if(this.next.isKeywordFalse())return this.advance(),new A(this.span(e),this.sourceSpan(e),!1);if(this.next.isKeywordThis())return this.advance(),new Se(this.span(e),this.sourceSpan(e));if(this.consumeOptionalCharacter(91)){this.rbracketsExpected++;let t=this.parseExpressionList(93);return this.rbracketsExpected--,this.expectCharacter(93),new X(this.span(e),this.sourceSpan(e),t)}else{if(this.next.isCharacter(123))return this.parseLiteralMap();if(this.next.isIdentifier())return this.parseAccessMember(new b(this.span(e),this.sourceSpan(e)),e,!1);if(this.next.isNumber()){let t=this.next.toNumber();return this.advance(),new A(this.span(e),this.sourceSpan(e),t)}else if(this.next.isString()){let t=this.next.toString();return this.advance(),new A(this.span(e),this.sourceSpan(e),t)}else return this.next.isPrivateIdentifier()?(this._reportErrorForPrivateIdentifier(this.next,null),new E(this.span(e),this.sourceSpan(e))):this.index>=this.tokens.length?(this.error(`Unexpected end of expression: ${this.input}`),new E(this.span(e),this.sourceSpan(e))):(this.error(`Unexpected token ${this.next}`),new E(this.span(e),this.sourceSpan(e)))}}}parseExpressionList(e){let t=[];do if(!this.next.isCharacter(e))t.push(this.parsePipe());else break;while(this.consumeOptionalCharacter(44));return t}parseLiteralMap(){let e=[],t=[],r=this.inputIndex;if(this.expectCharacter(123),!this.consumeOptionalCharacter(125)){this.rbracesExpected++;do{let n=this.inputIndex,i=this.next.isString(),a=this.expectIdentifierOrKeywordOrString();if(e.push({key:a,quoted:i}),i)this.expectCharacter(58),t.push(this.parsePipe());else if(this.consumeOptionalCharacter(58))t.push(this.parsePipe());else{let h=this.span(n),v=this.sourceSpan(n);t.push(new K(h,v,v,new b(h,v),a))}}while(this.consumeOptionalCharacter(44));this.rbracesExpected--,this.expectCharacter(125)}return new Z(this.span(r),this.sourceSpan(r),e,t)}parseAccessMember(e,t,r){let n=this.inputIndex,i=this.withContext(oe.Writable,()=>{let v=this.expectIdentifierOrKeyword()??"";return v.length===0&&this.error("Expected identifier for property access",e.span.end),v}),a=this.sourceSpan(n),h;if(r)this.consumeOptionalAssignment()?(this.error("The '?.' operator cannot be used in the assignment"),h=new E(this.span(t),this.sourceSpan(t))):h=new H(this.span(t),this.sourceSpan(t),a,e,i);else if(this.consumeOptionalAssignment()){if(!(this.parseFlags&1))return this.error("Bindings cannot contain assignments"),new E(this.span(t),this.sourceSpan(t));let v=this.parseConditional();h=new Q(this.span(t),this.sourceSpan(t),a,e,i,v)}else h=new K(this.span(t),this.sourceSpan(t),a,e,i);return h}parseCall(e,t,r){let n=this.inputIndex;this.rparensExpected++;let i=this.parseCallArguments(),a=this.span(n,this.inputIndex).toAbsolute(this.absoluteOffset);this.expectCharacter(41),this.rparensExpected--;let h=this.span(t),v=this.sourceSpan(t);return r?new te(h,v,e,i,a):new ee(h,v,e,i,a)}consumeOptionalAssignment(){return this.parseFlags&2&&this.next.isOperator("!")&&this.peek(1).isOperator("=")?(this.advance(),this.advance(),!0):this.consumeOptionalOperator("=")}parseCallArguments(){if(this.next.isCharacter(41))return[];let e=[];do e.push(this.parsePipe());while(this.consumeOptionalCharacter(44));return e}expectTemplateBindingKey(){let e="",t=!1,r=this.currentAbsoluteOffset;do e+=this.expectIdentifierOrKeywordOrString(),t=this.consumeOptionalOperator("-"),t&&(e+="-");while(t);return{source:e,span:new P(r,r+e.length)}}parseTemplateBindings(e){let t=[];for(t.push(...this.parseDirectiveKeywordBindings(e));this.index<this.tokens.length;){let r=this.parseLetBinding();if(r)t.push(r);else{let n=this.expectTemplateBindingKey(),i=this.parseAsBinding(n);i?t.push(i):(n.source=e.source+n.source.charAt(0).toUpperCase()+n.source.substring(1),t.push(...this.parseDirectiveKeywordBindings(n)))}this.consumeStatementTerminator()}return new Fe(t,[],this.errors)}parseKeyedReadOrWrite(e,t,r){return this.withContext(oe.Writable,()=>{this.rbracketsExpected++;let n=this.parsePipe();if(n instanceof E&&this.error("Key access cannot be empty"),this.rbracketsExpected--,this.expectCharacter(93),this.consumeOptionalOperator("="))if(r)this.error("The '?.' operator cannot be used in the assignment");else{let i=this.parseConditional();return new z(this.span(t),this.sourceSpan(t),e,n,i)}else return r?new we(this.span(t),this.sourceSpan(t),e,n):new j(this.span(t),this.sourceSpan(t),e,n);return new E(this.span(t),this.sourceSpan(t))})}parseDirectiveKeywordBindings(e){let t=[];this.consumeOptionalCharacter(58);let r=this.getDirectiveBoundTarget(),n=this.currentAbsoluteOffset,i=this.parseAsBinding(e);i||(this.consumeStatementTerminator(),n=this.currentAbsoluteOffset);let a=new P(e.span.start,n);return t.push(new re(a,e,r)),i&&t.push(i),t}getDirectiveBoundTarget(){if(this.next===Oe||this.peekKeywordAs()||this.peekKeywordLet())return null;let e=this.parsePipe(),{start:t,end:r}=e.span,n=this.input.substring(t,r);return new R(e,n,this.location,this.absoluteOffset+t,this.errors)}parseAsBinding(e){if(!this.peekKeywordAs())return null;this.advance();let t=this.expectTemplateBindingKey();this.consumeStatementTerminator();let r=new P(e.span.start,this.currentAbsoluteOffset);return new T(r,t,e)}parseLetBinding(){if(!this.peekKeywordLet())return null;let e=this.currentAbsoluteOffset;this.advance();let t=this.expectTemplateBindingKey(),r=null;this.consumeOptionalOperator("=")&&(r=this.expectTemplateBindingKey()),this.consumeStatementTerminator();let n=new P(e,this.currentAbsoluteOffset);return new T(n,t,r)}consumeStatementTerminator(){this.consumeOptionalCharacter(59)||this.consumeOptionalCharacter(44)}error(e,t=null){this.errors.push(new G(e,this.input,this.locationText(t),this.location)),this.skip()}locationText(e=null){return e==null&&(e=this.index),e<this.tokens.length?`at column ${this.tokens[e].index+1} in`:"at the end of the expression"}_reportErrorForPrivateIdentifier(e,t){let r=`Private identifiers are not supported. Unexpected private identifier: ${e}`;t!==null&&(r+=`, ${t}`),this.error(r)}skip(){let e=this.next;for(;this.index<this.tokens.length&&!e.isCharacter(59)&&!e.isOperator("|")&&(this.rparensExpected<=0||!e.isCharacter(41))&&(this.rbracesExpected<=0||!e.isCharacter(125))&&(this.rbracketsExpected<=0||!e.isCharacter(93))&&(!(this.context&oe.Writable)||!e.isOperator("="));)this.next.isError()&&this.errors.push(new G(this.next.toString(),this.input,this.locationText(),this.location)),this.advance(),e=this.next}},Ue=class extends Ee{constructor(){super(...arguments),this.errors=[]}visitPipe(){this.errors.push("pipes")}};function Or(s){let e=new Map,t=0,r=0,n=0;for(;n<s.length;){let i=s[n];if(i.type===9){let[a,h]=i.parts;t+=h.length,r+=a.length}else{let a=i.parts.reduce((h,v)=>h+v.length,0);r+=a,t+=a}e.set(r,t),n++}return e}var xt="angular-estree-parser",De="NgEstreeParser",Ge=0,Ve=[xt,Ge];function ft(){return new ve(new ue)}function We(s,e){let t=ft(),{astInput:r,comments:n}=kr(s,t),{ast:i,errors:a}=e(r,t);return St(a),{ast:i,comments:n}}function dt(s){return We(s,(e,t)=>t.parseBinding(e,...Ve))}function vt(s){return We(s,(e,t)=>t.parseAction(e,!1,...Ve))}function gt(s){return We(s,(e,t)=>{let r=t.parseInterpolationExpression(e,...Ve);return r.ast=r.ast.expressions[0],r})}function mt(s){let e=ft(),{templateBindings:t,errors:r}=e.parseTemplateBindings(De,s,xt,Ge,Ge);return St(r),t}function St(s){if(s.length!==0){let[{message:e}]=s;throw new SyntaxError(e.replace(/^Parser Error: | at column \d+ in [^]*$/g,""))}}function kr(s,e){let t=e._commentStart(s);return t===null?{astInput:s,comments:[]}:{astInput:s.slice(0,t),comments:[{type:"Comment",value:s.slice(t+2),sourceSpan:{start:t,end:s.length}}]}}function wt(s){return s instanceof I?"Unary":s instanceof $?"Binary":s instanceof q?"BindingPipe":s instanceof ee?"Call":s instanceof V?"Chain":s instanceof W?"Conditional":s instanceof E?"EmptyExpr":s instanceof b?"ImplicitReceiver":s instanceof j?"KeyedRead":s instanceof z?"KeyedWrite":s instanceof X?"LiteralArray":s instanceof Z?"LiteralMap":s instanceof A?"LiteralPrimitive":s instanceof Y?"NonNullAssert":s instanceof J?"PrefixNot":s instanceof K?"PropertyRead":s instanceof Q?"PropertyWrite":s instanceof te?"SafeCall":s instanceof H?"SafePropertyRead":s.type}function lt({start:s,end:e},t){let r=s,n=e;for(;n!==r&&/\s/.test(t[n-1]);)n--;for(;r!==n&&/\s/.test(t[r]);)r++;return{start:r,end:n}}function Ir({start:s,end:e},t){let r=s,n=e;for(;n!==t.length&&/\s/.test(t[n]);)n++;for(;r!==0&&/\s/.test(t[r-1]);)r--;return{start:r,end:n}}function Pr(s,e){return e[s.start-1]==="("&&e[s.end]===")"?{start:s.start-1,end:s.end+1}:s}function yt(s,e,t){let r=0,n={start:s.start,end:s.end};for(;;){let i=Ir(n,e),a=Pr(i,e);if(i.start===a.start&&i.end===a.end)break;n.start=a.start,n.end=a.end,r++}return{hasParens:(t?r-1:r)!==0,outerSpan:lt(t?{start:n.start+1,end:n.end-1}:n,e),innerSpan:lt(s,e)}}function Et(s,e,t){let r=e;for(;!s.test(t[r]);)if(--r<0)throw new Error(`Cannot find front char ${s} from index ${e} in ${JSON.stringify(t)}`);return r}function Ne(s,e,t){let r=e;for(;!s.test(t[r]);)if(++r>=t.length)throw new Error(`Cannot find back char ${s} from index ${e} in ${JSON.stringify(t)}`);return r}function At(s){return s.slice(0,1).toLowerCase()+s.slice(1)}function $t(s){return s.length===0?void 0:s[s.length-1]}var ce=(s,e,t=!1)=>{let r=wt(s);switch(r){case"Unary":{let{operator:c,expr:o}=s,x=n(o);return a("UnaryExpression",{prefix:!0,argument:x,operator:c},s.sourceSpan,{hasParentParens:t})}case"Binary":{let{left:c,operation:o,right:x}=s,p=n(c),l=n(x);return a(o==="&&"||o==="||"||o==="??"?"LogicalExpression":"BinaryExpression",{left:p,right:l,operator:o},{start:y(p),end:m(l)},{hasParentParens:t})}case"BindingPipe":{let{exp:c,name:o,args:x}=s,p=n(c),l=f(/\S/,f(/\|/,m(p))+1),g=a("Identifier",{name:o},{start:l,end:l+o.length}),u=x.map(n);return a("NGPipeExpression",{left:p,right:g,arguments:u},{start:y(p),end:m(u.length===0?g:$t(u))},{hasParentParens:t})}case"Chain":{let{expressions:c}=s;return a("NGChainedExpression",{expressions:c.map(n)},s.sourceSpan,{hasParentParens:t})}case"Comment":{let{value:c}=s;return a("CommentLine",{value:c},s.sourceSpan,{processSpan:!1})}case"Conditional":{let{condition:c,trueExp:o,falseExp:x}=s,p=n(c),l=n(o),g=n(x);return a("ConditionalExpression",{test:p,consequent:l,alternate:g},{start:y(p),end:m(g)},{hasParentParens:t})}case"EmptyExpr":return a("NGEmptyExpression",{},s.sourceSpan,{hasParentParens:t});case"ImplicitReceiver":return a("ThisExpression",{},s.sourceSpan,{hasParentParens:t});case"KeyedRead":{let{key:c}=s,o=Object.prototype.hasOwnProperty.call(s,"receiver")?s.receiver:s.obj,x=n(c);return h(o,x,{computed:!0,optional:!1},{end:s.sourceSpan.end,hasParentParens:t})}case"LiteralArray":{let{expressions:c}=s;return a("ArrayExpression",{elements:c.map(n)},s.sourceSpan,{hasParentParens:t})}case"LiteralMap":{let{keys:c,values:o}=s,x=o.map(l=>n(l)),p=c.map(({key:l,quoted:g},u)=>{let O=x[u],he=y(O),ze=m(O),Pe=f(/\S/,u===0?s.sourceSpan.start+1:f(/,/,m(x[u-1]))+1),Rt=he===Pe?ze:v(/\S/,v(/:/,he-1)-1)+1,qe={start:Pe,end:Rt},ge=g?a("StringLiteral",{value:l},qe):a("Identifier",{name:l},qe),Lt=ge.end<ge.start||Pe===he;return a("ObjectProperty",{key:ge,value:O,method:!1,shorthand:Lt,computed:!1},{start:y(ge),end:ze})});return a("ObjectExpression",{properties:p},s.sourceSpan,{hasParentParens:t})}case"LiteralPrimitive":{let{value:c}=s;switch(typeof c){case"boolean":return a("BooleanLiteral",{value:c},s.sourceSpan,{hasParentParens:t});case"number":return a("NumericLiteral",{value:c},s.sourceSpan,{hasParentParens:t});case"object":return a("NullLiteral",{},s.sourceSpan,{hasParentParens:t});case"string":return a("StringLiteral",{value:c},s.sourceSpan,{hasParentParens:t});case"undefined":return a("Identifier",{name:"undefined"},s.sourceSpan,{hasParentParens:t});default:throw new Error(`Unexpected LiteralPrimitive value type ${typeof c}`)}}case"Call":case"SafeCall":{let c=r==="SafeCall",{receiver:o,args:x}=s,p=x.length===1?[i(x[0])]:x.map(n),l=n(o),g=k(l),u=c||g?"OptionalCallExpression":"CallExpression";return a(u,{callee:l,arguments:p,optional:u==="OptionalCallExpression"?c:void 0},{start:y(l),end:s.sourceSpan.end},{hasParentParens:t})}case"NonNullAssert":{let{expression:c}=s,o=n(c);return a("TSNonNullExpression",{expression:o},{start:y(o),end:s.sourceSpan.end},{hasParentParens:t})}case"PrefixNot":{let{expression:c}=s,o=n(c);return a("UnaryExpression",{prefix:!0,operator:"!",argument:o},{start:s.sourceSpan.start,end:m(o)},{hasParentParens:t})}case"PropertyRead":case"SafePropertyRead":{let c=r==="SafePropertyRead",{receiver:o,name:x}=s,p=v(/\S/,s.sourceSpan.end-1)+1,l=a("Identifier",{name:x},{start:p-x.length,end:p},w(o)?{hasParentParens:t}:{});return h(o,l,{computed:!1,optional:c},{hasParentParens:t})}case"KeyedWrite":{let{key:c,value:o}=s,x=Object.prototype.hasOwnProperty.call(s,"receiver")?s.receiver:s.obj,p=n(c),l=n(o),g=h(x,p,{computed:!0,optional:!1},{end:f(/\]/,m(p))+1});return a("AssignmentExpression",{left:g,operator:"=",right:l},{start:y(g),end:m(l)},{hasParentParens:t})}case"PropertyWrite":{let{receiver:c,name:o,value:x}=s,p=n(x),l=v(/\S/,v(/=/,y(p)-1)-1)+1,g=a("Identifier",{name:o},{start:l-o.length,end:l}),u=h(c,g,{computed:!1,optional:!1});return a("AssignmentExpression",{left:u,operator:"=",right:p},{start:y(u),end:m(p)},{hasParentParens:t})}default:throw new Error(`Unexpected node ${r}`)}function n(c){return ce(c,e)}function i(c){return ce(c,e,!0)}function a(c,o,x,{processSpan:p=!0,hasParentParens:l=!1}={}){let g={type:c,...ke(x,e,p,l),...o};switch(c){case"Identifier":{let u=g;u.loc.identifierName=u.name;break}case"NumericLiteral":{let u=g;u.extra={...u.extra,raw:e.text.slice(u.start,u.end),rawValue:u.value};break}case"StringLiteral":{let u=g;u.extra={...u.extra,raw:e.text.slice(u.start,u.end),rawValue:u.value};break}case"ObjectProperty":{let u=g;u.shorthand&&(u.extra={...u.extra,shorthand:u.shorthand});break}}return g}function h(c,o,x,{end:p=m(o),hasParentParens:l=!1}={}){if(w(c)||c.sourceSpan.start===o.start)return o;let g=n(c),u=k(g);return a(x.optional||u?"OptionalMemberExpression":"MemberExpression",{object:g,property:o,computed:x.computed,...x.optional?{optional:!0}:u?{optional:!1}:null},{start:y(g),end:p},{hasParentParens:l})}function v(c,o){return Et(c,o,e.text)}function f(c,o){return Ne(c,o,e.text)}function w(c){return c.sourceSpan.start>=c.sourceSpan.end||/^\s+$/.test(e.text.slice(c.sourceSpan.start,c.sourceSpan.end))}function k(c){return(c.type==="OptionalCallExpression"||c.type==="OptionalMemberExpression")&&!C(c)}function C(c){return c.extra&&c.extra.parenthesized}function y(c){return C(c)?c.extra.parenStart:c.start}function m(c){return C(c)?c.extra.parenEnd:c.end}};function ke(s,e,t=!1,r=!1){if(!t){let{start:h,end:v}=s;return{start:h,end:v,loc:{start:e.locator.locationForIndex(h),end:e.locator.locationForIndex(v)}}}let{outerSpan:n,innerSpan:i,hasParens:a}=yt(s,e.text,r);return{start:i.start,end:i.end,loc:{start:e.locator.locationForIndex(i.start),end:e.locator.locationForIndex(i.end)},...a&&{extra:{parenthesized:!0,parenStart:n.start,parenEnd:n.end}}}}function Ct(s,e){s.forEach(y);let[t]=s,{key:r}=t,n=e.text.slice(t.sourceSpan.start,t.sourceSpan.end).trim().length===0?s.slice(1):s,i=[],a=null;for(let o=0;o<n.length;o++){let x=n[o];if(a&&k(a)&&C(x)&&x.value&&x.value.source===a.key.source){let p=f("NGMicrosyntaxKey",{name:x.key.source},x.key.span),l=(O,he)=>({...O,...ke({start:O.start,end:he},e)}),g=O=>({...l(O,p.end),alias:p}),u=i.pop();if(u.type==="NGMicrosyntaxExpression")i.push(g(u));else if(u.type==="NGMicrosyntaxKeyedExpression"){let O=g(u.expression);i.push(l({...u,expression:O},O.end))}else throw new Error(`Unexpected type ${u.type}`)}else i.push(h(x,o));a=x}return f("NGMicrosyntax",{body:i},i.length===0?s[0].sourceSpan:{start:i[0].start,end:i[i.length-1].end});function h(o,x){if(k(o)){let{key:p,value:l}=o;return l?x===0?f("NGMicrosyntaxExpression",{expression:v(l.ast),alias:null},l.sourceSpan):f("NGMicrosyntaxKeyedExpression",{key:f("NGMicrosyntaxKey",{name:w(p.source)},p.span),expression:f("NGMicrosyntaxExpression",{expression:v(l.ast),alias:null},l.sourceSpan)},{start:p.span.start,end:l.sourceSpan.end}):f("NGMicrosyntaxKey",{name:w(p.source)},p.span)}else{let{key:p,sourceSpan:l}=o;if(/^let\s$/.test(e.text.slice(l.start,l.start+4))){let{value:u}=o;return f("NGMicrosyntaxLet",{key:f("NGMicrosyntaxKey",{name:p.source},p.span),value:u?f("NGMicrosyntaxKey",{name:u.source},u.span):null},{start:l.start,end:u?u.span.end:p.span.end})}else{let u=c(o);return f("NGMicrosyntaxAs",{key:f("NGMicrosyntaxKey",{name:u.source},u.span),alias:f("NGMicrosyntaxKey",{name:p.source},p.span)},{start:u.span.start,end:p.span.end})}}}function v(o){return ce(o,e)}function f(o,x,p,l=!0){return{type:o,...ke(p,e,l),...x}}function w(o){return At(o.slice(r.source.length))}function k(o){return o instanceof re}function C(o){return o instanceof T}function y(o){m(o.key.span),C(o)&&o.value&&m(o.value.span)}function m(o){if(e.text[o.start]!=='"'&&e.text[o.start]!=="'")return;let x=e.text[o.start],p=!1;for(let l=o.start+1;l<e.text.length;l++)switch(e.text[l]){case x:if(!p){o.end=l+1;return}default:p=!1;break;case"\\":p=!p;break}}function c(o){if(!o.value||o.value.source!==De)return o.value;let x=Ne(/\S/,o.sourceSpan.start,e.text);return{source:"$implicit",span:{start:x,end:x}}}}function Qe(s,e){let{ast:t,comments:r}=e(s),n=new pe(s),i=h=>ce(h,n),a=i(t);return a.comments=r.map(h=>i(h)),a}function Ot(s){return Qe(s,dt)}function Nt(s){return Qe(s,gt)}function He(s){return Qe(s,vt)}function kt(s){return Ct(mt(s),new pe(s))}function Rr(s){return Array.isArray(s)&&s.length>0}var It=Rr;function je(s){var r;let e=s.range?s.range[0]:s.start,t=((r=s.declaration)==null?void 0:r.decorators)??s.decorators;return It(t)?Math.min(je(t[0]),e):e}function Pt(s){return s.range?s.range[1]:s.end}function Ie(s){return{astFormat:"estree",parse(e){let t=s(e);return{type:"NGRoot",node:s===He&&t.type!=="NGChainedExpression"?{...t,type:"NGChainedExpression",expressions:[t]}:t}},locStart:je,locEnd:Pt}}var Lr={parsers:{__ng_action:Ie(He),__ng_binding:Ie(Ot),__ng_interpolation:Ie(Nt),__ng_directive:Ie(kt)}},br=Lr;return Mt(Br);});
|
package/plugins/angular.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var
|
|
2
|
-
`,pt="\r",ut=function(){function r(e){this.length=e.length;for(var t=[0],s=0;s<e.length;)switch(e[s]){case Ee:s+=Ee.length,t.push(s);break;case pt:s+=pt.length,e[s]===Ee&&(s+=Ee.length),t.push(s);break;default:s++;break}this.offsets=t}return r.prototype.locationForIndex=function(e){if(e<0||e>this.length)return null;for(var t=0,s=this.offsets;s[t+1]<=e;)t++;var n=e-s[t];return{line:t,column:n}},r.prototype.indexForLocation=function(e){var t=e.line,s=e.column;return t<0||t>=this.offsets.length||s<0||s>this.lengthOfLine(t)?null:this.offsets[t]+s},r.prototype.lengthOfLine=function(e){var t=this.offsets[e],s=e===this.offsets.length-1?this.length:this.offsets[e+1];return s-t},r}()});var xe,Ue,xt=$(()=>{g();lt();xe=class{constructor(e){ye(this,"text");ye(this,"locator");this.text=e,this.locator=new Ue(this.text)}},Ue=class{constructor(e){ye(this,"_linesAndColumns");this._linesAndColumns=new ut(e)}locationForIndex(e){let{line:t,column:s}=this._linesAndColumns.locationForIndex(e);return{line:t+1,column:s,index:e}}}});var W,K,w,Q,C,T,Ae,j,H,M,z,q,X,$e,Z,J,O,Y,ee,Ce,N,L,te,re,se,ne,b,B,F,ie,Oe,ft,De=$(()=>{g();W=class{constructor(e,t,s,n){this.input=t,this.errLocation=s,this.ctxLocation=n,this.message=`Parser Error: ${e} ${s} [${t}] in ${n}`}},K=class{constructor(e,t){this.start=e,this.end=t}toAbsolute(e){return new b(e+this.start,e+this.end)}},w=class{constructor(e,t){this.span=e,this.sourceSpan=t}toString(){return"AST"}},Q=class extends w{constructor(e,t,s){super(e,t),this.nameSpan=s}},C=class extends w{visit(e,t=null){}},T=class extends w{visit(e,t=null){return e.visitImplicitReceiver(this,t)}},Ae=class extends T{visit(e,t=null){var s;return(s=e.visitThisReceiver)==null?void 0:s.call(e,this,t)}},j=class extends w{constructor(e,t,s){super(e,t),this.expressions=s}visit(e,t=null){return e.visitChain(this,t)}},H=class extends w{constructor(e,t,s,n,i){super(e,t),this.condition=s,this.trueExp=n,this.falseExp=i}visit(e,t=null){return e.visitConditional(this,t)}},M=class extends Q{constructor(e,t,s,n,i){super(e,t,s),this.receiver=n,this.name=i}visit(e,t=null){return e.visitPropertyRead(this,t)}},z=class extends Q{constructor(e,t,s,n,i,a){super(e,t,s),this.receiver=n,this.name=i,this.value=a}visit(e,t=null){return e.visitPropertyWrite(this,t)}},q=class extends Q{constructor(e,t,s,n,i){super(e,t,s),this.receiver=n,this.name=i}visit(e,t=null){return e.visitSafePropertyRead(this,t)}},X=class extends w{constructor(e,t,s,n){super(e,t),this.receiver=s,this.key=n}visit(e,t=null){return e.visitKeyedRead(this,t)}},$e=class extends w{constructor(e,t,s,n){super(e,t),this.receiver=s,this.key=n}visit(e,t=null){return e.visitSafeKeyedRead(this,t)}},Z=class extends w{constructor(e,t,s,n,i){super(e,t),this.receiver=s,this.key=n,this.value=i}visit(e,t=null){return e.visitKeyedWrite(this,t)}},J=class extends Q{constructor(e,t,s,n,i,a){super(e,t,a),this.exp=s,this.name=n,this.args=i}visit(e,t=null){return e.visitPipe(this,t)}},O=class extends w{constructor(e,t,s){super(e,t),this.value=s}visit(e,t=null){return e.visitLiteralPrimitive(this,t)}},Y=class extends w{constructor(e,t,s){super(e,t),this.expressions=s}visit(e,t=null){return e.visitLiteralArray(this,t)}},ee=class extends w{constructor(e,t,s,n){super(e,t),this.keys=s,this.values=n}visit(e,t=null){return e.visitLiteralMap(this,t)}},Ce=class extends w{constructor(e,t,s,n){super(e,t),this.strings=s,this.expressions=n}visit(e,t=null){return e.visitInterpolation(this,t)}},N=class extends w{constructor(e,t,s,n,i){super(e,t),this.operation=s,this.left=n,this.right=i}visit(e,t=null){return e.visitBinary(this,t)}},L=class extends N{constructor(e,t,s,n,i,a,h){super(e,t,i,a,h),this.operator=s,this.expr=n,this.left=null,this.right=null,this.operation=null}static createMinus(e,t,s){return new L(e,t,"-",s,"-",new O(e,t,0),s)}static createPlus(e,t,s){return new L(e,t,"+",s,"-",s,new O(e,t,0))}visit(e,t=null){return e.visitUnary!==void 0?e.visitUnary(this,t):e.visitBinary(this,t)}},te=class extends w{constructor(e,t,s){super(e,t),this.expression=s}visit(e,t=null){return e.visitPrefixNot(this,t)}},re=class extends w{constructor(e,t,s){super(e,t),this.expression=s}visit(e,t=null){return e.visitNonNullAssert(this,t)}},se=class extends w{constructor(e,t,s,n,i){super(e,t),this.receiver=s,this.args=n,this.argumentSpan=i}visit(e,t=null){return e.visitCall(this,t)}},ne=class extends w{constructor(e,t,s,n,i){super(e,t),this.receiver=s,this.args=n,this.argumentSpan=i}visit(e,t=null){return e.visitSafeCall(this,t)}},b=class{constructor(e,t){this.start=e,this.end=t}},B=class extends w{constructor(e,t,s,n,i){super(new K(0,t===null?0:t.length),new b(n,t===null?n:n+t.length)),this.ast=e,this.source=t,this.location=s,this.errors=i}visit(e,t=null){return e.visitASTWithSource?e.visitASTWithSource(this,t):this.ast.visit(e,t)}toString(){return`${this.source} in ${this.location}`}},F=class{constructor(e,t,s){this.sourceSpan=e,this.key=t,this.value=s}},ie=class{constructor(e,t,s){this.sourceSpan=e,this.key=t,this.value=s}},Oe=class{visit(e,t){e.visit(this,t)}visitUnary(e,t){this.visit(e.expr,t)}visitBinary(e,t){this.visit(e.left,t),this.visit(e.right,t)}visitChain(e,t){this.visitAll(e.expressions,t)}visitConditional(e,t){this.visit(e.condition,t),this.visit(e.trueExp,t),this.visit(e.falseExp,t)}visitPipe(e,t){this.visit(e.exp,t),this.visitAll(e.args,t)}visitImplicitReceiver(e,t){}visitThisReceiver(e,t){}visitInterpolation(e,t){this.visitAll(e.expressions,t)}visitKeyedRead(e,t){this.visit(e.receiver,t),this.visit(e.key,t)}visitKeyedWrite(e,t){this.visit(e.receiver,t),this.visit(e.key,t),this.visit(e.value,t)}visitLiteralArray(e,t){this.visitAll(e.expressions,t)}visitLiteralMap(e,t){this.visitAll(e.values,t)}visitLiteralPrimitive(e,t){}visitPrefixNot(e,t){this.visit(e.expression,t)}visitNonNullAssert(e,t){this.visit(e.expression,t)}visitPropertyRead(e,t){this.visit(e.receiver,t)}visitPropertyWrite(e,t){this.visit(e.receiver,t),this.visit(e.value,t)}visitSafePropertyRead(e,t){this.visit(e.receiver,t)}visitSafeKeyedRead(e,t){this.visit(e.receiver,t),this.visit(e.key,t)}visitCall(e,t){this.visit(e.receiver,t),this.visitAll(e.args,t)}visitSafeCall(e,t){this.visit(e.receiver,t),this.visitAll(e.args,t)}visitAll(e,t){for(let s of e)this.visit(s,t)}};(function(r){r[r.DEFAULT=0]="DEFAULT",r[r.LITERAL_ATTR=1]="LITERAL_ATTR",r[r.ANIMATION=2]="ANIMATION"})(ft||(ft={}))});function dt(r){return r>=9&&r<=32||r==160}function _(r){return 48<=r&&r<=57}function vt(r){return r>=97&&r<=122||r>=65&&r<=90}function Ge(r){return r===39||r===34||r===96}var Ve=$(()=>{g();});function yt(r,e,t){return new P(r,e,v.Character,t,String.fromCharCode(t))}function Ir(r,e,t){return new P(r,e,v.Identifier,0,t)}function Pr(r,e,t){return new P(r,e,v.PrivateIdentifier,0,t)}function Rr(r,e,t){return new P(r,e,v.Keyword,0,t)}function Qe(r,e,t){return new P(r,e,v.Operator,0,t)}function Lr(r,e,t){return new P(r,e,v.String,0,t)}function br(r,e,t){return new P(r,e,v.Number,t,"")}function Br(r,e,t){return new P(r,e,v.Error,0,t)}function Et(r){return 97<=r&&r<=122||65<=r&&r<=90||r==95||r==36}function At(r){return vt(r)||_(r)||r==95||r==36}function Kr(r){return r==101||r==69}function Tr(r){return r==45||r==43}function _r(r){switch(r){case 110:return 10;case 102:return 12;case 114:return 13;case 116:return 9;case 118:return 11;default:return r}}function Mr(r){let e=parseInt(r);if(isNaN(e))throw new Error("Invalid integer literal when parsing "+r);return e}var v,kr,fe,P,Pe,je,ze=$(()=>{g();Ve();(function(r){r[r.Character=0]="Character",r[r.Identifier=1]="Identifier",r[r.PrivateIdentifier=2]="PrivateIdentifier",r[r.Keyword=3]="Keyword",r[r.String=4]="String",r[r.Operator=5]="Operator",r[r.Number=6]="Number",r[r.Error=7]="Error"})(v||(v={}));kr=["var","let","as","null","undefined","true","false","if","else","this"],fe=class{tokenize(e){let t=new je(e),s=[],n=t.scanToken();for(;n!=null;)s.push(n),n=t.scanToken();return s}},P=class{constructor(e,t,s,n,i){this.index=e,this.end=t,this.type=s,this.numValue=n,this.strValue=i}isCharacter(e){return this.type==v.Character&&this.numValue==e}isNumber(){return this.type==v.Number}isString(){return this.type==v.String}isOperator(e){return this.type==v.Operator&&this.strValue==e}isIdentifier(){return this.type==v.Identifier}isPrivateIdentifier(){return this.type==v.PrivateIdentifier}isKeyword(){return this.type==v.Keyword}isKeywordLet(){return this.type==v.Keyword&&this.strValue=="let"}isKeywordAs(){return this.type==v.Keyword&&this.strValue=="as"}isKeywordNull(){return this.type==v.Keyword&&this.strValue=="null"}isKeywordUndefined(){return this.type==v.Keyword&&this.strValue=="undefined"}isKeywordTrue(){return this.type==v.Keyword&&this.strValue=="true"}isKeywordFalse(){return this.type==v.Keyword&&this.strValue=="false"}isKeywordThis(){return this.type==v.Keyword&&this.strValue=="this"}isError(){return this.type==v.Error}toNumber(){return this.type==v.Number?this.numValue:-1}toString(){switch(this.type){case v.Character:case v.Identifier:case v.Keyword:case v.Operator:case v.PrivateIdentifier:case v.String:case v.Error:return this.strValue;case v.Number:return this.numValue.toString();default:return null}}};Pe=new P(-1,-1,v.Character,0,""),je=class{constructor(e){this.input=e,this.peek=0,this.index=-1,this.length=e.length,this.advance()}advance(){this.peek=++this.index>=this.length?0:this.input.charCodeAt(this.index)}scanToken(){let e=this.input,t=this.length,s=this.peek,n=this.index;for(;s<=32;)if(++n>=t){s=0;break}else s=e.charCodeAt(n);if(this.peek=s,this.index=n,n>=t)return null;if(Et(s))return this.scanIdentifier();if(_(s))return this.scanNumber(n);let i=n;switch(s){case 46:return this.advance(),_(this.peek)?this.scanNumber(i):yt(i,this.index,46);case 40:case 41:case 123:case 125:case 91:case 93:case 44:case 58:case 59:return this.scanCharacter(i,s);case 39:case 34:return this.scanString();case 35:return this.scanPrivateIdentifier();case 43:case 45:case 42:case 47:case 37:case 94:return this.scanOperator(i,String.fromCharCode(s));case 63:return this.scanQuestion(i);case 60:case 62:return this.scanComplexOperator(i,String.fromCharCode(s),61,"=");case 33:case 61:return this.scanComplexOperator(i,String.fromCharCode(s),61,"=",61,"=");case 38:return this.scanComplexOperator(i,"&",38,"&");case 124:return this.scanComplexOperator(i,"|",124,"|");case 160:for(;dt(this.peek);)this.advance();return this.scanToken()}return this.advance(),this.error(`Unexpected character [${String.fromCharCode(s)}]`,0)}scanCharacter(e,t){return this.advance(),yt(e,this.index,t)}scanOperator(e,t){return this.advance(),Qe(e,this.index,t)}scanComplexOperator(e,t,s,n,i,a){this.advance();let h=t;return this.peek==s&&(this.advance(),h+=n),i!=null&&this.peek==i&&(this.advance(),h+=a),Qe(e,this.index,h)}scanIdentifier(){let e=this.index;for(this.advance();At(this.peek);)this.advance();let t=this.input.substring(e,this.index);return kr.indexOf(t)>-1?Rr(e,this.index,t):Ir(e,this.index,t)}scanPrivateIdentifier(){let e=this.index;if(this.advance(),!Et(this.peek))return this.error("Invalid character [#]",-1);for(;At(this.peek);)this.advance();let t=this.input.substring(e,this.index);return Pr(e,this.index,t)}scanNumber(e){let t=this.index===e,s=!1;for(this.advance();;){if(!_(this.peek))if(this.peek===95){if(!_(this.input.charCodeAt(this.index-1))||!_(this.input.charCodeAt(this.index+1)))return this.error("Invalid numeric separator",0);s=!0}else if(this.peek===46)t=!1;else if(Kr(this.peek)){if(this.advance(),Tr(this.peek)&&this.advance(),!_(this.peek))return this.error("Invalid exponent",-1);t=!1}else break;this.advance()}let n=this.input.substring(e,this.index);s&&(n=n.replace(/_/g,""));let i=t?Mr(n):parseFloat(n);return br(e,this.index,i)}scanString(){let e=this.index,t=this.peek;this.advance();let s="",n=this.index,i=this.input;for(;this.peek!=t;)if(this.peek==92){s+=i.substring(n,this.index),this.advance();let h;if(this.peek=this.peek,this.peek==117){let d=i.substring(this.index+1,this.index+5);if(/^[0-9a-f]+$/i.test(d))h=parseInt(d,16);else return this.error(`Invalid unicode escape [\\u${d}]`,0);for(let f=0;f<5;f++)this.advance()}else h=_r(this.peek),this.advance();s+=String.fromCharCode(h),n=this.index}else{if(this.peek==0)return this.error("Unterminated quote",0);this.advance()}let a=i.substring(n,this.index);return this.advance(),Lr(e,this.index,s+a)}scanQuestion(e){this.advance();let t="?";return(this.peek===63||this.peek===46)&&(t+=this.peek===46?".":"?",this.advance()),Qe(e,this.index,t)}error(e,t){let s=this.index+t;return Br(s,this.index,`Lexer Error: ${e} at column ${s} in expression [${this.input}]`)}}});function Nt(r,e){if(e!=null&&!(Array.isArray(e)&&e.length==2))throw new Error(`Expected '${r}' to be an array, [start, end].`);if(e!=null){let t=e[0],s=e[1];Fr.forEach(n=>{if(n.test(t)||n.test(s))throw new Error(`['${t}', '${s}'] contains unusable interpolation symbol.`)})}}var Fr,kt=$(()=>{g();Fr=[/^\s*$/,/[<>]/,/^[{}]$/,/&(#|[a-z])/i,/^\/\//]});var me,G,It=$(()=>{g();kt();me=class{constructor(e,t){this.start=e,this.end=t}static fromArray(e){return e?(Nt("interpolation",e),new me(e[0],e[1])):G}},G=new me("{{","}}")});function Ur(r){let e=new Map,t=0,s=0,n=0;for(;n<r.length;){let i=r[n];if(i.type===9){let[a,h]=i.parts;t+=h.length,s+=a.length}else{let a=i.parts.reduce((h,d)=>h+d.length,0);s+=a,t+=a}e.set(s,t),n++}return e}var qe,Xe,Se,pe,V,Ze,Pt=$(()=>{g();Ve();It();De();ze();qe=class{constructor(e,t,s){this.strings=e,this.expressions=t,this.offsets=s}},Xe=class{constructor(e,t,s){this.templateBindings=e,this.warnings=t,this.errors=s}},Se=class{constructor(e){this._lexer=e,this.errors=[]}parseAction(e,t,s,n,i=G){this._checkNoInterpolation(e,s,i);let a=this._stripComments(e),h=this._lexer.tokenize(a),d=1;t&&(d|=2);let f=new V(e,s,n,h,d,this.errors,0).parseChain();return new B(f,e,s,n,this.errors)}parseBinding(e,t,s,n=G){let i=this._parseBindingAst(e,t,s,n);return new B(i,e,t,s,this.errors)}checkSimpleExpression(e){let t=new Ze;return e.visit(t),t.errors}parseSimpleBinding(e,t,s,n=G){let i=this._parseBindingAst(e,t,s,n),a=this.checkSimpleExpression(i);return a.length>0&&this._reportError(`Host binding expression cannot contain ${a.join(" ")}`,e,t),new B(i,e,t,s,this.errors)}_reportError(e,t,s,n){this.errors.push(new W(e,t,s,n))}_parseBindingAst(e,t,s,n){this._checkNoInterpolation(e,t,n);let i=this._stripComments(e),a=this._lexer.tokenize(i);return new V(e,t,s,a,0,this.errors,0).parseChain()}parseTemplateBindings(e,t,s,n,i){let a=this._lexer.tokenize(t);return new V(t,s,i,a,0,this.errors,0).parseTemplateBindings({source:e,span:new b(n,n+e.length)})}parseInterpolation(e,t,s,n,i=G){let{strings:a,expressions:h,offsets:d}=this.splitInterpolation(e,t,n,i);if(h.length===0)return null;let f=[];for(let S=0;S<h.length;++S){let R=h[S].text,k=this._stripComments(R),E=this._lexer.tokenize(k),y=new V(e,t,s,E,0,this.errors,d[S]).parseChain();f.push(y)}return this.createInterpolationAst(a.map(S=>S.text),f,e,t,s)}parseInterpolationExpression(e,t,s){let n=this._stripComments(e),i=this._lexer.tokenize(n),a=new V(e,t,s,i,0,this.errors,0).parseChain(),h=["",""];return this.createInterpolationAst(h,[a],e,t,s)}createInterpolationAst(e,t,s,n,i){let a=new K(0,s.length),h=new Ce(a,a.toAbsolute(i),e,t);return new B(h,s,n,i,this.errors)}splitInterpolation(e,t,s,n=G){var y;let i=[],a=[],h=[],d=s?Ur(s):null,f=0,S=!1,R=!1,{start:k,end:E}=n;for(;f<e.length;)if(S){let o=f,c=o+k.length,x=this._getInterpolationEndIndex(e,E,c);if(x===-1){S=!1,R=!0;break}let u=x+E.length,l=e.substring(c,x);l.trim().length===0&&this._reportError("Blank expressions are not allowed in interpolated strings",e,`at column ${f} in`,t),a.push({text:l,start:o,end:u});let p=((y=d==null?void 0:d.get(o))!=null?y:o)+k.length;h.push(p),f=u,S=!1}else{let o=f;f=e.indexOf(k,f),f===-1&&(f=e.length);let c=e.substring(o,f);i.push({text:c,start:o,end:f}),S=!0}if(!S)if(R){let o=i[i.length-1];o.text+=e.substring(f),o.end=e.length}else i.push({text:e.substring(f),start:f,end:e.length});return new qe(i,a,h)}wrapLiteralPrimitive(e,t,s){let n=new K(0,e==null?0:e.length);return new B(new O(n,n.toAbsolute(s),e),e,t,s,this.errors)}_stripComments(e){let t=this._commentStart(e);return t!=null?e.substring(0,t):e}_commentStart(e){let t=null;for(let s=0;s<e.length-1;s++){let n=e.charCodeAt(s),i=e.charCodeAt(s+1);if(n===47&&i==47&&t==null)return s;t===n?t=null:t==null&&Ge(n)&&(t=n)}return null}_checkNoInterpolation(e,t,{start:s,end:n}){let i=-1,a=-1;for(let h of this._forEachUnquotedChar(e,0))if(i===-1)e.startsWith(s)&&(i=h);else if(a=this._getInterpolationEndIndex(e,n,h),a>-1)break;i>-1&&a>-1&&this._reportError(`Got interpolation (${s}${n}) where expression was expected`,e,`at column ${i} in`,t)}_getInterpolationEndIndex(e,t,s){for(let n of this._forEachUnquotedChar(e,s)){if(e.startsWith(t,n))return n;if(e.startsWith("//",n))return e.indexOf(t,n)}return-1}*_forEachUnquotedChar(e,t){let s=null,n=0;for(let i=t;i<e.length;i++){let a=e[i];Ge(e.charCodeAt(i))&&(s===null||s===a)&&n%2===0?s=s===null?a:null:s===null&&(yield i),n=a==="\\"?n+1:0}}};(function(r){r[r.None=0]="None",r[r.Writable=1]="Writable"})(pe||(pe={}));V=class{constructor(e,t,s,n,i,a,h){this.input=e,this.location=t,this.absoluteOffset=s,this.tokens=n,this.parseFlags=i,this.errors=a,this.offset=h,this.rparensExpected=0,this.rbracketsExpected=0,this.rbracesExpected=0,this.context=pe.None,this.sourceSpanCache=new Map,this.index=0}peek(e){let t=this.index+e;return t<this.tokens.length?this.tokens[t]:Pe}get next(){return this.peek(0)}get atEOF(){return this.index>=this.tokens.length}get inputIndex(){return this.atEOF?this.currentEndIndex:this.next.index+this.offset}get currentEndIndex(){return this.index>0?this.peek(-1).end+this.offset:this.tokens.length===0?this.input.length+this.offset:this.next.index+this.offset}get currentAbsoluteOffset(){return this.absoluteOffset+this.inputIndex}span(e,t){let s=this.currentEndIndex;if(t!==void 0&&t>this.currentEndIndex&&(s=t),e>s){let n=s;s=e,e=n}return new K(e,s)}sourceSpan(e,t){let s=`${e}@${this.inputIndex}:${t}`;return this.sourceSpanCache.has(s)||this.sourceSpanCache.set(s,this.span(e,t).toAbsolute(this.absoluteOffset)),this.sourceSpanCache.get(s)}advance(){this.index++}withContext(e,t){this.context|=e;let s=t();return this.context^=e,s}consumeOptionalCharacter(e){return this.next.isCharacter(e)?(this.advance(),!0):!1}peekKeywordLet(){return this.next.isKeywordLet()}peekKeywordAs(){return this.next.isKeywordAs()}expectCharacter(e){this.consumeOptionalCharacter(e)||this.error(`Missing expected ${String.fromCharCode(e)}`)}consumeOptionalOperator(e){return this.next.isOperator(e)?(this.advance(),!0):!1}expectOperator(e){this.consumeOptionalOperator(e)||this.error(`Missing expected operator ${e}`)}prettyPrintToken(e){return e===Pe?"end of input":`token ${e}`}expectIdentifierOrKeyword(){let e=this.next;return!e.isIdentifier()&&!e.isKeyword()?(e.isPrivateIdentifier()?this._reportErrorForPrivateIdentifier(e,"expected identifier or keyword"):this.error(`Unexpected ${this.prettyPrintToken(e)}, expected identifier or keyword`),null):(this.advance(),e.toString())}expectIdentifierOrKeywordOrString(){let e=this.next;return!e.isIdentifier()&&!e.isKeyword()&&!e.isString()?(e.isPrivateIdentifier()?this._reportErrorForPrivateIdentifier(e,"expected identifier, keyword or string"):this.error(`Unexpected ${this.prettyPrintToken(e)}, expected identifier, keyword, or string`),""):(this.advance(),e.toString())}parseChain(){let e=[],t=this.inputIndex;for(;this.index<this.tokens.length;){let s=this.parsePipe();if(e.push(s),this.consumeOptionalCharacter(59))for(this.parseFlags&1||this.error("Binding expression cannot contain chained expression");this.consumeOptionalCharacter(59););else if(this.index<this.tokens.length){let n=this.index;if(this.error(`Unexpected token '${this.next}'`),this.index===n)break}}if(e.length===0){let s=this.offset,n=this.offset+this.input.length;return new C(this.span(s,n),this.sourceSpan(s,n))}return e.length==1?e[0]:new j(this.span(t),this.sourceSpan(t),e)}parsePipe(){let e=this.inputIndex,t=this.parseExpression();if(this.consumeOptionalOperator("|")){this.parseFlags&1&&this.error("Cannot have a pipe in an action expression");do{let s=this.inputIndex,n=this.expectIdentifierOrKeyword(),i,a;n!==null?i=this.sourceSpan(s):(n="",a=this.next.index!==-1?this.next.index:this.input.length+this.offset,i=new K(a,a).toAbsolute(this.absoluteOffset));let h=[];for(;this.consumeOptionalCharacter(58);)h.push(this.parseExpression());t=new J(this.span(e),this.sourceSpan(e,a),t,n,h,i)}while(this.consumeOptionalOperator("|"))}return t}parseExpression(){return this.parseConditional()}parseConditional(){let e=this.inputIndex,t=this.parseLogicalOr();if(this.consumeOptionalOperator("?")){let s=this.parsePipe(),n;if(this.consumeOptionalCharacter(58))n=this.parsePipe();else{let i=this.inputIndex,a=this.input.substring(e,i);this.error(`Conditional expression ${a} requires all 3 expressions`),n=new C(this.span(e),this.sourceSpan(e))}return new H(this.span(e),this.sourceSpan(e),t,s,n)}else return t}parseLogicalOr(){let e=this.inputIndex,t=this.parseLogicalAnd();for(;this.consumeOptionalOperator("||");){let s=this.parseLogicalAnd();t=new N(this.span(e),this.sourceSpan(e),"||",t,s)}return t}parseLogicalAnd(){let e=this.inputIndex,t=this.parseNullishCoalescing();for(;this.consumeOptionalOperator("&&");){let s=this.parseNullishCoalescing();t=new N(this.span(e),this.sourceSpan(e),"&&",t,s)}return t}parseNullishCoalescing(){let e=this.inputIndex,t=this.parseEquality();for(;this.consumeOptionalOperator("??");){let s=this.parseEquality();t=new N(this.span(e),this.sourceSpan(e),"??",t,s)}return t}parseEquality(){let e=this.inputIndex,t=this.parseRelational();for(;this.next.type==v.Operator;){let s=this.next.strValue;switch(s){case"==":case"===":case"!=":case"!==":this.advance();let n=this.parseRelational();t=new N(this.span(e),this.sourceSpan(e),s,t,n);continue}break}return t}parseRelational(){let e=this.inputIndex,t=this.parseAdditive();for(;this.next.type==v.Operator;){let s=this.next.strValue;switch(s){case"<":case">":case"<=":case">=":this.advance();let n=this.parseAdditive();t=new N(this.span(e),this.sourceSpan(e),s,t,n);continue}break}return t}parseAdditive(){let e=this.inputIndex,t=this.parseMultiplicative();for(;this.next.type==v.Operator;){let s=this.next.strValue;switch(s){case"+":case"-":this.advance();let n=this.parseMultiplicative();t=new N(this.span(e),this.sourceSpan(e),s,t,n);continue}break}return t}parseMultiplicative(){let e=this.inputIndex,t=this.parsePrefix();for(;this.next.type==v.Operator;){let s=this.next.strValue;switch(s){case"*":case"%":case"/":this.advance();let n=this.parsePrefix();t=new N(this.span(e),this.sourceSpan(e),s,t,n);continue}break}return t}parsePrefix(){if(this.next.type==v.Operator){let e=this.inputIndex,t=this.next.strValue,s;switch(t){case"+":return this.advance(),s=this.parsePrefix(),L.createPlus(this.span(e),this.sourceSpan(e),s);case"-":return this.advance(),s=this.parsePrefix(),L.createMinus(this.span(e),this.sourceSpan(e),s);case"!":return this.advance(),s=this.parsePrefix(),new te(this.span(e),this.sourceSpan(e),s)}}return this.parseCallChain()}parseCallChain(){let e=this.inputIndex,t=this.parsePrimary();for(;;)if(this.consumeOptionalCharacter(46))t=this.parseAccessMember(t,e,!1);else if(this.consumeOptionalOperator("?."))this.consumeOptionalCharacter(40)?t=this.parseCall(t,e,!0):t=this.consumeOptionalCharacter(91)?this.parseKeyedReadOrWrite(t,e,!0):this.parseAccessMember(t,e,!0);else if(this.consumeOptionalCharacter(91))t=this.parseKeyedReadOrWrite(t,e,!1);else if(this.consumeOptionalCharacter(40))t=this.parseCall(t,e,!1);else if(this.consumeOptionalOperator("!"))t=new re(this.span(e),this.sourceSpan(e),t);else return t}parsePrimary(){let e=this.inputIndex;if(this.consumeOptionalCharacter(40)){this.rparensExpected++;let t=this.parsePipe();return this.rparensExpected--,this.expectCharacter(41),t}else{if(this.next.isKeywordNull())return this.advance(),new O(this.span(e),this.sourceSpan(e),null);if(this.next.isKeywordUndefined())return this.advance(),new O(this.span(e),this.sourceSpan(e),void 0);if(this.next.isKeywordTrue())return this.advance(),new O(this.span(e),this.sourceSpan(e),!0);if(this.next.isKeywordFalse())return this.advance(),new O(this.span(e),this.sourceSpan(e),!1);if(this.next.isKeywordThis())return this.advance(),new Ae(this.span(e),this.sourceSpan(e));if(this.consumeOptionalCharacter(91)){this.rbracketsExpected++;let t=this.parseExpressionList(93);return this.rbracketsExpected--,this.expectCharacter(93),new Y(this.span(e),this.sourceSpan(e),t)}else{if(this.next.isCharacter(123))return this.parseLiteralMap();if(this.next.isIdentifier())return this.parseAccessMember(new T(this.span(e),this.sourceSpan(e)),e,!1);if(this.next.isNumber()){let t=this.next.toNumber();return this.advance(),new O(this.span(e),this.sourceSpan(e),t)}else if(this.next.isString()){let t=this.next.toString();return this.advance(),new O(this.span(e),this.sourceSpan(e),t)}else return this.next.isPrivateIdentifier()?(this._reportErrorForPrivateIdentifier(this.next,null),new C(this.span(e),this.sourceSpan(e))):this.index>=this.tokens.length?(this.error(`Unexpected end of expression: ${this.input}`),new C(this.span(e),this.sourceSpan(e))):(this.error(`Unexpected token ${this.next}`),new C(this.span(e),this.sourceSpan(e)))}}}parseExpressionList(e){let t=[];do if(!this.next.isCharacter(e))t.push(this.parsePipe());else break;while(this.consumeOptionalCharacter(44));return t}parseLiteralMap(){let e=[],t=[],s=this.inputIndex;if(this.expectCharacter(123),!this.consumeOptionalCharacter(125)){this.rbracesExpected++;do{let n=this.inputIndex,i=this.next.isString(),a=this.expectIdentifierOrKeywordOrString();if(e.push({key:a,quoted:i}),i)this.expectCharacter(58),t.push(this.parsePipe());else if(this.consumeOptionalCharacter(58))t.push(this.parsePipe());else{let h=this.span(n),d=this.sourceSpan(n);t.push(new M(h,d,d,new T(h,d),a))}}while(this.consumeOptionalCharacter(44));this.rbracesExpected--,this.expectCharacter(125)}return new ee(this.span(s),this.sourceSpan(s),e,t)}parseAccessMember(e,t,s){let n=this.inputIndex,i=this.withContext(pe.Writable,()=>{var f;let d=(f=this.expectIdentifierOrKeyword())!=null?f:"";return d.length===0&&this.error("Expected identifier for property access",e.span.end),d}),a=this.sourceSpan(n),h;if(s)this.consumeOptionalAssignment()?(this.error("The '?.' operator cannot be used in the assignment"),h=new C(this.span(t),this.sourceSpan(t))):h=new q(this.span(t),this.sourceSpan(t),a,e,i);else if(this.consumeOptionalAssignment()){if(!(this.parseFlags&1))return this.error("Bindings cannot contain assignments"),new C(this.span(t),this.sourceSpan(t));let d=this.parseConditional();h=new z(this.span(t),this.sourceSpan(t),a,e,i,d)}else h=new M(this.span(t),this.sourceSpan(t),a,e,i);return h}parseCall(e,t,s){let n=this.inputIndex;this.rparensExpected++;let i=this.parseCallArguments(),a=this.span(n,this.inputIndex).toAbsolute(this.absoluteOffset);this.expectCharacter(41),this.rparensExpected--;let h=this.span(t),d=this.sourceSpan(t);return s?new ne(h,d,e,i,a):new se(h,d,e,i,a)}consumeOptionalAssignment(){return this.parseFlags&2&&this.next.isOperator("!")&&this.peek(1).isOperator("=")?(this.advance(),this.advance(),!0):this.consumeOptionalOperator("=")}parseCallArguments(){if(this.next.isCharacter(41))return[];let e=[];do e.push(this.parsePipe());while(this.consumeOptionalCharacter(44));return e}expectTemplateBindingKey(){let e="",t=!1,s=this.currentAbsoluteOffset;do e+=this.expectIdentifierOrKeywordOrString(),t=this.consumeOptionalOperator("-"),t&&(e+="-");while(t);return{source:e,span:new b(s,s+e.length)}}parseTemplateBindings(e){let t=[];for(t.push(...this.parseDirectiveKeywordBindings(e));this.index<this.tokens.length;){let s=this.parseLetBinding();if(s)t.push(s);else{let n=this.expectTemplateBindingKey(),i=this.parseAsBinding(n);i?t.push(i):(n.source=e.source+n.source.charAt(0).toUpperCase()+n.source.substring(1),t.push(...this.parseDirectiveKeywordBindings(n)))}this.consumeStatementTerminator()}return new Xe(t,[],this.errors)}parseKeyedReadOrWrite(e,t,s){return this.withContext(pe.Writable,()=>{this.rbracketsExpected++;let n=this.parsePipe();if(n instanceof C&&this.error("Key access cannot be empty"),this.rbracketsExpected--,this.expectCharacter(93),this.consumeOptionalOperator("="))if(s)this.error("The '?.' operator cannot be used in the assignment");else{let i=this.parseConditional();return new Z(this.span(t),this.sourceSpan(t),e,n,i)}else return s?new $e(this.span(t),this.sourceSpan(t),e,n):new X(this.span(t),this.sourceSpan(t),e,n);return new C(this.span(t),this.sourceSpan(t))})}parseDirectiveKeywordBindings(e){let t=[];this.consumeOptionalCharacter(58);let s=this.getDirectiveBoundTarget(),n=this.currentAbsoluteOffset,i=this.parseAsBinding(e);i||(this.consumeStatementTerminator(),n=this.currentAbsoluteOffset);let a=new b(e.span.start,n);return t.push(new ie(a,e,s)),i&&t.push(i),t}getDirectiveBoundTarget(){if(this.next===Pe||this.peekKeywordAs()||this.peekKeywordLet())return null;let e=this.parsePipe(),{start:t,end:s}=e.span,n=this.input.substring(t,s);return new B(e,n,this.location,this.absoluteOffset+t,this.errors)}parseAsBinding(e){if(!this.peekKeywordAs())return null;this.advance();let t=this.expectTemplateBindingKey();this.consumeStatementTerminator();let s=new b(e.span.start,this.currentAbsoluteOffset);return new F(s,t,e)}parseLetBinding(){if(!this.peekKeywordLet())return null;let e=this.currentAbsoluteOffset;this.advance();let t=this.expectTemplateBindingKey(),s=null;this.consumeOptionalOperator("=")&&(s=this.expectTemplateBindingKey()),this.consumeStatementTerminator();let n=new b(e,this.currentAbsoluteOffset);return new F(n,t,s)}consumeStatementTerminator(){this.consumeOptionalCharacter(59)||this.consumeOptionalCharacter(44)}error(e,t=null){this.errors.push(new W(e,this.input,this.locationText(t),this.location)),this.skip()}locationText(e=null){return e==null&&(e=this.index),e<this.tokens.length?`at column ${this.tokens[e].index+1} in`:"at the end of the expression"}_reportErrorForPrivateIdentifier(e,t){let s=`Private identifiers are not supported. Unexpected private identifier: ${e}`;t!==null&&(s+=`, ${t}`),this.error(s)}skip(){let e=this.next;for(;this.index<this.tokens.length&&!e.isCharacter(59)&&!e.isOperator("|")&&(this.rparensExpected<=0||!e.isCharacter(41))&&(this.rbracesExpected<=0||!e.isCharacter(125))&&(this.rbracketsExpected<=0||!e.isCharacter(93))&&(!(this.context&pe.Writable)||!e.isOperator("="));)this.next.isError()&&this.errors.push(new W(this.next.toString(),this.input,this.locationText(),this.location)),this.advance(),e=this.next}},Ze=class extends Oe{constructor(){super(...arguments),this.errors=[]}visitPipe(){this.errors.push("pipes")}}});var Re=$(()=>{g();De();ze();Pt()});function tt(){return new Se(new fe)}function rt(r,e){let t=tt(),{astInput:s,comments:n}=Mt(r,t),{ast:i,errors:a}=e(s,t);return st(a),{ast:i,comments:n}}function bt(r){return rt(r,(e,t)=>t.parseBinding(e,...Le))}function Bt(r){return rt(r,(e,t)=>t.parseSimpleBinding(e,...Le))}function Kt(r){return rt(r,(e,t)=>t.parseAction(e,!1,...Le))}function Tt(r){let e=tt(),{templateBindings:t,errors:s}=e.parseTemplateBindings(et,r,Lt,Je,Je);return st(s),t}function _t(r){let e=tt(),{astInput:t,comments:s}=Mt(r,e),n="{{",i="}}",{ast:a,errors:h}=e.parseInterpolation(n+t+i,...Le,null);st(h);let d=a.expressions[0],f=new Set;return Ye(d,S=>{f.has(S)||(S.start-=n.length,S.end-=n.length,f.add(S))}),{ast:d,comments:s}}function Ye(r,e){if(!(!r||typeof r!="object")){if(Array.isArray(r))return r.forEach(t=>Ye(t,e));for(let t of Object.keys(r)){let s=r[t];t==="span"?e(s):Ye(s,e)}}}function st(r){if(r.length!==0){let[{message:e}]=r;throw new SyntaxError(e.replace(/^Parser Error: | at column \d+ in [^]*$/g,""))}}function Mt(r,e){let t=e._commentStart(r);return t===null?{astInput:r,comments:[]}:{astInput:r.slice(0,t),comments:[{type:"Comment",value:r.slice(t+2),span:{start:t,end:r.length}}]}}function Ft(r){return r instanceof L?"Unary":r instanceof N?"Binary":r instanceof J?"BindingPipe":r instanceof se?"Call":r instanceof j?"Chain":r instanceof H?"Conditional":r instanceof C?"EmptyExpr":r instanceof T?"ImplicitReceiver":r instanceof X?"KeyedRead":r instanceof Z?"KeyedWrite":r instanceof Y?"LiteralArray":r instanceof ee?"LiteralMap":r instanceof O?"LiteralPrimitive":r instanceof re?"NonNullAssert":r instanceof te?"PrefixNot":r instanceof M?"PropertyRead":r instanceof z?"PropertyWrite":r instanceof ne?"SafeCall":r instanceof q?"SafePropertyRead":r.type}function Rt({start:r,end:e},t){let s=r,n=e;for(;n!==s&&/\s/.test(t[n-1]);)n--;for(;s!==n&&/\s/.test(t[s]);)s++;return{start:s,end:n}}function Gr({start:r,end:e},t){let s=r,n=e;for(;n!==t.length&&/\s/.test(t[n]);)n++;for(;s!==0&&/\s/.test(t[s-1]);)s--;return{start:s,end:n}}function Vr(r,e){return e[r.start-1]==="("&&e[r.end]===")"?{start:r.start-1,end:r.end+1}:r}function Ut(r,e,t){let s=0,n={start:r.start,end:r.end};for(;;){let i=Gr(n,e),a=Vr(i,e);if(i.start===a.start&&i.end===a.end)break;n.start=a.start,n.end=a.end,s++}return{hasParens:(t?s-1:s)!==0,outerSpan:Rt(t?{start:n.start+1,end:n.end-1}:n,e),innerSpan:Rt(r,e)}}function Dt(r,e,t){let s=e;for(;!r.test(t[s]);)if(--s<0)throw new Error(`Cannot find front char ${r} from index ${e} in ${JSON.stringify(t)}`);return s}function be(r,e,t){let s=e;for(;!r.test(t[s]);)if(++s>=t.length)throw new Error(`Cannot find back char ${r} from index ${e} in ${JSON.stringify(t)}`);return s}function Gt(r){return r.slice(0,1).toLowerCase()+r.slice(1)}function Vt(r){return r.length===0?void 0:r[r.length-1]}var Lt,et,Je,Le,Be=$(()=>{g();Re();Re();Lt="angular-estree-parser",et="NgEstreeParser",Je=0,Le=[Lt,Je]});function Ke(r,e,t=!1,s=!1){if(!t){let{start:h,end:d}=r;return{start:h,end:d,loc:{start:e.locator.locationForIndex(h),end:e.locator.locationForIndex(d)}}}let{outerSpan:n,innerSpan:i,hasParens:a}=Ut(r,e.text,s);return{start:i.start,end:i.end,loc:{start:e.locator.locationForIndex(i.start),end:e.locator.locationForIndex(i.end)},...a&&{extra:{parenthesized:!0,parenStart:n.start,parenEnd:n.end}}}}var ue,nt=$(()=>{g();Be();ue=(r,e,t=!1)=>{let s=Ft(r);switch(s){case"Unary":{let{operator:o,expr:c}=r,x=n(c);return a("UnaryExpression",{prefix:!0,argument:x,operator:o},r.span,{hasParentParens:t})}case"Binary":{let{left:o,operation:c,right:x}=r,u=n(o),l=n(x);return a(c==="&&"||c==="||"?"LogicalExpression":"BinaryExpression",{left:u,right:l,operator:c},{start:E(u),end:y(l)},{hasParentParens:t})}case"BindingPipe":{let{exp:o,name:c,args:x}=r,u=n(o),l=f(/\S/,f(/\|/,y(u))+1),m=a("Identifier",{name:c},{start:l,end:l+c.length}),p=x.map(n);return a("NGPipeExpression",{left:u,right:m,arguments:p},{start:E(u),end:y(p.length===0?m:Vt(p))},{hasParentParens:t})}case"Chain":{let{expressions:o}=r;return a("NGChainedExpression",{expressions:o.map(n)},r.span,{hasParentParens:t})}case"Comment":{let{value:o}=r;return a("CommentLine",{value:o},r.span,{processSpan:!1})}case"Conditional":{let{condition:o,trueExp:c,falseExp:x}=r,u=n(o),l=n(c),m=n(x);return a("ConditionalExpression",{test:u,consequent:l,alternate:m},{start:E(u),end:y(m)},{hasParentParens:t})}case"EmptyExpr":return a("NGEmptyExpression",{},r.span,{hasParentParens:t});case"ImplicitReceiver":return a("ThisExpression",{},r.span,{hasParentParens:t});case"KeyedRead":{let{key:o}=r,c=Object.prototype.hasOwnProperty.call(r,"receiver")?r.receiver:r.obj,x=n(o);return h(c,x,{computed:!0,optional:!1},{end:r.span.end,hasParentParens:t})}case"LiteralArray":{let{expressions:o}=r;return a("ArrayExpression",{elements:o.map(n)},r.span,{hasParentParens:t})}case"LiteralMap":{let{keys:o,values:c}=r,x=c.map(l=>n(l)),u=o.map(({key:l,quoted:m},p)=>{let I=x[p],le=E(I),it=y(I),Me=f(/\S/,p===0?r.span.start+1:f(/,/,y(x[p-1]))+1),zt=le===Me?it:d(/\S/,d(/:/,le-1)-1)+1,at={start:Me,end:zt},we=m?a("StringLiteral",{value:l},at):a("Identifier",{name:l},at),qt=we.end<we.start||Me===le;return a("ObjectProperty",{key:we,value:I,method:!1,shorthand:qt,computed:!1},{start:E(we),end:it})});return a("ObjectExpression",{properties:u},r.span,{hasParentParens:t})}case"LiteralPrimitive":{let{value:o}=r;switch(typeof o){case"boolean":return a("BooleanLiteral",{value:o},r.span,{hasParentParens:t});case"number":return a("NumericLiteral",{value:o},r.span,{hasParentParens:t});case"object":return a("NullLiteral",{},r.span,{hasParentParens:t});case"string":return a("StringLiteral",{value:o},r.span,{hasParentParens:t});case"undefined":return a("Identifier",{name:"undefined"},r.span,{hasParentParens:t});default:throw new Error(`Unexpected LiteralPrimitive value type ${typeof o}`)}}case"Call":case"SafeCall":{let o=s==="SafeCall",{receiver:c,args:x}=r,u=x.length===1?[i(x[0])]:x.map(n),l=n(c),m=R(l),p=o||m?"OptionalCallExpression":"CallExpression";return a(p,{callee:l,arguments:u,optional:p==="OptionalCallExpression"?o:void 0},{start:E(l),end:r.span.end},{hasParentParens:t})}case"NonNullAssert":{let{expression:o}=r,c=n(o);return a("TSNonNullExpression",{expression:c},{start:E(c),end:r.span.end},{hasParentParens:t})}case"PrefixNot":{let{expression:o}=r,c=n(o);return a("UnaryExpression",{prefix:!0,operator:"!",argument:c},{start:r.span.start,end:y(c)},{hasParentParens:t})}case"PropertyRead":case"SafePropertyRead":{let o=s==="SafePropertyRead",{receiver:c,name:x}=r,u=d(/\S/,r.span.end-1)+1,l=a("Identifier",{name:x},{start:u-x.length,end:u},S(c)?{hasParentParens:t}:{});return h(c,l,{computed:!1,optional:o},{hasParentParens:t})}case"KeyedWrite":{let{key:o,value:c}=r,x=Object.prototype.hasOwnProperty.call(r,"receiver")?r.receiver:r.obj,u=n(o),l=n(c),m=h(x,u,{computed:!0,optional:!1},{end:f(/\]/,y(u))+1});return a("AssignmentExpression",{left:m,operator:"=",right:l},{start:E(m),end:y(l)},{hasParentParens:t})}case"PropertyWrite":{let{receiver:o,name:c,value:x}=r,u=n(x),l=d(/\S/,d(/=/,E(u)-1)-1)+1,m=a("Identifier",{name:c},{start:l-c.length,end:l}),p=h(o,m,{computed:!1,optional:!1});return a("AssignmentExpression",{left:p,operator:"=",right:u},{start:E(p),end:y(u)},{hasParentParens:t})}default:throw new Error(`Unexpected node ${s}`)}function n(o){return ue(o,e)}function i(o){return ue(o,e,!0)}function a(o,c,x,{processSpan:u=!0,hasParentParens:l=!1}={}){let m={type:o,...Ke(x,e,u,l),...c};switch(o){case"Identifier":{let p=m;p.loc.identifierName=p.name;break}case"NumericLiteral":{let p=m;p.extra={...p.extra,raw:e.text.slice(p.start,p.end),rawValue:p.value};break}case"StringLiteral":{let p=m;p.extra={...p.extra,raw:e.text.slice(p.start,p.end),rawValue:p.value};break}case"ObjectProperty":{let p=m;p.shorthand&&(p.extra={...p.extra,shorthand:p.shorthand});break}}return m}function h(o,c,x,{end:u=y(c),hasParentParens:l=!1}={}){if(S(o)||o.span.start===c.start)return c;let m=n(o),p=R(m);return a(x.optional||p?"OptionalMemberExpression":"MemberExpression",{object:m,property:c,computed:x.computed,...x.optional?{optional:!0}:p?{optional:!1}:null},{start:E(m),end:u},{hasParentParens:l})}function d(o,c){return Dt(o,c,e.text)}function f(o,c){return be(o,c,e.text)}function S(o){return o.span.start>=o.span.end||/^\s+$/.test(e.text.slice(o.span.start,o.span.end))}function R(o){return(o.type==="OptionalCallExpression"||o.type==="OptionalMemberExpression")&&!k(o)}function k(o){return o.extra&&o.extra.parenthesized}function E(o){return k(o)?o.extra.parenStart:o.start}function y(o){return k(o)?o.extra.parenEnd:o.end}}});function Wt(r,e){r.forEach(E);let[t]=r,{key:s}=t,n=e.text.slice(t.sourceSpan.start,t.sourceSpan.end).trim().length===0?r.slice(1):r,i=[],a=null;for(let c=0;c<n.length;c++){let x=n[c];if(a&&R(a)&&k(x)&&x.value&&x.value.source===a.key.source){let u=f("NGMicrosyntaxKey",{name:x.key.source},x.key.span),l=(I,le)=>({...I,...Ke({start:I.start,end:le},e)}),m=I=>({...l(I,u.end),alias:u}),p=i.pop();if(p.type==="NGMicrosyntaxExpression")i.push(m(p));else if(p.type==="NGMicrosyntaxKeyedExpression"){let I=m(p.expression);i.push(l({...p,expression:I},I.end))}else throw new Error(`Unexpected type ${p.type}`)}else i.push(h(x,c));a=x}return f("NGMicrosyntax",{body:i},i.length===0?r[0].sourceSpan:{start:i[0].start,end:i[i.length-1].end});function h(c,x){if(R(c)){let{key:u,value:l}=c;return l?x===0?f("NGMicrosyntaxExpression",{expression:d(l.ast),alias:null},l.sourceSpan):f("NGMicrosyntaxKeyedExpression",{key:f("NGMicrosyntaxKey",{name:S(u.source)},u.span),expression:f("NGMicrosyntaxExpression",{expression:d(l.ast),alias:null},l.sourceSpan)},{start:u.span.start,end:l.sourceSpan.end}):f("NGMicrosyntaxKey",{name:S(u.source)},u.span)}else{let{key:u,sourceSpan:l}=c;if(/^let\s$/.test(e.text.slice(l.start,l.start+4))){let{value:p}=c;return f("NGMicrosyntaxLet",{key:f("NGMicrosyntaxKey",{name:u.source},u.span),value:p?f("NGMicrosyntaxKey",{name:p.source},p.span):null},{start:l.start,end:p?p.span.end:u.span.end})}else{let p=o(c);return f("NGMicrosyntaxAs",{key:f("NGMicrosyntaxKey",{name:p.source},p.span),alias:f("NGMicrosyntaxKey",{name:u.source},u.span)},{start:p.span.start,end:u.span.end})}}}function d(c){return ue(c,e)}function f(c,x,u,l=!0){return{type:c,...Ke(u,e,l),...x}}function S(c){return Gt(c.slice(s.source.length))}function R(c){return c instanceof ie}function k(c){return c instanceof F}function E(c){y(c.key.span),k(c)&&c.value&&y(c.value.span)}function y(c){if(e.text[c.start]!=='"'&&e.text[c.start]!=="'")return;let x=e.text[c.start],u=!1;for(let l=c.start+1;l<e.text.length;l++)switch(e.text[l]){case x:if(!u){c.end=l+1;return}default:u=!1;break;case"\\":u=!u;break}}function o(c){if(!c.value||c.value.source!==et)return c.value;let x=be(/\S/,c.sourceSpan.start,e.text);return{source:"$implicit",span:{start:x,end:x}}}}var Qt=$(()=>{g();Re();nt();Be()});var jt={};Zt(jt,{parseAction:()=>Hr,parseBinding:()=>Wr,parseInterpolation:()=>jr,parseSimpleBinding:()=>Qr,parseTemplateBindings:()=>zr});function Te(r,e){let{ast:t,comments:s}=e(r),n=new xe(r),i=h=>ue(h,n),a=i(t);return a.comments=s.map(h=>i(h)),a}function Wr(r){return Te(r,bt)}function Qr(r){return Te(r,Bt)}function jr(r){return Te(r,_t)}function Hr(r){return Te(r,Kt)}function zr(r){return Wt(Tt(r),new xe(r))}var Ht=$(()=>{g();xt();nt();Qt();Be()});g();g();g();function Jt(r){return Array.isArray(r)&&r.length>0}var ct=Jt;function Fe(r,e){let{ignoreDecorators:t}=e||{};if(!t){let s=r.declaration&&r.declaration.decorators||r.decorators;if(ct(s))return Fe(s[0])}return r.range?r.range[0]:r.start}function ht(r){return r.range?r.range[1]:r.end}function _e(r){return{astFormat:"estree",parse:async(t,s)=>{let n=await Promise.resolve().then(()=>(Ht(),jt)),i=r(t,n);return{type:"NGRoot",node:s.parser==="__ng_action"&&i.type!=="NGChainedExpression"?{...i,type:"NGChainedExpression",expressions:[i]}:i}},locStart:Fe,locEnd:ht}}var qr={parsers:{__ng_action:_e((r,e)=>e.parseAction(r)),__ng_binding:_e((r,e)=>e.parseBinding(r)),__ng_interpolation:_e((r,e)=>e.parseInterpolation(r)),__ng_directive:_e((r,e)=>e.parseTemplateBindings(r))}},js=qr;export{js as default};
|
|
1
|
+
var me=`
|
|
2
|
+
`,qe="\r",Xe=function(){function s(e){this.length=e.length;for(var t=[0],r=0;r<e.length;)switch(e[r]){case me:r+=me.length,t.push(r);break;case qe:r+=qe.length,e[r]===me&&(r+=me.length),t.push(r);break;default:r++;break}this.offsets=t}return s.prototype.locationForIndex=function(e){if(e<0||e>this.length)return null;for(var t=0,r=this.offsets;r[t+1]<=e;)t++;var n=e-r[t];return{line:t,column:n}},s.prototype.indexForLocation=function(e){var t=e.line,r=e.column;return t<0||t>=this.offsets.length||r<0||r>this.lengthOfLine(t)?null:this.offsets[t]+r},s.prototype.lengthOfLine=function(e){var t=this.offsets[e],r=e===this.offsets.length-1?this.length:this.offsets[e+1];return r-t},s}();var pe=class{text;locator;constructor(e){this.text=e,this.locator=new Re(this.text)}},Re=class{_linesAndColumns;constructor(e){this._linesAndColumns=new Xe(e)}locationForIndex(e){let{line:t,column:r}=this._linesAndColumns.locationForIndex(e);return{line:t+1,column:r,index:e}}};var G=class{constructor(e,t,r,n){this.input=t,this.errLocation=r,this.ctxLocation=n,this.message=`Parser Error: ${e} ${r} [${t}] in ${n}`}},L=class{constructor(e,t){this.start=e,this.end=t}toAbsolute(e){return new P(e+this.start,e+this.end)}},S=class{constructor(e,t){this.span=e,this.sourceSpan=t}toString(){return"AST"}},D=class extends S{constructor(e,t,r){super(e,t),this.nameSpan=r}},E=class extends S{visit(e,t=null){}},b=class extends S{visit(e,t=null){return e.visitImplicitReceiver(this,t)}},Se=class extends b{visit(e,t=null){var r;return(r=e.visitThisReceiver)==null?void 0:r.call(e,this,t)}},V=class extends S{constructor(e,t,r){super(e,t),this.expressions=r}visit(e,t=null){return e.visitChain(this,t)}},W=class extends S{constructor(e,t,r,n,i){super(e,t),this.condition=r,this.trueExp=n,this.falseExp=i}visit(e,t=null){return e.visitConditional(this,t)}},K=class extends D{constructor(e,t,r,n,i){super(e,t,r),this.receiver=n,this.name=i}visit(e,t=null){return e.visitPropertyRead(this,t)}},Q=class extends D{constructor(e,t,r,n,i,a){super(e,t,r),this.receiver=n,this.name=i,this.value=a}visit(e,t=null){return e.visitPropertyWrite(this,t)}},H=class extends D{constructor(e,t,r,n,i){super(e,t,r),this.receiver=n,this.name=i}visit(e,t=null){return e.visitSafePropertyRead(this,t)}},j=class extends S{constructor(e,t,r,n){super(e,t),this.receiver=r,this.key=n}visit(e,t=null){return e.visitKeyedRead(this,t)}},we=class extends S{constructor(e,t,r,n){super(e,t),this.receiver=r,this.key=n}visit(e,t=null){return e.visitSafeKeyedRead(this,t)}},z=class extends S{constructor(e,t,r,n,i){super(e,t),this.receiver=r,this.key=n,this.value=i}visit(e,t=null){return e.visitKeyedWrite(this,t)}},q=class extends D{constructor(e,t,r,n,i,a){super(e,t,a),this.exp=r,this.name=n,this.args=i}visit(e,t=null){return e.visitPipe(this,t)}},A=class extends S{constructor(e,t,r){super(e,t),this.value=r}visit(e,t=null){return e.visitLiteralPrimitive(this,t)}},X=class extends S{constructor(e,t,r){super(e,t),this.expressions=r}visit(e,t=null){return e.visitLiteralArray(this,t)}},Z=class extends S{constructor(e,t,r,n){super(e,t),this.keys=r,this.values=n}visit(e,t=null){return e.visitLiteralMap(this,t)}},ye=class extends S{constructor(e,t,r,n){super(e,t),this.strings=r,this.expressions=n}visit(e,t=null){return e.visitInterpolation(this,t)}},$=class extends S{constructor(e,t,r,n,i){super(e,t),this.operation=r,this.left=n,this.right=i}visit(e,t=null){return e.visitBinary(this,t)}},I=class extends ${static createMinus(e,t,r){return new I(e,t,"-",r,"-",new A(e,t,0),r)}static createPlus(e,t,r){return new I(e,t,"+",r,"-",r,new A(e,t,0))}constructor(e,t,r,n,i,a,h){super(e,t,i,a,h),this.operator=r,this.expr=n,this.left=null,this.right=null,this.operation=null}visit(e,t=null){return e.visitUnary!==void 0?e.visitUnary(this,t):e.visitBinary(this,t)}},J=class extends S{constructor(e,t,r){super(e,t),this.expression=r}visit(e,t=null){return e.visitPrefixNot(this,t)}},Y=class extends S{constructor(e,t,r){super(e,t),this.expression=r}visit(e,t=null){return e.visitNonNullAssert(this,t)}},ee=class extends S{constructor(e,t,r,n,i){super(e,t),this.receiver=r,this.args=n,this.argumentSpan=i}visit(e,t=null){return e.visitCall(this,t)}},te=class extends S{constructor(e,t,r,n,i){super(e,t),this.receiver=r,this.args=n,this.argumentSpan=i}visit(e,t=null){return e.visitSafeCall(this,t)}},P=class{constructor(e,t){this.start=e,this.end=t}},R=class extends S{constructor(e,t,r,n,i){super(new L(0,t===null?0:t.length),new P(n,t===null?n:n+t.length)),this.ast=e,this.source=t,this.location=r,this.errors=i}visit(e,t=null){return e.visitASTWithSource?e.visitASTWithSource(this,t):this.ast.visit(e,t)}toString(){return`${this.source} in ${this.location}`}},T=class{constructor(e,t,r){this.sourceSpan=e,this.key=t,this.value=r}},re=class{constructor(e,t,r){this.sourceSpan=e,this.key=t,this.value=r}},Ee=class{visit(e,t){e.visit(this,t)}visitUnary(e,t){this.visit(e.expr,t)}visitBinary(e,t){this.visit(e.left,t),this.visit(e.right,t)}visitChain(e,t){this.visitAll(e.expressions,t)}visitConditional(e,t){this.visit(e.condition,t),this.visit(e.trueExp,t),this.visit(e.falseExp,t)}visitPipe(e,t){this.visit(e.exp,t),this.visitAll(e.args,t)}visitImplicitReceiver(e,t){}visitThisReceiver(e,t){}visitInterpolation(e,t){this.visitAll(e.expressions,t)}visitKeyedRead(e,t){this.visit(e.receiver,t),this.visit(e.key,t)}visitKeyedWrite(e,t){this.visit(e.receiver,t),this.visit(e.key,t),this.visit(e.value,t)}visitLiteralArray(e,t){this.visitAll(e.expressions,t)}visitLiteralMap(e,t){this.visitAll(e.values,t)}visitLiteralPrimitive(e,t){}visitPrefixNot(e,t){this.visit(e.expression,t)}visitNonNullAssert(e,t){this.visit(e.expression,t)}visitPropertyRead(e,t){this.visit(e.receiver,t)}visitPropertyWrite(e,t){this.visit(e.receiver,t),this.visit(e.value,t)}visitSafePropertyRead(e,t){this.visit(e.receiver,t)}visitSafeKeyedRead(e,t){this.visit(e.receiver,t),this.visit(e.key,t)}visitCall(e,t){this.visit(e.receiver,t),this.visitAll(e.args,t)}visitSafeCall(e,t){this.visit(e.receiver,t),this.visitAll(e.args,t)}visitAll(e,t){for(let r of e)this.visit(r,t)}};var Ze;(function(s){s[s.DEFAULT=0]="DEFAULT",s[s.LITERAL_ATTR=1]="LITERAL_ATTR",s[s.ANIMATION=2]="ANIMATION"})(Ze||(Ze={}));function Je(s){return s>=9&&s<=32||s==160}function B(s){return 48<=s&&s<=57}function Ye(s){return s>=97&&s<=122||s>=65&&s<=90}function Le(s){return s===39||s===34||s===96}var d;(function(s){s[s.Character=0]="Character",s[s.Identifier=1]="Identifier",s[s.PrivateIdentifier=2]="PrivateIdentifier",s[s.Keyword=3]="Keyword",s[s.String=4]="String",s[s.Operator=5]="Operator",s[s.Number=6]="Number",s[s.Error=7]="Error"})(d||(d={}));var or=["var","let","as","null","undefined","true","false","if","else","this"],ue=class{tokenize(e){let t=new Ke(e),r=[],n=t.scanToken();for(;n!=null;)r.push(n),n=t.scanToken();return r}},N=class{constructor(e,t,r,n,i){this.index=e,this.end=t,this.type=r,this.numValue=n,this.strValue=i}isCharacter(e){return this.type==d.Character&&this.numValue==e}isNumber(){return this.type==d.Number}isString(){return this.type==d.String}isOperator(e){return this.type==d.Operator&&this.strValue==e}isIdentifier(){return this.type==d.Identifier}isPrivateIdentifier(){return this.type==d.PrivateIdentifier}isKeyword(){return this.type==d.Keyword}isKeywordLet(){return this.type==d.Keyword&&this.strValue=="let"}isKeywordAs(){return this.type==d.Keyword&&this.strValue=="as"}isKeywordNull(){return this.type==d.Keyword&&this.strValue=="null"}isKeywordUndefined(){return this.type==d.Keyword&&this.strValue=="undefined"}isKeywordTrue(){return this.type==d.Keyword&&this.strValue=="true"}isKeywordFalse(){return this.type==d.Keyword&&this.strValue=="false"}isKeywordThis(){return this.type==d.Keyword&&this.strValue=="this"}isError(){return this.type==d.Error}toNumber(){return this.type==d.Number?this.numValue:-1}toString(){switch(this.type){case d.Character:case d.Identifier:case d.Keyword:case d.Operator:case d.PrivateIdentifier:case d.String:case d.Error:return this.strValue;case d.Number:return this.numValue.toString();default:return null}}};function nt(s,e,t){return new N(s,e,d.Character,t,String.fromCharCode(t))}function cr(s,e,t){return new N(s,e,d.Identifier,0,t)}function hr(s,e,t){return new N(s,e,d.PrivateIdentifier,0,t)}function pr(s,e,t){return new N(s,e,d.Keyword,0,t)}function Be(s,e,t){return new N(s,e,d.Operator,0,t)}function ur(s,e,t){return new N(s,e,d.String,0,t)}function lr(s,e,t){return new N(s,e,d.Number,t,"")}function xr(s,e,t){return new N(s,e,d.Error,0,t)}var Oe=new N(-1,-1,d.Character,0,""),Ke=class{constructor(e){this.input=e,this.peek=0,this.index=-1,this.length=e.length,this.advance()}advance(){this.peek=++this.index>=this.length?0:this.input.charCodeAt(this.index)}scanToken(){let e=this.input,t=this.length,r=this.peek,n=this.index;for(;r<=32;)if(++n>=t){r=0;break}else r=e.charCodeAt(n);if(this.peek=r,this.index=n,n>=t)return null;if(it(r))return this.scanIdentifier();if(B(r))return this.scanNumber(n);let i=n;switch(r){case 46:return this.advance(),B(this.peek)?this.scanNumber(i):nt(i,this.index,46);case 40:case 41:case 123:case 125:case 91:case 93:case 44:case 58:case 59:return this.scanCharacter(i,r);case 39:case 34:return this.scanString();case 35:return this.scanPrivateIdentifier();case 43:case 45:case 42:case 47:case 37:case 94:return this.scanOperator(i,String.fromCharCode(r));case 63:return this.scanQuestion(i);case 60:case 62:return this.scanComplexOperator(i,String.fromCharCode(r),61,"=");case 33:case 61:return this.scanComplexOperator(i,String.fromCharCode(r),61,"=",61,"=");case 38:return this.scanComplexOperator(i,"&",38,"&");case 124:return this.scanComplexOperator(i,"|",124,"|");case 160:for(;Je(this.peek);)this.advance();return this.scanToken()}return this.advance(),this.error(`Unexpected character [${String.fromCharCode(r)}]`,0)}scanCharacter(e,t){return this.advance(),nt(e,this.index,t)}scanOperator(e,t){return this.advance(),Be(e,this.index,t)}scanComplexOperator(e,t,r,n,i,a){this.advance();let h=t;return this.peek==r&&(this.advance(),h+=n),i!=null&&this.peek==i&&(this.advance(),h+=a),Be(e,this.index,h)}scanIdentifier(){let e=this.index;for(this.advance();at(this.peek);)this.advance();let t=this.input.substring(e,this.index);return or.indexOf(t)>-1?pr(e,this.index,t):cr(e,this.index,t)}scanPrivateIdentifier(){let e=this.index;if(this.advance(),!it(this.peek))return this.error("Invalid character [#]",-1);for(;at(this.peek);)this.advance();let t=this.input.substring(e,this.index);return hr(e,this.index,t)}scanNumber(e){let t=this.index===e,r=!1;for(this.advance();;){if(!B(this.peek))if(this.peek===95){if(!B(this.input.charCodeAt(this.index-1))||!B(this.input.charCodeAt(this.index+1)))return this.error("Invalid numeric separator",0);r=!0}else if(this.peek===46)t=!1;else if(fr(this.peek)){if(this.advance(),dr(this.peek)&&this.advance(),!B(this.peek))return this.error("Invalid exponent",-1);t=!1}else break;this.advance()}let n=this.input.substring(e,this.index);r&&(n=n.replace(/_/g,""));let i=t?gr(n):parseFloat(n);return lr(e,this.index,i)}scanString(){let e=this.index,t=this.peek;this.advance();let r="",n=this.index,i=this.input;for(;this.peek!=t;)if(this.peek==92){r+=i.substring(n,this.index);let h;if(this.advance(),this.peek==117){let v=i.substring(this.index+1,this.index+5);if(/^[0-9a-f]+$/i.test(v))h=parseInt(v,16);else return this.error(`Invalid unicode escape [\\u${v}]`,0);for(let f=0;f<5;f++)this.advance()}else h=vr(this.peek),this.advance();r+=String.fromCharCode(h),n=this.index}else{if(this.peek==0)return this.error("Unterminated quote",0);this.advance()}let a=i.substring(n,this.index);return this.advance(),ur(e,this.index,r+a)}scanQuestion(e){this.advance();let t="?";return(this.peek===63||this.peek===46)&&(t+=this.peek===46?".":"?",this.advance()),Be(e,this.index,t)}error(e,t){let r=this.index+t;return xr(r,this.index,`Lexer Error: ${e} at column ${r} in expression [${this.input}]`)}};function it(s){return 97<=s&&s<=122||65<=s&&s<=90||s==95||s==36}function at(s){return Ye(s)||B(s)||s==95||s==36}function fr(s){return s==101||s==69}function dr(s){return s==45||s==43}function vr(s){switch(s){case 110:return 10;case 102:return 12;case 114:return 13;case 116:return 9;case 118:return 11;default:return s}}function gr(s){let e=parseInt(s);if(isNaN(e))throw new Error("Invalid integer literal when parsing "+s);return e}var mr=[/^\s*$/,/[<>]/,/^[{}]$/,/&(#|[a-z])/i,/^\/\//];function pt(s,e){if(e!=null&&!(Array.isArray(e)&&e.length==2))throw new Error(`Expected '${s}' to be an array, [start, end].`);if(e!=null){let t=e[0],r=e[1];mr.forEach(n=>{if(n.test(t)||n.test(r))throw new Error(`['${t}', '${r}'] contains unusable interpolation symbol.`)})}}var de=class{static fromArray(e){return e?(pt("interpolation",e),new de(e[0],e[1])):F}constructor(e,t){this.start=e,this.end=t}},F=new de("{{","}}");var _e=class{constructor(e,t,r){this.strings=e,this.expressions=t,this.offsets=r}},Me=class{constructor(e,t,r){this.templateBindings=e,this.warnings=t,this.errors=r}},ve=class{constructor(e){this._lexer=e,this.errors=[]}parseAction(e,t,r,n,i=F){this._checkNoInterpolation(e,r,i);let a=this._stripComments(e),h=this._lexer.tokenize(a),v=1;t&&(v|=2);let f=new U(e,r,n,h,v,this.errors,0).parseChain();return new R(f,e,r,n,this.errors)}parseBinding(e,t,r,n=F){let i=this._parseBindingAst(e,t,r,n);return new R(i,e,t,r,this.errors)}checkSimpleExpression(e){let t=new Fe;return e.visit(t),t.errors}parseSimpleBinding(e,t,r,n=F){let i=this._parseBindingAst(e,t,r,n),a=this.checkSimpleExpression(i);return a.length>0&&this._reportError(`Host binding expression cannot contain ${a.join(" ")}`,e,t),new R(i,e,t,r,this.errors)}_reportError(e,t,r,n){this.errors.push(new G(e,t,r,n))}_parseBindingAst(e,t,r,n){this._checkNoInterpolation(e,t,n);let i=this._stripComments(e),a=this._lexer.tokenize(i);return new U(e,t,r,a,0,this.errors,0).parseChain()}parseTemplateBindings(e,t,r,n,i){let a=this._lexer.tokenize(t);return new U(t,r,i,a,0,this.errors,0).parseTemplateBindings({source:e,span:new P(n,n+e.length)})}parseInterpolation(e,t,r,n,i=F){let{strings:a,expressions:h,offsets:v}=this.splitInterpolation(e,t,n,i);if(h.length===0)return null;let f=[];for(let w=0;w<h.length;++w){let k=h[w].text,C=this._stripComments(k),y=this._lexer.tokenize(C),m=new U(e,t,r,y,0,this.errors,v[w]).parseChain();f.push(m)}return this.createInterpolationAst(a.map(w=>w.text),f,e,t,r)}parseInterpolationExpression(e,t,r){let n=this._stripComments(e),i=this._lexer.tokenize(n),a=new U(e,t,r,i,0,this.errors,0).parseChain(),h=["",""];return this.createInterpolationAst(h,[a],e,t,r)}createInterpolationAst(e,t,r,n,i){let a=new L(0,r.length),h=new ye(a,a.toAbsolute(i),e,t);return new R(h,r,n,i,this.errors)}splitInterpolation(e,t,r,n=F){let i=[],a=[],h=[],v=r?Sr(r):null,f=0,w=!1,k=!1,{start:C,end:y}=n;for(;f<e.length;)if(w){let m=f,c=m+C.length,o=this._getInterpolationEndIndex(e,y,c);if(o===-1){w=!1,k=!0;break}let x=o+y.length,p=e.substring(c,o);p.trim().length===0&&this._reportError("Blank expressions are not allowed in interpolated strings",e,`at column ${f} in`,t),a.push({text:p,start:m,end:x});let g=((v==null?void 0:v.get(m))??m)+C.length;h.push(g),f=x,w=!1}else{let m=f;f=e.indexOf(C,f),f===-1&&(f=e.length);let c=e.substring(m,f);i.push({text:c,start:m,end:f}),w=!0}if(!w)if(k){let m=i[i.length-1];m.text+=e.substring(f),m.end=e.length}else i.push({text:e.substring(f),start:f,end:e.length});return new _e(i,a,h)}wrapLiteralPrimitive(e,t,r){let n=new L(0,e==null?0:e.length);return new R(new A(n,n.toAbsolute(r),e),e,t,r,this.errors)}_stripComments(e){let t=this._commentStart(e);return t!=null?e.substring(0,t):e}_commentStart(e){let t=null;for(let r=0;r<e.length-1;r++){let n=e.charCodeAt(r),i=e.charCodeAt(r+1);if(n===47&&i==47&&t==null)return r;t===n?t=null:t==null&&Le(n)&&(t=n)}return null}_checkNoInterpolation(e,t,{start:r,end:n}){let i=-1,a=-1;for(let h of this._forEachUnquotedChar(e,0))if(i===-1)e.startsWith(r)&&(i=h);else if(a=this._getInterpolationEndIndex(e,n,h),a>-1)break;i>-1&&a>-1&&this._reportError(`Got interpolation (${r}${n}) where expression was expected`,e,`at column ${i} in`,t)}_getInterpolationEndIndex(e,t,r){for(let n of this._forEachUnquotedChar(e,r)){if(e.startsWith(t,n))return n;if(e.startsWith("//",n))return e.indexOf(t,n)}return-1}*_forEachUnquotedChar(e,t){let r=null,n=0;for(let i=t;i<e.length;i++){let a=e[i];Le(e.charCodeAt(i))&&(r===null||r===a)&&n%2===0?r=r===null?a:null:r===null&&(yield i),n=a==="\\"?n+1:0}}},oe;(function(s){s[s.None=0]="None",s[s.Writable=1]="Writable"})(oe||(oe={}));var U=class{constructor(e,t,r,n,i,a,h){this.input=e,this.location=t,this.absoluteOffset=r,this.tokens=n,this.parseFlags=i,this.errors=a,this.offset=h,this.rparensExpected=0,this.rbracketsExpected=0,this.rbracesExpected=0,this.context=oe.None,this.sourceSpanCache=new Map,this.index=0}peek(e){let t=this.index+e;return t<this.tokens.length?this.tokens[t]:Oe}get next(){return this.peek(0)}get atEOF(){return this.index>=this.tokens.length}get inputIndex(){return this.atEOF?this.currentEndIndex:this.next.index+this.offset}get currentEndIndex(){return this.index>0?this.peek(-1).end+this.offset:this.tokens.length===0?this.input.length+this.offset:this.next.index+this.offset}get currentAbsoluteOffset(){return this.absoluteOffset+this.inputIndex}span(e,t){let r=this.currentEndIndex;if(t!==void 0&&t>this.currentEndIndex&&(r=t),e>r){let n=r;r=e,e=n}return new L(e,r)}sourceSpan(e,t){let r=`${e}@${this.inputIndex}:${t}`;return this.sourceSpanCache.has(r)||this.sourceSpanCache.set(r,this.span(e,t).toAbsolute(this.absoluteOffset)),this.sourceSpanCache.get(r)}advance(){this.index++}withContext(e,t){this.context|=e;let r=t();return this.context^=e,r}consumeOptionalCharacter(e){return this.next.isCharacter(e)?(this.advance(),!0):!1}peekKeywordLet(){return this.next.isKeywordLet()}peekKeywordAs(){return this.next.isKeywordAs()}expectCharacter(e){this.consumeOptionalCharacter(e)||this.error(`Missing expected ${String.fromCharCode(e)}`)}consumeOptionalOperator(e){return this.next.isOperator(e)?(this.advance(),!0):!1}expectOperator(e){this.consumeOptionalOperator(e)||this.error(`Missing expected operator ${e}`)}prettyPrintToken(e){return e===Oe?"end of input":`token ${e}`}expectIdentifierOrKeyword(){let e=this.next;return!e.isIdentifier()&&!e.isKeyword()?(e.isPrivateIdentifier()?this._reportErrorForPrivateIdentifier(e,"expected identifier or keyword"):this.error(`Unexpected ${this.prettyPrintToken(e)}, expected identifier or keyword`),null):(this.advance(),e.toString())}expectIdentifierOrKeywordOrString(){let e=this.next;return!e.isIdentifier()&&!e.isKeyword()&&!e.isString()?(e.isPrivateIdentifier()?this._reportErrorForPrivateIdentifier(e,"expected identifier, keyword or string"):this.error(`Unexpected ${this.prettyPrintToken(e)}, expected identifier, keyword, or string`),""):(this.advance(),e.toString())}parseChain(){let e=[],t=this.inputIndex;for(;this.index<this.tokens.length;){let r=this.parsePipe();if(e.push(r),this.consumeOptionalCharacter(59))for(this.parseFlags&1||this.error("Binding expression cannot contain chained expression");this.consumeOptionalCharacter(59););else if(this.index<this.tokens.length){let n=this.index;if(this.error(`Unexpected token '${this.next}'`),this.index===n)break}}if(e.length===0){let r=this.offset,n=this.offset+this.input.length;return new E(this.span(r,n),this.sourceSpan(r,n))}return e.length==1?e[0]:new V(this.span(t),this.sourceSpan(t),e)}parsePipe(){let e=this.inputIndex,t=this.parseExpression();if(this.consumeOptionalOperator("|")){this.parseFlags&1&&this.error("Cannot have a pipe in an action expression");do{let r=this.inputIndex,n=this.expectIdentifierOrKeyword(),i,a;n!==null?i=this.sourceSpan(r):(n="",a=this.next.index!==-1?this.next.index:this.input.length+this.offset,i=new L(a,a).toAbsolute(this.absoluteOffset));let h=[];for(;this.consumeOptionalCharacter(58);)h.push(this.parseExpression());t=new q(this.span(e),this.sourceSpan(e,a),t,n,h,i)}while(this.consumeOptionalOperator("|"))}return t}parseExpression(){return this.parseConditional()}parseConditional(){let e=this.inputIndex,t=this.parseLogicalOr();if(this.consumeOptionalOperator("?")){let r=this.parsePipe(),n;if(this.consumeOptionalCharacter(58))n=this.parsePipe();else{let i=this.inputIndex,a=this.input.substring(e,i);this.error(`Conditional expression ${a} requires all 3 expressions`),n=new E(this.span(e),this.sourceSpan(e))}return new W(this.span(e),this.sourceSpan(e),t,r,n)}else return t}parseLogicalOr(){let e=this.inputIndex,t=this.parseLogicalAnd();for(;this.consumeOptionalOperator("||");){let r=this.parseLogicalAnd();t=new $(this.span(e),this.sourceSpan(e),"||",t,r)}return t}parseLogicalAnd(){let e=this.inputIndex,t=this.parseNullishCoalescing();for(;this.consumeOptionalOperator("&&");){let r=this.parseNullishCoalescing();t=new $(this.span(e),this.sourceSpan(e),"&&",t,r)}return t}parseNullishCoalescing(){let e=this.inputIndex,t=this.parseEquality();for(;this.consumeOptionalOperator("??");){let r=this.parseEquality();t=new $(this.span(e),this.sourceSpan(e),"??",t,r)}return t}parseEquality(){let e=this.inputIndex,t=this.parseRelational();for(;this.next.type==d.Operator;){let r=this.next.strValue;switch(r){case"==":case"===":case"!=":case"!==":this.advance();let n=this.parseRelational();t=new $(this.span(e),this.sourceSpan(e),r,t,n);continue}break}return t}parseRelational(){let e=this.inputIndex,t=this.parseAdditive();for(;this.next.type==d.Operator;){let r=this.next.strValue;switch(r){case"<":case">":case"<=":case">=":this.advance();let n=this.parseAdditive();t=new $(this.span(e),this.sourceSpan(e),r,t,n);continue}break}return t}parseAdditive(){let e=this.inputIndex,t=this.parseMultiplicative();for(;this.next.type==d.Operator;){let r=this.next.strValue;switch(r){case"+":case"-":this.advance();let n=this.parseMultiplicative();t=new $(this.span(e),this.sourceSpan(e),r,t,n);continue}break}return t}parseMultiplicative(){let e=this.inputIndex,t=this.parsePrefix();for(;this.next.type==d.Operator;){let r=this.next.strValue;switch(r){case"*":case"%":case"/":this.advance();let n=this.parsePrefix();t=new $(this.span(e),this.sourceSpan(e),r,t,n);continue}break}return t}parsePrefix(){if(this.next.type==d.Operator){let e=this.inputIndex,t=this.next.strValue,r;switch(t){case"+":return this.advance(),r=this.parsePrefix(),I.createPlus(this.span(e),this.sourceSpan(e),r);case"-":return this.advance(),r=this.parsePrefix(),I.createMinus(this.span(e),this.sourceSpan(e),r);case"!":return this.advance(),r=this.parsePrefix(),new J(this.span(e),this.sourceSpan(e),r)}}return this.parseCallChain()}parseCallChain(){let e=this.inputIndex,t=this.parsePrimary();for(;;)if(this.consumeOptionalCharacter(46))t=this.parseAccessMember(t,e,!1);else if(this.consumeOptionalOperator("?."))this.consumeOptionalCharacter(40)?t=this.parseCall(t,e,!0):t=this.consumeOptionalCharacter(91)?this.parseKeyedReadOrWrite(t,e,!0):this.parseAccessMember(t,e,!0);else if(this.consumeOptionalCharacter(91))t=this.parseKeyedReadOrWrite(t,e,!1);else if(this.consumeOptionalCharacter(40))t=this.parseCall(t,e,!1);else if(this.consumeOptionalOperator("!"))t=new Y(this.span(e),this.sourceSpan(e),t);else return t}parsePrimary(){let e=this.inputIndex;if(this.consumeOptionalCharacter(40)){this.rparensExpected++;let t=this.parsePipe();return this.rparensExpected--,this.expectCharacter(41),t}else{if(this.next.isKeywordNull())return this.advance(),new A(this.span(e),this.sourceSpan(e),null);if(this.next.isKeywordUndefined())return this.advance(),new A(this.span(e),this.sourceSpan(e),void 0);if(this.next.isKeywordTrue())return this.advance(),new A(this.span(e),this.sourceSpan(e),!0);if(this.next.isKeywordFalse())return this.advance(),new A(this.span(e),this.sourceSpan(e),!1);if(this.next.isKeywordThis())return this.advance(),new Se(this.span(e),this.sourceSpan(e));if(this.consumeOptionalCharacter(91)){this.rbracketsExpected++;let t=this.parseExpressionList(93);return this.rbracketsExpected--,this.expectCharacter(93),new X(this.span(e),this.sourceSpan(e),t)}else{if(this.next.isCharacter(123))return this.parseLiteralMap();if(this.next.isIdentifier())return this.parseAccessMember(new b(this.span(e),this.sourceSpan(e)),e,!1);if(this.next.isNumber()){let t=this.next.toNumber();return this.advance(),new A(this.span(e),this.sourceSpan(e),t)}else if(this.next.isString()){let t=this.next.toString();return this.advance(),new A(this.span(e),this.sourceSpan(e),t)}else return this.next.isPrivateIdentifier()?(this._reportErrorForPrivateIdentifier(this.next,null),new E(this.span(e),this.sourceSpan(e))):this.index>=this.tokens.length?(this.error(`Unexpected end of expression: ${this.input}`),new E(this.span(e),this.sourceSpan(e))):(this.error(`Unexpected token ${this.next}`),new E(this.span(e),this.sourceSpan(e)))}}}parseExpressionList(e){let t=[];do if(!this.next.isCharacter(e))t.push(this.parsePipe());else break;while(this.consumeOptionalCharacter(44));return t}parseLiteralMap(){let e=[],t=[],r=this.inputIndex;if(this.expectCharacter(123),!this.consumeOptionalCharacter(125)){this.rbracesExpected++;do{let n=this.inputIndex,i=this.next.isString(),a=this.expectIdentifierOrKeywordOrString();if(e.push({key:a,quoted:i}),i)this.expectCharacter(58),t.push(this.parsePipe());else if(this.consumeOptionalCharacter(58))t.push(this.parsePipe());else{let h=this.span(n),v=this.sourceSpan(n);t.push(new K(h,v,v,new b(h,v),a))}}while(this.consumeOptionalCharacter(44));this.rbracesExpected--,this.expectCharacter(125)}return new Z(this.span(r),this.sourceSpan(r),e,t)}parseAccessMember(e,t,r){let n=this.inputIndex,i=this.withContext(oe.Writable,()=>{let v=this.expectIdentifierOrKeyword()??"";return v.length===0&&this.error("Expected identifier for property access",e.span.end),v}),a=this.sourceSpan(n),h;if(r)this.consumeOptionalAssignment()?(this.error("The '?.' operator cannot be used in the assignment"),h=new E(this.span(t),this.sourceSpan(t))):h=new H(this.span(t),this.sourceSpan(t),a,e,i);else if(this.consumeOptionalAssignment()){if(!(this.parseFlags&1))return this.error("Bindings cannot contain assignments"),new E(this.span(t),this.sourceSpan(t));let v=this.parseConditional();h=new Q(this.span(t),this.sourceSpan(t),a,e,i,v)}else h=new K(this.span(t),this.sourceSpan(t),a,e,i);return h}parseCall(e,t,r){let n=this.inputIndex;this.rparensExpected++;let i=this.parseCallArguments(),a=this.span(n,this.inputIndex).toAbsolute(this.absoluteOffset);this.expectCharacter(41),this.rparensExpected--;let h=this.span(t),v=this.sourceSpan(t);return r?new te(h,v,e,i,a):new ee(h,v,e,i,a)}consumeOptionalAssignment(){return this.parseFlags&2&&this.next.isOperator("!")&&this.peek(1).isOperator("=")?(this.advance(),this.advance(),!0):this.consumeOptionalOperator("=")}parseCallArguments(){if(this.next.isCharacter(41))return[];let e=[];do e.push(this.parsePipe());while(this.consumeOptionalCharacter(44));return e}expectTemplateBindingKey(){let e="",t=!1,r=this.currentAbsoluteOffset;do e+=this.expectIdentifierOrKeywordOrString(),t=this.consumeOptionalOperator("-"),t&&(e+="-");while(t);return{source:e,span:new P(r,r+e.length)}}parseTemplateBindings(e){let t=[];for(t.push(...this.parseDirectiveKeywordBindings(e));this.index<this.tokens.length;){let r=this.parseLetBinding();if(r)t.push(r);else{let n=this.expectTemplateBindingKey(),i=this.parseAsBinding(n);i?t.push(i):(n.source=e.source+n.source.charAt(0).toUpperCase()+n.source.substring(1),t.push(...this.parseDirectiveKeywordBindings(n)))}this.consumeStatementTerminator()}return new Me(t,[],this.errors)}parseKeyedReadOrWrite(e,t,r){return this.withContext(oe.Writable,()=>{this.rbracketsExpected++;let n=this.parsePipe();if(n instanceof E&&this.error("Key access cannot be empty"),this.rbracketsExpected--,this.expectCharacter(93),this.consumeOptionalOperator("="))if(r)this.error("The '?.' operator cannot be used in the assignment");else{let i=this.parseConditional();return new z(this.span(t),this.sourceSpan(t),e,n,i)}else return r?new we(this.span(t),this.sourceSpan(t),e,n):new j(this.span(t),this.sourceSpan(t),e,n);return new E(this.span(t),this.sourceSpan(t))})}parseDirectiveKeywordBindings(e){let t=[];this.consumeOptionalCharacter(58);let r=this.getDirectiveBoundTarget(),n=this.currentAbsoluteOffset,i=this.parseAsBinding(e);i||(this.consumeStatementTerminator(),n=this.currentAbsoluteOffset);let a=new P(e.span.start,n);return t.push(new re(a,e,r)),i&&t.push(i),t}getDirectiveBoundTarget(){if(this.next===Oe||this.peekKeywordAs()||this.peekKeywordLet())return null;let e=this.parsePipe(),{start:t,end:r}=e.span,n=this.input.substring(t,r);return new R(e,n,this.location,this.absoluteOffset+t,this.errors)}parseAsBinding(e){if(!this.peekKeywordAs())return null;this.advance();let t=this.expectTemplateBindingKey();this.consumeStatementTerminator();let r=new P(e.span.start,this.currentAbsoluteOffset);return new T(r,t,e)}parseLetBinding(){if(!this.peekKeywordLet())return null;let e=this.currentAbsoluteOffset;this.advance();let t=this.expectTemplateBindingKey(),r=null;this.consumeOptionalOperator("=")&&(r=this.expectTemplateBindingKey()),this.consumeStatementTerminator();let n=new P(e,this.currentAbsoluteOffset);return new T(n,t,r)}consumeStatementTerminator(){this.consumeOptionalCharacter(59)||this.consumeOptionalCharacter(44)}error(e,t=null){this.errors.push(new G(e,this.input,this.locationText(t),this.location)),this.skip()}locationText(e=null){return e==null&&(e=this.index),e<this.tokens.length?`at column ${this.tokens[e].index+1} in`:"at the end of the expression"}_reportErrorForPrivateIdentifier(e,t){let r=`Private identifiers are not supported. Unexpected private identifier: ${e}`;t!==null&&(r+=`, ${t}`),this.error(r)}skip(){let e=this.next;for(;this.index<this.tokens.length&&!e.isCharacter(59)&&!e.isOperator("|")&&(this.rparensExpected<=0||!e.isCharacter(41))&&(this.rbracesExpected<=0||!e.isCharacter(125))&&(this.rbracketsExpected<=0||!e.isCharacter(93))&&(!(this.context&oe.Writable)||!e.isOperator("="));)this.next.isError()&&this.errors.push(new G(this.next.toString(),this.input,this.locationText(),this.location)),this.advance(),e=this.next}},Fe=class extends Ee{constructor(){super(...arguments),this.errors=[]}visitPipe(){this.errors.push("pipes")}};function Sr(s){let e=new Map,t=0,r=0,n=0;for(;n<s.length;){let i=s[n];if(i.type===9){let[a,h]=i.parts;t+=h.length,r+=a.length}else{let a=i.parts.reduce((h,v)=>h+v.length,0);r+=a,t+=a}e.set(r,t),n++}return e}var lt="angular-estree-parser",Ge="NgEstreeParser",Ue=0,De=[lt,Ue];function xt(){return new ve(new ue)}function Ve(s,e){let t=xt(),{astInput:r,comments:n}=yr(s,t),{ast:i,errors:a}=e(r,t);return mt(a),{ast:i,comments:n}}function ft(s){return Ve(s,(e,t)=>t.parseBinding(e,...De))}function dt(s){return Ve(s,(e,t)=>t.parseAction(e,!1,...De))}function vt(s){return Ve(s,(e,t)=>{let r=t.parseInterpolationExpression(e,...De);return r.ast=r.ast.expressions[0],r})}function gt(s){let e=xt(),{templateBindings:t,errors:r}=e.parseTemplateBindings(Ge,s,lt,Ue,Ue);return mt(r),t}function mt(s){if(s.length!==0){let[{message:e}]=s;throw new SyntaxError(e.replace(/^Parser Error: | at column \d+ in [^]*$/g,""))}}function yr(s,e){let t=e._commentStart(s);return t===null?{astInput:s,comments:[]}:{astInput:s.slice(0,t),comments:[{type:"Comment",value:s.slice(t+2),sourceSpan:{start:t,end:s.length}}]}}function St(s){return s instanceof I?"Unary":s instanceof $?"Binary":s instanceof q?"BindingPipe":s instanceof ee?"Call":s instanceof V?"Chain":s instanceof W?"Conditional":s instanceof E?"EmptyExpr":s instanceof b?"ImplicitReceiver":s instanceof j?"KeyedRead":s instanceof z?"KeyedWrite":s instanceof X?"LiteralArray":s instanceof Z?"LiteralMap":s instanceof A?"LiteralPrimitive":s instanceof Y?"NonNullAssert":s instanceof J?"PrefixNot":s instanceof K?"PropertyRead":s instanceof Q?"PropertyWrite":s instanceof te?"SafeCall":s instanceof H?"SafePropertyRead":s.type}function ut({start:s,end:e},t){let r=s,n=e;for(;n!==r&&/\s/.test(t[n-1]);)n--;for(;r!==n&&/\s/.test(t[r]);)r++;return{start:r,end:n}}function Er({start:s,end:e},t){let r=s,n=e;for(;n!==t.length&&/\s/.test(t[n]);)n++;for(;r!==0&&/\s/.test(t[r-1]);)r--;return{start:r,end:n}}function Ar(s,e){return e[s.start-1]==="("&&e[s.end]===")"?{start:s.start-1,end:s.end+1}:s}function wt(s,e,t){let r=0,n={start:s.start,end:s.end};for(;;){let i=Er(n,e),a=Ar(i,e);if(i.start===a.start&&i.end===a.end)break;n.start=a.start,n.end=a.end,r++}return{hasParens:(t?r-1:r)!==0,outerSpan:ut(t?{start:n.start+1,end:n.end-1}:n,e),innerSpan:ut(s,e)}}function yt(s,e,t){let r=e;for(;!s.test(t[r]);)if(--r<0)throw new Error(`Cannot find front char ${s} from index ${e} in ${JSON.stringify(t)}`);return r}function Ne(s,e,t){let r=e;for(;!s.test(t[r]);)if(++r>=t.length)throw new Error(`Cannot find back char ${s} from index ${e} in ${JSON.stringify(t)}`);return r}function Et(s){return s.slice(0,1).toLowerCase()+s.slice(1)}function At(s){return s.length===0?void 0:s[s.length-1]}var ce=(s,e,t=!1)=>{let r=St(s);switch(r){case"Unary":{let{operator:c,expr:o}=s,x=n(o);return a("UnaryExpression",{prefix:!0,argument:x,operator:c},s.sourceSpan,{hasParentParens:t})}case"Binary":{let{left:c,operation:o,right:x}=s,p=n(c),l=n(x);return a(o==="&&"||o==="||"||o==="??"?"LogicalExpression":"BinaryExpression",{left:p,right:l,operator:o},{start:y(p),end:m(l)},{hasParentParens:t})}case"BindingPipe":{let{exp:c,name:o,args:x}=s,p=n(c),l=f(/\S/,f(/\|/,m(p))+1),g=a("Identifier",{name:o},{start:l,end:l+o.length}),u=x.map(n);return a("NGPipeExpression",{left:p,right:g,arguments:u},{start:y(p),end:m(u.length===0?g:At(u))},{hasParentParens:t})}case"Chain":{let{expressions:c}=s;return a("NGChainedExpression",{expressions:c.map(n)},s.sourceSpan,{hasParentParens:t})}case"Comment":{let{value:c}=s;return a("CommentLine",{value:c},s.sourceSpan,{processSpan:!1})}case"Conditional":{let{condition:c,trueExp:o,falseExp:x}=s,p=n(c),l=n(o),g=n(x);return a("ConditionalExpression",{test:p,consequent:l,alternate:g},{start:y(p),end:m(g)},{hasParentParens:t})}case"EmptyExpr":return a("NGEmptyExpression",{},s.sourceSpan,{hasParentParens:t});case"ImplicitReceiver":return a("ThisExpression",{},s.sourceSpan,{hasParentParens:t});case"KeyedRead":{let{key:c}=s,o=Object.prototype.hasOwnProperty.call(s,"receiver")?s.receiver:s.obj,x=n(c);return h(o,x,{computed:!0,optional:!1},{end:s.sourceSpan.end,hasParentParens:t})}case"LiteralArray":{let{expressions:c}=s;return a("ArrayExpression",{elements:c.map(n)},s.sourceSpan,{hasParentParens:t})}case"LiteralMap":{let{keys:c,values:o}=s,x=o.map(l=>n(l)),p=c.map(({key:l,quoted:g},u)=>{let O=x[u],he=y(O),je=m(O),Pe=f(/\S/,u===0?s.sourceSpan.start+1:f(/,/,m(x[u-1]))+1),Pt=he===Pe?je:v(/\S/,v(/:/,he-1)-1)+1,ze={start:Pe,end:Pt},ge=g?a("StringLiteral",{value:l},ze):a("Identifier",{name:l},ze),Rt=ge.end<ge.start||Pe===he;return a("ObjectProperty",{key:ge,value:O,method:!1,shorthand:Rt,computed:!1},{start:y(ge),end:je})});return a("ObjectExpression",{properties:p},s.sourceSpan,{hasParentParens:t})}case"LiteralPrimitive":{let{value:c}=s;switch(typeof c){case"boolean":return a("BooleanLiteral",{value:c},s.sourceSpan,{hasParentParens:t});case"number":return a("NumericLiteral",{value:c},s.sourceSpan,{hasParentParens:t});case"object":return a("NullLiteral",{},s.sourceSpan,{hasParentParens:t});case"string":return a("StringLiteral",{value:c},s.sourceSpan,{hasParentParens:t});case"undefined":return a("Identifier",{name:"undefined"},s.sourceSpan,{hasParentParens:t});default:throw new Error(`Unexpected LiteralPrimitive value type ${typeof c}`)}}case"Call":case"SafeCall":{let c=r==="SafeCall",{receiver:o,args:x}=s,p=x.length===1?[i(x[0])]:x.map(n),l=n(o),g=k(l),u=c||g?"OptionalCallExpression":"CallExpression";return a(u,{callee:l,arguments:p,optional:u==="OptionalCallExpression"?c:void 0},{start:y(l),end:s.sourceSpan.end},{hasParentParens:t})}case"NonNullAssert":{let{expression:c}=s,o=n(c);return a("TSNonNullExpression",{expression:o},{start:y(o),end:s.sourceSpan.end},{hasParentParens:t})}case"PrefixNot":{let{expression:c}=s,o=n(c);return a("UnaryExpression",{prefix:!0,operator:"!",argument:o},{start:s.sourceSpan.start,end:m(o)},{hasParentParens:t})}case"PropertyRead":case"SafePropertyRead":{let c=r==="SafePropertyRead",{receiver:o,name:x}=s,p=v(/\S/,s.sourceSpan.end-1)+1,l=a("Identifier",{name:x},{start:p-x.length,end:p},w(o)?{hasParentParens:t}:{});return h(o,l,{computed:!1,optional:c},{hasParentParens:t})}case"KeyedWrite":{let{key:c,value:o}=s,x=Object.prototype.hasOwnProperty.call(s,"receiver")?s.receiver:s.obj,p=n(c),l=n(o),g=h(x,p,{computed:!0,optional:!1},{end:f(/\]/,m(p))+1});return a("AssignmentExpression",{left:g,operator:"=",right:l},{start:y(g),end:m(l)},{hasParentParens:t})}case"PropertyWrite":{let{receiver:c,name:o,value:x}=s,p=n(x),l=v(/\S/,v(/=/,y(p)-1)-1)+1,g=a("Identifier",{name:o},{start:l-o.length,end:l}),u=h(c,g,{computed:!1,optional:!1});return a("AssignmentExpression",{left:u,operator:"=",right:p},{start:y(u),end:m(p)},{hasParentParens:t})}default:throw new Error(`Unexpected node ${r}`)}function n(c){return ce(c,e)}function i(c){return ce(c,e,!0)}function a(c,o,x,{processSpan:p=!0,hasParentParens:l=!1}={}){let g={type:c,...ke(x,e,p,l),...o};switch(c){case"Identifier":{let u=g;u.loc.identifierName=u.name;break}case"NumericLiteral":{let u=g;u.extra={...u.extra,raw:e.text.slice(u.start,u.end),rawValue:u.value};break}case"StringLiteral":{let u=g;u.extra={...u.extra,raw:e.text.slice(u.start,u.end),rawValue:u.value};break}case"ObjectProperty":{let u=g;u.shorthand&&(u.extra={...u.extra,shorthand:u.shorthand});break}}return g}function h(c,o,x,{end:p=m(o),hasParentParens:l=!1}={}){if(w(c)||c.sourceSpan.start===o.start)return o;let g=n(c),u=k(g);return a(x.optional||u?"OptionalMemberExpression":"MemberExpression",{object:g,property:o,computed:x.computed,...x.optional?{optional:!0}:u?{optional:!1}:null},{start:y(g),end:p},{hasParentParens:l})}function v(c,o){return yt(c,o,e.text)}function f(c,o){return Ne(c,o,e.text)}function w(c){return c.sourceSpan.start>=c.sourceSpan.end||/^\s+$/.test(e.text.slice(c.sourceSpan.start,c.sourceSpan.end))}function k(c){return(c.type==="OptionalCallExpression"||c.type==="OptionalMemberExpression")&&!C(c)}function C(c){return c.extra&&c.extra.parenthesized}function y(c){return C(c)?c.extra.parenStart:c.start}function m(c){return C(c)?c.extra.parenEnd:c.end}};function ke(s,e,t=!1,r=!1){if(!t){let{start:h,end:v}=s;return{start:h,end:v,loc:{start:e.locator.locationForIndex(h),end:e.locator.locationForIndex(v)}}}let{outerSpan:n,innerSpan:i,hasParens:a}=wt(s,e.text,r);return{start:i.start,end:i.end,loc:{start:e.locator.locationForIndex(i.start),end:e.locator.locationForIndex(i.end)},...a&&{extra:{parenthesized:!0,parenStart:n.start,parenEnd:n.end}}}}function $t(s,e){s.forEach(y);let[t]=s,{key:r}=t,n=e.text.slice(t.sourceSpan.start,t.sourceSpan.end).trim().length===0?s.slice(1):s,i=[],a=null;for(let o=0;o<n.length;o++){let x=n[o];if(a&&k(a)&&C(x)&&x.value&&x.value.source===a.key.source){let p=f("NGMicrosyntaxKey",{name:x.key.source},x.key.span),l=(O,he)=>({...O,...ke({start:O.start,end:he},e)}),g=O=>({...l(O,p.end),alias:p}),u=i.pop();if(u.type==="NGMicrosyntaxExpression")i.push(g(u));else if(u.type==="NGMicrosyntaxKeyedExpression"){let O=g(u.expression);i.push(l({...u,expression:O},O.end))}else throw new Error(`Unexpected type ${u.type}`)}else i.push(h(x,o));a=x}return f("NGMicrosyntax",{body:i},i.length===0?s[0].sourceSpan:{start:i[0].start,end:i[i.length-1].end});function h(o,x){if(k(o)){let{key:p,value:l}=o;return l?x===0?f("NGMicrosyntaxExpression",{expression:v(l.ast),alias:null},l.sourceSpan):f("NGMicrosyntaxKeyedExpression",{key:f("NGMicrosyntaxKey",{name:w(p.source)},p.span),expression:f("NGMicrosyntaxExpression",{expression:v(l.ast),alias:null},l.sourceSpan)},{start:p.span.start,end:l.sourceSpan.end}):f("NGMicrosyntaxKey",{name:w(p.source)},p.span)}else{let{key:p,sourceSpan:l}=o;if(/^let\s$/.test(e.text.slice(l.start,l.start+4))){let{value:u}=o;return f("NGMicrosyntaxLet",{key:f("NGMicrosyntaxKey",{name:p.source},p.span),value:u?f("NGMicrosyntaxKey",{name:u.source},u.span):null},{start:l.start,end:u?u.span.end:p.span.end})}else{let u=c(o);return f("NGMicrosyntaxAs",{key:f("NGMicrosyntaxKey",{name:u.source},u.span),alias:f("NGMicrosyntaxKey",{name:p.source},p.span)},{start:u.span.start,end:p.span.end})}}}function v(o){return ce(o,e)}function f(o,x,p,l=!0){return{type:o,...ke(p,e,l),...x}}function w(o){return Et(o.slice(r.source.length))}function k(o){return o instanceof re}function C(o){return o instanceof T}function y(o){m(o.key.span),C(o)&&o.value&&m(o.value.span)}function m(o){if(e.text[o.start]!=='"'&&e.text[o.start]!=="'")return;let x=e.text[o.start],p=!1;for(let l=o.start+1;l<e.text.length;l++)switch(e.text[l]){case x:if(!p){o.end=l+1;return}default:p=!1;break;case"\\":p=!p;break}}function c(o){if(!o.value||o.value.source!==Ge)return o.value;let x=Ne(/\S/,o.sourceSpan.start,e.text);return{source:"$implicit",span:{start:x,end:x}}}}function We(s,e){let{ast:t,comments:r}=e(s),n=new pe(s),i=h=>ce(h,n),a=i(t);return a.comments=r.map(h=>i(h)),a}function Ct(s){return We(s,ft)}function Ot(s){return We(s,vt)}function Qe(s){return We(s,dt)}function Nt(s){return $t(gt(s),new pe(s))}function $r(s){return Array.isArray(s)&&s.length>0}var kt=$r;function He(s){var r;let e=s.range?s.range[0]:s.start,t=((r=s.declaration)==null?void 0:r.decorators)??s.decorators;return kt(t)?Math.min(He(t[0]),e):e}function It(s){return s.range?s.range[1]:s.end}function Ie(s){return{astFormat:"estree",parse(e){let t=s(e);return{type:"NGRoot",node:s===Qe&&t.type!=="NGChainedExpression"?{...t,type:"NGChainedExpression",expressions:[t]}:t}},locStart:He,locEnd:It}}var Cr={parsers:{__ng_action:Ie(Qe),__ng_binding:Ie(Ct),__ng_interpolation:Ie(Ot),__ng_directive:Ie(Nt)}},as=Cr;export{as as default};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Parser } from "../index.js";
|
|
2
|
+
|
|
3
|
+
declare const plugin: {
|
|
4
|
+
parsers: {
|
|
5
|
+
babel: Parser;
|
|
6
|
+
"babel-flow": Parser;
|
|
7
|
+
"babel-ts": Parser;
|
|
8
|
+
json: Parser;
|
|
9
|
+
json5: Parser;
|
|
10
|
+
"json-stringify": Parser;
|
|
11
|
+
__js_expression: Parser;
|
|
12
|
+
__vue_expression: Parser;
|
|
13
|
+
__vue_event_binding: Parser;
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export default plugin;
|