@player-ui/player 0.7.2-next.0 → 0.7.2-next.2

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/dist/index.cjs.js CHANGED
@@ -1360,7 +1360,7 @@ function parseExpression(expr, options) {
1360
1360
  }
1361
1361
  args.push(node);
1362
1362
  }
1363
- if (charIndex !== termination) {
1363
+ if (strictMode && charIndex !== termination) {
1364
1364
  throwError(`Expected ${String.fromCharCode(termination)}`, index);
1365
1365
  }
1366
1366
  return args;
@@ -1443,7 +1443,7 @@ function parseExpression(expr, options) {
1443
1443
  const node = gobbleExpression();
1444
1444
  if (node) {
1445
1445
  nodes.push(node);
1446
- } else if (index < length) {
1446
+ } else if (strictMode && index < length) {
1447
1447
  throwError(`Unexpected "${exprI(index)}"`, index);
1448
1448
  }
1449
1449
  }
@@ -1709,7 +1709,7 @@ class ExpressionEvaluator {
1709
1709
  }
1710
1710
  let storedAST;
1711
1711
  try {
1712
- storedAST = (_a = this.expressionsCache.get(matchedExp)) != null ? _a : parseExpression(matchedExp);
1712
+ storedAST = (_a = this.expressionsCache.get(matchedExp)) != null ? _a : parseExpression(matchedExp, { strict: options.strict });
1713
1713
  this.expressionsCache.set(matchedExp, storedAST);
1714
1714
  } catch (e) {
1715
1715
  if (options.throwErrors || !this.hooks.onError.call(e)) {
@@ -4856,8 +4856,8 @@ var __async = (__this, __arguments, generator) => {
4856
4856
  step((generator = generator.apply(__this, __arguments)).next());
4857
4857
  });
4858
4858
  };
4859
- const PLAYER_VERSION = "0.7.2-next.0";
4860
- const COMMIT = "bc01b43eaf000d1a85e3c3ea6cd17b5cad312d84";
4859
+ const PLAYER_VERSION = "0.7.2-next.2";
4860
+ const COMMIT = "9c00884b3858447c923b999c32acc0b76b5b6421";
4861
4861
  const _Player = class {
4862
4862
  constructor(config) {
4863
4863
  this.logger = new TapableLogger();
package/dist/index.d.ts CHANGED
@@ -509,6 +509,8 @@ interface HookOptions extends ExpressionContext {
509
509
  * The caller is responsible for handling the error.
510
510
  */
511
511
  throwErrors?: boolean;
512
+ /** Whether expressions should be parsed strictly or not */
513
+ strict?: boolean;
512
514
  }
513
515
  declare type ExpressionEvaluatorOptions = Omit<HookOptions, 'resolveNode' | 'evaluate'>;
514
516
  declare type ExpressionEvaluatorFunction = (exp: ExpressionType, options?: ExpressionEvaluatorOptions) => any;
package/dist/index.esm.js CHANGED
@@ -1348,7 +1348,7 @@ function parseExpression(expr, options) {
1348
1348
  }
1349
1349
  args.push(node);
1350
1350
  }
1351
- if (charIndex !== termination) {
1351
+ if (strictMode && charIndex !== termination) {
1352
1352
  throwError(`Expected ${String.fromCharCode(termination)}`, index);
1353
1353
  }
1354
1354
  return args;
@@ -1431,7 +1431,7 @@ function parseExpression(expr, options) {
1431
1431
  const node = gobbleExpression();
1432
1432
  if (node) {
1433
1433
  nodes.push(node);
1434
- } else if (index < length) {
1434
+ } else if (strictMode && index < length) {
1435
1435
  throwError(`Unexpected "${exprI(index)}"`, index);
1436
1436
  }
1437
1437
  }
@@ -1697,7 +1697,7 @@ class ExpressionEvaluator {
1697
1697
  }
1698
1698
  let storedAST;
1699
1699
  try {
1700
- storedAST = (_a = this.expressionsCache.get(matchedExp)) != null ? _a : parseExpression(matchedExp);
1700
+ storedAST = (_a = this.expressionsCache.get(matchedExp)) != null ? _a : parseExpression(matchedExp, { strict: options.strict });
1701
1701
  this.expressionsCache.set(matchedExp, storedAST);
1702
1702
  } catch (e) {
1703
1703
  if (options.throwErrors || !this.hooks.onError.call(e)) {
@@ -4844,8 +4844,8 @@ var __async = (__this, __arguments, generator) => {
4844
4844
  step((generator = generator.apply(__this, __arguments)).next());
4845
4845
  });
4846
4846
  };
4847
- const PLAYER_VERSION = "0.7.2-next.0";
4848
- const COMMIT = "bc01b43eaf000d1a85e3c3ea6cd17b5cad312d84";
4847
+ const PLAYER_VERSION = "0.7.2-next.2";
4848
+ const COMMIT = "9c00884b3858447c923b999c32acc0b76b5b6421";
4849
4849
  const _Player = class {
4850
4850
  constructor(config) {
4851
4851
  this.logger = new TapableLogger();
@@ -1657,7 +1657,7 @@ function parseExpression(expr, options) {
1657
1657
  }
1658
1658
  args.push(node);
1659
1659
  }
1660
- if (charIndex !== termination) {
1660
+ if (strictMode && charIndex !== termination) {
1661
1661
  throwError(`Expected ${String.fromCharCode(termination)}`, index);
1662
1662
  }
1663
1663
  return args;
@@ -1740,7 +1740,7 @@ function parseExpression(expr, options) {
1740
1740
  const node = gobbleExpression();
1741
1741
  if (node) {
1742
1742
  nodes.push(node);
1743
- } else if (index < length) {
1743
+ } else if (strictMode && index < length) {
1744
1744
  throwError(`Unexpected "${exprI(index)}"`, index);
1745
1745
  }
1746
1746
  }
@@ -2006,7 +2006,7 @@ class ExpressionEvaluator {
2006
2006
  }
2007
2007
  let storedAST;
2008
2008
  try {
2009
- storedAST = (_a = this.expressionsCache.get(matchedExp)) != null ? _a : parseExpression(matchedExp);
2009
+ storedAST = (_a = this.expressionsCache.get(matchedExp)) != null ? _a : parseExpression(matchedExp, { strict: options.strict });
2010
2010
  this.expressionsCache.set(matchedExp, storedAST);
2011
2011
  } catch (e) {
2012
2012
  if (options.throwErrors || !this.hooks.onError.call(e)) {
@@ -5153,8 +5153,8 @@ var __async = (__this, __arguments, generator) => {
5153
5153
  step((generator = generator.apply(__this, __arguments)).next());
5154
5154
  });
5155
5155
  };
5156
- const PLAYER_VERSION = "0.7.2-next.0";
5157
- const COMMIT = "bc01b43eaf000d1a85e3c3ea6cd17b5cad312d84";
5156
+ const PLAYER_VERSION = "0.7.2-next.2";
5157
+ const COMMIT = "9c00884b3858447c923b999c32acc0b76b5b6421";
5158
5158
  const _Player = class {
5159
5159
  constructor(config) {
5160
5160
  this.logger = new TapableLogger();
@@ -1,2 +1,2 @@
1
1
  /*! For license information please see player.prod.js.LICENSE.txt */
2
- !function(e,t){"object"===typeof exports&&"object"===typeof module?module.exports=t():"function"===typeof define&&define.amd?define([],t):"object"===typeof exports?exports.Player=t():e.Player=t()}(this,(function(){return function(e){var t={};function r(n){if(t[n])return t[n].exports;var o=t[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}return r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!==typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"===typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)r.d(n,o,function(t){return e[t]}.bind(null,o));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=23)}([function(e,t,r){"use strict";function n(e,t,r){return e.context?e.callback(r,...t):e.callback(...t)}r.d(t,"a",(function(){return s})),r.d(t,"b",(function(){return a})),r.d(t,"c",(function(){return l}));class o{constructor(){this.interceptions=[],this.interceptionKeySet=new Set}isUsed(){return this.interceptions.length>0}intercept(e){this.interceptions.push(e),Object.keys(e).forEach((e=>{this.interceptionKeySet.add(e)}))}tap(e){this.interceptionKeySet.has("tap")&&this.interceptions.forEach((t=>{var r;null==(r=t.tap)||r.call(t,e)}))}call(e,...t){this.interceptionKeySet.has("call")&&this.interceptions.forEach((r=>{var n,o;r.context?null==(n=r.call)||n.call(r,e,...t):null==(o=r.call)||o.call(r,...t)}))}loop(...e){this.interceptionKeySet.has("loop")&&this.interceptions.forEach((t=>{var r;null==(r=t.loop)||r.call(t,...e)}))}error(e){if(this.interceptionKeySet.has("error")&&e instanceof Error){const t=e;this.interceptions.forEach((e=>{var r;null==(r=e.error)||r.call(e,t)}))}}result(e){this.interceptionKeySet.has("result")&&this.interceptions.forEach((t=>{var r;null==(r=t.result)||r.call(t,e)}))}done(){this.interceptionKeySet.has("done")&&this.interceptions.forEach((e=>{var t;null==(t=e.done)||t.call(e)}))}}class i{constructor(){this.taps=[],this.interceptions=new o}tap(e,t){const r="string"===typeof e?{name:e,context:!1}:{context:!1,...e},n={key:Symbol(r.name),...r,callback:t};if(n.before){let e=this.taps.length;const t=new Set(Array.isArray(n.before)?n.before:[n.before]);for(;e>0&&t.size>0;e--){const r=this.taps[e-1];if(t.has(r.name)&&t.delete(r.name),r.before&&(o=n.name,i=r.before,Array.isArray(i)?i.includes(o):i===o))break}this.taps.splice(e,0,n)}else this.taps.push(n);var o,i;return this.interceptions.tap(n),n}untap(e){this.taps=this.taps.filter((t=>t.key!==e.key))}isUsed(){return this.taps.length>0||this.interceptions.isUsed()}intercept(e){this.interceptions.intercept(e)}}class a extends i{call(...e){if(!this.isUsed())return;const t={};this.interceptions.call(t,...e);try{this.taps.forEach((r=>{n(r,e,t)}))}catch(r){throw this.interceptions.error(r),r}this.interceptions.done()}}class s extends i{call(...e){if(!this.isUsed())return;const t={};this.interceptions.call(t,...e);for(let r=0;r<this.taps.length;r+=1){const o=n(this.taps[r],e,t);if(void 0!==o)return this.interceptions.result(o),o}this.interceptions.done()}}class l extends i{call(...e){const t={};this.interceptions.call(t,...e);let[r,...o]=e;for(let i=0;i<this.taps.length;i+=1){const e=n(this.taps[i],[r,...o],t);void 0!==e&&(r=e)}return this.interceptions.result(r),r}}},function(e,t,r){(function(t){"undefined"!=typeof self&&self,e.exports=function(e){var t={};function r(n){if(t[n])return t[n].exports;var o=t[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}return r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:n})},r.r=function(e){Object.defineProperty(e,"__esModule",{value:!0})},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=0)}([function(e,r,n){"use strict";function o(e){if(!(this instanceof o))return new o(e);this._=e}var i=o.prototype;function a(e,t){for(var r=0;r<e;r++)t(r)}function s(e,t,r){return function(e,t){a(t.length,(function(r){e(t[r],r,t)}))}((function(r,n,o){t=e(t,r,n,o)}),r),t}function l(e,t){return s((function(t,r,n,o){return t.concat([e(r,n,o)])}),[],t)}function u(e,r){var n={v:0,buf:r};return a(e,(function(){var e;n={v:n.v<<1|(e=n.buf,e[0]>>7),buf:function(e){var r=s((function(e,r,n,o){return e.concat(n===o.length-1?t.from([r,0]).readUInt16BE(0):o.readUInt16BE(n))}),[],e);return t.from(l((function(e){return(e<<1&65535)>>8}),r))}(n.buf)}})),n}function c(){return"undefined"!=typeof t}function h(){if(!c())throw new Error("Buffer global does not exist; please use webpack if you need to parse Buffers in the browser.")}function f(e){h();var t=s((function(e,t){return e+t}),0,e);if(t%8!=0)throw new Error("The bits ["+e.join(", ")+"] add up to "+t+" which is not an even number of bytes; the total should be divisible by 8");var r,n=t/8,i=(r=function(e){return e>48},s((function(e,t){return e||(r(t)?t:e)}),null,e));if(i)throw new Error(i+" bit range requested exceeds 48 bit (6 byte) Number max.");return new o((function(t,r){var o=n+r;return o>t.length?O(r,n.toString()+" bytes"):S(o,s((function(e,t){var r=u(t,e.buf);return{coll:e.coll.concat(r.v),buf:r.buf}}),{coll:[],buf:t.slice(r,o)},e).coll)}))}function p(e,t){return new o((function(r,n){return h(),n+t>r.length?O(n,t+" bytes for "+e):S(n+t,r.slice(n,n+t))}))}function d(e,t){if("number"!=typeof(r=t)||Math.floor(r)!==r||t<0||t>6)throw new Error(e+" requires integer length in range [0, 6].");var r}function g(e){return d("uintBE",e),p("uintBE("+e+")",e).map((function(t){return t.readUIntBE(0,e)}))}function v(e){return d("uintLE",e),p("uintLE("+e+")",e).map((function(t){return t.readUIntLE(0,e)}))}function y(e){return d("intBE",e),p("intBE("+e+")",e).map((function(t){return t.readIntBE(0,e)}))}function m(e){return d("intLE",e),p("intLE("+e+")",e).map((function(t){return t.readIntLE(0,e)}))}function b(e){return e instanceof o}function w(e){return"[object Array]"==={}.toString.call(e)}function E(e){return c()&&t.isBuffer(e)}function S(e,t){return{status:!0,index:e,value:t,furthest:-1,expected:[]}}function O(e,t){return w(t)||(t=[t]),{status:!1,index:-1,value:null,furthest:e,expected:t}}function x(e,t){if(!t)return e;if(e.furthest>t.furthest)return e;var r=e.furthest===t.furthest?function(e,t){if(function(){if(void 0!==o._supportsSet)return o._supportsSet;var e="undefined"!=typeof Set;return o._supportsSet=e,e}()&&Array.from){for(var r=new Set(e),n=0;n<t.length;n++)r.add(t[n]);var i=Array.from(r);return i.sort(),i}for(var a={},s=0;s<e.length;s++)a[e[s]]=!0;for(var l=0;l<t.length;l++)a[t[l]]=!0;var u=[];for(var c in a)({}).hasOwnProperty.call(a,c)&&u.push(c);return u.sort(),u}(e.expected,t.expected):t.expected;return{status:e.status,index:e.index,value:e.value,furthest:t.furthest,expected:r}}var A={};function k(e,t){if(E(e))return{offset:t,line:-1,column:-1};e in A||(A[e]={});for(var r=A[e],n=0,o=0,i=0,a=t;a>=0;){if(a in r){n=r[a].line,0===i&&(i=r[a].lineStart);break}("\n"===e.charAt(a)||"\r"===e.charAt(a)&&"\n"!==e.charAt(a+1))&&(o++,0===i&&(i=a+1)),a--}var s=n+o,l=t-i;return r[t]={line:s,lineStart:i},{offset:t,line:s+1,column:l+1}}function P(e){if(!b(e))throw new Error("not a parser: "+e)}function R(e,t){return"string"==typeof e?e.charAt(t):e[t]}function _(e){if("number"!=typeof e)throw new Error("not a number: "+e)}function T(e){if("function"!=typeof e)throw new Error("not a function: "+e)}function C(e){if("string"!=typeof e)throw new Error("not a string: "+e)}var j=2,N=3,U=8,L=5*U,B=4*U,I=" ";function D(e,t){return new Array(t+1).join(e)}function M(e,t,r){var n=t-e.length;return n<=0?e:D(r,n)+e}function V(e,t,r,n){return{from:e-t>0?e-t:0,to:e+r>n?n:e+r}}function F(e,t){var r,n,o,i,a,u=t.index,c=u.offset,h=1;if(c===e.length)return"Got the end of the input";if(E(e)){var f=c-c%U,p=c-f,d=V(f,L,B+U,e.length),g=l((function(e){return l((function(e){return M(e.toString(16),2,"0")}),e)}),function(e,t){var r=e.length,n=[],o=0;if(r<=t)return[e.slice()];for(var i=0;i<r;i++)n[o]||n.push([]),n[o].push(e[i]),(i+1)%t==0&&o++;return n}(e.slice(d.from,d.to).toJSON().data,U));i=function(e){return 0===e.from&&1===e.to?{from:e.from,to:e.to}:{from:e.from/U,to:Math.floor(e.to/U)}}(d),n=f/U,r=3*p,p>=4&&(r+=1),h=2,o=l((function(e){return e.length<=4?e.join(" "):e.slice(0,4).join(" ")+" "+e.slice(4).join(" ")}),g),(a=(8*(i.to>0?i.to-1:i.to)).toString(16).length)<2&&(a=2)}else{var v=e.split(/\r\n|[\n\r\u2028\u2029]/);r=u.column-1,n=u.line-1,i=V(n,j,N,v.length),o=v.slice(i.from,i.to),a=i.to.toString().length}var y=n-i.from;return E(e)&&(a=(8*(i.to>0?i.to-1:i.to)).toString(16).length)<2&&(a=2),s((function(t,n,o){var s,l=o===y,u=l?"> ":I;return s=E(e)?M((8*(i.from+o)).toString(16),a,"0"):M((i.from+o+1).toString(),a," "),[].concat(t,[u+s+" | "+n],l?[I+D(" ",a)+" | "+M("",r," ")+D("^",h)]:[])}),[],o).join("\n")}function $(e,t){return["\n","-- PARSING FAILED "+D("-",50),"\n\n",F(e,t),"\n\n",(r=t.expected,1===r.length?"Expected:\n\n"+r[0]:"Expected one of the following: \n\n"+r.join(", ")),"\n"].join("");var r}function H(e){return void 0!==e.flags?e.flags:[e.global?"g":"",e.ignoreCase?"i":"",e.multiline?"m":"",e.unicode?"u":"",e.sticky?"y":""].join("")}function z(){for(var e=[].slice.call(arguments),t=e.length,r=0;r<t;r+=1)P(e[r]);return o((function(r,n){for(var o,i=new Array(t),a=0;a<t;a+=1){if(!(o=x(e[a]._(r,n),o)).status)return o;i[a]=o.value,n=o.index}return x(S(n,i),o)}))}function W(){var e=[].slice.call(arguments);if(0===e.length)throw new Error("seqMap needs at least one argument");var t=e.pop();return T(t),z.apply(null,e).map((function(e){return t.apply(null,e)}))}function Y(){var e=[].slice.call(arguments),t=e.length;if(0===t)return Q("zero alternates");for(var r=0;r<t;r+=1)P(e[r]);return o((function(t,r){for(var n,o=0;o<e.length;o+=1)if((n=x(e[o]._(t,r),n)).status)return n;return n}))}function q(e,t){return G(e,t).or(J([]))}function G(e,t){return P(e),P(t),W(e,t.then(e).many(),(function(e,t){return[e].concat(t)}))}function K(e){C(e);var t="'"+e+"'";return o((function(r,n){var o=n+e.length,i=r.slice(n,o);return i===e?S(o,i):O(n,t)}))}function Z(e,t){!function(e){if(!(e instanceof RegExp))throw new Error("not a regexp: "+e);for(var t=H(e),r=0;r<t.length;r++){var n=t.charAt(r);if("i"!==n&&"m"!==n&&"u"!==n&&"s"!==n)throw new Error('unsupported regexp flag "'+n+'": '+e)}}(e),arguments.length>=2?_(t):t=0;var r=function(e){return RegExp("^(?:"+e.source+")",H(e))}(e),n=""+e;return o((function(e,o){var i=r.exec(e.slice(o));if(i){if(0<=t&&t<=i.length){var a=i[0],s=i[t];return S(o+a.length,s)}return O(o,"valid match group (0 to "+i.length+") in "+n)}return O(o,n)}))}function J(e){return o((function(t,r){return S(r,e)}))}function Q(e){return o((function(t,r){return O(r,e)}))}function X(e){if(b(e))return o((function(t,r){var n=e._(t,r);return n.index=r,n.value="",n}));if("string"==typeof e)return X(K(e));if(e instanceof RegExp)return X(Z(e));throw new Error("not a string, regexp, or parser: "+e)}function ee(e){return P(e),o((function(t,r){var n=e._(t,r),o=t.slice(r,n.index);return n.status?O(r,'not "'+o+'"'):S(r,null)}))}function te(e){return T(e),o((function(t,r){var n=R(t,r);return r<t.length&&e(n)?S(r+1,n):O(r,"a character/byte matching "+e)}))}function re(e,t){arguments.length<2&&(t=e,e=void 0);var r=o((function(e,n){return r._=t()._,r._(e,n)}));return e?r.desc(e):r}function ne(){return Q("fantasy-land/empty")}i.parse=function(e){if("string"!=typeof e&&!E(e))throw new Error(".parse must be called with a string or Buffer as its argument");var t,r=this.skip(se)._(e,0);return t=r.status?{status:!0,value:r.value}:{status:!1,index:k(e,r.furthest),expected:r.expected},delete A[e],t},i.tryParse=function(e){var t=this.parse(e);if(t.status)return t.value;var r=$(e,t),n=new Error(r);throw n.type="ParsimmonError",n.result=t,n},i.assert=function(e,t){return this.chain((function(r){return e(r)?J(r):Q(t)}))},i.or=function(e){return Y(this,e)},i.trim=function(e){return this.wrap(e,e)},i.wrap=function(e,t){return W(e,this,t,(function(e,t){return t}))},i.thru=function(e){return e(this)},i.then=function(e){return P(e),z(this,e).map((function(e){return e[1]}))},i.many=function(){var e=this;return o((function(t,r){for(var n=[],o=void 0;;){if(!(o=x(e._(t,r),o)).status)return x(S(r,n),o);if(r===o.index)throw new Error("infinite loop detected in .many() parser --- calling .many() on a parser which can accept zero characters is usually the cause");r=o.index,n.push(o.value)}}))},i.tieWith=function(e){return C(e),this.map((function(t){if(function(e){if(!w(e))throw new Error("not an array: "+e)}(t),t.length){C(t[0]);for(var r=t[0],n=1;n<t.length;n++)C(t[n]),r+=e+t[n];return r}return""}))},i.tie=function(){return this.tieWith("")},i.times=function(e,t){var r=this;return arguments.length<2&&(t=e),_(e),_(t),o((function(n,o){for(var i=[],a=void 0,s=void 0,l=0;l<e;l+=1){if(s=x(a=r._(n,o),s),!a.status)return s;o=a.index,i.push(a.value)}for(;l<t&&(s=x(a=r._(n,o),s),a.status);l+=1)o=a.index,i.push(a.value);return x(S(o,i),s)}))},i.result=function(e){return this.map((function(){return e}))},i.atMost=function(e){return this.times(0,e)},i.atLeast=function(e){return W(this.times(e),this.many(),(function(e,t){return e.concat(t)}))},i.map=function(e){T(e);var t=this;return o((function(r,n){var o=t._(r,n);return o.status?x(S(o.index,e(o.value)),o):o}))},i.contramap=function(e){T(e);var t=this;return o((function(r,n){var o=t.parse(e(r.slice(n)));return o.status?S(n+r.length,o.value):o}))},i.promap=function(e,t){return T(e),T(t),this.contramap(e).map(t)},i.skip=function(e){return z(this,e).map((function(e){return e[0]}))},i.mark=function(){return W(oe,this,oe,(function(e,t,r){return{start:e,value:t,end:r}}))},i.node=function(e){return W(oe,this,oe,(function(t,r,n){return{name:e,value:r,start:t,end:n}}))},i.sepBy=function(e){return q(this,e)},i.sepBy1=function(e){return G(this,e)},i.lookahead=function(e){return this.skip(X(e))},i.notFollowedBy=function(e){return this.skip(ee(e))},i.desc=function(e){w(e)||(e=[e]);var t=this;return o((function(r,n){var o=t._(r,n);return o.status||(o.expected=e),o}))},i.fallback=function(e){return this.or(J(e))},i.ap=function(e){return W(e,this,(function(e,t){return e(t)}))},i.chain=function(e){var t=this;return o((function(r,n){var o=t._(r,n);return o.status?x(e(o.value)._(r,o.index),o):o}))},i.concat=i.or,i.empty=ne,i.of=J,i["fantasy-land/ap"]=i.ap,i["fantasy-land/chain"]=i.chain,i["fantasy-land/concat"]=i.concat,i["fantasy-land/empty"]=i.empty,i["fantasy-land/of"]=i.of,i["fantasy-land/map"]=i.map;var oe=o((function(e,t){return S(t,k(e,t))})),ie=o((function(e,t){return t>=e.length?O(t,"any character/byte"):S(t+1,R(e,t))})),ae=o((function(e,t){return S(e.length,e.slice(t))})),se=o((function(e,t){return t<e.length?O(t,"EOF"):S(t,null)})),le=Z(/[0-9]/).desc("a digit"),ue=Z(/[0-9]*/).desc("optional digits"),ce=Z(/[a-z]/i).desc("a letter"),he=Z(/[a-z]*/i).desc("optional letters"),fe=Z(/\s*/).desc("optional whitespace"),pe=Z(/\s+/).desc("whitespace"),de=K("\r"),ge=K("\n"),ve=K("\r\n"),ye=Y(ve,ge,de).desc("newline"),me=Y(ye,se);o.all=ae,o.alt=Y,o.any=ie,o.cr=de,o.createLanguage=function(e){var t={};for(var r in e)({}).hasOwnProperty.call(e,r)&&function(r){t[r]=re((function(){return e[r](t)}))}(r);return t},o.crlf=ve,o.custom=function(e){return o(e(S,O))},o.digit=le,o.digits=ue,o.empty=ne,o.end=me,o.eof=se,o.fail=Q,o.formatError=$,o.index=oe,o.isParser=b,o.lazy=re,o.letter=ce,o.letters=he,o.lf=ge,o.lookahead=X,o.makeFailure=O,o.makeSuccess=S,o.newline=ye,o.noneOf=function(e){return te((function(t){return e.indexOf(t)<0})).desc("none of '"+e+"'")},o.notFollowedBy=ee,o.of=J,o.oneOf=function(e){for(var t=e.split(""),r=0;r<t.length;r++)t[r]="'"+t[r]+"'";return te((function(t){return e.indexOf(t)>=0})).desc(t)},o.optWhitespace=fe,o.Parser=o,o.range=function(e,t){return te((function(r){return e<=r&&r<=t})).desc(e+"-"+t)},o.regex=Z,o.regexp=Z,o.sepBy=q,o.sepBy1=G,o.seq=z,o.seqMap=W,o.seqObj=function(){for(var e,t={},r=0,n=(e=arguments,Array.prototype.slice.call(e)),i=n.length,a=0;a<i;a+=1){var s=n[a];if(!b(s)){if(w(s)&&2===s.length&&"string"==typeof s[0]&&b(s[1])){var l=s[0];if(Object.prototype.hasOwnProperty.call(t,l))throw new Error("seqObj: duplicate key "+l);t[l]=!0,r++;continue}throw new Error("seqObj arguments must be parsers or [string, parser] array pairs.")}}if(0===r)throw new Error("seqObj expects at least one named parser, found zero");return o((function(e,t){for(var r,o={},a=0;a<i;a+=1){var s,l;if(w(n[a])?(s=n[a][0],l=n[a][1]):(s=null,l=n[a]),!(r=x(l._(e,t),r)).status)return r;s&&(o[s]=r.value),t=r.index}return x(S(t,o),r)}))},o.string=K,o.succeed=J,o.takeWhile=function(e){return T(e),o((function(t,r){for(var n=r;n<t.length&&e(R(t,n));)n++;return S(n,t.slice(r,n))}))},o.test=te,o.whitespace=pe,o["fantasy-land/empty"]=ne,o["fantasy-land/of"]=J,o.Binary={bitSeq:f,bitSeqObj:function(e){h();var t={},r=0,n=l((function(e){if(w(e)){var n=e;if(2!==n.length)throw new Error("["+n.join(", ")+"] should be length 2, got length "+n.length);if(C(n[0]),_(n[1]),Object.prototype.hasOwnProperty.call(t,n[0]))throw new Error("duplicate key in bitSeqObj: "+n[0]);return t[n[0]]=!0,r++,n}return _(e),[null,e]}),e);if(r<1)throw new Error("bitSeqObj expects at least one named pair, got ["+e.join(", ")+"]");var o=l((function(e){return e[0]}),n);return f(l((function(e){return e[1]}),n)).map((function(e){return s((function(e,t){return null!==t[0]&&(e[t[0]]=t[1]),e}),{},l((function(t,r){return[t,e[r]]}),o))}))},byte:function(e){if(h(),_(e),e>255)throw new Error("Value specified to byte constructor ("+e+"=0x"+e.toString(16)+") is larger in value than a single byte.");var t=(e>15?"0x":"0x0")+e.toString(16);return o((function(r,n){var o=R(r,n);return o===e?S(n+1,o):O(n,t)}))},buffer:function(e){return p("buffer",e).map((function(e){return t.from(e)}))},encodedString:function(e,t){return p("string",t).map((function(t){return t.toString(e)}))},uintBE:g,uint8BE:g(1),uint16BE:g(2),uint32BE:g(4),uintLE:v,uint8LE:v(1),uint16LE:v(2),uint32LE:v(4),intBE:y,int8BE:y(1),int16BE:y(2),int32BE:y(4),intLE:m,int8LE:m(1),int16LE:m(2),int32LE:m(4),floatBE:p("floatBE",4).map((function(e){return e.readFloatBE(0)})),floatLE:p("floatLE",4).map((function(e){return e.readFloatLE(0)})),doubleBE:p("doubleBE",8).map((function(e){return e.readDoubleBE(0)})),doubleLE:p("doubleLE",8).map((function(e){return e.readDoubleLE(0)}))},e.exports=o}])}).call(this,r(40).Buffer)},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.clone=s,t.addLast=u,t.addFirst=c,t.removeLast=h,t.removeFirst=f,t.insert=p,t.removeAt=d,t.replaceAt=g,t.getIn=v,t.set=y,t.setIn=m,t.update=w,t.updateIn=E,t.merge=S,t.mergeDeep=O,t.mergeIn=x,t.omit=A,t.addDefaults=k,t.default=void 0;const n="INVALID_ARGS";function o(e){throw new Error(e)}function i(e){const t=Object.keys(e);return Object.getOwnPropertySymbols?t.concat(Object.getOwnPropertySymbols(e)):t}const a={}.hasOwnProperty;function s(e){if(Array.isArray(e))return e.slice();const t=e,r=i(t),n={};for(let o=0;o<r.length;o++){const e=r[o];n[e]=t[e]}return n}function l(e){return null!=e&&"object"===typeof e}function u(e,t){return Array.isArray(t)?e.concat(t):e.concat([t])}function c(e,t){return Array.isArray(t)?t.concat(e):[t].concat(e)}function h(e){return e.length?e.slice(0,e.length-1):e}function f(e){return e.length?e.slice(1):e}function p(e,t,r){return e.slice(0,t).concat(Array.isArray(r)?r:[r]).concat(e.slice(t))}function d(e,t){return t>=e.length||t<0?e:e.slice(0,t).concat(e.slice(t+1))}function g(e,t,r){if(e[t]===r)return e;const n=e.length,o=Array(n);for(let i=0;i<n;i++)o[i]=e[i];return o[t]=r,o}function v(e,t){if(Array.isArray(t)||o(n),null==e)return;let r=e;for(let n=0;n<t.length;n++){const e=t[n];if(r=null!=r?r[e]:void 0,void 0===r)return r}return r}function y(e,t,r){let n=e;if(null==n&&(n="number"===typeof t?[]:{}),n[t]===r)return n;const o=s(n);return o[t]=r,o}function m(e,t,r){return t.length?b(e,t,r,0):r}function b(e,t,r,n){let o;const i=t[n];if(n===t.length-1)o=r;else{o=b(l(e)&&l(e[i])?e[i]:"number"===typeof t[n+1]?[]:{},t,r,n+1)}return y(e,i,o)}function w(e,t,r){return y(e,t,r(null==e?void 0:e[t]))}function E(e,t,r){return m(e,t,r(v(e,t)))}function S(e,t,r,n,o,i,...a){return a.length?P.call(null,!1,!1,e,t,r,n,o,i,...a):P(!1,!1,e,t,r,n,o,i)}function O(e,t,r,n,o,i,...a){return a.length?P.call(null,!1,!0,e,t,r,n,o,i,...a):P(!1,!0,e,t,r,n,o,i)}function x(e,t,r,n,o,i,a,...s){let l,u=v(e,t);return null==u&&(u={}),l=s.length?P.call(null,!1,!1,u,r,n,o,i,a,...s):P(!1,!1,u,r,n,o,i,a),m(e,t,l)}function A(e,t){const r=Array.isArray(t)?t:[t];let n=!1;for(let i=0;i<r.length;i++)if(a.call(e,r[i])){n=!0;break}if(!n)return e;const o={},s=i(e);for(let i=0;i<s.length;i++){const t=s[i];r.indexOf(t)>=0||(o[t]=e[t])}return o}function k(e,t,r,n,o,i,...a){return a.length?P.call(null,!0,!1,e,t,r,n,o,i,...a):P(!0,!1,e,t,r,n,o,i)}function P(e,t,r,...a){let u=r;null==u&&o(n);let c=!1;for(let n=0;n<a.length;n++){const r=a[n];if(null==r)continue;const o=i(r);if(o.length)for(let n=0;n<=o.length;n++){const i=o[n];if(e&&void 0!==u[i])continue;let a=r[i];t&&l(u[i])&&l(a)&&(a=P(e,t,u[i],a)),void 0!==a&&a!==u[i]&&(c||(c=!0,u=s(u)),u[i]=a)}}return u}var R={clone:s,addLast:u,addFirst:c,removeLast:h,removeFirst:f,insert:p,removeAt:d,replaceAt:g,getIn:v,set:y,setIn:m,update:w,updateIn:E,merge:S,mergeDeep:O,mergeIn:x,omit:A,addDefaults:k};t.default=R},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.toError=t.NestedError=void 0;class n extends Error{constructor(e,...t){super(e);const r=n.getErrorReport(this);if(1===t.length){const e=o(t[0]);this.innerErrors=[e];const i=n.getErrorReport(e);return void(this.stack=`${r}\n\n======= INNER ERROR =======\n\n${i}`)}this.innerErrors=t.map((e=>o(e)));const i=this.innerErrors.map(((e,r)=>{const o=n.getErrorReport(e);return`======= INNER ERROR (${r+1} of ${t.length}) =======\n\n${o}`})).join("\n\n");this.stack=`${r}\n\n${i}`}get innerError(){return 0===this.innerErrors.length?null:this.innerErrors[0]}static rethrow(e){return(...t)=>{throw new this(e,...t)}}}function o(e){try{return e instanceof Error?e:new Error(`Value that is not an instance of Error was thrown: ${e}`)}catch{return new Error("Failed to stringify non-instance of Error that was thrown.This is possibly due to the fact that toString() method of the valuedoesn't return a primitive value.")}}t.NestedError=n,n.getErrorReport="string"===typeof(new Error).stack?e=>e.stack:e=>`${e.name}: ${e.message}`,n.prototype.name="NestedError",t.toError=o},function(e,t,r){r(14),e.exports=r(31)},function(e,t,r){e.exports=r(34)},function(e,t,r){e.exports=function(e,t,r,n,o){for(t=t.split?t.split("."):t,n=0;n<t.length;n++)e=e?e[t[n]]:o;return e===o?r:e}},function(module,exports,__webpack_require__){"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.Parser=exports.findRuleByName=exports.parseRuleName=exports.escapeRegExp=exports.readToken=void 0;const UPPER_SNAKE_RE=/^[A-Z0-9_]+$/,decorationRE=/(\?|\+|\*)$/,preDecorationRE=/^(@|&|!)/,WS_RULE="WS",TokenError_1=__webpack_require__(11);function readToken(e,t){let r=t.exec(e);return r&&0==r.index?0==r[0].length&&t.source.length>0?null:{type:null,text:r[0],rest:e.substr(r[0].length),start:0,end:r[0].length-1,fullText:r[0],errors:[],children:[],parent:null}:null}function escapeRegExp(e){return e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")}function fixRest(e){e.rest="",e.children&&e.children.forEach((e=>fixRest(e)))}function fixPositions(e,t){e.start+=t,e.end+=t,e.children&&e.children.forEach((t=>fixPositions(t,e.start)))}function agregateErrors(e,t){t.errors&&t.errors.length&&t.errors.forEach((t=>e.push(t))),t.children&&t.children.forEach((t=>agregateErrors(e,t)))}function parseRuleName(e){let t=decorationRE.exec(e),r=preDecorationRE.exec(e),n=t&&t[0]||"",o=r&&r[0]||"",i={raw:e,name:e.replace(decorationRE,"").replace(preDecorationRE,""),isOptional:"?"==n||"*"==n,allowRepetition:"+"==n||"*"==n,atLeastOne:"+"==n,lookupPositive:"&"==o,lookupNegative:"!"==o,pinned:"@"==o,lookup:!1,isLiteral:!1};return i.isLiteral="'"==i.name[0]||'"'==i.name[0],i.lookup=i.lookupNegative||i.lookupPositive,i}function findRuleByName(e,t){let r=parseRuleName(e);return t.cachedRules[r.name]||null}function stripRules(e,t){if(e.children){let r=e.children.filter((e=>e.type&&t.test(e.type)));for(let t=0;t<r.length;t++){let n=e.children.indexOf(r[t]);-1!=n&&e.children.splice(n,1)}e.children.forEach((e=>stripRules(e,t)))}}exports.readToken=readToken,exports.escapeRegExp=escapeRegExp,exports.parseRuleName=parseRuleName,exports.findRuleByName=findRuleByName;const ignoreMissingRules=["EOF"];class Parser{constructor(e,t){this.grammarRules=e,this.options=t,this.cachedRules={},this.debug=!!t&&!0===t.debug;let r=[],n=[];if(e.forEach((e=>{let t=parseRuleName(e.name);if(t.name in this.cachedRules)r.push("Duplicated rule "+t.name);else{if(this.cachedRules[t.name]=e,e.bnf&&e.bnf.length)e.bnf.forEach((t=>{if("string"===typeof t[0]){if(parseRuleName(t[0]).name==e.name){let t="Left recursion is not allowed, rule: "+e.name;-1==r.indexOf(t)&&r.push(t)}}t.forEach((e=>{if("string"==typeof e){let t=parseRuleName(e);t.isLiteral||-1!=n.indexOf(t.name)||-1!=ignoreMissingRules.indexOf(t.name)||n.push(t.name)}}))}));else{let t="Missing rule content, rule: "+e.name;-1==r.indexOf(t)&&r.push(t)}WS_RULE==e.name&&(e.implicitWs=!1),e.implicitWs&&-1==n.indexOf(WS_RULE)&&n.push(WS_RULE),e.recover&&-1==n.indexOf(e.recover)&&n.push(e.recover)}})),n.forEach((e=>{e in this.cachedRules||r.push("Missing rule "+e)})),r.length)throw new Error(r.join("\n"))}getAST(e,t){t||(t=this.grammarRules.filter((e=>!e.fragment&&0!=e.name.indexOf("%")))[0].name);let r=this.parse(e,t);if(r){agregateErrors(r.errors,r),fixPositions(r,0),stripRules(r,/^%/),this.options&&this.options.keepUpperRules||stripRules(r,UPPER_SNAKE_RE);let e=r.rest;e&&new TokenError_1.TokenError("Unexpected end of input: \n"+e,r),fixRest(r),r.rest=e}return r}emitSource(){return"CANNOT EMIT SOURCE FROM BASE Parser"}parse(txt,target,recursion=0){let out=null,type=parseRuleName(target),expr,printable=this.debug&&!UPPER_SNAKE_RE.test(type.name);printable&&console.log(new Array(recursion).join("\u2502 ")+"Trying to get "+target+" from "+JSON.stringify(txt.split("\n")[0]));let realType=type.name,targetLex=findRuleByName(type.name,this);if("EOF"==type.name){if(txt.length)return null;if(0==txt.length)return{type:"EOF",text:"",rest:"",start:0,end:0,fullText:"",errors:[],children:[],parent:null}}try{if(!targetLex&&type.isLiteral){let src=eval(type.name);if(""===src)return{type:"%%EMPTY%%",text:"",rest:txt,start:0,end:0,fullText:"",errors:[],children:[],parent:null};expr=new RegExp(escapeRegExp(src)),realType=null}}catch(e){return e instanceof ReferenceError&&console.error(e),null}if(expr){let e=readToken(txt,expr);if(e)return e.type=realType,e}else{let e=targetLex.bnf;e instanceof Array&&e.forEach((e=>{if(out)return;let t=null,r={type:type.name,text:"",children:[],end:0,errors:[],fullText:"",parent:null,start:0,rest:txt};targetLex.fragment&&(r.fragment=!0);let n=txt,o=0,i=e.length>0,a=!1;for(let s=0;s<e.length;s++)if("string"==typeof e[s]){let l,u=parseRuleName(e[s]);i=i&&u.isOptional;let c=!1;do{if(l=null,targetLex.implicitWs&&(l=this.parse(n,u.name,recursion+1),!l)){let e;do{if(e=this.parse(n,WS_RULE,recursion+1),!e)break;r.text=r.text+e.text,r.end=r.text.length,e.parent=r,r.children.push(e),n=n.substr(e.text.length),o+=e.text.length}while(e&&e.text.length)}if(l=l||this.parse(n,u.name,recursion+1),u.lookupNegative){if(l)return;break}if(u.lookupPositive&&!l)return;if(!l){if(u.isOptional)break;if(u.atLeastOne&&c)break}if(l&&targetLex.pinned==s+1&&(t=l,printable&&console.log(new Array(recursion+1).join("\u2502 ")+"\u2514\u2500 "+l.type+" PINNED")),l||(l=this.parseRecovery(targetLex,n,recursion+1)),!l){if(!t)return;out=r,l={type:"SyntaxError",text:n,children:[],end:n.length,errors:[],fullText:"",parent:null,start:0,rest:""},n.length?new TokenError_1.TokenError(`Unexpected end of input. Expecting ${u.name} Got: ${n}`,l):new TokenError_1.TokenError(`Unexpected end of input. Missing ${u.name}`,l),printable&&console.log(new Array(recursion+1).join("\u2502 ")+"\u2514\u2500 "+l.type+" "+JSON.stringify(l.text))}if(c=!0,a=!0,"%%EMPTY%%"==l.type)break;l.start+=o,l.end+=o,!u.lookupPositive&&l.type&&(l.fragment?l.children&&l.children.forEach((e=>{e.start+=o,e.end+=o,e.parent=r,r.children.push(e)})):(l.parent=r,r.children.push(l))),u.lookup&&(l.lookup=!0),printable&&console.log(new Array(recursion+1).join("\u2502 ")+"\u2514\u2500 "+l.type+" "+JSON.stringify(l.text)),u.lookup||l.lookup||(r.text=r.text+l.text,r.end=r.text.length,n=n.substr(l.text.length),o+=l.text.length),r.rest=n}while(l&&u.allowRepetition&&n.length&&!l.lookup)}else{let t=readToken(n,e[s]);if(!t)return;printable&&console.log(new Array(recursion+1).join("\u2502 ")+"\u2514> "+JSON.stringify(t.text)+e[s].source),a=!0,t.start+=o,t.end+=o,r.text=r.text+t.text,r.end=r.text.length,n=n.substr(t.text.length),o+=t.text.length,r.rest=n}a&&(out=r,printable&&console.log(new Array(recursion).join("\u2502 ")+"\u251c<\u2500\u2534< PUSHING "+out.type+" "+JSON.stringify(out.text)))})),out&&targetLex.simplifyWhenOneChildren&&1==out.children.length&&(out=out.children[0])}return out||printable&&console.log(target+" NOT RESOLVED FROM "+txt),out}parseRecovery(e,t,r){if(e.recover&&t.length){let n=this.debug;n&&console.log(new Array(r+1).join("\u2502 ")+"Trying to recover until token "+e.recover+" from "+JSON.stringify(t.split("\n")[0]+t.split("\n")[1]));let o,i={type:"SyntaxError",text:"",children:[],end:0,errors:[],fullText:"",parent:null,start:0,rest:""};do{if(o=this.parse(t,e.recover,r+1),o){new TokenError_1.TokenError('Unexpected input: "'+i.text+`" Expecting: ${e.name}`,i);break}i.text=i.text+t[0],i.end=i.text.length,t=t.substr(1)}while(!o&&t.length>0);if(i.text.length>0&&o)return n&&console.log(new Array(r+1).join("\u2502 ")+"Recovered text: "+JSON.stringify(i.text)),i}return null}}exports.Parser=Parser,exports.default=Parser},function(e,t,r){"use strict";r.d(t,"a",(function(){return i}));var n=Object.prototype.hasOwnProperty;function o(e,t,r){for(r of e.keys())if(i(r,t))return r}function i(e,t){var r,a,s;if(e===t)return!0;if(e&&t&&(r=e.constructor)===t.constructor){if(r===Date)return e.getTime()===t.getTime();if(r===RegExp)return e.toString()===t.toString();if(r===Array){if((a=e.length)===t.length)for(;a--&&i(e[a],t[a]););return-1===a}if(r===Set){if(e.size!==t.size)return!1;for(a of e){if((s=a)&&"object"===typeof s&&!(s=o(t,s)))return!1;if(!t.has(s))return!1}return!0}if(r===Map){if(e.size!==t.size)return!1;for(a of e){if((s=a[0])&&"object"===typeof s&&!(s=o(t,s)))return!1;if(!i(a[1],t.get(s)))return!1}return!0}if(r===ArrayBuffer)e=new Uint8Array(e),t=new Uint8Array(t);else if(r===DataView){if((a=e.byteLength)===t.byteLength)for(;a--&&e.getInt8(a)===t.getInt8(a););return-1===a}if(ArrayBuffer.isView(e)){if((a=e.byteLength)===t.byteLength)for(;a--&&e[a]===t[a];);return-1===a}if(!r||"object"===typeof e){for(r in a=0,e){if(n.call(e,r)&&++a&&!n.call(t,r))return!1;if(!(r in t)||!i(e[r],t[r]))return!1}return Object.keys(t).length===a}}return e!==e&&t!==t}},function(e,t,r){r(26),e.exports=r(15)},function(e,t){e.exports=function(e,t,r){var n="";if(n+=e.name||"Error",n+=": "+(e.message||""),r instanceof Array)for(var o in r){n+="\n # "+r[o]}for(var i in t){n+="\n at "+t[i].toString()}return n}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TokenError=void 0;class n extends Error{constructor(e,t){if(super(e),this.message=e,this.token=t,!t||!t.errors)throw this;t.errors.push(this)}inspect(){return"SyntaxError: "+this.message}}t.TokenError=n},function(e,t,r){"use strict";function n(e,t){for(var r,o=0,i=e.length;o<i;o++)r=e[o],Array.isArray(r)?n(r,t):t.push(r);return t}e.exports=function(e){return n(e,[])}},function(e,t,r){"use strict";e.exports=()=>{const e={};return e.promise=new Promise(((t,r)=>{e.resolve=t,e.reject=r})),e}},function(e,t,r){r(9).check("es5")},function(e,t,r){var n=new(r(27)),o=function(e){return n.test(e)};o.define=function(e,t){n.define(e,t)},o.check=function(e){n.check(e)},o.test=o,e.exports=o},function(e,t,r){"use strict";r.r(t),r.d(t,"ApplicabilityPlugin",(function(){return jr})),r.d(t,"AssetTransformCorePlugin",(function(){return jn})),r.d(t,"BINDING_BRACKETS_REGEX",(function(){return le})),r.d(t,"BindingInstance",(function(){return q})),r.d(t,"BindingParser",(function(){return he})),r.d(t,"Builder",(function(){return qr})),r.d(t,"ConsoleLogger",(function(){return ct})),r.d(t,"ConstantsController",(function(){return zn})),r.d(t,"DataController",(function(){return Ln})),r.d(t,"DependencyMiddleware",(function(){return pe})),r.d(t,"DependencyModel",(function(){return de})),r.d(t,"DependencyTracker",(function(){return fe})),r.d(t,"EMPTY_NODE",(function(){return rr})),r.d(t,"ExpNodeOpaqueIdentifier",(function(){return Oe})),r.d(t,"ExpressionEvaluator",(function(){return lt})),r.d(t,"FlowController",(function(){return rn})),r.d(t,"FlowExpPlugin",(function(){return Wn})),r.d(t,"FlowInstance",(function(){return en})),r.d(t,"LocalModel",(function(){return Se})),r.d(t,"LocalStateStore",(function(){return Tn})),r.d(t,"NOOPDataModel",(function(){return ge})),r.d(t,"NOOP_MODEL",(function(){return ve})),r.d(t,"NOT_STARTED_STATE",(function(){return qn})),r.d(t,"NodeType",(function(){return Ut})),r.d(t,"NoopLogger",(function(){return ft})),r.d(t,"Parser",(function(){return nr})),r.d(t,"PipelinedDataModel",(function(){return Ee})),r.d(t,"Player",(function(){return no})),r.d(t,"ProxyLogger",(function(){return dt})),r.d(t,"ROOT_BINDING",(function(){return ye})),r.d(t,"Resolver",(function(){return Or})),r.d(t,"SCHEMA_VALIDATION_PROVIDER_NAME",(function(){return An})),r.d(t,"SIMPLE_BINDING_REGEX",(function(){return se})),r.d(t,"SchemaController",(function(){return At})),r.d(t,"StringResolverPlugin",(function(){return Cr})),r.d(t,"SwitchPlugin",(function(){return Br})),r.d(t,"TapableLogger",(function(){return pt})),r.d(t,"TemplatePlugin",(function(){return xr})),r.d(t,"VALIDATION_PROVIDER_NAME_SYMBOL",(function(){return Pn})),r.d(t,"VIEW_VALIDATION_PROVIDER_NAME",(function(){return kn})),r.d(t,"ValidationBindingTrackerViewPlugin",(function(){return gn})),r.d(t,"ValidationController",(function(){return _n})),r.d(t,"ValidationMiddleware",(function(){return Ht})),r.d(t,"ValidatorRegistry",(function(){return zt})),r.d(t,"ViewController",(function(){return Nn})),r.d(t,"ViewInstance",(function(){return Yr})),r.d(t,"caresAboutDataChanges",(function(){return hr})),r.d(t,"constructModelForPipeline",(function(){return we})),r.d(t,"findClosestNodeAtPosition",(function(){return qe})),r.d(t,"findInArray",(function(){return Y})),r.d(t,"findNextExp",(function(){return Rt})),r.d(t,"getBindingSegments",(function(){return W})),r.d(t,"getNodeID",(function(){return Yt})),r.d(t,"hasAsync",(function(){return Wt})),r.d(t,"isBinding",(function(){return H})),r.d(t,"isExpressionNode",(function(){return xe})),r.d(t,"isObjectExpression",(function(){return Ge})),r.d(t,"maybeConvertToNum",(function(){return z})),r.d(t,"parse",(function(){return xt})),r.d(t,"parseExpression",(function(){return He})),r.d(t,"removeBindingAndChildrenFromMap",(function(){return Nt})),r.d(t,"resolveDataRefs",(function(){return jt})),r.d(t,"resolveDataRefsInString",(function(){return Tt})),r.d(t,"resolveExpressionsInString",(function(){return _t})),r.d(t,"severities",(function(){return ut})),r.d(t,"toModel",(function(){return be})),r.d(t,"toNodeResolveOptions",(function(){return fr})),r.d(t,"unpackAndPush",(function(){return pr})),r.d(t,"withParser",(function(){return me})),r.d(t,"withoutContext",(function(){return Ye}));var n=r(17);for(var o in n)["default","ApplicabilityPlugin","AssetTransformCorePlugin","BINDING_BRACKETS_REGEX","BindingInstance","BindingParser","Builder","ConsoleLogger","ConstantsController","DataController","DependencyMiddleware","DependencyModel","DependencyTracker","EMPTY_NODE","ExpNodeOpaqueIdentifier","ExpressionEvaluator","FlowController","FlowExpPlugin","FlowInstance","LocalModel","LocalStateStore","NOOPDataModel","NOOP_MODEL","NOT_STARTED_STATE","NodeType","NoopLogger","Parser","PipelinedDataModel","Player","ProxyLogger","ROOT_BINDING","Resolver","SCHEMA_VALIDATION_PROVIDER_NAME","SIMPLE_BINDING_REGEX","SchemaController","StringResolverPlugin","SwitchPlugin","TapableLogger","TemplatePlugin","VALIDATION_PROVIDER_NAME_SYMBOL","VIEW_VALIDATION_PROVIDER_NAME","ValidationBindingTrackerViewPlugin","ValidationController","ValidationMiddleware","ValidatorRegistry","ViewController","ViewInstance","caresAboutDataChanges","constructModelForPipeline","findClosestNodeAtPosition","findInArray","findNextExp","getBindingSegments","getNodeID","hasAsync","isBinding","isExpressionNode","isObjectExpression","maybeConvertToNum","parse","parseExpression","removeBindingAndChildrenFromMap","resolveDataRefs","resolveDataRefsInString","resolveExpressionsInString","severities","toModel","toNodeResolveOptions","unpackAndPush","withParser","withoutContext"].indexOf(o)<0&&function(e){r.d(t,e,(function(){return n[e]}))}(o);var i=r(0),a=r(3),s=r(12),l=r.n(s),u=r(1),c=r.n(u),h=r(19),f=r(6),p=r.n(f),d=r(2),g=r(8),v=r(13),y=r.n(v),m=r(20),b=r.n(m),w=r(21);const E=e=>({name:"Value",value:e}),S=e=>({name:"Expression",value:e}),O=e=>({name:"PathNode",path:e}),x=(e,t)=>({name:"Query",key:e,value:t}),A=e=>1===e.length?e[0]:{name:"Concatenated",value:e},k=c.a.string('"'),P=c.a.string("'"),R=c.a.string("`"),_=c.a.regex(/[\w\-@]+/).desc("identifier").map(E);let T;const C=c.a.lazy((()=>T)).trim(c.a.optWhitespace).wrap(c.a.string("{{"),c.a.string("}}")).map(O),j=c.a.regex(/[^`]*/).wrap(R,R).map(S),N=c.a.alt(_,C,j).atLeast(1).map(l.a).map(A),U=c.a.alt(c.a.regex(/[^"]*/).wrap(k,k).map(E),c.a.regex(/[^']*/).wrap(P,P).map(E),N),L=c.a.seq(U,c.a.string("=").times(1,3).trim(c.a.optWhitespace),U).map((([e,,t])=>x(e,t))),B=c.a.alt(L,U).trim(c.a.optWhitespace).wrap(c.a.string("["),c.a.string("]")).many(),I=c.a.seqMap(N,B,((e,t)=>[e,...t]));T=c.a.sepBy(I,c.a.string(".")).map(l.a),new h.Grammars.W3C.Parser('\nvalue ::= segment_and_bracket (SEGMENT_SEPARATOR segment_and_bracket)*\nsegment ::= concatenated | expression | modelRef | identifier \nconcatenated ::= (expression | modelRef | identifier)+ \nmodelRef ::= OPEN_CURL OPEN_CURL value CLOSE_CURL CLOSE_CURL \nidentifier ::= [\\w\\-@]+\nquery ::= WHITESPACE* optionally_quoted_segment WHITESPACE* EQUALS EQUALS? EQUALS? WHITESPACE* optionally_quoted_segment WHITESPACE*\nbrackets ::= OPEN_BRACKET WHITESPACE* (query | optionally_quoted_segment) WHITESPACE* CLOSE_BRACKET \nsegment_and_bracket ::= segment brackets*\nquoted_value ::= [^"\']*\noptionally_quoted_segment ::= WHITESPACE* SINGLE_QUOTE quoted_value SINGLE_QUOTE WHITESPACE* | WHITESPACE* DOUBLE_QUOTE quoted_value DOUBLE_QUOTE WHITESPACE* | WHITESPACE* segment WHITESPACE*\nexpression_value ::= [^`]*\nexpression ::= BACK_TICK expression_value BACK_TICK\n\nEQUALS ::= "="\nSEGMENT_SEPARATOR ::= "."\nSINGLE_QUOTE ::= "\'"\nDOUBLE_QUOTE ::= \'"\'\nWHITESPACE ::= " "\nOPEN_CURL ::= "{"\nCLOSE_CURL ::= "}" \nOPEN_BRACKET ::= "[" \nCLOSE_BRACKET ::= "]"\nBACK_TICK ::= "`" \n');const D="{",M="'",V="`",F=e=>{if(!e)return!1;const t=e.charCodeAt(0);return!(32===t||34===t||39===t||40===t||41===t||42===t||46===t||61===t||91===t||93===t||96===t||123===t||125===t)},$=e=>{let t=1,r=e.charAt(0);const n=n=>{if(n&&r!==n)throw new Error(`Expected char: ${n} but got: ${r}`);return r=e.charAt(t),t+=1,r},o=()=>{for(;" "===r;)n()},i=()=>{var e,t;return null!=(t=null!=(e=(()=>{if(r===D&&(n(D),r===D)){n(D);const e=u();return n("}"),n("}"),e}})())?e:(()=>{if(r===V){n(V);let e=r;for(;n()&&r!==V;)e+=r;if(n(V),e)return S(e)}})())?t:(()=>{if(!F(r))return;let e=r;for(;n()&&F(r);)e+=r;return e?E(e):void 0})()},a=()=>{if(o(),r===M||'"'===r){const e=r===M;n(e?M:'"');const t=(e=>{if(!(null==r?void 0:r.match(e)))return;let t=r;for(;n()&&(null==r?void 0:r.match(e));)t+=r;return t?E(t):void 0})(/[^'"]+/);return n(e?M:'"'),t}return i()},s=()=>{if("["===r){n("["),o();let e=a();if(!e)throw new Error("Expected identifier");if(o(),(()=>{if("="!==r)return!1;for(;"="===r;)n();return!0})()){o();const t=a();e=x(e,t),o()}return e&&n("]"),e}},l=()=>{const e=[],t=(()=>{const e=[];let t=i();for(;void 0!==t;)e.push(t),t=i();if(0!==e.length)return A(e)})();if(t){e.push(t);let r=s();for(;void 0!==r;)e.push(r),r=s()}return e},u=()=>{const e=[];let t=l();for(;void 0!==t&&(e.push(...t),r&&"}"!==r);){if(0===t.length&&r)throw new Error(`Unexpected character: ${r}`);n("."),t=l()}return O(e)};try{return{status:!0,path:u()}}catch(c){return{status:!1,error:c.message}}};function H(e){return!("string"===typeof e||Array.isArray(e))}function z(e){const t=parseInt(e,10);return isNaN(t)?e:t}function W(e){return Array.isArray(e)?e:"string"===typeof e?e.split("."):e.asArray()}function Y(e,t,r){return e.findIndex((e=>!(!e||"object"!==typeof e)&&e[t]==r))}class q{constructor(e,t=(e=>new q(e))){const r=Array.isArray(e)?e:e.split(".");this.split=r.map((e=>{if("number"===typeof e)return e;const t=Number(e);return isNaN(t)?e:t})),Object.freeze(this.split),this.joined=this.split.join("."),this.factory=t}asArray(){return this.split}asString(){return this.joined}contains(e){const t=e.asArray();if(t.length<this.split.length)return!1;for(let r=0;r<this.split.length;r++)if(this.split[r]!==t[r])return!1;return!0}relative(e){return this.asArray().slice(e.asArray().length)}parent(){return this.factory(this.split.slice(0,-1))}key(){return this.split[this.split.length-1]}descendent(e){const t=W(e);return this.factory(this.split.concat(t))}}var G=Object.defineProperty,K=Object.getOwnPropertySymbols,Z=Object.prototype.hasOwnProperty,J=Object.prototype.propertyIsEnumerable,Q=(e,t,r)=>t in e?G(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,X=(e,t)=>{for(var r in t||(t={}))Z.call(t,r)&&Q(e,r,t[r]);if(K)for(var r of K(t))J.call(t,r)&&Q(e,r,t[r]);return e};function ee(e,t,r){var n;const o={updates:{},path:[]};function i(e){if("Value"===e.name)return e.value;if("PathNode"===e.name){const n=ee(e,t);n.updates&&(o.updates=X(X({},o.updates),n.updates));try{return t.convertToPath(t.getValue(n.path))}catch(r){throw new a.NestedError(`Unable to resolve path segment: ${n.path}`,r)}}if("Expression"===e.name)try{const r=t.evaluate(e.value);return t.convertToPath(r)}catch(r){throw new a.NestedError(`Unable to resolve path: ${e.value}`,r)}throw new Error(`Unable to resolve value for node: ${e.name}`)}function s(e){"string"===typeof e&&e.indexOf(".")>-1?e.split(".").forEach((e=>{o.path.push(z(e))})):o.path.push(e)}return e.path.forEach((function(e){var n,a;const l=null!=(n=null==r?void 0:r.beforeResolveNode.call(e,X(X({},o),t)))?n:e;switch(l.name){case"Expression":case"PathNode":s(i(l));break;case"Value":s(l.value);break;case"Query":{const e=null!=(a=t.getValue(o.path))?a:[],{key:r,value:n}=l,s=i(r),u=n&&i(n),c=Y(e,s,u);void 0===c||-1===c?(o.updates[[...o.path,e.length,s].join(".")]=u,o.path.push(e.length)):o.path.push(c);break}case"Concatenated":o.path.push(l.value.map(i).join(""));break;default:throw new Error(`Unsupported node type: ${l.name}`)}})),{path:o.path,updates:Object.keys(null!=(n=o.updates)?n:{}).length>0?o.updates:void 0}}var te=Object.defineProperty,re=Object.getOwnPropertySymbols,ne=Object.prototype.hasOwnProperty,oe=Object.prototype.propertyIsEnumerable,ie=(e,t,r)=>t in e?te(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,ae=(e,t)=>{for(var r in t||(t={}))ne.call(t,r)&&ie(e,r,t[r]);if(re)for(var r of re(t))oe.call(t,r)&&ie(e,r,t[r]);return e};const se=/^[\w\-@]+(\.[\w\-@]+)*$/,le=/[\s()*=`{}'"[\]]/,ue=/^[^.]+(\..+)*$/,ce={get:()=>{throw new Error("Not Implemented")},set:()=>{throw new Error("Not Implemented")},evaluate:()=>{throw new Error("Not Implemented")}};class he{constructor(e){this.hooks={skipOptimization:new i.a,beforeResolveNode:new i.c},this.parserOptions=ae(ae({},ce),e),this.cache={},this.parseCache={},this.parse=this.parse.bind(this)}normalizePath(e,t){var r,n;if(!le.test(e)&&ue.test(e)&&!0!==this.hooks.skipOptimization.call(e))return{path:e.split("."),updates:void 0};const o=null!=(r=this.parseCache[e])?r:$(e);if(this.parseCache[e]=o,"object"!==typeof o||!(null==o?void 0:o.status))throw new TypeError(`Cannot normalize path "${e}": ${null!=(n=null==o?void 0:o.error)?n:"Unknown Error."}`);try{return ee(o.path,t,this.hooks)}catch(i){throw new a.NestedError(`Cannot resolve binding: ${e}`,i)}}getBindingForNormalizedResult(e){const t=e.path.join(".");if(this.cache[t])return this.cache[t];const r=new q(""===t?[]:e.path,this.parse);return this.cache[t]=r,r}parse(e,t={}){if(H(e))return e;const r=ae(ae({},this.parserOptions),t);let n={};const o=Array.isArray(e)?e.join("."):String(e),i={getValue:e=>{const t=this.normalizePath(e.join("."),i);return r.get(this.getBindingForNormalizedResult(t))},evaluate:e=>r.evaluate(e),convertToPath:e=>{if(void 0===e)throw new Error("Attempted to convert undefined value to binding path");if("string"!==typeof e&&"number"!==typeof e&&"boolean"!==typeof e)throw new Error(`Attempting to convert ${typeof e} to a binding path.`);const t=this.normalizePath(String(e),i);t.updates&&(n=ae(ae({},n),t.updates));const r=t.path.join(".");if(""===r)throw new Error("Nested path resolved to an empty path");return r}},a=this.normalizePath(o,i);a.updates&&(n=ae(ae({},n),a.updates));const s=Object.keys(n);if(!r.readOnly&&s.length>0){const e=s.map((e=>[this.parse(e),n[e]]));r.set(e)}return this.getBindingForNormalizedResult(a)}}class fe{constructor(){this.readDeps=new Set,this.writeDeps=new Set,this.namedDependencySets={},this.namedSet="core",this.createSubset("core"),this.createSubset("children")}createSubset(e,t=!1){!t&&this.namedDependencySets[e]||(this.namedDependencySets[e]={readDeps:new Set,writeDeps:new Set})}getDependencies(e){var t,r,n;return void 0!==e?null!=(n=null==(r=null==(t=this.namedDependencySets)?void 0:t[e])?void 0:r.readDeps)?n:new Set:this.readDeps}trackSubset(e){this.createSubset(e),this.namedSet=e}trackDefault(){this.namedSet="core"}getModified(e){var t,r,n;return void 0!==e?null!=(n=null==(r=null==(t=this.namedDependencySets)?void 0:t[e])?void 0:r.writeDeps)?n:new Set:this.writeDeps}readsBinding(e){return this.readDeps.has(e)}writesBinding(e){return this.writeDeps.has(e)}reset(){this.readDeps=new Set,this.writeDeps=new Set,this.namedDependencySets={},this.namedSet="core",this.createSubset("core",!0),this.createSubset("children",!0)}addReadDep(e,t=this.namedSet){var r,n;t&&(null==(n=null==(r=this.namedDependencySets)?void 0:r[t])||n.readDeps.add(e)),this.readDeps.add(e)}addWriteDep(e,t=this.namedSet){var r,n;t&&(null==(n=null==(r=this.namedDependencySets)?void 0:r[t])||n.writeDeps.add(e)),this.writeDeps.add(e)}addChildReadDep(e){this.addReadDep(e,"children")}}class pe extends fe{constructor(){super(),this.get=this.get.bind(this),this.set=this.set.bind(this)}set(e,t,r){var n;return e.forEach((([e])=>this.addWriteDep(e))),null!=(n=null==r?void 0:r.set(e,t))?n:[]}get(e,t,r){return this.addReadDep(e),null==r?void 0:r.get(e,t)}delete(e,t,r){return this.addWriteDep(e),null==r?void 0:r.delete(e,t)}}class de extends fe{constructor(e){super(),this.rootModel=e,this.set=this.set.bind(this),this.get=this.get.bind(this)}set(e,t){return e.forEach((([e])=>this.addWriteDep(e))),this.rootModel.set(e,t)}get(e,t){return this.addReadDep(e),this.rootModel.get(e,t)}delete(e,t){return this.addWriteDep(e),this.rootModel.delete(e,t)}}class ge{get(){}set(){return[]}delete(){}}const ve=new ge,ye=new q([]);function me(e,t){function r(r,n){const o=H(r)?r:t(r,{get:e.get,set:e.set,readOnly:n});if(!o)throw new Error("Unable to parse binding");return o}return{get:(t,n)=>e.get(r(t,!0),n),set:(t,n)=>e.set(t.map((([e,t])=>[r(e,!1),t])),n),delete:(t,n)=>e.delete(r(t,!1),n)}}function be(e,t,r){return r?{get:(n,o)=>{const i=null!=o?o:t;return e.get?e.get(n,i,r):null==r?void 0:r.get(n,i)},set:(n,o)=>{const i=null!=o?o:t;return e.set?e.set(n,i,r):null==r?void 0:r.set(n,i)},delete:(n,o)=>{const i=null!=o?o:t;return e.delete?e.delete(n,i,r):null==r?void 0:r.delete(n,i)}}:e}function we(e){if(0===e.length)return ve;if(1===e.length)return be(e[0]);function t(t){var r;return null!=(r=e.reduce(((e,r)=>be(r,t,e)),void 0))?r:ve}return{get:(e,r)=>{var n;return null==(n=t(r))?void 0:n.get(e,r)},set:(e,r)=>{var n;return null==(n=t(r))?void 0:n.set(e,r)},delete:(e,r)=>{var n;return null==(n=t(r))?void 0:n.delete(e,r)}}}class Ee{constructor(e=[]){this.hooks={onSet:new i.b},this.pipeline=e,this.effectiveDataModel=we(this.pipeline)}setMiddleware(e){this.pipeline=e,this.effectiveDataModel=we(e)}addMiddleware(e){this.pipeline=[...this.pipeline,e],this.effectiveDataModel=we(this.pipeline)}reset(e={}){this.pipeline.forEach((e=>{var t;"reset"in e&&(null==(t=e.reset)||t.call(e))})),this.set([[ye,e]])}set(e,t){const r=this.effectiveDataModel.set(e,t);return this.hooks.onSet.call(e),r}get(e,t){return this.effectiveDataModel.get(e,t)}delete(e,t){return this.effectiveDataModel.delete(e,t)}}class Se{constructor(e={}){this.model=e,this.get=this.get.bind(this),this.set=this.set.bind(this)}reset(e={}){this.model=e}get(e){return e&&e.asString()?p()(this.model,e.asArray()):this.model}set(e){const t=[];return e.forEach((([e,r])=>{const n=this.get(e);this.model=Object(d.setIn)(this.model,e.asArray(),r),t.push({binding:e,oldValue:n,newValue:r})})),t}delete(e){const t=e.parent();if(t){const r=this.get(t);void 0!==r&&(Array.isArray(r)?this.model=Object(d.setIn)(this.model,t.asArray(),Object(d.removeAt)(r,e.key())):this.model=Object(d.setIn)(this.model,t.asArray(),Object(d.omit)(r,e.key())))}}}const Oe=Symbol("Expression Node ID");function xe(e){return"object"===typeof e&&null!==e&&!Array.isArray(e)&&e.__id===Oe}const Ae=46,ke=40,Pe=123,Re=125,_e=!0,Te={"-":_e,"!":_e,"~":_e,"+":_e},Ce={"=":3,"+=":3,"-=":3,"&=":3,"|=":3,"||":5,"&&":6,"|":7,"^":8,"&":9,"==":10,"!=":10,"===":10,"!==":10,"<":11,">":11,"<=":11,">=":11,"<<":12,">>":12,">>>":12,"+":13,"-":13,"*":14,"/":14,"%":14};function je(e,t){const r=new Error(`${e} at character ${t}`);throw r.index=t,r.description=e,r}function Ne(e,t){if(e&&t)return{start:e.start,end:t.end}}function Ue(e){let t=0;return Object.keys(e).forEach((r=>{r.length>t&&Object.prototype.hasOwnProperty.call(e,r)&&(t=r.length)})),t}const Le=Ue(Te),Be=Ue(Ce),Ie={true:!0,false:!1,null:null,undefined:void 0};function De(e){return Ce[e]||0}function Me(e,t,r,n){let o;return o="||"===e||"&&"===e?"LogicalExpression":"="===e?"Assignment":"+="===e||"-="===e||"&="===e||"|="===e?"Modification":"BinaryExpression",{__id:Oe,type:o,operator:e,left:t,right:r,location:n}}function Ve(e){return e>=48&&e<=57}function Fe(e){return 36===e||95===e||e>=65&&e<=90||e>=97&&e<=122}function $e(e){return 36===e||95===e||e>=65&&e<=90||e>=97&&e<=122||e>=48&&e<=57}function He(e,t){var r;const n=null==(r=null==t?void 0:t.strict)||r,o=e.charAt,i=e.charCodeAt,{length:a}=e;let s=0;const l=e=>({start:{character:e},end:{character:s}});function u(t){return o.call(e,t)}function c(t){return i.call(e,t)}function h(){let e=c(s);for(;32===e||9===e;)e=c(++s)}function f(){const e=function(){let e,t,r,n=d(),o=p();if(!o)return n;let i={value:o,prec:De(o)},a=d();a||je(`Expected expression after ${o}`,s);const l=[n,i,a];o=p();for(;o&&(t=De(o),0!==t);){for(i={value:o,prec:t};l.length>2&&t<=l[l.length-2].prec;)a=l.pop(),o=l.pop().value,n=l.pop(),e=Me(o,n,a,Ne(n.location,a.location)),l.push(e);e=d(),e||je(`Expected expression after ${o}`,s),l.push(i,e),o=p()}r=l.length-1,e=l[r];for(;r>1;)e=Me(l[r-1].value,l[r-2],e,Ne(l[r-2].location,e.location)),r-=2;return e}();h();const t=s;if(s<a&&63===c(s)){s++;const r=f();if(r||je("Expected expression",s),h(),58===c(s)){s++;const n=f();return n||je("Expected expression",s),{__id:Oe,type:"ConditionalExpression",test:e,consequent:r,alternate:n,location:l(t)}}je("Expected :",s)}return e}function p(){h();let t=e.substr(s,Be),r=t.length;for(;r>0;){if(Object.prototype.hasOwnProperty.call(Ce,t))return s+=r,t;t=t.substr(0,--r)}return!1}function d(){h();const t=c(s),r=s;if(Ve(t)||46===t)return function(){let e="";const t=s;for(;Ve(c(s));)e+=u(s++);if(c(s)===Ae)for(e+=u(s++);Ve(c(s));)e+=u(s++);let r=u(s);if("e"===r||"E"===r){for(e+=u(s++),r=u(s),"+"!==r&&"-"!==r||(e+=u(s++));Ve(c(s));)e+=u(s++);Ve(c(s-1))||je(`Expected exponent (${e}${u(s)})`,s)}const n=c(s);Fe(n)?je(`Variable names cannot start with a number (${e}${u(s)})`,s):n===Ae&&je("Unexpected period",s);return{__id:Oe,type:"Literal",value:parseFloat(e),raw:e,location:l(t)}}();if(39===t||34===t)return g();if(Fe(t)||40===t)return function(){let e=c(s),t=e===ke?function(){s++;const e=f();if(h(),41===c(s))return s++,e;je("Unclosed (",s)}():v();const r=s;h(),e=c(s);for(;e===Ae||91===e||e===ke;)s++,e===Ae?(h(),t={__id:Oe,type:"MemberExpression",computed:!1,object:t,property:v(),location:l(r)}):91===e?(t={__id:Oe,type:"MemberExpression",computed:!0,object:t,property:f(),location:l(r)},h(),e=c(s),93!==e&&je("Unclosed [",s),s++):e===ke&&(t={__id:Oe,type:"CallExpression",args:y(41),callTarget:t,location:l(r)}),h(),e=c(s);return t}();if(91===t)return function(){const e=s;return s++,{__id:Oe,type:"ArrayExpression",elements:y(93),location:l(e)}}();if(n=t,o=c(s+1),n===Pe&&o===Pe)return function(){let e="",t=!1,r=1;const n=s;s+=2;for(;s<a;){const n=u(s++);if("}"===n&&c(s)===Re){if(s++,r--,0===r){t=!0;break}e+="}}"}else"{"===n&&c(s)===Pe?(r++,e+="{{",s++):e+=n}t||je(`Unclosed brace after "${e}"`,s);return{__id:Oe,type:"ModelRef",ref:e,location:l(n)}}();var n,o;if(t===Pe)return function(){const e=[];let t,r,n,o=!1,i=!0;const u=s;for(++s;s<a;){if(h(),n=c(s),125===n){t&&je("A key was defined but a value was not",s),s++,o=!0;break}i?(39!==n&&34!==n&&je("An object must start wtih a key",s),t=g(),h(),58===c(s)?(s++,i=!1):je("A colon must follow an object key",s)):(r=f(),e.push({key:t,value:r}),h(),n=c(s),44===n?s++:125!==n&&je("Please add a comma to add another key",s),i=!0,t=void 0,r=void 0),n=c(s)}return o||je("Unclosed brace in object",s),{__id:Oe,type:"Object",attributes:e,location:l(u)}}();let i=e.substr(s,Le),p=i.length;for(;p>0;){if(Object.prototype.hasOwnProperty.call(Te,i))return s+=p,{__id:Oe,type:"UnaryExpression",operator:i,argument:d(),prefix:!0,location:l(r)};i=i.substr(0,--p)}return!1}function g(){const e=u(s++);let t="",r=!1;const n=s;for(;s<a;){let n=u(s++);if(n===e){r=!0;break}if("\\"===n)switch(n=u(s++),n){case"n":t+="\n";break;case"r":t+="\r";break;case"t":t+="\t";break;case"b":t+="\b";break;case"f":t+="\f";break;case"v":t+="\v"}else t+=n}return r||je(`Unclosed quote after "${t}"`,s),{__id:Oe,type:"Literal",value:t,raw:`${e}${t}${e}`,location:l(n)}}function v(){const t=s;let r=c(t);for(Fe(r)?s++:je(`Unexpected ${u(s)}`,s);s<a&&(r=c(s),$e(r));)s++;const n=e.slice(t,s);return Object.prototype.hasOwnProperty.call(Ie,n)?{__id:Oe,type:"Literal",value:Ie[n],raw:n,location:l(t)}:"this"===n?{__id:Oe,type:"ThisExpression",location:l(t)}:{__id:Oe,type:"Identifier",name:n,location:l(t)}}function y(e){const t=[];let r,n;for(;s<a;){if(h(),r=c(s),r===e){s++;break}44!==r?(n=f(),n&&"Compound"!==n.type||je("Expected comma",s),t.push(n)):s++}return r!==e&&je(`Expected ${String.fromCharCode(e)}`,s),t}const m=[];try{for(;s<a;){const e=c(s);if(59===e||44===e){s++;continue}const t=f();t?m.push(t):s<a&&je(`Unexpected "${u(s)}"`,s)}return 1===m.length?m[0]:{__id:Oe,type:"Compound",body:m,location:l(0)}}catch(b){if(n||!(b instanceof Error))throw b;return{__id:Oe,type:"Compound",body:m,location:l(0),error:b}}}const ze=(e,t,r,n)=>e.evaluate(t)?e.evaluate(r):n?e.evaluate(n):null;ze.resolveParams=!1;var We=Object.freeze({__proto__:null,setDataVal:(e,t,r)=>{e.model.set([[t,r]])},getDataVal:(e,t)=>e.model.get(t),deleteDataVal:(e,t)=>e.model.delete(t),conditional:ze});function Ye(e){return(t,...r)=>e(...r)}function qe(e,t){var r,n,o,i,a;switch(e.type){case"Modification":case"Assignment":case"LogicalExpression":case"BinaryExpression":{const n=null!=(r=qe(e.left,t))?r:qe(e.right,t);if(n)return n;break}case"UnaryExpression":{const r=qe(e.argument,t);if(r)return r;break}case"MemberExpression":{const r=null!=(n=qe(e.object,t))?n:qe(e.property,t);if(r)return r;break}case"ConditionalExpression":{const r=null!=(i=null!=(o=qe(e.test,t))?o:qe(e.consequent,t))?i:qe(e.alternate,t);if(r)return r;break}case"ArrayExpression":case"Compound":{const r=("ArrayExpression"===e.type?e.elements:e.body).find((e=>qe(e,t)));if(r)return r;break}case"Object":{const r=e.attributes.reduce(((e,r)=>{var n;return null!=(n=null!=e?e:qe(r.key,t))?n:qe(r.value,t)}),void 0);if(r)return r;break}case"CallExpression":{const r=null!=(a=e.args.find((e=>qe(e,t))))?a:qe(e.callTarget,t);if(r)return r;break}}if(e.location&&function(e,t){return e.character>=t.start.character&&e.character<=t.end.character}(t,e.location))return e}function Ge(e){return!xe(e)&&("object"===typeof e&&null!==e&&!Array.isArray(e)&&"value"in e)}var Ke=Object.defineProperty,Ze=Object.defineProperties,Je=Object.getOwnPropertyDescriptors,Qe=Object.getOwnPropertySymbols,Xe=Object.prototype.hasOwnProperty,et=Object.prototype.propertyIsEnumerable,tt=(e,t,r)=>t in e?Ke(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,rt=(e,t)=>{for(var r in t||(t={}))Xe.call(t,r)&&tt(e,r,t[r]);if(Qe)for(var r of Qe(t))et.call(t,r)&&tt(e,r,t[r]);return e},nt=(e,t)=>Ze(e,Je(t));const ot=(e,t,r)=>e.evaluate(t)&&e.evaluate(r);ot.resolveParams=!1;const it=(e,t,r)=>e.evaluate(t)||e.evaluate(r);it.resolveParams=!1;const at={"+":(e,t)=>e+t,"-":(e,t)=>e-t,"*":(e,t)=>e*t,"/":(e,t)=>e/t,"%":(e,t)=>e%t,"==":(e,t)=>e==t,"!=":(e,t)=>e!=t,">":(e,t)=>e>t,">=":(e,t)=>e>=t,"<":(e,t)=>e<t,"<=":(e,t)=>e<=t,"&&":ot,"||":it,"!==":(e,t)=>e!==t,"===":(e,t)=>e===t,"|":(e,t)=>e|t,"&":(e,t)=>e&t,"+=":(e,t)=>e+t,"-=":(e,t)=>e-t,"&=":(e,t)=>e&t,"|=":(e,t)=>e|t},st={"-":e=>-e,"+":e=>Number(e),"!":e=>!e};class lt{constructor(e){this.vars={},this.hooks={resolve:new i.c,resolveOptions:new i.c,beforeEvaluate:new i.c,onError:new i.a},this.expressionsCache=new Map,this.operators={binary:new Map(Object.entries(at)),unary:new Map(Object.entries(st)),expressions:new Map(Object.entries(We))},this.defaultHookOptions=nt(rt({},e),{evaluate:e=>this.evaluate(e,this.defaultHookOptions),resolveNode:e=>this._execAST(e,this.defaultHookOptions)}),this.hooks.resolve.tap("ExpressionEvaluator",this._resolveNode.bind(this)),this.evaluate=this.evaluate.bind(this)}reset(){this.expressionsCache.clear()}evaluate(e,t){var r;const n=this.hooks.resolveOptions.call(nt(rt(rt({},this.defaultHookOptions),t),{resolveNode:e=>this._execAST(e,n)}));let o=null!=(r=this.hooks.beforeEvaluate.call(e,n))?r:e;for(;Ge(o);)o=o.value;return"number"===typeof o||"boolean"===typeof o||void 0===o||null===o?o:xe(o)?this._execAST(o,n):Array.isArray(o)?o.reduce(((e,r)=>this.evaluate(r,t)),null):this._execString(String(o),n)}addExpressionFunction(e,t){this.operators.expressions.set(e,t)}addBinaryOperator(e,t){this.operators.binary.set(e,t)}addUnaryOperator(e,t){this.operators.unary.set(e,t)}setExpressionVariable(e,t){this.vars[e]=t}getExpressionVariable(e){return this.vars[e]}_execAST(e,t){return this.hooks.resolve.call(void 0,e,t)}_execString(e,t){var r;if(""===e)return e;const n=e.match(/^@\[(.*)\]@$/);let o,i=e;n&&([,i]=Array.from(n));try{o=null!=(r=this.expressionsCache.get(i))?r:He(i),this.expressionsCache.set(i,o)}catch(s){if(t.throwErrors||!this.hooks.onError.call(s))throw new a.NestedError(`Error parsing expression: ${e}`,s);return}try{return this._execAST(o,t)}catch(s){if(t.throwErrors||!this.hooks.onError.call(s))throw new a.NestedError(`Error evaluating expression: ${e}`,s)}}_resolveNode(e,t,r){const{resolveNode:n,model:o}=r,i=nt(rt({},r),{evaluate:e=>this.evaluate(e,r)});if("Literal"===t.type)return t.value;if("Identifier"===t.type)return this.vars[t.name];if("Compound"===t.type||"ThisExpression"===t.type)throw new Error(`Expression type: ${t.type} is not supported`);if("BinaryExpression"===t.type||"LogicalExpression"===t.type){const e=this.operators.binary.get(t.operator);return e?"resolveParams"in e?!1===e.resolveParams?e(i,t.left,t.right):e(i,n(t.left),n(t.right)):e(n(t.left),n(t.right)):void 0}if("UnaryExpression"===t.type){const e=this.operators.unary.get(t.operator);return e?"resolveParams"in e?e(i,!1===e.resolveParams?t.argument:n(t.argument)):e(n(t.argument)):void 0}if("Object"===t.type){const{attributes:e}=t,r={};return e.forEach((e=>{const t=n(e.key),o=n(e.value);r[t]=o})),r}if("CallExpression"===t.type){const e=t.callTarget.name,r=this.operators.expressions.get(e);if(!r)throw new Error(`Unknown expression function: ${e}`);if("resolveParams"in r&&!1===r.resolveParams)return r(i,...t.args);return r(i,...t.args.map((e=>n(e))))}if("ModelRef"===t.type)return o.get(t.ref,{context:{model:r.model}});if("MemberExpression"===t.type){return n(t.object)[n(t.property)]}if("Assignment"!==t.type){if("ConditionalExpression"===t.type){const e=n(t.test)?t.consequent:t.alternate;return n(e)}if("ArrayExpression"===t.type)return t.elements.map((e=>n(e)));if("Modification"===t.type){const e=this.operators.binary.get(t.operator);if(e){let r;return r="resolveParams"in e?!1===e.resolveParams?e(i,t.left,t.right):e(i,n(t.left),n(t.right)):e(n(t.left),n(t.right)),"ModelRef"===t.left.type?o.set([[t.left.ref,r]]):"Identifier"===t.left.type&&(this.vars[t.left.name]=r),r}return n(t.left)}}else{if("ModelRef"===t.left.type){const e=n(t.right);return o.set([[t.left.ref,e]]),e}if("Identifier"===t.left.type){const e=n(t.right);return this.vars[t.left.name]=e,e}}}}const ut=["trace","debug","info","warn","error"];class ct{constructor(e="warn",t=console){this.trace=this.createHandler("trace"),this.debug=this.createHandler("debug"),this.info=this.createHandler("info"),this.warn=this.createHandler("warn"),this.error=this.createHandler("error"),this.severity=e,this._console=t}setSeverity(e){this.severity=e}getConsoleFn(e){switch(ut.indexOf(e)){case 0:case 1:case 2:return this._console.log;case 3:return this._console.warn;default:return this._console.error}}createHandler(e){return(...t)=>{ut.indexOf(e)>=ut.indexOf(this.severity)&&this.getConsoleFn(e)(`player - ${e} -`,...t)}}}const ht=()=>{};class ft{constructor(){this.trace=ht,this.debug=ht,this.info=ht,this.warn=ht,this.error=ht}}class pt{constructor(){this.hooks={trace:new i.b,debug:new i.b,info:new i.b,warn:new i.b,error:new i.b,log:new i.b},this.logHandlers=new Set,this.trace=this.createHandler("trace"),this.debug=this.createHandler("debug"),this.info=this.createHandler("info"),this.warn=this.createHandler("warn"),this.error=this.createHandler("error")}createHandler(e){return(...t)=>{this.hooks[e].call(t),this.hooks.log.call(e,t),this.logHandlers.forEach((r=>r[e](...t)))}}addHandler(e){this.logHandlers.add(e)}removeHandler(e){this.logHandlers.delete(e)}}class dt{constructor(e){this.trace=this.createHandler("trace"),this.debug=this.createHandler("debug"),this.info=this.createHandler("info"),this.warn=this.createHandler("warn"),this.error=this.createHandler("error"),this.proxiedLoggerProvider=e}createHandler(e){return(...t)=>{const r=this.proxiedLoggerProvider();null==r||r[e](...t)}}}var gt=Object.defineProperty,vt=Object.defineProperties,yt=Object.getOwnPropertyDescriptors,mt=Object.getOwnPropertySymbols,bt=Object.prototype.hasOwnProperty,wt=Object.prototype.propertyIsEnumerable,Et=(e,t,r)=>t in e?gt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,St=(e,t)=>{for(var r in t||(t={}))bt.call(t,r)&&Et(e,r,t[r]);if(mt)for(var r of mt(t))wt.call(t,r)&&Et(e,r,t[r]);return e};const Ot=e=>e;function xt(e){const t=new Map;if(!e.ROOT)return t;const r=[{node:e.ROOT,path:[],visited:new Set}];for(;r.length>0;){const n=r.shift();if(!n)break;const{node:o,path:i,visited:a}=n;Object.entries(o).forEach((([n,o])=>{const s=[...i,n],l=s.join(".");if(t.has(l))throw new Error("Path has already been processed. There's either a loop somewhere or a bug");if(a.has(o.type))throw new Error(`Path already contained type: ${o.type}. This likely indicates a loop in the schema`);t.set(l,o),o.isArray&&s.push("[]"),o.isRecord&&s.push("{}"),o.type&&e[o.type]&&r.push({path:s,node:e[o.type],visited:new Set([...a,o.type])})}))}return t}class At{constructor(e){this.formatters=new Map,this.types=new Map,this.schema=new Map,this.bindingSchemaNormalizedCache=new Map,this.hooks={resolveTypeForBinding:new i.c},this.schema=e?xt(e):new Map}addFormatters(e){e.forEach((e=>{this.formatters.set(e.name,e)}))}addDataTypes(e){e.forEach((e=>{this.types.set(e.type,e)}))}getValidationsForBinding(e){var t;const r=this.getApparentType(e);if(null==(t=null==r?void 0:r.validation)?void 0:t.length)return r.validation.map((e=>St({severity:"error",trigger:"change"},e)))}normalizeBinding(e){const t=this.bindingSchemaNormalizedCache.get(e);if(t)return t;let r=e.asArray(),n=r.map((e=>"number"===typeof e?"[]":e)).join(".");return n&&(this.bindingSchemaNormalizedCache.set(e,n),r=n.split(".")),r.forEach((t=>{const o=r.map((e=>e===t?"{}":e)).join(".");this.schema.get(o)&&(this.bindingSchemaNormalizedCache.set(e,o),r=o.split("."),n=o)})),n}getType(e){return this.hooks.resolveTypeForBinding.call(this.schema.get(this.normalizeBinding(e)),e)}getApparentType(e){var t,r;const n=this.getType(e);if(void 0===n)return;const o=this.getTypeDefinition(null==n?void 0:n.type);return void 0===o?n:(i=St(St({},o),n),a={validation:[...null!=(t=n.validation)?t:[],...null!=(r=o.validation)?r:[]]},vt(i,yt(a)));var i,a}getTypeDefinition(e){return this.types.get(e)}getFormatterForType(e){const t=e,{type:r}=t,n=((e,t)=>{var r={};for(var n in e)bt.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&mt)for(var n of mt(e))t.indexOf(n)<0&&wt.call(e,n)&&(r[n]=e[n]);return r})(t,["type"]),o=this.formatters.get(r);if(o)return{format:o.format?e=>{var t;return null==(t=o.format)?void 0:t.call(o,e,n)}:Ot,deformat:o.deformat?e=>{var t;return null==(t=o.deformat)?void 0:t.call(o,e,n)}:Ot}}getFormatter(e){const t=this.getApparentType(e);if(null==t?void 0:t.format)return this.getFormatterForType(t.format)}}const kt="{{",Pt="}}";function Rt(e){const t=e.indexOf(kt);if(-1===t)return;let r=1,n=t+kt.length,o=e.substring(t+kt.length);for(;r>0&&o.length>0;){const e=o.indexOf(Pt);if(-1===e)break;const t=o.indexOf(kt);-1!==t&&t<e?(r++,o=o.substring(t+kt.length),n+=t+kt.length):(r--,o=o.substring(e+Pt.length),n+=e+Pt.length)}if(0!==r)throw new Error(`Unbalanced {{ and }} in exp: ${e}`);return{start:t,end:n}}function _t(e,{evaluate:t}){if(!t)return e;const r=/@\[.*?\]@/;let n=e,o=n.match(r);for(;null!==o;){const i=o[0],a=n.indexOf(i),s=t(i.substr("@[".length,i.length-"@[".length-"]@".length));if(0===a&&i===e&&"string"!==typeof s)return s;n=n.substr(0,a)+s+n.substr(a+i.length),o=n.match(r)}return n}function Tt(e,t){const{model:r,formatted:n=!0}=t;let o=_t(e,t);if(!r||"string"!==typeof o||-1===o.indexOf(kt))return o;for(;-1!==o.indexOf(kt);){const e=Rt(o);if(!e)return o;const{start:t,end:i}=e,a=o.substring(t+kt.length,i-kt.length).trim(),s=r.get(a,{formatted:n});if(0===t&&i===o.length&&"string"!==typeof s)return s;o=o.substr(0,t)+s+o.substr(i)}return o}function Ct(e,t){switch(typeof e){case"string":return Tt(e,t);case"object":{if(!e)return e;const r=Object.keys(e);let n=e;return r.length>0&&r.forEach((r=>{n=Object(d.setIn)(n,[r],Ct(e[r],t))})),n}default:return e}}function jt(e,t){return Ct(e,t)}function Nt(e,t){const r=new Map(e),n=t.parent(),o=t.key();if(r.forEach(((e,n)=>{(t===n||t.contains(n))&&r.delete(n)})),"number"===typeof o){Array.from(e.keys()).filter((e=>{if(n.contains(e)){const[t]=e.relative(n);return"number"===typeof t&&t>o}return!1})).sort().forEach((e=>{const[t,...o]=e.relative(n);if("number"===typeof t){const i=[t-1,...o],a=n.descendent(i);r.set(a,r.get(e)),r.delete(e)}}))}return r}var Ut,Lt,Bt=Object.defineProperty,It=Object.defineProperties,Dt=Object.getOwnPropertyDescriptors,Mt=Object.getOwnPropertySymbols,Vt=Object.prototype.hasOwnProperty,Ft=Object.prototype.propertyIsEnumerable,$t=(e,t,r)=>t in e?Bt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;class Ht{constructor(e,t){this.validator=e,this.shadowModelPaths=new Map,this.logger=null==t?void 0:t.logger,this.shouldIncludeInvalid=null==t?void 0:t.shouldIncludeInvalid}set(e,t,r){const n=be(this,(o=((e,t)=>{for(var r in t||(t={}))Vt.call(t,r)&&$t(e,r,t[r]);if(Mt)for(var r of Mt(t))Ft.call(t,r)&&$t(e,r,t[r]);return e})({},t),It(o,Dt({includeInvalid:!0}))),r);var o;const i=[],a=new Set;e.forEach((([e,t])=>{this.shadowModelPaths.set(e,t),a.add(e)}));const s=[];this.shadowModelPaths.forEach(((e,t)=>{var r;const o=this.validator(t,n);void 0===o?i.push([t,e]):o instanceof Set?o.forEach((r=>{s.push(r.binding),r.isStrong||r.binding.asString()!==t.asString()||i.push([r.binding,e])})):a.has(t)&&(s.push(t),null==(r=this.logger)||r.debug(`Invalid value for path: ${t.asString()} - ${o.severity} - ${o.message}`))}));let l=[];if(r&&i.length>0){i.forEach((([e])=>this.shadowModelPaths.delete(e)));const e=r.set(i,t);if(0===s.length)return e;l=e}const u=s.map((e=>({binding:e,oldValue:n.get(e),newValue:n.get(e),force:!0})));return[...l,...u]}get(e,t,r){var n,o;let i=null==r?void 0:r.get(e,t);return(null!=(o=null==(n=this.shouldIncludeInvalid)?void 0:n.call(this,t))?o:!0===(null==t?void 0:t.includeInvalid))&&this.shadowModelPaths.forEach(((t,r)=>{r!==e?e.contains(r)&&(i=Object(d.setIn)(i,r.relative(e),t)):i=t})),i}delete(e,t,r){return this.shadowModelPaths=Nt(this.shadowModelPaths,e),null==r?void 0:r.delete(e,t)}}class zt{constructor(){this.registry=new Map}get(e){return this.registry.get(e)}register(e,t){this.registry.set(e,t)}}function Wt(e){return Object.prototype.hasOwnProperty.call(e,"async")}function Yt(e){var t;if(e)return"value"in e&&"object"===typeof e.value&&"string"===typeof(null==(t=e.value)?void 0:t.id)?e.value.id:void 0}(Lt=Ut||(Ut={})).Asset="asset",Lt.View="view",Lt.Applicability="applicability",Lt.Template="template",Lt.Value="value",Lt.MultiNode="multi-node",Lt.Switch="switch",Lt.Async="async",Lt.Unknown="unknown",Lt.Empty="empty";var qt=Object.defineProperty,Gt=Object.defineProperties,Kt=Object.getOwnPropertyDescriptors,Zt=Object.getOwnPropertySymbols,Jt=Object.prototype.hasOwnProperty,Qt=Object.prototype.propertyIsEnumerable,Xt=(e,t,r)=>t in e?qt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,er=(e,t)=>{for(var r in t||(t={}))Jt.call(t,r)&&Xt(e,r,t[r]);if(Zt)for(var r of Zt(t))Qt.call(t,r)&&Xt(e,r,t[r]);return e},tr=(e,t)=>Gt(e,Kt(t));const rr={type:Ut.Empty};class nr{constructor(){this.hooks={onParseObject:new i.c,onCreateASTNode:new i.c,determineNodeType:new i.a,parseNode:new i.a}}parseView(e){const t=this.parseObject(e,Ut.View);if(!t)throw new Error("Unable to parse object into a view");return t}parseAsync(e,t,r){const n=this.parseObject(Object(d.omit)(e,"async"),t,r),o=Yt(n);return null!==n&&o?this.createASTNode({id:o,type:Ut.Async,value:n},e):null}createASTNode(e,t){const r=this.hooks.onCreateASTNode.call(e,t);return void 0===r?e:r}hasTemplateValues(e,t){return Object.hasOwnProperty.call(e,"template")&&Array.isArray(null==e?void 0:e.template)&&e.template.length&&e.template.find((e=>e.output===t))}parseObject(e,t=Ut.Value,r={templateDepth:0}){var n;const o=this.hooks.determineNodeType.call(e);if(void 0!==o){const n=this.hooks.parseNode.call(e,t,r,o);if(n)return n}const i=(e,n,o=[])=>{if("object"!==typeof n||null===n)return{value:n,children:[]};const a=this.hooks.onParseObject.call(n,t);if(!a)return e;const s={children:[],value:e};return(Array.isArray(a)?a.map(((e,t)=>[t,e])):[...Object.entries(a),...Object.getOwnPropertySymbols(a).map((e=>[e,a[e]]))]).reduce(((e,t)=>{var n;const s=e,{children:l}=s,u=((e,t)=>{var r={};for(var n in e)Jt.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&Zt)for(var n of Zt(e))t.indexOf(n)<0&&Qt.call(e,n)&&(r[n]=e[n]);return r})(s,["children"]),[c,h]=t;if("asset"===c&&"object"===typeof h){const e=this.parseObject(h,Ut.Asset,r);if(e)return tr(er({},u),{children:[...l,{path:[...o,"asset"],value:e}]})}else{if(this.hooks.determineNodeType.call(c)===Ut.Template&&Array.isArray(h)){const e=h.map((e=>{var t,n;const i=this.hooks.onCreateASTNode.call({type:Ut.Template,depth:null!=(t=r.templateDepth)?t:0,data:e.data,template:e.value,dynamic:null!=(n=e.dynamic)&&n},e);if((null==i?void 0:i.type)===Ut.MultiNode&&i.values.forEach((e=>{e.parent=i})),i)return{path:[...o,e.output],value:i}})).filter((e=>!!e));return tr(er({},u),{children:[...l,...e]})}if(h&&this.hooks.determineNodeType.call(h)===Ut.Switch){const e=this.hooks.parseNode.call(h,Ut.Value,r,Ut.Switch);if(e&&e.type===Ut.Value&&1===(null==(n=e.children)?void 0:n.length)&&void 0===e.value){const t=e.children[0];return tr(er({},u),{children:[...l,{path:[...o,c,...t.path],value:t.value}]})}if(e)return tr(er({},u),{children:[...l,{path:[...o,c],value:e}]})}else if(h&&Wt(h)){const e=this.parseAsync(h,Ut.Value,r);e&&l.push({path:[...o,c],value:e})}else if(h&&Array.isArray(h)){const e=h.map((e=>this.parseObject(e,Ut.Value,r))).filter((e=>!!e));if(e.length>0){const t=this.hooks.onCreateASTNode.call({type:Ut.MultiNode,override:!this.hasTemplateValues(a,c),values:e},h);if((null==t?void 0:t.type)===Ut.MultiNode&&t.values.forEach((e=>{e.parent=t})),t)return tr(er({},u),{children:[...l,{path:[...o,c],value:t}]})}}else{if(!h||"object"!==typeof h){return{children:l,value:Object(d.setIn)(e.value,[...o,c],h)}}{const t=this.hooks.determineNodeType.call(h);if(t!==Ut.Applicability){const t=i(e.value,h,[...o,c]);return{value:t.value,children:[...l,...t.children]}}{const e=this.hooks.parseNode.call(h,Ut.Value,r,t);if(e)return tr(er({},u),{children:[...l,{path:[...o,c],value:e}]})}}}}return e}),s)},{value:a,children:s}=i(void 0,e),l=void 0===a&&0===s.length?void 0:{type:t,value:a};if(void 0!==l&&s.length>0){const e=l;e.children=s,s.forEach((t=>{t.value.parent=e}))}return null!=(n=this.hooks.onCreateASTNode.call(l,e))?n:null}}var or=Object.defineProperty,ir=Object.defineProperties,ar=Object.getOwnPropertyDescriptors,sr=Object.getOwnPropertySymbols,lr=Object.prototype.hasOwnProperty,ur=Object.prototype.propertyIsEnumerable,cr=(e,t,r)=>t in e?or(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;function hr(e,t){if(!e||!t)return!0;const r=Array.from(t.values()),n=Array.from(e.values());return void 0!==r.find((e=>!!n.find((t=>t===e||t.contains(e)||e.contains(t)))))}function fr(e){return t=((e,t)=>{for(var r in t||(t={}))lr.call(t,r)&&cr(e,r,t[r]);if(sr)for(var r of sr(t))ur.call(t,r)&&cr(e,r,t[r]);return e})({},e),r={data:{model:e.model,formatValue:(t,r)=>e.formatValue?e.formatValue(t,r):r,format:(t,r)=>e.format?e.format(H(t)?t:e.parseBinding(t),r):r},evaluate:t=>e.evaluator.evaluate(t,e)},ir(t,ar(r));var t,r}function pr(e,t){Array.isArray(e)?e.forEach((e=>{pr(e,t)})):t.push(e)}var dr=Object.defineProperty,gr=Object.defineProperties,vr=Object.getOwnPropertyDescriptors,yr=Object.getOwnPropertySymbols,mr=Object.prototype.hasOwnProperty,br=Object.prototype.propertyIsEnumerable,wr=(e,t,r)=>t in e?dr(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,Er=(e,t)=>{for(var r in t||(t={}))mr.call(t,r)&&wr(e,r,t[r]);if(yr)for(var r of yr(t))br.call(t,r)&&wr(e,r,t[r]);return e},Sr=(e,t)=>gr(e,vr(t));class Or{constructor(e,t){this.hooks={skipResolve:new i.c,beforeUpdate:new i.b,afterUpdate:new i.b,resolveOptions:new i.c,beforeResolve:new i.c,resolve:new i.c,afterResolve:new i.c,afterNodeUpdate:new i.b},this.root=e,this.options=t,this.resolveCache=new Map,this.ASTMap=new Map,this.logger=t.logger,this.idCache=new Set}getSourceNode(e){return this.ASTMap.get(e)}update(e){this.hooks.beforeUpdate.call(e);const t=new Map;this.idCache.clear();const r=new Map(this.ASTMap);this.ASTMap.clear();const n=this.computeTree(this.root,void 0,e,t,fr(this.options),void 0,r);return this.resolveCache=t,this.hooks.afterUpdate.call(n.value),n.value}getResolveCache(){return new Map(this.resolveCache)}getPreviousResult(e){var t,r;if(!e)return;const n=0===this.resolveCache.size,o=Yt(e);if(o){if(this.idCache.has(o))return void(n&&(e.type===Ut.Asset||e.type===Ut.View?null==(t=this.logger)||t.error(`Cache conflict: Found Asset/View nodes that have conflicting ids: ${o}, may cause cache issues.`):e.type===Ut.Value&&(null==(r=this.logger)||r.info(`Cache conflict: Found Value nodes that have conflicting ids: ${o}, may cause cache issues. To improve performance make value node IDs globally unique.`))));this.idCache.add(o)}return this.resolveCache.get(e)}cloneNode(e){const t=Object(d.clone)(e);return Object.keys(t).forEach((e=>{if("parent"===e)return;const r=t[e];"object"===typeof r&&null!==r&&(t[e]=Array.isArray(r)?[...r]:Er({},r))})),t}computeTree(e,t,r,n,o,i,a){var s,l,u;const c=new de(o.data.model);c.trackSubset("core");const h=(f=me(c,this.options.parseBinding),{get:(e,t)=>f.get(e,Er({context:{model:f}},t)),set:(e,t)=>f.set(e,Er({context:{model:f}},t)),delete:(e,t)=>f.delete(e,Er({context:{model:f}},t))});var f;const v=this.hooks.resolveOptions.call(Sr(Er({},o),{data:Sr(Er({},o.data),{model:h}),evaluate:e=>this.options.evaluator.evaluate(e,{model:h}),node:e}),e),y=this.getPreviousResult(e),m=null==y?void 0:y.dependencies,b=hr(r,m),w=this.hooks.skipResolve.call(!b,e,v),E=Sr(Er({},this.cloneNode(e)),{parent:i}),S=null!=(s=this.hooks.beforeResolve.call(E,v))?s:{type:Ut.Empty},O=S.type===Ut.MultiNode&&(null==(l=null==i?void 0:i.parent)?void 0:l.type)===Ut.MultiNode&&i.type===Ut.Value;if(y&&w){const r=Sr(Er({},y),{updated:!1}),o=(e,t,r)=>{var i;const{node:s}=e;this.ASTMap.set(s,t);const l=Sr(Er({},e),{updated:!1});n.set(t,l);const u=e=>{var r;const n=null!=(r=a.get(e))?r:e,i=this.getPreviousResult(n);i&&o(i,n,t)};"children"in s?null==(i=s.children)||i.forEach((({value:e})=>u(e))):s.type===Ut.MultiNode&&s.values.forEach(u),this.hooks.afterNodeUpdate.call(t,r,l)};return y.node.parent=i,o(y,e,t),r}S.parent=i,v.node=S,this.ASTMap.set(S,e);let x=this.hooks.resolve.call(void 0,S,v),A=!Object(g.a)(null==y?void 0:y.value,x);y&&!A&&(x=null==y?void 0:y.value);const k=new Set;if(c.trackSubset("children"),"children"in S){const t=null==(u=S.children)?void 0:u.map((t=>{const o=this.computeTree(t.value,e,r,n,v,S,a),{dependencies:i,node:s,updated:l,value:u}=o;if(i.forEach((e=>k.add(e))),u)if(s.type!==Ut.MultiNode||s.override)x=Object(d.setIn)(x,t.path,u);else{const e=Object(d.addLast)(p()(x,t.path,[]),u);x=Object(d.setIn)(x,t.path,e)}return A=A||l,Sr(Er({},t),{value:s})}));S.children=t}else if(S.type===Ut.MultiNode){const t=[],o=O?null==i?void 0:i.parent:e,s=S.values.map((e=>{var i;const s=this.computeTree(e,o,r,n,v,S,a);return void 0!==s.value&&null!==s.value&&((null==(i=s.node.parent)?void 0:i.type)===Ut.MultiNode&&Array.isArray(s.value)?s.value.forEach((e=>{pr(e,t)})):t.push(s.value)),s.dependencies.forEach((e=>k.add(e))),A=A||s.updated,s.node}));S.values=s,x=t}k.forEach((e=>c.addChildReadDep(e))),c.trackSubset("core"),y&&!A&&(x=null==y?void 0:y.value),x=this.hooks.afterResolve.call(x,S,Sr(Er({},v),{getDependencies:e=>c.getDependencies(e)}));const P={node:S,updated:A,value:x,dependencies:new Set([...c.getDependencies(),...k])};return this.hooks.afterNodeUpdate.call(e,O?null==i?void 0:i.parent:t,P),n.set(e,P),P}}class xr{constructor(e){this.hooks={resolveTemplateSubstitutions:new i.c},this.options=e}parseTemplate(e,t,r){const{template:n,depth:o}=t,i=r.data.model.get(t.data);if(!i)return null;if(!Array.isArray(i))throw new Error(`Template using '${t.data}' but is not an array`);const a=[];i.forEach(((r,i)=>{const s=this.hooks.resolveTemplateSubstitutions.call([{expression:new RegExp(`_index${o||""}_`),value:String(i)}],{depth:o,data:r,index:i});let l=JSON.stringify(n);for(const{expression:e,value:t}of s){let r="g";"object"===typeof e&&(r=`${e.flags}${e.global?"":"g"}`),l=l.replace(new RegExp(e,r),t)}const u=e(JSON.parse(l),Ut.Value,{templateDepth:t.depth+1});u&&a.push(u)}));return{type:Ut.MultiNode,override:!1,values:a}}applyParser(e){e.hooks.onCreateASTNode.tap("template",(t=>t&&t.type===Ut.Template&&!t.dynamic?this.parseTemplate(e.parseObject.bind(e),t,this.options):t)),e.hooks.determineNodeType.tap("template",(e=>{if("template"===e)return Ut.Template})),e.hooks.parseNode.tap("template",((t,r,n,o)=>{var i,a;if(o===Ut.Template){const r=e.createASTNode({type:Ut.Template,depth:null!=(i=n.templateDepth)?i:0,data:t.data,template:t.value,dynamic:null!=(a=t.dynamic)&&a},t);if(r)return r}}))}applyResolverHooks(e){e.hooks.beforeResolve.tap("template",((e,t)=>e&&e.type===Ut.Template&&e.dynamic?this.parseTemplate(t.parseNode,e,t):e))}apply(e){e.hooks.parser.tap("template",this.applyParser.bind(this)),e.hooks.resolver.tap("template",this.applyResolverHooks.bind(this))}}const Ar=(e,t)=>r=>{const n=r.indexOf(e);if(-1===n)return!1;const o=r.indexOf(t);return-1!==o&&n<o},kr=Ar("{{","}}"),Pr=Ar("@[","]@");function Rr(e,t){return function(e){return kr(e)||Pr(e)}(e)?jt(e,{model:t.data.model,evaluate:t.evaluate}):e}function _r(e,t,r){if(null===e||void 0===e||"object"!==typeof e&&"string"!==typeof e)return e;if("string"===typeof e)return Rr(e,t);let n=e;return Object.keys(e).forEach((o=>{if(r.has(o))return;const i=e[o];let a=i;"object"===typeof i?a=_r(i,t,r):"string"===typeof i&&(a=Rr(i,t)),a!==i&&(n=Object(d.set)(n,o,a))})),n}const Tr=(e,t)=>{var r,n,o;const i=e.parent;if(!i)return[];if("children"in i){const a=t.getSourceNode(e);return null!=(o=null==(n=null==(r=i.children)?void 0:r.find((e=>e.value===a)))?void 0:n.path)?o:[]}return i.type!==Ut.MultiNode?[]:Tr(i,t)};class Cr{constructor(){this.propertiesToSkipCache=new Map}applyResolver(e){e.hooks.resolve.tap("string-resolver",((t,r,n)=>{var o,i,a,s,l,u,c,h,f,p;if(r.type===Ut.Empty||r.type===Ut.Unknown)return null;if(r.type===Ut.Value||r.type===Ut.Asset||r.type===Ut.View){let t;r.type===Ut.Asset||r.type===Ut.View?(t=new Set(null!=(a=null==(i=null==(o=r.plugins)?void 0:o.stringResolver)?void 0:i.propertiesToSkip)?a:["exp"]),(null==(s=r.value)?void 0:s.id)&&this.propertiesToSkipCache.set(r.value.id,t)):t=(null==(l=r.parent)?void 0:l.type)===Ut.MultiNode&&((null==(c=null==(u=r.parent)?void 0:u.parent)?void 0:c.type)===Ut.Asset||(null==(f=null==(h=r.parent)?void 0:h.parent)?void 0:f.type)===Ut.View)&&(null==(p=r.parent.parent.value)?void 0:p.id)&&this.propertiesToSkipCache.has(r.parent.parent.value.id)?this.propertiesToSkipCache.get(r.parent.parent.value.id):new Set(["exp"]);const d=Tr(r,e);return d.length>0&&d.some((e=>t.has(e.toString())))?r.value:_r(r.value,n,t)}return t}))}apply(e){e.hooks.resolver.tap("string-resolver",this.applyResolver.bind(this))}}class jr{applyResolver(e){e.hooks.beforeResolve.tap("applicability",((e,t)=>{let r=e;if((null==e?void 0:e.type)===Ut.Applicability){if(!1===t.evaluate(e.expression))return null;r=e.value}return r}))}applyParser(e){e.hooks.determineNodeType.tap("applicability",(e=>{if(Object.prototype.hasOwnProperty.call(e,"applicability"))return Ut.Applicability})),e.hooks.parseNode.tap("applicability",((t,r,n,o)=>{if(o===Ut.Applicability){const o=e.parseObject(Object(d.omit)(t,"applicability"),r,n);if(null!==o){const r=e.createASTNode({type:Ut.Applicability,expression:t.applicability,value:o},t);return(null==r?void 0:r.type)===Ut.Applicability&&(r.value.parent=r),r}}}))}apply(e){e.hooks.resolver.tap("applicability",this.applyResolver.bind(this)),e.hooks.parser.tap("applicability",this.applyParser.bind(this))}}var Nr=Object.getOwnPropertySymbols,Ur=Object.prototype.hasOwnProperty,Lr=Object.prototype.propertyIsEnumerable;class Br{constructor(e){this.options=e}resolveSwitch(e,t){for(const r of e.cases){if(t.evaluate(r.case))return r.value}return rr}applyParser(e){e.hooks.onCreateASTNode.tap("switch",(e=>e&&e.type===Ut.Switch&&!e.dynamic?this.resolveSwitch(e,this.options):e)),e.hooks.determineNodeType.tap("switch",(e=>{if(Object.prototype.hasOwnProperty.call(e,"dynamicSwitch")||Object.prototype.hasOwnProperty.call(e,"staticSwitch"))return Ut.Switch})),e.hooks.parseNode.tap("switch",((t,r,n,o)=>{if(o===Ut.Switch){const r="dynamicSwitch"in t,o="dynamicSwitch"in t?t.dynamicSwitch:t.staticSwitch,i=[];o.forEach((t=>{const r=t,{case:o}=r,a=((e,t)=>{var r={};for(var n in e)Ur.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&Nr)for(var n of Nr(e))t.indexOf(n)<0&&Lr.call(e,n)&&(r[n]=e[n]);return r})(r,["case"]),s=e.parseObject(a,Ut.Value,n);s&&i.push({case:o,value:s})}));const a=e.hooks.onCreateASTNode.call({type:Ut.Switch,dynamic:r,cases:i},t);return(null==a?void 0:a.type)===Ut.Switch&&a.cases.forEach((e=>{e.value.parent=a})),(null==a?void 0:a.type)===Ut.Empty?null:null!=a?a:null}}))}applyResolver(e){e.hooks.beforeResolve.tap("switch",((e,t)=>e&&e.type===Ut.Switch&&e.dynamic?this.resolveSwitch(e,t):e))}apply(e){e.hooks.parser.tap("switch",this.applyParser.bind(this)),e.hooks.resolver.tap("switch",this.applyResolver.bind(this))}}var Ir=Object.defineProperty,Dr=Object.defineProperties,Mr=Object.getOwnPropertyDescriptors,Vr=Object.getOwnPropertySymbols,Fr=Object.prototype.hasOwnProperty,$r=Object.prototype.propertyIsEnumerable,Hr=(e,t,r)=>t in e?Ir(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,zr=(e,t)=>{for(var r in t||(t={}))Fr.call(t,r)&&Hr(e,r,t[r]);if(Vr)for(var r of Vr(t))$r.call(t,r)&&Hr(e,r,t[r]);return e};class Wr{constructor(e,t,r){this.allValidations=new Set,this.byBinding=new Map,this.logger=r,this.parse(e,t)}parse(e,t){var r;const n=e.validation;void 0!==n&&(Array.isArray(n)?n.forEach((e=>{var r;const n=zr({trigger:"navigation",severity:"error"},e);this.allValidations.add(n);const{ref:o}=e;if(o){const e=t(o);this.byBinding.has(e)?null==(r=this.byBinding.get(e))||r.push(n):this.byBinding.set(e,[n])}})):null==(r=this.logger)||r.warn(`Unable to register view validations for id: ${e.id}. 'validation' property must be an Array.`))}getValidationsForBinding(e){return this.byBinding.get(e)}}class Yr{constructor(e,t){this.hooks={onUpdate:new i.b,parser:new i.b,resolver:new i.b,templatePlugin:new i.b},this.initialView=e,this.resolverOptions=t;const r=fr(t);new Br(r).apply(this),(new jr).apply(this),(new Cr).apply(this),this.templatePlugin=new xr(r),this.templatePlugin.apply(this)}updateAsync(){var e;const t=null==(e=this.resolver)?void 0:e.update();this.lastUpdate=t,this.hooks.onUpdate.call(t)}update(e){var t,r,n;if(void 0===this.rootNode){this.validationProvider=new Wr(this.initialView,this.resolverOptions.parseBinding,this.resolverOptions.logger),this.hooks.templatePlugin.call(this.templatePlugin);const e=new nr;this.hooks.parser.call(e),this.rootNode=e.parseView(this.initialView),this.resolver=new Or(this.rootNode,(r=zr({},this.resolverOptions),n={parseNode:e.parseObject.bind(e)},Dr(r,Mr(n)))),this.hooks.resolver.call(this.resolver)}const o=null==(t=this.resolver)?void 0:t.update(e);return this.lastUpdate===o?this.lastUpdate:(this.lastUpdate=o,this.hooks.onUpdate.call(o),o)}getValidationsForBinding(e){var t;return null==(t=this.validationProvider)?void 0:t.getValidationsForBinding(e)}}class qr{static asset(e){return{type:Ut.Asset,value:e}}static value(e){return{type:Ut.Value,value:e}}static multiNode(...e){const t={type:Ut.MultiNode,override:!0,values:e};return e.forEach((e=>{e.parent=t})),t}static addChild(e,t,r){r.parent=e;const n={path:Array.isArray(t)?t:[t],value:r};return e.children=e.children||[],e.children.push(n),e}}var Gr=Object.defineProperty,Kr=Object.getOwnPropertySymbols,Zr=Object.prototype.hasOwnProperty,Jr=Object.prototype.propertyIsEnumerable,Qr=(e,t,r)=>t in e?Gr(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,Xr=(e,t,r)=>new Promise(((n,o)=>{var i=e=>{try{s(r.next(e))}catch(t){o(t)}},a=e=>{try{s(r.throw(e))}catch(t){o(t)}},s=e=>e.done?n(e.value):Promise.resolve(e.value).then(i,a);s((r=r.apply(e,t)).next())}));class en{constructor(e,t,r){this.isTransitioning=!1,this.hooks={beforeStart:new i.a,onStart:new i.b,onEnd:new i.b,skipTransition:new i.a,beforeTransition:new i.c,resolveTransitionNode:new i.c,transition:new i.b,afterTransition:new i.b},this.id=e,this.flow=t,this.log=null==r?void 0:r.logger,this.history=[],this.hooks.transition.tap("startPromise",((e,t)=>Xr(this,null,(function*(){const e=t.value;this.flowPromise&&"END"===e.state_type&&this.flowPromise.resolve(e)}))))}start(){return Xr(this,null,(function*(){var e;if(this.flowPromise)return null==(e=this.log)||e.warn("Already called start for flow"),this.flowPromise.promise;this.flow=this.hooks.beforeStart.call(this.flow)||this.flow,this.flow.onStart&&this.hooks.onStart.call(this.flow.onStart);const t=this.flow.startState;return t?(this.flowPromise=y()(),this.pushHistory(t),this.flowPromise.promise):Promise.reject(new Error("No 'startState' defined for flow"))}))}transition(e,t){var r,n,o,i,a,s,l;if(this.isTransitioning)throw new Error(`Transitioning while ongoing transition from ${null==(r=this.currentState)?void 0:r.name} is in progress is not supported`);if("END"===(null==(n=this.currentState)?void 0:n.value.state_type))return void(null==(o=this.log)||o.warn(`Skipping transition using ${e}. Already at and END state`));if(void 0===this.currentState)throw new Error("Cannot transition when there's no current state");if(null==t?void 0:t.force)null==(i=this.log)||i.debug("Forced transition. Skipping validation checks");else{if(this.hooks.skipTransition.call(this.currentState))return void(null==(a=this.log)||a.debug(`Skipping transition from ${this.currentState.name} b/c hook told us to`))}const u=this.hooks.beforeTransition.call(this.currentState.value,e);if(!("transitions"in u))throw new Error(`No transitions defined for ${this.currentState.value}`);const{transitions:c}=u,h=c[e]||c["*"];if(void 0!==h)return null==(l=this.log)||l.debug(`Transitioning from ${this.currentState.name} to ${h} using ${e} `),this.pushHistory(h,t);null==(s=this.log)||s.warn(`No transition from ${this.currentState.name} using ${e} or *`)}pushHistory(e,t){var r;if(!Object.prototype.hasOwnProperty.call(this.flow,e))throw new Error(`No flow definition for: ${e} was found.`);let n=this.flow[e];if(!this.flow[e]||"object"!==typeof n||!("state_type"in n))return void(null==(r=this.log)||r.error(`Flow doesn't contain any states named: ${e}`));const o=this.currentState;this.isTransitioning=!0,n=this.hooks.resolveTransitionNode.call(n);const i={name:e,value:n};this.currentState=i,this.history.push(e),"END"===i.value.state_type&&this.flow.onEnd&&this.hooks.onEnd.call(this.flow.onEnd),this.hooks.transition.call(o,((e,t)=>{for(var r in t||(t={}))Zr.call(t,r)&&Qr(e,r,t[r]);if(Kr)for(var r of Kr(t))Jr.call(t,r)&&Qr(e,r,t[r]);return e})({},i)),this.isTransitioning=!1,this.hooks.afterTransition.call(this)}}var tn=(e,t,r)=>new Promise(((n,o)=>{var i=e=>{try{s(r.next(e))}catch(t){o(t)}},a=e=>{try{s(r.throw(e))}catch(t){o(t)}},s=e=>e.done?n(e.value):Promise.resolve(e.value).then(i,a);s((r=r.apply(e,t)).next())}));class rn{constructor(e,t){this.hooks={flow:new i.b},this.navigation=e,this.navStack=[],this.log=null==t?void 0:t.logger,this.start=this.start.bind(this),this.run=this.run.bind(this),this.transition=this.transition.bind(this),this.addNewFlow=this.addNewFlow.bind(this)}transition(e,t){if(void 0===this.current)throw new Error("Not currently in a flow. Cannot transition.");this.current.transition(e,t)}addNewFlow(e){this.navStack.push(e),this.current=e,this.hooks.flow.call(e)}run(e){return tn(this,null,(function*(){var t;if(!Object.prototype.hasOwnProperty.call(this.navigation,e))return Promise.reject(new Error(`No flow defined for: ${e}`));const r=this.navigation[e];if(null===r||"object"!==typeof r)return Promise.reject(new Error(`Flow: ${e} needs to be an object`));null==(t=this.log)||t.debug(`Starting flow: ${e}`);const n=new en(e,r,{logger:this.log});this.addNewFlow(n),n.hooks.afterTransition.tap("flow-controller",(e=>{var t,r,n;if("FLOW"===(null==(t=e.currentState)?void 0:t.value.state_type)){const t=null==(r=e.currentState)?void 0:r.value.ref;null==(n=this.log)||n.debug(`Loading subflow ${t}`),this.run(t).then((t=>{var r;null==(r=this.log)||r.debug(`Subflow ended. Using outcome: ${t.outcome}`),e.transition(null==t?void 0:t.outcome)}))}}));const o=yield n.start();if(this.navStack.pop(),this.navStack.length>0){const e=0;this.current=this.navStack[e]}return o}))}start(){return tn(this,null,(function*(){return this.navigation.BEGIN?this.run(this.navigation.BEGIN):Promise.reject(new Error("Must supply a BEGIN state"))}))}}const nn=/%([a-zA-Z]+)/g;var on=Object.defineProperty,an=Object.defineProperties,sn=Object.getOwnPropertyDescriptors,ln=Object.getOwnPropertySymbols,un=Object.prototype.hasOwnProperty,cn=Object.prototype.propertyIsEnumerable,hn=(e,t,r)=>t in e?on(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,fn=(e,t)=>{for(var r in t||(t={}))un.call(t,r)&&hn(e,r,t[r]);if(ln)for(var r of ln(t))cn.call(t,r)&&hn(e,r,t[r]);return e},pn=(e,t)=>an(e,sn(t));const dn="validation-binding-tracker";class gn{constructor(e){this.trackedBindings=new Set,this.options=e}getBindings(){return this.trackedBindings}trackBinding(e){var t,r;this.trackedBindings.has(e)||(this.trackedBindings.add(e),null==(r=null==(t=this.options.callbacks)?void 0:t.onAdd)||r.call(t,e))}applyResolver(e){this.trackedBindings.clear();const t=new Map,r=new Map;let n;const o=new Map;let i=new Map,a=new Map;const s=new Map;e.hooks.beforeUpdate.tap(dn,(e=>{n=e})),e.hooks.skipResolve.tap(dn,((e,t)=>{const r=i.get(t);if(!e||!n||!r)return e;return 0===new Set([...n].filter((e=>r.has(e)))).size})),e.hooks.resolveOptions.tap(dn,((e,n)=>{if(void 0===e.validation)return e;t.delete(n);const o=e=>{var o,i,a,s;const l=H(e)?e:this.options.parseBinding(e);t.has(n)?null==(o=t.get(n))||o.add(l):t.set(n,new Set([l]));let{parent:u}=n;for(;u;){if(r.has(u)){null==(i=r.get(u))||i.add(n);break}u=u.parent}this.trackedBindings.add(l),null==(s=null==(a=this.options.callbacks)?void 0:a.onAdd)||s.call(a,l)};return pn(fn({},e),{validation:pn(fn({},e.validation),{get:(t,r)=>{var n,i;(null==r?void 0:r.track)&&o(t);const a=null==(i=null==(n=e.validation)?void 0:n._getValidationForBinding(t))?void 0:i.getAll(r);return null==a?void 0:a.find((e=>"field"===e.displayTarget||void 0===e.displayTarget))},getValidationsForBinding(t,r){var n,i,a;return(null==r?void 0:r.track)&&o(t),null!=(a=null==(i=null==(n=e.validation)?void 0:n._getValidationForBinding(t))?void 0:i.getAll(r))?a:[]},getChildren:t=>{var r;const o=new Array;return null==(r=i.get(n))||r.forEach((r=>{var n,i;const a=null==(i=null==(n=e.validation)?void 0:n._getValidationForBinding(r))?void 0:i.get();!a||void 0!==t&&t!==a.displayTarget||o.push(a)})),o},getValidationsForSection:()=>{var t;const r=new Array;return null==(t=s.get(n))||t.forEach((t=>{var n,o;const i=null==(o=null==(n=e.validation)?void 0:n._getValidationForBinding(t))?void 0:o.get();i&&"section"===i.displayTarget&&r.push(i)})),r},register:e=>{"section"===(null==e?void 0:e.type)&&(r.has(n)||r.set(n,new Set))},track:o})})})),e.hooks.afterNodeUpdate.tap(dn,((n,l,u)=>{var c,h;if(l&&function(e,t){var r;o.has(t)?null==(r=o.get(t))||r.add(e):o.set(t,new Set([e]))}(n,l),u.updated){const e=new Set(t.get(n));null==(c=o.get(n))||c.forEach((t=>{var r;null==(r=a.get(t))||r.forEach((t=>e.add(t)))})),a.set(n,e)}else a.set(n,null!=(h=i.get(n))?h:new Set);n===e.root&&(this.trackedBindings=new Set(a.get(n)),i=a,s.clear(),r.forEach(((e,r)=>{const n=new Set;e.forEach((e=>{var r;null==(r=t.get(e))||r.forEach(n.add,n)})),s.set(r,n)})),o.clear(),t.clear(),r.clear(),a=new Map)}))}apply(e){e.hooks.resolver.tap(dn,this.applyResolver.bind(this))}}var vn=Object.defineProperty,yn=Object.defineProperties,mn=Object.getOwnPropertyDescriptors,bn=Object.getOwnPropertySymbols,wn=Object.prototype.hasOwnProperty,En=Object.prototype.propertyIsEnumerable,Sn=(e,t,r)=>t in e?vn(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,On=(e,t)=>{for(var r in t||(t={}))wn.call(t,r)&&Sn(e,r,t[r]);if(bn)for(var r of bn(t))En.call(t,r)&&Sn(e,r,t[r]);return e},xn=(e,t)=>yn(e,mn(t));const An="schema",kn="view",Pn=Symbol.for("validation-provider-name");class Rn{constructor(e,t,r,n){this.applicableValidations=[],this.validationsByState={load:[],change:[],navigation:[]},this.onDismiss=t,e.forEach((e=>{const{trigger:t}=e;if(this.validationsByState[t]){const r={value:n=e,type:n.severity,state:"none",isBlockingNavigation:!1};this.validationsByState[t].push(r)}else null==r||r.warn(`Unknown validation trigger: ${t}`);var n})),this.weakBindings=null!=n?n:new Set}get allValidations(){return Object.values(this.validationsByState).flat()}checkIfBlocking(e){if("active"===e.state){const{isBlockingNavigation:t}=e;return t}return!1}getAll(){return this.applicableValidations.reduce(((e,t)=>("active"===t.state&&t.response&&e.push(xn(On({},t.response),{blocking:this.checkIfBlocking(t)})),e)),[])}get(){const e=this.applicableValidations.find((e=>"active"===e.state&&e.response));if("active"===(null==e?void 0:e.state))return xn(On({},e.response),{blocking:this.checkIfBlocking(e)})}runApplicableValidations(e,t,r){this.applicableValidations=this.applicableValidations.map((n=>{var o,i,a;if("dismissed"===n.state)return n;const s=null!=(o=n.value.blocking)?o:"warning"!==n.value.severity||"once",l=Object(d.setIn)(n,["value","blocking"],s),u=!0===s||"once"===s&&!t;if("navigation"===r&&"active"===l.state&&!0!==l.value.blocking&&"warning"===l.value.severity){const e=l;return!e.dismissable||!e.response.dismiss||"once"===e.response.blocking&&e.response.blocking?("once"===(null==e?void 0:e.response.blocking)&&(e.response.blocking=!1),e.dismissable=!0):e.response.dismiss(),e}const c=e(l.value),h={type:l.type,value:l.value,state:c?"active":"none",isBlockingNavigation:u,dismissable:"warning"===l.value.severity&&"navigation"===r,response:c?xn(On({},l.value),{message:null!=(i=c.message)?i:"Something is broken",severity:l.value.severity,displayTarget:null!=(a=l.value.displayTarget)?a:"field"}):void 0};return"active"===h.state&&"warning"===l.value.severity&&(h.response.dismiss=()=>{var e;h.state="dismissed",null==(e=this.onDismiss)||e.call(this)}),h}))}update(e,t,r){const n=[];"load"===e&&void 0!==this.currentPhase||("navigation"!==this.currentPhase&&e!==this.currentPhase?("load"===e?(this.currentPhase="load",this.applicableValidations=[...this.validationsByState.load]):"change"===e&&"load"===this.currentPhase?(this.currentPhase="change",this.applicableValidations=[...this.applicableValidations,...this.validationsByState.change]):"navigation"!==e||"load"!==this.currentPhase&&"change"!==this.currentPhase||(this.applicableValidations.forEach((e=>{"error"===e.type&&"active"===e.state&&!1===e.isBlockingNavigation||n.push(e)})),this.applicableValidations=[...n,...this.validationsByState.navigation,..."load"===this.currentPhase?this.validationsByState.change:[]],this.currentPhase="navigation"),this.runApplicableValidations(r,t,e)):this.runApplicableValidations(r,t,e))}}class _n{constructor(e,t){this.hooks={createValidatorRegistry:new i.b,onAddValidation:new i.c,onRemoveValidation:new i.c,resolveValidationProviders:new i.c,onTrackBinding:new i.b},this.validations=new Map,this.weakBindingTracker=new Set,this.schema=e,this.options=t,this.reset()}setOptions(e){this.options=e}getDataMiddleware(){return[{set:(e,t,r)=>{var n;return null!=(n=null==r?void 0:r.set(e,t))?n:[]},get:(e,t,r)=>null==r?void 0:r.get(e,t),delete:(e,t,r)=>(this.validations=Nt(this.validations,e),null==r?void 0:r.delete(e,t))},new Ht((e=>{var t;if(!this.options)return;this.updateValidationsForBinding(e,"change",this.options);const r=this.getValidationForBinding(e);if("error"===(null==(t=null==r?void 0:r.get())?void 0:t.severity))return r.get();const n=new Set;return this.validations.forEach(((t,r)=>{var o;hr(new Set([e]),t.weakBindings)&&"error"===(null==(o=null==t?void 0:t.get())?void 0:o.severity)&&(null==t||t.weakBindings.forEach((e=>{e===r?n.add({binding:e,isStrong:!0}):n.add({binding:e,isStrong:!1})})))})),n.size>0?n:void 0}),{logger:new dt((()=>{var e;return null==(e=this.options)?void 0:e.logger}))})]}getValidationProviders(){return this.providers||(this.providers=this.hooks.resolveValidationProviders.call([{source:An,provider:this.schema},{source:kn,provider:{getValidationsForBinding:e=>{var t,r;return null==(r=null==(t=this.viewValidationProvider)?void 0:t.getValidationsForBinding)?void 0:r.call(t,e)},getValidationsForView:()=>{var e,t;return null==(t=null==(e=this.viewValidationProvider)?void 0:e.getValidationsForView)?void 0:t.call(e)}}}])),this.providers}reset(){this.validations.clear(),this.tracker=void 0}onView(e){if(this.validations.clear(),!this.options)return;const t=new gn(xn(On({},this.options),{callbacks:{onAdd:t=>{if(!this.options||void 0!==this.getValidationForBinding(t))return;const r=this.options.model.get(t);r!==this.options.model.get(t,{ignoreDefaultValue:!0})&&this.options.model.set([[t,r]],{silent:!0}),this.updateValidationsForBinding(t,"load",this.options,(()=>{e.update(new Set([t]))})),this.hooks.onTrackBinding.call(t)}}}));this.tracker=t,this.viewValidationProvider=e,t.apply(e)}updateValidationsForBinding(e,t,r,n){var o;const i=null!=r?r:this.options;if(!i)throw new Error("Context is required for executing validations");if("load"===t){const t=this.getValidationProviders().reduce(((t,r)=>{var n,o,i,a;return t.push(...null!=(a=null==(i=null==(o=(n=r.provider).getValidationsForBinding)?void 0:o.call(n,e))?void 0:i.map((e=>xn(On({},e),{[Pn]:r.source}))))?a:[]),t}),[]);if(0===t.length)return;this.validations.set(e,new Rn(t,n,null==(o=this.options)?void 0:o.logger))}const a=this.validations.get(e);null==a||a.update(t,!0,(t=>{const r=this.validationRunner(t,e,i);if(this.weakBindingTracker.size>0){const t=this.validations.get(e);this.weakBindingTracker.forEach((e=>t.weakBindings.add(e)))}return r?{message:r.message}:void 0})),"load"!==t&&this.validations.forEach(((r,n)=>{n!==e&&hr(new Set([e]),r.weakBindings)&&r.update(t,!0,(e=>{const t=this.validationRunner(e,n,i);return t?{message:t.message}:void 0}))}))}validationRunner(e,t,r=this.options){var n;if(!r)throw new Error("No context provided to validation runner");const o=null!=(n=e.handler)?n:this.getValidator(e.type),i=new Set,a={get:(e,n)=>(i.add(H(e)?t:r.parseBinding(e)),r.model.get(e,xn(On({},n),{includeInvalid:!0}))),set:r.model.set,delete:r.model.delete},s=null==o?void 0:o(xn(On({},r),{evaluate:(e,t={model:a})=>r.evaluate(e,t),model:a,validation:e,schemaType:this.schema.getType(t)}),r.model.get(t,{includeInvalid:!0,formatted:"formatted"===e.dataTarget}),e);if(this.weakBindingTracker=i,s){let{message:t}=s;const{parameters:n}=s;return e.message&&(t=jt(e.message,{model:a,evaluate:r.evaluate}),n&&(t=function(e,t){return e.slice().replace(nn,(e=>t[e.slice(1)]||e))}(t,n))),{message:t}}}updateValidationsForView(e){const t="navigation"===e,r=this.activeBindings,n=t=>{this.getBindings().forEach((r=>{var n;null==(n=this.validations.get(r))||n.update(e,t,(e=>{if(this.options)return this.validationRunner(e,r,this.options)}))}))};if(n(!t),t){const{activeBindings:e}=this;(function(e,t){if(e.size>t.size)return!1;for(const r of e)if(!t.has(r))return!1;return!0})(e,r)&&n(!0)}}get activeBindings(){return new Set(Array.from(this.getBindings()).filter((e=>{var t;return void 0!==(null==(t=this.validations.get(e))?void 0:t.get())})))}getValidator(e){if(this.validatorRegistry)return this.validatorRegistry.get(e);const t=new zt;return this.hooks.createValidatorRegistry.call(t),this.validatorRegistry=t,t.get(e)}getBindings(){var e,t;return null!=(t=null==(e=this.tracker)?void 0:e.getBindings())?t:new Set}trackBinding(e){var t;null==(t=this.tracker)||t.trackBinding(e)}validateView(e="navigation"){this.updateValidationsForView(e);const t=new Map;let r=!0;return this.getBindings().forEach((n=>{var o;const i=null==(o=this.getValidationForBinding(n))?void 0:o.getAll();null==i||i.forEach((o=>{var i;"navigation"===e&&o.blocking&&(null==(i=this.options)||i.logger.debug(`Validation on binding: ${n.asString()} is preventing navigation. ${JSON.stringify(o)}`),r=!1),t.has(n)||t.set(n,o)}))})),{canTransition:r,validations:t.size?t:void 0}}getValidationForBinding(e){return this.validations.get(e)}forView(e){return{_getValidationForBinding:t=>this.getValidationForBinding(H(t)?t:e(t)),getAll:()=>{const e=this.getBindings();if(0===e.size)return;const t=new Map;return e.forEach((e=>{var r;const n=null==(r=this.getValidationForBinding(e))?void 0:r.get();n&&t.set(e,n)})),0===t.size?void 0:t},get(){throw new Error("Error Access be provided by the view plugin")},getValidationsForBinding(){throw new Error("Error rollup should be provided by the view plugin")},getChildren(){throw new Error("Error rollup should be provided by the view plugin")},getValidationsForSection(){throw new Error("Error rollup should be provided by the view plugin")},track:()=>{throw new Error("Tracking should be provided by the view plugin")},register:()=>{throw new Error("Section functionality should be provided by the view plugin")},type:t=>this.schema.getType(H(t)?t:e(t))}}}class Tn{constructor(e){this.updateCallback=e,this.state=new Map}removeKey(e){this.state.delete(e)}reset(){this.state.clear()}useSharedState(e){return t=>(this.state.has(e)||this.state.set(e,t),[this.state.get(e),t=>{var r;const n=this.state.get(e);this.state.set(e,t),n!==t&&(null==(r=this.updateCallback)||r.call(this))}])}getLocalStateFunction(e,t){return r=>{this.state.has(e)||this.state.set(e,[]),this.state.has(t)||this.state.set(t,0);const n=this.state.get(e),o=this.state.get(t);this.state.set(t,o+1),n.length<=o&&n.push(r);return[n[o],e=>{var t;const r=n[o];n[o]=e,r!==e&&(null==(t=this.updateCallback)||t.call(this))}]}}}function Cn(e,t){return e===t||!!e.parent&&Cn(e.parent,t)}class jn{constructor(e){this.registry=e,this.stateStore=new Map,this.beforeResolveSymbol=Symbol("before resolve"),this.resolveSymbol=Symbol("resolve"),this.beforeResolveCountSymbol=Symbol("before resolve count"),this.resolveCountSymbol=Symbol("resolve count")}apply(e){e.hooks.view.tap("asset-transform",(e=>{this.stateStore.clear(),e.hooks.resolver.tap("asset-transform",(t=>{let r;const n=(t,n)=>{let o;const i=n===this.resolveSymbol?this.resolveCountSymbol:this.beforeResolveCountSymbol,a=this.stateStore.get(t);return a?(o=a,o.removeKey(i)):(o=new Tn((()=>{(t=>{r=t,e.update(new Set)})(t)})),this.stateStore.set(t,o)),{useSharedState:e=>o.useSharedState(e),useLocalState:e=>o.getLocalStateFunction(n,i)(e)}};t.hooks.beforeResolve.tap("asset-transform",((e,t)=>{var r;if(e&&("asset"===e.type||"view"===e.type)){const o=this.registry.get(e.value);if(null==o?void 0:o.beforeResolve){const i=n(null!=(r=t.node)?r:e,this.beforeResolveSymbol);return o.beforeResolve(e,t,i)}}return e})),t.hooks.afterUpdate.tap("asset-transform",(()=>{r=void 0})),t.hooks.skipResolve.tap("asset-transform",((e,t)=>{if(!e||!r)return e;const n=Cn(r,t),o=Cn(t,r);return!n&&!o})),t.hooks.afterResolve.tap("asset-transform",((e,r,o)=>{if(r.type!==Ut.Asset&&r.type!==Ut.View)return e;const i=t.getSourceNode(r);if(!i)return e;const a=this.registry.get(e);if(null==a?void 0:a.resolve){const t=n(i,this.resolveSymbol);return null==a?void 0:a.resolve(e,o,t)}return e}))}))}))}}class Nn{constructor(e,t){this.hooks={resolveView:new i.c,view:new i.b},this.transformRegistry=new w.a,this.optimizeUpdates=!0,this.viewOptions=t,this.viewMap=e.reduce(((e,t)=>(e[t.id]=t,e)),{}),new jn(this.transformRegistry).apply(this),t.flowController.hooks.flow.tap("viewController",(e=>{e.hooks.transition.tap("viewController",((e,t)=>{"VIEW"===t.value.state_type?this.onView(t.value):this.currentView=void 0}))}));const r=(e,t=!1)=>{this.currentView&&(this.optimizeUpdates?this.queueUpdate(e,t):this.currentView.update())};t.model.hooks.onUpdate.tap("viewController",((e,t)=>{var n;r(new Set(e.map((e=>e.binding))),null!=(n=null==t?void 0:t.silent)&&n)})),t.model.hooks.onDelete.tap("viewController",(e=>{const t=e.parent(),n=e.key();r("number"===typeof n&&t?new Set([t]):new Set([e]))}))}queueUpdate(e,t=!1){var r;(null==(r=this.pendingUpdate)?void 0:r.changedBindings)?this.pendingUpdate.changedBindings=new Set([...this.pendingUpdate.changedBindings,...e]):this.pendingUpdate={changedBindings:e,scheduled:!1},this.pendingUpdate.scheduled||t||(this.pendingUpdate.scheduled=!0,b()((()=>{var e,t;const r=null==(e=this.pendingUpdate)?void 0:e.changedBindings;this.pendingUpdate=void 0,null==(t=this.currentView)||t.update(r)})))}getViewForRef(e){if(this.viewMap[e])return this.viewMap[e];const t=Object.keys(this.viewMap).find((t=>e===Tt(t,{model:this.viewOptions.model,evaluate:this.viewOptions.evaluator.evaluate})));return t&&this.viewMap[t]?this.viewMap[t]:void 0}onView(e){const t=e.ref,r=this.hooks.resolveView.call(this.getViewForRef(t),t,e);if(!r)throw new Error(`No view with id ${t}`);const n=new Yr(r,this.viewOptions);this.currentView=n,this.hooks.view.call(n),n.update()}}class Un{constructor(e,t){this.controller=e,this.logger=t}get(e,t){return this.controller.get(e,t)}set(e,t){var r;return null==(r=this.logger)||r.error("Error: Tried to set in a read only instance of the DataController"),[]}delete(e,t){var r;null==(r=this.logger)||r.error("Error: Tried to delete in a read only instance of the DataController")}}class Ln{constructor(e,t){this.hooks={resolve:new i.c,resolveDataStages:new i.c,resolveDefaultValue:new i.a,onDelete:new i.b,onSet:new i.b,onGet:new i.b,onUpdate:new i.b,format:new i.c,deformat:new i.c,serialize:new i.c},this.logger=t.logger;const r=t.middleware||[];this.baseMiddleware=[new Se(e),...r],this.trash=new Set,this.pathResolver=t.pathResolver}getModel(){if(!this.model){const e=this.hooks.resolveDataStages.call(this.baseMiddleware),t=new Ee;t.setMiddleware(e),this.model=t}return this.model}resolveDataValue(e,t,r){return r?this.hooks.deformat.call(t,e):t}set(e,t){let r=[];r=Array.isArray(e)?e.map((([e,r])=>{const n=this.pathResolver.parse(e);return[n,this.resolveDataValue(n,r,Boolean(null==t?void 0:t.formatted))]})):Object.keys(e).map((r=>{const n=this.pathResolver.parse(r),o=e[r];return[n,this.resolveDataValue(n,o,Boolean(null==t?void 0:t.formatted))]}));const n=r.reduce(((e,[t,r])=>{var n,o;const i=this.get(t,{includeInvalid:!0}),a={binding:t,newValue:r,oldValue:i};return Object(g.a)(i,r)?null==(n=this.logger)||n.debug(`Skipping update for path: ${t.asString()}. Value was unchanged: ${i}`):(e.push(a),null==(o=this.logger)||o.debug(`Setting path: ${t.asString()} from: ${i} to: ${r}`)),e}),[]),o=this.getModel().set(r,t),i=new Set(n.map((e=>e.binding)));return o.forEach((e=>{var t;i.has(e.binding)||!0!==e.force&&Object(g.a)(e.oldValue,e.newValue)||(null==(t=this.logger)||t.debug(`Path: ${e.binding.asString()} was changed from: ${e.oldValue} to: ${e.newValue}`),n.push(e))})),this.hooks.onSet.call(r),n.length>0&&this.hooks.onUpdate.call(n,t),o}resolve(e,t){return Array.isArray(e)||"string"===typeof e?this.pathResolver.parse(e,{readOnly:t}):e}get(e,t){const r=e instanceof q?e:this.resolve(e,!0);let n=this.getModel().get(r,t);if(void 0===n&&!(null==t?void 0:t.ignoreDefaultValue)){const e=this.hooks.resolveDefaultValue.call(r);e!==n&&(n=e)}return(null==t?void 0:t.formatted)?n=this.hooks.format.call(n,r):!1===(null==t?void 0:t.formatted)&&(n=this.hooks.deformat.call(n,r)),this.hooks.onGet.call(e,n),n}delete(e,t){if("string"!==typeof e&&!Array.isArray(e)&&!(e instanceof q))throw new Error("Invalid arguments: delete expects a data path (string)");const r=e instanceof q?e:this.resolve(e,!1),n=r.parent(),o=r.key(),i=this.get(n),a="object"===typeof i&&null!==i&&Object.prototype.hasOwnProperty.call(i,o);this.getModel().delete(r,t),a&&!this.get(r)&&this.trash.add(r),this.hooks.onDelete.call(r)}serialize(){return this.hooks.serialize.call(this.get(""))}makeReadOnly(){return new Un(this,this.logger)}}var Bn=Object.defineProperty,In=Object.getOwnPropertySymbols,Dn=Object.prototype.hasOwnProperty,Mn=Object.prototype.propertyIsEnumerable,Vn=(e,t,r)=>t in e?Bn(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,Fn=(e,t)=>{for(var r in t||(t={}))Dn.call(t,r)&&Vn(e,r,t[r]);if(In)for(var r of In(t))Mn.call(t,r)&&Vn(e,r,t[r]);return e};function $n(e,t=[],r="."){return Object.keys(e).reduce(((n,o)=>Fn(Fn({},n),"[object Object]"===Object.prototype.toString.call(e[o])?$n(e[o],t.concat([o])):{[t.concat([o]).join(r)]:e[o]})),{})}function Hn(e){const t=$n(e),r=[];return Object.keys(t).forEach((e=>{r.push([new q(e),t[e]])})),r}class zn{constructor(){this.store=new Map,this.tempStore=new Map}addConstants(e,t){var r;this.store.has(t)?null==(r=this.store.get(t))||r.set(Hn(e)):this.store.set(t,new Se(e))}getConstants(e,t,r){var n,o,i,a;const s=new q(e);return null!=(a=null!=(i=null==(n=this.tempStore.get(t))?void 0:n.get(s))?i:null==(o=this.store.get(t))?void 0:o.get(s))?a:r}setTemporaryValues(e,t){var r;this.tempStore.has(t)?null==(r=this.tempStore.get(t))||r.set(Hn(e)):this.tempStore.set(t,new Se(e))}clearTemporaryValues(e){var t;e?null==(t=this.tempStore.get(e))||t.reset():this.tempStore.forEach((e=>{e.reset()}))}}class Wn{constructor(){this.name="flow-exp-plugin"}apply(e){let t;const r=e=>{e&&("object"===typeof e&&"exp"in e?null==t||t.evaluate(e.exp):null==t||t.evaluate(e))};e.hooks.expressionEvaluator.tap(this.name,(e=>{t=e})),e.hooks.flowController.tap(this.name,(e=>{e.hooks.flow.tap(this.name,(e=>{e.hooks.onStart.tap(this.name,(e=>r(e))),e.hooks.onEnd.tap(this.name,(e=>r(e))),e.hooks.resolveTransitionNode.intercept({call:e=>{(null==e?void 0:e.onStart)&&r(e.onStart)}})}))}))}}class Yn{constructor(){this.name="flow-exp-plugin"}apply(e){let t;e.hooks.schema.tap(this.name,(e=>{var r;r=e,t=(e,t,n)=>{var o,i;return null!=(i=null==(o=r.getFormatterForType({type:n}))?void 0:o.format(t))?i:t}})),e.hooks.expressionEvaluator.tap(this.name,(r=>{t&&r.addExpressionFunction("format",t),r.addExpressionFunction("log",((t,...r)=>{e.logger.info(...r)})),r.addExpressionFunction("debug",((t,...r)=>{e.logger.debug(...r)})),r.addExpressionFunction("eval",((e,...t)=>e.evaluate(...t)))}))}}const qn={ref:Symbol("not-started"),status:"not-started"};var Gn=Object.defineProperty,Kn=Object.defineProperties,Zn=Object.getOwnPropertyDescriptors,Jn=Object.getOwnPropertySymbols,Qn=Object.prototype.hasOwnProperty,Xn=Object.prototype.propertyIsEnumerable,eo=(e,t,r)=>t in e?Gn(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,to=(e,t)=>{for(var r in t||(t={}))Qn.call(t,r)&&eo(e,r,t[r]);if(Jn)for(var r of Jn(t))Xn.call(t,r)&&eo(e,r,t[r]);return e};const ro=class{constructor(e){var t;this.logger=new pt,this.constantsController=new zn,this.state=qn,this.hooks={flowController:new i.b,viewController:new i.b,view:new i.b,expressionEvaluator:new i.b,dataController:new i.b,schema:new i.b,validationController:new i.b,bindingParser:new i.b,state:new i.b,onStart:new i.b,onEnd:new i.b,resolveFlowContent:new i.c},(null==e?void 0:e.logger)&&this.logger.addHandler(e.logger),this.config=e||{},this.config.plugins=[new Yn,...this.config.plugins||[],new Wn],null==(t=this.config.plugins)||t.forEach((e=>{e.apply(this)}))}getPlugins(){var e;return null!=(e=this.config.plugins)?e:[]}findPlugin(e){var t;return null==(t=this.config.plugins)?void 0:t.find((t=>t.symbol===e))}applyTo(e,t){const r=this.findPlugin(e);r&&t(r)}registerPlugin(e){var t;e.apply(this),null==(t=this.config.plugins)||t.push(e)}getVersion(){return ro.info.version}getCommit(){return ro.info.commit}getState(){return this.state}setState(e){this.state=e,this.hooks.state.call(e)}setupFlow(e){const t=this.hooks.resolveFlowContent.call(e),r=new rn(t.navigation,{logger:this.logger});let n,o;this.hooks.onStart.call(t),this.hooks.flowController.call(r);const i=new he({get:e=>o.get(e),set:e=>o.set(e),evaluate:e=>n.evaluate(e)});this.hooks.bindingParser.call(i);const a=i.parse,s=y()(),l=new At(t.schema);this.hooks.schema.call(l);const u=new _n(l);let c;function h(e,t){return jt(e,{model:o,evaluate:n.evaluate,formatted:t})}var f,p;return this.hooks.validationController.call(u),o=new Ln(t.data,{pathResolver:i,middleware:u.getDataMiddleware(),logger:this.logger}),o.hooks.format.tap("player",((e,t)=>{const r=l.getFormatter(t);return r?r.format(e):e})),o.hooks.deformat.tap("player",((e,t)=>{const r=l.getFormatter(t);return r?r.deformat(e):e})),o.hooks.resolveDefaultValue.tap("player",(e=>{var t;return null==(t=l.getApparentType(e))?void 0:t.default})),n=new lt({model:o,logger:this.logger}),this.hooks.expressionEvaluator.call(n),n.hooks.onError.tap("player",(e=>(s.reject(e),!0))),r.hooks.flow.tap("player",(e=>{e.hooks.beforeTransition.tap("player",((e,t)=>{const r=e.transitions[t]?t:"*";return e.onEnd&&e.transitions[r]&&("object"===typeof e.onEnd&&"exp"in e.onEnd?null==n||n.evaluate(e.onEnd.exp):null==n||n.evaluate(e.onEnd)),"transitions"in e&&e.transitions[r]?Object(d.setIn)(e,["transitions",r],h(e.transitions[r])):e})),e.hooks.skipTransition.tap("validation",(e=>{var t;if("VIEW"===(null==e?void 0:e.value.state_type)){const{canTransition:e,validations:r}=u.validateView("navigation");if(!e&&r){const e=new Set(r.keys());return null==(t=null==c?void 0:c.currentView)||t.update(e),!0}}})),e.hooks.resolveTransitionNode.tap("player",(e=>{let t=e;return"ref"in e&&(t=Object(d.setIn)(e,["ref"],h(e.ref))),"param"in e&&(t=Object(d.setIn)(e,["param"],h(e.param,!1))),t})),e.hooks.transition.tap("player",((e,t)=>{"VIEW"!==t.value.state_type&&u.reset()})),e.hooks.afterTransition.tap("player",(e=>{var t;const o=null==(t=e.currentState)?void 0:t.value;if(o&&"ACTION"===o.state_type){const{exp:e}=o;null==r||r.transition(String(null==n?void 0:n.evaluate(e)))}n.reset()}))})),this.hooks.dataController.call(o),u.setOptions({parseBinding:a,model:o,logger:this.logger,evaluate:n.evaluate,constants:this.constantsController}),c=new Nn(t.views||[],{evaluator:n,parseBinding:a,transition:r.transition,model:o,utils:{findPlugin:e=>this.findPlugin(e)},logger:this.logger,flowController:r,schema:l,format:(e,t)=>{const r=l.getFormatter(e);return(null==r?void 0:r.format)?r.format(t):t},formatValue:(e,t)=>{const r=l.getFormatterForType(e);return(null==r?void 0:r.format)?r.format(t):t},validation:(f=to({},u.forView(a)),p={type:e=>l.getType(a(e))},Kn(f,Zn(p))),constants:this.constantsController}),c.hooks.view.tap("player",(e=>{u.onView(e),this.hooks.view.call(e)})),this.hooks.viewController.call(c),{start:()=>{r.start().then((e=>({endState:h(e,!1),data:o.serialize()}))).then(s.resolve).catch((e=>{throw this.logger.error(`Something went wrong: ${e.message}`),e})).catch(s.reject).finally((()=>this.hooks.onEnd.call()))},state:{status:"in-progress",flowResult:s.promise,controllers:{data:o,view:c,flow:r,schema:l,expression:n,binding:i,validation:u},fail:s.reject,flow:t,logger:this.logger}}}start(e){return t=this,r=null,n=function*(){var t;const r=Symbol(null!=(t=null==e?void 0:e.id)?t:"payload"),n=e=>this.state.ref!==r?(this.logger.warn("Received update for a flow that's not the current one"),e):(this.setState(e),e);this.setState({status:"not-started",ref:r});try{const{state:t,start:o}=this.setupFlow(e);this.setState(to({ref:r},t)),o();const i={ref:r,status:"completed",flow:t.flow,controllers:{data:t.controllers.data.makeReadOnly()}};return n(to(to({},yield t.flowResult),i))}catch(o){throw n({status:"error",ref:r,flow:e,error:o}),o}},new Promise(((e,o)=>{var i=e=>{try{s(n.next(e))}catch(t){o(t)}},a=e=>{try{s(n.throw(e))}catch(t){o(t)}},s=t=>t.done?e(t.value):Promise.resolve(t.value).then(i,a);s((n=n.apply(t,r)).next())}));var t,r,n}};let no=ro;no.info={version:"0.7.2-next.0",commit:"bc01b43eaf000d1a85e3c3ea6cd17b5cad312d84"}},function(e,t){},function(e,t){var r;r=function(){return this}();try{r=r||new Function("return this")()}catch(n){"object"===typeof window&&(r=window)}e.exports=r},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(7);Object.defineProperty(t,"Parser",{enumerable:!0,get:function(){return n.Parser}});var o=r(11);Object.defineProperty(t,"TokenError",{enumerable:!0,get:function(){return o.TokenError}}),t.Grammars=r(44)},function(e,t,r){(function(t){let r;e.exports="function"===typeof queueMicrotask?queueMicrotask.bind("undefined"!==typeof window?window:t):e=>(r||(r=Promise.resolve())).then(e).catch((e=>setTimeout((()=>{throw e}),0)))}).call(this,r(18))},function(e,t,r){"use strict";r.d(t,"a",(function(){return c}));var n=r(22),o=r.n(n),i=r(6),a=r.n(i);function s(e,t=[],r=new Map){for(const n of Object.keys(e)){const o=e[n],i=[...t,n];"object"===typeof o?s(o,i,r):r.set(i,o)}return r}function l(e){const t=s(e),r=e=>{for(const r of t){const[t,n]=r;if(a()(e,t)!==n)return!1}return!0};return r.count=t.size,r}const u=()=>new o.a([],(e=>e.matcher.count));class c{constructor(e){this.store=u(),null==e||e.forEach((([e,t])=>{this.set(e,t)}))}set(e,t){const r="object"===typeof e?l(e):function(e){const t=t=>e===t;return t.count=1,t}(e);this.store.insert({key:e,value:t,matcher:r})}get(e){for(const t of this.store.array)if(t.matcher(e))return t.value}forEach(e){for(const t of this.store.array)e(t)}clear(){this.store=u()}}},function(e,t,r){var n,o=function(){var e=function(e){var t=e.constructor;return t.prototype=e,t}({constructor:function(e,r){this.array=[],this.compare=r||t;for(var n=e.length,o=0;o<n;)this.insert(e[o++])},insert:function(e){for(var t,r,n=this.array,o=this.compare,i=n.length-1,a=0,s=-1;i>=a;)if((r=o(n[t=(i+a)/2>>>0],e))<0)a=t+1;else{if(!(r>0)){s=t;break}i=t-1}for(-1===s&&(s=i),s++,i=n.length-1;s<i&&0===o(e,n[s]);)s++;for(t=n.length,n.push(e);t>s;)n[t]=n[--t];return n[s]=e,this},search:function(e){for(var t,r,n=this.array,o=this.compare,i=n.length-1,a=0;i>=a;)if((r=o(n[t=(i+a)/2>>>0],e))<0)a=t+1;else{if(!(r>0))return t;i=t-1}return-1},remove:function(e){var t=this.search(e);return t>=0&&this.array.splice(t,1),this}});return e.comparing=function(r,n){return new e(n,(function(e,n){return t(e[r],n[r])}))},e;function t(e,t){return e<t?-1:e>t?1:0}}();e.exports=o,void 0===(n=function(){return o}.call(t,r,t,e))||(e.exports=n)},function(e,t,r){"use strict";r.r(t);r(24);var n=r(16);for(var o in n)["default"].indexOf(o)<0&&function(e){r.d(t,e,(function(){return n[e]}))}(o)},function(e,t,r){e.exports=r(25)},function(e,t,r){r(14);var n,o=r(9);n=o("Error.captureStackTrace")?r(28):o("Error.prototype.stack")?r(29):r(39),e.exports=n()},function(e,t,r){var n=r(15),o=n.define,i=n.test;o("strict mode",(function(){return void 0===this})),o("arguments.callee.caller",(function(){try{return function(){return arguments.callee.caller}()===arguments.callee}catch(e){return!1}})),o("es5",(function(){return i("Array.prototype.forEach")&&i("Array.prototype.map")&&i("Function.prototype.bind")&&i("Object.create")&&i("Object.defineProperties")&&i("Object.defineProperty")&&i("Object.prototype.hasOwnProperty")})),o("Array.prototype.forEach",(function(){return Array.prototype.forEach})),o("Array.prototype.map",(function(){return Array.prototype.map})),o("Function.prototype.bind",(function(){return Function.prototype.bind})),o("Object.create",(function(){return Object.create})),o("Object.defineProperties",(function(){return Object.defineProperties})),o("Object.defineProperty",(function(){return Object.defineProperty})),o("Object.prototype.hasOwnProperty",(function(){return Object.prototype.hasOwnProperty})),o("Error.captureStackTrace",(function(){return Error.captureStackTrace})),o("Error.prototype.stack",(function(){try{throw new Error}catch(e){return e.stack||e.stacktrace}}))},function(e,t){var r=function(){this.tests={},this.cache={}};r.prototype={constructor:r,define:function(e,t){if("string"!=typeof e||!(t instanceof Function))throw new Error("Invalid capability definition.");if(this.tests[e])throw new Error('Duplicated capability definition by "'+e+'".');this.tests[e]=t},check:function(e){if(!this.test(e))throw new Error('The current environment does not support "'+e+'", therefore we cannot continue.')},test:function(e){if(void 0!==this.cache[e])return this.cache[e];if(!this.tests[e])throw new Error('Unknown capability with name "'+e+'".');var t=this.tests[e];return this.cache[e]=!!t(),this.cache[e]}},e.exports=r},function(e,t,r){var n=r(10);e.exports=function(){return Error.getStackTrace=function(e){return e.stack},{prepareStackTrace:n}}},function(e,t,r){var n=r(30),o=r(37),i=r(5).cache,a=r(10);e.exports=function(){return Error.captureStackTrace=function e(t,r){var s=[e];r&&s.push(r);var l=n.getInstance().captureFrameStrings(s);Object.defineProperties(t,{stack:{configurable:!0,get:i((function(){var e=o.getInstance().getFrames(l.frameStrings,l.functionValues);return(Error.prepareStackTrace||a)(t,e,undefined)}))},cachedStack:{configurable:!0,writable:!0,enumerable:!1,value:!0}})},Error.getStackTrace=function(e){if(e.cachedStack)return e.stack;var t,r=n.getInstance().getFrameStrings(e),i=[];r?i=o.getInstance().getFrames(r,[]):t=["The stack is not readable by unthrown errors in this environment."];var s=(Error.prepareStackTrace||a)(e,i,t);if(r)try{Object.defineProperties(e,{stack:{configurable:!0,writable:!0,enumerable:!1,value:s},cachedStack:{configurable:!0,writable:!0,enumerable:!1,value:!0}})}catch(l){}return s},{prepareStackTrace:a}}},function(e,t,r){var n=r(4).Class,o=r(4).abstractMethod,i=r(5).eachCombination,a=r(5).cache,s=r(9),l=n(Object,{prototype:{captureFrameStrings:function(e){var t=this.createError();e.unshift(this.captureFrameStrings),e.unshift(this.createError);var r=this.getFrameStrings(t),n=r.slice(e.length),o=[];if(s("arguments.callee.caller")){var i=[this.createError,this.captureFrameStrings];try{for(var a=arguments.callee;a=a.caller;)i.push(a)}catch(l){}o=i.slice(e.length)}return{frameStrings:n,functionValues:o}},getFrameStrings:function(e){var t=e.message||"",r=e.name||"",n=this.getStackString(e);if(void 0!==n){var o=n.split("\n"),i=0,a=o.length;return this.hasHeader&&(i+=r.split("\n").length+t.split("\n").length-1),this.hasFooter&&(a-=1),o.slice(i,a)}},createError:o,getStackString:o,hasHeader:void 0,hasFooter:void 0}}),u=n(Object,{prototype:{calibrateClass:function(e){return this.calibrateMethods(e)&&this.calibrateEnvelope(e)},calibrateMethods:function(e){try{i([[function(e){return new Error(e)},function(e){try{throw new Error(e)}catch(t){return t}}],[function(e){return e.stack},function(e){return e.stacktrace}]],(function(e,t){if(t(e()))throw{getStackString:t,createError:e}}))}catch(t){return n.merge.call(e,{prototype:t}),!0}return!1},calibrateEnvelope:function(e){var t=(0,e.prototype.getStackString)((0,e.prototype.createError)("marker")).split("\n");return n.merge.call(e,{prototype:{hasHeader:/marker/.test(t[0]),hasFooter:""===t[t.length-1]}}),!0}}});e.exports={getClass:a((function(){var e;if(e)return e;if(e=n(l,{}),!(new u).calibrateClass(e))throw new Error("Cannot read Error.prototype.stack in this environment.");return e})),getInstance:a((function(){return new(this.getClass())}))}},function(e,t,r){e.exports={Class:r(32),abstractMethod:r(33)}},function(e,t){var r=function(){var e=Object.create({Source:Object,config:{},buildArgs:[]});function t(t){var r="config";if(t instanceof Function)r="Source";else if(t instanceof Array)r="buildArgs";else{if(!(t instanceof Object))throw new Error("Invalid configuration option.");r="config"}if(e.hasOwnProperty(r))throw new Error("Duplicated configuration option: "+r+".");e[r]=t}for(var n=0,o=arguments.length;n<o;++n)t(arguments[n]);var i=e.Source,a=e.config,s=e.buildArgs;return(i.extend||r.extend).call(i,a,s)};r.factory=function(){return function(){var e=this;e.build instanceof Function&&e.build.apply(e,arguments),e.init instanceof Function&&e.init.apply(e,arguments)}},r.extend=function(e,t){var n,o=this;return e||(e={}),e.prototype instanceof Object&&e.prototype.constructor!==Object?n=e.prototype.constructor:e.factory instanceof Function&&(n=e.factory.call(o)),((n=(o.clone||r.clone).call(o,n,t)).merge||r.merge).call(n,e),n},r.prototype.extend=function(e,t){var n=(this.clone||r.prototype.clone).apply(this,t);return(n.merge||r.prototype.merge).call(n,e),n},r.clone=function(e,t){var n=this;for(var o in e instanceof Function||(e=(n.factory||r.factory).call(n)),e.prototype=(n.prototype.clone||r.prototype.clone).apply(n.prototype,t||[]),e.prototype.constructor=e,n)"prototype"!==o&&(e[o]=n[o]);return e},r.prototype.clone=function(){var e=this,t=Object.create(e);return t.build instanceof Function&&t.build.apply(t,arguments),t},r.merge=function(e){var t=this;for(var n in e)"prototype"!==n&&(t[n]=e[n]);return e.prototype instanceof Object&&(t.prototype.merge||r.prototype.merge).call(t.prototype,e.prototype),t},r.prototype.merge=function(e){for(var t in e)"constructor"!==t&&(this[t]=e[t]);return this},r.absorb=function(e){var t=this;for(var n in e)"prototype"===n||void 0!==t[n]&&t[n]!==Function.prototype[n]||(t[n]=e[n]);return e.prototype instanceof Object&&(t.prototype.absorb||r.prototype.absorb).call(t.prototype,e.prototype),t},r.prototype.absorb=function(e){var t=this;for(var r in e)"constructor"===r||void 0!==t[r]&&t[r]!==Object.prototype[r]||(t[r]=e[r]);return t},r.getAncestor=function(){var e=this;if(e!==e.prototype.constructor)return e.prototype.constructor},r.newInstance=function(){var e=this,t=Object.create(this.prototype);return e.apply(t,arguments),t},e.exports=r},function(e,t){e.exports=function(){throw new Error("Not implemented.")}},function(e,t,r){e.exports={cache:r(35),eachCombination:r(36)}},function(e,t){e.exports=function(e){var t,r=!1;return e instanceof Function||(r=!0,t=e,e=null),function(){return r||(r=!0,t=e.apply(this,arguments),e=null),t}}},function(e,t){e.exports=function e(t,r,n){if(n||(n=[]),n.length<t.length){var o=t[n.length];for(var i in o)n[n.length]=o[i],e(t,r,n),--n.length}else r.apply(null,n)}},function(e,t,r){var n=r(4).Class,o=r(38),i=r(5).cache,a=n(Object,{prototype:{stackParser:null,frameParser:null,locationParsers:null,constructor:function(e){n.prototype.merge.call(this,e)},getFrames:function(e,t){for(var r=[],n=0,o=e.length;n<o;++n)r[n]=this.getFrame(e[n],t[n]);return r},getFrame:function(e,t){return new o({frameString:e,functionValue:t})}}});e.exports={getClass:i((function(){return a})),getInstance:i((function(){return new(this.getClass())}))}},function(e,t,r){var n=r(4).Class,o=r(4).abstractMethod,i=n(Object,{prototype:{init:n.prototype.merge,frameString:void 0,toString:function(){return this.frameString},functionValue:void 0,getThis:o,getTypeName:o,getFunction:function(){return this.functionValue},getFunctionName:o,getMethodName:o,getFileName:o,getLineNumber:o,getColumnNumber:o,getEvalOrigin:o,isTopLevel:o,isEval:o,isNative:o,isConstructor:o}});e.exports=i},function(e,t,r){var n=r(5).cache,o=r(10);e.exports=function(){return Error.captureStackTrace=function(e,t){Object.defineProperties(e,{stack:{configurable:!0,get:n((function(){return(Error.prepareStackTrace||o)(e,[])}))},cachedStack:{configurable:!0,writable:!0,enumerable:!1,value:!0}})},Error.getStackTrace=function(e){if(e.cachedStack)return e.stack;var t=(Error.prepareStackTrace||o)(e,[]);try{Object.defineProperties(e,{stack:{configurable:!0,writable:!0,enumerable:!1,value:t},cachedStack:{configurable:!0,writable:!0,enumerable:!1,value:!0}})}catch(r){}return t},{prepareStackTrace:o}}},function(e,t,r){"use strict";(function(e){var n=r(41),o=r(42),i=r(43);function a(){return l.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function s(e,t){if(a()<t)throw new RangeError("Invalid typed array length");return l.TYPED_ARRAY_SUPPORT?(e=new Uint8Array(t)).__proto__=l.prototype:(null===e&&(e=new l(t)),e.length=t),e}function l(e,t,r){if(!l.TYPED_ARRAY_SUPPORT&&!(this instanceof l))return new l(e,t,r);if("number"===typeof e){if("string"===typeof t)throw new Error("If encoding is specified then the first argument must be a string");return h(this,e)}return u(this,e,t,r)}function u(e,t,r,n){if("number"===typeof t)throw new TypeError('"value" argument must not be a number');return"undefined"!==typeof ArrayBuffer&&t instanceof ArrayBuffer?function(e,t,r,n){if(t.byteLength,r<0||t.byteLength<r)throw new RangeError("'offset' is out of bounds");if(t.byteLength<r+(n||0))throw new RangeError("'length' is out of bounds");t=void 0===r&&void 0===n?new Uint8Array(t):void 0===n?new Uint8Array(t,r):new Uint8Array(t,r,n);l.TYPED_ARRAY_SUPPORT?(e=t).__proto__=l.prototype:e=f(e,t);return e}(e,t,r,n):"string"===typeof t?function(e,t,r){"string"===typeof r&&""!==r||(r="utf8");if(!l.isEncoding(r))throw new TypeError('"encoding" must be a valid string encoding');var n=0|d(t,r),o=(e=s(e,n)).write(t,r);o!==n&&(e=e.slice(0,o));return e}(e,t,r):function(e,t){if(l.isBuffer(t)){var r=0|p(t.length);return 0===(e=s(e,r)).length||t.copy(e,0,0,r),e}if(t){if("undefined"!==typeof ArrayBuffer&&t.buffer instanceof ArrayBuffer||"length"in t)return"number"!==typeof t.length||(n=t.length)!==n?s(e,0):f(e,t);if("Buffer"===t.type&&i(t.data))return f(e,t.data)}var n;throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}(e,t)}function c(e){if("number"!==typeof e)throw new TypeError('"size" argument must be a number');if(e<0)throw new RangeError('"size" argument must not be negative')}function h(e,t){if(c(t),e=s(e,t<0?0:0|p(t)),!l.TYPED_ARRAY_SUPPORT)for(var r=0;r<t;++r)e[r]=0;return e}function f(e,t){var r=t.length<0?0:0|p(t.length);e=s(e,r);for(var n=0;n<r;n+=1)e[n]=255&t[n];return e}function p(e){if(e>=a())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+a().toString(16)+" bytes");return 0|e}function d(e,t){if(l.isBuffer(e))return e.length;if("undefined"!==typeof ArrayBuffer&&"function"===typeof ArrayBuffer.isView&&(ArrayBuffer.isView(e)||e instanceof ArrayBuffer))return e.byteLength;"string"!==typeof e&&(e=""+e);var r=e.length;if(0===r)return 0;for(var n=!1;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":case void 0:return F(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return $(e).length;default:if(n)return F(e).length;t=(""+t).toLowerCase(),n=!0}}function g(e,t,r){var n=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return T(this,t,r);case"utf8":case"utf-8":return k(this,t,r);case"ascii":return R(this,t,r);case"latin1":case"binary":return _(this,t,r);case"base64":return A(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return C(this,t,r);default:if(n)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),n=!0}}function v(e,t,r){var n=e[t];e[t]=e[r],e[r]=n}function y(e,t,r,n,o){if(0===e.length)return-1;if("string"===typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,isNaN(r)&&(r=o?0:e.length-1),r<0&&(r=e.length+r),r>=e.length){if(o)return-1;r=e.length-1}else if(r<0){if(!o)return-1;r=0}if("string"===typeof t&&(t=l.from(t,n)),l.isBuffer(t))return 0===t.length?-1:m(e,t,r,n,o);if("number"===typeof t)return t&=255,l.TYPED_ARRAY_SUPPORT&&"function"===typeof Uint8Array.prototype.indexOf?o?Uint8Array.prototype.indexOf.call(e,t,r):Uint8Array.prototype.lastIndexOf.call(e,t,r):m(e,[t],r,n,o);throw new TypeError("val must be string, number or Buffer")}function m(e,t,r,n,o){var i,a=1,s=e.length,l=t.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(e.length<2||t.length<2)return-1;a=2,s/=2,l/=2,r/=2}function u(e,t){return 1===a?e[t]:e.readUInt16BE(t*a)}if(o){var c=-1;for(i=r;i<s;i++)if(u(e,i)===u(t,-1===c?0:i-c)){if(-1===c&&(c=i),i-c+1===l)return c*a}else-1!==c&&(i-=i-c),c=-1}else for(r+l>s&&(r=s-l),i=r;i>=0;i--){for(var h=!0,f=0;f<l;f++)if(u(e,i+f)!==u(t,f)){h=!1;break}if(h)return i}return-1}function b(e,t,r,n){r=Number(r)||0;var o=e.length-r;n?(n=Number(n))>o&&(n=o):n=o;var i=t.length;if(i%2!==0)throw new TypeError("Invalid hex string");n>i/2&&(n=i/2);for(var a=0;a<n;++a){var s=parseInt(t.substr(2*a,2),16);if(isNaN(s))return a;e[r+a]=s}return a}function w(e,t,r,n){return H(F(t,e.length-r),e,r,n)}function E(e,t,r,n){return H(function(e){for(var t=[],r=0;r<e.length;++r)t.push(255&e.charCodeAt(r));return t}(t),e,r,n)}function S(e,t,r,n){return E(e,t,r,n)}function O(e,t,r,n){return H($(t),e,r,n)}function x(e,t,r,n){return H(function(e,t){for(var r,n,o,i=[],a=0;a<e.length&&!((t-=2)<0);++a)n=(r=e.charCodeAt(a))>>8,o=r%256,i.push(o),i.push(n);return i}(t,e.length-r),e,r,n)}function A(e,t,r){return 0===t&&r===e.length?n.fromByteArray(e):n.fromByteArray(e.slice(t,r))}function k(e,t,r){r=Math.min(e.length,r);for(var n=[],o=t;o<r;){var i,a,s,l,u=e[o],c=null,h=u>239?4:u>223?3:u>191?2:1;if(o+h<=r)switch(h){case 1:u<128&&(c=u);break;case 2:128===(192&(i=e[o+1]))&&(l=(31&u)<<6|63&i)>127&&(c=l);break;case 3:i=e[o+1],a=e[o+2],128===(192&i)&&128===(192&a)&&(l=(15&u)<<12|(63&i)<<6|63&a)>2047&&(l<55296||l>57343)&&(c=l);break;case 4:i=e[o+1],a=e[o+2],s=e[o+3],128===(192&i)&&128===(192&a)&&128===(192&s)&&(l=(15&u)<<18|(63&i)<<12|(63&a)<<6|63&s)>65535&&l<1114112&&(c=l)}null===c?(c=65533,h=1):c>65535&&(c-=65536,n.push(c>>>10&1023|55296),c=56320|1023&c),n.push(c),o+=h}return function(e){var t=e.length;if(t<=P)return String.fromCharCode.apply(String,e);var r="",n=0;for(;n<t;)r+=String.fromCharCode.apply(String,e.slice(n,n+=P));return r}(n)}t.Buffer=l,t.SlowBuffer=function(e){+e!=e&&(e=0);return l.alloc(+e)},t.INSPECT_MAX_BYTES=50,l.TYPED_ARRAY_SUPPORT=void 0!==e.TYPED_ARRAY_SUPPORT?e.TYPED_ARRAY_SUPPORT:function(){try{var e=new Uint8Array(1);return e.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===e.foo()&&"function"===typeof e.subarray&&0===e.subarray(1,1).byteLength}catch(t){return!1}}(),t.kMaxLength=a(),l.poolSize=8192,l._augment=function(e){return e.__proto__=l.prototype,e},l.from=function(e,t,r){return u(null,e,t,r)},l.TYPED_ARRAY_SUPPORT&&(l.prototype.__proto__=Uint8Array.prototype,l.__proto__=Uint8Array,"undefined"!==typeof Symbol&&Symbol.species&&l[Symbol.species]===l&&Object.defineProperty(l,Symbol.species,{value:null,configurable:!0})),l.alloc=function(e,t,r){return function(e,t,r,n){return c(t),t<=0?s(e,t):void 0!==r?"string"===typeof n?s(e,t).fill(r,n):s(e,t).fill(r):s(e,t)}(null,e,t,r)},l.allocUnsafe=function(e){return h(null,e)},l.allocUnsafeSlow=function(e){return h(null,e)},l.isBuffer=function(e){return!(null==e||!e._isBuffer)},l.compare=function(e,t){if(!l.isBuffer(e)||!l.isBuffer(t))throw new TypeError("Arguments must be Buffers");if(e===t)return 0;for(var r=e.length,n=t.length,o=0,i=Math.min(r,n);o<i;++o)if(e[o]!==t[o]){r=e[o],n=t[o];break}return r<n?-1:n<r?1:0},l.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},l.concat=function(e,t){if(!i(e))throw new TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return l.alloc(0);var r;if(void 0===t)for(t=0,r=0;r<e.length;++r)t+=e[r].length;var n=l.allocUnsafe(t),o=0;for(r=0;r<e.length;++r){var a=e[r];if(!l.isBuffer(a))throw new TypeError('"list" argument must be an Array of Buffers');a.copy(n,o),o+=a.length}return n},l.byteLength=d,l.prototype._isBuffer=!0,l.prototype.swap16=function(){var e=this.length;if(e%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var t=0;t<e;t+=2)v(this,t,t+1);return this},l.prototype.swap32=function(){var e=this.length;if(e%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var t=0;t<e;t+=4)v(this,t,t+3),v(this,t+1,t+2);return this},l.prototype.swap64=function(){var e=this.length;if(e%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var t=0;t<e;t+=8)v(this,t,t+7),v(this,t+1,t+6),v(this,t+2,t+5),v(this,t+3,t+4);return this},l.prototype.toString=function(){var e=0|this.length;return 0===e?"":0===arguments.length?k(this,0,e):g.apply(this,arguments)},l.prototype.equals=function(e){if(!l.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e||0===l.compare(this,e)},l.prototype.inspect=function(){var e="",r=t.INSPECT_MAX_BYTES;return this.length>0&&(e=this.toString("hex",0,r).match(/.{2}/g).join(" "),this.length>r&&(e+=" ... ")),"<Buffer "+e+">"},l.prototype.compare=function(e,t,r,n,o){if(!l.isBuffer(e))throw new TypeError("Argument must be a Buffer");if(void 0===t&&(t=0),void 0===r&&(r=e?e.length:0),void 0===n&&(n=0),void 0===o&&(o=this.length),t<0||r>e.length||n<0||o>this.length)throw new RangeError("out of range index");if(n>=o&&t>=r)return 0;if(n>=o)return-1;if(t>=r)return 1;if(this===e)return 0;for(var i=(o>>>=0)-(n>>>=0),a=(r>>>=0)-(t>>>=0),s=Math.min(i,a),u=this.slice(n,o),c=e.slice(t,r),h=0;h<s;++h)if(u[h]!==c[h]){i=u[h],a=c[h];break}return i<a?-1:a<i?1:0},l.prototype.includes=function(e,t,r){return-1!==this.indexOf(e,t,r)},l.prototype.indexOf=function(e,t,r){return y(this,e,t,r,!0)},l.prototype.lastIndexOf=function(e,t,r){return y(this,e,t,r,!1)},l.prototype.write=function(e,t,r,n){if(void 0===t)n="utf8",r=this.length,t=0;else if(void 0===r&&"string"===typeof t)n=t,r=this.length,t=0;else{if(!isFinite(t))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");t|=0,isFinite(r)?(r|=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}var o=this.length-t;if((void 0===r||r>o)&&(r=o),e.length>0&&(r<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var i=!1;;)switch(n){case"hex":return b(this,e,t,r);case"utf8":case"utf-8":return w(this,e,t,r);case"ascii":return E(this,e,t,r);case"latin1":case"binary":return S(this,e,t,r);case"base64":return O(this,e,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return x(this,e,t,r);default:if(i)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),i=!0}},l.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var P=4096;function R(e,t,r){var n="";r=Math.min(e.length,r);for(var o=t;o<r;++o)n+=String.fromCharCode(127&e[o]);return n}function _(e,t,r){var n="";r=Math.min(e.length,r);for(var o=t;o<r;++o)n+=String.fromCharCode(e[o]);return n}function T(e,t,r){var n=e.length;(!t||t<0)&&(t=0),(!r||r<0||r>n)&&(r=n);for(var o="",i=t;i<r;++i)o+=V(e[i]);return o}function C(e,t,r){for(var n=e.slice(t,r),o="",i=0;i<n.length;i+=2)o+=String.fromCharCode(n[i]+256*n[i+1]);return o}function j(e,t,r){if(e%1!==0||e<0)throw new RangeError("offset is not uint");if(e+t>r)throw new RangeError("Trying to access beyond buffer length")}function N(e,t,r,n,o,i){if(!l.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>o||t<i)throw new RangeError('"value" argument is out of bounds');if(r+n>e.length)throw new RangeError("Index out of range")}function U(e,t,r,n){t<0&&(t=65535+t+1);for(var o=0,i=Math.min(e.length-r,2);o<i;++o)e[r+o]=(t&255<<8*(n?o:1-o))>>>8*(n?o:1-o)}function L(e,t,r,n){t<0&&(t=4294967295+t+1);for(var o=0,i=Math.min(e.length-r,4);o<i;++o)e[r+o]=t>>>8*(n?o:3-o)&255}function B(e,t,r,n,o,i){if(r+n>e.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function I(e,t,r,n,i){return i||B(e,0,r,4),o.write(e,t,r,n,23,4),r+4}function D(e,t,r,n,i){return i||B(e,0,r,8),o.write(e,t,r,n,52,8),r+8}l.prototype.slice=function(e,t){var r,n=this.length;if((e=~~e)<0?(e+=n)<0&&(e=0):e>n&&(e=n),(t=void 0===t?n:~~t)<0?(t+=n)<0&&(t=0):t>n&&(t=n),t<e&&(t=e),l.TYPED_ARRAY_SUPPORT)(r=this.subarray(e,t)).__proto__=l.prototype;else{var o=t-e;r=new l(o,void 0);for(var i=0;i<o;++i)r[i]=this[i+e]}return r},l.prototype.readUIntLE=function(e,t,r){e|=0,t|=0,r||j(e,t,this.length);for(var n=this[e],o=1,i=0;++i<t&&(o*=256);)n+=this[e+i]*o;return n},l.prototype.readUIntBE=function(e,t,r){e|=0,t|=0,r||j(e,t,this.length);for(var n=this[e+--t],o=1;t>0&&(o*=256);)n+=this[e+--t]*o;return n},l.prototype.readUInt8=function(e,t){return t||j(e,1,this.length),this[e]},l.prototype.readUInt16LE=function(e,t){return t||j(e,2,this.length),this[e]|this[e+1]<<8},l.prototype.readUInt16BE=function(e,t){return t||j(e,2,this.length),this[e]<<8|this[e+1]},l.prototype.readUInt32LE=function(e,t){return t||j(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},l.prototype.readUInt32BE=function(e,t){return t||j(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},l.prototype.readIntLE=function(e,t,r){e|=0,t|=0,r||j(e,t,this.length);for(var n=this[e],o=1,i=0;++i<t&&(o*=256);)n+=this[e+i]*o;return n>=(o*=128)&&(n-=Math.pow(2,8*t)),n},l.prototype.readIntBE=function(e,t,r){e|=0,t|=0,r||j(e,t,this.length);for(var n=t,o=1,i=this[e+--n];n>0&&(o*=256);)i+=this[e+--n]*o;return i>=(o*=128)&&(i-=Math.pow(2,8*t)),i},l.prototype.readInt8=function(e,t){return t||j(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},l.prototype.readInt16LE=function(e,t){t||j(e,2,this.length);var r=this[e]|this[e+1]<<8;return 32768&r?4294901760|r:r},l.prototype.readInt16BE=function(e,t){t||j(e,2,this.length);var r=this[e+1]|this[e]<<8;return 32768&r?4294901760|r:r},l.prototype.readInt32LE=function(e,t){return t||j(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},l.prototype.readInt32BE=function(e,t){return t||j(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},l.prototype.readFloatLE=function(e,t){return t||j(e,4,this.length),o.read(this,e,!0,23,4)},l.prototype.readFloatBE=function(e,t){return t||j(e,4,this.length),o.read(this,e,!1,23,4)},l.prototype.readDoubleLE=function(e,t){return t||j(e,8,this.length),o.read(this,e,!0,52,8)},l.prototype.readDoubleBE=function(e,t){return t||j(e,8,this.length),o.read(this,e,!1,52,8)},l.prototype.writeUIntLE=function(e,t,r,n){(e=+e,t|=0,r|=0,n)||N(this,e,t,r,Math.pow(2,8*r)-1,0);var o=1,i=0;for(this[t]=255&e;++i<r&&(o*=256);)this[t+i]=e/o&255;return t+r},l.prototype.writeUIntBE=function(e,t,r,n){(e=+e,t|=0,r|=0,n)||N(this,e,t,r,Math.pow(2,8*r)-1,0);var o=r-1,i=1;for(this[t+o]=255&e;--o>=0&&(i*=256);)this[t+o]=e/i&255;return t+r},l.prototype.writeUInt8=function(e,t,r){return e=+e,t|=0,r||N(this,e,t,1,255,0),l.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=255&e,t+1},l.prototype.writeUInt16LE=function(e,t,r){return e=+e,t|=0,r||N(this,e,t,2,65535,0),l.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):U(this,e,t,!0),t+2},l.prototype.writeUInt16BE=function(e,t,r){return e=+e,t|=0,r||N(this,e,t,2,65535,0),l.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):U(this,e,t,!1),t+2},l.prototype.writeUInt32LE=function(e,t,r){return e=+e,t|=0,r||N(this,e,t,4,4294967295,0),l.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e):L(this,e,t,!0),t+4},l.prototype.writeUInt32BE=function(e,t,r){return e=+e,t|=0,r||N(this,e,t,4,4294967295,0),l.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):L(this,e,t,!1),t+4},l.prototype.writeIntLE=function(e,t,r,n){if(e=+e,t|=0,!n){var o=Math.pow(2,8*r-1);N(this,e,t,r,o-1,-o)}var i=0,a=1,s=0;for(this[t]=255&e;++i<r&&(a*=256);)e<0&&0===s&&0!==this[t+i-1]&&(s=1),this[t+i]=(e/a>>0)-s&255;return t+r},l.prototype.writeIntBE=function(e,t,r,n){if(e=+e,t|=0,!n){var o=Math.pow(2,8*r-1);N(this,e,t,r,o-1,-o)}var i=r-1,a=1,s=0;for(this[t+i]=255&e;--i>=0&&(a*=256);)e<0&&0===s&&0!==this[t+i+1]&&(s=1),this[t+i]=(e/a>>0)-s&255;return t+r},l.prototype.writeInt8=function(e,t,r){return e=+e,t|=0,r||N(this,e,t,1,127,-128),l.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[t]=255&e,t+1},l.prototype.writeInt16LE=function(e,t,r){return e=+e,t|=0,r||N(this,e,t,2,32767,-32768),l.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):U(this,e,t,!0),t+2},l.prototype.writeInt16BE=function(e,t,r){return e=+e,t|=0,r||N(this,e,t,2,32767,-32768),l.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):U(this,e,t,!1),t+2},l.prototype.writeInt32LE=function(e,t,r){return e=+e,t|=0,r||N(this,e,t,4,2147483647,-2147483648),l.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):L(this,e,t,!0),t+4},l.prototype.writeInt32BE=function(e,t,r){return e=+e,t|=0,r||N(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),l.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):L(this,e,t,!1),t+4},l.prototype.writeFloatLE=function(e,t,r){return I(this,e,t,!0,r)},l.prototype.writeFloatBE=function(e,t,r){return I(this,e,t,!1,r)},l.prototype.writeDoubleLE=function(e,t,r){return D(this,e,t,!0,r)},l.prototype.writeDoubleBE=function(e,t,r){return D(this,e,t,!1,r)},l.prototype.copy=function(e,t,r,n){if(r||(r=0),n||0===n||(n=this.length),t>=e.length&&(t=e.length),t||(t=0),n>0&&n<r&&(n=r),n===r)return 0;if(0===e.length||0===this.length)return 0;if(t<0)throw new RangeError("targetStart out of bounds");if(r<0||r>=this.length)throw new RangeError("sourceStart out of bounds");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),e.length-t<n-r&&(n=e.length-t+r);var o,i=n-r;if(this===e&&r<t&&t<n)for(o=i-1;o>=0;--o)e[o+t]=this[o+r];else if(i<1e3||!l.TYPED_ARRAY_SUPPORT)for(o=0;o<i;++o)e[o+t]=this[o+r];else Uint8Array.prototype.set.call(e,this.subarray(r,r+i),t);return i},l.prototype.fill=function(e,t,r,n){if("string"===typeof e){if("string"===typeof t?(n=t,t=0,r=this.length):"string"===typeof r&&(n=r,r=this.length),1===e.length){var o=e.charCodeAt(0);o<256&&(e=o)}if(void 0!==n&&"string"!==typeof n)throw new TypeError("encoding must be a string");if("string"===typeof n&&!l.isEncoding(n))throw new TypeError("Unknown encoding: "+n)}else"number"===typeof e&&(e&=255);if(t<0||this.length<t||this.length<r)throw new RangeError("Out of range index");if(r<=t)return this;var i;if(t>>>=0,r=void 0===r?this.length:r>>>0,e||(e=0),"number"===typeof e)for(i=t;i<r;++i)this[i]=e;else{var a=l.isBuffer(e)?e:F(new l(e,n).toString()),s=a.length;for(i=0;i<r-t;++i)this[i+t]=a[i%s]}return this};var M=/[^+\/0-9A-Za-z-_]/g;function V(e){return e<16?"0"+e.toString(16):e.toString(16)}function F(e,t){var r;t=t||1/0;for(var n=e.length,o=null,i=[],a=0;a<n;++a){if((r=e.charCodeAt(a))>55295&&r<57344){if(!o){if(r>56319){(t-=3)>-1&&i.push(239,191,189);continue}if(a+1===n){(t-=3)>-1&&i.push(239,191,189);continue}o=r;continue}if(r<56320){(t-=3)>-1&&i.push(239,191,189),o=r;continue}r=65536+(o-55296<<10|r-56320)}else o&&(t-=3)>-1&&i.push(239,191,189);if(o=null,r<128){if((t-=1)<0)break;i.push(r)}else if(r<2048){if((t-=2)<0)break;i.push(r>>6|192,63&r|128)}else if(r<65536){if((t-=3)<0)break;i.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;i.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return i}function $(e){return n.toByteArray(function(e){if((e=function(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}(e).replace(M,"")).length<2)return"";for(;e.length%4!==0;)e+="=";return e}(e))}function H(e,t,r,n){for(var o=0;o<n&&!(o+r>=t.length||o>=e.length);++o)t[o+r]=e[o];return o}}).call(this,r(18))},function(e,t,r){"use strict";t.byteLength=function(e){var t=u(e),r=t[0],n=t[1];return 3*(r+n)/4-n},t.toByteArray=function(e){var t,r,n=u(e),a=n[0],s=n[1],l=new i(function(e,t,r){return 3*(t+r)/4-r}(0,a,s)),c=0,h=s>0?a-4:a;for(r=0;r<h;r+=4)t=o[e.charCodeAt(r)]<<18|o[e.charCodeAt(r+1)]<<12|o[e.charCodeAt(r+2)]<<6|o[e.charCodeAt(r+3)],l[c++]=t>>16&255,l[c++]=t>>8&255,l[c++]=255&t;2===s&&(t=o[e.charCodeAt(r)]<<2|o[e.charCodeAt(r+1)]>>4,l[c++]=255&t);1===s&&(t=o[e.charCodeAt(r)]<<10|o[e.charCodeAt(r+1)]<<4|o[e.charCodeAt(r+2)]>>2,l[c++]=t>>8&255,l[c++]=255&t);return l},t.fromByteArray=function(e){for(var t,r=e.length,o=r%3,i=[],a=16383,s=0,l=r-o;s<l;s+=a)i.push(c(e,s,s+a>l?l:s+a));1===o?(t=e[r-1],i.push(n[t>>2]+n[t<<4&63]+"==")):2===o&&(t=(e[r-2]<<8)+e[r-1],i.push(n[t>>10]+n[t>>4&63]+n[t<<2&63]+"="));return i.join("")};for(var n=[],o=[],i="undefined"!==typeof Uint8Array?Uint8Array:Array,a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",s=0,l=a.length;s<l;++s)n[s]=a[s],o[a.charCodeAt(s)]=s;function u(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=e.indexOf("=");return-1===r&&(r=t),[r,r===t?0:4-r%4]}function c(e,t,r){for(var o,i,a=[],s=t;s<r;s+=3)o=(e[s]<<16&16711680)+(e[s+1]<<8&65280)+(255&e[s+2]),a.push(n[(i=o)>>18&63]+n[i>>12&63]+n[i>>6&63]+n[63&i]);return a.join("")}o["-".charCodeAt(0)]=62,o["_".charCodeAt(0)]=63},function(e,t){t.read=function(e,t,r,n,o){var i,a,s=8*o-n-1,l=(1<<s)-1,u=l>>1,c=-7,h=r?o-1:0,f=r?-1:1,p=e[t+h];for(h+=f,i=p&(1<<-c)-1,p>>=-c,c+=s;c>0;i=256*i+e[t+h],h+=f,c-=8);for(a=i&(1<<-c)-1,i>>=-c,c+=n;c>0;a=256*a+e[t+h],h+=f,c-=8);if(0===i)i=1-u;else{if(i===l)return a?NaN:1/0*(p?-1:1);a+=Math.pow(2,n),i-=u}return(p?-1:1)*a*Math.pow(2,i-n)},t.write=function(e,t,r,n,o,i){var a,s,l,u=8*i-o-1,c=(1<<u)-1,h=c>>1,f=23===o?Math.pow(2,-24)-Math.pow(2,-77):0,p=n?0:i-1,d=n?1:-1,g=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(s=isNaN(t)?1:0,a=c):(a=Math.floor(Math.log(t)/Math.LN2),t*(l=Math.pow(2,-a))<1&&(a--,l*=2),(t+=a+h>=1?f/l:f*Math.pow(2,1-h))*l>=2&&(a++,l/=2),a+h>=c?(s=0,a=c):a+h>=1?(s=(t*l-1)*Math.pow(2,o),a+=h):(s=t*Math.pow(2,h-1)*Math.pow(2,o),a=0));o>=8;e[r+p]=255&s,p+=d,s/=256,o-=8);for(a=a<<o|s,u+=o;u>0;e[r+p]=255&a,p+=d,a/=256,u-=8);e[r+p-d]|=128*g}},function(e,t){var r={}.toString;e.exports=Array.isArray||function(e){return"[object Array]"==r.call(e)}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(45);Object.defineProperty(t,"BNF",{enumerable:!0,get:function(){return n.default}});var o=r(47);Object.defineProperty(t,"W3C",{enumerable:!0,get:function(){return o.default}});var i=r(48);Object.defineProperty(t,"Custom",{enumerable:!0,get:function(){return i.default}})},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=r(46),o=r(7);var i;!function(e){function t(e){let r=n.findChildrenByType(e,"term").map((e=>n.findChildrenByType(e,"literal").concat(n.findChildrenByType(e,"rule-name"))[0].text));return n.findChildrenByType(e,"list").forEach((e=>{r=r.concat(t(e))})),r}function r(r,o=e.defaultParser){let i=o.getAST(r);if(!i)throw new Error("Could not parse "+r);if(i.errors&&i.errors.length)throw i.errors[0];let a=n.findChildrenByType(i,"rule").map((e=>{let r=n.findChildrenByType(e,"rule-name")[0].text,o=n.findChildrenByType(e,"firstExpression").concat(n.findChildrenByType(e,"otherExpression")),i=[];return o.forEach((e=>{i.push(t(e))})),{name:r,bnf:i}}));return a.some((e=>"EOL"==e.name))||a.push({name:"EOL",bnf:[['"\\r\\n"','"\\r"','"\\n"']]}),a}e.RULES=[{name:"syntax",bnf:[["RULE_EOL*","rule+"]]},{name:"rule",bnf:[['" "*','"<"',"rule-name",'">"','" "*','"::="',"firstExpression","otherExpression*",'" "*',"RULE_EOL+",'" "*']]},{name:"firstExpression",bnf:[['" "*',"list"]]},{name:"otherExpression",bnf:[['" "*','"|"','" "*',"list"]]},{name:"RULE_EOL",bnf:[['"\\r"'],['"\\n"']]},{name:"list",bnf:[["term",'" "*',"list"],["term"]]},{name:"term",bnf:[["literal"],['"<"',"rule-name",'">"']]},{name:"literal",bnf:[["'\"'","RULE_CHARACTER1*","'\"'"],['"\'"',"RULE_CHARACTER2*",'"\'"']]},{name:"RULE_CHARACTER",bnf:[['" "'],["RULE_LETTER"],["RULE_DIGIT"],["RULE_SYMBOL"]]},{name:"RULE_LETTER",bnf:[['"A"'],['"B"'],['"C"'],['"D"'],['"E"'],['"F"'],['"G"'],['"H"'],['"I"'],['"J"'],['"K"'],['"L"'],['"M"'],['"N"'],['"O"'],['"P"'],['"Q"'],['"R"'],['"S"'],['"T"'],['"U"'],['"V"'],['"W"'],['"X"'],['"Y"'],['"Z"'],['"a"'],['"b"'],['"c"'],['"d"'],['"e"'],['"f"'],['"g"'],['"h"'],['"i"'],['"j"'],['"k"'],['"l"'],['"m"'],['"n"'],['"o"'],['"p"'],['"q"'],['"r"'],['"s"'],['"t"'],['"u"'],['"v"'],['"w"'],['"x"'],['"y"'],['"z"']]},{name:"RULE_DIGIT",bnf:[['"0"'],['"1"'],['"2"'],['"3"'],['"4"'],['"5"'],['"6"'],['"7"'],['"8"'],['"9"']]},{name:"RULE_SYMBOL",bnf:[['"-"'],['"_"'],['"!"'],['"#"'],['"$"'],['"%"'],['"&"'],['"("'],['")"'],['"*"'],['"+"'],['","'],['"-"'],['"."'],['"/"'],['":"'],['";"'],['"<"'],['"="'],['">"'],['"?"'],['"@"'],['"["'],['"\\"'],['"]"'],['"^"'],['"_"'],['"`"'],['"{"'],['"|"'],['"}"'],['"~"']]},{name:"RULE_CHARACTER1",bnf:[["RULE_CHARACTER"],['"\'"']]},{name:"RULE_CHARACTER2",bnf:[["RULE_CHARACTER"],["'\"'"]]},{name:"rule-name",bnf:[["RULE_LETTER","RULE_CHAR*"]]},{name:"RULE_CHAR",bnf:[["RULE_LETTER"],["RULE_DIGIT"],['"_"'],['"-"']]}],e.defaultParser=new o.Parser(e.RULES,{debug:!1}),e.getRules=r,e.Transform=function(t,n=e.defaultParser){return r(t.join(""),n)};class i extends o.Parser{constructor(t,n){super(r(t,n&&!0===n.debugRulesParser?new o.Parser(e.RULES,{debug:!0}):e.defaultParser),n),this.source=t}emitSource(){return this.source}}e.Parser=i}(i||(i={})),t.default=i},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.findChildrenByType=void 0,t.findChildrenByType=function(e,t){return e.children?e.children.filter((e=>e.type==t)):[]}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=r(7);var o;!function(e){e.RULES=[{name:"Grammar",bnf:[["RULE_S*","%Atomic*","EOF"]]},{name:"%Atomic",bnf:[["Production","RULE_S*"]],fragment:!0},{name:"Production",bnf:[["NCName","RULE_S*",'"::="',"RULE_WHITESPACE*","Choice","RULE_WHITESPACE*","RULE_EOL+","RULE_S*"]]},{name:"NCName",bnf:[[/[a-zA-Z][a-zA-Z_0-9]*/]]},{name:"Choice",bnf:[["SequenceOrDifference","%_Choice_1*"]],fragment:!0},{name:"%_Choice_1",bnf:[["RULE_WHITESPACE*",'"|"',"RULE_WHITESPACE*","SequenceOrDifference"]],fragment:!0},{name:"SequenceOrDifference",bnf:[["Item","RULE_WHITESPACE*","%_Item_1?"]]},{name:"%_Item_1",bnf:[["Minus","Item"],["Item*"]],fragment:!0},{name:"Minus",bnf:[['"-"']]},{name:"Item",bnf:[["RULE_WHITESPACE*","%Primary","PrimaryDecoration?"]],fragment:!0},{name:"PrimaryDecoration",bnf:[['"?"'],['"*"'],['"+"']]},{name:"DecorationName",bnf:[['"ebnf://"',/[^\x5D#]+/]]},{name:"%Primary",bnf:[["NCName"],["StringLiteral"],["CharCode"],["CharClass"],["SubItem"]],fragment:!0},{name:"SubItem",bnf:[['"("',"RULE_WHITESPACE*","Choice","RULE_WHITESPACE*",'")"']]},{name:"StringLiteral",bnf:[["'\"'",/[^"]*/,"'\"'"],['"\'"',/[^']*/,'"\'"']],pinned:1},{name:"CharCode",bnf:[['"#x"',/[0-9a-zA-Z]+/]]},{name:"CharClass",bnf:[["'['","'^'?","%RULE_CharClass_1+",'"]"']]},{name:"%RULE_CharClass_1",bnf:[["CharCodeRange"],["CharRange"],["CharCode"],["RULE_Char"]],fragment:!0},{name:"RULE_Char",bnf:[[/\x09/],[/\x0A/],[/\x0D/],[/[\x20-\x5c]/],[/[\x5e-\uD7FF]/],[/[\uE000-\uFFFD]/]]},{name:"CharRange",bnf:[["RULE_Char",'"-"',"RULE_Char"]]},{name:"CharCodeRange",bnf:[["CharCode",'"-"',"CharCode"]]},{name:"RULE_WHITESPACE",bnf:[["%RULE_WHITESPACE_CHAR*"],["Comment","RULE_WHITESPACE*"]]},{name:"RULE_S",bnf:[["RULE_WHITESPACE","RULE_S*"],["RULE_EOL","RULE_S*"]]},{name:"%RULE_WHITESPACE_CHAR",bnf:[[/\x09/],[/\x20/]],fragment:!0},{name:"Comment",bnf:[['"/*"',"%RULE_Comment_Body*",'"*/"']]},{name:"%RULE_Comment_Body",bnf:[['!"*/"',/[^*]/]],fragment:!0},{name:"RULE_EOL",bnf:[[/\x0D/,/\x0A/],[/\x0A/],[/\x0D/]]},{name:"Link",bnf:[["'['","Url","']'"]]},{name:"Url",bnf:[[/[^\x5D:/?#]/,'"://"',/[^\x5D#]+/,"%Url1?"]]},{name:"%Url1",bnf:[['"#"',"NCName"]],fragment:!0}],e.defaultParser=new n.Parser(e.RULES,{debug:!1});const t=/^(!|&)/,r=/(\?|\+|\*)$/,o=/^%/;function i(e,i){if("string"==typeof e){if(t.test(e))return"";if(o.test(e)){let t=r.exec(e),o=t?t[0]+" ":"",s=function(e,t){let r=n.findRuleByName(e,t);return r&&1==r.bnf.length&&1==r.bnf[0].length&&(r.bnf[0][0]instanceof RegExp||'"'==r.bnf[0][0][0]||"'"==r.bnf[0][0][0])}(e,i);return s?a(e,i)+o:"("+a(e,i)+")"+o}return e}return e.source.replace(/\\(?:x|u)([a-zA-Z0-9]+)/g,"#x$1").replace(/\[\\(?:x|u)([a-zA-Z0-9]+)-\\(?:x|u)([a-zA-Z0-9]+)\]/g,"[#x$1-#x$2]")}function a(e,t){let r=n.findRuleByName(e,t);return r?r.bnf.map((e=>function(e,t){return e.map((e=>i(e,t))).join(" ")}(e,t))).join(" | "):"RULE_NOT_FOUND {"+e+"}"}function s(e){let t=[];return e.grammarRules.forEach((r=>{if(!/^%/.test(r.name)){let n=r.recover?" /* { recoverUntil="+r.recover+" } */":"";t.push(r.name+" ::= "+a(r.name,e)+n)}})),t.join("\n")}e.emit=s;let l=0;function u(e){return new RegExp(e.replace(/#x([a-zA-Z0-9]{4})/g,"\\u$1").replace(/#x([a-zA-Z0-9]{3})/g,"\\u0$1").replace(/#x([a-zA-Z0-9]{2})/g,"\\x$1").replace(/#x([a-zA-Z0-9]{1})/g,"\\x0$1"))}function c(e,t,r){let n=null,o=[];return t.children.forEach(((i,a)=>{"Minus"==i.type&&function(e,t){throw console.log("reberia restar "+t+" a "+e),new Error("Difference not supported yet")}(n,i);let s=t.children[a+1];s=s&&"PrimaryDecoration"==s.type&&s.text||"";switch(i.type){case"SubItem":let t="%"+(r+l++);h(e,i,t),o.push(""+t+s);break;case"NCName":case"StringLiteral":o.push(""+i.text+s);break;case"CharCode":case"CharClass":if(s){let t={name:"%"+(r+l++),bnf:[[u(i.text)]]};e.push(t),o.push(""+t.name+s)}else o.push(u(i.text));break;case"PrimaryDecoration":break;default:throw new Error(" HOW SHOULD I PARSE THIS? "+i.type+" -> "+JSON.stringify(i.text))}n=i})),o}function h(e,t,r){let n=t.children.filter((e=>"SequenceOrDifference"==e.type)).map((t=>c(e,t,r))),o={name:r,bnf:n},i=null;n.forEach((e=>{i=i||e.recover,delete e.recover})),0==r.indexOf("%")&&(o.fragment=!0),i&&(o.recover=i),e.push(o)}function f(t,r=e.defaultParser){let n=r.getAST(t);if(!n)throw new Error("Could not parse "+t);if(n.errors&&n.errors.length)throw n.errors[0];let o=[];return n.children.filter((e=>"Production"==e.type)).map((e=>{let t=e.children.filter((e=>"NCName"==e.type))[0].text;h(o,e,t)})),o}e.getRules=f,e.Transform=function(t,r=e.defaultParser){return f(t.join(""),r)};class p extends n.Parser{constructor(t,r){super(f(t,r&&!0===r.debugRulesParser?new n.Parser(e.RULES,{debug:!0}):e.defaultParser),r)}emitSource(){return s(this)}}e.Parser=p}(o||(o={})),t.default=o},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=r(11),o=r(7);var i;!function(e){e.RULES=[{name:"Grammar",bnf:[["RULE_S*","Attributes?","RULE_S*","%Atomic*","EOF"]]},{name:"%Atomic",bnf:[["Production","RULE_S*"]],fragment:!0},{name:"Production",bnf:[["NCName","RULE_S*",'"::="',"RULE_WHITESPACE*","%Choice","RULE_WHITESPACE*","Attributes?","RULE_EOL+","RULE_S*"]]},{name:"NCName",bnf:[[/[a-zA-Z][a-zA-Z_0-9]*/]]},{name:"Attributes",bnf:[['"{"',"Attribute","%Attributes*","RULE_S*",'"}"']]},{name:"%Attributes",bnf:[["RULE_S*",'","',"Attribute"]],fragment:!0},{name:"Attribute",bnf:[["RULE_S*","NCName","RULE_WHITESPACE*",'"="',"RULE_WHITESPACE*","AttributeValue"]]},{name:"AttributeValue",bnf:[["NCName"],[/[1-9][0-9]*/]]},{name:"%Choice",bnf:[["SequenceOrDifference","%_Choice_1*"]],fragment:!0},{name:"%_Choice_1",bnf:[["RULE_S*",'"|"',"RULE_S*","SequenceOrDifference"]],fragment:!0},{name:"SequenceOrDifference",bnf:[["%Item","RULE_WHITESPACE*","%_Item_1?"]]},{name:"%_Item_1",bnf:[["Minus","%Item"],["%Item*"]],fragment:!0},{name:"Minus",bnf:[['"-"']]},{name:"%Item",bnf:[["RULE_WHITESPACE*","PrimaryPreDecoration?","%Primary","PrimaryDecoration?"]],fragment:!0},{name:"PrimaryDecoration",bnf:[['"?"'],['"*"'],['"+"']]},{name:"PrimaryPreDecoration",bnf:[['"&"'],['"!"'],['"~"']]},{name:"%Primary",bnf:[["NCName"],["StringLiteral"],["CharCode"],["CharClass"],["SubItem"]],fragment:!0},{name:"SubItem",bnf:[['"("',"RULE_S*","%Choice","RULE_S*",'")"']]},{name:"StringLiteral",bnf:[["'\"'",/[^"]*/,"'\"'"],['"\'"',/[^']*/,'"\'"']]},{name:"CharCode",bnf:[['"#x"',/[0-9a-zA-Z]+/]]},{name:"CharClass",bnf:[["'['","'^'?","%RULE_CharClass_1+",'"]"']]},{name:"%RULE_CharClass_1",bnf:[["CharCodeRange"],["CharRange"],["CharCode"],["RULE_Char"]],fragment:!0},{name:"RULE_Char",bnf:[[/\x09/],[/\x0A/],[/\x0D/],[/[\x20-\x5c]/],[/[\x5e-\uD7FF]/],[/[\uE000-\uFFFD]/]]},{name:"CharRange",bnf:[["RULE_Char",'"-"',"RULE_Char"]]},{name:"CharCodeRange",bnf:[["CharCode",'"-"',"CharCode"]]},{name:"RULE_WHITESPACE",bnf:[["%RULE_WHITESPACE_CHAR*"],["Comment","RULE_WHITESPACE*"]]},{name:"RULE_S",bnf:[["RULE_WHITESPACE","RULE_S*"],["RULE_EOL","RULE_S*"]]},{name:"%RULE_WHITESPACE_CHAR",bnf:[[/\x09/],[/\x20/]],fragment:!0},{name:"Comment",bnf:[['"/*"',"%RULE_Comment_Body*",'"*/"']]},{name:"%RULE_Comment_Body",bnf:[[/[^*]/],['"*"+',/[^/]*/]],fragment:!0},{name:"RULE_EOL",bnf:[[/\x0D/,/\x0A/],[/\x0A/],[/\x0D/]]},{name:"Link",bnf:[["'['","Url","']'"]]},{name:"Url",bnf:[[/[^\x5D:/?#]/,'"://"',/[^\x5D#]+/,"%Url1?"]]},{name:"%Url1",bnf:[['"#"',"NCName"]],fragment:!0}],e.defaultParser=new o.Parser(e.RULES,{debug:!1});const t=/^(!|&)/,r=/(\?|\+|\*)$/,i=/^%/;function a(e,n){if("string"==typeof e){let a=r.exec(e),l=t.exec(e),u=l?l[0]:"",c=a?a[0]+" ":"";if(i.test(e)){let t=function(e,t){let r=o.findRuleByName(e,t);return r&&1==r.bnf.length&&1==r.bnf[0].length&&(r.bnf[0][0]instanceof RegExp||'"'==r.bnf[0][0][0]||"'"==r.bnf[0][0][0])}(e,n);return t?u+s(e,n)+c:u+"("+s(e,n)+")"+c}return e.replace(t,u)}return e.source.replace(/\\(?:x|u)([a-zA-Z0-9]+)/g,"#x$1").replace(/\[\\(?:x|u)([a-zA-Z0-9]+)-\\(?:x|u)([a-zA-Z0-9]+)\]/g,"[#x$1-#x$2]")}function s(e,t){let r=o.findRuleByName(e,t);return r?r.bnf.map((e=>function(e,t){return e.map((e=>a(e,t))).join(" ")}(e,t))).join(" | "):"RULE_NOT_FOUND {"+e+"}"}function l(e){let t=[];return e.grammarRules.forEach((r=>{if(!/^%/.test(r.name)){let n=r.recover?" { recoverUntil="+r.recover+" }":"";t.push(r.name+" ::= "+s(r.name,e)+n)}})),t.join("\n")}e.emit=l;let u=0;function c(e){return new RegExp(e.replace(/#x([a-zA-Z0-9]{4})/g,"\\u$1").replace(/#x([a-zA-Z0-9]{3})/g,"\\u0$1").replace(/#x([a-zA-Z0-9]{2})/g,"\\x$1").replace(/#x([a-zA-Z0-9]{1})/g,"\\x0$1"))}function h(e,t,r,n){let i=null,a=[];return t.children.forEach(((s,l)=>{"Minus"==s.type&&function(e,t){throw console.log("reberia restar "+t+" a "+e),new Error("Difference not supported yet")}(i,s);let h=t.children[l+1];h=h&&"PrimaryDecoration"==h.type&&h.text||"";let p="";i&&"PrimaryPreDecoration"==i.type&&(p=i.text);let d="~"==p?1:void 0;switch(d&&(p=""),s.type){case"SubItem":let t="%"+(r+u++);f(e,s,t,n),a.push(p+t+h);break;case"NCName":a.push(p+s.text+h);break;case"StringLiteral":if(h||p||!/^['"/()a-zA-Z0-9&_.:=,+*\-\^\\]+$/.test(s.text))a.push(p+s.text+h);else for(const e of s.text.slice(1,-1))n&&"true"==n.ignoreCase&&/[a-zA-Z]/.test(e)?a.push(new RegExp("["+e.toUpperCase()+e.toLowerCase()+"]")):a.push(new RegExp(o.escapeRegExp(e)));break;case"CharCode":case"CharClass":if(h||p){let t={name:"%"+(r+u++),bnf:[[c(s.text)]],pinned:d};e.push(t),a.push(p+t.name+h)}else a.push(c(s.text));break;case"PrimaryPreDecoration":case"PrimaryDecoration":break;default:throw new Error(" HOW SHOULD I PARSE THIS? "+s.type+" -> "+JSON.stringify(s.text))}i=s})),a}function f(e,t,r,o){let i=t.children.filter((e=>"Attributes"==e.type))[0],a={};i&&i.children.forEach((e=>{let t=e.children.filter((e=>"NCName"==e.type))[0].text;if(t in a)throw new n.TokenError("Duplicated attribute "+t,e);a[t]=e.children.filter((e=>"AttributeValue"==e.type))[0].text}));let s=t.children.filter((e=>"SequenceOrDifference"==e.type)).map((t=>h(e,t,r,o||a))),l={name:r,bnf:s};if(0==r.indexOf("%")&&(l.fragment=!0),a.recoverUntil&&(l.recover=a.recoverUntil,l.bnf.length>1))throw new n.TokenError("only one-option productions are suitable for error recovering",t);if("pin"in a){let e=parseInt(a.pin);if(isNaN(e)||(l.pinned=e),l.bnf.length>1)throw new n.TokenError("only one-option productions are suitable for pinning",t)}l.implicitWs="ws"in a?"explicit"!=a.ws:null,l.fragment=l.fragment||"true"==a.fragment,l.simplifyWhenOneChildren="true"==a.simplifyWhenOneChildren,e.push(l)}function p(t,r=e.defaultParser){let o=r.getAST(t);if(!o)throw new Error("Could not parse "+t);if(o.errors&&o.errors.length)throw o.errors[0];let i=null,a=o.children.filter((e=>"Attributes"==e.type))[0],s={};a&&a.children.forEach((e=>{let t=e.children.filter((e=>"NCName"==e.type))[0].text;if(t in s)throw new n.TokenError("Duplicated attribute "+t,e);s[t]=e.children.filter((e=>"AttributeValue"==e.type))[0].text})),i="implicit"==s.ws;let l=[];return o.children.filter((e=>"Production"==e.type)).map((e=>{let t=e.children.filter((e=>"NCName"==e.type))[0].text;f(l,e,t)})),l.forEach((e=>{null===e.implicitWs&&(e.implicitWs=i)})),l}e.getRules=p,e.Transform=function(t,r=e.defaultParser){return p(t.join(""),r)};class d extends o.Parser{constructor(t,r){super(p(t,r&&!0===r.debugRulesParser?new o.Parser(e.RULES,{debug:!0}):e.defaultParser),r)}emitSource(){return l(this)}}e.Parser=d}(i||(i={})),t.default=i}])}));
2
+ !function(e,t){"object"===typeof exports&&"object"===typeof module?module.exports=t():"function"===typeof define&&define.amd?define([],t):"object"===typeof exports?exports.Player=t():e.Player=t()}(this,(function(){return function(e){var t={};function r(n){if(t[n])return t[n].exports;var o=t[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}return r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!==typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"===typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)r.d(n,o,function(t){return e[t]}.bind(null,o));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=23)}([function(e,t,r){"use strict";function n(e,t,r){return e.context?e.callback(r,...t):e.callback(...t)}r.d(t,"a",(function(){return s})),r.d(t,"b",(function(){return a})),r.d(t,"c",(function(){return l}));class o{constructor(){this.interceptions=[],this.interceptionKeySet=new Set}isUsed(){return this.interceptions.length>0}intercept(e){this.interceptions.push(e),Object.keys(e).forEach((e=>{this.interceptionKeySet.add(e)}))}tap(e){this.interceptionKeySet.has("tap")&&this.interceptions.forEach((t=>{var r;null==(r=t.tap)||r.call(t,e)}))}call(e,...t){this.interceptionKeySet.has("call")&&this.interceptions.forEach((r=>{var n,o;r.context?null==(n=r.call)||n.call(r,e,...t):null==(o=r.call)||o.call(r,...t)}))}loop(...e){this.interceptionKeySet.has("loop")&&this.interceptions.forEach((t=>{var r;null==(r=t.loop)||r.call(t,...e)}))}error(e){if(this.interceptionKeySet.has("error")&&e instanceof Error){const t=e;this.interceptions.forEach((e=>{var r;null==(r=e.error)||r.call(e,t)}))}}result(e){this.interceptionKeySet.has("result")&&this.interceptions.forEach((t=>{var r;null==(r=t.result)||r.call(t,e)}))}done(){this.interceptionKeySet.has("done")&&this.interceptions.forEach((e=>{var t;null==(t=e.done)||t.call(e)}))}}class i{constructor(){this.taps=[],this.interceptions=new o}tap(e,t){const r="string"===typeof e?{name:e,context:!1}:{context:!1,...e},n={key:Symbol(r.name),...r,callback:t};if(n.before){let e=this.taps.length;const t=new Set(Array.isArray(n.before)?n.before:[n.before]);for(;e>0&&t.size>0;e--){const r=this.taps[e-1];if(t.has(r.name)&&t.delete(r.name),r.before&&(o=n.name,i=r.before,Array.isArray(i)?i.includes(o):i===o))break}this.taps.splice(e,0,n)}else this.taps.push(n);var o,i;return this.interceptions.tap(n),n}untap(e){this.taps=this.taps.filter((t=>t.key!==e.key))}isUsed(){return this.taps.length>0||this.interceptions.isUsed()}intercept(e){this.interceptions.intercept(e)}}class a extends i{call(...e){if(!this.isUsed())return;const t={};this.interceptions.call(t,...e);try{this.taps.forEach((r=>{n(r,e,t)}))}catch(r){throw this.interceptions.error(r),r}this.interceptions.done()}}class s extends i{call(...e){if(!this.isUsed())return;const t={};this.interceptions.call(t,...e);for(let r=0;r<this.taps.length;r+=1){const o=n(this.taps[r],e,t);if(void 0!==o)return this.interceptions.result(o),o}this.interceptions.done()}}class l extends i{call(...e){const t={};this.interceptions.call(t,...e);let[r,...o]=e;for(let i=0;i<this.taps.length;i+=1){const e=n(this.taps[i],[r,...o],t);void 0!==e&&(r=e)}return this.interceptions.result(r),r}}},function(e,t,r){(function(t){"undefined"!=typeof self&&self,e.exports=function(e){var t={};function r(n){if(t[n])return t[n].exports;var o=t[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}return r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:n})},r.r=function(e){Object.defineProperty(e,"__esModule",{value:!0})},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=0)}([function(e,r,n){"use strict";function o(e){if(!(this instanceof o))return new o(e);this._=e}var i=o.prototype;function a(e,t){for(var r=0;r<e;r++)t(r)}function s(e,t,r){return function(e,t){a(t.length,(function(r){e(t[r],r,t)}))}((function(r,n,o){t=e(t,r,n,o)}),r),t}function l(e,t){return s((function(t,r,n,o){return t.concat([e(r,n,o)])}),[],t)}function u(e,r){var n={v:0,buf:r};return a(e,(function(){var e;n={v:n.v<<1|(e=n.buf,e[0]>>7),buf:function(e){var r=s((function(e,r,n,o){return e.concat(n===o.length-1?t.from([r,0]).readUInt16BE(0):o.readUInt16BE(n))}),[],e);return t.from(l((function(e){return(e<<1&65535)>>8}),r))}(n.buf)}})),n}function c(){return"undefined"!=typeof t}function h(){if(!c())throw new Error("Buffer global does not exist; please use webpack if you need to parse Buffers in the browser.")}function f(e){h();var t=s((function(e,t){return e+t}),0,e);if(t%8!=0)throw new Error("The bits ["+e.join(", ")+"] add up to "+t+" which is not an even number of bytes; the total should be divisible by 8");var r,n=t/8,i=(r=function(e){return e>48},s((function(e,t){return e||(r(t)?t:e)}),null,e));if(i)throw new Error(i+" bit range requested exceeds 48 bit (6 byte) Number max.");return new o((function(t,r){var o=n+r;return o>t.length?O(r,n.toString()+" bytes"):S(o,s((function(e,t){var r=u(t,e.buf);return{coll:e.coll.concat(r.v),buf:r.buf}}),{coll:[],buf:t.slice(r,o)},e).coll)}))}function p(e,t){return new o((function(r,n){return h(),n+t>r.length?O(n,t+" bytes for "+e):S(n+t,r.slice(n,n+t))}))}function d(e,t){if("number"!=typeof(r=t)||Math.floor(r)!==r||t<0||t>6)throw new Error(e+" requires integer length in range [0, 6].");var r}function g(e){return d("uintBE",e),p("uintBE("+e+")",e).map((function(t){return t.readUIntBE(0,e)}))}function v(e){return d("uintLE",e),p("uintLE("+e+")",e).map((function(t){return t.readUIntLE(0,e)}))}function y(e){return d("intBE",e),p("intBE("+e+")",e).map((function(t){return t.readIntBE(0,e)}))}function m(e){return d("intLE",e),p("intLE("+e+")",e).map((function(t){return t.readIntLE(0,e)}))}function b(e){return e instanceof o}function w(e){return"[object Array]"==={}.toString.call(e)}function E(e){return c()&&t.isBuffer(e)}function S(e,t){return{status:!0,index:e,value:t,furthest:-1,expected:[]}}function O(e,t){return w(t)||(t=[t]),{status:!1,index:-1,value:null,furthest:e,expected:t}}function x(e,t){if(!t)return e;if(e.furthest>t.furthest)return e;var r=e.furthest===t.furthest?function(e,t){if(function(){if(void 0!==o._supportsSet)return o._supportsSet;var e="undefined"!=typeof Set;return o._supportsSet=e,e}()&&Array.from){for(var r=new Set(e),n=0;n<t.length;n++)r.add(t[n]);var i=Array.from(r);return i.sort(),i}for(var a={},s=0;s<e.length;s++)a[e[s]]=!0;for(var l=0;l<t.length;l++)a[t[l]]=!0;var u=[];for(var c in a)({}).hasOwnProperty.call(a,c)&&u.push(c);return u.sort(),u}(e.expected,t.expected):t.expected;return{status:e.status,index:e.index,value:e.value,furthest:t.furthest,expected:r}}var A={};function k(e,t){if(E(e))return{offset:t,line:-1,column:-1};e in A||(A[e]={});for(var r=A[e],n=0,o=0,i=0,a=t;a>=0;){if(a in r){n=r[a].line,0===i&&(i=r[a].lineStart);break}("\n"===e.charAt(a)||"\r"===e.charAt(a)&&"\n"!==e.charAt(a+1))&&(o++,0===i&&(i=a+1)),a--}var s=n+o,l=t-i;return r[t]={line:s,lineStart:i},{offset:t,line:s+1,column:l+1}}function P(e){if(!b(e))throw new Error("not a parser: "+e)}function R(e,t){return"string"==typeof e?e.charAt(t):e[t]}function _(e){if("number"!=typeof e)throw new Error("not a number: "+e)}function T(e){if("function"!=typeof e)throw new Error("not a function: "+e)}function C(e){if("string"!=typeof e)throw new Error("not a string: "+e)}var j=2,N=3,U=8,L=5*U,B=4*U,I=" ";function D(e,t){return new Array(t+1).join(e)}function M(e,t,r){var n=t-e.length;return n<=0?e:D(r,n)+e}function V(e,t,r,n){return{from:e-t>0?e-t:0,to:e+r>n?n:e+r}}function F(e,t){var r,n,o,i,a,u=t.index,c=u.offset,h=1;if(c===e.length)return"Got the end of the input";if(E(e)){var f=c-c%U,p=c-f,d=V(f,L,B+U,e.length),g=l((function(e){return l((function(e){return M(e.toString(16),2,"0")}),e)}),function(e,t){var r=e.length,n=[],o=0;if(r<=t)return[e.slice()];for(var i=0;i<r;i++)n[o]||n.push([]),n[o].push(e[i]),(i+1)%t==0&&o++;return n}(e.slice(d.from,d.to).toJSON().data,U));i=function(e){return 0===e.from&&1===e.to?{from:e.from,to:e.to}:{from:e.from/U,to:Math.floor(e.to/U)}}(d),n=f/U,r=3*p,p>=4&&(r+=1),h=2,o=l((function(e){return e.length<=4?e.join(" "):e.slice(0,4).join(" ")+" "+e.slice(4).join(" ")}),g),(a=(8*(i.to>0?i.to-1:i.to)).toString(16).length)<2&&(a=2)}else{var v=e.split(/\r\n|[\n\r\u2028\u2029]/);r=u.column-1,n=u.line-1,i=V(n,j,N,v.length),o=v.slice(i.from,i.to),a=i.to.toString().length}var y=n-i.from;return E(e)&&(a=(8*(i.to>0?i.to-1:i.to)).toString(16).length)<2&&(a=2),s((function(t,n,o){var s,l=o===y,u=l?"> ":I;return s=E(e)?M((8*(i.from+o)).toString(16),a,"0"):M((i.from+o+1).toString(),a," "),[].concat(t,[u+s+" | "+n],l?[I+D(" ",a)+" | "+M("",r," ")+D("^",h)]:[])}),[],o).join("\n")}function $(e,t){return["\n","-- PARSING FAILED "+D("-",50),"\n\n",F(e,t),"\n\n",(r=t.expected,1===r.length?"Expected:\n\n"+r[0]:"Expected one of the following: \n\n"+r.join(", ")),"\n"].join("");var r}function H(e){return void 0!==e.flags?e.flags:[e.global?"g":"",e.ignoreCase?"i":"",e.multiline?"m":"",e.unicode?"u":"",e.sticky?"y":""].join("")}function z(){for(var e=[].slice.call(arguments),t=e.length,r=0;r<t;r+=1)P(e[r]);return o((function(r,n){for(var o,i=new Array(t),a=0;a<t;a+=1){if(!(o=x(e[a]._(r,n),o)).status)return o;i[a]=o.value,n=o.index}return x(S(n,i),o)}))}function W(){var e=[].slice.call(arguments);if(0===e.length)throw new Error("seqMap needs at least one argument");var t=e.pop();return T(t),z.apply(null,e).map((function(e){return t.apply(null,e)}))}function Y(){var e=[].slice.call(arguments),t=e.length;if(0===t)return Q("zero alternates");for(var r=0;r<t;r+=1)P(e[r]);return o((function(t,r){for(var n,o=0;o<e.length;o+=1)if((n=x(e[o]._(t,r),n)).status)return n;return n}))}function q(e,t){return G(e,t).or(J([]))}function G(e,t){return P(e),P(t),W(e,t.then(e).many(),(function(e,t){return[e].concat(t)}))}function K(e){C(e);var t="'"+e+"'";return o((function(r,n){var o=n+e.length,i=r.slice(n,o);return i===e?S(o,i):O(n,t)}))}function Z(e,t){!function(e){if(!(e instanceof RegExp))throw new Error("not a regexp: "+e);for(var t=H(e),r=0;r<t.length;r++){var n=t.charAt(r);if("i"!==n&&"m"!==n&&"u"!==n&&"s"!==n)throw new Error('unsupported regexp flag "'+n+'": '+e)}}(e),arguments.length>=2?_(t):t=0;var r=function(e){return RegExp("^(?:"+e.source+")",H(e))}(e),n=""+e;return o((function(e,o){var i=r.exec(e.slice(o));if(i){if(0<=t&&t<=i.length){var a=i[0],s=i[t];return S(o+a.length,s)}return O(o,"valid match group (0 to "+i.length+") in "+n)}return O(o,n)}))}function J(e){return o((function(t,r){return S(r,e)}))}function Q(e){return o((function(t,r){return O(r,e)}))}function X(e){if(b(e))return o((function(t,r){var n=e._(t,r);return n.index=r,n.value="",n}));if("string"==typeof e)return X(K(e));if(e instanceof RegExp)return X(Z(e));throw new Error("not a string, regexp, or parser: "+e)}function ee(e){return P(e),o((function(t,r){var n=e._(t,r),o=t.slice(r,n.index);return n.status?O(r,'not "'+o+'"'):S(r,null)}))}function te(e){return T(e),o((function(t,r){var n=R(t,r);return r<t.length&&e(n)?S(r+1,n):O(r,"a character/byte matching "+e)}))}function re(e,t){arguments.length<2&&(t=e,e=void 0);var r=o((function(e,n){return r._=t()._,r._(e,n)}));return e?r.desc(e):r}function ne(){return Q("fantasy-land/empty")}i.parse=function(e){if("string"!=typeof e&&!E(e))throw new Error(".parse must be called with a string or Buffer as its argument");var t,r=this.skip(se)._(e,0);return t=r.status?{status:!0,value:r.value}:{status:!1,index:k(e,r.furthest),expected:r.expected},delete A[e],t},i.tryParse=function(e){var t=this.parse(e);if(t.status)return t.value;var r=$(e,t),n=new Error(r);throw n.type="ParsimmonError",n.result=t,n},i.assert=function(e,t){return this.chain((function(r){return e(r)?J(r):Q(t)}))},i.or=function(e){return Y(this,e)},i.trim=function(e){return this.wrap(e,e)},i.wrap=function(e,t){return W(e,this,t,(function(e,t){return t}))},i.thru=function(e){return e(this)},i.then=function(e){return P(e),z(this,e).map((function(e){return e[1]}))},i.many=function(){var e=this;return o((function(t,r){for(var n=[],o=void 0;;){if(!(o=x(e._(t,r),o)).status)return x(S(r,n),o);if(r===o.index)throw new Error("infinite loop detected in .many() parser --- calling .many() on a parser which can accept zero characters is usually the cause");r=o.index,n.push(o.value)}}))},i.tieWith=function(e){return C(e),this.map((function(t){if(function(e){if(!w(e))throw new Error("not an array: "+e)}(t),t.length){C(t[0]);for(var r=t[0],n=1;n<t.length;n++)C(t[n]),r+=e+t[n];return r}return""}))},i.tie=function(){return this.tieWith("")},i.times=function(e,t){var r=this;return arguments.length<2&&(t=e),_(e),_(t),o((function(n,o){for(var i=[],a=void 0,s=void 0,l=0;l<e;l+=1){if(s=x(a=r._(n,o),s),!a.status)return s;o=a.index,i.push(a.value)}for(;l<t&&(s=x(a=r._(n,o),s),a.status);l+=1)o=a.index,i.push(a.value);return x(S(o,i),s)}))},i.result=function(e){return this.map((function(){return e}))},i.atMost=function(e){return this.times(0,e)},i.atLeast=function(e){return W(this.times(e),this.many(),(function(e,t){return e.concat(t)}))},i.map=function(e){T(e);var t=this;return o((function(r,n){var o=t._(r,n);return o.status?x(S(o.index,e(o.value)),o):o}))},i.contramap=function(e){T(e);var t=this;return o((function(r,n){var o=t.parse(e(r.slice(n)));return o.status?S(n+r.length,o.value):o}))},i.promap=function(e,t){return T(e),T(t),this.contramap(e).map(t)},i.skip=function(e){return z(this,e).map((function(e){return e[0]}))},i.mark=function(){return W(oe,this,oe,(function(e,t,r){return{start:e,value:t,end:r}}))},i.node=function(e){return W(oe,this,oe,(function(t,r,n){return{name:e,value:r,start:t,end:n}}))},i.sepBy=function(e){return q(this,e)},i.sepBy1=function(e){return G(this,e)},i.lookahead=function(e){return this.skip(X(e))},i.notFollowedBy=function(e){return this.skip(ee(e))},i.desc=function(e){w(e)||(e=[e]);var t=this;return o((function(r,n){var o=t._(r,n);return o.status||(o.expected=e),o}))},i.fallback=function(e){return this.or(J(e))},i.ap=function(e){return W(e,this,(function(e,t){return e(t)}))},i.chain=function(e){var t=this;return o((function(r,n){var o=t._(r,n);return o.status?x(e(o.value)._(r,o.index),o):o}))},i.concat=i.or,i.empty=ne,i.of=J,i["fantasy-land/ap"]=i.ap,i["fantasy-land/chain"]=i.chain,i["fantasy-land/concat"]=i.concat,i["fantasy-land/empty"]=i.empty,i["fantasy-land/of"]=i.of,i["fantasy-land/map"]=i.map;var oe=o((function(e,t){return S(t,k(e,t))})),ie=o((function(e,t){return t>=e.length?O(t,"any character/byte"):S(t+1,R(e,t))})),ae=o((function(e,t){return S(e.length,e.slice(t))})),se=o((function(e,t){return t<e.length?O(t,"EOF"):S(t,null)})),le=Z(/[0-9]/).desc("a digit"),ue=Z(/[0-9]*/).desc("optional digits"),ce=Z(/[a-z]/i).desc("a letter"),he=Z(/[a-z]*/i).desc("optional letters"),fe=Z(/\s*/).desc("optional whitespace"),pe=Z(/\s+/).desc("whitespace"),de=K("\r"),ge=K("\n"),ve=K("\r\n"),ye=Y(ve,ge,de).desc("newline"),me=Y(ye,se);o.all=ae,o.alt=Y,o.any=ie,o.cr=de,o.createLanguage=function(e){var t={};for(var r in e)({}).hasOwnProperty.call(e,r)&&function(r){t[r]=re((function(){return e[r](t)}))}(r);return t},o.crlf=ve,o.custom=function(e){return o(e(S,O))},o.digit=le,o.digits=ue,o.empty=ne,o.end=me,o.eof=se,o.fail=Q,o.formatError=$,o.index=oe,o.isParser=b,o.lazy=re,o.letter=ce,o.letters=he,o.lf=ge,o.lookahead=X,o.makeFailure=O,o.makeSuccess=S,o.newline=ye,o.noneOf=function(e){return te((function(t){return e.indexOf(t)<0})).desc("none of '"+e+"'")},o.notFollowedBy=ee,o.of=J,o.oneOf=function(e){for(var t=e.split(""),r=0;r<t.length;r++)t[r]="'"+t[r]+"'";return te((function(t){return e.indexOf(t)>=0})).desc(t)},o.optWhitespace=fe,o.Parser=o,o.range=function(e,t){return te((function(r){return e<=r&&r<=t})).desc(e+"-"+t)},o.regex=Z,o.regexp=Z,o.sepBy=q,o.sepBy1=G,o.seq=z,o.seqMap=W,o.seqObj=function(){for(var e,t={},r=0,n=(e=arguments,Array.prototype.slice.call(e)),i=n.length,a=0;a<i;a+=1){var s=n[a];if(!b(s)){if(w(s)&&2===s.length&&"string"==typeof s[0]&&b(s[1])){var l=s[0];if(Object.prototype.hasOwnProperty.call(t,l))throw new Error("seqObj: duplicate key "+l);t[l]=!0,r++;continue}throw new Error("seqObj arguments must be parsers or [string, parser] array pairs.")}}if(0===r)throw new Error("seqObj expects at least one named parser, found zero");return o((function(e,t){for(var r,o={},a=0;a<i;a+=1){var s,l;if(w(n[a])?(s=n[a][0],l=n[a][1]):(s=null,l=n[a]),!(r=x(l._(e,t),r)).status)return r;s&&(o[s]=r.value),t=r.index}return x(S(t,o),r)}))},o.string=K,o.succeed=J,o.takeWhile=function(e){return T(e),o((function(t,r){for(var n=r;n<t.length&&e(R(t,n));)n++;return S(n,t.slice(r,n))}))},o.test=te,o.whitespace=pe,o["fantasy-land/empty"]=ne,o["fantasy-land/of"]=J,o.Binary={bitSeq:f,bitSeqObj:function(e){h();var t={},r=0,n=l((function(e){if(w(e)){var n=e;if(2!==n.length)throw new Error("["+n.join(", ")+"] should be length 2, got length "+n.length);if(C(n[0]),_(n[1]),Object.prototype.hasOwnProperty.call(t,n[0]))throw new Error("duplicate key in bitSeqObj: "+n[0]);return t[n[0]]=!0,r++,n}return _(e),[null,e]}),e);if(r<1)throw new Error("bitSeqObj expects at least one named pair, got ["+e.join(", ")+"]");var o=l((function(e){return e[0]}),n);return f(l((function(e){return e[1]}),n)).map((function(e){return s((function(e,t){return null!==t[0]&&(e[t[0]]=t[1]),e}),{},l((function(t,r){return[t,e[r]]}),o))}))},byte:function(e){if(h(),_(e),e>255)throw new Error("Value specified to byte constructor ("+e+"=0x"+e.toString(16)+") is larger in value than a single byte.");var t=(e>15?"0x":"0x0")+e.toString(16);return o((function(r,n){var o=R(r,n);return o===e?S(n+1,o):O(n,t)}))},buffer:function(e){return p("buffer",e).map((function(e){return t.from(e)}))},encodedString:function(e,t){return p("string",t).map((function(t){return t.toString(e)}))},uintBE:g,uint8BE:g(1),uint16BE:g(2),uint32BE:g(4),uintLE:v,uint8LE:v(1),uint16LE:v(2),uint32LE:v(4),intBE:y,int8BE:y(1),int16BE:y(2),int32BE:y(4),intLE:m,int8LE:m(1),int16LE:m(2),int32LE:m(4),floatBE:p("floatBE",4).map((function(e){return e.readFloatBE(0)})),floatLE:p("floatLE",4).map((function(e){return e.readFloatLE(0)})),doubleBE:p("doubleBE",8).map((function(e){return e.readDoubleBE(0)})),doubleLE:p("doubleLE",8).map((function(e){return e.readDoubleLE(0)}))},e.exports=o}])}).call(this,r(40).Buffer)},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.clone=s,t.addLast=u,t.addFirst=c,t.removeLast=h,t.removeFirst=f,t.insert=p,t.removeAt=d,t.replaceAt=g,t.getIn=v,t.set=y,t.setIn=m,t.update=w,t.updateIn=E,t.merge=S,t.mergeDeep=O,t.mergeIn=x,t.omit=A,t.addDefaults=k,t.default=void 0;const n="INVALID_ARGS";function o(e){throw new Error(e)}function i(e){const t=Object.keys(e);return Object.getOwnPropertySymbols?t.concat(Object.getOwnPropertySymbols(e)):t}const a={}.hasOwnProperty;function s(e){if(Array.isArray(e))return e.slice();const t=e,r=i(t),n={};for(let o=0;o<r.length;o++){const e=r[o];n[e]=t[e]}return n}function l(e){return null!=e&&"object"===typeof e}function u(e,t){return Array.isArray(t)?e.concat(t):e.concat([t])}function c(e,t){return Array.isArray(t)?t.concat(e):[t].concat(e)}function h(e){return e.length?e.slice(0,e.length-1):e}function f(e){return e.length?e.slice(1):e}function p(e,t,r){return e.slice(0,t).concat(Array.isArray(r)?r:[r]).concat(e.slice(t))}function d(e,t){return t>=e.length||t<0?e:e.slice(0,t).concat(e.slice(t+1))}function g(e,t,r){if(e[t]===r)return e;const n=e.length,o=Array(n);for(let i=0;i<n;i++)o[i]=e[i];return o[t]=r,o}function v(e,t){if(Array.isArray(t)||o(n),null==e)return;let r=e;for(let n=0;n<t.length;n++){const e=t[n];if(r=null!=r?r[e]:void 0,void 0===r)return r}return r}function y(e,t,r){let n=e;if(null==n&&(n="number"===typeof t?[]:{}),n[t]===r)return n;const o=s(n);return o[t]=r,o}function m(e,t,r){return t.length?b(e,t,r,0):r}function b(e,t,r,n){let o;const i=t[n];if(n===t.length-1)o=r;else{o=b(l(e)&&l(e[i])?e[i]:"number"===typeof t[n+1]?[]:{},t,r,n+1)}return y(e,i,o)}function w(e,t,r){return y(e,t,r(null==e?void 0:e[t]))}function E(e,t,r){return m(e,t,r(v(e,t)))}function S(e,t,r,n,o,i,...a){return a.length?P.call(null,!1,!1,e,t,r,n,o,i,...a):P(!1,!1,e,t,r,n,o,i)}function O(e,t,r,n,o,i,...a){return a.length?P.call(null,!1,!0,e,t,r,n,o,i,...a):P(!1,!0,e,t,r,n,o,i)}function x(e,t,r,n,o,i,a,...s){let l,u=v(e,t);return null==u&&(u={}),l=s.length?P.call(null,!1,!1,u,r,n,o,i,a,...s):P(!1,!1,u,r,n,o,i,a),m(e,t,l)}function A(e,t){const r=Array.isArray(t)?t:[t];let n=!1;for(let i=0;i<r.length;i++)if(a.call(e,r[i])){n=!0;break}if(!n)return e;const o={},s=i(e);for(let i=0;i<s.length;i++){const t=s[i];r.indexOf(t)>=0||(o[t]=e[t])}return o}function k(e,t,r,n,o,i,...a){return a.length?P.call(null,!0,!1,e,t,r,n,o,i,...a):P(!0,!1,e,t,r,n,o,i)}function P(e,t,r,...a){let u=r;null==u&&o(n);let c=!1;for(let n=0;n<a.length;n++){const r=a[n];if(null==r)continue;const o=i(r);if(o.length)for(let n=0;n<=o.length;n++){const i=o[n];if(e&&void 0!==u[i])continue;let a=r[i];t&&l(u[i])&&l(a)&&(a=P(e,t,u[i],a)),void 0!==a&&a!==u[i]&&(c||(c=!0,u=s(u)),u[i]=a)}}return u}var R={clone:s,addLast:u,addFirst:c,removeLast:h,removeFirst:f,insert:p,removeAt:d,replaceAt:g,getIn:v,set:y,setIn:m,update:w,updateIn:E,merge:S,mergeDeep:O,mergeIn:x,omit:A,addDefaults:k};t.default=R},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.toError=t.NestedError=void 0;class n extends Error{constructor(e,...t){super(e);const r=n.getErrorReport(this);if(1===t.length){const e=o(t[0]);this.innerErrors=[e];const i=n.getErrorReport(e);return void(this.stack=`${r}\n\n======= INNER ERROR =======\n\n${i}`)}this.innerErrors=t.map((e=>o(e)));const i=this.innerErrors.map(((e,r)=>{const o=n.getErrorReport(e);return`======= INNER ERROR (${r+1} of ${t.length}) =======\n\n${o}`})).join("\n\n");this.stack=`${r}\n\n${i}`}get innerError(){return 0===this.innerErrors.length?null:this.innerErrors[0]}static rethrow(e){return(...t)=>{throw new this(e,...t)}}}function o(e){try{return e instanceof Error?e:new Error(`Value that is not an instance of Error was thrown: ${e}`)}catch{return new Error("Failed to stringify non-instance of Error that was thrown.This is possibly due to the fact that toString() method of the valuedoesn't return a primitive value.")}}t.NestedError=n,n.getErrorReport="string"===typeof(new Error).stack?e=>e.stack:e=>`${e.name}: ${e.message}`,n.prototype.name="NestedError",t.toError=o},function(e,t,r){r(14),e.exports=r(31)},function(e,t,r){e.exports=r(34)},function(e,t,r){e.exports=function(e,t,r,n,o){for(t=t.split?t.split("."):t,n=0;n<t.length;n++)e=e?e[t[n]]:o;return e===o?r:e}},function(module,exports,__webpack_require__){"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.Parser=exports.findRuleByName=exports.parseRuleName=exports.escapeRegExp=exports.readToken=void 0;const UPPER_SNAKE_RE=/^[A-Z0-9_]+$/,decorationRE=/(\?|\+|\*)$/,preDecorationRE=/^(@|&|!)/,WS_RULE="WS",TokenError_1=__webpack_require__(11);function readToken(e,t){let r=t.exec(e);return r&&0==r.index?0==r[0].length&&t.source.length>0?null:{type:null,text:r[0],rest:e.substr(r[0].length),start:0,end:r[0].length-1,fullText:r[0],errors:[],children:[],parent:null}:null}function escapeRegExp(e){return e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")}function fixRest(e){e.rest="",e.children&&e.children.forEach((e=>fixRest(e)))}function fixPositions(e,t){e.start+=t,e.end+=t,e.children&&e.children.forEach((t=>fixPositions(t,e.start)))}function agregateErrors(e,t){t.errors&&t.errors.length&&t.errors.forEach((t=>e.push(t))),t.children&&t.children.forEach((t=>agregateErrors(e,t)))}function parseRuleName(e){let t=decorationRE.exec(e),r=preDecorationRE.exec(e),n=t&&t[0]||"",o=r&&r[0]||"",i={raw:e,name:e.replace(decorationRE,"").replace(preDecorationRE,""),isOptional:"?"==n||"*"==n,allowRepetition:"+"==n||"*"==n,atLeastOne:"+"==n,lookupPositive:"&"==o,lookupNegative:"!"==o,pinned:"@"==o,lookup:!1,isLiteral:!1};return i.isLiteral="'"==i.name[0]||'"'==i.name[0],i.lookup=i.lookupNegative||i.lookupPositive,i}function findRuleByName(e,t){let r=parseRuleName(e);return t.cachedRules[r.name]||null}function stripRules(e,t){if(e.children){let r=e.children.filter((e=>e.type&&t.test(e.type)));for(let t=0;t<r.length;t++){let n=e.children.indexOf(r[t]);-1!=n&&e.children.splice(n,1)}e.children.forEach((e=>stripRules(e,t)))}}exports.readToken=readToken,exports.escapeRegExp=escapeRegExp,exports.parseRuleName=parseRuleName,exports.findRuleByName=findRuleByName;const ignoreMissingRules=["EOF"];class Parser{constructor(e,t){this.grammarRules=e,this.options=t,this.cachedRules={},this.debug=!!t&&!0===t.debug;let r=[],n=[];if(e.forEach((e=>{let t=parseRuleName(e.name);if(t.name in this.cachedRules)r.push("Duplicated rule "+t.name);else{if(this.cachedRules[t.name]=e,e.bnf&&e.bnf.length)e.bnf.forEach((t=>{if("string"===typeof t[0]){if(parseRuleName(t[0]).name==e.name){let t="Left recursion is not allowed, rule: "+e.name;-1==r.indexOf(t)&&r.push(t)}}t.forEach((e=>{if("string"==typeof e){let t=parseRuleName(e);t.isLiteral||-1!=n.indexOf(t.name)||-1!=ignoreMissingRules.indexOf(t.name)||n.push(t.name)}}))}));else{let t="Missing rule content, rule: "+e.name;-1==r.indexOf(t)&&r.push(t)}WS_RULE==e.name&&(e.implicitWs=!1),e.implicitWs&&-1==n.indexOf(WS_RULE)&&n.push(WS_RULE),e.recover&&-1==n.indexOf(e.recover)&&n.push(e.recover)}})),n.forEach((e=>{e in this.cachedRules||r.push("Missing rule "+e)})),r.length)throw new Error(r.join("\n"))}getAST(e,t){t||(t=this.grammarRules.filter((e=>!e.fragment&&0!=e.name.indexOf("%")))[0].name);let r=this.parse(e,t);if(r){agregateErrors(r.errors,r),fixPositions(r,0),stripRules(r,/^%/),this.options&&this.options.keepUpperRules||stripRules(r,UPPER_SNAKE_RE);let e=r.rest;e&&new TokenError_1.TokenError("Unexpected end of input: \n"+e,r),fixRest(r),r.rest=e}return r}emitSource(){return"CANNOT EMIT SOURCE FROM BASE Parser"}parse(txt,target,recursion=0){let out=null,type=parseRuleName(target),expr,printable=this.debug&&!UPPER_SNAKE_RE.test(type.name);printable&&console.log(new Array(recursion).join("\u2502 ")+"Trying to get "+target+" from "+JSON.stringify(txt.split("\n")[0]));let realType=type.name,targetLex=findRuleByName(type.name,this);if("EOF"==type.name){if(txt.length)return null;if(0==txt.length)return{type:"EOF",text:"",rest:"",start:0,end:0,fullText:"",errors:[],children:[],parent:null}}try{if(!targetLex&&type.isLiteral){let src=eval(type.name);if(""===src)return{type:"%%EMPTY%%",text:"",rest:txt,start:0,end:0,fullText:"",errors:[],children:[],parent:null};expr=new RegExp(escapeRegExp(src)),realType=null}}catch(e){return e instanceof ReferenceError&&console.error(e),null}if(expr){let e=readToken(txt,expr);if(e)return e.type=realType,e}else{let e=targetLex.bnf;e instanceof Array&&e.forEach((e=>{if(out)return;let t=null,r={type:type.name,text:"",children:[],end:0,errors:[],fullText:"",parent:null,start:0,rest:txt};targetLex.fragment&&(r.fragment=!0);let n=txt,o=0,i=e.length>0,a=!1;for(let s=0;s<e.length;s++)if("string"==typeof e[s]){let l,u=parseRuleName(e[s]);i=i&&u.isOptional;let c=!1;do{if(l=null,targetLex.implicitWs&&(l=this.parse(n,u.name,recursion+1),!l)){let e;do{if(e=this.parse(n,WS_RULE,recursion+1),!e)break;r.text=r.text+e.text,r.end=r.text.length,e.parent=r,r.children.push(e),n=n.substr(e.text.length),o+=e.text.length}while(e&&e.text.length)}if(l=l||this.parse(n,u.name,recursion+1),u.lookupNegative){if(l)return;break}if(u.lookupPositive&&!l)return;if(!l){if(u.isOptional)break;if(u.atLeastOne&&c)break}if(l&&targetLex.pinned==s+1&&(t=l,printable&&console.log(new Array(recursion+1).join("\u2502 ")+"\u2514\u2500 "+l.type+" PINNED")),l||(l=this.parseRecovery(targetLex,n,recursion+1)),!l){if(!t)return;out=r,l={type:"SyntaxError",text:n,children:[],end:n.length,errors:[],fullText:"",parent:null,start:0,rest:""},n.length?new TokenError_1.TokenError(`Unexpected end of input. Expecting ${u.name} Got: ${n}`,l):new TokenError_1.TokenError(`Unexpected end of input. Missing ${u.name}`,l),printable&&console.log(new Array(recursion+1).join("\u2502 ")+"\u2514\u2500 "+l.type+" "+JSON.stringify(l.text))}if(c=!0,a=!0,"%%EMPTY%%"==l.type)break;l.start+=o,l.end+=o,!u.lookupPositive&&l.type&&(l.fragment?l.children&&l.children.forEach((e=>{e.start+=o,e.end+=o,e.parent=r,r.children.push(e)})):(l.parent=r,r.children.push(l))),u.lookup&&(l.lookup=!0),printable&&console.log(new Array(recursion+1).join("\u2502 ")+"\u2514\u2500 "+l.type+" "+JSON.stringify(l.text)),u.lookup||l.lookup||(r.text=r.text+l.text,r.end=r.text.length,n=n.substr(l.text.length),o+=l.text.length),r.rest=n}while(l&&u.allowRepetition&&n.length&&!l.lookup)}else{let t=readToken(n,e[s]);if(!t)return;printable&&console.log(new Array(recursion+1).join("\u2502 ")+"\u2514> "+JSON.stringify(t.text)+e[s].source),a=!0,t.start+=o,t.end+=o,r.text=r.text+t.text,r.end=r.text.length,n=n.substr(t.text.length),o+=t.text.length,r.rest=n}a&&(out=r,printable&&console.log(new Array(recursion).join("\u2502 ")+"\u251c<\u2500\u2534< PUSHING "+out.type+" "+JSON.stringify(out.text)))})),out&&targetLex.simplifyWhenOneChildren&&1==out.children.length&&(out=out.children[0])}return out||printable&&console.log(target+" NOT RESOLVED FROM "+txt),out}parseRecovery(e,t,r){if(e.recover&&t.length){let n=this.debug;n&&console.log(new Array(r+1).join("\u2502 ")+"Trying to recover until token "+e.recover+" from "+JSON.stringify(t.split("\n")[0]+t.split("\n")[1]));let o,i={type:"SyntaxError",text:"",children:[],end:0,errors:[],fullText:"",parent:null,start:0,rest:""};do{if(o=this.parse(t,e.recover,r+1),o){new TokenError_1.TokenError('Unexpected input: "'+i.text+`" Expecting: ${e.name}`,i);break}i.text=i.text+t[0],i.end=i.text.length,t=t.substr(1)}while(!o&&t.length>0);if(i.text.length>0&&o)return n&&console.log(new Array(r+1).join("\u2502 ")+"Recovered text: "+JSON.stringify(i.text)),i}return null}}exports.Parser=Parser,exports.default=Parser},function(e,t,r){"use strict";r.d(t,"a",(function(){return i}));var n=Object.prototype.hasOwnProperty;function o(e,t,r){for(r of e.keys())if(i(r,t))return r}function i(e,t){var r,a,s;if(e===t)return!0;if(e&&t&&(r=e.constructor)===t.constructor){if(r===Date)return e.getTime()===t.getTime();if(r===RegExp)return e.toString()===t.toString();if(r===Array){if((a=e.length)===t.length)for(;a--&&i(e[a],t[a]););return-1===a}if(r===Set){if(e.size!==t.size)return!1;for(a of e){if((s=a)&&"object"===typeof s&&!(s=o(t,s)))return!1;if(!t.has(s))return!1}return!0}if(r===Map){if(e.size!==t.size)return!1;for(a of e){if((s=a[0])&&"object"===typeof s&&!(s=o(t,s)))return!1;if(!i(a[1],t.get(s)))return!1}return!0}if(r===ArrayBuffer)e=new Uint8Array(e),t=new Uint8Array(t);else if(r===DataView){if((a=e.byteLength)===t.byteLength)for(;a--&&e.getInt8(a)===t.getInt8(a););return-1===a}if(ArrayBuffer.isView(e)){if((a=e.byteLength)===t.byteLength)for(;a--&&e[a]===t[a];);return-1===a}if(!r||"object"===typeof e){for(r in a=0,e){if(n.call(e,r)&&++a&&!n.call(t,r))return!1;if(!(r in t)||!i(e[r],t[r]))return!1}return Object.keys(t).length===a}}return e!==e&&t!==t}},function(e,t,r){r(26),e.exports=r(15)},function(e,t){e.exports=function(e,t,r){var n="";if(n+=e.name||"Error",n+=": "+(e.message||""),r instanceof Array)for(var o in r){n+="\n # "+r[o]}for(var i in t){n+="\n at "+t[i].toString()}return n}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TokenError=void 0;class n extends Error{constructor(e,t){if(super(e),this.message=e,this.token=t,!t||!t.errors)throw this;t.errors.push(this)}inspect(){return"SyntaxError: "+this.message}}t.TokenError=n},function(e,t,r){"use strict";function n(e,t){for(var r,o=0,i=e.length;o<i;o++)r=e[o],Array.isArray(r)?n(r,t):t.push(r);return t}e.exports=function(e){return n(e,[])}},function(e,t,r){"use strict";e.exports=()=>{const e={};return e.promise=new Promise(((t,r)=>{e.resolve=t,e.reject=r})),e}},function(e,t,r){r(9).check("es5")},function(e,t,r){var n=new(r(27)),o=function(e){return n.test(e)};o.define=function(e,t){n.define(e,t)},o.check=function(e){n.check(e)},o.test=o,e.exports=o},function(e,t,r){"use strict";r.r(t),r.d(t,"ApplicabilityPlugin",(function(){return jr})),r.d(t,"AssetTransformCorePlugin",(function(){return jn})),r.d(t,"BINDING_BRACKETS_REGEX",(function(){return le})),r.d(t,"BindingInstance",(function(){return q})),r.d(t,"BindingParser",(function(){return he})),r.d(t,"Builder",(function(){return qr})),r.d(t,"ConsoleLogger",(function(){return ct})),r.d(t,"ConstantsController",(function(){return zn})),r.d(t,"DataController",(function(){return Ln})),r.d(t,"DependencyMiddleware",(function(){return pe})),r.d(t,"DependencyModel",(function(){return de})),r.d(t,"DependencyTracker",(function(){return fe})),r.d(t,"EMPTY_NODE",(function(){return rr})),r.d(t,"ExpNodeOpaqueIdentifier",(function(){return Oe})),r.d(t,"ExpressionEvaluator",(function(){return lt})),r.d(t,"FlowController",(function(){return rn})),r.d(t,"FlowExpPlugin",(function(){return Wn})),r.d(t,"FlowInstance",(function(){return en})),r.d(t,"LocalModel",(function(){return Se})),r.d(t,"LocalStateStore",(function(){return Tn})),r.d(t,"NOOPDataModel",(function(){return ge})),r.d(t,"NOOP_MODEL",(function(){return ve})),r.d(t,"NOT_STARTED_STATE",(function(){return qn})),r.d(t,"NodeType",(function(){return Ut})),r.d(t,"NoopLogger",(function(){return ft})),r.d(t,"Parser",(function(){return nr})),r.d(t,"PipelinedDataModel",(function(){return Ee})),r.d(t,"Player",(function(){return no})),r.d(t,"ProxyLogger",(function(){return dt})),r.d(t,"ROOT_BINDING",(function(){return ye})),r.d(t,"Resolver",(function(){return Or})),r.d(t,"SCHEMA_VALIDATION_PROVIDER_NAME",(function(){return An})),r.d(t,"SIMPLE_BINDING_REGEX",(function(){return se})),r.d(t,"SchemaController",(function(){return At})),r.d(t,"StringResolverPlugin",(function(){return Cr})),r.d(t,"SwitchPlugin",(function(){return Br})),r.d(t,"TapableLogger",(function(){return pt})),r.d(t,"TemplatePlugin",(function(){return xr})),r.d(t,"VALIDATION_PROVIDER_NAME_SYMBOL",(function(){return Pn})),r.d(t,"VIEW_VALIDATION_PROVIDER_NAME",(function(){return kn})),r.d(t,"ValidationBindingTrackerViewPlugin",(function(){return gn})),r.d(t,"ValidationController",(function(){return _n})),r.d(t,"ValidationMiddleware",(function(){return Ht})),r.d(t,"ValidatorRegistry",(function(){return zt})),r.d(t,"ViewController",(function(){return Nn})),r.d(t,"ViewInstance",(function(){return Yr})),r.d(t,"caresAboutDataChanges",(function(){return hr})),r.d(t,"constructModelForPipeline",(function(){return we})),r.d(t,"findClosestNodeAtPosition",(function(){return qe})),r.d(t,"findInArray",(function(){return Y})),r.d(t,"findNextExp",(function(){return Rt})),r.d(t,"getBindingSegments",(function(){return W})),r.d(t,"getNodeID",(function(){return Yt})),r.d(t,"hasAsync",(function(){return Wt})),r.d(t,"isBinding",(function(){return H})),r.d(t,"isExpressionNode",(function(){return xe})),r.d(t,"isObjectExpression",(function(){return Ge})),r.d(t,"maybeConvertToNum",(function(){return z})),r.d(t,"parse",(function(){return xt})),r.d(t,"parseExpression",(function(){return He})),r.d(t,"removeBindingAndChildrenFromMap",(function(){return Nt})),r.d(t,"resolveDataRefs",(function(){return jt})),r.d(t,"resolveDataRefsInString",(function(){return Tt})),r.d(t,"resolveExpressionsInString",(function(){return _t})),r.d(t,"severities",(function(){return ut})),r.d(t,"toModel",(function(){return be})),r.d(t,"toNodeResolveOptions",(function(){return fr})),r.d(t,"unpackAndPush",(function(){return pr})),r.d(t,"withParser",(function(){return me})),r.d(t,"withoutContext",(function(){return Ye}));var n=r(17);for(var o in n)["default","ApplicabilityPlugin","AssetTransformCorePlugin","BINDING_BRACKETS_REGEX","BindingInstance","BindingParser","Builder","ConsoleLogger","ConstantsController","DataController","DependencyMiddleware","DependencyModel","DependencyTracker","EMPTY_NODE","ExpNodeOpaqueIdentifier","ExpressionEvaluator","FlowController","FlowExpPlugin","FlowInstance","LocalModel","LocalStateStore","NOOPDataModel","NOOP_MODEL","NOT_STARTED_STATE","NodeType","NoopLogger","Parser","PipelinedDataModel","Player","ProxyLogger","ROOT_BINDING","Resolver","SCHEMA_VALIDATION_PROVIDER_NAME","SIMPLE_BINDING_REGEX","SchemaController","StringResolverPlugin","SwitchPlugin","TapableLogger","TemplatePlugin","VALIDATION_PROVIDER_NAME_SYMBOL","VIEW_VALIDATION_PROVIDER_NAME","ValidationBindingTrackerViewPlugin","ValidationController","ValidationMiddleware","ValidatorRegistry","ViewController","ViewInstance","caresAboutDataChanges","constructModelForPipeline","findClosestNodeAtPosition","findInArray","findNextExp","getBindingSegments","getNodeID","hasAsync","isBinding","isExpressionNode","isObjectExpression","maybeConvertToNum","parse","parseExpression","removeBindingAndChildrenFromMap","resolveDataRefs","resolveDataRefsInString","resolveExpressionsInString","severities","toModel","toNodeResolveOptions","unpackAndPush","withParser","withoutContext"].indexOf(o)<0&&function(e){r.d(t,e,(function(){return n[e]}))}(o);var i=r(0),a=r(3),s=r(12),l=r.n(s),u=r(1),c=r.n(u),h=r(19),f=r(6),p=r.n(f),d=r(2),g=r(8),v=r(13),y=r.n(v),m=r(20),b=r.n(m),w=r(21);const E=e=>({name:"Value",value:e}),S=e=>({name:"Expression",value:e}),O=e=>({name:"PathNode",path:e}),x=(e,t)=>({name:"Query",key:e,value:t}),A=e=>1===e.length?e[0]:{name:"Concatenated",value:e},k=c.a.string('"'),P=c.a.string("'"),R=c.a.string("`"),_=c.a.regex(/[\w\-@]+/).desc("identifier").map(E);let T;const C=c.a.lazy((()=>T)).trim(c.a.optWhitespace).wrap(c.a.string("{{"),c.a.string("}}")).map(O),j=c.a.regex(/[^`]*/).wrap(R,R).map(S),N=c.a.alt(_,C,j).atLeast(1).map(l.a).map(A),U=c.a.alt(c.a.regex(/[^"]*/).wrap(k,k).map(E),c.a.regex(/[^']*/).wrap(P,P).map(E),N),L=c.a.seq(U,c.a.string("=").times(1,3).trim(c.a.optWhitespace),U).map((([e,,t])=>x(e,t))),B=c.a.alt(L,U).trim(c.a.optWhitespace).wrap(c.a.string("["),c.a.string("]")).many(),I=c.a.seqMap(N,B,((e,t)=>[e,...t]));T=c.a.sepBy(I,c.a.string(".")).map(l.a),new h.Grammars.W3C.Parser('\nvalue ::= segment_and_bracket (SEGMENT_SEPARATOR segment_and_bracket)*\nsegment ::= concatenated | expression | modelRef | identifier \nconcatenated ::= (expression | modelRef | identifier)+ \nmodelRef ::= OPEN_CURL OPEN_CURL value CLOSE_CURL CLOSE_CURL \nidentifier ::= [\\w\\-@]+\nquery ::= WHITESPACE* optionally_quoted_segment WHITESPACE* EQUALS EQUALS? EQUALS? WHITESPACE* optionally_quoted_segment WHITESPACE*\nbrackets ::= OPEN_BRACKET WHITESPACE* (query | optionally_quoted_segment) WHITESPACE* CLOSE_BRACKET \nsegment_and_bracket ::= segment brackets*\nquoted_value ::= [^"\']*\noptionally_quoted_segment ::= WHITESPACE* SINGLE_QUOTE quoted_value SINGLE_QUOTE WHITESPACE* | WHITESPACE* DOUBLE_QUOTE quoted_value DOUBLE_QUOTE WHITESPACE* | WHITESPACE* segment WHITESPACE*\nexpression_value ::= [^`]*\nexpression ::= BACK_TICK expression_value BACK_TICK\n\nEQUALS ::= "="\nSEGMENT_SEPARATOR ::= "."\nSINGLE_QUOTE ::= "\'"\nDOUBLE_QUOTE ::= \'"\'\nWHITESPACE ::= " "\nOPEN_CURL ::= "{"\nCLOSE_CURL ::= "}" \nOPEN_BRACKET ::= "[" \nCLOSE_BRACKET ::= "]"\nBACK_TICK ::= "`" \n');const D="{",M="'",V="`",F=e=>{if(!e)return!1;const t=e.charCodeAt(0);return!(32===t||34===t||39===t||40===t||41===t||42===t||46===t||61===t||91===t||93===t||96===t||123===t||125===t)},$=e=>{let t=1,r=e.charAt(0);const n=n=>{if(n&&r!==n)throw new Error(`Expected char: ${n} but got: ${r}`);return r=e.charAt(t),t+=1,r},o=()=>{for(;" "===r;)n()},i=()=>{var e,t;return null!=(t=null!=(e=(()=>{if(r===D&&(n(D),r===D)){n(D);const e=u();return n("}"),n("}"),e}})())?e:(()=>{if(r===V){n(V);let e=r;for(;n()&&r!==V;)e+=r;if(n(V),e)return S(e)}})())?t:(()=>{if(!F(r))return;let e=r;for(;n()&&F(r);)e+=r;return e?E(e):void 0})()},a=()=>{if(o(),r===M||'"'===r){const e=r===M;n(e?M:'"');const t=(e=>{if(!(null==r?void 0:r.match(e)))return;let t=r;for(;n()&&(null==r?void 0:r.match(e));)t+=r;return t?E(t):void 0})(/[^'"]+/);return n(e?M:'"'),t}return i()},s=()=>{if("["===r){n("["),o();let e=a();if(!e)throw new Error("Expected identifier");if(o(),(()=>{if("="!==r)return!1;for(;"="===r;)n();return!0})()){o();const t=a();e=x(e,t),o()}return e&&n("]"),e}},l=()=>{const e=[],t=(()=>{const e=[];let t=i();for(;void 0!==t;)e.push(t),t=i();if(0!==e.length)return A(e)})();if(t){e.push(t);let r=s();for(;void 0!==r;)e.push(r),r=s()}return e},u=()=>{const e=[];let t=l();for(;void 0!==t&&(e.push(...t),r&&"}"!==r);){if(0===t.length&&r)throw new Error(`Unexpected character: ${r}`);n("."),t=l()}return O(e)};try{return{status:!0,path:u()}}catch(c){return{status:!1,error:c.message}}};function H(e){return!("string"===typeof e||Array.isArray(e))}function z(e){const t=parseInt(e,10);return isNaN(t)?e:t}function W(e){return Array.isArray(e)?e:"string"===typeof e?e.split("."):e.asArray()}function Y(e,t,r){return e.findIndex((e=>!(!e||"object"!==typeof e)&&e[t]==r))}class q{constructor(e,t=(e=>new q(e))){const r=Array.isArray(e)?e:e.split(".");this.split=r.map((e=>{if("number"===typeof e)return e;const t=Number(e);return isNaN(t)?e:t})),Object.freeze(this.split),this.joined=this.split.join("."),this.factory=t}asArray(){return this.split}asString(){return this.joined}contains(e){const t=e.asArray();if(t.length<this.split.length)return!1;for(let r=0;r<this.split.length;r++)if(this.split[r]!==t[r])return!1;return!0}relative(e){return this.asArray().slice(e.asArray().length)}parent(){return this.factory(this.split.slice(0,-1))}key(){return this.split[this.split.length-1]}descendent(e){const t=W(e);return this.factory(this.split.concat(t))}}var G=Object.defineProperty,K=Object.getOwnPropertySymbols,Z=Object.prototype.hasOwnProperty,J=Object.prototype.propertyIsEnumerable,Q=(e,t,r)=>t in e?G(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,X=(e,t)=>{for(var r in t||(t={}))Z.call(t,r)&&Q(e,r,t[r]);if(K)for(var r of K(t))J.call(t,r)&&Q(e,r,t[r]);return e};function ee(e,t,r){var n;const o={updates:{},path:[]};function i(e){if("Value"===e.name)return e.value;if("PathNode"===e.name){const n=ee(e,t);n.updates&&(o.updates=X(X({},o.updates),n.updates));try{return t.convertToPath(t.getValue(n.path))}catch(r){throw new a.NestedError(`Unable to resolve path segment: ${n.path}`,r)}}if("Expression"===e.name)try{const r=t.evaluate(e.value);return t.convertToPath(r)}catch(r){throw new a.NestedError(`Unable to resolve path: ${e.value}`,r)}throw new Error(`Unable to resolve value for node: ${e.name}`)}function s(e){"string"===typeof e&&e.indexOf(".")>-1?e.split(".").forEach((e=>{o.path.push(z(e))})):o.path.push(e)}return e.path.forEach((function(e){var n,a;const l=null!=(n=null==r?void 0:r.beforeResolveNode.call(e,X(X({},o),t)))?n:e;switch(l.name){case"Expression":case"PathNode":s(i(l));break;case"Value":s(l.value);break;case"Query":{const e=null!=(a=t.getValue(o.path))?a:[],{key:r,value:n}=l,s=i(r),u=n&&i(n),c=Y(e,s,u);void 0===c||-1===c?(o.updates[[...o.path,e.length,s].join(".")]=u,o.path.push(e.length)):o.path.push(c);break}case"Concatenated":o.path.push(l.value.map(i).join(""));break;default:throw new Error(`Unsupported node type: ${l.name}`)}})),{path:o.path,updates:Object.keys(null!=(n=o.updates)?n:{}).length>0?o.updates:void 0}}var te=Object.defineProperty,re=Object.getOwnPropertySymbols,ne=Object.prototype.hasOwnProperty,oe=Object.prototype.propertyIsEnumerable,ie=(e,t,r)=>t in e?te(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,ae=(e,t)=>{for(var r in t||(t={}))ne.call(t,r)&&ie(e,r,t[r]);if(re)for(var r of re(t))oe.call(t,r)&&ie(e,r,t[r]);return e};const se=/^[\w\-@]+(\.[\w\-@]+)*$/,le=/[\s()*=`{}'"[\]]/,ue=/^[^.]+(\..+)*$/,ce={get:()=>{throw new Error("Not Implemented")},set:()=>{throw new Error("Not Implemented")},evaluate:()=>{throw new Error("Not Implemented")}};class he{constructor(e){this.hooks={skipOptimization:new i.a,beforeResolveNode:new i.c},this.parserOptions=ae(ae({},ce),e),this.cache={},this.parseCache={},this.parse=this.parse.bind(this)}normalizePath(e,t){var r,n;if(!le.test(e)&&ue.test(e)&&!0!==this.hooks.skipOptimization.call(e))return{path:e.split("."),updates:void 0};const o=null!=(r=this.parseCache[e])?r:$(e);if(this.parseCache[e]=o,"object"!==typeof o||!(null==o?void 0:o.status))throw new TypeError(`Cannot normalize path "${e}": ${null!=(n=null==o?void 0:o.error)?n:"Unknown Error."}`);try{return ee(o.path,t,this.hooks)}catch(i){throw new a.NestedError(`Cannot resolve binding: ${e}`,i)}}getBindingForNormalizedResult(e){const t=e.path.join(".");if(this.cache[t])return this.cache[t];const r=new q(""===t?[]:e.path,this.parse);return this.cache[t]=r,r}parse(e,t={}){if(H(e))return e;const r=ae(ae({},this.parserOptions),t);let n={};const o=Array.isArray(e)?e.join("."):String(e),i={getValue:e=>{const t=this.normalizePath(e.join("."),i);return r.get(this.getBindingForNormalizedResult(t))},evaluate:e=>r.evaluate(e),convertToPath:e=>{if(void 0===e)throw new Error("Attempted to convert undefined value to binding path");if("string"!==typeof e&&"number"!==typeof e&&"boolean"!==typeof e)throw new Error(`Attempting to convert ${typeof e} to a binding path.`);const t=this.normalizePath(String(e),i);t.updates&&(n=ae(ae({},n),t.updates));const r=t.path.join(".");if(""===r)throw new Error("Nested path resolved to an empty path");return r}},a=this.normalizePath(o,i);a.updates&&(n=ae(ae({},n),a.updates));const s=Object.keys(n);if(!r.readOnly&&s.length>0){const e=s.map((e=>[this.parse(e),n[e]]));r.set(e)}return this.getBindingForNormalizedResult(a)}}class fe{constructor(){this.readDeps=new Set,this.writeDeps=new Set,this.namedDependencySets={},this.namedSet="core",this.createSubset("core"),this.createSubset("children")}createSubset(e,t=!1){!t&&this.namedDependencySets[e]||(this.namedDependencySets[e]={readDeps:new Set,writeDeps:new Set})}getDependencies(e){var t,r,n;return void 0!==e?null!=(n=null==(r=null==(t=this.namedDependencySets)?void 0:t[e])?void 0:r.readDeps)?n:new Set:this.readDeps}trackSubset(e){this.createSubset(e),this.namedSet=e}trackDefault(){this.namedSet="core"}getModified(e){var t,r,n;return void 0!==e?null!=(n=null==(r=null==(t=this.namedDependencySets)?void 0:t[e])?void 0:r.writeDeps)?n:new Set:this.writeDeps}readsBinding(e){return this.readDeps.has(e)}writesBinding(e){return this.writeDeps.has(e)}reset(){this.readDeps=new Set,this.writeDeps=new Set,this.namedDependencySets={},this.namedSet="core",this.createSubset("core",!0),this.createSubset("children",!0)}addReadDep(e,t=this.namedSet){var r,n;t&&(null==(n=null==(r=this.namedDependencySets)?void 0:r[t])||n.readDeps.add(e)),this.readDeps.add(e)}addWriteDep(e,t=this.namedSet){var r,n;t&&(null==(n=null==(r=this.namedDependencySets)?void 0:r[t])||n.writeDeps.add(e)),this.writeDeps.add(e)}addChildReadDep(e){this.addReadDep(e,"children")}}class pe extends fe{constructor(){super(),this.get=this.get.bind(this),this.set=this.set.bind(this)}set(e,t,r){var n;return e.forEach((([e])=>this.addWriteDep(e))),null!=(n=null==r?void 0:r.set(e,t))?n:[]}get(e,t,r){return this.addReadDep(e),null==r?void 0:r.get(e,t)}delete(e,t,r){return this.addWriteDep(e),null==r?void 0:r.delete(e,t)}}class de extends fe{constructor(e){super(),this.rootModel=e,this.set=this.set.bind(this),this.get=this.get.bind(this)}set(e,t){return e.forEach((([e])=>this.addWriteDep(e))),this.rootModel.set(e,t)}get(e,t){return this.addReadDep(e),this.rootModel.get(e,t)}delete(e,t){return this.addWriteDep(e),this.rootModel.delete(e,t)}}class ge{get(){}set(){return[]}delete(){}}const ve=new ge,ye=new q([]);function me(e,t){function r(r,n){const o=H(r)?r:t(r,{get:e.get,set:e.set,readOnly:n});if(!o)throw new Error("Unable to parse binding");return o}return{get:(t,n)=>e.get(r(t,!0),n),set:(t,n)=>e.set(t.map((([e,t])=>[r(e,!1),t])),n),delete:(t,n)=>e.delete(r(t,!1),n)}}function be(e,t,r){return r?{get:(n,o)=>{const i=null!=o?o:t;return e.get?e.get(n,i,r):null==r?void 0:r.get(n,i)},set:(n,o)=>{const i=null!=o?o:t;return e.set?e.set(n,i,r):null==r?void 0:r.set(n,i)},delete:(n,o)=>{const i=null!=o?o:t;return e.delete?e.delete(n,i,r):null==r?void 0:r.delete(n,i)}}:e}function we(e){if(0===e.length)return ve;if(1===e.length)return be(e[0]);function t(t){var r;return null!=(r=e.reduce(((e,r)=>be(r,t,e)),void 0))?r:ve}return{get:(e,r)=>{var n;return null==(n=t(r))?void 0:n.get(e,r)},set:(e,r)=>{var n;return null==(n=t(r))?void 0:n.set(e,r)},delete:(e,r)=>{var n;return null==(n=t(r))?void 0:n.delete(e,r)}}}class Ee{constructor(e=[]){this.hooks={onSet:new i.b},this.pipeline=e,this.effectiveDataModel=we(this.pipeline)}setMiddleware(e){this.pipeline=e,this.effectiveDataModel=we(e)}addMiddleware(e){this.pipeline=[...this.pipeline,e],this.effectiveDataModel=we(this.pipeline)}reset(e={}){this.pipeline.forEach((e=>{var t;"reset"in e&&(null==(t=e.reset)||t.call(e))})),this.set([[ye,e]])}set(e,t){const r=this.effectiveDataModel.set(e,t);return this.hooks.onSet.call(e),r}get(e,t){return this.effectiveDataModel.get(e,t)}delete(e,t){return this.effectiveDataModel.delete(e,t)}}class Se{constructor(e={}){this.model=e,this.get=this.get.bind(this),this.set=this.set.bind(this)}reset(e={}){this.model=e}get(e){return e&&e.asString()?p()(this.model,e.asArray()):this.model}set(e){const t=[];return e.forEach((([e,r])=>{const n=this.get(e);this.model=Object(d.setIn)(this.model,e.asArray(),r),t.push({binding:e,oldValue:n,newValue:r})})),t}delete(e){const t=e.parent();if(t){const r=this.get(t);void 0!==r&&(Array.isArray(r)?this.model=Object(d.setIn)(this.model,t.asArray(),Object(d.removeAt)(r,e.key())):this.model=Object(d.setIn)(this.model,t.asArray(),Object(d.omit)(r,e.key())))}}}const Oe=Symbol("Expression Node ID");function xe(e){return"object"===typeof e&&null!==e&&!Array.isArray(e)&&e.__id===Oe}const Ae=46,ke=40,Pe=123,Re=125,_e=!0,Te={"-":_e,"!":_e,"~":_e,"+":_e},Ce={"=":3,"+=":3,"-=":3,"&=":3,"|=":3,"||":5,"&&":6,"|":7,"^":8,"&":9,"==":10,"!=":10,"===":10,"!==":10,"<":11,">":11,"<=":11,">=":11,"<<":12,">>":12,">>>":12,"+":13,"-":13,"*":14,"/":14,"%":14};function je(e,t){const r=new Error(`${e} at character ${t}`);throw r.index=t,r.description=e,r}function Ne(e,t){if(e&&t)return{start:e.start,end:t.end}}function Ue(e){let t=0;return Object.keys(e).forEach((r=>{r.length>t&&Object.prototype.hasOwnProperty.call(e,r)&&(t=r.length)})),t}const Le=Ue(Te),Be=Ue(Ce),Ie={true:!0,false:!1,null:null,undefined:void 0};function De(e){return Ce[e]||0}function Me(e,t,r,n){let o;return o="||"===e||"&&"===e?"LogicalExpression":"="===e?"Assignment":"+="===e||"-="===e||"&="===e||"|="===e?"Modification":"BinaryExpression",{__id:Oe,type:o,operator:e,left:t,right:r,location:n}}function Ve(e){return e>=48&&e<=57}function Fe(e){return 36===e||95===e||e>=65&&e<=90||e>=97&&e<=122}function $e(e){return 36===e||95===e||e>=65&&e<=90||e>=97&&e<=122||e>=48&&e<=57}function He(e,t){var r;const n=null==(r=null==t?void 0:t.strict)||r,o=e.charAt,i=e.charCodeAt,{length:a}=e;let s=0;const l=e=>({start:{character:e},end:{character:s}});function u(t){return o.call(e,t)}function c(t){return i.call(e,t)}function h(){let e=c(s);for(;32===e||9===e;)e=c(++s)}function f(){const e=function(){let e,t,r,n=d(),o=p();if(!o)return n;let i={value:o,prec:De(o)},a=d();a||je(`Expected expression after ${o}`,s);const l=[n,i,a];o=p();for(;o&&(t=De(o),0!==t);){for(i={value:o,prec:t};l.length>2&&t<=l[l.length-2].prec;)a=l.pop(),o=l.pop().value,n=l.pop(),e=Me(o,n,a,Ne(n.location,a.location)),l.push(e);e=d(),e||je(`Expected expression after ${o}`,s),l.push(i,e),o=p()}r=l.length-1,e=l[r];for(;r>1;)e=Me(l[r-1].value,l[r-2],e,Ne(l[r-2].location,e.location)),r-=2;return e}();h();const t=s;if(s<a&&63===c(s)){s++;const r=f();if(r||je("Expected expression",s),h(),58===c(s)){s++;const n=f();return n||je("Expected expression",s),{__id:Oe,type:"ConditionalExpression",test:e,consequent:r,alternate:n,location:l(t)}}je("Expected :",s)}return e}function p(){h();let t=e.substr(s,Be),r=t.length;for(;r>0;){if(Object.prototype.hasOwnProperty.call(Ce,t))return s+=r,t;t=t.substr(0,--r)}return!1}function d(){h();const t=c(s),r=s;if(Ve(t)||46===t)return function(){let e="";const t=s;for(;Ve(c(s));)e+=u(s++);if(c(s)===Ae)for(e+=u(s++);Ve(c(s));)e+=u(s++);let r=u(s);if("e"===r||"E"===r){for(e+=u(s++),r=u(s),"+"!==r&&"-"!==r||(e+=u(s++));Ve(c(s));)e+=u(s++);Ve(c(s-1))||je(`Expected exponent (${e}${u(s)})`,s)}const n=c(s);Fe(n)?je(`Variable names cannot start with a number (${e}${u(s)})`,s):n===Ae&&je("Unexpected period",s);return{__id:Oe,type:"Literal",value:parseFloat(e),raw:e,location:l(t)}}();if(39===t||34===t)return g();if(Fe(t)||40===t)return function(){let e=c(s),t=e===ke?function(){s++;const e=f();if(h(),41===c(s))return s++,e;je("Unclosed (",s)}():v();const r=s;h(),e=c(s);for(;e===Ae||91===e||e===ke;)s++,e===Ae?(h(),t={__id:Oe,type:"MemberExpression",computed:!1,object:t,property:v(),location:l(r)}):91===e?(t={__id:Oe,type:"MemberExpression",computed:!0,object:t,property:f(),location:l(r)},h(),e=c(s),93!==e&&je("Unclosed [",s),s++):e===ke&&(t={__id:Oe,type:"CallExpression",args:y(41),callTarget:t,location:l(r)}),h(),e=c(s);return t}();if(91===t)return function(){const e=s;return s++,{__id:Oe,type:"ArrayExpression",elements:y(93),location:l(e)}}();if(n=t,o=c(s+1),n===Pe&&o===Pe)return function(){let e="",t=!1,r=1;const n=s;s+=2;for(;s<a;){const n=u(s++);if("}"===n&&c(s)===Re){if(s++,r--,0===r){t=!0;break}e+="}}"}else"{"===n&&c(s)===Pe?(r++,e+="{{",s++):e+=n}t||je(`Unclosed brace after "${e}"`,s);return{__id:Oe,type:"ModelRef",ref:e,location:l(n)}}();var n,o;if(t===Pe)return function(){const e=[];let t,r,n,o=!1,i=!0;const u=s;for(++s;s<a;){if(h(),n=c(s),125===n){t&&je("A key was defined but a value was not",s),s++,o=!0;break}i?(39!==n&&34!==n&&je("An object must start wtih a key",s),t=g(),h(),58===c(s)?(s++,i=!1):je("A colon must follow an object key",s)):(r=f(),e.push({key:t,value:r}),h(),n=c(s),44===n?s++:125!==n&&je("Please add a comma to add another key",s),i=!0,t=void 0,r=void 0),n=c(s)}return o||je("Unclosed brace in object",s),{__id:Oe,type:"Object",attributes:e,location:l(u)}}();let i=e.substr(s,Le),p=i.length;for(;p>0;){if(Object.prototype.hasOwnProperty.call(Te,i))return s+=p,{__id:Oe,type:"UnaryExpression",operator:i,argument:d(),prefix:!0,location:l(r)};i=i.substr(0,--p)}return!1}function g(){const e=u(s++);let t="",r=!1;const n=s;for(;s<a;){let n=u(s++);if(n===e){r=!0;break}if("\\"===n)switch(n=u(s++),n){case"n":t+="\n";break;case"r":t+="\r";break;case"t":t+="\t";break;case"b":t+="\b";break;case"f":t+="\f";break;case"v":t+="\v"}else t+=n}return r||je(`Unclosed quote after "${t}"`,s),{__id:Oe,type:"Literal",value:t,raw:`${e}${t}${e}`,location:l(n)}}function v(){const t=s;let r=c(t);for(Fe(r)?s++:je(`Unexpected ${u(s)}`,s);s<a&&(r=c(s),$e(r));)s++;const n=e.slice(t,s);return Object.prototype.hasOwnProperty.call(Ie,n)?{__id:Oe,type:"Literal",value:Ie[n],raw:n,location:l(t)}:"this"===n?{__id:Oe,type:"ThisExpression",location:l(t)}:{__id:Oe,type:"Identifier",name:n,location:l(t)}}function y(e){const t=[];let r,o;for(;s<a;){if(h(),r=c(s),r===e){s++;break}44!==r?(o=f(),o&&"Compound"!==o.type||je("Expected comma",s),t.push(o)):s++}return n&&r!==e&&je(`Expected ${String.fromCharCode(e)}`,s),t}const m=[];try{for(;s<a;){const e=c(s);if(59===e||44===e){s++;continue}const t=f();t?m.push(t):n&&s<a&&je(`Unexpected "${u(s)}"`,s)}return 1===m.length?m[0]:{__id:Oe,type:"Compound",body:m,location:l(0)}}catch(b){if(n||!(b instanceof Error))throw b;return{__id:Oe,type:"Compound",body:m,location:l(0),error:b}}}const ze=(e,t,r,n)=>e.evaluate(t)?e.evaluate(r):n?e.evaluate(n):null;ze.resolveParams=!1;var We=Object.freeze({__proto__:null,setDataVal:(e,t,r)=>{e.model.set([[t,r]])},getDataVal:(e,t)=>e.model.get(t),deleteDataVal:(e,t)=>e.model.delete(t),conditional:ze});function Ye(e){return(t,...r)=>e(...r)}function qe(e,t){var r,n,o,i,a;switch(e.type){case"Modification":case"Assignment":case"LogicalExpression":case"BinaryExpression":{const n=null!=(r=qe(e.left,t))?r:qe(e.right,t);if(n)return n;break}case"UnaryExpression":{const r=qe(e.argument,t);if(r)return r;break}case"MemberExpression":{const r=null!=(n=qe(e.object,t))?n:qe(e.property,t);if(r)return r;break}case"ConditionalExpression":{const r=null!=(i=null!=(o=qe(e.test,t))?o:qe(e.consequent,t))?i:qe(e.alternate,t);if(r)return r;break}case"ArrayExpression":case"Compound":{const r=("ArrayExpression"===e.type?e.elements:e.body).find((e=>qe(e,t)));if(r)return r;break}case"Object":{const r=e.attributes.reduce(((e,r)=>{var n;return null!=(n=null!=e?e:qe(r.key,t))?n:qe(r.value,t)}),void 0);if(r)return r;break}case"CallExpression":{const r=null!=(a=e.args.find((e=>qe(e,t))))?a:qe(e.callTarget,t);if(r)return r;break}}if(e.location&&function(e,t){return e.character>=t.start.character&&e.character<=t.end.character}(t,e.location))return e}function Ge(e){return!xe(e)&&("object"===typeof e&&null!==e&&!Array.isArray(e)&&"value"in e)}var Ke=Object.defineProperty,Ze=Object.defineProperties,Je=Object.getOwnPropertyDescriptors,Qe=Object.getOwnPropertySymbols,Xe=Object.prototype.hasOwnProperty,et=Object.prototype.propertyIsEnumerable,tt=(e,t,r)=>t in e?Ke(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,rt=(e,t)=>{for(var r in t||(t={}))Xe.call(t,r)&&tt(e,r,t[r]);if(Qe)for(var r of Qe(t))et.call(t,r)&&tt(e,r,t[r]);return e},nt=(e,t)=>Ze(e,Je(t));const ot=(e,t,r)=>e.evaluate(t)&&e.evaluate(r);ot.resolveParams=!1;const it=(e,t,r)=>e.evaluate(t)||e.evaluate(r);it.resolveParams=!1;const at={"+":(e,t)=>e+t,"-":(e,t)=>e-t,"*":(e,t)=>e*t,"/":(e,t)=>e/t,"%":(e,t)=>e%t,"==":(e,t)=>e==t,"!=":(e,t)=>e!=t,">":(e,t)=>e>t,">=":(e,t)=>e>=t,"<":(e,t)=>e<t,"<=":(e,t)=>e<=t,"&&":ot,"||":it,"!==":(e,t)=>e!==t,"===":(e,t)=>e===t,"|":(e,t)=>e|t,"&":(e,t)=>e&t,"+=":(e,t)=>e+t,"-=":(e,t)=>e-t,"&=":(e,t)=>e&t,"|=":(e,t)=>e|t},st={"-":e=>-e,"+":e=>Number(e),"!":e=>!e};class lt{constructor(e){this.vars={},this.hooks={resolve:new i.c,resolveOptions:new i.c,beforeEvaluate:new i.c,onError:new i.a},this.expressionsCache=new Map,this.operators={binary:new Map(Object.entries(at)),unary:new Map(Object.entries(st)),expressions:new Map(Object.entries(We))},this.defaultHookOptions=nt(rt({},e),{evaluate:e=>this.evaluate(e,this.defaultHookOptions),resolveNode:e=>this._execAST(e,this.defaultHookOptions)}),this.hooks.resolve.tap("ExpressionEvaluator",this._resolveNode.bind(this)),this.evaluate=this.evaluate.bind(this)}reset(){this.expressionsCache.clear()}evaluate(e,t){var r;const n=this.hooks.resolveOptions.call(nt(rt(rt({},this.defaultHookOptions),t),{resolveNode:e=>this._execAST(e,n)}));let o=null!=(r=this.hooks.beforeEvaluate.call(e,n))?r:e;for(;Ge(o);)o=o.value;return"number"===typeof o||"boolean"===typeof o||void 0===o||null===o?o:xe(o)?this._execAST(o,n):Array.isArray(o)?o.reduce(((e,r)=>this.evaluate(r,t)),null):this._execString(String(o),n)}addExpressionFunction(e,t){this.operators.expressions.set(e,t)}addBinaryOperator(e,t){this.operators.binary.set(e,t)}addUnaryOperator(e,t){this.operators.unary.set(e,t)}setExpressionVariable(e,t){this.vars[e]=t}getExpressionVariable(e){return this.vars[e]}_execAST(e,t){return this.hooks.resolve.call(void 0,e,t)}_execString(e,t){var r;if(""===e)return e;const n=e.match(/^@\[(.*)\]@$/);let o,i=e;n&&([,i]=Array.from(n));try{o=null!=(r=this.expressionsCache.get(i))?r:He(i,{strict:t.strict}),this.expressionsCache.set(i,o)}catch(s){if(t.throwErrors||!this.hooks.onError.call(s))throw new a.NestedError(`Error parsing expression: ${e}`,s);return}try{return this._execAST(o,t)}catch(s){if(t.throwErrors||!this.hooks.onError.call(s))throw new a.NestedError(`Error evaluating expression: ${e}`,s)}}_resolveNode(e,t,r){const{resolveNode:n,model:o}=r,i=nt(rt({},r),{evaluate:e=>this.evaluate(e,r)});if("Literal"===t.type)return t.value;if("Identifier"===t.type)return this.vars[t.name];if("Compound"===t.type||"ThisExpression"===t.type)throw new Error(`Expression type: ${t.type} is not supported`);if("BinaryExpression"===t.type||"LogicalExpression"===t.type){const e=this.operators.binary.get(t.operator);return e?"resolveParams"in e?!1===e.resolveParams?e(i,t.left,t.right):e(i,n(t.left),n(t.right)):e(n(t.left),n(t.right)):void 0}if("UnaryExpression"===t.type){const e=this.operators.unary.get(t.operator);return e?"resolveParams"in e?e(i,!1===e.resolveParams?t.argument:n(t.argument)):e(n(t.argument)):void 0}if("Object"===t.type){const{attributes:e}=t,r={};return e.forEach((e=>{const t=n(e.key),o=n(e.value);r[t]=o})),r}if("CallExpression"===t.type){const e=t.callTarget.name,r=this.operators.expressions.get(e);if(!r)throw new Error(`Unknown expression function: ${e}`);if("resolveParams"in r&&!1===r.resolveParams)return r(i,...t.args);return r(i,...t.args.map((e=>n(e))))}if("ModelRef"===t.type)return o.get(t.ref,{context:{model:r.model}});if("MemberExpression"===t.type){return n(t.object)[n(t.property)]}if("Assignment"!==t.type){if("ConditionalExpression"===t.type){const e=n(t.test)?t.consequent:t.alternate;return n(e)}if("ArrayExpression"===t.type)return t.elements.map((e=>n(e)));if("Modification"===t.type){const e=this.operators.binary.get(t.operator);if(e){let r;return r="resolveParams"in e?!1===e.resolveParams?e(i,t.left,t.right):e(i,n(t.left),n(t.right)):e(n(t.left),n(t.right)),"ModelRef"===t.left.type?o.set([[t.left.ref,r]]):"Identifier"===t.left.type&&(this.vars[t.left.name]=r),r}return n(t.left)}}else{if("ModelRef"===t.left.type){const e=n(t.right);return o.set([[t.left.ref,e]]),e}if("Identifier"===t.left.type){const e=n(t.right);return this.vars[t.left.name]=e,e}}}}const ut=["trace","debug","info","warn","error"];class ct{constructor(e="warn",t=console){this.trace=this.createHandler("trace"),this.debug=this.createHandler("debug"),this.info=this.createHandler("info"),this.warn=this.createHandler("warn"),this.error=this.createHandler("error"),this.severity=e,this._console=t}setSeverity(e){this.severity=e}getConsoleFn(e){switch(ut.indexOf(e)){case 0:case 1:case 2:return this._console.log;case 3:return this._console.warn;default:return this._console.error}}createHandler(e){return(...t)=>{ut.indexOf(e)>=ut.indexOf(this.severity)&&this.getConsoleFn(e)(`player - ${e} -`,...t)}}}const ht=()=>{};class ft{constructor(){this.trace=ht,this.debug=ht,this.info=ht,this.warn=ht,this.error=ht}}class pt{constructor(){this.hooks={trace:new i.b,debug:new i.b,info:new i.b,warn:new i.b,error:new i.b,log:new i.b},this.logHandlers=new Set,this.trace=this.createHandler("trace"),this.debug=this.createHandler("debug"),this.info=this.createHandler("info"),this.warn=this.createHandler("warn"),this.error=this.createHandler("error")}createHandler(e){return(...t)=>{this.hooks[e].call(t),this.hooks.log.call(e,t),this.logHandlers.forEach((r=>r[e](...t)))}}addHandler(e){this.logHandlers.add(e)}removeHandler(e){this.logHandlers.delete(e)}}class dt{constructor(e){this.trace=this.createHandler("trace"),this.debug=this.createHandler("debug"),this.info=this.createHandler("info"),this.warn=this.createHandler("warn"),this.error=this.createHandler("error"),this.proxiedLoggerProvider=e}createHandler(e){return(...t)=>{const r=this.proxiedLoggerProvider();null==r||r[e](...t)}}}var gt=Object.defineProperty,vt=Object.defineProperties,yt=Object.getOwnPropertyDescriptors,mt=Object.getOwnPropertySymbols,bt=Object.prototype.hasOwnProperty,wt=Object.prototype.propertyIsEnumerable,Et=(e,t,r)=>t in e?gt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,St=(e,t)=>{for(var r in t||(t={}))bt.call(t,r)&&Et(e,r,t[r]);if(mt)for(var r of mt(t))wt.call(t,r)&&Et(e,r,t[r]);return e};const Ot=e=>e;function xt(e){const t=new Map;if(!e.ROOT)return t;const r=[{node:e.ROOT,path:[],visited:new Set}];for(;r.length>0;){const n=r.shift();if(!n)break;const{node:o,path:i,visited:a}=n;Object.entries(o).forEach((([n,o])=>{const s=[...i,n],l=s.join(".");if(t.has(l))throw new Error("Path has already been processed. There's either a loop somewhere or a bug");if(a.has(o.type))throw new Error(`Path already contained type: ${o.type}. This likely indicates a loop in the schema`);t.set(l,o),o.isArray&&s.push("[]"),o.isRecord&&s.push("{}"),o.type&&e[o.type]&&r.push({path:s,node:e[o.type],visited:new Set([...a,o.type])})}))}return t}class At{constructor(e){this.formatters=new Map,this.types=new Map,this.schema=new Map,this.bindingSchemaNormalizedCache=new Map,this.hooks={resolveTypeForBinding:new i.c},this.schema=e?xt(e):new Map}addFormatters(e){e.forEach((e=>{this.formatters.set(e.name,e)}))}addDataTypes(e){e.forEach((e=>{this.types.set(e.type,e)}))}getValidationsForBinding(e){var t;const r=this.getApparentType(e);if(null==(t=null==r?void 0:r.validation)?void 0:t.length)return r.validation.map((e=>St({severity:"error",trigger:"change"},e)))}normalizeBinding(e){const t=this.bindingSchemaNormalizedCache.get(e);if(t)return t;let r=e.asArray(),n=r.map((e=>"number"===typeof e?"[]":e)).join(".");return n&&(this.bindingSchemaNormalizedCache.set(e,n),r=n.split(".")),r.forEach((t=>{const o=r.map((e=>e===t?"{}":e)).join(".");this.schema.get(o)&&(this.bindingSchemaNormalizedCache.set(e,o),r=o.split("."),n=o)})),n}getType(e){return this.hooks.resolveTypeForBinding.call(this.schema.get(this.normalizeBinding(e)),e)}getApparentType(e){var t,r;const n=this.getType(e);if(void 0===n)return;const o=this.getTypeDefinition(null==n?void 0:n.type);return void 0===o?n:(i=St(St({},o),n),a={validation:[...null!=(t=n.validation)?t:[],...null!=(r=o.validation)?r:[]]},vt(i,yt(a)));var i,a}getTypeDefinition(e){return this.types.get(e)}getFormatterForType(e){const t=e,{type:r}=t,n=((e,t)=>{var r={};for(var n in e)bt.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&mt)for(var n of mt(e))t.indexOf(n)<0&&wt.call(e,n)&&(r[n]=e[n]);return r})(t,["type"]),o=this.formatters.get(r);if(o)return{format:o.format?e=>{var t;return null==(t=o.format)?void 0:t.call(o,e,n)}:Ot,deformat:o.deformat?e=>{var t;return null==(t=o.deformat)?void 0:t.call(o,e,n)}:Ot}}getFormatter(e){const t=this.getApparentType(e);if(null==t?void 0:t.format)return this.getFormatterForType(t.format)}}const kt="{{",Pt="}}";function Rt(e){const t=e.indexOf(kt);if(-1===t)return;let r=1,n=t+kt.length,o=e.substring(t+kt.length);for(;r>0&&o.length>0;){const e=o.indexOf(Pt);if(-1===e)break;const t=o.indexOf(kt);-1!==t&&t<e?(r++,o=o.substring(t+kt.length),n+=t+kt.length):(r--,o=o.substring(e+Pt.length),n+=e+Pt.length)}if(0!==r)throw new Error(`Unbalanced {{ and }} in exp: ${e}`);return{start:t,end:n}}function _t(e,{evaluate:t}){if(!t)return e;const r=/@\[.*?\]@/;let n=e,o=n.match(r);for(;null!==o;){const i=o[0],a=n.indexOf(i),s=t(i.substr("@[".length,i.length-"@[".length-"]@".length));if(0===a&&i===e&&"string"!==typeof s)return s;n=n.substr(0,a)+s+n.substr(a+i.length),o=n.match(r)}return n}function Tt(e,t){const{model:r,formatted:n=!0}=t;let o=_t(e,t);if(!r||"string"!==typeof o||-1===o.indexOf(kt))return o;for(;-1!==o.indexOf(kt);){const e=Rt(o);if(!e)return o;const{start:t,end:i}=e,a=o.substring(t+kt.length,i-kt.length).trim(),s=r.get(a,{formatted:n});if(0===t&&i===o.length&&"string"!==typeof s)return s;o=o.substr(0,t)+s+o.substr(i)}return o}function Ct(e,t){switch(typeof e){case"string":return Tt(e,t);case"object":{if(!e)return e;const r=Object.keys(e);let n=e;return r.length>0&&r.forEach((r=>{n=Object(d.setIn)(n,[r],Ct(e[r],t))})),n}default:return e}}function jt(e,t){return Ct(e,t)}function Nt(e,t){const r=new Map(e),n=t.parent(),o=t.key();if(r.forEach(((e,n)=>{(t===n||t.contains(n))&&r.delete(n)})),"number"===typeof o){Array.from(e.keys()).filter((e=>{if(n.contains(e)){const[t]=e.relative(n);return"number"===typeof t&&t>o}return!1})).sort().forEach((e=>{const[t,...o]=e.relative(n);if("number"===typeof t){const i=[t-1,...o],a=n.descendent(i);r.set(a,r.get(e)),r.delete(e)}}))}return r}var Ut,Lt,Bt=Object.defineProperty,It=Object.defineProperties,Dt=Object.getOwnPropertyDescriptors,Mt=Object.getOwnPropertySymbols,Vt=Object.prototype.hasOwnProperty,Ft=Object.prototype.propertyIsEnumerable,$t=(e,t,r)=>t in e?Bt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;class Ht{constructor(e,t){this.validator=e,this.shadowModelPaths=new Map,this.logger=null==t?void 0:t.logger,this.shouldIncludeInvalid=null==t?void 0:t.shouldIncludeInvalid}set(e,t,r){const n=be(this,(o=((e,t)=>{for(var r in t||(t={}))Vt.call(t,r)&&$t(e,r,t[r]);if(Mt)for(var r of Mt(t))Ft.call(t,r)&&$t(e,r,t[r]);return e})({},t),It(o,Dt({includeInvalid:!0}))),r);var o;const i=[],a=new Set;e.forEach((([e,t])=>{this.shadowModelPaths.set(e,t),a.add(e)}));const s=[];this.shadowModelPaths.forEach(((e,t)=>{var r;const o=this.validator(t,n);void 0===o?i.push([t,e]):o instanceof Set?o.forEach((r=>{s.push(r.binding),r.isStrong||r.binding.asString()!==t.asString()||i.push([r.binding,e])})):a.has(t)&&(s.push(t),null==(r=this.logger)||r.debug(`Invalid value for path: ${t.asString()} - ${o.severity} - ${o.message}`))}));let l=[];if(r&&i.length>0){i.forEach((([e])=>this.shadowModelPaths.delete(e)));const e=r.set(i,t);if(0===s.length)return e;l=e}const u=s.map((e=>({binding:e,oldValue:n.get(e),newValue:n.get(e),force:!0})));return[...l,...u]}get(e,t,r){var n,o;let i=null==r?void 0:r.get(e,t);return(null!=(o=null==(n=this.shouldIncludeInvalid)?void 0:n.call(this,t))?o:!0===(null==t?void 0:t.includeInvalid))&&this.shadowModelPaths.forEach(((t,r)=>{r!==e?e.contains(r)&&(i=Object(d.setIn)(i,r.relative(e),t)):i=t})),i}delete(e,t,r){return this.shadowModelPaths=Nt(this.shadowModelPaths,e),null==r?void 0:r.delete(e,t)}}class zt{constructor(){this.registry=new Map}get(e){return this.registry.get(e)}register(e,t){this.registry.set(e,t)}}function Wt(e){return Object.prototype.hasOwnProperty.call(e,"async")}function Yt(e){var t;if(e)return"value"in e&&"object"===typeof e.value&&"string"===typeof(null==(t=e.value)?void 0:t.id)?e.value.id:void 0}(Lt=Ut||(Ut={})).Asset="asset",Lt.View="view",Lt.Applicability="applicability",Lt.Template="template",Lt.Value="value",Lt.MultiNode="multi-node",Lt.Switch="switch",Lt.Async="async",Lt.Unknown="unknown",Lt.Empty="empty";var qt=Object.defineProperty,Gt=Object.defineProperties,Kt=Object.getOwnPropertyDescriptors,Zt=Object.getOwnPropertySymbols,Jt=Object.prototype.hasOwnProperty,Qt=Object.prototype.propertyIsEnumerable,Xt=(e,t,r)=>t in e?qt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,er=(e,t)=>{for(var r in t||(t={}))Jt.call(t,r)&&Xt(e,r,t[r]);if(Zt)for(var r of Zt(t))Qt.call(t,r)&&Xt(e,r,t[r]);return e},tr=(e,t)=>Gt(e,Kt(t));const rr={type:Ut.Empty};class nr{constructor(){this.hooks={onParseObject:new i.c,onCreateASTNode:new i.c,determineNodeType:new i.a,parseNode:new i.a}}parseView(e){const t=this.parseObject(e,Ut.View);if(!t)throw new Error("Unable to parse object into a view");return t}parseAsync(e,t,r){const n=this.parseObject(Object(d.omit)(e,"async"),t,r),o=Yt(n);return null!==n&&o?this.createASTNode({id:o,type:Ut.Async,value:n},e):null}createASTNode(e,t){const r=this.hooks.onCreateASTNode.call(e,t);return void 0===r?e:r}hasTemplateValues(e,t){return Object.hasOwnProperty.call(e,"template")&&Array.isArray(null==e?void 0:e.template)&&e.template.length&&e.template.find((e=>e.output===t))}parseObject(e,t=Ut.Value,r={templateDepth:0}){var n;const o=this.hooks.determineNodeType.call(e);if(void 0!==o){const n=this.hooks.parseNode.call(e,t,r,o);if(n)return n}const i=(e,n,o=[])=>{if("object"!==typeof n||null===n)return{value:n,children:[]};const a=this.hooks.onParseObject.call(n,t);if(!a)return e;const s={children:[],value:e};return(Array.isArray(a)?a.map(((e,t)=>[t,e])):[...Object.entries(a),...Object.getOwnPropertySymbols(a).map((e=>[e,a[e]]))]).reduce(((e,t)=>{var n;const s=e,{children:l}=s,u=((e,t)=>{var r={};for(var n in e)Jt.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&Zt)for(var n of Zt(e))t.indexOf(n)<0&&Qt.call(e,n)&&(r[n]=e[n]);return r})(s,["children"]),[c,h]=t;if("asset"===c&&"object"===typeof h){const e=this.parseObject(h,Ut.Asset,r);if(e)return tr(er({},u),{children:[...l,{path:[...o,"asset"],value:e}]})}else{if(this.hooks.determineNodeType.call(c)===Ut.Template&&Array.isArray(h)){const e=h.map((e=>{var t,n;const i=this.hooks.onCreateASTNode.call({type:Ut.Template,depth:null!=(t=r.templateDepth)?t:0,data:e.data,template:e.value,dynamic:null!=(n=e.dynamic)&&n},e);if((null==i?void 0:i.type)===Ut.MultiNode&&i.values.forEach((e=>{e.parent=i})),i)return{path:[...o,e.output],value:i}})).filter((e=>!!e));return tr(er({},u),{children:[...l,...e]})}if(h&&this.hooks.determineNodeType.call(h)===Ut.Switch){const e=this.hooks.parseNode.call(h,Ut.Value,r,Ut.Switch);if(e&&e.type===Ut.Value&&1===(null==(n=e.children)?void 0:n.length)&&void 0===e.value){const t=e.children[0];return tr(er({},u),{children:[...l,{path:[...o,c,...t.path],value:t.value}]})}if(e)return tr(er({},u),{children:[...l,{path:[...o,c],value:e}]})}else if(h&&Wt(h)){const e=this.parseAsync(h,Ut.Value,r);e&&l.push({path:[...o,c],value:e})}else if(h&&Array.isArray(h)){const e=h.map((e=>this.parseObject(e,Ut.Value,r))).filter((e=>!!e));if(e.length>0){const t=this.hooks.onCreateASTNode.call({type:Ut.MultiNode,override:!this.hasTemplateValues(a,c),values:e},h);if((null==t?void 0:t.type)===Ut.MultiNode&&t.values.forEach((e=>{e.parent=t})),t)return tr(er({},u),{children:[...l,{path:[...o,c],value:t}]})}}else{if(!h||"object"!==typeof h){return{children:l,value:Object(d.setIn)(e.value,[...o,c],h)}}{const t=this.hooks.determineNodeType.call(h);if(t!==Ut.Applicability){const t=i(e.value,h,[...o,c]);return{value:t.value,children:[...l,...t.children]}}{const e=this.hooks.parseNode.call(h,Ut.Value,r,t);if(e)return tr(er({},u),{children:[...l,{path:[...o,c],value:e}]})}}}}return e}),s)},{value:a,children:s}=i(void 0,e),l=void 0===a&&0===s.length?void 0:{type:t,value:a};if(void 0!==l&&s.length>0){const e=l;e.children=s,s.forEach((t=>{t.value.parent=e}))}return null!=(n=this.hooks.onCreateASTNode.call(l,e))?n:null}}var or=Object.defineProperty,ir=Object.defineProperties,ar=Object.getOwnPropertyDescriptors,sr=Object.getOwnPropertySymbols,lr=Object.prototype.hasOwnProperty,ur=Object.prototype.propertyIsEnumerable,cr=(e,t,r)=>t in e?or(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;function hr(e,t){if(!e||!t)return!0;const r=Array.from(t.values()),n=Array.from(e.values());return void 0!==r.find((e=>!!n.find((t=>t===e||t.contains(e)||e.contains(t)))))}function fr(e){return t=((e,t)=>{for(var r in t||(t={}))lr.call(t,r)&&cr(e,r,t[r]);if(sr)for(var r of sr(t))ur.call(t,r)&&cr(e,r,t[r]);return e})({},e),r={data:{model:e.model,formatValue:(t,r)=>e.formatValue?e.formatValue(t,r):r,format:(t,r)=>e.format?e.format(H(t)?t:e.parseBinding(t),r):r},evaluate:t=>e.evaluator.evaluate(t,e)},ir(t,ar(r));var t,r}function pr(e,t){Array.isArray(e)?e.forEach((e=>{pr(e,t)})):t.push(e)}var dr=Object.defineProperty,gr=Object.defineProperties,vr=Object.getOwnPropertyDescriptors,yr=Object.getOwnPropertySymbols,mr=Object.prototype.hasOwnProperty,br=Object.prototype.propertyIsEnumerable,wr=(e,t,r)=>t in e?dr(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,Er=(e,t)=>{for(var r in t||(t={}))mr.call(t,r)&&wr(e,r,t[r]);if(yr)for(var r of yr(t))br.call(t,r)&&wr(e,r,t[r]);return e},Sr=(e,t)=>gr(e,vr(t));class Or{constructor(e,t){this.hooks={skipResolve:new i.c,beforeUpdate:new i.b,afterUpdate:new i.b,resolveOptions:new i.c,beforeResolve:new i.c,resolve:new i.c,afterResolve:new i.c,afterNodeUpdate:new i.b},this.root=e,this.options=t,this.resolveCache=new Map,this.ASTMap=new Map,this.logger=t.logger,this.idCache=new Set}getSourceNode(e){return this.ASTMap.get(e)}update(e){this.hooks.beforeUpdate.call(e);const t=new Map;this.idCache.clear();const r=new Map(this.ASTMap);this.ASTMap.clear();const n=this.computeTree(this.root,void 0,e,t,fr(this.options),void 0,r);return this.resolveCache=t,this.hooks.afterUpdate.call(n.value),n.value}getResolveCache(){return new Map(this.resolveCache)}getPreviousResult(e){var t,r;if(!e)return;const n=0===this.resolveCache.size,o=Yt(e);if(o){if(this.idCache.has(o))return void(n&&(e.type===Ut.Asset||e.type===Ut.View?null==(t=this.logger)||t.error(`Cache conflict: Found Asset/View nodes that have conflicting ids: ${o}, may cause cache issues.`):e.type===Ut.Value&&(null==(r=this.logger)||r.info(`Cache conflict: Found Value nodes that have conflicting ids: ${o}, may cause cache issues. To improve performance make value node IDs globally unique.`))));this.idCache.add(o)}return this.resolveCache.get(e)}cloneNode(e){const t=Object(d.clone)(e);return Object.keys(t).forEach((e=>{if("parent"===e)return;const r=t[e];"object"===typeof r&&null!==r&&(t[e]=Array.isArray(r)?[...r]:Er({},r))})),t}computeTree(e,t,r,n,o,i,a){var s,l,u;const c=new de(o.data.model);c.trackSubset("core");const h=(f=me(c,this.options.parseBinding),{get:(e,t)=>f.get(e,Er({context:{model:f}},t)),set:(e,t)=>f.set(e,Er({context:{model:f}},t)),delete:(e,t)=>f.delete(e,Er({context:{model:f}},t))});var f;const v=this.hooks.resolveOptions.call(Sr(Er({},o),{data:Sr(Er({},o.data),{model:h}),evaluate:e=>this.options.evaluator.evaluate(e,{model:h}),node:e}),e),y=this.getPreviousResult(e),m=null==y?void 0:y.dependencies,b=hr(r,m),w=this.hooks.skipResolve.call(!b,e,v),E=Sr(Er({},this.cloneNode(e)),{parent:i}),S=null!=(s=this.hooks.beforeResolve.call(E,v))?s:{type:Ut.Empty},O=S.type===Ut.MultiNode&&(null==(l=null==i?void 0:i.parent)?void 0:l.type)===Ut.MultiNode&&i.type===Ut.Value;if(y&&w){const r=Sr(Er({},y),{updated:!1}),o=(e,t,r)=>{var i;const{node:s}=e;this.ASTMap.set(s,t);const l=Sr(Er({},e),{updated:!1});n.set(t,l);const u=e=>{var r;const n=null!=(r=a.get(e))?r:e,i=this.getPreviousResult(n);i&&o(i,n,t)};"children"in s?null==(i=s.children)||i.forEach((({value:e})=>u(e))):s.type===Ut.MultiNode&&s.values.forEach(u),this.hooks.afterNodeUpdate.call(t,r,l)};return y.node.parent=i,o(y,e,t),r}S.parent=i,v.node=S,this.ASTMap.set(S,e);let x=this.hooks.resolve.call(void 0,S,v),A=!Object(g.a)(null==y?void 0:y.value,x);y&&!A&&(x=null==y?void 0:y.value);const k=new Set;if(c.trackSubset("children"),"children"in S){const t=null==(u=S.children)?void 0:u.map((t=>{const o=this.computeTree(t.value,e,r,n,v,S,a),{dependencies:i,node:s,updated:l,value:u}=o;if(i.forEach((e=>k.add(e))),u)if(s.type!==Ut.MultiNode||s.override)x=Object(d.setIn)(x,t.path,u);else{const e=Object(d.addLast)(p()(x,t.path,[]),u);x=Object(d.setIn)(x,t.path,e)}return A=A||l,Sr(Er({},t),{value:s})}));S.children=t}else if(S.type===Ut.MultiNode){const t=[],o=O?null==i?void 0:i.parent:e,s=S.values.map((e=>{var i;const s=this.computeTree(e,o,r,n,v,S,a);return void 0!==s.value&&null!==s.value&&((null==(i=s.node.parent)?void 0:i.type)===Ut.MultiNode&&Array.isArray(s.value)?s.value.forEach((e=>{pr(e,t)})):t.push(s.value)),s.dependencies.forEach((e=>k.add(e))),A=A||s.updated,s.node}));S.values=s,x=t}k.forEach((e=>c.addChildReadDep(e))),c.trackSubset("core"),y&&!A&&(x=null==y?void 0:y.value),x=this.hooks.afterResolve.call(x,S,Sr(Er({},v),{getDependencies:e=>c.getDependencies(e)}));const P={node:S,updated:A,value:x,dependencies:new Set([...c.getDependencies(),...k])};return this.hooks.afterNodeUpdate.call(e,O?null==i?void 0:i.parent:t,P),n.set(e,P),P}}class xr{constructor(e){this.hooks={resolveTemplateSubstitutions:new i.c},this.options=e}parseTemplate(e,t,r){const{template:n,depth:o}=t,i=r.data.model.get(t.data);if(!i)return null;if(!Array.isArray(i))throw new Error(`Template using '${t.data}' but is not an array`);const a=[];i.forEach(((r,i)=>{const s=this.hooks.resolveTemplateSubstitutions.call([{expression:new RegExp(`_index${o||""}_`),value:String(i)}],{depth:o,data:r,index:i});let l=JSON.stringify(n);for(const{expression:e,value:t}of s){let r="g";"object"===typeof e&&(r=`${e.flags}${e.global?"":"g"}`),l=l.replace(new RegExp(e,r),t)}const u=e(JSON.parse(l),Ut.Value,{templateDepth:t.depth+1});u&&a.push(u)}));return{type:Ut.MultiNode,override:!1,values:a}}applyParser(e){e.hooks.onCreateASTNode.tap("template",(t=>t&&t.type===Ut.Template&&!t.dynamic?this.parseTemplate(e.parseObject.bind(e),t,this.options):t)),e.hooks.determineNodeType.tap("template",(e=>{if("template"===e)return Ut.Template})),e.hooks.parseNode.tap("template",((t,r,n,o)=>{var i,a;if(o===Ut.Template){const r=e.createASTNode({type:Ut.Template,depth:null!=(i=n.templateDepth)?i:0,data:t.data,template:t.value,dynamic:null!=(a=t.dynamic)&&a},t);if(r)return r}}))}applyResolverHooks(e){e.hooks.beforeResolve.tap("template",((e,t)=>e&&e.type===Ut.Template&&e.dynamic?this.parseTemplate(t.parseNode,e,t):e))}apply(e){e.hooks.parser.tap("template",this.applyParser.bind(this)),e.hooks.resolver.tap("template",this.applyResolverHooks.bind(this))}}const Ar=(e,t)=>r=>{const n=r.indexOf(e);if(-1===n)return!1;const o=r.indexOf(t);return-1!==o&&n<o},kr=Ar("{{","}}"),Pr=Ar("@[","]@");function Rr(e,t){return function(e){return kr(e)||Pr(e)}(e)?jt(e,{model:t.data.model,evaluate:t.evaluate}):e}function _r(e,t,r){if(null===e||void 0===e||"object"!==typeof e&&"string"!==typeof e)return e;if("string"===typeof e)return Rr(e,t);let n=e;return Object.keys(e).forEach((o=>{if(r.has(o))return;const i=e[o];let a=i;"object"===typeof i?a=_r(i,t,r):"string"===typeof i&&(a=Rr(i,t)),a!==i&&(n=Object(d.set)(n,o,a))})),n}const Tr=(e,t)=>{var r,n,o;const i=e.parent;if(!i)return[];if("children"in i){const a=t.getSourceNode(e);return null!=(o=null==(n=null==(r=i.children)?void 0:r.find((e=>e.value===a)))?void 0:n.path)?o:[]}return i.type!==Ut.MultiNode?[]:Tr(i,t)};class Cr{constructor(){this.propertiesToSkipCache=new Map}applyResolver(e){e.hooks.resolve.tap("string-resolver",((t,r,n)=>{var o,i,a,s,l,u,c,h,f,p;if(r.type===Ut.Empty||r.type===Ut.Unknown)return null;if(r.type===Ut.Value||r.type===Ut.Asset||r.type===Ut.View){let t;r.type===Ut.Asset||r.type===Ut.View?(t=new Set(null!=(a=null==(i=null==(o=r.plugins)?void 0:o.stringResolver)?void 0:i.propertiesToSkip)?a:["exp"]),(null==(s=r.value)?void 0:s.id)&&this.propertiesToSkipCache.set(r.value.id,t)):t=(null==(l=r.parent)?void 0:l.type)===Ut.MultiNode&&((null==(c=null==(u=r.parent)?void 0:u.parent)?void 0:c.type)===Ut.Asset||(null==(f=null==(h=r.parent)?void 0:h.parent)?void 0:f.type)===Ut.View)&&(null==(p=r.parent.parent.value)?void 0:p.id)&&this.propertiesToSkipCache.has(r.parent.parent.value.id)?this.propertiesToSkipCache.get(r.parent.parent.value.id):new Set(["exp"]);const d=Tr(r,e);return d.length>0&&d.some((e=>t.has(e.toString())))?r.value:_r(r.value,n,t)}return t}))}apply(e){e.hooks.resolver.tap("string-resolver",this.applyResolver.bind(this))}}class jr{applyResolver(e){e.hooks.beforeResolve.tap("applicability",((e,t)=>{let r=e;if((null==e?void 0:e.type)===Ut.Applicability){if(!1===t.evaluate(e.expression))return null;r=e.value}return r}))}applyParser(e){e.hooks.determineNodeType.tap("applicability",(e=>{if(Object.prototype.hasOwnProperty.call(e,"applicability"))return Ut.Applicability})),e.hooks.parseNode.tap("applicability",((t,r,n,o)=>{if(o===Ut.Applicability){const o=e.parseObject(Object(d.omit)(t,"applicability"),r,n);if(null!==o){const r=e.createASTNode({type:Ut.Applicability,expression:t.applicability,value:o},t);return(null==r?void 0:r.type)===Ut.Applicability&&(r.value.parent=r),r}}}))}apply(e){e.hooks.resolver.tap("applicability",this.applyResolver.bind(this)),e.hooks.parser.tap("applicability",this.applyParser.bind(this))}}var Nr=Object.getOwnPropertySymbols,Ur=Object.prototype.hasOwnProperty,Lr=Object.prototype.propertyIsEnumerable;class Br{constructor(e){this.options=e}resolveSwitch(e,t){for(const r of e.cases){if(t.evaluate(r.case))return r.value}return rr}applyParser(e){e.hooks.onCreateASTNode.tap("switch",(e=>e&&e.type===Ut.Switch&&!e.dynamic?this.resolveSwitch(e,this.options):e)),e.hooks.determineNodeType.tap("switch",(e=>{if(Object.prototype.hasOwnProperty.call(e,"dynamicSwitch")||Object.prototype.hasOwnProperty.call(e,"staticSwitch"))return Ut.Switch})),e.hooks.parseNode.tap("switch",((t,r,n,o)=>{if(o===Ut.Switch){const r="dynamicSwitch"in t,o="dynamicSwitch"in t?t.dynamicSwitch:t.staticSwitch,i=[];o.forEach((t=>{const r=t,{case:o}=r,a=((e,t)=>{var r={};for(var n in e)Ur.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&Nr)for(var n of Nr(e))t.indexOf(n)<0&&Lr.call(e,n)&&(r[n]=e[n]);return r})(r,["case"]),s=e.parseObject(a,Ut.Value,n);s&&i.push({case:o,value:s})}));const a=e.hooks.onCreateASTNode.call({type:Ut.Switch,dynamic:r,cases:i},t);return(null==a?void 0:a.type)===Ut.Switch&&a.cases.forEach((e=>{e.value.parent=a})),(null==a?void 0:a.type)===Ut.Empty?null:null!=a?a:null}}))}applyResolver(e){e.hooks.beforeResolve.tap("switch",((e,t)=>e&&e.type===Ut.Switch&&e.dynamic?this.resolveSwitch(e,t):e))}apply(e){e.hooks.parser.tap("switch",this.applyParser.bind(this)),e.hooks.resolver.tap("switch",this.applyResolver.bind(this))}}var Ir=Object.defineProperty,Dr=Object.defineProperties,Mr=Object.getOwnPropertyDescriptors,Vr=Object.getOwnPropertySymbols,Fr=Object.prototype.hasOwnProperty,$r=Object.prototype.propertyIsEnumerable,Hr=(e,t,r)=>t in e?Ir(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,zr=(e,t)=>{for(var r in t||(t={}))Fr.call(t,r)&&Hr(e,r,t[r]);if(Vr)for(var r of Vr(t))$r.call(t,r)&&Hr(e,r,t[r]);return e};class Wr{constructor(e,t,r){this.allValidations=new Set,this.byBinding=new Map,this.logger=r,this.parse(e,t)}parse(e,t){var r;const n=e.validation;void 0!==n&&(Array.isArray(n)?n.forEach((e=>{var r;const n=zr({trigger:"navigation",severity:"error"},e);this.allValidations.add(n);const{ref:o}=e;if(o){const e=t(o);this.byBinding.has(e)?null==(r=this.byBinding.get(e))||r.push(n):this.byBinding.set(e,[n])}})):null==(r=this.logger)||r.warn(`Unable to register view validations for id: ${e.id}. 'validation' property must be an Array.`))}getValidationsForBinding(e){return this.byBinding.get(e)}}class Yr{constructor(e,t){this.hooks={onUpdate:new i.b,parser:new i.b,resolver:new i.b,templatePlugin:new i.b},this.initialView=e,this.resolverOptions=t;const r=fr(t);new Br(r).apply(this),(new jr).apply(this),(new Cr).apply(this),this.templatePlugin=new xr(r),this.templatePlugin.apply(this)}updateAsync(){var e;const t=null==(e=this.resolver)?void 0:e.update();this.lastUpdate=t,this.hooks.onUpdate.call(t)}update(e){var t,r,n;if(void 0===this.rootNode){this.validationProvider=new Wr(this.initialView,this.resolverOptions.parseBinding,this.resolverOptions.logger),this.hooks.templatePlugin.call(this.templatePlugin);const e=new nr;this.hooks.parser.call(e),this.rootNode=e.parseView(this.initialView),this.resolver=new Or(this.rootNode,(r=zr({},this.resolverOptions),n={parseNode:e.parseObject.bind(e)},Dr(r,Mr(n)))),this.hooks.resolver.call(this.resolver)}const o=null==(t=this.resolver)?void 0:t.update(e);return this.lastUpdate===o?this.lastUpdate:(this.lastUpdate=o,this.hooks.onUpdate.call(o),o)}getValidationsForBinding(e){var t;return null==(t=this.validationProvider)?void 0:t.getValidationsForBinding(e)}}class qr{static asset(e){return{type:Ut.Asset,value:e}}static value(e){return{type:Ut.Value,value:e}}static multiNode(...e){const t={type:Ut.MultiNode,override:!0,values:e};return e.forEach((e=>{e.parent=t})),t}static addChild(e,t,r){r.parent=e;const n={path:Array.isArray(t)?t:[t],value:r};return e.children=e.children||[],e.children.push(n),e}}var Gr=Object.defineProperty,Kr=Object.getOwnPropertySymbols,Zr=Object.prototype.hasOwnProperty,Jr=Object.prototype.propertyIsEnumerable,Qr=(e,t,r)=>t in e?Gr(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,Xr=(e,t,r)=>new Promise(((n,o)=>{var i=e=>{try{s(r.next(e))}catch(t){o(t)}},a=e=>{try{s(r.throw(e))}catch(t){o(t)}},s=e=>e.done?n(e.value):Promise.resolve(e.value).then(i,a);s((r=r.apply(e,t)).next())}));class en{constructor(e,t,r){this.isTransitioning=!1,this.hooks={beforeStart:new i.a,onStart:new i.b,onEnd:new i.b,skipTransition:new i.a,beforeTransition:new i.c,resolveTransitionNode:new i.c,transition:new i.b,afterTransition:new i.b},this.id=e,this.flow=t,this.log=null==r?void 0:r.logger,this.history=[],this.hooks.transition.tap("startPromise",((e,t)=>Xr(this,null,(function*(){const e=t.value;this.flowPromise&&"END"===e.state_type&&this.flowPromise.resolve(e)}))))}start(){return Xr(this,null,(function*(){var e;if(this.flowPromise)return null==(e=this.log)||e.warn("Already called start for flow"),this.flowPromise.promise;this.flow=this.hooks.beforeStart.call(this.flow)||this.flow,this.flow.onStart&&this.hooks.onStart.call(this.flow.onStart);const t=this.flow.startState;return t?(this.flowPromise=y()(),this.pushHistory(t),this.flowPromise.promise):Promise.reject(new Error("No 'startState' defined for flow"))}))}transition(e,t){var r,n,o,i,a,s,l;if(this.isTransitioning)throw new Error(`Transitioning while ongoing transition from ${null==(r=this.currentState)?void 0:r.name} is in progress is not supported`);if("END"===(null==(n=this.currentState)?void 0:n.value.state_type))return void(null==(o=this.log)||o.warn(`Skipping transition using ${e}. Already at and END state`));if(void 0===this.currentState)throw new Error("Cannot transition when there's no current state");if(null==t?void 0:t.force)null==(i=this.log)||i.debug("Forced transition. Skipping validation checks");else{if(this.hooks.skipTransition.call(this.currentState))return void(null==(a=this.log)||a.debug(`Skipping transition from ${this.currentState.name} b/c hook told us to`))}const u=this.hooks.beforeTransition.call(this.currentState.value,e);if(!("transitions"in u))throw new Error(`No transitions defined for ${this.currentState.value}`);const{transitions:c}=u,h=c[e]||c["*"];if(void 0!==h)return null==(l=this.log)||l.debug(`Transitioning from ${this.currentState.name} to ${h} using ${e} `),this.pushHistory(h,t);null==(s=this.log)||s.warn(`No transition from ${this.currentState.name} using ${e} or *`)}pushHistory(e,t){var r;if(!Object.prototype.hasOwnProperty.call(this.flow,e))throw new Error(`No flow definition for: ${e} was found.`);let n=this.flow[e];if(!this.flow[e]||"object"!==typeof n||!("state_type"in n))return void(null==(r=this.log)||r.error(`Flow doesn't contain any states named: ${e}`));const o=this.currentState;this.isTransitioning=!0,n=this.hooks.resolveTransitionNode.call(n);const i={name:e,value:n};this.currentState=i,this.history.push(e),"END"===i.value.state_type&&this.flow.onEnd&&this.hooks.onEnd.call(this.flow.onEnd),this.hooks.transition.call(o,((e,t)=>{for(var r in t||(t={}))Zr.call(t,r)&&Qr(e,r,t[r]);if(Kr)for(var r of Kr(t))Jr.call(t,r)&&Qr(e,r,t[r]);return e})({},i)),this.isTransitioning=!1,this.hooks.afterTransition.call(this)}}var tn=(e,t,r)=>new Promise(((n,o)=>{var i=e=>{try{s(r.next(e))}catch(t){o(t)}},a=e=>{try{s(r.throw(e))}catch(t){o(t)}},s=e=>e.done?n(e.value):Promise.resolve(e.value).then(i,a);s((r=r.apply(e,t)).next())}));class rn{constructor(e,t){this.hooks={flow:new i.b},this.navigation=e,this.navStack=[],this.log=null==t?void 0:t.logger,this.start=this.start.bind(this),this.run=this.run.bind(this),this.transition=this.transition.bind(this),this.addNewFlow=this.addNewFlow.bind(this)}transition(e,t){if(void 0===this.current)throw new Error("Not currently in a flow. Cannot transition.");this.current.transition(e,t)}addNewFlow(e){this.navStack.push(e),this.current=e,this.hooks.flow.call(e)}run(e){return tn(this,null,(function*(){var t;if(!Object.prototype.hasOwnProperty.call(this.navigation,e))return Promise.reject(new Error(`No flow defined for: ${e}`));const r=this.navigation[e];if(null===r||"object"!==typeof r)return Promise.reject(new Error(`Flow: ${e} needs to be an object`));null==(t=this.log)||t.debug(`Starting flow: ${e}`);const n=new en(e,r,{logger:this.log});this.addNewFlow(n),n.hooks.afterTransition.tap("flow-controller",(e=>{var t,r,n;if("FLOW"===(null==(t=e.currentState)?void 0:t.value.state_type)){const t=null==(r=e.currentState)?void 0:r.value.ref;null==(n=this.log)||n.debug(`Loading subflow ${t}`),this.run(t).then((t=>{var r;null==(r=this.log)||r.debug(`Subflow ended. Using outcome: ${t.outcome}`),e.transition(null==t?void 0:t.outcome)}))}}));const o=yield n.start();if(this.navStack.pop(),this.navStack.length>0){const e=0;this.current=this.navStack[e]}return o}))}start(){return tn(this,null,(function*(){return this.navigation.BEGIN?this.run(this.navigation.BEGIN):Promise.reject(new Error("Must supply a BEGIN state"))}))}}const nn=/%([a-zA-Z]+)/g;var on=Object.defineProperty,an=Object.defineProperties,sn=Object.getOwnPropertyDescriptors,ln=Object.getOwnPropertySymbols,un=Object.prototype.hasOwnProperty,cn=Object.prototype.propertyIsEnumerable,hn=(e,t,r)=>t in e?on(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,fn=(e,t)=>{for(var r in t||(t={}))un.call(t,r)&&hn(e,r,t[r]);if(ln)for(var r of ln(t))cn.call(t,r)&&hn(e,r,t[r]);return e},pn=(e,t)=>an(e,sn(t));const dn="validation-binding-tracker";class gn{constructor(e){this.trackedBindings=new Set,this.options=e}getBindings(){return this.trackedBindings}trackBinding(e){var t,r;this.trackedBindings.has(e)||(this.trackedBindings.add(e),null==(r=null==(t=this.options.callbacks)?void 0:t.onAdd)||r.call(t,e))}applyResolver(e){this.trackedBindings.clear();const t=new Map,r=new Map;let n;const o=new Map;let i=new Map,a=new Map;const s=new Map;e.hooks.beforeUpdate.tap(dn,(e=>{n=e})),e.hooks.skipResolve.tap(dn,((e,t)=>{const r=i.get(t);if(!e||!n||!r)return e;return 0===new Set([...n].filter((e=>r.has(e)))).size})),e.hooks.resolveOptions.tap(dn,((e,n)=>{if(void 0===e.validation)return e;t.delete(n);const o=e=>{var o,i,a,s;const l=H(e)?e:this.options.parseBinding(e);t.has(n)?null==(o=t.get(n))||o.add(l):t.set(n,new Set([l]));let{parent:u}=n;for(;u;){if(r.has(u)){null==(i=r.get(u))||i.add(n);break}u=u.parent}this.trackedBindings.add(l),null==(s=null==(a=this.options.callbacks)?void 0:a.onAdd)||s.call(a,l)};return pn(fn({},e),{validation:pn(fn({},e.validation),{get:(t,r)=>{var n,i;(null==r?void 0:r.track)&&o(t);const a=null==(i=null==(n=e.validation)?void 0:n._getValidationForBinding(t))?void 0:i.getAll(r);return null==a?void 0:a.find((e=>"field"===e.displayTarget||void 0===e.displayTarget))},getValidationsForBinding(t,r){var n,i,a;return(null==r?void 0:r.track)&&o(t),null!=(a=null==(i=null==(n=e.validation)?void 0:n._getValidationForBinding(t))?void 0:i.getAll(r))?a:[]},getChildren:t=>{var r;const o=new Array;return null==(r=i.get(n))||r.forEach((r=>{var n,i;const a=null==(i=null==(n=e.validation)?void 0:n._getValidationForBinding(r))?void 0:i.get();!a||void 0!==t&&t!==a.displayTarget||o.push(a)})),o},getValidationsForSection:()=>{var t;const r=new Array;return null==(t=s.get(n))||t.forEach((t=>{var n,o;const i=null==(o=null==(n=e.validation)?void 0:n._getValidationForBinding(t))?void 0:o.get();i&&"section"===i.displayTarget&&r.push(i)})),r},register:e=>{"section"===(null==e?void 0:e.type)&&(r.has(n)||r.set(n,new Set))},track:o})})})),e.hooks.afterNodeUpdate.tap(dn,((n,l,u)=>{var c,h;if(l&&function(e,t){var r;o.has(t)?null==(r=o.get(t))||r.add(e):o.set(t,new Set([e]))}(n,l),u.updated){const e=new Set(t.get(n));null==(c=o.get(n))||c.forEach((t=>{var r;null==(r=a.get(t))||r.forEach((t=>e.add(t)))})),a.set(n,e)}else a.set(n,null!=(h=i.get(n))?h:new Set);n===e.root&&(this.trackedBindings=new Set(a.get(n)),i=a,s.clear(),r.forEach(((e,r)=>{const n=new Set;e.forEach((e=>{var r;null==(r=t.get(e))||r.forEach(n.add,n)})),s.set(r,n)})),o.clear(),t.clear(),r.clear(),a=new Map)}))}apply(e){e.hooks.resolver.tap(dn,this.applyResolver.bind(this))}}var vn=Object.defineProperty,yn=Object.defineProperties,mn=Object.getOwnPropertyDescriptors,bn=Object.getOwnPropertySymbols,wn=Object.prototype.hasOwnProperty,En=Object.prototype.propertyIsEnumerable,Sn=(e,t,r)=>t in e?vn(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,On=(e,t)=>{for(var r in t||(t={}))wn.call(t,r)&&Sn(e,r,t[r]);if(bn)for(var r of bn(t))En.call(t,r)&&Sn(e,r,t[r]);return e},xn=(e,t)=>yn(e,mn(t));const An="schema",kn="view",Pn=Symbol.for("validation-provider-name");class Rn{constructor(e,t,r,n){this.applicableValidations=[],this.validationsByState={load:[],change:[],navigation:[]},this.onDismiss=t,e.forEach((e=>{const{trigger:t}=e;if(this.validationsByState[t]){const r={value:n=e,type:n.severity,state:"none",isBlockingNavigation:!1};this.validationsByState[t].push(r)}else null==r||r.warn(`Unknown validation trigger: ${t}`);var n})),this.weakBindings=null!=n?n:new Set}get allValidations(){return Object.values(this.validationsByState).flat()}checkIfBlocking(e){if("active"===e.state){const{isBlockingNavigation:t}=e;return t}return!1}getAll(){return this.applicableValidations.reduce(((e,t)=>("active"===t.state&&t.response&&e.push(xn(On({},t.response),{blocking:this.checkIfBlocking(t)})),e)),[])}get(){const e=this.applicableValidations.find((e=>"active"===e.state&&e.response));if("active"===(null==e?void 0:e.state))return xn(On({},e.response),{blocking:this.checkIfBlocking(e)})}runApplicableValidations(e,t,r){this.applicableValidations=this.applicableValidations.map((n=>{var o,i,a;if("dismissed"===n.state)return n;const s=null!=(o=n.value.blocking)?o:"warning"!==n.value.severity||"once",l=Object(d.setIn)(n,["value","blocking"],s),u=!0===s||"once"===s&&!t;if("navigation"===r&&"active"===l.state&&!0!==l.value.blocking&&"warning"===l.value.severity){const e=l;return!e.dismissable||!e.response.dismiss||"once"===e.response.blocking&&e.response.blocking?("once"===(null==e?void 0:e.response.blocking)&&(e.response.blocking=!1),e.dismissable=!0):e.response.dismiss(),e}const c=e(l.value),h={type:l.type,value:l.value,state:c?"active":"none",isBlockingNavigation:u,dismissable:"warning"===l.value.severity&&"navigation"===r,response:c?xn(On({},l.value),{message:null!=(i=c.message)?i:"Something is broken",severity:l.value.severity,displayTarget:null!=(a=l.value.displayTarget)?a:"field"}):void 0};return"active"===h.state&&"warning"===l.value.severity&&(h.response.dismiss=()=>{var e;h.state="dismissed",null==(e=this.onDismiss)||e.call(this)}),h}))}update(e,t,r){const n=[];"load"===e&&void 0!==this.currentPhase||("navigation"!==this.currentPhase&&e!==this.currentPhase?("load"===e?(this.currentPhase="load",this.applicableValidations=[...this.validationsByState.load]):"change"===e&&"load"===this.currentPhase?(this.currentPhase="change",this.applicableValidations=[...this.applicableValidations,...this.validationsByState.change]):"navigation"!==e||"load"!==this.currentPhase&&"change"!==this.currentPhase||(this.applicableValidations.forEach((e=>{"error"===e.type&&"active"===e.state&&!1===e.isBlockingNavigation||n.push(e)})),this.applicableValidations=[...n,...this.validationsByState.navigation,..."load"===this.currentPhase?this.validationsByState.change:[]],this.currentPhase="navigation"),this.runApplicableValidations(r,t,e)):this.runApplicableValidations(r,t,e))}}class _n{constructor(e,t){this.hooks={createValidatorRegistry:new i.b,onAddValidation:new i.c,onRemoveValidation:new i.c,resolveValidationProviders:new i.c,onTrackBinding:new i.b},this.validations=new Map,this.weakBindingTracker=new Set,this.schema=e,this.options=t,this.reset()}setOptions(e){this.options=e}getDataMiddleware(){return[{set:(e,t,r)=>{var n;return null!=(n=null==r?void 0:r.set(e,t))?n:[]},get:(e,t,r)=>null==r?void 0:r.get(e,t),delete:(e,t,r)=>(this.validations=Nt(this.validations,e),null==r?void 0:r.delete(e,t))},new Ht((e=>{var t;if(!this.options)return;this.updateValidationsForBinding(e,"change",this.options);const r=this.getValidationForBinding(e);if("error"===(null==(t=null==r?void 0:r.get())?void 0:t.severity))return r.get();const n=new Set;return this.validations.forEach(((t,r)=>{var o;hr(new Set([e]),t.weakBindings)&&"error"===(null==(o=null==t?void 0:t.get())?void 0:o.severity)&&(null==t||t.weakBindings.forEach((e=>{e===r?n.add({binding:e,isStrong:!0}):n.add({binding:e,isStrong:!1})})))})),n.size>0?n:void 0}),{logger:new dt((()=>{var e;return null==(e=this.options)?void 0:e.logger}))})]}getValidationProviders(){return this.providers||(this.providers=this.hooks.resolveValidationProviders.call([{source:An,provider:this.schema},{source:kn,provider:{getValidationsForBinding:e=>{var t,r;return null==(r=null==(t=this.viewValidationProvider)?void 0:t.getValidationsForBinding)?void 0:r.call(t,e)},getValidationsForView:()=>{var e,t;return null==(t=null==(e=this.viewValidationProvider)?void 0:e.getValidationsForView)?void 0:t.call(e)}}}])),this.providers}reset(){this.validations.clear(),this.tracker=void 0}onView(e){if(this.validations.clear(),!this.options)return;const t=new gn(xn(On({},this.options),{callbacks:{onAdd:t=>{if(!this.options||void 0!==this.getValidationForBinding(t))return;const r=this.options.model.get(t);r!==this.options.model.get(t,{ignoreDefaultValue:!0})&&this.options.model.set([[t,r]],{silent:!0}),this.updateValidationsForBinding(t,"load",this.options,(()=>{e.update(new Set([t]))})),this.hooks.onTrackBinding.call(t)}}}));this.tracker=t,this.viewValidationProvider=e,t.apply(e)}updateValidationsForBinding(e,t,r,n){var o;const i=null!=r?r:this.options;if(!i)throw new Error("Context is required for executing validations");if("load"===t){const t=this.getValidationProviders().reduce(((t,r)=>{var n,o,i,a;return t.push(...null!=(a=null==(i=null==(o=(n=r.provider).getValidationsForBinding)?void 0:o.call(n,e))?void 0:i.map((e=>xn(On({},e),{[Pn]:r.source}))))?a:[]),t}),[]);if(0===t.length)return;this.validations.set(e,new Rn(t,n,null==(o=this.options)?void 0:o.logger))}const a=this.validations.get(e);null==a||a.update(t,!0,(t=>{const r=this.validationRunner(t,e,i);if(this.weakBindingTracker.size>0){const t=this.validations.get(e);this.weakBindingTracker.forEach((e=>t.weakBindings.add(e)))}return r?{message:r.message}:void 0})),"load"!==t&&this.validations.forEach(((r,n)=>{n!==e&&hr(new Set([e]),r.weakBindings)&&r.update(t,!0,(e=>{const t=this.validationRunner(e,n,i);return t?{message:t.message}:void 0}))}))}validationRunner(e,t,r=this.options){var n;if(!r)throw new Error("No context provided to validation runner");const o=null!=(n=e.handler)?n:this.getValidator(e.type),i=new Set,a={get:(e,n)=>(i.add(H(e)?t:r.parseBinding(e)),r.model.get(e,xn(On({},n),{includeInvalid:!0}))),set:r.model.set,delete:r.model.delete},s=null==o?void 0:o(xn(On({},r),{evaluate:(e,t={model:a})=>r.evaluate(e,t),model:a,validation:e,schemaType:this.schema.getType(t)}),r.model.get(t,{includeInvalid:!0,formatted:"formatted"===e.dataTarget}),e);if(this.weakBindingTracker=i,s){let{message:t}=s;const{parameters:n}=s;return e.message&&(t=jt(e.message,{model:a,evaluate:r.evaluate}),n&&(t=function(e,t){return e.slice().replace(nn,(e=>t[e.slice(1)]||e))}(t,n))),{message:t}}}updateValidationsForView(e){const t="navigation"===e,r=this.activeBindings,n=t=>{this.getBindings().forEach((r=>{var n;null==(n=this.validations.get(r))||n.update(e,t,(e=>{if(this.options)return this.validationRunner(e,r,this.options)}))}))};if(n(!t),t){const{activeBindings:e}=this;(function(e,t){if(e.size>t.size)return!1;for(const r of e)if(!t.has(r))return!1;return!0})(e,r)&&n(!0)}}get activeBindings(){return new Set(Array.from(this.getBindings()).filter((e=>{var t;return void 0!==(null==(t=this.validations.get(e))?void 0:t.get())})))}getValidator(e){if(this.validatorRegistry)return this.validatorRegistry.get(e);const t=new zt;return this.hooks.createValidatorRegistry.call(t),this.validatorRegistry=t,t.get(e)}getBindings(){var e,t;return null!=(t=null==(e=this.tracker)?void 0:e.getBindings())?t:new Set}trackBinding(e){var t;null==(t=this.tracker)||t.trackBinding(e)}validateView(e="navigation"){this.updateValidationsForView(e);const t=new Map;let r=!0;return this.getBindings().forEach((n=>{var o;const i=null==(o=this.getValidationForBinding(n))?void 0:o.getAll();null==i||i.forEach((o=>{var i;"navigation"===e&&o.blocking&&(null==(i=this.options)||i.logger.debug(`Validation on binding: ${n.asString()} is preventing navigation. ${JSON.stringify(o)}`),r=!1),t.has(n)||t.set(n,o)}))})),{canTransition:r,validations:t.size?t:void 0}}getValidationForBinding(e){return this.validations.get(e)}forView(e){return{_getValidationForBinding:t=>this.getValidationForBinding(H(t)?t:e(t)),getAll:()=>{const e=this.getBindings();if(0===e.size)return;const t=new Map;return e.forEach((e=>{var r;const n=null==(r=this.getValidationForBinding(e))?void 0:r.get();n&&t.set(e,n)})),0===t.size?void 0:t},get(){throw new Error("Error Access be provided by the view plugin")},getValidationsForBinding(){throw new Error("Error rollup should be provided by the view plugin")},getChildren(){throw new Error("Error rollup should be provided by the view plugin")},getValidationsForSection(){throw new Error("Error rollup should be provided by the view plugin")},track:()=>{throw new Error("Tracking should be provided by the view plugin")},register:()=>{throw new Error("Section functionality should be provided by the view plugin")},type:t=>this.schema.getType(H(t)?t:e(t))}}}class Tn{constructor(e){this.updateCallback=e,this.state=new Map}removeKey(e){this.state.delete(e)}reset(){this.state.clear()}useSharedState(e){return t=>(this.state.has(e)||this.state.set(e,t),[this.state.get(e),t=>{var r;const n=this.state.get(e);this.state.set(e,t),n!==t&&(null==(r=this.updateCallback)||r.call(this))}])}getLocalStateFunction(e,t){return r=>{this.state.has(e)||this.state.set(e,[]),this.state.has(t)||this.state.set(t,0);const n=this.state.get(e),o=this.state.get(t);this.state.set(t,o+1),n.length<=o&&n.push(r);return[n[o],e=>{var t;const r=n[o];n[o]=e,r!==e&&(null==(t=this.updateCallback)||t.call(this))}]}}}function Cn(e,t){return e===t||!!e.parent&&Cn(e.parent,t)}class jn{constructor(e){this.registry=e,this.stateStore=new Map,this.beforeResolveSymbol=Symbol("before resolve"),this.resolveSymbol=Symbol("resolve"),this.beforeResolveCountSymbol=Symbol("before resolve count"),this.resolveCountSymbol=Symbol("resolve count")}apply(e){e.hooks.view.tap("asset-transform",(e=>{this.stateStore.clear(),e.hooks.resolver.tap("asset-transform",(t=>{let r;const n=(t,n)=>{let o;const i=n===this.resolveSymbol?this.resolveCountSymbol:this.beforeResolveCountSymbol,a=this.stateStore.get(t);return a?(o=a,o.removeKey(i)):(o=new Tn((()=>{(t=>{r=t,e.update(new Set)})(t)})),this.stateStore.set(t,o)),{useSharedState:e=>o.useSharedState(e),useLocalState:e=>o.getLocalStateFunction(n,i)(e)}};t.hooks.beforeResolve.tap("asset-transform",((e,t)=>{var r;if(e&&("asset"===e.type||"view"===e.type)){const o=this.registry.get(e.value);if(null==o?void 0:o.beforeResolve){const i=n(null!=(r=t.node)?r:e,this.beforeResolveSymbol);return o.beforeResolve(e,t,i)}}return e})),t.hooks.afterUpdate.tap("asset-transform",(()=>{r=void 0})),t.hooks.skipResolve.tap("asset-transform",((e,t)=>{if(!e||!r)return e;const n=Cn(r,t),o=Cn(t,r);return!n&&!o})),t.hooks.afterResolve.tap("asset-transform",((e,r,o)=>{if(r.type!==Ut.Asset&&r.type!==Ut.View)return e;const i=t.getSourceNode(r);if(!i)return e;const a=this.registry.get(e);if(null==a?void 0:a.resolve){const t=n(i,this.resolveSymbol);return null==a?void 0:a.resolve(e,o,t)}return e}))}))}))}}class Nn{constructor(e,t){this.hooks={resolveView:new i.c,view:new i.b},this.transformRegistry=new w.a,this.optimizeUpdates=!0,this.viewOptions=t,this.viewMap=e.reduce(((e,t)=>(e[t.id]=t,e)),{}),new jn(this.transformRegistry).apply(this),t.flowController.hooks.flow.tap("viewController",(e=>{e.hooks.transition.tap("viewController",((e,t)=>{"VIEW"===t.value.state_type?this.onView(t.value):this.currentView=void 0}))}));const r=(e,t=!1)=>{this.currentView&&(this.optimizeUpdates?this.queueUpdate(e,t):this.currentView.update())};t.model.hooks.onUpdate.tap("viewController",((e,t)=>{var n;r(new Set(e.map((e=>e.binding))),null!=(n=null==t?void 0:t.silent)&&n)})),t.model.hooks.onDelete.tap("viewController",(e=>{const t=e.parent(),n=e.key();r("number"===typeof n&&t?new Set([t]):new Set([e]))}))}queueUpdate(e,t=!1){var r;(null==(r=this.pendingUpdate)?void 0:r.changedBindings)?this.pendingUpdate.changedBindings=new Set([...this.pendingUpdate.changedBindings,...e]):this.pendingUpdate={changedBindings:e,scheduled:!1},this.pendingUpdate.scheduled||t||(this.pendingUpdate.scheduled=!0,b()((()=>{var e,t;const r=null==(e=this.pendingUpdate)?void 0:e.changedBindings;this.pendingUpdate=void 0,null==(t=this.currentView)||t.update(r)})))}getViewForRef(e){if(this.viewMap[e])return this.viewMap[e];const t=Object.keys(this.viewMap).find((t=>e===Tt(t,{model:this.viewOptions.model,evaluate:this.viewOptions.evaluator.evaluate})));return t&&this.viewMap[t]?this.viewMap[t]:void 0}onView(e){const t=e.ref,r=this.hooks.resolveView.call(this.getViewForRef(t),t,e);if(!r)throw new Error(`No view with id ${t}`);const n=new Yr(r,this.viewOptions);this.currentView=n,this.hooks.view.call(n),n.update()}}class Un{constructor(e,t){this.controller=e,this.logger=t}get(e,t){return this.controller.get(e,t)}set(e,t){var r;return null==(r=this.logger)||r.error("Error: Tried to set in a read only instance of the DataController"),[]}delete(e,t){var r;null==(r=this.logger)||r.error("Error: Tried to delete in a read only instance of the DataController")}}class Ln{constructor(e,t){this.hooks={resolve:new i.c,resolveDataStages:new i.c,resolveDefaultValue:new i.a,onDelete:new i.b,onSet:new i.b,onGet:new i.b,onUpdate:new i.b,format:new i.c,deformat:new i.c,serialize:new i.c},this.logger=t.logger;const r=t.middleware||[];this.baseMiddleware=[new Se(e),...r],this.trash=new Set,this.pathResolver=t.pathResolver}getModel(){if(!this.model){const e=this.hooks.resolveDataStages.call(this.baseMiddleware),t=new Ee;t.setMiddleware(e),this.model=t}return this.model}resolveDataValue(e,t,r){return r?this.hooks.deformat.call(t,e):t}set(e,t){let r=[];r=Array.isArray(e)?e.map((([e,r])=>{const n=this.pathResolver.parse(e);return[n,this.resolveDataValue(n,r,Boolean(null==t?void 0:t.formatted))]})):Object.keys(e).map((r=>{const n=this.pathResolver.parse(r),o=e[r];return[n,this.resolveDataValue(n,o,Boolean(null==t?void 0:t.formatted))]}));const n=r.reduce(((e,[t,r])=>{var n,o;const i=this.get(t,{includeInvalid:!0}),a={binding:t,newValue:r,oldValue:i};return Object(g.a)(i,r)?null==(n=this.logger)||n.debug(`Skipping update for path: ${t.asString()}. Value was unchanged: ${i}`):(e.push(a),null==(o=this.logger)||o.debug(`Setting path: ${t.asString()} from: ${i} to: ${r}`)),e}),[]),o=this.getModel().set(r,t),i=new Set(n.map((e=>e.binding)));return o.forEach((e=>{var t;i.has(e.binding)||!0!==e.force&&Object(g.a)(e.oldValue,e.newValue)||(null==(t=this.logger)||t.debug(`Path: ${e.binding.asString()} was changed from: ${e.oldValue} to: ${e.newValue}`),n.push(e))})),this.hooks.onSet.call(r),n.length>0&&this.hooks.onUpdate.call(n,t),o}resolve(e,t){return Array.isArray(e)||"string"===typeof e?this.pathResolver.parse(e,{readOnly:t}):e}get(e,t){const r=e instanceof q?e:this.resolve(e,!0);let n=this.getModel().get(r,t);if(void 0===n&&!(null==t?void 0:t.ignoreDefaultValue)){const e=this.hooks.resolveDefaultValue.call(r);e!==n&&(n=e)}return(null==t?void 0:t.formatted)?n=this.hooks.format.call(n,r):!1===(null==t?void 0:t.formatted)&&(n=this.hooks.deformat.call(n,r)),this.hooks.onGet.call(e,n),n}delete(e,t){if("string"!==typeof e&&!Array.isArray(e)&&!(e instanceof q))throw new Error("Invalid arguments: delete expects a data path (string)");const r=e instanceof q?e:this.resolve(e,!1),n=r.parent(),o=r.key(),i=this.get(n),a="object"===typeof i&&null!==i&&Object.prototype.hasOwnProperty.call(i,o);this.getModel().delete(r,t),a&&!this.get(r)&&this.trash.add(r),this.hooks.onDelete.call(r)}serialize(){return this.hooks.serialize.call(this.get(""))}makeReadOnly(){return new Un(this,this.logger)}}var Bn=Object.defineProperty,In=Object.getOwnPropertySymbols,Dn=Object.prototype.hasOwnProperty,Mn=Object.prototype.propertyIsEnumerable,Vn=(e,t,r)=>t in e?Bn(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,Fn=(e,t)=>{for(var r in t||(t={}))Dn.call(t,r)&&Vn(e,r,t[r]);if(In)for(var r of In(t))Mn.call(t,r)&&Vn(e,r,t[r]);return e};function $n(e,t=[],r="."){return Object.keys(e).reduce(((n,o)=>Fn(Fn({},n),"[object Object]"===Object.prototype.toString.call(e[o])?$n(e[o],t.concat([o])):{[t.concat([o]).join(r)]:e[o]})),{})}function Hn(e){const t=$n(e),r=[];return Object.keys(t).forEach((e=>{r.push([new q(e),t[e]])})),r}class zn{constructor(){this.store=new Map,this.tempStore=new Map}addConstants(e,t){var r;this.store.has(t)?null==(r=this.store.get(t))||r.set(Hn(e)):this.store.set(t,new Se(e))}getConstants(e,t,r){var n,o,i,a;const s=new q(e);return null!=(a=null!=(i=null==(n=this.tempStore.get(t))?void 0:n.get(s))?i:null==(o=this.store.get(t))?void 0:o.get(s))?a:r}setTemporaryValues(e,t){var r;this.tempStore.has(t)?null==(r=this.tempStore.get(t))||r.set(Hn(e)):this.tempStore.set(t,new Se(e))}clearTemporaryValues(e){var t;e?null==(t=this.tempStore.get(e))||t.reset():this.tempStore.forEach((e=>{e.reset()}))}}class Wn{constructor(){this.name="flow-exp-plugin"}apply(e){let t;const r=e=>{e&&("object"===typeof e&&"exp"in e?null==t||t.evaluate(e.exp):null==t||t.evaluate(e))};e.hooks.expressionEvaluator.tap(this.name,(e=>{t=e})),e.hooks.flowController.tap(this.name,(e=>{e.hooks.flow.tap(this.name,(e=>{e.hooks.onStart.tap(this.name,(e=>r(e))),e.hooks.onEnd.tap(this.name,(e=>r(e))),e.hooks.resolveTransitionNode.intercept({call:e=>{(null==e?void 0:e.onStart)&&r(e.onStart)}})}))}))}}class Yn{constructor(){this.name="flow-exp-plugin"}apply(e){let t;e.hooks.schema.tap(this.name,(e=>{var r;r=e,t=(e,t,n)=>{var o,i;return null!=(i=null==(o=r.getFormatterForType({type:n}))?void 0:o.format(t))?i:t}})),e.hooks.expressionEvaluator.tap(this.name,(r=>{t&&r.addExpressionFunction("format",t),r.addExpressionFunction("log",((t,...r)=>{e.logger.info(...r)})),r.addExpressionFunction("debug",((t,...r)=>{e.logger.debug(...r)})),r.addExpressionFunction("eval",((e,...t)=>e.evaluate(...t)))}))}}const qn={ref:Symbol("not-started"),status:"not-started"};var Gn=Object.defineProperty,Kn=Object.defineProperties,Zn=Object.getOwnPropertyDescriptors,Jn=Object.getOwnPropertySymbols,Qn=Object.prototype.hasOwnProperty,Xn=Object.prototype.propertyIsEnumerable,eo=(e,t,r)=>t in e?Gn(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,to=(e,t)=>{for(var r in t||(t={}))Qn.call(t,r)&&eo(e,r,t[r]);if(Jn)for(var r of Jn(t))Xn.call(t,r)&&eo(e,r,t[r]);return e};const ro=class{constructor(e){var t;this.logger=new pt,this.constantsController=new zn,this.state=qn,this.hooks={flowController:new i.b,viewController:new i.b,view:new i.b,expressionEvaluator:new i.b,dataController:new i.b,schema:new i.b,validationController:new i.b,bindingParser:new i.b,state:new i.b,onStart:new i.b,onEnd:new i.b,resolveFlowContent:new i.c},(null==e?void 0:e.logger)&&this.logger.addHandler(e.logger),this.config=e||{},this.config.plugins=[new Yn,...this.config.plugins||[],new Wn],null==(t=this.config.plugins)||t.forEach((e=>{e.apply(this)}))}getPlugins(){var e;return null!=(e=this.config.plugins)?e:[]}findPlugin(e){var t;return null==(t=this.config.plugins)?void 0:t.find((t=>t.symbol===e))}applyTo(e,t){const r=this.findPlugin(e);r&&t(r)}registerPlugin(e){var t;e.apply(this),null==(t=this.config.plugins)||t.push(e)}getVersion(){return ro.info.version}getCommit(){return ro.info.commit}getState(){return this.state}setState(e){this.state=e,this.hooks.state.call(e)}setupFlow(e){const t=this.hooks.resolveFlowContent.call(e),r=new rn(t.navigation,{logger:this.logger});let n,o;this.hooks.onStart.call(t),this.hooks.flowController.call(r);const i=new he({get:e=>o.get(e),set:e=>o.set(e),evaluate:e=>n.evaluate(e)});this.hooks.bindingParser.call(i);const a=i.parse,s=y()(),l=new At(t.schema);this.hooks.schema.call(l);const u=new _n(l);let c;function h(e,t){return jt(e,{model:o,evaluate:n.evaluate,formatted:t})}var f,p;return this.hooks.validationController.call(u),o=new Ln(t.data,{pathResolver:i,middleware:u.getDataMiddleware(),logger:this.logger}),o.hooks.format.tap("player",((e,t)=>{const r=l.getFormatter(t);return r?r.format(e):e})),o.hooks.deformat.tap("player",((e,t)=>{const r=l.getFormatter(t);return r?r.deformat(e):e})),o.hooks.resolveDefaultValue.tap("player",(e=>{var t;return null==(t=l.getApparentType(e))?void 0:t.default})),n=new lt({model:o,logger:this.logger}),this.hooks.expressionEvaluator.call(n),n.hooks.onError.tap("player",(e=>(s.reject(e),!0))),r.hooks.flow.tap("player",(e=>{e.hooks.beforeTransition.tap("player",((e,t)=>{const r=e.transitions[t]?t:"*";return e.onEnd&&e.transitions[r]&&("object"===typeof e.onEnd&&"exp"in e.onEnd?null==n||n.evaluate(e.onEnd.exp):null==n||n.evaluate(e.onEnd)),"transitions"in e&&e.transitions[r]?Object(d.setIn)(e,["transitions",r],h(e.transitions[r])):e})),e.hooks.skipTransition.tap("validation",(e=>{var t;if("VIEW"===(null==e?void 0:e.value.state_type)){const{canTransition:e,validations:r}=u.validateView("navigation");if(!e&&r){const e=new Set(r.keys());return null==(t=null==c?void 0:c.currentView)||t.update(e),!0}}})),e.hooks.resolveTransitionNode.tap("player",(e=>{let t=e;return"ref"in e&&(t=Object(d.setIn)(e,["ref"],h(e.ref))),"param"in e&&(t=Object(d.setIn)(e,["param"],h(e.param,!1))),t})),e.hooks.transition.tap("player",((e,t)=>{"VIEW"!==t.value.state_type&&u.reset()})),e.hooks.afterTransition.tap("player",(e=>{var t;const o=null==(t=e.currentState)?void 0:t.value;if(o&&"ACTION"===o.state_type){const{exp:e}=o;null==r||r.transition(String(null==n?void 0:n.evaluate(e)))}n.reset()}))})),this.hooks.dataController.call(o),u.setOptions({parseBinding:a,model:o,logger:this.logger,evaluate:n.evaluate,constants:this.constantsController}),c=new Nn(t.views||[],{evaluator:n,parseBinding:a,transition:r.transition,model:o,utils:{findPlugin:e=>this.findPlugin(e)},logger:this.logger,flowController:r,schema:l,format:(e,t)=>{const r=l.getFormatter(e);return(null==r?void 0:r.format)?r.format(t):t},formatValue:(e,t)=>{const r=l.getFormatterForType(e);return(null==r?void 0:r.format)?r.format(t):t},validation:(f=to({},u.forView(a)),p={type:e=>l.getType(a(e))},Kn(f,Zn(p))),constants:this.constantsController}),c.hooks.view.tap("player",(e=>{u.onView(e),this.hooks.view.call(e)})),this.hooks.viewController.call(c),{start:()=>{r.start().then((e=>({endState:h(e,!1),data:o.serialize()}))).then(s.resolve).catch((e=>{throw this.logger.error(`Something went wrong: ${e.message}`),e})).catch(s.reject).finally((()=>this.hooks.onEnd.call()))},state:{status:"in-progress",flowResult:s.promise,controllers:{data:o,view:c,flow:r,schema:l,expression:n,binding:i,validation:u},fail:s.reject,flow:t,logger:this.logger}}}start(e){return t=this,r=null,n=function*(){var t;const r=Symbol(null!=(t=null==e?void 0:e.id)?t:"payload"),n=e=>this.state.ref!==r?(this.logger.warn("Received update for a flow that's not the current one"),e):(this.setState(e),e);this.setState({status:"not-started",ref:r});try{const{state:t,start:o}=this.setupFlow(e);this.setState(to({ref:r},t)),o();const i={ref:r,status:"completed",flow:t.flow,controllers:{data:t.controllers.data.makeReadOnly()}};return n(to(to({},yield t.flowResult),i))}catch(o){throw n({status:"error",ref:r,flow:e,error:o}),o}},new Promise(((e,o)=>{var i=e=>{try{s(n.next(e))}catch(t){o(t)}},a=e=>{try{s(n.throw(e))}catch(t){o(t)}},s=t=>t.done?e(t.value):Promise.resolve(t.value).then(i,a);s((n=n.apply(t,r)).next())}));var t,r,n}};let no=ro;no.info={version:"0.7.2-next.2",commit:"9c00884b3858447c923b999c32acc0b76b5b6421"}},function(e,t){},function(e,t){var r;r=function(){return this}();try{r=r||new Function("return this")()}catch(n){"object"===typeof window&&(r=window)}e.exports=r},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(7);Object.defineProperty(t,"Parser",{enumerable:!0,get:function(){return n.Parser}});var o=r(11);Object.defineProperty(t,"TokenError",{enumerable:!0,get:function(){return o.TokenError}}),t.Grammars=r(44)},function(e,t,r){(function(t){let r;e.exports="function"===typeof queueMicrotask?queueMicrotask.bind("undefined"!==typeof window?window:t):e=>(r||(r=Promise.resolve())).then(e).catch((e=>setTimeout((()=>{throw e}),0)))}).call(this,r(18))},function(e,t,r){"use strict";r.d(t,"a",(function(){return c}));var n=r(22),o=r.n(n),i=r(6),a=r.n(i);function s(e,t=[],r=new Map){for(const n of Object.keys(e)){const o=e[n],i=[...t,n];"object"===typeof o?s(o,i,r):r.set(i,o)}return r}function l(e){const t=s(e),r=e=>{for(const r of t){const[t,n]=r;if(a()(e,t)!==n)return!1}return!0};return r.count=t.size,r}const u=()=>new o.a([],(e=>e.matcher.count));class c{constructor(e){this.store=u(),null==e||e.forEach((([e,t])=>{this.set(e,t)}))}set(e,t){const r="object"===typeof e?l(e):function(e){const t=t=>e===t;return t.count=1,t}(e);this.store.insert({key:e,value:t,matcher:r})}get(e){for(const t of this.store.array)if(t.matcher(e))return t.value}forEach(e){for(const t of this.store.array)e(t)}clear(){this.store=u()}}},function(e,t,r){var n,o=function(){var e=function(e){var t=e.constructor;return t.prototype=e,t}({constructor:function(e,r){this.array=[],this.compare=r||t;for(var n=e.length,o=0;o<n;)this.insert(e[o++])},insert:function(e){for(var t,r,n=this.array,o=this.compare,i=n.length-1,a=0,s=-1;i>=a;)if((r=o(n[t=(i+a)/2>>>0],e))<0)a=t+1;else{if(!(r>0)){s=t;break}i=t-1}for(-1===s&&(s=i),s++,i=n.length-1;s<i&&0===o(e,n[s]);)s++;for(t=n.length,n.push(e);t>s;)n[t]=n[--t];return n[s]=e,this},search:function(e){for(var t,r,n=this.array,o=this.compare,i=n.length-1,a=0;i>=a;)if((r=o(n[t=(i+a)/2>>>0],e))<0)a=t+1;else{if(!(r>0))return t;i=t-1}return-1},remove:function(e){var t=this.search(e);return t>=0&&this.array.splice(t,1),this}});return e.comparing=function(r,n){return new e(n,(function(e,n){return t(e[r],n[r])}))},e;function t(e,t){return e<t?-1:e>t?1:0}}();e.exports=o,void 0===(n=function(){return o}.call(t,r,t,e))||(e.exports=n)},function(e,t,r){"use strict";r.r(t);r(24);var n=r(16);for(var o in n)["default"].indexOf(o)<0&&function(e){r.d(t,e,(function(){return n[e]}))}(o)},function(e,t,r){e.exports=r(25)},function(e,t,r){r(14);var n,o=r(9);n=o("Error.captureStackTrace")?r(28):o("Error.prototype.stack")?r(29):r(39),e.exports=n()},function(e,t,r){var n=r(15),o=n.define,i=n.test;o("strict mode",(function(){return void 0===this})),o("arguments.callee.caller",(function(){try{return function(){return arguments.callee.caller}()===arguments.callee}catch(e){return!1}})),o("es5",(function(){return i("Array.prototype.forEach")&&i("Array.prototype.map")&&i("Function.prototype.bind")&&i("Object.create")&&i("Object.defineProperties")&&i("Object.defineProperty")&&i("Object.prototype.hasOwnProperty")})),o("Array.prototype.forEach",(function(){return Array.prototype.forEach})),o("Array.prototype.map",(function(){return Array.prototype.map})),o("Function.prototype.bind",(function(){return Function.prototype.bind})),o("Object.create",(function(){return Object.create})),o("Object.defineProperties",(function(){return Object.defineProperties})),o("Object.defineProperty",(function(){return Object.defineProperty})),o("Object.prototype.hasOwnProperty",(function(){return Object.prototype.hasOwnProperty})),o("Error.captureStackTrace",(function(){return Error.captureStackTrace})),o("Error.prototype.stack",(function(){try{throw new Error}catch(e){return e.stack||e.stacktrace}}))},function(e,t){var r=function(){this.tests={},this.cache={}};r.prototype={constructor:r,define:function(e,t){if("string"!=typeof e||!(t instanceof Function))throw new Error("Invalid capability definition.");if(this.tests[e])throw new Error('Duplicated capability definition by "'+e+'".');this.tests[e]=t},check:function(e){if(!this.test(e))throw new Error('The current environment does not support "'+e+'", therefore we cannot continue.')},test:function(e){if(void 0!==this.cache[e])return this.cache[e];if(!this.tests[e])throw new Error('Unknown capability with name "'+e+'".');var t=this.tests[e];return this.cache[e]=!!t(),this.cache[e]}},e.exports=r},function(e,t,r){var n=r(10);e.exports=function(){return Error.getStackTrace=function(e){return e.stack},{prepareStackTrace:n}}},function(e,t,r){var n=r(30),o=r(37),i=r(5).cache,a=r(10);e.exports=function(){return Error.captureStackTrace=function e(t,r){var s=[e];r&&s.push(r);var l=n.getInstance().captureFrameStrings(s);Object.defineProperties(t,{stack:{configurable:!0,get:i((function(){var e=o.getInstance().getFrames(l.frameStrings,l.functionValues);return(Error.prepareStackTrace||a)(t,e,undefined)}))},cachedStack:{configurable:!0,writable:!0,enumerable:!1,value:!0}})},Error.getStackTrace=function(e){if(e.cachedStack)return e.stack;var t,r=n.getInstance().getFrameStrings(e),i=[];r?i=o.getInstance().getFrames(r,[]):t=["The stack is not readable by unthrown errors in this environment."];var s=(Error.prepareStackTrace||a)(e,i,t);if(r)try{Object.defineProperties(e,{stack:{configurable:!0,writable:!0,enumerable:!1,value:s},cachedStack:{configurable:!0,writable:!0,enumerable:!1,value:!0}})}catch(l){}return s},{prepareStackTrace:a}}},function(e,t,r){var n=r(4).Class,o=r(4).abstractMethod,i=r(5).eachCombination,a=r(5).cache,s=r(9),l=n(Object,{prototype:{captureFrameStrings:function(e){var t=this.createError();e.unshift(this.captureFrameStrings),e.unshift(this.createError);var r=this.getFrameStrings(t),n=r.slice(e.length),o=[];if(s("arguments.callee.caller")){var i=[this.createError,this.captureFrameStrings];try{for(var a=arguments.callee;a=a.caller;)i.push(a)}catch(l){}o=i.slice(e.length)}return{frameStrings:n,functionValues:o}},getFrameStrings:function(e){var t=e.message||"",r=e.name||"",n=this.getStackString(e);if(void 0!==n){var o=n.split("\n"),i=0,a=o.length;return this.hasHeader&&(i+=r.split("\n").length+t.split("\n").length-1),this.hasFooter&&(a-=1),o.slice(i,a)}},createError:o,getStackString:o,hasHeader:void 0,hasFooter:void 0}}),u=n(Object,{prototype:{calibrateClass:function(e){return this.calibrateMethods(e)&&this.calibrateEnvelope(e)},calibrateMethods:function(e){try{i([[function(e){return new Error(e)},function(e){try{throw new Error(e)}catch(t){return t}}],[function(e){return e.stack},function(e){return e.stacktrace}]],(function(e,t){if(t(e()))throw{getStackString:t,createError:e}}))}catch(t){return n.merge.call(e,{prototype:t}),!0}return!1},calibrateEnvelope:function(e){var t=(0,e.prototype.getStackString)((0,e.prototype.createError)("marker")).split("\n");return n.merge.call(e,{prototype:{hasHeader:/marker/.test(t[0]),hasFooter:""===t[t.length-1]}}),!0}}});e.exports={getClass:a((function(){var e;if(e)return e;if(e=n(l,{}),!(new u).calibrateClass(e))throw new Error("Cannot read Error.prototype.stack in this environment.");return e})),getInstance:a((function(){return new(this.getClass())}))}},function(e,t,r){e.exports={Class:r(32),abstractMethod:r(33)}},function(e,t){var r=function(){var e=Object.create({Source:Object,config:{},buildArgs:[]});function t(t){var r="config";if(t instanceof Function)r="Source";else if(t instanceof Array)r="buildArgs";else{if(!(t instanceof Object))throw new Error("Invalid configuration option.");r="config"}if(e.hasOwnProperty(r))throw new Error("Duplicated configuration option: "+r+".");e[r]=t}for(var n=0,o=arguments.length;n<o;++n)t(arguments[n]);var i=e.Source,a=e.config,s=e.buildArgs;return(i.extend||r.extend).call(i,a,s)};r.factory=function(){return function(){var e=this;e.build instanceof Function&&e.build.apply(e,arguments),e.init instanceof Function&&e.init.apply(e,arguments)}},r.extend=function(e,t){var n,o=this;return e||(e={}),e.prototype instanceof Object&&e.prototype.constructor!==Object?n=e.prototype.constructor:e.factory instanceof Function&&(n=e.factory.call(o)),((n=(o.clone||r.clone).call(o,n,t)).merge||r.merge).call(n,e),n},r.prototype.extend=function(e,t){var n=(this.clone||r.prototype.clone).apply(this,t);return(n.merge||r.prototype.merge).call(n,e),n},r.clone=function(e,t){var n=this;for(var o in e instanceof Function||(e=(n.factory||r.factory).call(n)),e.prototype=(n.prototype.clone||r.prototype.clone).apply(n.prototype,t||[]),e.prototype.constructor=e,n)"prototype"!==o&&(e[o]=n[o]);return e},r.prototype.clone=function(){var e=this,t=Object.create(e);return t.build instanceof Function&&t.build.apply(t,arguments),t},r.merge=function(e){var t=this;for(var n in e)"prototype"!==n&&(t[n]=e[n]);return e.prototype instanceof Object&&(t.prototype.merge||r.prototype.merge).call(t.prototype,e.prototype),t},r.prototype.merge=function(e){for(var t in e)"constructor"!==t&&(this[t]=e[t]);return this},r.absorb=function(e){var t=this;for(var n in e)"prototype"===n||void 0!==t[n]&&t[n]!==Function.prototype[n]||(t[n]=e[n]);return e.prototype instanceof Object&&(t.prototype.absorb||r.prototype.absorb).call(t.prototype,e.prototype),t},r.prototype.absorb=function(e){var t=this;for(var r in e)"constructor"===r||void 0!==t[r]&&t[r]!==Object.prototype[r]||(t[r]=e[r]);return t},r.getAncestor=function(){var e=this;if(e!==e.prototype.constructor)return e.prototype.constructor},r.newInstance=function(){var e=this,t=Object.create(this.prototype);return e.apply(t,arguments),t},e.exports=r},function(e,t){e.exports=function(){throw new Error("Not implemented.")}},function(e,t,r){e.exports={cache:r(35),eachCombination:r(36)}},function(e,t){e.exports=function(e){var t,r=!1;return e instanceof Function||(r=!0,t=e,e=null),function(){return r||(r=!0,t=e.apply(this,arguments),e=null),t}}},function(e,t){e.exports=function e(t,r,n){if(n||(n=[]),n.length<t.length){var o=t[n.length];for(var i in o)n[n.length]=o[i],e(t,r,n),--n.length}else r.apply(null,n)}},function(e,t,r){var n=r(4).Class,o=r(38),i=r(5).cache,a=n(Object,{prototype:{stackParser:null,frameParser:null,locationParsers:null,constructor:function(e){n.prototype.merge.call(this,e)},getFrames:function(e,t){for(var r=[],n=0,o=e.length;n<o;++n)r[n]=this.getFrame(e[n],t[n]);return r},getFrame:function(e,t){return new o({frameString:e,functionValue:t})}}});e.exports={getClass:i((function(){return a})),getInstance:i((function(){return new(this.getClass())}))}},function(e,t,r){var n=r(4).Class,o=r(4).abstractMethod,i=n(Object,{prototype:{init:n.prototype.merge,frameString:void 0,toString:function(){return this.frameString},functionValue:void 0,getThis:o,getTypeName:o,getFunction:function(){return this.functionValue},getFunctionName:o,getMethodName:o,getFileName:o,getLineNumber:o,getColumnNumber:o,getEvalOrigin:o,isTopLevel:o,isEval:o,isNative:o,isConstructor:o}});e.exports=i},function(e,t,r){var n=r(5).cache,o=r(10);e.exports=function(){return Error.captureStackTrace=function(e,t){Object.defineProperties(e,{stack:{configurable:!0,get:n((function(){return(Error.prepareStackTrace||o)(e,[])}))},cachedStack:{configurable:!0,writable:!0,enumerable:!1,value:!0}})},Error.getStackTrace=function(e){if(e.cachedStack)return e.stack;var t=(Error.prepareStackTrace||o)(e,[]);try{Object.defineProperties(e,{stack:{configurable:!0,writable:!0,enumerable:!1,value:t},cachedStack:{configurable:!0,writable:!0,enumerable:!1,value:!0}})}catch(r){}return t},{prepareStackTrace:o}}},function(e,t,r){"use strict";(function(e){var n=r(41),o=r(42),i=r(43);function a(){return l.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function s(e,t){if(a()<t)throw new RangeError("Invalid typed array length");return l.TYPED_ARRAY_SUPPORT?(e=new Uint8Array(t)).__proto__=l.prototype:(null===e&&(e=new l(t)),e.length=t),e}function l(e,t,r){if(!l.TYPED_ARRAY_SUPPORT&&!(this instanceof l))return new l(e,t,r);if("number"===typeof e){if("string"===typeof t)throw new Error("If encoding is specified then the first argument must be a string");return h(this,e)}return u(this,e,t,r)}function u(e,t,r,n){if("number"===typeof t)throw new TypeError('"value" argument must not be a number');return"undefined"!==typeof ArrayBuffer&&t instanceof ArrayBuffer?function(e,t,r,n){if(t.byteLength,r<0||t.byteLength<r)throw new RangeError("'offset' is out of bounds");if(t.byteLength<r+(n||0))throw new RangeError("'length' is out of bounds");t=void 0===r&&void 0===n?new Uint8Array(t):void 0===n?new Uint8Array(t,r):new Uint8Array(t,r,n);l.TYPED_ARRAY_SUPPORT?(e=t).__proto__=l.prototype:e=f(e,t);return e}(e,t,r,n):"string"===typeof t?function(e,t,r){"string"===typeof r&&""!==r||(r="utf8");if(!l.isEncoding(r))throw new TypeError('"encoding" must be a valid string encoding');var n=0|d(t,r),o=(e=s(e,n)).write(t,r);o!==n&&(e=e.slice(0,o));return e}(e,t,r):function(e,t){if(l.isBuffer(t)){var r=0|p(t.length);return 0===(e=s(e,r)).length||t.copy(e,0,0,r),e}if(t){if("undefined"!==typeof ArrayBuffer&&t.buffer instanceof ArrayBuffer||"length"in t)return"number"!==typeof t.length||(n=t.length)!==n?s(e,0):f(e,t);if("Buffer"===t.type&&i(t.data))return f(e,t.data)}var n;throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}(e,t)}function c(e){if("number"!==typeof e)throw new TypeError('"size" argument must be a number');if(e<0)throw new RangeError('"size" argument must not be negative')}function h(e,t){if(c(t),e=s(e,t<0?0:0|p(t)),!l.TYPED_ARRAY_SUPPORT)for(var r=0;r<t;++r)e[r]=0;return e}function f(e,t){var r=t.length<0?0:0|p(t.length);e=s(e,r);for(var n=0;n<r;n+=1)e[n]=255&t[n];return e}function p(e){if(e>=a())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+a().toString(16)+" bytes");return 0|e}function d(e,t){if(l.isBuffer(e))return e.length;if("undefined"!==typeof ArrayBuffer&&"function"===typeof ArrayBuffer.isView&&(ArrayBuffer.isView(e)||e instanceof ArrayBuffer))return e.byteLength;"string"!==typeof e&&(e=""+e);var r=e.length;if(0===r)return 0;for(var n=!1;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":case void 0:return F(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return $(e).length;default:if(n)return F(e).length;t=(""+t).toLowerCase(),n=!0}}function g(e,t,r){var n=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return T(this,t,r);case"utf8":case"utf-8":return k(this,t,r);case"ascii":return R(this,t,r);case"latin1":case"binary":return _(this,t,r);case"base64":return A(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return C(this,t,r);default:if(n)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),n=!0}}function v(e,t,r){var n=e[t];e[t]=e[r],e[r]=n}function y(e,t,r,n,o){if(0===e.length)return-1;if("string"===typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,isNaN(r)&&(r=o?0:e.length-1),r<0&&(r=e.length+r),r>=e.length){if(o)return-1;r=e.length-1}else if(r<0){if(!o)return-1;r=0}if("string"===typeof t&&(t=l.from(t,n)),l.isBuffer(t))return 0===t.length?-1:m(e,t,r,n,o);if("number"===typeof t)return t&=255,l.TYPED_ARRAY_SUPPORT&&"function"===typeof Uint8Array.prototype.indexOf?o?Uint8Array.prototype.indexOf.call(e,t,r):Uint8Array.prototype.lastIndexOf.call(e,t,r):m(e,[t],r,n,o);throw new TypeError("val must be string, number or Buffer")}function m(e,t,r,n,o){var i,a=1,s=e.length,l=t.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(e.length<2||t.length<2)return-1;a=2,s/=2,l/=2,r/=2}function u(e,t){return 1===a?e[t]:e.readUInt16BE(t*a)}if(o){var c=-1;for(i=r;i<s;i++)if(u(e,i)===u(t,-1===c?0:i-c)){if(-1===c&&(c=i),i-c+1===l)return c*a}else-1!==c&&(i-=i-c),c=-1}else for(r+l>s&&(r=s-l),i=r;i>=0;i--){for(var h=!0,f=0;f<l;f++)if(u(e,i+f)!==u(t,f)){h=!1;break}if(h)return i}return-1}function b(e,t,r,n){r=Number(r)||0;var o=e.length-r;n?(n=Number(n))>o&&(n=o):n=o;var i=t.length;if(i%2!==0)throw new TypeError("Invalid hex string");n>i/2&&(n=i/2);for(var a=0;a<n;++a){var s=parseInt(t.substr(2*a,2),16);if(isNaN(s))return a;e[r+a]=s}return a}function w(e,t,r,n){return H(F(t,e.length-r),e,r,n)}function E(e,t,r,n){return H(function(e){for(var t=[],r=0;r<e.length;++r)t.push(255&e.charCodeAt(r));return t}(t),e,r,n)}function S(e,t,r,n){return E(e,t,r,n)}function O(e,t,r,n){return H($(t),e,r,n)}function x(e,t,r,n){return H(function(e,t){for(var r,n,o,i=[],a=0;a<e.length&&!((t-=2)<0);++a)n=(r=e.charCodeAt(a))>>8,o=r%256,i.push(o),i.push(n);return i}(t,e.length-r),e,r,n)}function A(e,t,r){return 0===t&&r===e.length?n.fromByteArray(e):n.fromByteArray(e.slice(t,r))}function k(e,t,r){r=Math.min(e.length,r);for(var n=[],o=t;o<r;){var i,a,s,l,u=e[o],c=null,h=u>239?4:u>223?3:u>191?2:1;if(o+h<=r)switch(h){case 1:u<128&&(c=u);break;case 2:128===(192&(i=e[o+1]))&&(l=(31&u)<<6|63&i)>127&&(c=l);break;case 3:i=e[o+1],a=e[o+2],128===(192&i)&&128===(192&a)&&(l=(15&u)<<12|(63&i)<<6|63&a)>2047&&(l<55296||l>57343)&&(c=l);break;case 4:i=e[o+1],a=e[o+2],s=e[o+3],128===(192&i)&&128===(192&a)&&128===(192&s)&&(l=(15&u)<<18|(63&i)<<12|(63&a)<<6|63&s)>65535&&l<1114112&&(c=l)}null===c?(c=65533,h=1):c>65535&&(c-=65536,n.push(c>>>10&1023|55296),c=56320|1023&c),n.push(c),o+=h}return function(e){var t=e.length;if(t<=P)return String.fromCharCode.apply(String,e);var r="",n=0;for(;n<t;)r+=String.fromCharCode.apply(String,e.slice(n,n+=P));return r}(n)}t.Buffer=l,t.SlowBuffer=function(e){+e!=e&&(e=0);return l.alloc(+e)},t.INSPECT_MAX_BYTES=50,l.TYPED_ARRAY_SUPPORT=void 0!==e.TYPED_ARRAY_SUPPORT?e.TYPED_ARRAY_SUPPORT:function(){try{var e=new Uint8Array(1);return e.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===e.foo()&&"function"===typeof e.subarray&&0===e.subarray(1,1).byteLength}catch(t){return!1}}(),t.kMaxLength=a(),l.poolSize=8192,l._augment=function(e){return e.__proto__=l.prototype,e},l.from=function(e,t,r){return u(null,e,t,r)},l.TYPED_ARRAY_SUPPORT&&(l.prototype.__proto__=Uint8Array.prototype,l.__proto__=Uint8Array,"undefined"!==typeof Symbol&&Symbol.species&&l[Symbol.species]===l&&Object.defineProperty(l,Symbol.species,{value:null,configurable:!0})),l.alloc=function(e,t,r){return function(e,t,r,n){return c(t),t<=0?s(e,t):void 0!==r?"string"===typeof n?s(e,t).fill(r,n):s(e,t).fill(r):s(e,t)}(null,e,t,r)},l.allocUnsafe=function(e){return h(null,e)},l.allocUnsafeSlow=function(e){return h(null,e)},l.isBuffer=function(e){return!(null==e||!e._isBuffer)},l.compare=function(e,t){if(!l.isBuffer(e)||!l.isBuffer(t))throw new TypeError("Arguments must be Buffers");if(e===t)return 0;for(var r=e.length,n=t.length,o=0,i=Math.min(r,n);o<i;++o)if(e[o]!==t[o]){r=e[o],n=t[o];break}return r<n?-1:n<r?1:0},l.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},l.concat=function(e,t){if(!i(e))throw new TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return l.alloc(0);var r;if(void 0===t)for(t=0,r=0;r<e.length;++r)t+=e[r].length;var n=l.allocUnsafe(t),o=0;for(r=0;r<e.length;++r){var a=e[r];if(!l.isBuffer(a))throw new TypeError('"list" argument must be an Array of Buffers');a.copy(n,o),o+=a.length}return n},l.byteLength=d,l.prototype._isBuffer=!0,l.prototype.swap16=function(){var e=this.length;if(e%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var t=0;t<e;t+=2)v(this,t,t+1);return this},l.prototype.swap32=function(){var e=this.length;if(e%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var t=0;t<e;t+=4)v(this,t,t+3),v(this,t+1,t+2);return this},l.prototype.swap64=function(){var e=this.length;if(e%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var t=0;t<e;t+=8)v(this,t,t+7),v(this,t+1,t+6),v(this,t+2,t+5),v(this,t+3,t+4);return this},l.prototype.toString=function(){var e=0|this.length;return 0===e?"":0===arguments.length?k(this,0,e):g.apply(this,arguments)},l.prototype.equals=function(e){if(!l.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e||0===l.compare(this,e)},l.prototype.inspect=function(){var e="",r=t.INSPECT_MAX_BYTES;return this.length>0&&(e=this.toString("hex",0,r).match(/.{2}/g).join(" "),this.length>r&&(e+=" ... ")),"<Buffer "+e+">"},l.prototype.compare=function(e,t,r,n,o){if(!l.isBuffer(e))throw new TypeError("Argument must be a Buffer");if(void 0===t&&(t=0),void 0===r&&(r=e?e.length:0),void 0===n&&(n=0),void 0===o&&(o=this.length),t<0||r>e.length||n<0||o>this.length)throw new RangeError("out of range index");if(n>=o&&t>=r)return 0;if(n>=o)return-1;if(t>=r)return 1;if(this===e)return 0;for(var i=(o>>>=0)-(n>>>=0),a=(r>>>=0)-(t>>>=0),s=Math.min(i,a),u=this.slice(n,o),c=e.slice(t,r),h=0;h<s;++h)if(u[h]!==c[h]){i=u[h],a=c[h];break}return i<a?-1:a<i?1:0},l.prototype.includes=function(e,t,r){return-1!==this.indexOf(e,t,r)},l.prototype.indexOf=function(e,t,r){return y(this,e,t,r,!0)},l.prototype.lastIndexOf=function(e,t,r){return y(this,e,t,r,!1)},l.prototype.write=function(e,t,r,n){if(void 0===t)n="utf8",r=this.length,t=0;else if(void 0===r&&"string"===typeof t)n=t,r=this.length,t=0;else{if(!isFinite(t))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");t|=0,isFinite(r)?(r|=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}var o=this.length-t;if((void 0===r||r>o)&&(r=o),e.length>0&&(r<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var i=!1;;)switch(n){case"hex":return b(this,e,t,r);case"utf8":case"utf-8":return w(this,e,t,r);case"ascii":return E(this,e,t,r);case"latin1":case"binary":return S(this,e,t,r);case"base64":return O(this,e,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return x(this,e,t,r);default:if(i)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),i=!0}},l.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var P=4096;function R(e,t,r){var n="";r=Math.min(e.length,r);for(var o=t;o<r;++o)n+=String.fromCharCode(127&e[o]);return n}function _(e,t,r){var n="";r=Math.min(e.length,r);for(var o=t;o<r;++o)n+=String.fromCharCode(e[o]);return n}function T(e,t,r){var n=e.length;(!t||t<0)&&(t=0),(!r||r<0||r>n)&&(r=n);for(var o="",i=t;i<r;++i)o+=V(e[i]);return o}function C(e,t,r){for(var n=e.slice(t,r),o="",i=0;i<n.length;i+=2)o+=String.fromCharCode(n[i]+256*n[i+1]);return o}function j(e,t,r){if(e%1!==0||e<0)throw new RangeError("offset is not uint");if(e+t>r)throw new RangeError("Trying to access beyond buffer length")}function N(e,t,r,n,o,i){if(!l.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>o||t<i)throw new RangeError('"value" argument is out of bounds');if(r+n>e.length)throw new RangeError("Index out of range")}function U(e,t,r,n){t<0&&(t=65535+t+1);for(var o=0,i=Math.min(e.length-r,2);o<i;++o)e[r+o]=(t&255<<8*(n?o:1-o))>>>8*(n?o:1-o)}function L(e,t,r,n){t<0&&(t=4294967295+t+1);for(var o=0,i=Math.min(e.length-r,4);o<i;++o)e[r+o]=t>>>8*(n?o:3-o)&255}function B(e,t,r,n,o,i){if(r+n>e.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function I(e,t,r,n,i){return i||B(e,0,r,4),o.write(e,t,r,n,23,4),r+4}function D(e,t,r,n,i){return i||B(e,0,r,8),o.write(e,t,r,n,52,8),r+8}l.prototype.slice=function(e,t){var r,n=this.length;if((e=~~e)<0?(e+=n)<0&&(e=0):e>n&&(e=n),(t=void 0===t?n:~~t)<0?(t+=n)<0&&(t=0):t>n&&(t=n),t<e&&(t=e),l.TYPED_ARRAY_SUPPORT)(r=this.subarray(e,t)).__proto__=l.prototype;else{var o=t-e;r=new l(o,void 0);for(var i=0;i<o;++i)r[i]=this[i+e]}return r},l.prototype.readUIntLE=function(e,t,r){e|=0,t|=0,r||j(e,t,this.length);for(var n=this[e],o=1,i=0;++i<t&&(o*=256);)n+=this[e+i]*o;return n},l.prototype.readUIntBE=function(e,t,r){e|=0,t|=0,r||j(e,t,this.length);for(var n=this[e+--t],o=1;t>0&&(o*=256);)n+=this[e+--t]*o;return n},l.prototype.readUInt8=function(e,t){return t||j(e,1,this.length),this[e]},l.prototype.readUInt16LE=function(e,t){return t||j(e,2,this.length),this[e]|this[e+1]<<8},l.prototype.readUInt16BE=function(e,t){return t||j(e,2,this.length),this[e]<<8|this[e+1]},l.prototype.readUInt32LE=function(e,t){return t||j(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},l.prototype.readUInt32BE=function(e,t){return t||j(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},l.prototype.readIntLE=function(e,t,r){e|=0,t|=0,r||j(e,t,this.length);for(var n=this[e],o=1,i=0;++i<t&&(o*=256);)n+=this[e+i]*o;return n>=(o*=128)&&(n-=Math.pow(2,8*t)),n},l.prototype.readIntBE=function(e,t,r){e|=0,t|=0,r||j(e,t,this.length);for(var n=t,o=1,i=this[e+--n];n>0&&(o*=256);)i+=this[e+--n]*o;return i>=(o*=128)&&(i-=Math.pow(2,8*t)),i},l.prototype.readInt8=function(e,t){return t||j(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},l.prototype.readInt16LE=function(e,t){t||j(e,2,this.length);var r=this[e]|this[e+1]<<8;return 32768&r?4294901760|r:r},l.prototype.readInt16BE=function(e,t){t||j(e,2,this.length);var r=this[e+1]|this[e]<<8;return 32768&r?4294901760|r:r},l.prototype.readInt32LE=function(e,t){return t||j(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},l.prototype.readInt32BE=function(e,t){return t||j(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},l.prototype.readFloatLE=function(e,t){return t||j(e,4,this.length),o.read(this,e,!0,23,4)},l.prototype.readFloatBE=function(e,t){return t||j(e,4,this.length),o.read(this,e,!1,23,4)},l.prototype.readDoubleLE=function(e,t){return t||j(e,8,this.length),o.read(this,e,!0,52,8)},l.prototype.readDoubleBE=function(e,t){return t||j(e,8,this.length),o.read(this,e,!1,52,8)},l.prototype.writeUIntLE=function(e,t,r,n){(e=+e,t|=0,r|=0,n)||N(this,e,t,r,Math.pow(2,8*r)-1,0);var o=1,i=0;for(this[t]=255&e;++i<r&&(o*=256);)this[t+i]=e/o&255;return t+r},l.prototype.writeUIntBE=function(e,t,r,n){(e=+e,t|=0,r|=0,n)||N(this,e,t,r,Math.pow(2,8*r)-1,0);var o=r-1,i=1;for(this[t+o]=255&e;--o>=0&&(i*=256);)this[t+o]=e/i&255;return t+r},l.prototype.writeUInt8=function(e,t,r){return e=+e,t|=0,r||N(this,e,t,1,255,0),l.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=255&e,t+1},l.prototype.writeUInt16LE=function(e,t,r){return e=+e,t|=0,r||N(this,e,t,2,65535,0),l.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):U(this,e,t,!0),t+2},l.prototype.writeUInt16BE=function(e,t,r){return e=+e,t|=0,r||N(this,e,t,2,65535,0),l.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):U(this,e,t,!1),t+2},l.prototype.writeUInt32LE=function(e,t,r){return e=+e,t|=0,r||N(this,e,t,4,4294967295,0),l.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e):L(this,e,t,!0),t+4},l.prototype.writeUInt32BE=function(e,t,r){return e=+e,t|=0,r||N(this,e,t,4,4294967295,0),l.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):L(this,e,t,!1),t+4},l.prototype.writeIntLE=function(e,t,r,n){if(e=+e,t|=0,!n){var o=Math.pow(2,8*r-1);N(this,e,t,r,o-1,-o)}var i=0,a=1,s=0;for(this[t]=255&e;++i<r&&(a*=256);)e<0&&0===s&&0!==this[t+i-1]&&(s=1),this[t+i]=(e/a>>0)-s&255;return t+r},l.prototype.writeIntBE=function(e,t,r,n){if(e=+e,t|=0,!n){var o=Math.pow(2,8*r-1);N(this,e,t,r,o-1,-o)}var i=r-1,a=1,s=0;for(this[t+i]=255&e;--i>=0&&(a*=256);)e<0&&0===s&&0!==this[t+i+1]&&(s=1),this[t+i]=(e/a>>0)-s&255;return t+r},l.prototype.writeInt8=function(e,t,r){return e=+e,t|=0,r||N(this,e,t,1,127,-128),l.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[t]=255&e,t+1},l.prototype.writeInt16LE=function(e,t,r){return e=+e,t|=0,r||N(this,e,t,2,32767,-32768),l.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):U(this,e,t,!0),t+2},l.prototype.writeInt16BE=function(e,t,r){return e=+e,t|=0,r||N(this,e,t,2,32767,-32768),l.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):U(this,e,t,!1),t+2},l.prototype.writeInt32LE=function(e,t,r){return e=+e,t|=0,r||N(this,e,t,4,2147483647,-2147483648),l.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):L(this,e,t,!0),t+4},l.prototype.writeInt32BE=function(e,t,r){return e=+e,t|=0,r||N(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),l.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):L(this,e,t,!1),t+4},l.prototype.writeFloatLE=function(e,t,r){return I(this,e,t,!0,r)},l.prototype.writeFloatBE=function(e,t,r){return I(this,e,t,!1,r)},l.prototype.writeDoubleLE=function(e,t,r){return D(this,e,t,!0,r)},l.prototype.writeDoubleBE=function(e,t,r){return D(this,e,t,!1,r)},l.prototype.copy=function(e,t,r,n){if(r||(r=0),n||0===n||(n=this.length),t>=e.length&&(t=e.length),t||(t=0),n>0&&n<r&&(n=r),n===r)return 0;if(0===e.length||0===this.length)return 0;if(t<0)throw new RangeError("targetStart out of bounds");if(r<0||r>=this.length)throw new RangeError("sourceStart out of bounds");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),e.length-t<n-r&&(n=e.length-t+r);var o,i=n-r;if(this===e&&r<t&&t<n)for(o=i-1;o>=0;--o)e[o+t]=this[o+r];else if(i<1e3||!l.TYPED_ARRAY_SUPPORT)for(o=0;o<i;++o)e[o+t]=this[o+r];else Uint8Array.prototype.set.call(e,this.subarray(r,r+i),t);return i},l.prototype.fill=function(e,t,r,n){if("string"===typeof e){if("string"===typeof t?(n=t,t=0,r=this.length):"string"===typeof r&&(n=r,r=this.length),1===e.length){var o=e.charCodeAt(0);o<256&&(e=o)}if(void 0!==n&&"string"!==typeof n)throw new TypeError("encoding must be a string");if("string"===typeof n&&!l.isEncoding(n))throw new TypeError("Unknown encoding: "+n)}else"number"===typeof e&&(e&=255);if(t<0||this.length<t||this.length<r)throw new RangeError("Out of range index");if(r<=t)return this;var i;if(t>>>=0,r=void 0===r?this.length:r>>>0,e||(e=0),"number"===typeof e)for(i=t;i<r;++i)this[i]=e;else{var a=l.isBuffer(e)?e:F(new l(e,n).toString()),s=a.length;for(i=0;i<r-t;++i)this[i+t]=a[i%s]}return this};var M=/[^+\/0-9A-Za-z-_]/g;function V(e){return e<16?"0"+e.toString(16):e.toString(16)}function F(e,t){var r;t=t||1/0;for(var n=e.length,o=null,i=[],a=0;a<n;++a){if((r=e.charCodeAt(a))>55295&&r<57344){if(!o){if(r>56319){(t-=3)>-1&&i.push(239,191,189);continue}if(a+1===n){(t-=3)>-1&&i.push(239,191,189);continue}o=r;continue}if(r<56320){(t-=3)>-1&&i.push(239,191,189),o=r;continue}r=65536+(o-55296<<10|r-56320)}else o&&(t-=3)>-1&&i.push(239,191,189);if(o=null,r<128){if((t-=1)<0)break;i.push(r)}else if(r<2048){if((t-=2)<0)break;i.push(r>>6|192,63&r|128)}else if(r<65536){if((t-=3)<0)break;i.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;i.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return i}function $(e){return n.toByteArray(function(e){if((e=function(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}(e).replace(M,"")).length<2)return"";for(;e.length%4!==0;)e+="=";return e}(e))}function H(e,t,r,n){for(var o=0;o<n&&!(o+r>=t.length||o>=e.length);++o)t[o+r]=e[o];return o}}).call(this,r(18))},function(e,t,r){"use strict";t.byteLength=function(e){var t=u(e),r=t[0],n=t[1];return 3*(r+n)/4-n},t.toByteArray=function(e){var t,r,n=u(e),a=n[0],s=n[1],l=new i(function(e,t,r){return 3*(t+r)/4-r}(0,a,s)),c=0,h=s>0?a-4:a;for(r=0;r<h;r+=4)t=o[e.charCodeAt(r)]<<18|o[e.charCodeAt(r+1)]<<12|o[e.charCodeAt(r+2)]<<6|o[e.charCodeAt(r+3)],l[c++]=t>>16&255,l[c++]=t>>8&255,l[c++]=255&t;2===s&&(t=o[e.charCodeAt(r)]<<2|o[e.charCodeAt(r+1)]>>4,l[c++]=255&t);1===s&&(t=o[e.charCodeAt(r)]<<10|o[e.charCodeAt(r+1)]<<4|o[e.charCodeAt(r+2)]>>2,l[c++]=t>>8&255,l[c++]=255&t);return l},t.fromByteArray=function(e){for(var t,r=e.length,o=r%3,i=[],a=16383,s=0,l=r-o;s<l;s+=a)i.push(c(e,s,s+a>l?l:s+a));1===o?(t=e[r-1],i.push(n[t>>2]+n[t<<4&63]+"==")):2===o&&(t=(e[r-2]<<8)+e[r-1],i.push(n[t>>10]+n[t>>4&63]+n[t<<2&63]+"="));return i.join("")};for(var n=[],o=[],i="undefined"!==typeof Uint8Array?Uint8Array:Array,a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",s=0,l=a.length;s<l;++s)n[s]=a[s],o[a.charCodeAt(s)]=s;function u(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=e.indexOf("=");return-1===r&&(r=t),[r,r===t?0:4-r%4]}function c(e,t,r){for(var o,i,a=[],s=t;s<r;s+=3)o=(e[s]<<16&16711680)+(e[s+1]<<8&65280)+(255&e[s+2]),a.push(n[(i=o)>>18&63]+n[i>>12&63]+n[i>>6&63]+n[63&i]);return a.join("")}o["-".charCodeAt(0)]=62,o["_".charCodeAt(0)]=63},function(e,t){t.read=function(e,t,r,n,o){var i,a,s=8*o-n-1,l=(1<<s)-1,u=l>>1,c=-7,h=r?o-1:0,f=r?-1:1,p=e[t+h];for(h+=f,i=p&(1<<-c)-1,p>>=-c,c+=s;c>0;i=256*i+e[t+h],h+=f,c-=8);for(a=i&(1<<-c)-1,i>>=-c,c+=n;c>0;a=256*a+e[t+h],h+=f,c-=8);if(0===i)i=1-u;else{if(i===l)return a?NaN:1/0*(p?-1:1);a+=Math.pow(2,n),i-=u}return(p?-1:1)*a*Math.pow(2,i-n)},t.write=function(e,t,r,n,o,i){var a,s,l,u=8*i-o-1,c=(1<<u)-1,h=c>>1,f=23===o?Math.pow(2,-24)-Math.pow(2,-77):0,p=n?0:i-1,d=n?1:-1,g=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(s=isNaN(t)?1:0,a=c):(a=Math.floor(Math.log(t)/Math.LN2),t*(l=Math.pow(2,-a))<1&&(a--,l*=2),(t+=a+h>=1?f/l:f*Math.pow(2,1-h))*l>=2&&(a++,l/=2),a+h>=c?(s=0,a=c):a+h>=1?(s=(t*l-1)*Math.pow(2,o),a+=h):(s=t*Math.pow(2,h-1)*Math.pow(2,o),a=0));o>=8;e[r+p]=255&s,p+=d,s/=256,o-=8);for(a=a<<o|s,u+=o;u>0;e[r+p]=255&a,p+=d,a/=256,u-=8);e[r+p-d]|=128*g}},function(e,t){var r={}.toString;e.exports=Array.isArray||function(e){return"[object Array]"==r.call(e)}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=r(45);Object.defineProperty(t,"BNF",{enumerable:!0,get:function(){return n.default}});var o=r(47);Object.defineProperty(t,"W3C",{enumerable:!0,get:function(){return o.default}});var i=r(48);Object.defineProperty(t,"Custom",{enumerable:!0,get:function(){return i.default}})},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=r(46),o=r(7);var i;!function(e){function t(e){let r=n.findChildrenByType(e,"term").map((e=>n.findChildrenByType(e,"literal").concat(n.findChildrenByType(e,"rule-name"))[0].text));return n.findChildrenByType(e,"list").forEach((e=>{r=r.concat(t(e))})),r}function r(r,o=e.defaultParser){let i=o.getAST(r);if(!i)throw new Error("Could not parse "+r);if(i.errors&&i.errors.length)throw i.errors[0];let a=n.findChildrenByType(i,"rule").map((e=>{let r=n.findChildrenByType(e,"rule-name")[0].text,o=n.findChildrenByType(e,"firstExpression").concat(n.findChildrenByType(e,"otherExpression")),i=[];return o.forEach((e=>{i.push(t(e))})),{name:r,bnf:i}}));return a.some((e=>"EOL"==e.name))||a.push({name:"EOL",bnf:[['"\\r\\n"','"\\r"','"\\n"']]}),a}e.RULES=[{name:"syntax",bnf:[["RULE_EOL*","rule+"]]},{name:"rule",bnf:[['" "*','"<"',"rule-name",'">"','" "*','"::="',"firstExpression","otherExpression*",'" "*',"RULE_EOL+",'" "*']]},{name:"firstExpression",bnf:[['" "*',"list"]]},{name:"otherExpression",bnf:[['" "*','"|"','" "*',"list"]]},{name:"RULE_EOL",bnf:[['"\\r"'],['"\\n"']]},{name:"list",bnf:[["term",'" "*',"list"],["term"]]},{name:"term",bnf:[["literal"],['"<"',"rule-name",'">"']]},{name:"literal",bnf:[["'\"'","RULE_CHARACTER1*","'\"'"],['"\'"',"RULE_CHARACTER2*",'"\'"']]},{name:"RULE_CHARACTER",bnf:[['" "'],["RULE_LETTER"],["RULE_DIGIT"],["RULE_SYMBOL"]]},{name:"RULE_LETTER",bnf:[['"A"'],['"B"'],['"C"'],['"D"'],['"E"'],['"F"'],['"G"'],['"H"'],['"I"'],['"J"'],['"K"'],['"L"'],['"M"'],['"N"'],['"O"'],['"P"'],['"Q"'],['"R"'],['"S"'],['"T"'],['"U"'],['"V"'],['"W"'],['"X"'],['"Y"'],['"Z"'],['"a"'],['"b"'],['"c"'],['"d"'],['"e"'],['"f"'],['"g"'],['"h"'],['"i"'],['"j"'],['"k"'],['"l"'],['"m"'],['"n"'],['"o"'],['"p"'],['"q"'],['"r"'],['"s"'],['"t"'],['"u"'],['"v"'],['"w"'],['"x"'],['"y"'],['"z"']]},{name:"RULE_DIGIT",bnf:[['"0"'],['"1"'],['"2"'],['"3"'],['"4"'],['"5"'],['"6"'],['"7"'],['"8"'],['"9"']]},{name:"RULE_SYMBOL",bnf:[['"-"'],['"_"'],['"!"'],['"#"'],['"$"'],['"%"'],['"&"'],['"("'],['")"'],['"*"'],['"+"'],['","'],['"-"'],['"."'],['"/"'],['":"'],['";"'],['"<"'],['"="'],['">"'],['"?"'],['"@"'],['"["'],['"\\"'],['"]"'],['"^"'],['"_"'],['"`"'],['"{"'],['"|"'],['"}"'],['"~"']]},{name:"RULE_CHARACTER1",bnf:[["RULE_CHARACTER"],['"\'"']]},{name:"RULE_CHARACTER2",bnf:[["RULE_CHARACTER"],["'\"'"]]},{name:"rule-name",bnf:[["RULE_LETTER","RULE_CHAR*"]]},{name:"RULE_CHAR",bnf:[["RULE_LETTER"],["RULE_DIGIT"],['"_"'],['"-"']]}],e.defaultParser=new o.Parser(e.RULES,{debug:!1}),e.getRules=r,e.Transform=function(t,n=e.defaultParser){return r(t.join(""),n)};class i extends o.Parser{constructor(t,n){super(r(t,n&&!0===n.debugRulesParser?new o.Parser(e.RULES,{debug:!0}):e.defaultParser),n),this.source=t}emitSource(){return this.source}}e.Parser=i}(i||(i={})),t.default=i},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.findChildrenByType=void 0,t.findChildrenByType=function(e,t){return e.children?e.children.filter((e=>e.type==t)):[]}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=r(7);var o;!function(e){e.RULES=[{name:"Grammar",bnf:[["RULE_S*","%Atomic*","EOF"]]},{name:"%Atomic",bnf:[["Production","RULE_S*"]],fragment:!0},{name:"Production",bnf:[["NCName","RULE_S*",'"::="',"RULE_WHITESPACE*","Choice","RULE_WHITESPACE*","RULE_EOL+","RULE_S*"]]},{name:"NCName",bnf:[[/[a-zA-Z][a-zA-Z_0-9]*/]]},{name:"Choice",bnf:[["SequenceOrDifference","%_Choice_1*"]],fragment:!0},{name:"%_Choice_1",bnf:[["RULE_WHITESPACE*",'"|"',"RULE_WHITESPACE*","SequenceOrDifference"]],fragment:!0},{name:"SequenceOrDifference",bnf:[["Item","RULE_WHITESPACE*","%_Item_1?"]]},{name:"%_Item_1",bnf:[["Minus","Item"],["Item*"]],fragment:!0},{name:"Minus",bnf:[['"-"']]},{name:"Item",bnf:[["RULE_WHITESPACE*","%Primary","PrimaryDecoration?"]],fragment:!0},{name:"PrimaryDecoration",bnf:[['"?"'],['"*"'],['"+"']]},{name:"DecorationName",bnf:[['"ebnf://"',/[^\x5D#]+/]]},{name:"%Primary",bnf:[["NCName"],["StringLiteral"],["CharCode"],["CharClass"],["SubItem"]],fragment:!0},{name:"SubItem",bnf:[['"("',"RULE_WHITESPACE*","Choice","RULE_WHITESPACE*",'")"']]},{name:"StringLiteral",bnf:[["'\"'",/[^"]*/,"'\"'"],['"\'"',/[^']*/,'"\'"']],pinned:1},{name:"CharCode",bnf:[['"#x"',/[0-9a-zA-Z]+/]]},{name:"CharClass",bnf:[["'['","'^'?","%RULE_CharClass_1+",'"]"']]},{name:"%RULE_CharClass_1",bnf:[["CharCodeRange"],["CharRange"],["CharCode"],["RULE_Char"]],fragment:!0},{name:"RULE_Char",bnf:[[/\x09/],[/\x0A/],[/\x0D/],[/[\x20-\x5c]/],[/[\x5e-\uD7FF]/],[/[\uE000-\uFFFD]/]]},{name:"CharRange",bnf:[["RULE_Char",'"-"',"RULE_Char"]]},{name:"CharCodeRange",bnf:[["CharCode",'"-"',"CharCode"]]},{name:"RULE_WHITESPACE",bnf:[["%RULE_WHITESPACE_CHAR*"],["Comment","RULE_WHITESPACE*"]]},{name:"RULE_S",bnf:[["RULE_WHITESPACE","RULE_S*"],["RULE_EOL","RULE_S*"]]},{name:"%RULE_WHITESPACE_CHAR",bnf:[[/\x09/],[/\x20/]],fragment:!0},{name:"Comment",bnf:[['"/*"',"%RULE_Comment_Body*",'"*/"']]},{name:"%RULE_Comment_Body",bnf:[['!"*/"',/[^*]/]],fragment:!0},{name:"RULE_EOL",bnf:[[/\x0D/,/\x0A/],[/\x0A/],[/\x0D/]]},{name:"Link",bnf:[["'['","Url","']'"]]},{name:"Url",bnf:[[/[^\x5D:/?#]/,'"://"',/[^\x5D#]+/,"%Url1?"]]},{name:"%Url1",bnf:[['"#"',"NCName"]],fragment:!0}],e.defaultParser=new n.Parser(e.RULES,{debug:!1});const t=/^(!|&)/,r=/(\?|\+|\*)$/,o=/^%/;function i(e,i){if("string"==typeof e){if(t.test(e))return"";if(o.test(e)){let t=r.exec(e),o=t?t[0]+" ":"",s=function(e,t){let r=n.findRuleByName(e,t);return r&&1==r.bnf.length&&1==r.bnf[0].length&&(r.bnf[0][0]instanceof RegExp||'"'==r.bnf[0][0][0]||"'"==r.bnf[0][0][0])}(e,i);return s?a(e,i)+o:"("+a(e,i)+")"+o}return e}return e.source.replace(/\\(?:x|u)([a-zA-Z0-9]+)/g,"#x$1").replace(/\[\\(?:x|u)([a-zA-Z0-9]+)-\\(?:x|u)([a-zA-Z0-9]+)\]/g,"[#x$1-#x$2]")}function a(e,t){let r=n.findRuleByName(e,t);return r?r.bnf.map((e=>function(e,t){return e.map((e=>i(e,t))).join(" ")}(e,t))).join(" | "):"RULE_NOT_FOUND {"+e+"}"}function s(e){let t=[];return e.grammarRules.forEach((r=>{if(!/^%/.test(r.name)){let n=r.recover?" /* { recoverUntil="+r.recover+" } */":"";t.push(r.name+" ::= "+a(r.name,e)+n)}})),t.join("\n")}e.emit=s;let l=0;function u(e){return new RegExp(e.replace(/#x([a-zA-Z0-9]{4})/g,"\\u$1").replace(/#x([a-zA-Z0-9]{3})/g,"\\u0$1").replace(/#x([a-zA-Z0-9]{2})/g,"\\x$1").replace(/#x([a-zA-Z0-9]{1})/g,"\\x0$1"))}function c(e,t,r){let n=null,o=[];return t.children.forEach(((i,a)=>{"Minus"==i.type&&function(e,t){throw console.log("reberia restar "+t+" a "+e),new Error("Difference not supported yet")}(n,i);let s=t.children[a+1];s=s&&"PrimaryDecoration"==s.type&&s.text||"";switch(i.type){case"SubItem":let t="%"+(r+l++);h(e,i,t),o.push(""+t+s);break;case"NCName":case"StringLiteral":o.push(""+i.text+s);break;case"CharCode":case"CharClass":if(s){let t={name:"%"+(r+l++),bnf:[[u(i.text)]]};e.push(t),o.push(""+t.name+s)}else o.push(u(i.text));break;case"PrimaryDecoration":break;default:throw new Error(" HOW SHOULD I PARSE THIS? "+i.type+" -> "+JSON.stringify(i.text))}n=i})),o}function h(e,t,r){let n=t.children.filter((e=>"SequenceOrDifference"==e.type)).map((t=>c(e,t,r))),o={name:r,bnf:n},i=null;n.forEach((e=>{i=i||e.recover,delete e.recover})),0==r.indexOf("%")&&(o.fragment=!0),i&&(o.recover=i),e.push(o)}function f(t,r=e.defaultParser){let n=r.getAST(t);if(!n)throw new Error("Could not parse "+t);if(n.errors&&n.errors.length)throw n.errors[0];let o=[];return n.children.filter((e=>"Production"==e.type)).map((e=>{let t=e.children.filter((e=>"NCName"==e.type))[0].text;h(o,e,t)})),o}e.getRules=f,e.Transform=function(t,r=e.defaultParser){return f(t.join(""),r)};class p extends n.Parser{constructor(t,r){super(f(t,r&&!0===r.debugRulesParser?new n.Parser(e.RULES,{debug:!0}):e.defaultParser),r)}emitSource(){return s(this)}}e.Parser=p}(o||(o={})),t.default=o},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const n=r(11),o=r(7);var i;!function(e){e.RULES=[{name:"Grammar",bnf:[["RULE_S*","Attributes?","RULE_S*","%Atomic*","EOF"]]},{name:"%Atomic",bnf:[["Production","RULE_S*"]],fragment:!0},{name:"Production",bnf:[["NCName","RULE_S*",'"::="',"RULE_WHITESPACE*","%Choice","RULE_WHITESPACE*","Attributes?","RULE_EOL+","RULE_S*"]]},{name:"NCName",bnf:[[/[a-zA-Z][a-zA-Z_0-9]*/]]},{name:"Attributes",bnf:[['"{"',"Attribute","%Attributes*","RULE_S*",'"}"']]},{name:"%Attributes",bnf:[["RULE_S*",'","',"Attribute"]],fragment:!0},{name:"Attribute",bnf:[["RULE_S*","NCName","RULE_WHITESPACE*",'"="',"RULE_WHITESPACE*","AttributeValue"]]},{name:"AttributeValue",bnf:[["NCName"],[/[1-9][0-9]*/]]},{name:"%Choice",bnf:[["SequenceOrDifference","%_Choice_1*"]],fragment:!0},{name:"%_Choice_1",bnf:[["RULE_S*",'"|"',"RULE_S*","SequenceOrDifference"]],fragment:!0},{name:"SequenceOrDifference",bnf:[["%Item","RULE_WHITESPACE*","%_Item_1?"]]},{name:"%_Item_1",bnf:[["Minus","%Item"],["%Item*"]],fragment:!0},{name:"Minus",bnf:[['"-"']]},{name:"%Item",bnf:[["RULE_WHITESPACE*","PrimaryPreDecoration?","%Primary","PrimaryDecoration?"]],fragment:!0},{name:"PrimaryDecoration",bnf:[['"?"'],['"*"'],['"+"']]},{name:"PrimaryPreDecoration",bnf:[['"&"'],['"!"'],['"~"']]},{name:"%Primary",bnf:[["NCName"],["StringLiteral"],["CharCode"],["CharClass"],["SubItem"]],fragment:!0},{name:"SubItem",bnf:[['"("',"RULE_S*","%Choice","RULE_S*",'")"']]},{name:"StringLiteral",bnf:[["'\"'",/[^"]*/,"'\"'"],['"\'"',/[^']*/,'"\'"']]},{name:"CharCode",bnf:[['"#x"',/[0-9a-zA-Z]+/]]},{name:"CharClass",bnf:[["'['","'^'?","%RULE_CharClass_1+",'"]"']]},{name:"%RULE_CharClass_1",bnf:[["CharCodeRange"],["CharRange"],["CharCode"],["RULE_Char"]],fragment:!0},{name:"RULE_Char",bnf:[[/\x09/],[/\x0A/],[/\x0D/],[/[\x20-\x5c]/],[/[\x5e-\uD7FF]/],[/[\uE000-\uFFFD]/]]},{name:"CharRange",bnf:[["RULE_Char",'"-"',"RULE_Char"]]},{name:"CharCodeRange",bnf:[["CharCode",'"-"',"CharCode"]]},{name:"RULE_WHITESPACE",bnf:[["%RULE_WHITESPACE_CHAR*"],["Comment","RULE_WHITESPACE*"]]},{name:"RULE_S",bnf:[["RULE_WHITESPACE","RULE_S*"],["RULE_EOL","RULE_S*"]]},{name:"%RULE_WHITESPACE_CHAR",bnf:[[/\x09/],[/\x20/]],fragment:!0},{name:"Comment",bnf:[['"/*"',"%RULE_Comment_Body*",'"*/"']]},{name:"%RULE_Comment_Body",bnf:[[/[^*]/],['"*"+',/[^/]*/]],fragment:!0},{name:"RULE_EOL",bnf:[[/\x0D/,/\x0A/],[/\x0A/],[/\x0D/]]},{name:"Link",bnf:[["'['","Url","']'"]]},{name:"Url",bnf:[[/[^\x5D:/?#]/,'"://"',/[^\x5D#]+/,"%Url1?"]]},{name:"%Url1",bnf:[['"#"',"NCName"]],fragment:!0}],e.defaultParser=new o.Parser(e.RULES,{debug:!1});const t=/^(!|&)/,r=/(\?|\+|\*)$/,i=/^%/;function a(e,n){if("string"==typeof e){let a=r.exec(e),l=t.exec(e),u=l?l[0]:"",c=a?a[0]+" ":"";if(i.test(e)){let t=function(e,t){let r=o.findRuleByName(e,t);return r&&1==r.bnf.length&&1==r.bnf[0].length&&(r.bnf[0][0]instanceof RegExp||'"'==r.bnf[0][0][0]||"'"==r.bnf[0][0][0])}(e,n);return t?u+s(e,n)+c:u+"("+s(e,n)+")"+c}return e.replace(t,u)}return e.source.replace(/\\(?:x|u)([a-zA-Z0-9]+)/g,"#x$1").replace(/\[\\(?:x|u)([a-zA-Z0-9]+)-\\(?:x|u)([a-zA-Z0-9]+)\]/g,"[#x$1-#x$2]")}function s(e,t){let r=o.findRuleByName(e,t);return r?r.bnf.map((e=>function(e,t){return e.map((e=>a(e,t))).join(" ")}(e,t))).join(" | "):"RULE_NOT_FOUND {"+e+"}"}function l(e){let t=[];return e.grammarRules.forEach((r=>{if(!/^%/.test(r.name)){let n=r.recover?" { recoverUntil="+r.recover+" }":"";t.push(r.name+" ::= "+s(r.name,e)+n)}})),t.join("\n")}e.emit=l;let u=0;function c(e){return new RegExp(e.replace(/#x([a-zA-Z0-9]{4})/g,"\\u$1").replace(/#x([a-zA-Z0-9]{3})/g,"\\u0$1").replace(/#x([a-zA-Z0-9]{2})/g,"\\x$1").replace(/#x([a-zA-Z0-9]{1})/g,"\\x0$1"))}function h(e,t,r,n){let i=null,a=[];return t.children.forEach(((s,l)=>{"Minus"==s.type&&function(e,t){throw console.log("reberia restar "+t+" a "+e),new Error("Difference not supported yet")}(i,s);let h=t.children[l+1];h=h&&"PrimaryDecoration"==h.type&&h.text||"";let p="";i&&"PrimaryPreDecoration"==i.type&&(p=i.text);let d="~"==p?1:void 0;switch(d&&(p=""),s.type){case"SubItem":let t="%"+(r+u++);f(e,s,t,n),a.push(p+t+h);break;case"NCName":a.push(p+s.text+h);break;case"StringLiteral":if(h||p||!/^['"/()a-zA-Z0-9&_.:=,+*\-\^\\]+$/.test(s.text))a.push(p+s.text+h);else for(const e of s.text.slice(1,-1))n&&"true"==n.ignoreCase&&/[a-zA-Z]/.test(e)?a.push(new RegExp("["+e.toUpperCase()+e.toLowerCase()+"]")):a.push(new RegExp(o.escapeRegExp(e)));break;case"CharCode":case"CharClass":if(h||p){let t={name:"%"+(r+u++),bnf:[[c(s.text)]],pinned:d};e.push(t),a.push(p+t.name+h)}else a.push(c(s.text));break;case"PrimaryPreDecoration":case"PrimaryDecoration":break;default:throw new Error(" HOW SHOULD I PARSE THIS? "+s.type+" -> "+JSON.stringify(s.text))}i=s})),a}function f(e,t,r,o){let i=t.children.filter((e=>"Attributes"==e.type))[0],a={};i&&i.children.forEach((e=>{let t=e.children.filter((e=>"NCName"==e.type))[0].text;if(t in a)throw new n.TokenError("Duplicated attribute "+t,e);a[t]=e.children.filter((e=>"AttributeValue"==e.type))[0].text}));let s=t.children.filter((e=>"SequenceOrDifference"==e.type)).map((t=>h(e,t,r,o||a))),l={name:r,bnf:s};if(0==r.indexOf("%")&&(l.fragment=!0),a.recoverUntil&&(l.recover=a.recoverUntil,l.bnf.length>1))throw new n.TokenError("only one-option productions are suitable for error recovering",t);if("pin"in a){let e=parseInt(a.pin);if(isNaN(e)||(l.pinned=e),l.bnf.length>1)throw new n.TokenError("only one-option productions are suitable for pinning",t)}l.implicitWs="ws"in a?"explicit"!=a.ws:null,l.fragment=l.fragment||"true"==a.fragment,l.simplifyWhenOneChildren="true"==a.simplifyWhenOneChildren,e.push(l)}function p(t,r=e.defaultParser){let o=r.getAST(t);if(!o)throw new Error("Could not parse "+t);if(o.errors&&o.errors.length)throw o.errors[0];let i=null,a=o.children.filter((e=>"Attributes"==e.type))[0],s={};a&&a.children.forEach((e=>{let t=e.children.filter((e=>"NCName"==e.type))[0].text;if(t in s)throw new n.TokenError("Duplicated attribute "+t,e);s[t]=e.children.filter((e=>"AttributeValue"==e.type))[0].text})),i="implicit"==s.ws;let l=[];return o.children.filter((e=>"Production"==e.type)).map((e=>{let t=e.children.filter((e=>"NCName"==e.type))[0].text;f(l,e,t)})),l.forEach((e=>{null===e.implicitWs&&(e.implicitWs=i)})),l}e.getRules=p,e.Transform=function(t,r=e.defaultParser){return p(t.join(""),r)};class d extends o.Parser{constructor(t,r){super(p(t,r&&!0===r.debugRulesParser?new o.Parser(e.RULES,{debug:!0}):e.defaultParser),r)}emitSource(){return l(this)}}e.Parser=d}(i||(i={})),t.default=i}])}));
package/package.json CHANGED
@@ -1,14 +1,14 @@
1
1
  {
2
2
  "name": "@player-ui/player",
3
- "version": "0.7.2-next.0",
3
+ "version": "0.7.2-next.2",
4
4
  "private": false,
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org"
7
7
  },
8
8
  "peerDependencies": {},
9
9
  "dependencies": {
10
- "@player-ui/partial-match-registry": "0.7.2-next.0",
11
- "@player-ui/types": "0.7.2-next.0",
10
+ "@player-ui/partial-match-registry": "0.7.2-next.2",
11
+ "@player-ui/types": "0.7.2-next.2",
12
12
  "dequal": "^2.0.2",
13
13
  "p-defer": "^3.0.0",
14
14
  "queue-microtask": "^1.2.3",
@@ -78,6 +78,9 @@ export interface HookOptions extends ExpressionContext {
78
78
  * The caller is responsible for handling the error.
79
79
  */
80
80
  throwErrors?: boolean;
81
+
82
+ /** Whether expressions should be parsed strictly or not */
83
+ strict?: boolean;
81
84
  }
82
85
 
83
86
  export type ExpressionEvaluatorOptions = Omit<
@@ -226,7 +229,8 @@ export class ExpressionEvaluator {
226
229
 
227
230
  try {
228
231
  storedAST =
229
- this.expressionsCache.get(matchedExp) ?? parseExpression(matchedExp);
232
+ this.expressionsCache.get(matchedExp) ??
233
+ parseExpression(matchedExp, { strict: options.strict });
230
234
  this.expressionsCache.set(matchedExp, storedAST);
231
235
  } catch (e: any) {
232
236
  if (options.throwErrors || !this.hooks.onError.call(e)) {
@@ -797,7 +797,7 @@ export function parseExpression(
797
797
  args.push(node);
798
798
  }
799
799
 
800
- if (charIndex !== termination) {
800
+ if (strictMode && charIndex !== termination) {
801
801
  throwError(`Expected ${String.fromCharCode(termination)}`, index);
802
802
  }
803
803
 
@@ -929,7 +929,7 @@ export function parseExpression(
929
929
  nodes.push(node);
930
930
  // If we weren't able to find a binary expression and are out of room, then
931
931
  // the expression passed in probably has too much
932
- } else if (index < length) {
932
+ } else if (strictMode && index < length) {
933
933
  throwError(`Unexpected "${exprI(index)}"`, index);
934
934
  }
935
935
  }
package/src/player.ts CHANGED
@@ -30,8 +30,8 @@ import type {
30
30
  import { NOT_STARTED_STATE } from './types';
31
31
 
32
32
  // Variables injected at build time
33
- const PLAYER_VERSION = '0.7.2-next.0';
34
- const COMMIT = 'bc01b43eaf000d1a85e3c3ea6cd17b5cad312d84';
33
+ const PLAYER_VERSION = '0.7.2-next.2';
34
+ const COMMIT = '9c00884b3858447c923b999c32acc0b76b5b6421';
35
35
 
36
36
  export interface PlayerPlugin {
37
37
  /**