@sprig-technologies/sprig-browser 2.23.3 → 2.23.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -1,5 +1,5 @@
1
1
  "use strict";var dc=Object.defineProperty;var fc=(e,t,n)=>t in e?dc(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var ce=(e,t,n)=>(fc(e,typeof t!="symbol"?t+"":t,n),n);Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});var Be=(e=>(e.Closed="close.click",e.Complete="survey.completed",e.PageChange="page.change",e.API="api",e.Override="override",e))(Be||{}),H=(e=>(e.SDKReady="sdk.ready",e.SurveyAppeared="survey.appeared",e.SurveyClosed="survey.closed",e.SurveyDimensions="survey.dimensions",e.SurveyFadingOut="survey.fadingOut",e.SurveyHeight="survey.height",e.SurveyPresented="survey.presented",e.SurveyLifeCycle="survey.lifeCycle",e.SurveyWillClose="survey.willClose",e.SurveyWillPresent="survey.will.present",e.CloseSurveyOnOverlayClick="close.survey.overlayClick",e.VisitorIDUpdated="visitor.id.updated",e))(H||{}),Ss=(e=>(e.SurveyId="survey.id",e))(Ss||{});const ho={SDK_READY:"sdk.ready",SURVEY_APPEARED:"survey.appeared",SURVEY_CLOSED:"survey.closed",SURVEY_DIMENSIONS:"survey.dimensions",SURVEY_FADING_OUT:"survey.fadingOut",SURVEY_HEIGHT:"survey.height",SURVEY_PRESENTED:"survey.presented",SURVEY_LIFE_CYCLE:"survey.lifeCycle",SURVEY_WILL_CLOSE:"survey.willClose",SURVEY_WILL_PRESENT:"survey.will.present",CLOSE_SURVEY_ON_OVERLAY_CLICK:"close.survey.overlayClick",VISITOR_ID_UPDATED:"visitor.id.updated",DATA:{DISMISS_REASONS:{API:"api",CLOSED:"close.click",COMPLETE:"survey.completed",PAGE_CHANGE:"page.change",OVERRIDE:"override"},SURVEY_ID:"survey.id"}};var Ie=(e=>(e.VerifyViewVersion="verify.view.version",e.CurrentQuestion="survey.question",e.ViewPrototypeClick="question.prototype.click",e.ViewAgreementClick="question.agreement.click",e.RecordedTaskStart="recorded.task.start",e.RecordedTaskPermissionScreen="recorded.task.permission.screen",e.SurveyComplete="survey.complete",e))(Ie||{}),Lt=(e=>(e.ViewVersion="view.version",e.QuestionId="qid",e.Props="props",e))(Lt||{}),z=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function pc(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function hc(e){var t=e.default;if(typeof t=="function"){var n=function(){return t.apply(this,arguments)};n.prototype=t.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(e).forEach(function(r){var i=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(n,r,i.get?i:{enumerable:!0,get:function(){return e[r]}})}),n}var se={},jt={};Object.defineProperty(jt,"__esModule",{value:!0});var vo=function(){function e(){}return e.prototype.handleError=function(t){},e}();jt.NoopErrorHandler=vo;var mo=new vo;function vc(e){mo=e}jt.setErrorHandler=vc;function mc(){return mo}jt.getErrorHandler=mc;function gc(){mo=new vo}jt.resetErrorHandler=gc;var go={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),function(t){t[t.NOTSET=0]="NOTSET",t[t.DEBUG=1]="DEBUG",t[t.INFO=2]="INFO",t[t.WARNING=3]="WARNING",t[t.ERROR=4]="ERROR"}(e.LogLevel||(e.LogLevel={}))})(go);var wt={},sn={},br={exports:{}},sa=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||typeof msCrypto<"u"&&typeof window.msCrypto.getRandomValues=="function"&&msCrypto.getRandomValues.bind(msCrypto);if(sa){var la=new Uint8Array(16);br.exports=function(){return sa(la),la}}else{var ua=new Array(16);br.exports=function(){for(var t=0,n;t<16;t++)(t&3)===0&&(n=Math.random()*4294967296),ua[t]=n>>>((t&3)<<3)&255;return ua}}var Cs=[];for(var Zn=0;Zn<256;++Zn)Cs[Zn]=(Zn+256).toString(16).substr(1);function yc(e,t){var n=t||0,r=Cs;return[r[e[n++]],r[e[n++]],r[e[n++]],r[e[n++]],"-",r[e[n++]],r[e[n++]],"-",r[e[n++]],r[e[n++]],"-",r[e[n++]],r[e[n++]],"-",r[e[n++]],r[e[n++]],r[e[n++]],r[e[n++]],r[e[n++]],r[e[n++]]].join("")}var Is=yc,_c=br.exports,wc=Is,ca,ei,ti=0,ni=0;function bc(e,t,n){var r=t&&n||0,i=t||[];e=e||{};var o=e.node||ca,a=e.clockseq!==void 0?e.clockseq:ei;if(o==null||a==null){var s=_c();o==null&&(o=ca=[s[0]|1,s[1],s[2],s[3],s[4],s[5]]),a==null&&(a=ei=(s[6]<<8|s[7])&16383)}var l=e.msecs!==void 0?e.msecs:new Date().getTime(),u=e.nsecs!==void 0?e.nsecs:ni+1,c=l-ti+(u-ni)/1e4;if(c<0&&e.clockseq===void 0&&(a=a+1&16383),(c<0||l>ti)&&e.nsecs===void 0&&(u=0),u>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");ti=l,ni=u,ei=a,l+=122192928e5;var f=((l&268435455)*1e4+u)%4294967296;i[r++]=f>>>24&255,i[r++]=f>>>16&255,i[r++]=f>>>8&255,i[r++]=f&255;var d=l/4294967296*1e4&268435455;i[r++]=d>>>8&255,i[r++]=d&255,i[r++]=d>>>24&15|16,i[r++]=d>>>16&255,i[r++]=a>>>8|128,i[r++]=a&255;for(var p=0;p<6;++p)i[r+p]=o[p];return t||wc(i)}var Ec=bc,xc=br.exports,Sc=Is;function Cc(e,t,n){var r=t&&n||0;typeof e=="string"&&(t=e==="binary"?new Array(16):null,e=null),e=e||{};var i=e.random||(e.rng||xc)();if(i[6]=i[6]&15|64,i[8]=i[8]&63|128,t)for(var o=0;o<16;++o)t[r+o]=i[o];return t||Sc(i)}var Ic=Cc,kc=Ec,ks=Ic,yo=ks;yo.v1=kc;yo.v4=ks;var Tc=yo;(function(e){Object.defineProperty(e,"__esModule",{value:!0});var t=Tc;function n(){return t.v4()}e.generateUUID=n;function r(){return new Date().getTime()}e.getTimestamp=r;function i(f,d){for(var p=!1,h=Object.keys(f),v=0;v<h.length;v++)if(d===f[h[v]]){p=!0;break}return p}e.isValidEnum=i;function o(f,d){var p={};return f.forEach(function(h){var v=d(h);p[v]=p[v]||[],p[v].push(h)}),a(p)}e.groupBy=o;function a(f){return Object.keys(f).map(function(d){return f[d]})}e.objectValues=a;function s(f){return Object.keys(f).map(function(d){return[d,f[d]]})}e.objectEntries=s;function l(f,d){for(var p,h=0,v=f;h<v.length;h++){var m=v[h];if(d(m)){p=m;break}}return p}e.find=l;function u(f,d){var p={};return f.forEach(function(h){var v=d(h);p[v]=h}),p}e.keyBy=u;function c(f){for(var d=[],p=1;p<arguments.length;p++)d[p-1]=arguments[p];var h=0;return f.replace(/%s/g,function(){var v=d[h++],m=typeof v;return m==="function"?v():m==="string"?v:String(v)})}e.sprintf=c,function(f){f.ACTIVATE="ACTIVATE:experiment, user_id,attributes, variation, event",f.DECISION="DECISION:type, userId, attributes, decisionInfo",f.LOG_EVENT="LOG_EVENT:logEvent",f.OPTIMIZELY_CONFIG_UPDATE="OPTIMIZELY_CONFIG_UPDATE",f.TRACK="TRACK:event_key, user_id, attributes, event_tags, event"}(e.NOTIFICATION_TYPES||(e.NOTIFICATION_TYPES={}))})(sn);var Lc=z&&z.__spreadArrays||function(){for(var e=0,t=0,n=arguments.length;t<n;t++)e+=arguments[t].length;for(var r=Array(e),i=0,t=0;t<n;t++)for(var o=arguments[t],a=0,s=o.length;a<s;a++,i++)r[i]=o[a];return r};Object.defineProperty(wt,"__esModule",{value:!0});var Rc=jt,Er=sn,te=go,da={NOTSET:0,DEBUG:1,INFO:2,WARNING:3,ERROR:4};function _o(e){return typeof e!="string"||(e=e.toUpperCase(),e==="WARN"&&(e="WARNING"),!da[e])?e:da[e]}var Ts=function(){function e(){this.defaultLoggerFacade=new fa,this.loggers={}}return e.prototype.getLogger=function(t){return t?(this.loggers[t]||(this.loggers[t]=new fa({messagePrefix:t})),this.loggers[t]):this.defaultLoggerFacade},e}(),Ac=function(){function e(t){t===void 0&&(t={}),this.logLevel=te.LogLevel.NOTSET,t.logLevel!==void 0&&Er.isValidEnum(te.LogLevel,t.logLevel)&&this.setLogLevel(t.logLevel),this.logToConsole=t.logToConsole!==void 0?!!t.logToConsole:!0,this.prefix=t.prefix!==void 0?t.prefix:"[OPTIMIZELY]"}return e.prototype.log=function(t,n){if(!(!this.shouldLog(t)||!this.logToConsole)){var r=this.prefix+" - "+this.getLogLevelName(t)+" "+this.getTime()+" "+n;this.consoleLog(t,[r])}},e.prototype.setLogLevel=function(t){t=_o(t),!Er.isValidEnum(te.LogLevel,t)||t===void 0?this.logLevel=te.LogLevel.ERROR:this.logLevel=t},e.prototype.getTime=function(){return new Date().toISOString()},e.prototype.shouldLog=function(t){return t>=this.logLevel},e.prototype.getLogLevelName=function(t){switch(t){case te.LogLevel.DEBUG:return"DEBUG";case te.LogLevel.INFO:return"INFO ";case te.LogLevel.WARNING:return"WARN ";case te.LogLevel.ERROR:return"ERROR";default:return"NOTSET"}},e.prototype.consoleLog=function(t,n){switch(t){case te.LogLevel.DEBUG:console.log.apply(console,n);break;case te.LogLevel.INFO:console.info.apply(console,n);break;case te.LogLevel.WARNING:console.warn.apply(console,n);break;case te.LogLevel.ERROR:console.error.apply(console,n);break;default:console.log.apply(console,n)}},e}();wt.ConsoleLogHandler=Ac;var Tn=te.LogLevel.NOTSET,Ii=null,fa=function(){function e(t){t===void 0&&(t={}),this.messagePrefix="",t.messagePrefix&&(this.messagePrefix=t.messagePrefix)}return e.prototype.log=function(t,n){for(var r=[],i=2;i<arguments.length;i++)r[i-2]=arguments[i];this.internalLog(_o(t),{message:n,splat:r})},e.prototype.info=function(t){for(var n=[],r=1;r<arguments.length;r++)n[r-1]=arguments[r];this.namedLog(te.LogLevel.INFO,t,n)},e.prototype.debug=function(t){for(var n=[],r=1;r<arguments.length;r++)n[r-1]=arguments[r];this.namedLog(te.LogLevel.DEBUG,t,n)},e.prototype.warn=function(t){for(var n=[],r=1;r<arguments.length;r++)n[r-1]=arguments[r];this.namedLog(te.LogLevel.WARNING,t,n)},e.prototype.error=function(t){for(var n=[],r=1;r<arguments.length;r++)n[r-1]=arguments[r];this.namedLog(te.LogLevel.ERROR,t,n)},e.prototype.format=function(t){return(this.messagePrefix?this.messagePrefix+": ":"")+Er.sprintf.apply(void 0,Lc([t.message],t.splat))},e.prototype.internalLog=function(t,n){!Ii||t<Tn||(Ii.log(t,this.format(n)),n.error&&n.error instanceof Error&&Rc.getErrorHandler().handleError(n.error))},e.prototype.namedLog=function(t,n,r){var i;if(n instanceof Error){i=n,n=i.message,this.internalLog(t,{error:i,message:n,splat:r});return}if(r.length===0){this.internalLog(t,{message:n,splat:r});return}var o=r[r.length-1];o instanceof Error&&(i=o,r.splice(-1)),this.internalLog(t,{message:n,error:i,splat:r})},e}(),Ls=new Ts;function Oc(e){return Ls.getLogger(e)}wt.getLogger=Oc;function Uc(e){Ii=e}wt.setLogHandler=Uc;function Dc(e){e=_o(e),!Er.isValidEnum(te.LogLevel,e)||e===void 0?Tn=te.LogLevel.ERROR:Tn=e}wt.setLogLevel=Dc;function Pc(){return Tn}wt.getLogLevel=Pc;function Nc(){Ls=new Ts,Tn=te.LogLevel.NOTSET}wt.resetLogger=Nc;(function(e){function t(n){for(var r in n)e.hasOwnProperty(r)||(e[r]=n[r])}Object.defineProperty(e,"__esModule",{value:!0}),t(jt),t(go),t(wt)})(se);var Mc={},Vn={};Object.defineProperty(Vn,"__esModule",{value:!0});Vn.areEventContextsEqual=void 0;function jc(e,t){var n=e.context,r=t.context;return n.accountId===r.accountId&&n.projectId===r.projectId&&n.clientName===r.clientName&&n.clientVersion===r.clientVersion&&n.revision===r.revision&&n.anonymizeIP===r.anonymizeIP&&n.botFiltering===r.botFiltering}Vn.areEventContextsEqual=jc;var wo={},Qt={};Object.defineProperty(Qt,"__esModule",{value:!0});Qt.DefaultEventQueue=Qt.SingleEventQueue=void 0;var Vc=se,Fc=Vc.getLogger("EventProcessor"),Bc=function(){function e(t){var n=t.timeout,r=t.callback;this.timeout=Math.max(n,0),this.callback=r}return e.prototype.start=function(){this.timeoutId=setTimeout(this.callback,this.timeout)},e.prototype.refresh=function(){this.stop(),this.start()},e.prototype.stop=function(){this.timeoutId&&clearTimeout(this.timeoutId)},e}(),Hc=function(){function e(t){var n=t.sink;this.sink=n}return e.prototype.start=function(){},e.prototype.stop=function(){return Promise.resolve()},e.prototype.enqueue=function(t){this.sink([t])},e}();Qt.SingleEventQueue=Hc;var Kc=function(){function e(t){var n=t.flushInterval,r=t.maxQueueSize,i=t.sink,o=t.batchComparator;this.buffer=[],this.maxQueueSize=Math.max(r,1),this.sink=i,this.batchComparator=o,this.timer=new Bc({callback:this.flush.bind(this),timeout:n}),this.started=!1}return e.prototype.start=function(){this.started=!0},e.prototype.stop=function(){this.started=!1;var t=this.sink(this.buffer);return this.buffer=[],this.timer.stop(),t},e.prototype.enqueue=function(t){if(!this.started){Fc.warn("Queue is stopped, not accepting event");return}var n=this.buffer[0];n&&!this.batchComparator(n,t)&&this.flush(),this.buffer.length===0&&this.timer.refresh(),this.buffer.push(t),this.buffer.length>=this.maxQueueSize&&this.flush()},e.prototype.flush=function(){this.sink(this.buffer),this.buffer=[],this.timer.stop()},e}();Qt.DefaultEventQueue=Kc;(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.sendEventNotification=e.getQueue=e.validateAndGetBatchSize=e.validateAndGetFlushInterval=e.DEFAULT_BATCH_SIZE=e.DEFAULT_FLUSH_INTERVAL=void 0;var t=Qt,n=se,r=sn;e.DEFAULT_FLUSH_INTERVAL=3e4,e.DEFAULT_BATCH_SIZE=10;var i=n.getLogger("EventProcessor");function o(u){return u<=0&&(i.warn("Invalid flushInterval "+u+", defaulting to "+e.DEFAULT_FLUSH_INTERVAL),u=e.DEFAULT_FLUSH_INTERVAL),u}e.validateAndGetFlushInterval=o;function a(u){return u=Math.floor(u),u<1&&(i.warn("Invalid batchSize "+u+", defaulting to "+e.DEFAULT_BATCH_SIZE),u=e.DEFAULT_BATCH_SIZE),u=Math.max(1,u),u}e.validateAndGetBatchSize=a;function s(u,c,f,d){var p;return u>1?p=new t.DefaultEventQueue({flushInterval:c,maxQueueSize:u,sink:f,batchComparator:d}):p=new t.SingleEventQueue({sink:f}),p}e.getQueue=s;function l(u,c){u&&u.sendNotifications(r.NOTIFICATION_TYPES.LOG_EVENT,c)}e.sendEventNotification=l})(wo);var Rs={};Object.defineProperty(Rs,"__esModule",{value:!0});var As={};Object.defineProperty(As,"__esModule",{value:!0});var Zt={},Br={};Object.defineProperty(Br,"__esModule",{value:!0});Br.LocalStorageStore=void 0;var $c=sn,Gc=se,pa=Gc.getLogger("EventProcessor"),qc=function(){function e(t){var n=t.key,r=t.maxValues,i=r===void 0?1e3:r;this.LS_KEY=n,this.maxValues=i}return e.prototype.get=function(t){return this.getMap()[t]||null},e.prototype.set=function(t,n){var r=this.getMap();r[t]=n,this.replace(r)},e.prototype.remove=function(t){var n=this.getMap();delete n[t],this.replace(n)},e.prototype.values=function(){return $c.objectValues(this.getMap())},e.prototype.clear=function(){this.replace({})},e.prototype.replace=function(t){try{window.localStorage&&localStorage.setItem(this.LS_KEY,JSON.stringify(t)),this.clean()}catch(n){pa.error(n)}},e.prototype.clean=function(){var t=this.getMap(),n=Object.keys(t),r=n.length-this.maxValues;if(!(r<1)){var i=n.map(function(a){return{key:a,value:t[a]}});i.sort(function(a,s){return a.value.timestamp-s.value.timestamp});for(var o=0;o<r;o++)delete t[i[o].key];this.replace(t)}},e.prototype.getMap=function(){try{var t=window.localStorage&&localStorage.getItem(this.LS_KEY);if(t)return JSON.parse(t)||{}}catch(n){pa.error(n)}return{}},e}();Br.LocalStorageStore=qc;var zc=z&&z.__extends||function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,i){r.__proto__=i}||function(r,i){for(var o in i)Object.prototype.hasOwnProperty.call(i,o)&&(r[o]=i[o])},e(t,n)};return function(t,n){e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}();Object.defineProperty(Zt,"__esModule",{value:!0});Zt.LocalStoragePendingEventsDispatcher=Zt.PendingEventsDispatcher=void 0;var Wc=se,Yc=Br,ha=sn,Qc=Wc.getLogger("EventProcessor"),Os=function(){function e(t){var n=t.eventDispatcher,r=t.store;this.dispatcher=n,this.store=r}return e.prototype.dispatchEvent=function(t,n){this.send({uuid:ha.generateUUID(),timestamp:ha.getTimestamp(),request:t},n)},e.prototype.sendPendingEvents=function(){var t=this,n=this.store.values();Qc.debug("Sending %s pending events from previous page",n.length),n.forEach(function(r){try{t.send(r,function(){})}catch{}})},e.prototype.send=function(t,n){var r=this;this.store.set(t.uuid,t),this.dispatcher.dispatchEvent(t.request,function(i){r.store.remove(t.uuid),n(i)})},e}();Zt.PendingEventsDispatcher=Os;var Zc=function(e){zc(t,e);function t(n){var r=n.eventDispatcher;return e.call(this,{eventDispatcher:r,store:new Yc.LocalStorageStore({maxValues:100,key:"fs_optly_pending_events"})})||this}return t}(Os);Zt.LocalStoragePendingEventsDispatcher=Zc;var Re={},ki=z&&z.__assign||function(){return ki=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++){t=arguments[n];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])}return e},ki.apply(this,arguments)};Object.defineProperty(Re,"__esModule",{value:!0});Re.formatEvents=Re.buildConversionEventV1=Re.buildImpressionEventV1=Re.makeBatchedEventV1=void 0;var Xc="campaign_activated",Jc="custom",va="$opt_bot_filtering";function Us(e){var t=[],n=e[0];return e.forEach(function(r){if(r.type==="conversion"||r.type==="impression"){var i=bo(r);r.type==="impression"?i.snapshots.push(Ps(r)):r.type==="conversion"&&i.snapshots.push(Ds(r)),t.push(i)}}),{client_name:n.context.clientName,client_version:n.context.clientVersion,account_id:n.context.accountId,project_id:n.context.projectId,revision:n.context.revision,anonymize_ip:n.context.anonymizeIP,enrich_decisions:!0,visitors:t}}Re.makeBatchedEventV1=Us;function Ds(e){var t=ki({},e.tags);delete t.revenue,delete t.value;var n={entity_id:e.event.id,key:e.event.key,timestamp:e.timestamp,uuid:e.uuid};return e.tags&&(n.tags=e.tags),e.value!=null&&(n.value=e.value),e.revenue!=null&&(n.revenue=e.revenue),{events:[n]}}function Ps(e){var t,n,r=e.layer,i=e.experiment,o=e.variation,a=e.ruleKey,s=e.flagKey,l=e.ruleType,u=e.enabled,c=r?r.id:null,f=(t=i==null?void 0:i.id)!==null&&t!==void 0?t:"",d=(n=o==null?void 0:o.id)!==null&&n!==void 0?n:"",p=o?o.key:"";return{decisions:[{campaign_id:c,experiment_id:f,variation_id:d,metadata:{flag_key:s,rule_key:a,rule_type:l,variation_key:p,enabled:u}}],events:[{entity_id:c,timestamp:e.timestamp,key:Xc,uuid:e.uuid}]}}function bo(e){var t={snapshots:[],visitor_id:e.user.id,attributes:[]};return e.user.attributes.forEach(function(n){t.attributes.push({entity_id:n.entityId,key:n.key,type:"custom",value:n.value})}),typeof e.context.botFiltering=="boolean"&&t.attributes.push({entity_id:va,key:va,type:Jc,value:e.context.botFiltering}),t}function ed(e){var t=bo(e);return t.snapshots.push(Ps(e)),{client_name:e.context.clientName,client_version:e.context.clientVersion,account_id:e.context.accountId,project_id:e.context.projectId,revision:e.context.revision,anonymize_ip:e.context.anonymizeIP,enrich_decisions:!0,visitors:[t]}}Re.buildImpressionEventV1=ed;function td(e){var t=bo(e);return t.snapshots.push(Ds(e)),{client_name:e.context.clientName,client_version:e.context.clientVersion,account_id:e.context.accountId,project_id:e.context.projectId,revision:e.context.revision,anonymize_ip:e.context.anonymizeIP,enrich_decisions:!0,visitors:[t]}}Re.buildConversionEventV1=td;function nd(e){return{url:"https://logx.optimizely.com/v1/events",httpVerb:"POST",params:Us(e)}}Re.formatEvents=nd;var Hr={},Eo={};Object.defineProperty(Eo,"__esModule",{value:!0});var rd=function(){function e(){this.reqsInFlightCount=0,this.reqsCompleteResolvers=[]}return e.prototype.trackRequest=function(t){var n=this;this.reqsInFlightCount++;var r=function(){n.reqsInFlightCount--,n.reqsInFlightCount===0&&(n.reqsCompleteResolvers.forEach(function(i){return i()}),n.reqsCompleteResolvers=[])};t.then(r,r)},e.prototype.onRequestsComplete=function(){var t=this;return new Promise(function(n){t.reqsInFlightCount===0?n():t.reqsCompleteResolvers.push(n)})},e}();Eo.default=rd;var id=z&&z.__awaiter||function(e,t,n,r){function i(o){return o instanceof n?o:new n(function(a){a(o)})}return new(n||(n=Promise))(function(o,a){function s(c){try{u(r.next(c))}catch(f){a(f)}}function l(c){try{u(r.throw(c))}catch(f){a(f)}}function u(c){c.done?o(c.value):i(c.value).then(s,l)}u((r=r.apply(e,t||[])).next())})},od=z&&z.__generator||function(e,t){var n={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},r,i,o,a;return a={next:s(0),throw:s(1),return:s(2)},typeof Symbol=="function"&&(a[Symbol.iterator]=function(){return this}),a;function s(u){return function(c){return l([u,c])}}function l(u){if(r)throw new TypeError("Generator is already executing.");for(;n;)try{if(r=1,i&&(o=u[0]&2?i.return:u[0]?i.throw||((o=i.return)&&o.call(i),0):i.next)&&!(o=o.call(i,u[1])).done)return o;switch(i=0,o&&(u=[u[0]&2,o.value]),u[0]){case 0:case 1:o=u;break;case 4:return n.label++,{value:u[1],done:!1};case 5:n.label++,i=u[1],u=[0];continue;case 7:u=n.ops.pop(),n.trys.pop();continue;default:if(o=n.trys,!(o=o.length>0&&o[o.length-1])&&(u[0]===6||u[0]===2)){n=0;continue}if(u[0]===3&&(!o||u[1]>o[0]&&u[1]<o[3])){n.label=u[1];break}if(u[0]===6&&n.label<o[1]){n.label=o[1],o=u;break}if(o&&n.label<o[2]){n.label=o[2],n.ops.push(u);break}o[2]&&n.ops.pop(),n.trys.pop();continue}u=t.call(e,n)}catch(c){u=[6,c],i=0}finally{r=o=0}if(u[0]&5)throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}},ad=z&&z.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Hr,"__esModule",{value:!0});Hr.LogTierV1EventProcessor=void 0;var sd=se,Bt=wo,ld=ad(Eo),ud=Vn,cd=Re,ma=sd.getLogger("LogTierV1EventProcessor"),dd=function(){function e(t){var n=t.dispatcher,r=t.flushInterval,i=r===void 0?Bt.DEFAULT_FLUSH_INTERVAL:r,o=t.batchSize,a=o===void 0?Bt.DEFAULT_BATCH_SIZE:o,s=t.notificationCenter;this.dispatcher=n,this.notificationCenter=s,this.requestTracker=new ld.default,i=Bt.validateAndGetFlushInterval(i),a=Bt.validateAndGetBatchSize(a),this.queue=Bt.getQueue(a,i,this.drainQueue.bind(this),ud.areEventContextsEqual)}return e.prototype.drainQueue=function(t){var n=this,r=new Promise(function(i){if(ma.debug("draining queue with %s events",t.length),t.length===0){i();return}var o=cd.formatEvents(t);n.dispatcher.dispatchEvent(o,function(){i()}),Bt.sendEventNotification(n.notificationCenter,o)});return this.requestTracker.trackRequest(r),r},e.prototype.process=function(t){this.queue.enqueue(t)},e.prototype.stop=function(){try{return this.queue.stop(),this.requestTracker.onRequestsComplete()}catch(t){ma.error('Error stopping EventProcessor: "%s"',t.message,t)}return Promise.resolve()},e.prototype.start=function(){return id(this,void 0,void 0,function(){return od(this,function(t){return this.queue.start(),[2]})})},e}();Hr.LogTierV1EventProcessor=dd;(function(e){var t=z&&z.__createBinding||(Object.create?function(r,i,o,a){a===void 0&&(a=o),Object.defineProperty(r,a,{enumerable:!0,get:function(){return i[o]}})}:function(r,i,o,a){a===void 0&&(a=o),r[a]=i[o]}),n=z&&z.__exportStar||function(r,i){for(var o in r)o!=="default"&&!Object.prototype.hasOwnProperty.call(i,o)&&t(i,r,o)};Object.defineProperty(e,"__esModule",{value:!0}),n(Vn,e),n(wo,e),n(Rs,e),n(As,e),n(Zt,e),n(Re,e),n(Hr,e)})(Mc);var xr={exports:{}},ga=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||typeof msCrypto<"u"&&typeof window.msCrypto.getRandomValues=="function"&&msCrypto.getRandomValues.bind(msCrypto);if(ga){var ya=new Uint8Array(16);xr.exports=function(){return ga(ya),ya}}else{var _a=new Array(16);xr.exports=function(){for(var t=0,n;t<16;t++)(t&3)===0&&(n=Math.random()*4294967296),_a[t]=n>>>((t&3)<<3)&255;return _a}}var Ns=[];for(var Xn=0;Xn<256;++Xn)Ns[Xn]=(Xn+256).toString(16).substr(1);function fd(e,t){var n=t||0,r=Ns;return[r[e[n++]],r[e[n++]],r[e[n++]],r[e[n++]],"-",r[e[n++]],r[e[n++]],"-",r[e[n++]],r[e[n++]],"-",r[e[n++]],r[e[n++]],"-",r[e[n++]],r[e[n++]],r[e[n++]],r[e[n++]],r[e[n++]],r[e[n++]]].join("")}var Ms=fd,pd=xr.exports,hd=Ms,wa,ri,ii=0,oi=0;function vd(e,t,n){var r=t&&n||0,i=t||[];e=e||{};var o=e.node||wa,a=e.clockseq!==void 0?e.clockseq:ri;if(o==null||a==null){var s=pd();o==null&&(o=wa=[s[0]|1,s[1],s[2],s[3],s[4],s[5]]),a==null&&(a=ri=(s[6]<<8|s[7])&16383)}var l=e.msecs!==void 0?e.msecs:new Date().getTime(),u=e.nsecs!==void 0?e.nsecs:oi+1,c=l-ii+(u-oi)/1e4;if(c<0&&e.clockseq===void 0&&(a=a+1&16383),(c<0||l>ii)&&e.nsecs===void 0&&(u=0),u>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");ii=l,oi=u,ri=a,l+=122192928e5;var f=((l&268435455)*1e4+u)%4294967296;i[r++]=f>>>24&255,i[r++]=f>>>16&255,i[r++]=f>>>8&255,i[r++]=f&255;var d=l/4294967296*1e4&268435455;i[r++]=d>>>8&255,i[r++]=d&255,i[r++]=d>>>24&15|16,i[r++]=d>>>16&255,i[r++]=a>>>8|128,i[r++]=a&255;for(var p=0;p<6;++p)i[r+p]=o[p];return t||hd(i)}var md=vd,gd=xr.exports,yd=Ms;function _d(e,t,n){var r=t&&n||0;typeof e=="string"&&(t=e==="binary"?new Array(16):null,e=null),e=e||{};var i=e.random||(e.rng||gd)();if(i[6]=i[6]&15|64,i[8]=i[8]&63|128,t)for(var o=0;o<16;++o)t[r+o]=i[o];return t||yd(i)}var wd=_d,bd=md,js=wd,Vs=js;Vs.v1=bd;Vs.v4=js;var Ed={exports:{}};(function(e){(function(){function t(i,o){for(var a=i.length,s=o^a,l=0,u;a>=4;)u=i.charCodeAt(l)&255|(i.charCodeAt(++l)&255)<<8|(i.charCodeAt(++l)&255)<<16|(i.charCodeAt(++l)&255)<<24,u=(u&65535)*1540483477+(((u>>>16)*1540483477&65535)<<16),u^=u>>>24,u=(u&65535)*1540483477+(((u>>>16)*1540483477&65535)<<16),s=(s&65535)*1540483477+(((s>>>16)*1540483477&65535)<<16)^u,a-=4,++l;switch(a){case 3:s^=(i.charCodeAt(l+2)&255)<<16;case 2:s^=(i.charCodeAt(l+1)&255)<<8;case 1:s^=i.charCodeAt(l)&255,s=(s&65535)*1540483477+(((s>>>16)*1540483477&65535)<<16)}return s^=s>>>13,s=(s&65535)*1540483477+(((s>>>16)*1540483477&65535)<<16),s^=s>>>15,s>>>0}function n(i,o){var a,s,l,u,c,f,d,p;for(a=i.length&3,s=i.length-a,l=o,c=3432918353,f=461845907,p=0;p<s;)d=i.charCodeAt(p)&255|(i.charCodeAt(++p)&255)<<8|(i.charCodeAt(++p)&255)<<16|(i.charCodeAt(++p)&255)<<24,++p,d=(d&65535)*c+(((d>>>16)*c&65535)<<16)&4294967295,d=d<<15|d>>>17,d=(d&65535)*f+(((d>>>16)*f&65535)<<16)&4294967295,l^=d,l=l<<13|l>>>19,u=(l&65535)*5+(((l>>>16)*5&65535)<<16)&4294967295,l=(u&65535)+27492+(((u>>>16)+58964&65535)<<16);switch(d=0,a){case 3:d^=(i.charCodeAt(p+2)&255)<<16;case 2:d^=(i.charCodeAt(p+1)&255)<<8;case 1:d^=i.charCodeAt(p)&255,d=(d&65535)*c+(((d>>>16)*c&65535)<<16)&4294967295,d=d<<15|d>>>17,d=(d&65535)*f+(((d>>>16)*f&65535)<<16)&4294967295,l^=d}return l^=i.length,l^=l>>>16,l=(l&65535)*2246822507+(((l>>>16)*2246822507&65535)<<16)&4294967295,l^=l>>>13,l=(l&65535)*3266489909+(((l>>>16)*3266489909&65535)<<16)&4294967295,l^=l>>>16,l>>>0}var r=n;r.v2=t,r.v3=n,e.exports=r})()})(Ed);var Fs={},xo={},So={},$e={};Object.defineProperty($e,"__esModule",{value:!0});$e.DEFAULT_UPDATE_INTERVAL=5*60*1e3;$e.MIN_UPDATE_INTERVAL=1e3;$e.DEFAULT_URL_TEMPLATE="https://cdn.optimizely.com/datafiles/%s.json";$e.DEFAULT_AUTHENTICATED_URL_TEMPLATE="https://config.optimizely.com/datafiles/auth/%s.json";$e.BACKOFF_BASE_WAIT_SECONDS_BY_ERROR_COUNT=[0,8,16,32,64,128,256,512];$e.REQUEST_TIMEOUT_MS=60*1e3;Object.defineProperty(So,"__esModule",{value:!0});var xd=$e,Sd=se,Cd=Sd.getLogger("DatafileManager"),Id="GET",kd=4;function Td(e){var t=e.getAllResponseHeaders();if(t===null)return{};var n=t.split(`\r
2
- `),r={};return n.forEach(function(i){var o=i.indexOf(": ");if(o>-1){var a=i.slice(0,o),s=i.slice(o+2);s.length>0&&(r[a]=s)}}),r}function Ld(e,t){Object.keys(e).forEach(function(n){var r=e[n];t.setRequestHeader(n,r)})}function Rd(e,t){var n=new XMLHttpRequest,r=new Promise(function(i,o){n.open(Id,e,!0),Ld(t,n),n.onreadystatechange=function(){if(n.readyState===kd){var a=n.status;if(a===0){o(new Error("Request error"));return}var s=Td(n),l={statusCode:n.status,body:n.responseText,headers:s};i(l)}},n.timeout=xd.REQUEST_TIMEOUT_MS,n.ontimeout=function(){Cd.error("Request timed out")},n.send()});return{responsePromise:r,abort:function(){n.abort()}}}So.makeGetRequest=Rd;var Co={},Io={};Object.defineProperty(Io,"__esModule",{value:!0});var Ad=function(){function e(){this.listeners={},this.listenerId=1}return e.prototype.on=function(t,n){var r=this;this.listeners[t]||(this.listeners[t]={});var i=String(this.listenerId);return this.listenerId++,this.listeners[t][i]=n,function(){r.listeners[t]&&delete r.listeners[t][i]}},e.prototype.emit=function(t,n){var r=this.listeners[t];r&&Object.keys(r).forEach(function(i){var o=r[i];o(n)})},e.prototype.removeAllListeners=function(){this.listeners={}},e}();Io.default=Ad;var ko={};Object.defineProperty(ko,"__esModule",{value:!0});var ai=$e;function Od(){return Math.round(Math.random()*1e3)}var Ud=function(){function e(){this.errorCount=0}return e.prototype.getDelay=function(){if(this.errorCount===0)return 0;var t=ai.BACKOFF_BASE_WAIT_SECONDS_BY_ERROR_COUNT[Math.min(ai.BACKOFF_BASE_WAIT_SECONDS_BY_ERROR_COUNT.length-1,this.errorCount)];return t*1e3+Od()},e.prototype.countError=function(){this.errorCount<ai.BACKOFF_BASE_WAIT_SECONDS_BY_ERROR_COUNT.length-1&&this.errorCount++},e.prototype.reset=function(){this.errorCount=0},e}();ko.default=Ud;var Sr=z&&z.__assign||function(){return Sr=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++){t=arguments[n];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])}return e},Sr.apply(this,arguments)},Bs=z&&z.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Co,"__esModule",{value:!0});var Dd=se,Pd=sn,Nd=Bs(Io),gn=$e,Md=Bs(ko),xe=Dd.getLogger("DatafileManager"),jd="update";function Vd(e){return e>=gn.MIN_UPDATE_INTERVAL}function ba(e){return e>=200&&e<400}var Fd={get:function(){return Promise.resolve("")},set:function(){return Promise.resolve()},contains:function(){return Promise.resolve(!1)},remove:function(){return Promise.resolve()}},Bd=function(){function e(t){var n=this,r=Sr(Sr({},this.getConfigDefaults()),t),i=r.datafile,o=r.autoUpdate,a=o===void 0?!1:o,s=r.sdkKey,l=r.updateInterval,u=l===void 0?gn.DEFAULT_UPDATE_INTERVAL:l,c=r.urlTemplate,f=c===void 0?gn.DEFAULT_URL_TEMPLATE:c,d=r.cache,p=d===void 0?Fd:d;this.cache=p,this.cacheKey="opt-datafile-"+s,this.isReadyPromiseSettled=!1,this.readyPromiseResolver=function(){},this.readyPromiseRejecter=function(){},this.readyPromise=new Promise(function(h,v){n.readyPromiseResolver=h,n.readyPromiseRejecter=v}),i?(this.currentDatafile=i,s||this.resolveReadyPromise()):this.currentDatafile="",this.isStarted=!1,this.datafileUrl=Pd.sprintf(f,s),this.emitter=new Nd.default,this.autoUpdate=a,Vd(u)?this.updateInterval=u:(xe.warn("Invalid updateInterval %s, defaulting to %s",u,gn.DEFAULT_UPDATE_INTERVAL),this.updateInterval=gn.DEFAULT_UPDATE_INTERVAL),this.currentTimeout=null,this.currentRequest=null,this.backoffController=new Md.default,this.syncOnCurrentRequestComplete=!1}return e.prototype.get=function(){return this.currentDatafile},e.prototype.start=function(){this.isStarted||(xe.debug("Datafile manager started"),this.isStarted=!0,this.backoffController.reset(),this.setDatafileFromCacheIfAvailable(),this.syncDatafile())},e.prototype.stop=function(){return xe.debug("Datafile manager stopped"),this.isStarted=!1,this.currentTimeout&&(clearTimeout(this.currentTimeout),this.currentTimeout=null),this.emitter.removeAllListeners(),this.currentRequest&&(this.currentRequest.abort(),this.currentRequest=null),Promise.resolve()},e.prototype.onReady=function(){return this.readyPromise},e.prototype.on=function(t,n){return this.emitter.on(t,n)},e.prototype.onRequestRejected=function(t){!this.isStarted||(this.backoffController.countError(),t instanceof Error?xe.error("Error fetching datafile: %s",t.message,t):typeof t=="string"?xe.error("Error fetching datafile: %s",t):xe.error("Error fetching datafile"))},e.prototype.onRequestResolved=function(t){if(!!this.isStarted){typeof t.statusCode<"u"&&ba(t.statusCode)?this.backoffController.reset():this.backoffController.countError(),this.trySavingLastModified(t.headers);var n=this.getNextDatafileFromResponse(t);if(n!=="")if(xe.info("Updating datafile from response"),this.currentDatafile=n,this.cache.set(this.cacheKey,n),!this.isReadyPromiseSettled)this.resolveReadyPromise();else{var r={datafile:n};this.emitter.emit(jd,r)}}},e.prototype.onRequestComplete=function(){!this.isStarted||(this.currentRequest=null,!this.isReadyPromiseSettled&&!this.autoUpdate&&this.rejectReadyPromise(new Error("Failed to become ready")),this.autoUpdate&&this.syncOnCurrentRequestComplete&&this.syncDatafile(),this.syncOnCurrentRequestComplete=!1)},e.prototype.syncDatafile=function(){var t=this,n={};this.lastResponseLastModified&&(n["if-modified-since"]=this.lastResponseLastModified),xe.debug("Making datafile request to url %s with headers: %s",this.datafileUrl,function(){return JSON.stringify(n)}),this.currentRequest=this.makeGetRequest(this.datafileUrl,n);var r=function(){t.onRequestComplete()},i=function(a){t.onRequestResolved(a)},o=function(a){t.onRequestRejected(a)};this.currentRequest.responsePromise.then(i,o).then(r,r),this.autoUpdate&&this.scheduleNextUpdate()},e.prototype.resolveReadyPromise=function(){this.readyPromiseResolver(),this.isReadyPromiseSettled=!0},e.prototype.rejectReadyPromise=function(t){this.readyPromiseRejecter(t),this.isReadyPromiseSettled=!0},e.prototype.scheduleNextUpdate=function(){var t=this,n=this.backoffController.getDelay(),r=Math.max(n,this.updateInterval);xe.debug("Scheduling sync in %s ms",r),this.currentTimeout=setTimeout(function(){t.currentRequest?t.syncOnCurrentRequestComplete=!0:t.syncDatafile()},r)},e.prototype.getNextDatafileFromResponse=function(t){return xe.debug("Response status code: %s",t.statusCode),typeof t.statusCode>"u"||t.statusCode===304?"":ba(t.statusCode)?t.body:""},e.prototype.trySavingLastModified=function(t){var n=t["last-modified"]||t["Last-Modified"];typeof n<"u"&&(this.lastResponseLastModified=n,xe.debug("Saved last modified header value from response: %s",this.lastResponseLastModified))},e.prototype.setDatafileFromCacheIfAvailable=function(){var t=this;this.cache.get(this.cacheKey).then(function(n){t.isStarted&&!t.isReadyPromiseSettled&&n!==""&&(xe.debug("Using datafile from cache"),t.currentDatafile=n,t.resolveReadyPromise())})},e}();Co.default=Bd;var Hd=z&&z.__extends||function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,i){r.__proto__=i}||function(r,i){for(var o in i)i.hasOwnProperty(o)&&(r[o]=i[o])},e(t,n)};return function(t,n){e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}(),Kd=z&&z.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(xo,"__esModule",{value:!0});var $d=So,Gd=Kd(Co),qd=function(e){Hd(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.makeGetRequest=function(n,r){return $d.makeGetRequest(n,r)},t.prototype.getConfigDefaults=function(){return{autoUpdate:!1}},t}(Gd.default);xo.default=qd;Object.defineProperty(Fs,"__esModule",{value:!0});var zd=xo;Fs.HttpPollingDatafileManager=zd.default;var Wd={NOTSET:0,DEBUG:1,INFO:2,WARNING:3,ERROR:4},Yd={CONDITION_EVALUATOR_ERROR:"%s: Error evaluating audience condition of type %s: %s",DATAFILE_AND_SDK_KEY_MISSING:"%s: You must provide at least one of sdkKey or datafile. Cannot start Optimizely",EXPERIMENT_KEY_NOT_IN_DATAFILE:"%s: Experiment key %s is not in datafile.",FEATURE_NOT_IN_DATAFILE:"%s: Feature key %s is not in datafile.",IMPROPERLY_FORMATTED_EXPERIMENT:"%s: Experiment key %s is improperly formatted.",INVALID_ATTRIBUTES:"%s: Provided attributes are in an invalid format.",INVALID_BUCKETING_ID:"%s: Unable to generate hash for bucketing ID %s: %s",INVALID_DATAFILE:"%s: Datafile is invalid - property %s: %s",INVALID_DATAFILE_MALFORMED:"%s: Datafile is invalid because it is malformed.",INVALID_CONFIG:"%s: Provided Optimizely config is in an invalid format.",INVALID_JSON:"%s: JSON object is not valid.",INVALID_ERROR_HANDLER:'%s: Provided "errorHandler" is in an invalid format.',INVALID_EVENT_DISPATCHER:'%s: Provided "eventDispatcher" is in an invalid format.',INVALID_EVENT_TAGS:"%s: Provided event tags are in an invalid format.",INVALID_EXPERIMENT_KEY:"%s: Experiment key %s is not in datafile. It is either invalid, paused, or archived.",INVALID_EXPERIMENT_ID:"%s: Experiment ID %s is not in datafile.",INVALID_GROUP_ID:"%s: Group ID %s is not in datafile.",INVALID_LOGGER:'%s: Provided "logger" is in an invalid format.',INVALID_ROLLOUT_ID:"%s: Invalid rollout ID %s attached to feature %s",INVALID_USER_ID:"%s: Provided user ID is in an invalid format.",INVALID_USER_PROFILE_SERVICE:"%s: Provided user profile service instance is in an invalid format: %s.",NO_DATAFILE_SPECIFIED:"%s: No datafile specified. Cannot start optimizely.",NO_JSON_PROVIDED:"%s: No JSON object to validate against schema.",NO_VARIATION_FOR_EXPERIMENT_KEY:"%s: No variation key %s defined in datafile for experiment %s.",UNDEFINED_ATTRIBUTE:"%s: Provided attribute: %s has an undefined value.",UNRECOGNIZED_ATTRIBUTE:"%s: Unrecognized attribute %s provided. Pruning before sending event to Optimizely.",UNABLE_TO_CAST_VALUE:"%s: Unable to cast value %s to type %s, returning null.",USER_NOT_IN_FORCED_VARIATION:"%s: User %s is not in the forced variation map. Cannot remove their forced variation.",USER_PROFILE_LOOKUP_ERROR:'%s: Error while looking up user profile for user ID "%s": %s.',USER_PROFILE_SAVE_ERROR:'%s: Error while saving user profile for user ID "%s": %s.',VARIABLE_KEY_NOT_IN_DATAFILE:'%s: Variable with key "%s" associated with feature with key "%s" is not in datafile.',VARIATION_ID_NOT_IN_DATAFILE:"%s: No variation ID %s defined in datafile for experiment %s.",VARIATION_ID_NOT_IN_DATAFILE_NO_EXPERIMENT:"%s: Variation ID %s is not in the datafile.",INVALID_INPUT_FORMAT:"%s: Provided %s is in an invalid format.",INVALID_DATAFILE_VERSION:"%s: This version of the JavaScript SDK does not support the given datafile version: %s",INVALID_VARIATION_KEY:"%s: Provided variation key is in an invalid format."},Qd={ACTIVATE_USER:"%s: Activating user %s in experiment %s.",DISPATCH_CONVERSION_EVENT:"%s: Dispatching conversion event to URL %s with params %s.",DISPATCH_IMPRESSION_EVENT:"%s: Dispatching impression event to URL %s with params %s.",DEPRECATED_EVENT_VALUE:"%s: Event value is deprecated in %s call.",EVENT_KEY_NOT_FOUND:"%s: Event key %s is not in datafile.",EXPERIMENT_NOT_RUNNING:"%s: Experiment %s is not running.",FEATURE_ENABLED_FOR_USER:"%s: Feature %s is enabled for user %s.",FEATURE_NOT_ENABLED_FOR_USER:"%s: Feature %s is not enabled for user %s.",FEATURE_HAS_NO_EXPERIMENTS:"%s: Feature %s is not attached to any experiments.",FAILED_TO_PARSE_VALUE:'%s: Failed to parse event value "%s" from event tags.',FAILED_TO_PARSE_REVENUE:'%s: Failed to parse revenue value "%s" from event tags.',FORCED_BUCKETING_FAILED:"%s: Variation key %s is not in datafile. Not activating user %s.",INVALID_OBJECT:"%s: Optimizely object is not valid. Failing %s.",INVALID_CLIENT_ENGINE:"%s: Invalid client engine passed: %s. Defaulting to node-sdk.",INVALID_DEFAULT_DECIDE_OPTIONS:"%s: Provided default decide options is not an array.",INVALID_DECIDE_OPTIONS:"%s: Provided decide options is not an array. Using default decide options.",INVALID_VARIATION_ID:"%s: Bucketed into an invalid variation ID. Returning null.",NOTIFICATION_LISTENER_EXCEPTION:"%s: Notification listener for (%s) threw exception: %s",NO_ROLLOUT_EXISTS:"%s: There is no rollout of feature %s.",NOT_ACTIVATING_USER:"%s: Not activating user %s for experiment %s.",NOT_TRACKING_USER:"%s: Not tracking user %s.",PARSED_REVENUE_VALUE:'%s: Parsed revenue value "%s" from event tags.',PARSED_NUMERIC_VALUE:'%s: Parsed event value "%s" from event tags.',RETURNING_STORED_VARIATION:'%s: Returning previously activated variation "%s" of experiment "%s" for user "%s" from user profile.',ROLLOUT_HAS_NO_EXPERIMENTS:"%s: Rollout of feature %s has no experiments",SAVED_VARIATION:'%s: Saved variation "%s" of experiment "%s" for user "%s".',SAVED_VARIATION_NOT_FOUND:"%s: User %s was previously bucketed into variation with ID %s for experiment %s, but no matching variation was found.",SHOULD_NOT_DISPATCH_ACTIVATE:'%s: Experiment %s is not in "Running" state. Not activating user.',SKIPPING_JSON_VALIDATION:"%s: Skipping JSON schema validation.",TRACK_EVENT:"%s: Tracking event %s for user %s.",UNRECOGNIZED_DECIDE_OPTION:"%s: Unrecognized decide option %s provided.",USER_ASSIGNED_TO_EXPERIMENT_BUCKET:"%s: Assigned bucket %s to user with bucketing ID %s.",USER_BUCKETED_INTO_EXPERIMENT_IN_GROUP:"%s: User %s is in experiment %s of group %s.",USER_BUCKETED_INTO_TARGETING_RULE:"%s: User %s bucketed into targeting rule %s.",USER_IN_FEATURE_EXPERIMENT:"%s: User %s is in variation %s of experiment %s on the feature %s.",USER_IN_ROLLOUT:"%s: User %s is in rollout of feature %s.",USER_NOT_BUCKETED_INTO_EVERYONE_TARGETING_RULE:"%s: User %s not bucketed into everyone targeting rule due to traffic allocation.",USER_NOT_BUCKETED_INTO_EXPERIMENT_IN_GROUP:"%s: User %s is not in experiment %s of group %s.",USER_NOT_BUCKETED_INTO_ANY_EXPERIMENT_IN_GROUP:"%s: User %s is not in any experiment of group %s.",USER_NOT_BUCKETED_INTO_TARGETING_RULE:"%s User %s not bucketed into targeting rule %s due to traffic allocation. Trying everyone rule.",USER_NOT_IN_FEATURE_EXPERIMENT:"%s: User %s is not in any experiment on the feature %s.",USER_NOT_IN_ROLLOUT:"%s: User %s is not in rollout of feature %s.",USER_FORCED_IN_VARIATION:"%s: User %s is forced in variation %s.",USER_MAPPED_TO_FORCED_VARIATION:"%s: Set variation %s for experiment %s and user %s in the forced variation map.",USER_DOESNT_MEET_CONDITIONS_FOR_TARGETING_RULE:"%s: User %s does not meet conditions for targeting rule %s.",USER_MEETS_CONDITIONS_FOR_TARGETING_RULE:"%s: User %s meets conditions for targeting rule %s.",USER_HAS_VARIATION:"%s: User %s is in variation %s of experiment %s.",USER_HAS_FORCED_DECISION_WITH_RULE_SPECIFIED:"Variation (%s) is mapped to flag (%s), rule (%s) and user (%s) in the forced decision map.",USER_HAS_FORCED_DECISION_WITH_NO_RULE_SPECIFIED:"Variation (%s) is mapped to flag (%s) and user (%s) in the forced decision map.",USER_HAS_FORCED_DECISION_WITH_RULE_SPECIFIED_BUT_INVALID:"Invalid variation is mapped to flag (%s), rule (%s) and user (%s) in the forced decision map.",USER_HAS_FORCED_DECISION_WITH_NO_RULE_SPECIFIED_BUT_INVALID:"Invalid variation is mapped to flag (%s) and user (%s) in the forced decision map.",USER_HAS_FORCED_VARIATION:"%s: Variation %s is mapped to experiment %s and user %s in the forced variation map.",USER_HAS_NO_VARIATION:"%s: User %s is in no variation of experiment %s.",USER_HAS_NO_FORCED_VARIATION:"%s: User %s is not in the forced variation map.",USER_HAS_NO_FORCED_VARIATION_FOR_EXPERIMENT:"%s: No experiment %s mapped to user %s in the forced variation map.",USER_NOT_IN_ANY_EXPERIMENT:"%s: User %s is not in any experiment of group %s.",USER_NOT_IN_EXPERIMENT:"%s: User %s does not meet conditions to be in experiment %s.",USER_RECEIVED_DEFAULT_VARIABLE_VALUE:'%s: User "%s" is not in any variation or rollout rule. Returning default value for variable "%s" of feature flag "%s".',FEATURE_NOT_ENABLED_RETURN_DEFAULT_VARIABLE_VALUE:'%s: Feature "%s" is not enabled for user %s. Returning the default variable value "%s".',VARIABLE_NOT_USED_RETURN_DEFAULT_VARIABLE_VALUE:'%s: Variable "%s" is not used in variation "%s". Returning default value.',USER_RECEIVED_VARIABLE_VALUE:'%s: Got variable value "%s" for variable "%s" of feature flag "%s"',VALID_DATAFILE:"%s: Datafile is valid.",VALID_USER_PROFILE_SERVICE:"%s: Valid user profile service provided.",VARIATION_REMOVED_FOR_USER:"%s: Variation mapped to experiment %s has been removed for user %s.",VARIABLE_REQUESTED_WITH_WRONG_TYPE:'%s: Requested variable type "%s", but variable is of type "%s". Use correct API to retrieve value. Returning None.',VALID_BUCKETING_ID:'%s: BucketingId is valid: "%s"',BUCKETING_ID_NOT_STRING:"%s: BucketingID attribute is not a string. Defaulted to userId",EVALUATING_AUDIENCE:'%s: Starting to evaluate audience "%s" with conditions: %s.',EVALUATING_AUDIENCES_COMBINED:'%s: Evaluating audiences for %s "%s": %s.',AUDIENCE_EVALUATION_RESULT:'%s: Audience "%s" evaluated to %s.',AUDIENCE_EVALUATION_RESULT_COMBINED:"%s: Audiences for %s %s collectively evaluated to %s.",MISSING_ATTRIBUTE_VALUE:'%s: Audience condition %s evaluated to UNKNOWN because no value was passed for user attribute "%s".',UNEXPECTED_CONDITION_VALUE:"%s: Audience condition %s evaluated to UNKNOWN because the condition value is not supported.",UNEXPECTED_TYPE:'%s: Audience condition %s evaluated to UNKNOWN because a value of type "%s" was passed for user attribute "%s".',UNEXPECTED_TYPE_NULL:'%s: Audience condition %s evaluated to UNKNOWN because a null value was passed for user attribute "%s".',UNKNOWN_CONDITION_TYPE:"%s: Audience condition %s has an unknown condition type. You may need to upgrade to a newer release of the Optimizely SDK.",UNKNOWN_MATCH_TYPE:"%s: Audience condition %s uses an unknown match type. You may need to upgrade to a newer release of the Optimizely SDK.",UPDATED_OPTIMIZELY_CONFIG:"%s: Updated Optimizely config to revision %s (project id %s)",OUT_OF_BOUNDS:'%s: Audience condition %s evaluated to UNKNOWN because the number value for user attribute "%s" is not in the range [-2^53, +2^53].',UNABLE_TO_ATTACH_UNLOAD:'%s: unable to bind optimizely.close() to page unload event: "%s"'},Zd={BOT_FILTERING:"$opt_bot_filtering",BUCKETING_ID:"$opt_bucketing_id",STICKY_BUCKETING_KEY:"$opt_experiment_bucket_map",USER_AGENT:"$opt_user_agent",FORCED_DECISION_NULL_RULE_KEY:"$opt_null_rule_key"},Xd="javascript-sdk",Jd="node-sdk",ef="react-sdk",tf="react-native-sdk",nf="react-native-js-sdk",rf="4.9.3",of="4.9.3",af={AB_TEST:"ab-test",FEATURE:"feature",FEATURE_TEST:"feature-test",FEATURE_VARIABLE:"feature-variable",ALL_FEATURE_VARIABLES:"all-feature-variables",FLAG:"flag"},sf={FEATURE_TEST:"feature-test",ROLLOUT:"rollout",EXPERIMENT:"experiment"},lf={RULE:"rule",EXPERIMENT:"experiment"},uf={BOOLEAN:"boolean",DOUBLE:"double",INTEGER:"integer",STRING:"string",JSON:"json"},sr={V2:"2",V3:"3",V4:"4"},cf={SDK_NOT_READY:"Optimizely SDK not configured properly yet.",FLAG_KEY_INVALID:'No flag was found for key "%s".',VARIABLE_VALUE_INVALID:'Variable value for key "%s" is invalid or wrong type.'},Ti;(function(e){e.ACTIVATE="ACTIVATE:experiment, user_id,attributes, variation, event",e.DECISION="DECISION:type, userId, attributes, decisionInfo",e.LOG_EVENT="LOG_EVENT:logEvent",e.OPTIMIZELY_CONFIG_UPDATE="OPTIMIZELY_CONFIG_UPDATE",e.TRACK="TRACK:event_key, user_id, attributes, event_tags, event"})(Ti||(Ti={}));var df=Object.freeze({__proto__:null,LOG_LEVEL:Wd,ERROR_MESSAGES:Yd,LOG_MESSAGES:Qd,CONTROL_ATTRIBUTES:Zd,JAVASCRIPT_CLIENT_ENGINE:Xd,NODE_CLIENT_ENGINE:Jd,REACT_CLIENT_ENGINE:ef,REACT_NATIVE_CLIENT_ENGINE:tf,REACT_NATIVE_JS_CLIENT_ENGINE:nf,BROWSER_CLIENT_VERSION:rf,NODE_CLIENT_VERSION:of,DECISION_NOTIFICATION_TYPES:af,DECISION_SOURCES:sf,AUDIENCE_EVALUATION_TYPES:lf,FEATURE_VARIABLE_TYPES:uf,DATAFILE_VERSIONS:sr,DECISION_MESSAGES:cf,get NOTIFICATION_TYPES(){return Ti}});sr.V2,sr.V3,sr.V4;(function(){function e(){}return e.prototype.log=function(){},e})();function ff(e){return new se.ConsoleLogHandler(e)}var Ea;(function(e){e.BOOLEAN="boolean",e.DOUBLE="double",e.INTEGER="integer",e.STRING="string",e.JSON="json"})(Ea||(Ea={}));var xa;(function(e){e.DISABLE_DECISION_EVENT="DISABLE_DECISION_EVENT",e.ENABLED_FLAGS_ONLY="ENABLED_FLAGS_ONLY",e.IGNORE_USER_PROFILE_SERVICE="IGNORE_USER_PROFILE_SERVICE",e.INCLUDE_REASONS="INCLUDE_REASONS",e.EXCLUDE_VARIABLES="EXCLUDE_VARIABLES"})(xa||(xa={}));se.getLogger();se.getLogger();se.getLogger();se.getLogger();se.getLogger("EVENT_BUILDER");se.getLogger();se.setLogHandler(ff());se.setLogLevel(se.LogLevel.INFO);let Jn;const pf=new Uint8Array(16);function hf(){if(!Jn&&(Jn=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!Jn))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Jn(pf)}const le=[];for(let e=0;e<256;++e)le.push((e+256).toString(16).slice(1));function vf(e,t=0){return(le[e[t+0]]+le[e[t+1]]+le[e[t+2]]+le[e[t+3]]+"-"+le[e[t+4]]+le[e[t+5]]+"-"+le[e[t+6]]+le[e[t+7]]+"-"+le[e[t+8]]+le[e[t+9]]+"-"+le[e[t+10]]+le[e[t+11]]+le[e[t+12]]+le[e[t+13]]+le[e[t+14]]+le[e[t+15]]).toLowerCase()}const mf=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),Sa={randomUUID:mf};function vt(e,t,n){if(Sa.randomUUID&&!t&&!e)return Sa.randomUUID();e=e||{};const r=e.random||(e.rng||hf)();if(r[6]=r[6]&15|64,r[8]=r[8]&63|128,t){n=n||0;for(let i=0;i<16;++i)t[n+i]=r[i];return t}return vf(r)}const qt="ul-app";var R=(e=>(e.Caption="ul-caption",e.CardContainer="ul-card__container",e.CardMainContent="ul-card-main-content",e.Choice="choice",e.ChoiceCheckbox="select-checkbox",e.ChoiceGroup="ul-card__choices",e.ChoiceLabel="select-label",e.ChoiceLabelContainer="choice-label-container",e.ChoiceRadio="select-radio",e.ChoiceTextEntryContainer="choice-text-entry-container",e.ChoiceTextInput="choice-text-input",e.CloseButton="close-btn",e.CloseContainer="close-container",e.ConsentLegalNameInput="ul-consent-legal__name-input",e.CustomStyle="ul-custom-style",e.DesktopSuffix="--desktop",e.FadeInTransition="fade-in-transition",e.LikertNumber="likert-number",e.LikertSmiley="likert-smiley",e.LikertStar="likert-star",e.LoadingSpinner="ul-loading-spinner",e.LoadingSpinnerContainer="ul-loading-spinner-container",e.LoadingSpinnerFirst="first",e.LoadingSpinnerFourth="fourth",e.LoadingSpinnerSecond="second",e.LoadingSpinnerThird="third",e.MobileSuffix="--mobile",e.NPSNumber="nps-number",e.OpenTextInput="ul-card-text__input",e.QuestionHeader="ul-question",e.VideoCard="ul-card--video",e.CheckmarkButton="ul-button-checkmark",e.InactiveButton="ul-button-inactive",e.LeftAlignButton="ul-button-left-align",e.ButtonDisabled="sprig-button-disabled",e))(R||{});const To="#e6e6e6",bn="#bd282a",gf=500,yf=1030;var _e=(e=>(e.Preview="sprig.previewKey",e.Credentials="userleap.ids",e.PageViews="userleap.pageviews",e))(_e||{});const Hs=()=>{try{return window.parent.Intercom}catch(e){return console.error(e),null}},_f=()=>{const e=Hs();!e||(e.ul_wasVisible&&e("update",{hide_default_launcher:!1}),delete e.ul_wasVisible)},wf=()=>{const e=Hs();!e||(e.ul_wasVisible=!!document.querySelector("iframe.intercom-launcher-frame"),e.ul_wasVisible&&e("update",{hide_default_launcher:!0}))},bf=Object.freeze(Object.defineProperty({__proto__:null,enable:_f,disable:wf},Symbol.toStringTag,{value:"Module"})),Ca=[bf];class Li{static disable(){Ca.forEach(t=>t.disable())}static enable(){Ca.forEach(t=>t.enable())}}const Ef=1,Xt=e=>e instanceof HTMLElement,xf=e=>e instanceof HTMLInputElement,En=e=>e instanceof HTMLTextAreaElement,Ks=(e,t,n)=>{const r=e.createElement("style");n&&(r.nonce=n),r.textContent=t,r.id=R.CustomStyle,e.head.appendChild(r)},$s=e=>{const t=e.querySelector(`.${R.CardContainer}`);let n=600,r=0;if(t){n=t.scrollHeight;const i=getComputedStyle(t),o=parseFloat(i.marginTop)+parseFloat(i.marginBottom),a=parseFloat(i.borderTopWidth)+parseFloat(i.borderBottomWidth);r=o+a}return n+r+Ef},Sf=e=>{const t=e.querySelector(`.${R.CardContainer}`);t&&(t.scrollTop=0)};var Gs={},Kr={},Fn={};Object.defineProperty(Fn,"__esModule",{value:!0});Fn.MemoryLeakError=void 0;class Cf extends Error{constructor(t,n,r){super(`Possible EventEmitter memory leak detected. ${r} ${n.toString()} listeners added. Use emitter.setMaxListeners() to increase limit`),this.emitter=t,this.type=n,this.count=r,this.name="MaxListenersExceededWarning"}}Fn.MemoryLeakError=Cf;Object.defineProperty(Kr,"__esModule",{value:!0});Kr.Emitter=void 0;const If=Fn;class $r{constructor(){this.events=new Map,this.maxListeners=$r.defaultMaxListeners,this.hasWarnedAboutPotentialMemoryLeak=!1}static listenerCount(t,n){return t.listenerCount(n)}_emitInternalEvent(t,n,r){this.emit(t,n,r)}_getListeners(t){return this.events.get(t)||[]}_removeListener(t,n){const r=t.indexOf(n);return r>-1&&t.splice(r,1),[]}_wrapOnceListener(t,n){const r=(...i)=>{this.removeListener(t,r),n.apply(this,i)};return r}setMaxListeners(t){return this.maxListeners=t,this}getMaxListeners(){return this.maxListeners}eventNames(){return Array.from(this.events.keys())}emit(t,...n){const r=this._getListeners(t);return r.forEach(i=>{i.apply(this,n)}),r.length>0}addListener(t,n){this._emitInternalEvent("newListener",t,n);const r=this._getListeners(t).concat(n);if(this.events.set(t,r),this.maxListeners>0&&this.listenerCount(t)>this.maxListeners&&!this.hasWarnedAboutPotentialMemoryLeak){this.hasWarnedAboutPotentialMemoryLeak=!0;const i=new If.MemoryLeakError(this,t,this.listenerCount(t));console.warn(i)}return this}on(t,n){return this.addListener(t,n)}once(t,n){return this.addListener(t,this._wrapOnceListener(t,n))}prependListener(t,n){const r=this._getListeners(t);if(r.length>0){const i=[n].concat(r);this.events.set(t,i)}else this.events.set(t,r.concat(n));return this}prependOnceListener(t,n){return this.prependListener(t,this._wrapOnceListener(t,n))}removeListener(t,n){const r=this._getListeners(t);return r.length>0&&(this._removeListener(r,n),this.events.set(t,r),this._emitInternalEvent("removeListener",t,n)),this}off(t,n){return this.removeListener(t,n)}removeAllListeners(t){return t?this.events.delete(t):this.events.clear(),this}listeners(t){return Array.from(this._getListeners(t))}listenerCount(t){return this._getListeners(t).length}rawListeners(t){return this.listeners(t)}}Kr.Emitter=$r;$r.defaultMaxListeners=10;(function(e){var t=z&&z.__createBinding||(Object.create?function(r,i,o,a){a===void 0&&(a=o);var s=Object.getOwnPropertyDescriptor(i,o);(!s||("get"in s?!i.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return i[o]}}),Object.defineProperty(r,a,s)}:function(r,i,o,a){a===void 0&&(a=o),r[a]=i[o]}),n=z&&z.__exportStar||function(r,i){for(var o in r)o!=="default"&&!Object.prototype.hasOwnProperty.call(i,o)&&t(i,r,o)};Object.defineProperty(e,"__esModule",{value:!0}),n(Kr,e),n(Fn,e)})(Gs);const q=new Gs.Emitter;var yn=(e=>(e.BottomLeft="bottomLeft",e.BottomRight="bottomRight",e.Center="center",e.TopLeft="topLeft",e.TopRight="topRight",e))(yn||{}),Ve=(e=>(e.Error="x-ul-error",e.EnvironmentID="x-ul-environment-id",e.InstallationMethod="x-ul-installation-method",e.PartnerAnonymousId="x-ul-anonymous-id",e.Platform="userleap-platform",e.PreviewMode="x-ul-preview-mode",e.UserID="x-ul-user-id",e.VisitorID="x-ul-visitor-id",e))(Ve||{}),Pt=(e=>(e.Email="email",e.Link="link",e.Web="web",e))(Pt||{}),ht=(e=>(e.Npm="web-npm",e.Gtm="web-gtm",e.Segment="web-segment",e.SegmentAndroid="android-segment",e.SegmentReactNative="react-native-segment",e.SegmentIOS="ios-segment",e.Snippet="web-snippet",e))(ht||{});const Cr=e=>new Promise(t=>{setTimeout(()=>{t()},e)}),zt=({"userleap-platform":e})=>e!==Pt.Web,re=(e,t)=>{const n=t?R.MobileSuffix:R.DesktopSuffix;return[e+n,e]},Ge=(e,t)=>[e,`${e}__${t}`];class kf{constructor(t){ce(this,"payload");ce(this,"promise");ce(this,"reject",()=>{});ce(this,"resolve",()=>{});this.payload=t,this.promise=new Promise((n,r)=>{this.reject=r,this.resolve=n})}resolveRequest(t){this.resolve(t)}}const Tf={RATELIMIT_RESET_DEFAULT:10};let qs=!1,zs="",er=!1,lr=[];const Lf=e=>e._config&&e._config.installationMethod?e._config.installationMethod:e._gtm?ht.Gtm:e._segment?ht.Segment:ht.Snippet,Ri=(e="")=>{qs=!0,zs=e};function Bn(e={}){const t={"Content-Type":"application/json","userleap-platform":Pt.Web,"x-ul-sdk-version":"2.23.3",[Ve.InstallationMethod]:Lf(e)};if(e.envId&&(t[Ve.EnvironmentID]=e.envId),e.token&&(t.Authorization="Bearer "+e.token),e.userId&&(t[Ve.UserID]=e.userId),e.visitorId&&(t[Ve.VisitorID]=e.visitorId),e.partnerAnonymousId&&(t[Ve.PartnerAnonymousId]=e.partnerAnonymousId),e.mobileHeadersJSON){const n=JSON.parse(e.mobileHeadersJSON);Object.assign(t,n)}return e.locale&&(t["accept-language"]=e.locale),window.previewMode&&(t[Ve.PreviewMode]="1"),t}const Ia=async(e,t,n)=>{if(e)return{status:429};{const r=new kf(n);return lr.push(r),r.promise}},He=async(e,t,n=0,r=!1,i=!1)=>{const o={url:e,options:t,attempt:n,shouldDropOnRateLimit:r};if(er&&!i)return Ia(r,i,o);const a={ok:!1,reportError:!1};if(qs)return console.info(`UserLeap - ${zs}`),a;try{t.headers=Object.assign(Bn(),t.headers);const s=await fetch(e,t);if(s.status===429)if(!er&&!r||i){er=!0;const u=s.headers.has("ratelimit-reset")?Number(s.headers.get("ratelimit-reset")):Tf.RATELIMIT_RESET_DEFAULT;return await Cr(u*1e3),He(e,t,0,r,!0)}else return Ia(r,!1,o);if(er=!1,lr.length&&(lr.map(l=>{const{url:u,options:c,attempt:f,shouldDropOnRateLimit:d}=l.payload;He(u,c,f,d).then(p=>{l.resolveRequest(p)})}),lr=[]),s.ok){if(s.status===249)return Ri(),a;const l=await s.text();try{return l&&l!=="OK"&&(s.json=JSON.parse(l)),s}catch{return{ok:!1,reportError:!1,error:new Error(`failed parsing response json for ${e} - ${l}`)}}}return s}catch(s){const l=n+1;return l>5?{ok:!1,reportError:!1,error:s}:(await Cr(Math.pow(2,n)*1e3),He(e,t,l))}};/*! *****************************************************************************
2
+ `),r={};return n.forEach(function(i){var o=i.indexOf(": ");if(o>-1){var a=i.slice(0,o),s=i.slice(o+2);s.length>0&&(r[a]=s)}}),r}function Ld(e,t){Object.keys(e).forEach(function(n){var r=e[n];t.setRequestHeader(n,r)})}function Rd(e,t){var n=new XMLHttpRequest,r=new Promise(function(i,o){n.open(Id,e,!0),Ld(t,n),n.onreadystatechange=function(){if(n.readyState===kd){var a=n.status;if(a===0){o(new Error("Request error"));return}var s=Td(n),l={statusCode:n.status,body:n.responseText,headers:s};i(l)}},n.timeout=xd.REQUEST_TIMEOUT_MS,n.ontimeout=function(){Cd.error("Request timed out")},n.send()});return{responsePromise:r,abort:function(){n.abort()}}}So.makeGetRequest=Rd;var Co={},Io={};Object.defineProperty(Io,"__esModule",{value:!0});var Ad=function(){function e(){this.listeners={},this.listenerId=1}return e.prototype.on=function(t,n){var r=this;this.listeners[t]||(this.listeners[t]={});var i=String(this.listenerId);return this.listenerId++,this.listeners[t][i]=n,function(){r.listeners[t]&&delete r.listeners[t][i]}},e.prototype.emit=function(t,n){var r=this.listeners[t];r&&Object.keys(r).forEach(function(i){var o=r[i];o(n)})},e.prototype.removeAllListeners=function(){this.listeners={}},e}();Io.default=Ad;var ko={};Object.defineProperty(ko,"__esModule",{value:!0});var ai=$e;function Od(){return Math.round(Math.random()*1e3)}var Ud=function(){function e(){this.errorCount=0}return e.prototype.getDelay=function(){if(this.errorCount===0)return 0;var t=ai.BACKOFF_BASE_WAIT_SECONDS_BY_ERROR_COUNT[Math.min(ai.BACKOFF_BASE_WAIT_SECONDS_BY_ERROR_COUNT.length-1,this.errorCount)];return t*1e3+Od()},e.prototype.countError=function(){this.errorCount<ai.BACKOFF_BASE_WAIT_SECONDS_BY_ERROR_COUNT.length-1&&this.errorCount++},e.prototype.reset=function(){this.errorCount=0},e}();ko.default=Ud;var Sr=z&&z.__assign||function(){return Sr=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++){t=arguments[n];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])}return e},Sr.apply(this,arguments)},Bs=z&&z.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Co,"__esModule",{value:!0});var Dd=se,Pd=sn,Nd=Bs(Io),gn=$e,Md=Bs(ko),xe=Dd.getLogger("DatafileManager"),jd="update";function Vd(e){return e>=gn.MIN_UPDATE_INTERVAL}function ba(e){return e>=200&&e<400}var Fd={get:function(){return Promise.resolve("")},set:function(){return Promise.resolve()},contains:function(){return Promise.resolve(!1)},remove:function(){return Promise.resolve()}},Bd=function(){function e(t){var n=this,r=Sr(Sr({},this.getConfigDefaults()),t),i=r.datafile,o=r.autoUpdate,a=o===void 0?!1:o,s=r.sdkKey,l=r.updateInterval,u=l===void 0?gn.DEFAULT_UPDATE_INTERVAL:l,c=r.urlTemplate,f=c===void 0?gn.DEFAULT_URL_TEMPLATE:c,d=r.cache,p=d===void 0?Fd:d;this.cache=p,this.cacheKey="opt-datafile-"+s,this.isReadyPromiseSettled=!1,this.readyPromiseResolver=function(){},this.readyPromiseRejecter=function(){},this.readyPromise=new Promise(function(h,v){n.readyPromiseResolver=h,n.readyPromiseRejecter=v}),i?(this.currentDatafile=i,s||this.resolveReadyPromise()):this.currentDatafile="",this.isStarted=!1,this.datafileUrl=Pd.sprintf(f,s),this.emitter=new Nd.default,this.autoUpdate=a,Vd(u)?this.updateInterval=u:(xe.warn("Invalid updateInterval %s, defaulting to %s",u,gn.DEFAULT_UPDATE_INTERVAL),this.updateInterval=gn.DEFAULT_UPDATE_INTERVAL),this.currentTimeout=null,this.currentRequest=null,this.backoffController=new Md.default,this.syncOnCurrentRequestComplete=!1}return e.prototype.get=function(){return this.currentDatafile},e.prototype.start=function(){this.isStarted||(xe.debug("Datafile manager started"),this.isStarted=!0,this.backoffController.reset(),this.setDatafileFromCacheIfAvailable(),this.syncDatafile())},e.prototype.stop=function(){return xe.debug("Datafile manager stopped"),this.isStarted=!1,this.currentTimeout&&(clearTimeout(this.currentTimeout),this.currentTimeout=null),this.emitter.removeAllListeners(),this.currentRequest&&(this.currentRequest.abort(),this.currentRequest=null),Promise.resolve()},e.prototype.onReady=function(){return this.readyPromise},e.prototype.on=function(t,n){return this.emitter.on(t,n)},e.prototype.onRequestRejected=function(t){!this.isStarted||(this.backoffController.countError(),t instanceof Error?xe.error("Error fetching datafile: %s",t.message,t):typeof t=="string"?xe.error("Error fetching datafile: %s",t):xe.error("Error fetching datafile"))},e.prototype.onRequestResolved=function(t){if(!!this.isStarted){typeof t.statusCode<"u"&&ba(t.statusCode)?this.backoffController.reset():this.backoffController.countError(),this.trySavingLastModified(t.headers);var n=this.getNextDatafileFromResponse(t);if(n!=="")if(xe.info("Updating datafile from response"),this.currentDatafile=n,this.cache.set(this.cacheKey,n),!this.isReadyPromiseSettled)this.resolveReadyPromise();else{var r={datafile:n};this.emitter.emit(jd,r)}}},e.prototype.onRequestComplete=function(){!this.isStarted||(this.currentRequest=null,!this.isReadyPromiseSettled&&!this.autoUpdate&&this.rejectReadyPromise(new Error("Failed to become ready")),this.autoUpdate&&this.syncOnCurrentRequestComplete&&this.syncDatafile(),this.syncOnCurrentRequestComplete=!1)},e.prototype.syncDatafile=function(){var t=this,n={};this.lastResponseLastModified&&(n["if-modified-since"]=this.lastResponseLastModified),xe.debug("Making datafile request to url %s with headers: %s",this.datafileUrl,function(){return JSON.stringify(n)}),this.currentRequest=this.makeGetRequest(this.datafileUrl,n);var r=function(){t.onRequestComplete()},i=function(a){t.onRequestResolved(a)},o=function(a){t.onRequestRejected(a)};this.currentRequest.responsePromise.then(i,o).then(r,r),this.autoUpdate&&this.scheduleNextUpdate()},e.prototype.resolveReadyPromise=function(){this.readyPromiseResolver(),this.isReadyPromiseSettled=!0},e.prototype.rejectReadyPromise=function(t){this.readyPromiseRejecter(t),this.isReadyPromiseSettled=!0},e.prototype.scheduleNextUpdate=function(){var t=this,n=this.backoffController.getDelay(),r=Math.max(n,this.updateInterval);xe.debug("Scheduling sync in %s ms",r),this.currentTimeout=setTimeout(function(){t.currentRequest?t.syncOnCurrentRequestComplete=!0:t.syncDatafile()},r)},e.prototype.getNextDatafileFromResponse=function(t){return xe.debug("Response status code: %s",t.statusCode),typeof t.statusCode>"u"||t.statusCode===304?"":ba(t.statusCode)?t.body:""},e.prototype.trySavingLastModified=function(t){var n=t["last-modified"]||t["Last-Modified"];typeof n<"u"&&(this.lastResponseLastModified=n,xe.debug("Saved last modified header value from response: %s",this.lastResponseLastModified))},e.prototype.setDatafileFromCacheIfAvailable=function(){var t=this;this.cache.get(this.cacheKey).then(function(n){t.isStarted&&!t.isReadyPromiseSettled&&n!==""&&(xe.debug("Using datafile from cache"),t.currentDatafile=n,t.resolveReadyPromise())})},e}();Co.default=Bd;var Hd=z&&z.__extends||function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,i){r.__proto__=i}||function(r,i){for(var o in i)i.hasOwnProperty(o)&&(r[o]=i[o])},e(t,n)};return function(t,n){e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}(),Kd=z&&z.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(xo,"__esModule",{value:!0});var $d=So,Gd=Kd(Co),qd=function(e){Hd(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.makeGetRequest=function(n,r){return $d.makeGetRequest(n,r)},t.prototype.getConfigDefaults=function(){return{autoUpdate:!1}},t}(Gd.default);xo.default=qd;Object.defineProperty(Fs,"__esModule",{value:!0});var zd=xo;Fs.HttpPollingDatafileManager=zd.default;var Wd={NOTSET:0,DEBUG:1,INFO:2,WARNING:3,ERROR:4},Yd={CONDITION_EVALUATOR_ERROR:"%s: Error evaluating audience condition of type %s: %s",DATAFILE_AND_SDK_KEY_MISSING:"%s: You must provide at least one of sdkKey or datafile. Cannot start Optimizely",EXPERIMENT_KEY_NOT_IN_DATAFILE:"%s: Experiment key %s is not in datafile.",FEATURE_NOT_IN_DATAFILE:"%s: Feature key %s is not in datafile.",IMPROPERLY_FORMATTED_EXPERIMENT:"%s: Experiment key %s is improperly formatted.",INVALID_ATTRIBUTES:"%s: Provided attributes are in an invalid format.",INVALID_BUCKETING_ID:"%s: Unable to generate hash for bucketing ID %s: %s",INVALID_DATAFILE:"%s: Datafile is invalid - property %s: %s",INVALID_DATAFILE_MALFORMED:"%s: Datafile is invalid because it is malformed.",INVALID_CONFIG:"%s: Provided Optimizely config is in an invalid format.",INVALID_JSON:"%s: JSON object is not valid.",INVALID_ERROR_HANDLER:'%s: Provided "errorHandler" is in an invalid format.',INVALID_EVENT_DISPATCHER:'%s: Provided "eventDispatcher" is in an invalid format.',INVALID_EVENT_TAGS:"%s: Provided event tags are in an invalid format.",INVALID_EXPERIMENT_KEY:"%s: Experiment key %s is not in datafile. It is either invalid, paused, or archived.",INVALID_EXPERIMENT_ID:"%s: Experiment ID %s is not in datafile.",INVALID_GROUP_ID:"%s: Group ID %s is not in datafile.",INVALID_LOGGER:'%s: Provided "logger" is in an invalid format.',INVALID_ROLLOUT_ID:"%s: Invalid rollout ID %s attached to feature %s",INVALID_USER_ID:"%s: Provided user ID is in an invalid format.",INVALID_USER_PROFILE_SERVICE:"%s: Provided user profile service instance is in an invalid format: %s.",NO_DATAFILE_SPECIFIED:"%s: No datafile specified. Cannot start optimizely.",NO_JSON_PROVIDED:"%s: No JSON object to validate against schema.",NO_VARIATION_FOR_EXPERIMENT_KEY:"%s: No variation key %s defined in datafile for experiment %s.",UNDEFINED_ATTRIBUTE:"%s: Provided attribute: %s has an undefined value.",UNRECOGNIZED_ATTRIBUTE:"%s: Unrecognized attribute %s provided. Pruning before sending event to Optimizely.",UNABLE_TO_CAST_VALUE:"%s: Unable to cast value %s to type %s, returning null.",USER_NOT_IN_FORCED_VARIATION:"%s: User %s is not in the forced variation map. Cannot remove their forced variation.",USER_PROFILE_LOOKUP_ERROR:'%s: Error while looking up user profile for user ID "%s": %s.',USER_PROFILE_SAVE_ERROR:'%s: Error while saving user profile for user ID "%s": %s.',VARIABLE_KEY_NOT_IN_DATAFILE:'%s: Variable with key "%s" associated with feature with key "%s" is not in datafile.',VARIATION_ID_NOT_IN_DATAFILE:"%s: No variation ID %s defined in datafile for experiment %s.",VARIATION_ID_NOT_IN_DATAFILE_NO_EXPERIMENT:"%s: Variation ID %s is not in the datafile.",INVALID_INPUT_FORMAT:"%s: Provided %s is in an invalid format.",INVALID_DATAFILE_VERSION:"%s: This version of the JavaScript SDK does not support the given datafile version: %s",INVALID_VARIATION_KEY:"%s: Provided variation key is in an invalid format."},Qd={ACTIVATE_USER:"%s: Activating user %s in experiment %s.",DISPATCH_CONVERSION_EVENT:"%s: Dispatching conversion event to URL %s with params %s.",DISPATCH_IMPRESSION_EVENT:"%s: Dispatching impression event to URL %s with params %s.",DEPRECATED_EVENT_VALUE:"%s: Event value is deprecated in %s call.",EVENT_KEY_NOT_FOUND:"%s: Event key %s is not in datafile.",EXPERIMENT_NOT_RUNNING:"%s: Experiment %s is not running.",FEATURE_ENABLED_FOR_USER:"%s: Feature %s is enabled for user %s.",FEATURE_NOT_ENABLED_FOR_USER:"%s: Feature %s is not enabled for user %s.",FEATURE_HAS_NO_EXPERIMENTS:"%s: Feature %s is not attached to any experiments.",FAILED_TO_PARSE_VALUE:'%s: Failed to parse event value "%s" from event tags.',FAILED_TO_PARSE_REVENUE:'%s: Failed to parse revenue value "%s" from event tags.',FORCED_BUCKETING_FAILED:"%s: Variation key %s is not in datafile. Not activating user %s.",INVALID_OBJECT:"%s: Optimizely object is not valid. Failing %s.",INVALID_CLIENT_ENGINE:"%s: Invalid client engine passed: %s. Defaulting to node-sdk.",INVALID_DEFAULT_DECIDE_OPTIONS:"%s: Provided default decide options is not an array.",INVALID_DECIDE_OPTIONS:"%s: Provided decide options is not an array. Using default decide options.",INVALID_VARIATION_ID:"%s: Bucketed into an invalid variation ID. Returning null.",NOTIFICATION_LISTENER_EXCEPTION:"%s: Notification listener for (%s) threw exception: %s",NO_ROLLOUT_EXISTS:"%s: There is no rollout of feature %s.",NOT_ACTIVATING_USER:"%s: Not activating user %s for experiment %s.",NOT_TRACKING_USER:"%s: Not tracking user %s.",PARSED_REVENUE_VALUE:'%s: Parsed revenue value "%s" from event tags.',PARSED_NUMERIC_VALUE:'%s: Parsed event value "%s" from event tags.',RETURNING_STORED_VARIATION:'%s: Returning previously activated variation "%s" of experiment "%s" for user "%s" from user profile.',ROLLOUT_HAS_NO_EXPERIMENTS:"%s: Rollout of feature %s has no experiments",SAVED_VARIATION:'%s: Saved variation "%s" of experiment "%s" for user "%s".',SAVED_VARIATION_NOT_FOUND:"%s: User %s was previously bucketed into variation with ID %s for experiment %s, but no matching variation was found.",SHOULD_NOT_DISPATCH_ACTIVATE:'%s: Experiment %s is not in "Running" state. Not activating user.',SKIPPING_JSON_VALIDATION:"%s: Skipping JSON schema validation.",TRACK_EVENT:"%s: Tracking event %s for user %s.",UNRECOGNIZED_DECIDE_OPTION:"%s: Unrecognized decide option %s provided.",USER_ASSIGNED_TO_EXPERIMENT_BUCKET:"%s: Assigned bucket %s to user with bucketing ID %s.",USER_BUCKETED_INTO_EXPERIMENT_IN_GROUP:"%s: User %s is in experiment %s of group %s.",USER_BUCKETED_INTO_TARGETING_RULE:"%s: User %s bucketed into targeting rule %s.",USER_IN_FEATURE_EXPERIMENT:"%s: User %s is in variation %s of experiment %s on the feature %s.",USER_IN_ROLLOUT:"%s: User %s is in rollout of feature %s.",USER_NOT_BUCKETED_INTO_EVERYONE_TARGETING_RULE:"%s: User %s not bucketed into everyone targeting rule due to traffic allocation.",USER_NOT_BUCKETED_INTO_EXPERIMENT_IN_GROUP:"%s: User %s is not in experiment %s of group %s.",USER_NOT_BUCKETED_INTO_ANY_EXPERIMENT_IN_GROUP:"%s: User %s is not in any experiment of group %s.",USER_NOT_BUCKETED_INTO_TARGETING_RULE:"%s User %s not bucketed into targeting rule %s due to traffic allocation. Trying everyone rule.",USER_NOT_IN_FEATURE_EXPERIMENT:"%s: User %s is not in any experiment on the feature %s.",USER_NOT_IN_ROLLOUT:"%s: User %s is not in rollout of feature %s.",USER_FORCED_IN_VARIATION:"%s: User %s is forced in variation %s.",USER_MAPPED_TO_FORCED_VARIATION:"%s: Set variation %s for experiment %s and user %s in the forced variation map.",USER_DOESNT_MEET_CONDITIONS_FOR_TARGETING_RULE:"%s: User %s does not meet conditions for targeting rule %s.",USER_MEETS_CONDITIONS_FOR_TARGETING_RULE:"%s: User %s meets conditions for targeting rule %s.",USER_HAS_VARIATION:"%s: User %s is in variation %s of experiment %s.",USER_HAS_FORCED_DECISION_WITH_RULE_SPECIFIED:"Variation (%s) is mapped to flag (%s), rule (%s) and user (%s) in the forced decision map.",USER_HAS_FORCED_DECISION_WITH_NO_RULE_SPECIFIED:"Variation (%s) is mapped to flag (%s) and user (%s) in the forced decision map.",USER_HAS_FORCED_DECISION_WITH_RULE_SPECIFIED_BUT_INVALID:"Invalid variation is mapped to flag (%s), rule (%s) and user (%s) in the forced decision map.",USER_HAS_FORCED_DECISION_WITH_NO_RULE_SPECIFIED_BUT_INVALID:"Invalid variation is mapped to flag (%s) and user (%s) in the forced decision map.",USER_HAS_FORCED_VARIATION:"%s: Variation %s is mapped to experiment %s and user %s in the forced variation map.",USER_HAS_NO_VARIATION:"%s: User %s is in no variation of experiment %s.",USER_HAS_NO_FORCED_VARIATION:"%s: User %s is not in the forced variation map.",USER_HAS_NO_FORCED_VARIATION_FOR_EXPERIMENT:"%s: No experiment %s mapped to user %s in the forced variation map.",USER_NOT_IN_ANY_EXPERIMENT:"%s: User %s is not in any experiment of group %s.",USER_NOT_IN_EXPERIMENT:"%s: User %s does not meet conditions to be in experiment %s.",USER_RECEIVED_DEFAULT_VARIABLE_VALUE:'%s: User "%s" is not in any variation or rollout rule. Returning default value for variable "%s" of feature flag "%s".',FEATURE_NOT_ENABLED_RETURN_DEFAULT_VARIABLE_VALUE:'%s: Feature "%s" is not enabled for user %s. Returning the default variable value "%s".',VARIABLE_NOT_USED_RETURN_DEFAULT_VARIABLE_VALUE:'%s: Variable "%s" is not used in variation "%s". Returning default value.',USER_RECEIVED_VARIABLE_VALUE:'%s: Got variable value "%s" for variable "%s" of feature flag "%s"',VALID_DATAFILE:"%s: Datafile is valid.",VALID_USER_PROFILE_SERVICE:"%s: Valid user profile service provided.",VARIATION_REMOVED_FOR_USER:"%s: Variation mapped to experiment %s has been removed for user %s.",VARIABLE_REQUESTED_WITH_WRONG_TYPE:'%s: Requested variable type "%s", but variable is of type "%s". Use correct API to retrieve value. Returning None.',VALID_BUCKETING_ID:'%s: BucketingId is valid: "%s"',BUCKETING_ID_NOT_STRING:"%s: BucketingID attribute is not a string. Defaulted to userId",EVALUATING_AUDIENCE:'%s: Starting to evaluate audience "%s" with conditions: %s.',EVALUATING_AUDIENCES_COMBINED:'%s: Evaluating audiences for %s "%s": %s.',AUDIENCE_EVALUATION_RESULT:'%s: Audience "%s" evaluated to %s.',AUDIENCE_EVALUATION_RESULT_COMBINED:"%s: Audiences for %s %s collectively evaluated to %s.",MISSING_ATTRIBUTE_VALUE:'%s: Audience condition %s evaluated to UNKNOWN because no value was passed for user attribute "%s".',UNEXPECTED_CONDITION_VALUE:"%s: Audience condition %s evaluated to UNKNOWN because the condition value is not supported.",UNEXPECTED_TYPE:'%s: Audience condition %s evaluated to UNKNOWN because a value of type "%s" was passed for user attribute "%s".',UNEXPECTED_TYPE_NULL:'%s: Audience condition %s evaluated to UNKNOWN because a null value was passed for user attribute "%s".',UNKNOWN_CONDITION_TYPE:"%s: Audience condition %s has an unknown condition type. You may need to upgrade to a newer release of the Optimizely SDK.",UNKNOWN_MATCH_TYPE:"%s: Audience condition %s uses an unknown match type. You may need to upgrade to a newer release of the Optimizely SDK.",UPDATED_OPTIMIZELY_CONFIG:"%s: Updated Optimizely config to revision %s (project id %s)",OUT_OF_BOUNDS:'%s: Audience condition %s evaluated to UNKNOWN because the number value for user attribute "%s" is not in the range [-2^53, +2^53].',UNABLE_TO_ATTACH_UNLOAD:'%s: unable to bind optimizely.close() to page unload event: "%s"'},Zd={BOT_FILTERING:"$opt_bot_filtering",BUCKETING_ID:"$opt_bucketing_id",STICKY_BUCKETING_KEY:"$opt_experiment_bucket_map",USER_AGENT:"$opt_user_agent",FORCED_DECISION_NULL_RULE_KEY:"$opt_null_rule_key"},Xd="javascript-sdk",Jd="node-sdk",ef="react-sdk",tf="react-native-sdk",nf="react-native-js-sdk",rf="4.9.3",of="4.9.3",af={AB_TEST:"ab-test",FEATURE:"feature",FEATURE_TEST:"feature-test",FEATURE_VARIABLE:"feature-variable",ALL_FEATURE_VARIABLES:"all-feature-variables",FLAG:"flag"},sf={FEATURE_TEST:"feature-test",ROLLOUT:"rollout",EXPERIMENT:"experiment"},lf={RULE:"rule",EXPERIMENT:"experiment"},uf={BOOLEAN:"boolean",DOUBLE:"double",INTEGER:"integer",STRING:"string",JSON:"json"},sr={V2:"2",V3:"3",V4:"4"},cf={SDK_NOT_READY:"Optimizely SDK not configured properly yet.",FLAG_KEY_INVALID:'No flag was found for key "%s".',VARIABLE_VALUE_INVALID:'Variable value for key "%s" is invalid or wrong type.'},Ti;(function(e){e.ACTIVATE="ACTIVATE:experiment, user_id,attributes, variation, event",e.DECISION="DECISION:type, userId, attributes, decisionInfo",e.LOG_EVENT="LOG_EVENT:logEvent",e.OPTIMIZELY_CONFIG_UPDATE="OPTIMIZELY_CONFIG_UPDATE",e.TRACK="TRACK:event_key, user_id, attributes, event_tags, event"})(Ti||(Ti={}));var df=Object.freeze({__proto__:null,LOG_LEVEL:Wd,ERROR_MESSAGES:Yd,LOG_MESSAGES:Qd,CONTROL_ATTRIBUTES:Zd,JAVASCRIPT_CLIENT_ENGINE:Xd,NODE_CLIENT_ENGINE:Jd,REACT_CLIENT_ENGINE:ef,REACT_NATIVE_CLIENT_ENGINE:tf,REACT_NATIVE_JS_CLIENT_ENGINE:nf,BROWSER_CLIENT_VERSION:rf,NODE_CLIENT_VERSION:of,DECISION_NOTIFICATION_TYPES:af,DECISION_SOURCES:sf,AUDIENCE_EVALUATION_TYPES:lf,FEATURE_VARIABLE_TYPES:uf,DATAFILE_VERSIONS:sr,DECISION_MESSAGES:cf,get NOTIFICATION_TYPES(){return Ti}});sr.V2,sr.V3,sr.V4;(function(){function e(){}return e.prototype.log=function(){},e})();function ff(e){return new se.ConsoleLogHandler(e)}var Ea;(function(e){e.BOOLEAN="boolean",e.DOUBLE="double",e.INTEGER="integer",e.STRING="string",e.JSON="json"})(Ea||(Ea={}));var xa;(function(e){e.DISABLE_DECISION_EVENT="DISABLE_DECISION_EVENT",e.ENABLED_FLAGS_ONLY="ENABLED_FLAGS_ONLY",e.IGNORE_USER_PROFILE_SERVICE="IGNORE_USER_PROFILE_SERVICE",e.INCLUDE_REASONS="INCLUDE_REASONS",e.EXCLUDE_VARIABLES="EXCLUDE_VARIABLES"})(xa||(xa={}));se.getLogger();se.getLogger();se.getLogger();se.getLogger();se.getLogger("EVENT_BUILDER");se.getLogger();se.setLogHandler(ff());se.setLogLevel(se.LogLevel.INFO);let Jn;const pf=new Uint8Array(16);function hf(){if(!Jn&&(Jn=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!Jn))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Jn(pf)}const le=[];for(let e=0;e<256;++e)le.push((e+256).toString(16).slice(1));function vf(e,t=0){return(le[e[t+0]]+le[e[t+1]]+le[e[t+2]]+le[e[t+3]]+"-"+le[e[t+4]]+le[e[t+5]]+"-"+le[e[t+6]]+le[e[t+7]]+"-"+le[e[t+8]]+le[e[t+9]]+"-"+le[e[t+10]]+le[e[t+11]]+le[e[t+12]]+le[e[t+13]]+le[e[t+14]]+le[e[t+15]]).toLowerCase()}const mf=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),Sa={randomUUID:mf};function vt(e,t,n){if(Sa.randomUUID&&!t&&!e)return Sa.randomUUID();e=e||{};const r=e.random||(e.rng||hf)();if(r[6]=r[6]&15|64,r[8]=r[8]&63|128,t){n=n||0;for(let i=0;i<16;++i)t[n+i]=r[i];return t}return vf(r)}const qt="ul-app";var R=(e=>(e.Caption="ul-caption",e.CardContainer="ul-card__container",e.CardMainContent="ul-card-main-content",e.Choice="choice",e.ChoiceCheckbox="select-checkbox",e.ChoiceGroup="ul-card__choices",e.ChoiceLabel="select-label",e.ChoiceLabelContainer="choice-label-container",e.ChoiceRadio="select-radio",e.ChoiceTextEntryContainer="choice-text-entry-container",e.ChoiceTextInput="choice-text-input",e.CloseButton="close-btn",e.CloseContainer="close-container",e.ConsentLegalNameInput="ul-consent-legal__name-input",e.CustomStyle="ul-custom-style",e.DesktopSuffix="--desktop",e.FadeInTransition="fade-in-transition",e.LikertNumber="likert-number",e.LikertSmiley="likert-smiley",e.LikertStar="likert-star",e.LoadingSpinner="ul-loading-spinner",e.LoadingSpinnerContainer="ul-loading-spinner-container",e.LoadingSpinnerFirst="first",e.LoadingSpinnerFourth="fourth",e.LoadingSpinnerSecond="second",e.LoadingSpinnerThird="third",e.MobileSuffix="--mobile",e.NPSNumber="nps-number",e.OpenTextInput="ul-card-text__input",e.QuestionHeader="ul-question",e.VideoCard="ul-card--video",e.CheckmarkButton="ul-button-checkmark",e.InactiveButton="ul-button-inactive",e.LeftAlignButton="ul-button-left-align",e.ButtonDisabled="sprig-button-disabled",e))(R||{});const To="#e6e6e6",bn="#bd282a",gf=500,yf=1030;var _e=(e=>(e.Preview="sprig.previewKey",e.Credentials="userleap.ids",e.PageViews="userleap.pageviews",e))(_e||{});const Hs=()=>{try{return window.parent.Intercom}catch(e){return console.error(e),null}},_f=()=>{const e=Hs();!e||(e.ul_wasVisible&&e("update",{hide_default_launcher:!1}),delete e.ul_wasVisible)},wf=()=>{const e=Hs();!e||(e.ul_wasVisible=!!document.querySelector("iframe.intercom-launcher-frame"),e.ul_wasVisible&&e("update",{hide_default_launcher:!0}))},bf=Object.freeze(Object.defineProperty({__proto__:null,enable:_f,disable:wf},Symbol.toStringTag,{value:"Module"})),Ca=[bf];class Li{static disable(){Ca.forEach(t=>t.disable())}static enable(){Ca.forEach(t=>t.enable())}}const Ef=1,Xt=e=>e instanceof HTMLElement,xf=e=>e instanceof HTMLInputElement,En=e=>e instanceof HTMLTextAreaElement,Ks=(e,t,n)=>{const r=e.createElement("style");n&&(r.nonce=n),r.textContent=t,r.id=R.CustomStyle,e.head.appendChild(r)},$s=e=>{const t=e.querySelector(`.${R.CardContainer}`);let n=600,r=0;if(t){n=t.scrollHeight;const i=getComputedStyle(t),o=parseFloat(i.marginTop)+parseFloat(i.marginBottom),a=parseFloat(i.borderTopWidth)+parseFloat(i.borderBottomWidth);r=o+a}return n+r+Ef},Sf=e=>{const t=e.querySelector(`.${R.CardContainer}`);t&&(t.scrollTop=0)};var Gs={},Kr={},Fn={};Object.defineProperty(Fn,"__esModule",{value:!0});Fn.MemoryLeakError=void 0;class Cf extends Error{constructor(t,n,r){super(`Possible EventEmitter memory leak detected. ${r} ${n.toString()} listeners added. Use emitter.setMaxListeners() to increase limit`),this.emitter=t,this.type=n,this.count=r,this.name="MaxListenersExceededWarning"}}Fn.MemoryLeakError=Cf;Object.defineProperty(Kr,"__esModule",{value:!0});Kr.Emitter=void 0;const If=Fn;class $r{constructor(){this.events=new Map,this.maxListeners=$r.defaultMaxListeners,this.hasWarnedAboutPotentialMemoryLeak=!1}static listenerCount(t,n){return t.listenerCount(n)}_emitInternalEvent(t,n,r){this.emit(t,n,r)}_getListeners(t){return this.events.get(t)||[]}_removeListener(t,n){const r=t.indexOf(n);return r>-1&&t.splice(r,1),[]}_wrapOnceListener(t,n){const r=(...i)=>{this.removeListener(t,r),n.apply(this,i)};return r}setMaxListeners(t){return this.maxListeners=t,this}getMaxListeners(){return this.maxListeners}eventNames(){return Array.from(this.events.keys())}emit(t,...n){const r=this._getListeners(t);return r.forEach(i=>{i.apply(this,n)}),r.length>0}addListener(t,n){this._emitInternalEvent("newListener",t,n);const r=this._getListeners(t).concat(n);if(this.events.set(t,r),this.maxListeners>0&&this.listenerCount(t)>this.maxListeners&&!this.hasWarnedAboutPotentialMemoryLeak){this.hasWarnedAboutPotentialMemoryLeak=!0;const i=new If.MemoryLeakError(this,t,this.listenerCount(t));console.warn(i)}return this}on(t,n){return this.addListener(t,n)}once(t,n){return this.addListener(t,this._wrapOnceListener(t,n))}prependListener(t,n){const r=this._getListeners(t);if(r.length>0){const i=[n].concat(r);this.events.set(t,i)}else this.events.set(t,r.concat(n));return this}prependOnceListener(t,n){return this.prependListener(t,this._wrapOnceListener(t,n))}removeListener(t,n){const r=this._getListeners(t);return r.length>0&&(this._removeListener(r,n),this.events.set(t,r),this._emitInternalEvent("removeListener",t,n)),this}off(t,n){return this.removeListener(t,n)}removeAllListeners(t){return t?this.events.delete(t):this.events.clear(),this}listeners(t){return Array.from(this._getListeners(t))}listenerCount(t){return this._getListeners(t).length}rawListeners(t){return this.listeners(t)}}Kr.Emitter=$r;$r.defaultMaxListeners=10;(function(e){var t=z&&z.__createBinding||(Object.create?function(r,i,o,a){a===void 0&&(a=o);var s=Object.getOwnPropertyDescriptor(i,o);(!s||("get"in s?!i.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return i[o]}}),Object.defineProperty(r,a,s)}:function(r,i,o,a){a===void 0&&(a=o),r[a]=i[o]}),n=z&&z.__exportStar||function(r,i){for(var o in r)o!=="default"&&!Object.prototype.hasOwnProperty.call(i,o)&&t(i,r,o)};Object.defineProperty(e,"__esModule",{value:!0}),n(Kr,e),n(Fn,e)})(Gs);const q=new Gs.Emitter;var yn=(e=>(e.BottomLeft="bottomLeft",e.BottomRight="bottomRight",e.Center="center",e.TopLeft="topLeft",e.TopRight="topRight",e))(yn||{}),Ve=(e=>(e.Error="x-ul-error",e.EnvironmentID="x-ul-environment-id",e.InstallationMethod="x-ul-installation-method",e.PartnerAnonymousId="x-ul-anonymous-id",e.Platform="userleap-platform",e.PreviewMode="x-ul-preview-mode",e.UserID="x-ul-user-id",e.VisitorID="x-ul-visitor-id",e))(Ve||{}),Pt=(e=>(e.Email="email",e.Link="link",e.Web="web",e))(Pt||{}),ht=(e=>(e.Npm="web-npm",e.Gtm="web-gtm",e.Segment="web-segment",e.SegmentAndroid="android-segment",e.SegmentReactNative="react-native-segment",e.SegmentIOS="ios-segment",e.Snippet="web-snippet",e))(ht||{});const Cr=e=>new Promise(t=>{setTimeout(()=>{t()},e)}),zt=({"userleap-platform":e})=>e!==Pt.Web,re=(e,t)=>{const n=t?R.MobileSuffix:R.DesktopSuffix;return[e+n,e]},Ge=(e,t)=>[e,`${e}__${t}`];class kf{constructor(t){ce(this,"payload");ce(this,"promise");ce(this,"reject",()=>{});ce(this,"resolve",()=>{});this.payload=t,this.promise=new Promise((n,r)=>{this.reject=r,this.resolve=n})}resolveRequest(t){this.resolve(t)}}const Tf={RATELIMIT_RESET_DEFAULT:10};let qs=!1,zs="",er=!1,lr=[];const Lf=e=>e._config&&e._config.installationMethod?e._config.installationMethod:e._gtm?ht.Gtm:e._segment?ht.Segment:ht.Snippet,Ri=(e="")=>{qs=!0,zs=e};function Bn(e={}){const t={"Content-Type":"application/json","userleap-platform":Pt.Web,"x-ul-sdk-version":"2.23.4",[Ve.InstallationMethod]:Lf(e)};if(e.envId&&(t[Ve.EnvironmentID]=e.envId),e.token&&(t.Authorization="Bearer "+e.token),e.userId&&(t[Ve.UserID]=e.userId),e.visitorId&&(t[Ve.VisitorID]=e.visitorId),e.partnerAnonymousId&&(t[Ve.PartnerAnonymousId]=e.partnerAnonymousId),e.mobileHeadersJSON){const n=JSON.parse(e.mobileHeadersJSON);Object.assign(t,n)}return e.locale&&(t["accept-language"]=e.locale),window.previewMode&&(t[Ve.PreviewMode]="1"),t}const Ia=async(e,t,n)=>{if(e)return{status:429};{const r=new kf(n);return lr.push(r),r.promise}},He=async(e,t,n=0,r=!1,i=!1)=>{const o={url:e,options:t,attempt:n,shouldDropOnRateLimit:r};if(er&&!i)return Ia(r,i,o);const a={ok:!1,reportError:!1};if(qs)return console.info(`UserLeap - ${zs}`),a;try{t.headers=Object.assign(Bn(),t.headers);const s=await fetch(e,t);if(s.status===429)if(!er&&!r||i){er=!0;const u=s.headers.has("ratelimit-reset")?Number(s.headers.get("ratelimit-reset")):Tf.RATELIMIT_RESET_DEFAULT;return await Cr(u*1e3),He(e,t,0,r,!0)}else return Ia(r,!1,o);if(er=!1,lr.length&&(lr.map(l=>{const{url:u,options:c,attempt:f,shouldDropOnRateLimit:d}=l.payload;He(u,c,f,d).then(p=>{l.resolveRequest(p)})}),lr=[]),s.ok){if(s.status===249)return Ri(),a;const l=await s.text();try{return l&&l!=="OK"&&(s.json=JSON.parse(l)),s}catch{return{ok:!1,reportError:!1,error:new Error(`failed parsing response json for ${e} - ${l}`)}}}return s}catch(s){const l=n+1;return l>5?{ok:!1,reportError:!1,error:s}:(await Cr(Math.pow(2,n)*1e3),He(e,t,l))}};/*! *****************************************************************************
3
3
  Copyright (c) Microsoft Corporation.
4
4
  Permission to use, copy, modify, and/or distribute this software for any
5
5
  purpose with or without fee is hereby granted.
@@ -16,7 +16,7 @@ PERFORMANCE OF THIS SOFTWARE.
16
16
  `+r}).join("")):""}var Ff=["Modify","Bulk","OpenFailed","VersionChange","Schema","Upgrade","InvalidTable","MissingAPI","NoSuchDatabase","InvalidArgument","SubTransaction","Unsupported","Internal","DatabaseClosed","PrematureCommit","ForeignAwait"],rl=["Unknown","Constraint","Data","TransactionInactive","ReadOnly","Version","NotFound","InvalidState","InvalidAccess","Abort","Timeout","QuotaExceeded","Syntax","DataClone"],Ao=Ff.concat(rl),Bf={VersionChanged:"Database version changed by other database connection",DatabaseClosed:"Database has been closed",Abort:"Transaction aborted",TransactionInactive:"Transaction has already completed or failed",MissingAPI:"IndexedDB API missing. Please visit https://tinyurl.com/y2uuvskb"};function un(e,t){this._e=Vt(),this.name=e,this.message=t}ln(un).from(Error).extend({stack:{get:function(){return this._stack||(this._stack=this.name+": "+this.message+Pi(this._e,2))}},toString:function(){return this.name+": "+this.message}});function il(e,t){return e+". Errors: "+Object.keys(t).map(function(n){return t[n].toString()}).filter(function(n,r,i){return i.indexOf(n)===r}).join(`
17
17
  `)}function Ir(e,t,n,r){this._e=Vt(),this.failures=t,this.failedKeys=r,this.successCount=n,this.message=il(e,t)}ln(Ir).from(un);function xn(e,t){this._e=Vt(),this.name="BulkError",this.failures=Object.keys(t).map(function(n){return t[n]}),this.failuresByPos=t,this.message=il(e,t)}ln(xn).from(un);var Oo=Ao.reduce(function(e,t){return e[t]=t+"Error",e},{}),Hf=un,V=Ao.reduce(function(e,t){var n=t+"Error";function r(i,o){this._e=Vt(),this.name=n,i?typeof i=="string"?(this.message=""+i+(o?`
18
18
  `+o:""),this.inner=o||null):typeof i=="object"&&(this.message=i.name+" "+i.message,this.inner=i):(this.message=Bf[t]||n,this.inner=null)}return ln(r).from(Hf),e[t]=r,e},{});V.Syntax=SyntaxError;V.Type=TypeError;V.Range=RangeError;var ka=rl.reduce(function(e,t){return e[t+"Error"]=V[t],e},{});function Kf(e,t){if(!e||e instanceof un||e instanceof TypeError||e instanceof SyntaxError||!e.name||!ka[e.name])return e;var n=new ka[e.name](t||e.message,e);return"stack"in e&&rt(n,"stack",{get:function(){return this.inner.stack}}),n}var qr=Ao.reduce(function(e,t){return["Syntax","Type","Range"].indexOf(t)===-1&&(e[t+"Error"]=V[t]),e},{});qr.ModifyError=Ir;qr.DexieError=un;qr.BulkError=xn;function W(){}function Kn(e){return e}function $f(e,t){return e==null||e===Kn?t:function(n){return t(e(n))}}function Nt(e,t){return function(){e.apply(this,arguments),t.apply(this,arguments)}}function Gf(e,t){return e===W?t:function(){var n=e.apply(this,arguments);n!==void 0&&(arguments[0]=n);var r=this.onsuccess,i=this.onerror;this.onsuccess=null,this.onerror=null;var o=t.apply(this,arguments);return r&&(this.onsuccess=this.onsuccess?Nt(r,this.onsuccess):r),i&&(this.onerror=this.onerror?Nt(i,this.onerror):i),o!==void 0?o:n}}function qf(e,t){return e===W?t:function(){e.apply(this,arguments);var n=this.onsuccess,r=this.onerror;this.onsuccess=this.onerror=null,t.apply(this,arguments),n&&(this.onsuccess=this.onsuccess?Nt(n,this.onsuccess):n),r&&(this.onerror=this.onerror?Nt(r,this.onerror):r)}}function zf(e,t){return e===W?t:function(n){var r=e.apply(this,arguments);me(n,r);var i=this.onsuccess,o=this.onerror;this.onsuccess=null,this.onerror=null;var a=t.apply(this,arguments);return i&&(this.onsuccess=this.onsuccess?Nt(i,this.onsuccess):i),o&&(this.onerror=this.onerror?Nt(o,this.onerror):o),r===void 0?a===void 0?void 0:a:me(r,a)}}function Wf(e,t){return e===W?t:function(){return t.apply(this,arguments)===!1?!1:e.apply(this,arguments)}}function Uo(e,t){return e===W?t:function(){var n=e.apply(this,arguments);if(n&&typeof n.then=="function"){for(var r=this,i=arguments.length,o=new Array(i);i--;)o[i]=arguments[i];return n.then(function(){return t.apply(r,o)})}return t.apply(this,arguments)}}var Rn={},Yf=100,Qf=20,ol=100,Do=typeof Promise>"u"?[]:function(){var e=Promise.resolve();if(typeof crypto>"u"||!crypto.subtle)return[e,Ln(e),e];var t=crypto.subtle.digest("SHA-512",new Uint8Array([0]));return[t,Ln(t),e]}(),Ni=Do[0],kr=Do[1],Mi=Do[2],al=kr&&kr.then,ur=Ni&&Ni.constructor,Po=!!Mi,ji=!1,Zf=Mi?function(){Mi.then(tr)}:Q.setImmediate?setImmediate.bind(null,tr):Q.MutationObserver?function(){var e=document.createElement("div");new MutationObserver(function(){tr(),e=null}).observe(e,{attributes:!0}),e.setAttribute("i","1")}:function(){setTimeout(tr,0)},An=function(e,t){wn.push([e,t]),Tr&&(Zf(),Tr=!1)},Vi=!0,Tr=!0,Ot=[],cr=[],Fi=null,Bi=Kn,Wt={id:"global",global:!0,ref:0,unhandleds:[],onunhandled:Ra,pgp:!1,env:{},finalize:function(){this.unhandleds.forEach(function(e){try{Ra(e[0],e[1])}catch{}})}},P=Wt,wn=[],Ut=0,dr=[];function A(e){if(typeof this!="object")throw new TypeError("Promises must be constructed via new");this._listeners=[],this.onuncatched=W,this._lib=!1;var t=this._PSD=P;if(qe&&(this._stackHolder=Vt(),this._prev=null,this._numPrev=0),typeof e!="function"){if(e!==Rn)throw new TypeError("Not a function");this._state=arguments[1],this._value=arguments[2],this._state===!1&&Ki(this,this._value);return}this._state=null,this._value=null,++t.ref,ll(this,e)}var Hi={get:function(){var e=P,t=Lr;function n(r,i){var o=this,a=!e.global&&(e!==P||t!==Lr),s=a&&!it(),l=new A(function(u,c){No(o,new sl(Ar(r,e,a,s),Ar(i,e,a,s),u,c,e))});return qe&&dl(l,this),l}return n.prototype=Rn,n},set:function(e){rt(this,"then",e&&e.prototype===Rn?Hi:{get:function(){return e},set:Hi.set})}};Jt(A.prototype,{then:Hi,_then:function(e,t){No(this,new sl(null,null,e,t,P))},catch:function(e){if(arguments.length===1)return this.then(null,e);var t=arguments[0],n=arguments[1];return typeof t=="function"?this.then(null,function(r){return r instanceof t?n(r):fr(r)}):this.then(null,function(r){return r&&r.name===t?n(r):fr(r)})},finally:function(e){return this.then(function(t){return e(),t},function(t){return e(),fr(t)})},stack:{get:function(){if(this._stack)return this._stack;try{ji=!0;var e=cl(this,[],Qf),t=e.join(`
19
- From previous: `);return this._state!==null&&(this._stack=t),t}finally{ji=!1}}},timeout:function(e,t){var n=this;return e<1/0?new A(function(r,i){var o=setTimeout(function(){return i(new V.Timeout(t))},e);n.then(r,i).finally(clearTimeout.bind(null,o))}):this}});typeof Symbol<"u"&&Symbol.toStringTag&&rt(A.prototype,Symbol.toStringTag,"Dexie.Promise");Wt.env=fl();function sl(e,t,n,r,i){this.onFulfilled=typeof e=="function"?e:null,this.onRejected=typeof t=="function"?t:null,this.resolve=n,this.reject=r,this.psd=i}Jt(A,{all:function(){var e=Qe.apply(null,arguments).map(Rr);return new A(function(t,n){e.length===0&&t([]);var r=e.length;e.forEach(function(i,o){return A.resolve(i).then(function(a){e[o]=a,--r||t(e)},n)})})},resolve:function(e){if(e instanceof A)return e;if(e&&typeof e.then=="function")return new A(function(n,r){e.then(n,r)});var t=new A(Rn,!0,e);return dl(t,Fi),t},reject:fr,race:function(){var e=Qe.apply(null,arguments).map(Rr);return new A(function(t,n){e.map(function(r){return A.resolve(r).then(t,n)})})},PSD:{get:function(){return P},set:function(e){return P=e}},totalEchoes:{get:function(){return Lr}},newPSD:mt,usePSD:dn,scheduler:{get:function(){return An},set:function(e){An=e}},rejectionMapper:{get:function(){return Bi},set:function(e){Bi=e}},follow:function(e,t){return new A(function(n,r){return mt(function(i,o){var a=P;a.unhandleds=[],a.onunhandled=o,a.finalize=Nt(function(){var s=this;Jf(function(){s.unhandleds.length===0?i():o(s.unhandleds[0])})},a.finalize),e()},t,n,r)})}});ur&&(ur.allSettled&&rt(A,"allSettled",function(){var e=Qe.apply(null,arguments).map(Rr);return new A(function(t){e.length===0&&t([]);var n=e.length,r=new Array(n);e.forEach(function(i,o){return A.resolve(i).then(function(a){return r[o]={status:"fulfilled",value:a}},function(a){return r[o]={status:"rejected",reason:a}}).then(function(){return--n||t(r)})})})}),ur.any&&typeof AggregateError<"u"&&rt(A,"any",function(){var e=Qe.apply(null,arguments).map(Rr);return new A(function(t,n){e.length===0&&n(new AggregateError([]));var r=e.length,i=new Array(r);e.forEach(function(o,a){return A.resolve(o).then(function(s){return t(s)},function(s){i[a]=s,--r||n(new AggregateError(i))})})})}));function ll(e,t){try{t(function(n){if(e._state===null){if(n===e)throw new TypeError("A promise cannot be resolved with itself.");var r=e._lib&&$n();n&&typeof n.then=="function"?ll(e,function(i,o){n instanceof A?n._then(i,o):n.then(i,o)}):(e._state=!0,e._value=n,ul(e)),r&&Gn()}},Ki.bind(null,e))}catch(n){Ki(e,n)}}function Ki(e,t){if(cr.push(t),e._state===null){var n=e._lib&&$n();t=Bi(t),e._state=!1,e._value=t,qe&&t!==null&&typeof t=="object"&&!t._promise&&Uf(function(){var r=Lo(t,"stack");t._promise=e,rt(t,"stack",{get:function(){return ji?r&&(r.get?r.get.apply(t):r.value):e.stack}})}),ep(e),ul(e),n&&Gn()}}function ul(e){var t=e._listeners;e._listeners=[];for(var n=0,r=t.length;n<r;++n)No(e,t[n]);var i=e._PSD;--i.ref||i.finalize(),Ut===0&&(++Ut,An(function(){--Ut===0&&Mo()},[]))}function No(e,t){if(e._state===null){e._listeners.push(t);return}var n=e._state?t.onFulfilled:t.onRejected;if(n===null)return(e._state?t.resolve:t.reject)(e._value);++t.psd.ref,++Ut,An(Xf,[n,e,t])}function Xf(e,t,n){try{Fi=t;var r,i=t._value;t._state?r=e(i):(cr.length&&(cr=[]),r=e(i),cr.indexOf(i)===-1&&tp(t)),n.resolve(r)}catch(o){n.reject(o)}finally{Fi=null,--Ut===0&&Mo(),--n.psd.ref||n.psd.finalize()}}function cl(e,t,n){if(t.length===n)return t;var r="";if(e._state===!1){var i=e._value,o,a;i!=null?(o=i.name||"Error",a=i.message||i,r=Pi(i,0)):(o=i,a=""),t.push(o+(a?": "+a:"")+r)}return qe&&(r=Pi(e._stackHolder,2),r&&t.indexOf(r)===-1&&t.push(r),e._prev&&cl(e._prev,t,n)),t}function dl(e,t){var n=t?t._numPrev+1:0;n<Yf&&(e._prev=t,e._numPrev=n)}function tr(){$n()&&Gn()}function $n(){var e=Vi;return Vi=!1,Tr=!1,e}function Gn(){var e,t,n;do for(;wn.length>0;)for(e=wn,wn=[],n=e.length,t=0;t<n;++t){var r=e[t];r[0].apply(null,r[1])}while(wn.length>0);Vi=!0,Tr=!0}function Mo(){var e=Ot;Ot=[],e.forEach(function(r){r._PSD.onunhandled.call(null,r._value,r)});for(var t=dr.slice(0),n=t.length;n;)t[--n]()}function Jf(e){function t(){e(),dr.splice(dr.indexOf(t),1)}dr.push(t),++Ut,An(function(){--Ut===0&&Mo()},[])}function ep(e){Ot.some(function(t){return t._value===e._value})||Ot.push(e)}function tp(e){for(var t=Ot.length;t;)if(Ot[--t]._value===e._value){Ot.splice(t,1);return}}function fr(e){return new A(Rn,!1,e)}function X(e,t){var n=P;return function(){var r=$n(),i=P;try{return gt(n,!0),e.apply(this,arguments)}catch(o){t&&t(o)}finally{gt(i,!1),r&&Gn()}}}var fe={awaits:0,echoes:0,id:0},np=0,pr=[],si=0,Lr=0,rp=0;function mt(e,t,n,r){var i=P,o=Object.create(i);o.parent=i,o.ref=0,o.global=!1,o.id=++rp;var a=Wt.env;o.env=Po?{Promise:A,PromiseProp:{value:A,configurable:!0,writable:!0},all:A.all,race:A.race,allSettled:A.allSettled,any:A.any,resolve:A.resolve,reject:A.reject,nthen:Ta(a.nthen,o),gthen:Ta(a.gthen,o)}:{},t&&me(o,t),++i.ref,o.finalize=function(){--this.parent.ref||this.parent.finalize()};var s=dn(o,e,n,r);return o.ref===0&&o.finalize(),s}function cn(){return fe.id||(fe.id=++np),++fe.awaits,fe.echoes+=ol,fe.id}function it(){return fe.awaits?(--fe.awaits===0&&(fe.id=0),fe.echoes=fe.awaits*ol,!0):!1}(""+al).indexOf("[native code]")===-1&&(cn=it=W);function Rr(e){return fe.echoes&&e&&e.constructor===ur?(cn(),e.then(function(t){return it(),t},function(t){return it(),ie(t)})):e}function ip(e){++Lr,(!fe.echoes||--fe.echoes===0)&&(fe.echoes=fe.id=0),pr.push(P),gt(e,!0)}function op(){var e=pr[pr.length-1];pr.pop(),gt(e,!1)}function gt(e,t){var n=P;if((t?fe.echoes&&(!si++||e!==P):si&&(!--si||e!==P))&&pl(t?ip.bind(null,e):op),e!==P&&(P=e,n===Wt&&(Wt.env=fl()),Po)){var r=Wt.env.Promise,i=e.env;kr.then=i.nthen,r.prototype.then=i.gthen,(n.global||e.global)&&(Object.defineProperty(Q,"Promise",i.PromiseProp),r.all=i.all,r.race=i.race,r.resolve=i.resolve,r.reject=i.reject,i.allSettled&&(r.allSettled=i.allSettled),i.any&&(r.any=i.any))}}function fl(){var e=Q.Promise;return Po?{Promise:e,PromiseProp:Object.getOwnPropertyDescriptor(Q,"Promise"),all:e.all,race:e.race,allSettled:e.allSettled,any:e.any,resolve:e.resolve,reject:e.reject,nthen:kr.then,gthen:e.prototype.then}:{}}function dn(e,t,n,r,i){var o=P;try{return gt(e,!0),t(n,r,i)}finally{gt(o,!1)}}function pl(e){al.call(Ni,e)}function Ar(e,t,n,r){return typeof e!="function"?e:function(){var i=P;n&&cn(),gt(t,!0);try{return e.apply(this,arguments)}finally{gt(i,!1),r&&pl(it)}}}function Ta(e,t){return function(n,r){return e.call(this,Ar(n,t),Ar(r,t))}}var La="unhandledrejection";function Ra(e,t){var n;try{n=t.onuncatched(e)}catch{}if(n!==!1)try{var r,i={promise:t,reason:e};if(Q.document&&document.createEvent?(r=document.createEvent("Event"),r.initEvent(La,!0,!0),me(r,i)):Q.CustomEvent&&(r=new CustomEvent(La,{detail:i}),me(r,i)),r&&Q.dispatchEvent&&(dispatchEvent(r),!Q.PromiseRejectionEvent&&Q.onunhandledrejection))try{Q.onunhandledrejection(r)}catch{}qe&&r&&!r.defaultPrevented&&console.warn("Unhandled rejection: "+(e.stack||e))}catch{}}var ie=A.reject;function $i(e,t,n,r){if(!e.idbdb||!e._state.openComplete&&!P.letThrough&&!e._vip){if(e._state.openComplete)return ie(new V.DatabaseClosed(e._state.dbOpenError));if(!e._state.isBeingOpened){if(!e._options.autoOpen)return ie(new V.DatabaseClosed);e.open().catch(W)}return e._state.dbReadyPromise.then(function(){return $i(e,t,n,r)})}else{var i=e._createTransaction(t,n,e._dbSchema);try{i.create(),e._state.PR1398_maxLoop=3}catch(o){return o.name===Oo.InvalidState&&e.isOpen()&&--e._state.PR1398_maxLoop>0?(console.warn("Dexie: Need to reopen db"),e._close(),e.open().then(function(){return $i(e,t,n,r)})):ie(o)}return i._promise(t,function(o,a){return mt(function(){return P.trans=i,r(o,a,i)})}).then(function(o){return i._completion.then(function(){return o})})}}var Aa="3.2.3",Rt=String.fromCharCode(65535),Gi=-1/0,We="Invalid key provided. Keys must be of type string, number, Date or Array<string | number | Date>.",hl="String expected.",Sn=[],zr=typeof navigator<"u"&&/(MSIE|Trident|Edge)/.test(navigator.userAgent),ap=zr,sp=zr,vl=function(e){return!/(dexie\.js|dexie\.min\.js)/.test(e)},Wr="__dbnames",li="readonly",ui="readwrite";function Mt(e,t){return e?t?function(){return e.apply(this,arguments)&&t.apply(this,arguments)}:e:t}var ml={type:3,lower:-1/0,lowerOpen:!1,upper:[[]],upperOpen:!1};function nr(e){return typeof e=="string"&&!/\./.test(e)?function(t){return t[e]===void 0&&e in t&&(t=Hn(t),delete t[e]),t}:function(t){return t}}var lp=function(){function e(){}return e.prototype._trans=function(t,n,r){var i=this._tx||P.trans,o=this.name;function a(l,u,c){if(!c.schema[o])throw new V.NotFound("Table "+o+" not part of transaction");return n(c.idbtrans,c)}var s=$n();try{return i&&i.db===this.db?i===P.trans?i._promise(t,a,r):mt(function(){return i._promise(t,a,r)},{trans:i,transless:P.transless||P}):$i(this.db,t,[this.name],a)}finally{s&&Gn()}},e.prototype.get=function(t,n){var r=this;return t&&t.constructor===Object?this.where(t).first(n):this._trans("readonly",function(i){return r.core.get({trans:i,key:t}).then(function(o){return r.hook.reading.fire(o)})}).then(n)},e.prototype.where=function(t){if(typeof t=="string")return new this.db.WhereClause(this,t);if(pe(t))return new this.db.WhereClause(this,"["+t.join("+")+"]");var n=ne(t);if(n.length===1)return this.where(n[0]).equals(t[n[0]]);var r=this.schema.indexes.concat(this.schema.primKey).filter(function(c){return c.compound&&n.every(function(f){return c.keyPath.indexOf(f)>=0})&&c.keyPath.every(function(f){return n.indexOf(f)>=0})})[0];if(r&&this.db._maxKey!==Rt)return this.where(r.name).equals(r.keyPath.map(function(c){return t[c]}));!r&&qe&&console.warn("The query "+JSON.stringify(t)+" on "+this.name+" would benefit of a "+("compound index ["+n.join("+")+"]"));var i=this.schema.idxByName,o=this.db._deps.indexedDB;function a(c,f){try{return o.cmp(c,f)===0}catch{return!1}}var s=n.reduce(function(c,f){var d=c[0],p=c[1],h=i[f],v=t[f];return[d||h,d||!h?Mt(p,h&&h.multi?function(m){var w=tt(m,f);return pe(w)&&w.some(function(y){return a(v,y)})}:function(m){return a(v,tt(m,f))}):p]},[null,null]),l=s[0],u=s[1];return l?this.where(l.name).equals(t[l.keyPath]).filter(u):r?this.filter(u):this.where(n).equals("")},e.prototype.filter=function(t){return this.toCollection().and(t)},e.prototype.count=function(t){return this.toCollection().count(t)},e.prototype.offset=function(t){return this.toCollection().offset(t)},e.prototype.limit=function(t){return this.toCollection().limit(t)},e.prototype.each=function(t){return this.toCollection().each(t)},e.prototype.toArray=function(t){return this.toCollection().toArray(t)},e.prototype.toCollection=function(){return new this.db.Collection(new this.db.WhereClause(this))},e.prototype.orderBy=function(t){return new this.db.Collection(new this.db.WhereClause(this,pe(t)?"["+t.join("+")+"]":t))},e.prototype.reverse=function(){return this.toCollection().reverse()},e.prototype.mapToClass=function(t){this.schema.mappedClass=t;var n=function(r){if(!r)return r;var i=Object.create(t.prototype);for(var o in r)if(we(r,o))try{i[o]=r[o]}catch{}return i};return this.schema.readHook&&this.hook.reading.unsubscribe(this.schema.readHook),this.schema.readHook=n,this.hook("reading",n),t},e.prototype.defineClass=function(){function t(n){me(this,n)}return this.mapToClass(t)},e.prototype.add=function(t,n){var r=this,i=this.schema.primKey,o=i.auto,a=i.keyPath,s=t;return a&&o&&(s=nr(a)(t)),this._trans("readwrite",function(l){return r.core.mutate({trans:l,type:"add",keys:n!=null?[n]:null,values:[s]})}).then(function(l){return l.numFailures?A.reject(l.failures[0]):l.lastResult}).then(function(l){if(a)try{Ae(t,a,l)}catch{}return l})},e.prototype.update=function(t,n){if(typeof t=="object"&&!pe(t)){var r=tt(t,this.schema.primKey.keyPath);if(r===void 0)return ie(new V.InvalidArgument("Given object does not contain its primary key"));try{typeof n!="function"?ne(n).forEach(function(i){Ae(t,i,n[i])}):n(t,{value:t,primKey:r})}catch{}return this.where(":id").equals(r).modify(n)}else return this.where(":id").equals(t).modify(n)},e.prototype.put=function(t,n){var r=this,i=this.schema.primKey,o=i.auto,a=i.keyPath,s=t;return a&&o&&(s=nr(a)(t)),this._trans("readwrite",function(l){return r.core.mutate({trans:l,type:"put",values:[s],keys:n!=null?[n]:null})}).then(function(l){return l.numFailures?A.reject(l.failures[0]):l.lastResult}).then(function(l){if(a)try{Ae(t,a,l)}catch{}return l})},e.prototype.delete=function(t){var n=this;return this._trans("readwrite",function(r){return n.core.mutate({trans:r,type:"delete",keys:[t]})}).then(function(r){return r.numFailures?A.reject(r.failures[0]):void 0})},e.prototype.clear=function(){var t=this;return this._trans("readwrite",function(n){return t.core.mutate({trans:n,type:"deleteRange",range:ml})}).then(function(n){return n.numFailures?A.reject(n.failures[0]):void 0})},e.prototype.bulkGet=function(t){var n=this;return this._trans("readonly",function(r){return n.core.getMany({keys:t,trans:r}).then(function(i){return i.map(function(o){return n.hook.reading.fire(o)})})})},e.prototype.bulkAdd=function(t,n,r){var i=this,o=Array.isArray(n)?n:void 0;r=r||(o?void 0:n);var a=r?r.allKeys:void 0;return this._trans("readwrite",function(s){var l=i.schema.primKey,u=l.auto,c=l.keyPath;if(c&&o)throw new V.InvalidArgument("bulkAdd(): keys argument invalid on tables with inbound keys");if(o&&o.length!==t.length)throw new V.InvalidArgument("Arguments objects and keys must have the same length");var f=t.length,d=c&&u?t.map(nr(c)):t;return i.core.mutate({trans:s,type:"add",keys:o,values:d,wantResults:a}).then(function(p){var h=p.numFailures,v=p.results,m=p.lastResult,w=p.failures,y=a?v:m;if(h===0)return y;throw new xn(i.name+".bulkAdd(): "+h+" of "+f+" operations failed",w)})})},e.prototype.bulkPut=function(t,n,r){var i=this,o=Array.isArray(n)?n:void 0;r=r||(o?void 0:n);var a=r?r.allKeys:void 0;return this._trans("readwrite",function(s){var l=i.schema.primKey,u=l.auto,c=l.keyPath;if(c&&o)throw new V.InvalidArgument("bulkPut(): keys argument invalid on tables with inbound keys");if(o&&o.length!==t.length)throw new V.InvalidArgument("Arguments objects and keys must have the same length");var f=t.length,d=c&&u?t.map(nr(c)):t;return i.core.mutate({trans:s,type:"put",keys:o,values:d,wantResults:a}).then(function(p){var h=p.numFailures,v=p.results,m=p.lastResult,w=p.failures,y=a?v:m;if(h===0)return y;throw new xn(i.name+".bulkPut(): "+h+" of "+f+" operations failed",w)})})},e.prototype.bulkDelete=function(t){var n=this,r=t.length;return this._trans("readwrite",function(i){return n.core.mutate({trans:i,type:"delete",keys:t})}).then(function(i){var o=i.numFailures,a=i.lastResult,s=i.failures;if(o===0)return a;throw new xn(n.name+".bulkDelete(): "+o+" of "+r+" operations failed",s)})},e}();function qn(e){var t={},n=function(s,l){if(l){for(var u=arguments.length,c=new Array(u-1);--u;)c[u-1]=arguments[u];return t[s].subscribe.apply(null,c),e}else if(typeof s=="string")return t[s]};n.addEventType=o;for(var r=1,i=arguments.length;r<i;++r)o(arguments[r]);return n;function o(s,l,u){if(typeof s=="object")return a(s);l||(l=Wf),u||(u=W);var c={subscribers:[],fire:u,subscribe:function(f){c.subscribers.indexOf(f)===-1&&(c.subscribers.push(f),c.fire=l(c.fire,f))},unsubscribe:function(f){c.subscribers=c.subscribers.filter(function(d){return d!==f}),c.fire=c.subscribers.reduce(l,u)}};return t[s]=n[s]=c,c}function a(s){ne(s).forEach(function(l){var u=s[l];if(pe(u))o(l,s[l][0],s[l][1]);else if(u==="asap")var c=o(l,Kn,function(){for(var d=arguments.length,p=new Array(d);d--;)p[d]=arguments[d];c.subscribers.forEach(function(h){Qs(function(){h.apply(null,p)})})});else throw new V.InvalidArgument("Invalid event config")})}}function zn(e,t){return ln(t).from({prototype:e}),t}function up(e){return zn(lp.prototype,function(n,r,i){this.db=e,this._tx=i,this.name=n,this.schema=r,this.hook=e._allTables[n]?e._allTables[n].hook:qn(null,{creating:[Gf,W],reading:[$f,Kn],updating:[zf,W],deleting:[qf,W]})})}function Ht(e,t){return!(e.filter||e.algorithm||e.or)&&(t?e.justLimit:!e.replayFilter)}function ci(e,t){e.filter=Mt(e.filter,t)}function di(e,t,n){var r=e.replayFilter;e.replayFilter=r?function(){return Mt(r(),t())}:t,e.justLimit=n&&!r}function cp(e,t){e.isMatch=Mt(e.isMatch,t)}function hr(e,t){if(e.isPrimKey)return t.primaryKey;var n=t.getIndexByKeyPath(e.index);if(!n)throw new V.Schema("KeyPath "+e.index+" on object store "+t.name+" is not indexed");return n}function Oa(e,t,n){var r=hr(e,t.schema);return t.openCursor({trans:n,values:!e.keysOnly,reverse:e.dir==="prev",unique:!!e.unique,query:{index:r,range:e.range}})}function rr(e,t,n,r){var i=e.replayFilter?Mt(e.filter,e.replayFilter()):e.filter;if(e.or){var o={},a=function(s,l,u){if(!i||i(l,u,function(d){return l.stop(d)},function(d){return l.fail(d)})){var c=l.primaryKey,f=""+c;f==="[object ArrayBuffer]"&&(f=""+new Uint8Array(c)),we(o,f)||(o[f]=!0,t(s,l,u))}};return Promise.all([e.or._iterate(a,n),Ua(Oa(e,r,n),e.algorithm,a,!e.keysOnly&&e.valueMapper)])}else return Ua(Oa(e,r,n),Mt(e.algorithm,i),t,!e.keysOnly&&e.valueMapper)}function Ua(e,t,n,r){var i=r?function(a,s,l){return n(r(a),s,l)}:n,o=X(i);return e.then(function(a){if(a)return a.start(function(){var s=function(){return a.continue()};(!t||t(a,function(l){return s=l},function(l){a.stop(l),s=W},function(l){a.fail(l),s=W}))&&o(a.value,a,function(l){return s=l}),s()})})}function ve(e,t){try{var n=Da(e),r=Da(t);if(n!==r)return n==="Array"?1:r==="Array"?-1:n==="binary"?1:r==="binary"?-1:n==="string"?1:r==="string"?-1:n==="Date"?1:r!=="Date"?NaN:-1;switch(n){case"number":case"Date":case"string":return e>t?1:e<t?-1:0;case"binary":return fp(Pa(e),Pa(t));case"Array":return dp(e,t)}}catch{}return NaN}function dp(e,t){for(var n=e.length,r=t.length,i=n<r?n:r,o=0;o<i;++o){var a=ve(e[o],t[o]);if(a!==0)return a}return n===r?0:n<r?-1:1}function fp(e,t){for(var n=e.length,r=t.length,i=n<r?n:r,o=0;o<i;++o)if(e[o]!==t[o])return e[o]<t[o]?-1:1;return n===r?0:n<r?-1:1}function Da(e){var t=typeof e;if(t!=="object")return t;if(ArrayBuffer.isView(e))return"binary";var n=Ui(e);return n==="ArrayBuffer"?"binary":n}function Pa(e){return e instanceof Uint8Array?e:ArrayBuffer.isView(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):new Uint8Array(e)}var pp=function(){function e(){}return e.prototype._read=function(t,n){var r=this._ctx;return r.error?r.table._trans(null,ie.bind(null,r.error)):r.table._trans("readonly",t).then(n)},e.prototype._write=function(t){var n=this._ctx;return n.error?n.table._trans(null,ie.bind(null,n.error)):n.table._trans("readwrite",t,"locked")},e.prototype._addAlgorithm=function(t){var n=this._ctx;n.algorithm=Mt(n.algorithm,t)},e.prototype._iterate=function(t,n){return rr(this._ctx,t,n,this._ctx.table.core)},e.prototype.clone=function(t){var n=Object.create(this.constructor.prototype),r=Object.create(this._ctx);return t&&me(r,t),n._ctx=r,n},e.prototype.raw=function(){return this._ctx.valueMapper=null,this},e.prototype.each=function(t){var n=this._ctx;return this._read(function(r){return rr(n,t,r,n.table.core)})},e.prototype.count=function(t){var n=this;return this._read(function(r){var i=n._ctx,o=i.table.core;if(Ht(i,!0))return o.count({trans:r,query:{index:hr(i,o.schema),range:i.range}}).then(function(s){return Math.min(s,i.limit)});var a=0;return rr(i,function(){return++a,!1},r,o).then(function(){return a})}).then(t)},e.prototype.sortBy=function(t,n){var r=t.split(".").reverse(),i=r[0],o=r.length-1;function a(u,c){return c?a(u[r[c]],c-1):u[i]}var s=this._ctx.dir==="next"?1:-1;function l(u,c){var f=a(u,o),d=a(c,o);return f<d?-s:f>d?s:0}return this.toArray(function(u){return u.sort(l)}).then(n)},e.prototype.toArray=function(t){var n=this;return this._read(function(r){var i=n._ctx;if(i.dir==="next"&&Ht(i,!0)&&i.limit>0){var o=i.valueMapper,a=hr(i,i.table.core.schema);return i.table.core.query({trans:r,limit:i.limit,values:!0,query:{index:a,range:i.range}}).then(function(l){var u=l.result;return o?u.map(o):u})}else{var s=[];return rr(i,function(l){return s.push(l)},r,i.table.core).then(function(){return s})}},t)},e.prototype.offset=function(t){var n=this._ctx;return t<=0?this:(n.offset+=t,Ht(n)?di(n,function(){var r=t;return function(i,o){return r===0?!0:r===1?(--r,!1):(o(function(){i.advance(r),r=0}),!1)}}):di(n,function(){var r=t;return function(){return--r<0}}),this)},e.prototype.limit=function(t){return this._ctx.limit=Math.min(this._ctx.limit,t),di(this._ctx,function(){var n=t;return function(r,i,o){return--n<=0&&i(o),n>=0}},!0),this},e.prototype.until=function(t,n){return ci(this._ctx,function(r,i,o){return t(r.value)?(i(o),n):!0}),this},e.prototype.first=function(t){return this.limit(1).toArray(function(n){return n[0]}).then(t)},e.prototype.last=function(t){return this.reverse().first(t)},e.prototype.filter=function(t){return ci(this._ctx,function(n){return t(n.value)}),cp(this._ctx,t),this},e.prototype.and=function(t){return this.filter(t)},e.prototype.or=function(t){return new this.db.WhereClause(this._ctx.table,t,this)},e.prototype.reverse=function(){return this._ctx.dir=this._ctx.dir==="prev"?"next":"prev",this._ondirectionchange&&this._ondirectionchange(this._ctx.dir),this},e.prototype.desc=function(){return this.reverse()},e.prototype.eachKey=function(t){var n=this._ctx;return n.keysOnly=!n.isMatch,this.each(function(r,i){t(i.key,i)})},e.prototype.eachUniqueKey=function(t){return this._ctx.unique="unique",this.eachKey(t)},e.prototype.eachPrimaryKey=function(t){var n=this._ctx;return n.keysOnly=!n.isMatch,this.each(function(r,i){t(i.primaryKey,i)})},e.prototype.keys=function(t){var n=this._ctx;n.keysOnly=!n.isMatch;var r=[];return this.each(function(i,o){r.push(o.key)}).then(function(){return r}).then(t)},e.prototype.primaryKeys=function(t){var n=this._ctx;if(n.dir==="next"&&Ht(n,!0)&&n.limit>0)return this._read(function(i){var o=hr(n,n.table.core.schema);return n.table.core.query({trans:i,values:!1,limit:n.limit,query:{index:o,range:n.range}})}).then(function(i){var o=i.result;return o}).then(t);n.keysOnly=!n.isMatch;var r=[];return this.each(function(i,o){r.push(o.primaryKey)}).then(function(){return r}).then(t)},e.prototype.uniqueKeys=function(t){return this._ctx.unique="unique",this.keys(t)},e.prototype.firstKey=function(t){return this.limit(1).keys(function(n){return n[0]}).then(t)},e.prototype.lastKey=function(t){return this.reverse().firstKey(t)},e.prototype.distinct=function(){var t=this._ctx,n=t.index&&t.table.schema.idxByName[t.index];if(!n||!n.multi)return this;var r={};return ci(this._ctx,function(i){var o=i.primaryKey.toString(),a=we(r,o);return r[o]=!0,!a}),this},e.prototype.modify=function(t){var n=this,r=this._ctx;return this._write(function(i){var o;if(typeof t=="function")o=t;else{var a=ne(t),s=a.length;o=function(w){for(var y=!1,E=0;E<s;++E){var _=a[E],b=t[_];tt(w,_)!==b&&(Ae(w,_,b),y=!0)}return y}}var l=r.table.core,u=l.schema.primaryKey,c=u.outbound,f=u.extractKey,d=n.db._options.modifyChunkSize||200,p=[],h=0,v=[],m=function(w,y){var E=y.failures,_=y.numFailures;h+=w-_;for(var b=0,S=ne(E);b<S.length;b++){var x=S[b];p.push(E[x])}};return n.clone().primaryKeys().then(function(w){var y=function(E){var _=Math.min(d,w.length-E);return l.getMany({trans:i,keys:w.slice(E,E+_),cache:"immutable"}).then(function(b){for(var S=[],x=[],I=c?[]:null,k=[],L=0;L<_;++L){var T=b[L],U={value:Hn(T),primKey:w[E+L]};o.call(U,U.value,U)!==!1&&(U.value==null?k.push(w[E+L]):!c&&ve(f(T),f(U.value))!==0?(k.push(w[E+L]),S.push(U.value)):(x.push(U.value),c&&I.push(w[E+L])))}var C=Ht(r)&&r.limit===1/0&&(typeof t!="function"||t===fi)&&{index:r.index,range:r.range};return Promise.resolve(S.length>0&&l.mutate({trans:i,type:"add",values:S}).then(function(j){for(var O in j.failures)k.splice(parseInt(O),1);m(S.length,j)})).then(function(){return(x.length>0||C&&typeof t=="object")&&l.mutate({trans:i,type:"put",keys:I,values:x,criteria:C,changeSpec:typeof t!="function"&&t}).then(function(j){return m(x.length,j)})}).then(function(){return(k.length>0||C&&t===fi)&&l.mutate({trans:i,type:"delete",keys:k,criteria:C}).then(function(j){return m(k.length,j)})}).then(function(){return w.length>E+_&&y(E+d)})})};return y(0).then(function(){if(p.length>0)throw new Ir("Error modifying one or more objects",p,h,v);return w.length})})})},e.prototype.delete=function(){var t=this._ctx,n=t.range;return Ht(t)&&(t.isPrimKey&&!sp||n.type===3)?this._write(function(r){var i=t.table.core.schema.primaryKey,o=n;return t.table.core.count({trans:r,query:{index:i,range:o}}).then(function(a){return t.table.core.mutate({trans:r,type:"deleteRange",range:o}).then(function(s){var l=s.failures;s.lastResult,s.results;var u=s.numFailures;if(u)throw new Ir("Could not delete some values",Object.keys(l).map(function(c){return l[c]}),a-u);return a-u})})}):this.modify(fi)},e}(),fi=function(e,t){return t.value=null};function hp(e){return zn(pp.prototype,function(n,r){this.db=e;var i=ml,o=null;if(r)try{i=r()}catch(u){o=u}var a=n._ctx,s=a.table,l=s.hook.reading.fire;this._ctx={table:s,index:a.index,isPrimKey:!a.index||s.schema.primKey.keyPath&&a.index===s.schema.primKey.name,range:i,keysOnly:!1,dir:"next",unique:"",algorithm:null,filter:null,replayFilter:null,justLimit:!0,isMatch:null,offset:0,limit:1/0,error:o,or:a.or,valueMapper:l!==Kn?l:null}})}function vp(e,t){return e<t?-1:e===t?0:1}function mp(e,t){return e>t?-1:e===t?0:1}function ge(e,t,n){var r=e instanceof yl?new e.Collection(e):e;return r._ctx.error=n?new n(t):new TypeError(t),r}function Kt(e){return new e.Collection(e,function(){return gl("")}).limit(0)}function gp(e){return e==="next"?function(t){return t.toUpperCase()}:function(t){return t.toLowerCase()}}function yp(e){return e==="next"?function(t){return t.toLowerCase()}:function(t){return t.toUpperCase()}}function _p(e,t,n,r,i,o){for(var a=Math.min(e.length,r.length),s=-1,l=0;l<a;++l){var u=t[l];if(u!==r[l])return i(e[l],n[l])<0?e.substr(0,l)+n[l]+n.substr(l+1):i(e[l],r[l])<0?e.substr(0,l)+r[l]+n.substr(l+1):s>=0?e.substr(0,s)+t[s]+n.substr(s+1):null;i(e[l],u)<0&&(s=l)}return a<r.length&&o==="next"?e+n.substr(e.length):a<e.length&&o==="prev"?e.substr(0,n.length):s<0?null:e.substr(0,s)+r[s]+n.substr(s+1)}function ir(e,t,n,r){var i,o,a,s,l,u,c,f=n.length;if(!n.every(function(v){return typeof v=="string"}))return ge(e,hl);function d(v){i=gp(v),o=yp(v),a=v==="next"?vp:mp;var m=n.map(function(w){return{lower:o(w),upper:i(w)}}).sort(function(w,y){return a(w.lower,y.lower)});s=m.map(function(w){return w.upper}),l=m.map(function(w){return w.lower}),u=v,c=v==="next"?"":r}d("next");var p=new e.Collection(e,function(){return st(s[0],l[f-1]+r)});p._ondirectionchange=function(v){d(v)};var h=0;return p._addAlgorithm(function(v,m,w){var y=v.key;if(typeof y!="string")return!1;var E=o(y);if(t(E,l,h))return!0;for(var _=null,b=h;b<f;++b){var S=_p(y,E,s[b],l[b],a,u);S===null&&_===null?h=b+1:(_===null||a(_,S)>0)&&(_=S)}return m(_!==null?function(){v.continue(_+c)}:w),!1}),p}function st(e,t,n,r){return{type:2,lower:e,upper:t,lowerOpen:n,upperOpen:r}}function gl(e){return{type:1,lower:e,upper:e}}var yl=function(){function e(){}return Object.defineProperty(e.prototype,"Collection",{get:function(){return this._ctx.table.db.Collection},enumerable:!1,configurable:!0}),e.prototype.between=function(t,n,r,i){r=r!==!1,i=i===!0;try{return this._cmp(t,n)>0||this._cmp(t,n)===0&&(r||i)&&!(r&&i)?Kt(this):new this.Collection(this,function(){return st(t,n,!r,!i)})}catch{return ge(this,We)}},e.prototype.equals=function(t){return t==null?ge(this,We):new this.Collection(this,function(){return gl(t)})},e.prototype.above=function(t){return t==null?ge(this,We):new this.Collection(this,function(){return st(t,void 0,!0)})},e.prototype.aboveOrEqual=function(t){return t==null?ge(this,We):new this.Collection(this,function(){return st(t,void 0,!1)})},e.prototype.below=function(t){return t==null?ge(this,We):new this.Collection(this,function(){return st(void 0,t,!1,!0)})},e.prototype.belowOrEqual=function(t){return t==null?ge(this,We):new this.Collection(this,function(){return st(void 0,t)})},e.prototype.startsWith=function(t){return typeof t!="string"?ge(this,hl):this.between(t,t+Rt,!0,!0)},e.prototype.startsWithIgnoreCase=function(t){return t===""?this.startsWith(t):ir(this,function(n,r){return n.indexOf(r[0])===0},[t],Rt)},e.prototype.equalsIgnoreCase=function(t){return ir(this,function(n,r){return n===r[0]},[t],"")},e.prototype.anyOfIgnoreCase=function(){var t=Qe.apply($t,arguments);return t.length===0?Kt(this):ir(this,function(n,r){return r.indexOf(n)!==-1},t,"")},e.prototype.startsWithAnyOfIgnoreCase=function(){var t=Qe.apply($t,arguments);return t.length===0?Kt(this):ir(this,function(n,r){return r.some(function(i){return n.indexOf(i)===0})},t,Rt)},e.prototype.anyOf=function(){var t=this,n=Qe.apply($t,arguments),r=this._cmp;try{n.sort(r)}catch{return ge(this,We)}if(n.length===0)return Kt(this);var i=new this.Collection(this,function(){return st(n[0],n[n.length-1])});i._ondirectionchange=function(a){r=a==="next"?t._ascending:t._descending,n.sort(r)};var o=0;return i._addAlgorithm(function(a,s,l){for(var u=a.key;r(u,n[o])>0;)if(++o,o===n.length)return s(l),!1;return r(u,n[o])===0?!0:(s(function(){a.continue(n[o])}),!1)}),i},e.prototype.notEqual=function(t){return this.inAnyRange([[Gi,t],[t,this.db._maxKey]],{includeLowers:!1,includeUppers:!1})},e.prototype.noneOf=function(){var t=Qe.apply($t,arguments);if(t.length===0)return new this.Collection(this);try{t.sort(this._ascending)}catch{return ge(this,We)}var n=t.reduce(function(r,i){return r?r.concat([[r[r.length-1][1],i]]):[[Gi,i]]},null);return n.push([t[t.length-1],this.db._maxKey]),this.inAnyRange(n,{includeLowers:!1,includeUppers:!1})},e.prototype.inAnyRange=function(t,n){var r=this,i=this._cmp,o=this._ascending,a=this._descending,s=this._min,l=this._max;if(t.length===0)return Kt(this);if(!t.every(function(b){return b[0]!==void 0&&b[1]!==void 0&&o(b[0],b[1])<=0}))return ge(this,"First argument to inAnyRange() must be an Array of two-value Arrays [lower,upper] where upper must not be lower than lower",V.InvalidArgument);var u=!n||n.includeLowers!==!1,c=n&&n.includeUppers===!0;function f(b,S){for(var x=0,I=b.length;x<I;++x){var k=b[x];if(i(S[0],k[1])<0&&i(S[1],k[0])>0){k[0]=s(k[0],S[0]),k[1]=l(k[1],S[1]);break}}return x===I&&b.push(S),b}var d=o;function p(b,S){return d(b[0],S[0])}var h;try{h=t.reduce(f,[]),h.sort(p)}catch{return ge(this,We)}var v=0,m=c?function(b){return o(b,h[v][1])>0}:function(b){return o(b,h[v][1])>=0},w=u?function(b){return a(b,h[v][0])>0}:function(b){return a(b,h[v][0])>=0};function y(b){return!m(b)&&!w(b)}var E=m,_=new this.Collection(this,function(){return st(h[0][0],h[h.length-1][1],!u,!c)});return _._ondirectionchange=function(b){b==="next"?(E=m,d=o):(E=w,d=a),h.sort(p)},_._addAlgorithm(function(b,S,x){for(var I=b.key;E(I);)if(++v,v===h.length)return S(x),!1;return y(I)?!0:(r._cmp(I,h[v][1])===0||r._cmp(I,h[v][0])===0||S(function(){d===o?b.continue(h[v][0]):b.continue(h[v][1])}),!1)}),_},e.prototype.startsWithAnyOf=function(){var t=Qe.apply($t,arguments);return t.every(function(n){return typeof n=="string"})?t.length===0?Kt(this):this.inAnyRange(t.map(function(n){return[n,n+Rt]})):ge(this,"startsWithAnyOf() only works with strings")},e}();function wp(e){return zn(yl.prototype,function(n,r,i){this.db=e,this._ctx={table:n,index:r===":id"?null:r,or:i};var o=e._deps.indexedDB;if(!o)throw new V.MissingAPI;this._cmp=this._ascending=o.cmp.bind(o),this._descending=function(a,s){return o.cmp(s,a)},this._max=function(a,s){return o.cmp(a,s)>0?a:s},this._min=function(a,s){return o.cmp(a,s)<0?a:s},this._IDBKeyRange=e._deps.IDBKeyRange})}function Me(e){return X(function(t){return On(t),e(t.target.error),!1})}function On(e){e.stopPropagation&&e.stopPropagation(),e.preventDefault&&e.preventDefault()}var Un="storagemutated",dt="x-storagemutated-1",yt=qn(null,Un),bp=function(){function e(){}return e.prototype._lock=function(){return _n(!P.global),++this._reculock,this._reculock===1&&!P.global&&(P.lockOwnerFor=this),this},e.prototype._unlock=function(){if(_n(!P.global),--this._reculock===0)for(P.global||(P.lockOwnerFor=null);this._blockedFuncs.length>0&&!this._locked();){var t=this._blockedFuncs.shift();try{dn(t[1],t[0])}catch{}}return this},e.prototype._locked=function(){return this._reculock&&P.lockOwnerFor!==this},e.prototype.create=function(t){var n=this;if(!this.mode)return this;var r=this.db.idbdb,i=this.db._state.dbOpenError;if(_n(!this.idbtrans),!t&&!r)switch(i&&i.name){case"DatabaseClosedError":throw new V.DatabaseClosed(i);case"MissingAPIError":throw new V.MissingAPI(i.message,i);default:throw new V.OpenFailed(i)}if(!this.active)throw new V.TransactionInactive;return _n(this._completion._state===null),t=this.idbtrans=t||(this.db.core?this.db.core.transaction(this.storeNames,this.mode,{durability:this.chromeTransactionDurability}):r.transaction(this.storeNames,this.mode,{durability:this.chromeTransactionDurability})),t.onerror=X(function(o){On(o),n._reject(t.error)}),t.onabort=X(function(o){On(o),n.active&&n._reject(new V.Abort(t.error)),n.active=!1,n.on("abort").fire(o)}),t.oncomplete=X(function(){n.active=!1,n._resolve(),"mutatedParts"in t&&yt.storagemutated.fire(t.mutatedParts)}),this},e.prototype._promise=function(t,n,r){var i=this;if(t==="readwrite"&&this.mode!=="readwrite")return ie(new V.ReadOnly("Transaction is readonly"));if(!this.active)return ie(new V.TransactionInactive);if(this._locked())return new A(function(a,s){i._blockedFuncs.push([function(){i._promise(t,n,r).then(a,s)},P])});if(r)return mt(function(){var a=new A(function(s,l){i._lock();var u=n(s,l,i);u&&u.then&&u.then(s,l)});return a.finally(function(){return i._unlock()}),a._lib=!0,a});var o=new A(function(a,s){var l=n(a,s,i);l&&l.then&&l.then(a,s)});return o._lib=!0,o},e.prototype._root=function(){return this.parent?this.parent._root():this},e.prototype.waitFor=function(t){var n=this._root(),r=A.resolve(t);if(n._waitingFor)n._waitingFor=n._waitingFor.then(function(){return r});else{n._waitingFor=r,n._waitingQueue=[];var i=n.idbtrans.objectStore(n.storeNames[0]);(function a(){for(++n._spinCount;n._waitingQueue.length;)n._waitingQueue.shift()();n._waitingFor&&(i.get(-1/0).onsuccess=a)})()}var o=n._waitingFor;return new A(function(a,s){r.then(function(l){return n._waitingQueue.push(X(a.bind(null,l)))},function(l){return n._waitingQueue.push(X(s.bind(null,l)))}).finally(function(){n._waitingFor===o&&(n._waitingFor=null)})})},e.prototype.abort=function(){this.active&&(this.active=!1,this.idbtrans&&this.idbtrans.abort(),this._reject(new V.Abort))},e.prototype.table=function(t){var n=this._memoizedTables||(this._memoizedTables={});if(we(n,t))return n[t];var r=this.schema[t];if(!r)throw new V.NotFound("Table "+t+" not part of transaction");var i=new this.db.Table(t,r,this);return i.core=this.db.core.table(t),n[t]=i,i},e}();function Ep(e){return zn(bp.prototype,function(n,r,i,o,a){var s=this;this.db=e,this.mode=n,this.storeNames=r,this.schema=i,this.chromeTransactionDurability=o,this.idbtrans=null,this.on=qn(this,"complete","error","abort"),this.parent=a||null,this.active=!0,this._reculock=0,this._blockedFuncs=[],this._resolve=null,this._reject=null,this._waitingFor=null,this._waitingQueue=null,this._spinCount=0,this._completion=new A(function(l,u){s._resolve=l,s._reject=u}),this._completion.then(function(){s.active=!1,s.on.complete.fire()},function(l){var u=s.active;return s.active=!1,s.on.error.fire(l),s.parent?s.parent._reject(l):u&&s.idbtrans&&s.idbtrans.abort(),ie(l)})})}function qi(e,t,n,r,i,o,a){return{name:e,keyPath:t,unique:n,multi:r,auto:i,compound:o,src:(n&&!a?"&":"")+(r?"*":"")+(i?"++":"")+_l(t)}}function _l(e){return typeof e=="string"?e:e?"["+[].join.call(e,"+")+"]":""}function wl(e,t,n){return{name:e,primKey:t,indexes:n,mappedClass:null,idxByName:Zs(n,function(r){return[r.name,r]})}}function xp(e){return e.length===1?e[0]:e}var Dn=function(e){try{return e.only([[]]),Dn=function(){return[[]]},[[]]}catch{return Dn=function(){return Rt},Rt}};function zi(e){return e==null?function(){}:typeof e=="string"?Sp(e):function(t){return tt(t,e)}}function Sp(e){var t=e.split(".");return t.length===1?function(n){return n[e]}:function(n){return tt(n,e)}}function Na(e){return[].slice.call(e)}var Cp=0;function Cn(e){return e==null?":id":typeof e=="string"?e:"["+e.join("+")+"]"}function Ip(e,t,n){function r(f,d){var p=Na(f.objectStoreNames);return{schema:{name:f.name,tables:p.map(function(h){return d.objectStore(h)}).map(function(h){var v=h.keyPath,m=h.autoIncrement,w=pe(v),y=v==null,E={},_={name:h.name,primaryKey:{name:null,isPrimaryKey:!0,outbound:y,compound:w,keyPath:v,autoIncrement:m,unique:!0,extractKey:zi(v)},indexes:Na(h.indexNames).map(function(b){return h.index(b)}).map(function(b){var S=b.name,x=b.unique,I=b.multiEntry,k=b.keyPath,L=pe(k),T={name:S,compound:L,keyPath:k,unique:x,multiEntry:I,extractKey:zi(k)};return E[Cn(k)]=T,T}),getIndexByKeyPath:function(b){return E[Cn(b)]}};return E[":id"]=_.primaryKey,v!=null&&(E[Cn(v)]=_.primaryKey),_})},hasGetAll:p.length>0&&"getAll"in d.objectStore(p[0])&&!(typeof navigator<"u"&&/Safari/.test(navigator.userAgent)&&!/(Chrome\/|Edge\/)/.test(navigator.userAgent)&&[].concat(navigator.userAgent.match(/Safari\/(\d*)/))[1]<604)}}function i(f){if(f.type===3)return null;if(f.type===4)throw new Error("Cannot convert never type to IDBKeyRange");var d=f.lower,p=f.upper,h=f.lowerOpen,v=f.upperOpen,m=d===void 0?p===void 0?null:t.upperBound(p,!!v):p===void 0?t.lowerBound(d,!!h):t.bound(d,p,!!h,!!v);return m}function o(f){var d=f.name;function p(m){var w=m.trans,y=m.type,E=m.keys,_=m.values,b=m.range;return new Promise(function(S,x){S=X(S);var I=w.objectStore(d),k=I.keyPath==null,L=y==="put"||y==="add";if(!L&&y!=="delete"&&y!=="deleteRange")throw new Error("Invalid operation type: "+y);var T=(E||_||{length:1}).length;if(E&&_&&E.length!==_.length)throw new Error("Given keys array must have same length as given values array.");if(T===0)return S({numFailures:0,failures:{},results:[],lastResult:void 0});var U,C=[],j=[],O=0,Y=function(Ne){++O,On(Ne)};if(y==="deleteRange"){if(b.type===4)return S({numFailures:O,failures:j,results:[],lastResult:void 0});b.type===3?C.push(U=I.clear()):C.push(U=I.delete(i(b)))}else{var G=L?k?[_,E]:[_,null]:[E,null],he=G[0],Pe=G[1];if(L)for(var Ee=0;Ee<T;++Ee)C.push(U=Pe&&Pe[Ee]!==void 0?I[y](he[Ee],Pe[Ee]):I[y](he[Ee])),U.onerror=Y;else for(var Ee=0;Ee<T;++Ee)C.push(U=I[y](he[Ee])),U.onerror=Y}var at=function(Ne){var hn=Ne.target.result;C.forEach(function(ke,Qn){return ke.error!=null&&(j[Qn]=ke.error)}),S({numFailures:O,failures:j,results:y==="delete"?E:C.map(function(ke){return ke.result}),lastResult:hn})};U.onerror=function(Ne){Y(Ne),at(Ne)},U.onsuccess=at})}function h(m){var w=m.trans,y=m.values,E=m.query,_=m.reverse,b=m.unique;return new Promise(function(S,x){S=X(S);var I=E.index,k=E.range,L=w.objectStore(d),T=I.isPrimaryKey?L:L.index(I.name),U=_?b?"prevunique":"prev":b?"nextunique":"next",C=y||!("openKeyCursor"in T)?T.openCursor(i(k),U):T.openKeyCursor(i(k),U);C.onerror=Me(x),C.onsuccess=X(function(j){var O=C.result;if(!O){S(null);return}O.___id=++Cp,O.done=!1;var Y=O.continue.bind(O),G=O.continuePrimaryKey;G&&(G=G.bind(O));var he=O.advance.bind(O),Pe=function(){throw new Error("Cursor not started")},Ee=function(){throw new Error("Cursor not stopped")};O.trans=w,O.stop=O.continue=O.continuePrimaryKey=O.advance=Pe,O.fail=X(x),O.next=function(){var at=this,Ne=1;return this.start(function(){return Ne--?at.continue():at.stop()}).then(function(){return at})},O.start=function(at){var Ne=new Promise(function(ke,Qn){ke=X(ke),C.onerror=Me(Qn),O.fail=Qn,O.stop=function(cc){O.stop=O.continue=O.continuePrimaryKey=O.advance=Ee,ke(cc)}}),hn=function(){if(C.result)try{at()}catch(ke){O.fail(ke)}else O.done=!0,O.start=function(){throw new Error("Cursor behind last entry")},O.stop()};return C.onsuccess=X(function(ke){C.onsuccess=hn,hn()}),O.continue=Y,O.continuePrimaryKey=G,O.advance=he,hn(),Ne},S(O)},x)})}function v(m){return function(w){return new Promise(function(y,E){y=X(y);var _=w.trans,b=w.values,S=w.limit,x=w.query,I=S===1/0?void 0:S,k=x.index,L=x.range,T=_.objectStore(d),U=k.isPrimaryKey?T:T.index(k.name),C=i(L);if(S===0)return y({result:[]});if(m){var j=b?U.getAll(C,I):U.getAllKeys(C,I);j.onsuccess=function(he){return y({result:he.target.result})},j.onerror=Me(E)}else{var O=0,Y=b||!("openKeyCursor"in U)?U.openCursor(C):U.openKeyCursor(C),G=[];Y.onsuccess=function(he){var Pe=Y.result;if(!Pe)return y({result:G});if(G.push(b?Pe.value:Pe.primaryKey),++O===S)return y({result:G});Pe.continue()},Y.onerror=Me(E)}})}}return{name:d,schema:f,mutate:p,getMany:function(m){var w=m.trans,y=m.keys;return new Promise(function(E,_){E=X(E);for(var b=w.objectStore(d),S=y.length,x=new Array(S),I=0,k=0,L,T=function(O){var Y=O.target;(x[Y._pos]=Y.result)!=null,++k===I&&E(x)},U=Me(_),C=0;C<S;++C){var j=y[C];j!=null&&(L=b.get(y[C]),L._pos=C,L.onsuccess=T,L.onerror=U,++I)}I===0&&E(x)})},get:function(m){var w=m.trans,y=m.key;return new Promise(function(E,_){E=X(E);var b=w.objectStore(d),S=b.get(y);S.onsuccess=function(x){return E(x.target.result)},S.onerror=Me(_)})},query:v(l),openCursor:h,count:function(m){var w=m.query,y=m.trans,E=w.index,_=w.range;return new Promise(function(b,S){var x=y.objectStore(d),I=E.isPrimaryKey?x:x.index(E.name),k=i(_),L=k?I.count(k):I.count();L.onsuccess=X(function(T){return b(T.target.result)}),L.onerror=Me(S)})}}}var a=r(e,n),s=a.schema,l=a.hasGetAll,u=s.tables.map(function(f){return o(f)}),c={};return u.forEach(function(f){return c[f.name]=f}),{stack:"dbcore",transaction:e.transaction.bind(e),table:function(f){var d=c[f];if(!d)throw new Error("Table '"+f+"' not found");return c[f]},MIN_KEY:-1/0,MAX_KEY:Dn(t),schema:s}}function kp(e,t){return t.reduce(function(n,r){var i=r.create;return K(K({},n),i(n))},e)}function Tp(e,t,n,r){var i=n.IDBKeyRange;n.indexedDB;var o=kp(Ip(t,i,r),e.dbcore);return{dbcore:o}}function jo(e,t){var n=e._novip,r=t.db,i=Tp(n._middlewares,r,n._deps,t);n.core=i.dbcore,n.tables.forEach(function(o){var a=o.name;n.core.schema.tables.some(function(s){return s.name===a})&&(o.core=n.core.table(a),n[a]instanceof n.Table&&(n[a].core=o.core))})}function Or(e,t,n,r){var i=e._novip;n.forEach(function(o){var a=r[o];t.forEach(function(s){var l=Lo(s,o);(!l||"value"in l&&l.value===void 0)&&(s===i.Transaction.prototype||s instanceof i.Transaction?rt(s,o,{get:function(){return this.table(o)},set:function(u){Ws(this,o,{value:u,writable:!0,configurable:!0,enumerable:!0})}}):s[o]=new i.Table(o,a))})})}function Wi(e,t){var n=e._novip;t.forEach(function(r){for(var i in r)r[i]instanceof n.Table&&delete r[i]})}function Lp(e,t){return e._cfg.version-t._cfg.version}function Rp(e,t,n,r){var i=e._dbSchema,o=e._createTransaction("readwrite",e._storeNames,i);o.create(n),o._completion.catch(r);var a=o._reject.bind(o),s=P.transless||P;mt(function(){P.trans=o,P.transless=s,t===0?(ne(i).forEach(function(l){Vo(n,l,i[l].primKey,i[l].indexes)}),jo(e,n),A.follow(function(){return e.on.populate.fire(o)}).catch(a)):Ap(e,t,o,n).catch(a)})}function Ap(e,t,n,r){var i=e._novip,o=[],a=i._versions,s=i._dbSchema=Fo(i,i.idbdb,r),l=!1,u=a.filter(function(f){return f._cfg.version>=t});u.forEach(function(f){o.push(function(){var d=s,p=f._cfg.dbschema;Qi(i,d,r),Qi(i,p,r),s=i._dbSchema=p;var h=bl(d,p);h.add.forEach(function(_){Vo(r,_[0],_[1].primKey,_[1].indexes)}),h.change.forEach(function(_){if(_.recreate)throw new V.Upgrade("Not yet support for changing primary key");var b=r.objectStore(_.name);_.add.forEach(function(S){return Yi(b,S)}),_.change.forEach(function(S){b.deleteIndex(S.name),Yi(b,S)}),_.del.forEach(function(S){return b.deleteIndex(S)})});var v=f._cfg.contentUpgrade;if(v&&f._cfg.version>t){jo(i,r),n._memoizedTables={},l=!0;var m=Xs(p);h.del.forEach(function(_){m[_]=d[_]}),Wi(i,[i.Transaction.prototype]),Or(i,[i.Transaction.prototype],ne(m),m),n.schema=m;var w=Ro(v);w&&cn();var y,E=A.follow(function(){if(y=v(n),y&&w){var _=it.bind(null,null);y.then(_,_)}});return y&&typeof y.then=="function"?A.resolve(y):E.then(function(){return y})}}),o.push(function(d){if(!l||!ap){var p=f._cfg.dbschema;Up(p,d)}Wi(i,[i.Transaction.prototype]),Or(i,[i.Transaction.prototype],i._storeNames,i._dbSchema),n.schema=i._dbSchema})});function c(){return o.length?A.resolve(o.shift()(n.idbtrans)).then(c):A.resolve()}return c().then(function(){Op(s,r)})}function bl(e,t){var n={del:[],add:[],change:[]},r;for(r in e)t[r]||n.del.push(r);for(r in t){var i=e[r],o=t[r];if(!i)n.add.push([r,o]);else{var a={name:r,def:o,recreate:!1,del:[],add:[],change:[]};if(""+(i.primKey.keyPath||"")!=""+(o.primKey.keyPath||"")||i.primKey.auto!==o.primKey.auto&&!zr)a.recreate=!0,n.change.push(a);else{var s=i.idxByName,l=o.idxByName,u=void 0;for(u in s)l[u]||a.del.push(u);for(u in l){var c=s[u],f=l[u];c?c.src!==f.src&&a.change.push(f):a.add.push(f)}(a.del.length>0||a.add.length>0||a.change.length>0)&&n.change.push(a)}}}return n}function Vo(e,t,n,r){var i=e.db.createObjectStore(t,n.keyPath?{keyPath:n.keyPath,autoIncrement:n.auto}:{autoIncrement:n.auto});return r.forEach(function(o){return Yi(i,o)}),i}function Op(e,t){ne(e).forEach(function(n){t.db.objectStoreNames.contains(n)||Vo(t,n,e[n].primKey,e[n].indexes)})}function Up(e,t){[].slice.call(t.db.objectStoreNames).forEach(function(n){return e[n]==null&&t.db.deleteObjectStore(n)})}function Yi(e,t){e.createIndex(t.name,t.keyPath,{unique:t.unique,multiEntry:t.multi})}function Fo(e,t,n){var r={},i=Gr(t.objectStoreNames,0);return i.forEach(function(o){for(var a=n.objectStore(o),s=a.keyPath,l=qi(_l(s),s||"",!1,!1,!!a.autoIncrement,s&&typeof s!="string",!0),u=[],c=0;c<a.indexNames.length;++c){var f=a.index(a.indexNames[c]);s=f.keyPath;var d=qi(f.name,s,!!f.unique,!!f.multiEntry,!1,s&&typeof s!="string",!1);u.push(d)}r[o]=wl(o,l,u)}),r}function Dp(e,t,n){var r=e._novip;r.verno=t.version/10;var i=r._dbSchema=Fo(r,t,n);r._storeNames=Gr(t.objectStoreNames,0),Or(r,[r._allTables],ne(i),i)}function Pp(e,t){var n=Fo(e,e.idbdb,t),r=bl(n,e._dbSchema);return!(r.add.length||r.change.some(function(i){return i.add.length||i.change.length}))}function Qi(e,t,n){for(var r=e._novip,i=n.db.objectStoreNames,o=0;o<i.length;++o){var a=i[o],s=n.objectStore(a);r._hasGetAll="getAll"in s;for(var l=0;l<s.indexNames.length;++l){var u=s.indexNames[l],c=s.index(u).keyPath,f=typeof c=="string"?c:"["+Gr(c).join("+")+"]";if(t[a]){var d=t[a].idxByName[f];d&&(d.name=u,delete t[a].idxByName[f],t[a].idxByName[u]=d)}}}typeof navigator<"u"&&/Safari/.test(navigator.userAgent)&&!/(Chrome\/|Edge\/)/.test(navigator.userAgent)&&Q.WorkerGlobalScope&&Q instanceof Q.WorkerGlobalScope&&[].concat(navigator.userAgent.match(/Safari\/(\d*)/))[1]<604&&(r._hasGetAll=!1)}function Np(e){return e.split(",").map(function(t,n){t=t.trim();var r=t.replace(/([&*]|\+\+)/g,""),i=/^\[/.test(r)?r.match(/^\[(.*)\]$/)[1].split("+"):r;return qi(r,i||null,/\&/.test(t),/\*/.test(t),/\+\+/.test(t),pe(i),n===0)})}var Mp=function(){function e(){}return e.prototype._parseStoresSpec=function(t,n){ne(t).forEach(function(r){if(t[r]!==null){var i=Np(t[r]),o=i.shift();if(o.multi)throw new V.Schema("Primary key cannot be multi-valued");i.forEach(function(a){if(a.auto)throw new V.Schema("Only primary key can be marked as autoIncrement (++)");if(!a.keyPath)throw new V.Schema("Index must have a name and cannot be an empty string")}),n[r]=wl(r,o,i)}})},e.prototype.stores=function(t){var n=this.db;this._cfg.storesSource=this._cfg.storesSource?me(this._cfg.storesSource,t):t;var r=n._versions,i={},o={};return r.forEach(function(a){me(i,a._cfg.storesSource),o=a._cfg.dbschema={},a._parseStoresSpec(i,o)}),n._dbSchema=o,Wi(n,[n._allTables,n,n.Transaction.prototype]),Or(n,[n._allTables,n,n.Transaction.prototype,this._cfg.tables],ne(o),o),n._storeNames=ne(o),this},e.prototype.upgrade=function(t){return this._cfg.contentUpgrade=Uo(this._cfg.contentUpgrade||W,t),this},e}();function jp(e){return zn(Mp.prototype,function(n){this.db=e,this._cfg={version:n,storesSource:null,dbschema:{},tables:{},contentUpgrade:null}})}function Bo(e,t){var n=e._dbNamesDB;return n||(n=e._dbNamesDB=new Yt(Wr,{addons:[],indexedDB:e,IDBKeyRange:t}),n.version(1).stores({dbnames:"name"})),n.table("dbnames")}function Ho(e){return e&&typeof e.databases=="function"}function Vp(e){var t=e.indexedDB,n=e.IDBKeyRange;return Ho(t)?Promise.resolve(t.databases()).then(function(r){return r.map(function(i){return i.name}).filter(function(i){return i!==Wr})}):Bo(t,n).toCollection().primaryKeys()}function Fp(e,t){var n=e.indexedDB,r=e.IDBKeyRange;!Ho(n)&&t!==Wr&&Bo(n,r).put({name:t}).catch(W)}function Bp(e,t){var n=e.indexedDB,r=e.IDBKeyRange;!Ho(n)&&t!==Wr&&Bo(n,r).delete(t).catch(W)}function Zi(e){return mt(function(){return P.letThrough=!0,e()})}function Hp(){var e=!navigator.userAgentData&&/Safari\//.test(navigator.userAgent)&&!/Chrom(e|ium)\//.test(navigator.userAgent);if(!e||!indexedDB.databases)return Promise.resolve();var t;return new Promise(function(n){var r=function(){return indexedDB.databases().finally(n)};t=setInterval(r,100),r()}).finally(function(){return clearInterval(t)})}function Kp(e){var t=e._state,n=e._deps.indexedDB;if(t.isBeingOpened||e.idbdb)return t.dbReadyPromise.then(function(){return t.dbOpenError?ie(t.dbOpenError):e});qe&&(t.openCanceller._stackHolder=Vt()),t.isBeingOpened=!0,t.dbOpenError=null,t.openComplete=!1;var r=t.openCanceller;function i(){if(t.openCanceller!==r)throw new V.DatabaseClosed("db.open() was cancelled")}var o=t.dbReadyResolve,a=null,s=!1;return A.race([r,(typeof navigator>"u"?A.resolve():Hp()).then(function(){return new A(function(l,u){if(i(),!n)throw new V.MissingAPI;var c=e.name,f=t.autoSchema?n.open(c):n.open(c,Math.round(e.verno*10));if(!f)throw new V.MissingAPI;f.onerror=Me(u),f.onblocked=X(e._fireOnBlocked),f.onupgradeneeded=X(function(d){if(a=f.transaction,t.autoSchema&&!e._options.allowEmptyDB){f.onerror=On,a.abort(),f.result.close();var p=n.deleteDatabase(c);p.onsuccess=p.onerror=X(function(){u(new V.NoSuchDatabase("Database "+c+" doesnt exist"))})}else{a.onerror=Me(u);var h=d.oldVersion>Math.pow(2,62)?0:d.oldVersion;s=h<1,e._novip.idbdb=f.result,Rp(e,h/10,a,u)}},u),f.onsuccess=X(function(){a=null;var d=e._novip.idbdb=f.result,p=Gr(d.objectStoreNames);if(p.length>0)try{var h=d.transaction(xp(p),"readonly");t.autoSchema?Dp(e,d,h):(Qi(e,e._dbSchema,h),Pp(e,h)||console.warn("Dexie SchemaDiff: Schema was extended without increasing the number passed to db.version(). Some queries may fail.")),jo(e,h)}catch{}Sn.push(e),d.onversionchange=X(function(v){t.vcFired=!0,e.on("versionchange").fire(v)}),d.onclose=X(function(v){e.on("close").fire(v)}),s&&Fp(e._deps,c),l()},u)})})]).then(function(){return i(),t.onReadyBeingFired=[],A.resolve(Zi(function(){return e.on.ready.fire(e.vip)})).then(function l(){if(t.onReadyBeingFired.length>0){var u=t.onReadyBeingFired.reduce(Uo,W);return t.onReadyBeingFired=[],A.resolve(Zi(function(){return u(e.vip)})).then(l)}})}).finally(function(){t.onReadyBeingFired=null,t.isBeingOpened=!1}).then(function(){return e}).catch(function(l){t.dbOpenError=l;try{a&&a.abort()}catch{}return r===t.openCanceller&&e._close(),ie(l)}).finally(function(){t.openComplete=!0,o()})}function Xi(e){var t=function(a){return e.next(a)},n=function(a){return e.throw(a)},r=o(t),i=o(n);function o(a){return function(s){var l=a(s),u=l.value;return l.done?u:!u||typeof u.then!="function"?pe(u)?Promise.all(u).then(r,i):r(u):u.then(r,i)}}return o(t)()}function $p(e,t,n){var r=arguments.length;if(r<2)throw new V.InvalidArgument("Too few arguments");for(var i=new Array(r-1);--r;)i[r-1]=arguments[r];n=i.pop();var o=Js(i);return[e,o,n]}function El(e,t,n,r,i){return A.resolve().then(function(){var o=P.transless||P,a=e._createTransaction(t,n,e._dbSchema,r),s={trans:a,transless:o};if(r)a.idbtrans=r.idbtrans;else try{a.create(),e._state.PR1398_maxLoop=3}catch(f){return f.name===Oo.InvalidState&&e.isOpen()&&--e._state.PR1398_maxLoop>0?(console.warn("Dexie: Need to reopen db"),e._close(),e.open().then(function(){return El(e,t,n,null,i)})):ie(f)}var l=Ro(i);l&&cn();var u,c=A.follow(function(){if(u=i.call(a,a),u)if(l){var f=it.bind(null,null);u.then(f,f)}else typeof u.next=="function"&&typeof u.throw=="function"&&(u=Xi(u))},s);return(u&&typeof u.then=="function"?A.resolve(u).then(function(f){return a.active?f:ie(new V.PrematureCommit("Transaction committed too early. See http://bit.ly/2kdckMn"))}):c.then(function(){return u})).then(function(f){return r&&a._resolve(),a._completion.then(function(){return f})}).catch(function(f){return a._reject(f),ie(f)})})}function or(e,t,n){for(var r=pe(e)?e.slice():[e],i=0;i<n;++i)r.push(t);return r}function Gp(e){return K(K({},e),{table:function(t){var n=e.table(t),r=n.schema,i={},o=[];function a(v,m,w){var y=Cn(v),E=i[y]=i[y]||[],_=v==null?0:typeof v=="string"?1:v.length,b=m>0,S=K(K({},w),{isVirtual:b,keyTail:m,keyLength:_,extractKey:zi(v),unique:!b&&w.unique});if(E.push(S),S.isPrimaryKey||o.push(S),_>1){var x=_===2?v[0]:v.slice(0,_-1);a(x,m+1,w)}return E.sort(function(I,k){return I.keyTail-k.keyTail}),S}var s=a(r.primaryKey.keyPath,0,r.primaryKey);i[":id"]=[s];for(var l=0,u=r.indexes;l<u.length;l++){var c=u[l];a(c.keyPath,0,c)}function f(v){var m=i[Cn(v)];return m&&m[0]}function d(v,m){return{type:v.type===1?2:v.type,lower:or(v.lower,v.lowerOpen?e.MAX_KEY:e.MIN_KEY,m),lowerOpen:!0,upper:or(v.upper,v.upperOpen?e.MIN_KEY:e.MAX_KEY,m),upperOpen:!0}}function p(v){var m=v.query.index;return m.isVirtual?K(K({},v),{query:{index:m,range:d(v.query.range,m.keyTail)}}):v}var h=K(K({},n),{schema:K(K({},r),{primaryKey:s,indexes:o,getIndexByKeyPath:f}),count:function(v){return n.count(p(v))},query:function(v){return n.query(p(v))},openCursor:function(v){var m=v.query.index,w=m.keyTail,y=m.isVirtual,E=m.keyLength;if(!y)return n.openCursor(v);function _(b){function S(I){I!=null?b.continue(or(I,v.reverse?e.MAX_KEY:e.MIN_KEY,w)):v.unique?b.continue(b.key.slice(0,E).concat(v.reverse?e.MIN_KEY:e.MAX_KEY,w)):b.continue()}var x=Object.create(b,{continue:{value:S},continuePrimaryKey:{value:function(I,k){b.continuePrimaryKey(or(I,e.MAX_KEY,w),k)}},primaryKey:{get:function(){return b.primaryKey}},key:{get:function(){var I=b.key;return E===1?I[0]:I.slice(0,E)}},value:{get:function(){return b.value}}});return x}return n.openCursor(p(v)).then(function(b){return b&&_(b)})}});return h}})}var qp={stack:"dbcore",name:"VirtualIndexMiddleware",level:1,create:Gp};function Ko(e,t,n,r){return n=n||{},r=r||"",ne(e).forEach(function(i){if(!we(t,i))n[r+i]=void 0;else{var o=e[i],a=t[i];if(typeof o=="object"&&typeof a=="object"&&o&&a){var s=Ui(o),l=Ui(a);s!==l?n[r+i]=t[i]:s==="Object"?Ko(o,a,n,r+i+"."):o!==a&&(n[r+i]=t[i])}else o!==a&&(n[r+i]=t[i])}}),ne(t).forEach(function(i){we(e,i)||(n[r+i]=t[i])}),n}function zp(e,t){return t.type==="delete"?t.keys:t.keys||t.values.map(e.extractKey)}var Wp={stack:"dbcore",name:"HooksMiddleware",level:2,create:function(e){return K(K({},e),{table:function(t){var n=e.table(t),r=n.schema.primaryKey,i=K(K({},n),{mutate:function(o){var a=P.trans,s=a.table(t).hook,l=s.deleting,u=s.creating,c=s.updating;switch(o.type){case"add":if(u.fire===W)break;return a._promise("readwrite",function(){return f(o)},!0);case"put":if(u.fire===W&&c.fire===W)break;return a._promise("readwrite",function(){return f(o)},!0);case"delete":if(l.fire===W)break;return a._promise("readwrite",function(){return f(o)},!0);case"deleteRange":if(l.fire===W)break;return a._promise("readwrite",function(){return d(o)},!0)}return n.mutate(o);function f(h){var v=P.trans,m=h.keys||zp(r,h);if(!m)throw new Error("Keys missing");return h=h.type==="add"||h.type==="put"?K(K({},h),{keys:m}):K({},h),h.type!=="delete"&&(h.values=Ai([],h.values,!0)),h.keys&&(h.keys=Ai([],h.keys,!0)),Yp(n,h,m).then(function(w){var y=m.map(function(E,_){var b=w[_],S={onerror:null,onsuccess:null};if(h.type==="delete")l.fire.call(S,E,b,v);else if(h.type==="add"||b===void 0){var x=u.fire.call(S,E,h.values[_],v);E==null&&x!=null&&(E=x,h.keys[_]=E,r.outbound||Ae(h.values[_],r.keyPath,E))}else{var I=Ko(b,h.values[_]),k=c.fire.call(S,I,E,b,v);if(k){var L=h.values[_];Object.keys(k).forEach(function(T){we(L,T)?L[T]=k[T]:Ae(L,T,k[T])})}}return S});return n.mutate(h).then(function(E){for(var _=E.failures,b=E.results,S=E.numFailures,x=E.lastResult,I=0;I<m.length;++I){var k=b?b[I]:m[I],L=y[I];k==null?L.onerror&&L.onerror(_[I]):L.onsuccess&&L.onsuccess(h.type==="put"&&w[I]?h.values[I]:k)}return{failures:_,results:b,numFailures:S,lastResult:x}}).catch(function(E){return y.forEach(function(_){return _.onerror&&_.onerror(E)}),Promise.reject(E)})})}function d(h){return p(h.trans,h.range,1e4)}function p(h,v,m){return n.query({trans:h,values:!1,query:{index:r,range:v},limit:m}).then(function(w){var y=w.result;return f({type:"delete",keys:y,trans:h}).then(function(E){return E.numFailures>0?Promise.reject(E.failures[0]):y.length<m?{failures:[],numFailures:0,lastResult:void 0}:p(h,K(K({},v),{lower:y[y.length-1],lowerOpen:!0}),m)})})}}});return i}})}};function Yp(e,t,n){return t.type==="add"?Promise.resolve([]):e.getMany({trans:t.trans,keys:n,cache:"immutable"})}function xl(e,t,n){try{if(!t||t.keys.length<e.length)return null;for(var r=[],i=0,o=0;i<t.keys.length&&o<e.length;++i)ve(t.keys[i],e[o])===0&&(r.push(n?Hn(t.values[i]):t.values[i]),++o);return r.length===e.length?r:null}catch{return null}}var Qp={stack:"dbcore",level:-1,create:function(e){return{table:function(t){var n=e.table(t);return K(K({},n),{getMany:function(r){if(!r.cache)return n.getMany(r);var i=xl(r.keys,r.trans._cache,r.cache==="clone");return i?A.resolve(i):n.getMany(r).then(function(o){return r.trans._cache={keys:r.keys,values:r.cache==="clone"?Hn(o):o},o})},mutate:function(r){return r.type!=="add"&&(r.trans._cache=null),n.mutate(r)}})}}}},pi;function $o(e){return!("from"in e)}var Ye=function(e,t){if(this)me(this,arguments.length?{d:1,from:e,to:arguments.length>1?t:e}:{d:0});else{var n=new Ye;return e&&"d"in e&&me(n,e),n}};Jt(Ye.prototype,(pi={add:function(e){return Ur(this,e),this},addKey:function(e){return Pn(this,e,e),this},addKeys:function(e){var t=this;return e.forEach(function(n){return Pn(t,n,n)}),this}},pi[Di]=function(){return Ji(this)},pi));function Pn(e,t,n){var r=ve(t,n);if(!isNaN(r)){if(r>0)throw RangeError();if($o(e))return me(e,{from:t,to:n,d:1});var i=e.l,o=e.r;if(ve(n,e.from)<0)return i?Pn(i,t,n):e.l={from:t,to:n,d:1,l:null,r:null},Ma(e);if(ve(t,e.to)>0)return o?Pn(o,t,n):e.r={from:t,to:n,d:1,l:null,r:null},Ma(e);ve(t,e.from)<0&&(e.from=t,e.l=null,e.d=o?o.d+1:1),ve(n,e.to)>0&&(e.to=n,e.r=null,e.d=e.l?e.l.d+1:1);var a=!e.r;i&&!e.l&&Ur(e,i),o&&a&&Ur(e,o)}}function Ur(e,t){function n(r,i){var o=i.from,a=i.to,s=i.l,l=i.r;Pn(r,o,a),s&&n(r,s),l&&n(r,l)}$o(t)||n(e,t)}function Zp(e,t){var n=Ji(t),r=n.next();if(r.done)return!1;for(var i=r.value,o=Ji(e),a=o.next(i.from),s=a.value;!r.done&&!a.done;){if(ve(s.from,i.to)<=0&&ve(s.to,i.from)>=0)return!0;ve(i.from,s.from)<0?i=(r=n.next(s.from)).value:s=(a=o.next(i.from)).value}return!1}function Ji(e){var t=$o(e)?null:{s:0,n:e};return{next:function(n){for(var r=arguments.length>0;t;)switch(t.s){case 0:if(t.s=1,r)for(;t.n.l&&ve(n,t.n.from)<0;)t={up:t,n:t.n.l,s:1};else for(;t.n.l;)t={up:t,n:t.n.l,s:1};case 1:if(t.s=2,!r||ve(n,t.n.to)<=0)return{value:t.n,done:!1};case 2:if(t.n.r){t.s=3,t={up:t,n:t.n.r,s:0};continue}case 3:t=t.up}return{done:!0}}}}function Ma(e){var t,n,r=(((t=e.r)===null||t===void 0?void 0:t.d)||0)-(((n=e.l)===null||n===void 0?void 0:n.d)||0),i=r>1?"r":r<-1?"l":"";if(i){var o=i==="r"?"l":"r",a=K({},e),s=e[i];e.from=s.from,e.to=s.to,e[i]=s[i],a[i]=s[o],e[o]=a,a.d=ja(a)}e.d=ja(e)}function ja(e){var t=e.r,n=e.l;return(t?n?Math.max(t.d,n.d):t.d:n?n.d:0)+1}var Xp={stack:"dbcore",level:0,create:function(e){var t=e.schema.name,n=new Ye(e.MIN_KEY,e.MAX_KEY);return K(K({},e),{table:function(r){var i=e.table(r),o=i.schema,a=o.primaryKey,s=a.extractKey,l=a.outbound,u=K(K({},i),{mutate:function(d){var p=d.trans,h=p.mutatedParts||(p.mutatedParts={}),v=function(x){var I="idb://"+t+"/"+r+"/"+x;return h[I]||(h[I]=new Ye)},m=v(""),w=v(":dels"),y=d.type,E=d.type==="deleteRange"?[d.range]:d.type==="delete"?[d.keys]:d.values.length<50?[[],d.values]:[],_=E[0],b=E[1],S=d.trans._cache;return i.mutate(d).then(function(x){if(pe(_)){y!=="delete"&&(_=x.results),m.addKeys(_);var I=xl(_,S);!I&&y!=="add"&&w.addKeys(_),(I||b)&&Jp(v,o,I,b)}else if(_){var k={from:_.lower,to:_.upper};w.add(k),m.add(k)}else m.add(n),w.add(n),o.indexes.forEach(function(L){return v(L.name).add(n)});return x})}}),c=function(d){var p,h,v=d.query,m=v.index,w=v.range;return[m,new Ye((p=w.lower)!==null&&p!==void 0?p:e.MIN_KEY,(h=w.upper)!==null&&h!==void 0?h:e.MAX_KEY)]},f={get:function(d){return[a,new Ye(d.key)]},getMany:function(d){return[a,new Ye().addKeys(d.keys)]},count:c,query:c,openCursor:c};return ne(f).forEach(function(d){u[d]=function(p){var h=P.subscr;if(h){var v=function(S){var x="idb://"+t+"/"+r+"/"+S;return h[x]||(h[x]=new Ye)},m=v(""),w=v(":dels"),y=f[d](p),E=y[0],_=y[1];if(v(E.name||"").add(_),!E.isPrimaryKey)if(d==="count")w.add(n);else{var b=d==="query"&&l&&p.values&&i.query(K(K({},p),{values:!1}));return i[d].apply(this,arguments).then(function(S){if(d==="query"){if(l&&p.values)return b.then(function(L){var T=L.result;return m.addKeys(T),S});var x=p.values?S.result.map(s):S.result;p.values?m.addKeys(x):w.addKeys(x)}else if(d==="openCursor"){var I=S,k=p.values;return I&&Object.create(I,{key:{get:function(){return w.addKey(I.primaryKey),I.key}},primaryKey:{get:function(){var L=I.primaryKey;return w.addKey(L),L}},value:{get:function(){return k&&m.addKey(I.primaryKey),I.value}}})}return S})}}return i[d].apply(this,arguments)}}),u}})}};function Jp(e,t,n,r){function i(o){var a=e(o.name||"");function s(u){return u!=null?o.extractKey(u):null}var l=function(u){return o.multiEntry&&pe(u)?u.forEach(function(c){return a.addKey(c)}):a.addKey(u)};(n||r).forEach(function(u,c){var f=n&&s(n[c]),d=r&&s(r[c]);ve(f,d)!==0&&(f!=null&&l(f),d!=null&&l(d))})}t.indexes.forEach(i)}var Yt=function(){function e(t,n){var r=this;this._middlewares={},this.verno=0;var i=e.dependencies;this._options=n=K({addons:e.addons,autoOpen:!0,indexedDB:i.indexedDB,IDBKeyRange:i.IDBKeyRange},n),this._deps={indexedDB:n.indexedDB,IDBKeyRange:n.IDBKeyRange};var o=n.addons;this._dbSchema={},this._versions=[],this._storeNames=[],this._allTables={},this.idbdb=null,this._novip=this;var a={dbOpenError:null,isBeingOpened:!1,onReadyBeingFired:null,openComplete:!1,dbReadyResolve:W,dbReadyPromise:null,cancelOpen:W,openCanceller:null,autoSchema:!0,PR1398_maxLoop:3};a.dbReadyPromise=new A(function(s){a.dbReadyResolve=s}),a.openCanceller=new A(function(s,l){a.cancelOpen=l}),this._state=a,this.name=t,this.on=qn(this,"populate","blocked","versionchange","close",{ready:[Uo,W]}),this.on.ready.subscribe=Ys(this.on.ready.subscribe,function(s){return function(l,u){e.vip(function(){var c=r._state;if(c.openComplete)c.dbOpenError||A.resolve().then(l),u&&s(l);else if(c.onReadyBeingFired)c.onReadyBeingFired.push(l),u&&s(l);else{s(l);var f=r;u||s(function d(){f.on.ready.unsubscribe(l),f.on.ready.unsubscribe(d)})}})}}),this.Collection=hp(this),this.Table=up(this),this.Transaction=Ep(this),this.Version=jp(this),this.WhereClause=wp(this),this.on("versionchange",function(s){s.newVersion>0?console.warn("Another connection wants to upgrade database '"+r.name+"'. Closing db now to resume the upgrade."):console.warn("Another connection wants to delete database '"+r.name+"'. Closing db now to resume the delete request."),r.close()}),this.on("blocked",function(s){!s.newVersion||s.newVersion<s.oldVersion?console.warn("Dexie.delete('"+r.name+"') was blocked"):console.warn("Upgrade '"+r.name+"' blocked by other connection holding version "+s.oldVersion/10)}),this._maxKey=Dn(n.IDBKeyRange),this._createTransaction=function(s,l,u,c){return new r.Transaction(s,l,u,r._options.chromeTransactionDurability,c)},this._fireOnBlocked=function(s){r.on("blocked").fire(s),Sn.filter(function(l){return l.name===r.name&&l!==r&&!l._state.vcFired}).map(function(l){return l.on("versionchange").fire(s)})},this.use(qp),this.use(Wp),this.use(Xp),this.use(Qp),this.vip=Object.create(this,{_vip:{value:!0}}),o.forEach(function(s){return s(r)})}return e.prototype.version=function(t){if(isNaN(t)||t<.1)throw new V.Type("Given version is not a positive number");if(t=Math.round(t*10)/10,this.idbdb||this._state.isBeingOpened)throw new V.Schema("Cannot add version when database is open");this.verno=Math.max(this.verno,t);var n=this._versions,r=n.filter(function(i){return i._cfg.version===t})[0];return r||(r=new this.Version(t),n.push(r),n.sort(Lp),r.stores({}),this._state.autoSchema=!1,r)},e.prototype._whenReady=function(t){var n=this;return this.idbdb&&(this._state.openComplete||P.letThrough||this._vip)?t():new A(function(r,i){if(n._state.openComplete)return i(new V.DatabaseClosed(n._state.dbOpenError));if(!n._state.isBeingOpened){if(!n._options.autoOpen){i(new V.DatabaseClosed);return}n.open().catch(W)}n._state.dbReadyPromise.then(r,i)}).then(t)},e.prototype.use=function(t){var n=t.stack,r=t.create,i=t.level,o=t.name;o&&this.unuse({stack:n,name:o});var a=this._middlewares[n]||(this._middlewares[n]=[]);return a.push({stack:n,create:r,level:i==null?10:i,name:o}),a.sort(function(s,l){return s.level-l.level}),this},e.prototype.unuse=function(t){var n=t.stack,r=t.name,i=t.create;return n&&this._middlewares[n]&&(this._middlewares[n]=this._middlewares[n].filter(function(o){return i?o.create!==i:r?o.name!==r:!1})),this},e.prototype.open=function(){return Kp(this)},e.prototype._close=function(){var t=this._state,n=Sn.indexOf(this);if(n>=0&&Sn.splice(n,1),this.idbdb){try{this.idbdb.close()}catch{}this._novip.idbdb=null}t.dbReadyPromise=new A(function(r){t.dbReadyResolve=r}),t.openCanceller=new A(function(r,i){t.cancelOpen=i})},e.prototype.close=function(){this._close();var t=this._state;this._options.autoOpen=!1,t.dbOpenError=new V.DatabaseClosed,t.isBeingOpened&&t.cancelOpen(t.dbOpenError)},e.prototype.delete=function(){var t=this,n=arguments.length>0,r=this._state;return new A(function(i,o){var a=function(){t.close();var s=t._deps.indexedDB.deleteDatabase(t.name);s.onsuccess=X(function(){Bp(t._deps,t.name),i()}),s.onerror=Me(o),s.onblocked=t._fireOnBlocked};if(n)throw new V.InvalidArgument("Arguments not allowed in db.delete()");r.isBeingOpened?r.dbReadyPromise.then(a):a()})},e.prototype.backendDB=function(){return this.idbdb},e.prototype.isOpen=function(){return this.idbdb!==null},e.prototype.hasBeenClosed=function(){var t=this._state.dbOpenError;return t&&t.name==="DatabaseClosed"},e.prototype.hasFailed=function(){return this._state.dbOpenError!==null},e.prototype.dynamicallyOpened=function(){return this._state.autoSchema},Object.defineProperty(e.prototype,"tables",{get:function(){var t=this;return ne(this._allTables).map(function(n){return t._allTables[n]})},enumerable:!1,configurable:!0}),e.prototype.transaction=function(){var t=$p.apply(this,arguments);return this._transaction.apply(this,t)},e.prototype._transaction=function(t,n,r){var i=this,o=P.trans;(!o||o.db!==this||t.indexOf("!")!==-1)&&(o=null);var a=t.indexOf("?")!==-1;t=t.replace("!","").replace("?","");var s,l;try{if(l=n.map(function(c){var f=c instanceof i.Table?c.name:c;if(typeof f!="string")throw new TypeError("Invalid table argument to Dexie.transaction(). Only Table or String are allowed");return f}),t=="r"||t===li)s=li;else if(t=="rw"||t==ui)s=ui;else throw new V.InvalidArgument("Invalid transaction mode: "+t);if(o){if(o.mode===li&&s===ui)if(a)o=null;else throw new V.SubTransaction("Cannot enter a sub-transaction with READWRITE mode when parent transaction is READONLY");o&&l.forEach(function(c){if(o&&o.storeNames.indexOf(c)===-1)if(a)o=null;else throw new V.SubTransaction("Table "+c+" not included in parent transaction.")}),a&&o&&!o.active&&(o=null)}}catch(c){return o?o._promise(null,function(f,d){d(c)}):ie(c)}var u=El.bind(null,this,s,l,o,r);return o?o._promise(s,u,"lock"):P.trans?dn(P.transless,function(){return i._whenReady(u)}):this._whenReady(u)},e.prototype.table=function(t){if(!we(this._allTables,t))throw new V.InvalidTable("Table "+t+" does not exist");return this._allTables[t]},e}(),eh=typeof Symbol<"u"&&"observable"in Symbol?Symbol.observable:"@@observable",th=function(){function e(t){this._subscribe=t}return e.prototype.subscribe=function(t,n,r){return this._subscribe(!t||typeof t=="function"?{next:t,error:n,complete:r}:t)},e.prototype[eh]=function(){return this},e}();function Sl(e,t){return ne(t).forEach(function(n){var r=e[n]||(e[n]=new Ye);Ur(r,t[n])}),e}function nh(e){return new th(function(t){var n=Ro(e);function r(p){n&&cn();var h=function(){return mt(e,{subscr:p,trans:null})},v=P.trans?dn(P.transless,h):h();return n&&v.then(it,it),v}var i=!1,o={},a={},s={get closed(){return i},unsubscribe:function(){i=!0,yt.storagemutated.unsubscribe(f)}};t.start&&t.start(s);var l=!1,u=!1;function c(){return ne(a).some(function(p){return o[p]&&Zp(o[p],a[p])})}var f=function(p){Sl(o,p),c()&&d()},d=function(){if(!(l||i)){o={};var p={},h=r(p);u||(yt(Un,f),u=!0),l=!0,Promise.resolve(h).then(function(v){l=!1,!i&&(c()?d():(o={},a=p,t.next&&t.next(v)))},function(v){l=!1,t.error&&t.error(v),s.unsubscribe()})}};return d(),s})}var eo;try{eo={indexedDB:Q.indexedDB||Q.mozIndexedDB||Q.webkitIndexedDB||Q.msIndexedDB,IDBKeyRange:Q.IDBKeyRange||Q.webkitIDBKeyRange}}catch{eo={indexedDB:null,IDBKeyRange:null}}var It=Yt;Jt(It,K(K({},qr),{delete:function(e){var t=new It(e,{addons:[]});return t.delete()},exists:function(e){return new It(e,{addons:[]}).open().then(function(t){return t.close(),!0}).catch("NoSuchDatabaseError",function(){return!1})},getDatabaseNames:function(e){try{return Vp(It.dependencies).then(e)}catch{return ie(new V.MissingAPI)}},defineClass:function(){function e(t){me(this,t)}return e},ignoreTransaction:function(e){return P.trans?dn(P.transless,e):e()},vip:Zi,async:function(e){return function(){try{var t=Xi(e.apply(this,arguments));return!t||typeof t.then!="function"?A.resolve(t):t}catch(n){return ie(n)}}},spawn:function(e,t,n){try{var r=Xi(e.apply(n,t||[]));return!r||typeof r.then!="function"?A.resolve(r):r}catch(i){return ie(i)}},currentTransaction:{get:function(){return P.trans||null}},waitFor:function(e,t){var n=A.resolve(typeof e=="function"?It.ignoreTransaction(e):e).timeout(t||6e4);return P.trans?P.trans.waitFor(n):n},Promise:A,debug:{get:function(){return qe},set:function(e){tl(e,e==="dexie"?function(){return!0}:vl)}},derive:ln,extend:me,props:Jt,override:Ys,Events:qn,on:yt,liveQuery:nh,extendObservabilitySet:Sl,getByKeyPath:tt,setByKeyPath:Ae,delByKeyPath:Df,shallowClone:Xs,deepClone:Hn,getObjectDiff:Ko,cmp:ve,asap:Qs,minKey:Gi,addons:[],connections:Sn,errnames:Oo,dependencies:eo,semVer:Aa,version:Aa.split(".").map(function(e){return parseInt(e)}).reduce(function(e,t,n){return e+t/Math.pow(10,n*2)})}));It.maxKey=Dn(It.dependencies.IDBKeyRange);typeof dispatchEvent<"u"&&typeof addEventListener<"u"&&(yt(Un,function(e){if(!Je){var t;zr?(t=document.createEvent("CustomEvent"),t.initCustomEvent(dt,!0,!0,e)):t=new CustomEvent(dt,{detail:e}),Je=!0,dispatchEvent(t),Je=!1}}),addEventListener(dt,function(e){var t=e.detail;Je||Dr(t)}));function Dr(e){var t=Je;try{Je=!0,yt.storagemutated.fire(e)}finally{Je=t}}var Je=!1;if(typeof BroadcastChannel<"u"){var ar=new BroadcastChannel(dt);typeof ar.unref=="function"&&ar.unref(),yt(Un,function(e){Je||ar.postMessage(e)}),ar.onmessage=function(e){e.data&&Dr(e.data)}}else if(typeof self<"u"&&typeof navigator<"u"){yt(Un,function(e){try{Je||(typeof localStorage<"u"&&localStorage.setItem(dt,JSON.stringify({trig:Math.random(),changedParts:e})),typeof self.clients=="object"&&Ai([],self.clients.matchAll({includeUncontrolled:!0}),!0).forEach(function(t){return t.postMessage({type:dt,changedParts:e})}))}catch{}}),typeof addEventListener<"u"&&addEventListener("storage",function(e){if(e.key===dt){var t=JSON.parse(e.newValue);t&&Dr(t.changedParts)}});var Va=self.document&&navigator.serviceWorker;Va&&Va.addEventListener("message",rh)}function rh(e){var t=e.data;t&&t.type===dt&&Dr(t.changedParts)}A.rejectionMapper=Kf;tl(qe,vl);var Cl={exports:{}};(function(e,t){(function(n,r){e.exports=r()})(z,function(){var n=function(o,a){if(a=a||{},typeof o!="function")throw new i("fetch must be a function");if(typeof a!="object")throw new i("defaults must be an object");if(a.retries!==void 0&&!r(a.retries))throw new i("retries must be a positive integer");if(a.retryDelay!==void 0&&!r(a.retryDelay)&&typeof a.retryDelay!="function")throw new i("retryDelay must be a positive integer or a function returning a positive integer");if(a.retryOn!==void 0&&!Array.isArray(a.retryOn)&&typeof a.retryOn!="function")throw new i("retryOn property expects an array or function");var s={retries:3,retryDelay:1e3,retryOn:[]};return a=Object.assign(s,a),function(u,c){var f=a.retries,d=a.retryDelay,p=a.retryOn;if(c&&c.retries!==void 0)if(r(c.retries))f=c.retries;else throw new i("retries must be a positive integer");if(c&&c.retryDelay!==void 0)if(r(c.retryDelay)||typeof c.retryDelay=="function")d=c.retryDelay;else throw new i("retryDelay must be a positive integer or a function returning a positive integer");if(c&&c.retryOn)if(Array.isArray(c.retryOn)||typeof c.retryOn=="function")p=c.retryOn;else throw new i("retryOn property expects an array or function");return new Promise(function(h,v){var m=function(y){var E=typeof Request<"u"&&u instanceof Request?u.clone():u;o(E,c).then(function(_){if(Array.isArray(p)&&p.indexOf(_.status)===-1)h(_);else if(typeof p=="function")try{return Promise.resolve(p(y,null,_)).then(function(b){b?w(y,null,_):h(_)}).catch(v)}catch(b){v(b)}else y<f?w(y,null,_):h(_)}).catch(function(_){if(typeof p=="function")try{Promise.resolve(p(y,_,null)).then(function(b){b?w(y,_,null):v(_)}).catch(function(b){v(b)})}catch(b){v(b)}else y<f?w(y,_,null):v(_)})};function w(y,E,_){var b=typeof d=="function"?d(y,E,_):d;setTimeout(function(){m(++y)},b)}m(0)})}};function r(o){return Number.isInteger(o)&&o>=0}function i(o){this.name="ArgumentError",this.message=o}return n})})(Cl);const ih=Cl.exports;class oh{constructor(t){ce(this,"awaitingResolvers",[]);ce(this,"activeCount",0);this.capacity=t}async acquire(){if(this.activeCount<this.capacity){this.activeCount++;return}return new Promise(t=>{this.awaitingResolvers.push(t)})}release(){const t=this.awaitingResolvers.shift();t&&this.activeCount<=this.capacity?t():this.activeCount--}async execute(t){try{return await this.acquire(),await t()}finally{this.release()}}setLimit(t){this.capacity=t}}const Il=new oh(2),ah=e=>Il.setLimit(e),sh=ih(fetch),lh=async(e,t=3)=>Il.execute(async()=>{const r=(await sh(e.uploadUrl,{body:e.data,method:"PUT",retries:t,retryDelay:i=>Math.pow(2,i)*1e3})).headers.get("ETag");if(!r)throw new Error(`Upload response did not include etag for upload ${e.uploadId}, part ${e.chunkIndex}`);return r}),uh=async({apiUrl:e,surveyId:t,uploadId:n,etags:r,headers:i,responseGroupUuid:o,replayDuration:a})=>He(`${e}/sdk/1/completeSessionReplay`,{method:"POST",body:JSON.stringify({etags:r,uploadId:n,responseGroupUuid:o,surveyId:t,replayDuration:a}),headers:i});var fn=(e=>(e.ReadyForUpload="ReadyForUpload",e.UploadComplete="UploadComplete",e))(fn||{}),Nn=(e=>(e.After="after",e.Before="before",e.BeforeAndAfter="beforeAndAfter",e))(Nn||{});const Fa="sprig.sessionId",kl="sprig.disableReplayRecording",Tl=()=>{sessionStorage.setItem(kl,"disabled")},en=()=>!!sessionStorage.getItem(kl),Ba=(e,t,n)=>{en()||(Ll(),Tl()),t instanceof Error&&window.UserLeap.reportError(e,t,n)},bt=(e,t)=>{var n,r;(r=(n=window.navigator)==null?void 0:n.storage)!=null&&r.estimate?window.navigator.storage.estimate().then(i=>{Ba(e,t,i)}).catch(i=>{window.UserLeap.reportError("Error getting storage estimate: ",i)}):Ba(e,t)},ch=()=>{const e=sessionStorage.getItem(Fa);if(e)return e;const t=vt();return sessionStorage.setItem(Fa,t),t},ot=ch(),Ll=()=>{Promise.all([oe.events.clear(),oe.chunkUploads.clear(),oe.pendingCaptures.clear()]).catch(e=>{window.UserLeap.reportError("Error wiping database: ",e)})},hi=(e,t)=>oe.table(t).where("timestamp").below(e).delete(),dh=()=>{oe.events.where("sessionId").equals(ot).delete(),oe.pendingCaptures.where("sessionId").equals(ot).delete()},fh=e=>{const t=e.map(n=>{var r;return{...n,sessionId:(r=n.sessionId)!=null?r:ot}});return oe.events.bulkAdd(t)},ph=e=>oe.events.where("[sessionId+timestamp]").between([ot,e],[ot,Number.MAX_VALUE]).toArray(),hh=e=>{var t;return oe.chunkUploads.add({...e,sessionId:(t=e.sessionId)!=null?t:ot})},vh=(e,t)=>oe.chunkUploads.update(e,{data:null,etag:t,status:fn.UploadComplete}),mh=({status:e,uploadId:t})=>t?oe.chunkUploads.where({uploadId:t,status:e}).toArray():oe.chunkUploads.where({sessionId:ot,status:e}).toArray(),gh=e=>oe.chunkUploads.where({uploadId:e,status:fn.UploadComplete}).toArray(),yh=e=>oe.chunkUploads.where({uploadId:e,status:fn.UploadComplete}).delete(),_h=e=>{var t;return oe.pendingCaptures.add({...e,sessionId:(t=e.sessionId)!=null?t:ot})},wh=()=>oe.pendingCaptures.where("sessionId").equals(ot).and(e=>e.targetTimestamp<Date.now()).toArray();class bh extends Yt{constructor(){super("replayStorage",{autoOpen:!1});ce(this,"events");ce(this,"chunkUploads");ce(this,"pendingCaptures")}}const oe=new bh;oe.version(1).stores({events:"uuid, timestamp, [sessionId+timestamp]",chunkUploads:"uuid, timestamp, [sessionId+status], [uploadId+status], [sessionId+status+uploadId]",pendingCaptures:"uuid, timestamp, [sessionId+targetTimestamp]"});oe.open().catch(e=>{window.UserLeap.reportError("Error opening replay db",e),Tl()});const Eh=async(e,t,n)=>new Promise((r,i)=>{const o=e.createElement("script");o.src=t,o.onload=r,o.onerror=i,n&&(o.nonce=n),e.head.appendChild(o)});let Rl=5e3;const xh=5,Al=30,to=Al+xh,Go="sprig.pendingCount",Sh=sessionStorage.getItem("sprig.sessionId"),Ch=async(e,t,n,r=2,i)=>{try{if(await Yt.exists("sprig.replay")&&await Yt.delete("sprig.replay"),en())return;if(!t){await Yt.exists("replayStorage")&&Ll();return}i!=null&&i.minDuration&&(Rl=i.minDuration),ah(r),Uh(),Th(t+to,30*60,t+to),Lh();const o=window;o.rrwebRecord||await Eh(e,"https://cdn.sprig.com/dependencies/record-2.0.0-alpha.6.min.js",n);const a=o.rrwebRecord;if(!a)return;let s=!0;a({checkoutEveryNms:Al*1e3,sampling:{input:"last",scroll:250,media:800},emit:(l,u)=>{if(en())return;const c=s||!!u;s=!1,Ih({uuid:vt(),event:JSON.stringify(l),isValidStart:c,timestamp:Date.now()})},...i})}catch(o){bt("Error initializing replay: ",o)}};let no=!1,ro=[];const Ih=e=>{ro.push(e),no||kh()},kh=()=>{no=!0,setTimeout(async()=>{if(en())return;const e=ro;ro=[],no=!1;try{fh(e)}catch(t){bt("Error storing replay events: ",t)}},500)},Th=(e=6*60,t=30*60,n=4*60)=>{setInterval(async()=>{const r=Date.now();try{await Promise.all([hi(r-e*1e3,"events"),hi(r-t*1e3,"chunkUploads"),hi(r-n*1e3,"pendingCaptures")])}catch(i){bt("Error deleting table rows: ",i)}},30*1e3)},Lh=(e=5)=>{setInterval(Nh,e*1e3)},Rh=async e=>{try{const t=await ph(Date.now()-(e+to)*1e3);if(!(t!=null&&t.length))return;let n=-1;const r=Date.now()-e*1e3;return t==null||t.forEach((i,o)=>{if(!i.isValidStart)return;const a=i.timestamp<=r;(n<0||a)&&(n=o)}),n<0?[]:t==null?void 0:t.slice(n)}catch(t){bt("Error getting events for capture: ",t)}},Ah=async e=>{const t=`[${e.map(i=>i.event).join(",")}]`,r=new TextEncoder().encode(t);try{if(window.CompressionStream===void 0)return r;const i=new CompressionStream("gzip"),o=i.writable.getWriter();return o.write(r),o.close(),new Uint8Array(await new Response(i.readable).arrayBuffer())}catch(i){return i instanceof Error&&window.UserLeap.reportError("Error compressing replay for upload",i),r}},Oh=(e,t,n)=>{const r=e.length,i=t*1024*1024,o=Math.ceil(r/n),a=Math.max(i,o),s=[];let l=0;for(;l<r;)s.push(e.slice(l,l+a)),l+=a;return s},Ol=e=>Promise.all(e.map(async t=>{const n=await lh(t);return await vh(t.uuid,n),t.uploadId})),Ul=async e=>{const t=await gh(e);if(!(t!=null&&t.length))return;t.sort((i,o)=>i.chunkIndex-o.chunkIndex);const n=t.map(i=>({ETag:i.etag,PartNumber:i.chunkIndex})).filter(i=>i.ETag!==null),r=t[0];await uh({apiUrl:r.apiUrl,surveyId:r.surveyId,uploadId:e,responseGroupUuid:r.responseGroupId,etags:n,headers:r.completeUploadHeaders,replayDuration:r.replayDuration}),await yh(e)},Uh=async()=>{try{const e=await mh({status:fn.ReadyForUpload});if(!(e!=null&&e.length))return;const t=await Ol(e);t!=null&&t.length&&await Promise.all(t.map(async n=>{n&&await Ul(n)}))}catch(e){bt("Error getting chunk upload uuids: ",e)}},Dh=async(e,t)=>{await Ol(t),await Promise.all(e.map(n=>Ul(n)))},Dl=async e=>{if(!en())try{const{surveyId:t,responseGroupId:n,visitorId:r,apiUrl:i,completeUploadHeaders:o,replayParams:a}=e;if(a.replayDurationType===Nn.After||a.replayDurationType===Nn.BeforeAndAfter)return Ph(e);const s=await Rh(a.replayDurationSeconds);if(!(s!=null&&s.length))return;const l=s[s.length-1].timestamp-s[0].timestamp;if(l<=Rl)return;const u=await Ah(s),c=Oh(u,a.minimumChunkSizeMb,a.signedUrls.length),f=Date.now(),d=await Promise.all(c.map(async(p,h)=>{const v=vt(),m={apiUrl:i,chunkIndex:h+1,completeUploadHeaders:o,etag:null,replayDuration:l,responseGroupId:n,sessionId:Sh,status:fn.ReadyForUpload,surveyId:t,timestamp:f,totalChunks:c.length,data:p,uploadId:a.uploadId,uploadUrl:a.signedUrls[h].url,uuid:v,visitorId:r};return await hh(m),m}));await Dh([a.uploadId],d)}catch(t){bt("Error scheduling or capturing replay",t)}},Ha=()=>{if(!en())try{dh()}catch(e){bt("Error clearing session event data: ",e)}};let Ze=sessionStorage.getItem(Go);const Ph=e=>{const t={...e,replayParams:{...e.replayParams}};e.replayParams.replayDurationType===Nn.BeforeAndAfter&&(t.replayParams.replayDurationSeconds*=2),t.replayParams.replayDurationType=Nn.Before;const n=Date.now()+e.replayParams.replayDurationSeconds*1e3;return Ze=Ze?(parseInt(Ze)+1).toString():"1",sessionStorage.setItem(Go,Ze),_h({uuid:vt(),targetTimestamp:n,timestamp:Date.now(),captureParams:t})},Nh=async()=>{try{if(Ze&&parseInt(Ze)>0){const e=await wh();e.length&&await Promise.all(e.map(async t=>{await oe.pendingCaptures.delete(t.uuid),await Dl(t.captureParams)})),Ze=(parseInt(Ze)-e.length).toString(),sessionStorage.setItem(Go,Ze)}}catch(e){bt("Error initiating pending captures",e)}};var Wn,D,Pl,tn,kt,Ka,Nl,Ml,Pr={},jl=[],Mh=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i;function et(e,t){for(var n in t)e[n]=t[n];return e}function Vl(e){var t=e.parentNode;t&&t.removeChild(e)}function ee(e,t,n){var r,i,o,a={};for(o in t)o=="key"?r=t[o]:o=="ref"?i=t[o]:a[o]=t[o];if(arguments.length>2&&(a.children=arguments.length>3?Wn.call(arguments,2):n),typeof e=="function"&&e.defaultProps!=null)for(o in e.defaultProps)a[o]===void 0&&(a[o]=e.defaultProps[o]);return In(e,a,r,i,null)}function In(e,t,n,r,i){var o={type:e,props:t,key:n,ref:r,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,__h:null,constructor:void 0,__v:i==null?++Pl:i};return i==null&&D.vnode!=null&&D.vnode(o),o}function Fl(){return{current:null}}function De(e){return e.children}function jh(e,t,n,r,i){var o;for(o in n)o==="children"||o==="key"||o in t||Nr(e,o,null,n[o],r);for(o in t)i&&typeof t[o]!="function"||o==="children"||o==="key"||o==="value"||o==="checked"||n[o]===t[o]||Nr(e,o,t[o],n[o],r)}function $a(e,t,n){t[0]==="-"?e.setProperty(t,n==null?"":n):e[t]=n==null?"":typeof n!="number"||Mh.test(t)?n:n+"px"}function Nr(e,t,n,r,i){var o;e:if(t==="style")if(typeof n=="string")e.style.cssText=n;else{if(typeof r=="string"&&(e.style.cssText=r=""),r)for(t in r)n&&t in n||$a(e.style,t,"");if(n)for(t in n)r&&n[t]===r[t]||$a(e.style,t,n[t])}else if(t[0]==="o"&&t[1]==="n")o=t!==(t=t.replace(/Capture$/,"")),t=t.toLowerCase()in e?t.toLowerCase().slice(2):t.slice(2),e.l||(e.l={}),e.l[t+o]=n,n?r||e.addEventListener(t,o?qa:Ga,o):e.removeEventListener(t,o?qa:Ga,o);else if(t!=="dangerouslySetInnerHTML"){if(i)t=t.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(t!=="width"&&t!=="height"&&t!=="href"&&t!=="list"&&t!=="form"&&t!=="tabIndex"&&t!=="download"&&t in e)try{e[t]=n==null?"":n;break e}catch{}typeof n=="function"||(n==null||n===!1&&t.indexOf("-")==-1?e.removeAttribute(t):e.setAttribute(t,n))}}function Ga(e){tn=!0;try{return this.l[e.type+!1](D.event?D.event(e):e)}finally{tn=!1}}function qa(e){tn=!0;try{return this.l[e.type+!0](D.event?D.event(e):e)}finally{tn=!1}}function Oe(e,t){this.props=e,this.context=t}function Mn(e,t){if(t==null)return e.__?Mn(e.__,e.__.__k.indexOf(e)+1):null;for(var n;t<e.__k.length;t++)if((n=e.__k[t])!=null&&n.__e!=null)return n.__e;return typeof e.type=="function"?Mn(e):null}function Bl(e){var t,n;if((e=e.__)!=null&&e.__c!=null){for(e.__e=e.__c.base=null,t=0;t<e.__k.length;t++)if((n=e.__k[t])!=null&&n.__e!=null){e.__e=e.__c.base=n.__e;break}return Bl(e)}}function Vh(e){tn?setTimeout(e):Nl(e)}function io(e){(!e.__d&&(e.__d=!0)&&kt.push(e)&&!Mr.__r++||Ka!==D.debounceRendering)&&((Ka=D.debounceRendering)||Vh)(Mr)}function Mr(){var e,t,n,r,i,o,a,s;for(kt.sort(function(l,u){return l.__v.__b-u.__v.__b});e=kt.shift();)e.__d&&(t=kt.length,r=void 0,i=void 0,a=(o=(n=e).__v).__e,(s=n.__P)&&(r=[],(i=et({},o)).__v=o.__v+1,qo(s,o,i,n.__n,s.ownerSVGElement!==void 0,o.__h!=null?[a]:null,r,a==null?Mn(o):a,o.__h),ql(r,o),o.__e!=a&&Bl(o)),kt.length>t&&kt.sort(function(l,u){return l.__v.__b-u.__v.__b}));Mr.__r=0}function Hl(e,t,n,r,i,o,a,s,l,u){var c,f,d,p,h,v,m,w=r&&r.__k||jl,y=w.length;for(n.__k=[],c=0;c<t.length;c++)if((p=n.__k[c]=(p=t[c])==null||typeof p=="boolean"?null:typeof p=="string"||typeof p=="number"||typeof p=="bigint"?In(null,p,null,null,p):Array.isArray(p)?In(De,{children:p},null,null,null):p.__b>0?In(p.type,p.props,p.key,p.ref?p.ref:null,p.__v):p)!=null){if(p.__=n,p.__b=n.__b+1,(d=w[c])===null||d&&p.key==d.key&&p.type===d.type)w[c]=void 0;else for(f=0;f<y;f++){if((d=w[f])&&p.key==d.key&&p.type===d.type){w[f]=void 0;break}d=null}qo(e,p,d=d||Pr,i,o,a,s,l,u),h=p.__e,(f=p.ref)&&d.ref!=f&&(m||(m=[]),d.ref&&m.push(d.ref,null,p),m.push(f,p.__c||h,p)),h!=null?(v==null&&(v=h),typeof p.type=="function"&&p.__k===d.__k?p.__d=l=Kl(p,l,e):l=$l(e,p,d,w,h,l),typeof n.type=="function"&&(n.__d=l)):l&&d.__e==l&&l.parentNode!=e&&(l=Mn(d))}for(n.__e=v,c=y;c--;)w[c]!=null&&(typeof n.type=="function"&&w[c].__e!=null&&w[c].__e==n.__d&&(n.__d=Gl(r).nextSibling),Wl(w[c],w[c]));if(m)for(c=0;c<m.length;c++)zl(m[c],m[++c],m[++c])}function Kl(e,t,n){for(var r,i=e.__k,o=0;i&&o<i.length;o++)(r=i[o])&&(r.__=e,t=typeof r.type=="function"?Kl(r,t,n):$l(n,r,r,i,r.__e,t));return t}function nt(e,t){return t=t||[],e==null||typeof e=="boolean"||(Array.isArray(e)?e.some(function(n){nt(n,t)}):t.push(e)),t}function $l(e,t,n,r,i,o){var a,s,l;if(t.__d!==void 0)a=t.__d,t.__d=void 0;else if(n==null||i!=o||i.parentNode==null)e:if(o==null||o.parentNode!==e)e.appendChild(i),a=null;else{for(s=o,l=0;(s=s.nextSibling)&&l<r.length;l+=1)if(s==i)break e;e.insertBefore(i,o),a=o}return a!==void 0?a:i.nextSibling}function Gl(e){var t,n,r;if(e.type==null||typeof e.type=="string")return e.__e;if(e.__k){for(t=e.__k.length-1;t>=0;t--)if((n=e.__k[t])&&(r=Gl(n)))return r}return null}function qo(e,t,n,r,i,o,a,s,l){var u,c,f,d,p,h,v,m,w,y,E,_,b,S,x,I=t.type;if(t.constructor!==void 0)return null;n.__h!=null&&(l=n.__h,s=t.__e=n.__e,t.__h=null,o=[s]),(u=D.__b)&&u(t);try{e:if(typeof I=="function"){if(m=t.props,w=(u=I.contextType)&&r[u.__c],y=u?w?w.props.value:u.__:r,n.__c?v=(c=t.__c=n.__c).__=c.__E:("prototype"in I&&I.prototype.render?t.__c=c=new I(m,y):(t.__c=c=new Oe(m,y),c.constructor=I,c.render=Bh),w&&w.sub(c),c.props=m,c.state||(c.state={}),c.context=y,c.__n=r,f=c.__d=!0,c.__h=[],c._sb=[]),c.__s==null&&(c.__s=c.state),I.getDerivedStateFromProps!=null&&(c.__s==c.state&&(c.__s=et({},c.__s)),et(c.__s,I.getDerivedStateFromProps(m,c.__s))),d=c.props,p=c.state,c.__v=t,f)I.getDerivedStateFromProps==null&&c.componentWillMount!=null&&c.componentWillMount(),c.componentDidMount!=null&&c.__h.push(c.componentDidMount);else{if(I.getDerivedStateFromProps==null&&m!==d&&c.componentWillReceiveProps!=null&&c.componentWillReceiveProps(m,y),!c.__e&&c.shouldComponentUpdate!=null&&c.shouldComponentUpdate(m,c.__s,y)===!1||t.__v===n.__v){for(t.__v!==n.__v&&(c.props=m,c.state=c.__s,c.__d=!1),t.__e=n.__e,t.__k=n.__k,t.__k.forEach(function(k){k&&(k.__=t)}),E=0;E<c._sb.length;E++)c.__h.push(c._sb[E]);c._sb=[],c.__h.length&&a.push(c);break e}c.componentWillUpdate!=null&&c.componentWillUpdate(m,c.__s,y),c.componentDidUpdate!=null&&c.__h.push(function(){c.componentDidUpdate(d,p,h)})}if(c.context=y,c.props=m,c.__P=e,_=D.__r,b=0,"prototype"in I&&I.prototype.render){for(c.state=c.__s,c.__d=!1,_&&_(t),u=c.render(c.props,c.state,c.context),S=0;S<c._sb.length;S++)c.__h.push(c._sb[S]);c._sb=[]}else do c.__d=!1,_&&_(t),u=c.render(c.props,c.state,c.context),c.state=c.__s;while(c.__d&&++b<25);c.state=c.__s,c.getChildContext!=null&&(r=et(et({},r),c.getChildContext())),f||c.getSnapshotBeforeUpdate==null||(h=c.getSnapshotBeforeUpdate(d,p)),x=u!=null&&u.type===De&&u.key==null?u.props.children:u,Hl(e,Array.isArray(x)?x:[x],t,n,r,i,o,a,s,l),c.base=t.__e,t.__h=null,c.__h.length&&a.push(c),v&&(c.__E=c.__=null),c.__e=!1}else o==null&&t.__v===n.__v?(t.__k=n.__k,t.__e=n.__e):t.__e=Fh(n.__e,t,n,r,i,o,a,l);(u=D.diffed)&&u(t)}catch(k){t.__v=null,(l||o!=null)&&(t.__e=s,t.__h=!!l,o[o.indexOf(s)]=null),D.__e(k,t,n)}}function ql(e,t){D.__c&&D.__c(t,e),e.some(function(n){try{e=n.__h,n.__h=[],e.some(function(r){r.call(n)})}catch(r){D.__e(r,n.__v)}})}function Fh(e,t,n,r,i,o,a,s){var l,u,c,f=n.props,d=t.props,p=t.type,h=0;if(p==="svg"&&(i=!0),o!=null){for(;h<o.length;h++)if((l=o[h])&&"setAttribute"in l==!!p&&(p?l.localName===p:l.nodeType===3)){e=l,o[h]=null;break}}if(e==null){if(p===null)return document.createTextNode(d);e=i?document.createElementNS("http://www.w3.org/2000/svg",p):document.createElement(p,d.is&&d),o=null,s=!1}if(p===null)f===d||s&&e.data===d||(e.data=d);else{if(o=o&&Wn.call(e.childNodes),u=(f=n.props||Pr).dangerouslySetInnerHTML,c=d.dangerouslySetInnerHTML,!s){if(o!=null)for(f={},h=0;h<e.attributes.length;h++)f[e.attributes[h].name]=e.attributes[h].value;(c||u)&&(c&&(u&&c.__html==u.__html||c.__html===e.innerHTML)||(e.innerHTML=c&&c.__html||""))}if(jh(e,d,f,i,s),c)t.__k=[];else if(h=t.props.children,Hl(e,Array.isArray(h)?h:[h],t,n,r,i&&p!=="foreignObject",o,a,o?o[0]:n.__k&&Mn(n,0),s),o!=null)for(h=o.length;h--;)o[h]!=null&&Vl(o[h]);s||("value"in d&&(h=d.value)!==void 0&&(h!==e.value||p==="progress"&&!h||p==="option"&&h!==f.value)&&Nr(e,"value",h,f.value,!1),"checked"in d&&(h=d.checked)!==void 0&&h!==e.checked&&Nr(e,"checked",h,f.checked,!1))}return e}function zl(e,t,n){try{typeof e=="function"?e(t):e.current=t}catch(r){D.__e(r,n)}}function Wl(e,t,n){var r,i;if(D.unmount&&D.unmount(e),(r=e.ref)&&(r.current&&r.current!==e.__e||zl(r,null,t)),(r=e.__c)!=null){if(r.componentWillUnmount)try{r.componentWillUnmount()}catch(o){D.__e(o,t)}r.base=r.__P=null,e.__c=void 0}if(r=e.__k)for(i=0;i<r.length;i++)r[i]&&Wl(r[i],t,n||typeof e.type!="function");n||e.__e==null||Vl(e.__e),e.__=e.__e=e.__d=void 0}function Bh(e,t,n){return this.constructor(e,n)}function nn(e,t,n){var r,i,o;D.__&&D.__(e,t),i=(r=typeof n=="function")?null:n&&n.__k||t.__k,o=[],qo(t,e=(!r&&n||t).__k=ee(De,null,[e]),i||Pr,Pr,t.ownerSVGElement!==void 0,!r&&n?[n]:i?null:t.firstChild?Wn.call(t.childNodes):null,o,!r&&n?n:i?i.__e:t.firstChild,r),ql(o,e)}function Yl(e,t){nn(e,t,Yl)}function Hh(e,t,n){var r,i,o,a=et({},e.props);for(o in t)o=="key"?r=t[o]:o=="ref"?i=t[o]:a[o]=t[o];return arguments.length>2&&(a.children=arguments.length>3?Wn.call(arguments,2):n),In(e.type,a,r||e.key,i||e.ref,null)}function Ql(e,t){var n={__c:t="__cC"+Ml++,__:e,Consumer:function(r,i){return r.children(i)},Provider:function(r){var i,o;return this.getChildContext||(i=[],(o={})[t]=this,this.getChildContext=function(){return o},this.shouldComponentUpdate=function(a){this.props.value!==a.value&&i.some(function(s){s.__e=!0,io(s)})},this.sub=function(a){i.push(a);var s=a.componentWillUnmount;a.componentWillUnmount=function(){i.splice(i.indexOf(a),1),s&&s.call(a)}}),r.children}};return n.Provider.__=n.Consumer.contextType=n}Wn=jl.slice,D={__e:function(e,t,n,r){for(var i,o,a;t=t.__;)if((i=t.__c)&&!i.__)try{if((o=i.constructor)&&o.getDerivedStateFromError!=null&&(i.setState(o.getDerivedStateFromError(e)),a=i.__d),i.componentDidCatch!=null&&(i.componentDidCatch(e,r||{}),a=i.__d),a)return i.__E=i}catch(s){e=s}throw e}},Pl=0,tn=!1,Oe.prototype.setState=function(e,t){var n;n=this.__s!=null&&this.__s!==this.state?this.__s:this.__s=et({},this.state),typeof e=="function"&&(e=e(et({},n),this.props)),e&&et(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),io(this))},Oe.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),io(this))},Oe.prototype.render=De,kt=[],Nl=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,Mr.__r=0,Ml=0;var N=(e=>(e.ConsentLegal="consentlegal",e.Likert="likert",e.MultipleChoice="multiplechoice",e.MultipleSelect="multipleselect",e.NPS="nps",e.Open="open",e.RecordedTask="recordedtask",e.TextUrlPrompt="texturlprompt",e.Thanks="thanks",e.Uploading="uploading",e.VideoVoice="videovoice",e))(N||{}),Dt=(e=>(e.Answered="answered",e.Equal="eq",e.NotEqual="neq",e.Skipped="skipped",e.LessThan="lt",e.LessThanOrEqual="lte",e.GivenUp="given_up",e.GreaterThan="gt",e.GreaterThanOrEqual="gte",e.ListAll="list_all",e.ListAtLeastOne="list_alo",e.ListExact="list_exact",e))(Dt||{}),rn=(e=>(e.Camera="camera",e.Microphone="microphone",e.Screen="screen",e))(rn||{}),Se=(e=>(e.AvPermission="av_permission",e.ScreenPermission="screen_permission",e.StartTask="start_task",e.CompleteTask="complete_task",e))(Se||{}),At=(e=>(e.Number="number",e.Smiley="smiley",e.Star="star",e))(At||{}),Le=(e=>(e.Video="video",e.Audio="audio",e.Screen="screen",e))(Le||{}),de=(e=>(e.PermissionStatus="permission.status",e.AvPermission="av.permission",e.ScreenPermission="screen.permission",e.BeginRecording="begin.recording",e.StartTask="start.task",e.FinishTask="finish.task",e))(de||{}),Ue=(e=>(e.Abandoned="abandoned",e.GivenUp="given.up",e.Completed="completed",e))(Ue||{}),$=(e=>(e.ScreenPermissionRequested="screen.permission.requested",e.PermissionDescriptors="permission.descriptors",e.PermissionStatusCallback="permission.status.callback",e.StreamReadyCallback="stream.ready.callback",e.StreamCanceledCallback="stream.canceled.callback",e.TaskCompleteCallback="task.complete.callback",e.TaskResponse="task.response",e.TaskStatus="task.status",e.RecordingMediaTypes="recording.media.types",e.StartRecordingCallback="start.recording.callback",e.PassthroughData="passthrough.data",e.CurrentIndex="current.index",e.UploadCallback="upload.callback",e.ProgressCallback="progress.callback",e.BeginCallback="begin.callback",e))($||{});const za=e=>{let t;const n=new Set,r=(l,u)=>{const c=typeof l=="function"?l(t):l;if(!Object.is(c,t)){const f=t;t=(u!=null?u:typeof c!="object")?c:Object.assign({},t,c),n.forEach(d=>d(t,f))}},i=()=>t,s={setState:r,getState:i,subscribe:l=>(n.add(l),()=>n.delete(l)),destroy:()=>n.clear()};return t=e(r,i,s),s},Kh=e=>e?za(e):za;var Et,Z,vi,Wa,on=0,Zl=[],vr=[],Ya=D.__b,Qa=D.__r,Za=D.diffed,Xa=D.__c,Ja=D.unmount;function Ft(e,t){D.__h&&D.__h(Z,e,on||t),on=0;var n=Z.__H||(Z.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({__V:vr}),n.__[e]}function ue(e){return on=1,zo(nu,e)}function zo(e,t,n){var r=Ft(Et++,2);if(r.t=e,!r.__c&&(r.__=[n?n(t):nu(void 0,t),function(o){var a=r.__N?r.__N[0]:r.__[0],s=r.t(a,o);a!==s&&(r.__N=[s,r.__[1]],r.__c.setState({}))}],r.__c=Z,!Z.u)){Z.u=!0;var i=Z.shouldComponentUpdate;Z.shouldComponentUpdate=function(o,a,s){if(!r.__c.__H)return!0;var l=r.__c.__H.__.filter(function(c){return c.__c});if(l.every(function(c){return!c.__N}))return!i||i.call(this,o,a,s);var u=!1;return l.forEach(function(c){if(c.__N){var f=c.__[0];c.__=c.__N,c.__N=void 0,f!==c.__[0]&&(u=!0)}}),!(!u&&r.__c.props===o)&&(!i||i.call(this,o,a,s))}}return r.__N||r.__}function Ce(e,t){var n=Ft(Et++,3);!D.__s&&Yo(n.__H,t)&&(n.__=e,n.i=t,Z.__H.__h.push(n))}function Yn(e,t){var n=Ft(Et++,4);!D.__s&&Yo(n.__H,t)&&(n.__=e,n.i=t,Z.__h.push(n))}function _t(e){return on=5,Yr(function(){return{current:e}},[])}function Xl(e,t,n){on=6,Yn(function(){return typeof e=="function"?(e(t()),function(){return e(null)}):e?(e.current=t(),function(){return e.current=null}):void 0},n==null?n:n.concat(e))}function Yr(e,t){var n=Ft(Et++,7);return Yo(n.__H,t)?(n.__V=e(),n.i=t,n.__h=e,n.__V):n.__}function Jl(e,t){return on=8,Yr(function(){return e},t)}function eu(e){var t=Z.context[e.__c],n=Ft(Et++,9);return n.c=e,t?(n.__==null&&(n.__=!0,t.sub(Z)),t.props.value):e.__}function Wo(e,t){D.useDebugValue&&D.useDebugValue(t?t(e):e)}function $h(e){var t=Ft(Et++,10),n=ue();return t.__=e,Z.componentDidCatch||(Z.componentDidCatch=function(r,i){t.__&&t.__(r,i),n[1](r)}),[n[0],function(){n[1](void 0)}]}function tu(){var e=Ft(Et++,11);if(!e.__){for(var t=Z.__v;t!==null&&!t.__m&&t.__!==null;)t=t.__;var n=t.__m||(t.__m=[0,0]);e.__="P"+n[0]+"-"+n[1]++}return e.__}function Gh(){for(var e;e=Zl.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach(mr),e.__H.__h.forEach(oo),e.__H.__h=[]}catch(t){e.__H.__h=[],D.__e(t,e.__v)}}D.__b=function(e){Z=null,Ya&&Ya(e)},D.__r=function(e){Qa&&Qa(e),Et=0;var t=(Z=e.__c).__H;t&&(vi===Z?(t.__h=[],Z.__h=[],t.__.forEach(function(n){n.__N&&(n.__=n.__N),n.__V=vr,n.__N=n.i=void 0})):(t.__h.forEach(mr),t.__h.forEach(oo),t.__h=[])),vi=Z},D.diffed=function(e){Za&&Za(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(Zl.push(t)!==1&&Wa===D.requestAnimationFrame||((Wa=D.requestAnimationFrame)||qh)(Gh)),t.__H.__.forEach(function(n){n.i&&(n.__H=n.i),n.__V!==vr&&(n.__=n.__V),n.i=void 0,n.__V=vr})),vi=Z=null},D.__c=function(e,t){t.some(function(n){try{n.__h.forEach(mr),n.__h=n.__h.filter(function(r){return!r.__||oo(r)})}catch(r){t.some(function(i){i.__h&&(i.__h=[])}),t=[],D.__e(r,n.__v)}}),Xa&&Xa(e,t)},D.unmount=function(e){Ja&&Ja(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.forEach(function(r){try{mr(r)}catch(i){t=i}}),n.__H=void 0,t&&D.__e(t,n.__v))};var es=typeof requestAnimationFrame=="function";function qh(e){var t,n=function(){clearTimeout(r),es&&cancelAnimationFrame(t),setTimeout(e)},r=setTimeout(n,100);es&&(t=requestAnimationFrame(n))}function mr(e){var t=Z,n=e.__c;typeof n=="function"&&(e.__c=void 0,n()),Z=t}function oo(e){var t=Z;e.__c=e.__(),Z=t}function Yo(e,t){return!e||e.length!==t.length||t.some(function(n,r){return n!==e[r]})}function nu(e,t){return typeof t=="function"?t(e):t}function ru(e,t){for(var n in t)e[n]=t[n];return e}function ao(e,t){for(var n in e)if(n!=="__source"&&!(n in t))return!0;for(var r in t)if(r!=="__source"&&e[r]!==t[r])return!0;return!1}function mi(e,t){return e===t&&(e!==0||1/e==1/t)||e!=e&&t!=t}function jr(e){this.props=e}function iu(e,t){function n(i){var o=this.props.ref,a=o==i.ref;return!a&&o&&(o.call?o(null):o.current=null),t?!t(this.props,i)||!a:ao(this.props,i)}function r(i){return this.shouldComponentUpdate=n,ee(e,i)}return r.displayName="Memo("+(e.displayName||e.name)+")",r.prototype.isReactComponent=!0,r.__f=!0,r}(jr.prototype=new Oe).isPureReactComponent=!0,jr.prototype.shouldComponentUpdate=function(e,t){return ao(this.props,e)||ao(this.state,t)};var ts=D.__b;D.__b=function(e){e.type&&e.type.__f&&e.ref&&(e.props.ref=e.ref,e.ref=null),ts&&ts(e)};var zh=typeof Symbol<"u"&&Symbol.for&&Symbol.for("react.forward_ref")||3911;function ou(e){function t(n){var r=ru({},n);return delete r.ref,e(r,n.ref||null)}return t.$$typeof=zh,t.render=t,t.prototype.isReactComponent=t.__f=!0,t.displayName="ForwardRef("+(e.displayName||e.name)+")",t}var ns=function(e,t){return e==null?null:nt(nt(e).map(t))},au={map:ns,forEach:ns,count:function(e){return e?nt(e).length:0},only:function(e){var t=nt(e);if(t.length!==1)throw"Children.only";return t[0]},toArray:nt},Wh=D.__e;D.__e=function(e,t,n,r){if(e.then){for(var i,o=t;o=o.__;)if((i=o.__c)&&i.__c)return t.__e==null&&(t.__e=n.__e,t.__k=n.__k),i.__c(e,t)}Wh(e,t,n,r)};var rs=D.unmount;function su(e,t,n){return e&&(e.__c&&e.__c.__H&&(e.__c.__H.__.forEach(function(r){typeof r.__c=="function"&&r.__c()}),e.__c.__H=null),(e=ru({},e)).__c!=null&&(e.__c.__P===n&&(e.__c.__P=t),e.__c=null),e.__k=e.__k&&e.__k.map(function(r){return su(r,t,n)})),e}function lu(e,t,n){return e&&(e.__v=null,e.__k=e.__k&&e.__k.map(function(r){return lu(r,t,n)}),e.__c&&e.__c.__P===t&&(e.__e&&n.insertBefore(e.__e,e.__d),e.__c.__e=!0,e.__c.__P=n)),e}function kn(){this.__u=0,this.t=null,this.__b=null}function uu(e){var t=e.__.__c;return t&&t.__a&&t.__a(e)}function cu(e){var t,n,r;function i(o){if(t||(t=e()).then(function(a){n=a.default||a},function(a){r=a}),r)throw r;if(!n)throw t;return ee(n,o)}return i.displayName="Lazy",i.__f=!0,i}function Gt(){this.u=null,this.o=null}D.unmount=function(e){var t=e.__c;t&&t.__R&&t.__R(),t&&e.__h===!0&&(e.type=null),rs&&rs(e)},(kn.prototype=new Oe).__c=function(e,t){var n=t.__c,r=this;r.t==null&&(r.t=[]),r.t.push(n);var i=uu(r.__v),o=!1,a=function(){o||(o=!0,n.__R=null,i?i(s):s())};n.__R=a;var s=function(){if(!--r.__u){if(r.state.__a){var u=r.state.__a;r.__v.__k[0]=lu(u,u.__c.__P,u.__c.__O)}var c;for(r.setState({__a:r.__b=null});c=r.t.pop();)c.forceUpdate()}},l=t.__h===!0;r.__u++||l||r.setState({__a:r.__b=r.__v.__k[0]}),e.then(a,a)},kn.prototype.componentWillUnmount=function(){this.t=[]},kn.prototype.render=function(e,t){if(this.__b){if(this.__v.__k){var n=document.createElement("div"),r=this.__v.__k[0].__c;this.__v.__k[0]=su(this.__b,n,r.__O=r.__P)}this.__b=null}var i=t.__a&&ee(De,null,e.fallback);return i&&(i.__h=null),[ee(De,null,t.__a?null:e.children),i]};var is=function(e,t,n){if(++n[1]===n[0]&&e.o.delete(t),e.props.revealOrder&&(e.props.revealOrder[0]!=="t"||!e.o.size))for(n=e.u;n;){for(;n.length>3;)n.pop()();if(n[1]<n[0])break;e.u=n=n[2]}};function Yh(e){return this.getChildContext=function(){return e.context},e.children}function Qh(e){var t=this,n=e.i;t.componentWillUnmount=function(){nn(null,t.l),t.l=null,t.i=null},t.i&&t.i!==n&&t.componentWillUnmount(),e.__v?(t.l||(t.i=n,t.l={nodeType:1,parentNode:n,childNodes:[],appendChild:function(r){this.childNodes.push(r),t.i.appendChild(r)},insertBefore:function(r,i){this.childNodes.push(r),t.i.appendChild(r)},removeChild:function(r){this.childNodes.splice(this.childNodes.indexOf(r)>>>1,1),t.i.removeChild(r)}}),nn(ee(Yh,{context:t.context},e.__v),t.l)):t.l&&t.componentWillUnmount()}function du(e,t){var n=ee(Qh,{__v:e,i:t});return n.containerInfo=t,n}(Gt.prototype=new Oe).__a=function(e){var t=this,n=uu(t.__v),r=t.o.get(e);return r[0]++,function(i){var o=function(){t.props.revealOrder?(r.push(i),is(t,e,r)):i()};n?n(o):o()}},Gt.prototype.render=function(e){this.u=null,this.o=new Map;var t=nt(e.children);e.revealOrder&&e.revealOrder[0]==="b"&&t.reverse();for(var n=t.length;n--;)this.o.set(t[n],this.u=[1,0,this.u]);return e.children},Gt.prototype.componentDidUpdate=Gt.prototype.componentDidMount=function(){var e=this;this.o.forEach(function(t,n){is(e,n,t)})};var fu=typeof Symbol<"u"&&Symbol.for&&Symbol.for("react.element")||60103,Zh=/^(?:accent|alignment|arabic|baseline|cap|clip(?!PathU)|color|dominant|fill|flood|font|glyph(?!R)|horiz|image|letter|lighting|marker(?!H|W|U)|overline|paint|pointer|shape|stop|strikethrough|stroke|text(?!L)|transform|underline|unicode|units|v|vector|vert|word|writing|x(?!C))[A-Z]/,Xh=typeof document<"u",Jh=function(e){return(typeof Symbol<"u"&&typeof Symbol()=="symbol"?/fil|che|rad/i:/fil|che|ra/i).test(e)};function pu(e,t,n){return t.__k==null&&(t.textContent=""),nn(e,t),typeof n=="function"&&n(),e?e.__c:null}function hu(e,t,n){return Yl(e,t),typeof n=="function"&&n(),e?e.__c:null}Oe.prototype.isReactComponent={},["componentWillMount","componentWillReceiveProps","componentWillUpdate"].forEach(function(e){Object.defineProperty(Oe.prototype,e,{configurable:!0,get:function(){return this["UNSAFE_"+e]},set:function(t){Object.defineProperty(this,e,{configurable:!0,writable:!0,value:t})}})});var os=D.event;function ev(){}function tv(){return this.cancelBubble}function nv(){return this.defaultPrevented}D.event=function(e){return os&&(e=os(e)),e.persist=ev,e.isPropagationStopped=tv,e.isDefaultPrevented=nv,e.nativeEvent=e};var vu,as={configurable:!0,get:function(){return this.class}},ss=D.vnode;D.vnode=function(e){var t=e.type,n=e.props,r=n;if(typeof t=="string"){var i=t.indexOf("-")===-1;for(var o in r={},n){var a=n[o];Xh&&o==="children"&&t==="noscript"||o==="value"&&"defaultValue"in n&&a==null||(o==="defaultValue"&&"value"in n&&n.value==null?o="value":o==="download"&&a===!0?a="":/ondoubleclick/i.test(o)?o="ondblclick":/^onchange(textarea|input)/i.test(o+t)&&!Jh(n.type)?o="oninput":/^onfocus$/i.test(o)?o="onfocusin":/^onblur$/i.test(o)?o="onfocusout":/^on(Ani|Tra|Tou|BeforeInp|Compo)/.test(o)?o=o.toLowerCase():i&&Zh.test(o)?o=o.replace(/[A-Z0-9]/g,"-$&").toLowerCase():a===null&&(a=void 0),/^oninput$/i.test(o)&&(o=o.toLowerCase(),r[o]&&(o="oninputCapture")),r[o]=a)}t=="select"&&r.multiple&&Array.isArray(r.value)&&(r.value=nt(n.children).forEach(function(s){s.props.selected=r.value.indexOf(s.props.value)!=-1})),t=="select"&&r.defaultValue!=null&&(r.value=nt(n.children).forEach(function(s){s.props.selected=r.multiple?r.defaultValue.indexOf(s.props.value)!=-1:r.defaultValue==s.props.value})),e.props=r,n.class!=n.className&&(as.enumerable="className"in n,n.className!=null&&(r.class=n.className),Object.defineProperty(r,"className",as))}e.$$typeof=fu,ss&&ss(e)};var ls=D.__r;D.__r=function(e){ls&&ls(e),vu=e.__c};var mu={ReactCurrentDispatcher:{current:{readContext:function(e){return vu.__n[e.__c].props.value}}}},rv="17.0.2";function gu(e){return ee.bind(null,e)}function Qo(e){return!!e&&e.$$typeof===fu}function yu(e){return Qo(e)?Hh.apply(null,arguments):e}function _u(e){return!!e.__k&&(nn(null,e),!0)}function wu(e){return e&&(e.base||e.nodeType===1&&e)||null}var bu=function(e,t){return e(t)},Eu=function(e,t){return e(t)},xu=De;function Zo(e){e()}function Su(e){return e}function Cu(){return[!1,Zo]}var Iu=Yn;function ku(e,t){var n=t(),r=ue({h:{__:n,v:t}}),i=r[0].h,o=r[1];return Yn(function(){i.__=n,i.v=t,mi(i.__,t())||o({h:i})},[e,n,t]),Ce(function(){return mi(i.__,i.v())||o({h:i}),e(function(){mi(i.__,i.v())||o({h:i})})},[e]),n}var iv={useState:ue,useId:tu,useReducer:zo,useEffect:Ce,useLayoutEffect:Yn,useInsertionEffect:Iu,useTransition:Cu,useDeferredValue:Su,useSyncExternalStore:ku,startTransition:Zo,useRef:_t,useImperativeHandle:Xl,useMemo:Yr,useCallback:Jl,useContext:eu,useDebugValue:Wo,version:"17.0.2",Children:au,render:pu,hydrate:hu,unmountComponentAtNode:_u,createPortal:du,createElement:ee,createContext:Ql,createFactory:gu,cloneElement:yu,createRef:Fl,Fragment:De,isValidElement:Qo,findDOMNode:wu,Component:Oe,PureComponent:jr,memo:iu,forwardRef:ou,flushSync:Eu,unstable_batchedUpdates:bu,StrictMode:xu,Suspense:kn,SuspenseList:Gt,lazy:cu,__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED:mu};const ov=Object.freeze(Object.defineProperty({__proto__:null,Children:au,PureComponent:jr,StrictMode:xu,Suspense:kn,SuspenseList:Gt,__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED:mu,cloneElement:yu,createFactory:gu,createPortal:du,default:iv,findDOMNode:wu,flushSync:Eu,forwardRef:ou,hydrate:hu,isValidElement:Qo,lazy:cu,memo:iu,render:pu,startTransition:Zo,unmountComponentAtNode:_u,unstable_batchedUpdates:bu,useDeferredValue:Su,useInsertionEffect:Iu,useSyncExternalStore:ku,useTransition:Cu,version:rv,Component:Oe,Fragment:De,createContext:Ql,createElement:ee,createRef:Fl,useCallback:Jl,useContext:eu,useDebugValue:Wo,useEffect:Ce,useErrorBoundary:$h,useId:tu,useImperativeHandle:Xl,useLayoutEffect:Yn,useMemo:Yr,useReducer:zo,useRef:_t,useState:ue},Symbol.toStringTag,{value:"Module"}));var Tu={exports:{}},Lu={};const Ru=hc(ov);var Au={exports:{}},Ou={};/**
19
+ From previous: `);return this._state!==null&&(this._stack=t),t}finally{ji=!1}}},timeout:function(e,t){var n=this;return e<1/0?new A(function(r,i){var o=setTimeout(function(){return i(new V.Timeout(t))},e);n.then(r,i).finally(clearTimeout.bind(null,o))}):this}});typeof Symbol<"u"&&Symbol.toStringTag&&rt(A.prototype,Symbol.toStringTag,"Dexie.Promise");Wt.env=fl();function sl(e,t,n,r,i){this.onFulfilled=typeof e=="function"?e:null,this.onRejected=typeof t=="function"?t:null,this.resolve=n,this.reject=r,this.psd=i}Jt(A,{all:function(){var e=Qe.apply(null,arguments).map(Rr);return new A(function(t,n){e.length===0&&t([]);var r=e.length;e.forEach(function(i,o){return A.resolve(i).then(function(a){e[o]=a,--r||t(e)},n)})})},resolve:function(e){if(e instanceof A)return e;if(e&&typeof e.then=="function")return new A(function(n,r){e.then(n,r)});var t=new A(Rn,!0,e);return dl(t,Fi),t},reject:fr,race:function(){var e=Qe.apply(null,arguments).map(Rr);return new A(function(t,n){e.map(function(r){return A.resolve(r).then(t,n)})})},PSD:{get:function(){return P},set:function(e){return P=e}},totalEchoes:{get:function(){return Lr}},newPSD:mt,usePSD:dn,scheduler:{get:function(){return An},set:function(e){An=e}},rejectionMapper:{get:function(){return Bi},set:function(e){Bi=e}},follow:function(e,t){return new A(function(n,r){return mt(function(i,o){var a=P;a.unhandleds=[],a.onunhandled=o,a.finalize=Nt(function(){var s=this;Jf(function(){s.unhandleds.length===0?i():o(s.unhandleds[0])})},a.finalize),e()},t,n,r)})}});ur&&(ur.allSettled&&rt(A,"allSettled",function(){var e=Qe.apply(null,arguments).map(Rr);return new A(function(t){e.length===0&&t([]);var n=e.length,r=new Array(n);e.forEach(function(i,o){return A.resolve(i).then(function(a){return r[o]={status:"fulfilled",value:a}},function(a){return r[o]={status:"rejected",reason:a}}).then(function(){return--n||t(r)})})})}),ur.any&&typeof AggregateError<"u"&&rt(A,"any",function(){var e=Qe.apply(null,arguments).map(Rr);return new A(function(t,n){e.length===0&&n(new AggregateError([]));var r=e.length,i=new Array(r);e.forEach(function(o,a){return A.resolve(o).then(function(s){return t(s)},function(s){i[a]=s,--r||n(new AggregateError(i))})})})}));function ll(e,t){try{t(function(n){if(e._state===null){if(n===e)throw new TypeError("A promise cannot be resolved with itself.");var r=e._lib&&$n();n&&typeof n.then=="function"?ll(e,function(i,o){n instanceof A?n._then(i,o):n.then(i,o)}):(e._state=!0,e._value=n,ul(e)),r&&Gn()}},Ki.bind(null,e))}catch(n){Ki(e,n)}}function Ki(e,t){if(cr.push(t),e._state===null){var n=e._lib&&$n();t=Bi(t),e._state=!1,e._value=t,qe&&t!==null&&typeof t=="object"&&!t._promise&&Uf(function(){var r=Lo(t,"stack");t._promise=e,rt(t,"stack",{get:function(){return ji?r&&(r.get?r.get.apply(t):r.value):e.stack}})}),ep(e),ul(e),n&&Gn()}}function ul(e){var t=e._listeners;e._listeners=[];for(var n=0,r=t.length;n<r;++n)No(e,t[n]);var i=e._PSD;--i.ref||i.finalize(),Ut===0&&(++Ut,An(function(){--Ut===0&&Mo()},[]))}function No(e,t){if(e._state===null){e._listeners.push(t);return}var n=e._state?t.onFulfilled:t.onRejected;if(n===null)return(e._state?t.resolve:t.reject)(e._value);++t.psd.ref,++Ut,An(Xf,[n,e,t])}function Xf(e,t,n){try{Fi=t;var r,i=t._value;t._state?r=e(i):(cr.length&&(cr=[]),r=e(i),cr.indexOf(i)===-1&&tp(t)),n.resolve(r)}catch(o){n.reject(o)}finally{Fi=null,--Ut===0&&Mo(),--n.psd.ref||n.psd.finalize()}}function cl(e,t,n){if(t.length===n)return t;var r="";if(e._state===!1){var i=e._value,o,a;i!=null?(o=i.name||"Error",a=i.message||i,r=Pi(i,0)):(o=i,a=""),t.push(o+(a?": "+a:"")+r)}return qe&&(r=Pi(e._stackHolder,2),r&&t.indexOf(r)===-1&&t.push(r),e._prev&&cl(e._prev,t,n)),t}function dl(e,t){var n=t?t._numPrev+1:0;n<Yf&&(e._prev=t,e._numPrev=n)}function tr(){$n()&&Gn()}function $n(){var e=Vi;return Vi=!1,Tr=!1,e}function Gn(){var e,t,n;do for(;wn.length>0;)for(e=wn,wn=[],n=e.length,t=0;t<n;++t){var r=e[t];r[0].apply(null,r[1])}while(wn.length>0);Vi=!0,Tr=!0}function Mo(){var e=Ot;Ot=[],e.forEach(function(r){r._PSD.onunhandled.call(null,r._value,r)});for(var t=dr.slice(0),n=t.length;n;)t[--n]()}function Jf(e){function t(){e(),dr.splice(dr.indexOf(t),1)}dr.push(t),++Ut,An(function(){--Ut===0&&Mo()},[])}function ep(e){Ot.some(function(t){return t._value===e._value})||Ot.push(e)}function tp(e){for(var t=Ot.length;t;)if(Ot[--t]._value===e._value){Ot.splice(t,1);return}}function fr(e){return new A(Rn,!1,e)}function X(e,t){var n=P;return function(){var r=$n(),i=P;try{return gt(n,!0),e.apply(this,arguments)}catch(o){t&&t(o)}finally{gt(i,!1),r&&Gn()}}}var fe={awaits:0,echoes:0,id:0},np=0,pr=[],si=0,Lr=0,rp=0;function mt(e,t,n,r){var i=P,o=Object.create(i);o.parent=i,o.ref=0,o.global=!1,o.id=++rp;var a=Wt.env;o.env=Po?{Promise:A,PromiseProp:{value:A,configurable:!0,writable:!0},all:A.all,race:A.race,allSettled:A.allSettled,any:A.any,resolve:A.resolve,reject:A.reject,nthen:Ta(a.nthen,o),gthen:Ta(a.gthen,o)}:{},t&&me(o,t),++i.ref,o.finalize=function(){--this.parent.ref||this.parent.finalize()};var s=dn(o,e,n,r);return o.ref===0&&o.finalize(),s}function cn(){return fe.id||(fe.id=++np),++fe.awaits,fe.echoes+=ol,fe.id}function it(){return fe.awaits?(--fe.awaits===0&&(fe.id=0),fe.echoes=fe.awaits*ol,!0):!1}(""+al).indexOf("[native code]")===-1&&(cn=it=W);function Rr(e){return fe.echoes&&e&&e.constructor===ur?(cn(),e.then(function(t){return it(),t},function(t){return it(),ie(t)})):e}function ip(e){++Lr,(!fe.echoes||--fe.echoes===0)&&(fe.echoes=fe.id=0),pr.push(P),gt(e,!0)}function op(){var e=pr[pr.length-1];pr.pop(),gt(e,!1)}function gt(e,t){var n=P;if((t?fe.echoes&&(!si++||e!==P):si&&(!--si||e!==P))&&pl(t?ip.bind(null,e):op),e!==P&&(P=e,n===Wt&&(Wt.env=fl()),Po)){var r=Wt.env.Promise,i=e.env;kr.then=i.nthen,r.prototype.then=i.gthen,(n.global||e.global)&&(Object.defineProperty(Q,"Promise",i.PromiseProp),r.all=i.all,r.race=i.race,r.resolve=i.resolve,r.reject=i.reject,i.allSettled&&(r.allSettled=i.allSettled),i.any&&(r.any=i.any))}}function fl(){var e=Q.Promise;return Po?{Promise:e,PromiseProp:Object.getOwnPropertyDescriptor(Q,"Promise"),all:e.all,race:e.race,allSettled:e.allSettled,any:e.any,resolve:e.resolve,reject:e.reject,nthen:kr.then,gthen:e.prototype.then}:{}}function dn(e,t,n,r,i){var o=P;try{return gt(e,!0),t(n,r,i)}finally{gt(o,!1)}}function pl(e){al.call(Ni,e)}function Ar(e,t,n,r){return typeof e!="function"?e:function(){var i=P;n&&cn(),gt(t,!0);try{return e.apply(this,arguments)}finally{gt(i,!1),r&&pl(it)}}}function Ta(e,t){return function(n,r){return e.call(this,Ar(n,t),Ar(r,t))}}var La="unhandledrejection";function Ra(e,t){var n;try{n=t.onuncatched(e)}catch{}if(n!==!1)try{var r,i={promise:t,reason:e};if(Q.document&&document.createEvent?(r=document.createEvent("Event"),r.initEvent(La,!0,!0),me(r,i)):Q.CustomEvent&&(r=new CustomEvent(La,{detail:i}),me(r,i)),r&&Q.dispatchEvent&&(dispatchEvent(r),!Q.PromiseRejectionEvent&&Q.onunhandledrejection))try{Q.onunhandledrejection(r)}catch{}qe&&r&&!r.defaultPrevented&&console.warn("Unhandled rejection: "+(e.stack||e))}catch{}}var ie=A.reject;function $i(e,t,n,r){if(!e.idbdb||!e._state.openComplete&&!P.letThrough&&!e._vip){if(e._state.openComplete)return ie(new V.DatabaseClosed(e._state.dbOpenError));if(!e._state.isBeingOpened){if(!e._options.autoOpen)return ie(new V.DatabaseClosed);e.open().catch(W)}return e._state.dbReadyPromise.then(function(){return $i(e,t,n,r)})}else{var i=e._createTransaction(t,n,e._dbSchema);try{i.create(),e._state.PR1398_maxLoop=3}catch(o){return o.name===Oo.InvalidState&&e.isOpen()&&--e._state.PR1398_maxLoop>0?(console.warn("Dexie: Need to reopen db"),e._close(),e.open().then(function(){return $i(e,t,n,r)})):ie(o)}return i._promise(t,function(o,a){return mt(function(){return P.trans=i,r(o,a,i)})}).then(function(o){return i._completion.then(function(){return o})})}}var Aa="3.2.3",Rt=String.fromCharCode(65535),Gi=-1/0,We="Invalid key provided. Keys must be of type string, number, Date or Array<string | number | Date>.",hl="String expected.",Sn=[],zr=typeof navigator<"u"&&/(MSIE|Trident|Edge)/.test(navigator.userAgent),ap=zr,sp=zr,vl=function(e){return!/(dexie\.js|dexie\.min\.js)/.test(e)},Wr="__dbnames",li="readonly",ui="readwrite";function Mt(e,t){return e?t?function(){return e.apply(this,arguments)&&t.apply(this,arguments)}:e:t}var ml={type:3,lower:-1/0,lowerOpen:!1,upper:[[]],upperOpen:!1};function nr(e){return typeof e=="string"&&!/\./.test(e)?function(t){return t[e]===void 0&&e in t&&(t=Hn(t),delete t[e]),t}:function(t){return t}}var lp=function(){function e(){}return e.prototype._trans=function(t,n,r){var i=this._tx||P.trans,o=this.name;function a(l,u,c){if(!c.schema[o])throw new V.NotFound("Table "+o+" not part of transaction");return n(c.idbtrans,c)}var s=$n();try{return i&&i.db===this.db?i===P.trans?i._promise(t,a,r):mt(function(){return i._promise(t,a,r)},{trans:i,transless:P.transless||P}):$i(this.db,t,[this.name],a)}finally{s&&Gn()}},e.prototype.get=function(t,n){var r=this;return t&&t.constructor===Object?this.where(t).first(n):this._trans("readonly",function(i){return r.core.get({trans:i,key:t}).then(function(o){return r.hook.reading.fire(o)})}).then(n)},e.prototype.where=function(t){if(typeof t=="string")return new this.db.WhereClause(this,t);if(pe(t))return new this.db.WhereClause(this,"["+t.join("+")+"]");var n=ne(t);if(n.length===1)return this.where(n[0]).equals(t[n[0]]);var r=this.schema.indexes.concat(this.schema.primKey).filter(function(c){return c.compound&&n.every(function(f){return c.keyPath.indexOf(f)>=0})&&c.keyPath.every(function(f){return n.indexOf(f)>=0})})[0];if(r&&this.db._maxKey!==Rt)return this.where(r.name).equals(r.keyPath.map(function(c){return t[c]}));!r&&qe&&console.warn("The query "+JSON.stringify(t)+" on "+this.name+" would benefit of a "+("compound index ["+n.join("+")+"]"));var i=this.schema.idxByName,o=this.db._deps.indexedDB;function a(c,f){try{return o.cmp(c,f)===0}catch{return!1}}var s=n.reduce(function(c,f){var d=c[0],p=c[1],h=i[f],v=t[f];return[d||h,d||!h?Mt(p,h&&h.multi?function(m){var w=tt(m,f);return pe(w)&&w.some(function(y){return a(v,y)})}:function(m){return a(v,tt(m,f))}):p]},[null,null]),l=s[0],u=s[1];return l?this.where(l.name).equals(t[l.keyPath]).filter(u):r?this.filter(u):this.where(n).equals("")},e.prototype.filter=function(t){return this.toCollection().and(t)},e.prototype.count=function(t){return this.toCollection().count(t)},e.prototype.offset=function(t){return this.toCollection().offset(t)},e.prototype.limit=function(t){return this.toCollection().limit(t)},e.prototype.each=function(t){return this.toCollection().each(t)},e.prototype.toArray=function(t){return this.toCollection().toArray(t)},e.prototype.toCollection=function(){return new this.db.Collection(new this.db.WhereClause(this))},e.prototype.orderBy=function(t){return new this.db.Collection(new this.db.WhereClause(this,pe(t)?"["+t.join("+")+"]":t))},e.prototype.reverse=function(){return this.toCollection().reverse()},e.prototype.mapToClass=function(t){this.schema.mappedClass=t;var n=function(r){if(!r)return r;var i=Object.create(t.prototype);for(var o in r)if(we(r,o))try{i[o]=r[o]}catch{}return i};return this.schema.readHook&&this.hook.reading.unsubscribe(this.schema.readHook),this.schema.readHook=n,this.hook("reading",n),t},e.prototype.defineClass=function(){function t(n){me(this,n)}return this.mapToClass(t)},e.prototype.add=function(t,n){var r=this,i=this.schema.primKey,o=i.auto,a=i.keyPath,s=t;return a&&o&&(s=nr(a)(t)),this._trans("readwrite",function(l){return r.core.mutate({trans:l,type:"add",keys:n!=null?[n]:null,values:[s]})}).then(function(l){return l.numFailures?A.reject(l.failures[0]):l.lastResult}).then(function(l){if(a)try{Ae(t,a,l)}catch{}return l})},e.prototype.update=function(t,n){if(typeof t=="object"&&!pe(t)){var r=tt(t,this.schema.primKey.keyPath);if(r===void 0)return ie(new V.InvalidArgument("Given object does not contain its primary key"));try{typeof n!="function"?ne(n).forEach(function(i){Ae(t,i,n[i])}):n(t,{value:t,primKey:r})}catch{}return this.where(":id").equals(r).modify(n)}else return this.where(":id").equals(t).modify(n)},e.prototype.put=function(t,n){var r=this,i=this.schema.primKey,o=i.auto,a=i.keyPath,s=t;return a&&o&&(s=nr(a)(t)),this._trans("readwrite",function(l){return r.core.mutate({trans:l,type:"put",values:[s],keys:n!=null?[n]:null})}).then(function(l){return l.numFailures?A.reject(l.failures[0]):l.lastResult}).then(function(l){if(a)try{Ae(t,a,l)}catch{}return l})},e.prototype.delete=function(t){var n=this;return this._trans("readwrite",function(r){return n.core.mutate({trans:r,type:"delete",keys:[t]})}).then(function(r){return r.numFailures?A.reject(r.failures[0]):void 0})},e.prototype.clear=function(){var t=this;return this._trans("readwrite",function(n){return t.core.mutate({trans:n,type:"deleteRange",range:ml})}).then(function(n){return n.numFailures?A.reject(n.failures[0]):void 0})},e.prototype.bulkGet=function(t){var n=this;return this._trans("readonly",function(r){return n.core.getMany({keys:t,trans:r}).then(function(i){return i.map(function(o){return n.hook.reading.fire(o)})})})},e.prototype.bulkAdd=function(t,n,r){var i=this,o=Array.isArray(n)?n:void 0;r=r||(o?void 0:n);var a=r?r.allKeys:void 0;return this._trans("readwrite",function(s){var l=i.schema.primKey,u=l.auto,c=l.keyPath;if(c&&o)throw new V.InvalidArgument("bulkAdd(): keys argument invalid on tables with inbound keys");if(o&&o.length!==t.length)throw new V.InvalidArgument("Arguments objects and keys must have the same length");var f=t.length,d=c&&u?t.map(nr(c)):t;return i.core.mutate({trans:s,type:"add",keys:o,values:d,wantResults:a}).then(function(p){var h=p.numFailures,v=p.results,m=p.lastResult,w=p.failures,y=a?v:m;if(h===0)return y;throw new xn(i.name+".bulkAdd(): "+h+" of "+f+" operations failed",w)})})},e.prototype.bulkPut=function(t,n,r){var i=this,o=Array.isArray(n)?n:void 0;r=r||(o?void 0:n);var a=r?r.allKeys:void 0;return this._trans("readwrite",function(s){var l=i.schema.primKey,u=l.auto,c=l.keyPath;if(c&&o)throw new V.InvalidArgument("bulkPut(): keys argument invalid on tables with inbound keys");if(o&&o.length!==t.length)throw new V.InvalidArgument("Arguments objects and keys must have the same length");var f=t.length,d=c&&u?t.map(nr(c)):t;return i.core.mutate({trans:s,type:"put",keys:o,values:d,wantResults:a}).then(function(p){var h=p.numFailures,v=p.results,m=p.lastResult,w=p.failures,y=a?v:m;if(h===0)return y;throw new xn(i.name+".bulkPut(): "+h+" of "+f+" operations failed",w)})})},e.prototype.bulkDelete=function(t){var n=this,r=t.length;return this._trans("readwrite",function(i){return n.core.mutate({trans:i,type:"delete",keys:t})}).then(function(i){var o=i.numFailures,a=i.lastResult,s=i.failures;if(o===0)return a;throw new xn(n.name+".bulkDelete(): "+o+" of "+r+" operations failed",s)})},e}();function qn(e){var t={},n=function(s,l){if(l){for(var u=arguments.length,c=new Array(u-1);--u;)c[u-1]=arguments[u];return t[s].subscribe.apply(null,c),e}else if(typeof s=="string")return t[s]};n.addEventType=o;for(var r=1,i=arguments.length;r<i;++r)o(arguments[r]);return n;function o(s,l,u){if(typeof s=="object")return a(s);l||(l=Wf),u||(u=W);var c={subscribers:[],fire:u,subscribe:function(f){c.subscribers.indexOf(f)===-1&&(c.subscribers.push(f),c.fire=l(c.fire,f))},unsubscribe:function(f){c.subscribers=c.subscribers.filter(function(d){return d!==f}),c.fire=c.subscribers.reduce(l,u)}};return t[s]=n[s]=c,c}function a(s){ne(s).forEach(function(l){var u=s[l];if(pe(u))o(l,s[l][0],s[l][1]);else if(u==="asap")var c=o(l,Kn,function(){for(var d=arguments.length,p=new Array(d);d--;)p[d]=arguments[d];c.subscribers.forEach(function(h){Qs(function(){h.apply(null,p)})})});else throw new V.InvalidArgument("Invalid event config")})}}function zn(e,t){return ln(t).from({prototype:e}),t}function up(e){return zn(lp.prototype,function(n,r,i){this.db=e,this._tx=i,this.name=n,this.schema=r,this.hook=e._allTables[n]?e._allTables[n].hook:qn(null,{creating:[Gf,W],reading:[$f,Kn],updating:[zf,W],deleting:[qf,W]})})}function Ht(e,t){return!(e.filter||e.algorithm||e.or)&&(t?e.justLimit:!e.replayFilter)}function ci(e,t){e.filter=Mt(e.filter,t)}function di(e,t,n){var r=e.replayFilter;e.replayFilter=r?function(){return Mt(r(),t())}:t,e.justLimit=n&&!r}function cp(e,t){e.isMatch=Mt(e.isMatch,t)}function hr(e,t){if(e.isPrimKey)return t.primaryKey;var n=t.getIndexByKeyPath(e.index);if(!n)throw new V.Schema("KeyPath "+e.index+" on object store "+t.name+" is not indexed");return n}function Oa(e,t,n){var r=hr(e,t.schema);return t.openCursor({trans:n,values:!e.keysOnly,reverse:e.dir==="prev",unique:!!e.unique,query:{index:r,range:e.range}})}function rr(e,t,n,r){var i=e.replayFilter?Mt(e.filter,e.replayFilter()):e.filter;if(e.or){var o={},a=function(s,l,u){if(!i||i(l,u,function(d){return l.stop(d)},function(d){return l.fail(d)})){var c=l.primaryKey,f=""+c;f==="[object ArrayBuffer]"&&(f=""+new Uint8Array(c)),we(o,f)||(o[f]=!0,t(s,l,u))}};return Promise.all([e.or._iterate(a,n),Ua(Oa(e,r,n),e.algorithm,a,!e.keysOnly&&e.valueMapper)])}else return Ua(Oa(e,r,n),Mt(e.algorithm,i),t,!e.keysOnly&&e.valueMapper)}function Ua(e,t,n,r){var i=r?function(a,s,l){return n(r(a),s,l)}:n,o=X(i);return e.then(function(a){if(a)return a.start(function(){var s=function(){return a.continue()};(!t||t(a,function(l){return s=l},function(l){a.stop(l),s=W},function(l){a.fail(l),s=W}))&&o(a.value,a,function(l){return s=l}),s()})})}function ve(e,t){try{var n=Da(e),r=Da(t);if(n!==r)return n==="Array"?1:r==="Array"?-1:n==="binary"?1:r==="binary"?-1:n==="string"?1:r==="string"?-1:n==="Date"?1:r!=="Date"?NaN:-1;switch(n){case"number":case"Date":case"string":return e>t?1:e<t?-1:0;case"binary":return fp(Pa(e),Pa(t));case"Array":return dp(e,t)}}catch{}return NaN}function dp(e,t){for(var n=e.length,r=t.length,i=n<r?n:r,o=0;o<i;++o){var a=ve(e[o],t[o]);if(a!==0)return a}return n===r?0:n<r?-1:1}function fp(e,t){for(var n=e.length,r=t.length,i=n<r?n:r,o=0;o<i;++o)if(e[o]!==t[o])return e[o]<t[o]?-1:1;return n===r?0:n<r?-1:1}function Da(e){var t=typeof e;if(t!=="object")return t;if(ArrayBuffer.isView(e))return"binary";var n=Ui(e);return n==="ArrayBuffer"?"binary":n}function Pa(e){return e instanceof Uint8Array?e:ArrayBuffer.isView(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):new Uint8Array(e)}var pp=function(){function e(){}return e.prototype._read=function(t,n){var r=this._ctx;return r.error?r.table._trans(null,ie.bind(null,r.error)):r.table._trans("readonly",t).then(n)},e.prototype._write=function(t){var n=this._ctx;return n.error?n.table._trans(null,ie.bind(null,n.error)):n.table._trans("readwrite",t,"locked")},e.prototype._addAlgorithm=function(t){var n=this._ctx;n.algorithm=Mt(n.algorithm,t)},e.prototype._iterate=function(t,n){return rr(this._ctx,t,n,this._ctx.table.core)},e.prototype.clone=function(t){var n=Object.create(this.constructor.prototype),r=Object.create(this._ctx);return t&&me(r,t),n._ctx=r,n},e.prototype.raw=function(){return this._ctx.valueMapper=null,this},e.prototype.each=function(t){var n=this._ctx;return this._read(function(r){return rr(n,t,r,n.table.core)})},e.prototype.count=function(t){var n=this;return this._read(function(r){var i=n._ctx,o=i.table.core;if(Ht(i,!0))return o.count({trans:r,query:{index:hr(i,o.schema),range:i.range}}).then(function(s){return Math.min(s,i.limit)});var a=0;return rr(i,function(){return++a,!1},r,o).then(function(){return a})}).then(t)},e.prototype.sortBy=function(t,n){var r=t.split(".").reverse(),i=r[0],o=r.length-1;function a(u,c){return c?a(u[r[c]],c-1):u[i]}var s=this._ctx.dir==="next"?1:-1;function l(u,c){var f=a(u,o),d=a(c,o);return f<d?-s:f>d?s:0}return this.toArray(function(u){return u.sort(l)}).then(n)},e.prototype.toArray=function(t){var n=this;return this._read(function(r){var i=n._ctx;if(i.dir==="next"&&Ht(i,!0)&&i.limit>0){var o=i.valueMapper,a=hr(i,i.table.core.schema);return i.table.core.query({trans:r,limit:i.limit,values:!0,query:{index:a,range:i.range}}).then(function(l){var u=l.result;return o?u.map(o):u})}else{var s=[];return rr(i,function(l){return s.push(l)},r,i.table.core).then(function(){return s})}},t)},e.prototype.offset=function(t){var n=this._ctx;return t<=0?this:(n.offset+=t,Ht(n)?di(n,function(){var r=t;return function(i,o){return r===0?!0:r===1?(--r,!1):(o(function(){i.advance(r),r=0}),!1)}}):di(n,function(){var r=t;return function(){return--r<0}}),this)},e.prototype.limit=function(t){return this._ctx.limit=Math.min(this._ctx.limit,t),di(this._ctx,function(){var n=t;return function(r,i,o){return--n<=0&&i(o),n>=0}},!0),this},e.prototype.until=function(t,n){return ci(this._ctx,function(r,i,o){return t(r.value)?(i(o),n):!0}),this},e.prototype.first=function(t){return this.limit(1).toArray(function(n){return n[0]}).then(t)},e.prototype.last=function(t){return this.reverse().first(t)},e.prototype.filter=function(t){return ci(this._ctx,function(n){return t(n.value)}),cp(this._ctx,t),this},e.prototype.and=function(t){return this.filter(t)},e.prototype.or=function(t){return new this.db.WhereClause(this._ctx.table,t,this)},e.prototype.reverse=function(){return this._ctx.dir=this._ctx.dir==="prev"?"next":"prev",this._ondirectionchange&&this._ondirectionchange(this._ctx.dir),this},e.prototype.desc=function(){return this.reverse()},e.prototype.eachKey=function(t){var n=this._ctx;return n.keysOnly=!n.isMatch,this.each(function(r,i){t(i.key,i)})},e.prototype.eachUniqueKey=function(t){return this._ctx.unique="unique",this.eachKey(t)},e.prototype.eachPrimaryKey=function(t){var n=this._ctx;return n.keysOnly=!n.isMatch,this.each(function(r,i){t(i.primaryKey,i)})},e.prototype.keys=function(t){var n=this._ctx;n.keysOnly=!n.isMatch;var r=[];return this.each(function(i,o){r.push(o.key)}).then(function(){return r}).then(t)},e.prototype.primaryKeys=function(t){var n=this._ctx;if(n.dir==="next"&&Ht(n,!0)&&n.limit>0)return this._read(function(i){var o=hr(n,n.table.core.schema);return n.table.core.query({trans:i,values:!1,limit:n.limit,query:{index:o,range:n.range}})}).then(function(i){var o=i.result;return o}).then(t);n.keysOnly=!n.isMatch;var r=[];return this.each(function(i,o){r.push(o.primaryKey)}).then(function(){return r}).then(t)},e.prototype.uniqueKeys=function(t){return this._ctx.unique="unique",this.keys(t)},e.prototype.firstKey=function(t){return this.limit(1).keys(function(n){return n[0]}).then(t)},e.prototype.lastKey=function(t){return this.reverse().firstKey(t)},e.prototype.distinct=function(){var t=this._ctx,n=t.index&&t.table.schema.idxByName[t.index];if(!n||!n.multi)return this;var r={};return ci(this._ctx,function(i){var o=i.primaryKey.toString(),a=we(r,o);return r[o]=!0,!a}),this},e.prototype.modify=function(t){var n=this,r=this._ctx;return this._write(function(i){var o;if(typeof t=="function")o=t;else{var a=ne(t),s=a.length;o=function(w){for(var y=!1,E=0;E<s;++E){var _=a[E],b=t[_];tt(w,_)!==b&&(Ae(w,_,b),y=!0)}return y}}var l=r.table.core,u=l.schema.primaryKey,c=u.outbound,f=u.extractKey,d=n.db._options.modifyChunkSize||200,p=[],h=0,v=[],m=function(w,y){var E=y.failures,_=y.numFailures;h+=w-_;for(var b=0,S=ne(E);b<S.length;b++){var x=S[b];p.push(E[x])}};return n.clone().primaryKeys().then(function(w){var y=function(E){var _=Math.min(d,w.length-E);return l.getMany({trans:i,keys:w.slice(E,E+_),cache:"immutable"}).then(function(b){for(var S=[],x=[],I=c?[]:null,k=[],L=0;L<_;++L){var T=b[L],U={value:Hn(T),primKey:w[E+L]};o.call(U,U.value,U)!==!1&&(U.value==null?k.push(w[E+L]):!c&&ve(f(T),f(U.value))!==0?(k.push(w[E+L]),S.push(U.value)):(x.push(U.value),c&&I.push(w[E+L])))}var C=Ht(r)&&r.limit===1/0&&(typeof t!="function"||t===fi)&&{index:r.index,range:r.range};return Promise.resolve(S.length>0&&l.mutate({trans:i,type:"add",values:S}).then(function(j){for(var O in j.failures)k.splice(parseInt(O),1);m(S.length,j)})).then(function(){return(x.length>0||C&&typeof t=="object")&&l.mutate({trans:i,type:"put",keys:I,values:x,criteria:C,changeSpec:typeof t!="function"&&t}).then(function(j){return m(x.length,j)})}).then(function(){return(k.length>0||C&&t===fi)&&l.mutate({trans:i,type:"delete",keys:k,criteria:C}).then(function(j){return m(k.length,j)})}).then(function(){return w.length>E+_&&y(E+d)})})};return y(0).then(function(){if(p.length>0)throw new Ir("Error modifying one or more objects",p,h,v);return w.length})})})},e.prototype.delete=function(){var t=this._ctx,n=t.range;return Ht(t)&&(t.isPrimKey&&!sp||n.type===3)?this._write(function(r){var i=t.table.core.schema.primaryKey,o=n;return t.table.core.count({trans:r,query:{index:i,range:o}}).then(function(a){return t.table.core.mutate({trans:r,type:"deleteRange",range:o}).then(function(s){var l=s.failures;s.lastResult,s.results;var u=s.numFailures;if(u)throw new Ir("Could not delete some values",Object.keys(l).map(function(c){return l[c]}),a-u);return a-u})})}):this.modify(fi)},e}(),fi=function(e,t){return t.value=null};function hp(e){return zn(pp.prototype,function(n,r){this.db=e;var i=ml,o=null;if(r)try{i=r()}catch(u){o=u}var a=n._ctx,s=a.table,l=s.hook.reading.fire;this._ctx={table:s,index:a.index,isPrimKey:!a.index||s.schema.primKey.keyPath&&a.index===s.schema.primKey.name,range:i,keysOnly:!1,dir:"next",unique:"",algorithm:null,filter:null,replayFilter:null,justLimit:!0,isMatch:null,offset:0,limit:1/0,error:o,or:a.or,valueMapper:l!==Kn?l:null}})}function vp(e,t){return e<t?-1:e===t?0:1}function mp(e,t){return e>t?-1:e===t?0:1}function ge(e,t,n){var r=e instanceof yl?new e.Collection(e):e;return r._ctx.error=n?new n(t):new TypeError(t),r}function Kt(e){return new e.Collection(e,function(){return gl("")}).limit(0)}function gp(e){return e==="next"?function(t){return t.toUpperCase()}:function(t){return t.toLowerCase()}}function yp(e){return e==="next"?function(t){return t.toLowerCase()}:function(t){return t.toUpperCase()}}function _p(e,t,n,r,i,o){for(var a=Math.min(e.length,r.length),s=-1,l=0;l<a;++l){var u=t[l];if(u!==r[l])return i(e[l],n[l])<0?e.substr(0,l)+n[l]+n.substr(l+1):i(e[l],r[l])<0?e.substr(0,l)+r[l]+n.substr(l+1):s>=0?e.substr(0,s)+t[s]+n.substr(s+1):null;i(e[l],u)<0&&(s=l)}return a<r.length&&o==="next"?e+n.substr(e.length):a<e.length&&o==="prev"?e.substr(0,n.length):s<0?null:e.substr(0,s)+r[s]+n.substr(s+1)}function ir(e,t,n,r){var i,o,a,s,l,u,c,f=n.length;if(!n.every(function(v){return typeof v=="string"}))return ge(e,hl);function d(v){i=gp(v),o=yp(v),a=v==="next"?vp:mp;var m=n.map(function(w){return{lower:o(w),upper:i(w)}}).sort(function(w,y){return a(w.lower,y.lower)});s=m.map(function(w){return w.upper}),l=m.map(function(w){return w.lower}),u=v,c=v==="next"?"":r}d("next");var p=new e.Collection(e,function(){return st(s[0],l[f-1]+r)});p._ondirectionchange=function(v){d(v)};var h=0;return p._addAlgorithm(function(v,m,w){var y=v.key;if(typeof y!="string")return!1;var E=o(y);if(t(E,l,h))return!0;for(var _=null,b=h;b<f;++b){var S=_p(y,E,s[b],l[b],a,u);S===null&&_===null?h=b+1:(_===null||a(_,S)>0)&&(_=S)}return m(_!==null?function(){v.continue(_+c)}:w),!1}),p}function st(e,t,n,r){return{type:2,lower:e,upper:t,lowerOpen:n,upperOpen:r}}function gl(e){return{type:1,lower:e,upper:e}}var yl=function(){function e(){}return Object.defineProperty(e.prototype,"Collection",{get:function(){return this._ctx.table.db.Collection},enumerable:!1,configurable:!0}),e.prototype.between=function(t,n,r,i){r=r!==!1,i=i===!0;try{return this._cmp(t,n)>0||this._cmp(t,n)===0&&(r||i)&&!(r&&i)?Kt(this):new this.Collection(this,function(){return st(t,n,!r,!i)})}catch{return ge(this,We)}},e.prototype.equals=function(t){return t==null?ge(this,We):new this.Collection(this,function(){return gl(t)})},e.prototype.above=function(t){return t==null?ge(this,We):new this.Collection(this,function(){return st(t,void 0,!0)})},e.prototype.aboveOrEqual=function(t){return t==null?ge(this,We):new this.Collection(this,function(){return st(t,void 0,!1)})},e.prototype.below=function(t){return t==null?ge(this,We):new this.Collection(this,function(){return st(void 0,t,!1,!0)})},e.prototype.belowOrEqual=function(t){return t==null?ge(this,We):new this.Collection(this,function(){return st(void 0,t)})},e.prototype.startsWith=function(t){return typeof t!="string"?ge(this,hl):this.between(t,t+Rt,!0,!0)},e.prototype.startsWithIgnoreCase=function(t){return t===""?this.startsWith(t):ir(this,function(n,r){return n.indexOf(r[0])===0},[t],Rt)},e.prototype.equalsIgnoreCase=function(t){return ir(this,function(n,r){return n===r[0]},[t],"")},e.prototype.anyOfIgnoreCase=function(){var t=Qe.apply($t,arguments);return t.length===0?Kt(this):ir(this,function(n,r){return r.indexOf(n)!==-1},t,"")},e.prototype.startsWithAnyOfIgnoreCase=function(){var t=Qe.apply($t,arguments);return t.length===0?Kt(this):ir(this,function(n,r){return r.some(function(i){return n.indexOf(i)===0})},t,Rt)},e.prototype.anyOf=function(){var t=this,n=Qe.apply($t,arguments),r=this._cmp;try{n.sort(r)}catch{return ge(this,We)}if(n.length===0)return Kt(this);var i=new this.Collection(this,function(){return st(n[0],n[n.length-1])});i._ondirectionchange=function(a){r=a==="next"?t._ascending:t._descending,n.sort(r)};var o=0;return i._addAlgorithm(function(a,s,l){for(var u=a.key;r(u,n[o])>0;)if(++o,o===n.length)return s(l),!1;return r(u,n[o])===0?!0:(s(function(){a.continue(n[o])}),!1)}),i},e.prototype.notEqual=function(t){return this.inAnyRange([[Gi,t],[t,this.db._maxKey]],{includeLowers:!1,includeUppers:!1})},e.prototype.noneOf=function(){var t=Qe.apply($t,arguments);if(t.length===0)return new this.Collection(this);try{t.sort(this._ascending)}catch{return ge(this,We)}var n=t.reduce(function(r,i){return r?r.concat([[r[r.length-1][1],i]]):[[Gi,i]]},null);return n.push([t[t.length-1],this.db._maxKey]),this.inAnyRange(n,{includeLowers:!1,includeUppers:!1})},e.prototype.inAnyRange=function(t,n){var r=this,i=this._cmp,o=this._ascending,a=this._descending,s=this._min,l=this._max;if(t.length===0)return Kt(this);if(!t.every(function(b){return b[0]!==void 0&&b[1]!==void 0&&o(b[0],b[1])<=0}))return ge(this,"First argument to inAnyRange() must be an Array of two-value Arrays [lower,upper] where upper must not be lower than lower",V.InvalidArgument);var u=!n||n.includeLowers!==!1,c=n&&n.includeUppers===!0;function f(b,S){for(var x=0,I=b.length;x<I;++x){var k=b[x];if(i(S[0],k[1])<0&&i(S[1],k[0])>0){k[0]=s(k[0],S[0]),k[1]=l(k[1],S[1]);break}}return x===I&&b.push(S),b}var d=o;function p(b,S){return d(b[0],S[0])}var h;try{h=t.reduce(f,[]),h.sort(p)}catch{return ge(this,We)}var v=0,m=c?function(b){return o(b,h[v][1])>0}:function(b){return o(b,h[v][1])>=0},w=u?function(b){return a(b,h[v][0])>0}:function(b){return a(b,h[v][0])>=0};function y(b){return!m(b)&&!w(b)}var E=m,_=new this.Collection(this,function(){return st(h[0][0],h[h.length-1][1],!u,!c)});return _._ondirectionchange=function(b){b==="next"?(E=m,d=o):(E=w,d=a),h.sort(p)},_._addAlgorithm(function(b,S,x){for(var I=b.key;E(I);)if(++v,v===h.length)return S(x),!1;return y(I)?!0:(r._cmp(I,h[v][1])===0||r._cmp(I,h[v][0])===0||S(function(){d===o?b.continue(h[v][0]):b.continue(h[v][1])}),!1)}),_},e.prototype.startsWithAnyOf=function(){var t=Qe.apply($t,arguments);return t.every(function(n){return typeof n=="string"})?t.length===0?Kt(this):this.inAnyRange(t.map(function(n){return[n,n+Rt]})):ge(this,"startsWithAnyOf() only works with strings")},e}();function wp(e){return zn(yl.prototype,function(n,r,i){this.db=e,this._ctx={table:n,index:r===":id"?null:r,or:i};var o=e._deps.indexedDB;if(!o)throw new V.MissingAPI;this._cmp=this._ascending=o.cmp.bind(o),this._descending=function(a,s){return o.cmp(s,a)},this._max=function(a,s){return o.cmp(a,s)>0?a:s},this._min=function(a,s){return o.cmp(a,s)<0?a:s},this._IDBKeyRange=e._deps.IDBKeyRange})}function Me(e){return X(function(t){return On(t),e(t.target.error),!1})}function On(e){e.stopPropagation&&e.stopPropagation(),e.preventDefault&&e.preventDefault()}var Un="storagemutated",dt="x-storagemutated-1",yt=qn(null,Un),bp=function(){function e(){}return e.prototype._lock=function(){return _n(!P.global),++this._reculock,this._reculock===1&&!P.global&&(P.lockOwnerFor=this),this},e.prototype._unlock=function(){if(_n(!P.global),--this._reculock===0)for(P.global||(P.lockOwnerFor=null);this._blockedFuncs.length>0&&!this._locked();){var t=this._blockedFuncs.shift();try{dn(t[1],t[0])}catch{}}return this},e.prototype._locked=function(){return this._reculock&&P.lockOwnerFor!==this},e.prototype.create=function(t){var n=this;if(!this.mode)return this;var r=this.db.idbdb,i=this.db._state.dbOpenError;if(_n(!this.idbtrans),!t&&!r)switch(i&&i.name){case"DatabaseClosedError":throw new V.DatabaseClosed(i);case"MissingAPIError":throw new V.MissingAPI(i.message,i);default:throw new V.OpenFailed(i)}if(!this.active)throw new V.TransactionInactive;return _n(this._completion._state===null),t=this.idbtrans=t||(this.db.core?this.db.core.transaction(this.storeNames,this.mode,{durability:this.chromeTransactionDurability}):r.transaction(this.storeNames,this.mode,{durability:this.chromeTransactionDurability})),t.onerror=X(function(o){On(o),n._reject(t.error)}),t.onabort=X(function(o){On(o),n.active&&n._reject(new V.Abort(t.error)),n.active=!1,n.on("abort").fire(o)}),t.oncomplete=X(function(){n.active=!1,n._resolve(),"mutatedParts"in t&&yt.storagemutated.fire(t.mutatedParts)}),this},e.prototype._promise=function(t,n,r){var i=this;if(t==="readwrite"&&this.mode!=="readwrite")return ie(new V.ReadOnly("Transaction is readonly"));if(!this.active)return ie(new V.TransactionInactive);if(this._locked())return new A(function(a,s){i._blockedFuncs.push([function(){i._promise(t,n,r).then(a,s)},P])});if(r)return mt(function(){var a=new A(function(s,l){i._lock();var u=n(s,l,i);u&&u.then&&u.then(s,l)});return a.finally(function(){return i._unlock()}),a._lib=!0,a});var o=new A(function(a,s){var l=n(a,s,i);l&&l.then&&l.then(a,s)});return o._lib=!0,o},e.prototype._root=function(){return this.parent?this.parent._root():this},e.prototype.waitFor=function(t){var n=this._root(),r=A.resolve(t);if(n._waitingFor)n._waitingFor=n._waitingFor.then(function(){return r});else{n._waitingFor=r,n._waitingQueue=[];var i=n.idbtrans.objectStore(n.storeNames[0]);(function a(){for(++n._spinCount;n._waitingQueue.length;)n._waitingQueue.shift()();n._waitingFor&&(i.get(-1/0).onsuccess=a)})()}var o=n._waitingFor;return new A(function(a,s){r.then(function(l){return n._waitingQueue.push(X(a.bind(null,l)))},function(l){return n._waitingQueue.push(X(s.bind(null,l)))}).finally(function(){n._waitingFor===o&&(n._waitingFor=null)})})},e.prototype.abort=function(){this.active&&(this.active=!1,this.idbtrans&&this.idbtrans.abort(),this._reject(new V.Abort))},e.prototype.table=function(t){var n=this._memoizedTables||(this._memoizedTables={});if(we(n,t))return n[t];var r=this.schema[t];if(!r)throw new V.NotFound("Table "+t+" not part of transaction");var i=new this.db.Table(t,r,this);return i.core=this.db.core.table(t),n[t]=i,i},e}();function Ep(e){return zn(bp.prototype,function(n,r,i,o,a){var s=this;this.db=e,this.mode=n,this.storeNames=r,this.schema=i,this.chromeTransactionDurability=o,this.idbtrans=null,this.on=qn(this,"complete","error","abort"),this.parent=a||null,this.active=!0,this._reculock=0,this._blockedFuncs=[],this._resolve=null,this._reject=null,this._waitingFor=null,this._waitingQueue=null,this._spinCount=0,this._completion=new A(function(l,u){s._resolve=l,s._reject=u}),this._completion.then(function(){s.active=!1,s.on.complete.fire()},function(l){var u=s.active;return s.active=!1,s.on.error.fire(l),s.parent?s.parent._reject(l):u&&s.idbtrans&&s.idbtrans.abort(),ie(l)})})}function qi(e,t,n,r,i,o,a){return{name:e,keyPath:t,unique:n,multi:r,auto:i,compound:o,src:(n&&!a?"&":"")+(r?"*":"")+(i?"++":"")+_l(t)}}function _l(e){return typeof e=="string"?e:e?"["+[].join.call(e,"+")+"]":""}function wl(e,t,n){return{name:e,primKey:t,indexes:n,mappedClass:null,idxByName:Zs(n,function(r){return[r.name,r]})}}function xp(e){return e.length===1?e[0]:e}var Dn=function(e){try{return e.only([[]]),Dn=function(){return[[]]},[[]]}catch{return Dn=function(){return Rt},Rt}};function zi(e){return e==null?function(){}:typeof e=="string"?Sp(e):function(t){return tt(t,e)}}function Sp(e){var t=e.split(".");return t.length===1?function(n){return n[e]}:function(n){return tt(n,e)}}function Na(e){return[].slice.call(e)}var Cp=0;function Cn(e){return e==null?":id":typeof e=="string"?e:"["+e.join("+")+"]"}function Ip(e,t,n){function r(f,d){var p=Na(f.objectStoreNames);return{schema:{name:f.name,tables:p.map(function(h){return d.objectStore(h)}).map(function(h){var v=h.keyPath,m=h.autoIncrement,w=pe(v),y=v==null,E={},_={name:h.name,primaryKey:{name:null,isPrimaryKey:!0,outbound:y,compound:w,keyPath:v,autoIncrement:m,unique:!0,extractKey:zi(v)},indexes:Na(h.indexNames).map(function(b){return h.index(b)}).map(function(b){var S=b.name,x=b.unique,I=b.multiEntry,k=b.keyPath,L=pe(k),T={name:S,compound:L,keyPath:k,unique:x,multiEntry:I,extractKey:zi(k)};return E[Cn(k)]=T,T}),getIndexByKeyPath:function(b){return E[Cn(b)]}};return E[":id"]=_.primaryKey,v!=null&&(E[Cn(v)]=_.primaryKey),_})},hasGetAll:p.length>0&&"getAll"in d.objectStore(p[0])&&!(typeof navigator<"u"&&/Safari/.test(navigator.userAgent)&&!/(Chrome\/|Edge\/)/.test(navigator.userAgent)&&[].concat(navigator.userAgent.match(/Safari\/(\d*)/))[1]<604)}}function i(f){if(f.type===3)return null;if(f.type===4)throw new Error("Cannot convert never type to IDBKeyRange");var d=f.lower,p=f.upper,h=f.lowerOpen,v=f.upperOpen,m=d===void 0?p===void 0?null:t.upperBound(p,!!v):p===void 0?t.lowerBound(d,!!h):t.bound(d,p,!!h,!!v);return m}function o(f){var d=f.name;function p(m){var w=m.trans,y=m.type,E=m.keys,_=m.values,b=m.range;return new Promise(function(S,x){S=X(S);var I=w.objectStore(d),k=I.keyPath==null,L=y==="put"||y==="add";if(!L&&y!=="delete"&&y!=="deleteRange")throw new Error("Invalid operation type: "+y);var T=(E||_||{length:1}).length;if(E&&_&&E.length!==_.length)throw new Error("Given keys array must have same length as given values array.");if(T===0)return S({numFailures:0,failures:{},results:[],lastResult:void 0});var U,C=[],j=[],O=0,Y=function(Ne){++O,On(Ne)};if(y==="deleteRange"){if(b.type===4)return S({numFailures:O,failures:j,results:[],lastResult:void 0});b.type===3?C.push(U=I.clear()):C.push(U=I.delete(i(b)))}else{var G=L?k?[_,E]:[_,null]:[E,null],he=G[0],Pe=G[1];if(L)for(var Ee=0;Ee<T;++Ee)C.push(U=Pe&&Pe[Ee]!==void 0?I[y](he[Ee],Pe[Ee]):I[y](he[Ee])),U.onerror=Y;else for(var Ee=0;Ee<T;++Ee)C.push(U=I[y](he[Ee])),U.onerror=Y}var at=function(Ne){var hn=Ne.target.result;C.forEach(function(ke,Qn){return ke.error!=null&&(j[Qn]=ke.error)}),S({numFailures:O,failures:j,results:y==="delete"?E:C.map(function(ke){return ke.result}),lastResult:hn})};U.onerror=function(Ne){Y(Ne),at(Ne)},U.onsuccess=at})}function h(m){var w=m.trans,y=m.values,E=m.query,_=m.reverse,b=m.unique;return new Promise(function(S,x){S=X(S);var I=E.index,k=E.range,L=w.objectStore(d),T=I.isPrimaryKey?L:L.index(I.name),U=_?b?"prevunique":"prev":b?"nextunique":"next",C=y||!("openKeyCursor"in T)?T.openCursor(i(k),U):T.openKeyCursor(i(k),U);C.onerror=Me(x),C.onsuccess=X(function(j){var O=C.result;if(!O){S(null);return}O.___id=++Cp,O.done=!1;var Y=O.continue.bind(O),G=O.continuePrimaryKey;G&&(G=G.bind(O));var he=O.advance.bind(O),Pe=function(){throw new Error("Cursor not started")},Ee=function(){throw new Error("Cursor not stopped")};O.trans=w,O.stop=O.continue=O.continuePrimaryKey=O.advance=Pe,O.fail=X(x),O.next=function(){var at=this,Ne=1;return this.start(function(){return Ne--?at.continue():at.stop()}).then(function(){return at})},O.start=function(at){var Ne=new Promise(function(ke,Qn){ke=X(ke),C.onerror=Me(Qn),O.fail=Qn,O.stop=function(cc){O.stop=O.continue=O.continuePrimaryKey=O.advance=Ee,ke(cc)}}),hn=function(){if(C.result)try{at()}catch(ke){O.fail(ke)}else O.done=!0,O.start=function(){throw new Error("Cursor behind last entry")},O.stop()};return C.onsuccess=X(function(ke){C.onsuccess=hn,hn()}),O.continue=Y,O.continuePrimaryKey=G,O.advance=he,hn(),Ne},S(O)},x)})}function v(m){return function(w){return new Promise(function(y,E){y=X(y);var _=w.trans,b=w.values,S=w.limit,x=w.query,I=S===1/0?void 0:S,k=x.index,L=x.range,T=_.objectStore(d),U=k.isPrimaryKey?T:T.index(k.name),C=i(L);if(S===0)return y({result:[]});if(m){var j=b?U.getAll(C,I):U.getAllKeys(C,I);j.onsuccess=function(he){return y({result:he.target.result})},j.onerror=Me(E)}else{var O=0,Y=b||!("openKeyCursor"in U)?U.openCursor(C):U.openKeyCursor(C),G=[];Y.onsuccess=function(he){var Pe=Y.result;if(!Pe)return y({result:G});if(G.push(b?Pe.value:Pe.primaryKey),++O===S)return y({result:G});Pe.continue()},Y.onerror=Me(E)}})}}return{name:d,schema:f,mutate:p,getMany:function(m){var w=m.trans,y=m.keys;return new Promise(function(E,_){E=X(E);for(var b=w.objectStore(d),S=y.length,x=new Array(S),I=0,k=0,L,T=function(O){var Y=O.target;(x[Y._pos]=Y.result)!=null,++k===I&&E(x)},U=Me(_),C=0;C<S;++C){var j=y[C];j!=null&&(L=b.get(y[C]),L._pos=C,L.onsuccess=T,L.onerror=U,++I)}I===0&&E(x)})},get:function(m){var w=m.trans,y=m.key;return new Promise(function(E,_){E=X(E);var b=w.objectStore(d),S=b.get(y);S.onsuccess=function(x){return E(x.target.result)},S.onerror=Me(_)})},query:v(l),openCursor:h,count:function(m){var w=m.query,y=m.trans,E=w.index,_=w.range;return new Promise(function(b,S){var x=y.objectStore(d),I=E.isPrimaryKey?x:x.index(E.name),k=i(_),L=k?I.count(k):I.count();L.onsuccess=X(function(T){return b(T.target.result)}),L.onerror=Me(S)})}}}var a=r(e,n),s=a.schema,l=a.hasGetAll,u=s.tables.map(function(f){return o(f)}),c={};return u.forEach(function(f){return c[f.name]=f}),{stack:"dbcore",transaction:e.transaction.bind(e),table:function(f){var d=c[f];if(!d)throw new Error("Table '"+f+"' not found");return c[f]},MIN_KEY:-1/0,MAX_KEY:Dn(t),schema:s}}function kp(e,t){return t.reduce(function(n,r){var i=r.create;return K(K({},n),i(n))},e)}function Tp(e,t,n,r){var i=n.IDBKeyRange;n.indexedDB;var o=kp(Ip(t,i,r),e.dbcore);return{dbcore:o}}function jo(e,t){var n=e._novip,r=t.db,i=Tp(n._middlewares,r,n._deps,t);n.core=i.dbcore,n.tables.forEach(function(o){var a=o.name;n.core.schema.tables.some(function(s){return s.name===a})&&(o.core=n.core.table(a),n[a]instanceof n.Table&&(n[a].core=o.core))})}function Or(e,t,n,r){var i=e._novip;n.forEach(function(o){var a=r[o];t.forEach(function(s){var l=Lo(s,o);(!l||"value"in l&&l.value===void 0)&&(s===i.Transaction.prototype||s instanceof i.Transaction?rt(s,o,{get:function(){return this.table(o)},set:function(u){Ws(this,o,{value:u,writable:!0,configurable:!0,enumerable:!0})}}):s[o]=new i.Table(o,a))})})}function Wi(e,t){var n=e._novip;t.forEach(function(r){for(var i in r)r[i]instanceof n.Table&&delete r[i]})}function Lp(e,t){return e._cfg.version-t._cfg.version}function Rp(e,t,n,r){var i=e._dbSchema,o=e._createTransaction("readwrite",e._storeNames,i);o.create(n),o._completion.catch(r);var a=o._reject.bind(o),s=P.transless||P;mt(function(){P.trans=o,P.transless=s,t===0?(ne(i).forEach(function(l){Vo(n,l,i[l].primKey,i[l].indexes)}),jo(e,n),A.follow(function(){return e.on.populate.fire(o)}).catch(a)):Ap(e,t,o,n).catch(a)})}function Ap(e,t,n,r){var i=e._novip,o=[],a=i._versions,s=i._dbSchema=Fo(i,i.idbdb,r),l=!1,u=a.filter(function(f){return f._cfg.version>=t});u.forEach(function(f){o.push(function(){var d=s,p=f._cfg.dbschema;Qi(i,d,r),Qi(i,p,r),s=i._dbSchema=p;var h=bl(d,p);h.add.forEach(function(_){Vo(r,_[0],_[1].primKey,_[1].indexes)}),h.change.forEach(function(_){if(_.recreate)throw new V.Upgrade("Not yet support for changing primary key");var b=r.objectStore(_.name);_.add.forEach(function(S){return Yi(b,S)}),_.change.forEach(function(S){b.deleteIndex(S.name),Yi(b,S)}),_.del.forEach(function(S){return b.deleteIndex(S)})});var v=f._cfg.contentUpgrade;if(v&&f._cfg.version>t){jo(i,r),n._memoizedTables={},l=!0;var m=Xs(p);h.del.forEach(function(_){m[_]=d[_]}),Wi(i,[i.Transaction.prototype]),Or(i,[i.Transaction.prototype],ne(m),m),n.schema=m;var w=Ro(v);w&&cn();var y,E=A.follow(function(){if(y=v(n),y&&w){var _=it.bind(null,null);y.then(_,_)}});return y&&typeof y.then=="function"?A.resolve(y):E.then(function(){return y})}}),o.push(function(d){if(!l||!ap){var p=f._cfg.dbschema;Up(p,d)}Wi(i,[i.Transaction.prototype]),Or(i,[i.Transaction.prototype],i._storeNames,i._dbSchema),n.schema=i._dbSchema})});function c(){return o.length?A.resolve(o.shift()(n.idbtrans)).then(c):A.resolve()}return c().then(function(){Op(s,r)})}function bl(e,t){var n={del:[],add:[],change:[]},r;for(r in e)t[r]||n.del.push(r);for(r in t){var i=e[r],o=t[r];if(!i)n.add.push([r,o]);else{var a={name:r,def:o,recreate:!1,del:[],add:[],change:[]};if(""+(i.primKey.keyPath||"")!=""+(o.primKey.keyPath||"")||i.primKey.auto!==o.primKey.auto&&!zr)a.recreate=!0,n.change.push(a);else{var s=i.idxByName,l=o.idxByName,u=void 0;for(u in s)l[u]||a.del.push(u);for(u in l){var c=s[u],f=l[u];c?c.src!==f.src&&a.change.push(f):a.add.push(f)}(a.del.length>0||a.add.length>0||a.change.length>0)&&n.change.push(a)}}}return n}function Vo(e,t,n,r){var i=e.db.createObjectStore(t,n.keyPath?{keyPath:n.keyPath,autoIncrement:n.auto}:{autoIncrement:n.auto});return r.forEach(function(o){return Yi(i,o)}),i}function Op(e,t){ne(e).forEach(function(n){t.db.objectStoreNames.contains(n)||Vo(t,n,e[n].primKey,e[n].indexes)})}function Up(e,t){[].slice.call(t.db.objectStoreNames).forEach(function(n){return e[n]==null&&t.db.deleteObjectStore(n)})}function Yi(e,t){e.createIndex(t.name,t.keyPath,{unique:t.unique,multiEntry:t.multi})}function Fo(e,t,n){var r={},i=Gr(t.objectStoreNames,0);return i.forEach(function(o){for(var a=n.objectStore(o),s=a.keyPath,l=qi(_l(s),s||"",!1,!1,!!a.autoIncrement,s&&typeof s!="string",!0),u=[],c=0;c<a.indexNames.length;++c){var f=a.index(a.indexNames[c]);s=f.keyPath;var d=qi(f.name,s,!!f.unique,!!f.multiEntry,!1,s&&typeof s!="string",!1);u.push(d)}r[o]=wl(o,l,u)}),r}function Dp(e,t,n){var r=e._novip;r.verno=t.version/10;var i=r._dbSchema=Fo(r,t,n);r._storeNames=Gr(t.objectStoreNames,0),Or(r,[r._allTables],ne(i),i)}function Pp(e,t){var n=Fo(e,e.idbdb,t),r=bl(n,e._dbSchema);return!(r.add.length||r.change.some(function(i){return i.add.length||i.change.length}))}function Qi(e,t,n){for(var r=e._novip,i=n.db.objectStoreNames,o=0;o<i.length;++o){var a=i[o],s=n.objectStore(a);r._hasGetAll="getAll"in s;for(var l=0;l<s.indexNames.length;++l){var u=s.indexNames[l],c=s.index(u).keyPath,f=typeof c=="string"?c:"["+Gr(c).join("+")+"]";if(t[a]){var d=t[a].idxByName[f];d&&(d.name=u,delete t[a].idxByName[f],t[a].idxByName[u]=d)}}}typeof navigator<"u"&&/Safari/.test(navigator.userAgent)&&!/(Chrome\/|Edge\/)/.test(navigator.userAgent)&&Q.WorkerGlobalScope&&Q instanceof Q.WorkerGlobalScope&&[].concat(navigator.userAgent.match(/Safari\/(\d*)/))[1]<604&&(r._hasGetAll=!1)}function Np(e){return e.split(",").map(function(t,n){t=t.trim();var r=t.replace(/([&*]|\+\+)/g,""),i=/^\[/.test(r)?r.match(/^\[(.*)\]$/)[1].split("+"):r;return qi(r,i||null,/\&/.test(t),/\*/.test(t),/\+\+/.test(t),pe(i),n===0)})}var Mp=function(){function e(){}return e.prototype._parseStoresSpec=function(t,n){ne(t).forEach(function(r){if(t[r]!==null){var i=Np(t[r]),o=i.shift();if(o.multi)throw new V.Schema("Primary key cannot be multi-valued");i.forEach(function(a){if(a.auto)throw new V.Schema("Only primary key can be marked as autoIncrement (++)");if(!a.keyPath)throw new V.Schema("Index must have a name and cannot be an empty string")}),n[r]=wl(r,o,i)}})},e.prototype.stores=function(t){var n=this.db;this._cfg.storesSource=this._cfg.storesSource?me(this._cfg.storesSource,t):t;var r=n._versions,i={},o={};return r.forEach(function(a){me(i,a._cfg.storesSource),o=a._cfg.dbschema={},a._parseStoresSpec(i,o)}),n._dbSchema=o,Wi(n,[n._allTables,n,n.Transaction.prototype]),Or(n,[n._allTables,n,n.Transaction.prototype,this._cfg.tables],ne(o),o),n._storeNames=ne(o),this},e.prototype.upgrade=function(t){return this._cfg.contentUpgrade=Uo(this._cfg.contentUpgrade||W,t),this},e}();function jp(e){return zn(Mp.prototype,function(n){this.db=e,this._cfg={version:n,storesSource:null,dbschema:{},tables:{},contentUpgrade:null}})}function Bo(e,t){var n=e._dbNamesDB;return n||(n=e._dbNamesDB=new Yt(Wr,{addons:[],indexedDB:e,IDBKeyRange:t}),n.version(1).stores({dbnames:"name"})),n.table("dbnames")}function Ho(e){return e&&typeof e.databases=="function"}function Vp(e){var t=e.indexedDB,n=e.IDBKeyRange;return Ho(t)?Promise.resolve(t.databases()).then(function(r){return r.map(function(i){return i.name}).filter(function(i){return i!==Wr})}):Bo(t,n).toCollection().primaryKeys()}function Fp(e,t){var n=e.indexedDB,r=e.IDBKeyRange;!Ho(n)&&t!==Wr&&Bo(n,r).put({name:t}).catch(W)}function Bp(e,t){var n=e.indexedDB,r=e.IDBKeyRange;!Ho(n)&&t!==Wr&&Bo(n,r).delete(t).catch(W)}function Zi(e){return mt(function(){return P.letThrough=!0,e()})}function Hp(){var e=!navigator.userAgentData&&/Safari\//.test(navigator.userAgent)&&!/Chrom(e|ium)\//.test(navigator.userAgent);if(!e||!indexedDB.databases)return Promise.resolve();var t;return new Promise(function(n){var r=function(){return indexedDB.databases().finally(n)};t=setInterval(r,100),r()}).finally(function(){return clearInterval(t)})}function Kp(e){var t=e._state,n=e._deps.indexedDB;if(t.isBeingOpened||e.idbdb)return t.dbReadyPromise.then(function(){return t.dbOpenError?ie(t.dbOpenError):e});qe&&(t.openCanceller._stackHolder=Vt()),t.isBeingOpened=!0,t.dbOpenError=null,t.openComplete=!1;var r=t.openCanceller;function i(){if(t.openCanceller!==r)throw new V.DatabaseClosed("db.open() was cancelled")}var o=t.dbReadyResolve,a=null,s=!1;return A.race([r,(typeof navigator>"u"?A.resolve():Hp()).then(function(){return new A(function(l,u){if(i(),!n)throw new V.MissingAPI;var c=e.name,f=t.autoSchema?n.open(c):n.open(c,Math.round(e.verno*10));if(!f)throw new V.MissingAPI;f.onerror=Me(u),f.onblocked=X(e._fireOnBlocked),f.onupgradeneeded=X(function(d){if(a=f.transaction,t.autoSchema&&!e._options.allowEmptyDB){f.onerror=On,a.abort(),f.result.close();var p=n.deleteDatabase(c);p.onsuccess=p.onerror=X(function(){u(new V.NoSuchDatabase("Database "+c+" doesnt exist"))})}else{a.onerror=Me(u);var h=d.oldVersion>Math.pow(2,62)?0:d.oldVersion;s=h<1,e._novip.idbdb=f.result,Rp(e,h/10,a,u)}},u),f.onsuccess=X(function(){a=null;var d=e._novip.idbdb=f.result,p=Gr(d.objectStoreNames);if(p.length>0)try{var h=d.transaction(xp(p),"readonly");t.autoSchema?Dp(e,d,h):(Qi(e,e._dbSchema,h),Pp(e,h)||console.warn("Dexie SchemaDiff: Schema was extended without increasing the number passed to db.version(). Some queries may fail.")),jo(e,h)}catch{}Sn.push(e),d.onversionchange=X(function(v){t.vcFired=!0,e.on("versionchange").fire(v)}),d.onclose=X(function(v){e.on("close").fire(v)}),s&&Fp(e._deps,c),l()},u)})})]).then(function(){return i(),t.onReadyBeingFired=[],A.resolve(Zi(function(){return e.on.ready.fire(e.vip)})).then(function l(){if(t.onReadyBeingFired.length>0){var u=t.onReadyBeingFired.reduce(Uo,W);return t.onReadyBeingFired=[],A.resolve(Zi(function(){return u(e.vip)})).then(l)}})}).finally(function(){t.onReadyBeingFired=null,t.isBeingOpened=!1}).then(function(){return e}).catch(function(l){t.dbOpenError=l;try{a&&a.abort()}catch{}return r===t.openCanceller&&e._close(),ie(l)}).finally(function(){t.openComplete=!0,o()})}function Xi(e){var t=function(a){return e.next(a)},n=function(a){return e.throw(a)},r=o(t),i=o(n);function o(a){return function(s){var l=a(s),u=l.value;return l.done?u:!u||typeof u.then!="function"?pe(u)?Promise.all(u).then(r,i):r(u):u.then(r,i)}}return o(t)()}function $p(e,t,n){var r=arguments.length;if(r<2)throw new V.InvalidArgument("Too few arguments");for(var i=new Array(r-1);--r;)i[r-1]=arguments[r];n=i.pop();var o=Js(i);return[e,o,n]}function El(e,t,n,r,i){return A.resolve().then(function(){var o=P.transless||P,a=e._createTransaction(t,n,e._dbSchema,r),s={trans:a,transless:o};if(r)a.idbtrans=r.idbtrans;else try{a.create(),e._state.PR1398_maxLoop=3}catch(f){return f.name===Oo.InvalidState&&e.isOpen()&&--e._state.PR1398_maxLoop>0?(console.warn("Dexie: Need to reopen db"),e._close(),e.open().then(function(){return El(e,t,n,null,i)})):ie(f)}var l=Ro(i);l&&cn();var u,c=A.follow(function(){if(u=i.call(a,a),u)if(l){var f=it.bind(null,null);u.then(f,f)}else typeof u.next=="function"&&typeof u.throw=="function"&&(u=Xi(u))},s);return(u&&typeof u.then=="function"?A.resolve(u).then(function(f){return a.active?f:ie(new V.PrematureCommit("Transaction committed too early. See http://bit.ly/2kdckMn"))}):c.then(function(){return u})).then(function(f){return r&&a._resolve(),a._completion.then(function(){return f})}).catch(function(f){return a._reject(f),ie(f)})})}function or(e,t,n){for(var r=pe(e)?e.slice():[e],i=0;i<n;++i)r.push(t);return r}function Gp(e){return K(K({},e),{table:function(t){var n=e.table(t),r=n.schema,i={},o=[];function a(v,m,w){var y=Cn(v),E=i[y]=i[y]||[],_=v==null?0:typeof v=="string"?1:v.length,b=m>0,S=K(K({},w),{isVirtual:b,keyTail:m,keyLength:_,extractKey:zi(v),unique:!b&&w.unique});if(E.push(S),S.isPrimaryKey||o.push(S),_>1){var x=_===2?v[0]:v.slice(0,_-1);a(x,m+1,w)}return E.sort(function(I,k){return I.keyTail-k.keyTail}),S}var s=a(r.primaryKey.keyPath,0,r.primaryKey);i[":id"]=[s];for(var l=0,u=r.indexes;l<u.length;l++){var c=u[l];a(c.keyPath,0,c)}function f(v){var m=i[Cn(v)];return m&&m[0]}function d(v,m){return{type:v.type===1?2:v.type,lower:or(v.lower,v.lowerOpen?e.MAX_KEY:e.MIN_KEY,m),lowerOpen:!0,upper:or(v.upper,v.upperOpen?e.MIN_KEY:e.MAX_KEY,m),upperOpen:!0}}function p(v){var m=v.query.index;return m.isVirtual?K(K({},v),{query:{index:m,range:d(v.query.range,m.keyTail)}}):v}var h=K(K({},n),{schema:K(K({},r),{primaryKey:s,indexes:o,getIndexByKeyPath:f}),count:function(v){return n.count(p(v))},query:function(v){return n.query(p(v))},openCursor:function(v){var m=v.query.index,w=m.keyTail,y=m.isVirtual,E=m.keyLength;if(!y)return n.openCursor(v);function _(b){function S(I){I!=null?b.continue(or(I,v.reverse?e.MAX_KEY:e.MIN_KEY,w)):v.unique?b.continue(b.key.slice(0,E).concat(v.reverse?e.MIN_KEY:e.MAX_KEY,w)):b.continue()}var x=Object.create(b,{continue:{value:S},continuePrimaryKey:{value:function(I,k){b.continuePrimaryKey(or(I,e.MAX_KEY,w),k)}},primaryKey:{get:function(){return b.primaryKey}},key:{get:function(){var I=b.key;return E===1?I[0]:I.slice(0,E)}},value:{get:function(){return b.value}}});return x}return n.openCursor(p(v)).then(function(b){return b&&_(b)})}});return h}})}var qp={stack:"dbcore",name:"VirtualIndexMiddleware",level:1,create:Gp};function Ko(e,t,n,r){return n=n||{},r=r||"",ne(e).forEach(function(i){if(!we(t,i))n[r+i]=void 0;else{var o=e[i],a=t[i];if(typeof o=="object"&&typeof a=="object"&&o&&a){var s=Ui(o),l=Ui(a);s!==l?n[r+i]=t[i]:s==="Object"?Ko(o,a,n,r+i+"."):o!==a&&(n[r+i]=t[i])}else o!==a&&(n[r+i]=t[i])}}),ne(t).forEach(function(i){we(e,i)||(n[r+i]=t[i])}),n}function zp(e,t){return t.type==="delete"?t.keys:t.keys||t.values.map(e.extractKey)}var Wp={stack:"dbcore",name:"HooksMiddleware",level:2,create:function(e){return K(K({},e),{table:function(t){var n=e.table(t),r=n.schema.primaryKey,i=K(K({},n),{mutate:function(o){var a=P.trans,s=a.table(t).hook,l=s.deleting,u=s.creating,c=s.updating;switch(o.type){case"add":if(u.fire===W)break;return a._promise("readwrite",function(){return f(o)},!0);case"put":if(u.fire===W&&c.fire===W)break;return a._promise("readwrite",function(){return f(o)},!0);case"delete":if(l.fire===W)break;return a._promise("readwrite",function(){return f(o)},!0);case"deleteRange":if(l.fire===W)break;return a._promise("readwrite",function(){return d(o)},!0)}return n.mutate(o);function f(h){var v=P.trans,m=h.keys||zp(r,h);if(!m)throw new Error("Keys missing");return h=h.type==="add"||h.type==="put"?K(K({},h),{keys:m}):K({},h),h.type!=="delete"&&(h.values=Ai([],h.values,!0)),h.keys&&(h.keys=Ai([],h.keys,!0)),Yp(n,h,m).then(function(w){var y=m.map(function(E,_){var b=w[_],S={onerror:null,onsuccess:null};if(h.type==="delete")l.fire.call(S,E,b,v);else if(h.type==="add"||b===void 0){var x=u.fire.call(S,E,h.values[_],v);E==null&&x!=null&&(E=x,h.keys[_]=E,r.outbound||Ae(h.values[_],r.keyPath,E))}else{var I=Ko(b,h.values[_]),k=c.fire.call(S,I,E,b,v);if(k){var L=h.values[_];Object.keys(k).forEach(function(T){we(L,T)?L[T]=k[T]:Ae(L,T,k[T])})}}return S});return n.mutate(h).then(function(E){for(var _=E.failures,b=E.results,S=E.numFailures,x=E.lastResult,I=0;I<m.length;++I){var k=b?b[I]:m[I],L=y[I];k==null?L.onerror&&L.onerror(_[I]):L.onsuccess&&L.onsuccess(h.type==="put"&&w[I]?h.values[I]:k)}return{failures:_,results:b,numFailures:S,lastResult:x}}).catch(function(E){return y.forEach(function(_){return _.onerror&&_.onerror(E)}),Promise.reject(E)})})}function d(h){return p(h.trans,h.range,1e4)}function p(h,v,m){return n.query({trans:h,values:!1,query:{index:r,range:v},limit:m}).then(function(w){var y=w.result;return f({type:"delete",keys:y,trans:h}).then(function(E){return E.numFailures>0?Promise.reject(E.failures[0]):y.length<m?{failures:[],numFailures:0,lastResult:void 0}:p(h,K(K({},v),{lower:y[y.length-1],lowerOpen:!0}),m)})})}}});return i}})}};function Yp(e,t,n){return t.type==="add"?Promise.resolve([]):e.getMany({trans:t.trans,keys:n,cache:"immutable"})}function xl(e,t,n){try{if(!t||t.keys.length<e.length)return null;for(var r=[],i=0,o=0;i<t.keys.length&&o<e.length;++i)ve(t.keys[i],e[o])===0&&(r.push(n?Hn(t.values[i]):t.values[i]),++o);return r.length===e.length?r:null}catch{return null}}var Qp={stack:"dbcore",level:-1,create:function(e){return{table:function(t){var n=e.table(t);return K(K({},n),{getMany:function(r){if(!r.cache)return n.getMany(r);var i=xl(r.keys,r.trans._cache,r.cache==="clone");return i?A.resolve(i):n.getMany(r).then(function(o){return r.trans._cache={keys:r.keys,values:r.cache==="clone"?Hn(o):o},o})},mutate:function(r){return r.type!=="add"&&(r.trans._cache=null),n.mutate(r)}})}}}},pi;function $o(e){return!("from"in e)}var Ye=function(e,t){if(this)me(this,arguments.length?{d:1,from:e,to:arguments.length>1?t:e}:{d:0});else{var n=new Ye;return e&&"d"in e&&me(n,e),n}};Jt(Ye.prototype,(pi={add:function(e){return Ur(this,e),this},addKey:function(e){return Pn(this,e,e),this},addKeys:function(e){var t=this;return e.forEach(function(n){return Pn(t,n,n)}),this}},pi[Di]=function(){return Ji(this)},pi));function Pn(e,t,n){var r=ve(t,n);if(!isNaN(r)){if(r>0)throw RangeError();if($o(e))return me(e,{from:t,to:n,d:1});var i=e.l,o=e.r;if(ve(n,e.from)<0)return i?Pn(i,t,n):e.l={from:t,to:n,d:1,l:null,r:null},Ma(e);if(ve(t,e.to)>0)return o?Pn(o,t,n):e.r={from:t,to:n,d:1,l:null,r:null},Ma(e);ve(t,e.from)<0&&(e.from=t,e.l=null,e.d=o?o.d+1:1),ve(n,e.to)>0&&(e.to=n,e.r=null,e.d=e.l?e.l.d+1:1);var a=!e.r;i&&!e.l&&Ur(e,i),o&&a&&Ur(e,o)}}function Ur(e,t){function n(r,i){var o=i.from,a=i.to,s=i.l,l=i.r;Pn(r,o,a),s&&n(r,s),l&&n(r,l)}$o(t)||n(e,t)}function Zp(e,t){var n=Ji(t),r=n.next();if(r.done)return!1;for(var i=r.value,o=Ji(e),a=o.next(i.from),s=a.value;!r.done&&!a.done;){if(ve(s.from,i.to)<=0&&ve(s.to,i.from)>=0)return!0;ve(i.from,s.from)<0?i=(r=n.next(s.from)).value:s=(a=o.next(i.from)).value}return!1}function Ji(e){var t=$o(e)?null:{s:0,n:e};return{next:function(n){for(var r=arguments.length>0;t;)switch(t.s){case 0:if(t.s=1,r)for(;t.n.l&&ve(n,t.n.from)<0;)t={up:t,n:t.n.l,s:1};else for(;t.n.l;)t={up:t,n:t.n.l,s:1};case 1:if(t.s=2,!r||ve(n,t.n.to)<=0)return{value:t.n,done:!1};case 2:if(t.n.r){t.s=3,t={up:t,n:t.n.r,s:0};continue}case 3:t=t.up}return{done:!0}}}}function Ma(e){var t,n,r=(((t=e.r)===null||t===void 0?void 0:t.d)||0)-(((n=e.l)===null||n===void 0?void 0:n.d)||0),i=r>1?"r":r<-1?"l":"";if(i){var o=i==="r"?"l":"r",a=K({},e),s=e[i];e.from=s.from,e.to=s.to,e[i]=s[i],a[i]=s[o],e[o]=a,a.d=ja(a)}e.d=ja(e)}function ja(e){var t=e.r,n=e.l;return(t?n?Math.max(t.d,n.d):t.d:n?n.d:0)+1}var Xp={stack:"dbcore",level:0,create:function(e){var t=e.schema.name,n=new Ye(e.MIN_KEY,e.MAX_KEY);return K(K({},e),{table:function(r){var i=e.table(r),o=i.schema,a=o.primaryKey,s=a.extractKey,l=a.outbound,u=K(K({},i),{mutate:function(d){var p=d.trans,h=p.mutatedParts||(p.mutatedParts={}),v=function(x){var I="idb://"+t+"/"+r+"/"+x;return h[I]||(h[I]=new Ye)},m=v(""),w=v(":dels"),y=d.type,E=d.type==="deleteRange"?[d.range]:d.type==="delete"?[d.keys]:d.values.length<50?[[],d.values]:[],_=E[0],b=E[1],S=d.trans._cache;return i.mutate(d).then(function(x){if(pe(_)){y!=="delete"&&(_=x.results),m.addKeys(_);var I=xl(_,S);!I&&y!=="add"&&w.addKeys(_),(I||b)&&Jp(v,o,I,b)}else if(_){var k={from:_.lower,to:_.upper};w.add(k),m.add(k)}else m.add(n),w.add(n),o.indexes.forEach(function(L){return v(L.name).add(n)});return x})}}),c=function(d){var p,h,v=d.query,m=v.index,w=v.range;return[m,new Ye((p=w.lower)!==null&&p!==void 0?p:e.MIN_KEY,(h=w.upper)!==null&&h!==void 0?h:e.MAX_KEY)]},f={get:function(d){return[a,new Ye(d.key)]},getMany:function(d){return[a,new Ye().addKeys(d.keys)]},count:c,query:c,openCursor:c};return ne(f).forEach(function(d){u[d]=function(p){var h=P.subscr;if(h){var v=function(S){var x="idb://"+t+"/"+r+"/"+S;return h[x]||(h[x]=new Ye)},m=v(""),w=v(":dels"),y=f[d](p),E=y[0],_=y[1];if(v(E.name||"").add(_),!E.isPrimaryKey)if(d==="count")w.add(n);else{var b=d==="query"&&l&&p.values&&i.query(K(K({},p),{values:!1}));return i[d].apply(this,arguments).then(function(S){if(d==="query"){if(l&&p.values)return b.then(function(L){var T=L.result;return m.addKeys(T),S});var x=p.values?S.result.map(s):S.result;p.values?m.addKeys(x):w.addKeys(x)}else if(d==="openCursor"){var I=S,k=p.values;return I&&Object.create(I,{key:{get:function(){return w.addKey(I.primaryKey),I.key}},primaryKey:{get:function(){var L=I.primaryKey;return w.addKey(L),L}},value:{get:function(){return k&&m.addKey(I.primaryKey),I.value}}})}return S})}}return i[d].apply(this,arguments)}}),u}})}};function Jp(e,t,n,r){function i(o){var a=e(o.name||"");function s(u){return u!=null?o.extractKey(u):null}var l=function(u){return o.multiEntry&&pe(u)?u.forEach(function(c){return a.addKey(c)}):a.addKey(u)};(n||r).forEach(function(u,c){var f=n&&s(n[c]),d=r&&s(r[c]);ve(f,d)!==0&&(f!=null&&l(f),d!=null&&l(d))})}t.indexes.forEach(i)}var Yt=function(){function e(t,n){var r=this;this._middlewares={},this.verno=0;var i=e.dependencies;this._options=n=K({addons:e.addons,autoOpen:!0,indexedDB:i.indexedDB,IDBKeyRange:i.IDBKeyRange},n),this._deps={indexedDB:n.indexedDB,IDBKeyRange:n.IDBKeyRange};var o=n.addons;this._dbSchema={},this._versions=[],this._storeNames=[],this._allTables={},this.idbdb=null,this._novip=this;var a={dbOpenError:null,isBeingOpened:!1,onReadyBeingFired:null,openComplete:!1,dbReadyResolve:W,dbReadyPromise:null,cancelOpen:W,openCanceller:null,autoSchema:!0,PR1398_maxLoop:3};a.dbReadyPromise=new A(function(s){a.dbReadyResolve=s}),a.openCanceller=new A(function(s,l){a.cancelOpen=l}),this._state=a,this.name=t,this.on=qn(this,"populate","blocked","versionchange","close",{ready:[Uo,W]}),this.on.ready.subscribe=Ys(this.on.ready.subscribe,function(s){return function(l,u){e.vip(function(){var c=r._state;if(c.openComplete)c.dbOpenError||A.resolve().then(l),u&&s(l);else if(c.onReadyBeingFired)c.onReadyBeingFired.push(l),u&&s(l);else{s(l);var f=r;u||s(function d(){f.on.ready.unsubscribe(l),f.on.ready.unsubscribe(d)})}})}}),this.Collection=hp(this),this.Table=up(this),this.Transaction=Ep(this),this.Version=jp(this),this.WhereClause=wp(this),this.on("versionchange",function(s){s.newVersion>0?console.warn("Another connection wants to upgrade database '"+r.name+"'. Closing db now to resume the upgrade."):console.warn("Another connection wants to delete database '"+r.name+"'. Closing db now to resume the delete request."),r.close()}),this.on("blocked",function(s){!s.newVersion||s.newVersion<s.oldVersion?console.warn("Dexie.delete('"+r.name+"') was blocked"):console.warn("Upgrade '"+r.name+"' blocked by other connection holding version "+s.oldVersion/10)}),this._maxKey=Dn(n.IDBKeyRange),this._createTransaction=function(s,l,u,c){return new r.Transaction(s,l,u,r._options.chromeTransactionDurability,c)},this._fireOnBlocked=function(s){r.on("blocked").fire(s),Sn.filter(function(l){return l.name===r.name&&l!==r&&!l._state.vcFired}).map(function(l){return l.on("versionchange").fire(s)})},this.use(qp),this.use(Wp),this.use(Xp),this.use(Qp),this.vip=Object.create(this,{_vip:{value:!0}}),o.forEach(function(s){return s(r)})}return e.prototype.version=function(t){if(isNaN(t)||t<.1)throw new V.Type("Given version is not a positive number");if(t=Math.round(t*10)/10,this.idbdb||this._state.isBeingOpened)throw new V.Schema("Cannot add version when database is open");this.verno=Math.max(this.verno,t);var n=this._versions,r=n.filter(function(i){return i._cfg.version===t})[0];return r||(r=new this.Version(t),n.push(r),n.sort(Lp),r.stores({}),this._state.autoSchema=!1,r)},e.prototype._whenReady=function(t){var n=this;return this.idbdb&&(this._state.openComplete||P.letThrough||this._vip)?t():new A(function(r,i){if(n._state.openComplete)return i(new V.DatabaseClosed(n._state.dbOpenError));if(!n._state.isBeingOpened){if(!n._options.autoOpen){i(new V.DatabaseClosed);return}n.open().catch(W)}n._state.dbReadyPromise.then(r,i)}).then(t)},e.prototype.use=function(t){var n=t.stack,r=t.create,i=t.level,o=t.name;o&&this.unuse({stack:n,name:o});var a=this._middlewares[n]||(this._middlewares[n]=[]);return a.push({stack:n,create:r,level:i==null?10:i,name:o}),a.sort(function(s,l){return s.level-l.level}),this},e.prototype.unuse=function(t){var n=t.stack,r=t.name,i=t.create;return n&&this._middlewares[n]&&(this._middlewares[n]=this._middlewares[n].filter(function(o){return i?o.create!==i:r?o.name!==r:!1})),this},e.prototype.open=function(){return Kp(this)},e.prototype._close=function(){var t=this._state,n=Sn.indexOf(this);if(n>=0&&Sn.splice(n,1),this.idbdb){try{this.idbdb.close()}catch{}this._novip.idbdb=null}t.dbReadyPromise=new A(function(r){t.dbReadyResolve=r}),t.openCanceller=new A(function(r,i){t.cancelOpen=i})},e.prototype.close=function(){this._close();var t=this._state;this._options.autoOpen=!1,t.dbOpenError=new V.DatabaseClosed,t.isBeingOpened&&t.cancelOpen(t.dbOpenError)},e.prototype.delete=function(){var t=this,n=arguments.length>0,r=this._state;return new A(function(i,o){var a=function(){t.close();var s=t._deps.indexedDB.deleteDatabase(t.name);s.onsuccess=X(function(){Bp(t._deps,t.name),i()}),s.onerror=Me(o),s.onblocked=t._fireOnBlocked};if(n)throw new V.InvalidArgument("Arguments not allowed in db.delete()");r.isBeingOpened?r.dbReadyPromise.then(a):a()})},e.prototype.backendDB=function(){return this.idbdb},e.prototype.isOpen=function(){return this.idbdb!==null},e.prototype.hasBeenClosed=function(){var t=this._state.dbOpenError;return t&&t.name==="DatabaseClosed"},e.prototype.hasFailed=function(){return this._state.dbOpenError!==null},e.prototype.dynamicallyOpened=function(){return this._state.autoSchema},Object.defineProperty(e.prototype,"tables",{get:function(){var t=this;return ne(this._allTables).map(function(n){return t._allTables[n]})},enumerable:!1,configurable:!0}),e.prototype.transaction=function(){var t=$p.apply(this,arguments);return this._transaction.apply(this,t)},e.prototype._transaction=function(t,n,r){var i=this,o=P.trans;(!o||o.db!==this||t.indexOf("!")!==-1)&&(o=null);var a=t.indexOf("?")!==-1;t=t.replace("!","").replace("?","");var s,l;try{if(l=n.map(function(c){var f=c instanceof i.Table?c.name:c;if(typeof f!="string")throw new TypeError("Invalid table argument to Dexie.transaction(). Only Table or String are allowed");return f}),t=="r"||t===li)s=li;else if(t=="rw"||t==ui)s=ui;else throw new V.InvalidArgument("Invalid transaction mode: "+t);if(o){if(o.mode===li&&s===ui)if(a)o=null;else throw new V.SubTransaction("Cannot enter a sub-transaction with READWRITE mode when parent transaction is READONLY");o&&l.forEach(function(c){if(o&&o.storeNames.indexOf(c)===-1)if(a)o=null;else throw new V.SubTransaction("Table "+c+" not included in parent transaction.")}),a&&o&&!o.active&&(o=null)}}catch(c){return o?o._promise(null,function(f,d){d(c)}):ie(c)}var u=El.bind(null,this,s,l,o,r);return o?o._promise(s,u,"lock"):P.trans?dn(P.transless,function(){return i._whenReady(u)}):this._whenReady(u)},e.prototype.table=function(t){if(!we(this._allTables,t))throw new V.InvalidTable("Table "+t+" does not exist");return this._allTables[t]},e}(),eh=typeof Symbol<"u"&&"observable"in Symbol?Symbol.observable:"@@observable",th=function(){function e(t){this._subscribe=t}return e.prototype.subscribe=function(t,n,r){return this._subscribe(!t||typeof t=="function"?{next:t,error:n,complete:r}:t)},e.prototype[eh]=function(){return this},e}();function Sl(e,t){return ne(t).forEach(function(n){var r=e[n]||(e[n]=new Ye);Ur(r,t[n])}),e}function nh(e){return new th(function(t){var n=Ro(e);function r(p){n&&cn();var h=function(){return mt(e,{subscr:p,trans:null})},v=P.trans?dn(P.transless,h):h();return n&&v.then(it,it),v}var i=!1,o={},a={},s={get closed(){return i},unsubscribe:function(){i=!0,yt.storagemutated.unsubscribe(f)}};t.start&&t.start(s);var l=!1,u=!1;function c(){return ne(a).some(function(p){return o[p]&&Zp(o[p],a[p])})}var f=function(p){Sl(o,p),c()&&d()},d=function(){if(!(l||i)){o={};var p={},h=r(p);u||(yt(Un,f),u=!0),l=!0,Promise.resolve(h).then(function(v){l=!1,!i&&(c()?d():(o={},a=p,t.next&&t.next(v)))},function(v){l=!1,t.error&&t.error(v),s.unsubscribe()})}};return d(),s})}var eo;try{eo={indexedDB:Q.indexedDB||Q.mozIndexedDB||Q.webkitIndexedDB||Q.msIndexedDB,IDBKeyRange:Q.IDBKeyRange||Q.webkitIDBKeyRange}}catch{eo={indexedDB:null,IDBKeyRange:null}}var It=Yt;Jt(It,K(K({},qr),{delete:function(e){var t=new It(e,{addons:[]});return t.delete()},exists:function(e){return new It(e,{addons:[]}).open().then(function(t){return t.close(),!0}).catch("NoSuchDatabaseError",function(){return!1})},getDatabaseNames:function(e){try{return Vp(It.dependencies).then(e)}catch{return ie(new V.MissingAPI)}},defineClass:function(){function e(t){me(this,t)}return e},ignoreTransaction:function(e){return P.trans?dn(P.transless,e):e()},vip:Zi,async:function(e){return function(){try{var t=Xi(e.apply(this,arguments));return!t||typeof t.then!="function"?A.resolve(t):t}catch(n){return ie(n)}}},spawn:function(e,t,n){try{var r=Xi(e.apply(n,t||[]));return!r||typeof r.then!="function"?A.resolve(r):r}catch(i){return ie(i)}},currentTransaction:{get:function(){return P.trans||null}},waitFor:function(e,t){var n=A.resolve(typeof e=="function"?It.ignoreTransaction(e):e).timeout(t||6e4);return P.trans?P.trans.waitFor(n):n},Promise:A,debug:{get:function(){return qe},set:function(e){tl(e,e==="dexie"?function(){return!0}:vl)}},derive:ln,extend:me,props:Jt,override:Ys,Events:qn,on:yt,liveQuery:nh,extendObservabilitySet:Sl,getByKeyPath:tt,setByKeyPath:Ae,delByKeyPath:Df,shallowClone:Xs,deepClone:Hn,getObjectDiff:Ko,cmp:ve,asap:Qs,minKey:Gi,addons:[],connections:Sn,errnames:Oo,dependencies:eo,semVer:Aa,version:Aa.split(".").map(function(e){return parseInt(e)}).reduce(function(e,t,n){return e+t/Math.pow(10,n*2)})}));It.maxKey=Dn(It.dependencies.IDBKeyRange);typeof dispatchEvent<"u"&&typeof addEventListener<"u"&&(yt(Un,function(e){if(!Je){var t;zr?(t=document.createEvent("CustomEvent"),t.initCustomEvent(dt,!0,!0,e)):t=new CustomEvent(dt,{detail:e}),Je=!0,dispatchEvent(t),Je=!1}}),addEventListener(dt,function(e){var t=e.detail;Je||Dr(t)}));function Dr(e){var t=Je;try{Je=!0,yt.storagemutated.fire(e)}finally{Je=t}}var Je=!1;if(typeof BroadcastChannel<"u"){var ar=new BroadcastChannel(dt);typeof ar.unref=="function"&&ar.unref(),yt(Un,function(e){Je||ar.postMessage(e)}),ar.onmessage=function(e){e.data&&Dr(e.data)}}else if(typeof self<"u"&&typeof navigator<"u"){yt(Un,function(e){try{Je||(typeof localStorage<"u"&&localStorage.setItem(dt,JSON.stringify({trig:Math.random(),changedParts:e})),typeof self.clients=="object"&&Ai([],self.clients.matchAll({includeUncontrolled:!0}),!0).forEach(function(t){return t.postMessage({type:dt,changedParts:e})}))}catch{}}),typeof addEventListener<"u"&&addEventListener("storage",function(e){if(e.key===dt){var t=JSON.parse(e.newValue);t&&Dr(t.changedParts)}});var Va=self.document&&navigator.serviceWorker;Va&&Va.addEventListener("message",rh)}function rh(e){var t=e.data;t&&t.type===dt&&Dr(t.changedParts)}A.rejectionMapper=Kf;tl(qe,vl);var Cl={exports:{}};(function(e,t){(function(n,r){e.exports=r()})(z,function(){var n=function(o,a){if(a=a||{},typeof o!="function")throw new i("fetch must be a function");if(typeof a!="object")throw new i("defaults must be an object");if(a.retries!==void 0&&!r(a.retries))throw new i("retries must be a positive integer");if(a.retryDelay!==void 0&&!r(a.retryDelay)&&typeof a.retryDelay!="function")throw new i("retryDelay must be a positive integer or a function returning a positive integer");if(a.retryOn!==void 0&&!Array.isArray(a.retryOn)&&typeof a.retryOn!="function")throw new i("retryOn property expects an array or function");var s={retries:3,retryDelay:1e3,retryOn:[]};return a=Object.assign(s,a),function(u,c){var f=a.retries,d=a.retryDelay,p=a.retryOn;if(c&&c.retries!==void 0)if(r(c.retries))f=c.retries;else throw new i("retries must be a positive integer");if(c&&c.retryDelay!==void 0)if(r(c.retryDelay)||typeof c.retryDelay=="function")d=c.retryDelay;else throw new i("retryDelay must be a positive integer or a function returning a positive integer");if(c&&c.retryOn)if(Array.isArray(c.retryOn)||typeof c.retryOn=="function")p=c.retryOn;else throw new i("retryOn property expects an array or function");return new Promise(function(h,v){var m=function(y){var E=typeof Request<"u"&&u instanceof Request?u.clone():u;o(E,c).then(function(_){if(Array.isArray(p)&&p.indexOf(_.status)===-1)h(_);else if(typeof p=="function")try{return Promise.resolve(p(y,null,_)).then(function(b){b?w(y,null,_):h(_)}).catch(v)}catch(b){v(b)}else y<f?w(y,null,_):h(_)}).catch(function(_){if(typeof p=="function")try{Promise.resolve(p(y,_,null)).then(function(b){b?w(y,_,null):v(_)}).catch(function(b){v(b)})}catch(b){v(b)}else y<f?w(y,_,null):v(_)})};function w(y,E,_){var b=typeof d=="function"?d(y,E,_):d;setTimeout(function(){m(++y)},b)}m(0)})}};function r(o){return Number.isInteger(o)&&o>=0}function i(o){this.name="ArgumentError",this.message=o}return n})})(Cl);const ih=Cl.exports;class oh{constructor(t){ce(this,"awaitingResolvers",[]);ce(this,"activeCount",0);this.capacity=t}async acquire(){if(this.activeCount<this.capacity){this.activeCount++;return}return new Promise(t=>{this.awaitingResolvers.push(t)})}release(){const t=this.awaitingResolvers.shift();t&&this.activeCount<=this.capacity?t():this.activeCount--}async execute(t){try{return await this.acquire(),await t()}finally{this.release()}}setLimit(t){this.capacity=t}}const Il=new oh(2),ah=e=>Il.setLimit(e),sh=ih(fetch),lh=async(e,t=3)=>Il.execute(async()=>{const r=(await sh(e.uploadUrl,{body:e.data,method:"PUT",retries:t,retryDelay:i=>Math.pow(2,i)*1e3})).headers.get("ETag");if(!r)throw new Error(`Upload response did not include etag for upload ${e.uploadId}, part ${e.chunkIndex}`);return r}),uh=async({apiUrl:e,surveyId:t,uploadId:n,etags:r,headers:i,responseGroupUuid:o,replayDuration:a})=>He(`${e}/sdk/1/completeSessionReplay`,{method:"POST",body:JSON.stringify({etags:r,uploadId:n,responseGroupUuid:o,surveyId:t,replayDuration:a}),headers:i});var fn=(e=>(e.ReadyForUpload="ReadyForUpload",e.UploadComplete="UploadComplete",e))(fn||{}),Nn=(e=>(e.After="after",e.Before="before",e.BeforeAndAfter="beforeAndAfter",e))(Nn||{});const Fa="sprig.sessionId",kl="sprig.disableReplayRecording",Tl=()=>{sessionStorage.setItem(kl,"disabled")},en=()=>!!sessionStorage.getItem(kl),Ba=(e,t,n)=>{en()||(Ll(),Tl()),t instanceof Error&&window.UserLeap.reportError(e,t,n)},bt=(e,t)=>{var n,r;(r=(n=window.navigator)==null?void 0:n.storage)!=null&&r.estimate?window.navigator.storage.estimate().then(i=>{Ba(e,t,i)}).catch(i=>{window.UserLeap.reportError("Error getting storage estimate: ",i)}):Ba(e,t)},ch=()=>{const e=sessionStorage.getItem(Fa);if(e)return e;const t=vt();return sessionStorage.setItem(Fa,t),t},ot=ch(),Ll=()=>{Promise.all([oe.events.clear(),oe.chunkUploads.clear(),oe.pendingCaptures.clear()]).catch(e=>{window.UserLeap.reportError("Error wiping database: ",e)})},hi=(e,t)=>oe.table(t).where("timestamp").below(e).delete(),dh=()=>{oe.events.where("sessionId").equals(ot).delete(),oe.pendingCaptures.where("sessionId").equals(ot).delete()},fh=e=>{const t=e.map(n=>{var r;return{...n,sessionId:(r=n.sessionId)!=null?r:ot}});return oe.events.bulkAdd(t)},ph=e=>oe.events.where("[sessionId+timestamp]").between([ot,e],[ot,Number.MAX_VALUE]).toArray(),hh=e=>{var t;return oe.chunkUploads.add({...e,sessionId:(t=e.sessionId)!=null?t:ot})},vh=(e,t)=>oe.chunkUploads.update(e,{data:null,etag:t,status:fn.UploadComplete}),mh=({status:e,uploadId:t})=>t?oe.chunkUploads.where({uploadId:t,status:e}).toArray():oe.chunkUploads.where({sessionId:ot,status:e}).toArray(),gh=e=>oe.chunkUploads.where({uploadId:e,status:fn.UploadComplete}).toArray(),yh=e=>oe.chunkUploads.where({uploadId:e,status:fn.UploadComplete}).delete(),_h=e=>{var t;return oe.pendingCaptures.add({...e,sessionId:(t=e.sessionId)!=null?t:ot})},wh=()=>oe.pendingCaptures.where("sessionId").equals(ot).and(e=>e.targetTimestamp<Date.now()).toArray();class bh extends Yt{constructor(){super("replayStorage",{autoOpen:!1});ce(this,"events");ce(this,"chunkUploads");ce(this,"pendingCaptures")}}const oe=new bh;oe.version(1).stores({events:"uuid, timestamp, [sessionId+timestamp]",chunkUploads:"uuid, timestamp, [sessionId+status], [uploadId+status], [sessionId+status+uploadId]",pendingCaptures:"uuid, timestamp, [sessionId+targetTimestamp]"});oe.open().catch(()=>{Tl()});const Eh=async(e,t,n)=>new Promise((r,i)=>{const o=e.createElement("script");o.src=t,o.onload=r,o.onerror=i,n&&(o.nonce=n),e.head.appendChild(o)});let Rl=5e3;const xh=5,Al=30,to=Al+xh,Go="sprig.pendingCount",Sh=sessionStorage.getItem("sprig.sessionId"),Ch=async(e,t,n,r=2,i)=>{try{if(await Yt.exists("sprig.replay")&&await Yt.delete("sprig.replay"),en())return;if(!t){await Yt.exists("replayStorage")&&Ll();return}i!=null&&i.minDuration&&(Rl=i.minDuration),ah(r),Uh(),Th(t+to,30*60,t+to),Lh();const o=window;o.rrwebRecord||await Eh(e,"https://cdn.sprig.com/dependencies/record-2.0.0-alpha.6.min.js",n);const a=o.rrwebRecord;if(!a)return;let s=!0;a({checkoutEveryNms:Al*1e3,sampling:{input:"last",scroll:250,media:800},emit:(l,u)=>{if(en())return;const c=s||!!u;s=!1,Ih({uuid:vt(),event:JSON.stringify(l),isValidStart:c,timestamp:Date.now()})},...i})}catch(o){bt("Error initializing replay: ",o)}};let no=!1,ro=[];const Ih=e=>{ro.push(e),no||kh()},kh=()=>{no=!0,setTimeout(async()=>{if(en())return;const e=ro;ro=[],no=!1;try{fh(e)}catch(t){bt("Error storing replay events: ",t)}},500)},Th=(e=6*60,t=30*60,n=4*60)=>{setInterval(async()=>{const r=Date.now();try{await Promise.all([hi(r-e*1e3,"events"),hi(r-t*1e3,"chunkUploads"),hi(r-n*1e3,"pendingCaptures")])}catch(i){bt("Error deleting table rows: ",i)}},30*1e3)},Lh=(e=5)=>{setInterval(Nh,e*1e3)},Rh=async e=>{try{const t=await ph(Date.now()-(e+to)*1e3);if(!(t!=null&&t.length))return;let n=-1;const r=Date.now()-e*1e3;return t==null||t.forEach((i,o)=>{if(!i.isValidStart)return;const a=i.timestamp<=r;(n<0||a)&&(n=o)}),n<0?[]:t==null?void 0:t.slice(n)}catch(t){bt("Error getting events for capture: ",t)}},Ah=async e=>{const t=`[${e.map(i=>i.event).join(",")}]`,r=new TextEncoder().encode(t);try{if(window.CompressionStream===void 0)return r;const i=new CompressionStream("gzip"),o=i.writable.getWriter();return o.write(r),o.close(),new Uint8Array(await new Response(i.readable).arrayBuffer())}catch(i){return i instanceof Error&&window.UserLeap.reportError("Error compressing replay for upload",i),r}},Oh=(e,t,n)=>{const r=e.length,i=t*1024*1024,o=Math.ceil(r/n),a=Math.max(i,o),s=[];let l=0;for(;l<r;)s.push(e.slice(l,l+a)),l+=a;return s},Ol=e=>Promise.all(e.map(async t=>{const n=await lh(t);return await vh(t.uuid,n),t.uploadId})),Ul=async e=>{const t=await gh(e);if(!(t!=null&&t.length))return;t.sort((i,o)=>i.chunkIndex-o.chunkIndex);const n=t.map(i=>({ETag:i.etag,PartNumber:i.chunkIndex})).filter(i=>i.ETag!==null),r=t[0];await uh({apiUrl:r.apiUrl,surveyId:r.surveyId,uploadId:e,responseGroupUuid:r.responseGroupId,etags:n,headers:r.completeUploadHeaders,replayDuration:r.replayDuration}),await yh(e)},Uh=async()=>{try{const e=await mh({status:fn.ReadyForUpload});if(!(e!=null&&e.length))return;const t=await Ol(e);t!=null&&t.length&&await Promise.all(t.map(async n=>{n&&await Ul(n)}))}catch(e){bt("Error getting chunk upload uuids: ",e)}},Dh=async(e,t)=>{await Ol(t),await Promise.all(e.map(n=>Ul(n)))},Dl=async e=>{if(!en())try{const{surveyId:t,responseGroupId:n,visitorId:r,apiUrl:i,completeUploadHeaders:o,replayParams:a}=e;if(a.replayDurationType===Nn.After||a.replayDurationType===Nn.BeforeAndAfter)return Ph(e);const s=await Rh(a.replayDurationSeconds);if(!(s!=null&&s.length))return;const l=s[s.length-1].timestamp-s[0].timestamp;if(l<=Rl)return;const u=await Ah(s),c=Oh(u,a.minimumChunkSizeMb,a.signedUrls.length),f=Date.now(),d=await Promise.all(c.map(async(p,h)=>{const v=vt(),m={apiUrl:i,chunkIndex:h+1,completeUploadHeaders:o,etag:null,replayDuration:l,responseGroupId:n,sessionId:Sh,status:fn.ReadyForUpload,surveyId:t,timestamp:f,totalChunks:c.length,data:p,uploadId:a.uploadId,uploadUrl:a.signedUrls[h].url,uuid:v,visitorId:r};return await hh(m),m}));await Dh([a.uploadId],d)}catch(t){bt("Error scheduling or capturing replay",t)}},Ha=()=>{if(!en())try{dh()}catch(e){bt("Error clearing session event data: ",e)}};let Ze=sessionStorage.getItem(Go);const Ph=e=>{const t={...e,replayParams:{...e.replayParams}};e.replayParams.replayDurationType===Nn.BeforeAndAfter&&(t.replayParams.replayDurationSeconds*=2),t.replayParams.replayDurationType=Nn.Before;const n=Date.now()+e.replayParams.replayDurationSeconds*1e3;return Ze=Ze?(parseInt(Ze)+1).toString():"1",sessionStorage.setItem(Go,Ze),_h({uuid:vt(),targetTimestamp:n,timestamp:Date.now(),captureParams:t})},Nh=async()=>{try{if(Ze&&parseInt(Ze)>0){const e=await wh();e.length&&await Promise.all(e.map(async t=>{await oe.pendingCaptures.delete(t.uuid),await Dl(t.captureParams)})),Ze=(parseInt(Ze)-e.length).toString(),sessionStorage.setItem(Go,Ze)}}catch(e){bt("Error initiating pending captures",e)}};var Wn,D,Pl,tn,kt,Ka,Nl,Ml,Pr={},jl=[],Mh=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i;function et(e,t){for(var n in t)e[n]=t[n];return e}function Vl(e){var t=e.parentNode;t&&t.removeChild(e)}function ee(e,t,n){var r,i,o,a={};for(o in t)o=="key"?r=t[o]:o=="ref"?i=t[o]:a[o]=t[o];if(arguments.length>2&&(a.children=arguments.length>3?Wn.call(arguments,2):n),typeof e=="function"&&e.defaultProps!=null)for(o in e.defaultProps)a[o]===void 0&&(a[o]=e.defaultProps[o]);return In(e,a,r,i,null)}function In(e,t,n,r,i){var o={type:e,props:t,key:n,ref:r,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,__h:null,constructor:void 0,__v:i==null?++Pl:i};return i==null&&D.vnode!=null&&D.vnode(o),o}function Fl(){return{current:null}}function De(e){return e.children}function jh(e,t,n,r,i){var o;for(o in n)o==="children"||o==="key"||o in t||Nr(e,o,null,n[o],r);for(o in t)i&&typeof t[o]!="function"||o==="children"||o==="key"||o==="value"||o==="checked"||n[o]===t[o]||Nr(e,o,t[o],n[o],r)}function $a(e,t,n){t[0]==="-"?e.setProperty(t,n==null?"":n):e[t]=n==null?"":typeof n!="number"||Mh.test(t)?n:n+"px"}function Nr(e,t,n,r,i){var o;e:if(t==="style")if(typeof n=="string")e.style.cssText=n;else{if(typeof r=="string"&&(e.style.cssText=r=""),r)for(t in r)n&&t in n||$a(e.style,t,"");if(n)for(t in n)r&&n[t]===r[t]||$a(e.style,t,n[t])}else if(t[0]==="o"&&t[1]==="n")o=t!==(t=t.replace(/Capture$/,"")),t=t.toLowerCase()in e?t.toLowerCase().slice(2):t.slice(2),e.l||(e.l={}),e.l[t+o]=n,n?r||e.addEventListener(t,o?qa:Ga,o):e.removeEventListener(t,o?qa:Ga,o);else if(t!=="dangerouslySetInnerHTML"){if(i)t=t.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(t!=="width"&&t!=="height"&&t!=="href"&&t!=="list"&&t!=="form"&&t!=="tabIndex"&&t!=="download"&&t in e)try{e[t]=n==null?"":n;break e}catch{}typeof n=="function"||(n==null||n===!1&&t.indexOf("-")==-1?e.removeAttribute(t):e.setAttribute(t,n))}}function Ga(e){tn=!0;try{return this.l[e.type+!1](D.event?D.event(e):e)}finally{tn=!1}}function qa(e){tn=!0;try{return this.l[e.type+!0](D.event?D.event(e):e)}finally{tn=!1}}function Oe(e,t){this.props=e,this.context=t}function Mn(e,t){if(t==null)return e.__?Mn(e.__,e.__.__k.indexOf(e)+1):null;for(var n;t<e.__k.length;t++)if((n=e.__k[t])!=null&&n.__e!=null)return n.__e;return typeof e.type=="function"?Mn(e):null}function Bl(e){var t,n;if((e=e.__)!=null&&e.__c!=null){for(e.__e=e.__c.base=null,t=0;t<e.__k.length;t++)if((n=e.__k[t])!=null&&n.__e!=null){e.__e=e.__c.base=n.__e;break}return Bl(e)}}function Vh(e){tn?setTimeout(e):Nl(e)}function io(e){(!e.__d&&(e.__d=!0)&&kt.push(e)&&!Mr.__r++||Ka!==D.debounceRendering)&&((Ka=D.debounceRendering)||Vh)(Mr)}function Mr(){var e,t,n,r,i,o,a,s;for(kt.sort(function(l,u){return l.__v.__b-u.__v.__b});e=kt.shift();)e.__d&&(t=kt.length,r=void 0,i=void 0,a=(o=(n=e).__v).__e,(s=n.__P)&&(r=[],(i=et({},o)).__v=o.__v+1,qo(s,o,i,n.__n,s.ownerSVGElement!==void 0,o.__h!=null?[a]:null,r,a==null?Mn(o):a,o.__h),ql(r,o),o.__e!=a&&Bl(o)),kt.length>t&&kt.sort(function(l,u){return l.__v.__b-u.__v.__b}));Mr.__r=0}function Hl(e,t,n,r,i,o,a,s,l,u){var c,f,d,p,h,v,m,w=r&&r.__k||jl,y=w.length;for(n.__k=[],c=0;c<t.length;c++)if((p=n.__k[c]=(p=t[c])==null||typeof p=="boolean"?null:typeof p=="string"||typeof p=="number"||typeof p=="bigint"?In(null,p,null,null,p):Array.isArray(p)?In(De,{children:p},null,null,null):p.__b>0?In(p.type,p.props,p.key,p.ref?p.ref:null,p.__v):p)!=null){if(p.__=n,p.__b=n.__b+1,(d=w[c])===null||d&&p.key==d.key&&p.type===d.type)w[c]=void 0;else for(f=0;f<y;f++){if((d=w[f])&&p.key==d.key&&p.type===d.type){w[f]=void 0;break}d=null}qo(e,p,d=d||Pr,i,o,a,s,l,u),h=p.__e,(f=p.ref)&&d.ref!=f&&(m||(m=[]),d.ref&&m.push(d.ref,null,p),m.push(f,p.__c||h,p)),h!=null?(v==null&&(v=h),typeof p.type=="function"&&p.__k===d.__k?p.__d=l=Kl(p,l,e):l=$l(e,p,d,w,h,l),typeof n.type=="function"&&(n.__d=l)):l&&d.__e==l&&l.parentNode!=e&&(l=Mn(d))}for(n.__e=v,c=y;c--;)w[c]!=null&&(typeof n.type=="function"&&w[c].__e!=null&&w[c].__e==n.__d&&(n.__d=Gl(r).nextSibling),Wl(w[c],w[c]));if(m)for(c=0;c<m.length;c++)zl(m[c],m[++c],m[++c])}function Kl(e,t,n){for(var r,i=e.__k,o=0;i&&o<i.length;o++)(r=i[o])&&(r.__=e,t=typeof r.type=="function"?Kl(r,t,n):$l(n,r,r,i,r.__e,t));return t}function nt(e,t){return t=t||[],e==null||typeof e=="boolean"||(Array.isArray(e)?e.some(function(n){nt(n,t)}):t.push(e)),t}function $l(e,t,n,r,i,o){var a,s,l;if(t.__d!==void 0)a=t.__d,t.__d=void 0;else if(n==null||i!=o||i.parentNode==null)e:if(o==null||o.parentNode!==e)e.appendChild(i),a=null;else{for(s=o,l=0;(s=s.nextSibling)&&l<r.length;l+=1)if(s==i)break e;e.insertBefore(i,o),a=o}return a!==void 0?a:i.nextSibling}function Gl(e){var t,n,r;if(e.type==null||typeof e.type=="string")return e.__e;if(e.__k){for(t=e.__k.length-1;t>=0;t--)if((n=e.__k[t])&&(r=Gl(n)))return r}return null}function qo(e,t,n,r,i,o,a,s,l){var u,c,f,d,p,h,v,m,w,y,E,_,b,S,x,I=t.type;if(t.constructor!==void 0)return null;n.__h!=null&&(l=n.__h,s=t.__e=n.__e,t.__h=null,o=[s]),(u=D.__b)&&u(t);try{e:if(typeof I=="function"){if(m=t.props,w=(u=I.contextType)&&r[u.__c],y=u?w?w.props.value:u.__:r,n.__c?v=(c=t.__c=n.__c).__=c.__E:("prototype"in I&&I.prototype.render?t.__c=c=new I(m,y):(t.__c=c=new Oe(m,y),c.constructor=I,c.render=Bh),w&&w.sub(c),c.props=m,c.state||(c.state={}),c.context=y,c.__n=r,f=c.__d=!0,c.__h=[],c._sb=[]),c.__s==null&&(c.__s=c.state),I.getDerivedStateFromProps!=null&&(c.__s==c.state&&(c.__s=et({},c.__s)),et(c.__s,I.getDerivedStateFromProps(m,c.__s))),d=c.props,p=c.state,c.__v=t,f)I.getDerivedStateFromProps==null&&c.componentWillMount!=null&&c.componentWillMount(),c.componentDidMount!=null&&c.__h.push(c.componentDidMount);else{if(I.getDerivedStateFromProps==null&&m!==d&&c.componentWillReceiveProps!=null&&c.componentWillReceiveProps(m,y),!c.__e&&c.shouldComponentUpdate!=null&&c.shouldComponentUpdate(m,c.__s,y)===!1||t.__v===n.__v){for(t.__v!==n.__v&&(c.props=m,c.state=c.__s,c.__d=!1),t.__e=n.__e,t.__k=n.__k,t.__k.forEach(function(k){k&&(k.__=t)}),E=0;E<c._sb.length;E++)c.__h.push(c._sb[E]);c._sb=[],c.__h.length&&a.push(c);break e}c.componentWillUpdate!=null&&c.componentWillUpdate(m,c.__s,y),c.componentDidUpdate!=null&&c.__h.push(function(){c.componentDidUpdate(d,p,h)})}if(c.context=y,c.props=m,c.__P=e,_=D.__r,b=0,"prototype"in I&&I.prototype.render){for(c.state=c.__s,c.__d=!1,_&&_(t),u=c.render(c.props,c.state,c.context),S=0;S<c._sb.length;S++)c.__h.push(c._sb[S]);c._sb=[]}else do c.__d=!1,_&&_(t),u=c.render(c.props,c.state,c.context),c.state=c.__s;while(c.__d&&++b<25);c.state=c.__s,c.getChildContext!=null&&(r=et(et({},r),c.getChildContext())),f||c.getSnapshotBeforeUpdate==null||(h=c.getSnapshotBeforeUpdate(d,p)),x=u!=null&&u.type===De&&u.key==null?u.props.children:u,Hl(e,Array.isArray(x)?x:[x],t,n,r,i,o,a,s,l),c.base=t.__e,t.__h=null,c.__h.length&&a.push(c),v&&(c.__E=c.__=null),c.__e=!1}else o==null&&t.__v===n.__v?(t.__k=n.__k,t.__e=n.__e):t.__e=Fh(n.__e,t,n,r,i,o,a,l);(u=D.diffed)&&u(t)}catch(k){t.__v=null,(l||o!=null)&&(t.__e=s,t.__h=!!l,o[o.indexOf(s)]=null),D.__e(k,t,n)}}function ql(e,t){D.__c&&D.__c(t,e),e.some(function(n){try{e=n.__h,n.__h=[],e.some(function(r){r.call(n)})}catch(r){D.__e(r,n.__v)}})}function Fh(e,t,n,r,i,o,a,s){var l,u,c,f=n.props,d=t.props,p=t.type,h=0;if(p==="svg"&&(i=!0),o!=null){for(;h<o.length;h++)if((l=o[h])&&"setAttribute"in l==!!p&&(p?l.localName===p:l.nodeType===3)){e=l,o[h]=null;break}}if(e==null){if(p===null)return document.createTextNode(d);e=i?document.createElementNS("http://www.w3.org/2000/svg",p):document.createElement(p,d.is&&d),o=null,s=!1}if(p===null)f===d||s&&e.data===d||(e.data=d);else{if(o=o&&Wn.call(e.childNodes),u=(f=n.props||Pr).dangerouslySetInnerHTML,c=d.dangerouslySetInnerHTML,!s){if(o!=null)for(f={},h=0;h<e.attributes.length;h++)f[e.attributes[h].name]=e.attributes[h].value;(c||u)&&(c&&(u&&c.__html==u.__html||c.__html===e.innerHTML)||(e.innerHTML=c&&c.__html||""))}if(jh(e,d,f,i,s),c)t.__k=[];else if(h=t.props.children,Hl(e,Array.isArray(h)?h:[h],t,n,r,i&&p!=="foreignObject",o,a,o?o[0]:n.__k&&Mn(n,0),s),o!=null)for(h=o.length;h--;)o[h]!=null&&Vl(o[h]);s||("value"in d&&(h=d.value)!==void 0&&(h!==e.value||p==="progress"&&!h||p==="option"&&h!==f.value)&&Nr(e,"value",h,f.value,!1),"checked"in d&&(h=d.checked)!==void 0&&h!==e.checked&&Nr(e,"checked",h,f.checked,!1))}return e}function zl(e,t,n){try{typeof e=="function"?e(t):e.current=t}catch(r){D.__e(r,n)}}function Wl(e,t,n){var r,i;if(D.unmount&&D.unmount(e),(r=e.ref)&&(r.current&&r.current!==e.__e||zl(r,null,t)),(r=e.__c)!=null){if(r.componentWillUnmount)try{r.componentWillUnmount()}catch(o){D.__e(o,t)}r.base=r.__P=null,e.__c=void 0}if(r=e.__k)for(i=0;i<r.length;i++)r[i]&&Wl(r[i],t,n||typeof e.type!="function");n||e.__e==null||Vl(e.__e),e.__=e.__e=e.__d=void 0}function Bh(e,t,n){return this.constructor(e,n)}function nn(e,t,n){var r,i,o;D.__&&D.__(e,t),i=(r=typeof n=="function")?null:n&&n.__k||t.__k,o=[],qo(t,e=(!r&&n||t).__k=ee(De,null,[e]),i||Pr,Pr,t.ownerSVGElement!==void 0,!r&&n?[n]:i?null:t.firstChild?Wn.call(t.childNodes):null,o,!r&&n?n:i?i.__e:t.firstChild,r),ql(o,e)}function Yl(e,t){nn(e,t,Yl)}function Hh(e,t,n){var r,i,o,a=et({},e.props);for(o in t)o=="key"?r=t[o]:o=="ref"?i=t[o]:a[o]=t[o];return arguments.length>2&&(a.children=arguments.length>3?Wn.call(arguments,2):n),In(e.type,a,r||e.key,i||e.ref,null)}function Ql(e,t){var n={__c:t="__cC"+Ml++,__:e,Consumer:function(r,i){return r.children(i)},Provider:function(r){var i,o;return this.getChildContext||(i=[],(o={})[t]=this,this.getChildContext=function(){return o},this.shouldComponentUpdate=function(a){this.props.value!==a.value&&i.some(function(s){s.__e=!0,io(s)})},this.sub=function(a){i.push(a);var s=a.componentWillUnmount;a.componentWillUnmount=function(){i.splice(i.indexOf(a),1),s&&s.call(a)}}),r.children}};return n.Provider.__=n.Consumer.contextType=n}Wn=jl.slice,D={__e:function(e,t,n,r){for(var i,o,a;t=t.__;)if((i=t.__c)&&!i.__)try{if((o=i.constructor)&&o.getDerivedStateFromError!=null&&(i.setState(o.getDerivedStateFromError(e)),a=i.__d),i.componentDidCatch!=null&&(i.componentDidCatch(e,r||{}),a=i.__d),a)return i.__E=i}catch(s){e=s}throw e}},Pl=0,tn=!1,Oe.prototype.setState=function(e,t){var n;n=this.__s!=null&&this.__s!==this.state?this.__s:this.__s=et({},this.state),typeof e=="function"&&(e=e(et({},n),this.props)),e&&et(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),io(this))},Oe.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),io(this))},Oe.prototype.render=De,kt=[],Nl=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,Mr.__r=0,Ml=0;var N=(e=>(e.ConsentLegal="consentlegal",e.Likert="likert",e.MultipleChoice="multiplechoice",e.MultipleSelect="multipleselect",e.NPS="nps",e.Open="open",e.RecordedTask="recordedtask",e.TextUrlPrompt="texturlprompt",e.Thanks="thanks",e.Uploading="uploading",e.VideoVoice="videovoice",e))(N||{}),Dt=(e=>(e.Answered="answered",e.Equal="eq",e.NotEqual="neq",e.Skipped="skipped",e.LessThan="lt",e.LessThanOrEqual="lte",e.GivenUp="given_up",e.GreaterThan="gt",e.GreaterThanOrEqual="gte",e.ListAll="list_all",e.ListAtLeastOne="list_alo",e.ListExact="list_exact",e))(Dt||{}),rn=(e=>(e.Camera="camera",e.Microphone="microphone",e.Screen="screen",e))(rn||{}),Se=(e=>(e.AvPermission="av_permission",e.ScreenPermission="screen_permission",e.StartTask="start_task",e.CompleteTask="complete_task",e))(Se||{}),At=(e=>(e.Number="number",e.Smiley="smiley",e.Star="star",e))(At||{}),Le=(e=>(e.Video="video",e.Audio="audio",e.Screen="screen",e))(Le||{}),de=(e=>(e.PermissionStatus="permission.status",e.AvPermission="av.permission",e.ScreenPermission="screen.permission",e.BeginRecording="begin.recording",e.StartTask="start.task",e.FinishTask="finish.task",e))(de||{}),Ue=(e=>(e.Abandoned="abandoned",e.GivenUp="given.up",e.Completed="completed",e))(Ue||{}),$=(e=>(e.ScreenPermissionRequested="screen.permission.requested",e.PermissionDescriptors="permission.descriptors",e.PermissionStatusCallback="permission.status.callback",e.StreamReadyCallback="stream.ready.callback",e.StreamCanceledCallback="stream.canceled.callback",e.TaskCompleteCallback="task.complete.callback",e.TaskResponse="task.response",e.TaskStatus="task.status",e.RecordingMediaTypes="recording.media.types",e.StartRecordingCallback="start.recording.callback",e.PassthroughData="passthrough.data",e.CurrentIndex="current.index",e.UploadCallback="upload.callback",e.ProgressCallback="progress.callback",e.BeginCallback="begin.callback",e))($||{});const za=e=>{let t;const n=new Set,r=(l,u)=>{const c=typeof l=="function"?l(t):l;if(!Object.is(c,t)){const f=t;t=(u!=null?u:typeof c!="object")?c:Object.assign({},t,c),n.forEach(d=>d(t,f))}},i=()=>t,s={setState:r,getState:i,subscribe:l=>(n.add(l),()=>n.delete(l)),destroy:()=>n.clear()};return t=e(r,i,s),s},Kh=e=>e?za(e):za;var Et,Z,vi,Wa,on=0,Zl=[],vr=[],Ya=D.__b,Qa=D.__r,Za=D.diffed,Xa=D.__c,Ja=D.unmount;function Ft(e,t){D.__h&&D.__h(Z,e,on||t),on=0;var n=Z.__H||(Z.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({__V:vr}),n.__[e]}function ue(e){return on=1,zo(nu,e)}function zo(e,t,n){var r=Ft(Et++,2);if(r.t=e,!r.__c&&(r.__=[n?n(t):nu(void 0,t),function(o){var a=r.__N?r.__N[0]:r.__[0],s=r.t(a,o);a!==s&&(r.__N=[s,r.__[1]],r.__c.setState({}))}],r.__c=Z,!Z.u)){Z.u=!0;var i=Z.shouldComponentUpdate;Z.shouldComponentUpdate=function(o,a,s){if(!r.__c.__H)return!0;var l=r.__c.__H.__.filter(function(c){return c.__c});if(l.every(function(c){return!c.__N}))return!i||i.call(this,o,a,s);var u=!1;return l.forEach(function(c){if(c.__N){var f=c.__[0];c.__=c.__N,c.__N=void 0,f!==c.__[0]&&(u=!0)}}),!(!u&&r.__c.props===o)&&(!i||i.call(this,o,a,s))}}return r.__N||r.__}function Ce(e,t){var n=Ft(Et++,3);!D.__s&&Yo(n.__H,t)&&(n.__=e,n.i=t,Z.__H.__h.push(n))}function Yn(e,t){var n=Ft(Et++,4);!D.__s&&Yo(n.__H,t)&&(n.__=e,n.i=t,Z.__h.push(n))}function _t(e){return on=5,Yr(function(){return{current:e}},[])}function Xl(e,t,n){on=6,Yn(function(){return typeof e=="function"?(e(t()),function(){return e(null)}):e?(e.current=t(),function(){return e.current=null}):void 0},n==null?n:n.concat(e))}function Yr(e,t){var n=Ft(Et++,7);return Yo(n.__H,t)?(n.__V=e(),n.i=t,n.__h=e,n.__V):n.__}function Jl(e,t){return on=8,Yr(function(){return e},t)}function eu(e){var t=Z.context[e.__c],n=Ft(Et++,9);return n.c=e,t?(n.__==null&&(n.__=!0,t.sub(Z)),t.props.value):e.__}function Wo(e,t){D.useDebugValue&&D.useDebugValue(t?t(e):e)}function $h(e){var t=Ft(Et++,10),n=ue();return t.__=e,Z.componentDidCatch||(Z.componentDidCatch=function(r,i){t.__&&t.__(r,i),n[1](r)}),[n[0],function(){n[1](void 0)}]}function tu(){var e=Ft(Et++,11);if(!e.__){for(var t=Z.__v;t!==null&&!t.__m&&t.__!==null;)t=t.__;var n=t.__m||(t.__m=[0,0]);e.__="P"+n[0]+"-"+n[1]++}return e.__}function Gh(){for(var e;e=Zl.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach(mr),e.__H.__h.forEach(oo),e.__H.__h=[]}catch(t){e.__H.__h=[],D.__e(t,e.__v)}}D.__b=function(e){Z=null,Ya&&Ya(e)},D.__r=function(e){Qa&&Qa(e),Et=0;var t=(Z=e.__c).__H;t&&(vi===Z?(t.__h=[],Z.__h=[],t.__.forEach(function(n){n.__N&&(n.__=n.__N),n.__V=vr,n.__N=n.i=void 0})):(t.__h.forEach(mr),t.__h.forEach(oo),t.__h=[])),vi=Z},D.diffed=function(e){Za&&Za(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(Zl.push(t)!==1&&Wa===D.requestAnimationFrame||((Wa=D.requestAnimationFrame)||qh)(Gh)),t.__H.__.forEach(function(n){n.i&&(n.__H=n.i),n.__V!==vr&&(n.__=n.__V),n.i=void 0,n.__V=vr})),vi=Z=null},D.__c=function(e,t){t.some(function(n){try{n.__h.forEach(mr),n.__h=n.__h.filter(function(r){return!r.__||oo(r)})}catch(r){t.some(function(i){i.__h&&(i.__h=[])}),t=[],D.__e(r,n.__v)}}),Xa&&Xa(e,t)},D.unmount=function(e){Ja&&Ja(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.forEach(function(r){try{mr(r)}catch(i){t=i}}),n.__H=void 0,t&&D.__e(t,n.__v))};var es=typeof requestAnimationFrame=="function";function qh(e){var t,n=function(){clearTimeout(r),es&&cancelAnimationFrame(t),setTimeout(e)},r=setTimeout(n,100);es&&(t=requestAnimationFrame(n))}function mr(e){var t=Z,n=e.__c;typeof n=="function"&&(e.__c=void 0,n()),Z=t}function oo(e){var t=Z;e.__c=e.__(),Z=t}function Yo(e,t){return!e||e.length!==t.length||t.some(function(n,r){return n!==e[r]})}function nu(e,t){return typeof t=="function"?t(e):t}function ru(e,t){for(var n in t)e[n]=t[n];return e}function ao(e,t){for(var n in e)if(n!=="__source"&&!(n in t))return!0;for(var r in t)if(r!=="__source"&&e[r]!==t[r])return!0;return!1}function mi(e,t){return e===t&&(e!==0||1/e==1/t)||e!=e&&t!=t}function jr(e){this.props=e}function iu(e,t){function n(i){var o=this.props.ref,a=o==i.ref;return!a&&o&&(o.call?o(null):o.current=null),t?!t(this.props,i)||!a:ao(this.props,i)}function r(i){return this.shouldComponentUpdate=n,ee(e,i)}return r.displayName="Memo("+(e.displayName||e.name)+")",r.prototype.isReactComponent=!0,r.__f=!0,r}(jr.prototype=new Oe).isPureReactComponent=!0,jr.prototype.shouldComponentUpdate=function(e,t){return ao(this.props,e)||ao(this.state,t)};var ts=D.__b;D.__b=function(e){e.type&&e.type.__f&&e.ref&&(e.props.ref=e.ref,e.ref=null),ts&&ts(e)};var zh=typeof Symbol<"u"&&Symbol.for&&Symbol.for("react.forward_ref")||3911;function ou(e){function t(n){var r=ru({},n);return delete r.ref,e(r,n.ref||null)}return t.$$typeof=zh,t.render=t,t.prototype.isReactComponent=t.__f=!0,t.displayName="ForwardRef("+(e.displayName||e.name)+")",t}var ns=function(e,t){return e==null?null:nt(nt(e).map(t))},au={map:ns,forEach:ns,count:function(e){return e?nt(e).length:0},only:function(e){var t=nt(e);if(t.length!==1)throw"Children.only";return t[0]},toArray:nt},Wh=D.__e;D.__e=function(e,t,n,r){if(e.then){for(var i,o=t;o=o.__;)if((i=o.__c)&&i.__c)return t.__e==null&&(t.__e=n.__e,t.__k=n.__k),i.__c(e,t)}Wh(e,t,n,r)};var rs=D.unmount;function su(e,t,n){return e&&(e.__c&&e.__c.__H&&(e.__c.__H.__.forEach(function(r){typeof r.__c=="function"&&r.__c()}),e.__c.__H=null),(e=ru({},e)).__c!=null&&(e.__c.__P===n&&(e.__c.__P=t),e.__c=null),e.__k=e.__k&&e.__k.map(function(r){return su(r,t,n)})),e}function lu(e,t,n){return e&&(e.__v=null,e.__k=e.__k&&e.__k.map(function(r){return lu(r,t,n)}),e.__c&&e.__c.__P===t&&(e.__e&&n.insertBefore(e.__e,e.__d),e.__c.__e=!0,e.__c.__P=n)),e}function kn(){this.__u=0,this.t=null,this.__b=null}function uu(e){var t=e.__.__c;return t&&t.__a&&t.__a(e)}function cu(e){var t,n,r;function i(o){if(t||(t=e()).then(function(a){n=a.default||a},function(a){r=a}),r)throw r;if(!n)throw t;return ee(n,o)}return i.displayName="Lazy",i.__f=!0,i}function Gt(){this.u=null,this.o=null}D.unmount=function(e){var t=e.__c;t&&t.__R&&t.__R(),t&&e.__h===!0&&(e.type=null),rs&&rs(e)},(kn.prototype=new Oe).__c=function(e,t){var n=t.__c,r=this;r.t==null&&(r.t=[]),r.t.push(n);var i=uu(r.__v),o=!1,a=function(){o||(o=!0,n.__R=null,i?i(s):s())};n.__R=a;var s=function(){if(!--r.__u){if(r.state.__a){var u=r.state.__a;r.__v.__k[0]=lu(u,u.__c.__P,u.__c.__O)}var c;for(r.setState({__a:r.__b=null});c=r.t.pop();)c.forceUpdate()}},l=t.__h===!0;r.__u++||l||r.setState({__a:r.__b=r.__v.__k[0]}),e.then(a,a)},kn.prototype.componentWillUnmount=function(){this.t=[]},kn.prototype.render=function(e,t){if(this.__b){if(this.__v.__k){var n=document.createElement("div"),r=this.__v.__k[0].__c;this.__v.__k[0]=su(this.__b,n,r.__O=r.__P)}this.__b=null}var i=t.__a&&ee(De,null,e.fallback);return i&&(i.__h=null),[ee(De,null,t.__a?null:e.children),i]};var is=function(e,t,n){if(++n[1]===n[0]&&e.o.delete(t),e.props.revealOrder&&(e.props.revealOrder[0]!=="t"||!e.o.size))for(n=e.u;n;){for(;n.length>3;)n.pop()();if(n[1]<n[0])break;e.u=n=n[2]}};function Yh(e){return this.getChildContext=function(){return e.context},e.children}function Qh(e){var t=this,n=e.i;t.componentWillUnmount=function(){nn(null,t.l),t.l=null,t.i=null},t.i&&t.i!==n&&t.componentWillUnmount(),e.__v?(t.l||(t.i=n,t.l={nodeType:1,parentNode:n,childNodes:[],appendChild:function(r){this.childNodes.push(r),t.i.appendChild(r)},insertBefore:function(r,i){this.childNodes.push(r),t.i.appendChild(r)},removeChild:function(r){this.childNodes.splice(this.childNodes.indexOf(r)>>>1,1),t.i.removeChild(r)}}),nn(ee(Yh,{context:t.context},e.__v),t.l)):t.l&&t.componentWillUnmount()}function du(e,t){var n=ee(Qh,{__v:e,i:t});return n.containerInfo=t,n}(Gt.prototype=new Oe).__a=function(e){var t=this,n=uu(t.__v),r=t.o.get(e);return r[0]++,function(i){var o=function(){t.props.revealOrder?(r.push(i),is(t,e,r)):i()};n?n(o):o()}},Gt.prototype.render=function(e){this.u=null,this.o=new Map;var t=nt(e.children);e.revealOrder&&e.revealOrder[0]==="b"&&t.reverse();for(var n=t.length;n--;)this.o.set(t[n],this.u=[1,0,this.u]);return e.children},Gt.prototype.componentDidUpdate=Gt.prototype.componentDidMount=function(){var e=this;this.o.forEach(function(t,n){is(e,n,t)})};var fu=typeof Symbol<"u"&&Symbol.for&&Symbol.for("react.element")||60103,Zh=/^(?:accent|alignment|arabic|baseline|cap|clip(?!PathU)|color|dominant|fill|flood|font|glyph(?!R)|horiz|image|letter|lighting|marker(?!H|W|U)|overline|paint|pointer|shape|stop|strikethrough|stroke|text(?!L)|transform|underline|unicode|units|v|vector|vert|word|writing|x(?!C))[A-Z]/,Xh=typeof document<"u",Jh=function(e){return(typeof Symbol<"u"&&typeof Symbol()=="symbol"?/fil|che|rad/i:/fil|che|ra/i).test(e)};function pu(e,t,n){return t.__k==null&&(t.textContent=""),nn(e,t),typeof n=="function"&&n(),e?e.__c:null}function hu(e,t,n){return Yl(e,t),typeof n=="function"&&n(),e?e.__c:null}Oe.prototype.isReactComponent={},["componentWillMount","componentWillReceiveProps","componentWillUpdate"].forEach(function(e){Object.defineProperty(Oe.prototype,e,{configurable:!0,get:function(){return this["UNSAFE_"+e]},set:function(t){Object.defineProperty(this,e,{configurable:!0,writable:!0,value:t})}})});var os=D.event;function ev(){}function tv(){return this.cancelBubble}function nv(){return this.defaultPrevented}D.event=function(e){return os&&(e=os(e)),e.persist=ev,e.isPropagationStopped=tv,e.isDefaultPrevented=nv,e.nativeEvent=e};var vu,as={configurable:!0,get:function(){return this.class}},ss=D.vnode;D.vnode=function(e){var t=e.type,n=e.props,r=n;if(typeof t=="string"){var i=t.indexOf("-")===-1;for(var o in r={},n){var a=n[o];Xh&&o==="children"&&t==="noscript"||o==="value"&&"defaultValue"in n&&a==null||(o==="defaultValue"&&"value"in n&&n.value==null?o="value":o==="download"&&a===!0?a="":/ondoubleclick/i.test(o)?o="ondblclick":/^onchange(textarea|input)/i.test(o+t)&&!Jh(n.type)?o="oninput":/^onfocus$/i.test(o)?o="onfocusin":/^onblur$/i.test(o)?o="onfocusout":/^on(Ani|Tra|Tou|BeforeInp|Compo)/.test(o)?o=o.toLowerCase():i&&Zh.test(o)?o=o.replace(/[A-Z0-9]/g,"-$&").toLowerCase():a===null&&(a=void 0),/^oninput$/i.test(o)&&(o=o.toLowerCase(),r[o]&&(o="oninputCapture")),r[o]=a)}t=="select"&&r.multiple&&Array.isArray(r.value)&&(r.value=nt(n.children).forEach(function(s){s.props.selected=r.value.indexOf(s.props.value)!=-1})),t=="select"&&r.defaultValue!=null&&(r.value=nt(n.children).forEach(function(s){s.props.selected=r.multiple?r.defaultValue.indexOf(s.props.value)!=-1:r.defaultValue==s.props.value})),e.props=r,n.class!=n.className&&(as.enumerable="className"in n,n.className!=null&&(r.class=n.className),Object.defineProperty(r,"className",as))}e.$$typeof=fu,ss&&ss(e)};var ls=D.__r;D.__r=function(e){ls&&ls(e),vu=e.__c};var mu={ReactCurrentDispatcher:{current:{readContext:function(e){return vu.__n[e.__c].props.value}}}},rv="17.0.2";function gu(e){return ee.bind(null,e)}function Qo(e){return!!e&&e.$$typeof===fu}function yu(e){return Qo(e)?Hh.apply(null,arguments):e}function _u(e){return!!e.__k&&(nn(null,e),!0)}function wu(e){return e&&(e.base||e.nodeType===1&&e)||null}var bu=function(e,t){return e(t)},Eu=function(e,t){return e(t)},xu=De;function Zo(e){e()}function Su(e){return e}function Cu(){return[!1,Zo]}var Iu=Yn;function ku(e,t){var n=t(),r=ue({h:{__:n,v:t}}),i=r[0].h,o=r[1];return Yn(function(){i.__=n,i.v=t,mi(i.__,t())||o({h:i})},[e,n,t]),Ce(function(){return mi(i.__,i.v())||o({h:i}),e(function(){mi(i.__,i.v())||o({h:i})})},[e]),n}var iv={useState:ue,useId:tu,useReducer:zo,useEffect:Ce,useLayoutEffect:Yn,useInsertionEffect:Iu,useTransition:Cu,useDeferredValue:Su,useSyncExternalStore:ku,startTransition:Zo,useRef:_t,useImperativeHandle:Xl,useMemo:Yr,useCallback:Jl,useContext:eu,useDebugValue:Wo,version:"17.0.2",Children:au,render:pu,hydrate:hu,unmountComponentAtNode:_u,createPortal:du,createElement:ee,createContext:Ql,createFactory:gu,cloneElement:yu,createRef:Fl,Fragment:De,isValidElement:Qo,findDOMNode:wu,Component:Oe,PureComponent:jr,memo:iu,forwardRef:ou,flushSync:Eu,unstable_batchedUpdates:bu,StrictMode:xu,Suspense:kn,SuspenseList:Gt,lazy:cu,__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED:mu};const ov=Object.freeze(Object.defineProperty({__proto__:null,Children:au,PureComponent:jr,StrictMode:xu,Suspense:kn,SuspenseList:Gt,__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED:mu,cloneElement:yu,createFactory:gu,createPortal:du,default:iv,findDOMNode:wu,flushSync:Eu,forwardRef:ou,hydrate:hu,isValidElement:Qo,lazy:cu,memo:iu,render:pu,startTransition:Zo,unmountComponentAtNode:_u,unstable_batchedUpdates:bu,useDeferredValue:Su,useInsertionEffect:Iu,useSyncExternalStore:ku,useTransition:Cu,version:rv,Component:Oe,Fragment:De,createContext:Ql,createElement:ee,createRef:Fl,useCallback:Jl,useContext:eu,useDebugValue:Wo,useEffect:Ce,useErrorBoundary:$h,useId:tu,useImperativeHandle:Xl,useLayoutEffect:Yn,useMemo:Yr,useReducer:zo,useRef:_t,useState:ue},Symbol.toStringTag,{value:"Module"}));var Tu={exports:{}},Lu={};const Ru=hc(ov);var Au={exports:{}},Ou={};/**
20
20
  * @license React
21
21
  * use-sync-external-store-shim.production.min.js
22
22
  *
@@ -701,4 +701,4 @@ span.ul-button-text {
701
701
  background-size: cover;
702
702
  }
703
703
  `,cm=e=>{const t=M.document.createElement("div");return t.className="ul-video-player-loading",t.id=ra(e),["first","second","third","fourth"].map(n=>{const r=M.document.createElement("div");r.className=n,t.appendChild(r)}),t},ra=e=>e+"-loading-spiner",ae="hidden",gs=".m3u8",wi="questionId",bi="ul-video-recorder-camera-off-button",Ei="ul-recording-in-session",dm=[{type:"link",content:`${Tt}/dependencies/videojs-record-4.5.0.min.css`},{type:"script",content:`${Tt}/dependencies/RecordRTC-5.6.2.js`},{type:"script",content:`${Tt}/dependencies/adapter.8.0.0.min.js`},{type:"script",content:`${Tt}/dependencies/videojs-record-4.5.0.min.js`},{type:"script",content:`${Tt}/userleap-web-upchunk-v2.2.2.js`}],Wu=[{type:"link",content:`${Tt}/dependencies/video-js-7.18.0.min.css`},{type:"script",content:`${Tt}/dependencies/video-js-7.18.0.min.js`},{type:"style",content:um}],Yu="-video-player",Qu="-secondary-video-player",Zu="-video-recorder";let je,ys;const ct=async({event:e,apiBase:t,headers:n,visitorId:r,envId:i,metadata:o})=>{const a=M.document.documentElement;if(!r||!i)return;const s={event:`SDK - ${e}`,visitorId:r,environmentId:i,metadata:{...o||{},screenWidth:window.screen.width,screenHeight:window.screen.height,clientWidth:a.clientWidth,clientHeight:a.clientHeight,location:window.location.href,language:navigator.language}};(await fetch(`${t}/sdk/1/visitors/${r}/analytics`,{method:"POST",cache:"no-cache",headers:n,body:JSON.stringify(s)})).ok||console.warn("[Sprig] (ERR-444) Failed to track analytics",e)},Xe=async(e,t,n,r,i,o)=>{ct({event:`Video Error ${t}`,apiBase:n,headers:r,visitorId:i,envId:o,metadata:{errorMessage:e.message}});const a=M.document.documentElement,s={screenWidth:window.screen.width,screenHeight:window.screen.height,clientWidth:a.clientWidth,clientHeight:a.clientHeight,location:window.location.href,language:navigator.language},l={action:t,err:{message:e.message,stack:e.stack},meta:s,vid:i,envId:o};(await fetch(`${n}/sdk/1/errors`,{method:"POST",cache:"no-cache",headers:{...r,"userleap-platform":"video_recorder","x-ul-error":window.btoa(`userleap-${Date.now()}-error`)},body:JSON.stringify(l)})).ok||console.warn("[Sprig] (ERR-444) Failed to report error to API",e)},fm=(e,{type:t,content:n})=>new Promise(function(r,i){let o;t==="script"?(o=M.document.createElement("script"),o.src=n):t==="link"?(o=M.document.createElement("link"),o.rel="stylesheet",o.href=n,o.type="text/css"):(o=M.document.createElement("style"),o.innerHTML=n),o.onload=function(){r(n)},o.onerror=function(){i(n)},o.async=!1,o.id=btoa(n),e.appendChild(o)}),Xu=(e,t)=>{if(e.length===0)return t&&t();Promise.all(e.reduce((n,r)=>(n.push(fm(M.document.head,r)),n),[])).then(()=>{M.videojs=M.document.defaultView.videojs,t&&t()}).catch(function(n){console.log(n+" failed to load")})},_s=(e,t,n)=>{if(t==="start"&&(e.style.visibility="visible"),t==="none")e.style.visibility=ae;else if(t==="success")e.style.visibility=ae,e.innerHTML="Upload succeeded!";else{const r=Math.round(parseFloat(n));e.innerHTML=`Uploading <span class="ul-upload-progress-label__time">${r}%</span>`,e.style.background=`linear-gradient(to right, #E0E0EB 0%, #E0E0EB ${r}%, #FCFCFD ${r}%, #FCFCFD 100%)`}},xi=(e,t)=>{const n=M.videojs(e.id());return n==null?void 0:n.payload[t]},pm=(e,t,n,r,i)=>{const{surveyId:o,responseGroupUid:a,visitorId:s,envId:l}=e.payload;e.on("deviceError",function(){console.warn("device error: ",e.deviceErrorCode),e.deviceErrorCode.message==="Permission denied"?(e.deviceButton.addClass("permission-denied"),n&&n(B.ERROR,{type:B.PERMISSION_DENIED}),ct({event:"Video Permission Denied",apiBase:t,headers:i,visitorId:s,envId:l,metadata:{questionId:xi(e,wi),responseGroupUid:a,surveyId:o}})):(n&&n(B.ERROR,{type:B.OTHER}),Xe(new Error(e.deviceErrorCode.message),"recorderDeviceError",t,i,s,l))}),e.on("error",function(u,c){Xe(c||e.error(),"recorderError",t,i,s,l)}),e.on("startRecord",function(u,c){r(e.uploadProgressLabel,"none"),ct({event:"Video Record Start",apiBase:t,headers:i,visitorId:s,envId:l,metadata:{questionId:xi(e,wi),responseGroupUid:a,surveyId:o}})}),e.on("finishRecord",async function(){r(e.uploadProgressLabel,"start",0);const u=xi(e,wi);if(!o){const v="internal error: missing fields in payload";return n&&n(B.ERROR,{type:B.OTHER}),Xe(new Error(v),"finishRecord",t,i,s,l),null}e.record().stopDevice();const c=e.cameraOff?B.MEDIA_TYPE_AUDIO:B.MEDIA_TYPE_VIDEO,f=vt();ct({event:"Video Record Finish",apiBase:t,headers:i,visitorId:s,envId:l,metadata:{mediaRecordingUid:f,questionId:u,responseGroupUid:a,surveyId:o,mediaType:c}});const d={surveyId:o,updatedAt:new Date().toISOString(),mediaType:c,mediaRecordingUid:f};u&&(d.questionId=u),a&&(d.responseGroupUid=a),s&&(d.visitorId=s);const h=await(async()=>{const v=await fetch(`${t}/2/environments/integrations/upload`,{method:"POST",cache:"no-cache",headers:{"Content-Type":"application/json"},body:JSON.stringify(d)});if(v.ok){const m=await v.json();return n&&n(B.UPLOAD_STARTED,{[B.UPLOAD_ID]:m.upload.id,[B.MEDIA_TYPE]:c,[B.MEDIA_RECORDING_UID]:f}),m.upload.url}else return n&&n(B.ERROR,{type:B.OTHER,response:v}),Xe(new Error("failed to get upload response with url"),"finishRecord",t,i,s,l),null})();!h||(je=M.document.defaultView.UpChunk.createUpload({endpoint:h,file:new M.document.defaultView.File([e.recordedData],`recording ${c} ${Date.now()}`),chunkSize:5120}),je.startTime=Date.now(),ct({event:"Video Upload Start",apiBase:t,headers:i,visitorId:s,envId:l,metadata:{mediaRecordingUid:f,questionId:u,responseGroupUid:a,surveyId:o,mediaType:c,url:h}}),je.on("error",v=>{r(e.uploadProgressLabel,"none"),n&&n(B.UPLOAD_FINISHED,{[B.MEDIA_RECORDING_UID]:f}),Xe(v,"finishRecord",t,i,s,l)}),je.on("progress",v=>{n&&n(B.UPLOAD_PROGRESS,{[B.MEDIA_RECORDING_UID]:f,[B.UPLOAD_PROGRESS_PCT]:v.detail}),r(e.uploadProgressLabel,"progress",v.detail)}),je.on("success",()=>{r(e.uploadProgressLabel,"success"),n&&n(B.UPLOAD_FINISHED,{[B.MEDIA_RECORDING_UID]:f}),ct({event:"Video Upload Success",apiBase:t,headers:i,visitorId:s,envId:l,metadata:{mediaRecordingUid:f,questionId:u,responseGroupUid:a,surveyId:o,mediaType:c,url:h,elapsedMs:je.startTime&&Date.now()-je.startTime}})}))})},Ju=(e,t)=>{const n=new(M.videojs.getComponent("Component"))(e);return n.addClass("ul-buttons-panel"),t.map(r=>{n.addChild(r)}),hm(n),n},hm=e=>{e.children().forEach(t=>{if(Te[t.name_]){const n=_r(Te[t.name_],`ul-${Te[t.name_]}`);t.el_.appendChild(n)}})},_r=(e,t="")=>{const n=M.document.createElement("span");return n.className="ul-button-text",n.innerHTML=e,n.id=t,n},ec=(e,t,n,r,i=!1,o)=>{e.addClass("ul-video-player");const a=new(M.videojs.getComponent("Component"))(e);a.addClass("ul-control-panel"),e.progressBar=a.addChild("ProgressControl"),n&&e.src(n),e.audioPlayerPlaceholder=new(M.videojs.getComponent("Component"))(e),e.audioPlayerPlaceholder.addClass("ul-audio-recorder-placeholder");const s=n&&n.src?Em(n.src):null;n&&(i||!s)?(e.children()[0].classList.add("vjs-hidden"),M.document.getElementById(`${e.id()}_html5_api`).style.height="0px"):(e.audioPlayerPlaceholder.hide(),M.document.getElementById(`${e.id()}_html5_api`).style.height="100%",s&&e.poster(s)),e.on("play",()=>{!i&&n&&!s&&gm(e,!1),o==null||o.play()}),e.on("pause",()=>{o==null||o.pause()}),e.on("seeked",()=>{o==null||o.currentTime(e.currentTime())}),e.on("ratechange",()=>{o==null||o.playbackRate(e.playbackRate())}),e.addChild(e.audioPlayerPlaceholder,{},1),a.addChild(t),e.addChild(a),r&&r(e)},vm=(e,t,n)=>{e.addClass(`ul${Qu}`);const r=new(M.videojs.getComponent("Component"))(e);t&&e.src(t),e.addChild(r),n&&n(e)},mm=(e,t,n,r,i,o,a,s=!1)=>{ys=Date.now();const u=Vr(t,{controls:!1,bigPlayButton:!1,fluid:!1,width:1280,height:720,playsinline:!0,plugins:{record:{audio:!0,video:{mandatory:{minWidth:1280,minHeight:720}},frameWidth:1280,frameHeight:720,maxLength:600,autoMuteDevice:!0}}});if(!u)return;u.payload=n;const{surveyId:c,questionId:f,responseGroupUid:d,visitorId:p,envId:h}=n;let v;const m=T=>{const U=bi,C=bi+"-audio-only";_s(u.uploadProgressLabel,"none"),je&&je.startTime>=ys&&je.abort();const j=M.document.getElementById("ul-camera-button");T?(u.children()[0].classList.add("vjs-hidden"),_.removeClass(U),_.addClass(C),j.innerHTML=Te.TurnOnCamera,u.audioPlayerPlaceholder.removeClass("vjs-hidden"),v==null||v.getTracks().forEach(O=>{O.stop()}),window.navigator.mediaDevices.getUserMedia({video:!0,audio:!0}).then(O=>{v=O,O.getVideoTracks().forEach(Y=>{Y.enabled=!1}),u.record().onDeviceReady(O)}).catch(u.record().onDeviceError.bind(u.record()))):(v==null||v.getVideoTracks().forEach(O=>{O.enabled=!0}),u.children()[0].classList.remove("vjs-hidden"),u.record().getDevice(),_.removeClass(C),_.addClass(U),j.innerHTML=Te.TurnOffCamera,u.audioPlayerPlaceholder.addClass("vjs-hidden"))},w=new(M.videojs.getComponent("Button"))(u,{clickHandler:()=>{w.hasClass(ae)||(ct({event:"Video Delete Button Clicked",apiBase:r,headers:a,visitorId:p,envId:h,metadata:{questionId:f,responseGroupUid:d,surveyId:c}}),m(u.cameraOff),i(B.DELETE,{}),_.removeClass(ae),w.addClass(ae))}});w.addClass("ul-video-recorder-delete-button"),w.el_.appendChild(_r(Te.DeleteButton,"ul-delete-button"));const y=M.document.getElementById(t),E=()=>{y.classList.contains("vjs-fullscreen")&&u.cameraOff?y.style.display="table":y.style.display="flex"};E();const _=new(M.videojs.getComponent("Button"))(u,{clickHandler:()=>{u.record().isRecording()||(u.cameraOff=!u.cameraOff,ct({event:"Video Camera Button Clicked",apiBase:r,headers:a,visitorId:n.visitorId,envId:n.envId,metadata:{questionId:f,responseGroupUid:d,surveyId:c,cameraOff:u.cameraOff}}),m(u.cameraOff),!w.hasClass(ae)&&w.addClass(ae),i(B.DELETE,{}),E())}});_.addClass(bi),_.el_.appendChild(_r(Te.TurnOffCamera,"ul-camera-button"));const b=new(M.videojs.getComponent("Button"))(u,{clickHandler:()=>{const T=M.document.getElementById("ul-recorder-toggle");if(u.record().isRecording())u.record().stop(),T&&(T.innerHTML=Te.RecordButton),b.removeClass(Ei),w.removeClass(ae);else{const U=M.document.getElementById("ul-recording-countdown-screen");if(U)U.remove(),T&&(T.innerHTML=Te.RecordButton),m(u.cameraOff),i(B.DELETE,{}),_.removeClass(ae),w.addClass(ae),b.removeClass(Ei),I.show();else{b.addClass(Ei),I.hide(),_.addClass(ae),w.addClass(ae),T&&(T.innerHTML=Te.StopButton);const C=M.document.createElement("div");C.id="ul-recording-countdown-screen",y.insertBefore(C,y.children[1]),C.style.height=`${y.offsetHeight}px`,tc(u,3)}}}});b.addClass("ul-video-recorder-toggle-button"),b.el_.appendChild(_r(Te.RecordButton,"ul-recorder-toggle"));const S=M.document.createElement("p");S.style.visibility="hidden",S.className="ul-upload-progress-label",e.appendChild(S),u.uploadProgressLabel=S;const x=Ju(u,[w,_,"PlayToggle",b,"FullscreenToggle"]),I=x.children().find(T=>T.name_==="FullscreenToggle");I.hasClass("vjs-disabled")&&I.hide();const k=x.children().find(T=>T.name_==="PlayToggle");k.hide(),o&&_.addClass(ae),!o&&w.addClass(ae),ec(u,x,o,!1,s),u.on("stopRecord",()=>{b.hide(),k.show(),I.show(),w.removeClass(ae)}),u.on("deviceReady",()=>{b.show(),k.hide(),w.addClass(ae)}),pm(u,r,i,_s,a),o&&(u.deviceButton&&u.deviceButton.hide(),u.src(o),k.show(),b.hide(),w.removeClass(ae));const L=[{name:"microphone"}];!u.cameraOff&&L.push({name:"camera"}),Promise.all(L.map(T=>{var U;return(U=navigator==null?void 0:navigator.permissions)==null?void 0:U.query(T)})).then(T=>{T.reduce((C,j)=>C&j.state==="granted",!0)&&u&&(u.deviceButton&&u.deviceButton.hide(),!o&&u.record().getDevice())}).catch(T=>{})},tc=(e,t=3)=>{const n=M.document.getElementById("ul-recording-countdown-screen");n&&t===0?(n.remove(),e.record().start()):n&&(n.innerHTML=`<span class='ul-countdown-text'>Recording in... ${t}</span>`,setTimeout(()=>{tc(e,t-1)},1e3))},nc=e=>{const t=M.document.createElement("div");return t.className="ul-video-container",t.appendChild(cm(e)),t},uo=(e,t)=>{const n=M.document.createElement("video");n.id=e,n.className="video-js vjs-default-skin ul-video-player-video";const r=M.document.createElement("p");r.className="vjs-no-js",r.innerHTML="To view this video please enable JavaScript, and consider upgrading to a web browser that";const i=M.document.createElement("a");return i.href="https://videojs.com/html5-video-support/",i.target="_blank",i.innerHTML="supports HTML5 video",r.appendChild(i),n.appendChild(r),t.appendChild(n),t},gm=(e,t)=>{t?(e.children()[0].classList.add("vjs-hidden"),e.audioPlayerPlaceholder.show(),M.document.getElementById(`${e.id()}_html5_api`).style.height="0px"):(e.children()[0].classList.remove("vjs-hidden"),e.audioPlayerPlaceholder.hide(),M.document.getElementById(`${e.id()}_html5_api`).style.height="100%")},Vr=(e,t)=>M.document.getElementById(e)?t?M.videojs(e,t):M.videojs(e):(console.error(`Error in finding player element with ID, ${e}`),null),ym=(e,t,n,r=!1,i="https://api.sprig.com",o=document,a=null,s=null)=>{M.document=o;const l=e+Yu,u=nc(l);return M.document.addEventListener("securitypolicyviolation",c=>{Xe(new Error(`Voice & Video feature violates ${c.violatedDirective} web page CSP policies for the question player.`),"playerDeviceError",i,{})}),Xu(Wu,()=>{M.document.getElementById(ra(l)).remove(),uo(l,u);const c={playsinline:!0,playbackRates:[.5,1,1.5,2],fill:!0};try{const f=e+Qu;uo(f,u);const d=Vr(l,c),p=Vr(f,{muted:!0,...c});if(!d||!p)return;vm(p,a,s),a||p.addClass(ae);const h=Ju(d,["PlaybackRateMenuButton","PlayToggle","FullscreenToggle"]),v=h.children().find(m=>m.name_==="FullscreenToggle");v.hasClass("vjs-disabled")&&v.hide(),ec(d,h,t,n,r,p)}catch(f){Xe(new Error(`Error when creating video player object ${f}`),"playerDeviceError",i,{});return}}),u},_m=(e,t={},n="https://api.userleap.com",r,i,o,a=!1,s=document)=>{M.document=s;const l=e+Zu,u=nc(l);return M.document.addEventListener("securitypolicyviolation",c=>{Xe(new Error(`Voice & Video feature violates ${c.violatedDirective} web page CSP policies for the recorder player.`),"recorderDeviceError",n,o,t.visitorId,t.envId)}),Xu(Wu.concat(dm),()=>{uo(l,u),M.document.getElementById(ra(l)).remove();try{mm(u,l,t,n,r,i,o,a)}catch(c){Xe(new Error(`Error when creating video recorder player object ${c}`),"recorderDeviceError",n,o,t.visitorId,t.envId);return}}),u},wm=e=>{const t=e+Zu;if(!!M.document.getElementById(t)&&!!M.videojs){try{if(!M.videojs(t).record().stream)return}catch{return}M.videojs(t).record().stop(),M.videojs(t).record().stopDevice()}},bm=e=>{const t=Vr(e+Yu);t==null||t.pause()},Em=e=>{if(!e)return null;const t=e.match(/https:\/\/stream.mux.com\/(.*)/);let n=t?t[1]:null;return n.includes(gs)&&(n=n.replace(gs,"")),n?`https://image.mux.com/${n}/thumbnail.jpg?time=0`:null},B={UPLOAD_STARTED:"upload.started",UPLOAD_PROGRESS:"upload.progress",UPLOAD_FINISHED:"upload.finished",DELETE:"delete",ERROR:"error",MEDIA_TYPE:"media.type",PERMISSION_DENIED:"permission_denied",OTHER:"other",UPLOAD_ID:"upload.id",UPLOAD_PROGRESS_PCT:"upload.progress.pct",MEDIA_RECORDING_UID:"media.recording.uid",MEDIA_TYPE_VIDEO:"video",MEDIA_TYPE_AUDIO:"audio"},Te={PlaybackRateMenuButton:"Speed",PlayToggle:"Play",FullscreenToggle:"Expand",TurnOnCamera:"Turn on",TurnOffCamera:"Turn off",DeleteButton:"Delete",RecordButton:"Record",StopButton:"Stop",PauseButton:"Pause"},vn="ul-card-video__player_recorder",xm="ul-card-video__skip_button",Sm="ul-video-interview-form",ws="ul-video-btn",Cm=({className:e,message:t,next:n,properties:r,questionId:i,type:o})=>{const{apiURL:a,envId:s,handleUploadUpdate:l,headers:u,responseGroupUid:c,surveyId:f,viewDocument:d,visitorId:p}=J(C=>({apiURL:C.apiURL,envId:C.envId,handleUploadUpdate:C.handleUploadUpdate,headers:C.headers,responseGroupUid:C.responseGroupUid,surveyId:C.surveyId,viewDocument:C.viewDocument,visitorId:C.userId})),[h,v]=ue(!1),[m,w]=ue(null),[y,E]=ue(null),[_,b]=ue(0),S=u["userleap-platform"],x=r&&r.videoUrl,I=(C,j)=>{C===B.UPLOAD_STARTED?(w(j[B.UPLOAD_ID]),E(j[B.MEDIA_RECORDING_UID]),v(!0)):C===B.DELETE?(w(null),E(null),v(!1)):C===B.UPLOAD_PROGRESS?isNaN(j[B.UPLOAD_PROGRESS_PCT])?l({mediaRecordingUid:j[B.MEDIA_RECORDING_UID],isComplete:!0}):l({mediaRecordingUid:j[B.MEDIA_RECORDING_UID],progressPct:j[B.UPLOAD_PROGRESS_PCT]}):C===B.UPLOAD_FINISHED&&l({mediaRecordingUid:j[B.MEDIA_RECORDING_UID],isComplete:!0})},k=C=>{if(C&&C.children.length===0){const j=ym(vn,{src:x,type:"application/x-mpegURL"},void 0,r.mediaType===B.MEDIA_TYPE_AUDIO,a,d);C.appendChild(j)}},L=C=>{if(C&&C.children.length===0){const j=_m(vn,{surveyId:f,responseGroupUid:c,questionId:i,visitorId:p,envId:s},a,I,void 0,{...u,"x-ul-video-recorder-origin":"sdk"},r.mediaType===B.MEDIA_TYPE_AUDIO,d);C.appendChild(j)}},T=C=>{C.preventDefault(),C.stopPropagation(),wm(vn),m&&y?(l({mediaRecordingUid:y,isSubmitted:!0}),n({value:{mediaRecordingUid:y},questionId:i,type:o})):n({value:null,questionId:i,type:o})},U=()=>g(xt,{defaultBody:()=>g("button",{className:`${ws} ul-record-response-btn`,onClick:C=>{C.preventDefault(),C.stopPropagation(),bm(vn),b(1)}}),properties:r});return g("div",{className:F(Ge(R.CardMainContent,S)),style:{marginTop:"unset"},children:g("form",{className:F([e,R.VideoCard,R.FadeInTransition]),id:Sm,children:[g(ze,{message:t,properties:r}),g("div",{id:"ul-card-voice__video",children:[g("div",{children:[g("div",{id:"ul-question-player-container",style:{display:_===0?"":"none"},children:[g("div",{id:vn,ref:k}),U()]}),g("div",{style:{display:_===1?"block":"none"},children:[g("button",{className:`${ws} ul-back-question-btn`,onClick:C=>{C.preventDefault(),C.stopPropagation(),b(0)}}),g("div",{id:"ul-recorder-player-container",ref:L})]})]}),g(be,{disabled:!h,onClick:T,children:pn(r)}),g("button",{className:`ul-card-text__button ${R.InactiveButton}`,id:xm,onClick:T,style:{display:r.required?"none":"block",...h?{display:"none"}:{}},children:ea(r)})]})]})})},Im=({className:e})=>{const{headers:t,uploadProgress:n}=J(a=>({headers:a.headers,uploadProgress:a.uploadProgress}));let r,i;Object.values(n).filter(a=>a.isSubmitted).length>1?(r="Your responses are processing",i="Please keep this tab open until your responses are fully processed."):(r="Your response is processing",i="Please keep this tab open until your response is fully processed.");const o=Math.round(Math.min(99,...Object.values(n).filter(a=>a.isSubmitted).map(a=>a.progressPct)));return g("div",{className:F(Ge(R.CardMainContent,t["userleap-platform"])),children:g("div",{className:F([e,"ul-card--uploading",R.FadeInTransition]),children:[g("div",{"aria-busy":"true","aria-label":"Processing...","aria-live":"polite",className:R.LoadingSpinnerContainer,role:"progressbar",children:g("div",{className:R.LoadingSpinner,children:[g("div",{className:R.LoadingSpinnerFirst}),g("div",{className:R.LoadingSpinnerSecond}),g("div",{className:R.LoadingSpinnerThird}),g("div",{className:R.LoadingSpinnerFourth})]})}),g(ze,{message:`${r} (${o}% complete)`}),g("p",{className:R.Caption,children:i})]})})},bs=()=>g("svg",{alt:"Powered by Sprig",fill:"none",height:"13",viewBox:"0 0 100 13",width:"100",xmlns:"http://www.w3.org/2000/svg",children:[g("path",{d:"M3.0369 0.839981H0.0249023V8.99998H1.3209V6.53998H2.8569C4.8969 6.53998 6.2409 5.37598 6.2409 3.62398C6.2409 1.95598 4.9689 0.839981 3.0369 0.839981ZM3.0009 5.35198H1.3209V2.02798H3.0009C4.1769 2.02798 4.9689 2.67598 4.9689 3.62398C4.9689 4.65598 4.1769 5.35198 3.0009 5.35198Z",fill:"#5D696F"}),g("path",{d:"M9.90653 3.21598C8.15453 3.21598 6.90653 4.45198 6.90653 6.17998C6.90653 7.90798 8.15453 9.14398 9.90653 9.14398C11.6585 9.14398 12.9065 7.90798 12.9065 6.17998C12.9065 4.45198 11.6585 3.21598 9.90653 3.21598ZM9.90653 8.01598C8.88653 8.01598 8.15453 7.23598 8.15453 6.17998C8.15453 5.11198 8.88653 4.34398 9.90653 4.34398C10.9265 4.34398 11.6585 5.11198 11.6585 6.17998C11.6585 7.23598 10.9265 8.01598 9.90653 8.01598Z",fill:"#5D696F"}),g("path",{d:"M20.9631 3.35998L19.7391 7.11598L18.3951 3.35998H17.3271L15.9831 7.12798L14.7591 3.35998H13.4151L15.4431 8.99998H16.5351L17.8671 5.08798L19.1871 8.99998H20.2791L22.3071 3.35998H20.9631Z",fill:"#5D696F"}),g("path",{d:"M25.7246 3.21598C24.0086 3.21598 22.8206 4.51198 22.8206 6.17998C22.8206 7.85998 24.0206 9.14398 25.7966 9.14398C27.0206 9.14398 28.0166 8.54398 28.3766 7.52398H27.0086C26.7806 7.88398 26.3606 8.05198 25.8086 8.05198C24.7526 8.05198 24.2126 7.40398 24.0926 6.55198H28.5206C28.7606 4.64398 27.5966 3.21598 25.7246 3.21598ZM25.7366 4.27198C26.6126 4.27198 27.2126 4.76398 27.2846 5.68798H24.1166C24.2606 4.89598 24.8006 4.27198 25.7366 4.27198Z",fill:"#5D696F"}),g("path",{d:"M31.1297 4.12798V3.35998H29.8817V8.99998H31.1297V5.44798C31.6337 4.78798 32.3177 4.45198 33.2177 4.41598V3.23998C32.3537 3.23998 31.6457 3.56398 31.1297 4.12798Z",fill:"#5D696F"}),g("path",{d:"M36.8222 3.21598C35.1062 3.21598 33.9182 4.51198 33.9182 6.17998C33.9182 7.85998 35.1182 9.14398 36.8942 9.14398C38.1182 9.14398 39.1142 8.54398 39.4742 7.52398H38.1062C37.8782 7.88398 37.4582 8.05198 36.9062 8.05198C35.8502 8.05198 35.3102 7.40398 35.1902 6.55198H39.6182C39.8582 4.64398 38.6942 3.21598 36.8222 3.21598ZM36.8342 4.27198C37.7102 4.27198 38.3102 4.76398 38.3822 5.68798H35.2142C35.3582 4.89598 35.8982 4.27198 36.8342 4.27198Z",fill:"#5D696F"}),g("path",{d:"M45.4886 0.47998V3.80398C45.0086 3.43198 44.3966 3.21598 43.6766 3.21598C42.0926 3.21598 40.8206 4.53598 40.8206 6.16798C40.8206 7.82398 42.0926 9.14398 43.6766 9.14398C44.3966 9.14398 45.0086 8.92798 45.4886 8.54398V8.99998H46.7246V0.47998H45.4886ZM43.8566 8.01598C42.8246 8.01598 42.0686 7.17598 42.0686 6.16798C42.0686 5.17198 42.8246 4.34398 43.8566 4.34398C44.4806 4.34398 45.0686 4.55998 45.4886 5.15998V7.18798C45.0686 7.79998 44.4806 8.01598 43.8566 8.01598Z",fill:"#5D696F"}),g("path",{d:"M54.6797 3.21598C53.9597 3.21598 53.3477 3.43198 52.8797 3.79198V0.47998H51.6317V8.99998H52.8797V8.55598C53.3477 8.92798 53.9597 9.14398 54.6797 9.14398C56.2637 9.14398 57.5477 7.82398 57.5477 6.16798C57.5477 4.53598 56.2637 3.21598 54.6797 3.21598ZM54.4997 8.01598C53.8757 8.01598 53.2997 7.79998 52.8797 7.21198V5.13598C53.2997 4.54798 53.8757 4.34398 54.4997 4.34398C55.5437 4.34398 56.2997 5.17198 56.2997 6.16798C56.2997 7.17598 55.5437 8.01598 54.4997 8.01598Z",fill:"#5D696F"}),g("path",{d:"M63.3347 3.34798L61.3907 7.76398L59.2667 3.34798H57.9347L60.8147 9.08398L59.6267 11.784H60.9347L64.6547 3.34798H63.3347Z",fill:"#5D696F"}),g("path",{d:"M71.1466 4.34661C69.8092 4.05038 69.131 3.53001 69.131 2.80065C69.131 2.04705 69.8546 1.47822 70.8142 1.47822C71.8034 1.47822 72.5496 2.10339 72.5496 2.9321V2.99813H73.9165V2.9321C73.9165 1.41764 72.5883 0.272705 70.8271 0.272705C69.9784 0.272705 69.2009 0.533191 68.6379 1.0057C68.3584 1.23619 68.1339 1.52487 67.9805 1.8511C67.8271 2.17733 67.7486 2.53303 67.7506 2.89273C67.7451 3.22255 67.8137 3.54949 67.9515 3.84994C68.0894 4.15038 68.293 4.41686 68.5478 4.63012C69.0218 5.04266 69.6945 5.34798 70.5463 5.5388C71.9806 5.85502 72.7078 6.39296 72.7078 7.13686C72.7078 7.94316 71.9156 8.55076 70.8682 8.55076C69.7804 8.55076 68.9599 7.87531 68.9599 6.97996V6.91393H67.5918V6.97996C67.5918 8.56348 68.9942 9.75688 70.8535 9.75688C71.7426 9.75688 72.5588 9.48731 73.1518 8.99662C73.446 8.75831 73.6827 8.4581 73.8445 8.1179C74.0063 7.7777 74.0891 7.40611 74.087 7.03024C74.087 5.6854 73.0991 4.78217 71.1466 4.34661Z",fill:"#5D696F"}),g("path",{d:"M78.7986 2.50806C78.2874 2.50175 77.7823 2.6176 77.3263 2.84576C76.8703 3.07391 76.4768 3.40759 76.1795 3.81837V2.66738H74.8789V12.0752H76.1795V8.48716C76.4768 8.8979 76.8703 9.23152 77.3263 9.45957C77.7824 9.68763 78.2875 9.80335 78.7986 9.79687C80.8167 9.79687 82.3381 8.23031 82.3381 6.15246C82.3381 4.07462 80.8167 2.50806 78.7986 2.50806ZM80.9835 6.42264C80.9316 6.9629 80.6921 7.46879 80.3056 7.8544C79.919 8.24001 79.4093 8.48156 78.863 8.53804C78.1369 8.61074 77.4605 8.40295 76.9583 7.95407C76.4561 7.50518 76.1795 6.86365 76.1795 6.15246C76.1795 4.7846 77.2122 3.75295 78.5815 3.75295C79.2904 3.75295 79.9306 4.02191 80.3776 4.51018C80.8387 5.01116 81.054 5.69025 80.9835 6.42264Z",fill:"#5D696F"}),g("path",{d:"M98.2908 2.6692V3.80747C97.6776 2.97875 96.7302 2.50806 95.6583 2.50806C93.6482 2.50806 92.1323 4.04615 92.1323 6.08582C92.1323 8.1255 93.6482 9.66299 95.6583 9.66299C96.7345 9.66299 97.6819 9.19714 98.2908 8.37691V8.55198C98.2908 9.96891 97.3906 10.8843 95.9974 10.8843C95.0561 10.8843 94.2718 10.4766 93.8996 9.79384L93.8806 9.7587H92.5389L92.5695 9.84654C92.7961 10.514 93.2392 11.0889 93.8303 11.4822C94.4233 11.8723 95.1726 12.0783 95.9974 12.0783C97.0552 12.0783 97.9554 11.7451 98.6017 11.1157C99.2481 10.4862 99.5915 9.6012 99.5915 8.56773V2.6692H98.2908ZM97.5611 7.842C97.0092 8.36418 96.2225 8.58348 95.4001 8.44294C94.9132 8.35796 94.4664 8.12184 94.1245 7.76889C93.7827 7.41593 93.5636 6.96452 93.4992 6.48019C93.3833 5.66541 93.631 4.89364 94.1786 4.36418C94.6383 3.92741 95.2542 3.68788 95.8919 3.69782C96.0464 3.69795 96.2006 3.71031 96.3531 3.73477C97.3459 3.89349 98.1314 4.70403 98.2632 5.71024C98.3749 6.53835 98.1179 7.31436 97.5611 7.842Z",fill:"#5D696F"}),g("path",{d:"M90.705 0.0995975C90.4602 0.046773 90.2043 0.0911971 89.9925 0.223269C89.7806 0.35534 89.6299 0.564452 89.5729 0.805409C89.5159 1.04637 89.5571 1.29982 89.6877 1.51098C89.8183 1.72215 90.0277 1.87407 90.2708 1.93391C90.3415 1.94954 90.4136 1.95747 90.486 1.95754C90.72 1.9579 90.9458 1.87325 91.1206 1.71973C91.2955 1.5662 91.407 1.35452 91.4341 1.125C91.4611 0.89547 91.4017 0.664135 91.2673 0.475046C91.1329 0.285958 90.9327 0.152325 90.705 0.0995975V0.0995975Z",fill:"#5D696F"}),g("path",{d:"M89.8366 8.39143H88.715C87.9178 8.39143 87.4389 7.85531 87.4389 6.95693C87.4389 6.08096 87.8681 5.03659 88.7432 3.76444L88.7548 3.74748V3.38825L85.0271 2.86727C85.0284 2.71553 84.9886 2.56622 84.9118 2.43478C84.8351 2.30335 84.7241 2.19458 84.5905 2.11973C84.2563 1.938 83.8908 1.938 83.5879 2.11368C83.4361 2.2023 83.3122 2.33077 83.23 2.4848C83.1477 2.63884 83.1103 2.8124 83.1219 2.98618C83.1336 3.15996 83.1938 3.32714 83.2958 3.46914C83.3979 3.61114 83.5379 3.72238 83.7001 3.79049L82.5405 9.63753H83.8283L84.8977 4.08551L86.9115 4.42111C86.3701 5.38007 86.0953 6.27421 86.0953 7.07869C86.0953 8.56347 87.0041 9.53576 88.4734 9.62965V9.63753H91.1341V2.69099H89.8366V8.39143Z",fill:"#5D696F"})]}),km=()=>{const{border:e,cards:t,headers:n,index:r,marketingUrl:i,showSurveyBrand:o,slugName:a,surveyId:s,viewedCardCount:l}=J(v=>({border:v.border,cards:v.cards,headers:v.headers,index:v.index,marketingUrl:v.marketingUrl,showSurveyBrand:v.showSurveyBrand,slugName:v.slugName,surveyId:v.surveyId,viewedCardCount:v.viewedCardCount})),u=_t(null),c=t.filter(v=>v.type!==N.Uploading&&v.type!==N.Thanks),f=Rv(t,r),d=l+1,p=d/(d+f);Ce(()=>{u.current&&(u.current.style.width=`${p*100}%`)},[p]);const h=()=>o?g("a",{href:`${i}?utm_source=survey_branding&utm_medium=website&utm_campaign=${a}&utm_content=${s}`,rel:"noreferrer",style:{display:"block",margin:"5px 0"},target:"_blank",children:g(bs,{})}):null;return!c||c.length===1?g("footer",{className:"ul-footer",style:o?{}:{marginBottom:"10px"},children:h()}):g("footer",{className:`ul-footer ${n["userleap-platform"]==="link"?"ul-footer__link":""}`,children:[c.length>1&&g("div",{id:"ul-progress-bar-container",children:g("div",{id:"ul-progress-bar-current",ref:u,style:{border:`1px solid ${e||"#000"}`}})}),o&&g("a",{href:`${i}?utm_source=survey_branding&utm_medium=website&utm_campaign=${a}&utm_content=${s}`,rel:"noreferrer",style:{display:"block",margin:"5px 0"},target:"_blank",children:g(bs,{})})]})},Tm=()=>{const{answers:e,border:t,cards:n,close:r,configureExitOnOverlayClick:i,destroy:o,endCard:a,eventEmitFn:s,fontFamily:l,headers:u,index:c,next:f,showStripes:d,update:p,useMobileStyling:h,viewDocument:v}=J(C=>({answers:C.answers,border:C.border,cards:C.cards,close:C.close,configureExitOnOverlayClick:C.configureExitOnOverlayClick,destroy:C.destroy,endCard:C.endCard,eventEmitFn:C.eventEmitFn,fontFamily:C.fontFamily,headers:C.headers,index:C.index,next:C.next,showStripes:C.showStripes,update:C.update,useMobileStyling:C.useMobileStyling,viewDocument:C.viewDocument})),m=_t(null),w=_t(!1),{props:y,type:E,name:_}=n[c],b=n.length;Ce(()=>{m.current&&(m.current.classList.contains("ul-app--visible")||m.current.classList.add("ul-app--visible"),!w.current&&s&&(w.current=!0,s(H.SurveyAppeared)))},[s]),Ce(()=>{p()},[c,p]),Ce(()=>{i(()=>r())},[r,i]);const S=()=>r(qt),x=C=>{C.key==="Enter"&&S()},I=async function(C){f({data:C,completeSurvey:()=>{o(qt)},endCard:a}),Sf(v)};if(e){for(const C of e)if(C.questionId===_){let j;if(E===N.MultipleChoice){const O=y.options.find(({value:Y})=>Y===C.value);if(!O)break;j={[O.id]:O.value}}else j=C.value;I({value:j,type:E,questionId:C.questionId});break}}const k=()=>[Pt.Email,Pt.Link].includes(u["userleap-platform"])?!1:!a||c+1!==b,L=()=>h?{borderColor:t}:{borderColor:t,margin:"15px"},T=()=>{const C={className:"ul-card",next:I,questionId:_,type:E};switch(E){case N.ConsentLegal:return ee(Bv,{...C,...y,key:_});case N.Likert:return ee(Kv,{...C,...y,key:_});case N.MultipleChoice:return ee($v,{...C,...y,key:_});case N.MultipleSelect:return ee(Gv,{...C,...y,key:_});case N.NPS:return ee(qv,{...C,key:_,props:y});case N.Open:return ee(zv,{...C,...y,key:_});case N.RecordedTask:return ee(im,{...C,...y,key:_});case N.TextUrlPrompt:return ee(sm,{...C,...y,key:_});case N.Thanks:return ee(lm,{...C,...y,key:_});case N.Uploading:return ee(Im,{...C,...y,key:_});case N.VideoVoice:return ee(Cm,{...C,...y,key:_});default:return null}},U=C=>{var G;const j=window.sprigAPI,O=C.target;if(!j||!O)return;const Y=[O,O.parentElement];for(const he of Y)if(((G=he==null?void 0:he.tagName)==null?void 0:G.toLowerCase())==="a"){C.preventDefault(),j==null||j.openUrl(he.href);return}};return g("div",{className:F("ul-app",zt(u)?"ul-app--visible":"ul-app--overlay"),id:qt,onClick:U,ref:m,style:{"--theme":t,...l?{fontFamily:l.replace(";","")}:{}},children:g("div",{className:"ul-app__container",children:[g("div",{className:F(re(R.CardContainer,h)),style:L(),children:[d&&g("div",{className:"ul-header__container",children:g("div",{className:"ul-header",children:"For development purposes only"})}),T(),g(km,{})]}),k()&&g("div",{className:F(re(R.CloseContainer,h)),children:g("div",{"aria-label":"Close button",className:R.CloseButton,onClick:S,onKeyPress:x,role:"button",tabIndex:0,children:g("svg",{fill:"none",height:"18px",viewBox:"0 0 13 13",width:"18px",xmlns:"http://www.w3.org/2000/svg",children:g("path",{d:"M2.54964 1.78369L1.78369 2.54964L5.73405 6.5L1.78369 10.4504L2.54964 11.2163L6.5 7.26595L10.4504 11.2163L11.2163 10.4504L7.26595 6.5L11.2163 2.54964L10.4504 1.78369L6.5 5.73405L2.54964 1.78369Z",fill:"#262136"})})})})]})})},Lm=`html,body,p,ol,ul,li,dl,dt,dd,blockquote,figure,fieldset,legend,textarea,pre,iframe,hr,h1,h2,h3,h4,h5,h6{margin:0;padding:0}h1,h2,h3,h4,h5,h6{font-size:100%;font-weight:400}button,input,select,textarea{margin:0}html{box-sizing:border-box}*,*:before,*:after{box-sizing:inherit}.ul-card{flex:1 1 auto;border-radius:2px;display:flex;flex-direction:column;font-size:17px;line-height:19px;text-align:left;margin:auto}.ul-card__container--desktop{border:2px solid #fff;box-shadow:0 0 15px #00000026}.ul-card__container--mobile{border-width:0;box-shadow:0 0 5px #00000040;margin-top:5px}.ul-card__container{background:#ffffff;border-radius:6px;display:flex;flex-direction:column;flex-grow:1;flex:1 1 auto;font-size:17px;line-height:23px;overflow:auto;padding:20px 20px 5px;position:relative;text-align:center;word-break:break-word}.ul-card-vertical__button-wrapper{flex-direction:column;align-items:center}.ul-card__button-wrapper{margin-top:4px;margin-bottom:3px;display:flex;gap:16px;justify-content:center}.ul-rich-text-body{min-height:2em}.ul-rich-text-body,.ul-rich-text-body p{margin-top:10px;margin-bottom:10px}.ul-rich-text-body li{margin:5px 0 5px 20px}.ul-rich-text-body p,.ul-rich-text-body li{font-size:15px;line-height:130.35%;letter-spacing:.02em;color:#343442;text-align:left;white-space:pre-line}.ul-rich-text-body:last-child,.ul-rich-text-body li:last-child{margin-bottom:15px}.ul-card-main-content__link,.ul-card-main-content__email{flex-grow:55;display:flex}.ul-card-main-content__web,.ul-card-main-content__android,.ul-card-main-content__ios{padding-top:15px;margin-bottom:5px}.ul-question{color:#343442;display:block;font-size:20px;line-height:125%;font-weight:500;cursor:default;text-align:left}.ul-caption{flex:1 0 auto;margin-top:8px;margin-bottom:15px;font-size:15px;line-height:130.35%;letter-spacing:.02em;color:#6c6c6e;text-align:left}.ul-card__choices{margin:5px 0 0;flex:1 0}.choice--mobile{border:2px solid #e6e6e6}.choice--desktop{border:1px solid #e6e6e6}.choice{align-items:flex-start;color:#262136;cursor:pointer;display:flex;justify-content:flex-start;flex-direction:column;box-sizing:border-box;border-radius:3px;margin-bottom:7px;font-size:15px;line-height:20px;padding:10px 20px 10px 15px;background-color:#00000003}.choice--desktop:hover,.choice--desktop:active,.choice--mobile:active{background-color:#0000000d}.choice-label-container{display:flex;flex-direction:row;justify-content:flex-start;align-items:center;width:100%;height:fit-content;flex:0 0 fit-content}.choice-text-entry-container{width:100%;height:fit-content;flex:0 1 fit-content;overflow:hidden}.choice .choice-text-input--mobile{max-height:63px}.choice .choice-text-input--desktop{max-height:150px}.choice .choice-text-input{box-sizing:border-box;background-color:transparent;color:#343442;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol;min-height:20px;max-height:60px;padding:0;margin-top:8px;resize:none;width:100%;font-size:14px;line-height:20px;outline:none;border:none;overflow-wrap:break-word}.choice .choice-text-input::placeholder{color:#6c6c6e80}.ul-thanks-check{text-align:center;margin-bottom:20px}.ul-card--thanks-content{padding:20px 0 10px}.ul-card--thanks .ul-question{padding-top:0;text-align:center}.ul-card--thanks .ul-caption{padding-top:0;text-align:center;overflow-wrap:break-word;hyphens:auto;hyphenate-limit-lines:no-limit}.ul-card--uploading .ul-question{padding-top:15px;text-align:center}.ul-card--uploading .ul-caption{padding-top:5px;text-align:center;overflow-wrap:break-word}.ul-loading-spinner-container{font-size:1.8rem;flex-grow:1;width:100%;height:100%;display:flex;align-items:center;justify-content:center}.ul-loading-spinner{display:inline-block;position:relative;width:6rem;height:6rem}.ul-loading-spinner div{box-sizing:border-box;display:block;position:absolute;width:80%;height:80%;margin:5px;border:5px solid #152e3e;border-radius:50%;animation:lds-ring 1.2s cubic-bezier(.5,0,.5,1) infinite;border-color:#152e3e transparent transparent transparent}.ul-loading-spinner .first{animation-delay:-.45s}.ul-loading-spinner .second{animation-delay:-.3s}.ul-loading-spinner .third{animation-delay:-.15s}@keyframes lds-ring{0%{transform:rotate(0)}to{transform:rotate(360deg)}}.select-checkbox{height:16px;width:16px;border-radius:3px;border:1px solid #323232;display:flex;box-sizing:border-box;box-shadow:inset 3px 3px #0000001a;background-color:"transparent";align-items:center;justify-content:center}.select-radio{height:16px;width:16px;border-radius:16px;border:1px solid #323232;display:flex;box-sizing:border-box;box-shadow:inset 2px 2px #0000001a;background-color:"transparent";align-items:center;justify-content:center}.fade-in-transition{animation:fadeIn .4s ease-in;-webkit-animation:fadeIn .4s ease-in;-moz-animation:fadeIn .4s ease-in;-o-animation:fadeIn .4s ease-in;-ms-animation:fadeIn .4s ease-in}@keyframes fadeIn{0%{opacity:0}to{opacity:1}}@-moz-keyframes fadeIn{0%{opacity:0}to{opacity:1}}@-webkit-keyframes fadeIn{0%{opacity:0}to{opacity:1}}@-o-keyframes fadeIn{0%{opacity:0}to{opacity:1}}@-ms-keyframes fadeIn{0%{opacity:0}to{opacity:1}}[class^=CenteredSurveyLayout] .ul-header__container,[class^=QuestionConceptTestLayout] .ul-header__container,.ul-websurvey-frame .ul-card__container,.ul-websurvey-frame-mobile .ul-card__container{margin-bottom:unset}[class^=CenteredSurveyLayout] .ul-card__container,[class^=QuestionConceptTestLayout] .ul-card__container,.ul-websurvey-frame .ul-card__container,.ul-websurvey-frame-mobile .ul-card__container{box-shadow:unset;border-radius:unset;border:none!important;position:unset}@media only screen and (min-height: 600px) and (width: 600px){.ul-card{position:relative;top:-20px}}.ul-vertical-centered-container{display:flex;flex-direction:column;align-items:center}.ul-consent-legal__name-input--mobile{border:2px solid #e6e6e6}.ul-consent-legal__name-input--desktop{border:1px solid #e6e6e6}.ul-consent-legal__name-input{background:rgba(0,0,0,.01);box-sizing:border-box;color:#343442;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol;padding:10px 20px 10px 15px;border-radius:3px;font-size:15px;line-height:20px;margin-bottom:7px;width:100%}.ul-consent-legal__name-input::placeholder{color:#6c6c6e80}.ul-consent-legal__name-input:focus{outline:none;background:white}.ul-consent-legal__name-input--desktop:hover:not(:focus){background-color:#0000000d}.ul-card__consent-legal .choice{font-size:15px;padding:10px 15px;background-color:#00000003}.ul-card__consent-legal .choice--desktop:hover,.ul-card__consent-legal .choice--desktop:active,.ul-card__consent-legal .choice--mobile:active{background-color:#0000000d}.ul-card--likert__numbers{align-items:center;border-radius:5px;display:flex;flex-direction:row;flex:1 0;justify-content:center;margin:5px 0 0}.likert-number--mobile{border:2px solid #e6e6e6;margin-left:-2px}.likert-number--desktop{border:1px solid #e6e6e6;margin-left:-1px}.likert-number{align-items:center;cursor:pointer;display:flex;justify-content:center;flex:1 0;background-color:#00000003;font-size:18px;line-height:24px;height:67px}.likert-number:active,.likert-number--desktop:hover{background-color:#0000000d;font-weight:500}.likert-number-1{border-top-left-radius:5px;border-bottom-left-radius:5px}.likert-last-option{border-top-right-radius:5px;border-bottom-right-radius:5px}.likert-star--mobile{margin-left:-2px}.likert-star--desktop{margin-left:-1px}.likert-star{align-items:center;cursor:pointer;display:flex;justify-content:space-between;flex:1 0;color:transparent;font-size:18px;line-height:24px;height:67px}.likert-smiley--mobile{margin-left:-2px}.likert-smiley--desktop{margin-left:-1px}.likert-smiley{align-items:center;cursor:pointer;display:flex;justify-content:space-between;flex:1 0;color:transparent;line-height:24px;height:67px}.likert-smiley circle:not(:first-child){fill-opacity:1}.ul-card--likert__labels{align-items:center;color:#262136;display:flex;flex-direction:row;flex:1 0;font-weight:500;font-size:13px;line-height:15px;justify-content:space-between;margin:7px 0 10px}.ul-card--likert__labels span:last-child{text-align:right}.select-label{flex:1;overflow-wrap:anywhere;cursor:pointer;padding-left:15px}.ul-card--nps__numbers{align-items:center;border-radius:5px;display:flex;flex-direction:row;flex:1 0;justify-content:center;margin:5px 0 0}.nps-number--mobile{border:2px solid #e6e6e6;margin-left:-2px}.nps-number--desktop{border:1px solid #e6e6e6;margin-left:-1px}.nps-number{align-items:center;cursor:pointer;display:flex;justify-content:center;flex:1 0;background-color:#00000003;font-size:18px;line-height:24px;height:67px}.nps-number:active,.nps-number--desktop:hover{background-color:#0000000d;font-weight:500}.nps-number-0{border-top-left-radius:5px;border-bottom-left-radius:5px}.nps-number-10{border-top-right-radius:5px;border-bottom-right-radius:5px}.ul-card--nps__labels{align-items:center;color:#262136;display:flex;flex-direction:row;flex:1 0;font-weight:500;font-size:13px;line-height:15px;justify-content:space-between;margin:7px 0 10px}.ul-card--nps__labels span:last-child{text-align:right}.ul-card-text{flex:1 0 auto;margin-top:2px;margin-bottom:3px;align-items:center;display:flex;flex-wrap:wrap;justify-content:center;padding:0}.ul-card-text__container{align-items:center;box-sizing:border-box;border-radius:3px;display:flex;justify-content:center;margin-bottom:12px;flex:1 0 100%}.ul-card-text__input--mobile{border:2px solid #e6e6e6;max-height:63px}.ul-card-text__input--desktop{border:1px solid #e6e6e6;max-height:150px}.ul-card-text__input{background:rgba(0,0,0,.01);box-sizing:border-box;color:#343442;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol;min-height:63px;overflow:auto;padding:12px;resize:none;width:100%;border-radius:3px;font-size:15px;line-height:20px;overflow-wrap:break-word}.ul-card-text__input::placeholder{color:#6c6c6e80}.ul-card-text__input:focus{outline:none;background:white}.ul-card-text__input--desktop:hover:not(:focus){background-color:#0000000d}.ul-card__text-url-prompt-button{text-decoration:none;text-overflow:ellipsis;overflow:hidden;white-space:nowrap}#ul-card-voice__video{align-items:center;display:flex;flex-direction:column}#ul-card-voice__video>div{margin-bottom:10px;width:100%}#ul-card-video__player_recorder{width:100%;width:-moz-available;width:-webkit-fill-available;width:fill-available}.ul-card-record__task{flex:1 0 auto;margin-top:2px;margin-bottom:3px;align-items:center;display:flex;flex-wrap:wrap;justify-content:center;padding:0}#ul-record-task-upload-progress,#ul-record-task-video-preview{width:100%;height:150px}.ul-permission-graphics-container{width:100%;height:150px;background-color:#0000000d;text-align:center;flex-direction:column;margin-left:auto;margin-right:auto;border-radius:5px;display:flex;align-items:center;font-size:15px;color:#000000b3}.ul-av-permission-denied-paragraph{margin:auto 15px;font-size:12px}.ul-av-permission-denied-headline{font-size:14px;color:#262136;text-decoration:underline;font-size:12px}.ul-permission-body{color:#000;margin:5px auto 5px 5px;line-height:135%;text-align:center}.ul-select-tab-container{width:240px;height:46px;background:#ffffff;border-radius:5px;text-align:left;align-items:center;display:flex;padding:0 5px;margin-top:20px;margin-bottom:auto}.ul-select-tab-text{color:#4b575d;margin:5px;line-height:135%;text-align:center}button.ul-task-skip-button{color:#000;background-color:#fff}#ul-task-detail-container{margin-top:0;margin-bottom:0;overflow:auto}#ul-task-detail-container.ul-rich-text-body p,#ul-task-detail-container.ul-rich-text-body li,#ul-task-detail-container.ul-rich-text-body{color:#4c4c4c}#ul-task-detail-container :first-child{margin-top:0}#ul-task-detail-container :last-child{margin-bottom:20px}.ul-horizontal-button-container{width:100%;display:flex;flex-direction:row}.ul-skip-button-below{margin-top:5px}.ul-horizontal-button-container-center{justify-content:center}.ul-vertical-button-container-center{display:flex;flex-direction:column;align-items:center}.ul-horizontal-button-container-left{justify-content:flex-start}.ul_recorded-task-inset-spacing{margin-top:5px;margin-bottom:24px}.ul_permission_svg_container{justify-content:center}.ul-card-text__button{background-color:var(--theme);border-radius:3px;border:none;color:#fff;cursor:pointer;font-size:15px;font-weight:500;line-height:18px;padding:10.5px 21px}.ul-card-text__button:disabled,.ul-card-text__button.sprig-button-disabled{background-color:#0000001a;color:#0003}.ul-card-text__button.ul-button-inactive{background-color:#fff!important;color:#5d696f!important}.ul-card-skip__button{color:#00000080;background:none;border:none;font-size:15px;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol;cursor:pointer}.ul-card-button-group{align-items:center;display:flex;gap:30px}html,body{cursor:default;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol;height:100%;overflow:hidden;-webkit-tap-highlight-color:transparent;-webkit-user-select:none;-webkit-touch-callout:none}b{font-weight:500}#ul-app{opacity:0;width:100%;flex-grow:2;display:flex}#ul-app.ul-app--overlay{position:absolute;bottom:0;transition:opacity .1s ease-out;transition-delay:.1s}#ul-app.ul-app--visible{opacity:1;bottom:0}.ul-app__container{width:100%;display:flex;flex-direction:column;max-height:100vh}.ul-header__container{margin-bottom:15px}.ul-header{align-items:center;background:repeating-linear-gradient(120deg,#ebebeb,#ebebeb 24px,#fff 24px,#fff 48px);border-bottom:2px solid #ebebeb;display:flex;font-size:14px;font-weight:500;height:40px;justify-content:center;left:0;position:absolute;top:0;width:100%}.ul-footer{display:flex;flex-direction:column;align-items:center;justify-content:center;margin-top:auto;flex-grow:1;width:100%}.ul-footer-bubble{display:inline-block;margin:0 3px;width:7px;height:7px;border-radius:3px;border:1px solid transparent}.close-container--desktop,.close-container--mobile{height:22px;width:22px;border-radius:22px;background-color:#fff;align-items:center;justify-content:center}.close-container--desktop{top:25px;right:25px}.close-container--mobile{top:15px;right:10px}.close-container{background:transparent;box-sizing:border-box;display:flex;position:absolute}.close-btn{height:18px;width:18px;align-items:center;justify-content:center;display:flex;cursor:pointer}.ul-app__container{transition:opacity .3s ease-out}.ul-center-horizontally{text-align:center}#ul-progress-bar-container{width:100%;height:2px;background-color:#0000001a;border-radius:2px;max-width:250px;margin:25px 0}#ul-progress-bar-current{transition:width 1s ease;width:0%;height:0;border-radius:2px}.prototype-button{width:100%;background:rgba(0,0,0,.01);border:1.5px solid #e6e6e6;border-radius:4px 0 0 4px;flex:none;flex-grow:1;margin:0;padding:20px 0;font-size:14px;font-family:inherit;text-decoration:underline}.prototype-button:hover{cursor:pointer}
704
- `,Rm=(e,t)=>{const n=[...e],r=new Set([N.VideoVoice,N.RecordedTask]);return e.some(i=>r.has(i.type))&&n.push({name:-2,props:{routingOptions:[]},type:N.Uploading}),t&&n.push({name:-1,props:{routingOptions:[]},type:N.Thanks}),n},Am=({mode:e=null,viewWindow:t,viewDocument:n})=>{const r=n.documentElement;return{mode:e,sw:t.screen.width,sh:t.screen.height,cw:r.clientWidth,ch:r.clientHeight,p:t.location.href,l:t.navigator.language}};function Om(e,t=!0){var b;const{answers:n,apiURL:r,customStyles:i,endCard:o,eventEmitFn:a,fontFamilyURL:s,frame:l,previewKey:u,UpChunk:c,viewDocument:f,viewWindow:d}=e,p=zt(e.headers)?e.frame:f.body,h=q,v=Rm(e.cards,!!o);gr.configure(h,{cards:v,hasEndCard:!!o,apiURL:r,UpChunk:c}),J.setState({apiURL:r,answers:n,border:e.border,index:e.startingQuestionIdx||0,cards:v,configureExitOnOverlayClick:e.configureExitOnOverlayClick,customMetadata:e.customMetadata,endCard:e.endCard,envId:e.envId,eventEmitFn:a,fontFamily:e.fontFamily,frame:l,headers:e.headers,hasViewedEmbed:!1,isPreview:e.isPreview,marketingUrl:"https://sprig.com",meta:Am({mode:e.mode,viewWindow:d,viewDocument:f}),mode:e.mode,previewKey:u,recorder:gr,recorderEventEmitter:h,responseGroupUid:e.responseGroupUid,showStripes:e.showStripes,showSurveyBrand:e.showSurveyBrand,slugName:e.slugName,styleNonce:e.styleNonce,surveyId:e.surveyId,tabTitle:e.tabTitle,uploadingCardViewed:!1,uploadProgress:{},useMobileStyling:e.useMobileStyling,useDesktopPrototype:e.useDesktopPrototype,userId:e.userId,viewDocument:e.viewDocument,visitorAttributes:e.visitorAttributes,viewedCardCount:e.startingQuestionIdx||0});const{seen:m}=J.getState();m();const{head:w}=f,y=f.createElement("style");if(y.id="sprig-style",y.textContent=Lm,y.nonce=e.styleNonce,w.appendChild(y),e.fontFamily&&s&&parent){const S=f.createElement("link");S.rel="stylesheet",S.href=s,w.appendChild(S)}if(e.customStyles&&Ks(f,i,e.styleNonce),!c)if(e.installationMethod!==ht.Npm){const S=f.createElement("script");S.src="https://cdn.sprig.com/userleap-web-upchunk-v2.2.2.js",S.onload=()=>{gr.setUpChunk(d.UpChunk)},S.onerror=()=>{console.warn("[Sprig] - recording functionality not configured due to UpChunk library load failure")},w.appendChild(S)}else console.warn("[Sprig] - recording functionality not configured due to missing UpChunk dependency");const E="2.23.3",_=a||((b=l.eventEmitter)==null?void 0:b.emit);_==null||_(Ie.VerifyViewVersion,{[Lt.ViewVersion]:E}),p&&t&&nn(g(Tm,{}),p)}const Um={configure:Om};window.UserLeap&&window.Sprig&&(window.Sprig._gtm?window.Sprig=window.UserLeap:window.UserLeap=window.Sprig);window.UserLeap||(window.UserLeap=window.Sprig);window.Sprig||(window.Sprig=window.UserLeap);const Dm="rgba(255,255,255, 0.95)",Pm="rgba(0,0,0,0.9)",Nm="360px",Si="0px",rc=()=>{window.UserLeap.container=document.createElement("div"),window.UserLeap.container.className="ul-container",document.body.appendChild(window.UserLeap.container)},ic=e=>{const t=window.UserLeap.container;if(!!t)try{document.body.removeChild(t),window.UserLeap.container=null,ye("trackStartUrl",null),q.emit(H.SurveyLifeCycle,{state:"dismissed"}),q.emit(H.SurveyClosed,{name:H.SurveyClosed,initiator:e})}catch(n){console.warn(`[Sprig] (ERR-412) Error removing UserLeap container by ${e} `+t),n instanceof Error&&window.UserLeap.reportError("dismissActiveSurvey",n)}},oc=()=>{q.on(H.SurveyWillClose,({initiator:e})=>{ic(e)})},Mm=(e,t)=>{const r={...{position:"fixed",overflow:"auto",top:"0px",left:"0px",display:"none",height:"100%",width:"100%",transition:"background-color 0.3s ease-out",zIndex:2147483646}},i=t?e.overlayStyleMobile:e.overlayStyle;r["background-color"]=i==="light"?Dm:Pm,t||(r.margin="auto"),window.UserLeap.container&&Object.assign(window.UserLeap.container.style,r)},jm=(e,t,n)=>{var s,l;const r={position:"fixed",bottom:"0px",right:Si,border:0,backgroundColor:"rgba(0,0,0,0)",zIndex:2147483646},i=Object.assign({},t,window.UserLeap);let o,a=!1;return n?((s=window.UserLeap.windowDimensions)!=null&&s.width?r.width=`${window.UserLeap.windowDimensions.width}px`:r.width="100%",(l=window.UserLeap.windowDimensions)!=null&&l.height?r.maxHeight=`${window.UserLeap.windowDimensions.height-20}px`:window.UserLeap.maxHeight?r.maxHeight=window.UserLeap.maxHeight:r.maxHeight=`${document.body.clientHeight-20}px`,["light","dark"].includes(i.overlayStyleMobile)&&(a=!0)):(r.width=Nm,r.maxHeight=window.UserLeap.maxHeight||"66vh",i.framePosition===yn.BottomLeft?o={left:Si}:i.framePosition===yn.TopLeft?o={left:Si,top:"0px"}:i.framePosition===yn.TopRight?o={top:"0px"}:i.framePosition===yn.Center&&(a=!0,o={margin:"auto",position:"static"},r.maxHeight=null)),a&&Mm(i,n),Object.assign(e.style,r,o),a},Vm=(e,t)=>{var s,l;const n="ul-frame";rc();const r=document.createElement("iframe");r.id=n,r.setAttribute("title","Sprig User Feedback Dialog");const i=jm(r,e,t);q.on(H.SurveyFadingOut,()=>{window.UserLeap.container&&Object.assign(window.UserLeap.container.style,{"background-color":"rgba(0,0,0,0)"})}),oc(),r.setHeight=u=>{parseInt(r.style.height)!=u&&(r.style.height=`${u}px`,q.emit(H.SurveyHeight,{name:H.SurveyHeight,contentFrameHeight:u}))},(s=window.UserLeap.container)==null||s.appendChild(r),e&&(t?e.exitOnOverlayClickMobile:e.exitOnOverlayClick)&&window.UserLeap.container&&(window.UserLeap.container.onclick=()=>{q.emit(H.CloseSurveyOnOverlayClick)}),q.emit(H.SurveyLifeCycle,{state:"presented"}),q.emit(H.SurveyPresented,{name:H.SurveyPresented});const o=(l=r.contentWindow)==null?void 0:l.document;o&&(o.open("text/html","replace"),o.write("<!doctype html><head></head><body></body></html>"),o.close());const a=o==null?void 0:o.head;return{frameId:n,contentWinDocHead:a,contentWindow:r.contentWindow,hasOverlay:i,iframe:r}},Fm="!launch_darkly_";class Bm{constructor(){ce(this,"_ldData",{})}getAllLaunchDarklyVariations(){return this._ldData}setLDFlagsVariations(t){try{return!t||typeof t!="object"||Array.isArray(t)?!1:(Object.keys(this._ldData).forEach(n=>{delete this._ldData[n]}),Object.keys(t).forEach(n=>this._ldData[`${Fm}${n}`]=t[n]+1),!0)}catch(n){return n instanceof Error&&window.UserLeap.reportError("setAllLDFlagsVariations",n),console.warn("[Sprig] An issue had occured when setting LaunchDarkly flags and variations."),!1}}}const co=new Bm;Object.freeze(co);const Hm="!optimizely_experiments_";class Km{constructor(){ce(this,"_optimizelyData",{})}setOptimizelyExperiment(t,n=!0){if(!t||typeof t!="object")return!1;const{experiments:r}=t;try{return n&&Object.keys(this._optimizelyData).map(i=>{delete this._optimizelyData[i]}),r&&r.map(i=>{const{id:o,variation:a}=i,s=this.transformExperimentId(o);a&&typeof a=="string"&&(this._optimizelyData[s]=a)}),!0}catch(i){return i instanceof Error&&window.UserLeap.reportError("setOptimizelyExperiment",i),!1}}getAllOptimizelyExperiments(){return this._optimizelyData}getOptimizelyVariationName(t){return this._optimizelyData[this.transformExperimentId(t)]}transformExperimentId(t){return Hm+t}getAndSetWebOptimizelyExperiments(){var t;try{if(window&&window.optimizely&&typeof window.optimizely.get=="function"){const n=(t=window.optimizely.get("state"))==null?void 0:t.getExperimentStates({isActive:!0});if(n){const r=Object.keys(n).map(i=>{var o,a;return(o=n[i].variation)!=null&&o.name?{id:i,variation:(a=n[i].variation)==null?void 0:a.name}:{id:i,variation:"Original"}});return this.setOptimizelyExperiment({experiments:r},!1),!0}return!1}return!1}catch(n){return n instanceof Error&&window.UserLeap.reportError("getAndSetWebOptimizely",n),!1}}}const wr=new Km;Object.freeze(wr);class $m{constructor(t,n){ce(this,"paused");ce(this,"queue");ce(this,"ul");this.ul=t,this.paused=!1,this.queue=[],this.flush(n)}flush(t){const n=t.length;if(n)for(let r=0;r<n;r++)this.push(t[r])}isPaused(){return this.paused}pause(){this.paused=!0}unpause(){this.paused=!1;const t=this.queue.slice();this.empty(),this.flush(t)}push(t){if(this.paused)this.queue.push(t);else if(t instanceof Function)t();else{const n=Array.prototype.slice.call(t,1),r=t[0],i=this.ul[r];i instanceof Function?i.apply(this.ul,n):r&&console.warn("[Sprig] (ERR-100) No valid UserLeap action called",r)}}perform(t){if(this.paused){let n=()=>{};const r=new Promise(function(i){n=function(){i(t())}});return this.queue.push(n),r}else return t()}empty(){this.queue.length=0}}const Gm=["popState","pushState","replaceState"],qm={test:"test"},mn="!email",zm=["ios","android"],pt="environments",fo="pageUrl",St="visitors",Es="ul-view-sdk-script",xs=Object.freeze({contains:(e,t)=>t.includes(e),notContains:(e,t)=>!t.includes(e),exactly:(e,t)=>t===e,notExactly:(e,t)=>t!==e,startsWith:(e,t)=>t.startsWith(e),endsWith:(e,t)=>t.endsWith(e),regex:(e,t)=>new RegExp(e).test(t),legacy:(e,t)=>new RegExp(e,"i").test(t)});function ia(e,t){const{matchType:n,pattern:r}=e,i=n?xs[n]:xs.legacy;let o=!1;try{o=i(r,t)}catch(a){const s=`[Sprig] (ERR-445) Failed to check url match with pattern ${r}`;a instanceof Error&&(console.warn(s,a),a.stack=JSON.stringify(e),window.UserLeap.reportError(s,a))}return o}function Wm(e,t){const{pageUrlEvents:n,interactiveEvents:r,dismissOnPageChange:i}=window.UserLeap._config;if(!i)return!0;const o=[];n&&n.length&&o.push(...n),r&&r.length&&o.push(...r);const a=e&&o.find(s=>s.id===e);return a?ia(a,window.location.href):t===window.location.href}function jn(e){const{pageUrlEvents:t,interactiveEvents:n,dismissOnPageChange:r,platform:i}=window.UserLeap._config;if(i&&i!==Pt.Web)return;const o=Ct("trackStartUrl"),a=o?String(o):null;t&&eg(window.location.href),n&&(sc(),Ym()),r&&a&&a!==window.location.href&&e&&Gm.includes(e.type)&&window.UserLeap("dismissActiveSurvey",Be.PageChange)}const ac={capture:!0},Ym=()=>{const t=window.UserLeap._config.interactiveEvents.filter(r=>ia(r,window.location.href)).map(r=>{const{name:i,properties:o}=r,{selector:a,innerText:s}=o;return a?l=>{if(Xt(l.target))try{l.target.closest(a)&&window.UserLeap("track",i)}catch{}return!1}:l=>(Xt(l.target)&&l.target.innerText===s&&window.UserLeap("track",i),!1)}),n=r=>t.forEach(i=>i(r));window.UserLeap._config.interactiveEventsHandler=n,window.addEventListener("click",n,ac)},sc=()=>{window.UserLeap._config.interactiveEventsHandler&&window.removeEventListener("click",window.UserLeap._config.interactiveEventsHandler,ac),delete window.UserLeap._config.interactiveEventsHandler};function Qm(){["hashchange","popstate"].forEach(e=>window.addEventListener(e,jn,!0))}function Zm(){["hashchange","popstate"].forEach(e=>window.removeEventListener(e,jn,!0)),window.UserLeap._config.interactiveEvents&&sc()}function Fe(e,t,n){const r=[window.UserLeap._API_URL,"sdk",e];return t&&t.forEach(i=>{r.push(i),i===pt?r.push(window.UserLeap.envId):i===St&&r.push(oa())}),n&&r.push(n),r.join("/")}function Xm(e,t){let n=Fe("1",[pt],"questions?");return e!=null&&(n+=`&vid=${e}`),t&&(t.surveyId&&(n+=`&surveyid=${t.surveyId}`),t.surveyTemplateId&&(n+=`&surveytemplateid=${t.surveyTemplateId}`)),n}function Jm(){try{if(typeof localStorage<"u"&&(localStorage.setItem("is_available","yes"),localStorage.getItem("is_available")==="yes"))return localStorage.removeItem("is_available"),!0}catch{return!1}return!1}function Ct(e){if(!window.UserLeap.localStorageAvailable)return null;const t=localStorage.getItem(_e.Credentials);if(t)try{const r=JSON.parse(t)[window.UserLeap.envId];return r&&r[e]||null}catch(n){n instanceof Error&&(n.stack=t,window.UserLeap.reportError("Failed to parse local storage credentials",n)),console.warn("[Sprig] (ERR-427) Failed to lookup saved ids",n)}return null}function ye(e,t){if(!window.UserLeap.localStorageAvailable)return;const n=localStorage.getItem(_e.Credentials);let r={};if(n)try{r=JSON.parse(n)}catch(o){o instanceof Error&&(o.stack=n,window.UserLeap.reportError("Failed to parse local storage credentials",o)),console.warn("[Sprig] (ERR-427) Failed to lookup saved ids",o)}let i=r[window.UserLeap.envId];i?i[e]=t:i={[e]:t},r[window.UserLeap.envId]=i;try{localStorage.setItem(_e.Credentials,JSON.stringify(r))}catch(o){o instanceof Error&&console.warn(`[Sprig] (ERR-426) Unable to write to Local Storage:: ${o.message}`)}}function lc(){window.previewMode||(window.UserLeap.visitorId=vt(),ye("vid",window.UserLeap.visitorId),q.emit(H.VisitorIDUpdated,{visitorId:window.UserLeap.visitorId}))}function oa(){return window.previewMode?"0":window.UserLeap.visitorId||""}function eg(e){if(!window.UserLeap.localStorageAvailable||e.endsWith("mock_snippet.html"))return;const t=window.UserLeap._config.pageUrlEvents;if(t&&t.length){let s=!1;for(let l=0;l<t.length&&(s=ia(t[l],e),!s);l++);if(!s)return}window.UserLeap.debugMode&&console.info("[DEBUG] Sprig trackPageView",e);const n=10,r=1;let i=[];const o={viewedAt:Date.now(),location:e},a=localStorage.getItem(_e.PageViews);try{if(i=a?JSON.parse(a):[],Array.isArray(i)||(i=[]),i.length>0){const s=i[i.length-1],l=(Date.now()-s.viewedAt)/1e3;(s.location!=e&&l>r||l>n)&&(window.UserLeap._queue.push(["track",fo,null,{url:e}]),i.push(o))}else window.UserLeap._queue.push(["track",fo,null,{url:e}]),i.push(o);i.length>5&&i.splice(0,i.length-5);try{localStorage.setItem(_e.PageViews,JSON.stringify(i))}catch(s){s instanceof Error&&console.warn(`[Sprig] Unable to write to Local Storage: ${s.message}`)}}catch(s){s instanceof Error&&(s.stack=a||"",window.UserLeap.reportError("trackPageView",s)),console.warn("[Sprig] (ERR-425) Failed to update page views in local storage")}}function tg(){const e="Backbone"in window&&window.Backbone&&window.Backbone.history?window.Backbone.history:window.history;"pushState"in e&&(e.pushState=(t=>function(...r){const i=t.apply(this,r),o=new Event("pushState");return window.dispatchEvent(o),jn(o),i})(e.pushState)),"replaceState"in e&&(e.replaceState=(t=>function(...r){const i=t.apply(this,r),o=new Event("replaceState");return window.dispatchEvent(o),jn(o),i})(e.replaceState)),Qm()}async function Ci(e,t){const n=oa();e&&!t&&(window.UserLeap._config.mode=qm.test);const r=await ut(Xm(n,e),{},0,!0);return r.ok?(r.json.delay&&await Cr(r.json.delay),uc(r.json)):(r.reportError&&r.error&&(console.warn("[Sprig] (ERR-414) Failed to request questions from the server",r.error),window.UserLeap.reportError("getQuestions",r.error)),{success:!1,surveyState:"no survey"})}const uc=async(e,t)=>{var C,j,O,Y;const{context:n,endCard:r,locale:i,productConfig:o,questions:a,responseGroupUid:s,surveyId:l,uuid:u,vid:c,sessionReplay:f}=e,d=Bn(window.UserLeap),p=aa(d),h=ng(d);if(f&&Dl({responseGroupId:s,surveyId:l,visitorId:c,replayParams:f,completeUploadHeaders:d,apiUrl:window.UserLeap._API_URL}),c==null||!a||!a.length)return{success:!1,message:"[Sprig] no survey found",surveyState:"no survey"};if(window.UserLeap.container){const G="[Sprig] (ERR-409) Found an existing Survey container, aborting rendering of this survey";return console.warn(G),{success:!1,message:G,surveyState:"no survey"}}if(c!==window.UserLeap.visitorId&&u!==window.UserLeap.visitorId&&!window.previewMode){const G="Attempted to display survey to a different visitor";return window.UserLeap.reportError("DisplaySurvey",new Error(G)),{success:!1,message:G,surveyState:"no survey"}}if(!(t?await t(l):!0))return{success:!1,message:"[Sprig] Callback returned false, aborting rendering of survey",surveyState:"no survey"};Li.disable(),q.emit(H.SurveyWillPresent,{name:H.SurveyWillPresent,[Ss.SurveyId]:l});let m,w=document.createElement("div"),y,E,_;const b=G=>{const{[Lt.ViewVersion]:he}=G;he!==d["x-ul-sdk-version"]&&ic(),q.removeListener(Ie.VerifyViewVersion,b)};q.on(Ie.VerifyViewVersion,b),zt(d)?(m="ul-direct-embeded-frame",y=document.head,E=window,_=!1,p&&(rc(),w.id=m,window.UserLeap.container.appendChild(w),oc(),q.emit(H.SurveyLifeCycle,{state:"presented"}),q.emit(H.SurveyPresented,{name:H.SurveyPresented}))):{frameId:m,contentWinDocHead:y,contentWindow:E,hasOverlay:_,iframe:w}=Vm(o,h),window.UserLeap.frameId=m,window.UserLeap.useMobileStyling=h;const S=G=>{q.on(H.CloseSurveyOnOverlayClick,G)},x=Object.assign({frame:w,envId:window.UserLeap.envId,surveyId:l,userId:u,visitorAttributes:{externalUserId:window.UserLeap.userId,email:window.UserLeap.email},cards:a,context:n,locale:i,fontFamily:window.UserLeap.fontFamily,fontFamilyURL:window.UserLeap.fontFamilyURL,apiURL:window.UserLeap._API_URL,responseGroupUid:s,headers:d,endCard:r,useMobileStyling:h,mobileSDKVersion:window.UserLeap.mobileSDKVersion,configureExitOnOverlayClick:S,eventEmitFn:q.emit.bind(q),ulEvents:ho,viewDocument:E==null?void 0:E.document,viewWindow:E,tabTitle:document.title,startingQuestionIdx:(C=window.UserLeap.config)==null?void 0:C.startingQuestionIdx,styleNonce:window.UserLeap.styleNonce,previewKey:(j=window.UserLeap)!=null&&j.localStorageAvailable?(O=window.localStorage)==null?void 0:O.getItem(_e.Preview):null},window.UserLeap._config);(Y=window.UserLeap.config)!=null&&Y.startingQuestionIdx&&(window.UserLeap.config={...window.UserLeap.config,startingQuestionIdx:null}),window.UserLeap.customStyles&&(x.customStyles=window.UserLeap.customStyles),E&&(E.__cfg=x);function I(){const G=document.createElement("script");return window.UserLeap.nonce&&G.setAttribute("nonce",window.UserLeap.nonce),G.id=Es,G}const k=window.UserLeap.viewSDKURL?window.UserLeap.viewSDKURL:x.path,L=document.getElementById(Es);L&&L.remove();const T=I(),U=()=>{window.UserLeap.container&&Object.assign(window.UserLeap.container.style,{display:"flex"})};return x.installationMethod===ht.Npm?(Um.configure(x),_&&window.UserLeap.container&&U()):k&&(T.src=k,_&&T.addEventListener("load",()=>{window.UserLeap.container&&U()}),E==null||E.addEventListener("error",G=>{G.target instanceof HTMLScriptElement&&G.target.src===k&&window.UserLeap.reportError("loadFrameScript",new Error("Frame script failed to load"))},{capture:!0,once:!0})),y==null||y.appendChild(T),{success:!0,surveyState:"ready"}};function ng(e){if(window.UserLeap.useMobileStyling!==void 0)return window.UserLeap.useMobileStyling;const t=window.UserLeap.windowDimensions&&window.UserLeap.windowDimensions.width||document.body.clientWidth;return aa(e)||t>10&&t<gf}function aa(e){return zm.includes(e[Ve.Platform])}function rg(e){let t=e.length;for(;t;){const n=Math.floor(Math.random()*t);t-=1;const r=e[t];e[t]=e[n],e[n]=r}}function ig(e){if(!e)return;window.UserLeap._config=e,e.mute&&window.UserLeap._queue.pause();const{interactiveEvents:t,pageUrlEvents:n,dismissOnPageChange:r}=e;t&&rg(t),(t||n||r)&&(tg(),jn())}async function ut(e,t,n=0,r=!1){var o,a;t.headers=Object.assign(Bn(window.UserLeap),t.headers);const i=await He(e,t,n,r);if(i.ok){const s=(o=i.headers)==null?void 0:o.get("Authorization"),l=s?s.split(" "):void 0,u=l&&l.length===2?l[1]:void 0,c=(a=i.headers)==null?void 0:a.get(Ve.VisitorID);u&&c&&(c!==window.UserLeap.visitorId||window.UserLeap.token!==u)&&(ye("token",u),ye("vid",c),q.emit(H.VisitorIDUpdated,{visitorId:c}),window.UserLeap.token=u,window.UserLeap.visitorId=c)}return i.json&&i.json.logMessage&&console.warn(`[Sprig] ${i.json.logMessage}`),i}async function og(e){var t;!((t=e==null?void 0:e.json)!=null&&t.delay)||(window.UserLeap.delayingSurvey=!0,await Cr(e.json.delay),window.UserLeap.delayingSurvey=!1)}const ag=function(e){if(!window.UserLeap)return;const t=async(r={})=>{var h,v,m,w,y;const{userId:i,anonymousId:o,metadata:a={},properties:s,showSurveyCallback:l}=r;let{eventName:u}=r;if(window.UserLeap.debugMode&&u!==fo&&console.info("[DEBUG] Sprig track",r),e.mode==="test")return;const c=window.UserLeap.localStorageAvailable&&(h=localStorage.getItem(_e.Preview))!=null?h:void 0;if(e.requireUserIdForTracking&&!window.UserLeap.userId&&!i){const E="[Sprig] - Skipping tracking without userId";return console.warn(E),{success:!1,message:E,surveyState:"no survey"}}if(!u||u.trim().length===0){u=u?String(u):"";const E="[Sprig] - Invalid event name "+u;return console.warn(E),{success:!1,message:E,surveyState:"no survey"}}const f=window.location.href;if(a.url||(a.url=f),ye("trackStartUrl",f),(m=(v=window.UserLeap)==null?void 0:v._config)!=null&&m.optimizelyEnabled){const E=Bn(window.UserLeap);aa(E)||wr.getAndSetWebOptimizelyExperiments(),a.optimizelyExperiments=Object.assign({},wr.getAllOptimizelyExperiments())}(y=(w=window.UserLeap)==null?void 0:w._config)!=null&&y.launchDarklyEnabled&&(a.launchDarklyFlags=co.getAllLaunchDarklyVariations()),i&&(window.UserLeap.userId=i),o&&(window.UserLeap.partnerAnonymousId=o),s&&(a.eventProperties=s);const d=window.UserLeap.delayingSurvey?await ut(Fe("1",[St],"events/batch"),{body:JSON.stringify({events:[{event:u,metadata:a}],previewKey:c}),method:"POST"},0,!0):await ut(Fe("1",[St],"events"),{body:JSON.stringify({event:u,metadata:a,previewKey:c}),method:"POST"},0,!0);if(!d.ok){const E="[Sprig] (ERR-421) Failed to track event";return d.reportError&&(console.warn(E,d.error),d.error&&window.UserLeap.reportError("track",d.error)),{success:!1,message:E,error:d.error,surveyState:"no survey"}}i&&ye("uid",i),o&&ye("aid",o);const p=d.json;return p.invalidPreviewKey&&window.UserLeap.localStorageAvailable&&localStorage.removeItem(_e.Preview),await og(d),Wm(p.eventId,f)?uc(p,l):{success:!1,message:"Study should not be displayed after page navigation",surveyState:"no survey"}},n={async displaySurvey(r){return console.warn("[Sprig] displaySurvey should only be used to debug your studies; not intended for production usage."),window.UserLeap("dismissActiveSurvey",Be.Override),Ci({surveyId:r},!0)},_previewSurvey(r){window.UserLeap("dismissActiveSurvey",Be.Override),Ci({surveyTemplateId:r},!1)},_reviewSurvey(r){window.UserLeap("dismissActiveSurvey",Be.Override),Ci({surveyId:r},!1)},previewSurvey(r){n._previewSurvey(r)},reviewSurvey(r){n._reviewSurvey(r)},mute(){window.UserLeap._queue.pause()},unmute(){window.UserLeap._queue.unpause()},setVisitorToken(){console.warn("[Sprig] setVisitorToken is deprecated.")},dismissActiveSurvey(r=Be.API){q.emit(H.SurveyWillClose,{name:H.SurveyWillClose,initiator:r})},async setAttribute(r,i){if(!r||!i&&i!==0){const o="[Sprig] - Disregarding empty attribute / value provided";return console.warn(o),{success:!1,message:o}}return this.setAttributes({[r]:i})},async setAttributes(r){if(r==null||Object.keys(r).length===0){const i="[Sprig] - Disregarding empty attributes provided";return console.warn(i),{success:!1,message:i}}return this.identifyAndSetAttributes({attributes:r})},async identifyAndSetAttributes(r){if(window.UserLeap.debugMode&&console.info("[DEBUG] Sprig identifyAndSetAttributes",r),e.mode==="test")return;if(r===null||typeof r!="object"||!(r.userId||r.anonymousId||r.attributes)){const u="[Sprig] - Disregarding empty payload provided";return console.warn(u),{success:!1,message:u}}const{userId:i,anonymousId:o,attributes:a}=r;if(e.requireUserIdForTracking&&!window.UserLeap.userId&&!i){const u="[Sprig] - Skipping tracking without userId";return console.warn(u),{success:!1,message:u}}if(!a&&(!i||window.UserLeap.userId===i)&&(!o||window.UserLeap.partnerAnonymousId===o))return{success:!0};const s={};i&&(s.userId=window.UserLeap.userId=i),o&&(s.partnerAnonymousId=window.UserLeap.partnerAnonymousId=o);let l;return a?(a.email&&!Object.prototype.hasOwnProperty.call(a,mn)&&(a[mn]=a.email,delete a.email),l=await ut(Fe("1",[pt,St],"attributes"),{body:JSON.stringify(a),method:"PUT"}),!l.ok&&l.reportError&&(console.warn("[Sprig] (ERR-432) identifyAndSetAttributes failed",l.error),l.error&&window.UserLeap.reportError("identifyAndSetAttributes",l.error))):l=await ut(Fe("1",[pt,St]),{body:JSON.stringify(s),method:"PUT"}),a&&a[mn]&&(window.UserLeap.email=a[mn]),l.ok&&(i&&ye("uid",i),o&&ye("aid",o)),{success:!!l.ok}},async removeAttributes(r){if(window.UserLeap.debugMode&&console.info("[DEBUG] Sprig removeAttributes",r),e.mode==="test")return;if(r==null||r.length===0){const o="[Sprig] - Disregarding empty attributes provided";return console.warn(o),{success:!1,message:o}}if(e.requireUserIdForTracking&&!window.UserLeap.userId){const o="[Sprig] - Skipping tracking without userId";return console.warn(o),{success:!1,message:o}}const i=await ut(Fe("1",[pt,St],"attributes"),{body:JSON.stringify({delete:r}),method:"DELETE"});return!i.ok&&i.reportError&&(console.warn("[Sprig] (ERR-433) Remove attributes failed",i.error),i.error&&window.UserLeap.reportError("removeAttributes",i.error)),{success:!!i.ok}},async addSurveyListener(r){q.on(H.SurveyLifeCycle,r)},async removeSurveyListener(r){q.removeListener(H.SurveyLifeCycle,r)},async addListener(r,i){q.on(r,i)},async removeListener(r,i){q.removeListener(r,i)},async removeAllListeners(){q.removeAllListeners()},setVisitorAttribute(r,i){return console.warn("[Sprig] setVisitorAttribute is deprecated. Please use setAttribute"),n.setAttribute(r,i)},async setEmail(r){return n.setAttribute(mn,r)},async setVisitorEmail(r){return console.warn("[Sprig] setVisitorEmail is deprecated. Please use setEmail"),n.setEmail(r)},async setUserId(r){if(window.UserLeap.debugMode&&console.info("[DEBUG] Sprig setUserId",r),r==null){const a=`[Sprig] - Invalid userId ${r}`;return console.warn(a),{success:!1,message:a}}if(e.mode==="test"||r===window.UserLeap.userId)return;window.UserLeap.userId=r;const i=window.UserLeap.visitorId,o=await ut(Fe("1",[pt,St]),{body:JSON.stringify({userId:r}),method:"PUT"});if(!o.ok){o.reportError&&(console.warn("[Sprig] (ERR-420) Failed to set user id",o.error),o.error&&window.UserLeap.reportError("setUserId",o.error));return}i!==window.UserLeap.visitorId&&Ha(),ye("uid",r)},async setPartnerAnonymousId(r){if(window.UserLeap.debugMode&&console.info("[DEBUG] Sprig setPartnerAnonymousId",r),r==null){const i=`[Sprig] - Invalid partnerAnonymousId ${r}`;return console.warn(i),{success:!1,message:i}}return window.UserLeap.partnerAnonymousId=r,ye("aid",r),{success:!0}},async track(r,i,o={},a=void 0){return t({eventName:r,properties:i,metadata:o,showSurveyCallback:a})},async identifyAndTrack(r){return await t(r)},applyStyles(r){if(window.UserLeap.customStyles=r,window.UserLeap.container){const i=window.UserLeap.container.children[0].contentDocument;if(i){const o=i.getElementById(R.CustomStyle);o?o.textContent=r:Ks(i,r,window.UserLeap.styleNonce)}}},setWindowDimensions(r,i){var l,u;const o=typeof r=="string"?parseInt(r,10):r,a=typeof i=="string"?parseInt(i,10):i;if(!isNaN(o)&&!isNaN(a)&&(window.UserLeap.windowDimensions={width:o,height:a}),!window.UserLeap.frameId)return;const s=document.getElementById(window.UserLeap.frameId);!s||(window.UserLeap.useMobileStyling&&((l=window.UserLeap.windowDimensions)!=null&&l.width&&(s.style.width=`${window.UserLeap.windowDimensions.width}px`),(u=window.UserLeap.windowDimensions)!=null&&u.height&&(s.style.maxHeight=`${window.UserLeap.windowDimensions.height-20}px`),s.contentDocument&&(s.style.height=String($s(s.contentDocument))+"px")),q.emit(H.SurveyDimensions,{name:H.SurveyDimensions,contentFrameWidth:s.clientWidth,contentFrameHeight:s.clientHeight}))},logoutUser(){window.UserLeap.debugMode&&console.info("[DEBUG] Sprig logout"),window.UserLeap.visitorId=null,window.UserLeap.userId=null,window.UserLeap.partnerAnonymousId=null,window.UserLeap.token=null,window.UserLeap.email=null,window.UserLeap.localStorageAvailable&&(localStorage.removeItem(_e.Credentials),localStorage.removeItem(_e.PageViews)),window.UserLeap._queue.isPaused()&&window.UserLeap._queue.empty(),lc(),Ha(),window.UserLeap._queue.unpause()},teardown(){Zm(),window.UserLeap("dismissActiveSurvey",Be.API),delete window.UserLeap,delete window.Sprig,delete window._Sprig},integrateOptimizely(r,i=!0){var o,a;if(!((a=(o=window.UserLeap)==null?void 0:o._config)!=null&&a.optimizelyEnabled)){console.warn("[SPRIG] Optimizely integration is currently not enabled for your product.");return}try{const s=typeof r=="string"?JSON.parse(r):r;wr.setOptimizelyExperiment(s,i)}catch(s){console.warn("[Sprig] Error with integrating Optimizely data"),s instanceof Error&&window.UserLeap.reportError("integrateOptimizely",s)}},integrateOptimizelyClient(r){var o,a;if(!((a=(o=window.UserLeap)==null?void 0:o._config)!=null&&a.optimizelyEnabled)){console.warn("[SPRIG] Optimizely integration is currently not enabled for your product.");return}const i=({experiment:s,variation:l})=>{const u={experiments:[{id:s.id,variation:l.key}]};window.UserLeap("integrateOptimizely",u,!1)};r.notificationCenter.addNotificationListener(df.NOTIFICATION_TYPES.ACTIVATE,i)},importLaunchDarklyData(r){var i,o;if(!((o=(i=window.UserLeap)==null?void 0:i._config)!=null&&o.launchDarklyEnabled)){console.warn("[SPRIG] LaunchDarkly integration is currently not enabled for your product.");return}co.setLDFlagsVariations(r)}};Object.assign(window.UserLeap,n)};async function sg(e){const t=Bn(window.UserLeap);let n=await He(Fe("1",[pt],"config"),{headers:t});const r="TypeError";if(window.UserLeap.error=n.error,!n.ok&&n.error&&n.error.name===r&&(window.UserLeap._API_URL="https://api.sprig.com",window.UserLeap.reportError("sprigDomainRequest",n.error),n=await He(Fe("1",[pt],"config"),{headers:t})),!n.ok)return n.reportError&&(console.warn("[Sprig] (ERR-422) Failed to load configuration",n.error),n.error&&window.UserLeap.reportError("applyRemoteConfig",n.error)),Ri("Disabled: failed to fetch configuration"),e;const i=n.json;return i!=null&&i.disabled?(Ri(`Disabled: ${i.disabled}`),{disabled:i.disabled}):Object.assign({},i,e)}async function lg(e,t,n={}){const r=window.__cfg&&window.__cfg.mode,i=oa(),o=window.UserLeap.envId,a=window.document.documentElement,s={mode:r,screenWidth:window.screen.width,screenHeight:window.screen.height,clientWidth:a.clientWidth,clientHeight:a.clientHeight,location:window.location.href,language:window.navigator.language,...n},l={action:e,err:{message:t.message,stack:t.stack},meta:s,vid:i,envId:o};(await ut(Fe("1",null,"errors"),{method:"POST",headers:{[Ve.Error]:window.btoa(`userleap-${Date.now()}-error`)},body:JSON.stringify(l)},0,!0)).ok||console.warn("[Sprig] (ERR-444) Failed to report error to API",t)}function ug(e={}){const t=new URLSearchParams(window.location.search).get("sprigPreviewKey"),n=Jm();window.UserLeap.localStorageAvailable=n,n&&t&&localStorage.setItem(_e.Preview,t),window.UserLeap.UPDATES=ho;async function r(){if(window.UserLeap.loaded)return;if(window.UserLeap.reportError=lg,window.UserLeap.loaded=!0,window.UserLeap._config=Object.assign({},e,window.UserLeap.config),window.UserLeap.delayingSurvey=!1,window.UserLeap._config&&typeof window.UserLeap._config=="object")for(const l in window.UserLeap._config)window.UserLeap[l]=window.UserLeap._config[l];if(!window.UserLeap.envId)if(window.UserLeap.appId)window.UserLeap.envId=window.UserLeap.appId;else throw new Error("Missing Environment id");window.UserLeap.debugMode&&console.info("[DEBUG] Sprig debug mode enabled");const i=window.UserLeap.sampleRate;if(i)if(!n)window.UserLeap.debugMode&&console.info("[DEBUG] Sprig cannot sample users without localStorage permissions");else{let l=Ct("sampled");if(l===null&&(l=Math.random()<i,ye("sampled",l)),!l)return}else n&&Ct("sampled")!==null&&ye("sampled",null);window.UserLeap._API_URL||(window.UserLeap._API_URL="https://api.sprig.com");const o=[...window.UserLeap._queue];window.UserLeap._queue=new $m(window.UserLeap,[]),window.UserLeap._queue.pause();for(let l=0;l<o.length;l++)window.UserLeap._queue.push(o[l]);const a=Ct("token");a?(window.UserLeap.token=a,window.UserLeap.visitorId=Ct("vid"),window.UserLeap.userId=Ct("uid"),window.UserLeap.partnerAnonymousId=Ct("aid")):(window.UserLeap.localStorageAvailable&&localStorage.removeItem(_e.Credentials),lc());const s=await sg(e);Ch(window.document,s.maxReplayDurationSeconds,window.UserLeap.replayNonce,window.UserLeap.maxInflightReplayRequests,s.replaySettings),ag(s),await ig(s),window.UserLeap._queue.unpause(),q.emit(H.SDKReady),q.emit(H.VisitorIDUpdated,{visitorId:window.UserLeap.visitorId})}document.readyState==="complete"?r():window.attachEvent?window.attachEvent("onload",r):window.addEventListener("load",r,!1)}class Fr{constructor(){ce(this,"UPDATES",ho)}displaySurvey(t){window.Sprig("displaySurvey",t)}mute(){window.Sprig("mute")}unmute(){window.Sprig("unmute")}dismissActiveSurvey(){window.Sprig("dismissActiveSurvey")}setAttribute(t,n){window.Sprig("setAttribute",t,n)}setAttributes(t){window.Sprig("setAttributes",t)}identifyAndSetAttributes(t){window.Sprig("identifyAndSetAttributes",t)}removeAttributes(t){window.Sprig("removeAttributes",t)}addListener(t,n){window.Sprig("addListener",t,n)}removeListener(t,n){window.Sprig("removeListener",t,n)}removeAllListeners(){window.Sprig("removeAllListeners")}setEmail(t){window.Sprig("setAttribute","!email",t)}setUserId(t){window.Sprig("setUserId",t)}setPartnerAnonymousId(t){window.Sprig("setPartnerAnonymousId",t)}track(t,n={},r={}){window.Sprig("track",t,n,r)}identifyAndTrack(t){window.Sprig("identifyAndTrack",t)}applyStyles(t){window.Sprig("applyStyles",t)}setWindowDimensions(t,n){window.Sprig("setWindowDimensions",t,n)}logoutUser(){window.Sprig("logoutUser")}teardown(){window.Sprig("teardown")}}const po={configure:e=>{if(!e.envId&&!e.environmentId)throw new Error("Initialization Error: Sprig configure requires an environmentId");if(e.envId||(e.envId=e.environmentId||""),e.installationMethod=ht.Npm,window.Sprig)return window.Sprig;window.Sprig=function(){window.Sprig._queue.push(arguments)},Object.getOwnPropertyNames(Fr.prototype).map(n=>{n!=="constructor"&&(window.Sprig[n]=Fr.prototype[n])});const t=window.Sprig;return t.appId=e.envId,t._queue=[],window.UserLeap=t,ug(e),window.Sprig}},cg={sprig:po,SprigAPI:Fr,configure:po.configure};exports.DismissReason=Be;exports.SprigAPI=Fr;exports.SprigEvent=H;exports.default=cg;exports.sprig=po;
704
+ `,Rm=(e,t)=>{const n=[...e],r=new Set([N.VideoVoice,N.RecordedTask]);return e.some(i=>r.has(i.type))&&n.push({name:-2,props:{routingOptions:[]},type:N.Uploading}),t&&n.push({name:-1,props:{routingOptions:[]},type:N.Thanks}),n},Am=({mode:e=null,viewWindow:t,viewDocument:n})=>{const r=n.documentElement;return{mode:e,sw:t.screen.width,sh:t.screen.height,cw:r.clientWidth,ch:r.clientHeight,p:t.location.href,l:t.navigator.language}};function Om(e,t=!0){var b;const{answers:n,apiURL:r,customStyles:i,endCard:o,eventEmitFn:a,fontFamilyURL:s,frame:l,previewKey:u,UpChunk:c,viewDocument:f,viewWindow:d}=e,p=zt(e.headers)?e.frame:f.body,h=q,v=Rm(e.cards,!!o);gr.configure(h,{cards:v,hasEndCard:!!o,apiURL:r,UpChunk:c}),J.setState({apiURL:r,answers:n,border:e.border,index:e.startingQuestionIdx||0,cards:v,configureExitOnOverlayClick:e.configureExitOnOverlayClick,customMetadata:e.customMetadata,endCard:e.endCard,envId:e.envId,eventEmitFn:a,fontFamily:e.fontFamily,frame:l,headers:e.headers,hasViewedEmbed:!1,isPreview:e.isPreview,marketingUrl:"https://sprig.com",meta:Am({mode:e.mode,viewWindow:d,viewDocument:f}),mode:e.mode,previewKey:u,recorder:gr,recorderEventEmitter:h,responseGroupUid:e.responseGroupUid,showStripes:e.showStripes,showSurveyBrand:e.showSurveyBrand,slugName:e.slugName,styleNonce:e.styleNonce,surveyId:e.surveyId,tabTitle:e.tabTitle,uploadingCardViewed:!1,uploadProgress:{},useMobileStyling:e.useMobileStyling,useDesktopPrototype:e.useDesktopPrototype,userId:e.userId,viewDocument:e.viewDocument,visitorAttributes:e.visitorAttributes,viewedCardCount:e.startingQuestionIdx||0});const{seen:m}=J.getState();m();const{head:w}=f,y=f.createElement("style");if(y.id="sprig-style",y.textContent=Lm,y.nonce=e.styleNonce,w.appendChild(y),e.fontFamily&&s&&parent){const S=f.createElement("link");S.rel="stylesheet",S.href=s,w.appendChild(S)}if(e.customStyles&&Ks(f,i,e.styleNonce),!c)if(e.installationMethod!==ht.Npm){const S=f.createElement("script");S.src="https://cdn.sprig.com/userleap-web-upchunk-v2.2.2.js",S.onload=()=>{gr.setUpChunk(d.UpChunk)},S.onerror=()=>{console.warn("[Sprig] - recording functionality not configured due to UpChunk library load failure")},w.appendChild(S)}else console.warn("[Sprig] - recording functionality not configured due to missing UpChunk dependency");const E="2.23.4",_=a||((b=l.eventEmitter)==null?void 0:b.emit);_==null||_(Ie.VerifyViewVersion,{[Lt.ViewVersion]:E}),p&&t&&nn(g(Tm,{}),p)}const Um={configure:Om};window.UserLeap&&window.Sprig&&(window.Sprig._gtm?window.Sprig=window.UserLeap:window.UserLeap=window.Sprig);window.UserLeap||(window.UserLeap=window.Sprig);window.Sprig||(window.Sprig=window.UserLeap);const Dm="rgba(255,255,255, 0.95)",Pm="rgba(0,0,0,0.9)",Nm="360px",Si="0px",rc=()=>{window.UserLeap.container=document.createElement("div"),window.UserLeap.container.className="ul-container",document.body.appendChild(window.UserLeap.container)},ic=e=>{const t=window.UserLeap.container;if(!!t)try{document.body.removeChild(t),window.UserLeap.container=null,ye("trackStartUrl",null),q.emit(H.SurveyLifeCycle,{state:"dismissed"}),q.emit(H.SurveyClosed,{name:H.SurveyClosed,initiator:e})}catch(n){console.warn(`[Sprig] (ERR-412) Error removing UserLeap container by ${e} `+t),n instanceof Error&&window.UserLeap.reportError("dismissActiveSurvey",n)}},oc=()=>{q.on(H.SurveyWillClose,({initiator:e})=>{ic(e)})},Mm=(e,t)=>{const r={...{position:"fixed",overflow:"auto",top:"0px",left:"0px",display:"none",height:"100%",width:"100%",transition:"background-color 0.3s ease-out",zIndex:2147483646}},i=t?e.overlayStyleMobile:e.overlayStyle;r["background-color"]=i==="light"?Dm:Pm,t||(r.margin="auto"),window.UserLeap.container&&Object.assign(window.UserLeap.container.style,r)},jm=(e,t,n)=>{var s,l;const r={position:"fixed",bottom:"0px",right:Si,border:0,backgroundColor:"rgba(0,0,0,0)",zIndex:2147483646},i=Object.assign({},t,window.UserLeap);let o,a=!1;return n?((s=window.UserLeap.windowDimensions)!=null&&s.width?r.width=`${window.UserLeap.windowDimensions.width}px`:r.width="100%",(l=window.UserLeap.windowDimensions)!=null&&l.height?r.maxHeight=`${window.UserLeap.windowDimensions.height-20}px`:window.UserLeap.maxHeight?r.maxHeight=window.UserLeap.maxHeight:r.maxHeight=`${document.body.clientHeight-20}px`,["light","dark"].includes(i.overlayStyleMobile)&&(a=!0)):(r.width=Nm,r.maxHeight=window.UserLeap.maxHeight||"66vh",i.framePosition===yn.BottomLeft?o={left:Si}:i.framePosition===yn.TopLeft?o={left:Si,top:"0px"}:i.framePosition===yn.TopRight?o={top:"0px"}:i.framePosition===yn.Center&&(a=!0,o={margin:"auto",position:"static"},r.maxHeight=null)),a&&Mm(i,n),Object.assign(e.style,r,o),a},Vm=(e,t)=>{var s,l;const n="ul-frame";rc();const r=document.createElement("iframe");r.id=n,r.setAttribute("title","Sprig User Feedback Dialog");const i=jm(r,e,t);q.on(H.SurveyFadingOut,()=>{window.UserLeap.container&&Object.assign(window.UserLeap.container.style,{"background-color":"rgba(0,0,0,0)"})}),oc(),r.setHeight=u=>{parseInt(r.style.height)!=u&&(r.style.height=`${u}px`,q.emit(H.SurveyHeight,{name:H.SurveyHeight,contentFrameHeight:u}))},(s=window.UserLeap.container)==null||s.appendChild(r),e&&(t?e.exitOnOverlayClickMobile:e.exitOnOverlayClick)&&window.UserLeap.container&&(window.UserLeap.container.onclick=()=>{q.emit(H.CloseSurveyOnOverlayClick)}),q.emit(H.SurveyLifeCycle,{state:"presented"}),q.emit(H.SurveyPresented,{name:H.SurveyPresented});const o=(l=r.contentWindow)==null?void 0:l.document;o&&(o.open("text/html","replace"),o.write("<!doctype html><head></head><body></body></html>"),o.close());const a=o==null?void 0:o.head;return{frameId:n,contentWinDocHead:a,contentWindow:r.contentWindow,hasOverlay:i,iframe:r}},Fm="!launch_darkly_";class Bm{constructor(){ce(this,"_ldData",{})}getAllLaunchDarklyVariations(){return this._ldData}setLDFlagsVariations(t){try{return!t||typeof t!="object"||Array.isArray(t)?!1:(Object.keys(this._ldData).forEach(n=>{delete this._ldData[n]}),Object.keys(t).forEach(n=>this._ldData[`${Fm}${n}`]=t[n]+1),!0)}catch(n){return n instanceof Error&&window.UserLeap.reportError("setAllLDFlagsVariations",n),console.warn("[Sprig] An issue had occured when setting LaunchDarkly flags and variations."),!1}}}const co=new Bm;Object.freeze(co);const Hm="!optimizely_experiments_";class Km{constructor(){ce(this,"_optimizelyData",{})}setOptimizelyExperiment(t,n=!0){if(!t||typeof t!="object")return!1;const{experiments:r}=t;try{return n&&Object.keys(this._optimizelyData).map(i=>{delete this._optimizelyData[i]}),r&&r.map(i=>{const{id:o,variation:a}=i,s=this.transformExperimentId(o);a&&typeof a=="string"&&(this._optimizelyData[s]=a)}),!0}catch(i){return i instanceof Error&&window.UserLeap.reportError("setOptimizelyExperiment",i),!1}}getAllOptimizelyExperiments(){return this._optimizelyData}getOptimizelyVariationName(t){return this._optimizelyData[this.transformExperimentId(t)]}transformExperimentId(t){return Hm+t}getAndSetWebOptimizelyExperiments(){var t;try{if(window&&window.optimizely&&typeof window.optimizely.get=="function"){const n=(t=window.optimizely.get("state"))==null?void 0:t.getExperimentStates({isActive:!0});if(n){const r=Object.keys(n).map(i=>{var o,a;return(o=n[i].variation)!=null&&o.name?{id:i,variation:(a=n[i].variation)==null?void 0:a.name}:{id:i,variation:"Original"}});return this.setOptimizelyExperiment({experiments:r},!1),!0}return!1}return!1}catch(n){return n instanceof Error&&window.UserLeap.reportError("getAndSetWebOptimizely",n),!1}}}const wr=new Km;Object.freeze(wr);class $m{constructor(t,n){ce(this,"paused");ce(this,"queue");ce(this,"ul");this.ul=t,this.paused=!1,this.queue=[],this.flush(n)}flush(t){const n=t.length;if(n)for(let r=0;r<n;r++)this.push(t[r])}isPaused(){return this.paused}pause(){this.paused=!0}unpause(){this.paused=!1;const t=this.queue.slice();this.empty(),this.flush(t)}push(t){if(this.paused)this.queue.push(t);else if(t instanceof Function)t();else{const n=Array.prototype.slice.call(t,1),r=t[0],i=this.ul[r];i instanceof Function?i.apply(this.ul,n):r&&console.warn("[Sprig] (ERR-100) No valid UserLeap action called",r)}}perform(t){if(this.paused){let n=()=>{};const r=new Promise(function(i){n=function(){i(t())}});return this.queue.push(n),r}else return t()}empty(){this.queue.length=0}}const Gm=["popState","pushState","replaceState"],qm={test:"test"},mn="!email",zm=["ios","android"],pt="environments",fo="pageUrl",St="visitors",Es="ul-view-sdk-script",xs=Object.freeze({contains:(e,t)=>t.includes(e),notContains:(e,t)=>!t.includes(e),exactly:(e,t)=>t===e,notExactly:(e,t)=>t!==e,startsWith:(e,t)=>t.startsWith(e),endsWith:(e,t)=>t.endsWith(e),regex:(e,t)=>new RegExp(e).test(t),legacy:(e,t)=>new RegExp(e,"i").test(t)});function ia(e,t){const{matchType:n,pattern:r}=e,i=n?xs[n]:xs.legacy;let o=!1;try{o=i(r,t)}catch(a){const s=`[Sprig] (ERR-445) Failed to check url match with pattern ${r}`;a instanceof Error&&(console.warn(s,a),a.stack=JSON.stringify(e),window.UserLeap.reportError(s,a))}return o}function Wm(e,t){const{pageUrlEvents:n,interactiveEvents:r,dismissOnPageChange:i}=window.UserLeap._config;if(!i)return!0;const o=[];n&&n.length&&o.push(...n),r&&r.length&&o.push(...r);const a=e&&o.find(s=>s.id===e);return a?ia(a,window.location.href):t===window.location.href}function jn(e){const{pageUrlEvents:t,interactiveEvents:n,dismissOnPageChange:r,platform:i}=window.UserLeap._config;if(i&&i!==Pt.Web)return;const o=Ct("trackStartUrl"),a=o?String(o):null;t&&eg(window.location.href),n&&(sc(),Ym()),r&&a&&a!==window.location.href&&e&&Gm.includes(e.type)&&window.UserLeap("dismissActiveSurvey",Be.PageChange)}const ac={capture:!0},Ym=()=>{const t=window.UserLeap._config.interactiveEvents.filter(r=>ia(r,window.location.href)).map(r=>{const{name:i,properties:o}=r,{selector:a,innerText:s}=o;return a?l=>{if(Xt(l.target))try{l.target.closest(a)&&window.UserLeap("track",i)}catch{}return!1}:l=>(Xt(l.target)&&l.target.innerText===s&&window.UserLeap("track",i),!1)}),n=r=>t.forEach(i=>i(r));window.UserLeap._config.interactiveEventsHandler=n,window.addEventListener("click",n,ac)},sc=()=>{window.UserLeap._config.interactiveEventsHandler&&window.removeEventListener("click",window.UserLeap._config.interactiveEventsHandler,ac),delete window.UserLeap._config.interactiveEventsHandler};function Qm(){["hashchange","popstate"].forEach(e=>window.addEventListener(e,jn,!0))}function Zm(){["hashchange","popstate"].forEach(e=>window.removeEventListener(e,jn,!0)),window.UserLeap._config.interactiveEvents&&sc()}function Fe(e,t,n){const r=[window.UserLeap._API_URL,"sdk",e];return t&&t.forEach(i=>{r.push(i),i===pt?r.push(window.UserLeap.envId):i===St&&r.push(oa())}),n&&r.push(n),r.join("/")}function Xm(e,t){let n=Fe("1",[pt],"questions?");return e!=null&&(n+=`&vid=${e}`),t&&(t.surveyId&&(n+=`&surveyid=${t.surveyId}`),t.surveyTemplateId&&(n+=`&surveytemplateid=${t.surveyTemplateId}`)),n}function Jm(){try{if(typeof localStorage<"u"&&(localStorage.setItem("is_available","yes"),localStorage.getItem("is_available")==="yes"))return localStorage.removeItem("is_available"),!0}catch{return!1}return!1}function Ct(e){if(!window.UserLeap.localStorageAvailable)return null;const t=localStorage.getItem(_e.Credentials);if(t)try{const r=JSON.parse(t)[window.UserLeap.envId];return r&&r[e]||null}catch(n){n instanceof Error&&(n.stack=t,window.UserLeap.reportError("Failed to parse local storage credentials",n)),console.warn("[Sprig] (ERR-427) Failed to lookup saved ids",n)}return null}function ye(e,t){if(!window.UserLeap.localStorageAvailable)return;const n=localStorage.getItem(_e.Credentials);let r={};if(n)try{r=JSON.parse(n)}catch(o){o instanceof Error&&(o.stack=n,window.UserLeap.reportError("Failed to parse local storage credentials",o)),console.warn("[Sprig] (ERR-427) Failed to lookup saved ids",o)}let i=r[window.UserLeap.envId];i?i[e]=t:i={[e]:t},r[window.UserLeap.envId]=i;try{localStorage.setItem(_e.Credentials,JSON.stringify(r))}catch(o){o instanceof Error&&console.warn(`[Sprig] (ERR-426) Unable to write to Local Storage:: ${o.message}`)}}function lc(){window.previewMode||(window.UserLeap.visitorId=vt(),ye("vid",window.UserLeap.visitorId),q.emit(H.VisitorIDUpdated,{visitorId:window.UserLeap.visitorId}))}function oa(){return window.previewMode?"0":window.UserLeap.visitorId||""}function eg(e){if(!window.UserLeap.localStorageAvailable||e.endsWith("mock_snippet.html"))return;const t=window.UserLeap._config.pageUrlEvents;if(t&&t.length){let s=!1;for(let l=0;l<t.length&&(s=ia(t[l],e),!s);l++);if(!s)return}window.UserLeap.debugMode&&console.info("[DEBUG] Sprig trackPageView",e);const n=10,r=1;let i=[];const o={viewedAt:Date.now(),location:e},a=localStorage.getItem(_e.PageViews);try{if(i=a?JSON.parse(a):[],Array.isArray(i)||(i=[]),i.length>0){const s=i[i.length-1],l=(Date.now()-s.viewedAt)/1e3;(s.location!=e&&l>r||l>n)&&(window.UserLeap._queue.push(["track",fo,null,{url:e}]),i.push(o))}else window.UserLeap._queue.push(["track",fo,null,{url:e}]),i.push(o);i.length>5&&i.splice(0,i.length-5);try{localStorage.setItem(_e.PageViews,JSON.stringify(i))}catch(s){s instanceof Error&&console.warn(`[Sprig] Unable to write to Local Storage: ${s.message}`)}}catch(s){s instanceof Error&&(s.stack=a||"",window.UserLeap.reportError("trackPageView",s)),console.warn("[Sprig] (ERR-425) Failed to update page views in local storage")}}function tg(){const e="Backbone"in window&&window.Backbone&&window.Backbone.history?window.Backbone.history:window.history;"pushState"in e&&(e.pushState=(t=>function(...r){const i=t.apply(this,r),o=new Event("pushState");return window.dispatchEvent(o),jn(o),i})(e.pushState)),"replaceState"in e&&(e.replaceState=(t=>function(...r){const i=t.apply(this,r),o=new Event("replaceState");return window.dispatchEvent(o),jn(o),i})(e.replaceState)),Qm()}async function Ci(e,t){const n=oa();e&&!t&&(window.UserLeap._config.mode=qm.test);const r=await ut(Xm(n,e),{},0,!0);return r.ok?(r.json.delay&&await Cr(r.json.delay),uc(r.json)):(r.reportError&&r.error&&(console.warn("[Sprig] (ERR-414) Failed to request questions from the server",r.error),window.UserLeap.reportError("getQuestions",r.error)),{success:!1,surveyState:"no survey"})}const uc=async(e,t)=>{var C,j,O,Y;const{context:n,endCard:r,locale:i,productConfig:o,questions:a,responseGroupUid:s,surveyId:l,uuid:u,vid:c,sessionReplay:f}=e,d=Bn(window.UserLeap),p=aa(d),h=ng(d);if(f&&Dl({responseGroupId:s,surveyId:l,visitorId:c,replayParams:f,completeUploadHeaders:d,apiUrl:window.UserLeap._API_URL}),c==null||!a||!a.length)return{success:!1,message:"[Sprig] no survey found",surveyState:"no survey"};if(window.UserLeap.container){const G="[Sprig] (ERR-409) Found an existing Survey container, aborting rendering of this survey";return console.warn(G),{success:!1,message:G,surveyState:"no survey"}}if(c!==window.UserLeap.visitorId&&u!==window.UserLeap.visitorId&&!window.previewMode){const G="Attempted to display survey to a different visitor";return window.UserLeap.reportError("DisplaySurvey",new Error(G)),{success:!1,message:G,surveyState:"no survey"}}if(!(t?await t(l):!0))return{success:!1,message:"[Sprig] Callback returned false, aborting rendering of survey",surveyState:"no survey"};Li.disable(),q.emit(H.SurveyWillPresent,{name:H.SurveyWillPresent,[Ss.SurveyId]:l});let m,w=document.createElement("div"),y,E,_;const b=G=>{const{[Lt.ViewVersion]:he}=G;he!==d["x-ul-sdk-version"]&&ic(),q.removeListener(Ie.VerifyViewVersion,b)};q.on(Ie.VerifyViewVersion,b),zt(d)?(m="ul-direct-embeded-frame",y=document.head,E=window,_=!1,p&&(rc(),w.id=m,window.UserLeap.container.appendChild(w),oc(),q.emit(H.SurveyLifeCycle,{state:"presented"}),q.emit(H.SurveyPresented,{name:H.SurveyPresented}))):{frameId:m,contentWinDocHead:y,contentWindow:E,hasOverlay:_,iframe:w}=Vm(o,h),window.UserLeap.frameId=m,window.UserLeap.useMobileStyling=h;const S=G=>{q.on(H.CloseSurveyOnOverlayClick,G)},x=Object.assign({frame:w,envId:window.UserLeap.envId,surveyId:l,userId:u,visitorAttributes:{externalUserId:window.UserLeap.userId,email:window.UserLeap.email},cards:a,context:n,locale:i,fontFamily:window.UserLeap.fontFamily,fontFamilyURL:window.UserLeap.fontFamilyURL,apiURL:window.UserLeap._API_URL,responseGroupUid:s,headers:d,endCard:r,useMobileStyling:h,mobileSDKVersion:window.UserLeap.mobileSDKVersion,configureExitOnOverlayClick:S,eventEmitFn:q.emit.bind(q),ulEvents:ho,viewDocument:E==null?void 0:E.document,viewWindow:E,tabTitle:document.title,startingQuestionIdx:(C=window.UserLeap.config)==null?void 0:C.startingQuestionIdx,styleNonce:window.UserLeap.styleNonce,previewKey:(j=window.UserLeap)!=null&&j.localStorageAvailable?(O=window.localStorage)==null?void 0:O.getItem(_e.Preview):null},window.UserLeap._config);(Y=window.UserLeap.config)!=null&&Y.startingQuestionIdx&&(window.UserLeap.config={...window.UserLeap.config,startingQuestionIdx:null}),window.UserLeap.customStyles&&(x.customStyles=window.UserLeap.customStyles),E&&(E.__cfg=x);function I(){const G=document.createElement("script");return window.UserLeap.nonce&&G.setAttribute("nonce",window.UserLeap.nonce),G.id=Es,G}const k=window.UserLeap.viewSDKURL?window.UserLeap.viewSDKURL:x.path,L=document.getElementById(Es);L&&L.remove();const T=I(),U=()=>{window.UserLeap.container&&Object.assign(window.UserLeap.container.style,{display:"flex"})};return x.installationMethod===ht.Npm?(Um.configure(x),_&&window.UserLeap.container&&U()):k&&(T.src=k,_&&T.addEventListener("load",()=>{window.UserLeap.container&&U()}),E==null||E.addEventListener("error",G=>{G.target instanceof HTMLScriptElement&&G.target.src===k&&window.UserLeap.reportError("loadFrameScript",new Error("Frame script failed to load"))},{capture:!0,once:!0})),y==null||y.appendChild(T),{success:!0,surveyState:"ready"}};function ng(e){if(window.UserLeap.useMobileStyling!==void 0)return window.UserLeap.useMobileStyling;const t=window.UserLeap.windowDimensions&&window.UserLeap.windowDimensions.width||document.body.clientWidth;return aa(e)||t>10&&t<gf}function aa(e){return zm.includes(e[Ve.Platform])}function rg(e){let t=e.length;for(;t;){const n=Math.floor(Math.random()*t);t-=1;const r=e[t];e[t]=e[n],e[n]=r}}function ig(e){if(!e)return;window.UserLeap._config=e,e.mute&&window.UserLeap._queue.pause();const{interactiveEvents:t,pageUrlEvents:n,dismissOnPageChange:r}=e;t&&rg(t),(t||n||r)&&(tg(),jn())}async function ut(e,t,n=0,r=!1){var o,a;t.headers=Object.assign(Bn(window.UserLeap),t.headers);const i=await He(e,t,n,r);if(i.ok){const s=(o=i.headers)==null?void 0:o.get("Authorization"),l=s?s.split(" "):void 0,u=l&&l.length===2?l[1]:void 0,c=(a=i.headers)==null?void 0:a.get(Ve.VisitorID);u&&c&&(c!==window.UserLeap.visitorId||window.UserLeap.token!==u)&&(ye("token",u),ye("vid",c),q.emit(H.VisitorIDUpdated,{visitorId:c}),window.UserLeap.token=u,window.UserLeap.visitorId=c)}return i.json&&i.json.logMessage&&console.warn(`[Sprig] ${i.json.logMessage}`),i}async function og(e){var t;!((t=e==null?void 0:e.json)!=null&&t.delay)||(window.UserLeap.delayingSurvey=!0,await Cr(e.json.delay),window.UserLeap.delayingSurvey=!1)}const ag=function(e){if(!window.UserLeap)return;const t=async(r={})=>{var h,v,m,w,y;const{userId:i,anonymousId:o,metadata:a={},properties:s,showSurveyCallback:l}=r;let{eventName:u}=r;if(window.UserLeap.debugMode&&u!==fo&&console.info("[DEBUG] Sprig track",r),e.mode==="test")return;const c=window.UserLeap.localStorageAvailable&&(h=localStorage.getItem(_e.Preview))!=null?h:void 0;if(e.requireUserIdForTracking&&!window.UserLeap.userId&&!i){const E="[Sprig] - Skipping tracking without userId";return console.warn(E),{success:!1,message:E,surveyState:"no survey"}}if(!u||u.trim().length===0){u=u?String(u):"";const E="[Sprig] - Invalid event name "+u;return console.warn(E),{success:!1,message:E,surveyState:"no survey"}}const f=window.location.href;if(a.url||(a.url=f),ye("trackStartUrl",f),(m=(v=window.UserLeap)==null?void 0:v._config)!=null&&m.optimizelyEnabled){const E=Bn(window.UserLeap);aa(E)||wr.getAndSetWebOptimizelyExperiments(),a.optimizelyExperiments=Object.assign({},wr.getAllOptimizelyExperiments())}(y=(w=window.UserLeap)==null?void 0:w._config)!=null&&y.launchDarklyEnabled&&(a.launchDarklyFlags=co.getAllLaunchDarklyVariations()),i&&(window.UserLeap.userId=i),o&&(window.UserLeap.partnerAnonymousId=o),s&&(a.eventProperties=s);const d=window.UserLeap.delayingSurvey?await ut(Fe("1",[St],"events/batch"),{body:JSON.stringify({events:[{event:u,metadata:a}],previewKey:c}),method:"POST"},0,!0):await ut(Fe("1",[St],"events"),{body:JSON.stringify({event:u,metadata:a,previewKey:c}),method:"POST"},0,!0);if(!d.ok){const E="[Sprig] (ERR-421) Failed to track event";return d.reportError&&(console.warn(E,d.error),d.error&&window.UserLeap.reportError("track",d.error)),{success:!1,message:E,error:d.error,surveyState:"no survey"}}i&&ye("uid",i),o&&ye("aid",o);const p=d.json;return p.invalidPreviewKey&&window.UserLeap.localStorageAvailable&&localStorage.removeItem(_e.Preview),await og(d),Wm(p.eventId,f)?uc(p,l):{success:!1,message:"Study should not be displayed after page navigation",surveyState:"no survey"}},n={async displaySurvey(r){return console.warn("[Sprig] displaySurvey should only be used to debug your studies; not intended for production usage."),window.UserLeap("dismissActiveSurvey",Be.Override),Ci({surveyId:r},!0)},_previewSurvey(r){window.UserLeap("dismissActiveSurvey",Be.Override),Ci({surveyTemplateId:r},!1)},_reviewSurvey(r){window.UserLeap("dismissActiveSurvey",Be.Override),Ci({surveyId:r},!1)},previewSurvey(r){n._previewSurvey(r)},reviewSurvey(r){n._reviewSurvey(r)},mute(){window.UserLeap._queue.pause()},unmute(){window.UserLeap._queue.unpause()},setVisitorToken(){console.warn("[Sprig] setVisitorToken is deprecated.")},dismissActiveSurvey(r=Be.API){q.emit(H.SurveyWillClose,{name:H.SurveyWillClose,initiator:r})},async setAttribute(r,i){if(!r||!i&&i!==0){const o="[Sprig] - Disregarding empty attribute / value provided";return console.warn(o),{success:!1,message:o}}return this.setAttributes({[r]:i})},async setAttributes(r){if(r==null||Object.keys(r).length===0){const i="[Sprig] - Disregarding empty attributes provided";return console.warn(i),{success:!1,message:i}}return this.identifyAndSetAttributes({attributes:r})},async identifyAndSetAttributes(r){if(window.UserLeap.debugMode&&console.info("[DEBUG] Sprig identifyAndSetAttributes",r),e.mode==="test")return;if(r===null||typeof r!="object"||!(r.userId||r.anonymousId||r.attributes)){const u="[Sprig] - Disregarding empty payload provided";return console.warn(u),{success:!1,message:u}}const{userId:i,anonymousId:o,attributes:a}=r;if(e.requireUserIdForTracking&&!window.UserLeap.userId&&!i){const u="[Sprig] - Skipping tracking without userId";return console.warn(u),{success:!1,message:u}}if(!a&&(!i||window.UserLeap.userId===i)&&(!o||window.UserLeap.partnerAnonymousId===o))return{success:!0};const s={};i&&(s.userId=window.UserLeap.userId=i),o&&(s.partnerAnonymousId=window.UserLeap.partnerAnonymousId=o);let l;return a?(a.email&&!Object.prototype.hasOwnProperty.call(a,mn)&&(a[mn]=a.email,delete a.email),l=await ut(Fe("1",[pt,St],"attributes"),{body:JSON.stringify(a),method:"PUT"}),!l.ok&&l.reportError&&(console.warn("[Sprig] (ERR-432) identifyAndSetAttributes failed",l.error),l.error&&window.UserLeap.reportError("identifyAndSetAttributes",l.error))):l=await ut(Fe("1",[pt,St]),{body:JSON.stringify(s),method:"PUT"}),a&&a[mn]&&(window.UserLeap.email=a[mn]),l.ok&&(i&&ye("uid",i),o&&ye("aid",o)),{success:!!l.ok}},async removeAttributes(r){if(window.UserLeap.debugMode&&console.info("[DEBUG] Sprig removeAttributes",r),e.mode==="test")return;if(r==null||r.length===0){const o="[Sprig] - Disregarding empty attributes provided";return console.warn(o),{success:!1,message:o}}if(e.requireUserIdForTracking&&!window.UserLeap.userId){const o="[Sprig] - Skipping tracking without userId";return console.warn(o),{success:!1,message:o}}const i=await ut(Fe("1",[pt,St],"attributes"),{body:JSON.stringify({delete:r}),method:"DELETE"});return!i.ok&&i.reportError&&(console.warn("[Sprig] (ERR-433) Remove attributes failed",i.error),i.error&&window.UserLeap.reportError("removeAttributes",i.error)),{success:!!i.ok}},async addSurveyListener(r){q.on(H.SurveyLifeCycle,r)},async removeSurveyListener(r){q.removeListener(H.SurveyLifeCycle,r)},async addListener(r,i){q.on(r,i)},async removeListener(r,i){q.removeListener(r,i)},async removeAllListeners(){q.removeAllListeners()},setVisitorAttribute(r,i){return console.warn("[Sprig] setVisitorAttribute is deprecated. Please use setAttribute"),n.setAttribute(r,i)},async setEmail(r){return n.setAttribute(mn,r)},async setVisitorEmail(r){return console.warn("[Sprig] setVisitorEmail is deprecated. Please use setEmail"),n.setEmail(r)},async setUserId(r){if(window.UserLeap.debugMode&&console.info("[DEBUG] Sprig setUserId",r),r==null){const a=`[Sprig] - Invalid userId ${r}`;return console.warn(a),{success:!1,message:a}}if(e.mode==="test"||r===window.UserLeap.userId)return;window.UserLeap.userId=r;const i=window.UserLeap.visitorId,o=await ut(Fe("1",[pt,St]),{body:JSON.stringify({userId:r}),method:"PUT"});if(!o.ok){o.reportError&&(console.warn("[Sprig] (ERR-420) Failed to set user id",o.error),o.error&&window.UserLeap.reportError("setUserId",o.error));return}i!==window.UserLeap.visitorId&&Ha(),ye("uid",r)},async setPartnerAnonymousId(r){if(window.UserLeap.debugMode&&console.info("[DEBUG] Sprig setPartnerAnonymousId",r),r==null){const i=`[Sprig] - Invalid partnerAnonymousId ${r}`;return console.warn(i),{success:!1,message:i}}return window.UserLeap.partnerAnonymousId=r,ye("aid",r),{success:!0}},async track(r,i,o={},a=void 0){return t({eventName:r,properties:i,metadata:o,showSurveyCallback:a})},async identifyAndTrack(r){return await t(r)},applyStyles(r){if(window.UserLeap.customStyles=r,window.UserLeap.container){const i=window.UserLeap.container.children[0].contentDocument;if(i){const o=i.getElementById(R.CustomStyle);o?o.textContent=r:Ks(i,r,window.UserLeap.styleNonce)}}},setWindowDimensions(r,i){var l,u;const o=typeof r=="string"?parseInt(r,10):r,a=typeof i=="string"?parseInt(i,10):i;if(!isNaN(o)&&!isNaN(a)&&(window.UserLeap.windowDimensions={width:o,height:a}),!window.UserLeap.frameId)return;const s=document.getElementById(window.UserLeap.frameId);!s||(window.UserLeap.useMobileStyling&&((l=window.UserLeap.windowDimensions)!=null&&l.width&&(s.style.width=`${window.UserLeap.windowDimensions.width}px`),(u=window.UserLeap.windowDimensions)!=null&&u.height&&(s.style.maxHeight=`${window.UserLeap.windowDimensions.height-20}px`),s.contentDocument&&(s.style.height=String($s(s.contentDocument))+"px")),q.emit(H.SurveyDimensions,{name:H.SurveyDimensions,contentFrameWidth:s.clientWidth,contentFrameHeight:s.clientHeight}))},logoutUser(){window.UserLeap.debugMode&&console.info("[DEBUG] Sprig logout"),window.UserLeap.visitorId=null,window.UserLeap.userId=null,window.UserLeap.partnerAnonymousId=null,window.UserLeap.token=null,window.UserLeap.email=null,window.UserLeap.localStorageAvailable&&(localStorage.removeItem(_e.Credentials),localStorage.removeItem(_e.PageViews)),window.UserLeap._queue.isPaused()&&window.UserLeap._queue.empty(),lc(),Ha(),window.UserLeap._queue.unpause()},teardown(){Zm(),window.UserLeap("dismissActiveSurvey",Be.API),delete window.UserLeap,delete window.Sprig,delete window._Sprig},integrateOptimizely(r,i=!0){var o,a;if(!((a=(o=window.UserLeap)==null?void 0:o._config)!=null&&a.optimizelyEnabled)){console.warn("[SPRIG] Optimizely integration is currently not enabled for your product.");return}try{const s=typeof r=="string"?JSON.parse(r):r;wr.setOptimizelyExperiment(s,i)}catch(s){console.warn("[Sprig] Error with integrating Optimizely data"),s instanceof Error&&window.UserLeap.reportError("integrateOptimizely",s)}},integrateOptimizelyClient(r){var o,a;if(!((a=(o=window.UserLeap)==null?void 0:o._config)!=null&&a.optimizelyEnabled)){console.warn("[SPRIG] Optimizely integration is currently not enabled for your product.");return}const i=({experiment:s,variation:l})=>{const u={experiments:[{id:s.id,variation:l.key}]};window.UserLeap("integrateOptimizely",u,!1)};r.notificationCenter.addNotificationListener(df.NOTIFICATION_TYPES.ACTIVATE,i)},importLaunchDarklyData(r){var i,o;if(!((o=(i=window.UserLeap)==null?void 0:i._config)!=null&&o.launchDarklyEnabled)){console.warn("[SPRIG] LaunchDarkly integration is currently not enabled for your product.");return}co.setLDFlagsVariations(r)}};Object.assign(window.UserLeap,n)};async function sg(e){const t=Bn(window.UserLeap);let n=await He(Fe("1",[pt],"config"),{headers:t});const r="TypeError";if(window.UserLeap.error=n.error,!n.ok&&n.error&&n.error.name===r&&(window.UserLeap._API_URL="https://api.sprig.com",window.UserLeap.reportError("sprigDomainRequest",n.error),n=await He(Fe("1",[pt],"config"),{headers:t})),!n.ok)return n.reportError&&(console.warn("[Sprig] (ERR-422) Failed to load configuration",n.error),n.error&&window.UserLeap.reportError("applyRemoteConfig",n.error)),Ri("Disabled: failed to fetch configuration"),e;const i=n.json;return i!=null&&i.disabled?(Ri(`Disabled: ${i.disabled}`),{disabled:i.disabled}):Object.assign({},i,e)}async function lg(e,t,n={}){const r=window.__cfg&&window.__cfg.mode,i=oa(),o=window.UserLeap.envId,a=window.document.documentElement,s={mode:r,screenWidth:window.screen.width,screenHeight:window.screen.height,clientWidth:a.clientWidth,clientHeight:a.clientHeight,location:window.location.href,language:window.navigator.language,...n},l={action:e,err:{message:t.message,stack:t.stack},meta:s,vid:i,envId:o};(await ut(Fe("1",null,"errors"),{method:"POST",headers:{[Ve.Error]:window.btoa(`userleap-${Date.now()}-error`)},body:JSON.stringify(l)},0,!0)).ok||console.warn("[Sprig] (ERR-444) Failed to report error to API",t)}function ug(e={}){const t=new URLSearchParams(window.location.search).get("sprigPreviewKey"),n=Jm();window.UserLeap.localStorageAvailable=n,n&&t&&localStorage.setItem(_e.Preview,t),window.UserLeap.UPDATES=ho;async function r(){if(window.UserLeap.loaded)return;if(window.UserLeap.reportError=lg,window.UserLeap.loaded=!0,window.UserLeap._config=Object.assign({},e,window.UserLeap.config),window.UserLeap.delayingSurvey=!1,window.UserLeap._config&&typeof window.UserLeap._config=="object")for(const l in window.UserLeap._config)window.UserLeap[l]=window.UserLeap._config[l];if(!window.UserLeap.envId)if(window.UserLeap.appId)window.UserLeap.envId=window.UserLeap.appId;else throw new Error("Missing Environment id");window.UserLeap.debugMode&&console.info("[DEBUG] Sprig debug mode enabled");const i=window.UserLeap.sampleRate;if(i)if(!n)window.UserLeap.debugMode&&console.info("[DEBUG] Sprig cannot sample users without localStorage permissions");else{let l=Ct("sampled");if(l===null&&(l=Math.random()<i,ye("sampled",l)),!l)return}else n&&Ct("sampled")!==null&&ye("sampled",null);window.UserLeap._API_URL||(window.UserLeap._API_URL="https://api.sprig.com");const o=[...window.UserLeap._queue];window.UserLeap._queue=new $m(window.UserLeap,[]),window.UserLeap._queue.pause();for(let l=0;l<o.length;l++)window.UserLeap._queue.push(o[l]);const a=Ct("token");a?(window.UserLeap.token=a,window.UserLeap.visitorId=Ct("vid"),window.UserLeap.userId=Ct("uid"),window.UserLeap.partnerAnonymousId=Ct("aid")):(window.UserLeap.localStorageAvailable&&localStorage.removeItem(_e.Credentials),lc());const s=await sg(e);Ch(window.document,s.maxReplayDurationSeconds,window.UserLeap.replayNonce,window.UserLeap.maxInflightReplayRequests,s.replaySettings),ag(s),await ig(s),window.UserLeap._queue.unpause(),q.emit(H.SDKReady),q.emit(H.VisitorIDUpdated,{visitorId:window.UserLeap.visitorId})}document.readyState==="complete"?r():window.attachEvent?window.attachEvent("onload",r):window.addEventListener("load",r,!1)}class Fr{constructor(){ce(this,"UPDATES",ho)}displaySurvey(t){window.Sprig("displaySurvey",t)}mute(){window.Sprig("mute")}unmute(){window.Sprig("unmute")}dismissActiveSurvey(){window.Sprig("dismissActiveSurvey")}setAttribute(t,n){window.Sprig("setAttribute",t,n)}setAttributes(t){window.Sprig("setAttributes",t)}identifyAndSetAttributes(t){window.Sprig("identifyAndSetAttributes",t)}removeAttributes(t){window.Sprig("removeAttributes",t)}addListener(t,n){window.Sprig("addListener",t,n)}removeListener(t,n){window.Sprig("removeListener",t,n)}removeAllListeners(){window.Sprig("removeAllListeners")}setEmail(t){window.Sprig("setAttribute","!email",t)}setUserId(t){window.Sprig("setUserId",t)}setPartnerAnonymousId(t){window.Sprig("setPartnerAnonymousId",t)}track(t,n={},r={}){window.Sprig("track",t,n,r)}identifyAndTrack(t){window.Sprig("identifyAndTrack",t)}applyStyles(t){window.Sprig("applyStyles",t)}setWindowDimensions(t,n){window.Sprig("setWindowDimensions",t,n)}logoutUser(){window.Sprig("logoutUser")}teardown(){window.Sprig("teardown")}}const po={configure:e=>{if(!e.envId&&!e.environmentId)throw new Error("Initialization Error: Sprig configure requires an environmentId");if(e.envId||(e.envId=e.environmentId||""),e.installationMethod=ht.Npm,window.Sprig)return window.Sprig;window.Sprig=function(){window.Sprig._queue.push(arguments)},Object.getOwnPropertyNames(Fr.prototype).map(n=>{n!=="constructor"&&(window.Sprig[n]=Fr.prototype[n])});const t=window.Sprig;return t.appId=e.envId,t._queue=[],window.UserLeap=t,ug(e),window.Sprig}},cg={sprig:po,SprigAPI:Fr,configure:po.configure};exports.DismissReason=Be;exports.SprigAPI=Fr;exports.SprigEvent=H;exports.default=cg;exports.sprig=po;
package/dist/index.js CHANGED
@@ -1700,7 +1700,7 @@ function Bn(e = {}) {
1700
1700
  const t = {
1701
1701
  "Content-Type": "application/json",
1702
1702
  "userleap-platform": Pt.Web,
1703
- "x-ul-sdk-version": "2.23.3",
1703
+ "x-ul-sdk-version": "2.23.4",
1704
1704
  [Ve.InstallationMethod]: Lf(e)
1705
1705
  };
1706
1706
  if (e.envId && (t[Ve.EnvironmentID] = e.envId), e.token && (t.Authorization = "Bearer " + e.token), e.userId && (t[Ve.UserID] = e.userId), e.visitorId && (t[Ve.VisitorID] = e.visitorId), e.partnerAnonymousId && (t[Ve.PartnerAnonymousId] = e.partnerAnonymousId), e.mobileHeadersJSON) {
@@ -5697,8 +5697,8 @@ oe.version(1).stores({
5697
5697
  chunkUploads: "uuid, timestamp, [sessionId+status], [uploadId+status], [sessionId+status+uploadId]",
5698
5698
  pendingCaptures: "uuid, timestamp, [sessionId+targetTimestamp]"
5699
5699
  });
5700
- oe.open().catch((e) => {
5701
- window.UserLeap.reportError("Error opening replay db", e), Tl();
5700
+ oe.open().catch(() => {
5701
+ Tl();
5702
5702
  });
5703
5703
  const Eh = async (e, t, n) => new Promise((r, i) => {
5704
5704
  const o = e.createElement("script");
@@ -10853,7 +10853,7 @@ function Om(e, t = !0) {
10853
10853
  }, w.appendChild(S);
10854
10854
  } else
10855
10855
  console.warn("[Sprig] - recording functionality not configured due to missing UpChunk dependency");
10856
- const E = "2.23.3", _ = a || ((b = l.eventEmitter) == null ? void 0 : b.emit);
10856
+ const E = "2.23.4", _ = a || ((b = l.eventEmitter) == null ? void 0 : b.emit);
10857
10857
  _ == null || _(Ie.VerifyViewVersion, {
10858
10858
  [Lt.ViewVersion]: E
10859
10859
  }), p && t && nn(g(Tm, {}), p);
package/package.json CHANGED
@@ -36,5 +36,5 @@
36
36
  },
37
37
  "homepage": "https://docs.sprig.com/docs/web-javascript",
38
38
  "license": "See LICENSE file",
39
- "version": "2.23.3"
39
+ "version": "2.23.4"
40
40
  }