@absmartly/javascript-sdk
Version:
A/B Smartly Javascript SDK
1 lines • 120 kB
JavaScript
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.absmartly=e():t.absmartly=e()}(self,(function(){return function(){var t={745:function(t,e,r){"use strict";function n(t){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},n(t)}function o(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=function(t,e){if(!t)return;if("string"==typeof t)return i(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return i(t,e)}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,o=function(){};return{s:o,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},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 u,a=!0,c=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return a=t.done,t},e:function(t){c=!0,u=t},f:function(){try{a||null==r.return||r.return()}finally{if(c)throw u}}}}function i(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function u(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function a(t,e){for(var r=0;r<e.length;r++){var o=e[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,(i=o.key,u=void 0,u=function(t,e){if("object"!==n(t)||null===t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var o=r.call(t,e||"default");if("object"!==n(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(i,"string"),"symbol"===n(u)?u:String(u)),o)}var i,u}function c(t,e,r){return e&&a(t.prototype,e),r&&a(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}r(6078),r(9653),Object.defineProperty(e,"__esModule",{value:!0}),e.AbortController=e.AbortSignal=void 0;var f=function(){function t(){u(this,t),this.aborted=!1,this._events={}}return c(t,[{key:"addEventListener",value:function(t,e){var r=this._events[t];r||(r=[],this._events[t]=r),r.push(e)}},{key:"removeEventListener",value:function(t,e){var r=this._events[t];if(r){var n=r.findIndex((function(t){return t===e}));-1!==n&&(r.splice(n,1),0===r.length&&delete this._events[t])}}},{key:"dispatchEvent",value:function(t){this["on".concat(t.type)]&&this["on".concat(t.type)](t);var e=this._events[t.type];if(e){var r,n=o(e);try{for(n.s();!(r=n.n()).done;){r.value.call(null,t)}}catch(t){n.e(t)}finally{n.f()}}}},{key:"toString",value:function(){return"[object AbortSignal]"}}]),t}();e.AbortSignal=f;var l=function(){function t(){u(this,t),this.signal=new f}return c(t,[{key:"abort",value:function(){var t;try{t=new Event("abort")}catch(e){t={type:"abort",bubbles:!1,cancelable:!1}}this.signal.aborted=!0,this.signal.dispatchEvent(t)}},{key:"toString",value:function(){return"[object AbortController]"}}]),t}();e.AbortController=l,"undefined"!=typeof Symbol&&void 0!==Symbol.toStringTag&&(Object.defineProperty(f.prototype,Symbol.toStringTag,{configurable:!0,value:"AbortSignal"}),Object.defineProperty(l.prototype,Symbol.toStringTag,{configurable:!0,value:"AbortController"})),e.default=l},6354:function(t,e,r){"use strict";var n=function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.AbortController=void 0;var o=r(1231),i=n(r(745));e.AbortController=(0,o.isLongLivedApp)()&&window.AbortController?window.AbortController:(0,o.isWorker)()&&self.AbortController?self.AbortController:r.g&&r.g.AbortController?r.g.AbortController:i.default},982:function(t,e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.insertUniqueSorted=void 0;e.insertUniqueSorted=function(t,e,r){for(var n=0,o=t.length-1;n<=o;){var i=Math.floor(n+(o-n)/2);if(r(t[i],e))n=i+1;else{if(!r(e,t[i]))return;o=i-1}}t.splice(n,0,e)}},2786:function(t,e,r){"use strict";function n(t){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},n(t)}function o(t,e){for(var r=0;r<e.length;r++){var o=e[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,(i=o.key,u=void 0,u=function(t,e){if("object"!==n(t)||null===t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var o=r.call(t,e||"default");if("object"!==n(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(i,"string"),"symbol"===n(u)?u:String(u)),o)}var i,u}r(6078),r(9653),Object.defineProperty(e,"__esModule",{value:!0}),e.VariantAssigner=void 0;var i=r(1231),u=r(7433),a=function(){function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this._unitHash=(0,u.murmur3_32)((0,i.stringToUint8Array)(e).buffer)}var e,r,n;return e=t,(r=[{key:"assign",value:function(t,e,r){var n=this._probability(e,r);return(0,i.chooseVariant)(t,n)}},{key:"_probability",value:function(t,e){var r=this._unitHash,n=new ArrayBuffer(12),o=new DataView(n);return o.setUint32(0,e,!0),o.setUint32(4,t,!0),o.setUint32(8,r,!0),(0,u.murmur3_32)(n)*(1/4294967295)}}])&&o(e.prototype,r),n&&o(e,n),Object.defineProperty(e,"prototype",{writable:!1}),t}();e.VariantAssigner=a},7578:function(t,e,r){"use strict";function n(t){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},n(t)}function o(t,e){for(var r=0;r<e.length;r++){var o=e[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,(i=o.key,u=void 0,u=function(t,e){if("object"!==n(t)||null===t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var o=r.call(t,e||"default");if("object"!==n(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(i,"string"),"symbol"===n(u)?u:String(u)),o)}var i,u}r(9601),r(6078),r(9653);var i=function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});var u=i(r(3651)),a=r(6354),c=r(2928),f=r(1231),l=function(){function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this._opts=Object.assign({agent:"javascript-client",apiKey:void 0,application:void 0,endpoint:void 0,environment:void 0,retries:5,timeout:3e3,keepalive:!0},e);for(var r=0,o=["agent","application","apiKey","endpoint","environment"];r<o.length;r++){var i=o[r];if(!(i in this._opts)||void 0===this._opts[i])throw new Error("Missing '".concat(i,"' in options argument"));var u=this._opts[i];if("string"!=typeof u||0===u.length){if("application"===i&&null!==u&&"object"===n(u)&&"name"in u)continue;throw new Error("Invalid '".concat(i,"' in options argument"))}}"string"==typeof this._opts.application&&(this._opts.application={name:this._opts.application,version:0}),this._delay=50}var e,r,i;return e=t,r=[{key:"getContext",value:function(t){return this.getUnauthed(Object.assign(Object.assign({},t),{path:"/context",query:{application:(0,f.getApplicationName)(this._opts.application),environment:this._opts.environment}}))}},{key:"createContext",value:function(t,e){var r={units:t.units};return this.post(Object.assign(Object.assign({},e),{path:"/context",body:r}))}},{key:"publish",value:function(t,e){var r={units:t.units,hashed:t.hashed,publishedAt:t.publishedAt||Date.now()};return Array.isArray(t.goals)&&t.goals.length>0&&(r.goals=t.goals),Array.isArray(t.exposures)&&t.exposures.length>0&&(r.exposures=t.exposures),Array.isArray(t.attributes)&&t.attributes.length>0&&(r.attributes=t.attributes),this.put(Object.assign(Object.assign({},e),{path:"/context",body:r}))}},{key:"request",value:function(t){var e,r,n=this,o="".concat(this._opts.endpoint).concat(t.path);if(t.query){var i=Object.keys(t.query);if(i.length>0){var l=i.map((function(e){return t.query?"".concat(e,"=").concat(encodeURIComponent(t.query[e])):null})).join("&");o="".concat(o,"?").concat(l)}}var s=new a.AbortController,p=function(){var e={method:t.method,body:void 0!==t.body?JSON.stringify(t.body,null,0):void 0,signal:s.signal,keepalive:n._opts.keepalive};return t.auth&&(e.headers={"Content-Type":"application/json","X-API-Key":n._opts.apiKey,"X-Agent":n._opts.agent,"X-Environment":n._opts.environment,"X-Application":(0,f.getApplicationName)(n._opts.application),"X-Application-Version":(0,f.getApplicationVersion)(n._opts.application)}),(0,u.default)(o,e).then((function(t){if(!t.ok){var e=t.status>=400&&t.status<500;return t.text().then((function(r){var n=new Error(null!==r&&r.length>0?r:t.statusText);return n._bail=e,Promise.reject(n)}))}return t.json()}))},y=function t(e){return new Promise((function(r,n){var o=setTimeout((function(){delete t.reject,r()}),e);t.reject=function(t){clearTimeout(o),n(t)}}))},v=function t(e,r){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,u=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;return delete t.timedout,p().catch((function(a){if(console.warn(a),a._bail||e<=0)throw new Error(a.message);if(i>=e)throw new c.RetryError(i,a,o);if(u>=r||"AbortError"===a.name){if(t.timedout)throw new c.TimeoutError(r);throw a}var f=(1<<i)*n._delay+.5*Math.random()*n._delay;return u+f>r&&(f=r-u),y(f).then((function(){return t(e,r,i+1,u+f)}))}))},b=function(){y.reject?y.reject(new c.AbortError):s.abort()};t.signal&&t.signal.addEventListener("abort",b);var h=t.timeout||this._opts.timeout||0,d=h>0?setTimeout((function(){v.timedout=!0,b()}),h):0,m=function(){clearTimeout(d),t.signal&&t.signal.removeEventListener("abort",b)};return v(null!==(e=this._opts.retries)&&void 0!==e?e:5,null!==(r=this._opts.timeout)&&void 0!==r?r:3e3).then((function(t){return m(),t})).catch((function(t){throw m(),t}))}},{key:"post",value:function(t){return this.request(Object.assign(Object.assign({},t),{auth:!0,method:"POST"}))}},{key:"put",value:function(t){return this.request(Object.assign(Object.assign({},t),{auth:!0,method:"PUT"}))}},{key:"getUnauthed",value:function(t){return this.request(Object.assign(Object.assign({},t),{method:"GET"}))}}],r&&o(e.prototype,r),i&&o(e,i),Object.defineProperty(e,"prototype",{writable:!1}),t}();e.default=l},7468:function(t,e,r){"use strict";function n(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,o,i,u,a=[],c=!0,f=!1;try{if(i=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=i.call(r)).done)&&(a.push(n.value),a.length!==e);c=!0);}catch(t){f=!0,o=t}finally{try{if(!c&&null!=r.return&&(u=r.return(),Object(u)!==u))return}finally{if(f)throw o}}return a}}(t,e)||function(t,e){if(!t)return;if("string"==typeof t)return o(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return o(t,e)}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function o(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}r(9720);var i=function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.mergeConfig=void 0;var u=i(r(1697)),a=r(1231);e.mergeConfig=function(t,e){for(var r=(0,u.default)(e),o=t.variableKeys(),i=function(){for(var e=n(f[c],2),o=e[0],i=e[1],u=r,l=o.split("."),s=function(){var e=l[p];if("_".concat(e,"_setter")in u)return console.error("Config key '".concat(l.slice(0,p+1).join("."),"' already set by experiment '").concat(u["_".concat(e,"_setter")],"'.")),u=void 0,"break";if(e in u&&p<l.length-1&&((0,a.isObject)(u[e])?u=u[e]:(console.warn("Config key '".concat(o,"' for experiment '").concat(i,"' is overriding non-object value at '").concat(l.slice(0,p+1).join("."),"' with an object.")),u=u[e]={})),p===l.length-1){var r=u[e];Object.defineProperty(u,"_".concat(e,"_setter"),{value:i,writable:!1}),Object.defineProperty(u,e,{get:function(){return t.variableValue(o,r)}})}},p=0;p<l.length;++p){if("break"===s())break}},c=0,f=Object.entries(o);c<f.length;c++)i();return r}},7621:function(t,e,r){"use strict";function n(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=i(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,o=function(){};return{s:o,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},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 u,a=!0,c=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return a=t.done,t},e:function(t){c=!0,u=t},f:function(){try{a||null==r.return||r.return()}finally{if(c)throw u}}}}function o(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,o,i,u,a=[],c=!0,f=!1;try{if(i=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=i.call(r)).done)&&(a.push(n.value),a.length!==e);c=!0);}catch(t){f=!0,o=t}finally{try{if(!c&&null!=r.return&&(u=r.return(),Object(u)!==u))return}finally{if(f)throw o}}return a}}(t,e)||i(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function i(t,e){if(t){if("string"==typeof t)return u(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?u(t,e):void 0}}function u(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function a(t){return a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},a(t)}function c(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,f(n.key),n)}}function f(t){var e=function(t,e){if("object"!==a(t)||null===t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,e||"default");if("object"!==a(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"===a(e)?e:String(e)}r(9720),r(9601),r(9826),r(9653),r(6078),Object.defineProperty(e,"__esModule",{value:!0});var l=r(1231),s=r(2786),p=r(7682),y=r(982),v=function(){function t(e,r,n,o){var i=this;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this._sdk=e,this._publisher=r.publisher||this._sdk.getContextPublisher(),this._dataProvider=r.dataProvider||this._sdk.getContextDataProvider(),this._eventLogger=r.eventLogger||this._sdk.getEventLogger(),this._opts=r,this._pending=0,this._failed=!1,this._finalized=!1,this._attrs=[],this._goals=[],this._exposures=[],this._overrides={},this._cassignments={},this._units={},this._assigners={},this._audienceMatcher=new p.AudienceMatcher,n.units&&this.units(n.units),(0,l.isPromise)(o)?this._promise=o.then((function(t){i._init(t),delete i._promise,i._logEvent("ready",t),i.pending()>0&&i._setTimeout()})).catch((function(t){i._init({}),i._failed=!0,delete i._promise,i._logError(t)})):(this._init(o),this._logEvent("ready",o))}var e,r,i;return e=t,r=[{key:"isReady",value:function(){return void 0===this._promise}},{key:"isFinalizing",value:function(){return!this._finalized&&null!=this._finalizing}},{key:"isFinalized",value:function(){return this._finalized}},{key:"isFailed",value:function(){return this._failed}},{key:"ready",value:function(){var t=this;return this.isReady()?Promise.resolve(!0):new Promise((function(e){var r;null===(r=t._promise)||void 0===r||r.then((function(){return e(!0)})).catch((function(t){return e(t)}))}))}},{key:"pending",value:function(){return this._pending}},{key:"data",value:function(){return this._checkReady(),this._data}},{key:"eventLogger",value:function(){return this._eventLogger}},{key:"publisher",value:function(){return this._publisher}},{key:"provider",value:function(){return this._dataProvider}},{key:"publish",value:function(t){var e=this;return this._checkReady(!0),new Promise((function(r,n){e._flush((function(t){t?n(t):r()}),t)}))}},{key:"refresh",value:function(t){var e=this;return this._checkReady(!0),new Promise((function(r,n){e._refresh((function(t){t?n(t):r()}),t)}))}},{key:"getUnit",value:function(t){return this._units[t]}},{key:"unit",value:function(t,e){switch(this._checkNotFinalized(),a(e)){case"string":if(0===(e=e.trim()).length)throw new Error("Unit '".concat(t,"' UID must not be blank."));break;case"number":break;default:throw new Error("Unit '".concat(t,"' must be a string or a number."))}var r=this._units[t];if(void 0!==r&&r!==e)throw new Error("Unit '".concat(t,"' UID already set."));this._units[t]=e}},{key:"getUnits",value:function(){return this._units}},{key:"units",value:function(t){var e=this;Object.entries(t).forEach((function(t){var r=o(t,2),n=r[0],i=r[1];e.unit(n,i)}))}},{key:"getAttribute",value:function(t){var e;return this._attrs.forEach((function(r){r.name===t&&(e=r.value)})),e}},{key:"attribute",value:function(t,e){this._checkNotFinalized(),this._attrs.push({name:t,value:e,setAt:Date.now()})}},{key:"getAttributes",value:function(){var t={};return this._attrs.map((function(t){return[t.name,t.value]})).forEach((function(e){var r=o(e,2),n=r[0],i=r[1];t[n]=i})),t}},{key:"attributes",value:function(t){var e=this;Object.entries(t).forEach((function(t){var r=o(t,2),n=r[0],i=r[1];e.attribute(n,i)}))}},{key:"peek",value:function(t){return this._checkReady(!0),this._peek(t).variant}},{key:"treatment",value:function(t){return this._checkReady(!0),this._treatment(t).variant}},{key:"track",value:function(t,e){return this._checkNotFinalized(),this._track(t,e)}},{key:"finalize",value:function(t){return this._finalize(t)}},{key:"experiments",value:function(){var t;return this._checkReady(),null===(t=this._data.experiments)||void 0===t?void 0:t.map((function(t){return t.name}))}},{key:"variableValue",value:function(t,e){return this._checkReady(!0),this._variableValue(t,e)}},{key:"peekVariableValue",value:function(t,e){return this._checkReady(!0),this._peekVariable(t,e)}},{key:"variableKeys",value:function(){this._checkReady(!0);var t={};return Object.entries(this._indexVariables).forEach((function(e){var r=o(e,2),n=r[0];r[1].forEach((function(e){t[n]?t[n].push(e.data.name):t[n]=[e.data.name]}))})),t}},{key:"override",value:function(t,e){var r,n,o;this._overrides=Object.assign(this._overrides,(r={},o=e,(n=f(n=t))in r?Object.defineProperty(r,n,{value:o,enumerable:!0,configurable:!0,writable:!0}):r[n]=o,r))}},{key:"overrides",value:function(t){var e=this;Object.entries(t).forEach((function(t){var r=o(t,2),n=r[0],i=r[1];e.override(n,i)}))}},{key:"customAssignment",value:function(t,e){this._checkNotFinalized(),this._cassignments[t]=e}},{key:"customAssignments",value:function(t){var e=this;Object.entries(t).forEach((function(t){var r=o(t,2),n=r[0],i=r[1];e.customAssignment(n,i)}))}},{key:"_checkNotFinalized",value:function(){if(this.isFinalized())throw new Error("ABSmartly Context is finalized.");if(this.isFinalizing())throw new Error("ABSmartly Context is finalizing.")}},{key:"_checkReady",value:function(t){if(!this.isReady())throw new Error("ABSmartly Context is not yet ready.");t&&this._checkNotFinalized()}},{key:"_assign",value:function(t){var e=t in this._cassignments,r=t in this._overrides,n=t in this._index?this._index[t]:null;if(t in this._assignments){var o=this._assignments[t];if(r){if(o.overridden&&o.variant===this._overrides[t])return o}else if(null==n){if(!o.assigned)return o}else if((!e||this._cassignments[t]===o.variant)&&function(t,e){return t.id===e.id&&t.unitType===e.unitType&&t.iteration===e.iteration&&t.fullOnVariant===e.fullOnVariant&&(0,l.arrayEqualsShallow)(t.trafficSplit,e.trafficSplit)}(n.data,o))return o}var i={id:0,iteration:0,fullOnVariant:0,unitType:null,variant:0,overridden:!1,assigned:!1,exposed:!1,eligible:!0,fullOn:!1,custom:!1,audienceMismatch:!1};if(this._assignments[t]=i,r)null!=n&&(i.id=n.data.id,i.unitType=n.data.unitType),i.overridden=!0,i.variant=this._overrides[t];else if(null!=n){var u=n.data.unitType;if(n.data.audience&&n.data.audience.length>0){var a={};this._attrs.forEach((function(t){a[t.name]=t.value}));var c=this._audienceMatcher.evaluate(n.data.audience,a);"boolean"==typeof c&&(i.audienceMismatch=!c)}if(n.data.audienceStrict&&i.audienceMismatch)i.variant=0;else if(0===n.data.fullOnVariant){if(null!==u&&u in this._units){var f=this._unitHash(u);if(null!==f){var p=u in this._assigners?this._assigners[u]:this._assigners[u]=new s.VariantAssigner(f),y=1===p.assign(n.data.trafficSplit,n.data.trafficSeedHi,n.data.trafficSeedLo);i.assigned=!0,i.eligible=y,y?e?(i.variant=this._cassignments[t],i.custom=!0):i.variant=p.assign(n.data.split,n.data.seedHi,n.data.seedLo):i.variant=0}}}else i.assigned=!0,i.eligible=!0,i.variant=n.data.fullOnVariant,i.fullOn=!0;i.unitType=u,i.id=n.data.id,i.iteration=n.data.iteration,i.trafficSplit=n.data.trafficSplit,i.fullOnVariant=n.data.fullOnVariant}return null!=n&&i.variant<n.data.variants.length&&(i.variables=n.variables[i.variant]),i}},{key:"_peek",value:function(t){return this._assign(t)}},{key:"_treatment",value:function(t){var e=this._assign(t);return e.exposed||(e.exposed=!0,this._queueExposure(t,e)),e}},{key:"_queueExposure",value:function(t,e){var r={id:e.id,name:t,exposedAt:Date.now(),unit:e.unitType,variant:e.variant,assigned:e.assigned,eligible:e.eligible,overridden:e.overridden,fullOn:e.fullOn,custom:e.custom,audienceMismatch:e.audienceMismatch};this._logEvent("exposure",r),this._exposures.push(r),this._pending++,this._setTimeout()}},{key:"_customFieldKeys",value:function(){var t=new Set;if(!this._data.experiments)return[];var e,r=n(this._data.experiments);try{for(r.s();!(e=r.n()).done;){var o=e.value;if(null!=o.customFieldValues){var i,u=n(o.customFieldValues);try{for(u.s();!(i=u.n()).done;){var a=i.value;t.add(a.name)}}catch(t){u.e(t)}finally{u.f()}}}}catch(t){r.e(t)}finally{r.f()}return Array.from(t)}},{key:"customFieldKeys",value:function(){return this._checkReady(!0),this._customFieldKeys()}},{key:"_customFieldValue",value:function(t,e){var r,n=this._index[t];if(null!=n){var o=null===(r=n.data.customFieldValues)||void 0===r?void 0:r.find((function(t){return t.name===e}));if(null!=o)switch(o.type){case"text":case"string":return o.value;case"number":return Number(o.value);case"json":try{return"null"===o.value?null:""===o.value?"":JSON.parse(o.value)}catch(r){return console.error("Failed to parse JSON custom field value '".concat(e,"' for experiment '").concat(t,"'")),null}case"boolean":return"true"===o.value;default:return console.error("Unknown custom field type '".concat(o.type,"' for experiment '").concat(t,"' and key '").concat(e,"' - you may need to upgrade to the latest SDK version")),null}}return null}},{key:"customFieldValue",value:function(t,e){return this._checkReady(!0),this._customFieldValue(t,e)}},{key:"_customFieldValueType",value:function(t,e){var r,n=this._index[t];if(null!=n){var o=null===(r=n.data.customFieldValues)||void 0===r?void 0:r.find((function(t){return t.name===e}));if(null!=o)return o.type}return null}},{key:"customFieldValueType",value:function(t,e){return this._checkReady(!0),this._customFieldValueType(t,e)}},{key:"_variableValue",value:function(t,e){for(var r in this._indexVariables[t]){var n=this._indexVariables[t][r].data.name,o=this._assign(n);if(void 0!==o.variables&&(o.exposed||(o.exposed=!0,this._queueExposure(n,o)),t in o.variables&&(o.assigned||o.overridden)))return o.variables[t]}return e}},{key:"_peekVariable",value:function(t,e){for(var r in this._indexVariables[t]){var n=this._indexVariables[t][r].data.name,o=this._assign(n);if(void 0!==o.variables&&t in o.variables&&(o.assigned||o.overridden))return o.variables[t]}return e}},{key:"_validateGoal",value:function(t,e){if(null!=e){if(!(0,l.isObject)(e))throw new Error("Goal '".concat(t,"' properties must be of type object."));return Object.assign({},e)}return null}},{key:"_track",value:function(t,e){var r={name:t,properties:this._validateGoal(t,e),achievedAt:Date.now()};this._logEvent("goal",r),this._goals.push(r),this._pending++,this._setTimeout()}},{key:"_setTimeout",value:function(){var t=this;this.isReady()&&void 0===this._publishTimeout&&this._opts.publishDelay>=0&&(this._publishTimeout=setTimeout((function(){t._flush()}),this._opts.publishDelay))}},{key:"_flush",value:function(t,e){var r=this;if(void 0!==this._publishTimeout&&(clearTimeout(this._publishTimeout),delete this._publishTimeout),0===this._pending)"function"==typeof t&&t();else{if(this._failed)"function"==typeof t&&t();else{var n={publishedAt:Date.now(),units:Object.entries(this._units).map((function(t){return{type:t[0],uid:r._unitHash(t[0])}})),hashed:!0};this._goals.length>0&&(n.goals=this._goals.map((function(t){return{name:t.name,achievedAt:t.achievedAt,properties:t.properties}}))),this._exposures.length>0&&(n.exposures=this._exposures.map((function(t){return{id:t.id,name:t.name,unit:t.unit,exposedAt:t.exposedAt,variant:t.variant,assigned:t.assigned,eligible:t.eligible,overridden:t.overridden,fullOn:t.fullOn,custom:t.custom,audienceMismatch:t.audienceMismatch}}))),this._attrs.length>0&&(n.attributes=this._attrs.map((function(t){return{name:t.name,value:t.value,setAt:t.setAt}}))),this._publisher.publish(n,this._sdk,this,e).then((function(){r._logEvent("publish",n),"function"==typeof t&&t()})).catch((function(e){r._logError(e),"function"==typeof t&&t(e)}))}this._pending=0,this._exposures=[],this._goals=[]}}},{key:"_refresh",value:function(t,e){var r=this;this._failed?"function"==typeof t&&t():this._dataProvider.getContextData(this._sdk,e).then((function(e){r._init(e,r._assignments),r._logEvent("refresh",e),"function"==typeof t&&t()})).catch((function(e){r._logError(e),"function"==typeof t&&t(e)}))}},{key:"_logEvent",value:function(t,e){this._eventLogger&&this._eventLogger(this,t,e)}},{key:"_logError",value:function(t){this._eventLogger&&this._eventLogger(this,"error",t)}},{key:"_unitHash",value:function(t){if(this._hashes||(this._hashes={}),!(t in this._hashes)){var e=t in this._units?(0,l.hashUnit)(this._units[t]):null;return this._hashes[t]=e,e}return this._hashes[t]}},{key:"_init",value:function(t){var e=this,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this._data=t;var n={},o={};(t.experiments||[]).forEach((function(t){var e=[],r={data:t,variables:e};n[t.name]=r,t.variants.forEach((function(t,n){var i=t.config,u=null!=i&&i.length>0?JSON.parse(i):{};Object.keys(u).forEach((function(t){var e=r;o[t]?(0,y.insertUniqueSorted)(o[t],e,(function(t,e){return t.data.id<e.data.id})):o[t]=[e]})),e[n]=u}))})),this._index=n,this._indexVariables=o,this._assignments=r,!this._failed&&this._opts.refreshPeriod>0&&!this._refreshInterval&&(this._refreshInterval=setInterval((function(){return e._refresh()}),this._opts.refreshPeriod))}},{key:"_finalize",value:function(t){var e=this;return this._finalized?Promise.resolve():this._finalizing?this._finalizing:(void 0!==this._refreshInterval&&(clearInterval(this._refreshInterval),delete this._refreshInterval),this.pending()>0?(this._finalizing=new Promise((function(r,n){e._flush((function(t){e._finalizing=null,t?n(t):(e._finalized=!0,e._logEvent("finalize"),r())}),t)})),this._finalizing):(this._finalized=!0,this._logEvent("finalize"),Promise.resolve()))}}],r&&c(e.prototype,r),i&&c(e,i),Object.defineProperty(e,"prototype",{writable:!1}),t}();e.default=v},2928:function(t,e,r){"use strict";function n(t){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},n(t)}function o(t,e){for(var r=0;r<e.length;r++){var o=e[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,(i=o.key,u=void 0,u=function(t,e){if("object"!==n(t)||null===t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var o=r.call(t,e||"default");if("object"!==n(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(i,"string"),"symbol"===n(u)?u:String(u)),o)}var i,u}function i(t,e,r){return e&&o(t.prototype,e),r&&o(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function u(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&y(t,e)}function c(t){var e=p();return function(){var r,n=v(t);if(e){var o=v(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return f(this,r)}}function f(t,e){if(e&&("object"===n(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}function l(t){var e="function"==typeof Map?new Map:void 0;return l=function(t){if(null===t||(r=t,-1===Function.toString.call(r).indexOf("[native code]")))return t;var r;if("function"!=typeof t)throw new TypeError("Super expression must either be null or a function");if(void 0!==e){if(e.has(t))return e.get(t);e.set(t,n)}function n(){return s(t,arguments,v(this).constructor)}return n.prototype=Object.create(t.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),y(n,t)},l(t)}function s(t,e,r){return s=p()?Reflect.construct.bind():function(t,e,r){var n=[null];n.push.apply(n,e);var o=new(Function.bind.apply(t,n));return r&&y(o,r.prototype),o},s.apply(null,arguments)}function p(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}function y(t,e){return y=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},y(t,e)}function v(t){return v=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},v(t)}r(6078),r(9653),Object.defineProperty(e,"__esModule",{value:!0}),e.AbortError=e.RetryError=e.TimeoutError=void 0;var b=function(t){a(r,t);var e=c(r);function r(t){var n;return u(this,r),(n=e.call(this,"Timeout exceeded.")).name="TimeoutError",n.timeout=t,n}return i(r)}(l(Error));e.TimeoutError=b;var h=function(t){a(r,t);var e=c(r);function r(t,n,o){var i;return u(this,r),(i=e.call(this,"Retries exhausted. URL: ".concat(o," - Last Error: ").concat(n.message))).name="RetryError",i.retries=t,i.exception=n,i}return i(r)}(l(Error));e.RetryError=h;var d=function(t){a(r,t);var e=c(r);function r(t){var n;return u(this,r),(n=e.call(this,t)).name="AbortError",n}return i(r)}(l(Error));e.AbortError=d},5525:function(t,e,r){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.fetch=void 0;var n=r(2928);function o(t,e){return e=e||{},new Promise((function(r,o){var i=new XMLHttpRequest,u=[],a=[],c={},f=function(){i.abort()},l=e.signal?function(){var t;return null===(t=e.signal)||void 0===t?void 0:t.removeEventListener("abort",f)}:function(){},s=function t(){return{ok:2==(i.status/100|0),statusText:i.statusText,status:i.status,url:i.responseURL,text:function(){return Promise.resolve(i.responseText)},json:function(){return Promise.resolve(JSON.parse(i.responseText))},blob:function(){return Promise.resolve(new Blob([i.response]))},clone:t,headers:{keys:function(){return u},entries:function(){return a},get:function(t){return c[t.toLowerCase()]},has:function(t){return t.toLowerCase()in c}}}};for(var p in i.open(e.method||"get",t,!0),i.onload=function(){i.getAllResponseHeaders().replace(/^(.*?):[^\S\n]*([\s\S]*?)$/gm,(function(t,e,r){return u.push(e=e.toLowerCase()),a.push([e,r]),c[e]=c[e]?"".concat(c[e],",").concat(r):r,t})),l(),r(s())},e.signal&&e.signal.addEventListener("abort",f),i.onerror=function(t){l(),o(t)},i.onabort=function(){l(),o(new n.AbortError("The user aborted a request."))},i.withCredentials="include"===e.credentials,e.headers)i.setRequestHeader(p,e.headers[p]);i.send(e.body||null)}))}e.fetch=o,e.default=o},3651:function(t,e,r){"use strict";var n=Object.create?function(t,e,r,n){void 0===n&&(n=r);var o=Object.getOwnPropertyDescriptor(e,r);o&&!("get"in o?!e.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,o)}:function(t,e,r,n){void 0===n&&(n=r),t[n]=e[r]},o=Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e},i=function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var r in t)"default"!==r&&Object.prototype.hasOwnProperty.call(t,r)&&n(e,t,r);return o(e,t),e},u=function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});var a=r(1231),c=u(r(5525)),f=(0,a.isLongLivedApp)()?window.fetch?window.fetch.bind(window):c.default:(0,a.isWorker)()?self.fetch?self.fetch.bind(self):c.default:r.g?r.g.fetch?r.g.fetch.bind(r.g):function(t,e){return new Promise((function(n,o){Promise.resolve().then((function(){return i(r(3300))})).then((function(r){r.default(t.replace(/^\/\//g,"https://"),e).then(n).catch(o)})).catch(o)}))}:void 0;e.default=f},2299:function(t,e,r){"use strict";function n(t){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},n(t)}function o(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,o,i,u,a=[],c=!0,f=!1;try{if(i=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=i.call(r)).done)&&(a.push(n.value),a.length!==e);c=!0);}catch(t){f=!0,o=t}finally{try{if(!c&&null!=r.return&&(u=r.return(),Object(u)!==u))return}finally{if(f)throw o}}return a}}(t,e)||function(t,e){if(!t)return;if("string"==typeof t)return i(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return i(t,e)}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function i(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function u(t,e){for(var r=0;r<e.length;r++){var o=e[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,(i=o.key,u=void 0,u=function(t,e){if("object"!==n(t)||null===t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var o=r.call(t,e||"default");if("object"!==n(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(i,"string"),"symbol"===n(u)?u:String(u)),o)}var i,u}r(9720),r(5192),r(9653),r(6977),r(6078),Object.defineProperty(e,"__esModule",{value:!0}),e.Evaluator=void 0;var a=r(1231),c=function(){function t(e,r){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.operators=e,this.vars=r}var e,r,i;return e=t,(r=[{key:"evaluate",value:function(t){if(Array.isArray(t))return this.operators.and.evaluate(this,t);if((0,a.isObject)(t))for(var e=0,r=Object.entries(t);e<r.length;e++){var n=o(r[e],2),i=n[0],u=n[1],c=this.operators[i];if(void 0!==c)return c.evaluate(this,u);break}return null}},{key:"booleanConvert",value:function(t){switch(n(t)){case"boolean":return t;case"number":return 0!==t;case"string":return"false"!==t&&"0"!==t&&""!==t;default:return null!=t}}},{key:"numberConvert",value:function(t){switch(n(t)){case"number":return t;case"boolean":return t?1:0;case"string":var e=parseFloat(t);return Number.isFinite(e)?e:null;default:return null}}},{key:"stringConvert",value:function(t){switch(n(t)){case"string":return t;case"boolean":return t.toString();case"number":return t.toFixed(15).replace(/\.?0{0,15}$/,"");default:return null}}},{key:"extractVar",value:function(t){for(var e,r=t.split("/"),n=null!==(e=this.vars)&&void 0!==e?e:{},o=0;o<r.length;++o){var i=n[r[o]];if(void 0===i)return null;n=i}return n}},{key:"compare",value:function(t,e){if(null===t)return null===e?0:null;if(null===e)return null;switch(n(t)){case"number":var r=this.numberConvert(e);if(null!==r)return t===r?0:t>r?1:-1;break;case"string":var o=this.stringConvert(e);if(null!==o)return t===o?0:t>o?1:-1;break;case"boolean":var i=this.booleanConvert(e);if(null!=i)return t===i?0:t>i?1:-1;break;default:if((0,a.isEqualsDeep)(t,e))return 0}return null}}])&&u(e.prototype,r),i&&u(e,i),Object.defineProperty(e,"prototype",{writable:!1}),t}();e.Evaluator=c},8728:function(t,e,r){"use strict";function n(t){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},n(t)}function o(t,e){for(var r=0;r<e.length;r++){var o=e[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,(i=o.key,u=void 0,u=function(t,e){if("object"!==n(t)||null===t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var o=r.call(t,e||"default");if("object"!==n(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(i,"string"),"symbol"===n(u)?u:String(u)),o)}var i,u}r(6078),r(9653),Object.defineProperty(e,"__esModule",{value:!0}),e.JsonExpr=void 0;var i=r(9771),u=r(4652),a=r(6197),c=r(640),f=r(3251),l=r(8588),s=r(1501),p=r(9083),y=r(2299),v=r(4228),b=r(2682),h=r(4325),d=r(9188),m=r(8095),g={and:new u.AndCombinator,or:new a.OrCombinator,value:new i.ValueOperator,var:new c.VarOperator,null:new l.NullOperator,not:new f.NotOperator,in:new p.InOperator,match:new s.MatchOperator,eq:new v.EqualsOperator,gt:new b.GreaterThanOperator,gte:new h.GreaterThanOrEqualOperator,lt:new d.LessThanOperator,lte:new m.LessThanOrEqualOperator},w=function(){function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t)}var e,r,n;return e=t,(r=[{key:"evaluateBooleanExpr",value:function(t,e){var r=new y.Evaluator(g,e);return r.booleanConvert(r.evaluate(t))}},{key:"evaluateExpr",value:function(t,e){return new y.Evaluator(g,e).evaluate(t)}}])&&o(e.prototype,r),n&&o(e,n),Object.defineProperty(e,"prototype",{writable:!1}),t}();e.JsonExpr=w},4652:function(t,e,r){"use strict";function n(t){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},n(t)}function o(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=function(t,e){if(!t)return;if("string"==typeof t)return i(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return i(t,e)}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,o=function(){};return{s:o,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},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 u,a=!0,c=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return a=t.done,t},e:function(t){c=!0,u=t},f:function(){try{a||null==r.return||r.return()}finally{if(c)throw u}}}}function i(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function u(t,e){for(var r=0;r<e.length;r++){var o=e[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,(i=o.key,u=void 0,u=function(t,e){if("object"!==n(t)||null===t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var o=r.call(t,e||"default");if("object"!==n(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(i,"string"),"symbol"===n(u)?u:String(u)),o)}var i,u}r(6078),r(9653),Object.defineProperty(e,"__esModule",{value:!0}),e.AndCombinator=void 0;var a=function(){function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t)}var e,r,n;return e=t,(r=[{key:"evaluate",value:function(t,e){if(Array.isArray(e)){var r,n=o(e);try{for(n.s();!(r=n.n()).done;){var i=r.value;if(!t.booleanConvert(t.evaluate(i)))return!1}}catch(t){n.e(t)}finally{n.f()}return!0}return null}}])&&u(e.prototype,r),n&&u(e,n),Object.defineProperty(e,"prototype",{writable:!1}),t}();e.AndCombinator=a},4915:function(t,e,r){"use strict";function n(t){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},n(t)}function o(t,e){for(var r=0;r<e.length;r++){var o=e[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,(i=o.key,u=void 0,u=function(t,e){if("object"!==n(t)||null===t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var o=r.call(t,e||"default");if("object"!==n(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(i,"string"),"symbol"===n(u)?u:String(u)),o)}var i,u}r(6078),r(9653),Object.defineProperty(e,"__esModule",{value:!0}),e.BinaryOperator=void 0;var i=function(){function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t)}var e,r,n;return e=t,(r=[{key:"evaluate",value:function(t,e){if(Array.isArray(e)){var r=e.length>0?t.evaluate(e[0]):null;if(null!==r){var n=e.length>1?t.evaluate(e[1]):null;if(null!==n)return this.binary(t,r,n)}}return null}}])&&o(e.prototype,r),n&&o(e,n),Object.defineProperty(e,"prototype",{writable:!1}),t}();e.BinaryOperator=i},4228:function(t,e,r){"use strict";function n(t){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},n(t)}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){for(var r=0;r<e.length;r++){var o=e[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,(i=o.key,u=void 0,u=function(t,e){if("object"!==n(t)||null===t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var o=r.call(t,e||"default");if("object"!==n(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(i,"string"),"symbol"===n(u)?u:String(u)),o)}var i,u}function u(t,e){return u=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},u(t,e)}function a(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=f(t);if(e){var o=f(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return c(this,r)}}function c(t,e){if(e&&("object"===n(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}function f(t){return f=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},f(t)}r(6078),r(9653),Object.defineProperty(e,"__esModule",{value:!0}),e.EqualsOperator=void 0;var l=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&u(t,e)}(f,t);var e,r,n,c=a(f);function f(){return o(this,f),c.apply(this,arguments)}return e=f,(r=[{key:"binary",value:function(t,e,r){var n=t.compare(e,r);return null!==n?0===n:null}}])&&i(e.prototype,r),n&&i(e,n),Object.defineProperty(e,"prototype",{writable:!1}),f}(r(4915).BinaryOperator);e.EqualsOperator=l},2682:function(t,e,r){"use strict";function n(t){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},n(t)}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){for(var r=0;r<e.length;r++){var o=e[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,(i=o.key,u=void 0,u=function(t,e){if("object"!==n(t)||null===t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var o=r.call(t,e||"default");if("object"!==n(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(i,"string"),"symbol"===n(u)?u:String(u)),o)}var i,u}function u(t,e){return u=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},u(t,e)}function a(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=f(t);if(e){var o=f(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return c(this,r)}}function c(t,e){if(e&&("object"===n(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}function f(t){return f=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},f(t)}r(6078),r(9653),Object.defineProperty(e,"__esModule",{value:!0}),e.GreaterThanOperator=void 0;var l=function(t){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&u(t,e)}(f,t);var e,r,n,c=a(f);function f(){return o(this,f),c.apply(this,arguments)}return e=f,(r=[{key:"binary",value:function(t,e,r){var n=t.compare(e,r);return null!==n?n>0:null}}])&&i(e.prototype,r),n&&i(e,n),Object.defineProperty(e,"prototype",{writable:!1}),f}(r(4915).BinaryOperator);e.GreaterThanOperator=l},4325:function(t,e,r){"use strict";function n(t){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},n(t)}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){for(var r=0;r<e.length;r++){var o=e[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,(i=o.key,u=void 0,u=function(t,e){if("object"!==n(t)||null===t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var o=r.call(t,e||"default");if("object"!==n(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(i,"string"),"symbol"===n(u)?u:String(u)),o)}var i,u}function u(t,e){return u=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},u(t,e)}function a(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call