@sprig-technologies/sprig-browser 2.24.11 → 2.25.1

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
- "use strict";var Cc=Object.defineProperty;var Ic=(e,t,n)=>t in e?Cc(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var fe=(e,t,n)=>(Ic(e,typeof t!="symbol"?t+"":t,n),n);Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});var Ke=(e=>(e.Closed="close.click",e.Complete="survey.completed",e.PageChange="page.change",e.API="api",e.Override="override",e))(Ke||{}),B=(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.QuestionAnswered="question.answered",e))(B||{}),Os=(e=>(e.SurveyId="survey.id",e))(Os||{});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",QUESTION_ANSWERED:"question.answered",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 Re=(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))(Re||{}),Lt=(e=>(e.ViewVersion="view.version",e.QuestionId="qid",e.Props="props",e))(Lt||{}),X=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function kc(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function Tc(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 le={},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 Lc(e){mo=e}jt.setErrorHandler=Lc;function Rc(){return mo}jt.getErrorHandler=Rc;function Ac(){mo=new vo}jt.resetErrorHandler=Ac;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 bt={},ln={},wr={exports:{}},la=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||typeof msCrypto<"u"&&typeof window.msCrypto.getRandomValues=="function"&&msCrypto.getRandomValues.bind(msCrypto);if(la){var ua=new Uint8Array(16);wr.exports=function(){return la(ua),ua}}else{var ca=new Array(16);wr.exports=function(){for(var t=0,n;t<16;t++)(t&3)===0&&(n=Math.random()*4294967296),ca[t]=n>>>((t&3)<<3)&255;return ca}}var Ds=[];for(var Qn=0;Qn<256;++Qn)Ds[Qn]=(Qn+256).toString(16).substr(1);function Uc(e,t){var n=t||0,r=Ds;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 Ps=Uc,Oc=wr.exports,Dc=Ps,da,Xr,Jr=0,ei=0;function Pc(e,t,n){var r=t&&n||0,i=t||[];e=e||{};var o=e.node||da,a=e.clockseq!==void 0?e.clockseq:Xr;if(o==null||a==null){var s=Oc();o==null&&(o=da=[s[0]|1,s[1],s[2],s[3],s[4],s[5]]),a==null&&(a=Xr=(s[6]<<8|s[7])&16383)}var l=e.msecs!==void 0?e.msecs:new Date().getTime(),u=e.nsecs!==void 0?e.nsecs:ei+1,c=l-Jr+(u-ei)/1e4;if(c<0&&e.clockseq===void 0&&(a=a+1&16383),(c<0||l>Jr)&&e.nsecs===void 0&&(u=0),u>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");Jr=l,ei=u,Xr=a,l+=122192928e5;var d=((l&268435455)*1e4+u)%4294967296;i[r++]=d>>>24&255,i[r++]=d>>>16&255,i[r++]=d>>>8&255,i[r++]=d&255;var f=l/4294967296*1e4&268435455;i[r++]=f>>>8&255,i[r++]=f&255,i[r++]=f>>>24&15|16,i[r++]=f>>>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||Dc(i)}var Nc=Pc,Vc=wr.exports,Mc=Ps;function jc(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||Vc)();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||Mc(i)}var Bc=jc,Fc=Nc,Ns=Bc,yo=Ns;yo.v1=Fc;yo.v4=Ns;var Hc=yo;(function(e){Object.defineProperty(e,"__esModule",{value:!0});var t=Hc;function n(){return t.v4()}e.generateUUID=n;function r(){return new Date().getTime()}e.getTimestamp=r;function i(d,f){for(var p=!1,h=Object.keys(d),v=0;v<h.length;v++)if(f===d[h[v]]){p=!0;break}return p}e.isValidEnum=i;function o(d,f){var p={};return d.forEach(function(h){var v=f(h);p[v]=p[v]||[],p[v].push(h)}),a(p)}e.groupBy=o;function a(d){return Object.keys(d).map(function(f){return d[f]})}e.objectValues=a;function s(d){return Object.keys(d).map(function(f){return[f,d[f]]})}e.objectEntries=s;function l(d,f){for(var p,h=0,v=d;h<v.length;h++){var g=v[h];if(f(g)){p=g;break}}return p}e.find=l;function u(d,f){var p={};return d.forEach(function(h){var v=f(h);p[v]=h}),p}e.keyBy=u;function c(d){for(var f=[],p=1;p<arguments.length;p++)f[p-1]=arguments[p];var h=0;return d.replace(/%s/g,function(){var v=f[h++],g=typeof v;return g==="function"?v():g==="string"?v:String(v)})}e.sprintf=c,function(d){d.ACTIVATE="ACTIVATE:experiment, user_id,attributes, variation, event",d.DECISION="DECISION:type, userId, attributes, decisionInfo",d.LOG_EVENT="LOG_EVENT:logEvent",d.OPTIMIZELY_CONFIG_UPDATE="OPTIMIZELY_CONFIG_UPDATE",d.TRACK="TRACK:event_key, user_id, attributes, event_tags, event"}(e.NOTIFICATION_TYPES||(e.NOTIFICATION_TYPES={}))})(ln);var Kc=X&&X.__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(bt,"__esModule",{value:!0});var $c=jt,br=ln,ne=go,fa={NOTSET:0,DEBUG:1,INFO:2,WARNING:3,ERROR:4};function _o(e){return typeof e!="string"||(e=e.toUpperCase(),e==="WARN"&&(e="WARNING"),!fa[e])?e:fa[e]}var Vs=function(){function e(){this.defaultLoggerFacade=new pa,this.loggers={}}return e.prototype.getLogger=function(t){return t?(this.loggers[t]||(this.loggers[t]=new pa({messagePrefix:t})),this.loggers[t]):this.defaultLoggerFacade},e}(),qc=function(){function e(t){t===void 0&&(t={}),this.logLevel=ne.LogLevel.NOTSET,t.logLevel!==void 0&&br.isValidEnum(ne.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),!br.isValidEnum(ne.LogLevel,t)||t===void 0?this.logLevel=ne.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 ne.LogLevel.DEBUG:return"DEBUG";case ne.LogLevel.INFO:return"INFO ";case ne.LogLevel.WARNING:return"WARN ";case ne.LogLevel.ERROR:return"ERROR";default:return"NOTSET"}},e.prototype.consoleLog=function(t,n){switch(t){case ne.LogLevel.DEBUG:console.log.apply(console,n);break;case ne.LogLevel.INFO:console.info.apply(console,n);break;case ne.LogLevel.WARNING:console.warn.apply(console,n);break;case ne.LogLevel.ERROR:console.error.apply(console,n);break;default:console.log.apply(console,n)}},e}();bt.ConsoleLogHandler=qc;var Ln=ne.LogLevel.NOTSET,xi=null,pa=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(ne.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(ne.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(ne.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(ne.LogLevel.ERROR,t,n)},e.prototype.format=function(t){return(this.messagePrefix?this.messagePrefix+": ":"")+br.sprintf.apply(void 0,Kc([t.message],t.splat))},e.prototype.internalLog=function(t,n){!xi||t<Ln||(xi.log(t,this.format(n)),n.error&&n.error instanceof Error&&$c.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}(),Ms=new Vs;function Gc(e){return Ms.getLogger(e)}bt.getLogger=Gc;function zc(e){xi=e}bt.setLogHandler=zc;function Wc(e){e=_o(e),!br.isValidEnum(ne.LogLevel,e)||e===void 0?Ln=ne.LogLevel.ERROR:Ln=e}bt.setLogLevel=Wc;function Yc(){return Ln}bt.getLogLevel=Yc;function Qc(){Ms=new Vs,Ln=ne.LogLevel.NOTSET}bt.resetLogger=Qc;(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(bt)})(le);var Zc={},jn={};Object.defineProperty(jn,"__esModule",{value:!0});jn.areEventContextsEqual=void 0;function Xc(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}jn.areEventContextsEqual=Xc;var wo={},Zt={};Object.defineProperty(Zt,"__esModule",{value:!0});Zt.DefaultEventQueue=Zt.SingleEventQueue=void 0;var Jc=le,ed=Jc.getLogger("EventProcessor"),td=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}(),nd=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}();Zt.SingleEventQueue=nd;var rd=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 td({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){ed.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}();Zt.DefaultEventQueue=rd;(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=Zt,n=le,r=ln;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,d,f){var p;return u>1?p=new t.DefaultEventQueue({flushInterval:c,maxQueueSize:u,sink:d,batchComparator:f}):p=new t.SingleEventQueue({sink:d}),p}e.getQueue=s;function l(u,c){u&&u.sendNotifications(r.NOTIFICATION_TYPES.LOG_EVENT,c)}e.sendEventNotification=l})(wo);var js={};Object.defineProperty(js,"__esModule",{value:!0});var Bs={};Object.defineProperty(Bs,"__esModule",{value:!0});var Xt={},Fr={};Object.defineProperty(Fr,"__esModule",{value:!0});Fr.LocalStorageStore=void 0;var id=ln,od=le,ha=od.getLogger("EventProcessor"),ad=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 id.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){ha.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){ha.error(n)}return{}},e}();Fr.LocalStorageStore=ad;var sd=X&&X.__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(Xt,"__esModule",{value:!0});Xt.LocalStoragePendingEventsDispatcher=Xt.PendingEventsDispatcher=void 0;var ld=le,ud=Fr,va=ln,cd=ld.getLogger("EventProcessor"),Fs=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:va.generateUUID(),timestamp:va.getTimestamp(),request:t},n)},e.prototype.sendPendingEvents=function(){var t=this,n=this.store.values();cd.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}();Xt.PendingEventsDispatcher=Fs;var dd=function(e){sd(t,e);function t(n){var r=n.eventDispatcher;return e.call(this,{eventDispatcher:r,store:new ud.LocalStorageStore({maxValues:100,key:"fs_optly_pending_events"})})||this}return t}(Fs);Xt.LocalStoragePendingEventsDispatcher=dd;var Pe={},Si=X&&X.__assign||function(){return Si=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},Si.apply(this,arguments)};Object.defineProperty(Pe,"__esModule",{value:!0});Pe.formatEvents=Pe.buildConversionEventV1=Pe.buildImpressionEventV1=Pe.makeBatchedEventV1=void 0;var fd="campaign_activated",pd="custom",ma="$opt_bot_filtering";function Hs(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($s(r)):r.type==="conversion"&&i.snapshots.push(Ks(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}}Pe.makeBatchedEventV1=Hs;function Ks(e){var t=Si({},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 $s(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,d=(t=i==null?void 0:i.id)!==null&&t!==void 0?t:"",f=(n=o==null?void 0:o.id)!==null&&n!==void 0?n:"",p=o?o.key:"";return{decisions:[{campaign_id:c,experiment_id:d,variation_id:f,metadata:{flag_key:s,rule_key:a,rule_type:l,variation_key:p,enabled:u}}],events:[{entity_id:c,timestamp:e.timestamp,key:fd,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:ma,key:ma,type:pd,value:e.context.botFiltering}),t}function hd(e){var t=bo(e);return t.snapshots.push($s(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]}}Pe.buildImpressionEventV1=hd;function vd(e){var t=bo(e);return t.snapshots.push(Ks(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]}}Pe.buildConversionEventV1=vd;function md(e){return{url:"https://logx.optimizely.com/v1/events",httpVerb:"POST",params:Hs(e)}}Pe.formatEvents=md;var Hr={},Eo={};Object.defineProperty(Eo,"__esModule",{value:!0});var gd=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=gd;var yd=X&&X.__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(d){a(d)}}function l(c){try{u(r.throw(c))}catch(d){a(d)}}function u(c){c.done?o(c.value):i(c.value).then(s,l)}u((r=r.apply(e,t||[])).next())})},_d=X&&X.__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}}},wd=X&&X.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Hr,"__esModule",{value:!0});Hr.LogTierV1EventProcessor=void 0;var bd=le,Ht=wo,Ed=wd(Eo),xd=jn,Sd=Pe,ga=bd.getLogger("LogTierV1EventProcessor"),Cd=function(){function e(t){var n=t.dispatcher,r=t.flushInterval,i=r===void 0?Ht.DEFAULT_FLUSH_INTERVAL:r,o=t.batchSize,a=o===void 0?Ht.DEFAULT_BATCH_SIZE:o,s=t.notificationCenter;this.dispatcher=n,this.notificationCenter=s,this.requestTracker=new Ed.default,i=Ht.validateAndGetFlushInterval(i),a=Ht.validateAndGetBatchSize(a),this.queue=Ht.getQueue(a,i,this.drainQueue.bind(this),xd.areEventContextsEqual)}return e.prototype.drainQueue=function(t){var n=this,r=new Promise(function(i){if(ga.debug("draining queue with %s events",t.length),t.length===0){i();return}var o=Sd.formatEvents(t);n.dispatcher.dispatchEvent(o,function(){i()}),Ht.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){ga.error('Error stopping EventProcessor: "%s"',t.message,t)}return Promise.resolve()},e.prototype.start=function(){return yd(this,void 0,void 0,function(){return _d(this,function(t){return this.queue.start(),[2]})})},e}();Hr.LogTierV1EventProcessor=Cd;(function(e){var t=X&&X.__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=X&&X.__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(jn,e),n(wo,e),n(js,e),n(Bs,e),n(Xt,e),n(Pe,e),n(Hr,e)})(Zc);var Er={exports:{}},ya=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||typeof msCrypto<"u"&&typeof window.msCrypto.getRandomValues=="function"&&msCrypto.getRandomValues.bind(msCrypto);if(ya){var _a=new Uint8Array(16);Er.exports=function(){return ya(_a),_a}}else{var wa=new Array(16);Er.exports=function(){for(var t=0,n;t<16;t++)(t&3)===0&&(n=Math.random()*4294967296),wa[t]=n>>>((t&3)<<3)&255;return wa}}var qs=[];for(var Zn=0;Zn<256;++Zn)qs[Zn]=(Zn+256).toString(16).substr(1);function Id(e,t){var n=t||0,r=qs;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 Gs=Id,kd=Er.exports,Td=Gs,ba,ti,ni=0,ri=0;function Ld(e,t,n){var r=t&&n||0,i=t||[];e=e||{};var o=e.node||ba,a=e.clockseq!==void 0?e.clockseq:ti;if(o==null||a==null){var s=kd();o==null&&(o=ba=[s[0]|1,s[1],s[2],s[3],s[4],s[5]]),a==null&&(a=ti=(s[6]<<8|s[7])&16383)}var l=e.msecs!==void 0?e.msecs:new Date().getTime(),u=e.nsecs!==void 0?e.nsecs:ri+1,c=l-ni+(u-ri)/1e4;if(c<0&&e.clockseq===void 0&&(a=a+1&16383),(c<0||l>ni)&&e.nsecs===void 0&&(u=0),u>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");ni=l,ri=u,ti=a,l+=122192928e5;var d=((l&268435455)*1e4+u)%4294967296;i[r++]=d>>>24&255,i[r++]=d>>>16&255,i[r++]=d>>>8&255,i[r++]=d&255;var f=l/4294967296*1e4&268435455;i[r++]=f>>>8&255,i[r++]=f&255,i[r++]=f>>>24&15|16,i[r++]=f>>>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||Td(i)}var Rd=Ld,Ad=Er.exports,Ud=Gs;function Od(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||Ad)();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||Ud(i)}var Dd=Od,Pd=Rd,zs=Dd,Ws=zs;Ws.v1=Pd;Ws.v4=zs;var Nd={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,d,f,p;for(a=i.length&3,s=i.length-a,l=o,c=3432918353,d=461845907,p=0;p<s;)f=i.charCodeAt(p)&255|(i.charCodeAt(++p)&255)<<8|(i.charCodeAt(++p)&255)<<16|(i.charCodeAt(++p)&255)<<24,++p,f=(f&65535)*c+(((f>>>16)*c&65535)<<16)&4294967295,f=f<<15|f>>>17,f=(f&65535)*d+(((f>>>16)*d&65535)<<16)&4294967295,l^=f,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(f=0,a){case 3:f^=(i.charCodeAt(p+2)&255)<<16;case 2:f^=(i.charCodeAt(p+1)&255)<<8;case 1:f^=i.charCodeAt(p)&255,f=(f&65535)*c+(((f>>>16)*c&65535)<<16)&4294967295,f=f<<15|f>>>17,f=(f&65535)*d+(((f>>>16)*d&65535)<<16)&4294967295,l^=f}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})()})(Nd);var Ys={},xo={},So={},qe={};Object.defineProperty(qe,"__esModule",{value:!0});qe.DEFAULT_UPDATE_INTERVAL=5*60*1e3;qe.MIN_UPDATE_INTERVAL=1e3;qe.DEFAULT_URL_TEMPLATE="https://cdn.optimizely.com/datafiles/%s.json";qe.DEFAULT_AUTHENTICATED_URL_TEMPLATE="https://config.optimizely.com/datafiles/auth/%s.json";qe.BACKOFF_BASE_WAIT_SECONDS_BY_ERROR_COUNT=[0,8,16,32,64,128,256,512];qe.REQUEST_TIMEOUT_MS=60*1e3;Object.defineProperty(So,"__esModule",{value:!0});var Vd=qe,Md=le,jd=Md.getLogger("DatafileManager"),Bd="GET",Fd=4;function Hd(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 Kd(e,t){Object.keys(e).forEach(function(n){var r=e[n];t.setRequestHeader(n,r)})}function $d(e,t){var n=new XMLHttpRequest,r=new Promise(function(i,o){n.open(Bd,e,!0),Kd(t,n),n.onreadystatechange=function(){if(n.readyState===Fd){var a=n.status;if(a===0){o(new Error("Request error"));return}var s=Hd(n),l={statusCode:n.status,body:n.responseText,headers:s};i(l)}},n.timeout=Vd.REQUEST_TIMEOUT_MS,n.ontimeout=function(){jd.error("Request timed out")},n.send()});return{responsePromise:r,abort:function(){n.abort()}}}So.makeGetRequest=$d;var Co={},Io={};Object.defineProperty(Io,"__esModule",{value:!0});var qd=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=qd;var ko={};Object.defineProperty(ko,"__esModule",{value:!0});var ii=qe;function Gd(){return Math.round(Math.random()*1e3)}var zd=function(){function e(){this.errorCount=0}return e.prototype.getDelay=function(){if(this.errorCount===0)return 0;var t=ii.BACKOFF_BASE_WAIT_SECONDS_BY_ERROR_COUNT[Math.min(ii.BACKOFF_BASE_WAIT_SECONDS_BY_ERROR_COUNT.length-1,this.errorCount)];return t*1e3+Gd()},e.prototype.countError=function(){this.errorCount<ii.BACKOFF_BASE_WAIT_SECONDS_BY_ERROR_COUNT.length-1&&this.errorCount++},e.prototype.reset=function(){this.errorCount=0},e}();ko.default=zd;var xr=X&&X.__assign||function(){return xr=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},xr.apply(this,arguments)},Qs=X&&X.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Co,"__esModule",{value:!0});var Wd=le,Yd=ln,Qd=Qs(Io),yn=qe,Zd=Qs(ko),Ce=Wd.getLogger("DatafileManager"),Xd="update";function Jd(e){return e>=yn.MIN_UPDATE_INTERVAL}function Ea(e){return e>=200&&e<400}var ef={get:function(){return Promise.resolve("")},set:function(){return Promise.resolve()},contains:function(){return Promise.resolve(!1)},remove:function(){return Promise.resolve()}},tf=function(){function e(t){var n=this,r=xr(xr({},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?yn.DEFAULT_UPDATE_INTERVAL:l,c=r.urlTemplate,d=c===void 0?yn.DEFAULT_URL_TEMPLATE:c,f=r.cache,p=f===void 0?ef:f;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=Yd.sprintf(d,s),this.emitter=new Qd.default,this.autoUpdate=a,Jd(u)?this.updateInterval=u:(Ce.warn("Invalid updateInterval %s, defaulting to %s",u,yn.DEFAULT_UPDATE_INTERVAL),this.updateInterval=yn.DEFAULT_UPDATE_INTERVAL),this.currentTimeout=null,this.currentRequest=null,this.backoffController=new Zd.default,this.syncOnCurrentRequestComplete=!1}return e.prototype.get=function(){return this.currentDatafile},e.prototype.start=function(){this.isStarted||(Ce.debug("Datafile manager started"),this.isStarted=!0,this.backoffController.reset(),this.setDatafileFromCacheIfAvailable(),this.syncDatafile())},e.prototype.stop=function(){return Ce.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?Ce.error("Error fetching datafile: %s",t.message,t):typeof t=="string"?Ce.error("Error fetching datafile: %s",t):Ce.error("Error fetching datafile"))},e.prototype.onRequestResolved=function(t){if(!!this.isStarted){typeof t.statusCode<"u"&&Ea(t.statusCode)?this.backoffController.reset():this.backoffController.countError(),this.trySavingLastModified(t.headers);var n=this.getNextDatafileFromResponse(t);if(n!=="")if(Ce.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(Xd,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),Ce.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);Ce.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 Ce.debug("Response status code: %s",t.statusCode),typeof t.statusCode>"u"||t.statusCode===304?"":Ea(t.statusCode)?t.body:""},e.prototype.trySavingLastModified=function(t){var n=t["last-modified"]||t["Last-Modified"];typeof n<"u"&&(this.lastResponseLastModified=n,Ce.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!==""&&(Ce.debug("Using datafile from cache"),t.currentDatafile=n,t.resolveReadyPromise())})},e}();Co.default=tf;var nf=X&&X.__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)}}(),rf=X&&X.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(xo,"__esModule",{value:!0});var of=So,af=rf(Co),sf=function(e){nf(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.makeGetRequest=function(n,r){return of.makeGetRequest(n,r)},t.prototype.getConfigDefaults=function(){return{autoUpdate:!1}},t}(af.default);xo.default=sf;Object.defineProperty(Ys,"__esModule",{value:!0});var lf=xo;Ys.HttpPollingDatafileManager=lf.default;var uf={NOTSET:0,DEBUG:1,INFO:2,WARNING:3,ERROR:4},cf={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."},df={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"'},ff={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"},pf="javascript-sdk",hf="node-sdk",vf="react-sdk",mf="react-native-sdk",gf="react-native-js-sdk",yf="4.9.4",_f="4.9.4",wf={AB_TEST:"ab-test",FEATURE:"feature",FEATURE_TEST:"feature-test",FEATURE_VARIABLE:"feature-variable",ALL_FEATURE_VARIABLES:"all-feature-variables",FLAG:"flag"},bf={FEATURE_TEST:"feature-test",ROLLOUT:"rollout",EXPERIMENT:"experiment"},Ef={RULE:"rule",EXPERIMENT:"experiment"},xf={BOOLEAN:"boolean",DOUBLE:"double",INTEGER:"integer",STRING:"string",JSON:"json"},ar={V2:"2",V3:"3",V4:"4"},Sf={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.'},Ci;(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"})(Ci||(Ci={}));var Cf=Object.freeze({__proto__:null,LOG_LEVEL:uf,ERROR_MESSAGES:cf,LOG_MESSAGES:df,CONTROL_ATTRIBUTES:ff,JAVASCRIPT_CLIENT_ENGINE:pf,NODE_CLIENT_ENGINE:hf,REACT_CLIENT_ENGINE:vf,REACT_NATIVE_CLIENT_ENGINE:mf,REACT_NATIVE_JS_CLIENT_ENGINE:gf,BROWSER_CLIENT_VERSION:yf,NODE_CLIENT_VERSION:_f,DECISION_NOTIFICATION_TYPES:wf,DECISION_SOURCES:bf,AUDIENCE_EVALUATION_TYPES:Ef,FEATURE_VARIABLE_TYPES:xf,DATAFILE_VERSIONS:ar,DECISION_MESSAGES:Sf,get NOTIFICATION_TYPES(){return Ci}});ar.V2,ar.V3,ar.V4;(function(){function e(){}return e.prototype.log=function(){},e})();function If(e){return new le.ConsoleLogHandler(e)}var xa;(function(e){e.BOOLEAN="boolean",e.DOUBLE="double",e.INTEGER="integer",e.STRING="string",e.JSON="json"})(xa||(xa={}));var Sa;(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"})(Sa||(Sa={}));le.getLogger();le.getLogger();le.getLogger();le.getLogger();le.getLogger("EVENT_BUILDER");le.getLogger();le.setLogHandler(If());le.setLogLevel(le.LogLevel.INFO);let Xn;const kf=new Uint8Array(16);function Tf(){if(!Xn&&(Xn=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!Xn))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Xn(kf)}const ce=[];for(let e=0;e<256;++e)ce.push((e+256).toString(16).slice(1));function Lf(e,t=0){return(ce[e[t+0]]+ce[e[t+1]]+ce[e[t+2]]+ce[e[t+3]]+"-"+ce[e[t+4]]+ce[e[t+5]]+"-"+ce[e[t+6]]+ce[e[t+7]]+"-"+ce[e[t+8]]+ce[e[t+9]]+"-"+ce[e[t+10]]+ce[e[t+11]]+ce[e[t+12]]+ce[e[t+13]]+ce[e[t+14]]+ce[e[t+15]]).toLowerCase()}const Rf=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),Ca={randomUUID:Rf};function mt(e,t,n){if(Ca.randomUUID&&!t&&!e)return Ca.randomUUID();e=e||{};const r=e.random||(e.rng||Tf)();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 Lf(r)}const zt="ul-app";var U=(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.SkipButton="ul-card-skip__button",e))(U||{});const To="#e6e6e6",En="#bd282a",Af=500,Uf=1030;var be=(e=>(e.Preview="sprig.previewKey",e.Credentials="userleap.ids",e.PageViews="userleap.pageviews",e))(be||{});const Zs=()=>{try{return window.parent.Intercom}catch(e){return console.error(e),null}},Of=()=>{const e=Zs();!e||(e.ul_wasVisible&&e("update",{hide_default_launcher:!1}),delete e.ul_wasVisible)},Df=()=>{const e=Zs();!e||(e.ul_wasVisible=!!document.querySelector("iframe.intercom-launcher-frame"),e.ul_wasVisible&&e("update",{hide_default_launcher:!0}))},Pf=Object.freeze(Object.defineProperty({__proto__:null,enable:Of,disable:Df},Symbol.toStringTag,{value:"Module"})),Ia=[Pf];class Ii{static disable(){Ia.forEach(t=>t.disable())}static enable(){Ia.forEach(t=>t.enable())}}const Nf=1,Jt=e=>e instanceof HTMLElement,Vf=e=>e instanceof HTMLInputElement,xn=e=>e instanceof HTMLTextAreaElement,Xs=(e,t,n)=>{const r=e.createElement("style");n&&(r.nonce=n),r.textContent=t,r.id=U.CustomStyle,e.head.appendChild(r)},Js=e=>{const t=e.querySelector(`.${U.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+Nf},Mf=e=>{const t=e.querySelector(`.${U.CardContainer}`);t&&(t.scrollTop=0)};var jf=class extends Error{constructor(e,t,n){super(`Possible EventEmitter memory leak detected. ${n} ${t.toString()} listeners added. Use emitter.setMaxListeners() to increase limit`),this.emitter=e,this.type=t,this.count=n,this.name="MaxListenersExceededWarning"}},el=class{static listenerCount(e,t){return e.listenerCount(t)}constructor(){this.events=new Map,this.maxListeners=el.defaultMaxListeners,this.hasWarnedAboutPotentialMemoryLeak=!1}_emitInternalEvent(e,t,n){this.emit(e,t,n)}_getListeners(e){return Array.prototype.concat.apply([],this.events.get(e))||[]}_removeListener(e,t){const n=e.indexOf(t);return n>-1&&e.splice(n,1),[]}_wrapOnceListener(e,t){const n=(...r)=>(this.removeListener(e,n),t.apply(this,r));return Object.defineProperty(n,"name",{value:t.name}),n}setMaxListeners(e){return this.maxListeners=e,this}getMaxListeners(){return this.maxListeners}eventNames(){return Array.from(this.events.keys())}emit(e,...t){const n=this._getListeners(e);return n.forEach(r=>{r.apply(this,t)}),n.length>0}addListener(e,t){this._emitInternalEvent("newListener",e,t);const n=this._getListeners(e).concat(t);if(this.events.set(e,n),this.maxListeners>0&&this.listenerCount(e)>this.maxListeners&&!this.hasWarnedAboutPotentialMemoryLeak){this.hasWarnedAboutPotentialMemoryLeak=!0;const r=new jf(this,e,this.listenerCount(e));console.warn(r)}return this}on(e,t){return this.addListener(e,t)}once(e,t){return this.addListener(e,this._wrapOnceListener(e,t))}prependListener(e,t){const n=this._getListeners(e);if(n.length>0){const r=[t].concat(n);this.events.set(e,r)}else this.events.set(e,n.concat(t));return this}prependOnceListener(e,t){return this.prependListener(e,this._wrapOnceListener(e,t))}removeListener(e,t){const n=this._getListeners(e);return n.length>0&&(this._removeListener(n,t),this.events.set(e,n),this._emitInternalEvent("removeListener",e,t)),this}off(e,t){return this.removeListener(e,t)}removeAllListeners(e){return e?this.events.delete(e):this.events.clear(),this}listeners(e){return Array.from(this._getListeners(e))}listenerCount(e){return this._getListeners(e).length}rawListeners(e){return this.listeners(e)}},tl=el;tl.defaultMaxListeners=10;const $=new tl;var _n=(e=>(e.BottomLeft="bottomLeft",e.BottomRight="bottomRight",e.Center="center",e.TopLeft="topLeft",e.TopRight="topRight",e))(_n||{}),He=(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))(He||{}),Pt=(e=>(e.Email="email",e.Link="link",e.Web="web",e))(Pt||{}),rt=(e=>(e.Npm="web-npm",e.NpmBundled="web-npm-bundled",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))(rt||{});const Sr=e=>new Promise(t=>{setTimeout(()=>{t()},e)}),Wt=({"userleap-platform":e})=>e!==Pt.Web,ie=(e,t)=>{const n=t?U.MobileSuffix:U.DesktopSuffix;return[e+n,e]},Bf=(e,t)=>[e,`${e}__${t}`];class Ff{constructor(t){fe(this,"payload");fe(this,"promise");fe(this,"reject",()=>{});fe(this,"resolve",()=>{});this.payload=t,this.promise=new Promise((n,r)=>{this.reject=r,this.resolve=n})}resolveRequest(t){this.resolve(t)}}const Hf={RATELIMIT_RESET_DEFAULT:10};let nl=!1,rl="",Jn=!1,il=!1,sr=[];const Kf=e=>e._config&&e._config.installationMethod?e._config.installationMethod:e._gtm?rt.Gtm:e._segment?rt.Segment:rt.Snippet,ki=e=>{var t;(t=e==null?void 0:e.blockedURI)!=null&&t.includes(window.UserLeap._API_URL)&&(il=!0,console.warn(`[Sprig] ${e.blockedURI} is blocked by Content-Security-Policy`),document.removeEventListener("securitypolicyviolation",ki))},Ti=(e="")=>{nl=!0,rl=e};function en(e={}){const t={"Content-Type":"application/json","userleap-platform":Pt.Web,"x-ul-sdk-version":"2.24.11",[He.InstallationMethod]:Kf(e)};if(e.envId&&(t[He.EnvironmentID]=e.envId),e.token&&(t.Authorization="Bearer "+e.token),e.userId&&(t[He.UserID]=e.userId),e.visitorId&&(t[He.VisitorID]=e.visitorId),e.partnerAnonymousId&&(t[He.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[He.PreviewMode]="1"),t}const ka=async(e,t,n)=>{if(e)return{status:429};{const r=new Ff(n);return sr.push(r),r.promise}},it=async(e,t,n=0,r=!1,i=!1)=>{const o={url:e,options:t,attempt:n,shouldDropOnRateLimit:r};if(Jn&&!i)return ka(r,i,o);const a={ok:!1,reportError:!1};if(nl)return console.info(`UserLeap - ${rl}`),a;try{t.headers=Object.assign(en(),t.headers);const s=await fetch(e,t);if(s.status===429)if(!Jn&&!r||i){Jn=!0;const u=s.headers.has("ratelimit-reset")?Number(s.headers.get("ratelimit-reset")):Hf.RATELIMIT_RESET_DEFAULT;return await Sr(u*1e3),it(e,t,0,r,!0)}else return ka(r,!1,o);if(Jn=!1,sr.length&&(sr.map(l=>{const{url:u,options:c,attempt:d,shouldDropOnRateLimit:f}=l.payload;it(u,c,d,f).then(p=>{l.resolveRequest(p)})}),sr=[]),s.ok){if(s.status===249)return Ti(),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||il?{ok:!1,reportError:!1,error:s}:(await Sr(Math.pow(2,n)*1e3),it(e,t,l))}};var ol={exports:{}};(function(e,t){(function(n,r){e.exports=r()})(X,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 d=a.retries,f=a.retryDelay,p=a.retryOn;if(c&&c.retries!==void 0)if(r(c.retries))d=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")f=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 g=function(_){var b=typeof Request<"u"&&u instanceof Request?u.clone():u;o(b,c).then(function(E){if(Array.isArray(p)&&p.indexOf(E.status)===-1)h(E);else if(typeof p=="function")try{return Promise.resolve(p(_,null,E)).then(function(m){m?w(_,null,E):h(E)}).catch(v)}catch(m){v(m)}else _<d?w(_,null,E):h(E)}).catch(function(E){if(typeof p=="function")try{Promise.resolve(p(_,E,null)).then(function(m){m?w(_,E,null):v(E)}).catch(function(m){v(m)})}catch(m){v(m)}else _<d?w(_,E,null):v(E)})};function w(_,b,E){var m=typeof f=="function"?f(_,b,E):f;setTimeout(function(){g(++_)},m)}g(0)})}};function r(o){return Number.isInteger(o)&&o>=0}function i(o){this.name="ArgumentError",this.message=o}return n})})(ol);const $f=ol.exports;class qf{constructor(t){fe(this,"awaitingResolvers",[]);fe(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 al=new qf(2),Gf=e=>al.setLimit(e),zf=$f(fetch),Wf=async(e,t=3)=>al.execute(async()=>{const r=(await zf(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}),sl=async({apiUrl:e,surveyId:t,uploadId:n,etags:r,headers:i,responseGroupUuid:o,replayDuration:a,eventDigest:s},l=!1)=>{var u;if(!(!l&&!n&&!r))return it(`${e}/sdk/1/completeSessionReplay`,{method:"POST",body:JSON.stringify({etags:r,uploadId:n,responseGroupUuid:o,surveyId:t,replayDuration:a,eventDigest:s,userAgent:(u=window==null?void 0:window.navigator)==null?void 0:u.userAgent}),headers:i})};/*! *****************************************************************************
1
+ "use strict";var Mc=Object.defineProperty;var Vc=(e,t,n)=>t in e?Mc(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var ie=(e,t,n)=>(Vc(e,typeof t!="symbol"?t+"":t,n),n);Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});var qe=(e=>(e.Closed="close.click",e.Complete="survey.completed",e.PageChange="page.change",e.API="api",e.Override="override",e))(qe||{}),j=(e=>(e.ReplayCapture="replay.capture",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.SurveyWidth="survey.width",e.SurveyWillClose="survey.willClose",e.SurveyWillPresent="survey.will.present",e.CloseSurveyOnOverlayClick="close.survey.overlayClick",e.VisitorIDUpdated="visitor.id.updated",e.QuestionAnswered="question.answered",e))(j||{}),Rn=(e=>(e.SurveyId="survey.id",e))(Rn||{});const _o={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",QUESTION_ANSWERED:"question.answered",REPLAY_CAPTURE:"replay.capture",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 Ue=(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))(Ue||{}),At=(e=>(e.ViewVersion="view.version",e.QuestionId="qid",e.Props="props",e))(At||{}),Z=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function jc(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function Bc(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 ue={},$t={};Object.defineProperty($t,"__esModule",{value:!0});var wo=function(){function e(){}return e.prototype.handleError=function(t){},e}();$t.NoopErrorHandler=wo;var bo=new wo;function Fc(e){bo=e}$t.setErrorHandler=Fc;function Hc(){return bo}$t.getErrorHandler=Hc;function $c(){bo=new wo}$t.resetErrorHandler=$c;var Eo={};(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={}))})(Eo);var St={},dn={},br={exports:{}},ha=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||typeof msCrypto<"u"&&typeof window.msCrypto.getRandomValues=="function"&&msCrypto.getRandomValues.bind(msCrypto);if(ha){var va=new Uint8Array(16);br.exports=function(){return ha(va),va}}else{var ma=new Array(16);br.exports=function(){for(var t=0,n;t<16;t++)(t&3)===0&&(n=Math.random()*4294967296),ma[t]=n>>>((t&3)<<3)&255;return ma}}var Fs=[];for(var Zn=0;Zn<256;++Zn)Fs[Zn]=(Zn+256).toString(16).substr(1);function Kc(e,t){var n=t||0,r=Fs;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 Hs=Kc,qc=br.exports,Gc=Hs,ga,ei,ti=0,ni=0;function zc(e,t,n){var r=t&&n||0,i=t||[];e=e||{};var o=e.node||ga,a=e.clockseq!==void 0?e.clockseq:ei;if(o==null||a==null){var s=qc();o==null&&(o=ga=[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 d=((l&268435455)*1e4+u)%4294967296;i[r++]=d>>>24&255,i[r++]=d>>>16&255,i[r++]=d>>>8&255,i[r++]=d&255;var f=l/4294967296*1e4&268435455;i[r++]=f>>>8&255,i[r++]=f&255,i[r++]=f>>>24&15|16,i[r++]=f>>>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||Gc(i)}var Wc=zc,Yc=br.exports,Qc=Hs;function Zc(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||Yc)();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||Qc(i)}var Xc=Zc,Jc=Wc,$s=Xc,xo=$s;xo.v1=Jc;xo.v4=$s;var ed=xo;(function(e){Object.defineProperty(e,"__esModule",{value:!0});var t=ed;function n(){return t.v4()}e.generateUUID=n;function r(){return new Date().getTime()}e.getTimestamp=r;function i(d,f){for(var p=!1,v=Object.keys(d),h=0;h<v.length;h++)if(f===d[v[h]]){p=!0;break}return p}e.isValidEnum=i;function o(d,f){var p={};return d.forEach(function(v){var h=f(v);p[h]=p[h]||[],p[h].push(v)}),a(p)}e.groupBy=o;function a(d){return Object.keys(d).map(function(f){return d[f]})}e.objectValues=a;function s(d){return Object.keys(d).map(function(f){return[f,d[f]]})}e.objectEntries=s;function l(d,f){for(var p,v=0,h=d;v<h.length;v++){var g=h[v];if(f(g)){p=g;break}}return p}e.find=l;function u(d,f){var p={};return d.forEach(function(v){var h=f(v);p[h]=v}),p}e.keyBy=u;function c(d){for(var f=[],p=1;p<arguments.length;p++)f[p-1]=arguments[p];var v=0;return d.replace(/%s/g,function(){var h=f[v++],g=typeof h;return g==="function"?h():g==="string"?h:String(h)})}e.sprintf=c,function(d){d.ACTIVATE="ACTIVATE:experiment, user_id,attributes, variation, event",d.DECISION="DECISION:type, userId, attributes, decisionInfo",d.LOG_EVENT="LOG_EVENT:logEvent",d.OPTIMIZELY_CONFIG_UPDATE="OPTIMIZELY_CONFIG_UPDATE",d.TRACK="TRACK:event_key, user_id, attributes, event_tags, event"}(e.NOTIFICATION_TYPES||(e.NOTIFICATION_TYPES={}))})(dn);var td=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(St,"__esModule",{value:!0});var nd=$t,Er=dn,te=Eo,ya={NOTSET:0,DEBUG:1,INFO:2,WARNING:3,ERROR:4};function So(e){return typeof e!="string"||(e=e.toUpperCase(),e==="WARN"&&(e="WARNING"),!ya[e])?e:ya[e]}var Ks=function(){function e(){this.defaultLoggerFacade=new _a,this.loggers={}}return e.prototype.getLogger=function(t){return t?(this.loggers[t]||(this.loggers[t]=new _a({messagePrefix:t})),this.loggers[t]):this.defaultLoggerFacade},e}(),rd=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=So(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}();St.ConsoleLogHandler=rd;var An=te.LogLevel.NOTSET,Ii=null,_a=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(So(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,td([t.message],t.splat))},e.prototype.internalLog=function(t,n){!Ii||t<An||(Ii.log(t,this.format(n)),n.error&&n.error instanceof Error&&nd.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}(),qs=new Ks;function id(e){return qs.getLogger(e)}St.getLogger=id;function od(e){Ii=e}St.setLogHandler=od;function ad(e){e=So(e),!Er.isValidEnum(te.LogLevel,e)||e===void 0?An=te.LogLevel.ERROR:An=e}St.setLogLevel=ad;function sd(){return An}St.getLogLevel=sd;function ld(){qs=new Ks,An=te.LogLevel.NOTSET}St.resetLogger=ld;(function(e){function t(n){for(var r in n)e.hasOwnProperty(r)||(e[r]=n[r])}Object.defineProperty(e,"__esModule",{value:!0}),t($t),t(Eo),t(St)})(ue);var ud={},Fn={};Object.defineProperty(Fn,"__esModule",{value:!0});Fn.areEventContextsEqual=void 0;function cd(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}Fn.areEventContextsEqual=cd;var Co={},tn={};Object.defineProperty(tn,"__esModule",{value:!0});tn.DefaultEventQueue=tn.SingleEventQueue=void 0;var dd=ue,fd=dd.getLogger("EventProcessor"),pd=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}(),hd=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}();tn.SingleEventQueue=hd;var vd=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 pd({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){fd.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}();tn.DefaultEventQueue=vd;(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=tn,n=ue,r=dn;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,d,f){var p;return u>1?p=new t.DefaultEventQueue({flushInterval:c,maxQueueSize:u,sink:d,batchComparator:f}):p=new t.SingleEventQueue({sink:d}),p}e.getQueue=s;function l(u,c){u&&u.sendNotifications(r.NOTIFICATION_TYPES.LOG_EVENT,c)}e.sendEventNotification=l})(Co);var Gs={};Object.defineProperty(Gs,"__esModule",{value:!0});var zs={};Object.defineProperty(zs,"__esModule",{value:!0});var nn={},Hr={};Object.defineProperty(Hr,"__esModule",{value:!0});Hr.LocalStorageStore=void 0;var md=dn,gd=ue,wa=gd.getLogger("EventProcessor"),yd=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 md.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){wa.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){wa.error(n)}return{}},e}();Hr.LocalStorageStore=yd;var _d=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(nn,"__esModule",{value:!0});nn.LocalStoragePendingEventsDispatcher=nn.PendingEventsDispatcher=void 0;var wd=ue,bd=Hr,ba=dn,Ed=wd.getLogger("EventProcessor"),Ws=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:ba.generateUUID(),timestamp:ba.getTimestamp(),request:t},n)},e.prototype.sendPendingEvents=function(){var t=this,n=this.store.values();Ed.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}();nn.PendingEventsDispatcher=Ws;var xd=function(e){_d(t,e);function t(n){var r=n.eventDispatcher;return e.call(this,{eventDispatcher:r,store:new bd.LocalStorageStore({maxValues:100,key:"fs_optly_pending_events"})})||this}return t}(Ws);nn.LocalStoragePendingEventsDispatcher=xd;var Me={},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(Me,"__esModule",{value:!0});Me.formatEvents=Me.buildConversionEventV1=Me.buildImpressionEventV1=Me.makeBatchedEventV1=void 0;var Sd="campaign_activated",Cd="custom",Ea="$opt_bot_filtering";function Ys(e){var t=[],n=e[0];return e.forEach(function(r){if(r.type==="conversion"||r.type==="impression"){var i=Io(r);r.type==="impression"?i.snapshots.push(Zs(r)):r.type==="conversion"&&i.snapshots.push(Qs(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}}Me.makeBatchedEventV1=Ys;function Qs(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 Zs(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,d=(t=i==null?void 0:i.id)!==null&&t!==void 0?t:"",f=(n=o==null?void 0:o.id)!==null&&n!==void 0?n:"",p=o?o.key:"";return{decisions:[{campaign_id:c,experiment_id:d,variation_id:f,metadata:{flag_key:s,rule_key:a,rule_type:l,variation_key:p,enabled:u}}],events:[{entity_id:c,timestamp:e.timestamp,key:Sd,uuid:e.uuid}]}}function Io(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:Ea,key:Ea,type:Cd,value:e.context.botFiltering}),t}function Id(e){var t=Io(e);return t.snapshots.push(Zs(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]}}Me.buildImpressionEventV1=Id;function kd(e){var t=Io(e);return t.snapshots.push(Qs(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]}}Me.buildConversionEventV1=kd;function Td(e){return{url:"https://logx.optimizely.com/v1/events",httpVerb:"POST",params:Ys(e)}}Me.formatEvents=Td;var $r={},ko={};Object.defineProperty(ko,"__esModule",{value:!0});var Ld=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}();ko.default=Ld;var Rd=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(d){a(d)}}function l(c){try{u(r.throw(c))}catch(d){a(d)}}function u(c){c.done?o(c.value):i(c.value).then(s,l)}u((r=r.apply(e,t||[])).next())})},Ad=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}}},Ud=Z&&Z.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty($r,"__esModule",{value:!0});$r.LogTierV1EventProcessor=void 0;var Od=ue,zt=Co,Dd=Ud(ko),Pd=Fn,Nd=Me,xa=Od.getLogger("LogTierV1EventProcessor"),Md=function(){function e(t){var n=t.dispatcher,r=t.flushInterval,i=r===void 0?zt.DEFAULT_FLUSH_INTERVAL:r,o=t.batchSize,a=o===void 0?zt.DEFAULT_BATCH_SIZE:o,s=t.notificationCenter;this.dispatcher=n,this.notificationCenter=s,this.requestTracker=new Dd.default,i=zt.validateAndGetFlushInterval(i),a=zt.validateAndGetBatchSize(a),this.queue=zt.getQueue(a,i,this.drainQueue.bind(this),Pd.areEventContextsEqual)}return e.prototype.drainQueue=function(t){var n=this,r=new Promise(function(i){if(xa.debug("draining queue with %s events",t.length),t.length===0){i();return}var o=Nd.formatEvents(t);n.dispatcher.dispatchEvent(o,function(){i()}),zt.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){xa.error('Error stopping EventProcessor: "%s"',t.message,t)}return Promise.resolve()},e.prototype.start=function(){return Rd(this,void 0,void 0,function(){return Ad(this,function(t){return this.queue.start(),[2]})})},e}();$r.LogTierV1EventProcessor=Md;(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(Fn,e),n(Co,e),n(Gs,e),n(zs,e),n(nn,e),n(Me,e),n($r,e)})(ud);var xr={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 Ca=new Uint8Array(16);xr.exports=function(){return Sa(Ca),Ca}}else{var Ia=new Array(16);xr.exports=function(){for(var t=0,n;t<16;t++)(t&3)===0&&(n=Math.random()*4294967296),Ia[t]=n>>>((t&3)<<3)&255;return Ia}}var Xs=[];for(var Xn=0;Xn<256;++Xn)Xs[Xn]=(Xn+256).toString(16).substr(1);function Vd(e,t){var n=t||0,r=Xs;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 Js=Vd,jd=xr.exports,Bd=Js,ka,ri,ii=0,oi=0;function Fd(e,t,n){var r=t&&n||0,i=t||[];e=e||{};var o=e.node||ka,a=e.clockseq!==void 0?e.clockseq:ri;if(o==null||a==null){var s=jd();o==null&&(o=ka=[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 d=((l&268435455)*1e4+u)%4294967296;i[r++]=d>>>24&255,i[r++]=d>>>16&255,i[r++]=d>>>8&255,i[r++]=d&255;var f=l/4294967296*1e4&268435455;i[r++]=f>>>8&255,i[r++]=f&255,i[r++]=f>>>24&15|16,i[r++]=f>>>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||Bd(i)}var Hd=Fd,$d=xr.exports,Kd=Js;function qd(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||$d)();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||Kd(i)}var Gd=qd,zd=Hd,el=Gd,tl=el;tl.v1=zd;tl.v4=el;var Wd={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,d,f,p;for(a=i.length&3,s=i.length-a,l=o,c=3432918353,d=461845907,p=0;p<s;)f=i.charCodeAt(p)&255|(i.charCodeAt(++p)&255)<<8|(i.charCodeAt(++p)&255)<<16|(i.charCodeAt(++p)&255)<<24,++p,f=(f&65535)*c+(((f>>>16)*c&65535)<<16)&4294967295,f=f<<15|f>>>17,f=(f&65535)*d+(((f>>>16)*d&65535)<<16)&4294967295,l^=f,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(f=0,a){case 3:f^=(i.charCodeAt(p+2)&255)<<16;case 2:f^=(i.charCodeAt(p+1)&255)<<8;case 1:f^=i.charCodeAt(p)&255,f=(f&65535)*c+(((f>>>16)*c&65535)<<16)&4294967295,f=f<<15|f>>>17,f=(f&65535)*d+(((f>>>16)*d&65535)<<16)&4294967295,l^=f}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})()})(Wd);var nl={},To={},Lo={},ze={};Object.defineProperty(ze,"__esModule",{value:!0});ze.DEFAULT_UPDATE_INTERVAL=5*60*1e3;ze.MIN_UPDATE_INTERVAL=1e3;ze.DEFAULT_URL_TEMPLATE="https://cdn.optimizely.com/datafiles/%s.json";ze.DEFAULT_AUTHENTICATED_URL_TEMPLATE="https://config.optimizely.com/datafiles/auth/%s.json";ze.BACKOFF_BASE_WAIT_SECONDS_BY_ERROR_COUNT=[0,8,16,32,64,128,256,512];ze.REQUEST_TIMEOUT_MS=60*1e3;Object.defineProperty(Lo,"__esModule",{value:!0});var Yd=ze,Qd=ue,Zd=Qd.getLogger("DatafileManager"),Xd="GET",Jd=4;function ef(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 tf(e,t){Object.keys(e).forEach(function(n){var r=e[n];t.setRequestHeader(n,r)})}function nf(e,t){var n=new XMLHttpRequest,r=new Promise(function(i,o){n.open(Xd,e,!0),tf(t,n),n.onreadystatechange=function(){if(n.readyState===Jd){var a=n.status;if(a===0){o(new Error("Request error"));return}var s=ef(n),l={statusCode:n.status,body:n.responseText,headers:s};i(l)}},n.timeout=Yd.REQUEST_TIMEOUT_MS,n.ontimeout=function(){Zd.error("Request timed out")},n.send()});return{responsePromise:r,abort:function(){n.abort()}}}Lo.makeGetRequest=nf;var Ro={},Ao={};Object.defineProperty(Ao,"__esModule",{value:!0});var rf=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}();Ao.default=rf;var Uo={};Object.defineProperty(Uo,"__esModule",{value:!0});var ai=ze;function of(){return Math.round(Math.random()*1e3)}var af=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+of()},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}();Uo.default=af;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)},rl=Z&&Z.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Ro,"__esModule",{value:!0});var sf=ue,lf=dn,uf=rl(Ao),wn=ze,cf=rl(Uo),ke=sf.getLogger("DatafileManager"),df="update";function ff(e){return e>=wn.MIN_UPDATE_INTERVAL}function Ta(e){return e>=200&&e<400}var pf={get:function(){return Promise.resolve("")},set:function(){return Promise.resolve()},contains:function(){return Promise.resolve(!1)},remove:function(){return Promise.resolve()}},hf=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?wn.DEFAULT_UPDATE_INTERVAL:l,c=r.urlTemplate,d=c===void 0?wn.DEFAULT_URL_TEMPLATE:c,f=r.cache,p=f===void 0?pf:f;this.cache=p,this.cacheKey="opt-datafile-"+s,this.isReadyPromiseSettled=!1,this.readyPromiseResolver=function(){},this.readyPromiseRejecter=function(){},this.readyPromise=new Promise(function(v,h){n.readyPromiseResolver=v,n.readyPromiseRejecter=h}),i?(this.currentDatafile=i,s||this.resolveReadyPromise()):this.currentDatafile="",this.isStarted=!1,this.datafileUrl=lf.sprintf(d,s),this.emitter=new uf.default,this.autoUpdate=a,ff(u)?this.updateInterval=u:(ke.warn("Invalid updateInterval %s, defaulting to %s",u,wn.DEFAULT_UPDATE_INTERVAL),this.updateInterval=wn.DEFAULT_UPDATE_INTERVAL),this.currentTimeout=null,this.currentRequest=null,this.backoffController=new cf.default,this.syncOnCurrentRequestComplete=!1}return e.prototype.get=function(){return this.currentDatafile},e.prototype.start=function(){this.isStarted||(ke.debug("Datafile manager started"),this.isStarted=!0,this.backoffController.reset(),this.setDatafileFromCacheIfAvailable(),this.syncDatafile())},e.prototype.stop=function(){return ke.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?ke.error("Error fetching datafile: %s",t.message,t):typeof t=="string"?ke.error("Error fetching datafile: %s",t):ke.error("Error fetching datafile"))},e.prototype.onRequestResolved=function(t){if(!!this.isStarted){typeof t.statusCode<"u"&&Ta(t.statusCode)?this.backoffController.reset():this.backoffController.countError(),this.trySavingLastModified(t.headers);var n=this.getNextDatafileFromResponse(t);if(n!=="")if(ke.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(df,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),ke.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);ke.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 ke.debug("Response status code: %s",t.statusCode),typeof t.statusCode>"u"||t.statusCode===304?"":Ta(t.statusCode)?t.body:""},e.prototype.trySavingLastModified=function(t){var n=t["last-modified"]||t["Last-Modified"];typeof n<"u"&&(this.lastResponseLastModified=n,ke.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!==""&&(ke.debug("Using datafile from cache"),t.currentDatafile=n,t.resolveReadyPromise())})},e}();Ro.default=hf;var vf=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)}}(),mf=Z&&Z.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(To,"__esModule",{value:!0});var gf=Lo,yf=mf(Ro),_f=function(e){vf(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.makeGetRequest=function(n,r){return gf.makeGetRequest(n,r)},t.prototype.getConfigDefaults=function(){return{autoUpdate:!1}},t}(yf.default);To.default=_f;Object.defineProperty(nl,"__esModule",{value:!0});var wf=To;nl.HttpPollingDatafileManager=wf.default;var bf={NOTSET:0,DEBUG:1,INFO:2,WARNING:3,ERROR:4},Ef={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."},xf={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"'},Sf={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"},Cf="javascript-sdk",If="node-sdk",kf="react-sdk",Tf="react-native-sdk",Lf="react-native-js-sdk",Rf="4.9.4",Af="4.9.4",Uf={AB_TEST:"ab-test",FEATURE:"feature",FEATURE_TEST:"feature-test",FEATURE_VARIABLE:"feature-variable",ALL_FEATURE_VARIABLES:"all-feature-variables",FLAG:"flag"},Of={FEATURE_TEST:"feature-test",ROLLOUT:"rollout",EXPERIMENT:"experiment"},Df={RULE:"rule",EXPERIMENT:"experiment"},Pf={BOOLEAN:"boolean",DOUBLE:"double",INTEGER:"integer",STRING:"string",JSON:"json"},sr={V2:"2",V3:"3",V4:"4"},Nf={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 Mf=Object.freeze({__proto__:null,LOG_LEVEL:bf,ERROR_MESSAGES:Ef,LOG_MESSAGES:xf,CONTROL_ATTRIBUTES:Sf,JAVASCRIPT_CLIENT_ENGINE:Cf,NODE_CLIENT_ENGINE:If,REACT_CLIENT_ENGINE:kf,REACT_NATIVE_CLIENT_ENGINE:Tf,REACT_NATIVE_JS_CLIENT_ENGINE:Lf,BROWSER_CLIENT_VERSION:Rf,NODE_CLIENT_VERSION:Af,DECISION_NOTIFICATION_TYPES:Uf,DECISION_SOURCES:Of,AUDIENCE_EVALUATION_TYPES:Df,FEATURE_VARIABLE_TYPES:Pf,DATAFILE_VERSIONS:sr,DECISION_MESSAGES:Nf,get NOTIFICATION_TYPES(){return Ti}});sr.V2,sr.V3,sr.V4;(function(){function e(){}return e.prototype.log=function(){},e})();function Vf(e){return new ue.ConsoleLogHandler(e)}var La;(function(e){e.BOOLEAN="boolean",e.DOUBLE="double",e.INTEGER="integer",e.STRING="string",e.JSON="json"})(La||(La={}));var Ra;(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"})(Ra||(Ra={}));ue.getLogger();ue.getLogger();ue.getLogger();ue.getLogger();ue.getLogger("EVENT_BUILDER");ue.getLogger();ue.setLogHandler(Vf());ue.setLogLevel(ue.LogLevel.INFO);let Jn;const jf=new Uint8Array(16);function Bf(){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(jf)}const de=[];for(let e=0;e<256;++e)de.push((e+256).toString(16).slice(1));function Ff(e,t=0){return(de[e[t+0]]+de[e[t+1]]+de[e[t+2]]+de[e[t+3]]+"-"+de[e[t+4]]+de[e[t+5]]+"-"+de[e[t+6]]+de[e[t+7]]+"-"+de[e[t+8]]+de[e[t+9]]+"-"+de[e[t+10]]+de[e[t+11]]+de[e[t+12]]+de[e[t+13]]+de[e[t+14]]+de[e[t+15]]).toLowerCase()}const Hf=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),Aa={randomUUID:Hf};function at(e,t,n){if(Aa.randomUUID&&!t&&!e)return Aa.randomUUID();e=e||{};const r=e.random||(e.rng||Bf)();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 Ff(r)}const Xt="ul-app";var U=(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.SkipButton="ul-card-skip__button",e))(U||{});const Oo="#e6e6e6",Sn="#bd282a",$f=500,Kf=1030;var Te=(e=>(e.Video="video",e.Audio="audio",e.Screen="screen",e))(Te||{}),fe=(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))(fe||{}),Re=(e=>(e.Abandoned="abandoned",e.GivenUp="given.up",e.Completed="completed",e))(Re||{}),$=(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))($||{}),xe=(e=>(e.Preview="sprig.previewKey",e.Credentials="userleap.ids",e.PageViews="userleap.pageviews",e))(xe||{});const il=()=>{try{return window.parent.Intercom}catch(e){return console.error(e),null}},qf=()=>{const e=il();!e||(e.ul_wasVisible&&e("update",{hide_default_launcher:!1}),delete e.ul_wasVisible)},Gf=()=>{const e=il();!e||(e.ul_wasVisible=!!document.querySelector("iframe.intercom-launcher-frame"),e.ul_wasVisible&&e("update",{hide_default_launcher:!0}))},zf=Object.freeze(Object.defineProperty({__proto__:null,enable:qf,disable:Gf},Symbol.toStringTag,{value:"Module"})),Ua=[zf];class Li{static disable(){Ua.forEach(t=>t.disable())}static enable(){Ua.forEach(t=>t.enable())}}const Wf=1,Oa=e=>e instanceof HTMLElement||e instanceof SVGElement,ol=(e,t,n)=>{const r=e.createElement("style");n&&(r.nonce=n),r.textContent=t,r.id=U.CustomStyle,e.head.appendChild(r)},al=()=>{try{return window.parent.innerWidth}catch{return window.innerWidth}},sl=e=>{const t=e.querySelector(`.${U.CardContainer}`);let n=600,r=360;if(t){n=t.scrollHeight;const i=getComputedStyle(t),o=parseFloat(i.marginTop)+parseFloat(i.marginBottom),a=parseFloat(i.borderTopWidth)+parseFloat(i.borderBottomWidth);n+=o+a,r=t.scrollWidth;const s=parseFloat(i.marginLeft)+parseFloat(i.marginRight),l=parseFloat(i.borderLeftWidth)+parseFloat(i.borderRightWidth);r+=s+l}return[n+Wf,Math.min(r,al())]},Yf=e=>{const t=e.querySelector(`.${U.CardContainer}`);t&&(t.scrollTop=0)};var Qf=class extends Error{constructor(e,t,n){super(`Possible EventEmitter memory leak detected. ${n} ${t.toString()} listeners added. Use emitter.setMaxListeners() to increase limit`),this.emitter=e,this.type=t,this.count=n,this.name="MaxListenersExceededWarning"}},ll=class{static listenerCount(e,t){return e.listenerCount(t)}constructor(){this.events=new Map,this.maxListeners=ll.defaultMaxListeners,this.hasWarnedAboutPotentialMemoryLeak=!1}_emitInternalEvent(e,t,n){this.emit(e,t,n)}_getListeners(e){return Array.prototype.concat.apply([],this.events.get(e))||[]}_removeListener(e,t){const n=e.indexOf(t);return n>-1&&e.splice(n,1),[]}_wrapOnceListener(e,t){const n=(...r)=>(this.removeListener(e,n),t.apply(this,r));return Object.defineProperty(n,"name",{value:t.name}),n}setMaxListeners(e){return this.maxListeners=e,this}getMaxListeners(){return this.maxListeners}eventNames(){return Array.from(this.events.keys())}emit(e,...t){const n=this._getListeners(e);return n.forEach(r=>{r.apply(this,t)}),n.length>0}addListener(e,t){this._emitInternalEvent("newListener",e,t);const n=this._getListeners(e).concat(t);if(this.events.set(e,n),this.maxListeners>0&&this.listenerCount(e)>this.maxListeners&&!this.hasWarnedAboutPotentialMemoryLeak){this.hasWarnedAboutPotentialMemoryLeak=!0;const r=new Qf(this,e,this.listenerCount(e));console.warn(r)}return this}on(e,t){return this.addListener(e,t)}once(e,t){return this.addListener(e,this._wrapOnceListener(e,t))}prependListener(e,t){const n=this._getListeners(e);if(n.length>0){const r=[t].concat(n);this.events.set(e,r)}else this.events.set(e,n.concat(t));return this}prependOnceListener(e,t){return this.prependListener(e,this._wrapOnceListener(e,t))}removeListener(e,t){const n=this._getListeners(e);return n.length>0&&(this._removeListener(n,t),this.events.set(e,n),this._emitInternalEvent("removeListener",e,t)),this}off(e,t){return this.removeListener(e,t)}removeAllListeners(e){return e?this.events.delete(e):this.events.clear(),this}listeners(e){return Array.from(this._getListeners(e))}listenerCount(e){return this._getListeners(e).length}rawListeners(e){return this.listeners(e)}},ul=ll;ul.defaultMaxListeners=10;const F=new ul;var bn=(e=>(e.BottomLeft="bottomLeft",e.BottomRight="bottomRight",e.Center="center",e.TopLeft="topLeft",e.TopRight="topRight",e))(bn||{}),Ke=(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))(Ke||{}),Vt=(e=>(e.Email="email",e.Link="link",e.Web="web",e))(Vt||{}),yt=(e=>(e.Npm="web-npm",e.NpmBundled="web-npm-bundled",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))(yt||{});const Cr=e=>new Promise(t=>{setTimeout(()=>{t()},e)}),Jt=({"userleap-platform":e})=>e!==Vt.Web,oe=(e,t)=>{const n=t?U.MobileSuffix:U.DesktopSuffix;return[e+n,e]},Zf=(e,t)=>[e,`${e}__${t}`];class cl{constructor(t){ie(this,"storage");ie(this,"tempStorage",{});ie(this,"isStorageAvailable");this.storage=window[t],this.isStorageAvailable=this.checkIfStorageAvailable()}checkIfStorageAvailable(){try{const t="__storage_test__";return this.storage.setItem(t,t),this.storage.removeItem(t),!0}catch{return!1}}setItem(t,n){this.isStorageAvailable?this.storage.setItem(t,n):this.tempStorage[t]=n}getItem(t){return this.isStorageAvailable?this.storage.getItem(t):this.tempStorage[t]}removeItem(t){this.isStorageAvailable?this.storage.removeItem(t):delete this.tempStorage[t]}clear(){this.isStorageAvailable?this.storage.clear():this.tempStorage={}}}const _t=new cl("sessionStorage"),Ee=new cl("localStorage");class Xf{constructor(t){ie(this,"payload");ie(this,"promise");ie(this,"reject",()=>{});ie(this,"resolve",()=>{});this.payload=t,this.promise=new Promise((n,r)=>{this.reject=r,this.resolve=n})}resolveRequest(t){this.resolve(t)}}const Jf={RATELIMIT_RESET_DEFAULT:10};let dl=!1,fl="",er=!1,pl=!1,lr=[];const ep=e=>e._config&&e._config.installationMethod?e._config.installationMethod:e._gtm?yt.Gtm:e._segment?yt.Segment:yt.Snippet,Ri=e=>{var t;(t=e==null?void 0:e.blockedURI)!=null&&t.includes(window.UserLeap._API_URL)&&(pl=!0,console.warn(`[Sprig] ${e.blockedURI} is blocked by Content-Security-Policy`),document.removeEventListener("securitypolicyviolation",Ri))},Ai=(e="")=>{dl=!0,fl=e};function rn(e={}){const t={"Content-Type":"application/json","userleap-platform":Vt.Web,"x-ul-sdk-version":"2.25.1",[Ke.InstallationMethod]:ep(e)};if(e.envId&&(t[Ke.EnvironmentID]=e.envId),e.token&&(t.Authorization="Bearer "+e.token),e.userId&&(t[Ke.UserID]=e.userId),e.visitorId&&(t[Ke.VisitorID]=e.visitorId),e.partnerAnonymousId&&(t[Ke.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[Ke.PreviewMode]="1"),t}const Da=async(e,t,n)=>{if(e)return{status:429};{const r=new Xf(n);return lr.push(r),r.promise}},rt=async(e,t,n=0,r=!1,i=!1)=>{const o={url:e,options:t,attempt:n,shouldDropOnRateLimit:r};if(er&&!i)return Da(r,i,o);const a={ok:!1,reportError:!1};if(dl)return console.info(`UserLeap - ${fl}`),a;try{t.headers=Object.assign(rn(),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")):Jf.RATELIMIT_RESET_DEFAULT;return await Cr(u*1e3),rt(e,t,0,r,!0)}else return Da(r,!1,o);if(er=!1,lr.length&&(lr.map(l=>{const{url:u,options:c,attempt:d,shouldDropOnRateLimit:f}=l.payload;rt(u,c,d,f).then(p=>{l.resolveRequest(p)})}),lr=[]),s.ok){if(s.status===249)return Ai(),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||pl?{ok:!1,reportError:!1,error:s}:(await Cr(Math.pow(2,n)*1e3),rt(e,t,l))}};var hl={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 d=a.retries,f=a.retryDelay,p=a.retryOn;if(c&&c.retries!==void 0)if(r(c.retries))d=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")f=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(v,h){var g=function(w){var E=typeof Request<"u"&&u instanceof Request?u.clone():u;o(E,c).then(function(b){if(Array.isArray(p)&&p.indexOf(b.status)===-1)v(b);else if(typeof p=="function")try{return Promise.resolve(p(w,null,b)).then(function(m){m?_(w,null,b):v(b)}).catch(h)}catch(m){h(m)}else w<d?_(w,null,b):v(b)}).catch(function(b){if(typeof p=="function")try{Promise.resolve(p(w,b,null)).then(function(m){m?_(w,b,null):h(b)}).catch(function(m){h(m)})}catch(m){h(m)}else w<d?_(w,b,null):h(b)})};function _(w,E,b){var m=typeof f=="function"?f(w,E,b):f;setTimeout(function(){g(++w)},m)}g(0)})}};function r(o){return Number.isInteger(o)&&o>=0}function i(o){this.name="ArgumentError",this.message=o}return n})})(hl);const tp=hl.exports;class np{constructor(t){ie(this,"awaitingResolvers",[]);ie(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 vl=new np(2),rp=e=>vl.setLimit(e),ip=tp(fetch),op=async(e,t=3)=>vl.execute(async()=>{const r=(await ip(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}),ml=async({apiUrl:e,surveyId:t,uploadId:n,etags:r,headers:i,responseGroupUuid:o,replayDuration:a,eventDigest:s},l=!1)=>{var u;if(!(!l&&!n&&!r))return rt(`${e}/sdk/1/completeSessionReplay`,{method:"POST",body:JSON.stringify({etags:r,uploadId:n,responseGroupUuid:o,surveyId:t,replayDuration:a,eventDigest:s,userAgent:(u=window==null?void 0:window.navigator)==null?void 0:u.userAgent}),headers:i})};/*! *****************************************************************************
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.
@@ -10,13 +10,13 @@ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
10
10
  LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
11
11
  OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
12
12
  PERFORMANCE OF THIS SOFTWARE.
13
- ***************************************************************************** */var H=function(){return H=Object.assign||function(t){for(var n,r=1,i=arguments.length;r<i;r++){n=arguments[r];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(t[o]=n[o])}return t},H.apply(this,arguments)};function Li(e,t,n){if(n||arguments.length===2)for(var r=0,i=t.length,o;r<i;r++)(o||!(r in t))&&(o||(o=Array.prototype.slice.call(t,0,r)),o[r]=t[r]);return e.concat(o||Array.prototype.slice.call(t))}var Q=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,re=Object.keys,ve=Array.isArray;typeof Promise<"u"&&!Q.Promise&&(Q.Promise=Promise);function ge(e,t){return typeof t!="object"||re(t).forEach(function(n){e[n]=t[n]}),e}var Rn=Object.getPrototypeOf,Yf={}.hasOwnProperty;function Ee(e,t){return Yf.call(e,t)}function tn(e,t){typeof t=="function"&&(t=t(Rn(e))),(typeof Reflect>"u"?re:Reflect.ownKeys)(t).forEach(function(n){st(e,n,t[n])})}var ll=Object.defineProperty;function st(e,t,n,r){ll(e,t,ge(n&&Ee(n,"get")&&typeof n.get=="function"?{get:n.get,set:n.set,configurable:!0}:{value:n,configurable:!0,writable:!0},r))}function un(e){return{from:function(t){return e.prototype=Object.create(t.prototype),st(e.prototype,"constructor",e),{extend:tn.bind(null,e.prototype)}}}}var Qf=Object.getOwnPropertyDescriptor;function Lo(e,t){var n=Qf(e,t),r;return n||(r=Rn(e))&&Lo(r,t)}var Zf=[].slice;function Kr(e,t,n){return Zf.call(e,t,n)}function ul(e,t){return t(e)}function wn(e){if(!e)throw new Error("Assertion Failed")}function cl(e){Q.setImmediate?setImmediate(e):setTimeout(e,0)}function dl(e,t){return e.reduce(function(n,r,i){var o=t(r,i);return o&&(n[o[0]]=o[1]),n},{})}function Xf(e,t,n){try{e.apply(null,n)}catch(r){t&&t(r)}}function ot(e,t){if(Ee(e,t))return e[t];if(!t)return e;if(typeof t!="string"){for(var n=[],r=0,i=t.length;r<i;++r){var o=ot(e,t[r]);n.push(o)}return n}var a=t.indexOf(".");if(a!==-1){var s=e[t.substr(0,a)];return s===void 0?void 0:ot(s,t.substr(a+1))}}function Ne(e,t,n){if(!(!e||t===void 0)&&!("isFrozen"in Object&&Object.isFrozen(e)))if(typeof t!="string"&&"length"in t){wn(typeof n!="string"&&"length"in n);for(var r=0,i=t.length;r<i;++r)Ne(e,t[r],n[r])}else{var o=t.indexOf(".");if(o!==-1){var a=t.substr(0,o),s=t.substr(o+1);if(s==="")n===void 0?ve(e)&&!isNaN(parseInt(a))?e.splice(a,1):delete e[a]:e[a]=n;else{var l=e[a];(!l||!Ee(e,a))&&(l=e[a]={}),Ne(l,s,n)}}else n===void 0?ve(e)&&!isNaN(parseInt(t))?e.splice(t,1):delete e[t]:e[t]=n}}function Jf(e,t){typeof t=="string"?Ne(e,t,void 0):"length"in t&&[].map.call(t,function(n){Ne(e,n,void 0)})}function fl(e){var t={};for(var n in e)Ee(e,n)&&(t[n]=e[n]);return t}var ep=[].concat;function pl(e){return ep.apply([],e)}var hl="Boolean,String,Date,RegExp,Blob,File,FileList,FileSystemFileHandle,ArrayBuffer,DataView,Uint8ClampedArray,ImageBitmap,ImageData,Map,Set,CryptoKey".split(",").concat(pl([8,16,32,64].map(function(e){return["Int","Uint","Float"].map(function(t){return t+e+"Array"})}))).filter(function(e){return Q[e]}),tp=hl.map(function(e){return Q[e]});dl(hl,function(e){return[e,!0]});var dt=null;function Bn(e){dt=typeof WeakMap<"u"&&new WeakMap;var t=Ri(e);return dt=null,t}function Ri(e){if(!e||typeof e!="object")return e;var t=dt&&dt.get(e);if(t)return t;if(ve(e)){t=[],dt&&dt.set(e,t);for(var n=0,r=e.length;n<r;++n)t.push(Ri(e[n]))}else if(tp.indexOf(e.constructor)>=0)t=e;else{var i=Rn(e);t=i===Object.prototype?{}:Object.create(i),dt&&dt.set(e,t);for(var o in e)Ee(e,o)&&(t[o]=Ri(e[o]))}return t}var np={}.toString;function Ai(e){return np.call(e).slice(8,-1)}var Ui=typeof Symbol<"u"?Symbol.iterator:"@@iterator",rp=typeof Ui=="symbol"?function(e){var t;return e!=null&&(t=e[Ui])&&t.apply(e)}:function(){return null},qt={};function Ze(e){var t,n,r,i;if(arguments.length===1){if(ve(e))return e.slice();if(this===qt&&typeof e=="string")return[e];if(i=rp(e)){for(n=[];r=i.next(),!r.done;)n.push(r.value);return n}if(e==null)return[e];if(t=e.length,typeof t=="number"){for(n=new Array(t);t--;)n[t]=e[t];return n}return[e]}for(t=arguments.length,n=new Array(t);t--;)n[t]=arguments[t];return n}var Ro=typeof Symbol<"u"?function(e){return e[Symbol.toStringTag]==="AsyncFunction"}:function(){return!1},Ge=typeof location<"u"&&/^(http|https):\/\/(localhost|127\.0\.0\.1)/.test(location.href);function vl(e,t){Ge=e,ml=t}var ml=function(){return!0},ip=!new Error("").stack;function Bt(){if(ip)try{throw Bt.arguments,new Error}catch(e){return e}return new Error}function Oi(e,t){var n=e.stack;return n?(t=t||0,n.indexOf(e.name)===0&&(t+=(e.name+e.message).split(`
13
+ ***************************************************************************** */var K=function(){return K=Object.assign||function(t){for(var n,r=1,i=arguments.length;r<i;r++){n=arguments[r];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(t[o]=n[o])}return t},K.apply(this,arguments)};function Ui(e,t,n){if(n||arguments.length===2)for(var r=0,i=t.length,o;r<i;r++)(o||!(r in t))&&(o||(o=Array.prototype.slice.call(t,0,r)),o[r]=t[r]);return e.concat(o||Array.prototype.slice.call(t))}var Y=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,ne=Object.keys,he=Array.isArray;typeof Promise<"u"&&!Y.Promise&&(Y.Promise=Promise);function me(e,t){return typeof t!="object"||ne(t).forEach(function(n){e[n]=t[n]}),e}var Un=Object.getPrototypeOf,ap={}.hasOwnProperty;function Se(e,t){return ap.call(e,t)}function on(e,t){typeof t=="function"&&(t=t(Un(e))),(typeof Reflect>"u"?ne:Reflect.ownKeys)(t).forEach(function(n){st(e,n,t[n])})}var gl=Object.defineProperty;function st(e,t,n,r){gl(e,t,me(n&&Se(n,"get")&&typeof n.get=="function"?{get:n.get,set:n.set,configurable:!0}:{value:n,configurable:!0,writable:!0},r))}function fn(e){return{from:function(t){return e.prototype=Object.create(t.prototype),st(e.prototype,"constructor",e),{extend:on.bind(null,e.prototype)}}}}var sp=Object.getOwnPropertyDescriptor;function Do(e,t){var n=sp(e,t),r;return n||(r=Un(e))&&Do(r,t)}var lp=[].slice;function Kr(e,t,n){return lp.call(e,t,n)}function yl(e,t){return t(e)}function En(e){if(!e)throw new Error("Assertion Failed")}function _l(e){Y.setImmediate?setImmediate(e):setTimeout(e,0)}function wl(e,t){return e.reduce(function(n,r,i){var o=t(r,i);return o&&(n[o[0]]=o[1]),n},{})}function up(e,t,n){try{e.apply(null,n)}catch(r){t&&t(r)}}function it(e,t){if(Se(e,t))return e[t];if(!t)return e;if(typeof t!="string"){for(var n=[],r=0,i=t.length;r<i;++r){var o=it(e,t[r]);n.push(o)}return n}var a=t.indexOf(".");if(a!==-1){var s=e[t.substr(0,a)];return s===void 0?void 0:it(s,t.substr(a+1))}}function Ve(e,t,n){if(!(!e||t===void 0)&&!("isFrozen"in Object&&Object.isFrozen(e)))if(typeof t!="string"&&"length"in t){En(typeof n!="string"&&"length"in n);for(var r=0,i=t.length;r<i;++r)Ve(e,t[r],n[r])}else{var o=t.indexOf(".");if(o!==-1){var a=t.substr(0,o),s=t.substr(o+1);if(s==="")n===void 0?he(e)&&!isNaN(parseInt(a))?e.splice(a,1):delete e[a]:e[a]=n;else{var l=e[a];(!l||!Se(e,a))&&(l=e[a]={}),Ve(l,s,n)}}else n===void 0?he(e)&&!isNaN(parseInt(t))?e.splice(t,1):delete e[t]:e[t]=n}}function cp(e,t){typeof t=="string"?Ve(e,t,void 0):"length"in t&&[].map.call(t,function(n){Ve(e,n,void 0)})}function bl(e){var t={};for(var n in e)Se(e,n)&&(t[n]=e[n]);return t}var dp=[].concat;function El(e){return dp.apply([],e)}var xl="Boolean,String,Date,RegExp,Blob,File,FileList,FileSystemFileHandle,ArrayBuffer,DataView,Uint8ClampedArray,ImageBitmap,ImageData,Map,Set,CryptoKey".split(",").concat(El([8,16,32,64].map(function(e){return["Int","Uint","Float"].map(function(t){return t+e+"Array"})}))).filter(function(e){return Y[e]}),fp=xl.map(function(e){return Y[e]});wl(xl,function(e){return[e,!0]});var pt=null;function Hn(e){pt=typeof WeakMap<"u"&&new WeakMap;var t=Oi(e);return pt=null,t}function Oi(e){if(!e||typeof e!="object")return e;var t=pt&&pt.get(e);if(t)return t;if(he(e)){t=[],pt&&pt.set(e,t);for(var n=0,r=e.length;n<r;++n)t.push(Oi(e[n]))}else if(fp.indexOf(e.constructor)>=0)t=e;else{var i=Un(e);t=i===Object.prototype?{}:Object.create(i),pt&&pt.set(e,t);for(var o in e)Se(e,o)&&(t[o]=Oi(e[o]))}return t}var pp={}.toString;function Di(e){return pp.call(e).slice(8,-1)}var Pi=typeof Symbol<"u"?Symbol.iterator:"@@iterator",hp=typeof Pi=="symbol"?function(e){var t;return e!=null&&(t=e[Pi])&&t.apply(e)}:function(){return null},Qt={};function Xe(e){var t,n,r,i;if(arguments.length===1){if(he(e))return e.slice();if(this===Qt&&typeof e=="string")return[e];if(i=hp(e)){for(n=[];r=i.next(),!r.done;)n.push(r.value);return n}if(e==null)return[e];if(t=e.length,typeof t=="number"){for(n=new Array(t);t--;)n[t]=e[t];return n}return[e]}for(t=arguments.length,n=new Array(t);t--;)n[t]=arguments[t];return n}var Po=typeof Symbol<"u"?function(e){return e[Symbol.toStringTag]==="AsyncFunction"}:function(){return!1},We=typeof location<"u"&&/^(http|https):\/\/(localhost|127\.0\.0\.1)/.test(location.href);function Sl(e,t){We=e,Cl=t}var Cl=function(){return!0},vp=!new Error("").stack;function Kt(){if(vp)try{throw Kt.arguments,new Error}catch(e){return e}return new Error}function Ni(e,t){var n=e.stack;return n?(t=t||0,n.indexOf(e.name)===0&&(t+=(e.name+e.message).split(`
14
14
  `).length),n.split(`
15
- `).slice(t).filter(ml).map(function(r){return`
16
- `+r}).join("")):""}var op=["Modify","Bulk","OpenFailed","VersionChange","Schema","Upgrade","InvalidTable","MissingAPI","NoSuchDatabase","InvalidArgument","SubTransaction","Unsupported","Internal","DatabaseClosed","PrematureCommit","ForeignAwait"],gl=["Unknown","Constraint","Data","TransactionInactive","ReadOnly","Version","NotFound","InvalidState","InvalidAccess","Abort","Timeout","QuotaExceeded","Syntax","DataClone"],Ao=op.concat(gl),ap={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 cn(e,t){this._e=Bt(),this.name=e,this.message=t}un(cn).from(Error).extend({stack:{get:function(){return this._stack||(this._stack=this.name+": "+this.message+Oi(this._e,2))}},toString:function(){return this.name+": "+this.message}});function yl(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
- `)}function Cr(e,t,n,r){this._e=Bt(),this.failures=t,this.failedKeys=r,this.successCount=n,this.message=yl(e,t)}un(Cr).from(cn);function Sn(e,t){this._e=Bt(),this.name="BulkError",this.failures=Object.keys(t).map(function(n){return t[n]}),this.failuresByPos=t,this.message=yl(e,t)}un(Sn).from(cn);var Uo=Ao.reduce(function(e,t){return e[t]=t+"Error",e},{}),sp=cn,j=Ao.reduce(function(e,t){var n=t+"Error";function r(i,o){this._e=Bt(),this.name=n,i?typeof i=="string"?(this.message=""+i+(o?`
18
- `+o:""),this.inner=o||null):typeof i=="object"&&(this.message=i.name+" "+i.message,this.inner=i):(this.message=ap[t]||n,this.inner=null)}return un(r).from(sp),e[t]=r,e},{});j.Syntax=SyntaxError;j.Type=TypeError;j.Range=RangeError;var Ta=gl.reduce(function(e,t){return e[t+"Error"]=j[t],e},{});function lp(e,t){if(!e||e instanceof cn||e instanceof TypeError||e instanceof SyntaxError||!e.name||!Ta[e.name])return e;var n=new Ta[e.name](t||e.message,e);return"stack"in e&&st(n,"stack",{get:function(){return this.inner.stack}}),n}var $r=Ao.reduce(function(e,t){return["Syntax","Type","Range"].indexOf(t)===-1&&(e[t+"Error"]=j[t]),e},{});$r.ModifyError=Cr;$r.DexieError=cn;$r.BulkError=Sn;function W(){}function Fn(e){return e}function up(e,t){return e==null||e===Fn?t:function(n){return t(e(n))}}function Nt(e,t){return function(){e.apply(this,arguments),t.apply(this,arguments)}}function cp(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 dp(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 fp(e,t){return e===W?t:function(n){var r=e.apply(this,arguments);ge(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:ge(r,a)}}function pp(e,t){return e===W?t:function(){return t.apply(this,arguments)===!1?!1:e.apply(this,arguments)}}function Oo(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 An={},hp=100,vp=20,_l=100,Do=typeof Promise>"u"?[]:function(){var e=Promise.resolve();if(typeof crypto>"u"||!crypto.subtle)return[e,Rn(e),e];var t=crypto.subtle.digest("SHA-512",new Uint8Array([0]));return[t,Rn(t),e]}(),Di=Do[0],Ir=Do[1],Pi=Do[2],wl=Ir&&Ir.then,lr=Di&&Di.constructor,Po=!!Pi,Ni=!1,mp=Pi?function(){Pi.then(er)}:Q.setImmediate?setImmediate.bind(null,er):Q.MutationObserver?function(){var e=document.createElement("div");new MutationObserver(function(){er(),e=null}).observe(e,{attributes:!0}),e.setAttribute("i","1")}:function(){setTimeout(er,0)},Un=function(e,t){bn.push([e,t]),kr&&(mp(),kr=!1)},Vi=!0,kr=!0,Ot=[],ur=[],Mi=null,ji=Fn,Yt={id:"global",global:!0,ref:0,unhandleds:[],onunhandled:Aa,pgp:!1,env:{},finalize:function(){this.unhandleds.forEach(function(e){try{Aa(e[0],e[1])}catch{}})}},V=Yt,bn=[],Dt=0,cr=[];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=V;if(Ge&&(this._stackHolder=Bt(),this._prev=null,this._numPrev=0),typeof e!="function"){if(e!==An)throw new TypeError("Not a function");this._state=arguments[1],this._value=arguments[2],this._state===!1&&Fi(this,this._value);return}this._state=null,this._value=null,++t.ref,El(this,e)}var Bi={get:function(){var e=V,t=Tr;function n(r,i){var o=this,a=!e.global&&(e!==V||t!==Tr),s=a&&!lt(),l=new A(function(u,c){No(o,new bl(Rr(r,e,a,s),Rr(i,e,a,s),u,c,e))});return Ge&&Cl(l,this),l}return n.prototype=An,n},set:function(e){st(this,"then",e&&e.prototype===An?Bi:{get:function(){return e},set:Bi.set})}};tn(A.prototype,{then:Bi,_then:function(e,t){No(this,new bl(null,null,e,t,V))},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):dr(r)}):this.then(null,function(r){return r&&r.name===t?n(r):dr(r)})},finally:function(e){return this.then(function(t){return e(),t},function(t){return e(),dr(t)})},stack:{get:function(){if(this._stack)return this._stack;try{Ni=!0;var e=Sl(this,[],vp),t=e.join(`
19
- From previous: `);return this._state!==null&&(this._stack=t),t}finally{Ni=!1}}},timeout:function(e,t){var n=this;return e<1/0?new A(function(r,i){var o=setTimeout(function(){return i(new j.Timeout(t))},e);n.then(r,i).finally(clearTimeout.bind(null,o))}):this}});typeof Symbol<"u"&&Symbol.toStringTag&&st(A.prototype,Symbol.toStringTag,"Dexie.Promise");Yt.env=Il();function bl(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}tn(A,{all:function(){var e=Ze.apply(null,arguments).map(Lr);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(An,!0,e);return Cl(t,Mi),t},reject:dr,race:function(){var e=Ze.apply(null,arguments).map(Lr);return new A(function(t,n){e.map(function(r){return A.resolve(r).then(t,n)})})},PSD:{get:function(){return V},set:function(e){return V=e}},totalEchoes:{get:function(){return Tr}},newPSD:gt,usePSD:fn,scheduler:{get:function(){return Un},set:function(e){Un=e}},rejectionMapper:{get:function(){return ji},set:function(e){ji=e}},follow:function(e,t){return new A(function(n,r){return gt(function(i,o){var a=V;a.unhandleds=[],a.onunhandled=o,a.finalize=Nt(function(){var s=this;yp(function(){s.unhandleds.length===0?i():o(s.unhandleds[0])})},a.finalize),e()},t,n,r)})}});lr&&(lr.allSettled&&st(A,"allSettled",function(){var e=Ze.apply(null,arguments).map(Lr);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)})})})}),lr.any&&typeof AggregateError<"u"&&st(A,"any",function(){var e=Ze.apply(null,arguments).map(Lr);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 El(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&&Hn();n&&typeof n.then=="function"?El(e,function(i,o){n instanceof A?n._then(i,o):n.then(i,o)}):(e._state=!0,e._value=n,xl(e)),r&&Kn()}},Fi.bind(null,e))}catch(n){Fi(e,n)}}function Fi(e,t){if(ur.push(t),e._state===null){var n=e._lib&&Hn();t=ji(t),e._state=!1,e._value=t,Ge&&t!==null&&typeof t=="object"&&!t._promise&&Xf(function(){var r=Lo(t,"stack");t._promise=e,st(t,"stack",{get:function(){return Ni?r&&(r.get?r.get.apply(t):r.value):e.stack}})}),_p(e),xl(e),n&&Kn()}}function xl(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(),Dt===0&&(++Dt,Un(function(){--Dt===0&&Vo()},[]))}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,++Dt,Un(gp,[n,e,t])}function gp(e,t,n){try{Mi=t;var r,i=t._value;t._state?r=e(i):(ur.length&&(ur=[]),r=e(i),ur.indexOf(i)===-1&&wp(t)),n.resolve(r)}catch(o){n.reject(o)}finally{Mi=null,--Dt===0&&Vo(),--n.psd.ref||n.psd.finalize()}}function Sl(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=Oi(i,0)):(o=i,a=""),t.push(o+(a?": "+a:"")+r)}return Ge&&(r=Oi(e._stackHolder,2),r&&t.indexOf(r)===-1&&t.push(r),e._prev&&Sl(e._prev,t,n)),t}function Cl(e,t){var n=t?t._numPrev+1:0;n<hp&&(e._prev=t,e._numPrev=n)}function er(){Hn()&&Kn()}function Hn(){var e=Vi;return Vi=!1,kr=!1,e}function Kn(){var e,t,n;do for(;bn.length>0;)for(e=bn,bn=[],n=e.length,t=0;t<n;++t){var r=e[t];r[0].apply(null,r[1])}while(bn.length>0);Vi=!0,kr=!0}function Vo(){var e=Ot;Ot=[],e.forEach(function(r){r._PSD.onunhandled.call(null,r._value,r)});for(var t=cr.slice(0),n=t.length;n;)t[--n]()}function yp(e){function t(){e(),cr.splice(cr.indexOf(t),1)}cr.push(t),++Dt,Un(function(){--Dt===0&&Vo()},[])}function _p(e){Ot.some(function(t){return t._value===e._value})||Ot.push(e)}function wp(e){for(var t=Ot.length;t;)if(Ot[--t]._value===e._value){Ot.splice(t,1);return}}function dr(e){return new A(An,!1,e)}function J(e,t){var n=V;return function(){var r=Hn(),i=V;try{return yt(n,!0),e.apply(this,arguments)}catch(o){t&&t(o)}finally{yt(i,!1),r&&Kn()}}}var he={awaits:0,echoes:0,id:0},bp=0,fr=[],oi=0,Tr=0,Ep=0;function gt(e,t,n,r){var i=V,o=Object.create(i);o.parent=i,o.ref=0,o.global=!1,o.id=++Ep;var a=Yt.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:La(a.nthen,o),gthen:La(a.gthen,o)}:{},t&&ge(o,t),++i.ref,o.finalize=function(){--this.parent.ref||this.parent.finalize()};var s=fn(o,e,n,r);return o.ref===0&&o.finalize(),s}function dn(){return he.id||(he.id=++bp),++he.awaits,he.echoes+=_l,he.id}function lt(){return he.awaits?(--he.awaits===0&&(he.id=0),he.echoes=he.awaits*_l,!0):!1}(""+wl).indexOf("[native code]")===-1&&(dn=lt=W);function Lr(e){return he.echoes&&e&&e.constructor===lr?(dn(),e.then(function(t){return lt(),t},function(t){return lt(),oe(t)})):e}function xp(e){++Tr,(!he.echoes||--he.echoes===0)&&(he.echoes=he.id=0),fr.push(V),yt(e,!0)}function Sp(){var e=fr[fr.length-1];fr.pop(),yt(e,!1)}function yt(e,t){var n=V;if((t?he.echoes&&(!oi++||e!==V):oi&&(!--oi||e!==V))&&kl(t?xp.bind(null,e):Sp),e!==V&&(V=e,n===Yt&&(Yt.env=Il()),Po)){var r=Yt.env.Promise,i=e.env;Ir.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 Il(){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:Ir.then,gthen:e.prototype.then}:{}}function fn(e,t,n,r,i){var o=V;try{return yt(e,!0),t(n,r,i)}finally{yt(o,!1)}}function kl(e){wl.call(Di,e)}function Rr(e,t,n,r){return typeof e!="function"?e:function(){var i=V;n&&dn(),yt(t,!0);try{return e.apply(this,arguments)}finally{yt(i,!1),r&&kl(lt)}}}function La(e,t){return function(n,r){return e.call(this,Rr(n,t),Rr(r,t))}}var Ra="unhandledrejection";function Aa(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(Ra,!0,!0),ge(r,i)):Q.CustomEvent&&(r=new CustomEvent(Ra,{detail:i}),ge(r,i)),r&&Q.dispatchEvent&&(dispatchEvent(r),!Q.PromiseRejectionEvent&&Q.onunhandledrejection))try{Q.onunhandledrejection(r)}catch{}Ge&&r&&!r.defaultPrevented&&console.warn("Unhandled rejection: "+(e.stack||e))}catch{}}var oe=A.reject;function Hi(e,t,n,r){if(!e.idbdb||!e._state.openComplete&&!V.letThrough&&!e._vip){if(e._state.openComplete)return oe(new j.DatabaseClosed(e._state.dbOpenError));if(!e._state.isBeingOpened){if(!e._options.autoOpen)return oe(new j.DatabaseClosed);e.open().catch(W)}return e._state.dbReadyPromise.then(function(){return Hi(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===Uo.InvalidState&&e.isOpen()&&--e._state.PR1398_maxLoop>0?(console.warn("Dexie: Need to reopen db"),e._close(),e.open().then(function(){return Hi(e,t,n,r)})):oe(o)}return i._promise(t,function(o,a){return gt(function(){return V.trans=i,r(o,a,i)})}).then(function(o){return i._completion.then(function(){return o})})}}var Ua="3.2.4",Rt=String.fromCharCode(65535),Ki=-1/0,We="Invalid key provided. Keys must be of type string, number, Date or Array<string | number | Date>.",Tl="String expected.",Cn=[],qr=typeof navigator<"u"&&/(MSIE|Trident|Edge)/.test(navigator.userAgent),Cp=qr,Ip=qr,Ll=function(e){return!/(dexie\.js|dexie\.min\.js)/.test(e)},Gr="__dbnames",ai="readonly",si="readwrite";function Vt(e,t){return e?t?function(){return e.apply(this,arguments)&&t.apply(this,arguments)}:e:t}var Rl={type:3,lower:-1/0,lowerOpen:!1,upper:[[]],upperOpen:!1};function tr(e){return typeof e=="string"&&!/\./.test(e)?function(t){return t[e]===void 0&&e in t&&(t=Bn(t),delete t[e]),t}:function(t){return t}}var kp=function(){function e(){}return e.prototype._trans=function(t,n,r){var i=this._tx||V.trans,o=this.name;function a(l,u,c){if(!c.schema[o])throw new j.NotFound("Table "+o+" not part of transaction");return n(c.idbtrans,c)}var s=Hn();try{return i&&i.db===this.db?i===V.trans?i._promise(t,a,r):gt(function(){return i._promise(t,a,r)},{trans:i,transless:V.transless||V}):Hi(this.db,t,[this.name],a)}finally{s&&Kn()}},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(ve(t))return new this.db.WhereClause(this,"["+t.join("+")+"]");var n=re(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(d){return c.keyPath.indexOf(d)>=0})&&c.keyPath.every(function(d){return n.indexOf(d)>=0})})[0];if(r&&this.db._maxKey!==Rt)return this.where(r.name).equals(r.keyPath.map(function(c){return t[c]}));!r&&Ge&&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,d){try{return o.cmp(c,d)===0}catch{return!1}}var s=n.reduce(function(c,d){var f=c[0],p=c[1],h=i[d],v=t[d];return[f||h,f||!h?Vt(p,h&&h.multi?function(g){var w=ot(g,d);return ve(w)&&w.some(function(_){return a(v,_)})}:function(g){return a(v,ot(g,d))}):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,ve(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(Ee(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){ge(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=tr(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{Ne(t,a,l)}catch{}return l})},e.prototype.update=function(t,n){if(typeof t=="object"&&!ve(t)){var r=ot(t,this.schema.primKey.keyPath);if(r===void 0)return oe(new j.InvalidArgument("Given object does not contain its primary key"));try{typeof n!="function"?re(n).forEach(function(i){Ne(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=tr(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{Ne(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:Rl})}).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 j.InvalidArgument("bulkAdd(): keys argument invalid on tables with inbound keys");if(o&&o.length!==t.length)throw new j.InvalidArgument("Arguments objects and keys must have the same length");var d=t.length,f=c&&u?t.map(tr(c)):t;return i.core.mutate({trans:s,type:"add",keys:o,values:f,wantResults:a}).then(function(p){var h=p.numFailures,v=p.results,g=p.lastResult,w=p.failures,_=a?v:g;if(h===0)return _;throw new Sn(i.name+".bulkAdd(): "+h+" of "+d+" 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 j.InvalidArgument("bulkPut(): keys argument invalid on tables with inbound keys");if(o&&o.length!==t.length)throw new j.InvalidArgument("Arguments objects and keys must have the same length");var d=t.length,f=c&&u?t.map(tr(c)):t;return i.core.mutate({trans:s,type:"put",keys:o,values:f,wantResults:a}).then(function(p){var h=p.numFailures,v=p.results,g=p.lastResult,w=p.failures,_=a?v:g;if(h===0)return _;throw new Sn(i.name+".bulkPut(): "+h+" of "+d+" 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 Sn(n.name+".bulkDelete(): "+o+" of "+r+" operations failed",s)})},e}();function $n(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=pp),u||(u=W);var c={subscribers:[],fire:u,subscribe:function(d){c.subscribers.indexOf(d)===-1&&(c.subscribers.push(d),c.fire=l(c.fire,d))},unsubscribe:function(d){c.subscribers=c.subscribers.filter(function(f){return f!==d}),c.fire=c.subscribers.reduce(l,u)}};return t[s]=n[s]=c,c}function a(s){re(s).forEach(function(l){var u=s[l];if(ve(u))o(l,s[l][0],s[l][1]);else if(u==="asap")var c=o(l,Fn,function(){for(var f=arguments.length,p=new Array(f);f--;)p[f]=arguments[f];c.subscribers.forEach(function(h){cl(function(){h.apply(null,p)})})});else throw new j.InvalidArgument("Invalid event config")})}}function qn(e,t){return un(t).from({prototype:e}),t}function Tp(e){return qn(kp.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:$n(null,{creating:[cp,W],reading:[up,Fn],updating:[fp,W],deleting:[dp,W]})})}function Kt(e,t){return!(e.filter||e.algorithm||e.or)&&(t?e.justLimit:!e.replayFilter)}function li(e,t){e.filter=Vt(e.filter,t)}function ui(e,t,n){var r=e.replayFilter;e.replayFilter=r?function(){return Vt(r(),t())}:t,e.justLimit=n&&!r}function Lp(e,t){e.isMatch=Vt(e.isMatch,t)}function pr(e,t){if(e.isPrimKey)return t.primaryKey;var n=t.getIndexByKeyPath(e.index);if(!n)throw new j.Schema("KeyPath "+e.index+" on object store "+t.name+" is not indexed");return n}function Oa(e,t,n){var r=pr(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 nr(e,t,n,r){var i=e.replayFilter?Vt(e.filter,e.replayFilter()):e.filter;if(e.or){var o={},a=function(s,l,u){if(!i||i(l,u,function(f){return l.stop(f)},function(f){return l.fail(f)})){var c=l.primaryKey,d=""+c;d==="[object ArrayBuffer]"&&(d=""+new Uint8Array(c)),Ee(o,d)||(o[d]=!0,t(s,l,u))}};return Promise.all([e.or._iterate(a,n),Da(Oa(e,r,n),e.algorithm,a,!e.keysOnly&&e.valueMapper)])}else return Da(Oa(e,r,n),Vt(e.algorithm,i),t,!e.keysOnly&&e.valueMapper)}function Da(e,t,n,r){var i=r?function(a,s,l){return n(r(a),s,l)}:n,o=J(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 me(e,t){try{var n=Pa(e),r=Pa(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 Ap(Na(e),Na(t));case"Array":return Rp(e,t)}}catch{}return NaN}function Rp(e,t){for(var n=e.length,r=t.length,i=n<r?n:r,o=0;o<i;++o){var a=me(e[o],t[o]);if(a!==0)return a}return n===r?0:n<r?-1:1}function Ap(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 Pa(e){var t=typeof e;if(t!=="object")return t;if(ArrayBuffer.isView(e))return"binary";var n=Ai(e);return n==="ArrayBuffer"?"binary":n}function Na(e){return e instanceof Uint8Array?e:ArrayBuffer.isView(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):new Uint8Array(e)}var Up=function(){function e(){}return e.prototype._read=function(t,n){var r=this._ctx;return r.error?r.table._trans(null,oe.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,oe.bind(null,n.error)):n.table._trans("readwrite",t,"locked")},e.prototype._addAlgorithm=function(t){var n=this._ctx;n.algorithm=Vt(n.algorithm,t)},e.prototype._iterate=function(t,n){return nr(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&&ge(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 nr(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(Kt(i,!0))return o.count({trans:r,query:{index:pr(i,o.schema),range:i.range}}).then(function(s){return Math.min(s,i.limit)});var a=0;return nr(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 d=a(u,o),f=a(c,o);return d<f?-s:d>f?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"&&Kt(i,!0)&&i.limit>0){var o=i.valueMapper,a=pr(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 nr(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,Kt(n)?ui(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)}}):ui(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),ui(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 li(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 li(this._ctx,function(n){return t(n.value)}),Lp(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"&&Kt(n,!0)&&n.limit>0)return this._read(function(i){var o=pr(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 li(this._ctx,function(i){var o=i.primaryKey.toString(),a=Ee(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=re(t),s=a.length;o=function(w){for(var _=!1,b=0;b<s;++b){var E=a[b],m=t[E];ot(w,E)!==m&&(Ne(w,E,m),_=!0)}return _}}var l=r.table.core,u=l.schema.primaryKey,c=u.outbound,d=u.extractKey,f=n.db._options.modifyChunkSize||200,p=[],h=0,v=[],g=function(w,_){var b=_.failures,E=_.numFailures;h+=w-E;for(var m=0,x=re(b);m<x.length;m++){var I=x[m];p.push(b[I])}};return n.clone().primaryKeys().then(function(w){var _=function(b){var E=Math.min(f,w.length-b);return l.getMany({trans:i,keys:w.slice(b,b+E),cache:"immutable"}).then(function(m){for(var x=[],I=[],C=c?[]:null,S=[],L=0;L<E;++L){var D=m[L],k={value:Bn(D),primKey:w[b+L]};o.call(k,k.value,k)!==!1&&(k.value==null?S.push(w[b+L]):!c&&me(d(D),d(k.value))!==0?(S.push(w[b+L]),x.push(k.value)):(I.push(k.value),c&&C.push(w[b+L])))}var P=Kt(r)&&r.limit===1/0&&(typeof t!="function"||t===ci)&&{index:r.index,range:r.range};return Promise.resolve(x.length>0&&l.mutate({trans:i,type:"add",values:x}).then(function(R){for(var O in R.failures)S.splice(parseInt(O),1);g(x.length,R)})).then(function(){return(I.length>0||P&&typeof t=="object")&&l.mutate({trans:i,type:"put",keys:C,values:I,criteria:P,changeSpec:typeof t!="function"&&t}).then(function(R){return g(I.length,R)})}).then(function(){return(S.length>0||P&&t===ci)&&l.mutate({trans:i,type:"delete",keys:S,criteria:P}).then(function(R){return g(S.length,R)})}).then(function(){return w.length>b+E&&_(b+f)})})};return _(0).then(function(){if(p.length>0)throw new Cr("Error modifying one or more objects",p,h,v);return w.length})})})},e.prototype.delete=function(){var t=this._ctx,n=t.range;return Kt(t)&&(t.isPrimKey&&!Ip||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 Cr("Could not delete some values",Object.keys(l).map(function(c){return l[c]}),a-u);return a-u})})}):this.modify(ci)},e}(),ci=function(e,t){return t.value=null};function Op(e){return qn(Up.prototype,function(n,r){this.db=e;var i=Rl,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!==Fn?l:null}})}function Dp(e,t){return e<t?-1:e===t?0:1}function Pp(e,t){return e>t?-1:e===t?0:1}function _e(e,t,n){var r=e instanceof Ul?new e.Collection(e):e;return r._ctx.error=n?new n(t):new TypeError(t),r}function $t(e){return new e.Collection(e,function(){return Al("")}).limit(0)}function Np(e){return e==="next"?function(t){return t.toUpperCase()}:function(t){return t.toLowerCase()}}function Vp(e){return e==="next"?function(t){return t.toLowerCase()}:function(t){return t.toUpperCase()}}function Mp(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 rr(e,t,n,r){var i,o,a,s,l,u,c,d=n.length;if(!n.every(function(v){return typeof v=="string"}))return _e(e,Tl);function f(v){i=Np(v),o=Vp(v),a=v==="next"?Dp:Pp;var g=n.map(function(w){return{lower:o(w),upper:i(w)}}).sort(function(w,_){return a(w.lower,_.lower)});s=g.map(function(w){return w.upper}),l=g.map(function(w){return w.lower}),u=v,c=v==="next"?"":r}f("next");var p=new e.Collection(e,function(){return ct(s[0],l[d-1]+r)});p._ondirectionchange=function(v){f(v)};var h=0;return p._addAlgorithm(function(v,g,w){var _=v.key;if(typeof _!="string")return!1;var b=o(_);if(t(b,l,h))return!0;for(var E=null,m=h;m<d;++m){var x=Mp(_,b,s[m],l[m],a,u);x===null&&E===null?h=m+1:(E===null||a(E,x)>0)&&(E=x)}return g(E!==null?function(){v.continue(E+c)}:w),!1}),p}function ct(e,t,n,r){return{type:2,lower:e,upper:t,lowerOpen:n,upperOpen:r}}function Al(e){return{type:1,lower:e,upper:e}}var Ul=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)?$t(this):new this.Collection(this,function(){return ct(t,n,!r,!i)})}catch{return _e(this,We)}},e.prototype.equals=function(t){return t==null?_e(this,We):new this.Collection(this,function(){return Al(t)})},e.prototype.above=function(t){return t==null?_e(this,We):new this.Collection(this,function(){return ct(t,void 0,!0)})},e.prototype.aboveOrEqual=function(t){return t==null?_e(this,We):new this.Collection(this,function(){return ct(t,void 0,!1)})},e.prototype.below=function(t){return t==null?_e(this,We):new this.Collection(this,function(){return ct(void 0,t,!1,!0)})},e.prototype.belowOrEqual=function(t){return t==null?_e(this,We):new this.Collection(this,function(){return ct(void 0,t)})},e.prototype.startsWith=function(t){return typeof t!="string"?_e(this,Tl):this.between(t,t+Rt,!0,!0)},e.prototype.startsWithIgnoreCase=function(t){return t===""?this.startsWith(t):rr(this,function(n,r){return n.indexOf(r[0])===0},[t],Rt)},e.prototype.equalsIgnoreCase=function(t){return rr(this,function(n,r){return n===r[0]},[t],"")},e.prototype.anyOfIgnoreCase=function(){var t=Ze.apply(qt,arguments);return t.length===0?$t(this):rr(this,function(n,r){return r.indexOf(n)!==-1},t,"")},e.prototype.startsWithAnyOfIgnoreCase=function(){var t=Ze.apply(qt,arguments);return t.length===0?$t(this):rr(this,function(n,r){return r.some(function(i){return n.indexOf(i)===0})},t,Rt)},e.prototype.anyOf=function(){var t=this,n=Ze.apply(qt,arguments),r=this._cmp;try{n.sort(r)}catch{return _e(this,We)}if(n.length===0)return $t(this);var i=new this.Collection(this,function(){return ct(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([[Ki,t],[t,this.db._maxKey]],{includeLowers:!1,includeUppers:!1})},e.prototype.noneOf=function(){var t=Ze.apply(qt,arguments);if(t.length===0)return new this.Collection(this);try{t.sort(this._ascending)}catch{return _e(this,We)}var n=t.reduce(function(r,i){return r?r.concat([[r[r.length-1][1],i]]):[[Ki,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 $t(this);if(!t.every(function(m){return m[0]!==void 0&&m[1]!==void 0&&o(m[0],m[1])<=0}))return _e(this,"First argument to inAnyRange() must be an Array of two-value Arrays [lower,upper] where upper must not be lower than lower",j.InvalidArgument);var u=!n||n.includeLowers!==!1,c=n&&n.includeUppers===!0;function d(m,x){for(var I=0,C=m.length;I<C;++I){var S=m[I];if(i(x[0],S[1])<0&&i(x[1],S[0])>0){S[0]=s(S[0],x[0]),S[1]=l(S[1],x[1]);break}}return I===C&&m.push(x),m}var f=o;function p(m,x){return f(m[0],x[0])}var h;try{h=t.reduce(d,[]),h.sort(p)}catch{return _e(this,We)}var v=0,g=c?function(m){return o(m,h[v][1])>0}:function(m){return o(m,h[v][1])>=0},w=u?function(m){return a(m,h[v][0])>0}:function(m){return a(m,h[v][0])>=0};function _(m){return!g(m)&&!w(m)}var b=g,E=new this.Collection(this,function(){return ct(h[0][0],h[h.length-1][1],!u,!c)});return E._ondirectionchange=function(m){m==="next"?(b=g,f=o):(b=w,f=a),h.sort(p)},E._addAlgorithm(function(m,x,I){for(var C=m.key;b(C);)if(++v,v===h.length)return x(I),!1;return _(C)?!0:(r._cmp(C,h[v][1])===0||r._cmp(C,h[v][0])===0||x(function(){f===o?m.continue(h[v][0]):m.continue(h[v][1])}),!1)}),E},e.prototype.startsWithAnyOf=function(){var t=Ze.apply(qt,arguments);return t.every(function(n){return typeof n=="string"})?t.length===0?$t(this):this.inAnyRange(t.map(function(n){return[n,n+Rt]})):_e(this,"startsWithAnyOf() only works with strings")},e}();function jp(e){return qn(Ul.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 j.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 Be(e){return J(function(t){return On(t),e(t.target.error),!1})}function On(e){e.stopPropagation&&e.stopPropagation(),e.preventDefault&&e.preventDefault()}var Dn="storagemutated",ht="x-storagemutated-1",_t=$n(null,Dn),Bp=function(){function e(){}return e.prototype._lock=function(){return wn(!V.global),++this._reculock,this._reculock===1&&!V.global&&(V.lockOwnerFor=this),this},e.prototype._unlock=function(){if(wn(!V.global),--this._reculock===0)for(V.global||(V.lockOwnerFor=null);this._blockedFuncs.length>0&&!this._locked();){var t=this._blockedFuncs.shift();try{fn(t[1],t[0])}catch{}}return this},e.prototype._locked=function(){return this._reculock&&V.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(wn(!this.idbtrans),!t&&!r)switch(i&&i.name){case"DatabaseClosedError":throw new j.DatabaseClosed(i);case"MissingAPIError":throw new j.MissingAPI(i.message,i);default:throw new j.OpenFailed(i)}if(!this.active)throw new j.TransactionInactive;return wn(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=J(function(o){On(o),n._reject(t.error)}),t.onabort=J(function(o){On(o),n.active&&n._reject(new j.Abort(t.error)),n.active=!1,n.on("abort").fire(o)}),t.oncomplete=J(function(){n.active=!1,n._resolve(),"mutatedParts"in t&&_t.storagemutated.fire(t.mutatedParts)}),this},e.prototype._promise=function(t,n,r){var i=this;if(t==="readwrite"&&this.mode!=="readwrite")return oe(new j.ReadOnly("Transaction is readonly"));if(!this.active)return oe(new j.TransactionInactive);if(this._locked())return new A(function(a,s){i._blockedFuncs.push([function(){i._promise(t,n,r).then(a,s)},V])});if(r)return gt(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(J(a.bind(null,l)))},function(l){return n._waitingQueue.push(J(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 j.Abort))},e.prototype.table=function(t){var n=this._memoizedTables||(this._memoizedTables={});if(Ee(n,t))return n[t];var r=this.schema[t];if(!r)throw new j.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 Fp(e){return qn(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=$n(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(),oe(l)})})}function $i(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?"++":"")+Ol(t)}}function Ol(e){return typeof e=="string"?e:e?"["+[].join.call(e,"+")+"]":""}function Dl(e,t,n){return{name:e,primKey:t,indexes:n,mappedClass:null,idxByName:dl(n,function(r){return[r.name,r]})}}function Hp(e){return e.length===1?e[0]:e}var Pn=function(e){try{return e.only([[]]),Pn=function(){return[[]]},[[]]}catch{return Pn=function(){return Rt},Rt}};function qi(e){return e==null?function(){}:typeof e=="string"?Kp(e):function(t){return ot(t,e)}}function Kp(e){var t=e.split(".");return t.length===1?function(n){return n[e]}:function(n){return ot(n,e)}}function Va(e){return[].slice.call(e)}var $p=0;function In(e){return e==null?":id":typeof e=="string"?e:"["+e.join("+")+"]"}function qp(e,t,n){function r(d,f){var p=Va(d.objectStoreNames);return{schema:{name:d.name,tables:p.map(function(h){return f.objectStore(h)}).map(function(h){var v=h.keyPath,g=h.autoIncrement,w=ve(v),_=v==null,b={},E={name:h.name,primaryKey:{name:null,isPrimaryKey:!0,outbound:_,compound:w,keyPath:v,autoIncrement:g,unique:!0,extractKey:qi(v)},indexes:Va(h.indexNames).map(function(m){return h.index(m)}).map(function(m){var x=m.name,I=m.unique,C=m.multiEntry,S=m.keyPath,L=ve(S),D={name:x,compound:L,keyPath:S,unique:I,multiEntry:C,extractKey:qi(S)};return b[In(S)]=D,D}),getIndexByKeyPath:function(m){return b[In(m)]}};return b[":id"]=E.primaryKey,v!=null&&(b[In(v)]=E.primaryKey),E})},hasGetAll:p.length>0&&"getAll"in f.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(d){if(d.type===3)return null;if(d.type===4)throw new Error("Cannot convert never type to IDBKeyRange");var f=d.lower,p=d.upper,h=d.lowerOpen,v=d.upperOpen,g=f===void 0?p===void 0?null:t.upperBound(p,!!v):p===void 0?t.lowerBound(f,!!h):t.bound(f,p,!!h,!!v);return g}function o(d){var f=d.name;function p(g){var w=g.trans,_=g.type,b=g.keys,E=g.values,m=g.range;return new Promise(function(x,I){x=J(x);var C=w.objectStore(f),S=C.keyPath==null,L=_==="put"||_==="add";if(!L&&_!=="delete"&&_!=="deleteRange")throw new Error("Invalid operation type: "+_);var D=(b||E||{length:1}).length;if(b&&E&&b.length!==E.length)throw new Error("Given keys array must have same length as given values array.");if(D===0)return x({numFailures:0,failures:{},results:[],lastResult:void 0});var k,P=[],R=[],O=0,Y=function(je){++O,On(je)};if(_==="deleteRange"){if(m.type===4)return x({numFailures:O,failures:R,results:[],lastResult:void 0});m.type===3?P.push(k=C.clear()):P.push(k=C.delete(i(m)))}else{var ae=L?S?[E,b]:[E,null]:[b,null],G=ae[0],ue=ae[1];if(L)for(var Se=0;Se<D;++Se)P.push(k=ue&&ue[Se]!==void 0?C[_](G[Se],ue[Se]):C[_](G[Se])),k.onerror=Y;else for(var Se=0;Se<D;++Se)P.push(k=C[_](G[Se])),k.onerror=Y}var ut=function(je){var vn=je.target.result;P.forEach(function(Ue,Yn){return Ue.error!=null&&(R[Yn]=Ue.error)}),x({numFailures:O,failures:R,results:_==="delete"?b:P.map(function(Ue){return Ue.result}),lastResult:vn})};k.onerror=function(je){Y(je),ut(je)},k.onsuccess=ut})}function h(g){var w=g.trans,_=g.values,b=g.query,E=g.reverse,m=g.unique;return new Promise(function(x,I){x=J(x);var C=b.index,S=b.range,L=w.objectStore(f),D=C.isPrimaryKey?L:L.index(C.name),k=E?m?"prevunique":"prev":m?"nextunique":"next",P=_||!("openKeyCursor"in D)?D.openCursor(i(S),k):D.openKeyCursor(i(S),k);P.onerror=Be(I),P.onsuccess=J(function(R){var O=P.result;if(!O){x(null);return}O.___id=++$p,O.done=!1;var Y=O.continue.bind(O),ae=O.continuePrimaryKey;ae&&(ae=ae.bind(O));var G=O.advance.bind(O),ue=function(){throw new Error("Cursor not started")},Se=function(){throw new Error("Cursor not stopped")};O.trans=w,O.stop=O.continue=O.continuePrimaryKey=O.advance=ue,O.fail=J(I),O.next=function(){var ut=this,je=1;return this.start(function(){return je--?ut.continue():ut.stop()}).then(function(){return ut})},O.start=function(ut){var je=new Promise(function(Ue,Yn){Ue=J(Ue),P.onerror=Be(Yn),O.fail=Yn,O.stop=function(Sc){O.stop=O.continue=O.continuePrimaryKey=O.advance=Se,Ue(Sc)}}),vn=function(){if(P.result)try{ut()}catch(Ue){O.fail(Ue)}else O.done=!0,O.start=function(){throw new Error("Cursor behind last entry")},O.stop()};return P.onsuccess=J(function(Ue){P.onsuccess=vn,vn()}),O.continue=Y,O.continuePrimaryKey=ae,O.advance=G,vn(),je},x(O)},I)})}function v(g){return function(w){return new Promise(function(_,b){_=J(_);var E=w.trans,m=w.values,x=w.limit,I=w.query,C=x===1/0?void 0:x,S=I.index,L=I.range,D=E.objectStore(f),k=S.isPrimaryKey?D:D.index(S.name),P=i(L);if(x===0)return _({result:[]});if(g){var R=m?k.getAll(P,C):k.getAllKeys(P,C);R.onsuccess=function(G){return _({result:G.target.result})},R.onerror=Be(b)}else{var O=0,Y=m||!("openKeyCursor"in k)?k.openCursor(P):k.openKeyCursor(P),ae=[];Y.onsuccess=function(G){var ue=Y.result;if(!ue)return _({result:ae});if(ae.push(m?ue.value:ue.primaryKey),++O===x)return _({result:ae});ue.continue()},Y.onerror=Be(b)}})}}return{name:f,schema:d,mutate:p,getMany:function(g){var w=g.trans,_=g.keys;return new Promise(function(b,E){b=J(b);for(var m=w.objectStore(f),x=_.length,I=new Array(x),C=0,S=0,L,D=function(O){var Y=O.target;(I[Y._pos]=Y.result)!=null,++S===C&&b(I)},k=Be(E),P=0;P<x;++P){var R=_[P];R!=null&&(L=m.get(_[P]),L._pos=P,L.onsuccess=D,L.onerror=k,++C)}C===0&&b(I)})},get:function(g){var w=g.trans,_=g.key;return new Promise(function(b,E){b=J(b);var m=w.objectStore(f),x=m.get(_);x.onsuccess=function(I){return b(I.target.result)},x.onerror=Be(E)})},query:v(l),openCursor:h,count:function(g){var w=g.query,_=g.trans,b=w.index,E=w.range;return new Promise(function(m,x){var I=_.objectStore(f),C=b.isPrimaryKey?I:I.index(b.name),S=i(E),L=S?C.count(S):C.count();L.onsuccess=J(function(D){return m(D.target.result)}),L.onerror=Be(x)})}}}var a=r(e,n),s=a.schema,l=a.hasGetAll,u=s.tables.map(function(d){return o(d)}),c={};return u.forEach(function(d){return c[d.name]=d}),{stack:"dbcore",transaction:e.transaction.bind(e),table:function(d){var f=c[d];if(!f)throw new Error("Table '"+d+"' not found");return c[d]},MIN_KEY:-1/0,MAX_KEY:Pn(t),schema:s}}function Gp(e,t){return t.reduce(function(n,r){var i=r.create;return H(H({},n),i(n))},e)}function zp(e,t,n,r){var i=n.IDBKeyRange;n.indexedDB;var o=Gp(qp(t,i,r),e.dbcore);return{dbcore:o}}function Mo(e,t){var n=e._novip,r=t.db,i=zp(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 Ar(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?st(s,o,{get:function(){return this.table(o)},set:function(u){ll(this,o,{value:u,writable:!0,configurable:!0,enumerable:!0})}}):s[o]=new i.Table(o,a))})})}function Gi(e,t){var n=e._novip;t.forEach(function(r){for(var i in r)r[i]instanceof n.Table&&delete r[i]})}function Wp(e,t){return e._cfg.version-t._cfg.version}function Yp(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=V.transless||V;gt(function(){V.trans=o,V.transless=s,t===0?(re(i).forEach(function(l){jo(n,l,i[l].primKey,i[l].indexes)}),Mo(e,n),A.follow(function(){return e.on.populate.fire(o)}).catch(a)):Qp(e,t,o,n).catch(a)})}function Qp(e,t,n,r){var i=e._novip,o=[],a=i._versions,s=i._dbSchema=Bo(i,i.idbdb,r),l=!1,u=a.filter(function(d){return d._cfg.version>=t});u.forEach(function(d){o.push(function(){var f=s,p=d._cfg.dbschema;Wi(i,f,r),Wi(i,p,r),s=i._dbSchema=p;var h=Pl(f,p);h.add.forEach(function(E){jo(r,E[0],E[1].primKey,E[1].indexes)}),h.change.forEach(function(E){if(E.recreate)throw new j.Upgrade("Not yet support for changing primary key");var m=r.objectStore(E.name);E.add.forEach(function(x){return zi(m,x)}),E.change.forEach(function(x){m.deleteIndex(x.name),zi(m,x)}),E.del.forEach(function(x){return m.deleteIndex(x)})});var v=d._cfg.contentUpgrade;if(v&&d._cfg.version>t){Mo(i,r),n._memoizedTables={},l=!0;var g=fl(p);h.del.forEach(function(E){g[E]=f[E]}),Gi(i,[i.Transaction.prototype]),Ar(i,[i.Transaction.prototype],re(g),g),n.schema=g;var w=Ro(v);w&&dn();var _,b=A.follow(function(){if(_=v(n),_&&w){var E=lt.bind(null,null);_.then(E,E)}});return _&&typeof _.then=="function"?A.resolve(_):b.then(function(){return _})}}),o.push(function(f){if(!l||!Cp){var p=d._cfg.dbschema;Xp(p,f)}Gi(i,[i.Transaction.prototype]),Ar(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(){Zp(s,r)})}function Pl(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&&!qr)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],d=l[u];c?c.src!==d.src&&a.change.push(d):a.add.push(d)}(a.del.length>0||a.add.length>0||a.change.length>0)&&n.change.push(a)}}}return n}function jo(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 zi(i,o)}),i}function Zp(e,t){re(e).forEach(function(n){t.db.objectStoreNames.contains(n)||jo(t,n,e[n].primKey,e[n].indexes)})}function Xp(e,t){[].slice.call(t.db.objectStoreNames).forEach(function(n){return e[n]==null&&t.db.deleteObjectStore(n)})}function zi(e,t){e.createIndex(t.name,t.keyPath,{unique:t.unique,multiEntry:t.multi})}function Bo(e,t,n){var r={},i=Kr(t.objectStoreNames,0);return i.forEach(function(o){for(var a=n.objectStore(o),s=a.keyPath,l=$i(Ol(s),s||"",!1,!1,!!a.autoIncrement,s&&typeof s!="string",!0),u=[],c=0;c<a.indexNames.length;++c){var d=a.index(a.indexNames[c]);s=d.keyPath;var f=$i(d.name,s,!!d.unique,!!d.multiEntry,!1,s&&typeof s!="string",!1);u.push(f)}r[o]=Dl(o,l,u)}),r}function Jp(e,t,n){var r=e._novip;r.verno=t.version/10;var i=r._dbSchema=Bo(r,t,n);r._storeNames=Kr(t.objectStoreNames,0),Ar(r,[r._allTables],re(i),i)}function eh(e,t){var n=Bo(e,e.idbdb,t),r=Pl(n,e._dbSchema);return!(r.add.length||r.change.some(function(i){return i.add.length||i.change.length}))}function Wi(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,d=typeof c=="string"?c:"["+Kr(c).join("+")+"]";if(t[a]){var f=t[a].idxByName[d];f&&(f.name=u,delete t[a].idxByName[d],t[a].idxByName[u]=f)}}}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 th(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 $i(r,i||null,/\&/.test(t),/\*/.test(t),/\+\+/.test(t),ve(i),n===0)})}var nh=function(){function e(){}return e.prototype._parseStoresSpec=function(t,n){re(t).forEach(function(r){if(t[r]!==null){var i=th(t[r]),o=i.shift();if(o.multi)throw new j.Schema("Primary key cannot be multi-valued");i.forEach(function(a){if(a.auto)throw new j.Schema("Only primary key can be marked as autoIncrement (++)");if(!a.keyPath)throw new j.Schema("Index must have a name and cannot be an empty string")}),n[r]=Dl(r,o,i)}})},e.prototype.stores=function(t){var n=this.db;this._cfg.storesSource=this._cfg.storesSource?ge(this._cfg.storesSource,t):t;var r=n._versions,i={},o={};return r.forEach(function(a){ge(i,a._cfg.storesSource),o=a._cfg.dbschema={},a._parseStoresSpec(i,o)}),n._dbSchema=o,Gi(n,[n._allTables,n,n.Transaction.prototype]),Ar(n,[n._allTables,n,n.Transaction.prototype,this._cfg.tables],re(o),o),n._storeNames=re(o),this},e.prototype.upgrade=function(t){return this._cfg.contentUpgrade=Oo(this._cfg.contentUpgrade||W,t),this},e}();function rh(e){return qn(nh.prototype,function(n){this.db=e,this._cfg={version:n,storesSource:null,dbschema:{},tables:{},contentUpgrade:null}})}function Fo(e,t){var n=e._dbNamesDB;return n||(n=e._dbNamesDB=new qo(Gr,{addons:[],indexedDB:e,IDBKeyRange:t}),n.version(1).stores({dbnames:"name"})),n.table("dbnames")}function Ho(e){return e&&typeof e.databases=="function"}function ih(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!==Gr})}):Fo(t,n).toCollection().primaryKeys()}function oh(e,t){var n=e.indexedDB,r=e.IDBKeyRange;!Ho(n)&&t!==Gr&&Fo(n,r).put({name:t}).catch(W)}function ah(e,t){var n=e.indexedDB,r=e.IDBKeyRange;!Ho(n)&&t!==Gr&&Fo(n,r).delete(t).catch(W)}function Yi(e){return gt(function(){return V.letThrough=!0,e()})}function sh(){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 lh(e){var t=e._state,n=e._deps.indexedDB;if(t.isBeingOpened||e.idbdb)return t.dbReadyPromise.then(function(){return t.dbOpenError?oe(t.dbOpenError):e});Ge&&(t.openCanceller._stackHolder=Bt()),t.isBeingOpened=!0,t.dbOpenError=null,t.openComplete=!1;var r=t.openCanceller;function i(){if(t.openCanceller!==r)throw new j.DatabaseClosed("db.open() was cancelled")}var o=t.dbReadyResolve,a=null,s=!1;return A.race([r,(typeof navigator>"u"?A.resolve():sh()).then(function(){return new A(function(l,u){if(i(),!n)throw new j.MissingAPI;var c=e.name,d=t.autoSchema?n.open(c):n.open(c,Math.round(e.verno*10));if(!d)throw new j.MissingAPI;d.onerror=Be(u),d.onblocked=J(e._fireOnBlocked),d.onupgradeneeded=J(function(f){if(a=d.transaction,t.autoSchema&&!e._options.allowEmptyDB){d.onerror=On,a.abort(),d.result.close();var p=n.deleteDatabase(c);p.onsuccess=p.onerror=J(function(){u(new j.NoSuchDatabase("Database "+c+" doesnt exist"))})}else{a.onerror=Be(u);var h=f.oldVersion>Math.pow(2,62)?0:f.oldVersion;s=h<1,e._novip.idbdb=d.result,Yp(e,h/10,a,u)}},u),d.onsuccess=J(function(){a=null;var f=e._novip.idbdb=d.result,p=Kr(f.objectStoreNames);if(p.length>0)try{var h=f.transaction(Hp(p),"readonly");t.autoSchema?Jp(e,f,h):(Wi(e,e._dbSchema,h),eh(e,h)||console.warn("Dexie SchemaDiff: Schema was extended without increasing the number passed to db.version(). Some queries may fail.")),Mo(e,h)}catch{}Cn.push(e),f.onversionchange=J(function(v){t.vcFired=!0,e.on("versionchange").fire(v)}),f.onclose=J(function(v){e.on("close").fire(v)}),s&&oh(e._deps,c),l()},u)})})]).then(function(){return i(),t.onReadyBeingFired=[],A.resolve(Yi(function(){return e.on.ready.fire(e.vip)})).then(function l(){if(t.onReadyBeingFired.length>0){var u=t.onReadyBeingFired.reduce(Oo,W);return t.onReadyBeingFired=[],A.resolve(Yi(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(),oe(l)}).finally(function(){t.openComplete=!0,o()})}function Qi(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"?ve(u)?Promise.all(u).then(r,i):r(u):u.then(r,i)}}return o(t)()}function uh(e,t,n){var r=arguments.length;if(r<2)throw new j.InvalidArgument("Too few arguments");for(var i=new Array(r-1);--r;)i[r-1]=arguments[r];n=i.pop();var o=pl(i);return[e,o,n]}function Nl(e,t,n,r,i){return A.resolve().then(function(){var o=V.transless||V,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(d){return d.name===Uo.InvalidState&&e.isOpen()&&--e._state.PR1398_maxLoop>0?(console.warn("Dexie: Need to reopen db"),e._close(),e.open().then(function(){return Nl(e,t,n,null,i)})):oe(d)}var l=Ro(i);l&&dn();var u,c=A.follow(function(){if(u=i.call(a,a),u)if(l){var d=lt.bind(null,null);u.then(d,d)}else typeof u.next=="function"&&typeof u.throw=="function"&&(u=Qi(u))},s);return(u&&typeof u.then=="function"?A.resolve(u).then(function(d){return a.active?d:oe(new j.PrematureCommit("Transaction committed too early. See http://bit.ly/2kdckMn"))}):c.then(function(){return u})).then(function(d){return r&&a._resolve(),a._completion.then(function(){return d})}).catch(function(d){return a._reject(d),oe(d)})})}function ir(e,t,n){for(var r=ve(e)?e.slice():[e],i=0;i<n;++i)r.push(t);return r}function ch(e){return H(H({},e),{table:function(t){var n=e.table(t),r=n.schema,i={},o=[];function a(v,g,w){var _=In(v),b=i[_]=i[_]||[],E=v==null?0:typeof v=="string"?1:v.length,m=g>0,x=H(H({},w),{isVirtual:m,keyTail:g,keyLength:E,extractKey:qi(v),unique:!m&&w.unique});if(b.push(x),x.isPrimaryKey||o.push(x),E>1){var I=E===2?v[0]:v.slice(0,E-1);a(I,g+1,w)}return b.sort(function(C,S){return C.keyTail-S.keyTail}),x}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 d(v){var g=i[In(v)];return g&&g[0]}function f(v,g){return{type:v.type===1?2:v.type,lower:ir(v.lower,v.lowerOpen?e.MAX_KEY:e.MIN_KEY,g),lowerOpen:!0,upper:ir(v.upper,v.upperOpen?e.MIN_KEY:e.MAX_KEY,g),upperOpen:!0}}function p(v){var g=v.query.index;return g.isVirtual?H(H({},v),{query:{index:g,range:f(v.query.range,g.keyTail)}}):v}var h=H(H({},n),{schema:H(H({},r),{primaryKey:s,indexes:o,getIndexByKeyPath:d}),count:function(v){return n.count(p(v))},query:function(v){return n.query(p(v))},openCursor:function(v){var g=v.query.index,w=g.keyTail,_=g.isVirtual,b=g.keyLength;if(!_)return n.openCursor(v);function E(m){function x(C){C!=null?m.continue(ir(C,v.reverse?e.MAX_KEY:e.MIN_KEY,w)):v.unique?m.continue(m.key.slice(0,b).concat(v.reverse?e.MIN_KEY:e.MAX_KEY,w)):m.continue()}var I=Object.create(m,{continue:{value:x},continuePrimaryKey:{value:function(C,S){m.continuePrimaryKey(ir(C,e.MAX_KEY,w),S)}},primaryKey:{get:function(){return m.primaryKey}},key:{get:function(){var C=m.key;return b===1?C[0]:C.slice(0,b)}},value:{get:function(){return m.value}}});return I}return n.openCursor(p(v)).then(function(m){return m&&E(m)})}});return h}})}var dh={stack:"dbcore",name:"VirtualIndexMiddleware",level:1,create:ch};function Ko(e,t,n,r){return n=n||{},r=r||"",re(e).forEach(function(i){if(!Ee(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=Ai(o),l=Ai(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])}}),re(t).forEach(function(i){Ee(e,i)||(n[r+i]=t[i])}),n}function fh(e,t){return t.type==="delete"?t.keys:t.keys||t.values.map(e.extractKey)}var ph={stack:"dbcore",name:"HooksMiddleware",level:2,create:function(e){return H(H({},e),{table:function(t){var n=e.table(t),r=n.schema.primaryKey,i=H(H({},n),{mutate:function(o){var a=V.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 d(o)},!0);case"put":if(u.fire===W&&c.fire===W)break;return a._promise("readwrite",function(){return d(o)},!0);case"delete":if(l.fire===W)break;return a._promise("readwrite",function(){return d(o)},!0);case"deleteRange":if(l.fire===W)break;return a._promise("readwrite",function(){return f(o)},!0)}return n.mutate(o);function d(h){var v=V.trans,g=h.keys||fh(r,h);if(!g)throw new Error("Keys missing");return h=h.type==="add"||h.type==="put"?H(H({},h),{keys:g}):H({},h),h.type!=="delete"&&(h.values=Li([],h.values,!0)),h.keys&&(h.keys=Li([],h.keys,!0)),hh(n,h,g).then(function(w){var _=g.map(function(b,E){var m=w[E],x={onerror:null,onsuccess:null};if(h.type==="delete")l.fire.call(x,b,m,v);else if(h.type==="add"||m===void 0){var I=u.fire.call(x,b,h.values[E],v);b==null&&I!=null&&(b=I,h.keys[E]=b,r.outbound||Ne(h.values[E],r.keyPath,b))}else{var C=Ko(m,h.values[E]),S=c.fire.call(x,C,b,m,v);if(S){var L=h.values[E];Object.keys(S).forEach(function(D){Ee(L,D)?L[D]=S[D]:Ne(L,D,S[D])})}}return x});return n.mutate(h).then(function(b){for(var E=b.failures,m=b.results,x=b.numFailures,I=b.lastResult,C=0;C<g.length;++C){var S=m?m[C]:g[C],L=_[C];S==null?L.onerror&&L.onerror(E[C]):L.onsuccess&&L.onsuccess(h.type==="put"&&w[C]?h.values[C]:S)}return{failures:E,results:m,numFailures:x,lastResult:I}}).catch(function(b){return _.forEach(function(E){return E.onerror&&E.onerror(b)}),Promise.reject(b)})})}function f(h){return p(h.trans,h.range,1e4)}function p(h,v,g){return n.query({trans:h,values:!1,query:{index:r,range:v},limit:g}).then(function(w){var _=w.result;return d({type:"delete",keys:_,trans:h}).then(function(b){return b.numFailures>0?Promise.reject(b.failures[0]):_.length<g?{failures:[],numFailures:0,lastResult:void 0}:p(h,H(H({},v),{lower:_[_.length-1],lowerOpen:!0}),g)})})}}});return i}})}};function hh(e,t,n){return t.type==="add"?Promise.resolve([]):e.getMany({trans:t.trans,keys:n,cache:"immutable"})}function Vl(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)me(t.keys[i],e[o])===0&&(r.push(n?Bn(t.values[i]):t.values[i]),++o);return r.length===e.length?r:null}catch{return null}}var vh={stack:"dbcore",level:-1,create:function(e){return{table:function(t){var n=e.table(t);return H(H({},n),{getMany:function(r){if(!r.cache)return n.getMany(r);var i=Vl(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"?Bn(o):o},o})},mutate:function(r){return r.type!=="add"&&(r.trans._cache=null),n.mutate(r)}})}}}},di;function $o(e){return!("from"in e)}var Ye=function(e,t){if(this)ge(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&&ge(n,e),n}};tn(Ye.prototype,(di={add:function(e){return Ur(this,e),this},addKey:function(e){return Nn(this,e,e),this},addKeys:function(e){var t=this;return e.forEach(function(n){return Nn(t,n,n)}),this}},di[Ui]=function(){return Zi(this)},di));function Nn(e,t,n){var r=me(t,n);if(!isNaN(r)){if(r>0)throw RangeError();if($o(e))return ge(e,{from:t,to:n,d:1});var i=e.l,o=e.r;if(me(n,e.from)<0)return i?Nn(i,t,n):e.l={from:t,to:n,d:1,l:null,r:null},Ma(e);if(me(t,e.to)>0)return o?Nn(o,t,n):e.r={from:t,to:n,d:1,l:null,r:null},Ma(e);me(t,e.from)<0&&(e.from=t,e.l=null,e.d=o?o.d+1:1),me(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;Nn(r,o,a),s&&n(r,s),l&&n(r,l)}$o(t)||n(e,t)}function mh(e,t){var n=Zi(t),r=n.next();if(r.done)return!1;for(var i=r.value,o=Zi(e),a=o.next(i.from),s=a.value;!r.done&&!a.done;){if(me(s.from,i.to)<=0&&me(s.to,i.from)>=0)return!0;me(i.from,s.from)<0?i=(r=n.next(s.from)).value:s=(a=o.next(i.from)).value}return!1}function Zi(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&&me(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||me(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=H({},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 gh={stack:"dbcore",level:0,create:function(e){var t=e.schema.name,n=new Ye(e.MIN_KEY,e.MAX_KEY);return H(H({},e),{table:function(r){var i=e.table(r),o=i.schema,a=o.primaryKey,s=a.extractKey,l=a.outbound,u=H(H({},i),{mutate:function(f){var p=f.trans,h=p.mutatedParts||(p.mutatedParts={}),v=function(I){var C="idb://"+t+"/"+r+"/"+I;return h[C]||(h[C]=new Ye)},g=v(""),w=v(":dels"),_=f.type,b=f.type==="deleteRange"?[f.range]:f.type==="delete"?[f.keys]:f.values.length<50?[[],f.values]:[],E=b[0],m=b[1],x=f.trans._cache;return i.mutate(f).then(function(I){if(ve(E)){_!=="delete"&&(E=I.results),g.addKeys(E);var C=Vl(E,x);!C&&_!=="add"&&w.addKeys(E),(C||m)&&yh(v,o,C,m)}else if(E){var S={from:E.lower,to:E.upper};w.add(S),g.add(S)}else g.add(n),w.add(n),o.indexes.forEach(function(L){return v(L.name).add(n)});return I})}}),c=function(f){var p,h,v=f.query,g=v.index,w=v.range;return[g,new Ye((p=w.lower)!==null&&p!==void 0?p:e.MIN_KEY,(h=w.upper)!==null&&h!==void 0?h:e.MAX_KEY)]},d={get:function(f){return[a,new Ye(f.key)]},getMany:function(f){return[a,new Ye().addKeys(f.keys)]},count:c,query:c,openCursor:c};return re(d).forEach(function(f){u[f]=function(p){var h=V.subscr;if(h){var v=function(x){var I="idb://"+t+"/"+r+"/"+x;return h[I]||(h[I]=new Ye)},g=v(""),w=v(":dels"),_=d[f](p),b=_[0],E=_[1];if(v(b.name||"").add(E),!b.isPrimaryKey)if(f==="count")w.add(n);else{var m=f==="query"&&l&&p.values&&i.query(H(H({},p),{values:!1}));return i[f].apply(this,arguments).then(function(x){if(f==="query"){if(l&&p.values)return m.then(function(L){var D=L.result;return g.addKeys(D),x});var I=p.values?x.result.map(s):x.result;p.values?g.addKeys(I):w.addKeys(I)}else if(f==="openCursor"){var C=x,S=p.values;return C&&Object.create(C,{key:{get:function(){return w.addKey(C.primaryKey),C.key}},primaryKey:{get:function(){var L=C.primaryKey;return w.addKey(L),L}},value:{get:function(){return S&&g.addKey(C.primaryKey),C.value}}})}return x})}}return i[f].apply(this,arguments)}}),u}})}};function yh(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&&ve(u)?u.forEach(function(c){return a.addKey(c)}):a.addKey(u)};(n||r).forEach(function(u,c){var d=n&&s(n[c]),f=r&&s(r[c]);me(d,f)!==0&&(d!=null&&l(d),f!=null&&l(f))})}t.indexes.forEach(i)}var qo=function(){function e(t,n){var r=this;this._middlewares={},this.verno=0;var i=e.dependencies;this._options=n=H({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=$n(this,"populate","blocked","versionchange","close",{ready:[Oo,W]}),this.on.ready.subscribe=ul(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 d=r;u||s(function f(){d.on.ready.unsubscribe(l),d.on.ready.unsubscribe(f)})}})}}),this.Collection=Op(this),this.Table=Tp(this),this.Transaction=Fp(this),this.Version=rh(this),this.WhereClause=jp(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=Pn(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),Cn.filter(function(l){return l.name===r.name&&l!==r&&!l._state.vcFired}).map(function(l){return l.on("versionchange").fire(s)})},this.use(dh),this.use(ph),this.use(gh),this.use(vh),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 j.Type("Given version is not a positive number");if(t=Math.round(t*10)/10,this.idbdb||this._state.isBeingOpened)throw new j.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(Wp),r.stores({}),this._state.autoSchema=!1,r)},e.prototype._whenReady=function(t){var n=this;return this.idbdb&&(this._state.openComplete||V.letThrough||this._vip)?t():new A(function(r,i){if(n._state.openComplete)return i(new j.DatabaseClosed(n._state.dbOpenError));if(!n._state.isBeingOpened){if(!n._options.autoOpen){i(new j.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 lh(this)},e.prototype._close=function(){var t=this._state,n=Cn.indexOf(this);if(n>=0&&Cn.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 j.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=J(function(){ah(t._deps,t.name),i()}),s.onerror=Be(o),s.onblocked=t._fireOnBlocked};if(n)throw new j.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 re(this._allTables).map(function(n){return t._allTables[n]})},enumerable:!1,configurable:!0}),e.prototype.transaction=function(){var t=uh.apply(this,arguments);return this._transaction.apply(this,t)},e.prototype._transaction=function(t,n,r){var i=this,o=V.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 d=c instanceof i.Table?c.name:c;if(typeof d!="string")throw new TypeError("Invalid table argument to Dexie.transaction(). Only Table or String are allowed");return d}),t=="r"||t===ai)s=ai;else if(t=="rw"||t==si)s=si;else throw new j.InvalidArgument("Invalid transaction mode: "+t);if(o){if(o.mode===ai&&s===si)if(a)o=null;else throw new j.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 j.SubTransaction("Table "+c+" not included in parent transaction.")}),a&&o&&!o.active&&(o=null)}}catch(c){return o?o._promise(null,function(d,f){f(c)}):oe(c)}var u=Nl.bind(null,this,s,l,o,r);return o?o._promise(s,u,"lock"):V.trans?fn(V.transless,function(){return i._whenReady(u)}):this._whenReady(u)},e.prototype.table=function(t){if(!Ee(this._allTables,t))throw new j.InvalidTable("Table "+t+" does not exist");return this._allTables[t]},e}(),_h=typeof Symbol<"u"&&"observable"in Symbol?Symbol.observable:"@@observable",wh=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[_h]=function(){return this},e}();function Ml(e,t){return re(t).forEach(function(n){var r=e[n]||(e[n]=new Ye);Ur(r,t[n])}),e}function bh(e){var t=!1,n=void 0,r=new wh(function(i){var o=Ro(e);function a(g){o&&dn();var w=function(){return gt(e,{subscr:g,trans:null})},_=V.trans?fn(V.transless,w):w();return o&&_.then(lt,lt),_}var s=!1,l={},u={},c={get closed(){return s},unsubscribe:function(){s=!0,_t.storagemutated.unsubscribe(h)}};i.start&&i.start(c);var d=!1,f=!1;function p(){return re(u).some(function(g){return l[g]&&mh(l[g],u[g])})}var h=function(g){Ml(l,g),p()&&v()},v=function(){if(!(d||s)){l={};var g={},w=a(g);f||(_t(Dn,h),f=!0),d=!0,Promise.resolve(w).then(function(_){t=!0,n=_,d=!1,!s&&(p()?v():(l={},u=g,i.next&&i.next(_)))},function(_){d=!1,t=!1,i.error&&i.error(_),c.unsubscribe()})}};return v(),c});return r.hasValue=function(){return t},r.getValue=function(){return n},r}var Xi;try{Xi={indexedDB:Q.indexedDB||Q.mozIndexedDB||Q.webkitIndexedDB||Q.msIndexedDB,IDBKeyRange:Q.IDBKeyRange||Q.webkitIDBKeyRange}}catch{Xi={indexedDB:null,IDBKeyRange:null}}var It=qo;tn(It,H(H({},$r),{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 ih(It.dependencies).then(e)}catch{return oe(new j.MissingAPI)}},defineClass:function(){function e(t){ge(this,t)}return e},ignoreTransaction:function(e){return V.trans?fn(V.transless,e):e()},vip:Yi,async:function(e){return function(){try{var t=Qi(e.apply(this,arguments));return!t||typeof t.then!="function"?A.resolve(t):t}catch(n){return oe(n)}}},spawn:function(e,t,n){try{var r=Qi(e.apply(n,t||[]));return!r||typeof r.then!="function"?A.resolve(r):r}catch(i){return oe(i)}},currentTransaction:{get:function(){return V.trans||null}},waitFor:function(e,t){var n=A.resolve(typeof e=="function"?It.ignoreTransaction(e):e).timeout(t||6e4);return V.trans?V.trans.waitFor(n):n},Promise:A,debug:{get:function(){return Ge},set:function(e){vl(e,e==="dexie"?function(){return!0}:Ll)}},derive:un,extend:ge,props:tn,override:ul,Events:$n,on:_t,liveQuery:bh,extendObservabilitySet:Ml,getByKeyPath:ot,setByKeyPath:Ne,delByKeyPath:Jf,shallowClone:fl,deepClone:Bn,getObjectDiff:Ko,cmp:me,asap:cl,minKey:Ki,addons:[],connections:Cn,errnames:Uo,dependencies:Xi,semVer:Ua,version:Ua.split(".").map(function(e){return parseInt(e)}).reduce(function(e,t,n){return e+t/Math.pow(10,n*2)})}));It.maxKey=Pn(It.dependencies.IDBKeyRange);typeof dispatchEvent<"u"&&typeof addEventListener<"u"&&(_t(Dn,function(e){if(!tt){var t;qr?(t=document.createEvent("CustomEvent"),t.initCustomEvent(ht,!0,!0,e)):t=new CustomEvent(ht,{detail:e}),tt=!0,dispatchEvent(t),tt=!1}}),addEventListener(ht,function(e){var t=e.detail;tt||Or(t)}));function Or(e){var t=tt;try{tt=!0,_t.storagemutated.fire(e)}finally{tt=t}}var tt=!1;if(typeof BroadcastChannel<"u"){var or=new BroadcastChannel(ht);typeof or.unref=="function"&&or.unref(),_t(Dn,function(e){tt||or.postMessage(e)}),or.onmessage=function(e){e.data&&Or(e.data)}}else if(typeof self<"u"&&typeof navigator<"u"){_t(Dn,function(e){try{tt||(typeof localStorage<"u"&&localStorage.setItem(ht,JSON.stringify({trig:Math.random(),changedParts:e})),typeof self.clients=="object"&&Li([],self.clients.matchAll({includeUncontrolled:!0}),!0).forEach(function(t){return t.postMessage({type:ht,changedParts:e})}))}catch{}}),typeof addEventListener<"u"&&addEventListener("storage",function(e){if(e.key===ht){var t=JSON.parse(e.newValue);t&&Or(t.changedParts)}});var Ba=self.document&&navigator.serviceWorker;Ba&&Ba.addEventListener("message",Eh)}function Eh(e){var t=e.data;t&&t.type===ht&&Or(t.changedParts)}A.rejectionMapper=lp;vl(Ge,Ll);var pn=(e=>(e.ReadyForUpload="ReadyForUpload",e.UploadComplete="UploadComplete",e))(pn||{}),Qt=(e=>(e.After="after",e.Before="before",e.BeforeAndAfter="beforeAndAfter",e))(Qt||{});const Ji="sprig.sessionId",jl="sprig.disableReplayRecording",xh=30,Bl=()=>{sessionStorage.setItem(jl,"disabled")},Mt=()=>!!sessionStorage.getItem(jl),Sh=["did not allow mutations","called in an invalid security context"],Ch=e=>{if(!e)return!0;for(const t of Sh)if(e.toLowerCase().includes(t))return!1;return!0},Fa=(e,t,n)=>{Mt()||t instanceof Error&&(Bl(),Ch(t==null?void 0:t.message)&&(Th(),window.UserLeap.reportError(e,t,n)))},Ih=(e,t)=>{var n,r;(r=(n=window.navigator)==null?void 0:n.storage)!=null&&r.estimate?window.navigator.storage.estimate().then(i=>{Fa(e,t,i)}).catch(i=>{window.UserLeap.reportError("Error getting storage estimate",i)}):Fa(e,t)},kh=()=>{const e=sessionStorage.getItem(Ji);return e?(sessionStorage.removeItem(Ji),e):mt()},ye=kh();window.addEventListener("beforeunload",()=>{sessionStorage.setItem(Ji,ye)});const Th=()=>{Promise.all([z.events.clear(),z.chunkUploads.clear(),z.pendingCaptures.clear()]).catch(e=>{window.UserLeap.reportError("Error wiping database",e)})},fi=(e,t,n=()=>!0)=>z.table(t).where("timestamp").below(e).and(n).delete(),Lh=()=>{z.events.where("sessionId").equals(ye).delete(),z.pendingCaptures.where("sessionId").equals(ye).delete()},Rh=e=>{const t=e.map(n=>{var r;return{...n,sessionId:(r=n.sessionId)!=null?r:ye}});return z.events.bulkAdd(t)},Ah=(e,t)=>z.events.where("[sessionId+timestamp]").between([ye,e],[ye,t]).toArray(),Uh=(e,t,n)=>{const r=new Date,i=r.setMinutes(r.getMinutes()+(n!=null?n:xh));return z.events.where("[sessionId+timestamp]").between([ye,e],[ye,t]).modify({expiredAt:i})},Oh=e=>{var t;return z.chunkUploads.add({...e,sessionId:(t=e.sessionId)!=null?t:ye})},Dh=(e,t)=>z.chunkUploads.update(e,{data:null,etag:t,status:pn.UploadComplete}),Ph=({status:e,uploadId:t})=>t?z.chunkUploads.where({uploadId:t,status:e}).toArray():z.chunkUploads.where({sessionId:ye,status:e}).toArray(),Nh=e=>z.chunkUploads.where({uploadId:e,status:pn.UploadComplete}).toArray(),Vh=e=>z.chunkUploads.where({uploadId:e,status:pn.UploadComplete}).delete(),Mh=e=>{var t;return z.pendingCaptures.add({...e,sessionId:(t=e.sessionId)!=null?t:ye,canUpload:!1})},jh=()=>z.pendingCaptures.where("sessionId").equals(ye).and(e=>e.targetTimestamp<Date.now()).toArray(),Bh=()=>z.pendingCaptures.where("sessionId").equals(ye).toArray(),Fh=e=>z.pendingCaptures.where("sessionId").equals(ye).and(t=>t.captureParams.responseGroupId===e).modify({canUpload:!0});class Hh extends qo{constructor(){super("replayStorage",{autoOpen:!1});fe(this,"events");fe(this,"chunkUploads");fe(this,"pendingCaptures")}}const z=new Hh;z.version(1).stores({events:"uuid, timestamp, [sessionId+timestamp]",chunkUploads:"uuid, timestamp, [sessionId+status], [uploadId+status], [sessionId+status+uploadId]",pendingCaptures:"uuid, timestamp, [sessionId+targetTimestamp]"});z.open().catch(()=>{Bl()});const Kh=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 Fl=5e3,eo=6e4;const $h=5,Ha=1e3,Hl=30,Dr=Hl+$h,Go="sprig.pendingCount";let Ka=0,$a=Date.now(),zo=!1;const qh=async(e,t,n,r=2,i)=>{try{if(Mt()||!t)return;i!=null&&i.minDuration&&(Fl=i.minDuration),i!=null&&i.batchDuration&&(eo=i.batchDuration),Gf(r),Xh(),Wh(t+Dr,30*60,t+Dr),Yh(),window.rrwebRecord||await Kh(e,"https://cdn.sprig.com/dependencies/record-2.0.0-alpha.6.min.js",n);const o=window.rrwebRecord;if(!o)return;let a=!0;o({checkoutEveryNms:Hl*1e3,sampling:{input:"last",scroll:250,media:800},emit:(s,l)=>{if(Mt())return;$a=Date.now();const u=a||!!l;a=!1,Gh({uuid:mt(),event:JSON.stringify(s),isValidStart:u,timestamp:Date.now()})},...i}),zo=!0,Ka||(Ka=window.setInterval(()=>{Date.now()-$a>Ha&&Gn("Sprig_Noop",{})},Ha))}catch(o){Me("Error initializing replay",o)}};let to=!1,no=[];const Gh=e=>{no.push(e),to||zh()},zh=()=>{to=!0,setTimeout(async()=>{if(Mt())return;const e=no;no=[],to=!1;try{await Rh(e)}catch(t){Me("Error storing replay events",t)}},500)},Wh=(e=6*60,t=30*60,n=4*60)=>{const r=setInterval(async()=>{const i=Date.now();Mt()||await z.transaction("rw",z.events,z.chunkUploads,z.pendingCaptures,()=>{fi(i-e*1e3,"events",o=>o.expiredAt===void 0||o.expiredAt<i-e*1e3),fi(i-t*1e3,"chunkUploads"),fi(i-n*1e3,"pendingCaptures",o=>o.canUpload===void 0||o.canUpload===!1)}).catch(o=>{clearInterval(r),Me("Error deleting table rows",o)})},3e4)},Yh=(e=5)=>{setInterval(rv,e*1e3)},Qh=async(e,t,n,r,i)=>{try{const o=Math.min(e+i,n),a=await Ah(e,o);if(!(a!=null&&a.length))return[r,[]];if(!r){let s=-1;return a==null||a.forEach((l,u)=>{if(!l.isValidStart)return;const c=l.timestamp<=t;(s<0||c)&&(s=u)}),s<0?[]:[!0,a==null?void 0:a.slice(s)]}return[r,a]}catch(o){Me("Error getting events batch",o)}},Zh=(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},Kl=e=>Promise.all(e.map(async t=>{const n=await Wf(t);return await Dh(t.uuid,n),t.uploadId})),$l=async e=>{const t=await Nh(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 sl({apiUrl:r.apiUrl,surveyId:r.surveyId,uploadId:e,responseGroupUuid:r.responseGroupId,etags:n,headers:r.completeUploadHeaders,replayDuration:r.replayDuration}),await Vh(e)},Xh=async()=>{try{let e=[];if(await z.transaction("rw",z.chunkUploads,async()=>{e=await Ph({status:pn.ReadyForUpload}).catch(n=>{Me("chunkUploads transaction error",n)})}),!(e!=null&&e.length))return;const t=await Kl(e);t!=null&&t.length&&await Promise.all(t.map(async n=>{n&&await $l(n)}))}catch(e){Me("Error getting chunk upload uuids",e)}},Jh=async(e,t)=>{await Kl(t),await Promise.all(e.map(n=>$l(n)))},ev=e=>{let t=0;e.forEach(i=>{t+=i.length});const n=new Uint8Array(t);let r=0;return e.forEach(i=>{n.set(i,r),r+=i.length}),n},qa=async(e,t,n)=>{const r=new TextEncoder;let i=null,o=null,a=null,s=!1,l=!1,[u,c]=[0,0];const d=e-Dr*1e3,f=[];let p=[];for(let v=d;v<t;v+=eo){if([l,p]=await Qh(v,e,t,l,eo),!(p!=null&&p.length))continue;u===0&&(u=p[0].timestamp),c=p[p.length-1].timestamp;const g=`${s?",":"["}${p.map(_=>_.event).join(",")}`,w=r.encode(g);n?(o===null&&(a=new window.CompressionStream("gzip"),o=a.writable.getWriter()),o.write(w)):f.push(w),s=!0}if(c-u<Fl)return null;const h=r.encode("]");return o&&a?(o.write(h),o.close(),i=new Uint8Array(await new Response(a.readable).arrayBuffer())):(f.push(h),i=ev(f)),i},tv=async(e,t)=>{const n=window.CompressionStream!==void 0;let r=null;const i=t!=null?t:Date.now(),o=i-e;try{r=await qa(o,i,n)}catch(a){if(a instanceof Error&&window.UserLeap.reportError("Error compressing replay",a),n)try{r=await qa(o,i,!1)}catch(s){Me("fileData fallback failed",s)}}return r},Ga=async e=>{const{surveyId:t,responseGroupId:n,visitorId:r,apiUrl:i,completeUploadHeaders:o,replayParams:a,triggerTimestamp:s}=e,l=await tv(a.replayDurationSeconds*1e3,s);if(!(l!=null&&l.length))return;const u=Zh(l,a.minimumChunkSizeMb,a.signedUrls.length),c=await Promise.all(u.map(async(d,f)=>{const p=mt(),h={apiUrl:i,chunkIndex:f+1,completeUploadHeaders:o,etag:null,responseGroupId:n,status:pn.ReadyForUpload,surveyId:t,timestamp:s,totalChunks:u.length,data:d,uploadId:a.uploadId,uploadUrl:a.signedUrls[f].url,uuid:p,visitorId:r};return await Oh(h),h}));await Jh([a.uploadId],c)},ql=async(e,t)=>{if(!Mt())try{const{isStandalone:n,replayParams:r,triggerTimestamp:i,responseGroupId:o}=e,a=async()=>{setTimeout(()=>$.removeListener(B.QuestionAnswered,a),0),r.replayDurationType===Qt.Before?await Ga(e):await Fh(o)};if(r.replayDurationType===Qt.After||r.replayDurationType===Qt.BeforeAndAfter){n||$.on(B.QuestionAnswered,a),await nv(e);return}if(n||t)await Ga(e);else{const s=Dr+r.replayDurationSeconds;await Uh(i-s*1e3,i,r.expirationTimeLimitMinutes),$.on(B.QuestionAnswered,a)}}catch(n){Me("Error scheduling or capturing replay",n)}},za=()=>{if(!Mt())try{Lh()}catch(e){Me("Error clearing session event data",e)}};let Xe=sessionStorage.getItem(Go);const nv=async e=>{const{surveyId:t}=e,n=await Bh(),r=n==null?void 0:n.filter(a=>a.captureParams.surveyId===t);if(r!=null&&r.length)return;const i={...e,replayParams:{...e.replayParams}};e.replayParams.replayDurationType===Qt.BeforeAndAfter&&(i.replayParams.replayDurationSeconds*=2),i.replayParams.replayDurationType=Qt.Before;const o=e.triggerTimestamp+e.replayParams.replayDurationSeconds*1e3;return i.triggerTimestamp=o,Xe=Xe?(parseInt(Xe)+1).toString():"1",sessionStorage.setItem(Go,Xe),Mh({uuid:mt(),targetTimestamp:o,timestamp:Date.now(),captureParams:i})},rv=async()=>{try{if(Xe&&parseInt(Xe)>0){const e=await jh();e.length&&await Promise.all(e.map(async t=>{await z.pendingCaptures.delete(t.uuid),await ql(t.captureParams,t.canUpload)})),Xe=(parseInt(Xe)-e.length).toString(),sessionStorage.setItem(Go,Xe)}}catch(e){Me("Error initiating pending captures",e)}},Gn=(e,t)=>{var n,r;if(!!zo)try{(r=(n=window.rrwebRecord)==null?void 0:n.addCustomEvent)==null||r.call(n,e,t)}catch(i){Me("Error recording custom event",i)}},Wa=e=>{Gn("Sprig_PageView",e)},iv=e=>{Gn("Sprig_TrackEvent",e)},ov=e=>{Gn("Sprig_ShowSurvey",e)},av=e=>{Gn("Sprig_SubmitSurvey",e)},Me=(e,t)=>{zo=!1,Ih(e,t)};var T=(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))(T||{}),Je=(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.DoesNotInclude="list_dni",e.Contains="contains",e.DoesNotContain="notcontains",e))(Je||{}),nn=(e=>(e.Camera="camera",e.Microphone="microphone",e.Screen="screen",e))(nn||{}),ke=(e=>(e.AvPermission="av_permission",e.ScreenPermission="screen_permission",e.StartTask="start_task",e.CompleteTask="complete_task",e))(ke||{}),At=(e=>(e.Number="number",e.Smiley="smiley",e.Star="star",e))(At||{}),zn,N,Gl,rn,kt,Ya,zl,Wl,Pr={},Yl=[],sv=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i;function nt(e,t){for(var n in t)e[n]=t[n];return e}function Ql(e){var t=e.parentNode;t&&t.removeChild(e)}function te(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?zn.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 kn(e,a,r,i,null)}function kn(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?++Gl:i};return i==null&&N.vnode!=null&&N.vnode(o),o}function Zl(){return{current:null}}function Ae(e){return e.children}function lv(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 Qa(e,t,n){t[0]==="-"?e.setProperty(t,n==null?"":n):e[t]=n==null?"":typeof n!="number"||sv.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||Qa(e.style,t,"");if(n)for(t in n)r&&n[t]===r[t]||Qa(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?Xa:Za,o):e.removeEventListener(t,o?Xa:Za,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 Za(e){rn=!0;try{return this.l[e.type+!1](N.event?N.event(e):e)}finally{rn=!1}}function Xa(e){rn=!0;try{return this.l[e.type+!0](N.event?N.event(e):e)}finally{rn=!1}}function Ve(e,t){this.props=e,this.context=t}function Vn(e,t){if(t==null)return e.__?Vn(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"?Vn(e):null}function Xl(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 Xl(e)}}function uv(e){rn?setTimeout(e):zl(e)}function ro(e){(!e.__d&&(e.__d=!0)&&kt.push(e)&&!Vr.__r++||Ya!==N.debounceRendering)&&((Ya=N.debounceRendering)||uv)(Vr)}function Vr(){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=nt({},o)).__v=o.__v+1,Wo(s,o,i,n.__n,s.ownerSVGElement!==void 0,o.__h!=null?[a]:null,r,a==null?Vn(o):a,o.__h),ru(r,o),o.__e!=a&&Xl(o)),kt.length>t&&kt.sort(function(l,u){return l.__v.__b-u.__v.__b}));Vr.__r=0}function Jl(e,t,n,r,i,o,a,s,l,u){var c,d,f,p,h,v,g,w=r&&r.__k||Yl,_=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"?kn(null,p,null,null,p):Array.isArray(p)?kn(Ae,{children:p},null,null,null):p.__b>0?kn(p.type,p.props,p.key,p.ref?p.ref:null,p.__v):p)!=null){if(p.__=n,p.__b=n.__b+1,(f=w[c])===null||f&&p.key==f.key&&p.type===f.type)w[c]=void 0;else for(d=0;d<_;d++){if((f=w[d])&&p.key==f.key&&p.type===f.type){w[d]=void 0;break}f=null}Wo(e,p,f=f||Pr,i,o,a,s,l,u),h=p.__e,(d=p.ref)&&f.ref!=d&&(g||(g=[]),f.ref&&g.push(f.ref,null,p),g.push(d,p.__c||h,p)),h!=null?(v==null&&(v=h),typeof p.type=="function"&&p.__k===f.__k?p.__d=l=eu(p,l,e):l=tu(e,p,f,w,h,l),typeof n.type=="function"&&(n.__d=l)):l&&f.__e==l&&l.parentNode!=e&&(l=Vn(f))}for(n.__e=v,c=_;c--;)w[c]!=null&&(typeof n.type=="function"&&w[c].__e!=null&&w[c].__e==n.__d&&(n.__d=nu(r).nextSibling),ou(w[c],w[c]));if(g)for(c=0;c<g.length;c++)iu(g[c],g[++c],g[++c])}function eu(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"?eu(r,t,n):tu(n,r,r,i,r.__e,t));return t}function at(e,t){return t=t||[],e==null||typeof e=="boolean"||(Array.isArray(e)?e.some(function(n){at(n,t)}):t.push(e)),t}function tu(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 nu(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=nu(n)))return r}return null}function Wo(e,t,n,r,i,o,a,s,l){var u,c,d,f,p,h,v,g,w,_,b,E,m,x,I,C=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=N.__b)&&u(t);try{e:if(typeof C=="function"){if(g=t.props,w=(u=C.contextType)&&r[u.__c],_=u?w?w.props.value:u.__:r,n.__c?v=(c=t.__c=n.__c).__=c.__E:("prototype"in C&&C.prototype.render?t.__c=c=new C(g,_):(t.__c=c=new Ve(g,_),c.constructor=C,c.render=dv),w&&w.sub(c),c.props=g,c.state||(c.state={}),c.context=_,c.__n=r,d=c.__d=!0,c.__h=[],c._sb=[]),c.__s==null&&(c.__s=c.state),C.getDerivedStateFromProps!=null&&(c.__s==c.state&&(c.__s=nt({},c.__s)),nt(c.__s,C.getDerivedStateFromProps(g,c.__s))),f=c.props,p=c.state,c.__v=t,d)C.getDerivedStateFromProps==null&&c.componentWillMount!=null&&c.componentWillMount(),c.componentDidMount!=null&&c.__h.push(c.componentDidMount);else{if(C.getDerivedStateFromProps==null&&g!==f&&c.componentWillReceiveProps!=null&&c.componentWillReceiveProps(g,_),!c.__e&&c.shouldComponentUpdate!=null&&c.shouldComponentUpdate(g,c.__s,_)===!1||t.__v===n.__v){for(t.__v!==n.__v&&(c.props=g,c.state=c.__s,c.__d=!1),t.__e=n.__e,t.__k=n.__k,t.__k.forEach(function(S){S&&(S.__=t)}),b=0;b<c._sb.length;b++)c.__h.push(c._sb[b]);c._sb=[],c.__h.length&&a.push(c);break e}c.componentWillUpdate!=null&&c.componentWillUpdate(g,c.__s,_),c.componentDidUpdate!=null&&c.__h.push(function(){c.componentDidUpdate(f,p,h)})}if(c.context=_,c.props=g,c.__P=e,E=N.__r,m=0,"prototype"in C&&C.prototype.render){for(c.state=c.__s,c.__d=!1,E&&E(t),u=c.render(c.props,c.state,c.context),x=0;x<c._sb.length;x++)c.__h.push(c._sb[x]);c._sb=[]}else do c.__d=!1,E&&E(t),u=c.render(c.props,c.state,c.context),c.state=c.__s;while(c.__d&&++m<25);c.state=c.__s,c.getChildContext!=null&&(r=nt(nt({},r),c.getChildContext())),d||c.getSnapshotBeforeUpdate==null||(h=c.getSnapshotBeforeUpdate(f,p)),I=u!=null&&u.type===Ae&&u.key==null?u.props.children:u,Jl(e,Array.isArray(I)?I:[I],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=cv(n.__e,t,n,r,i,o,a,l);(u=N.diffed)&&u(t)}catch(S){t.__v=null,(l||o!=null)&&(t.__e=s,t.__h=!!l,o[o.indexOf(s)]=null),N.__e(S,t,n)}}function ru(e,t){N.__c&&N.__c(t,e),e.some(function(n){try{e=n.__h,n.__h=[],e.some(function(r){r.call(n)})}catch(r){N.__e(r,n.__v)}})}function cv(e,t,n,r,i,o,a,s){var l,u,c,d=n.props,f=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(f);e=i?document.createElementNS("http://www.w3.org/2000/svg",p):document.createElement(p,f.is&&f),o=null,s=!1}if(p===null)d===f||s&&e.data===f||(e.data=f);else{if(o=o&&zn.call(e.childNodes),u=(d=n.props||Pr).dangerouslySetInnerHTML,c=f.dangerouslySetInnerHTML,!s){if(o!=null)for(d={},h=0;h<e.attributes.length;h++)d[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(lv(e,f,d,i,s),c)t.__k=[];else if(h=t.props.children,Jl(e,Array.isArray(h)?h:[h],t,n,r,i&&p!=="foreignObject",o,a,o?o[0]:n.__k&&Vn(n,0),s),o!=null)for(h=o.length;h--;)o[h]!=null&&Ql(o[h]);s||("value"in f&&(h=f.value)!==void 0&&(h!==e.value||p==="progress"&&!h||p==="option"&&h!==d.value)&&Nr(e,"value",h,d.value,!1),"checked"in f&&(h=f.checked)!==void 0&&h!==e.checked&&Nr(e,"checked",h,d.checked,!1))}return e}function iu(e,t,n){try{typeof e=="function"?e(t):e.current=t}catch(r){N.__e(r,n)}}function ou(e,t,n){var r,i;if(N.unmount&&N.unmount(e),(r=e.ref)&&(r.current&&r.current!==e.__e||iu(r,null,t)),(r=e.__c)!=null){if(r.componentWillUnmount)try{r.componentWillUnmount()}catch(o){N.__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]&&ou(r[i],t,n||typeof e.type!="function");n||e.__e==null||Ql(e.__e),e.__=e.__e=e.__d=void 0}function dv(e,t,n){return this.constructor(e,n)}function on(e,t,n){var r,i,o;N.__&&N.__(e,t),i=(r=typeof n=="function")?null:n&&n.__k||t.__k,o=[],Wo(t,e=(!r&&n||t).__k=te(Ae,null,[e]),i||Pr,Pr,t.ownerSVGElement!==void 0,!r&&n?[n]:i?null:t.firstChild?zn.call(t.childNodes):null,o,!r&&n?n:i?i.__e:t.firstChild,r),ru(o,e)}function au(e,t){on(e,t,au)}function fv(e,t,n){var r,i,o,a=nt({},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?zn.call(arguments,2):n),kn(e.type,a,r||e.key,i||e.ref,null)}function su(e,t){var n={__c:t="__cC"+Wl++,__: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,ro(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}zn=Yl.slice,N={__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}},Gl=0,rn=!1,Ve.prototype.setState=function(e,t){var n;n=this.__s!=null&&this.__s!==this.state?this.__s:this.__s=nt({},this.state),typeof e=="function"&&(e=e(nt({},n),this.props)),e&&nt(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),ro(this))},Ve.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),ro(this))},Ve.prototype.render=Ae,kt=[],zl=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,Vr.__r=0,Wl=0;var De=(e=>(e.Video="video",e.Audio="audio",e.Screen="screen",e))(De||{}),pe=(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))(pe||{}),Te=(e=>(e.Abandoned="abandoned",e.GivenUp="given.up",e.Completed="completed",e))(Te||{}),K=(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))(K||{});const Ja=e=>{let t;const n=new Set,r=(l,u)=>{const c=typeof l=="function"?l(t):l;if(!Object.is(c,t)){const d=t;t=(u!=null?u:typeof c!="object")?c:Object.assign({},t,c),n.forEach(f=>f(t,d))}},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},pv=e=>e?Ja(e):Ja;var Et,Z,pi,es,an=0,lu=[],hr=[],ts=N.__b,ns=N.__r,rs=N.diffed,is=N.__c,os=N.unmount;function Ft(e,t){N.__h&&N.__h(Z,e,an||t),an=0;var n=Z.__H||(Z.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({__V:hr}),n.__[e]}function de(e){return an=1,Yo(pu,e)}function Yo(e,t,n){var r=Ft(Et++,2);if(r.t=e,!r.__c&&(r.__=[n?n(t):pu(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 d=c.__[0];c.__=c.__N,c.__N=void 0,d!==c.__[0]&&(u=!0)}}),!(!u&&r.__c.props===o)&&(!i||i.call(this,o,a,s))}}return r.__N||r.__}function Le(e,t){var n=Ft(Et++,3);!N.__s&&Zo(n.__H,t)&&(n.__=e,n.i=t,Z.__H.__h.push(n))}function Wn(e,t){var n=Ft(Et++,4);!N.__s&&Zo(n.__H,t)&&(n.__=e,n.i=t,Z.__h.push(n))}function wt(e){return an=5,zr(function(){return{current:e}},[])}function uu(e,t,n){an=6,Wn(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 zr(e,t){var n=Ft(Et++,7);return Zo(n.__H,t)?(n.__V=e(),n.i=t,n.__h=e,n.__V):n.__}function cu(e,t){return an=8,zr(function(){return e},t)}function du(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 Qo(e,t){N.useDebugValue&&N.useDebugValue(t?t(e):e)}function hv(e){var t=Ft(Et++,10),n=de();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 fu(){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 vv(){for(var e;e=lu.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach(vr),e.__H.__h.forEach(io),e.__H.__h=[]}catch(t){e.__H.__h=[],N.__e(t,e.__v)}}N.__b=function(e){Z=null,ts&&ts(e)},N.__r=function(e){ns&&ns(e),Et=0;var t=(Z=e.__c).__H;t&&(pi===Z?(t.__h=[],Z.__h=[],t.__.forEach(function(n){n.__N&&(n.__=n.__N),n.__V=hr,n.__N=n.i=void 0})):(t.__h.forEach(vr),t.__h.forEach(io),t.__h=[])),pi=Z},N.diffed=function(e){rs&&rs(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(lu.push(t)!==1&&es===N.requestAnimationFrame||((es=N.requestAnimationFrame)||mv)(vv)),t.__H.__.forEach(function(n){n.i&&(n.__H=n.i),n.__V!==hr&&(n.__=n.__V),n.i=void 0,n.__V=hr})),pi=Z=null},N.__c=function(e,t){t.some(function(n){try{n.__h.forEach(vr),n.__h=n.__h.filter(function(r){return!r.__||io(r)})}catch(r){t.some(function(i){i.__h&&(i.__h=[])}),t=[],N.__e(r,n.__v)}}),is&&is(e,t)},N.unmount=function(e){os&&os(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.forEach(function(r){try{vr(r)}catch(i){t=i}}),n.__H=void 0,t&&N.__e(t,n.__v))};var as=typeof requestAnimationFrame=="function";function mv(e){var t,n=function(){clearTimeout(r),as&&cancelAnimationFrame(t),setTimeout(e)},r=setTimeout(n,100);as&&(t=requestAnimationFrame(n))}function vr(e){var t=Z,n=e.__c;typeof n=="function"&&(e.__c=void 0,n()),Z=t}function io(e){var t=Z;e.__c=e.__(),Z=t}function Zo(e,t){return!e||e.length!==t.length||t.some(function(n,r){return n!==e[r]})}function pu(e,t){return typeof t=="function"?t(e):t}function hu(e,t){for(var n in t)e[n]=t[n];return e}function oo(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 hi(e,t){return e===t&&(e!==0||1/e==1/t)||e!=e&&t!=t}function Mr(e){this.props=e}function vu(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:oo(this.props,i)}function r(i){return this.shouldComponentUpdate=n,te(e,i)}return r.displayName="Memo("+(e.displayName||e.name)+")",r.prototype.isReactComponent=!0,r.__f=!0,r}(Mr.prototype=new Ve).isPureReactComponent=!0,Mr.prototype.shouldComponentUpdate=function(e,t){return oo(this.props,e)||oo(this.state,t)};var ss=N.__b;N.__b=function(e){e.type&&e.type.__f&&e.ref&&(e.props.ref=e.ref,e.ref=null),ss&&ss(e)};var gv=typeof Symbol<"u"&&Symbol.for&&Symbol.for("react.forward_ref")||3911;function mu(e){function t(n){var r=hu({},n);return delete r.ref,e(r,n.ref||null)}return t.$$typeof=gv,t.render=t,t.prototype.isReactComponent=t.__f=!0,t.displayName="ForwardRef("+(e.displayName||e.name)+")",t}var ls=function(e,t){return e==null?null:at(at(e).map(t))},gu={map:ls,forEach:ls,count:function(e){return e?at(e).length:0},only:function(e){var t=at(e);if(t.length!==1)throw"Children.only";return t[0]},toArray:at},yv=N.__e;N.__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)}yv(e,t,n,r)};var us=N.unmount;function yu(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=hu({},e)).__c!=null&&(e.__c.__P===n&&(e.__c.__P=t),e.__c=null),e.__k=e.__k&&e.__k.map(function(r){return yu(r,t,n)})),e}function _u(e,t,n){return e&&(e.__v=null,e.__k=e.__k&&e.__k.map(function(r){return _u(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 Tn(){this.__u=0,this.t=null,this.__b=null}function wu(e){var t=e.__.__c;return t&&t.__a&&t.__a(e)}function bu(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 te(n,o)}return i.displayName="Lazy",i.__f=!0,i}function Gt(){this.u=null,this.o=null}N.unmount=function(e){var t=e.__c;t&&t.__R&&t.__R(),t&&e.__h===!0&&(e.type=null),us&&us(e)},(Tn.prototype=new Ve).__c=function(e,t){var n=t.__c,r=this;r.t==null&&(r.t=[]),r.t.push(n);var i=wu(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]=_u(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)},Tn.prototype.componentWillUnmount=function(){this.t=[]},Tn.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]=yu(this.__b,n,r.__O=r.__P)}this.__b=null}var i=t.__a&&te(Ae,null,e.fallback);return i&&(i.__h=null),[te(Ae,null,t.__a?null:e.children),i]};var cs=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 _v(e){return this.getChildContext=function(){return e.context},e.children}function wv(e){var t=this,n=e.i;t.componentWillUnmount=function(){on(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)}}),on(te(_v,{context:t.context},e.__v),t.l)):t.l&&t.componentWillUnmount()}function Eu(e,t){var n=te(wv,{__v:e,i:t});return n.containerInfo=t,n}(Gt.prototype=new Ve).__a=function(e){var t=this,n=wu(t.__v),r=t.o.get(e);return r[0]++,function(i){var o=function(){t.props.revealOrder?(r.push(i),cs(t,e,r)):i()};n?n(o):o()}},Gt.prototype.render=function(e){this.u=null,this.o=new Map;var t=at(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){cs(e,n,t)})};var xu=typeof Symbol<"u"&&Symbol.for&&Symbol.for("react.element")||60103,bv=/^(?: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]/,Ev=typeof document<"u",xv=function(e){return(typeof Symbol<"u"&&typeof Symbol()=="symbol"?/fil|che|rad/i:/fil|che|ra/i).test(e)};function Su(e,t,n){return t.__k==null&&(t.textContent=""),on(e,t),typeof n=="function"&&n(),e?e.__c:null}function Cu(e,t,n){return au(e,t),typeof n=="function"&&n(),e?e.__c:null}Ve.prototype.isReactComponent={},["componentWillMount","componentWillReceiveProps","componentWillUpdate"].forEach(function(e){Object.defineProperty(Ve.prototype,e,{configurable:!0,get:function(){return this["UNSAFE_"+e]},set:function(t){Object.defineProperty(this,e,{configurable:!0,writable:!0,value:t})}})});var ds=N.event;function Sv(){}function Cv(){return this.cancelBubble}function Iv(){return this.defaultPrevented}N.event=function(e){return ds&&(e=ds(e)),e.persist=Sv,e.isPropagationStopped=Cv,e.isDefaultPrevented=Iv,e.nativeEvent=e};var Iu,fs={configurable:!0,get:function(){return this.class}},ps=N.vnode;N.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];Ev&&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)&&!xv(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&&bv.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=at(n.children).forEach(function(s){s.props.selected=r.value.indexOf(s.props.value)!=-1})),t=="select"&&r.defaultValue!=null&&(r.value=at(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&&(fs.enumerable="className"in n,n.className!=null&&(r.class=n.className),Object.defineProperty(r,"className",fs))}e.$$typeof=xu,ps&&ps(e)};var hs=N.__r;N.__r=function(e){hs&&hs(e),Iu=e.__c};var ku={ReactCurrentDispatcher:{current:{readContext:function(e){return Iu.__n[e.__c].props.value}}}},kv="17.0.2";function Tu(e){return te.bind(null,e)}function Xo(e){return!!e&&e.$$typeof===xu}function Lu(e){return Xo(e)?fv.apply(null,arguments):e}function Ru(e){return!!e.__k&&(on(null,e),!0)}function Au(e){return e&&(e.base||e.nodeType===1&&e)||null}var Uu=function(e,t){return e(t)},Ou=function(e,t){return e(t)},Du=Ae;function Jo(e){e()}function Pu(e){return e}function Nu(){return[!1,Jo]}var Vu=Wn;function Mu(e,t){var n=t(),r=de({h:{__:n,v:t}}),i=r[0].h,o=r[1];return Wn(function(){i.__=n,i.v=t,hi(i.__,t())||o({h:i})},[e,n,t]),Le(function(){return hi(i.__,i.v())||o({h:i}),e(function(){hi(i.__,i.v())||o({h:i})})},[e]),n}var Tv={useState:de,useId:fu,useReducer:Yo,useEffect:Le,useLayoutEffect:Wn,useInsertionEffect:Vu,useTransition:Nu,useDeferredValue:Pu,useSyncExternalStore:Mu,startTransition:Jo,useRef:wt,useImperativeHandle:uu,useMemo:zr,useCallback:cu,useContext:du,useDebugValue:Qo,version:"17.0.2",Children:gu,render:Su,hydrate:Cu,unmountComponentAtNode:Ru,createPortal:Eu,createElement:te,createContext:su,createFactory:Tu,cloneElement:Lu,createRef:Zl,Fragment:Ae,isValidElement:Xo,findDOMNode:Au,Component:Ve,PureComponent:Mr,memo:vu,forwardRef:mu,flushSync:Ou,unstable_batchedUpdates:Uu,StrictMode:Du,Suspense:Tn,SuspenseList:Gt,lazy:bu,__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED:ku};const Lv=Object.freeze(Object.defineProperty({__proto__:null,Children:gu,PureComponent:Mr,StrictMode:Du,Suspense:Tn,SuspenseList:Gt,__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED:ku,cloneElement:Lu,createFactory:Tu,createPortal:Eu,default:Tv,findDOMNode:Au,flushSync:Ou,forwardRef:mu,hydrate:Cu,isValidElement:Xo,lazy:bu,memo:vu,render:Su,startTransition:Jo,unmountComponentAtNode:Ru,unstable_batchedUpdates:Uu,useDeferredValue:Pu,useInsertionEffect:Vu,useSyncExternalStore:Mu,useTransition:Nu,version:kv,Component:Ve,Fragment:Ae,createContext:su,createElement:te,createRef:Zl,useCallback:cu,useContext:du,useDebugValue:Qo,useEffect:Le,useErrorBoundary:hv,useId:fu,useImperativeHandle:uu,useLayoutEffect:Wn,useMemo:zr,useReducer:Yo,useRef:wt,useState:de},Symbol.toStringTag,{value:"Module"}));var ju={exports:{}},Bu={};const Fu=Tc(Lv);var Hu={exports:{}},Ku={};/**
15
+ `).slice(t).filter(Cl).map(function(r){return`
16
+ `+r}).join("")):""}var mp=["Modify","Bulk","OpenFailed","VersionChange","Schema","Upgrade","InvalidTable","MissingAPI","NoSuchDatabase","InvalidArgument","SubTransaction","Unsupported","Internal","DatabaseClosed","PrematureCommit","ForeignAwait"],Il=["Unknown","Constraint","Data","TransactionInactive","ReadOnly","Version","NotFound","InvalidState","InvalidAccess","Abort","Timeout","QuotaExceeded","Syntax","DataClone"],No=mp.concat(Il),gp={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 pn(e,t){this._e=Kt(),this.name=e,this.message=t}fn(pn).from(Error).extend({stack:{get:function(){return this._stack||(this._stack=this.name+": "+this.message+Ni(this._e,2))}},toString:function(){return this.name+": "+this.message}});function kl(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
+ `)}function Ir(e,t,n,r){this._e=Kt(),this.failures=t,this.failedKeys=r,this.successCount=n,this.message=kl(e,t)}fn(Ir).from(pn);function Cn(e,t){this._e=Kt(),this.name="BulkError",this.failures=Object.keys(t).map(function(n){return t[n]}),this.failuresByPos=t,this.message=kl(e,t)}fn(Cn).from(pn);var Mo=No.reduce(function(e,t){return e[t]=t+"Error",e},{}),yp=pn,V=No.reduce(function(e,t){var n=t+"Error";function r(i,o){this._e=Kt(),this.name=n,i?typeof i=="string"?(this.message=""+i+(o?`
18
+ `+o:""),this.inner=o||null):typeof i=="object"&&(this.message=i.name+" "+i.message,this.inner=i):(this.message=gp[t]||n,this.inner=null)}return fn(r).from(yp),e[t]=r,e},{});V.Syntax=SyntaxError;V.Type=TypeError;V.Range=RangeError;var Pa=Il.reduce(function(e,t){return e[t+"Error"]=V[t],e},{});function _p(e,t){if(!e||e instanceof pn||e instanceof TypeError||e instanceof SyntaxError||!e.name||!Pa[e.name])return e;var n=new Pa[e.name](t||e.message,e);return"stack"in e&&st(n,"stack",{get:function(){return this.inner.stack}}),n}var qr=No.reduce(function(e,t){return["Syntax","Type","Range"].indexOf(t)===-1&&(e[t+"Error"]=V[t]),e},{});qr.ModifyError=Ir;qr.DexieError=pn;qr.BulkError=Cn;function G(){}function $n(e){return e}function wp(e,t){return e==null||e===$n?t:function(n){return t(e(n))}}function jt(e,t){return function(){e.apply(this,arguments),t.apply(this,arguments)}}function bp(e,t){return e===G?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?jt(r,this.onsuccess):r),i&&(this.onerror=this.onerror?jt(i,this.onerror):i),o!==void 0?o:n}}function Ep(e,t){return e===G?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?jt(n,this.onsuccess):n),r&&(this.onerror=this.onerror?jt(r,this.onerror):r)}}function xp(e,t){return e===G?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?jt(i,this.onsuccess):i),o&&(this.onerror=this.onerror?jt(o,this.onerror):o),r===void 0?a===void 0?void 0:a:me(r,a)}}function Sp(e,t){return e===G?t:function(){return t.apply(this,arguments)===!1?!1:e.apply(this,arguments)}}function Vo(e,t){return e===G?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 On={},Cp=100,Ip=20,Tl=100,jo=typeof Promise>"u"?[]:function(){var e=Promise.resolve();if(typeof crypto>"u"||!crypto.subtle)return[e,Un(e),e];var t=crypto.subtle.digest("SHA-512",new Uint8Array([0]));return[t,Un(t),e]}(),Mi=jo[0],kr=jo[1],Vi=jo[2],Ll=kr&&kr.then,ur=Mi&&Mi.constructor,Bo=!!Vi,ji=!1,kp=Vi?function(){Vi.then(tr)}:Y.setImmediate?setImmediate.bind(null,tr):Y.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)},Dn=function(e,t){xn.push([e,t]),Tr&&(kp(),Tr=!1)},Bi=!0,Tr=!0,Pt=[],cr=[],Fi=null,Hi=$n,en={id:"global",global:!0,ref:0,unhandleds:[],onunhandled:Va,pgp:!1,env:{},finalize:function(){this.unhandleds.forEach(function(e){try{Va(e[0],e[1])}catch{}})}},N=en,xn=[],Nt=0,dr=[];function A(e){if(typeof this!="object")throw new TypeError("Promises must be constructed via new");this._listeners=[],this.onuncatched=G,this._lib=!1;var t=this._PSD=N;if(We&&(this._stackHolder=Kt(),this._prev=null,this._numPrev=0),typeof e!="function"){if(e!==On)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,Al(this,e)}var $i={get:function(){var e=N,t=Lr;function n(r,i){var o=this,a=!e.global&&(e!==N||t!==Lr),s=a&&!lt(),l=new A(function(u,c){Fo(o,new Rl(Ar(r,e,a,s),Ar(i,e,a,s),u,c,e))});return We&&Dl(l,this),l}return n.prototype=On,n},set:function(e){st(this,"then",e&&e.prototype===On?$i:{get:function(){return e},set:$i.set})}};on(A.prototype,{then:$i,_then:function(e,t){Fo(this,new Rl(null,null,e,t,N))},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=Ol(this,[],Ip),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&&st(A.prototype,Symbol.toStringTag,"Dexie.Promise");en.env=Pl();function Rl(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}on(A,{all:function(){var e=Xe.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(On,!0,e);return Dl(t,Fi),t},reject:fr,race:function(){var e=Xe.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 N},set:function(e){return N=e}},totalEchoes:{get:function(){return Lr}},newPSD:wt,usePSD:vn,scheduler:{get:function(){return Dn},set:function(e){Dn=e}},rejectionMapper:{get:function(){return Hi},set:function(e){Hi=e}},follow:function(e,t){return new A(function(n,r){return wt(function(i,o){var a=N;a.unhandleds=[],a.onunhandled=o,a.finalize=jt(function(){var s=this;Lp(function(){s.unhandleds.length===0?i():o(s.unhandleds[0])})},a.finalize),e()},t,n,r)})}});ur&&(ur.allSettled&&st(A,"allSettled",function(){var e=Xe.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"&&st(A,"any",function(){var e=Xe.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 Al(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&&Kn();n&&typeof n.then=="function"?Al(e,function(i,o){n instanceof A?n._then(i,o):n.then(i,o)}):(e._state=!0,e._value=n,Ul(e)),r&&qn()}},Ki.bind(null,e))}catch(n){Ki(e,n)}}function Ki(e,t){if(cr.push(t),e._state===null){var n=e._lib&&Kn();t=Hi(t),e._state=!1,e._value=t,We&&t!==null&&typeof t=="object"&&!t._promise&&up(function(){var r=Do(t,"stack");t._promise=e,st(t,"stack",{get:function(){return ji?r&&(r.get?r.get.apply(t):r.value):e.stack}})}),Rp(e),Ul(e),n&&qn()}}function Ul(e){var t=e._listeners;e._listeners=[];for(var n=0,r=t.length;n<r;++n)Fo(e,t[n]);var i=e._PSD;--i.ref||i.finalize(),Nt===0&&(++Nt,Dn(function(){--Nt===0&&Ho()},[]))}function Fo(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,++Nt,Dn(Tp,[n,e,t])}function Tp(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&&Ap(t)),n.resolve(r)}catch(o){n.reject(o)}finally{Fi=null,--Nt===0&&Ho(),--n.psd.ref||n.psd.finalize()}}function Ol(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=Ni(i,0)):(o=i,a=""),t.push(o+(a?": "+a:"")+r)}return We&&(r=Ni(e._stackHolder,2),r&&t.indexOf(r)===-1&&t.push(r),e._prev&&Ol(e._prev,t,n)),t}function Dl(e,t){var n=t?t._numPrev+1:0;n<Cp&&(e._prev=t,e._numPrev=n)}function tr(){Kn()&&qn()}function Kn(){var e=Bi;return Bi=!1,Tr=!1,e}function qn(){var e,t,n;do for(;xn.length>0;)for(e=xn,xn=[],n=e.length,t=0;t<n;++t){var r=e[t];r[0].apply(null,r[1])}while(xn.length>0);Bi=!0,Tr=!0}function Ho(){var e=Pt;Pt=[],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 Lp(e){function t(){e(),dr.splice(dr.indexOf(t),1)}dr.push(t),++Nt,Dn(function(){--Nt===0&&Ho()},[])}function Rp(e){Pt.some(function(t){return t._value===e._value})||Pt.push(e)}function Ap(e){for(var t=Pt.length;t;)if(Pt[--t]._value===e._value){Pt.splice(t,1);return}}function fr(e){return new A(On,!1,e)}function J(e,t){var n=N;return function(){var r=Kn(),i=N;try{return bt(n,!0),e.apply(this,arguments)}catch(o){t&&t(o)}finally{bt(i,!1),r&&qn()}}}var pe={awaits:0,echoes:0,id:0},Up=0,pr=[],si=0,Lr=0,Op=0;function wt(e,t,n,r){var i=N,o=Object.create(i);o.parent=i,o.ref=0,o.global=!1,o.id=++Op;var a=en.env;o.env=Bo?{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:Na(a.nthen,o),gthen:Na(a.gthen,o)}:{},t&&me(o,t),++i.ref,o.finalize=function(){--this.parent.ref||this.parent.finalize()};var s=vn(o,e,n,r);return o.ref===0&&o.finalize(),s}function hn(){return pe.id||(pe.id=++Up),++pe.awaits,pe.echoes+=Tl,pe.id}function lt(){return pe.awaits?(--pe.awaits===0&&(pe.id=0),pe.echoes=pe.awaits*Tl,!0):!1}(""+Ll).indexOf("[native code]")===-1&&(hn=lt=G);function Rr(e){return pe.echoes&&e&&e.constructor===ur?(hn(),e.then(function(t){return lt(),t},function(t){return lt(),ae(t)})):e}function Dp(e){++Lr,(!pe.echoes||--pe.echoes===0)&&(pe.echoes=pe.id=0),pr.push(N),bt(e,!0)}function Pp(){var e=pr[pr.length-1];pr.pop(),bt(e,!1)}function bt(e,t){var n=N;if((t?pe.echoes&&(!si++||e!==N):si&&(!--si||e!==N))&&Nl(t?Dp.bind(null,e):Pp),e!==N&&(N=e,n===en&&(en.env=Pl()),Bo)){var r=en.env.Promise,i=e.env;kr.then=i.nthen,r.prototype.then=i.gthen,(n.global||e.global)&&(Object.defineProperty(Y,"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 Pl(){var e=Y.Promise;return Bo?{Promise:e,PromiseProp:Object.getOwnPropertyDescriptor(Y,"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 vn(e,t,n,r,i){var o=N;try{return bt(e,!0),t(n,r,i)}finally{bt(o,!1)}}function Nl(e){Ll.call(Mi,e)}function Ar(e,t,n,r){return typeof e!="function"?e:function(){var i=N;n&&hn(),bt(t,!0);try{return e.apply(this,arguments)}finally{bt(i,!1),r&&Nl(lt)}}}function Na(e,t){return function(n,r){return e.call(this,Ar(n,t),Ar(r,t))}}var Ma="unhandledrejection";function Va(e,t){var n;try{n=t.onuncatched(e)}catch{}if(n!==!1)try{var r,i={promise:t,reason:e};if(Y.document&&document.createEvent?(r=document.createEvent("Event"),r.initEvent(Ma,!0,!0),me(r,i)):Y.CustomEvent&&(r=new CustomEvent(Ma,{detail:i}),me(r,i)),r&&Y.dispatchEvent&&(dispatchEvent(r),!Y.PromiseRejectionEvent&&Y.onunhandledrejection))try{Y.onunhandledrejection(r)}catch{}We&&r&&!r.defaultPrevented&&console.warn("Unhandled rejection: "+(e.stack||e))}catch{}}var ae=A.reject;function qi(e,t,n,r){if(!e.idbdb||!e._state.openComplete&&!N.letThrough&&!e._vip){if(e._state.openComplete)return ae(new V.DatabaseClosed(e._state.dbOpenError));if(!e._state.isBeingOpened){if(!e._options.autoOpen)return ae(new V.DatabaseClosed);e.open().catch(G)}return e._state.dbReadyPromise.then(function(){return qi(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===Mo.InvalidState&&e.isOpen()&&--e._state.PR1398_maxLoop>0?(console.warn("Dexie: Need to reopen db"),e._close(),e.open().then(function(){return qi(e,t,n,r)})):ae(o)}return i._promise(t,function(o,a){return wt(function(){return N.trans=i,r(o,a,i)})}).then(function(o){return i._completion.then(function(){return o})})}}var ja="3.2.4",Ut=String.fromCharCode(65535),Gi=-1/0,Ye="Invalid key provided. Keys must be of type string, number, Date or Array<string | number | Date>.",Ml="String expected.",In=[],Gr=typeof navigator<"u"&&/(MSIE|Trident|Edge)/.test(navigator.userAgent),Np=Gr,Mp=Gr,Vl=function(e){return!/(dexie\.js|dexie\.min\.js)/.test(e)},zr="__dbnames",li="readonly",ui="readwrite";function Bt(e,t){return e?t?function(){return e.apply(this,arguments)&&t.apply(this,arguments)}:e:t}var jl={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 Vp=function(){function e(){}return e.prototype._trans=function(t,n,r){var i=this._tx||N.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=Kn();try{return i&&i.db===this.db?i===N.trans?i._promise(t,a,r):wt(function(){return i._promise(t,a,r)},{trans:i,transless:N.transless||N}):qi(this.db,t,[this.name],a)}finally{s&&qn()}},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(he(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(d){return c.keyPath.indexOf(d)>=0})&&c.keyPath.every(function(d){return n.indexOf(d)>=0})})[0];if(r&&this.db._maxKey!==Ut)return this.where(r.name).equals(r.keyPath.map(function(c){return t[c]}));!r&&We&&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,d){try{return o.cmp(c,d)===0}catch{return!1}}var s=n.reduce(function(c,d){var f=c[0],p=c[1],v=i[d],h=t[d];return[f||v,f||!v?Bt(p,v&&v.multi?function(g){var _=it(g,d);return he(_)&&_.some(function(w){return a(h,w)})}:function(g){return a(h,it(g,d))}):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,he(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(Se(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{Ve(t,a,l)}catch{}return l})},e.prototype.update=function(t,n){if(typeof t=="object"&&!he(t)){var r=it(t,this.schema.primKey.keyPath);if(r===void 0)return ae(new V.InvalidArgument("Given object does not contain its primary key"));try{typeof n!="function"?ne(n).forEach(function(i){Ve(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{Ve(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:jl})}).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 d=t.length,f=c&&u?t.map(nr(c)):t;return i.core.mutate({trans:s,type:"add",keys:o,values:f,wantResults:a}).then(function(p){var v=p.numFailures,h=p.results,g=p.lastResult,_=p.failures,w=a?h:g;if(v===0)return w;throw new Cn(i.name+".bulkAdd(): "+v+" of "+d+" operations failed",_)})})},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 d=t.length,f=c&&u?t.map(nr(c)):t;return i.core.mutate({trans:s,type:"put",keys:o,values:f,wantResults:a}).then(function(p){var v=p.numFailures,h=p.results,g=p.lastResult,_=p.failures,w=a?h:g;if(v===0)return w;throw new Cn(i.name+".bulkPut(): "+v+" of "+d+" operations failed",_)})})},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 Cn(n.name+".bulkDelete(): "+o+" of "+r+" operations failed",s)})},e}();function Gn(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=Sp),u||(u=G);var c={subscribers:[],fire:u,subscribe:function(d){c.subscribers.indexOf(d)===-1&&(c.subscribers.push(d),c.fire=l(c.fire,d))},unsubscribe:function(d){c.subscribers=c.subscribers.filter(function(f){return f!==d}),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(he(u))o(l,s[l][0],s[l][1]);else if(u==="asap")var c=o(l,$n,function(){for(var f=arguments.length,p=new Array(f);f--;)p[f]=arguments[f];c.subscribers.forEach(function(v){_l(function(){v.apply(null,p)})})});else throw new V.InvalidArgument("Invalid event config")})}}function zn(e,t){return fn(t).from({prototype:e}),t}function jp(e){return zn(Vp.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:Gn(null,{creating:[bp,G],reading:[wp,$n],updating:[xp,G],deleting:[Ep,G]})})}function Wt(e,t){return!(e.filter||e.algorithm||e.or)&&(t?e.justLimit:!e.replayFilter)}function ci(e,t){e.filter=Bt(e.filter,t)}function di(e,t,n){var r=e.replayFilter;e.replayFilter=r?function(){return Bt(r(),t())}:t,e.justLimit=n&&!r}function Bp(e,t){e.isMatch=Bt(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 Ba(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?Bt(e.filter,e.replayFilter()):e.filter;if(e.or){var o={},a=function(s,l,u){if(!i||i(l,u,function(f){return l.stop(f)},function(f){return l.fail(f)})){var c=l.primaryKey,d=""+c;d==="[object ArrayBuffer]"&&(d=""+new Uint8Array(c)),Se(o,d)||(o[d]=!0,t(s,l,u))}};return Promise.all([e.or._iterate(a,n),Fa(Ba(e,r,n),e.algorithm,a,!e.keysOnly&&e.valueMapper)])}else return Fa(Ba(e,r,n),Bt(e.algorithm,i),t,!e.keysOnly&&e.valueMapper)}function Fa(e,t,n,r){var i=r?function(a,s,l){return n(r(a),s,l)}:n,o=J(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=G},function(l){a.fail(l),s=G}))&&o(a.value,a,function(l){return s=l}),s()})})}function ve(e,t){try{var n=Ha(e),r=Ha(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 Hp($a(e),$a(t));case"Array":return Fp(e,t)}}catch{}return NaN}function Fp(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 Hp(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 Ha(e){var t=typeof e;if(t!=="object")return t;if(ArrayBuffer.isView(e))return"binary";var n=Di(e);return n==="ArrayBuffer"?"binary":n}function $a(e){return e instanceof Uint8Array?e:ArrayBuffer.isView(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):new Uint8Array(e)}var $p=function(){function e(){}return e.prototype._read=function(t,n){var r=this._ctx;return r.error?r.table._trans(null,ae.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,ae.bind(null,n.error)):n.table._trans("readwrite",t,"locked")},e.prototype._addAlgorithm=function(t){var n=this._ctx;n.algorithm=Bt(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(Wt(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 d=a(u,o),f=a(c,o);return d<f?-s:d>f?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"&&Wt(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,Wt(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)}),Bp(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"&&Wt(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=Se(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(_){for(var w=!1,E=0;E<s;++E){var b=a[E],m=t[b];it(_,b)!==m&&(Ve(_,b,m),w=!0)}return w}}var l=r.table.core,u=l.schema.primaryKey,c=u.outbound,d=u.extractKey,f=n.db._options.modifyChunkSize||200,p=[],v=0,h=[],g=function(_,w){var E=w.failures,b=w.numFailures;v+=_-b;for(var m=0,x=ne(E);m<x.length;m++){var k=x[m];p.push(E[k])}};return n.clone().primaryKeys().then(function(_){var w=function(E){var b=Math.min(f,_.length-E);return l.getMany({trans:i,keys:_.slice(E,E+b),cache:"immutable"}).then(function(m){for(var x=[],k=[],S=c?[]:null,I=[],R=0;R<b;++R){var O=m[R],T={value:Hn(O),primKey:_[E+R]};o.call(T,T.value,T)!==!1&&(T.value==null?I.push(_[E+R]):!c&&ve(d(O),d(T.value))!==0?(I.push(_[E+R]),x.push(T.value)):(k.push(T.value),c&&S.push(_[E+R])))}var D=Wt(r)&&r.limit===1/0&&(typeof t!="function"||t===fi)&&{index:r.index,range:r.range};return Promise.resolve(x.length>0&&l.mutate({trans:i,type:"add",values:x}).then(function(z){for(var C in z.failures)I.splice(parseInt(C),1);g(x.length,z)})).then(function(){return(k.length>0||D&&typeof t=="object")&&l.mutate({trans:i,type:"put",keys:S,values:k,criteria:D,changeSpec:typeof t!="function"&&t}).then(function(z){return g(k.length,z)})}).then(function(){return(I.length>0||D&&t===fi)&&l.mutate({trans:i,type:"delete",keys:I,criteria:D}).then(function(z){return g(I.length,z)})}).then(function(){return _.length>E+b&&w(E+f)})})};return w(0).then(function(){if(p.length>0)throw new Ir("Error modifying one or more objects",p,v,h);return _.length})})})},e.prototype.delete=function(){var t=this._ctx,n=t.range;return Wt(t)&&(t.isPrimKey&&!Mp||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 Kp(e){return zn($p.prototype,function(n,r){this.db=e;var i=jl,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!==$n?l:null}})}function qp(e,t){return e<t?-1:e===t?0:1}function Gp(e,t){return e>t?-1:e===t?0:1}function we(e,t,n){var r=e instanceof Fl?new e.Collection(e):e;return r._ctx.error=n?new n(t):new TypeError(t),r}function Yt(e){return new e.Collection(e,function(){return Bl("")}).limit(0)}function zp(e){return e==="next"?function(t){return t.toUpperCase()}:function(t){return t.toLowerCase()}}function Wp(e){return e==="next"?function(t){return t.toLowerCase()}:function(t){return t.toUpperCase()}}function Yp(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,d=n.length;if(!n.every(function(h){return typeof h=="string"}))return we(e,Ml);function f(h){i=zp(h),o=Wp(h),a=h==="next"?qp:Gp;var g=n.map(function(_){return{lower:o(_),upper:i(_)}}).sort(function(_,w){return a(_.lower,w.lower)});s=g.map(function(_){return _.upper}),l=g.map(function(_){return _.lower}),u=h,c=h==="next"?"":r}f("next");var p=new e.Collection(e,function(){return ft(s[0],l[d-1]+r)});p._ondirectionchange=function(h){f(h)};var v=0;return p._addAlgorithm(function(h,g,_){var w=h.key;if(typeof w!="string")return!1;var E=o(w);if(t(E,l,v))return!0;for(var b=null,m=v;m<d;++m){var x=Yp(w,E,s[m],l[m],a,u);x===null&&b===null?v=m+1:(b===null||a(b,x)>0)&&(b=x)}return g(b!==null?function(){h.continue(b+c)}:_),!1}),p}function ft(e,t,n,r){return{type:2,lower:e,upper:t,lowerOpen:n,upperOpen:r}}function Bl(e){return{type:1,lower:e,upper:e}}var Fl=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)?Yt(this):new this.Collection(this,function(){return ft(t,n,!r,!i)})}catch{return we(this,Ye)}},e.prototype.equals=function(t){return t==null?we(this,Ye):new this.Collection(this,function(){return Bl(t)})},e.prototype.above=function(t){return t==null?we(this,Ye):new this.Collection(this,function(){return ft(t,void 0,!0)})},e.prototype.aboveOrEqual=function(t){return t==null?we(this,Ye):new this.Collection(this,function(){return ft(t,void 0,!1)})},e.prototype.below=function(t){return t==null?we(this,Ye):new this.Collection(this,function(){return ft(void 0,t,!1,!0)})},e.prototype.belowOrEqual=function(t){return t==null?we(this,Ye):new this.Collection(this,function(){return ft(void 0,t)})},e.prototype.startsWith=function(t){return typeof t!="string"?we(this,Ml):this.between(t,t+Ut,!0,!0)},e.prototype.startsWithIgnoreCase=function(t){return t===""?this.startsWith(t):ir(this,function(n,r){return n.indexOf(r[0])===0},[t],Ut)},e.prototype.equalsIgnoreCase=function(t){return ir(this,function(n,r){return n===r[0]},[t],"")},e.prototype.anyOfIgnoreCase=function(){var t=Xe.apply(Qt,arguments);return t.length===0?Yt(this):ir(this,function(n,r){return r.indexOf(n)!==-1},t,"")},e.prototype.startsWithAnyOfIgnoreCase=function(){var t=Xe.apply(Qt,arguments);return t.length===0?Yt(this):ir(this,function(n,r){return r.some(function(i){return n.indexOf(i)===0})},t,Ut)},e.prototype.anyOf=function(){var t=this,n=Xe.apply(Qt,arguments),r=this._cmp;try{n.sort(r)}catch{return we(this,Ye)}if(n.length===0)return Yt(this);var i=new this.Collection(this,function(){return ft(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=Xe.apply(Qt,arguments);if(t.length===0)return new this.Collection(this);try{t.sort(this._ascending)}catch{return we(this,Ye)}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 Yt(this);if(!t.every(function(m){return m[0]!==void 0&&m[1]!==void 0&&o(m[0],m[1])<=0}))return we(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 d(m,x){for(var k=0,S=m.length;k<S;++k){var I=m[k];if(i(x[0],I[1])<0&&i(x[1],I[0])>0){I[0]=s(I[0],x[0]),I[1]=l(I[1],x[1]);break}}return k===S&&m.push(x),m}var f=o;function p(m,x){return f(m[0],x[0])}var v;try{v=t.reduce(d,[]),v.sort(p)}catch{return we(this,Ye)}var h=0,g=c?function(m){return o(m,v[h][1])>0}:function(m){return o(m,v[h][1])>=0},_=u?function(m){return a(m,v[h][0])>0}:function(m){return a(m,v[h][0])>=0};function w(m){return!g(m)&&!_(m)}var E=g,b=new this.Collection(this,function(){return ft(v[0][0],v[v.length-1][1],!u,!c)});return b._ondirectionchange=function(m){m==="next"?(E=g,f=o):(E=_,f=a),v.sort(p)},b._addAlgorithm(function(m,x,k){for(var S=m.key;E(S);)if(++h,h===v.length)return x(k),!1;return w(S)?!0:(r._cmp(S,v[h][1])===0||r._cmp(S,v[h][0])===0||x(function(){f===o?m.continue(v[h][0]):m.continue(v[h][1])}),!1)}),b},e.prototype.startsWithAnyOf=function(){var t=Xe.apply(Qt,arguments);return t.every(function(n){return typeof n=="string"})?t.length===0?Yt(this):this.inAnyRange(t.map(function(n){return[n,n+Ut]})):we(this,"startsWithAnyOf() only works with strings")},e}();function Qp(e){return zn(Fl.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 He(e){return J(function(t){return Pn(t),e(t.target.error),!1})}function Pn(e){e.stopPropagation&&e.stopPropagation(),e.preventDefault&&e.preventDefault()}var Nn="storagemutated",mt="x-storagemutated-1",Et=Gn(null,Nn),Zp=function(){function e(){}return e.prototype._lock=function(){return En(!N.global),++this._reculock,this._reculock===1&&!N.global&&(N.lockOwnerFor=this),this},e.prototype._unlock=function(){if(En(!N.global),--this._reculock===0)for(N.global||(N.lockOwnerFor=null);this._blockedFuncs.length>0&&!this._locked();){var t=this._blockedFuncs.shift();try{vn(t[1],t[0])}catch{}}return this},e.prototype._locked=function(){return this._reculock&&N.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(En(!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 En(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=J(function(o){Pn(o),n._reject(t.error)}),t.onabort=J(function(o){Pn(o),n.active&&n._reject(new V.Abort(t.error)),n.active=!1,n.on("abort").fire(o)}),t.oncomplete=J(function(){n.active=!1,n._resolve(),"mutatedParts"in t&&Et.storagemutated.fire(t.mutatedParts)}),this},e.prototype._promise=function(t,n,r){var i=this;if(t==="readwrite"&&this.mode!=="readwrite")return ae(new V.ReadOnly("Transaction is readonly"));if(!this.active)return ae(new V.TransactionInactive);if(this._locked())return new A(function(a,s){i._blockedFuncs.push([function(){i._promise(t,n,r).then(a,s)},N])});if(r)return wt(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(J(a.bind(null,l)))},function(l){return n._waitingQueue.push(J(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(Se(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 Xp(e){return zn(Zp.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=Gn(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(),ae(l)})})}function zi(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?"++":"")+Hl(t)}}function Hl(e){return typeof e=="string"?e:e?"["+[].join.call(e,"+")+"]":""}function $l(e,t,n){return{name:e,primKey:t,indexes:n,mappedClass:null,idxByName:wl(n,function(r){return[r.name,r]})}}function Jp(e){return e.length===1?e[0]:e}var Mn=function(e){try{return e.only([[]]),Mn=function(){return[[]]},[[]]}catch{return Mn=function(){return Ut},Ut}};function Wi(e){return e==null?function(){}:typeof e=="string"?eh(e):function(t){return it(t,e)}}function eh(e){var t=e.split(".");return t.length===1?function(n){return n[e]}:function(n){return it(n,e)}}function Ka(e){return[].slice.call(e)}var th=0;function kn(e){return e==null?":id":typeof e=="string"?e:"["+e.join("+")+"]"}function nh(e,t,n){function r(d,f){var p=Ka(d.objectStoreNames);return{schema:{name:d.name,tables:p.map(function(v){return f.objectStore(v)}).map(function(v){var h=v.keyPath,g=v.autoIncrement,_=he(h),w=h==null,E={},b={name:v.name,primaryKey:{name:null,isPrimaryKey:!0,outbound:w,compound:_,keyPath:h,autoIncrement:g,unique:!0,extractKey:Wi(h)},indexes:Ka(v.indexNames).map(function(m){return v.index(m)}).map(function(m){var x=m.name,k=m.unique,S=m.multiEntry,I=m.keyPath,R=he(I),O={name:x,compound:R,keyPath:I,unique:k,multiEntry:S,extractKey:Wi(I)};return E[kn(I)]=O,O}),getIndexByKeyPath:function(m){return E[kn(m)]}};return E[":id"]=b.primaryKey,h!=null&&(E[kn(h)]=b.primaryKey),b})},hasGetAll:p.length>0&&"getAll"in f.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(d){if(d.type===3)return null;if(d.type===4)throw new Error("Cannot convert never type to IDBKeyRange");var f=d.lower,p=d.upper,v=d.lowerOpen,h=d.upperOpen,g=f===void 0?p===void 0?null:t.upperBound(p,!!h):p===void 0?t.lowerBound(f,!!v):t.bound(f,p,!!v,!!h);return g}function o(d){var f=d.name;function p(g){var _=g.trans,w=g.type,E=g.keys,b=g.values,m=g.range;return new Promise(function(x,k){x=J(x);var S=_.objectStore(f),I=S.keyPath==null,R=w==="put"||w==="add";if(!R&&w!=="delete"&&w!=="deleteRange")throw new Error("Invalid operation type: "+w);var O=(E||b||{length:1}).length;if(E&&b&&E.length!==b.length)throw new Error("Given keys array must have same length as given values array.");if(O===0)return x({numFailures:0,failures:{},results:[],lastResult:void 0});var T,D=[],z=[],C=0,W=function(Fe){++C,Pn(Fe)};if(w==="deleteRange"){if(m.type===4)return x({numFailures:C,failures:z,results:[],lastResult:void 0});m.type===3?D.push(T=S.clear()):D.push(T=S.delete(i(m)))}else{var re=R?I?[b,E]:[b,null]:[E,null],Ie=re[0],_e=re[1];if(R)for(var ce=0;ce<O;++ce)D.push(T=_e&&_e[ce]!==void 0?S[w](Ie[ce],_e[ce]):S[w](Ie[ce])),T.onerror=W;else for(var ce=0;ce<O;++ce)D.push(T=S[w](Ie[ce])),T.onerror=W}var dt=function(Fe){var gn=Fe.target.result;D.forEach(function(Oe,Qn){return Oe.error!=null&&(z[Qn]=Oe.error)}),x({numFailures:C,failures:z,results:w==="delete"?E:D.map(function(Oe){return Oe.result}),lastResult:gn})};T.onerror=function(Fe){W(Fe),dt(Fe)},T.onsuccess=dt})}function v(g){var _=g.trans,w=g.values,E=g.query,b=g.reverse,m=g.unique;return new Promise(function(x,k){x=J(x);var S=E.index,I=E.range,R=_.objectStore(f),O=S.isPrimaryKey?R:R.index(S.name),T=b?m?"prevunique":"prev":m?"nextunique":"next",D=w||!("openKeyCursor"in O)?O.openCursor(i(I),T):O.openKeyCursor(i(I),T);D.onerror=He(k),D.onsuccess=J(function(z){var C=D.result;if(!C){x(null);return}C.___id=++th,C.done=!1;var W=C.continue.bind(C),re=C.continuePrimaryKey;re&&(re=re.bind(C));var Ie=C.advance.bind(C),_e=function(){throw new Error("Cursor not started")},ce=function(){throw new Error("Cursor not stopped")};C.trans=_,C.stop=C.continue=C.continuePrimaryKey=C.advance=_e,C.fail=J(k),C.next=function(){var dt=this,Fe=1;return this.start(function(){return Fe--?dt.continue():dt.stop()}).then(function(){return dt})},C.start=function(dt){var Fe=new Promise(function(Oe,Qn){Oe=J(Oe),D.onerror=He(Qn),C.fail=Qn,C.stop=function(Nc){C.stop=C.continue=C.continuePrimaryKey=C.advance=ce,Oe(Nc)}}),gn=function(){if(D.result)try{dt()}catch(Oe){C.fail(Oe)}else C.done=!0,C.start=function(){throw new Error("Cursor behind last entry")},C.stop()};return D.onsuccess=J(function(Oe){D.onsuccess=gn,gn()}),C.continue=W,C.continuePrimaryKey=re,C.advance=Ie,gn(),Fe},x(C)},k)})}function h(g){return function(_){return new Promise(function(w,E){w=J(w);var b=_.trans,m=_.values,x=_.limit,k=_.query,S=x===1/0?void 0:x,I=k.index,R=k.range,O=b.objectStore(f),T=I.isPrimaryKey?O:O.index(I.name),D=i(R);if(x===0)return w({result:[]});if(g){var z=m?T.getAll(D,S):T.getAllKeys(D,S);z.onsuccess=function(Ie){return w({result:Ie.target.result})},z.onerror=He(E)}else{var C=0,W=m||!("openKeyCursor"in T)?T.openCursor(D):T.openKeyCursor(D),re=[];W.onsuccess=function(Ie){var _e=W.result;if(!_e)return w({result:re});if(re.push(m?_e.value:_e.primaryKey),++C===x)return w({result:re});_e.continue()},W.onerror=He(E)}})}}return{name:f,schema:d,mutate:p,getMany:function(g){var _=g.trans,w=g.keys;return new Promise(function(E,b){E=J(E);for(var m=_.objectStore(f),x=w.length,k=new Array(x),S=0,I=0,R,O=function(C){var W=C.target;(k[W._pos]=W.result)!=null,++I===S&&E(k)},T=He(b),D=0;D<x;++D){var z=w[D];z!=null&&(R=m.get(w[D]),R._pos=D,R.onsuccess=O,R.onerror=T,++S)}S===0&&E(k)})},get:function(g){var _=g.trans,w=g.key;return new Promise(function(E,b){E=J(E);var m=_.objectStore(f),x=m.get(w);x.onsuccess=function(k){return E(k.target.result)},x.onerror=He(b)})},query:h(l),openCursor:v,count:function(g){var _=g.query,w=g.trans,E=_.index,b=_.range;return new Promise(function(m,x){var k=w.objectStore(f),S=E.isPrimaryKey?k:k.index(E.name),I=i(b),R=I?S.count(I):S.count();R.onsuccess=J(function(O){return m(O.target.result)}),R.onerror=He(x)})}}}var a=r(e,n),s=a.schema,l=a.hasGetAll,u=s.tables.map(function(d){return o(d)}),c={};return u.forEach(function(d){return c[d.name]=d}),{stack:"dbcore",transaction:e.transaction.bind(e),table:function(d){var f=c[d];if(!f)throw new Error("Table '"+d+"' not found");return c[d]},MIN_KEY:-1/0,MAX_KEY:Mn(t),schema:s}}function rh(e,t){return t.reduce(function(n,r){var i=r.create;return K(K({},n),i(n))},e)}function ih(e,t,n,r){var i=n.IDBKeyRange;n.indexedDB;var o=rh(nh(t,i,r),e.dbcore);return{dbcore:o}}function $o(e,t){var n=e._novip,r=t.db,i=ih(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 Ur(e,t,n,r){var i=e._novip;n.forEach(function(o){var a=r[o];t.forEach(function(s){var l=Do(s,o);(!l||"value"in l&&l.value===void 0)&&(s===i.Transaction.prototype||s instanceof i.Transaction?st(s,o,{get:function(){return this.table(o)},set:function(u){gl(this,o,{value:u,writable:!0,configurable:!0,enumerable:!0})}}):s[o]=new i.Table(o,a))})})}function Yi(e,t){var n=e._novip;t.forEach(function(r){for(var i in r)r[i]instanceof n.Table&&delete r[i]})}function oh(e,t){return e._cfg.version-t._cfg.version}function ah(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=N.transless||N;wt(function(){N.trans=o,N.transless=s,t===0?(ne(i).forEach(function(l){Ko(n,l,i[l].primKey,i[l].indexes)}),$o(e,n),A.follow(function(){return e.on.populate.fire(o)}).catch(a)):sh(e,t,o,n).catch(a)})}function sh(e,t,n,r){var i=e._novip,o=[],a=i._versions,s=i._dbSchema=qo(i,i.idbdb,r),l=!1,u=a.filter(function(d){return d._cfg.version>=t});u.forEach(function(d){o.push(function(){var f=s,p=d._cfg.dbschema;Zi(i,f,r),Zi(i,p,r),s=i._dbSchema=p;var v=Kl(f,p);v.add.forEach(function(b){Ko(r,b[0],b[1].primKey,b[1].indexes)}),v.change.forEach(function(b){if(b.recreate)throw new V.Upgrade("Not yet support for changing primary key");var m=r.objectStore(b.name);b.add.forEach(function(x){return Qi(m,x)}),b.change.forEach(function(x){m.deleteIndex(x.name),Qi(m,x)}),b.del.forEach(function(x){return m.deleteIndex(x)})});var h=d._cfg.contentUpgrade;if(h&&d._cfg.version>t){$o(i,r),n._memoizedTables={},l=!0;var g=bl(p);v.del.forEach(function(b){g[b]=f[b]}),Yi(i,[i.Transaction.prototype]),Ur(i,[i.Transaction.prototype],ne(g),g),n.schema=g;var _=Po(h);_&&hn();var w,E=A.follow(function(){if(w=h(n),w&&_){var b=lt.bind(null,null);w.then(b,b)}});return w&&typeof w.then=="function"?A.resolve(w):E.then(function(){return w})}}),o.push(function(f){if(!l||!Np){var p=d._cfg.dbschema;uh(p,f)}Yi(i,[i.Transaction.prototype]),Ur(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(){lh(s,r)})}function Kl(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&&!Gr)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],d=l[u];c?c.src!==d.src&&a.change.push(d):a.add.push(d)}(a.del.length>0||a.add.length>0||a.change.length>0)&&n.change.push(a)}}}return n}function Ko(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 Qi(i,o)}),i}function lh(e,t){ne(e).forEach(function(n){t.db.objectStoreNames.contains(n)||Ko(t,n,e[n].primKey,e[n].indexes)})}function uh(e,t){[].slice.call(t.db.objectStoreNames).forEach(function(n){return e[n]==null&&t.db.deleteObjectStore(n)})}function Qi(e,t){e.createIndex(t.name,t.keyPath,{unique:t.unique,multiEntry:t.multi})}function qo(e,t,n){var r={},i=Kr(t.objectStoreNames,0);return i.forEach(function(o){for(var a=n.objectStore(o),s=a.keyPath,l=zi(Hl(s),s||"",!1,!1,!!a.autoIncrement,s&&typeof s!="string",!0),u=[],c=0;c<a.indexNames.length;++c){var d=a.index(a.indexNames[c]);s=d.keyPath;var f=zi(d.name,s,!!d.unique,!!d.multiEntry,!1,s&&typeof s!="string",!1);u.push(f)}r[o]=$l(o,l,u)}),r}function ch(e,t,n){var r=e._novip;r.verno=t.version/10;var i=r._dbSchema=qo(r,t,n);r._storeNames=Kr(t.objectStoreNames,0),Ur(r,[r._allTables],ne(i),i)}function dh(e,t){var n=qo(e,e.idbdb,t),r=Kl(n,e._dbSchema);return!(r.add.length||r.change.some(function(i){return i.add.length||i.change.length}))}function Zi(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,d=typeof c=="string"?c:"["+Kr(c).join("+")+"]";if(t[a]){var f=t[a].idxByName[d];f&&(f.name=u,delete t[a].idxByName[d],t[a].idxByName[u]=f)}}}typeof navigator<"u"&&/Safari/.test(navigator.userAgent)&&!/(Chrome\/|Edge\/)/.test(navigator.userAgent)&&Y.WorkerGlobalScope&&Y instanceof Y.WorkerGlobalScope&&[].concat(navigator.userAgent.match(/Safari\/(\d*)/))[1]<604&&(r._hasGetAll=!1)}function fh(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 zi(r,i||null,/\&/.test(t),/\*/.test(t),/\+\+/.test(t),he(i),n===0)})}var ph=function(){function e(){}return e.prototype._parseStoresSpec=function(t,n){ne(t).forEach(function(r){if(t[r]!==null){var i=fh(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]=$l(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,Yi(n,[n._allTables,n,n.Transaction.prototype]),Ur(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=Vo(this._cfg.contentUpgrade||G,t),this},e}();function hh(e){return zn(ph.prototype,function(n){this.db=e,this._cfg={version:n,storesSource:null,dbschema:{},tables:{},contentUpgrade:null}})}function Go(e,t){var n=e._dbNamesDB;return n||(n=e._dbNamesDB=new Qo(zr,{addons:[],indexedDB:e,IDBKeyRange:t}),n.version(1).stores({dbnames:"name"})),n.table("dbnames")}function zo(e){return e&&typeof e.databases=="function"}function vh(e){var t=e.indexedDB,n=e.IDBKeyRange;return zo(t)?Promise.resolve(t.databases()).then(function(r){return r.map(function(i){return i.name}).filter(function(i){return i!==zr})}):Go(t,n).toCollection().primaryKeys()}function mh(e,t){var n=e.indexedDB,r=e.IDBKeyRange;!zo(n)&&t!==zr&&Go(n,r).put({name:t}).catch(G)}function gh(e,t){var n=e.indexedDB,r=e.IDBKeyRange;!zo(n)&&t!==zr&&Go(n,r).delete(t).catch(G)}function Xi(e){return wt(function(){return N.letThrough=!0,e()})}function yh(){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 _h(e){var t=e._state,n=e._deps.indexedDB;if(t.isBeingOpened||e.idbdb)return t.dbReadyPromise.then(function(){return t.dbOpenError?ae(t.dbOpenError):e});We&&(t.openCanceller._stackHolder=Kt()),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():yh()).then(function(){return new A(function(l,u){if(i(),!n)throw new V.MissingAPI;var c=e.name,d=t.autoSchema?n.open(c):n.open(c,Math.round(e.verno*10));if(!d)throw new V.MissingAPI;d.onerror=He(u),d.onblocked=J(e._fireOnBlocked),d.onupgradeneeded=J(function(f){if(a=d.transaction,t.autoSchema&&!e._options.allowEmptyDB){d.onerror=Pn,a.abort(),d.result.close();var p=n.deleteDatabase(c);p.onsuccess=p.onerror=J(function(){u(new V.NoSuchDatabase("Database "+c+" doesnt exist"))})}else{a.onerror=He(u);var v=f.oldVersion>Math.pow(2,62)?0:f.oldVersion;s=v<1,e._novip.idbdb=d.result,ah(e,v/10,a,u)}},u),d.onsuccess=J(function(){a=null;var f=e._novip.idbdb=d.result,p=Kr(f.objectStoreNames);if(p.length>0)try{var v=f.transaction(Jp(p),"readonly");t.autoSchema?ch(e,f,v):(Zi(e,e._dbSchema,v),dh(e,v)||console.warn("Dexie SchemaDiff: Schema was extended without increasing the number passed to db.version(). Some queries may fail.")),$o(e,v)}catch{}In.push(e),f.onversionchange=J(function(h){t.vcFired=!0,e.on("versionchange").fire(h)}),f.onclose=J(function(h){e.on("close").fire(h)}),s&&mh(e._deps,c),l()},u)})})]).then(function(){return i(),t.onReadyBeingFired=[],A.resolve(Xi(function(){return e.on.ready.fire(e.vip)})).then(function l(){if(t.onReadyBeingFired.length>0){var u=t.onReadyBeingFired.reduce(Vo,G);return t.onReadyBeingFired=[],A.resolve(Xi(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(),ae(l)}).finally(function(){t.openComplete=!0,o()})}function Ji(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"?he(u)?Promise.all(u).then(r,i):r(u):u.then(r,i)}}return o(t)()}function wh(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=El(i);return[e,o,n]}function ql(e,t,n,r,i){return A.resolve().then(function(){var o=N.transless||N,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(d){return d.name===Mo.InvalidState&&e.isOpen()&&--e._state.PR1398_maxLoop>0?(console.warn("Dexie: Need to reopen db"),e._close(),e.open().then(function(){return ql(e,t,n,null,i)})):ae(d)}var l=Po(i);l&&hn();var u,c=A.follow(function(){if(u=i.call(a,a),u)if(l){var d=lt.bind(null,null);u.then(d,d)}else typeof u.next=="function"&&typeof u.throw=="function"&&(u=Ji(u))},s);return(u&&typeof u.then=="function"?A.resolve(u).then(function(d){return a.active?d:ae(new V.PrematureCommit("Transaction committed too early. See http://bit.ly/2kdckMn"))}):c.then(function(){return u})).then(function(d){return r&&a._resolve(),a._completion.then(function(){return d})}).catch(function(d){return a._reject(d),ae(d)})})}function or(e,t,n){for(var r=he(e)?e.slice():[e],i=0;i<n;++i)r.push(t);return r}function bh(e){return K(K({},e),{table:function(t){var n=e.table(t),r=n.schema,i={},o=[];function a(h,g,_){var w=kn(h),E=i[w]=i[w]||[],b=h==null?0:typeof h=="string"?1:h.length,m=g>0,x=K(K({},_),{isVirtual:m,keyTail:g,keyLength:b,extractKey:Wi(h),unique:!m&&_.unique});if(E.push(x),x.isPrimaryKey||o.push(x),b>1){var k=b===2?h[0]:h.slice(0,b-1);a(k,g+1,_)}return E.sort(function(S,I){return S.keyTail-I.keyTail}),x}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 d(h){var g=i[kn(h)];return g&&g[0]}function f(h,g){return{type:h.type===1?2:h.type,lower:or(h.lower,h.lowerOpen?e.MAX_KEY:e.MIN_KEY,g),lowerOpen:!0,upper:or(h.upper,h.upperOpen?e.MIN_KEY:e.MAX_KEY,g),upperOpen:!0}}function p(h){var g=h.query.index;return g.isVirtual?K(K({},h),{query:{index:g,range:f(h.query.range,g.keyTail)}}):h}var v=K(K({},n),{schema:K(K({},r),{primaryKey:s,indexes:o,getIndexByKeyPath:d}),count:function(h){return n.count(p(h))},query:function(h){return n.query(p(h))},openCursor:function(h){var g=h.query.index,_=g.keyTail,w=g.isVirtual,E=g.keyLength;if(!w)return n.openCursor(h);function b(m){function x(S){S!=null?m.continue(or(S,h.reverse?e.MAX_KEY:e.MIN_KEY,_)):h.unique?m.continue(m.key.slice(0,E).concat(h.reverse?e.MIN_KEY:e.MAX_KEY,_)):m.continue()}var k=Object.create(m,{continue:{value:x},continuePrimaryKey:{value:function(S,I){m.continuePrimaryKey(or(S,e.MAX_KEY,_),I)}},primaryKey:{get:function(){return m.primaryKey}},key:{get:function(){var S=m.key;return E===1?S[0]:S.slice(0,E)}},value:{get:function(){return m.value}}});return k}return n.openCursor(p(h)).then(function(m){return m&&b(m)})}});return v}})}var Eh={stack:"dbcore",name:"VirtualIndexMiddleware",level:1,create:bh};function Wo(e,t,n,r){return n=n||{},r=r||"",ne(e).forEach(function(i){if(!Se(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=Di(o),l=Di(a);s!==l?n[r+i]=t[i]:s==="Object"?Wo(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){Se(e,i)||(n[r+i]=t[i])}),n}function xh(e,t){return t.type==="delete"?t.keys:t.keys||t.values.map(e.extractKey)}var Sh={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=N.trans,s=a.table(t).hook,l=s.deleting,u=s.creating,c=s.updating;switch(o.type){case"add":if(u.fire===G)break;return a._promise("readwrite",function(){return d(o)},!0);case"put":if(u.fire===G&&c.fire===G)break;return a._promise("readwrite",function(){return d(o)},!0);case"delete":if(l.fire===G)break;return a._promise("readwrite",function(){return d(o)},!0);case"deleteRange":if(l.fire===G)break;return a._promise("readwrite",function(){return f(o)},!0)}return n.mutate(o);function d(v){var h=N.trans,g=v.keys||xh(r,v);if(!g)throw new Error("Keys missing");return v=v.type==="add"||v.type==="put"?K(K({},v),{keys:g}):K({},v),v.type!=="delete"&&(v.values=Ui([],v.values,!0)),v.keys&&(v.keys=Ui([],v.keys,!0)),Ch(n,v,g).then(function(_){var w=g.map(function(E,b){var m=_[b],x={onerror:null,onsuccess:null};if(v.type==="delete")l.fire.call(x,E,m,h);else if(v.type==="add"||m===void 0){var k=u.fire.call(x,E,v.values[b],h);E==null&&k!=null&&(E=k,v.keys[b]=E,r.outbound||Ve(v.values[b],r.keyPath,E))}else{var S=Wo(m,v.values[b]),I=c.fire.call(x,S,E,m,h);if(I){var R=v.values[b];Object.keys(I).forEach(function(O){Se(R,O)?R[O]=I[O]:Ve(R,O,I[O])})}}return x});return n.mutate(v).then(function(E){for(var b=E.failures,m=E.results,x=E.numFailures,k=E.lastResult,S=0;S<g.length;++S){var I=m?m[S]:g[S],R=w[S];I==null?R.onerror&&R.onerror(b[S]):R.onsuccess&&R.onsuccess(v.type==="put"&&_[S]?v.values[S]:I)}return{failures:b,results:m,numFailures:x,lastResult:k}}).catch(function(E){return w.forEach(function(b){return b.onerror&&b.onerror(E)}),Promise.reject(E)})})}function f(v){return p(v.trans,v.range,1e4)}function p(v,h,g){return n.query({trans:v,values:!1,query:{index:r,range:h},limit:g}).then(function(_){var w=_.result;return d({type:"delete",keys:w,trans:v}).then(function(E){return E.numFailures>0?Promise.reject(E.failures[0]):w.length<g?{failures:[],numFailures:0,lastResult:void 0}:p(v,K(K({},h),{lower:w[w.length-1],lowerOpen:!0}),g)})})}}});return i}})}};function Ch(e,t,n){return t.type==="add"?Promise.resolve([]):e.getMany({trans:t.trans,keys:n,cache:"immutable"})}function Gl(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 Ih={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=Gl(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 Yo(e){return!("from"in e)}var Qe=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 Qe;return e&&"d"in e&&me(n,e),n}};on(Qe.prototype,(pi={add:function(e){return Or(this,e),this},addKey:function(e){return Vn(this,e,e),this},addKeys:function(e){var t=this;return e.forEach(function(n){return Vn(t,n,n)}),this}},pi[Pi]=function(){return eo(this)},pi));function Vn(e,t,n){var r=ve(t,n);if(!isNaN(r)){if(r>0)throw RangeError();if(Yo(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?Vn(i,t,n):e.l={from:t,to:n,d:1,l:null,r:null},qa(e);if(ve(t,e.to)>0)return o?Vn(o,t,n):e.r={from:t,to:n,d:1,l:null,r:null},qa(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&&Or(e,i),o&&a&&Or(e,o)}}function Or(e,t){function n(r,i){var o=i.from,a=i.to,s=i.l,l=i.r;Vn(r,o,a),s&&n(r,s),l&&n(r,l)}Yo(t)||n(e,t)}function kh(e,t){var n=eo(t),r=n.next();if(r.done)return!1;for(var i=r.value,o=eo(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 eo(e){var t=Yo(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 qa(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=Ga(a)}e.d=Ga(e)}function Ga(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 Th={stack:"dbcore",level:0,create:function(e){var t=e.schema.name,n=new Qe(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(f){var p=f.trans,v=p.mutatedParts||(p.mutatedParts={}),h=function(k){var S="idb://"+t+"/"+r+"/"+k;return v[S]||(v[S]=new Qe)},g=h(""),_=h(":dels"),w=f.type,E=f.type==="deleteRange"?[f.range]:f.type==="delete"?[f.keys]:f.values.length<50?[[],f.values]:[],b=E[0],m=E[1],x=f.trans._cache;return i.mutate(f).then(function(k){if(he(b)){w!=="delete"&&(b=k.results),g.addKeys(b);var S=Gl(b,x);!S&&w!=="add"&&_.addKeys(b),(S||m)&&Lh(h,o,S,m)}else if(b){var I={from:b.lower,to:b.upper};_.add(I),g.add(I)}else g.add(n),_.add(n),o.indexes.forEach(function(R){return h(R.name).add(n)});return k})}}),c=function(f){var p,v,h=f.query,g=h.index,_=h.range;return[g,new Qe((p=_.lower)!==null&&p!==void 0?p:e.MIN_KEY,(v=_.upper)!==null&&v!==void 0?v:e.MAX_KEY)]},d={get:function(f){return[a,new Qe(f.key)]},getMany:function(f){return[a,new Qe().addKeys(f.keys)]},count:c,query:c,openCursor:c};return ne(d).forEach(function(f){u[f]=function(p){var v=N.subscr;if(v){var h=function(x){var k="idb://"+t+"/"+r+"/"+x;return v[k]||(v[k]=new Qe)},g=h(""),_=h(":dels"),w=d[f](p),E=w[0],b=w[1];if(h(E.name||"").add(b),!E.isPrimaryKey)if(f==="count")_.add(n);else{var m=f==="query"&&l&&p.values&&i.query(K(K({},p),{values:!1}));return i[f].apply(this,arguments).then(function(x){if(f==="query"){if(l&&p.values)return m.then(function(R){var O=R.result;return g.addKeys(O),x});var k=p.values?x.result.map(s):x.result;p.values?g.addKeys(k):_.addKeys(k)}else if(f==="openCursor"){var S=x,I=p.values;return S&&Object.create(S,{key:{get:function(){return _.addKey(S.primaryKey),S.key}},primaryKey:{get:function(){var R=S.primaryKey;return _.addKey(R),R}},value:{get:function(){return I&&g.addKey(S.primaryKey),S.value}}})}return x})}}return i[f].apply(this,arguments)}}),u}})}};function Lh(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&&he(u)?u.forEach(function(c){return a.addKey(c)}):a.addKey(u)};(n||r).forEach(function(u,c){var d=n&&s(n[c]),f=r&&s(r[c]);ve(d,f)!==0&&(d!=null&&l(d),f!=null&&l(f))})}t.indexes.forEach(i)}var Qo=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:G,dbReadyPromise:null,cancelOpen:G,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=Gn(this,"populate","blocked","versionchange","close",{ready:[Vo,G]}),this.on.ready.subscribe=yl(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 d=r;u||s(function f(){d.on.ready.unsubscribe(l),d.on.ready.unsubscribe(f)})}})}}),this.Collection=Kp(this),this.Table=jp(this),this.Transaction=Xp(this),this.Version=hh(this),this.WhereClause=Qp(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=Mn(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),In.filter(function(l){return l.name===r.name&&l!==r&&!l._state.vcFired}).map(function(l){return l.on("versionchange").fire(s)})},this.use(Eh),this.use(Sh),this.use(Th),this.use(Ih),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(oh),r.stores({}),this._state.autoSchema=!1,r)},e.prototype._whenReady=function(t){var n=this;return this.idbdb&&(this._state.openComplete||N.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(G)}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 _h(this)},e.prototype._close=function(){var t=this._state,n=In.indexOf(this);if(n>=0&&In.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=J(function(){gh(t._deps,t.name),i()}),s.onerror=He(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=wh.apply(this,arguments);return this._transaction.apply(this,t)},e.prototype._transaction=function(t,n,r){var i=this,o=N.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 d=c instanceof i.Table?c.name:c;if(typeof d!="string")throw new TypeError("Invalid table argument to Dexie.transaction(). Only Table or String are allowed");return d}),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(d,f){f(c)}):ae(c)}var u=ql.bind(null,this,s,l,o,r);return o?o._promise(s,u,"lock"):N.trans?vn(N.transless,function(){return i._whenReady(u)}):this._whenReady(u)},e.prototype.table=function(t){if(!Se(this._allTables,t))throw new V.InvalidTable("Table "+t+" does not exist");return this._allTables[t]},e}(),Rh=typeof Symbol<"u"&&"observable"in Symbol?Symbol.observable:"@@observable",Ah=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[Rh]=function(){return this},e}();function zl(e,t){return ne(t).forEach(function(n){var r=e[n]||(e[n]=new Qe);Or(r,t[n])}),e}function Uh(e){var t=!1,n=void 0,r=new Ah(function(i){var o=Po(e);function a(g){o&&hn();var _=function(){return wt(e,{subscr:g,trans:null})},w=N.trans?vn(N.transless,_):_();return o&&w.then(lt,lt),w}var s=!1,l={},u={},c={get closed(){return s},unsubscribe:function(){s=!0,Et.storagemutated.unsubscribe(v)}};i.start&&i.start(c);var d=!1,f=!1;function p(){return ne(u).some(function(g){return l[g]&&kh(l[g],u[g])})}var v=function(g){zl(l,g),p()&&h()},h=function(){if(!(d||s)){l={};var g={},_=a(g);f||(Et(Nn,v),f=!0),d=!0,Promise.resolve(_).then(function(w){t=!0,n=w,d=!1,!s&&(p()?h():(l={},u=g,i.next&&i.next(w)))},function(w){d=!1,t=!1,i.error&&i.error(w),c.unsubscribe()})}};return h(),c});return r.hasValue=function(){return t},r.getValue=function(){return n},r}var to;try{to={indexedDB:Y.indexedDB||Y.mozIndexedDB||Y.webkitIndexedDB||Y.msIndexedDB,IDBKeyRange:Y.IDBKeyRange||Y.webkitIDBKeyRange}}catch{to={indexedDB:null,IDBKeyRange:null}}var Tt=Qo;on(Tt,K(K({},qr),{delete:function(e){var t=new Tt(e,{addons:[]});return t.delete()},exists:function(e){return new Tt(e,{addons:[]}).open().then(function(t){return t.close(),!0}).catch("NoSuchDatabaseError",function(){return!1})},getDatabaseNames:function(e){try{return vh(Tt.dependencies).then(e)}catch{return ae(new V.MissingAPI)}},defineClass:function(){function e(t){me(this,t)}return e},ignoreTransaction:function(e){return N.trans?vn(N.transless,e):e()},vip:Xi,async:function(e){return function(){try{var t=Ji(e.apply(this,arguments));return!t||typeof t.then!="function"?A.resolve(t):t}catch(n){return ae(n)}}},spawn:function(e,t,n){try{var r=Ji(e.apply(n,t||[]));return!r||typeof r.then!="function"?A.resolve(r):r}catch(i){return ae(i)}},currentTransaction:{get:function(){return N.trans||null}},waitFor:function(e,t){var n=A.resolve(typeof e=="function"?Tt.ignoreTransaction(e):e).timeout(t||6e4);return N.trans?N.trans.waitFor(n):n},Promise:A,debug:{get:function(){return We},set:function(e){Sl(e,e==="dexie"?function(){return!0}:Vl)}},derive:fn,extend:me,props:on,override:yl,Events:Gn,on:Et,liveQuery:Uh,extendObservabilitySet:zl,getByKeyPath:it,setByKeyPath:Ve,delByKeyPath:cp,shallowClone:bl,deepClone:Hn,getObjectDiff:Wo,cmp:ve,asap:_l,minKey:Gi,addons:[],connections:In,errnames:Mo,dependencies:to,semVer:ja,version:ja.split(".").map(function(e){return parseInt(e)}).reduce(function(e,t,n){return e+t/Math.pow(10,n*2)})}));Tt.maxKey=Mn(Tt.dependencies.IDBKeyRange);typeof dispatchEvent<"u"&&typeof addEventListener<"u"&&(Et(Nn,function(e){if(!tt){var t;Gr?(t=document.createEvent("CustomEvent"),t.initCustomEvent(mt,!0,!0,e)):t=new CustomEvent(mt,{detail:e}),tt=!0,dispatchEvent(t),tt=!1}}),addEventListener(mt,function(e){var t=e.detail;tt||Dr(t)}));function Dr(e){var t=tt;try{tt=!0,Et.storagemutated.fire(e)}finally{tt=t}}var tt=!1;if(typeof BroadcastChannel<"u"){var ar=new BroadcastChannel(mt);typeof ar.unref=="function"&&ar.unref(),Et(Nn,function(e){tt||ar.postMessage(e)}),ar.onmessage=function(e){e.data&&Dr(e.data)}}else if(typeof self<"u"&&typeof navigator<"u"){Et(Nn,function(e){try{tt||(typeof localStorage<"u"&&localStorage.setItem(mt,JSON.stringify({trig:Math.random(),changedParts:e})),typeof self.clients=="object"&&Ui([],self.clients.matchAll({includeUncontrolled:!0}),!0).forEach(function(t){return t.postMessage({type:mt,changedParts:e})}))}catch{}}),typeof addEventListener<"u"&&addEventListener("storage",function(e){if(e.key===mt){var t=JSON.parse(e.newValue);t&&Dr(t.changedParts)}});var za=self.document&&navigator.serviceWorker;za&&za.addEventListener("message",Oh)}function Oh(e){var t=e.data;t&&t.type===mt&&Dr(t.changedParts)}A.rejectionMapper=_p;Sl(We,Vl);var mn=(e=>(e.ReadyForUpload="ReadyForUpload",e.UploadComplete="UploadComplete",e))(mn||{}),Mt=(e=>(e.After="after",e.Before="before",e.BeforeAndAfter="beforeAndAfter",e))(Mt||{});const no="sprig.sessionId",Wl="sprig.disableReplayRecording",Dh=30,Yl=()=>{_t.setItem(Wl,"disabled")},Ft=()=>!!_t.getItem(Wl),Ph=["did not allow mutations","called in an invalid security context"],Nh=e=>{if(!e)return!0;for(const t of Ph)if(e.toLowerCase().includes(t))return!1;return!0},Mh=(e,t,n)=>{Ft()||t instanceof Error&&(Yl(),Nh(t==null?void 0:t.message)&&(window.UserLeap.reportError(e,t,n),Bh()))},Vh=async(e,t)=>{var r;let n;try{if((r=window.navigator.storage)!=null&&r.estimate){const{quota:i,usage:o}=await window.navigator.storage.estimate();n={availableSpaceInMB:i&&o?(i-o)/(1024*1024):void 0,quota:i,usage:o}}}catch(i){window.UserLeap.reportError("Error getting storage estimate",i,{originalMessage:e,originalError:t})}Mh(e,t,n)},jh=()=>{const e=_t.getItem(no);return e?(_t.removeItem(no),e):at()},ge=jh();window.addEventListener("beforeunload",()=>{_t.setItem(no,ge)});const Bh=async()=>{q.transaction("rw",q.events,q.chunkUploads,q.pendingCaptures,()=>{q.events.clear(),q.chunkUploads.clear(),q.pendingCaptures.clear()}).catch(()=>{})},hi=(e,t,n=()=>!0)=>q.table(t).where("timestamp").below(e).and(n).delete(),Fh=(e,t)=>q.events.where("[sessionId+timestamp]").between([ge,e],[ge,t]).toArray(),Hh=(e,t,n)=>{const r=new Date,i=r.setMinutes(r.getMinutes()+(n!=null?n:Dh));return q.events.where("[sessionId+timestamp]").between([ge,e],[ge,t]).modify({expiredAt:i})},$h=e=>{var t;return q.chunkUploads.add({...e,sessionId:(t=e.sessionId)!=null?t:ge})},Kh=(e,t)=>q.chunkUploads.update(e,{data:null,etag:t,status:mn.UploadComplete}),qh=({status:e,uploadId:t})=>t?q.chunkUploads.where({uploadId:t,status:e}).toArray():q.chunkUploads.where({sessionId:ge,status:e}).toArray(),Gh=e=>q.chunkUploads.where({uploadId:e,status:mn.UploadComplete}).toArray(),zh=e=>q.chunkUploads.where({uploadId:e,status:mn.UploadComplete}).delete(),Wh=e=>{var t;return q.pendingCaptures.add({...e,sessionId:(t=e.sessionId)!=null?t:ge,canUpload:!1})},Yh=()=>q.pendingCaptures.where("sessionId").equals(ge).and(e=>e.targetTimestamp<Date.now()).toArray(),Qh=()=>q.pendingCaptures.where("sessionId").equals(ge).toArray(),Zh=e=>q.pendingCaptures.where("sessionId").equals(ge).and(t=>t.captureParams.responseGroupId===e).modify({canUpload:!0}),Xh=async e=>{var t;if((t=window.navigator.storage)!=null&&t.estimate){const{quota:n,usage:r}=await window.navigator.storage.estimate();if(n&&r&&(n-r)/1073741824<e)return!1}return!0};class Jh extends Qo{constructor(){super("replayStorage",{autoOpen:!1});ie(this,"events");ie(this,"chunkUploads");ie(this,"pendingCaptures")}}const q=new Jh;q.version(1).stores({events:"uuid, timestamp, [sessionId+timestamp]",chunkUploads:"uuid, timestamp, [sessionId+status], [uploadId+status], [sessionId+status+uploadId]",pendingCaptures:"uuid, timestamp, [sessionId+targetTimestamp]"});q.open().catch(()=>{Yl()});const ev=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 Wa=1,Ql=5e3,ro=6e4;const tv=5,Ya=1e3,Zl=30,Pr=Zl+tv,Zo="sprig.pendingCount";let Xl,io,Jl,Qa=Date.now(),Xo=!1;var oo=(e=>(e.Left="left_click",e.Right="right_click",e))(oo||{});const nv=async(e,t,n,r=2,i)=>{await Ht(async()=>{if(Ft()||!t||(i!=null&&i.minAvailableGb&&(Wa=i.minAvailableGb),!await Xh(Wa)))return;i!=null&&i.minDuration&&(Ql=i.minDuration),i!=null&&i.batchDuration&&(ro=i.batchDuration),rp(r),cv(),av(t+Pr,30*60,t+Pr),sv(),window.rrwebRecord||await ev(e,"https://cdn.sprig.com/dependencies/record-2.0.0-alpha.6.min.js",n);const o=window.rrwebRecord;if(!o)return;let a=!0;o({checkoutEveryNms:Zl*1e3,sampling:{input:"last",scroll:250,media:800},emit:(s,l)=>{if(Ft())return;Qa=Date.now();const u=a||!!l;a=!1,rv({uuid:at(),event:JSON.stringify(s),isValidStart:u,timestamp:Date.now()})},...i}),Xo=!0,io||(io=setInterval(()=>{Date.now()-Qa>Ya&&ut("Sprig_Noop",{})},Ya))},"Error initializing replay")};let ao=!1,so=[];const rv=e=>{so.push(e),ao||ov()},iv=e=>{const t=e.map(n=>{var r;return{...n,sessionId:(r=n.sessionId)!=null?r:ge}});return q.transaction("rw",q.events,()=>{q.events.bulkAdd(t)}).catch(n=>{Wr("Error storing replay events",n)})},ov=()=>{ao=!0,setTimeout(async()=>{if(Ft())return;iv(so),so=[],ao=!1},500)},av=(e=6*60,t=30*60,n=4*60)=>{Xl=setInterval(()=>{const r=Date.now();Ft()||q.transaction("rw!",q.events,q.chunkUploads,q.pendingCaptures,()=>{hi(r-e*1e3,"events",i=>i.expiredAt===void 0||i.expiredAt<r-e*1e3),hi(r-t*1e3,"chunkUploads"),hi(r-n*1e3,"pendingCaptures",i=>i.canUpload===void 0||i.canUpload===!1)}).catch(i=>{Wr("Error deleting table rows",i)})},30*1e3)},sv=(e=5)=>{Jl=setInterval(async()=>{Ht(async()=>{if(Je&&parseInt(Je)>0){const t=await Yh();t.length&&(await Promise.all(t.map(async n=>(await q.pendingCaptures.delete(n.uuid),nu(n.captureParams,n.canUpload)))),Je=(parseInt(Je)-t.length).toString(),_t.setItem(Zo,Je))}},"Error initiating pending captures")},e*1e3)},lv=async(e,t,n,r,i)=>{const o=Math.min(e+i,n),a=await Fh(e,o);if(!(a!=null&&a.length))return{validStartFound:r,events:[]};if(!r){let s=-1;return a==null||a.forEach((l,u)=>{if(!l.isValidStart)return;const c=l.timestamp<=t;(s<0||c)&&(s=u)}),s<0?{validStartFound:r,events:[]}:{validStartFound:!0,events:a==null?void 0:a.slice(s)}}return{validStartFound:r,events:a}},uv=(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},eu=e=>Promise.all(e.map(async t=>{const n=await op(t);return await Kh(t.uuid,n),t.uploadId})),tu=async e=>{const t=await Gh(e);if(!(t!=null&&t.length))return;const n=t.reduce((o,a)=>(o.find(s=>s.chunkIndex===a.chunkIndex)||o.push(a),o),[]);n.sort((o,a)=>o.chunkIndex-a.chunkIndex);const r=n.map(o=>({ETag:o.etag,PartNumber:o.chunkIndex})).filter(o=>o.ETag!==null),i=n[0];await ml({apiUrl:i.apiUrl,surveyId:i.surveyId,uploadId:e,responseGroupUuid:i.responseGroupId,etags:r,headers:i.completeUploadHeaders,replayDuration:i.replayDuration}),await zh(e)},cv=async()=>{Ht(async()=>{const e=await qh({status:mn.ReadyForUpload});if(!(e!=null&&e.length))return;const t=await eu(e);t!=null&&t.length&&await Promise.all(t.map(n=>{if(n)return tu(n)}))},"Error uploading unfinished chunks")},dv=async(e,t)=>{await eu(t),await tu(e)},fv=e=>{let t=0;e.forEach(i=>{t+=i.length});const n=new Uint8Array(t);let r=0;return e.forEach(i=>{n.set(i,r),r+=i.length}),n},Za=async(e,t,n)=>{const r=new TextEncoder;let i=null,o=null,a=null,s=!1,l=!1,[u,c]=[0,0];const d=e-Pr*1e3,f=[];let p=[];for(let h=d;h<t;h+=ro){if({validStartFound:l,events:p}=await lv(h,e,t,l,ro),!(p!=null&&p.length))continue;u===0&&(u=p[0].timestamp),c=p[p.length-1].timestamp;const g=`${s?",":"["}${p.map(w=>w.event).join(",")}`,_=r.encode(g);n?(o===null&&(a=new window.CompressionStream("gzip"),o=a.writable.getWriter()),o.write(_)):f.push(_),s=!0}if(c-u<Ql)return null;const v=r.encode("]");return o&&a?(o.write(v),o.close(),i=new Uint8Array(await new Response(a.readable).arrayBuffer())):(f.push(v),i=fv(f)),i},pv=async(e,t)=>{const n=window.CompressionStream!==void 0;let r=null;const i=t!=null?t:Date.now(),o=i-e;try{r=await Za(o,i,n)}catch(a){a instanceof Error&&window.UserLeap.reportError("Error compressing replay",a),n&&Ht(async()=>{await Za(o,i,!1)},"fileData fallback failed")}return r},Xa=async e=>{const{surveyId:t,responseGroupId:n,visitorId:r,apiUrl:i,completeUploadHeaders:o,replayParams:a,triggerTimestamp:s}=e,l=await pv(a.replayDurationSeconds*1e3,s);if(!(l!=null&&l.length))return;const u=uv(l,a.minimumChunkSizeMb,a.signedUrls.length),c=await Promise.all(u.map(async(d,f)=>{const p=at(),v={apiUrl:i,chunkIndex:f+1,completeUploadHeaders:o,etag:null,responseGroupId:n,status:mn.ReadyForUpload,surveyId:t,timestamp:s,totalChunks:u.length,data:d,uploadId:a.uploadId,uploadUrl:a.signedUrls[f].url,uuid:p,visitorId:r};return await $h(v),v}));return dv(a.uploadId,c)},nu=async(e,t)=>{if(Ft())return;const{isStandalone:n,replayParams:r,triggerTimestamp:i,responseGroupId:o}=e,a=async()=>{setTimeout(()=>F.removeListener(j.QuestionAnswered,a),0),Ht(async()=>{r.replayDurationType===Mt.Before?await Xa(e):await Zh(o)},"Error in schedule/capture callback")};Ht(async()=>{if(r.replayDurationType===Mt.After||r.replayDurationType===Mt.BeforeAndAfter){n||F.on(j.QuestionAnswered,a),await vv(e);return}if(n||t)await Xa(e);else{const s=Pr+r.replayDurationSeconds;await Hh(i-s*1e3,i,r.expirationTimeLimitMinutes),F.on(j.QuestionAnswered,a)}},"Error in scheduling/capturing replay")},hv=async()=>q.transaction("rw",q.events,q.pendingCaptures,()=>{q.events.where("sessionId").equals(ge).delete(),q.pendingCaptures.where("sessionId").equals(ge).delete()}).catch(e=>{Wr("Error clearing session event data",e)}),Ja=()=>{Ft()||hv()};let Je=_t.getItem(Zo);const vv=async e=>{const{surveyId:t}=e,n=await Qh(),r=n==null?void 0:n.filter(a=>a.captureParams.surveyId===t);if(r!=null&&r.length)return;const i={...e,replayParams:{...e.replayParams}};e.replayParams.replayDurationType===Mt.BeforeAndAfter&&(i.replayParams.replayDurationSeconds*=2),i.replayParams.replayDurationType=Mt.Before;const o=e.triggerTimestamp+e.replayParams.replayDurationSeconds*1e3;return i.triggerTimestamp=o,Je=Je?(parseInt(Je)+1).toString():"1",_t.setItem(Zo,Je),Wh({uuid:at(),targetTimestamp:o,timestamp:Date.now(),captureParams:i})},ut=(e,t)=>{!Xo||Ht(()=>{var n,r;(r=(n=window.rrwebRecord)==null?void 0:n.addCustomEvent)==null||r.call(n,e,t)},"Error recording custom event")},Ht=async(e,t)=>{try{await e()}catch(n){Wr(t,n)}},es=e=>{ut("Sprig_PageView",e)},mv=e=>{ut("Sprig_TrackEvent",e)},gv=e=>{ut("Sprig_ShowSurvey",e)},yv=e=>{ut("Sprig_SubmitSurvey",e)},_v=e=>{ut("Sprig_Click",e)},wv=()=>{ut("Sprig_Refresh",{})},bv=()=>{ut("Sprig_BackForward",{})},Ev=e=>{ut("Sprig_Keystroke",e)},Wr=(e,t)=>([Xl,io,Jl].forEach(n=>{n&&clearInterval(n)}),Xo=!1,Vh(e,t)),vi={capture:!0},xv=["a","button","input","option","li","link"],Sv=["Escape","Enter","Backspace","F5","Tab"],Cv=["label","type","role","title","placeholder","errormessage","valuetext","href"],ts="aria-",Iv=e=>{const t=e.getAttribute("type");return t?`${t} ${e.tagName.toLowerCase()}`:e.tagName.toLowerCase()},ns=e=>{const t=e.textContent,n=t?{text:t}:{};n.element=Iv(e);for(const r of e.attributes){let i=r.name;const o=r.value;i.startsWith(ts)&&(i=i.substring(ts.length)),Cv.includes(i)&&(n[i]=o)}return n},kv=e=>{if(!e)return{};const n={...ns(e)},r=e.parentElement;if(r&&xv.includes(r.tagName.toLowerCase())){const i=ns(r);Object.assign(n,i)}return n},ru=(e,t)=>{_v({x:t.x,y:t.y,type:e,elementAttributes:kv(t.target)})},Tv=e=>t=>ru(e,t),Lv=e=>{Sv.includes(e.key)&&Ev({key:e.key})},Rv=()=>{window.performance.getEntriesByType("navigation").map(t=>t.type).includes("reload")&&wv()},Av=()=>{window.performance.getEntriesByType("navigation").map(t=>t.type).includes("back_forward")&&bv()},Uv=()=>{window.addEventListener("click",Tv(oo.Left),vi),window.addEventListener("mousedown",e=>{e.button===2&&ru(oo.Right,e)},vi),window.addEventListener("keydown",Lv,vi),Rv(),Av()};var L=(e=>(e.ConsentLegal="consentlegal",e.Likert="likert",e.Matrix="matrix",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))(L||{}),Pe=(e=>(e.Answered="answered",e.Contains="contains",e.DoesNotContain="notcontains",e.DoesNotInclude="list_dni",e.Equal="eq",e.GivenUp="given_up",e.GreaterThan="gt",e.GreaterThanOrEqual="gte",e.LessThan="lt",e.LessThanOrEqual="lte",e.ListAll="list_all",e.ListAtLeastOne="list_alo",e.ListExact="list_exact",e.NotEqual="neq",e.Partial="partial",e.Skipped="skipped",e))(Pe||{}),an=(e=>(e.Camera="camera",e.Microphone="microphone",e.Screen="screen",e))(an||{}),Le=(e=>(e.AvPermission="av_permission",e.ScreenPermission="screen_permission",e.StartTask="start_task",e.CompleteTask="complete_task",e))(Le||{}),Ot=(e=>(e.Number="number",e.Smiley="smiley",e.Star="star",e))(Ot||{}),Wn,P,iu,sn,Lt,rs,ou,au,Nr={},su=[],Ov=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i;function nt(e,t){for(var n in t)e[n]=t[n];return e}function lu(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 Tn(e,a,r,i,null)}function Tn(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?++iu:i};return i==null&&P.vnode!=null&&P.vnode(o),o}function uu(){return{current:null}}function Ce(e){return e.children}function Dv(e,t,n,r,i){var o;for(o in n)o==="children"||o==="key"||o in t||Mr(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]||Mr(e,o,t[o],n[o],r)}function is(e,t,n){t[0]==="-"?e.setProperty(t,n==null?"":n):e[t]=n==null?"":typeof n!="number"||Ov.test(t)?n:n+"px"}function Mr(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||is(e.style,t,"");if(n)for(t in n)r&&n[t]===r[t]||is(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?as:os,o):e.removeEventListener(t,o?as:os,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 os(e){sn=!0;try{return this.l[e.type+!1](P.event?P.event(e):e)}finally{sn=!1}}function as(e){sn=!0;try{return this.l[e.type+!0](P.event?P.event(e):e)}finally{sn=!1}}function je(e,t){this.props=e,this.context=t}function jn(e,t){if(t==null)return e.__?jn(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"?jn(e):null}function cu(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 cu(e)}}function Pv(e){sn?setTimeout(e):ou(e)}function lo(e){(!e.__d&&(e.__d=!0)&&Lt.push(e)&&!Vr.__r++||rs!==P.debounceRendering)&&((rs=P.debounceRendering)||Pv)(Vr)}function Vr(){var e,t,n,r,i,o,a,s;for(Lt.sort(function(l,u){return l.__v.__b-u.__v.__b});e=Lt.shift();)e.__d&&(t=Lt.length,r=void 0,i=void 0,a=(o=(n=e).__v).__e,(s=n.__P)&&(r=[],(i=nt({},o)).__v=o.__v+1,Jo(s,o,i,n.__n,s.ownerSVGElement!==void 0,o.__h!=null?[a]:null,r,a==null?jn(o):a,o.__h),vu(r,o),o.__e!=a&&cu(o)),Lt.length>t&&Lt.sort(function(l,u){return l.__v.__b-u.__v.__b}));Vr.__r=0}function du(e,t,n,r,i,o,a,s,l,u){var c,d,f,p,v,h,g,_=r&&r.__k||su,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"?Tn(null,p,null,null,p):Array.isArray(p)?Tn(Ce,{children:p},null,null,null):p.__b>0?Tn(p.type,p.props,p.key,p.ref?p.ref:null,p.__v):p)!=null){if(p.__=n,p.__b=n.__b+1,(f=_[c])===null||f&&p.key==f.key&&p.type===f.type)_[c]=void 0;else for(d=0;d<w;d++){if((f=_[d])&&p.key==f.key&&p.type===f.type){_[d]=void 0;break}f=null}Jo(e,p,f=f||Nr,i,o,a,s,l,u),v=p.__e,(d=p.ref)&&f.ref!=d&&(g||(g=[]),f.ref&&g.push(f.ref,null,p),g.push(d,p.__c||v,p)),v!=null?(h==null&&(h=v),typeof p.type=="function"&&p.__k===f.__k?p.__d=l=fu(p,l,e):l=pu(e,p,f,_,v,l),typeof n.type=="function"&&(n.__d=l)):l&&f.__e==l&&l.parentNode!=e&&(l=jn(f))}for(n.__e=h,c=w;c--;)_[c]!=null&&(typeof n.type=="function"&&_[c].__e!=null&&_[c].__e==n.__d&&(n.__d=hu(r).nextSibling),gu(_[c],_[c]));if(g)for(c=0;c<g.length;c++)mu(g[c],g[++c],g[++c])}function fu(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"?fu(r,t,n):pu(n,r,r,i,r.__e,t));return t}function ot(e,t){return t=t||[],e==null||typeof e=="boolean"||(Array.isArray(e)?e.some(function(n){ot(n,t)}):t.push(e)),t}function pu(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 hu(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=hu(n)))return r}return null}function Jo(e,t,n,r,i,o,a,s,l){var u,c,d,f,p,v,h,g,_,w,E,b,m,x,k,S=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=P.__b)&&u(t);try{e:if(typeof S=="function"){if(g=t.props,_=(u=S.contextType)&&r[u.__c],w=u?_?_.props.value:u.__:r,n.__c?h=(c=t.__c=n.__c).__=c.__E:("prototype"in S&&S.prototype.render?t.__c=c=new S(g,w):(t.__c=c=new je(g,w),c.constructor=S,c.render=Mv),_&&_.sub(c),c.props=g,c.state||(c.state={}),c.context=w,c.__n=r,d=c.__d=!0,c.__h=[],c._sb=[]),c.__s==null&&(c.__s=c.state),S.getDerivedStateFromProps!=null&&(c.__s==c.state&&(c.__s=nt({},c.__s)),nt(c.__s,S.getDerivedStateFromProps(g,c.__s))),f=c.props,p=c.state,c.__v=t,d)S.getDerivedStateFromProps==null&&c.componentWillMount!=null&&c.componentWillMount(),c.componentDidMount!=null&&c.__h.push(c.componentDidMount);else{if(S.getDerivedStateFromProps==null&&g!==f&&c.componentWillReceiveProps!=null&&c.componentWillReceiveProps(g,w),!c.__e&&c.shouldComponentUpdate!=null&&c.shouldComponentUpdate(g,c.__s,w)===!1||t.__v===n.__v){for(t.__v!==n.__v&&(c.props=g,c.state=c.__s,c.__d=!1),t.__e=n.__e,t.__k=n.__k,t.__k.forEach(function(I){I&&(I.__=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(g,c.__s,w),c.componentDidUpdate!=null&&c.__h.push(function(){c.componentDidUpdate(f,p,v)})}if(c.context=w,c.props=g,c.__P=e,b=P.__r,m=0,"prototype"in S&&S.prototype.render){for(c.state=c.__s,c.__d=!1,b&&b(t),u=c.render(c.props,c.state,c.context),x=0;x<c._sb.length;x++)c.__h.push(c._sb[x]);c._sb=[]}else do c.__d=!1,b&&b(t),u=c.render(c.props,c.state,c.context),c.state=c.__s;while(c.__d&&++m<25);c.state=c.__s,c.getChildContext!=null&&(r=nt(nt({},r),c.getChildContext())),d||c.getSnapshotBeforeUpdate==null||(v=c.getSnapshotBeforeUpdate(f,p)),k=u!=null&&u.type===Ce&&u.key==null?u.props.children:u,du(e,Array.isArray(k)?k:[k],t,n,r,i,o,a,s,l),c.base=t.__e,t.__h=null,c.__h.length&&a.push(c),h&&(c.__E=c.__=null),c.__e=!1}else o==null&&t.__v===n.__v?(t.__k=n.__k,t.__e=n.__e):t.__e=Nv(n.__e,t,n,r,i,o,a,l);(u=P.diffed)&&u(t)}catch(I){t.__v=null,(l||o!=null)&&(t.__e=s,t.__h=!!l,o[o.indexOf(s)]=null),P.__e(I,t,n)}}function vu(e,t){P.__c&&P.__c(t,e),e.some(function(n){try{e=n.__h,n.__h=[],e.some(function(r){r.call(n)})}catch(r){P.__e(r,n.__v)}})}function Nv(e,t,n,r,i,o,a,s){var l,u,c,d=n.props,f=t.props,p=t.type,v=0;if(p==="svg"&&(i=!0),o!=null){for(;v<o.length;v++)if((l=o[v])&&"setAttribute"in l==!!p&&(p?l.localName===p:l.nodeType===3)){e=l,o[v]=null;break}}if(e==null){if(p===null)return document.createTextNode(f);e=i?document.createElementNS("http://www.w3.org/2000/svg",p):document.createElement(p,f.is&&f),o=null,s=!1}if(p===null)d===f||s&&e.data===f||(e.data=f);else{if(o=o&&Wn.call(e.childNodes),u=(d=n.props||Nr).dangerouslySetInnerHTML,c=f.dangerouslySetInnerHTML,!s){if(o!=null)for(d={},v=0;v<e.attributes.length;v++)d[e.attributes[v].name]=e.attributes[v].value;(c||u)&&(c&&(u&&c.__html==u.__html||c.__html===e.innerHTML)||(e.innerHTML=c&&c.__html||""))}if(Dv(e,f,d,i,s),c)t.__k=[];else if(v=t.props.children,du(e,Array.isArray(v)?v:[v],t,n,r,i&&p!=="foreignObject",o,a,o?o[0]:n.__k&&jn(n,0),s),o!=null)for(v=o.length;v--;)o[v]!=null&&lu(o[v]);s||("value"in f&&(v=f.value)!==void 0&&(v!==e.value||p==="progress"&&!v||p==="option"&&v!==d.value)&&Mr(e,"value",v,d.value,!1),"checked"in f&&(v=f.checked)!==void 0&&v!==e.checked&&Mr(e,"checked",v,d.checked,!1))}return e}function mu(e,t,n){try{typeof e=="function"?e(t):e.current=t}catch(r){P.__e(r,n)}}function gu(e,t,n){var r,i;if(P.unmount&&P.unmount(e),(r=e.ref)&&(r.current&&r.current!==e.__e||mu(r,null,t)),(r=e.__c)!=null){if(r.componentWillUnmount)try{r.componentWillUnmount()}catch(o){P.__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]&&gu(r[i],t,n||typeof e.type!="function");n||e.__e==null||lu(e.__e),e.__=e.__e=e.__d=void 0}function Mv(e,t,n){return this.constructor(e,n)}function ln(e,t,n){var r,i,o;P.__&&P.__(e,t),i=(r=typeof n=="function")?null:n&&n.__k||t.__k,o=[],Jo(t,e=(!r&&n||t).__k=ee(Ce,null,[e]),i||Nr,Nr,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),vu(o,e)}function yu(e,t){ln(e,t,yu)}function Vv(e,t,n){var r,i,o,a=nt({},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),Tn(e.type,a,r||e.key,i||e.ref,null)}function _u(e,t){var n={__c:t="__cC"+au++,__: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,lo(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=su.slice,P={__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}},iu=0,sn=!1,je.prototype.setState=function(e,t){var n;n=this.__s!=null&&this.__s!==this.state?this.__s:this.__s=nt({},this.state),typeof e=="function"&&(e=e(nt({},n),this.props)),e&&nt(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),lo(this))},je.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),lo(this))},je.prototype.render=Ce,Lt=[],ou=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,Vr.__r=0,au=0;const ss=e=>{let t;const n=new Set,r=(l,u)=>{const c=typeof l=="function"?l(t):l;if(!Object.is(c,t)){const d=t;t=(u!=null?u:typeof c!="object")?c:Object.assign({},t,c),n.forEach(f=>f(t,d))}},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},jv=e=>e?ss(e):ss;var Ct,Q,mi,ls,un=0,wu=[],vr=[],us=P.__b,cs=P.__r,ds=P.diffed,fs=P.__c,ps=P.unmount;function qt(e,t){P.__h&&P.__h(Q,e,un||t),un=0;var n=Q.__H||(Q.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({__V:vr}),n.__[e]}function le(e){return un=1,ea(Cu,e)}function ea(e,t,n){var r=qt(Ct++,2);if(r.t=e,!r.__c&&(r.__=[n?n(t):Cu(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=Q,!Q.u)){Q.u=!0;var i=Q.shouldComponentUpdate;Q.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 d=c.__[0];c.__=c.__N,c.__N=void 0,d!==c.__[0]&&(u=!0)}}),!(!u&&r.__c.props===o)&&(!i||i.call(this,o,a,s))}}return r.__N||r.__}function Ae(e,t){var n=qt(Ct++,3);!P.__s&&na(n.__H,t)&&(n.__=e,n.i=t,Q.__H.__h.push(n))}function Yn(e,t){var n=qt(Ct++,4);!P.__s&&na(n.__H,t)&&(n.__=e,n.i=t,Q.__h.push(n))}function xt(e){return un=5,Yr(function(){return{current:e}},[])}function bu(e,t,n){un=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=qt(Ct++,7);return na(n.__H,t)?(n.__V=e(),n.i=t,n.__h=e,n.__V):n.__}function Eu(e,t){return un=8,Yr(function(){return e},t)}function xu(e){var t=Q.context[e.__c],n=qt(Ct++,9);return n.c=e,t?(n.__==null&&(n.__=!0,t.sub(Q)),t.props.value):e.__}function ta(e,t){P.useDebugValue&&P.useDebugValue(t?t(e):e)}function Bv(e){var t=qt(Ct++,10),n=le();return t.__=e,Q.componentDidCatch||(Q.componentDidCatch=function(r,i){t.__&&t.__(r,i),n[1](r)}),[n[0],function(){n[1](void 0)}]}function Su(){var e=qt(Ct++,11);if(!e.__){for(var t=Q.__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 Fv(){for(var e;e=wu.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach(mr),e.__H.__h.forEach(uo),e.__H.__h=[]}catch(t){e.__H.__h=[],P.__e(t,e.__v)}}P.__b=function(e){Q=null,us&&us(e)},P.__r=function(e){cs&&cs(e),Ct=0;var t=(Q=e.__c).__H;t&&(mi===Q?(t.__h=[],Q.__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(uo),t.__h=[])),mi=Q},P.diffed=function(e){ds&&ds(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(wu.push(t)!==1&&ls===P.requestAnimationFrame||((ls=P.requestAnimationFrame)||Hv)(Fv)),t.__H.__.forEach(function(n){n.i&&(n.__H=n.i),n.__V!==vr&&(n.__=n.__V),n.i=void 0,n.__V=vr})),mi=Q=null},P.__c=function(e,t){t.some(function(n){try{n.__h.forEach(mr),n.__h=n.__h.filter(function(r){return!r.__||uo(r)})}catch(r){t.some(function(i){i.__h&&(i.__h=[])}),t=[],P.__e(r,n.__v)}}),fs&&fs(e,t)},P.unmount=function(e){ps&&ps(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&&P.__e(t,n.__v))};var hs=typeof requestAnimationFrame=="function";function Hv(e){var t,n=function(){clearTimeout(r),hs&&cancelAnimationFrame(t),setTimeout(e)},r=setTimeout(n,100);hs&&(t=requestAnimationFrame(n))}function mr(e){var t=Q,n=e.__c;typeof n=="function"&&(e.__c=void 0,n()),Q=t}function uo(e){var t=Q;e.__c=e.__(),Q=t}function na(e,t){return!e||e.length!==t.length||t.some(function(n,r){return n!==e[r]})}function Cu(e,t){return typeof t=="function"?t(e):t}function Iu(e,t){for(var n in t)e[n]=t[n];return e}function co(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 gi(e,t){return e===t&&(e!==0||1/e==1/t)||e!=e&&t!=t}function jr(e){this.props=e}function ku(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:co(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 je).isPureReactComponent=!0,jr.prototype.shouldComponentUpdate=function(e,t){return co(this.props,e)||co(this.state,t)};var vs=P.__b;P.__b=function(e){e.type&&e.type.__f&&e.ref&&(e.props.ref=e.ref,e.ref=null),vs&&vs(e)};var $v=typeof Symbol<"u"&&Symbol.for&&Symbol.for("react.forward_ref")||3911;function Tu(e){function t(n){var r=Iu({},n);return delete r.ref,e(r,n.ref||null)}return t.$$typeof=$v,t.render=t,t.prototype.isReactComponent=t.__f=!0,t.displayName="ForwardRef("+(e.displayName||e.name)+")",t}var ms=function(e,t){return e==null?null:ot(ot(e).map(t))},Lu={map:ms,forEach:ms,count:function(e){return e?ot(e).length:0},only:function(e){var t=ot(e);if(t.length!==1)throw"Children.only";return t[0]},toArray:ot},Kv=P.__e;P.__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)}Kv(e,t,n,r)};var gs=P.unmount;function Ru(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=Iu({},e)).__c!=null&&(e.__c.__P===n&&(e.__c.__P=t),e.__c=null),e.__k=e.__k&&e.__k.map(function(r){return Ru(r,t,n)})),e}function Au(e,t,n){return e&&(e.__v=null,e.__k=e.__k&&e.__k.map(function(r){return Au(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 Ln(){this.__u=0,this.t=null,this.__b=null}function Uu(e){var t=e.__.__c;return t&&t.__a&&t.__a(e)}function Ou(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 Zt(){this.u=null,this.o=null}P.unmount=function(e){var t=e.__c;t&&t.__R&&t.__R(),t&&e.__h===!0&&(e.type=null),gs&&gs(e)},(Ln.prototype=new je).__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]=Au(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)},Ln.prototype.componentWillUnmount=function(){this.t=[]},Ln.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]=Ru(this.__b,n,r.__O=r.__P)}this.__b=null}var i=t.__a&&ee(Ce,null,e.fallback);return i&&(i.__h=null),[ee(Ce,null,t.__a?null:e.children),i]};var ys=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 qv(e){return this.getChildContext=function(){return e.context},e.children}function Gv(e){var t=this,n=e.i;t.componentWillUnmount=function(){ln(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)}}),ln(ee(qv,{context:t.context},e.__v),t.l)):t.l&&t.componentWillUnmount()}function Du(e,t){var n=ee(Gv,{__v:e,i:t});return n.containerInfo=t,n}(Zt.prototype=new je).__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),ys(t,e,r)):i()};n?n(o):o()}},Zt.prototype.render=function(e){this.u=null,this.o=new Map;var t=ot(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},Zt.prototype.componentDidUpdate=Zt.prototype.componentDidMount=function(){var e=this;this.o.forEach(function(t,n){ys(e,n,t)})};var Pu=typeof Symbol<"u"&&Symbol.for&&Symbol.for("react.element")||60103,zv=/^(?: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]/,Wv=typeof document<"u",Yv=function(e){return(typeof Symbol<"u"&&typeof Symbol()=="symbol"?/fil|che|rad/i:/fil|che|ra/i).test(e)};function Nu(e,t,n){return t.__k==null&&(t.textContent=""),ln(e,t),typeof n=="function"&&n(),e?e.__c:null}function Mu(e,t,n){return yu(e,t),typeof n=="function"&&n(),e?e.__c:null}je.prototype.isReactComponent={},["componentWillMount","componentWillReceiveProps","componentWillUpdate"].forEach(function(e){Object.defineProperty(je.prototype,e,{configurable:!0,get:function(){return this["UNSAFE_"+e]},set:function(t){Object.defineProperty(this,e,{configurable:!0,writable:!0,value:t})}})});var _s=P.event;function Qv(){}function Zv(){return this.cancelBubble}function Xv(){return this.defaultPrevented}P.event=function(e){return _s&&(e=_s(e)),e.persist=Qv,e.isPropagationStopped=Zv,e.isDefaultPrevented=Xv,e.nativeEvent=e};var Vu,ws={configurable:!0,get:function(){return this.class}},bs=P.vnode;P.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];Wv&&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)&&!Yv(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&&zv.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=ot(n.children).forEach(function(s){s.props.selected=r.value.indexOf(s.props.value)!=-1})),t=="select"&&r.defaultValue!=null&&(r.value=ot(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&&(ws.enumerable="className"in n,n.className!=null&&(r.class=n.className),Object.defineProperty(r,"className",ws))}e.$$typeof=Pu,bs&&bs(e)};var Es=P.__r;P.__r=function(e){Es&&Es(e),Vu=e.__c};var ju={ReactCurrentDispatcher:{current:{readContext:function(e){return Vu.__n[e.__c].props.value}}}},Jv="17.0.2";function Bu(e){return ee.bind(null,e)}function ra(e){return!!e&&e.$$typeof===Pu}function Fu(e){return ra(e)?Vv.apply(null,arguments):e}function Hu(e){return!!e.__k&&(ln(null,e),!0)}function $u(e){return e&&(e.base||e.nodeType===1&&e)||null}var Ku=function(e,t){return e(t)},qu=function(e,t){return e(t)},Gu=Ce;function ia(e){e()}function zu(e){return e}function Wu(){return[!1,ia]}var Yu=Yn;function Qu(e,t){var n=t(),r=le({h:{__:n,v:t}}),i=r[0].h,o=r[1];return Yn(function(){i.__=n,i.v=t,gi(i.__,t())||o({h:i})},[e,n,t]),Ae(function(){return gi(i.__,i.v())||o({h:i}),e(function(){gi(i.__,i.v())||o({h:i})})},[e]),n}var em={useState:le,useId:Su,useReducer:ea,useEffect:Ae,useLayoutEffect:Yn,useInsertionEffect:Yu,useTransition:Wu,useDeferredValue:zu,useSyncExternalStore:Qu,startTransition:ia,useRef:xt,useImperativeHandle:bu,useMemo:Yr,useCallback:Eu,useContext:xu,useDebugValue:ta,version:"17.0.2",Children:Lu,render:Nu,hydrate:Mu,unmountComponentAtNode:Hu,createPortal:Du,createElement:ee,createContext:_u,createFactory:Bu,cloneElement:Fu,createRef:uu,Fragment:Ce,isValidElement:ra,findDOMNode:$u,Component:je,PureComponent:jr,memo:ku,forwardRef:Tu,flushSync:qu,unstable_batchedUpdates:Ku,StrictMode:Gu,Suspense:Ln,SuspenseList:Zt,lazy:Ou,__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED:ju};const tm=Object.freeze(Object.defineProperty({__proto__:null,Children:Lu,PureComponent:jr,StrictMode:Gu,Suspense:Ln,SuspenseList:Zt,__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED:ju,cloneElement:Fu,createFactory:Bu,createPortal:Du,default:em,findDOMNode:$u,flushSync:qu,forwardRef:Tu,hydrate:Mu,isValidElement:ra,lazy:Ou,memo:ku,render:Nu,startTransition:ia,unmountComponentAtNode:Hu,unstable_batchedUpdates:Ku,useDeferredValue:zu,useInsertionEffect:Yu,useSyncExternalStore:Qu,useTransition:Wu,version:Jv,Component:je,Fragment:Ce,createContext:_u,createElement:ee,createRef:uu,useCallback:Eu,useContext:xu,useDebugValue:ta,useEffect:Ae,useErrorBoundary:Bv,useId:Su,useImperativeHandle:bu,useLayoutEffect:Yn,useMemo:Yr,useReducer:ea,useRef:xt,useState:le},Symbol.toStringTag,{value:"Module"}));var Zu={exports:{}},Xu={};const Ju=Bc(tm);var ec={exports:{}},tc={};/**
20
20
  * @license React
21
21
  * use-sync-external-store-shim.production.min.js
22
22
  *
@@ -24,7 +24,7 @@ From previous: `);return this._state!==null&&(this._stack=t),t}finally{Ni=!1}}},
24
24
  *
25
25
  * This source code is licensed under the MIT license found in the
26
26
  * LICENSE file in the root directory of this source tree.
27
- */var sn=Fu;function Rv(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var Av=typeof Object.is=="function"?Object.is:Rv,Uv=sn.useState,Ov=sn.useEffect,Dv=sn.useLayoutEffect,Pv=sn.useDebugValue;function Nv(e,t){var n=t(),r=Uv({inst:{value:n,getSnapshot:t}}),i=r[0].inst,o=r[1];return Dv(function(){i.value=n,i.getSnapshot=t,vi(i)&&o({inst:i})},[e,n,t]),Ov(function(){return vi(i)&&o({inst:i}),e(function(){vi(i)&&o({inst:i})})},[e]),Pv(n),n}function vi(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!Av(e,n)}catch{return!0}}function Vv(e,t){return t()}var Mv=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?Vv:Nv;Ku.useSyncExternalStore=sn.useSyncExternalStore!==void 0?sn.useSyncExternalStore:Mv;(function(e){e.exports=Ku})(Hu);/**
27
+ */var cn=Ju;function nm(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var rm=typeof Object.is=="function"?Object.is:nm,im=cn.useState,om=cn.useEffect,am=cn.useLayoutEffect,sm=cn.useDebugValue;function lm(e,t){var n=t(),r=im({inst:{value:n,getSnapshot:t}}),i=r[0].inst,o=r[1];return am(function(){i.value=n,i.getSnapshot=t,yi(i)&&o({inst:i})},[e,n,t]),om(function(){return yi(i)&&o({inst:i}),e(function(){yi(i)&&o({inst:i})})},[e]),sm(n),n}function yi(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!rm(e,n)}catch{return!0}}function um(e,t){return t()}var cm=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?um:lm;tc.useSyncExternalStore=cn.useSyncExternalStore!==void 0?cn.useSyncExternalStore:cm;(function(e){e.exports=tc})(ec);/**
28
28
  * @license React
29
29
  * use-sync-external-store-shim/with-selector.production.min.js
30
30
  *
@@ -32,18 +32,18 @@ From previous: `);return this._state!==null&&(this._stack=t),t}finally{Ni=!1}}},
32
32
  *
33
33
  * This source code is licensed under the MIT license found in the
34
34
  * LICENSE file in the root directory of this source tree.
35
- */var Wr=Fu,jv=Hu.exports;function Bv(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var Fv=typeof Object.is=="function"?Object.is:Bv,Hv=jv.useSyncExternalStore,Kv=Wr.useRef,$v=Wr.useEffect,qv=Wr.useMemo,Gv=Wr.useDebugValue;Bu.useSyncExternalStoreWithSelector=function(e,t,n,r,i){var o=Kv(null);if(o.current===null){var a={hasValue:!1,value:null};o.current=a}else a=o.current;o=qv(function(){function l(p){if(!u){if(u=!0,c=p,p=r(p),i!==void 0&&a.hasValue){var h=a.value;if(i(h,p))return d=h}return d=p}if(h=d,Fv(c,p))return h;var v=r(p);return i!==void 0&&i(h,v)?h:(c=p,d=v)}var u=!1,c,d,f=n===void 0?null:n;return[function(){return l(t())},f===null?void 0:function(){return l(f())}]},[t,n,r,i]);var s=Hv(e,o[0],o[1]);return $v(function(){a.hasValue=!0,a.value=s},[s]),Gv(s),s};(function(e){e.exports=Bu})(ju);const zv=kc(ju.exports),{useSyncExternalStoreWithSelector:Wv}=zv;function Yv(e,t=e.getState,n){const r=Wv(e.subscribe,e.getState,e.getServerState||e.getState,t,n);return Qo(r),r}const vs=e=>{const t=typeof e=="function"?pv(e):e,n=(r,i)=>Yv(t,r,i);return Object.assign(n,t),n},$u=e=>e?vs(e):vs;var ao=(e=>(e[e.And=1]="And",e[e.Or=2]="Or",e))(ao||{});const ms=1,ea={eq(e,t){return e==t},neq(e,t){return!this.eq(e,t)},gt(e,t){return e>t},gte(e,t){return e>=t},lt(e,t){return e<t},lte(e,t){return e<=t},list_exact(e,t){return!Array.isArray(e)||!Array.isArray(t)?!1:e.slice().sort().join(",")===t.slice().sort().join(",")},list_all(e,t){return!Array.isArray(e)||!Array.isArray(t)?!1:!t.some(n=>e.indexOf(n)===-1)},list_alo(e,t){if(!Array.isArray(t))return!1;const n=Array.isArray(e)?e:[e],r=new Set(n);return t.some(i=>r.has(i))},list_dni(e,t){if(!Array.isArray(t))return!1;const n=Array.isArray(e)?e:[e],r=new Set(n);return t.every(i=>!r.has(i))},contains(e,t){const n=e.toLowerCase(),r=t.toLowerCase();return n.includes(r)},notcontains(e,t){return!this.contains(e,t)}},Qv=(e,t,n)=>{switch(t){case T.VideoVoice:return Boolean(e&&e.value);case T.Open:return!!n;case T.MultipleSelect:return Boolean(n&&!!Object.keys(n).length);case T.RecordedTask:return(n==null?void 0:n.taskStatus)===Te.Completed;case T.TextUrlPrompt:return!e.value;case T.ConsentLegal:return n!==null;case T.MultipleChoice:return n!==void 0;case T.NPS:return n!==null;case T.Likert:return n!==null;default:return!0}},qu=({cards:e,index:t,hasEndCard:n,allResponses:r,uploadProgress:i={}})=>{if(t>=e.length||t<0)return null;const o=e[t];let a=t+1;const s=o.props.routingOptions||[];for(let c=0;c<s.length;c++){const{group:d,target:f}=s[c];if(!(d!=null&&d.length))continue;const p=d[0];if(p.questionIndex===void 0||p.questionIndex>r.length)continue;let h=gs({comparator:p.comparator,response:r[p.questionIndex],type:o.type,value:p.value});for(let v=1;v<d.length;v+=2){const g=d[v],w=d[v+1],_=gs({comparator:w.comparator,response:r[w.questionIndex],type:e[w.questionIndex].type,value:w.value});g===ao.And?h&&(h=_):g===ao.Or&&(h||(h=_))}if(h){a=f===-1&&n?e.length-1:f;break}}const l=e.findIndex(c=>c.type===T.Uploading);let u;return l>0?u=n?e.length-3:e.length-2:u=e.length-1,t>=u||a===-1||a!==null&&a>u?l>0&&Object.values(i).some(d=>d.isSubmitted&&!d.isComplete)?l:n?e.length-1:null:a===-1?null:a},gs=({comparator:e,response:t,type:n,value:r})=>{if(e===Je.Answered)switch(n){case T.TextUrlPrompt:return t===void 0;case T.ConsentLegal:return t&&t.submitted===!0;case T.RecordedTask:return"taskStatus"in t&&t.taskStatus===Te.Completed;case T.Likert:return Number.isInteger(t);case T.Open:return t&&t.length>0;case T.MultipleChoice:case T.MultipleSelect:return Object.keys(t).length>0;case T.NPS:return Number.isInteger(t);case T.VideoVoice:return!!(t!=null&&t.mediaRecordingUid);default:return!1}if(e===Je.Skipped)switch(n){case T.TextUrlPrompt:return t==null?void 0:t.skipped;case T.ConsentLegal:return t===null;case T.RecordedTask:return"taskStatus"in t&&t.taskStatus===Te.Abandoned;case T.Likert:return t===null;case T.Open:return(t==null?void 0:t.length)===0;case T.MultipleChoice:return t===void 0;case T.MultipleSelect:return(t==null?void 0:t.length)===0;case T.NPS:return t===null;case T.VideoVoice:return t===null;default:return!1}return e===Je.GivenUp?n===T.RecordedTask?"taskStatus"in t&&t.taskStatus===Te.GivenUp:!0:ea[e](t,r)},Zv=13,Xv=(e,t)=>e.reduce((n,r)=>n.concat(n.map(i=>[...i,r])),[[]]).filter(n=>t||n.length>0),Jv=e=>{var t,n;switch(e.type){case T.MultipleSelect:return!e||!e.props||!e.props.options?null:e.props.options.length>Zv?e.props.options.map(r=>[r.value]):Xv(e.props.options.map(r=>r.value),!e.props.properties.required);case T.MultipleChoice:{if(!e||!e.props||!e.props.options)return null;const r=e.props.options.map(i=>i.value);return e.props.properties.required||r.push(void 0),r}case T.Likert:{const r=Number((n=(t=e.props)==null?void 0:t.properties)==null?void 0:n.range)||5;return[...Array.from(Array(r).keys()).map(o=>o+1),...e.props.properties.required?[]:[null]]}case T.NPS:return[0,1,2,3,4,5,6,7,8,9,10,...e.props.properties.required?[]:[null]];case T.VideoVoice:case T.Open:return["1",...e.props.properties.required?[]:[""]];case T.RecordedTask:return[{taskStatus:Te.Completed},{taskStatus:Te.GivenUp},...e.props.properties.required?[]:[{taskStatus:Te.Abandoned}]];case T.TextUrlPrompt:return[void 0,...e.props.properties.required?[]:[{skipped:!0}]];case T.ConsentLegal:return[ms,...e.props.properties.required?[]:[null]];default:return[ms]}},em=e=>e in ea,tm=e=>typeof e=="object"&&e!==null&&"taskStatus"in e,nm=(e,t=[])=>t.reduce((n,r)=>{const{group:i,target:o}=r;if(!(i!=null&&i.length))return[...n];const a=i.filter(s=>Number(s)?!0:typeof s=="object"?s.questionIndex===e:!1).map(s=>{const{comparator:l,value:u}=s;return{comparator:l,target:o,value:u}});return[...n,...a]},[]),rm=(e,t)=>{const n=new Set([T.Thanks,T.Uploading]);if(t>=e.length||t<0||n.has(e[t].type))return 0;const r=e.filter(o=>!n.has(o.type));if(t===r.length-1)return 1;const i={[r.length-1]:1,[-1]:0};for(let o=r.length-2;o>=t;o--){const a=r[o],s=nm(o,a.props.routingOptions);if(s.length===0){i[o]=i[o+1]+1;continue}let l=0,u=Jv(a);if(u===null)return r.length-1-t;for(let c=0;c<s.length&&u.length!==0;c++){const{comparator:d,target:f,value:p}=s[c],h=u.filter(v=>{const g=Qv({value:v},a.type,v);return!(g&&d===Je.Answered||!g&&d===Je.Skipped||d===Je.GivenUp&&tm(v)&&v.taskStatus===Te.GivenUp||g&&a.type===T.Open&&(d===Je.Contains||d===Je.DoesNotContain)||g&&em(d)&&ea[d](v,p))});if(h.length<u.length){const v=parseInt(String(f),10);if(v!==-1&&v<=o||v>=r.length)return r.length-1-t;l=Math.max(i[v]+1,l)}u=h}u.length>0&&(l=Math.max(i[o+1]+1,l)),i[o]=l}return i[t]},im=e=>!(e.type===T.Thanks||e.type===T.Uploading),ee=$u()((e,t)=>({allResponses:[],answers:void 0,apiURL:"",border:"#000000",cards:[],close:async(n=zt)=>{const r=t(),{fadeout:i,remove:o,trackHistory:a}=r;await i(n),mi(r)||a({event:"closed"}),Ii.enable(),o({initiator:Ke.Closed})},configureExitOnOverlayClick:()=>{},customMetadata:{},destroy:async n=>{const{eventEmitFn:r,fadeout:i,remove:o}=t();r(Re.SurveyComplete),await i(n),Ii.enable(),o({initiator:Ke.Complete})},endCard:{headline:""},envId:"",eventEmitFn:$.emit.bind($),fadeout:async n=>{const{eventEmitFn:r,headers:i,viewDocument:o}=t();return Wt(i)?Promise.resolve():(r(B.SurveyFadingOut),new Promise(a=>{const s=o.getElementById(n);s?(s.addEventListener("transitionend",()=>{a()}),s.classList.remove("ul-app--visible")):a()}))},forceBrandedLogo:!1,frame:document.createElement("iframe"),handleClickEmbedButton:n=>{const{cards:r,eventEmitFn:i,index:o}=t();i(n,{[Lt.QuestionId]:r[o].name,[Lt.Props]:r[o].props}),e(()=>({hasViewedEmbed:!0}))},handleUploadUpdate:({mediaRecordingUid:n,isComplete:r,progressPct:i,isSubmitted:o})=>{var f,p,h;const{cards:a,destroy:s,index:l,uploadProgress:u}=t(),c={...u,[n]:{progressPct:i||i===0?i:(f=u[n])==null?void 0:f.progressPct,isComplete:r||((p=u[n])==null?void 0:p.isComplete),isSubmitted:o||((h=u[n])==null?void 0:h.isSubmitted)}};if(a[l].type!==T.Uploading){e({uploadProgress:c});return}const d=Object.entries(u).every(([v,g])=>!g.isSubmitted||g.isComplete||n==v&&r);if(d&&l>=a.length-1){s(zt);return}e({index:d?l+1:l,uploadingCardViewed:!0,uploadProgress:c})},hasViewedEmbed:!1,headers:{Authorization:"","Content-Type":"","userleap-platform":Pt.Web,"x-ul-environment-id":"","x-ul-installation-method":rt.Snippet,"x-ul-sdk-version":"","x-ul-visitor-id":""},index:0,isPreview:!1,marketingUrl:"https://sprig.com",meta:{ch:0,cw:0,l:"",mode:null,p:"",sh:0,sw:0},mode:void 0,next:n=>{const{allResponses:r,cards:i,eventEmitFn:o,index:a,responseGroupUid:s,submit:l,trackHistory:u,uploadProgress:c,viewedCardCount:d}=t(),f=Date.now(),p=[...i],h=p[a],{type:v}=n.data,g={...n.data},w=g.value;im(h)&&(h.value=w),g.answeredAt=f,delete g.type;const _={response:g,responseGroupUid:s,questionIndex:a};let b=v===T.MultipleChoice?Object.values(w).find(C=>C!==!1):w;v===T.MultipleSelect&&(b=p[a].props.options.reduce((C,S)=>(w[S.id]&&C.push(S.value),C),[]));const E=r.slice(0);E[a]=b,e({allResponses:E});const m=qu({cards:p,index:a,hasEndCard:!!n.endCard,uploadProgress:c,allResponses:E});if(m===null){_.completedAt=f,l(_),n.completeSurvey();return}else[T.Thanks,T.Uploading].includes(p[m].type)&&(_.completedAt=f);const x=l(_);[T.Thanks,T.Uploading].includes(p[m].type)||x.finally(()=>{u({event:"seen",index:m})});const I=p[m];p[m]&&o&&o(Re.CurrentQuestion,{[Lt.QuestionId]:I.name,[Lt.Props]:I.props}),e({cards:p,hasViewedEmbed:!1,index:m,viewedCardCount:d+1})},previewKey:null,recorder:()=>{},recorderEventEmitter:$,responseGroupUid:"",remove:({initiator:n})=>{const{frame:r,headers:i,eventEmitFn:o}=t();["ios","android"].includes(i["userleap-platform"])&&o(B.SurveyWillClose,{name:B.SurveyWillClose,initiator:n}),!Wt(i)&&(o(B.SurveyWillClose,{name:B.SurveyWillClose,initiator:n}),r.remove())},seen:async()=>{const{trackHistory:n}=t();return n({event:"seen",isNew:!0})},slugName:null,showStripes:!1,showSurveyBrand:!1,styleNonce:"",submit:async({completedAt:n,questionIndex:r,response:i,responseGroupUid:o})=>{const a=t();if(!o||mi(a))return;const s={responseGroupUid:o,meta:a.meta,customMetadata:a.customMetadata,responses:[i],completedAt:n,previewKey:a.previewKey};n&&av({id:a.surveyId});const l=await it(`${a.apiURL}/sdk/1/environments/${a.envId}/visitors/${a.userId}/responses/submit`,{body:JSON.stringify(s),headers:a.headers,method:"POST"});if(!l.ok){l.reportError&&(console.warn("[Sprig] (ERR-427) Failed to submit response",l.error),await ys(a,"submitResponse",l.error));return}a.eventEmitFn(B.QuestionAnswered,{...i,questionIndex:r})},surveyId:0,tabTitle:"",trackHistory:async({event:n,index:r,isNew:i=!1})=>{const o=t();if(mi(o))return;const{cards:a,index:s}=o,l=r!==void 0?a[r]:a[s],u={sid:o.surveyId,qid:l.name,action:n,vid:o.userId,eid:o.envId,isNew:i,responseGroupUid:o.responseGroupUid,previewKey:o.previewKey},c=await it(`${o.apiURL}/sdk/1/visitors/${o.userId}/surveys/${o.surveyId}/history`,{body:JSON.stringify(u),headers:o.headers,method:"POST"});!c.ok&&c.reportError&&(console.warn("[Sprig] (ERR-428) Failed to track survey event",c.error),await ys(o,"trackHistory",c.error))},update:()=>{const{headers:n,eventEmitFn:r,frame:i,viewDocument:o}=t();setTimeout(()=>{var s;const a=Js(o);Wt(n)?r(B.SurveyHeight,{name:B.SurveyHeight,contentFrameHeight:a}):(s=i.setHeight)==null||s.call(i,a)},100)},uploadingCardViewed:!1,uploadProgress:{},useDesktopPrototype:void 0,useMobileStyling:!1,userId:"",viewDocument:window.document,viewedCardCount:0})),mi=e=>!e.userId||e.meta&&e.meta.mode==="test"||e.isPreview,ys=async(e,t,n)=>{const{mode:r,userId:i,envId:o,apiURL:a,headers:s,viewDocument:l}=e,u=l.documentElement,c={mode:r,screenWidth:window.screen.width,screenHeight:window.screen.height,clientWidth:u.clientWidth,clientHeight:u.clientHeight,location:window.location.href,language:window.navigator.language},d={action:t,err:{message:n==null?void 0:n.message,stack:n==null?void 0:n.stack},meta:c,vid:i,envId:o};(await it(`${a}/sdk/1/errors`,{method:"POST",headers:Object.assign({"x-ul-error":window.btoa(`userleap-${Date.now()}-error`)},s),body:JSON.stringify(d)})).ok||console.warn("[Sprig] (ERR-444) Failed to report error to API",n)},om=async(e,t)=>{var r;const n=await fetch(t,{method:"POST",cache:"no-cache",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(n.ok){const i=await n.json();return(r=i==null?void 0:i.upload)==null?void 0:r.url}else return null},Gu=()=>MediaRecorder.isTypeSupported("video/webm")?"video/webm":"video/mp4",_s=e=>{const t={audioBitsPerSecond:128e3,videoBitsPerSecond:25e5,mimeType:Gu()};return new MediaRecorder(e,t)},ws=(e,t,n)=>{n[t]=[],e.ondataavailable=function(r){n[t].push(r.data)},e.currentMediaRecordingUid=t,e.start()};function bs(e,t,n,r,i,o){if(e&&e.state!=="inactive"){const{[K.BeginCallback]:a}=r,s=e.currentMediaRecordingUid;if(!s)return;a&&a(s),e.onstop=()=>am(t,e,n,r,s,i,o),e.stop()}}async function am(e,t,n,r,i,o,a){const s=ee.getState().viewDocument,{[K.UploadCallback]:l,[K.ProgressCallback]:u}=r,c={mediaType:n,updatedAt:new Date().toISOString(),mediaRecordingUid:i,...r[K.PassthroughData]},d=await om(c,e);if(!d){l&&l(null,{message:"failed to get upload url"});return}const f=new Blob(a,{type:Gu()});if(!s.defaultView)return;const p=new s.defaultView.File([f],`recording video ${Date.now()}`),h=o.createUpload({endpoint:d,file:p,chunkSize:5120});h.on("error",v=>{l&&l(null,v)}),h.on("progress",v=>{u&&u(i,v)}),h.on("success",()=>{l&&l(i,!0)})}const sm={chunks:{}},lm={state:{...sm},stopRecording(e){const{uploadApiEndpoint:t,avRecorder:n,screenRecorder:r,UpChunk:i}=this.state,o=this.state.avStream&&this.state.avStream.getVideoTracks().length>0?De.Video:De.Audio;this.state.chunks&&t&&i&&(n!=null&&n.currentMediaRecordingUid&&bs(n,t,o,e,i,this.state.chunks[n==null?void 0:n.currentMediaRecordingUid]),r!=null&&r.currentMediaRecordingUid&&bs(r,t,De.Screen,e,i,this.state.chunks[r==null?void 0:r.currentMediaRecordingUid]))},handleCancelledStream(e){const t=e.getVideoTracks(),n=e.getAudioTracks();let r=t.length&&t[0];r=r||n.length&&n[0],r&&r.addEventListener("ended",()=>{[this.state.avRecorder,this.state.screenRecorder].map(i=>{i&&(i.state==="recording"&&i.stop(),i.stream.getTracks().map(o=>{o.readyState==="live"&&o.stop()}))}),Object.assign(this.state,{avStream:null,captureStream:null,avRecorder:null,screenRecorder:null})})},taskDurationMillisecond(){return this.state.startTime?new Date().getTime()-this.state.startTime.getTime():0},setUpChunk(e){this.state.UpChunk=e},configure(e,t){Object.assign(this.state,t),this.state.uploadApiEndpoint=`${t.apiURL}/2/environments/integrations/upload`,this.state.chunks={},e.on(pe.PermissionStatus,this.permissionStatusCallback.bind(this)),e.on(pe.AvPermission,async n=>{this.avPermissionCallback(n)}),e.on(pe.BeginRecording,this.beginRecordingCallback.bind(this)),e.on(pe.StartTask,this.startTaskCallback.bind(this)),e.on(pe.ScreenPermission,async n=>{this.screenPermissionCallback(n)}),e.on(pe.FinishTask,async n=>{this.finishTaskCallback(n)})},async avPermissionCallback(e){var r,i,o;const{[K.StreamReadyCallback]:t,[K.PermissionDescriptors]:n}=e;try{(r=this.state.avStream)!=null&&r.active&&(this.state.avStream.getTracks().map(a=>a.readyState==="live"&&a.stop()),((i=this.state.captureStream)==null?void 0:i.getAudioTracks().length)===1&&this.state.captureStream.removeTrack(this.state.captureStream.getAudioTracks()[0])),this.state.avStream=await navigator.mediaDevices.getUserMedia({video:n.includes(nn.Camera),audio:!0}),((o=this.state.captureStream)==null?void 0:o.getAudioTracks().length)===0&&this.state.captureStream.addTrack(this.state.avStream.getAudioTracks()[0]),this.handleCancelledStream(this.state.avStream)}catch(a){console.warn("Error: failed to get permissions: "+a),t&&t(null,null);return}t&&t(this.state.avStream,this.state.captureStream)},async screenPermissionCallback(e){const{[K.ScreenPermissionRequested]:t,[K.StreamReadyCallback]:n}=e;t==null||t(!0);try{this.state.captureStream=await navigator.mediaDevices.getDisplayMedia({video:!0,cursor:"always",displaySurface:"browser",preferCurrentTab:!0})}catch(r){t==null||t(!1),console.warn("Error: failed to get permissions: "+r),n&&n(null,null);return}t==null||t(!1),this.state.avStream&&this.state.avStream.getAudioTracks().length>0&&this.state.captureStream.addTrack(this.state.avStream.getAudioTracks()[0]),this.handleCancelledStream(this.state.captureStream),n&&n(this.state.avStream||null,this.state.captureStream)},beginRecordingCallback(e){const{[K.RecordingMediaTypes]:t,[K.StartRecordingCallback]:n}=e;if(!t)return;const r=[];if(t.includes(De.Video)&&this.state.avStream){this.state.avRecorder=_s(this.state.avStream);const i=mt();ws(this.state.avRecorder,i,this.state.chunks),r.push(i)}if(t.includes(De.Screen)&&this.state.captureStream){this.state.screenRecorder=_s(this.state.captureStream);const i=mt();ws(this.state.screenRecorder,i,this.state.chunks),r.push(i)}r&&n&&n(r)},async finishTaskCallback(e){const{[K.CurrentIndex]:t,[K.TaskResponse]:n,[K.TaskCompleteCallback]:r}=e;await this.stopRecording(e),r&&r(this.taskDurationMillisecond()),this.state.cards&&this.state.hasEndCard!==void 0&&this.lookAheadAndStopStream(t,n,this.state.cards,this.state.hasEndCard)},startTaskCallback(){this.state.startTime=new Date},permissionStatusCallback(e){var r;const{[K.PermissionStatusCallback]:t}=e,n=this.state.avStream;t&&t(n,n?(n==null?void 0:n.getVideoTracks().length)>0:!1,!!((r=this.state.captureStream)!=null&&r.active),this.state.captureStream)},lookAheadAndStopStream(e,t,n,r){const{avRecorder:i,screenRecorder:o}=this.state,{allResponses:a}=ee.getState(),s=qu({cards:n,index:e,hasEndCard:r,allResponses:a});s!==null&&n[s].type===T.RecordedTask||[i,o].map(l=>{l&&(l.state==="recording"&&l.stop(),l.stream.getTracks().map(u=>{u.readyState==="live"&&u.stop()}))})}},mr=Object.create(lm);Object.freeze(mr);function zu(e){var t,n,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e))for(t=0;t<e.length;t++)e[t]&&(n=zu(e[t]))&&(r&&(r+=" "),r+=n);else for(t in e)e[t]&&(r&&(r+=" "),r+=t);return r}function q(){for(var e,t,n=0,r="";n<arguments.length;)(e=arguments[n++])&&(t=zu(e))&&(r&&(r+=" "),r+=t);return r}var um=0;function y(e,t,n,r,i,o){var a,s,l={};for(s in t)s=="ref"?a=t[s]:l[s]=t[s];var u={type:e,props:l,key:n,ref:a,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,__h:null,constructor:void 0,__v:--um,__source:i,__self:o};if(typeof e=="function"&&(a=e.defaultProps))for(s in a)l[s]===void 0&&(l[s]=a[s]);return N.vnode&&N.vnode(u),u}const xe=e=>y("button",{...e,className:q("ul-card-text__button",e.className),id:"ul-card-text__button"}),ze=({message:e,properties:t})=>{const n=t==null?void 0:t.captionText;return y(Ae,{children:[e&&y("h1",{className:U.QuestionHeader,id:U.QuestionHeader,...n?{}:{style:{marginBottom:"15px"}},children:e}),n&&y("p",{className:U.Caption,id:U.Caption,children:n})]})},Es=({buttonText:e="View Prototype",handleClick:t})=>y("button",{className:"prototype-button",onClick:t,children:e},"prototype-btn"),xt=({defaultBody:e,embeddedType:t="prototype",properties:n})=>{var d;const{handleClickEmbedButton:r,hasViewedEmbed:i,headers:o,useDesktopPrototype:a}=ee(f=>({handleClickEmbedButton:f.handleClickEmbedButton,hasViewedEmbed:f.hasViewedEmbed,headers:f.headers,useDesktopPrototype:f.useDesktopPrototype})),s=(n==null?void 0:n.conceptUrl)||((d=n==null?void 0:n.consentDocument)==null?void 0:d.url),l=window.innerWidth<Uf,u=o["userleap-platform"],c=(f,p)=>{f.preventDefault(),r(p)};if(!a&&l&&!i&&s&&["email","link"].includes(u)){if(t==="prototype")return y(Es,{handleClick:f=>{c(f,Re.ViewPrototypeClick)}});if(t==="pdf")return y(Es,{buttonText:(n==null?void 0:n.viewDocumentText)||"View Document",handleClick:f=>{c(f,Re.ViewAgreementClick)}})}return e()},Wu=(e,t)=>{const n=wt(0),r=()=>{if(e.current){const i=e.current;i.style.height="1px";const o=i.scrollHeight,a=i.offsetHeight-i.clientHeight,s=o+a,l=parseInt(window.getComputedStyle(i).getPropertyValue("max-height")),u=s<=l?s:l;n.current!==u&&t(),n.current=u,i.style.height=`${u}px`}};return Le(r,[]),r},Yu=({border:e,label:t,isSelected:n,value:r,text:i,id:o,isRadio:a,useMobileStyling:s,error:l,allowTextEntry:u,promptText:c,onUserInputChanged:d})=>{const{styleNonce:f,viewDocument:p}=ee(S=>({styleNonce:S.styleNonce,viewDocument:S.viewDocument})),[h,v]=de(!1);fm(p,e,f);const g=({isSelected:S,userText:L})=>{d&&d({id:o||"",selected:S,value:r,userText:L})},w=S=>{S.stopPropagation(),g({isSelected:a||!n,userText:i}),v(!1)},_=()=>{h||v(!0)},b=()=>{h&&v(!1)},E=S=>{xn(S.target)||(S.key==="Enter"||S.key===" ")&&w(S)},m={onClick:S=>w(S),onKeyPress:S=>E(S)};"ontouchstart"in p.documentElement?(m.onTouchStart=b,m.onTouchCancel=b,m.onTouchEnd=b):(m.onMouseDown=_,m.onMouseLeave=b);const x=a?`radio-${o}`:`checkbox-${o}`,I=n||h?[gr]:[],C=[...l?[Qu]:[],...I];return y("div",{className:q([...ie(U.Choice,s),...C]),id:`choice-div-${o}`,style:l?{borderColor:En}:{},...m,children:[y("div",{className:q([U.ChoiceLabelContainer]),children:[a?y("div",{"aria-labelledby":`label-${o}`,className:q([U.ChoiceRadio,...I]),id:x,role:"radio",tabIndex:0}):y("div",{"aria-checked":n,"aria-labelledby":`label-${o}`,className:U.ChoiceCheckbox,id:x,role:"checkbox",style:n?{backgroundColor:e,borderColor:e,boxShadow:"none"}:{},tabIndex:0,children:n&&y("svg",{fill:"none",height:"10",viewBox:"0 0 10 10",width:"10",xmlns:"http://www.w3.org/2000/svg",children:y("path",{d:"M9.15377 1.30774L4.07685 8.23082L1.30762 5.00005",stroke:"white",strokeLinecap:"round",strokeWidth:"2"})})}),y("label",{className:q(ie(U.ChoiceLabel,s)),htmlFor:x,id:`label-${o}`,children:t})]}),u&&n&&y("div",{className:q([U.ChoiceTextEntryContainer,...I]),children:y(cm,{onTextChange:S=>g({isSelected:n,userText:S}),promptText:c||"Please specify",textValue:i,useMobileStyling:s})})]})},cm=({promptText:e,textValue:t,onTextChange:n,useMobileStyling:r})=>{const i=wt(null),{update:o}=ee(s=>({update:s.update})),a=Wu(i,()=>o());return Le(()=>{i.current&&i.current.focus()},[]),y("textarea",{"aria-label":e,"aria-multiline":"true","aria-placeholder":e,className:q(ie(U.ChoiceTextInput,r)),"data-gramm":"false",maxLength:5e3,name:"text",onChange:s=>{a(),xn(s.target)&&(s.stopPropagation(),n(s.target.value))},onClick:s=>{s.stopPropagation()},onKeyPress:s=>{s.stopPropagation()},placeholder:e,ref:i,role:"textbox",rows:1,value:t})},xs="ul-select-style-element",gr="ul-select-active-dynamic-style",Qu="ul-select-error-dynamic-style",dm=e=>e.tagName.toLowerCase()==="style",fm=(e,t,n)=>{let r=e.getElementById(xs),i=!1;r||(r=e.createElement("style"),i=!0),dm(r)&&(r.id=xs,n&&(r.nonce=n),r.textContent=pm(t),i&&e.head.appendChild(r))},pm=e=>`
36
- .${gr} {
35
+ */var Qr=Ju,dm=ec.exports;function fm(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var pm=typeof Object.is=="function"?Object.is:fm,hm=dm.useSyncExternalStore,vm=Qr.useRef,mm=Qr.useEffect,gm=Qr.useMemo,ym=Qr.useDebugValue;Xu.useSyncExternalStoreWithSelector=function(e,t,n,r,i){var o=vm(null);if(o.current===null){var a={hasValue:!1,value:null};o.current=a}else a=o.current;o=gm(function(){function l(p){if(!u){if(u=!0,c=p,p=r(p),i!==void 0&&a.hasValue){var v=a.value;if(i(v,p))return d=v}return d=p}if(v=d,pm(c,p))return v;var h=r(p);return i!==void 0&&i(v,h)?v:(c=p,d=h)}var u=!1,c,d,f=n===void 0?null:n;return[function(){return l(t())},f===null?void 0:function(){return l(f())}]},[t,n,r,i]);var s=hm(e,o[0],o[1]);return mm(function(){a.hasValue=!0,a.value=s},[s]),ym(s),s};(function(e){e.exports=Xu})(Zu);const _m=jc(Zu.exports),{useSyncExternalStoreWithSelector:wm}=_m;function bm(e,t=e.getState,n){const r=wm(e.subscribe,e.getState,e.getServerState||e.getState,t,n);return ta(r),r}const xs=e=>{const t=typeof e=="function"?jv(e):e,n=(r,i)=>bm(t,r,i);return Object.assign(n,t),n},nc=e=>e?xs(e):xs;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 Em="rgba(255,255,255, 0.95)",xm="rgba(0,0,0,0.9)",rc="360px",_i="0px",ic=()=>{window.UserLeap.container=document.createElement("div"),window.UserLeap.container.className="ul-container",document.body.appendChild(window.UserLeap.container)},oc=e=>{Tm();const t=window.UserLeap.container;if(!(!t||!t.parentNode))try{t.parentNode.removeChild(t),window.UserLeap.container=null,be("trackStartUrl",null),F.emit(j.SurveyLifeCycle,{state:"dismissed"}),F.emit(j.SurveyClosed,{name:j.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)}},ac=()=>{F.on(j.SurveyWillClose,({initiator:e})=>{oc(e)})},Sm=(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"?Em:xm,t||(r.margin="auto"),window.UserLeap.container&&Object.assign(window.UserLeap.container.style,r)},Cm=(e,t,n)=>{var s,l;const r={position:"fixed",bottom:"0px",right:_i,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=rc,r.maxHeight=window.UserLeap.maxHeight||"66vh",i.framePosition===bn.BottomLeft?o={left:_i}:i.framePosition===bn.TopLeft?o={left:_i,top:"0px"}:i.framePosition===bn.TopRight?o={top:"0px"}:i.framePosition===bn.Center&&(a=!0,o={margin:"auto",position:"static"},r.maxHeight=null)),a&&Sm(i,n),Object.assign(e.style,r,o),a},Im=(e,t,n)=>{var l,u;const r="ul-frame";ic(),km();const i=document.createElement("iframe");i.id=r,i.setAttribute("title","Sprig User Feedback Dialog");const o=Cm(i,e,t);ac(),i.setHeight=c=>{parseInt(i.style.height)!=c&&(i.style.height=`${c}px`,F.emit(j.SurveyHeight,{name:j.SurveyHeight,contentFrameHeight:c}))},i.setWidth=c=>{parseInt(i.style.width)!=c&&(i.style.width=`${c}px`,F.emit(j.SurveyWidth,{name:j.SurveyWidth,contentFrameWidth:c}))},(l=window.UserLeap.container)==null||l.appendChild(i),e&&(t?e.exitOnOverlayClickMobile:e.exitOnOverlayClick)&&window.UserLeap.container&&(window.UserLeap.container.onclick=()=>{F.emit(j.CloseSurveyOnOverlayClick)}),F.emit(j.SurveyLifeCycle,{state:"presented"}),F.emit(j.SurveyPresented,{name:j.SurveyPresented,[Rn.SurveyId]:n});const a=(u=i.contentWindow)==null?void 0:u.document;a&&(a.open("text/html","replace"),a.write("<!doctype html><head></head><body></body></html>"),a.close());const s=a==null?void 0:a.head;return{frameId:r,contentWinDocHead:s,contentWindow:i.contentWindow,hasOverlay:o,iframe:i}},sc={[j.SurveyFadingOut]:()=>{window.UserLeap.container&&Object.assign(window.UserLeap.container.style,{"background-color":"rgba(0,0,0,0)"})}},km=()=>{Object.entries(sc).forEach(([e,t])=>{F.on(e,t)})},Tm=()=>{Object.entries(sc).forEach(([e,t])=>{F.off(e,t)})};var fo=(e=>(e[e.And=1]="And",e[e.Or=2]="Or",e))(fo||{});const Ss=1,oa={eq(e,t){return e==t},neq(e,t){return!this.eq(e,t)},gt(e,t){return e>t},gte(e,t){return e>=t},lt(e,t){return e<t},lte(e,t){return e<=t},list_exact(e,t){return!Array.isArray(e)||!Array.isArray(t)?!1:e.slice().sort().join(",")===t.slice().sort().join(",")},list_all(e,t){return!Array.isArray(e)||!Array.isArray(t)?!1:!t.some(n=>e.indexOf(n)===-1)},list_alo(e,t){if(!Array.isArray(t))return!1;const n=Array.isArray(e)?e:[e],r=new Set(n);return t.some(i=>r.has(i))},list_dni(e,t){if(!Array.isArray(t))return!1;const n=Array.isArray(e)?e:[e],r=new Set(n);return t.every(i=>!r.has(i))},contains(e,t){const n=e.toLowerCase(),r=t.toLowerCase();return n.includes(r)},notcontains(e,t){return!this.contains(e,t)}},Lm=(e,t,n)=>{switch(t){case L.VideoVoice:return Boolean(e&&e.value);case L.Open:return!!n;case L.MultipleSelect:return Boolean(n&&!!Object.keys(n).length);case L.RecordedTask:return(n==null?void 0:n.taskStatus)===Re.Completed;case L.TextUrlPrompt:return!e.value;case L.ConsentLegal:return n!==null;case L.MultipleChoice:return n!==void 0;case L.Matrix:return Boolean(n&&Object.values(n).every(r=>r!==null));case L.NPS:return n!==null;case L.Likert:return n!==null;default:return!0}},lc=(e,t)=>{if(t===L.Matrix){const n=Object.keys(e).length,r=Object.values(e).filter(i=>i!==null).length;return r>0&&r<n}return!1},uc=({cards:e,index:t,hasEndCard:n,allResponses:r,uploadProgress:i={}})=>{if(t>=e.length||t<0)return null;const o=e[t];let a=t+1;const s=o.props.routingOptions||[];for(let c=0;c<s.length;c++){const{group:d,target:f}=s[c];if(!(d!=null&&d.length))continue;const p=d[0];if(p.questionIndex===void 0||p.questionIndex>r.length)continue;let v=Cs({comparator:p.comparator,response:r[p.questionIndex],type:o.type,value:p.value});for(let h=1;h<d.length;h+=2){const g=d[h],_=d[h+1],w=Cs({comparator:_.comparator,response:r[_.questionIndex],type:e[_.questionIndex].type,value:_.value});g===fo.And?v&&(v=w):g===fo.Or&&(v||(v=w))}if(v){a=f===-1&&n?e.length-1:f;break}}const l=e.findIndex(c=>c.type===L.Uploading);let u;return l>0?u=n?e.length-3:e.length-2:u=e.length-1,t>=u||a===-1||a!==null&&a>u?l>0&&Object.values(i).some(d=>d.isSubmitted&&!d.isComplete)?l:n?e.length-1:null:a===-1?null:a},Cs=({comparator:e,response:t,type:n,value:r})=>{if(e===Pe.Answered)switch(n){case L.TextUrlPrompt:return t===void 0;case L.ConsentLegal:return t&&t.submitted===!0;case L.RecordedTask:return"taskStatus"in t&&t.taskStatus===Re.Completed;case L.Likert:return Number.isInteger(t);case L.Open:return t&&t.length>0;case L.MultipleChoice:case L.MultipleSelect:return Object.keys(t).length>0;case L.Matrix:return Object.values(t).every(i=>i!==null);case L.NPS:return Number.isInteger(t);case L.VideoVoice:return!!(t!=null&&t.mediaRecordingUid);default:return!1}if(e===Pe.GivenUp)return n===L.RecordedTask?"taskStatus"in t&&t.taskStatus===Re.GivenUp:!0;if(e===Pe.Partial)return n===L.Matrix?lc(t,n):!1;if(e===Pe.Skipped)switch(n){case L.TextUrlPrompt:return t==null?void 0:t.skipped;case L.ConsentLegal:return t===null;case L.RecordedTask:return"taskStatus"in t&&t.taskStatus===Re.Abandoned;case L.Likert:return t===null;case L.Open:return(t==null?void 0:t.length)===0;case L.MultipleChoice:return t===void 0;case L.MultipleSelect:return(t==null?void 0:t.length)===0;case L.Matrix:return Object.values(t).every(i=>i===null);case L.NPS:return t===null;case L.VideoVoice:return t===null;default:return!1}return oa[e](t,r)},Rm=13,Am=(e,t)=>e.reduce((n,r)=>n.concat(n.map(i=>[...i,r])),[[]]).filter(n=>t||n.length>0),Um=e=>{var t,n,r;switch(e.type){case L.MultipleSelect:return!e||!e.props||!e.props.options?null:e.props.options.length>Rm?e.props.options.map(i=>[i.value]):Am(e.props.options.map(i=>i.value),!e.props.properties.required);case L.MultipleChoice:{if(!e||!e.props||!e.props.options)return null;const i=e.props.options.map(o=>o.value);return e.props.properties.required||i.push(void 0),i}case L.Matrix:{if(!((t=e==null?void 0:e.props)!=null&&t.options))return null;const i=e.props.properties.matrixColumn,o=e.props.options,a=o.reduce((c,d)=>(c[d.id]=null,c),{}),s={...a,[o[0].id]:i[0].value},l=o.reduce((c,d)=>(c[d.id]=i[0].value,c),{}),u=[s,l];return e.props.properties.required||u.push(a),u}case L.Likert:{const i=Number((r=(n=e.props)==null?void 0:n.properties)==null?void 0:r.range)||5;return[...Array.from(Array(i).keys()).map(a=>a+1),...e.props.properties.required?[]:[null]]}case L.NPS:return[0,1,2,3,4,5,6,7,8,9,10,...e.props.properties.required?[]:[null]];case L.VideoVoice:case L.Open:return["1",...e.props.properties.required?[]:[""]];case L.RecordedTask:return[{taskStatus:Re.Completed},{taskStatus:Re.GivenUp},...e.props.properties.required?[]:[{taskStatus:Re.Abandoned}]];case L.TextUrlPrompt:return[void 0,...e.props.properties.required?[]:[{skipped:!0}]];case L.ConsentLegal:return[Ss,...e.props.properties.required?[]:[null]];default:return[Ss]}},Om=e=>e in oa,Dm=e=>typeof e=="object"&&e!==null&&"taskStatus"in e,Pm=(e,t=[])=>t.reduce((n,r)=>{const{group:i,target:o}=r;if(!(i!=null&&i.length))return[...n];const a=i.filter(s=>Number(s)?!0:typeof s=="object"?s.questionIndex===e:!1).map(s=>{const{comparator:l,value:u}=s;return{comparator:l,target:o,value:u}});return[...n,...a]},[]),Nm=(e,t)=>{const n=new Set([L.Thanks,L.Uploading]);if(t>=e.length||t<0||n.has(e[t].type))return 0;const r=e.filter(o=>!n.has(o.type));if(t===r.length-1)return 1;const i={[r.length-1]:1,[-1]:0};for(let o=r.length-2;o>=t;o--){const a=r[o],s=Pm(o,a.props.routingOptions);if(s.length===0){i[o]=i[o+1]+1;continue}let l=0,u=Um(a);if(u===null)return r.length-1-t;for(let c=0;c<s.length&&u.length!==0;c++){const{comparator:d,target:f,value:p}=s[c],v=u.filter(h=>{const g=Lm({value:h},a.type,h),_=lc(h,a.type);return!(g&&d===Pe.Answered||_&&d===Pe.Partial||!g&&!_&&d===Pe.Skipped||d===Pe.GivenUp&&Dm(h)&&h.taskStatus===Re.GivenUp||g&&a.type===L.Open&&(d===Pe.Contains||d===Pe.DoesNotContain)||g&&Om(d)&&oa[d](h,p))});if(v.length<u.length){const h=parseInt(String(f),10);if(h!==-1&&h<=o||h>=r.length)return r.length-1-t;l=Math.max(i[h]+1,l)}u=v}u.length>0&&(l=Math.max(i[o+1]+1,l)),i[o]=l}return i[t]},Mm=e=>!(e.type===L.Thanks||e.type===L.Uploading),X=nc()((e,t)=>({allResponses:[],answers:void 0,apiURL:"",border:"#000000",cards:[],close:async(n=Xt)=>{const r=t(),{fadeout:i,remove:o,trackHistory:a}=r;await i(n),wi(r)||a({event:"closed"}),Li.enable(),o({initiator:qe.Closed})},configureExitOnOverlayClick:()=>{},customMetadata:{},destroy:async n=>{const{eventEmitFn:r,fadeout:i,remove:o}=t();r(Ue.SurveyComplete),await i(n),Li.enable(),o({initiator:qe.Complete})},endCard:{headline:""},envId:"",eventEmitFn:F.emit.bind(F),fadeout:async n=>{const{eventEmitFn:r,headers:i,viewDocument:o}=t();return Jt(i)?Promise.resolve():(r(j.SurveyFadingOut),new Promise(a=>{const s=o.getElementById(n);s?(s.addEventListener("transitionend",()=>{a()}),s.classList.remove("ul-app--visible")):a()}))},forceBrandedLogo:!1,frame:document.createElement("iframe"),handleClickEmbedButton:n=>{const{cards:r,eventEmitFn:i,index:o}=t();i(n,{[At.QuestionId]:r[o].name,[At.Props]:r[o].props}),e(()=>({hasViewedEmbed:!0}))},handleUploadUpdate:({mediaRecordingUid:n,isComplete:r,progressPct:i,isSubmitted:o})=>{var p,v,h;const{cards:a,destroy:s,index:l,uploadProgress:u}=t(),c=r||((p=u[n])==null?void 0:p.isComplete),d={...u,[n]:{progressPct:c?100:i||((v=u[n])==null?void 0:v.progressPct),isComplete:c,isSubmitted:o||((h=u[n])==null?void 0:h.isSubmitted)}};if(e({uploadProgress:d}),a[l].type!==L.Uploading)return;const f=Object.entries(u).every(([g,_])=>!_.isSubmitted||_.isComplete||n==g&&r);if(f&&l>=a.length-1)return s(Xt);e({index:f?l+1:l,uploadingCardViewed:!0})},hasViewedEmbed:!1,headers:{Authorization:"","Content-Type":"","userleap-platform":Vt.Web,"x-ul-environment-id":"","x-ul-installation-method":yt.Snippet,"x-ul-sdk-version":"","x-ul-visitor-id":""},index:0,isPreview:!1,marketingUrl:"https://sprig.com",meta:{ch:0,cw:0,l:"",mode:null,p:"",sh:0,sw:0},mode:void 0,next:n=>{const{allResponses:r,cards:i,eventEmitFn:o,index:a,responseGroupUid:s,submit:l,trackHistory:u,uploadProgress:c,viewedCardCount:d}=t(),f=Date.now(),p=[...i],v=p[a],{type:h}=n.data,g={...n.data},_=g.value;Mm(v)&&(v.value=_),g.answeredAt=f,delete g.type;const w={response:g,responseGroupUid:s,questionIndex:a};let E=h===L.MultipleChoice?Object.values(_).find(S=>S!==!1):_;h===L.MultipleSelect&&(E=p[a].props.options.reduce((S,I)=>(_[I.id]&&S.push(I.value),S),[]));const b=r.slice(0);b[a]=E,e({allResponses:b});const m=uc({cards:p,index:a,hasEndCard:!!n.endCard,uploadProgress:c,allResponses:b});if(m===null){w.completedAt=f,l(w),n.completeSurvey();return}else[L.Thanks,L.Uploading].includes(p[m].type)&&(w.completedAt=f);const x=l(w);[L.Thanks,L.Uploading].includes(p[m].type)||x.finally(()=>{u({event:"seen",index:m})});const k=p[m];p[m]&&o&&o(Ue.CurrentQuestion,{[At.QuestionId]:k.name,[At.Props]:k.props}),e({cards:p,hasViewedEmbed:!1,index:m,viewedCardCount:d+1})},previewKey:null,recorder:()=>{},recorderEventEmitter:F,responseGroupUid:"",remove:({initiator:n})=>{const{frame:r,headers:i,eventEmitFn:o}=t();["ios","android"].includes(i["userleap-platform"])&&o(j.SurveyWillClose,{name:j.SurveyWillClose,initiator:n}),!Jt(i)&&(o(j.SurveyWillClose,{name:j.SurveyWillClose,initiator:n}),r.remove())},seen:async()=>{const{trackHistory:n}=t();return n({event:"seen",isNew:!0})},slugName:null,showStripes:!1,showSurveyBrand:!1,styleNonce:"",submit:async({completedAt:n,questionIndex:r,response:i,responseGroupUid:o})=>{const a=t();if(!o||wi(a))return;const s={responseGroupUid:o,meta:a.meta,customMetadata:a.customMetadata,responses:[i],completedAt:n,previewKey:a.previewKey};n&&yv({id:a.surveyId});const l=await rt(`${a.apiURL}/sdk/1/environments/${a.envId}/visitors/${a.userId}/responses/submit`,{body:JSON.stringify(s),headers:a.headers,method:"POST"});if(!l.ok){l.reportError&&(console.warn("[Sprig] (ERR-427) Failed to submit response",l.error),await Is(a,"submitResponse",l.error));return}a.eventEmitFn(j.QuestionAnswered,{...i,questionIndex:r})},surveyId:0,tabTitle:"",trackHistory:async({event:n,index:r,isNew:i=!1})=>{const o=t();if(wi(o))return;const{cards:a,index:s}=o,l=r!==void 0?a[r]:a[s],u={sid:o.surveyId,qid:l.name,action:n,vid:o.userId,eid:o.envId,isNew:i,responseGroupUid:o.responseGroupUid,previewKey:o.previewKey},c=await rt(`${o.apiURL}/sdk/1/visitors/${o.userId}/surveys/${o.surveyId}/history`,{body:JSON.stringify(u),headers:o.headers,method:"POST"});!c.ok&&c.reportError&&(console.warn("[Sprig] (ERR-428) Failed to track survey event",c.error),await Is(o,"trackHistory",c.error))},update:()=>{const{cards:n,index:r,headers:i,eventEmitFn:o,frame:a,viewDocument:s}=t(),u=n[r].type===L.Matrix;setTimeout(()=>{var f,p;const[c,d]=sl(s);Jt(i)?o(j.SurveyHeight,{name:j.SurveyHeight,contentFrameHeight:c}):((f=a.setHeight)==null||f.call(a,c),(p=a.setWidth)==null||p.call(a,u?d:parseInt(rc)))},100)},uploadingCardViewed:!1,uploadProgress:{},useDesktopPrototype:void 0,useMobileStyling:!1,userId:"",viewDocument:window.document,viewedCardCount:0})),wi=e=>!e.userId||e.meta&&e.meta.mode==="test"||e.isPreview,Is=async(e,t,n)=>{const{mode:r,userId:i,envId:o,apiURL:a,headers:s,viewDocument:l}=e,u=l.documentElement,c={mode:r,screenWidth:window.screen.width,screenHeight:window.screen.height,clientWidth:u.clientWidth,clientHeight:u.clientHeight,location:window.location.href,language:window.navigator.language},d={action:t,err:{message:n==null?void 0:n.message,stack:n==null?void 0:n.stack},meta:c,vid:i,envId:o};(await rt(`${a}/sdk/1/errors`,{method:"POST",headers:Object.assign({"x-ul-error":window.btoa(`userleap-${Date.now()}-error`)},s),body:JSON.stringify(d)})).ok||console.warn("[Sprig] (ERR-444) Failed to report error to API",n)},Vm=async(e,t)=>{var r;const n=await fetch(t,{method:"POST",cache:"no-cache",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(n.ok){const i=await n.json();return(r=i==null?void 0:i.upload)==null?void 0:r.url}else return null},cc=()=>MediaRecorder.isTypeSupported("video/webm")?"video/webm":"video/mp4",ks=e=>{const t={audioBitsPerSecond:128e3,videoBitsPerSecond:25e5,mimeType:cc()};return new MediaRecorder(e,t)},Ts=(e,t,n)=>{n[t]=[],e.ondataavailable=function(r){n[t].push(r.data)},e.currentMediaRecordingUid=t,e.start()};function Ls(e,t,n,r,i,o){if(e&&e.state!=="inactive"){const{[$.BeginCallback]:a}=r,s=e.currentMediaRecordingUid;if(!s)return;a&&a(s),e.onstop=()=>jm(t,e,n,r,s,i,o),e.stop()}}async function jm(e,t,n,r,i,o,a){const s=X.getState().viewDocument,{[$.UploadCallback]:l,[$.ProgressCallback]:u}=r,c={mediaType:n,updatedAt:new Date().toISOString(),mediaRecordingUid:i,...r[$.PassthroughData]},d=await Vm(c,e);if(!d){l&&l(null,{message:"failed to get upload url"});return}const f=new Blob(a,{type:cc()});if(!s.defaultView)return;const p=new s.defaultView.File([f],`recording video ${Date.now()}`),v=o.createUpload({endpoint:d,file:p,chunkSize:5120});v.on("error",h=>{l&&l(null,h)}),v.on("progress",h=>{u&&u(i,h)}),v.on("success",()=>{l&&l(i,!0)})}const Bm={chunks:{}},Fm={state:{...Bm},stopRecording(e){const{uploadApiEndpoint:t,avRecorder:n,screenRecorder:r,UpChunk:i}=this.state,o=this.state.avStream&&this.state.avStream.getVideoTracks().length>0?Te.Video:Te.Audio;this.state.chunks&&t&&i&&(n!=null&&n.currentMediaRecordingUid&&Ls(n,t,o,e,i,this.state.chunks[n==null?void 0:n.currentMediaRecordingUid]),r!=null&&r.currentMediaRecordingUid&&Ls(r,t,Te.Screen,e,i,this.state.chunks[r==null?void 0:r.currentMediaRecordingUid]))},handleCancelledStream(e){const t=e.getVideoTracks(),n=e.getAudioTracks();let r=t.length&&t[0];r=r||n.length&&n[0],r&&r.addEventListener("ended",()=>{[this.state.avRecorder,this.state.screenRecorder].map(i=>{i&&(i.state==="recording"&&i.stop(),i.stream.getTracks().map(o=>{o.readyState==="live"&&o.stop()}))}),Object.assign(this.state,{avStream:null,captureStream:null,avRecorder:null,screenRecorder:null})})},taskDurationMillisecond(){return this.state.startTime?new Date().getTime()-this.state.startTime.getTime():0},setUpChunk(e){this.state.UpChunk=e},configure(e,t){Object.assign(this.state,t),this.state.uploadApiEndpoint=`${t.apiURL}/2/environments/integrations/upload`,this.state.chunks={},e.on(fe.PermissionStatus,this.permissionStatusCallback.bind(this)),e.on(fe.AvPermission,async n=>{this.avPermissionCallback(n)}),e.on(fe.BeginRecording,this.beginRecordingCallback.bind(this)),e.on(fe.StartTask,this.startTaskCallback.bind(this)),e.on(fe.ScreenPermission,async n=>{this.screenPermissionCallback(n)}),e.on(fe.FinishTask,async n=>{this.finishTaskCallback(n)})},async avPermissionCallback(e){var r,i,o;const{[$.StreamReadyCallback]:t,[$.PermissionDescriptors]:n}=e;try{(r=this.state.avStream)!=null&&r.active&&(this.state.avStream.getTracks().map(a=>a.readyState==="live"&&a.stop()),((i=this.state.captureStream)==null?void 0:i.getAudioTracks().length)===1&&this.state.captureStream.removeTrack(this.state.captureStream.getAudioTracks()[0])),this.state.avStream=await navigator.mediaDevices.getUserMedia({video:n.includes(an.Camera),audio:!0}),((o=this.state.captureStream)==null?void 0:o.getAudioTracks().length)===0&&this.state.captureStream.addTrack(this.state.avStream.getAudioTracks()[0]),this.handleCancelledStream(this.state.avStream)}catch(a){console.warn("Error: failed to get permissions: "+a),t&&t(null,null);return}t&&t(this.state.avStream,this.state.captureStream)},async screenPermissionCallback(e){const{[$.ScreenPermissionRequested]:t,[$.StreamReadyCallback]:n}=e;t==null||t(!0);try{this.state.captureStream=await navigator.mediaDevices.getDisplayMedia({video:!0,cursor:"always",displaySurface:"browser",preferCurrentTab:!0})}catch(r){t==null||t(!1),console.warn("Error: failed to get permissions: "+r),n&&n(null,null);return}t==null||t(!1),this.state.avStream&&this.state.avStream.getAudioTracks().length>0&&this.state.captureStream.addTrack(this.state.avStream.getAudioTracks()[0]),this.handleCancelledStream(this.state.captureStream),n&&n(this.state.avStream||null,this.state.captureStream)},beginRecordingCallback(e){const{[$.RecordingMediaTypes]:t,[$.StartRecordingCallback]:n}=e;if(!t)return;const r=[];if(t.includes(Te.Video)&&this.state.avStream){this.state.avRecorder=ks(this.state.avStream);const i=at();Ts(this.state.avRecorder,i,this.state.chunks),r.push(i)}if(t.includes(Te.Screen)&&this.state.captureStream){this.state.screenRecorder=ks(this.state.captureStream);const i=at();Ts(this.state.screenRecorder,i,this.state.chunks),r.push(i)}r&&n&&n(r)},async finishTaskCallback(e){const{[$.CurrentIndex]:t,[$.TaskResponse]:n,[$.TaskCompleteCallback]:r}=e;await this.stopRecording(e),r&&r(this.taskDurationMillisecond()),this.state.cards&&this.state.hasEndCard!==void 0&&this.lookAheadAndStopStream(t,n,this.state.cards,this.state.hasEndCard)},startTaskCallback(){this.state.startTime=new Date},permissionStatusCallback(e){var r;const{[$.PermissionStatusCallback]:t}=e,n=this.state.avStream;t&&t(n,n?(n==null?void 0:n.getVideoTracks().length)>0:!1,!!((r=this.state.captureStream)!=null&&r.active),this.state.captureStream)},lookAheadAndStopStream(e,t,n,r){const{avRecorder:i,screenRecorder:o}=this.state,{allResponses:a}=X.getState(),s=uc({cards:n,index:e,hasEndCard:r,allResponses:a});s!==null&&n[s].type===L.RecordedTask||[i,o].map(l=>{l&&(l.state==="recording"&&l.stop(),l.stream.getTracks().map(u=>{u.readyState==="live"&&u.stop()}))})}},gr=Object.create(Fm);Object.freeze(gr);function dc(e){var t,n,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e))for(t=0;t<e.length;t++)e[t]&&(n=dc(e[t]))&&(r&&(r+=" "),r+=n);else for(t in e)e[t]&&(r&&(r+=" "),r+=t);return r}function H(){for(var e,t,n=0,r="";n<arguments.length;)(e=arguments[n++])&&(t=dc(e))&&(r&&(r+=" "),r+=t);return r}var Hm=0;function y(e,t,n,r,i,o){var a,s,l={};for(s in t)s=="ref"?a=t[s]:l[s]=t[s];var u={type:e,props:l,key:n,ref:a,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,__h:null,constructor:void 0,__v:--Hm,__source:i,__self:o};if(typeof e=="function"&&(a=e.defaultProps))for(s in a)l[s]===void 0&&(l[s]=a[s]);return P.vnode&&P.vnode(u),u}const ye=e=>y("button",{...e,className:H("ul-card-text__button",e.className),id:"ul-card-text__button"}),Be=({message:e,properties:t})=>{const n=t==null?void 0:t.captionText;return y(Ce,{children:[e&&y("h1",{className:U.QuestionHeader,id:U.QuestionHeader,...n?{}:{style:{marginBottom:"15px"}},children:e}),n&&y("p",{className:U.Caption,id:U.Caption,children:n})]})},Rs=({buttonText:e="View Prototype",handleClick:t})=>y("button",{className:"prototype-button",onClick:t,children:e},"prototype-btn"),ct=({defaultBody:e,embeddedType:t="prototype",properties:n})=>{var d;const{handleClickEmbedButton:r,hasViewedEmbed:i,headers:o,useDesktopPrototype:a}=X(f=>({handleClickEmbedButton:f.handleClickEmbedButton,hasViewedEmbed:f.hasViewedEmbed,headers:f.headers,useDesktopPrototype:f.useDesktopPrototype})),s=(n==null?void 0:n.conceptUrl)||((d=n==null?void 0:n.consentDocument)==null?void 0:d.url),l=window.innerWidth<Kf,u=o["userleap-platform"],c=(f,p)=>{f.preventDefault(),r(p)};if(!a&&l&&!i&&s&&["email","link"].includes(u)){if(t==="prototype")return y(Rs,{handleClick:f=>{c(f,Ue.ViewPrototypeClick)}});if(t==="pdf")return y(Rs,{buttonText:(n==null?void 0:n.viewDocumentText)||"View Document",handleClick:f=>{c(f,Ue.ViewAgreementClick)}})}return e()},fc=(e,t)=>{const n=xt(0),r=()=>{if(e.current){const i=e.current;i.style.height="1px";const o=i.scrollHeight,a=i.offsetHeight-i.clientHeight,s=o+a,l=parseInt(window.getComputedStyle(i).getPropertyValue("max-height")),u=s<=l?s:l;n.current!==u&&t(),n.current=u,i.style.height=`${u}px`}};return Ae(r,[]),r},aa=({ariaLabel:e,border:t,choiceStyle:n={},label:r,isSelected:i,value:o,text:a,id:s,isRadio:l,useMobileStyling:u,error:c,allowTextEntry:d,promptText:f,onUserInputChanged:p})=>{const{styleNonce:v,viewDocument:h}=X(T=>({styleNonce:T.styleNonce,viewDocument:T.viewDocument})),[g,_]=le(!1);qm(h,t,v);const w=({isSelected:T,userText:D})=>{p&&p({id:s||"",selected:T,value:o,userText:D})},E=T=>{T.stopPropagation(),w({isSelected:l||!i,userText:a}),_(!1)},b=()=>{g||_(!0)},m=()=>{g&&_(!1)},x=T=>{(T.key==="Enter"||T.key===" ")&&E(T)},k={onClick:T=>E(T),onKeyPress:T=>x(T)};"ontouchstart"in h.documentElement?(k.onTouchStart=m,k.onTouchCancel=m,k.onTouchEnd=m):(k.onMouseDown=b,k.onMouseLeave=m);const S=l?`radio-${s}`:`checkbox-${s}`,I=i||g?[yr]:[],R=[...c?[pc]:[],...I],O=r?{"aria-labelledby":`label-${s}`}:{"aria-label":e};return y("div",{className:H([...oe(U.Choice,u),...R]),id:`choice-div-${s}`,style:{...n,...c?{borderColor:Sn}:{}},...k,children:[y("div",{className:H([U.ChoiceLabelContainer]),children:[l?y("div",{...O,className:H([U.ChoiceRadio,...I]),id:S,role:"radio",tabIndex:0}):y("div",{"aria-checked":i,"aria-labelledby":`label-${s}`,className:U.ChoiceCheckbox,id:S,role:"checkbox",style:i?{backgroundColor:t,borderColor:t,boxShadow:"none"}:{},tabIndex:0,children:i&&y("svg",{fill:"none",height:"10",viewBox:"0 0 10 10",width:"10",xmlns:"http://www.w3.org/2000/svg",children:y("path",{d:"M9.15377 1.30774L4.07685 8.23082L1.30762 5.00005",stroke:"white",strokeLinecap:"round",strokeWidth:"2"})})}),r&&y("label",{className:H(oe(U.ChoiceLabel,u)),htmlFor:S,id:`label-${s}`,children:r})]}),d&&i&&y("div",{className:H([U.ChoiceTextEntryContainer,...I]),children:y($m,{onTextChange:T=>w({isSelected:i,userText:T}),promptText:f||"Please specify",textValue:a,useMobileStyling:u})})]})},$m=({promptText:e,textValue:t,onTextChange:n,useMobileStyling:r})=>{const i=xt(null),{update:o}=X(s=>({update:s.update})),a=fc(i,()=>o());return Ae(()=>{i.current&&i.current.focus()},[]),y("textarea",{"aria-label":e,"aria-multiline":"true","aria-placeholder":e,className:H(oe(U.ChoiceTextInput,r)),"data-gramm":"false",maxLength:5e3,name:"text",onChange:s=>{a(),s.stopPropagation(),n(s.currentTarget.value)},onClick:s=>{s.stopPropagation()},onKeyPress:s=>{s.stopPropagation()},placeholder:e,ref:i,role:"textbox",rows:1,value:t})},As="ul-select-style-element",yr="ul-select-active-dynamic-style",pc="ul-select-error-dynamic-style",Km=e=>e.tagName.toLowerCase()==="style",qm=(e,t,n)=>{let r=e.getElementById(As),i=!1;r||(r=e.createElement("style"),i=!0),Km(r)&&(r.id=As,n&&(r.nonce=n),r.textContent=Gm(t),i&&e.head.appendChild(r))},Gm=e=>`
36
+ .${yr} {
37
37
  border-color: ${e};
38
38
  }
39
- .${gr} .${U.ChoiceRadio}, .${gr}.${U.ChoiceRadio} {
39
+ .${yr} .${U.ChoiceRadio}, .${yr}.${U.ChoiceRadio} {
40
40
  border: 6px solid ${e};
41
41
  box-shadow: none;
42
42
  }
43
- .${Qu} {
44
- border-color: ${En};
43
+ .${pc} {
44
+ border-color: ${Sn};
45
45
  }
46
- `,hn=e=>(e==null?void 0:e.buttonText)||"Next",ta=e=>(e==null?void 0:e.skipButtonText)||"Skip",hm=({className:e,message:t,next:n,properties:r,questionId:i,type:o})=>{const{useMobileStyling:a,border:s}=ee(S=>({useMobileStyling:S.useMobileStyling,border:S.border})),[l,u]=de(!1),[c,d]=de(""),[f,p]=de(!1),h=r==null?void 0:r.collectName,v=(r==null?void 0:r.nameLabelText)||"Full Name",g=(r==null?void 0:r.consentText)||"I agree to the stated conditions",w=(r==null?void 0:r.submitButtonText)||"Submit",_=!!c.trim(),b=l&&(!h||_),E=(S,L=!1)=>{S.preventDefault(),S.stopPropagation();let D=null;if(!L){if(!b){p(!0);return}D={submitted:!0},h&&(D.name=c)}n({value:D,questionId:i,type:o})},m=S=>{Vf(S.target)&&(S.preventDefault(),S.stopPropagation(),d(S.target.value))},x=S=>{Jt(S.target)&&(S.target.style.borderColor=f&&!_?En:s)},I=S=>{Jt(S.target)&&(S.target.style.borderColor=f&&!_?En:To)},C=()=>y("div",{children:[y(Yu,{allowTextEntry:!1,border:s,error:f&&!l,index:0,isRadio:!1,isSelected:l,label:g,onUserInputChanged:({selected:S})=>{S!==l&&u(!l)},useMobileStyling:a}),h&&y("input",{"aria-label":v,"aria-placeholder":v,className:q(ie(U.ConsentLegalNameInput,a)),"data-gramm":"false",maxLength:250,name:"name",onBlur:I,onFocus:x,onInput:m,placeholder:v,style:f&&!_?{borderColor:En}:{},tabIndex:0,value:c}),y("div",{className:"ul-card__button-wrapper ul-card-vertical__button-wrapper",children:[y(xe,{className:b?"":U.ButtonDisabled,onClick:E,children:w}),r.required===!1&&y("button",{className:U.SkipButton,onClick:S=>E(S,!0),children:ta(r)})]})]});return y("div",{className:q([e,"ul-card__consent-legal",U.FadeInTransition]),children:[y(ze,{message:t}),y("div",{className:"ul-rich-text-body",dangerouslySetInnerHTML:r&&r.richTextBody?{__html:r&&r.richTextBody}:void 0,id:"ul-card__consent-legal-body-container"}),y(xt,{properties:r,defaultBody:C,embeddedType:"pdf"})]},i)},vm=({activeValue:e,border:t,icon:n,isPressed:r,onSubmit:i,range:o,scaleLabelType:a,setActiveValue:s,setIsPressed:l,useMobileStyling:u,value:c})=>{const d=`option-${c}`,f=a===At.Number,p=a===At.Star,h=f&&c===e,[v,g]=(()=>c<=e&&p||c===e?r?[t,1]:[t,.3]:["",1])(),w=()=>{switch(a){case At.Star:return q([...ie(U.LikertStar,u),...ie(`${U.LikertStar}-${c}`,u)]);case At.Smiley:return q([...ie(U.LikertSmiley,u),...ie(`${U.LikertSmiley}-${c}`,u)]);default:return q(c===o?[...ie(U.LikertNumber,u),...ie(`${U.LikertNumber}-${c}`,u),...ie("likert-last-option",u)]:[...ie(U.LikertNumber,u),...ie(`${U.LikertNumber}-${c}`,u)])}},_=()=>{s(-1),l(!1)};return y("div",{"aria-label":f?void 0:String(c),className:w(),dangerouslySetInnerHTML:{__html:n},id:d,onClick:()=>i(),onPointerDown:()=>l(!0),onPointerEnter:()=>s(c),onPointerLeave:_,role:"radio",style:{color:f?"":v,borderColor:h?v:"",fillOpacity:h?"":g,zIndex:h?3:"auto"},tabIndex:0})},mm=({className:e,labels:t,message:n,next:r,properties:i,questionId:o,type:a})=>{const{border:s,useMobileStyling:l}=ee(C=>({border:C.border,useMobileStyling:C.useMobileStyling})),[u,c]=de(-1),[d,f]=de(!1),p=t&&t.left,h=t&&t.right;let v;const{range:g,scaleLabelType:w,ratingIcons:_}=i;g&&(v=Number(g));const b=v||5,E=C=>{var S,L;switch(w){case At.Star:return(S=_[0])==null?void 0:S.svg;case At.Smiley:return(L=_[C])==null?void 0:L.svg;default:return String(C+1)}},m=[...Array(b)].map((C,S)=>{const L=S+1;return y(vm,{activeValue:u,border:s,icon:E(S),isPressed:d,onSubmit:()=>r({value:L,questionId:o,type:a}),range:b,scaleLabelType:w,setActiveValue:c,setIsPressed:f,useMobileStyling:l,value:L},S)}),x=C=>{C.preventDefault(),C.stopPropagation(),r({value:null,questionId:o,type:a})},I=()=>y(Ae,{children:[y("div",{"aria-label":`Rating (1 - ${b})`,className:"ul-card--likert__numbers",role:"radiogroup",children:m}),y("div",{className:"ul-card--likert__labels",children:[y("span",{children:p}),y("span",{children:h})]}),!i.required&&y("div",{className:"ul-vertical-centered-container",children:y(xe,{onClick:x,children:hn(i)})})]});return y("form",{className:q([e,"ul-card--likert",U.FadeInTransition]),children:[y(ze,{message:n,properties:i}),y(xt,{properties:i,defaultBody:I})]},o)},Zu=({className:e,message:t,onSubmit:n,options:r=[],properties:i,questionId:o,type:a})=>{const{border:s,useMobileStyling:l}=ee(m=>({border:m.border,useMobileStyling:m.useMobileStyling})),u=r.reduce((m,x)=>(m[x.id]={isSelected:!1},m),{}),[c,d]=de(u),f=a===T.MultipleChoice,p=i.required,h=Object.entries(c).some(([m,x])=>{var S;const I=r.find(L=>`${L.id}`===m),C=x.userText===void 0||x.userText.trim()==="";return((S=I==null?void 0:I.optionProperties)==null?void 0:S.allowsTextEntry)&&C&&x.isSelected}),v=Object.values(c).some(m=>m.isSelected),g=h||p&&!v,w=r.map(({id:m,label:x,value:I,optionProperties:C},S)=>{var k,P;const L=`${m}`,{allowsTextEntry:D}=C||{allowsTextEntry:!1};return y(Yu,{allowTextEntry:D,border:s,error:!1,id:L,index:S,isRadio:f,isSelected:!!((k=c[L])!=null&&k.isSelected),label:x,onUserInputChanged:R=>b(R.id,R.selected,R.userText),promptText:"Please specify",text:(P=c[m])==null?void 0:P.userText,useMobileStyling:l,value:I},L)}),_=m=>{m.preventDefault(),m.stopPropagation(),n(c)},b=(m,x,I)=>{const C=Object.assign({},c);if(f&&x)for(const S of Object.values(C))S.isSelected=!1,delete S.userText;C[m]={isSelected:x,userText:I},d(C)},E=()=>y("div",{children:[y("div",{className:q(ie(U.ChoiceGroup,l)),role:f?"radiogroup":"group",children:w}),y("div",{className:"ul-card__button-wrapper",children:y(xe,{disabled:g,onClick:_,children:hn(i)})})]});return y("form",{className:q([e,"ul-card--multiple",U.FadeInTransition]),id:"text-form",onSubmit:_,children:[y(ze,{message:t,properties:i}),y(xt,{properties:i,defaultBody:E})]},o)},gm=e=>{const{questionId:t,type:n,next:r,options:i}=e;return y(Zu,{...e,onSubmit:a=>{const s=Object.entries(a).find(([,f])=>f.isSelected)||[void 0,void 0],[l,u]=s,c=i.find(f=>`${f.id}`===l),d=u!=null&&u.userText?{[l]:{userText:u.userText}}:null;r({value:c&&l?{[l]:c.value}:{},secondaryValue:d,questionId:t,type:n})}})},ym=e=>{const{questionId:t,type:n,next:r}=e;return y(Zu,{...e,onSubmit:o=>{const a={},s=Object.entries(o).reduce((u,[c,d])=>(u[c]=d.isSelected,u),a),l=Object.entries(o).reduce((u,[c,d])=>{if(!d.userText)return u;const f=u||{};return f[c]={userText:d.userText},f},null);r({value:s,secondaryValue:l,questionId:t,type:n})}})},_m=({className:e,props:{labels:t,message:n,properties:r},next:i,questionId:o,type:a})=>{const{border:s,useMobileStyling:l}=ee(h=>({border:h.border,useMobileStyling:h.useMobileStyling})),u=t&&t.left,c=t&&t.right,d=[...Array(11)].map((h,v)=>y("div",{className:q([...ie(U.NPSNumber,l),...ie(`${U.NPSNumber}-${v}`,l)]),id:`option-${v}`,onClick:()=>i({value:v,questionId:o,type:a}),onKeyPress:g=>{g.preventDefault(),(g.key==="Enter"||g.key===" ")&&i({value:v,questionId:o,type:a})},onPointerDown:g=>{Jt(g.target)&&(g.target.style.zIndex="2",g.target.style.borderColor=s)},onPointerLeave:g=>{Jt(g.target)&&(g.target.style.zIndex="auto",g.target.style.borderColor=To)},role:"radio",tabIndex:0,children:v},v)),f=h=>{h.preventDefault(),h.stopPropagation(),i({value:null,questionId:o,type:a})},p=()=>y("div",{children:[y("div",{className:"ul-card--nps__numbers",children:d}),y("div",{className:"ul-card--nps__labels",children:[y("span",{children:u}),y("span",{children:c})]}),!r.required&&y("div",{className:"ul-vertical-centered-container",children:y(xe,{onClick:f,children:hn(r)})})]});return y("form",{className:q([e,"ul-card--nps",U.FadeInTransition]),children:[y(ze,{message:n,properties:r}),y(xt,{properties:r,defaultBody:p})]},o)},wm=({className:e,message:t,next:n,properties:r,questionId:i,type:o})=>{const{border:a,useMobileStyling:s,update:l}=ee(m=>({border:m.border,useMobileStyling:m.useMobileStyling,update:m.update})),[u,c]=de(""),d=wt(null),f=u.trim(),p=r.required===!0&&!f,h=Wu(d,()=>l()),v=m=>{h(),m.preventDefault(),m.stopPropagation(),xn(m.target)&&c(m.target.value)},g=m=>{m.preventDefault(),m.stopPropagation(),n({value:u,questionId:i,type:o})},w=r&&r.openTextPlaceholder?r.openTextPlaceholder:"",_=m=>{xn(m.target)&&(m.target.style.borderColor=a)},b=m=>{xn(m.target)&&(m.target.style.borderColor=To)},E=()=>y("div",{className:"ul-card-text",children:[y("div",{className:"ul-card-text__container",children:y("textarea",{"aria-label":w,"aria-labelledby":U.QuestionHeader,"aria-multiline":"true","aria-placeholder":w,className:q(ie(U.OpenTextInput,s)),"data-gramm":"false",maxLength:5e3,name:"text",onBlur:b,onChange:v,onFocus:_,placeholder:w,ref:d,role:"textbox",tabIndex:0})}),y(xe,{disabled:p,onClick:g,style:{backgroundColor:p?"":a},children:hn(r)})]});return y("form",{className:q([e,"ul-card--text",U.FadeInTransition]),id:"text-form",children:[y(ze,{message:t,properties:r}),y(xt,{defaultBody:E,properties:r})]},i)};var vt=(e=>(e[e.RequestNeeded=1]="RequestNeeded",e[e.TryAgain=2]="TryAgain",e[e.Ready=3]="Ready",e))(vt||{});const Yr=e=>e.type===ke.AvPermission,Xu=e=>e.type===ke.ScreenPermission,bm=(e,t)=>!(Yr(t)?t.permissionDescriptors:[]).includes(nn.Camera)||e.getVideoTracks().length>0,Ju=(e,t)=>{if(e===void 0)return vt.RequestNeeded;if(e){if(!bm(e,t))return vt.RequestNeeded}else return vt.TryAgain;return vt.Ready},Ss={avStream:null,currentPage:null,mediaRecordingUids:null,nextQuestion:()=>{},passthroughData:void 0,recordingMediaTypes:void 0,screenPermissionRequested:!1,type:void 0},$e=$u(e=>({...Ss,reset:()=>{e(Ss)},updatePage:t=>{e(t)}}));function so({currentPage:e,pages:t}){const{avStream:n,recordingMediaTypes:r,updatePage:i}=$e.getState(),{recorderEventEmitter:o}=ee.getState();o.emit(pe.AvPermission,{[K.PermissionDescriptors]:e.permissionDescriptors,[K.StreamReadyCallback]:(a,s)=>{if(n===a)return;let l=e;if(a&&!e.permissionDescriptors.includes(nn.Camera)){const u=t.indexOf(e),c=s!=null&&s.active?u+2:u+1;(s==null?void 0:s.active)&&r&&o.emit(pe.BeginRecording,{[K.RecordingMediaTypes]:r,[K.StartRecordingCallback]:d=>i({mediaRecordingUids:d})}),l=t[c]}i({currentPage:l,avStream:a})}})}function Em({pages:e,userId:t,responseGroupUid:n,surveyId:r,questionId:i,next:o}){const{updatePage:a}=$e.getState(),{eventEmitFn:s,recorderEventEmitter:l}=ee.getState(),u={questionId:i,surveyId:r,visitorId:t,responseGroupUid:n};let c=0;l.emit(Re.RecordedTaskPermissionScreen),s(Re.RecordedTaskPermissionScreen),l.emit(pe.PermissionStatus,{[K.PermissionStatusCallback]:(f,p,h,v)=>{const g=e[c],{type:w}=g,_=[De.Screen];if(Yr(g)){const{permissionDescriptors:b}=g,E=b==null?void 0:b.includes(nn.Microphone),m=b==null?void 0:b.includes(nn.Camera);E&&_.push(De.Audio),m&&_.push(De.Video);const x=(f==null?void 0:f.active)&&!m,I=(f==null?void 0:f.active)&&p;(x||I)&&c++}Xu(e[c])&&h&&(c++,l.emit(pe.BeginRecording,{[K.RecordingMediaTypes]:_,[K.StartRecordingCallback]:b=>a({mediaRecordingUids:b})})),a({currentPage:e[c],avStream:f,screenPermissionRequested:h,nextQuestion:o,type:w,passthroughData:u,recordingMediaTypes:_,captureStream:v})}});const d=e[c];return d.type===ke.AvPermission&&so({currentPage:d,pages:e}),d}function lo({status:e}){const{nextQuestion:t,passthroughData:n,mediaRecordingUids:r,reset:i}=$e.getState(),{recorderEventEmitter:o,handleUploadUpdate:a,index:s}=ee.getState(),l={value:{taskStatus:e},type:T.RecordedTask,questionId:(n==null?void 0:n.questionId)||1};!n||o.emit(pe.FinishTask,{[K.BeginCallback]:u=>{a({mediaRecordingUid:u,isSubmitted:!0,progressPct:0,isComplete:!1})},[K.ProgressCallback]:(u,c)=>{a({mediaRecordingUid:u,progressPct:c.detail,isSubmitted:!1,isComplete:!1})},[K.UploadCallback]:u=>{u&&a({mediaRecordingUid:u,isComplete:!0,isSubmitted:!0,progressPct:100})},[K.PassthroughData]:n,[K.CurrentIndex]:s,[K.TaskResponse]:l,[K.TaskCompleteCallback]:u=>{l.value.taskDurationMillisecond=u,r&&(l.value.mediaRecordingUids=r),i(),t(l)}})}function na({pages:e,setIsRequestingPermission:t}){const{recorderEventEmitter:n,eventEmitFn:r}=ee.getState(),{updatePage:i,currentPage:o,recordingMediaTypes:a,screenPermissionRequested:s}=$e.getState();if(!o)return;const l=e.indexOf(o);switch(o.type){case ke.AvPermission:{const u=s?l+2:l+1;s&&a&&n.emit(pe.BeginRecording,{[K.RecordingMediaTypes]:a,[K.StartRecordingCallback]:c=>{i({mediaRecordingUids:c})}}),i({currentPage:e[u]});return}case ke.ScreenPermission:n.emit(pe.ScreenPermission,{[K.ScreenPermissionRequested]:t,[K.StreamReadyCallback]:(u,c)=>{const d=c?e[l+1]:o;c&&a&&n.emit(pe.BeginRecording,{[K.RecordingMediaTypes]:a,[K.StartRecordingCallback]:f=>{i({captureStream:c,mediaRecordingUids:f})}}),i({currentPage:d,screenPermissionRequested:!0,captureStream:c})}});return;case ke.StartTask:r(Re.RecordedTaskStart),n.emit(Re.RecordedTaskStart),n.emit(pe.StartTask),i({currentPage:e[l+1],screenPermissionRequested:!0});return;case ke.CompleteTask:return}}const ec="ul-permission-graphics-container",tc="ul-permission-body",nc=q([ec,"ul_recorded-task-inset-spacing"]),Qr=q(["ul-horizontal-button-container","ul-horizontal-button-container-left"]),rc=({richTextBody:e})=>y("div",{className:"ul-rich-text-body",dangerouslySetInnerHTML:{__html:e},id:"ul-task-detail-container"}),Zr=({required:e,skipButtonText:t,bottom:n=!1})=>e?null:y(xe,{className:q([n&&"ul-skip-button-below",U.InactiveButton]),onClick:lo.bind(null,{status:Te.Abandoned}),children:t||"Skip"}),ra=e=>{const{avStream:t,captureStream:n,recordingMediaTypes:r,updatePage:i}=$e.getState(),o=(r==null?void 0:r.includes(De.Audio))||(r==null?void 0:r.includes(De.Video));Le(()=>{const a=setInterval(()=>{o&&t&&!t.active?i({avStream:null,currentPage:e[0]}):(!n||!n.active)&&i({captureStream:void 0,currentPage:e[o?1:0]})},1e3);return()=>clearInterval(a)},[t,n,o,e,r,i])},xm=({content:e,pages:t,required:n})=>{const{buttonText:r,skipButtonText:i,taskDetail:o}=e;return ra(t),y("div",{className:"ul-task-page",children:[y(rc,{richTextBody:o}),y("div",{className:Qr,children:[y(xe,{onClick:na.bind(null,{pages:t}),children:r}),y(Zr,{required:n,skipButtonText:i})]})]},"start-task")},Sm=({content:e,pages:t,properties:n})=>{const{buttonText:r,skipButtonText:i}=e;ra(t);const a=y(xt,{properties:n,defaultBody:()=>y("div",{className:Qr,children:[y(xe,{className:"ul-complete-task-button",onClick:lo.bind(null,{status:Te.Completed}),children:r}),y(xe,{className:q([U.InactiveButton]),onClick:lo.bind(null,{status:Te.GivenUp}),children:i})]})});return y("div",{className:"ul-task-page",children:[y(rc,{richTextBody:e.taskDetail}),a]},"complete-task")},Cm=({content:e,pages:t,required:n})=>{const{buttonText:r,skipButtonText:i}=e,[o]=ee(l=>[l.tabTitle]),[a,s]=de(!1);return y("div",{children:[y("div",{className:nc,children:[y("p",{style:{marginTop:"auto"},children:e.selectTabText}),y("div",{className:"ul-select-tab-container",children:y("p",{className:tc,children:o})})]}),y("div",{className:n?"":Qr,children:[y(xe,{disabled:a,onClick:na.bind(null,{pages:t,setIsRequestingPermission:s}),children:r}),y(Zr,{required:n,skipButtonText:i})]})]})},Im=({content:e})=>y("div",{className:q([ec,"ul_permission_svg_container","ul_recorded-task-inset-spacing","ul-center-horizontally"]),dangerouslySetInnerHTML:{__html:e.svg}},"ul-permission-request-graphic"),km=({content:e,pages:t,required:n})=>{const{permissionDeniedHeadline:r,permissionDeniedBody:i,skipButtonText:o,tryAgainButtonText:a}=e,s=Yr(t[0])?t[0]:null;return Le(()=>{const l=setInterval(()=>{s!==null&&so({currentPage:s,pages:t})},1e3);return()=>clearInterval(l)},[s,t]),s?y("div",{children:[y("div",{className:nc,children:y("p",{className:"ul-av-permission-denied-paragraph",children:[y("span",{className:"ul-av-permission-denied-headline",children:r}),y("span",{className:tc,children:i})]})}),y("div",{className:Qr,children:[y(xe,{onClick:so.bind(null,{currentPage:s,pages:t}),children:a}),y(Zr,{required:n,skipButtonText:o})]})]}):null},Tm=({stream:e})=>y("video",{autoPlay:!0,className:q(["ul_recorded-task-inset-spacing"]),id:"ul-record-task-video-preview",muted:!0,ref:t=>{t&&(t.srcObject=e||null)}}),Lm=({content:e,pages:t,required:n})=>{const{skipButtonText:r}=e,{avStream:i}=$e.getState();return ra(t),y("div",{children:[y(Tm,{stream:i}),y("div",{className:"ul-vertical-button-container-center",children:[y(xe,{onClick:na.bind(null,{pages:t}),children:e.buttonText}),y(Zr,{bottom:!0,required:n,skipButtonText:r})]})]})},Rm=({properties:e})=>{const{pages:t,required:n}=e,{avStream:r,currentPage:i}=$e.getState();if(i===void 0)return null;switch(i==null?void 0:i.type){case ke.AvPermission:{const o=Ju(r,i);return o===vt.RequestNeeded?y(Im,{content:i}):o===vt.TryAgain?y(km,{content:i,pages:t,required:n}):y(Lm,{content:i,pages:t,required:n})}case ke.ScreenPermission:return y(Cm,{content:i,pages:t,required:n});case ke.StartTask:return y(xm,{content:i,pages:t,required:n});case ke.CompleteTask:return y(Sm,{content:i,pages:t,properties:e});default:return null}},Am=({className:e,properties:t,next:n,questionId:r})=>{const i=ee(),{surveyId:o,responseGroupUid:a,userId:s}=i,l=$e(),{screenPermissionRequested:u}=l,c=$e(v=>v.avStream);let d=$e(v=>v.currentPage);d||(d=Em({questionId:r,surveyId:o,next:v=>{n(v)},pages:t.pages,responseGroupUid:a,userId:s}));let f=d.headline,p=d.captionText;const h=Ju(c,d);return Xu(d)&&u&&(f=d.permissionDeniedHeadline,p=d.permissionDeniedCaptionText),Yr(d)&&h===vt.Ready&&(f=d.permissionGrantedHeadline,p=d.permissionGrantedCaptionText),y("div",{className:q([e,"ul-center-horizontally",U.FadeInTransition]),children:[y(ze,{message:f,properties:{captionText:p}}),y(Rm,{properties:t})]})},Um={"{{user_id}}":"externalUserId","{{email}}":"email"},Om=(e=void 0,t={})=>{if(!e)return e;let n=e;const r=[];for(const[l,u]of Object.entries(Um))if(n.toLowerCase().includes(l))if(t[u]){const c=new RegExp(l,"gi");n=n.replace(c,t[u])}else r.push(l);if(r.length===0||!n.includes("?"))return n;const i=n.slice(0,n.indexOf("?")),a=n.slice(n.indexOf("?")+1).split("&").map(l=>l.split("=")).filter(l=>!r.includes(l[1]));if(a.length===0)return i;const s=a.map(l=>l.join("=")).join("&");return`${i}?${s}`},Dm=({className:e,message:t,next:n,properties:r,questionId:i,type:o})=>{const{visitorAttributes:a}=ee(d=>({visitorAttributes:d.visitorAttributes})),s=(d,f=!1)=>{n({value:f?{skipped:!0}:void 0,questionId:i,type:o})},l=d=>{(d.key==="Enter"||d.key===" ")&&n({value:void 0,questionId:i,type:o})},u=()=>y("div",{className:"ul-card-button-group",children:[y("a",{className:"ul-card-text__button ul-card__text-url-prompt-button",href:Om(r&&r.buttonUrl,a),id:"ul-card-text__button",onClick:s,onKeyPress:l,rel:"noreferrer",role:"button",tabIndex:0,target:"_blank",children:hn(r)}),r.required===!1&&y("button",{className:U.SkipButton,onClick:d=>s(d,!0),children:ta(r)})]}),c=(d,f)=>d?y("div",{className:"ul-rich-text-body",dangerouslySetInnerHTML:{__html:d},id:"ul-card__text-url-body-container"}):y("div",{className:"ul-rich-text-body",id:"ul-card__text-url-body-container",children:(f?f.split(/\n\s*\n/g):[]).map((p,h)=>y("p",{children:p},h))});return y("div",{className:q([e,"ul-card__text-url-prompt",U.FadeInTransition]),children:[y(ze,{message:t}),c(r&&r.richTextBody,r&&r.body),y(xt,{defaultBody:u,properties:r})]},i)},Pm=({className:e,questionId:t})=>{const{border:n,destroy:r,endCard:i,forceBrandedLogo:o}=ee(l=>({border:l.border,destroy:l.destroy,endCard:l.endCard,forceBrandedLogo:l.forceBrandedLogo}));Le(()=>{setTimeout(()=>{r(zt)},o?4e3:2e3)},[r,o]);const a=i&&i.subheader?y("p",{className:U.Caption,children:i.subheader}):null,s=i&&i.headline?i.headline:"";return y("div",{className:q([e,"ul-card--thanks",U.FadeInTransition]),children:y("div",{children:y("div",{className:"ul-card--thanks-content",children:[y("div",{className:"ul-thanks-check",children:y("svg",{"aria-labelledby":"title",fill:"none",height:"99",viewBox:"0 0 81 99",width:"81",xmlns:"http://www.w3.org/2000/svg",children:[y("path",{clipRule:"evenodd",d:"M40.5 77C60.9345 77 77.5 60.4345 77.5 40C77.5 19.5655 60.9345 3 40.5 3C20.0655 3 3.5 19.5655 3.5 40C3.5 60.4345 20.0655 77 40.5 77ZM80.5 40C80.5 62.0914 62.5914 80 40.5 80C18.4086 80 0.5 62.0914 0.5 40C0.5 17.9086 18.4086 0 40.5 0C62.5914 0 80.5 17.9086 80.5 40Z",fill:n,fillRule:"evenodd"}),y("path",{clipRule:"evenodd",d:"M55.025 22.9046C55.6299 23.4705 55.6616 24.4198 55.0956 25.0247C54.8724 25.2634 54.6109 25.5285 54.3157 25.8277C52.2547 27.9168 48.5549 31.667 44.8135 39.6658C43.2818 42.9406 42.0864 45.8386 41.0823 48.2729C40.6539 49.3116 40.2603 50.2659 39.8902 51.129C39.287 52.5359 38.7248 53.7508 38.1744 54.625C37.8997 55.0613 37.5806 55.4905 37.2017 55.8245C36.8201 56.1607 36.2613 56.5 35.5457 56.5C34.6742 56.5 34.0892 55.9692 33.7774 55.6083C33.4502 55.2296 33.1752 54.7511 32.9396 54.301C32.7305 53.9013 32.5088 53.4367 32.2797 52.9565C32.2429 52.8794 32.2059 52.8019 32.1688 52.7243C31.8942 52.1499 31.5959 51.534 31.2537 50.8868C29.8886 48.305 27.8539 45.2878 24.2343 43.1382C23.522 42.7152 23.2875 41.7949 23.7105 41.0826C24.1335 40.3703 25.0539 40.1358 25.7662 40.5588C30.0556 43.1062 32.4149 46.6647 33.9058 49.4845C34.2776 50.1876 34.5973 50.8487 34.8753 51.4302C34.9147 51.5124 34.9529 51.5926 34.9902 51.6707C35.2222 52.1567 35.4164 52.5637 35.5978 52.9102C35.6151 52.9434 35.6321 52.9754 35.6485 53.0061C36.0565 52.3531 36.5341 51.3434 37.133 49.9468C37.4781 49.1418 37.8572 48.2229 38.2761 47.2074C39.2886 44.7532 40.5339 41.7347 42.0961 38.3948C46.0591 29.9221 50.0641 25.8648 52.1535 23.7482C52.4423 23.4556 52.6944 23.2002 52.9048 22.9753C53.4708 22.3703 54.42 22.3387 55.025 22.9046ZM35.1994 53.5892C35.1994 53.5892 35.2 53.5888 35.2012 53.5879C35.2 53.5889 35.1994 53.5893 35.1994 53.5892ZM36.0666 53.6682C36.0732 53.674 36.0765 53.6775 36.0765 53.6777C36.0765 53.678 36.0732 53.6751 36.0666 53.6682Z",fill:n,fillRule:"evenodd"}),y("path",{d:"M69.5 97C69.5 98.1046 56.2924 99 40 99C23.7076 99 10.5 98.1046 10.5 97C10.5 95.8954 23.7076 95 40 95C56.2924 95 69.5 95.8954 69.5 97Z",fill:"black",fillOpacity:"0.2"})]})}),y(ze,{message:s}),a]})})},t)},Tt="https://cdn.sprig.com",M={document:void 0,videojs:void 0},Nm=`/* progress control styles */
46
+ `,Gt=e=>(e==null?void 0:e.buttonText)||"Next",sa=e=>(e==null?void 0:e.skipButtonText)||"Skip",zm=({className:e,message:t,next:n,properties:r,questionId:i,type:o})=>{const{useMobileStyling:a,border:s}=X(I=>({useMobileStyling:I.useMobileStyling,border:I.border})),[l,u]=le(!1),[c,d]=le(""),[f,p]=le(!1),v=r==null?void 0:r.collectName,h=(r==null?void 0:r.nameLabelText)||"Full Name",g=(r==null?void 0:r.consentText)||"I agree to the stated conditions",_=(r==null?void 0:r.submitButtonText)||"Submit",w=!!c.trim(),E=l&&(!v||w),b=(I,R=!1)=>{I.preventDefault(),I.stopPropagation();let O=null;if(!R){if(!E){p(!0);return}O={submitted:!0},v&&(O.name=c)}n({value:O,questionId:i,type:o})},m=I=>{I.preventDefault(),I.stopPropagation(),d(I.currentTarget.value)},x=I=>{I.currentTarget.style.borderColor=f&&!w?Sn:s},k=I=>{I.currentTarget.style.borderColor=f&&!w?Sn:Oo},S=()=>y("div",{children:[y(aa,{allowTextEntry:!1,border:s,error:f&&!l,isRadio:!1,isSelected:l,label:g,onUserInputChanged:({selected:I})=>{I!==l&&u(!l)},useMobileStyling:a}),v&&y("input",{"aria-label":h,"aria-placeholder":h,className:H(oe(U.ConsentLegalNameInput,a)),"data-gramm":"false",maxLength:250,name:"name",onBlur:k,onFocus:x,onInput:m,placeholder:h,style:f&&!w?{borderColor:Sn}:{},tabIndex:0,value:c}),y("div",{className:"ul-card__button-wrapper ul-card-vertical__button-wrapper",children:[y(ye,{className:E?"":U.ButtonDisabled,onClick:b,children:_}),r.required===!1&&y("button",{className:U.SkipButton,onClick:I=>b(I,!0),children:sa(r)})]})]});return y("div",{className:H([e,"ul-card__consent-legal",U.FadeInTransition]),children:[y(Be,{message:t}),y("div",{className:"ul-rich-text-body",dangerouslySetInnerHTML:r&&r.richTextBody?{__html:r&&r.richTextBody}:void 0,id:"ul-card__consent-legal-body-container"}),y(ct,{properties:r,defaultBody:S,embeddedType:"pdf"})]},i)},Wm=({activeValue:e,border:t,icon:n,isPressed:r,onSubmit:i,range:o,scaleLabelType:a,setActiveValue:s,setIsPressed:l,useMobileStyling:u,value:c})=>{const d=`option-${c}`,f=a===Ot.Number,p=a===Ot.Star,v=f&&c===e,[h,g]=(()=>c<=e&&p||c===e?r?[t,1]:[t,.3]:["",1])(),_=()=>{switch(a){case Ot.Star:return H([...oe(U.LikertStar,u),...oe(`${U.LikertStar}-${c}`,u)]);case Ot.Smiley:return H([...oe(U.LikertSmiley,u),...oe(`${U.LikertSmiley}-${c}`,u)]);default:return H(c===o?[...oe(U.LikertNumber,u),...oe(`${U.LikertNumber}-${c}`,u),...oe("likert-last-option",u)]:[...oe(U.LikertNumber,u),...oe(`${U.LikertNumber}-${c}`,u)])}},w=()=>{s(-1),l(!1)};return y("div",{"aria-label":f?void 0:String(c),className:_(),dangerouslySetInnerHTML:{__html:n},id:d,onClick:()=>i(),onPointerDown:()=>l(!0),onPointerEnter:()=>s(c),onPointerLeave:w,role:"radio",style:{color:f?"":h,borderColor:v?h:"",fillOpacity:v?"":g,zIndex:v?3:"auto"},tabIndex:0})},Ym=({className:e,labels:t,message:n,next:r,properties:i,questionId:o,type:a})=>{const{border:s,useMobileStyling:l}=X(S=>({border:S.border,useMobileStyling:S.useMobileStyling})),[u,c]=le(-1),[d,f]=le(!1),p=t&&t.left,v=t&&t.right;let h;const{range:g,scaleLabelType:_,ratingIcons:w}=i;g&&(h=Number(g));const E=h||5,b=S=>{var I,R;switch(_){case Ot.Star:return(I=w[0])==null?void 0:I.svg;case Ot.Smiley:return(R=w[S])==null?void 0:R.svg;default:return String(S+1)}},m=[...Array(E)].map((S,I)=>{const R=I+1;return y(Wm,{activeValue:u,border:s,icon:b(I),isPressed:d,onSubmit:()=>r({value:R,questionId:o,type:a}),range:E,scaleLabelType:_,setActiveValue:c,setIsPressed:f,useMobileStyling:l,value:R},I)}),x=S=>{S.preventDefault(),S.stopPropagation(),r({value:null,questionId:o,type:a})},k=()=>y(Ce,{children:[y("div",{"aria-label":`Rating (1 - ${E})`,className:"ul-card--likert__numbers",role:"radiogroup",children:m}),y("div",{className:"ul-card--likert__labels",children:[y("span",{children:p}),y("span",{children:v})]}),!i.required&&y("div",{className:"ul-vertical-centered-container",children:y(ye,{onClick:x,children:Gt(i)})})]});return y("form",{className:H([e,"ul-card--likert",U.FadeInTransition]),children:[y(Be,{message:n,properties:i}),y(ct,{properties:i,defaultBody:k})]},o)},Qm=({className:e,message:t,next:n,options:r,properties:i,questionId:o,type:a})=>{const{border:s,useMobileStyling:l}=X(m=>({border:m.border,useMobileStyling:m.useMobileStyling})),u=i.matrixColumn,c=r.length,d=u.length,f=i.required,p=m=>{m.preventDefault(),m.stopPropagation(),n({value:h,questionId:o,type:a})},v=r.reduce((m,x)=>(m[x.id]=null,m),{}),[h,g]=le(v),_=(m,x)=>{g(k=>({...k,[m]:x}))},w=f&&Object.values(h).every(m=>m==null),E=r.map(m=>y(Ce,{children:[y("div",{"aria-label":m.label,className:"ul-matrix-row-label",children:m.label},m.label),y("div",{className:"ul-matrix-row-options",role:"radiogroup",children:u.map((x,k)=>{const S=k===d-1;return y("div",{className:H("ul-matrix-option-wrapper",S&&"ul-matrix-last-option"),children:y(aa,{allowTextEntry:!1,ariaLabel:`${m.label}-${x.label}`,border:s,choiceStyle:{background:"transparent",border:"none",marginBottom:"0",padding:"0"},error:!1,id:`${m.id}-${x.value}`,isRadio:!0,isSelected:h[m.id]===x.value,onUserInputChanged:()=>_(m.id,x.value),useMobileStyling:l})},x.value)})})]})),b=()=>y("div",{children:[y("div",{className:"ul-card--matrix_container",style:`--maxWidth: ${al()-74}px`,children:y("div",{className:"ul-card--matrix_grid",style:`--numColumns: ${d}; --numRows: ${c+1}`,children:[y("div",{})," ",u.map(m=>y("div",{className:"ul-matrix-column-label",children:m.label},m.label)),E]})}),y("div",{className:"ul-card__button-wrapper",children:y(ye,{disabled:w,children:Gt(i)})})]});return y("form",{className:H([e,U.FadeInTransition]),id:"text-form",onSubmit:p,children:[y(Be,{message:t,properties:i}),y(ct,{properties:i,defaultBody:b})]},o)},hc=({className:e,message:t,onSubmit:n,options:r=[],properties:i,questionId:o,type:a})=>{const{border:s,useMobileStyling:l}=X(m=>({border:m.border,useMobileStyling:m.useMobileStyling})),u=r.reduce((m,x)=>(m[x.id]={isSelected:!1},m),{}),[c,d]=le(u),f=a===L.MultipleChoice,p=i.required,v=Object.entries(c).some(([m,x])=>{var I;const k=r.find(R=>`${R.id}`===m),S=x.userText===void 0||x.userText.trim()==="";return((I=k==null?void 0:k.optionProperties)==null?void 0:I.allowsTextEntry)&&S&&x.isSelected}),h=Object.values(c).some(m=>m.isSelected),g=v||p&&!h,_=r.map(({id:m,label:x,value:k,optionProperties:S})=>{var O,T;const I=`${m}`,{allowsTextEntry:R}=S||{allowsTextEntry:!1};return y(aa,{allowTextEntry:R,border:s,error:!1,id:I,isRadio:f,isSelected:!!((O=c[I])!=null&&O.isSelected),label:x,onUserInputChanged:D=>E(D.id,D.selected,D.userText),promptText:"Please specify",text:(T=c[m])==null?void 0:T.userText,useMobileStyling:l,value:k},I)}),w=m=>{m.preventDefault(),m.stopPropagation(),n(c)},E=(m,x,k)=>{const S=Object.assign({},c);if(f&&x)for(const I of Object.values(S))I.isSelected=!1,delete I.userText;S[m]={isSelected:x,userText:k},d(S)},b=()=>y("div",{children:[y("div",{className:H(oe(U.ChoiceGroup,l)),role:f?"radiogroup":"group",children:_}),y("div",{className:"ul-card__button-wrapper",children:y(ye,{disabled:g,onClick:w,children:Gt(i)})})]});return y("form",{className:H([e,"ul-card--multiple",U.FadeInTransition]),id:"text-form",onSubmit:w,children:[y(Be,{message:t,properties:i}),y(ct,{properties:i,defaultBody:b})]},o)},Zm=e=>{const{questionId:t,type:n,next:r,options:i}=e;return y(hc,{...e,onSubmit:a=>{const s=Object.entries(a).find(([,f])=>f.isSelected)||[void 0,void 0],[l,u]=s,c=i.find(f=>`${f.id}`===l),d=u!=null&&u.userText?{[l]:{userText:u.userText}}:null;r({value:c&&l?{[l]:c.value}:{},secondaryValue:d,questionId:t,type:n})}})},Xm=e=>{const{questionId:t,type:n,next:r}=e;return y(hc,{...e,onSubmit:o=>{const a={},s=Object.entries(o).reduce((u,[c,d])=>(u[c]=d.isSelected,u),a),l=Object.entries(o).reduce((u,[c,d])=>{if(!d.userText)return u;const f=u||{};return f[c]={userText:d.userText},f},null);r({value:s,secondaryValue:l,questionId:t,type:n})}})},Jm=({className:e,props:{labels:t,message:n,properties:r},next:i,questionId:o,type:a})=>{const{border:s,useMobileStyling:l}=X(v=>({border:v.border,useMobileStyling:v.useMobileStyling})),u=t&&t.left,c=t&&t.right,d=[...Array(11)].map((v,h)=>y("div",{className:H([...oe(U.NPSNumber,l),...oe(`${U.NPSNumber}-${h}`,l)]),id:`option-${h}`,onClick:()=>i({value:h,questionId:o,type:a}),onKeyPress:g=>{g.preventDefault(),(g.key==="Enter"||g.key===" ")&&i({value:h,questionId:o,type:a})},onPointerDown:g=>{g.currentTarget.style.zIndex="2",g.currentTarget.style.borderColor=s},onPointerLeave:g=>{g.currentTarget.style.zIndex="auto",g.currentTarget.style.borderColor=Oo},role:"radio",tabIndex:0,children:h},h)),f=v=>{v.preventDefault(),v.stopPropagation(),i({value:null,questionId:o,type:a})},p=()=>y("div",{children:[y("div",{className:"ul-card--nps__numbers",children:d}),y("div",{className:"ul-card--nps__labels",children:[y("span",{children:u}),y("span",{children:c})]}),!r.required&&y("div",{className:"ul-vertical-centered-container",children:y(ye,{onClick:f,children:Gt(r)})})]});return y("form",{className:H([e,"ul-card--nps",U.FadeInTransition]),children:[y(Be,{message:n,properties:r}),y(ct,{properties:r,defaultBody:p})]},o)},eg=({className:e,message:t,next:n,properties:r,questionId:i,type:o})=>{const{border:a,useMobileStyling:s,update:l}=X(m=>({border:m.border,useMobileStyling:m.useMobileStyling,update:m.update})),[u,c]=le(""),d=xt(null),f=u.trim(),p=r.required===!0&&!f,v=fc(d,()=>l()),h=m=>{v(),m.preventDefault(),m.stopPropagation(),c(m.currentTarget.value)},g=m=>{m.preventDefault(),m.stopPropagation(),n({value:u,questionId:i,type:o})},_=r&&r.openTextPlaceholder?r.openTextPlaceholder:"",w=m=>{m.currentTarget.style.borderColor=a},E=m=>{m.currentTarget.style.borderColor=Oo},b=()=>y("div",{className:"ul-card-text",children:[y("div",{className:"ul-card-text__container",children:y("textarea",{"aria-label":_,"aria-labelledby":U.QuestionHeader,"aria-multiline":"true","aria-placeholder":_,className:H(oe(U.OpenTextInput,s)),"data-gramm":"false",maxLength:5e3,name:"text",onBlur:E,onChange:h,onFocus:w,placeholder:_,ref:d,role:"textbox",tabIndex:0})}),y(ye,{disabled:p,onClick:g,style:{backgroundColor:p?"":a},children:Gt(r)})]});return y("form",{className:H([e,"ul-card--text",U.FadeInTransition]),id:"text-form",children:[y(Be,{message:t,properties:r}),y(ct,{defaultBody:b,properties:r})]},i)};var gt=(e=>(e[e.RequestNeeded=1]="RequestNeeded",e[e.TryAgain=2]="TryAgain",e[e.Ready=3]="Ready",e))(gt||{});const Zr=e=>e.type===Le.AvPermission,vc=e=>e.type===Le.ScreenPermission,tg=(e,t)=>!(Zr(t)?t.permissionDescriptors:[]).includes(an.Camera)||e.getVideoTracks().length>0,mc=(e,t)=>{if(e===void 0)return gt.RequestNeeded;if(e){if(!tg(e,t))return gt.RequestNeeded}else return gt.TryAgain;return gt.Ready},Us={avStream:null,currentPage:null,mediaRecordingUids:null,nextQuestion:()=>{},passthroughData:void 0,recordingMediaTypes:void 0,screenPermissionRequested:!1,type:void 0},Ge=nc(e=>({...Us,reset:()=>{e(Us)},updatePage:t=>{e(t)}}));function po({currentPage:e,pages:t}){const{avStream:n,recordingMediaTypes:r,updatePage:i}=Ge.getState(),{recorderEventEmitter:o}=X.getState();o.emit(fe.AvPermission,{[$.PermissionDescriptors]:e.permissionDescriptors,[$.StreamReadyCallback]:(a,s)=>{if(n===a)return;let l=e;if(a&&!e.permissionDescriptors.includes(an.Camera)){const u=t.indexOf(e),c=s!=null&&s.active?u+2:u+1;(s==null?void 0:s.active)&&r&&o.emit(fe.BeginRecording,{[$.RecordingMediaTypes]:r,[$.StartRecordingCallback]:d=>i({mediaRecordingUids:d})}),l=t[c]}i({currentPage:l,avStream:a})}})}function ng({pages:e,userId:t,responseGroupUid:n,surveyId:r,questionId:i,next:o}){const{updatePage:a}=Ge.getState(),{eventEmitFn:s,recorderEventEmitter:l}=X.getState(),u={questionId:i,surveyId:r,visitorId:t,responseGroupUid:n};let c=0;l.emit(Ue.RecordedTaskPermissionScreen),s(Ue.RecordedTaskPermissionScreen),l.emit(fe.PermissionStatus,{[$.PermissionStatusCallback]:(f,p,v,h)=>{const g=e[c],{type:_}=g,w=[Te.Screen];if(Zr(g)){const{permissionDescriptors:E}=g,b=E==null?void 0:E.includes(an.Microphone),m=E==null?void 0:E.includes(an.Camera);b&&w.push(Te.Audio),m&&w.push(Te.Video);const x=(f==null?void 0:f.active)&&!m,k=(f==null?void 0:f.active)&&p;(x||k)&&c++}vc(e[c])&&v&&(c++,l.emit(fe.BeginRecording,{[$.RecordingMediaTypes]:w,[$.StartRecordingCallback]:E=>a({mediaRecordingUids:E})})),a({currentPage:e[c],avStream:f,screenPermissionRequested:v,nextQuestion:o,type:_,passthroughData:u,recordingMediaTypes:w,captureStream:h})}});const d=e[c];return d.type===Le.AvPermission&&po({currentPage:d,pages:e}),d}function ho({status:e}){const{nextQuestion:t,passthroughData:n,mediaRecordingUids:r,reset:i}=Ge.getState(),{recorderEventEmitter:o,handleUploadUpdate:a,index:s}=X.getState(),l={value:{taskStatus:e},type:L.RecordedTask,questionId:(n==null?void 0:n.questionId)||1};!n||o.emit(fe.FinishTask,{[$.BeginCallback]:u=>{a({mediaRecordingUid:u,isSubmitted:!0,progressPct:0,isComplete:!1})},[$.ProgressCallback]:(u,c)=>{a({mediaRecordingUid:u,progressPct:c.detail,isSubmitted:!1,isComplete:!1})},[$.UploadCallback]:u=>{u&&a({mediaRecordingUid:u,isComplete:!0,isSubmitted:!0,progressPct:100})},[$.PassthroughData]:n,[$.CurrentIndex]:s,[$.TaskResponse]:l,[$.TaskCompleteCallback]:u=>{l.value.taskDurationMillisecond=u,r&&(l.value.mediaRecordingUids=r),i(),t(l)}})}function la({pages:e,setIsRequestingPermission:t}){const{recorderEventEmitter:n,eventEmitFn:r}=X.getState(),{updatePage:i,currentPage:o,recordingMediaTypes:a,screenPermissionRequested:s}=Ge.getState();if(!o)return;const l=e.indexOf(o);switch(o.type){case Le.AvPermission:{const u=s?l+2:l+1;s&&a&&n.emit(fe.BeginRecording,{[$.RecordingMediaTypes]:a,[$.StartRecordingCallback]:c=>{i({mediaRecordingUids:c})}}),i({currentPage:e[u]});return}case Le.ScreenPermission:n.emit(fe.ScreenPermission,{[$.ScreenPermissionRequested]:t,[$.StreamReadyCallback]:(u,c)=>{const d=c?e[l+1]:o;c&&a&&n.emit(fe.BeginRecording,{[$.RecordingMediaTypes]:a,[$.StartRecordingCallback]:f=>{i({captureStream:c,mediaRecordingUids:f})}}),i({currentPage:d,screenPermissionRequested:!0,captureStream:c})}});return;case Le.StartTask:r(Ue.RecordedTaskStart),n.emit(Ue.RecordedTaskStart),n.emit(fe.StartTask),i({currentPage:e[l+1],screenPermissionRequested:!0});return;case Le.CompleteTask:return}}const gc="ul-permission-graphics-container",yc="ul-permission-body",_c=H([gc,"ul_recorded-task-inset-spacing"]),Xr=H(["ul-horizontal-button-container","ul-horizontal-button-container-left"]),wc=({richTextBody:e})=>y("div",{className:"ul-rich-text-body",dangerouslySetInnerHTML:{__html:e},id:"ul-task-detail-container"}),Jr=({required:e,skipButtonText:t,bottom:n=!1})=>e?null:y(ye,{className:H([n&&"ul-skip-button-below",U.InactiveButton]),onClick:ho.bind(null,{status:Re.Abandoned}),children:t||"Skip"}),ua=e=>{const{avStream:t,captureStream:n,recordingMediaTypes:r,updatePage:i}=Ge.getState(),o=(r==null?void 0:r.includes(Te.Audio))||(r==null?void 0:r.includes(Te.Video));Ae(()=>{const a=setInterval(()=>{o&&t&&!t.active?i({avStream:null,currentPage:e[0]}):(!n||!n.active)&&i({captureStream:void 0,currentPage:e[o?1:0]})},1e3);return()=>clearInterval(a)},[t,n,o,e,r,i])},rg=({content:e,pages:t,required:n})=>{const{buttonText:r,skipButtonText:i,taskDetail:o}=e;return ua(t),y("div",{className:"ul-task-page",children:[y(wc,{richTextBody:o}),y("div",{className:Xr,children:[y(ye,{onClick:la.bind(null,{pages:t}),children:r}),y(Jr,{required:n,skipButtonText:i})]})]},"start-task")},ig=({content:e,pages:t,properties:n})=>{const{buttonText:r,skipButtonText:i}=e;ua(t);const a=y(ct,{properties:n,defaultBody:()=>y("div",{className:Xr,children:[y(ye,{className:"ul-complete-task-button",onClick:ho.bind(null,{status:Re.Completed}),children:r}),y(ye,{className:H([U.InactiveButton]),onClick:ho.bind(null,{status:Re.GivenUp}),children:i})]})});return y("div",{className:"ul-task-page",children:[y(wc,{richTextBody:e.taskDetail}),a]},"complete-task")},og=({content:e,pages:t,required:n})=>{const{buttonText:r,skipButtonText:i}=e,[o]=X(l=>[l.tabTitle]),[a,s]=le(!1);return y("div",{children:[y("div",{className:_c,children:[y("p",{style:{marginTop:"auto"},children:e.selectTabText}),y("div",{className:"ul-select-tab-container",children:y("p",{className:yc,children:o})})]}),y("div",{className:n?"":Xr,children:[y(ye,{disabled:a,onClick:la.bind(null,{pages:t,setIsRequestingPermission:s}),children:r}),y(Jr,{required:n,skipButtonText:i})]})]})},ag=({content:e})=>y("div",{className:H([gc,"ul_permission_svg_container","ul_recorded-task-inset-spacing","ul-center-horizontally"]),dangerouslySetInnerHTML:{__html:e.svg}},"ul-permission-request-graphic"),sg=({content:e,pages:t,required:n})=>{const{permissionDeniedHeadline:r,permissionDeniedBody:i,skipButtonText:o,tryAgainButtonText:a}=e,s=Zr(t[0])?t[0]:null;return Ae(()=>{const l=setInterval(()=>{s!==null&&po({currentPage:s,pages:t})},1e3);return()=>clearInterval(l)},[s,t]),s?y("div",{children:[y("div",{className:_c,children:y("p",{className:"ul-av-permission-denied-paragraph",children:[y("span",{className:"ul-av-permission-denied-headline",children:r}),y("span",{className:yc,children:i})]})}),y("div",{className:Xr,children:[y(ye,{onClick:po.bind(null,{currentPage:s,pages:t}),children:a}),y(Jr,{required:n,skipButtonText:o})]})]}):null},lg=({stream:e})=>y("video",{autoPlay:!0,className:H(["ul_recorded-task-inset-spacing"]),id:"ul-record-task-video-preview",muted:!0,ref:t=>{t&&(t.srcObject=e||null)}}),ug=({content:e,pages:t,required:n})=>{const{skipButtonText:r}=e,{avStream:i}=Ge.getState();return ua(t),y("div",{children:[y(lg,{stream:i}),y("div",{className:"ul-vertical-button-container-center",children:[y(ye,{onClick:la.bind(null,{pages:t}),children:e.buttonText}),y(Jr,{bottom:!0,required:n,skipButtonText:r})]})]})},cg=({properties:e})=>{const{pages:t,required:n}=e,{avStream:r,currentPage:i}=Ge.getState();if(i===void 0)return null;switch(i==null?void 0:i.type){case Le.AvPermission:{const o=mc(r,i);return o===gt.RequestNeeded?y(ag,{content:i}):o===gt.TryAgain?y(sg,{content:i,pages:t,required:n}):y(ug,{content:i,pages:t,required:n})}case Le.ScreenPermission:return y(og,{content:i,pages:t,required:n});case Le.StartTask:return y(rg,{content:i,pages:t,required:n});case Le.CompleteTask:return y(ig,{content:i,pages:t,properties:e});default:return null}},dg=({className:e,properties:t,next:n,questionId:r})=>{const i=X(),{surveyId:o,responseGroupUid:a,userId:s}=i,l=Ge(),{screenPermissionRequested:u}=l,c=Ge(h=>h.avStream);let d=Ge(h=>h.currentPage);d||(d=ng({questionId:r,surveyId:o,next:h=>{n(h)},pages:t.pages,responseGroupUid:a,userId:s}));let f=d.headline,p=d.captionText;const v=mc(c,d);return vc(d)&&u&&(f=d.permissionDeniedHeadline,p=d.permissionDeniedCaptionText),Zr(d)&&v===gt.Ready&&(f=d.permissionGrantedHeadline,p=d.permissionGrantedCaptionText),y("div",{className:H([e,"ul-center-horizontally",U.FadeInTransition]),children:[y(Be,{message:f,properties:{captionText:p}}),y(cg,{properties:t})]})},fg={"{{user_id}}":"externalUserId","{{email}}":"email"},pg=(e=void 0,t={})=>{if(!e)return e;let n=e;const r=[];for(const[l,u]of Object.entries(fg))if(n.toLowerCase().includes(l))if(t[u]){const c=new RegExp(l,"gi");n=n.replace(c,t[u])}else r.push(l);if(r.length===0||!n.includes("?"))return n;const i=n.slice(0,n.indexOf("?")),a=n.slice(n.indexOf("?")+1).split("&").map(l=>l.split("=")).filter(l=>!r.includes(l[1]));if(a.length===0)return i;const s=a.map(l=>l.join("=")).join("&");return`${i}?${s}`},hg=({className:e,message:t,next:n,properties:r,questionId:i,type:o})=>{const{visitorAttributes:a}=X(d=>({visitorAttributes:d.visitorAttributes})),s=(d,f=!1)=>{n({value:f?{skipped:!0}:void 0,questionId:i,type:o})},l=d=>{(d.key==="Enter"||d.key===" ")&&n({value:void 0,questionId:i,type:o})},u=()=>{const d=pg(r&&r.buttonUrl,a);return y("div",{className:"ul-card-button-group",children:[y("a",{className:"ul-card-text__button ul-card__text-url-prompt-button",href:d,id:"ul-card-text__button",onClick:s,onKeyPress:l,rel:"noreferrer",role:d?"link":"button",tabIndex:0,target:"_blank",children:Gt(r)}),r.required===!1&&y("button",{className:U.SkipButton,onClick:f=>s(f,!0),children:sa(r)})]})},c=(d,f)=>d?y("div",{className:"ul-rich-text-body",dangerouslySetInnerHTML:{__html:d},id:"ul-card__text-url-body-container"}):y("div",{className:"ul-rich-text-body",id:"ul-card__text-url-body-container",children:(f?f.split(/\n\s*\n/g):[]).map((p,v)=>y("p",{children:p},v))});return y("div",{className:H([e,"ul-card__text-url-prompt",U.FadeInTransition]),children:[y(Be,{message:t}),c(r&&r.richTextBody,r&&r.body),y(ct,{defaultBody:u,properties:r})]},i)},vg=({className:e,questionId:t})=>{const{border:n,destroy:r,endCard:i,forceBrandedLogo:o}=X(l=>({border:l.border,destroy:l.destroy,endCard:l.endCard,forceBrandedLogo:l.forceBrandedLogo}));Ae(()=>{setTimeout(()=>{r(Xt)},o?4e3:2e3)},[r,o]);const a=i&&i.subheader?y("p",{className:U.Caption,children:i.subheader}):null,s=i&&i.headline?i.headline:"";return y("div",{className:H([e,"ul-card--thanks",U.FadeInTransition]),children:y("div",{children:y("div",{className:"ul-card--thanks-content",children:[y("div",{className:"ul-thanks-check",children:y("svg",{"aria-labelledby":"title",fill:"none",height:"99",viewBox:"0 0 81 99",width:"81",xmlns:"http://www.w3.org/2000/svg",children:[y("path",{clipRule:"evenodd",d:"M40.5 77C60.9345 77 77.5 60.4345 77.5 40C77.5 19.5655 60.9345 3 40.5 3C20.0655 3 3.5 19.5655 3.5 40C3.5 60.4345 20.0655 77 40.5 77ZM80.5 40C80.5 62.0914 62.5914 80 40.5 80C18.4086 80 0.5 62.0914 0.5 40C0.5 17.9086 18.4086 0 40.5 0C62.5914 0 80.5 17.9086 80.5 40Z",fill:n,fillRule:"evenodd"}),y("path",{clipRule:"evenodd",d:"M55.025 22.9046C55.6299 23.4705 55.6616 24.4198 55.0956 25.0247C54.8724 25.2634 54.6109 25.5285 54.3157 25.8277C52.2547 27.9168 48.5549 31.667 44.8135 39.6658C43.2818 42.9406 42.0864 45.8386 41.0823 48.2729C40.6539 49.3116 40.2603 50.2659 39.8902 51.129C39.287 52.5359 38.7248 53.7508 38.1744 54.625C37.8997 55.0613 37.5806 55.4905 37.2017 55.8245C36.8201 56.1607 36.2613 56.5 35.5457 56.5C34.6742 56.5 34.0892 55.9692 33.7774 55.6083C33.4502 55.2296 33.1752 54.7511 32.9396 54.301C32.7305 53.9013 32.5088 53.4367 32.2797 52.9565C32.2429 52.8794 32.2059 52.8019 32.1688 52.7243C31.8942 52.1499 31.5959 51.534 31.2537 50.8868C29.8886 48.305 27.8539 45.2878 24.2343 43.1382C23.522 42.7152 23.2875 41.7949 23.7105 41.0826C24.1335 40.3703 25.0539 40.1358 25.7662 40.5588C30.0556 43.1062 32.4149 46.6647 33.9058 49.4845C34.2776 50.1876 34.5973 50.8487 34.8753 51.4302C34.9147 51.5124 34.9529 51.5926 34.9902 51.6707C35.2222 52.1567 35.4164 52.5637 35.5978 52.9102C35.6151 52.9434 35.6321 52.9754 35.6485 53.0061C36.0565 52.3531 36.5341 51.3434 37.133 49.9468C37.4781 49.1418 37.8572 48.2229 38.2761 47.2074C39.2886 44.7532 40.5339 41.7347 42.0961 38.3948C46.0591 29.9221 50.0641 25.8648 52.1535 23.7482C52.4423 23.4556 52.6944 23.2002 52.9048 22.9753C53.4708 22.3703 54.42 22.3387 55.025 22.9046ZM35.1994 53.5892C35.1994 53.5892 35.2 53.5888 35.2012 53.5879C35.2 53.5889 35.1994 53.5893 35.1994 53.5892ZM36.0666 53.6682C36.0732 53.674 36.0765 53.6775 36.0765 53.6777C36.0765 53.678 36.0732 53.6751 36.0666 53.6682Z",fill:n,fillRule:"evenodd"}),y("path",{d:"M69.5 97C69.5 98.1046 56.2924 99 40 99C23.7076 99 10.5 98.1046 10.5 97C10.5 95.8954 23.7076 95 40 95C56.2924 95 69.5 95.8954 69.5 97Z",fill:"black",fillOpacity:"0.2"})]})}),y(Be,{message:s}),a]})})},t)},Rt="https://cdn.sprig.com",M={document:void 0,videojs:void 0},mg=`/* progress control styles */
47
47
  .video-js .vjs-control {
48
48
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif;
49
49
  }
@@ -700,5 +700,5 @@ span.ul-button-text {
700
700
  .vjs-poster {
701
701
  background-size: cover;
702
702
  }
703
- `,Vm=e=>{const t=M.document.createElement("div");return t.className="ul-video-player-loading",t.id=ia(e),["first","second","third","fourth"].map(n=>{const r=M.document.createElement("div");r.className=n,t.appendChild(r)}),t},ia=e=>e+"-loading-spiner",se="hidden",Cs=".m3u8",gi="questionId",yi="ul-video-recorder-camera-off-button",_i="ul-recording-in-session",Mm=[{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`}],ic=[{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:Nm}],oc="-video-player",ac="-secondary-video-player",sc="-video-recorder";let Fe,Is;const pt=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)},et=async(e,t,n,r,i,o)=>{pt({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)},jm=(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)}),lc=(e,t)=>{if(e.length===0)return t&&t();Promise.all(e.reduce((n,r)=>(n.push(jm(M.document.head,r)),n),[])).then(()=>{M.videojs=M.document.defaultView.videojs,t&&t()}).catch(function(n){console.log(n+" failed to load")})},ks=(e,t,n)=>{if(t==="start"&&(e.style.visibility="visible"),t==="none")e.style.visibility=se;else if(t==="success")e.style.visibility=se,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%)`}},wi=(e,t)=>{const n=M.videojs(e.id());return n==null?void 0:n.payload[t]},Bm=(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(F.ERROR,{type:F.PERMISSION_DENIED}),pt({event:"Video Permission Denied",apiBase:t,headers:i,visitorId:s,envId:l,metadata:{questionId:wi(e,gi),responseGroupUid:a,surveyId:o}})):(n&&n(F.ERROR,{type:F.OTHER}),et(new Error(e.deviceErrorCode.message),"recorderDeviceError",t,i,s,l))}),e.on("error",function(u,c){et(c||e.error(),"recorderError",t,i,s,l)}),e.on("startRecord",function(u,c){r(e.uploadProgressLabel,"none"),pt({event:"Video Record Start",apiBase:t,headers:i,visitorId:s,envId:l,metadata:{questionId:wi(e,gi),responseGroupUid:a,surveyId:o}})}),e.on("finishRecord",async function(){r(e.uploadProgressLabel,"start",0);const u=wi(e,gi);if(!o){const v="internal error: missing fields in payload";return n&&n(F.ERROR,{type:F.OTHER}),et(new Error(v),"finishRecord",t,i,s,l),null}e.record().stopDevice();const c=e.cameraOff?F.MEDIA_TYPE_AUDIO:F.MEDIA_TYPE_VIDEO,d=mt();pt({event:"Video Record Finish",apiBase:t,headers:i,visitorId:s,envId:l,metadata:{mediaRecordingUid:d,questionId:u,responseGroupUid:a,surveyId:o,mediaType:c}});const f={surveyId:o,updatedAt:new Date().toISOString(),mediaType:c,mediaRecordingUid:d};u&&(f.questionId=u),a&&(f.responseGroupUid=a),s&&(f.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(f)});if(v.ok){const g=await v.json();return n&&n(F.UPLOAD_STARTED,{[F.UPLOAD_ID]:g.upload.id,[F.MEDIA_TYPE]:c,[F.MEDIA_RECORDING_UID]:d}),g.upload.url}else return n&&n(F.ERROR,{type:F.OTHER,response:v}),et(new Error("failed to get upload response with url"),"finishRecord",t,i,s,l),null})();!h||(Fe=M.document.defaultView.UpChunk.createUpload({endpoint:h,file:new M.document.defaultView.File([e.recordedData],`recording ${c} ${Date.now()}`),chunkSize:5120}),Fe.startTime=Date.now(),pt({event:"Video Upload Start",apiBase:t,headers:i,visitorId:s,envId:l,metadata:{mediaRecordingUid:d,questionId:u,responseGroupUid:a,surveyId:o,mediaType:c,url:h}}),Fe.on("error",v=>{r(e.uploadProgressLabel,"none"),n&&n(F.UPLOAD_FINISHED,{[F.MEDIA_RECORDING_UID]:d}),et(v,"finishRecord",t,i,s,l)}),Fe.on("progress",v=>{n&&n(F.UPLOAD_PROGRESS,{[F.MEDIA_RECORDING_UID]:d,[F.UPLOAD_PROGRESS_PCT]:v.detail}),r(e.uploadProgressLabel,"progress",v.detail)}),Fe.on("success",()=>{r(e.uploadProgressLabel,"success"),n&&n(F.UPLOAD_FINISHED,{[F.MEDIA_RECORDING_UID]:d}),pt({event:"Video Upload Success",apiBase:t,headers:i,visitorId:s,envId:l,metadata:{mediaRecordingUid:d,questionId:u,responseGroupUid:a,surveyId:o,mediaType:c,url:h,elapsedMs:Fe.startTime&&Date.now()-Fe.startTime}})}))})},uc=(e,t)=>{const n=new(M.videojs.getComponent("Component"))(e);return n.addClass("ul-buttons-panel"),t.map(r=>{n.addChild(r)}),Fm(n),n},Fm=e=>{e.children().forEach(t=>{if(Oe[t.name_]){const n=yr(Oe[t.name_],`ul-${Oe[t.name_]}`);t.el_.appendChild(n)}})},yr=(e,t="")=>{const n=M.document.createElement("span");return n.className="ul-button-text",n.innerHTML=e,n.id=t,n},cc=(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?Ym(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&&$m(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)},Hm=(e,t,n)=>{e.addClass(`ul${ac}`);const r=new(M.videojs.getComponent("Component"))(e);t&&e.src(t),e.addChild(r),n&&n(e)},Km=(e,t,n,r,i,o,a,s=!1)=>{Is=Date.now();const u=jr(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:d,responseGroupUid:f,visitorId:p,envId:h}=n;let v;const g=D=>{const k=yi,P=yi+"-audio-only";ks(u.uploadProgressLabel,"none"),Fe&&Fe.startTime>=Is&&Fe.abort();const R=M.document.getElementById("ul-camera-button");D?(u.children()[0].classList.add("vjs-hidden"),E.removeClass(k),E.addClass(P),R.innerHTML=Oe.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(),E.removeClass(P),E.addClass(k),R.innerHTML=Oe.TurnOffCamera,u.audioPlayerPlaceholder.addClass("vjs-hidden"))},w=new(M.videojs.getComponent("Button"))(u,{clickHandler:()=>{w.hasClass(se)||(pt({event:"Video Delete Button Clicked",apiBase:r,headers:a,visitorId:p,envId:h,metadata:{questionId:d,responseGroupUid:f,surveyId:c}}),g(u.cameraOff),i(F.DELETE,{}),E.removeClass(se),w.addClass(se))}});w.addClass("ul-video-recorder-delete-button"),w.el_.appendChild(yr(Oe.DeleteButton,"ul-delete-button"));const _=M.document.getElementById(t),b=()=>{_.classList.contains("vjs-fullscreen")&&u.cameraOff?_.style.display="table":_.style.display="flex"};b();const E=new(M.videojs.getComponent("Button"))(u,{clickHandler:()=>{u.record().isRecording()||(u.cameraOff=!u.cameraOff,pt({event:"Video Camera Button Clicked",apiBase:r,headers:a,visitorId:n.visitorId,envId:n.envId,metadata:{questionId:d,responseGroupUid:f,surveyId:c,cameraOff:u.cameraOff}}),g(u.cameraOff),!w.hasClass(se)&&w.addClass(se),i(F.DELETE,{}),b())}});E.addClass(yi),E.el_.appendChild(yr(Oe.TurnOffCamera,"ul-camera-button"));const m=new(M.videojs.getComponent("Button"))(u,{clickHandler:()=>{const D=M.document.getElementById("ul-recorder-toggle");if(u.record().isRecording())u.record().stop(),D&&(D.innerHTML=Oe.RecordButton),m.removeClass(_i),w.removeClass(se);else{const k=M.document.getElementById("ul-recording-countdown-screen");if(k)k.remove(),D&&(D.innerHTML=Oe.RecordButton),g(u.cameraOff),i(F.DELETE,{}),E.removeClass(se),w.addClass(se),m.removeClass(_i),C.show();else{m.addClass(_i),C.hide(),E.addClass(se),w.addClass(se),D&&(D.innerHTML=Oe.StopButton);const P=M.document.createElement("div");P.id="ul-recording-countdown-screen",_.insertBefore(P,_.children[1]),P.style.height=`${_.offsetHeight}px`,dc(u,3)}}}});m.addClass("ul-video-recorder-toggle-button"),m.el_.appendChild(yr(Oe.RecordButton,"ul-recorder-toggle"));const x=M.document.createElement("p");x.style.visibility="hidden",x.className="ul-upload-progress-label",e.appendChild(x),u.uploadProgressLabel=x;const I=uc(u,[w,E,"PlayToggle",m,"FullscreenToggle"]),C=I.children().find(D=>D.name_==="FullscreenToggle");C.hasClass("vjs-disabled")&&C.hide();const S=I.children().find(D=>D.name_==="PlayToggle");S.hide(),o&&E.addClass(se),!o&&w.addClass(se),cc(u,I,o,!1,s),u.on("stopRecord",()=>{m.hide(),S.show(),C.show(),w.removeClass(se)}),u.on("deviceReady",()=>{m.show(),S.hide(),w.addClass(se)}),Bm(u,r,i,ks,a),o&&(u.deviceButton&&u.deviceButton.hide(),u.src(o),S.show(),m.hide(),w.removeClass(se));const L=[{name:"microphone"}];!u.cameraOff&&L.push({name:"camera"}),Promise.all(L.map(D=>{var k;return(k=navigator==null?void 0:navigator.permissions)==null?void 0:k.query(D)})).then(D=>{D.reduce((P,R)=>P&R.state==="granted",!0)&&u&&(u.deviceButton&&u.deviceButton.hide(),!o&&u.record().getDevice())}).catch(D=>{})},dc=(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(()=>{dc(e,t-1)},1e3))},fc=e=>{const t=M.document.createElement("div");return t.className="ul-video-container",t.appendChild(Vm(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},$m=(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%")},jr=(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),qm=(e,t,n,r=!1,i="https://api.sprig.com",o=document,a=null,s=null)=>{M.document=o;const l=e+oc,u=fc(l);return M.document.addEventListener("securitypolicyviolation",c=>{et(new Error(`Voice & Video feature violates ${c.violatedDirective} web page CSP policies for the question player.`),"playerDeviceError",i,{})}),lc(ic,()=>{M.document.getElementById(ia(l)).remove(),uo(l,u);const c={playsinline:!0,playbackRates:[.5,1,1.5,2],fill:!0};try{const d=e+ac;uo(d,u);const f=jr(l,c),p=jr(d,{muted:!0,...c});if(!f||!p)return;Hm(p,a,s),a||p.addClass(se);const h=uc(f,["PlaybackRateMenuButton","PlayToggle","FullscreenToggle"]),v=h.children().find(g=>g.name_==="FullscreenToggle");v.hasClass("vjs-disabled")&&v.hide(),cc(f,h,t,n,r,p)}catch(d){et(new Error(`Error when creating video player object ${d}`),"playerDeviceError",i,{});return}}),u},Gm=(e,t={},n="https://api.userleap.com",r,i,o,a=!1,s=document)=>{M.document=s;const l=e+sc,u=fc(l);return M.document.addEventListener("securitypolicyviolation",c=>{et(new Error(`Voice & Video feature violates ${c.violatedDirective} web page CSP policies for the recorder player.`),"recorderDeviceError",n,o,t.visitorId,t.envId)}),lc(ic.concat(Mm),()=>{uo(l,u),M.document.getElementById(ia(l)).remove();try{Km(u,l,t,n,r,i,o,a)}catch(c){et(new Error(`Error when creating video recorder player object ${c}`),"recorderDeviceError",n,o,t.visitorId,t.envId);return}}),u},zm=e=>{const t=e+sc;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()}},Wm=e=>{const t=jr(e+oc);t==null||t.pause()},Ym=e=>{if(!e)return null;const t=e.match(/https:\/\/stream.mux.com\/(.*)/);let n=t?t[1]:null;return n.includes(Cs)&&(n=n.replace(Cs,"")),n?`https://image.mux.com/${n}/thumbnail.jpg?time=0`:null},F={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"},Oe={PlaybackRateMenuButton:"Speed",PlayToggle:"Play",FullscreenToggle:"Expand",TurnOnCamera:"Turn on",TurnOffCamera:"Turn off",DeleteButton:"Delete",RecordButton:"Record",StopButton:"Stop",PauseButton:"Pause"},mn="ul-card-video__player_recorder",Qm="ul-card-video__skip_button",Zm="ul-video-interview-form",Ts="ul-video-btn",Xm=({className:e,message:t,next:n,properties:r,questionId:i,type:o})=>{const{apiURL:a,envId:s,handleUploadUpdate:l,headers:u,responseGroupUid:c,surveyId:d,viewDocument:f,visitorId:p}=ee(k=>({apiURL:k.apiURL,envId:k.envId,handleUploadUpdate:k.handleUploadUpdate,headers:k.headers,responseGroupUid:k.responseGroupUid,surveyId:k.surveyId,viewDocument:k.viewDocument,visitorId:k.userId})),[h,v]=de(!1),[g,w]=de(null),[_,b]=de(null),[E,m]=de(0),x=r&&r.videoUrl,I=(k,P)=>{k===F.UPLOAD_STARTED?(w(P[F.UPLOAD_ID]),b(P[F.MEDIA_RECORDING_UID]),v(!0)):k===F.DELETE?(w(null),b(null),v(!1)):k===F.UPLOAD_PROGRESS?isNaN(P[F.UPLOAD_PROGRESS_PCT])?l({mediaRecordingUid:P[F.MEDIA_RECORDING_UID],isComplete:!0}):l({mediaRecordingUid:P[F.MEDIA_RECORDING_UID],progressPct:P[F.UPLOAD_PROGRESS_PCT]}):k===F.UPLOAD_FINISHED&&l({mediaRecordingUid:P[F.MEDIA_RECORDING_UID],isComplete:!0})},C=k=>{if(k&&k.children.length===0){const P=qm(mn,{src:x,type:"application/x-mpegURL"},void 0,r.mediaType===F.MEDIA_TYPE_AUDIO,a,f);k.appendChild(P)}},S=k=>{if(k&&k.children.length===0){const P=Gm(mn,{surveyId:d,responseGroupUid:c,questionId:i,visitorId:p,envId:s},a,I,void 0,{...u,"x-ul-video-recorder-origin":"sdk"},r.mediaType===F.MEDIA_TYPE_AUDIO,f);k.appendChild(P)}},L=k=>{k.preventDefault(),k.stopPropagation(),zm(mn),g&&_?(l({mediaRecordingUid:_,isSubmitted:!0}),n({value:{mediaRecordingUid:_},questionId:i,type:o})):n({value:null,questionId:i,type:o})},D=()=>y(xt,{defaultBody:()=>y("button",{className:`${Ts} ul-record-response-btn`,onClick:k=>{k.preventDefault(),k.stopPropagation(),Wm(mn),m(1)}}),properties:r});return y("form",{className:q([e,U.VideoCard,U.FadeInTransition]),id:Zm,children:[y(ze,{message:t,properties:r}),y("div",{id:"ul-card-voice__video",children:[y("div",{children:[y("div",{id:"ul-question-player-container",style:{display:E===0?"":"none"},children:[y("div",{id:mn,ref:C}),D()]}),y("div",{style:{display:E===1?"block":"none"},children:[y("button",{className:`${Ts} ul-back-question-btn`,onClick:k=>{k.preventDefault(),k.stopPropagation(),m(0)}}),y("div",{id:"ul-recorder-player-container",ref:S})]})]}),y(xe,{disabled:!h,onClick:L,children:hn(r)}),y("button",{className:`ul-card-text__button ${U.InactiveButton} ${U.SkipButton}`,id:Qm,onClick:L,style:{display:r.required?"none":"block",...h?{display:"none"}:{}},children:ta(r)})]})]})},Jm=({className:e})=>{const{uploadProgress:t}=ee(o=>({uploadProgress:o.uploadProgress}));let n,r;Object.values(t).filter(o=>o.isSubmitted).length>1?(n="Your responses are processing",r="Please keep this tab open until your responses are fully processed."):(n="Your response is processing",r="Please keep this tab open until your response is fully processed.");const i=Math.round(Math.min(99,...Object.values(t).filter(o=>o.isSubmitted).map(o=>o.progressPct)));return y("div",{className:q([e,"ul-card--uploading",U.FadeInTransition]),children:[y("div",{"aria-busy":"true","aria-label":"Processing...","aria-live":"polite",className:U.LoadingSpinnerContainer,role:"progressbar",children:y("div",{className:U.LoadingSpinner,children:[y("div",{className:U.LoadingSpinnerFirst}),y("div",{className:U.LoadingSpinnerSecond}),y("div",{className:U.LoadingSpinnerThird}),y("div",{className:U.LoadingSpinnerFourth})]})}),y(ze,{message:`${n} (${i}% complete)`}),y("p",{className:U.Caption,children:r})]})},Ls=({logoOnly:e=!1,style:t={}})=>y("svg",{alt:`${e?"Powered by ":""}Sprig`,width:e?"35":"112",height:"15",viewBox:e?"79 0 31 15":"0 0 112 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{display:"block",...t},children:[!e&&y("path",{d:"M0.648926 12.0181V2.8584H4.21631C6.0127 2.8584 7.25684 4.06445 7.25684 5.86084V5.87354C7.25684 7.66357 6.0127 8.88867 4.21631 8.88867H2.0708V12.0181H0.648926ZM3.86084 4.05811H2.0708V7.69531H3.86084C5.09229 7.69531 5.80957 7.02881 5.80957 5.87988V5.86719C5.80957 4.72461 5.09229 4.05811 3.86084 4.05811ZM11.6621 12.1514C9.63721 12.1514 8.39941 10.7993 8.39941 8.57764V8.56494C8.39941 6.34961 9.64355 4.99121 11.6621 4.99121C13.6743 4.99121 14.9185 6.34326 14.9185 8.56494V8.57764C14.9185 10.7993 13.6807 12.1514 11.6621 12.1514ZM11.6621 11.0024C12.8428 11.0024 13.5156 10.1011 13.5156 8.57764V8.56494C13.5156 7.03516 12.8428 6.14014 11.6621 6.14014C10.4751 6.14014 9.80859 7.03516 9.80859 8.56494V8.57764C9.80859 10.1074 10.4751 11.0024 11.6621 11.0024ZM17.6226 12.0181L15.7183 5.12451H17.1021L18.3398 10.4438H18.4414L19.8633 5.12451H21.1709L22.5928 10.4438H22.7007L23.9321 5.12451H25.2969L23.3989 12.0181H21.9834L20.5552 6.87646H20.4473L19.0254 12.0181H17.6226ZM29.334 12.1514C27.3154 12.1514 26.0967 10.7739 26.0967 8.59033V8.58398C26.0967 6.43213 27.3408 4.99121 29.2642 4.99121C31.1875 4.99121 32.3682 6.38135 32.3682 8.45068V8.93311H27.4805C27.5059 10.2534 28.2295 11.0215 29.3657 11.0215C30.248 11.0215 30.7749 10.5835 30.9399 10.228L30.9653 10.1772L32.292 10.1709L32.2793 10.228C32.0508 11.1357 31.0986 12.1514 29.334 12.1514ZM29.2705 6.12109C28.3311 6.12109 27.6201 6.76221 27.4995 7.94922H31.0034C30.8955 6.71777 30.2036 6.12109 29.2705 6.12109ZM34.0059 12.0181V5.12451H35.3833V6.16553H35.4849C35.7324 5.43555 36.3735 5.00391 37.2939 5.00391C37.5161 5.00391 37.7573 5.03564 37.897 5.06738V6.33691C37.6494 6.28613 37.4146 6.25439 37.1543 6.25439C36.1006 6.25439 35.3833 6.90186 35.3833 7.89844V12.0181H34.0059ZM41.9277 12.1514C39.9092 12.1514 38.6904 10.7739 38.6904 8.59033V8.58398C38.6904 6.43213 39.9346 4.99121 41.8579 4.99121C43.7812 4.99121 44.9619 6.38135 44.9619 8.45068V8.93311H40.0742C40.0996 10.2534 40.8232 11.0215 41.9595 11.0215C42.8418 11.0215 43.3687 10.5835 43.5337 10.228L43.5591 10.1772L44.8857 10.1709L44.873 10.228C44.6445 11.1357 43.6924 12.1514 41.9277 12.1514ZM41.8643 6.12109C40.9248 6.12109 40.2139 6.76221 40.0933 7.94922H43.5972C43.4893 6.71777 42.7974 6.12109 41.8643 6.12109ZM49.1133 12.1323C47.3804 12.1323 46.2568 10.7422 46.2568 8.57764V8.56494C46.2568 6.38135 47.3613 5.00391 49.1133 5.00391C50.0591 5.00391 50.8652 5.47363 51.2334 6.21631H51.3413V2.42041H52.7124V12.0181H51.3413V10.9326H51.2334C50.8335 11.688 50.0781 12.1323 49.1133 12.1323ZM49.5068 10.958C50.6558 10.958 51.3604 10.0503 51.3604 8.57764V8.56494C51.3604 7.09229 50.6494 6.18457 49.5068 6.18457C48.3516 6.18457 47.6597 7.08594 47.6597 8.56494V8.57764C47.6597 10.0566 48.3516 10.958 49.5068 10.958ZM61.98 12.1323C61.0151 12.1323 60.2598 11.688 59.8599 10.9326H59.7583V12.0181H58.3809V2.42041H59.7583V6.21631H59.8599C60.228 5.47363 61.0342 5.00391 61.98 5.00391C63.7319 5.00391 64.8364 6.38135 64.8364 8.56494V8.57764C64.8364 10.7422 63.7192 12.1323 61.98 12.1323ZM61.5928 10.958C62.7417 10.958 63.4336 10.0566 63.4336 8.57764V8.56494C63.4336 7.08594 62.7417 6.18457 61.5928 6.18457C60.4438 6.18457 59.7329 7.09229 59.7329 8.56494V8.57764C59.7329 10.0503 60.4438 10.958 61.5928 10.958ZM66.8867 14.4429C66.7153 14.4429 66.5122 14.4302 66.3345 14.4111V13.3257C66.4678 13.3447 66.6392 13.3511 66.7979 13.3511C67.439 13.3511 67.8262 13.0781 68.0293 12.3799L68.1309 12.0244L65.6299 5.12451H67.1152L68.8418 10.6343H68.9624L70.6826 5.12451H72.1299L69.5654 12.2847C68.9814 13.9287 68.2832 14.4429 66.8867 14.4429Z",fill:"black",fillOpacity:"0.7"}),y("path",{d:"M81.1088 6.63629C79.6878 6.32154 78.9672 5.76865 78.9672 4.99369C78.9672 4.19299 79.736 3.5886 80.7556 3.5886C81.8066 3.5886 82.5995 4.25285 82.5995 5.13336V5.20352H84.0518V5.13336C84.0518 3.52424 82.6405 2.30774 80.7693 2.30774C79.8676 2.30774 79.0414 2.58451 78.4433 3.08655C78.1463 3.33144 77.9077 3.63818 77.7448 3.98479C77.5818 4.33141 77.4984 4.70934 77.5005 5.09153C77.4946 5.44197 77.5675 5.78934 77.714 6.10857C77.8605 6.42779 78.0769 6.71092 78.3475 6.93752C78.8512 7.37584 79.5659 7.70024 80.4709 7.90299C81.9949 8.23898 82.7676 8.81054 82.7676 9.60094C82.7676 10.4576 81.9258 11.1032 80.813 11.1032C79.6571 11.1032 78.7854 10.3856 78.7854 9.43424V9.36408H77.3318V9.43424C77.3318 11.1167 78.8219 12.3847 80.7973 12.3847C81.7421 12.3847 82.6093 12.0983 83.2393 11.5769C83.5519 11.3237 83.8034 11.0048 83.9753 10.6433C84.1472 10.2818 84.2352 9.88702 84.2329 9.48766C84.2329 8.05875 83.1833 7.09907 81.1088 6.63629Z",fill:"black",fillOpacity:"0.7"}),y("path",{d:"M89.2394 4.68276C88.6963 4.67605 88.1596 4.79915 87.6751 5.04156C87.1905 5.28397 86.7725 5.63851 86.4566 6.07497V4.85204H85.0747V14.8479H86.4566V11.0356C86.7725 11.472 87.1906 11.8265 87.6751 12.0688C88.1596 12.3111 88.6963 12.434 89.2394 12.4272C91.3836 12.4272 93 10.7627 93 8.55495C93 6.34723 91.3836 4.68276 89.2394 4.68276ZM91.5608 8.84202C91.5057 9.41605 91.2512 9.95356 90.8406 10.3633C90.4299 10.773 89.8883 11.0296 89.3078 11.0896C88.5363 11.1669 87.8177 10.9461 87.2841 10.4692C86.7505 9.99222 86.4566 9.3106 86.4566 8.55495C86.4566 7.10159 87.5538 6.00546 89.0087 6.00546C89.7619 6.00546 90.4421 6.29124 90.9171 6.81002C91.407 7.34232 91.6357 8.06385 91.5608 8.84202Z",fill:"black",fillOpacity:"0.7"}),y("path",{d:"M109.95 4.85407V6.06349C109.298 5.18298 108.292 4.68286 107.153 4.68286C105.017 4.68286 103.406 6.31709 103.406 8.48426C103.406 10.6514 105.017 12.285 107.153 12.285C108.296 12.285 109.303 11.79 109.95 10.9185V11.1046C109.95 12.6101 108.993 13.5826 107.513 13.5826C106.513 13.5826 105.68 13.1494 105.284 12.424L105.264 12.3867H103.838L103.871 12.48C104.112 13.1892 104.583 13.8001 105.211 14.2179C105.841 14.6324 106.637 14.8512 107.513 14.8512C108.637 14.8512 109.594 14.4972 110.28 13.8285C110.967 13.1597 111.332 12.2194 111.332 11.1213V4.85407H109.95ZM109.175 10.3502C108.588 10.905 107.752 11.138 106.879 10.9887C106.361 10.8984 105.886 10.6475 105.523 10.2725C105.16 9.89751 104.927 9.41787 104.859 8.90328C104.736 8.03757 104.999 7.21756 105.581 6.655C106.069 6.19093 106.723 5.93643 107.401 5.94699C107.565 5.94713 107.729 5.96026 107.891 5.98625C108.946 6.15489 109.781 7.01609 109.921 8.0852C110.039 8.96507 109.766 9.78958 109.175 10.3502Z",fill:"black",fillOpacity:"0.7"}),y("path",{d:"M101.89 2.12378C101.63 2.06766 101.358 2.11486 101.133 2.25518C100.908 2.39551 100.747 2.61769 100.687 2.87371C100.626 3.12973 100.67 3.39902 100.809 3.62339C100.947 3.84775 101.17 4.00917 101.428 4.07275C101.503 4.08936 101.58 4.09778 101.657 4.09786C101.906 4.09824 102.146 4.0083 102.331 3.84518C102.517 3.68206 102.636 3.45714 102.664 3.21327C102.693 2.9694 102.63 2.72361 102.487 2.5227C102.344 2.32179 102.132 2.17981 101.89 2.12378Z",fill:"black",fillOpacity:"0.7"}),y("path",{d:"M100.967 10.934H99.7755C98.9285 10.934 98.4196 10.3644 98.4196 9.40982C98.4196 8.4791 98.8757 7.36945 99.8054 6.01778L99.8178 5.99976V5.61807L95.8571 5.06453C95.8585 4.90331 95.8162 4.74466 95.7346 4.60501C95.653 4.46536 95.5352 4.34979 95.3932 4.27027C95.0381 4.07718 94.6498 4.07717 94.3279 4.26383C94.1667 4.35799 94.035 4.4945 93.9476 4.65816C93.8602 4.82182 93.8205 5.00623 93.8328 5.19087C93.8452 5.37552 93.9092 5.55315 94.0176 5.70402C94.1261 5.85489 94.2748 5.97309 94.4472 6.04546L93.2151 12.258H94.5833L95.7196 6.35891L97.8593 6.7155C97.284 7.73439 96.9921 8.68442 96.9921 9.53919C96.9921 11.1168 97.9577 12.1498 99.5187 12.2496V12.258H102.346V4.87723H100.967V10.934Z",fill:"black",fillOpacity:"0.7"})]}),eg=()=>{const{border:e,cards:t,forceBrandedLogo:n,headers:r,index:i,marketingUrl:o,showSurveyBrand:a,slugName:s,surveyId:l,viewedCardCount:u}=ee(b=>({border:b.border,cards:b.cards,forceBrandedLogo:b.forceBrandedLogo,headers:b.headers,index:b.index,marketingUrl:b.marketingUrl,showSurveyBrand:b.showSurveyBrand,slugName:b.slugName,surveyId:b.surveyId,viewedCardCount:b.viewedCardCount})),c=wt(null),d=t.filter(b=>b.type!==T.Uploading&&b.type!==T.Thanks),f=rm(t,i),p=u+1,h=p/(p+f),v=`${o}?utm_source=survey_branding&utm_medium=website&utm_campaign=${s}&utm_content=${l}${n&&"&utm_term=poweredby_pill"}`;Le(()=>{c.current&&(c.current.style.width=`${h*100}%`)},[h]);const g=()=>y(Ae,{children:[d.length>1&&y("div",{id:"ul-progress-bar-container",children:y("div",{id:"ul-progress-bar-current",ref:c,style:{border:`1px solid ${e||"#000"}`}})}),a?y("div",{className:n?"yellow-footer-logo":"",style:{marginTop:"4px"},children:y("a",{href:v,rel:"noreferrer",target:"_blank",children:y("div",{style:{display:"flex"},children:[y(Ls,{logoOnly:!1}),n&&y(Rs,{style:{display:"block",margin:"auto 0 auto 4px",transform:"rotateY(0deg) rotate(-45deg)"}})]})})}):null]}),w=()=>y("a",{dir:"ltr",href:v,rel:"noreferrer",target:"_blank",children:y("div",{className:"thank-you-card-link",children:[y("div",{className:"sprig-box-logo",children:y(Ls,{logoOnly:!0,style:{margin:"auto"}})}),y("div",{children:y("p",{children:["Capture insights about your own product",y(Rs,{style:{display:"inline-flex",marginInlineStart:"4px",verticalAlign:"middle"}})]})})]})}),_=t[i].type===T.Thanks;return y("footer",{className:`ul-footer ${r["userleap-platform"]==="link"?"ul-footer__link":""}`,style:a?{}:{marginBottom:"10px"},children:_&&n?w():g()})},Rs=({style:e})=>y("svg",{fill:"none",height:"10",style:e,viewBox:"0 0 12 10",width:"12",xmlns:"http://www.w3.org/2000/svg",children:[y("path",{d:"M1.47839 5.2085L10.9384 5.2085",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.35"}),y("path",{d:"M7.0686 1.15845L10.9386 5.20845L7.0686 9.25845",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.35"})]}),tg=()=>{const{answers:e,border:t,cards:n,close:r,configureExitOnOverlayClick:i,destroy:o,endCard:a,eventEmitFn:s,fontFamily:l,headers:u,index:c,next:d,showStripes:f,update:p,useMobileStyling:h,viewDocument:v}=ee(R=>({answers:R.answers,border:R.border,cards:R.cards,close:R.close,configureExitOnOverlayClick:R.configureExitOnOverlayClick,destroy:R.destroy,endCard:R.endCard,eventEmitFn:R.eventEmitFn,fontFamily:R.fontFamily,headers:R.headers,index:R.index,next:R.next,showStripes:R.showStripes,update:R.update,useMobileStyling:R.useMobileStyling,viewDocument:R.viewDocument})),g=wt(null),w=wt(!1),_=u["userleap-platform"],{props:b,type:E,name:m}=n[c],x=n.length;Le(()=>{g.current&&(g.current.classList.contains("ul-app--visible")||g.current.classList.add("ul-app--visible"),!w.current&&s&&(w.current=!0,s(B.SurveyAppeared)))},[s]),Le(()=>{p()},[c,p]),Le(()=>{i(()=>r())},[r,i]);const I=()=>r(zt),C=R=>{R.key==="Enter"&&I()},S=async function(R){d({data:R,completeSurvey:()=>{o(zt)},endCard:a}),Mf(v)};if(e){for(const R of e)if(R.questionId===m){let O;if(E===T.MultipleChoice){const Y=b.options.find(({value:ae})=>ae===R.value);if(!Y)break;O={[Y.id]:Y.value}}else O=R.value;S({value:O,type:E,questionId:R.questionId});break}}const L=()=>[Pt.Email,Pt.Link].includes(u["userleap-platform"])?!1:!a||c+1!==x,D=()=>h?{borderColor:t}:{borderColor:t,margin:"15px"},k=()=>{const R={className:"ul-card",next:S,questionId:m,type:E};switch(E){case T.ConsentLegal:return te(hm,{...R,...b,key:m});case T.Likert:return te(mm,{...R,...b,key:m});case T.MultipleChoice:return te(gm,{...R,...b,key:m});case T.MultipleSelect:return te(ym,{...R,...b,key:m});case T.NPS:return te(_m,{...R,key:m,props:b});case T.Open:return te(wm,{...R,...b,key:m});case T.RecordedTask:return te(Am,{...R,...b,key:m});case T.TextUrlPrompt:return te(Dm,{...R,...b,key:m});case T.Thanks:return te(Pm,{...R,...b,key:m});case T.Uploading:return te(Jm,{...R,...b,key:m});case T.VideoVoice:return te(Xm,{...R,...b,key:m});default:return null}},P=R=>{var G;const O=window.sprigAPI,Y=R.target;if(!O||!Y)return;const ae=[Y,Y.parentElement];for(const ue of ae)if(((G=ue==null?void 0:ue.tagName)==null?void 0:G.toLowerCase())==="a"){R.preventDefault(),O==null||O.openUrl(ue.href);return}};return y("div",{className:q("ul-app",Wt(u)?"ul-app--visible":"ul-app--overlay"),dir:"auto",id:zt,onClick:P,ref:g,style:{"--theme":t,...l?{fontFamily:l.replace(";","")}:{}},children:y("div",{className:"ul-app__container",children:y("div",{className:q(ie(U.CardContainer,h)),style:D(),children:[L()&&y("div",{className:q(ie(U.CloseContainer,h)),children:y("div",{"aria-label":"Close button",className:U.CloseButton,onClick:I,onKeyPress:C,role:"button",tabIndex:0,children:y("svg",{fill:"none",height:"18px",viewBox:"0 0 13 13",width:"18px",xmlns:"http://www.w3.org/2000/svg",children:y("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"})})})}),f&&y("div",{className:"ul-header__container",dir:"ltr",children:y("div",{className:"ul-header",children:"For development purposes only"})}),y("div",{className:q(Bf(U.CardMainContent,_)),children:k()}),y(eg,{})]})})})},ng=`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}ol,ul{padding-inline-start:1em}.ul-card{flex:1 1 auto;border-radius:2px;display:flex;flex-direction:column;font-size:17px;line-height:19px;text-align:start;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}.ul-rich-text-body p,.ul-rich-text-body li{font-size:15px;line-height:130.35%;letter-spacing:.02em;color:#343442;text-align:start;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{margin-bottom:5px}.ul-question{color:#343442;display:block;font-size:20px;line-height:125%;font-weight:500;cursor:default;text-align:start}.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:start}.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{align-items:center;display:flex;flex-direction:row;flex:0 0 fit-content;gap:15px;height:fit-content;justify-content:flex-start;width:100%}.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}.likert-number--mobile:not(:first-child){margin-inline-start:-2px}.likert-number--desktop{border:1px solid #e6e6e6}.likert-number--desktop:not(:first-child){margin-inline-start:-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:first-child{border-start-start-radius:5px;border-end-start-radius:5px}.likert-number:last-child{border-start-end-radius:5px;border-end-end-radius:5px}.likert-number:active,.likert-number--desktop:hover{background-color:#0000000d;font-weight:500}.likert-star--mobile:not(:first-child){margin-inline-start:-2px}.likert-star--desktop:not(:first-child){margin-inline-start:-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:not(:first-child){margin-inline-start:-2px}.likert-smiley--desktop:not(:first-child){margin-inline-start:-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}.select-label{cursor:pointer;flex:1;overflow-wrap:anywhere;text-align:start}.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}.nps-number--mobile:not(:first-child){margin-inline-start:-2px}.nps-number--desktop{border:1px solid #e6e6e6}.nps-number--desktop:not(:first-child){margin-inline-start:-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:first-child{border-start-start-radius:5px;border-end-start-radius:5px}.nps-number:last-child{border-start-end-radius:5px;border-end-end-radius:5px}.nps-number:active,.nps-number--desktop:hover{background-color:#0000000d;font-weight:500}.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-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:start;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;justify-content:center}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>.yellow-footer-logo{background:#fad133;border:1px solid #f9c600;border-radius:14px;padding:6px 12px}.ul-footer>.yellow-footer-logo:hover{background:#f9c600}.ul-footer .thank-you-card-link{background:rgba(0,0,0,.01);border:1px solid #e6e6e6;border-radius:8px;cursor:pointer;display:inline-flex;font-size:14px;gap:8px;margin-bottom:15px;padding:12px;text-align:initial}.ul-footer .thank-you-card-link:hover{background:rgba(0,0,0,.03)}.ul-footer>a{color:inherit}.ul-footer-bubble{display:inline-block;margin:0 3px;width:7px;height:7px;border-radius:3px;border:1px solid transparent}.sprig-box-logo{background:rgba(249,198,0,1);border-radius:5px;display:flex;padding:4px}.close-container{display:flex;justify-content:flex-end;width:100%}.close-btn{cursor:pointer;height:18px;margin-inline-end:-10px;position:relative;top:-10px;width:18px;z-index:1}.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
- `,rg=(e,t)=>{const n=[...e],r=new Set([T.VideoVoice,T.RecordedTask]);return e.some(i=>r.has(i.type))&&n.push({name:-2,props:{routingOptions:[]},type:T.Uploading}),t&&n.push({name:-1,props:{routingOptions:[]},type:T.Thanks}),n},ig=({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 og(e,t=!0){var m;const{answers:n,apiURL:r,customStyles:i,endCard:o,eventEmitFn:a,fontFamilyURL:s,frame:l,previewKey:u,viewDocument:c,viewWindow:d}=e,f=Wt(e.headers)?e.frame:c.body,p=e.UpChunk||window.UpChunk,h=$,v=rg(e.cards,!!o);mr.configure(h,{cards:v,hasEndCard:!!o,apiURL:r,UpChunk:p}),ee.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,forceBrandedLogo:e.forceBrandedLogo,frame:l,headers:e.headers,hasViewedEmbed:!1,isPreview:e.isPreview,marketingUrl:"https://sprig.com",meta:ig({mode:e.mode,viewWindow:d,viewDocument:c}),mode:e.mode,previewKey:u,recorder:mr,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:g}=ee.getState();g();const{head:w}=c,_=c.createElement("style");if(_.id="sprig-style",_.textContent=ng,_.nonce=e.styleNonce,w.appendChild(_),e.fontFamily&&s&&parent){const x=c.createElement("link");x.rel="stylesheet",x.href=s,w.appendChild(x)}if(e.customStyles&&Xs(c,i,e.styleNonce),!p)if(e.installationMethod!==rt.Npm){const x=c.createElement("script");x.src="https://cdn.sprig.com/userleap-web-upchunk-v2.2.2.js",x.onload=()=>{mr.setUpChunk(d.UpChunk)},x.onerror=()=>{console.warn("[Sprig] - recording functionality not configured due to UpChunk library load failure")},w.appendChild(x)}else console.warn("[Sprig] - recording functionality not configured due to missing UpChunk dependency");const b="2.24.11",E=a||((m=l.eventEmitter)==null?void 0:m.emit);E==null||E(Re.VerifyViewVersion,{[Lt.ViewVersion]:b}),f&&t&&on(y(tg,{}),f)}const ag={configure:og};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 sg="rgba(255,255,255, 0.95)",lg="rgba(0,0,0,0.9)",ug="360px",bi="0px",pc=()=>{window.UserLeap.container=document.createElement("div"),window.UserLeap.container.className="ul-container",document.body.appendChild(window.UserLeap.container)},hc=e=>{hg();const t=window.UserLeap.container;if(!(!t||!t.parentNode))try{t.parentNode.removeChild(t),window.UserLeap.container=null,we("trackStartUrl",null),$.emit(B.SurveyLifeCycle,{state:"dismissed"}),$.emit(B.SurveyClosed,{name:B.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)}},vc=()=>{$.on(B.SurveyWillClose,({initiator:e})=>{hc(e)})},cg=(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"?sg:lg,t||(r.margin="auto"),window.UserLeap.container&&Object.assign(window.UserLeap.container.style,r)},dg=(e,t,n)=>{var s,l;const r={position:"fixed",bottom:"0px",right:bi,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=ug,r.maxHeight=window.UserLeap.maxHeight||"66vh",i.framePosition===_n.BottomLeft?o={left:bi}:i.framePosition===_n.TopLeft?o={left:bi,top:"0px"}:i.framePosition===_n.TopRight?o={top:"0px"}:i.framePosition===_n.Center&&(a=!0,o={margin:"auto",position:"static"},r.maxHeight=null)),a&&cg(i,n),Object.assign(e.style,r,o),a},fg=(e,t)=>{var s,l;const n="ul-frame";pc(),pg();const r=document.createElement("iframe");r.id=n,r.setAttribute("title","Sprig User Feedback Dialog");const i=dg(r,e,t);vc(),r.setHeight=u=>{parseInt(r.style.height)!=u&&(r.style.height=`${u}px`,$.emit(B.SurveyHeight,{name:B.SurveyHeight,contentFrameHeight:u}))},(s=window.UserLeap.container)==null||s.appendChild(r),e&&(t?e.exitOnOverlayClickMobile:e.exitOnOverlayClick)&&window.UserLeap.container&&(window.UserLeap.container.onclick=()=>{$.emit(B.CloseSurveyOnOverlayClick)}),$.emit(B.SurveyLifeCycle,{state:"presented"}),$.emit(B.SurveyPresented,{name:B.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}},mc={[B.SurveyFadingOut]:()=>{window.UserLeap.container&&Object.assign(window.UserLeap.container.style,{"background-color":"rgba(0,0,0,0)"})}},pg=()=>{Object.entries(mc).forEach(([e,t])=>{$.on(e,t)})},hg=()=>{Object.entries(mc).forEach(([e,t])=>{$.off(e,t)})},vg="!launch_darkly_";class mg{constructor(){fe(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=>{var r;return this._ldData[`${vg}${n}`]=((r=t[n])!=null?r:0)+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 mg;Object.freeze(co);const gg="!optimizely_experiments_";class yg{constructor(){fe(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 gg+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 _r=new yg;Object.freeze(_r);class _g{constructor(t,n){fe(this,"paused");fe(this,"queue");fe(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}}var Ie=(e=>(e.Ready="ready",e.NoSurvey="no survey",e))(Ie||{}),gc=(e=>(e.Preview="sprigPreviewKey",e))(gc||{});const wg=["popState","pushState","replaceState"],bg={test:"test"},gn="!email",Eg=["ios","android"],Ut="environments",fo="pageUrl",St="visitors",As="ul-view-sdk-script",Us=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 oa(e,t){const{matchType:n,pattern:r}=e,i=n?Us[n]:Us.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 xg(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?oa(a,window.location.href):t===window.location.href}function Mn(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&&Ec(window.location.href),n&&(_c(),Sg()),r&&a&&a!==window.location.href&&e&&wg.includes(e.type)&&window.UserLeap("dismissActiveSurvey",Ke.PageChange)}const yc={capture:!0},Sg=()=>{const t=window.UserLeap._config.interactiveEvents.filter(r=>oa(r,window.location.href)).map(r=>{const{name:i,properties:o}=r,{selector:a,innerText:s}=o;return a?l=>{if(Jt(l.target))try{l.target.closest(a)&&window.UserLeap("track",i)}catch{}return!1}:l=>(Jt(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,yc)},_c=()=>{window.UserLeap._config.interactiveEventsHandler&&window.removeEventListener("click",window.UserLeap._config.interactiveEventsHandler,yc),delete window.UserLeap._config.interactiveEventsHandler};function Cg(){["hashchange","popstate"].forEach(e=>window.addEventListener(e,Mn,!0))}function Ig(){["hashchange","popstate"].forEach(e=>window.removeEventListener(e,Mn,!0)),window.UserLeap._config.interactiveEvents&&_c()}function Qe(e,t,n){const r=[window.UserLeap._API_URL,"sdk",e];return t&&t.forEach(i=>{r.push(i),i===Ut?r.push(window.UserLeap.envId):i===St&&r.push(aa())}),n&&r.push(n),r.join("/")}function kg(e,t){let n=Qe("1",[Ut],"questions?");return e!=null&&(n+=`&vid=${e}`),t&&(t.surveyId&&(n+=`&surveyid=${t.surveyId}`),t.surveyTemplateId&&(n+=`&surveytemplateid=${t.surveyTemplateId}`),t.previewLanguage&&(n+=`&previewLanguage=${encodeURIComponent(t.previewLanguage)}`)),n}function wc(){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(be.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 we(e,t){if(!window.UserLeap.localStorageAvailable)return;const n=localStorage.getItem(be.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(be.Credentials,JSON.stringify(r))}catch(o){o instanceof Error&&console.warn(`[Sprig] (ERR-426) Unable to write to Local Storage:: ${o.message}`)}}function bc(){window.previewMode||(window.UserLeap.visitorId=mt(),we("vid",window.UserLeap.visitorId),$.emit(B.VisitorIDUpdated,{visitorId:window.UserLeap.visitorId}))}function aa(){return window.previewMode?"0":window.UserLeap.visitorId||""}function Ec(e,t,n){if(!window.UserLeap.localStorageAvailable||e.endsWith("mock_snippet.html"))return;const r=window.UserLeap._config.pageUrlEvents;let i=!1;if(r&&r.length)for(let c=0;c<r.length&&(i=oa(r[c],e),!i);c++);if(!i)return;window.UserLeap.debugMode&&console.info("[DEBUG] Sprig trackPageView",e);const o=10,a=1;let s=[];const l={viewedAt:Date.now(),location:e},u=localStorage.getItem(be.PageViews);try{if(s=u?JSON.parse(u):[],Array.isArray(s)||(s=[]),s.length>0){const c=s[s.length-1],d=(Date.now()-c.viewedAt)/1e3;c.location!=e&&d>a&&Wa({url:e}),(c.location!=e&&d>a||d>o)&&(window.UserLeap._queue.push(["track",fo,t,{url:e},n]),s.push(l))}else window.UserLeap._queue.push(["track",fo,t,{url:e},n]),s.push(l),Wa({url:e});s.length>5&&s.splice(0,s.length-5);try{localStorage.setItem(be.PageViews,JSON.stringify(s))}catch(c){c instanceof Error&&console.warn(`[Sprig] Unable to write to Local Storage: ${c.message}`)}}catch(c){c instanceof Error&&window.UserLeap.reportError("trackPageView",c,{pageViewsStorage:u}),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),Mn(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),Mn(o),i})(e.replaceState)),Cg()}async function Ei(e,t){const n=aa();e&&!t&&(window.UserLeap._config.mode=bg.test);const r=await ft(kg(n,{...e,previewLanguage:window.UserLeap._config.previewLanguage}),{},0,!0);return r.ok?(r.json.delay&&await Sr(r.json.delay),xc(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:Ie.NoSurvey})}const Lg=e=>e.some(t=>t.type===T.VideoVoice),xc=async e=>{var k,P,R,O,Y,ae;const{context:t,forceBrandedLogo:n,endCard:r,locale:i,productConfig:o,questions:a,responseGroupUid:s,surveyId:l,uuid:u,vid:c,sessionReplay:d}=e,f=en(window.UserLeap),p=sa(f),h=Rg(f);if(d&&ql({responseGroupId:s,surveyId:l,visitorId:c,replayParams:d,completeUploadHeaders:f,apiUrl:window.UserLeap._API_URL,triggerTimestamp:Date.now(),isStandalone:a.length===0}),c==null||!a||!a.length)return{success:!1,message:"[Sprig] no survey found",surveyState:Ie.NoSurvey};if(((P=(k=window.UserLeap)==null?void 0:k._config)==null?void 0:P.installationMethod)===rt.NpmBundled&&Lg(a))return{success:!1,message:"[Sprig] bundled version does not support video voice",surveyState:Ie.NoSurvey};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:Ie.NoSurvey}}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:Ie.NoSurvey}}ov({id:l}),Ii.disable(),$.emit(B.SurveyWillPresent,{name:B.SurveyWillPresent,[Os.SurveyId]:l});let v,g=document.createElement("div"),w,_,b;const E=G=>{const{[Lt.ViewVersion]:ue}=G;ue!==f["x-ul-sdk-version"]&&hc(),$.removeListener(Re.VerifyViewVersion,E)};$.on(Re.VerifyViewVersion,E),Wt(f)?(v="ul-direct-embeded-frame",w=document.head,_=window,b=!1,p&&(pc(),g.id=v,window.UserLeap.container.appendChild(g),vc(),$.emit(B.SurveyLifeCycle,{state:"presented"}),$.emit(B.SurveyPresented,{name:B.SurveyPresented}))):{frameId:v,contentWinDocHead:w,contentWindow:_,hasOverlay:b,iframe:g}=fg(o,h),window.UserLeap.frameId=v,window.UserLeap.useMobileStyling=h;const m=G=>{$.on(B.CloseSurveyOnOverlayClick,G)},x=Object.assign({frame:g,envId:window.UserLeap.envId,surveyId:l,userId:u,visitorAttributes:{externalUserId:window.UserLeap.userId,email:window.UserLeap.email},cards:a,context:t,locale:i,fontFamily:window.UserLeap.fontFamily,fontFamilyURL:window.UserLeap.fontFamilyURL,apiURL:window.UserLeap._API_URL,responseGroupUid:s,headers:f,endCard:r,useMobileStyling:h,mobileSDKVersion:window.UserLeap.mobileSDKVersion,configureExitOnOverlayClick:m,eventEmitFn:$.emit.bind($),ulEvents:ho,viewDocument:_==null?void 0:_.document,viewWindow:_,tabTitle:document.title,startingQuestionIdx:(R=window.UserLeap.config)==null?void 0:R.startingQuestionIdx,styleNonce:window.UserLeap.styleNonce,previewKey:(O=window.UserLeap)!=null&&O.localStorageAvailable?(Y=window.localStorage)==null?void 0:Y.getItem(be.Preview):null,forceBrandedLogo:n},window.UserLeap._config);(ae=window.UserLeap.config)!=null&&ae.startingQuestionIdx&&(window.UserLeap.config={...window.UserLeap.config,startingQuestionIdx:null}),window.UserLeap.customStyles&&(x.customStyles=window.UserLeap.customStyles),_&&(_.__cfg=x);function I(){const G=document.createElement("script");return window.UserLeap.nonce&&G.setAttribute("nonce",window.UserLeap.nonce),G.id=As,G}const C=window.UserLeap.viewSDKURL?window.UserLeap.viewSDKURL:x.path,S=document.getElementById(As);S&&S.remove();const L=I(),D=()=>{window.UserLeap.container&&Object.assign(window.UserLeap.container.style,{display:"flex"})};return x.installationMethod===rt.Npm||x.installationMethod===rt.NpmBundled?(ag.configure(x),b&&window.UserLeap.container&&D()):C&&(L.src=C,b&&L.addEventListener("load",()=>{window.UserLeap.container&&D()}),_==null||_.addEventListener("error",G=>{G.target instanceof HTMLScriptElement&&G.target.src===C&&window.UserLeap.reportError("loadFrameScript",new Error("Frame script failed to load"))},{capture:!0,once:!0})),w==null||w.appendChild(L),{success:!0,surveyState:Ie.Ready,surveyId:l,responseGroupUid:s}};function Rg(e){if(window.UserLeap.useMobileStyling!==void 0)return window.UserLeap.useMobileStyling;const t=window.UserLeap.windowDimensions&&window.UserLeap.windowDimensions.width||document.body.clientWidth;return sa(e)||t>10&&t<Af}function sa(e){return Eg.includes(e[He.Platform])}function Ag(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 Ug(e){if(!e)return;window.UserLeap._config=e,e.mute&&window.UserLeap._queue.pause();const{interactiveEvents:t,pageUrlEvents:n,dismissOnPageChange:r}=e;t&&Ag(t),(t||n||r)&&(Tg(),Mn())}async function ft(e,t,n=0,r=!1){var o,a;t.headers=Object.assign(en(window.UserLeap),t.headers);const i=await it(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(He.VisitorID);u&&c&&(c!==window.UserLeap.visitorId||window.UserLeap.token!==u)&&(we("token",u),we("vid",c),$.emit(B.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,t){var r,i;let n=!0;return t&&((r=e==null?void 0:e.json)==null?void 0:r.surveyId)&&(window.UserLeap.delayingSurvey=!0,n=await t(e.json.surveyId),window.UserLeap.delayingSurvey=!1,!n)?!1:((i=e==null?void 0:e.json)!=null&&i.delay&&(window.UserLeap.delayingSurvey=!0,await Sr(e.json.delay),window.UserLeap.delayingSurvey=!1),n)}const Dg=function(e){if(!window.UserLeap)return;const t=async(r={})=>{var v,g,w,_,b;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&&(v=localStorage.getItem(be.Preview))!=null?v: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:Ie.NoSurvey}}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:Ie.NoSurvey}}const d=window.location.href;if(a.url||(a.url=d),we("trackStartUrl",d),(w=(g=window.UserLeap)==null?void 0:g._config)!=null&&w.optimizelyEnabled){const E=en(window.UserLeap);sa(E)||_r.getAndSetWebOptimizelyExperiments(),a.optimizelyExperiments=Object.assign({},_r.getAllOptimizelyExperiments())}(b=(_=window.UserLeap)==null?void 0:_._config)!=null&&b.launchDarklyEnabled&&(a.launchDarklyFlags=co.getAllLaunchDarklyVariations()),i&&(window.UserLeap.userId=i),o&&(window.UserLeap.partnerAnonymousId=o),s&&(a.eventProperties=s),iv({name:u});const f=window.UserLeap.delayingSurvey?await ft(Qe("1",[St],"events/batch"),{body:JSON.stringify({events:[{event:u,metadata:a}],previewKey:c}),method:"POST"},0,!0):await ft(Qe("1",[St],"events"),{body:JSON.stringify({event:u,metadata:a,previewKey:c}),method:"POST"},0,!0);if(!f.ok){const E="[Sprig] (ERR-421) Failed to track event";return f.reportError&&(console.warn(E,f.error),f.error&&window.UserLeap.reportError("track",f.error)),{success:!1,message:E,error:f.error,surveyState:Ie.NoSurvey}}i&&we("uid",i),o&&we("aid",o);const p=f.json;return p.invalidPreviewKey&&window.UserLeap.localStorageAvailable&&localStorage.removeItem(be.Preview),await Og(f,l)?xg(p.eventId,d)?xc(p):{success:!1,message:"Study should not be displayed after page navigation",surveyState:Ie.NoSurvey}:{success:!1,message:"[Sprig] Callback returned false, aborting rendering of survey",surveyState:Ie.NoSurvey}},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",Ke.Override),Ei({surveyId:r},!0)},_previewSurvey(r){window.UserLeap("dismissActiveSurvey",Ke.Override),Ei({surveyTemplateId:r},!1)},_reviewSurvey(r){window.UserLeap("dismissActiveSurvey",Ke.Override),Ei({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=Ke.API){$.emit(B.SurveyWillClose,{name:B.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,gn)&&(a[gn]=a.email,delete a.email),l=await ft(Qe("1",[Ut,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 ft(Qe("1",[Ut,St]),{body:JSON.stringify(s),method:"PUT"}),a&&a[gn]&&(window.UserLeap.email=a[gn]),l.ok&&(i&&we("uid",i),o&&we("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 ft(Qe("1",[Ut,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){$.on(B.SurveyLifeCycle,r)},async removeSurveyListener(r){$.removeListener(B.SurveyLifeCycle,r)},async addListener(r,i){$.on(r,i)},async removeListener(r,i){$.removeListener(r,i)},async removeAllListeners(){$.removeAllListeners()},setPreviewKey(r){if(!r||typeof r!="string")return;const i=wc();window.UserLeap.localStorageAvailable=i,i&&r&&localStorage.setItem(be.Preview,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 ft(Qe("1",[Ut,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&&za(),we("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,we("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)},trackPageView(r,i=void 0,o=void 0){Ec(r,i,o)},applyStyles(r){if(window.UserLeap.customStyles=r,window.UserLeap.container){const i=window.UserLeap.container.children[0].contentDocument;if(i){const o=i.getElementById(U.CustomStyle);o?o.textContent=r:Xs(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(Js(s.contentDocument))+"px")),$.emit(B.SurveyDimensions,{name:B.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(be.Credentials),localStorage.removeItem(be.PageViews)),window.UserLeap._queue.isPaused()&&window.UserLeap._queue.empty(),bc(),za(),window.UserLeap._queue.unpause()},teardown(){Ig(),window.UserLeap("dismissActiveSurvey",Ke.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;_r.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(Cf.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)},setVisitorAttribute(r,i){return console.warn("[Sprig] setVisitorAttribute is deprecated. Please use setAttribute"),n.setAttribute(r,i)},async setEmail(r){return n.setAttribute(gn,r)},async setVisitorEmail(r){return console.warn("[Sprig] setVisitorEmail is deprecated. Please use setEmail"),n.setEmail(r)},async _generateVideoUploadUrl(r){return Vg(r)},async _completeSessionReplay({surveyId:r,responseGroupUuid:i,eventDigest:o}){if(!r||!i)return;const a=window.UserLeap._API_URL;try{await sl({surveyId:r,responseGroupUuid:i,eventDigest:o,apiUrl:a,headers:en(window.UserLeap)},!0)}catch(s){console.warn("[Sprig] Error with completing session replay"),s instanceof Error&&window.UserLeap.reportError("completeSessionReplay",s)}}};Object.assign(window.UserLeap,n)};async function Pg(e){const t=en(window.UserLeap);document.addEventListener("securitypolicyviolation",ki);const n=await it(Qe("1",[Ut],"config"),{headers:t}),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)):document.removeEventListener("securitypolicyviolation",ki),!n.ok)return n.reportError&&(console.warn("[Sprig] (ERR-422) Failed to load configuration",n.error),n.error&&window.UserLeap.reportError("applyRemoteConfig",n.error)),Ti("Disabled: failed to fetch configuration"),e;const i=n.json;return i!=null&&i.disabled?(Ti(`Disabled: ${i.disabled}`),{disabled:i.disabled}):Object.assign({},i,e)}async function Ng(e,t,n={}){const r=window.__cfg&&window.__cfg.mode,i=aa(),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 ft(Qe("1",null,"errors"),{method:"POST",headers:{[He.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)}async function Vg(e){var n;if(!e)return;const t=`${window.UserLeap._API_URL}/2/environments/integrations/upload`;try{const r=await fetch(t,{method:"POST",cache:"no-cache",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(r.ok){const i=await r.json();return(n=i==null?void 0:i.upload)==null?void 0:n.url}else return null}catch(r){console.warn("[Sprig] Error with generating video upload url"),r instanceof Error&&window.UserLeap.reportError("generateVideoUploadUrl",r)}}function Mg(e={}){var i;const t=(i=new URLSearchParams(window.location.search).get(gc.Preview))!=null?i:"",n=wc();window.UserLeap.localStorageAvailable=n,window.UserLeap.UPDATES=ho,window.UserLeap("setPreviewKey",t);async function r(){if(window.UserLeap.loaded)return;if(window.UserLeap.reportError=Ng,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 u in window.UserLeap._config)window.UserLeap[u]=window.UserLeap._config[u];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 o=window.UserLeap.sampleRate;if(o)if(!n)window.UserLeap.debugMode&&console.info("[DEBUG] Sprig cannot sample users without localStorage permissions");else{let u=Ct("sampled");if(u===null&&(u=Math.random()<o,we("sampled",u)),!u)return}else n&&Ct("sampled")!==null&&we("sampled",null);window.UserLeap._API_URL||(window.UserLeap._API_URL="https://api.sprig.com");const a=[...window.UserLeap._queue];window.UserLeap._queue=new _g(window.UserLeap,[]),window.UserLeap._queue.pause();for(let u=0;u<a.length;u++)window.UserLeap._queue.push(a[u]);const s=Ct("token");s?(window.UserLeap.token=s,window.UserLeap.visitorId=Ct("vid"),window.UserLeap.userId=Ct("uid"),window.UserLeap.partnerAnonymousId=Ct("aid")):(window.UserLeap.localStorageAvailable&&localStorage.removeItem(be.Credentials),bc());const l=await Pg(e);qh(window.document,l.maxReplayDurationSeconds,window.UserLeap.replayNonce,window.UserLeap.maxInflightReplayRequests,l.replaySettings),Dg(l),await Ug(l),window.UserLeap._queue.unpause(),$.emit(B.SDKReady),$.emit(B.VisitorIDUpdated,{visitorId:window.UserLeap.visitorId})}document.readyState==="complete"?r():window.attachEvent?window.attachEvent("onload",r):window.addEventListener("load",r,!1)}class Br{constructor(){fe(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)}trackPageView(t,n,r){window.Sprig("trackPageView",t,n,r)}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="web-npm",window.Sprig)return window.Sprig;window.Sprig=function(){window.Sprig._queue.push(arguments)},Object.getOwnPropertyNames(Br.prototype).map(n=>{n!=="constructor"&&(window.Sprig[n]=Br.prototype[n])});const t=window.Sprig;return t.appId=e.envId,t._queue=[],window.UserLeap=t,Mg(e),window.Sprig}},jg={sprig:po,SprigAPI:Br,configure:po.configure};exports.DismissReason=Ke;exports.SprigAPI=Br;exports.SprigEvent=B;exports.default=jg;exports.sprig=po;
703
+ `,gg=e=>{const t=M.document.createElement("div");return t.className="ul-video-player-loading",t.id=ca(e),["first","second","third","fourth"].map(n=>{const r=M.document.createElement("div");r.className=n,t.appendChild(r)}),t},ca=e=>e+"-loading-spiner",se="hidden",Os=".m3u8",bi="questionId",Ei="ul-video-recorder-camera-off-button",xi="ul-recording-in-session",yg=[{type:"link",content:`${Rt}/dependencies/videojs-record-4.5.0.min.css`},{type:"script",content:`${Rt}/dependencies/RecordRTC-5.6.2.js`},{type:"script",content:`${Rt}/dependencies/adapter.8.0.0.min.js`},{type:"script",content:`${Rt}/dependencies/videojs-record-4.5.0.min.js`},{type:"script",content:`${Rt}/userleap-web-upchunk-v2.2.2.js`}],bc=[{type:"link",content:`${Rt}/dependencies/video-js-7.18.0.min.css`},{type:"script",content:`${Rt}/dependencies/video-js-7.18.0.min.js`},{type:"style",content:mg}],Ec="-video-player",xc="-secondary-video-player",Sc="-video-recorder";let $e,Ds;const vt=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)},et=async(e,t,n,r,i,o)=>{vt({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)},_g=(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)}),Cc=(e,t)=>{if(e.length===0)return t&&t();Promise.all(e.reduce((n,r)=>(n.push(_g(M.document.head,r)),n),[])).then(()=>{M.videojs=M.document.defaultView.videojs,t&&t()}).catch(function(n){console.log(n+" failed to load")})},Ps=(e,t,n)=>{if(t==="start"&&(e.style.visibility="visible"),t==="none")e.style.visibility=se;else if(t==="success")e.style.visibility=se,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%)`}},Si=(e,t)=>{const n=M.videojs(e.id());return n==null?void 0:n.payload[t]},wg=(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}),vt({event:"Video Permission Denied",apiBase:t,headers:i,visitorId:s,envId:l,metadata:{questionId:Si(e,bi),responseGroupUid:a,surveyId:o}})):(n&&n(B.ERROR,{type:B.OTHER}),et(new Error(e.deviceErrorCode.message),"recorderDeviceError",t,i,s,l))}),e.on("error",function(u,c){et(c||e.error(),"recorderError",t,i,s,l)}),e.on("startRecord",function(u,c){r(e.uploadProgressLabel,"none"),vt({event:"Video Record Start",apiBase:t,headers:i,visitorId:s,envId:l,metadata:{questionId:Si(e,bi),responseGroupUid:a,surveyId:o}})}),e.on("finishRecord",async function(){r(e.uploadProgressLabel,"start",0);const u=Si(e,bi);if(!o){const h="internal error: missing fields in payload";return n&&n(B.ERROR,{type:B.OTHER}),et(new Error(h),"finishRecord",t,i,s,l),null}e.record().stopDevice();const c=e.cameraOff?B.MEDIA_TYPE_AUDIO:B.MEDIA_TYPE_VIDEO,d=at();vt({event:"Video Record Finish",apiBase:t,headers:i,visitorId:s,envId:l,metadata:{mediaRecordingUid:d,questionId:u,responseGroupUid:a,surveyId:o,mediaType:c}});const f={surveyId:o,updatedAt:new Date().toISOString(),mediaType:c,mediaRecordingUid:d};u&&(f.questionId=u),a&&(f.responseGroupUid=a),s&&(f.visitorId=s);const v=await(async()=>{const h=await fetch(`${t}/2/environments/integrations/upload`,{method:"POST",cache:"no-cache",headers:{"Content-Type":"application/json"},body:JSON.stringify(f)});if(h.ok){const g=await h.json();return n&&n(B.UPLOAD_STARTED,{[B.UPLOAD_ID]:g.upload.id,[B.MEDIA_TYPE]:c,[B.MEDIA_RECORDING_UID]:d}),g.upload.url}else return n&&n(B.ERROR,{type:B.OTHER,response:h}),et(new Error("failed to get upload response with url"),"finishRecord",t,i,s,l),null})();!v||($e=M.document.defaultView.UpChunk.createUpload({endpoint:v,file:new M.document.defaultView.File([e.recordedData],`recording ${c} ${Date.now()}`),chunkSize:5120}),$e.startTime=Date.now(),vt({event:"Video Upload Start",apiBase:t,headers:i,visitorId:s,envId:l,metadata:{mediaRecordingUid:d,questionId:u,responseGroupUid:a,surveyId:o,mediaType:c,url:v}}),$e.on("error",h=>{r(e.uploadProgressLabel,"none"),n&&n(B.UPLOAD_FINISHED,{[B.MEDIA_RECORDING_UID]:d}),et(h,"finishRecord",t,i,s,l)}),$e.on("progress",h=>{n&&n(B.UPLOAD_PROGRESS,{[B.MEDIA_RECORDING_UID]:d,[B.UPLOAD_PROGRESS_PCT]:h.detail}),r(e.uploadProgressLabel,"progress",h.detail)}),$e.on("success",()=>{r(e.uploadProgressLabel,"success"),n&&n(B.UPLOAD_FINISHED,{[B.MEDIA_RECORDING_UID]:d}),vt({event:"Video Upload Success",apiBase:t,headers:i,visitorId:s,envId:l,metadata:{mediaRecordingUid:d,questionId:u,responseGroupUid:a,surveyId:o,mediaType:c,url:v,elapsedMs:$e.startTime&&Date.now()-$e.startTime}})}))})},Ic=(e,t)=>{const n=new(M.videojs.getComponent("Component"))(e);return n.addClass("ul-buttons-panel"),t.map(r=>{n.addChild(r)}),bg(n),n},bg=e=>{e.children().forEach(t=>{if(De[t.name_]){const n=_r(De[t.name_],`ul-${De[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},kc=(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?Lg(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&&Sg(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)},Eg=(e,t,n)=>{e.addClass(`ul${xc}`);const r=new(M.videojs.getComponent("Component"))(e);t&&e.src(t),e.addChild(r),n&&n(e)},xg=(e,t,n,r,i,o,a,s=!1)=>{Ds=Date.now();const u=Br(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:d,responseGroupUid:f,visitorId:p,envId:v}=n;let h;const g=O=>{const T=Ei,D=Ei+"-audio-only";Ps(u.uploadProgressLabel,"none"),$e&&$e.startTime>=Ds&&$e.abort();const z=M.document.getElementById("ul-camera-button");O?(u.children()[0].classList.add("vjs-hidden"),b.removeClass(T),b.addClass(D),z.innerHTML=De.TurnOnCamera,u.audioPlayerPlaceholder.removeClass("vjs-hidden"),h==null||h.getTracks().forEach(C=>{C.stop()}),window.navigator.mediaDevices.getUserMedia({video:!0,audio:!0}).then(C=>{h=C,C.getVideoTracks().forEach(W=>{W.enabled=!1}),u.record().onDeviceReady(C)}).catch(u.record().onDeviceError.bind(u.record()))):(h==null||h.getVideoTracks().forEach(C=>{C.enabled=!0}),u.children()[0].classList.remove("vjs-hidden"),u.record().getDevice(),b.removeClass(D),b.addClass(T),z.innerHTML=De.TurnOffCamera,u.audioPlayerPlaceholder.addClass("vjs-hidden"))},_=new(M.videojs.getComponent("Button"))(u,{clickHandler:()=>{_.hasClass(se)||(vt({event:"Video Delete Button Clicked",apiBase:r,headers:a,visitorId:p,envId:v,metadata:{questionId:d,responseGroupUid:f,surveyId:c}}),g(u.cameraOff),i(B.DELETE,{}),b.removeClass(se),_.addClass(se))}});_.addClass("ul-video-recorder-delete-button"),_.el_.appendChild(_r(De.DeleteButton,"ul-delete-button"));const w=M.document.getElementById(t),E=()=>{w.classList.contains("vjs-fullscreen")&&u.cameraOff?w.style.display="table":w.style.display="flex"};E();const b=new(M.videojs.getComponent("Button"))(u,{clickHandler:()=>{u.record().isRecording()||(u.cameraOff=!u.cameraOff,vt({event:"Video Camera Button Clicked",apiBase:r,headers:a,visitorId:n.visitorId,envId:n.envId,metadata:{questionId:d,responseGroupUid:f,surveyId:c,cameraOff:u.cameraOff}}),g(u.cameraOff),!_.hasClass(se)&&_.addClass(se),i(B.DELETE,{}),E())}});b.addClass(Ei),b.el_.appendChild(_r(De.TurnOffCamera,"ul-camera-button"));const m=new(M.videojs.getComponent("Button"))(u,{clickHandler:()=>{const O=M.document.getElementById("ul-recorder-toggle");if(u.record().isRecording())u.record().stop(),O&&(O.innerHTML=De.RecordButton),m.removeClass(xi),_.removeClass(se);else{const T=M.document.getElementById("ul-recording-countdown-screen");if(T)T.remove(),O&&(O.innerHTML=De.RecordButton),g(u.cameraOff),i(B.DELETE,{}),b.removeClass(se),_.addClass(se),m.removeClass(xi),S.show();else{m.addClass(xi),S.hide(),b.addClass(se),_.addClass(se),O&&(O.innerHTML=De.StopButton);const D=M.document.createElement("div");D.id="ul-recording-countdown-screen",w.insertBefore(D,w.children[1]),D.style.height=`${w.offsetHeight}px`,Tc(u,3)}}}});m.addClass("ul-video-recorder-toggle-button"),m.el_.appendChild(_r(De.RecordButton,"ul-recorder-toggle"));const x=M.document.createElement("p");x.style.visibility="hidden",x.className="ul-upload-progress-label",e.appendChild(x),u.uploadProgressLabel=x;const k=Ic(u,[_,b,"PlayToggle",m,"FullscreenToggle"]),S=k.children().find(O=>O.name_==="FullscreenToggle");S.hasClass("vjs-disabled")&&S.hide();const I=k.children().find(O=>O.name_==="PlayToggle");I.hide(),o&&b.addClass(se),!o&&_.addClass(se),kc(u,k,o,!1,s),u.on("stopRecord",()=>{m.hide(),I.show(),S.show(),_.removeClass(se)}),u.on("deviceReady",()=>{m.show(),I.hide(),_.addClass(se)}),wg(u,r,i,Ps,a),o&&(u.deviceButton&&u.deviceButton.hide(),u.src(o),I.show(),m.hide(),_.removeClass(se));const R=[{name:"microphone"}];!u.cameraOff&&R.push({name:"camera"}),Promise.all(R.map(O=>{var T;return(T=navigator==null?void 0:navigator.permissions)==null?void 0:T.query(O)})).then(O=>{O.reduce((D,z)=>D&z.state==="granted",!0)&&u&&(u.deviceButton&&u.deviceButton.hide(),!o&&u.record().getDevice())}).catch(O=>{})},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))},Lc=e=>{const t=M.document.createElement("div");return t.className="ul-video-container",t.appendChild(gg(e)),t},vo=(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},Sg=(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%")},Br=(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),Cg=(e,t,n,r=!1,i="https://api.sprig.com",o=document,a=null,s=null)=>{M.document=o;const l=e+Ec,u=Lc(l);return M.document.addEventListener("securitypolicyviolation",c=>{et(new Error(`Voice & Video feature violates ${c.violatedDirective} web page CSP policies for the question player.`),"playerDeviceError",i,{})}),Cc(bc,()=>{M.document.getElementById(ca(l)).remove(),vo(l,u);const c={playsinline:!0,playbackRates:[.5,1,1.5,2],fill:!0};try{const d=e+xc;vo(d,u);const f=Br(l,c),p=Br(d,{muted:!0,...c});if(!f||!p)return;Eg(p,a,s),a||p.addClass(se);const v=Ic(f,["PlaybackRateMenuButton","PlayToggle","FullscreenToggle"]),h=v.children().find(g=>g.name_==="FullscreenToggle");h.hasClass("vjs-disabled")&&h.hide(),kc(f,v,t,n,r,p)}catch(d){et(new Error(`Error when creating video player object ${d}`),"playerDeviceError",i,{});return}}),u},Ig=(e,t={},n="https://api.userleap.com",r,i,o,a=!1,s=document)=>{M.document=s;const l=e+Sc,u=Lc(l);return M.document.addEventListener("securitypolicyviolation",c=>{et(new Error(`Voice & Video feature violates ${c.violatedDirective} web page CSP policies for the recorder player.`),"recorderDeviceError",n,o,t.visitorId,t.envId)}),Cc(bc.concat(yg),()=>{vo(l,u),M.document.getElementById(ca(l)).remove();try{xg(u,l,t,n,r,i,o,a)}catch(c){et(new Error(`Error when creating video recorder player object ${c}`),"recorderDeviceError",n,o,t.visitorId,t.envId);return}}),u},kg=e=>{const t=e+Sc;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()}},Tg=e=>{const t=Br(e+Ec);t==null||t.pause()},Lg=e=>{if(!e)return null;const t=e.match(/https:\/\/stream.mux.com\/(.*)/);let n=t?t[1]:null;return n.includes(Os)&&(n=n.replace(Os,"")),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"},De={PlaybackRateMenuButton:"Speed",PlayToggle:"Play",FullscreenToggle:"Expand",TurnOnCamera:"Turn on",TurnOffCamera:"Turn off",DeleteButton:"Delete",RecordButton:"Record",StopButton:"Stop",PauseButton:"Pause"},yn="ul-card-video__player_recorder",Rg="ul-card-video__skip_button",Ag="ul-video-interview-form",Ns="ul-video-btn",Ug=({className:e,message:t,next:n,properties:r,questionId:i,type:o})=>{const{apiURL:a,envId:s,handleUploadUpdate:l,headers:u,responseGroupUid:c,surveyId:d,viewDocument:f,visitorId:p}=X(T=>({apiURL:T.apiURL,envId:T.envId,handleUploadUpdate:T.handleUploadUpdate,headers:T.headers,responseGroupUid:T.responseGroupUid,surveyId:T.surveyId,viewDocument:T.viewDocument,visitorId:T.userId})),[v,h]=le(!1),[g,_]=le(null),[w,E]=le(null),[b,m]=le(0),x=r&&r.videoUrl,k=(T,D)=>{T===B.UPLOAD_STARTED?(_(D[B.UPLOAD_ID]),E(D[B.MEDIA_RECORDING_UID]),h(!0)):T===B.DELETE?(_(null),E(null),h(!1)):T===B.UPLOAD_PROGRESS?isNaN(D[B.UPLOAD_PROGRESS_PCT])?l({mediaRecordingUid:D[B.MEDIA_RECORDING_UID],isComplete:!0}):l({mediaRecordingUid:D[B.MEDIA_RECORDING_UID],progressPct:D[B.UPLOAD_PROGRESS_PCT]}):T===B.UPLOAD_FINISHED&&l({mediaRecordingUid:D[B.MEDIA_RECORDING_UID],isComplete:!0})},S=T=>{if(T&&T.children.length===0){const D=Cg(yn,{src:x,type:"application/x-mpegURL"},void 0,r.mediaType===B.MEDIA_TYPE_AUDIO,a,f);T.appendChild(D)}},I=T=>{if(T&&T.children.length===0){const D=Ig(yn,{surveyId:d,responseGroupUid:c,questionId:i,visitorId:p,envId:s},a,k,void 0,{...u,"x-ul-video-recorder-origin":"sdk"},r.mediaType===B.MEDIA_TYPE_AUDIO,f);T.appendChild(D)}},R=T=>{T.preventDefault(),T.stopPropagation(),kg(yn),g&&w?(l({mediaRecordingUid:w,isSubmitted:!0}),n({value:{mediaRecordingUid:w},questionId:i,type:o})):n({value:null,questionId:i,type:o})},O=()=>y(ct,{defaultBody:()=>y("button",{className:`${Ns} ul-record-response-btn`,onClick:T=>{T.preventDefault(),T.stopPropagation(),Tg(yn),m(1)}}),properties:r});return y("form",{className:H([e,U.VideoCard,U.FadeInTransition]),id:Ag,children:[y(Be,{message:t,properties:r}),y("div",{id:"ul-card-voice__video",children:[y("div",{children:[y("div",{id:"ul-question-player-container",style:{display:b===0?"":"none"},children:[y("div",{id:yn,ref:S}),O()]}),y("div",{style:{display:b===1?"block":"none"},children:[y("button",{className:`${Ns} ul-back-question-btn`,onClick:T=>{T.preventDefault(),T.stopPropagation(),m(0)}}),y("div",{id:"ul-recorder-player-container",ref:I})]})]}),y(ye,{disabled:!v,onClick:R,children:Gt(r)}),y("button",{className:`ul-card-text__button ${U.InactiveButton} ${U.SkipButton}`,id:Rg,onClick:R,style:{display:r.required?"none":"block",...v?{display:"none"}:{}},children:sa(r)})]})]})},Og=({className:e})=>{const{uploadProgress:t}=X(o=>({uploadProgress:o.uploadProgress}));let n,r;Object.values(t).filter(o=>o.isSubmitted).length>1?(n="Your responses are processing",r="Please keep this tab open until your responses are fully processed."):(n="Your response is processing",r="Please keep this tab open until your response is fully processed.");const i=Math.round(Math.min(99,...Object.values(t).filter(o=>o.isSubmitted).map(o=>o.progressPct||0)));return y("div",{className:H([e,"ul-card--uploading",U.FadeInTransition]),children:[y("div",{"aria-busy":"true","aria-label":"Processing...","aria-live":"polite",className:U.LoadingSpinnerContainer,role:"progressbar",children:y("div",{className:U.LoadingSpinner,children:[y("div",{className:U.LoadingSpinnerFirst}),y("div",{className:U.LoadingSpinnerSecond}),y("div",{className:U.LoadingSpinnerThird}),y("div",{className:U.LoadingSpinnerFourth})]})}),y(Be,{message:`${n} (${i}% complete)`}),y("p",{className:U.Caption,children:r})]})},Ms=({logoOnly:e=!1,style:t={}})=>y("svg",{alt:`${e?"Powered by ":""}Sprig`,width:e?"35":"112",height:"15",viewBox:e?"79 0 31 15":"0 0 112 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{display:"block",...t},children:[!e&&y("path",{d:"M0.648926 12.0181V2.8584H4.21631C6.0127 2.8584 7.25684 4.06445 7.25684 5.86084V5.87354C7.25684 7.66357 6.0127 8.88867 4.21631 8.88867H2.0708V12.0181H0.648926ZM3.86084 4.05811H2.0708V7.69531H3.86084C5.09229 7.69531 5.80957 7.02881 5.80957 5.87988V5.86719C5.80957 4.72461 5.09229 4.05811 3.86084 4.05811ZM11.6621 12.1514C9.63721 12.1514 8.39941 10.7993 8.39941 8.57764V8.56494C8.39941 6.34961 9.64355 4.99121 11.6621 4.99121C13.6743 4.99121 14.9185 6.34326 14.9185 8.56494V8.57764C14.9185 10.7993 13.6807 12.1514 11.6621 12.1514ZM11.6621 11.0024C12.8428 11.0024 13.5156 10.1011 13.5156 8.57764V8.56494C13.5156 7.03516 12.8428 6.14014 11.6621 6.14014C10.4751 6.14014 9.80859 7.03516 9.80859 8.56494V8.57764C9.80859 10.1074 10.4751 11.0024 11.6621 11.0024ZM17.6226 12.0181L15.7183 5.12451H17.1021L18.3398 10.4438H18.4414L19.8633 5.12451H21.1709L22.5928 10.4438H22.7007L23.9321 5.12451H25.2969L23.3989 12.0181H21.9834L20.5552 6.87646H20.4473L19.0254 12.0181H17.6226ZM29.334 12.1514C27.3154 12.1514 26.0967 10.7739 26.0967 8.59033V8.58398C26.0967 6.43213 27.3408 4.99121 29.2642 4.99121C31.1875 4.99121 32.3682 6.38135 32.3682 8.45068V8.93311H27.4805C27.5059 10.2534 28.2295 11.0215 29.3657 11.0215C30.248 11.0215 30.7749 10.5835 30.9399 10.228L30.9653 10.1772L32.292 10.1709L32.2793 10.228C32.0508 11.1357 31.0986 12.1514 29.334 12.1514ZM29.2705 6.12109C28.3311 6.12109 27.6201 6.76221 27.4995 7.94922H31.0034C30.8955 6.71777 30.2036 6.12109 29.2705 6.12109ZM34.0059 12.0181V5.12451H35.3833V6.16553H35.4849C35.7324 5.43555 36.3735 5.00391 37.2939 5.00391C37.5161 5.00391 37.7573 5.03564 37.897 5.06738V6.33691C37.6494 6.28613 37.4146 6.25439 37.1543 6.25439C36.1006 6.25439 35.3833 6.90186 35.3833 7.89844V12.0181H34.0059ZM41.9277 12.1514C39.9092 12.1514 38.6904 10.7739 38.6904 8.59033V8.58398C38.6904 6.43213 39.9346 4.99121 41.8579 4.99121C43.7812 4.99121 44.9619 6.38135 44.9619 8.45068V8.93311H40.0742C40.0996 10.2534 40.8232 11.0215 41.9595 11.0215C42.8418 11.0215 43.3687 10.5835 43.5337 10.228L43.5591 10.1772L44.8857 10.1709L44.873 10.228C44.6445 11.1357 43.6924 12.1514 41.9277 12.1514ZM41.8643 6.12109C40.9248 6.12109 40.2139 6.76221 40.0933 7.94922H43.5972C43.4893 6.71777 42.7974 6.12109 41.8643 6.12109ZM49.1133 12.1323C47.3804 12.1323 46.2568 10.7422 46.2568 8.57764V8.56494C46.2568 6.38135 47.3613 5.00391 49.1133 5.00391C50.0591 5.00391 50.8652 5.47363 51.2334 6.21631H51.3413V2.42041H52.7124V12.0181H51.3413V10.9326H51.2334C50.8335 11.688 50.0781 12.1323 49.1133 12.1323ZM49.5068 10.958C50.6558 10.958 51.3604 10.0503 51.3604 8.57764V8.56494C51.3604 7.09229 50.6494 6.18457 49.5068 6.18457C48.3516 6.18457 47.6597 7.08594 47.6597 8.56494V8.57764C47.6597 10.0566 48.3516 10.958 49.5068 10.958ZM61.98 12.1323C61.0151 12.1323 60.2598 11.688 59.8599 10.9326H59.7583V12.0181H58.3809V2.42041H59.7583V6.21631H59.8599C60.228 5.47363 61.0342 5.00391 61.98 5.00391C63.7319 5.00391 64.8364 6.38135 64.8364 8.56494V8.57764C64.8364 10.7422 63.7192 12.1323 61.98 12.1323ZM61.5928 10.958C62.7417 10.958 63.4336 10.0566 63.4336 8.57764V8.56494C63.4336 7.08594 62.7417 6.18457 61.5928 6.18457C60.4438 6.18457 59.7329 7.09229 59.7329 8.56494V8.57764C59.7329 10.0503 60.4438 10.958 61.5928 10.958ZM66.8867 14.4429C66.7153 14.4429 66.5122 14.4302 66.3345 14.4111V13.3257C66.4678 13.3447 66.6392 13.3511 66.7979 13.3511C67.439 13.3511 67.8262 13.0781 68.0293 12.3799L68.1309 12.0244L65.6299 5.12451H67.1152L68.8418 10.6343H68.9624L70.6826 5.12451H72.1299L69.5654 12.2847C68.9814 13.9287 68.2832 14.4429 66.8867 14.4429Z",fill:"black",fillOpacity:"0.7"}),y("path",{d:"M81.1088 6.63629C79.6878 6.32154 78.9672 5.76865 78.9672 4.99369C78.9672 4.19299 79.736 3.5886 80.7556 3.5886C81.8066 3.5886 82.5995 4.25285 82.5995 5.13336V5.20352H84.0518V5.13336C84.0518 3.52424 82.6405 2.30774 80.7693 2.30774C79.8676 2.30774 79.0414 2.58451 78.4433 3.08655C78.1463 3.33144 77.9077 3.63818 77.7448 3.98479C77.5818 4.33141 77.4984 4.70934 77.5005 5.09153C77.4946 5.44197 77.5675 5.78934 77.714 6.10857C77.8605 6.42779 78.0769 6.71092 78.3475 6.93752C78.8512 7.37584 79.5659 7.70024 80.4709 7.90299C81.9949 8.23898 82.7676 8.81054 82.7676 9.60094C82.7676 10.4576 81.9258 11.1032 80.813 11.1032C79.6571 11.1032 78.7854 10.3856 78.7854 9.43424V9.36408H77.3318V9.43424C77.3318 11.1167 78.8219 12.3847 80.7973 12.3847C81.7421 12.3847 82.6093 12.0983 83.2393 11.5769C83.5519 11.3237 83.8034 11.0048 83.9753 10.6433C84.1472 10.2818 84.2352 9.88702 84.2329 9.48766C84.2329 8.05875 83.1833 7.09907 81.1088 6.63629Z",fill:"black",fillOpacity:"0.7"}),y("path",{d:"M89.2394 4.68276C88.6963 4.67605 88.1596 4.79915 87.6751 5.04156C87.1905 5.28397 86.7725 5.63851 86.4566 6.07497V4.85204H85.0747V14.8479H86.4566V11.0356C86.7725 11.472 87.1906 11.8265 87.6751 12.0688C88.1596 12.3111 88.6963 12.434 89.2394 12.4272C91.3836 12.4272 93 10.7627 93 8.55495C93 6.34723 91.3836 4.68276 89.2394 4.68276ZM91.5608 8.84202C91.5057 9.41605 91.2512 9.95356 90.8406 10.3633C90.4299 10.773 89.8883 11.0296 89.3078 11.0896C88.5363 11.1669 87.8177 10.9461 87.2841 10.4692C86.7505 9.99222 86.4566 9.3106 86.4566 8.55495C86.4566 7.10159 87.5538 6.00546 89.0087 6.00546C89.7619 6.00546 90.4421 6.29124 90.9171 6.81002C91.407 7.34232 91.6357 8.06385 91.5608 8.84202Z",fill:"black",fillOpacity:"0.7"}),y("path",{d:"M109.95 4.85407V6.06349C109.298 5.18298 108.292 4.68286 107.153 4.68286C105.017 4.68286 103.406 6.31709 103.406 8.48426C103.406 10.6514 105.017 12.285 107.153 12.285C108.296 12.285 109.303 11.79 109.95 10.9185V11.1046C109.95 12.6101 108.993 13.5826 107.513 13.5826C106.513 13.5826 105.68 13.1494 105.284 12.424L105.264 12.3867H103.838L103.871 12.48C104.112 13.1892 104.583 13.8001 105.211 14.2179C105.841 14.6324 106.637 14.8512 107.513 14.8512C108.637 14.8512 109.594 14.4972 110.28 13.8285C110.967 13.1597 111.332 12.2194 111.332 11.1213V4.85407H109.95ZM109.175 10.3502C108.588 10.905 107.752 11.138 106.879 10.9887C106.361 10.8984 105.886 10.6475 105.523 10.2725C105.16 9.89751 104.927 9.41787 104.859 8.90328C104.736 8.03757 104.999 7.21756 105.581 6.655C106.069 6.19093 106.723 5.93643 107.401 5.94699C107.565 5.94713 107.729 5.96026 107.891 5.98625C108.946 6.15489 109.781 7.01609 109.921 8.0852C110.039 8.96507 109.766 9.78958 109.175 10.3502Z",fill:"black",fillOpacity:"0.7"}),y("path",{d:"M101.89 2.12378C101.63 2.06766 101.358 2.11486 101.133 2.25518C100.908 2.39551 100.747 2.61769 100.687 2.87371C100.626 3.12973 100.67 3.39902 100.809 3.62339C100.947 3.84775 101.17 4.00917 101.428 4.07275C101.503 4.08936 101.58 4.09778 101.657 4.09786C101.906 4.09824 102.146 4.0083 102.331 3.84518C102.517 3.68206 102.636 3.45714 102.664 3.21327C102.693 2.9694 102.63 2.72361 102.487 2.5227C102.344 2.32179 102.132 2.17981 101.89 2.12378Z",fill:"black",fillOpacity:"0.7"}),y("path",{d:"M100.967 10.934H99.7755C98.9285 10.934 98.4196 10.3644 98.4196 9.40982C98.4196 8.4791 98.8757 7.36945 99.8054 6.01778L99.8178 5.99976V5.61807L95.8571 5.06453C95.8585 4.90331 95.8162 4.74466 95.7346 4.60501C95.653 4.46536 95.5352 4.34979 95.3932 4.27027C95.0381 4.07718 94.6498 4.07717 94.3279 4.26383C94.1667 4.35799 94.035 4.4945 93.9476 4.65816C93.8602 4.82182 93.8205 5.00623 93.8328 5.19087C93.8452 5.37552 93.9092 5.55315 94.0176 5.70402C94.1261 5.85489 94.2748 5.97309 94.4472 6.04546L93.2151 12.258H94.5833L95.7196 6.35891L97.8593 6.7155C97.284 7.73439 96.9921 8.68442 96.9921 9.53919C96.9921 11.1168 97.9577 12.1498 99.5187 12.2496V12.258H102.346V4.87723H100.967V10.934Z",fill:"black",fillOpacity:"0.7"})]}),Dg=()=>{const{border:e,cards:t,forceBrandedLogo:n,headers:r,index:i,marketingUrl:o,showSurveyBrand:a,slugName:s,surveyId:l,viewedCardCount:u}=X(E=>({border:E.border,cards:E.cards,forceBrandedLogo:E.forceBrandedLogo,headers:E.headers,index:E.index,marketingUrl:E.marketingUrl,showSurveyBrand:E.showSurveyBrand,slugName:E.slugName,surveyId:E.surveyId,viewedCardCount:E.viewedCardCount})),c=xt(null),d=t.filter(E=>E.type!==L.Uploading&&E.type!==L.Thanks),f=Nm(t,i),p=u+1,v=p/(p+f),h=`${o}?utm_source=survey_branding&utm_medium=website&utm_campaign=${s}&utm_content=${l}${n&&"&utm_term=poweredby_pill"}`;Ae(()=>{c.current&&(c.current.style.width=`${v*100}%`)},[v]);const g=()=>y(Ce,{children:[d.length>1&&y("div",{id:"ul-progress-bar-container",children:y("div",{id:"ul-progress-bar-current",ref:c,style:{border:`1px solid ${e||"#000"}`}})}),a?y("div",{className:n?"yellow-footer-logo":"",style:{marginTop:"4px"},children:y("a",{href:h,rel:"noreferrer",target:"_blank",children:y("div",{style:{display:"flex"},children:[y(Ms,{logoOnly:!1}),n&&y(Vs,{style:{display:"block",margin:"auto 0 auto 4px",transform:"rotateY(0deg) rotate(-45deg)"}})]})})}):null]}),_=()=>y("a",{dir:"ltr",href:h,rel:"noreferrer",target:"_blank",children:y("div",{className:"thank-you-card-link",children:[y("div",{className:"sprig-box-logo",children:y(Ms,{logoOnly:!0,style:{margin:"auto"}})}),y("div",{children:y("p",{children:["Capture insights about your own product",y(Vs,{style:{display:"inline-flex",marginInlineStart:"4px",verticalAlign:"middle"}})]})})]})}),w=t[i].type===L.Thanks;return y("footer",{className:`ul-footer ${r["userleap-platform"]==="link"?"ul-footer__link":""}`,style:a?{}:{marginBottom:"10px"},children:w&&n?_():g()})},Vs=({style:e})=>y("svg",{fill:"none",height:"10",style:e,viewBox:"0 0 12 10",width:"12",xmlns:"http://www.w3.org/2000/svg",children:[y("path",{d:"M1.47839 5.2085L10.9384 5.2085",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.35"}),y("path",{d:"M7.0686 1.15845L10.9386 5.20845L7.0686 9.25845",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.35"})]}),Pg=()=>{const{answers:e,border:t,cards:n,close:r,configureExitOnOverlayClick:i,destroy:o,endCard:a,eventEmitFn:s,fontFamily:l,headers:u,index:c,next:d,showStripes:f,surveyId:p,update:v,useMobileStyling:h,viewDocument:g}=X(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,surveyId:C.surveyId,update:C.update,useMobileStyling:C.useMobileStyling,viewDocument:C.viewDocument})),_=xt(null),w=xt(!1),E=u["userleap-platform"],{props:b,type:m,name:x}=n[c],k=n.length;Ae(()=>{_.current&&(_.current.classList.contains("ul-app--visible")||_.current.classList.add("ul-app--visible"),!w.current&&s&&(w.current=!0,s(j.SurveyAppeared,{name:j.SurveyAppeared,[Rn.SurveyId]:p})))},[s,p]),Ae(()=>{v()},[c,v]),Ae(()=>{i(()=>r())},[r,i]);const S=()=>r(Xt),I=C=>{C.key==="Enter"&&S()},R=async function(C){d({data:C,completeSurvey:()=>{o(Xt)},endCard:a}),Yf(g)};if(e){for(const C of e)if(C.questionId===x){let W;if(m===L.MultipleChoice){const re=b.options.find(({value:Ie})=>Ie===C.value);if(!re)break;W={[re.id]:re.value}}else W=C.value;R({value:W,type:m,questionId:C.questionId});break}}const O=()=>[Vt.Email,Vt.Link].includes(u["userleap-platform"])?!1:!a||c+1!==k,T=()=>h?{borderColor:t}:{borderColor:t,margin:"15px"},D=()=>{const C={className:"ul-card",next:R,questionId:x,type:m};switch(m){case L.ConsentLegal:return ee(zm,{...C,...b,key:x});case L.Likert:return ee(Ym,{...C,...b,key:x});case L.Matrix:return ee(Qm,{...C,...b,key:x});case L.MultipleChoice:return ee(Zm,{...C,...b,key:x});case L.MultipleSelect:return ee(Xm,{...C,...b,key:x});case L.NPS:return ee(Jm,{...C,key:x,props:b});case L.Open:return ee(eg,{...C,...b,key:x});case L.RecordedTask:return ee(dg,{...C,...b,key:x});case L.TextUrlPrompt:return ee(hg,{...C,...b,key:x});case L.Thanks:return ee(vg,{...C,...b,key:x});case L.Uploading:return ee(Og,{...C,...b,key:x});case L.VideoVoice:return ee(Ug,{...C,...b,key:x});default:return null}},z=C=>{var _e;const W=window.sprigAPI,re=C.target;if(!W||!re)return;const Ie=[re,re.parentElement];for(const ce of Ie)if(((_e=ce==null?void 0:ce.tagName)==null?void 0:_e.toLowerCase())==="a"){C.preventDefault(),W==null||W.openUrl(ce.href);return}};return y("div",{className:H("ul-app",Jt(u)?"ul-app--visible":"ul-app--overlay"),dir:"auto",id:Xt,onClick:z,ref:_,style:{"--theme":t,...l?{fontFamily:l.replace(";","")}:{}},children:y("div",{className:"ul-app__container",children:y("div",{className:H(oe(U.CardContainer,h)),style:T(),children:[O()&&y("div",{className:H(oe(U.CloseContainer,h)),children:y("div",{"aria-label":"Close button",className:U.CloseButton,onClick:S,onKeyPress:I,role:"button",tabIndex:0,children:y("svg",{fill:"none",height:"18px",viewBox:"0 0 13 13",width:"18px",xmlns:"http://www.w3.org/2000/svg",children:y("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"})})})}),f&&y("div",{className:"ul-header__container",dir:"ltr",children:y("div",{className:"ul-header",children:"For development purposes only"})}),y("div",{className:H(Zf(U.CardMainContent,E)),children:D()}),y(Dg,{})]})})})},Ng=`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}ol,ul{padding-inline-start:1em}.ul-card{flex:1 1 auto;border-radius:2px;display:flex;flex-direction:column;font-size:17px;line-height:19px;text-align:start;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;min-width:min-content}.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}.ul-rich-text-body p,.ul-rich-text-body li{font-size:15px;line-height:130.35%;letter-spacing:.02em;color:#343442;text-align:start;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{margin-bottom:5px}.ul-question{color:#343442;display:block;font-size:20px;line-height:125%;font-weight:500;cursor:default;text-align:start}.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:start}.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{align-items:center;display:flex;flex-direction:row;flex:0 0 fit-content;gap:15px;height:fit-content;justify-content:flex-start;width:100%}.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{align-self:center;box-shadow:unset;border-radius:unset;border:none!important;position:unset;width:100%}@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}.likert-number--mobile:not(:first-child){margin-inline-start:-2px}.likert-number--desktop{border:1px solid #e6e6e6}.likert-number--desktop:not(:first-child){margin-inline-start:-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:first-child{border-start-start-radius:5px;border-end-start-radius:5px}.likert-number:last-child{border-start-end-radius:5px;border-end-end-radius:5px}.likert-number:active,.likert-number--desktop:hover{background-color:#0000000d;font-weight:500}.likert-star--mobile:not(:first-child){margin-inline-start:-2px}.likert-star--desktop:not(:first-child){margin-inline-start:-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:not(:first-child){margin-inline-start:-2px}.likert-smiley--desktop:not(:first-child){margin-inline-start:-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--matrix_grid{display:grid;grid-template-columns:max-content repeat(var(--numColumns),minmax(93px,1fr));grid-template-rows:repeat(var(--numRows),min-content);margin:0 auto;row-gap:4px;width:max-content}.ul-matrix-row-options{display:grid;grid-column:2/-1;grid-template-columns:subgrid}.ul-matrix-column-label{font-size:15px;max-width:150px;padding:10px 12px;text-align:center}.ul-card--matrix_container{margin-bottom:16px;max-width:var(--maxWidth);overflow:auto}.ul-matrix-option-wrapper{align-items:center;background:#f9f9f8;display:flex;justify-content:center;padding:10px 12px}.ul-matrix-last-option{border-start-end-radius:4px;border-end-end-radius:4px}.ul-matrix-row-label{align-items:center;background:#f9f9f8;border-end-start-radius:4px;border-start-start-radius:4px;display:flex;font-size:15px;left:0;right:0;max-width:200px;min-width:100px;padding:10px 12px;position:sticky}.ul-matrix-option-selected{border:6px solid var(--border);box-shadow:none}.select-label{cursor:pointer;flex:1;overflow-wrap:anywhere;text-align:start}.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}.nps-number--mobile:not(:first-child){margin-inline-start:-2px}.nps-number--desktop{border:1px solid #e6e6e6}.nps-number--desktop:not(:first-child){margin-inline-start:-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:first-child{border-start-start-radius:5px;border-end-start-radius:5px}.nps-number:last-child{border-start-end-radius:5px;border-end-end-radius:5px}.nps-number:active,.nps-number--desktop:hover{background-color:#0000000d;font-weight:500}.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-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:start;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;justify-content:center}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>.yellow-footer-logo{background:#fad133;border:1px solid #f9c600;border-radius:14px;padding:6px 12px}.ul-footer>.yellow-footer-logo:hover{background:#f9c600}.ul-footer .thank-you-card-link{background:rgba(0,0,0,.01);border:1px solid #e6e6e6;border-radius:8px;cursor:pointer;display:inline-flex;font-size:14px;gap:12px;margin-bottom:15px;padding:12px;text-align:initial;width:280px}.ul-footer .thank-you-card-link:hover{background:rgba(0,0,0,.03)}.ul-footer>a{color:inherit}.ul-footer-bubble{display:inline-block;margin:0 3px;width:7px;height:7px;border-radius:3px;border:1px solid transparent}.sprig-box-logo{background:rgba(249,198,0,1);border-radius:5px;display:flex;padding:4px}.close-container{display:flex;justify-content:flex-end;width:100%}.close-btn{cursor:pointer;height:18px;margin-inline-end:-10px;position:relative;top:-10px;width:18px;z-index:1}.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
+ `,Mg=(e,t)=>{const n=[...e],r=new Set([L.VideoVoice,L.RecordedTask]);return e.some(i=>r.has(i.type))&&n.push({name:-2,props:{routingOptions:[]},type:L.Uploading}),t&&n.push({name:-1,props:{routingOptions:[]},type:L.Thanks}),n},Vg=({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 jg(e,t=!0){var m;const{answers:n,apiURL:r,customStyles:i,endCard:o,eventEmitFn:a,fontFamilyURL:s,frame:l,previewKey:u,viewDocument:c,viewWindow:d}=e,f=Jt(e.headers)?e.frame:c.body,p=e.UpChunk||window.UpChunk,v=F,h=Mg(e.cards,!!o);gr.configure(v,{cards:h,hasEndCard:!!o,apiURL:r,UpChunk:p}),X.setState({apiURL:r,answers:n,border:e.border,index:e.startingQuestionIdx||0,cards:h,configureExitOnOverlayClick:e.configureExitOnOverlayClick,customMetadata:e.customMetadata,endCard:e.endCard,envId:e.envId,eventEmitFn:a,fontFamily:e.fontFamily,forceBrandedLogo:e.forceBrandedLogo,frame:l,headers:e.headers,hasViewedEmbed:!1,isPreview:e.isPreview,marketingUrl:"https://sprig.com",meta:Vg({mode:e.mode,viewWindow:d,viewDocument:c}),mode:e.mode,previewKey:u,recorder:gr,recorderEventEmitter:v,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:g}=X.getState();g();const{head:_}=c,w=c.createElement("style");if(w.id="sprig-style",w.textContent=Ng,w.nonce=e.styleNonce,_.appendChild(w),e.fontFamily&&s&&parent){const x=c.createElement("link");x.rel="stylesheet",x.href=s,_.appendChild(x)}if(e.customStyles&&ol(c,i,e.styleNonce),!p)if(e.installationMethod!==yt.Npm){const x=c.createElement("script");x.src="https://cdn.sprig.com/userleap-web-upchunk-v2.2.2.js",x.onload=()=>{gr.setUpChunk(d.UpChunk)},x.onerror=()=>{console.warn("[Sprig] - recording functionality not configured due to UpChunk library load failure")},_.appendChild(x)}else console.warn("[Sprig] - recording functionality not configured due to missing UpChunk dependency");const E="2.25.1",b=a||((m=l.eventEmitter)==null?void 0:m.emit);b==null||b(Ue.VerifyViewVersion,{[At.ViewVersion]:E}),f&&t&&ln(y(Pg,{}),f)}const Bg={configure:jg},Fg="!launch_darkly_";class Hg{constructor(){ie(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=>{var r;return this._ldData[`${Fg}${n}`]=((r=t[n])!=null?r:0)+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 mo=new Hg;Object.freeze(mo);const $g="!optimizely_experiments_";class Kg{constructor(){ie(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 $g+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 Kg;Object.freeze(wr);class qg{constructor(t,n){ie(this,"paused");ie(this,"queue");ie(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}}var Ne=(e=>(e.Ready="ready",e.NoSurvey="no survey",e))(Ne||{}),Rc=(e=>(e.Preview="sprigPreviewKey",e))(Rc||{});const Gg=["popState","pushState","replaceState"],zg={test:"test"},_n="!email",Wg=["ios","android"],Dt="environments",go="pageUrl",It="visitors",js="ul-view-sdk-script",Bs=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 da(e,t){const{matchType:n,pattern:r}=e,i=n?Bs[n]:Bs.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 Yg(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?da(a,window.location.href):t===window.location.href}function Bn(e){const{pageUrlEvents:t,interactiveEvents:n,dismissOnPageChange:r,platform:i}=window.UserLeap._config;if(i&&i!==Vt.Web)return;const o=kt("trackStartUrl"),a=o?String(o):null;t&&Dc(window.location.href),n&&(Uc(),Qg()),r&&a&&a!==window.location.href&&e&&Gg.includes(e.type)&&window.UserLeap("dismissActiveSurvey",qe.PageChange)}const Ac={capture:!0},Qg=()=>{const t=window.UserLeap._config.interactiveEvents.filter(r=>da(r,window.location.href)).map(r=>{const{name:i,properties:o}=r,{selector:a,innerText:s}=o;return a?l=>{if(Oa(l.target))try{l.target.closest(a)&&window.UserLeap("track",i)}catch{}return!1}:l=>(Oa(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)},Uc=()=>{window.UserLeap._config.interactiveEventsHandler&&window.removeEventListener("click",window.UserLeap._config.interactiveEventsHandler,Ac),delete window.UserLeap._config.interactiveEventsHandler};function Zg(){["hashchange","popstate"].forEach(e=>window.addEventListener(e,Bn,!0))}function Xg(){["hashchange","popstate"].forEach(e=>window.removeEventListener(e,Bn,!0)),window.UserLeap._config.interactiveEvents&&Uc()}function Ze(e,t,n){const r=[window.UserLeap._API_URL,"sdk",e];return t&&t.forEach(i=>{r.push(i),i===Dt?r.push(window.UserLeap.envId):i===It&&r.push(fa())}),n&&r.push(n),r.join("/")}function Jg(e,t){let n=Ze("1",[Dt],"questions?");return e!=null&&(n+=`&vid=${e}`),t&&(t.surveyId&&(n+=`&surveyid=${t.surveyId}`),t.surveyTemplateId&&(n+=`&surveytemplateid=${t.surveyTemplateId}`),t.previewLanguage&&(n+=`&previewLanguage=${encodeURIComponent(t.previewLanguage)}`)),n}function kt(e){const t=Ee.getItem(xe.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 be(e,t){const n=Ee.getItem(xe.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{Ee.setItem(xe.Credentials,JSON.stringify(r))}catch(o){o instanceof Error&&console.warn(`[Sprig] (ERR-426) Unable to write to Local Storage:: ${o.message}`)}}function Oc(){window.previewMode||(window.UserLeap.visitorId=at(),be("vid",window.UserLeap.visitorId),F.emit(j.VisitorIDUpdated,{visitorId:window.UserLeap.visitorId}))}function fa(){return window.previewMode?"0":window.UserLeap.visitorId||""}function Dc(e,t,n){if(e.endsWith("mock_snippet.html"))return;const r=window.UserLeap._config.pageUrlEvents;let i=!1;if(r&&r.length)for(let c=0;c<r.length&&(i=da(r[c],e),!i);c++);if(!i)return;window.UserLeap.debugMode&&console.info("[DEBUG] Sprig trackPageView",e);const o=10,a=1;let s=[];const l={viewedAt:Date.now(),location:e},u=Ee.getItem(xe.PageViews);try{if(s=u?JSON.parse(u):[],Array.isArray(s)||(s=[]),s.length>0){const c=s[s.length-1],d=(Date.now()-c.viewedAt)/1e3;c.location!=e&&d>a&&es({url:e,referrer:document.referrer,description:document.title}),(c.location!=e&&d>a||d>o)&&(window.UserLeap._queue.push(["track",go,t,{url:e},n]),s.push(l))}else window.UserLeap._queue.push(["track",go,t,{url:e},n]),s.push(l),es({url:e});s.length>5&&s.splice(0,s.length-5),Ee.setItem(xe.PageViews,JSON.stringify(s))}catch(c){c instanceof Error&&window.UserLeap.reportError("trackPageView",c,{pageViewsStorage:u}),console.warn("[Sprig] (ERR-425) Failed to update page views in local storage")}}function ey(){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),Bn(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),Bn(o),i})(e.replaceState)),Zg()}async function Ci(e,t){const n=fa();e&&!t&&(window.UserLeap._config.mode=zg.test);const r=await ht(Jg(n,{...e,previewLanguage:window.UserLeap._config.previewLanguage}),{},0,!0);return r.ok?(r.json.delay&&await Cr(r.json.delay),Pc(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:Ne.NoSurvey})}const Pc=async e=>{var T,D,z;const{context:t,forceBrandedLogo:n,endCard:r,locale:i,productConfig:o,questions:a,responseGroupUid:s,surveyId:l,uuid:u,vid:c,sessionReplay:d}=e,f=rn(window.UserLeap),p=pa(f),v=ty(f);if(d)if(p){const C={mediaRecordingUid:at(),mediaType:Te.Screen,questionId:1,responseGroupUid:s,surveyId:l,updatedAt:new Date().toISOString(),visitorId:window.UserLeap.visitorId,isReplay:!0};F.emit(j.ReplayCapture,{responseGroupUid:s,hasQuestions:!!(a!=null&&a.length),surveyId:l,uploadId:d.uploadId,replayType:(T=d.replayDurationType)!=null?T:Mt.Before,seconds:d.replayDurationSeconds,generateVideoUploadUrlPayload:C})}else nu({responseGroupId:s,surveyId:l,visitorId:c,replayParams:d,completeUploadHeaders:f,apiUrl:window.UserLeap._API_URL,triggerTimestamp:Date.now(),isStandalone:a.length===0});if(c==null||!a||!a.length)return{success:!1,message:"[Sprig] no survey found",surveyState:Ne.NoSurvey};if(window.UserLeap.container){const C="[Sprig] (ERR-409) Found an existing Survey container, aborting rendering of this survey";return console.warn(C),{success:!1,message:C,surveyState:Ne.NoSurvey}}if(c!==window.UserLeap.visitorId&&u!==window.UserLeap.visitorId&&!window.previewMode){const C="Attempted to display survey to a different visitor";return window.UserLeap.reportError("DisplaySurvey",new Error(C)),{success:!1,message:C,surveyState:Ne.NoSurvey}}gv({id:l}),Li.disable(),F.emit(j.SurveyWillPresent,{name:j.SurveyWillPresent,[Rn.SurveyId]:l});let h,g=document.createElement("div"),_,w,E;const b=C=>{const{[At.ViewVersion]:W}=C;W!==f["x-ul-sdk-version"]&&oc(),F.removeListener(Ue.VerifyViewVersion,b)};F.on(Ue.VerifyViewVersion,b),Jt(f)?(h="ul-direct-embeded-frame",_=document.head,w=window,E=!1,p&&(ic(),g.id=h,window.UserLeap.container.appendChild(g),ac(),F.emit(j.SurveyLifeCycle,{state:"presented"}),F.emit(j.SurveyPresented,{name:j.SurveyPresented,[Rn.SurveyId]:l}))):{frameId:h,contentWinDocHead:_,contentWindow:w,hasOverlay:E,iframe:g}=Im(o,v,l),window.UserLeap.frameId=h,window.UserLeap.useMobileStyling=v;const m=C=>{F.on(j.CloseSurveyOnOverlayClick,C)},x=Object.assign({frame:g,envId:window.UserLeap.envId,surveyId:l,userId:u,visitorAttributes:{externalUserId:window.UserLeap.userId,email:window.UserLeap.email},cards:a,context:t,locale:i,fontFamily:window.UserLeap.fontFamily,fontFamilyURL:window.UserLeap.fontFamilyURL,apiURL:window.UserLeap._API_URL,responseGroupUid:s,headers:f,endCard:r,useMobileStyling:v,mobileSDKVersion:window.UserLeap.mobileSDKVersion,configureExitOnOverlayClick:m,eventEmitFn:F.emit.bind(F),ulEvents:_o,viewDocument:w==null?void 0:w.document,viewWindow:w,tabTitle:document.title,startingQuestionIdx:(D=window.UserLeap.config)==null?void 0:D.startingQuestionIdx,styleNonce:window.UserLeap.styleNonce,previewKey:Ee.getItem(xe.Preview),forceBrandedLogo:n},window.UserLeap._config);(z=window.UserLeap.config)!=null&&z.startingQuestionIdx&&(window.UserLeap.config={...window.UserLeap.config,startingQuestionIdx:null}),window.UserLeap.customStyles&&(x.customStyles=window.UserLeap.customStyles),w&&(w.__cfg=x);function k(){const C=document.createElement("script");return window.UserLeap.nonce&&C.setAttribute("nonce",window.UserLeap.nonce),C.id=js,C}const S=window.UserLeap.viewSDKURL?window.UserLeap.viewSDKURL:x.path,I=document.getElementById(js);I&&I.remove();const R=k(),O=()=>{window.UserLeap.container&&Object.assign(window.UserLeap.container.style,{display:"flex"})};return x.installationMethod===yt.Npm||x.installationMethod===yt.NpmBundled?(Bg.configure(x),E&&window.UserLeap.container&&O()):S&&(R.src=S,E&&R.addEventListener("load",()=>{window.UserLeap.container&&O()}),w==null||w.addEventListener("error",C=>{C.target instanceof HTMLScriptElement&&C.target.src===S&&window.UserLeap.reportError("loadFrameScript",new Error("Frame script failed to load"))},{capture:!0,once:!0})),_==null||_.appendChild(R),{success:!0,surveyState:Ne.Ready,surveyId:l,responseGroupUid:s}};function ty(e){if(window.UserLeap.useMobileStyling!==void 0)return window.UserLeap.useMobileStyling;const t=window.UserLeap.windowDimensions&&window.UserLeap.windowDimensions.width||document.body.clientWidth;return pa(e)||t>10&&t<$f}function pa(e){return Wg.includes(e[Ke.Platform])}function ny(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 ry(e){if(!e)return;window.UserLeap._config=e,e.mute&&window.UserLeap._queue.pause();const{interactiveEvents:t,pageUrlEvents:n,dismissOnPageChange:r}=e;t&&ny(t),(t||n||r)&&(ey(),Bn())}async function ht(e,t,n=0,r=!1){var o,a;t.headers=Object.assign(rn(window.UserLeap),t.headers);const i=await rt(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(Ke.VisitorID);u&&c&&(c!==window.UserLeap.visitorId||window.UserLeap.token!==u)&&(be("token",u),be("vid",c),F.emit(j.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 iy(e,t){var r,i;let n=!0;return t&&((r=e==null?void 0:e.json)==null?void 0:r.surveyId)&&(window.UserLeap.delayingSurvey=!0,n=await t(e.json.surveyId),window.UserLeap.delayingSurvey=!1,!n)?!1:((i=e==null?void 0:e.json)!=null&&i.delay&&(window.UserLeap.delayingSurvey=!0,await Cr(e.json.delay),window.UserLeap.delayingSurvey=!1),n)}const oy=function(e){if(!window.UserLeap)return;const t=async(r={})=>{var h,g,_,w,E;const{userId:i,anonymousId:o,metadata:a={},properties:s,showSurveyCallback:l}=r;let{eventName:u}=r;if(window.UserLeap.debugMode&&u!==go&&console.info("[DEBUG] Sprig track",r),e.mode==="test")return;const c=(h=Ee.getItem(xe.Preview))!=null?h:void 0;if(e.requireUserIdForTracking&&!window.UserLeap.userId&&!i){const b="[Sprig] - Skipping tracking without userId";return console.warn(b),{success:!1,message:b,surveyState:Ne.NoSurvey}}if(!u||u.trim().length===0){u=u?String(u):"";const b="[Sprig] - Invalid event name "+u;return console.warn(b),{success:!1,message:b,surveyState:Ne.NoSurvey}}const d=window.location.href;if(a.url||(a.url=d),be("trackStartUrl",d),(_=(g=window.UserLeap)==null?void 0:g._config)!=null&&_.optimizelyEnabled){const b=rn(window.UserLeap);pa(b)||wr.getAndSetWebOptimizelyExperiments(),a.optimizelyExperiments=Object.assign({},wr.getAllOptimizelyExperiments())}(E=(w=window.UserLeap)==null?void 0:w._config)!=null&&E.launchDarklyEnabled&&(a.launchDarklyFlags=mo.getAllLaunchDarklyVariations()),i&&(window.UserLeap.userId=i),o&&(window.UserLeap.partnerAnonymousId=o),s&&(a.eventProperties=s),mv({name:u,url:a.url});const f=window.UserLeap.delayingSurvey?await ht(Ze("1",[It],"events/batch"),{body:JSON.stringify({events:[{event:u,metadata:a}],previewKey:c}),method:"POST"},0,!0):await ht(Ze("1",[It],"events"),{body:JSON.stringify({event:u,metadata:a,previewKey:c}),method:"POST"},0,!0);if(!f.ok){const b="[Sprig] (ERR-421) Failed to track event";return f.reportError&&(console.warn(b,f.error),f.error&&window.UserLeap.reportError("track",f.error)),{success:!1,message:b,error:f.error,surveyState:Ne.NoSurvey}}i&&be("uid",i),o&&be("aid",o);const p=f.json;return p.invalidPreviewKey&&Ee.removeItem(xe.Preview),await iy(f,l)?Yg(p.eventId,d)?Pc(p):{success:!1,message:"Study should not be displayed after page navigation",surveyState:Ne.NoSurvey}:{success:!1,message:"[Sprig] Callback returned false, aborting rendering of survey",surveyState:Ne.NoSurvey}},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",qe.Override),Ci({surveyId:r},!0)},_previewSurvey(r){window.UserLeap("dismissActiveSurvey",qe.Override),Ci({surveyTemplateId:r},!1)},_reviewSurvey(r){window.UserLeap("dismissActiveSurvey",qe.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=qe.API){F.emit(j.SurveyWillClose,{name:j.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,_n)&&(a[_n]=a.email,delete a.email),l=await ht(Ze("1",[Dt,It],"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 ht(Ze("1",[Dt,It]),{body:JSON.stringify(s),method:"PUT"}),a&&a[_n]&&(window.UserLeap.email=a[_n]),l.ok&&(i&&be("uid",i),o&&be("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 ht(Ze("1",[Dt,It],"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){F.on(j.SurveyLifeCycle,r)},async removeSurveyListener(r){F.removeListener(j.SurveyLifeCycle,r)},async addListener(r,i){F.on(r,i)},async removeListener(r,i){F.removeListener(r,i)},async removeAllListeners(){F.removeAllListeners()},setPreviewKey(r){!r||typeof r!="string"||Ee.isStorageAvailable&&r&&Ee.setItem(xe.Preview,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 ht(Ze("1",[Dt,It]),{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&&Ja(),be("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,be("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)},trackPageView(r,i=void 0,o=void 0){Dc(r,i,o)},applyStyles(r){if(window.UserLeap.customStyles=r,window.UserLeap.container){const i=window.UserLeap.container.children[0].contentDocument;if(i){const o=i.getElementById(U.CustomStyle);o?o.textContent=r:ol(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(sl(s.contentDocument)[0])+"px")),F.emit(j.SurveyDimensions,{name:j.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,Ee.removeItem(xe.Credentials),Ee.removeItem(xe.PageViews),window.UserLeap._queue.isPaused()&&window.UserLeap._queue.empty(),Oc(),Ja(),window.UserLeap._queue.unpause()},teardown(){Xg(),window.UserLeap("dismissActiveSurvey",qe.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(Mf.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}mo.setLDFlagsVariations(r)},setVisitorAttribute(r,i){return console.warn("[Sprig] setVisitorAttribute is deprecated. Please use setAttribute"),n.setAttribute(r,i)},async setEmail(r){return n.setAttribute(_n,r)},async setVisitorEmail(r){return console.warn("[Sprig] setVisitorEmail is deprecated. Please use setEmail"),n.setEmail(r)},async _generateVideoUploadUrl(r){return uy(r)},async _completeSessionReplay({surveyId:r,responseGroupUuid:i,eventDigest:o}){if(!r||!i)return;const a=window.UserLeap._API_URL;try{await ml({surveyId:r,responseGroupUuid:i,eventDigest:o,apiUrl:a,headers:rn(window.UserLeap)},!0)}catch(s){console.warn("[Sprig] Error with completing session replay"),s instanceof Error&&window.UserLeap.reportError("completeSessionReplay",s)}}};Object.assign(window.UserLeap,n)};async function ay(e){const t=rn(window.UserLeap);document.addEventListener("securitypolicyviolation",Ri);const n=await rt(Ze("1",[Dt],"config"),{headers:t}),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)):document.removeEventListener("securitypolicyviolation",Ri),!n.ok)return n.reportError&&(console.warn("[Sprig] (ERR-422) Failed to load configuration",n.error),n.error&&window.UserLeap.reportError("applyRemoteConfig",n.error)),Ai("Disabled: failed to fetch configuration"),e;const i=n.json;return i!=null&&i.disabled?(Ai(`Disabled: ${i.disabled}`),{disabled:i.disabled}):Object.assign({},i,e)}const sy=e=>typeof e=="object"&&e&&"inner"in e&&!!e.inner&&typeof e.inner=="object";async function ly(e,t,n={}){var d,f;const r=window.__cfg&&window.__cfg.mode,i=fa(),o=window.UserLeap.envId,a=window.document.documentElement,s=sy(t)?{inner:{message:(d=t.inner)==null?void 0:d.message,stack:(f=t.inner)==null?void 0:f.stack}}:{},l={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,...s},u={action:e,err:{message:t.message,stack:t.stack},meta:l,vid:i,envId:o};(await ht(Ze("1",null,"errors"),{method:"POST",headers:{[Ke.Error]:window.btoa(`userleap-${Date.now()}-error`)},body:JSON.stringify(u)},0,!0)).ok||console.warn("[Sprig] (ERR-444) Failed to report error to API",t)}async function uy(e){var n;if(!e)return;const t=`${window.UserLeap._API_URL}/2/environments/integrations/upload`;try{const r=await fetch(t,{method:"POST",cache:"no-cache",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(r.ok){const i=await r.json();return(n=i==null?void 0:i.upload)==null?void 0:n.url}else return null}catch(r){console.warn("[Sprig] Error with generating video upload url"),r instanceof Error&&window.UserLeap.reportError("generateVideoUploadUrl",r)}}function cy(e={}){var r;const t=(r=new URLSearchParams(window.location.search).get(Rc.Preview))!=null?r:"";window.UserLeap.UPDATES=_o,window.UserLeap("setPreviewKey",t);async function n(){if(window.UserLeap.loaded)return;if(window.UserLeap.reportError=ly,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){let l=kt("sampled");if(l===null&&(l=Math.random()<i,be("sampled",l)),!l)return}else kt("sampled")!==null&&be("sampled",null);window.UserLeap._API_URL||(window.UserLeap._API_URL="https://api.sprig.com");const o=[...window.UserLeap._queue];window.UserLeap._queue=new qg(window.UserLeap,[]),window.UserLeap._queue.pause();for(let l=0;l<o.length;l++)window.UserLeap._queue.push(o[l]);const a=kt("token");a?(window.UserLeap.token=a,window.UserLeap.visitorId=kt("vid"),window.UserLeap.userId=kt("uid"),window.UserLeap.partnerAnonymousId=kt("aid")):(Ee.removeItem(xe.Credentials),Oc());const s=await ay(e);nv(window.document,s.maxReplayDurationSeconds,window.UserLeap.replayNonce,window.UserLeap.maxInflightReplayRequests,s.replaySettings).then(()=>{Uv()}),oy(s),await ry(s),window.UserLeap._queue.unpause(),F.emit(j.SDKReady,{maxMobileReplayDurationSeconds:s.maxMobileReplayDurationSeconds,mobileReplaySettings:s.mobileReplaySettings}),F.emit(j.VisitorIDUpdated,{visitorId:window.UserLeap.visitorId})}document.readyState==="complete"?n():window.attachEvent?window.attachEvent("onload",n):window.addEventListener("load",()=>{n()},!1)}class Fr{constructor(){ie(this,"UPDATES",_o)}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)}trackPageView(t,n,r){window.Sprig("trackPageView",t,n,r)}applyStyles(t){window.Sprig("applyStyles",t)}setWindowDimensions(t,n){window.Sprig("setWindowDimensions",t,n)}logoutUser(){window.Sprig("logoutUser")}teardown(){window.Sprig("teardown")}}const yo={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="web-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,cy(e),window.Sprig}},dy={sprig:yo,SprigAPI:Fr,configure:yo.configure};exports.DismissReason=qe;exports.SprigAPI=Fr;exports.SprigEvent=j;exports.default=dy;exports.sprig=yo;