var runtime=function(e){"use strict";var t,r=Object.prototype,n=r.hasOwnProperty,a=Object.defineProperty||function(e,t,r){e[t]=r.value},o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",s=o.asyncIterator||"@@asyncIterator",u=o.toStringTag||"@@toStringTag";function c(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{c({},"")}catch(e){c=function(e,t,r){return e[t]=r}}function p(e,r,n,o){var i=r&&r.prototype instanceof y?r:y,s=Object.create(i.prototype),u=new P(o||[]);return a(s,"_invoke",{value:function(e,r,n){var a=l;return function(o,i){if(a===d)throw new Error("Generator is already running");if(a===v){if("throw"===o)throw i;return{value:t,done:!0}}for(n.method=o,n.arg=i;;){var s=n.delegate;if(s){var u=T(s,n);if(u){if(u===b)continue;return u}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(a===l)throw a=v,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);a=d;var c=f(e,r,n);if("normal"===c.type){if(a=n.done?v:h,c.arg===b)continue;return{value:c.arg,done:n.done}}"throw"===c.type&&(a=v,n.method="throw",n.arg=c.arg)}}}(e,n,u)}),s}function f(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}e.wrap=p;var l="suspendedStart",h="suspendedYield",d="executing",v="completed",b={};function y(){}function g(){}function m(){}var x={};c(x,i,function(){return this});var k=Object.getPrototypeOf,w=k&&k(k(j([])));w&&w!==r&&n.call(w,i)&&(x=w);var E=m.prototype=y.prototype=Object.create(x);function A(e){["next","throw","return"].forEach(function(t){c(e,t,function(e){return this._invoke(t,e)})})}function S(e,t){var r;a(this,"_invoke",{value:function(a,o){function i(){return new t(function(r,i){!function r(a,o,i,s){var u=f(e[a],e,o);if("throw"!==u.type){var c=u.arg,p=c.value;return p&&"object"==typeof p&&n.call(p,"__await")?t.resolve(p.__await).then(function(e){r("next",e,i,s)},function(e){r("throw",e,i,s)}):t.resolve(p).then(function(e){c.value=e,i(c)},function(e){return r("throw",e,i,s)})}s(u.arg)}(a,o,r,i)})}return r=r?r.then(i,i):i()}})}function T(e,r){var n=r.method,a=e.iterator[n];if(a===t)return r.delegate=null,"throw"===n&&e.iterator.return&&(r.method="return",r.arg=t,T(e,r),"throw"===r.method)?b:("return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),b);var o=f(a,e.iterator,r.arg);if("throw"===o.type)return r.method="throw",r.arg=o.arg,r.delegate=null,b;var i=o.arg;return i?i.done?(r[e.resultName]=i.value,r.next=e.nextLoc,"return"!==r.method&&(r.method="next",r.arg=t),r.delegate=null,b):i:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,b)}function O(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function D(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function P(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(O,this),this.reset(!0)}function j(e){if(null!=e){var r=e[i];if(r)return r.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var a=-1,o=function r(){for(;++a=0;--o){var i=this.tryEntries[o],s=i.completion;if("root"===i.tryLoc)return a("end");if(i.tryLoc<=this.prev){var u=n.call(i,"catchLoc"),c=n.call(i,"finallyLoc");if(u&&c){if(this.prev=0;--r){var a=this.tryEntries[r];if(a.tryLoc<=this.prev&&n.call(a,"finallyLoc")&&this.prev=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),D(r),b}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var a=n.arg;D(r)}return a}}throw new Error("illegal catch attempt")},delegateYield:function(e,r,n){return this.delegate={iterator:j(e),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=t),b}},e}("object"==typeof module?module.exports:{});try{regeneratorRuntime=runtime}catch(e){"object"==typeof globalThis?globalThis.regeneratorRuntime=runtime:Function("r","regeneratorRuntime = r")(runtime)}Number.isInteger=Number.isInteger||function(e){return"number"==typeof e&&isFinite(e)&&Math.floor(e)===e},String.fromCodePoint||function(e){var t=function(t){for(var r=[],n=0,a="",o=0,i=arguments.length;o!==i;++o){var s=+arguments[o];if(!(s<1114111&&s>>>0===s))throw RangeError("Invalid code point: "+s);s<=65535?n=r.push(s):(s-=65536,n=r.push(55296+(s>>10),s%1024+56320)),n>=16383&&(a+=e.apply(null,r),r.length=0)}return a+e.apply(null,r)};try{Object.defineProperty(String,"fromCodePoint",{value:t,configurable:!0,writable:!0})}catch(e){String.fromCodePoint=t}}(String.fromCharCode),Object.is||(Object.is=function(e,t){return e===t?0!==e||1/e==1/t:e!=e&&t!=t}),String.prototype.codePointAt||function(){"use strict";var e=function(){try{var e={},t=Object.defineProperty,r=t(e,e,e)&&t}catch(e){}return r}(),t=function(e){if(null==this)throw TypeError();var t=String(this),r=t.length,n=e?Number(e):0;if(n!=n&&(n=0),!(n<0||n>=r)){var a,o=t.charCodeAt(n);return o>=55296&&o<=56319&&r>n+1&&(a=t.charCodeAt(n+1))>=56320&&a<=57343?1024*(o-55296)+a-56320+65536:o}};e?e(String.prototype,"codePointAt",{value:t,configurable:!0,writable:!0}):String.prototype.codePointAt=t}(),Math.log10=Math.log10||function(e){return Math.log(e)*Math.LOG10E},function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).jsonata=e()}}(function(){return function(){return function e(t,r,n){function a(i,s){if(!r[i]){if(!t[i]){var u="function"==typeof require&&require;if(!s&&u)return u(i,!0);if(o)return o(i,!0);var c=new Error("Cannot find module '"+i+"'");throw c.code="MODULE_NOT_FOUND",c}var p=r[i]={exports:{}};t[i][0].call(p.exports,function(e){return a(t[i][1][e]||e)},p,p.exports,e,t,r,n)}return r[i].exports}for(var o="function"==typeof require&&require,i=0;i0;)r.unshift(String.fromCharCode((e-1)%26+n)),e=Math.floor((e-1)/26);return r.join("")}(n,i.case===f.UPPER?"A":"a");break;case p.ROMAN:u=function e(t){for(var r=0;r=n[0])return n[1]+e(t-n[0])}return""}(n),i.case===f.UPPER&&(u=u.toUpperCase());break;case p.WORDS:u=function(e,n){return function e(n,i,s){var u="";if(n<=19)u=(i?" and ":"")+(s?r[n]:t[n]);else if(n<100){var c=Math.floor(n/10),p=n%10;u=(i?" and ":"")+a[c-2],p>0?u+="-"+e(p,!1,s):s&&(u=u.substring(0,u.length-1)+"ieth")}else if(n<1e3){var f=Math.floor(n/100),l=n%100;u=(i?", ":"")+t[f]+" Hundred",l>0?u+=e(l,!0,s):s&&(u+="th")}else{var h=Math.floor(Math.log10(n)/3);h>o.length&&(h=o.length);var d=Math.pow(10,3*h),v=Math.floor(n/d),b=n-v*d;u=(i?", ":"")+e(v,!1,!1)+" "+o[h-1],b>0?u+=e(b,!0,s):s&&(u+="th")}return u}(e,!1,n)}(n,i.ordinal),i.case===f.UPPER?u=u.toUpperCase():i.case===f.LOWER&&(u=u.toLowerCase());break;case p.DECIMAL:u=""+n;var l=i.mandatoryDigits-u.length;if(l>0){var h=new Array(l+1).join("0");u=h+u}if(48!==i.zeroCode&&(u=e(u).map(function(e){return String.fromCodePoint(e.codePointAt(0)+i.zeroCode-48)}).join("")),i.regular)for(var d=Math.floor((u.length-1)/i.groupingSeparators.position);d>0;d--){var v=u.length-d*i.groupingSeparators.position;u=u.substr(0,v)+i.groupingSeparators.character+u.substr(v)}else i.groupingSeparators.reverse().forEach(function(e){var t=u.length-e.position;u=u.substr(0,t)+e.character+u.substr(t)});if(i.ordinal){var b={1:"st",2:"nd",3:"rd"}[u[u.length-1]];(!b||u.length>1&&"1"===u[u.length-2])&&(b="th"),u+=b}break;case p.SEQUENCE:throw{code:"D3130",value:i.token}}return c&&(u="-"+u),u}var h=[48,1632,1776,1984,2406,2534,2662,2790,2918,3046,3174,3302,3430,3558,3664,3792,3872,4160,4240,6112,6160,6470,6608,6784,6800,6992,7088,7232,7248,42528,43216,43264,43472,43504,43600,44016,65296];function d(t){var r,n={type:"integer",primary:p.DECIMAL,case:f.LOWER,ordinal:!1},a=t.lastIndexOf(";");switch(-1===a?r=t:(r=t.substring(0,a),"o"===t.substring(a+1)[0]&&(n.ordinal=!0)),r){case"A":n.case=f.UPPER;case"a":n.primary=p.LETTERS;break;case"I":n.case=f.UPPER;case"i":n.primary=p.ROMAN;break;case"W":n.case=f.UPPER,n.primary=p.WORDS;break;case"Ww":n.case=f.TITLE,n.primary=p.WORDS;break;case"w":n.primary=p.WORDS;break;default:var o=null,i=0,s=0,u=[],c=0;if(e(r).map(function(e){return e.codePointAt(0)}).reverse().forEach(function(e){for(var t=!1,r=0;r=n&&e<=n+9){if(t=!0,i++,c++,null===o)o=n;else if(n!==o)throw{code:"D3131"};break}}t||(35===e?(c++,s++):u.push({position:c,character:String.fromCodePoint(e)}))}),i>0){n.primary=p.DECIMAL,n.zeroCode=o,n.mandatoryDigits=i,n.optionalDigits=s;var l=function(e){if(0===e.length)return 0;for(var t=e[0].character,r=1;r0?(n.regular=!0,n.groupingSeparators={position:l,character:u[0].character}):(n.regular=!1,n.groupingSeparators=u)}else n.primary=p.SEQUENCE,n.token=r}return n}var v={Y:"1",M:"1",D:"1",d:"1",F:"n",W:"1",w:"1",X:"1",x:"1",H:"1",h:"1",P:"n",m:"01",s:"01",f:"1",Z:"01:01",z:"01:01",C:"n",E:"n"};function b(e){for(var t=[],r={type:"datetime",parts:t},n=function(r,n){if(n>r){var a=e.substring(r,n);a=a.split("]]").join("]"),t.push({type:"literal",value:a})}},a=0,o=0;o1){var m=i.charAt(i.length-1);-1!=="atco".indexOf(m)?(u.presentation2=m,"o"===m&&(u.ordinal=!0),u.presentation1=i.substring(0,i.length-1)):u.presentation1=i}else u.presentation1=v[u.component];if(void 0===u.presentation1)throw{code:"D3132",value:u.component};if("n"===u.presentation1[0])u.names=f.LOWER;else if("N"===u.presentation1[0])"n"===u.presentation1[1]?u.names=f.TITLE:u.names=f.UPPER;else if(-1!=="YMDdFWwXxHhmsf".indexOf(u.component)){var x=u.presentation1;if(u.presentation2&&(x+=";"+u.presentation2),u.integerFormat=d(x),u.width&&void 0!==u.width.min&&u.integerFormat.mandatoryDigits=2&&(u.n=k)}}"Z"!==u.component&&"z"!==u.component||(u.integerFormat=d(u.presentation1)),t.push(u),a=o+1}o++}return n(a,o),r}var y=["","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"],g=["January","February","March","April","May","June","July","August","September","October","November","December"],m=function(e){var t=Date.UTC(e.year,e.month),r=new Date(t).getUTCDay();return 0===r&&(r=7),r>4?t+864e5*(8-r):t-864e5*(r-1)},x=function e(t,r){return{year:t,month:r,nextMonth:function(){return 11===r?e(t+1,0):e(t,r+1)},previousMonth:function(){return 0===r?e(t-1,11):e(t,r-1)},nextYear:function(){return e(t+1,r)},previousYear:function(){return e(t-1,r)}}},k=function(e,t){return(t-e)/6048e5+1},w=function(e,t){var r;switch(t){case"Y":r=e.getUTCFullYear();break;case"M":r=e.getUTCMonth()+1;break;case"D":r=e.getUTCDate();break;case"d":r=(Date.UTC(e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate())-Date.UTC(e.getUTCFullYear(),0))/864e5+1;break;case"F":0===(r=e.getUTCDay())&&(r=7);break;case"W":var n=x(e.getUTCFullYear(),0),a=m(n),o=Date.UTC(n.year,e.getUTCMonth(),e.getUTCDate()),i=k(a,o);if(i>52)o>=m(n.nextYear())&&(i=1);else if(i<1){var s=m(n.previousYear());i=k(s,o)}r=Math.floor(i);break;case"w":var u=x(e.getUTCFullYear(),e.getUTCMonth()),c=m(u),p=Date.UTC(u.year,u.month,e.getUTCDate()),f=k(c,p);if(f>4)p>=m(u.nextMonth())&&(f=1);else if(f<1){var l=m(u.previousMonth());f=k(l,p)}r=Math.floor(f);break;case"X":var h=x(e.getUTCFullYear(),0),d=m(h),v=m(h.nextYear()),b=e.getTime();r=b=v?h.year+1:h.year;break;case"x":var y=x(e.getUTCFullYear(),e.getUTCMonth()),g=m(y),w=y.nextMonth(),E=m(w),A=e.getTime();r=A=E?w.month+1:y.month+1;break;case"H":r=e.getUTCHours();break;case"h":r=e.getUTCHours(),0===(r%=12)&&(r=12);break;case"P":r=e.getUTCHours()>=12?"pm":"am";break;case"m":r=e.getUTCMinutes();break;case"s":r=e.getUTCSeconds();break;case"f":r=e.getUTCMilliseconds();break;case"Z":case"z":break;case"C":case"E":r="ISO"}return r},E=null;function A(e,t,r){var n=0,a=0;if(void 0!==r){var o=parseInt(r);n=Math.floor(o/100),a=o%100}var i;void 0===t?(null===E&&(E=b("[Y0001]-[M01]-[D01]T[H01]:[m01]:[s01].[f001][Z01:01t]")),i=E):i=b(t);var s=new Date(e+60*(60*n+a)*1e3),u="";return i.parts.forEach(function(e){"literal"===e.type?u+=e.value:u+=function(e,t){var r=w(e,t.component);if(-1!=="YMDdFWwXxHhms".indexOf(t.component))if("Y"===t.component&&-1!==t.n&&(r%=Math.pow(10,t.n)),t.names){if("M"===t.component||"x"===t.component)r=g[r-1];else{if("F"!==t.component)throw{code:"D3133",value:t.component};r=y[r]}t.names===f.UPPER?r=r.toUpperCase():t.names===f.LOWER&&(r=r.toLowerCase()),t.width&&r.length>t.width.max&&(r=r.substring(0,t.width.max))}else r=l(r,t.integerFormat);else if("f"===t.component)r=l(r,t.integerFormat);else if("Z"===t.component||"z"===t.component){var o=100*n+a;if(t.integerFormat.regular)r=l(o,t.integerFormat);else{var i=t.integerFormat.mandatoryDigits;if(1===i||2===i)r=l(n,t.integerFormat),0!==a&&(r+=":"+c(a,"00"));else{if(3!==i&&4!==i)throw{code:"D3134",value:i};r=l(o,t.integerFormat)}}o>=0&&(r="+"+r),"z"===t.component&&(r="GMT"+r),0===o&&"t"===t.presentation2&&(r="Z")}else"P"===t.component&&t.names===f.UPPER&&(r=r.toUpperCase());return r}(s,e)}),u}function S(e){var t={};if("datetime"===e.type)t.type="datetime",t.parts=e.parts.map(function(e){var t={};if("literal"===e.type)t.regex=e.value.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");else if("Z"===e.component||"z"===e.component){var r;Array.isArray(e.integerFormat.groupingSeparators)||(r=e.integerFormat.groupingSeparators),t.regex="","z"===e.component&&(t.regex="GMT"),t.regex+="[-+][0-9]+",r&&(t.regex+=r.character+"[0-9]+"),t.parse=function(t){"z"===e.component&&(t=t.substring(3));var n=0,a=0;r?(n=Number.parseInt(t.substring(0,t.indexOf(r.character))),a=Number.parseInt(t.substring(t.indexOf(r.character)+1))):t.length-1<=2?n=Number.parseInt(t):(n=Number.parseInt(t.substring(0,3)),a=Number.parseInt(t.substring(3)));return 60*n+a}}else if(e.integerFormat)e.integerFormat.n=e.n,t=S(e.integerFormat);else{t.regex="[a-zA-Z]+";var n={};if("M"===e.component||"x"===e.component)g.forEach(function(t,r){e.width&&e.width.max?n[t.substring(0,e.width.max)]=r+1:n[t]=r+1});else if("F"===e.component)y.forEach(function(t,r){r>0&&(e.width&&e.width.max?n[t.substring(0,e.width.max)]=r:n[t]=r)});else{if("P"!==e.component)throw{code:"D3133",value:e.component};n={am:0,AM:0,pm:1,PM:1}}t.parse=function(e){return n[e]}}return t.component=e.component,t});else{t.type="integer";var r,n=e.case===f.UPPER;switch(r=e.n&&e.n>0?0===e.optionalDigits?"{".concat(e.n,"}"):"{".concat(e.n-e.optionalDigits,",").concat(e.n,"}"):"+",e.primary){case p.LETTERS:t.regex=n?"[A-Z]+":"[a-z]+",t.parse=function(e){return function(e,t){for(var r=t.charCodeAt(0),n=0,a=0;a=0;n--){var a=e[n],o=u[a];o=1e3&&(n.push(t),t=0),n.push(t+e)}else n.push(n.pop()*e)}),n.reduce(function(e,t){return e+t},0);var t,r,n};break;case p.DECIMAL:t.regex="[0-9]".concat(r),e.ordinal&&(t.regex+="(?:th|st|nd|rd)"),t.parse=function(t){var r=t;return e.ordinal&&(r=t.substring(0,t.length-2)),e.regular?r=r.split(",").join(""):e.groupingSeparators.forEach(function(e){r=r.split(e.character).join("")}),48!==e.zeroCode&&(r=r.split("").map(function(t){return String.fromCodePoint(t.codePointAt(0)-e.zeroCode+48)}).join("")),parseInt(r)};break;case p.SEQUENCE:throw{code:"D3130",value:e.token}}}return t}var T=new RegExp("^\\d{4}(-[01]\\d)*(-[0-3]\\d)*(T[0-2]\\d:[0-5]\\d:[0-5]\\d)*(\\.\\d+)?([+-][0-2]\\d:?[0-5]\\d|Z)?$");return{formatInteger:c,parseInteger:function(e,t){if(void 0!==e)return S(d(t)).parse(e)},fromMillis:function(e,t,r){if(void 0!==e)return A.call(this,e,t,r)},toMillis:function(e,t){if(void 0!==e){if(void 0===t){if(!T.test(e))throw{stack:(new Error).stack,code:"D3110",value:e};return Date.parse(e)}return function(e,t){var r=S(b(t)),n="^"+r.parts.map(function(e){return"("+e.regex+")"}).join("")+"$",a=new RegExp(n,"i").exec(e);if(null!==a){for(var o={},i=1;i0?o.M-=1:o.M=0,f){var x=Date.UTC(o.Y,0),k=1e3*(o.d-1)*60*60*24,E=new Date(x+k);o.M=E.getUTCMonth(),o.D=E.getUTCDate()}if(l)throw{code:"D3136"};if(h)throw{code:"D3136"};d&&(o.H=12===o.h?0:o.h,1===o.P&&(o.H+=12));var A=Date.UTC(o.Y,o.M,o.D,o.H,o.m,o.s,o.f);return(o.Z||o.z)&&(A-=60*(o.Z||o.z)*1e3),A}}.call(this,e,t)}}}}();t.exports=a},{"./utils":6}],2:[function(e,t,r){(function(r){(function(){"use strict";function n(){n=function(){return t};var e,t={},r=Object.prototype,o=r.hasOwnProperty,i=Object.defineProperty||function(e,t,r){e[t]=r.value},s="function"==typeof Symbol?Symbol:{},u=s.iterator||"@@iterator",c=s.asyncIterator||"@@asyncIterator",p=s.toStringTag||"@@toStringTag";function f(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{f({},"")}catch(e){f=function(e,t,r){return e[t]=r}}function l(e,t,r,n){var a=t&&t.prototype instanceof m?t:m,o=Object.create(a.prototype),s=new M(n||[]);return i(o,"_invoke",{value:D(e,r,s)}),o}function h(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}t.wrap=l;var d="suspendedStart",v="suspendedYield",b="executing",y="completed",g={};function m(){}function x(){}function k(){}var w={};f(w,u,function(){return this});var E=Object.getPrototypeOf,A=E&&E(E(C([])));A&&A!==r&&o.call(A,u)&&(w=A);var S=k.prototype=m.prototype=Object.create(w);function T(e){["next","throw","return"].forEach(function(t){f(e,t,function(e){return this._invoke(t,e)})})}function O(e,t){function r(n,i,s,u){var c=h(e[n],e,i);if("throw"!==c.type){var p=c.arg,f=p.value;return f&&"object"==a(f)&&o.call(f,"__await")?t.resolve(f.__await).then(function(e){r("next",e,s,u)},function(e){r("throw",e,s,u)}):t.resolve(f).then(function(e){p.value=e,s(p)},function(e){return r("throw",e,s,u)})}u(c.arg)}var n;i(this,"_invoke",{value:function(e,a){function o(){return new t(function(t,n){r(e,a,t,n)})}return n=n?n.then(o,o):o()}})}function D(t,r,n){var a=d;return function(o,i){if(a===b)throw Error("Generator is already running");if(a===y){if("throw"===o)throw i;return{value:e,done:!0}}for(n.method=o,n.arg=i;;){var s=n.delegate;if(s){var u=P(s,n);if(u){if(u===g)continue;return u}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(a===d)throw a=y,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);a=b;var c=h(t,r,n);if("normal"===c.type){if(a=n.done?y:v,c.arg===g)continue;return{value:c.arg,done:n.done}}"throw"===c.type&&(a=y,n.method="throw",n.arg=c.arg)}}}function P(t,r){var n=r.method,a=t.iterator[n];if(a===e)return r.delegate=null,"throw"===n&&t.iterator.return&&(r.method="return",r.arg=e,P(t,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),g;var o=h(a,t.iterator,r.arg);if("throw"===o.type)return r.method="throw",r.arg=o.arg,r.delegate=null,g;var i=o.arg;return i?i.done?(r[t.resultName]=i.value,r.next=t.nextLoc,"return"!==r.method&&(r.method="next",r.arg=e),r.delegate=null,g):i:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,g)}function j(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function L(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function M(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(j,this),this.reset(!0)}function C(t){if(t||""===t){var r=t[u];if(r)return r.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var n=-1,i=function r(){for(;++n=0;--a){var i=this.tryEntries[a],s=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var u=o.call(i,"catchLoc"),c=o.call(i,"finallyLoc");if(u&&c){if(this.prev=0;--r){var n=this.tryEntries[r];if(n.tryLoc<=this.prev&&o.call(n,"finallyLoc")&&this.prev=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),L(r),g}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var a=n.arg;L(r)}return a}}throw Error("illegal catch attempt")},delegateYield:function(t,r,n){return this.delegate={iterator:C(t),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=e),g}},t}function a(e){"@babel/helpers - typeof";return(a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function o(e,t,r,n,a,o,i){try{var s=e[o](i),u=s.value}catch(e){return void r(e)}s.done?t(u):Promise.resolve(u).then(n,a)}function i(e){return function(){var t=this,r=arguments;return new Promise(function(n,a){var i=e.apply(t,r);function s(e){o(i,n,a,s,u,"next",e)}function u(e){o(i,n,a,s,u,"throw",e)}s(void 0)})}}var s=e("./utils"),u=function(){var e=s.isNumeric,t=s.isArrayOfStrings,o=s.isArrayOfNumbers,u=s.createSequence,c=s.isSequence,p=s.isFunction,f=s.isLambda,l=s.isPromise,h=s.getFunctionArity,d=s.isDeepEqual,v=s.stringToArray;function b(e,t,r){if(void 0!==e){var n=v(e),a=n.length;if(a+t<0&&(t=0),void 0!==r){if(r<=0)return"";var o=t>=0?t+r:a+t+r;return n.slice(t,o).join("")}return n.slice(t).join("")}}function y(e){if(void 0!==e)return v(e).length}function g(e,t){return m.apply(this,arguments)}function m(){return(m=i(n().mark(function e(t,r){var a;return n().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(a=t.apply(this,[r]),!l(a)){e.next=5;break}return e.next=4,a;case 4:a=e.sent;case 5:if(!a||"number"==typeof a.start||"number"===a.end||Array.isArray(a.groups)||p(a.next)){e.next=7;break}throw{code:"T1010",stack:(new Error).stack};case 7:return e.abrupt("return",a);case 8:case"end":return e.stop()}},e,this)}))).apply(this,arguments)}function x(){return(x=i(n().mark(function e(t,r){var a,o;return n().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(void 0!==t){e.next=2;break}return e.abrupt("return",void 0);case 2:if("string"!=typeof r){e.next=6;break}a=-1!==t.indexOf(r),e.next=10;break;case 6:return e.next=8,g(r,t);case 8:o=e.sent,a=void 0!==o;case 10:return e.abrupt("return",a);case 11:case"end":return e.stop()}},e)}))).apply(this,arguments)}function k(){return(k=i(n().mark(function e(t,r,a){var o,i,s;return n().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(void 0!==t){e.next=2;break}return e.abrupt("return",void 0);case 2:if(!(a<0)){e.next=4;break}throw{stack:(new Error).stack,value:a,code:"D3040",index:3};case 4:if(o=u(),!(void 0===a||a>0)){e.next=19;break}return i=0,e.next=9,g(r,t);case 9:if(void 0===(s=e.sent)){e.next=19;break}case 11:if(void 0===s||!(void 0===a||i1&&n>e.groups.length&&(n=parseInt(a.substring(r,r+i-1),10)),isNaN(n))t+="$";else{if(e.groups.length>0){var s=e.groups[n-1];void 0!==s&&(t+=s)}r+=n.toString().length}}n=a.indexOf("$",r)}return t+=a.substring(r)}:a,u="",c=0,!(void 0===o||o>0)){e.next=47;break}if(p=0,"string"!=typeof r){e.next=18;break}for(f=t.indexOf(r,c);-1!==f&&(void 0===o||p0)){e.next=29;break}if("string"!=typeof r){e.next=10;break}o=t.split(r,a),e.next=29;break;case 10:return i=0,e.next=13,g(r,t);case 13:if(void 0===(s=e.sent)){e.next=28;break}u=0;case 16:if(void 0===s||!(void 0===a||i1){r=t.filter(function(e){return S(e)}).length>0}}else"string"==typeof t?t.length>0&&(r=!0):e(t)?0!==t&&(r=!0):null!==t&&"object"===a(t)?Object.keys(t).length>0&&(r=!0):"boolean"==typeof t&&!0===t&&(r=!0);return r}}function T(e,t,r,n){var a=[t],o=h(e);return o>=2&&a.push(r),o>=3&&a.push(n),a}function O(){return(O=i(n().mark(function e(t,r){var a,o,i,s;return n().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(void 0!==t){e.next=2;break}return e.abrupt("return",void 0);case 2:a=u(),o=0;case 4:if(!(o0?(o=t[0],s=1):(o=a,s=0);case 6:if(!(s=3&&u.push(s),i>=4&&u.push(t),e.next=12,r.apply(this,u);case 12:o=e.sent,s++,e.next=6;break;case 16:return e.abrupt("return",o);case 17:case"end":return e.stop()}},e,this)}))).apply(this,arguments)}function L(e,t){return void 0===e?t:void 0===t?e:(Array.isArray(e)||(e=u(e)),Array.isArray(t)||(t=[t]),e.concat(t))}function M(){return(M=i(n().mark(function e(t,r){var a,o,i,s;return n().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:a=u(),e.t0=n().keys(t);case 2:if((e.t1=e.t0()).done){e.next=11;break}return o=e.t1.value,i=T(r,t[o],o,t),e.next=7,r.apply(this,i);case 7:void 0!==(s=e.sent)&&a.push(s),e.next=2;break;case 11:return e.abrupt("return",a);case 12:case"end":return e.stop()}},e,this)}))).apply(this,arguments)}function C(){return(C=i(n().mark(function e(r,a){var s,u,c,p;return n().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(void 0!==r){e.next=2;break}return e.abrupt("return",void 0);case 2:if(!(r.length<=1)){e.next=4;break}return e.abrupt("return",r);case 4:if(void 0!==a){e.next=10;break}if(o(r)||t(r)){e.next=7;break}throw{stack:(new Error).stack,code:"D3070",index:1};case 7:s=function(){var e=i(n().mark(function e(t,r){return n().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",t>r);case 1:case"end":return e.stop()}},e)}));return function(t,r){return e.apply(this,arguments)}}(),e.next=11;break;case 10:s=a;case 11:return u=function(){var e=i(n().mark(function e(t,r){var a,o;return n().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return a=function(){var e=i(n().mark(function e(t,r,o){return n().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(0!==r.length){e.next=4;break}Array.prototype.push.apply(t,o),e.next=19;break;case 4:if(0!==o.length){e.next=8;break}Array.prototype.push.apply(t,r),e.next=19;break;case 8:return e.next=10,s(r[0],o[0]);case 10:if(!e.sent){e.next=16;break}return t.push(o[0]),e.next=14,a(t,r,o.slice(1));case 14:e.next=19;break;case 16:return t.push(r[0]),e.next=19,a(t,r.slice(1),o);case 19:case"end":return e.stop()}},e)}));return function(t,r,n){return e.apply(this,arguments)}}(),o=[],e.next=4,a(o,t,r);case 4:return e.abrupt("return",o);case 5:case"end":return e.stop()}},e)}));return function(t,r){return e.apply(this,arguments)}}(),c=function(){var e=i(n().mark(function e(t){var r,a,o;return n().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(Array.isArray(t)&&!(t.length<=1)){e.next=4;break}return e.abrupt("return",t);case 4:return r=Math.floor(t.length/2),a=t.slice(0,r),o=t.slice(r),e.next=9,c(a);case 9:return a=e.sent,e.next=12,c(o);case 12:return o=e.sent,e.next=15,u(a,o);case 15:return e.abrupt("return",e.sent);case 16:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}(),e.next=15,c(r);case 15:return p=e.sent,e.abrupt("return",p);case 17:case"end":return e.stop()}},e)}))).apply(this,arguments)}function F(){return(F=i(n().mark(function e(t,r){var a,o,i,s;return n().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:a={},e.t0=n().keys(t);case 2:if((e.t1=e.t0()).done){e.next=12;break}return o=e.t1.value,i=t[o],s=T(r,i,o,t),e.next=8,r.apply(this,s);case 8:S(e.sent)&&(a[o]=i),e.next=2;break;case 12:return 0===Object.keys(a).length&&(a=void 0),e.abrupt("return",a);case 14:case"end":return e.stop()}},e,this)}))).apply(this,arguments)}return{sum:function(e){if(void 0!==e){var t=0;return e.forEach(function(e){t+=e}),t}},count:function(e){return void 0===e?0:e.length},max:function(e){if(void 0!==e&&0!==e.length)return Math.max.apply(Math,e)},min:function(e){if(void 0!==e&&0!==e.length)return Math.min.apply(Math,e)},average:function(e){if(void 0!==e&&0!==e.length){var t=0;return e.forEach(function(e){t+=e}),t/e.length}},string:function(t){var r=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(void 0!==t){var n;if("string"==typeof t)n=t;else if(p(t))n="";else{if("number"==typeof t&&!isFinite(t))throw{code:"D3001",value:t,stack:(new Error).stack};var a=r?2:0;Array.isArray(t)&&t.outerWrapper&&(t=t[0]),n=JSON.stringify(t,function(t,r){return null!=r&&r.toPrecision&&e(r)?Number(r.toPrecision(15)):r&&p(r)?"":r},a)}return n}},substring:b,substringBefore:function(e,t){if(void 0!==e){var r=e.indexOf(t);return r>-1?e.substr(0,r):e}},substringAfter:function(e,t){if(void 0!==e){var r=e.indexOf(t);return r>-1?e.substr(r+t.length):e}},lowercase:function(e){if(void 0!==e)return e.toLowerCase()},uppercase:function(e){if(void 0!==e)return e.toUpperCase()},length:y,trim:function(e){if(void 0!==e){var t=e.replace(/[ \t\n\r]+/gm," ");return" "===t.charAt(0)&&(t=t.substring(1))," "===t.charAt(t.length-1)&&(t=t.substring(0,t.length-1)),t}},pad:function(e,t,r){if(void 0!==e){var n;void 0!==r&&0!==r.length||(r=" ");var a=Math.abs(t)-y(e);if(a>0){var o=new Array(a+1).join(r);r.length>1&&(o=b(o,0,a)),n=t>0?e+o:o+e}else n=e;return n}},match:function(e,t,r){return k.apply(this,arguments)},contains:function(e,t){return x.apply(this,arguments)},replace:function(e,t,r,n){return w.apply(this,arguments)},split:function(e,t,r){return E.apply(this,arguments)},join:function(e,t){if(void 0!==e)return void 0===t&&(t=""),e.join(t)},formatNumber:function(e,t,r){if(void 0!==e){var n={"decimal-separator":".","grouping-separator":",","exponent-separator":"e",infinity:"Infinity","minus-sign":"-",NaN:"NaN",percent:"%","per-mille":"‰","zero-digit":"0",digit:"#","pattern-separator":";"};void 0!==r&&Object.keys(r).forEach(function(e){n[e]=r[e]});for(var a=[],o=n["zero-digit"].charCodeAt(0),i=o;i2)throw{code:"D3080",stack:(new Error).stack};var c=u.map(function(e){var t,r,a,o,i=function(){for(var t,r=0;r=0;r--)if(t=e.charAt(r),-1!==s.indexOf(t)&&t!==n["exponent-separator"])return e.substring(r+1)}(),c=e.substring(i.length,e.length-u.length),p=e.indexOf(n["exponent-separator"],i.length);-1===p||p>e.length-u.length?(t=c,r=void 0):(t=c.substring(0,p),r=c.substring(p+1));var f=t.indexOf(n["decimal-separator"]);return-1===f?(a=t,o=u):(a=t.substring(0,f),o=t.substring(f+1)),{prefix:i,suffix:u,activePart:c,mantissaPart:t,exponentPart:r,integerPart:a,fractionalPart:o,subpicture:e}});c.forEach(function(e){var t,r,o=e.subpicture,i=o.indexOf(n["decimal-separator"]);i!==o.lastIndexOf(n["decimal-separator"])&&(t="D3081"),o.indexOf(n.percent)!==o.lastIndexOf(n.percent)&&(t="D3082"),o.indexOf(n["per-mille"])!==o.lastIndexOf(n["per-mille"])&&(t="D3083"),-1!==o.indexOf(n.percent)&&-1!==o.indexOf(n["per-mille"])&&(t="D3084");var u=!1;for(r=0;r-1}).length>0&&(t="D3090"),-1!==(p=e.fractionalPart.lastIndexOf(n.digit))&&e.fractionalPart.substring(p).split("").filter(function(e){return a.indexOf(e)>-1}).length>0&&(t="D3091");var f="string"==typeof e.exponentPart;if(f&&e.exponentPart.length>0&&(-1!==o.indexOf(n.percent)||-1!==o.indexOf(n["per-mille"]))&&(t="D3092"),f&&(0===e.exponentPart.length||e.exponentPart.split("").filter(function(e){return-1===a.indexOf(e)}).length>0)&&(t="D3093"),t)throw{code:t,stack:(new Error).stack}});var p,f,l,h,d=c.map(function(e){var t=function(t,r){for(var o=[],i=t.indexOf(n["grouping-separator"]);-1!==i;){var s=(r?t.substring(0,i):t.substring(i)).split("").filter(function(e){return-1!==a.indexOf(e)||e===n.digit}).length;o.push(s),i=e.integerPart.indexOf(n["grouping-separator"],i+1)}return o},r=t(e.integerPart),o=function(e){if(0===e.length)return 0;for(var t=e.reduce(function e(t,r){return 0===r?t:e(r,t%r)}),r=1;r<=e.length;r++)if(-1===e.indexOf(r*t))return 0;return t}(r),i=t(e.fractionalPart,!0),s=e.integerPart.split("").filter(function(e){return-1!==a.indexOf(e)}).length,u=s,c=e.fractionalPart.split(""),p=c.filter(function(e){return-1!==a.indexOf(e)}).length,f=c.filter(function(e){return-1!==a.indexOf(e)||e===n.digit}).length,l="string"==typeof e.exponentPart;0===s&&0===f&&(l?(p=1,f=1):s=1),l&&0===s&&-1!==e.integerPart.indexOf(n.digit)&&(s=1),0===s&&0===p&&(p=1);var h=0;return l&&(h=e.exponentPart.split("").filter(function(e){return-1!==a.indexOf(e)}).length),{integerPartGroupingPositions:r,regularGrouping:o,minimumIntegerPartSize:s,scalingFactor:u,prefix:e.prefix,fractionalPartGroupingPositions:i,minimumFactionalPartSize:p,maximumFactionalPartSize:f,minimumExponentSize:h,suffix:e.suffix,picture:e.subpicture}}),v=n["minus-sign"],b=n["zero-digit"],y=n["decimal-separator"],g=n["grouping-separator"];if(1===d.length&&(d.push(JSON.parse(JSON.stringify(d[0]))),d[1].prefix=v+d[1].prefix),f=-1!==(p=e>=0?d[0]:d[1]).picture.indexOf(n.percent)?100*e:-1!==p.picture.indexOf(n["per-mille"])?1e3*e:e,0===p.minimumExponentSize)l=f;else{var m=Math.pow(10,p.scalingFactor),x=Math.pow(10,p.scalingFactor-1);for(l=f,h=0;lm;)l/=10,h+=1}var k=function(e,t){var r=Math.abs(e).toFixed(t);return"0"!==b&&(r=r.split("").map(function(e){return e>="0"&&e<="9"?a[e.charCodeAt(0)-48]:e}).join("")),r},w=k(A(l,p.maximumFactionalPartSize),p.maximumFactionalPartSize),E=w.indexOf(".");for(-1===E?w+=y:w=w.replace(".",y);w.charAt(0)===b;)w=w.substring(1);for(;w.charAt(w.length-1)===b;)w=w.substring(0,w.length-1);E=w.indexOf(y);var S=p.minimumIntegerPartSize-E,T=p.minimumFactionalPartSize-(w.length-E-1);if(w=(S>0?new Array(S+1).join(b):"")+w,w+=T>0?new Array(T+1).join(b):"",E=w.indexOf(y),p.regularGrouping>0)for(var O=Math.floor((E-1)/p.regularGrouping),D=1;D<=O;D++)w=[w.slice(0,E-D*p.regularGrouping),g,w.slice(E-D*p.regularGrouping)].join("");else p.integerPartGroupingPositions.forEach(function(e){w=[w.slice(0,E-e),g,w.slice(E-e)].join(""),E++});if(E=w.indexOf(y),p.fractionalPartGroupingPositions.forEach(function(e){w=[w.slice(0,e+E+1),g,w.slice(e+E+1)].join("")}),E=w.indexOf(y),-1!==p.picture.indexOf(y)&&E!==w.length-1||(w=w.substring(0,w.length-1)),void 0!==h){var P=k(h,0);(S=p.minimumExponentSize-P.length)>0&&(P=new Array(S+1).join(b)+P),w=w+n["exponent-separator"]+(h<0?v:"")+P}return w=p.prefix+w+p.suffix}},formatBase:function(e,t){if(void 0!==e){if(e=A(e),(t=void 0===t?10:A(t))<2||t>36)throw{code:"D3100",stack:(new Error).stack,value:t};return e.toString(t)}},number:function(e){var t;if(void 0!==e){if("number"==typeof e)t=e;else if("string"==typeof e&&/^-?[0-9]+(\.[0-9]+)?([Ee][-+]?[0-9]+)?$/.test(e)&&!isNaN(parseFloat(e))&&isFinite(e))t=parseFloat(e);else if("string"==typeof e&&/^(0[xX][0-9A-Fa-f]+)|(0[oO][0-7]+)|(0[bB][0-1]+)$/.test(e))t=Number(e);else if(!0===e)t=1;else{if(!1!==e)throw{code:"D3030",value:e,stack:(new Error).stack,index:1};t=0}return t}},floor:function(e){if(void 0!==e)return Math.floor(e)},ceil:function(e){if(void 0!==e)return Math.ceil(e)},round:A,abs:function(e){if(void 0!==e)return Math.abs(e)},sqrt:function(e){if(void 0!==e){if(e<0)throw{stack:(new Error).stack,code:"D3060",index:1,value:e};return Math.sqrt(e)}},power:function(e,t){var r;if(void 0!==e){if(r=Math.pow(e,t),!isFinite(r))throw{stack:(new Error).stack,code:"D3061",index:1,value:e,exp:t};return r}},random:function(){return Math.random()},boolean:S,not:function(e){if(void 0!==e)return!S(e)},map:function(e,t){return O.apply(this,arguments)},zip:function(){for(var e=[],t=Array.prototype.slice.call(arguments),r=Math.min.apply(Math,t.map(function(e){return Array.isArray(e)?e.length:0})),n=0;n=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:a}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,s=!0,u=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return s=e.done,e},e:function(e){u=!0,i=e},f:function(){try{s||null==r.return||r.return()}finally{if(u)throw i}}}}function o(e,t){if(e){if("string"==typeof e)return i(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?i(e,t):void 0}}function i(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r=0;--o){var i=this.tryEntries[o],s=i.completion;if("root"===i.tryLoc)return a("end");if(i.tryLoc<=this.prev){var u=n.call(i,"catchLoc"),c=n.call(i,"finallyLoc");if(u&&c){if(this.prev=0;--r){var a=this.tryEntries[r];if(a.tryLoc<=this.prev&&n.call(a,"finallyLoc")&&this.prev=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),L(r),g}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var a=n.arg;L(r)}return a}}throw Error("illegal catch attempt")},delegateYield:function(t,r,n){return this.delegate={iterator:C(t),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=e),g}},t}function u(e){"@babel/helpers - typeof";return(u="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function c(e,t,r,n,a,o,i){try{var s=e[o](i),u=s.value}catch(e){return void r(e)}s.done?t(u):Promise.resolve(u).then(n,a)}function p(e){return function(){var t=this,r=arguments;return new Promise(function(n,a){var o=e.apply(t,r);function i(e){c(o,n,a,i,s,"next",e)}function s(e){c(o,n,a,i,s,"throw",e)}i(void 0)})}}var f=e("./datetime"),l=e("./functions"),h=e("./utils"),d=e("./parser"),v=e("./signature"),b=function(){var e=h.isNumeric,t=h.isArrayOfStrings,r=h.isArrayOfNumbers,o=h.createSequence,i=h.isSequence,c=h.isFunction,b=h.isLambda,y=h.isIterable,g=h.isPromise,m=h.getFunctionArity,x=h.isDeepEqual,k=Fe(null);function w(e,t,r){return E.apply(this,arguments)}function E(){return(E=p(s().mark(function e(t,r,n){var a,o,u,c;return s().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(!(o=n.lookup("__evaluate_entry"))){e.next=4;break}return e.next=4,o(t,r,n);case 4:e.t0=t.type,e.next="path"===e.t0?7:"binary"===e.t0?11:"unary"===e.t0?15:"name"===e.t0?19:"string"===e.t0?21:"number"===e.t0?21:"value"===e.t0?21:"wildcard"===e.t0?23:"descendant"===e.t0?25:"parent"===e.t0?27:"condition"===e.t0?29:"block"===e.t0?33:"bind"===e.t0?37:"regex"===e.t0?41:"function"===e.t0?43:"variable"===e.t0?47:"lambda"===e.t0?49:"partial"===e.t0?51:"apply"===e.t0?55:"transform"===e.t0?59:61;break;case 7:return e.next=9,A(t,r,n);case 9:return a=e.sent,e.abrupt("break",61);case 11:return e.next=13,N(t,r,n);case 13:return a=e.sent,e.abrupt("break",61);case 15:return e.next=17,I(t,r,n);case 17:return a=e.sent,e.abrupt("break",61);case 19:return a=R(t,r,n),e.abrupt("break",61);case 21:return a=G(t),e.abrupt("break",61);case 23:return a=z(t,r),e.abrupt("break",61);case 25:return a=$(t,r),e.abrupt("break",61);case 27:return a=n.lookup(t.slot.label),e.abrupt("break",61);case 29:return e.next=31,ne(t,r,n);case 31:return a=e.sent,e.abrupt("break",61);case 33:return e.next=35,oe(t,r,n);case 35:return a=e.sent,e.abrupt("break",61);case 37:return e.next=39,te(t,r,n);case 39:return a=e.sent,e.abrupt("break",61);case 41:return a=se(t),e.abrupt("break",61);case 43:return e.next=45,ve(t,r,n);case 45:return a=e.sent,e.abrupt("break",61);case 47:return a=ue(t,r,n),e.abrupt("break",61);case 49:return a=ke(t,r,n),e.abrupt("break",61);case 51:return e.next=53,we(t,r,n);case 53:return a=e.sent,e.abrupt("break",61);case 55:return e.next=57,he(t,r,n);case 57:return a=e.sent,e.abrupt("break",61);case 59:return a=fe(t,r,n),e.abrupt("break",61);case 61:if(!Object.prototype.hasOwnProperty.call(t,"predicate")){e.next=70;break}u=0;case 63:if(!(u"===e.t1?28:">="===e.t1?28:"&"===e.t1?30:".."===e.t1?32:"in"===e.t1?34:36;break;case 24:return a=Y(o,c,i),e.abrupt("break",36);case 26:return a=q(o,c,i),e.abrupt("break",36);case 28:return a=W(o,c,i),e.abrupt("break",36);case 30:return a=X(o,c),e.abrupt("break",36);case 32:return a=ee(o,c),e.abrupt("break",36);case 34:return a=H(o,c),e.abrupt("break",36);case 36:e.next=43;break;case 38:throw e.prev=38,e.t2=e.catch(20),e.t2.position=t.position,e.t2.token=i,e.t2;case 43:return e.abrupt("return",a);case 44:case"end":return e.stop()}},e,null,[[6,12],[20,38]])}))).apply(this,arguments)}function I(e,t,r){return _.apply(this,arguments)}function _(){return(_=p(s().mark(function t(r,o,i){var u,c,f,h,d,v,b,y;return s().wrap(function(t){for(;;)switch(t.prev=t.next){case 0:t.t0=r.value,t.next="-"===t.t0?3:"["===t.t0?16:"{"===t.t0?24:28;break;case 3:return t.next=5,w(r.expression,o,i);case 5:if(void 0!==(u=t.sent)){t.next=10;break}u=void 0,t.next=15;break;case 10:if(!e(u)){t.next=14;break}u=-u,t.next=15;break;case 14:throw{code:"D1002",stack:(new Error).stack,position:r.position,token:r.value,value:u};case 15:return t.abrupt("break",28);case 16:return u=[],t.next=19,Promise.all(r.expressions.map(function(){var e=p(s().mark(function e(t,r){return s().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return i.isParallelCall=r>0,e.t0=t,e.next=4,w(t,o,i);case 4:return e.t1=e.sent,e.abrupt("return",[e.t0,e.t1]);case 6:case"end":return e.stop()}},e)}));return function(t,r){return e.apply(this,arguments)}}()));case 19:c=t.sent,f=a(c);try{for(f.s();!(h=f.n()).done;)d=h.value,v=n(d,2),b=v[0],void 0!==(y=v[1])&&("["===b.value?u.push(y):u=l.append(u,y))}catch(e){f.e(e)}finally{f.f()}return r.consarray&&Object.defineProperty(u,"cons",{enumerable:!1,configurable:!1,value:!0}),t.abrupt("break",28);case 24:return t.next=26,Q(r,o,i);case 26:return u=t.sent,t.abrupt("break",28);case 28:return t.abrupt("return",u);case 29:case"end":return t.stop()}},t)}))).apply(this,arguments)}function R(e,t,r){return l.lookup(t,e.value)}function G(e){return e.value}function z(e,t){var r=o();return Array.isArray(t)&&t.outerWrapper&&t.length>0&&(t=t[0]),null!==t&&"object"===u(t)&&Object.keys(t).forEach(function(e){var n=t[e];Array.isArray(n)?(n=function e(t,r){void 0===r&&(r=[]);Array.isArray(t)?t.forEach(function(t){e(t,r)}):r.push(t);return r}(n),r=l.append(r,n)):r.push(n)}),r}function $(e,t){var r,n=o();return void 0!==t&&(!function e(t,r){Array.isArray(t)||r.push(t);Array.isArray(t)?t.forEach(function(t){e(t,r)}):null!==t&&"object"===u(t)&&Object.keys(t).forEach(function(n){e(t[n],r)})}(t,n),r=1===n.length?n[0]:n),r}function Y(t,r,n){var a;if(void 0!==t&&!e(t))throw{code:"T2001",stack:(new Error).stack,value:t};if(void 0!==r&&!e(r))throw{code:"T2002",stack:(new Error).stack,value:r};if(void 0===t||void 0===r)return a;switch(n){case"+":a=t+r;break;case"-":a=t-r;break;case"*":a=t*r;break;case"/":a=t/r;break;case"%":a=t%r}return a}function q(e,t,r){var n,a=u(e),o=u(t);if("undefined"===a||"undefined"===o)return!1;switch(r){case"=":n=x(e,t);break;case"!=":n=!x(e,t)}return n}function W(e,t,r){var n,a=u(e),o=u(t);if(!("undefined"===a||"string"===a||"number"===a)||!("undefined"===o||"string"===o||"number"===o))throw{code:"T2010",stack:(new Error).stack,value:"string"!==a&&"number"!==a?e:t};if("undefined"!==a&&"undefined"!==o){if(a!==o)throw{code:"T2009",stack:(new Error).stack,value:e,value2:t};switch(r){case"<":n=e":n=e>t;break;case">=":n=e>=t}return n}}function H(e,t){var r=!1;if(void 0===e||void 0===t)return!1;Array.isArray(t)||(t=[t]);for(var n=0;n0,e.t0=r,e.next=8,w(t.lhs[a.exprIndex][1],o,u);case 8:return e.t1=e.sent,e.abrupt("return",[e.t0,e.t1]);case 10:case"end":return e.stop()}},e)}));return function(t,r){return e.apply(this,arguments)}}()));case 34:x=e.sent,k=a(x),e.prev=36,k.s();case 38:if((E=k.n()).done){e.next=49;break}return A=E.value,e.next=42,A;case 42:S=e.sent,O=n(S,2),g=O[0],void 0!==(D=O[1])&&(u[g]=D);case 47:e.next=38;break;case 49:e.next=54;break;case 51:e.prev=51,e.t0=e.catch(36),k.e(e.t0);case 54:return e.prev=54,k.f(),e.finish(54);case 57:return e.abrupt("return",u);case 58:case"end":return e.stop()}},e,null,[[36,51,54,57]])}))).apply(this,arguments)}function K(e){if(!Array.isArray(e))return e;var t={};Object.assign(t,e[0]);for(var r=1;rt)return r;var n=t-e+1;if(n>1e7)throw{code:"D2014",stack:(new Error).stack,value:n};r=new Array(n);for(var a=e,o=0;a<=t;a++,o++)r[o]=a;return r.sequence=!0,r}function te(e,t,r){return re.apply(this,arguments)}function re(){return(re=p(s().mark(function e(t,r,n){var a;return s().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,w(t.rhs,r,n);case 2:return a=e.sent,n.bind(t.lhs.value,a),e.abrupt("return",a);case 5:case"end":return e.stop()}},e)}))).apply(this,arguments)}function ne(e,t,r){return ae.apply(this,arguments)}function ae(){return(ae=p(s().mark(function e(t,r,n){var a,o;return s().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,w(t.condition,r,n);case 2:if(o=e.sent,!l.boolean(o)){e.next=9;break}return e.next=6,w(t.then,r,n);case 6:a=e.sent,e.next=13;break;case 9:if(void 0===t.else){e.next=13;break}return e.next=12,w(t.else,r,n);case 12:a=e.sent;case 13:return e.abrupt("return",a);case 14:case"end":return e.stop()}},e)}))).apply(this,arguments)}function oe(e,t,r){return ie.apply(this,arguments)}function ie(){return(ie=p(s().mark(function e(t,r,n){var a,o,i;return s().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:o=Fe(n),i=0;case 2:if(!(i1)for(var s=1;s=n.length)){var a=r(n,t.lastIndex);if(a&&""===a.match)throw{code:"D1004",stack:(new Error).stack,position:e.position,value:e.value.source};return a}}}return o}}function ue(e,t,r){return""===e.value?t&&t.outerWrapper?t[0]:t:r.lookup(e.value)}function ce(e,t,r){return pe.apply(this,arguments)}function pe(){return(pe=p(s().mark(function e(t,r,n){var a,o,i,c,f;return s().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return o=r,i=!!r.tupleStream,c=function(){var e=p(s().mark(function e(r,a){var o,c,p,f,l,h,d,v,b;return s().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:o=0,c=0;case 2:if(!(0===o&&c")}var le=d("function($f, $g) { function($x){ $g($f($x)) } }");function he(e,t,r){return de.apply(this,arguments)}function de(){return(de=p(s().mark(function e(t,r,n){var a,o,i,u;return s().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,w(t.lhs,r,n);case 2:if(o=e.sent,"function"!==t.rhs.type){e.next=9;break}return e.next=6,ve(t.rhs,r,n,{context:o});case 6:a=e.sent,e.next=26;break;case 9:return e.next=11,w(t.rhs,r,n);case 11:if(i=e.sent,c(i)){e.next=14;break}throw{code:"T2006",stack:(new Error).stack,position:t.position,value:i};case 14:if(!c(o)){e.next=23;break}return e.next=17,w(le,null,n);case 17:return u=e.sent,e.next=20,ye(u,[o,i],null,n);case 20:a=e.sent,e.next=26;break;case 23:return e.next=25,ye(i,[o],null,n);case 25:a=e.sent;case 26:return e.abrupt("return",a);case 27:case"end":return e.stop()}},e)}))).apply(this,arguments)}function ve(e,t,r,n){return be.apply(this,arguments)}function be(){return(be=p(s().mark(function e(t,r,n,a){var o,i,f,l,h,d;return s().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,w(t.procedure,r,n);case 2:if(void 0!==(i=e.sent)||"path"!==t.procedure.type||!n.lookup(t.procedure.steps[0].value)){e.next=5;break}throw{code:"T1005",stack:(new Error).stack,position:t.position,token:t.procedure.steps[0].value};case 5:f=[],void 0!==a&&f.push(a.context),l=s().mark(function e(){var a,o;return s().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,w(t.arguments[h],r,n);case 2:a=e.sent,c(a)?((o=function(){var e=p(s().mark(function e(){var t,r,o,i=arguments;return s().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:for(t=i.length,r=new Array(t),o=0;o:n>")),k.bind("count",Me(l.count,"")),k.bind("max",Me(l.max,":n>")),k.bind("min",Me(l.min,":n>")),k.bind("average",Me(l.average,":n>")),k.bind("string",Me(l.string,"")),k.bind("substring",Me(l.substring,"")),k.bind("substringBefore",Me(l.substringBefore,"")),k.bind("substringAfter",Me(l.substringAfter,"")),k.bind("lowercase",Me(l.lowercase,"")),k.bind("uppercase",Me(l.uppercase,"")),k.bind("length",Me(l.length,"")),k.bind("trim",Me(l.trim,"")),k.bind("pad",Me(l.pad,"")),k.bind("match",Me(l.match,"n?:a>")),k.bind("contains",Me(l.contains,"")),k.bind("replace",Me(l.replace,"")),k.bind("split",Me(l.split,">")),k.bind("join",Me(l.join,"s?:s>")),k.bind("formatNumber",Me(l.formatNumber,"")),k.bind("formatBase",Me(l.formatBase,"")),k.bind("formatInteger",Me(f.formatInteger,"")),k.bind("parseInteger",Me(f.parseInteger,"")),k.bind("number",Me(l.number,"<(nsb)-:n>")),k.bind("floor",Me(l.floor,"")),k.bind("ceil",Me(l.ceil,"")),k.bind("round",Me(l.round,"")),k.bind("abs",Me(l.abs,"")),k.bind("sqrt",Me(l.sqrt,"")),k.bind("power",Me(l.power,"")),k.bind("random",Me(l.random,"<:n>")),k.bind("boolean",Me(l.boolean,"")),k.bind("not",Me(l.not,"")),k.bind("map",Me(l.map,"")),k.bind("zip",Me(l.zip,"")),k.bind("filter",Me(l.filter,"")),k.bind("single",Me(l.single,"")),k.bind("reduce",Me(l.foldLeft,"")),k.bind("sift",Me(l.sift,"")),k.bind("keys",Me(l.keys,">")),k.bind("lookup",Me(l.lookup,"")),k.bind("append",Me(l.append,"")),k.bind("exists",Me(l.exists,"")),k.bind("spread",Me(l.spread,">")),k.bind("merge",Me(l.merge,":o>")),k.bind("reverse",Me(l.reverse,"")),k.bind("each",Me(l.each,"")),k.bind("error",Me(l.error,"")),k.bind("assert",Me(l.assert,"")),k.bind("type",Me(l.type,"")),k.bind("sort",Me(l.sort,"")),k.bind("shuffle",Me(l.shuffle,"")),k.bind("distinct",Me(l.distinct,"")),k.bind("base64encode",Me(l.base64encode,"")),k.bind("base64decode",Me(l.base64decode,"")),k.bind("encodeUrlComponent",Me(l.encodeUrlComponent,"")),k.bind("encodeUrl",Me(l.encodeUrl,"")),k.bind("decodeUrlComponent",Me(l.decodeUrlComponent,"")),k.bind("decodeUrl",Me(l.decodeUrl,"")),k.bind("eval",Me(function(e,t){return Ce.apply(this,arguments)},"")),k.bind("toMillis",Me(f.toMillis,"")),k.bind("fromMillis",Me(f.fromMillis,"")),k.bind("clone",Me(function(e){if(void 0!==e)return JSON.parse(l.string(e))},"<(oa)-:o>"));var Ne={S0101:"String literal must be terminated by a matching quote",S0102:"Number out of range: {{token}}",S0103:"Unsupported escape sequence: \\{{token}}",S0104:"The escape sequence \\u must be followed by 4 hex digits",S0105:"Quoted property name must be terminated with a backquote (`)",S0106:"Comment has no closing tag",S0201:"Syntax error: {{token}}",S0202:"Expected {{value}}, got {{token}}",S0203:"Expected {{value}} before end of expression",S0204:"Unknown operator: {{token}}",S0205:"Unexpected token: {{token}}",S0206:"Unknown expression type: {{token}}",S0207:"Unexpected end of expression",S0208:"Parameter {{value}} of function definition must be a variable name (start with $)",S0209:"A predicate cannot follow a grouping expression in a step",S0210:"Each step can only have one grouping expression",S0211:"The symbol {{token}} cannot be used as a unary operator",S0212:"The left side of := must be a variable name (start with $)",S0213:"The literal value {{value}} cannot be used as a step within a path expression",S0214:"The right side of {{token}} must be a variable name (start with $)",S0215:"A context variable binding must precede any predicates on a step",S0216:"A context variable binding must precede the 'order-by' clause on a step",S0217:"The object representing the 'parent' cannot be derived from this expression",S0301:"Empty regular expressions are not allowed",S0302:"No terminating / in regular expression",S0402:"Choice groups containing parameterized types are not supported",S0401:"Type parameters can only be applied to functions and arrays",S0500:"Attempted to evaluate an expression containing syntax error(s)",T0410:"Argument {{index}} of function {{token}} does not match function signature",T0411:"Context value is not a compatible type with argument {{index}} of function {{token}}",T0412:"Argument {{index}} of function {{token}} must be an array of {{type}}",D1001:"Number out of range: {{value}}",D1002:"Cannot negate a non-numeric value: {{value}}",T1003:"Key in object structure must evaluate to a string; got: {{value}}",D1004:"Regular expression matches zero length string",T1005:"Attempted to invoke a non-function. Did you mean ${{{token}}}?",T1006:"Attempted to invoke a non-function",T1007:"Attempted to partially apply a non-function. Did you mean ${{{token}}}?",T1008:"Attempted to partially apply a non-function",D1009:"Multiple key definitions evaluate to same key: {{value}}",D1010:"Attempted to access the Javascript object prototype",T1010:"The matcher function argument passed to function {{token}} does not return the correct object structure",T2001:"The left side of the {{token}} operator must evaluate to a number",T2002:"The right side of the {{token}} operator must evaluate to a number",T2003:"The left side of the range operator (..) must evaluate to an integer",T2004:"The right side of the range operator (..) must evaluate to an integer",D2005:"The left side of := must be a variable name (start with $)",T2006:"The right side of the function application operator ~> must be a function",T2007:"Type mismatch when comparing values {{value}} and {{value2}} in order-by clause",T2008:"The expressions within an order-by clause must evaluate to numeric or string values",T2009:"The values {{value}} and {{value2}} either side of operator {{token}} must be of the same data type",T2010:"The expressions either side of operator {{token}} must evaluate to numeric or string values",T2011:"The insert/update clause of the transform expression must evaluate to an object: {{value}}",T2012:"The delete clause of the transform expression must evaluate to a string or array of strings: {{value}}",T2013:"The transform expression clones the input object using the $clone() function. This has been overridden in the current scope by a non-function.",D2014:"The size of the sequence allocated by the range operator (..) must not exceed 1e6. Attempted to allocate {{value}}.",D3001:"Attempting to invoke string function on Infinity or NaN",D3010:"Second argument of replace function cannot be an empty string",D3011:"Fourth argument of replace function must evaluate to a positive number",D3012:"Attempted to replace a matched string with a non-string value",D3020:"Third argument of split function must evaluate to a positive number",D3030:"Unable to cast value to a number: {{value}}",D3040:"Third argument of match function must evaluate to a positive number",D3050:"The second argument of reduce function must be a function with at least two arguments",D3060:"The sqrt function cannot be applied to a negative number: {{value}}",D3061:"The power function has resulted in a value that cannot be represented as a JSON number: base={{value}}, exponent={{exp}}",D3070:"The single argument form of the sort function can only be applied to an array of strings or an array of numbers. Use the second argument to specify a comparison function",D3080:"The picture string must only contain a maximum of two sub-pictures",D3081:"The sub-picture must not contain more than one instance of the 'decimal-separator' character",D3082:"The sub-picture must not contain more than one instance of the 'percent' character",D3083:"The sub-picture must not contain more than one instance of the 'per-mille' character",D3084:"The sub-picture must not contain both a 'percent' and a 'per-mille' character",D3085:"The mantissa part of a sub-picture must contain at least one character that is either an 'optional digit character' or a member of the 'decimal digit family'",D3086:"The sub-picture must not contain a passive character that is preceded by an active character and that is followed by another active character",D3087:"The sub-picture must not contain a 'grouping-separator' character that appears adjacent to a 'decimal-separator' character",D3088:"The sub-picture must not contain a 'grouping-separator' at the end of the integer part",D3089:"The sub-picture must not contain two adjacent instances of the 'grouping-separator' character",D3090:"The integer part of the sub-picture must not contain a member of the 'decimal digit family' that is followed by an instance of the 'optional digit character'",D3091:"The fractional part of the sub-picture must not contain an instance of the 'optional digit character' that is followed by a member of the 'decimal digit family'",D3092:"A sub-picture that contains a 'percent' or 'per-mille' character must not contain a character treated as an 'exponent-separator'",D3093:"The exponent part of the sub-picture must comprise only of one or more characters that are members of the 'decimal digit family'",D3100:"The radix of the formatBase function must be between 2 and 36. It was given {{value}}",D3110:"The argument of the toMillis function must be an ISO 8601 formatted timestamp. Given {{value}}",D3120:"Syntax error in expression passed to function eval: {{value}}",D3121:"Dynamic error evaluating the expression passed to function eval: {{value}}",D3130:"Formatting or parsing an integer as a sequence starting with {{value}} is not supported by this implementation",D3131:"In a decimal digit pattern, all digits must be from the same decimal group",D3132:"Unknown component specifier {{value}} in date/time picture string",D3133:"The 'name' modifier can only be applied to months and days in the date/time picture string, not {{value}}",D3134:"The timezone integer format specifier cannot have more than four digits",D3135:"No matching closing bracket ']' in date/time picture string",D3136:"The date/time picture string is missing specifiers required to parse the timestamp",D3137:"{{{message}}}",D3138:"The $single() function expected exactly 1 matching result. Instead it matched more.",D3139:"The $single() function expected exactly 1 matching result. Instead it matched 0.",D3140:"Malformed URL passed to ${{{functionName}}}(): {{value}}",D3141:"{{{message}}}"};function Ue(e){var t=Ne[e.code];if(void 0!==t){var r=t.replace(/\{\{\{([^}]+)}}}/g,function(){return e[arguments[1]]});r=r.replace(/\{\{([^}]+)}}/g,function(){return JSON.stringify(e[arguments[1]])}),e.message=r}}function Ie(e,t){var r,n;try{r=d(e,t&&t.recover),n=r.errors,delete r.errors}catch(e){throw Ue(e),e}var a=Fe(k),u=new Date;return a.bind("now",Me(function(e,t){return f.fromMillis(u.getTime(),e,t)},"")),a.bind("millis",Me(function(){return u.getTime()},"<:n>")),t&&t.RegexEngine?Ie.RegexEngine=t.RegexEngine:Ie.RegexEngine=RegExp,{evaluate:function(){var e=p(s().mark(function e(t,c,p){var f,l,h,d;return s().wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(void 0===n){e.next=4;break}throw Ue(f={code:"S0500",position:0}),f;case 4:if(void 0!==c)for(h in l=Fe(a),c)l.bind(h,c[h]);else l=a;return l.bind("$",t),u=new Date,l.timestamp=u,Array.isArray(t)&&!i(t)&&((t=o(t)).outerWrapper=!0),e.prev=9,e.next=12,w(r,t,l);case 12:return d=e.sent,"function"==typeof p&&p(null,d),e.abrupt("return",d);case 17:throw e.prev=17,e.t0=e.catch(9),Ue(e.t0),e.t0;case 21:case"end":return e.stop()}},e,null,[[9,17]])}));return function(t,r,n){return e.apply(this,arguments)}}(),assign:function(e,t){a.bind(e,t)},registerFunction:function(e,t,r){var n=Me(t,r);a.bind(e,n)},ast:function(){return r},errors:function(){return n}}}return Ie.parser=d,Ie}();t.exports=b},{"./datetime":1,"./functions":2,"./parser":4,"./signature":5,"./utils":6}],4:[function(e,t,r){"use strict";var n,a,o,i=e("./signature"),s=(n={".":75,"[":80,"]":0,"{":70,"}":0,"(":80,")":0,",":0,"@":80,"#":80,";":80,":":80,"?":20,"+":50,"-":50,"*":60,"/":60,"%":60,"|":20,"=":40,"<":40,">":40,"^":40,"**":60,"..":20,":=":10,"!=":40,"<=":40,">=":40,"~>":40,and:30,or:25,in:40,"&":50,"!":0,"~":0},a={'"':'"',"\\":"\\","/":"/",b:"\b",f:"\f",n:"\n",r:"\r",t:"\t"},o=function(e){var t=0,r=e.length,o=function(e,r){return{type:e,value:r,position:t}};return function i(s){if(t>=r)return null;for(var u=e.charAt(t);t-1;)t++,u=e.charAt(t);if("/"===u&&"*"===e.charAt(t+1)){var c=t;for(t+=2,u=e.charAt(t);"*"!==u||"/"!==e.charAt(t+1);)if(u=e.charAt(++t),t>=r)throw{code:"S0106",stack:(new Error).stack,position:c};return t+=2,u=e.charAt(t),i(s)}if(!0!==s&&"/"===u)return t++,o("regex",function(){for(var n,a,o=t,i=0,s=function(t){if("/"===e.charAt(t)&&0===i){for(var r=0;"\\"===e.charAt(t-(r+1));)r++;if(r%2==0)return!0}return!1};t"===u&&"="===e.charAt(t+1))return t+=2,o("operator",">=");if("<"===u&&"="===e.charAt(t+1))return t+=2,o("operator","<=");if("*"===u&&"*"===e.charAt(t+1))return t+=2,o("operator","**");if("~"===u&&">"===e.charAt(t+1))return t+=2,o("operator","~>");if(Object.prototype.hasOwnProperty.call(n,u))return t++,o("operator",u);if('"'===u||"'"===u){var p=u;t++;for(var f="";t-1||Object.prototype.hasOwnProperty.call(n,g)){if("$"===e.charAt(t))return d=e.substring(t+1,m),t=m,o("variable",d);switch(d=e.substring(t,m),t=m,d){case"or":case"in":case"and":return o("operator",d);case"true":return o("value",!0);case"false":return o("value",!1);case"null":return o("value",null);default:return t===r&&""===d?null:o("name",d)}}else m++}},function(e,t){var r,a,s={},u=[],c=function(){var e=[];"(end)"!==r.id&&e.push({type:r.type,value:r.value,position:r.position});for(var t=a();null!==t;)e.push(t),t=a();return e},p={nud:function(){var e={code:"S0211",token:this.value,position:this.position};if(t)return e.remaining=c(),e.type="error",u.push(e),e;throw e.stack=(new Error).stack,e}},f=function(e,t){var r=s[e];return t=t||0,r?t>=r.lbp&&(r.lbp=t):((r=Object.create(p)).id=r.value=e,r.lbp=t,s[e]=r),r},l=function(e){if(t){e.remaining=c(),u.push(e);var n=s["(error)"];return(r=Object.create(n)).error=e,r.type="(error)",r}throw e.stack=(new Error).stack,e},h=function(t,n){if(t&&r.id!==t){var o={code:"(end)"===r.id?"S0203":"S0202",position:r.position,token:r.value,value:t};return l(o)}var i=a(n);if(null===i)return(r=s["(end)"]).position=e.length,r;var u,c=i.value,p=i.type;switch(p){case"name":case"variable":u=s["(name)"];break;case"operator":if(!(u=s[c]))return l({code:"S0204",stack:(new Error).stack,position:i.position,token:c});break;case"string":case"number":case"value":u=s["(literal)"];break;case"regex":p="regex",u=s["(regex)"];break;default:return l({code:"S0205",stack:(new Error).stack,position:i.position,token:c})}return(r=Object.create(u)).value=c,r.type=p,r.position=i.position,r},d=function(e){var t,n=r;for(h(null,!0),t=n.nud();e"),b("!="),b("<="),b(">="),b("&"),b("and"),b("or"),b("in"),v("and"),v("or"),v("in"),g("-"),b("~>"),y("(error)",10,function(e){return this.lhs=e,this.error=r.error,this.remaining=c(),this.type="error",this}),g("*",function(){return this.type="wildcard",this}),g("**",function(){return this.type="descendant",this}),g("%",function(){return this.type="parent",this}),b("(",n["("],function(e){if(this.procedure=e,this.type="function",this.arguments=[],")"!==r.id)for(;"operator"===r.type&&"?"===r.id?(this.type="partial",this.arguments.push(r),h("?")):this.arguments.push(d(0)),","===r.id;)h(",");if(h(")",!0),"name"===e.type&&("function"===e.value||"λ"===e.value)){if(this.arguments.forEach(function(e,t){if("variable"!==e.type)return l({code:"S0208",stack:(new Error).stack,position:e.position,token:e.value,value:t+1})}),this.type="lambda","<"===r.id){for(var t=r.position,n=1,a="<";n>0&&"{"!==r.id&&"(end)"!==r.id;){var o=h();">"===o.id?n--:"<"===o.id&&n++,a+=o.value}h(">");try{this.signature=i(a)}catch(e){return e.position=t+e.offset,l(e)}}h("{"),this.body=d(0),h("}")}return this}),g("(",function(){for(var e=[];")"!==r.id&&(e.push(d(0)),";"===r.id);)h(";");return h(")",!0),this.type="block",this.expressions=e,this}),g("[",function(){var e=[];if("]"!==r.id)for(;;){var t=d(0);if(".."===r.id){var n={type:"binary",value:"..",position:r.position,lhs:t};h(".."),n.rhs=d(0),t=n}if(e.push(t),","!==r.id)break;h(",")}return h("]",!0),this.expressions=e,this.type="unary",this}),b("[",n["["],function(e){if("]"===r.id){for(var t=e;t&&"binary"===t.type&&"["===t.value;)t=t.lhs;return t.keepArray=!0,h("]"),e}return this.lhs=e,this.rhs=d(n["]"]),this.type="binary",h("]",!0),this}),b("^",n["^"],function(e){h("(");for(var t=[];;){var n={descending:!1};if("<"===r.id?h("<"):">"===r.id&&(n.descending=!0,h(">")),n.expression=d(0),t.push(n),","!==r.id)break;h(",")}return h(")"),this.lhs=e,this.rhs=t,this.type="binary",this});var m=function(e){var t=[];if("}"!==r.id)for(;;){var n=d(0);h(":");var a=d(0);if(t.push([n,a]),","!==r.id)break;h(",")}return h("}",!0),void 0===e?(this.lhs=t,this.type="unary"):(this.lhs=e,this.rhs=t,this.type="binary"),this};g("{",m),b("{",n["{"],m),y(":=",n[":="],function(e){return"variable"!==e.type?l({code:"S0212",stack:(new Error).stack,position:e.position,token:e.value}):(this.lhs=e,this.rhs=d(n[":="]-1),this.type="binary",this)}),b("@",n["@"],function(e){return this.lhs=e,this.rhs=d(n["@"]),"variable"!==this.rhs.type?l({code:"S0214",stack:(new Error).stack,position:this.rhs.position,token:"@"}):(this.type="binary",this)}),b("#",n["#"],function(e){return this.lhs=e,this.rhs=d(n["#"]),"variable"!==this.rhs.type?l({code:"S0214",stack:(new Error).stack,position:this.rhs.position,token:"#"}):(this.type="binary",this)}),b("?",n["?"],function(e){return this.type="condition",this.condition=e,this.then=d(0),":"===r.id&&(h(":"),this.else=d(0)),this}),g("|",function(){return this.type="transform",this.pattern=d(0),h("|"),this.update=d(0),","===r.id&&(h(","),this.delete=d(0)),h("|"),this});var x=0,k=0,w=[],E=function e(t,r){switch(t.type){case"name":case"wildcard":r.level--,0===r.level&&(void 0===t.ancestor?t.ancestor=r:(w[r.index].slot.label=t.ancestor.label,t.ancestor=r),t.tuple=!0);break;case"parent":r.level++;break;case"block":t.expressions.length>0&&(t.tuple=!0,r=e(t.expressions[t.expressions.length-1],r));break;case"path":t.tuple=!0;var n=t.steps.length-1;for(r=e(t.steps[n--],r);r.level>0&&n>=0;)r=e(t.steps[n--],r);break;default:throw{code:"S0217",token:t.type,position:t.position}}return r},A=function(e,t){if(void 0!==t.seekingParent||"parent"===t.type){var r=void 0!==t.seekingParent?t.seekingParent:[];"parent"===t.type&&r.push(t.slot),void 0===e.seekingParent?e.seekingParent=r:Array.prototype.push.apply(e.seekingParent,r)}},S=function(e){var t=e.steps.length-1,r=e.steps[t],n=void 0!==r.seekingParent?r.seekingParent:[];"parent"===r.type&&n.push(r.slot);for(var a=0;a0;){if(t<0){void 0===e.seekingParent?e.seekingParent=[o]:e.seekingParent.push(o);break}for(var i=e.steps[t--];t>=0&&i.focus&&e.steps[t].focus;)i=e.steps[t--];o=E(i,o)}}};a=o(e),h();var T=d(0);if("(end)"!==r.id){var O={code:"S0201",position:r.position,token:r.value};l(O)}if("parent"===(T=function e(r){var n;switch(r.type){case"binary":switch(r.value){case".":var a=e(r.lhs);n="path"===a.type?a:{type:"path",steps:[a]},"parent"===a.type&&(n.seekingParent=[a.slot]);var o=e(r.rhs);"function"===o.type&&"path"===o.procedure.type&&1===o.procedure.steps.length&&"name"===o.procedure.steps[0].type&&"function"===n.steps[n.steps.length-1].type&&(n.steps[n.steps.length-1].nextFunction=o.procedure.steps[0].value),"path"===o.type?Array.prototype.push.apply(n.steps,o.steps):(void 0!==o.predicate&&(o.stages=o.predicate,delete o.predicate),n.steps.push(o)),n.steps.filter(function(e){if("number"===e.type||"value"===e.type)throw{code:"S0213",stack:(new Error).stack,position:e.position,value:e.value};return"string"===e.type}).forEach(function(e){e.type="name"}),n.steps.filter(function(e){return!0===e.keepArray}).length>0&&(n.keepSingletonArray=!0);var i=n.steps[0];"unary"===i.type&&"["===i.value&&(i.consarray=!0);var s=n.steps[n.steps.length-1];"unary"===s.type&&"["===s.value&&(s.consarray=!0),S(n);break;case"[":var c=n=e(r.lhs),p="predicate";if("path"===n.type&&(c=n.steps[n.steps.length-1],p="stages"),void 0!==c.group)throw{code:"S0209",stack:(new Error).stack,position:r.position};void 0===c[p]&&(c[p]=[]);var f=e(r.rhs);void 0!==f.seekingParent&&(f.seekingParent.forEach(function(e){1===e.level?E(c,e):e.level--}),A(c,f)),c[p].push({type:"filter",expr:f,position:r.position});break;case"{":if(void 0!==(n=e(r.lhs)).group)throw{code:"S0210",stack:(new Error).stack,position:r.position};n.group={lhs:r.rhs.map(function(t){return[e(t[0]),e(t[1])]}),position:r.position};break;case"^":"path"!==(n=e(r.lhs)).type&&(n={type:"path",steps:[n]});var l={type:"sort",position:r.position};l.terms=r.rhs.map(function(t){var r=e(t.expression);return A(l,r),{descending:t.descending,expression:r}}),n.steps.push(l),S(n);break;case":=":(n={type:"bind",value:r.value,position:r.position}).lhs=e(r.lhs),n.rhs=e(r.rhs),A(n,n.rhs);break;case"@":if(n=e(r.lhs),c=n,"path"===n.type&&(c=n.steps[n.steps.length-1]),void 0!==c.stages||void 0!==c.predicate)throw{code:"S0215",stack:(new Error).stack,position:r.position};if("sort"===c.type)throw{code:"S0216",stack:(new Error).stack,position:r.position};r.keepArray&&(c.keepArray=!0),c.focus=r.rhs.value,c.tuple=!0;break;case"#":n=e(r.lhs),c=n,"path"===n.type?c=n.steps[n.steps.length-1]:(n={type:"path",steps:[n]},void 0!==c.predicate&&(c.stages=c.predicate,delete c.predicate)),void 0===c.stages?c.index=r.rhs.value:c.stages.push({type:"index",value:r.rhs.value,position:r.position}),c.tuple=!0;break;case"~>":(n={type:"apply",value:r.value,position:r.position}).lhs=e(r.lhs),n.rhs=e(r.rhs);break;default:(n={type:r.type,value:r.value,position:r.position}).lhs=e(r.lhs),n.rhs=e(r.rhs),A(n,n.lhs),A(n,n.rhs)}break;case"unary":n={type:r.type,value:r.value,position:r.position},"["===r.value?n.expressions=r.expressions.map(function(t){var r=e(t);return A(n,r),r}):"{"===r.value?n.lhs=r.lhs.map(function(t){var r=e(t[0]);A(n,r);var a=e(t[1]);return A(n,a),[r,a]}):(n.expression=e(r.expression),"-"===r.value&&"number"===n.expression.type?(n=n.expression).value=-n.value:A(n,n.expression));break;case"function":case"partial":(n={type:r.type,name:r.name,value:r.value,position:r.position}).arguments=r.arguments.map(function(t){var r=e(t);return A(n,r),r}),n.procedure=e(r.procedure);break;case"lambda":n={type:r.type,arguments:r.arguments,signature:r.signature,position:r.position};var h=e(r.body);n.body=function e(t){var r;if("function"!==t.type||t.predicate)if("condition"===t.type)t.then=e(t.then),void 0!==t.else&&(t.else=e(t.else)),r=t;else if("block"===t.type){var n=t.expressions.length;n>0&&(t.expressions[n-1]=e(t.expressions[n-1])),r=t}else r=t;else{var a={type:"lambda",thunk:!0,arguments:[],position:t.position};a.body=t,r=a}return r}(h);break;case"condition":(n={type:r.type,position:r.position}).condition=e(r.condition),A(n,n.condition),n.then=e(r.then),A(n,n.then),void 0!==r.else&&(n.else=e(r.else),A(n,n.else));break;case"transform":(n={type:r.type,position:r.position}).pattern=e(r.pattern),n.update=e(r.update),void 0!==r.delete&&(n.delete=e(r.delete));break;case"block":(n={type:r.type,position:r.position}).expressions=r.expressions.map(function(t){var r=e(t);return A(n,r),(r.consarray||"path"===r.type&&r.steps[0].consarray)&&(n.consarray=!0),r});break;case"name":n={type:"path",steps:[r]},r.keepArray&&(n.keepSingletonArray=!0);break;case"parent":n={type:"parent",slot:{label:"!"+x++,level:1,index:k++}},w.push(n);break;case"string":case"number":case"value":case"wildcard":case"descendant":case"variable":case"regex":n=r;break;case"operator":if("and"===r.value||"or"===r.value||"in"===r.value)r.type="name",n=e(r);else{if("?"!==r.value)throw{code:"S0201",stack:(new Error).stack,position:r.position,token:r.value};n=r}break;case"error":n=r,r.lhs&&(n=e(r.lhs));break;default:var d="S0206";"(end)"===r.id&&(d="S0207");var v={code:d,position:r.position,token:r.value};if(t)return u.push(v),{type:"error",error:v};throw v.stack=(new Error).stack,v}return r.keepArray&&(n.keepArray=!0),n}(T)).type||void 0!==T.seekingParent)throw{code:"S0217",token:T.type,position:T.position};return u.length>0&&(T.errors=u),T});t.exports=s},{"./signature":5}],5:[function(e,t,r){"use strict";function n(e){"@babel/helpers - typeof";return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}var a=e("./utils"),o=function(){var e={a:"arrays",b:"booleans",f:"functions",n:"numbers",o:"objects",s:"strings"};return function(t){for(var r=1,o=[],i={},s=i;r");s.subtype=t.substring(r+1,h),r=h}r++}var d="^"+o.map(function(e){return"("+e.regex+")"}).join("")+"$",v=new RegExp(d),b=function(e){var t;if(a.isFunction(e))t="f";else switch(n(e)){case"string":t="s";break;case"number":t="n";break;case"boolean":t="b";break;case"object":t=null===e?"l":Array.isArray(e)?"a":"o";break;case"undefined":default:t="m"}return t};return{definition:t,validate:function(t,r){var n="";t.forEach(function(e){n+=b(e)});var a=v.exec(n);if(a){var i=[],s=0;return o.forEach(function(n,o){var u=t[s],c=a[o+1];if(""===c)if(n.context&&n.contextRegex){var p=b(r);if(!n.contextRegex.test(p))throw{code:"T0411",stack:(new Error).stack,value:r,index:s+1};i.push(r)}else i.push(u),s++;else c.split("").forEach(function(r){if("a"===n.type){if("m"===r)u=void 0;else{u=t[s];var a=!0;if(void 0!==n.subtype)if("a"!==r&&c!==n.subtype)a=!1;else if("a"===r&&u.length>0){var o=b(u[0]);a=o===n.subtype.charAt(0)&&0===u.filter(function(e){return b(e)!==o}).length}if(!a)throw{code:"T0412",stack:(new Error).stack,value:u,index:s+1,type:e[n.subtype]};"a"!==r&&(u=[u])}i.push(u),s++}else i.push(u),s++})}),i}!function(e,t){for(var r="^",n=0,a=0;a=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,s=!0,u=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return s=e.done,e},e:function(e){u=!0,i=e},f:function(){try{s||null==r.return||r.return()}finally{if(u)throw i}}}}function a(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r