mirror of
https://github.com/joelwmale/webhook-action.git
synced 2024-11-29 02:45:23 +01:00
46 lines
50 KiB
JavaScript
46 lines
50 KiB
JavaScript
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):((t="undefined"!=typeof globalThis?globalThis:t||self).prettierPlugins=t.prettierPlugins||{},t.prettierPlugins.angular=e())}(this,(function(){"use strict";function t(e,s){const{ignoreDecorators:n}=s||{};if(!n){const s=e.declaration&&e.declaration.decorators||e.decorators;if(s&&s.length>0)return t(s[0])}return e.range?e.range[0]:e.start}function e(t){const s=t.range?t.range[1]:t.end;return t.typeAnnotation?Math.max(s,e(t.typeAnnotation)):s}function s(e,s){return t(e)===t(s)}var n={locStart:t,locEnd:e,composeLoc:function(s,n=s){const r=t(s);return[r,"number"==typeof n?r+n:e(n)]},hasSameLocStart:s,hasSameLoc:function(t,n){return s(t,n)&&function(t,s){return e(t)===e(s)}(t,n)}};function r(t,e,s){return t(s={path:e,exports:{},require:function(t,e){return function(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}(null==e&&s.path)}},s.exports),s.exports}var i,a=r((function(t,e){var s="\n",n=function(){function t(t){this.string=t;for(var e=[0],n=0;n<t.length;)switch(t[n]){case s:n+=s.length,e.push(n);break;case"\r":t[n+="\r".length]===s&&(n+=s.length),e.push(n);break;default:n++}this.offsets=e}return t.prototype.locationForIndex=function(t){if(t<0||t>this.string.length)return null;for(var e=0,s=this.offsets;s[e+1]<=t;)e++;return{line:e,column:t-s[e]}},t.prototype.indexForLocation=function(t){var e=t.line,s=t.column;return e<0||e>=this.offsets.length||s<0||s>this.lengthOfLine(e)?null:this.offsets[e]+s},t.prototype.lengthOfLine=function(t){var e=this.offsets[t];return(t===this.offsets.length-1?this.string.length:this.offsets[t+1])-e},t}();e.__esModule=!0,e.default=n})),o=r((function(t,e){Object.defineProperty(e,"__esModule",{value:!0});e.Context=class{constructor(t){this.text=t,this.locator=new s(this.text)}};class s{constructor(t){this._lineAndColumn=new a.default(t)}locationForIndex(t){const{line:e,column:s}=this._lineAndColumn.locationForIndex(t);return{line:e+1,column:s}}}}));
|
|
/**
|
|
* @license
|
|
* Copyright Google LLC All Rights Reserved.
|
|
*
|
|
* Use of this source code is governed by an MIT-style license that can be
|
|
* found in the LICENSE file at https://angular.io/license
|
|
*/
|
|
class c{constructor(t,e,s,n){this.input=e,this.errLocation=s,this.ctxLocation=n,this.message="Parser Error: ".concat(t," ").concat(s," [").concat(e,"] in ").concat(n)}}class h{constructor(t,e){this.start=t,this.end=e}toAbsolute(t){return new M(t+this.start,t+this.end)}}class p{constructor(t,e){this.span=t,this.sourceSpan=e}visit(t,e=null){return null}toString(){return"AST"}}class u extends p{constructor(t,e,s){super(t,e),this.nameSpan=s}}class l extends p{constructor(t,e,s,n,r){super(t,e),this.prefix=s,this.uninterpretedExpression=n,this.location=r}visit(t,e=null){return t.visitQuote(this,e)}toString(){return"Quote"}}class d extends p{visit(t,e=null){}}class f extends p{visit(t,e=null){return t.visitImplicitReceiver(this,e)}}class v extends p{constructor(t,e,s){super(t,e),this.expressions=s}visit(t,e=null){return t.visitChain(this,e)}}class x extends p{constructor(t,e,s,n,r){super(t,e),this.condition=s,this.trueExp=n,this.falseExp=r}visit(t,e=null){return t.visitConditional(this,e)}}class g extends u{constructor(t,e,s,n,r){super(t,e,s),this.receiver=n,this.name=r}visit(t,e=null){return t.visitPropertyRead(this,e)}}class m extends u{constructor(t,e,s,n,r,i){super(t,e,s),this.receiver=n,this.name=r,this.value=i}visit(t,e=null){return t.visitPropertyWrite(this,e)}}class y extends u{constructor(t,e,s,n,r){super(t,e,s),this.receiver=n,this.name=r}visit(t,e=null){return t.visitSafePropertyRead(this,e)}}class S extends p{constructor(t,e,s,n){super(t,e),this.obj=s,this.key=n}visit(t,e=null){return t.visitKeyedRead(this,e)}}class w extends p{constructor(t,e,s,n,r){super(t,e),this.obj=s,this.key=n,this.value=r}visit(t,e=null){return t.visitKeyedWrite(this,e)}}class C extends u{constructor(t,e,s,n,r,i){super(t,e,i),this.exp=s,this.name=n,this.args=r}visit(t,e=null){return t.visitPipe(this,e)}}class P extends p{constructor(t,e,s){super(t,e),this.value=s}visit(t,e=null){return t.visitLiteralPrimitive(this,e)}}class E extends p{constructor(t,e,s){super(t,e),this.expressions=s}visit(t,e=null){return t.visitLiteralArray(this,e)}}class A extends p{constructor(t,e,s,n){super(t,e),this.keys=s,this.values=n}visit(t,e=null){return t.visitLiteralMap(this,e)}}class b extends p{constructor(t,e,s,n){super(t,e),this.strings=s,this.expressions=n}visit(t,e=null){return t.visitInterpolation(this,e)}}class O extends p{constructor(t,e,s,n,r){super(t,e),this.operation=s,this.left=n,this.right=r}visit(t,e=null){return t.visitBinary(this,e)}}class k extends O{constructor(t,e,s,n,r,i,a){super(t,e,r,i,a),this.operator=s,this.expr=n}static createMinus(t,e,s){return new k(t,e,"-",s,"-",new P(t,e,0),s)}static createPlus(t,e,s){return new k(t,e,"+",s,"-",s,new P(t,e,0))}visit(t,e=null){return void 0!==t.visitUnary?t.visitUnary(this,e):t.visitBinary(this,e)}}class N extends p{constructor(t,e,s){super(t,e),this.expression=s}visit(t,e=null){return t.visitPrefixNot(this,e)}}class I extends p{constructor(t,e,s){super(t,e),this.expression=s}visit(t,e=null){return t.visitNonNullAssert(this,e)}}class _ extends u{constructor(t,e,s,n,r,i){super(t,e,s),this.receiver=n,this.name=r,this.args=i}visit(t,e=null){return t.visitMethodCall(this,e)}}class L extends u{constructor(t,e,s,n,r,i){super(t,e,s),this.receiver=n,this.name=r,this.args=i}visit(t,e=null){return t.visitSafeMethodCall(this,e)}}class K extends p{constructor(t,e,s,n){super(t,e),this.target=s,this.args=n}visit(t,e=null){return t.visitFunctionCall(this,e)}}class M{constructor(t,e){this.start=t,this.end=e}}class T extends p{constructor(t,e,s,n,r){super(new h(0,null===e?0:e.length),new M(n,null===e?n:n+e.length)),this.ast=t,this.source=e,this.location=s,this.errors=r}visit(t,e=null){return t.visitASTWithSource?t.visitASTWithSource(this,e):this.ast.visit(t,e)}toString(){return"".concat(this.source," in ").concat(this.location)}}class B{constructor(t,e,s){this.sourceSpan=t,this.key=e,this.value=s}}class R{constructor(t,e,s){this.sourceSpan=t,this.key=e,this.value=s}}class j{visit(t,e){t.visit(this,e)}visitUnary(t,e){this.visit(t.expr,e)}visitBinary(t,e){this.visit(t.left,e),this.visit(t.right,e)}visitChain(t,e){this.visitAll(t.expressions,e)}visitConditional(t,e){this.visit(t.condition,e),this.visit(t.trueExp,e),this.visit(t.falseExp,e)}visitPipe(t,e){this.visit(t.exp,e),this.visitAll(t.args,e)}visitFunctionCall(t,e){t.target&&this.visit(t.target,e),this.visitAll(t.args,e)}visitImplicitReceiver(t,e){}visitInterpolation(t,e){this.visitAll(t.expressions,e)}visitKeyedRead(t,e){this.visit(t.obj,e),this.visit(t.key,e)}visitKeyedWrite(t,e){this.visit(t.obj,e),this.visit(t.key,e),this.visit(t.value,e)}visitLiteralArray(t,e){this.visitAll(t.expressions,e)}visitLiteralMap(t,e){this.visitAll(t.values,e)}visitLiteralPrimitive(t,e){}visitMethodCall(t,e){this.visit(t.receiver,e),this.visitAll(t.args,e)}visitPrefixNot(t,e){this.visit(t.expression,e)}visitNonNullAssert(t,e){this.visit(t.expression,e)}visitPropertyRead(t,e){this.visit(t.receiver,e)}visitPropertyWrite(t,e){this.visit(t.receiver,e),this.visit(t.value,e)}visitSafePropertyRead(t,e){this.visit(t.receiver,e)}visitSafeMethodCall(t,e){this.visit(t.receiver,e),this.visitAll(t.args,e)}visitQuote(t,e){}visitAll(t,e){for(const s of t)this.visit(s,e)}}!function(t){t[t.DEFAULT=0]="DEFAULT",t[t.LITERAL_ATTR=1]="LITERAL_ATTR",t[t.ANIMATION=2]="ANIMATION"}(i||(i={}));var F=Object.freeze({__proto__:null,ParserError:c,ParseSpan:h,AST:p,ASTWithName:u,Quote:l,EmptyExpr:d,ImplicitReceiver:f,Chain:v,Conditional:x,PropertyRead:g,PropertyWrite:m,SafePropertyRead:y,KeyedRead:S,KeyedWrite:w,BindingPipe:C,LiteralPrimitive:P,LiteralArray:E,LiteralMap:A,Interpolation:b,Binary:O,Unary:k,PrefixNot:N,NonNullAssert:I,MethodCall:_,SafeMethodCall:L,FunctionCall:K,AbsoluteSourceSpan:M,ASTWithSource:T,VariableBinding:B,ExpressionBinding:R,RecursiveAstVisitor:j,AstTransformer:class{visitImplicitReceiver(t,e){return t}visitInterpolation(t,e){return new b(t.span,t.sourceSpan,t.strings,this.visitAll(t.expressions))}visitLiteralPrimitive(t,e){return new P(t.span,t.sourceSpan,t.value)}visitPropertyRead(t,e){return new g(t.span,t.sourceSpan,t.nameSpan,t.receiver.visit(this),t.name)}visitPropertyWrite(t,e){return new m(t.span,t.sourceSpan,t.nameSpan,t.receiver.visit(this),t.name,t.value.visit(this))}visitSafePropertyRead(t,e){return new y(t.span,t.sourceSpan,t.nameSpan,t.receiver.visit(this),t.name)}visitMethodCall(t,e){return new _(t.span,t.sourceSpan,t.nameSpan,t.receiver.visit(this),t.name,this.visitAll(t.args))}visitSafeMethodCall(t,e){return new L(t.span,t.sourceSpan,t.nameSpan,t.receiver.visit(this),t.name,this.visitAll(t.args))}visitFunctionCall(t,e){return new K(t.span,t.sourceSpan,t.target.visit(this),this.visitAll(t.args))}visitLiteralArray(t,e){return new E(t.span,t.sourceSpan,this.visitAll(t.expressions))}visitLiteralMap(t,e){return new A(t.span,t.sourceSpan,t.keys,this.visitAll(t.values))}visitUnary(t,e){switch(t.operator){case"+":return k.createPlus(t.span,t.sourceSpan,t.expr.visit(this));case"-":return k.createMinus(t.span,t.sourceSpan,t.expr.visit(this));default:throw new Error("Unknown unary operator ".concat(t.operator))}}visitBinary(t,e){return new O(t.span,t.sourceSpan,t.operation,t.left.visit(this),t.right.visit(this))}visitPrefixNot(t,e){return new N(t.span,t.sourceSpan,t.expression.visit(this))}visitNonNullAssert(t,e){return new I(t.span,t.sourceSpan,t.expression.visit(this))}visitConditional(t,e){return new x(t.span,t.sourceSpan,t.condition.visit(this),t.trueExp.visit(this),t.falseExp.visit(this))}visitPipe(t,e){return new C(t.span,t.sourceSpan,t.exp.visit(this),t.name,this.visitAll(t.args),t.nameSpan)}visitKeyedRead(t,e){return new S(t.span,t.sourceSpan,t.obj.visit(this),t.key.visit(this))}visitKeyedWrite(t,e){return new w(t.span,t.sourceSpan,t.obj.visit(this),t.key.visit(this),t.value.visit(this))}visitAll(t){const e=[];for(let s=0;s<t.length;++s)e[s]=t[s].visit(this);return e}visitChain(t,e){return new v(t.span,t.sourceSpan,this.visitAll(t.expressions))}visitQuote(t,e){return new l(t.span,t.sourceSpan,t.prefix,t.uninterpretedExpression,t.location)}},AstMemoryEfficientTransformer:class{visitImplicitReceiver(t,e){return t}visitInterpolation(t,e){const s=this.visitAll(t.expressions);return s!==t.expressions?new b(t.span,t.sourceSpan,t.strings,s):t}visitLiteralPrimitive(t,e){return t}visitPropertyRead(t,e){const s=t.receiver.visit(this);return s!==t.receiver?new g(t.span,t.sourceSpan,t.nameSpan,s,t.name):t}visitPropertyWrite(t,e){const s=t.receiver.visit(this),n=t.value.visit(this);return s!==t.receiver||n!==t.value?new m(t.span,t.sourceSpan,t.nameSpan,s,t.name,n):t}visitSafePropertyRead(t,e){const s=t.receiver.visit(this);return s!==t.receiver?new y(t.span,t.sourceSpan,t.nameSpan,s,t.name):t}visitMethodCall(t,e){const s=t.receiver.visit(this),n=this.visitAll(t.args);return s!==t.receiver||n!==t.args?new _(t.span,t.sourceSpan,t.nameSpan,s,t.name,n):t}visitSafeMethodCall(t,e){const s=t.receiver.visit(this),n=this.visitAll(t.args);return s!==t.receiver||n!==t.args?new L(t.span,t.sourceSpan,t.nameSpan,s,t.name,n):t}visitFunctionCall(t,e){const s=t.target&&t.target.visit(this),n=this.visitAll(t.args);return s!==t.target||n!==t.args?new K(t.span,t.sourceSpan,s,n):t}visitLiteralArray(t,e){const s=this.visitAll(t.expressions);return s!==t.expressions?new E(t.span,t.sourceSpan,s):t}visitLiteralMap(t,e){const s=this.visitAll(t.values);return s!==t.values?new A(t.span,t.sourceSpan,t.keys,s):t}visitUnary(t,e){const s=t.expr.visit(this);if(s!==t.expr)switch(t.operator){case"+":return k.createPlus(t.span,t.sourceSpan,s);case"-":return k.createMinus(t.span,t.sourceSpan,s);default:throw new Error("Unknown unary operator ".concat(t.operator))}return t}visitBinary(t,e){const s=t.left.visit(this),n=t.right.visit(this);return s!==t.left||n!==t.right?new O(t.span,t.sourceSpan,t.operation,s,n):t}visitPrefixNot(t,e){const s=t.expression.visit(this);return s!==t.expression?new N(t.span,t.sourceSpan,s):t}visitNonNullAssert(t,e){const s=t.expression.visit(this);return s!==t.expression?new I(t.span,t.sourceSpan,s):t}visitConditional(t,e){const s=t.condition.visit(this),n=t.trueExp.visit(this),r=t.falseExp.visit(this);return s!==t.condition||n!==t.trueExp||r!==t.falseExp?new x(t.span,t.sourceSpan,s,n,r):t}visitPipe(t,e){const s=t.exp.visit(this),n=this.visitAll(t.args);return s!==t.exp||n!==t.args?new C(t.span,t.sourceSpan,s,t.name,n,t.nameSpan):t}visitKeyedRead(t,e){const s=t.obj.visit(this),n=t.key.visit(this);return s!==t.obj||n!==t.key?new S(t.span,t.sourceSpan,s,n):t}visitKeyedWrite(t,e){const s=t.obj.visit(this),n=t.key.visit(this),r=t.value.visit(this);return s!==t.obj||n!==t.key||r!==t.value?new w(t.span,t.sourceSpan,s,n,r):t}visitAll(t){const e=[];let s=!1;for(let n=0;n<t.length;++n){const r=t[n],i=r.visit(this);e[n]=i,s=s||i!==r}return s?e:t}visitChain(t,e){const s=this.visitAll(t.expressions);return s!==t.expressions?new v(t.span,t.sourceSpan,s):t}visitQuote(t,e){return t}},ParsedProperty:class{constructor(t,e,s,n,r){this.name=t,this.expression=e,this.type=s,this.sourceSpan=n,this.valueSpan=r,this.isLiteral=this.type===i.LITERAL_ATTR,this.isAnimation=this.type===i.ANIMATION}},get ParsedPropertyType(){return i},ParsedEvent:class{constructor(t,e,s,n,r,i){this.name=t,this.targetOrPhase=e,this.type=s,this.handler=n,this.sourceSpan=r,this.handlerSpan=i}},ParsedVariable:class{constructor(t,e,s,n,r){this.name=t,this.value=e,this.sourceSpan=s,this.keySpan=n,this.valueSpan=r}},BoundElementProperty:class{constructor(t,e,s,n,r,i,a){this.name=t,this.type=e,this.securityContext=s,this.value=n,this.unit=r,this.sourceSpan=i,this.valueSpan=a}}});
|
|
/**
|
|
* @license
|
|
* Copyright Google LLC All Rights Reserved.
|
|
*
|
|
* Use of this source code is governed by an MIT-style license that can be
|
|
* found in the LICENSE file at https://angular.io/license
|
|
*/const G=41,U=125;function W(t){return 48<=t&&t<=57}
|
|
/**
|
|
* @license
|
|
* Copyright Google LLC All Rights Reserved.
|
|
*
|
|
* Use of this source code is governed by an MIT-style license that can be
|
|
* found in the LICENSE file at https://angular.io/license
|
|
*/
|
|
var V;!function(t){t[t.Character=0]="Character",t[t.Identifier=1]="Identifier",t[t.Keyword=2]="Keyword",t[t.String=3]="String",t[t.Operator=4]="Operator",t[t.Number=5]="Number",t[t.Error=6]="Error"}(V||(V={}));const Q=["var","let","as","null","undefined","true","false","if","else","this"];class D{constructor(t,e,s,n,r){this.index=t,this.end=e,this.type=s,this.numValue=n,this.strValue=r}isCharacter(t){return this.type==V.Character&&this.numValue==t}isNumber(){return this.type==V.Number}isString(){return this.type==V.String}isOperator(t){return this.type==V.Operator&&this.strValue==t}isIdentifier(){return this.type==V.Identifier}isKeyword(){return this.type==V.Keyword}isKeywordLet(){return this.type==V.Keyword&&"let"==this.strValue}isKeywordAs(){return this.type==V.Keyword&&"as"==this.strValue}isKeywordNull(){return this.type==V.Keyword&&"null"==this.strValue}isKeywordUndefined(){return this.type==V.Keyword&&"undefined"==this.strValue}isKeywordTrue(){return this.type==V.Keyword&&"true"==this.strValue}isKeywordFalse(){return this.type==V.Keyword&&"false"==this.strValue}isKeywordThis(){return this.type==V.Keyword&&"this"==this.strValue}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.String:case V.Error:return this.strValue;case V.Number:return this.numValue.toString();default:return null}}}function z(t,e,s){return new D(t,e,V.Character,s,String.fromCharCode(s))}function q(t,e,s){return new D(t,e,V.Operator,0,s)}const $=new D(-1,-1,V.Character,0,"");class X{constructor(t){this.input=t,this.peek=0,this.index=-1,this.length=t.length,this.advance()}advance(){this.peek=++this.index>=this.length?0:this.input.charCodeAt(this.index)}scanToken(){const t=this.input,e=this.length;let s=this.peek,n=this.index;for(;s<=32;){if(++n>=e){s=0;break}s=t.charCodeAt(n)}if(this.peek=s,this.index=n,n>=e)return null;if(J(s))return this.scanIdentifier();if(W(s))return this.scanNumber(n);const r=n;switch(s){case 46:return this.advance(),W(this.peek)?this.scanNumber(r):z(r,this.index,46);case 40:case G:case 123:case U:case 91:case 93:case 44:case 58:case 59:return this.scanCharacter(r,s);case 39:case 34:return this.scanString();case 35:case 43:case 45:case 42:case 47:case 37:case 94:return this.scanOperator(r,String.fromCharCode(s));case 63:return this.scanComplexOperator(r,"?",46,".");case 60:case 62:return this.scanComplexOperator(r,String.fromCharCode(s),61,"=");case 33:case 61:return this.scanComplexOperator(r,String.fromCharCode(s),61,"=",61,"=");case 38:return this.scanComplexOperator(r,"&",38,"&");case 124:return this.scanComplexOperator(r,"|",124,"|");case 160:for(;(i=this.peek)>=9&&i<=32||160==i;)this.advance();return this.scanToken()}var i;return this.advance(),this.error("Unexpected character [".concat(String.fromCharCode(s),"]"),0)}scanCharacter(t,e){return this.advance(),z(t,this.index,e)}scanOperator(t,e){return this.advance(),q(t,this.index,e)}scanComplexOperator(t,e,s,n,r,i){this.advance();let a=e;return this.peek==s&&(this.advance(),a+=n),null!=r&&this.peek==r&&(this.advance(),a+=i),q(t,this.index,a)}scanIdentifier(){const t=this.index;for(this.advance();Y(this.peek);)this.advance();const e=this.input.substring(t,this.index);return Q.indexOf(e)>-1?(s=t,n=this.index,r=e,new D(s,n,V.Keyword,0,r)):function(t,e,s){return new D(t,e,V.Identifier,0,s)}(t,this.index,e);var s,n,r}scanNumber(t){let e=this.index===t;for(this.advance();;){if(W(this.peek));else if(46==this.peek)e=!1;else{if(101!=(s=this.peek)&&69!=s)break;if(this.advance(),Z(this.peek)&&this.advance(),!W(this.peek))return this.error("Invalid exponent",-1);e=!1}this.advance()}var s;const n=this.input.substring(t,this.index),r=e?function(t){const e=parseInt(t);if(isNaN(e))throw new Error("Invalid integer literal when parsing "+t);return e}(n):parseFloat(n);return i=t,a=this.index,o=r,new D(i,a,V.Number,o,"");var i,a,o}scanString(){const t=this.index,e=this.peek;this.advance();let s="",n=this.index;const r=this.input;for(;this.peek!=e;)if(92==this.peek){let t;if(s+=r.substring(n,this.index),this.advance(),this.peek=this.peek,117==this.peek){const e=r.substring(this.index+1,this.index+5);if(!/^[0-9a-f]+$/i.test(e))return this.error("Invalid unicode escape [\\u".concat(e,"]"),0);t=parseInt(e,16);for(let t=0;t<5;t++)this.advance()}else t=et(this.peek),this.advance();s+=String.fromCharCode(t),n=this.index}else{if(0==this.peek)return this.error("Unterminated quote",0);this.advance()}const i=r.substring(n,this.index);return this.advance(),a=t,o=this.index,c=s+i,new D(a,o,V.String,0,c);var a,o,c}error(t,e){const s=this.index+e;return function(t,e,s){return new D(t,e,V.Error,0,s)}(s,this.index,"Lexer Error: ".concat(t," at column ").concat(s," in expression [").concat(this.input,"]"))}}function J(t){return 97<=t&&t<=122||65<=t&&t<=90||95==t||36==t}function H(t){if(0==t.length)return!1;const e=new X(t);if(!J(e.peek))return!1;for(e.advance();0!==e.peek;){if(!Y(e.peek))return!1;e.advance()}return!0}function Y(t){return function(t){return t>=97&&t<=122||t>=65&&t<=90}(t)||W(t)||95==t||36==t}function Z(t){return 45==t||43==t}function tt(t){return 39===t||34===t||96===t}function et(t){switch(t){case 110:return 10;case 102:return 12;case 114:return 13;case 116:return 9;case 118:return 11;default:return t}}var st=Object.freeze({__proto__:null,get TokenType(){return V},Lexer:class{tokenize(t){const e=new X(t),s=[];let n=e.scanToken();for(;null!=n;)s.push(n),n=e.scanToken();return s}},Token:D,EOF:$,isIdentifier:H,isQuote:tt});
|
|
/**
|
|
* @license
|
|
* Copyright Google LLC All Rights Reserved.
|
|
*
|
|
* Use of this source code is governed by an MIT-style license that can be
|
|
* found in the LICENSE file at https://angular.io/license
|
|
*/const nt=[/^\s*$/,/[<>]/,/^[{}]$/,/&(#|[a-z])/i,/^\/\//];
|
|
/**
|
|
* @license
|
|
* Copyright Google LLC All Rights Reserved.
|
|
*
|
|
* Use of this source code is governed by an MIT-style license that can be
|
|
* found in the LICENSE file at https://angular.io/license
|
|
*/
|
|
class rt{constructor(t,e){this.start=t,this.end=e}static fromArray(t){return t?(function(t,e){if(!(null==e||Array.isArray(e)&&2==e.length))throw new Error("Expected '".concat(t,"' to be an array, [start, end]."));if(null!=e){const t=e[0],s=e[1];nt.forEach((e=>{if(e.test(t)||e.test(s))throw new Error("['".concat(t,"', '").concat(s,"'] contains unusable interpolation symbol."))}))}}("interpolation",t),new rt(t[0],t[1])):it}}const it=new rt("{{","}}");function at(t){return t.replace(/([.*+?^=!:${}()|[\]\/\\])/g,"\\$1")}"undefined"!=typeof self&&"undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope&&self;
|
|
/**
|
|
* @license
|
|
* Copyright Google LLC All Rights Reserved.
|
|
*
|
|
* Use of this source code is governed by an MIT-style license that can be
|
|
* found in the LICENSE file at https://angular.io/license
|
|
*/class ot{constructor(t,e,s,n,r){this.strings=t,this.stringSpans=e,this.expressions=s,this.expressionsSpans=n,this.offsets=r}}class ct{constructor(t,e,s){this.templateBindings=t,this.warnings=e,this.errors=s}}const ht=pt(it);function pt(t){const e=at(t.start)+"([\\s\\S]*?)"+at(t.end);return new RegExp(e,"g")}class ut{constructor(t){this._lexer=t,this.errors=[],this.simpleExpressionChecker=ft}parseAction(t,e,s,n=it){this._checkNoInterpolation(t,e,n);const r=this._stripComments(t),i=this._lexer.tokenize(this._stripComments(t)),a=new dt(t,e,s,i,r.length,!0,this.errors,t.length-r.length).parseChain();return new T(a,t,e,s,this.errors)}parseBinding(t,e,s,n=it){const r=this._parseBindingAst(t,e,s,n);return new T(r,t,e,s,this.errors)}checkSimpleExpression(t){const e=new this.simpleExpressionChecker;return t.visit(e),e.errors}parseSimpleBinding(t,e,s,n=it){const r=this._parseBindingAst(t,e,s,n),i=this.checkSimpleExpression(r);return i.length>0&&this._reportError("Host binding expression cannot contain ".concat(i.join(" ")),t,e),new T(r,t,e,s,this.errors)}_reportError(t,e,s,n){this.errors.push(new c(t,e,s,n))}_parseBindingAst(t,e,s,n){const r=this._parseQuote(t,e,s);if(null!=r)return r;this._checkNoInterpolation(t,e,n);const i=this._stripComments(t),a=this._lexer.tokenize(i);return new dt(t,e,s,a,i.length,!1,this.errors,t.length-i.length).parseChain()}_parseQuote(t,e,s){if(null==t)return null;const n=t.indexOf(":");if(-1==n)return null;const r=t.substring(0,n).trim();if(!H(r))return null;const i=t.substring(n+1),a=new h(0,t.length);return new l(a,a.toAbsolute(s),r,i,e)}parseTemplateBindings(t,e,s,n,r){const i=this._lexer.tokenize(e);return new dt(e,s,r,i,e.length,!1,this.errors,0).parseTemplateBindings({source:t,span:new M(n,n+t.length)})}parseInterpolation(t,e,s,n=it){const r=this.splitInterpolation(t,e,n);if(null==r)return null;const i=[];for(let n=0;n<r.expressions.length;++n){const a=r.expressions[n],o=this._stripComments(a),c=this._lexer.tokenize(o),h=new dt(t,e,s,c,o.length,!1,this.errors,r.offsets[n]+(a.length-o.length)).parseChain();i.push(h)}const a=new h(0,null==t?0:t.length);return new T(new b(a,a.toAbsolute(s),r.strings,i),t,e,s,this.errors)}splitInterpolation(t,e,s=it){const n=[],r=[],i=[],a=[],o=[];let c=0,h=!1,p=!1,{start:u,end:l}=s;for(;c<t.length;)if(h){const s=c,n=s+u.length,a=t.indexOf(l,n);if(-1===a){h=!1,p=!0;break}const d=a+l.length,f=t.substring(n,a);f.trim().length>0?r.push(f):(this._reportError("Blank expressions are not allowed in interpolated strings",t,"at column ".concat(c," in"),e),r.push("$implicit")),i.push(n),o.push({start:s,end:d}),c=d,h=!1}else{const e=c;c=t.indexOf(u,c),-1===c&&(c=t.length);const s=t.substring(e,c);n.push(s),a.push({start:e,end:c}),h=!0}return h||(p?(n[n.length-1]+=t.substring(c),a[a.length-1].end=t.length):(n.push(t.substring(c)),a.push({start:c,end:t.length}))),0===r.length?null:new ot(n,a,r,o,i)}wrapLiteralPrimitive(t,e,s){const n=new h(0,null==t?0:t.length);return new T(new P(n,n.toAbsolute(s),t),t,e,s,this.errors)}_stripComments(t){const e=this._commentStart(t);return null!=e?t.substring(0,e).trim():t}_commentStart(t){let e=null;for(let s=0;s<t.length-1;s++){const n=t.charCodeAt(s),r=t.charCodeAt(s+1);if(47===n&&47==r&&null==e)return s;e===n?e=null:null==e&&tt(n)&&(e=n)}return null}_checkNoInterpolation(t,e,s){const n=(r=s)===it?ht:pt(r);var r;const i=t.split(n);i.length>1&&this._reportError("Got interpolation (".concat(s.start).concat(s.end,") where expression was expected"),t,"at column ".concat(this._findInterpolationErrorColumn(i,1,s)," in"),e)}_findInterpolationErrorColumn(t,e,s){let n="";for(let r=0;r<e;r++)n+=r%2==0?t[r]:"".concat(s.start).concat(t[r]).concat(s.end);return n.length}}var lt;!function(t){t[t.None=0]="None",t[t.Writable=1]="Writable"}(lt||(lt={}));class dt{constructor(t,e,s,n,r,i,a,o){this.input=t,this.location=e,this.absoluteOffset=s,this.tokens=n,this.inputLength=r,this.parseAction=i,this.errors=a,this.offset=o,this.rparensExpected=0,this.rbracketsExpected=0,this.rbracesExpected=0,this.context=lt.None,this.sourceSpanCache=new Map,this.index=0}peek(t){const e=this.index+t;return e<this.tokens.length?this.tokens[e]:$}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(){if(this.index>0){return this.peek(-1).end+this.offset}return 0===this.tokens.length?this.inputLength+this.offset:this.next.index+this.offset}get currentAbsoluteOffset(){return this.absoluteOffset+this.inputIndex}span(t){return new h(t,this.currentEndIndex)}sourceSpan(t){const e="".concat(t,"@").concat(this.inputIndex);return this.sourceSpanCache.has(e)||this.sourceSpanCache.set(e,this.span(t).toAbsolute(this.absoluteOffset)),this.sourceSpanCache.get(e)}advance(){this.index++}withContext(t,e){this.context|=t;const s=e();return this.context^=t,s}consumeOptionalCharacter(t){return!!this.next.isCharacter(t)&&(this.advance(),!0)}peekKeywordLet(){return this.next.isKeywordLet()}peekKeywordAs(){return this.next.isKeywordAs()}expectCharacter(t){this.consumeOptionalCharacter(t)||this.error("Missing expected ".concat(String.fromCharCode(t)))}consumeOptionalOperator(t){return!!this.next.isOperator(t)&&(this.advance(),!0)}expectOperator(t){this.consumeOptionalOperator(t)||this.error("Missing expected operator ".concat(t))}prettyPrintToken(t){return t===$?"end of input":"token ".concat(t)}expectIdentifierOrKeyword(){const t=this.next;return t.isIdentifier()||t.isKeyword()?(this.advance(),t.toString()):(this.error("Unexpected ".concat(this.prettyPrintToken(t),", expected identifier or keyword")),"")}expectIdentifierOrKeywordOrString(){const t=this.next;return t.isIdentifier()||t.isKeyword()||t.isString()?(this.advance(),t.toString()):(this.error("Unexpected ".concat(this.prettyPrintToken(t),", expected identifier, keyword, or string")),"")}parseChain(){const t=[],e=this.inputIndex;for(;this.index<this.tokens.length;){const e=this.parsePipe();if(t.push(e),this.consumeOptionalCharacter(59))for(this.parseAction||this.error("Binding expression cannot contain chained expression");this.consumeOptionalCharacter(59););else this.index<this.tokens.length&&this.error("Unexpected token '".concat(this.next,"'"))}return 0==t.length?new d(this.span(e),this.sourceSpan(e)):1==t.length?t[0]:new v(this.span(e),this.sourceSpan(e),t)}parsePipe(){let t=this.parseExpression();if(this.consumeOptionalOperator("|")){this.parseAction&&this.error("Cannot have a pipe in an action expression");do{const e=this.inputIndex,s=this.expectIdentifierOrKeyword(),n=this.sourceSpan(e),r=[];for(;this.consumeOptionalCharacter(58);)r.push(this.parseExpression());const{start:i}=t.span;t=new C(this.span(i),this.sourceSpan(i),t,s,r,n)}while(this.consumeOptionalOperator("|"))}return t}parseExpression(){return this.parseConditional()}parseConditional(){const t=this.inputIndex,e=this.parseLogicalOr();if(this.consumeOptionalOperator("?")){const s=this.parsePipe();let n;if(this.consumeOptionalCharacter(58))n=this.parsePipe();else{const e=this.inputIndex,s=this.input.substring(t,e);this.error("Conditional expression ".concat(s," requires all 3 expressions")),n=new d(this.span(t),this.sourceSpan(t))}return new x(this.span(t),this.sourceSpan(t),e,s,n)}return e}parseLogicalOr(){let t=this.parseLogicalAnd();for(;this.consumeOptionalOperator("||");){const e=this.parseLogicalAnd(),{start:s}=t.span;t=new O(this.span(s),this.sourceSpan(s),"||",t,e)}return t}parseLogicalAnd(){let t=this.parseEquality();for(;this.consumeOptionalOperator("&&");){const e=this.parseEquality(),{start:s}=t.span;t=new O(this.span(s),this.sourceSpan(s),"&&",t,e)}return t}parseEquality(){let t=this.parseRelational();for(;this.next.type==V.Operator;){const e=this.next.strValue;switch(e){case"==":case"===":case"!=":case"!==":this.advance();const s=this.parseRelational(),{start:n}=t.span;t=new O(this.span(n),this.sourceSpan(n),e,t,s);continue}break}return t}parseRelational(){let t=this.parseAdditive();for(;this.next.type==V.Operator;){const e=this.next.strValue;switch(e){case"<":case">":case"<=":case">=":this.advance();const s=this.parseAdditive(),{start:n}=t.span;t=new O(this.span(n),this.sourceSpan(n),e,t,s);continue}break}return t}parseAdditive(){let t=this.parseMultiplicative();for(;this.next.type==V.Operator;){const e=this.next.strValue;switch(e){case"+":case"-":this.advance();let s=this.parseMultiplicative();const{start:n}=t.span;t=new O(this.span(n),this.sourceSpan(n),e,t,s);continue}break}return t}parseMultiplicative(){let t=this.parsePrefix();for(;this.next.type==V.Operator;){const e=this.next.strValue;switch(e){case"*":case"%":case"/":this.advance();let s=this.parsePrefix();const{start:n}=t.span;t=new O(this.span(n),this.sourceSpan(n),e,t,s);continue}break}return t}parsePrefix(){if(this.next.type==V.Operator){const t=this.inputIndex;let e;switch(this.next.strValue){case"+":return this.advance(),e=this.parsePrefix(),k.createPlus(this.span(t),this.sourceSpan(t),e);case"-":return this.advance(),e=this.parsePrefix(),k.createMinus(this.span(t),this.sourceSpan(t),e);case"!":return this.advance(),e=this.parsePrefix(),new N(this.span(t),this.sourceSpan(t),e)}}return this.parseCallChain()}parseCallChain(){let t=this.parsePrimary();const e=t.span.start;for(;;)if(this.consumeOptionalCharacter(46))t=this.parseAccessMemberOrMethodCall(t,!1);else if(this.consumeOptionalOperator("?."))t=this.parseAccessMemberOrMethodCall(t,!0);else if(this.consumeOptionalCharacter(91))this.withContext(lt.Writable,(()=>{this.rbracketsExpected++;const s=this.parsePipe();if(s instanceof d&&this.error("Key access cannot be empty"),this.rbracketsExpected--,this.expectCharacter(93),this.consumeOptionalOperator("=")){const n=this.parseConditional();t=new w(this.span(e),this.sourceSpan(e),t,s,n)}else t=new S(this.span(e),this.sourceSpan(e),t,s)}));else if(this.consumeOptionalCharacter(40)){this.rparensExpected++;const s=this.parseCallArguments();this.rparensExpected--,this.expectCharacter(G),t=new K(this.span(e),this.sourceSpan(e),t,s)}else{if(!this.consumeOptionalOperator("!"))return t;t=new I(this.span(e),this.sourceSpan(e),t)}}parsePrimary(){const t=this.inputIndex;if(this.consumeOptionalCharacter(40)){this.rparensExpected++;const t=this.parsePipe();return this.rparensExpected--,this.expectCharacter(G),t}if(this.next.isKeywordNull())return this.advance(),new P(this.span(t),this.sourceSpan(t),null);if(this.next.isKeywordUndefined())return this.advance(),new P(this.span(t),this.sourceSpan(t),void 0);if(this.next.isKeywordTrue())return this.advance(),new P(this.span(t),this.sourceSpan(t),!0);if(this.next.isKeywordFalse())return this.advance(),new P(this.span(t),this.sourceSpan(t),!1);if(this.next.isKeywordThis())return this.advance(),new f(this.span(t),this.sourceSpan(t));if(this.consumeOptionalCharacter(91)){this.rbracketsExpected++;const e=this.parseExpressionList(93);return this.rbracketsExpected--,this.expectCharacter(93),new E(this.span(t),this.sourceSpan(t),e)}if(this.next.isCharacter(123))return this.parseLiteralMap();if(this.next.isIdentifier())return this.parseAccessMemberOrMethodCall(new f(this.span(t),this.sourceSpan(t)),!1);if(this.next.isNumber()){const e=this.next.toNumber();return this.advance(),new P(this.span(t),this.sourceSpan(t),e)}if(this.next.isString()){const e=this.next.toString();return this.advance(),new P(this.span(t),this.sourceSpan(t),e)}return this.index>=this.tokens.length?(this.error("Unexpected end of expression: ".concat(this.input)),new d(this.span(t),this.sourceSpan(t))):(this.error("Unexpected token ".concat(this.next)),new d(this.span(t),this.sourceSpan(t)))}parseExpressionList(t){const e=[];if(!this.next.isCharacter(t))do{e.push(this.parsePipe())}while(this.consumeOptionalCharacter(44));return e}parseLiteralMap(){const t=[],e=[],s=this.inputIndex;if(this.expectCharacter(123),!this.consumeOptionalCharacter(U)){this.rbracesExpected++;do{const s=this.next.isString(),n=this.expectIdentifierOrKeywordOrString();t.push({key:n,quoted:s}),this.expectCharacter(58),e.push(this.parsePipe())}while(this.consumeOptionalCharacter(44));this.rbracesExpected--,this.expectCharacter(U)}return new A(this.span(s),this.sourceSpan(s),t,e)}parseAccessMemberOrMethodCall(t,e=!1){const s=t.span.start,n=this.inputIndex,r=this.expectIdentifierOrKeyword(),i=this.sourceSpan(n);if(this.consumeOptionalCharacter(40)){this.rparensExpected++;const n=this.parseCallArguments();this.expectCharacter(G),this.rparensExpected--;const a=this.span(s),o=this.sourceSpan(s);return e?new L(a,o,i,t,r,n):new _(a,o,i,t,r,n)}if(e)return this.consumeOptionalOperator("=")?(this.error("The '?.' operator cannot be used in the assignment"),new d(this.span(s),this.sourceSpan(s))):new y(this.span(s),this.sourceSpan(s),i,t,r);if(this.consumeOptionalOperator("=")){if(!this.parseAction)return this.error("Bindings cannot contain assignments"),new d(this.span(s),this.sourceSpan(s));const e=this.parseConditional();return new m(this.span(s),this.sourceSpan(s),i,t,r,e)}return new g(this.span(s),this.sourceSpan(s),i,t,r)}parseCallArguments(){if(this.next.isCharacter(G))return[];const t=[];do{t.push(this.parsePipe())}while(this.consumeOptionalCharacter(44));return t}expectTemplateBindingKey(){let t="",e=!1;const s=this.currentAbsoluteOffset;do{t+=this.expectIdentifierOrKeywordOrString(),e=this.consumeOptionalOperator("-"),e&&(t+="-")}while(e);return{source:t,span:new M(s,s+t.length)}}parseTemplateBindings(t){const e=[];for(e.push(...this.parseDirectiveKeywordBindings(t));this.index<this.tokens.length;){const s=this.parseLetBinding();if(s)e.push(s);else{const s=this.expectTemplateBindingKey(),n=this.parseAsBinding(s);n?e.push(n):(s.source=t.source+s.source[0].toUpperCase()+s.source.substring(1),e.push(...this.parseDirectiveKeywordBindings(s)))}this.consumeStatementTerminator()}return new ct(e,[],this.errors)}parseDirectiveKeywordBindings(t){const e=[];this.consumeOptionalCharacter(58);const s=this.getDirectiveBoundTarget();let n=this.currentAbsoluteOffset;const r=this.parseAsBinding(t);r||(this.consumeStatementTerminator(),n=this.currentAbsoluteOffset);const i=new M(t.span.start,n);return e.push(new R(i,t,s)),r&&e.push(r),e}getDirectiveBoundTarget(){if(this.next===$||this.peekKeywordAs()||this.peekKeywordLet())return null;const t=this.parsePipe(),{start:e,end:s}=t.span,n=this.input.substring(e,s);return new T(t,n,this.location,this.absoluteOffset+e,this.errors)}parseAsBinding(t){if(!this.peekKeywordAs())return null;this.advance();const e=this.expectTemplateBindingKey();this.consumeStatementTerminator();const s=new M(t.span.start,this.currentAbsoluteOffset);return new B(s,e,t)}parseLetBinding(){if(!this.peekKeywordLet())return null;const t=this.currentAbsoluteOffset;this.advance();const e=this.expectTemplateBindingKey();let s=null;this.consumeOptionalOperator("=")&&(s=this.expectTemplateBindingKey()),this.consumeStatementTerminator();const n=new M(t,this.currentAbsoluteOffset);return new B(n,e,s)}consumeStatementTerminator(){this.consumeOptionalCharacter(59)||this.consumeOptionalCharacter(44)}error(t,e=null){this.errors.push(new c(t,this.input,this.locationText(e),this.location)),this.skip()}locationText(t=null){return null==t&&(t=this.index),t<this.tokens.length?"at column ".concat(this.tokens[t].index+1," in"):"at the end of the expression"}skip(){let t=this.next;for(;!(!(this.index<this.tokens.length)||t.isCharacter(59)||!(this.rparensExpected<=0)&&t.isCharacter(G)||!(this.rbracesExpected<=0)&&t.isCharacter(U)||!(this.rbracketsExpected<=0)&&t.isCharacter(93)||this.context<.Writable&&t.isOperator("="));)this.next.isError()&&this.errors.push(new c(this.next.toString(),this.input,this.locationText(),this.location)),this.advance(),t=this.next}}class ft{constructor(){this.errors=[]}visitImplicitReceiver(t,e){}visitInterpolation(t,e){}visitLiteralPrimitive(t,e){}visitPropertyRead(t,e){}visitPropertyWrite(t,e){}visitSafePropertyRead(t,e){}visitMethodCall(t,e){}visitSafeMethodCall(t,e){}visitFunctionCall(t,e){}visitLiteralArray(t,e){this.visitAll(t.expressions,e)}visitLiteralMap(t,e){this.visitAll(t.values,e)}visitUnary(t,e){}visitBinary(t,e){}visitPrefixNot(t,e){}visitNonNullAssert(t,e){}visitConditional(t,e){}visitPipe(t,e){this.errors.push("pipes")}visitKeyedRead(t,e){}visitKeyedWrite(t,e){}visitAll(t,e){return t.map((t=>t.visit(this,e)))}visitChain(t,e){}visitQuote(t,e){}}class vt extends j{constructor(){super(...arguments),this.errors=[]}visitPipe(){this.errors.push("pipes")}}var xt=Object.freeze({__proto__:null,SplitInterpolation:ot,TemplateBindingParseResult:ct,Parser:ut,IvyParser:class extends ut{constructor(){super(...arguments),this.simpleExpressionChecker=vt}},_ParseAST:dt}),gt=r((function(t,e){Object.defineProperty(e,"__esModule",{value:!0});const s="angular-estree-parser";e.NG_PARSE_TEMPLATE_BINDINGS_FAKE_PREFIX="NgEstreeParser";const n=[s,0];function r(){return new xt.Parser(new st.Lexer)}function i(t,e){const s=r(),{astInput:n,comments:i}=c(t,s),{ast:a,errors:h}=e(n,s);return o(h),{ast:a,comments:i}}function a(t,e){if(t&&"object"==typeof t){if(Array.isArray(t))return t.forEach((t=>a(t,e)));for(const s of Object.keys(t)){const n=t[s];"span"===s?e(n):a(n,e)}}}function o(t){if(0!==t.length){const[{message:e}]=t;throw new SyntaxError(e.replace(/^Parser Error: | at column \d+ in [^]*$/g,""))}}function c(t,e){const s=e._commentStart(t);return null===s?{astInput:t,comments:[]}:{astInput:t.slice(0,s),comments:[{type:"Comment",value:t.slice(s+"//".length),span:{start:s,end:t.length}}]}}function h({start:t,end:e},s){let n=t,r=e;for(;r!==n&&/\s/.test(s[r-1]);)r--;for(;n!==r&&/\s/.test(s[n]);)n++;return{start:n,end:r}}function p({start:t,end:e},s){let n=t,r=e;for(;r!==s.length&&/\s/.test(s[r]);)r++;for(;0!==n&&/\s/.test(s[n-1]);)n--;return{start:n,end:r}}function u(t,e){return"("===e[t.start-1]&&")"===e[t.end]?{start:t.start-1,end:t.end+1}:t}e.parseNgBinding=function(t){return i(t,((t,e)=>e.parseBinding(t,...n)))},e.parseNgSimpleBinding=function(t){return i(t,((t,e)=>e.parseSimpleBinding(t,...n)))},e.parseNgAction=function(t){return i(t,((t,e)=>e.parseAction(t,...n)))},e.parseNgTemplateBindings=function(t){const n=r(),{templateBindings:i,errors:a}=n.parseTemplateBindings(e.NG_PARSE_TEMPLATE_BINDINGS_FAKE_PREFIX,t,s,0,0);return o(a),i},e.parseNgInterpolation=function(t){const e=r(),{astInput:s,comments:i}=c(t,e),h="{{",{ast:p,errors:u}=e.parseInterpolation(h+s+"}}",...n);o(u);const l=p.expressions[0],d=new Set;return a(l,(t=>{d.has(t)||(t.start-=h.length,t.end-=h.length,d.add(t))})),{ast:l,comments:i}},e.getNgType=function(t){return F.Unary&&t instanceof F.Unary?"Unary":t instanceof F.Binary?"Binary":t instanceof F.BindingPipe?"BindingPipe":t instanceof F.Chain?"Chain":t instanceof F.Conditional?"Conditional":t instanceof F.EmptyExpr?"EmptyExpr":t instanceof F.FunctionCall?"FunctionCall":t instanceof F.ImplicitReceiver?"ImplicitReceiver":t instanceof F.KeyedRead?"KeyedRead":t instanceof F.KeyedWrite?"KeyedWrite":t instanceof F.LiteralArray?"LiteralArray":t instanceof F.LiteralMap?"LiteralMap":t instanceof F.LiteralPrimitive?"LiteralPrimitive":t instanceof F.MethodCall?"MethodCall":t instanceof F.NonNullAssert?"NonNullAssert":t instanceof F.PrefixNot?"PrefixNot":t instanceof F.PropertyRead?"PropertyRead":t instanceof F.PropertyWrite?"PropertyWrite":t instanceof F.Quote?"Quote":t instanceof F.SafeMethodCall?"SafeMethodCall":t instanceof F.SafePropertyRead?"SafePropertyRead":t.type},e.fitSpans=function(t,e,s){let n=0;const r={start:t.start,end:t.end};for(;;){const t=p(r,e),s=u(t,e);if(t.start===s.start&&t.end===s.end)break;r.start=s.start,r.end=s.end,n++}return{hasParens:0!==(s?n-1:n),outerSpan:h(s?{start:r.start+1,end:r.end-1}:r,e),innerSpan:h(t,e)}},e.findFrontChar=function(t,e,s){let n=e;for(;!t.test(s[n]);)if(--n<0)throw new Error("Cannot find front char ".concat(t," from index ").concat(e," in ").concat(JSON.stringify(s)));return n},e.findBackChar=function(t,e,s){let n=e;for(;!t.test(s[n]);)if(++n>=s.length)throw new Error("Cannot find back char ".concat(t," from index ").concat(e," in ").concat(JSON.stringify(s)));return n},e.toLowerCamelCase=function(t){return t.slice(0,1).toLowerCase()+t.slice(1)},e.getLast=function(t){return 0===t.length?void 0:t[t.length-1]}})),mt=r((function(t,e){function s(t,e,s=!1,n=!1){if(!s){const{start:s,end:n}=t;return{start:s,end:n,loc:{start:e.locator.locationForIndex(s),end:e.locator.locationForIndex(n)}}}const{outerSpan:r,innerSpan:i,hasParens:a}=gt.fitSpans(t,e.text,n);return Object.assign({start:i.start,end:i.end,loc:{start:e.locator.locationForIndex(i.start),end:e.locator.locationForIndex(i.end)}},a&&{extra:{parenthesized:!0,parenStart:r.start,parenEnd:r.end}})}Object.defineProperty(e,"__esModule",{value:!0}),e.transform=(t,n,r=!1)=>{const i=gt.getNgType(t);switch(i){case"Unary":{const{operator:e,expr:s}=t;return c("UnaryExpression",{prefix:!0,argument:a(s),operator:e},t.span,{hasParentParens:r})}case"Binary":{const{left:e,operation:s,right:n}=t,i=n.span.start===n.span.end,o=e.span.start===e.span.end;if(i||o){const s=e.span.start===e.span.end?a(n):a(e);return c("UnaryExpression",{prefix:!0,argument:s,operator:i?"+":"-"},{start:t.span.start,end:x(s)},{hasParentParens:r})}const h=a(e),p=a(n);return c("&&"===s||"||"===s?"LogicalExpression":"BinaryExpression",{left:h,right:p,operator:s},{start:v(h),end:x(p)},{hasParentParens:r})}case"BindingPipe":{const{exp:e,name:s,args:n}=t,i=a(e),o=u(/\S/,u(/\|/,x(i))+1),h=c("Identifier",{name:s},{start:o,end:o+s.length}),p=n.map(a);return c("NGPipeExpression",{left:i,right:h,arguments:p},{start:v(i),end:x(0===p.length?h:gt.getLast(p))},{hasParentParens:r})}case"Chain":{const{expressions:e}=t;return c("NGChainedExpression",{expressions:e.map(a)},t.span,{hasParentParens:r})}case"Comment":{const{value:e}=t;return c("CommentLine",{value:e},t.span,{processSpan:!1})}case"Conditional":{const{condition:e,trueExp:s,falseExp:n}=t,i=a(e),o=a(s),h=a(n);return c("ConditionalExpression",{test:i,consequent:o,alternate:h},{start:v(i),end:x(h)},{hasParentParens:r})}case"EmptyExpr":return c("NGEmptyExpression",{},t.span,{hasParentParens:r});case"FunctionCall":{const{target:e,args:s}=t,n=1===s.length?[o(s[0])]:s.map(a),i=a(e);return c("CallExpression",{callee:i,arguments:n},{start:v(i),end:t.span.end},{hasParentParens:r})}case"ImplicitReceiver":return c("ThisExpression",{},t.span,{hasParentParens:r});case"KeyedRead":{const{obj:e,key:s}=t;return h(e,a(s),{computed:!0,optional:!1},{end:t.span.end,hasParentParens:r})}case"LiteralArray":{const{expressions:e}=t;return c("ArrayExpression",{elements:e.map(a)},t.span,{hasParentParens:r})}case"LiteralMap":{const{keys:e,values:s}=t,n=s.map((t=>a(t))),i=e.map((({key:e,quoted:s},r)=>{const i=n[r],a={start:u(/\S/,0===r?t.span.start+1:u(/,/,x(n[r-1]))+1),end:p(/\S/,p(/:/,v(i)-1)-1)+1},o=s?c("StringLiteral",{value:e},a):c("Identifier",{name:e},a);return c("ObjectProperty",{key:o,value:i,method:!1,shorthand:!1,computed:!1},{start:v(o),end:x(i)})}));return c("ObjectExpression",{properties:i},t.span,{hasParentParens:r})}case"LiteralPrimitive":{const{value:e}=t;switch(typeof e){case"boolean":return c("BooleanLiteral",{value:e},t.span,{hasParentParens:r});case"number":return c("NumericLiteral",{value:e},t.span,{hasParentParens:r});case"object":return c("NullLiteral",{},t.span,{hasParentParens:r});case"string":return c("StringLiteral",{value:e},t.span,{hasParentParens:r});case"undefined":return c("Identifier",{name:"undefined"},t.span,{hasParentParens:r});default:throw new Error("Unexpected LiteralPrimitive value type ".concat(typeof e))}}case"MethodCall":case"SafeMethodCall":{const e="SafeMethodCall"===i,{receiver:s,name:n,args:u}=t,l=1===u.length?[o(u[0])]:u.map(a),f=p(/\S/,p(/\(/,(0===l.length?p(/\)/,t.span.end-1):v(l[0]))-1)-1)+1,x=h(s,c("Identifier",{name:n},{start:f-n.length,end:f}),{computed:!1,optional:e}),g=d(x);return c(e||g?"OptionalCallExpression":"CallExpression",{callee:x,arguments:l},{start:v(x),end:t.span.end},{hasParentParens:r})}case"NonNullAssert":{const{expression:e}=t,s=a(e);return c("TSNonNullExpression",{expression:s},{start:v(s),end:t.span.end},{hasParentParens:r})}case"PrefixNot":{const{expression:e}=t,s=a(e);return c("UnaryExpression",{prefix:!0,operator:"!",argument:s},{start:t.span.start,end:x(s)},{hasParentParens:r})}case"PropertyRead":case"SafePropertyRead":{const e="SafePropertyRead"===i,{receiver:s,name:n}=t,a=p(/\S/,t.span.end-1)+1;return h(s,c("Identifier",{name:n},{start:a-n.length,end:a},l(s)?{hasParentParens:r}:{}),{computed:!1,optional:e},{hasParentParens:r})}case"KeyedWrite":{const{obj:e,key:s,value:n}=t,i=a(s),o=a(n),p=h(e,i,{computed:!0,optional:!1},{end:u(/\]/,x(i))+1});return c("AssignmentExpression",{left:p,operator:"=",right:o},{start:v(p),end:x(o)},{hasParentParens:r})}case"PropertyWrite":{const{receiver:e,name:s,value:n}=t,i=a(n),o=p(/\S/,p(/=/,v(i)-1)-1)+1,u=h(e,c("Identifier",{name:s},{start:o-s.length,end:o}),{computed:!1,optional:!1});return c("AssignmentExpression",{left:u,operator:"=",right:i},{start:v(u),end:x(i)},{hasParentParens:r})}case"Quote":{const{prefix:e,uninterpretedExpression:s}=t;return c("NGQuotedExpression",{prefix:e,value:s},t.span,{hasParentParens:r})}default:throw new Error("Unexpected node ".concat(i))}function a(t){return e.transform(t,n)}function o(t){return e.transform(t,n,!0)}function c(t,e,r,{processSpan:i=!0,hasParentParens:a=!1}={}){const o=Object.assign(Object.assign({type:t},s(r,n,i,a)),e);switch(t){case"Identifier":{const t=o;t.loc.identifierName=t.name;break}case"NumericLiteral":{const t=o;t.extra=Object.assign(Object.assign({},t.extra),{raw:n.text.slice(t.start,t.end),rawValue:t.value});break}case"StringLiteral":{const t=o;t.extra=Object.assign(Object.assign({},t.extra),{raw:n.text.slice(t.start,t.end),rawValue:t.value});break}}return o}function h(t,e,s,{end:n=x(e),hasParentParens:r=!1}={}){if(l(t))return e;const i=a(t),o=d(i);return c(s.optional||o?"OptionalMemberExpression":"MemberExpression",Object.assign({object:i,property:e,computed:s.computed},s.optional?{optional:!0}:o?{optional:!1}:null),{start:v(i),end:n},{hasParentParens:r})}function p(t,e){return gt.findFrontChar(t,e,n.text)}function u(t,e){return gt.findBackChar(t,e,n.text)}function l(t){return t.span.start>=t.span.end}function d(t){return("OptionalCallExpression"===t.type||"OptionalMemberExpression"===t.type)&&!f(t)}function f(t){return t.extra&&t.extra.parenthesized}function v(t){return f(t)?t.extra.parenStart:t.start}function x(t){return f(t)?t.extra.parenEnd:t.end}},e.transformSpan=s})),yt=r((function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.transformTemplateBindings=function(t,e){t.forEach((function(t){d(t.key.span),l(t)&&t.value&&d(t.value.span)}));const[s]=t,{key:n}=s,r=0===e.text.slice(s.sourceSpan.start,s.sourceSpan.end).trim().length?t.slice(1):t,i=[];let a=null;for(let t=0;t<r.length;t++){const s=r[t];if(a&&u(a)&&l(s)&&s.value&&s.value.source===a.key.source){const t=h("NGMicrosyntaxKey",{name:s.key.source},s.key.span),n=(t,s)=>Object.assign(Object.assign({},t),mt.transformSpan({start:t.start,end:s},e)),r=e=>Object.assign(Object.assign({},n(e,t.end)),{alias:t}),a=i.pop();if("NGMicrosyntaxExpression"===a.type)i.push(r(a));else{if("NGMicrosyntaxKeyedExpression"!==a.type)throw new Error("Unexpected type ".concat(a.type));{const t=r(a.expression);i.push(n(Object.assign(Object.assign({},a),{expression:t}),t.end))}}}else i.push(o(s,t));a=s}return h("NGMicrosyntax",{body:i},0===i.length?t[0].sourceSpan:{start:i[0].start,end:i[i.length-1].end});function o(t,s){if(u(t)){const{key:e,value:n}=t;return n?0===s?h("NGMicrosyntaxExpression",{expression:c(n.ast),alias:null},n.sourceSpan):h("NGMicrosyntaxKeyedExpression",{key:h("NGMicrosyntaxKey",{name:p(e.source)},e.span),expression:h("NGMicrosyntaxExpression",{expression:c(n.ast),alias:null},n.sourceSpan)},{start:e.span.start,end:n.sourceSpan.end}):h("NGMicrosyntaxKey",{name:p(e.source)},e.span)}{const{key:s,sourceSpan:n}=t;if(/^let\s$/.test(e.text.slice(n.start,n.start+4))){const{value:e}=t;return h("NGMicrosyntaxLet",{key:h("NGMicrosyntaxKey",{name:s.source},s.span),value:e?h("NGMicrosyntaxKey",{name:e.source},e.span):null},{start:n.start,end:e?e.span.end:s.span.end})}{const n=function(t){if(!t.value||t.value.source!==gt.NG_PARSE_TEMPLATE_BINDINGS_FAKE_PREFIX)return t.value;const s=gt.findBackChar(/\S/,t.sourceSpan.start,e.text);return{source:"$implicit",span:{start:s,end:s}}}(t);return h("NGMicrosyntaxAs",{key:h("NGMicrosyntaxKey",{name:n.source},n.span),alias:h("NGMicrosyntaxKey",{name:s.source},s.span)},{start:n.span.start,end:s.span.end})}}}function c(t){return mt.transform(t,e)}function h(t,s,n,r=!0){return Object.assign(Object.assign({type:t},mt.transformSpan(n,e,r)),s)}function p(t){return gt.toLowerCamelCase(t.slice(n.source.length))}function u(t){return t instanceof F.ExpressionBinding}function l(t){return t instanceof F.VariableBinding}function d(t){if('"'!==e.text[t.start]&&"'"!==e.text[t.start])return;const s=e.text[t.start];let n=!1;for(let r=t.start+1;r<e.text.length;r++)switch(e.text[r]){case s:if(!n)return void(t.end=r+1);default:n=!1;break;case"\\":n=!n}}}})),St=r((function(t,e){function s(t,e){const{ast:s,comments:n}=e(t),r=new o.Context(t),i=t=>mt.transform(t,r),a=i(s);return a.comments=n.map(i),a}Object.defineProperty(e,"__esModule",{value:!0}),e.parseBinding=function(t){return s(t,gt.parseNgBinding)},e.parseSimpleBinding=function(t){return s(t,gt.parseNgSimpleBinding)},e.parseInterpolation=function(t){return s(t,gt.parseNgInterpolation)},e.parseAction=function(t){return s(t,gt.parseNgAction)},e.parseTemplateBindings=function(t){return yt.transformTemplateBindings(gt.parseNgTemplateBindings(t),new o.Context(t))}}));const{locStart:wt,locEnd:Ct}=n;function Pt(t){return{astFormat:"estree",parse:(e,s,n)=>{const r=t(e,St);return{type:"NGRoot",node:"__ng_action"===n.parser&&"NGChainedExpression"!==r.type?Object.assign({},r,{type:"NGChainedExpression",expressions:[r]}):r}},locStart:wt,locEnd:Ct}}return{parsers:{__ng_action:Pt(((t,e)=>e.parseAction(t))),__ng_binding:Pt(((t,e)=>e.parseBinding(t))),__ng_interpolation:Pt(((t,e)=>e.parseInterpolation(t))),__ng_directive:Pt(((t,e)=>e.parseTemplateBindings(t)))}}}));
|