UNPKG

@foxy.io/sdk

Version:

Universal SDK for a full server-side and a limited in-browser access to Foxy hAPI.

1 lines 268 kB
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.FoxySDK=e():(t.FoxySDK=t.FoxySDK||{},t.FoxySDK.Customer=e())}(self,(()=>(()=>{var t={575:t=>{t.exports=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}},226:t=>{t.exports=function(t,e){var n=e.get(t);if(!n)throw new TypeError("attempted to get private field on non-instance");return n.get?n.get.call(t):n.value}},962:t=>{t.exports=function(t,e,n){var r=e.get(t);if(!r)throw new TypeError("attempted to set private field on non-instance");if(r.set)r.set.call(t,n);else{if(!r.writable)throw new TypeError("attempted to set read only private field");r.value=n}return n}},913:t=>{function e(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}t.exports=function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}},652:function(t){t.exports=function(){"use strict";function t(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function e(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function n(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}function r(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function i(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function o(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?i(Object(n),!0).forEach((function(e){r(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):i(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}function a(t){return function(t){if(Array.isArray(t))return u(t)}(t)||function(t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(t))return Array.from(t)}(t)||s(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function s(t,e){if(t){if("string"==typeof t)return u(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?u(t,e):void 0}}function u(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function c(t){if("undefined"==typeof Symbol||null==t[Symbol.iterator]){if(Array.isArray(t)||(t=s(t))){var e=0,n=function(){};return{s:n,n:function(){return e>=t.length?{done:!0}:{done:!1,value:t[e++]}},e:function(t){throw t},f:n}}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 r,i,o=!0,a=!1;return{s:function(){r=t[Symbol.iterator]()},n:function(){var t=r.next();return o=t.done,t},e:function(t){a=!0,i=t},f:function(){try{o||null==r.return||r.return()}finally{if(a)throw i}}}}var f={};f[f.Fatal=0]="Fatal",f[f.Error=0]="Error",f[f.Warn=1]="Warn",f[f.Log=2]="Log",f[f.Info=3]="Info",f[f.Success=3]="Success",f[f.Debug=4]="Debug",f[f.Trace=5]="Trace",f[f.Silent=-1/0]="Silent",f[f.Verbose=1/0]="Verbose";var l={silent:{level:-1},fatal:{level:f.Fatal},error:{level:f.Error},warn:{level:f.Warn},log:{level:f.Log},info:{level:f.Info},success:{level:f.Success},debug:{level:f.Debug},trace:{level:f.Trace},verbose:{level:f.Trace},ready:{level:f.Info},start:{level:f.Info}};function h(t){return e=t,!("[object Object]"!==Object.prototype.toString.call(e)||!t.message&&!t.args||t.stack);var e}var p=!1,d=[],v=function(){function e(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};for(var r in t(this,e),this._reporters=n.reporters||[],this._types=n.types||l,this.level=void 0!==n.level?n.level:3,this._defaults=n.defaults||{},this._async=void 0!==n.async?n.async:void 0,this._stdout=n.stdout,this._stderr=n.stderr,this._mockFn=n.mockFn,this._throttle=n.throttle||1e3,this._throttleMin=n.throttleMin||5,this._types)this[r]=this._wrapLogFn(Object.assign({type:r},this._types[r],this._defaults));this._mockFn&&this.mockTypes(),this._lastLogSerialized=void 0,this._lastLog=void 0,this._lastLogTime=void 0,this._lastLogCount=0,this._throttleTimeout=void 0}return n(e,[{key:"create",value:function(t){return new e(Object.assign({reporters:this._reporters,level:this.level,types:this._types,defaults:this._defaults,stdout:this._stdout,stderr:this._stderr,mockFn:this._mockFn},t))}},{key:"withDefaults",value:function(t){return this.create({defaults:Object.assign({},this._defaults,t)})}},{key:"withTag",value:function(t){return this.withDefaults({tag:this._defaults.tag?this._defaults.tag+":"+t:t})}},{key:"addReporter",value:function(t){return this._reporters.push(t),this}},{key:"removeReporter",value:function(t){if(t){var e=this._reporters.indexOf(t);if(e>=0)return this._reporters.splice(e,1)}else this._reporters.splice(0);return this}},{key:"setReporters",value:function(t){return this._reporters=Array.isArray(t)?t:[t],this}},{key:"wrapAll",value:function(){this.wrapConsole(),this.wrapStd()}},{key:"restoreAll",value:function(){this.restoreConsole(),this.restoreStd()}},{key:"wrapConsole",value:function(){for(var t in this._types)console["__"+t]||(console["__"+t]=console[t]),console[t]=this[t]}},{key:"restoreConsole",value:function(){for(var t in this._types)console["__"+t]&&(console[t]=console["__"+t],delete console["__"+t])}},{key:"wrapStd",value:function(){this._wrapStream(this.stdout,"log"),this._wrapStream(this.stderr,"log")}},{key:"_wrapStream",value:function(t,e){var n=this;t&&(t.__write||(t.__write=t.write),t.write=function(t){n[e](String(t).trim())})}},{key:"restoreStd",value:function(){this._restoreStream(this.stdout),this._restoreStream(this.stderr)}},{key:"_restoreStream",value:function(t){t&&t.__write&&(t.write=t.__write,delete t.__write)}},{key:"pauseLogs",value:function(){p=!0}},{key:"resumeLogs",value:function(){p=!1;var t,e=c(d.splice(0));try{for(e.s();!(t=e.n()).done;){var n=t.value;n[0]._logFn(n[1],n[2])}}catch(t){e.e(t)}finally{e.f()}}},{key:"mockTypes",value:function(t){if(this._mockFn=t||this._mockFn,"function"==typeof this._mockFn)for(var e in this._types)this[e]=this._mockFn(e,this._types[e])||this[e]}},{key:"_wrapLogFn",value:function(t){return function(){if(!p)return this._logFn(t,arguments);d.push([this,t,arguments])}.bind(this)}},{key:"_logFn",value:function(t,e){var n=this;if(t.level>this.level)return!!this._async&&Promise.resolve(!1);var r=Object.assign({date:new Date,args:[]},t);1===e.length&&h(e[0])?Object.assign(r,e[0]):r.args=Array.from(e),r.message&&(r.args.unshift(r.message),delete r.message),r.additional&&(Array.isArray(r.additional)||(r.additional=r.additional.split("\n")),r.args.push("\n"+r.additional.join("\n")),delete r.additional),r.type="string"==typeof r.type?r.type.toLowerCase():"",r.tag="string"==typeof r.tag?r.tag.toLowerCase():"";var i=function(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0],e=n._lastLogCount-n._throttleMin;if(n._lastLog&&e>0){var i=a(n._lastLog.args);e>1&&i.push("(repeated ".concat(e," times)")),n._log(o(o({},n._lastLog),{},{args:i})),n._lastLogCount=1}if(t){if(n._lastLog=r,n._async)return n._logAsync(r);n._log(r)}};clearTimeout(this._throttleTimeout);var s=this._lastLogTime?r.date-this._lastLogTime:0;if(this._lastLogTime=r.date,s<this._throttle)try{var u=JSON.stringify([r.type,r.tag,r.args]),c=this._lastLogSerialized===u;if(this._lastLogSerialized=u,c&&(this._lastLogCount++,this._lastLogCount>this._throttleMin))return void(this._throttleTimeout=setTimeout(i,this._throttle))}catch(t){}i(!0)}},{key:"_log",value:function(t){var e,n=c(this._reporters);try{for(n.s();!(e=n.n()).done;)e.value.log(t,{async:!1,stdout:this.stdout,stderr:this.stderr})}catch(t){n.e(t)}finally{n.f()}}},{key:"_logAsync",value:function(t){var e=this;return Promise.all(this._reporters.map((function(n){return n.log(t,{async:!0,stdout:e.stdout,stderr:e.stderr})})))}},{key:"stdout",get:function(){return this._stdout||console._stdout}},{key:"stderr",get:function(){return this._stderr||console._stderr}}]),e}();v.prototype.add=v.prototype.addReporter,v.prototype.remove=v.prototype.removeReporter,v.prototype.clear=v.prototype.removeReporter,v.prototype.withScope=v.prototype.withTag,v.prototype.mock=v.prototype.mockTypes,v.prototype.pause=v.prototype.pauseLogs,v.prototype.resume=v.prototype.resumeLogs;var y,g=function(){function e(n){t(this,e),this.options=Object.assign({},n),this.defaultColor="#7f8c8d",this.levelColorMap={0:"#c0392b",1:"#f39c12",3:"#00BCD4"},this.typeColorMap={success:"#2ecc71"}}return n(e,[{key:"log",value:function(t){var e=t.level<1?console.__error||console.error:1===t.level&&console.warn?console.__warn||console.warn:console.__log||console.log,n="log"!==t.type?t.type:"",r=t.tag?t.tag:"",i=this.typeColorMap[t.type]||this.levelColorMap[t.level]||this.defaultColor,o="\n background: ".concat(i,";\n border-radius: 0.5em;\n color: white;\n font-weight: bold;\n padding: 2px 0.5em;\n "),s="%c".concat([r,n].filter(Boolean).join(":"));"string"==typeof t.args[0]?e.apply(void 0,["".concat(s,"%c ").concat(t.args[0]),o,""].concat(a(t.args.slice(1)))):e.apply(void 0,[s,o].concat(a(t.args)))}}]),e}();return"undefined"!=typeof window&&window.consola||((y=new v({reporters:[new g]})).Consola=v,y.LogLevel=f,y.BrowserReporter=g,y)}()},98:function(t,e){var n="undefined"!=typeof self?self:this,r=function(){function t(){this.fetch=!1,this.DOMException=n.DOMException}return t.prototype=n,new t}();!function(t){!function(e){var n={searchParams:"URLSearchParams"in t,iterable:"Symbol"in t&&"iterator"in Symbol,blob:"FileReader"in t&&"Blob"in t&&function(){try{return new Blob,!0}catch(t){return!1}}(),formData:"FormData"in t,arrayBuffer:"ArrayBuffer"in t};if(n.arrayBuffer)var r=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],i=ArrayBuffer.isView||function(t){return t&&r.indexOf(Object.prototype.toString.call(t))>-1};function o(t){if("string"!=typeof t&&(t=String(t)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(t))throw new TypeError("Invalid character in header field name");return t.toLowerCase()}function a(t){return"string"!=typeof t&&(t=String(t)),t}function s(t){var e={next:function(){var e=t.shift();return{done:void 0===e,value:e}}};return n.iterable&&(e[Symbol.iterator]=function(){return e}),e}function u(t){this.map={},t instanceof u?t.forEach((function(t,e){this.append(e,t)}),this):Array.isArray(t)?t.forEach((function(t){this.append(t[0],t[1])}),this):t&&Object.getOwnPropertyNames(t).forEach((function(e){this.append(e,t[e])}),this)}function c(t){if(t.bodyUsed)return Promise.reject(new TypeError("Already read"));t.bodyUsed=!0}function f(t){return new Promise((function(e,n){t.onload=function(){e(t.result)},t.onerror=function(){n(t.error)}}))}function l(t){var e=new FileReader,n=f(e);return e.readAsArrayBuffer(t),n}function h(t){if(t.slice)return t.slice(0);var e=new Uint8Array(t.byteLength);return e.set(new Uint8Array(t)),e.buffer}function p(){return this.bodyUsed=!1,this._initBody=function(t){var e;this._bodyInit=t,t?"string"==typeof t?this._bodyText=t:n.blob&&Blob.prototype.isPrototypeOf(t)?this._bodyBlob=t:n.formData&&FormData.prototype.isPrototypeOf(t)?this._bodyFormData=t:n.searchParams&&URLSearchParams.prototype.isPrototypeOf(t)?this._bodyText=t.toString():n.arrayBuffer&&n.blob&&((e=t)&&DataView.prototype.isPrototypeOf(e))?(this._bodyArrayBuffer=h(t.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):n.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(t)||i(t))?this._bodyArrayBuffer=h(t):this._bodyText=t=Object.prototype.toString.call(t):this._bodyText="",this.headers.get("content-type")||("string"==typeof t?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):n.searchParams&&URLSearchParams.prototype.isPrototypeOf(t)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},n.blob&&(this.blob=function(){var t=c(this);if(t)return t;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this._bodyArrayBuffer?c(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(l)}),this.text=function(){var t,e,n,r=c(this);if(r)return r;if(this._bodyBlob)return t=this._bodyBlob,e=new FileReader,n=f(e),e.readAsText(t),n;if(this._bodyArrayBuffer)return Promise.resolve(function(t){for(var e=new Uint8Array(t),n=new Array(e.length),r=0;r<e.length;r++)n[r]=String.fromCharCode(e[r]);return n.join("")}(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},n.formData&&(this.formData=function(){return this.text().then(y)}),this.json=function(){return this.text().then(JSON.parse)},this}u.prototype.append=function(t,e){t=o(t),e=a(e);var n=this.map[t];this.map[t]=n?n+", "+e:e},u.prototype.delete=function(t){delete this.map[o(t)]},u.prototype.get=function(t){return t=o(t),this.has(t)?this.map[t]:null},u.prototype.has=function(t){return this.map.hasOwnProperty(o(t))},u.prototype.set=function(t,e){this.map[o(t)]=a(e)},u.prototype.forEach=function(t,e){for(var n in this.map)this.map.hasOwnProperty(n)&&t.call(e,this.map[n],n,this)},u.prototype.keys=function(){var t=[];return this.forEach((function(e,n){t.push(n)})),s(t)},u.prototype.values=function(){var t=[];return this.forEach((function(e){t.push(e)})),s(t)},u.prototype.entries=function(){var t=[];return this.forEach((function(e,n){t.push([n,e])})),s(t)},n.iterable&&(u.prototype[Symbol.iterator]=u.prototype.entries);var d=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function v(t,e){var n,r,i=(e=e||{}).body;if(t instanceof v){if(t.bodyUsed)throw new TypeError("Already read");this.url=t.url,this.credentials=t.credentials,e.headers||(this.headers=new u(t.headers)),this.method=t.method,this.mode=t.mode,this.signal=t.signal,i||null==t._bodyInit||(i=t._bodyInit,t.bodyUsed=!0)}else this.url=String(t);if(this.credentials=e.credentials||this.credentials||"same-origin",!e.headers&&this.headers||(this.headers=new u(e.headers)),this.method=(n=e.method||this.method||"GET",r=n.toUpperCase(),d.indexOf(r)>-1?r:n),this.mode=e.mode||this.mode||null,this.signal=e.signal||this.signal,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&i)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(i)}function y(t){var e=new FormData;return t.trim().split("&").forEach((function(t){if(t){var n=t.split("="),r=n.shift().replace(/\+/g," "),i=n.join("=").replace(/\+/g," ");e.append(decodeURIComponent(r),decodeURIComponent(i))}})),e}function g(t,e){e||(e={}),this.type="default",this.status=void 0===e.status?200:e.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in e?e.statusText:"OK",this.headers=new u(e.headers),this.url=e.url||"",this._initBody(t)}v.prototype.clone=function(){return new v(this,{body:this._bodyInit})},p.call(v.prototype),p.call(g.prototype),g.prototype.clone=function(){return new g(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new u(this.headers),url:this.url})},g.error=function(){var t=new g(null,{status:0,statusText:""});return t.type="error",t};var m=[301,302,303,307,308];g.redirect=function(t,e){if(-1===m.indexOf(e))throw new RangeError("Invalid status code");return new g(null,{status:e,headers:{location:t}})},e.DOMException=t.DOMException;try{new e.DOMException}catch(t){e.DOMException=function(t,e){this.message=t,this.name=e;var n=Error(t);this.stack=n.stack},e.DOMException.prototype=Object.create(Error.prototype),e.DOMException.prototype.constructor=e.DOMException}function b(t,r){return new Promise((function(i,o){var a=new v(t,r);if(a.signal&&a.signal.aborted)return o(new e.DOMException("Aborted","AbortError"));var s=new XMLHttpRequest;function c(){s.abort()}s.onload=function(){var t,e,n={status:s.status,statusText:s.statusText,headers:(t=s.getAllResponseHeaders()||"",e=new u,t.replace(/\r?\n[\t ]+/g," ").split(/\r?\n/).forEach((function(t){var n=t.split(":"),r=n.shift().trim();if(r){var i=n.join(":").trim();e.append(r,i)}})),e)};n.url="responseURL"in s?s.responseURL:n.headers.get("X-Request-URL");var r="response"in s?s.response:s.responseText;i(new g(r,n))},s.onerror=function(){o(new TypeError("Network request failed"))},s.ontimeout=function(){o(new TypeError("Network request failed"))},s.onabort=function(){o(new e.DOMException("Aborted","AbortError"))},s.open(a.method,a.url,!0),"include"===a.credentials?s.withCredentials=!0:"omit"===a.credentials&&(s.withCredentials=!1),"responseType"in s&&n.blob&&(s.responseType="blob"),a.headers.forEach((function(t,e){s.setRequestHeader(e,t)})),a.signal&&(a.signal.addEventListener("abort",c),s.onreadystatechange=function(){4===s.readyState&&a.signal.removeEventListener("abort",c)}),s.send(void 0===a._bodyInit?null:a._bodyInit)}))}b.polyfill=!0,t.fetch||(t.fetch=b,t.Headers=u,t.Request=v,t.Response=g),e.Headers=u,e.Request=v,e.Response=g,e.fetch=b,Object.defineProperty(e,"__esModule",{value:!0})}({})}(r),r.fetch.ponyfill=!0,delete r.fetch.polyfill;var i=r;(e=i.fetch).default=i.fetch,e.fetch=i.fetch,e.Headers=i.Headers,e.Request=i.Request,e.Response=i.Response,t.exports=e},545:(t,e,n)=>{"use strict";n.r(e),n.d(e,{default:()=>h});var r=n(575),i=n.n(r),o=n(913),a=n.n(o),s=n(962),u=n.n(s),c=n(226),f=n.n(c),l=new WeakMap;const h=function(){function t(){i()(this,t),l.set(this,{writable:!0,value:{}})}return a()(t,[{key:"key",value:function(t){var e;return null!==(e=Object.keys(f()(this,l))[Number.parseInt(t,10)])&&void 0!==e?e:null}},{key:"getItem",value:function(t){var e=f()(this,l),n="".concat(t);return Object.prototype.hasOwnProperty.call(e,n)?e[n]:null}},{key:"setItem",value:function(t,e){return f()(this,l)["".concat(t)]="".concat(e)}},{key:"removeItem",value:function(t,e){var n=f()(this,l),r="".concat(t);Object.prototype.hasOwnProperty.call(n,r)&&delete n[r]}},{key:"clear",value:function(t,e){u()(this,l,{})}},{key:"length",get:function(){return Object.keys(f()(this,l)).length}}]),t}()},998:(t,e,n)=>{t.exports=function(){function t(e,n,r){function i(a,s){if(!n[a]){if(!e[a]){if(o)return o(a,!0);var u=new Error("Cannot find module '"+a+"'");throw u.code="MODULE_NOT_FOUND",u}var c=n[a]={exports:{}};e[a][0].call(c.exports,(function(t){return i(e[a][1][t]||t)}),c,c.exports,t,e,n,r)}return n[a].exports}for(var o=void 0,a=0;a<r.length;a++)i(r[a]);return i}return t}()({1:[function(t,e,n){const r=t("./utils"),i=function(){"use strict";const t=r.stringToArray,e=["Zero","One","Two","Three","Four","Five","Six","Seven","Eight","Nine","Ten","Eleven","Twelve","Thirteen","Fourteen","Fifteen","Sixteen","Seventeen","Eighteen","Nineteen"],n=["Zeroth","First","Second","Third","Fourth","Fifth","Sixth","Seventh","Eighth","Ninth","Tenth","Eleventh","Twelfth","Thirteenth","Fourteenth","Fifteenth","Sixteenth","Seventeenth","Eighteenth","Nineteenth"],i=["Twenty","Thirty","Forty","Fifty","Sixty","Seventy","Eighty","Ninety","Hundred"],o=["Thousand","Million","Billion","Trillion"];function a(t,r){var a=function(t,r,s){var u="";if(t<=19)u=(r?" and ":"")+(s?n[t]:e[t]);else if(t<100){const e=Math.floor(t/10),n=t%10;u=(r?" and ":"")+i[e-2],n>0?u+="-"+a(n,!1,s):s&&(u=u.substring(0,u.length-1)+"ieth")}else if(t<1e3){const n=Math.floor(t/100),i=t%100;u=(r?", ":"")+e[n]+" Hundred",i>0?u+=a(i,!0,s):s&&(u+="th")}else{var c=Math.floor(Math.log10(t)/3);c>o.length&&(c=o.length);const e=Math.pow(10,3*c),n=Math.floor(t/e),i=t-n*e;u=(r?", ":"")+a(n,!1,!1)+" "+o[c-1],i>0?u+=a(i,!0,s):s&&(u+="th")}return u};return a(t,!1,r)}const s={};function u(t){const e=t.split(/,\s|\sand\s|[\s\\-]/).map((t=>s[t]));let n=[0];return e.forEach((t=>{if(t<100){let e=n.pop();e>=1e3&&(n.push(e),e=0),n.push(e+t)}else n.push(n.pop()*t)})),n.reduce(((t,e)=>t+e),0)}e.forEach((function(t,e){s[t.toLowerCase()]=e})),n.forEach((function(t,e){s[t.toLowerCase()]=e})),i.forEach((function(t,e){const n=t.toLowerCase();s[n]=10*(e+2),s[n.substring(0,t.length-1)+"ieth"]=s[n]})),s.hundredth=100,o.forEach((function(t,e){const n=t.toLowerCase(),r=Math.pow(10,3*(e+1));s[n]=r,s[n+"th"]=r}));const c=[[1e3,"m"],[900,"cm"],[500,"d"],[400,"cd"],[100,"c"],[90,"xc"],[50,"l"],[40,"xl"],[10,"x"],[9,"ix"],[5,"v"],[4,"iv"],[1,"i"]],f={M:1e3,D:500,C:100,L:50,X:10,V:5,I:1};function l(t){for(var e=0;e<c.length;e++){const n=c[e];if(t>=n[0])return n[1]+l(t-n[0])}return""}function h(t){for(var e=0,n=1,r=t.length-1;r>=0;r--){const i=t[r],o=f[i];o<n?e-=o:(n=o,e+=o)}return e}function p(t,e){for(var n=[],r=e.charCodeAt(0);t>0;)n.unshift(String.fromCharCode((t-1)%26+r)),t=Math.floor((t-1)/26);return n.join("")}function d(t,e){for(var n=e.charCodeAt(0),r=0,i=0;i<t.length;i++)r+=(t.charCodeAt(t.length-i-1)-n+1)*Math.pow(26,i);return r}function v(t,e){if(void 0!==t)return m(t=Math.floor(t),_(e))}const y={DECIMAL:"decimal",LETTERS:"letters",ROMAN:"roman",WORDS:"words",SEQUENCE:"sequence"},g={UPPER:"upper",LOWER:"lower",TITLE:"title"};function m(e,n){let r;const i=e<0;switch(e=Math.abs(e),n.primary){case y.LETTERS:r=p(e,n.case===g.UPPER?"A":"a");break;case y.ROMAN:r=l(e),n.case===g.UPPER&&(r=r.toUpperCase());break;case y.WORDS:r=a(e,n.ordinal),n.case===g.UPPER?r=r.toUpperCase():n.case===g.LOWER&&(r=r.toLowerCase());break;case y.DECIMAL:r=""+e;var o=n.mandatoryDigits-r.length;if(o>0){var s=new Array(o+1).join("0");r=s+r}if(48!==n.zeroCode&&(r=t(r).map((t=>String.fromCodePoint(t.codePointAt(0)+n.zeroCode-48))).join("")),n.regular)for(let t=Math.floor((r.length-1)/n.groupingSeparators.position);t>0;t--){const e=r.length-t*n.groupingSeparators.position;r=r.substr(0,e)+n.groupingSeparators.character+r.substr(e)}else n.groupingSeparators.reverse().forEach((t=>{const e=r.length-t.position;r=r.substr(0,e)+t.character+r.substr(e)}));if(n.ordinal){var u={1:"st",2:"nd",3:"rd"}[r[r.length-1]];(!u||r.length>1&&"1"===r[r.length-2])&&(u="th"),r+=u}break;case y.SEQUENCE:throw{code:"D3130",value:n.token}}return i&&(r="-"+r),r}const b=[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 _(e){const n={type:"integer",primary:y.DECIMAL,case:g.LOWER,ordinal:!1};let r,i;const o=e.lastIndexOf(";");switch(-1===o?r=e:(r=e.substring(0,o),i=e.substring(o+1),"o"===i[0]&&(n.ordinal=!0)),r){case"A":n.case=g.UPPER;case"a":n.primary=y.LETTERS;break;case"I":n.case=g.UPPER;case"i":n.primary=y.ROMAN;break;case"W":n.case=g.UPPER,n.primary=y.WORDS;break;case"Ww":n.case=g.TITLE,n.primary=y.WORDS;break;case"w":n.primary=y.WORDS;break;default:{let e=null,i=0,o=0,a=[],s=0;if(t(r).map((t=>t.codePointAt(0))).reverse().forEach((t=>{let n=!1;for(let r=0;r<b.length;r++){const o=b[r];if(t>=o&&t<=o+9){if(n=!0,i++,s++,null===e)e=o;else if(o!==e)throw{code:"D3131"};break}}n||(35===t?(s++,o++):a.push({position:s,character:String.fromCodePoint(t)}))})),i>0){n.primary=y.DECIMAL,n.zeroCode=e,n.mandatoryDigits=i,n.optionalDigits=o;const t=function(t){if(0===t.length)return 0;const e=t[0].character;for(let n=1;n<t.length;n++)if(t[n].character!==e)return 0;const n=t.map((t=>t.position)),r=function(t,e){return 0===e?t:r(e,t%e)},i=n.reduce(r);for(let t=1;t<=n.length;t++)if(-1===n.indexOf(t*i))return 0;return i}(a);t>0?(n.regular=!0,n.groupingSeparators={position:t,character:a[0].character}):(n.regular=!1,n.groupingSeparators=a)}else n.primary=y.SEQUENCE,n.token=r}}return n}const w={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 x(t){var e=[];const n={type:"datetime",parts:e},r=function(n,r){if(r>n){let i=t.substring(n,r);i=i.split("]]").join("]"),e.push({type:"literal",value:i})}};for(var i=0,o=0;o<t.length;){if("["===t.charAt(o)){if("["===t.charAt(o+1)){r(i,o),e.push({type:"literal",value:"["}),i=o+=2;continue}if(r(i,o),i=o,-1===(o=t.indexOf("]",i)))throw{code:"D3135"};let n=t.substring(i+1,o);n=n.split(/\s+/).join("");var a,s={type:"marker",component:n.charAt(0)},u=n.lastIndexOf(",");if(-1!==u){const t=n.substring(u+1),e=t.indexOf("-");let r,i;const o=function(t){return void 0===t||"*"===t?void 0:parseInt(t)};-1===e?r=t:(r=t.substring(0,e),i=t.substring(e+1));const c={min:o(r),max:o(i)};s.width=c,a=n.substring(1,u)}else a=n.substring(1);if(1===a.length)s.presentation1=a;else if(a.length>1){var c=a.charAt(a.length-1);-1!=="atco".indexOf(c)?(s.presentation2=c,"o"===c&&(s.ordinal=!0),s.presentation1=a.substring(0,a.length-1)):s.presentation1=a}else s.presentation1=w[s.component];if(void 0===s.presentation1)throw{code:"D3132",value:s.component};if("n"===s.presentation1[0])s.names=g.LOWER;else if("N"===s.presentation1[0])"n"===s.presentation1[1]?s.names=g.TITLE:s.names=g.UPPER;else if(-1!=="YMDdFWwXxHhmsf".indexOf(s.component)){var f=s.presentation1;if(s.presentation2&&(f+=";"+s.presentation2),s.integerFormat=_(f),s.width&&void 0!==s.width.min&&s.integerFormat.mandatoryDigits<s.width.min&&(s.integerFormat.mandatoryDigits=s.width.min),-1!=="YMD".indexOf(s.component))if(s.n=-1,s.width&&void 0!==s.width.max)s.n=s.width.max,s.integerFormat.mandatoryDigits=s.n;else{var l=s.integerFormat.mandatoryDigits+s.integerFormat.optionalDigits;l>=2&&(s.n=l)}}"Z"!==s.component&&"z"!==s.component||(s.integerFormat=_(s.presentation1)),e.push(s),i=o+1}o++}return r(i,o),n}const k=["","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"],E=["January","February","March","April","May","June","July","August","September","October","November","December"],S=864e5,O=function(t){const e=Date.UTC(t.year,t.month);var n=new Date(e).getUTCDay();return 0===n&&(n=7),n>4?e+(8-n)*S:e-(n-1)*S},A=function(t,e){return{year:t,month:e,nextMonth:function(){return 11===e?A(t+1,0):A(t,e+1)},previousMonth:function(){return 0===e?A(t-1,11):A(t,e-1)},nextYear:function(){return A(t+1,e)},previousYear:function(){return A(t-1,e)}}},j=function(t,e){return(e-t)/(7*S)+1},T=(t,e)=>{let n;switch(e){case"Y":n=t.getUTCFullYear();break;case"M":n=t.getUTCMonth()+1;break;case"D":n=t.getUTCDate();break;case"d":n=(Date.UTC(t.getUTCFullYear(),t.getUTCMonth(),t.getUTCDate())-Date.UTC(t.getUTCFullYear(),0))/S+1;break;case"F":n=t.getUTCDay(),0===n&&(n=7);break;case"W":{const e=A(t.getUTCFullYear(),0),r=O(e),i=Date.UTC(e.year,t.getUTCMonth(),t.getUTCDate());let o=j(r,i);if(o>52)i>=O(e.nextYear())&&(o=1);else if(o<1){const t=O(e.previousYear());o=j(t,i)}n=Math.floor(o);break}case"w":{const e=A(t.getUTCFullYear(),t.getUTCMonth()),r=O(e),i=Date.UTC(e.year,e.month,t.getUTCDate());let o=j(r,i);if(o>4)i>=O(e.nextMonth())&&(o=1);else if(o<1){const t=O(e.previousMonth());o=j(t,i)}n=Math.floor(o);break}case"X":{const e=A(t.getUTCFullYear(),0),r=O(e),i=O(e.nextYear()),o=t.getTime();n=o<r?e.year-1:o>=i?e.year+1:e.year;break}case"x":{const e=A(t.getUTCFullYear(),t.getUTCMonth()),r=O(e),i=e.nextMonth(),o=O(i),a=t.getTime();n=a<r?e.previousMonth().month+1:a>=o?i.month+1:e.month+1;break}case"H":n=t.getUTCHours();break;case"h":n=t.getUTCHours(),n%=12,0===n&&(n=12);break;case"P":n=t.getUTCHours()>=12?"pm":"am";break;case"m":n=t.getUTCMinutes();break;case"s":n=t.getUTCSeconds();break;case"f":n=t.getUTCMilliseconds();break;case"Z":case"z":break;case"C":case"E":n="ISO"}return n};let D=null;function P(t,e,n){var r=0,i=0;if(void 0!==n){const t=parseInt(n);r=Math.floor(t/100),i=t%100}var o=function(t,e){var n=T(t,e.component);if(-1!=="YMDdFWwXxHhms".indexOf(e.component))if("Y"===e.component&&-1!==e.n&&(n%=Math.pow(10,e.n)),e.names){if("M"===e.component||"x"===e.component)n=E[n-1];else{if("F"!==e.component)throw{code:"D3133",value:e.component};n=k[n]}e.names===g.UPPER?n=n.toUpperCase():e.names===g.LOWER&&(n=n.toLowerCase()),e.width&&n.length>e.width.max&&(n=n.substring(0,e.width.max))}else n=m(n,e.integerFormat);else if("f"===e.component)n=m(n,e.integerFormat);else if("Z"===e.component||"z"===e.component){const t=100*r+i;if(e.integerFormat.regular)n=m(t,e.integerFormat);else{const o=e.integerFormat.mandatoryDigits;if(1===o||2===o)n=m(r,e.integerFormat),0!==i&&(n+=":"+v(i,"00"));else{if(3!==o&&4!==o)throw{code:"D3134",value:o};n=m(t,e.integerFormat)}}t>=0&&(n="+"+n),"z"===e.component&&(n="GMT"+n),0===t&&"t"===e.presentation2&&(n="Z")}return n};let a;void 0===e?(null===D&&(D=x("[Y0001]-[M01]-[D01]T[H01]:[m01]:[s01].[f001][Z01:01t]")),a=D):a=x(e);const s=new Date(t+60*(60*r+i)*1e3);let u="";return a.parts.forEach((function(t){"literal"===t.type?u+=t.value:u+=o(s,t)})),u}function I(t){var e={};if("datetime"===t.type)e.type="datetime",e.parts=t.parts.map((function(t){var e={};if("literal"===t.type)e.regex=t.value.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");else if("Z"===t.component||"z"===t.component){let n;Array.isArray(t.integerFormat.groupingSeparators)||(n=t.integerFormat.groupingSeparators),e.regex="","z"===t.component&&(e.regex="GMT"),e.regex+="[-+][0-9]+",n&&(e.regex+=n.character+"[0-9]+"),e.parse=function(e){"z"===t.component&&(e=e.substring(3));let r=0,i=0;return n?(r=Number.parseInt(e.substring(0,e.indexOf(n.character))),i=Number.parseInt(e.substring(e.indexOf(n.character)+1))):e.length-1<=2?r=Number.parseInt(e):(r=Number.parseInt(e.substring(0,3)),i=Number.parseInt(e.substring(3))),60*r+i}}else if(t.integerFormat)t.integerFormat.n=t.n,e=I(t.integerFormat);else{e.regex="[a-zA-Z]+";var n={};if("M"===t.component||"x"===t.component)E.forEach((function(e,r){t.width&&t.width.max?n[e.substring(0,t.width.max)]=r+1:n[e]=r+1}));else if("F"===t.component)k.forEach((function(e,r){r>0&&(t.width&&t.width.max?n[e.substring(0,t.width.max)]=r:n[e]=r)}));else{if("P"!==t.component)throw{code:"D3133",value:t.component};n={am:0,AM:0,pm:1,PM:1}}e.parse=function(t){return n[t]}}return e.component=t.component,e}));else{e.type="integer";const n=t.case===g.UPPER;let r;switch(r=t.n&&t.n>0?0===t.optionalDigits?`{${t.n}}`:`{${t.n-t.optionalDigits},${t.n}}`:"+",t.primary){case y.LETTERS:e.regex=n?"[A-Z]+":"[a-z]+",e.parse=function(t){return d(t,n?"A":"a")};break;case y.ROMAN:e.regex=n?"[MDCLXVI]+":"[mdclxvi]+",e.parse=function(t){return h(n?t:t.toUpperCase())};break;case y.WORDS:e.regex="(?:"+Object.keys(s).concat("and","[\\-, ]").join("|")+")+",e.parse=function(t){return u(t.toLowerCase())};break;case y.DECIMAL:e.regex=`[0-9]${r}`,t.ordinal&&(e.regex+="(?:th|st|nd|rd)"),e.parse=function(e){let n=e;return t.ordinal&&(n=e.substring(0,e.length-2)),t.regular?n=n.split(",").join(""):t.groupingSeparators.forEach((t=>{n=n.split(t.character).join("")})),48!==t.zeroCode&&(n=n.split("").map((e=>String.fromCodePoint(e.codePointAt(0)-t.zeroCode+48))).join("")),parseInt(n)};break;case y.SEQUENCE:throw{code:"D3130",value:t.token}}}return e}function N(t,e){if(void 0!==t)return I(_(e)).parse(t)}function R(t,e){const n=I(x(e)),r="^"+n.parts.map((t=>"("+t.regex+")")).join("")+"$";var i=new RegExp(r,"i").exec(t);if(null!==i){const t=161,e=130,r=84,a=72,s=23,u=47,c={};for(let t=1;t<i.length;t++){const e=n.parts[t-1];e.parse&&(c[e.component]=e.parse(i[t]))}if(0===Object.getOwnPropertyNames(c).length)return;let f=0;const l=t=>{f<<=1,f+=t?1:0},h=t=>!(~t&f||!(t&f));"YXMxWwdD".split("").forEach((t=>l(c[t])));const p=!h(t)&&h(e),d=h(r),v=!d&&h(a);f=0,"PHhmsf".split("").forEach((t=>l(c[t])));const y=!h(s)&&h(u),g=(p?"YD":d?"XxwF":v?"XWF":"YMD")+(y?"Phmsf":"Hmsf"),m=this.environment.timestamp;let b=!1,_=!1;if(g.split("").forEach((t=>{if(void 0===c[t])b?(c[t]=-1!=="MDd".indexOf(t)?1:0,_=!0):c[t]=T(m,t);else if(b=!0,_)throw{code:"D3136"}})),c.M>0?c.M-=1:c.M=0,p){const t=Date.UTC(c.Y,0),e=1e3*(c.d-1)*60*60*24,n=new Date(t+e);c.M=n.getUTCMonth(),c.D=n.getUTCDate()}if(d)throw{code:"D3136"};if(v)throw{code:"D3136"};y&&(c.H=12===c.h?0:c.h,1===c.P&&(c.H+=12));var o=Date.UTC(c.Y,c.M,c.D,c.H,c.m,c.s,c.f);return(c.Z||c.z)&&(o-=60*(c.Z||c.z)*1e3),o}}var M=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)?$");function C(t,e){if(void 0!==t){if(void 0===e){if(!M.test(t))throw{stack:(new Error).stack,code:"D3110",value:t};return Date.parse(t)}return R.call(this,t,e)}}function U(t,e,n){if(void 0!==t)return P.call(this,t,e,n)}return{formatInteger:v,parseInteger:N,fromMillis:U,toMillis:C}}();e.exports=i},{"./utils":6}],2:[function(t,e,r){(function(n){(function(){var r=t("./utils");const i=(()=>{"use strict";var t=r.isNumeric,e=r.isArrayOfStrings,i=r.isArrayOfNumbers,o=r.createSequence,a=r.isSequence,s=r.isFunction,u=r.isLambda,c=r.isIterable,f=r.getFunctionArity,l=r.isDeepEqual,h=r.stringToArray;function p(t){if(void 0!==t){var e=0;return t.forEach((function(t){e+=t})),e}}function d(t){return void 0===t?0:t.length}function v(t){if(void 0!==t&&0!==t.length)return Math.max.apply(Math,t)}function y(t){if(void 0!==t&&0!==t.length)return Math.min.apply(Math,t)}function g(t){if(void 0!==t&&0!==t.length){var e=0;return t.forEach((function(t){e+=t})),e/t.length}}function m(e,n=!1){if(void 0!==e){var r;if("string"==typeof e)r=e;else if(s(e))r="";else{if("number"==typeof e&&!isFinite(e))throw{code:"D3001",value:e,stack:(new Error).stack};var i=n?2:0;Array.isArray(e)&&e.outerWrapper&&(e=e[0]),r=JSON.stringify(e,(function(e,n){return null!=n&&n.toPrecision&&t(n)?Number(n.toPrecision(15)):n&&s(n)?"":n}),i)}return r}}function b(t,e,n){if(void 0!==t){var r=h(t),i=r.length;if(i+e<0&&(e=0),void 0!==n){if(n<=0)return"";var o=e>=0?e+n:i+e+n;return r.slice(e,o).join("")}return r.slice(e).join("")}}function _(t,e){if(void 0!==t){var n=t.indexOf(e);return n>-1?t.substr(0,n):t}}function w(t,e){if(void 0!==t){var n=t.indexOf(e);return n>-1?t.substr(n+e.length):t}}function x(t){if(void 0!==t)return t.toLowerCase()}function k(t){if(void 0!==t)return t.toUpperCase()}function E(t){if(void 0!==t)return h(t).length}function S(t){if(void 0!==t){var e=t.replace(/[ \t\n\r]+/gm," ");return" "===e.charAt(0)&&(e=e.substring(1))," "===e.charAt(e.length-1)&&(e=e.substring(0,e.length-1)),e}}function O(t,e,n){if(void 0!==t){var r;void 0!==n&&0!==n.length||(n=" ");var i=Math.abs(e)-E(t);if(i>0){var o=new Array(i+1).join(n);n.length>1&&(o=b(o,0,i)),r=e>0?t+o:o+t}else r=t;return r}}function*A(t,e){var n=t.apply(this,[e]);if(c(n)&&(n=yield*n),n&&"number"!=typeof n.start&&"number"!==n.end&&!Array.isArray(n.groups)&&!s(n.next))throw{code:"T1010",stack:(new Error).stack};return n}function*j(t,e){if(void 0!==t)return"string"==typeof e?-1!==t.indexOf(e):void 0!==(yield*A(e,t))}function*T(t,e,n){if(void 0!==t){if(n<0)throw{stack:(new Error).stack,value:n,code:"D3040",index:3};var r=o();if(void 0===n||n>0){var i=0,a=yield*A(e,t);if(void 0!==a)for(;void 0!==a&&(void 0===n||i<n);)r.push({match:a.match,index:a.start,groups:a.groups}),a=yield*A(a.next),i++}return r}}function*D(t,e,n,r){if(void 0!==t){var i,o=this;if(""===e)throw{code:"D3010",stack:(new Error).stack,value:e,index:2};if(r<0)throw{code:"D3011",stack:(new Error).stack,value:r,index:4};i="string"==typeof n?function(t){for(var e="",r=0,i=n.indexOf("$",r);-1!==i&&r<n.length;){e+=n.substring(r,i),r=i+1;var o=n.charAt(r);if("$"===o)e+="$",r++;else if("0"===o)e+=t.match,r++;else{var a;if(a=0===t.groups.length?1:Math.floor(Math.log(t.groups.length)*Math.LOG10E)+1,i=parseInt(n.substring(r,r+a),10),a>1&&i>t.groups.length&&(i=parseInt(n.substring(r,r+a-1),10)),isNaN(i))e+="$";else{if(t.groups.length>0){var s=t.groups[i-1];void 0!==s&&(e+=s)}r+=i.toString().length}}i=n.indexOf("$",r)}return e+=n.substring(r)}:n;var a="",s=0;if(void 0===r||r>0){var u=0;if("string"==typeof e){for(var f=t.indexOf(e,s);-1!==f&&(void 0===r||u<r);)a+=t.substring(s,f),a+=n,s=f+e.length,u++,f=t.indexOf(e,s);a+=t.substring(s)}else{var l=yield*A(e,t);if(void 0!==l){for(;void 0!==l&&(void 0===r||u<r);){a+=t.substring(s,l.start);var h=i.apply(o,[l]);if(c(h)&&(h=yield*h),"string"!=typeof h)throw{code:"D3012",stack:(new Error).stack,value:h};a+=h,s=l.start+l.match.length,u++,l=yield*A(l.next)}a+=t.substring(s)}else a=t}}else a=t;return a}}function P(t){if(void 0!==t){var e="undefined"!=typeof window?window.btoa:function(t){return new n.Buffer.from(t,"binary").toString("base64")};return e(t)}}function I(t){if(void 0!==t){var e="undefined"!=typeof window?window.atob:function(t){return new n.Buffer.from(t,"base64").toString("binary")};return e(t)}}function N(t){if(void 0!==t){var e;try{e=encodeURIComponent(t)}catch(e){throw{code:"D3140",stack:(new Error).stack,value:t,functionName:"encodeUrlComponent"}}return e}}function R(t){if(void 0!==t){var e;try{e=encodeURI(t)}catch(e){throw{code:"D3140",stack:(new Error).stack,value:t,functionName:"encodeUrl"}}return e}}function M(t){if(void 0!==t){var e;try{e=decodeURIComponent(t)}catch(e){throw{code:"D3140",stack:(new Error).stack,value:t,functionName:"decodeUrlComponent"}}return e}}function C(t){if(void 0!==t){var e;try{e=decodeURI(t)}catch(e){throw{code:"D3140",stack:(new Error).stack,value:t,functionName:"decodeUrl"}}return e}}function*U(t,e,n){if(void 0!==t){if(n<0)throw{code:"D3020",stack:(new Error).stack,value:n,index:3};var r=[];if(void 0===n||n>0)if("string"==typeof e)r=t.split(e,n);else{var i=0,o=yield*A(e,t);if(void 0!==o){for(var a=0;void 0!==o&&(void 0===n||i<n);)r.push(t.substring(a,o.start)),a=o.end,o=yield*A(o.next),i++;(void 0===n||i<n)&&r.push(t.substring(a))}else r.push(t)}return r}}function F(t,e){if(void 0!==t)return void 0===e&&(e=""),t.join(e)}function L(t,e,n){if(void 0!==t){var r={"decimal-separator":".","grouping-separator":",","exponent-separator":"e",infinity:"Infinity","minus-sign":"-",NaN:"NaN",percent:"%","per-mille":"‰","zero-digit":"0",digit:"#","pattern-separator":";"};void 0!==n&&Object.keys(n).forEach((function(t){r[t]=n[t]}));for(var i=[],o=r["zero-digit"].charCodeAt(0),a=o;a<o+10;a++)i.push(String.fromCharCode(a));var s=i.concat([r["decimal-separator"],r["exponent-separator"],r["grouping-separator"],r.digit,r["pattern-separator"]]),u=e.split(r["pattern-separator"]);if(u.length>2)throw{code:"D3080",stack:(new Error).stack};var c=function(t){var e,n,i,o,a=function(){for(var e,n=0;n<t.length;n++)if(e=t.charAt(n),-1!==s.indexOf(e)&&e!==r["exponent-separator"])return t.substring(0,n)}(),u=function(){for(var e,n=t.length-1;n>=0;n--)if(e=t.charAt(n),-1!==s.indexOf(e)&&e!==r["exponent-separator"])return t.substring(n+1)}(),c=t.substring(a.length,t.length-u.length),f=t.indexOf(r["exponent-separator"],a.length);-1===f||f>t.length-u.length?(e=c,n=void 0):(e=c.substring(0,f),n=c.substring(f+1));var l=e.indexOf(r["decimal-separator"]);return-1===l?(i=e,o=u):(i=e.substring(0,l),o=e.substring(l+1)),{prefix:a,suffix:u,activePart:c,mantissaPart:e,exponentPart:n,integerPart:i,fractionalPart:o,subpicture:t}},f=function(t){var e,n,o=t.subpicture,a=o.indexOf(r["decimal-separator"]);a!==o.lastIndexOf(r["decimal-separator"])&&(e="D3081"),o.indexOf(r.percent)!==o.lastIndexOf(r.percent)&&(e="D3082"),o.indexOf(r["per-mille"])!==o.lastIndexOf(r["per-mille"])&&(e="D3083"),-1!==o.indexOf(r.percent)&&-1!==o.indexOf(r["per-mille"])&&(e="D3084");var u=!1;for(n=0;n<t.mantissaPart.length;n++){var c=t.mantissaPart.charAt(n);if(-1!==i.indexOf(c)||c===r.digit){u=!0;break}}u||(e="D3085"),-1!==t.activePart.split("").map((function(t){return-1===s.indexOf(t)?"p":"a"})).join("").indexOf("p")&&(e="D3086"),-1!==a?o.charAt(a-1)!==r["grouping-separator"]&&o.charAt(a+1)!==r["grouping-separator"]||(e="D3087"):t.integerPart.charAt(t.integerPart.length-1)===r["grouping-separator"]&&(e="D3088"),-1!==o.indexOf(r["grouping-separator"]+r["grouping-separator"])&&(e="D3089");var f=t.integerPart.indexOf(r.digit);-1!==f&&t.integerPart.substring(0,f).split("").filter((function(t){return i.indexOf(t)>-1})).length>0&&(e="D3090"),-1!==(f=t.fractionalPart.lastIndexOf(r.digit))&&t.fractionalPart.substring(f).split("").filter((function(t){return i.indexOf(t)>-1})).length>0&&(e="D3091");var l="string"==typeof t.exponentPart;if(l&&t.exponentPart.length>0&&(-1!==o.indexOf(r.percent)||-1!==o.indexOf(r["per-mille"]))&&(e="D3092"),l&&(0===t.exponentPart.length||t.exponentPart.split("").filter((function(t){return-1===i.indexOf(t)})).length>0)&&(e="D3093"),e)throw{code:e,stack:(new Error).stack}},l=function(t){var e=function(e,n){for(var o=[],a=e.indexOf(r["grouping-separator"]);-1!==a;){var s=(n?e.substring(0,a):e.substring(a)).split("").filter((function(t){return-1!==i.indexOf(t)||t===r.digit})).length;o.push(s),a=t.integerPart.indexOf(r["grouping-separator"],a+1)}return o},n=e(t.integerPart),o=function(t){if(0===t.length)return 0;for(var e=function(t,n){return 0===n?t:e(n,t%n)},n=t.reduce(e),r=1;r<=t.length;r++)if(-1===t.indexOf(r*n))return 0;return n}(n),a=e(t.fractionalPart,!0),s=t.integerPart.split("").filter((function(t){return-1!==i.indexOf(t)})).length,u=s,c=t.fractionalPart.split(""),f=c.filter((function(t){return-1!==i.indexOf(t)})).length,l=c.filter((function(t){return-1!==i.indexOf(t)||t===r.digit})).length,h="string"==typeof t.exponentPart;0===s&&0===l&&(h?(f=1,l=1):s=1),h&&0===s&&-1!==t.integerPart.indexOf(r.digit)&&(s=1),0===s&&0===f&&(f=1);var p=0;return h&&(p=t.exponentPart.split("").filter((function(t){return-1!==i.indexOf(t)})).length),{integerPartGroupingPositions:n,regularGrouping:o,minimumIntegerPartSize:s,scalingFactor:u,prefix:t.prefix,fractionalPartGroupingPositions:a,minimumFactionalPartSize:f,maximumFactionalPartSize:l,minimumExponentSize:p,suffix:t.suffix,picture:t.subpicture}},h=u.map(c);h.forEach(f);var p,d,v,y,g=h.map(l),m=r["minus-sign"],b=r["zero-digit"],_=r["decimal-separator"],w=r["grouping-separator"];if(1===g.length&&(g.push(JSON.parse(JSON.stringify(g[0]))),g[1].prefix=m+g[1].prefix),d=-1!==(p=t>=0?g[0]:g[1]).picture.indexOf(r.percent)?100*t:-1!==p.picture.indexOf(r["per-mille"])?1e3*t:t,0===p.minimumExponentSize)v=d;else{var x=Math.pow(10,p.scalingFactor),k=Math.pow(10,p.scalingFactor-1);for(v=d,y=0;v<k;)v*=10,y-=1;for(;v>x;)v/=10,y+=1}var E=function(t,e){var n=Math.abs(t).toFixed(e);return"0"!==b&&(n=n.split("").map((function(t){return t>="0"&&t<="9"?i[t.charCodeAt(0)-48]:t})).join("")),n},S=E(V(v,p.maximumFactionalPartSize),p.maximumFactionalPartSize),O=S.indexOf(".");for(-1===O?S+=_:S=S.replace(".",_);S.charAt(0)===b;)S=S.substring(1);for(;S.charAt(S.length-1)===b;)S=S.substring(0,S.length-1);O=S.indexOf(_);var A=p.minimumIntegerPartSize-O,j=p.minimumFactionalPartSize-(S.length-O-1);if(S=(A>0?new Array(A+1).join(b):"")+S,S+=j>0?new Array(j+1).join(b):"",O=S.indexOf(_),p.regularGrouping>0)for(var T=Math.floor((O-1)/p.regularGrouping),D=1;D<=T;D++)S=[S.slice(0,O-D*p.regularGrouping),w,S.slice(O-D*p.regularGrouping)].join("");else p.integerPartGroupingPositions.forEach((function(t){S=[S.slice(0,O-t),w,S.slice(O-t)].join(""),O++}));if(O=S.indexOf(_),p.fractionalPartGroupingPositions.forEach((function(t){S=[S.slice(0,t+O+1),w,S.slice(t+O+1)].join("")})),O=S.indexOf(_),-1!==p.picture.indexOf(_)&&O!==S.length-1||(S=S.substring(0,S.length-1)),void 0!==y){var P=E(y,0);(A=p.minimumExponentSize-P.length)>0&&(P=new Array(A+1).join(b)+P),S=S+r["exponent-separator"]+(y<0?m:"")+P}return S=p.prefix+S+p.suffix}}function z(t,e){if(void 0!==t){if(t=V(t),(e=void 0===e?10:V(e))<2||e>36)throw{code:"D3100",stack:(new Error).stack,value:e};return t.toString(e)}}function $(t){var e;if(void 0!==t){if("number"==typeof t)e=t;else if("string"==typeof t&&/^-?[0-9]+(\.[0-9]+)?([Ee][-+]?[0-9]+)?$/.test(t)&&!isNaN(parseFloat(t))&&isFinite(t))e=parseFloat(t);else if(!0===t)e=1;else{if(!1!==t)throw{code:"D3030",value:t,stack:(new Error).stack,index:1};e=0}return e}}function B(t){if(void 0!==t)return Math.abs(t)}function W(t){if(void 0!==t)return Math.floor(t)}function q(t){if(void 0!==t)return Math.ceil(t)}function V(t,e){var n;if(void 0!==t){if(e){var r=t.toString().split("e");t=+(r[0]+"e"+(r[1]?+r[1]+e:e))}var i=(n=Math.round(t))-t;return.5===Math.abs(i)&&1===Math.abs(n%2)&&(n-=1),e&&(r=n.toString().split("e"),n=+(r[0]+"e"+(r[1]?+r[1]-e:-e))),Object.is(n,-0)&&(n=0),n}}function H(t){if(void 0!==t){if(t<0)throw{stack:(new Error).stack,code:"D3060",index:1,value:t};return Math.sqrt(t)}}function J(t,e){var n;if(void 0!==t){if(n=Math.pow(t,e),!isFinite(n))throw{stack:(new Error).stack,code:"D3061",index:1,value:t,exp:e};return n}}function Z(){return Math.random()}function Y(e){if(void 0!==e){var n=!1;return Array.isArray(e)?1===e.length?n=Y(e[0]):e.length>1&&(n=e.filter((function(t){return Y(t)})).length>0):"string"==typeof e?e.length>0&&(n=!0):t(e)?0!==e&&(n=!0):null!==e&&"object"==typeof e?Object.keys(e).length>0&&(n=!0):"boolean"==typeof e&&!0===e&&(n=!0),n}}function G(t){if(void 0!==t)return!Y(t)}function K(t,e,n,r){var i=[e],o=f(t);return o>=2&&i.push(n),o>=3&&i.push(r),i}function*X(t,e){if(void 0!==t){for(var n=o(),r=0;r<t.length;r++){var i=K(e,t[r],r,t),a=yield*e.apply(this,i);void 0!==a&&n.push(a)}return n}}function*Q(t,e){if(void 0!==t){for(var n=o(),r=0;r<t.length;r++){var i=t[r],a=K(e,i,r,t);Y(yield*e.apply(this,a))&&n.push(i)}return n}}function*tt(t,e){if(void 0!==t){for(var n,r=!1,i=0;i<t.length;i++){var o=t[i],a=!0;if(void 0!==e){var s=K(e,o,i,t);a=Y(yield*e.apply(this,s))}if(a){if(r)throw{stack:(new Error).stack,code:"D3138",index:i};n=o,r=!0}}if(!r)throw{stack:(new Error).stack,code:"D3139"};return n}}function et(){for(var t=[],e=Array.prototype.slice.call(arguments),n=Math.min.apply(Math,e.map((function(t){return Array.isArray(t)?t.length:0}))),r=0;r<n;r++){var i=e.map((t=>t[r]));t.push(i)}return t}function*nt(t,e,n){if(void 0!==t){var r,i,o=f(e);if(o<2)throw{stack:(new Error).stack,code:"D3050",index:1};for(void 0===n&&t.length>0?(r=t[0],i=1):(r=n,i=0);i<t.length;){var a=[r,t[i]];o>=3&&a.push(i),o>=4&&a.push(t),r=yield*e.apply(this,a),i++}return r}}function rt(t){var e=o();if(Array.isArray(t)){var n={};t.forEach((function(t){rt(t).forEach((function(t){n[t]=!0}))})),e=rt(n)}else null===t||"object"!=typeof t||u(t)||Object.keys(t).forEach((t=>e.push(t)));return e}function it(t,e){var n;if(Array.isArray(t)){n=o();for(var r=0;r<t.length;r++){var i=it(t[r],e);void 0!==i&&(Array.isArray(i)?i.forEach((t=>n.push(t))):n.push(i))}}else null!==t&&"object"==typeof t&&(n=t[e]);return n}function ot(t,e){return void 0===t?e:void 0===e?t:(Array.isArray(t)||(t=o(t)),Array.isArray(e)||(e=[e]),t.concat(e))}function at(t){return void 0!==t}function st(t){var e=o();if(Array.isArray(t))t.forEach((function(t){e=ot(e,st(t))}));else if(null===t||"object"!=typeof t||u(t))e=t;else for(var n in t){var r={};r[n]=t[n],e.push(r)}return e}function ut(t){if(void 0!==t){var e={};return t.forEach((function(t){for(var n in t)e[n]=t[n]})),e}}function ct(t){if(void 0!==t){if(t.length<=1)return t;for(var e=t.length,n=new Array(e),r=0;r<e;r++)n[e-r-1]=t[r];return n}}function*ft(t,e){var n=o();for(var r in t){var i=K(e,t[r],r,t),a=yield*e.apply(this,i);void 0!==a&&n.push(a)}return n}function lt(t){throw{code:"D3137",stack:(new Error).stack,message:t||"$error() function evaluated"}}function ht(t,e){if(!t)throw{code:"D3141",stack:(new Error).stack,message:e||"$assert() statement failed"}}function pt(e){if(void 0!==e)return null===e?"null":t(e)?"number":"string"==typeof e?"string":"boolean"==typeof e?"boolean":Array.isArray(e)?"array":s(e)?"function":"object"}function*dt(t,n){if(void 0!==t){if(t.length<=1)return t;var r;if(void 0===n){if(!i(t)&&!e(t))throw{stack:(new Error).stack,code:"D3070",index:1};r=function*(t,e){return t>e}}else r=n;var o=function*(t,e){var n=function*(t,e,i){0===e.length?Array.prototype.push.apply(t,i):0===i.length?Array.prototype.push.apply(t,e):(yield*r(e[0],i[0]))?(t.push(i[0]),yield*n(t,e,i.slice(1))):(t.push(e[0]),yield*n(t,e.slice(1),i))},i=[];return yield*n(i,t,e),i},a=function*(t){if(!Array.isArray(t)||t.length<=1)return t;var e=Math.floor(t.length/2),n=t.slice(0,e),r=t.slice(e);return n=yield*a(n),r=yield*a(r),yield*o(n,r)};return yield*a(t)}}function vt(t){if(void 0!==t){if(t.length<=1)return t;for(var e=new Array(t.length),n=0;n<t.length;n++){var r=Math.floor(Math.random()*(n+1));n!==r&&(e[n]=e[r]),e[r]=t[n]}return e}}function yt(t){if(void 0!==t){if(!Array.isArray(t)||t.length<=1)return t;for(var e=a(t)?o():[],n=0;n<t.length;n++){for(var r=t[n],i=!1,s=0;s<e.length;s++)if(l(r,e[s])){i=!0;break}i||e.push(r)}return e}}function*gt(t,e){var n={};for(var r in t){var i=t[r],o=K(e,i,r,t);Y(yield*e.apply(this,o))&&(n[r]=i)}return 0===Object.keys(n).length&&(n=void 0),n}return{sum:p,count:d,max:v,min:y,average:g,string:m,substring:b,substringBefore:_,substringAfter:w,lowercase:x,uppercase:k,length:E,trim:S,pad:O,match:T,contains:j,replace:D,split:U,join:F,formatNumber:L,formatBase:z,number:$,floor:W,ceil:q,round:V,abs:B,sqrt:H,power:J,random:Z,boolean:Y,not:G,map:X,zip:et,filter:Q,single:tt,foldLeft:nt,sift:gt,keys:rt,lookup:it,append:ot,exists:at,spread:st,merge:ut,reverse:ct,each:ft,error:lt,assert:ht,type:pt,sort:dt,shuffle:vt,distinct:yt,base64encode:P,base64decode:I,encodeUrlComponent:N,encodeUrl:R,decodeUrlComponent:M,decodeUrl:C}})();e.exports=i}).call(this)}).call(this,void 0!==n.g?n.g:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./utils":6}],3:[function(t,e,n){var r=t("./datetime"),i=t("./functions"),o=t("./utils"),a=t("./parser"),s=t("./signature"),u=function(){"use strict";var t=o.isNumeric,e=o.isArrayOfStrings,n=o.isArrayOfNumbers,u=o.createSequence,c=o.isSequence,f=o.isFunction,l=o.isLambda,h=o.isIterable,p=o.getFunctionArity,d=o.isDeepEqual,v=ft(null);function*y(t,e,n){var r,i=n.lookup("__