!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e.prettierPlugins=e.prettierPlugins||{},e.prettierPlugins.angular=t())}(this,function(){"use strict";var e=function(e){return e.length>0?e[e.length-1]:null};var t={locStart:function e(t,n){return!(n=n||{}).ignoreDecorators&&t.declaration&&t.declaration.decorators&&t.declaration.decorators.length>0?e(t.declaration.decorators[0]):!n.ignoreDecorators&&t.decorators&&t.decorators.length>0?e(t.decorators[0]):t.__location?t.__location.startOffset:t.range?t.range[0]:"number"==typeof t.start?t.start:t.loc?t.loc.start:null},locEnd:function t(n){var i=n.nodes&&e(n.nodes);if(i&&n.source&&!n.source.end&&(n=i),n.__location)return n.__location.endOffset;var r=n.range?n.range[1]:"number"==typeof n.end?n.end:null;return n.typeAnnotation?Math.max(r,t(n.typeAnnotation)):n.loc&&!r?n.loc.end:r}};function n(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function i(e,t){return e(t={exports:{}},t.exports),t.exports}function r(e){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function s(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){for(var n=0;nthis.string.length)return null;for(var t=0,n=this.offsets;n[t+1]<=e;)t++;return{line:t,column:e-n[t]}},e.prototype.indexForLocation=function(e){var t=e.line,n=e.column;return t<0||t>=this.offsets.length?null:n<0||n>this.lengthOfLine(t)?null:this.offsets[t]+n},e.prototype.lengthOfLine=function(e){var t=this.offsets[e];return(e===this.offsets.length-1?this.string.length:this.offsets[e+1])-t},e}();t.__esModule=!0,t.default=r});n(d);var y=i(function(e,t){Object.defineProperty(t,"__esModule",{value:!0});t.Context=function e(t){s(this,e),this.text=t,this.locator=new n(this.text)};var n=function(){function e(t){s(this,e),this._lineAndColumn=new d.default(t)}return o(e,[{key:"locationForIndex",value:function(e){var t=this._lineAndColumn.locationForIndex(e);return{line:t.line+1,column:t.column}}}]),e}()});n(y);var x=function e(t,n,i,r){s(this,e),this.input=n,this.errLocation=i,this.ctxLocation=r,this.message="Parser Error: ".concat(t," ").concat(i," [").concat(n,"] in ").concat(r)},g=function e(t,n){s(this,e),this.start=t,this.end=n},k=function(){function e(t){s(this,e),this.span=t}return o(e,[{key:"visit",value:function(e){arguments.length>1&&void 0!==arguments[1]&&arguments[1];return null}},{key:"toString",value:function(){return"AST"}}]),e}(),m=function(e){function t(e,n,i,r){var a;return s(this,t),(a=h(this,l(t).call(this,e))).prefix=n,a.uninterpretedExpression=i,a.location=r,a}return u(t,k),o(t,[{key:"visit",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return e.visitQuote(this,t)}},{key:"toString",value:function(){return"Quote"}}]),t}(),w=function(e){function t(){return s(this,t),h(this,l(t).apply(this,arguments))}return u(t,k),o(t,[{key:"visit",value:function(e){arguments.length>1&&void 0!==arguments[1]&&arguments[1]}}]),t}(),C=function(e){function t(){return s(this,t),h(this,l(t).apply(this,arguments))}return u(t,k),o(t,[{key:"visit",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return e.visitImplicitReceiver(this,t)}}]),t}(),P=function(e){function t(e,n){var i;return s(this,t),(i=h(this,l(t).call(this,e))).expressions=n,i}return u(t,k),o(t,[{key:"visit",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return e.visitChain(this,t)}}]),t}(),b=function(e){function t(e,n,i,r){var a;return s(this,t),(a=h(this,l(t).call(this,e))).condition=n,a.trueExp=i,a.falseExp=r,a}return u(t,k),o(t,[{key:"visit",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return e.visitConditional(this,t)}}]),t}(),E=function(e){function t(e,n,i){var r;return s(this,t),(r=h(this,l(t).call(this,e))).receiver=n,r.name=i,r}return u(t,k),o(t,[{key:"visit",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return e.visitPropertyRead(this,t)}}]),t}(),A=function(e){function t(e,n,i,r){var a;return s(this,t),(a=h(this,l(t).call(this,e))).receiver=n,a.name=i,a.value=r,a}return u(t,k),o(t,[{key:"visit",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return e.visitPropertyWrite(this,t)}}]),t}(),S=function(e){function t(e,n,i){var r;return s(this,t),(r=h(this,l(t).call(this,e))).receiver=n,r.name=i,r}return u(t,k),o(t,[{key:"visit",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return e.visitSafePropertyRead(this,t)}}]),t}(),N=function(e){function t(e,n,i){var r;return s(this,t),(r=h(this,l(t).call(this,e))).obj=n,r.key=i,r}return u(t,k),o(t,[{key:"visit",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return e.visitKeyedRead(this,t)}}]),t}(),O=function(e){function t(e,n,i,r){var a;return s(this,t),(a=h(this,l(t).call(this,e))).obj=n,a.key=i,a.value=r,a}return u(t,k),o(t,[{key:"visit",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return e.visitKeyedWrite(this,t)}}]),t}(),I=function(e){function t(e,n,i,r){var a;return s(this,t),(a=h(this,l(t).call(this,e))).exp=n,a.name=i,a.args=r,a}return u(t,k),o(t,[{key:"visit",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return e.visitPipe(this,t)}}]),t}(),L=function(e){function t(e,n){var i;return s(this,t),(i=h(this,l(t).call(this,e))).value=n,i}return u(t,k),o(t,[{key:"visit",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return e.visitLiteralPrimitive(this,t)}}]),t}(),M=function(e){function t(e,n){var i;return s(this,t),(i=h(this,l(t).call(this,e))).expressions=n,i}return u(t,k),o(t,[{key:"visit",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return e.visitLiteralArray(this,t)}}]),t}(),_=function(e){function t(e,n,i){var r;return s(this,t),(r=h(this,l(t).call(this,e))).keys=n,r.values=i,r}return u(t,k),o(t,[{key:"visit",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return e.visitLiteralMap(this,t)}}]),t}(),K=function(e){function t(e,n,i){var r;return s(this,t),(r=h(this,l(t).call(this,e))).strings=n,r.expressions=i,r}return u(t,k),o(t,[{key:"visit",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return e.visitInterpolation(this,t)}}]),t}(),T=function(e){function t(e,n,i,r){var a;return s(this,t),(a=h(this,l(t).call(this,e))).operation=n,a.left=i,a.right=r,a}return u(t,k),o(t,[{key:"visit",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return e.visitBinary(this,t)}}]),t}(),B=function(e){function t(e,n){var i;return s(this,t),(i=h(this,l(t).call(this,e))).expression=n,i}return u(t,k),o(t,[{key:"visit",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return e.visitPrefixNot(this,t)}}]),t}(),R=function(e){function t(e,n){var i;return s(this,t),(i=h(this,l(t).call(this,e))).expression=n,i}return u(t,k),o(t,[{key:"visit",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return e.visitNonNullAssert(this,t)}}]),t}(),j=function(e){function t(e,n,i,r){var a;return s(this,t),(a=h(this,l(t).call(this,e))).receiver=n,a.name=i,a.args=r,a}return u(t,k),o(t,[{key:"visit",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return e.visitMethodCall(this,t)}}]),t}(),F=function(e){function t(e,n,i,r){var a;return s(this,t),(a=h(this,l(t).call(this,e))).receiver=n,a.name=i,a.args=r,a}return u(t,k),o(t,[{key:"visit",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return e.visitSafeMethodCall(this,t)}}]),t}(),V=function(e){function t(e,n,i){var r;return s(this,t),(r=h(this,l(t).call(this,e))).target=n,r.args=i,r}return u(t,k),o(t,[{key:"visit",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return e.visitFunctionCall(this,t)}}]),t}(),G=function(e){function t(e,n,i,r){var a;return s(this,t),(a=h(this,l(t).call(this,new g(0,null==n?0:n.length)))).ast=e,a.source=n,a.location=i,a.errors=r,a}return u(t,k),o(t,[{key:"visit",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return this.ast.visit(e,t)}},{key:"toString",value:function(){return"".concat(this.source," in ").concat(this.location)}}]),t}(),W=function e(t,n,i,r,a){s(this,e),this.span=t,this.key=n,this.keyIsVar=i,this.name=r,this.expression=a},U=function(){function e(){s(this,e)}return o(e,[{key:"visitBinary",value:function(e,t){}},{key:"visitChain",value:function(e,t){}},{key:"visitConditional",value:function(e,t){}},{key:"visitFunctionCall",value:function(e,t){}},{key:"visitImplicitReceiver",value:function(e,t){}},{key:"visitInterpolation",value:function(e,t){}},{key:"visitKeyedRead",value:function(e,t){}},{key:"visitKeyedWrite",value:function(e,t){}},{key:"visitLiteralArray",value:function(e,t){}},{key:"visitLiteralMap",value:function(e,t){}},{key:"visitLiteralPrimitive",value:function(e,t){}},{key:"visitMethodCall",value:function(e,t){}},{key:"visitPipe",value:function(e,t){}},{key:"visitPrefixNot",value:function(e,t){}},{key:"visitNonNullAssert",value:function(e,t){}},{key:"visitPropertyRead",value:function(e,t){}},{key:"visitPropertyWrite",value:function(e,t){}},{key:"visitQuote",value:function(e,t){}},{key:"visitSafeMethodCall",value:function(e,t){}},{key:"visitSafePropertyRead",value:function(e,t){}}]),e}(),Q=function(){function e(){s(this,e)}return o(e,[{key:"visitBinary",value:function(e,t){return e.left.visit(this),e.right.visit(this),null}},{key:"visitChain",value:function(e,t){return this.visitAll(e.expressions,t)}},{key:"visitConditional",value:function(e,t){return e.condition.visit(this),e.trueExp.visit(this),e.falseExp.visit(this),null}},{key:"visitPipe",value:function(e,t){return e.exp.visit(this),this.visitAll(e.args,t),null}},{key:"visitFunctionCall",value:function(e,t){return e.target.visit(this),this.visitAll(e.args,t),null}},{key:"visitImplicitReceiver",value:function(e,t){return null}},{key:"visitInterpolation",value:function(e,t){return this.visitAll(e.expressions,t)}},{key:"visitKeyedRead",value:function(e,t){return e.obj.visit(this),e.key.visit(this),null}},{key:"visitKeyedWrite",value:function(e,t){return e.obj.visit(this),e.key.visit(this),e.value.visit(this),null}},{key:"visitLiteralArray",value:function(e,t){return this.visitAll(e.expressions,t)}},{key:"visitLiteralMap",value:function(e,t){return this.visitAll(e.values,t)}},{key:"visitLiteralPrimitive",value:function(e,t){return null}},{key:"visitMethodCall",value:function(e,t){return e.receiver.visit(this),this.visitAll(e.args,t)}},{key:"visitPrefixNot",value:function(e,t){return e.expression.visit(this),null}},{key:"visitNonNullAssert",value:function(e,t){return e.expression.visit(this),null}},{key:"visitPropertyRead",value:function(e,t){return e.receiver.visit(this),null}},{key:"visitPropertyWrite",value:function(e,t){return e.receiver.visit(this),e.value.visit(this),null}},{key:"visitSafePropertyRead",value:function(e,t){return e.receiver.visit(this),null}},{key:"visitSafeMethodCall",value:function(e,t){return e.receiver.visit(this),this.visitAll(e.args,t)}},{key:"visitAll",value:function(e,t){var n=this;return e.forEach(function(e){return e.visit(n,t)}),null}},{key:"visitQuote",value:function(e,t){return null}}]),e}(),z=function(){function e(){s(this,e)}return o(e,[{key:"visitImplicitReceiver",value:function(e,t){return e}},{key:"visitInterpolation",value:function(e,t){return new K(e.span,e.strings,this.visitAll(e.expressions))}},{key:"visitLiteralPrimitive",value:function(e,t){return new L(e.span,e.value)}},{key:"visitPropertyRead",value:function(e,t){return new E(e.span,e.receiver.visit(this),e.name)}},{key:"visitPropertyWrite",value:function(e,t){return new A(e.span,e.receiver.visit(this),e.name,e.value.visit(this))}},{key:"visitSafePropertyRead",value:function(e,t){return new S(e.span,e.receiver.visit(this),e.name)}},{key:"visitMethodCall",value:function(e,t){return new j(e.span,e.receiver.visit(this),e.name,this.visitAll(e.args))}},{key:"visitSafeMethodCall",value:function(e,t){return new F(e.span,e.receiver.visit(this),e.name,this.visitAll(e.args))}},{key:"visitFunctionCall",value:function(e,t){return new V(e.span,e.target.visit(this),this.visitAll(e.args))}},{key:"visitLiteralArray",value:function(e,t){return new M(e.span,this.visitAll(e.expressions))}},{key:"visitLiteralMap",value:function(e,t){return new _(e.span,e.keys,this.visitAll(e.values))}},{key:"visitBinary",value:function(e,t){return new T(e.span,e.operation,e.left.visit(this),e.right.visit(this))}},{key:"visitPrefixNot",value:function(e,t){return new B(e.span,e.expression.visit(this))}},{key:"visitNonNullAssert",value:function(e,t){return new R(e.span,e.expression.visit(this))}},{key:"visitConditional",value:function(e,t){return new b(e.span,e.condition.visit(this),e.trueExp.visit(this),e.falseExp.visit(this))}},{key:"visitPipe",value:function(e,t){return new I(e.span,e.exp.visit(this),e.name,this.visitAll(e.args))}},{key:"visitKeyedRead",value:function(e,t){return new N(e.span,e.obj.visit(this),e.key.visit(this))}},{key:"visitKeyedWrite",value:function(e,t){return new O(e.span,e.obj.visit(this),e.key.visit(this),e.value.visit(this))}},{key:"visitAll",value:function(e){for(var t=new Array(e.length),n=0;n=this.length?J:this.input.charCodeAt(this.index)}},{key:"scanToken",value:function(){for(var e=this.input,t=this.length,n=this.peek,i=this.index;n<=ne;){if(++i>=t){n=J;break}n=e.charCodeAt(i)}if(this.peek=n,this.index=i,i>=t)return null;if(Me(n))return this.scanIdentifier();if(be(n))return this.scanNumber(i);var r,s=i;switch(n){case 46:return this.advance(),be(this.peek)?this.scanNumber(s):Ne(s,46);case 40:case 41:case 123:case 125:case 91:case 93:case 44:case 58:case 59:return this.scanCharacter(s,n);case se:case ie:return this.scanString();case 35:case ae:case oe:case 42:case 47:case 37:case 94:return this.scanOperator(s,String.fromCharCode(n));case 63:return this.scanComplexOperator(s,"?",46,".");case 60:case 62:return this.scanComplexOperator(s,String.fromCharCode(n),61,"=");case 33:case 61:return this.scanComplexOperator(s,String.fromCharCode(n),61,"=",61,"=");case 38:return this.scanComplexOperator(s,"&",38,"&");case 124:return this.scanComplexOperator(s,"|",124,"|");case Ce:for(;(r=this.peek)>=X&&r<=ne||r==Ce;)this.advance();return this.scanToken()}return this.advance(),this.error("Unexpected character [".concat(String.fromCharCode(n),"]"),0)}},{key:"scanCharacter",value:function(e,t){return this.advance(),Ne(e,t)}},{key:"scanOperator",value:function(e,t){return this.advance(),Oe(e,t)}},{key:"scanComplexOperator",value:function(e,t,n,i,r,s){this.advance();var a=t;return this.peek==n&&(this.advance(),a+=i),null!=r&&this.peek==r&&(this.advance(),a+=s),Oe(e,a)}},{key:"scanIdentifier",value:function(){var e=this.index;for(this.advance();Ke(this.peek);)this.advance();var t,n=this.input.substring(e,this.index);return Ee.indexOf(n)>-1?(t=n,new Se(e,D.Keyword,0,t)):function(e,t){return new Se(e,D.Identifier,0,t)}(e,n)}},{key:"scanNumber",value:function(e){var t,n=this.index===e;for(this.advance();;){if(be(this.peek));else if(46==this.peek)n=!1;else{if((t=this.peek)!=de&&t!=he)break;if(this.advance(),Te(this.peek)&&this.advance(),!be(this.peek))return this.error("Invalid exponent",-1);n=!1}this.advance()}var i,r=this.input.substring(e,this.index),s=n?function(e){var t=parseInt(e);if(isNaN(t))throw new Error("Invalid integer literal when parsing "+e);return t}(r):parseFloat(r);return i=s,new Se(e,D.Number,i,"")}},{key:"scanString",value:function(){var e=this.index,t=this.peek;this.advance();for(var n="",i=this.index,r=this.input;this.peek!=t;)if(92==this.peek){n+=r.substring(i,this.index),this.advance();var s=void 0;if(this.peek=this.peek,117==this.peek){var a=r.substring(this.index+1,this.index+5);if(!/^[0-9a-f]+$/i.test(a))return this.error("Invalid unicode escape [\\u".concat(a,"]"),0);s=parseInt(a,16);for(var o=0;o<5;o++)this.advance()}else s=Re(this.peek),this.advance();n+=String.fromCharCode(s),i=this.index}else{if(this.peek==J)return this.error("Unterminated quote",0);this.advance()}var u,l=r.substring(i,this.index);return this.advance(),u=n+l,new Se(e,D.String,0,u)}},{key:"error",value:function(e,t){var n=this.index+t;return function(e,t){return new Se(e,D.Error,0,t)}(n,"Lexer Error: ".concat(e," at column ").concat(n," in expression [").concat(this.input,"]"))}}]),e}();function Me(e){return fe<=e&&e<=we||ce<=e&&e<=pe||e==ve||e==re}function _e(e){if(0==e.length)return!1;var t=new Le(e);if(!Me(t.peek))return!1;for(t.advance();t.peek!==J;){if(!Ke(t.peek))return!1;t.advance()}return!0}function Ke(e){return function(e){return e>=fe&&e<=we||e>=ce&&e<=pe}(e)||be(e)||e==ve||e==re}function Te(e){return e==oe||e==ae}function Be(e){return e===se||e===ie||e===Pe}function Re(e){switch(e){case xe:return Y;case ye:return ee;case ge:return te;case ke:return X;case me:return Z;default:return e}}var je=Object.freeze({get TokenType(){return D},Lexer:Ae,Token:Se,EOF:Ie,isIdentifier:_e,isQuote:Be}),Fe=[/^\s*$/,/[<>]/,/^[{}]$/,/&(#|[a-z])/i,/^\/\//];var Ve=new(function(){function e(t,n){s(this,e),this.start=t,this.end=n}return o(e,null,[{key:"fromArray",value:function(t){return t?(function(e,t){if(!(null==t||Array.isArray(t)&&2==t.length))throw new Error("Expected '".concat(e,"' to be an array, [start, end]."));if(null!=t){var n=t[0],i=t[1];Fe.forEach(function(e){if(e.test(n)||e.test(i))throw new Error("['".concat(n,"', '").concat(i,"'] contains unusable interpolation symbol."))})}}("interpolation",t),new e(t[0],t[1])):Ve}}]),e}())("{{","}}");function Ge(e){return e.replace(/([.*+?^=!:${}()|[\]\/\\])/g,"\\$1")}Object.getPrototypeOf({});var We=function e(t,n,i){s(this,e),this.strings=t,this.expressions=n,this.offsets=i},Ue=function e(t,n,i){s(this,e),this.templateBindings=t,this.warnings=n,this.errors=i};function Qe(e){var t=Ge(e.start)+"([\\s\\S]*?)"+Ge(e.end);return new RegExp(t,"g")}var ze=function(){function e(t){s(this,e),this._lexer=t,this.errors=[]}return o(e,[{key:"parseAction",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:Ve;this._checkNoInterpolation(e,t,n);var i=this._stripComments(e),r=this._lexer.tokenize(this._stripComments(e)),s=new $e(e,t,r,i.length,!0,this.errors,e.length-i.length).parseChain();return new G(s,e,t,this.errors)}},{key:"parseBinding",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:Ve,i=this._parseBindingAst(e,t,n);return new G(i,e,t,this.errors)}},{key:"parseSimpleBinding",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:Ve,i=this._parseBindingAst(e,t,n),r=qe.check(i);return r.length>0&&this._reportError("Host binding expression cannot contain ".concat(r.join(" ")),e,t),new G(i,e,t,this.errors)}},{key:"_reportError",value:function(e,t,n,i){this.errors.push(new x(e,t,n,i))}},{key:"_parseBindingAst",value:function(e,t,n){var i=this._parseQuote(e,t);if(null!=i)return i;this._checkNoInterpolation(e,t,n);var r=this._stripComments(e),s=this._lexer.tokenize(r);return new $e(e,t,s,r.length,!1,this.errors,e.length-r.length).parseChain()}},{key:"_parseQuote",value:function(e,t){if(null==e)return null;var n=e.indexOf(":");if(-1==n)return null;var i=e.substring(0,n).trim();if(!_e(i))return null;var r=e.substring(n+1);return new m(new g(0,e.length),i,r,t)}},{key:"parseTemplateBindings",value:function(e,t,n){var i=this._lexer.tokenize(t);return new $e(t,n,i,t.length,!1,this.errors,0).parseTemplateBindings(e)}},{key:"parseInterpolation",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:Ve,i=this.splitInterpolation(e,t,n);if(null==i)return null;for(var r=[],s=0;s2&&void 0!==arguments[2]?arguments[2]:Ve,i=Qe(n),r=e.split(i);if(r.length<=1)return null;for(var s=[],a=[],o=[],u=0,l=0;l0?(u+=n.start.length,a.push(c),o.push(u),u+=c.length+n.end.length):(this._reportError("Blank expressions are not allowed in interpolated strings",e,"at column ".concat(this._findInterpolationErrorColumn(r,l,n)," in"),t),a.push("$implict"),o.push(u))}return new We(s,a,o)}},{key:"wrapLiteralPrimitive",value:function(e,t){return new G(new L(new g(0,null==e?0:e.length),e),e,t,this.errors)}},{key:"_stripComments",value:function(e){var t=this._commentStart(e);return null!=t?e.substring(0,t).trim():e}},{key:"_commentStart",value:function(e){for(var t=null,n=0;n1&&this._reportError("Got interpolation (".concat(n.start).concat(n.end,") where expression was expected"),e,"at column ".concat(this._findInterpolationErrorColumn(r,1,n)," in"),t)}},{key:"_findInterpolationErrorColumn",value:function(e,t,n){for(var i="",r=0;r":case"<=":case">=":this.advance();var n=this.parseAdditive();e=new T(this.span(e.span.start),t,e,n);continue}break}return e}},{key:"parseAdditive",value:function(){for(var e=this.parseMultiplicative();this.next.type==D.Operator;){var t=this.next.strValue;switch(t){case"+":case"-":this.advance();var n=this.parseMultiplicative();e=new T(this.span(e.span.start),t,e,n);continue}break}return e}},{key:"parseMultiplicative",value:function(){for(var e=this.parsePrefix();this.next.type==D.Operator;){var t=this.next.strValue;switch(t){case"*":case"%":case"/":this.advance();var n=this.parsePrefix();e=new T(this.span(e.span.start),t,e,n);continue}break}return e}},{key:"parsePrefix",value:function(){if(this.next.type==D.Operator){var e,t=this.inputIndex,n=this.next.strValue;switch(n){case"+":return this.advance(),e=this.parsePrefix(),new T(this.span(t),"-",e,new L(new g(t,t),0));case"-":return this.advance(),e=this.parsePrefix(),new T(this.span(t),n,new L(new g(t,t),0),e);case"!":return this.advance(),e=this.parsePrefix(),new B(this.span(t),e)}}return this.parseCallChain()}},{key:"parseCallChain",value:function(){for(var e=this.parsePrimary();;)if(this.optionalCharacter(46))e=this.parseAccessMemberOrMethodCall(e,!1);else if(this.optionalOperator("?."))e=this.parseAccessMemberOrMethodCall(e,!0);else if(this.optionalCharacter(91)){this.rbracketsExpected++;var t=this.parsePipe();if(this.rbracketsExpected--,this.expectCharacter(93),this.optionalOperator("=")){var n=this.parseConditional();e=new O(this.span(e.span.start),e,t,n)}else e=new N(this.span(e.span.start),e,t)}else if(this.optionalCharacter(40)){this.rparensExpected++;var i=this.parseCallArguments();this.rparensExpected--,this.expectCharacter(41),e=new V(this.span(e.span.start),e,i)}else{if(!this.optionalOperator("!"))return e;e=new R(this.span(e.span.start),e)}}},{key:"parsePrimary",value:function(){var e=this.inputIndex;if(this.optionalCharacter(40)){this.rparensExpected++;var t=this.parsePipe();return this.rparensExpected--,this.expectCharacter(41),t}if(this.next.isKeywordNull())return this.advance(),new L(this.span(e),null);if(this.next.isKeywordUndefined())return this.advance(),new L(this.span(e),void 0);if(this.next.isKeywordTrue())return this.advance(),new L(this.span(e),!0);if(this.next.isKeywordFalse())return this.advance(),new L(this.span(e),!1);if(this.next.isKeywordThis())return this.advance(),new C(this.span(e));if(this.optionalCharacter(91)){this.rbracketsExpected++;var n=this.parseExpressionList(93);return this.rbracketsExpected--,this.expectCharacter(93),new M(this.span(e),n)}if(this.next.isCharacter(123))return this.parseLiteralMap();if(this.next.isIdentifier())return this.parseAccessMemberOrMethodCall(new C(this.span(e)),!1);if(this.next.isNumber()){var i=this.next.toNumber();return this.advance(),new L(this.span(e),i)}if(this.next.isString()){var r=this.next.toString();return this.advance(),new L(this.span(e),r)}return this.index>=this.tokens.length?(this.error("Unexpected end of expression: ".concat(this.input)),new w(this.span(e))):(this.error("Unexpected token ".concat(this.next)),new w(this.span(e)))}},{key:"parseExpressionList",value:function(e){var t=[];if(!this.next.isCharacter(e))do{t.push(this.parsePipe())}while(this.optionalCharacter(44));return t}},{key:"parseLiteralMap",value:function(){var e=[],t=[],n=this.inputIndex;if(this.expectCharacter(123),!this.optionalCharacter(125)){this.rbracesExpected++;do{var i=this.next.isString(),r=this.expectIdentifierOrKeywordOrString();e.push({key:r,quoted:i}),this.expectCharacter(58),t.push(this.parsePipe())}while(this.optionalCharacter(44));this.rbracesExpected--,this.expectCharacter(125)}return new _(this.span(n),e,t)}},{key:"parseAccessMemberOrMethodCall",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=e.span.start,i=this.expectIdentifierOrKeyword();if(this.optionalCharacter(40)){this.rparensExpected++;var r=this.parseCallArguments();this.expectCharacter(41),this.rparensExpected--;var s=this.span(n);return t?new F(s,e,i,r):new j(s,e,i,r)}if(t)return this.optionalOperator("=")?(this.error("The '?.' operator cannot be used in the assignment"),new w(this.span(n))):new S(this.span(n),e,i);if(this.optionalOperator("=")){if(!this.parseAction)return this.error("Bindings cannot contain assignments"),new w(this.span(n));var a=this.parseConditional();return new A(this.span(n),e,i,a)}return new E(this.span(n),e,i)}},{key:"parseCallArguments",value:function(){if(this.next.isCharacter(41))return[];var e=[];do{e.push(this.parsePipe())}while(this.optionalCharacter(44));return e}},{key:"expectTemplateBindingKey",value:function(){var e="",t=!1;do{e+=this.expectIdentifierOrKeywordOrString(),(t=this.optionalOperator("-"))&&(e+="-")}while(t);return e.toString()}},{key:"parseTemplateBindings",value:function(e){var t=!0,n=[];do{var i=this.inputIndex,r=void 0,s=void 0,a=!1;t?(r=s=e,t=!1):((a=this.peekKeywordLet())&&this.advance(),r=this.expectTemplateBindingKey(),s=a?r:e+r[0].toUpperCase()+r.substring(1),this.optionalCharacter(58));var o=null,u=null;if(a)o=this.optionalOperator("=")?this.expectTemplateBindingKey():"$implicit";else if(this.peekKeywordAs())this.advance(),o=r,s=this.expectTemplateBindingKey(),a=!0;else if(this.next!==Ie&&!this.peekKeywordLet()){var l=this.inputIndex,c=this.parsePipe(),h=this.input.substring(l-this.offset,this.inputIndex-this.offset);u=new G(c,h,this.location,this.errors)}if(n.push(new W(this.span(i),s,a,o,u)),this.peekKeywordAs()&&!a){var p=this.inputIndex;this.advance();var v=this.expectTemplateBindingKey();n.push(new W(this.span(p),v,!0,s,null))}this.optionalCharacter(59)||this.optionalCharacter(44)}while(this.index1&&void 0!==arguments[1]?arguments[1]:null;this.errors.push(new x(e,this.input,this.locationText(t),this.location)),this.skip()}},{key:"locationText",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;return null==e&&(e=this.index),e2&&void 0!==arguments[2]&&arguments[2],a=He.getNgType(e);switch(a){case"Binary":var o=e.left,u=e.operation,l=e.right,c=l.span.start===l.span.end,h=o.span.start===o.span.end;if(c||h){var p=o.span.start===o.span.end?le(l):le(o);return he("UnaryExpression",{prefix:!0,argument:p,operator:c?"+":"-"},{start:e.span.start,end:ge(p)},{hasParentParens:s})}var v=le(o),f=le(l);return he("&&"===u||"||"===u?"LogicalExpression":"BinaryExpression",{left:v,right:f,operator:u},{start:xe(v),end:ge(f)},{hasParentParens:s});case"BindingPipe":var d=e.exp,y=e.name,x=e.args,g=le(d),k=fe(/\S/,fe(/\|/,ge(g))+1),m=he("Identifier",{name:y},{start:k,end:k+y.length}),w=x.map(le);return he("NGPipeExpression",{left:g,right:m,arguments:w},{start:xe(g),end:ge(0===w.length?m:He.getLast(w))},{hasParentParens:s});case"Chain":return he("NGChainedExpression",{expressions:e.expressions.map(le)},e.span,{hasParentParens:s});case"Comment":return he("CommentLine",{value:e.value},e.span,{processSpan:!1});case"Conditional":var C=e.condition,P=e.trueExp,b=e.falseExp,E=le(C),A=le(P),S=le(b);return he("ConditionalExpression",{test:E,consequent:A,alternate:S},{start:xe(E),end:ge(S)},{hasParentParens:s});case"EmptyExpr":return he("NGEmptyExpression",{},e.span,{hasParentParens:s});case"FunctionCall":var N=e.target,O=e.args,I=1===O.length?[ce(O[0])]:O.map(le),L=le(N);return he("CallExpression",{callee:L,arguments:I},{start:xe(L),end:e.span.end},{hasParentParens:s});case"KeyedRead":var M=e.obj,_=e.key,K=le(M);return he("MemberExpression",{computed:!0,object:K,property:le(_)},{start:xe(K),end:e.span.end},{hasParentParens:s});case"LiteralArray":return he("ArrayExpression",{elements:e.expressions.map(le)},e.span,{hasParentParens:s});case"LiteralMap":var T=e.keys,B=e.values.map(function(e){return le(e)});return he("ObjectExpression",{properties:T.map(function(t,n){var i=t.key,r=t.quoted,s=B[n],a={start:fe(/\S/,0===n?e.span.start+1:fe(/,/,ge(B[n-1]))+1),end:ve(/\S/,ve(/:/,xe(s)-1)-1)+1},o=r?he("StringLiteral",{value:i},a):he("Identifier",{name:i},a);return he("ObjectProperty",{key:o,value:s,method:!1,shorthand:!1,computed:!1},{start:xe(o),end:ge(s)})})},e.span,{hasParentParens:s});case"LiteralPrimitive":var R=e.value;switch(r(R)){case"boolean":return he("BooleanLiteral",{value:R},e.span,{hasParentParens:s});case"number":return he("NumericLiteral",{value:R},e.span,{hasParentParens:s});case"object":return he("NullLiteral",{},e.span,{hasParentParens:s});case"string":return he("StringLiteral",{value:R},e.span,{hasParentParens:s});case"undefined":return he("Identifier",{name:"undefined"},e.span,{hasParentParens:s});default:throw new Error("Unexpected LiteralPrimitive value type ".concat(r(R)))}case"MethodCall":case"SafeMethodCall":var j="SafeMethodCall"===a,F=e.receiver,V=e.name,G=e.args,W=1===G.length?[ce(G[0])]:G.map(le),U=ve(/\S/,ve(/\(/,(0===W.length?ve(/\)/,e.span.end-1):xe(W[0]))-1)-1)+1,Q=pe(F,he("Identifier",{name:V},{start:U-V.length,end:U}),{computed:!1,optional:j}),z=de(Q);return he(j||z?"OptionalCallExpression":"CallExpression",{callee:Q,arguments:W},{start:xe(Q),end:e.span.end},{hasParentParens:s});case"NonNullAssert":var $=le(e.expression);return he("TSNonNullExpression",{expression:$},{start:xe($),end:e.span.end},{hasParentParens:s});case"PrefixNot":var q=le(e.expression);return he("UnaryExpression",{prefix:!0,operator:"!",argument:q},{start:e.span.start,end:ge(q)},{hasParentParens:s});case"PropertyRead":case"SafePropertyRead":var D="SafePropertyRead"===a,H=e.receiver,J=e.name,X=ve(/\S/,e.span.end-1)+1;return pe(H,he("Identifier",{name:J},{start:X-J.length,end:X},H.span.start===H.span.end?{hasParentParens:s}:{}),{computed:!1,optional:D},{hasParentParens:s});case"KeyedWrite":var Y=e.obj,Z=e.key,ee=e.value,te=le(Z),ne=le(ee),ie=pe(Y,te,{computed:!0,optional:!1},{end:fe(/\]/,ge(te))+1});return he("AssignmentExpression",{left:ie,operator:"=",right:ne},{start:xe(ie),end:ge(ne)},{hasParentParens:s});case"PropertyWrite":var re=e.receiver,se=e.name,ae=le(e.value),oe=ve(/\S/,ve(/=/,xe(ae)-1)-1)+1,ue=pe(re,he("Identifier",{name:se},{start:oe-se.length,end:oe}),{computed:!1,optional:!1});return he("AssignmentExpression",{left:ue,operator:"=",right:ae},{start:xe(ue),end:ge(ae)},{hasParentParens:s});case"Quote":return he("NGQuotedExpression",{prefix:e.prefix,value:e.uninterpretedExpression},e.span,{hasParentParens:s});default:throw new Error("Unexpected node ".concat(a))}function le(e){return t.transform(e,i)}function ce(e){return t.transform(e,i,!0)}function he(e,t,r){var s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},a=s.processSpan,o=void 0===a||a,u=s.hasParentParens,l=void 0!==u&&u,c=Object.assign({type:e},n(r,i,o,l),t);switch(e){case"Identifier":var h=c;h.loc.identifierName=h.name;break;case"NumericLiteral":var p=c;p.extra=Object.assign({},p.extra,{raw:i.text.slice(p.start,p.end),rawValue:p.value});break;case"StringLiteral":var v=c;v.extra=Object.assign({},v.extra,{raw:i.text.slice(v.start,v.end),rawValue:v.value})}return c}function pe(e,t,n){var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},r=i.end,s=void 0===r?ge(t):r,a=i.hasParentParens,o=void 0!==a&&a;if(e.span.start===e.span.end)return t;var u="ImplicitReceiver"===He.getNgType(e)?he("ThisExpression",{},e.span):le(e),l=de(u);return he(n.optional||l?"OptionalMemberExpression":"MemberExpression",Object.assign({object:u,property:t,computed:n.computed},n.optional?{optional:!0}:l?{optional:!1}:null),{start:xe(u),end:s},{hasParentParens:o})}function ve(e,t){return He.findFrontChar(e,t,i.text)}function fe(e,t){return He.findBackChar(e,t,i.text)}function de(e){return("OptionalCallExpression"===e.type||"OptionalMemberExpression"===e.type)&&!ye(e)}function ye(e){return e.extra&&e.extra.parenthesized}function xe(e){return ye(e)?e.extra.parenStart:e.start}function ge(e){return ye(e)?e.extra.parenEnd:e.end}},t.transformSpan=n});n(Je);var Xe=i(function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.transformTemplateBindings=function(e,t){for(var n=p(e,1)[0],i=n.key,r=0===t.text.slice(n.span.start,n.span.end).trim().length?e.slice(1):e,s=[],a=null,o=0;o3&&void 0!==arguments[3])||arguments[3];return Object.assign({type:e},Je.transformSpan(i,t,r,!1),n)}function x(e,n){if("'"!==t.text[e]&&'"'!==t.text[e])return{start:e,end:e+n.length};for(var i=t.text[e],r=0,s=e+1;;){var a=t.text[s];if(a===i&&r%2==0)return{start:e,end:s+1};"\\"===a?r++:r=0,s++}}function g(e){return He.toLowerCamelCase(e.slice(i.length))}}});n(Xe);var Ye=i(function(e,t){function n(e,t){var n=t(e),i=n.ast,r=n.comments,s=new y.Context(e),a=function(e){return Je.transform(e,s)},o=a(i);return o.comments=r.map(a),o}Object.defineProperty(t,"__esModule",{value:!0}),t.parseBinding=function(e){return n(e,He.parseNgBinding)},t.parseSimpleBinding=function(e){return n(e,He.parseNgSimpleBinding)},t.parseInterpolation=function(e){return n(e,He.parseNgInterpolation)},t.parseAction=function(e){return n(e,He.parseNgAction)},t.parseTemplateBindings=function(e){return Xe.transformTemplateBindings(He.parseNgTemplateBindings(e),new y.Context(e))}});function Ze(e){return Object.assign({astFormat:"estree",parse:function(t,n,i){var r=e(t,Ye);return{type:"NGRoot",node:"__ng_action"===i.parser&&"NGChainedExpression"!==r.type?Object.assign({},r,{type:"NGChainedExpression",expressions:[r]}):r}}},t)}return n(Ye),{parsers:{__ng_action:Ze(function(e,t){return t.parseAction(e)}),__ng_binding:Ze(function(e,t){return t.parseBinding(e)}),__ng_interpolation:Ze(function(e,t){return t.parseInterpolation(e)}),__ng_directive:Ze(function(e,t){return t.parseTemplateBindings(e)})}}});