@sprig-technologies/sprig-browser 2.24.5 → 2.24.7

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,22 +1,5 @@
1
- "use strict";var Zf=Object.defineProperty;var Yf=(e,t,n)=>t in e?Zf(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var xe=(e,t,n)=>(Yf(e,typeof t!="symbol"?t+"":t,n),n);Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});var ut=(e=>(e.Closed="close.click",e.Complete="survey.completed",e.PageChange="page.change",e.API="api",e.Override="override",e))(ut||{}),z=(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))(z||{}),yu=(e=>(e.SurveyId="survey.id",e))(yu||{});const Ta={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 qe=(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))(qe||{}),en=(e=>(e.ViewVersion="view.version",e.QuestionId="qid",e.Props="props",e))(en||{}),ee=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Qf(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function Xf(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 Ie={},fn={};Object.defineProperty(fn,"__esModule",{value:!0});var Ra=function(){function e(){}return e.prototype.handleError=function(t){},e}();fn.NoopErrorHandler=Ra;var La=new Ra;function Jf(e){La=e}fn.setErrorHandler=Jf;function ep(){return La}fn.getErrorHandler=ep;function tp(){La=new Ra}fn.resetErrorHandler=tp;var Oa={};(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={}))})(Oa);var Wt={},jn={},ci={exports:{}},ks=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||typeof msCrypto<"u"&&typeof window.msCrypto.getRandomValues=="function"&&msCrypto.getRandomValues.bind(msCrypto);if(ks){var xs=new Uint8Array(16);ci.exports=function(){return ks(xs),xs}}else{var As=new Array(16);ci.exports=function(){for(var t=0,n;t<16;t++)(t&3)===0&&(n=Math.random()*4294967296),As[t]=n>>>((t&3)<<3)&255;return As}}var _u=[];for(var Pr=0;Pr<256;++Pr)_u[Pr]=(Pr+256).toString(16).substr(1);function np(e,t){var n=t||0,r=_u;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 bu=np,rp=ci.exports,ip=bu,Ts,eo,to=0,no=0;function op(e,t,n){var r=t&&n||0,i=t||[];e=e||{};var o=e.node||Ts,a=e.clockseq!==void 0?e.clockseq:eo;if(o==null||a==null){var s=rp();o==null&&(o=Ts=[s[0]|1,s[1],s[2],s[3],s[4],s[5]]),a==null&&(a=eo=(s[6]<<8|s[7])&16383)}var l=e.msecs!==void 0?e.msecs:new Date().getTime(),u=e.nsecs!==void 0?e.nsecs:no+1,c=l-to+(u-no)/1e4;if(c<0&&e.clockseq===void 0&&(a=a+1&16383),(c<0||l>to)&&e.nsecs===void 0&&(u=0),u>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");to=l,no=u,eo=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||ip(i)}var ap=op,sp=ci.exports,lp=bu;function up(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||sp)();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||lp(i)}var cp=up,dp=ap,wu=cp,Na=wu;Na.v1=dp;Na.v4=wu;var fp=Na;(function(e){Object.defineProperty(e,"__esModule",{value:!0});var t=fp;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),m=0;m<h.length;m++)if(f===d[h[m]]){p=!0;break}return p}e.isValidEnum=i;function o(d,f){var p={};return d.forEach(function(h){var m=f(h);p[m]=p[m]||[],p[m].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,m=d;h<m.length;h++){var g=m[h];if(f(g)){p=g;break}}return p}e.find=l;function u(d,f){var p={};return d.forEach(function(h){var m=f(h);p[m]=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 m=f[h++],g=typeof m;return g==="function"?m():g==="string"?m:String(m)})}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={}))})(jn);var pp=ee&&ee.__spreadArrays||function(){for(var e=0,t=0,n=arguments.length;t<n;t++)e+=arguments[t].length;for(var r=Array(e),i=0,t=0;t<n;t++)for(var o=arguments[t],a=0,s=o.length;a<s;a++,i++)r[i]=o[a];return r};Object.defineProperty(Wt,"__esModule",{value:!0});var hp=fn,di=jn,me=Oa,Rs={NOTSET:0,DEBUG:1,INFO:2,WARNING:3,ERROR:4};function Da(e){return typeof e!="string"||(e=e.toUpperCase(),e==="WARN"&&(e="WARNING"),!Rs[e])?e:Rs[e]}var Cu=function(){function e(){this.defaultLoggerFacade=new Ls,this.loggers={}}return e.prototype.getLogger=function(t){return t?(this.loggers[t]||(this.loggers[t]=new Ls({messagePrefix:t})),this.loggers[t]):this.defaultLoggerFacade},e}(),mp=function(){function e(t){t===void 0&&(t={}),this.logLevel=me.LogLevel.NOTSET,t.logLevel!==void 0&&di.isValidEnum(me.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=Da(t),!di.isValidEnum(me.LogLevel,t)||t===void 0?this.logLevel=me.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 me.LogLevel.DEBUG:return"DEBUG";case me.LogLevel.INFO:return"INFO ";case me.LogLevel.WARNING:return"WARN ";case me.LogLevel.ERROR:return"ERROR";default:return"NOTSET"}},e.prototype.consoleLog=function(t,n){switch(t){case me.LogLevel.DEBUG:console.log.apply(console,n);break;case me.LogLevel.INFO:console.info.apply(console,n);break;case me.LogLevel.WARNING:console.warn.apply(console,n);break;case me.LogLevel.ERROR:console.error.apply(console,n);break;default:console.log.apply(console,n)}},e}();Wt.ConsoleLogHandler=mp;var ur=me.LogLevel.NOTSET,Oo=null,Ls=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(Da(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(me.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(me.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(me.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(me.LogLevel.ERROR,t,n)},e.prototype.format=function(t){return(this.messagePrefix?this.messagePrefix+": ":"")+di.sprintf.apply(void 0,pp([t.message],t.splat))},e.prototype.internalLog=function(t,n){!Oo||t<ur||(Oo.log(t,this.format(n)),n.error&&n.error instanceof Error&&hp.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}(),Iu=new Cu;function gp(e){return Iu.getLogger(e)}Wt.getLogger=gp;function vp(e){Oo=e}Wt.setLogHandler=vp;function yp(e){e=Da(e),!di.isValidEnum(me.LogLevel,e)||e===void 0?ur=me.LogLevel.ERROR:ur=e}Wt.setLogLevel=yp;function _p(){return ur}Wt.getLogLevel=_p;function bp(){Iu=new Cu,ur=me.LogLevel.NOTSET}Wt.resetLogger=bp;(function(e){function t(n){for(var r in n)e.hasOwnProperty(r)||(e[r]=n[r])}Object.defineProperty(e,"__esModule",{value:!0}),t(fn),t(Oa),t(Wt)})(Ie);var wp={},wr={};Object.defineProperty(wr,"__esModule",{value:!0});wr.areEventContextsEqual=void 0;function Cp(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}wr.areEventContextsEqual=Cp;var Ua={},Ln={};Object.defineProperty(Ln,"__esModule",{value:!0});Ln.DefaultEventQueue=Ln.SingleEventQueue=void 0;var Ip=Ie,Ep=Ip.getLogger("EventProcessor"),Sp=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}(),kp=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}();Ln.SingleEventQueue=kp;var xp=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 Sp({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){Ep.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}();Ln.DefaultEventQueue=xp;(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=Ln,n=Ie,r=jn;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})(Ua);var Eu={};Object.defineProperty(Eu,"__esModule",{value:!0});var Su={};Object.defineProperty(Su,"__esModule",{value:!0});var On={},Pi={};Object.defineProperty(Pi,"__esModule",{value:!0});Pi.LocalStorageStore=void 0;var Ap=jn,Tp=Ie,Os=Tp.getLogger("EventProcessor"),Rp=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 Ap.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){Os.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){Os.error(n)}return{}},e}();Pi.LocalStorageStore=Rp;var Lp=ee&&ee.__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(On,"__esModule",{value:!0});On.LocalStoragePendingEventsDispatcher=On.PendingEventsDispatcher=void 0;var Op=Ie,Np=Pi,Ns=jn,Dp=Op.getLogger("EventProcessor"),ku=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:Ns.generateUUID(),timestamp:Ns.getTimestamp(),request:t},n)},e.prototype.sendPendingEvents=function(){var t=this,n=this.store.values();Dp.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}();On.PendingEventsDispatcher=ku;var Up=function(e){Lp(t,e);function t(n){var r=n.eventDispatcher;return e.call(this,{eventDispatcher:r,store:new Np.LocalStorageStore({maxValues:100,key:"fs_optly_pending_events"})})||this}return t}(ku);On.LocalStoragePendingEventsDispatcher=Up;var Xe={},No=ee&&ee.__assign||function(){return No=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},No.apply(this,arguments)};Object.defineProperty(Xe,"__esModule",{value:!0});Xe.formatEvents=Xe.buildConversionEventV1=Xe.buildImpressionEventV1=Xe.makeBatchedEventV1=void 0;var Pp="campaign_activated",Mp="custom",Ds="$opt_bot_filtering";function xu(e){var t=[],n=e[0];return e.forEach(function(r){if(r.type==="conversion"||r.type==="impression"){var i=Pa(r);r.type==="impression"?i.snapshots.push(Tu(r)):r.type==="conversion"&&i.snapshots.push(Au(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}}Xe.makeBatchedEventV1=xu;function Au(e){var t=No({},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 Tu(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:Pp,uuid:e.uuid}]}}function Pa(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:Ds,key:Ds,type:Mp,value:e.context.botFiltering}),t}function Fp(e){var t=Pa(e);return t.snapshots.push(Tu(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]}}Xe.buildImpressionEventV1=Fp;function Vp(e){var t=Pa(e);return t.snapshots.push(Au(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]}}Xe.buildConversionEventV1=Vp;function Bp(e){return{url:"https://logx.optimizely.com/v1/events",httpVerb:"POST",params:xu(e)}}Xe.formatEvents=Bp;var Mi={},Ma={};Object.defineProperty(Ma,"__esModule",{value:!0});var jp=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}();Ma.default=jp;var Hp=ee&&ee.__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())})},zp=ee&&ee.__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}}},Kp=ee&&ee.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Mi,"__esModule",{value:!0});Mi.LogTierV1EventProcessor=void 0;var Gp=Ie,gn=Ua,Wp=Kp(Ma),qp=wr,$p=Xe,Us=Gp.getLogger("LogTierV1EventProcessor"),Zp=function(){function e(t){var n=t.dispatcher,r=t.flushInterval,i=r===void 0?gn.DEFAULT_FLUSH_INTERVAL:r,o=t.batchSize,a=o===void 0?gn.DEFAULT_BATCH_SIZE:o,s=t.notificationCenter;this.dispatcher=n,this.notificationCenter=s,this.requestTracker=new Wp.default,i=gn.validateAndGetFlushInterval(i),a=gn.validateAndGetBatchSize(a),this.queue=gn.getQueue(a,i,this.drainQueue.bind(this),qp.areEventContextsEqual)}return e.prototype.drainQueue=function(t){var n=this,r=new Promise(function(i){if(Us.debug("draining queue with %s events",t.length),t.length===0){i();return}var o=$p.formatEvents(t);n.dispatcher.dispatchEvent(o,function(){i()}),gn.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){Us.error('Error stopping EventProcessor: "%s"',t.message,t)}return Promise.resolve()},e.prototype.start=function(){return Hp(this,void 0,void 0,function(){return zp(this,function(t){return this.queue.start(),[2]})})},e}();Mi.LogTierV1EventProcessor=Zp;(function(e){var t=ee&&ee.__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=ee&&ee.__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(wr,e),n(Ua,e),n(Eu,e),n(Su,e),n(On,e),n(Xe,e),n(Mi,e)})(wp);var fi={exports:{}},Ps=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||typeof msCrypto<"u"&&typeof window.msCrypto.getRandomValues=="function"&&msCrypto.getRandomValues.bind(msCrypto);if(Ps){var Ms=new Uint8Array(16);fi.exports=function(){return Ps(Ms),Ms}}else{var Fs=new Array(16);fi.exports=function(){for(var t=0,n;t<16;t++)(t&3)===0&&(n=Math.random()*4294967296),Fs[t]=n>>>((t&3)<<3)&255;return Fs}}var Ru=[];for(var Mr=0;Mr<256;++Mr)Ru[Mr]=(Mr+256).toString(16).substr(1);function Yp(e,t){var n=t||0,r=Ru;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 Lu=Yp,Qp=fi.exports,Xp=Lu,Vs,ro,io=0,oo=0;function Jp(e,t,n){var r=t&&n||0,i=t||[];e=e||{};var o=e.node||Vs,a=e.clockseq!==void 0?e.clockseq:ro;if(o==null||a==null){var s=Qp();o==null&&(o=Vs=[s[0]|1,s[1],s[2],s[3],s[4],s[5]]),a==null&&(a=ro=(s[6]<<8|s[7])&16383)}var l=e.msecs!==void 0?e.msecs:new Date().getTime(),u=e.nsecs!==void 0?e.nsecs:oo+1,c=l-io+(u-oo)/1e4;if(c<0&&e.clockseq===void 0&&(a=a+1&16383),(c<0||l>io)&&e.nsecs===void 0&&(u=0),u>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");io=l,oo=u,ro=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||Xp(i)}var eh=Jp,th=fi.exports,nh=Lu;function rh(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||th)();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||nh(i)}var ih=rh,oh=eh,Ou=ih,Nu=Ou;Nu.v1=oh;Nu.v4=Ou;var ah={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})()})(ah);var Du={},Fa={},Va={},pt={};Object.defineProperty(pt,"__esModule",{value:!0});pt.DEFAULT_UPDATE_INTERVAL=5*60*1e3;pt.MIN_UPDATE_INTERVAL=1e3;pt.DEFAULT_URL_TEMPLATE="https://cdn.optimizely.com/datafiles/%s.json";pt.DEFAULT_AUTHENTICATED_URL_TEMPLATE="https://config.optimizely.com/datafiles/auth/%s.json";pt.BACKOFF_BASE_WAIT_SECONDS_BY_ERROR_COUNT=[0,8,16,32,64,128,256,512];pt.REQUEST_TIMEOUT_MS=60*1e3;Object.defineProperty(Va,"__esModule",{value:!0});var sh=pt,lh=Ie,uh=lh.getLogger("DatafileManager"),ch="GET",dh=4;function fh(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 ph(e,t){Object.keys(e).forEach(function(n){var r=e[n];t.setRequestHeader(n,r)})}function hh(e,t){var n=new XMLHttpRequest,r=new Promise(function(i,o){n.open(ch,e,!0),ph(t,n),n.onreadystatechange=function(){if(n.readyState===dh){var a=n.status;if(a===0){o(new Error("Request error"));return}var s=fh(n),l={statusCode:n.status,body:n.responseText,headers:s};i(l)}},n.timeout=sh.REQUEST_TIMEOUT_MS,n.ontimeout=function(){uh.error("Request timed out")},n.send()});return{responsePromise:r,abort:function(){n.abort()}}}Va.makeGetRequest=hh;var Ba={},ja={};Object.defineProperty(ja,"__esModule",{value:!0});var mh=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}();ja.default=mh;var Ha={};Object.defineProperty(Ha,"__esModule",{value:!0});var ao=pt;function gh(){return Math.round(Math.random()*1e3)}var vh=function(){function e(){this.errorCount=0}return e.prototype.getDelay=function(){if(this.errorCount===0)return 0;var t=ao.BACKOFF_BASE_WAIT_SECONDS_BY_ERROR_COUNT[Math.min(ao.BACKOFF_BASE_WAIT_SECONDS_BY_ERROR_COUNT.length-1,this.errorCount)];return t*1e3+gh()},e.prototype.countError=function(){this.errorCount<ao.BACKOFF_BASE_WAIT_SECONDS_BY_ERROR_COUNT.length-1&&this.errorCount++},e.prototype.reset=function(){this.errorCount=0},e}();Ha.default=vh;var pi=ee&&ee.__assign||function(){return pi=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},pi.apply(this,arguments)},Uu=ee&&ee.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Ba,"__esModule",{value:!0});var yh=Ie,_h=jn,bh=Uu(ja),Yn=pt,wh=Uu(Ha),ze=yh.getLogger("DatafileManager"),Ch="update";function Ih(e){return e>=Yn.MIN_UPDATE_INTERVAL}function Bs(e){return e>=200&&e<400}var Eh={get:function(){return Promise.resolve("")},set:function(){return Promise.resolve()},contains:function(){return Promise.resolve(!1)},remove:function(){return Promise.resolve()}},Sh=function(){function e(t){var n=this,r=pi(pi({},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?Eh:f;this.cache=p,this.cacheKey="opt-datafile-"+s,this.isReadyPromiseSettled=!1,this.readyPromiseResolver=function(){},this.readyPromiseRejecter=function(){},this.readyPromise=new Promise(function(h,m){n.readyPromiseResolver=h,n.readyPromiseRejecter=m}),i?(this.currentDatafile=i,s||this.resolveReadyPromise()):this.currentDatafile="",this.isStarted=!1,this.datafileUrl=_h.sprintf(d,s),this.emitter=new bh.default,this.autoUpdate=a,Ih(u)?this.updateInterval=u:(ze.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 wh.default,this.syncOnCurrentRequestComplete=!1}return e.prototype.get=function(){return this.currentDatafile},e.prototype.start=function(){this.isStarted||(ze.debug("Datafile manager started"),this.isStarted=!0,this.backoffController.reset(),this.setDatafileFromCacheIfAvailable(),this.syncDatafile())},e.prototype.stop=function(){return ze.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?ze.error("Error fetching datafile: %s",t.message,t):typeof t=="string"?ze.error("Error fetching datafile: %s",t):ze.error("Error fetching datafile"))},e.prototype.onRequestResolved=function(t){if(!!this.isStarted){typeof t.statusCode<"u"&&Bs(t.statusCode)?this.backoffController.reset():this.backoffController.countError(),this.trySavingLastModified(t.headers);var n=this.getNextDatafileFromResponse(t);if(n!=="")if(ze.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(Ch,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),ze.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);ze.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 ze.debug("Response status code: %s",t.statusCode),typeof t.statusCode>"u"||t.statusCode===304?"":Bs(t.statusCode)?t.body:""},e.prototype.trySavingLastModified=function(t){var n=t["last-modified"]||t["Last-Modified"];typeof n<"u"&&(this.lastResponseLastModified=n,ze.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!==""&&(ze.debug("Using datafile from cache"),t.currentDatafile=n,t.resolveReadyPromise())})},e}();Ba.default=Sh;var kh=ee&&ee.__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)}}(),xh=ee&&ee.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Fa,"__esModule",{value:!0});var Ah=Va,Th=xh(Ba),Rh=function(e){kh(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.makeGetRequest=function(n,r){return Ah.makeGetRequest(n,r)},t.prototype.getConfigDefaults=function(){return{autoUpdate:!1}},t}(Th.default);Fa.default=Rh;Object.defineProperty(Du,"__esModule",{value:!0});var Lh=Fa;Du.HttpPollingDatafileManager=Lh.default;var Oh={NOTSET:0,DEBUG:1,INFO:2,WARNING:3,ERROR:4},Nh={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."},Dh={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"'},Uh={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"},Ph="javascript-sdk",Mh="node-sdk",Fh="react-sdk",Vh="react-native-sdk",Bh="react-native-js-sdk",jh="4.9.4",Hh="4.9.4",zh={AB_TEST:"ab-test",FEATURE:"feature",FEATURE_TEST:"feature-test",FEATURE_VARIABLE:"feature-variable",ALL_FEATURE_VARIABLES:"all-feature-variables",FLAG:"flag"},Kh={FEATURE_TEST:"feature-test",ROLLOUT:"rollout",EXPERIMENT:"experiment"},Gh={RULE:"rule",EXPERIMENT:"experiment"},Wh={BOOLEAN:"boolean",DOUBLE:"double",INTEGER:"integer",STRING:"string",JSON:"json"},Zr={V2:"2",V3:"3",V4:"4"},qh={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.'},Do;(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"})(Do||(Do={}));var $h=Object.freeze({__proto__:null,LOG_LEVEL:Oh,ERROR_MESSAGES:Nh,LOG_MESSAGES:Dh,CONTROL_ATTRIBUTES:Uh,JAVASCRIPT_CLIENT_ENGINE:Ph,NODE_CLIENT_ENGINE:Mh,REACT_CLIENT_ENGINE:Fh,REACT_NATIVE_CLIENT_ENGINE:Vh,REACT_NATIVE_JS_CLIENT_ENGINE:Bh,BROWSER_CLIENT_VERSION:jh,NODE_CLIENT_VERSION:Hh,DECISION_NOTIFICATION_TYPES:zh,DECISION_SOURCES:Kh,AUDIENCE_EVALUATION_TYPES:Gh,FEATURE_VARIABLE_TYPES:Wh,DATAFILE_VERSIONS:Zr,DECISION_MESSAGES:qh,get NOTIFICATION_TYPES(){return Do}});Zr.V2,Zr.V3,Zr.V4;(function(){function e(){}return e.prototype.log=function(){},e})();function Zh(e){return new Ie.ConsoleLogHandler(e)}var js;(function(e){e.BOOLEAN="boolean",e.DOUBLE="double",e.INTEGER="integer",e.STRING="string",e.JSON="json"})(js||(js={}));var Hs;(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"})(Hs||(Hs={}));Ie.getLogger();Ie.getLogger();Ie.getLogger();Ie.getLogger();Ie.getLogger("EVENT_BUILDER");Ie.getLogger();Ie.setLogHandler(Zh());Ie.setLogLevel(Ie.LogLevel.INFO);let Fr;const Yh=new Uint8Array(16);function Qh(){if(!Fr&&(Fr=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!Fr))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Fr(Yh)}const Se=[];for(let e=0;e<256;++e)Se.push((e+256).toString(16).slice(1));function Xh(e,t=0){return(Se[e[t+0]]+Se[e[t+1]]+Se[e[t+2]]+Se[e[t+3]]+"-"+Se[e[t+4]]+Se[e[t+5]]+"-"+Se[e[t+6]]+Se[e[t+7]]+"-"+Se[e[t+8]]+Se[e[t+9]]+"-"+Se[e[t+10]]+Se[e[t+11]]+Se[e[t+12]]+Se[e[t+13]]+Se[e[t+14]]+Se[e[t+15]]).toLowerCase()}const Jh=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),zs={randomUUID:Jh};function jt(e,t,n){if(zs.randomUUID&&!t&&!e)return zs.randomUUID();e=e||{};const r=e.random||(e.rng||Qh)();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 Xh(r)}const xn="ul-app";var L=(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))(L||{});const za="#e6e6e6",er="#bd282a",em=500,tm=1030;var Be=(e=>(e.Preview="sprig.previewKey",e.Credentials="userleap.ids",e.PageViews="userleap.pageviews",e))(Be||{});const Pu=()=>{try{return window.parent.Intercom}catch(e){return console.error(e),null}},nm=()=>{const e=Pu();!e||(e.ul_wasVisible&&e("update",{hide_default_launcher:!1}),delete e.ul_wasVisible)},rm=()=>{const e=Pu();!e||(e.ul_wasVisible=!!document.querySelector("iframe.intercom-launcher-frame"),e.ul_wasVisible&&e("update",{hide_default_launcher:!0}))},im=Object.freeze(Object.defineProperty({__proto__:null,enable:nm,disable:rm},Symbol.toStringTag,{value:"Module"})),Ks=[im];class Uo{static disable(){Ks.forEach(t=>t.disable())}static enable(){Ks.forEach(t=>t.enable())}}const om=1,Nn=e=>e instanceof HTMLElement,am=e=>e instanceof HTMLInputElement,tr=e=>e instanceof HTMLTextAreaElement,Mu=(e,t,n)=>{const r=e.createElement("style");n&&(r.nonce=n),r.textContent=t,r.id=L.CustomStyle,e.head.appendChild(r)},Fu=e=>{const t=e.querySelector(`.${L.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+om},sm=e=>{const t=e.querySelector(`.${L.CardContainer}`);t&&(t.scrollTop=0)};var Vu={},Fi={},Cr={};Object.defineProperty(Cr,"__esModule",{value:!0});Cr.MemoryLeakError=void 0;class lm extends Error{constructor(t,n,r){super(`Possible EventEmitter memory leak detected. ${r} ${n.toString()} listeners added. Use emitter.setMaxListeners() to increase limit`),this.emitter=t,this.type=n,this.count=r,this.name="MaxListenersExceededWarning"}}Cr.MemoryLeakError=lm;Object.defineProperty(Fi,"__esModule",{value:!0});Fi.Emitter=void 0;const um=Cr;class Vi{constructor(){this.events=new Map,this.maxListeners=Vi.defaultMaxListeners,this.hasWarnedAboutPotentialMemoryLeak=!1}static listenerCount(t,n){return t.listenerCount(n)}_emitInternalEvent(t,n,r){this.emit(t,n,r)}_getListeners(t){return this.events.get(t)||[]}_removeListener(t,n){const r=t.indexOf(n);return r>-1&&t.splice(r,1),[]}_wrapOnceListener(t,n){const r=(...i)=>{this.removeListener(t,r),n.apply(this,i)};return r}setMaxListeners(t){return this.maxListeners=t,this}getMaxListeners(){return this.maxListeners}eventNames(){return Array.from(this.events.keys())}emit(t,...n){const r=this._getListeners(t);return r.forEach(i=>{i.apply(this,n)}),r.length>0}addListener(t,n){this._emitInternalEvent("newListener",t,n);const r=this._getListeners(t).concat(n);if(this.events.set(t,r),this.maxListeners>0&&this.listenerCount(t)>this.maxListeners&&!this.hasWarnedAboutPotentialMemoryLeak){this.hasWarnedAboutPotentialMemoryLeak=!0;const i=new um.MemoryLeakError(this,t,this.listenerCount(t));console.warn(i)}return this}on(t,n){return this.addListener(t,n)}once(t,n){return this.addListener(t,this._wrapOnceListener(t,n))}prependListener(t,n){const r=this._getListeners(t);if(r.length>0){const i=[n].concat(r);this.events.set(t,i)}else this.events.set(t,r.concat(n));return this}prependOnceListener(t,n){return this.prependListener(t,this._wrapOnceListener(t,n))}removeListener(t,n){const r=this._getListeners(t);return r.length>0&&(this._removeListener(r,n),this.events.set(t,r),this._emitInternalEvent("removeListener",t,n)),this}off(t,n){return this.removeListener(t,n)}removeAllListeners(t){return t?this.events.delete(t):this.events.clear(),this}listeners(t){return Array.from(this._getListeners(t))}listenerCount(t){return this._getListeners(t).length}rawListeners(t){return this.listeners(t)}}Fi.Emitter=Vi;Vi.defaultMaxListeners=10;(function(e){var t=ee&&ee.__createBinding||(Object.create?function(r,i,o,a){a===void 0&&(a=o);var s=Object.getOwnPropertyDescriptor(i,o);(!s||("get"in s?!i.__esModule:s.writable||s.configurable))&&(s={enumerable:!0,get:function(){return i[o]}}),Object.defineProperty(r,a,s)}:function(r,i,o,a){a===void 0&&(a=o),r[a]=i[o]}),n=ee&&ee.__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(Fi,e),n(Cr,e)})(Vu);const q=new Vu.Emitter;var Qn=(e=>(e.BottomLeft="bottomLeft",e.BottomRight="bottomRight",e.Center="center",e.TopLeft="topLeft",e.TopRight="topRight",e))(Qn||{}),st=(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))(st||{}),ln=(e=>(e.Email="email",e.Link="link",e.Web="web",e))(ln||{}),on=(e=>(e.Npm="web-npm",e.Gtm="web-gtm",e.Segment="web-segment",e.SegmentAndroid="android-segment",e.SegmentReactNative="react-native-segment",e.SegmentIOS="ios-segment",e.Snippet="web-snippet",e))(on||{});const hi=e=>new Promise(t=>{setTimeout(()=>{t()},e)}),An=({"userleap-platform":e})=>e!==ln.Web,_e=(e,t)=>{const n=t?L.MobileSuffix:L.DesktopSuffix;return[e+n,e]},ht=(e,t)=>[e,`${e}__${t}`];class cm{constructor(t){xe(this,"payload");xe(this,"promise");xe(this,"reject",()=>{});xe(this,"resolve",()=>{});this.payload=t,this.promise=new Promise((n,r)=>{this.reject=r,this.resolve=n})}resolveRequest(t){this.resolve(t)}}const dm={RATELIMIT_RESET_DEFAULT:10};let Bu=!1,ju="",Vr=!1,Yr=[];const fm=e=>e._config&&e._config.installationMethod?e._config.installationMethod:e._gtm?on.Gtm:e._segment?on.Segment:on.Snippet,Po=(e="")=>{Bu=!0,ju=e};function Ir(e={}){const t={"Content-Type":"application/json","userleap-platform":ln.Web,"x-ul-sdk-version":"2.24.5",[st.InstallationMethod]:fm(e)};if(e.envId&&(t[st.EnvironmentID]=e.envId),e.token&&(t.Authorization="Bearer "+e.token),e.userId&&(t[st.UserID]=e.userId),e.visitorId&&(t[st.VisitorID]=e.visitorId),e.partnerAnonymousId&&(t[st.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[st.PreviewMode]="1"),t}const Gs=async(e,t,n)=>{if(e)return{status:429};{const r=new cm(n);return Yr.push(r),r.promise}},ct=async(e,t,n=0,r=!1,i=!1)=>{const o={url:e,options:t,attempt:n,shouldDropOnRateLimit:r};if(Vr&&!i)return Gs(r,i,o);const a={ok:!1,reportError:!1};if(Bu)return console.info(`UserLeap - ${ju}`),a;try{t.headers=Object.assign(Ir(),t.headers);const s=await fetch(e,t);if(s.status===429)if(!Vr&&!r||i){Vr=!0;const u=s.headers.has("ratelimit-reset")?Number(s.headers.get("ratelimit-reset")):dm.RATELIMIT_RESET_DEFAULT;return await hi(u*1e3),ct(e,t,0,r,!0)}else return Gs(r,!1,o);if(Vr=!1,Yr.length&&(Yr.map(l=>{const{url:u,options:c,attempt:d,shouldDropOnRateLimit:f}=l.payload;ct(u,c,d,f).then(p=>{l.resolveRequest(p)})}),Yr=[]),s.ok){if(s.status===249)return Po(),a;const l=await s.text();try{return l&&l!=="OK"&&(s.json=JSON.parse(l)),s}catch{return{ok:!1,reportError:!1,error:new Error(`failed parsing response json for ${e} - ${l}`)}}}return s}catch(s){const l=n+1;return l>5?{ok:!1,reportError:!1,error:s}:(await hi(Math.pow(2,n)*1e3),ct(e,t,l))}};var be;(function(e){e[e.Document=0]="Document",e[e.DocumentType=1]="DocumentType",e[e.Element=2]="Element",e[e.Text=3]="Text",e[e.CDATA=4]="CDATA",e[e.Comment=5]="Comment"})(be||(be={}));function pm(e){return e.nodeType===e.ELEMENT_NODE}function nr(e){var t=e==null?void 0:e.host;return Boolean((t==null?void 0:t.shadowRoot)===e)}function rr(e){return Object.prototype.toString.call(e)==="[object ShadowRoot]"}function hm(e){return e.includes(" background-clip: text;")&&!e.includes(" -webkit-background-clip: text;")&&(e=e.replace(" background-clip: text;"," -webkit-background-clip: text; background-clip: text;")),e}function Mo(e){try{var t=e.rules||e.cssRules;return t?hm(Array.from(t).map(Hu).join("")):null}catch{return null}}function Hu(e){var t=e.cssText;if(mm(e))try{t=Mo(e.styleSheet)||t}catch{}return t}function mm(e){return"styleSheet"in e}var zu=function(){function e(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}return e.prototype.getId=function(t){var n;if(!t)return-1;var r=(n=this.getMeta(t))===null||n===void 0?void 0:n.id;return r!=null?r:-1},e.prototype.getNode=function(t){return this.idNodeMap.get(t)||null},e.prototype.getIds=function(){return Array.from(this.idNodeMap.keys())},e.prototype.getMeta=function(t){return this.nodeMetaMap.get(t)||null},e.prototype.removeNodeFromMap=function(t){var n=this,r=this.getId(t);this.idNodeMap.delete(r),t.childNodes&&t.childNodes.forEach(function(i){return n.removeNodeFromMap(i)})},e.prototype.has=function(t){return this.idNodeMap.has(t)},e.prototype.hasNode=function(t){return this.nodeMetaMap.has(t)},e.prototype.add=function(t,n){var r=n.id;this.idNodeMap.set(r,t),this.nodeMetaMap.set(t,n)},e.prototype.replace=function(t,n){var r=this.getNode(t);if(r){var i=this.nodeMetaMap.get(r);i&&this.nodeMetaMap.set(n,i)}this.idNodeMap.set(t,n)},e.prototype.reset=function(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap},e}();function gm(){return new zu}function Ka(e){var t=e.maskInputOptions,n=e.tagName,r=e.type,i=e.value,o=e.maskInputFn,a=i||"";return(t[n.toLowerCase()]||t[r])&&(o?a=o(a):a="*".repeat(a.length)),a}var Ws="__rrweb_original__";function vm(e){var t=e.getContext("2d");if(!t)return!0;for(var n=50,r=0;r<e.width;r+=n)for(var i=0;i<e.height;i+=n){var o=t.getImageData,a=Ws in o?o[Ws]:o,s=new Uint32Array(a.call(t,r,i,Math.min(n,e.width-r),Math.min(n,e.height-i)).data.buffer);if(s.some(function(l){return l!==0}))return!1}return!0}var ym=1,_m=new RegExp("[^a-z0-9-_:]"),cr=-2;function Ku(){return ym++}function bm(e){if(e instanceof HTMLFormElement)return"form";var t=e.tagName.toLowerCase().trim();return _m.test(t)?"div":t}function wm(e){return e.cssRules?Array.from(e.cssRules).map(function(t){return t.cssText||""}).join(""):""}function Cm(e){var t="";return e.indexOf("//")>-1?t=e.split("/").slice(0,3).join("/"):t=e.split("/")[0],t=t.split("?")[0],t}var vn,qs,Im=/url\((?:(')([^']*)'|(")(.*?)"|([^)]*))\)/gm,Em=/^(?:[a-z+]+:)?\/\//i,Sm=/^www\..*/i,km=/^(data:)([^,]*),(.*)/i;function mi(e,t){return(e||"").replace(Im,function(n,r,i,o,a,s){var l=i||a||s,u=r||o||"";if(!l)return n;if(Em.test(l)||Sm.test(l)||km.test(l))return"url(".concat(u).concat(l).concat(u,")");if(l[0]==="/")return"url(".concat(u).concat(Cm(t)+l).concat(u,")");var c=t.split("/"),d=l.split("/");c.pop();for(var f=0,p=d;f<p.length;f++){var h=p[f];h!=="."&&(h===".."?c.pop():c.push(h))}return"url(".concat(u).concat(c.join("/")).concat(u,")")})}var xm=/^[^ \t\n\r\u000c]+/,Am=/^[, \t\n\r\u000c]+/;function Tm(e,t){if(t.trim()==="")return t;var n=0;function r(u){var c,d=u.exec(t.substring(n));return d?(c=d[0],n+=c.length,c):""}for(var i=[];r(Am),!(n>=t.length);){var o=r(xm);if(o.slice(-1)===",")o=In(e,o.substring(0,o.length-1)),i.push(o);else{var a="";o=In(e,o);for(var s=!1;;){var l=t.charAt(n);if(l===""){i.push((o+a).trim());break}else if(s)l===")"&&(s=!1);else if(l===","){n+=1,i.push((o+a).trim());break}else l==="("&&(s=!0);a+=l,n+=1}}}return i.join(", ")}function In(e,t){if(!t||t.trim()==="")return t;var n=e.createElement("a");return n.href=t,n.href}function Rm(e){return Boolean(e.tagName==="svg"||e.ownerSVGElement)}function Ga(){var e=document.createElement("a");return e.href="",e.href}function Gu(e,t,n,r){return r&&(n==="src"||n==="href"&&!(t==="use"&&r[0]==="#")||n==="xlink:href"&&r[0]!=="#"||n==="background"&&(t==="table"||t==="td"||t==="th")?In(e,r):n==="srcset"?Tm(e,r):n==="style"?mi(r,Ga()):t==="object"&&n==="data"?In(e,r):r)}function Wu(e,t,n){return(e==="video"||e==="audio")&&t==="autoplay"}function Lm(e,t,n){if(typeof t=="string"){if(e.classList.contains(t))return!0}else for(var r=e.classList.length;r--;){var i=e.classList[r];if(t.test(i))return!0}return n?e.matches(n):!1}function gi(e,t,n){if(!e)return!1;if(e.nodeType!==e.ELEMENT_NODE)return n?gi(e.parentNode,t,n):!1;for(var r=e.classList.length;r--;){var i=e.classList[r];if(t.test(i))return!0}return n?gi(e.parentNode,t,n):!1}function qu(e,t,n){var r=e.nodeType===e.ELEMENT_NODE?e:e.parentElement;if(r===null)return!1;if(typeof t=="string"){if(r.classList.contains(t)||r.closest(".".concat(t)))return!0}else if(gi(r,t,!0))return!0;return!!(n&&(r.matches(n)||r.closest(n)))}function Om(e,t,n){var r=e.contentWindow;if(!!r){var i=!1,o;try{o=r.document.readyState}catch{return}if(o!=="complete"){var a=setTimeout(function(){i||(t(),i=!0)},n);e.addEventListener("load",function(){clearTimeout(a),i=!0,t()});return}var s="about:blank";if(r.location.href!==s||e.src===s||e.src==="")return setTimeout(t,0),e.addEventListener("load",t);e.addEventListener("load",t)}}function Nm(e,t,n){var r=!1,i;try{i=e.sheet}catch{return}if(!i){var o=setTimeout(function(){r||(t(),r=!0)},n);e.addEventListener("load",function(){clearTimeout(o),r=!0,t()})}}function Dm(e,t){var n=t.doc,r=t.mirror,i=t.blockClass,o=t.blockSelector,a=t.maskTextClass,s=t.maskTextSelector,l=t.inlineStylesheet,u=t.maskInputOptions,c=u===void 0?{}:u,d=t.maskTextFn,f=t.maskInputFn,p=t.dataURLOptions,h=p===void 0?{}:p,m=t.inlineImages,g=t.recordCanvas,_=t.keepIframeSrcFn,v=t.newlyAddedElement,b=v===void 0?!1:v,y=Um(n,r);switch(e.nodeType){case e.DOCUMENT_NODE:return e.compatMode!=="CSS1Compat"?{type:be.Document,childNodes:[],compatMode:e.compatMode}:{type:be.Document,childNodes:[]};case e.DOCUMENT_TYPE_NODE:return{type:be.DocumentType,name:e.name,publicId:e.publicId,systemId:e.systemId,rootId:y};case e.ELEMENT_NODE:return Mm(e,{doc:n,blockClass:i,blockSelector:o,inlineStylesheet:l,maskInputOptions:c,maskInputFn:f,dataURLOptions:h,inlineImages:m,recordCanvas:g,keepIframeSrcFn:_,newlyAddedElement:b,rootId:y});case e.TEXT_NODE:return Pm(e,{maskTextClass:a,maskTextSelector:s,maskTextFn:d,rootId:y});case e.CDATA_SECTION_NODE:return{type:be.CDATA,textContent:"",rootId:y};case e.COMMENT_NODE:return{type:be.Comment,textContent:e.textContent||"",rootId:y};default:return!1}}function Um(e,t){if(!!t.hasNode(e)){var n=t.getId(e);return n===1?void 0:n}}function Pm(e,t){var n,r=t.maskTextClass,i=t.maskTextSelector,o=t.maskTextFn,a=t.rootId,s=e.parentNode&&e.parentNode.tagName,l=e.textContent,u=s==="STYLE"?!0:void 0,c=s==="SCRIPT"?!0:void 0;if(u&&l){try{e.nextSibling||e.previousSibling||!((n=e.parentNode.sheet)===null||n===void 0)&&n.cssRules&&(l=wm(e.parentNode.sheet))}catch(d){console.warn("Cannot get CSS styles from text's parentNode. Error: ".concat(d),e)}l=mi(l,Ga())}return c&&(l="SCRIPT_PLACEHOLDER"),!u&&!c&&l&&qu(e,r,i)&&(l=o?o(l):l.replace(/[\S]/g,"*")),{type:be.Text,textContent:l||"",isStyle:u,rootId:a}}function Mm(e,t){for(var n=t.doc,r=t.blockClass,i=t.blockSelector,o=t.inlineStylesheet,a=t.maskInputOptions,s=a===void 0?{}:a,l=t.maskInputFn,u=t.dataURLOptions,c=u===void 0?{}:u,d=t.inlineImages,f=t.recordCanvas,p=t.keepIframeSrcFn,h=t.newlyAddedElement,m=h===void 0?!1:h,g=t.rootId,_=Lm(e,r,i),v=bm(e),b={},y=e.attributes.length,C=0;C<y;C++){var S=e.attributes[C];Wu(v,S.name,S.value)||(b[S.name]=Gu(n,v,S.name,S.value))}if(v==="link"&&o){var E=Array.from(n.styleSheets).find(function(te){return te.href===e.href}),I=null;E&&(I=Mo(E)),I&&(delete b.rel,delete b.href,b._cssText=mi(I,E.href))}if(v==="style"&&e.sheet&&!(e.innerText||e.textContent||"").trim().length){var I=Mo(e.sheet);I&&(b._cssText=mi(I,Ga()))}if(v==="input"||v==="textarea"||v==="select"){var x=e.value,R=e.checked;b.type!=="radio"&&b.type!=="checkbox"&&b.type!=="submit"&&b.type!=="button"&&x?b.value=Ka({type:b.type,tagName:v,value:x,maskInputOptions:s,maskInputFn:l}):R&&(b.checked=R)}if(v==="option"&&(e.selected&&!s.select?b.selected=!0:delete b.selected),v==="canvas"&&f){if(e.__context==="2d")vm(e)||(b.rr_dataURL=e.toDataURL(c.type,c.quality));else if(!("__context"in e)){var T=e.toDataURL(c.type,c.quality),O=document.createElement("canvas");O.width=e.width,O.height=e.height;var k=O.toDataURL(c.type,c.quality);T!==k&&(b.rr_dataURL=T)}}if(v==="img"&&d){vn||(vn=n.createElement("canvas"),qs=vn.getContext("2d"));var N=e,A=N.crossOrigin;N.crossOrigin="anonymous";var B=function(){try{vn.width=N.naturalWidth,vn.height=N.naturalHeight,qs.drawImage(N,0,0),b.rr_dataURL=vn.toDataURL(c.type,c.quality)}catch(te){console.warn("Cannot inline img src=".concat(N.currentSrc,"! Error: ").concat(te))}A?b.crossOrigin=A:N.removeAttribute("crossorigin")};N.complete&&N.naturalWidth!==0?B():N.onload=B}if((v==="audio"||v==="video")&&(b.rr_mediaState=e.paused?"paused":"played",b.rr_mediaCurrentTime=e.currentTime),m||(e.scrollLeft&&(b.rr_scrollLeft=e.scrollLeft),e.scrollTop&&(b.rr_scrollTop=e.scrollTop)),_){var J=e.getBoundingClientRect(),se=J.width,ce=J.height;b={class:b.class,rr_width:"".concat(se,"px"),rr_height:"".concat(ce,"px")}}return v==="iframe"&&!p(b.src)&&(e.contentDocument||(b.rr_src=b.src),delete b.src),{type:be.Element,tagName:v,attributes:b,childNodes:[],isSVG:Rm(e)||void 0,needBlock:_,rootId:g}}function ie(e){return e==null?"":e.toLowerCase()}function Fm(e,t){if(t.comment&&e.type===be.Comment)return!0;if(e.type===be.Element){if(t.script&&(e.tagName==="script"||e.tagName==="link"&&(e.attributes.rel==="preload"||e.attributes.rel==="modulepreload")&&e.attributes.as==="script"||e.tagName==="link"&&e.attributes.rel==="prefetch"&&typeof e.attributes.href=="string"&&e.attributes.href.endsWith(".js")))return!0;if(t.headFavicon&&(e.tagName==="link"&&e.attributes.rel==="shortcut icon"||e.tagName==="meta"&&(ie(e.attributes.name).match(/^msapplication-tile(image|color)$/)||ie(e.attributes.name)==="application-name"||ie(e.attributes.rel)==="icon"||ie(e.attributes.rel)==="apple-touch-icon"||ie(e.attributes.rel)==="shortcut icon")))return!0;if(e.tagName==="meta"){if(t.headMetaDescKeywords&&ie(e.attributes.name).match(/^description|keywords$/))return!0;if(t.headMetaSocial&&(ie(e.attributes.property).match(/^(og|twitter|fb):/)||ie(e.attributes.name).match(/^(og|twitter):/)||ie(e.attributes.name)==="pinterest"))return!0;if(t.headMetaRobots&&(ie(e.attributes.name)==="robots"||ie(e.attributes.name)==="googlebot"||ie(e.attributes.name)==="bingbot"))return!0;if(t.headMetaHttpEquiv&&e.attributes["http-equiv"]!==void 0)return!0;if(t.headMetaAuthorship&&(ie(e.attributes.name)==="author"||ie(e.attributes.name)==="generator"||ie(e.attributes.name)==="framework"||ie(e.attributes.name)==="publisher"||ie(e.attributes.name)==="progid"||ie(e.attributes.property).match(/^article:/)||ie(e.attributes.property).match(/^product:/)))return!0;if(t.headMetaVerification&&(ie(e.attributes.name)==="google-site-verification"||ie(e.attributes.name)==="yandex-verification"||ie(e.attributes.name)==="csrf-token"||ie(e.attributes.name)==="p:domain_verify"||ie(e.attributes.name)==="verify-v1"||ie(e.attributes.name)==="verification"||ie(e.attributes.name)==="shopify-checkout-api-token"))return!0}}return!1}function En(e,t){var n=t.doc,r=t.mirror,i=t.blockClass,o=t.blockSelector,a=t.maskTextClass,s=t.maskTextSelector,l=t.skipChild,u=l===void 0?!1:l,c=t.inlineStylesheet,d=c===void 0?!0:c,f=t.maskInputOptions,p=f===void 0?{}:f,h=t.maskTextFn,m=t.maskInputFn,g=t.slimDOMOptions,_=t.dataURLOptions,v=_===void 0?{}:_,b=t.inlineImages,y=b===void 0?!1:b,C=t.recordCanvas,S=C===void 0?!1:C,E=t.onSerialize,I=t.onIframeLoad,x=t.iframeLoadTimeout,R=x===void 0?5e3:x,T=t.onStylesheetLoad,O=t.stylesheetLoadTimeout,k=O===void 0?5e3:O,N=t.keepIframeSrcFn,A=N===void 0?function(){return!1}:N,B=t.newlyAddedElement,J=B===void 0?!1:B,se=t.preserveWhiteSpace,ce=se===void 0?!0:se,te=Dm(e,{doc:n,mirror:r,blockClass:i,blockSelector:o,maskTextClass:a,maskTextSelector:s,inlineStylesheet:d,maskInputOptions:p,maskTextFn:h,maskInputFn:m,dataURLOptions:v,inlineImages:y,recordCanvas:S,keepIframeSrcFn:A,newlyAddedElement:J});if(!te)return console.warn(e,"not serialized"),null;var Ee;r.hasNode(e)?Ee=r.getId(e):Fm(te,g)||!ce&&te.type===be.Text&&!te.isStyle&&!te.textContent.replace(/^\s+|\s+$/gm,"").length?Ee=cr:Ee=Ku();var Z=Object.assign(te,{id:Ee});if(r.add(e,Z),Ee===cr)return null;E&&E(e);var $e=!u;if(Z.type===be.Element){$e=$e&&!Z.needBlock,delete Z.needBlock;var de=e.shadowRoot;de&&rr(de)&&(Z.isShadowHost=!0)}if((Z.type===be.Document||Z.type===be.Element)&&$e){g.headWhitespace&&Z.type===be.Element&&Z.tagName==="head"&&(ce=!1);for(var Le={doc:n,mirror:r,blockClass:i,blockSelector:o,maskTextClass:a,maskTextSelector:s,skipChild:u,inlineStylesheet:d,maskInputOptions:p,maskTextFn:h,maskInputFn:m,slimDOMOptions:g,dataURLOptions:v,inlineImages:y,recordCanvas:S,preserveWhiteSpace:ce,onSerialize:E,onIframeLoad:I,iframeLoadTimeout:R,onStylesheetLoad:T,stylesheetLoadTimeout:k,keepIframeSrcFn:A},rt=0,H=Array.from(e.childNodes);rt<H.length;rt++){var Oe=H[rt],Q=En(Oe,Le);Q&&Z.childNodes.push(Q)}if(pm(e)&&e.shadowRoot)for(var ve=0,it=Array.from(e.shadowRoot.childNodes);ve<it.length;ve++){var Oe=it[ve],Q=En(Oe,Le);Q&&(rr(e.shadowRoot)&&(Q.isShadow=!0),Z.childNodes.push(Q))}}return e.parentNode&&nr(e.parentNode)&&rr(e.parentNode)&&(Z.isShadow=!0),Z.type===be.Element&&Z.tagName==="iframe"&&Om(e,function(){var X=e.contentDocument;if(X&&I){var mn=En(X,{doc:X,mirror:r,blockClass:i,blockSelector:o,maskTextClass:a,maskTextSelector:s,skipChild:!1,inlineStylesheet:d,maskInputOptions:p,maskTextFn:h,maskInputFn:m,slimDOMOptions:g,dataURLOptions:v,inlineImages:y,recordCanvas:S,preserveWhiteSpace:ce,onSerialize:E,onIframeLoad:I,iframeLoadTimeout:R,onStylesheetLoad:T,stylesheetLoadTimeout:k,keepIframeSrcFn:A});mn&&I(e,mn)}},R),Z.type===be.Element&&Z.tagName==="link"&&Z.attributes.rel==="stylesheet"&&Nm(e,function(){if(T){var X=En(e,{doc:n,mirror:r,blockClass:i,blockSelector:o,maskTextClass:a,maskTextSelector:s,skipChild:!1,inlineStylesheet:d,maskInputOptions:p,maskTextFn:h,maskInputFn:m,slimDOMOptions:g,dataURLOptions:v,inlineImages:y,recordCanvas:S,preserveWhiteSpace:ce,onSerialize:E,onIframeLoad:I,iframeLoadTimeout:R,onStylesheetLoad:T,stylesheetLoadTimeout:k,keepIframeSrcFn:A});X&&T(e,X)}},k),Z}function Vm(e,t){var n=t||{},r=n.mirror,i=r===void 0?new zu:r,o=n.blockClass,a=o===void 0?"rr-block":o,s=n.blockSelector,l=s===void 0?null:s,u=n.maskTextClass,c=u===void 0?"rr-mask":u,d=n.maskTextSelector,f=d===void 0?null:d,p=n.inlineStylesheet,h=p===void 0?!0:p,m=n.inlineImages,g=m===void 0?!1:m,_=n.recordCanvas,v=_===void 0?!1:_,b=n.maskAllInputs,y=b===void 0?!1:b,C=n.maskTextFn,S=n.maskInputFn,E=n.slimDOM,I=E===void 0?!1:E,x=n.dataURLOptions,R=n.preserveWhiteSpace,T=n.onSerialize,O=n.onIframeLoad,k=n.iframeLoadTimeout,N=n.onStylesheetLoad,A=n.stylesheetLoadTimeout,B=n.keepIframeSrcFn,J=B===void 0?function(){return!1}:B,se=y===!0?{color:!0,date:!0,"datetime-local":!0,email:!0,month:!0,number:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0,textarea:!0,select:!0,password:!0}:y===!1?{password:!0}:y,ce=I===!0||I==="all"?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaDescKeywords:I==="all",headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaAuthorship:!0,headMetaVerification:!0}:I===!1?{}:I;return En(e,{doc:e,mirror:i,blockClass:a,blockSelector:l,maskTextClass:c,maskTextSelector:f,skipChild:!1,inlineStylesheet:h,maskInputOptions:se,maskTextFn:C,maskInputFn:S,slimDOMOptions:ce,dataURLOptions:x,inlineImages:g,recordCanvas:v,preserveWhiteSpace:R,onSerialize:T,onIframeLoad:O,iframeLoadTimeout:k,onStylesheetLoad:N,stylesheetLoadTimeout:A,keepIframeSrcFn:J,newlyAddedElement:!1})}function Ne(e,t,n=document){const r={capture:!0,passive:!0};return n.addEventListener(e,t,r),()=>n.removeEventListener(e,t,r)}const wn=`Please stop import mirror directly. Instead of that,\r
3
- now you can use replayer.getMirror() to access the mirror instance of a replayer,\r
4
- or you can use record.mirror to access the mirror instance during recording.`;let $s={map:{},getId(){return console.error(wn),-1},getNode(){return console.error(wn),null},removeNodeFromMap(){console.error(wn)},has(){return console.error(wn),!1},reset(){console.error(wn)}};typeof window<"u"&&window.Proxy&&window.Reflect&&($s=new Proxy($s,{get(e,t,n){return t==="map"&&console.error(wn),Reflect.get(e,t,n)}}));function dr(e,t,n={}){let r=null,i=0;return function(...o){const a=Date.now();!i&&n.leading===!1&&(i=a);const s=t-(a-i),l=this;s<=0||s>t?(r&&(clearTimeout(r),r=null),i=a,e.apply(l,o)):!r&&n.trailing!==!1&&(r=setTimeout(()=>{i=n.leading===!1?0:Date.now(),r=null,e.apply(l,o)},s))}}function Bi(e,t,n,r,i=window){const o=i.Object.getOwnPropertyDescriptor(e,t);return i.Object.defineProperty(e,t,r?n:{set(a){setTimeout(()=>{n.set.call(this,a)},0),o&&o.set&&o.set.call(this,a)}}),()=>Bi(e,t,o||{},!0)}function Er(e,t,n){try{if(!(t in e))return()=>{};const r=e[t],i=n(r);return typeof i=="function"&&(i.prototype=i.prototype||{},Object.defineProperties(i,{__rrweb_original__:{enumerable:!1,value:r}})),e[t]=i,()=>{e[t]=r}}catch{return()=>{}}}function $u(e){var t,n,r,i,o,a;const s=e.document;return{left:s.scrollingElement?s.scrollingElement.scrollLeft:e.pageXOffset!==void 0?e.pageXOffset:(s==null?void 0:s.documentElement.scrollLeft)||((n=(t=s==null?void 0:s.body)===null||t===void 0?void 0:t.parentElement)===null||n===void 0?void 0:n.scrollLeft)||((r=s==null?void 0:s.body)===null||r===void 0?void 0:r.scrollLeft)||0,top:s.scrollingElement?s.scrollingElement.scrollTop:e.pageYOffset!==void 0?e.pageYOffset:(s==null?void 0:s.documentElement.scrollTop)||((o=(i=s==null?void 0:s.body)===null||i===void 0?void 0:i.parentElement)===null||o===void 0?void 0:o.scrollTop)||((a=s==null?void 0:s.body)===null||a===void 0?void 0:a.scrollTop)||0}}function Zu(){return window.innerHeight||document.documentElement&&document.documentElement.clientHeight||document.body&&document.body.clientHeight}function Yu(){return window.innerWidth||document.documentElement&&document.documentElement.clientWidth||document.body&&document.body.clientWidth}function De(e,t,n,r){if(!e)return!1;const i=e.nodeType===e.ELEMENT_NODE?e:e.parentElement;if(!i)return!1;if(typeof t=="string"){if(i.classList.contains(t)||r&&i.closest("."+t)!==null)return!0}else if(gi(i,t,r))return!0;return!!(n&&(i.matches(n)||r&&i.closest(n)!==null))}function Bm(e,t){return t.getId(e)!==-1}function so(e,t){return t.getId(e)===cr}function Qu(e,t){if(nr(e))return!1;const n=t.getId(e);return t.has(n)?e.parentNode&&e.parentNode.nodeType===e.DOCUMENT_NODE?!1:e.parentNode?Qu(e.parentNode,t):!0:!0}function Xu(e){return Boolean(e.changedTouches)}function jm(e=window){"NodeList"in e&&!e.NodeList.prototype.forEach&&(e.NodeList.prototype.forEach=Array.prototype.forEach),"DOMTokenList"in e&&!e.DOMTokenList.prototype.forEach&&(e.DOMTokenList.prototype.forEach=Array.prototype.forEach),Node.prototype.contains||(Node.prototype.contains=(...t)=>{let n=t[0];if(!(0 in t))throw new TypeError("1 argument is required");do if(this===n)return!0;while(n=n&&n.parentNode);return!1})}function Ju(e,t){return Boolean(e.nodeName==="IFRAME"&&t.getMeta(e))}function ec(e,t){return Boolean(e.nodeName==="LINK"&&e.nodeType===e.ELEMENT_NODE&&e.getAttribute&&e.getAttribute("rel")==="stylesheet"&&t.getMeta(e))}function Fo(e){return Boolean(e==null?void 0:e.shadowRoot)}class Hm{constructor(){this.id=1,this.styleIDMap=new WeakMap,this.idStyleMap=new Map}getId(t){var n;return(n=this.styleIDMap.get(t))!==null&&n!==void 0?n:-1}has(t){return this.styleIDMap.has(t)}add(t,n){if(this.has(t))return this.getId(t);let r;return n===void 0?r=this.id++:r=n,this.styleIDMap.set(t,r),this.idStyleMap.set(r,t),r}getStyle(t){return this.idStyleMap.get(t)||null}reset(){this.styleIDMap=new WeakMap,this.idStyleMap=new Map,this.id=1}generateId(){return this.id++}}function tc(e){var t,n;let r=null;return((n=(t=e.getRootNode)===null||t===void 0?void 0:t.call(e))===null||n===void 0?void 0:n.nodeType)===Node.DOCUMENT_FRAGMENT_NODE&&e.getRootNode().host&&(r=e.getRootNode().host),r}function zm(e){let t=e,n;for(;n=tc(t);)t=n;return t}function Km(e){const t=e.ownerDocument;if(!t)return!1;const n=zm(e);return t.contains(n)}function nc(e){const t=e.ownerDocument;return t?t.contains(e)||Km(e):!1}var Y=(e=>(e[e.DomContentLoaded=0]="DomContentLoaded",e[e.Load=1]="Load",e[e.FullSnapshot=2]="FullSnapshot",e[e.IncrementalSnapshot=3]="IncrementalSnapshot",e[e.Meta=4]="Meta",e[e.Custom=5]="Custom",e[e.Plugin=6]="Plugin",e))(Y||{}),$=(e=>(e[e.Mutation=0]="Mutation",e[e.MouseMove=1]="MouseMove",e[e.MouseInteraction=2]="MouseInteraction",e[e.Scroll=3]="Scroll",e[e.ViewportResize=4]="ViewportResize",e[e.Input=5]="Input",e[e.TouchMove=6]="TouchMove",e[e.MediaInteraction=7]="MediaInteraction",e[e.StyleSheetRule=8]="StyleSheetRule",e[e.CanvasMutation=9]="CanvasMutation",e[e.Font=10]="Font",e[e.Log=11]="Log",e[e.Drag=12]="Drag",e[e.StyleDeclaration=13]="StyleDeclaration",e[e.Selection=14]="Selection",e[e.AdoptedStyleSheet=15]="AdoptedStyleSheet",e))($||{}),Vo=(e=>(e[e.MouseUp=0]="MouseUp",e[e.MouseDown=1]="MouseDown",e[e.Click=2]="Click",e[e.ContextMenu=3]="ContextMenu",e[e.DblClick=4]="DblClick",e[e.Focus=5]="Focus",e[e.Blur=6]="Blur",e[e.TouchStart=7]="TouchStart",e[e.TouchMove_Departed=8]="TouchMove_Departed",e[e.TouchEnd=9]="TouchEnd",e[e.TouchCancel=10]="TouchCancel",e))(Vo||{}),Dn=(e=>(e[e["2D"]=0]="2D",e[e.WebGL=1]="WebGL",e[e.WebGL2=2]="WebGL2",e))(Dn||{});function Zs(e){return"__ln"in e}class Gm{constructor(){this.length=0,this.head=null}get(t){if(t>=this.length)throw new Error("Position outside of list range");let n=this.head;for(let r=0;r<t;r++)n=(n==null?void 0:n.next)||null;return n}addNode(t){const n={value:t,previous:null,next:null};if(t.__ln=n,t.previousSibling&&Zs(t.previousSibling)){const r=t.previousSibling.__ln.next;n.next=r,n.previous=t.previousSibling.__ln,t.previousSibling.__ln.next=n,r&&(r.previous=n)}else if(t.nextSibling&&Zs(t.nextSibling)&&t.nextSibling.__ln.previous){const r=t.nextSibling.__ln.previous;n.previous=r,n.next=t.nextSibling.__ln,t.nextSibling.__ln.previous=n,r&&(r.next=n)}else this.head&&(this.head.previous=n),n.next=this.head,this.head=n;this.length++}removeNode(t){const n=t.__ln;!this.head||(n.previous?(n.previous.next=n.next,n.next&&(n.next.previous=n.previous)):(this.head=n.next,this.head&&(this.head.previous=null)),t.__ln&&delete t.__ln,this.length--)}}const Ys=(e,t)=>`${e}@${t}`;class Wm{constructor(){this.frozen=!1,this.locked=!1,this.texts=[],this.attributes=[],this.removes=[],this.mapRemoves=[],this.movedMap={},this.addedSet=new Set,this.movedSet=new Set,this.droppedSet=new Set,this.processMutations=t=>{t.forEach(this.processMutation),this.emit()},this.emit=()=>{if(this.frozen||this.locked)return;const t=[],n=new Gm,r=s=>{let l=s,u=cr;for(;u===cr;)l=l&&l.nextSibling,u=l&&this.mirror.getId(l);return u},i=s=>{if(!s.parentNode||!nc(s))return;const l=nr(s.parentNode)?this.mirror.getId(tc(s)):this.mirror.getId(s.parentNode),u=r(s);if(l===-1||u===-1)return n.addNode(s);const c=En(s,{doc:this.doc,mirror:this.mirror,blockClass:this.blockClass,blockSelector:this.blockSelector,maskTextClass:this.maskTextClass,maskTextSelector:this.maskTextSelector,skipChild:!0,newlyAddedElement:!0,inlineStylesheet:this.inlineStylesheet,maskInputOptions:this.maskInputOptions,maskTextFn:this.maskTextFn,maskInputFn:this.maskInputFn,slimDOMOptions:this.slimDOMOptions,dataURLOptions:this.dataURLOptions,recordCanvas:this.recordCanvas,inlineImages:this.inlineImages,onSerialize:d=>{Ju(d,this.mirror)&&this.iframeManager.addIframe(d),ec(d,this.mirror)&&this.stylesheetManager.trackLinkElement(d),Fo(s)&&this.shadowDomManager.addShadowRoot(s.shadowRoot,this.doc)},onIframeLoad:(d,f)=>{this.iframeManager.attachIframe(d,f),this.shadowDomManager.observeAttachShadow(d)},onStylesheetLoad:(d,f)=>{this.stylesheetManager.attachLinkElement(d,f)}});c&&t.push({parentId:l,nextId:u,node:c})};for(;this.mapRemoves.length;)this.mirror.removeNodeFromMap(this.mapRemoves.shift());for(const s of Array.from(this.movedSet.values()))Qs(this.removes,s,this.mirror)&&!this.movedSet.has(s.parentNode)||i(s);for(const s of Array.from(this.addedSet.values()))!Xs(this.droppedSet,s)&&!Qs(this.removes,s,this.mirror)||Xs(this.movedSet,s)?i(s):this.droppedSet.add(s);let o=null;for(;n.length;){let s=null;if(o){const l=this.mirror.getId(o.value.parentNode),u=r(o.value);l!==-1&&u!==-1&&(s=o)}if(!s)for(let l=n.length-1;l>=0;l--){const u=n.get(l);if(u){const c=this.mirror.getId(u.value.parentNode);if(r(u.value)===-1)continue;if(c!==-1){s=u;break}else{const f=u.value;if(f.parentNode&&f.parentNode.nodeType===Node.DOCUMENT_FRAGMENT_NODE){const p=f.parentNode.host;if(this.mirror.getId(p)!==-1){s=u;break}}}}}if(!s){for(;n.head;)n.removeNode(n.head.value);break}o=s.previous,n.removeNode(s.value),i(s.value)}const a={texts:this.texts.map(s=>({id:this.mirror.getId(s.node),value:s.value})).filter(s=>this.mirror.has(s.id)),attributes:this.attributes.map(s=>({id:this.mirror.getId(s.node),attributes:s.attributes})).filter(s=>this.mirror.has(s.id)),removes:this.removes,adds:t};!a.texts.length&&!a.attributes.length&&!a.removes.length&&!a.adds.length||(this.texts=[],this.attributes=[],this.removes=[],this.addedSet=new Set,this.movedSet=new Set,this.droppedSet=new Set,this.movedMap={},this.mutationCb(a))},this.processMutation=t=>{if(!so(t.target,this.mirror))switch(t.type){case"characterData":{const n=t.target.textContent;!De(t.target,this.blockClass,this.blockSelector,!1)&&n!==t.oldValue&&this.texts.push({value:qu(t.target,this.maskTextClass,this.maskTextSelector)&&n?this.maskTextFn?this.maskTextFn(n):n.replace(/[\S]/g,"*"):n,node:t.target});break}case"attributes":{const n=t.target;let r=t.target.getAttribute(t.attributeName);if(t.attributeName==="value"&&(r=Ka({maskInputOptions:this.maskInputOptions,tagName:t.target.tagName,type:t.target.getAttribute("type"),value:r,maskInputFn:this.maskInputFn})),De(t.target,this.blockClass,this.blockSelector,!1)||r===t.oldValue)return;let i=this.attributes.find(o=>o.node===t.target);if(n.tagName==="IFRAME"&&t.attributeName==="src"&&!this.keepIframeSrcFn(r))if(!n.contentDocument)t.attributeName="rr_src";else return;if(i||(i={node:t.target,attributes:{}},this.attributes.push(i)),t.attributeName==="style"){const o=this.doc.createElement("span");t.oldValue&&o.setAttribute("style",t.oldValue),(i.attributes.style===void 0||i.attributes.style===null)&&(i.attributes.style={});const a=i.attributes.style;for(const s of Array.from(n.style)){const l=n.style.getPropertyValue(s),u=n.style.getPropertyPriority(s);(l!==o.style.getPropertyValue(s)||u!==o.style.getPropertyPriority(s))&&(u===""?a[s]=l:a[s]=[l,u])}for(const s of Array.from(o.style))n.style.getPropertyValue(s)===""&&(a[s]=!1)}else Wu(n.tagName,t.attributeName)||(i.attributes[t.attributeName]=Gu(this.doc,n.tagName,t.attributeName,r));break}case"childList":{if(De(t.target,this.blockClass,this.blockSelector,!0))return;t.addedNodes.forEach(n=>this.genAdds(n,t.target)),t.removedNodes.forEach(n=>{const r=this.mirror.getId(n),i=nr(t.target)?this.mirror.getId(t.target.host):this.mirror.getId(t.target);De(t.target,this.blockClass,this.blockSelector,!1)||so(n,this.mirror)||!Bm(n,this.mirror)||(this.addedSet.has(n)?(Bo(this.addedSet,n),this.droppedSet.add(n)):this.addedSet.has(t.target)&&r===-1||Qu(t.target,this.mirror)||(this.movedSet.has(n)&&this.movedMap[Ys(r,i)]?Bo(this.movedSet,n):this.removes.push({parentId:i,id:r,isShadow:nr(t.target)&&rr(t.target)?!0:void 0})),this.mapRemoves.push(n))});break}}},this.genAdds=(t,n)=>{if(!this.processedNodeManager.inOtherBuffer(t,this)){if(this.mirror.hasNode(t)){if(so(t,this.mirror))return;this.movedSet.add(t);let r=null;n&&this.mirror.hasNode(n)&&(r=this.mirror.getId(n)),r&&r!==-1&&(this.movedMap[Ys(this.mirror.getId(t),r)]=!0)}else this.addedSet.add(t),this.droppedSet.delete(t);De(t,this.blockClass,this.blockSelector,!1)||(t.childNodes.forEach(r=>this.genAdds(r)),Fo(t)&&t.shadowRoot.childNodes.forEach(r=>{this.processedNodeManager.add(r,this),this.genAdds(r,t)}))}}}init(t){["mutationCb","blockClass","blockSelector","maskTextClass","maskTextSelector","inlineStylesheet","maskInputOptions","maskTextFn","maskInputFn","keepIframeSrcFn","recordCanvas","inlineImages","slimDOMOptions","dataURLOptions","doc","mirror","iframeManager","stylesheetManager","shadowDomManager","canvasManager","processedNodeManager"].forEach(n=>{this[n]=t[n]})}freeze(){this.frozen=!0,this.canvasManager.freeze()}unfreeze(){this.frozen=!1,this.canvasManager.unfreeze(),this.emit()}isFrozen(){return this.frozen}lock(){this.locked=!0,this.canvasManager.lock()}unlock(){this.locked=!1,this.canvasManager.unlock(),this.emit()}reset(){this.shadowDomManager.reset(),this.canvasManager.reset()}}function Bo(e,t){e.delete(t),t.childNodes.forEach(n=>Bo(e,n))}function Qs(e,t,n){return e.length===0?!1:rc(e,t,n)}function rc(e,t,n){const{parentNode:r}=t;if(!r)return!1;const i=n.getId(r);return e.some(o=>o.id===i)?!0:rc(e,r,n)}function Xs(e,t){return e.size===0?!1:ic(e,t)}function ic(e,t){const{parentNode:n}=t;return n?e.has(n)?!0:ic(e,n):!1}class qm{constructor(){this.nodeMap=new WeakMap,this.periodicallyClear()}periodicallyClear(){requestAnimationFrame(()=>{this.clear(),this.periodicallyClear()})}inOtherBuffer(t,n){const r=this.nodeMap.get(t);return r&&Array.from(r).some(i=>i!==n)}add(t,n){this.nodeMap.set(t,(this.nodeMap.get(t)||new Set).add(n))}clear(){this.nodeMap=new WeakMap}}const tn=[],Js=new qm;function Sr(e){try{if("composedPath"in e){const t=e.composedPath();if(t.length)return t[0]}else if("path"in e&&e.path.length)return e.path[0];return e.target}catch{return e.target}}function oc(e,t){var n,r;const i=new Wm;tn.push(i),i.init(e);let o=window.MutationObserver||window.__rrMutationObserver;const a=(r=(n=window==null?void 0:window.Zone)===null||n===void 0?void 0:n.__symbol__)===null||r===void 0?void 0:r.call(n,"MutationObserver");a&&window[a]&&(o=window[a]);const s=new o(i.processMutations.bind(i));return s.observe(t,{attributes:!0,attributeOldValue:!0,characterData:!0,characterDataOldValue:!0,childList:!0,subtree:!0}),s}function $m({mousemoveCb:e,sampling:t,doc:n,mirror:r}){if(t.mousemove===!1)return()=>{};const i=typeof t.mousemove=="number"?t.mousemove:50,o=typeof t.mousemoveCallback=="number"?t.mousemoveCallback:500;let a=[],s;const l=dr(d=>{const f=Date.now()-s;e(a.map(p=>(p.timeOffset-=f,p)),d),a=[],s=null},o),u=dr(d=>{const f=Sr(d),{clientX:p,clientY:h}=Xu(d)?d.changedTouches[0]:d;s||(s=Date.now()),a.push({x:p,y:h,id:r.getId(f),timeOffset:Date.now()-s}),l(typeof DragEvent<"u"&&d instanceof DragEvent?$.Drag:d instanceof MouseEvent?$.MouseMove:$.TouchMove)},i,{trailing:!1}),c=[Ne("mousemove",u,n),Ne("touchmove",u,n),Ne("drag",u,n)];return()=>{c.forEach(d=>d())}}function Zm({mouseInteractionCb:e,doc:t,mirror:n,blockClass:r,blockSelector:i,sampling:o}){if(o.mouseInteraction===!1)return()=>{};const a=o.mouseInteraction===!0||o.mouseInteraction===void 0?{}:o.mouseInteraction,s=[],l=u=>c=>{const d=Sr(c);if(De(d,r,i,!0))return;const f=Xu(c)?c.changedTouches[0]:c;if(!f)return;const p=n.getId(d),{clientX:h,clientY:m}=f;e({type:Vo[u],id:p,x:h,y:m})};return Object.keys(Vo).filter(u=>Number.isNaN(Number(u))&&!u.endsWith("_Departed")&&a[u]!==!1).forEach(u=>{const c=u.toLowerCase(),d=l(u);s.push(Ne(c,d,t))}),()=>{s.forEach(u=>u())}}function ac({scrollCb:e,doc:t,mirror:n,blockClass:r,blockSelector:i,sampling:o}){const a=dr(s=>{const l=Sr(s);if(!l||De(l,r,i,!0))return;const u=n.getId(l);if(l===t&&t.defaultView){const c=$u(t.defaultView);e({id:u,x:c.left,y:c.top})}else e({id:u,x:l.scrollLeft,y:l.scrollTop})},o.scroll||100);return Ne("scroll",a,t)}function Ym({viewportResizeCb:e}){let t=-1,n=-1;const r=dr(()=>{const i=Zu(),o=Yu();(t!==i||n!==o)&&(e({width:Number(o),height:Number(i)}),t=i,n=o)},200);return Ne("resize",r,window)}function el(e,t){const n=Object.assign({},e);return t||delete n.userTriggered,n}const Qm=["INPUT","TEXTAREA","SELECT"],tl=new WeakMap;function Xm({inputCb:e,doc:t,mirror:n,blockClass:r,blockSelector:i,ignoreClass:o,maskInputOptions:a,maskInputFn:s,sampling:l,userTriggeredOnInput:u}){function c(_){let v=Sr(_);const b=_.isTrusted;if(v&&v.tagName==="OPTION"&&(v=v.parentElement),!v||!v.tagName||Qm.indexOf(v.tagName)<0||De(v,r,i,!0))return;const y=v.type;if(v.classList.contains(o))return;let C=v.value,S=!1;y==="radio"||y==="checkbox"?S=v.checked:(a[v.tagName.toLowerCase()]||a[y])&&(C=Ka({maskInputOptions:a,tagName:v.tagName,type:y,value:C,maskInputFn:s})),d(v,el({text:C,isChecked:S,userTriggered:b},u));const E=v.name;y==="radio"&&E&&S&&t.querySelectorAll(`input[type="radio"][name="${E}"]`).forEach(I=>{I!==v&&d(I,el({text:I.value,isChecked:!S,userTriggered:!1},u))})}function d(_,v){const b=tl.get(_);if(!b||b.text!==v.text||b.isChecked!==v.isChecked){tl.set(_,v);const y=n.getId(_);e(Object.assign(Object.assign({},v),{id:y}))}}const p=(l.input==="last"?["change"]:["input","change"]).map(_=>Ne(_,c,t)),h=t.defaultView;if(!h)return()=>{p.forEach(_=>_())};const m=h.Object.getOwnPropertyDescriptor(h.HTMLInputElement.prototype,"value"),g=[[h.HTMLInputElement.prototype,"value"],[h.HTMLInputElement.prototype,"checked"],[h.HTMLSelectElement.prototype,"value"],[h.HTMLTextAreaElement.prototype,"value"],[h.HTMLSelectElement.prototype,"selectedIndex"],[h.HTMLOptionElement.prototype,"selected"]];return m&&m.set&&p.push(...g.map(_=>Bi(_[0],_[1],{set(){c({target:this,isTrusted:!1})}},!1,h))),()=>{p.forEach(_=>_())}}function vi(e){const t=[];function n(r,i){if(Br("CSSGroupingRule")&&r.parentRule instanceof CSSGroupingRule||Br("CSSMediaRule")&&r.parentRule instanceof CSSMediaRule||Br("CSSSupportsRule")&&r.parentRule instanceof CSSSupportsRule||Br("CSSConditionRule")&&r.parentRule instanceof CSSConditionRule){const a=Array.from(r.parentRule.cssRules).indexOf(r);i.unshift(a)}else if(r.parentStyleSheet){const a=Array.from(r.parentStyleSheet.cssRules).indexOf(r);i.unshift(a)}return i}return n(e,t)}function Ot(e,t,n){let r,i;return e?(e.ownerNode?r=t.getId(e.ownerNode):i=n.getId(e),{styleId:i,id:r}):{}}function Jm({styleSheetRuleCb:e,mirror:t,stylesheetManager:n},{win:r}){if(!r.CSSStyleSheet||!r.CSSStyleSheet.prototype)return()=>{};const i=r.CSSStyleSheet.prototype.insertRule;r.CSSStyleSheet.prototype.insertRule=function(c,d){const{id:f,styleId:p}=Ot(this,t,n.styleMirror);return(f&&f!==-1||p&&p!==-1)&&e({id:f,styleId:p,adds:[{rule:c,index:d}]}),i.apply(this,[c,d])};const o=r.CSSStyleSheet.prototype.deleteRule;r.CSSStyleSheet.prototype.deleteRule=function(c){const{id:d,styleId:f}=Ot(this,t,n.styleMirror);return(d&&d!==-1||f&&f!==-1)&&e({id:d,styleId:f,removes:[{index:c}]}),o.apply(this,[c])};let a;r.CSSStyleSheet.prototype.replace&&(a=r.CSSStyleSheet.prototype.replace,r.CSSStyleSheet.prototype.replace=function(c){const{id:d,styleId:f}=Ot(this,t,n.styleMirror);return(d&&d!==-1||f&&f!==-1)&&e({id:d,styleId:f,replace:c}),a.apply(this,[c])});let s;r.CSSStyleSheet.prototype.replaceSync&&(s=r.CSSStyleSheet.prototype.replaceSync,r.CSSStyleSheet.prototype.replaceSync=function(c){const{id:d,styleId:f}=Ot(this,t,n.styleMirror);return(d&&d!==-1||f&&f!==-1)&&e({id:d,styleId:f,replaceSync:c}),s.apply(this,[c])});const l={};jr("CSSGroupingRule")?l.CSSGroupingRule=r.CSSGroupingRule:(jr("CSSMediaRule")&&(l.CSSMediaRule=r.CSSMediaRule),jr("CSSConditionRule")&&(l.CSSConditionRule=r.CSSConditionRule),jr("CSSSupportsRule")&&(l.CSSSupportsRule=r.CSSSupportsRule));const u={};return Object.entries(l).forEach(([c,d])=>{u[c]={insertRule:d.prototype.insertRule,deleteRule:d.prototype.deleteRule},d.prototype.insertRule=function(f,p){const{id:h,styleId:m}=Ot(this.parentStyleSheet,t,n.styleMirror);return(h&&h!==-1||m&&m!==-1)&&e({id:h,styleId:m,adds:[{rule:f,index:[...vi(this),p||0]}]}),u[c].insertRule.apply(this,[f,p])},d.prototype.deleteRule=function(f){const{id:p,styleId:h}=Ot(this.parentStyleSheet,t,n.styleMirror);return(p&&p!==-1||h&&h!==-1)&&e({id:p,styleId:h,removes:[{index:[...vi(this),f]}]}),u[c].deleteRule.apply(this,[f])}}),()=>{r.CSSStyleSheet.prototype.insertRule=i,r.CSSStyleSheet.prototype.deleteRule=o,a&&(r.CSSStyleSheet.prototype.replace=a),s&&(r.CSSStyleSheet.prototype.replaceSync=s),Object.entries(l).forEach(([c,d])=>{d.prototype.insertRule=u[c].insertRule,d.prototype.deleteRule=u[c].deleteRule})}}function sc({mirror:e,stylesheetManager:t},n){var r,i,o;let a=null;n.nodeName==="#document"?a=e.getId(n):a=e.getId(n.host);const s=n.nodeName==="#document"?(r=n.defaultView)===null||r===void 0?void 0:r.Document:(o=(i=n.ownerDocument)===null||i===void 0?void 0:i.defaultView)===null||o===void 0?void 0:o.ShadowRoot,l=Object.getOwnPropertyDescriptor(s==null?void 0:s.prototype,"adoptedStyleSheets");return a===null||a===-1||!s||!l?()=>{}:(Object.defineProperty(n,"adoptedStyleSheets",{configurable:l.configurable,enumerable:l.enumerable,get(){var u;return(u=l.get)===null||u===void 0?void 0:u.call(this)},set(u){var c;const d=(c=l.set)===null||c===void 0?void 0:c.call(this,u);if(a!==null&&a!==-1)try{t.adoptStyleSheets(u,a)}catch{}return d}}),()=>{Object.defineProperty(n,"adoptedStyleSheets",{configurable:l.configurable,enumerable:l.enumerable,get:l.get,set:l.set})})}function eg({styleDeclarationCb:e,mirror:t,ignoreCSSAttributes:n,stylesheetManager:r},{win:i}){const o=i.CSSStyleDeclaration.prototype.setProperty;i.CSSStyleDeclaration.prototype.setProperty=function(s,l,u){var c;if(n.has(s))return o.apply(this,[s,l,u]);const{id:d,styleId:f}=Ot((c=this.parentRule)===null||c===void 0?void 0:c.parentStyleSheet,t,r.styleMirror);return(d&&d!==-1||f&&f!==-1)&&e({id:d,styleId:f,set:{property:s,value:l,priority:u},index:vi(this.parentRule)}),o.apply(this,[s,l,u])};const a=i.CSSStyleDeclaration.prototype.removeProperty;return i.CSSStyleDeclaration.prototype.removeProperty=function(s){var l;if(n.has(s))return a.apply(this,[s]);const{id:u,styleId:c}=Ot((l=this.parentRule)===null||l===void 0?void 0:l.parentStyleSheet,t,r.styleMirror);return(u&&u!==-1||c&&c!==-1)&&e({id:u,styleId:c,remove:{property:s},index:vi(this.parentRule)}),a.apply(this,[s])},()=>{i.CSSStyleDeclaration.prototype.setProperty=o,i.CSSStyleDeclaration.prototype.removeProperty=a}}function tg({mediaInteractionCb:e,blockClass:t,blockSelector:n,mirror:r,sampling:i}){const o=s=>dr(l=>{const u=Sr(l);if(!u||De(u,t,n,!0))return;const{currentTime:c,volume:d,muted:f,playbackRate:p}=u;e({type:s,id:r.getId(u),currentTime:c,volume:d,muted:f,playbackRate:p})},i.media||500),a=[Ne("play",o(0)),Ne("pause",o(1)),Ne("seeked",o(2)),Ne("volumechange",o(3)),Ne("ratechange",o(4))];return()=>{a.forEach(s=>s())}}function ng({fontCb:e,doc:t}){const n=t.defaultView;if(!n)return()=>{};const r=[],i=new WeakMap,o=n.FontFace;n.FontFace=function(l,u,c){const d=new o(l,u,c);return i.set(d,{family:l,buffer:typeof u!="string",descriptors:c,fontSource:typeof u=="string"?u:JSON.stringify(Array.from(new Uint8Array(u)))}),d};const a=Er(t.fonts,"add",function(s){return function(l){return setTimeout(()=>{const u=i.get(l);u&&(e(u),i.delete(l))},0),s.apply(this,[l])}});return r.push(()=>{n.FontFace=o}),r.push(a),()=>{r.forEach(s=>s())}}function rg(e){const{doc:t,mirror:n,blockClass:r,blockSelector:i,selectionCb:o}=e;let a=!0;const s=()=>{const l=t.getSelection();if(!l||a&&(l==null?void 0:l.isCollapsed))return;a=l.isCollapsed||!1;const u=[],c=l.rangeCount||0;for(let d=0;d<c;d++){const f=l.getRangeAt(d),{startContainer:p,startOffset:h,endContainer:m,endOffset:g}=f;De(p,r,i,!0)||De(m,r,i,!0)||u.push({start:n.getId(p),startOffset:h,end:n.getId(m),endOffset:g})}o({ranges:u})};return s(),Ne("selectionchange",s)}function ig(e,t){const{mutationCb:n,mousemoveCb:r,mouseInteractionCb:i,scrollCb:o,viewportResizeCb:a,inputCb:s,mediaInteractionCb:l,styleSheetRuleCb:u,styleDeclarationCb:c,canvasMutationCb:d,fontCb:f,selectionCb:p}=e;e.mutationCb=(...h)=>{t.mutation&&t.mutation(...h),n(...h)},e.mousemoveCb=(...h)=>{t.mousemove&&t.mousemove(...h),r(...h)},e.mouseInteractionCb=(...h)=>{t.mouseInteraction&&t.mouseInteraction(...h),i(...h)},e.scrollCb=(...h)=>{t.scroll&&t.scroll(...h),o(...h)},e.viewportResizeCb=(...h)=>{t.viewportResize&&t.viewportResize(...h),a(...h)},e.inputCb=(...h)=>{t.input&&t.input(...h),s(...h)},e.mediaInteractionCb=(...h)=>{t.mediaInteaction&&t.mediaInteaction(...h),l(...h)},e.styleSheetRuleCb=(...h)=>{t.styleSheetRule&&t.styleSheetRule(...h),u(...h)},e.styleDeclarationCb=(...h)=>{t.styleDeclaration&&t.styleDeclaration(...h),c(...h)},e.canvasMutationCb=(...h)=>{t.canvasMutation&&t.canvasMutation(...h),d(...h)},e.fontCb=(...h)=>{t.font&&t.font(...h),f(...h)},e.selectionCb=(...h)=>{t.selection&&t.selection(...h),p(...h)}}function og(e,t={}){const n=e.doc.defaultView;if(!n)return()=>{};ig(e,t);const r=oc(e,e.doc),i=$m(e),o=Zm(e),a=ac(e),s=Ym(e),l=Xm(e),u=tg(e),c=Jm(e,{win:n}),d=sc(e,e.doc),f=eg(e,{win:n}),p=e.collectFonts?ng(e):()=>{},h=rg(e),m=[];for(const g of e.plugins)m.push(g.observer(g.callback,n,g.options));return()=>{tn.forEach(g=>g.reset()),r.disconnect(),i(),o(),a(),s(),l(),u(),c(),d(),f(),p(),h(),m.forEach(g=>g())}}function Br(e){return typeof window[e]<"u"}function jr(e){return Boolean(typeof window[e]<"u"&&window[e].prototype&&"insertRule"in window[e].prototype&&"deleteRule"in window[e].prototype)}class nl{constructor(t){this.generateIdFn=t,this.iframeIdToRemoteIdMap=new WeakMap,this.iframeRemoteIdToIdMap=new WeakMap}getId(t,n,r,i){const o=r||this.getIdToRemoteIdMap(t),a=i||this.getRemoteIdToIdMap(t);let s=o.get(n);return s||(s=this.generateIdFn(),o.set(n,s),a.set(s,n)),s}getIds(t,n){const r=this.getIdToRemoteIdMap(t),i=this.getRemoteIdToIdMap(t);return n.map(o=>this.getId(t,o,r,i))}getRemoteId(t,n,r){const i=r||this.getRemoteIdToIdMap(t);if(typeof n!="number")return n;const o=i.get(n);return o||-1}getRemoteIds(t,n){const r=this.getRemoteIdToIdMap(t);return n.map(i=>this.getRemoteId(t,i,r))}reset(t){if(!t){this.iframeIdToRemoteIdMap=new WeakMap,this.iframeRemoteIdToIdMap=new WeakMap;return}this.iframeIdToRemoteIdMap.delete(t),this.iframeRemoteIdToIdMap.delete(t)}getIdToRemoteIdMap(t){let n=this.iframeIdToRemoteIdMap.get(t);return n||(n=new Map,this.iframeIdToRemoteIdMap.set(t,n)),n}getRemoteIdToIdMap(t){let n=this.iframeRemoteIdToIdMap.get(t);return n||(n=new Map,this.iframeRemoteIdToIdMap.set(t,n)),n}}class ag{constructor(t){this.iframes=new WeakMap,this.crossOriginIframeMap=new WeakMap,this.crossOriginIframeMirror=new nl(Ku),this.crossOriginIframeRootIdMap=new WeakMap,this.mutationCb=t.mutationCb,this.wrappedEmit=t.wrappedEmit,this.stylesheetManager=t.stylesheetManager,this.recordCrossOriginIframes=t.recordCrossOriginIframes,this.crossOriginIframeStyleMirror=new nl(this.stylesheetManager.styleMirror.generateId.bind(this.stylesheetManager.styleMirror)),this.mirror=t.mirror,this.recordCrossOriginIframes&&window.addEventListener("message",this.handleMessage.bind(this))}addIframe(t){this.iframes.set(t,!0),t.contentWindow&&this.crossOriginIframeMap.set(t.contentWindow,t)}addLoadListener(t){this.loadListener=t}attachIframe(t,n){var r;this.mutationCb({adds:[{parentId:this.mirror.getId(t),nextId:null,node:n}],removes:[],texts:[],attributes:[],isAttachIframe:!0}),(r=this.loadListener)===null||r===void 0||r.call(this,t),t.contentDocument&&t.contentDocument.adoptedStyleSheets&&t.contentDocument.adoptedStyleSheets.length>0&&this.stylesheetManager.adoptStyleSheets(t.contentDocument.adoptedStyleSheets,this.mirror.getId(t.contentDocument))}handleMessage(t){const n=t;if(n.data.type!=="rrweb"||n.origin!==n.data.origin||!t.source)return;const i=this.crossOriginIframeMap.get(t.source);if(!i)return;const o=this.transformCrossOriginEvent(i,n.data.event);o&&this.wrappedEmit(o,n.data.isCheckout)}transformCrossOriginEvent(t,n){var r;switch(n.type){case Y.FullSnapshot:{this.crossOriginIframeMirror.reset(t),this.crossOriginIframeStyleMirror.reset(t),this.replaceIdOnNode(n.data.node,t);const i=n.data.node.id;return this.crossOriginIframeRootIdMap.set(t,i),this.patchRootIdOnNode(n.data.node,i),{timestamp:n.timestamp,type:Y.IncrementalSnapshot,data:{source:$.Mutation,adds:[{parentId:this.mirror.getId(t),nextId:null,node:n.data.node}],removes:[],texts:[],attributes:[],isAttachIframe:!0}}}case Y.Meta:case Y.Load:case Y.DomContentLoaded:return!1;case Y.Plugin:return n;case Y.Custom:return this.replaceIds(n.data.payload,t,["id","parentId","previousId","nextId"]),n;case Y.IncrementalSnapshot:switch(n.data.source){case $.Mutation:return n.data.adds.forEach(i=>{this.replaceIds(i,t,["parentId","nextId","previousId"]),this.replaceIdOnNode(i.node,t);const o=this.crossOriginIframeRootIdMap.get(t);o&&this.patchRootIdOnNode(i.node,o)}),n.data.removes.forEach(i=>{this.replaceIds(i,t,["parentId","id"])}),n.data.attributes.forEach(i=>{this.replaceIds(i,t,["id"])}),n.data.texts.forEach(i=>{this.replaceIds(i,t,["id"])}),n;case $.Drag:case $.TouchMove:case $.MouseMove:return n.data.positions.forEach(i=>{this.replaceIds(i,t,["id"])}),n;case $.ViewportResize:return!1;case $.MediaInteraction:case $.MouseInteraction:case $.Scroll:case $.CanvasMutation:case $.Input:return this.replaceIds(n.data,t,["id"]),n;case $.StyleSheetRule:case $.StyleDeclaration:return this.replaceIds(n.data,t,["id"]),this.replaceStyleIds(n.data,t,["styleId"]),n;case $.Font:return n;case $.Selection:return n.data.ranges.forEach(i=>{this.replaceIds(i,t,["start","end"])}),n;case $.AdoptedStyleSheet:return this.replaceIds(n.data,t,["id"]),this.replaceStyleIds(n.data,t,["styleIds"]),(r=n.data.styles)===null||r===void 0||r.forEach(i=>{this.replaceStyleIds(i,t,["styleId"])}),n}}}replace(t,n,r,i){for(const o of i)!Array.isArray(n[o])&&typeof n[o]!="number"||(Array.isArray(n[o])?n[o]=t.getIds(r,n[o]):n[o]=t.getId(r,n[o]));return n}replaceIds(t,n,r){return this.replace(this.crossOriginIframeMirror,t,n,r)}replaceStyleIds(t,n,r){return this.replace(this.crossOriginIframeStyleMirror,t,n,r)}replaceIdOnNode(t,n){this.replaceIds(t,n,["id","rootId"]),"childNodes"in t&&t.childNodes.forEach(r=>{this.replaceIdOnNode(r,n)})}patchRootIdOnNode(t,n){t.type!==be.Document&&!t.rootId&&(t.rootId=n),"childNodes"in t&&t.childNodes.forEach(r=>{this.patchRootIdOnNode(r,n)})}}class sg{constructor(t){this.shadowDoms=new WeakSet,this.restoreHandlers=[],this.mutationCb=t.mutationCb,this.scrollCb=t.scrollCb,this.bypassOptions=t.bypassOptions,this.mirror=t.mirror,this.init()}init(){this.reset(),this.patchAttachShadow(Element,document)}addShadowRoot(t,n){if(!rr(t)||this.shadowDoms.has(t))return;this.shadowDoms.add(t);const r=oc(Object.assign(Object.assign({},this.bypassOptions),{doc:n,mutationCb:this.mutationCb,mirror:this.mirror,shadowDomManager:this}),t);this.restoreHandlers.push(()=>r.disconnect()),this.restoreHandlers.push(ac(Object.assign(Object.assign({},this.bypassOptions),{scrollCb:this.scrollCb,doc:t,mirror:this.mirror}))),setTimeout(()=>{t.adoptedStyleSheets&&t.adoptedStyleSheets.length>0&&this.bypassOptions.stylesheetManager.adoptStyleSheets(t.adoptedStyleSheets,this.mirror.getId(t.host)),this.restoreHandlers.push(sc({mirror:this.mirror,stylesheetManager:this.bypassOptions.stylesheetManager},t))},0)}observeAttachShadow(t){!t.contentWindow||!t.contentDocument||this.patchAttachShadow(t.contentWindow.Element,t.contentDocument)}patchAttachShadow(t,n){const r=this;this.restoreHandlers.push(Er(t.prototype,"attachShadow",function(i){return function(o){const a=i.call(this,o);return this.shadowRoot&&nc(this)&&r.addShadowRoot(this.shadowRoot,n),a}}))}reset(){this.restoreHandlers.forEach(t=>{try{t()}catch{}}),this.restoreHandlers=[],this.shadowDoms=new WeakSet}}/*! *****************************************************************************
5
- Copyright (c) Microsoft Corporation.
6
-
7
- Permission to use, copy, modify, and/or distribute this software for any
8
- purpose with or without fee is hereby granted.
9
-
10
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
11
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
12
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
13
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
14
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
15
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
16
- PERFORMANCE OF THIS SOFTWARE.
17
- ***************************************************************************** */function lg(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n}function ug(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())})}var Sn="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",cg=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(var Hr=0;Hr<Sn.length;Hr++)cg[Sn.charCodeAt(Hr)]=Hr;var dg=function(e){var t=new Uint8Array(e),n,r=t.length,i="";for(n=0;n<r;n+=3)i+=Sn[t[n]>>2],i+=Sn[(t[n]&3)<<4|t[n+1]>>4],i+=Sn[(t[n+1]&15)<<2|t[n+2]>>6],i+=Sn[t[n+2]&63];return r%3===2?i=i.substring(0,i.length-1)+"=":r%3===1&&(i=i.substring(0,i.length-2)+"=="),i};const rl=new Map;function fg(e,t){let n=rl.get(e);return n||(n=new Map,rl.set(e,n)),n.has(t)||n.set(t,[]),n.get(t)}const lc=(e,t,n)=>{if(!e||!(cc(e,t)||typeof e=="object"))return;const r=e.constructor.name,i=fg(n,r);let o=i.indexOf(e);return o===-1&&(o=i.length,i.push(e)),o};function Qr(e,t,n){if(e instanceof Array)return e.map(r=>Qr(r,t,n));if(e===null)return e;if(e instanceof Float32Array||e instanceof Float64Array||e instanceof Int32Array||e instanceof Uint32Array||e instanceof Uint8Array||e instanceof Uint16Array||e instanceof Int16Array||e instanceof Int8Array||e instanceof Uint8ClampedArray)return{rr_type:e.constructor.name,args:[Object.values(e)]};if(e instanceof ArrayBuffer){const r=e.constructor.name,i=dg(e);return{rr_type:r,base64:i}}else{if(e instanceof DataView)return{rr_type:e.constructor.name,args:[Qr(e.buffer,t,n),e.byteOffset,e.byteLength]};if(e instanceof HTMLImageElement){const r=e.constructor.name,{src:i}=e;return{rr_type:r,src:i}}else if(e instanceof HTMLCanvasElement){const r="HTMLImageElement",i=e.toDataURL();return{rr_type:r,src:i}}else{if(e instanceof ImageData)return{rr_type:e.constructor.name,args:[Qr(e.data,t,n),e.width,e.height]};if(cc(e,t)||typeof e=="object"){const r=e.constructor.name,i=lc(e,t,n);return{rr_type:r,index:i}}}}return e}const uc=(e,t,n)=>[...e].map(r=>Qr(r,t,n)),cc=(e,t)=>{const r=["WebGLActiveInfo","WebGLBuffer","WebGLFramebuffer","WebGLProgram","WebGLRenderbuffer","WebGLShader","WebGLShaderPrecisionFormat","WebGLTexture","WebGLUniformLocation","WebGLVertexArrayObject","WebGLVertexArrayObjectOES"].filter(i=>typeof t[i]=="function");return Boolean(r.find(i=>e instanceof t[i]))};function pg(e,t,n,r){const i=[],o=Object.getOwnPropertyNames(t.CanvasRenderingContext2D.prototype);for(const a of o)try{if(typeof t.CanvasRenderingContext2D.prototype[a]!="function")continue;const s=Er(t.CanvasRenderingContext2D.prototype,a,function(l){return function(...u){return De(this.canvas,n,r,!0)||setTimeout(()=>{const c=uc([...u],t,this);e(this.canvas,{type:Dn["2D"],property:a,args:c})},0),l.apply(this,u)}});i.push(s)}catch{const l=Bi(t.CanvasRenderingContext2D.prototype,a,{set(u){e(this.canvas,{type:Dn["2D"],property:a,args:[u],setter:!0})}});i.push(l)}return()=>{i.forEach(a=>a())}}function il(e,t,n){const r=[];try{const i=Er(e.HTMLCanvasElement.prototype,"getContext",function(o){return function(a,...s){return De(this,t,n,!0)||"__context"in this||(this.__context=a),o.apply(this,[a,...s])}});r.push(i)}catch{console.error("failed to patch HTMLCanvasElement.prototype.getContext")}return()=>{r.forEach(i=>i())}}function ol(e,t,n,r,i,o,a){const s=[],l=Object.getOwnPropertyNames(e);for(const u of l)if(!["isContextLost","canvas","drawingBufferWidth","drawingBufferHeight"].includes(u))try{if(typeof e[u]!="function")continue;const c=Er(e,u,function(d){return function(...f){const p=d.apply(this,f);if(lc(p,a,this),!De(this.canvas,r,i,!0)){const h=uc([...f],a,this),m={type:t,property:u,args:h};n(this.canvas,m)}return p}});s.push(c)}catch{const d=Bi(e,u,{set(f){n(this.canvas,{type:t,property:u,args:[f],setter:!0})}});s.push(d)}return s}function hg(e,t,n,r,i){const o=[];return o.push(...ol(t.WebGLRenderingContext.prototype,Dn.WebGL,e,n,r,i,t)),typeof t.WebGL2RenderingContext<"u"&&o.push(...ol(t.WebGL2RenderingContext.prototype,Dn.WebGL2,e,n,r,i,t)),()=>{o.forEach(a=>a())}}var dc=null;try{var mg=typeof module<"u"&&typeof module.require=="function"&&module.require("worker_threads")||typeof __non_webpack_require__=="function"&&__non_webpack_require__("worker_threads")||typeof require=="function"&&require("worker_threads");dc=mg.Worker}catch{}function gg(e,t){return Buffer.from(e,"base64").toString(t?"utf16":"utf8")}function vg(e,t,n){var r=t===void 0?null:t,i=n===void 0?!1:n,o=gg(e,i),a=o.indexOf(`
18
- `,10)+1,s=o.substring(a)+(r?"//# sourceMappingURL="+r:"");return function(u){return new dc(s,Object.assign({},u,{eval:!0}))}}function yg(e,t){var n=atob(e);if(t){for(var r=new Uint8Array(n.length),i=0,o=n.length;i<o;++i)r[i]=n.charCodeAt(i);return String.fromCharCode.apply(null,new Uint16Array(r.buffer))}return n}function _g(e,t,n){var r=t===void 0?null:t,i=n===void 0?!1:n,o=yg(e,i),a=o.indexOf(`
19
- `,10)+1,s=o.substring(a)+(r?"//# sourceMappingURL="+r:""),l=new Blob([s],{type:"application/javascript"});return URL.createObjectURL(l)}function bg(e,t,n){var r;return function(o){return r=r||_g(e,t,n),new Worker(r,o)}}var wg=Object.prototype.toString.call(typeof process<"u"?process:0)==="[object process]";function Cg(){return wg}function Ig(e,t,n){return Cg()?vg(e,t,n):bg(e,t,n)}var Eg=Ig("Lyogcm9sbHVwLXBsdWdpbi13ZWItd29ya2VyLWxvYWRlciAqLwooZnVuY3Rpb24gKCkgewogICAgJ3VzZSBzdHJpY3QnOwoKICAgIC8qISAqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKg0KICAgIENvcHlyaWdodCAoYykgTWljcm9zb2Z0IENvcnBvcmF0aW9uLg0KDQogICAgUGVybWlzc2lvbiB0byB1c2UsIGNvcHksIG1vZGlmeSwgYW5kL29yIGRpc3RyaWJ1dGUgdGhpcyBzb2Z0d2FyZSBmb3IgYW55DQogICAgcHVycG9zZSB3aXRoIG9yIHdpdGhvdXQgZmVlIGlzIGhlcmVieSBncmFudGVkLg0KDQogICAgVEhFIFNPRlRXQVJFIElTIFBST1ZJREVEICJBUyBJUyIgQU5EIFRIRSBBVVRIT1IgRElTQ0xBSU1TIEFMTCBXQVJSQU5USUVTIFdJVEgNCiAgICBSRUdBUkQgVE8gVEhJUyBTT0ZUV0FSRSBJTkNMVURJTkcgQUxMIElNUExJRUQgV0FSUkFOVElFUyBPRiBNRVJDSEFOVEFCSUxJVFkNCiAgICBBTkQgRklUTkVTUy4gSU4gTk8gRVZFTlQgU0hBTEwgVEhFIEFVVEhPUiBCRSBMSUFCTEUgRk9SIEFOWSBTUEVDSUFMLCBESVJFQ1QsDQogICAgSU5ESVJFQ1QsIE9SIENPTlNFUVVFTlRJQUwgREFNQUdFUyBPUiBBTlkgREFNQUdFUyBXSEFUU09FVkVSIFJFU1VMVElORyBGUk9NDQogICAgTE9TUyBPRiBVU0UsIERBVEEgT1IgUFJPRklUUywgV0hFVEhFUiBJTiBBTiBBQ1RJT04gT0YgQ09OVFJBQ1QsIE5FR0xJR0VOQ0UgT1INCiAgICBPVEhFUiBUT1JUSU9VUyBBQ1RJT04sIEFSSVNJTkcgT1VUIE9GIE9SIElOIENPTk5FQ1RJT04gV0lUSCBUSEUgVVNFIE9SDQogICAgUEVSRk9STUFOQ0UgT0YgVEhJUyBTT0ZUV0FSRS4NCiAgICAqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKiAqLw0KDQogICAgZnVuY3Rpb24gX19hd2FpdGVyKHRoaXNBcmcsIF9hcmd1bWVudHMsIFAsIGdlbmVyYXRvcikgew0KICAgICAgICBmdW5jdGlvbiBhZG9wdCh2YWx1ZSkgeyByZXR1cm4gdmFsdWUgaW5zdGFuY2VvZiBQID8gdmFsdWUgOiBuZXcgUChmdW5jdGlvbiAocmVzb2x2ZSkgeyByZXNvbHZlKHZhbHVlKTsgfSk7IH0NCiAgICAgICAgcmV0dXJuIG5ldyAoUCB8fCAoUCA9IFByb21pc2UpKShmdW5jdGlvbiAocmVzb2x2ZSwgcmVqZWN0KSB7DQogICAgICAgICAgICBmdW5jdGlvbiBmdWxmaWxsZWQodmFsdWUpIHsgdHJ5IHsgc3RlcChnZW5lcmF0b3IubmV4dCh2YWx1ZSkpOyB9IGNhdGNoIChlKSB7IHJlamVjdChlKTsgfSB9DQogICAgICAgICAgICBmdW5jdGlvbiByZWplY3RlZCh2YWx1ZSkgeyB0cnkgeyBzdGVwKGdlbmVyYXRvclsidGhyb3ciXSh2YWx1ZSkpOyB9IGNhdGNoIChlKSB7IHJlamVjdChlKTsgfSB9DQogICAgICAgICAgICBmdW5jdGlvbiBzdGVwKHJlc3VsdCkgeyByZXN1bHQuZG9uZSA/IHJlc29sdmUocmVzdWx0LnZhbHVlKSA6IGFkb3B0KHJlc3VsdC52YWx1ZSkudGhlbihmdWxmaWxsZWQsIHJlamVjdGVkKTsgfQ0KICAgICAgICAgICAgc3RlcCgoZ2VuZXJhdG9yID0gZ2VuZXJhdG9yLmFwcGx5KHRoaXNBcmcsIF9hcmd1bWVudHMgfHwgW10pKS5uZXh0KCkpOw0KICAgICAgICB9KTsNCiAgICB9CgogICAgLyoKICAgICAqIGJhc2U2NC1hcnJheWJ1ZmZlciAxLjAuMSA8aHR0cHM6Ly9naXRodWIuY29tL25pa2xhc3ZoL2Jhc2U2NC1hcnJheWJ1ZmZlcj4KICAgICAqIENvcHlyaWdodCAoYykgMjAyMSBOaWtsYXMgdm9uIEhlcnR6ZW4gPGh0dHBzOi8vaGVydHplbi5jb20+CiAgICAgKiBSZWxlYXNlZCB1bmRlciBNSVQgTGljZW5zZQogICAgICovCiAgICB2YXIgY2hhcnMgPSAnQUJDREVGR0hJSktMTU5PUFFSU1RVVldYWVphYmNkZWZnaGlqa2xtbm9wcXJzdHV2d3h5ejAxMjM0NTY3ODkrLyc7CiAgICAvLyBVc2UgYSBsb29rdXAgdGFibGUgdG8gZmluZCB0aGUgaW5kZXguCiAgICB2YXIgbG9va3VwID0gdHlwZW9mIFVpbnQ4QXJyYXkgPT09ICd1bmRlZmluZWQnID8gW10gOiBuZXcgVWludDhBcnJheSgyNTYpOwogICAgZm9yICh2YXIgaSA9IDA7IGkgPCBjaGFycy5sZW5ndGg7IGkrKykgewogICAgICAgIGxvb2t1cFtjaGFycy5jaGFyQ29kZUF0KGkpXSA9IGk7CiAgICB9CiAgICB2YXIgZW5jb2RlID0gZnVuY3Rpb24gKGFycmF5YnVmZmVyKSB7CiAgICAgICAgdmFyIGJ5dGVzID0gbmV3IFVpbnQ4QXJyYXkoYXJyYXlidWZmZXIpLCBpLCBsZW4gPSBieXRlcy5sZW5ndGgsIGJhc2U2NCA9ICcnOwogICAgICAgIGZvciAoaSA9IDA7IGkgPCBsZW47IGkgKz0gMykgewogICAgICAgICAgICBiYXNlNjQgKz0gY2hhcnNbYnl0ZXNbaV0gPj4gMl07CiAgICAgICAgICAgIGJhc2U2NCArPSBjaGFyc1soKGJ5dGVzW2ldICYgMykgPDwgNCkgfCAoYnl0ZXNbaSArIDFdID4+IDQpXTsKICAgICAgICAgICAgYmFzZTY0ICs9IGNoYXJzWygoYnl0ZXNbaSArIDFdICYgMTUpIDw8IDIpIHwgKGJ5dGVzW2kgKyAyXSA+PiA2KV07CiAgICAgICAgICAgIGJhc2U2NCArPSBjaGFyc1tieXRlc1tpICsgMl0gJiA2M107CiAgICAgICAgfQogICAgICAgIGlmIChsZW4gJSAzID09PSAyKSB7CiAgICAgICAgICAgIGJhc2U2NCA9IGJhc2U2NC5zdWJzdHJpbmcoMCwgYmFzZTY0Lmxlbmd0aCAtIDEpICsgJz0nOwogICAgICAgIH0KICAgICAgICBlbHNlIGlmIChsZW4gJSAzID09PSAxKSB7CiAgICAgICAgICAgIGJhc2U2NCA9IGJhc2U2NC5zdWJzdHJpbmcoMCwgYmFzZTY0Lmxlbmd0aCAtIDIpICsgJz09JzsKICAgICAgICB9CiAgICAgICAgcmV0dXJuIGJhc2U2NDsKICAgIH07CgogICAgY29uc3QgbGFzdEJsb2JNYXAgPSBuZXcgTWFwKCk7DQogICAgY29uc3QgdHJhbnNwYXJlbnRCbG9iTWFwID0gbmV3IE1hcCgpOw0KICAgIGZ1bmN0aW9uIGdldFRyYW5zcGFyZW50QmxvYkZvcih3aWR0aCwgaGVpZ2h0LCBkYXRhVVJMT3B0aW9ucykgew0KICAgICAgICByZXR1cm4gX19hd2FpdGVyKHRoaXMsIHZvaWQgMCwgdm9pZCAwLCBmdW5jdGlvbiogKCkgew0KICAgICAgICAgICAgY29uc3QgaWQgPSBgJHt3aWR0aH0tJHtoZWlnaHR9YDsNCiAgICAgICAgICAgIGlmICgnT2Zmc2NyZWVuQ2FudmFzJyBpbiBnbG9iYWxUaGlzKSB7DQogICAgICAgICAgICAgICAgaWYgKHRyYW5zcGFyZW50QmxvYk1hcC5oYXMoaWQpKQ0KICAgICAgICAgICAgICAgICAgICByZXR1cm4gdHJhbnNwYXJlbnRCbG9iTWFwLmdldChpZCk7DQogICAgICAgICAgICAgICAgY29uc3Qgb2Zmc2NyZWVuID0gbmV3IE9mZnNjcmVlbkNhbnZhcyh3aWR0aCwgaGVpZ2h0KTsNCiAgICAgICAgICAgICAgICBvZmZzY3JlZW4uZ2V0Q29udGV4dCgnMmQnKTsNCiAgICAgICAgICAgICAgICBjb25zdCBibG9iID0geWllbGQgb2Zmc2NyZWVuLmNvbnZlcnRUb0Jsb2IoZGF0YVVSTE9wdGlvbnMpOw0KICAgICAgICAgICAgICAgIGNvbnN0IGFycmF5QnVmZmVyID0geWllbGQgYmxvYi5hcnJheUJ1ZmZlcigpOw0KICAgICAgICAgICAgICAgIGNvbnN0IGJhc2U2NCA9IGVuY29kZShhcnJheUJ1ZmZlcik7DQogICAgICAgICAgICAgICAgdHJhbnNwYXJlbnRCbG9iTWFwLnNldChpZCwgYmFzZTY0KTsNCiAgICAgICAgICAgICAgICByZXR1cm4gYmFzZTY0Ow0KICAgICAgICAgICAgfQ0KICAgICAgICAgICAgZWxzZSB7DQogICAgICAgICAgICAgICAgcmV0dXJuICcnOw0KICAgICAgICAgICAgfQ0KICAgICAgICB9KTsNCiAgICB9DQogICAgY29uc3Qgd29ya2VyID0gc2VsZjsNCiAgICB3b3JrZXIub25tZXNzYWdlID0gZnVuY3Rpb24gKGUpIHsNCiAgICAgICAgcmV0dXJuIF9fYXdhaXRlcih0aGlzLCB2b2lkIDAsIHZvaWQgMCwgZnVuY3Rpb24qICgpIHsNCiAgICAgICAgICAgIGlmICgnT2Zmc2NyZWVuQ2FudmFzJyBpbiBnbG9iYWxUaGlzKSB7DQogICAgICAgICAgICAgICAgY29uc3QgeyBpZCwgYml0bWFwLCB3aWR0aCwgaGVpZ2h0LCBkYXRhVVJMT3B0aW9ucyB9ID0gZS5kYXRhOw0KICAgICAgICAgICAgICAgIGNvbnN0IHRyYW5zcGFyZW50QmFzZTY0ID0gZ2V0VHJhbnNwYXJlbnRCbG9iRm9yKHdpZHRoLCBoZWlnaHQsIGRhdGFVUkxPcHRpb25zKTsNCiAgICAgICAgICAgICAgICBjb25zdCBvZmZzY3JlZW4gPSBuZXcgT2Zmc2NyZWVuQ2FudmFzKHdpZHRoLCBoZWlnaHQpOw0KICAgICAgICAgICAgICAgIGNvbnN0IGN0eCA9IG9mZnNjcmVlbi5nZXRDb250ZXh0KCcyZCcpOw0KICAgICAgICAgICAgICAgIGN0eC5kcmF3SW1hZ2UoYml0bWFwLCAwLCAwKTsNCiAgICAgICAgICAgICAgICBiaXRtYXAuY2xvc2UoKTsNCiAgICAgICAgICAgICAgICBjb25zdCBibG9iID0geWllbGQgb2Zmc2NyZWVuLmNvbnZlcnRUb0Jsb2IoZGF0YVVSTE9wdGlvbnMpOw0KICAgICAgICAgICAgICAgIGNvbnN0IHR5cGUgPSBibG9iLnR5cGU7DQogICAgICAgICAgICAgICAgY29uc3QgYXJyYXlCdWZmZXIgPSB5aWVsZCBibG9iLmFycmF5QnVmZmVyKCk7DQogICAgICAgICAgICAgICAgY29uc3QgYmFzZTY0ID0gZW5jb2RlKGFycmF5QnVmZmVyKTsNCiAgICAgICAgICAgICAgICBpZiAoIWxhc3RCbG9iTWFwLmhhcyhpZCkgJiYgKHlpZWxkIHRyYW5zcGFyZW50QmFzZTY0KSA9PT0gYmFzZTY0KSB7DQogICAgICAgICAgICAgICAgICAgIGxhc3RCbG9iTWFwLnNldChpZCwgYmFzZTY0KTsNCiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHdvcmtlci5wb3N0TWVzc2FnZSh7IGlkIH0pOw0KICAgICAgICAgICAgICAgIH0NCiAgICAgICAgICAgICAgICBpZiAobGFzdEJsb2JNYXAuZ2V0KGlkKSA9PT0gYmFzZTY0KQ0KICAgICAgICAgICAgICAgICAgICByZXR1cm4gd29ya2VyLnBvc3RNZXNzYWdlKHsgaWQgfSk7DQogICAgICAgICAgICAgICAgd29ya2VyLnBvc3RNZXNzYWdlKHsNCiAgICAgICAgICAgICAgICAgICAgaWQsDQogICAgICAgICAgICAgICAgICAgIHR5cGUsDQogICAgICAgICAgICAgICAgICAgIGJhc2U2NCwNCiAgICAgICAgICAgICAgICAgICAgd2lkdGgsDQogICAgICAgICAgICAgICAgICAgIGhlaWdodCwNCiAgICAgICAgICAgICAgICB9KTsNCiAgICAgICAgICAgICAgICBsYXN0QmxvYk1hcC5zZXQoaWQsIGJhc2U2NCk7DQogICAgICAgICAgICB9DQogICAgICAgICAgICBlbHNlIHsNCiAgICAgICAgICAgICAgICByZXR1cm4gd29ya2VyLnBvc3RNZXNzYWdlKHsgaWQ6IGUuZGF0YS5pZCB9KTsNCiAgICAgICAgICAgIH0NCiAgICAgICAgfSk7DQogICAgfTsKCn0pKCk7Cgo=",null,!1);class Sg{constructor(t){this.pendingCanvasMutations=new Map,this.rafStamps={latestId:0,invokeId:null},this.frozen=!1,this.locked=!1,this.processMutation=(l,u)=>{(this.rafStamps.invokeId&&this.rafStamps.latestId!==this.rafStamps.invokeId||!this.rafStamps.invokeId)&&(this.rafStamps.invokeId=this.rafStamps.latestId),this.pendingCanvasMutations.has(l)||this.pendingCanvasMutations.set(l,[]),this.pendingCanvasMutations.get(l).push(u)};const{sampling:n="all",win:r,blockClass:i,blockSelector:o,recordCanvas:a,dataURLOptions:s}=t;this.mutationCb=t.mutationCb,this.mirror=t.mirror,a&&n==="all"&&this.initCanvasMutationObserver(r,i,o),a&&typeof n=="number"&&this.initCanvasFPSObserver(n,r,i,o,{dataURLOptions:s})}reset(){this.pendingCanvasMutations.clear(),this.resetObservers&&this.resetObservers()}freeze(){this.frozen=!0}unfreeze(){this.frozen=!1}lock(){this.locked=!0}unlock(){this.locked=!1}initCanvasFPSObserver(t,n,r,i,o){const a=il(n,r,i),s=new Map,l=new Eg;l.onmessage=h=>{const{id:m}=h.data;if(s.set(m,!1),!("base64"in h.data))return;const{base64:g,type:_,width:v,height:b}=h.data;this.mutationCb({id:m,type:Dn["2D"],commands:[{property:"clearRect",args:[0,0,v,b]},{property:"drawImage",args:[{rr_type:"ImageBitmap",args:[{rr_type:"Blob",data:[{rr_type:"ArrayBuffer",base64:g}],type:_}]},0,0]}]})};const u=1e3/t;let c=0,d;const f=()=>{const h=[];return n.document.querySelectorAll("canvas").forEach(m=>{De(m,r,i,!0)||h.push(m)}),h},p=h=>{if(c&&h-c<u){d=requestAnimationFrame(p);return}c=h,f().forEach(m=>ug(this,void 0,void 0,function*(){var g;const _=this.mirror.getId(m);if(s.get(_))return;if(s.set(_,!0),["webgl","webgl2"].includes(m.__context)){const b=m.getContext(m.__context);((g=b==null?void 0:b.getContextAttributes())===null||g===void 0?void 0:g.preserveDrawingBuffer)===!1&&(b==null||b.clear(b.COLOR_BUFFER_BIT))}const v=yield createImageBitmap(m);l.postMessage({id:_,bitmap:v,width:m.width,height:m.height,dataURLOptions:o.dataURLOptions},[v])})),d=requestAnimationFrame(p)};d=requestAnimationFrame(p),this.resetObservers=()=>{a(),cancelAnimationFrame(d)}}initCanvasMutationObserver(t,n,r){this.startRAFTimestamping(),this.startPendingCanvasMutationFlusher();const i=il(t,n,r),o=pg(this.processMutation.bind(this),t,n,r),a=hg(this.processMutation.bind(this),t,n,r,this.mirror);this.resetObservers=()=>{i(),o(),a()}}startPendingCanvasMutationFlusher(){requestAnimationFrame(()=>this.flushPendingCanvasMutations())}startRAFTimestamping(){const t=n=>{this.rafStamps.latestId=n,requestAnimationFrame(t)};requestAnimationFrame(t)}flushPendingCanvasMutations(){this.pendingCanvasMutations.forEach((t,n)=>{const r=this.mirror.getId(n);this.flushPendingCanvasMutationFor(n,r)}),requestAnimationFrame(()=>this.flushPendingCanvasMutations())}flushPendingCanvasMutationFor(t,n){if(this.frozen||this.locked)return;const r=this.pendingCanvasMutations.get(t);if(!r||n===-1)return;const i=r.map(a=>lg(a,["type"])),{type:o}=r[0];this.mutationCb({id:n,type:o,commands:i}),this.pendingCanvasMutations.delete(t)}}class kg{constructor(t){this.trackedLinkElements=new WeakSet,this.styleMirror=new Hm,this.mutationCb=t.mutationCb,this.adoptedStyleSheetCb=t.adoptedStyleSheetCb}attachLinkElement(t,n){"_cssText"in n.attributes&&this.mutationCb({adds:[],removes:[],texts:[],attributes:[{id:n.id,attributes:n.attributes}]}),this.trackLinkElement(t)}trackLinkElement(t){this.trackedLinkElements.has(t)||(this.trackedLinkElements.add(t),this.trackStylesheetInLinkElement(t))}adoptStyleSheets(t,n){if(t.length===0)return;const r={id:n,styleIds:[]},i=[];for(const o of t){let a;if(this.styleMirror.has(o))a=this.styleMirror.getId(o);else{a=this.styleMirror.add(o);const s=Array.from(o.rules||CSSRule);i.push({styleId:a,rules:s.map((l,u)=>({rule:Hu(l),index:u}))})}r.styleIds.push(a)}i.length>0&&(r.styles=i),this.adoptedStyleSheetCb(r)}reset(){this.styleMirror.reset(),this.trackedLinkElements=new WeakSet}trackStylesheetInLinkElement(t){}}function ye(e){return Object.assign(Object.assign({},e),{timestamp:Date.now()})}let fe,Xr,lo,yi=!1;const Ze=gm();function Bt(e={}){const{emit:t,checkoutEveryNms:n,checkoutEveryNth:r,blockClass:i="rr-block",blockSelector:o=null,ignoreClass:a="rr-ignore",maskTextClass:s="rr-mask",maskTextSelector:l=null,inlineStylesheet:u=!0,maskAllInputs:c,maskInputOptions:d,slimDOMOptions:f,maskInputFn:p,maskTextFn:h,hooks:m,packFn:g,sampling:_={},dataURLOptions:v={},mousemoveWait:b,recordCanvas:y=!1,recordCrossOriginIframes:C=!1,recordAfter:S=e.recordAfter==="DOMContentLoaded"?e.recordAfter:"load",userTriggeredOnInput:E=!1,collectFonts:I=!1,inlineImages:x=!1,plugins:R,keepIframeSrcFn:T=()=>!1,ignoreCSSAttributes:O=new Set([])}=e,k=C?window.parent===window:!0;let N=!1;if(!k)try{window.parent.document&&(N=!1)}catch{N=!0}if(k&&!t)throw new Error("emit function is required");b!==void 0&&_.mousemove===void 0&&(_.mousemove=b),Ze.reset();const A=c===!0?{color:!0,date:!0,"datetime-local":!0,email:!0,month:!0,number:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0,textarea:!0,select:!0,password:!0}:d!==void 0?d:{password:!0},B=f===!0||f==="all"?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaVerification:!0,headMetaAuthorship:f==="all",headMetaDescKeywords:f==="all"}:f||{};jm();let J,se=0;const ce=H=>{for(const Oe of R||[])Oe.eventProcessor&&(H=Oe.eventProcessor(H));return g&&!N&&(H=g(H)),H};fe=(H,Oe)=>{var Q;if(((Q=tn[0])===null||Q===void 0?void 0:Q.isFrozen())&&H.type!==Y.FullSnapshot&&!(H.type===Y.IncrementalSnapshot&&H.data.source===$.Mutation)&&tn.forEach(ve=>ve.unfreeze()),k)t==null||t(ce(H),Oe);else if(N){const ve={type:"rrweb",event:ce(H),origin:window.location.origin,isCheckout:Oe};window.parent.postMessage(ve,"*")}if(H.type===Y.FullSnapshot)J=H,se=0;else if(H.type===Y.IncrementalSnapshot){if(H.data.source===$.Mutation&&H.data.isAttachIframe)return;se++;const ve=r&&se>=r,it=n&&H.timestamp-J.timestamp>n;(ve||it)&&Xr(!0)}};const te=H=>{fe(ye({type:Y.IncrementalSnapshot,data:Object.assign({source:$.Mutation},H)}))},Ee=H=>fe(ye({type:Y.IncrementalSnapshot,data:Object.assign({source:$.Scroll},H)})),Z=H=>fe(ye({type:Y.IncrementalSnapshot,data:Object.assign({source:$.CanvasMutation},H)})),$e=H=>fe(ye({type:Y.IncrementalSnapshot,data:Object.assign({source:$.AdoptedStyleSheet},H)})),de=new kg({mutationCb:te,adoptedStyleSheetCb:$e}),Le=new ag({mirror:Ze,mutationCb:te,stylesheetManager:de,recordCrossOriginIframes:C,wrappedEmit:fe});for(const H of R||[])H.getMirror&&H.getMirror({nodeMirror:Ze,crossOriginIframeMirror:Le.crossOriginIframeMirror,crossOriginIframeStyleMirror:Le.crossOriginIframeStyleMirror});lo=new Sg({recordCanvas:y,mutationCb:Z,win:window,blockClass:i,blockSelector:o,mirror:Ze,sampling:_.canvas,dataURLOptions:v});const rt=new sg({mutationCb:te,scrollCb:Ee,bypassOptions:{blockClass:i,blockSelector:o,maskTextClass:s,maskTextSelector:l,inlineStylesheet:u,maskInputOptions:A,dataURLOptions:v,maskTextFn:h,maskInputFn:p,recordCanvas:y,inlineImages:x,sampling:_,slimDOMOptions:B,iframeManager:Le,stylesheetManager:de,canvasManager:lo,keepIframeSrcFn:T,processedNodeManager:Js},mirror:Ze});Xr=(H=!1)=>{fe(ye({type:Y.Meta,data:{href:window.location.href,width:Yu(),height:Zu()}}),H),de.reset(),rt.init(),tn.forEach(Q=>Q.lock());const Oe=Vm(document,{mirror:Ze,blockClass:i,blockSelector:o,maskTextClass:s,maskTextSelector:l,inlineStylesheet:u,maskAllInputs:A,maskTextFn:h,slimDOM:B,dataURLOptions:v,recordCanvas:y,inlineImages:x,onSerialize:Q=>{Ju(Q,Ze)&&Le.addIframe(Q),ec(Q,Ze)&&de.trackLinkElement(Q),Fo(Q)&&rt.addShadowRoot(Q.shadowRoot,document)},onIframeLoad:(Q,ve)=>{Le.attachIframe(Q,ve),rt.observeAttachShadow(Q)},onStylesheetLoad:(Q,ve)=>{de.attachLinkElement(Q,ve)},keepIframeSrcFn:T});if(!Oe)return console.warn("Failed to snapshot the document");fe(ye({type:Y.FullSnapshot,data:{node:Oe,initialOffset:$u(window)}}),H),tn.forEach(Q=>Q.unlock()),document.adoptedStyleSheets&&document.adoptedStyleSheets.length>0&&de.adoptStyleSheets(document.adoptedStyleSheets,Ze.getId(document))};try{const H=[],Oe=ve=>{var it;return og({mutationCb:te,mousemoveCb:(X,mn)=>fe(ye({type:Y.IncrementalSnapshot,data:{source:mn,positions:X}})),mouseInteractionCb:X=>fe(ye({type:Y.IncrementalSnapshot,data:Object.assign({source:$.MouseInteraction},X)})),scrollCb:Ee,viewportResizeCb:X=>fe(ye({type:Y.IncrementalSnapshot,data:Object.assign({source:$.ViewportResize},X)})),inputCb:X=>fe(ye({type:Y.IncrementalSnapshot,data:Object.assign({source:$.Input},X)})),mediaInteractionCb:X=>fe(ye({type:Y.IncrementalSnapshot,data:Object.assign({source:$.MediaInteraction},X)})),styleSheetRuleCb:X=>fe(ye({type:Y.IncrementalSnapshot,data:Object.assign({source:$.StyleSheetRule},X)})),styleDeclarationCb:X=>fe(ye({type:Y.IncrementalSnapshot,data:Object.assign({source:$.StyleDeclaration},X)})),canvasMutationCb:Z,fontCb:X=>fe(ye({type:Y.IncrementalSnapshot,data:Object.assign({source:$.Font},X)})),selectionCb:X=>{fe(ye({type:Y.IncrementalSnapshot,data:Object.assign({source:$.Selection},X)}))},blockClass:i,ignoreClass:a,maskTextClass:s,maskTextSelector:l,maskInputOptions:A,inlineStylesheet:u,sampling:_,recordCanvas:y,inlineImages:x,userTriggeredOnInput:E,collectFonts:I,doc:ve,maskInputFn:p,maskTextFn:h,keepIframeSrcFn:T,blockSelector:o,slimDOMOptions:B,dataURLOptions:v,mirror:Ze,iframeManager:Le,stylesheetManager:de,shadowDomManager:rt,processedNodeManager:Js,canvasManager:lo,ignoreCSSAttributes:O,plugins:((it=R==null?void 0:R.filter(X=>X.observer))===null||it===void 0?void 0:it.map(X=>({observer:X.observer,options:X.options,callback:mn=>fe(ye({type:Y.Plugin,data:{plugin:X.name,payload:mn}}))})))||[]},m)};Le.addLoadListener(ve=>{try{H.push(Oe(ve.contentDocument))}catch(it){console.warn(it)}});const Q=()=>{Xr(),H.push(Oe(document)),yi=!0};return document.readyState==="interactive"||document.readyState==="complete"?Q():(H.push(Ne("DOMContentLoaded",()=>{fe(ye({type:Y.DomContentLoaded,data:{}})),S==="DOMContentLoaded"&&Q()})),H.push(Ne("load",()=>{fe(ye({type:Y.Load,data:{}})),S==="load"&&Q()},window))),()=>{H.forEach(ve=>ve()),yi=!1}}catch(H){console.warn(H)}}Bt.addCustomEvent=(e,t)=>{if(!yi)throw new Error("please add custom event after start recording");fe(ye({type:Y.Custom,data:{tag:e,payload:t}}))};Bt.freezePage=()=>{tn.forEach(e=>e.freeze())};Bt.takeFullSnapshot=e=>{if(!yi)throw new Error("please take full snapshot after start recording");Xr(e)};Bt.mirror=Ze;var fc={exports:{}};(function(e,t){(function(n,r){e.exports=r()})(ee,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,m){var g=function(v){var b=typeof Request<"u"&&u instanceof Request?u.clone():u;o(b,c).then(function(y){if(Array.isArray(p)&&p.indexOf(y.status)===-1)h(y);else if(typeof p=="function")try{return Promise.resolve(p(v,null,y)).then(function(C){C?_(v,null,y):h(y)}).catch(m)}catch(C){m(C)}else v<d?_(v,null,y):h(y)}).catch(function(y){if(typeof p=="function")try{Promise.resolve(p(v,y,null)).then(function(C){C?_(v,y,null):m(y)}).catch(function(C){m(C)})}catch(C){m(C)}else v<d?_(v,y,null):m(y)})};function _(v,b,y){var C=typeof f=="function"?f(v,b,y):f;setTimeout(function(){g(++v)},C)}g(0)})}};function r(o){return Number.isInteger(o)&&o>=0}function i(o){this.name="ArgumentError",this.message=o}return n})})(fc);const xg=fc.exports;class Ag{constructor(t){xe(this,"awaitingResolvers",[]);xe(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 pc=new Ag(2),Tg=e=>pc.setLimit(e),Rg=xg(fetch),Lg=async(e,t=3)=>pc.execute(async()=>{const r=(await Rg(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}),Og=async({apiUrl:e,surveyId:t,uploadId:n,etags:r,headers:i,responseGroupUuid:o,replayDuration:a})=>{var s;return ct(`${e}/sdk/1/completeSessionReplay`,{method:"POST",body:JSON.stringify({etags:r,uploadId:n,responseGroupUuid:o,surveyId:t,replayDuration:a,userAgent:(s=window==null?void 0:window.navigator)==null?void 0:s.userAgent}),headers:i})};/*! *****************************************************************************
1
+ "use strict";var kc=Object.defineProperty;var Tc=(e,t,n)=>t in e?kc(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var ce=(e,t,n)=>(Tc(e,typeof t!="symbol"?t+"":t,n),n);Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});var He=(e=>(e.Closed="close.click",e.Complete="survey.completed",e.PageChange="page.change",e.API="api",e.Override="override",e))(He||{}),F=(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))(F||{}),Ps=(e=>(e.SurveyId="survey.id",e))(Ps||{});const mo={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 Te=(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))(Te||{}),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 Lc(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function Ac(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 ae={},Bt={};Object.defineProperty(Bt,"__esModule",{value:!0});var go=function(){function e(){}return e.prototype.handleError=function(t){},e}();Bt.NoopErrorHandler=go;var yo=new go;function Rc(e){yo=e}Bt.setErrorHandler=Rc;function Uc(){return yo}Bt.getErrorHandler=Uc;function Oc(){yo=new go}Bt.resetErrorHandler=Oc;var _o={};(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={}))})(_o);var Et={},un={},Er={exports:{}},ca=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||typeof msCrypto<"u"&&typeof window.msCrypto.getRandomValues=="function"&&msCrypto.getRandomValues.bind(msCrypto);if(ca){var da=new Uint8Array(16);Er.exports=function(){return ca(da),da}}else{var fa=new Array(16);Er.exports=function(){for(var t=0,n;t<16;t++)(t&3)===0&&(n=Math.random()*4294967296),fa[t]=n>>>((t&3)<<3)&255;return fa}}var Ns=[];for(var Xn=0;Xn<256;++Xn)Ns[Xn]=(Xn+256).toString(16).substr(1);function Dc(e,t){var n=t||0,r=Ns;return[r[e[n++]],r[e[n++]],r[e[n++]],r[e[n++]],"-",r[e[n++]],r[e[n++]],"-",r[e[n++]],r[e[n++]],"-",r[e[n++]],r[e[n++]],"-",r[e[n++]],r[e[n++]],r[e[n++]],r[e[n++]],r[e[n++]],r[e[n++]]].join("")}var Ms=Dc,Pc=Er.exports,Nc=Ms,pa,ei,ti=0,ni=0;function Mc(e,t,n){var r=t&&n||0,i=t||[];e=e||{};var o=e.node||pa,a=e.clockseq!==void 0?e.clockseq:ei;if(o==null||a==null){var s=Pc();o==null&&(o=pa=[s[0]|1,s[1],s[2],s[3],s[4],s[5]]),a==null&&(a=ei=(s[6]<<8|s[7])&16383)}var l=e.msecs!==void 0?e.msecs:new Date().getTime(),u=e.nsecs!==void 0?e.nsecs:ni+1,c=l-ti+(u-ni)/1e4;if(c<0&&e.clockseq===void 0&&(a=a+1&16383),(c<0||l>ti)&&e.nsecs===void 0&&(u=0),u>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");ti=l,ni=u,ei=a,l+=122192928e5;var f=((l&268435455)*1e4+u)%4294967296;i[r++]=f>>>24&255,i[r++]=f>>>16&255,i[r++]=f>>>8&255,i[r++]=f&255;var d=l/4294967296*1e4&268435455;i[r++]=d>>>8&255,i[r++]=d&255,i[r++]=d>>>24&15|16,i[r++]=d>>>16&255,i[r++]=a>>>8|128,i[r++]=a&255;for(var p=0;p<6;++p)i[r+p]=o[p];return t||Nc(i)}var Vc=Mc,jc=Er.exports,Bc=Ms;function Fc(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||jc)();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||Bc(i)}var Hc=Fc,Kc=Vc,Vs=Hc,wo=Vs;wo.v1=Kc;wo.v4=Vs;var $c=wo;(function(e){Object.defineProperty(e,"__esModule",{value:!0});var t=$c;function n(){return t.v4()}e.generateUUID=n;function r(){return new Date().getTime()}e.getTimestamp=r;function i(f,d){for(var p=!1,h=Object.keys(f),v=0;v<h.length;v++)if(d===f[h[v]]){p=!0;break}return p}e.isValidEnum=i;function o(f,d){var p={};return f.forEach(function(h){var v=d(h);p[v]=p[v]||[],p[v].push(h)}),a(p)}e.groupBy=o;function a(f){return Object.keys(f).map(function(d){return f[d]})}e.objectValues=a;function s(f){return Object.keys(f).map(function(d){return[d,f[d]]})}e.objectEntries=s;function l(f,d){for(var p,h=0,v=f;h<v.length;h++){var m=v[h];if(d(m)){p=m;break}}return p}e.find=l;function u(f,d){var p={};return f.forEach(function(h){var v=d(h);p[v]=h}),p}e.keyBy=u;function c(f){for(var d=[],p=1;p<arguments.length;p++)d[p-1]=arguments[p];var h=0;return f.replace(/%s/g,function(){var v=d[h++],m=typeof v;return m==="function"?v():m==="string"?v:String(v)})}e.sprintf=c,function(f){f.ACTIVATE="ACTIVATE:experiment, user_id,attributes, variation, event",f.DECISION="DECISION:type, userId, attributes, decisionInfo",f.LOG_EVENT="LOG_EVENT:logEvent",f.OPTIMIZELY_CONFIG_UPDATE="OPTIMIZELY_CONFIG_UPDATE",f.TRACK="TRACK:event_key, user_id, attributes, event_tags, event"}(e.NOTIFICATION_TYPES||(e.NOTIFICATION_TYPES={}))})(un);var qc=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(Et,"__esModule",{value:!0});var Gc=Bt,xr=un,te=_o,ha={NOTSET:0,DEBUG:1,INFO:2,WARNING:3,ERROR:4};function bo(e){return typeof e!="string"||(e=e.toUpperCase(),e==="WARN"&&(e="WARNING"),!ha[e])?e:ha[e]}var js=function(){function e(){this.defaultLoggerFacade=new va,this.loggers={}}return e.prototype.getLogger=function(t){return t?(this.loggers[t]||(this.loggers[t]=new va({messagePrefix:t})),this.loggers[t]):this.defaultLoggerFacade},e}(),zc=function(){function e(t){t===void 0&&(t={}),this.logLevel=te.LogLevel.NOTSET,t.logLevel!==void 0&&xr.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=bo(t),!xr.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}();Et.ConsoleLogHandler=zc;var An=te.LogLevel.NOTSET,Ci=null,va=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(bo(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+": ":"")+xr.sprintf.apply(void 0,qc([t.message],t.splat))},e.prototype.internalLog=function(t,n){!Ci||t<An||(Ci.log(t,this.format(n)),n.error&&n.error instanceof Error&&Gc.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}(),Bs=new js;function Wc(e){return Bs.getLogger(e)}Et.getLogger=Wc;function Yc(e){Ci=e}Et.setLogHandler=Yc;function Qc(e){e=bo(e),!xr.isValidEnum(te.LogLevel,e)||e===void 0?An=te.LogLevel.ERROR:An=e}Et.setLogLevel=Qc;function Zc(){return An}Et.getLogLevel=Zc;function Xc(){Bs=new js,An=te.LogLevel.NOTSET}Et.resetLogger=Xc;(function(e){function t(n){for(var r in n)e.hasOwnProperty(r)||(e[r]=n[r])}Object.defineProperty(e,"__esModule",{value:!0}),t(Bt),t(_o),t(Et)})(ae);var Jc={},Bn={};Object.defineProperty(Bn,"__esModule",{value:!0});Bn.areEventContextsEqual=void 0;function ed(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}Bn.areEventContextsEqual=ed;var Eo={},Jt={};Object.defineProperty(Jt,"__esModule",{value:!0});Jt.DefaultEventQueue=Jt.SingleEventQueue=void 0;var td=ae,nd=td.getLogger("EventProcessor"),rd=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}(),id=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}();Jt.SingleEventQueue=id;var od=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 rd({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){nd.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}();Jt.DefaultEventQueue=od;(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=Jt,n=ae,r=un;e.DEFAULT_FLUSH_INTERVAL=3e4,e.DEFAULT_BATCH_SIZE=10;var i=n.getLogger("EventProcessor");function o(u){return u<=0&&(i.warn("Invalid flushInterval "+u+", defaulting to "+e.DEFAULT_FLUSH_INTERVAL),u=e.DEFAULT_FLUSH_INTERVAL),u}e.validateAndGetFlushInterval=o;function a(u){return u=Math.floor(u),u<1&&(i.warn("Invalid batchSize "+u+", defaulting to "+e.DEFAULT_BATCH_SIZE),u=e.DEFAULT_BATCH_SIZE),u=Math.max(1,u),u}e.validateAndGetBatchSize=a;function s(u,c,f,d){var p;return u>1?p=new t.DefaultEventQueue({flushInterval:c,maxQueueSize:u,sink:f,batchComparator:d}):p=new t.SingleEventQueue({sink:f}),p}e.getQueue=s;function l(u,c){u&&u.sendNotifications(r.NOTIFICATION_TYPES.LOG_EVENT,c)}e.sendEventNotification=l})(Eo);var Fs={};Object.defineProperty(Fs,"__esModule",{value:!0});var Hs={};Object.defineProperty(Hs,"__esModule",{value:!0});var en={},Kr={};Object.defineProperty(Kr,"__esModule",{value:!0});Kr.LocalStorageStore=void 0;var ad=un,sd=ae,ma=sd.getLogger("EventProcessor"),ld=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 ad.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){ma.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){ma.error(n)}return{}},e}();Kr.LocalStorageStore=ld;var ud=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(en,"__esModule",{value:!0});en.LocalStoragePendingEventsDispatcher=en.PendingEventsDispatcher=void 0;var cd=ae,dd=Kr,ga=un,fd=cd.getLogger("EventProcessor"),Ks=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:ga.generateUUID(),timestamp:ga.getTimestamp(),request:t},n)},e.prototype.sendPendingEvents=function(){var t=this,n=this.store.values();fd.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}();en.PendingEventsDispatcher=Ks;var pd=function(e){ud(t,e);function t(n){var r=n.eventDispatcher;return e.call(this,{eventDispatcher:r,store:new dd.LocalStorageStore({maxValues:100,key:"fs_optly_pending_events"})})||this}return t}(Ks);en.LocalStoragePendingEventsDispatcher=pd;var De={},Ii=Z&&Z.__assign||function(){return Ii=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},Ii.apply(this,arguments)};Object.defineProperty(De,"__esModule",{value:!0});De.formatEvents=De.buildConversionEventV1=De.buildImpressionEventV1=De.makeBatchedEventV1=void 0;var hd="campaign_activated",vd="custom",ya="$opt_bot_filtering";function $s(e){var t=[],n=e[0];return e.forEach(function(r){if(r.type==="conversion"||r.type==="impression"){var i=xo(r);r.type==="impression"?i.snapshots.push(Gs(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}}De.makeBatchedEventV1=$s;function qs(e){var t=Ii({},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 Gs(e){var t,n,r=e.layer,i=e.experiment,o=e.variation,a=e.ruleKey,s=e.flagKey,l=e.ruleType,u=e.enabled,c=r?r.id:null,f=(t=i==null?void 0:i.id)!==null&&t!==void 0?t:"",d=(n=o==null?void 0:o.id)!==null&&n!==void 0?n:"",p=o?o.key:"";return{decisions:[{campaign_id:c,experiment_id:f,variation_id:d,metadata:{flag_key:s,rule_key:a,rule_type:l,variation_key:p,enabled:u}}],events:[{entity_id:c,timestamp:e.timestamp,key:hd,uuid:e.uuid}]}}function xo(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:ya,key:ya,type:vd,value:e.context.botFiltering}),t}function md(e){var t=xo(e);return t.snapshots.push(Gs(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]}}De.buildImpressionEventV1=md;function gd(e){var t=xo(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]}}De.buildConversionEventV1=gd;function yd(e){return{url:"https://logx.optimizely.com/v1/events",httpVerb:"POST",params:$s(e)}}De.formatEvents=yd;var $r={},So={};Object.defineProperty(So,"__esModule",{value:!0});var _d=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}();So.default=_d;var wd=Z&&Z.__awaiter||function(e,t,n,r){function i(o){return o instanceof n?o:new n(function(a){a(o)})}return new(n||(n=Promise))(function(o,a){function s(c){try{u(r.next(c))}catch(f){a(f)}}function l(c){try{u(r.throw(c))}catch(f){a(f)}}function u(c){c.done?o(c.value):i(c.value).then(s,l)}u((r=r.apply(e,t||[])).next())})},bd=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}}},Ed=Z&&Z.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty($r,"__esModule",{value:!0});$r.LogTierV1EventProcessor=void 0;var xd=ae,Kt=Eo,Sd=Ed(So),Cd=Bn,Id=De,_a=xd.getLogger("LogTierV1EventProcessor"),kd=function(){function e(t){var n=t.dispatcher,r=t.flushInterval,i=r===void 0?Kt.DEFAULT_FLUSH_INTERVAL:r,o=t.batchSize,a=o===void 0?Kt.DEFAULT_BATCH_SIZE:o,s=t.notificationCenter;this.dispatcher=n,this.notificationCenter=s,this.requestTracker=new Sd.default,i=Kt.validateAndGetFlushInterval(i),a=Kt.validateAndGetBatchSize(a),this.queue=Kt.getQueue(a,i,this.drainQueue.bind(this),Cd.areEventContextsEqual)}return e.prototype.drainQueue=function(t){var n=this,r=new Promise(function(i){if(_a.debug("draining queue with %s events",t.length),t.length===0){i();return}var o=Id.formatEvents(t);n.dispatcher.dispatchEvent(o,function(){i()}),Kt.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){_a.error('Error stopping EventProcessor: "%s"',t.message,t)}return Promise.resolve()},e.prototype.start=function(){return wd(this,void 0,void 0,function(){return bd(this,function(t){return this.queue.start(),[2]})})},e}();$r.LogTierV1EventProcessor=kd;(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(Bn,e),n(Eo,e),n(Fs,e),n(Hs,e),n(en,e),n(De,e),n($r,e)})(Jc);var Sr={exports:{}},wa=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||typeof msCrypto<"u"&&typeof window.msCrypto.getRandomValues=="function"&&msCrypto.getRandomValues.bind(msCrypto);if(wa){var ba=new Uint8Array(16);Sr.exports=function(){return wa(ba),ba}}else{var Ea=new Array(16);Sr.exports=function(){for(var t=0,n;t<16;t++)(t&3)===0&&(n=Math.random()*4294967296),Ea[t]=n>>>((t&3)<<3)&255;return Ea}}var zs=[];for(var Jn=0;Jn<256;++Jn)zs[Jn]=(Jn+256).toString(16).substr(1);function Td(e,t){var n=t||0,r=zs;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 Ws=Td,Ld=Sr.exports,Ad=Ws,xa,ri,ii=0,oi=0;function Rd(e,t,n){var r=t&&n||0,i=t||[];e=e||{};var o=e.node||xa,a=e.clockseq!==void 0?e.clockseq:ri;if(o==null||a==null){var s=Ld();o==null&&(o=xa=[s[0]|1,s[1],s[2],s[3],s[4],s[5]]),a==null&&(a=ri=(s[6]<<8|s[7])&16383)}var l=e.msecs!==void 0?e.msecs:new Date().getTime(),u=e.nsecs!==void 0?e.nsecs:oi+1,c=l-ii+(u-oi)/1e4;if(c<0&&e.clockseq===void 0&&(a=a+1&16383),(c<0||l>ii)&&e.nsecs===void 0&&(u=0),u>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");ii=l,oi=u,ri=a,l+=122192928e5;var f=((l&268435455)*1e4+u)%4294967296;i[r++]=f>>>24&255,i[r++]=f>>>16&255,i[r++]=f>>>8&255,i[r++]=f&255;var d=l/4294967296*1e4&268435455;i[r++]=d>>>8&255,i[r++]=d&255,i[r++]=d>>>24&15|16,i[r++]=d>>>16&255,i[r++]=a>>>8|128,i[r++]=a&255;for(var p=0;p<6;++p)i[r+p]=o[p];return t||Ad(i)}var Ud=Rd,Od=Sr.exports,Dd=Ws;function Pd(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||Od)();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||Dd(i)}var Nd=Pd,Md=Ud,Ys=Nd,Qs=Ys;Qs.v1=Md;Qs.v4=Ys;var Vd={exports:{}};(function(e){(function(){function t(i,o){for(var a=i.length,s=o^a,l=0,u;a>=4;)u=i.charCodeAt(l)&255|(i.charCodeAt(++l)&255)<<8|(i.charCodeAt(++l)&255)<<16|(i.charCodeAt(++l)&255)<<24,u=(u&65535)*1540483477+(((u>>>16)*1540483477&65535)<<16),u^=u>>>24,u=(u&65535)*1540483477+(((u>>>16)*1540483477&65535)<<16),s=(s&65535)*1540483477+(((s>>>16)*1540483477&65535)<<16)^u,a-=4,++l;switch(a){case 3:s^=(i.charCodeAt(l+2)&255)<<16;case 2:s^=(i.charCodeAt(l+1)&255)<<8;case 1:s^=i.charCodeAt(l)&255,s=(s&65535)*1540483477+(((s>>>16)*1540483477&65535)<<16)}return s^=s>>>13,s=(s&65535)*1540483477+(((s>>>16)*1540483477&65535)<<16),s^=s>>>15,s>>>0}function n(i,o){var a,s,l,u,c,f,d,p;for(a=i.length&3,s=i.length-a,l=o,c=3432918353,f=461845907,p=0;p<s;)d=i.charCodeAt(p)&255|(i.charCodeAt(++p)&255)<<8|(i.charCodeAt(++p)&255)<<16|(i.charCodeAt(++p)&255)<<24,++p,d=(d&65535)*c+(((d>>>16)*c&65535)<<16)&4294967295,d=d<<15|d>>>17,d=(d&65535)*f+(((d>>>16)*f&65535)<<16)&4294967295,l^=d,l=l<<13|l>>>19,u=(l&65535)*5+(((l>>>16)*5&65535)<<16)&4294967295,l=(u&65535)+27492+(((u>>>16)+58964&65535)<<16);switch(d=0,a){case 3:d^=(i.charCodeAt(p+2)&255)<<16;case 2:d^=(i.charCodeAt(p+1)&255)<<8;case 1:d^=i.charCodeAt(p)&255,d=(d&65535)*c+(((d>>>16)*c&65535)<<16)&4294967295,d=d<<15|d>>>17,d=(d&65535)*f+(((d>>>16)*f&65535)<<16)&4294967295,l^=d}return l^=i.length,l^=l>>>16,l=(l&65535)*2246822507+(((l>>>16)*2246822507&65535)<<16)&4294967295,l^=l>>>13,l=(l&65535)*3266489909+(((l>>>16)*3266489909&65535)<<16)&4294967295,l^=l>>>16,l>>>0}var r=n;r.v2=t,r.v3=n,e.exports=r})()})(Vd);var Zs={},Co={},Io={},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(Io,"__esModule",{value:!0});var jd=qe,Bd=ae,Fd=Bd.getLogger("DatafileManager"),Hd="GET",Kd=4;function $d(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 qd(e,t){Object.keys(e).forEach(function(n){var r=e[n];t.setRequestHeader(n,r)})}function Gd(e,t){var n=new XMLHttpRequest,r=new Promise(function(i,o){n.open(Hd,e,!0),qd(t,n),n.onreadystatechange=function(){if(n.readyState===Kd){var a=n.status;if(a===0){o(new Error("Request error"));return}var s=$d(n),l={statusCode:n.status,body:n.responseText,headers:s};i(l)}},n.timeout=jd.REQUEST_TIMEOUT_MS,n.ontimeout=function(){Fd.error("Request timed out")},n.send()});return{responsePromise:r,abort:function(){n.abort()}}}Io.makeGetRequest=Gd;var ko={},To={};Object.defineProperty(To,"__esModule",{value:!0});var zd=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}();To.default=zd;var Lo={};Object.defineProperty(Lo,"__esModule",{value:!0});var ai=qe;function Wd(){return Math.round(Math.random()*1e3)}var Yd=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+Wd()},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}();Lo.default=Yd;var Cr=Z&&Z.__assign||function(){return Cr=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},Cr.apply(this,arguments)},Xs=Z&&Z.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(ko,"__esModule",{value:!0});var Qd=ae,Zd=un,Xd=Xs(To),_n=qe,Jd=Xs(Lo),Se=Qd.getLogger("DatafileManager"),ef="update";function tf(e){return e>=_n.MIN_UPDATE_INTERVAL}function Sa(e){return e>=200&&e<400}var nf={get:function(){return Promise.resolve("")},set:function(){return Promise.resolve()},contains:function(){return Promise.resolve(!1)},remove:function(){return Promise.resolve()}},rf=function(){function e(t){var n=this,r=Cr(Cr({},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?_n.DEFAULT_UPDATE_INTERVAL:l,c=r.urlTemplate,f=c===void 0?_n.DEFAULT_URL_TEMPLATE:c,d=r.cache,p=d===void 0?nf:d;this.cache=p,this.cacheKey="opt-datafile-"+s,this.isReadyPromiseSettled=!1,this.readyPromiseResolver=function(){},this.readyPromiseRejecter=function(){},this.readyPromise=new Promise(function(h,v){n.readyPromiseResolver=h,n.readyPromiseRejecter=v}),i?(this.currentDatafile=i,s||this.resolveReadyPromise()):this.currentDatafile="",this.isStarted=!1,this.datafileUrl=Zd.sprintf(f,s),this.emitter=new Xd.default,this.autoUpdate=a,tf(u)?this.updateInterval=u:(Se.warn("Invalid updateInterval %s, defaulting to %s",u,_n.DEFAULT_UPDATE_INTERVAL),this.updateInterval=_n.DEFAULT_UPDATE_INTERVAL),this.currentTimeout=null,this.currentRequest=null,this.backoffController=new Jd.default,this.syncOnCurrentRequestComplete=!1}return e.prototype.get=function(){return this.currentDatafile},e.prototype.start=function(){this.isStarted||(Se.debug("Datafile manager started"),this.isStarted=!0,this.backoffController.reset(),this.setDatafileFromCacheIfAvailable(),this.syncDatafile())},e.prototype.stop=function(){return Se.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?Se.error("Error fetching datafile: %s",t.message,t):typeof t=="string"?Se.error("Error fetching datafile: %s",t):Se.error("Error fetching datafile"))},e.prototype.onRequestResolved=function(t){if(!!this.isStarted){typeof t.statusCode<"u"&&Sa(t.statusCode)?this.backoffController.reset():this.backoffController.countError(),this.trySavingLastModified(t.headers);var n=this.getNextDatafileFromResponse(t);if(n!=="")if(Se.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(ef,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),Se.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);Se.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 Se.debug("Response status code: %s",t.statusCode),typeof t.statusCode>"u"||t.statusCode===304?"":Sa(t.statusCode)?t.body:""},e.prototype.trySavingLastModified=function(t){var n=t["last-modified"]||t["Last-Modified"];typeof n<"u"&&(this.lastResponseLastModified=n,Se.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!==""&&(Se.debug("Using datafile from cache"),t.currentDatafile=n,t.resolveReadyPromise())})},e}();ko.default=rf;var of=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)}}(),af=Z&&Z.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Co,"__esModule",{value:!0});var sf=Io,lf=af(ko),uf=function(e){of(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.makeGetRequest=function(n,r){return sf.makeGetRequest(n,r)},t.prototype.getConfigDefaults=function(){return{autoUpdate:!1}},t}(lf.default);Co.default=uf;Object.defineProperty(Zs,"__esModule",{value:!0});var cf=Co;Zs.HttpPollingDatafileManager=cf.default;var df={NOTSET:0,DEBUG:1,INFO:2,WARNING:3,ERROR:4},ff={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."},pf={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"'},hf={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"},vf="javascript-sdk",mf="node-sdk",gf="react-sdk",yf="react-native-sdk",_f="react-native-js-sdk",wf="4.9.4",bf="4.9.4",Ef={AB_TEST:"ab-test",FEATURE:"feature",FEATURE_TEST:"feature-test",FEATURE_VARIABLE:"feature-variable",ALL_FEATURE_VARIABLES:"all-feature-variables",FLAG:"flag"},xf={FEATURE_TEST:"feature-test",ROLLOUT:"rollout",EXPERIMENT:"experiment"},Sf={RULE:"rule",EXPERIMENT:"experiment"},Cf={BOOLEAN:"boolean",DOUBLE:"double",INTEGER:"integer",STRING:"string",JSON:"json"},lr={V2:"2",V3:"3",V4:"4"},If={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.'},ki;(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"})(ki||(ki={}));var kf=Object.freeze({__proto__:null,LOG_LEVEL:df,ERROR_MESSAGES:ff,LOG_MESSAGES:pf,CONTROL_ATTRIBUTES:hf,JAVASCRIPT_CLIENT_ENGINE:vf,NODE_CLIENT_ENGINE:mf,REACT_CLIENT_ENGINE:gf,REACT_NATIVE_CLIENT_ENGINE:yf,REACT_NATIVE_JS_CLIENT_ENGINE:_f,BROWSER_CLIENT_VERSION:wf,NODE_CLIENT_VERSION:bf,DECISION_NOTIFICATION_TYPES:Ef,DECISION_SOURCES:xf,AUDIENCE_EVALUATION_TYPES:Sf,FEATURE_VARIABLE_TYPES:Cf,DATAFILE_VERSIONS:lr,DECISION_MESSAGES:If,get NOTIFICATION_TYPES(){return ki}});lr.V2,lr.V3,lr.V4;(function(){function e(){}return e.prototype.log=function(){},e})();function Tf(e){return new ae.ConsoleLogHandler(e)}var Ca;(function(e){e.BOOLEAN="boolean",e.DOUBLE="double",e.INTEGER="integer",e.STRING="string",e.JSON="json"})(Ca||(Ca={}));var Ia;(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"})(Ia||(Ia={}));ae.getLogger();ae.getLogger();ae.getLogger();ae.getLogger();ae.getLogger("EVENT_BUILDER");ae.getLogger();ae.setLogHandler(Tf());ae.setLogLevel(ae.LogLevel.INFO);let er;const Lf=new Uint8Array(16);function Af(){if(!er&&(er=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!er))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return er(Lf)}const se=[];for(let e=0;e<256;++e)se.push((e+256).toString(16).slice(1));function Rf(e,t=0){return(se[e[t+0]]+se[e[t+1]]+se[e[t+2]]+se[e[t+3]]+"-"+se[e[t+4]]+se[e[t+5]]+"-"+se[e[t+6]]+se[e[t+7]]+"-"+se[e[t+8]]+se[e[t+9]]+"-"+se[e[t+10]]+se[e[t+11]]+se[e[t+12]]+se[e[t+13]]+se[e[t+14]]+se[e[t+15]]).toLowerCase()}const Uf=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),ka={randomUUID:Uf};function gt(e,t,n){if(ka.randomUUID&&!t&&!e)return ka.randomUUID();e=e||{};const r=e.random||(e.rng||Af)();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 Rf(r)}const Yt="ul-app";var R=(e=>(e.Caption="ul-caption",e.CardContainer="ul-card__container",e.CardMainContent="ul-card-main-content",e.Choice="choice",e.ChoiceCheckbox="select-checkbox",e.ChoiceGroup="ul-card__choices",e.ChoiceLabel="select-label",e.ChoiceLabelContainer="choice-label-container",e.ChoiceRadio="select-radio",e.ChoiceTextEntryContainer="choice-text-entry-container",e.ChoiceTextInput="choice-text-input",e.CloseButton="close-btn",e.CloseContainer="close-container",e.ConsentLegalNameInput="ul-consent-legal__name-input",e.CustomStyle="ul-custom-style",e.DesktopSuffix="--desktop",e.FadeInTransition="fade-in-transition",e.LikertNumber="likert-number",e.LikertSmiley="likert-smiley",e.LikertStar="likert-star",e.LoadingSpinner="ul-loading-spinner",e.LoadingSpinnerContainer="ul-loading-spinner-container",e.LoadingSpinnerFirst="first",e.LoadingSpinnerFourth="fourth",e.LoadingSpinnerSecond="second",e.LoadingSpinnerThird="third",e.MobileSuffix="--mobile",e.NPSNumber="nps-number",e.OpenTextInput="ul-card-text__input",e.QuestionHeader="ul-question",e.VideoCard="ul-card--video",e.CheckmarkButton="ul-button-checkmark",e.InactiveButton="ul-button-inactive",e.LeftAlignButton="ul-button-left-align",e.ButtonDisabled="sprig-button-disabled",e.SkipButton="ul-card-skip__button",e))(R||{});const Ao="#e6e6e6",xn="#bd282a",Of=500,Df=1030;var we=(e=>(e.Preview="sprig.previewKey",e.Credentials="userleap.ids",e.PageViews="userleap.pageviews",e))(we||{});const Js=()=>{try{return window.parent.Intercom}catch(e){return console.error(e),null}},Pf=()=>{const e=Js();!e||(e.ul_wasVisible&&e("update",{hide_default_launcher:!1}),delete e.ul_wasVisible)},Nf=()=>{const e=Js();!e||(e.ul_wasVisible=!!document.querySelector("iframe.intercom-launcher-frame"),e.ul_wasVisible&&e("update",{hide_default_launcher:!0}))},Mf=Object.freeze(Object.defineProperty({__proto__:null,enable:Pf,disable:Nf},Symbol.toStringTag,{value:"Module"})),Ta=[Mf];class Ti{static disable(){Ta.forEach(t=>t.disable())}static enable(){Ta.forEach(t=>t.enable())}}const Vf=1,tn=e=>e instanceof HTMLElement,jf=e=>e instanceof HTMLInputElement,Sn=e=>e instanceof HTMLTextAreaElement,el=(e,t,n)=>{const r=e.createElement("style");n&&(r.nonce=n),r.textContent=t,r.id=R.CustomStyle,e.head.appendChild(r)},tl=e=>{const t=e.querySelector(`.${R.CardContainer}`);let n=600,r=0;if(t){n=t.scrollHeight;const i=getComputedStyle(t),o=parseFloat(i.marginTop)+parseFloat(i.marginBottom),a=parseFloat(i.borderTopWidth)+parseFloat(i.borderBottomWidth);r=o+a}return n+r+Vf},Bf=e=>{const t=e.querySelector(`.${R.CardContainer}`);t&&(t.scrollTop=0)};var Ff=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"}},nl=class{static listenerCount(e,t){return e.listenerCount(t)}constructor(){this.events=new Map,this.maxListeners=nl.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 Ff(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)}},rl=nl;rl.defaultMaxListeners=10;const G=new rl;var wn=(e=>(e.BottomLeft="bottomLeft",e.BottomRight="bottomRight",e.Center="center",e.TopLeft="topLeft",e.TopRight="topRight",e))(wn||{}),Fe=(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))(Fe||{}),Nt=(e=>(e.Email="email",e.Link="link",e.Web="web",e))(Nt||{}),mt=(e=>(e.Npm="web-npm",e.Gtm="web-gtm",e.Segment="web-segment",e.SegmentAndroid="android-segment",e.SegmentReactNative="react-native-segment",e.SegmentIOS="ios-segment",e.Snippet="web-snippet",e))(mt||{});const Ir=e=>new Promise(t=>{setTimeout(()=>{t()},e)}),Qt=({"userleap-platform":e})=>e!==Nt.Web,re=(e,t)=>{const n=t?R.MobileSuffix:R.DesktopSuffix;return[e+n,e]},Ge=(e,t)=>[e,`${e}__${t}`];class Hf{constructor(t){ce(this,"payload");ce(this,"promise");ce(this,"reject",()=>{});ce(this,"resolve",()=>{});this.payload=t,this.promise=new Promise((n,r)=>{this.reject=r,this.resolve=n})}resolveRequest(t){this.resolve(t)}}const Kf={RATELIMIT_RESET_DEFAULT:10};let il=!1,ol="",tr=!1,al=!1,ur=[];const $f=e=>e._config&&e._config.installationMethod?e._config.installationMethod:e._gtm?mt.Gtm:e._segment?mt.Segment:mt.Snippet,Li=e=>{var t;(t=e==null?void 0:e.blockedURI)!=null&&t.includes(window.UserLeap._API_URL)&&(al=!0,console.warn(`[Sprig] ${e.blockedURI} is blocked by Content-Security-Policy`),document.removeEventListener("securitypolicyviolation",Li))},Ai=(e="")=>{il=!0,ol=e};function Fn(e={}){const t={"Content-Type":"application/json","userleap-platform":Nt.Web,"x-ul-sdk-version":"2.24.7",[Fe.InstallationMethod]:$f(e)};if(e.envId&&(t[Fe.EnvironmentID]=e.envId),e.token&&(t.Authorization="Bearer "+e.token),e.userId&&(t[Fe.UserID]=e.userId),e.visitorId&&(t[Fe.VisitorID]=e.visitorId),e.partnerAnonymousId&&(t[Fe.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[Fe.PreviewMode]="1"),t}const La=async(e,t,n)=>{if(e)return{status:429};{const r=new Hf(n);return ur.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(tr&&!i)return La(r,i,o);const a={ok:!1,reportError:!1};if(il)return console.info(`UserLeap - ${ol}`),a;try{t.headers=Object.assign(Fn(),t.headers);const s=await fetch(e,t);if(s.status===429)if(!tr&&!r||i){tr=!0;const u=s.headers.has("ratelimit-reset")?Number(s.headers.get("ratelimit-reset")):Kf.RATELIMIT_RESET_DEFAULT;return await Ir(u*1e3),it(e,t,0,r,!0)}else return La(r,!1,o);if(tr=!1,ur.length&&(ur.map(l=>{const{url:u,options:c,attempt:f,shouldDropOnRateLimit:d}=l.payload;it(u,c,f,d).then(p=>{l.resolveRequest(p)})}),ur=[]),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||al?{ok:!1,reportError:!1,error:s}:(await Ir(Math.pow(2,n)*1e3),it(e,t,l))}};var sl={exports:{}};(function(e,t){(function(n,r){e.exports=r()})(Z,function(){var n=function(o,a){if(a=a||{},typeof o!="function")throw new i("fetch must be a function");if(typeof a!="object")throw new i("defaults must be an object");if(a.retries!==void 0&&!r(a.retries))throw new i("retries must be a positive integer");if(a.retryDelay!==void 0&&!r(a.retryDelay)&&typeof a.retryDelay!="function")throw new i("retryDelay must be a positive integer or a function returning a positive integer");if(a.retryOn!==void 0&&!Array.isArray(a.retryOn)&&typeof a.retryOn!="function")throw new i("retryOn property expects an array or function");var s={retries:3,retryDelay:1e3,retryOn:[]};return a=Object.assign(s,a),function(u,c){var f=a.retries,d=a.retryDelay,p=a.retryOn;if(c&&c.retries!==void 0)if(r(c.retries))f=c.retries;else throw new i("retries must be a positive integer");if(c&&c.retryDelay!==void 0)if(r(c.retryDelay)||typeof c.retryDelay=="function")d=c.retryDelay;else throw new i("retryDelay must be a positive integer or a function returning a positive integer");if(c&&c.retryOn)if(Array.isArray(c.retryOn)||typeof c.retryOn=="function")p=c.retryOn;else throw new i("retryOn property expects an array or function");return new Promise(function(h,v){var m=function(y){var E=typeof Request<"u"&&u instanceof Request?u.clone():u;o(E,c).then(function(w){if(Array.isArray(p)&&p.indexOf(w.status)===-1)h(w);else if(typeof p=="function")try{return Promise.resolve(p(y,null,w)).then(function(b){b?_(y,null,w):h(w)}).catch(v)}catch(b){v(b)}else y<f?_(y,null,w):h(w)}).catch(function(w){if(typeof p=="function")try{Promise.resolve(p(y,w,null)).then(function(b){b?_(y,w,null):v(w)}).catch(function(b){v(b)})}catch(b){v(b)}else y<f?_(y,w,null):v(w)})};function _(y,E,w){var b=typeof d=="function"?d(y,E,w):d;setTimeout(function(){m(++y)},b)}m(0)})}};function r(o){return Number.isInteger(o)&&o>=0}function i(o){this.name="ArgumentError",this.message=o}return n})})(sl);const qf=sl.exports;class Gf{constructor(t){ce(this,"awaitingResolvers",[]);ce(this,"activeCount",0);this.capacity=t}async acquire(){if(this.activeCount<this.capacity){this.activeCount++;return}return new Promise(t=>{this.awaitingResolvers.push(t)})}release(){const t=this.awaitingResolvers.shift();t&&this.activeCount<=this.capacity?t():this.activeCount--}async execute(t){try{return await this.acquire(),await t()}finally{this.release()}}setLimit(t){this.capacity=t}}const ll=new Gf(2),zf=e=>ll.setLimit(e),Wf=qf(fetch),Yf=async(e,t=3)=>ll.execute(async()=>{const r=(await Wf(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}),ul=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})};/*! *****************************************************************************
20
3
  Copyright (c) Microsoft Corporation.
21
4
  Permission to use, copy, modify, and/or distribute this software for any
22
5
  purpose with or without fee is hereby granted.
@@ -27,15 +10,13 @@ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
27
10
  LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
28
11
  OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
29
12
  PERFORMANCE OF THIS SOFTWARE.
30
- ***************************************************************************** */var G=function(){return G=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},G.apply(this,arguments)};function jo(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 oe=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,ge=Object.keys,Re=Array.isArray;typeof Promise<"u"&&!oe.Promise&&(oe.Promise=Promise);function Pe(e,t){return typeof t!="object"||ge(t).forEach(function(n){e[n]=t[n]}),e}var fr=Object.getPrototypeOf,Ng={}.hasOwnProperty;function je(e,t){return Ng.call(e,t)}function Un(e,t){typeof t=="function"&&(t=t(fr(e))),(typeof Reflect>"u"?ge:Reflect.ownKeys)(t).forEach(function(n){xt(e,n,t[n])})}var hc=Object.defineProperty;function xt(e,t,n,r){hc(e,t,Pe(n&&je(n,"get")&&typeof n.get=="function"?{get:n.get,set:n.set,configurable:!0}:{value:n,configurable:!0,writable:!0},r))}function Hn(e){return{from:function(t){return e.prototype=Object.create(t.prototype),xt(e.prototype,"constructor",e),{extend:Un.bind(null,e.prototype)}}}}var Dg=Object.getOwnPropertyDescriptor;function Wa(e,t){var n=Dg(e,t),r;return n||(r=fr(e))&&Wa(r,t)}var Ug=[].slice;function ji(e,t,n){return Ug.call(e,t,n)}function mc(e,t){return t(e)}function Xn(e){if(!e)throw new Error("Assertion Failed")}function gc(e){oe.setImmediate?setImmediate(e):setTimeout(e,0)}function vc(e,t){return e.reduce(function(n,r,i){var o=t(r,i);return o&&(n[o[0]]=o[1]),n},{})}function Pg(e,t,n){try{e.apply(null,n)}catch(r){t&&t(r)}}function St(e,t){if(je(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=St(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:St(s,t.substr(a+1))}}function Je(e,t,n){if(!(!e||t===void 0)&&!("isFrozen"in Object&&Object.isFrozen(e)))if(typeof t!="string"&&"length"in t){Xn(typeof n!="string"&&"length"in n);for(var r=0,i=t.length;r<i;++r)Je(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?Re(e)&&!isNaN(parseInt(a))?e.splice(a,1):delete e[a]:e[a]=n;else{var l=e[a];(!l||!je(e,a))&&(l=e[a]={}),Je(l,s,n)}}else n===void 0?Re(e)&&!isNaN(parseInt(t))?e.splice(t,1):delete e[t]:e[t]=n}}function Mg(e,t){typeof t=="string"?Je(e,t,void 0):"length"in t&&[].map.call(t,function(n){Je(e,n,void 0)})}function yc(e){var t={};for(var n in e)je(e,n)&&(t[n]=e[n]);return t}var Fg=[].concat;function _c(e){return Fg.apply([],e)}var bc="Boolean,String,Date,RegExp,Blob,File,FileList,FileSystemFileHandle,ArrayBuffer,DataView,Uint8ClampedArray,ImageBitmap,ImageData,Map,Set,CryptoKey".split(",").concat(_c([8,16,32,64].map(function(e){return["Int","Uint","Float"].map(function(t){return t+e+"Array"})}))).filter(function(e){return oe[e]}),Vg=bc.map(function(e){return oe[e]});vc(bc,function(e){return[e,!0]});var Nt=null;function kr(e){Nt=typeof WeakMap<"u"&&new WeakMap;var t=Ho(e);return Nt=null,t}function Ho(e){if(!e||typeof e!="object")return e;var t=Nt&&Nt.get(e);if(t)return t;if(Re(e)){t=[],Nt&&Nt.set(e,t);for(var n=0,r=e.length;n<r;++n)t.push(Ho(e[n]))}else if(Vg.indexOf(e.constructor)>=0)t=e;else{var i=fr(e);t=i===Object.prototype?{}:Object.create(i),Nt&&Nt.set(e,t);for(var o in e)je(e,o)&&(t[o]=Ho(e[o]))}return t}var Bg={}.toString;function zo(e){return Bg.call(e).slice(8,-1)}var Ko=typeof Symbol<"u"?Symbol.iterator:"@@iterator",jg=typeof Ko=="symbol"?function(e){var t;return e!=null&&(t=e[Ko])&&t.apply(e)}:function(){return null},Cn={};function _t(e){var t,n,r,i;if(arguments.length===1){if(Re(e))return e.slice();if(this===Cn&&typeof e=="string")return[e];if(i=jg(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 qa=typeof Symbol<"u"?function(e){return e[Symbol.toStringTag]==="AsyncFunction"}:function(){return!1},mt=typeof location<"u"&&/^(http|https):\/\/(localhost|127\.0\.0\.1)/.test(location.href);function wc(e,t){mt=e,Cc=t}var Cc=function(){return!0},Hg=!new Error("").stack;function pn(){if(Hg)try{throw pn.arguments,new Error}catch(e){return e}return new Error}function Go(e,t){var n=e.stack;return n?(t=t||0,n.indexOf(e.name)===0&&(t+=(e.name+e.message).split(`
13
+ ***************************************************************************** */var $=function(){return $=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},$.apply(this,arguments)};function Ri(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,pe=Array.isArray;typeof Promise<"u"&&!Y.Promise&&(Y.Promise=Promise);function ve(e,t){return typeof t!="object"||ne(t).forEach(function(n){e[n]=t[n]}),e}var Rn=Object.getPrototypeOf,Qf={}.hasOwnProperty;function be(e,t){return Qf.call(e,t)}function nn(e,t){typeof t=="function"&&(t=t(Rn(e))),(typeof Reflect>"u"?ne:Reflect.ownKeys)(t).forEach(function(n){st(e,n,t[n])})}var cl=Object.defineProperty;function st(e,t,n,r){cl(e,t,ve(n&&be(n,"get")&&typeof n.get=="function"?{get:n.get,set:n.set,configurable:!0}:{value:n,configurable:!0,writable:!0},r))}function cn(e){return{from:function(t){return e.prototype=Object.create(t.prototype),st(e.prototype,"constructor",e),{extend:nn.bind(null,e.prototype)}}}}var Zf=Object.getOwnPropertyDescriptor;function Ro(e,t){var n=Zf(e,t),r;return n||(r=Rn(e))&&Ro(r,t)}var Xf=[].slice;function qr(e,t,n){return Xf.call(e,t,n)}function dl(e,t){return t(e)}function bn(e){if(!e)throw new Error("Assertion Failed")}function fl(e){Y.setImmediate?setImmediate(e):setTimeout(e,0)}function pl(e,t){return e.reduce(function(n,r,i){var o=t(r,i);return o&&(n[o[0]]=o[1]),n},{})}function Jf(e,t,n){try{e.apply(null,n)}catch(r){t&&t(r)}}function ot(e,t){if(be(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 Pe(e,t,n){if(!(!e||t===void 0)&&!("isFrozen"in Object&&Object.isFrozen(e)))if(typeof t!="string"&&"length"in t){bn(typeof n!="string"&&"length"in n);for(var r=0,i=t.length;r<i;++r)Pe(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?pe(e)&&!isNaN(parseInt(a))?e.splice(a,1):delete e[a]:e[a]=n;else{var l=e[a];(!l||!be(e,a))&&(l=e[a]={}),Pe(l,s,n)}}else n===void 0?pe(e)&&!isNaN(parseInt(t))?e.splice(t,1):delete e[t]:e[t]=n}}function ep(e,t){typeof t=="string"?Pe(e,t,void 0):"length"in t&&[].map.call(t,function(n){Pe(e,n,void 0)})}function hl(e){var t={};for(var n in e)be(e,n)&&(t[n]=e[n]);return t}var tp=[].concat;function vl(e){return tp.apply([],e)}var ml="Boolean,String,Date,RegExp,Blob,File,FileList,FileSystemFileHandle,ArrayBuffer,DataView,Uint8ClampedArray,ImageBitmap,ImageData,Map,Set,CryptoKey".split(",").concat(vl([8,16,32,64].map(function(e){return["Int","Uint","Float"].map(function(t){return t+e+"Array"})}))).filter(function(e){return Y[e]}),np=ml.map(function(e){return Y[e]});pl(ml,function(e){return[e,!0]});var dt=null;function Hn(e){dt=typeof WeakMap<"u"&&new WeakMap;var t=Ui(e);return dt=null,t}function Ui(e){if(!e||typeof e!="object")return e;var t=dt&&dt.get(e);if(t)return t;if(pe(e)){t=[],dt&&dt.set(e,t);for(var n=0,r=e.length;n<r;++n)t.push(Ui(e[n]))}else if(np.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)be(e,o)&&(t[o]=Ui(e[o]))}return t}var rp={}.toString;function Oi(e){return rp.call(e).slice(8,-1)}var Di=typeof Symbol<"u"?Symbol.iterator:"@@iterator",ip=typeof Di=="symbol"?function(e){var t;return e!=null&&(t=e[Di])&&t.apply(e)}:function(){return null},Gt={};function Xe(e){var t,n,r,i;if(arguments.length===1){if(pe(e))return e.slice();if(this===Gt&&typeof e=="string")return[e];if(i=ip(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 Uo=typeof Symbol<"u"?function(e){return e[Symbol.toStringTag]==="AsyncFunction"}:function(){return!1},ze=typeof location<"u"&&/^(http|https):\/\/(localhost|127\.0\.0\.1)/.test(location.href);function gl(e,t){ze=e,yl=t}var yl=function(){return!0},op=!new Error("").stack;function Ft(){if(op)try{throw Ft.arguments,new Error}catch(e){return e}return new Error}function Pi(e,t){var n=e.stack;return n?(t=t||0,n.indexOf(e.name)===0&&(t+=(e.name+e.message).split(`
31
14
  `).length),n.split(`
32
- `).slice(t).filter(Cc).map(function(r){return`
33
- `+r}).join("")):""}var zg=["Modify","Bulk","OpenFailed","VersionChange","Schema","Upgrade","InvalidTable","MissingAPI","NoSuchDatabase","InvalidArgument","SubTransaction","Unsupported","Internal","DatabaseClosed","PrematureCommit","ForeignAwait"],Ic=["Unknown","Constraint","Data","TransactionInactive","ReadOnly","Version","NotFound","InvalidState","InvalidAccess","Abort","Timeout","QuotaExceeded","Syntax","DataClone"],$a=zg.concat(Ic),Kg={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 zn(e,t){this._e=pn(),this.name=e,this.message=t}Hn(zn).from(Error).extend({stack:{get:function(){return this._stack||(this._stack=this.name+": "+this.message+Go(this._e,2))}},toString:function(){return this.name+": "+this.message}});function Ec(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(`
34
- `)}function _i(e,t,n,r){this._e=pn(),this.failures=t,this.failedKeys=r,this.successCount=n,this.message=Ec(e,t)}Hn(_i).from(zn);function ir(e,t){this._e=pn(),this.name="BulkError",this.failures=Object.keys(t).map(function(n){return t[n]}),this.failuresByPos=t,this.message=Ec(e,t)}Hn(ir).from(zn);var Za=$a.reduce(function(e,t){return e[t]=t+"Error",e},{}),Gg=zn,V=$a.reduce(function(e,t){var n=t+"Error";function r(i,o){this._e=pn(),this.name=n,i?typeof i=="string"?(this.message=""+i+(o?`
35
- `+o:""),this.inner=o||null):typeof i=="object"&&(this.message=i.name+" "+i.message,this.inner=i):(this.message=Kg[t]||n,this.inner=null)}return Hn(r).from(Gg),e[t]=r,e},{});V.Syntax=SyntaxError;V.Type=TypeError;V.Range=RangeError;var al=Ic.reduce(function(e,t){return e[t+"Error"]=V[t],e},{});function Wg(e,t){if(!e||e instanceof zn||e instanceof TypeError||e instanceof SyntaxError||!e.name||!al[e.name])return e;var n=new al[e.name](t||e.message,e);return"stack"in e&&xt(n,"stack",{get:function(){return this.inner.stack}}),n}var Hi=$a.reduce(function(e,t){return["Syntax","Type","Range"].indexOf(t)===-1&&(e[t+"Error"]=V[t]),e},{});Hi.ModifyError=_i;Hi.DexieError=zn;Hi.BulkError=ir;function re(){}function xr(e){return e}function qg(e,t){return e==null||e===xr?t:function(n){return t(e(n))}}function un(e,t){return function(){e.apply(this,arguments),t.apply(this,arguments)}}function $g(e,t){return e===re?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?un(r,this.onsuccess):r),i&&(this.onerror=this.onerror?un(i,this.onerror):i),o!==void 0?o:n}}function Zg(e,t){return e===re?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?un(n,this.onsuccess):n),r&&(this.onerror=this.onerror?un(r,this.onerror):r)}}function Yg(e,t){return e===re?t:function(n){var r=e.apply(this,arguments);Pe(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?un(i,this.onsuccess):i),o&&(this.onerror=this.onerror?un(o,this.onerror):o),r===void 0?a===void 0?void 0:a:Pe(r,a)}}function Qg(e,t){return e===re?t:function(){return t.apply(this,arguments)===!1?!1:e.apply(this,arguments)}}function Ya(e,t){return e===re?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 pr={},Xg=100,Jg=20,Sc=100,Qa=typeof Promise>"u"?[]:function(){var e=Promise.resolve();if(typeof crypto>"u"||!crypto.subtle)return[e,fr(e),e];var t=crypto.subtle.digest("SHA-512",new Uint8Array([0]));return[t,fr(t),e]}(),Wo=Qa[0],bi=Qa[1],qo=Qa[2],kc=bi&&bi.then,Jr=Wo&&Wo.constructor,Xa=!!qo,$o=!1,ev=qo?function(){qo.then(zr)}:oe.setImmediate?setImmediate.bind(null,zr):oe.MutationObserver?function(){var e=document.createElement("div");new MutationObserver(function(){zr(),e=null}).observe(e,{attributes:!0}),e.setAttribute("i","1")}:function(){setTimeout(zr,0)},hr=function(e,t){Jn.push([e,t]),wi&&(ev(),wi=!1)},Zo=!0,wi=!0,an=[],ei=[],Yo=null,Qo=xr,Tn={id:"global",global:!0,ref:0,unhandleds:[],onunhandled:ul,pgp:!1,env:{},finalize:function(){this.unhandleds.forEach(function(e){try{ul(e[0],e[1])}catch{}})}},M=Tn,Jn=[],sn=0,ti=[];function U(e){if(typeof this!="object")throw new TypeError("Promises must be constructed via new");this._listeners=[],this.onuncatched=re,this._lib=!1;var t=this._PSD=M;if(mt&&(this._stackHolder=pn(),this._prev=null,this._numPrev=0),typeof e!="function"){if(e!==pr)throw new TypeError("Not a function");this._state=arguments[1],this._value=arguments[2],this._state===!1&&Jo(this,this._value);return}this._state=null,this._value=null,++t.ref,Ac(this,e)}var Xo={get:function(){var e=M,t=Ci;function n(r,i){var o=this,a=!e.global&&(e!==M||t!==Ci),s=a&&!At(),l=new U(function(u,c){Ja(o,new xc(Ei(r,e,a,s),Ei(i,e,a,s),u,c,e))});return mt&&Lc(l,this),l}return n.prototype=pr,n},set:function(e){xt(this,"then",e&&e.prototype===pr?Xo:{get:function(){return e},set:Xo.set})}};Un(U.prototype,{then:Xo,_then:function(e,t){Ja(this,new xc(null,null,e,t,M))},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):ni(r)}):this.then(null,function(r){return r&&r.name===t?n(r):ni(r)})},finally:function(e){return this.then(function(t){return e(),t},function(t){return e(),ni(t)})},stack:{get:function(){if(this._stack)return this._stack;try{$o=!0;var e=Rc(this,[],Jg),t=e.join(`
36
- From previous: `);return this._state!==null&&(this._stack=t),t}finally{$o=!1}}},timeout:function(e,t){var n=this;return e<1/0?new U(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&&xt(U.prototype,Symbol.toStringTag,"Dexie.Promise");Tn.env=Oc();function xc(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}Un(U,{all:function(){var e=_t.apply(null,arguments).map(Ii);return new U(function(t,n){e.length===0&&t([]);var r=e.length;e.forEach(function(i,o){return U.resolve(i).then(function(a){e[o]=a,--r||t(e)},n)})})},resolve:function(e){if(e instanceof U)return e;if(e&&typeof e.then=="function")return new U(function(n,r){e.then(n,r)});var t=new U(pr,!0,e);return Lc(t,Yo),t},reject:ni,race:function(){var e=_t.apply(null,arguments).map(Ii);return new U(function(t,n){e.map(function(r){return U.resolve(r).then(t,n)})})},PSD:{get:function(){return M},set:function(e){return M=e}},totalEchoes:{get:function(){return Ci}},newPSD:Ht,usePSD:Gn,scheduler:{get:function(){return hr},set:function(e){hr=e}},rejectionMapper:{get:function(){return Qo},set:function(e){Qo=e}},follow:function(e,t){return new U(function(n,r){return Ht(function(i,o){var a=M;a.unhandleds=[],a.onunhandled=o,a.finalize=un(function(){var s=this;nv(function(){s.unhandleds.length===0?i():o(s.unhandleds[0])})},a.finalize),e()},t,n,r)})}});Jr&&(Jr.allSettled&&xt(U,"allSettled",function(){var e=_t.apply(null,arguments).map(Ii);return new U(function(t){e.length===0&&t([]);var n=e.length,r=new Array(n);e.forEach(function(i,o){return U.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)})})})}),Jr.any&&typeof AggregateError<"u"&&xt(U,"any",function(){var e=_t.apply(null,arguments).map(Ii);return new U(function(t,n){e.length===0&&n(new AggregateError([]));var r=e.length,i=new Array(r);e.forEach(function(o,a){return U.resolve(o).then(function(s){return t(s)},function(s){i[a]=s,--r||n(new AggregateError(i))})})})}));function Ac(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&&Ar();n&&typeof n.then=="function"?Ac(e,function(i,o){n instanceof U?n._then(i,o):n.then(i,o)}):(e._state=!0,e._value=n,Tc(e)),r&&Tr()}},Jo.bind(null,e))}catch(n){Jo(e,n)}}function Jo(e,t){if(ei.push(t),e._state===null){var n=e._lib&&Ar();t=Qo(t),e._state=!1,e._value=t,mt&&t!==null&&typeof t=="object"&&!t._promise&&Pg(function(){var r=Wa(t,"stack");t._promise=e,xt(t,"stack",{get:function(){return $o?r&&(r.get?r.get.apply(t):r.value):e.stack}})}),rv(e),Tc(e),n&&Tr()}}function Tc(e){var t=e._listeners;e._listeners=[];for(var n=0,r=t.length;n<r;++n)Ja(e,t[n]);var i=e._PSD;--i.ref||i.finalize(),sn===0&&(++sn,hr(function(){--sn===0&&es()},[]))}function Ja(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,++sn,hr(tv,[n,e,t])}function tv(e,t,n){try{Yo=t;var r,i=t._value;t._state?r=e(i):(ei.length&&(ei=[]),r=e(i),ei.indexOf(i)===-1&&iv(t)),n.resolve(r)}catch(o){n.reject(o)}finally{Yo=null,--sn===0&&es(),--n.psd.ref||n.psd.finalize()}}function Rc(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=Go(i,0)):(o=i,a=""),t.push(o+(a?": "+a:"")+r)}return mt&&(r=Go(e._stackHolder,2),r&&t.indexOf(r)===-1&&t.push(r),e._prev&&Rc(e._prev,t,n)),t}function Lc(e,t){var n=t?t._numPrev+1:0;n<Xg&&(e._prev=t,e._numPrev=n)}function zr(){Ar()&&Tr()}function Ar(){var e=Zo;return Zo=!1,wi=!1,e}function Tr(){var e,t,n;do for(;Jn.length>0;)for(e=Jn,Jn=[],n=e.length,t=0;t<n;++t){var r=e[t];r[0].apply(null,r[1])}while(Jn.length>0);Zo=!0,wi=!0}function es(){var e=an;an=[],e.forEach(function(r){r._PSD.onunhandled.call(null,r._value,r)});for(var t=ti.slice(0),n=t.length;n;)t[--n]()}function nv(e){function t(){e(),ti.splice(ti.indexOf(t),1)}ti.push(t),++sn,hr(function(){--sn===0&&es()},[])}function rv(e){an.some(function(t){return t._value===e._value})||an.push(e)}function iv(e){for(var t=an.length;t;)if(an[--t]._value===e._value){an.splice(t,1);return}}function ni(e){return new U(pr,!1,e)}function le(e,t){var n=M;return function(){var r=Ar(),i=M;try{return zt(n,!0),e.apply(this,arguments)}catch(o){t&&t(o)}finally{zt(i,!1),r&&Tr()}}}var Te={awaits:0,echoes:0,id:0},ov=0,ri=[],uo=0,Ci=0,av=0;function Ht(e,t,n,r){var i=M,o=Object.create(i);o.parent=i,o.ref=0,o.global=!1,o.id=++av;var a=Tn.env;o.env=Xa?{Promise:U,PromiseProp:{value:U,configurable:!0,writable:!0},all:U.all,race:U.race,allSettled:U.allSettled,any:U.any,resolve:U.resolve,reject:U.reject,nthen:sl(a.nthen,o),gthen:sl(a.gthen,o)}:{},t&&Pe(o,t),++i.ref,o.finalize=function(){--this.parent.ref||this.parent.finalize()};var s=Gn(o,e,n,r);return o.ref===0&&o.finalize(),s}function Kn(){return Te.id||(Te.id=++ov),++Te.awaits,Te.echoes+=Sc,Te.id}function At(){return Te.awaits?(--Te.awaits===0&&(Te.id=0),Te.echoes=Te.awaits*Sc,!0):!1}(""+kc).indexOf("[native code]")===-1&&(Kn=At=re);function Ii(e){return Te.echoes&&e&&e.constructor===Jr?(Kn(),e.then(function(t){return At(),t},function(t){return At(),we(t)})):e}function sv(e){++Ci,(!Te.echoes||--Te.echoes===0)&&(Te.echoes=Te.id=0),ri.push(M),zt(e,!0)}function lv(){var e=ri[ri.length-1];ri.pop(),zt(e,!1)}function zt(e,t){var n=M;if((t?Te.echoes&&(!uo++||e!==M):uo&&(!--uo||e!==M))&&Nc(t?sv.bind(null,e):lv),e!==M&&(M=e,n===Tn&&(Tn.env=Oc()),Xa)){var r=Tn.env.Promise,i=e.env;bi.then=i.nthen,r.prototype.then=i.gthen,(n.global||e.global)&&(Object.defineProperty(oe,"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 Oc(){var e=oe.Promise;return Xa?{Promise:e,PromiseProp:Object.getOwnPropertyDescriptor(oe,"Promise"),all:e.all,race:e.race,allSettled:e.allSettled,any:e.any,resolve:e.resolve,reject:e.reject,nthen:bi.then,gthen:e.prototype.then}:{}}function Gn(e,t,n,r,i){var o=M;try{return zt(e,!0),t(n,r,i)}finally{zt(o,!1)}}function Nc(e){kc.call(Wo,e)}function Ei(e,t,n,r){return typeof e!="function"?e:function(){var i=M;n&&Kn(),zt(t,!0);try{return e.apply(this,arguments)}finally{zt(i,!1),r&&Nc(At)}}}function sl(e,t){return function(n,r){return e.call(this,Ei(n,t),Ei(r,t))}}var ll="unhandledrejection";function ul(e,t){var n;try{n=t.onuncatched(e)}catch{}if(n!==!1)try{var r,i={promise:t,reason:e};if(oe.document&&document.createEvent?(r=document.createEvent("Event"),r.initEvent(ll,!0,!0),Pe(r,i)):oe.CustomEvent&&(r=new CustomEvent(ll,{detail:i}),Pe(r,i)),r&&oe.dispatchEvent&&(dispatchEvent(r),!oe.PromiseRejectionEvent&&oe.onunhandledrejection))try{oe.onunhandledrejection(r)}catch{}mt&&r&&!r.defaultPrevented&&console.warn("Unhandled rejection: "+(e.stack||e))}catch{}}var we=U.reject;function ea(e,t,n,r){if(!e.idbdb||!e._state.openComplete&&!M.letThrough&&!e._vip){if(e._state.openComplete)return we(new V.DatabaseClosed(e._state.dbOpenError));if(!e._state.isBeingOpened){if(!e._options.autoOpen)return we(new V.DatabaseClosed);e.open().catch(re)}return e._state.dbReadyPromise.then(function(){return ea(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===Za.InvalidState&&e.isOpen()&&--e._state.PR1398_maxLoop>0?(console.warn("Dexie: Need to reopen db"),e._close(),e.open().then(function(){return ea(e,t,n,r)})):we(o)}return i._promise(t,function(o,a){return Ht(function(){return M.trans=i,r(o,a,i)})}).then(function(o){return i._completion.then(function(){return o})})}}var cl="3.2.3",nn=String.fromCharCode(65535),ta=-1/0,vt="Invalid key provided. Keys must be of type string, number, Date or Array<string | number | Date>.",Dc="String expected.",or=[],zi=typeof navigator<"u"&&/(MSIE|Trident|Edge)/.test(navigator.userAgent),uv=zi,cv=zi,Uc=function(e){return!/(dexie\.js|dexie\.min\.js)/.test(e)},Ki="__dbnames",co="readonly",fo="readwrite";function cn(e,t){return e?t?function(){return e.apply(this,arguments)&&t.apply(this,arguments)}:e:t}var Pc={type:3,lower:-1/0,lowerOpen:!1,upper:[[]],upperOpen:!1};function Kr(e){return typeof e=="string"&&!/\./.test(e)?function(t){return t[e]===void 0&&e in t&&(t=kr(t),delete t[e]),t}:function(t){return t}}var dv=function(){function e(){}return e.prototype._trans=function(t,n,r){var i=this._tx||M.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=Ar();try{return i&&i.db===this.db?i===M.trans?i._promise(t,a,r):Ht(function(){return i._promise(t,a,r)},{trans:i,transless:M.transless||M}):ea(this.db,t,[this.name],a)}finally{s&&Tr()}},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(Re(t))return new this.db.WhereClause(this,"["+t.join("+")+"]");var n=ge(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!==nn)return this.where(r.name).equals(r.keyPath.map(function(c){return t[c]}));!r&&mt&&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],m=t[d];return[f||h,f||!h?cn(p,h&&h.multi?function(g){var _=St(g,d);return Re(_)&&_.some(function(v){return a(m,v)})}:function(g){return a(m,St(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,Re(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(je(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){Pe(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=Kr(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?U.reject(l.failures[0]):l.lastResult}).then(function(l){if(a)try{Je(t,a,l)}catch{}return l})},e.prototype.update=function(t,n){if(typeof t=="object"&&!Re(t)){var r=St(t,this.schema.primKey.keyPath);if(r===void 0)return we(new V.InvalidArgument("Given object does not contain its primary key"));try{typeof n!="function"?ge(n).forEach(function(i){Je(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=Kr(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?U.reject(l.failures[0]):l.lastResult}).then(function(l){if(a)try{Je(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?U.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:Pc})}).then(function(n){return n.numFailures?U.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(Kr(c)):t;return i.core.mutate({trans:s,type:"add",keys:o,values:f,wantResults:a}).then(function(p){var h=p.numFailures,m=p.results,g=p.lastResult,_=p.failures,v=a?m:g;if(h===0)return v;throw new ir(i.name+".bulkAdd(): "+h+" 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(Kr(c)):t;return i.core.mutate({trans:s,type:"put",keys:o,values:f,wantResults:a}).then(function(p){var h=p.numFailures,m=p.results,g=p.lastResult,_=p.failures,v=a?m:g;if(h===0)return v;throw new ir(i.name+".bulkPut(): "+h+" 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 ir(n.name+".bulkDelete(): "+o+" of "+r+" operations failed",s)})},e}();function Rr(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=Qg),u||(u=re);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){ge(s).forEach(function(l){var u=s[l];if(Re(u))o(l,s[l][0],s[l][1]);else if(u==="asap")var c=o(l,xr,function(){for(var f=arguments.length,p=new Array(f);f--;)p[f]=arguments[f];c.subscribers.forEach(function(h){gc(function(){h.apply(null,p)})})});else throw new V.InvalidArgument("Invalid event config")})}}function Lr(e,t){return Hn(t).from({prototype:e}),t}function fv(e){return Lr(dv.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:Rr(null,{creating:[$g,re],reading:[qg,xr],updating:[Yg,re],deleting:[Zg,re]})})}function yn(e,t){return!(e.filter||e.algorithm||e.or)&&(t?e.justLimit:!e.replayFilter)}function po(e,t){e.filter=cn(e.filter,t)}function ho(e,t,n){var r=e.replayFilter;e.replayFilter=r?function(){return cn(r(),t())}:t,e.justLimit=n&&!r}function pv(e,t){e.isMatch=cn(e.isMatch,t)}function ii(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 dl(e,t,n){var r=ii(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 Gr(e,t,n,r){var i=e.replayFilter?cn(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)),je(o,d)||(o[d]=!0,t(s,l,u))}};return Promise.all([e.or._iterate(a,n),fl(dl(e,r,n),e.algorithm,a,!e.keysOnly&&e.valueMapper)])}else return fl(dl(e,r,n),cn(e.algorithm,i),t,!e.keysOnly&&e.valueMapper)}function fl(e,t,n,r){var i=r?function(a,s,l){return n(r(a),s,l)}:n,o=le(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=re},function(l){a.fail(l),s=re}))&&o(a.value,a,function(l){return s=l}),s()})})}function Ue(e,t){try{var n=pl(e),r=pl(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 mv(hl(e),hl(t));case"Array":return hv(e,t)}}catch{}return NaN}function hv(e,t){for(var n=e.length,r=t.length,i=n<r?n:r,o=0;o<i;++o){var a=Ue(e[o],t[o]);if(a!==0)return a}return n===r?0:n<r?-1:1}function mv(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 pl(e){var t=typeof e;if(t!=="object")return t;if(ArrayBuffer.isView(e))return"binary";var n=zo(e);return n==="ArrayBuffer"?"binary":n}function hl(e){return e instanceof Uint8Array?e:ArrayBuffer.isView(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):new Uint8Array(e)}var gv=function(){function e(){}return e.prototype._read=function(t,n){var r=this._ctx;return r.error?r.table._trans(null,we.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,we.bind(null,n.error)):n.table._trans("readwrite",t,"locked")},e.prototype._addAlgorithm=function(t){var n=this._ctx;n.algorithm=cn(n.algorithm,t)},e.prototype._iterate=function(t,n){return Gr(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&&Pe(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 Gr(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(yn(i,!0))return o.count({trans:r,query:{index:ii(i,o.schema),range:i.range}}).then(function(s){return Math.min(s,i.limit)});var a=0;return Gr(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"&&yn(i,!0)&&i.limit>0){var o=i.valueMapper,a=ii(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 Gr(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,yn(n)?ho(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)}}):ho(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),ho(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 po(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 po(this._ctx,function(n){return t(n.value)}),pv(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"&&yn(n,!0)&&n.limit>0)return this._read(function(i){var o=ii(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 po(this._ctx,function(i){var o=i.primaryKey.toString(),a=je(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=ge(t),s=a.length;o=function(_){for(var v=!1,b=0;b<s;++b){var y=a[b],C=t[y];St(_,y)!==C&&(Je(_,y,C),v=!0)}return v}}var l=r.table.core,u=l.schema.primaryKey,c=u.outbound,d=u.extractKey,f=n.db._options.modifyChunkSize||200,p=[],h=0,m=[],g=function(_,v){var b=v.failures,y=v.numFailures;h+=_-y;for(var C=0,S=ge(b);C<S.length;C++){var E=S[C];p.push(b[E])}};return n.clone().primaryKeys().then(function(_){var v=function(b){var y=Math.min(f,_.length-b);return l.getMany({trans:i,keys:_.slice(b,b+y),cache:"immutable"}).then(function(C){for(var S=[],E=[],I=c?[]:null,x=[],R=0;R<y;++R){var T=C[R],O={value:kr(T),primKey:_[b+R]};o.call(O,O.value,O)!==!1&&(O.value==null?x.push(_[b+R]):!c&&Ue(d(T),d(O.value))!==0?(x.push(_[b+R]),S.push(O.value)):(E.push(O.value),c&&I.push(_[b+R])))}var k=yn(r)&&r.limit===1/0&&(typeof t!="function"||t===mo)&&{index:r.index,range:r.range};return Promise.resolve(S.length>0&&l.mutate({trans:i,type:"add",values:S}).then(function(N){for(var A in N.failures)x.splice(parseInt(A),1);g(S.length,N)})).then(function(){return(E.length>0||k&&typeof t=="object")&&l.mutate({trans:i,type:"put",keys:I,values:E,criteria:k,changeSpec:typeof t!="function"&&t}).then(function(N){return g(E.length,N)})}).then(function(){return(x.length>0||k&&t===mo)&&l.mutate({trans:i,type:"delete",keys:x,criteria:k}).then(function(N){return g(x.length,N)})}).then(function(){return _.length>b+y&&v(b+f)})})};return v(0).then(function(){if(p.length>0)throw new _i("Error modifying one or more objects",p,h,m);return _.length})})})},e.prototype.delete=function(){var t=this._ctx,n=t.range;return yn(t)&&(t.isPrimKey&&!cv||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 _i("Could not delete some values",Object.keys(l).map(function(c){return l[c]}),a-u);return a-u})})}):this.modify(mo)},e}(),mo=function(e,t){return t.value=null};function vv(e){return Lr(gv.prototype,function(n,r){this.db=e;var i=Pc,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!==xr?l:null}})}function yv(e,t){return e<t?-1:e===t?0:1}function _v(e,t){return e>t?-1:e===t?0:1}function Fe(e,t,n){var r=e instanceof Fc?new e.Collection(e):e;return r._ctx.error=n?new n(t):new TypeError(t),r}function _n(e){return new e.Collection(e,function(){return Mc("")}).limit(0)}function bv(e){return e==="next"?function(t){return t.toUpperCase()}:function(t){return t.toLowerCase()}}function wv(e){return e==="next"?function(t){return t.toLowerCase()}:function(t){return t.toUpperCase()}}function Cv(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 Wr(e,t,n,r){var i,o,a,s,l,u,c,d=n.length;if(!n.every(function(m){return typeof m=="string"}))return Fe(e,Dc);function f(m){i=bv(m),o=wv(m),a=m==="next"?yv:_v;var g=n.map(function(_){return{lower:o(_),upper:i(_)}}).sort(function(_,v){return a(_.lower,v.lower)});s=g.map(function(_){return _.upper}),l=g.map(function(_){return _.lower}),u=m,c=m==="next"?"":r}f("next");var p=new e.Collection(e,function(){return Lt(s[0],l[d-1]+r)});p._ondirectionchange=function(m){f(m)};var h=0;return p._addAlgorithm(function(m,g,_){var v=m.key;if(typeof v!="string")return!1;var b=o(v);if(t(b,l,h))return!0;for(var y=null,C=h;C<d;++C){var S=Cv(v,b,s[C],l[C],a,u);S===null&&y===null?h=C+1:(y===null||a(y,S)>0)&&(y=S)}return g(y!==null?function(){m.continue(y+c)}:_),!1}),p}function Lt(e,t,n,r){return{type:2,lower:e,upper:t,lowerOpen:n,upperOpen:r}}function Mc(e){return{type:1,lower:e,upper:e}}var Fc=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)?_n(this):new this.Collection(this,function(){return Lt(t,n,!r,!i)})}catch{return Fe(this,vt)}},e.prototype.equals=function(t){return t==null?Fe(this,vt):new this.Collection(this,function(){return Mc(t)})},e.prototype.above=function(t){return t==null?Fe(this,vt):new this.Collection(this,function(){return Lt(t,void 0,!0)})},e.prototype.aboveOrEqual=function(t){return t==null?Fe(this,vt):new this.Collection(this,function(){return Lt(t,void 0,!1)})},e.prototype.below=function(t){return t==null?Fe(this,vt):new this.Collection(this,function(){return Lt(void 0,t,!1,!0)})},e.prototype.belowOrEqual=function(t){return t==null?Fe(this,vt):new this.Collection(this,function(){return Lt(void 0,t)})},e.prototype.startsWith=function(t){return typeof t!="string"?Fe(this,Dc):this.between(t,t+nn,!0,!0)},e.prototype.startsWithIgnoreCase=function(t){return t===""?this.startsWith(t):Wr(this,function(n,r){return n.indexOf(r[0])===0},[t],nn)},e.prototype.equalsIgnoreCase=function(t){return Wr(this,function(n,r){return n===r[0]},[t],"")},e.prototype.anyOfIgnoreCase=function(){var t=_t.apply(Cn,arguments);return t.length===0?_n(this):Wr(this,function(n,r){return r.indexOf(n)!==-1},t,"")},e.prototype.startsWithAnyOfIgnoreCase=function(){var t=_t.apply(Cn,arguments);return t.length===0?_n(this):Wr(this,function(n,r){return r.some(function(i){return n.indexOf(i)===0})},t,nn)},e.prototype.anyOf=function(){var t=this,n=_t.apply(Cn,arguments),r=this._cmp;try{n.sort(r)}catch{return Fe(this,vt)}if(n.length===0)return _n(this);var i=new this.Collection(this,function(){return Lt(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([[ta,t],[t,this.db._maxKey]],{includeLowers:!1,includeUppers:!1})},e.prototype.noneOf=function(){var t=_t.apply(Cn,arguments);if(t.length===0)return new this.Collection(this);try{t.sort(this._ascending)}catch{return Fe(this,vt)}var n=t.reduce(function(r,i){return r?r.concat([[r[r.length-1][1],i]]):[[ta,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 _n(this);if(!t.every(function(C){return C[0]!==void 0&&C[1]!==void 0&&o(C[0],C[1])<=0}))return Fe(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(C,S){for(var E=0,I=C.length;E<I;++E){var x=C[E];if(i(S[0],x[1])<0&&i(S[1],x[0])>0){x[0]=s(x[0],S[0]),x[1]=l(x[1],S[1]);break}}return E===I&&C.push(S),C}var f=o;function p(C,S){return f(C[0],S[0])}var h;try{h=t.reduce(d,[]),h.sort(p)}catch{return Fe(this,vt)}var m=0,g=c?function(C){return o(C,h[m][1])>0}:function(C){return o(C,h[m][1])>=0},_=u?function(C){return a(C,h[m][0])>0}:function(C){return a(C,h[m][0])>=0};function v(C){return!g(C)&&!_(C)}var b=g,y=new this.Collection(this,function(){return Lt(h[0][0],h[h.length-1][1],!u,!c)});return y._ondirectionchange=function(C){C==="next"?(b=g,f=o):(b=_,f=a),h.sort(p)},y._addAlgorithm(function(C,S,E){for(var I=C.key;b(I);)if(++m,m===h.length)return S(E),!1;return v(I)?!0:(r._cmp(I,h[m][1])===0||r._cmp(I,h[m][0])===0||S(function(){f===o?C.continue(h[m][0]):C.continue(h[m][1])}),!1)}),y},e.prototype.startsWithAnyOf=function(){var t=_t.apply(Cn,arguments);return t.every(function(n){return typeof n=="string"})?t.length===0?_n(this):this.inAnyRange(t.map(function(n){return[n,n+nn]})):Fe(this,"startsWithAnyOf() only works with strings")},e}();function Iv(e){return Lr(Fc.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 ot(e){return le(function(t){return mr(t),e(t.target.error),!1})}function mr(e){e.stopPropagation&&e.stopPropagation(),e.preventDefault&&e.preventDefault()}var gr="storagemutated",Mt="x-storagemutated-1",Kt=Rr(null,gr),Ev=function(){function e(){}return e.prototype._lock=function(){return Xn(!M.global),++this._reculock,this._reculock===1&&!M.global&&(M.lockOwnerFor=this),this},e.prototype._unlock=function(){if(Xn(!M.global),--this._reculock===0)for(M.global||(M.lockOwnerFor=null);this._blockedFuncs.length>0&&!this._locked();){var t=this._blockedFuncs.shift();try{Gn(t[1],t[0])}catch{}}return this},e.prototype._locked=function(){return this._reculock&&M.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(Xn(!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 Xn(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=le(function(o){mr(o),n._reject(t.error)}),t.onabort=le(function(o){mr(o),n.active&&n._reject(new V.Abort(t.error)),n.active=!1,n.on("abort").fire(o)}),t.oncomplete=le(function(){n.active=!1,n._resolve(),"mutatedParts"in t&&Kt.storagemutated.fire(t.mutatedParts)}),this},e.prototype._promise=function(t,n,r){var i=this;if(t==="readwrite"&&this.mode!=="readwrite")return we(new V.ReadOnly("Transaction is readonly"));if(!this.active)return we(new V.TransactionInactive);if(this._locked())return new U(function(a,s){i._blockedFuncs.push([function(){i._promise(t,n,r).then(a,s)},M])});if(r)return Ht(function(){var a=new U(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 U(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=U.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 U(function(a,s){r.then(function(l){return n._waitingQueue.push(le(a.bind(null,l)))},function(l){return n._waitingQueue.push(le(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(je(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 Sv(e){return Lr(Ev.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=Rr(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 U(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(),we(l)})})}function na(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?"++":"")+Vc(t)}}function Vc(e){return typeof e=="string"?e:e?"["+[].join.call(e,"+")+"]":""}function Bc(e,t,n){return{name:e,primKey:t,indexes:n,mappedClass:null,idxByName:vc(n,function(r){return[r.name,r]})}}function kv(e){return e.length===1?e[0]:e}var vr=function(e){try{return e.only([[]]),vr=function(){return[[]]},[[]]}catch{return vr=function(){return nn},nn}};function ra(e){return e==null?function(){}:typeof e=="string"?xv(e):function(t){return St(t,e)}}function xv(e){var t=e.split(".");return t.length===1?function(n){return n[e]}:function(n){return St(n,e)}}function ml(e){return[].slice.call(e)}var Av=0;function ar(e){return e==null?":id":typeof e=="string"?e:"["+e.join("+")+"]"}function Tv(e,t,n){function r(d,f){var p=ml(d.objectStoreNames);return{schema:{name:d.name,tables:p.map(function(h){return f.objectStore(h)}).map(function(h){var m=h.keyPath,g=h.autoIncrement,_=Re(m),v=m==null,b={},y={name:h.name,primaryKey:{name:null,isPrimaryKey:!0,outbound:v,compound:_,keyPath:m,autoIncrement:g,unique:!0,extractKey:ra(m)},indexes:ml(h.indexNames).map(function(C){return h.index(C)}).map(function(C){var S=C.name,E=C.unique,I=C.multiEntry,x=C.keyPath,R=Re(x),T={name:S,compound:R,keyPath:x,unique:E,multiEntry:I,extractKey:ra(x)};return b[ar(x)]=T,T}),getIndexByKeyPath:function(C){return b[ar(C)]}};return b[":id"]=y.primaryKey,m!=null&&(b[ar(m)]=y.primaryKey),y})},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,m=d.upperOpen,g=f===void 0?p===void 0?null:t.upperBound(p,!!m):p===void 0?t.lowerBound(f,!!h):t.bound(f,p,!!h,!!m);return g}function o(d){var f=d.name;function p(g){var _=g.trans,v=g.type,b=g.keys,y=g.values,C=g.range;return new Promise(function(S,E){S=le(S);var I=_.objectStore(f),x=I.keyPath==null,R=v==="put"||v==="add";if(!R&&v!=="delete"&&v!=="deleteRange")throw new Error("Invalid operation type: "+v);var T=(b||y||{length:1}).length;if(b&&y&&b.length!==y.length)throw new Error("Given keys array must have same length as given values array.");if(T===0)return S({numFailures:0,failures:{},results:[],lastResult:void 0});var O,k=[],N=[],A=0,B=function(Z){++A,mr(Z)};if(v==="deleteRange"){if(C.type===4)return S({numFailures:A,failures:N,results:[],lastResult:void 0});C.type===3?k.push(O=I.clear()):k.push(O=I.delete(i(C)))}else{var J=R?x?[y,b]:[y,null]:[b,null],se=J[0],ce=J[1];if(R)for(var te=0;te<T;++te)k.push(O=ce&&ce[te]!==void 0?I[v](se[te],ce[te]):I[v](se[te])),O.onerror=B;else for(var te=0;te<T;++te)k.push(O=I[v](se[te])),O.onerror=B}var Ee=function(Z){var $e=Z.target.result;k.forEach(function(de,Le){return de.error!=null&&(N[Le]=de.error)}),S({numFailures:A,failures:N,results:v==="delete"?b:k.map(function(de){return de.result}),lastResult:$e})};O.onerror=function(Z){B(Z),Ee(Z)},O.onsuccess=Ee})}function h(g){var _=g.trans,v=g.values,b=g.query,y=g.reverse,C=g.unique;return new Promise(function(S,E){S=le(S);var I=b.index,x=b.range,R=_.objectStore(f),T=I.isPrimaryKey?R:R.index(I.name),O=y?C?"prevunique":"prev":C?"nextunique":"next",k=v||!("openKeyCursor"in T)?T.openCursor(i(x),O):T.openKeyCursor(i(x),O);k.onerror=ot(E),k.onsuccess=le(function(N){var A=k.result;if(!A){S(null);return}A.___id=++Av,A.done=!1;var B=A.continue.bind(A),J=A.continuePrimaryKey;J&&(J=J.bind(A));var se=A.advance.bind(A),ce=function(){throw new Error("Cursor not started")},te=function(){throw new Error("Cursor not stopped")};A.trans=_,A.stop=A.continue=A.continuePrimaryKey=A.advance=ce,A.fail=le(E),A.next=function(){var Ee=this,Z=1;return this.start(function(){return Z--?Ee.continue():Ee.stop()}).then(function(){return Ee})},A.start=function(Ee){var Z=new Promise(function(de,Le){de=le(de),k.onerror=ot(Le),A.fail=Le,A.stop=function(rt){A.stop=A.continue=A.continuePrimaryKey=A.advance=te,de(rt)}}),$e=function(){if(k.result)try{Ee()}catch(de){A.fail(de)}else A.done=!0,A.start=function(){throw new Error("Cursor behind last entry")},A.stop()};return k.onsuccess=le(function(de){k.onsuccess=$e,$e()}),A.continue=B,A.continuePrimaryKey=J,A.advance=se,$e(),Z},S(A)},E)})}function m(g){return function(_){return new Promise(function(v,b){v=le(v);var y=_.trans,C=_.values,S=_.limit,E=_.query,I=S===1/0?void 0:S,x=E.index,R=E.range,T=y.objectStore(f),O=x.isPrimaryKey?T:T.index(x.name),k=i(R);if(S===0)return v({result:[]});if(g){var N=C?O.getAll(k,I):O.getAllKeys(k,I);N.onsuccess=function(se){return v({result:se.target.result})},N.onerror=ot(b)}else{var A=0,B=C||!("openKeyCursor"in O)?O.openCursor(k):O.openKeyCursor(k),J=[];B.onsuccess=function(se){var ce=B.result;if(!ce)return v({result:J});if(J.push(C?ce.value:ce.primaryKey),++A===S)return v({result:J});ce.continue()},B.onerror=ot(b)}})}}return{name:f,schema:d,mutate:p,getMany:function(g){var _=g.trans,v=g.keys;return new Promise(function(b,y){b=le(b);for(var C=_.objectStore(f),S=v.length,E=new Array(S),I=0,x=0,R,T=function(A){var B=A.target;(E[B._pos]=B.result)!=null,++x===I&&b(E)},O=ot(y),k=0;k<S;++k){var N=v[k];N!=null&&(R=C.get(v[k]),R._pos=k,R.onsuccess=T,R.onerror=O,++I)}I===0&&b(E)})},get:function(g){var _=g.trans,v=g.key;return new Promise(function(b,y){b=le(b);var C=_.objectStore(f),S=C.get(v);S.onsuccess=function(E){return b(E.target.result)},S.onerror=ot(y)})},query:m(l),openCursor:h,count:function(g){var _=g.query,v=g.trans,b=_.index,y=_.range;return new Promise(function(C,S){var E=v.objectStore(f),I=b.isPrimaryKey?E:E.index(b.name),x=i(y),R=x?I.count(x):I.count();R.onsuccess=le(function(T){return C(T.target.result)}),R.onerror=ot(S)})}}}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:vr(t),schema:s}}function Rv(e,t){return t.reduce(function(n,r){var i=r.create;return G(G({},n),i(n))},e)}function Lv(e,t,n,r){var i=n.IDBKeyRange;n.indexedDB;var o=Rv(Tv(t,i,r),e.dbcore);return{dbcore:o}}function ts(e,t){var n=e._novip,r=t.db,i=Lv(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 Si(e,t,n,r){var i=e._novip;n.forEach(function(o){var a=r[o];t.forEach(function(s){var l=Wa(s,o);(!l||"value"in l&&l.value===void 0)&&(s===i.Transaction.prototype||s instanceof i.Transaction?xt(s,o,{get:function(){return this.table(o)},set:function(u){hc(this,o,{value:u,writable:!0,configurable:!0,enumerable:!0})}}):s[o]=new i.Table(o,a))})})}function ia(e,t){var n=e._novip;t.forEach(function(r){for(var i in r)r[i]instanceof n.Table&&delete r[i]})}function Ov(e,t){return e._cfg.version-t._cfg.version}function Nv(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=M.transless||M;Ht(function(){M.trans=o,M.transless=s,t===0?(ge(i).forEach(function(l){ns(n,l,i[l].primKey,i[l].indexes)}),ts(e,n),U.follow(function(){return e.on.populate.fire(o)}).catch(a)):Dv(e,t,o,n).catch(a)})}function Dv(e,t,n,r){var i=e._novip,o=[],a=i._versions,s=i._dbSchema=rs(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;aa(i,f,r),aa(i,p,r),s=i._dbSchema=p;var h=jc(f,p);h.add.forEach(function(y){ns(r,y[0],y[1].primKey,y[1].indexes)}),h.change.forEach(function(y){if(y.recreate)throw new V.Upgrade("Not yet support for changing primary key");var C=r.objectStore(y.name);y.add.forEach(function(S){return oa(C,S)}),y.change.forEach(function(S){C.deleteIndex(S.name),oa(C,S)}),y.del.forEach(function(S){return C.deleteIndex(S)})});var m=d._cfg.contentUpgrade;if(m&&d._cfg.version>t){ts(i,r),n._memoizedTables={},l=!0;var g=yc(p);h.del.forEach(function(y){g[y]=f[y]}),ia(i,[i.Transaction.prototype]),Si(i,[i.Transaction.prototype],ge(g),g),n.schema=g;var _=qa(m);_&&Kn();var v,b=U.follow(function(){if(v=m(n),v&&_){var y=At.bind(null,null);v.then(y,y)}});return v&&typeof v.then=="function"?U.resolve(v):b.then(function(){return v})}}),o.push(function(f){if(!l||!uv){var p=d._cfg.dbschema;Pv(p,f)}ia(i,[i.Transaction.prototype]),Si(i,[i.Transaction.prototype],i._storeNames,i._dbSchema),n.schema=i._dbSchema})});function c(){return o.length?U.resolve(o.shift()(n.idbtrans)).then(c):U.resolve()}return c().then(function(){Uv(s,r)})}function jc(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&&!zi)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 ns(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 oa(i,o)}),i}function Uv(e,t){ge(e).forEach(function(n){t.db.objectStoreNames.contains(n)||ns(t,n,e[n].primKey,e[n].indexes)})}function Pv(e,t){[].slice.call(t.db.objectStoreNames).forEach(function(n){return e[n]==null&&t.db.deleteObjectStore(n)})}function oa(e,t){e.createIndex(t.name,t.keyPath,{unique:t.unique,multiEntry:t.multi})}function rs(e,t,n){var r={},i=ji(t.objectStoreNames,0);return i.forEach(function(o){for(var a=n.objectStore(o),s=a.keyPath,l=na(Vc(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=na(d.name,s,!!d.unique,!!d.multiEntry,!1,s&&typeof s!="string",!1);u.push(f)}r[o]=Bc(o,l,u)}),r}function Mv(e,t,n){var r=e._novip;r.verno=t.version/10;var i=r._dbSchema=rs(r,t,n);r._storeNames=ji(t.objectStoreNames,0),Si(r,[r._allTables],ge(i),i)}function Fv(e,t){var n=rs(e,e.idbdb,t),r=jc(n,e._dbSchema);return!(r.add.length||r.change.some(function(i){return i.add.length||i.change.length}))}function aa(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:"["+ji(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)&&oe.WorkerGlobalScope&&oe instanceof oe.WorkerGlobalScope&&[].concat(navigator.userAgent.match(/Safari\/(\d*)/))[1]<604&&(r._hasGetAll=!1)}function Vv(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 na(r,i||null,/\&/.test(t),/\*/.test(t),/\+\+/.test(t),Re(i),n===0)})}var Bv=function(){function e(){}return e.prototype._parseStoresSpec=function(t,n){ge(t).forEach(function(r){if(t[r]!==null){var i=Vv(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]=Bc(r,o,i)}})},e.prototype.stores=function(t){var n=this.db;this._cfg.storesSource=this._cfg.storesSource?Pe(this._cfg.storesSource,t):t;var r=n._versions,i={},o={};return r.forEach(function(a){Pe(i,a._cfg.storesSource),o=a._cfg.dbschema={},a._parseStoresSpec(i,o)}),n._dbSchema=o,ia(n,[n._allTables,n,n.Transaction.prototype]),Si(n,[n._allTables,n,n.Transaction.prototype,this._cfg.tables],ge(o),o),n._storeNames=ge(o),this},e.prototype.upgrade=function(t){return this._cfg.contentUpgrade=Ya(this._cfg.contentUpgrade||re,t),this},e}();function jv(e){return Lr(Bv.prototype,function(n){this.db=e,this._cfg={version:n,storesSource:null,dbschema:{},tables:{},contentUpgrade:null}})}function is(e,t){var n=e._dbNamesDB;return n||(n=e._dbNamesDB=new ls(Ki,{addons:[],indexedDB:e,IDBKeyRange:t}),n.version(1).stores({dbnames:"name"})),n.table("dbnames")}function os(e){return e&&typeof e.databases=="function"}function Hv(e){var t=e.indexedDB,n=e.IDBKeyRange;return os(t)?Promise.resolve(t.databases()).then(function(r){return r.map(function(i){return i.name}).filter(function(i){return i!==Ki})}):is(t,n).toCollection().primaryKeys()}function zv(e,t){var n=e.indexedDB,r=e.IDBKeyRange;!os(n)&&t!==Ki&&is(n,r).put({name:t}).catch(re)}function Kv(e,t){var n=e.indexedDB,r=e.IDBKeyRange;!os(n)&&t!==Ki&&is(n,r).delete(t).catch(re)}function sa(e){return Ht(function(){return M.letThrough=!0,e()})}function Gv(){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 Wv(e){var t=e._state,n=e._deps.indexedDB;if(t.isBeingOpened||e.idbdb)return t.dbReadyPromise.then(function(){return t.dbOpenError?we(t.dbOpenError):e});mt&&(t.openCanceller._stackHolder=pn()),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 U.race([r,(typeof navigator>"u"?U.resolve():Gv()).then(function(){return new U(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=ot(u),d.onblocked=le(e._fireOnBlocked),d.onupgradeneeded=le(function(f){if(a=d.transaction,t.autoSchema&&!e._options.allowEmptyDB){d.onerror=mr,a.abort(),d.result.close();var p=n.deleteDatabase(c);p.onsuccess=p.onerror=le(function(){u(new V.NoSuchDatabase("Database "+c+" doesnt exist"))})}else{a.onerror=ot(u);var h=f.oldVersion>Math.pow(2,62)?0:f.oldVersion;s=h<1,e._novip.idbdb=d.result,Nv(e,h/10,a,u)}},u),d.onsuccess=le(function(){a=null;var f=e._novip.idbdb=d.result,p=ji(f.objectStoreNames);if(p.length>0)try{var h=f.transaction(kv(p),"readonly");t.autoSchema?Mv(e,f,h):(aa(e,e._dbSchema,h),Fv(e,h)||console.warn("Dexie SchemaDiff: Schema was extended without increasing the number passed to db.version(). Some queries may fail.")),ts(e,h)}catch{}or.push(e),f.onversionchange=le(function(m){t.vcFired=!0,e.on("versionchange").fire(m)}),f.onclose=le(function(m){e.on("close").fire(m)}),s&&zv(e._deps,c),l()},u)})})]).then(function(){return i(),t.onReadyBeingFired=[],U.resolve(sa(function(){return e.on.ready.fire(e.vip)})).then(function l(){if(t.onReadyBeingFired.length>0){var u=t.onReadyBeingFired.reduce(Ya,re);return t.onReadyBeingFired=[],U.resolve(sa(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(),we(l)}).finally(function(){t.openComplete=!0,o()})}function la(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"?Re(u)?Promise.all(u).then(r,i):r(u):u.then(r,i)}}return o(t)()}function qv(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=_c(i);return[e,o,n]}function Hc(e,t,n,r,i){return U.resolve().then(function(){var o=M.transless||M,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===Za.InvalidState&&e.isOpen()&&--e._state.PR1398_maxLoop>0?(console.warn("Dexie: Need to reopen db"),e._close(),e.open().then(function(){return Hc(e,t,n,null,i)})):we(d)}var l=qa(i);l&&Kn();var u,c=U.follow(function(){if(u=i.call(a,a),u)if(l){var d=At.bind(null,null);u.then(d,d)}else typeof u.next=="function"&&typeof u.throw=="function"&&(u=la(u))},s);return(u&&typeof u.then=="function"?U.resolve(u).then(function(d){return a.active?d:we(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),we(d)})})}function qr(e,t,n){for(var r=Re(e)?e.slice():[e],i=0;i<n;++i)r.push(t);return r}function $v(e){return G(G({},e),{table:function(t){var n=e.table(t),r=n.schema,i={},o=[];function a(m,g,_){var v=ar(m),b=i[v]=i[v]||[],y=m==null?0:typeof m=="string"?1:m.length,C=g>0,S=G(G({},_),{isVirtual:C,keyTail:g,keyLength:y,extractKey:ra(m),unique:!C&&_.unique});if(b.push(S),S.isPrimaryKey||o.push(S),y>1){var E=y===2?m[0]:m.slice(0,y-1);a(E,g+1,_)}return b.sort(function(I,x){return I.keyTail-x.keyTail}),S}var s=a(r.primaryKey.keyPath,0,r.primaryKey);i[":id"]=[s];for(var l=0,u=r.indexes;l<u.length;l++){var c=u[l];a(c.keyPath,0,c)}function d(m){var g=i[ar(m)];return g&&g[0]}function f(m,g){return{type:m.type===1?2:m.type,lower:qr(m.lower,m.lowerOpen?e.MAX_KEY:e.MIN_KEY,g),lowerOpen:!0,upper:qr(m.upper,m.upperOpen?e.MIN_KEY:e.MAX_KEY,g),upperOpen:!0}}function p(m){var g=m.query.index;return g.isVirtual?G(G({},m),{query:{index:g,range:f(m.query.range,g.keyTail)}}):m}var h=G(G({},n),{schema:G(G({},r),{primaryKey:s,indexes:o,getIndexByKeyPath:d}),count:function(m){return n.count(p(m))},query:function(m){return n.query(p(m))},openCursor:function(m){var g=m.query.index,_=g.keyTail,v=g.isVirtual,b=g.keyLength;if(!v)return n.openCursor(m);function y(C){function S(I){I!=null?C.continue(qr(I,m.reverse?e.MAX_KEY:e.MIN_KEY,_)):m.unique?C.continue(C.key.slice(0,b).concat(m.reverse?e.MIN_KEY:e.MAX_KEY,_)):C.continue()}var E=Object.create(C,{continue:{value:S},continuePrimaryKey:{value:function(I,x){C.continuePrimaryKey(qr(I,e.MAX_KEY,_),x)}},primaryKey:{get:function(){return C.primaryKey}},key:{get:function(){var I=C.key;return b===1?I[0]:I.slice(0,b)}},value:{get:function(){return C.value}}});return E}return n.openCursor(p(m)).then(function(C){return C&&y(C)})}});return h}})}var Zv={stack:"dbcore",name:"VirtualIndexMiddleware",level:1,create:$v};function as(e,t,n,r){return n=n||{},r=r||"",ge(e).forEach(function(i){if(!je(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=zo(o),l=zo(a);s!==l?n[r+i]=t[i]:s==="Object"?as(o,a,n,r+i+"."):o!==a&&(n[r+i]=t[i])}else o!==a&&(n[r+i]=t[i])}}),ge(t).forEach(function(i){je(e,i)||(n[r+i]=t[i])}),n}function Yv(e,t){return t.type==="delete"?t.keys:t.keys||t.values.map(e.extractKey)}var Qv={stack:"dbcore",name:"HooksMiddleware",level:2,create:function(e){return G(G({},e),{table:function(t){var n=e.table(t),r=n.schema.primaryKey,i=G(G({},n),{mutate:function(o){var a=M.trans,s=a.table(t).hook,l=s.deleting,u=s.creating,c=s.updating;switch(o.type){case"add":if(u.fire===re)break;return a._promise("readwrite",function(){return d(o)},!0);case"put":if(u.fire===re&&c.fire===re)break;return a._promise("readwrite",function(){return d(o)},!0);case"delete":if(l.fire===re)break;return a._promise("readwrite",function(){return d(o)},!0);case"deleteRange":if(l.fire===re)break;return a._promise("readwrite",function(){return f(o)},!0)}return n.mutate(o);function d(h){var m=M.trans,g=h.keys||Yv(r,h);if(!g)throw new Error("Keys missing");return h=h.type==="add"||h.type==="put"?G(G({},h),{keys:g}):G({},h),h.type!=="delete"&&(h.values=jo([],h.values,!0)),h.keys&&(h.keys=jo([],h.keys,!0)),Xv(n,h,g).then(function(_){var v=g.map(function(b,y){var C=_[y],S={onerror:null,onsuccess:null};if(h.type==="delete")l.fire.call(S,b,C,m);else if(h.type==="add"||C===void 0){var E=u.fire.call(S,b,h.values[y],m);b==null&&E!=null&&(b=E,h.keys[y]=b,r.outbound||Je(h.values[y],r.keyPath,b))}else{var I=as(C,h.values[y]),x=c.fire.call(S,I,b,C,m);if(x){var R=h.values[y];Object.keys(x).forEach(function(T){je(R,T)?R[T]=x[T]:Je(R,T,x[T])})}}return S});return n.mutate(h).then(function(b){for(var y=b.failures,C=b.results,S=b.numFailures,E=b.lastResult,I=0;I<g.length;++I){var x=C?C[I]:g[I],R=v[I];x==null?R.onerror&&R.onerror(y[I]):R.onsuccess&&R.onsuccess(h.type==="put"&&_[I]?h.values[I]:x)}return{failures:y,results:C,numFailures:S,lastResult:E}}).catch(function(b){return v.forEach(function(y){return y.onerror&&y.onerror(b)}),Promise.reject(b)})})}function f(h){return p(h.trans,h.range,1e4)}function p(h,m,g){return n.query({trans:h,values:!1,query:{index:r,range:m},limit:g}).then(function(_){var v=_.result;return d({type:"delete",keys:v,trans:h}).then(function(b){return b.numFailures>0?Promise.reject(b.failures[0]):v.length<g?{failures:[],numFailures:0,lastResult:void 0}:p(h,G(G({},m),{lower:v[v.length-1],lowerOpen:!0}),g)})})}}});return i}})}};function Xv(e,t,n){return t.type==="add"?Promise.resolve([]):e.getMany({trans:t.trans,keys:n,cache:"immutable"})}function zc(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)Ue(t.keys[i],e[o])===0&&(r.push(n?kr(t.values[i]):t.values[i]),++o);return r.length===e.length?r:null}catch{return null}}var Jv={stack:"dbcore",level:-1,create:function(e){return{table:function(t){var n=e.table(t);return G(G({},n),{getMany:function(r){if(!r.cache)return n.getMany(r);var i=zc(r.keys,r.trans._cache,r.cache==="clone");return i?U.resolve(i):n.getMany(r).then(function(o){return r.trans._cache={keys:r.keys,values:r.cache==="clone"?kr(o):o},o})},mutate:function(r){return r.type!=="add"&&(r.trans._cache=null),n.mutate(r)}})}}}},go;function ss(e){return!("from"in e)}var yt=function(e,t){if(this)Pe(this,arguments.length?{d:1,from:e,to:arguments.length>1?t:e}:{d:0});else{var n=new yt;return e&&"d"in e&&Pe(n,e),n}};Un(yt.prototype,(go={add:function(e){return ki(this,e),this},addKey:function(e){return yr(this,e,e),this},addKeys:function(e){var t=this;return e.forEach(function(n){return yr(t,n,n)}),this}},go[Ko]=function(){return ua(this)},go));function yr(e,t,n){var r=Ue(t,n);if(!isNaN(r)){if(r>0)throw RangeError();if(ss(e))return Pe(e,{from:t,to:n,d:1});var i=e.l,o=e.r;if(Ue(n,e.from)<0)return i?yr(i,t,n):e.l={from:t,to:n,d:1,l:null,r:null},gl(e);if(Ue(t,e.to)>0)return o?yr(o,t,n):e.r={from:t,to:n,d:1,l:null,r:null},gl(e);Ue(t,e.from)<0&&(e.from=t,e.l=null,e.d=o?o.d+1:1),Ue(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&&ki(e,i),o&&a&&ki(e,o)}}function ki(e,t){function n(r,i){var o=i.from,a=i.to,s=i.l,l=i.r;yr(r,o,a),s&&n(r,s),l&&n(r,l)}ss(t)||n(e,t)}function ey(e,t){var n=ua(t),r=n.next();if(r.done)return!1;for(var i=r.value,o=ua(e),a=o.next(i.from),s=a.value;!r.done&&!a.done;){if(Ue(s.from,i.to)<=0&&Ue(s.to,i.from)>=0)return!0;Ue(i.from,s.from)<0?i=(r=n.next(s.from)).value:s=(a=o.next(i.from)).value}return!1}function ua(e){var t=ss(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&&Ue(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||Ue(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 gl(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=G({},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=vl(a)}e.d=vl(e)}function vl(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 ty={stack:"dbcore",level:0,create:function(e){var t=e.schema.name,n=new yt(e.MIN_KEY,e.MAX_KEY);return G(G({},e),{table:function(r){var i=e.table(r),o=i.schema,a=o.primaryKey,s=a.extractKey,l=a.outbound,u=G(G({},i),{mutate:function(f){var p=f.trans,h=p.mutatedParts||(p.mutatedParts={}),m=function(E){var I="idb://"+t+"/"+r+"/"+E;return h[I]||(h[I]=new yt)},g=m(""),_=m(":dels"),v=f.type,b=f.type==="deleteRange"?[f.range]:f.type==="delete"?[f.keys]:f.values.length<50?[[],f.values]:[],y=b[0],C=b[1],S=f.trans._cache;return i.mutate(f).then(function(E){if(Re(y)){v!=="delete"&&(y=E.results),g.addKeys(y);var I=zc(y,S);!I&&v!=="add"&&_.addKeys(y),(I||C)&&ny(m,o,I,C)}else if(y){var x={from:y.lower,to:y.upper};_.add(x),g.add(x)}else g.add(n),_.add(n),o.indexes.forEach(function(R){return m(R.name).add(n)});return E})}}),c=function(f){var p,h,m=f.query,g=m.index,_=m.range;return[g,new yt((p=_.lower)!==null&&p!==void 0?p:e.MIN_KEY,(h=_.upper)!==null&&h!==void 0?h:e.MAX_KEY)]},d={get:function(f){return[a,new yt(f.key)]},getMany:function(f){return[a,new yt().addKeys(f.keys)]},count:c,query:c,openCursor:c};return ge(d).forEach(function(f){u[f]=function(p){var h=M.subscr;if(h){var m=function(S){var E="idb://"+t+"/"+r+"/"+S;return h[E]||(h[E]=new yt)},g=m(""),_=m(":dels"),v=d[f](p),b=v[0],y=v[1];if(m(b.name||"").add(y),!b.isPrimaryKey)if(f==="count")_.add(n);else{var C=f==="query"&&l&&p.values&&i.query(G(G({},p),{values:!1}));return i[f].apply(this,arguments).then(function(S){if(f==="query"){if(l&&p.values)return C.then(function(R){var T=R.result;return g.addKeys(T),S});var E=p.values?S.result.map(s):S.result;p.values?g.addKeys(E):_.addKeys(E)}else if(f==="openCursor"){var I=S,x=p.values;return I&&Object.create(I,{key:{get:function(){return _.addKey(I.primaryKey),I.key}},primaryKey:{get:function(){var R=I.primaryKey;return _.addKey(R),R}},value:{get:function(){return x&&g.addKey(I.primaryKey),I.value}}})}return S})}}return i[f].apply(this,arguments)}}),u}})}};function ny(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&&Re(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]);Ue(d,f)!==0&&(d!=null&&l(d),f!=null&&l(f))})}t.indexes.forEach(i)}var ls=function(){function e(t,n){var r=this;this._middlewares={},this.verno=0;var i=e.dependencies;this._options=n=G({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:re,dbReadyPromise:null,cancelOpen:re,openCanceller:null,autoSchema:!0,PR1398_maxLoop:3};a.dbReadyPromise=new U(function(s){a.dbReadyResolve=s}),a.openCanceller=new U(function(s,l){a.cancelOpen=l}),this._state=a,this.name=t,this.on=Rr(this,"populate","blocked","versionchange","close",{ready:[Ya,re]}),this.on.ready.subscribe=mc(this.on.ready.subscribe,function(s){return function(l,u){e.vip(function(){var c=r._state;if(c.openComplete)c.dbOpenError||U.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=vv(this),this.Table=fv(this),this.Transaction=Sv(this),this.Version=jv(this),this.WhereClause=Iv(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=vr(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),or.filter(function(l){return l.name===r.name&&l!==r&&!l._state.vcFired}).map(function(l){return l.on("versionchange").fire(s)})},this.use(Zv),this.use(Qv),this.use(ty),this.use(Jv),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(Ov),r.stores({}),this._state.autoSchema=!1,r)},e.prototype._whenReady=function(t){var n=this;return this.idbdb&&(this._state.openComplete||M.letThrough||this._vip)?t():new U(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(re)}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 Wv(this)},e.prototype._close=function(){var t=this._state,n=or.indexOf(this);if(n>=0&&or.splice(n,1),this.idbdb){try{this.idbdb.close()}catch{}this._novip.idbdb=null}t.dbReadyPromise=new U(function(r){t.dbReadyResolve=r}),t.openCanceller=new U(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 U(function(i,o){var a=function(){t.close();var s=t._deps.indexedDB.deleteDatabase(t.name);s.onsuccess=le(function(){Kv(t._deps,t.name),i()}),s.onerror=ot(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 ge(this._allTables).map(function(n){return t._allTables[n]})},enumerable:!1,configurable:!0}),e.prototype.transaction=function(){var t=qv.apply(this,arguments);return this._transaction.apply(this,t)},e.prototype._transaction=function(t,n,r){var i=this,o=M.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===co)s=co;else if(t=="rw"||t==fo)s=fo;else throw new V.InvalidArgument("Invalid transaction mode: "+t);if(o){if(o.mode===co&&s===fo)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)}):we(c)}var u=Hc.bind(null,this,s,l,o,r);return o?o._promise(s,u,"lock"):M.trans?Gn(M.transless,function(){return i._whenReady(u)}):this._whenReady(u)},e.prototype.table=function(t){if(!je(this._allTables,t))throw new V.InvalidTable("Table "+t+" does not exist");return this._allTables[t]},e}(),ry=typeof Symbol<"u"&&"observable"in Symbol?Symbol.observable:"@@observable",iy=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[ry]=function(){return this},e}();function Kc(e,t){return ge(t).forEach(function(n){var r=e[n]||(e[n]=new yt);ki(r,t[n])}),e}function oy(e){return new iy(function(t){var n=qa(e);function r(p){n&&Kn();var h=function(){return Ht(e,{subscr:p,trans:null})},m=M.trans?Gn(M.transless,h):h();return n&&m.then(At,At),m}var i=!1,o={},a={},s={get closed(){return i},unsubscribe:function(){i=!0,Kt.storagemutated.unsubscribe(d)}};t.start&&t.start(s);var l=!1,u=!1;function c(){return ge(a).some(function(p){return o[p]&&ey(o[p],a[p])})}var d=function(p){Kc(o,p),c()&&f()},f=function(){if(!(l||i)){o={};var p={},h=r(p);u||(Kt(gr,d),u=!0),l=!0,Promise.resolve(h).then(function(m){l=!1,!i&&(c()?f():(o={},a=p,t.next&&t.next(m)))},function(m){l=!1,t.error&&t.error(m),s.unsubscribe()})}};return f(),s})}var ca;try{ca={indexedDB:oe.indexedDB||oe.mozIndexedDB||oe.webkitIndexedDB||oe.msIndexedDB,IDBKeyRange:oe.IDBKeyRange||oe.webkitIDBKeyRange}}catch{ca={indexedDB:null,IDBKeyRange:null}}var Qt=ls;Un(Qt,G(G({},Hi),{delete:function(e){var t=new Qt(e,{addons:[]});return t.delete()},exists:function(e){return new Qt(e,{addons:[]}).open().then(function(t){return t.close(),!0}).catch("NoSuchDatabaseError",function(){return!1})},getDatabaseNames:function(e){try{return Hv(Qt.dependencies).then(e)}catch{return we(new V.MissingAPI)}},defineClass:function(){function e(t){Pe(this,t)}return e},ignoreTransaction:function(e){return M.trans?Gn(M.transless,e):e()},vip:sa,async:function(e){return function(){try{var t=la(e.apply(this,arguments));return!t||typeof t.then!="function"?U.resolve(t):t}catch(n){return we(n)}}},spawn:function(e,t,n){try{var r=la(e.apply(n,t||[]));return!r||typeof r.then!="function"?U.resolve(r):r}catch(i){return we(i)}},currentTransaction:{get:function(){return M.trans||null}},waitFor:function(e,t){var n=U.resolve(typeof e=="function"?Qt.ignoreTransaction(e):e).timeout(t||6e4);return M.trans?M.trans.waitFor(n):n},Promise:U,debug:{get:function(){return mt},set:function(e){wc(e,e==="dexie"?function(){return!0}:Uc)}},derive:Hn,extend:Pe,props:Un,override:mc,Events:Rr,on:Kt,liveQuery:oy,extendObservabilitySet:Kc,getByKeyPath:St,setByKeyPath:Je,delByKeyPath:Mg,shallowClone:yc,deepClone:kr,getObjectDiff:as,cmp:Ue,asap:gc,minKey:ta,addons:[],connections:or,errnames:Za,dependencies:ca,semVer:cl,version:cl.split(".").map(function(e){return parseInt(e)}).reduce(function(e,t,n){return e+t/Math.pow(10,n*2)})}));Qt.maxKey=vr(Qt.dependencies.IDBKeyRange);typeof dispatchEvent<"u"&&typeof addEventListener<"u"&&(Kt(gr,function(e){if(!It){var t;zi?(t=document.createEvent("CustomEvent"),t.initCustomEvent(Mt,!0,!0,e)):t=new CustomEvent(Mt,{detail:e}),It=!0,dispatchEvent(t),It=!1}}),addEventListener(Mt,function(e){var t=e.detail;It||xi(t)}));function xi(e){var t=It;try{It=!0,Kt.storagemutated.fire(e)}finally{It=t}}var It=!1;if(typeof BroadcastChannel<"u"){var $r=new BroadcastChannel(Mt);typeof $r.unref=="function"&&$r.unref(),Kt(gr,function(e){It||$r.postMessage(e)}),$r.onmessage=function(e){e.data&&xi(e.data)}}else if(typeof self<"u"&&typeof navigator<"u"){Kt(gr,function(e){try{It||(typeof localStorage<"u"&&localStorage.setItem(Mt,JSON.stringify({trig:Math.random(),changedParts:e})),typeof self.clients=="object"&&jo([],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&&xi(t.changedParts)}});var yl=self.document&&navigator.serviceWorker;yl&&yl.addEventListener("message",ay)}function ay(e){var t=e.data;t&&t.type===Mt&&xi(t.changedParts)}U.rejectionMapper=Wg;wc(mt,Uc);var Wn=(e=>(e.ReadyForUpload="ReadyForUpload",e.UploadComplete="UploadComplete",e))(Wn||{}),Rn=(e=>(e.After="after",e.Before="before",e.BeforeAndAfter="beforeAndAfter",e))(Rn||{});const da="sprig.sessionId",Gc="sprig.disableReplayRecording",sy=30,Wc=()=>{sessionStorage.setItem(Gc,"disabled")},dn=()=>!!sessionStorage.getItem(Gc),ly=["did not allow mutations","called in an invalid security context"],uy=e=>{if(!e)return!0;for(const t of ly)if(e.toLowerCase().includes(t))return!1;return!0},_l=(e,t,n)=>{dn()||t instanceof Error&&(Wc(),uy(t==null?void 0:t.message)&&(fy(),window.UserLeap.reportError(e,t,n)))},cy=(e,t)=>{var n,r;(r=(n=window.navigator)==null?void 0:n.storage)!=null&&r.estimate?window.navigator.storage.estimate().then(i=>{_l(e,t,i)}).catch(i=>{window.UserLeap.reportError("Error getting storage estimate",i)}):_l(e,t)},dy=()=>{const e=sessionStorage.getItem(da);return e?(sessionStorage.removeItem(da),e):jt()},Me=dy();window.addEventListener("beforeunload",()=>{sessionStorage.setItem(da,Me)});const fy=()=>{Promise.all([ne.events.clear(),ne.chunkUploads.clear(),ne.pendingCaptures.clear()]).catch(e=>{window.UserLeap.reportError("Error wiping database",e)})},vo=(e,t,n=()=>!0)=>ne.table(t).where("timestamp").below(e).and(n).delete(),py=()=>{ne.events.where("sessionId").equals(Me).delete(),ne.pendingCaptures.where("sessionId").equals(Me).delete()},hy=e=>{const t=e.map(n=>{var r;return{...n,sessionId:(r=n.sessionId)!=null?r:Me}});return ne.events.bulkAdd(t)},my=(e,t)=>ne.events.where("[sessionId+timestamp]").between([Me,e],[Me,t]).toArray(),gy=(e,t,n)=>{const r=new Date,i=r.setMinutes(r.getMinutes()+(n!=null?n:sy));return ne.events.where("[sessionId+timestamp]").between([Me,e],[Me,t]).modify({expiredAt:i})},vy=e=>{var t;return ne.chunkUploads.add({...e,sessionId:(t=e.sessionId)!=null?t:Me})},yy=(e,t)=>ne.chunkUploads.update(e,{data:null,etag:t,status:Wn.UploadComplete}),_y=({status:e,uploadId:t})=>t?ne.chunkUploads.where({uploadId:t,status:e}).toArray():ne.chunkUploads.where({sessionId:Me,status:e}).toArray(),by=e=>ne.chunkUploads.where({uploadId:e,status:Wn.UploadComplete}).toArray(),wy=e=>ne.chunkUploads.where({uploadId:e,status:Wn.UploadComplete}).delete(),Cy=e=>{var t;return ne.pendingCaptures.add({...e,sessionId:(t=e.sessionId)!=null?t:Me,canUpload:!1})},Iy=()=>ne.pendingCaptures.where("sessionId").equals(Me).and(e=>e.targetTimestamp<Date.now()).toArray(),Ey=()=>ne.pendingCaptures.where("sessionId").equals(Me).toArray(),Sy=e=>ne.pendingCaptures.where("sessionId").equals(Me).and(t=>t.captureParams.responseGroupId===e).modify({canUpload:!0});class ky extends ls{constructor(){super("replayStorage",{autoOpen:!1});xe(this,"events");xe(this,"chunkUploads");xe(this,"pendingCaptures")}}const ne=new ky;ne.version(1).stores({events:"uuid, timestamp, [sessionId+timestamp]",chunkUploads:"uuid, timestamp, [sessionId+status], [uploadId+status], [sessionId+status+uploadId]",pendingCaptures:"uuid, timestamp, [sessionId+targetTimestamp]"});ne.open().catch(()=>{Wc()});let qc=5e3,fa=6e4;const xy=5,bl=1e3,$c=30,Ai=$c+xy,us="sprig.pendingCount";let wl=0,Cl=Date.now(),cs=!1;const Ay=async(e,t=2,n)=>{try{if(dn()||!e)return;n!=null&&n.minDuration&&(qc=n.minDuration),n!=null&&n.batchDuration&&(fa=n.batchDuration),Tg(t),Uy(),Ly(e+Ai,30*60,e+Ai),Oy();let r=!0;Bt({checkoutEveryNms:$c*1e3,sampling:{input:"last",scroll:250,media:800},emit:(i,o)=>{if(dn())return;Cl=Date.now();const a=r||!!o;r=!1,Ty({uuid:jt(),event:JSON.stringify(i),isValidStart:a,timestamp:Date.now()})},...n}),cs=!0,wl||(wl=window.setInterval(()=>{Date.now()-Cl>bl&&Or("Sprig_Noop",{})},bl))}catch(r){ft("Error initializing replay",r)}};let pa=!1,ha=[];const Ty=e=>{ha.push(e),pa||Ry()},Ry=()=>{pa=!0,setTimeout(async()=>{if(dn())return;const e=ha;ha=[],pa=!1;try{await hy(e)}catch(t){ft("Error storing replay events",t)}},500)},Ly=(e=6*60,t=30*60,n=4*60)=>{const r=setInterval(async()=>{const i=Date.now();dn()||await ne.transaction("rw",ne.events,ne.chunkUploads,ne.pendingCaptures,()=>{vo(i-e*1e3,"events",o=>o.expiredAt===void 0||o.expiredAt<i-e*1e3),vo(i-t*1e3,"chunkUploads"),vo(i-n*1e3,"pendingCaptures",o=>o.canUpload===void 0||o.canUpload===!1)}).catch(o=>{clearInterval(r),ft("Error deleting table rows",o)})},3e4)},Oy=(e=5)=>{setInterval(By,e*1e3)},Ny=async(e,t,n,r,i)=>{try{const o=Math.min(e+i,n),a=await my(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){ft("Error getting events batch",o)}},Dy=(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},Zc=e=>Promise.all(e.map(async t=>{const n=await Lg(t);return await yy(t.uuid,n),t.uploadId})),Yc=async e=>{const t=await by(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 Og({apiUrl:r.apiUrl,surveyId:r.surveyId,uploadId:e,responseGroupUuid:r.responseGroupId,etags:n,headers:r.completeUploadHeaders,replayDuration:r.replayDuration}),await wy(e)},Uy=async()=>{try{let e=[];if(await ne.transaction("rw",ne.chunkUploads,async()=>{e=await _y({status:Wn.ReadyForUpload}).catch(n=>{ft("chunkUploads transaction error",n)})}),!(e!=null&&e.length))return;const t=await Zc(e);t!=null&&t.length&&await Promise.all(t.map(async n=>{n&&await Yc(n)}))}catch(e){ft("Error getting chunk upload uuids",e)}},Py=async(e,t)=>{await Zc(t),await Promise.all(e.map(n=>Yc(n)))},My=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},Il=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-Ai*1e3,f=[];let p=[];for(let m=d;m<t;m+=fa){if([l,p]=await Ny(m,e,t,l,fa),!(p!=null&&p.length))continue;u===0&&(u=p[0].timestamp),c=p[p.length-1].timestamp;const g=`${s?",":"["}${p.map(v=>v.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<qc)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=My(f)),i},Fy=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 Il(o,i,n)}catch(a){if(a instanceof Error&&window.UserLeap.reportError("Error compressing replay",a),n)try{r=await Il(o,i,!1)}catch(s){ft("fileData fallback failed",s)}}return r},El=async e=>{const{surveyId:t,responseGroupId:n,visitorId:r,apiUrl:i,completeUploadHeaders:o,replayParams:a,triggerTimestamp:s}=e,l=await Fy(a.replayDurationSeconds*1e3,s);if(!(l!=null&&l.length))return;const u=Dy(l,a.minimumChunkSizeMb,a.signedUrls.length),c=await Promise.all(u.map(async(d,f)=>{const p=jt(),h={apiUrl:i,chunkIndex:f+1,completeUploadHeaders:o,etag:null,responseGroupId:n,status:Wn.ReadyForUpload,surveyId:t,timestamp:s,totalChunks:u.length,data:d,uploadId:a.uploadId,uploadUrl:a.signedUrls[f].url,uuid:p,visitorId:r};return await vy(h),h}));await Py([a.uploadId],c)},Qc=async(e,t)=>{if(!dn())try{const{isStandalone:n,replayParams:r,triggerTimestamp:i,responseGroupId:o}=e,a=async()=>{setTimeout(()=>q.removeListener(z.QuestionAnswered,a),0),r.replayDurationType===Rn.Before?await El(e):await Sy(o)};if(r.replayDurationType===Rn.After||r.replayDurationType===Rn.BeforeAndAfter){n||q.on(z.QuestionAnswered,a),await Vy(e);return}if(n||t)await El(e);else{const s=Ai+r.replayDurationSeconds;await gy(i-s*1e3,i,r.expirationTimeLimitMinutes),q.on(z.QuestionAnswered,a)}}catch(n){ft("Error scheduling or capturing replay",n)}},Sl=()=>{if(!dn())try{py()}catch(e){ft("Error clearing session event data",e)}};let bt=sessionStorage.getItem(us);const Vy=async e=>{const{surveyId:t}=e,n=await Ey(),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===Rn.BeforeAndAfter&&(i.replayParams.replayDurationSeconds*=2),i.replayParams.replayDurationType=Rn.Before;const o=e.triggerTimestamp+e.replayParams.replayDurationSeconds*1e3;return i.triggerTimestamp=o,bt=bt?(parseInt(bt)+1).toString():"1",sessionStorage.setItem(us,bt),Cy({uuid:jt(),targetTimestamp:o,timestamp:Date.now(),captureParams:i})},By=async()=>{try{if(bt&&parseInt(bt)>0){const e=await Iy();e.length&&await Promise.all(e.map(async t=>{await ne.pendingCaptures.delete(t.uuid),await Qc(t.captureParams,t.canUpload)})),bt=(parseInt(bt)-e.length).toString(),sessionStorage.setItem(us,bt)}}catch(e){ft("Error initiating pending captures",e)}},Or=(e,t)=>{var n;!cs||(n=Bt.addCustomEvent)==null||n.call(Bt,e,t)},kl=e=>{Or("Sprig_PageView",e)},jy=e=>{Or("Sprig_TrackEvent",e)},Hy=e=>{Or("Sprig_ShowSurvey",e)},zy=e=>{Or("Sprig_SubmitSurvey",e)},ft=(e,t)=>{cs=!1,cy(e,t)};var Nr,P,Xc,Pn,Xt,xl,Jc,ed,Ti={},td=[],Ky=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i;function Et(e,t){for(var n in t)e[n]=t[n];return e}function nd(e){var t=e.parentNode;t&&t.removeChild(e)}function pe(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?Nr.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 sr(e,a,r,i,null)}function sr(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?++Xc:i};return i==null&&P.vnode!=null&&P.vnode(o),o}function rd(){return{current:null}}function nt(e){return e.children}function Gy(e,t,n,r,i){var o;for(o in n)o==="children"||o==="key"||o in t||Ri(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]||Ri(e,o,t[o],n[o],r)}function Al(e,t,n){t[0]==="-"?e.setProperty(t,n==null?"":n):e[t]=n==null?"":typeof n!="number"||Ky.test(t)?n:n+"px"}function Ri(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||Al(e.style,t,"");if(n)for(t in n)r&&n[t]===r[t]||Al(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?Rl:Tl,o):e.removeEventListener(t,o?Rl:Tl,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 Tl(e){Pn=!0;try{return this.l[e.type+!1](P.event?P.event(e):e)}finally{Pn=!1}}function Rl(e){Pn=!0;try{return this.l[e.type+!0](P.event?P.event(e):e)}finally{Pn=!1}}function et(e,t){this.props=e,this.context=t}function _r(e,t){if(t==null)return e.__?_r(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"?_r(e):null}function id(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 id(e)}}function Wy(e){Pn?setTimeout(e):Jc(e)}function ma(e){(!e.__d&&(e.__d=!0)&&Xt.push(e)&&!Li.__r++||xl!==P.debounceRendering)&&((xl=P.debounceRendering)||Wy)(Li)}function Li(){var e,t,n,r,i,o,a,s;for(Xt.sort(function(l,u){return l.__v.__b-u.__v.__b});e=Xt.shift();)e.__d&&(t=Xt.length,r=void 0,i=void 0,a=(o=(n=e).__v).__e,(s=n.__P)&&(r=[],(i=Et({},o)).__v=o.__v+1,ds(s,o,i,n.__n,s.ownerSVGElement!==void 0,o.__h!=null?[a]:null,r,a==null?_r(o):a,o.__h),ud(r,o),o.__e!=a&&id(o)),Xt.length>t&&Xt.sort(function(l,u){return l.__v.__b-u.__v.__b}));Li.__r=0}function od(e,t,n,r,i,o,a,s,l,u){var c,d,f,p,h,m,g,_=r&&r.__k||td,v=_.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"?sr(null,p,null,null,p):Array.isArray(p)?sr(nt,{children:p},null,null,null):p.__b>0?sr(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<v;d++){if((f=_[d])&&p.key==f.key&&p.type===f.type){_[d]=void 0;break}f=null}ds(e,p,f=f||Ti,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?(m==null&&(m=h),typeof p.type=="function"&&p.__k===f.__k?p.__d=l=ad(p,l,e):l=sd(e,p,f,_,h,l),typeof n.type=="function"&&(n.__d=l)):l&&f.__e==l&&l.parentNode!=e&&(l=_r(f))}for(n.__e=m,c=v;c--;)_[c]!=null&&(typeof n.type=="function"&&_[c].__e!=null&&_[c].__e==n.__d&&(n.__d=ld(r).nextSibling),dd(_[c],_[c]));if(g)for(c=0;c<g.length;c++)cd(g[c],g[++c],g[++c])}function ad(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"?ad(r,t,n):sd(n,r,r,i,r.__e,t));return t}function kt(e,t){return t=t||[],e==null||typeof e=="boolean"||(Array.isArray(e)?e.some(function(n){kt(n,t)}):t.push(e)),t}function sd(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 ld(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=ld(n)))return r}return null}function ds(e,t,n,r,i,o,a,s,l){var u,c,d,f,p,h,m,g,_,v,b,y,C,S,E,I=t.type;if(t.constructor!==void 0)return null;n.__h!=null&&(l=n.__h,s=t.__e=n.__e,t.__h=null,o=[s]),(u=P.__b)&&u(t);try{e:if(typeof I=="function"){if(g=t.props,_=(u=I.contextType)&&r[u.__c],v=u?_?_.props.value:u.__:r,n.__c?m=(c=t.__c=n.__c).__=c.__E:("prototype"in I&&I.prototype.render?t.__c=c=new I(g,v):(t.__c=c=new et(g,v),c.constructor=I,c.render=$y),_&&_.sub(c),c.props=g,c.state||(c.state={}),c.context=v,c.__n=r,d=c.__d=!0,c.__h=[],c._sb=[]),c.__s==null&&(c.__s=c.state),I.getDerivedStateFromProps!=null&&(c.__s==c.state&&(c.__s=Et({},c.__s)),Et(c.__s,I.getDerivedStateFromProps(g,c.__s))),f=c.props,p=c.state,c.__v=t,d)I.getDerivedStateFromProps==null&&c.componentWillMount!=null&&c.componentWillMount(),c.componentDidMount!=null&&c.__h.push(c.componentDidMount);else{if(I.getDerivedStateFromProps==null&&g!==f&&c.componentWillReceiveProps!=null&&c.componentWillReceiveProps(g,v),!c.__e&&c.shouldComponentUpdate!=null&&c.shouldComponentUpdate(g,c.__s,v)===!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(x){x&&(x.__=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,v),c.componentDidUpdate!=null&&c.__h.push(function(){c.componentDidUpdate(f,p,h)})}if(c.context=v,c.props=g,c.__P=e,y=P.__r,C=0,"prototype"in I&&I.prototype.render){for(c.state=c.__s,c.__d=!1,y&&y(t),u=c.render(c.props,c.state,c.context),S=0;S<c._sb.length;S++)c.__h.push(c._sb[S]);c._sb=[]}else do c.__d=!1,y&&y(t),u=c.render(c.props,c.state,c.context),c.state=c.__s;while(c.__d&&++C<25);c.state=c.__s,c.getChildContext!=null&&(r=Et(Et({},r),c.getChildContext())),d||c.getSnapshotBeforeUpdate==null||(h=c.getSnapshotBeforeUpdate(f,p)),E=u!=null&&u.type===nt&&u.key==null?u.props.children:u,od(e,Array.isArray(E)?E:[E],t,n,r,i,o,a,s,l),c.base=t.__e,t.__h=null,c.__h.length&&a.push(c),m&&(c.__E=c.__=null),c.__e=!1}else o==null&&t.__v===n.__v?(t.__k=n.__k,t.__e=n.__e):t.__e=qy(n.__e,t,n,r,i,o,a,l);(u=P.diffed)&&u(t)}catch(x){t.__v=null,(l||o!=null)&&(t.__e=s,t.__h=!!l,o[o.indexOf(s)]=null),P.__e(x,t,n)}}function ud(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 qy(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&&Nr.call(e.childNodes),u=(d=n.props||Ti).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(Gy(e,f,d,i,s),c)t.__k=[];else if(h=t.props.children,od(e,Array.isArray(h)?h:[h],t,n,r,i&&p!=="foreignObject",o,a,o?o[0]:n.__k&&_r(n,0),s),o!=null)for(h=o.length;h--;)o[h]!=null&&nd(o[h]);s||("value"in f&&(h=f.value)!==void 0&&(h!==e.value||p==="progress"&&!h||p==="option"&&h!==d.value)&&Ri(e,"value",h,d.value,!1),"checked"in f&&(h=f.checked)!==void 0&&h!==e.checked&&Ri(e,"checked",h,d.checked,!1))}return e}function cd(e,t,n){try{typeof e=="function"?e(t):e.current=t}catch(r){P.__e(r,n)}}function dd(e,t,n){var r,i;if(P.unmount&&P.unmount(e),(r=e.ref)&&(r.current&&r.current!==e.__e||cd(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]&&dd(r[i],t,n||typeof e.type!="function");n||e.__e==null||nd(e.__e),e.__=e.__e=e.__d=void 0}function $y(e,t,n){return this.constructor(e,n)}function Mn(e,t,n){var r,i,o;P.__&&P.__(e,t),i=(r=typeof n=="function")?null:n&&n.__k||t.__k,o=[],ds(t,e=(!r&&n||t).__k=pe(nt,null,[e]),i||Ti,Ti,t.ownerSVGElement!==void 0,!r&&n?[n]:i?null:t.firstChild?Nr.call(t.childNodes):null,o,!r&&n?n:i?i.__e:t.firstChild,r),ud(o,e)}function fd(e,t){Mn(e,t,fd)}function Zy(e,t,n){var r,i,o,a=Et({},e.props);for(o in t)o=="key"?r=t[o]:o=="ref"?i=t[o]:a[o]=t[o];return arguments.length>2&&(a.children=arguments.length>3?Nr.call(arguments,2):n),sr(e.type,a,r||e.key,i||e.ref,null)}function pd(e,t){var n={__c:t="__cC"+ed++,__: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,ma(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}Nr=td.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}},Xc=0,Pn=!1,et.prototype.setState=function(e,t){var n;n=this.__s!=null&&this.__s!==this.state?this.__s:this.__s=Et({},this.state),typeof e=="function"&&(e=e(Et({},n),this.props)),e&&Et(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),ma(this))},et.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),ma(this))},et.prototype.render=nt,Xt=[],Jc=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,Li.__r=0,ed=0;var D=(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))(D||{}),wt=(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))(wt||{}),Fn=(e=>(e.Camera="camera",e.Microphone="microphone",e.Screen="screen",e))(Fn||{}),Ke=(e=>(e.AvPermission="av_permission",e.ScreenPermission="screen_permission",e.StartTask="start_task",e.CompleteTask="complete_task",e))(Ke||{}),rn=(e=>(e.Number="number",e.Smiley="smiley",e.Star="star",e))(rn||{}),Yy=Object.create,hd=Object.defineProperty,Qy=Object.getOwnPropertyDescriptor,Xy=Object.getOwnPropertyNames,Jy=Object.getPrototypeOf,e0=Object.prototype.hasOwnProperty,Dr=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),t0=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of Xy(t))!e0.call(e,i)&&i!==n&&hd(e,i,{get:()=>t[i],enumerable:!(r=Qy(t,i))||r.enumerable});return e},n0=(e,t,n)=>(n=e!=null?Yy(Jy(e)):{},t0(t||!e||!e.__esModule?hd(n,"default",{value:e,enumerable:!0}):n,e)),r0=Dr((e,t)=>{var n;typeof window<"u"?n=window:typeof global<"u"?n=global:typeof self<"u"?n=self:n={},t.exports=n}),i0=Dr((e,t)=>{t.exports=r;var n=Object.prototype.toString;function r(i){if(!i)return!1;var o=n.call(i);return o==="[object Function]"||typeof i=="function"&&o!=="[object RegExp]"||typeof window<"u"&&(i===window.setTimeout||i===window.alert||i===window.confirm||i===window.prompt)}}),o0=Dr((e,t)=>{var n=function(i){return i.replace(/^\s+|\s+$/g,"")},r=function(i){return Object.prototype.toString.call(i)==="[object Array]"};t.exports=function(i){if(!i)return{};for(var o={},a=n(i).split(`
37
- `),s=0;s<a.length;s++){var l=a[s],u=l.indexOf(":"),c=n(l.slice(0,u)).toLowerCase(),d=n(l.slice(u+1));typeof o[c]>"u"?o[c]=d:r(o[c])?o[c].push(d):o[c]=[o[c],d]}return o}}),a0=Dr((e,t)=>{t.exports=r;var n=Object.prototype.hasOwnProperty;function r(){for(var i={},o=0;o<arguments.length;o++){var a=arguments[o];for(var s in a)n.call(a,s)&&(i[s]=a[s])}return i}}),s0=Dr((e,t)=>{var n=r0(),r=i0(),i=o0(),o=a0();t.exports=u,t.exports.default=u,u.XMLHttpRequest=n.XMLHttpRequest||f,u.XDomainRequest="withCredentials"in new u.XMLHttpRequest?u.XMLHttpRequest:n.XDomainRequest,a(["get","put","post","patch","head","delete"],function(p){u[p==="delete"?"del":p]=function(h,m,g){return m=l(h,m,g),m.method=p.toUpperCase(),c(m)}});function a(p,h){for(var m=0;m<p.length;m++)h(p[m])}function s(p){for(var h in p)if(p.hasOwnProperty(h))return!1;return!0}function l(p,h,m){var g=p;return r(h)?(m=h,typeof p=="string"&&(g={uri:p})):g=o(h,{uri:p}),g.callback=m,g}function u(p,h,m){return h=l(p,h,m),c(h)}function c(p){if(typeof p.callback>"u")throw new Error("callback argument missing");var h=!1,m=function(A,B,J){h||(h=!0,p.callback(A,B,J))};function g(){y.readyState===4&&setTimeout(b,0)}function _(){var A=void 0;if(y.response?A=y.response:A=y.responseText||d(y),O)try{A=JSON.parse(A)}catch{}return A}function v(A){return clearTimeout(k),A instanceof Error||(A=new Error(""+(A||"Unknown XMLHttpRequest Error"))),A.statusCode=0,m(A,N)}function b(){if(!S){var A;clearTimeout(k),p.useXDR&&y.status===void 0?A=200:A=y.status===1223?204:y.status;var B=N,J=null;return A!==0?(B={body:_(),statusCode:A,method:I,headers:{},url:E,rawRequest:y},y.getAllResponseHeaders&&(B.headers=i(y.getAllResponseHeaders()))):J=new Error("Internal XMLHttpRequest Error"),m(J,B,B.body)}}var y=p.xhr||null;y||(p.cors||p.useXDR?y=new u.XDomainRequest:y=new u.XMLHttpRequest);var C,S,E=y.url=p.uri||p.url,I=y.method=p.method||"GET",x=p.body||p.data,R=y.headers=p.headers||{},T=!!p.sync,O=!1,k,N={body:void 0,headers:{},statusCode:0,method:I,url:E,rawRequest:y};if("json"in p&&p.json!==!1&&(O=!0,R.accept||R.Accept||(R.Accept="application/json"),I!=="GET"&&I!=="HEAD"&&(R["content-type"]||R["Content-Type"]||(R["Content-Type"]="application/json"),x=JSON.stringify(p.json===!0?x:p.json))),y.onreadystatechange=g,y.onload=b,y.onerror=v,y.onprogress=function(){},y.onabort=function(){S=!0},y.ontimeout=v,y.open(I,E,!T,p.username,p.password),T||(y.withCredentials=!!p.withCredentials),!T&&p.timeout>0&&(k=setTimeout(function(){if(!S){S=!0,y.abort("timeout");var A=new Error("XMLHttpRequest timeout");A.code="ETIMEDOUT",v(A)}},p.timeout)),y.setRequestHeader)for(C in R)R.hasOwnProperty(C)&&y.setRequestHeader(C,R[C]);else if(p.headers&&!s(p.headers))throw new Error("Headers cannot be set on an XDomainRequest object");return"responseType"in p&&(y.responseType=p.responseType),"beforeSend"in p&&typeof p.beforeSend=="function"&&p.beforeSend(y),y.send(x||null),y}function d(p){try{if(p.responseType==="document")return p.responseXML;var h=p.responseXML&&p.responseXML.documentElement.nodeName==="parsererror";if(p.responseType===""&&!h)return p.responseXML}catch{}return null}function f(){}});function fs(e,t,...n){if(!e)throw new TypeError(md(t,n))}function md(e,t){let n=0;return e.replace(/%[os]/gu,()=>gd(t[n++]))}function gd(e){return typeof e!="object"||e===null?String(e):Object.prototype.toString.call(e)}var l0;function u0(e){try{let t=e instanceof Error?e:new Error(gd(e));if(typeof dispatchEvent=="function"&&typeof ErrorEvent=="function")dispatchEvent(new ErrorEvent("error",{error:t,message:t.message}));else if(typeof process<"u"&&typeof process.emit=="function"){process.emit("uncaughtException",t);return}console.error(t)}catch{}}var tt=typeof window<"u"?window:typeof self<"u"?self:typeof global<"u"?global:typeof globalThis<"u"?globalThis:void 0,c0,Tt=class{constructor(e,t){this.code=e,this.message=t}warn(...e){var t;try{let n=((t=new Error().stack)!==null&&t!==void 0?t:"").replace(/^(?:.+?\n){2}/gu,`
38
- `);console.warn(this.message,...e,n)}catch{}}},d0=new Tt("W01","Unable to initialize event under dispatching."),f0=new Tt("W02","Assigning any falsy value to 'cancelBubble' property has no effect."),p0=new Tt("W03","Assigning any truthy value to 'returnValue' property has no effect."),h0=new Tt("W04","Unable to preventDefault on non-cancelable events."),m0=new Tt("W05","Unable to preventDefault inside passive event listener invocation."),g0=new Tt("W06","An event listener wasn't added because it has been added already: %o, %o"),yo=new Tt("W07","The %o option value was abandoned because the event listener wasn't added as duplicated."),Ll=new Tt("W08","The 'callback' argument must be a function or an object that has 'handleEvent' method: %o");new Tt("W09","Event attribute handler must be a function: %o");var Rt=class{static get NONE(){return Ol}static get CAPTURING_PHASE(){return Nl}static get AT_TARGET(){return Dl}static get BUBBLING_PHASE(){return Ul}constructor(e,t){Object.defineProperty(this,"isTrusted",{value:!1,enumerable:!0});let n=t!=null?t:{};ga.set(this,{type:String(e),bubbles:Boolean(n.bubbles),cancelable:Boolean(n.cancelable),composed:Boolean(n.composed),target:null,currentTarget:null,stopPropagationFlag:!1,stopImmediatePropagationFlag:!1,canceledFlag:!1,inPassiveListenerFlag:!1,dispatchFlag:!1,timeStamp:Date.now()})}get type(){return he(this).type}get target(){return he(this).target}get srcElement(){return he(this).target}get currentTarget(){return he(this).currentTarget}composedPath(){let e=he(this).currentTarget;return e?[e]:[]}get NONE(){return Ol}get CAPTURING_PHASE(){return Nl}get AT_TARGET(){return Dl}get BUBBLING_PHASE(){return Ul}get eventPhase(){return he(this).dispatchFlag?2:0}stopPropagation(){he(this).stopPropagationFlag=!0}get cancelBubble(){return he(this).stopPropagationFlag}set cancelBubble(e){e?he(this).stopPropagationFlag=!0:f0.warn()}stopImmediatePropagation(){let e=he(this);e.stopPropagationFlag=e.stopImmediatePropagationFlag=!0}get bubbles(){return he(this).bubbles}get cancelable(){return he(this).cancelable}get returnValue(){return!he(this).canceledFlag}set returnValue(e){e?p0.warn():Pl(he(this))}preventDefault(){Pl(he(this))}get defaultPrevented(){return he(this).canceledFlag}get composed(){return he(this).composed}get isTrusted(){return!1}get timeStamp(){return he(this).timeStamp}initEvent(e,t=!1,n=!1){let r=he(this);if(r.dispatchFlag){d0.warn();return}ga.set(this,{...r,type:String(e),bubbles:Boolean(t),cancelable:Boolean(n),target:null,currentTarget:null,stopPropagationFlag:!1,stopImmediatePropagationFlag:!1,canceledFlag:!1})}},Ol=0,Nl=1,Dl=2,Ul=3,ga=new WeakMap;function he(e,t="this"){let n=ga.get(e);return fs(n!=null,"'%s' must be an object that Event constructor created, but got another one: %o",t,e),n}function Pl(e){if(e.inPassiveListenerFlag){m0.warn();return}if(!e.cancelable){h0.warn();return}e.canceledFlag=!0}Object.defineProperty(Rt,"NONE",{enumerable:!0});Object.defineProperty(Rt,"CAPTURING_PHASE",{enumerable:!0});Object.defineProperty(Rt,"AT_TARGET",{enumerable:!0});Object.defineProperty(Rt,"BUBBLING_PHASE",{enumerable:!0});var _o=Object.getOwnPropertyNames(Rt.prototype);for(let e=0;e<_o.length;++e)_o[e]!=="constructor"&&Object.defineProperty(Rt.prototype,_o[e],{enumerable:!0});typeof tt<"u"&&typeof tt.Event<"u"&&Object.setPrototypeOf(Rt.prototype,tt.Event.prototype);function v0(e){return tt.DOMException?new tt.DOMException(e,"InvalidStateError"):(bn==null&&(bn=class vd extends Error{constructor(n){super(n),Error.captureStackTrace&&Error.captureStackTrace(this,vd)}get code(){return 11}get name(){return"InvalidStateError"}},Object.defineProperties(bn.prototype,{code:{enumerable:!0},name:{enumerable:!0}}),Fl(bn),Fl(bn.prototype)),new bn(e))}var bn,Ml={INDEX_SIZE_ERR:1,DOMSTRING_SIZE_ERR:2,HIERARCHY_REQUEST_ERR:3,WRONG_DOCUMENT_ERR:4,INVALID_CHARACTER_ERR:5,NO_DATA_ALLOWED_ERR:6,NO_MODIFICATION_ALLOWED_ERR:7,NOT_FOUND_ERR:8,NOT_SUPPORTED_ERR:9,INUSE_ATTRIBUTE_ERR:10,INVALID_STATE_ERR:11,SYNTAX_ERR:12,INVALID_MODIFICATION_ERR:13,NAMESPACE_ERR:14,INVALID_ACCESS_ERR:15,VALIDATION_ERR:16,TYPE_MISMATCH_ERR:17,SECURITY_ERR:18,NETWORK_ERR:19,ABORT_ERR:20,URL_MISMATCH_ERR:21,QUOTA_EXCEEDED_ERR:22,TIMEOUT_ERR:23,INVALID_NODE_TYPE_ERR:24,DATA_CLONE_ERR:25};function Fl(e){let t=Object.keys(Ml);for(let n=0;n<t.length;++n){let r=t[n],i=Ml[r];Object.defineProperty(e,r,{get(){return i},configurable:!0,enumerable:!0})}}var Gi=class extends Rt{static wrap(e){return new(_d(e))(e)}constructor(e){super(e.type,{bubbles:e.bubbles,cancelable:e.cancelable,composed:e.composed}),e.cancelBubble&&super.stopPropagation(),e.defaultPrevented&&super.preventDefault(),yd.set(this,{original:e});let t=Object.keys(e);for(let n=0;n<t.length;++n){let r=t[n];r in this||Object.defineProperty(this,r,bd(e,r))}}stopPropagation(){super.stopPropagation();let{original:e}=Dt(this);"stopPropagation"in e&&e.stopPropagation()}get cancelBubble(){return super.cancelBubble}set cancelBubble(e){super.cancelBubble=e;let{original:t}=Dt(this);"cancelBubble"in t&&(t.cancelBubble=e)}stopImmediatePropagation(){super.stopImmediatePropagation();let{original:e}=Dt(this);"stopImmediatePropagation"in e&&e.stopImmediatePropagation()}get returnValue(){return super.returnValue}set returnValue(e){super.returnValue=e;let{original:t}=Dt(this);"returnValue"in t&&(t.returnValue=e)}preventDefault(){super.preventDefault();let{original:e}=Dt(this);"preventDefault"in e&&e.preventDefault()}get timeStamp(){let{original:e}=Dt(this);return"timeStamp"in e?e.timeStamp:super.timeStamp}},yd=new WeakMap;function Dt(e){let t=yd.get(e);return fs(t!=null,"'this' is expected an Event object, but got",e),t}var Oi=new WeakMap;Oi.set(Object.prototype,Gi);typeof tt<"u"&&typeof tt.Event<"u"&&Oi.set(tt.Event.prototype,Gi);function _d(e){let t=Object.getPrototypeOf(e);if(t==null)return Gi;let n=Oi.get(t);return n==null&&(n=y0(_d(t),t),Oi.set(t,n)),n}function y0(e,t){class n extends e{}let r=Object.keys(t);for(let i=0;i<r.length;++i)Object.defineProperty(n.prototype,r[i],bd(t,r[i]));return n}function bd(e,t){let n=Object.getOwnPropertyDescriptor(e,t);return{get(){let r=Dt(this).original,i=r[t];return typeof i=="function"?i.bind(r):i},set(r){let i=Dt(this).original;i[t]=r},configurable:n.configurable,enumerable:n.enumerable}}function _0(e,t,n,r,i,o){return{callback:e,flags:(t?1:0)|(n?2:0)|(r?4:0),signal:i,signalListener:o}}function b0(e){e.flags|=8}function wd(e){return(e.flags&1)===1}function Cd(e){return(e.flags&2)===2}function Id(e){return(e.flags&4)===4}function w0(e){return(e.flags&8)===8}function C0({callback:e},t,n){try{typeof e=="function"?e.call(t,n):typeof e.handleEvent=="function"&&e.handleEvent(n)}catch(r){u0(r)}}function Ed({listeners:e},t,n){for(let r=0;r<e.length;++r)if(e[r].callback===t&&wd(e[r])===n)return r;return-1}function I0(e,t,n,r,i,o){let a;o&&(a=Sd.bind(null,e,t,n),o.addEventListener("abort",a));let s=_0(t,n,r,i,o,a);return e.cow?(e.cow=!1,e.listeners=[...e.listeners,s]):e.listeners.push(s),s}function Sd(e,t,n){let r=Ed(e,t,n);return r!==-1?kd(e,r):!1}function kd(e,t,n=!1){let r=e.listeners[t];return b0(r),r.signal&&r.signal.removeEventListener("abort",r.signalListener),e.cow&&!n?(e.cow=!1,e.listeners=e.listeners.filter((i,o)=>o!==t),!1):(e.listeners.splice(t,1),!0)}function E0(){return Object.create(null)}function S0(e,t){var n;return(n=e[t])!==null&&n!==void 0?n:e[t]={attrCallback:void 0,attrListener:void 0,cow:!1,listeners:[]}}var Wi=class{constructor(){xd.set(this,E0())}addEventListener(e,t,n){let r=bo(this),{callback:i,capture:o,once:a,passive:s,signal:l,type:u}=k0(e,t,n);if(i==null||(l==null?void 0:l.aborted))return;let c=S0(r,u),d=Ed(c,i,o);if(d!==-1){A0(c.listeners[d],s,a,l);return}I0(c,i,o,s,a,l)}removeEventListener(e,t,n){let r=bo(this),{callback:i,capture:o,type:a}=x0(e,t,n),s=r[a];i!=null&&s&&Sd(s,i,o)}dispatchEvent(e){let t=bo(this)[String(e.type)];if(t==null)return!0;let n=e instanceof Rt?e:Gi.wrap(e),r=he(n,"event");if(r.dispatchFlag)throw v0("This event has been in dispatching.");if(r.dispatchFlag=!0,r.target=r.currentTarget=this,!r.stopPropagationFlag){let{cow:i,listeners:o}=t;t.cow=!0;for(let a=0;a<o.length;++a){let s=o[a];if(!w0(s)&&(Id(s)&&kd(t,a,!i)&&(a-=1),r.inPassiveListenerFlag=Cd(s),C0(s,this,n),r.inPassiveListenerFlag=!1,r.stopImmediatePropagationFlag))break}i||(t.cow=!1)}return r.target=null,r.currentTarget=null,r.stopImmediatePropagationFlag=!1,r.stopPropagationFlag=!1,r.dispatchFlag=!1,!r.canceledFlag}},xd=new WeakMap;function bo(e,t="this"){let n=xd.get(e);return fs(n!=null,"'%s' must be an object that EventTarget constructor created, but got another one: %o",t,e),n}function k0(e,t,n){var r;return Ad(t),typeof n=="object"&&n!==null?{type:String(e),callback:t!=null?t:void 0,capture:Boolean(n.capture),passive:Boolean(n.passive),once:Boolean(n.once),signal:(r=n.signal)!==null&&r!==void 0?r:void 0}:{type:String(e),callback:t!=null?t:void 0,capture:Boolean(n),passive:!1,once:!1,signal:void 0}}function x0(e,t,n){return Ad(t),typeof n=="object"&&n!==null?{type:String(e),callback:t!=null?t:void 0,capture:Boolean(n.capture)}:{type:String(e),callback:t!=null?t:void 0,capture:Boolean(n)}}function Ad(e){if(!(typeof e=="function"||typeof e=="object"&&e!==null&&typeof e.handleEvent=="function")){if(e==null||typeof e=="object"){Ll.warn(e);return}throw new TypeError(md(Ll.message,[e]))}}function A0(e,t,n,r){g0.warn(wd(e)?"capture":"bubble",e.callback),Cd(e)!==t&&yo.warn("passive"),Id(e)!==n&&yo.warn("once"),e.signal!==r&&yo.warn("signal")}var wo=Object.getOwnPropertyNames(Wi.prototype);for(let e=0;e<wo.length;++e)wo[e]!=="constructor"&&Object.defineProperty(Wi.prototype,wo[e],{enumerable:!0});typeof tt<"u"&&typeof tt.EventTarget<"u"&&Object.setPrototypeOf(Wi.prototype,tt.EventTarget.prototype);var T0=n0(s0()),Td=30720,qi=512e3,$i=256,va=(e,{minChunkSize:t=$i,maxChunkSize:n=qi}={})=>e==null||typeof e=="number"&&e>=256&&e%256===0&&e>=t&&e<=n,ya=(e,{minChunkSize:t=$i,maxChunkSize:n=qi}={})=>new TypeError(`chunkSize ${e} must be a positive number in multiples of 256, between ${t} and ${n}`),R0=class{constructor(e,t={}){this.readableStream=e;var n,r,i;if(!va(t.defaultChunkSize,t))throw ya(t.defaultChunkSize,t);this.defaultChunkSize=(n=t.defaultChunkSize)!=null?n:Td,this.minChunkSize=(r=t.minChunkSize)!=null?r:$i,this.maxChunkSize=(i=t.maxChunkSize)!=null?i:qi}get chunkSize(){var e;return(e=this._chunkSize)!=null?e:this.defaultChunkSize}set chunkSize(e){if(!va(e,this))throw ya(e,this);this._chunkSize=e}get chunkByteSize(){return this.chunkSize*1024}async*[Symbol.asyncIterator](){let e,t=this.readableStream.getReader();try{for(;;){let{done:n,value:r}=await t.read();if(n){if(e){let o=e;e=void 0,yield o}break}let i=r instanceof Uint8Array?new Blob([r],{type:"application/octet-stream"}):r;for(e=e?new Blob([e,i]):i;e;)if(e.size===this.chunkByteSize){let o=e;e=void 0,yield o;break}else{if(e.size<this.chunkByteSize)break;{let o=e.slice(0,this.chunkByteSize);e=e.slice(this.chunkByteSize),yield o}}}}finally{if(e){let n=e;e=void 0,yield n}t.releaseLock();return}}},L0=[200,201,202,204,308],Rd=[408,502,503,504],Ld=(e,t)=>!!e&&L0.includes(e.statusCode),O0=(e,{retryCodes:t=Rd})=>!e||t.includes(e.statusCode),N0=(e,t)=>t.attemptCount>=t.attempts||!(Ld(e)||O0(e,t)),Od=class{static createUpload(e){return new Od(e)}constructor(e){this.endpoint=e.endpoint,this.file=e.file,this.headers=e.headers||{},this.method=e.method||"PUT",this.attempts=e.attempts||5,this.delayBeforeAttempt=e.delayBeforeAttempt||1,this.retryCodes=e.retryCodes||Rd,this.dynamicChunkSize=e.dynamicChunkSize||!1,this.maxFileBytes=(e.maxFileSize||0)*1024,this.chunkCount=0,this.attemptCount=0,this.offline=!1,this._paused=!1,this.success=!1,this.nextChunkRangeStart=0,this.chunkedStreamIterable=new R0(this.file.stream(),{...e,defaultChunkSize:e.chunkSize}),this.chunkedStreamIterator=this.chunkedStreamIterable[Symbol.asyncIterator](),this.totalChunks=Math.ceil(this.file.size/this.chunkByteSize),this.eventTarget=new Wi,this.validateOptions(),this.getEndpoint().then(()=>this.sendChunks()),typeof window<"u"&&(window.addEventListener("online",()=>{!this.offline||(this.offline=!1,this.dispatch("online"),this.sendChunks())}),window.addEventListener("offline",()=>{this.offline=!0,this.dispatch("offline")}))}get maxChunkSize(){var e,t;return(t=(e=this.chunkedStreamIterable)==null?void 0:e.maxChunkSize)!=null?t:qi}get minChunkSize(){var e,t;return(t=(e=this.chunkedStreamIterable)==null?void 0:e.minChunkSize)!=null?t:$i}get chunkSize(){var e,t;return(t=(e=this.chunkedStreamIterable)==null?void 0:e.chunkSize)!=null?t:Td}set chunkSize(e){this.chunkedStreamIterable.chunkSize=e}get chunkByteSize(){return this.chunkedStreamIterable.chunkByteSize}get totalChunkSize(){return Math.ceil(this.file.size/this.chunkByteSize)}on(e,t){this.eventTarget.addEventListener(e,t)}once(e,t){this.eventTarget.addEventListener(e,t,{once:!0})}off(e,t){this.eventTarget.removeEventListener(e,t)}get paused(){return this._paused}abort(){var e;this.pause(),(e=this.currentXhr)==null||e.abort()}pause(){this._paused=!0}resume(){this._paused&&(this._paused=!1,this.sendChunks())}dispatch(e,t){let n=new CustomEvent(e,{detail:t});this.eventTarget.dispatchEvent(n)}validateOptions(){if(!this.endpoint||typeof this.endpoint!="function"&&typeof this.endpoint!="string")throw new TypeError("endpoint must be defined as a string or a function that returns a promise");if(!(this.file instanceof File))throw new TypeError("file must be a File object");if(this.headers&&typeof this.headers!="function"&&typeof this.headers!="object")throw new TypeError("headers must be null, an object, or a function that returns an object or a promise");if(!va(this.chunkSize,{maxChunkSize:this.maxChunkSize,minChunkSize:this.minChunkSize}))throw ya(this.chunkSize,{maxChunkSize:this.maxChunkSize,minChunkSize:this.minChunkSize});if(this.maxChunkSize&&(typeof this.maxChunkSize!="number"||this.maxChunkSize<256||this.maxChunkSize%256!==0||this.maxChunkSize<this.chunkSize||this.maxChunkSize<this.minChunkSize))throw new TypeError(`maxChunkSize must be a positive number in multiples of 256, and larger than or equal to both ${this.minChunkSize} and ${this.chunkSize}`);if(this.minChunkSize&&(typeof this.minChunkSize!="number"||this.minChunkSize<256||this.minChunkSize%256!==0||this.minChunkSize>this.chunkSize||this.minChunkSize>this.maxChunkSize))throw new TypeError(`minChunkSize must be a positive number in multiples of 256, and smaller than ${this.chunkSize} and ${this.maxChunkSize}`);if(this.maxFileBytes>0&&this.maxFileBytes<this.file.size)throw new Error(`file size exceeds maximum (${this.file.size} > ${this.maxFileBytes})`);if(this.attempts&&(typeof this.attempts!="number"||this.attempts<=0))throw new TypeError("retries must be a positive number");if(this.delayBeforeAttempt&&(typeof this.delayBeforeAttempt!="number"||this.delayBeforeAttempt<0))throw new TypeError("delayBeforeAttempt must be a positive number")}getEndpoint(){return typeof this.endpoint=="string"?(this.endpointValue=this.endpoint,Promise.resolve(this.endpoint)):this.endpoint(this.file).then(e=>(this.endpointValue=e,this.endpointValue))}xhrPromise(e){let t=n=>{n.upload.onprogress=r=>{var i;let o=this.totalChunks-this.chunkCount,a=(this.file.size-this.nextChunkRangeStart)/this.file.size/o,s=this.nextChunkRangeStart/this.file.size,l=r.loaded/((i=r.total)!=null?i:this.chunkByteSize)*a;this.dispatch("progress",Math.min((s+l)*100,100))}};return new Promise((n,r)=>{this.currentXhr=(0,T0.default)({...e,beforeSend:t},(i,o)=>(this.currentXhr=void 0,i?r(i):n(o)))})}async sendChunk(e){let t=this.nextChunkRangeStart,n=t+e.size-1,r={...await(typeof this.headers=="function"?this.headers():this.headers),"Content-Type":this.file.type,"Content-Range":`bytes ${t}-${n}/${this.file.size}`};return this.dispatch("attempt",{chunkNumber:this.chunkCount,totalChunks:this.totalChunks,chunkSize:this.chunkSize}),this.xhrPromise({headers:r,url:this.endpointValue,method:this.method,body:e})}async sendChunkWithRetries(e){let t=async(a,s)=>{var l;let u=(new Date().getTime()-this.lastChunkStart.getTime())/1e3;if(this.dispatch("chunkSuccess",{chunk:this.chunkCount,chunkSize:this.chunkSize,attempts:this.attemptCount,timeInterval:u,response:a}),this.attemptCount=0,this.chunkCount=((l=this.chunkCount)!=null?l:0)+1,this.nextChunkRangeStart=this.nextChunkRangeStart+this.chunkByteSize,this.dynamicChunkSize){let c=this.chunkSize;u<10?c=Math.min(this.chunkSize*2,this.maxChunkSize):u>30&&(c=Math.max(this.chunkSize/2,this.minChunkSize)),this.chunkSize=Math.ceil(c/256)*256;let d=(this.file.size-this.nextChunkRangeStart)/this.chunkByteSize;this.totalChunks=Math.ceil(this.chunkCount+d)}return!0},n=async(a,s)=>(this.dispatch("error",{message:`Server responded with ${a.statusCode}. Stopping upload.`,chunk:this.chunkCount,attempts:this.attemptCount}),!1),r=async(a,s)=>(this.dispatch("attemptFailure",{message:`An error occured uploading chunk ${this.chunkCount}. ${this.attempts-this.attemptCount} retries left.`,chunkNumber:this.chunkCount,attemptsLeft:this.attempts-this.attemptCount}),new Promise(l=>{setTimeout(async()=>{if(this._paused||this.offline){this.pendingChunk=e,l(!1);return}let u=await this.sendChunkWithRetries(e);l(u)},this.delayBeforeAttempt*1e3)})),i;try{this.attemptCount=this.attemptCount+1,this.lastChunkStart=new Date,i=await this.sendChunk(e)}catch{}let o={retryCodes:this.retryCodes,attemptCount:this.attemptCount,attempts:this.attempts};return Ld(i)?t(i):N0(i,o)?n(i):r()}async sendChunks(){if(this.pendingChunk&&!(this._paused||this.offline)){let e=this.pendingChunk;this.pendingChunk=void 0;let t=await this.sendChunkWithRetries(e);this.success&&t&&this.dispatch("success")}for(;!(this.success||this._paused||this.offline);){let{value:e,done:t}=await this.chunkedStreamIterator.next(),n=!e&&t;if(e&&(n=await this.sendChunkWithRetries(e)),this.success=!!t,this.success&&n&&this.dispatch("success"),!n)return}}},D0=Od.createUpload,Qe=(e=>(e.Video="video",e.Audio="audio",e.Screen="screen",e))(Qe||{}),Ae=(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))(Ae||{}),Ge=(e=>(e.Abandoned="abandoned",e.GivenUp="given.up",e.Completed="completed",e))(Ge||{}),W=(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))(W||{});const Vl=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},U0=e=>e?Vl(e):Vl;var qt,ae,Co,Bl,Vn=0,Nd=[],oi=[],jl=P.__b,Hl=P.__r,zl=P.diffed,Kl=P.__c,Gl=P.unmount;function hn(e,t){P.__h&&P.__h(ae,e,Vn||t),Vn=0;var n=ae.__H||(ae.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({__V:oi}),n.__[e]}function ke(e){return Vn=1,ps(Fd,e)}function ps(e,t,n){var r=hn(qt++,2);if(r.t=e,!r.__c&&(r.__=[n?n(t):Fd(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=ae,!ae.u)){ae.u=!0;var i=ae.shouldComponentUpdate;ae.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 We(e,t){var n=hn(qt++,3);!P.__s&&ms(n.__H,t)&&(n.__=e,n.i=t,ae.__H.__h.push(n))}function Ur(e,t){var n=hn(qt++,4);!P.__s&&ms(n.__H,t)&&(n.__=e,n.i=t,ae.__h.push(n))}function Gt(e){return Vn=5,Zi(function(){return{current:e}},[])}function Dd(e,t,n){Vn=6,Ur(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 Zi(e,t){var n=hn(qt++,7);return ms(n.__H,t)?(n.__V=e(),n.i=t,n.__h=e,n.__V):n.__}function Ud(e,t){return Vn=8,Zi(function(){return e},t)}function Pd(e){var t=ae.context[e.__c],n=hn(qt++,9);return n.c=e,t?(n.__==null&&(n.__=!0,t.sub(ae)),t.props.value):e.__}function hs(e,t){P.useDebugValue&&P.useDebugValue(t?t(e):e)}function P0(e){var t=hn(qt++,10),n=ke();return t.__=e,ae.componentDidCatch||(ae.componentDidCatch=function(r,i){t.__&&t.__(r,i),n[1](r)}),[n[0],function(){n[1](void 0)}]}function Md(){var e=hn(qt++,11);if(!e.__){for(var t=ae.__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 M0(){for(var e;e=Nd.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach(ai),e.__H.__h.forEach(_a),e.__H.__h=[]}catch(t){e.__H.__h=[],P.__e(t,e.__v)}}P.__b=function(e){ae=null,jl&&jl(e)},P.__r=function(e){Hl&&Hl(e),qt=0;var t=(ae=e.__c).__H;t&&(Co===ae?(t.__h=[],ae.__h=[],t.__.forEach(function(n){n.__N&&(n.__=n.__N),n.__V=oi,n.__N=n.i=void 0})):(t.__h.forEach(ai),t.__h.forEach(_a),t.__h=[])),Co=ae},P.diffed=function(e){zl&&zl(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(Nd.push(t)!==1&&Bl===P.requestAnimationFrame||((Bl=P.requestAnimationFrame)||F0)(M0)),t.__H.__.forEach(function(n){n.i&&(n.__H=n.i),n.__V!==oi&&(n.__=n.__V),n.i=void 0,n.__V=oi})),Co=ae=null},P.__c=function(e,t){t.some(function(n){try{n.__h.forEach(ai),n.__h=n.__h.filter(function(r){return!r.__||_a(r)})}catch(r){t.some(function(i){i.__h&&(i.__h=[])}),t=[],P.__e(r,n.__v)}}),Kl&&Kl(e,t)},P.unmount=function(e){Gl&&Gl(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.forEach(function(r){try{ai(r)}catch(i){t=i}}),n.__H=void 0,t&&P.__e(t,n.__v))};var Wl=typeof requestAnimationFrame=="function";function F0(e){var t,n=function(){clearTimeout(r),Wl&&cancelAnimationFrame(t),setTimeout(e)},r=setTimeout(n,100);Wl&&(t=requestAnimationFrame(n))}function ai(e){var t=ae,n=e.__c;typeof n=="function"&&(e.__c=void 0,n()),ae=t}function _a(e){var t=ae;e.__c=e.__(),ae=t}function ms(e,t){return!e||e.length!==t.length||t.some(function(n,r){return n!==e[r]})}function Fd(e,t){return typeof t=="function"?t(e):t}function Vd(e,t){for(var n in t)e[n]=t[n];return e}function ba(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 Io(e,t){return e===t&&(e!==0||1/e==1/t)||e!=e&&t!=t}function Ni(e){this.props=e}function Bd(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:ba(this.props,i)}function r(i){return this.shouldComponentUpdate=n,pe(e,i)}return r.displayName="Memo("+(e.displayName||e.name)+")",r.prototype.isReactComponent=!0,r.__f=!0,r}(Ni.prototype=new et).isPureReactComponent=!0,Ni.prototype.shouldComponentUpdate=function(e,t){return ba(this.props,e)||ba(this.state,t)};var ql=P.__b;P.__b=function(e){e.type&&e.type.__f&&e.ref&&(e.props.ref=e.ref,e.ref=null),ql&&ql(e)};var V0=typeof Symbol<"u"&&Symbol.for&&Symbol.for("react.forward_ref")||3911;function jd(e){function t(n){var r=Vd({},n);return delete r.ref,e(r,n.ref||null)}return t.$$typeof=V0,t.render=t,t.prototype.isReactComponent=t.__f=!0,t.displayName="ForwardRef("+(e.displayName||e.name)+")",t}var $l=function(e,t){return e==null?null:kt(kt(e).map(t))},Hd={map:$l,forEach:$l,count:function(e){return e?kt(e).length:0},only:function(e){var t=kt(e);if(t.length!==1)throw"Children.only";return t[0]},toArray:kt},B0=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)}B0(e,t,n,r)};var Zl=P.unmount;function zd(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=Vd({},e)).__c!=null&&(e.__c.__P===n&&(e.__c.__P=t),e.__c=null),e.__k=e.__k&&e.__k.map(function(r){return zd(r,t,n)})),e}function Kd(e,t,n){return e&&(e.__v=null,e.__k=e.__k&&e.__k.map(function(r){return Kd(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 lr(){this.__u=0,this.t=null,this.__b=null}function Gd(e){var t=e.__.__c;return t&&t.__a&&t.__a(e)}function Wd(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 pe(n,o)}return i.displayName="Lazy",i.__f=!0,i}function kn(){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),Zl&&Zl(e)},(lr.prototype=new et).__c=function(e,t){var n=t.__c,r=this;r.t==null&&(r.t=[]),r.t.push(n);var i=Gd(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]=Kd(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)},lr.prototype.componentWillUnmount=function(){this.t=[]},lr.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]=zd(this.__b,n,r.__O=r.__P)}this.__b=null}var i=t.__a&&pe(nt,null,e.fallback);return i&&(i.__h=null),[pe(nt,null,t.__a?null:e.children),i]};var Yl=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 j0(e){return this.getChildContext=function(){return e.context},e.children}function H0(e){var t=this,n=e.i;t.componentWillUnmount=function(){Mn(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)}}),Mn(pe(j0,{context:t.context},e.__v),t.l)):t.l&&t.componentWillUnmount()}function qd(e,t){var n=pe(H0,{__v:e,i:t});return n.containerInfo=t,n}(kn.prototype=new et).__a=function(e){var t=this,n=Gd(t.__v),r=t.o.get(e);return r[0]++,function(i){var o=function(){t.props.revealOrder?(r.push(i),Yl(t,e,r)):i()};n?n(o):o()}},kn.prototype.render=function(e){this.u=null,this.o=new Map;var t=kt(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},kn.prototype.componentDidUpdate=kn.prototype.componentDidMount=function(){var e=this;this.o.forEach(function(t,n){Yl(e,n,t)})};var $d=typeof Symbol<"u"&&Symbol.for&&Symbol.for("react.element")||60103,z0=/^(?: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]/,K0=typeof document<"u",G0=function(e){return(typeof Symbol<"u"&&typeof Symbol()=="symbol"?/fil|che|rad/i:/fil|che|ra/i).test(e)};function Zd(e,t,n){return t.__k==null&&(t.textContent=""),Mn(e,t),typeof n=="function"&&n(),e?e.__c:null}function Yd(e,t,n){return fd(e,t),typeof n=="function"&&n(),e?e.__c:null}et.prototype.isReactComponent={},["componentWillMount","componentWillReceiveProps","componentWillUpdate"].forEach(function(e){Object.defineProperty(et.prototype,e,{configurable:!0,get:function(){return this["UNSAFE_"+e]},set:function(t){Object.defineProperty(this,e,{configurable:!0,writable:!0,value:t})}})});var Ql=P.event;function W0(){}function q0(){return this.cancelBubble}function $0(){return this.defaultPrevented}P.event=function(e){return Ql&&(e=Ql(e)),e.persist=W0,e.isPropagationStopped=q0,e.isDefaultPrevented=$0,e.nativeEvent=e};var Qd,Xl={configurable:!0,get:function(){return this.class}},Jl=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];K0&&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)&&!G0(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&&z0.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=kt(n.children).forEach(function(s){s.props.selected=r.value.indexOf(s.props.value)!=-1})),t=="select"&&r.defaultValue!=null&&(r.value=kt(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&&(Xl.enumerable="className"in n,n.className!=null&&(r.class=n.className),Object.defineProperty(r,"className",Xl))}e.$$typeof=$d,Jl&&Jl(e)};var eu=P.__r;P.__r=function(e){eu&&eu(e),Qd=e.__c};var Xd={ReactCurrentDispatcher:{current:{readContext:function(e){return Qd.__n[e.__c].props.value}}}},Z0="17.0.2";function Jd(e){return pe.bind(null,e)}function gs(e){return!!e&&e.$$typeof===$d}function ef(e){return gs(e)?Zy.apply(null,arguments):e}function tf(e){return!!e.__k&&(Mn(null,e),!0)}function nf(e){return e&&(e.base||e.nodeType===1&&e)||null}var rf=function(e,t){return e(t)},of=function(e,t){return e(t)},af=nt;function vs(e){e()}function sf(e){return e}function lf(){return[!1,vs]}var uf=Ur;function cf(e,t){var n=t(),r=ke({h:{__:n,v:t}}),i=r[0].h,o=r[1];return Ur(function(){i.__=n,i.v=t,Io(i.__,t())||o({h:i})},[e,n,t]),We(function(){return Io(i.__,i.v())||o({h:i}),e(function(){Io(i.__,i.v())||o({h:i})})},[e]),n}var Y0={useState:ke,useId:Md,useReducer:ps,useEffect:We,useLayoutEffect:Ur,useInsertionEffect:uf,useTransition:lf,useDeferredValue:sf,useSyncExternalStore:cf,startTransition:vs,useRef:Gt,useImperativeHandle:Dd,useMemo:Zi,useCallback:Ud,useContext:Pd,useDebugValue:hs,version:"17.0.2",Children:Hd,render:Zd,hydrate:Yd,unmountComponentAtNode:tf,createPortal:qd,createElement:pe,createContext:pd,createFactory:Jd,cloneElement:ef,createRef:rd,Fragment:nt,isValidElement:gs,findDOMNode:nf,Component:et,PureComponent:Ni,memo:Bd,forwardRef:jd,flushSync:of,unstable_batchedUpdates:rf,StrictMode:af,Suspense:lr,SuspenseList:kn,lazy:Wd,__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED:Xd};const Q0=Object.freeze(Object.defineProperty({__proto__:null,Children:Hd,PureComponent:Ni,StrictMode:af,Suspense:lr,SuspenseList:kn,__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED:Xd,cloneElement:ef,createFactory:Jd,createPortal:qd,default:Y0,findDOMNode:nf,flushSync:of,forwardRef:jd,hydrate:Yd,isValidElement:gs,lazy:Wd,memo:Bd,render:Zd,startTransition:vs,unmountComponentAtNode:tf,unstable_batchedUpdates:rf,useDeferredValue:sf,useInsertionEffect:uf,useSyncExternalStore:cf,useTransition:lf,version:Z0,Component:et,Fragment:nt,createContext:pd,createElement:pe,createRef:rd,useCallback:Ud,useContext:Pd,useDebugValue:hs,useEffect:We,useErrorBoundary:P0,useId:Md,useImperativeHandle:Dd,useLayoutEffect:Ur,useMemo:Zi,useReducer:ps,useRef:Gt,useState:ke},Symbol.toStringTag,{value:"Module"}));var df={exports:{}},ff={};const pf=Xf(Q0);var hf={exports:{}},mf={};/**
15
+ `).slice(t).filter(yl).map(function(r){return`
16
+ `+r}).join("")):""}var ap=["Modify","Bulk","OpenFailed","VersionChange","Schema","Upgrade","InvalidTable","MissingAPI","NoSuchDatabase","InvalidArgument","SubTransaction","Unsupported","Internal","DatabaseClosed","PrematureCommit","ForeignAwait"],_l=["Unknown","Constraint","Data","TransactionInactive","ReadOnly","Version","NotFound","InvalidState","InvalidAccess","Abort","Timeout","QuotaExceeded","Syntax","DataClone"],Oo=ap.concat(_l),sp={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 dn(e,t){this._e=Ft(),this.name=e,this.message=t}cn(dn).from(Error).extend({stack:{get:function(){return this._stack||(this._stack=this.name+": "+this.message+Pi(this._e,2))}},toString:function(){return this.name+": "+this.message}});function wl(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 kr(e,t,n,r){this._e=Ft(),this.failures=t,this.failedKeys=r,this.successCount=n,this.message=wl(e,t)}cn(kr).from(dn);function Cn(e,t){this._e=Ft(),this.name="BulkError",this.failures=Object.keys(t).map(function(n){return t[n]}),this.failuresByPos=t,this.message=wl(e,t)}cn(Cn).from(dn);var Do=Oo.reduce(function(e,t){return e[t]=t+"Error",e},{}),lp=dn,j=Oo.reduce(function(e,t){var n=t+"Error";function r(i,o){this._e=Ft(),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=sp[t]||n,this.inner=null)}return cn(r).from(lp),e[t]=r,e},{});j.Syntax=SyntaxError;j.Type=TypeError;j.Range=RangeError;var Aa=_l.reduce(function(e,t){return e[t+"Error"]=j[t],e},{});function up(e,t){if(!e||e instanceof dn||e instanceof TypeError||e instanceof SyntaxError||!e.name||!Aa[e.name])return e;var n=new Aa[e.name](t||e.message,e);return"stack"in e&&st(n,"stack",{get:function(){return this.inner.stack}}),n}var Gr=Oo.reduce(function(e,t){return["Syntax","Type","Range"].indexOf(t)===-1&&(e[t+"Error"]=j[t]),e},{});Gr.ModifyError=kr;Gr.DexieError=dn;Gr.BulkError=Cn;function W(){}function Kn(e){return e}function cp(e,t){return e==null||e===Kn?t:function(n){return t(e(n))}}function Mt(e,t){return function(){e.apply(this,arguments),t.apply(this,arguments)}}function dp(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?Mt(r,this.onsuccess):r),i&&(this.onerror=this.onerror?Mt(i,this.onerror):i),o!==void 0?o:n}}function fp(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?Mt(n,this.onsuccess):n),r&&(this.onerror=this.onerror?Mt(r,this.onerror):r)}}function pp(e,t){return e===W?t:function(n){var r=e.apply(this,arguments);ve(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?Mt(i,this.onsuccess):i),o&&(this.onerror=this.onerror?Mt(o,this.onerror):o),r===void 0?a===void 0?void 0:a:ve(r,a)}}function hp(e,t){return e===W?t:function(){return t.apply(this,arguments)===!1?!1:e.apply(this,arguments)}}function Po(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 Un={},vp=100,mp=20,bl=100,No=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]}(),Ni=No[0],Tr=No[1],Mi=No[2],El=Tr&&Tr.then,cr=Ni&&Ni.constructor,Mo=!!Mi,Vi=!1,gp=Mi?function(){Mi.then(nr)}:Y.setImmediate?setImmediate.bind(null,nr):Y.MutationObserver?function(){var e=document.createElement("div");new MutationObserver(function(){nr(),e=null}).observe(e,{attributes:!0}),e.setAttribute("i","1")}:function(){setTimeout(nr,0)},On=function(e,t){En.push([e,t]),Lr&&(gp(),Lr=!1)},ji=!0,Lr=!0,Dt=[],dr=[],Bi=null,Fi=Kn,Zt={id:"global",global:!0,ref:0,unhandleds:[],onunhandled:Oa,pgp:!1,env:{},finalize:function(){this.unhandleds.forEach(function(e){try{Oa(e[0],e[1])}catch{}})}},N=Zt,En=[],Pt=0,fr=[];function U(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=N;if(ze&&(this._stackHolder=Ft(),this._prev=null,this._numPrev=0),typeof e!="function"){if(e!==Un)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,Sl(this,e)}var Hi={get:function(){var e=N,t=Ar;function n(r,i){var o=this,a=!e.global&&(e!==N||t!==Ar),s=a&&!lt(),l=new U(function(u,c){Vo(o,new xl(Ur(r,e,a,s),Ur(i,e,a,s),u,c,e))});return ze&&kl(l,this),l}return n.prototype=Un,n},set:function(e){st(this,"then",e&&e.prototype===Un?Hi:{get:function(){return e},set:Hi.set})}};nn(U.prototype,{then:Hi,_then:function(e,t){Vo(this,new xl(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):pr(r)}):this.then(null,function(r){return r&&r.name===t?n(r):pr(r)})},finally:function(e){return this.then(function(t){return e(),t},function(t){return e(),pr(t)})},stack:{get:function(){if(this._stack)return this._stack;try{Vi=!0;var e=Il(this,[],mp),t=e.join(`
19
+ From previous: `);return this._state!==null&&(this._stack=t),t}finally{Vi=!1}}},timeout:function(e,t){var n=this;return e<1/0?new U(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(U.prototype,Symbol.toStringTag,"Dexie.Promise");Zt.env=Tl();function xl(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}nn(U,{all:function(){var e=Xe.apply(null,arguments).map(Rr);return new U(function(t,n){e.length===0&&t([]);var r=e.length;e.forEach(function(i,o){return U.resolve(i).then(function(a){e[o]=a,--r||t(e)},n)})})},resolve:function(e){if(e instanceof U)return e;if(e&&typeof e.then=="function")return new U(function(n,r){e.then(n,r)});var t=new U(Un,!0,e);return kl(t,Bi),t},reject:pr,race:function(){var e=Xe.apply(null,arguments).map(Rr);return new U(function(t,n){e.map(function(r){return U.resolve(r).then(t,n)})})},PSD:{get:function(){return N},set:function(e){return N=e}},totalEchoes:{get:function(){return Ar}},newPSD:yt,usePSD:pn,scheduler:{get:function(){return On},set:function(e){On=e}},rejectionMapper:{get:function(){return Fi},set:function(e){Fi=e}},follow:function(e,t){return new U(function(n,r){return yt(function(i,o){var a=N;a.unhandleds=[],a.onunhandled=o,a.finalize=Mt(function(){var s=this;_p(function(){s.unhandleds.length===0?i():o(s.unhandleds[0])})},a.finalize),e()},t,n,r)})}});cr&&(cr.allSettled&&st(U,"allSettled",function(){var e=Xe.apply(null,arguments).map(Rr);return new U(function(t){e.length===0&&t([]);var n=e.length,r=new Array(n);e.forEach(function(i,o){return U.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)})})})}),cr.any&&typeof AggregateError<"u"&&st(U,"any",function(){var e=Xe.apply(null,arguments).map(Rr);return new U(function(t,n){e.length===0&&n(new AggregateError([]));var r=e.length,i=new Array(r);e.forEach(function(o,a){return U.resolve(o).then(function(s){return t(s)},function(s){i[a]=s,--r||n(new AggregateError(i))})})})}));function Sl(e,t){try{t(function(n){if(e._state===null){if(n===e)throw new TypeError("A promise cannot be resolved with itself.");var r=e._lib&&$n();n&&typeof n.then=="function"?Sl(e,function(i,o){n instanceof U?n._then(i,o):n.then(i,o)}):(e._state=!0,e._value=n,Cl(e)),r&&qn()}},Ki.bind(null,e))}catch(n){Ki(e,n)}}function Ki(e,t){if(dr.push(t),e._state===null){var n=e._lib&&$n();t=Fi(t),e._state=!1,e._value=t,ze&&t!==null&&typeof t=="object"&&!t._promise&&Jf(function(){var r=Ro(t,"stack");t._promise=e,st(t,"stack",{get:function(){return Vi?r&&(r.get?r.get.apply(t):r.value):e.stack}})}),wp(e),Cl(e),n&&qn()}}function Cl(e){var t=e._listeners;e._listeners=[];for(var n=0,r=t.length;n<r;++n)Vo(e,t[n]);var i=e._PSD;--i.ref||i.finalize(),Pt===0&&(++Pt,On(function(){--Pt===0&&jo()},[]))}function Vo(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,++Pt,On(yp,[n,e,t])}function yp(e,t,n){try{Bi=t;var r,i=t._value;t._state?r=e(i):(dr.length&&(dr=[]),r=e(i),dr.indexOf(i)===-1&&bp(t)),n.resolve(r)}catch(o){n.reject(o)}finally{Bi=null,--Pt===0&&jo(),--n.psd.ref||n.psd.finalize()}}function Il(e,t,n){if(t.length===n)return t;var r="";if(e._state===!1){var i=e._value,o,a;i!=null?(o=i.name||"Error",a=i.message||i,r=Pi(i,0)):(o=i,a=""),t.push(o+(a?": "+a:"")+r)}return ze&&(r=Pi(e._stackHolder,2),r&&t.indexOf(r)===-1&&t.push(r),e._prev&&Il(e._prev,t,n)),t}function kl(e,t){var n=t?t._numPrev+1:0;n<vp&&(e._prev=t,e._numPrev=n)}function nr(){$n()&&qn()}function $n(){var e=ji;return ji=!1,Lr=!1,e}function qn(){var e,t,n;do for(;En.length>0;)for(e=En,En=[],n=e.length,t=0;t<n;++t){var r=e[t];r[0].apply(null,r[1])}while(En.length>0);ji=!0,Lr=!0}function jo(){var e=Dt;Dt=[],e.forEach(function(r){r._PSD.onunhandled.call(null,r._value,r)});for(var t=fr.slice(0),n=t.length;n;)t[--n]()}function _p(e){function t(){e(),fr.splice(fr.indexOf(t),1)}fr.push(t),++Pt,On(function(){--Pt===0&&jo()},[])}function wp(e){Dt.some(function(t){return t._value===e._value})||Dt.push(e)}function bp(e){for(var t=Dt.length;t;)if(Dt[--t]._value===e._value){Dt.splice(t,1);return}}function pr(e){return new U(Un,!1,e)}function X(e,t){var n=N;return function(){var r=$n(),i=N;try{return _t(n,!0),e.apply(this,arguments)}catch(o){t&&t(o)}finally{_t(i,!1),r&&qn()}}}var fe={awaits:0,echoes:0,id:0},Ep=0,hr=[],si=0,Ar=0,xp=0;function yt(e,t,n,r){var i=N,o=Object.create(i);o.parent=i,o.ref=0,o.global=!1,o.id=++xp;var a=Zt.env;o.env=Mo?{Promise:U,PromiseProp:{value:U,configurable:!0,writable:!0},all:U.all,race:U.race,allSettled:U.allSettled,any:U.any,resolve:U.resolve,reject:U.reject,nthen:Ra(a.nthen,o),gthen:Ra(a.gthen,o)}:{},t&&ve(o,t),++i.ref,o.finalize=function(){--this.parent.ref||this.parent.finalize()};var s=pn(o,e,n,r);return o.ref===0&&o.finalize(),s}function fn(){return fe.id||(fe.id=++Ep),++fe.awaits,fe.echoes+=bl,fe.id}function lt(){return fe.awaits?(--fe.awaits===0&&(fe.id=0),fe.echoes=fe.awaits*bl,!0):!1}(""+El).indexOf("[native code]")===-1&&(fn=lt=W);function Rr(e){return fe.echoes&&e&&e.constructor===cr?(fn(),e.then(function(t){return lt(),t},function(t){return lt(),ie(t)})):e}function Sp(e){++Ar,(!fe.echoes||--fe.echoes===0)&&(fe.echoes=fe.id=0),hr.push(N),_t(e,!0)}function Cp(){var e=hr[hr.length-1];hr.pop(),_t(e,!1)}function _t(e,t){var n=N;if((t?fe.echoes&&(!si++||e!==N):si&&(!--si||e!==N))&&Ll(t?Sp.bind(null,e):Cp),e!==N&&(N=e,n===Zt&&(Zt.env=Tl()),Mo)){var r=Zt.env.Promise,i=e.env;Tr.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 Tl(){var e=Y.Promise;return Mo?{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:Tr.then,gthen:e.prototype.then}:{}}function pn(e,t,n,r,i){var o=N;try{return _t(e,!0),t(n,r,i)}finally{_t(o,!1)}}function Ll(e){El.call(Ni,e)}function Ur(e,t,n,r){return typeof e!="function"?e:function(){var i=N;n&&fn(),_t(t,!0);try{return e.apply(this,arguments)}finally{_t(i,!1),r&&Ll(lt)}}}function Ra(e,t){return function(n,r){return e.call(this,Ur(n,t),Ur(r,t))}}var Ua="unhandledrejection";function Oa(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(Ua,!0,!0),ve(r,i)):Y.CustomEvent&&(r=new CustomEvent(Ua,{detail:i}),ve(r,i)),r&&Y.dispatchEvent&&(dispatchEvent(r),!Y.PromiseRejectionEvent&&Y.onunhandledrejection))try{Y.onunhandledrejection(r)}catch{}ze&&r&&!r.defaultPrevented&&console.warn("Unhandled rejection: "+(e.stack||e))}catch{}}var ie=U.reject;function $i(e,t,n,r){if(!e.idbdb||!e._state.openComplete&&!N.letThrough&&!e._vip){if(e._state.openComplete)return ie(new j.DatabaseClosed(e._state.dbOpenError));if(!e._state.isBeingOpened){if(!e._options.autoOpen)return ie(new j.DatabaseClosed);e.open().catch(W)}return e._state.dbReadyPromise.then(function(){return $i(e,t,n,r)})}else{var i=e._createTransaction(t,n,e._dbSchema);try{i.create(),e._state.PR1398_maxLoop=3}catch(o){return o.name===Do.InvalidState&&e.isOpen()&&--e._state.PR1398_maxLoop>0?(console.warn("Dexie: Need to reopen db"),e._close(),e.open().then(function(){return $i(e,t,n,r)})):ie(o)}return i._promise(t,function(o,a){return yt(function(){return N.trans=i,r(o,a,i)})}).then(function(o){return i._completion.then(function(){return o})})}}var Da="3.2.4",Rt=String.fromCharCode(65535),qi=-1/0,Ye="Invalid key provided. Keys must be of type string, number, Date or Array<string | number | Date>.",Al="String expected.",In=[],zr=typeof navigator<"u"&&/(MSIE|Trident|Edge)/.test(navigator.userAgent),Ip=zr,kp=zr,Rl=function(e){return!/(dexie\.js|dexie\.min\.js)/.test(e)},Wr="__dbnames",li="readonly",ui="readwrite";function Vt(e,t){return e?t?function(){return e.apply(this,arguments)&&t.apply(this,arguments)}:e:t}var Ul={type:3,lower:-1/0,lowerOpen:!1,upper:[[]],upperOpen:!1};function rr(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 Tp=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 j.NotFound("Table "+o+" not part of transaction");return n(c.idbtrans,c)}var s=$n();try{return i&&i.db===this.db?i===N.trans?i._promise(t,a,r):yt(function(){return i._promise(t,a,r)},{trans:i,transless:N.transless||N}):$i(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(pe(t))return new this.db.WhereClause(this,"["+t.join("+")+"]");var n=ne(t);if(n.length===1)return this.where(n[0]).equals(t[n[0]]);var r=this.schema.indexes.concat(this.schema.primKey).filter(function(c){return c.compound&&n.every(function(f){return c.keyPath.indexOf(f)>=0})&&c.keyPath.every(function(f){return n.indexOf(f)>=0})})[0];if(r&&this.db._maxKey!==Rt)return this.where(r.name).equals(r.keyPath.map(function(c){return t[c]}));!r&&ze&&console.warn("The query "+JSON.stringify(t)+" on "+this.name+" would benefit of a "+("compound index ["+n.join("+")+"]"));var i=this.schema.idxByName,o=this.db._deps.indexedDB;function a(c,f){try{return o.cmp(c,f)===0}catch{return!1}}var s=n.reduce(function(c,f){var d=c[0],p=c[1],h=i[f],v=t[f];return[d||h,d||!h?Vt(p,h&&h.multi?function(m){var _=ot(m,f);return pe(_)&&_.some(function(y){return a(v,y)})}:function(m){return a(v,ot(m,f))}):p]},[null,null]),l=s[0],u=s[1];return l?this.where(l.name).equals(t[l.keyPath]).filter(u):r?this.filter(u):this.where(n).equals("")},e.prototype.filter=function(t){return this.toCollection().and(t)},e.prototype.count=function(t){return this.toCollection().count(t)},e.prototype.offset=function(t){return this.toCollection().offset(t)},e.prototype.limit=function(t){return this.toCollection().limit(t)},e.prototype.each=function(t){return this.toCollection().each(t)},e.prototype.toArray=function(t){return this.toCollection().toArray(t)},e.prototype.toCollection=function(){return new this.db.Collection(new this.db.WhereClause(this))},e.prototype.orderBy=function(t){return new this.db.Collection(new this.db.WhereClause(this,pe(t)?"["+t.join("+")+"]":t))},e.prototype.reverse=function(){return this.toCollection().reverse()},e.prototype.mapToClass=function(t){this.schema.mappedClass=t;var n=function(r){if(!r)return r;var i=Object.create(t.prototype);for(var o in r)if(be(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){ve(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=rr(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?U.reject(l.failures[0]):l.lastResult}).then(function(l){if(a)try{Pe(t,a,l)}catch{}return l})},e.prototype.update=function(t,n){if(typeof t=="object"&&!pe(t)){var r=ot(t,this.schema.primKey.keyPath);if(r===void 0)return ie(new j.InvalidArgument("Given object does not contain its primary key"));try{typeof n!="function"?ne(n).forEach(function(i){Pe(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=rr(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?U.reject(l.failures[0]):l.lastResult}).then(function(l){if(a)try{Pe(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?U.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:Ul})}).then(function(n){return n.numFailures?U.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 f=t.length,d=c&&u?t.map(rr(c)):t;return i.core.mutate({trans:s,type:"add",keys:o,values:d,wantResults:a}).then(function(p){var h=p.numFailures,v=p.results,m=p.lastResult,_=p.failures,y=a?v:m;if(h===0)return y;throw new Cn(i.name+".bulkAdd(): "+h+" of "+f+" 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 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 f=t.length,d=c&&u?t.map(rr(c)):t;return i.core.mutate({trans:s,type:"put",keys:o,values:d,wantResults:a}).then(function(p){var h=p.numFailures,v=p.results,m=p.lastResult,_=p.failures,y=a?v:m;if(h===0)return y;throw new Cn(i.name+".bulkPut(): "+h+" of "+f+" 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=hp),u||(u=W);var c={subscribers:[],fire:u,subscribe:function(f){c.subscribers.indexOf(f)===-1&&(c.subscribers.push(f),c.fire=l(c.fire,f))},unsubscribe:function(f){c.subscribers=c.subscribers.filter(function(d){return d!==f}),c.fire=c.subscribers.reduce(l,u)}};return t[s]=n[s]=c,c}function a(s){ne(s).forEach(function(l){var u=s[l];if(pe(u))o(l,s[l][0],s[l][1]);else if(u==="asap")var c=o(l,Kn,function(){for(var d=arguments.length,p=new Array(d);d--;)p[d]=arguments[d];c.subscribers.forEach(function(h){fl(function(){h.apply(null,p)})})});else throw new j.InvalidArgument("Invalid event config")})}}function zn(e,t){return cn(t).from({prototype:e}),t}function Lp(e){return zn(Tp.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:[dp,W],reading:[cp,Kn],updating:[pp,W],deleting:[fp,W]})})}function $t(e,t){return!(e.filter||e.algorithm||e.or)&&(t?e.justLimit:!e.replayFilter)}function ci(e,t){e.filter=Vt(e.filter,t)}function di(e,t,n){var r=e.replayFilter;e.replayFilter=r?function(){return Vt(r(),t())}:t,e.justLimit=n&&!r}function Ap(e,t){e.isMatch=Vt(e.isMatch,t)}function vr(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 Pa(e,t,n){var r=vr(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 ir(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(d){return l.stop(d)},function(d){return l.fail(d)})){var c=l.primaryKey,f=""+c;f==="[object ArrayBuffer]"&&(f=""+new Uint8Array(c)),be(o,f)||(o[f]=!0,t(s,l,u))}};return Promise.all([e.or._iterate(a,n),Na(Pa(e,r,n),e.algorithm,a,!e.keysOnly&&e.valueMapper)])}else return Na(Pa(e,r,n),Vt(e.algorithm,i),t,!e.keysOnly&&e.valueMapper)}function Na(e,t,n,r){var i=r?function(a,s,l){return n(r(a),s,l)}:n,o=X(i);return e.then(function(a){if(a)return a.start(function(){var s=function(){return a.continue()};(!t||t(a,function(l){return s=l},function(l){a.stop(l),s=W},function(l){a.fail(l),s=W}))&&o(a.value,a,function(l){return s=l}),s()})})}function he(e,t){try{var n=Ma(e),r=Ma(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 Up(Va(e),Va(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=he(e[o],t[o]);if(a!==0)return a}return n===r?0:n<r?-1:1}function Up(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 Ma(e){var t=typeof e;if(t!=="object")return t;if(ArrayBuffer.isView(e))return"binary";var n=Oi(e);return n==="ArrayBuffer"?"binary":n}function Va(e){return e instanceof Uint8Array?e:ArrayBuffer.isView(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):new Uint8Array(e)}var Op=function(){function e(){}return e.prototype._read=function(t,n){var r=this._ctx;return r.error?r.table._trans(null,ie.bind(null,r.error)):r.table._trans("readonly",t).then(n)},e.prototype._write=function(t){var n=this._ctx;return n.error?n.table._trans(null,ie.bind(null,n.error)):n.table._trans("readwrite",t,"locked")},e.prototype._addAlgorithm=function(t){var n=this._ctx;n.algorithm=Vt(n.algorithm,t)},e.prototype._iterate=function(t,n){return ir(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&&ve(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 ir(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($t(i,!0))return o.count({trans:r,query:{index:vr(i,o.schema),range:i.range}}).then(function(s){return Math.min(s,i.limit)});var a=0;return ir(i,function(){return++a,!1},r,o).then(function(){return a})}).then(t)},e.prototype.sortBy=function(t,n){var r=t.split(".").reverse(),i=r[0],o=r.length-1;function a(u,c){return c?a(u[r[c]],c-1):u[i]}var s=this._ctx.dir==="next"?1:-1;function l(u,c){var f=a(u,o),d=a(c,o);return f<d?-s:f>d?s:0}return this.toArray(function(u){return u.sort(l)}).then(n)},e.prototype.toArray=function(t){var n=this;return this._read(function(r){var i=n._ctx;if(i.dir==="next"&&$t(i,!0)&&i.limit>0){var o=i.valueMapper,a=vr(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 ir(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,$t(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)}),Ap(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"&&$t(n,!0)&&n.limit>0)return this._read(function(i){var o=vr(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=be(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 y=!1,E=0;E<s;++E){var w=a[E],b=t[w];ot(_,w)!==b&&(Pe(_,w,b),y=!0)}return y}}var l=r.table.core,u=l.schema.primaryKey,c=u.outbound,f=u.extractKey,d=n.db._options.modifyChunkSize||200,p=[],h=0,v=[],m=function(_,y){var E=y.failures,w=y.numFailures;h+=_-w;for(var b=0,x=ne(E);b<x.length;b++){var C=x[b];p.push(E[C])}};return n.clone().primaryKeys().then(function(_){var y=function(E){var w=Math.min(d,_.length-E);return l.getMany({trans:i,keys:_.slice(E,E+w),cache:"immutable"}).then(function(b){for(var x=[],C=[],I=c?[]:null,k=[],L=0;L<w;++L){var T=b[L],D={value:Hn(T),primKey:_[E+L]};o.call(D,D.value,D)!==!1&&(D.value==null?k.push(_[E+L]):!c&&he(f(T),f(D.value))!==0?(k.push(_[E+L]),x.push(D.value)):(C.push(D.value),c&&I.push(_[E+L])))}var S=$t(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(V){for(var O in V.failures)k.splice(parseInt(O),1);m(x.length,V)})).then(function(){return(C.length>0||S&&typeof t=="object")&&l.mutate({trans:i,type:"put",keys:I,values:C,criteria:S,changeSpec:typeof t!="function"&&t}).then(function(V){return m(C.length,V)})}).then(function(){return(k.length>0||S&&t===fi)&&l.mutate({trans:i,type:"delete",keys:k,criteria:S}).then(function(V){return m(k.length,V)})}).then(function(){return _.length>E+w&&y(E+d)})})};return y(0).then(function(){if(p.length>0)throw new kr("Error modifying one or more objects",p,h,v);return _.length})})})},e.prototype.delete=function(){var t=this._ctx,n=t.range;return $t(t)&&(t.isPrimKey&&!kp||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 kr("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 Dp(e){return zn(Op.prototype,function(n,r){this.db=e;var i=Ul,o=null;if(r)try{i=r()}catch(u){o=u}var a=n._ctx,s=a.table,l=s.hook.reading.fire;this._ctx={table:s,index:a.index,isPrimKey:!a.index||s.schema.primKey.keyPath&&a.index===s.schema.primKey.name,range:i,keysOnly:!1,dir:"next",unique:"",algorithm:null,filter:null,replayFilter:null,justLimit:!0,isMatch:null,offset:0,limit:1/0,error:o,or:a.or,valueMapper:l!==Kn?l:null}})}function Pp(e,t){return e<t?-1:e===t?0:1}function Np(e,t){return e>t?-1:e===t?0:1}function ye(e,t,n){var r=e instanceof Dl?new e.Collection(e):e;return r._ctx.error=n?new n(t):new TypeError(t),r}function qt(e){return new e.Collection(e,function(){return Ol("")}).limit(0)}function Mp(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 jp(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 or(e,t,n,r){var i,o,a,s,l,u,c,f=n.length;if(!n.every(function(v){return typeof v=="string"}))return ye(e,Al);function d(v){i=Mp(v),o=Vp(v),a=v==="next"?Pp:Np;var m=n.map(function(_){return{lower:o(_),upper:i(_)}}).sort(function(_,y){return a(_.lower,y.lower)});s=m.map(function(_){return _.upper}),l=m.map(function(_){return _.lower}),u=v,c=v==="next"?"":r}d("next");var p=new e.Collection(e,function(){return ct(s[0],l[f-1]+r)});p._ondirectionchange=function(v){d(v)};var h=0;return p._addAlgorithm(function(v,m,_){var y=v.key;if(typeof y!="string")return!1;var E=o(y);if(t(E,l,h))return!0;for(var w=null,b=h;b<f;++b){var x=jp(y,E,s[b],l[b],a,u);x===null&&w===null?h=b+1:(w===null||a(w,x)>0)&&(w=x)}return m(w!==null?function(){v.continue(w+c)}:_),!1}),p}function ct(e,t,n,r){return{type:2,lower:e,upper:t,lowerOpen:n,upperOpen:r}}function Ol(e){return{type:1,lower:e,upper:e}}var Dl=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)?qt(this):new this.Collection(this,function(){return ct(t,n,!r,!i)})}catch{return ye(this,Ye)}},e.prototype.equals=function(t){return t==null?ye(this,Ye):new this.Collection(this,function(){return Ol(t)})},e.prototype.above=function(t){return t==null?ye(this,Ye):new this.Collection(this,function(){return ct(t,void 0,!0)})},e.prototype.aboveOrEqual=function(t){return t==null?ye(this,Ye):new this.Collection(this,function(){return ct(t,void 0,!1)})},e.prototype.below=function(t){return t==null?ye(this,Ye):new this.Collection(this,function(){return ct(void 0,t,!1,!0)})},e.prototype.belowOrEqual=function(t){return t==null?ye(this,Ye):new this.Collection(this,function(){return ct(void 0,t)})},e.prototype.startsWith=function(t){return typeof t!="string"?ye(this,Al):this.between(t,t+Rt,!0,!0)},e.prototype.startsWithIgnoreCase=function(t){return t===""?this.startsWith(t):or(this,function(n,r){return n.indexOf(r[0])===0},[t],Rt)},e.prototype.equalsIgnoreCase=function(t){return or(this,function(n,r){return n===r[0]},[t],"")},e.prototype.anyOfIgnoreCase=function(){var t=Xe.apply(Gt,arguments);return t.length===0?qt(this):or(this,function(n,r){return r.indexOf(n)!==-1},t,"")},e.prototype.startsWithAnyOfIgnoreCase=function(){var t=Xe.apply(Gt,arguments);return t.length===0?qt(this):or(this,function(n,r){return r.some(function(i){return n.indexOf(i)===0})},t,Rt)},e.prototype.anyOf=function(){var t=this,n=Xe.apply(Gt,arguments),r=this._cmp;try{n.sort(r)}catch{return ye(this,Ye)}if(n.length===0)return qt(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([[qi,t],[t,this.db._maxKey]],{includeLowers:!1,includeUppers:!1})},e.prototype.noneOf=function(){var t=Xe.apply(Gt,arguments);if(t.length===0)return new this.Collection(this);try{t.sort(this._ascending)}catch{return ye(this,Ye)}var n=t.reduce(function(r,i){return r?r.concat([[r[r.length-1][1],i]]):[[qi,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 qt(this);if(!t.every(function(b){return b[0]!==void 0&&b[1]!==void 0&&o(b[0],b[1])<=0}))return ye(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 f(b,x){for(var C=0,I=b.length;C<I;++C){var k=b[C];if(i(x[0],k[1])<0&&i(x[1],k[0])>0){k[0]=s(k[0],x[0]),k[1]=l(k[1],x[1]);break}}return C===I&&b.push(x),b}var d=o;function p(b,x){return d(b[0],x[0])}var h;try{h=t.reduce(f,[]),h.sort(p)}catch{return ye(this,Ye)}var v=0,m=c?function(b){return o(b,h[v][1])>0}:function(b){return o(b,h[v][1])>=0},_=u?function(b){return a(b,h[v][0])>0}:function(b){return a(b,h[v][0])>=0};function y(b){return!m(b)&&!_(b)}var E=m,w=new this.Collection(this,function(){return ct(h[0][0],h[h.length-1][1],!u,!c)});return w._ondirectionchange=function(b){b==="next"?(E=m,d=o):(E=_,d=a),h.sort(p)},w._addAlgorithm(function(b,x,C){for(var I=b.key;E(I);)if(++v,v===h.length)return x(C),!1;return y(I)?!0:(r._cmp(I,h[v][1])===0||r._cmp(I,h[v][0])===0||x(function(){d===o?b.continue(h[v][0]):b.continue(h[v][1])}),!1)}),w},e.prototype.startsWithAnyOf=function(){var t=Xe.apply(Gt,arguments);return t.every(function(n){return typeof n=="string"})?t.length===0?qt(this):this.inAnyRange(t.map(function(n){return[n,n+Rt]})):ye(this,"startsWithAnyOf() only works with strings")},e}();function Bp(e){return zn(Dl.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 je(e){return X(function(t){return Dn(t),e(t.target.error),!1})}function Dn(e){e.stopPropagation&&e.stopPropagation(),e.preventDefault&&e.preventDefault()}var Pn="storagemutated",ht="x-storagemutated-1",wt=Gn(null,Pn),Fp=function(){function e(){}return e.prototype._lock=function(){return bn(!N.global),++this._reculock,this._reculock===1&&!N.global&&(N.lockOwnerFor=this),this},e.prototype._unlock=function(){if(bn(!N.global),--this._reculock===0)for(N.global||(N.lockOwnerFor=null);this._blockedFuncs.length>0&&!this._locked();){var t=this._blockedFuncs.shift();try{pn(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(bn(!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 bn(this._completion._state===null),t=this.idbtrans=t||(this.db.core?this.db.core.transaction(this.storeNames,this.mode,{durability:this.chromeTransactionDurability}):r.transaction(this.storeNames,this.mode,{durability:this.chromeTransactionDurability})),t.onerror=X(function(o){Dn(o),n._reject(t.error)}),t.onabort=X(function(o){Dn(o),n.active&&n._reject(new j.Abort(t.error)),n.active=!1,n.on("abort").fire(o)}),t.oncomplete=X(function(){n.active=!1,n._resolve(),"mutatedParts"in t&&wt.storagemutated.fire(t.mutatedParts)}),this},e.prototype._promise=function(t,n,r){var i=this;if(t==="readwrite"&&this.mode!=="readwrite")return ie(new j.ReadOnly("Transaction is readonly"));if(!this.active)return ie(new j.TransactionInactive);if(this._locked())return new U(function(a,s){i._blockedFuncs.push([function(){i._promise(t,n,r).then(a,s)},N])});if(r)return yt(function(){var a=new U(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 U(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=U.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 U(function(a,s){r.then(function(l){return n._waitingQueue.push(X(a.bind(null,l)))},function(l){return n._waitingQueue.push(X(s.bind(null,l)))}).finally(function(){n._waitingFor===o&&(n._waitingFor=null)})})},e.prototype.abort=function(){this.active&&(this.active=!1,this.idbtrans&&this.idbtrans.abort(),this._reject(new j.Abort))},e.prototype.table=function(t){var n=this._memoizedTables||(this._memoizedTables={});if(be(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 Hp(e){return zn(Fp.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 U(function(l,u){s._resolve=l,s._reject=u}),this._completion.then(function(){s.active=!1,s.on.complete.fire()},function(l){var u=s.active;return s.active=!1,s.on.error.fire(l),s.parent?s.parent._reject(l):u&&s.idbtrans&&s.idbtrans.abort(),ie(l)})})}function Gi(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?"++":"")+Pl(t)}}function Pl(e){return typeof e=="string"?e:e?"["+[].join.call(e,"+")+"]":""}function Nl(e,t,n){return{name:e,primKey:t,indexes:n,mappedClass:null,idxByName:pl(n,function(r){return[r.name,r]})}}function Kp(e){return e.length===1?e[0]:e}var Nn=function(e){try{return e.only([[]]),Nn=function(){return[[]]},[[]]}catch{return Nn=function(){return Rt},Rt}};function zi(e){return e==null?function(){}:typeof e=="string"?$p(e):function(t){return ot(t,e)}}function $p(e){var t=e.split(".");return t.length===1?function(n){return n[e]}:function(n){return ot(n,e)}}function ja(e){return[].slice.call(e)}var qp=0;function kn(e){return e==null?":id":typeof e=="string"?e:"["+e.join("+")+"]"}function Gp(e,t,n){function r(f,d){var p=ja(f.objectStoreNames);return{schema:{name:f.name,tables:p.map(function(h){return d.objectStore(h)}).map(function(h){var v=h.keyPath,m=h.autoIncrement,_=pe(v),y=v==null,E={},w={name:h.name,primaryKey:{name:null,isPrimaryKey:!0,outbound:y,compound:_,keyPath:v,autoIncrement:m,unique:!0,extractKey:zi(v)},indexes:ja(h.indexNames).map(function(b){return h.index(b)}).map(function(b){var x=b.name,C=b.unique,I=b.multiEntry,k=b.keyPath,L=pe(k),T={name:x,compound:L,keyPath:k,unique:C,multiEntry:I,extractKey:zi(k)};return E[kn(k)]=T,T}),getIndexByKeyPath:function(b){return E[kn(b)]}};return E[":id"]=w.primaryKey,v!=null&&(E[kn(v)]=w.primaryKey),w})},hasGetAll:p.length>0&&"getAll"in d.objectStore(p[0])&&!(typeof navigator<"u"&&/Safari/.test(navigator.userAgent)&&!/(Chrome\/|Edge\/)/.test(navigator.userAgent)&&[].concat(navigator.userAgent.match(/Safari\/(\d*)/))[1]<604)}}function i(f){if(f.type===3)return null;if(f.type===4)throw new Error("Cannot convert never type to IDBKeyRange");var d=f.lower,p=f.upper,h=f.lowerOpen,v=f.upperOpen,m=d===void 0?p===void 0?null:t.upperBound(p,!!v):p===void 0?t.lowerBound(d,!!h):t.bound(d,p,!!h,!!v);return m}function o(f){var d=f.name;function p(m){var _=m.trans,y=m.type,E=m.keys,w=m.values,b=m.range;return new Promise(function(x,C){x=X(x);var I=_.objectStore(d),k=I.keyPath==null,L=y==="put"||y==="add";if(!L&&y!=="delete"&&y!=="deleteRange")throw new Error("Invalid operation type: "+y);var T=(E||w||{length:1}).length;if(E&&w&&E.length!==w.length)throw new Error("Given keys array must have same length as given values array.");if(T===0)return x({numFailures:0,failures:{},results:[],lastResult:void 0});var D,S=[],V=[],O=0,H=function(Ve){++O,Dn(Ve)};if(y==="deleteRange"){if(b.type===4)return x({numFailures:O,failures:V,results:[],lastResult:void 0});b.type===3?S.push(D=I.clear()):S.push(D=I.delete(i(b)))}else{var ue=L?k?[w,E]:[w,null]:[E,null],ge=ue[0],Me=ue[1];if(L)for(var xe=0;xe<T;++xe)S.push(D=Me&&Me[xe]!==void 0?I[y](ge[xe],Me[xe]):I[y](ge[xe])),D.onerror=H;else for(var xe=0;xe<T;++xe)S.push(D=I[y](ge[xe])),D.onerror=H}var ut=function(Ve){var mn=Ve.target.result;S.forEach(function(Ae,Zn){return Ae.error!=null&&(V[Zn]=Ae.error)}),x({numFailures:O,failures:V,results:y==="delete"?E:S.map(function(Ae){return Ae.result}),lastResult:mn})};D.onerror=function(Ve){H(Ve),ut(Ve)},D.onsuccess=ut})}function h(m){var _=m.trans,y=m.values,E=m.query,w=m.reverse,b=m.unique;return new Promise(function(x,C){x=X(x);var I=E.index,k=E.range,L=_.objectStore(d),T=I.isPrimaryKey?L:L.index(I.name),D=w?b?"prevunique":"prev":b?"nextunique":"next",S=y||!("openKeyCursor"in T)?T.openCursor(i(k),D):T.openKeyCursor(i(k),D);S.onerror=je(C),S.onsuccess=X(function(V){var O=S.result;if(!O){x(null);return}O.___id=++qp,O.done=!1;var H=O.continue.bind(O),ue=O.continuePrimaryKey;ue&&(ue=ue.bind(O));var ge=O.advance.bind(O),Me=function(){throw new Error("Cursor not started")},xe=function(){throw new Error("Cursor not stopped")};O.trans=_,O.stop=O.continue=O.continuePrimaryKey=O.advance=Me,O.fail=X(C),O.next=function(){var ut=this,Ve=1;return this.start(function(){return Ve--?ut.continue():ut.stop()}).then(function(){return ut})},O.start=function(ut){var Ve=new Promise(function(Ae,Zn){Ae=X(Ae),S.onerror=je(Zn),O.fail=Zn,O.stop=function(Ic){O.stop=O.continue=O.continuePrimaryKey=O.advance=xe,Ae(Ic)}}),mn=function(){if(S.result)try{ut()}catch(Ae){O.fail(Ae)}else O.done=!0,O.start=function(){throw new Error("Cursor behind last entry")},O.stop()};return S.onsuccess=X(function(Ae){S.onsuccess=mn,mn()}),O.continue=H,O.continuePrimaryKey=ue,O.advance=ge,mn(),Ve},x(O)},C)})}function v(m){return function(_){return new Promise(function(y,E){y=X(y);var w=_.trans,b=_.values,x=_.limit,C=_.query,I=x===1/0?void 0:x,k=C.index,L=C.range,T=w.objectStore(d),D=k.isPrimaryKey?T:T.index(k.name),S=i(L);if(x===0)return y({result:[]});if(m){var V=b?D.getAll(S,I):D.getAllKeys(S,I);V.onsuccess=function(ge){return y({result:ge.target.result})},V.onerror=je(E)}else{var O=0,H=b||!("openKeyCursor"in D)?D.openCursor(S):D.openKeyCursor(S),ue=[];H.onsuccess=function(ge){var Me=H.result;if(!Me)return y({result:ue});if(ue.push(b?Me.value:Me.primaryKey),++O===x)return y({result:ue});Me.continue()},H.onerror=je(E)}})}}return{name:d,schema:f,mutate:p,getMany:function(m){var _=m.trans,y=m.keys;return new Promise(function(E,w){E=X(E);for(var b=_.objectStore(d),x=y.length,C=new Array(x),I=0,k=0,L,T=function(O){var H=O.target;(C[H._pos]=H.result)!=null,++k===I&&E(C)},D=je(w),S=0;S<x;++S){var V=y[S];V!=null&&(L=b.get(y[S]),L._pos=S,L.onsuccess=T,L.onerror=D,++I)}I===0&&E(C)})},get:function(m){var _=m.trans,y=m.key;return new Promise(function(E,w){E=X(E);var b=_.objectStore(d),x=b.get(y);x.onsuccess=function(C){return E(C.target.result)},x.onerror=je(w)})},query:v(l),openCursor:h,count:function(m){var _=m.query,y=m.trans,E=_.index,w=_.range;return new Promise(function(b,x){var C=y.objectStore(d),I=E.isPrimaryKey?C:C.index(E.name),k=i(w),L=k?I.count(k):I.count();L.onsuccess=X(function(T){return b(T.target.result)}),L.onerror=je(x)})}}}var a=r(e,n),s=a.schema,l=a.hasGetAll,u=s.tables.map(function(f){return o(f)}),c={};return u.forEach(function(f){return c[f.name]=f}),{stack:"dbcore",transaction:e.transaction.bind(e),table:function(f){var d=c[f];if(!d)throw new Error("Table '"+f+"' not found");return c[f]},MIN_KEY:-1/0,MAX_KEY:Nn(t),schema:s}}function zp(e,t){return t.reduce(function(n,r){var i=r.create;return $($({},n),i(n))},e)}function Wp(e,t,n,r){var i=n.IDBKeyRange;n.indexedDB;var o=zp(Gp(t,i,r),e.dbcore);return{dbcore:o}}function Bo(e,t){var n=e._novip,r=t.db,i=Wp(n._middlewares,r,n._deps,t);n.core=i.dbcore,n.tables.forEach(function(o){var a=o.name;n.core.schema.tables.some(function(s){return s.name===a})&&(o.core=n.core.table(a),n[a]instanceof n.Table&&(n[a].core=o.core))})}function Or(e,t,n,r){var i=e._novip;n.forEach(function(o){var a=r[o];t.forEach(function(s){var l=Ro(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){cl(this,o,{value:u,writable:!0,configurable:!0,enumerable:!0})}}):s[o]=new i.Table(o,a))})})}function Wi(e,t){var n=e._novip;t.forEach(function(r){for(var i in r)r[i]instanceof n.Table&&delete r[i]})}function Yp(e,t){return e._cfg.version-t._cfg.version}function Qp(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;yt(function(){N.trans=o,N.transless=s,t===0?(ne(i).forEach(function(l){Fo(n,l,i[l].primKey,i[l].indexes)}),Bo(e,n),U.follow(function(){return e.on.populate.fire(o)}).catch(a)):Zp(e,t,o,n).catch(a)})}function Zp(e,t,n,r){var i=e._novip,o=[],a=i._versions,s=i._dbSchema=Ho(i,i.idbdb,r),l=!1,u=a.filter(function(f){return f._cfg.version>=t});u.forEach(function(f){o.push(function(){var d=s,p=f._cfg.dbschema;Qi(i,d,r),Qi(i,p,r),s=i._dbSchema=p;var h=Ml(d,p);h.add.forEach(function(w){Fo(r,w[0],w[1].primKey,w[1].indexes)}),h.change.forEach(function(w){if(w.recreate)throw new j.Upgrade("Not yet support for changing primary key");var b=r.objectStore(w.name);w.add.forEach(function(x){return Yi(b,x)}),w.change.forEach(function(x){b.deleteIndex(x.name),Yi(b,x)}),w.del.forEach(function(x){return b.deleteIndex(x)})});var v=f._cfg.contentUpgrade;if(v&&f._cfg.version>t){Bo(i,r),n._memoizedTables={},l=!0;var m=hl(p);h.del.forEach(function(w){m[w]=d[w]}),Wi(i,[i.Transaction.prototype]),Or(i,[i.Transaction.prototype],ne(m),m),n.schema=m;var _=Uo(v);_&&fn();var y,E=U.follow(function(){if(y=v(n),y&&_){var w=lt.bind(null,null);y.then(w,w)}});return y&&typeof y.then=="function"?U.resolve(y):E.then(function(){return y})}}),o.push(function(d){if(!l||!Ip){var p=f._cfg.dbschema;Jp(p,d)}Wi(i,[i.Transaction.prototype]),Or(i,[i.Transaction.prototype],i._storeNames,i._dbSchema),n.schema=i._dbSchema})});function c(){return o.length?U.resolve(o.shift()(n.idbtrans)).then(c):U.resolve()}return c().then(function(){Xp(s,r)})}function Ml(e,t){var n={del:[],add:[],change:[]},r;for(r in e)t[r]||n.del.push(r);for(r in t){var i=e[r],o=t[r];if(!i)n.add.push([r,o]);else{var a={name:r,def:o,recreate:!1,del:[],add:[],change:[]};if(""+(i.primKey.keyPath||"")!=""+(o.primKey.keyPath||"")||i.primKey.auto!==o.primKey.auto&&!zr)a.recreate=!0,n.change.push(a);else{var s=i.idxByName,l=o.idxByName,u=void 0;for(u in s)l[u]||a.del.push(u);for(u in l){var c=s[u],f=l[u];c?c.src!==f.src&&a.change.push(f):a.add.push(f)}(a.del.length>0||a.add.length>0||a.change.length>0)&&n.change.push(a)}}}return n}function Fo(e,t,n,r){var i=e.db.createObjectStore(t,n.keyPath?{keyPath:n.keyPath,autoIncrement:n.auto}:{autoIncrement:n.auto});return r.forEach(function(o){return Yi(i,o)}),i}function Xp(e,t){ne(e).forEach(function(n){t.db.objectStoreNames.contains(n)||Fo(t,n,e[n].primKey,e[n].indexes)})}function Jp(e,t){[].slice.call(t.db.objectStoreNames).forEach(function(n){return e[n]==null&&t.db.deleteObjectStore(n)})}function Yi(e,t){e.createIndex(t.name,t.keyPath,{unique:t.unique,multiEntry:t.multi})}function Ho(e,t,n){var r={},i=qr(t.objectStoreNames,0);return i.forEach(function(o){for(var a=n.objectStore(o),s=a.keyPath,l=Gi(Pl(s),s||"",!1,!1,!!a.autoIncrement,s&&typeof s!="string",!0),u=[],c=0;c<a.indexNames.length;++c){var f=a.index(a.indexNames[c]);s=f.keyPath;var d=Gi(f.name,s,!!f.unique,!!f.multiEntry,!1,s&&typeof s!="string",!1);u.push(d)}r[o]=Nl(o,l,u)}),r}function eh(e,t,n){var r=e._novip;r.verno=t.version/10;var i=r._dbSchema=Ho(r,t,n);r._storeNames=qr(t.objectStoreNames,0),Or(r,[r._allTables],ne(i),i)}function th(e,t){var n=Ho(e,e.idbdb,t),r=Ml(n,e._dbSchema);return!(r.add.length||r.change.some(function(i){return i.add.length||i.change.length}))}function Qi(e,t,n){for(var r=e._novip,i=n.db.objectStoreNames,o=0;o<i.length;++o){var a=i[o],s=n.objectStore(a);r._hasGetAll="getAll"in s;for(var l=0;l<s.indexNames.length;++l){var u=s.indexNames[l],c=s.index(u).keyPath,f=typeof c=="string"?c:"["+qr(c).join("+")+"]";if(t[a]){var d=t[a].idxByName[f];d&&(d.name=u,delete t[a].idxByName[f],t[a].idxByName[u]=d)}}}typeof navigator<"u"&&/Safari/.test(navigator.userAgent)&&!/(Chrome\/|Edge\/)/.test(navigator.userAgent)&&Y.WorkerGlobalScope&&Y instanceof Y.WorkerGlobalScope&&[].concat(navigator.userAgent.match(/Safari\/(\d*)/))[1]<604&&(r._hasGetAll=!1)}function nh(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 Gi(r,i||null,/\&/.test(t),/\*/.test(t),/\+\+/.test(t),pe(i),n===0)})}var rh=function(){function e(){}return e.prototype._parseStoresSpec=function(t,n){ne(t).forEach(function(r){if(t[r]!==null){var i=nh(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]=Nl(r,o,i)}})},e.prototype.stores=function(t){var n=this.db;this._cfg.storesSource=this._cfg.storesSource?ve(this._cfg.storesSource,t):t;var r=n._versions,i={},o={};return r.forEach(function(a){ve(i,a._cfg.storesSource),o=a._cfg.dbschema={},a._parseStoresSpec(i,o)}),n._dbSchema=o,Wi(n,[n._allTables,n,n.Transaction.prototype]),Or(n,[n._allTables,n,n.Transaction.prototype,this._cfg.tables],ne(o),o),n._storeNames=ne(o),this},e.prototype.upgrade=function(t){return this._cfg.contentUpgrade=Po(this._cfg.contentUpgrade||W,t),this},e}();function ih(e){return zn(rh.prototype,function(n){this.db=e,this._cfg={version:n,storesSource:null,dbschema:{},tables:{},contentUpgrade:null}})}function Ko(e,t){var n=e._dbNamesDB;return n||(n=e._dbNamesDB=new zo(Wr,{addons:[],indexedDB:e,IDBKeyRange:t}),n.version(1).stores({dbnames:"name"})),n.table("dbnames")}function $o(e){return e&&typeof e.databases=="function"}function oh(e){var t=e.indexedDB,n=e.IDBKeyRange;return $o(t)?Promise.resolve(t.databases()).then(function(r){return r.map(function(i){return i.name}).filter(function(i){return i!==Wr})}):Ko(t,n).toCollection().primaryKeys()}function ah(e,t){var n=e.indexedDB,r=e.IDBKeyRange;!$o(n)&&t!==Wr&&Ko(n,r).put({name:t}).catch(W)}function sh(e,t){var n=e.indexedDB,r=e.IDBKeyRange;!$o(n)&&t!==Wr&&Ko(n,r).delete(t).catch(W)}function Zi(e){return yt(function(){return N.letThrough=!0,e()})}function lh(){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 uh(e){var t=e._state,n=e._deps.indexedDB;if(t.isBeingOpened||e.idbdb)return t.dbReadyPromise.then(function(){return t.dbOpenError?ie(t.dbOpenError):e});ze&&(t.openCanceller._stackHolder=Ft()),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 U.race([r,(typeof navigator>"u"?U.resolve():lh()).then(function(){return new U(function(l,u){if(i(),!n)throw new j.MissingAPI;var c=e.name,f=t.autoSchema?n.open(c):n.open(c,Math.round(e.verno*10));if(!f)throw new j.MissingAPI;f.onerror=je(u),f.onblocked=X(e._fireOnBlocked),f.onupgradeneeded=X(function(d){if(a=f.transaction,t.autoSchema&&!e._options.allowEmptyDB){f.onerror=Dn,a.abort(),f.result.close();var p=n.deleteDatabase(c);p.onsuccess=p.onerror=X(function(){u(new j.NoSuchDatabase("Database "+c+" doesnt exist"))})}else{a.onerror=je(u);var h=d.oldVersion>Math.pow(2,62)?0:d.oldVersion;s=h<1,e._novip.idbdb=f.result,Qp(e,h/10,a,u)}},u),f.onsuccess=X(function(){a=null;var d=e._novip.idbdb=f.result,p=qr(d.objectStoreNames);if(p.length>0)try{var h=d.transaction(Kp(p),"readonly");t.autoSchema?eh(e,d,h):(Qi(e,e._dbSchema,h),th(e,h)||console.warn("Dexie SchemaDiff: Schema was extended without increasing the number passed to db.version(). Some queries may fail.")),Bo(e,h)}catch{}In.push(e),d.onversionchange=X(function(v){t.vcFired=!0,e.on("versionchange").fire(v)}),d.onclose=X(function(v){e.on("close").fire(v)}),s&&ah(e._deps,c),l()},u)})})]).then(function(){return i(),t.onReadyBeingFired=[],U.resolve(Zi(function(){return e.on.ready.fire(e.vip)})).then(function l(){if(t.onReadyBeingFired.length>0){var u=t.onReadyBeingFired.reduce(Po,W);return t.onReadyBeingFired=[],U.resolve(Zi(function(){return u(e.vip)})).then(l)}})}).finally(function(){t.onReadyBeingFired=null,t.isBeingOpened=!1}).then(function(){return e}).catch(function(l){t.dbOpenError=l;try{a&&a.abort()}catch{}return r===t.openCanceller&&e._close(),ie(l)}).finally(function(){t.openComplete=!0,o()})}function Xi(e){var t=function(a){return e.next(a)},n=function(a){return e.throw(a)},r=o(t),i=o(n);function o(a){return function(s){var l=a(s),u=l.value;return l.done?u:!u||typeof u.then!="function"?pe(u)?Promise.all(u).then(r,i):r(u):u.then(r,i)}}return o(t)()}function ch(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=vl(i);return[e,o,n]}function Vl(e,t,n,r,i){return U.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(f){return f.name===Do.InvalidState&&e.isOpen()&&--e._state.PR1398_maxLoop>0?(console.warn("Dexie: Need to reopen db"),e._close(),e.open().then(function(){return Vl(e,t,n,null,i)})):ie(f)}var l=Uo(i);l&&fn();var u,c=U.follow(function(){if(u=i.call(a,a),u)if(l){var f=lt.bind(null,null);u.then(f,f)}else typeof u.next=="function"&&typeof u.throw=="function"&&(u=Xi(u))},s);return(u&&typeof u.then=="function"?U.resolve(u).then(function(f){return a.active?f:ie(new j.PrematureCommit("Transaction committed too early. See http://bit.ly/2kdckMn"))}):c.then(function(){return u})).then(function(f){return r&&a._resolve(),a._completion.then(function(){return f})}).catch(function(f){return a._reject(f),ie(f)})})}function ar(e,t,n){for(var r=pe(e)?e.slice():[e],i=0;i<n;++i)r.push(t);return r}function dh(e){return $($({},e),{table:function(t){var n=e.table(t),r=n.schema,i={},o=[];function a(v,m,_){var y=kn(v),E=i[y]=i[y]||[],w=v==null?0:typeof v=="string"?1:v.length,b=m>0,x=$($({},_),{isVirtual:b,keyTail:m,keyLength:w,extractKey:zi(v),unique:!b&&_.unique});if(E.push(x),x.isPrimaryKey||o.push(x),w>1){var C=w===2?v[0]:v.slice(0,w-1);a(C,m+1,_)}return E.sort(function(I,k){return I.keyTail-k.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 f(v){var m=i[kn(v)];return m&&m[0]}function d(v,m){return{type:v.type===1?2:v.type,lower:ar(v.lower,v.lowerOpen?e.MAX_KEY:e.MIN_KEY,m),lowerOpen:!0,upper:ar(v.upper,v.upperOpen?e.MIN_KEY:e.MAX_KEY,m),upperOpen:!0}}function p(v){var m=v.query.index;return m.isVirtual?$($({},v),{query:{index:m,range:d(v.query.range,m.keyTail)}}):v}var h=$($({},n),{schema:$($({},r),{primaryKey:s,indexes:o,getIndexByKeyPath:f}),count:function(v){return n.count(p(v))},query:function(v){return n.query(p(v))},openCursor:function(v){var m=v.query.index,_=m.keyTail,y=m.isVirtual,E=m.keyLength;if(!y)return n.openCursor(v);function w(b){function x(I){I!=null?b.continue(ar(I,v.reverse?e.MAX_KEY:e.MIN_KEY,_)):v.unique?b.continue(b.key.slice(0,E).concat(v.reverse?e.MIN_KEY:e.MAX_KEY,_)):b.continue()}var C=Object.create(b,{continue:{value:x},continuePrimaryKey:{value:function(I,k){b.continuePrimaryKey(ar(I,e.MAX_KEY,_),k)}},primaryKey:{get:function(){return b.primaryKey}},key:{get:function(){var I=b.key;return E===1?I[0]:I.slice(0,E)}},value:{get:function(){return b.value}}});return C}return n.openCursor(p(v)).then(function(b){return b&&w(b)})}});return h}})}var fh={stack:"dbcore",name:"VirtualIndexMiddleware",level:1,create:dh};function qo(e,t,n,r){return n=n||{},r=r||"",ne(e).forEach(function(i){if(!be(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=Oi(o),l=Oi(a);s!==l?n[r+i]=t[i]:s==="Object"?qo(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){be(e,i)||(n[r+i]=t[i])}),n}function ph(e,t){return t.type==="delete"?t.keys:t.keys||t.values.map(e.extractKey)}var hh={stack:"dbcore",name:"HooksMiddleware",level:2,create:function(e){return $($({},e),{table:function(t){var n=e.table(t),r=n.schema.primaryKey,i=$($({},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===W)break;return a._promise("readwrite",function(){return f(o)},!0);case"put":if(u.fire===W&&c.fire===W)break;return a._promise("readwrite",function(){return f(o)},!0);case"delete":if(l.fire===W)break;return a._promise("readwrite",function(){return f(o)},!0);case"deleteRange":if(l.fire===W)break;return a._promise("readwrite",function(){return d(o)},!0)}return n.mutate(o);function f(h){var v=N.trans,m=h.keys||ph(r,h);if(!m)throw new Error("Keys missing");return h=h.type==="add"||h.type==="put"?$($({},h),{keys:m}):$({},h),h.type!=="delete"&&(h.values=Ri([],h.values,!0)),h.keys&&(h.keys=Ri([],h.keys,!0)),vh(n,h,m).then(function(_){var y=m.map(function(E,w){var b=_[w],x={onerror:null,onsuccess:null};if(h.type==="delete")l.fire.call(x,E,b,v);else if(h.type==="add"||b===void 0){var C=u.fire.call(x,E,h.values[w],v);E==null&&C!=null&&(E=C,h.keys[w]=E,r.outbound||Pe(h.values[w],r.keyPath,E))}else{var I=qo(b,h.values[w]),k=c.fire.call(x,I,E,b,v);if(k){var L=h.values[w];Object.keys(k).forEach(function(T){be(L,T)?L[T]=k[T]:Pe(L,T,k[T])})}}return x});return n.mutate(h).then(function(E){for(var w=E.failures,b=E.results,x=E.numFailures,C=E.lastResult,I=0;I<m.length;++I){var k=b?b[I]:m[I],L=y[I];k==null?L.onerror&&L.onerror(w[I]):L.onsuccess&&L.onsuccess(h.type==="put"&&_[I]?h.values[I]:k)}return{failures:w,results:b,numFailures:x,lastResult:C}}).catch(function(E){return y.forEach(function(w){return w.onerror&&w.onerror(E)}),Promise.reject(E)})})}function d(h){return p(h.trans,h.range,1e4)}function p(h,v,m){return n.query({trans:h,values:!1,query:{index:r,range:v},limit:m}).then(function(_){var y=_.result;return f({type:"delete",keys:y,trans:h}).then(function(E){return E.numFailures>0?Promise.reject(E.failures[0]):y.length<m?{failures:[],numFailures:0,lastResult:void 0}:p(h,$($({},v),{lower:y[y.length-1],lowerOpen:!0}),m)})})}}});return i}})}};function vh(e,t,n){return t.type==="add"?Promise.resolve([]):e.getMany({trans:t.trans,keys:n,cache:"immutable"})}function jl(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)he(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 mh={stack:"dbcore",level:-1,create:function(e){return{table:function(t){var n=e.table(t);return $($({},n),{getMany:function(r){if(!r.cache)return n.getMany(r);var i=jl(r.keys,r.trans._cache,r.cache==="clone");return i?U.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 Go(e){return!("from"in e)}var Qe=function(e,t){if(this)ve(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&&ve(n,e),n}};nn(Qe.prototype,(pi={add:function(e){return Dr(this,e),this},addKey:function(e){return Mn(this,e,e),this},addKeys:function(e){var t=this;return e.forEach(function(n){return Mn(t,n,n)}),this}},pi[Di]=function(){return Ji(this)},pi));function Mn(e,t,n){var r=he(t,n);if(!isNaN(r)){if(r>0)throw RangeError();if(Go(e))return ve(e,{from:t,to:n,d:1});var i=e.l,o=e.r;if(he(n,e.from)<0)return i?Mn(i,t,n):e.l={from:t,to:n,d:1,l:null,r:null},Ba(e);if(he(t,e.to)>0)return o?Mn(o,t,n):e.r={from:t,to:n,d:1,l:null,r:null},Ba(e);he(t,e.from)<0&&(e.from=t,e.l=null,e.d=o?o.d+1:1),he(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&&Dr(e,i),o&&a&&Dr(e,o)}}function Dr(e,t){function n(r,i){var o=i.from,a=i.to,s=i.l,l=i.r;Mn(r,o,a),s&&n(r,s),l&&n(r,l)}Go(t)||n(e,t)}function gh(e,t){var n=Ji(t),r=n.next();if(r.done)return!1;for(var i=r.value,o=Ji(e),a=o.next(i.from),s=a.value;!r.done&&!a.done;){if(he(s.from,i.to)<=0&&he(s.to,i.from)>=0)return!0;he(i.from,s.from)<0?i=(r=n.next(s.from)).value:s=(a=o.next(i.from)).value}return!1}function Ji(e){var t=Go(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&&he(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||he(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 Ba(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=$({},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=Fa(a)}e.d=Fa(e)}function Fa(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 yh={stack:"dbcore",level:0,create:function(e){var t=e.schema.name,n=new Qe(e.MIN_KEY,e.MAX_KEY);return $($({},e),{table:function(r){var i=e.table(r),o=i.schema,a=o.primaryKey,s=a.extractKey,l=a.outbound,u=$($({},i),{mutate:function(d){var p=d.trans,h=p.mutatedParts||(p.mutatedParts={}),v=function(C){var I="idb://"+t+"/"+r+"/"+C;return h[I]||(h[I]=new Qe)},m=v(""),_=v(":dels"),y=d.type,E=d.type==="deleteRange"?[d.range]:d.type==="delete"?[d.keys]:d.values.length<50?[[],d.values]:[],w=E[0],b=E[1],x=d.trans._cache;return i.mutate(d).then(function(C){if(pe(w)){y!=="delete"&&(w=C.results),m.addKeys(w);var I=jl(w,x);!I&&y!=="add"&&_.addKeys(w),(I||b)&&_h(v,o,I,b)}else if(w){var k={from:w.lower,to:w.upper};_.add(k),m.add(k)}else m.add(n),_.add(n),o.indexes.forEach(function(L){return v(L.name).add(n)});return C})}}),c=function(d){var p,h,v=d.query,m=v.index,_=v.range;return[m,new Qe((p=_.lower)!==null&&p!==void 0?p:e.MIN_KEY,(h=_.upper)!==null&&h!==void 0?h:e.MAX_KEY)]},f={get:function(d){return[a,new Qe(d.key)]},getMany:function(d){return[a,new Qe().addKeys(d.keys)]},count:c,query:c,openCursor:c};return ne(f).forEach(function(d){u[d]=function(p){var h=N.subscr;if(h){var v=function(x){var C="idb://"+t+"/"+r+"/"+x;return h[C]||(h[C]=new Qe)},m=v(""),_=v(":dels"),y=f[d](p),E=y[0],w=y[1];if(v(E.name||"").add(w),!E.isPrimaryKey)if(d==="count")_.add(n);else{var b=d==="query"&&l&&p.values&&i.query($($({},p),{values:!1}));return i[d].apply(this,arguments).then(function(x){if(d==="query"){if(l&&p.values)return b.then(function(L){var T=L.result;return m.addKeys(T),x});var C=p.values?x.result.map(s):x.result;p.values?m.addKeys(C):_.addKeys(C)}else if(d==="openCursor"){var I=x,k=p.values;return I&&Object.create(I,{key:{get:function(){return _.addKey(I.primaryKey),I.key}},primaryKey:{get:function(){var L=I.primaryKey;return _.addKey(L),L}},value:{get:function(){return k&&m.addKey(I.primaryKey),I.value}}})}return x})}}return i[d].apply(this,arguments)}}),u}})}};function _h(e,t,n,r){function i(o){var a=e(o.name||"");function s(u){return u!=null?o.extractKey(u):null}var l=function(u){return o.multiEntry&&pe(u)?u.forEach(function(c){return a.addKey(c)}):a.addKey(u)};(n||r).forEach(function(u,c){var f=n&&s(n[c]),d=r&&s(r[c]);he(f,d)!==0&&(f!=null&&l(f),d!=null&&l(d))})}t.indexes.forEach(i)}var zo=function(){function e(t,n){var r=this;this._middlewares={},this.verno=0;var i=e.dependencies;this._options=n=$({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 U(function(s){a.dbReadyResolve=s}),a.openCanceller=new U(function(s,l){a.cancelOpen=l}),this._state=a,this.name=t,this.on=Gn(this,"populate","blocked","versionchange","close",{ready:[Po,W]}),this.on.ready.subscribe=dl(this.on.ready.subscribe,function(s){return function(l,u){e.vip(function(){var c=r._state;if(c.openComplete)c.dbOpenError||U.resolve().then(l),u&&s(l);else if(c.onReadyBeingFired)c.onReadyBeingFired.push(l),u&&s(l);else{s(l);var f=r;u||s(function d(){f.on.ready.unsubscribe(l),f.on.ready.unsubscribe(d)})}})}}),this.Collection=Dp(this),this.Table=Lp(this),this.Transaction=Hp(this),this.Version=ih(this),this.WhereClause=Bp(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=Nn(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(fh),this.use(hh),this.use(yh),this.use(mh),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(Yp),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 U(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 uh(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 U(function(r){t.dbReadyResolve=r}),t.openCanceller=new U(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 U(function(i,o){var a=function(){t.close();var s=t._deps.indexedDB.deleteDatabase(t.name);s.onsuccess=X(function(){sh(t._deps,t.name),i()}),s.onerror=je(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 ne(this._allTables).map(function(n){return t._allTables[n]})},enumerable:!1,configurable:!0}),e.prototype.transaction=function(){var t=ch.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 f=c instanceof i.Table?c.name:c;if(typeof f!="string")throw new TypeError("Invalid table argument to Dexie.transaction(). Only Table or String are allowed");return f}),t=="r"||t===li)s=li;else if(t=="rw"||t==ui)s=ui;else throw new j.InvalidArgument("Invalid transaction mode: "+t);if(o){if(o.mode===li&&s===ui)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(f,d){d(c)}):ie(c)}var u=Vl.bind(null,this,s,l,o,r);return o?o._promise(s,u,"lock"):N.trans?pn(N.transless,function(){return i._whenReady(u)}):this._whenReady(u)},e.prototype.table=function(t){if(!be(this._allTables,t))throw new j.InvalidTable("Table "+t+" does not exist");return this._allTables[t]},e}(),wh=typeof Symbol<"u"&&"observable"in Symbol?Symbol.observable:"@@observable",bh=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[wh]=function(){return this},e}();function Bl(e,t){return ne(t).forEach(function(n){var r=e[n]||(e[n]=new Qe);Dr(r,t[n])}),e}function Eh(e){var t=!1,n=void 0,r=new bh(function(i){var o=Uo(e);function a(m){o&&fn();var _=function(){return yt(e,{subscr:m,trans:null})},y=N.trans?pn(N.transless,_):_();return o&&y.then(lt,lt),y}var s=!1,l={},u={},c={get closed(){return s},unsubscribe:function(){s=!0,wt.storagemutated.unsubscribe(h)}};i.start&&i.start(c);var f=!1,d=!1;function p(){return ne(u).some(function(m){return l[m]&&gh(l[m],u[m])})}var h=function(m){Bl(l,m),p()&&v()},v=function(){if(!(f||s)){l={};var m={},_=a(m);d||(wt(Pn,h),d=!0),f=!0,Promise.resolve(_).then(function(y){t=!0,n=y,f=!1,!s&&(p()?v():(l={},u=m,i.next&&i.next(y)))},function(y){f=!1,t=!1,i.error&&i.error(y),c.unsubscribe()})}};return v(),c});return r.hasValue=function(){return t},r.getValue=function(){return n},r}var eo;try{eo={indexedDB:Y.indexedDB||Y.mozIndexedDB||Y.webkitIndexedDB||Y.msIndexedDB,IDBKeyRange:Y.IDBKeyRange||Y.webkitIDBKeyRange}}catch{eo={indexedDB:null,IDBKeyRange:null}}var kt=zo;nn(kt,$($({},Gr),{delete:function(e){var t=new kt(e,{addons:[]});return t.delete()},exists:function(e){return new kt(e,{addons:[]}).open().then(function(t){return t.close(),!0}).catch("NoSuchDatabaseError",function(){return!1})},getDatabaseNames:function(e){try{return oh(kt.dependencies).then(e)}catch{return ie(new j.MissingAPI)}},defineClass:function(){function e(t){ve(this,t)}return e},ignoreTransaction:function(e){return N.trans?pn(N.transless,e):e()},vip:Zi,async:function(e){return function(){try{var t=Xi(e.apply(this,arguments));return!t||typeof t.then!="function"?U.resolve(t):t}catch(n){return ie(n)}}},spawn:function(e,t,n){try{var r=Xi(e.apply(n,t||[]));return!r||typeof r.then!="function"?U.resolve(r):r}catch(i){return ie(i)}},currentTransaction:{get:function(){return N.trans||null}},waitFor:function(e,t){var n=U.resolve(typeof e=="function"?kt.ignoreTransaction(e):e).timeout(t||6e4);return N.trans?N.trans.waitFor(n):n},Promise:U,debug:{get:function(){return ze},set:function(e){gl(e,e==="dexie"?function(){return!0}:Rl)}},derive:cn,extend:ve,props:nn,override:dl,Events:Gn,on:wt,liveQuery:Eh,extendObservabilitySet:Bl,getByKeyPath:ot,setByKeyPath:Pe,delByKeyPath:ep,shallowClone:hl,deepClone:Hn,getObjectDiff:qo,cmp:he,asap:fl,minKey:qi,addons:[],connections:In,errnames:Do,dependencies:eo,semVer:Da,version:Da.split(".").map(function(e){return parseInt(e)}).reduce(function(e,t,n){return e+t/Math.pow(10,n*2)})}));kt.maxKey=Nn(kt.dependencies.IDBKeyRange);typeof dispatchEvent<"u"&&typeof addEventListener<"u"&&(wt(Pn,function(e){if(!nt){var t;zr?(t=document.createEvent("CustomEvent"),t.initCustomEvent(ht,!0,!0,e)):t=new CustomEvent(ht,{detail:e}),nt=!0,dispatchEvent(t),nt=!1}}),addEventListener(ht,function(e){var t=e.detail;nt||Pr(t)}));function Pr(e){var t=nt;try{nt=!0,wt.storagemutated.fire(e)}finally{nt=t}}var nt=!1;if(typeof BroadcastChannel<"u"){var sr=new BroadcastChannel(ht);typeof sr.unref=="function"&&sr.unref(),wt(Pn,function(e){nt||sr.postMessage(e)}),sr.onmessage=function(e){e.data&&Pr(e.data)}}else if(typeof self<"u"&&typeof navigator<"u"){wt(Pn,function(e){try{nt||(typeof localStorage<"u"&&localStorage.setItem(ht,JSON.stringify({trig:Math.random(),changedParts:e})),typeof self.clients=="object"&&Ri([],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&&Pr(t.changedParts)}});var Ha=self.document&&navigator.serviceWorker;Ha&&Ha.addEventListener("message",xh)}function xh(e){var t=e.data;t&&t.type===ht&&Pr(t.changedParts)}U.rejectionMapper=up;gl(ze,Rl);var hn=(e=>(e.ReadyForUpload="ReadyForUpload",e.UploadComplete="UploadComplete",e))(hn||{}),Xt=(e=>(e.After="after",e.Before="before",e.BeforeAndAfter="beforeAndAfter",e))(Xt||{});const to="sprig.sessionId",Fl="sprig.disableReplayRecording",Sh=30,Hl=()=>{sessionStorage.setItem(Fl,"disabled")},jt=()=>!!sessionStorage.getItem(Fl),Ch=["did not allow mutations","called in an invalid security context"],Ih=e=>{if(!e)return!0;for(const t of Ch)if(e.toLowerCase().includes(t))return!1;return!0},Ka=(e,t,n)=>{jt()||t instanceof Error&&(Hl(),Ih(t==null?void 0:t.message)&&(Lh(),window.UserLeap.reportError(e,t,n)))},kh=(e,t)=>{var n,r;(r=(n=window.navigator)==null?void 0:n.storage)!=null&&r.estimate?window.navigator.storage.estimate().then(i=>{Ka(e,t,i)}).catch(i=>{window.UserLeap.reportError("Error getting storage estimate",i)}):Ka(e,t)},Th=()=>{const e=sessionStorage.getItem(to);return e?(sessionStorage.removeItem(to),e):gt()},me=Th();window.addEventListener("beforeunload",()=>{sessionStorage.setItem(to,me)});const Lh=()=>{Promise.all([z.events.clear(),z.chunkUploads.clear(),z.pendingCaptures.clear()]).catch(e=>{window.UserLeap.reportError("Error wiping database",e)})},hi=(e,t,n=()=>!0)=>z.table(t).where("timestamp").below(e).and(n).delete(),Ah=()=>{z.events.where("sessionId").equals(me).delete(),z.pendingCaptures.where("sessionId").equals(me).delete()},Rh=e=>{const t=e.map(n=>{var r;return{...n,sessionId:(r=n.sessionId)!=null?r:me}});return z.events.bulkAdd(t)},Uh=(e,t)=>z.events.where("[sessionId+timestamp]").between([me,e],[me,t]).toArray(),Oh=(e,t,n)=>{const r=new Date,i=r.setMinutes(r.getMinutes()+(n!=null?n:Sh));return z.events.where("[sessionId+timestamp]").between([me,e],[me,t]).modify({expiredAt:i})},Dh=e=>{var t;return z.chunkUploads.add({...e,sessionId:(t=e.sessionId)!=null?t:me})},Ph=(e,t)=>z.chunkUploads.update(e,{data:null,etag:t,status:hn.UploadComplete}),Nh=({status:e,uploadId:t})=>t?z.chunkUploads.where({uploadId:t,status:e}).toArray():z.chunkUploads.where({sessionId:me,status:e}).toArray(),Mh=e=>z.chunkUploads.where({uploadId:e,status:hn.UploadComplete}).toArray(),Vh=e=>z.chunkUploads.where({uploadId:e,status:hn.UploadComplete}).delete(),jh=e=>{var t;return z.pendingCaptures.add({...e,sessionId:(t=e.sessionId)!=null?t:me,canUpload:!1})},Bh=()=>z.pendingCaptures.where("sessionId").equals(me).and(e=>e.targetTimestamp<Date.now()).toArray(),Fh=()=>z.pendingCaptures.where("sessionId").equals(me).toArray(),Hh=e=>z.pendingCaptures.where("sessionId").equals(me).and(t=>t.captureParams.responseGroupId===e).modify({canUpload:!0});class Kh extends zo{constructor(){super("replayStorage",{autoOpen:!1});ce(this,"events");ce(this,"chunkUploads");ce(this,"pendingCaptures")}}const z=new Kh;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(()=>{Hl()});const $h=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 Kl=5e3,no=6e4;const qh=5,$a=1e3,$l=30,Nr=$l+qh,Wo="sprig.pendingCount";let zt,qa=0,Ga=Date.now(),Yo=!1;const Gh=async(e,t,n,r=2,i)=>{try{if(jt()||!t)return;i!=null&&i.minDuration&&(Kl=i.minDuration),i!=null&&i.batchDuration&&(no=i.batchDuration),zf(r),Jh(),Yh(t+Nr,30*60,t+Nr),Qh();const o=window;o.rrwebRecord||await $h(e,"https://cdn.sprig.com/dependencies/record-2.0.0-alpha.6.min.js",n);const a=o.rrwebRecord;if(!a)return;zt=a;let s=!0;a({checkoutEveryNms:$l*1e3,sampling:{input:"last",scroll:250,media:800},emit:(l,u)=>{if(jt())return;Ga=Date.now();const c=s||!!u;s=!1,zh({uuid:gt(),event:JSON.stringify(l),isValidStart:c,timestamp:Date.now()})},...i}),Yo=!0,qa||(qa=window.setInterval(()=>{Date.now()-Ga>$a&&Wn("Sprig_Noop",{})},$a))}catch(o){$e("Error initializing replay",o)}};let ro=!1,io=[];const zh=e=>{io.push(e),ro||Wh()},Wh=()=>{ro=!0,setTimeout(async()=>{if(jt())return;const e=io;io=[],ro=!1;try{await Rh(e)}catch(t){$e("Error storing replay events",t)}},500)},Yh=(e=6*60,t=30*60,n=4*60)=>{const r=setInterval(async()=>{const i=Date.now();jt()||await z.transaction("rw",z.events,z.chunkUploads,z.pendingCaptures,()=>{hi(i-e*1e3,"events",o=>o.expiredAt===void 0||o.expiredAt<i-e*1e3),hi(i-t*1e3,"chunkUploads"),hi(i-n*1e3,"pendingCaptures",o=>o.canUpload===void 0||o.canUpload===!1)}).catch(o=>{clearInterval(r),$e("Error deleting table rows",o)})},3e4)},Qh=(e=5)=>{setInterval(iv,e*1e3)},Zh=async(e,t,n,r,i)=>{try{const o=Math.min(e+i,n),a=await Uh(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){$e("Error getting events batch",o)}},Xh=(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},ql=e=>Promise.all(e.map(async t=>{const n=await Yf(t);return await Ph(t.uuid,n),t.uploadId})),Gl=async e=>{const t=await Mh(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 ul({apiUrl:r.apiUrl,surveyId:r.surveyId,uploadId:e,responseGroupUuid:r.responseGroupId,etags:n,headers:r.completeUploadHeaders,replayDuration:r.replayDuration}),await Vh(e)},Jh=async()=>{try{let e=[];if(await z.transaction("rw",z.chunkUploads,async()=>{e=await Nh({status:hn.ReadyForUpload}).catch(n=>{$e("chunkUploads transaction error",n)})}),!(e!=null&&e.length))return;const t=await ql(e);t!=null&&t.length&&await Promise.all(t.map(async n=>{n&&await Gl(n)}))}catch(e){$e("Error getting chunk upload uuids",e)}},ev=async(e,t)=>{await ql(t),await Promise.all(e.map(n=>Gl(n)))},tv=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 f=e-Nr*1e3,d=[];let p=[];for(let v=f;v<t;v+=no){if([l,p]=await Zh(v,e,t,l,no),!(p!=null&&p.length))continue;u===0&&(u=p[0].timestamp),c=p[p.length-1].timestamp;const m=`${s?",":"["}${p.map(y=>y.event).join(",")}`,_=r.encode(m);n?(o===null&&(a=new window.CompressionStream("gzip"),o=a.writable.getWriter()),o.write(_)):d.push(_),s=!0}if(c-u<Kl)return null;const h=r.encode("]");return o&&a?(o.write(h),o.close(),i=new Uint8Array(await new Response(a.readable).arrayBuffer())):(d.push(h),i=tv(d)),i},nv=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){if(a instanceof Error&&window.UserLeap.reportError("Error compressing replay",a),n)try{r=await za(o,i,!1)}catch(s){$e("fileData fallback failed",s)}}return r},Wa=async e=>{const{surveyId:t,responseGroupId:n,visitorId:r,apiUrl:i,completeUploadHeaders:o,replayParams:a,triggerTimestamp:s}=e,l=await nv(a.replayDurationSeconds*1e3,s);if(!(l!=null&&l.length))return;const u=Xh(l,a.minimumChunkSizeMb,a.signedUrls.length),c=await Promise.all(u.map(async(f,d)=>{const p=gt(),h={apiUrl:i,chunkIndex:d+1,completeUploadHeaders:o,etag:null,responseGroupId:n,status:hn.ReadyForUpload,surveyId:t,timestamp:s,totalChunks:u.length,data:f,uploadId:a.uploadId,uploadUrl:a.signedUrls[d].url,uuid:p,visitorId:r};return await Dh(h),h}));await ev([a.uploadId],c)},zl=async(e,t)=>{if(!jt())try{const{isStandalone:n,replayParams:r,triggerTimestamp:i,responseGroupId:o}=e,a=async()=>{setTimeout(()=>G.removeListener(F.QuestionAnswered,a),0),r.replayDurationType===Xt.Before?await Wa(e):await Hh(o)};if(r.replayDurationType===Xt.After||r.replayDurationType===Xt.BeforeAndAfter){n||G.on(F.QuestionAnswered,a),await rv(e);return}if(n||t)await Wa(e);else{const s=Nr+r.replayDurationSeconds;await Oh(i-s*1e3,i,r.expirationTimeLimitMinutes),G.on(F.QuestionAnswered,a)}}catch(n){$e("Error scheduling or capturing replay",n)}},Ya=()=>{if(!jt())try{Ah()}catch(e){$e("Error clearing session event data",e)}};let Je=sessionStorage.getItem(Wo);const rv=async e=>{const{surveyId:t}=e,n=await Fh(),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===Xt.BeforeAndAfter&&(i.replayParams.replayDurationSeconds*=2),i.replayParams.replayDurationType=Xt.Before;const o=e.triggerTimestamp+e.replayParams.replayDurationSeconds*1e3;return i.triggerTimestamp=o,Je=Je?(parseInt(Je)+1).toString():"1",sessionStorage.setItem(Wo,Je),jh({uuid:gt(),targetTimestamp:o,timestamp:Date.now(),captureParams:i})},iv=async()=>{try{if(Je&&parseInt(Je)>0){const e=await Bh();e.length&&await Promise.all(e.map(async t=>{await z.pendingCaptures.delete(t.uuid),await zl(t.captureParams,t.canUpload)})),Je=(parseInt(Je)-e.length).toString(),sessionStorage.setItem(Wo,Je)}}catch(e){$e("Error initiating pending captures",e)}},Wn=(e,t)=>{var n;!Yo||(n=zt==null?void 0:zt.addCustomEvent)==null||n.call(zt,e,t)},Qa=e=>{Wn("Sprig_PageView",e)},ov=e=>{Wn("Sprig_TrackEvent",e)},av=e=>{Wn("Sprig_ShowSurvey",e)},sv=e=>{Wn("Sprig_SubmitSurvey",e)},$e=(e,t)=>{Yo=!1,kh(e,t)};var Yn,P,Wl,rn,Tt,Za,Yl,Ql,Mr={},Zl=[],lv=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i;function rt(e,t){for(var n in t)e[n]=t[n];return e}function Xl(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?Yn.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?++Wl:i};return i==null&&P.vnode!=null&&P.vnode(o),o}function Jl(){return{current:null}}function Le(e){return e.children}function uv(e,t,n,r,i){var o;for(o in n)o==="children"||o==="key"||o in t||Vr(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]||Vr(e,o,t[o],n[o],r)}function Xa(e,t,n){t[0]==="-"?e.setProperty(t,n==null?"":n):e[t]=n==null?"":typeof n!="number"||lv.test(t)?n:n+"px"}function Vr(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||Xa(e.style,t,"");if(n)for(t in n)r&&n[t]===r[t]||Xa(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?es:Ja,o):e.removeEventListener(t,o?es:Ja,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 Ja(e){rn=!0;try{return this.l[e.type+!1](P.event?P.event(e):e)}finally{rn=!1}}function es(e){rn=!0;try{return this.l[e.type+!0](P.event?P.event(e):e)}finally{rn=!1}}function Ne(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 eu(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 eu(e)}}function cv(e){rn?setTimeout(e):Yl(e)}function oo(e){(!e.__d&&(e.__d=!0)&&Tt.push(e)&&!jr.__r++||Za!==P.debounceRendering)&&((Za=P.debounceRendering)||cv)(jr)}function jr(){var e,t,n,r,i,o,a,s;for(Tt.sort(function(l,u){return l.__v.__b-u.__v.__b});e=Tt.shift();)e.__d&&(t=Tt.length,r=void 0,i=void 0,a=(o=(n=e).__v).__e,(s=n.__P)&&(r=[],(i=rt({},o)).__v=o.__v+1,Qo(s,o,i,n.__n,s.ownerSVGElement!==void 0,o.__h!=null?[a]:null,r,a==null?Vn(o):a,o.__h),ou(r,o),o.__e!=a&&eu(o)),Tt.length>t&&Tt.sort(function(l,u){return l.__v.__b-u.__v.__b}));jr.__r=0}function tu(e,t,n,r,i,o,a,s,l,u){var c,f,d,p,h,v,m,_=r&&r.__k||Zl,y=_.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(Le,{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,(d=_[c])===null||d&&p.key==d.key&&p.type===d.type)_[c]=void 0;else for(f=0;f<y;f++){if((d=_[f])&&p.key==d.key&&p.type===d.type){_[f]=void 0;break}d=null}Qo(e,p,d=d||Mr,i,o,a,s,l,u),h=p.__e,(f=p.ref)&&d.ref!=f&&(m||(m=[]),d.ref&&m.push(d.ref,null,p),m.push(f,p.__c||h,p)),h!=null?(v==null&&(v=h),typeof p.type=="function"&&p.__k===d.__k?p.__d=l=nu(p,l,e):l=ru(e,p,d,_,h,l),typeof n.type=="function"&&(n.__d=l)):l&&d.__e==l&&l.parentNode!=e&&(l=Vn(d))}for(n.__e=v,c=y;c--;)_[c]!=null&&(typeof n.type=="function"&&_[c].__e!=null&&_[c].__e==n.__d&&(n.__d=iu(r).nextSibling),su(_[c],_[c]));if(m)for(c=0;c<m.length;c++)au(m[c],m[++c],m[++c])}function nu(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"?nu(r,t,n):ru(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 ru(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 iu(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=iu(n)))return r}return null}function Qo(e,t,n,r,i,o,a,s,l){var u,c,f,d,p,h,v,m,_,y,E,w,b,x,C,I=t.type;if(t.constructor!==void 0)return null;n.__h!=null&&(l=n.__h,s=t.__e=n.__e,t.__h=null,o=[s]),(u=P.__b)&&u(t);try{e:if(typeof I=="function"){if(m=t.props,_=(u=I.contextType)&&r[u.__c],y=u?_?_.props.value:u.__:r,n.__c?v=(c=t.__c=n.__c).__=c.__E:("prototype"in I&&I.prototype.render?t.__c=c=new I(m,y):(t.__c=c=new Ne(m,y),c.constructor=I,c.render=fv),_&&_.sub(c),c.props=m,c.state||(c.state={}),c.context=y,c.__n=r,f=c.__d=!0,c.__h=[],c._sb=[]),c.__s==null&&(c.__s=c.state),I.getDerivedStateFromProps!=null&&(c.__s==c.state&&(c.__s=rt({},c.__s)),rt(c.__s,I.getDerivedStateFromProps(m,c.__s))),d=c.props,p=c.state,c.__v=t,f)I.getDerivedStateFromProps==null&&c.componentWillMount!=null&&c.componentWillMount(),c.componentDidMount!=null&&c.__h.push(c.componentDidMount);else{if(I.getDerivedStateFromProps==null&&m!==d&&c.componentWillReceiveProps!=null&&c.componentWillReceiveProps(m,y),!c.__e&&c.shouldComponentUpdate!=null&&c.shouldComponentUpdate(m,c.__s,y)===!1||t.__v===n.__v){for(t.__v!==n.__v&&(c.props=m,c.state=c.__s,c.__d=!1),t.__e=n.__e,t.__k=n.__k,t.__k.forEach(function(k){k&&(k.__=t)}),E=0;E<c._sb.length;E++)c.__h.push(c._sb[E]);c._sb=[],c.__h.length&&a.push(c);break e}c.componentWillUpdate!=null&&c.componentWillUpdate(m,c.__s,y),c.componentDidUpdate!=null&&c.__h.push(function(){c.componentDidUpdate(d,p,h)})}if(c.context=y,c.props=m,c.__P=e,w=P.__r,b=0,"prototype"in I&&I.prototype.render){for(c.state=c.__s,c.__d=!1,w&&w(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,w&&w(t),u=c.render(c.props,c.state,c.context),c.state=c.__s;while(c.__d&&++b<25);c.state=c.__s,c.getChildContext!=null&&(r=rt(rt({},r),c.getChildContext())),f||c.getSnapshotBeforeUpdate==null||(h=c.getSnapshotBeforeUpdate(d,p)),C=u!=null&&u.type===Le&&u.key==null?u.props.children:u,tu(e,Array.isArray(C)?C:[C],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=dv(n.__e,t,n,r,i,o,a,l);(u=P.diffed)&&u(t)}catch(k){t.__v=null,(l||o!=null)&&(t.__e=s,t.__h=!!l,o[o.indexOf(s)]=null),P.__e(k,t,n)}}function ou(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 dv(e,t,n,r,i,o,a,s){var l,u,c,f=n.props,d=t.props,p=t.type,h=0;if(p==="svg"&&(i=!0),o!=null){for(;h<o.length;h++)if((l=o[h])&&"setAttribute"in l==!!p&&(p?l.localName===p:l.nodeType===3)){e=l,o[h]=null;break}}if(e==null){if(p===null)return document.createTextNode(d);e=i?document.createElementNS("http://www.w3.org/2000/svg",p):document.createElement(p,d.is&&d),o=null,s=!1}if(p===null)f===d||s&&e.data===d||(e.data=d);else{if(o=o&&Yn.call(e.childNodes),u=(f=n.props||Mr).dangerouslySetInnerHTML,c=d.dangerouslySetInnerHTML,!s){if(o!=null)for(f={},h=0;h<e.attributes.length;h++)f[e.attributes[h].name]=e.attributes[h].value;(c||u)&&(c&&(u&&c.__html==u.__html||c.__html===e.innerHTML)||(e.innerHTML=c&&c.__html||""))}if(uv(e,d,f,i,s),c)t.__k=[];else if(h=t.props.children,tu(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&&Xl(o[h]);s||("value"in d&&(h=d.value)!==void 0&&(h!==e.value||p==="progress"&&!h||p==="option"&&h!==f.value)&&Vr(e,"value",h,f.value,!1),"checked"in d&&(h=d.checked)!==void 0&&h!==e.checked&&Vr(e,"checked",h,f.checked,!1))}return e}function au(e,t,n){try{typeof e=="function"?e(t):e.current=t}catch(r){P.__e(r,n)}}function su(e,t,n){var r,i;if(P.unmount&&P.unmount(e),(r=e.ref)&&(r.current&&r.current!==e.__e||au(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]&&su(r[i],t,n||typeof e.type!="function");n||e.__e==null||Xl(e.__e),e.__=e.__e=e.__d=void 0}function fv(e,t,n){return this.constructor(e,n)}function on(e,t,n){var r,i,o;P.__&&P.__(e,t),i=(r=typeof n=="function")?null:n&&n.__k||t.__k,o=[],Qo(t,e=(!r&&n||t).__k=ee(Le,null,[e]),i||Mr,Mr,t.ownerSVGElement!==void 0,!r&&n?[n]:i?null:t.firstChild?Yn.call(t.childNodes):null,o,!r&&n?n:i?i.__e:t.firstChild,r),ou(o,e)}function lu(e,t){on(e,t,lu)}function pv(e,t,n){var r,i,o,a=rt({},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?Yn.call(arguments,2):n),Tn(e.type,a,r||e.key,i||e.ref,null)}function uu(e,t){var n={__c:t="__cC"+Ql++,__: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,oo(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}Yn=Zl.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}},Wl=0,rn=!1,Ne.prototype.setState=function(e,t){var n;n=this.__s!=null&&this.__s!==this.state?this.__s:this.__s=rt({},this.state),typeof e=="function"&&(e=e(rt({},n),this.props)),e&&rt(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),oo(this))},Ne.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),oo(this))},Ne.prototype.render=Le,Tt=[],Yl=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,jr.__r=0,Ql=0;var A=(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))(A||{}),et=(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))(et||{}),an=(e=>(e.Camera="camera",e.Microphone="microphone",e.Screen="screen",e))(an||{}),Ce=(e=>(e.AvPermission="av_permission",e.ScreenPermission="screen_permission",e.StartTask="start_task",e.CompleteTask="complete_task",e))(Ce||{}),Ut=(e=>(e.Number="number",e.Smiley="smiley",e.Star="star",e))(Ut||{}),Ue=(e=>(e.Video="video",e.Audio="audio",e.Screen="screen",e))(Ue||{}),de=(e=>(e.PermissionStatus="permission.status",e.AvPermission="av.permission",e.ScreenPermission="screen.permission",e.BeginRecording="begin.recording",e.StartTask="start.task",e.FinishTask="finish.task",e))(de||{}),Ie=(e=>(e.Abandoned="abandoned",e.GivenUp="given.up",e.Completed="completed",e))(Ie||{}),q=(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))(q||{});const ts=e=>{let t;const n=new Set,r=(l,u)=>{const c=typeof l=="function"?l(t):l;if(!Object.is(c,t)){const f=t;t=(u!=null?u:typeof c!="object")?c:Object.assign({},t,c),n.forEach(d=>d(t,f))}},i=()=>t,s={setState:r,getState:i,subscribe:l=>(n.add(l),()=>n.delete(l)),destroy:()=>n.clear()};return t=e(r,i,s),s},hv=e=>e?ts(e):ts;var xt,Q,vi,ns,sn=0,cu=[],mr=[],rs=P.__b,is=P.__r,os=P.diffed,as=P.__c,ss=P.unmount;function Ht(e,t){P.__h&&P.__h(Q,e,sn||t),sn=0;var n=Q.__H||(Q.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({__V:mr}),n.__[e]}function le(e){return sn=1,Zo(vu,e)}function Zo(e,t,n){var r=Ht(xt++,2);if(r.t=e,!r.__c&&(r.__=[n?n(t):vu(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 f=c.__[0];c.__=c.__N,c.__N=void 0,f!==c.__[0]&&(u=!0)}}),!(!u&&r.__c.props===o)&&(!i||i.call(this,o,a,s))}}return r.__N||r.__}function ke(e,t){var n=Ht(xt++,3);!P.__s&&Jo(n.__H,t)&&(n.__=e,n.i=t,Q.__H.__h.push(n))}function Qn(e,t){var n=Ht(xt++,4);!P.__s&&Jo(n.__H,t)&&(n.__=e,n.i=t,Q.__h.push(n))}function bt(e){return sn=5,Yr(function(){return{current:e}},[])}function du(e,t,n){sn=6,Qn(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=Ht(xt++,7);return Jo(n.__H,t)?(n.__V=e(),n.i=t,n.__h=e,n.__V):n.__}function fu(e,t){return sn=8,Yr(function(){return e},t)}function pu(e){var t=Q.context[e.__c],n=Ht(xt++,9);return n.c=e,t?(n.__==null&&(n.__=!0,t.sub(Q)),t.props.value):e.__}function Xo(e,t){P.useDebugValue&&P.useDebugValue(t?t(e):e)}function vv(e){var t=Ht(xt++,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 hu(){var e=Ht(xt++,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 mv(){for(var e;e=cu.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach(gr),e.__H.__h.forEach(ao),e.__H.__h=[]}catch(t){e.__H.__h=[],P.__e(t,e.__v)}}P.__b=function(e){Q=null,rs&&rs(e)},P.__r=function(e){is&&is(e),xt=0;var t=(Q=e.__c).__H;t&&(vi===Q?(t.__h=[],Q.__h=[],t.__.forEach(function(n){n.__N&&(n.__=n.__N),n.__V=mr,n.__N=n.i=void 0})):(t.__h.forEach(gr),t.__h.forEach(ao),t.__h=[])),vi=Q},P.diffed=function(e){os&&os(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(cu.push(t)!==1&&ns===P.requestAnimationFrame||((ns=P.requestAnimationFrame)||gv)(mv)),t.__H.__.forEach(function(n){n.i&&(n.__H=n.i),n.__V!==mr&&(n.__=n.__V),n.i=void 0,n.__V=mr})),vi=Q=null},P.__c=function(e,t){t.some(function(n){try{n.__h.forEach(gr),n.__h=n.__h.filter(function(r){return!r.__||ao(r)})}catch(r){t.some(function(i){i.__h&&(i.__h=[])}),t=[],P.__e(r,n.__v)}}),as&&as(e,t)},P.unmount=function(e){ss&&ss(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.forEach(function(r){try{gr(r)}catch(i){t=i}}),n.__H=void 0,t&&P.__e(t,n.__v))};var ls=typeof requestAnimationFrame=="function";function gv(e){var t,n=function(){clearTimeout(r),ls&&cancelAnimationFrame(t),setTimeout(e)},r=setTimeout(n,100);ls&&(t=requestAnimationFrame(n))}function gr(e){var t=Q,n=e.__c;typeof n=="function"&&(e.__c=void 0,n()),Q=t}function ao(e){var t=Q;e.__c=e.__(),Q=t}function Jo(e,t){return!e||e.length!==t.length||t.some(function(n,r){return n!==e[r]})}function vu(e,t){return typeof t=="function"?t(e):t}function mu(e,t){for(var n in t)e[n]=t[n];return e}function so(e,t){for(var n in e)if(n!=="__source"&&!(n in t))return!0;for(var r in t)if(r!=="__source"&&e[r]!==t[r])return!0;return!1}function mi(e,t){return e===t&&(e!==0||1/e==1/t)||e!=e&&t!=t}function Br(e){this.props=e}function gu(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:so(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}(Br.prototype=new Ne).isPureReactComponent=!0,Br.prototype.shouldComponentUpdate=function(e,t){return so(this.props,e)||so(this.state,t)};var us=P.__b;P.__b=function(e){e.type&&e.type.__f&&e.ref&&(e.props.ref=e.ref,e.ref=null),us&&us(e)};var yv=typeof Symbol<"u"&&Symbol.for&&Symbol.for("react.forward_ref")||3911;function yu(e){function t(n){var r=mu({},n);return delete r.ref,e(r,n.ref||null)}return t.$$typeof=yv,t.render=t,t.prototype.isReactComponent=t.__f=!0,t.displayName="ForwardRef("+(e.displayName||e.name)+")",t}var cs=function(e,t){return e==null?null:at(at(e).map(t))},_u={map:cs,forEach:cs,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},_v=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)}_v(e,t,n,r)};var ds=P.unmount;function wu(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=mu({},e)).__c!=null&&(e.__c.__P===n&&(e.__c.__P=t),e.__c=null),e.__k=e.__k&&e.__k.map(function(r){return wu(r,t,n)})),e}function bu(e,t,n){return e&&(e.__v=null,e.__k=e.__k&&e.__k.map(function(r){return bu(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 Eu(e){var t=e.__.__c;return t&&t.__a&&t.__a(e)}function xu(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 Wt(){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),ds&&ds(e)},(Ln.prototype=new Ne).__c=function(e,t){var n=t.__c,r=this;r.t==null&&(r.t=[]),r.t.push(n);var i=Eu(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]=bu(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]=wu(this.__b,n,r.__O=r.__P)}this.__b=null}var i=t.__a&&ee(Le,null,e.fallback);return i&&(i.__h=null),[ee(Le,null,t.__a?null:e.children),i]};var fs=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 wv(e){return this.getChildContext=function(){return e.context},e.children}function bv(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(ee(wv,{context:t.context},e.__v),t.l)):t.l&&t.componentWillUnmount()}function Su(e,t){var n=ee(bv,{__v:e,i:t});return n.containerInfo=t,n}(Wt.prototype=new Ne).__a=function(e){var t=this,n=Eu(t.__v),r=t.o.get(e);return r[0]++,function(i){var o=function(){t.props.revealOrder?(r.push(i),fs(t,e,r)):i()};n?n(o):o()}},Wt.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},Wt.prototype.componentDidUpdate=Wt.prototype.componentDidMount=function(){var e=this;this.o.forEach(function(t,n){fs(e,n,t)})};var Cu=typeof Symbol<"u"&&Symbol.for&&Symbol.for("react.element")||60103,Ev=/^(?: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]/,xv=typeof document<"u",Sv=function(e){return(typeof Symbol<"u"&&typeof Symbol()=="symbol"?/fil|che|rad/i:/fil|che|ra/i).test(e)};function Iu(e,t,n){return t.__k==null&&(t.textContent=""),on(e,t),typeof n=="function"&&n(),e?e.__c:null}function ku(e,t,n){return lu(e,t),typeof n=="function"&&n(),e?e.__c:null}Ne.prototype.isReactComponent={},["componentWillMount","componentWillReceiveProps","componentWillUpdate"].forEach(function(e){Object.defineProperty(Ne.prototype,e,{configurable:!0,get:function(){return this["UNSAFE_"+e]},set:function(t){Object.defineProperty(this,e,{configurable:!0,writable:!0,value:t})}})});var ps=P.event;function Cv(){}function Iv(){return this.cancelBubble}function kv(){return this.defaultPrevented}P.event=function(e){return ps&&(e=ps(e)),e.persist=Cv,e.isPropagationStopped=Iv,e.isDefaultPrevented=kv,e.nativeEvent=e};var Tu,hs={configurable:!0,get:function(){return this.class}},vs=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];xv&&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)&&!Sv(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&&Ev.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&&(hs.enumerable="className"in n,n.className!=null&&(r.class=n.className),Object.defineProperty(r,"className",hs))}e.$$typeof=Cu,vs&&vs(e)};var ms=P.__r;P.__r=function(e){ms&&ms(e),Tu=e.__c};var Lu={ReactCurrentDispatcher:{current:{readContext:function(e){return Tu.__n[e.__c].props.value}}}},Tv="17.0.2";function Au(e){return ee.bind(null,e)}function ea(e){return!!e&&e.$$typeof===Cu}function Ru(e){return ea(e)?pv.apply(null,arguments):e}function Uu(e){return!!e.__k&&(on(null,e),!0)}function Ou(e){return e&&(e.base||e.nodeType===1&&e)||null}var Du=function(e,t){return e(t)},Pu=function(e,t){return e(t)},Nu=Le;function ta(e){e()}function Mu(e){return e}function Vu(){return[!1,ta]}var ju=Qn;function Bu(e,t){var n=t(),r=le({h:{__:n,v:t}}),i=r[0].h,o=r[1];return Qn(function(){i.__=n,i.v=t,mi(i.__,t())||o({h:i})},[e,n,t]),ke(function(){return mi(i.__,i.v())||o({h:i}),e(function(){mi(i.__,i.v())||o({h:i})})},[e]),n}var Lv={useState:le,useId:hu,useReducer:Zo,useEffect:ke,useLayoutEffect:Qn,useInsertionEffect:ju,useTransition:Vu,useDeferredValue:Mu,useSyncExternalStore:Bu,startTransition:ta,useRef:bt,useImperativeHandle:du,useMemo:Yr,useCallback:fu,useContext:pu,useDebugValue:Xo,version:"17.0.2",Children:_u,render:Iu,hydrate:ku,unmountComponentAtNode:Uu,createPortal:Su,createElement:ee,createContext:uu,createFactory:Au,cloneElement:Ru,createRef:Jl,Fragment:Le,isValidElement:ea,findDOMNode:Ou,Component:Ne,PureComponent:Br,memo:gu,forwardRef:yu,flushSync:Pu,unstable_batchedUpdates:Du,StrictMode:Nu,Suspense:Ln,SuspenseList:Wt,lazy:xu,__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED:Lu};const Av=Object.freeze(Object.defineProperty({__proto__:null,Children:_u,PureComponent:Br,StrictMode:Nu,Suspense:Ln,SuspenseList:Wt,__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED:Lu,cloneElement:Ru,createFactory:Au,createPortal:Su,default:Lv,findDOMNode:Ou,flushSync:Pu,forwardRef:yu,hydrate:ku,isValidElement:ea,lazy:xu,memo:gu,render:Iu,startTransition:ta,unmountComponentAtNode:Uu,unstable_batchedUpdates:Du,useDeferredValue:Mu,useInsertionEffect:ju,useSyncExternalStore:Bu,useTransition:Vu,version:Tv,Component:Ne,Fragment:Le,createContext:uu,createElement:ee,createRef:Jl,useCallback:fu,useContext:pu,useDebugValue:Xo,useEffect:ke,useErrorBoundary:vv,useId:hu,useImperativeHandle:du,useLayoutEffect:Qn,useMemo:Yr,useReducer:Zo,useRef:bt,useState:le},Symbol.toStringTag,{value:"Module"}));var Fu={exports:{}},Hu={};const Ku=Ac(Av);var $u={exports:{}},qu={};/**
39
20
  * @license React
40
21
  * use-sync-external-store-shim.production.min.js
41
22
  *
@@ -43,7 +24,7 @@ From previous: `);return this._state!==null&&(this._stack=t),t}finally{$o=!1}}},
43
24
  *
44
25
  * This source code is licensed under the MIT license found in the
45
26
  * LICENSE file in the root directory of this source tree.
46
- */var Bn=pf;function X0(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var J0=typeof Object.is=="function"?Object.is:X0,e_=Bn.useState,t_=Bn.useEffect,n_=Bn.useLayoutEffect,r_=Bn.useDebugValue;function i_(e,t){var n=t(),r=e_({inst:{value:n,getSnapshot:t}}),i=r[0].inst,o=r[1];return n_(function(){i.value=n,i.getSnapshot=t,Eo(i)&&o({inst:i})},[e,n,t]),t_(function(){return Eo(i)&&o({inst:i}),e(function(){Eo(i)&&o({inst:i})})},[e]),r_(n),n}function Eo(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!J0(e,n)}catch{return!0}}function o_(e,t){return t()}var a_=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?o_:i_;mf.useSyncExternalStore=Bn.useSyncExternalStore!==void 0?Bn.useSyncExternalStore:a_;(function(e){e.exports=mf})(hf);/**
27
+ */var ln=Ku;function Rv(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var Uv=typeof Object.is=="function"?Object.is:Rv,Ov=ln.useState,Dv=ln.useEffect,Pv=ln.useLayoutEffect,Nv=ln.useDebugValue;function Mv(e,t){var n=t(),r=Ov({inst:{value:n,getSnapshot:t}}),i=r[0].inst,o=r[1];return Pv(function(){i.value=n,i.getSnapshot=t,gi(i)&&o({inst:i})},[e,n,t]),Dv(function(){return gi(i)&&o({inst:i}),e(function(){gi(i)&&o({inst:i})})},[e]),Nv(n),n}function gi(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!Uv(e,n)}catch{return!0}}function Vv(e,t){return t()}var jv=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?Vv:Mv;qu.useSyncExternalStore=ln.useSyncExternalStore!==void 0?ln.useSyncExternalStore:jv;(function(e){e.exports=qu})($u);/**
47
28
  * @license React
48
29
  * use-sync-external-store-shim/with-selector.production.min.js
49
30
  *
@@ -51,18 +32,18 @@ From previous: `);return this._state!==null&&(this._stack=t),t}finally{$o=!1}}},
51
32
  *
52
33
  * This source code is licensed under the MIT license found in the
53
34
  * LICENSE file in the root directory of this source tree.
54
- */var Yi=pf,s_=hf.exports;function l_(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var u_=typeof Object.is=="function"?Object.is:l_,c_=s_.useSyncExternalStore,d_=Yi.useRef,f_=Yi.useEffect,p_=Yi.useMemo,h_=Yi.useDebugValue;ff.useSyncExternalStoreWithSelector=function(e,t,n,r,i){var o=d_(null);if(o.current===null){var a={hasValue:!1,value:null};o.current=a}else a=o.current;o=p_(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,u_(c,p))return h;var m=r(p);return i!==void 0&&i(h,m)?h:(c=p,d=m)}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=c_(e,o[0],o[1]);return f_(function(){a.hasValue=!0,a.value=s},[s]),h_(s),s};(function(e){e.exports=ff})(df);const m_=Qf(df.exports),{useSyncExternalStoreWithSelector:g_}=m_;function v_(e,t=e.getState,n){const r=g_(e.subscribe,e.getState,e.getServerState||e.getState,t,n);return hs(r),r}const tu=e=>{const t=typeof e=="function"?U0(e):e,n=(r,i)=>v_(t,r,i);return Object.assign(n,t),n},gf=e=>e?tu(e):tu;var wa=(e=>(e[e.And=1]="And",e[e.Or=2]="Or",e))(wa||{});const nu=1,ys={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)}},y_=(e,t,n)=>{switch(t){case D.VideoVoice:return Boolean(e&&e.value);case D.Open:return!!n;case D.MultipleSelect:return Boolean(n&&!!Object.keys(n).length);case D.RecordedTask:return(n==null?void 0:n.taskStatus)===Ge.Completed;case D.TextUrlPrompt:return!e.value;case D.ConsentLegal:return n!==null;case D.MultipleChoice:return n!==void 0;case D.NPS:return n!==null;case D.Likert:return n!==null;default:return!0}},vf=({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=ru({comparator:p.comparator,response:r[p.questionIndex],type:o.type,value:p.value});for(let m=1;m<d.length;m+=2){const g=d[m],_=d[m+1],v=ru({comparator:_.comparator,response:r[_.questionIndex],type:e[_.questionIndex].type,value:_.value});g===wa.And?h&&(h=v):g===wa.Or&&(h||(h=v))}if(h){a=f===-1&&n?e.length-1:f;break}}const l=e.findIndex(c=>c.type===D.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},ru=({comparator:e,response:t,type:n,value:r})=>{if(e===wt.Answered)switch(n){case D.TextUrlPrompt:return t===void 0;case D.ConsentLegal:return t&&t.submitted===!0;case D.RecordedTask:return"taskStatus"in t&&t.taskStatus===Ge.Completed;case D.Likert:return Number.isInteger(t);case D.Open:return t&&t.length>0;case D.MultipleChoice:case D.MultipleSelect:return Object.keys(t).length>0;case D.NPS:return Number.isInteger(t);case D.VideoVoice:return!!(t!=null&&t.mediaRecordingUid);default:return!1}if(e===wt.Skipped)switch(n){case D.TextUrlPrompt:return t==null?void 0:t.skipped;case D.ConsentLegal:return t===null;case D.RecordedTask:return"taskStatus"in t&&t.taskStatus===Ge.Abandoned;case D.Likert:return t===null;case D.Open:return(t==null?void 0:t.length)===0;case D.MultipleChoice:return t===void 0;case D.MultipleSelect:return(t==null?void 0:t.length)===0;case D.NPS:return t===null;case D.VideoVoice:return t===null;default:return!1}return e===wt.GivenUp?n===D.RecordedTask?"taskStatus"in t&&t.taskStatus===Ge.GivenUp:!0:ys[e](t,r)},__=13,b_=(e,t)=>e.reduce((n,r)=>n.concat(n.map(i=>[...i,r])),[[]]).filter(n=>t||n.length>0),w_=e=>{var t,n;switch(e.type){case D.MultipleSelect:return!e||!e.props||!e.props.options?null:e.props.options.length>__?e.props.options.map(r=>[r.value]):b_(e.props.options.map(r=>r.value),!e.props.properties.required);case D.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 D.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 D.NPS:return[0,1,2,3,4,5,6,7,8,9,10,...e.props.properties.required?[]:[null]];case D.VideoVoice:case D.Open:return["1",...e.props.properties.required?[]:[""]];case D.RecordedTask:return[{taskStatus:Ge.Completed},{taskStatus:Ge.GivenUp},...e.props.properties.required?[]:[{taskStatus:Ge.Abandoned}]];case D.TextUrlPrompt:return[void 0,...e.props.properties.required?[]:[{skipped:!0}]];case D.ConsentLegal:return[nu,...e.props.properties.required?[]:[null]];default:return[nu]}},C_=e=>e in ys,I_=e=>typeof e=="object"&&e!==null&&"taskStatus"in e,E_=(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]},[]),S_=(e,t)=>{const n=new Set([D.Thanks,D.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=E_(o,a.props.routingOptions);if(s.length===0){i[o]=i[o+1]+1;continue}let l=0,u=w_(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(m=>{const g=y_({value:m},a.type,m);return!(g&&d===wt.Answered||!g&&d===wt.Skipped||d===wt.GivenUp&&I_(m)&&m.taskStatus===Ge.GivenUp||g&&a.type===D.Open&&(d===wt.Contains||d===wt.DoesNotContain)||g&&C_(d)&&ys[d](m,p))});if(h.length<u.length){const m=parseInt(String(f),10);if(m!==-1&&m<=o||m>=r.length)return r.length-1-t;l=Math.max(i[m]+1,l)}u=h}u.length>0&&(l=Math.max(i[o+1]+1,l)),i[o]=l}return i[t]},k_=e=>!(e.type===D.Thanks||e.type===D.Uploading),ue=gf()((e,t)=>({allResponses:[],answers:void 0,apiURL:"",border:"#000000",cards:[],close:async(n=xn)=>{const r=t(),{fadeout:i,remove:o,trackHistory:a}=r;await i(n),So(r)||a({event:"closed"}),Uo.enable(),o({initiator:ut.Closed})},configureExitOnOverlayClick:()=>{},customMetadata:{},destroy:async n=>{const{eventEmitFn:r,fadeout:i,remove:o}=t();r(qe.SurveyComplete),await i(n),Uo.enable(),o({initiator:ut.Complete})},endCard:{headline:""},envId:"",eventEmitFn:q.emit.bind(q),fadeout:async n=>{const{eventEmitFn:r,headers:i,viewDocument:o}=t();return An(i)?Promise.resolve():(r(z.SurveyFadingOut),new Promise(a=>{const s=o.getElementById(n);s?(s.addEventListener("transitionend",()=>{a()}),s.classList.remove("ul-app--visible")):a()}))},frame:document.createElement("iframe"),handleClickEmbedButton:n=>{const{cards:r,eventEmitFn:i,index:o}=t();i(n,{[en.QuestionId]:r[o].name,[en.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!==D.Uploading){e({uploadProgress:c});return}const d=Object.entries(u).every(([m,g])=>!g.isSubmitted||g.isComplete||n==m&&r);if(d&&l>=a.length-1){s(xn);return}e({index:d?l+1:l,uploadingCardViewed:!0,uploadProgress:c})},hasViewedEmbed:!1,headers:{Authorization:"","Content-Type":"","userleap-platform":ln.Web,"x-ul-environment-id":"","x-ul-installation-method":on.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:m}=n.data,g={...n.data},_=g.value;k_(h)&&(h.value=_),g.answeredAt=f,delete g.type;const v={response:g,responseGroupUid:s,questionIndex:a};let b=m===D.MultipleChoice?Object.values(_).find(I=>I!==!1):_;m===D.MultipleSelect&&(b=p[a].props.options.reduce((I,x)=>(_[x.id]&&I.push(x.value),I),[]));const y=r.slice(0);y[a]=b,e({allResponses:y});const C=vf({cards:p,index:a,hasEndCard:!!n.endCard,uploadProgress:c,allResponses:y});if(C===null){v.completedAt=f,l(v),n.completeSurvey();return}else[D.Thanks,D.Uploading].includes(p[C].type)&&(v.completedAt=f);const S=l(v);[D.Thanks,D.Uploading].includes(p[C].type)||S.finally(()=>{u({event:"seen",index:C})});const E=p[C];p[C]&&o&&o(qe.CurrentQuestion,{[en.QuestionId]:E.name,[en.Props]:E.props}),e({cards:p,hasViewedEmbed:!1,index:C,viewedCardCount:d+1})},previewKey:null,recorder:()=>{},recorderEventEmitter:q,responseGroupUid:"",remove:({initiator:n})=>{const{frame:r,headers:i,eventEmitFn:o}=t();["ios","android"].includes(i["userleap-platform"])&&o(z.SurveyWillClose,{name:z.SurveyWillClose,initiator:n}),!An(i)&&(o(z.SurveyWillClose,{name:z.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||So(a))return;const s={responseGroupUid:o,meta:a.meta,customMetadata:a.customMetadata,responses:[i],completedAt:n,previewKey:a.previewKey};n&&zy({id:a.surveyId});const l=await ct(`${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 iu(a,"submitResponse",l.error));return}a.eventEmitFn(z.QuestionAnswered,{...i,questionIndex:r})},surveyId:0,tabTitle:"",trackHistory:async({event:n,index:r,isNew:i=!1})=>{const o=t();if(So(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 ct(`${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 iu(o,"trackHistory",c.error))},update:()=>{const{headers:n,eventEmitFn:r,frame:i,viewDocument:o}=t();setTimeout(()=>{var s;const a=Fu(o);An(n)?r(z.SurveyHeight,{name:z.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})),So=e=>!e.userId||e.meta&&e.meta.mode==="test"||e.isPreview,iu=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 ct(`${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)},x_=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},yf=()=>MediaRecorder.isTypeSupported("video/webm")?"video/webm":"video/mp4",ou=e=>{const t={audioBitsPerSecond:128e3,videoBitsPerSecond:25e5,mimeType:yf()};return new MediaRecorder(e,t)},au=(e,t,n)=>{n[t]=[],e.ondataavailable=function(r){n[t].push(r.data)},e.currentMediaRecordingUid=t,e.start()};function su(e,t,n,r,i){if(e&&e.state!=="inactive"){const{[W.BeginCallback]:o}=r,a=e.currentMediaRecordingUid;if(!a)return;o&&o(a),e.onstop=()=>A_(t,n,r,a,i),e.stop()}}async function A_(e,t,n,r,i){const o=ue.getState().viewDocument,{[W.UploadCallback]:a,[W.ProgressCallback]:s}=n,l={mediaType:t,updatedAt:new Date().toISOString(),mediaRecordingUid:r,...n[W.PassthroughData]},u=await x_(l,e);if(!u){a&&a(null,{message:"failed to get upload url"});return}const c=new Blob(i,{type:yf()});if(!o.defaultView)return;const d=new o.defaultView.File([c],`recording video ${Date.now()}`),f=D0({endpoint:u,file:d,chunkSize:5120});f.on("error",p=>{a&&a(null,p)}),f.on("progress",p=>{s&&s(r,p)}),f.on("success",()=>{a&&a(r,!0)})}const T_={chunks:{}},R_={state:{...T_},stopRecording(e){const{uploadApiEndpoint:t,avRecorder:n,screenRecorder:r}=this.state,i=this.state.avStream&&this.state.avStream.getVideoTracks().length>0?Qe.Video:Qe.Audio;this.state.chunks&&t&&(n!=null&&n.currentMediaRecordingUid&&su(n,t,i,e,this.state.chunks[n==null?void 0:n.currentMediaRecordingUid]),r!=null&&r.currentMediaRecordingUid&&su(r,t,Qe.Screen,e,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},configure(e,t){Object.assign(this.state,t),this.state.uploadApiEndpoint=`${t.apiURL}/2/environments/integrations/upload`,this.state.chunks={},e.on(Ae.PermissionStatus,this.permissionStatusCallback.bind(this)),e.on(Ae.AvPermission,async n=>{this.avPermissionCallback(n)}),e.on(Ae.BeginRecording,this.beginRecordingCallback.bind(this)),e.on(Ae.StartTask,this.startTaskCallback.bind(this)),e.on(Ae.ScreenPermission,async n=>{this.screenPermissionCallback(n)}),e.on(Ae.FinishTask,async n=>{this.finishTaskCallback(n)})},async avPermissionCallback(e){var r,i,o;const{[W.StreamReadyCallback]:t,[W.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(Fn.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{[W.ScreenPermissionRequested]:t,[W.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{[W.RecordingMediaTypes]:t,[W.StartRecordingCallback]:n}=e;if(!t)return;const r=[];if(t.includes(Qe.Video)&&this.state.avStream){this.state.avRecorder=ou(this.state.avStream);const i=jt();au(this.state.avRecorder,i,this.state.chunks),r.push(i)}if(t.includes(Qe.Screen)&&this.state.captureStream){this.state.screenRecorder=ou(this.state.captureStream);const i=jt();au(this.state.screenRecorder,i,this.state.chunks),r.push(i)}r&&n&&n(r)},async finishTaskCallback(e){const{[W.CurrentIndex]:t,[W.TaskResponse]:n,[W.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{[W.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}=ue.getState(),s=vf({cards:n,index:e,hasEndCard:r,allResponses:a});s!==null&&n[s].type===D.RecordedTask||[i,o].map(l=>{l&&(l.state==="recording"&&l.stop(),l.stream.getTracks().map(u=>{u.readyState==="live"&&u.stop()}))})}},Ca=Object.create(R_);Object.freeze(Ca);function _f(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=_f(e[t]))&&(r&&(r+=" "),r+=n);else for(t in e)e[t]&&(r&&(r+=" "),r+=t);return r}function j(){for(var e,t,n=0,r="";n<arguments.length;)(e=arguments[n++])&&(t=_f(e))&&(r&&(r+=" "),r+=t);return r}var L_=0;function w(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:--L_,__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 He=e=>w("button",{...e,className:j("ul-card-text__button",e.className),id:"ul-card-text__button"}),gt=({message:e,properties:t})=>{const n=t==null?void 0:t.captionText;return w(nt,{children:[e&&w("h1",{className:L.QuestionHeader,id:L.QuestionHeader,...n?{}:{style:{marginBottom:"15px"}},children:e}),n&&w("p",{className:L.Caption,id:L.Caption,children:n})]})},lu=({buttonText:e="View Prototype",handleClick:t})=>w("button",{className:"prototype-button",onClick:t,children:e},"prototype-btn"),$t=({defaultBody:e,embeddedType:t="prototype",properties:n})=>{var d;const{handleClickEmbedButton:r,hasViewedEmbed:i,headers:o,useDesktopPrototype:a}=ue(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<tm,u=o["userleap-platform"],c=(f,p)=>{f.preventDefault(),r(p)};if(!a&&l&&!i&&s&&["email","link"].includes(u)){if(t==="prototype")return w(lu,{handleClick:f=>{c(f,qe.ViewPrototypeClick)}});if(t==="pdf")return w(lu,{buttonText:(n==null?void 0:n.viewDocumentText)||"View Document",handleClick:f=>{c(f,qe.ViewAgreementClick)}})}return e()},bf=(e,t)=>{const n=Gt(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 We(r,[]),r},wf=({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}=ue(x=>({styleNonce:x.styleNonce,viewDocument:x.viewDocument})),[h,m]=ke(!1);D_(p,e,f);const g=({isSelected:x,userText:R})=>{d&&d({id:o||"",selected:x,value:r,userText:R})},_=x=>{x.stopPropagation(),g({isSelected:a||!n,userText:i}),m(!1)},v=()=>{h||m(!0)},b=()=>{h&&m(!1)},y=x=>{tr(x.target)||(x.key==="Enter"||x.key===" ")&&_(x)},C={onClick:x=>_(x),onKeyPress:x=>y(x)};"ontouchstart"in p.documentElement?(C.onTouchStart=b,C.onTouchCancel=b,C.onTouchEnd=b):(C.onMouseDown=v,C.onMouseLeave=b);const S=a?`radio-${o}`:`checkbox-${o}`,E=n||h?[si]:[],I=[...l?[Cf]:[],...E];return w("div",{className:j([..._e(L.Choice,s),...I]),id:`choice-div-${o}`,style:l?{borderColor:er}:{},...C,children:[w("div",{className:j([L.ChoiceLabelContainer]),children:[a?w("div",{"aria-labelledby":`label-${o}`,className:j([L.ChoiceRadio,...E]),id:S,role:"radio",tabIndex:0}):w("div",{"aria-checked":n,"aria-labelledby":`label-${o}`,className:L.ChoiceCheckbox,id:S,role:"checkbox",style:n?{backgroundColor:e,borderColor:e,boxShadow:"none"}:{},tabIndex:0,children:n&&w("svg",{fill:"none",height:"10",viewBox:"0 0 10 10",width:"10",xmlns:"http://www.w3.org/2000/svg",children:w("path",{d:"M9.15377 1.30774L4.07685 8.23082L1.30762 5.00005",stroke:"white",strokeLinecap:"round",strokeWidth:"2"})})}),w("label",{className:j(_e(L.ChoiceLabel,s)),htmlFor:S,id:`label-${o}`,children:t})]}),u&&n&&w("div",{className:j([L.ChoiceTextEntryContainer,...E]),children:w(O_,{onTextChange:x=>g({isSelected:n,userText:x}),promptText:c||"Please specify",textValue:i,useMobileStyling:s})})]})},O_=({promptText:e,textValue:t,onTextChange:n,useMobileStyling:r})=>{const i=Gt(null),{update:o}=ue(s=>({update:s.update})),a=bf(i,()=>o());return We(()=>{i.current&&i.current.focus()},[]),w("textarea",{"aria-label":e,"aria-multiline":"true","aria-placeholder":e,className:j(_e(L.ChoiceTextInput,r)),"data-gramm":"false",maxLength:5e3,name:"text",onChange:s=>{a(),tr(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})},uu="ul-select-style-element",si="ul-select-active-dynamic-style",Cf="ul-select-error-dynamic-style",N_=e=>e.tagName.toLowerCase()==="style",D_=(e,t,n)=>{let r=e.getElementById(uu),i=!1;r||(r=e.createElement("style"),i=!0),N_(r)&&(r.id=uu,n&&(r.nonce=n),r.textContent=U_(t),i&&e.head.appendChild(r))},U_=e=>`
55
- .${si} {
35
+ */var Qr=Ku,Bv=$u.exports;function Fv(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var Hv=typeof Object.is=="function"?Object.is:Fv,Kv=Bv.useSyncExternalStore,$v=Qr.useRef,qv=Qr.useEffect,Gv=Qr.useMemo,zv=Qr.useDebugValue;Hu.useSyncExternalStoreWithSelector=function(e,t,n,r,i){var o=$v(null);if(o.current===null){var a={hasValue:!1,value:null};o.current=a}else a=o.current;o=Gv(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 f=h}return f=p}if(h=f,Hv(c,p))return h;var v=r(p);return i!==void 0&&i(h,v)?h:(c=p,f=v)}var u=!1,c,f,d=n===void 0?null:n;return[function(){return l(t())},d===null?void 0:function(){return l(d())}]},[t,n,r,i]);var s=Kv(e,o[0],o[1]);return qv(function(){a.hasValue=!0,a.value=s},[s]),zv(s),s};(function(e){e.exports=Hu})(Fu);const Wv=Lc(Fu.exports),{useSyncExternalStoreWithSelector:Yv}=Wv;function Qv(e,t=e.getState,n){const r=Yv(e.subscribe,e.getState,e.getServerState||e.getState,t,n);return Xo(r),r}const gs=e=>{const t=typeof e=="function"?hv(e):e,n=(r,i)=>Qv(t,r,i);return Object.assign(n,t),n},Gu=e=>e?gs(e):gs;var lo=(e=>(e[e.And=1]="And",e[e.Or=2]="Or",e))(lo||{});const ys=1,na={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)}},Zv=(e,t,n)=>{switch(t){case A.VideoVoice:return Boolean(e&&e.value);case A.Open:return!!n;case A.MultipleSelect:return Boolean(n&&!!Object.keys(n).length);case A.RecordedTask:return(n==null?void 0:n.taskStatus)===Ie.Completed;case A.TextUrlPrompt:return!e.value;case A.ConsentLegal:return n!==null;case A.MultipleChoice:return n!==void 0;case A.NPS:return n!==null;case A.Likert:return n!==null;default:return!0}},zu=({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:f,target:d}=s[c];if(!(f!=null&&f.length))continue;const p=f[0];if(p.questionIndex===void 0||p.questionIndex>r.length)continue;let h=_s({comparator:p.comparator,response:r[p.questionIndex],type:o.type,value:p.value});for(let v=1;v<f.length;v+=2){const m=f[v],_=f[v+1],y=_s({comparator:_.comparator,response:r[_.questionIndex],type:e[_.questionIndex].type,value:_.value});m===lo.And?h&&(h=y):m===lo.Or&&(h||(h=y))}if(h){a=d===-1&&n?e.length-1:d;break}}const l=e.findIndex(c=>c.type===A.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(f=>f.isSubmitted&&!f.isComplete)?l:n?e.length-1:null:a===-1?null:a},_s=({comparator:e,response:t,type:n,value:r})=>{if(e===et.Answered)switch(n){case A.TextUrlPrompt:return t===void 0;case A.ConsentLegal:return t&&t.submitted===!0;case A.RecordedTask:return"taskStatus"in t&&t.taskStatus===Ie.Completed;case A.Likert:return Number.isInteger(t);case A.Open:return t&&t.length>0;case A.MultipleChoice:case A.MultipleSelect:return Object.keys(t).length>0;case A.NPS:return Number.isInteger(t);case A.VideoVoice:return!!(t!=null&&t.mediaRecordingUid);default:return!1}if(e===et.Skipped)switch(n){case A.TextUrlPrompt:return t==null?void 0:t.skipped;case A.ConsentLegal:return t===null;case A.RecordedTask:return"taskStatus"in t&&t.taskStatus===Ie.Abandoned;case A.Likert:return t===null;case A.Open:return(t==null?void 0:t.length)===0;case A.MultipleChoice:return t===void 0;case A.MultipleSelect:return(t==null?void 0:t.length)===0;case A.NPS:return t===null;case A.VideoVoice:return t===null;default:return!1}return e===et.GivenUp?n===A.RecordedTask?"taskStatus"in t&&t.taskStatus===Ie.GivenUp:!0:na[e](t,r)},Xv=13,Jv=(e,t)=>e.reduce((n,r)=>n.concat(n.map(i=>[...i,r])),[[]]).filter(n=>t||n.length>0),em=e=>{var t,n;switch(e.type){case A.MultipleSelect:return!e||!e.props||!e.props.options?null:e.props.options.length>Xv?e.props.options.map(r=>[r.value]):Jv(e.props.options.map(r=>r.value),!e.props.properties.required);case A.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 A.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 A.NPS:return[0,1,2,3,4,5,6,7,8,9,10,...e.props.properties.required?[]:[null]];case A.VideoVoice:case A.Open:return["1",...e.props.properties.required?[]:[""]];case A.RecordedTask:return[{taskStatus:Ie.Completed},{taskStatus:Ie.GivenUp},...e.props.properties.required?[]:[{taskStatus:Ie.Abandoned}]];case A.TextUrlPrompt:return[void 0,...e.props.properties.required?[]:[{skipped:!0}]];case A.ConsentLegal:return[ys,...e.props.properties.required?[]:[null]];default:return[ys]}},tm=e=>e in na,nm=e=>typeof e=="object"&&e!==null&&"taskStatus"in e,rm=(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]},[]),im=(e,t)=>{const n=new Set([A.Thanks,A.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=rm(o,a.props.routingOptions);if(s.length===0){i[o]=i[o+1]+1;continue}let l=0,u=em(a);if(u===null)return r.length-1-t;for(let c=0;c<s.length&&u.length!==0;c++){const{comparator:f,target:d,value:p}=s[c],h=u.filter(v=>{const m=Zv({value:v},a.type,v);return!(m&&f===et.Answered||!m&&f===et.Skipped||f===et.GivenUp&&nm(v)&&v.taskStatus===Ie.GivenUp||m&&a.type===A.Open&&(f===et.Contains||f===et.DoesNotContain)||m&&tm(f)&&na[f](v,p))});if(h.length<u.length){const v=parseInt(String(d),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]},om=e=>!(e.type===A.Thanks||e.type===A.Uploading),J=Gu()((e,t)=>({allResponses:[],answers:void 0,apiURL:"",border:"#000000",cards:[],close:async(n=Yt)=>{const r=t(),{fadeout:i,remove:o,trackHistory:a}=r;await i(n),yi(r)||a({event:"closed"}),Ti.enable(),o({initiator:He.Closed})},configureExitOnOverlayClick:()=>{},customMetadata:{},destroy:async n=>{const{eventEmitFn:r,fadeout:i,remove:o}=t();r(Te.SurveyComplete),await i(n),Ti.enable(),o({initiator:He.Complete})},endCard:{headline:""},envId:"",eventEmitFn:G.emit.bind(G),fadeout:async n=>{const{eventEmitFn:r,headers:i,viewDocument:o}=t();return Qt(i)?Promise.resolve():(r(F.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 d,p,h;const{cards:a,destroy:s,index:l,uploadProgress:u}=t(),c={...u,[n]:{progressPct:i||i===0?i:(d=u[n])==null?void 0:d.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!==A.Uploading){e({uploadProgress:c});return}const f=Object.entries(u).every(([v,m])=>!m.isSubmitted||m.isComplete||n==v&&r);if(f&&l>=a.length-1){s(Yt);return}e({index:f?l+1:l,uploadingCardViewed:!0,uploadProgress:c})},hasViewedEmbed:!1,headers:{Authorization:"","Content-Type":"","userleap-platform":Nt.Web,"x-ul-environment-id":"","x-ul-installation-method":mt.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:f}=t(),d=Date.now(),p=[...i],h=p[a],{type:v}=n.data,m={...n.data},_=m.value;om(h)&&(h.value=_),m.answeredAt=d,delete m.type;const y={response:m,responseGroupUid:s,questionIndex:a};let E=v===A.MultipleChoice?Object.values(_).find(I=>I!==!1):_;v===A.MultipleSelect&&(E=p[a].props.options.reduce((I,k)=>(_[k.id]&&I.push(k.value),I),[]));const w=r.slice(0);w[a]=E,e({allResponses:w});const b=zu({cards:p,index:a,hasEndCard:!!n.endCard,uploadProgress:c,allResponses:w});if(b===null){y.completedAt=d,l(y),n.completeSurvey();return}else[A.Thanks,A.Uploading].includes(p[b].type)&&(y.completedAt=d);const x=l(y);[A.Thanks,A.Uploading].includes(p[b].type)||x.finally(()=>{u({event:"seen",index:b})});const C=p[b];p[b]&&o&&o(Te.CurrentQuestion,{[At.QuestionId]:C.name,[At.Props]:C.props}),e({cards:p,hasViewedEmbed:!1,index:b,viewedCardCount:f+1})},previewKey:null,recorder:()=>{},recorderEventEmitter:G,responseGroupUid:"",remove:({initiator:n})=>{const{frame:r,headers:i,eventEmitFn:o}=t();["ios","android"].includes(i["userleap-platform"])&&o(F.SurveyWillClose,{name:F.SurveyWillClose,initiator:n}),!Qt(i)&&(o(F.SurveyWillClose,{name:F.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||yi(a))return;const s={responseGroupUid:o,meta:a.meta,customMetadata:a.customMetadata,responses:[i],completedAt:n,previewKey:a.previewKey};n&&sv({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 ws(a,"submitResponse",l.error));return}a.eventEmitFn(F.QuestionAnswered,{...i,questionIndex:r})},surveyId:0,tabTitle:"",trackHistory:async({event:n,index:r,isNew:i=!1})=>{const o=t();if(yi(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 ws(o,"trackHistory",c.error))},update:()=>{const{headers:n,eventEmitFn:r,frame:i,viewDocument:o}=t();setTimeout(()=>{var s;const a=tl(o);Qt(n)?r(F.SurveyHeight,{name:F.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})),yi=e=>!e.userId||e.meta&&e.meta.mode==="test"||e.isPreview,ws=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},f={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(f)})).ok||console.warn("[Sprig] (ERR-444) Failed to report error to API",n)},am=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},Wu=()=>MediaRecorder.isTypeSupported("video/webm")?"video/webm":"video/mp4",bs=e=>{const t={audioBitsPerSecond:128e3,videoBitsPerSecond:25e5,mimeType:Wu()};return new MediaRecorder(e,t)},Es=(e,t,n)=>{n[t]=[],e.ondataavailable=function(r){n[t].push(r.data)},e.currentMediaRecordingUid=t,e.start()};function xs(e,t,n,r,i,o){if(e&&e.state!=="inactive"){const{[q.BeginCallback]:a}=r,s=e.currentMediaRecordingUid;if(!s)return;a&&a(s),e.onstop=()=>sm(t,e,n,r,s,i,o),e.stop()}}async function sm(e,t,n,r,i,o,a){const s=J.getState().viewDocument,{[q.UploadCallback]:l,[q.ProgressCallback]:u}=r,c={mediaType:n,updatedAt:new Date().toISOString(),mediaRecordingUid:i,...r[q.PassthroughData]},f=await am(c,e);if(!f){l&&l(null,{message:"failed to get upload url"});return}const d=new Blob(a,{type:Wu()});if(!s.defaultView)return;const p=new s.defaultView.File([d],`recording video ${Date.now()}`),h=o.createUpload({endpoint:f,file:p,chunkSize:5120});h.startTime=Date.now(),h.on("error",v=>{l&&l(null,v)}),h.on("progress",v=>{u&&u(i,v)}),h.on("success",()=>{l&&l(i,!0)})}const lm={chunks:{}},um={state:{...lm},stopRecording(e){const{uploadApiEndpoint:t,avRecorder:n,screenRecorder:r,UpChunk:i}=this.state,o=this.state.avStream&&this.state.avStream.getVideoTracks().length>0?Ue.Video:Ue.Audio;this.state.chunks&&t&&i&&(n!=null&&n.currentMediaRecordingUid&&xs(n,t,o,e,i,this.state.chunks[n==null?void 0:n.currentMediaRecordingUid]),r!=null&&r.currentMediaRecordingUid&&xs(r,t,Ue.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(de.PermissionStatus,this.permissionStatusCallback.bind(this)),e.on(de.AvPermission,async n=>{this.avPermissionCallback(n)}),e.on(de.BeginRecording,this.beginRecordingCallback.bind(this)),e.on(de.StartTask,this.startTaskCallback.bind(this)),e.on(de.ScreenPermission,async n=>{this.screenPermissionCallback(n)}),e.on(de.FinishTask,async n=>{this.finishTaskCallback(n)})},async avPermissionCallback(e){var r,i,o;const{[q.StreamReadyCallback]:t,[q.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{[q.ScreenPermissionRequested]:t,[q.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{[q.RecordingMediaTypes]:t,[q.StartRecordingCallback]:n}=e;if(!t)return;const r=[];if(t.includes(Ue.Video)&&this.state.avStream){this.state.avRecorder=bs(this.state.avStream);const i=gt();Es(this.state.avRecorder,i,this.state.chunks),r.push(i)}if(t.includes(Ue.Screen)&&this.state.captureStream){this.state.screenRecorder=bs(this.state.captureStream);const i=gt();Es(this.state.screenRecorder,i,this.state.chunks),r.push(i)}r&&n&&n(r)},async finishTaskCallback(e){const{[q.CurrentIndex]:t,[q.TaskResponse]:n,[q.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{[q.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}=J.getState(),s=zu({cards:n,index:e,hasEndCard:r,allResponses:a});s!==null&&n[s].type===A.RecordedTask||[i,o].map(l=>{l&&(l.state==="recording"&&l.stop(),l.stream.getTracks().map(u=>{u.readyState==="live"&&u.stop()}))})}},yr=Object.create(um);Object.freeze(yr);function Yu(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=Yu(e[t]))&&(r&&(r+=" "),r+=n);else for(t in e)e[t]&&(r&&(r+=" "),r+=t);return r}function B(){for(var e,t,n=0,r="";n<arguments.length;)(e=arguments[n++])&&(t=Yu(e))&&(r&&(r+=" "),r+=t);return r}var cm=0;function g(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:--cm,__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 Ee=e=>g("button",{...e,className:B("ul-card-text__button",e.className),id:"ul-card-text__button"}),We=({message:e,properties:t})=>{const n=t==null?void 0:t.captionText;return g(Le,{children:[e&&g("h1",{className:R.QuestionHeader,id:R.QuestionHeader,...n?{}:{style:{marginBottom:"15px"}},children:e}),n&&g("p",{className:R.Caption,id:R.Caption,children:n})]})},Ss=({buttonText:e="View Prototype",handleClick:t})=>g("button",{className:"prototype-button",onClick:t,children:e},"prototype-btn"),St=({defaultBody:e,embeddedType:t="prototype",properties:n})=>{var f;const{handleClickEmbedButton:r,hasViewedEmbed:i,headers:o,useDesktopPrototype:a}=J(d=>({handleClickEmbedButton:d.handleClickEmbedButton,hasViewedEmbed:d.hasViewedEmbed,headers:d.headers,useDesktopPrototype:d.useDesktopPrototype})),s=(n==null?void 0:n.conceptUrl)||((f=n==null?void 0:n.consentDocument)==null?void 0:f.url),l=window.innerWidth<Df,u=o["userleap-platform"],c=(d,p)=>{d.preventDefault(),r(p)};if(!a&&l&&!i&&s&&["email","link"].includes(u)){if(t==="prototype")return g(Ss,{handleClick:d=>{c(d,Te.ViewPrototypeClick)}});if(t==="pdf")return g(Ss,{buttonText:(n==null?void 0:n.viewDocumentText)||"View Document",handleClick:d=>{c(d,Te.ViewAgreementClick)}})}return e()},Qu=(e,t)=>{const n=bt(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 ke(r,[]),r},Zu=({border:e,label:t,isSelected:n,value:r,text:i,id:o,isRadio:a,useMobileStyling:s,error:l,allowTextEntry:u,promptText:c,onUserInputChanged:f})=>{const{styleNonce:d,viewDocument:p}=J(k=>({styleNonce:k.styleNonce,viewDocument:k.viewDocument})),[h,v]=le(!1);pm(p,e,d);const m=({isSelected:k,userText:L})=>{f&&f({id:o||"",selected:k,value:r,userText:L})},_=k=>{k.stopPropagation(),m({isSelected:a||!n,userText:i}),v(!1)},y=()=>{h||v(!0)},E=()=>{h&&v(!1)},w=k=>{Sn(k.target)||(k.key==="Enter"||k.key===" ")&&_(k)},b={onClick:k=>_(k),onKeyPress:k=>w(k)};"ontouchstart"in p.documentElement?(b.onTouchStart=E,b.onTouchCancel=E,b.onTouchEnd=E):(b.onMouseDown=y,b.onMouseLeave=E);const x=a?`radio-${o}`:`checkbox-${o}`,C=n||h?[_r]:[],I=[...l?[Xu]:[],...C];return g("div",{className:B([...re(R.Choice,s),...I]),id:`choice-div-${o}`,style:l?{borderColor:xn}:{},...b,children:[g("div",{className:B([R.ChoiceLabelContainer]),children:[a?g("div",{"aria-labelledby":`label-${o}`,className:B([R.ChoiceRadio,...C]),id:x,role:"radio",tabIndex:0}):g("div",{"aria-checked":n,"aria-labelledby":`label-${o}`,className:R.ChoiceCheckbox,id:x,role:"checkbox",style:n?{backgroundColor:e,borderColor:e,boxShadow:"none"}:{},tabIndex:0,children:n&&g("svg",{fill:"none",height:"10",viewBox:"0 0 10 10",width:"10",xmlns:"http://www.w3.org/2000/svg",children:g("path",{d:"M9.15377 1.30774L4.07685 8.23082L1.30762 5.00005",stroke:"white",strokeLinecap:"round",strokeWidth:"2"})})}),g("label",{className:B(re(R.ChoiceLabel,s)),htmlFor:x,id:`label-${o}`,children:t})]}),u&&n&&g("div",{className:B([R.ChoiceTextEntryContainer,...C]),children:g(dm,{onTextChange:k=>m({isSelected:n,userText:k}),promptText:c||"Please specify",textValue:i,useMobileStyling:s})})]})},dm=({promptText:e,textValue:t,onTextChange:n,useMobileStyling:r})=>{const i=bt(null),{update:o}=J(s=>({update:s.update})),a=Qu(i,()=>o());return ke(()=>{i.current&&i.current.focus()},[]),g("textarea",{"aria-label":e,"aria-multiline":"true","aria-placeholder":e,className:B(re(R.ChoiceTextInput,r)),"data-gramm":"false",maxLength:5e3,name:"text",onChange:s=>{a(),Sn(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})},Cs="ul-select-style-element",_r="ul-select-active-dynamic-style",Xu="ul-select-error-dynamic-style",fm=e=>e.tagName.toLowerCase()==="style",pm=(e,t,n)=>{let r=e.getElementById(Cs),i=!1;r||(r=e.createElement("style"),i=!0),fm(r)&&(r.id=Cs,n&&(r.nonce=n),r.textContent=hm(t),i&&e.head.appendChild(r))},hm=e=>`
36
+ .${_r} {
56
37
  border-color: ${e};
57
38
  }
58
- .${si} .${L.ChoiceRadio}, .${si}.${L.ChoiceRadio} {
39
+ .${_r} .${R.ChoiceRadio}, .${_r}.${R.ChoiceRadio} {
59
40
  border: 6px solid ${e};
60
41
  box-shadow: none;
61
42
  }
62
- .${Cf} {
63
- border-color: ${er};
43
+ .${Xu} {
44
+ border-color: ${xn};
64
45
  }
65
- `,qn=e=>(e==null?void 0:e.buttonText)||"Next",_s=e=>(e==null?void 0:e.skipButtonText)||"Skip",P_=({className:e,message:t,next:n,properties:r,questionId:i,type:o})=>{const{headers:a,useMobileStyling:s,border:l}=ue(T=>({headers:T.headers,useMobileStyling:T.useMobileStyling,border:T.border})),[u,c]=ke(!1),[d,f]=ke(""),[p,h]=ke(!1),m=a["userleap-platform"],g=r==null?void 0:r.collectName,_=(r==null?void 0:r.nameLabelText)||"Full Name",v=(r==null?void 0:r.consentText)||"I agree to the stated conditions",b=(r==null?void 0:r.submitButtonText)||"Submit",y=!!d.trim(),C=u&&(!g||y),S=(T,O=!1)=>{T.preventDefault(),T.stopPropagation();let k=null;if(!O){if(!C){h(!0);return}k={submitted:!0},g&&(k.name=d)}n({value:k,questionId:i,type:o})},E=T=>{am(T.target)&&(T.preventDefault(),T.stopPropagation(),f(T.target.value))},I=T=>{Nn(T.target)&&(T.target.style.borderColor=p&&!y?er:l)},x=T=>{Nn(T.target)&&(T.target.style.borderColor=p&&!y?er:za)},R=()=>w("div",{children:[w(wf,{allowTextEntry:!1,border:l,error:p&&!u,index:0,isRadio:!1,isSelected:u,label:v,onUserInputChanged:({selected:T})=>{T!==u&&c(!u)},useMobileStyling:s}),g&&w("input",{"aria-label":_,"aria-placeholder":_,className:j(_e(L.ConsentLegalNameInput,s)),"data-gramm":"false",maxLength:250,name:"name",onBlur:x,onFocus:I,onInput:E,placeholder:_,style:p&&!y?{borderColor:er}:{},tabIndex:0,value:d}),w("div",{className:"ul-card__button-wrapper ul-card-vertical__button-wrapper",children:[w(He,{className:C?"":L.ButtonDisabled,onClick:S,children:b}),r.required===!1&&w("button",{className:L.SkipButton,onClick:T=>S(T,!0),children:_s(r)})]})]});return w("div",{className:j(ht(L.CardMainContent,m)),children:w("div",{className:j([e,"ul-card__consent-legal",L.FadeInTransition]),children:[w(gt,{message:t}),w("div",{className:"ul-rich-text-body",dangerouslySetInnerHTML:r&&r.richTextBody?{__html:r&&r.richTextBody}:void 0,id:"ul-card__consent-legal-body-container"}),w($t,{properties:r,defaultBody:R,embeddedType:"pdf"})]},i)})},M_=({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===rn.Number,p=a===rn.Star,h=f&&c===e,[m,g]=(()=>c<=e&&p||c===e?r?[t,1]:[t,.3]:["",1])(),_=()=>{switch(a){case rn.Star:return j([..._e(L.LikertStar,u),..._e(`${L.LikertStar}-${c}`,u)]);case rn.Smiley:return j([..._e(L.LikertSmiley,u),..._e(`${L.LikertSmiley}-${c}`,u)]);default:return j(c===o?[..._e(L.LikertNumber,u),..._e(`${L.LikertNumber}-${c}`,u),..._e("likert-last-option",u)]:[..._e(L.LikertNumber,u),..._e(`${L.LikertNumber}-${c}`,u)])}},v=()=>{s(-1),l(!1)};return w("div",{"aria-label":f?void 0:String(c),className:_(),dangerouslySetInnerHTML:{__html:n},id:d,onClick:()=>i(),onPointerDown:()=>l(!0),onPointerEnter:()=>s(c),onPointerLeave:v,role:"radio",style:{color:f?"":m,borderColor:h?m:"",fillOpacity:h?"":g,zIndex:h?3:"auto"},tabIndex:0})},F_=({className:e,labels:t,message:n,next:r,properties:i,questionId:o,type:a})=>{const{border:s,headers:l,useMobileStyling:u}=ue(R=>({border:R.border,headers:R.headers,useMobileStyling:R.useMobileStyling})),[c,d]=ke(-1),[f,p]=ke(!1),h=l["userleap-platform"],m=t&&t.left,g=t&&t.right;let _;const{range:v,scaleLabelType:b,ratingIcons:y}=i;v&&(_=Number(v));const C=_||5,S=R=>{var T,O;switch(b){case rn.Star:return(T=y[0])==null?void 0:T.svg;case rn.Smiley:return(O=y[R])==null?void 0:O.svg;default:return String(R+1)}},E=[...Array(C)].map((R,T)=>{const O=T+1;return w(M_,{activeValue:c,border:s,icon:S(T),isPressed:f,onSubmit:()=>r({value:O,questionId:o,type:a}),range:C,scaleLabelType:b,setActiveValue:d,setIsPressed:p,useMobileStyling:u,value:O},T)}),I=R=>{R.preventDefault(),R.stopPropagation(),r({value:null,questionId:o,type:a})},x=()=>w(nt,{children:[w("div",{"aria-label":`Rating (1 - ${C})`,className:"ul-card--likert__numbers",role:"radiogroup",children:E}),w("div",{className:"ul-card--likert__labels",children:[w("span",{children:m}),w("span",{children:g})]}),!i.required&&w("div",{className:"ul-vertical-centered-container",children:w(He,{onClick:I,children:qn(i)})})]});return w("div",{className:j(ht(L.CardMainContent,h)),children:w("form",{className:j([e,"ul-card--likert",L.FadeInTransition]),children:[w(gt,{message:n,properties:i}),w($t,{properties:i,defaultBody:x})]},o)})},If=({className:e,message:t,onSubmit:n,options:r=[],properties:i,questionId:o,type:a})=>{const{border:s,headers:l,useMobileStyling:u}=ue(E=>({border:E.border,headers:E.headers,useMobileStyling:E.useMobileStyling})),c=r.reduce((E,I)=>(E[I.id]={isSelected:!1},E),{}),[d,f]=ke(c),p=l["userleap-platform"],h=a===D.MultipleChoice,m=i.required,g=Object.entries(d).some(([E,I])=>{var T;const x=r.find(O=>`${O.id}`===E),R=I.userText===void 0||I.userText.trim()==="";return((T=x==null?void 0:x.optionProperties)==null?void 0:T.allowsTextEntry)&&R&&I.isSelected}),_=Object.values(d).some(E=>E.isSelected),v=g||m&&!_,b=r.map(({id:E,label:I,value:x,optionProperties:R},T)=>{var N,A;const O=`${E}`,{allowsTextEntry:k}=R||{allowsTextEntry:!1};return w(wf,{allowTextEntry:k,border:s,error:!1,id:O,index:T,isRadio:h,isSelected:!!((N=d[O])!=null&&N.isSelected),label:I,onUserInputChanged:B=>C(B.id,B.selected,B.userText),promptText:"Please specify",text:(A=d[E])==null?void 0:A.userText,useMobileStyling:u,value:x},O)}),y=E=>{E.preventDefault(),E.stopPropagation(),n(d)},C=(E,I,x)=>{const R=Object.assign({},d);if(h&&I)for(const T of Object.values(R))T.isSelected=!1,delete T.userText;R[E]={isSelected:I,userText:x},f(R)},S=()=>w("div",{children:[w("div",{className:j(_e(L.ChoiceGroup,u)),role:h?"radiogroup":"group",children:b}),w("div",{className:"ul-card__button-wrapper",children:w(He,{disabled:v,onClick:y,children:qn(i)})})]});return w("div",{className:j(ht(L.CardMainContent,p)),children:w("form",{className:j([e,"ul-card--multiple",L.FadeInTransition]),id:"text-form",onSubmit:y,children:[w(gt,{message:t,properties:i}),w($t,{properties:i,defaultBody:S})]},o)})},V_=e=>{const{questionId:t,type:n,next:r,options:i}=e;return w(If,{...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})}})},B_=e=>{const{questionId:t,type:n,next:r}=e;return w(If,{...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})}})},j_=({className:e,props:{labels:t,message:n,properties:r},next:i,questionId:o,type:a})=>{const{border:s,headers:l,useMobileStyling:u}=ue(g=>({border:g.border,headers:g.headers,useMobileStyling:g.useMobileStyling})),c=l["userleap-platform"],d=t&&t.left,f=t&&t.right,p=[...Array(11)].map((g,_)=>w("div",{className:j([..._e(L.NPSNumber,u),..._e(`${L.NPSNumber}-${_}`,u)]),id:`option-${_}`,onClick:()=>i({value:_,questionId:o,type:a}),onKeyPress:v=>{v.preventDefault(),(v.key==="Enter"||v.key===" ")&&i({value:_,questionId:o,type:a})},onPointerDown:v=>{Nn(v.target)&&(v.target.style.zIndex="2",v.target.style.borderColor=s)},onPointerLeave:v=>{Nn(v.target)&&(v.target.style.zIndex="auto",v.target.style.borderColor=za)},role:"radio",tabIndex:0,children:_},_)),h=g=>{g.preventDefault(),g.stopPropagation(),i({value:null,questionId:o,type:a})},m=()=>w("div",{children:[w("div",{className:"ul-card--nps__numbers",children:p}),w("div",{className:"ul-card--nps__labels",children:[w("span",{children:d}),w("span",{children:f})]}),!r.required&&w("div",{className:"ul-vertical-centered-container",children:w(He,{onClick:h,children:qn(r)})})]});return w("div",{className:j(ht(L.CardMainContent,c)),children:w("form",{className:j([e,"ul-card--nps",L.FadeInTransition]),children:[w(gt,{message:n,properties:r}),w($t,{properties:r,defaultBody:m})]},o)})},H_=({className:e,message:t,next:n,properties:r,questionId:i,type:o})=>{const{border:a,headers:s,useMobileStyling:l,update:u}=ue(E=>({border:E.border,headers:E.headers,useMobileStyling:E.useMobileStyling,update:E.update})),[c,d]=ke(""),f=Gt(null),p=s["userleap-platform"],h=c.trim(),m=r.required===!0&&!h,g=bf(f,()=>u()),_=E=>{g(),E.preventDefault(),E.stopPropagation(),tr(E.target)&&d(E.target.value)},v=E=>{E.preventDefault(),E.stopPropagation(),n({value:c,questionId:i,type:o})},b=r&&r.openTextPlaceholder?r.openTextPlaceholder:"",y=E=>{tr(E.target)&&(E.target.style.borderColor=a)},C=E=>{tr(E.target)&&(E.target.style.borderColor=za)},S=()=>w("div",{className:"ul-card-text",children:[w("div",{className:"ul-card-text__container",children:w("textarea",{"aria-label":b,"aria-labelledby":L.QuestionHeader,"aria-multiline":"true","aria-placeholder":b,className:j(_e(L.OpenTextInput,l)),"data-gramm":"false",maxLength:5e3,name:"text",onBlur:C,onChange:_,onFocus:y,placeholder:b,ref:f,role:"textbox",tabIndex:0})}),w(He,{disabled:m,onClick:v,style:{backgroundColor:m?"":a},children:qn(r)})]});return w("div",{className:j(ht(L.CardMainContent,p)),children:w("form",{className:j([e,"ul-card--text",L.FadeInTransition]),id:"text-form",children:[w(gt,{message:t,properties:r}),w($t,{defaultBody:S,properties:r})]},i)})};var Ft=(e=>(e[e.RequestNeeded=1]="RequestNeeded",e[e.TryAgain=2]="TryAgain",e[e.Ready=3]="Ready",e))(Ft||{});const Qi=e=>e.type===Ke.AvPermission,Ef=e=>e.type===Ke.ScreenPermission,z_=(e,t)=>!(Qi(t)?t.permissionDescriptors:[]).includes(Fn.Camera)||e.getVideoTracks().length>0,Sf=(e,t)=>{if(e===void 0)return Ft.RequestNeeded;if(e){if(!z_(e,t))return Ft.RequestNeeded}else return Ft.TryAgain;return Ft.Ready},cu={avStream:null,currentPage:null,mediaRecordingUids:null,nextQuestion:()=>{},passthroughData:void 0,recordingMediaTypes:void 0,screenPermissionRequested:!1,type:void 0},dt=gf(e=>({...cu,reset:()=>{e(cu)},updatePage:t=>{e(t)}}));function Ia({currentPage:e,pages:t}){const{avStream:n,recordingMediaTypes:r,updatePage:i}=dt.getState(),{recorderEventEmitter:o}=ue.getState();o.emit(Ae.AvPermission,{[W.PermissionDescriptors]:e.permissionDescriptors,[W.StreamReadyCallback]:(a,s)=>{if(n===a)return;let l=e;if(a&&!e.permissionDescriptors.includes(Fn.Camera)){const u=t.indexOf(e),c=s!=null&&s.active?u+2:u+1;(s==null?void 0:s.active)&&r&&o.emit(Ae.BeginRecording,{[W.RecordingMediaTypes]:r,[W.StartRecordingCallback]:d=>i({mediaRecordingUids:d})}),l=t[c]}i({currentPage:l,avStream:a})}})}function K_({pages:e,userId:t,responseGroupUid:n,surveyId:r,questionId:i,next:o}){const{updatePage:a}=dt.getState(),{eventEmitFn:s,recorderEventEmitter:l}=ue.getState(),u={questionId:i,surveyId:r,visitorId:t,responseGroupUid:n};let c=0;l.emit(qe.RecordedTaskPermissionScreen),s(qe.RecordedTaskPermissionScreen),l.emit(Ae.PermissionStatus,{[W.PermissionStatusCallback]:(f,p,h,m)=>{const g=e[c],{type:_}=g,v=[Qe.Screen];if(Qi(g)){const{permissionDescriptors:b}=g,y=b==null?void 0:b.includes(Fn.Microphone),C=b==null?void 0:b.includes(Fn.Camera);y&&v.push(Qe.Audio),C&&v.push(Qe.Video);const S=(f==null?void 0:f.active)&&!C,E=(f==null?void 0:f.active)&&p;(S||E)&&c++}Ef(e[c])&&h&&(c++,l.emit(Ae.BeginRecording,{[W.RecordingMediaTypes]:v,[W.StartRecordingCallback]:b=>a({mediaRecordingUids:b})})),a({currentPage:e[c],avStream:f,screenPermissionRequested:h,nextQuestion:o,type:_,passthroughData:u,recordingMediaTypes:v,captureStream:m})}});const d=e[c];return d.type===Ke.AvPermission&&Ia({currentPage:d,pages:e}),d}function Ea({status:e}){const{nextQuestion:t,passthroughData:n,mediaRecordingUids:r,reset:i}=dt.getState(),{recorderEventEmitter:o,handleUploadUpdate:a,index:s}=ue.getState(),l={value:{taskStatus:e},type:D.RecordedTask,questionId:(n==null?void 0:n.questionId)||1};!n||o.emit(Ae.FinishTask,{[W.BeginCallback]:u=>{a({mediaRecordingUid:u,isSubmitted:!0,progressPct:0,isComplete:!1})},[W.ProgressCallback]:(u,c)=>{a({mediaRecordingUid:u,progressPct:c.detail,isSubmitted:!1,isComplete:!1})},[W.UploadCallback]:u=>{u&&a({mediaRecordingUid:u,isComplete:!0,isSubmitted:!0,progressPct:100})},[W.PassthroughData]:n,[W.CurrentIndex]:s,[W.TaskResponse]:l,[W.TaskCompleteCallback]:u=>{l.value.taskDurationMillisecond=u,r&&(l.value.mediaRecordingUids=r),i(),t(l)}})}function bs({pages:e,setIsRequestingPermission:t}){const{recorderEventEmitter:n,eventEmitFn:r}=ue.getState(),{updatePage:i,currentPage:o,recordingMediaTypes:a,screenPermissionRequested:s}=dt.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(Ae.BeginRecording,{[W.RecordingMediaTypes]:a,[W.StartRecordingCallback]:c=>{i({mediaRecordingUids:c})}}),i({currentPage:e[u]});return}case Ke.ScreenPermission:n.emit(Ae.ScreenPermission,{[W.ScreenPermissionRequested]:t,[W.StreamReadyCallback]:(u,c)=>{const d=c?e[l+1]:o;c&&a&&n.emit(Ae.BeginRecording,{[W.RecordingMediaTypes]:a,[W.StartRecordingCallback]:f=>{i({captureStream:c,mediaRecordingUids:f})}}),i({currentPage:d,screenPermissionRequested:!0,captureStream:c})}});return;case Ke.StartTask:r(qe.RecordedTaskStart),n.emit(qe.RecordedTaskStart),n.emit(Ae.StartTask),i({currentPage:e[l+1],screenPermissionRequested:!0});return;case Ke.CompleteTask:return}}const kf="ul-permission-graphics-container",xf="ul-permission-body",Af=j([kf,"ul_recorded-task-inset-spacing"]),Xi=j(["ul-horizontal-button-container","ul-horizontal-button-container-left"]),Tf=({richTextBody:e})=>w("div",{className:"ul-rich-text-body",dangerouslySetInnerHTML:{__html:e},id:"ul-task-detail-container"}),Ji=({required:e,skipButtonText:t,bottom:n=!1})=>e?null:w(He,{className:j([n&&"ul-skip-button-below",L.InactiveButton]),onClick:Ea.bind(null,{status:Ge.Abandoned}),children:t||"Skip"}),ws=e=>{const{avStream:t,captureStream:n,recordingMediaTypes:r,updatePage:i}=dt.getState(),o=(r==null?void 0:r.includes(Qe.Audio))||(r==null?void 0:r.includes(Qe.Video));We(()=>{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])},G_=({content:e,pages:t,required:n})=>{const{buttonText:r,skipButtonText:i,taskDetail:o}=e;return ws(t),w("div",{className:"ul-task-page",children:[w(Tf,{richTextBody:o}),w("div",{className:Xi,children:[w(He,{onClick:bs.bind(null,{pages:t}),children:r}),w(Ji,{required:n,skipButtonText:i})]})]},"start-task")},W_=({content:e,pages:t,properties:n})=>{const{buttonText:r,skipButtonText:i}=e;ws(t);const a=w($t,{properties:n,defaultBody:()=>w("div",{className:Xi,children:[w(He,{className:"ul-complete-task-button",onClick:Ea.bind(null,{status:Ge.Completed}),children:r}),w(He,{className:j([L.InactiveButton]),onClick:Ea.bind(null,{status:Ge.GivenUp}),children:i})]})});return w("div",{className:"ul-task-page",children:[w(Tf,{richTextBody:e.taskDetail}),a]},"complete-task")},q_=({content:e,pages:t,required:n})=>{const{buttonText:r,skipButtonText:i}=e,[o]=ue(l=>[l.tabTitle]),[a,s]=ke(!1);return w("div",{children:[w("div",{className:Af,children:[w("p",{style:{marginTop:"auto"},children:e.selectTabText}),w("div",{className:"ul-select-tab-container",children:w("p",{className:xf,children:o})})]}),w("div",{className:n?"":Xi,children:[w(He,{disabled:a,onClick:bs.bind(null,{pages:t,setIsRequestingPermission:s}),children:r}),w(Ji,{required:n,skipButtonText:i})]})]})},$_=({content:e})=>w("div",{className:j([kf,"ul_permission_svg_container","ul_recorded-task-inset-spacing","ul-center-horizontally"]),dangerouslySetInnerHTML:{__html:e.svg}},"ul-permission-request-graphic"),Z_=({content:e,pages:t,required:n})=>{const{permissionDeniedHeadline:r,permissionDeniedBody:i,skipButtonText:o,tryAgainButtonText:a}=e,s=Qi(t[0])?t[0]:null;return We(()=>{const l=setInterval(()=>{s!==null&&Ia({currentPage:s,pages:t})},1e3);return()=>clearInterval(l)},[s,t]),s?w("div",{children:[w("div",{className:Af,children:w("p",{className:"ul-av-permission-denied-paragraph",children:[w("span",{className:"ul-av-permission-denied-headline",children:r}),w("span",{className:xf,children:i})]})}),w("div",{className:Xi,children:[w(He,{onClick:Ia.bind(null,{currentPage:s,pages:t}),children:a}),w(Ji,{required:n,skipButtonText:o})]})]}):null},Y_=({stream:e})=>w("video",{autoPlay:!0,className:j(["ul_recorded-task-inset-spacing"]),id:"ul-record-task-video-preview",muted:!0,ref:t=>{t&&(t.srcObject=e||null)}}),Q_=({content:e,pages:t,required:n})=>{const{skipButtonText:r}=e,{avStream:i}=dt.getState();return ws(t),w("div",{children:[w(Y_,{stream:i}),w("div",{className:"ul-vertical-button-container-center",children:[w(He,{onClick:bs.bind(null,{pages:t}),children:e.buttonText}),w(Ji,{bottom:!0,required:n,skipButtonText:r})]})]})},X_=({properties:e})=>{const{pages:t,required:n}=e,{avStream:r,currentPage:i}=dt.getState();if(i===void 0)return null;switch(i==null?void 0:i.type){case Ke.AvPermission:{const o=Sf(r,i);return o===Ft.RequestNeeded?w($_,{content:i}):o===Ft.TryAgain?w(Z_,{content:i,pages:t,required:n}):w(Q_,{content:i,pages:t,required:n})}case Ke.ScreenPermission:return w(q_,{content:i,pages:t,required:n});case Ke.StartTask:return w(G_,{content:i,pages:t,required:n});case Ke.CompleteTask:return w(W_,{content:i,pages:t,properties:e});default:return null}},J_=({className:e,properties:t,next:n,questionId:r})=>{const i=ue(),{headers:o,surveyId:a,responseGroupUid:s,userId:l}=i,u=dt(),{screenPermissionRequested:c}=u,d=dt(g=>g.avStream);let f=dt(g=>g.currentPage);f||(f=K_({questionId:r,surveyId:a,next:g=>{n(g)},pages:t.pages,responseGroupUid:s,userId:l}));let p=f.headline,h=f.captionText;const m=Sf(d,f);return Ef(f)&&c&&(p=f.permissionDeniedHeadline,h=f.permissionDeniedCaptionText),Qi(f)&&m===Ft.Ready&&(p=f.permissionGrantedHeadline,h=f.permissionGrantedCaptionText),w("div",{className:j([...ht(L.CardMainContent,o["userleap-platform"])]),children:w("div",{className:j([e,"ul-center-horizontally",L.FadeInTransition]),children:[w(gt,{message:p,properties:{captionText:h}}),w(X_,{properties:t})]})})},eb={"{{user_id}}":"externalUserId","{{email}}":"email"},tb=(e=void 0,t={})=>{if(!e)return e;let n=e;const r=[];for(const[l,u]of Object.entries(eb))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}`},nb=({className:e,message:t,next:n,properties:r,questionId:i,type:o})=>{const{headers:a,visitorAttributes:s}=ue(p=>({headers:p.headers,visitorAttributes:p.visitorAttributes})),l=a["userleap-platform"],u=(p,h=!1)=>{n({value:h?{skipped:!0}:void 0,questionId:i,type:o})},c=p=>{(p.key==="Enter"||p.key===" ")&&n({value:void 0,questionId:i,type:o})},d=()=>w("div",{className:"ul-card-button-group",children:[w("a",{className:"ul-card-text__button ul-card__text-url-prompt-button",href:tb(r&&r.buttonUrl,s),id:"ul-card-text__button",onClick:u,onKeyPress:c,rel:"noreferrer",role:"button",tabIndex:0,target:"_blank",children:qn(r)}),r.required===!1&&w("button",{className:L.SkipButton,onClick:p=>u(p,!0),children:_s(r)})]}),f=(p,h)=>p?w("div",{className:"ul-rich-text-body",dangerouslySetInnerHTML:{__html:p},id:"ul-card__text-url-body-container"}):w("div",{className:"ul-rich-text-body",id:"ul-card__text-url-body-container",children:(h?h.split(/\n\s*\n/g):[]).map((m,g)=>w("p",{children:m},g))});return w("div",{className:j(ht(L.CardMainContent,l)),children:w("div",{className:j([e,"ul-card__text-url-prompt",L.FadeInTransition]),children:[w(gt,{message:t}),f(r&&r.richTextBody,r&&r.body),w($t,{defaultBody:d,properties:r})]},i)})},rb=({className:e,questionId:t})=>{const{border:n,destroy:r,endCard:i,headers:o}=ue(l=>({border:l.border,endCard:l.endCard,destroy:l.destroy,headers:l.headers}));We(()=>{setTimeout(()=>{r(xn)},2e3)},[r]);const a=i&&i.subheader?w("p",{className:L.Caption,children:i.subheader}):null,s=i&&i.headline?i.headline:"";return w("div",{className:j(ht(L.CardMainContent,o["userleap-platform"])),children:w("div",{className:j([e,"ul-card--thanks",L.FadeInTransition]),children:w("div",{children:w("div",{className:"ul-card--thanks-content",children:[w("div",{className:"ul-thanks-check",children:w("svg",{"aria-labelledby":"title",fill:"none",height:"99",viewBox:"0 0 81 99",width:"81",xmlns:"http://www.w3.org/2000/svg",children:[w("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"}),w("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"}),w("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"})]})}),w(gt,{message:s}),a]})})},t)})},Jt="https://cdn.sprig.com",F={document:void 0,videojs:void 0},ib=`/* progress control styles */
46
+ `,vn=e=>(e==null?void 0:e.buttonText)||"Next",ra=e=>(e==null?void 0:e.skipButtonText)||"Skip",vm=({className:e,message:t,next:n,properties:r,questionId:i,type:o})=>{const{headers:a,useMobileStyling:s,border:l}=J(T=>({headers:T.headers,useMobileStyling:T.useMobileStyling,border:T.border})),[u,c]=le(!1),[f,d]=le(""),[p,h]=le(!1),v=a["userleap-platform"],m=r==null?void 0:r.collectName,_=(r==null?void 0:r.nameLabelText)||"Full Name",y=(r==null?void 0:r.consentText)||"I agree to the stated conditions",E=(r==null?void 0:r.submitButtonText)||"Submit",w=!!f.trim(),b=u&&(!m||w),x=(T,D=!1)=>{T.preventDefault(),T.stopPropagation();let S=null;if(!D){if(!b){h(!0);return}S={submitted:!0},m&&(S.name=f)}n({value:S,questionId:i,type:o})},C=T=>{jf(T.target)&&(T.preventDefault(),T.stopPropagation(),d(T.target.value))},I=T=>{tn(T.target)&&(T.target.style.borderColor=p&&!w?xn:l)},k=T=>{tn(T.target)&&(T.target.style.borderColor=p&&!w?xn:Ao)},L=()=>g("div",{children:[g(Zu,{allowTextEntry:!1,border:l,error:p&&!u,index:0,isRadio:!1,isSelected:u,label:y,onUserInputChanged:({selected:T})=>{T!==u&&c(!u)},useMobileStyling:s}),m&&g("input",{"aria-label":_,"aria-placeholder":_,className:B(re(R.ConsentLegalNameInput,s)),"data-gramm":"false",maxLength:250,name:"name",onBlur:k,onFocus:I,onInput:C,placeholder:_,style:p&&!w?{borderColor:xn}:{},tabIndex:0,value:f}),g("div",{className:"ul-card__button-wrapper ul-card-vertical__button-wrapper",children:[g(Ee,{className:b?"":R.ButtonDisabled,onClick:x,children:E}),r.required===!1&&g("button",{className:R.SkipButton,onClick:T=>x(T,!0),children:ra(r)})]})]});return g("div",{className:B(Ge(R.CardMainContent,v)),children:g("div",{className:B([e,"ul-card__consent-legal",R.FadeInTransition]),children:[g(We,{message:t}),g("div",{className:"ul-rich-text-body",dangerouslySetInnerHTML:r&&r.richTextBody?{__html:r&&r.richTextBody}:void 0,id:"ul-card__consent-legal-body-container"}),g(St,{properties:r,defaultBody:L,embeddedType:"pdf"})]},i)})},mm=({activeValue:e,border:t,icon:n,isPressed:r,onSubmit:i,range:o,scaleLabelType:a,setActiveValue:s,setIsPressed:l,useMobileStyling:u,value:c})=>{const f=`option-${c}`,d=a===Ut.Number,p=a===Ut.Star,h=d&&c===e,[v,m]=(()=>c<=e&&p||c===e?r?[t,1]:[t,.3]:["",1])(),_=()=>{switch(a){case Ut.Star:return B([...re(R.LikertStar,u),...re(`${R.LikertStar}-${c}`,u)]);case Ut.Smiley:return B([...re(R.LikertSmiley,u),...re(`${R.LikertSmiley}-${c}`,u)]);default:return B(c===o?[...re(R.LikertNumber,u),...re(`${R.LikertNumber}-${c}`,u),...re("likert-last-option",u)]:[...re(R.LikertNumber,u),...re(`${R.LikertNumber}-${c}`,u)])}},y=()=>{s(-1),l(!1)};return g("div",{"aria-label":d?void 0:String(c),className:_(),dangerouslySetInnerHTML:{__html:n},id:f,onClick:()=>i(),onPointerDown:()=>l(!0),onPointerEnter:()=>s(c),onPointerLeave:y,role:"radio",style:{color:d?"":v,borderColor:h?v:"",fillOpacity:h?"":m,zIndex:h?3:"auto"},tabIndex:0})},gm=({className:e,labels:t,message:n,next:r,properties:i,questionId:o,type:a})=>{const{border:s,headers:l,useMobileStyling:u}=J(L=>({border:L.border,headers:L.headers,useMobileStyling:L.useMobileStyling})),[c,f]=le(-1),[d,p]=le(!1),h=l["userleap-platform"],v=t&&t.left,m=t&&t.right;let _;const{range:y,scaleLabelType:E,ratingIcons:w}=i;y&&(_=Number(y));const b=_||5,x=L=>{var T,D;switch(E){case Ut.Star:return(T=w[0])==null?void 0:T.svg;case Ut.Smiley:return(D=w[L])==null?void 0:D.svg;default:return String(L+1)}},C=[...Array(b)].map((L,T)=>{const D=T+1;return g(mm,{activeValue:c,border:s,icon:x(T),isPressed:d,onSubmit:()=>r({value:D,questionId:o,type:a}),range:b,scaleLabelType:E,setActiveValue:f,setIsPressed:p,useMobileStyling:u,value:D},T)}),I=L=>{L.preventDefault(),L.stopPropagation(),r({value:null,questionId:o,type:a})},k=()=>g(Le,{children:[g("div",{"aria-label":`Rating (1 - ${b})`,className:"ul-card--likert__numbers",role:"radiogroup",children:C}),g("div",{className:"ul-card--likert__labels",children:[g("span",{children:v}),g("span",{children:m})]}),!i.required&&g("div",{className:"ul-vertical-centered-container",children:g(Ee,{onClick:I,children:vn(i)})})]});return g("div",{className:B(Ge(R.CardMainContent,h)),children:g("form",{className:B([e,"ul-card--likert",R.FadeInTransition]),children:[g(We,{message:n,properties:i}),g(St,{properties:i,defaultBody:k})]},o)})},Ju=({className:e,message:t,onSubmit:n,options:r=[],properties:i,questionId:o,type:a})=>{const{border:s,headers:l,useMobileStyling:u}=J(C=>({border:C.border,headers:C.headers,useMobileStyling:C.useMobileStyling})),c=r.reduce((C,I)=>(C[I.id]={isSelected:!1},C),{}),[f,d]=le(c),p=l["userleap-platform"],h=a===A.MultipleChoice,v=i.required,m=Object.entries(f).some(([C,I])=>{var T;const k=r.find(D=>`${D.id}`===C),L=I.userText===void 0||I.userText.trim()==="";return((T=k==null?void 0:k.optionProperties)==null?void 0:T.allowsTextEntry)&&L&&I.isSelected}),_=Object.values(f).some(C=>C.isSelected),y=m||v&&!_,E=r.map(({id:C,label:I,value:k,optionProperties:L},T)=>{var V,O;const D=`${C}`,{allowsTextEntry:S}=L||{allowsTextEntry:!1};return g(Zu,{allowTextEntry:S,border:s,error:!1,id:D,index:T,isRadio:h,isSelected:!!((V=f[D])!=null&&V.isSelected),label:I,onUserInputChanged:H=>b(H.id,H.selected,H.userText),promptText:"Please specify",text:(O=f[C])==null?void 0:O.userText,useMobileStyling:u,value:k},D)}),w=C=>{C.preventDefault(),C.stopPropagation(),n(f)},b=(C,I,k)=>{const L=Object.assign({},f);if(h&&I)for(const T of Object.values(L))T.isSelected=!1,delete T.userText;L[C]={isSelected:I,userText:k},d(L)},x=()=>g("div",{children:[g("div",{className:B(re(R.ChoiceGroup,u)),role:h?"radiogroup":"group",children:E}),g("div",{className:"ul-card__button-wrapper",children:g(Ee,{disabled:y,onClick:w,children:vn(i)})})]});return g("div",{className:B(Ge(R.CardMainContent,p)),children:g("form",{className:B([e,"ul-card--multiple",R.FadeInTransition]),id:"text-form",onSubmit:w,children:[g(We,{message:t,properties:i}),g(St,{properties:i,defaultBody:x})]},o)})},ym=e=>{const{questionId:t,type:n,next:r,options:i}=e;return g(Ju,{...e,onSubmit:a=>{const s=Object.entries(a).find(([,d])=>d.isSelected)||[void 0,void 0],[l,u]=s,c=i.find(d=>`${d.id}`===l),f=u!=null&&u.userText?{[l]:{userText:u.userText}}:null;r({value:c&&l?{[l]:c.value}:{},secondaryValue:f,questionId:t,type:n})}})},_m=e=>{const{questionId:t,type:n,next:r}=e;return g(Ju,{...e,onSubmit:o=>{const a={},s=Object.entries(o).reduce((u,[c,f])=>(u[c]=f.isSelected,u),a),l=Object.entries(o).reduce((u,[c,f])=>{if(!f.userText)return u;const d=u||{};return d[c]={userText:f.userText},d},null);r({value:s,secondaryValue:l,questionId:t,type:n})}})},wm=({className:e,props:{labels:t,message:n,properties:r},next:i,questionId:o,type:a})=>{const{border:s,headers:l,useMobileStyling:u}=J(m=>({border:m.border,headers:m.headers,useMobileStyling:m.useMobileStyling})),c=l["userleap-platform"],f=t&&t.left,d=t&&t.right,p=[...Array(11)].map((m,_)=>g("div",{className:B([...re(R.NPSNumber,u),...re(`${R.NPSNumber}-${_}`,u)]),id:`option-${_}`,onClick:()=>i({value:_,questionId:o,type:a}),onKeyPress:y=>{y.preventDefault(),(y.key==="Enter"||y.key===" ")&&i({value:_,questionId:o,type:a})},onPointerDown:y=>{tn(y.target)&&(y.target.style.zIndex="2",y.target.style.borderColor=s)},onPointerLeave:y=>{tn(y.target)&&(y.target.style.zIndex="auto",y.target.style.borderColor=Ao)},role:"radio",tabIndex:0,children:_},_)),h=m=>{m.preventDefault(),m.stopPropagation(),i({value:null,questionId:o,type:a})},v=()=>g("div",{children:[g("div",{className:"ul-card--nps__numbers",children:p}),g("div",{className:"ul-card--nps__labels",children:[g("span",{children:f}),g("span",{children:d})]}),!r.required&&g("div",{className:"ul-vertical-centered-container",children:g(Ee,{onClick:h,children:vn(r)})})]});return g("div",{className:B(Ge(R.CardMainContent,c)),children:g("form",{className:B([e,"ul-card--nps",R.FadeInTransition]),children:[g(We,{message:n,properties:r}),g(St,{properties:r,defaultBody:v})]},o)})},bm=({className:e,message:t,next:n,properties:r,questionId:i,type:o})=>{const{border:a,headers:s,useMobileStyling:l,update:u}=J(C=>({border:C.border,headers:C.headers,useMobileStyling:C.useMobileStyling,update:C.update})),[c,f]=le(""),d=bt(null),p=s["userleap-platform"],h=c.trim(),v=r.required===!0&&!h,m=Qu(d,()=>u()),_=C=>{m(),C.preventDefault(),C.stopPropagation(),Sn(C.target)&&f(C.target.value)},y=C=>{C.preventDefault(),C.stopPropagation(),n({value:c,questionId:i,type:o})},E=r&&r.openTextPlaceholder?r.openTextPlaceholder:"",w=C=>{Sn(C.target)&&(C.target.style.borderColor=a)},b=C=>{Sn(C.target)&&(C.target.style.borderColor=Ao)},x=()=>g("div",{className:"ul-card-text",children:[g("div",{className:"ul-card-text__container",children:g("textarea",{"aria-label":E,"aria-labelledby":R.QuestionHeader,"aria-multiline":"true","aria-placeholder":E,className:B(re(R.OpenTextInput,l)),"data-gramm":"false",maxLength:5e3,name:"text",onBlur:b,onChange:_,onFocus:w,placeholder:E,ref:d,role:"textbox",tabIndex:0})}),g(Ee,{disabled:v,onClick:y,style:{backgroundColor:v?"":a},children:vn(r)})]});return g("div",{className:B(Ge(R.CardMainContent,p)),children:g("form",{className:B([e,"ul-card--text",R.FadeInTransition]),id:"text-form",children:[g(We,{message:t,properties:r}),g(St,{defaultBody:x,properties:r})]},i)})};var vt=(e=>(e[e.RequestNeeded=1]="RequestNeeded",e[e.TryAgain=2]="TryAgain",e[e.Ready=3]="Ready",e))(vt||{});const Zr=e=>e.type===Ce.AvPermission,ec=e=>e.type===Ce.ScreenPermission,Em=(e,t)=>!(Zr(t)?t.permissionDescriptors:[]).includes(an.Camera)||e.getVideoTracks().length>0,tc=(e,t)=>{if(e===void 0)return vt.RequestNeeded;if(e){if(!Em(e,t))return vt.RequestNeeded}else return vt.TryAgain;return vt.Ready},Is={avStream:null,currentPage:null,mediaRecordingUids:null,nextQuestion:()=>{},passthroughData:void 0,recordingMediaTypes:void 0,screenPermissionRequested:!1,type:void 0},Ke=Gu(e=>({...Is,reset:()=>{e(Is)},updatePage:t=>{e(t)}}));function uo({currentPage:e,pages:t}){const{avStream:n,recordingMediaTypes:r,updatePage:i}=Ke.getState(),{recorderEventEmitter:o}=J.getState();o.emit(de.AvPermission,{[q.PermissionDescriptors]:e.permissionDescriptors,[q.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(de.BeginRecording,{[q.RecordingMediaTypes]:r,[q.StartRecordingCallback]:f=>i({mediaRecordingUids:f})}),l=t[c]}i({currentPage:l,avStream:a})}})}function xm({pages:e,userId:t,responseGroupUid:n,surveyId:r,questionId:i,next:o}){const{updatePage:a}=Ke.getState(),{eventEmitFn:s,recorderEventEmitter:l}=J.getState(),u={questionId:i,surveyId:r,visitorId:t,responseGroupUid:n};let c=0;l.emit(Te.RecordedTaskPermissionScreen),s(Te.RecordedTaskPermissionScreen),l.emit(de.PermissionStatus,{[q.PermissionStatusCallback]:(d,p,h,v)=>{const m=e[c],{type:_}=m,y=[Ue.Screen];if(Zr(m)){const{permissionDescriptors:E}=m,w=E==null?void 0:E.includes(an.Microphone),b=E==null?void 0:E.includes(an.Camera);w&&y.push(Ue.Audio),b&&y.push(Ue.Video);const x=(d==null?void 0:d.active)&&!b,C=(d==null?void 0:d.active)&&p;(x||C)&&c++}ec(e[c])&&h&&(c++,l.emit(de.BeginRecording,{[q.RecordingMediaTypes]:y,[q.StartRecordingCallback]:E=>a({mediaRecordingUids:E})})),a({currentPage:e[c],avStream:d,screenPermissionRequested:h,nextQuestion:o,type:_,passthroughData:u,recordingMediaTypes:y,captureStream:v})}});const f=e[c];return f.type===Ce.AvPermission&&uo({currentPage:f,pages:e}),f}function co({status:e}){const{nextQuestion:t,passthroughData:n,mediaRecordingUids:r,reset:i}=Ke.getState(),{recorderEventEmitter:o,handleUploadUpdate:a,index:s}=J.getState(),l={value:{taskStatus:e},type:A.RecordedTask,questionId:(n==null?void 0:n.questionId)||1};!n||o.emit(de.FinishTask,{[q.BeginCallback]:u=>{a({mediaRecordingUid:u,isSubmitted:!0,progressPct:0,isComplete:!1})},[q.ProgressCallback]:(u,c)=>{a({mediaRecordingUid:u,progressPct:c.detail,isSubmitted:!1,isComplete:!1})},[q.UploadCallback]:u=>{u&&a({mediaRecordingUid:u,isComplete:!0,isSubmitted:!0,progressPct:100})},[q.PassthroughData]:n,[q.CurrentIndex]:s,[q.TaskResponse]:l,[q.TaskCompleteCallback]:u=>{l.value.taskDurationMillisecond=u,r&&(l.value.mediaRecordingUids=r),i(),t(l)}})}function ia({pages:e,setIsRequestingPermission:t}){const{recorderEventEmitter:n,eventEmitFn:r}=J.getState(),{updatePage:i,currentPage:o,recordingMediaTypes:a,screenPermissionRequested:s}=Ke.getState();if(!o)return;const l=e.indexOf(o);switch(o.type){case Ce.AvPermission:{const u=s?l+2:l+1;s&&a&&n.emit(de.BeginRecording,{[q.RecordingMediaTypes]:a,[q.StartRecordingCallback]:c=>{i({mediaRecordingUids:c})}}),i({currentPage:e[u]});return}case Ce.ScreenPermission:n.emit(de.ScreenPermission,{[q.ScreenPermissionRequested]:t,[q.StreamReadyCallback]:(u,c)=>{const f=c?e[l+1]:o;c&&a&&n.emit(de.BeginRecording,{[q.RecordingMediaTypes]:a,[q.StartRecordingCallback]:d=>{i({captureStream:c,mediaRecordingUids:d})}}),i({currentPage:f,screenPermissionRequested:!0,captureStream:c})}});return;case Ce.StartTask:r(Te.RecordedTaskStart),n.emit(Te.RecordedTaskStart),n.emit(de.StartTask),i({currentPage:e[l+1],screenPermissionRequested:!0});return;case Ce.CompleteTask:return}}const nc="ul-permission-graphics-container",rc="ul-permission-body",ic=B([nc,"ul_recorded-task-inset-spacing"]),Xr=B(["ul-horizontal-button-container","ul-horizontal-button-container-left"]),oc=({richTextBody:e})=>g("div",{className:"ul-rich-text-body",dangerouslySetInnerHTML:{__html:e},id:"ul-task-detail-container"}),Jr=({required:e,skipButtonText:t,bottom:n=!1})=>e?null:g(Ee,{className:B([n&&"ul-skip-button-below",R.InactiveButton]),onClick:co.bind(null,{status:Ie.Abandoned}),children:t||"Skip"}),oa=e=>{const{avStream:t,captureStream:n,recordingMediaTypes:r,updatePage:i}=Ke.getState(),o=(r==null?void 0:r.includes(Ue.Audio))||(r==null?void 0:r.includes(Ue.Video));ke(()=>{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])},Sm=({content:e,pages:t,required:n})=>{const{buttonText:r,skipButtonText:i,taskDetail:o}=e;return oa(t),g("div",{className:"ul-task-page",children:[g(oc,{richTextBody:o}),g("div",{className:Xr,children:[g(Ee,{onClick:ia.bind(null,{pages:t}),children:r}),g(Jr,{required:n,skipButtonText:i})]})]},"start-task")},Cm=({content:e,pages:t,properties:n})=>{const{buttonText:r,skipButtonText:i}=e;oa(t);const a=g(St,{properties:n,defaultBody:()=>g("div",{className:Xr,children:[g(Ee,{className:"ul-complete-task-button",onClick:co.bind(null,{status:Ie.Completed}),children:r}),g(Ee,{className:B([R.InactiveButton]),onClick:co.bind(null,{status:Ie.GivenUp}),children:i})]})});return g("div",{className:"ul-task-page",children:[g(oc,{richTextBody:e.taskDetail}),a]},"complete-task")},Im=({content:e,pages:t,required:n})=>{const{buttonText:r,skipButtonText:i}=e,[o]=J(l=>[l.tabTitle]),[a,s]=le(!1);return g("div",{children:[g("div",{className:ic,children:[g("p",{style:{marginTop:"auto"},children:e.selectTabText}),g("div",{className:"ul-select-tab-container",children:g("p",{className:rc,children:o})})]}),g("div",{className:n?"":Xr,children:[g(Ee,{disabled:a,onClick:ia.bind(null,{pages:t,setIsRequestingPermission:s}),children:r}),g(Jr,{required:n,skipButtonText:i})]})]})},km=({content:e})=>g("div",{className:B([nc,"ul_permission_svg_container","ul_recorded-task-inset-spacing","ul-center-horizontally"]),dangerouslySetInnerHTML:{__html:e.svg}},"ul-permission-request-graphic"),Tm=({content:e,pages:t,required:n})=>{const{permissionDeniedHeadline:r,permissionDeniedBody:i,skipButtonText:o,tryAgainButtonText:a}=e,s=Zr(t[0])?t[0]:null;return ke(()=>{const l=setInterval(()=>{s!==null&&uo({currentPage:s,pages:t})},1e3);return()=>clearInterval(l)},[s,t]),s?g("div",{children:[g("div",{className:ic,children:g("p",{className:"ul-av-permission-denied-paragraph",children:[g("span",{className:"ul-av-permission-denied-headline",children:r}),g("span",{className:rc,children:i})]})}),g("div",{className:Xr,children:[g(Ee,{onClick:uo.bind(null,{currentPage:s,pages:t}),children:a}),g(Jr,{required:n,skipButtonText:o})]})]}):null},Lm=({stream:e})=>g("video",{autoPlay:!0,className:B(["ul_recorded-task-inset-spacing"]),id:"ul-record-task-video-preview",muted:!0,ref:t=>{t&&(t.srcObject=e||null)}}),Am=({content:e,pages:t,required:n})=>{const{skipButtonText:r}=e,{avStream:i}=Ke.getState();return oa(t),g("div",{children:[g(Lm,{stream:i}),g("div",{className:"ul-vertical-button-container-center",children:[g(Ee,{onClick:ia.bind(null,{pages:t}),children:e.buttonText}),g(Jr,{bottom:!0,required:n,skipButtonText:r})]})]})},Rm=({properties:e})=>{const{pages:t,required:n}=e,{avStream:r,currentPage:i}=Ke.getState();if(i===void 0)return null;switch(i==null?void 0:i.type){case Ce.AvPermission:{const o=tc(r,i);return o===vt.RequestNeeded?g(km,{content:i}):o===vt.TryAgain?g(Tm,{content:i,pages:t,required:n}):g(Am,{content:i,pages:t,required:n})}case Ce.ScreenPermission:return g(Im,{content:i,pages:t,required:n});case Ce.StartTask:return g(Sm,{content:i,pages:t,required:n});case Ce.CompleteTask:return g(Cm,{content:i,pages:t,properties:e});default:return null}},Um=({className:e,properties:t,next:n,questionId:r})=>{const i=J(),{headers:o,surveyId:a,responseGroupUid:s,userId:l}=i,u=Ke(),{screenPermissionRequested:c}=u,f=Ke(m=>m.avStream);let d=Ke(m=>m.currentPage);d||(d=xm({questionId:r,surveyId:a,next:m=>{n(m)},pages:t.pages,responseGroupUid:s,userId:l}));let p=d.headline,h=d.captionText;const v=tc(f,d);return ec(d)&&c&&(p=d.permissionDeniedHeadline,h=d.permissionDeniedCaptionText),Zr(d)&&v===vt.Ready&&(p=d.permissionGrantedHeadline,h=d.permissionGrantedCaptionText),g("div",{className:B([...Ge(R.CardMainContent,o["userleap-platform"])]),children:g("div",{className:B([e,"ul-center-horizontally",R.FadeInTransition]),children:[g(We,{message:p,properties:{captionText:h}}),g(Rm,{properties:t})]})})},Om={"{{user_id}}":"externalUserId","{{email}}":"email"},Dm=(e=void 0,t={})=>{if(!e)return e;let n=e;const r=[];for(const[l,u]of Object.entries(Om))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}`},Pm=({className:e,message:t,next:n,properties:r,questionId:i,type:o})=>{const{headers:a,visitorAttributes:s}=J(p=>({headers:p.headers,visitorAttributes:p.visitorAttributes})),l=a["userleap-platform"],u=(p,h=!1)=>{n({value:h?{skipped:!0}:void 0,questionId:i,type:o})},c=p=>{(p.key==="Enter"||p.key===" ")&&n({value:void 0,questionId:i,type:o})},f=()=>g("div",{className:"ul-card-button-group",children:[g("a",{className:"ul-card-text__button ul-card__text-url-prompt-button",href:Dm(r&&r.buttonUrl,s),id:"ul-card-text__button",onClick:u,onKeyPress:c,rel:"noreferrer",role:"button",tabIndex:0,target:"_blank",children:vn(r)}),r.required===!1&&g("button",{className:R.SkipButton,onClick:p=>u(p,!0),children:ra(r)})]}),d=(p,h)=>p?g("div",{className:"ul-rich-text-body",dangerouslySetInnerHTML:{__html:p},id:"ul-card__text-url-body-container"}):g("div",{className:"ul-rich-text-body",id:"ul-card__text-url-body-container",children:(h?h.split(/\n\s*\n/g):[]).map((v,m)=>g("p",{children:v},m))});return g("div",{className:B(Ge(R.CardMainContent,l)),children:g("div",{className:B([e,"ul-card__text-url-prompt",R.FadeInTransition]),children:[g(We,{message:t}),d(r&&r.richTextBody,r&&r.body),g(St,{defaultBody:f,properties:r})]},i)})},Nm=({className:e,questionId:t})=>{const{border:n,destroy:r,endCard:i,forceBrandedLogo:o,headers:a}=J(u=>({border:u.border,destroy:u.destroy,endCard:u.endCard,forceBrandedLogo:u.forceBrandedLogo,headers:u.headers}));ke(()=>{setTimeout(()=>{r(Yt)},o?4e3:2e3)},[r,o]);const s=i&&i.subheader?g("p",{className:R.Caption,children:i.subheader}):null,l=i&&i.headline?i.headline:"";return g("div",{className:B(Ge(R.CardMainContent,a["userleap-platform"])),children:g("div",{className:B([e,"ul-card--thanks",R.FadeInTransition]),children:g("div",{children:g("div",{className:"ul-card--thanks-content",children:[g("div",{className:"ul-thanks-check",children:g("svg",{"aria-labelledby":"title",fill:"none",height:"99",viewBox:"0 0 81 99",width:"81",xmlns:"http://www.w3.org/2000/svg",children:[g("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"}),g("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"}),g("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"})]})}),g(We,{message:l}),s]})})},t)})},Lt="https://cdn.sprig.com",M={document:void 0,videojs:void 0},Mm=`/* progress control styles */
66
47
  .video-js .vjs-control {
67
48
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif;
68
49
  }
@@ -719,5 +700,5 @@ span.ul-button-text {
719
700
  .vjs-poster {
720
701
  background-size: cover;
721
702
  }
722
- `,ob=e=>{const t=F.document.createElement("div");return t.className="ul-video-player-loading",t.id=Cs(e),["first","second","third","fourth"].map(n=>{const r=F.document.createElement("div");r.className=n,t.appendChild(r)}),t},Cs=e=>e+"-loading-spiner",Ce="hidden",du=".m3u8",ko="questionId",xo="ul-video-recorder-camera-off-button",Ao="ul-recording-in-session",ab=[{type:"link",content:`${Jt}/dependencies/videojs-record-4.5.0.min.css`},{type:"script",content:`${Jt}/dependencies/RecordRTC-5.6.2.js`},{type:"script",content:`${Jt}/dependencies/adapter.8.0.0.min.js`},{type:"script",content:`${Jt}/dependencies/videojs-record-4.5.0.min.js`},{type:"script",content:`${Jt}/userleap-web-upchunk-v2.2.2.js`}],Rf=[{type:"link",content:`${Jt}/dependencies/video-js-7.18.0.min.css`},{type:"script",content:`${Jt}/dependencies/video-js-7.18.0.min.js`},{type:"style",content:ib}],Lf="-video-player",Of="-secondary-video-player",Nf="-video-recorder";let at,fu;const Pt=async({event:e,apiBase:t,headers:n,visitorId:r,envId:i,metadata:o})=>{const a=F.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)},Ct=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=F.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)},sb=(e,{type:t,content:n})=>new Promise(function(r,i){let o;t==="script"?(o=F.document.createElement("script"),o.src=n):t==="link"?(o=F.document.createElement("link"),o.rel="stylesheet",o.href=n,o.type="text/css"):(o=F.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)}),Df=(e,t)=>{if(e.length===0)return t&&t();Promise.all(e.reduce((n,r)=>(n.push(sb(F.document.head,r)),n),[])).then(()=>{F.videojs=F.document.defaultView.videojs,t&&t()}).catch(function(n){console.log(n+" failed to load")})},pu=(e,t,n)=>{if(t==="start"&&(e.style.visibility="visible"),t==="none")e.style.visibility=Ce;else if(t==="success")e.style.visibility=Ce,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%)`}},To=(e,t)=>{const n=F.videojs(e.id());return n==null?void 0:n.payload[t]},lb=(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(K.ERROR,{type:K.PERMISSION_DENIED}),Pt({event:"Video Permission Denied",apiBase:t,headers:i,visitorId:s,envId:l,metadata:{questionId:To(e,ko),responseGroupUid:a,surveyId:o}})):(n&&n(K.ERROR,{type:K.OTHER}),Ct(new Error(e.deviceErrorCode.message),"recorderDeviceError",t,i,s,l))}),e.on("error",function(u,c){Ct(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:To(e,ko),responseGroupUid:a,surveyId:o}})}),e.on("finishRecord",async function(){r(e.uploadProgressLabel,"start",0);const u=To(e,ko);if(!o){const m="internal error: missing fields in payload";return n&&n(K.ERROR,{type:K.OTHER}),Ct(new Error(m),"finishRecord",t,i,s,l),null}e.record().stopDevice();const c=e.cameraOff?K.MEDIA_TYPE_AUDIO:K.MEDIA_TYPE_VIDEO,d=jt();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 m=await fetch(`${t}/2/environments/integrations/upload`,{method:"POST",cache:"no-cache",headers:{"Content-Type":"application/json"},body:JSON.stringify(f)});if(m.ok){const g=await m.json();return n&&n(K.UPLOAD_STARTED,{[K.UPLOAD_ID]:g.upload.id,[K.MEDIA_TYPE]:c,[K.MEDIA_RECORDING_UID]:d}),g.upload.url}else return n&&n(K.ERROR,{type:K.OTHER,response:m}),Ct(new Error("failed to get upload response with url"),"finishRecord",t,i,s,l),null})();!h||(at=F.document.defaultView.UpChunk.createUpload({endpoint:h,file:new F.document.defaultView.File([e.recordedData],`recording ${c} ${Date.now()}`),chunkSize:5120}),at.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}}),at.on("error",m=>{r(e.uploadProgressLabel,"none"),n&&n(K.UPLOAD_FINISHED,{[K.MEDIA_RECORDING_UID]:d}),Ct(m,"finishRecord",t,i,s,l)}),at.on("progress",m=>{n&&n(K.UPLOAD_PROGRESS,{[K.MEDIA_RECORDING_UID]:d,[K.UPLOAD_PROGRESS_PCT]:m.detail}),r(e.uploadProgressLabel,"progress",m.detail)}),at.on("success",()=>{r(e.uploadProgressLabel,"success"),n&&n(K.UPLOAD_FINISHED,{[K.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:at.startTime&&Date.now()-at.startTime}})}))})},Uf=(e,t)=>{const n=new(F.videojs.getComponent("Component"))(e);return n.addClass("ul-buttons-panel"),t.map(r=>{n.addChild(r)}),ub(n),n},ub=e=>{e.children().forEach(t=>{if(Ye[t.name_]){const n=li(Ye[t.name_],`ul-${Ye[t.name_]}`);t.el_.appendChild(n)}})},li=(e,t="")=>{const n=F.document.createElement("span");return n.className="ul-button-text",n.innerHTML=e,n.id=t,n},Pf=(e,t,n,r,i=!1,o)=>{e.addClass("ul-video-player");const a=new(F.videojs.getComponent("Component"))(e);a.addClass("ul-control-panel"),e.progressBar=a.addChild("ProgressControl"),n&&e.src(n),e.audioPlayerPlaceholder=new(F.videojs.getComponent("Component"))(e),e.audioPlayerPlaceholder.addClass("ul-audio-recorder-placeholder");const s=n&&n.src?vb(n.src):null;n&&(i||!s)?(e.children()[0].classList.add("vjs-hidden"),F.document.getElementById(`${e.id()}_html5_api`).style.height="0px"):(e.audioPlayerPlaceholder.hide(),F.document.getElementById(`${e.id()}_html5_api`).style.height="100%",s&&e.poster(s)),e.on("play",()=>{!i&&n&&!s&&fb(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)},cb=(e,t,n)=>{e.addClass(`ul${Of}`);const r=new(F.videojs.getComponent("Component"))(e);t&&e.src(t),e.addChild(r),n&&n(e)},db=(e,t,n,r,i,o,a,s=!1)=>{fu=Date.now();const u=Di(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 m;const g=T=>{const O=xo,k=xo+"-audio-only";pu(u.uploadProgressLabel,"none"),at&&at.startTime>=fu&&at.abort();const N=F.document.getElementById("ul-camera-button");T?(u.children()[0].classList.add("vjs-hidden"),y.removeClass(O),y.addClass(k),N.innerHTML=Ye.TurnOnCamera,u.audioPlayerPlaceholder.removeClass("vjs-hidden"),m==null||m.getTracks().forEach(A=>{A.stop()}),window.navigator.mediaDevices.getUserMedia({video:!0,audio:!0}).then(A=>{m=A,A.getVideoTracks().forEach(B=>{B.enabled=!1}),u.record().onDeviceReady(A)}).catch(u.record().onDeviceError.bind(u.record()))):(m==null||m.getVideoTracks().forEach(A=>{A.enabled=!0}),u.children()[0].classList.remove("vjs-hidden"),u.record().getDevice(),y.removeClass(k),y.addClass(O),N.innerHTML=Ye.TurnOffCamera,u.audioPlayerPlaceholder.addClass("vjs-hidden"))},_=new(F.videojs.getComponent("Button"))(u,{clickHandler:()=>{_.hasClass(Ce)||(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(K.DELETE,{}),y.removeClass(Ce),_.addClass(Ce))}});_.addClass("ul-video-recorder-delete-button"),_.el_.appendChild(li(Ye.DeleteButton,"ul-delete-button"));const v=F.document.getElementById(t),b=()=>{v.classList.contains("vjs-fullscreen")&&u.cameraOff?v.style.display="table":v.style.display="flex"};b();const y=new(F.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),!_.hasClass(Ce)&&_.addClass(Ce),i(K.DELETE,{}),b())}});y.addClass(xo),y.el_.appendChild(li(Ye.TurnOffCamera,"ul-camera-button"));const C=new(F.videojs.getComponent("Button"))(u,{clickHandler:()=>{const T=F.document.getElementById("ul-recorder-toggle");if(u.record().isRecording())u.record().stop(),T&&(T.innerHTML=Ye.RecordButton),C.removeClass(Ao),_.removeClass(Ce);else{const O=F.document.getElementById("ul-recording-countdown-screen");if(O)O.remove(),T&&(T.innerHTML=Ye.RecordButton),g(u.cameraOff),i(K.DELETE,{}),y.removeClass(Ce),_.addClass(Ce),C.removeClass(Ao),I.show();else{C.addClass(Ao),I.hide(),y.addClass(Ce),_.addClass(Ce),T&&(T.innerHTML=Ye.StopButton);const k=F.document.createElement("div");k.id="ul-recording-countdown-screen",v.insertBefore(k,v.children[1]),k.style.height=`${v.offsetHeight}px`,Mf(u,3)}}}});C.addClass("ul-video-recorder-toggle-button"),C.el_.appendChild(li(Ye.RecordButton,"ul-recorder-toggle"));const S=F.document.createElement("p");S.style.visibility="hidden",S.className="ul-upload-progress-label",e.appendChild(S),u.uploadProgressLabel=S;const E=Uf(u,[_,y,"PlayToggle",C,"FullscreenToggle"]),I=E.children().find(T=>T.name_==="FullscreenToggle");I.hasClass("vjs-disabled")&&I.hide();const x=E.children().find(T=>T.name_==="PlayToggle");x.hide(),o&&y.addClass(Ce),!o&&_.addClass(Ce),Pf(u,E,o,!1,s),u.on("stopRecord",()=>{C.hide(),x.show(),I.show(),_.removeClass(Ce)}),u.on("deviceReady",()=>{C.show(),x.hide(),_.addClass(Ce)}),lb(u,r,i,pu,a),o&&(u.deviceButton&&u.deviceButton.hide(),u.src(o),x.show(),C.hide(),_.removeClass(Ce));const R=[{name:"microphone"}];!u.cameraOff&&R.push({name:"camera"}),Promise.all(R.map(T=>{var O;return(O=navigator==null?void 0:navigator.permissions)==null?void 0:O.query(T)})).then(T=>{T.reduce((k,N)=>k&N.state==="granted",!0)&&u&&(u.deviceButton&&u.deviceButton.hide(),!o&&u.record().getDevice())}).catch(T=>{})},Mf=(e,t=3)=>{const n=F.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(()=>{Mf(e,t-1)},1e3))},Ff=e=>{const t=F.document.createElement("div");return t.className="ul-video-container",t.appendChild(ob(e)),t},Sa=(e,t)=>{const n=F.document.createElement("video");n.id=e,n.className="video-js vjs-default-skin ul-video-player-video";const r=F.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=F.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},fb=(e,t)=>{t?(e.children()[0].classList.add("vjs-hidden"),e.audioPlayerPlaceholder.show(),F.document.getElementById(`${e.id()}_html5_api`).style.height="0px"):(e.children()[0].classList.remove("vjs-hidden"),e.audioPlayerPlaceholder.hide(),F.document.getElementById(`${e.id()}_html5_api`).style.height="100%")},Di=(e,t)=>F.document.getElementById(e)?t?F.videojs(e,t):F.videojs(e):(console.error(`Error in finding player element with ID, ${e}`),null),pb=(e,t,n,r=!1,i="https://api.sprig.com",o=document,a=null,s=null)=>{F.document=o;const l=e+Lf,u=Ff(l);return F.document.addEventListener("securitypolicyviolation",c=>{Ct(new Error(`Voice & Video feature violates ${c.violatedDirective} web page CSP policies for the question player.`),"playerDeviceError",i,{})}),Df(Rf,()=>{F.document.getElementById(Cs(l)).remove(),Sa(l,u);const c={playsinline:!0,playbackRates:[.5,1,1.5,2],fill:!0};try{const d=e+Of;Sa(d,u);const f=Di(l,c),p=Di(d,{muted:!0,...c});if(!f||!p)return;cb(p,a,s),a||p.addClass(Ce);const h=Uf(f,["PlaybackRateMenuButton","PlayToggle","FullscreenToggle"]),m=h.children().find(g=>g.name_==="FullscreenToggle");m.hasClass("vjs-disabled")&&m.hide(),Pf(f,h,t,n,r,p)}catch(d){Ct(new Error(`Error when creating video player object ${d}`),"playerDeviceError",i,{});return}}),u},hb=(e,t={},n="https://api.userleap.com",r,i,o,a=!1,s=document)=>{F.document=s;const l=e+Nf,u=Ff(l);return F.document.addEventListener("securitypolicyviolation",c=>{Ct(new Error(`Voice & Video feature violates ${c.violatedDirective} web page CSP policies for the recorder player.`),"recorderDeviceError",n,o,t.visitorId,t.envId)}),Df(Rf.concat(ab),()=>{Sa(l,u),F.document.getElementById(Cs(l)).remove();try{db(u,l,t,n,r,i,o,a)}catch(c){Ct(new Error(`Error when creating video recorder player object ${c}`),"recorderDeviceError",n,o,t.visitorId,t.envId);return}}),u},mb=e=>{const t=e+Nf;if(!!F.document.getElementById(t)&&!!F.videojs){try{if(!F.videojs(t).record().stream)return}catch{return}F.videojs(t).record().stop(),F.videojs(t).record().stopDevice()}},gb=e=>{const t=Di(e+Lf);t==null||t.pause()},vb=e=>{if(!e)return null;const t=e.match(/https:\/\/stream.mux.com\/(.*)/);let n=t?t[1]:null;return n.includes(du)&&(n=n.replace(du,"")),n?`https://image.mux.com/${n}/thumbnail.jpg?time=0`:null},K={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"},Ye={PlaybackRateMenuButton:"Speed",PlayToggle:"Play",FullscreenToggle:"Expand",TurnOnCamera:"Turn on",TurnOffCamera:"Turn off",DeleteButton:"Delete",RecordButton:"Record",StopButton:"Stop",PauseButton:"Pause"},$n="ul-card-video__player_recorder",yb="ul-card-video__skip_button",_b="ul-video-interview-form",hu="ul-video-btn",bb=({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}=ue(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,m]=ke(!1),[g,_]=ke(null),[v,b]=ke(null),[y,C]=ke(0),S=u["userleap-platform"],E=r&&r.videoUrl,I=(k,N)=>{k===K.UPLOAD_STARTED?(_(N[K.UPLOAD_ID]),b(N[K.MEDIA_RECORDING_UID]),m(!0)):k===K.DELETE?(_(null),b(null),m(!1)):k===K.UPLOAD_PROGRESS?isNaN(N[K.UPLOAD_PROGRESS_PCT])?l({mediaRecordingUid:N[K.MEDIA_RECORDING_UID],isComplete:!0}):l({mediaRecordingUid:N[K.MEDIA_RECORDING_UID],progressPct:N[K.UPLOAD_PROGRESS_PCT]}):k===K.UPLOAD_FINISHED&&l({mediaRecordingUid:N[K.MEDIA_RECORDING_UID],isComplete:!0})},x=k=>{if(k&&k.children.length===0){const N=pb($n,{src:E,type:"application/x-mpegURL"},void 0,r.mediaType===K.MEDIA_TYPE_AUDIO,a,f);k.appendChild(N)}},R=k=>{if(k&&k.children.length===0){const N=hb($n,{surveyId:d,responseGroupUid:c,questionId:i,visitorId:p,envId:s},a,I,void 0,{...u,"x-ul-video-recorder-origin":"sdk"},r.mediaType===K.MEDIA_TYPE_AUDIO,f);k.appendChild(N)}},T=k=>{k.preventDefault(),k.stopPropagation(),mb($n),g&&v?(l({mediaRecordingUid:v,isSubmitted:!0}),n({value:{mediaRecordingUid:v},questionId:i,type:o})):n({value:null,questionId:i,type:o})},O=()=>w($t,{defaultBody:()=>w("button",{className:`${hu} ul-record-response-btn`,onClick:k=>{k.preventDefault(),k.stopPropagation(),gb($n),C(1)}}),properties:r});return w("div",{className:j(ht(L.CardMainContent,S)),style:{marginTop:"unset"},children:w("form",{className:j([e,L.VideoCard,L.FadeInTransition]),id:_b,children:[w(gt,{message:t,properties:r}),w("div",{id:"ul-card-voice__video",children:[w("div",{children:[w("div",{id:"ul-question-player-container",style:{display:y===0?"":"none"},children:[w("div",{id:$n,ref:x}),O()]}),w("div",{style:{display:y===1?"block":"none"},children:[w("button",{className:`${hu} ul-back-question-btn`,onClick:k=>{k.preventDefault(),k.stopPropagation(),C(0)}}),w("div",{id:"ul-recorder-player-container",ref:R})]})]}),w(He,{disabled:!h,onClick:T,children:qn(r)}),w("button",{className:`ul-card-text__button ${L.InactiveButton} ${L.SkipButton}`,id:yb,onClick:T,style:{display:r.required?"none":"block",...h?{display:"none"}:{}},children:_s(r)})]})]})})},wb=({className:e})=>{const{headers:t,uploadProgress:n}=ue(a=>({headers:a.headers,uploadProgress:a.uploadProgress}));let r,i;Object.values(n).filter(a=>a.isSubmitted).length>1?(r="Your responses are processing",i="Please keep this tab open until your responses are fully processed."):(r="Your response is processing",i="Please keep this tab open until your response is fully processed.");const o=Math.round(Math.min(99,...Object.values(n).filter(a=>a.isSubmitted).map(a=>a.progressPct)));return w("div",{className:j(ht(L.CardMainContent,t["userleap-platform"])),children:w("div",{className:j([e,"ul-card--uploading",L.FadeInTransition]),children:[w("div",{"aria-busy":"true","aria-label":"Processing...","aria-live":"polite",className:L.LoadingSpinnerContainer,role:"progressbar",children:w("div",{className:L.LoadingSpinner,children:[w("div",{className:L.LoadingSpinnerFirst}),w("div",{className:L.LoadingSpinnerSecond}),w("div",{className:L.LoadingSpinnerThird}),w("div",{className:L.LoadingSpinnerFourth})]})}),w(gt,{message:`${r} (${o}% complete)`}),w("p",{className:L.Caption,children:i})]})})},mu=()=>w("svg",{alt:"Powered by Sprig",fill:"none",height:"13",viewBox:"0 0 100 13",width:"100",xmlns:"http://www.w3.org/2000/svg",children:[w("path",{d:"M3.0369 0.839981H0.0249023V8.99998H1.3209V6.53998H2.8569C4.8969 6.53998 6.2409 5.37598 6.2409 3.62398C6.2409 1.95598 4.9689 0.839981 3.0369 0.839981ZM3.0009 5.35198H1.3209V2.02798H3.0009C4.1769 2.02798 4.9689 2.67598 4.9689 3.62398C4.9689 4.65598 4.1769 5.35198 3.0009 5.35198Z",fill:"#5D696F"}),w("path",{d:"M9.90653 3.21598C8.15453 3.21598 6.90653 4.45198 6.90653 6.17998C6.90653 7.90798 8.15453 9.14398 9.90653 9.14398C11.6585 9.14398 12.9065 7.90798 12.9065 6.17998C12.9065 4.45198 11.6585 3.21598 9.90653 3.21598ZM9.90653 8.01598C8.88653 8.01598 8.15453 7.23598 8.15453 6.17998C8.15453 5.11198 8.88653 4.34398 9.90653 4.34398C10.9265 4.34398 11.6585 5.11198 11.6585 6.17998C11.6585 7.23598 10.9265 8.01598 9.90653 8.01598Z",fill:"#5D696F"}),w("path",{d:"M20.9631 3.35998L19.7391 7.11598L18.3951 3.35998H17.3271L15.9831 7.12798L14.7591 3.35998H13.4151L15.4431 8.99998H16.5351L17.8671 5.08798L19.1871 8.99998H20.2791L22.3071 3.35998H20.9631Z",fill:"#5D696F"}),w("path",{d:"M25.7246 3.21598C24.0086 3.21598 22.8206 4.51198 22.8206 6.17998C22.8206 7.85998 24.0206 9.14398 25.7966 9.14398C27.0206 9.14398 28.0166 8.54398 28.3766 7.52398H27.0086C26.7806 7.88398 26.3606 8.05198 25.8086 8.05198C24.7526 8.05198 24.2126 7.40398 24.0926 6.55198H28.5206C28.7606 4.64398 27.5966 3.21598 25.7246 3.21598ZM25.7366 4.27198C26.6126 4.27198 27.2126 4.76398 27.2846 5.68798H24.1166C24.2606 4.89598 24.8006 4.27198 25.7366 4.27198Z",fill:"#5D696F"}),w("path",{d:"M31.1297 4.12798V3.35998H29.8817V8.99998H31.1297V5.44798C31.6337 4.78798 32.3177 4.45198 33.2177 4.41598V3.23998C32.3537 3.23998 31.6457 3.56398 31.1297 4.12798Z",fill:"#5D696F"}),w("path",{d:"M36.8222 3.21598C35.1062 3.21598 33.9182 4.51198 33.9182 6.17998C33.9182 7.85998 35.1182 9.14398 36.8942 9.14398C38.1182 9.14398 39.1142 8.54398 39.4742 7.52398H38.1062C37.8782 7.88398 37.4582 8.05198 36.9062 8.05198C35.8502 8.05198 35.3102 7.40398 35.1902 6.55198H39.6182C39.8582 4.64398 38.6942 3.21598 36.8222 3.21598ZM36.8342 4.27198C37.7102 4.27198 38.3102 4.76398 38.3822 5.68798H35.2142C35.3582 4.89598 35.8982 4.27198 36.8342 4.27198Z",fill:"#5D696F"}),w("path",{d:"M45.4886 0.47998V3.80398C45.0086 3.43198 44.3966 3.21598 43.6766 3.21598C42.0926 3.21598 40.8206 4.53598 40.8206 6.16798C40.8206 7.82398 42.0926 9.14398 43.6766 9.14398C44.3966 9.14398 45.0086 8.92798 45.4886 8.54398V8.99998H46.7246V0.47998H45.4886ZM43.8566 8.01598C42.8246 8.01598 42.0686 7.17598 42.0686 6.16798C42.0686 5.17198 42.8246 4.34398 43.8566 4.34398C44.4806 4.34398 45.0686 4.55998 45.4886 5.15998V7.18798C45.0686 7.79998 44.4806 8.01598 43.8566 8.01598Z",fill:"#5D696F"}),w("path",{d:"M54.6797 3.21598C53.9597 3.21598 53.3477 3.43198 52.8797 3.79198V0.47998H51.6317V8.99998H52.8797V8.55598C53.3477 8.92798 53.9597 9.14398 54.6797 9.14398C56.2637 9.14398 57.5477 7.82398 57.5477 6.16798C57.5477 4.53598 56.2637 3.21598 54.6797 3.21598ZM54.4997 8.01598C53.8757 8.01598 53.2997 7.79998 52.8797 7.21198V5.13598C53.2997 4.54798 53.8757 4.34398 54.4997 4.34398C55.5437 4.34398 56.2997 5.17198 56.2997 6.16798C56.2997 7.17598 55.5437 8.01598 54.4997 8.01598Z",fill:"#5D696F"}),w("path",{d:"M63.3347 3.34798L61.3907 7.76398L59.2667 3.34798H57.9347L60.8147 9.08398L59.6267 11.784H60.9347L64.6547 3.34798H63.3347Z",fill:"#5D696F"}),w("path",{d:"M71.1466 4.34661C69.8092 4.05038 69.131 3.53001 69.131 2.80065C69.131 2.04705 69.8546 1.47822 70.8142 1.47822C71.8034 1.47822 72.5496 2.10339 72.5496 2.9321V2.99813H73.9165V2.9321C73.9165 1.41764 72.5883 0.272705 70.8271 0.272705C69.9784 0.272705 69.2009 0.533191 68.6379 1.0057C68.3584 1.23619 68.1339 1.52487 67.9805 1.8511C67.8271 2.17733 67.7486 2.53303 67.7506 2.89273C67.7451 3.22255 67.8137 3.54949 67.9515 3.84994C68.0894 4.15038 68.293 4.41686 68.5478 4.63012C69.0218 5.04266 69.6945 5.34798 70.5463 5.5388C71.9806 5.85502 72.7078 6.39296 72.7078 7.13686C72.7078 7.94316 71.9156 8.55076 70.8682 8.55076C69.7804 8.55076 68.9599 7.87531 68.9599 6.97996V6.91393H67.5918V6.97996C67.5918 8.56348 68.9942 9.75688 70.8535 9.75688C71.7426 9.75688 72.5588 9.48731 73.1518 8.99662C73.446 8.75831 73.6827 8.4581 73.8445 8.1179C74.0063 7.7777 74.0891 7.40611 74.087 7.03024C74.087 5.6854 73.0991 4.78217 71.1466 4.34661Z",fill:"#5D696F"}),w("path",{d:"M78.7986 2.50806C78.2874 2.50175 77.7823 2.6176 77.3263 2.84576C76.8703 3.07391 76.4768 3.40759 76.1795 3.81837V2.66738H74.8789V12.0752H76.1795V8.48716C76.4768 8.8979 76.8703 9.23152 77.3263 9.45957C77.7824 9.68763 78.2875 9.80335 78.7986 9.79687C80.8167 9.79687 82.3381 8.23031 82.3381 6.15246C82.3381 4.07462 80.8167 2.50806 78.7986 2.50806ZM80.9835 6.42264C80.9316 6.9629 80.6921 7.46879 80.3056 7.8544C79.919 8.24001 79.4093 8.48156 78.863 8.53804C78.1369 8.61074 77.4605 8.40295 76.9583 7.95407C76.4561 7.50518 76.1795 6.86365 76.1795 6.15246C76.1795 4.7846 77.2122 3.75295 78.5815 3.75295C79.2904 3.75295 79.9306 4.02191 80.3776 4.51018C80.8387 5.01116 81.054 5.69025 80.9835 6.42264Z",fill:"#5D696F"}),w("path",{d:"M98.2908 2.6692V3.80747C97.6776 2.97875 96.7302 2.50806 95.6583 2.50806C93.6482 2.50806 92.1323 4.04615 92.1323 6.08582C92.1323 8.1255 93.6482 9.66299 95.6583 9.66299C96.7345 9.66299 97.6819 9.19714 98.2908 8.37691V8.55198C98.2908 9.96891 97.3906 10.8843 95.9974 10.8843C95.0561 10.8843 94.2718 10.4766 93.8996 9.79384L93.8806 9.7587H92.5389L92.5695 9.84654C92.7961 10.514 93.2392 11.0889 93.8303 11.4822C94.4233 11.8723 95.1726 12.0783 95.9974 12.0783C97.0552 12.0783 97.9554 11.7451 98.6017 11.1157C99.2481 10.4862 99.5915 9.6012 99.5915 8.56773V2.6692H98.2908ZM97.5611 7.842C97.0092 8.36418 96.2225 8.58348 95.4001 8.44294C94.9132 8.35796 94.4664 8.12184 94.1245 7.76889C93.7827 7.41593 93.5636 6.96452 93.4992 6.48019C93.3833 5.66541 93.631 4.89364 94.1786 4.36418C94.6383 3.92741 95.2542 3.68788 95.8919 3.69782C96.0464 3.69795 96.2006 3.71031 96.3531 3.73477C97.3459 3.89349 98.1314 4.70403 98.2632 5.71024C98.3749 6.53835 98.1179 7.31436 97.5611 7.842Z",fill:"#5D696F"}),w("path",{d:"M90.705 0.0995975C90.4602 0.046773 90.2043 0.0911971 89.9925 0.223269C89.7806 0.35534 89.6299 0.564452 89.5729 0.805409C89.5159 1.04637 89.5571 1.29982 89.6877 1.51098C89.8183 1.72215 90.0277 1.87407 90.2708 1.93391C90.3415 1.94954 90.4136 1.95747 90.486 1.95754C90.72 1.9579 90.9458 1.87325 91.1206 1.71973C91.2955 1.5662 91.407 1.35452 91.4341 1.125C91.4611 0.89547 91.4017 0.664135 91.2673 0.475046C91.1329 0.285958 90.9327 0.152325 90.705 0.0995975V0.0995975Z",fill:"#5D696F"}),w("path",{d:"M89.8366 8.39143H88.715C87.9178 8.39143 87.4389 7.85531 87.4389 6.95693C87.4389 6.08096 87.8681 5.03659 88.7432 3.76444L88.7548 3.74748V3.38825L85.0271 2.86727C85.0284 2.71553 84.9886 2.56622 84.9118 2.43478C84.8351 2.30335 84.7241 2.19458 84.5905 2.11973C84.2563 1.938 83.8908 1.938 83.5879 2.11368C83.4361 2.2023 83.3122 2.33077 83.23 2.4848C83.1477 2.63884 83.1103 2.8124 83.1219 2.98618C83.1336 3.15996 83.1938 3.32714 83.2958 3.46914C83.3979 3.61114 83.5379 3.72238 83.7001 3.79049L82.5405 9.63753H83.8283L84.8977 4.08551L86.9115 4.42111C86.3701 5.38007 86.0953 6.27421 86.0953 7.07869C86.0953 8.56347 87.0041 9.53576 88.4734 9.62965V9.63753H91.1341V2.69099H89.8366V8.39143Z",fill:"#5D696F"})]}),Cb=()=>{const{border:e,cards:t,headers:n,index:r,marketingUrl:i,showSurveyBrand:o,slugName:a,surveyId:s,viewedCardCount:l}=ue(m=>({border:m.border,cards:m.cards,headers:m.headers,index:m.index,marketingUrl:m.marketingUrl,showSurveyBrand:m.showSurveyBrand,slugName:m.slugName,surveyId:m.surveyId,viewedCardCount:m.viewedCardCount})),u=Gt(null),c=t.filter(m=>m.type!==D.Uploading&&m.type!==D.Thanks),d=S_(t,r),f=l+1,p=f/(f+d);We(()=>{u.current&&(u.current.style.width=`${p*100}%`)},[p]);const h=()=>o?w("a",{href:`${i}?utm_source=survey_branding&utm_medium=website&utm_campaign=${a}&utm_content=${s}`,rel:"noreferrer",style:{display:"block",margin:"5px 0"},target:"_blank",children:w(mu,{})}):null;return!c||c.length===1?w("footer",{className:"ul-footer",style:o?{}:{marginBottom:"10px"},children:h()}):w("footer",{className:`ul-footer ${n["userleap-platform"]==="link"?"ul-footer__link":""}`,children:[c.length>1&&w("div",{id:"ul-progress-bar-container",children:w("div",{id:"ul-progress-bar-current",ref:u,style:{border:`1px solid ${e||"#000"}`}})}),o&&w("a",{href:`${i}?utm_source=survey_branding&utm_medium=website&utm_campaign=${a}&utm_content=${s}`,rel:"noreferrer",style:{display:"block",margin:"5px 0"},target:"_blank",children:w(mu,{})})]})},Ib=()=>{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:m}=ue(k=>({answers:k.answers,border:k.border,cards:k.cards,close:k.close,configureExitOnOverlayClick:k.configureExitOnOverlayClick,destroy:k.destroy,endCard:k.endCard,eventEmitFn:k.eventEmitFn,fontFamily:k.fontFamily,headers:k.headers,index:k.index,next:k.next,showStripes:k.showStripes,update:k.update,useMobileStyling:k.useMobileStyling,viewDocument:k.viewDocument})),g=Gt(null),_=Gt(!1),{props:v,type:b,name:y}=n[c],C=n.length;We(()=>{g.current&&(g.current.classList.contains("ul-app--visible")||g.current.classList.add("ul-app--visible"),!_.current&&s&&(_.current=!0,s(z.SurveyAppeared)))},[s]),We(()=>{p()},[c,p]),We(()=>{i(()=>r())},[r,i]);const S=()=>r(xn),E=k=>{k.key==="Enter"&&S()},I=async function(k){d({data:k,completeSurvey:()=>{o(xn)},endCard:a}),sm(m)};if(e){for(const k of e)if(k.questionId===y){let N;if(b===D.MultipleChoice){const A=v.options.find(({value:B})=>B===k.value);if(!A)break;N={[A.id]:A.value}}else N=k.value;I({value:N,type:b,questionId:k.questionId});break}}const x=()=>[ln.Email,ln.Link].includes(u["userleap-platform"])?!1:!a||c+1!==C,R=()=>h?{borderColor:t}:{borderColor:t,margin:"15px"},T=()=>{const k={className:"ul-card",next:I,questionId:y,type:b};switch(b){case D.ConsentLegal:return pe(P_,{...k,...v,key:y});case D.Likert:return pe(F_,{...k,...v,key:y});case D.MultipleChoice:return pe(V_,{...k,...v,key:y});case D.MultipleSelect:return pe(B_,{...k,...v,key:y});case D.NPS:return pe(j_,{...k,key:y,props:v});case D.Open:return pe(H_,{...k,...v,key:y});case D.RecordedTask:return pe(J_,{...k,...v,key:y});case D.TextUrlPrompt:return pe(nb,{...k,...v,key:y});case D.Thanks:return pe(rb,{...k,...v,key:y});case D.Uploading:return pe(wb,{...k,...v,key:y});case D.VideoVoice:return pe(bb,{...k,...v,key:y});default:return null}},O=k=>{var J;const N=window.sprigAPI,A=k.target;if(!N||!A)return;const B=[A,A.parentElement];for(const se of B)if(((J=se==null?void 0:se.tagName)==null?void 0:J.toLowerCase())==="a"){k.preventDefault(),N==null||N.openUrl(se.href);return}};return w("div",{className:j("ul-app",An(u)?"ul-app--visible":"ul-app--overlay"),id:xn,onClick:O,ref:g,style:{"--theme":t,...l?{fontFamily:l.replace(";","")}:{}},children:w("div",{className:"ul-app__container",children:[w("div",{className:j(_e(L.CardContainer,h)),style:R(),children:[f&&w("div",{className:"ul-header__container",children:w("div",{className:"ul-header",children:"For development purposes only"})}),T(),w(Cb,{})]}),x()&&w("div",{className:j(_e(L.CloseContainer,h)),children:w("div",{"aria-label":"Close button",className:L.CloseButton,onClick:S,onKeyPress:E,role:"button",tabIndex:0,children:w("svg",{fill:"none",height:"18px",viewBox:"0 0 13 13",width:"18px",xmlns:"http://www.w3.org/2000/svg",children:w("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"})})})})]})})},Eb=`html,body,p,ol,ul,li,dl,dt,dd,blockquote,figure,fieldset,legend,textarea,pre,iframe,hr,h1,h2,h3,h4,h5,h6{margin:0;padding:0}h1,h2,h3,h4,h5,h6{font-size:100%;font-weight:400}button,input,select,textarea{margin:0}html{box-sizing:border-box}*,*:before,*:after{box-sizing:inherit}.ul-card{flex:1 1 auto;border-radius:2px;display:flex;flex-direction:column;font-size:17px;line-height:19px;text-align:left;margin:auto}.ul-card__container--desktop{border:2px solid #fff;box-shadow:0 0 15px #00000026}.ul-card__container--mobile{border-width:0;box-shadow:0 0 5px #00000040;margin-top:5px}.ul-card__container{background:#ffffff;border-radius:6px;display:flex;flex-direction:column;flex-grow:1;flex:1 1 auto;font-size:17px;line-height:23px;overflow:auto;padding:20px 20px 5px;position:relative;text-align:center;word-break:break-word}.ul-card-vertical__button-wrapper{flex-direction:column;align-items:center}.ul-card__button-wrapper{margin-top:4px;margin-bottom:3px;display:flex;gap:16px;justify-content:center}.ul-rich-text-body{min-height:2em}.ul-rich-text-body,.ul-rich-text-body p{margin-top:10px;margin-bottom:10px}.ul-rich-text-body li{margin:5px 0 5px 20px}.ul-rich-text-body p,.ul-rich-text-body li{font-size:15px;line-height:130.35%;letter-spacing:.02em;color:#343442;text-align:left;white-space:pre-line}.ul-rich-text-body:last-child,.ul-rich-text-body li:last-child{margin-bottom:15px}.ul-card-main-content__link,.ul-card-main-content__email{flex-grow:55;display:flex}.ul-card-main-content__web,.ul-card-main-content__android,.ul-card-main-content__ios{padding-top:15px;margin-bottom:5px}.ul-question{color:#343442;display:block;font-size:20px;line-height:125%;font-weight:500;cursor:default;text-align:left}.ul-caption{flex:1 0 auto;margin-top:8px;margin-bottom:15px;font-size:15px;line-height:130.35%;letter-spacing:.02em;color:#6c6c6e;text-align:left}.ul-card__choices{margin:5px 0 0;flex:1 0}.choice--mobile{border:2px solid #e6e6e6}.choice--desktop{border:1px solid #e6e6e6}.choice{align-items:flex-start;color:#262136;cursor:pointer;display:flex;justify-content:flex-start;flex-direction:column;box-sizing:border-box;border-radius:3px;margin-bottom:7px;font-size:15px;line-height:20px;padding:10px 20px 10px 15px;background-color:#00000003}.choice--desktop:hover,.choice--desktop:active,.choice--mobile:active{background-color:#0000000d}.choice-label-container{display:flex;flex-direction:row;justify-content:flex-start;align-items:center;width:100%;height:fit-content;flex:0 0 fit-content}.choice-text-entry-container{width:100%;height:fit-content;flex:0 1 fit-content;overflow:hidden}.choice .choice-text-input--mobile{max-height:63px}.choice .choice-text-input--desktop{max-height:150px}.choice .choice-text-input{box-sizing:border-box;background-color:transparent;color:#343442;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol;min-height:20px;max-height:60px;padding:0;margin-top:8px;resize:none;width:100%;font-size:14px;line-height:20px;outline:none;border:none;overflow-wrap:break-word}.choice .choice-text-input::placeholder{color:#6c6c6e80}.ul-thanks-check{text-align:center;margin-bottom:20px}.ul-card--thanks-content{padding:20px 0 10px}.ul-card--thanks .ul-question{padding-top:0;text-align:center}.ul-card--thanks .ul-caption{padding-top:0;text-align:center;overflow-wrap:break-word;hyphens:auto;hyphenate-limit-lines:no-limit}.ul-card--uploading .ul-question{padding-top:15px;text-align:center}.ul-card--uploading .ul-caption{padding-top:5px;text-align:center;overflow-wrap:break-word}.ul-loading-spinner-container{font-size:1.8rem;flex-grow:1;width:100%;height:100%;display:flex;align-items:center;justify-content:center}.ul-loading-spinner{display:inline-block;position:relative;width:6rem;height:6rem}.ul-loading-spinner div{box-sizing:border-box;display:block;position:absolute;width:80%;height:80%;margin:5px;border:5px solid #152e3e;border-radius:50%;animation:lds-ring 1.2s cubic-bezier(.5,0,.5,1) infinite;border-color:#152e3e transparent transparent transparent}.ul-loading-spinner .first{animation-delay:-.45s}.ul-loading-spinner .second{animation-delay:-.3s}.ul-loading-spinner .third{animation-delay:-.15s}@keyframes lds-ring{0%{transform:rotate(0)}to{transform:rotate(360deg)}}.select-checkbox{height:16px;width:16px;border-radius:3px;border:1px solid #323232;display:flex;box-sizing:border-box;box-shadow:inset 3px 3px #0000001a;background-color:"transparent";align-items:center;justify-content:center}.select-radio{height:16px;width:16px;border-radius:16px;border:1px solid #323232;display:flex;box-sizing:border-box;box-shadow:inset 2px 2px #0000001a;background-color:"transparent";align-items:center;justify-content:center}.fade-in-transition{animation:fadeIn .4s ease-in;-webkit-animation:fadeIn .4s ease-in;-moz-animation:fadeIn .4s ease-in;-o-animation:fadeIn .4s ease-in;-ms-animation:fadeIn .4s ease-in}@keyframes fadeIn{0%{opacity:0}to{opacity:1}}@-moz-keyframes fadeIn{0%{opacity:0}to{opacity:1}}@-webkit-keyframes fadeIn{0%{opacity:0}to{opacity:1}}@-o-keyframes fadeIn{0%{opacity:0}to{opacity:1}}@-ms-keyframes fadeIn{0%{opacity:0}to{opacity:1}}[class^=CenteredSurveyLayout] .ul-header__container,[class^=QuestionConceptTestLayout] .ul-header__container,.ul-websurvey-frame .ul-card__container,.ul-websurvey-frame-mobile .ul-card__container{margin-bottom:unset}[class^=CenteredSurveyLayout] .ul-card__container,[class^=QuestionConceptTestLayout] .ul-card__container,.ul-websurvey-frame .ul-card__container,.ul-websurvey-frame-mobile .ul-card__container{box-shadow:unset;border-radius:unset;border:none!important;position:unset}@media only screen and (min-height: 600px) and (width: 600px){.ul-card{position:relative;top:-20px}}.ul-vertical-centered-container{display:flex;flex-direction:column;align-items:center}.ul-consent-legal__name-input--mobile{border:2px solid #e6e6e6}.ul-consent-legal__name-input--desktop{border:1px solid #e6e6e6}.ul-consent-legal__name-input{background:rgba(0,0,0,.01);box-sizing:border-box;color:#343442;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol;padding:10px 20px 10px 15px;border-radius:3px;font-size:15px;line-height:20px;margin-bottom:7px;width:100%}.ul-consent-legal__name-input::placeholder{color:#6c6c6e80}.ul-consent-legal__name-input:focus{outline:none;background:white}.ul-consent-legal__name-input--desktop:hover:not(:focus){background-color:#0000000d}.ul-card__consent-legal .choice{font-size:15px;padding:10px 15px;background-color:#00000003}.ul-card__consent-legal .choice--desktop:hover,.ul-card__consent-legal .choice--desktop:active,.ul-card__consent-legal .choice--mobile:active{background-color:#0000000d}.ul-card--likert__numbers{align-items:center;border-radius:5px;display:flex;flex-direction:row;flex:1 0;justify-content:center;margin:5px 0 0}.likert-number--mobile{border:2px solid #e6e6e6;margin-left:-2px}.likert-number--desktop{border:1px solid #e6e6e6;margin-left:-1px}.likert-number{align-items:center;cursor:pointer;display:flex;justify-content:center;flex:1 0;background-color:#00000003;font-size:18px;line-height:24px;height:67px}.likert-number:active,.likert-number--desktop:hover{background-color:#0000000d;font-weight:500}.likert-number-1{border-top-left-radius:5px;border-bottom-left-radius:5px}.likert-last-option{border-top-right-radius:5px;border-bottom-right-radius:5px}.likert-star--mobile{margin-left:-2px}.likert-star--desktop{margin-left:-1px}.likert-star{align-items:center;cursor:pointer;display:flex;justify-content:space-between;flex:1 0;color:transparent;font-size:18px;line-height:24px;height:67px}.likert-smiley--mobile{margin-left:-2px}.likert-smiley--desktop{margin-left:-1px}.likert-smiley{align-items:center;cursor:pointer;display:flex;justify-content:space-between;flex:1 0;color:transparent;line-height:24px;height:67px}.likert-smiley circle:not(:first-child){fill-opacity:1}.ul-card--likert__labels{align-items:center;color:#262136;display:flex;flex-direction:row;flex:1 0;font-weight:500;font-size:13px;line-height:15px;justify-content:space-between;margin:7px 0 10px}.ul-card--likert__labels span:last-child{text-align:right}.select-label{flex:1;overflow-wrap:anywhere;cursor:pointer;padding-left:15px}.ul-card--nps__numbers{align-items:center;border-radius:5px;display:flex;flex-direction:row;flex:1 0;justify-content:center;margin:5px 0 0}.nps-number--mobile{border:2px solid #e6e6e6;margin-left:-2px}.nps-number--desktop{border:1px solid #e6e6e6;margin-left:-1px}.nps-number{align-items:center;cursor:pointer;display:flex;justify-content:center;flex:1 0;background-color:#00000003;font-size:18px;line-height:24px;height:67px}.nps-number:active,.nps-number--desktop:hover{background-color:#0000000d;font-weight:500}.nps-number-0{border-top-left-radius:5px;border-bottom-left-radius:5px}.nps-number-10{border-top-right-radius:5px;border-bottom-right-radius:5px}.ul-card--nps__labels{align-items:center;color:#262136;display:flex;flex-direction:row;flex:1 0;font-weight:500;font-size:13px;line-height:15px;justify-content:space-between;margin:7px 0 10px}.ul-card--nps__labels span:last-child{text-align:right}.ul-card-text{flex:1 0 auto;margin-top:2px;margin-bottom:3px;align-items:center;display:flex;flex-wrap:wrap;justify-content:center;padding:0}.ul-card-text__container{align-items:center;box-sizing:border-box;border-radius:3px;display:flex;justify-content:center;margin-bottom:12px;flex:1 0 100%}.ul-card-text__input--mobile{border:2px solid #e6e6e6;max-height:63px}.ul-card-text__input--desktop{border:1px solid #e6e6e6;max-height:150px}.ul-card-text__input{background:rgba(0,0,0,.01);box-sizing:border-box;color:#343442;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol;min-height:63px;overflow:auto;padding:12px;resize:none;width:100%;border-radius:3px;font-size:15px;line-height:20px;overflow-wrap:break-word}.ul-card-text__input::placeholder{color:#6c6c6e80}.ul-card-text__input:focus{outline:none;background:white}.ul-card-text__input--desktop:hover:not(:focus){background-color:#0000000d}.ul-card__text-url-prompt-button{text-decoration:none;text-overflow:ellipsis;overflow:hidden;white-space:nowrap}#ul-card-voice__video{align-items:center;display:flex;flex-direction:column}#ul-card-voice__video>div{margin-bottom:10px;width:100%}#ul-card-video__player_recorder{width:100%;width:-moz-available;width:-webkit-fill-available;width:fill-available}.ul-card-record__task{flex:1 0 auto;margin-top:2px;margin-bottom:3px;align-items:center;display:flex;flex-wrap:wrap;justify-content:center;padding:0}#ul-record-task-upload-progress,#ul-record-task-video-preview{width:100%;height:150px}.ul-permission-graphics-container{width:100%;height:150px;background-color:#0000000d;text-align:center;flex-direction:column;margin-left:auto;margin-right:auto;border-radius:5px;display:flex;align-items:center;font-size:15px;color:#000000b3}.ul-av-permission-denied-paragraph{margin:auto 15px;font-size:12px}.ul-av-permission-denied-headline{font-size:14px;color:#262136;text-decoration:underline;font-size:12px}.ul-permission-body{color:#000;margin:5px auto 5px 5px;line-height:135%;text-align:center}.ul-select-tab-container{width:240px;height:46px;background:#ffffff;border-radius:5px;text-align:left;align-items:center;display:flex;padding:0 5px;margin-top:20px;margin-bottom:auto}.ul-select-tab-text{color:#4b575d;margin:5px;line-height:135%;text-align:center}button.ul-task-skip-button{color:#000;background-color:#fff}#ul-task-detail-container{margin-top:0;margin-bottom:0;overflow:auto}#ul-task-detail-container.ul-rich-text-body p,#ul-task-detail-container.ul-rich-text-body li,#ul-task-detail-container.ul-rich-text-body{color:#4c4c4c}#ul-task-detail-container :first-child{margin-top:0}#ul-task-detail-container :last-child{margin-bottom:20px}.ul-horizontal-button-container{width:100%;display:flex;flex-direction:row}.ul-skip-button-below{margin-top:5px}.ul-horizontal-button-container-center{justify-content:center}.ul-vertical-button-container-center{display:flex;flex-direction:column;align-items:center}.ul-horizontal-button-container-left{justify-content:flex-start}.ul_recorded-task-inset-spacing{margin-top:5px;margin-bottom:24px}.ul_permission_svg_container{justify-content:center}.ul-card-text__button{background-color:var(--theme);border-radius:3px;border:none;color:#fff;cursor:pointer;font-size:15px;font-weight:500;line-height:18px;padding:10.5px 21px}.ul-card-text__button:disabled,.ul-card-text__button.sprig-button-disabled{background-color:#0000001a;color:#0003}.ul-card-text__button.ul-button-inactive{background-color:#fff!important;color:#5d696f!important}.ul-card-skip__button{color:#00000080;background:none;border:none;font-size:15px;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol;cursor:pointer}.ul-card-button-group{align-items:center;display:flex;gap:30px;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-bubble{display:inline-block;margin:0 3px;width:7px;height:7px;border-radius:3px;border:1px solid transparent}.close-container--desktop,.close-container--mobile{height:22px;width:22px;border-radius:22px;background-color:#fff;align-items:center;justify-content:center}.close-container--desktop{top:25px;right:25px}.close-container--mobile{top:15px;right:10px}.close-container{background:transparent;box-sizing:border-box;display:flex;position:absolute}.close-btn{height:18px;width:18px;align-items:center;justify-content:center;display:flex;cursor:pointer}.ul-app__container{transition:opacity .3s ease-out}.ul-center-horizontally{text-align:center}#ul-progress-bar-container{width:100%;height:2px;background-color:#0000001a;border-radius:2px;max-width:250px;margin:25px 0}#ul-progress-bar-current{transition:width 1s ease;width:0%;height:0;border-radius:2px}.prototype-button{width:100%;background:rgba(0,0,0,.01);border:1.5px solid #e6e6e6;border-radius:4px 0 0 4px;flex:none;flex-grow:1;margin:0;padding:20px 0;font-size:14px;font-family:inherit;text-decoration:underline}.prototype-button:hover{cursor:pointer}
723
- `,Sb=(e,t)=>{const n=[...e],r=new Set([D.VideoVoice,D.RecordedTask]);return e.some(i=>r.has(i.type))&&n.push({name:-2,props:{routingOptions:[]},type:D.Uploading}),t&&n.push({name:-1,props:{routingOptions:[]},type:D.Thanks}),n},kb=({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 xb(e,t=!0){var y;const{answers:n,apiURL:r,customStyles:i,endCard:o,eventEmitFn:a,fontFamilyURL:s,frame:l,previewKey:u,viewDocument:c,viewWindow:d}=e,f=An(e.headers)?e.frame:c.body,p=q,h=Sb(e.cards,!!o);Ca.configure(p,{cards:h,hasEndCard:!!o,apiURL:r}),ue.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,frame:l,headers:e.headers,hasViewedEmbed:!1,isPreview:e.isPreview,marketingUrl:"https://sprig.com",meta:kb({mode:e.mode,viewWindow:d,viewDocument:c}),mode:e.mode,previewKey:u,recorder:Ca,recorderEventEmitter:p,responseGroupUid:e.responseGroupUid,showStripes:e.showStripes,showSurveyBrand:e.showSurveyBrand,slugName:e.slugName,styleNonce:e.styleNonce,surveyId:e.surveyId,tabTitle:e.tabTitle,uploadingCardViewed:!1,uploadProgress:{},useMobileStyling:e.useMobileStyling,useDesktopPrototype:e.useDesktopPrototype,userId:e.userId,viewDocument:e.viewDocument,visitorAttributes:e.visitorAttributes,viewedCardCount:e.startingQuestionIdx||0});const{seen:m}=ue.getState();m();const{head:g}=c,_=c.createElement("style");if(_.id="sprig-style",_.textContent=Eb,_.nonce=e.styleNonce,g.appendChild(_),e.fontFamily&&s&&parent){const C=c.createElement("link");C.rel="stylesheet",C.href=s,g.appendChild(C)}e.customStyles&&Mu(c,i,e.styleNonce);const v="2.24.5",b=a||((y=l.eventEmitter)==null?void 0:y.emit);b==null||b(qe.VerifyViewVersion,{[en.ViewVersion]:v}),f&&t&&Mn(w(Ib,{}),f)}const Ab={configure:xb};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 Tb="rgba(255,255,255, 0.95)",Rb="rgba(0,0,0,0.9)",Lb="360px",Ro="0px",Vf=()=>{window.UserLeap.container=document.createElement("div"),window.UserLeap.container.className="ul-container",document.body.appendChild(window.UserLeap.container)},Bf=e=>{Pb();const t=window.UserLeap.container;if(!(!t||!t.parentNode))try{t.parentNode.removeChild(t),window.UserLeap.container=null,Ve("trackStartUrl",null),q.emit(z.SurveyLifeCycle,{state:"dismissed"}),q.emit(z.SurveyClosed,{name:z.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)}},jf=()=>{q.on(z.SurveyWillClose,({initiator:e})=>{Bf(e)})},Ob=(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"?Tb:Rb,t||(r.margin="auto"),window.UserLeap.container&&Object.assign(window.UserLeap.container.style,r)},Nb=(e,t,n)=>{var s,l;const r={position:"fixed",bottom:"0px",right:Ro,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=Lb,r.maxHeight=window.UserLeap.maxHeight||"66vh",i.framePosition===Qn.BottomLeft?o={left:Ro}:i.framePosition===Qn.TopLeft?o={left:Ro,top:"0px"}:i.framePosition===Qn.TopRight?o={top:"0px"}:i.framePosition===Qn.Center&&(a=!0,o={margin:"auto",position:"static"},r.maxHeight=null)),a&&Ob(i,n),Object.assign(e.style,r,o),a},Db=(e,t)=>{var s,l;const n="ul-frame";Vf(),Ub();const r=document.createElement("iframe");r.id=n,r.setAttribute("title","Sprig User Feedback Dialog");const i=Nb(r,e,t);jf(),r.setHeight=u=>{parseInt(r.style.height)!=u&&(r.style.height=`${u}px`,q.emit(z.SurveyHeight,{name:z.SurveyHeight,contentFrameHeight:u}))},(s=window.UserLeap.container)==null||s.appendChild(r),e&&(t?e.exitOnOverlayClickMobile:e.exitOnOverlayClick)&&window.UserLeap.container&&(window.UserLeap.container.onclick=()=>{q.emit(z.CloseSurveyOnOverlayClick)}),q.emit(z.SurveyLifeCycle,{state:"presented"}),q.emit(z.SurveyPresented,{name:z.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}},Hf={[z.SurveyFadingOut]:()=>{window.UserLeap.container&&Object.assign(window.UserLeap.container.style,{"background-color":"rgba(0,0,0,0)"})}},Ub=()=>{Object.entries(Hf).forEach(([e,t])=>{q.on(e,t)})},Pb=()=>{Object.entries(Hf).forEach(([e,t])=>{q.off(e,t)})},Mb="!launch_darkly_";class Fb{constructor(){xe(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[`${Mb}${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 ka=new Fb;Object.freeze(ka);const Vb="!optimizely_experiments_";class Bb{constructor(){xe(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 Vb+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 ui=new Bb;Object.freeze(ui);class jb{constructor(t,n){xe(this,"paused");xe(this,"queue");xe(this,"ul");this.ul=t,this.paused=!1,this.queue=[],this.flush(n)}flush(t){const n=t.length;if(n)for(let r=0;r<n;r++)this.push(t[r])}isPaused(){return this.paused}pause(){this.paused=!0}unpause(){this.paused=!1;const t=this.queue.slice();this.empty(),this.flush(t)}push(t){if(this.paused)this.queue.push(t);else if(t instanceof Function)t();else{const n=Array.prototype.slice.call(t,1),r=t[0],i=this.ul[r];i instanceof Function?i.apply(this.ul,n):r&&console.warn("[Sprig] (ERR-100) No valid UserLeap action called",r)}}perform(t){if(this.paused){let n=()=>{};const r=new Promise(function(i){n=function(){i(t())}});return this.queue.push(n),r}else return t()}empty(){this.queue.length=0}}const Hb=["popState","pushState","replaceState"],zb={test:"test"},Zn="!email",Kb=["ios","android"],Vt="environments",xa="pageUrl",Zt="visitors",gu="ul-view-sdk-script",vu=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 Is(e,t){const{matchType:n,pattern:r}=e,i=n?vu[n]:vu.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 Gb(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?Is(a,window.location.href):t===window.location.href}function br(e){const{pageUrlEvents:t,interactiveEvents:n,dismissOnPageChange:r,platform:i}=window.UserLeap._config;if(i&&i!==ln.Web)return;const o=Yt("trackStartUrl"),a=o?String(o):null;t&&qf(window.location.href),n&&(Kf(),Wb()),r&&a&&a!==window.location.href&&e&&Hb.includes(e.type)&&window.UserLeap("dismissActiveSurvey",ut.PageChange)}const zf={capture:!0},Wb=()=>{const t=window.UserLeap._config.interactiveEvents.filter(r=>Is(r,window.location.href)).map(r=>{const{name:i,properties:o}=r,{selector:a,innerText:s}=o;return a?l=>{if(Nn(l.target))try{l.target.closest(a)&&window.UserLeap("track",i)}catch{}return!1}:l=>(Nn(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,zf)},Kf=()=>{window.UserLeap._config.interactiveEventsHandler&&window.removeEventListener("click",window.UserLeap._config.interactiveEventsHandler,zf),delete window.UserLeap._config.interactiveEventsHandler};function qb(){["hashchange","popstate"].forEach(e=>window.addEventListener(e,br,!0))}function $b(){["hashchange","popstate"].forEach(e=>window.removeEventListener(e,br,!0)),window.UserLeap._config.interactiveEvents&&Kf()}function lt(e,t,n){const r=[window.UserLeap._API_URL,"sdk",e];return t&&t.forEach(i=>{r.push(i),i===Vt?r.push(window.UserLeap.envId):i===Zt&&r.push(Es())}),n&&r.push(n),r.join("/")}function Zb(e,t){let n=lt("1",[Vt],"questions?");return e!=null&&(n+=`&vid=${e}`),t&&(t.surveyId&&(n+=`&surveyid=${t.surveyId}`),t.surveyTemplateId&&(n+=`&surveytemplateid=${t.surveyTemplateId}`)),n}function Gf(){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 Yt(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 Ve(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 Wf(){window.previewMode||(window.UserLeap.visitorId=jt(),Ve("vid",window.UserLeap.visitorId),q.emit(z.VisitorIDUpdated,{visitorId:window.UserLeap.visitorId}))}function Es(){return window.previewMode?"0":window.UserLeap.visitorId||""}function qf(e,t,n){if(!window.UserLeap.localStorageAvailable||e.endsWith("mock_snippet.html"))return;const r=window.UserLeap._config.pageUrlEvents;if(r&&r.length){let u=!1;for(let c=0;c<r.length&&(u=Is(r[c],e),!u);c++);if(!u)return}window.UserLeap.debugMode&&console.info("[DEBUG] Sprig trackPageView",e);const i=10,o=1;let a=[];const s={viewedAt:Date.now(),location:e},l=localStorage.getItem(Be.PageViews);try{if(a=l?JSON.parse(l):[],Array.isArray(a)||(a=[]),a.length>0){const u=a[a.length-1],c=(Date.now()-u.viewedAt)/1e3;u.location!=e&&c>o&&kl({url:e}),(u.location!=e&&c>o||c>i)&&(window.UserLeap._queue.push(["track",xa,t,{url:e},n]),a.push(s))}else window.UserLeap._queue.push(["track",xa,t,{url:e},n]),a.push(s),kl({url:e});a.length>5&&a.splice(0,a.length-5);try{localStorage.setItem(Be.PageViews,JSON.stringify(a))}catch(u){u instanceof Error&&console.warn(`[Sprig] Unable to write to Local Storage: ${u.message}`)}}catch(u){u instanceof Error&&window.UserLeap.reportError("trackPageView",u,{pageViewsStorage:l}),console.warn("[Sprig] (ERR-425) Failed to update page views in local storage")}}function Yb(){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),br(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),br(o),i})(e.replaceState)),qb()}async function Lo(e,t){const n=Es();e&&!t&&(window.UserLeap._config.mode=zb.test);const r=await Ut(Zb(n,e),{},0,!0);return r.ok?(r.json.delay&&await hi(r.json.delay),$f(r.json)):(r.reportError&&r.error&&(console.warn("[Sprig] (ERR-414) Failed to request questions from the server",r.error),window.UserLeap.reportError("getQuestions",r.error)),{success:!1,surveyState:"no survey"})}const $f=async e=>{var T,O,k,N;const{context:t,endCard:n,locale:r,productConfig:i,questions:o,responseGroupUid:a,surveyId:s,uuid:l,vid:u,sessionReplay:c}=e,d=Ir(window.UserLeap),f=Ss(d),p=Qb(d);if(c&&Qc({responseGroupId:a,surveyId:s,visitorId:u,replayParams:c,completeUploadHeaders:d,apiUrl:window.UserLeap._API_URL,triggerTimestamp:Date.now(),isStandalone:o.length===0}),u==null||!o||!o.length)return{success:!1,message:"[Sprig] no survey found",surveyState:"no survey"};if(window.UserLeap.container){const A="[Sprig] (ERR-409) Found an existing Survey container, aborting rendering of this survey";return console.warn(A),{success:!1,message:A,surveyState:"no survey"}}if(u!==window.UserLeap.visitorId&&l!==window.UserLeap.visitorId&&!window.previewMode){const A="Attempted to display survey to a different visitor";return window.UserLeap.reportError("DisplaySurvey",new Error(A)),{success:!1,message:A,surveyState:"no survey"}}Hy({id:s}),Uo.disable(),q.emit(z.SurveyWillPresent,{name:z.SurveyWillPresent,[yu.SurveyId]:s});let h,m=document.createElement("div"),g,_,v;const b=A=>{const{[en.ViewVersion]:B}=A;B!==d["x-ul-sdk-version"]&&Bf(),q.removeListener(qe.VerifyViewVersion,b)};q.on(qe.VerifyViewVersion,b),An(d)?(h="ul-direct-embeded-frame",g=document.head,_=window,v=!1,f&&(Vf(),m.id=h,window.UserLeap.container.appendChild(m),jf(),q.emit(z.SurveyLifeCycle,{state:"presented"}),q.emit(z.SurveyPresented,{name:z.SurveyPresented}))):{frameId:h,contentWinDocHead:g,contentWindow:_,hasOverlay:v,iframe:m}=Db(i,p),window.UserLeap.frameId=h,window.UserLeap.useMobileStyling=p;const y=A=>{q.on(z.CloseSurveyOnOverlayClick,A)},C=Object.assign({frame:m,envId:window.UserLeap.envId,surveyId:s,userId:l,visitorAttributes:{externalUserId:window.UserLeap.userId,email:window.UserLeap.email},cards:o,context:t,locale:r,fontFamily:window.UserLeap.fontFamily,fontFamilyURL:window.UserLeap.fontFamilyURL,apiURL:window.UserLeap._API_URL,responseGroupUid:a,headers:d,endCard:n,useMobileStyling:p,mobileSDKVersion:window.UserLeap.mobileSDKVersion,configureExitOnOverlayClick:y,eventEmitFn:q.emit.bind(q),ulEvents:Ta,viewDocument:_==null?void 0:_.document,viewWindow:_,tabTitle:document.title,startingQuestionIdx:(T=window.UserLeap.config)==null?void 0:T.startingQuestionIdx,styleNonce:window.UserLeap.styleNonce,previewKey:(O=window.UserLeap)!=null&&O.localStorageAvailable?(k=window.localStorage)==null?void 0:k.getItem(Be.Preview):null},window.UserLeap._config);(N=window.UserLeap.config)!=null&&N.startingQuestionIdx&&(window.UserLeap.config={...window.UserLeap.config,startingQuestionIdx:null}),window.UserLeap.customStyles&&(C.customStyles=window.UserLeap.customStyles),_&&(_.__cfg=C);function S(){const A=document.createElement("script");return window.UserLeap.nonce&&A.setAttribute("nonce",window.UserLeap.nonce),A.id=gu,A}const E=window.UserLeap.viewSDKURL?window.UserLeap.viewSDKURL:C.path,I=document.getElementById(gu);I&&I.remove();const x=S(),R=()=>{window.UserLeap.container&&Object.assign(window.UserLeap.container.style,{display:"flex"})};return C.installationMethod===on.Npm?(Ab.configure(C),v&&window.UserLeap.container&&R()):E&&(x.src=E,v&&x.addEventListener("load",()=>{window.UserLeap.container&&R()}),_==null||_.addEventListener("error",A=>{A.target instanceof HTMLScriptElement&&A.target.src===E&&window.UserLeap.reportError("loadFrameScript",new Error("Frame script failed to load"))},{capture:!0,once:!0})),g==null||g.appendChild(x),{success:!0,surveyState:"ready"}};function Qb(e){if(window.UserLeap.useMobileStyling!==void 0)return window.UserLeap.useMobileStyling;const t=window.UserLeap.windowDimensions&&window.UserLeap.windowDimensions.width||document.body.clientWidth;return Ss(e)||t>10&&t<em}function Ss(e){return Kb.includes(e[st.Platform])}function Xb(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 Jb(e){if(!e)return;window.UserLeap._config=e,e.mute&&window.UserLeap._queue.pause();const{interactiveEvents:t,pageUrlEvents:n,dismissOnPageChange:r}=e;t&&Xb(t),(t||n||r)&&(Yb(),br())}async function Ut(e,t,n=0,r=!1){var o,a;t.headers=Object.assign(Ir(window.UserLeap),t.headers);const i=await ct(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(st.VisitorID);u&&c&&(c!==window.UserLeap.visitorId||window.UserLeap.token!==u)&&(Ve("token",u),Ve("vid",c),q.emit(z.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 ew(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 hi(e.json.delay),window.UserLeap.delayingSurvey=!1),n)}const tw=function(e){if(!window.UserLeap)return;const t=async(r={})=>{var m,g,_,v,b;const{userId:i,anonymousId:o,metadata:a={},properties:s,showSurveyCallback:l}=r;let{eventName:u}=r;if(window.UserLeap.debugMode&&u!==xa&&console.info("[DEBUG] Sprig track",r),e.mode==="test")return;const c=window.UserLeap.localStorageAvailable&&(m=localStorage.getItem(Be.Preview))!=null?m:void 0;if(e.requireUserIdForTracking&&!window.UserLeap.userId&&!i){const y="[Sprig] - Skipping tracking without userId";return console.warn(y),{success:!1,message:y,surveyState:"no survey"}}if(!u||u.trim().length===0){u=u?String(u):"";const y="[Sprig] - Invalid event name "+u;return console.warn(y),{success:!1,message:y,surveyState:"no survey"}}const d=window.location.href;if(a.url||(a.url=d),Ve("trackStartUrl",d),(_=(g=window.UserLeap)==null?void 0:g._config)!=null&&_.optimizelyEnabled){const y=Ir(window.UserLeap);Ss(y)||ui.getAndSetWebOptimizelyExperiments(),a.optimizelyExperiments=Object.assign({},ui.getAllOptimizelyExperiments())}(b=(v=window.UserLeap)==null?void 0:v._config)!=null&&b.launchDarklyEnabled&&(a.launchDarklyFlags=ka.getAllLaunchDarklyVariations()),i&&(window.UserLeap.userId=i),o&&(window.UserLeap.partnerAnonymousId=o),s&&(a.eventProperties=s),jy({name:u});const f=window.UserLeap.delayingSurvey?await Ut(lt("1",[Zt],"events/batch"),{body:JSON.stringify({events:[{event:u,metadata:a}],previewKey:c}),method:"POST"},0,!0):await Ut(lt("1",[Zt],"events"),{body:JSON.stringify({event:u,metadata:a,previewKey:c}),method:"POST"},0,!0);if(!f.ok){const y="[Sprig] (ERR-421) Failed to track event";return f.reportError&&(console.warn(y,f.error),f.error&&window.UserLeap.reportError("track",f.error)),{success:!1,message:y,error:f.error,surveyState:"no survey"}}i&&Ve("uid",i),o&&Ve("aid",o);const p=f.json;return p.invalidPreviewKey&&window.UserLeap.localStorageAvailable&&localStorage.removeItem(Be.Preview),await ew(f,l)?Gb(p.eventId,d)?$f(p):{success:!1,message:"Study should not be displayed after page navigation",surveyState:"no survey"}:{success:!1,message:"[Sprig] Callback returned false, aborting rendering of survey",surveyState:"no survey"}},n={async displaySurvey(r){return console.warn("[Sprig] displaySurvey should only be used to debug your studies; not intended for production usage."),window.UserLeap("dismissActiveSurvey",ut.Override),Lo({surveyId:r},!0)},_previewSurvey(r){window.UserLeap("dismissActiveSurvey",ut.Override),Lo({surveyTemplateId:r},!1)},_reviewSurvey(r){window.UserLeap("dismissActiveSurvey",ut.Override),Lo({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=ut.API){q.emit(z.SurveyWillClose,{name:z.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,Zn)&&(a[Zn]=a.email,delete a.email),l=await Ut(lt("1",[Vt,Zt],"attributes"),{body:JSON.stringify(a),method:"PUT"}),!l.ok&&l.reportError&&(console.warn("[Sprig] (ERR-432) identifyAndSetAttributes failed",l.error),l.error&&window.UserLeap.reportError("identifyAndSetAttributes",l.error))):l=await Ut(lt("1",[Vt,Zt]),{body:JSON.stringify(s),method:"PUT"}),a&&a[Zn]&&(window.UserLeap.email=a[Zn]),l.ok&&(i&&Ve("uid",i),o&&Ve("aid",o)),{success:!!l.ok}},async removeAttributes(r){if(window.UserLeap.debugMode&&console.info("[DEBUG] Sprig removeAttributes",r),e.mode==="test")return;if(r==null||r.length===0){const o="[Sprig] - Disregarding empty attributes provided";return console.warn(o),{success:!1,message:o}}if(e.requireUserIdForTracking&&!window.UserLeap.userId){const o="[Sprig] - Skipping tracking without userId";return console.warn(o),{success:!1,message:o}}const i=await Ut(lt("1",[Vt,Zt],"attributes"),{body:JSON.stringify({delete:r}),method:"DELETE"});return!i.ok&&i.reportError&&(console.warn("[Sprig] (ERR-433) Remove attributes failed",i.error),i.error&&window.UserLeap.reportError("removeAttributes",i.error)),{success:!!i.ok}},async addSurveyListener(r){q.on(z.SurveyLifeCycle,r)},async removeSurveyListener(r){q.removeListener(z.SurveyLifeCycle,r)},async addListener(r,i){q.on(r,i)},async removeListener(r,i){q.removeListener(r,i)},async removeAllListeners(){q.removeAllListeners()},setPreviewKey(r){if(!r||typeof r!="string")return;const i=Gf();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 Ut(lt("1",[Vt,Zt]),{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&&Sl(),Ve("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,Ve("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){qf(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(L.CustomStyle);o?o.textContent=r:Mu(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(Fu(s.contentDocument))+"px")),q.emit(z.SurveyDimensions,{name:z.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(),Wf(),Sl(),window.UserLeap._queue.unpause()},teardown(){$b(),window.UserLeap("dismissActiveSurvey",ut.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;ui.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($h.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}ka.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(Zn,r)},async setVisitorEmail(r){return console.warn("[Sprig] setVisitorEmail is deprecated. Please use setEmail"),n.setEmail(r)}};Object.assign(window.UserLeap,n)};async function nw(e){const t=Ir(window.UserLeap);let n=await ct(lt("1",[Vt],"config"),{headers:t});const r="TypeError";if(window.UserLeap.error=n.error,!n.ok&&n.error&&n.error.name===r&&(window.UserLeap._API_URL="https://api.sprig.com",window.UserLeap.reportError("sprigDomainRequest",n.error),n=await ct(lt("1",[Vt],"config"),{headers:t})),!n.ok)return n.reportError&&(console.warn("[Sprig] (ERR-422) Failed to load configuration",n.error),n.error&&window.UserLeap.reportError("applyRemoteConfig",n.error)),Po("Disabled: failed to fetch configuration"),e;const i=n.json;return i!=null&&i.disabled?(Po(`Disabled: ${i.disabled}`),{disabled:i.disabled}):Object.assign({},i,e)}async function rw(e,t,n={}){const r=window.__cfg&&window.__cfg.mode,i=Es(),o=window.UserLeap.envId,a=window.document.documentElement,s={mode:r,screenWidth:window.screen.width,screenHeight:window.screen.height,clientWidth:a.clientWidth,clientHeight:a.clientHeight,location:window.location.href,language:window.navigator.language,...n},l={action:e,err:{message:t.message,stack:t.stack},meta:s,vid:i,envId:o};(await Ut(lt("1",null,"errors"),{method:"POST",headers:{[st.Error]:window.btoa(`userleap-${Date.now()}-error`)},body:JSON.stringify(l)},0,!0)).ok||console.warn("[Sprig] (ERR-444) Failed to report error to API",t)}function iw(e={}){var i;const t=(i=new URLSearchParams(window.location.search).get("sprigPreviewKey"))!=null?i:"",n=Gf();window.UserLeap.localStorageAvailable=n,window.UserLeap.UPDATES=Ta,window.UserLeap("setPreviewKey",t);async function r(){if(window.UserLeap.loaded)return;if(window.UserLeap.reportError=rw,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=Yt("sampled");if(u===null&&(u=Math.random()<o,Ve("sampled",u)),!u)return}else n&&Yt("sampled")!==null&&Ve("sampled",null);window.UserLeap._API_URL||(window.UserLeap._API_URL="https://api.sprig.com");const a=[...window.UserLeap._queue];window.UserLeap._queue=new jb(window.UserLeap,[]),window.UserLeap._queue.pause();for(let u=0;u<a.length;u++)window.UserLeap._queue.push(a[u]);const s=Yt("token");s?(window.UserLeap.token=s,window.UserLeap.visitorId=Yt("vid"),window.UserLeap.userId=Yt("uid"),window.UserLeap.partnerAnonymousId=Yt("aid")):(window.UserLeap.localStorageAvailable&&localStorage.removeItem(Be.Credentials),Wf());const l=await nw(e);Ay(l.maxReplayDurationSeconds,window.UserLeap.maxInflightReplayRequests,l.replaySettings),tw(l),await Jb(l),window.UserLeap._queue.unpause(),q.emit(z.SDKReady),q.emit(z.VisitorIDUpdated,{visitorId:window.UserLeap.visitorId})}document.readyState==="complete"?r():window.attachEvent?window.attachEvent("onload",r):window.addEventListener("load",r,!1)}class Ui{constructor(){xe(this,"UPDATES",Ta)}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 Aa={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=on.Npm,window.Sprig)return window.Sprig;window.Sprig=function(){window.Sprig._queue.push(arguments)},Object.getOwnPropertyNames(Ui.prototype).map(n=>{n!=="constructor"&&(window.Sprig[n]=Ui.prototype[n])});const t=window.Sprig;return t.appId=e.envId,t._queue=[],window.UserLeap=t,iw(e),window.Sprig}},ow={sprig:Aa,SprigAPI:Ui,configure:Aa.configure};exports.DismissReason=ut;exports.SprigAPI=Ui;exports.SprigEvent=z;exports.default=ow;exports.sprig=Aa;
703
+ `,Vm=e=>{const t=M.document.createElement("div");return t.className="ul-video-player-loading",t.id=aa(e),["first","second","third","fourth"].map(n=>{const r=M.document.createElement("div");r.className=n,t.appendChild(r)}),t},aa=e=>e+"-loading-spiner",oe="hidden",ks=".m3u8",_i="questionId",wi="ul-video-recorder-camera-off-button",bi="ul-recording-in-session",jm=[{type:"link",content:`${Lt}/dependencies/videojs-record-4.5.0.min.css`},{type:"script",content:`${Lt}/dependencies/RecordRTC-5.6.2.js`},{type:"script",content:`${Lt}/dependencies/adapter.8.0.0.min.js`},{type:"script",content:`${Lt}/dependencies/videojs-record-4.5.0.min.js`},{type:"script",content:`${Lt}/userleap-web-upchunk-v2.2.2.js`}],ac=[{type:"link",content:`${Lt}/dependencies/video-js-7.18.0.min.css`},{type:"script",content:`${Lt}/dependencies/video-js-7.18.0.min.js`},{type:"style",content:Mm}],sc="-video-player",lc="-secondary-video-player",uc="-video-recorder";let Be,Ts;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)},tt=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)},Bm=(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(Bm(M.document.head,r)),n),[])).then(()=>{M.videojs=M.document.defaultView.videojs,t&&t()}).catch(function(n){console.log(n+" failed to load")})},Ls=(e,t,n)=>{if(t==="start"&&(e.style.visibility="visible"),t==="none")e.style.visibility=oe;else if(t==="success")e.style.visibility=oe,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%)`}},Ei=(e,t)=>{const n=M.videojs(e.id());return n==null?void 0:n.payload[t]},Fm=(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(K.ERROR,{type:K.PERMISSION_DENIED}),pt({event:"Video Permission Denied",apiBase:t,headers:i,visitorId:s,envId:l,metadata:{questionId:Ei(e,_i),responseGroupUid:a,surveyId:o}})):(n&&n(K.ERROR,{type:K.OTHER}),tt(new Error(e.deviceErrorCode.message),"recorderDeviceError",t,i,s,l))}),e.on("error",function(u,c){tt(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:Ei(e,_i),responseGroupUid:a,surveyId:o}})}),e.on("finishRecord",async function(){r(e.uploadProgressLabel,"start",0);const u=Ei(e,_i);if(!o){const v="internal error: missing fields in payload";return n&&n(K.ERROR,{type:K.OTHER}),tt(new Error(v),"finishRecord",t,i,s,l),null}e.record().stopDevice();const c=e.cameraOff?K.MEDIA_TYPE_AUDIO:K.MEDIA_TYPE_VIDEO,f=gt();pt({event:"Video Record Finish",apiBase:t,headers:i,visitorId:s,envId:l,metadata:{mediaRecordingUid:f,questionId:u,responseGroupUid:a,surveyId:o,mediaType:c}});const d={surveyId:o,updatedAt:new Date().toISOString(),mediaType:c,mediaRecordingUid:f};u&&(d.questionId=u),a&&(d.responseGroupUid=a),s&&(d.visitorId=s);const h=await(async()=>{const v=await fetch(`${t}/2/environments/integrations/upload`,{method:"POST",cache:"no-cache",headers:{"Content-Type":"application/json"},body:JSON.stringify(d)});if(v.ok){const m=await v.json();return n&&n(K.UPLOAD_STARTED,{[K.UPLOAD_ID]:m.upload.id,[K.MEDIA_TYPE]:c,[K.MEDIA_RECORDING_UID]:f}),m.upload.url}else return n&&n(K.ERROR,{type:K.OTHER,response:v}),tt(new Error("failed to get upload response with url"),"finishRecord",t,i,s,l),null})();!h||(Be=M.document.defaultView.UpChunk.createUpload({endpoint:h,file:new M.document.defaultView.File([e.recordedData],`recording ${c} ${Date.now()}`),chunkSize:5120}),Be.startTime=Date.now(),pt({event:"Video Upload Start",apiBase:t,headers:i,visitorId:s,envId:l,metadata:{mediaRecordingUid:f,questionId:u,responseGroupUid:a,surveyId:o,mediaType:c,url:h}}),Be.on("error",v=>{r(e.uploadProgressLabel,"none"),n&&n(K.UPLOAD_FINISHED,{[K.MEDIA_RECORDING_UID]:f}),tt(v,"finishRecord",t,i,s,l)}),Be.on("progress",v=>{n&&n(K.UPLOAD_PROGRESS,{[K.MEDIA_RECORDING_UID]:f,[K.UPLOAD_PROGRESS_PCT]:v.detail}),r(e.uploadProgressLabel,"progress",v.detail)}),Be.on("success",()=>{r(e.uploadProgressLabel,"success"),n&&n(K.UPLOAD_FINISHED,{[K.MEDIA_RECORDING_UID]:f}),pt({event:"Video Upload Success",apiBase:t,headers:i,visitorId:s,envId:l,metadata:{mediaRecordingUid:f,questionId:u,responseGroupUid:a,surveyId:o,mediaType:c,url:h,elapsedMs:Be.startTime&&Date.now()-Be.startTime}})}))})},dc=(e,t)=>{const n=new(M.videojs.getComponent("Component"))(e);return n.addClass("ul-buttons-panel"),t.map(r=>{n.addChild(r)}),Hm(n),n},Hm=e=>{e.children().forEach(t=>{if(Re[t.name_]){const n=wr(Re[t.name_],`ul-${Re[t.name_]}`);t.el_.appendChild(n)}})},wr=(e,t="")=>{const n=M.document.createElement("span");return n.className="ul-button-text",n.innerHTML=e,n.id=t,n},fc=(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?Qm(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&&qm(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)},Km=(e,t,n)=>{e.addClass(`ul${lc}`);const r=new(M.videojs.getComponent("Component"))(e);t&&e.src(t),e.addChild(r),n&&n(e)},$m=(e,t,n,r,i,o,a,s=!1)=>{Ts=Date.now();const u=Fr(t,{controls:!1,bigPlayButton:!1,fluid:!1,width:1280,height:720,playsinline:!0,plugins:{record:{audio:!0,video:{mandatory:{minWidth:1280,minHeight:720}},frameWidth:1280,frameHeight:720,maxLength:600,autoMuteDevice:!0}}});if(!u)return;u.payload=n;const{surveyId:c,questionId:f,responseGroupUid:d,visitorId:p,envId:h}=n;let v;const m=T=>{const D=wi,S=wi+"-audio-only";Ls(u.uploadProgressLabel,"none"),Be&&Be.startTime>=Ts&&Be.abort();const V=M.document.getElementById("ul-camera-button");T?(u.children()[0].classList.add("vjs-hidden"),w.removeClass(D),w.addClass(S),V.innerHTML=Re.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(H=>{H.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(),w.removeClass(S),w.addClass(D),V.innerHTML=Re.TurnOffCamera,u.audioPlayerPlaceholder.addClass("vjs-hidden"))},_=new(M.videojs.getComponent("Button"))(u,{clickHandler:()=>{_.hasClass(oe)||(pt({event:"Video Delete Button Clicked",apiBase:r,headers:a,visitorId:p,envId:h,metadata:{questionId:f,responseGroupUid:d,surveyId:c}}),m(u.cameraOff),i(K.DELETE,{}),w.removeClass(oe),_.addClass(oe))}});_.addClass("ul-video-recorder-delete-button"),_.el_.appendChild(wr(Re.DeleteButton,"ul-delete-button"));const y=M.document.getElementById(t),E=()=>{y.classList.contains("vjs-fullscreen")&&u.cameraOff?y.style.display="table":y.style.display="flex"};E();const w=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:f,responseGroupUid:d,surveyId:c,cameraOff:u.cameraOff}}),m(u.cameraOff),!_.hasClass(oe)&&_.addClass(oe),i(K.DELETE,{}),E())}});w.addClass(wi),w.el_.appendChild(wr(Re.TurnOffCamera,"ul-camera-button"));const b=new(M.videojs.getComponent("Button"))(u,{clickHandler:()=>{const T=M.document.getElementById("ul-recorder-toggle");if(u.record().isRecording())u.record().stop(),T&&(T.innerHTML=Re.RecordButton),b.removeClass(bi),_.removeClass(oe);else{const D=M.document.getElementById("ul-recording-countdown-screen");if(D)D.remove(),T&&(T.innerHTML=Re.RecordButton),m(u.cameraOff),i(K.DELETE,{}),w.removeClass(oe),_.addClass(oe),b.removeClass(bi),I.show();else{b.addClass(bi),I.hide(),w.addClass(oe),_.addClass(oe),T&&(T.innerHTML=Re.StopButton);const S=M.document.createElement("div");S.id="ul-recording-countdown-screen",y.insertBefore(S,y.children[1]),S.style.height=`${y.offsetHeight}px`,pc(u,3)}}}});b.addClass("ul-video-recorder-toggle-button"),b.el_.appendChild(wr(Re.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 C=dc(u,[_,w,"PlayToggle",b,"FullscreenToggle"]),I=C.children().find(T=>T.name_==="FullscreenToggle");I.hasClass("vjs-disabled")&&I.hide();const k=C.children().find(T=>T.name_==="PlayToggle");k.hide(),o&&w.addClass(oe),!o&&_.addClass(oe),fc(u,C,o,!1,s),u.on("stopRecord",()=>{b.hide(),k.show(),I.show(),_.removeClass(oe)}),u.on("deviceReady",()=>{b.show(),k.hide(),_.addClass(oe)}),Fm(u,r,i,Ls,a),o&&(u.deviceButton&&u.deviceButton.hide(),u.src(o),k.show(),b.hide(),_.removeClass(oe));const L=[{name:"microphone"}];!u.cameraOff&&L.push({name:"camera"}),Promise.all(L.map(T=>{var D;return(D=navigator==null?void 0:navigator.permissions)==null?void 0:D.query(T)})).then(T=>{T.reduce((S,V)=>S&V.state==="granted",!0)&&u&&(u.deviceButton&&u.deviceButton.hide(),!o&&u.record().getDevice())}).catch(T=>{})},pc=(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(()=>{pc(e,t-1)},1e3))},hc=e=>{const t=M.document.createElement("div");return t.className="ul-video-container",t.appendChild(Vm(e)),t},fo=(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},qm=(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%")},Fr=(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),Gm=(e,t,n,r=!1,i="https://api.sprig.com",o=document,a=null,s=null)=>{M.document=o;const l=e+sc,u=hc(l);return M.document.addEventListener("securitypolicyviolation",c=>{tt(new Error(`Voice & Video feature violates ${c.violatedDirective} web page CSP policies for the question player.`),"playerDeviceError",i,{})}),cc(ac,()=>{M.document.getElementById(aa(l)).remove(),fo(l,u);const c={playsinline:!0,playbackRates:[.5,1,1.5,2],fill:!0};try{const f=e+lc;fo(f,u);const d=Fr(l,c),p=Fr(f,{muted:!0,...c});if(!d||!p)return;Km(p,a,s),a||p.addClass(oe);const h=dc(d,["PlaybackRateMenuButton","PlayToggle","FullscreenToggle"]),v=h.children().find(m=>m.name_==="FullscreenToggle");v.hasClass("vjs-disabled")&&v.hide(),fc(d,h,t,n,r,p)}catch(f){tt(new Error(`Error when creating video player object ${f}`),"playerDeviceError",i,{});return}}),u},zm=(e,t={},n="https://api.userleap.com",r,i,o,a=!1,s=document)=>{M.document=s;const l=e+uc,u=hc(l);return M.document.addEventListener("securitypolicyviolation",c=>{tt(new Error(`Voice & Video feature violates ${c.violatedDirective} web page CSP policies for the recorder player.`),"recorderDeviceError",n,o,t.visitorId,t.envId)}),cc(ac.concat(jm),()=>{fo(l,u),M.document.getElementById(aa(l)).remove();try{$m(u,l,t,n,r,i,o,a)}catch(c){tt(new Error(`Error when creating video recorder player object ${c}`),"recorderDeviceError",n,o,t.visitorId,t.envId);return}}),u},Wm=e=>{const t=e+uc;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()}},Ym=e=>{const t=Fr(e+sc);t==null||t.pause()},Qm=e=>{if(!e)return null;const t=e.match(/https:\/\/stream.mux.com\/(.*)/);let n=t?t[1]:null;return n.includes(ks)&&(n=n.replace(ks,"")),n?`https://image.mux.com/${n}/thumbnail.jpg?time=0`:null},K={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"},Re={PlaybackRateMenuButton:"Speed",PlayToggle:"Play",FullscreenToggle:"Expand",TurnOnCamera:"Turn on",TurnOffCamera:"Turn off",DeleteButton:"Delete",RecordButton:"Record",StopButton:"Stop",PauseButton:"Pause"},gn="ul-card-video__player_recorder",Zm="ul-card-video__skip_button",Xm="ul-video-interview-form",As="ul-video-btn",Jm=({className:e,message:t,next:n,properties:r,questionId:i,type:o})=>{const{apiURL:a,envId:s,handleUploadUpdate:l,headers:u,responseGroupUid:c,surveyId:f,viewDocument:d,visitorId:p}=J(S=>({apiURL:S.apiURL,envId:S.envId,handleUploadUpdate:S.handleUploadUpdate,headers:S.headers,responseGroupUid:S.responseGroupUid,surveyId:S.surveyId,viewDocument:S.viewDocument,visitorId:S.userId})),[h,v]=le(!1),[m,_]=le(null),[y,E]=le(null),[w,b]=le(0),x=u["userleap-platform"],C=r&&r.videoUrl,I=(S,V)=>{S===K.UPLOAD_STARTED?(_(V[K.UPLOAD_ID]),E(V[K.MEDIA_RECORDING_UID]),v(!0)):S===K.DELETE?(_(null),E(null),v(!1)):S===K.UPLOAD_PROGRESS?isNaN(V[K.UPLOAD_PROGRESS_PCT])?l({mediaRecordingUid:V[K.MEDIA_RECORDING_UID],isComplete:!0}):l({mediaRecordingUid:V[K.MEDIA_RECORDING_UID],progressPct:V[K.UPLOAD_PROGRESS_PCT]}):S===K.UPLOAD_FINISHED&&l({mediaRecordingUid:V[K.MEDIA_RECORDING_UID],isComplete:!0})},k=S=>{if(S&&S.children.length===0){const V=Gm(gn,{src:C,type:"application/x-mpegURL"},void 0,r.mediaType===K.MEDIA_TYPE_AUDIO,a,d);S.appendChild(V)}},L=S=>{if(S&&S.children.length===0){const V=zm(gn,{surveyId:f,responseGroupUid:c,questionId:i,visitorId:p,envId:s},a,I,void 0,{...u,"x-ul-video-recorder-origin":"sdk"},r.mediaType===K.MEDIA_TYPE_AUDIO,d);S.appendChild(V)}},T=S=>{S.preventDefault(),S.stopPropagation(),Wm(gn),m&&y?(l({mediaRecordingUid:y,isSubmitted:!0}),n({value:{mediaRecordingUid:y},questionId:i,type:o})):n({value:null,questionId:i,type:o})},D=()=>g(St,{defaultBody:()=>g("button",{className:`${As} ul-record-response-btn`,onClick:S=>{S.preventDefault(),S.stopPropagation(),Ym(gn),b(1)}}),properties:r});return g("div",{className:B(Ge(R.CardMainContent,x)),style:{marginTop:"unset"},children:g("form",{className:B([e,R.VideoCard,R.FadeInTransition]),id:Xm,children:[g(We,{message:t,properties:r}),g("div",{id:"ul-card-voice__video",children:[g("div",{children:[g("div",{id:"ul-question-player-container",style:{display:w===0?"":"none"},children:[g("div",{id:gn,ref:k}),D()]}),g("div",{style:{display:w===1?"block":"none"},children:[g("button",{className:`${As} ul-back-question-btn`,onClick:S=>{S.preventDefault(),S.stopPropagation(),b(0)}}),g("div",{id:"ul-recorder-player-container",ref:L})]})]}),g(Ee,{disabled:!h,onClick:T,children:vn(r)}),g("button",{className:`ul-card-text__button ${R.InactiveButton} ${R.SkipButton}`,id:Zm,onClick:T,style:{display:r.required?"none":"block",...h?{display:"none"}:{}},children:ra(r)})]})]})})},eg=({className:e})=>{const{headers:t,uploadProgress:n}=J(a=>({headers:a.headers,uploadProgress:a.uploadProgress}));let r,i;Object.values(n).filter(a=>a.isSubmitted).length>1?(r="Your responses are processing",i="Please keep this tab open until your responses are fully processed."):(r="Your response is processing",i="Please keep this tab open until your response is fully processed.");const o=Math.round(Math.min(99,...Object.values(n).filter(a=>a.isSubmitted).map(a=>a.progressPct)));return g("div",{className:B(Ge(R.CardMainContent,t["userleap-platform"])),children:g("div",{className:B([e,"ul-card--uploading",R.FadeInTransition]),children:[g("div",{"aria-busy":"true","aria-label":"Processing...","aria-live":"polite",className:R.LoadingSpinnerContainer,role:"progressbar",children:g("div",{className:R.LoadingSpinner,children:[g("div",{className:R.LoadingSpinnerFirst}),g("div",{className:R.LoadingSpinnerSecond}),g("div",{className:R.LoadingSpinnerThird}),g("div",{className:R.LoadingSpinnerFourth})]})}),g(We,{message:`${r} (${o}% complete)`}),g("p",{className:R.Caption,children:i})]})})},Rs=({logoOnly:e=!1,style:t={}})=>g("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&&g("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"}),g("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"}),g("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"}),g("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"}),g("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"}),g("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"})]}),tg=()=>{const{border:e,cards:t,forceBrandedLogo:n,headers:r,index:i,marketingUrl:o,showSurveyBrand:a,slugName:s,surveyId:l,viewedCardCount:u}=J(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=bt(null),f=t.filter(E=>E.type!==A.Uploading&&E.type!==A.Thanks),d=im(t,i),p=u+1,h=p/(p+d),v=`${o}?utm_source=survey_branding&utm_medium=website&utm_campaign=${s}&utm_content=${l}${n&&"&utm_term=poweredby_pill"}`;ke(()=>{c.current&&(c.current.style.width=`${h*100}%`)},[h]);const m=()=>g(Le,{children:[f.length>1&&g("div",{id:"ul-progress-bar-container",children:g("div",{id:"ul-progress-bar-current",ref:c,style:{border:`1px solid ${e||"#000"}`}})}),a?g("div",{className:n?"yellow-footer-logo":"",style:{marginTop:"4px"},children:g("a",{href:v,rel:"noreferrer",target:"_blank",children:g("div",{style:{display:"flex"},children:[g(Rs,{logoOnly:!1}),n&&g(Us,{style:{display:"block",margin:"auto 0 auto 4px",transform:"rotateY(0deg) rotate(-45deg)"}})]})})}):null]}),_=()=>g("a",{href:v,rel:"noreferrer",target:"_blank",children:g("div",{className:"thank-you-card-link",children:[g("div",{className:"sprig-box-logo",children:g(Rs,{logoOnly:!0,style:{margin:"auto"}})}),g("div",{children:g("p",{children:["Capture insights about your own product",g(Us,{style:{margin:"auto 0 auto 4px",display:"inline-flex"}})]})})]})}),y=t[i].type===A.Thanks;return g("footer",{className:`ul-footer ${r["userleap-platform"]==="link"?"ul-footer__link":""}`,style:a?{}:{marginBottom:"10px"},children:y&&n?_():m()})},Us=({style:e})=>g("svg",{width:"12",height:"10",viewBox:"0 0 12 10",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:e,children:[g("path",{d:"M1.47839 5.2085L10.9384 5.2085",stroke:"black",strokeWidth:"1.35",strokeLinecap:"round",strokeLinejoin:"round"}),g("path",{d:"M7.0686 1.15845L10.9386 5.20845L7.0686 9.25845",stroke:"black",strokeWidth:"1.35",strokeLinecap:"round",strokeLinejoin:"round"})]}),ng=()=>{const{answers:e,border:t,cards:n,close:r,configureExitOnOverlayClick:i,destroy:o,endCard:a,eventEmitFn:s,fontFamily:l,headers:u,index:c,next:f,showStripes:d,update:p,useMobileStyling:h,viewDocument:v}=J(S=>({answers:S.answers,border:S.border,cards:S.cards,close:S.close,configureExitOnOverlayClick:S.configureExitOnOverlayClick,destroy:S.destroy,endCard:S.endCard,eventEmitFn:S.eventEmitFn,fontFamily:S.fontFamily,headers:S.headers,index:S.index,next:S.next,showStripes:S.showStripes,update:S.update,useMobileStyling:S.useMobileStyling,viewDocument:S.viewDocument})),m=bt(null),_=bt(!1),{props:y,type:E,name:w}=n[c],b=n.length;ke(()=>{m.current&&(m.current.classList.contains("ul-app--visible")||m.current.classList.add("ul-app--visible"),!_.current&&s&&(_.current=!0,s(F.SurveyAppeared)))},[s]),ke(()=>{p()},[c,p]),ke(()=>{i(()=>r())},[r,i]);const x=()=>r(Yt),C=S=>{S.key==="Enter"&&x()},I=async function(S){f({data:S,completeSurvey:()=>{o(Yt)},endCard:a}),Bf(v)};if(e){for(const S of e)if(S.questionId===w){let V;if(E===A.MultipleChoice){const O=y.options.find(({value:H})=>H===S.value);if(!O)break;V={[O.id]:O.value}}else V=S.value;I({value:V,type:E,questionId:S.questionId});break}}const k=()=>[Nt.Email,Nt.Link].includes(u["userleap-platform"])?!1:!a||c+1!==b,L=()=>h?{borderColor:t}:{borderColor:t,margin:"15px"},T=()=>{const S={className:"ul-card",next:I,questionId:w,type:E};switch(E){case A.ConsentLegal:return ee(vm,{...S,...y,key:w});case A.Likert:return ee(gm,{...S,...y,key:w});case A.MultipleChoice:return ee(ym,{...S,...y,key:w});case A.MultipleSelect:return ee(_m,{...S,...y,key:w});case A.NPS:return ee(wm,{...S,key:w,props:y});case A.Open:return ee(bm,{...S,...y,key:w});case A.RecordedTask:return ee(Um,{...S,...y,key:w});case A.TextUrlPrompt:return ee(Pm,{...S,...y,key:w});case A.Thanks:return ee(Nm,{...S,...y,key:w});case A.Uploading:return ee(eg,{...S,...y,key:w});case A.VideoVoice:return ee(Jm,{...S,...y,key:w});default:return null}},D=S=>{var ue;const V=window.sprigAPI,O=S.target;if(!V||!O)return;const H=[O,O.parentElement];for(const ge of H)if(((ue=ge==null?void 0:ge.tagName)==null?void 0:ue.toLowerCase())==="a"){S.preventDefault(),V==null||V.openUrl(ge.href);return}};return g("div",{className:B("ul-app",Qt(u)?"ul-app--visible":"ul-app--overlay"),id:Yt,onClick:D,ref:m,style:{"--theme":t,...l?{fontFamily:l.replace(";","")}:{}},children:g("div",{className:"ul-app__container",children:[g("div",{className:B(re(R.CardContainer,h)),style:L(),children:[d&&g("div",{className:"ul-header__container",children:g("div",{className:"ul-header",children:"For development purposes only"})}),T(),g(tg,{})]}),k()&&g("div",{className:B(re(R.CloseContainer,h)),children:g("div",{"aria-label":"Close button",className:R.CloseButton,onClick:x,onKeyPress:C,role:"button",tabIndex:0,children:g("svg",{fill:"none",height:"18px",viewBox:"0 0 13 13",width:"18px",xmlns:"http://www.w3.org/2000/svg",children:g("path",{d:"M2.54964 1.78369L1.78369 2.54964L5.73405 6.5L1.78369 10.4504L2.54964 11.2163L6.5 7.26595L10.4504 11.2163L11.2163 10.4504L7.26595 6.5L11.2163 2.54964L10.4504 1.78369L6.5 5.73405L2.54964 1.78369Z",fill:"#262136"})})})})]})})},rg=`html,body,p,ol,ul,li,dl,dt,dd,blockquote,figure,fieldset,legend,textarea,pre,iframe,hr,h1,h2,h3,h4,h5,h6{margin:0;padding:0}h1,h2,h3,h4,h5,h6{font-size:100%;font-weight:400}button,input,select,textarea{margin:0}html{box-sizing:border-box}*,*:before,*:after{box-sizing:inherit}.ul-card{flex:1 1 auto;border-radius:2px;display:flex;flex-direction:column;font-size:17px;line-height:19px;text-align:left;margin:auto}.ul-card__container--desktop{border:2px solid #fff;box-shadow:0 0 15px #00000026}.ul-card__container--mobile{border-width:0;box-shadow:0 0 5px #00000040;margin-top:5px}.ul-card__container{background:#ffffff;border-radius:6px;display:flex;flex-direction:column;flex-grow:1;flex:1 1 auto;font-size:17px;line-height:23px;overflow:auto;padding:20px 20px 5px;position:relative;text-align:center;word-break:break-word}.ul-card-vertical__button-wrapper{flex-direction:column;align-items:center}.ul-card__button-wrapper{margin-top:4px;margin-bottom:3px;display:flex;gap:16px;justify-content:center}.ul-rich-text-body{min-height:2em}.ul-rich-text-body,.ul-rich-text-body p{margin-top:10px;margin-bottom:10px}.ul-rich-text-body li{margin:5px 0 5px 20px}.ul-rich-text-body p,.ul-rich-text-body li{font-size:15px;line-height:130.35%;letter-spacing:.02em;color:#343442;text-align:left;white-space:pre-line}.ul-rich-text-body:last-child,.ul-rich-text-body li:last-child{margin-bottom:15px}.ul-card-main-content__link,.ul-card-main-content__email{flex-grow:55;display:flex}.ul-card-main-content__web,.ul-card-main-content__android,.ul-card-main-content__ios{padding-top:15px;margin-bottom:5px}.ul-question{color:#343442;display:block;font-size:20px;line-height:125%;font-weight:500;cursor:default;text-align:left}.ul-caption{flex:1 0 auto;margin-top:8px;margin-bottom:15px;font-size:15px;line-height:130.35%;letter-spacing:.02em;color:#6c6c6e;text-align:left}.ul-card__choices{margin:5px 0 0;flex:1 0}.choice--mobile{border:2px solid #e6e6e6}.choice--desktop{border:1px solid #e6e6e6}.choice{align-items:flex-start;color:#262136;cursor:pointer;display:flex;justify-content:flex-start;flex-direction:column;box-sizing:border-box;border-radius:3px;margin-bottom:7px;font-size:15px;line-height:20px;padding:10px 20px 10px 15px;background-color:#00000003}.choice--desktop:hover,.choice--desktop:active,.choice--mobile:active{background-color:#0000000d}.choice-label-container{display:flex;flex-direction:row;justify-content:flex-start;align-items:center;width:100%;height:fit-content;flex:0 0 fit-content}.choice-text-entry-container{width:100%;height:fit-content;flex:0 1 fit-content;overflow:hidden}.choice .choice-text-input--mobile{max-height:63px}.choice .choice-text-input--desktop{max-height:150px}.choice .choice-text-input{box-sizing:border-box;background-color:transparent;color:#343442;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol;min-height:20px;max-height:60px;padding:0;margin-top:8px;resize:none;width:100%;font-size:14px;line-height:20px;outline:none;border:none;overflow-wrap:break-word}.choice .choice-text-input::placeholder{color:#6c6c6e80}.ul-thanks-check{text-align:center;margin-bottom:20px}.ul-card--thanks-content{padding:20px 0 10px}.ul-card--thanks .ul-question{padding-top:0;text-align:center}.ul-card--thanks .ul-caption{padding-top:0;text-align:center;overflow-wrap:break-word;hyphens:auto;hyphenate-limit-lines:no-limit}.ul-card--uploading .ul-question{padding-top:15px;text-align:center}.ul-card--uploading .ul-caption{padding-top:5px;text-align:center;overflow-wrap:break-word}.ul-loading-spinner-container{font-size:1.8rem;flex-grow:1;width:100%;height:100%;display:flex;align-items:center;justify-content:center}.ul-loading-spinner{display:inline-block;position:relative;width:6rem;height:6rem}.ul-loading-spinner div{box-sizing:border-box;display:block;position:absolute;width:80%;height:80%;margin:5px;border:5px solid #152e3e;border-radius:50%;animation:lds-ring 1.2s cubic-bezier(.5,0,.5,1) infinite;border-color:#152e3e transparent transparent transparent}.ul-loading-spinner .first{animation-delay:-.45s}.ul-loading-spinner .second{animation-delay:-.3s}.ul-loading-spinner .third{animation-delay:-.15s}@keyframes lds-ring{0%{transform:rotate(0)}to{transform:rotate(360deg)}}.select-checkbox{height:16px;width:16px;border-radius:3px;border:1px solid #323232;display:flex;box-sizing:border-box;box-shadow:inset 3px 3px #0000001a;background-color:"transparent";align-items:center;justify-content:center}.select-radio{height:16px;width:16px;border-radius:16px;border:1px solid #323232;display:flex;box-sizing:border-box;box-shadow:inset 2px 2px #0000001a;background-color:"transparent";align-items:center;justify-content:center}.fade-in-transition{animation:fadeIn .4s ease-in;-webkit-animation:fadeIn .4s ease-in;-moz-animation:fadeIn .4s ease-in;-o-animation:fadeIn .4s ease-in;-ms-animation:fadeIn .4s ease-in}@keyframes fadeIn{0%{opacity:0}to{opacity:1}}@-moz-keyframes fadeIn{0%{opacity:0}to{opacity:1}}@-webkit-keyframes fadeIn{0%{opacity:0}to{opacity:1}}@-o-keyframes fadeIn{0%{opacity:0}to{opacity:1}}@-ms-keyframes fadeIn{0%{opacity:0}to{opacity:1}}[class^=CenteredSurveyLayout] .ul-header__container,[class^=QuestionConceptTestLayout] .ul-header__container,.ul-websurvey-frame .ul-card__container,.ul-websurvey-frame-mobile .ul-card__container{margin-bottom:unset}[class^=CenteredSurveyLayout] .ul-card__container,[class^=QuestionConceptTestLayout] .ul-card__container,.ul-websurvey-frame .ul-card__container,.ul-websurvey-frame-mobile .ul-card__container{box-shadow:unset;border-radius:unset;border:none!important;position:unset}@media only screen and (min-height: 600px) and (width: 600px){.ul-card{position:relative;top:-20px}}.ul-vertical-centered-container{display:flex;flex-direction:column;align-items:center}.ul-consent-legal__name-input--mobile{border:2px solid #e6e6e6}.ul-consent-legal__name-input--desktop{border:1px solid #e6e6e6}.ul-consent-legal__name-input{background:rgba(0,0,0,.01);box-sizing:border-box;color:#343442;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol;padding:10px 20px 10px 15px;border-radius:3px;font-size:15px;line-height:20px;margin-bottom:7px;width:100%}.ul-consent-legal__name-input::placeholder{color:#6c6c6e80}.ul-consent-legal__name-input:focus{outline:none;background:white}.ul-consent-legal__name-input--desktop:hover:not(:focus){background-color:#0000000d}.ul-card__consent-legal .choice{font-size:15px;padding:10px 15px;background-color:#00000003}.ul-card__consent-legal .choice--desktop:hover,.ul-card__consent-legal .choice--desktop:active,.ul-card__consent-legal .choice--mobile:active{background-color:#0000000d}.ul-card--likert__numbers{align-items:center;border-radius:5px;display:flex;flex-direction:row;flex:1 0;justify-content:center;margin:5px 0 0}.likert-number--mobile{border:2px solid #e6e6e6;margin-left:-2px}.likert-number--desktop{border:1px solid #e6e6e6;margin-left:-1px}.likert-number{align-items:center;cursor:pointer;display:flex;justify-content:center;flex:1 0;background-color:#00000003;font-size:18px;line-height:24px;height:67px}.likert-number:active,.likert-number--desktop:hover{background-color:#0000000d;font-weight:500}.likert-number-1{border-top-left-radius:5px;border-bottom-left-radius:5px}.likert-last-option{border-top-right-radius:5px;border-bottom-right-radius:5px}.likert-star--mobile{margin-left:-2px}.likert-star--desktop{margin-left:-1px}.likert-star{align-items:center;cursor:pointer;display:flex;justify-content:space-between;flex:1 0;color:transparent;font-size:18px;line-height:24px;height:67px}.likert-smiley--mobile{margin-left:-2px}.likert-smiley--desktop{margin-left:-1px}.likert-smiley{align-items:center;cursor:pointer;display:flex;justify-content:space-between;flex:1 0;color:transparent;line-height:24px;height:67px}.likert-smiley circle:not(:first-child){fill-opacity:1}.ul-card--likert__labels{align-items:center;color:#262136;display:flex;flex-direction:row;flex:1 0;font-weight:500;font-size:13px;line-height:15px;justify-content:space-between;margin:7px 0 10px}.ul-card--likert__labels span:last-child{text-align:right}.select-label{flex:1;overflow-wrap:anywhere;cursor:pointer;padding-left:15px}.ul-card--nps__numbers{align-items:center;border-radius:5px;display:flex;flex-direction:row;flex:1 0;justify-content:center;margin:5px 0 0}.nps-number--mobile{border:2px solid #e6e6e6;margin-left:-2px}.nps-number--desktop{border:1px solid #e6e6e6;margin-left:-1px}.nps-number{align-items:center;cursor:pointer;display:flex;justify-content:center;flex:1 0;background-color:#00000003;font-size:18px;line-height:24px;height:67px}.nps-number:active,.nps-number--desktop:hover{background-color:#0000000d;font-weight:500}.nps-number-0{border-top-left-radius:5px;border-bottom-left-radius:5px}.nps-number-10{border-top-right-radius:5px;border-bottom-right-radius:5px}.ul-card--nps__labels{align-items:center;color:#262136;display:flex;flex-direction:row;flex:1 0;font-weight:500;font-size:13px;line-height:15px;justify-content:space-between;margin:7px 0 10px}.ul-card--nps__labels span:last-child{text-align:right}.ul-card-text{flex:1 0 auto;margin-top:2px;margin-bottom:3px;align-items:center;display:flex;flex-wrap:wrap;justify-content:center;padding:0}.ul-card-text__container{align-items:center;box-sizing:border-box;border-radius:3px;display:flex;justify-content:center;margin-bottom:12px;flex:1 0 100%}.ul-card-text__input--mobile{border:2px solid #e6e6e6;max-height:63px}.ul-card-text__input--desktop{border:1px solid #e6e6e6;max-height:150px}.ul-card-text__input{background:rgba(0,0,0,.01);box-sizing:border-box;color:#343442;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol;min-height:63px;overflow:auto;padding:12px;resize:none;width:100%;border-radius:3px;font-size:15px;line-height:20px;overflow-wrap:break-word}.ul-card-text__input::placeholder{color:#6c6c6e80}.ul-card-text__input:focus{outline:none;background:white}.ul-card-text__input--desktop:hover:not(:focus){background-color:#0000000d}.ul-card__text-url-prompt-button{text-decoration:none;text-overflow:ellipsis;overflow:hidden;white-space:nowrap}#ul-card-voice__video{align-items:center;display:flex;flex-direction:column}#ul-card-voice__video>div{margin-bottom:10px;width:100%}#ul-card-video__player_recorder{width:100%;width:-moz-available;width:-webkit-fill-available;width:fill-available}.ul-card-record__task{flex:1 0 auto;margin-top:2px;margin-bottom:3px;align-items:center;display:flex;flex-wrap:wrap;justify-content:center;padding:0}#ul-record-task-upload-progress,#ul-record-task-video-preview{width:100%;height:150px}.ul-permission-graphics-container{width:100%;height:150px;background-color:#0000000d;text-align:center;flex-direction:column;margin-left:auto;margin-right:auto;border-radius:5px;display:flex;align-items:center;font-size:15px;color:#000000b3}.ul-av-permission-denied-paragraph{margin:auto 15px;font-size:12px}.ul-av-permission-denied-headline{font-size:14px;color:#262136;text-decoration:underline;font-size:12px}.ul-permission-body{color:#000;margin:5px auto 5px 5px;line-height:135%;text-align:center}.ul-select-tab-container{width:240px;height:46px;background:#ffffff;border-radius:5px;text-align:left;align-items:center;display:flex;padding:0 5px;margin-top:20px;margin-bottom:auto}.ul-select-tab-text{color:#4b575d;margin:5px;line-height:135%;text-align:center}button.ul-task-skip-button{color:#000;background-color:#fff}#ul-task-detail-container{margin-top:0;margin-bottom:0;overflow:auto}#ul-task-detail-container.ul-rich-text-body p,#ul-task-detail-container.ul-rich-text-body li,#ul-task-detail-container.ul-rich-text-body{color:#4c4c4c}#ul-task-detail-container :first-child{margin-top:0}#ul-task-detail-container :last-child{margin-bottom:20px}.ul-horizontal-button-container{width:100%;display:flex;flex-direction:row}.ul-skip-button-below{margin-top:5px}.ul-horizontal-button-container-center{justify-content:center}.ul-vertical-button-container-center{display:flex;flex-direction:column;align-items:center}.ul-horizontal-button-container-left{justify-content:flex-start}.ul_recorded-task-inset-spacing{margin-top:5px;margin-bottom:24px}.ul_permission_svg_container{justify-content:center}.ul-card-text__button{background-color:var(--theme);border-radius:3px;border:none;color:#fff;cursor:pointer;font-size:15px;font-weight:500;line-height:18px;padding:10.5px 21px}.ul-card-text__button:disabled,.ul-card-text__button.sprig-button-disabled{background-color:#0000001a;color:#0003}.ul-card-text__button.ul-button-inactive{background-color:#fff!important;color:#5d696f!important}.ul-card-skip__button{color:#00000080;background:none;border:none;font-size:15px;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol;cursor:pointer}.ul-card-button-group{align-items:center;display:flex;gap:30px;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%;margin-bottom:8px}.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;margin-bottom:15px;padding:12px;text-align:left}.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;margin-right:8px;padding:4px}.close-container--desktop,.close-container--mobile{height:22px;width:22px;border-radius:22px;background-color:#fff;align-items:center;justify-content:center}.close-container--desktop{top:25px;right:25px}.close-container--mobile{top:15px;right:10px}.close-container{background:transparent;box-sizing:border-box;display:flex;position:absolute}.close-btn{height:18px;width:18px;align-items:center;justify-content:center;display:flex;cursor:pointer}.ul-app__container{transition:opacity .3s ease-out}.ul-center-horizontally{text-align:center}#ul-progress-bar-container{width:100%;height:2px;background-color:#0000001a;border-radius:2px;max-width:250px;margin:25px 0}#ul-progress-bar-current{transition:width 1s ease;width:0%;height:0;border-radius:2px}.prototype-button{width:100%;background:rgba(0,0,0,.01);border:1.5px solid #e6e6e6;border-radius:4px 0 0 4px;flex:none;flex-grow:1;margin:0;padding:20px 0;font-size:14px;font-family:inherit;text-decoration:underline}.prototype-button:hover{cursor:pointer}
704
+ `,ig=(e,t)=>{const n=[...e],r=new Set([A.VideoVoice,A.RecordedTask]);return e.some(i=>r.has(i.type))&&n.push({name:-2,props:{routingOptions:[]},type:A.Uploading}),t&&n.push({name:-1,props:{routingOptions:[]},type:A.Thanks}),n},og=({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 ag(e,t=!0){var b;const{answers:n,apiURL:r,customStyles:i,endCard:o,eventEmitFn:a,fontFamilyURL:s,frame:l,previewKey:u,UpChunk:c,viewDocument:f,viewWindow:d}=e,p=Qt(e.headers)?e.frame:f.body,h=G,v=ig(e.cards,!!o);yr.configure(h,{cards:v,hasEndCard:!!o,apiURL:r,UpChunk:c}),J.setState({apiURL:r,answers:n,border:e.border,index:e.startingQuestionIdx||0,cards:v,configureExitOnOverlayClick:e.configureExitOnOverlayClick,customMetadata:e.customMetadata,endCard:e.endCard,envId:e.envId,eventEmitFn:a,fontFamily:e.fontFamily,forceBrandedLogo:e.forceBrandedLogo,frame:l,headers:e.headers,hasViewedEmbed:!1,isPreview:e.isPreview,marketingUrl:"https://sprig.com",meta:og({mode:e.mode,viewWindow:d,viewDocument:f}),mode:e.mode,previewKey:u,recorder:yr,recorderEventEmitter:h,responseGroupUid:e.responseGroupUid,showStripes:e.showStripes,showSurveyBrand:e.showSurveyBrand,slugName:e.slugName,styleNonce:e.styleNonce,surveyId:e.surveyId,tabTitle:e.tabTitle,uploadingCardViewed:!1,uploadProgress:{},useMobileStyling:e.useMobileStyling,useDesktopPrototype:e.useDesktopPrototype,userId:e.userId,viewDocument:e.viewDocument,visitorAttributes:e.visitorAttributes,viewedCardCount:e.startingQuestionIdx||0});const{seen:m}=J.getState();m();const{head:_}=f,y=f.createElement("style");if(y.id="sprig-style",y.textContent=rg,y.nonce=e.styleNonce,_.appendChild(y),e.fontFamily&&s&&parent){const x=f.createElement("link");x.rel="stylesheet",x.href=s,_.appendChild(x)}if(e.customStyles&&el(f,i,e.styleNonce),!c)if(e.installationMethod!==mt.Npm){const x=f.createElement("script");x.src="https://cdn.sprig.com/userleap-web-upchunk-v2.2.2.js",x.onload=()=>{yr.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.24.7",w=a||((b=l.eventEmitter)==null?void 0:b.emit);w==null||w(Te.VerifyViewVersion,{[At.ViewVersion]:E}),p&&t&&on(g(ng,{}),p)}const sg={configure:ag};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 lg="rgba(255,255,255, 0.95)",ug="rgba(0,0,0,0.9)",cg="360px",xi="0px",vc=()=>{window.UserLeap.container=document.createElement("div"),window.UserLeap.container.className="ul-container",document.body.appendChild(window.UserLeap.container)},mc=e=>{vg();const t=window.UserLeap.container;if(!(!t||!t.parentNode))try{t.parentNode.removeChild(t),window.UserLeap.container=null,_e("trackStartUrl",null),G.emit(F.SurveyLifeCycle,{state:"dismissed"}),G.emit(F.SurveyClosed,{name:F.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)}},gc=()=>{G.on(F.SurveyWillClose,({initiator:e})=>{mc(e)})},dg=(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"?lg:ug,t||(r.margin="auto"),window.UserLeap.container&&Object.assign(window.UserLeap.container.style,r)},fg=(e,t,n)=>{var s,l;const r={position:"fixed",bottom:"0px",right:xi,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=cg,r.maxHeight=window.UserLeap.maxHeight||"66vh",i.framePosition===wn.BottomLeft?o={left:xi}:i.framePosition===wn.TopLeft?o={left:xi,top:"0px"}:i.framePosition===wn.TopRight?o={top:"0px"}:i.framePosition===wn.Center&&(a=!0,o={margin:"auto",position:"static"},r.maxHeight=null)),a&&dg(i,n),Object.assign(e.style,r,o),a},pg=(e,t)=>{var s,l;const n="ul-frame";vc(),hg();const r=document.createElement("iframe");r.id=n,r.setAttribute("title","Sprig User Feedback Dialog");const i=fg(r,e,t);gc(),r.setHeight=u=>{parseInt(r.style.height)!=u&&(r.style.height=`${u}px`,G.emit(F.SurveyHeight,{name:F.SurveyHeight,contentFrameHeight:u}))},(s=window.UserLeap.container)==null||s.appendChild(r),e&&(t?e.exitOnOverlayClickMobile:e.exitOnOverlayClick)&&window.UserLeap.container&&(window.UserLeap.container.onclick=()=>{G.emit(F.CloseSurveyOnOverlayClick)}),G.emit(F.SurveyLifeCycle,{state:"presented"}),G.emit(F.SurveyPresented,{name:F.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}},yc={[F.SurveyFadingOut]:()=>{window.UserLeap.container&&Object.assign(window.UserLeap.container.style,{"background-color":"rgba(0,0,0,0)"})}},hg=()=>{Object.entries(yc).forEach(([e,t])=>{G.on(e,t)})},vg=()=>{Object.entries(yc).forEach(([e,t])=>{G.off(e,t)})},mg="!launch_darkly_";class gg{constructor(){ce(this,"_ldData",{})}getAllLaunchDarklyVariations(){return this._ldData}setLDFlagsVariations(t){try{return!t||typeof t!="object"||Array.isArray(t)?!1:(Object.keys(this._ldData).forEach(n=>{delete this._ldData[n]}),Object.keys(t).forEach(n=>{var r;return this._ldData[`${mg}${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 po=new gg;Object.freeze(po);const yg="!optimizely_experiments_";class _g{constructor(){ce(this,"_optimizelyData",{})}setOptimizelyExperiment(t,n=!0){if(!t||typeof t!="object")return!1;const{experiments:r}=t;try{return n&&Object.keys(this._optimizelyData).map(i=>{delete this._optimizelyData[i]}),r&&r.map(i=>{const{id:o,variation:a}=i,s=this.transformExperimentId(o);a&&typeof a=="string"&&(this._optimizelyData[s]=a)}),!0}catch(i){return i instanceof Error&&window.UserLeap.reportError("setOptimizelyExperiment",i),!1}}getAllOptimizelyExperiments(){return this._optimizelyData}getOptimizelyVariationName(t){return this._optimizelyData[this.transformExperimentId(t)]}transformExperimentId(t){return yg+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 br=new _g;Object.freeze(br);class wg{constructor(t,n){ce(this,"paused");ce(this,"queue");ce(this,"ul");this.ul=t,this.paused=!1,this.queue=[],this.flush(n)}flush(t){const n=t.length;if(n)for(let r=0;r<n;r++)this.push(t[r])}isPaused(){return this.paused}pause(){this.paused=!0}unpause(){this.paused=!1;const t=this.queue.slice();this.empty(),this.flush(t)}push(t){if(this.paused)this.queue.push(t);else if(t instanceof Function)t();else{const n=Array.prototype.slice.call(t,1),r=t[0],i=this.ul[r];i instanceof Function?i.apply(this.ul,n):r&&console.warn("[Sprig] (ERR-100) No valid UserLeap action called",r)}}perform(t){if(this.paused){let n=()=>{};const r=new Promise(function(i){n=function(){i(t())}});return this.queue.push(n),r}else return t()}empty(){this.queue.length=0}}var Oe=(e=>(e.Ready="ready",e.NoSurvey="no survey",e))(Oe||{}),_c=(e=>(e.Preview="sprigPreviewKey",e))(_c||{});const bg=["popState","pushState","replaceState"],Eg={test:"test"},yn="!email",xg=["ios","android"],Ot="environments",ho="pageUrl",Ct="visitors",Os="ul-view-sdk-script",Ds=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 sa(e,t){const{matchType:n,pattern:r}=e,i=n?Ds[n]:Ds.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 Sg(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?sa(a,window.location.href):t===window.location.href}function jn(e){const{pageUrlEvents:t,interactiveEvents:n,dismissOnPageChange:r,platform:i}=window.UserLeap._config;if(i&&i!==Nt.Web)return;const o=It("trackStartUrl"),a=o?String(o):null;t&&Sc(window.location.href),n&&(bc(),Cg()),r&&a&&a!==window.location.href&&e&&bg.includes(e.type)&&window.UserLeap("dismissActiveSurvey",He.PageChange)}const wc={capture:!0},Cg=()=>{const t=window.UserLeap._config.interactiveEvents.filter(r=>sa(r,window.location.href)).map(r=>{const{name:i,properties:o}=r,{selector:a,innerText:s}=o;return a?l=>{if(tn(l.target))try{l.target.closest(a)&&window.UserLeap("track",i)}catch{}return!1}:l=>(tn(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,wc)},bc=()=>{window.UserLeap._config.interactiveEventsHandler&&window.removeEventListener("click",window.UserLeap._config.interactiveEventsHandler,wc),delete window.UserLeap._config.interactiveEventsHandler};function Ig(){["hashchange","popstate"].forEach(e=>window.addEventListener(e,jn,!0))}function kg(){["hashchange","popstate"].forEach(e=>window.removeEventListener(e,jn,!0)),window.UserLeap._config.interactiveEvents&&bc()}function Ze(e,t,n){const r=[window.UserLeap._API_URL,"sdk",e];return t&&t.forEach(i=>{r.push(i),i===Ot?r.push(window.UserLeap.envId):i===Ct&&r.push(la())}),n&&r.push(n),r.join("/")}function Tg(e,t){let n=Ze("1",[Ot],"questions?");return e!=null&&(n+=`&vid=${e}`),t&&(t.surveyId&&(n+=`&surveyid=${t.surveyId}`),t.surveyTemplateId&&(n+=`&surveytemplateid=${t.surveyTemplateId}`)),n}function Ec(){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 It(e){if(!window.UserLeap.localStorageAvailable)return null;const t=localStorage.getItem(we.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 _e(e,t){if(!window.UserLeap.localStorageAvailable)return;const n=localStorage.getItem(we.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(we.Credentials,JSON.stringify(r))}catch(o){o instanceof Error&&console.warn(`[Sprig] (ERR-426) Unable to write to Local Storage:: ${o.message}`)}}function xc(){window.previewMode||(window.UserLeap.visitorId=gt(),_e("vid",window.UserLeap.visitorId),G.emit(F.VisitorIDUpdated,{visitorId:window.UserLeap.visitorId}))}function la(){return window.previewMode?"0":window.UserLeap.visitorId||""}function Sc(e,t,n){if(!window.UserLeap.localStorageAvailable||e.endsWith("mock_snippet.html"))return;const r=window.UserLeap._config.pageUrlEvents;if(r&&r.length){let u=!1;for(let c=0;c<r.length&&(u=sa(r[c],e),!u);c++);if(!u)return}window.UserLeap.debugMode&&console.info("[DEBUG] Sprig trackPageView",e);const i=10,o=1;let a=[];const s={viewedAt:Date.now(),location:e},l=localStorage.getItem(we.PageViews);try{if(a=l?JSON.parse(l):[],Array.isArray(a)||(a=[]),a.length>0){const u=a[a.length-1],c=(Date.now()-u.viewedAt)/1e3;u.location!=e&&c>o&&Qa({url:e}),(u.location!=e&&c>o||c>i)&&(window.UserLeap._queue.push(["track",ho,t,{url:e},n]),a.push(s))}else window.UserLeap._queue.push(["track",ho,t,{url:e},n]),a.push(s),Qa({url:e});a.length>5&&a.splice(0,a.length-5);try{localStorage.setItem(we.PageViews,JSON.stringify(a))}catch(u){u instanceof Error&&console.warn(`[Sprig] Unable to write to Local Storage: ${u.message}`)}}catch(u){u instanceof Error&&window.UserLeap.reportError("trackPageView",u,{pageViewsStorage:l}),console.warn("[Sprig] (ERR-425) Failed to update page views in local storage")}}function Lg(){const e="Backbone"in window&&window.Backbone&&window.Backbone.history?window.Backbone.history:window.history;"pushState"in e&&(e.pushState=(t=>function(...r){const i=t.apply(this,r),o=new Event("pushState");return window.dispatchEvent(o),jn(o),i})(e.pushState)),"replaceState"in e&&(e.replaceState=(t=>function(...r){const i=t.apply(this,r),o=new Event("replaceState");return window.dispatchEvent(o),jn(o),i})(e.replaceState)),Ig()}async function Si(e,t){const n=la();e&&!t&&(window.UserLeap._config.mode=Eg.test);const r=await ft(Tg(n,e),{},0,!0);return r.ok?(r.json.delay&&await Ir(r.json.delay),Cc(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:Oe.NoSurvey})}const Cc=async e=>{var D,S,V,O;const{context:t,forceBrandedLogo:n,endCard:r,locale:i,productConfig:o,questions:a,responseGroupUid:s,surveyId:l,uuid:u,vid:c,sessionReplay:f}=e,d=Fn(window.UserLeap),p=ua(d),h=Ag(d);if(f&&zl({responseGroupId:s,surveyId:l,visitorId:c,replayParams:f,completeUploadHeaders:d,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:Oe.NoSurvey};if(window.UserLeap.container){const H="[Sprig] (ERR-409) Found an existing Survey container, aborting rendering of this survey";return console.warn(H),{success:!1,message:H,surveyState:Oe.NoSurvey}}if(c!==window.UserLeap.visitorId&&u!==window.UserLeap.visitorId&&!window.previewMode){const H="Attempted to display survey to a different visitor";return window.UserLeap.reportError("DisplaySurvey",new Error(H)),{success:!1,message:H,surveyState:Oe.NoSurvey}}av({id:l}),Ti.disable(),G.emit(F.SurveyWillPresent,{name:F.SurveyWillPresent,[Ps.SurveyId]:l});let v,m=document.createElement("div"),_,y,E;const w=H=>{const{[At.ViewVersion]:ue}=H;ue!==d["x-ul-sdk-version"]&&mc(),G.removeListener(Te.VerifyViewVersion,w)};G.on(Te.VerifyViewVersion,w),Qt(d)?(v="ul-direct-embeded-frame",_=document.head,y=window,E=!1,p&&(vc(),m.id=v,window.UserLeap.container.appendChild(m),gc(),G.emit(F.SurveyLifeCycle,{state:"presented"}),G.emit(F.SurveyPresented,{name:F.SurveyPresented}))):{frameId:v,contentWinDocHead:_,contentWindow:y,hasOverlay:E,iframe:m}=pg(o,h),window.UserLeap.frameId=v,window.UserLeap.useMobileStyling=h;const b=H=>{G.on(F.CloseSurveyOnOverlayClick,H)},x=Object.assign({frame:m,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:d,endCard:r,useMobileStyling:h,mobileSDKVersion:window.UserLeap.mobileSDKVersion,configureExitOnOverlayClick:b,eventEmitFn:G.emit.bind(G),ulEvents:mo,viewDocument:y==null?void 0:y.document,viewWindow:y,tabTitle:document.title,startingQuestionIdx:(D=window.UserLeap.config)==null?void 0:D.startingQuestionIdx,styleNonce:window.UserLeap.styleNonce,previewKey:(S=window.UserLeap)!=null&&S.localStorageAvailable?(V=window.localStorage)==null?void 0:V.getItem(we.Preview):null,forceBrandedLogo:n},window.UserLeap._config);(O=window.UserLeap.config)!=null&&O.startingQuestionIdx&&(window.UserLeap.config={...window.UserLeap.config,startingQuestionIdx:null}),window.UserLeap.customStyles&&(x.customStyles=window.UserLeap.customStyles),y&&(y.__cfg=x);function C(){const H=document.createElement("script");return window.UserLeap.nonce&&H.setAttribute("nonce",window.UserLeap.nonce),H.id=Os,H}const I=window.UserLeap.viewSDKURL?window.UserLeap.viewSDKURL:x.path,k=document.getElementById(Os);k&&k.remove();const L=C(),T=()=>{window.UserLeap.container&&Object.assign(window.UserLeap.container.style,{display:"flex"})};return x.installationMethod===mt.Npm?(sg.configure(x),E&&window.UserLeap.container&&T()):I&&(L.src=I,E&&L.addEventListener("load",()=>{window.UserLeap.container&&T()}),y==null||y.addEventListener("error",H=>{H.target instanceof HTMLScriptElement&&H.target.src===I&&window.UserLeap.reportError("loadFrameScript",new Error("Frame script failed to load"))},{capture:!0,once:!0})),_==null||_.appendChild(L),{success:!0,surveyState:Oe.Ready,surveyId:l,responseGroupUid:s}};function Ag(e){if(window.UserLeap.useMobileStyling!==void 0)return window.UserLeap.useMobileStyling;const t=window.UserLeap.windowDimensions&&window.UserLeap.windowDimensions.width||document.body.clientWidth;return ua(e)||t>10&&t<Of}function ua(e){return xg.includes(e[Fe.Platform])}function Rg(e){let t=e.length;for(;t;){const n=Math.floor(Math.random()*t);t-=1;const r=e[t];e[t]=e[n],e[n]=r}}function Ug(e){if(!e)return;window.UserLeap._config=e,e.mute&&window.UserLeap._queue.pause();const{interactiveEvents:t,pageUrlEvents:n,dismissOnPageChange:r}=e;t&&Rg(t),(t||n||r)&&(Lg(),jn())}async function ft(e,t,n=0,r=!1){var o,a;t.headers=Object.assign(Fn(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(Fe.VisitorID);u&&c&&(c!==window.UserLeap.visitorId||window.UserLeap.token!==u)&&(_e("token",u),_e("vid",c),G.emit(F.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 Ir(e.json.delay),window.UserLeap.delayingSurvey=!1),n)}const Dg=function(e){if(!window.UserLeap)return;const t=async(r={})=>{var v,m,_,y,E;const{userId:i,anonymousId:o,metadata:a={},properties:s,showSurveyCallback:l}=r;let{eventName:u}=r;if(window.UserLeap.debugMode&&u!==ho&&console.info("[DEBUG] Sprig track",r),e.mode==="test")return;const c=window.UserLeap.localStorageAvailable&&(v=localStorage.getItem(we.Preview))!=null?v:void 0;if(e.requireUserIdForTracking&&!window.UserLeap.userId&&!i){const w="[Sprig] - Skipping tracking without userId";return console.warn(w),{success:!1,message:w,surveyState:Oe.NoSurvey}}if(!u||u.trim().length===0){u=u?String(u):"";const w="[Sprig] - Invalid event name "+u;return console.warn(w),{success:!1,message:w,surveyState:Oe.NoSurvey}}const f=window.location.href;if(a.url||(a.url=f),_e("trackStartUrl",f),(_=(m=window.UserLeap)==null?void 0:m._config)!=null&&_.optimizelyEnabled){const w=Fn(window.UserLeap);ua(w)||br.getAndSetWebOptimizelyExperiments(),a.optimizelyExperiments=Object.assign({},br.getAllOptimizelyExperiments())}(E=(y=window.UserLeap)==null?void 0:y._config)!=null&&E.launchDarklyEnabled&&(a.launchDarklyFlags=po.getAllLaunchDarklyVariations()),i&&(window.UserLeap.userId=i),o&&(window.UserLeap.partnerAnonymousId=o),s&&(a.eventProperties=s),ov({name:u});const d=window.UserLeap.delayingSurvey?await ft(Ze("1",[Ct],"events/batch"),{body:JSON.stringify({events:[{event:u,metadata:a}],previewKey:c}),method:"POST"},0,!0):await ft(Ze("1",[Ct],"events"),{body:JSON.stringify({event:u,metadata:a,previewKey:c}),method:"POST"},0,!0);if(!d.ok){const w="[Sprig] (ERR-421) Failed to track event";return d.reportError&&(console.warn(w,d.error),d.error&&window.UserLeap.reportError("track",d.error)),{success:!1,message:w,error:d.error,surveyState:Oe.NoSurvey}}i&&_e("uid",i),o&&_e("aid",o);const p=d.json;return p.invalidPreviewKey&&window.UserLeap.localStorageAvailable&&localStorage.removeItem(we.Preview),await Og(d,l)?Sg(p.eventId,f)?Cc(p):{success:!1,message:"Study should not be displayed after page navigation",surveyState:Oe.NoSurvey}:{success:!1,message:"[Sprig] Callback returned false, aborting rendering of survey",surveyState:Oe.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",He.Override),Si({surveyId:r},!0)},_previewSurvey(r){window.UserLeap("dismissActiveSurvey",He.Override),Si({surveyTemplateId:r},!1)},_reviewSurvey(r){window.UserLeap("dismissActiveSurvey",He.Override),Si({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=He.API){G.emit(F.SurveyWillClose,{name:F.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,yn)&&(a[yn]=a.email,delete a.email),l=await ft(Ze("1",[Ot,Ct],"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(Ze("1",[Ot,Ct]),{body:JSON.stringify(s),method:"PUT"}),a&&a[yn]&&(window.UserLeap.email=a[yn]),l.ok&&(i&&_e("uid",i),o&&_e("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(Ze("1",[Ot,Ct],"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){G.on(F.SurveyLifeCycle,r)},async removeSurveyListener(r){G.removeListener(F.SurveyLifeCycle,r)},async addListener(r,i){G.on(r,i)},async removeListener(r,i){G.removeListener(r,i)},async removeAllListeners(){G.removeAllListeners()},setPreviewKey(r){if(!r||typeof r!="string")return;const i=Ec();window.UserLeap.localStorageAvailable=i,i&&r&&localStorage.setItem(we.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(Ze("1",[Ot,Ct]),{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&&Ya(),_e("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,_e("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){Sc(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(R.CustomStyle);o?o.textContent=r:el(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(tl(s.contentDocument))+"px")),G.emit(F.SurveyDimensions,{name:F.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(we.Credentials),localStorage.removeItem(we.PageViews)),window.UserLeap._queue.isPaused()&&window.UserLeap._queue.empty(),xc(),Ya(),window.UserLeap._queue.unpause()},teardown(){kg(),window.UserLeap("dismissActiveSurvey",He.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;br.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(kf.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}po.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(yn,r)},async setVisitorEmail(r){return console.warn("[Sprig] setVisitorEmail is deprecated. Please use setEmail"),n.setEmail(r)},async _generateVideoUploadUrl(r){return Mg(r)},async _completeSessionReplay({surveyId:r,responseGroupUuid:i,eventDigest:o}){if(!r||!i)return;const a=window.UserLeap._API_URL;try{await ul({surveyId:r,responseGroupUuid:i,eventDigest:o,apiUrl:a},!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=Fn(window.UserLeap);document.addEventListener("securitypolicyviolation",Li);let n=await it(Ze("1",[Ot],"config"),{headers:t});const r="TypeError";if(window.UserLeap.error=n.error,!n.ok&&n.error&&n.error.name===r?(window.UserLeap._API_URL="https://api.sprig.com",window.UserLeap.reportError("sprigDomainRequest",n.error)):document.removeEventListener("securitypolicyviolation",Li),!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)}async function Ng(e,t,n={}){const r=window.__cfg&&window.__cfg.mode,i=la(),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(Ze("1",null,"errors"),{method:"POST",headers:{[Fe.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 Mg(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 Vg(e={}){var i;const t=(i=new URLSearchParams(window.location.search).get(_c.Preview))!=null?i:"",n=Ec();window.UserLeap.localStorageAvailable=n,window.UserLeap.UPDATES=mo,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=It("sampled");if(u===null&&(u=Math.random()<o,_e("sampled",u)),!u)return}else n&&It("sampled")!==null&&_e("sampled",null);window.UserLeap._API_URL||(window.UserLeap._API_URL="https://api.sprig.com");const a=[...window.UserLeap._queue];window.UserLeap._queue=new wg(window.UserLeap,[]),window.UserLeap._queue.pause();for(let u=0;u<a.length;u++)window.UserLeap._queue.push(a[u]);const s=It("token");s?(window.UserLeap.token=s,window.UserLeap.visitorId=It("vid"),window.UserLeap.userId=It("uid"),window.UserLeap.partnerAnonymousId=It("aid")):(window.UserLeap.localStorageAvailable&&localStorage.removeItem(we.Credentials),xc());const l=await Pg(e);Gh(window.document,l.maxReplayDurationSeconds,window.UserLeap.replayNonce,window.UserLeap.maxInflightReplayRequests,l.replaySettings),Dg(l),await Ug(l),window.UserLeap._queue.unpause(),G.emit(F.SDKReady),G.emit(F.VisitorIDUpdated,{visitorId:window.UserLeap.visitorId})}document.readyState==="complete"?r():window.attachEvent?window.attachEvent("onload",r):window.addEventListener("load",r,!1)}class Hr{constructor(){ce(this,"UPDATES",mo)}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 vo={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=mt.Npm,window.Sprig)return window.Sprig;window.Sprig=function(){window.Sprig._queue.push(arguments)},Object.getOwnPropertyNames(Hr.prototype).map(n=>{n!=="constructor"&&(window.Sprig[n]=Hr.prototype[n])});const t=window.Sprig;return t.appId=e.envId,t._queue=[],window.UserLeap=t,Vg(e),window.Sprig}},jg={sprig:vo,SprigAPI:Hr,configure:vo.configure};exports.DismissReason=He;exports.SprigAPI=Hr;exports.SprigEvent=F;exports.default=jg;exports.sprig=vo;