@sprig-technologies/sprig-browser 2.25.0 → 2.25.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +2 -2
- package/dist/index.js +3 -3
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use strict";var Mc=Object.defineProperty;var Vc=(e,t,n)=>t in e?Mc(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var ie=(e,t,n)=>(Vc(e,typeof t!="symbol"?t+"":t,n),n);Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});var qe=(e=>(e.Closed="close.click",e.Complete="survey.completed",e.PageChange="page.change",e.API="api",e.Override="override",e))(qe||{}),j=(e=>(e.ReplayCapture="replay.capture",e.SDKReady="sdk.ready",e.SurveyAppeared="survey.appeared",e.SurveyClosed="survey.closed",e.SurveyDimensions="survey.dimensions",e.SurveyFadingOut="survey.fadingOut",e.SurveyHeight="survey.height",e.SurveyPresented="survey.presented",e.SurveyLifeCycle="survey.lifeCycle",e.SurveyWidth="survey.width",e.SurveyWillClose="survey.willClose",e.SurveyWillPresent="survey.will.present",e.CloseSurveyOnOverlayClick="close.survey.overlayClick",e.VisitorIDUpdated="visitor.id.updated",e.QuestionAnswered="question.answered",e))(j||{}),Rn=(e=>(e.SurveyId="survey.id",e))(Rn||{});const _o={SDK_READY:"sdk.ready",SURVEY_APPEARED:"survey.appeared",SURVEY_CLOSED:"survey.closed",SURVEY_DIMENSIONS:"survey.dimensions",SURVEY_FADING_OUT:"survey.fadingOut",SURVEY_HEIGHT:"survey.height",SURVEY_PRESENTED:"survey.presented",SURVEY_LIFE_CYCLE:"survey.lifeCycle",SURVEY_WILL_CLOSE:"survey.willClose",SURVEY_WILL_PRESENT:"survey.will.present",QUESTION_ANSWERED:"question.answered",REPLAY_CAPTURE:"replay.capture",CLOSE_SURVEY_ON_OVERLAY_CLICK:"close.survey.overlayClick",VISITOR_ID_UPDATED:"visitor.id.updated",DATA:{DISMISS_REASONS:{API:"api",CLOSED:"close.click",COMPLETE:"survey.completed",PAGE_CHANGE:"page.change",OVERRIDE:"override"},SURVEY_ID:"survey.id"}};var Ue=(e=>(e.VerifyViewVersion="verify.view.version",e.CurrentQuestion="survey.question",e.ViewPrototypeClick="question.prototype.click",e.ViewAgreementClick="question.agreement.click",e.RecordedTaskStart="recorded.task.start",e.RecordedTaskPermissionScreen="recorded.task.permission.screen",e.SurveyComplete="survey.complete",e))(Ue||{}),At=(e=>(e.ViewVersion="view.version",e.QuestionId="qid",e.Props="props",e))(At||{}),Z=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function jc(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function Bc(e){var t=e.default;if(typeof t=="function"){var n=function(){return t.apply(this,arguments)};n.prototype=t.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(e).forEach(function(r){var i=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(n,r,i.get?i:{enumerable:!0,get:function(){return e[r]}})}),n}var ue={},$t={};Object.defineProperty($t,"__esModule",{value:!0});var wo=function(){function e(){}return e.prototype.handleError=function(t){},e}();$t.NoopErrorHandler=wo;var bo=new wo;function Fc(e){bo=e}$t.setErrorHandler=Fc;function Hc(){return bo}$t.getErrorHandler=Hc;function $c(){bo=new wo}$t.resetErrorHandler=$c;var Eo={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),function(t){t[t.NOTSET=0]="NOTSET",t[t.DEBUG=1]="DEBUG",t[t.INFO=2]="INFO",t[t.WARNING=3]="WARNING",t[t.ERROR=4]="ERROR"}(e.LogLevel||(e.LogLevel={}))})(Eo);var St={},dn={},br={exports:{}},ha=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||typeof msCrypto<"u"&&typeof window.msCrypto.getRandomValues=="function"&&msCrypto.getRandomValues.bind(msCrypto);if(ha){var va=new Uint8Array(16);br.exports=function(){return ha(va),va}}else{var ma=new Array(16);br.exports=function(){for(var t=0,n;t<16;t++)(t&3)===0&&(n=Math.random()*4294967296),ma[t]=n>>>((t&3)<<3)&255;return ma}}var Fs=[];for(var Zn=0;Zn<256;++Zn)Fs[Zn]=(Zn+256).toString(16).substr(1);function Kc(e,t){var n=t||0,r=Fs;return[r[e[n++]],r[e[n++]],r[e[n++]],r[e[n++]],"-",r[e[n++]],r[e[n++]],"-",r[e[n++]],r[e[n++]],"-",r[e[n++]],r[e[n++]],"-",r[e[n++]],r[e[n++]],r[e[n++]],r[e[n++]],r[e[n++]],r[e[n++]]].join("")}var Hs=Kc,qc=br.exports,Gc=Hs,ga,ei,ti=0,ni=0;function zc(e,t,n){var r=t&&n||0,i=t||[];e=e||{};var o=e.node||ga,a=e.clockseq!==void 0?e.clockseq:ei;if(o==null||a==null){var s=qc();o==null&&(o=ga=[s[0]|1,s[1],s[2],s[3],s[4],s[5]]),a==null&&(a=ei=(s[6]<<8|s[7])&16383)}var l=e.msecs!==void 0?e.msecs:new Date().getTime(),u=e.nsecs!==void 0?e.nsecs:ni+1,c=l-ti+(u-ni)/1e4;if(c<0&&e.clockseq===void 0&&(a=a+1&16383),(c<0||l>ti)&&e.nsecs===void 0&&(u=0),u>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");ti=l,ni=u,ei=a,l+=122192928e5;var d=((l&268435455)*1e4+u)%4294967296;i[r++]=d>>>24&255,i[r++]=d>>>16&255,i[r++]=d>>>8&255,i[r++]=d&255;var f=l/4294967296*1e4&268435455;i[r++]=f>>>8&255,i[r++]=f&255,i[r++]=f>>>24&15|16,i[r++]=f>>>16&255,i[r++]=a>>>8|128,i[r++]=a&255;for(var p=0;p<6;++p)i[r+p]=o[p];return t||Gc(i)}var Wc=zc,Yc=br.exports,Qc=Hs;function Zc(e,t,n){var r=t&&n||0;typeof e=="string"&&(t=e==="binary"?new Array(16):null,e=null),e=e||{};var i=e.random||(e.rng||Yc)();if(i[6]=i[6]&15|64,i[8]=i[8]&63|128,t)for(var o=0;o<16;++o)t[r+o]=i[o];return t||Qc(i)}var Xc=Zc,Jc=Wc,$s=Xc,xo=$s;xo.v1=Jc;xo.v4=$s;var ed=xo;(function(e){Object.defineProperty(e,"__esModule",{value:!0});var t=ed;function n(){return t.v4()}e.generateUUID=n;function r(){return new Date().getTime()}e.getTimestamp=r;function i(d,f){for(var p=!1,v=Object.keys(d),h=0;h<v.length;h++)if(f===d[v[h]]){p=!0;break}return p}e.isValidEnum=i;function o(d,f){var p={};return d.forEach(function(v){var h=f(v);p[h]=p[h]||[],p[h].push(v)}),a(p)}e.groupBy=o;function a(d){return Object.keys(d).map(function(f){return d[f]})}e.objectValues=a;function s(d){return Object.keys(d).map(function(f){return[f,d[f]]})}e.objectEntries=s;function l(d,f){for(var p,v=0,h=d;v<h.length;v++){var g=h[v];if(f(g)){p=g;break}}return p}e.find=l;function u(d,f){var p={};return d.forEach(function(v){var h=f(v);p[h]=v}),p}e.keyBy=u;function c(d){for(var f=[],p=1;p<arguments.length;p++)f[p-1]=arguments[p];var v=0;return d.replace(/%s/g,function(){var h=f[v++],g=typeof h;return g==="function"?h():g==="string"?h:String(h)})}e.sprintf=c,function(d){d.ACTIVATE="ACTIVATE:experiment, user_id,attributes, variation, event",d.DECISION="DECISION:type, userId, attributes, decisionInfo",d.LOG_EVENT="LOG_EVENT:logEvent",d.OPTIMIZELY_CONFIG_UPDATE="OPTIMIZELY_CONFIG_UPDATE",d.TRACK="TRACK:event_key, user_id, attributes, event_tags, event"}(e.NOTIFICATION_TYPES||(e.NOTIFICATION_TYPES={}))})(dn);var td=Z&&Z.__spreadArrays||function(){for(var e=0,t=0,n=arguments.length;t<n;t++)e+=arguments[t].length;for(var r=Array(e),i=0,t=0;t<n;t++)for(var o=arguments[t],a=0,s=o.length;a<s;a++,i++)r[i]=o[a];return r};Object.defineProperty(St,"__esModule",{value:!0});var nd=$t,Er=dn,te=Eo,ya={NOTSET:0,DEBUG:1,INFO:2,WARNING:3,ERROR:4};function So(e){return typeof e!="string"||(e=e.toUpperCase(),e==="WARN"&&(e="WARNING"),!ya[e])?e:ya[e]}var Ks=function(){function e(){this.defaultLoggerFacade=new _a,this.loggers={}}return e.prototype.getLogger=function(t){return t?(this.loggers[t]||(this.loggers[t]=new _a({messagePrefix:t})),this.loggers[t]):this.defaultLoggerFacade},e}(),rd=function(){function e(t){t===void 0&&(t={}),this.logLevel=te.LogLevel.NOTSET,t.logLevel!==void 0&&Er.isValidEnum(te.LogLevel,t.logLevel)&&this.setLogLevel(t.logLevel),this.logToConsole=t.logToConsole!==void 0?!!t.logToConsole:!0,this.prefix=t.prefix!==void 0?t.prefix:"[OPTIMIZELY]"}return e.prototype.log=function(t,n){if(!(!this.shouldLog(t)||!this.logToConsole)){var r=this.prefix+" - "+this.getLogLevelName(t)+" "+this.getTime()+" "+n;this.consoleLog(t,[r])}},e.prototype.setLogLevel=function(t){t=So(t),!Er.isValidEnum(te.LogLevel,t)||t===void 0?this.logLevel=te.LogLevel.ERROR:this.logLevel=t},e.prototype.getTime=function(){return new Date().toISOString()},e.prototype.shouldLog=function(t){return t>=this.logLevel},e.prototype.getLogLevelName=function(t){switch(t){case te.LogLevel.DEBUG:return"DEBUG";case te.LogLevel.INFO:return"INFO ";case te.LogLevel.WARNING:return"WARN ";case te.LogLevel.ERROR:return"ERROR";default:return"NOTSET"}},e.prototype.consoleLog=function(t,n){switch(t){case te.LogLevel.DEBUG:console.log.apply(console,n);break;case te.LogLevel.INFO:console.info.apply(console,n);break;case te.LogLevel.WARNING:console.warn.apply(console,n);break;case te.LogLevel.ERROR:console.error.apply(console,n);break;default:console.log.apply(console,n)}},e}();St.ConsoleLogHandler=rd;var An=te.LogLevel.NOTSET,Ii=null,_a=function(){function e(t){t===void 0&&(t={}),this.messagePrefix="",t.messagePrefix&&(this.messagePrefix=t.messagePrefix)}return e.prototype.log=function(t,n){for(var r=[],i=2;i<arguments.length;i++)r[i-2]=arguments[i];this.internalLog(So(t),{message:n,splat:r})},e.prototype.info=function(t){for(var n=[],r=1;r<arguments.length;r++)n[r-1]=arguments[r];this.namedLog(te.LogLevel.INFO,t,n)},e.prototype.debug=function(t){for(var n=[],r=1;r<arguments.length;r++)n[r-1]=arguments[r];this.namedLog(te.LogLevel.DEBUG,t,n)},e.prototype.warn=function(t){for(var n=[],r=1;r<arguments.length;r++)n[r-1]=arguments[r];this.namedLog(te.LogLevel.WARNING,t,n)},e.prototype.error=function(t){for(var n=[],r=1;r<arguments.length;r++)n[r-1]=arguments[r];this.namedLog(te.LogLevel.ERROR,t,n)},e.prototype.format=function(t){return(this.messagePrefix?this.messagePrefix+": ":"")+Er.sprintf.apply(void 0,td([t.message],t.splat))},e.prototype.internalLog=function(t,n){!Ii||t<An||(Ii.log(t,this.format(n)),n.error&&n.error instanceof Error&&nd.getErrorHandler().handleError(n.error))},e.prototype.namedLog=function(t,n,r){var i;if(n instanceof Error){i=n,n=i.message,this.internalLog(t,{error:i,message:n,splat:r});return}if(r.length===0){this.internalLog(t,{message:n,splat:r});return}var o=r[r.length-1];o instanceof Error&&(i=o,r.splice(-1)),this.internalLog(t,{message:n,error:i,splat:r})},e}(),qs=new Ks;function id(e){return qs.getLogger(e)}St.getLogger=id;function od(e){Ii=e}St.setLogHandler=od;function ad(e){e=So(e),!Er.isValidEnum(te.LogLevel,e)||e===void 0?An=te.LogLevel.ERROR:An=e}St.setLogLevel=ad;function sd(){return An}St.getLogLevel=sd;function ld(){qs=new Ks,An=te.LogLevel.NOTSET}St.resetLogger=ld;(function(e){function t(n){for(var r in n)e.hasOwnProperty(r)||(e[r]=n[r])}Object.defineProperty(e,"__esModule",{value:!0}),t($t),t(Eo),t(St)})(ue);var ud={},Fn={};Object.defineProperty(Fn,"__esModule",{value:!0});Fn.areEventContextsEqual=void 0;function cd(e,t){var n=e.context,r=t.context;return n.accountId===r.accountId&&n.projectId===r.projectId&&n.clientName===r.clientName&&n.clientVersion===r.clientVersion&&n.revision===r.revision&&n.anonymizeIP===r.anonymizeIP&&n.botFiltering===r.botFiltering}Fn.areEventContextsEqual=cd;var Co={},tn={};Object.defineProperty(tn,"__esModule",{value:!0});tn.DefaultEventQueue=tn.SingleEventQueue=void 0;var dd=ue,fd=dd.getLogger("EventProcessor"),pd=function(){function e(t){var n=t.timeout,r=t.callback;this.timeout=Math.max(n,0),this.callback=r}return e.prototype.start=function(){this.timeoutId=setTimeout(this.callback,this.timeout)},e.prototype.refresh=function(){this.stop(),this.start()},e.prototype.stop=function(){this.timeoutId&&clearTimeout(this.timeoutId)},e}(),hd=function(){function e(t){var n=t.sink;this.sink=n}return e.prototype.start=function(){},e.prototype.stop=function(){return Promise.resolve()},e.prototype.enqueue=function(t){this.sink([t])},e}();tn.SingleEventQueue=hd;var vd=function(){function e(t){var n=t.flushInterval,r=t.maxQueueSize,i=t.sink,o=t.batchComparator;this.buffer=[],this.maxQueueSize=Math.max(r,1),this.sink=i,this.batchComparator=o,this.timer=new pd({callback:this.flush.bind(this),timeout:n}),this.started=!1}return e.prototype.start=function(){this.started=!0},e.prototype.stop=function(){this.started=!1;var t=this.sink(this.buffer);return this.buffer=[],this.timer.stop(),t},e.prototype.enqueue=function(t){if(!this.started){fd.warn("Queue is stopped, not accepting event");return}var n=this.buffer[0];n&&!this.batchComparator(n,t)&&this.flush(),this.buffer.length===0&&this.timer.refresh(),this.buffer.push(t),this.buffer.length>=this.maxQueueSize&&this.flush()},e.prototype.flush=function(){this.sink(this.buffer),this.buffer=[],this.timer.stop()},e}();tn.DefaultEventQueue=vd;(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.sendEventNotification=e.getQueue=e.validateAndGetBatchSize=e.validateAndGetFlushInterval=e.DEFAULT_BATCH_SIZE=e.DEFAULT_FLUSH_INTERVAL=void 0;var t=tn,n=ue,r=dn;e.DEFAULT_FLUSH_INTERVAL=3e4,e.DEFAULT_BATCH_SIZE=10;var i=n.getLogger("EventProcessor");function o(u){return u<=0&&(i.warn("Invalid flushInterval "+u+", defaulting to "+e.DEFAULT_FLUSH_INTERVAL),u=e.DEFAULT_FLUSH_INTERVAL),u}e.validateAndGetFlushInterval=o;function a(u){return u=Math.floor(u),u<1&&(i.warn("Invalid batchSize "+u+", defaulting to "+e.DEFAULT_BATCH_SIZE),u=e.DEFAULT_BATCH_SIZE),u=Math.max(1,u),u}e.validateAndGetBatchSize=a;function s(u,c,d,f){var p;return u>1?p=new t.DefaultEventQueue({flushInterval:c,maxQueueSize:u,sink:d,batchComparator:f}):p=new t.SingleEventQueue({sink:d}),p}e.getQueue=s;function l(u,c){u&&u.sendNotifications(r.NOTIFICATION_TYPES.LOG_EVENT,c)}e.sendEventNotification=l})(Co);var Gs={};Object.defineProperty(Gs,"__esModule",{value:!0});var zs={};Object.defineProperty(zs,"__esModule",{value:!0});var nn={},Hr={};Object.defineProperty(Hr,"__esModule",{value:!0});Hr.LocalStorageStore=void 0;var md=dn,gd=ue,wa=gd.getLogger("EventProcessor"),yd=function(){function e(t){var n=t.key,r=t.maxValues,i=r===void 0?1e3:r;this.LS_KEY=n,this.maxValues=i}return e.prototype.get=function(t){return this.getMap()[t]||null},e.prototype.set=function(t,n){var r=this.getMap();r[t]=n,this.replace(r)},e.prototype.remove=function(t){var n=this.getMap();delete n[t],this.replace(n)},e.prototype.values=function(){return md.objectValues(this.getMap())},e.prototype.clear=function(){this.replace({})},e.prototype.replace=function(t){try{window.localStorage&&localStorage.setItem(this.LS_KEY,JSON.stringify(t)),this.clean()}catch(n){wa.error(n)}},e.prototype.clean=function(){var t=this.getMap(),n=Object.keys(t),r=n.length-this.maxValues;if(!(r<1)){var i=n.map(function(a){return{key:a,value:t[a]}});i.sort(function(a,s){return a.value.timestamp-s.value.timestamp});for(var o=0;o<r;o++)delete t[i[o].key];this.replace(t)}},e.prototype.getMap=function(){try{var t=window.localStorage&&localStorage.getItem(this.LS_KEY);if(t)return JSON.parse(t)||{}}catch(n){wa.error(n)}return{}},e}();Hr.LocalStorageStore=yd;var _d=Z&&Z.__extends||function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,i){r.__proto__=i}||function(r,i){for(var o in i)Object.prototype.hasOwnProperty.call(i,o)&&(r[o]=i[o])},e(t,n)};return function(t,n){e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}();Object.defineProperty(nn,"__esModule",{value:!0});nn.LocalStoragePendingEventsDispatcher=nn.PendingEventsDispatcher=void 0;var wd=ue,bd=Hr,ba=dn,Ed=wd.getLogger("EventProcessor"),Ws=function(){function e(t){var n=t.eventDispatcher,r=t.store;this.dispatcher=n,this.store=r}return e.prototype.dispatchEvent=function(t,n){this.send({uuid:ba.generateUUID(),timestamp:ba.getTimestamp(),request:t},n)},e.prototype.sendPendingEvents=function(){var t=this,n=this.store.values();Ed.debug("Sending %s pending events from previous page",n.length),n.forEach(function(r){try{t.send(r,function(){})}catch{}})},e.prototype.send=function(t,n){var r=this;this.store.set(t.uuid,t),this.dispatcher.dispatchEvent(t.request,function(i){r.store.remove(t.uuid),n(i)})},e}();nn.PendingEventsDispatcher=Ws;var xd=function(e){_d(t,e);function t(n){var r=n.eventDispatcher;return e.call(this,{eventDispatcher:r,store:new bd.LocalStorageStore({maxValues:100,key:"fs_optly_pending_events"})})||this}return t}(Ws);nn.LocalStoragePendingEventsDispatcher=xd;var Me={},ki=Z&&Z.__assign||function(){return ki=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++){t=arguments[n];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])}return e},ki.apply(this,arguments)};Object.defineProperty(Me,"__esModule",{value:!0});Me.formatEvents=Me.buildConversionEventV1=Me.buildImpressionEventV1=Me.makeBatchedEventV1=void 0;var Sd="campaign_activated",Cd="custom",Ea="$opt_bot_filtering";function Ys(e){var t=[],n=e[0];return e.forEach(function(r){if(r.type==="conversion"||r.type==="impression"){var i=Io(r);r.type==="impression"?i.snapshots.push(Zs(r)):r.type==="conversion"&&i.snapshots.push(Qs(r)),t.push(i)}}),{client_name:n.context.clientName,client_version:n.context.clientVersion,account_id:n.context.accountId,project_id:n.context.projectId,revision:n.context.revision,anonymize_ip:n.context.anonymizeIP,enrich_decisions:!0,visitors:t}}Me.makeBatchedEventV1=Ys;function Qs(e){var t=ki({},e.tags);delete t.revenue,delete t.value;var n={entity_id:e.event.id,key:e.event.key,timestamp:e.timestamp,uuid:e.uuid};return e.tags&&(n.tags=e.tags),e.value!=null&&(n.value=e.value),e.revenue!=null&&(n.revenue=e.revenue),{events:[n]}}function Zs(e){var t,n,r=e.layer,i=e.experiment,o=e.variation,a=e.ruleKey,s=e.flagKey,l=e.ruleType,u=e.enabled,c=r?r.id:null,d=(t=i==null?void 0:i.id)!==null&&t!==void 0?t:"",f=(n=o==null?void 0:o.id)!==null&&n!==void 0?n:"",p=o?o.key:"";return{decisions:[{campaign_id:c,experiment_id:d,variation_id:f,metadata:{flag_key:s,rule_key:a,rule_type:l,variation_key:p,enabled:u}}],events:[{entity_id:c,timestamp:e.timestamp,key:Sd,uuid:e.uuid}]}}function Io(e){var t={snapshots:[],visitor_id:e.user.id,attributes:[]};return e.user.attributes.forEach(function(n){t.attributes.push({entity_id:n.entityId,key:n.key,type:"custom",value:n.value})}),typeof e.context.botFiltering=="boolean"&&t.attributes.push({entity_id:Ea,key:Ea,type:Cd,value:e.context.botFiltering}),t}function Id(e){var t=Io(e);return t.snapshots.push(Zs(e)),{client_name:e.context.clientName,client_version:e.context.clientVersion,account_id:e.context.accountId,project_id:e.context.projectId,revision:e.context.revision,anonymize_ip:e.context.anonymizeIP,enrich_decisions:!0,visitors:[t]}}Me.buildImpressionEventV1=Id;function kd(e){var t=Io(e);return t.snapshots.push(Qs(e)),{client_name:e.context.clientName,client_version:e.context.clientVersion,account_id:e.context.accountId,project_id:e.context.projectId,revision:e.context.revision,anonymize_ip:e.context.anonymizeIP,enrich_decisions:!0,visitors:[t]}}Me.buildConversionEventV1=kd;function Td(e){return{url:"https://logx.optimizely.com/v1/events",httpVerb:"POST",params:Ys(e)}}Me.formatEvents=Td;var $r={},ko={};Object.defineProperty(ko,"__esModule",{value:!0});var Ld=function(){function e(){this.reqsInFlightCount=0,this.reqsCompleteResolvers=[]}return e.prototype.trackRequest=function(t){var n=this;this.reqsInFlightCount++;var r=function(){n.reqsInFlightCount--,n.reqsInFlightCount===0&&(n.reqsCompleteResolvers.forEach(function(i){return i()}),n.reqsCompleteResolvers=[])};t.then(r,r)},e.prototype.onRequestsComplete=function(){var t=this;return new Promise(function(n){t.reqsInFlightCount===0?n():t.reqsCompleteResolvers.push(n)})},e}();ko.default=Ld;var Rd=Z&&Z.__awaiter||function(e,t,n,r){function i(o){return o instanceof n?o:new n(function(a){a(o)})}return new(n||(n=Promise))(function(o,a){function s(c){try{u(r.next(c))}catch(d){a(d)}}function l(c){try{u(r.throw(c))}catch(d){a(d)}}function u(c){c.done?o(c.value):i(c.value).then(s,l)}u((r=r.apply(e,t||[])).next())})},Ad=Z&&Z.__generator||function(e,t){var n={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},r,i,o,a;return a={next:s(0),throw:s(1),return:s(2)},typeof Symbol=="function"&&(a[Symbol.iterator]=function(){return this}),a;function s(u){return function(c){return l([u,c])}}function l(u){if(r)throw new TypeError("Generator is already executing.");for(;n;)try{if(r=1,i&&(o=u[0]&2?i.return:u[0]?i.throw||((o=i.return)&&o.call(i),0):i.next)&&!(o=o.call(i,u[1])).done)return o;switch(i=0,o&&(u=[u[0]&2,o.value]),u[0]){case 0:case 1:o=u;break;case 4:return n.label++,{value:u[1],done:!1};case 5:n.label++,i=u[1],u=[0];continue;case 7:u=n.ops.pop(),n.trys.pop();continue;default:if(o=n.trys,!(o=o.length>0&&o[o.length-1])&&(u[0]===6||u[0]===2)){n=0;continue}if(u[0]===3&&(!o||u[1]>o[0]&&u[1]<o[3])){n.label=u[1];break}if(u[0]===6&&n.label<o[1]){n.label=o[1],o=u;break}if(o&&n.label<o[2]){n.label=o[2],n.ops.push(u);break}o[2]&&n.ops.pop(),n.trys.pop();continue}u=t.call(e,n)}catch(c){u=[6,c],i=0}finally{r=o=0}if(u[0]&5)throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}},Ud=Z&&Z.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty($r,"__esModule",{value:!0});$r.LogTierV1EventProcessor=void 0;var Od=ue,zt=Co,Dd=Ud(ko),Pd=Fn,Nd=Me,xa=Od.getLogger("LogTierV1EventProcessor"),Md=function(){function e(t){var n=t.dispatcher,r=t.flushInterval,i=r===void 0?zt.DEFAULT_FLUSH_INTERVAL:r,o=t.batchSize,a=o===void 0?zt.DEFAULT_BATCH_SIZE:o,s=t.notificationCenter;this.dispatcher=n,this.notificationCenter=s,this.requestTracker=new Dd.default,i=zt.validateAndGetFlushInterval(i),a=zt.validateAndGetBatchSize(a),this.queue=zt.getQueue(a,i,this.drainQueue.bind(this),Pd.areEventContextsEqual)}return e.prototype.drainQueue=function(t){var n=this,r=new Promise(function(i){if(xa.debug("draining queue with %s events",t.length),t.length===0){i();return}var o=Nd.formatEvents(t);n.dispatcher.dispatchEvent(o,function(){i()}),zt.sendEventNotification(n.notificationCenter,o)});return this.requestTracker.trackRequest(r),r},e.prototype.process=function(t){this.queue.enqueue(t)},e.prototype.stop=function(){try{return this.queue.stop(),this.requestTracker.onRequestsComplete()}catch(t){xa.error('Error stopping EventProcessor: "%s"',t.message,t)}return Promise.resolve()},e.prototype.start=function(){return Rd(this,void 0,void 0,function(){return Ad(this,function(t){return this.queue.start(),[2]})})},e}();$r.LogTierV1EventProcessor=Md;(function(e){var t=Z&&Z.__createBinding||(Object.create?function(r,i,o,a){a===void 0&&(a=o),Object.defineProperty(r,a,{enumerable:!0,get:function(){return i[o]}})}:function(r,i,o,a){a===void 0&&(a=o),r[a]=i[o]}),n=Z&&Z.__exportStar||function(r,i){for(var o in r)o!=="default"&&!Object.prototype.hasOwnProperty.call(i,o)&&t(i,r,o)};Object.defineProperty(e,"__esModule",{value:!0}),n(Fn,e),n(Co,e),n(Gs,e),n(zs,e),n(nn,e),n(Me,e),n($r,e)})(ud);var xr={exports:{}},Sa=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||typeof msCrypto<"u"&&typeof window.msCrypto.getRandomValues=="function"&&msCrypto.getRandomValues.bind(msCrypto);if(Sa){var Ca=new Uint8Array(16);xr.exports=function(){return Sa(Ca),Ca}}else{var Ia=new Array(16);xr.exports=function(){for(var t=0,n;t<16;t++)(t&3)===0&&(n=Math.random()*4294967296),Ia[t]=n>>>((t&3)<<3)&255;return Ia}}var Xs=[];for(var Xn=0;Xn<256;++Xn)Xs[Xn]=(Xn+256).toString(16).substr(1);function Vd(e,t){var n=t||0,r=Xs;return[r[e[n++]],r[e[n++]],r[e[n++]],r[e[n++]],"-",r[e[n++]],r[e[n++]],"-",r[e[n++]],r[e[n++]],"-",r[e[n++]],r[e[n++]],"-",r[e[n++]],r[e[n++]],r[e[n++]],r[e[n++]],r[e[n++]],r[e[n++]]].join("")}var Js=Vd,jd=xr.exports,Bd=Js,ka,ri,ii=0,oi=0;function Fd(e,t,n){var r=t&&n||0,i=t||[];e=e||{};var o=e.node||ka,a=e.clockseq!==void 0?e.clockseq:ri;if(o==null||a==null){var s=jd();o==null&&(o=ka=[s[0]|1,s[1],s[2],s[3],s[4],s[5]]),a==null&&(a=ri=(s[6]<<8|s[7])&16383)}var l=e.msecs!==void 0?e.msecs:new Date().getTime(),u=e.nsecs!==void 0?e.nsecs:oi+1,c=l-ii+(u-oi)/1e4;if(c<0&&e.clockseq===void 0&&(a=a+1&16383),(c<0||l>ii)&&e.nsecs===void 0&&(u=0),u>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");ii=l,oi=u,ri=a,l+=122192928e5;var d=((l&268435455)*1e4+u)%4294967296;i[r++]=d>>>24&255,i[r++]=d>>>16&255,i[r++]=d>>>8&255,i[r++]=d&255;var f=l/4294967296*1e4&268435455;i[r++]=f>>>8&255,i[r++]=f&255,i[r++]=f>>>24&15|16,i[r++]=f>>>16&255,i[r++]=a>>>8|128,i[r++]=a&255;for(var p=0;p<6;++p)i[r+p]=o[p];return t||Bd(i)}var Hd=Fd,$d=xr.exports,Kd=Js;function qd(e,t,n){var r=t&&n||0;typeof e=="string"&&(t=e==="binary"?new Array(16):null,e=null),e=e||{};var i=e.random||(e.rng||$d)();if(i[6]=i[6]&15|64,i[8]=i[8]&63|128,t)for(var o=0;o<16;++o)t[r+o]=i[o];return t||Kd(i)}var Gd=qd,zd=Hd,el=Gd,tl=el;tl.v1=zd;tl.v4=el;var Wd={exports:{}};(function(e){(function(){function t(i,o){for(var a=i.length,s=o^a,l=0,u;a>=4;)u=i.charCodeAt(l)&255|(i.charCodeAt(++l)&255)<<8|(i.charCodeAt(++l)&255)<<16|(i.charCodeAt(++l)&255)<<24,u=(u&65535)*1540483477+(((u>>>16)*1540483477&65535)<<16),u^=u>>>24,u=(u&65535)*1540483477+(((u>>>16)*1540483477&65535)<<16),s=(s&65535)*1540483477+(((s>>>16)*1540483477&65535)<<16)^u,a-=4,++l;switch(a){case 3:s^=(i.charCodeAt(l+2)&255)<<16;case 2:s^=(i.charCodeAt(l+1)&255)<<8;case 1:s^=i.charCodeAt(l)&255,s=(s&65535)*1540483477+(((s>>>16)*1540483477&65535)<<16)}return s^=s>>>13,s=(s&65535)*1540483477+(((s>>>16)*1540483477&65535)<<16),s^=s>>>15,s>>>0}function n(i,o){var a,s,l,u,c,d,f,p;for(a=i.length&3,s=i.length-a,l=o,c=3432918353,d=461845907,p=0;p<s;)f=i.charCodeAt(p)&255|(i.charCodeAt(++p)&255)<<8|(i.charCodeAt(++p)&255)<<16|(i.charCodeAt(++p)&255)<<24,++p,f=(f&65535)*c+(((f>>>16)*c&65535)<<16)&4294967295,f=f<<15|f>>>17,f=(f&65535)*d+(((f>>>16)*d&65535)<<16)&4294967295,l^=f,l=l<<13|l>>>19,u=(l&65535)*5+(((l>>>16)*5&65535)<<16)&4294967295,l=(u&65535)+27492+(((u>>>16)+58964&65535)<<16);switch(f=0,a){case 3:f^=(i.charCodeAt(p+2)&255)<<16;case 2:f^=(i.charCodeAt(p+1)&255)<<8;case 1:f^=i.charCodeAt(p)&255,f=(f&65535)*c+(((f>>>16)*c&65535)<<16)&4294967295,f=f<<15|f>>>17,f=(f&65535)*d+(((f>>>16)*d&65535)<<16)&4294967295,l^=f}return l^=i.length,l^=l>>>16,l=(l&65535)*2246822507+(((l>>>16)*2246822507&65535)<<16)&4294967295,l^=l>>>13,l=(l&65535)*3266489909+(((l>>>16)*3266489909&65535)<<16)&4294967295,l^=l>>>16,l>>>0}var r=n;r.v2=t,r.v3=n,e.exports=r})()})(Wd);var nl={},To={},Lo={},ze={};Object.defineProperty(ze,"__esModule",{value:!0});ze.DEFAULT_UPDATE_INTERVAL=5*60*1e3;ze.MIN_UPDATE_INTERVAL=1e3;ze.DEFAULT_URL_TEMPLATE="https://cdn.optimizely.com/datafiles/%s.json";ze.DEFAULT_AUTHENTICATED_URL_TEMPLATE="https://config.optimizely.com/datafiles/auth/%s.json";ze.BACKOFF_BASE_WAIT_SECONDS_BY_ERROR_COUNT=[0,8,16,32,64,128,256,512];ze.REQUEST_TIMEOUT_MS=60*1e3;Object.defineProperty(Lo,"__esModule",{value:!0});var Yd=ze,Qd=ue,Zd=Qd.getLogger("DatafileManager"),Xd="GET",Jd=4;function ef(e){var t=e.getAllResponseHeaders();if(t===null)return{};var n=t.split(`\r
|
|
2
|
-
`),r={};return n.forEach(function(i){var o=i.indexOf(": ");if(o>-1){var a=i.slice(0,o),s=i.slice(o+2);s.length>0&&(r[a]=s)}}),r}function tf(e,t){Object.keys(e).forEach(function(n){var r=e[n];t.setRequestHeader(n,r)})}function nf(e,t){var n=new XMLHttpRequest,r=new Promise(function(i,o){n.open(Xd,e,!0),tf(t,n),n.onreadystatechange=function(){if(n.readyState===Jd){var a=n.status;if(a===0){o(new Error("Request error"));return}var s=ef(n),l={statusCode:n.status,body:n.responseText,headers:s};i(l)}},n.timeout=Yd.REQUEST_TIMEOUT_MS,n.ontimeout=function(){Zd.error("Request timed out")},n.send()});return{responsePromise:r,abort:function(){n.abort()}}}Lo.makeGetRequest=nf;var Ro={},Ao={};Object.defineProperty(Ao,"__esModule",{value:!0});var rf=function(){function e(){this.listeners={},this.listenerId=1}return e.prototype.on=function(t,n){var r=this;this.listeners[t]||(this.listeners[t]={});var i=String(this.listenerId);return this.listenerId++,this.listeners[t][i]=n,function(){r.listeners[t]&&delete r.listeners[t][i]}},e.prototype.emit=function(t,n){var r=this.listeners[t];r&&Object.keys(r).forEach(function(i){var o=r[i];o(n)})},e.prototype.removeAllListeners=function(){this.listeners={}},e}();Ao.default=rf;var Uo={};Object.defineProperty(Uo,"__esModule",{value:!0});var ai=ze;function of(){return Math.round(Math.random()*1e3)}var af=function(){function e(){this.errorCount=0}return e.prototype.getDelay=function(){if(this.errorCount===0)return 0;var t=ai.BACKOFF_BASE_WAIT_SECONDS_BY_ERROR_COUNT[Math.min(ai.BACKOFF_BASE_WAIT_SECONDS_BY_ERROR_COUNT.length-1,this.errorCount)];return t*1e3+of()},e.prototype.countError=function(){this.errorCount<ai.BACKOFF_BASE_WAIT_SECONDS_BY_ERROR_COUNT.length-1&&this.errorCount++},e.prototype.reset=function(){this.errorCount=0},e}();Uo.default=af;var Sr=Z&&Z.__assign||function(){return Sr=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++){t=arguments[n];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])}return e},Sr.apply(this,arguments)},rl=Z&&Z.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Ro,"__esModule",{value:!0});var sf=ue,lf=dn,uf=rl(Ao),wn=ze,cf=rl(Uo),ke=sf.getLogger("DatafileManager"),df="update";function ff(e){return e>=wn.MIN_UPDATE_INTERVAL}function Ta(e){return e>=200&&e<400}var pf={get:function(){return Promise.resolve("")},set:function(){return Promise.resolve()},contains:function(){return Promise.resolve(!1)},remove:function(){return Promise.resolve()}},hf=function(){function e(t){var n=this,r=Sr(Sr({},this.getConfigDefaults()),t),i=r.datafile,o=r.autoUpdate,a=o===void 0?!1:o,s=r.sdkKey,l=r.updateInterval,u=l===void 0?wn.DEFAULT_UPDATE_INTERVAL:l,c=r.urlTemplate,d=c===void 0?wn.DEFAULT_URL_TEMPLATE:c,f=r.cache,p=f===void 0?pf:f;this.cache=p,this.cacheKey="opt-datafile-"+s,this.isReadyPromiseSettled=!1,this.readyPromiseResolver=function(){},this.readyPromiseRejecter=function(){},this.readyPromise=new Promise(function(v,h){n.readyPromiseResolver=v,n.readyPromiseRejecter=h}),i?(this.currentDatafile=i,s||this.resolveReadyPromise()):this.currentDatafile="",this.isStarted=!1,this.datafileUrl=lf.sprintf(d,s),this.emitter=new uf.default,this.autoUpdate=a,ff(u)?this.updateInterval=u:(ke.warn("Invalid updateInterval %s, defaulting to %s",u,wn.DEFAULT_UPDATE_INTERVAL),this.updateInterval=wn.DEFAULT_UPDATE_INTERVAL),this.currentTimeout=null,this.currentRequest=null,this.backoffController=new cf.default,this.syncOnCurrentRequestComplete=!1}return e.prototype.get=function(){return this.currentDatafile},e.prototype.start=function(){this.isStarted||(ke.debug("Datafile manager started"),this.isStarted=!0,this.backoffController.reset(),this.setDatafileFromCacheIfAvailable(),this.syncDatafile())},e.prototype.stop=function(){return ke.debug("Datafile manager stopped"),this.isStarted=!1,this.currentTimeout&&(clearTimeout(this.currentTimeout),this.currentTimeout=null),this.emitter.removeAllListeners(),this.currentRequest&&(this.currentRequest.abort(),this.currentRequest=null),Promise.resolve()},e.prototype.onReady=function(){return this.readyPromise},e.prototype.on=function(t,n){return this.emitter.on(t,n)},e.prototype.onRequestRejected=function(t){!this.isStarted||(this.backoffController.countError(),t instanceof Error?ke.error("Error fetching datafile: %s",t.message,t):typeof t=="string"?ke.error("Error fetching datafile: %s",t):ke.error("Error fetching datafile"))},e.prototype.onRequestResolved=function(t){if(!!this.isStarted){typeof t.statusCode<"u"&&Ta(t.statusCode)?this.backoffController.reset():this.backoffController.countError(),this.trySavingLastModified(t.headers);var n=this.getNextDatafileFromResponse(t);if(n!=="")if(ke.info("Updating datafile from response"),this.currentDatafile=n,this.cache.set(this.cacheKey,n),!this.isReadyPromiseSettled)this.resolveReadyPromise();else{var r={datafile:n};this.emitter.emit(df,r)}}},e.prototype.onRequestComplete=function(){!this.isStarted||(this.currentRequest=null,!this.isReadyPromiseSettled&&!this.autoUpdate&&this.rejectReadyPromise(new Error("Failed to become ready")),this.autoUpdate&&this.syncOnCurrentRequestComplete&&this.syncDatafile(),this.syncOnCurrentRequestComplete=!1)},e.prototype.syncDatafile=function(){var t=this,n={};this.lastResponseLastModified&&(n["if-modified-since"]=this.lastResponseLastModified),ke.debug("Making datafile request to url %s with headers: %s",this.datafileUrl,function(){return JSON.stringify(n)}),this.currentRequest=this.makeGetRequest(this.datafileUrl,n);var r=function(){t.onRequestComplete()},i=function(a){t.onRequestResolved(a)},o=function(a){t.onRequestRejected(a)};this.currentRequest.responsePromise.then(i,o).then(r,r),this.autoUpdate&&this.scheduleNextUpdate()},e.prototype.resolveReadyPromise=function(){this.readyPromiseResolver(),this.isReadyPromiseSettled=!0},e.prototype.rejectReadyPromise=function(t){this.readyPromiseRejecter(t),this.isReadyPromiseSettled=!0},e.prototype.scheduleNextUpdate=function(){var t=this,n=this.backoffController.getDelay(),r=Math.max(n,this.updateInterval);ke.debug("Scheduling sync in %s ms",r),this.currentTimeout=setTimeout(function(){t.currentRequest?t.syncOnCurrentRequestComplete=!0:t.syncDatafile()},r)},e.prototype.getNextDatafileFromResponse=function(t){return ke.debug("Response status code: %s",t.statusCode),typeof t.statusCode>"u"||t.statusCode===304?"":Ta(t.statusCode)?t.body:""},e.prototype.trySavingLastModified=function(t){var n=t["last-modified"]||t["Last-Modified"];typeof n<"u"&&(this.lastResponseLastModified=n,ke.debug("Saved last modified header value from response: %s",this.lastResponseLastModified))},e.prototype.setDatafileFromCacheIfAvailable=function(){var t=this;this.cache.get(this.cacheKey).then(function(n){t.isStarted&&!t.isReadyPromiseSettled&&n!==""&&(ke.debug("Using datafile from cache"),t.currentDatafile=n,t.resolveReadyPromise())})},e}();Ro.default=hf;var vf=Z&&Z.__extends||function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,i){r.__proto__=i}||function(r,i){for(var o in i)i.hasOwnProperty(o)&&(r[o]=i[o])},e(t,n)};return function(t,n){e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}(),mf=Z&&Z.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(To,"__esModule",{value:!0});var gf=Lo,yf=mf(Ro),_f=function(e){vf(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.makeGetRequest=function(n,r){return gf.makeGetRequest(n,r)},t.prototype.getConfigDefaults=function(){return{autoUpdate:!1}},t}(yf.default);To.default=_f;Object.defineProperty(nl,"__esModule",{value:!0});var wf=To;nl.HttpPollingDatafileManager=wf.default;var bf={NOTSET:0,DEBUG:1,INFO:2,WARNING:3,ERROR:4},Ef={CONDITION_EVALUATOR_ERROR:"%s: Error evaluating audience condition of type %s: %s",DATAFILE_AND_SDK_KEY_MISSING:"%s: You must provide at least one of sdkKey or datafile. Cannot start Optimizely",EXPERIMENT_KEY_NOT_IN_DATAFILE:"%s: Experiment key %s is not in datafile.",FEATURE_NOT_IN_DATAFILE:"%s: Feature key %s is not in datafile.",IMPROPERLY_FORMATTED_EXPERIMENT:"%s: Experiment key %s is improperly formatted.",INVALID_ATTRIBUTES:"%s: Provided attributes are in an invalid format.",INVALID_BUCKETING_ID:"%s: Unable to generate hash for bucketing ID %s: %s",INVALID_DATAFILE:"%s: Datafile is invalid - property %s: %s",INVALID_DATAFILE_MALFORMED:"%s: Datafile is invalid because it is malformed.",INVALID_CONFIG:"%s: Provided Optimizely config is in an invalid format.",INVALID_JSON:"%s: JSON object is not valid.",INVALID_ERROR_HANDLER:'%s: Provided "errorHandler" is in an invalid format.',INVALID_EVENT_DISPATCHER:'%s: Provided "eventDispatcher" is in an invalid format.',INVALID_EVENT_TAGS:"%s: Provided event tags are in an invalid format.",INVALID_EXPERIMENT_KEY:"%s: Experiment key %s is not in datafile. It is either invalid, paused, or archived.",INVALID_EXPERIMENT_ID:"%s: Experiment ID %s is not in datafile.",INVALID_GROUP_ID:"%s: Group ID %s is not in datafile.",INVALID_LOGGER:'%s: Provided "logger" is in an invalid format.',INVALID_ROLLOUT_ID:"%s: Invalid rollout ID %s attached to feature %s",INVALID_USER_ID:"%s: Provided user ID is in an invalid format.",INVALID_USER_PROFILE_SERVICE:"%s: Provided user profile service instance is in an invalid format: %s.",NO_DATAFILE_SPECIFIED:"%s: No datafile specified. Cannot start optimizely.",NO_JSON_PROVIDED:"%s: No JSON object to validate against schema.",NO_VARIATION_FOR_EXPERIMENT_KEY:"%s: No variation key %s defined in datafile for experiment %s.",UNDEFINED_ATTRIBUTE:"%s: Provided attribute: %s has an undefined value.",UNRECOGNIZED_ATTRIBUTE:"%s: Unrecognized attribute %s provided. Pruning before sending event to Optimizely.",UNABLE_TO_CAST_VALUE:"%s: Unable to cast value %s to type %s, returning null.",USER_NOT_IN_FORCED_VARIATION:"%s: User %s is not in the forced variation map. Cannot remove their forced variation.",USER_PROFILE_LOOKUP_ERROR:'%s: Error while looking up user profile for user ID "%s": %s.',USER_PROFILE_SAVE_ERROR:'%s: Error while saving user profile for user ID "%s": %s.',VARIABLE_KEY_NOT_IN_DATAFILE:'%s: Variable with key "%s" associated with feature with key "%s" is not in datafile.',VARIATION_ID_NOT_IN_DATAFILE:"%s: No variation ID %s defined in datafile for experiment %s.",VARIATION_ID_NOT_IN_DATAFILE_NO_EXPERIMENT:"%s: Variation ID %s is not in the datafile.",INVALID_INPUT_FORMAT:"%s: Provided %s is in an invalid format.",INVALID_DATAFILE_VERSION:"%s: This version of the JavaScript SDK does not support the given datafile version: %s",INVALID_VARIATION_KEY:"%s: Provided variation key is in an invalid format."},xf={ACTIVATE_USER:"%s: Activating user %s in experiment %s.",DISPATCH_CONVERSION_EVENT:"%s: Dispatching conversion event to URL %s with params %s.",DISPATCH_IMPRESSION_EVENT:"%s: Dispatching impression event to URL %s with params %s.",DEPRECATED_EVENT_VALUE:"%s: Event value is deprecated in %s call.",EVENT_KEY_NOT_FOUND:"%s: Event key %s is not in datafile.",EXPERIMENT_NOT_RUNNING:"%s: Experiment %s is not running.",FEATURE_ENABLED_FOR_USER:"%s: Feature %s is enabled for user %s.",FEATURE_NOT_ENABLED_FOR_USER:"%s: Feature %s is not enabled for user %s.",FEATURE_HAS_NO_EXPERIMENTS:"%s: Feature %s is not attached to any experiments.",FAILED_TO_PARSE_VALUE:'%s: Failed to parse event value "%s" from event tags.',FAILED_TO_PARSE_REVENUE:'%s: Failed to parse revenue value "%s" from event tags.',FORCED_BUCKETING_FAILED:"%s: Variation key %s is not in datafile. Not activating user %s.",INVALID_OBJECT:"%s: Optimizely object is not valid. Failing %s.",INVALID_CLIENT_ENGINE:"%s: Invalid client engine passed: %s. Defaulting to node-sdk.",INVALID_DEFAULT_DECIDE_OPTIONS:"%s: Provided default decide options is not an array.",INVALID_DECIDE_OPTIONS:"%s: Provided decide options is not an array. Using default decide options.",INVALID_VARIATION_ID:"%s: Bucketed into an invalid variation ID. Returning null.",NOTIFICATION_LISTENER_EXCEPTION:"%s: Notification listener for (%s) threw exception: %s",NO_ROLLOUT_EXISTS:"%s: There is no rollout of feature %s.",NOT_ACTIVATING_USER:"%s: Not activating user %s for experiment %s.",NOT_TRACKING_USER:"%s: Not tracking user %s.",PARSED_REVENUE_VALUE:'%s: Parsed revenue value "%s" from event tags.',PARSED_NUMERIC_VALUE:'%s: Parsed event value "%s" from event tags.',RETURNING_STORED_VARIATION:'%s: Returning previously activated variation "%s" of experiment "%s" for user "%s" from user profile.',ROLLOUT_HAS_NO_EXPERIMENTS:"%s: Rollout of feature %s has no experiments",SAVED_VARIATION:'%s: Saved variation "%s" of experiment "%s" for user "%s".',SAVED_VARIATION_NOT_FOUND:"%s: User %s was previously bucketed into variation with ID %s for experiment %s, but no matching variation was found.",SHOULD_NOT_DISPATCH_ACTIVATE:'%s: Experiment %s is not in "Running" state. Not activating user.',SKIPPING_JSON_VALIDATION:"%s: Skipping JSON schema validation.",TRACK_EVENT:"%s: Tracking event %s for user %s.",UNRECOGNIZED_DECIDE_OPTION:"%s: Unrecognized decide option %s provided.",USER_ASSIGNED_TO_EXPERIMENT_BUCKET:"%s: Assigned bucket %s to user with bucketing ID %s.",USER_BUCKETED_INTO_EXPERIMENT_IN_GROUP:"%s: User %s is in experiment %s of group %s.",USER_BUCKETED_INTO_TARGETING_RULE:"%s: User %s bucketed into targeting rule %s.",USER_IN_FEATURE_EXPERIMENT:"%s: User %s is in variation %s of experiment %s on the feature %s.",USER_IN_ROLLOUT:"%s: User %s is in rollout of feature %s.",USER_NOT_BUCKETED_INTO_EVERYONE_TARGETING_RULE:"%s: User %s not bucketed into everyone targeting rule due to traffic allocation.",USER_NOT_BUCKETED_INTO_EXPERIMENT_IN_GROUP:"%s: User %s is not in experiment %s of group %s.",USER_NOT_BUCKETED_INTO_ANY_EXPERIMENT_IN_GROUP:"%s: User %s is not in any experiment of group %s.",USER_NOT_BUCKETED_INTO_TARGETING_RULE:"%s User %s not bucketed into targeting rule %s due to traffic allocation. Trying everyone rule.",USER_NOT_IN_FEATURE_EXPERIMENT:"%s: User %s is not in any experiment on the feature %s.",USER_NOT_IN_ROLLOUT:"%s: User %s is not in rollout of feature %s.",USER_FORCED_IN_VARIATION:"%s: User %s is forced in variation %s.",USER_MAPPED_TO_FORCED_VARIATION:"%s: Set variation %s for experiment %s and user %s in the forced variation map.",USER_DOESNT_MEET_CONDITIONS_FOR_TARGETING_RULE:"%s: User %s does not meet conditions for targeting rule %s.",USER_MEETS_CONDITIONS_FOR_TARGETING_RULE:"%s: User %s meets conditions for targeting rule %s.",USER_HAS_VARIATION:"%s: User %s is in variation %s of experiment %s.",USER_HAS_FORCED_DECISION_WITH_RULE_SPECIFIED:"Variation (%s) is mapped to flag (%s), rule (%s) and user (%s) in the forced decision map.",USER_HAS_FORCED_DECISION_WITH_NO_RULE_SPECIFIED:"Variation (%s) is mapped to flag (%s) and user (%s) in the forced decision map.",USER_HAS_FORCED_DECISION_WITH_RULE_SPECIFIED_BUT_INVALID:"Invalid variation is mapped to flag (%s), rule (%s) and user (%s) in the forced decision map.",USER_HAS_FORCED_DECISION_WITH_NO_RULE_SPECIFIED_BUT_INVALID:"Invalid variation is mapped to flag (%s) and user (%s) in the forced decision map.",USER_HAS_FORCED_VARIATION:"%s: Variation %s is mapped to experiment %s and user %s in the forced variation map.",USER_HAS_NO_VARIATION:"%s: User %s is in no variation of experiment %s.",USER_HAS_NO_FORCED_VARIATION:"%s: User %s is not in the forced variation map.",USER_HAS_NO_FORCED_VARIATION_FOR_EXPERIMENT:"%s: No experiment %s mapped to user %s in the forced variation map.",USER_NOT_IN_ANY_EXPERIMENT:"%s: User %s is not in any experiment of group %s.",USER_NOT_IN_EXPERIMENT:"%s: User %s does not meet conditions to be in experiment %s.",USER_RECEIVED_DEFAULT_VARIABLE_VALUE:'%s: User "%s" is not in any variation or rollout rule. Returning default value for variable "%s" of feature flag "%s".',FEATURE_NOT_ENABLED_RETURN_DEFAULT_VARIABLE_VALUE:'%s: Feature "%s" is not enabled for user %s. Returning the default variable value "%s".',VARIABLE_NOT_USED_RETURN_DEFAULT_VARIABLE_VALUE:'%s: Variable "%s" is not used in variation "%s". Returning default value.',USER_RECEIVED_VARIABLE_VALUE:'%s: Got variable value "%s" for variable "%s" of feature flag "%s"',VALID_DATAFILE:"%s: Datafile is valid.",VALID_USER_PROFILE_SERVICE:"%s: Valid user profile service provided.",VARIATION_REMOVED_FOR_USER:"%s: Variation mapped to experiment %s has been removed for user %s.",VARIABLE_REQUESTED_WITH_WRONG_TYPE:'%s: Requested variable type "%s", but variable is of type "%s". Use correct API to retrieve value. Returning None.',VALID_BUCKETING_ID:'%s: BucketingId is valid: "%s"',BUCKETING_ID_NOT_STRING:"%s: BucketingID attribute is not a string. Defaulted to userId",EVALUATING_AUDIENCE:'%s: Starting to evaluate audience "%s" with conditions: %s.',EVALUATING_AUDIENCES_COMBINED:'%s: Evaluating audiences for %s "%s": %s.',AUDIENCE_EVALUATION_RESULT:'%s: Audience "%s" evaluated to %s.',AUDIENCE_EVALUATION_RESULT_COMBINED:"%s: Audiences for %s %s collectively evaluated to %s.",MISSING_ATTRIBUTE_VALUE:'%s: Audience condition %s evaluated to UNKNOWN because no value was passed for user attribute "%s".',UNEXPECTED_CONDITION_VALUE:"%s: Audience condition %s evaluated to UNKNOWN because the condition value is not supported.",UNEXPECTED_TYPE:'%s: Audience condition %s evaluated to UNKNOWN because a value of type "%s" was passed for user attribute "%s".',UNEXPECTED_TYPE_NULL:'%s: Audience condition %s evaluated to UNKNOWN because a null value was passed for user attribute "%s".',UNKNOWN_CONDITION_TYPE:"%s: Audience condition %s has an unknown condition type. You may need to upgrade to a newer release of the Optimizely SDK.",UNKNOWN_MATCH_TYPE:"%s: Audience condition %s uses an unknown match type. You may need to upgrade to a newer release of the Optimizely SDK.",UPDATED_OPTIMIZELY_CONFIG:"%s: Updated Optimizely config to revision %s (project id %s)",OUT_OF_BOUNDS:'%s: Audience condition %s evaluated to UNKNOWN because the number value for user attribute "%s" is not in the range [-2^53, +2^53].',UNABLE_TO_ATTACH_UNLOAD:'%s: unable to bind optimizely.close() to page unload event: "%s"'},Sf={BOT_FILTERING:"$opt_bot_filtering",BUCKETING_ID:"$opt_bucketing_id",STICKY_BUCKETING_KEY:"$opt_experiment_bucket_map",USER_AGENT:"$opt_user_agent",FORCED_DECISION_NULL_RULE_KEY:"$opt_null_rule_key"},Cf="javascript-sdk",If="node-sdk",kf="react-sdk",Tf="react-native-sdk",Lf="react-native-js-sdk",Rf="4.9.4",Af="4.9.4",Uf={AB_TEST:"ab-test",FEATURE:"feature",FEATURE_TEST:"feature-test",FEATURE_VARIABLE:"feature-variable",ALL_FEATURE_VARIABLES:"all-feature-variables",FLAG:"flag"},Of={FEATURE_TEST:"feature-test",ROLLOUT:"rollout",EXPERIMENT:"experiment"},Df={RULE:"rule",EXPERIMENT:"experiment"},Pf={BOOLEAN:"boolean",DOUBLE:"double",INTEGER:"integer",STRING:"string",JSON:"json"},sr={V2:"2",V3:"3",V4:"4"},Nf={SDK_NOT_READY:"Optimizely SDK not configured properly yet.",FLAG_KEY_INVALID:'No flag was found for key "%s".',VARIABLE_VALUE_INVALID:'Variable value for key "%s" is invalid or wrong type.'},Ti;(function(e){e.ACTIVATE="ACTIVATE:experiment, user_id,attributes, variation, event",e.DECISION="DECISION:type, userId, attributes, decisionInfo",e.LOG_EVENT="LOG_EVENT:logEvent",e.OPTIMIZELY_CONFIG_UPDATE="OPTIMIZELY_CONFIG_UPDATE",e.TRACK="TRACK:event_key, user_id, attributes, event_tags, event"})(Ti||(Ti={}));var Mf=Object.freeze({__proto__:null,LOG_LEVEL:bf,ERROR_MESSAGES:Ef,LOG_MESSAGES:xf,CONTROL_ATTRIBUTES:Sf,JAVASCRIPT_CLIENT_ENGINE:Cf,NODE_CLIENT_ENGINE:If,REACT_CLIENT_ENGINE:kf,REACT_NATIVE_CLIENT_ENGINE:Tf,REACT_NATIVE_JS_CLIENT_ENGINE:Lf,BROWSER_CLIENT_VERSION:Rf,NODE_CLIENT_VERSION:Af,DECISION_NOTIFICATION_TYPES:Uf,DECISION_SOURCES:Of,AUDIENCE_EVALUATION_TYPES:Df,FEATURE_VARIABLE_TYPES:Pf,DATAFILE_VERSIONS:sr,DECISION_MESSAGES:Nf,get NOTIFICATION_TYPES(){return Ti}});sr.V2,sr.V3,sr.V4;(function(){function e(){}return e.prototype.log=function(){},e})();function Vf(e){return new ue.ConsoleLogHandler(e)}var La;(function(e){e.BOOLEAN="boolean",e.DOUBLE="double",e.INTEGER="integer",e.STRING="string",e.JSON="json"})(La||(La={}));var Ra;(function(e){e.DISABLE_DECISION_EVENT="DISABLE_DECISION_EVENT",e.ENABLED_FLAGS_ONLY="ENABLED_FLAGS_ONLY",e.IGNORE_USER_PROFILE_SERVICE="IGNORE_USER_PROFILE_SERVICE",e.INCLUDE_REASONS="INCLUDE_REASONS",e.EXCLUDE_VARIABLES="EXCLUDE_VARIABLES"})(Ra||(Ra={}));ue.getLogger();ue.getLogger();ue.getLogger();ue.getLogger();ue.getLogger("EVENT_BUILDER");ue.getLogger();ue.setLogHandler(Vf());ue.setLogLevel(ue.LogLevel.INFO);let Jn;const jf=new Uint8Array(16);function Bf(){if(!Jn&&(Jn=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!Jn))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Jn(jf)}const de=[];for(let e=0;e<256;++e)de.push((e+256).toString(16).slice(1));function Ff(e,t=0){return(de[e[t+0]]+de[e[t+1]]+de[e[t+2]]+de[e[t+3]]+"-"+de[e[t+4]]+de[e[t+5]]+"-"+de[e[t+6]]+de[e[t+7]]+"-"+de[e[t+8]]+de[e[t+9]]+"-"+de[e[t+10]]+de[e[t+11]]+de[e[t+12]]+de[e[t+13]]+de[e[t+14]]+de[e[t+15]]).toLowerCase()}const Hf=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),Aa={randomUUID:Hf};function at(e,t,n){if(Aa.randomUUID&&!t&&!e)return Aa.randomUUID();e=e||{};const r=e.random||(e.rng||Bf)();if(r[6]=r[6]&15|64,r[8]=r[8]&63|128,t){n=n||0;for(let i=0;i<16;++i)t[n+i]=r[i];return t}return Ff(r)}const Xt="ul-app";var U=(e=>(e.Caption="ul-caption",e.CardContainer="ul-card__container",e.CardMainContent="ul-card-main-content",e.Choice="choice",e.ChoiceCheckbox="select-checkbox",e.ChoiceGroup="ul-card__choices",e.ChoiceLabel="select-label",e.ChoiceLabelContainer="choice-label-container",e.ChoiceRadio="select-radio",e.ChoiceTextEntryContainer="choice-text-entry-container",e.ChoiceTextInput="choice-text-input",e.CloseButton="close-btn",e.CloseContainer="close-container",e.ConsentLegalNameInput="ul-consent-legal__name-input",e.CustomStyle="ul-custom-style",e.DesktopSuffix="--desktop",e.FadeInTransition="fade-in-transition",e.LikertNumber="likert-number",e.LikertSmiley="likert-smiley",e.LikertStar="likert-star",e.LoadingSpinner="ul-loading-spinner",e.LoadingSpinnerContainer="ul-loading-spinner-container",e.LoadingSpinnerFirst="first",e.LoadingSpinnerFourth="fourth",e.LoadingSpinnerSecond="second",e.LoadingSpinnerThird="third",e.MobileSuffix="--mobile",e.NPSNumber="nps-number",e.OpenTextInput="ul-card-text__input",e.QuestionHeader="ul-question",e.VideoCard="ul-card--video",e.CheckmarkButton="ul-button-checkmark",e.InactiveButton="ul-button-inactive",e.LeftAlignButton="ul-button-left-align",e.ButtonDisabled="sprig-button-disabled",e.SkipButton="ul-card-skip__button",e))(U||{});const Oo="#e6e6e6",Sn="#bd282a",$f=500,Kf=1030;var Te=(e=>(e.Video="video",e.Audio="audio",e.Screen="screen",e))(Te||{}),fe=(e=>(e.PermissionStatus="permission.status",e.AvPermission="av.permission",e.ScreenPermission="screen.permission",e.BeginRecording="begin.recording",e.StartTask="start.task",e.FinishTask="finish.task",e))(fe||{}),Re=(e=>(e.Abandoned="abandoned",e.GivenUp="given.up",e.Completed="completed",e))(Re||{}),$=(e=>(e.ScreenPermissionRequested="screen.permission.requested",e.PermissionDescriptors="permission.descriptors",e.PermissionStatusCallback="permission.status.callback",e.StreamReadyCallback="stream.ready.callback",e.StreamCanceledCallback="stream.canceled.callback",e.TaskCompleteCallback="task.complete.callback",e.TaskResponse="task.response",e.TaskStatus="task.status",e.RecordingMediaTypes="recording.media.types",e.StartRecordingCallback="start.recording.callback",e.PassthroughData="passthrough.data",e.CurrentIndex="current.index",e.UploadCallback="upload.callback",e.ProgressCallback="progress.callback",e.BeginCallback="begin.callback",e))($||{}),xe=(e=>(e.Preview="sprig.previewKey",e.Credentials="userleap.ids",e.PageViews="userleap.pageviews",e))(xe||{});const il=()=>{try{return window.parent.Intercom}catch(e){return console.error(e),null}},qf=()=>{const e=il();!e||(e.ul_wasVisible&&e("update",{hide_default_launcher:!1}),delete e.ul_wasVisible)},Gf=()=>{const e=il();!e||(e.ul_wasVisible=!!document.querySelector("iframe.intercom-launcher-frame"),e.ul_wasVisible&&e("update",{hide_default_launcher:!0}))},zf=Object.freeze(Object.defineProperty({__proto__:null,enable:qf,disable:Gf},Symbol.toStringTag,{value:"Module"})),Ua=[zf];class Li{static disable(){Ua.forEach(t=>t.disable())}static enable(){Ua.forEach(t=>t.enable())}}const Wf=1,Oa=e=>e instanceof HTMLElement||e instanceof SVGElement,ol=(e,t,n)=>{const r=e.createElement("style");n&&(r.nonce=n),r.textContent=t,r.id=U.CustomStyle,e.head.appendChild(r)},al=()=>{try{return window.parent.innerWidth}catch{return window.innerWidth}},sl=e=>{const t=e.querySelector(`.${U.CardContainer}`);let n=600,r=360;if(t){n=t.scrollHeight;const i=getComputedStyle(t),o=parseFloat(i.marginTop)+parseFloat(i.marginBottom),a=parseFloat(i.borderTopWidth)+parseFloat(i.borderBottomWidth);n+=o+a,r=t.scrollWidth;const s=parseFloat(i.marginLeft)+parseFloat(i.marginRight),l=parseFloat(i.borderLeftWidth)+parseFloat(i.borderRightWidth);r+=s+l}return[n+Wf,Math.min(r,al())]},Yf=e=>{const t=e.querySelector(`.${U.CardContainer}`);t&&(t.scrollTop=0)};var Qf=class extends Error{constructor(e,t,n){super(`Possible EventEmitter memory leak detected. ${n} ${t.toString()} listeners added. Use emitter.setMaxListeners() to increase limit`),this.emitter=e,this.type=t,this.count=n,this.name="MaxListenersExceededWarning"}},ll=class{static listenerCount(e,t){return e.listenerCount(t)}constructor(){this.events=new Map,this.maxListeners=ll.defaultMaxListeners,this.hasWarnedAboutPotentialMemoryLeak=!1}_emitInternalEvent(e,t,n){this.emit(e,t,n)}_getListeners(e){return Array.prototype.concat.apply([],this.events.get(e))||[]}_removeListener(e,t){const n=e.indexOf(t);return n>-1&&e.splice(n,1),[]}_wrapOnceListener(e,t){const n=(...r)=>(this.removeListener(e,n),t.apply(this,r));return Object.defineProperty(n,"name",{value:t.name}),n}setMaxListeners(e){return this.maxListeners=e,this}getMaxListeners(){return this.maxListeners}eventNames(){return Array.from(this.events.keys())}emit(e,...t){const n=this._getListeners(e);return n.forEach(r=>{r.apply(this,t)}),n.length>0}addListener(e,t){this._emitInternalEvent("newListener",e,t);const n=this._getListeners(e).concat(t);if(this.events.set(e,n),this.maxListeners>0&&this.listenerCount(e)>this.maxListeners&&!this.hasWarnedAboutPotentialMemoryLeak){this.hasWarnedAboutPotentialMemoryLeak=!0;const r=new Qf(this,e,this.listenerCount(e));console.warn(r)}return this}on(e,t){return this.addListener(e,t)}once(e,t){return this.addListener(e,this._wrapOnceListener(e,t))}prependListener(e,t){const n=this._getListeners(e);if(n.length>0){const r=[t].concat(n);this.events.set(e,r)}else this.events.set(e,n.concat(t));return this}prependOnceListener(e,t){return this.prependListener(e,this._wrapOnceListener(e,t))}removeListener(e,t){const n=this._getListeners(e);return n.length>0&&(this._removeListener(n,t),this.events.set(e,n),this._emitInternalEvent("removeListener",e,t)),this}off(e,t){return this.removeListener(e,t)}removeAllListeners(e){return e?this.events.delete(e):this.events.clear(),this}listeners(e){return Array.from(this._getListeners(e))}listenerCount(e){return this._getListeners(e).length}rawListeners(e){return this.listeners(e)}},ul=ll;ul.defaultMaxListeners=10;const F=new ul;var bn=(e=>(e.BottomLeft="bottomLeft",e.BottomRight="bottomRight",e.Center="center",e.TopLeft="topLeft",e.TopRight="topRight",e))(bn||{}),Ke=(e=>(e.Error="x-ul-error",e.EnvironmentID="x-ul-environment-id",e.InstallationMethod="x-ul-installation-method",e.PartnerAnonymousId="x-ul-anonymous-id",e.Platform="userleap-platform",e.PreviewMode="x-ul-preview-mode",e.UserID="x-ul-user-id",e.VisitorID="x-ul-visitor-id",e))(Ke||{}),Vt=(e=>(e.Email="email",e.Link="link",e.Web="web",e))(Vt||{}),yt=(e=>(e.Npm="web-npm",e.NpmBundled="web-npm-bundled",e.Gtm="web-gtm",e.Segment="web-segment",e.SegmentAndroid="android-segment",e.SegmentReactNative="react-native-segment",e.SegmentIOS="ios-segment",e.Snippet="web-snippet",e))(yt||{});const Cr=e=>new Promise(t=>{setTimeout(()=>{t()},e)}),Jt=({"userleap-platform":e})=>e!==Vt.Web,oe=(e,t)=>{const n=t?U.MobileSuffix:U.DesktopSuffix;return[e+n,e]},Zf=(e,t)=>[e,`${e}__${t}`];class cl{constructor(t){ie(this,"storage");ie(this,"tempStorage",{});ie(this,"isStorageAvailable");this.storage=window[t],this.isStorageAvailable=this.checkIfStorageAvailable()}checkIfStorageAvailable(){try{const t="__storage_test__";return this.storage.setItem(t,t),this.storage.removeItem(t),!0}catch{return!1}}setItem(t,n){this.isStorageAvailable?this.storage.setItem(t,n):this.tempStorage[t]=n}getItem(t){return this.isStorageAvailable?this.storage.getItem(t):this.tempStorage[t]}removeItem(t){this.isStorageAvailable?this.storage.removeItem(t):delete this.tempStorage[t]}clear(){this.isStorageAvailable?this.storage.clear():this.tempStorage={}}}const _t=new cl("sessionStorage"),Ee=new cl("localStorage");class Xf{constructor(t){ie(this,"payload");ie(this,"promise");ie(this,"reject",()=>{});ie(this,"resolve",()=>{});this.payload=t,this.promise=new Promise((n,r)=>{this.reject=r,this.resolve=n})}resolveRequest(t){this.resolve(t)}}const Jf={RATELIMIT_RESET_DEFAULT:10};let dl=!1,fl="",er=!1,pl=!1,lr=[];const ep=e=>e._config&&e._config.installationMethod?e._config.installationMethod:e._gtm?yt.Gtm:e._segment?yt.Segment:yt.Snippet,Ri=e=>{var t;(t=e==null?void 0:e.blockedURI)!=null&&t.includes(window.UserLeap._API_URL)&&(pl=!0,console.warn(`[Sprig] ${e.blockedURI} is blocked by Content-Security-Policy`),document.removeEventListener("securitypolicyviolation",Ri))},Ai=(e="")=>{dl=!0,fl=e};function rn(e={}){const t={"Content-Type":"application/json","userleap-platform":Vt.Web,"x-ul-sdk-version":"2.25.0",[Ke.InstallationMethod]:ep(e)};if(e.envId&&(t[Ke.EnvironmentID]=e.envId),e.token&&(t.Authorization="Bearer "+e.token),e.userId&&(t[Ke.UserID]=e.userId),e.visitorId&&(t[Ke.VisitorID]=e.visitorId),e.partnerAnonymousId&&(t[Ke.PartnerAnonymousId]=e.partnerAnonymousId),e.mobileHeadersJSON){const n=JSON.parse(e.mobileHeadersJSON);Object.assign(t,n)}return e.locale&&(t["accept-language"]=e.locale),window.previewMode&&(t[Ke.PreviewMode]="1"),t}const Da=async(e,t,n)=>{if(e)return{status:429};{const r=new Xf(n);return lr.push(r),r.promise}},rt=async(e,t,n=0,r=!1,i=!1)=>{const o={url:e,options:t,attempt:n,shouldDropOnRateLimit:r};if(er&&!i)return Da(r,i,o);const a={ok:!1,reportError:!1};if(dl)return console.info(`UserLeap - ${fl}`),a;try{t.headers=Object.assign(rn(),t.headers);const s=await fetch(e,t);if(s.status===429)if(!er&&!r||i){er=!0;const u=s.headers.has("ratelimit-reset")?Number(s.headers.get("ratelimit-reset")):Jf.RATELIMIT_RESET_DEFAULT;return await Cr(u*1e3),rt(e,t,0,r,!0)}else return Da(r,!1,o);if(er=!1,lr.length&&(lr.map(l=>{const{url:u,options:c,attempt:d,shouldDropOnRateLimit:f}=l.payload;rt(u,c,d,f).then(p=>{l.resolveRequest(p)})}),lr=[]),s.ok){if(s.status===249)return Ai(),a;const l=await s.text();try{return l&&l!=="OK"&&(s.json=JSON.parse(l)),s}catch{return{ok:!1,reportError:!1,error:new Error(`failed parsing response json for ${e} - ${l}`)}}}return s}catch(s){const l=n+1;return l>5||pl?{ok:!1,reportError:!1,error:s}:(await Cr(Math.pow(2,n)*1e3),rt(e,t,l))}};var hl={exports:{}};(function(e,t){(function(n,r){e.exports=r()})(Z,function(){var n=function(o,a){if(a=a||{},typeof o!="function")throw new i("fetch must be a function");if(typeof a!="object")throw new i("defaults must be an object");if(a.retries!==void 0&&!r(a.retries))throw new i("retries must be a positive integer");if(a.retryDelay!==void 0&&!r(a.retryDelay)&&typeof a.retryDelay!="function")throw new i("retryDelay must be a positive integer or a function returning a positive integer");if(a.retryOn!==void 0&&!Array.isArray(a.retryOn)&&typeof a.retryOn!="function")throw new i("retryOn property expects an array or function");var s={retries:3,retryDelay:1e3,retryOn:[]};return a=Object.assign(s,a),function(u,c){var d=a.retries,f=a.retryDelay,p=a.retryOn;if(c&&c.retries!==void 0)if(r(c.retries))d=c.retries;else throw new i("retries must be a positive integer");if(c&&c.retryDelay!==void 0)if(r(c.retryDelay)||typeof c.retryDelay=="function")f=c.retryDelay;else throw new i("retryDelay must be a positive integer or a function returning a positive integer");if(c&&c.retryOn)if(Array.isArray(c.retryOn)||typeof c.retryOn=="function")p=c.retryOn;else throw new i("retryOn property expects an array or function");return new Promise(function(v,h){var g=function(w){var E=typeof Request<"u"&&u instanceof Request?u.clone():u;o(E,c).then(function(b){if(Array.isArray(p)&&p.indexOf(b.status)===-1)v(b);else if(typeof p=="function")try{return Promise.resolve(p(w,null,b)).then(function(m){m?_(w,null,b):v(b)}).catch(h)}catch(m){h(m)}else w<d?_(w,null,b):v(b)}).catch(function(b){if(typeof p=="function")try{Promise.resolve(p(w,b,null)).then(function(m){m?_(w,b,null):h(b)}).catch(function(m){h(m)})}catch(m){h(m)}else w<d?_(w,b,null):h(b)})};function _(w,E,b){var m=typeof f=="function"?f(w,E,b):f;setTimeout(function(){g(++w)},m)}g(0)})}};function r(o){return Number.isInteger(o)&&o>=0}function i(o){this.name="ArgumentError",this.message=o}return n})})(hl);const tp=hl.exports;class np{constructor(t){ie(this,"awaitingResolvers",[]);ie(this,"activeCount",0);this.capacity=t}async acquire(){if(this.activeCount<this.capacity){this.activeCount++;return}return new Promise(t=>{this.awaitingResolvers.push(t)})}release(){const t=this.awaitingResolvers.shift();t&&this.activeCount<=this.capacity?t():this.activeCount--}async execute(t){try{return await this.acquire(),await t()}finally{this.release()}}setLimit(t){this.capacity=t}}const vl=new np(2),rp=e=>vl.setLimit(e),ip=tp(fetch),op=async(e,t=3)=>vl.execute(async()=>{const r=(await ip(e.uploadUrl,{body:e.data,method:"PUT",retries:t,retryDelay:i=>Math.pow(2,i)*1e3})).headers.get("ETag");if(!r)throw new Error(`Upload response did not include etag for upload ${e.uploadId}, part ${e.chunkIndex}`);return r}),ml=async({apiUrl:e,surveyId:t,uploadId:n,etags:r,headers:i,responseGroupUuid:o,replayDuration:a,eventDigest:s},l=!1)=>{var u;if(!(!l&&!n&&!r))return rt(`${e}/sdk/1/completeSessionReplay`,{method:"POST",body:JSON.stringify({etags:r,uploadId:n,responseGroupUuid:o,surveyId:t,replayDuration:a,eventDigest:s,userAgent:(u=window==null?void 0:window.navigator)==null?void 0:u.userAgent}),headers:i})};/*! *****************************************************************************
|
|
2
|
+
`),r={};return n.forEach(function(i){var o=i.indexOf(": ");if(o>-1){var a=i.slice(0,o),s=i.slice(o+2);s.length>0&&(r[a]=s)}}),r}function tf(e,t){Object.keys(e).forEach(function(n){var r=e[n];t.setRequestHeader(n,r)})}function nf(e,t){var n=new XMLHttpRequest,r=new Promise(function(i,o){n.open(Xd,e,!0),tf(t,n),n.onreadystatechange=function(){if(n.readyState===Jd){var a=n.status;if(a===0){o(new Error("Request error"));return}var s=ef(n),l={statusCode:n.status,body:n.responseText,headers:s};i(l)}},n.timeout=Yd.REQUEST_TIMEOUT_MS,n.ontimeout=function(){Zd.error("Request timed out")},n.send()});return{responsePromise:r,abort:function(){n.abort()}}}Lo.makeGetRequest=nf;var Ro={},Ao={};Object.defineProperty(Ao,"__esModule",{value:!0});var rf=function(){function e(){this.listeners={},this.listenerId=1}return e.prototype.on=function(t,n){var r=this;this.listeners[t]||(this.listeners[t]={});var i=String(this.listenerId);return this.listenerId++,this.listeners[t][i]=n,function(){r.listeners[t]&&delete r.listeners[t][i]}},e.prototype.emit=function(t,n){var r=this.listeners[t];r&&Object.keys(r).forEach(function(i){var o=r[i];o(n)})},e.prototype.removeAllListeners=function(){this.listeners={}},e}();Ao.default=rf;var Uo={};Object.defineProperty(Uo,"__esModule",{value:!0});var ai=ze;function of(){return Math.round(Math.random()*1e3)}var af=function(){function e(){this.errorCount=0}return e.prototype.getDelay=function(){if(this.errorCount===0)return 0;var t=ai.BACKOFF_BASE_WAIT_SECONDS_BY_ERROR_COUNT[Math.min(ai.BACKOFF_BASE_WAIT_SECONDS_BY_ERROR_COUNT.length-1,this.errorCount)];return t*1e3+of()},e.prototype.countError=function(){this.errorCount<ai.BACKOFF_BASE_WAIT_SECONDS_BY_ERROR_COUNT.length-1&&this.errorCount++},e.prototype.reset=function(){this.errorCount=0},e}();Uo.default=af;var Sr=Z&&Z.__assign||function(){return Sr=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++){t=arguments[n];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])}return e},Sr.apply(this,arguments)},rl=Z&&Z.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Ro,"__esModule",{value:!0});var sf=ue,lf=dn,uf=rl(Ao),wn=ze,cf=rl(Uo),ke=sf.getLogger("DatafileManager"),df="update";function ff(e){return e>=wn.MIN_UPDATE_INTERVAL}function Ta(e){return e>=200&&e<400}var pf={get:function(){return Promise.resolve("")},set:function(){return Promise.resolve()},contains:function(){return Promise.resolve(!1)},remove:function(){return Promise.resolve()}},hf=function(){function e(t){var n=this,r=Sr(Sr({},this.getConfigDefaults()),t),i=r.datafile,o=r.autoUpdate,a=o===void 0?!1:o,s=r.sdkKey,l=r.updateInterval,u=l===void 0?wn.DEFAULT_UPDATE_INTERVAL:l,c=r.urlTemplate,d=c===void 0?wn.DEFAULT_URL_TEMPLATE:c,f=r.cache,p=f===void 0?pf:f;this.cache=p,this.cacheKey="opt-datafile-"+s,this.isReadyPromiseSettled=!1,this.readyPromiseResolver=function(){},this.readyPromiseRejecter=function(){},this.readyPromise=new Promise(function(v,h){n.readyPromiseResolver=v,n.readyPromiseRejecter=h}),i?(this.currentDatafile=i,s||this.resolveReadyPromise()):this.currentDatafile="",this.isStarted=!1,this.datafileUrl=lf.sprintf(d,s),this.emitter=new uf.default,this.autoUpdate=a,ff(u)?this.updateInterval=u:(ke.warn("Invalid updateInterval %s, defaulting to %s",u,wn.DEFAULT_UPDATE_INTERVAL),this.updateInterval=wn.DEFAULT_UPDATE_INTERVAL),this.currentTimeout=null,this.currentRequest=null,this.backoffController=new cf.default,this.syncOnCurrentRequestComplete=!1}return e.prototype.get=function(){return this.currentDatafile},e.prototype.start=function(){this.isStarted||(ke.debug("Datafile manager started"),this.isStarted=!0,this.backoffController.reset(),this.setDatafileFromCacheIfAvailable(),this.syncDatafile())},e.prototype.stop=function(){return ke.debug("Datafile manager stopped"),this.isStarted=!1,this.currentTimeout&&(clearTimeout(this.currentTimeout),this.currentTimeout=null),this.emitter.removeAllListeners(),this.currentRequest&&(this.currentRequest.abort(),this.currentRequest=null),Promise.resolve()},e.prototype.onReady=function(){return this.readyPromise},e.prototype.on=function(t,n){return this.emitter.on(t,n)},e.prototype.onRequestRejected=function(t){!this.isStarted||(this.backoffController.countError(),t instanceof Error?ke.error("Error fetching datafile: %s",t.message,t):typeof t=="string"?ke.error("Error fetching datafile: %s",t):ke.error("Error fetching datafile"))},e.prototype.onRequestResolved=function(t){if(!!this.isStarted){typeof t.statusCode<"u"&&Ta(t.statusCode)?this.backoffController.reset():this.backoffController.countError(),this.trySavingLastModified(t.headers);var n=this.getNextDatafileFromResponse(t);if(n!=="")if(ke.info("Updating datafile from response"),this.currentDatafile=n,this.cache.set(this.cacheKey,n),!this.isReadyPromiseSettled)this.resolveReadyPromise();else{var r={datafile:n};this.emitter.emit(df,r)}}},e.prototype.onRequestComplete=function(){!this.isStarted||(this.currentRequest=null,!this.isReadyPromiseSettled&&!this.autoUpdate&&this.rejectReadyPromise(new Error("Failed to become ready")),this.autoUpdate&&this.syncOnCurrentRequestComplete&&this.syncDatafile(),this.syncOnCurrentRequestComplete=!1)},e.prototype.syncDatafile=function(){var t=this,n={};this.lastResponseLastModified&&(n["if-modified-since"]=this.lastResponseLastModified),ke.debug("Making datafile request to url %s with headers: %s",this.datafileUrl,function(){return JSON.stringify(n)}),this.currentRequest=this.makeGetRequest(this.datafileUrl,n);var r=function(){t.onRequestComplete()},i=function(a){t.onRequestResolved(a)},o=function(a){t.onRequestRejected(a)};this.currentRequest.responsePromise.then(i,o).then(r,r),this.autoUpdate&&this.scheduleNextUpdate()},e.prototype.resolveReadyPromise=function(){this.readyPromiseResolver(),this.isReadyPromiseSettled=!0},e.prototype.rejectReadyPromise=function(t){this.readyPromiseRejecter(t),this.isReadyPromiseSettled=!0},e.prototype.scheduleNextUpdate=function(){var t=this,n=this.backoffController.getDelay(),r=Math.max(n,this.updateInterval);ke.debug("Scheduling sync in %s ms",r),this.currentTimeout=setTimeout(function(){t.currentRequest?t.syncOnCurrentRequestComplete=!0:t.syncDatafile()},r)},e.prototype.getNextDatafileFromResponse=function(t){return ke.debug("Response status code: %s",t.statusCode),typeof t.statusCode>"u"||t.statusCode===304?"":Ta(t.statusCode)?t.body:""},e.prototype.trySavingLastModified=function(t){var n=t["last-modified"]||t["Last-Modified"];typeof n<"u"&&(this.lastResponseLastModified=n,ke.debug("Saved last modified header value from response: %s",this.lastResponseLastModified))},e.prototype.setDatafileFromCacheIfAvailable=function(){var t=this;this.cache.get(this.cacheKey).then(function(n){t.isStarted&&!t.isReadyPromiseSettled&&n!==""&&(ke.debug("Using datafile from cache"),t.currentDatafile=n,t.resolveReadyPromise())})},e}();Ro.default=hf;var vf=Z&&Z.__extends||function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,i){r.__proto__=i}||function(r,i){for(var o in i)i.hasOwnProperty(o)&&(r[o]=i[o])},e(t,n)};return function(t,n){e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}(),mf=Z&&Z.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(To,"__esModule",{value:!0});var gf=Lo,yf=mf(Ro),_f=function(e){vf(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.makeGetRequest=function(n,r){return gf.makeGetRequest(n,r)},t.prototype.getConfigDefaults=function(){return{autoUpdate:!1}},t}(yf.default);To.default=_f;Object.defineProperty(nl,"__esModule",{value:!0});var wf=To;nl.HttpPollingDatafileManager=wf.default;var bf={NOTSET:0,DEBUG:1,INFO:2,WARNING:3,ERROR:4},Ef={CONDITION_EVALUATOR_ERROR:"%s: Error evaluating audience condition of type %s: %s",DATAFILE_AND_SDK_KEY_MISSING:"%s: You must provide at least one of sdkKey or datafile. Cannot start Optimizely",EXPERIMENT_KEY_NOT_IN_DATAFILE:"%s: Experiment key %s is not in datafile.",FEATURE_NOT_IN_DATAFILE:"%s: Feature key %s is not in datafile.",IMPROPERLY_FORMATTED_EXPERIMENT:"%s: Experiment key %s is improperly formatted.",INVALID_ATTRIBUTES:"%s: Provided attributes are in an invalid format.",INVALID_BUCKETING_ID:"%s: Unable to generate hash for bucketing ID %s: %s",INVALID_DATAFILE:"%s: Datafile is invalid - property %s: %s",INVALID_DATAFILE_MALFORMED:"%s: Datafile is invalid because it is malformed.",INVALID_CONFIG:"%s: Provided Optimizely config is in an invalid format.",INVALID_JSON:"%s: JSON object is not valid.",INVALID_ERROR_HANDLER:'%s: Provided "errorHandler" is in an invalid format.',INVALID_EVENT_DISPATCHER:'%s: Provided "eventDispatcher" is in an invalid format.',INVALID_EVENT_TAGS:"%s: Provided event tags are in an invalid format.",INVALID_EXPERIMENT_KEY:"%s: Experiment key %s is not in datafile. It is either invalid, paused, or archived.",INVALID_EXPERIMENT_ID:"%s: Experiment ID %s is not in datafile.",INVALID_GROUP_ID:"%s: Group ID %s is not in datafile.",INVALID_LOGGER:'%s: Provided "logger" is in an invalid format.',INVALID_ROLLOUT_ID:"%s: Invalid rollout ID %s attached to feature %s",INVALID_USER_ID:"%s: Provided user ID is in an invalid format.",INVALID_USER_PROFILE_SERVICE:"%s: Provided user profile service instance is in an invalid format: %s.",NO_DATAFILE_SPECIFIED:"%s: No datafile specified. Cannot start optimizely.",NO_JSON_PROVIDED:"%s: No JSON object to validate against schema.",NO_VARIATION_FOR_EXPERIMENT_KEY:"%s: No variation key %s defined in datafile for experiment %s.",UNDEFINED_ATTRIBUTE:"%s: Provided attribute: %s has an undefined value.",UNRECOGNIZED_ATTRIBUTE:"%s: Unrecognized attribute %s provided. Pruning before sending event to Optimizely.",UNABLE_TO_CAST_VALUE:"%s: Unable to cast value %s to type %s, returning null.",USER_NOT_IN_FORCED_VARIATION:"%s: User %s is not in the forced variation map. Cannot remove their forced variation.",USER_PROFILE_LOOKUP_ERROR:'%s: Error while looking up user profile for user ID "%s": %s.',USER_PROFILE_SAVE_ERROR:'%s: Error while saving user profile for user ID "%s": %s.',VARIABLE_KEY_NOT_IN_DATAFILE:'%s: Variable with key "%s" associated with feature with key "%s" is not in datafile.',VARIATION_ID_NOT_IN_DATAFILE:"%s: No variation ID %s defined in datafile for experiment %s.",VARIATION_ID_NOT_IN_DATAFILE_NO_EXPERIMENT:"%s: Variation ID %s is not in the datafile.",INVALID_INPUT_FORMAT:"%s: Provided %s is in an invalid format.",INVALID_DATAFILE_VERSION:"%s: This version of the JavaScript SDK does not support the given datafile version: %s",INVALID_VARIATION_KEY:"%s: Provided variation key is in an invalid format."},xf={ACTIVATE_USER:"%s: Activating user %s in experiment %s.",DISPATCH_CONVERSION_EVENT:"%s: Dispatching conversion event to URL %s with params %s.",DISPATCH_IMPRESSION_EVENT:"%s: Dispatching impression event to URL %s with params %s.",DEPRECATED_EVENT_VALUE:"%s: Event value is deprecated in %s call.",EVENT_KEY_NOT_FOUND:"%s: Event key %s is not in datafile.",EXPERIMENT_NOT_RUNNING:"%s: Experiment %s is not running.",FEATURE_ENABLED_FOR_USER:"%s: Feature %s is enabled for user %s.",FEATURE_NOT_ENABLED_FOR_USER:"%s: Feature %s is not enabled for user %s.",FEATURE_HAS_NO_EXPERIMENTS:"%s: Feature %s is not attached to any experiments.",FAILED_TO_PARSE_VALUE:'%s: Failed to parse event value "%s" from event tags.',FAILED_TO_PARSE_REVENUE:'%s: Failed to parse revenue value "%s" from event tags.',FORCED_BUCKETING_FAILED:"%s: Variation key %s is not in datafile. Not activating user %s.",INVALID_OBJECT:"%s: Optimizely object is not valid. Failing %s.",INVALID_CLIENT_ENGINE:"%s: Invalid client engine passed: %s. Defaulting to node-sdk.",INVALID_DEFAULT_DECIDE_OPTIONS:"%s: Provided default decide options is not an array.",INVALID_DECIDE_OPTIONS:"%s: Provided decide options is not an array. Using default decide options.",INVALID_VARIATION_ID:"%s: Bucketed into an invalid variation ID. Returning null.",NOTIFICATION_LISTENER_EXCEPTION:"%s: Notification listener for (%s) threw exception: %s",NO_ROLLOUT_EXISTS:"%s: There is no rollout of feature %s.",NOT_ACTIVATING_USER:"%s: Not activating user %s for experiment %s.",NOT_TRACKING_USER:"%s: Not tracking user %s.",PARSED_REVENUE_VALUE:'%s: Parsed revenue value "%s" from event tags.',PARSED_NUMERIC_VALUE:'%s: Parsed event value "%s" from event tags.',RETURNING_STORED_VARIATION:'%s: Returning previously activated variation "%s" of experiment "%s" for user "%s" from user profile.',ROLLOUT_HAS_NO_EXPERIMENTS:"%s: Rollout of feature %s has no experiments",SAVED_VARIATION:'%s: Saved variation "%s" of experiment "%s" for user "%s".',SAVED_VARIATION_NOT_FOUND:"%s: User %s was previously bucketed into variation with ID %s for experiment %s, but no matching variation was found.",SHOULD_NOT_DISPATCH_ACTIVATE:'%s: Experiment %s is not in "Running" state. Not activating user.',SKIPPING_JSON_VALIDATION:"%s: Skipping JSON schema validation.",TRACK_EVENT:"%s: Tracking event %s for user %s.",UNRECOGNIZED_DECIDE_OPTION:"%s: Unrecognized decide option %s provided.",USER_ASSIGNED_TO_EXPERIMENT_BUCKET:"%s: Assigned bucket %s to user with bucketing ID %s.",USER_BUCKETED_INTO_EXPERIMENT_IN_GROUP:"%s: User %s is in experiment %s of group %s.",USER_BUCKETED_INTO_TARGETING_RULE:"%s: User %s bucketed into targeting rule %s.",USER_IN_FEATURE_EXPERIMENT:"%s: User %s is in variation %s of experiment %s on the feature %s.",USER_IN_ROLLOUT:"%s: User %s is in rollout of feature %s.",USER_NOT_BUCKETED_INTO_EVERYONE_TARGETING_RULE:"%s: User %s not bucketed into everyone targeting rule due to traffic allocation.",USER_NOT_BUCKETED_INTO_EXPERIMENT_IN_GROUP:"%s: User %s is not in experiment %s of group %s.",USER_NOT_BUCKETED_INTO_ANY_EXPERIMENT_IN_GROUP:"%s: User %s is not in any experiment of group %s.",USER_NOT_BUCKETED_INTO_TARGETING_RULE:"%s User %s not bucketed into targeting rule %s due to traffic allocation. Trying everyone rule.",USER_NOT_IN_FEATURE_EXPERIMENT:"%s: User %s is not in any experiment on the feature %s.",USER_NOT_IN_ROLLOUT:"%s: User %s is not in rollout of feature %s.",USER_FORCED_IN_VARIATION:"%s: User %s is forced in variation %s.",USER_MAPPED_TO_FORCED_VARIATION:"%s: Set variation %s for experiment %s and user %s in the forced variation map.",USER_DOESNT_MEET_CONDITIONS_FOR_TARGETING_RULE:"%s: User %s does not meet conditions for targeting rule %s.",USER_MEETS_CONDITIONS_FOR_TARGETING_RULE:"%s: User %s meets conditions for targeting rule %s.",USER_HAS_VARIATION:"%s: User %s is in variation %s of experiment %s.",USER_HAS_FORCED_DECISION_WITH_RULE_SPECIFIED:"Variation (%s) is mapped to flag (%s), rule (%s) and user (%s) in the forced decision map.",USER_HAS_FORCED_DECISION_WITH_NO_RULE_SPECIFIED:"Variation (%s) is mapped to flag (%s) and user (%s) in the forced decision map.",USER_HAS_FORCED_DECISION_WITH_RULE_SPECIFIED_BUT_INVALID:"Invalid variation is mapped to flag (%s), rule (%s) and user (%s) in the forced decision map.",USER_HAS_FORCED_DECISION_WITH_NO_RULE_SPECIFIED_BUT_INVALID:"Invalid variation is mapped to flag (%s) and user (%s) in the forced decision map.",USER_HAS_FORCED_VARIATION:"%s: Variation %s is mapped to experiment %s and user %s in the forced variation map.",USER_HAS_NO_VARIATION:"%s: User %s is in no variation of experiment %s.",USER_HAS_NO_FORCED_VARIATION:"%s: User %s is not in the forced variation map.",USER_HAS_NO_FORCED_VARIATION_FOR_EXPERIMENT:"%s: No experiment %s mapped to user %s in the forced variation map.",USER_NOT_IN_ANY_EXPERIMENT:"%s: User %s is not in any experiment of group %s.",USER_NOT_IN_EXPERIMENT:"%s: User %s does not meet conditions to be in experiment %s.",USER_RECEIVED_DEFAULT_VARIABLE_VALUE:'%s: User "%s" is not in any variation or rollout rule. Returning default value for variable "%s" of feature flag "%s".',FEATURE_NOT_ENABLED_RETURN_DEFAULT_VARIABLE_VALUE:'%s: Feature "%s" is not enabled for user %s. Returning the default variable value "%s".',VARIABLE_NOT_USED_RETURN_DEFAULT_VARIABLE_VALUE:'%s: Variable "%s" is not used in variation "%s". Returning default value.',USER_RECEIVED_VARIABLE_VALUE:'%s: Got variable value "%s" for variable "%s" of feature flag "%s"',VALID_DATAFILE:"%s: Datafile is valid.",VALID_USER_PROFILE_SERVICE:"%s: Valid user profile service provided.",VARIATION_REMOVED_FOR_USER:"%s: Variation mapped to experiment %s has been removed for user %s.",VARIABLE_REQUESTED_WITH_WRONG_TYPE:'%s: Requested variable type "%s", but variable is of type "%s". Use correct API to retrieve value. Returning None.',VALID_BUCKETING_ID:'%s: BucketingId is valid: "%s"',BUCKETING_ID_NOT_STRING:"%s: BucketingID attribute is not a string. Defaulted to userId",EVALUATING_AUDIENCE:'%s: Starting to evaluate audience "%s" with conditions: %s.',EVALUATING_AUDIENCES_COMBINED:'%s: Evaluating audiences for %s "%s": %s.',AUDIENCE_EVALUATION_RESULT:'%s: Audience "%s" evaluated to %s.',AUDIENCE_EVALUATION_RESULT_COMBINED:"%s: Audiences for %s %s collectively evaluated to %s.",MISSING_ATTRIBUTE_VALUE:'%s: Audience condition %s evaluated to UNKNOWN because no value was passed for user attribute "%s".',UNEXPECTED_CONDITION_VALUE:"%s: Audience condition %s evaluated to UNKNOWN because the condition value is not supported.",UNEXPECTED_TYPE:'%s: Audience condition %s evaluated to UNKNOWN because a value of type "%s" was passed for user attribute "%s".',UNEXPECTED_TYPE_NULL:'%s: Audience condition %s evaluated to UNKNOWN because a null value was passed for user attribute "%s".',UNKNOWN_CONDITION_TYPE:"%s: Audience condition %s has an unknown condition type. You may need to upgrade to a newer release of the Optimizely SDK.",UNKNOWN_MATCH_TYPE:"%s: Audience condition %s uses an unknown match type. You may need to upgrade to a newer release of the Optimizely SDK.",UPDATED_OPTIMIZELY_CONFIG:"%s: Updated Optimizely config to revision %s (project id %s)",OUT_OF_BOUNDS:'%s: Audience condition %s evaluated to UNKNOWN because the number value for user attribute "%s" is not in the range [-2^53, +2^53].',UNABLE_TO_ATTACH_UNLOAD:'%s: unable to bind optimizely.close() to page unload event: "%s"'},Sf={BOT_FILTERING:"$opt_bot_filtering",BUCKETING_ID:"$opt_bucketing_id",STICKY_BUCKETING_KEY:"$opt_experiment_bucket_map",USER_AGENT:"$opt_user_agent",FORCED_DECISION_NULL_RULE_KEY:"$opt_null_rule_key"},Cf="javascript-sdk",If="node-sdk",kf="react-sdk",Tf="react-native-sdk",Lf="react-native-js-sdk",Rf="4.9.4",Af="4.9.4",Uf={AB_TEST:"ab-test",FEATURE:"feature",FEATURE_TEST:"feature-test",FEATURE_VARIABLE:"feature-variable",ALL_FEATURE_VARIABLES:"all-feature-variables",FLAG:"flag"},Of={FEATURE_TEST:"feature-test",ROLLOUT:"rollout",EXPERIMENT:"experiment"},Df={RULE:"rule",EXPERIMENT:"experiment"},Pf={BOOLEAN:"boolean",DOUBLE:"double",INTEGER:"integer",STRING:"string",JSON:"json"},sr={V2:"2",V3:"3",V4:"4"},Nf={SDK_NOT_READY:"Optimizely SDK not configured properly yet.",FLAG_KEY_INVALID:'No flag was found for key "%s".',VARIABLE_VALUE_INVALID:'Variable value for key "%s" is invalid or wrong type.'},Ti;(function(e){e.ACTIVATE="ACTIVATE:experiment, user_id,attributes, variation, event",e.DECISION="DECISION:type, userId, attributes, decisionInfo",e.LOG_EVENT="LOG_EVENT:logEvent",e.OPTIMIZELY_CONFIG_UPDATE="OPTIMIZELY_CONFIG_UPDATE",e.TRACK="TRACK:event_key, user_id, attributes, event_tags, event"})(Ti||(Ti={}));var Mf=Object.freeze({__proto__:null,LOG_LEVEL:bf,ERROR_MESSAGES:Ef,LOG_MESSAGES:xf,CONTROL_ATTRIBUTES:Sf,JAVASCRIPT_CLIENT_ENGINE:Cf,NODE_CLIENT_ENGINE:If,REACT_CLIENT_ENGINE:kf,REACT_NATIVE_CLIENT_ENGINE:Tf,REACT_NATIVE_JS_CLIENT_ENGINE:Lf,BROWSER_CLIENT_VERSION:Rf,NODE_CLIENT_VERSION:Af,DECISION_NOTIFICATION_TYPES:Uf,DECISION_SOURCES:Of,AUDIENCE_EVALUATION_TYPES:Df,FEATURE_VARIABLE_TYPES:Pf,DATAFILE_VERSIONS:sr,DECISION_MESSAGES:Nf,get NOTIFICATION_TYPES(){return Ti}});sr.V2,sr.V3,sr.V4;(function(){function e(){}return e.prototype.log=function(){},e})();function Vf(e){return new ue.ConsoleLogHandler(e)}var La;(function(e){e.BOOLEAN="boolean",e.DOUBLE="double",e.INTEGER="integer",e.STRING="string",e.JSON="json"})(La||(La={}));var Ra;(function(e){e.DISABLE_DECISION_EVENT="DISABLE_DECISION_EVENT",e.ENABLED_FLAGS_ONLY="ENABLED_FLAGS_ONLY",e.IGNORE_USER_PROFILE_SERVICE="IGNORE_USER_PROFILE_SERVICE",e.INCLUDE_REASONS="INCLUDE_REASONS",e.EXCLUDE_VARIABLES="EXCLUDE_VARIABLES"})(Ra||(Ra={}));ue.getLogger();ue.getLogger();ue.getLogger();ue.getLogger();ue.getLogger("EVENT_BUILDER");ue.getLogger();ue.setLogHandler(Vf());ue.setLogLevel(ue.LogLevel.INFO);let Jn;const jf=new Uint8Array(16);function Bf(){if(!Jn&&(Jn=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!Jn))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Jn(jf)}const de=[];for(let e=0;e<256;++e)de.push((e+256).toString(16).slice(1));function Ff(e,t=0){return(de[e[t+0]]+de[e[t+1]]+de[e[t+2]]+de[e[t+3]]+"-"+de[e[t+4]]+de[e[t+5]]+"-"+de[e[t+6]]+de[e[t+7]]+"-"+de[e[t+8]]+de[e[t+9]]+"-"+de[e[t+10]]+de[e[t+11]]+de[e[t+12]]+de[e[t+13]]+de[e[t+14]]+de[e[t+15]]).toLowerCase()}const Hf=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),Aa={randomUUID:Hf};function at(e,t,n){if(Aa.randomUUID&&!t&&!e)return Aa.randomUUID();e=e||{};const r=e.random||(e.rng||Bf)();if(r[6]=r[6]&15|64,r[8]=r[8]&63|128,t){n=n||0;for(let i=0;i<16;++i)t[n+i]=r[i];return t}return Ff(r)}const Xt="ul-app";var U=(e=>(e.Caption="ul-caption",e.CardContainer="ul-card__container",e.CardMainContent="ul-card-main-content",e.Choice="choice",e.ChoiceCheckbox="select-checkbox",e.ChoiceGroup="ul-card__choices",e.ChoiceLabel="select-label",e.ChoiceLabelContainer="choice-label-container",e.ChoiceRadio="select-radio",e.ChoiceTextEntryContainer="choice-text-entry-container",e.ChoiceTextInput="choice-text-input",e.CloseButton="close-btn",e.CloseContainer="close-container",e.ConsentLegalNameInput="ul-consent-legal__name-input",e.CustomStyle="ul-custom-style",e.DesktopSuffix="--desktop",e.FadeInTransition="fade-in-transition",e.LikertNumber="likert-number",e.LikertSmiley="likert-smiley",e.LikertStar="likert-star",e.LoadingSpinner="ul-loading-spinner",e.LoadingSpinnerContainer="ul-loading-spinner-container",e.LoadingSpinnerFirst="first",e.LoadingSpinnerFourth="fourth",e.LoadingSpinnerSecond="second",e.LoadingSpinnerThird="third",e.MobileSuffix="--mobile",e.NPSNumber="nps-number",e.OpenTextInput="ul-card-text__input",e.QuestionHeader="ul-question",e.VideoCard="ul-card--video",e.CheckmarkButton="ul-button-checkmark",e.InactiveButton="ul-button-inactive",e.LeftAlignButton="ul-button-left-align",e.ButtonDisabled="sprig-button-disabled",e.SkipButton="ul-card-skip__button",e))(U||{});const Oo="#e6e6e6",Sn="#bd282a",$f=500,Kf=1030;var Te=(e=>(e.Video="video",e.Audio="audio",e.Screen="screen",e))(Te||{}),fe=(e=>(e.PermissionStatus="permission.status",e.AvPermission="av.permission",e.ScreenPermission="screen.permission",e.BeginRecording="begin.recording",e.StartTask="start.task",e.FinishTask="finish.task",e))(fe||{}),Re=(e=>(e.Abandoned="abandoned",e.GivenUp="given.up",e.Completed="completed",e))(Re||{}),$=(e=>(e.ScreenPermissionRequested="screen.permission.requested",e.PermissionDescriptors="permission.descriptors",e.PermissionStatusCallback="permission.status.callback",e.StreamReadyCallback="stream.ready.callback",e.StreamCanceledCallback="stream.canceled.callback",e.TaskCompleteCallback="task.complete.callback",e.TaskResponse="task.response",e.TaskStatus="task.status",e.RecordingMediaTypes="recording.media.types",e.StartRecordingCallback="start.recording.callback",e.PassthroughData="passthrough.data",e.CurrentIndex="current.index",e.UploadCallback="upload.callback",e.ProgressCallback="progress.callback",e.BeginCallback="begin.callback",e))($||{}),xe=(e=>(e.Preview="sprig.previewKey",e.Credentials="userleap.ids",e.PageViews="userleap.pageviews",e))(xe||{});const il=()=>{try{return window.parent.Intercom}catch(e){return console.error(e),null}},qf=()=>{const e=il();!e||(e.ul_wasVisible&&e("update",{hide_default_launcher:!1}),delete e.ul_wasVisible)},Gf=()=>{const e=il();!e||(e.ul_wasVisible=!!document.querySelector("iframe.intercom-launcher-frame"),e.ul_wasVisible&&e("update",{hide_default_launcher:!0}))},zf=Object.freeze(Object.defineProperty({__proto__:null,enable:qf,disable:Gf},Symbol.toStringTag,{value:"Module"})),Ua=[zf];class Li{static disable(){Ua.forEach(t=>t.disable())}static enable(){Ua.forEach(t=>t.enable())}}const Wf=1,Oa=e=>e instanceof HTMLElement||e instanceof SVGElement,ol=(e,t,n)=>{const r=e.createElement("style");n&&(r.nonce=n),r.textContent=t,r.id=U.CustomStyle,e.head.appendChild(r)},al=()=>{try{return window.parent.innerWidth}catch{return window.innerWidth}},sl=e=>{const t=e.querySelector(`.${U.CardContainer}`);let n=600,r=360;if(t){n=t.scrollHeight;const i=getComputedStyle(t),o=parseFloat(i.marginTop)+parseFloat(i.marginBottom),a=parseFloat(i.borderTopWidth)+parseFloat(i.borderBottomWidth);n+=o+a,r=t.scrollWidth;const s=parseFloat(i.marginLeft)+parseFloat(i.marginRight),l=parseFloat(i.borderLeftWidth)+parseFloat(i.borderRightWidth);r+=s+l}return[n+Wf,Math.min(r,al())]},Yf=e=>{const t=e.querySelector(`.${U.CardContainer}`);t&&(t.scrollTop=0)};var Qf=class extends Error{constructor(e,t,n){super(`Possible EventEmitter memory leak detected. ${n} ${t.toString()} listeners added. Use emitter.setMaxListeners() to increase limit`),this.emitter=e,this.type=t,this.count=n,this.name="MaxListenersExceededWarning"}},ll=class{static listenerCount(e,t){return e.listenerCount(t)}constructor(){this.events=new Map,this.maxListeners=ll.defaultMaxListeners,this.hasWarnedAboutPotentialMemoryLeak=!1}_emitInternalEvent(e,t,n){this.emit(e,t,n)}_getListeners(e){return Array.prototype.concat.apply([],this.events.get(e))||[]}_removeListener(e,t){const n=e.indexOf(t);return n>-1&&e.splice(n,1),[]}_wrapOnceListener(e,t){const n=(...r)=>(this.removeListener(e,n),t.apply(this,r));return Object.defineProperty(n,"name",{value:t.name}),n}setMaxListeners(e){return this.maxListeners=e,this}getMaxListeners(){return this.maxListeners}eventNames(){return Array.from(this.events.keys())}emit(e,...t){const n=this._getListeners(e);return n.forEach(r=>{r.apply(this,t)}),n.length>0}addListener(e,t){this._emitInternalEvent("newListener",e,t);const n=this._getListeners(e).concat(t);if(this.events.set(e,n),this.maxListeners>0&&this.listenerCount(e)>this.maxListeners&&!this.hasWarnedAboutPotentialMemoryLeak){this.hasWarnedAboutPotentialMemoryLeak=!0;const r=new Qf(this,e,this.listenerCount(e));console.warn(r)}return this}on(e,t){return this.addListener(e,t)}once(e,t){return this.addListener(e,this._wrapOnceListener(e,t))}prependListener(e,t){const n=this._getListeners(e);if(n.length>0){const r=[t].concat(n);this.events.set(e,r)}else this.events.set(e,n.concat(t));return this}prependOnceListener(e,t){return this.prependListener(e,this._wrapOnceListener(e,t))}removeListener(e,t){const n=this._getListeners(e);return n.length>0&&(this._removeListener(n,t),this.events.set(e,n),this._emitInternalEvent("removeListener",e,t)),this}off(e,t){return this.removeListener(e,t)}removeAllListeners(e){return e?this.events.delete(e):this.events.clear(),this}listeners(e){return Array.from(this._getListeners(e))}listenerCount(e){return this._getListeners(e).length}rawListeners(e){return this.listeners(e)}},ul=ll;ul.defaultMaxListeners=10;const F=new ul;var bn=(e=>(e.BottomLeft="bottomLeft",e.BottomRight="bottomRight",e.Center="center",e.TopLeft="topLeft",e.TopRight="topRight",e))(bn||{}),Ke=(e=>(e.Error="x-ul-error",e.EnvironmentID="x-ul-environment-id",e.InstallationMethod="x-ul-installation-method",e.PartnerAnonymousId="x-ul-anonymous-id",e.Platform="userleap-platform",e.PreviewMode="x-ul-preview-mode",e.UserID="x-ul-user-id",e.VisitorID="x-ul-visitor-id",e))(Ke||{}),Vt=(e=>(e.Email="email",e.Link="link",e.Web="web",e))(Vt||{}),yt=(e=>(e.Npm="web-npm",e.NpmBundled="web-npm-bundled",e.Gtm="web-gtm",e.Segment="web-segment",e.SegmentAndroid="android-segment",e.SegmentReactNative="react-native-segment",e.SegmentIOS="ios-segment",e.Snippet="web-snippet",e))(yt||{});const Cr=e=>new Promise(t=>{setTimeout(()=>{t()},e)}),Jt=({"userleap-platform":e})=>e!==Vt.Web,oe=(e,t)=>{const n=t?U.MobileSuffix:U.DesktopSuffix;return[e+n,e]},Zf=(e,t)=>[e,`${e}__${t}`];class cl{constructor(t){ie(this,"storage");ie(this,"tempStorage",{});ie(this,"isStorageAvailable");this.storage=window[t],this.isStorageAvailable=this.checkIfStorageAvailable()}checkIfStorageAvailable(){try{const t="__storage_test__";return this.storage.setItem(t,t),this.storage.removeItem(t),!0}catch{return!1}}setItem(t,n){this.isStorageAvailable?this.storage.setItem(t,n):this.tempStorage[t]=n}getItem(t){return this.isStorageAvailable?this.storage.getItem(t):this.tempStorage[t]}removeItem(t){this.isStorageAvailable?this.storage.removeItem(t):delete this.tempStorage[t]}clear(){this.isStorageAvailable?this.storage.clear():this.tempStorage={}}}const _t=new cl("sessionStorage"),Ee=new cl("localStorage");class Xf{constructor(t){ie(this,"payload");ie(this,"promise");ie(this,"reject",()=>{});ie(this,"resolve",()=>{});this.payload=t,this.promise=new Promise((n,r)=>{this.reject=r,this.resolve=n})}resolveRequest(t){this.resolve(t)}}const Jf={RATELIMIT_RESET_DEFAULT:10};let dl=!1,fl="",er=!1,pl=!1,lr=[];const ep=e=>e._config&&e._config.installationMethod?e._config.installationMethod:e._gtm?yt.Gtm:e._segment?yt.Segment:yt.Snippet,Ri=e=>{var t;(t=e==null?void 0:e.blockedURI)!=null&&t.includes(window.UserLeap._API_URL)&&(pl=!0,console.warn(`[Sprig] ${e.blockedURI} is blocked by Content-Security-Policy`),document.removeEventListener("securitypolicyviolation",Ri))},Ai=(e="")=>{dl=!0,fl=e};function rn(e={}){const t={"Content-Type":"application/json","userleap-platform":Vt.Web,"x-ul-sdk-version":"2.25.1",[Ke.InstallationMethod]:ep(e)};if(e.envId&&(t[Ke.EnvironmentID]=e.envId),e.token&&(t.Authorization="Bearer "+e.token),e.userId&&(t[Ke.UserID]=e.userId),e.visitorId&&(t[Ke.VisitorID]=e.visitorId),e.partnerAnonymousId&&(t[Ke.PartnerAnonymousId]=e.partnerAnonymousId),e.mobileHeadersJSON){const n=JSON.parse(e.mobileHeadersJSON);Object.assign(t,n)}return e.locale&&(t["accept-language"]=e.locale),window.previewMode&&(t[Ke.PreviewMode]="1"),t}const Da=async(e,t,n)=>{if(e)return{status:429};{const r=new Xf(n);return lr.push(r),r.promise}},rt=async(e,t,n=0,r=!1,i=!1)=>{const o={url:e,options:t,attempt:n,shouldDropOnRateLimit:r};if(er&&!i)return Da(r,i,o);const a={ok:!1,reportError:!1};if(dl)return console.info(`UserLeap - ${fl}`),a;try{t.headers=Object.assign(rn(),t.headers);const s=await fetch(e,t);if(s.status===429)if(!er&&!r||i){er=!0;const u=s.headers.has("ratelimit-reset")?Number(s.headers.get("ratelimit-reset")):Jf.RATELIMIT_RESET_DEFAULT;return await Cr(u*1e3),rt(e,t,0,r,!0)}else return Da(r,!1,o);if(er=!1,lr.length&&(lr.map(l=>{const{url:u,options:c,attempt:d,shouldDropOnRateLimit:f}=l.payload;rt(u,c,d,f).then(p=>{l.resolveRequest(p)})}),lr=[]),s.ok){if(s.status===249)return Ai(),a;const l=await s.text();try{return l&&l!=="OK"&&(s.json=JSON.parse(l)),s}catch{return{ok:!1,reportError:!1,error:new Error(`failed parsing response json for ${e} - ${l}`)}}}return s}catch(s){const l=n+1;return l>5||pl?{ok:!1,reportError:!1,error:s}:(await Cr(Math.pow(2,n)*1e3),rt(e,t,l))}};var hl={exports:{}};(function(e,t){(function(n,r){e.exports=r()})(Z,function(){var n=function(o,a){if(a=a||{},typeof o!="function")throw new i("fetch must be a function");if(typeof a!="object")throw new i("defaults must be an object");if(a.retries!==void 0&&!r(a.retries))throw new i("retries must be a positive integer");if(a.retryDelay!==void 0&&!r(a.retryDelay)&&typeof a.retryDelay!="function")throw new i("retryDelay must be a positive integer or a function returning a positive integer");if(a.retryOn!==void 0&&!Array.isArray(a.retryOn)&&typeof a.retryOn!="function")throw new i("retryOn property expects an array or function");var s={retries:3,retryDelay:1e3,retryOn:[]};return a=Object.assign(s,a),function(u,c){var d=a.retries,f=a.retryDelay,p=a.retryOn;if(c&&c.retries!==void 0)if(r(c.retries))d=c.retries;else throw new i("retries must be a positive integer");if(c&&c.retryDelay!==void 0)if(r(c.retryDelay)||typeof c.retryDelay=="function")f=c.retryDelay;else throw new i("retryDelay must be a positive integer or a function returning a positive integer");if(c&&c.retryOn)if(Array.isArray(c.retryOn)||typeof c.retryOn=="function")p=c.retryOn;else throw new i("retryOn property expects an array or function");return new Promise(function(v,h){var g=function(w){var E=typeof Request<"u"&&u instanceof Request?u.clone():u;o(E,c).then(function(b){if(Array.isArray(p)&&p.indexOf(b.status)===-1)v(b);else if(typeof p=="function")try{return Promise.resolve(p(w,null,b)).then(function(m){m?_(w,null,b):v(b)}).catch(h)}catch(m){h(m)}else w<d?_(w,null,b):v(b)}).catch(function(b){if(typeof p=="function")try{Promise.resolve(p(w,b,null)).then(function(m){m?_(w,b,null):h(b)}).catch(function(m){h(m)})}catch(m){h(m)}else w<d?_(w,b,null):h(b)})};function _(w,E,b){var m=typeof f=="function"?f(w,E,b):f;setTimeout(function(){g(++w)},m)}g(0)})}};function r(o){return Number.isInteger(o)&&o>=0}function i(o){this.name="ArgumentError",this.message=o}return n})})(hl);const tp=hl.exports;class np{constructor(t){ie(this,"awaitingResolvers",[]);ie(this,"activeCount",0);this.capacity=t}async acquire(){if(this.activeCount<this.capacity){this.activeCount++;return}return new Promise(t=>{this.awaitingResolvers.push(t)})}release(){const t=this.awaitingResolvers.shift();t&&this.activeCount<=this.capacity?t():this.activeCount--}async execute(t){try{return await this.acquire(),await t()}finally{this.release()}}setLimit(t){this.capacity=t}}const vl=new np(2),rp=e=>vl.setLimit(e),ip=tp(fetch),op=async(e,t=3)=>vl.execute(async()=>{const r=(await ip(e.uploadUrl,{body:e.data,method:"PUT",retries:t,retryDelay:i=>Math.pow(2,i)*1e3})).headers.get("ETag");if(!r)throw new Error(`Upload response did not include etag for upload ${e.uploadId}, part ${e.chunkIndex}`);return r}),ml=async({apiUrl:e,surveyId:t,uploadId:n,etags:r,headers:i,responseGroupUuid:o,replayDuration:a,eventDigest:s},l=!1)=>{var u;if(!(!l&&!n&&!r))return rt(`${e}/sdk/1/completeSessionReplay`,{method:"POST",body:JSON.stringify({etags:r,uploadId:n,responseGroupUuid:o,surveyId:t,replayDuration:a,eventDigest:s,userAgent:(u=window==null?void 0:window.navigator)==null?void 0:u.userAgent}),headers:i})};/*! *****************************************************************************
|
|
3
3
|
Copyright (c) Microsoft Corporation.
|
|
4
4
|
Permission to use, copy, modify, and/or distribute this software for any
|
|
5
5
|
purpose with or without fee is hereby granted.
|
|
@@ -701,4 +701,4 @@ span.ul-button-text {
|
|
|
701
701
|
background-size: cover;
|
|
702
702
|
}
|
|
703
703
|
`,gg=e=>{const t=M.document.createElement("div");return t.className="ul-video-player-loading",t.id=ca(e),["first","second","third","fourth"].map(n=>{const r=M.document.createElement("div");r.className=n,t.appendChild(r)}),t},ca=e=>e+"-loading-spiner",se="hidden",Os=".m3u8",bi="questionId",Ei="ul-video-recorder-camera-off-button",xi="ul-recording-in-session",yg=[{type:"link",content:`${Rt}/dependencies/videojs-record-4.5.0.min.css`},{type:"script",content:`${Rt}/dependencies/RecordRTC-5.6.2.js`},{type:"script",content:`${Rt}/dependencies/adapter.8.0.0.min.js`},{type:"script",content:`${Rt}/dependencies/videojs-record-4.5.0.min.js`},{type:"script",content:`${Rt}/userleap-web-upchunk-v2.2.2.js`}],bc=[{type:"link",content:`${Rt}/dependencies/video-js-7.18.0.min.css`},{type:"script",content:`${Rt}/dependencies/video-js-7.18.0.min.js`},{type:"style",content:mg}],Ec="-video-player",xc="-secondary-video-player",Sc="-video-recorder";let $e,Ds;const vt=async({event:e,apiBase:t,headers:n,visitorId:r,envId:i,metadata:o})=>{const a=M.document.documentElement;if(!r||!i)return;const s={event:`SDK - ${e}`,visitorId:r,environmentId:i,metadata:{...o||{},screenWidth:window.screen.width,screenHeight:window.screen.height,clientWidth:a.clientWidth,clientHeight:a.clientHeight,location:window.location.href,language:navigator.language}};(await fetch(`${t}/sdk/1/visitors/${r}/analytics`,{method:"POST",cache:"no-cache",headers:n,body:JSON.stringify(s)})).ok||console.warn("[Sprig] (ERR-444) Failed to track analytics",e)},et=async(e,t,n,r,i,o)=>{vt({event:`Video Error ${t}`,apiBase:n,headers:r,visitorId:i,envId:o,metadata:{errorMessage:e.message}});const a=M.document.documentElement,s={screenWidth:window.screen.width,screenHeight:window.screen.height,clientWidth:a.clientWidth,clientHeight:a.clientHeight,location:window.location.href,language:navigator.language},l={action:t,err:{message:e.message,stack:e.stack},meta:s,vid:i,envId:o};(await fetch(`${n}/sdk/1/errors`,{method:"POST",cache:"no-cache",headers:{...r,"userleap-platform":"video_recorder","x-ul-error":window.btoa(`userleap-${Date.now()}-error`)},body:JSON.stringify(l)})).ok||console.warn("[Sprig] (ERR-444) Failed to report error to API",e)},_g=(e,{type:t,content:n})=>new Promise(function(r,i){let o;t==="script"?(o=M.document.createElement("script"),o.src=n):t==="link"?(o=M.document.createElement("link"),o.rel="stylesheet",o.href=n,o.type="text/css"):(o=M.document.createElement("style"),o.innerHTML=n),o.onload=function(){r(n)},o.onerror=function(){i(n)},o.async=!1,o.id=btoa(n),e.appendChild(o)}),Cc=(e,t)=>{if(e.length===0)return t&&t();Promise.all(e.reduce((n,r)=>(n.push(_g(M.document.head,r)),n),[])).then(()=>{M.videojs=M.document.defaultView.videojs,t&&t()}).catch(function(n){console.log(n+" failed to load")})},Ps=(e,t,n)=>{if(t==="start"&&(e.style.visibility="visible"),t==="none")e.style.visibility=se;else if(t==="success")e.style.visibility=se,e.innerHTML="Upload succeeded!";else{const r=Math.round(parseFloat(n));e.innerHTML=`Uploading <span class="ul-upload-progress-label__time">${r}%</span>`,e.style.background=`linear-gradient(to right, #E0E0EB 0%, #E0E0EB ${r}%, #FCFCFD ${r}%, #FCFCFD 100%)`}},Si=(e,t)=>{const n=M.videojs(e.id());return n==null?void 0:n.payload[t]},wg=(e,t,n,r,i)=>{const{surveyId:o,responseGroupUid:a,visitorId:s,envId:l}=e.payload;e.on("deviceError",function(){console.warn("device error: ",e.deviceErrorCode),e.deviceErrorCode.message==="Permission denied"?(e.deviceButton.addClass("permission-denied"),n&&n(B.ERROR,{type:B.PERMISSION_DENIED}),vt({event:"Video Permission Denied",apiBase:t,headers:i,visitorId:s,envId:l,metadata:{questionId:Si(e,bi),responseGroupUid:a,surveyId:o}})):(n&&n(B.ERROR,{type:B.OTHER}),et(new Error(e.deviceErrorCode.message),"recorderDeviceError",t,i,s,l))}),e.on("error",function(u,c){et(c||e.error(),"recorderError",t,i,s,l)}),e.on("startRecord",function(u,c){r(e.uploadProgressLabel,"none"),vt({event:"Video Record Start",apiBase:t,headers:i,visitorId:s,envId:l,metadata:{questionId:Si(e,bi),responseGroupUid:a,surveyId:o}})}),e.on("finishRecord",async function(){r(e.uploadProgressLabel,"start",0);const u=Si(e,bi);if(!o){const h="internal error: missing fields in payload";return n&&n(B.ERROR,{type:B.OTHER}),et(new Error(h),"finishRecord",t,i,s,l),null}e.record().stopDevice();const c=e.cameraOff?B.MEDIA_TYPE_AUDIO:B.MEDIA_TYPE_VIDEO,d=at();vt({event:"Video Record Finish",apiBase:t,headers:i,visitorId:s,envId:l,metadata:{mediaRecordingUid:d,questionId:u,responseGroupUid:a,surveyId:o,mediaType:c}});const f={surveyId:o,updatedAt:new Date().toISOString(),mediaType:c,mediaRecordingUid:d};u&&(f.questionId=u),a&&(f.responseGroupUid=a),s&&(f.visitorId=s);const v=await(async()=>{const h=await fetch(`${t}/2/environments/integrations/upload`,{method:"POST",cache:"no-cache",headers:{"Content-Type":"application/json"},body:JSON.stringify(f)});if(h.ok){const g=await h.json();return n&&n(B.UPLOAD_STARTED,{[B.UPLOAD_ID]:g.upload.id,[B.MEDIA_TYPE]:c,[B.MEDIA_RECORDING_UID]:d}),g.upload.url}else return n&&n(B.ERROR,{type:B.OTHER,response:h}),et(new Error("failed to get upload response with url"),"finishRecord",t,i,s,l),null})();!v||($e=M.document.defaultView.UpChunk.createUpload({endpoint:v,file:new M.document.defaultView.File([e.recordedData],`recording ${c} ${Date.now()}`),chunkSize:5120}),$e.startTime=Date.now(),vt({event:"Video Upload Start",apiBase:t,headers:i,visitorId:s,envId:l,metadata:{mediaRecordingUid:d,questionId:u,responseGroupUid:a,surveyId:o,mediaType:c,url:v}}),$e.on("error",h=>{r(e.uploadProgressLabel,"none"),n&&n(B.UPLOAD_FINISHED,{[B.MEDIA_RECORDING_UID]:d}),et(h,"finishRecord",t,i,s,l)}),$e.on("progress",h=>{n&&n(B.UPLOAD_PROGRESS,{[B.MEDIA_RECORDING_UID]:d,[B.UPLOAD_PROGRESS_PCT]:h.detail}),r(e.uploadProgressLabel,"progress",h.detail)}),$e.on("success",()=>{r(e.uploadProgressLabel,"success"),n&&n(B.UPLOAD_FINISHED,{[B.MEDIA_RECORDING_UID]:d}),vt({event:"Video Upload Success",apiBase:t,headers:i,visitorId:s,envId:l,metadata:{mediaRecordingUid:d,questionId:u,responseGroupUid:a,surveyId:o,mediaType:c,url:v,elapsedMs:$e.startTime&&Date.now()-$e.startTime}})}))})},Ic=(e,t)=>{const n=new(M.videojs.getComponent("Component"))(e);return n.addClass("ul-buttons-panel"),t.map(r=>{n.addChild(r)}),bg(n),n},bg=e=>{e.children().forEach(t=>{if(De[t.name_]){const n=_r(De[t.name_],`ul-${De[t.name_]}`);t.el_.appendChild(n)}})},_r=(e,t="")=>{const n=M.document.createElement("span");return n.className="ul-button-text",n.innerHTML=e,n.id=t,n},kc=(e,t,n,r,i=!1,o)=>{e.addClass("ul-video-player");const a=new(M.videojs.getComponent("Component"))(e);a.addClass("ul-control-panel"),e.progressBar=a.addChild("ProgressControl"),n&&e.src(n),e.audioPlayerPlaceholder=new(M.videojs.getComponent("Component"))(e),e.audioPlayerPlaceholder.addClass("ul-audio-recorder-placeholder");const s=n&&n.src?Lg(n.src):null;n&&(i||!s)?(e.children()[0].classList.add("vjs-hidden"),M.document.getElementById(`${e.id()}_html5_api`).style.height="0px"):(e.audioPlayerPlaceholder.hide(),M.document.getElementById(`${e.id()}_html5_api`).style.height="100%",s&&e.poster(s)),e.on("play",()=>{!i&&n&&!s&&Sg(e,!1),o==null||o.play()}),e.on("pause",()=>{o==null||o.pause()}),e.on("seeked",()=>{o==null||o.currentTime(e.currentTime())}),e.on("ratechange",()=>{o==null||o.playbackRate(e.playbackRate())}),e.addChild(e.audioPlayerPlaceholder,{},1),a.addChild(t),e.addChild(a),r&&r(e)},Eg=(e,t,n)=>{e.addClass(`ul${xc}`);const r=new(M.videojs.getComponent("Component"))(e);t&&e.src(t),e.addChild(r),n&&n(e)},xg=(e,t,n,r,i,o,a,s=!1)=>{Ds=Date.now();const u=Br(t,{controls:!1,bigPlayButton:!1,fluid:!1,width:1280,height:720,playsinline:!0,plugins:{record:{audio:!0,video:{mandatory:{minWidth:1280,minHeight:720}},frameWidth:1280,frameHeight:720,maxLength:600,autoMuteDevice:!0}}});if(!u)return;u.payload=n;const{surveyId:c,questionId:d,responseGroupUid:f,visitorId:p,envId:v}=n;let h;const g=O=>{const T=Ei,D=Ei+"-audio-only";Ps(u.uploadProgressLabel,"none"),$e&&$e.startTime>=Ds&&$e.abort();const z=M.document.getElementById("ul-camera-button");O?(u.children()[0].classList.add("vjs-hidden"),b.removeClass(T),b.addClass(D),z.innerHTML=De.TurnOnCamera,u.audioPlayerPlaceholder.removeClass("vjs-hidden"),h==null||h.getTracks().forEach(C=>{C.stop()}),window.navigator.mediaDevices.getUserMedia({video:!0,audio:!0}).then(C=>{h=C,C.getVideoTracks().forEach(W=>{W.enabled=!1}),u.record().onDeviceReady(C)}).catch(u.record().onDeviceError.bind(u.record()))):(h==null||h.getVideoTracks().forEach(C=>{C.enabled=!0}),u.children()[0].classList.remove("vjs-hidden"),u.record().getDevice(),b.removeClass(D),b.addClass(T),z.innerHTML=De.TurnOffCamera,u.audioPlayerPlaceholder.addClass("vjs-hidden"))},_=new(M.videojs.getComponent("Button"))(u,{clickHandler:()=>{_.hasClass(se)||(vt({event:"Video Delete Button Clicked",apiBase:r,headers:a,visitorId:p,envId:v,metadata:{questionId:d,responseGroupUid:f,surveyId:c}}),g(u.cameraOff),i(B.DELETE,{}),b.removeClass(se),_.addClass(se))}});_.addClass("ul-video-recorder-delete-button"),_.el_.appendChild(_r(De.DeleteButton,"ul-delete-button"));const w=M.document.getElementById(t),E=()=>{w.classList.contains("vjs-fullscreen")&&u.cameraOff?w.style.display="table":w.style.display="flex"};E();const b=new(M.videojs.getComponent("Button"))(u,{clickHandler:()=>{u.record().isRecording()||(u.cameraOff=!u.cameraOff,vt({event:"Video Camera Button Clicked",apiBase:r,headers:a,visitorId:n.visitorId,envId:n.envId,metadata:{questionId:d,responseGroupUid:f,surveyId:c,cameraOff:u.cameraOff}}),g(u.cameraOff),!_.hasClass(se)&&_.addClass(se),i(B.DELETE,{}),E())}});b.addClass(Ei),b.el_.appendChild(_r(De.TurnOffCamera,"ul-camera-button"));const m=new(M.videojs.getComponent("Button"))(u,{clickHandler:()=>{const O=M.document.getElementById("ul-recorder-toggle");if(u.record().isRecording())u.record().stop(),O&&(O.innerHTML=De.RecordButton),m.removeClass(xi),_.removeClass(se);else{const T=M.document.getElementById("ul-recording-countdown-screen");if(T)T.remove(),O&&(O.innerHTML=De.RecordButton),g(u.cameraOff),i(B.DELETE,{}),b.removeClass(se),_.addClass(se),m.removeClass(xi),S.show();else{m.addClass(xi),S.hide(),b.addClass(se),_.addClass(se),O&&(O.innerHTML=De.StopButton);const D=M.document.createElement("div");D.id="ul-recording-countdown-screen",w.insertBefore(D,w.children[1]),D.style.height=`${w.offsetHeight}px`,Tc(u,3)}}}});m.addClass("ul-video-recorder-toggle-button"),m.el_.appendChild(_r(De.RecordButton,"ul-recorder-toggle"));const x=M.document.createElement("p");x.style.visibility="hidden",x.className="ul-upload-progress-label",e.appendChild(x),u.uploadProgressLabel=x;const k=Ic(u,[_,b,"PlayToggle",m,"FullscreenToggle"]),S=k.children().find(O=>O.name_==="FullscreenToggle");S.hasClass("vjs-disabled")&&S.hide();const I=k.children().find(O=>O.name_==="PlayToggle");I.hide(),o&&b.addClass(se),!o&&_.addClass(se),kc(u,k,o,!1,s),u.on("stopRecord",()=>{m.hide(),I.show(),S.show(),_.removeClass(se)}),u.on("deviceReady",()=>{m.show(),I.hide(),_.addClass(se)}),wg(u,r,i,Ps,a),o&&(u.deviceButton&&u.deviceButton.hide(),u.src(o),I.show(),m.hide(),_.removeClass(se));const R=[{name:"microphone"}];!u.cameraOff&&R.push({name:"camera"}),Promise.all(R.map(O=>{var T;return(T=navigator==null?void 0:navigator.permissions)==null?void 0:T.query(O)})).then(O=>{O.reduce((D,z)=>D&z.state==="granted",!0)&&u&&(u.deviceButton&&u.deviceButton.hide(),!o&&u.record().getDevice())}).catch(O=>{})},Tc=(e,t=3)=>{const n=M.document.getElementById("ul-recording-countdown-screen");n&&t===0?(n.remove(),e.record().start()):n&&(n.innerHTML=`<span class='ul-countdown-text'>Recording in... ${t}</span>`,setTimeout(()=>{Tc(e,t-1)},1e3))},Lc=e=>{const t=M.document.createElement("div");return t.className="ul-video-container",t.appendChild(gg(e)),t},vo=(e,t)=>{const n=M.document.createElement("video");n.id=e,n.className="video-js vjs-default-skin ul-video-player-video";const r=M.document.createElement("p");r.className="vjs-no-js",r.innerHTML="To view this video please enable JavaScript, and consider upgrading to a web browser that";const i=M.document.createElement("a");return i.href="https://videojs.com/html5-video-support/",i.target="_blank",i.innerHTML="supports HTML5 video",r.appendChild(i),n.appendChild(r),t.appendChild(n),t},Sg=(e,t)=>{t?(e.children()[0].classList.add("vjs-hidden"),e.audioPlayerPlaceholder.show(),M.document.getElementById(`${e.id()}_html5_api`).style.height="0px"):(e.children()[0].classList.remove("vjs-hidden"),e.audioPlayerPlaceholder.hide(),M.document.getElementById(`${e.id()}_html5_api`).style.height="100%")},Br=(e,t)=>M.document.getElementById(e)?t?M.videojs(e,t):M.videojs(e):(console.error(`Error in finding player element with ID, ${e}`),null),Cg=(e,t,n,r=!1,i="https://api.sprig.com",o=document,a=null,s=null)=>{M.document=o;const l=e+Ec,u=Lc(l);return M.document.addEventListener("securitypolicyviolation",c=>{et(new Error(`Voice & Video feature violates ${c.violatedDirective} web page CSP policies for the question player.`),"playerDeviceError",i,{})}),Cc(bc,()=>{M.document.getElementById(ca(l)).remove(),vo(l,u);const c={playsinline:!0,playbackRates:[.5,1,1.5,2],fill:!0};try{const d=e+xc;vo(d,u);const f=Br(l,c),p=Br(d,{muted:!0,...c});if(!f||!p)return;Eg(p,a,s),a||p.addClass(se);const v=Ic(f,["PlaybackRateMenuButton","PlayToggle","FullscreenToggle"]),h=v.children().find(g=>g.name_==="FullscreenToggle");h.hasClass("vjs-disabled")&&h.hide(),kc(f,v,t,n,r,p)}catch(d){et(new Error(`Error when creating video player object ${d}`),"playerDeviceError",i,{});return}}),u},Ig=(e,t={},n="https://api.userleap.com",r,i,o,a=!1,s=document)=>{M.document=s;const l=e+Sc,u=Lc(l);return M.document.addEventListener("securitypolicyviolation",c=>{et(new Error(`Voice & Video feature violates ${c.violatedDirective} web page CSP policies for the recorder player.`),"recorderDeviceError",n,o,t.visitorId,t.envId)}),Cc(bc.concat(yg),()=>{vo(l,u),M.document.getElementById(ca(l)).remove();try{xg(u,l,t,n,r,i,o,a)}catch(c){et(new Error(`Error when creating video recorder player object ${c}`),"recorderDeviceError",n,o,t.visitorId,t.envId);return}}),u},kg=e=>{const t=e+Sc;if(!!M.document.getElementById(t)&&!!M.videojs){try{if(!M.videojs(t).record().stream)return}catch{return}M.videojs(t).record().stop(),M.videojs(t).record().stopDevice()}},Tg=e=>{const t=Br(e+Ec);t==null||t.pause()},Lg=e=>{if(!e)return null;const t=e.match(/https:\/\/stream.mux.com\/(.*)/);let n=t?t[1]:null;return n.includes(Os)&&(n=n.replace(Os,"")),n?`https://image.mux.com/${n}/thumbnail.jpg?time=0`:null},B={UPLOAD_STARTED:"upload.started",UPLOAD_PROGRESS:"upload.progress",UPLOAD_FINISHED:"upload.finished",DELETE:"delete",ERROR:"error",MEDIA_TYPE:"media.type",PERMISSION_DENIED:"permission_denied",OTHER:"other",UPLOAD_ID:"upload.id",UPLOAD_PROGRESS_PCT:"upload.progress.pct",MEDIA_RECORDING_UID:"media.recording.uid",MEDIA_TYPE_VIDEO:"video",MEDIA_TYPE_AUDIO:"audio"},De={PlaybackRateMenuButton:"Speed",PlayToggle:"Play",FullscreenToggle:"Expand",TurnOnCamera:"Turn on",TurnOffCamera:"Turn off",DeleteButton:"Delete",RecordButton:"Record",StopButton:"Stop",PauseButton:"Pause"},yn="ul-card-video__player_recorder",Rg="ul-card-video__skip_button",Ag="ul-video-interview-form",Ns="ul-video-btn",Ug=({className:e,message:t,next:n,properties:r,questionId:i,type:o})=>{const{apiURL:a,envId:s,handleUploadUpdate:l,headers:u,responseGroupUid:c,surveyId:d,viewDocument:f,visitorId:p}=X(T=>({apiURL:T.apiURL,envId:T.envId,handleUploadUpdate:T.handleUploadUpdate,headers:T.headers,responseGroupUid:T.responseGroupUid,surveyId:T.surveyId,viewDocument:T.viewDocument,visitorId:T.userId})),[v,h]=le(!1),[g,_]=le(null),[w,E]=le(null),[b,m]=le(0),x=r&&r.videoUrl,k=(T,D)=>{T===B.UPLOAD_STARTED?(_(D[B.UPLOAD_ID]),E(D[B.MEDIA_RECORDING_UID]),h(!0)):T===B.DELETE?(_(null),E(null),h(!1)):T===B.UPLOAD_PROGRESS?isNaN(D[B.UPLOAD_PROGRESS_PCT])?l({mediaRecordingUid:D[B.MEDIA_RECORDING_UID],isComplete:!0}):l({mediaRecordingUid:D[B.MEDIA_RECORDING_UID],progressPct:D[B.UPLOAD_PROGRESS_PCT]}):T===B.UPLOAD_FINISHED&&l({mediaRecordingUid:D[B.MEDIA_RECORDING_UID],isComplete:!0})},S=T=>{if(T&&T.children.length===0){const D=Cg(yn,{src:x,type:"application/x-mpegURL"},void 0,r.mediaType===B.MEDIA_TYPE_AUDIO,a,f);T.appendChild(D)}},I=T=>{if(T&&T.children.length===0){const D=Ig(yn,{surveyId:d,responseGroupUid:c,questionId:i,visitorId:p,envId:s},a,k,void 0,{...u,"x-ul-video-recorder-origin":"sdk"},r.mediaType===B.MEDIA_TYPE_AUDIO,f);T.appendChild(D)}},R=T=>{T.preventDefault(),T.stopPropagation(),kg(yn),g&&w?(l({mediaRecordingUid:w,isSubmitted:!0}),n({value:{mediaRecordingUid:w},questionId:i,type:o})):n({value:null,questionId:i,type:o})},O=()=>y(ct,{defaultBody:()=>y("button",{className:`${Ns} ul-record-response-btn`,onClick:T=>{T.preventDefault(),T.stopPropagation(),Tg(yn),m(1)}}),properties:r});return y("form",{className:H([e,U.VideoCard,U.FadeInTransition]),id:Ag,children:[y(Be,{message:t,properties:r}),y("div",{id:"ul-card-voice__video",children:[y("div",{children:[y("div",{id:"ul-question-player-container",style:{display:b===0?"":"none"},children:[y("div",{id:yn,ref:S}),O()]}),y("div",{style:{display:b===1?"block":"none"},children:[y("button",{className:`${Ns} ul-back-question-btn`,onClick:T=>{T.preventDefault(),T.stopPropagation(),m(0)}}),y("div",{id:"ul-recorder-player-container",ref:I})]})]}),y(ye,{disabled:!v,onClick:R,children:Gt(r)}),y("button",{className:`ul-card-text__button ${U.InactiveButton} ${U.SkipButton}`,id:Rg,onClick:R,style:{display:r.required?"none":"block",...v?{display:"none"}:{}},children:sa(r)})]})]})},Og=({className:e})=>{const{uploadProgress:t}=X(o=>({uploadProgress:o.uploadProgress}));let n,r;Object.values(t).filter(o=>o.isSubmitted).length>1?(n="Your responses are processing",r="Please keep this tab open until your responses are fully processed."):(n="Your response is processing",r="Please keep this tab open until your response is fully processed.");const i=Math.round(Math.min(99,...Object.values(t).filter(o=>o.isSubmitted).map(o=>o.progressPct||0)));return y("div",{className:H([e,"ul-card--uploading",U.FadeInTransition]),children:[y("div",{"aria-busy":"true","aria-label":"Processing...","aria-live":"polite",className:U.LoadingSpinnerContainer,role:"progressbar",children:y("div",{className:U.LoadingSpinner,children:[y("div",{className:U.LoadingSpinnerFirst}),y("div",{className:U.LoadingSpinnerSecond}),y("div",{className:U.LoadingSpinnerThird}),y("div",{className:U.LoadingSpinnerFourth})]})}),y(Be,{message:`${n} (${i}% complete)`}),y("p",{className:U.Caption,children:r})]})},Ms=({logoOnly:e=!1,style:t={}})=>y("svg",{alt:`${e?"Powered by ":""}Sprig`,width:e?"35":"112",height:"15",viewBox:e?"79 0 31 15":"0 0 112 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{display:"block",...t},children:[!e&&y("path",{d:"M0.648926 12.0181V2.8584H4.21631C6.0127 2.8584 7.25684 4.06445 7.25684 5.86084V5.87354C7.25684 7.66357 6.0127 8.88867 4.21631 8.88867H2.0708V12.0181H0.648926ZM3.86084 4.05811H2.0708V7.69531H3.86084C5.09229 7.69531 5.80957 7.02881 5.80957 5.87988V5.86719C5.80957 4.72461 5.09229 4.05811 3.86084 4.05811ZM11.6621 12.1514C9.63721 12.1514 8.39941 10.7993 8.39941 8.57764V8.56494C8.39941 6.34961 9.64355 4.99121 11.6621 4.99121C13.6743 4.99121 14.9185 6.34326 14.9185 8.56494V8.57764C14.9185 10.7993 13.6807 12.1514 11.6621 12.1514ZM11.6621 11.0024C12.8428 11.0024 13.5156 10.1011 13.5156 8.57764V8.56494C13.5156 7.03516 12.8428 6.14014 11.6621 6.14014C10.4751 6.14014 9.80859 7.03516 9.80859 8.56494V8.57764C9.80859 10.1074 10.4751 11.0024 11.6621 11.0024ZM17.6226 12.0181L15.7183 5.12451H17.1021L18.3398 10.4438H18.4414L19.8633 5.12451H21.1709L22.5928 10.4438H22.7007L23.9321 5.12451H25.2969L23.3989 12.0181H21.9834L20.5552 6.87646H20.4473L19.0254 12.0181H17.6226ZM29.334 12.1514C27.3154 12.1514 26.0967 10.7739 26.0967 8.59033V8.58398C26.0967 6.43213 27.3408 4.99121 29.2642 4.99121C31.1875 4.99121 32.3682 6.38135 32.3682 8.45068V8.93311H27.4805C27.5059 10.2534 28.2295 11.0215 29.3657 11.0215C30.248 11.0215 30.7749 10.5835 30.9399 10.228L30.9653 10.1772L32.292 10.1709L32.2793 10.228C32.0508 11.1357 31.0986 12.1514 29.334 12.1514ZM29.2705 6.12109C28.3311 6.12109 27.6201 6.76221 27.4995 7.94922H31.0034C30.8955 6.71777 30.2036 6.12109 29.2705 6.12109ZM34.0059 12.0181V5.12451H35.3833V6.16553H35.4849C35.7324 5.43555 36.3735 5.00391 37.2939 5.00391C37.5161 5.00391 37.7573 5.03564 37.897 5.06738V6.33691C37.6494 6.28613 37.4146 6.25439 37.1543 6.25439C36.1006 6.25439 35.3833 6.90186 35.3833 7.89844V12.0181H34.0059ZM41.9277 12.1514C39.9092 12.1514 38.6904 10.7739 38.6904 8.59033V8.58398C38.6904 6.43213 39.9346 4.99121 41.8579 4.99121C43.7812 4.99121 44.9619 6.38135 44.9619 8.45068V8.93311H40.0742C40.0996 10.2534 40.8232 11.0215 41.9595 11.0215C42.8418 11.0215 43.3687 10.5835 43.5337 10.228L43.5591 10.1772L44.8857 10.1709L44.873 10.228C44.6445 11.1357 43.6924 12.1514 41.9277 12.1514ZM41.8643 6.12109C40.9248 6.12109 40.2139 6.76221 40.0933 7.94922H43.5972C43.4893 6.71777 42.7974 6.12109 41.8643 6.12109ZM49.1133 12.1323C47.3804 12.1323 46.2568 10.7422 46.2568 8.57764V8.56494C46.2568 6.38135 47.3613 5.00391 49.1133 5.00391C50.0591 5.00391 50.8652 5.47363 51.2334 6.21631H51.3413V2.42041H52.7124V12.0181H51.3413V10.9326H51.2334C50.8335 11.688 50.0781 12.1323 49.1133 12.1323ZM49.5068 10.958C50.6558 10.958 51.3604 10.0503 51.3604 8.57764V8.56494C51.3604 7.09229 50.6494 6.18457 49.5068 6.18457C48.3516 6.18457 47.6597 7.08594 47.6597 8.56494V8.57764C47.6597 10.0566 48.3516 10.958 49.5068 10.958ZM61.98 12.1323C61.0151 12.1323 60.2598 11.688 59.8599 10.9326H59.7583V12.0181H58.3809V2.42041H59.7583V6.21631H59.8599C60.228 5.47363 61.0342 5.00391 61.98 5.00391C63.7319 5.00391 64.8364 6.38135 64.8364 8.56494V8.57764C64.8364 10.7422 63.7192 12.1323 61.98 12.1323ZM61.5928 10.958C62.7417 10.958 63.4336 10.0566 63.4336 8.57764V8.56494C63.4336 7.08594 62.7417 6.18457 61.5928 6.18457C60.4438 6.18457 59.7329 7.09229 59.7329 8.56494V8.57764C59.7329 10.0503 60.4438 10.958 61.5928 10.958ZM66.8867 14.4429C66.7153 14.4429 66.5122 14.4302 66.3345 14.4111V13.3257C66.4678 13.3447 66.6392 13.3511 66.7979 13.3511C67.439 13.3511 67.8262 13.0781 68.0293 12.3799L68.1309 12.0244L65.6299 5.12451H67.1152L68.8418 10.6343H68.9624L70.6826 5.12451H72.1299L69.5654 12.2847C68.9814 13.9287 68.2832 14.4429 66.8867 14.4429Z",fill:"black",fillOpacity:"0.7"}),y("path",{d:"M81.1088 6.63629C79.6878 6.32154 78.9672 5.76865 78.9672 4.99369C78.9672 4.19299 79.736 3.5886 80.7556 3.5886C81.8066 3.5886 82.5995 4.25285 82.5995 5.13336V5.20352H84.0518V5.13336C84.0518 3.52424 82.6405 2.30774 80.7693 2.30774C79.8676 2.30774 79.0414 2.58451 78.4433 3.08655C78.1463 3.33144 77.9077 3.63818 77.7448 3.98479C77.5818 4.33141 77.4984 4.70934 77.5005 5.09153C77.4946 5.44197 77.5675 5.78934 77.714 6.10857C77.8605 6.42779 78.0769 6.71092 78.3475 6.93752C78.8512 7.37584 79.5659 7.70024 80.4709 7.90299C81.9949 8.23898 82.7676 8.81054 82.7676 9.60094C82.7676 10.4576 81.9258 11.1032 80.813 11.1032C79.6571 11.1032 78.7854 10.3856 78.7854 9.43424V9.36408H77.3318V9.43424C77.3318 11.1167 78.8219 12.3847 80.7973 12.3847C81.7421 12.3847 82.6093 12.0983 83.2393 11.5769C83.5519 11.3237 83.8034 11.0048 83.9753 10.6433C84.1472 10.2818 84.2352 9.88702 84.2329 9.48766C84.2329 8.05875 83.1833 7.09907 81.1088 6.63629Z",fill:"black",fillOpacity:"0.7"}),y("path",{d:"M89.2394 4.68276C88.6963 4.67605 88.1596 4.79915 87.6751 5.04156C87.1905 5.28397 86.7725 5.63851 86.4566 6.07497V4.85204H85.0747V14.8479H86.4566V11.0356C86.7725 11.472 87.1906 11.8265 87.6751 12.0688C88.1596 12.3111 88.6963 12.434 89.2394 12.4272C91.3836 12.4272 93 10.7627 93 8.55495C93 6.34723 91.3836 4.68276 89.2394 4.68276ZM91.5608 8.84202C91.5057 9.41605 91.2512 9.95356 90.8406 10.3633C90.4299 10.773 89.8883 11.0296 89.3078 11.0896C88.5363 11.1669 87.8177 10.9461 87.2841 10.4692C86.7505 9.99222 86.4566 9.3106 86.4566 8.55495C86.4566 7.10159 87.5538 6.00546 89.0087 6.00546C89.7619 6.00546 90.4421 6.29124 90.9171 6.81002C91.407 7.34232 91.6357 8.06385 91.5608 8.84202Z",fill:"black",fillOpacity:"0.7"}),y("path",{d:"M109.95 4.85407V6.06349C109.298 5.18298 108.292 4.68286 107.153 4.68286C105.017 4.68286 103.406 6.31709 103.406 8.48426C103.406 10.6514 105.017 12.285 107.153 12.285C108.296 12.285 109.303 11.79 109.95 10.9185V11.1046C109.95 12.6101 108.993 13.5826 107.513 13.5826C106.513 13.5826 105.68 13.1494 105.284 12.424L105.264 12.3867H103.838L103.871 12.48C104.112 13.1892 104.583 13.8001 105.211 14.2179C105.841 14.6324 106.637 14.8512 107.513 14.8512C108.637 14.8512 109.594 14.4972 110.28 13.8285C110.967 13.1597 111.332 12.2194 111.332 11.1213V4.85407H109.95ZM109.175 10.3502C108.588 10.905 107.752 11.138 106.879 10.9887C106.361 10.8984 105.886 10.6475 105.523 10.2725C105.16 9.89751 104.927 9.41787 104.859 8.90328C104.736 8.03757 104.999 7.21756 105.581 6.655C106.069 6.19093 106.723 5.93643 107.401 5.94699C107.565 5.94713 107.729 5.96026 107.891 5.98625C108.946 6.15489 109.781 7.01609 109.921 8.0852C110.039 8.96507 109.766 9.78958 109.175 10.3502Z",fill:"black",fillOpacity:"0.7"}),y("path",{d:"M101.89 2.12378C101.63 2.06766 101.358 2.11486 101.133 2.25518C100.908 2.39551 100.747 2.61769 100.687 2.87371C100.626 3.12973 100.67 3.39902 100.809 3.62339C100.947 3.84775 101.17 4.00917 101.428 4.07275C101.503 4.08936 101.58 4.09778 101.657 4.09786C101.906 4.09824 102.146 4.0083 102.331 3.84518C102.517 3.68206 102.636 3.45714 102.664 3.21327C102.693 2.9694 102.63 2.72361 102.487 2.5227C102.344 2.32179 102.132 2.17981 101.89 2.12378Z",fill:"black",fillOpacity:"0.7"}),y("path",{d:"M100.967 10.934H99.7755C98.9285 10.934 98.4196 10.3644 98.4196 9.40982C98.4196 8.4791 98.8757 7.36945 99.8054 6.01778L99.8178 5.99976V5.61807L95.8571 5.06453C95.8585 4.90331 95.8162 4.74466 95.7346 4.60501C95.653 4.46536 95.5352 4.34979 95.3932 4.27027C95.0381 4.07718 94.6498 4.07717 94.3279 4.26383C94.1667 4.35799 94.035 4.4945 93.9476 4.65816C93.8602 4.82182 93.8205 5.00623 93.8328 5.19087C93.8452 5.37552 93.9092 5.55315 94.0176 5.70402C94.1261 5.85489 94.2748 5.97309 94.4472 6.04546L93.2151 12.258H94.5833L95.7196 6.35891L97.8593 6.7155C97.284 7.73439 96.9921 8.68442 96.9921 9.53919C96.9921 11.1168 97.9577 12.1498 99.5187 12.2496V12.258H102.346V4.87723H100.967V10.934Z",fill:"black",fillOpacity:"0.7"})]}),Dg=()=>{const{border:e,cards:t,forceBrandedLogo:n,headers:r,index:i,marketingUrl:o,showSurveyBrand:a,slugName:s,surveyId:l,viewedCardCount:u}=X(E=>({border:E.border,cards:E.cards,forceBrandedLogo:E.forceBrandedLogo,headers:E.headers,index:E.index,marketingUrl:E.marketingUrl,showSurveyBrand:E.showSurveyBrand,slugName:E.slugName,surveyId:E.surveyId,viewedCardCount:E.viewedCardCount})),c=xt(null),d=t.filter(E=>E.type!==L.Uploading&&E.type!==L.Thanks),f=Nm(t,i),p=u+1,v=p/(p+f),h=`${o}?utm_source=survey_branding&utm_medium=website&utm_campaign=${s}&utm_content=${l}${n&&"&utm_term=poweredby_pill"}`;Ae(()=>{c.current&&(c.current.style.width=`${v*100}%`)},[v]);const g=()=>y(Ce,{children:[d.length>1&&y("div",{id:"ul-progress-bar-container",children:y("div",{id:"ul-progress-bar-current",ref:c,style:{border:`1px solid ${e||"#000"}`}})}),a?y("div",{className:n?"yellow-footer-logo":"",style:{marginTop:"4px"},children:y("a",{href:h,rel:"noreferrer",target:"_blank",children:y("div",{style:{display:"flex"},children:[y(Ms,{logoOnly:!1}),n&&y(Vs,{style:{display:"block",margin:"auto 0 auto 4px",transform:"rotateY(0deg) rotate(-45deg)"}})]})})}):null]}),_=()=>y("a",{dir:"ltr",href:h,rel:"noreferrer",target:"_blank",children:y("div",{className:"thank-you-card-link",children:[y("div",{className:"sprig-box-logo",children:y(Ms,{logoOnly:!0,style:{margin:"auto"}})}),y("div",{children:y("p",{children:["Capture insights about your own product",y(Vs,{style:{display:"inline-flex",marginInlineStart:"4px",verticalAlign:"middle"}})]})})]})}),w=t[i].type===L.Thanks;return y("footer",{className:`ul-footer ${r["userleap-platform"]==="link"?"ul-footer__link":""}`,style:a?{}:{marginBottom:"10px"},children:w&&n?_():g()})},Vs=({style:e})=>y("svg",{fill:"none",height:"10",style:e,viewBox:"0 0 12 10",width:"12",xmlns:"http://www.w3.org/2000/svg",children:[y("path",{d:"M1.47839 5.2085L10.9384 5.2085",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.35"}),y("path",{d:"M7.0686 1.15845L10.9386 5.20845L7.0686 9.25845",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.35"})]}),Pg=()=>{const{answers:e,border:t,cards:n,close:r,configureExitOnOverlayClick:i,destroy:o,endCard:a,eventEmitFn:s,fontFamily:l,headers:u,index:c,next:d,showStripes:f,surveyId:p,update:v,useMobileStyling:h,viewDocument:g}=X(C=>({answers:C.answers,border:C.border,cards:C.cards,close:C.close,configureExitOnOverlayClick:C.configureExitOnOverlayClick,destroy:C.destroy,endCard:C.endCard,eventEmitFn:C.eventEmitFn,fontFamily:C.fontFamily,headers:C.headers,index:C.index,next:C.next,showStripes:C.showStripes,surveyId:C.surveyId,update:C.update,useMobileStyling:C.useMobileStyling,viewDocument:C.viewDocument})),_=xt(null),w=xt(!1),E=u["userleap-platform"],{props:b,type:m,name:x}=n[c],k=n.length;Ae(()=>{_.current&&(_.current.classList.contains("ul-app--visible")||_.current.classList.add("ul-app--visible"),!w.current&&s&&(w.current=!0,s(j.SurveyAppeared,{name:j.SurveyAppeared,[Rn.SurveyId]:p})))},[s,p]),Ae(()=>{v()},[c,v]),Ae(()=>{i(()=>r())},[r,i]);const S=()=>r(Xt),I=C=>{C.key==="Enter"&&S()},R=async function(C){d({data:C,completeSurvey:()=>{o(Xt)},endCard:a}),Yf(g)};if(e){for(const C of e)if(C.questionId===x){let W;if(m===L.MultipleChoice){const re=b.options.find(({value:Ie})=>Ie===C.value);if(!re)break;W={[re.id]:re.value}}else W=C.value;R({value:W,type:m,questionId:C.questionId});break}}const O=()=>[Vt.Email,Vt.Link].includes(u["userleap-platform"])?!1:!a||c+1!==k,T=()=>h?{borderColor:t}:{borderColor:t,margin:"15px"},D=()=>{const C={className:"ul-card",next:R,questionId:x,type:m};switch(m){case L.ConsentLegal:return ee(zm,{...C,...b,key:x});case L.Likert:return ee(Ym,{...C,...b,key:x});case L.Matrix:return ee(Qm,{...C,...b,key:x});case L.MultipleChoice:return ee(Zm,{...C,...b,key:x});case L.MultipleSelect:return ee(Xm,{...C,...b,key:x});case L.NPS:return ee(Jm,{...C,key:x,props:b});case L.Open:return ee(eg,{...C,...b,key:x});case L.RecordedTask:return ee(dg,{...C,...b,key:x});case L.TextUrlPrompt:return ee(hg,{...C,...b,key:x});case L.Thanks:return ee(vg,{...C,...b,key:x});case L.Uploading:return ee(Og,{...C,...b,key:x});case L.VideoVoice:return ee(Ug,{...C,...b,key:x});default:return null}},z=C=>{var _e;const W=window.sprigAPI,re=C.target;if(!W||!re)return;const Ie=[re,re.parentElement];for(const ce of Ie)if(((_e=ce==null?void 0:ce.tagName)==null?void 0:_e.toLowerCase())==="a"){C.preventDefault(),W==null||W.openUrl(ce.href);return}};return y("div",{className:H("ul-app",Jt(u)?"ul-app--visible":"ul-app--overlay"),dir:"auto",id:Xt,onClick:z,ref:_,style:{"--theme":t,...l?{fontFamily:l.replace(";","")}:{}},children:y("div",{className:"ul-app__container",children:y("div",{className:H(oe(U.CardContainer,h)),style:T(),children:[O()&&y("div",{className:H(oe(U.CloseContainer,h)),children:y("div",{"aria-label":"Close button",className:U.CloseButton,onClick:S,onKeyPress:I,role:"button",tabIndex:0,children:y("svg",{fill:"none",height:"18px",viewBox:"0 0 13 13",width:"18px",xmlns:"http://www.w3.org/2000/svg",children:y("path",{d:"M2.54964 1.78369L1.78369 2.54964L5.73405 6.5L1.78369 10.4504L2.54964 11.2163L6.5 7.26595L10.4504 11.2163L11.2163 10.4504L7.26595 6.5L11.2163 2.54964L10.4504 1.78369L6.5 5.73405L2.54964 1.78369Z",fill:"#262136"})})})}),f&&y("div",{className:"ul-header__container",dir:"ltr",children:y("div",{className:"ul-header",children:"For development purposes only"})}),y("div",{className:H(Zf(U.CardMainContent,E)),children:D()}),y(Dg,{})]})})})},Ng=`html,body,p,ol,ul,li,dl,dt,dd,blockquote,figure,fieldset,legend,textarea,pre,iframe,hr,h1,h2,h3,h4,h5,h6{margin:0;padding:0}h1,h2,h3,h4,h5,h6{font-size:100%;font-weight:400}button,input,select,textarea{margin:0}html{box-sizing:border-box}*,*:before,*:after{box-sizing:inherit}ol,ul{padding-inline-start:1em}.ul-card{flex:1 1 auto;border-radius:2px;display:flex;flex-direction:column;font-size:17px;line-height:19px;text-align:start;margin:auto}.ul-card__container--desktop{border:2px solid #fff;box-shadow:0 0 15px #00000026}.ul-card__container--mobile{border-width:0;box-shadow:0 0 5px #00000040;margin-top:5px}.ul-card__container{background:#ffffff;border-radius:6px;display:flex;flex-direction:column;flex-grow:1;flex:1 1 auto;font-size:17px;line-height:23px;overflow:auto;padding:20px 20px 5px;position:relative;text-align:center;word-break:break-word;min-width:min-content}.ul-card-vertical__button-wrapper{flex-direction:column;align-items:center}.ul-card__button-wrapper{margin-top:4px;margin-bottom:3px;display:flex;gap:16px;justify-content:center}.ul-rich-text-body{min-height:2em}.ul-rich-text-body,.ul-rich-text-body p{margin-top:10px;margin-bottom:10px}.ul-rich-text-body li{margin:5px 0}.ul-rich-text-body p,.ul-rich-text-body li{font-size:15px;line-height:130.35%;letter-spacing:.02em;color:#343442;text-align:start;white-space:pre-line}.ul-rich-text-body:last-child,.ul-rich-text-body li:last-child{margin-bottom:15px}.ul-card-main-content__link,.ul-card-main-content__email{flex-grow:55;display:flex}.ul-card-main-content__web,.ul-card-main-content__android,.ul-card-main-content__ios{margin-bottom:5px}.ul-question{color:#343442;display:block;font-size:20px;line-height:125%;font-weight:500;cursor:default;text-align:start}.ul-caption{flex:1 0 auto;margin-top:8px;margin-bottom:15px;font-size:15px;line-height:130.35%;letter-spacing:.02em;color:#6c6c6e;text-align:start}.ul-card__choices{margin:5px 0 0;flex:1 0}.choice--mobile{border:2px solid #e6e6e6}.choice--desktop{border:1px solid #e6e6e6}.choice{align-items:flex-start;color:#262136;cursor:pointer;display:flex;justify-content:flex-start;flex-direction:column;box-sizing:border-box;border-radius:3px;margin-bottom:7px;font-size:15px;line-height:20px;padding:10px 20px 10px 15px;background-color:#00000003}.choice--desktop:hover,.choice--desktop:active,.choice--mobile:active{background-color:#0000000d}.choice-label-container{align-items:center;display:flex;flex-direction:row;flex:0 0 fit-content;gap:15px;height:fit-content;justify-content:flex-start;width:100%}.choice-text-entry-container{width:100%;height:fit-content;flex:0 1 fit-content;overflow:hidden}.choice .choice-text-input--mobile{max-height:63px}.choice .choice-text-input--desktop{max-height:150px}.choice .choice-text-input{box-sizing:border-box;background-color:transparent;color:#343442;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol;min-height:20px;max-height:60px;padding:0;margin-top:8px;resize:none;width:100%;font-size:14px;line-height:20px;outline:none;border:none;overflow-wrap:break-word}.choice .choice-text-input::placeholder{color:#6c6c6e80}.ul-thanks-check{text-align:center;margin-bottom:20px}.ul-card--thanks-content{padding:20px 0 10px}.ul-card--thanks .ul-question{padding-top:0;text-align:center}.ul-card--thanks .ul-caption{padding-top:0;text-align:center;overflow-wrap:break-word;hyphens:auto;hyphenate-limit-lines:no-limit}.ul-card--uploading .ul-question{padding-top:15px;text-align:center}.ul-card--uploading .ul-caption{padding-top:5px;text-align:center;overflow-wrap:break-word}.ul-loading-spinner-container{font-size:1.8rem;flex-grow:1;width:100%;height:100%;display:flex;align-items:center;justify-content:center}.ul-loading-spinner{display:inline-block;position:relative;width:6rem;height:6rem}.ul-loading-spinner div{box-sizing:border-box;display:block;position:absolute;width:80%;height:80%;margin:5px;border:5px solid #152e3e;border-radius:50%;animation:lds-ring 1.2s cubic-bezier(.5,0,.5,1) infinite;border-color:#152e3e transparent transparent transparent}.ul-loading-spinner .first{animation-delay:-.45s}.ul-loading-spinner .second{animation-delay:-.3s}.ul-loading-spinner .third{animation-delay:-.15s}@keyframes lds-ring{0%{transform:rotate(0)}to{transform:rotate(360deg)}}.select-checkbox{height:16px;width:16px;border-radius:3px;border:1px solid #323232;display:flex;box-sizing:border-box;box-shadow:inset 3px 3px #0000001a;background-color:"transparent";align-items:center;justify-content:center}.select-radio{height:16px;width:16px;border-radius:16px;border:1px solid #323232;display:flex;box-sizing:border-box;box-shadow:inset 2px 2px #0000001a;background-color:"transparent";align-items:center;justify-content:center}.fade-in-transition{animation:fadeIn .4s ease-in;-webkit-animation:fadeIn .4s ease-in;-moz-animation:fadeIn .4s ease-in;-o-animation:fadeIn .4s ease-in;-ms-animation:fadeIn .4s ease-in}@keyframes fadeIn{0%{opacity:0}to{opacity:1}}@-moz-keyframes fadeIn{0%{opacity:0}to{opacity:1}}@-webkit-keyframes fadeIn{0%{opacity:0}to{opacity:1}}@-o-keyframes fadeIn{0%{opacity:0}to{opacity:1}}@-ms-keyframes fadeIn{0%{opacity:0}to{opacity:1}}[class^=CenteredSurveyLayout] .ul-header__container,[class^=QuestionConceptTestLayout] .ul-header__container,.ul-websurvey-frame .ul-card__container,.ul-websurvey-frame-mobile .ul-card__container{margin-bottom:unset}[class^=CenteredSurveyLayout] .ul-card__container,[class^=QuestionConceptTestLayout] .ul-card__container,.ul-websurvey-frame .ul-card__container,.ul-websurvey-frame-mobile .ul-card__container{align-self:center;box-shadow:unset;border-radius:unset;border:none!important;position:unset;width:100%}@media only screen and (min-height: 600px) and (width: 600px){.ul-card{position:relative;top:-20px}}.ul-vertical-centered-container{display:flex;flex-direction:column;align-items:center}.ul-consent-legal__name-input--mobile{border:2px solid #e6e6e6}.ul-consent-legal__name-input--desktop{border:1px solid #e6e6e6}.ul-consent-legal__name-input{background:rgba(0,0,0,.01);box-sizing:border-box;color:#343442;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol;padding:10px 20px 10px 15px;border-radius:3px;font-size:15px;line-height:20px;margin-bottom:7px;width:100%}.ul-consent-legal__name-input::placeholder{color:#6c6c6e80}.ul-consent-legal__name-input:focus{outline:none;background:white}.ul-consent-legal__name-input--desktop:hover:not(:focus){background-color:#0000000d}.ul-card__consent-legal .choice{font-size:15px;padding:10px 15px;background-color:#00000003}.ul-card__consent-legal .choice--desktop:hover,.ul-card__consent-legal .choice--desktop:active,.ul-card__consent-legal .choice--mobile:active{background-color:#0000000d}.ul-card--likert__numbers{align-items:center;border-radius:5px;display:flex;flex-direction:row;flex:1 0;justify-content:center;margin:5px 0 0}.likert-number--mobile{border:2px solid #e6e6e6}.likert-number--mobile:not(:first-child){margin-inline-start:-2px}.likert-number--desktop{border:1px solid #e6e6e6}.likert-number--desktop:not(:first-child){margin-inline-start:-1px}.likert-number{align-items:center;cursor:pointer;display:flex;justify-content:center;flex:1 0;background-color:#00000003;font-size:18px;line-height:24px;height:67px}.likert-number:first-child{border-start-start-radius:5px;border-end-start-radius:5px}.likert-number:last-child{border-start-end-radius:5px;border-end-end-radius:5px}.likert-number:active,.likert-number--desktop:hover{background-color:#0000000d;font-weight:500}.likert-star--mobile:not(:first-child){margin-inline-start:-2px}.likert-star--desktop:not(:first-child){margin-inline-start:-1px}.likert-star{align-items:center;cursor:pointer;display:flex;justify-content:space-between;flex:1 0;color:transparent;font-size:18px;line-height:24px;height:67px}.likert-smiley--mobile:not(:first-child){margin-inline-start:-2px}.likert-smiley--desktop:not(:first-child){margin-inline-start:-1px}.likert-smiley{align-items:center;cursor:pointer;display:flex;justify-content:space-between;flex:1 0;color:transparent;line-height:24px;height:67px}.likert-smiley circle:not(:first-child){fill-opacity:1}.ul-card--likert__labels{align-items:center;color:#262136;display:flex;flex-direction:row;flex:1 0;font-weight:500;font-size:13px;line-height:15px;justify-content:space-between;margin:7px 0 10px}.ul-card--matrix_grid{display:grid;grid-template-columns:max-content repeat(var(--numColumns),minmax(93px,1fr));grid-template-rows:repeat(var(--numRows),min-content);margin:0 auto;row-gap:4px;width:max-content}.ul-matrix-row-options{display:grid;grid-column:2/-1;grid-template-columns:subgrid}.ul-matrix-column-label{font-size:15px;max-width:150px;padding:10px 12px;text-align:center}.ul-card--matrix_container{margin-bottom:16px;max-width:var(--maxWidth);overflow:auto}.ul-matrix-option-wrapper{align-items:center;background:#f9f9f8;display:flex;justify-content:center;padding:10px 12px}.ul-matrix-last-option{border-start-end-radius:4px;border-end-end-radius:4px}.ul-matrix-row-label{align-items:center;background:#f9f9f8;border-end-start-radius:4px;border-start-start-radius:4px;display:flex;font-size:15px;left:0;right:0;max-width:200px;min-width:100px;padding:10px 12px;position:sticky}.ul-matrix-option-selected{border:6px solid var(--border);box-shadow:none}.select-label{cursor:pointer;flex:1;overflow-wrap:anywhere;text-align:start}.ul-card--nps__numbers{align-items:center;border-radius:5px;display:flex;flex-direction:row;flex:1 0;justify-content:center;margin:5px 0 0}.nps-number--mobile{border:2px solid #e6e6e6}.nps-number--mobile:not(:first-child){margin-inline-start:-2px}.nps-number--desktop{border:1px solid #e6e6e6}.nps-number--desktop:not(:first-child){margin-inline-start:-1px}.nps-number{align-items:center;cursor:pointer;display:flex;justify-content:center;flex:1 0;background-color:#00000003;font-size:18px;line-height:24px;height:67px}.nps-number:first-child{border-start-start-radius:5px;border-end-start-radius:5px}.nps-number:last-child{border-start-end-radius:5px;border-end-end-radius:5px}.nps-number:active,.nps-number--desktop:hover{background-color:#0000000d;font-weight:500}.ul-card--nps__labels{align-items:center;color:#262136;display:flex;flex-direction:row;flex:1 0;font-weight:500;font-size:13px;line-height:15px;justify-content:space-between;margin:7px 0 10px}.ul-card-text{flex:1 0 auto;margin-top:2px;margin-bottom:3px;align-items:center;display:flex;flex-wrap:wrap;justify-content:center;padding:0}.ul-card-text__container{align-items:center;box-sizing:border-box;border-radius:3px;display:flex;justify-content:center;margin-bottom:12px;flex:1 0 100%}.ul-card-text__input--mobile{border:2px solid #e6e6e6;max-height:63px}.ul-card-text__input--desktop{border:1px solid #e6e6e6;max-height:150px}.ul-card-text__input{background:rgba(0,0,0,.01);box-sizing:border-box;color:#343442;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol;min-height:63px;overflow:auto;padding:12px;resize:none;width:100%;border-radius:3px;font-size:15px;line-height:20px;overflow-wrap:break-word}.ul-card-text__input::placeholder{color:#6c6c6e80}.ul-card-text__input:focus{outline:none;background:white}.ul-card-text__input--desktop:hover:not(:focus){background-color:#0000000d}.ul-card__text-url-prompt-button{text-decoration:none;text-overflow:ellipsis;overflow:hidden;white-space:nowrap}#ul-card-voice__video{align-items:center;display:flex;flex-direction:column}#ul-card-voice__video>div{margin-bottom:10px;width:100%}#ul-card-video__player_recorder{width:100%;width:-moz-available;width:-webkit-fill-available;width:fill-available}.ul-card-record__task{flex:1 0 auto;margin-top:2px;margin-bottom:3px;align-items:center;display:flex;flex-wrap:wrap;justify-content:center;padding:0}#ul-record-task-upload-progress,#ul-record-task-video-preview{width:100%;height:150px}.ul-permission-graphics-container{width:100%;height:150px;background-color:#0000000d;text-align:center;flex-direction:column;margin-left:auto;margin-right:auto;border-radius:5px;display:flex;align-items:center;font-size:15px;color:#000000b3}.ul-av-permission-denied-paragraph{margin:auto 15px;font-size:12px}.ul-av-permission-denied-headline{font-size:14px;color:#262136;text-decoration:underline;font-size:12px}.ul-permission-body{color:#000;margin:5px auto 5px 5px;line-height:135%;text-align:center}.ul-select-tab-container{width:240px;height:46px;background:#ffffff;border-radius:5px;text-align:start;align-items:center;display:flex;padding:0 5px;margin-top:20px;margin-bottom:auto}.ul-select-tab-text{color:#4b575d;margin:5px;line-height:135%;text-align:center}button.ul-task-skip-button{color:#000;background-color:#fff}#ul-task-detail-container{margin-top:0;margin-bottom:0;overflow:auto}#ul-task-detail-container.ul-rich-text-body p,#ul-task-detail-container.ul-rich-text-body li,#ul-task-detail-container.ul-rich-text-body{color:#4c4c4c}#ul-task-detail-container :first-child{margin-top:0}#ul-task-detail-container :last-child{margin-bottom:20px}.ul-horizontal-button-container{width:100%;display:flex;flex-direction:row}.ul-skip-button-below{margin-top:5px}.ul-horizontal-button-container-center{justify-content:center}.ul-vertical-button-container-center{display:flex;flex-direction:column;align-items:center}.ul-horizontal-button-container-left{justify-content:flex-start}.ul_recorded-task-inset-spacing{margin-top:5px;margin-bottom:24px}.ul_permission_svg_container{justify-content:center}.ul-card-text__button{background-color:var(--theme);border-radius:3px;border:none;color:#fff;cursor:pointer;font-size:15px;font-weight:500;line-height:18px;padding:10.5px 21px}.ul-card-text__button:disabled,.ul-card-text__button.sprig-button-disabled{background-color:#0000001a;color:#0003}.ul-card-text__button.ul-button-inactive{background-color:#fff!important;color:#5d696f!important}.ul-card-skip__button{color:#00000080;background:none;border:none;font-size:15px;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol;cursor:pointer}.ul-card-button-group{align-items:center;display:flex;gap:30px;justify-content:center}html,body{cursor:default;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol;height:100%;overflow:hidden;-webkit-tap-highlight-color:transparent;-webkit-user-select:none;-webkit-touch-callout:none}b{font-weight:500}#ul-app{opacity:0;width:100%;flex-grow:2;display:flex}#ul-app.ul-app--overlay{position:absolute;bottom:0;transition:opacity .1s ease-out;transition-delay:.1s}#ul-app.ul-app--visible{opacity:1;bottom:0}.ul-app__container{width:100%;display:flex;flex-direction:column;max-height:100vh}.ul-header__container{margin-bottom:15px}.ul-header{align-items:center;background:repeating-linear-gradient(120deg,#ebebeb,#ebebeb 24px,#fff 24px,#fff 48px);border-bottom:2px solid #ebebeb;display:flex;font-size:14px;font-weight:500;height:40px;justify-content:center;left:0;position:absolute;top:0;width:100%}.ul-footer{display:flex;flex-direction:column;align-items:center;justify-content:center;margin-top:auto;flex-grow:1;width:100%}.ul-footer>.yellow-footer-logo{background:#fad133;border:1px solid #f9c600;border-radius:14px;padding:6px 12px}.ul-footer>.yellow-footer-logo:hover{background:#f9c600}.ul-footer .thank-you-card-link{background:rgba(0,0,0,.01);border:1px solid #e6e6e6;border-radius:8px;cursor:pointer;display:inline-flex;font-size:14px;gap:12px;margin-bottom:15px;padding:12px;text-align:initial;width:280px}.ul-footer .thank-you-card-link:hover{background:rgba(0,0,0,.03)}.ul-footer>a{color:inherit}.ul-footer-bubble{display:inline-block;margin:0 3px;width:7px;height:7px;border-radius:3px;border:1px solid transparent}.sprig-box-logo{background:rgba(249,198,0,1);border-radius:5px;display:flex;padding:4px}.close-container{display:flex;justify-content:flex-end;width:100%}.close-btn{cursor:pointer;height:18px;margin-inline-end:-10px;position:relative;top:-10px;width:18px;z-index:1}.ul-app__container{transition:opacity .3s ease-out}.ul-center-horizontally{text-align:center}#ul-progress-bar-container{width:100%;height:2px;background-color:#0000001a;border-radius:2px;max-width:250px;margin:25px 0}#ul-progress-bar-current{transition:width 1s ease;width:0%;height:0;border-radius:2px}.prototype-button{width:100%;background:rgba(0,0,0,.01);border:1.5px solid #e6e6e6;border-radius:4px 0 0 4px;flex:none;flex-grow:1;margin:0;padding:20px 0;font-size:14px;font-family:inherit;text-decoration:underline}.prototype-button:hover{cursor:pointer}
|
|
704
|
-
`,Mg=(e,t)=>{const n=[...e],r=new Set([L.VideoVoice,L.RecordedTask]);return e.some(i=>r.has(i.type))&&n.push({name:-2,props:{routingOptions:[]},type:L.Uploading}),t&&n.push({name:-1,props:{routingOptions:[]},type:L.Thanks}),n},Vg=({mode:e=null,viewWindow:t,viewDocument:n})=>{const r=n.documentElement;return{mode:e,sw:t.screen.width,sh:t.screen.height,cw:r.clientWidth,ch:r.clientHeight,p:t.parent.location.href,l:t.navigator.language}};function jg(e,t=!0){var m;const{answers:n,apiURL:r,customStyles:i,endCard:o,eventEmitFn:a,fontFamilyURL:s,frame:l,previewKey:u,viewDocument:c,viewWindow:d}=e,f=Jt(e.headers)?e.frame:c.body,p=e.UpChunk||window.UpChunk,v=F,h=Mg(e.cards,!!o);gr.configure(v,{cards:h,hasEndCard:!!o,apiURL:r,UpChunk:p}),X.setState({apiURL:r,answers:n,border:e.border,index:e.startingQuestionIdx||0,cards:h,configureExitOnOverlayClick:e.configureExitOnOverlayClick,customMetadata:e.customMetadata,endCard:e.endCard,envId:e.envId,eventEmitFn:a,fontFamily:e.fontFamily,forceBrandedLogo:e.forceBrandedLogo,frame:l,headers:e.headers,hasViewedEmbed:!1,isPreview:e.isPreview,marketingUrl:"https://sprig.com",meta:Vg({mode:e.mode,viewWindow:d,viewDocument:c}),mode:e.mode,previewKey:u,recorder:gr,recorderEventEmitter:v,responseGroupUid:e.responseGroupUid,showStripes:e.showStripes,showSurveyBrand:e.showSurveyBrand,slugName:e.slugName,styleNonce:e.styleNonce,surveyId:e.surveyId,tabTitle:e.tabTitle,uploadingCardViewed:!1,uploadProgress:{},useMobileStyling:e.useMobileStyling,useDesktopPrototype:e.useDesktopPrototype,userId:e.userId,viewDocument:e.viewDocument,visitorAttributes:e.visitorAttributes,viewedCardCount:e.startingQuestionIdx||0});const{seen:g}=X.getState();g();const{head:_}=c,w=c.createElement("style");if(w.id="sprig-style",w.textContent=Ng,w.nonce=e.styleNonce,_.appendChild(w),e.fontFamily&&s&&parent){const x=c.createElement("link");x.rel="stylesheet",x.href=s,_.appendChild(x)}if(e.customStyles&&ol(c,i,e.styleNonce),!p)if(e.installationMethod!==yt.Npm){const x=c.createElement("script");x.src="https://cdn.sprig.com/userleap-web-upchunk-v2.2.2.js",x.onload=()=>{gr.setUpChunk(d.UpChunk)},x.onerror=()=>{console.warn("[Sprig] - recording functionality not configured due to UpChunk library load failure")},_.appendChild(x)}else console.warn("[Sprig] - recording functionality not configured due to missing UpChunk dependency");const E="2.25.0",b=a||((m=l.eventEmitter)==null?void 0:m.emit);b==null||b(Ue.VerifyViewVersion,{[At.ViewVersion]:E}),f&&t&&ln(y(Pg,{}),f)}const Bg={configure:jg},Fg="!launch_darkly_";class Hg{constructor(){ie(this,"_ldData",{})}getAllLaunchDarklyVariations(){return this._ldData}setLDFlagsVariations(t){try{return!t||typeof t!="object"||Array.isArray(t)?!1:(Object.keys(this._ldData).forEach(n=>{delete this._ldData[n]}),Object.keys(t).forEach(n=>{var r;return this._ldData[`${Fg}${n}`]=((r=t[n])!=null?r:0)+1}),!0)}catch(n){return n instanceof Error&&window.UserLeap.reportError("setAllLDFlagsVariations",n),console.warn("[Sprig] An issue had occured when setting LaunchDarkly flags and variations."),!1}}}const mo=new Hg;Object.freeze(mo);const $g="!optimizely_experiments_";class Kg{constructor(){ie(this,"_optimizelyData",{})}setOptimizelyExperiment(t,n=!0){if(!t||typeof t!="object")return!1;const{experiments:r}=t;try{return n&&Object.keys(this._optimizelyData).map(i=>{delete this._optimizelyData[i]}),r&&r.map(i=>{const{id:o,variation:a}=i,s=this.transformExperimentId(o);a&&typeof a=="string"&&(this._optimizelyData[s]=a)}),!0}catch(i){return i instanceof Error&&window.UserLeap.reportError("setOptimizelyExperiment",i),!1}}getAllOptimizelyExperiments(){return this._optimizelyData}getOptimizelyVariationName(t){return this._optimizelyData[this.transformExperimentId(t)]}transformExperimentId(t){return $g+t}getAndSetWebOptimizelyExperiments(){var t;try{if(window&&window.optimizely&&typeof window.optimizely.get=="function"){const n=(t=window.optimizely.get("state"))==null?void 0:t.getExperimentStates({isActive:!0});if(n){const r=Object.keys(n).map(i=>{var o,a;return(o=n[i].variation)!=null&&o.name?{id:i,variation:(a=n[i].variation)==null?void 0:a.name}:{id:i,variation:"Original"}});return this.setOptimizelyExperiment({experiments:r},!1),!0}return!1}return!1}catch(n){return n instanceof Error&&window.UserLeap.reportError("getAndSetWebOptimizely",n),!1}}}const wr=new Kg;Object.freeze(wr);class qg{constructor(t,n){ie(this,"paused");ie(this,"queue");ie(this,"ul");this.ul=t,this.paused=!1,this.queue=[],this.flush(n)}flush(t){const n=t.length;if(n)for(let r=0;r<n;r++)this.push(t[r])}isPaused(){return this.paused}pause(){this.paused=!0}unpause(){this.paused=!1;const t=this.queue.slice();this.empty(),this.flush(t)}push(t){if(this.paused)this.queue.push(t);else if(t instanceof Function)t();else{const n=Array.prototype.slice.call(t,1),r=t[0],i=this.ul[r];i instanceof Function?i.apply(this.ul,n):r&&console.warn("[Sprig] (ERR-100) No valid UserLeap action called",r)}}perform(t){if(this.paused){let n=()=>{};const r=new Promise(function(i){n=function(){i(t())}});return this.queue.push(n),r}else return t()}empty(){this.queue.length=0}}var Ne=(e=>(e.Ready="ready",e.NoSurvey="no survey",e))(Ne||{}),Rc=(e=>(e.Preview="sprigPreviewKey",e))(Rc||{});const Gg=["popState","pushState","replaceState"],zg={test:"test"},_n="!email",Wg=["ios","android"],Dt="environments",go="pageUrl",It="visitors",js="ul-view-sdk-script",Bs=Object.freeze({contains:(e,t)=>t.includes(e),notContains:(e,t)=>!t.includes(e),exactly:(e,t)=>t===e,notExactly:(e,t)=>t!==e,startsWith:(e,t)=>t.startsWith(e),endsWith:(e,t)=>t.endsWith(e),regex:(e,t)=>new RegExp(e).test(t),legacy:(e,t)=>new RegExp(e,"i").test(t)});function da(e,t){const{matchType:n,pattern:r}=e,i=n?Bs[n]:Bs.legacy;let o=!1;try{o=i(r,t)}catch(a){const s=`[Sprig] (ERR-445) Failed to check url match with pattern ${r}`;a instanceof Error&&(console.warn(s,a),a.stack=JSON.stringify(e),window.UserLeap.reportError(s,a))}return o}function Yg(e,t){const{pageUrlEvents:n,interactiveEvents:r,dismissOnPageChange:i}=window.UserLeap._config;if(!i)return!0;const o=[];n&&n.length&&o.push(...n),r&&r.length&&o.push(...r);const a=e&&o.find(s=>s.id===e);return a?da(a,window.location.href):t===window.location.href}function Bn(e){const{pageUrlEvents:t,interactiveEvents:n,dismissOnPageChange:r,platform:i}=window.UserLeap._config;if(i&&i!==Vt.Web)return;const o=kt("trackStartUrl"),a=o?String(o):null;t&&Dc(window.location.href),n&&(Uc(),Qg()),r&&a&&a!==window.location.href&&e&&Gg.includes(e.type)&&window.UserLeap("dismissActiveSurvey",qe.PageChange)}const Ac={capture:!0},Qg=()=>{const t=window.UserLeap._config.interactiveEvents.filter(r=>da(r,window.location.href)).map(r=>{const{name:i,properties:o}=r,{selector:a,innerText:s}=o;return a?l=>{if(Oa(l.target))try{l.target.closest(a)&&window.UserLeap("track",i)}catch{}return!1}:l=>(Oa(l.target)&&l.target.innerText===s&&window.UserLeap("track",i),!1)}),n=r=>t.forEach(i=>i(r));window.UserLeap._config.interactiveEventsHandler=n,window.addEventListener("click",n,Ac)},Uc=()=>{window.UserLeap._config.interactiveEventsHandler&&window.removeEventListener("click",window.UserLeap._config.interactiveEventsHandler,Ac),delete window.UserLeap._config.interactiveEventsHandler};function Zg(){["hashchange","popstate"].forEach(e=>window.addEventListener(e,Bn,!0))}function Xg(){["hashchange","popstate"].forEach(e=>window.removeEventListener(e,Bn,!0)),window.UserLeap._config.interactiveEvents&&Uc()}function Ze(e,t,n){const r=[window.UserLeap._API_URL,"sdk",e];return t&&t.forEach(i=>{r.push(i),i===Dt?r.push(window.UserLeap.envId):i===It&&r.push(fa())}),n&&r.push(n),r.join("/")}function Jg(e,t){let n=Ze("1",[Dt],"questions?");return e!=null&&(n+=`&vid=${e}`),t&&(t.surveyId&&(n+=`&surveyid=${t.surveyId}`),t.surveyTemplateId&&(n+=`&surveytemplateid=${t.surveyTemplateId}`),t.previewLanguage&&(n+=`&previewLanguage=${encodeURIComponent(t.previewLanguage)}`)),n}function kt(e){const t=Ee.getItem(xe.Credentials);if(t)try{const r=JSON.parse(t)[window.UserLeap.envId];return r&&r[e]||null}catch(n){n instanceof Error&&(n.stack=t,window.UserLeap.reportError("Failed to parse local storage credentials",n)),console.warn("[Sprig] (ERR-427) Failed to lookup saved ids",n)}return null}function be(e,t){const n=Ee.getItem(xe.Credentials);let r={};if(n)try{r=JSON.parse(n)}catch(o){o instanceof Error&&(o.stack=n,window.UserLeap.reportError("Failed to parse local storage credentials",o)),console.warn("[Sprig] (ERR-427) Failed to lookup saved ids",o)}let i=r[window.UserLeap.envId];i?i[e]=t:i={[e]:t},r[window.UserLeap.envId]=i;try{Ee.setItem(xe.Credentials,JSON.stringify(r))}catch(o){o instanceof Error&&console.warn(`[Sprig] (ERR-426) Unable to write to Local Storage:: ${o.message}`)}}function Oc(){window.previewMode||(window.UserLeap.visitorId=at(),be("vid",window.UserLeap.visitorId),F.emit(j.VisitorIDUpdated,{visitorId:window.UserLeap.visitorId}))}function fa(){return window.previewMode?"0":window.UserLeap.visitorId||""}function Dc(e,t,n){if(e.endsWith("mock_snippet.html"))return;const r=window.UserLeap._config.pageUrlEvents;let i=!1;if(r&&r.length)for(let c=0;c<r.length&&(i=da(r[c],e),!i);c++);if(!i)return;window.UserLeap.debugMode&&console.info("[DEBUG] Sprig trackPageView",e);const o=10,a=1;let s=[];const l={viewedAt:Date.now(),location:e},u=Ee.getItem(xe.PageViews);try{if(s=u?JSON.parse(u):[],Array.isArray(s)||(s=[]),s.length>0){const c=s[s.length-1],d=(Date.now()-c.viewedAt)/1e3;c.location!=e&&d>a&&es({url:e,referrer:document.referrer,description:document.title}),(c.location!=e&&d>a||d>o)&&(window.UserLeap._queue.push(["track",go,t,{url:e},n]),s.push(l))}else window.UserLeap._queue.push(["track",go,t,{url:e},n]),s.push(l),es({url:e});s.length>5&&s.splice(0,s.length-5),Ee.setItem(xe.PageViews,JSON.stringify(s))}catch(c){c instanceof Error&&window.UserLeap.reportError("trackPageView",c,{pageViewsStorage:u}),console.warn("[Sprig] (ERR-425) Failed to update page views in local storage")}}function ey(){const e="Backbone"in window&&window.Backbone&&window.Backbone.history?window.Backbone.history:window.history;"pushState"in e&&(e.pushState=(t=>function(...r){const i=t.apply(this,r),o=new Event("pushState");return window.dispatchEvent(o),Bn(o),i})(e.pushState)),"replaceState"in e&&(e.replaceState=(t=>function(...r){const i=t.apply(this,r),o=new Event("replaceState");return window.dispatchEvent(o),Bn(o),i})(e.replaceState)),Zg()}async function Ci(e,t){const n=fa();e&&!t&&(window.UserLeap._config.mode=zg.test);const r=await ht(Jg(n,{...e,previewLanguage:window.UserLeap._config.previewLanguage}),{},0,!0);return r.ok?(r.json.delay&&await Cr(r.json.delay),Pc(r.json)):(r.reportError&&r.error&&(console.warn("[Sprig] (ERR-414) Failed to request questions from the server",r.error),window.UserLeap.reportError("getQuestions",r.error)),{success:!1,surveyState:Ne.NoSurvey})}const Pc=async e=>{var T,D,z;const{context:t,forceBrandedLogo:n,endCard:r,locale:i,productConfig:o,questions:a,responseGroupUid:s,surveyId:l,uuid:u,vid:c,sessionReplay:d}=e,f=rn(window.UserLeap),p=pa(f),v=ty(f);if(d)if(p){const C={mediaRecordingUid:at(),mediaType:Te.Screen,questionId:1,responseGroupUid:s,surveyId:l,updatedAt:new Date().toISOString(),visitorId:window.UserLeap.visitorId,isReplay:!0};F.emit(j.ReplayCapture,{responseGroupUid:s,hasQuestions:!!(a!=null&&a.length),surveyId:l,uploadId:d.uploadId,replayType:(T=d.replayDurationType)!=null?T:Mt.Before,seconds:d.replayDurationSeconds,generateVideoUploadUrlPayload:C})}else nu({responseGroupId:s,surveyId:l,visitorId:c,replayParams:d,completeUploadHeaders:f,apiUrl:window.UserLeap._API_URL,triggerTimestamp:Date.now(),isStandalone:a.length===0});if(c==null||!a||!a.length)return{success:!1,message:"[Sprig] no survey found",surveyState:Ne.NoSurvey};if(window.UserLeap.container){const C="[Sprig] (ERR-409) Found an existing Survey container, aborting rendering of this survey";return console.warn(C),{success:!1,message:C,surveyState:Ne.NoSurvey}}if(c!==window.UserLeap.visitorId&&u!==window.UserLeap.visitorId&&!window.previewMode){const C="Attempted to display survey to a different visitor";return window.UserLeap.reportError("DisplaySurvey",new Error(C)),{success:!1,message:C,surveyState:Ne.NoSurvey}}gv({id:l}),Li.disable(),F.emit(j.SurveyWillPresent,{name:j.SurveyWillPresent,[Rn.SurveyId]:l});let h,g=document.createElement("div"),_,w,E;const b=C=>{const{[At.ViewVersion]:W}=C;W!==f["x-ul-sdk-version"]&&oc(),F.removeListener(Ue.VerifyViewVersion,b)};F.on(Ue.VerifyViewVersion,b),Jt(f)?(h="ul-direct-embeded-frame",_=document.head,w=window,E=!1,p&&(ic(),g.id=h,window.UserLeap.container.appendChild(g),ac(),F.emit(j.SurveyLifeCycle,{state:"presented"}),F.emit(j.SurveyPresented,{name:j.SurveyPresented,[Rn.SurveyId]:l}))):{frameId:h,contentWinDocHead:_,contentWindow:w,hasOverlay:E,iframe:g}=Im(o,v,l),window.UserLeap.frameId=h,window.UserLeap.useMobileStyling=v;const m=C=>{F.on(j.CloseSurveyOnOverlayClick,C)},x=Object.assign({frame:g,envId:window.UserLeap.envId,surveyId:l,userId:u,visitorAttributes:{externalUserId:window.UserLeap.userId,email:window.UserLeap.email},cards:a,context:t,locale:i,fontFamily:window.UserLeap.fontFamily,fontFamilyURL:window.UserLeap.fontFamilyURL,apiURL:window.UserLeap._API_URL,responseGroupUid:s,headers:f,endCard:r,useMobileStyling:v,mobileSDKVersion:window.UserLeap.mobileSDKVersion,configureExitOnOverlayClick:m,eventEmitFn:F.emit.bind(F),ulEvents:_o,viewDocument:w==null?void 0:w.document,viewWindow:w,tabTitle:document.title,startingQuestionIdx:(D=window.UserLeap.config)==null?void 0:D.startingQuestionIdx,styleNonce:window.UserLeap.styleNonce,previewKey:Ee.getItem(xe.Preview),forceBrandedLogo:n},window.UserLeap._config);(z=window.UserLeap.config)!=null&&z.startingQuestionIdx&&(window.UserLeap.config={...window.UserLeap.config,startingQuestionIdx:null}),window.UserLeap.customStyles&&(x.customStyles=window.UserLeap.customStyles),w&&(w.__cfg=x);function k(){const C=document.createElement("script");return window.UserLeap.nonce&&C.setAttribute("nonce",window.UserLeap.nonce),C.id=js,C}const S=window.UserLeap.viewSDKURL?window.UserLeap.viewSDKURL:x.path,I=document.getElementById(js);I&&I.remove();const R=k(),O=()=>{window.UserLeap.container&&Object.assign(window.UserLeap.container.style,{display:"flex"})};return x.installationMethod===yt.Npm||x.installationMethod===yt.NpmBundled?(Bg.configure(x),E&&window.UserLeap.container&&O()):S&&(R.src=S,E&&R.addEventListener("load",()=>{window.UserLeap.container&&O()}),w==null||w.addEventListener("error",C=>{C.target instanceof HTMLScriptElement&&C.target.src===S&&window.UserLeap.reportError("loadFrameScript",new Error("Frame script failed to load"))},{capture:!0,once:!0})),_==null||_.appendChild(R),{success:!0,surveyState:Ne.Ready,surveyId:l,responseGroupUid:s}};function ty(e){if(window.UserLeap.useMobileStyling!==void 0)return window.UserLeap.useMobileStyling;const t=window.UserLeap.windowDimensions&&window.UserLeap.windowDimensions.width||document.body.clientWidth;return pa(e)||t>10&&t<$f}function pa(e){return Wg.includes(e[Ke.Platform])}function ny(e){let t=e.length;for(;t;){const n=Math.floor(Math.random()*t);t-=1;const r=e[t];e[t]=e[n],e[n]=r}}function ry(e){if(!e)return;window.UserLeap._config=e,e.mute&&window.UserLeap._queue.pause();const{interactiveEvents:t,pageUrlEvents:n,dismissOnPageChange:r}=e;t&&ny(t),(t||n||r)&&(ey(),Bn())}async function ht(e,t,n=0,r=!1){var o,a;t.headers=Object.assign(rn(window.UserLeap),t.headers);const i=await rt(e,t,n,r);if(i.ok){const s=(o=i.headers)==null?void 0:o.get("Authorization"),l=s?s.split(" "):void 0,u=l&&l.length===2?l[1]:void 0,c=(a=i.headers)==null?void 0:a.get(Ke.VisitorID);u&&c&&(c!==window.UserLeap.visitorId||window.UserLeap.token!==u)&&(be("token",u),be("vid",c),F.emit(j.VisitorIDUpdated,{visitorId:c}),window.UserLeap.token=u,window.UserLeap.visitorId=c)}return i.json&&i.json.logMessage&&console.warn(`[Sprig] ${i.json.logMessage}`),i}async function iy(e,t){var r,i;let n=!0;return t&&((r=e==null?void 0:e.json)==null?void 0:r.surveyId)&&(window.UserLeap.delayingSurvey=!0,n=await t(e.json.surveyId),window.UserLeap.delayingSurvey=!1,!n)?!1:((i=e==null?void 0:e.json)!=null&&i.delay&&(window.UserLeap.delayingSurvey=!0,await Cr(e.json.delay),window.UserLeap.delayingSurvey=!1),n)}const oy=function(e){if(!window.UserLeap)return;const t=async(r={})=>{var h,g,_,w,E;const{userId:i,anonymousId:o,metadata:a={},properties:s,showSurveyCallback:l}=r;let{eventName:u}=r;if(window.UserLeap.debugMode&&u!==go&&console.info("[DEBUG] Sprig track",r),e.mode==="test")return;const c=(h=Ee.getItem(xe.Preview))!=null?h:void 0;if(e.requireUserIdForTracking&&!window.UserLeap.userId&&!i){const b="[Sprig] - Skipping tracking without userId";return console.warn(b),{success:!1,message:b,surveyState:Ne.NoSurvey}}if(!u||u.trim().length===0){u=u?String(u):"";const b="[Sprig] - Invalid event name "+u;return console.warn(b),{success:!1,message:b,surveyState:Ne.NoSurvey}}const d=window.location.href;if(a.url||(a.url=d),be("trackStartUrl",d),(_=(g=window.UserLeap)==null?void 0:g._config)!=null&&_.optimizelyEnabled){const b=rn(window.UserLeap);pa(b)||wr.getAndSetWebOptimizelyExperiments(),a.optimizelyExperiments=Object.assign({},wr.getAllOptimizelyExperiments())}(E=(w=window.UserLeap)==null?void 0:w._config)!=null&&E.launchDarklyEnabled&&(a.launchDarklyFlags=mo.getAllLaunchDarklyVariations()),i&&(window.UserLeap.userId=i),o&&(window.UserLeap.partnerAnonymousId=o),s&&(a.eventProperties=s),mv({name:u,url:a.url});const f=window.UserLeap.delayingSurvey?await ht(Ze("1",[It],"events/batch"),{body:JSON.stringify({events:[{event:u,metadata:a}],previewKey:c}),method:"POST"},0,!0):await ht(Ze("1",[It],"events"),{body:JSON.stringify({event:u,metadata:a,previewKey:c}),method:"POST"},0,!0);if(!f.ok){const b="[Sprig] (ERR-421) Failed to track event";return f.reportError&&(console.warn(b,f.error),f.error&&window.UserLeap.reportError("track",f.error)),{success:!1,message:b,error:f.error,surveyState:Ne.NoSurvey}}i&&be("uid",i),o&&be("aid",o);const p=f.json;return p.invalidPreviewKey&&Ee.removeItem(xe.Preview),await iy(f,l)?Yg(p.eventId,d)?Pc(p):{success:!1,message:"Study should not be displayed after page navigation",surveyState:Ne.NoSurvey}:{success:!1,message:"[Sprig] Callback returned false, aborting rendering of survey",surveyState:Ne.NoSurvey}},n={async displaySurvey(r){return console.warn("[Sprig] displaySurvey should only be used to debug your studies; not intended for production usage."),window.UserLeap("dismissActiveSurvey",qe.Override),Ci({surveyId:r},!0)},_previewSurvey(r){window.UserLeap("dismissActiveSurvey",qe.Override),Ci({surveyTemplateId:r},!1)},_reviewSurvey(r){window.UserLeap("dismissActiveSurvey",qe.Override),Ci({surveyId:r},!1)},previewSurvey(r){n._previewSurvey(r)},reviewSurvey(r){n._reviewSurvey(r)},mute(){window.UserLeap._queue.pause()},unmute(){window.UserLeap._queue.unpause()},setVisitorToken(){console.warn("[Sprig] setVisitorToken is deprecated.")},dismissActiveSurvey(r=qe.API){F.emit(j.SurveyWillClose,{name:j.SurveyWillClose,initiator:r})},async setAttribute(r,i){if(!r||!i&&i!==0){const o="[Sprig] - Disregarding empty attribute / value provided";return console.warn(o),{success:!1,message:o}}return this.setAttributes({[r]:i})},async setAttributes(r){if(r==null||Object.keys(r).length===0){const i="[Sprig] - Disregarding empty attributes provided";return console.warn(i),{success:!1,message:i}}return this.identifyAndSetAttributes({attributes:r})},async identifyAndSetAttributes(r){if(window.UserLeap.debugMode&&console.info("[DEBUG] Sprig identifyAndSetAttributes",r),e.mode==="test")return;if(r===null||typeof r!="object"||!(r.userId||r.anonymousId||r.attributes)){const u="[Sprig] - Disregarding empty payload provided";return console.warn(u),{success:!1,message:u}}const{userId:i,anonymousId:o,attributes:a}=r;if(e.requireUserIdForTracking&&!window.UserLeap.userId&&!i){const u="[Sprig] - Skipping tracking without userId";return console.warn(u),{success:!1,message:u}}if(!a&&(!i||window.UserLeap.userId===i)&&(!o||window.UserLeap.partnerAnonymousId===o))return{success:!0};const s={};i&&(s.userId=window.UserLeap.userId=i),o&&(s.partnerAnonymousId=window.UserLeap.partnerAnonymousId=o);let l;return a?(a.email&&!Object.prototype.hasOwnProperty.call(a,_n)&&(a[_n]=a.email,delete a.email),l=await ht(Ze("1",[Dt,It],"attributes"),{body:JSON.stringify(a),method:"PUT"}),!l.ok&&l.reportError&&(console.warn("[Sprig] (ERR-432) identifyAndSetAttributes failed",l.error),l.error&&window.UserLeap.reportError("identifyAndSetAttributes",l.error))):l=await ht(Ze("1",[Dt,It]),{body:JSON.stringify(s),method:"PUT"}),a&&a[_n]&&(window.UserLeap.email=a[_n]),l.ok&&(i&&be("uid",i),o&&be("aid",o)),{success:!!l.ok}},async removeAttributes(r){if(window.UserLeap.debugMode&&console.info("[DEBUG] Sprig removeAttributes",r),e.mode==="test")return;if(r==null||r.length===0){const o="[Sprig] - Disregarding empty attributes provided";return console.warn(o),{success:!1,message:o}}if(e.requireUserIdForTracking&&!window.UserLeap.userId){const o="[Sprig] - Skipping tracking without userId";return console.warn(o),{success:!1,message:o}}const i=await ht(Ze("1",[Dt,It],"attributes"),{body:JSON.stringify({delete:r}),method:"DELETE"});return!i.ok&&i.reportError&&(console.warn("[Sprig] (ERR-433) Remove attributes failed",i.error),i.error&&window.UserLeap.reportError("removeAttributes",i.error)),{success:!!i.ok}},async addSurveyListener(r){F.on(j.SurveyLifeCycle,r)},async removeSurveyListener(r){F.removeListener(j.SurveyLifeCycle,r)},async addListener(r,i){F.on(r,i)},async removeListener(r,i){F.removeListener(r,i)},async removeAllListeners(){F.removeAllListeners()},setPreviewKey(r){!r||typeof r!="string"||Ee.isStorageAvailable&&r&&Ee.setItem(xe.Preview,r)},async setUserId(r){if(window.UserLeap.debugMode&&console.info("[DEBUG] Sprig setUserId",r),r==null){const a=`[Sprig] - Invalid userId ${r}`;return console.warn(a),{success:!1,message:a}}if(e.mode==="test"||r===window.UserLeap.userId)return;window.UserLeap.userId=r;const i=window.UserLeap.visitorId,o=await ht(Ze("1",[Dt,It]),{body:JSON.stringify({userId:r}),method:"PUT"});if(!o.ok){o.reportError&&(console.warn("[Sprig] (ERR-420) Failed to set user id",o.error),o.error&&window.UserLeap.reportError("setUserId",o.error));return}i!==window.UserLeap.visitorId&&Ja(),be("uid",r)},async setPartnerAnonymousId(r){if(window.UserLeap.debugMode&&console.info("[DEBUG] Sprig setPartnerAnonymousId",r),r==null){const i=`[Sprig] - Invalid partnerAnonymousId ${r}`;return console.warn(i),{success:!1,message:i}}return window.UserLeap.partnerAnonymousId=r,be("aid",r),{success:!0}},async track(r,i,o={},a=void 0){return t({eventName:r,properties:i,metadata:o,showSurveyCallback:a})},async identifyAndTrack(r){return await t(r)},trackPageView(r,i=void 0,o=void 0){Dc(r,i,o)},applyStyles(r){if(window.UserLeap.customStyles=r,window.UserLeap.container){const i=window.UserLeap.container.children[0].contentDocument;if(i){const o=i.getElementById(U.CustomStyle);o?o.textContent=r:ol(i,r,window.UserLeap.styleNonce)}}},setWindowDimensions(r,i){var l,u;const o=typeof r=="string"?parseInt(r,10):r,a=typeof i=="string"?parseInt(i,10):i;if(!isNaN(o)&&!isNaN(a)&&(window.UserLeap.windowDimensions={width:o,height:a}),!window.UserLeap.frameId)return;const s=document.getElementById(window.UserLeap.frameId);!s||(window.UserLeap.useMobileStyling&&((l=window.UserLeap.windowDimensions)!=null&&l.width&&(s.style.width=`${window.UserLeap.windowDimensions.width}px`),(u=window.UserLeap.windowDimensions)!=null&&u.height&&(s.style.maxHeight=`${window.UserLeap.windowDimensions.height-20}px`),s.contentDocument&&(s.style.height=String(sl(s.contentDocument)[0])+"px")),F.emit(j.SurveyDimensions,{name:j.SurveyDimensions,contentFrameWidth:s.clientWidth,contentFrameHeight:s.clientHeight}))},logoutUser(){window.UserLeap.debugMode&&console.info("[DEBUG] Sprig logout"),window.UserLeap.visitorId=null,window.UserLeap.userId=null,window.UserLeap.partnerAnonymousId=null,window.UserLeap.token=null,window.UserLeap.email=null,Ee.removeItem(xe.Credentials),Ee.removeItem(xe.PageViews),window.UserLeap._queue.isPaused()&&window.UserLeap._queue.empty(),Oc(),Ja(),window.UserLeap._queue.unpause()},teardown(){Xg(),window.UserLeap("dismissActiveSurvey",qe.API),delete window.UserLeap,delete window.Sprig,delete window._Sprig},integrateOptimizely(r,i=!0){var o,a;if(!((a=(o=window.UserLeap)==null?void 0:o._config)!=null&&a.optimizelyEnabled)){console.warn("[SPRIG] Optimizely integration is currently not enabled for your product.");return}try{const s=typeof r=="string"?JSON.parse(r):r;wr.setOptimizelyExperiment(s,i)}catch(s){console.warn("[Sprig] Error with integrating Optimizely data"),s instanceof Error&&window.UserLeap.reportError("integrateOptimizely",s)}},integrateOptimizelyClient(r){var o,a;if(!((a=(o=window.UserLeap)==null?void 0:o._config)!=null&&a.optimizelyEnabled)){console.warn("[SPRIG] Optimizely integration is currently not enabled for your product.");return}const i=({experiment:s,variation:l})=>{const u={experiments:[{id:s.id,variation:l.key}]};window.UserLeap("integrateOptimizely",u,!1)};r.notificationCenter.addNotificationListener(Mf.NOTIFICATION_TYPES.ACTIVATE,i)},importLaunchDarklyData(r){var i,o;if(!((o=(i=window.UserLeap)==null?void 0:i._config)!=null&&o.launchDarklyEnabled)){console.warn("[SPRIG] LaunchDarkly integration is currently not enabled for your product.");return}mo.setLDFlagsVariations(r)},setVisitorAttribute(r,i){return console.warn("[Sprig] setVisitorAttribute is deprecated. Please use setAttribute"),n.setAttribute(r,i)},async setEmail(r){return n.setAttribute(_n,r)},async setVisitorEmail(r){return console.warn("[Sprig] setVisitorEmail is deprecated. Please use setEmail"),n.setEmail(r)},async _generateVideoUploadUrl(r){return uy(r)},async _completeSessionReplay({surveyId:r,responseGroupUuid:i,eventDigest:o}){if(!r||!i)return;const a=window.UserLeap._API_URL;try{await ml({surveyId:r,responseGroupUuid:i,eventDigest:o,apiUrl:a,headers:rn(window.UserLeap)},!0)}catch(s){console.warn("[Sprig] Error with completing session replay"),s instanceof Error&&window.UserLeap.reportError("completeSessionReplay",s)}}};Object.assign(window.UserLeap,n)};async function ay(e){const t=rn(window.UserLeap);document.addEventListener("securitypolicyviolation",Ri);const n=await rt(Ze("1",[Dt],"config"),{headers:t}),r="TypeError";if(window.UserLeap.error=n.error,!n.ok&&n.error&&n.error.name===r?(window.UserLeap._API_URL="https://api.sprig.com",window.UserLeap.reportError("sprigDomainRequest",n.error)):document.removeEventListener("securitypolicyviolation",Ri),!n.ok)return n.reportError&&(console.warn("[Sprig] (ERR-422) Failed to load configuration",n.error),n.error&&window.UserLeap.reportError("applyRemoteConfig",n.error)),Ai("Disabled: failed to fetch configuration"),e;const i=n.json;return i!=null&&i.disabled?(Ai(`Disabled: ${i.disabled}`),{disabled:i.disabled}):Object.assign({},i,e)}const sy=e=>typeof e=="object"&&e&&"inner"in e&&!!e.inner&&typeof e.inner=="object";async function ly(e,t,n={}){var d,f;const r=window.__cfg&&window.__cfg.mode,i=fa(),o=window.UserLeap.envId,a=window.document.documentElement,s=sy(t)?{inner:{message:(d=t.inner)==null?void 0:d.message,stack:(f=t.inner)==null?void 0:f.stack}}:{},l={mode:r,screenWidth:window.screen.width,screenHeight:window.screen.height,clientWidth:a.clientWidth,clientHeight:a.clientHeight,location:window.location.href,language:window.navigator.language,...n,...s},u={action:e,err:{message:t.message,stack:t.stack},meta:l,vid:i,envId:o};(await ht(Ze("1",null,"errors"),{method:"POST",headers:{[Ke.Error]:window.btoa(`userleap-${Date.now()}-error`)},body:JSON.stringify(u)},0,!0)).ok||console.warn("[Sprig] (ERR-444) Failed to report error to API",t)}async function uy(e){var n;if(!e)return;const t=`${window.UserLeap._API_URL}/2/environments/integrations/upload`;try{const r=await fetch(t,{method:"POST",cache:"no-cache",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(r.ok){const i=await r.json();return(n=i==null?void 0:i.upload)==null?void 0:n.url}else return null}catch(r){console.warn("[Sprig] Error with generating video upload url"),r instanceof Error&&window.UserLeap.reportError("generateVideoUploadUrl",r)}}function cy(e={}){var r;const t=(r=new URLSearchParams(window.location.search).get(Rc.Preview))!=null?r:"";window.UserLeap.UPDATES=_o,window.UserLeap("setPreviewKey",t);async function n(){if(window.UserLeap.loaded)return;if(window.UserLeap.reportError=ly,window.UserLeap.loaded=!0,window.UserLeap._config=Object.assign({},e,window.UserLeap.config),window.UserLeap.delayingSurvey=!1,window.UserLeap._config&&typeof window.UserLeap._config=="object")for(const l in window.UserLeap._config)window.UserLeap[l]=window.UserLeap._config[l];if(!window.UserLeap.envId)if(window.UserLeap.appId)window.UserLeap.envId=window.UserLeap.appId;else throw new Error("Missing Environment id");window.UserLeap.debugMode&&console.info("[DEBUG] Sprig debug mode enabled");const i=window.UserLeap.sampleRate;if(i){let l=kt("sampled");if(l===null&&(l=Math.random()<i,be("sampled",l)),!l)return}else kt("sampled")!==null&&be("sampled",null);window.UserLeap._API_URL||(window.UserLeap._API_URL="https://api.sprig.com");const o=[...window.UserLeap._queue];window.UserLeap._queue=new qg(window.UserLeap,[]),window.UserLeap._queue.pause();for(let l=0;l<o.length;l++)window.UserLeap._queue.push(o[l]);const a=kt("token");a?(window.UserLeap.token=a,window.UserLeap.visitorId=kt("vid"),window.UserLeap.userId=kt("uid"),window.UserLeap.partnerAnonymousId=kt("aid")):(Ee.removeItem(xe.Credentials),Oc());const s=await ay(e);nv(window.document,s.maxReplayDurationSeconds,window.UserLeap.replayNonce,window.UserLeap.maxInflightReplayRequests,s.replaySettings).then(()=>{Uv()}),oy(s),await ry(s),window.UserLeap._queue.unpause(),F.emit(j.SDKReady,{maxMobileReplayDurationSeconds:s.maxMobileReplayDurationSeconds,mobileReplaySettings:s.mobileReplaySettings}),F.emit(j.VisitorIDUpdated,{visitorId:window.UserLeap.visitorId})}document.readyState==="complete"?n():window.attachEvent?window.attachEvent("onload",n):window.addEventListener("load",()=>{n()},!1)}class Fr{constructor(){ie(this,"UPDATES",_o)}displaySurvey(t){window.Sprig("displaySurvey",t)}mute(){window.Sprig("mute")}unmute(){window.Sprig("unmute")}dismissActiveSurvey(){window.Sprig("dismissActiveSurvey")}setAttribute(t,n){window.Sprig("setAttribute",t,n)}setAttributes(t){window.Sprig("setAttributes",t)}identifyAndSetAttributes(t){window.Sprig("identifyAndSetAttributes",t)}removeAttributes(t){window.Sprig("removeAttributes",t)}addListener(t,n){window.Sprig("addListener",t,n)}removeListener(t,n){window.Sprig("removeListener",t,n)}removeAllListeners(){window.Sprig("removeAllListeners")}setEmail(t){window.Sprig("setAttribute","!email",t)}setUserId(t){window.Sprig("setUserId",t)}setPartnerAnonymousId(t){window.Sprig("setPartnerAnonymousId",t)}track(t,n={},r={}){window.Sprig("track",t,n,r)}identifyAndTrack(t){window.Sprig("identifyAndTrack",t)}trackPageView(t,n,r){window.Sprig("trackPageView",t,n,r)}applyStyles(t){window.Sprig("applyStyles",t)}setWindowDimensions(t,n){window.Sprig("setWindowDimensions",t,n)}logoutUser(){window.Sprig("logoutUser")}teardown(){window.Sprig("teardown")}}const yo={configure:e=>{if(!e.envId&&!e.environmentId)throw new Error("Initialization Error: Sprig configure requires an environmentId");if(e.envId||(e.envId=e.environmentId||""),e.installationMethod="web-npm",window.Sprig)return window.Sprig;window.Sprig=function(){window.Sprig._queue.push(arguments)},Object.getOwnPropertyNames(Fr.prototype).map(n=>{n!=="constructor"&&(window.Sprig[n]=Fr.prototype[n])});const t=window.Sprig;return t.appId=e.envId,t._queue=[],window.UserLeap=t,cy(e),window.Sprig}},dy={sprig:yo,SprigAPI:Fr,configure:yo.configure};exports.DismissReason=qe;exports.SprigAPI=Fr;exports.SprigEvent=j;exports.default=dy;exports.sprig=yo;
|
|
704
|
+
`,Mg=(e,t)=>{const n=[...e],r=new Set([L.VideoVoice,L.RecordedTask]);return e.some(i=>r.has(i.type))&&n.push({name:-2,props:{routingOptions:[]},type:L.Uploading}),t&&n.push({name:-1,props:{routingOptions:[]},type:L.Thanks}),n},Vg=({mode:e=null,viewWindow:t,viewDocument:n})=>{const r=n.documentElement;return{mode:e,sw:t.screen.width,sh:t.screen.height,cw:r.clientWidth,ch:r.clientHeight,p:t.location.href,l:t.navigator.language}};function jg(e,t=!0){var m;const{answers:n,apiURL:r,customStyles:i,endCard:o,eventEmitFn:a,fontFamilyURL:s,frame:l,previewKey:u,viewDocument:c,viewWindow:d}=e,f=Jt(e.headers)?e.frame:c.body,p=e.UpChunk||window.UpChunk,v=F,h=Mg(e.cards,!!o);gr.configure(v,{cards:h,hasEndCard:!!o,apiURL:r,UpChunk:p}),X.setState({apiURL:r,answers:n,border:e.border,index:e.startingQuestionIdx||0,cards:h,configureExitOnOverlayClick:e.configureExitOnOverlayClick,customMetadata:e.customMetadata,endCard:e.endCard,envId:e.envId,eventEmitFn:a,fontFamily:e.fontFamily,forceBrandedLogo:e.forceBrandedLogo,frame:l,headers:e.headers,hasViewedEmbed:!1,isPreview:e.isPreview,marketingUrl:"https://sprig.com",meta:Vg({mode:e.mode,viewWindow:d,viewDocument:c}),mode:e.mode,previewKey:u,recorder:gr,recorderEventEmitter:v,responseGroupUid:e.responseGroupUid,showStripes:e.showStripes,showSurveyBrand:e.showSurveyBrand,slugName:e.slugName,styleNonce:e.styleNonce,surveyId:e.surveyId,tabTitle:e.tabTitle,uploadingCardViewed:!1,uploadProgress:{},useMobileStyling:e.useMobileStyling,useDesktopPrototype:e.useDesktopPrototype,userId:e.userId,viewDocument:e.viewDocument,visitorAttributes:e.visitorAttributes,viewedCardCount:e.startingQuestionIdx||0});const{seen:g}=X.getState();g();const{head:_}=c,w=c.createElement("style");if(w.id="sprig-style",w.textContent=Ng,w.nonce=e.styleNonce,_.appendChild(w),e.fontFamily&&s&&parent){const x=c.createElement("link");x.rel="stylesheet",x.href=s,_.appendChild(x)}if(e.customStyles&&ol(c,i,e.styleNonce),!p)if(e.installationMethod!==yt.Npm){const x=c.createElement("script");x.src="https://cdn.sprig.com/userleap-web-upchunk-v2.2.2.js",x.onload=()=>{gr.setUpChunk(d.UpChunk)},x.onerror=()=>{console.warn("[Sprig] - recording functionality not configured due to UpChunk library load failure")},_.appendChild(x)}else console.warn("[Sprig] - recording functionality not configured due to missing UpChunk dependency");const E="2.25.1",b=a||((m=l.eventEmitter)==null?void 0:m.emit);b==null||b(Ue.VerifyViewVersion,{[At.ViewVersion]:E}),f&&t&&ln(y(Pg,{}),f)}const Bg={configure:jg},Fg="!launch_darkly_";class Hg{constructor(){ie(this,"_ldData",{})}getAllLaunchDarklyVariations(){return this._ldData}setLDFlagsVariations(t){try{return!t||typeof t!="object"||Array.isArray(t)?!1:(Object.keys(this._ldData).forEach(n=>{delete this._ldData[n]}),Object.keys(t).forEach(n=>{var r;return this._ldData[`${Fg}${n}`]=((r=t[n])!=null?r:0)+1}),!0)}catch(n){return n instanceof Error&&window.UserLeap.reportError("setAllLDFlagsVariations",n),console.warn("[Sprig] An issue had occured when setting LaunchDarkly flags and variations."),!1}}}const mo=new Hg;Object.freeze(mo);const $g="!optimizely_experiments_";class Kg{constructor(){ie(this,"_optimizelyData",{})}setOptimizelyExperiment(t,n=!0){if(!t||typeof t!="object")return!1;const{experiments:r}=t;try{return n&&Object.keys(this._optimizelyData).map(i=>{delete this._optimizelyData[i]}),r&&r.map(i=>{const{id:o,variation:a}=i,s=this.transformExperimentId(o);a&&typeof a=="string"&&(this._optimizelyData[s]=a)}),!0}catch(i){return i instanceof Error&&window.UserLeap.reportError("setOptimizelyExperiment",i),!1}}getAllOptimizelyExperiments(){return this._optimizelyData}getOptimizelyVariationName(t){return this._optimizelyData[this.transformExperimentId(t)]}transformExperimentId(t){return $g+t}getAndSetWebOptimizelyExperiments(){var t;try{if(window&&window.optimizely&&typeof window.optimizely.get=="function"){const n=(t=window.optimizely.get("state"))==null?void 0:t.getExperimentStates({isActive:!0});if(n){const r=Object.keys(n).map(i=>{var o,a;return(o=n[i].variation)!=null&&o.name?{id:i,variation:(a=n[i].variation)==null?void 0:a.name}:{id:i,variation:"Original"}});return this.setOptimizelyExperiment({experiments:r},!1),!0}return!1}return!1}catch(n){return n instanceof Error&&window.UserLeap.reportError("getAndSetWebOptimizely",n),!1}}}const wr=new Kg;Object.freeze(wr);class qg{constructor(t,n){ie(this,"paused");ie(this,"queue");ie(this,"ul");this.ul=t,this.paused=!1,this.queue=[],this.flush(n)}flush(t){const n=t.length;if(n)for(let r=0;r<n;r++)this.push(t[r])}isPaused(){return this.paused}pause(){this.paused=!0}unpause(){this.paused=!1;const t=this.queue.slice();this.empty(),this.flush(t)}push(t){if(this.paused)this.queue.push(t);else if(t instanceof Function)t();else{const n=Array.prototype.slice.call(t,1),r=t[0],i=this.ul[r];i instanceof Function?i.apply(this.ul,n):r&&console.warn("[Sprig] (ERR-100) No valid UserLeap action called",r)}}perform(t){if(this.paused){let n=()=>{};const r=new Promise(function(i){n=function(){i(t())}});return this.queue.push(n),r}else return t()}empty(){this.queue.length=0}}var Ne=(e=>(e.Ready="ready",e.NoSurvey="no survey",e))(Ne||{}),Rc=(e=>(e.Preview="sprigPreviewKey",e))(Rc||{});const Gg=["popState","pushState","replaceState"],zg={test:"test"},_n="!email",Wg=["ios","android"],Dt="environments",go="pageUrl",It="visitors",js="ul-view-sdk-script",Bs=Object.freeze({contains:(e,t)=>t.includes(e),notContains:(e,t)=>!t.includes(e),exactly:(e,t)=>t===e,notExactly:(e,t)=>t!==e,startsWith:(e,t)=>t.startsWith(e),endsWith:(e,t)=>t.endsWith(e),regex:(e,t)=>new RegExp(e).test(t),legacy:(e,t)=>new RegExp(e,"i").test(t)});function da(e,t){const{matchType:n,pattern:r}=e,i=n?Bs[n]:Bs.legacy;let o=!1;try{o=i(r,t)}catch(a){const s=`[Sprig] (ERR-445) Failed to check url match with pattern ${r}`;a instanceof Error&&(console.warn(s,a),a.stack=JSON.stringify(e),window.UserLeap.reportError(s,a))}return o}function Yg(e,t){const{pageUrlEvents:n,interactiveEvents:r,dismissOnPageChange:i}=window.UserLeap._config;if(!i)return!0;const o=[];n&&n.length&&o.push(...n),r&&r.length&&o.push(...r);const a=e&&o.find(s=>s.id===e);return a?da(a,window.location.href):t===window.location.href}function Bn(e){const{pageUrlEvents:t,interactiveEvents:n,dismissOnPageChange:r,platform:i}=window.UserLeap._config;if(i&&i!==Vt.Web)return;const o=kt("trackStartUrl"),a=o?String(o):null;t&&Dc(window.location.href),n&&(Uc(),Qg()),r&&a&&a!==window.location.href&&e&&Gg.includes(e.type)&&window.UserLeap("dismissActiveSurvey",qe.PageChange)}const Ac={capture:!0},Qg=()=>{const t=window.UserLeap._config.interactiveEvents.filter(r=>da(r,window.location.href)).map(r=>{const{name:i,properties:o}=r,{selector:a,innerText:s}=o;return a?l=>{if(Oa(l.target))try{l.target.closest(a)&&window.UserLeap("track",i)}catch{}return!1}:l=>(Oa(l.target)&&l.target.innerText===s&&window.UserLeap("track",i),!1)}),n=r=>t.forEach(i=>i(r));window.UserLeap._config.interactiveEventsHandler=n,window.addEventListener("click",n,Ac)},Uc=()=>{window.UserLeap._config.interactiveEventsHandler&&window.removeEventListener("click",window.UserLeap._config.interactiveEventsHandler,Ac),delete window.UserLeap._config.interactiveEventsHandler};function Zg(){["hashchange","popstate"].forEach(e=>window.addEventListener(e,Bn,!0))}function Xg(){["hashchange","popstate"].forEach(e=>window.removeEventListener(e,Bn,!0)),window.UserLeap._config.interactiveEvents&&Uc()}function Ze(e,t,n){const r=[window.UserLeap._API_URL,"sdk",e];return t&&t.forEach(i=>{r.push(i),i===Dt?r.push(window.UserLeap.envId):i===It&&r.push(fa())}),n&&r.push(n),r.join("/")}function Jg(e,t){let n=Ze("1",[Dt],"questions?");return e!=null&&(n+=`&vid=${e}`),t&&(t.surveyId&&(n+=`&surveyid=${t.surveyId}`),t.surveyTemplateId&&(n+=`&surveytemplateid=${t.surveyTemplateId}`),t.previewLanguage&&(n+=`&previewLanguage=${encodeURIComponent(t.previewLanguage)}`)),n}function kt(e){const t=Ee.getItem(xe.Credentials);if(t)try{const r=JSON.parse(t)[window.UserLeap.envId];return r&&r[e]||null}catch(n){n instanceof Error&&(n.stack=t,window.UserLeap.reportError("Failed to parse local storage credentials",n)),console.warn("[Sprig] (ERR-427) Failed to lookup saved ids",n)}return null}function be(e,t){const n=Ee.getItem(xe.Credentials);let r={};if(n)try{r=JSON.parse(n)}catch(o){o instanceof Error&&(o.stack=n,window.UserLeap.reportError("Failed to parse local storage credentials",o)),console.warn("[Sprig] (ERR-427) Failed to lookup saved ids",o)}let i=r[window.UserLeap.envId];i?i[e]=t:i={[e]:t},r[window.UserLeap.envId]=i;try{Ee.setItem(xe.Credentials,JSON.stringify(r))}catch(o){o instanceof Error&&console.warn(`[Sprig] (ERR-426) Unable to write to Local Storage:: ${o.message}`)}}function Oc(){window.previewMode||(window.UserLeap.visitorId=at(),be("vid",window.UserLeap.visitorId),F.emit(j.VisitorIDUpdated,{visitorId:window.UserLeap.visitorId}))}function fa(){return window.previewMode?"0":window.UserLeap.visitorId||""}function Dc(e,t,n){if(e.endsWith("mock_snippet.html"))return;const r=window.UserLeap._config.pageUrlEvents;let i=!1;if(r&&r.length)for(let c=0;c<r.length&&(i=da(r[c],e),!i);c++);if(!i)return;window.UserLeap.debugMode&&console.info("[DEBUG] Sprig trackPageView",e);const o=10,a=1;let s=[];const l={viewedAt:Date.now(),location:e},u=Ee.getItem(xe.PageViews);try{if(s=u?JSON.parse(u):[],Array.isArray(s)||(s=[]),s.length>0){const c=s[s.length-1],d=(Date.now()-c.viewedAt)/1e3;c.location!=e&&d>a&&es({url:e,referrer:document.referrer,description:document.title}),(c.location!=e&&d>a||d>o)&&(window.UserLeap._queue.push(["track",go,t,{url:e},n]),s.push(l))}else window.UserLeap._queue.push(["track",go,t,{url:e},n]),s.push(l),es({url:e});s.length>5&&s.splice(0,s.length-5),Ee.setItem(xe.PageViews,JSON.stringify(s))}catch(c){c instanceof Error&&window.UserLeap.reportError("trackPageView",c,{pageViewsStorage:u}),console.warn("[Sprig] (ERR-425) Failed to update page views in local storage")}}function ey(){const e="Backbone"in window&&window.Backbone&&window.Backbone.history?window.Backbone.history:window.history;"pushState"in e&&(e.pushState=(t=>function(...r){const i=t.apply(this,r),o=new Event("pushState");return window.dispatchEvent(o),Bn(o),i})(e.pushState)),"replaceState"in e&&(e.replaceState=(t=>function(...r){const i=t.apply(this,r),o=new Event("replaceState");return window.dispatchEvent(o),Bn(o),i})(e.replaceState)),Zg()}async function Ci(e,t){const n=fa();e&&!t&&(window.UserLeap._config.mode=zg.test);const r=await ht(Jg(n,{...e,previewLanguage:window.UserLeap._config.previewLanguage}),{},0,!0);return r.ok?(r.json.delay&&await Cr(r.json.delay),Pc(r.json)):(r.reportError&&r.error&&(console.warn("[Sprig] (ERR-414) Failed to request questions from the server",r.error),window.UserLeap.reportError("getQuestions",r.error)),{success:!1,surveyState:Ne.NoSurvey})}const Pc=async e=>{var T,D,z;const{context:t,forceBrandedLogo:n,endCard:r,locale:i,productConfig:o,questions:a,responseGroupUid:s,surveyId:l,uuid:u,vid:c,sessionReplay:d}=e,f=rn(window.UserLeap),p=pa(f),v=ty(f);if(d)if(p){const C={mediaRecordingUid:at(),mediaType:Te.Screen,questionId:1,responseGroupUid:s,surveyId:l,updatedAt:new Date().toISOString(),visitorId:window.UserLeap.visitorId,isReplay:!0};F.emit(j.ReplayCapture,{responseGroupUid:s,hasQuestions:!!(a!=null&&a.length),surveyId:l,uploadId:d.uploadId,replayType:(T=d.replayDurationType)!=null?T:Mt.Before,seconds:d.replayDurationSeconds,generateVideoUploadUrlPayload:C})}else nu({responseGroupId:s,surveyId:l,visitorId:c,replayParams:d,completeUploadHeaders:f,apiUrl:window.UserLeap._API_URL,triggerTimestamp:Date.now(),isStandalone:a.length===0});if(c==null||!a||!a.length)return{success:!1,message:"[Sprig] no survey found",surveyState:Ne.NoSurvey};if(window.UserLeap.container){const C="[Sprig] (ERR-409) Found an existing Survey container, aborting rendering of this survey";return console.warn(C),{success:!1,message:C,surveyState:Ne.NoSurvey}}if(c!==window.UserLeap.visitorId&&u!==window.UserLeap.visitorId&&!window.previewMode){const C="Attempted to display survey to a different visitor";return window.UserLeap.reportError("DisplaySurvey",new Error(C)),{success:!1,message:C,surveyState:Ne.NoSurvey}}gv({id:l}),Li.disable(),F.emit(j.SurveyWillPresent,{name:j.SurveyWillPresent,[Rn.SurveyId]:l});let h,g=document.createElement("div"),_,w,E;const b=C=>{const{[At.ViewVersion]:W}=C;W!==f["x-ul-sdk-version"]&&oc(),F.removeListener(Ue.VerifyViewVersion,b)};F.on(Ue.VerifyViewVersion,b),Jt(f)?(h="ul-direct-embeded-frame",_=document.head,w=window,E=!1,p&&(ic(),g.id=h,window.UserLeap.container.appendChild(g),ac(),F.emit(j.SurveyLifeCycle,{state:"presented"}),F.emit(j.SurveyPresented,{name:j.SurveyPresented,[Rn.SurveyId]:l}))):{frameId:h,contentWinDocHead:_,contentWindow:w,hasOverlay:E,iframe:g}=Im(o,v,l),window.UserLeap.frameId=h,window.UserLeap.useMobileStyling=v;const m=C=>{F.on(j.CloseSurveyOnOverlayClick,C)},x=Object.assign({frame:g,envId:window.UserLeap.envId,surveyId:l,userId:u,visitorAttributes:{externalUserId:window.UserLeap.userId,email:window.UserLeap.email},cards:a,context:t,locale:i,fontFamily:window.UserLeap.fontFamily,fontFamilyURL:window.UserLeap.fontFamilyURL,apiURL:window.UserLeap._API_URL,responseGroupUid:s,headers:f,endCard:r,useMobileStyling:v,mobileSDKVersion:window.UserLeap.mobileSDKVersion,configureExitOnOverlayClick:m,eventEmitFn:F.emit.bind(F),ulEvents:_o,viewDocument:w==null?void 0:w.document,viewWindow:w,tabTitle:document.title,startingQuestionIdx:(D=window.UserLeap.config)==null?void 0:D.startingQuestionIdx,styleNonce:window.UserLeap.styleNonce,previewKey:Ee.getItem(xe.Preview),forceBrandedLogo:n},window.UserLeap._config);(z=window.UserLeap.config)!=null&&z.startingQuestionIdx&&(window.UserLeap.config={...window.UserLeap.config,startingQuestionIdx:null}),window.UserLeap.customStyles&&(x.customStyles=window.UserLeap.customStyles),w&&(w.__cfg=x);function k(){const C=document.createElement("script");return window.UserLeap.nonce&&C.setAttribute("nonce",window.UserLeap.nonce),C.id=js,C}const S=window.UserLeap.viewSDKURL?window.UserLeap.viewSDKURL:x.path,I=document.getElementById(js);I&&I.remove();const R=k(),O=()=>{window.UserLeap.container&&Object.assign(window.UserLeap.container.style,{display:"flex"})};return x.installationMethod===yt.Npm||x.installationMethod===yt.NpmBundled?(Bg.configure(x),E&&window.UserLeap.container&&O()):S&&(R.src=S,E&&R.addEventListener("load",()=>{window.UserLeap.container&&O()}),w==null||w.addEventListener("error",C=>{C.target instanceof HTMLScriptElement&&C.target.src===S&&window.UserLeap.reportError("loadFrameScript",new Error("Frame script failed to load"))},{capture:!0,once:!0})),_==null||_.appendChild(R),{success:!0,surveyState:Ne.Ready,surveyId:l,responseGroupUid:s}};function ty(e){if(window.UserLeap.useMobileStyling!==void 0)return window.UserLeap.useMobileStyling;const t=window.UserLeap.windowDimensions&&window.UserLeap.windowDimensions.width||document.body.clientWidth;return pa(e)||t>10&&t<$f}function pa(e){return Wg.includes(e[Ke.Platform])}function ny(e){let t=e.length;for(;t;){const n=Math.floor(Math.random()*t);t-=1;const r=e[t];e[t]=e[n],e[n]=r}}function ry(e){if(!e)return;window.UserLeap._config=e,e.mute&&window.UserLeap._queue.pause();const{interactiveEvents:t,pageUrlEvents:n,dismissOnPageChange:r}=e;t&&ny(t),(t||n||r)&&(ey(),Bn())}async function ht(e,t,n=0,r=!1){var o,a;t.headers=Object.assign(rn(window.UserLeap),t.headers);const i=await rt(e,t,n,r);if(i.ok){const s=(o=i.headers)==null?void 0:o.get("Authorization"),l=s?s.split(" "):void 0,u=l&&l.length===2?l[1]:void 0,c=(a=i.headers)==null?void 0:a.get(Ke.VisitorID);u&&c&&(c!==window.UserLeap.visitorId||window.UserLeap.token!==u)&&(be("token",u),be("vid",c),F.emit(j.VisitorIDUpdated,{visitorId:c}),window.UserLeap.token=u,window.UserLeap.visitorId=c)}return i.json&&i.json.logMessage&&console.warn(`[Sprig] ${i.json.logMessage}`),i}async function iy(e,t){var r,i;let n=!0;return t&&((r=e==null?void 0:e.json)==null?void 0:r.surveyId)&&(window.UserLeap.delayingSurvey=!0,n=await t(e.json.surveyId),window.UserLeap.delayingSurvey=!1,!n)?!1:((i=e==null?void 0:e.json)!=null&&i.delay&&(window.UserLeap.delayingSurvey=!0,await Cr(e.json.delay),window.UserLeap.delayingSurvey=!1),n)}const oy=function(e){if(!window.UserLeap)return;const t=async(r={})=>{var h,g,_,w,E;const{userId:i,anonymousId:o,metadata:a={},properties:s,showSurveyCallback:l}=r;let{eventName:u}=r;if(window.UserLeap.debugMode&&u!==go&&console.info("[DEBUG] Sprig track",r),e.mode==="test")return;const c=(h=Ee.getItem(xe.Preview))!=null?h:void 0;if(e.requireUserIdForTracking&&!window.UserLeap.userId&&!i){const b="[Sprig] - Skipping tracking without userId";return console.warn(b),{success:!1,message:b,surveyState:Ne.NoSurvey}}if(!u||u.trim().length===0){u=u?String(u):"";const b="[Sprig] - Invalid event name "+u;return console.warn(b),{success:!1,message:b,surveyState:Ne.NoSurvey}}const d=window.location.href;if(a.url||(a.url=d),be("trackStartUrl",d),(_=(g=window.UserLeap)==null?void 0:g._config)!=null&&_.optimizelyEnabled){const b=rn(window.UserLeap);pa(b)||wr.getAndSetWebOptimizelyExperiments(),a.optimizelyExperiments=Object.assign({},wr.getAllOptimizelyExperiments())}(E=(w=window.UserLeap)==null?void 0:w._config)!=null&&E.launchDarklyEnabled&&(a.launchDarklyFlags=mo.getAllLaunchDarklyVariations()),i&&(window.UserLeap.userId=i),o&&(window.UserLeap.partnerAnonymousId=o),s&&(a.eventProperties=s),mv({name:u,url:a.url});const f=window.UserLeap.delayingSurvey?await ht(Ze("1",[It],"events/batch"),{body:JSON.stringify({events:[{event:u,metadata:a}],previewKey:c}),method:"POST"},0,!0):await ht(Ze("1",[It],"events"),{body:JSON.stringify({event:u,metadata:a,previewKey:c}),method:"POST"},0,!0);if(!f.ok){const b="[Sprig] (ERR-421) Failed to track event";return f.reportError&&(console.warn(b,f.error),f.error&&window.UserLeap.reportError("track",f.error)),{success:!1,message:b,error:f.error,surveyState:Ne.NoSurvey}}i&&be("uid",i),o&&be("aid",o);const p=f.json;return p.invalidPreviewKey&&Ee.removeItem(xe.Preview),await iy(f,l)?Yg(p.eventId,d)?Pc(p):{success:!1,message:"Study should not be displayed after page navigation",surveyState:Ne.NoSurvey}:{success:!1,message:"[Sprig] Callback returned false, aborting rendering of survey",surveyState:Ne.NoSurvey}},n={async displaySurvey(r){return console.warn("[Sprig] displaySurvey should only be used to debug your studies; not intended for production usage."),window.UserLeap("dismissActiveSurvey",qe.Override),Ci({surveyId:r},!0)},_previewSurvey(r){window.UserLeap("dismissActiveSurvey",qe.Override),Ci({surveyTemplateId:r},!1)},_reviewSurvey(r){window.UserLeap("dismissActiveSurvey",qe.Override),Ci({surveyId:r},!1)},previewSurvey(r){n._previewSurvey(r)},reviewSurvey(r){n._reviewSurvey(r)},mute(){window.UserLeap._queue.pause()},unmute(){window.UserLeap._queue.unpause()},setVisitorToken(){console.warn("[Sprig] setVisitorToken is deprecated.")},dismissActiveSurvey(r=qe.API){F.emit(j.SurveyWillClose,{name:j.SurveyWillClose,initiator:r})},async setAttribute(r,i){if(!r||!i&&i!==0){const o="[Sprig] - Disregarding empty attribute / value provided";return console.warn(o),{success:!1,message:o}}return this.setAttributes({[r]:i})},async setAttributes(r){if(r==null||Object.keys(r).length===0){const i="[Sprig] - Disregarding empty attributes provided";return console.warn(i),{success:!1,message:i}}return this.identifyAndSetAttributes({attributes:r})},async identifyAndSetAttributes(r){if(window.UserLeap.debugMode&&console.info("[DEBUG] Sprig identifyAndSetAttributes",r),e.mode==="test")return;if(r===null||typeof r!="object"||!(r.userId||r.anonymousId||r.attributes)){const u="[Sprig] - Disregarding empty payload provided";return console.warn(u),{success:!1,message:u}}const{userId:i,anonymousId:o,attributes:a}=r;if(e.requireUserIdForTracking&&!window.UserLeap.userId&&!i){const u="[Sprig] - Skipping tracking without userId";return console.warn(u),{success:!1,message:u}}if(!a&&(!i||window.UserLeap.userId===i)&&(!o||window.UserLeap.partnerAnonymousId===o))return{success:!0};const s={};i&&(s.userId=window.UserLeap.userId=i),o&&(s.partnerAnonymousId=window.UserLeap.partnerAnonymousId=o);let l;return a?(a.email&&!Object.prototype.hasOwnProperty.call(a,_n)&&(a[_n]=a.email,delete a.email),l=await ht(Ze("1",[Dt,It],"attributes"),{body:JSON.stringify(a),method:"PUT"}),!l.ok&&l.reportError&&(console.warn("[Sprig] (ERR-432) identifyAndSetAttributes failed",l.error),l.error&&window.UserLeap.reportError("identifyAndSetAttributes",l.error))):l=await ht(Ze("1",[Dt,It]),{body:JSON.stringify(s),method:"PUT"}),a&&a[_n]&&(window.UserLeap.email=a[_n]),l.ok&&(i&&be("uid",i),o&&be("aid",o)),{success:!!l.ok}},async removeAttributes(r){if(window.UserLeap.debugMode&&console.info("[DEBUG] Sprig removeAttributes",r),e.mode==="test")return;if(r==null||r.length===0){const o="[Sprig] - Disregarding empty attributes provided";return console.warn(o),{success:!1,message:o}}if(e.requireUserIdForTracking&&!window.UserLeap.userId){const o="[Sprig] - Skipping tracking without userId";return console.warn(o),{success:!1,message:o}}const i=await ht(Ze("1",[Dt,It],"attributes"),{body:JSON.stringify({delete:r}),method:"DELETE"});return!i.ok&&i.reportError&&(console.warn("[Sprig] (ERR-433) Remove attributes failed",i.error),i.error&&window.UserLeap.reportError("removeAttributes",i.error)),{success:!!i.ok}},async addSurveyListener(r){F.on(j.SurveyLifeCycle,r)},async removeSurveyListener(r){F.removeListener(j.SurveyLifeCycle,r)},async addListener(r,i){F.on(r,i)},async removeListener(r,i){F.removeListener(r,i)},async removeAllListeners(){F.removeAllListeners()},setPreviewKey(r){!r||typeof r!="string"||Ee.isStorageAvailable&&r&&Ee.setItem(xe.Preview,r)},async setUserId(r){if(window.UserLeap.debugMode&&console.info("[DEBUG] Sprig setUserId",r),r==null){const a=`[Sprig] - Invalid userId ${r}`;return console.warn(a),{success:!1,message:a}}if(e.mode==="test"||r===window.UserLeap.userId)return;window.UserLeap.userId=r;const i=window.UserLeap.visitorId,o=await ht(Ze("1",[Dt,It]),{body:JSON.stringify({userId:r}),method:"PUT"});if(!o.ok){o.reportError&&(console.warn("[Sprig] (ERR-420) Failed to set user id",o.error),o.error&&window.UserLeap.reportError("setUserId",o.error));return}i!==window.UserLeap.visitorId&&Ja(),be("uid",r)},async setPartnerAnonymousId(r){if(window.UserLeap.debugMode&&console.info("[DEBUG] Sprig setPartnerAnonymousId",r),r==null){const i=`[Sprig] - Invalid partnerAnonymousId ${r}`;return console.warn(i),{success:!1,message:i}}return window.UserLeap.partnerAnonymousId=r,be("aid",r),{success:!0}},async track(r,i,o={},a=void 0){return t({eventName:r,properties:i,metadata:o,showSurveyCallback:a})},async identifyAndTrack(r){return await t(r)},trackPageView(r,i=void 0,o=void 0){Dc(r,i,o)},applyStyles(r){if(window.UserLeap.customStyles=r,window.UserLeap.container){const i=window.UserLeap.container.children[0].contentDocument;if(i){const o=i.getElementById(U.CustomStyle);o?o.textContent=r:ol(i,r,window.UserLeap.styleNonce)}}},setWindowDimensions(r,i){var l,u;const o=typeof r=="string"?parseInt(r,10):r,a=typeof i=="string"?parseInt(i,10):i;if(!isNaN(o)&&!isNaN(a)&&(window.UserLeap.windowDimensions={width:o,height:a}),!window.UserLeap.frameId)return;const s=document.getElementById(window.UserLeap.frameId);!s||(window.UserLeap.useMobileStyling&&((l=window.UserLeap.windowDimensions)!=null&&l.width&&(s.style.width=`${window.UserLeap.windowDimensions.width}px`),(u=window.UserLeap.windowDimensions)!=null&&u.height&&(s.style.maxHeight=`${window.UserLeap.windowDimensions.height-20}px`),s.contentDocument&&(s.style.height=String(sl(s.contentDocument)[0])+"px")),F.emit(j.SurveyDimensions,{name:j.SurveyDimensions,contentFrameWidth:s.clientWidth,contentFrameHeight:s.clientHeight}))},logoutUser(){window.UserLeap.debugMode&&console.info("[DEBUG] Sprig logout"),window.UserLeap.visitorId=null,window.UserLeap.userId=null,window.UserLeap.partnerAnonymousId=null,window.UserLeap.token=null,window.UserLeap.email=null,Ee.removeItem(xe.Credentials),Ee.removeItem(xe.PageViews),window.UserLeap._queue.isPaused()&&window.UserLeap._queue.empty(),Oc(),Ja(),window.UserLeap._queue.unpause()},teardown(){Xg(),window.UserLeap("dismissActiveSurvey",qe.API),delete window.UserLeap,delete window.Sprig,delete window._Sprig},integrateOptimizely(r,i=!0){var o,a;if(!((a=(o=window.UserLeap)==null?void 0:o._config)!=null&&a.optimizelyEnabled)){console.warn("[SPRIG] Optimizely integration is currently not enabled for your product.");return}try{const s=typeof r=="string"?JSON.parse(r):r;wr.setOptimizelyExperiment(s,i)}catch(s){console.warn("[Sprig] Error with integrating Optimizely data"),s instanceof Error&&window.UserLeap.reportError("integrateOptimizely",s)}},integrateOptimizelyClient(r){var o,a;if(!((a=(o=window.UserLeap)==null?void 0:o._config)!=null&&a.optimizelyEnabled)){console.warn("[SPRIG] Optimizely integration is currently not enabled for your product.");return}const i=({experiment:s,variation:l})=>{const u={experiments:[{id:s.id,variation:l.key}]};window.UserLeap("integrateOptimizely",u,!1)};r.notificationCenter.addNotificationListener(Mf.NOTIFICATION_TYPES.ACTIVATE,i)},importLaunchDarklyData(r){var i,o;if(!((o=(i=window.UserLeap)==null?void 0:i._config)!=null&&o.launchDarklyEnabled)){console.warn("[SPRIG] LaunchDarkly integration is currently not enabled for your product.");return}mo.setLDFlagsVariations(r)},setVisitorAttribute(r,i){return console.warn("[Sprig] setVisitorAttribute is deprecated. Please use setAttribute"),n.setAttribute(r,i)},async setEmail(r){return n.setAttribute(_n,r)},async setVisitorEmail(r){return console.warn("[Sprig] setVisitorEmail is deprecated. Please use setEmail"),n.setEmail(r)},async _generateVideoUploadUrl(r){return uy(r)},async _completeSessionReplay({surveyId:r,responseGroupUuid:i,eventDigest:o}){if(!r||!i)return;const a=window.UserLeap._API_URL;try{await ml({surveyId:r,responseGroupUuid:i,eventDigest:o,apiUrl:a,headers:rn(window.UserLeap)},!0)}catch(s){console.warn("[Sprig] Error with completing session replay"),s instanceof Error&&window.UserLeap.reportError("completeSessionReplay",s)}}};Object.assign(window.UserLeap,n)};async function ay(e){const t=rn(window.UserLeap);document.addEventListener("securitypolicyviolation",Ri);const n=await rt(Ze("1",[Dt],"config"),{headers:t}),r="TypeError";if(window.UserLeap.error=n.error,!n.ok&&n.error&&n.error.name===r?(window.UserLeap._API_URL="https://api.sprig.com",window.UserLeap.reportError("sprigDomainRequest",n.error)):document.removeEventListener("securitypolicyviolation",Ri),!n.ok)return n.reportError&&(console.warn("[Sprig] (ERR-422) Failed to load configuration",n.error),n.error&&window.UserLeap.reportError("applyRemoteConfig",n.error)),Ai("Disabled: failed to fetch configuration"),e;const i=n.json;return i!=null&&i.disabled?(Ai(`Disabled: ${i.disabled}`),{disabled:i.disabled}):Object.assign({},i,e)}const sy=e=>typeof e=="object"&&e&&"inner"in e&&!!e.inner&&typeof e.inner=="object";async function ly(e,t,n={}){var d,f;const r=window.__cfg&&window.__cfg.mode,i=fa(),o=window.UserLeap.envId,a=window.document.documentElement,s=sy(t)?{inner:{message:(d=t.inner)==null?void 0:d.message,stack:(f=t.inner)==null?void 0:f.stack}}:{},l={mode:r,screenWidth:window.screen.width,screenHeight:window.screen.height,clientWidth:a.clientWidth,clientHeight:a.clientHeight,location:window.location.href,language:window.navigator.language,...n,...s},u={action:e,err:{message:t.message,stack:t.stack},meta:l,vid:i,envId:o};(await ht(Ze("1",null,"errors"),{method:"POST",headers:{[Ke.Error]:window.btoa(`userleap-${Date.now()}-error`)},body:JSON.stringify(u)},0,!0)).ok||console.warn("[Sprig] (ERR-444) Failed to report error to API",t)}async function uy(e){var n;if(!e)return;const t=`${window.UserLeap._API_URL}/2/environments/integrations/upload`;try{const r=await fetch(t,{method:"POST",cache:"no-cache",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(r.ok){const i=await r.json();return(n=i==null?void 0:i.upload)==null?void 0:n.url}else return null}catch(r){console.warn("[Sprig] Error with generating video upload url"),r instanceof Error&&window.UserLeap.reportError("generateVideoUploadUrl",r)}}function cy(e={}){var r;const t=(r=new URLSearchParams(window.location.search).get(Rc.Preview))!=null?r:"";window.UserLeap.UPDATES=_o,window.UserLeap("setPreviewKey",t);async function n(){if(window.UserLeap.loaded)return;if(window.UserLeap.reportError=ly,window.UserLeap.loaded=!0,window.UserLeap._config=Object.assign({},e,window.UserLeap.config),window.UserLeap.delayingSurvey=!1,window.UserLeap._config&&typeof window.UserLeap._config=="object")for(const l in window.UserLeap._config)window.UserLeap[l]=window.UserLeap._config[l];if(!window.UserLeap.envId)if(window.UserLeap.appId)window.UserLeap.envId=window.UserLeap.appId;else throw new Error("Missing Environment id");window.UserLeap.debugMode&&console.info("[DEBUG] Sprig debug mode enabled");const i=window.UserLeap.sampleRate;if(i){let l=kt("sampled");if(l===null&&(l=Math.random()<i,be("sampled",l)),!l)return}else kt("sampled")!==null&&be("sampled",null);window.UserLeap._API_URL||(window.UserLeap._API_URL="https://api.sprig.com");const o=[...window.UserLeap._queue];window.UserLeap._queue=new qg(window.UserLeap,[]),window.UserLeap._queue.pause();for(let l=0;l<o.length;l++)window.UserLeap._queue.push(o[l]);const a=kt("token");a?(window.UserLeap.token=a,window.UserLeap.visitorId=kt("vid"),window.UserLeap.userId=kt("uid"),window.UserLeap.partnerAnonymousId=kt("aid")):(Ee.removeItem(xe.Credentials),Oc());const s=await ay(e);nv(window.document,s.maxReplayDurationSeconds,window.UserLeap.replayNonce,window.UserLeap.maxInflightReplayRequests,s.replaySettings).then(()=>{Uv()}),oy(s),await ry(s),window.UserLeap._queue.unpause(),F.emit(j.SDKReady,{maxMobileReplayDurationSeconds:s.maxMobileReplayDurationSeconds,mobileReplaySettings:s.mobileReplaySettings}),F.emit(j.VisitorIDUpdated,{visitorId:window.UserLeap.visitorId})}document.readyState==="complete"?n():window.attachEvent?window.attachEvent("onload",n):window.addEventListener("load",()=>{n()},!1)}class Fr{constructor(){ie(this,"UPDATES",_o)}displaySurvey(t){window.Sprig("displaySurvey",t)}mute(){window.Sprig("mute")}unmute(){window.Sprig("unmute")}dismissActiveSurvey(){window.Sprig("dismissActiveSurvey")}setAttribute(t,n){window.Sprig("setAttribute",t,n)}setAttributes(t){window.Sprig("setAttributes",t)}identifyAndSetAttributes(t){window.Sprig("identifyAndSetAttributes",t)}removeAttributes(t){window.Sprig("removeAttributes",t)}addListener(t,n){window.Sprig("addListener",t,n)}removeListener(t,n){window.Sprig("removeListener",t,n)}removeAllListeners(){window.Sprig("removeAllListeners")}setEmail(t){window.Sprig("setAttribute","!email",t)}setUserId(t){window.Sprig("setUserId",t)}setPartnerAnonymousId(t){window.Sprig("setPartnerAnonymousId",t)}track(t,n={},r={}){window.Sprig("track",t,n,r)}identifyAndTrack(t){window.Sprig("identifyAndTrack",t)}trackPageView(t,n,r){window.Sprig("trackPageView",t,n,r)}applyStyles(t){window.Sprig("applyStyles",t)}setWindowDimensions(t,n){window.Sprig("setWindowDimensions",t,n)}logoutUser(){window.Sprig("logoutUser")}teardown(){window.Sprig("teardown")}}const yo={configure:e=>{if(!e.envId&&!e.environmentId)throw new Error("Initialization Error: Sprig configure requires an environmentId");if(e.envId||(e.envId=e.environmentId||""),e.installationMethod="web-npm",window.Sprig)return window.Sprig;window.Sprig=function(){window.Sprig._queue.push(arguments)},Object.getOwnPropertyNames(Fr.prototype).map(n=>{n!=="constructor"&&(window.Sprig[n]=Fr.prototype[n])});const t=window.Sprig;return t.appId=e.envId,t._queue=[],window.UserLeap=t,cy(e),window.Sprig}},dy={sprig:yo,SprigAPI:Fr,configure:yo.configure};exports.DismissReason=qe;exports.SprigAPI=Fr;exports.SprigEvent=j;exports.default=dy;exports.sprig=yo;
|
package/dist/index.js
CHANGED
|
@@ -1728,7 +1728,7 @@ function rn(e = {}) {
|
|
|
1728
1728
|
const t = {
|
|
1729
1729
|
"Content-Type": "application/json",
|
|
1730
1730
|
"userleap-platform": Vt.Web,
|
|
1731
|
-
"x-ul-sdk-version": "2.25.
|
|
1731
|
+
"x-ul-sdk-version": "2.25.1",
|
|
1732
1732
|
[Ke.InstallationMethod]: ep(e)
|
|
1733
1733
|
};
|
|
1734
1734
|
if (e.envId && (t[Ke.EnvironmentID] = e.envId), e.token && (t.Authorization = "Bearer " + e.token), e.userId && (t[Ke.UserID] = e.userId), e.visitorId && (t[Ke.VisitorID] = e.visitorId), e.partnerAnonymousId && (t[Ke.PartnerAnonymousId] = e.partnerAnonymousId), e.mobileHeadersJSON) {
|
|
@@ -11335,7 +11335,7 @@ const vt = async ({ event: e, apiBase: t, headers: n, visitorId: r, envId: i, me
|
|
|
11335
11335
|
sh: t.screen.height,
|
|
11336
11336
|
cw: r.clientWidth,
|
|
11337
11337
|
ch: r.clientHeight,
|
|
11338
|
-
p: t.
|
|
11338
|
+
p: t.location.href,
|
|
11339
11339
|
l: t.navigator.language
|
|
11340
11340
|
};
|
|
11341
11341
|
};
|
|
@@ -11422,7 +11422,7 @@ function jg(e, t = !0) {
|
|
|
11422
11422
|
}, _.appendChild(x);
|
|
11423
11423
|
} else
|
|
11424
11424
|
console.warn("[Sprig] - recording functionality not configured due to missing UpChunk dependency");
|
|
11425
|
-
const E = "2.25.
|
|
11425
|
+
const E = "2.25.1", b = a || ((m = l.eventEmitter) == null ? void 0 : m.emit);
|
|
11426
11426
|
b == null || b(Ue.VerifyViewVersion, {
|
|
11427
11427
|
[At.ViewVersion]: E
|
|
11428
11428
|
}), f && t && ln(y(Pg, {}), f);
|
package/package.json
CHANGED