@sprig-technologies/sprig-browser 2.24.10 → 2.24.11

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/LICENSE.md CHANGED
@@ -1,176 +1,13 @@
1
- **SPRIG SDK LICENSE AGREEMENT**
1
+ Copyright 2018 Sprig Technologies Inc.
2
2
 
3
- YOU MAY OPEN, INSTALL AND USE THE SPRIG SOFTWARE DEVELOPMENT KIT AND
4
- ACCOMPANYING DOCUMENTATION (COLLECTIVELY, “**SDK**” ONLY IF YOU ACCEPT
5
- ALL OF THE TERMS OF THIS LICENSE AGREEMENT (“**AGREEMENT**”. PLEASE READ
6
- THESE TERMS CAREFULLY. BY OPENING, INSTALLING OR USING THE SDK, YOU
7
- AGREE TO BE BOUND BY THIS AGREEMENT. IF YOU DO NOT AGREE TO ALL TERMS OF
8
- THIS AGREEMENT, YOU MAY NOT USE THE SDK.
3
+ Licensed under the Apache License, Version 2.0 (the "License");
4
+ you may not use this file except in compliance with the License.
5
+ You may obtain a copy of the License at
9
6
 
10
- 1. **<u>License</u><u> </u><u>Grant</u>.** Subject to the terms and
11
- conditions contained herein, Sprig hereby grants to you a
12
- non-transferable, non-exclusive license to (i) download, install,
13
- modify (solely to the extent contemplated and subject to the terms
14
- of your separate service agreement with Sprig for Sprig’s products
15
- and services, including without limitation rate limits) and use the
16
- SDK solely in connection with your authorized use of Sprig’s
17
- products and services; (ii) download, install and use the SDK solely
18
- to develop applications for use with Sprig’s products and services
19
- (“**Licensee Applications**”; and (iii) distribute the SDK solely in
20
- conjunction with and as part of Licensee Applications, in each case
21
- pursuant to (and subject to the terms of) your agreement with Sprig.
22
- Licensee Applications must be designed, developed, and tested to
23
- function with and not degrade the functionality of Sprig’s products
24
- and services. Sprig and its licensors reserve all rights not
25
- expressly granted to you herein. You may make and/or simultaneously
26
- use only the number of copies of the SDK paid for by you, plus you
27
- may make an additional back-up copy of the SDK, provided any copies
28
- must contain all of the original SDK's copyright, trademark and
29
- other proprietary notices.
7
+ http://www.apache.org/licenses/LICENSE-2.0
30
8
 
31
- 2. **<u>License</u><u> </u><u>Restrictions</u>.** Unless otherwise
32
- agreed in writing by Sprig, you will not, and will not permit or
33
- authorize third parties to: (a) disassemble, decompile, or reverse
34
- engineer the SDK, except to the extent any such activity is not
35
- permitted to be restricted under applicable law; (b) circumvent or
36
- disable any copy-protection, security, or related features or
37
- measures in the SDK; (c) use the SDK in any way not expressly
38
- permitted under this Agreement; (d) except as authorized by Sprig,
39
- provide the SDK to any third party (including any contractors,
40
- agents, or advisors); (e) except as contemplated hereunder, use or
41
- combine any open source software or third party materials with the
42
- SDK in any manner which could subject the SDK to any open source
43
- license or other third party terms or conditions; (f) use the SDK
44
- for benchmarking or competitive analysis with respect to competitive
45
- or related products or services, or to develop, commercialize,
46
- license or sell any product, service or technology that could,
47
- directly or indirectly, compete with the SDK or any of Sprig’s
48
- products or services.
49
-
50
- Any distribution of a Licensee Application shall be under the terms of
51
- an End User License Agreement that contains terms which: (i) license use
52
- of the SDK only as an integrated component of the Licensee Application;
53
- (ii) prohibit any modifications to the SDK; (iii) prohibit any
54
- distribution of the SDK separate from the Licensee Application; (iv)
55
- prohibit title to the SDK passing to any party; (v) prohibit the reverse
56
- engineering, disassembly or decompilation of the Code; and (vi)
57
- disclaim; to the extent permitted by applicable law, all warranties by
58
- Sprig and Sprig’s liability for any damages arising from the use of the
59
- SDK and/or the Licensee Application.
60
-
61
- 1. **<u>Ownership</u>.** Sprig and its licensors retain all right,
62
- title and interest in the SDK, and in all copies, improvements,
63
- enhancements, modifications and derivative works thereof, including,
64
- without limitation, all patent, copyright, trade secret, trademark
65
- and database rights. The terms of this Agreement are intended to
66
- benefit any third-party licensors, which may directly enforce
67
- applicable terms of this Agreement to protect their interest in the
68
- SDK.
69
-
70
- 2. **<u>Maintenance, Support and Updates</u>.**
71
- Sprig is under no obligation to maintain or
72
- support or update the SDK in any way, or to provide updates or error
73
- corrections. Such services are available under the terms of Sprig’s
74
- standard SDK Support Services Terms and Conditions, a current copy
75
- of which is provided with the SDK. If Sprig provides you with a bug
76
- fix, maintenance release or update to the SDK, it is provided to you
77
- as and shall be considered subject to the terms of this license,
78
- unless you receive a separate license from Sprig for that release or
79
- update that expressly supersedes this Agreement.
80
-
81
- 3. **<u>Confidentiality</u>.** The SDK contains confidential and
82
- proprietary information of Sprig and/or its licensors. You agree to
83
- take adequate steps to protect the SDK from unauthorized disclosure
84
- or use.
85
-
86
- 4. **<u>Warranty</u>**. SPRIG PROVIDES THE SDK “AS IS”AND MAKES NO
87
- WARRANTY OR REPRESENTATION, EITHER EXPRESS OR IMPLIED, WITH RESPECT
88
- TO THE SDK, INCLUDING, WITHOUT LIMITATION, ANY WARRANTY RELATED TO
89
- THE DESIGN OR CONDITION OF THE SDK. AMAZON HEREBY EXPRESSLY
90
- DISCLAIMS ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
91
- PARTICULAR PURPOSE, TITLE, OR NONINFRINGEMENT, AND SHALL HAVE NO
92
- LIABILITY WHATSOEVER TO COMPANY FOR ANY DAMAGES OR CLAIMS RELATING
93
- TO THE SDK.
94
-
95
- 5. **<u>Termination</u>.** This Agreement will terminate immediately
96
- and automatically without notice if you breach any provision in this
97
- Agreement. Upon termination you will remove all copies of the SDK or
98
- any part of the SDK from any and all computer storage devices and
99
- destroy the SDK. At Sprig's request, you will certify in writing to
100
- Sprig that all complete and partial copies of the SDK have been
101
- destroyed and that no copies remain in your possession or under your
102
- control. The provisions of this Agreement, except for the license
103
- grant and warranty, will survive termination.
104
-
105
- 6. **<u>LIMITED</u><u> </u><u>LIABILITY</u>.** UNDER NO CIRCUMSTANCES
106
- WILL SPRIG OR ITS LICENSORS BE LIABLE FOR ANY INCIDENTAL, INDIRECT,
107
- SPECIAL OR CON-SEQUENTIAL DAMAGES, INCLUDING WITHOUT LIMITATION LOSS
108
- OF PROFITS, SAVINGS, BUSINESS, GOODWILL OR DATA, COST OF COVER,
109
- RELIANCE DAMAGES OR ANY OTHER SIMILAR DAMAGES OR LOSS, EVEN IF THE
110
- PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES, AND
111
- NOTWITHSTANDING ANY FAILURE OF ESSENTIAL PURPOSE OF ANY EXCLUSIVE
112
- REMEDY PROVIDED IN THIS AGREEMENT OR THE INVALIDITY OF ANY OTHER
113
- PROVISION. EXCEPT AS LIMITED BY APPLICABLE LAW, SPRIG’S TOTAL
114
- LIABILITY UNDER THIS AGREEMENT OR OTHERWISE SHALL IN NO EVENT EXCEED
115
- $100. IF THE LIMITATIONS ON LIABILITY SET FORTH IN THIS AGREEMENT
116
- ARE NOT ENFORCEABLE UNDER APPLICABLE LAW, THEN SPRIG’S LIABILITY
117
- HEREUNDER SHALL BE LIMITED TO THE MAXIMUM EXTENT PERMITTED UNDER
118
- APPLICABLE LAW.
119
-
120
- 7. **<u>U.S. Government Rights</u>.** The SDK and its documentation
121
- are “commercial computer software”and “commercial computer software
122
- documentation,”respectively, as such terms are used in FAR 12.212
123
- and other relevant government procurement regulations. Any use,
124
- duplication, or disclosure of the Software or its documentation by
125
- or on behalf of the U.S. government is subject to restrictions as
126
- set forth in this Agreement.
127
-
128
- 8. **<u>Export</u><u> </u><u>Law</u><u> </u><u>Assurances</u>**. You
129
- agree to comply fully with all U.S. export laws and regulations to
130
- ensure that neither the SDK nor any technical data related thereto
131
- nor any direct product thereof are exported or re-exported directly
132
- or indirectly in violation of, or used for any purposes prohibited
133
- by, such laws and regulations.
134
-
135
- 9. **<u>Miscellaneous</u>**. You may not assign or transfer this
136
- Agreement, by operation of law or otherwise, without Sprig’s prior
137
- written consent, and any attempt by you to do so, without such
138
- consent, will be void. Subject to the foregoing, this Agreement is
139
- binding upon and will inure to the benefit of each of the parties
140
- and their respective successors and permitted assigns. If any
141
- provision of this Agreement is held invalid, illegal or
142
- unenforceable, that provision will be enforced to the maximum extent
143
- permitted by law, given the fundamental intentions of the parties,
144
- and the remaining provisions of this Agreement will remain in full
145
- force and effect. This Agreement is the complete and exclusive
146
- agreement between the parties with respect to its subject matter and
147
- supersedes all prior or contemporaneous agreements, communications
148
- and understandings, both written and oral, with respect to its
149
- subject matter. This Agreement may be amended or modified only by a
150
- written document executed by duly authorized representatives of the
151
- parties. Nothing in this Agreement will be construed to create a
152
- partnership, joint venture or agency relationship between the
153
- parties. Neither party will have the power to bind the other or to
154
- incur obligations on the other’s behalf without such other party’s
155
- prior written consent. Except as expressly set forth in this
156
- Agreement, the exercise by either party of any remedy under this
157
- Agreement will be without prejudice to its other remedies under this
158
- Agreement or otherwise. Either party’s failure to enforce any
159
- provision of this Agreement will not constitute a waiver of future
160
- enforcement of that or any other provision. No waiver of any
161
- provision of this Agreement will be effective unless it is in
162
- writing and signed by the party granting the waiver. This Agreement
163
- will be governed by and construed in accordance with the laws of the
164
- State of California without giving effect to any principles of
165
- conflict of laws that would lead to the application of the laws of
166
- another jurisdiction. The parties expressly agree that the United
167
- Nations Convention on Contracts for the International Sale of Goods
168
- will not apply. Any legal action or proceeding arising under this
169
- Agreement will be brought exclusively in the federal or state courts
170
- located in the Northern District of California and the parties
171
- irrevocably consent to the personal jurisdiction and venue therein.
172
- All notices required to be sent hereunder will be in writing and
173
- will be deemed to have been given when mailed by certified mail,
174
- overnight express, or sent by email, with receipt confirmed. This
175
- Agreement may be signed in counterparts, and electronic signatures
176
- will have the same weight and effect as originals.
9
+ Unless required by applicable law or agreed to in writing, software
10
+ distributed under the License is distributed on an "AS IS" BASIS,
11
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ See the License for the specific language governing permissions and
13
+ limitations under the License.
package/dist/index.cjs CHANGED
@@ -1,5 +1,5 @@
1
1
  "use strict";var Cc=Object.defineProperty;var Ic=(e,t,n)=>t in e?Cc(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var fe=(e,t,n)=>(Ic(e,typeof t!="symbol"?t+"":t,n),n);Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});var Ke=(e=>(e.Closed="close.click",e.Complete="survey.completed",e.PageChange="page.change",e.API="api",e.Override="override",e))(Ke||{}),B=(e=>(e.SDKReady="sdk.ready",e.SurveyAppeared="survey.appeared",e.SurveyClosed="survey.closed",e.SurveyDimensions="survey.dimensions",e.SurveyFadingOut="survey.fadingOut",e.SurveyHeight="survey.height",e.SurveyPresented="survey.presented",e.SurveyLifeCycle="survey.lifeCycle",e.SurveyWillClose="survey.willClose",e.SurveyWillPresent="survey.will.present",e.CloseSurveyOnOverlayClick="close.survey.overlayClick",e.VisitorIDUpdated="visitor.id.updated",e.QuestionAnswered="question.answered",e))(B||{}),Os=(e=>(e.SurveyId="survey.id",e))(Os||{});const ho={SDK_READY:"sdk.ready",SURVEY_APPEARED:"survey.appeared",SURVEY_CLOSED:"survey.closed",SURVEY_DIMENSIONS:"survey.dimensions",SURVEY_FADING_OUT:"survey.fadingOut",SURVEY_HEIGHT:"survey.height",SURVEY_PRESENTED:"survey.presented",SURVEY_LIFE_CYCLE:"survey.lifeCycle",SURVEY_WILL_CLOSE:"survey.willClose",SURVEY_WILL_PRESENT:"survey.will.present",QUESTION_ANSWERED:"question.answered",CLOSE_SURVEY_ON_OVERLAY_CLICK:"close.survey.overlayClick",VISITOR_ID_UPDATED:"visitor.id.updated",DATA:{DISMISS_REASONS:{API:"api",CLOSED:"close.click",COMPLETE:"survey.completed",PAGE_CHANGE:"page.change",OVERRIDE:"override"},SURVEY_ID:"survey.id"}};var Re=(e=>(e.VerifyViewVersion="verify.view.version",e.CurrentQuestion="survey.question",e.ViewPrototypeClick="question.prototype.click",e.ViewAgreementClick="question.agreement.click",e.RecordedTaskStart="recorded.task.start",e.RecordedTaskPermissionScreen="recorded.task.permission.screen",e.SurveyComplete="survey.complete",e))(Re||{}),Lt=(e=>(e.ViewVersion="view.version",e.QuestionId="qid",e.Props="props",e))(Lt||{}),X=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function kc(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function Tc(e){var t=e.default;if(typeof t=="function"){var n=function(){return t.apply(this,arguments)};n.prototype=t.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(e).forEach(function(r){var i=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(n,r,i.get?i:{enumerable:!0,get:function(){return e[r]}})}),n}var le={},jt={};Object.defineProperty(jt,"__esModule",{value:!0});var vo=function(){function e(){}return e.prototype.handleError=function(t){},e}();jt.NoopErrorHandler=vo;var mo=new vo;function Lc(e){mo=e}jt.setErrorHandler=Lc;function Rc(){return mo}jt.getErrorHandler=Rc;function Ac(){mo=new vo}jt.resetErrorHandler=Ac;var go={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),function(t){t[t.NOTSET=0]="NOTSET",t[t.DEBUG=1]="DEBUG",t[t.INFO=2]="INFO",t[t.WARNING=3]="WARNING",t[t.ERROR=4]="ERROR"}(e.LogLevel||(e.LogLevel={}))})(go);var bt={},ln={},wr={exports:{}},la=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||typeof msCrypto<"u"&&typeof window.msCrypto.getRandomValues=="function"&&msCrypto.getRandomValues.bind(msCrypto);if(la){var ua=new Uint8Array(16);wr.exports=function(){return la(ua),ua}}else{var ca=new Array(16);wr.exports=function(){for(var t=0,n;t<16;t++)(t&3)===0&&(n=Math.random()*4294967296),ca[t]=n>>>((t&3)<<3)&255;return ca}}var Ds=[];for(var Qn=0;Qn<256;++Qn)Ds[Qn]=(Qn+256).toString(16).substr(1);function Uc(e,t){var n=t||0,r=Ds;return[r[e[n++]],r[e[n++]],r[e[n++]],r[e[n++]],"-",r[e[n++]],r[e[n++]],"-",r[e[n++]],r[e[n++]],"-",r[e[n++]],r[e[n++]],"-",r[e[n++]],r[e[n++]],r[e[n++]],r[e[n++]],r[e[n++]],r[e[n++]]].join("")}var Ps=Uc,Oc=wr.exports,Dc=Ps,da,Xr,Jr=0,ei=0;function Pc(e,t,n){var r=t&&n||0,i=t||[];e=e||{};var o=e.node||da,a=e.clockseq!==void 0?e.clockseq:Xr;if(o==null||a==null){var s=Oc();o==null&&(o=da=[s[0]|1,s[1],s[2],s[3],s[4],s[5]]),a==null&&(a=Xr=(s[6]<<8|s[7])&16383)}var l=e.msecs!==void 0?e.msecs:new Date().getTime(),u=e.nsecs!==void 0?e.nsecs:ei+1,c=l-Jr+(u-ei)/1e4;if(c<0&&e.clockseq===void 0&&(a=a+1&16383),(c<0||l>Jr)&&e.nsecs===void 0&&(u=0),u>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");Jr=l,ei=u,Xr=a,l+=122192928e5;var d=((l&268435455)*1e4+u)%4294967296;i[r++]=d>>>24&255,i[r++]=d>>>16&255,i[r++]=d>>>8&255,i[r++]=d&255;var f=l/4294967296*1e4&268435455;i[r++]=f>>>8&255,i[r++]=f&255,i[r++]=f>>>24&15|16,i[r++]=f>>>16&255,i[r++]=a>>>8|128,i[r++]=a&255;for(var p=0;p<6;++p)i[r+p]=o[p];return t||Dc(i)}var Nc=Pc,Vc=wr.exports,Mc=Ps;function jc(e,t,n){var r=t&&n||0;typeof e=="string"&&(t=e==="binary"?new Array(16):null,e=null),e=e||{};var i=e.random||(e.rng||Vc)();if(i[6]=i[6]&15|64,i[8]=i[8]&63|128,t)for(var o=0;o<16;++o)t[r+o]=i[o];return t||Mc(i)}var Bc=jc,Fc=Nc,Ns=Bc,yo=Ns;yo.v1=Fc;yo.v4=Ns;var Hc=yo;(function(e){Object.defineProperty(e,"__esModule",{value:!0});var t=Hc;function n(){return t.v4()}e.generateUUID=n;function r(){return new Date().getTime()}e.getTimestamp=r;function i(d,f){for(var p=!1,h=Object.keys(d),v=0;v<h.length;v++)if(f===d[h[v]]){p=!0;break}return p}e.isValidEnum=i;function o(d,f){var p={};return d.forEach(function(h){var v=f(h);p[v]=p[v]||[],p[v].push(h)}),a(p)}e.groupBy=o;function a(d){return Object.keys(d).map(function(f){return d[f]})}e.objectValues=a;function s(d){return Object.keys(d).map(function(f){return[f,d[f]]})}e.objectEntries=s;function l(d,f){for(var p,h=0,v=d;h<v.length;h++){var g=v[h];if(f(g)){p=g;break}}return p}e.find=l;function u(d,f){var p={};return d.forEach(function(h){var v=f(h);p[v]=h}),p}e.keyBy=u;function c(d){for(var f=[],p=1;p<arguments.length;p++)f[p-1]=arguments[p];var h=0;return d.replace(/%s/g,function(){var v=f[h++],g=typeof v;return g==="function"?v():g==="string"?v:String(v)})}e.sprintf=c,function(d){d.ACTIVATE="ACTIVATE:experiment, user_id,attributes, variation, event",d.DECISION="DECISION:type, userId, attributes, decisionInfo",d.LOG_EVENT="LOG_EVENT:logEvent",d.OPTIMIZELY_CONFIG_UPDATE="OPTIMIZELY_CONFIG_UPDATE",d.TRACK="TRACK:event_key, user_id, attributes, event_tags, event"}(e.NOTIFICATION_TYPES||(e.NOTIFICATION_TYPES={}))})(ln);var Kc=X&&X.__spreadArrays||function(){for(var e=0,t=0,n=arguments.length;t<n;t++)e+=arguments[t].length;for(var r=Array(e),i=0,t=0;t<n;t++)for(var o=arguments[t],a=0,s=o.length;a<s;a++,i++)r[i]=o[a];return r};Object.defineProperty(bt,"__esModule",{value:!0});var $c=jt,br=ln,ne=go,fa={NOTSET:0,DEBUG:1,INFO:2,WARNING:3,ERROR:4};function _o(e){return typeof e!="string"||(e=e.toUpperCase(),e==="WARN"&&(e="WARNING"),!fa[e])?e:fa[e]}var Vs=function(){function e(){this.defaultLoggerFacade=new pa,this.loggers={}}return e.prototype.getLogger=function(t){return t?(this.loggers[t]||(this.loggers[t]=new pa({messagePrefix:t})),this.loggers[t]):this.defaultLoggerFacade},e}(),qc=function(){function e(t){t===void 0&&(t={}),this.logLevel=ne.LogLevel.NOTSET,t.logLevel!==void 0&&br.isValidEnum(ne.LogLevel,t.logLevel)&&this.setLogLevel(t.logLevel),this.logToConsole=t.logToConsole!==void 0?!!t.logToConsole:!0,this.prefix=t.prefix!==void 0?t.prefix:"[OPTIMIZELY]"}return e.prototype.log=function(t,n){if(!(!this.shouldLog(t)||!this.logToConsole)){var r=this.prefix+" - "+this.getLogLevelName(t)+" "+this.getTime()+" "+n;this.consoleLog(t,[r])}},e.prototype.setLogLevel=function(t){t=_o(t),!br.isValidEnum(ne.LogLevel,t)||t===void 0?this.logLevel=ne.LogLevel.ERROR:this.logLevel=t},e.prototype.getTime=function(){return new Date().toISOString()},e.prototype.shouldLog=function(t){return t>=this.logLevel},e.prototype.getLogLevelName=function(t){switch(t){case ne.LogLevel.DEBUG:return"DEBUG";case ne.LogLevel.INFO:return"INFO ";case ne.LogLevel.WARNING:return"WARN ";case ne.LogLevel.ERROR:return"ERROR";default:return"NOTSET"}},e.prototype.consoleLog=function(t,n){switch(t){case ne.LogLevel.DEBUG:console.log.apply(console,n);break;case ne.LogLevel.INFO:console.info.apply(console,n);break;case ne.LogLevel.WARNING:console.warn.apply(console,n);break;case ne.LogLevel.ERROR:console.error.apply(console,n);break;default:console.log.apply(console,n)}},e}();bt.ConsoleLogHandler=qc;var Ln=ne.LogLevel.NOTSET,xi=null,pa=function(){function e(t){t===void 0&&(t={}),this.messagePrefix="",t.messagePrefix&&(this.messagePrefix=t.messagePrefix)}return e.prototype.log=function(t,n){for(var r=[],i=2;i<arguments.length;i++)r[i-2]=arguments[i];this.internalLog(_o(t),{message:n,splat:r})},e.prototype.info=function(t){for(var n=[],r=1;r<arguments.length;r++)n[r-1]=arguments[r];this.namedLog(ne.LogLevel.INFO,t,n)},e.prototype.debug=function(t){for(var n=[],r=1;r<arguments.length;r++)n[r-1]=arguments[r];this.namedLog(ne.LogLevel.DEBUG,t,n)},e.prototype.warn=function(t){for(var n=[],r=1;r<arguments.length;r++)n[r-1]=arguments[r];this.namedLog(ne.LogLevel.WARNING,t,n)},e.prototype.error=function(t){for(var n=[],r=1;r<arguments.length;r++)n[r-1]=arguments[r];this.namedLog(ne.LogLevel.ERROR,t,n)},e.prototype.format=function(t){return(this.messagePrefix?this.messagePrefix+": ":"")+br.sprintf.apply(void 0,Kc([t.message],t.splat))},e.prototype.internalLog=function(t,n){!xi||t<Ln||(xi.log(t,this.format(n)),n.error&&n.error instanceof Error&&$c.getErrorHandler().handleError(n.error))},e.prototype.namedLog=function(t,n,r){var i;if(n instanceof Error){i=n,n=i.message,this.internalLog(t,{error:i,message:n,splat:r});return}if(r.length===0){this.internalLog(t,{message:n,splat:r});return}var o=r[r.length-1];o instanceof Error&&(i=o,r.splice(-1)),this.internalLog(t,{message:n,error:i,splat:r})},e}(),Ms=new Vs;function Gc(e){return Ms.getLogger(e)}bt.getLogger=Gc;function zc(e){xi=e}bt.setLogHandler=zc;function Wc(e){e=_o(e),!br.isValidEnum(ne.LogLevel,e)||e===void 0?Ln=ne.LogLevel.ERROR:Ln=e}bt.setLogLevel=Wc;function Yc(){return Ln}bt.getLogLevel=Yc;function Qc(){Ms=new Vs,Ln=ne.LogLevel.NOTSET}bt.resetLogger=Qc;(function(e){function t(n){for(var r in n)e.hasOwnProperty(r)||(e[r]=n[r])}Object.defineProperty(e,"__esModule",{value:!0}),t(jt),t(go),t(bt)})(le);var Zc={},jn={};Object.defineProperty(jn,"__esModule",{value:!0});jn.areEventContextsEqual=void 0;function Xc(e,t){var n=e.context,r=t.context;return n.accountId===r.accountId&&n.projectId===r.projectId&&n.clientName===r.clientName&&n.clientVersion===r.clientVersion&&n.revision===r.revision&&n.anonymizeIP===r.anonymizeIP&&n.botFiltering===r.botFiltering}jn.areEventContextsEqual=Xc;var wo={},Zt={};Object.defineProperty(Zt,"__esModule",{value:!0});Zt.DefaultEventQueue=Zt.SingleEventQueue=void 0;var Jc=le,ed=Jc.getLogger("EventProcessor"),td=function(){function e(t){var n=t.timeout,r=t.callback;this.timeout=Math.max(n,0),this.callback=r}return e.prototype.start=function(){this.timeoutId=setTimeout(this.callback,this.timeout)},e.prototype.refresh=function(){this.stop(),this.start()},e.prototype.stop=function(){this.timeoutId&&clearTimeout(this.timeoutId)},e}(),nd=function(){function e(t){var n=t.sink;this.sink=n}return e.prototype.start=function(){},e.prototype.stop=function(){return Promise.resolve()},e.prototype.enqueue=function(t){this.sink([t])},e}();Zt.SingleEventQueue=nd;var rd=function(){function e(t){var n=t.flushInterval,r=t.maxQueueSize,i=t.sink,o=t.batchComparator;this.buffer=[],this.maxQueueSize=Math.max(r,1),this.sink=i,this.batchComparator=o,this.timer=new td({callback:this.flush.bind(this),timeout:n}),this.started=!1}return e.prototype.start=function(){this.started=!0},e.prototype.stop=function(){this.started=!1;var t=this.sink(this.buffer);return this.buffer=[],this.timer.stop(),t},e.prototype.enqueue=function(t){if(!this.started){ed.warn("Queue is stopped, not accepting event");return}var n=this.buffer[0];n&&!this.batchComparator(n,t)&&this.flush(),this.buffer.length===0&&this.timer.refresh(),this.buffer.push(t),this.buffer.length>=this.maxQueueSize&&this.flush()},e.prototype.flush=function(){this.sink(this.buffer),this.buffer=[],this.timer.stop()},e}();Zt.DefaultEventQueue=rd;(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.sendEventNotification=e.getQueue=e.validateAndGetBatchSize=e.validateAndGetFlushInterval=e.DEFAULT_BATCH_SIZE=e.DEFAULT_FLUSH_INTERVAL=void 0;var t=Zt,n=le,r=ln;e.DEFAULT_FLUSH_INTERVAL=3e4,e.DEFAULT_BATCH_SIZE=10;var i=n.getLogger("EventProcessor");function o(u){return u<=0&&(i.warn("Invalid flushInterval "+u+", defaulting to "+e.DEFAULT_FLUSH_INTERVAL),u=e.DEFAULT_FLUSH_INTERVAL),u}e.validateAndGetFlushInterval=o;function a(u){return u=Math.floor(u),u<1&&(i.warn("Invalid batchSize "+u+", defaulting to "+e.DEFAULT_BATCH_SIZE),u=e.DEFAULT_BATCH_SIZE),u=Math.max(1,u),u}e.validateAndGetBatchSize=a;function s(u,c,d,f){var p;return u>1?p=new t.DefaultEventQueue({flushInterval:c,maxQueueSize:u,sink:d,batchComparator:f}):p=new t.SingleEventQueue({sink:d}),p}e.getQueue=s;function l(u,c){u&&u.sendNotifications(r.NOTIFICATION_TYPES.LOG_EVENT,c)}e.sendEventNotification=l})(wo);var js={};Object.defineProperty(js,"__esModule",{value:!0});var Bs={};Object.defineProperty(Bs,"__esModule",{value:!0});var Xt={},Fr={};Object.defineProperty(Fr,"__esModule",{value:!0});Fr.LocalStorageStore=void 0;var id=ln,od=le,ha=od.getLogger("EventProcessor"),ad=function(){function e(t){var n=t.key,r=t.maxValues,i=r===void 0?1e3:r;this.LS_KEY=n,this.maxValues=i}return e.prototype.get=function(t){return this.getMap()[t]||null},e.prototype.set=function(t,n){var r=this.getMap();r[t]=n,this.replace(r)},e.prototype.remove=function(t){var n=this.getMap();delete n[t],this.replace(n)},e.prototype.values=function(){return id.objectValues(this.getMap())},e.prototype.clear=function(){this.replace({})},e.prototype.replace=function(t){try{window.localStorage&&localStorage.setItem(this.LS_KEY,JSON.stringify(t)),this.clean()}catch(n){ha.error(n)}},e.prototype.clean=function(){var t=this.getMap(),n=Object.keys(t),r=n.length-this.maxValues;if(!(r<1)){var i=n.map(function(a){return{key:a,value:t[a]}});i.sort(function(a,s){return a.value.timestamp-s.value.timestamp});for(var o=0;o<r;o++)delete t[i[o].key];this.replace(t)}},e.prototype.getMap=function(){try{var t=window.localStorage&&localStorage.getItem(this.LS_KEY);if(t)return JSON.parse(t)||{}}catch(n){ha.error(n)}return{}},e}();Fr.LocalStorageStore=ad;var sd=X&&X.__extends||function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,i){r.__proto__=i}||function(r,i){for(var o in i)Object.prototype.hasOwnProperty.call(i,o)&&(r[o]=i[o])},e(t,n)};return function(t,n){e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}();Object.defineProperty(Xt,"__esModule",{value:!0});Xt.LocalStoragePendingEventsDispatcher=Xt.PendingEventsDispatcher=void 0;var ld=le,ud=Fr,va=ln,cd=ld.getLogger("EventProcessor"),Fs=function(){function e(t){var n=t.eventDispatcher,r=t.store;this.dispatcher=n,this.store=r}return e.prototype.dispatchEvent=function(t,n){this.send({uuid:va.generateUUID(),timestamp:va.getTimestamp(),request:t},n)},e.prototype.sendPendingEvents=function(){var t=this,n=this.store.values();cd.debug("Sending %s pending events from previous page",n.length),n.forEach(function(r){try{t.send(r,function(){})}catch{}})},e.prototype.send=function(t,n){var r=this;this.store.set(t.uuid,t),this.dispatcher.dispatchEvent(t.request,function(i){r.store.remove(t.uuid),n(i)})},e}();Xt.PendingEventsDispatcher=Fs;var dd=function(e){sd(t,e);function t(n){var r=n.eventDispatcher;return e.call(this,{eventDispatcher:r,store:new ud.LocalStorageStore({maxValues:100,key:"fs_optly_pending_events"})})||this}return t}(Fs);Xt.LocalStoragePendingEventsDispatcher=dd;var Pe={},Si=X&&X.__assign||function(){return Si=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++){t=arguments[n];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])}return e},Si.apply(this,arguments)};Object.defineProperty(Pe,"__esModule",{value:!0});Pe.formatEvents=Pe.buildConversionEventV1=Pe.buildImpressionEventV1=Pe.makeBatchedEventV1=void 0;var fd="campaign_activated",pd="custom",ma="$opt_bot_filtering";function Hs(e){var t=[],n=e[0];return e.forEach(function(r){if(r.type==="conversion"||r.type==="impression"){var i=bo(r);r.type==="impression"?i.snapshots.push($s(r)):r.type==="conversion"&&i.snapshots.push(Ks(r)),t.push(i)}}),{client_name:n.context.clientName,client_version:n.context.clientVersion,account_id:n.context.accountId,project_id:n.context.projectId,revision:n.context.revision,anonymize_ip:n.context.anonymizeIP,enrich_decisions:!0,visitors:t}}Pe.makeBatchedEventV1=Hs;function Ks(e){var t=Si({},e.tags);delete t.revenue,delete t.value;var n={entity_id:e.event.id,key:e.event.key,timestamp:e.timestamp,uuid:e.uuid};return e.tags&&(n.tags=e.tags),e.value!=null&&(n.value=e.value),e.revenue!=null&&(n.revenue=e.revenue),{events:[n]}}function $s(e){var t,n,r=e.layer,i=e.experiment,o=e.variation,a=e.ruleKey,s=e.flagKey,l=e.ruleType,u=e.enabled,c=r?r.id:null,d=(t=i==null?void 0:i.id)!==null&&t!==void 0?t:"",f=(n=o==null?void 0:o.id)!==null&&n!==void 0?n:"",p=o?o.key:"";return{decisions:[{campaign_id:c,experiment_id:d,variation_id:f,metadata:{flag_key:s,rule_key:a,rule_type:l,variation_key:p,enabled:u}}],events:[{entity_id:c,timestamp:e.timestamp,key:fd,uuid:e.uuid}]}}function bo(e){var t={snapshots:[],visitor_id:e.user.id,attributes:[]};return e.user.attributes.forEach(function(n){t.attributes.push({entity_id:n.entityId,key:n.key,type:"custom",value:n.value})}),typeof e.context.botFiltering=="boolean"&&t.attributes.push({entity_id:ma,key:ma,type:pd,value:e.context.botFiltering}),t}function hd(e){var t=bo(e);return t.snapshots.push($s(e)),{client_name:e.context.clientName,client_version:e.context.clientVersion,account_id:e.context.accountId,project_id:e.context.projectId,revision:e.context.revision,anonymize_ip:e.context.anonymizeIP,enrich_decisions:!0,visitors:[t]}}Pe.buildImpressionEventV1=hd;function vd(e){var t=bo(e);return t.snapshots.push(Ks(e)),{client_name:e.context.clientName,client_version:e.context.clientVersion,account_id:e.context.accountId,project_id:e.context.projectId,revision:e.context.revision,anonymize_ip:e.context.anonymizeIP,enrich_decisions:!0,visitors:[t]}}Pe.buildConversionEventV1=vd;function md(e){return{url:"https://logx.optimizely.com/v1/events",httpVerb:"POST",params:Hs(e)}}Pe.formatEvents=md;var Hr={},Eo={};Object.defineProperty(Eo,"__esModule",{value:!0});var gd=function(){function e(){this.reqsInFlightCount=0,this.reqsCompleteResolvers=[]}return e.prototype.trackRequest=function(t){var n=this;this.reqsInFlightCount++;var r=function(){n.reqsInFlightCount--,n.reqsInFlightCount===0&&(n.reqsCompleteResolvers.forEach(function(i){return i()}),n.reqsCompleteResolvers=[])};t.then(r,r)},e.prototype.onRequestsComplete=function(){var t=this;return new Promise(function(n){t.reqsInFlightCount===0?n():t.reqsCompleteResolvers.push(n)})},e}();Eo.default=gd;var yd=X&&X.__awaiter||function(e,t,n,r){function i(o){return o instanceof n?o:new n(function(a){a(o)})}return new(n||(n=Promise))(function(o,a){function s(c){try{u(r.next(c))}catch(d){a(d)}}function l(c){try{u(r.throw(c))}catch(d){a(d)}}function u(c){c.done?o(c.value):i(c.value).then(s,l)}u((r=r.apply(e,t||[])).next())})},_d=X&&X.__generator||function(e,t){var n={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},r,i,o,a;return a={next:s(0),throw:s(1),return:s(2)},typeof Symbol=="function"&&(a[Symbol.iterator]=function(){return this}),a;function s(u){return function(c){return l([u,c])}}function l(u){if(r)throw new TypeError("Generator is already executing.");for(;n;)try{if(r=1,i&&(o=u[0]&2?i.return:u[0]?i.throw||((o=i.return)&&o.call(i),0):i.next)&&!(o=o.call(i,u[1])).done)return o;switch(i=0,o&&(u=[u[0]&2,o.value]),u[0]){case 0:case 1:o=u;break;case 4:return n.label++,{value:u[1],done:!1};case 5:n.label++,i=u[1],u=[0];continue;case 7:u=n.ops.pop(),n.trys.pop();continue;default:if(o=n.trys,!(o=o.length>0&&o[o.length-1])&&(u[0]===6||u[0]===2)){n=0;continue}if(u[0]===3&&(!o||u[1]>o[0]&&u[1]<o[3])){n.label=u[1];break}if(u[0]===6&&n.label<o[1]){n.label=o[1],o=u;break}if(o&&n.label<o[2]){n.label=o[2],n.ops.push(u);break}o[2]&&n.ops.pop(),n.trys.pop();continue}u=t.call(e,n)}catch(c){u=[6,c],i=0}finally{r=o=0}if(u[0]&5)throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}},wd=X&&X.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Hr,"__esModule",{value:!0});Hr.LogTierV1EventProcessor=void 0;var bd=le,Ht=wo,Ed=wd(Eo),xd=jn,Sd=Pe,ga=bd.getLogger("LogTierV1EventProcessor"),Cd=function(){function e(t){var n=t.dispatcher,r=t.flushInterval,i=r===void 0?Ht.DEFAULT_FLUSH_INTERVAL:r,o=t.batchSize,a=o===void 0?Ht.DEFAULT_BATCH_SIZE:o,s=t.notificationCenter;this.dispatcher=n,this.notificationCenter=s,this.requestTracker=new Ed.default,i=Ht.validateAndGetFlushInterval(i),a=Ht.validateAndGetBatchSize(a),this.queue=Ht.getQueue(a,i,this.drainQueue.bind(this),xd.areEventContextsEqual)}return e.prototype.drainQueue=function(t){var n=this,r=new Promise(function(i){if(ga.debug("draining queue with %s events",t.length),t.length===0){i();return}var o=Sd.formatEvents(t);n.dispatcher.dispatchEvent(o,function(){i()}),Ht.sendEventNotification(n.notificationCenter,o)});return this.requestTracker.trackRequest(r),r},e.prototype.process=function(t){this.queue.enqueue(t)},e.prototype.stop=function(){try{return this.queue.stop(),this.requestTracker.onRequestsComplete()}catch(t){ga.error('Error stopping EventProcessor: "%s"',t.message,t)}return Promise.resolve()},e.prototype.start=function(){return yd(this,void 0,void 0,function(){return _d(this,function(t){return this.queue.start(),[2]})})},e}();Hr.LogTierV1EventProcessor=Cd;(function(e){var t=X&&X.__createBinding||(Object.create?function(r,i,o,a){a===void 0&&(a=o),Object.defineProperty(r,a,{enumerable:!0,get:function(){return i[o]}})}:function(r,i,o,a){a===void 0&&(a=o),r[a]=i[o]}),n=X&&X.__exportStar||function(r,i){for(var o in r)o!=="default"&&!Object.prototype.hasOwnProperty.call(i,o)&&t(i,r,o)};Object.defineProperty(e,"__esModule",{value:!0}),n(jn,e),n(wo,e),n(js,e),n(Bs,e),n(Xt,e),n(Pe,e),n(Hr,e)})(Zc);var Er={exports:{}},ya=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||typeof msCrypto<"u"&&typeof window.msCrypto.getRandomValues=="function"&&msCrypto.getRandomValues.bind(msCrypto);if(ya){var _a=new Uint8Array(16);Er.exports=function(){return ya(_a),_a}}else{var wa=new Array(16);Er.exports=function(){for(var t=0,n;t<16;t++)(t&3)===0&&(n=Math.random()*4294967296),wa[t]=n>>>((t&3)<<3)&255;return wa}}var qs=[];for(var Zn=0;Zn<256;++Zn)qs[Zn]=(Zn+256).toString(16).substr(1);function Id(e,t){var n=t||0,r=qs;return[r[e[n++]],r[e[n++]],r[e[n++]],r[e[n++]],"-",r[e[n++]],r[e[n++]],"-",r[e[n++]],r[e[n++]],"-",r[e[n++]],r[e[n++]],"-",r[e[n++]],r[e[n++]],r[e[n++]],r[e[n++]],r[e[n++]],r[e[n++]]].join("")}var Gs=Id,kd=Er.exports,Td=Gs,ba,ti,ni=0,ri=0;function Ld(e,t,n){var r=t&&n||0,i=t||[];e=e||{};var o=e.node||ba,a=e.clockseq!==void 0?e.clockseq:ti;if(o==null||a==null){var s=kd();o==null&&(o=ba=[s[0]|1,s[1],s[2],s[3],s[4],s[5]]),a==null&&(a=ti=(s[6]<<8|s[7])&16383)}var l=e.msecs!==void 0?e.msecs:new Date().getTime(),u=e.nsecs!==void 0?e.nsecs:ri+1,c=l-ni+(u-ri)/1e4;if(c<0&&e.clockseq===void 0&&(a=a+1&16383),(c<0||l>ni)&&e.nsecs===void 0&&(u=0),u>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");ni=l,ri=u,ti=a,l+=122192928e5;var d=((l&268435455)*1e4+u)%4294967296;i[r++]=d>>>24&255,i[r++]=d>>>16&255,i[r++]=d>>>8&255,i[r++]=d&255;var f=l/4294967296*1e4&268435455;i[r++]=f>>>8&255,i[r++]=f&255,i[r++]=f>>>24&15|16,i[r++]=f>>>16&255,i[r++]=a>>>8|128,i[r++]=a&255;for(var p=0;p<6;++p)i[r+p]=o[p];return t||Td(i)}var Rd=Ld,Ad=Er.exports,Ud=Gs;function Od(e,t,n){var r=t&&n||0;typeof e=="string"&&(t=e==="binary"?new Array(16):null,e=null),e=e||{};var i=e.random||(e.rng||Ad)();if(i[6]=i[6]&15|64,i[8]=i[8]&63|128,t)for(var o=0;o<16;++o)t[r+o]=i[o];return t||Ud(i)}var Dd=Od,Pd=Rd,zs=Dd,Ws=zs;Ws.v1=Pd;Ws.v4=zs;var Nd={exports:{}};(function(e){(function(){function t(i,o){for(var a=i.length,s=o^a,l=0,u;a>=4;)u=i.charCodeAt(l)&255|(i.charCodeAt(++l)&255)<<8|(i.charCodeAt(++l)&255)<<16|(i.charCodeAt(++l)&255)<<24,u=(u&65535)*1540483477+(((u>>>16)*1540483477&65535)<<16),u^=u>>>24,u=(u&65535)*1540483477+(((u>>>16)*1540483477&65535)<<16),s=(s&65535)*1540483477+(((s>>>16)*1540483477&65535)<<16)^u,a-=4,++l;switch(a){case 3:s^=(i.charCodeAt(l+2)&255)<<16;case 2:s^=(i.charCodeAt(l+1)&255)<<8;case 1:s^=i.charCodeAt(l)&255,s=(s&65535)*1540483477+(((s>>>16)*1540483477&65535)<<16)}return s^=s>>>13,s=(s&65535)*1540483477+(((s>>>16)*1540483477&65535)<<16),s^=s>>>15,s>>>0}function n(i,o){var a,s,l,u,c,d,f,p;for(a=i.length&3,s=i.length-a,l=o,c=3432918353,d=461845907,p=0;p<s;)f=i.charCodeAt(p)&255|(i.charCodeAt(++p)&255)<<8|(i.charCodeAt(++p)&255)<<16|(i.charCodeAt(++p)&255)<<24,++p,f=(f&65535)*c+(((f>>>16)*c&65535)<<16)&4294967295,f=f<<15|f>>>17,f=(f&65535)*d+(((f>>>16)*d&65535)<<16)&4294967295,l^=f,l=l<<13|l>>>19,u=(l&65535)*5+(((l>>>16)*5&65535)<<16)&4294967295,l=(u&65535)+27492+(((u>>>16)+58964&65535)<<16);switch(f=0,a){case 3:f^=(i.charCodeAt(p+2)&255)<<16;case 2:f^=(i.charCodeAt(p+1)&255)<<8;case 1:f^=i.charCodeAt(p)&255,f=(f&65535)*c+(((f>>>16)*c&65535)<<16)&4294967295,f=f<<15|f>>>17,f=(f&65535)*d+(((f>>>16)*d&65535)<<16)&4294967295,l^=f}return l^=i.length,l^=l>>>16,l=(l&65535)*2246822507+(((l>>>16)*2246822507&65535)<<16)&4294967295,l^=l>>>13,l=(l&65535)*3266489909+(((l>>>16)*3266489909&65535)<<16)&4294967295,l^=l>>>16,l>>>0}var r=n;r.v2=t,r.v3=n,e.exports=r})()})(Nd);var Ys={},xo={},So={},qe={};Object.defineProperty(qe,"__esModule",{value:!0});qe.DEFAULT_UPDATE_INTERVAL=5*60*1e3;qe.MIN_UPDATE_INTERVAL=1e3;qe.DEFAULT_URL_TEMPLATE="https://cdn.optimizely.com/datafiles/%s.json";qe.DEFAULT_AUTHENTICATED_URL_TEMPLATE="https://config.optimizely.com/datafiles/auth/%s.json";qe.BACKOFF_BASE_WAIT_SECONDS_BY_ERROR_COUNT=[0,8,16,32,64,128,256,512];qe.REQUEST_TIMEOUT_MS=60*1e3;Object.defineProperty(So,"__esModule",{value:!0});var Vd=qe,Md=le,jd=Md.getLogger("DatafileManager"),Bd="GET",Fd=4;function Hd(e){var t=e.getAllResponseHeaders();if(t===null)return{};var n=t.split(`\r
2
- `),r={};return n.forEach(function(i){var o=i.indexOf(": ");if(o>-1){var a=i.slice(0,o),s=i.slice(o+2);s.length>0&&(r[a]=s)}}),r}function Kd(e,t){Object.keys(e).forEach(function(n){var r=e[n];t.setRequestHeader(n,r)})}function $d(e,t){var n=new XMLHttpRequest,r=new Promise(function(i,o){n.open(Bd,e,!0),Kd(t,n),n.onreadystatechange=function(){if(n.readyState===Fd){var a=n.status;if(a===0){o(new Error("Request error"));return}var s=Hd(n),l={statusCode:n.status,body:n.responseText,headers:s};i(l)}},n.timeout=Vd.REQUEST_TIMEOUT_MS,n.ontimeout=function(){jd.error("Request timed out")},n.send()});return{responsePromise:r,abort:function(){n.abort()}}}So.makeGetRequest=$d;var Co={},Io={};Object.defineProperty(Io,"__esModule",{value:!0});var qd=function(){function e(){this.listeners={},this.listenerId=1}return e.prototype.on=function(t,n){var r=this;this.listeners[t]||(this.listeners[t]={});var i=String(this.listenerId);return this.listenerId++,this.listeners[t][i]=n,function(){r.listeners[t]&&delete r.listeners[t][i]}},e.prototype.emit=function(t,n){var r=this.listeners[t];r&&Object.keys(r).forEach(function(i){var o=r[i];o(n)})},e.prototype.removeAllListeners=function(){this.listeners={}},e}();Io.default=qd;var ko={};Object.defineProperty(ko,"__esModule",{value:!0});var ii=qe;function Gd(){return Math.round(Math.random()*1e3)}var zd=function(){function e(){this.errorCount=0}return e.prototype.getDelay=function(){if(this.errorCount===0)return 0;var t=ii.BACKOFF_BASE_WAIT_SECONDS_BY_ERROR_COUNT[Math.min(ii.BACKOFF_BASE_WAIT_SECONDS_BY_ERROR_COUNT.length-1,this.errorCount)];return t*1e3+Gd()},e.prototype.countError=function(){this.errorCount<ii.BACKOFF_BASE_WAIT_SECONDS_BY_ERROR_COUNT.length-1&&this.errorCount++},e.prototype.reset=function(){this.errorCount=0},e}();ko.default=zd;var xr=X&&X.__assign||function(){return xr=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++){t=arguments[n];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])}return e},xr.apply(this,arguments)},Qs=X&&X.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Co,"__esModule",{value:!0});var Wd=le,Yd=ln,Qd=Qs(Io),yn=qe,Zd=Qs(ko),Ce=Wd.getLogger("DatafileManager"),Xd="update";function Jd(e){return e>=yn.MIN_UPDATE_INTERVAL}function Ea(e){return e>=200&&e<400}var ef={get:function(){return Promise.resolve("")},set:function(){return Promise.resolve()},contains:function(){return Promise.resolve(!1)},remove:function(){return Promise.resolve()}},tf=function(){function e(t){var n=this,r=xr(xr({},this.getConfigDefaults()),t),i=r.datafile,o=r.autoUpdate,a=o===void 0?!1:o,s=r.sdkKey,l=r.updateInterval,u=l===void 0?yn.DEFAULT_UPDATE_INTERVAL:l,c=r.urlTemplate,d=c===void 0?yn.DEFAULT_URL_TEMPLATE:c,f=r.cache,p=f===void 0?ef:f;this.cache=p,this.cacheKey="opt-datafile-"+s,this.isReadyPromiseSettled=!1,this.readyPromiseResolver=function(){},this.readyPromiseRejecter=function(){},this.readyPromise=new Promise(function(h,v){n.readyPromiseResolver=h,n.readyPromiseRejecter=v}),i?(this.currentDatafile=i,s||this.resolveReadyPromise()):this.currentDatafile="",this.isStarted=!1,this.datafileUrl=Yd.sprintf(d,s),this.emitter=new Qd.default,this.autoUpdate=a,Jd(u)?this.updateInterval=u:(Ce.warn("Invalid updateInterval %s, defaulting to %s",u,yn.DEFAULT_UPDATE_INTERVAL),this.updateInterval=yn.DEFAULT_UPDATE_INTERVAL),this.currentTimeout=null,this.currentRequest=null,this.backoffController=new Zd.default,this.syncOnCurrentRequestComplete=!1}return e.prototype.get=function(){return this.currentDatafile},e.prototype.start=function(){this.isStarted||(Ce.debug("Datafile manager started"),this.isStarted=!0,this.backoffController.reset(),this.setDatafileFromCacheIfAvailable(),this.syncDatafile())},e.prototype.stop=function(){return Ce.debug("Datafile manager stopped"),this.isStarted=!1,this.currentTimeout&&(clearTimeout(this.currentTimeout),this.currentTimeout=null),this.emitter.removeAllListeners(),this.currentRequest&&(this.currentRequest.abort(),this.currentRequest=null),Promise.resolve()},e.prototype.onReady=function(){return this.readyPromise},e.prototype.on=function(t,n){return this.emitter.on(t,n)},e.prototype.onRequestRejected=function(t){!this.isStarted||(this.backoffController.countError(),t instanceof Error?Ce.error("Error fetching datafile: %s",t.message,t):typeof t=="string"?Ce.error("Error fetching datafile: %s",t):Ce.error("Error fetching datafile"))},e.prototype.onRequestResolved=function(t){if(!!this.isStarted){typeof t.statusCode<"u"&&Ea(t.statusCode)?this.backoffController.reset():this.backoffController.countError(),this.trySavingLastModified(t.headers);var n=this.getNextDatafileFromResponse(t);if(n!=="")if(Ce.info("Updating datafile from response"),this.currentDatafile=n,this.cache.set(this.cacheKey,n),!this.isReadyPromiseSettled)this.resolveReadyPromise();else{var r={datafile:n};this.emitter.emit(Xd,r)}}},e.prototype.onRequestComplete=function(){!this.isStarted||(this.currentRequest=null,!this.isReadyPromiseSettled&&!this.autoUpdate&&this.rejectReadyPromise(new Error("Failed to become ready")),this.autoUpdate&&this.syncOnCurrentRequestComplete&&this.syncDatafile(),this.syncOnCurrentRequestComplete=!1)},e.prototype.syncDatafile=function(){var t=this,n={};this.lastResponseLastModified&&(n["if-modified-since"]=this.lastResponseLastModified),Ce.debug("Making datafile request to url %s with headers: %s",this.datafileUrl,function(){return JSON.stringify(n)}),this.currentRequest=this.makeGetRequest(this.datafileUrl,n);var r=function(){t.onRequestComplete()},i=function(a){t.onRequestResolved(a)},o=function(a){t.onRequestRejected(a)};this.currentRequest.responsePromise.then(i,o).then(r,r),this.autoUpdate&&this.scheduleNextUpdate()},e.prototype.resolveReadyPromise=function(){this.readyPromiseResolver(),this.isReadyPromiseSettled=!0},e.prototype.rejectReadyPromise=function(t){this.readyPromiseRejecter(t),this.isReadyPromiseSettled=!0},e.prototype.scheduleNextUpdate=function(){var t=this,n=this.backoffController.getDelay(),r=Math.max(n,this.updateInterval);Ce.debug("Scheduling sync in %s ms",r),this.currentTimeout=setTimeout(function(){t.currentRequest?t.syncOnCurrentRequestComplete=!0:t.syncDatafile()},r)},e.prototype.getNextDatafileFromResponse=function(t){return Ce.debug("Response status code: %s",t.statusCode),typeof t.statusCode>"u"||t.statusCode===304?"":Ea(t.statusCode)?t.body:""},e.prototype.trySavingLastModified=function(t){var n=t["last-modified"]||t["Last-Modified"];typeof n<"u"&&(this.lastResponseLastModified=n,Ce.debug("Saved last modified header value from response: %s",this.lastResponseLastModified))},e.prototype.setDatafileFromCacheIfAvailable=function(){var t=this;this.cache.get(this.cacheKey).then(function(n){t.isStarted&&!t.isReadyPromiseSettled&&n!==""&&(Ce.debug("Using datafile from cache"),t.currentDatafile=n,t.resolveReadyPromise())})},e}();Co.default=tf;var nf=X&&X.__extends||function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,i){r.__proto__=i}||function(r,i){for(var o in i)i.hasOwnProperty(o)&&(r[o]=i[o])},e(t,n)};return function(t,n){e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}(),rf=X&&X.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(xo,"__esModule",{value:!0});var of=So,af=rf(Co),sf=function(e){nf(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.makeGetRequest=function(n,r){return of.makeGetRequest(n,r)},t.prototype.getConfigDefaults=function(){return{autoUpdate:!1}},t}(af.default);xo.default=sf;Object.defineProperty(Ys,"__esModule",{value:!0});var lf=xo;Ys.HttpPollingDatafileManager=lf.default;var uf={NOTSET:0,DEBUG:1,INFO:2,WARNING:3,ERROR:4},cf={CONDITION_EVALUATOR_ERROR:"%s: Error evaluating audience condition of type %s: %s",DATAFILE_AND_SDK_KEY_MISSING:"%s: You must provide at least one of sdkKey or datafile. Cannot start Optimizely",EXPERIMENT_KEY_NOT_IN_DATAFILE:"%s: Experiment key %s is not in datafile.",FEATURE_NOT_IN_DATAFILE:"%s: Feature key %s is not in datafile.",IMPROPERLY_FORMATTED_EXPERIMENT:"%s: Experiment key %s is improperly formatted.",INVALID_ATTRIBUTES:"%s: Provided attributes are in an invalid format.",INVALID_BUCKETING_ID:"%s: Unable to generate hash for bucketing ID %s: %s",INVALID_DATAFILE:"%s: Datafile is invalid - property %s: %s",INVALID_DATAFILE_MALFORMED:"%s: Datafile is invalid because it is malformed.",INVALID_CONFIG:"%s: Provided Optimizely config is in an invalid format.",INVALID_JSON:"%s: JSON object is not valid.",INVALID_ERROR_HANDLER:'%s: Provided "errorHandler" is in an invalid format.',INVALID_EVENT_DISPATCHER:'%s: Provided "eventDispatcher" is in an invalid format.',INVALID_EVENT_TAGS:"%s: Provided event tags are in an invalid format.",INVALID_EXPERIMENT_KEY:"%s: Experiment key %s is not in datafile. It is either invalid, paused, or archived.",INVALID_EXPERIMENT_ID:"%s: Experiment ID %s is not in datafile.",INVALID_GROUP_ID:"%s: Group ID %s is not in datafile.",INVALID_LOGGER:'%s: Provided "logger" is in an invalid format.',INVALID_ROLLOUT_ID:"%s: Invalid rollout ID %s attached to feature %s",INVALID_USER_ID:"%s: Provided user ID is in an invalid format.",INVALID_USER_PROFILE_SERVICE:"%s: Provided user profile service instance is in an invalid format: %s.",NO_DATAFILE_SPECIFIED:"%s: No datafile specified. Cannot start optimizely.",NO_JSON_PROVIDED:"%s: No JSON object to validate against schema.",NO_VARIATION_FOR_EXPERIMENT_KEY:"%s: No variation key %s defined in datafile for experiment %s.",UNDEFINED_ATTRIBUTE:"%s: Provided attribute: %s has an undefined value.",UNRECOGNIZED_ATTRIBUTE:"%s: Unrecognized attribute %s provided. Pruning before sending event to Optimizely.",UNABLE_TO_CAST_VALUE:"%s: Unable to cast value %s to type %s, returning null.",USER_NOT_IN_FORCED_VARIATION:"%s: User %s is not in the forced variation map. Cannot remove their forced variation.",USER_PROFILE_LOOKUP_ERROR:'%s: Error while looking up user profile for user ID "%s": %s.',USER_PROFILE_SAVE_ERROR:'%s: Error while saving user profile for user ID "%s": %s.',VARIABLE_KEY_NOT_IN_DATAFILE:'%s: Variable with key "%s" associated with feature with key "%s" is not in datafile.',VARIATION_ID_NOT_IN_DATAFILE:"%s: No variation ID %s defined in datafile for experiment %s.",VARIATION_ID_NOT_IN_DATAFILE_NO_EXPERIMENT:"%s: Variation ID %s is not in the datafile.",INVALID_INPUT_FORMAT:"%s: Provided %s is in an invalid format.",INVALID_DATAFILE_VERSION:"%s: This version of the JavaScript SDK does not support the given datafile version: %s",INVALID_VARIATION_KEY:"%s: Provided variation key is in an invalid format."},df={ACTIVATE_USER:"%s: Activating user %s in experiment %s.",DISPATCH_CONVERSION_EVENT:"%s: Dispatching conversion event to URL %s with params %s.",DISPATCH_IMPRESSION_EVENT:"%s: Dispatching impression event to URL %s with params %s.",DEPRECATED_EVENT_VALUE:"%s: Event value is deprecated in %s call.",EVENT_KEY_NOT_FOUND:"%s: Event key %s is not in datafile.",EXPERIMENT_NOT_RUNNING:"%s: Experiment %s is not running.",FEATURE_ENABLED_FOR_USER:"%s: Feature %s is enabled for user %s.",FEATURE_NOT_ENABLED_FOR_USER:"%s: Feature %s is not enabled for user %s.",FEATURE_HAS_NO_EXPERIMENTS:"%s: Feature %s is not attached to any experiments.",FAILED_TO_PARSE_VALUE:'%s: Failed to parse event value "%s" from event tags.',FAILED_TO_PARSE_REVENUE:'%s: Failed to parse revenue value "%s" from event tags.',FORCED_BUCKETING_FAILED:"%s: Variation key %s is not in datafile. Not activating user %s.",INVALID_OBJECT:"%s: Optimizely object is not valid. Failing %s.",INVALID_CLIENT_ENGINE:"%s: Invalid client engine passed: %s. Defaulting to node-sdk.",INVALID_DEFAULT_DECIDE_OPTIONS:"%s: Provided default decide options is not an array.",INVALID_DECIDE_OPTIONS:"%s: Provided decide options is not an array. Using default decide options.",INVALID_VARIATION_ID:"%s: Bucketed into an invalid variation ID. Returning null.",NOTIFICATION_LISTENER_EXCEPTION:"%s: Notification listener for (%s) threw exception: %s",NO_ROLLOUT_EXISTS:"%s: There is no rollout of feature %s.",NOT_ACTIVATING_USER:"%s: Not activating user %s for experiment %s.",NOT_TRACKING_USER:"%s: Not tracking user %s.",PARSED_REVENUE_VALUE:'%s: Parsed revenue value "%s" from event tags.',PARSED_NUMERIC_VALUE:'%s: Parsed event value "%s" from event tags.',RETURNING_STORED_VARIATION:'%s: Returning previously activated variation "%s" of experiment "%s" for user "%s" from user profile.',ROLLOUT_HAS_NO_EXPERIMENTS:"%s: Rollout of feature %s has no experiments",SAVED_VARIATION:'%s: Saved variation "%s" of experiment "%s" for user "%s".',SAVED_VARIATION_NOT_FOUND:"%s: User %s was previously bucketed into variation with ID %s for experiment %s, but no matching variation was found.",SHOULD_NOT_DISPATCH_ACTIVATE:'%s: Experiment %s is not in "Running" state. Not activating user.',SKIPPING_JSON_VALIDATION:"%s: Skipping JSON schema validation.",TRACK_EVENT:"%s: Tracking event %s for user %s.",UNRECOGNIZED_DECIDE_OPTION:"%s: Unrecognized decide option %s provided.",USER_ASSIGNED_TO_EXPERIMENT_BUCKET:"%s: Assigned bucket %s to user with bucketing ID %s.",USER_BUCKETED_INTO_EXPERIMENT_IN_GROUP:"%s: User %s is in experiment %s of group %s.",USER_BUCKETED_INTO_TARGETING_RULE:"%s: User %s bucketed into targeting rule %s.",USER_IN_FEATURE_EXPERIMENT:"%s: User %s is in variation %s of experiment %s on the feature %s.",USER_IN_ROLLOUT:"%s: User %s is in rollout of feature %s.",USER_NOT_BUCKETED_INTO_EVERYONE_TARGETING_RULE:"%s: User %s not bucketed into everyone targeting rule due to traffic allocation.",USER_NOT_BUCKETED_INTO_EXPERIMENT_IN_GROUP:"%s: User %s is not in experiment %s of group %s.",USER_NOT_BUCKETED_INTO_ANY_EXPERIMENT_IN_GROUP:"%s: User %s is not in any experiment of group %s.",USER_NOT_BUCKETED_INTO_TARGETING_RULE:"%s User %s not bucketed into targeting rule %s due to traffic allocation. Trying everyone rule.",USER_NOT_IN_FEATURE_EXPERIMENT:"%s: User %s is not in any experiment on the feature %s.",USER_NOT_IN_ROLLOUT:"%s: User %s is not in rollout of feature %s.",USER_FORCED_IN_VARIATION:"%s: User %s is forced in variation %s.",USER_MAPPED_TO_FORCED_VARIATION:"%s: Set variation %s for experiment %s and user %s in the forced variation map.",USER_DOESNT_MEET_CONDITIONS_FOR_TARGETING_RULE:"%s: User %s does not meet conditions for targeting rule %s.",USER_MEETS_CONDITIONS_FOR_TARGETING_RULE:"%s: User %s meets conditions for targeting rule %s.",USER_HAS_VARIATION:"%s: User %s is in variation %s of experiment %s.",USER_HAS_FORCED_DECISION_WITH_RULE_SPECIFIED:"Variation (%s) is mapped to flag (%s), rule (%s) and user (%s) in the forced decision map.",USER_HAS_FORCED_DECISION_WITH_NO_RULE_SPECIFIED:"Variation (%s) is mapped to flag (%s) and user (%s) in the forced decision map.",USER_HAS_FORCED_DECISION_WITH_RULE_SPECIFIED_BUT_INVALID:"Invalid variation is mapped to flag (%s), rule (%s) and user (%s) in the forced decision map.",USER_HAS_FORCED_DECISION_WITH_NO_RULE_SPECIFIED_BUT_INVALID:"Invalid variation is mapped to flag (%s) and user (%s) in the forced decision map.",USER_HAS_FORCED_VARIATION:"%s: Variation %s is mapped to experiment %s and user %s in the forced variation map.",USER_HAS_NO_VARIATION:"%s: User %s is in no variation of experiment %s.",USER_HAS_NO_FORCED_VARIATION:"%s: User %s is not in the forced variation map.",USER_HAS_NO_FORCED_VARIATION_FOR_EXPERIMENT:"%s: No experiment %s mapped to user %s in the forced variation map.",USER_NOT_IN_ANY_EXPERIMENT:"%s: User %s is not in any experiment of group %s.",USER_NOT_IN_EXPERIMENT:"%s: User %s does not meet conditions to be in experiment %s.",USER_RECEIVED_DEFAULT_VARIABLE_VALUE:'%s: User "%s" is not in any variation or rollout rule. Returning default value for variable "%s" of feature flag "%s".',FEATURE_NOT_ENABLED_RETURN_DEFAULT_VARIABLE_VALUE:'%s: Feature "%s" is not enabled for user %s. Returning the default variable value "%s".',VARIABLE_NOT_USED_RETURN_DEFAULT_VARIABLE_VALUE:'%s: Variable "%s" is not used in variation "%s". Returning default value.',USER_RECEIVED_VARIABLE_VALUE:'%s: Got variable value "%s" for variable "%s" of feature flag "%s"',VALID_DATAFILE:"%s: Datafile is valid.",VALID_USER_PROFILE_SERVICE:"%s: Valid user profile service provided.",VARIATION_REMOVED_FOR_USER:"%s: Variation mapped to experiment %s has been removed for user %s.",VARIABLE_REQUESTED_WITH_WRONG_TYPE:'%s: Requested variable type "%s", but variable is of type "%s". Use correct API to retrieve value. Returning None.',VALID_BUCKETING_ID:'%s: BucketingId is valid: "%s"',BUCKETING_ID_NOT_STRING:"%s: BucketingID attribute is not a string. Defaulted to userId",EVALUATING_AUDIENCE:'%s: Starting to evaluate audience "%s" with conditions: %s.',EVALUATING_AUDIENCES_COMBINED:'%s: Evaluating audiences for %s "%s": %s.',AUDIENCE_EVALUATION_RESULT:'%s: Audience "%s" evaluated to %s.',AUDIENCE_EVALUATION_RESULT_COMBINED:"%s: Audiences for %s %s collectively evaluated to %s.",MISSING_ATTRIBUTE_VALUE:'%s: Audience condition %s evaluated to UNKNOWN because no value was passed for user attribute "%s".',UNEXPECTED_CONDITION_VALUE:"%s: Audience condition %s evaluated to UNKNOWN because the condition value is not supported.",UNEXPECTED_TYPE:'%s: Audience condition %s evaluated to UNKNOWN because a value of type "%s" was passed for user attribute "%s".',UNEXPECTED_TYPE_NULL:'%s: Audience condition %s evaluated to UNKNOWN because a null value was passed for user attribute "%s".',UNKNOWN_CONDITION_TYPE:"%s: Audience condition %s has an unknown condition type. You may need to upgrade to a newer release of the Optimizely SDK.",UNKNOWN_MATCH_TYPE:"%s: Audience condition %s uses an unknown match type. You may need to upgrade to a newer release of the Optimizely SDK.",UPDATED_OPTIMIZELY_CONFIG:"%s: Updated Optimizely config to revision %s (project id %s)",OUT_OF_BOUNDS:'%s: Audience condition %s evaluated to UNKNOWN because the number value for user attribute "%s" is not in the range [-2^53, +2^53].',UNABLE_TO_ATTACH_UNLOAD:'%s: unable to bind optimizely.close() to page unload event: "%s"'},ff={BOT_FILTERING:"$opt_bot_filtering",BUCKETING_ID:"$opt_bucketing_id",STICKY_BUCKETING_KEY:"$opt_experiment_bucket_map",USER_AGENT:"$opt_user_agent",FORCED_DECISION_NULL_RULE_KEY:"$opt_null_rule_key"},pf="javascript-sdk",hf="node-sdk",vf="react-sdk",mf="react-native-sdk",gf="react-native-js-sdk",yf="4.9.4",_f="4.9.4",wf={AB_TEST:"ab-test",FEATURE:"feature",FEATURE_TEST:"feature-test",FEATURE_VARIABLE:"feature-variable",ALL_FEATURE_VARIABLES:"all-feature-variables",FLAG:"flag"},bf={FEATURE_TEST:"feature-test",ROLLOUT:"rollout",EXPERIMENT:"experiment"},Ef={RULE:"rule",EXPERIMENT:"experiment"},xf={BOOLEAN:"boolean",DOUBLE:"double",INTEGER:"integer",STRING:"string",JSON:"json"},ar={V2:"2",V3:"3",V4:"4"},Sf={SDK_NOT_READY:"Optimizely SDK not configured properly yet.",FLAG_KEY_INVALID:'No flag was found for key "%s".',VARIABLE_VALUE_INVALID:'Variable value for key "%s" is invalid or wrong type.'},Ci;(function(e){e.ACTIVATE="ACTIVATE:experiment, user_id,attributes, variation, event",e.DECISION="DECISION:type, userId, attributes, decisionInfo",e.LOG_EVENT="LOG_EVENT:logEvent",e.OPTIMIZELY_CONFIG_UPDATE="OPTIMIZELY_CONFIG_UPDATE",e.TRACK="TRACK:event_key, user_id, attributes, event_tags, event"})(Ci||(Ci={}));var Cf=Object.freeze({__proto__:null,LOG_LEVEL:uf,ERROR_MESSAGES:cf,LOG_MESSAGES:df,CONTROL_ATTRIBUTES:ff,JAVASCRIPT_CLIENT_ENGINE:pf,NODE_CLIENT_ENGINE:hf,REACT_CLIENT_ENGINE:vf,REACT_NATIVE_CLIENT_ENGINE:mf,REACT_NATIVE_JS_CLIENT_ENGINE:gf,BROWSER_CLIENT_VERSION:yf,NODE_CLIENT_VERSION:_f,DECISION_NOTIFICATION_TYPES:wf,DECISION_SOURCES:bf,AUDIENCE_EVALUATION_TYPES:Ef,FEATURE_VARIABLE_TYPES:xf,DATAFILE_VERSIONS:ar,DECISION_MESSAGES:Sf,get NOTIFICATION_TYPES(){return Ci}});ar.V2,ar.V3,ar.V4;(function(){function e(){}return e.prototype.log=function(){},e})();function If(e){return new le.ConsoleLogHandler(e)}var xa;(function(e){e.BOOLEAN="boolean",e.DOUBLE="double",e.INTEGER="integer",e.STRING="string",e.JSON="json"})(xa||(xa={}));var Sa;(function(e){e.DISABLE_DECISION_EVENT="DISABLE_DECISION_EVENT",e.ENABLED_FLAGS_ONLY="ENABLED_FLAGS_ONLY",e.IGNORE_USER_PROFILE_SERVICE="IGNORE_USER_PROFILE_SERVICE",e.INCLUDE_REASONS="INCLUDE_REASONS",e.EXCLUDE_VARIABLES="EXCLUDE_VARIABLES"})(Sa||(Sa={}));le.getLogger();le.getLogger();le.getLogger();le.getLogger();le.getLogger("EVENT_BUILDER");le.getLogger();le.setLogHandler(If());le.setLogLevel(le.LogLevel.INFO);let Xn;const kf=new Uint8Array(16);function Tf(){if(!Xn&&(Xn=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!Xn))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Xn(kf)}const ce=[];for(let e=0;e<256;++e)ce.push((e+256).toString(16).slice(1));function Lf(e,t=0){return(ce[e[t+0]]+ce[e[t+1]]+ce[e[t+2]]+ce[e[t+3]]+"-"+ce[e[t+4]]+ce[e[t+5]]+"-"+ce[e[t+6]]+ce[e[t+7]]+"-"+ce[e[t+8]]+ce[e[t+9]]+"-"+ce[e[t+10]]+ce[e[t+11]]+ce[e[t+12]]+ce[e[t+13]]+ce[e[t+14]]+ce[e[t+15]]).toLowerCase()}const Rf=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),Ca={randomUUID:Rf};function mt(e,t,n){if(Ca.randomUUID&&!t&&!e)return Ca.randomUUID();e=e||{};const r=e.random||(e.rng||Tf)();if(r[6]=r[6]&15|64,r[8]=r[8]&63|128,t){n=n||0;for(let i=0;i<16;++i)t[n+i]=r[i];return t}return Lf(r)}const zt="ul-app";var U=(e=>(e.Caption="ul-caption",e.CardContainer="ul-card__container",e.CardMainContent="ul-card-main-content",e.Choice="choice",e.ChoiceCheckbox="select-checkbox",e.ChoiceGroup="ul-card__choices",e.ChoiceLabel="select-label",e.ChoiceLabelContainer="choice-label-container",e.ChoiceRadio="select-radio",e.ChoiceTextEntryContainer="choice-text-entry-container",e.ChoiceTextInput="choice-text-input",e.CloseButton="close-btn",e.CloseContainer="close-container",e.ConsentLegalNameInput="ul-consent-legal__name-input",e.CustomStyle="ul-custom-style",e.DesktopSuffix="--desktop",e.FadeInTransition="fade-in-transition",e.LikertNumber="likert-number",e.LikertSmiley="likert-smiley",e.LikertStar="likert-star",e.LoadingSpinner="ul-loading-spinner",e.LoadingSpinnerContainer="ul-loading-spinner-container",e.LoadingSpinnerFirst="first",e.LoadingSpinnerFourth="fourth",e.LoadingSpinnerSecond="second",e.LoadingSpinnerThird="third",e.MobileSuffix="--mobile",e.NPSNumber="nps-number",e.OpenTextInput="ul-card-text__input",e.QuestionHeader="ul-question",e.VideoCard="ul-card--video",e.CheckmarkButton="ul-button-checkmark",e.InactiveButton="ul-button-inactive",e.LeftAlignButton="ul-button-left-align",e.ButtonDisabled="sprig-button-disabled",e.SkipButton="ul-card-skip__button",e))(U||{});const To="#e6e6e6",En="#bd282a",Af=500,Uf=1030;var be=(e=>(e.Preview="sprig.previewKey",e.Credentials="userleap.ids",e.PageViews="userleap.pageviews",e))(be||{});const Zs=()=>{try{return window.parent.Intercom}catch(e){return console.error(e),null}},Of=()=>{const e=Zs();!e||(e.ul_wasVisible&&e("update",{hide_default_launcher:!1}),delete e.ul_wasVisible)},Df=()=>{const e=Zs();!e||(e.ul_wasVisible=!!document.querySelector("iframe.intercom-launcher-frame"),e.ul_wasVisible&&e("update",{hide_default_launcher:!0}))},Pf=Object.freeze(Object.defineProperty({__proto__:null,enable:Of,disable:Df},Symbol.toStringTag,{value:"Module"})),Ia=[Pf];class Ii{static disable(){Ia.forEach(t=>t.disable())}static enable(){Ia.forEach(t=>t.enable())}}const Nf=1,Jt=e=>e instanceof HTMLElement,Vf=e=>e instanceof HTMLInputElement,xn=e=>e instanceof HTMLTextAreaElement,Xs=(e,t,n)=>{const r=e.createElement("style");n&&(r.nonce=n),r.textContent=t,r.id=U.CustomStyle,e.head.appendChild(r)},Js=e=>{const t=e.querySelector(`.${U.CardContainer}`);let n=600,r=0;if(t){n=t.scrollHeight;const i=getComputedStyle(t),o=parseFloat(i.marginTop)+parseFloat(i.marginBottom),a=parseFloat(i.borderTopWidth)+parseFloat(i.borderBottomWidth);r=o+a}return n+r+Nf},Mf=e=>{const t=e.querySelector(`.${U.CardContainer}`);t&&(t.scrollTop=0)};var jf=class extends Error{constructor(e,t,n){super(`Possible EventEmitter memory leak detected. ${n} ${t.toString()} listeners added. Use emitter.setMaxListeners() to increase limit`),this.emitter=e,this.type=t,this.count=n,this.name="MaxListenersExceededWarning"}},el=class{static listenerCount(e,t){return e.listenerCount(t)}constructor(){this.events=new Map,this.maxListeners=el.defaultMaxListeners,this.hasWarnedAboutPotentialMemoryLeak=!1}_emitInternalEvent(e,t,n){this.emit(e,t,n)}_getListeners(e){return Array.prototype.concat.apply([],this.events.get(e))||[]}_removeListener(e,t){const n=e.indexOf(t);return n>-1&&e.splice(n,1),[]}_wrapOnceListener(e,t){const n=(...r)=>(this.removeListener(e,n),t.apply(this,r));return Object.defineProperty(n,"name",{value:t.name}),n}setMaxListeners(e){return this.maxListeners=e,this}getMaxListeners(){return this.maxListeners}eventNames(){return Array.from(this.events.keys())}emit(e,...t){const n=this._getListeners(e);return n.forEach(r=>{r.apply(this,t)}),n.length>0}addListener(e,t){this._emitInternalEvent("newListener",e,t);const n=this._getListeners(e).concat(t);if(this.events.set(e,n),this.maxListeners>0&&this.listenerCount(e)>this.maxListeners&&!this.hasWarnedAboutPotentialMemoryLeak){this.hasWarnedAboutPotentialMemoryLeak=!0;const r=new jf(this,e,this.listenerCount(e));console.warn(r)}return this}on(e,t){return this.addListener(e,t)}once(e,t){return this.addListener(e,this._wrapOnceListener(e,t))}prependListener(e,t){const n=this._getListeners(e);if(n.length>0){const r=[t].concat(n);this.events.set(e,r)}else this.events.set(e,n.concat(t));return this}prependOnceListener(e,t){return this.prependListener(e,this._wrapOnceListener(e,t))}removeListener(e,t){const n=this._getListeners(e);return n.length>0&&(this._removeListener(n,t),this.events.set(e,n),this._emitInternalEvent("removeListener",e,t)),this}off(e,t){return this.removeListener(e,t)}removeAllListeners(e){return e?this.events.delete(e):this.events.clear(),this}listeners(e){return Array.from(this._getListeners(e))}listenerCount(e){return this._getListeners(e).length}rawListeners(e){return this.listeners(e)}},tl=el;tl.defaultMaxListeners=10;const $=new tl;var _n=(e=>(e.BottomLeft="bottomLeft",e.BottomRight="bottomRight",e.Center="center",e.TopLeft="topLeft",e.TopRight="topRight",e))(_n||{}),He=(e=>(e.Error="x-ul-error",e.EnvironmentID="x-ul-environment-id",e.InstallationMethod="x-ul-installation-method",e.PartnerAnonymousId="x-ul-anonymous-id",e.Platform="userleap-platform",e.PreviewMode="x-ul-preview-mode",e.UserID="x-ul-user-id",e.VisitorID="x-ul-visitor-id",e))(He||{}),Pt=(e=>(e.Email="email",e.Link="link",e.Web="web",e))(Pt||{}),rt=(e=>(e.Npm="web-npm",e.NpmBundled="web-npm-bundled",e.Gtm="web-gtm",e.Segment="web-segment",e.SegmentAndroid="android-segment",e.SegmentReactNative="react-native-segment",e.SegmentIOS="ios-segment",e.Snippet="web-snippet",e))(rt||{});const Sr=e=>new Promise(t=>{setTimeout(()=>{t()},e)}),Wt=({"userleap-platform":e})=>e!==Pt.Web,ie=(e,t)=>{const n=t?U.MobileSuffix:U.DesktopSuffix;return[e+n,e]},Bf=(e,t)=>[e,`${e}__${t}`];class Ff{constructor(t){fe(this,"payload");fe(this,"promise");fe(this,"reject",()=>{});fe(this,"resolve",()=>{});this.payload=t,this.promise=new Promise((n,r)=>{this.reject=r,this.resolve=n})}resolveRequest(t){this.resolve(t)}}const Hf={RATELIMIT_RESET_DEFAULT:10};let nl=!1,rl="",Jn=!1,il=!1,sr=[];const Kf=e=>e._config&&e._config.installationMethod?e._config.installationMethod:e._gtm?rt.Gtm:e._segment?rt.Segment:rt.Snippet,ki=e=>{var t;(t=e==null?void 0:e.blockedURI)!=null&&t.includes(window.UserLeap._API_URL)&&(il=!0,console.warn(`[Sprig] ${e.blockedURI} is blocked by Content-Security-Policy`),document.removeEventListener("securitypolicyviolation",ki))},Ti=(e="")=>{nl=!0,rl=e};function en(e={}){const t={"Content-Type":"application/json","userleap-platform":Pt.Web,"x-ul-sdk-version":"2.24.10",[He.InstallationMethod]:Kf(e)};if(e.envId&&(t[He.EnvironmentID]=e.envId),e.token&&(t.Authorization="Bearer "+e.token),e.userId&&(t[He.UserID]=e.userId),e.visitorId&&(t[He.VisitorID]=e.visitorId),e.partnerAnonymousId&&(t[He.PartnerAnonymousId]=e.partnerAnonymousId),e.mobileHeadersJSON){const n=JSON.parse(e.mobileHeadersJSON);Object.assign(t,n)}return e.locale&&(t["accept-language"]=e.locale),window.previewMode&&(t[He.PreviewMode]="1"),t}const ka=async(e,t,n)=>{if(e)return{status:429};{const r=new Ff(n);return sr.push(r),r.promise}},it=async(e,t,n=0,r=!1,i=!1)=>{const o={url:e,options:t,attempt:n,shouldDropOnRateLimit:r};if(Jn&&!i)return ka(r,i,o);const a={ok:!1,reportError:!1};if(nl)return console.info(`UserLeap - ${rl}`),a;try{t.headers=Object.assign(en(),t.headers);const s=await fetch(e,t);if(s.status===429)if(!Jn&&!r||i){Jn=!0;const u=s.headers.has("ratelimit-reset")?Number(s.headers.get("ratelimit-reset")):Hf.RATELIMIT_RESET_DEFAULT;return await Sr(u*1e3),it(e,t,0,r,!0)}else return ka(r,!1,o);if(Jn=!1,sr.length&&(sr.map(l=>{const{url:u,options:c,attempt:d,shouldDropOnRateLimit:f}=l.payload;it(u,c,d,f).then(p=>{l.resolveRequest(p)})}),sr=[]),s.ok){if(s.status===249)return Ti(),a;const l=await s.text();try{return l&&l!=="OK"&&(s.json=JSON.parse(l)),s}catch{return{ok:!1,reportError:!1,error:new Error(`failed parsing response json for ${e} - ${l}`)}}}return s}catch(s){const l=n+1;return l>5||il?{ok:!1,reportError:!1,error:s}:(await Sr(Math.pow(2,n)*1e3),it(e,t,l))}};var ol={exports:{}};(function(e,t){(function(n,r){e.exports=r()})(X,function(){var n=function(o,a){if(a=a||{},typeof o!="function")throw new i("fetch must be a function");if(typeof a!="object")throw new i("defaults must be an object");if(a.retries!==void 0&&!r(a.retries))throw new i("retries must be a positive integer");if(a.retryDelay!==void 0&&!r(a.retryDelay)&&typeof a.retryDelay!="function")throw new i("retryDelay must be a positive integer or a function returning a positive integer");if(a.retryOn!==void 0&&!Array.isArray(a.retryOn)&&typeof a.retryOn!="function")throw new i("retryOn property expects an array or function");var s={retries:3,retryDelay:1e3,retryOn:[]};return a=Object.assign(s,a),function(u,c){var d=a.retries,f=a.retryDelay,p=a.retryOn;if(c&&c.retries!==void 0)if(r(c.retries))d=c.retries;else throw new i("retries must be a positive integer");if(c&&c.retryDelay!==void 0)if(r(c.retryDelay)||typeof c.retryDelay=="function")f=c.retryDelay;else throw new i("retryDelay must be a positive integer or a function returning a positive integer");if(c&&c.retryOn)if(Array.isArray(c.retryOn)||typeof c.retryOn=="function")p=c.retryOn;else throw new i("retryOn property expects an array or function");return new Promise(function(h,v){var g=function(_){var b=typeof Request<"u"&&u instanceof Request?u.clone():u;o(b,c).then(function(E){if(Array.isArray(p)&&p.indexOf(E.status)===-1)h(E);else if(typeof p=="function")try{return Promise.resolve(p(_,null,E)).then(function(m){m?w(_,null,E):h(E)}).catch(v)}catch(m){v(m)}else _<d?w(_,null,E):h(E)}).catch(function(E){if(typeof p=="function")try{Promise.resolve(p(_,E,null)).then(function(m){m?w(_,E,null):v(E)}).catch(function(m){v(m)})}catch(m){v(m)}else _<d?w(_,E,null):v(E)})};function w(_,b,E){var m=typeof f=="function"?f(_,b,E):f;setTimeout(function(){g(++_)},m)}g(0)})}};function r(o){return Number.isInteger(o)&&o>=0}function i(o){this.name="ArgumentError",this.message=o}return n})})(ol);const $f=ol.exports;class qf{constructor(t){fe(this,"awaitingResolvers",[]);fe(this,"activeCount",0);this.capacity=t}async acquire(){if(this.activeCount<this.capacity){this.activeCount++;return}return new Promise(t=>{this.awaitingResolvers.push(t)})}release(){const t=this.awaitingResolvers.shift();t&&this.activeCount<=this.capacity?t():this.activeCount--}async execute(t){try{return await this.acquire(),await t()}finally{this.release()}}setLimit(t){this.capacity=t}}const al=new qf(2),Gf=e=>al.setLimit(e),zf=$f(fetch),Wf=async(e,t=3)=>al.execute(async()=>{const r=(await zf(e.uploadUrl,{body:e.data,method:"PUT",retries:t,retryDelay:i=>Math.pow(2,i)*1e3})).headers.get("ETag");if(!r)throw new Error(`Upload response did not include etag for upload ${e.uploadId}, part ${e.chunkIndex}`);return r}),sl=async({apiUrl:e,surveyId:t,uploadId:n,etags:r,headers:i,responseGroupUuid:o,replayDuration:a,eventDigest:s},l=!1)=>{var u;if(!(!l&&!n&&!r))return it(`${e}/sdk/1/completeSessionReplay`,{method:"POST",body:JSON.stringify({etags:r,uploadId:n,responseGroupUuid:o,surveyId:t,replayDuration:a,eventDigest:s,userAgent:(u=window==null?void 0:window.navigator)==null?void 0:u.userAgent}),headers:i})};/*! *****************************************************************************
2
+ `),r={};return n.forEach(function(i){var o=i.indexOf(": ");if(o>-1){var a=i.slice(0,o),s=i.slice(o+2);s.length>0&&(r[a]=s)}}),r}function Kd(e,t){Object.keys(e).forEach(function(n){var r=e[n];t.setRequestHeader(n,r)})}function $d(e,t){var n=new XMLHttpRequest,r=new Promise(function(i,o){n.open(Bd,e,!0),Kd(t,n),n.onreadystatechange=function(){if(n.readyState===Fd){var a=n.status;if(a===0){o(new Error("Request error"));return}var s=Hd(n),l={statusCode:n.status,body:n.responseText,headers:s};i(l)}},n.timeout=Vd.REQUEST_TIMEOUT_MS,n.ontimeout=function(){jd.error("Request timed out")},n.send()});return{responsePromise:r,abort:function(){n.abort()}}}So.makeGetRequest=$d;var Co={},Io={};Object.defineProperty(Io,"__esModule",{value:!0});var qd=function(){function e(){this.listeners={},this.listenerId=1}return e.prototype.on=function(t,n){var r=this;this.listeners[t]||(this.listeners[t]={});var i=String(this.listenerId);return this.listenerId++,this.listeners[t][i]=n,function(){r.listeners[t]&&delete r.listeners[t][i]}},e.prototype.emit=function(t,n){var r=this.listeners[t];r&&Object.keys(r).forEach(function(i){var o=r[i];o(n)})},e.prototype.removeAllListeners=function(){this.listeners={}},e}();Io.default=qd;var ko={};Object.defineProperty(ko,"__esModule",{value:!0});var ii=qe;function Gd(){return Math.round(Math.random()*1e3)}var zd=function(){function e(){this.errorCount=0}return e.prototype.getDelay=function(){if(this.errorCount===0)return 0;var t=ii.BACKOFF_BASE_WAIT_SECONDS_BY_ERROR_COUNT[Math.min(ii.BACKOFF_BASE_WAIT_SECONDS_BY_ERROR_COUNT.length-1,this.errorCount)];return t*1e3+Gd()},e.prototype.countError=function(){this.errorCount<ii.BACKOFF_BASE_WAIT_SECONDS_BY_ERROR_COUNT.length-1&&this.errorCount++},e.prototype.reset=function(){this.errorCount=0},e}();ko.default=zd;var xr=X&&X.__assign||function(){return xr=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++){t=arguments[n];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])}return e},xr.apply(this,arguments)},Qs=X&&X.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Co,"__esModule",{value:!0});var Wd=le,Yd=ln,Qd=Qs(Io),yn=qe,Zd=Qs(ko),Ce=Wd.getLogger("DatafileManager"),Xd="update";function Jd(e){return e>=yn.MIN_UPDATE_INTERVAL}function Ea(e){return e>=200&&e<400}var ef={get:function(){return Promise.resolve("")},set:function(){return Promise.resolve()},contains:function(){return Promise.resolve(!1)},remove:function(){return Promise.resolve()}},tf=function(){function e(t){var n=this,r=xr(xr({},this.getConfigDefaults()),t),i=r.datafile,o=r.autoUpdate,a=o===void 0?!1:o,s=r.sdkKey,l=r.updateInterval,u=l===void 0?yn.DEFAULT_UPDATE_INTERVAL:l,c=r.urlTemplate,d=c===void 0?yn.DEFAULT_URL_TEMPLATE:c,f=r.cache,p=f===void 0?ef:f;this.cache=p,this.cacheKey="opt-datafile-"+s,this.isReadyPromiseSettled=!1,this.readyPromiseResolver=function(){},this.readyPromiseRejecter=function(){},this.readyPromise=new Promise(function(h,v){n.readyPromiseResolver=h,n.readyPromiseRejecter=v}),i?(this.currentDatafile=i,s||this.resolveReadyPromise()):this.currentDatafile="",this.isStarted=!1,this.datafileUrl=Yd.sprintf(d,s),this.emitter=new Qd.default,this.autoUpdate=a,Jd(u)?this.updateInterval=u:(Ce.warn("Invalid updateInterval %s, defaulting to %s",u,yn.DEFAULT_UPDATE_INTERVAL),this.updateInterval=yn.DEFAULT_UPDATE_INTERVAL),this.currentTimeout=null,this.currentRequest=null,this.backoffController=new Zd.default,this.syncOnCurrentRequestComplete=!1}return e.prototype.get=function(){return this.currentDatafile},e.prototype.start=function(){this.isStarted||(Ce.debug("Datafile manager started"),this.isStarted=!0,this.backoffController.reset(),this.setDatafileFromCacheIfAvailable(),this.syncDatafile())},e.prototype.stop=function(){return Ce.debug("Datafile manager stopped"),this.isStarted=!1,this.currentTimeout&&(clearTimeout(this.currentTimeout),this.currentTimeout=null),this.emitter.removeAllListeners(),this.currentRequest&&(this.currentRequest.abort(),this.currentRequest=null),Promise.resolve()},e.prototype.onReady=function(){return this.readyPromise},e.prototype.on=function(t,n){return this.emitter.on(t,n)},e.prototype.onRequestRejected=function(t){!this.isStarted||(this.backoffController.countError(),t instanceof Error?Ce.error("Error fetching datafile: %s",t.message,t):typeof t=="string"?Ce.error("Error fetching datafile: %s",t):Ce.error("Error fetching datafile"))},e.prototype.onRequestResolved=function(t){if(!!this.isStarted){typeof t.statusCode<"u"&&Ea(t.statusCode)?this.backoffController.reset():this.backoffController.countError(),this.trySavingLastModified(t.headers);var n=this.getNextDatafileFromResponse(t);if(n!=="")if(Ce.info("Updating datafile from response"),this.currentDatafile=n,this.cache.set(this.cacheKey,n),!this.isReadyPromiseSettled)this.resolveReadyPromise();else{var r={datafile:n};this.emitter.emit(Xd,r)}}},e.prototype.onRequestComplete=function(){!this.isStarted||(this.currentRequest=null,!this.isReadyPromiseSettled&&!this.autoUpdate&&this.rejectReadyPromise(new Error("Failed to become ready")),this.autoUpdate&&this.syncOnCurrentRequestComplete&&this.syncDatafile(),this.syncOnCurrentRequestComplete=!1)},e.prototype.syncDatafile=function(){var t=this,n={};this.lastResponseLastModified&&(n["if-modified-since"]=this.lastResponseLastModified),Ce.debug("Making datafile request to url %s with headers: %s",this.datafileUrl,function(){return JSON.stringify(n)}),this.currentRequest=this.makeGetRequest(this.datafileUrl,n);var r=function(){t.onRequestComplete()},i=function(a){t.onRequestResolved(a)},o=function(a){t.onRequestRejected(a)};this.currentRequest.responsePromise.then(i,o).then(r,r),this.autoUpdate&&this.scheduleNextUpdate()},e.prototype.resolveReadyPromise=function(){this.readyPromiseResolver(),this.isReadyPromiseSettled=!0},e.prototype.rejectReadyPromise=function(t){this.readyPromiseRejecter(t),this.isReadyPromiseSettled=!0},e.prototype.scheduleNextUpdate=function(){var t=this,n=this.backoffController.getDelay(),r=Math.max(n,this.updateInterval);Ce.debug("Scheduling sync in %s ms",r),this.currentTimeout=setTimeout(function(){t.currentRequest?t.syncOnCurrentRequestComplete=!0:t.syncDatafile()},r)},e.prototype.getNextDatafileFromResponse=function(t){return Ce.debug("Response status code: %s",t.statusCode),typeof t.statusCode>"u"||t.statusCode===304?"":Ea(t.statusCode)?t.body:""},e.prototype.trySavingLastModified=function(t){var n=t["last-modified"]||t["Last-Modified"];typeof n<"u"&&(this.lastResponseLastModified=n,Ce.debug("Saved last modified header value from response: %s",this.lastResponseLastModified))},e.prototype.setDatafileFromCacheIfAvailable=function(){var t=this;this.cache.get(this.cacheKey).then(function(n){t.isStarted&&!t.isReadyPromiseSettled&&n!==""&&(Ce.debug("Using datafile from cache"),t.currentDatafile=n,t.resolveReadyPromise())})},e}();Co.default=tf;var nf=X&&X.__extends||function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,i){r.__proto__=i}||function(r,i){for(var o in i)i.hasOwnProperty(o)&&(r[o]=i[o])},e(t,n)};return function(t,n){e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}(),rf=X&&X.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(xo,"__esModule",{value:!0});var of=So,af=rf(Co),sf=function(e){nf(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.makeGetRequest=function(n,r){return of.makeGetRequest(n,r)},t.prototype.getConfigDefaults=function(){return{autoUpdate:!1}},t}(af.default);xo.default=sf;Object.defineProperty(Ys,"__esModule",{value:!0});var lf=xo;Ys.HttpPollingDatafileManager=lf.default;var uf={NOTSET:0,DEBUG:1,INFO:2,WARNING:3,ERROR:4},cf={CONDITION_EVALUATOR_ERROR:"%s: Error evaluating audience condition of type %s: %s",DATAFILE_AND_SDK_KEY_MISSING:"%s: You must provide at least one of sdkKey or datafile. Cannot start Optimizely",EXPERIMENT_KEY_NOT_IN_DATAFILE:"%s: Experiment key %s is not in datafile.",FEATURE_NOT_IN_DATAFILE:"%s: Feature key %s is not in datafile.",IMPROPERLY_FORMATTED_EXPERIMENT:"%s: Experiment key %s is improperly formatted.",INVALID_ATTRIBUTES:"%s: Provided attributes are in an invalid format.",INVALID_BUCKETING_ID:"%s: Unable to generate hash for bucketing ID %s: %s",INVALID_DATAFILE:"%s: Datafile is invalid - property %s: %s",INVALID_DATAFILE_MALFORMED:"%s: Datafile is invalid because it is malformed.",INVALID_CONFIG:"%s: Provided Optimizely config is in an invalid format.",INVALID_JSON:"%s: JSON object is not valid.",INVALID_ERROR_HANDLER:'%s: Provided "errorHandler" is in an invalid format.',INVALID_EVENT_DISPATCHER:'%s: Provided "eventDispatcher" is in an invalid format.',INVALID_EVENT_TAGS:"%s: Provided event tags are in an invalid format.",INVALID_EXPERIMENT_KEY:"%s: Experiment key %s is not in datafile. It is either invalid, paused, or archived.",INVALID_EXPERIMENT_ID:"%s: Experiment ID %s is not in datafile.",INVALID_GROUP_ID:"%s: Group ID %s is not in datafile.",INVALID_LOGGER:'%s: Provided "logger" is in an invalid format.',INVALID_ROLLOUT_ID:"%s: Invalid rollout ID %s attached to feature %s",INVALID_USER_ID:"%s: Provided user ID is in an invalid format.",INVALID_USER_PROFILE_SERVICE:"%s: Provided user profile service instance is in an invalid format: %s.",NO_DATAFILE_SPECIFIED:"%s: No datafile specified. Cannot start optimizely.",NO_JSON_PROVIDED:"%s: No JSON object to validate against schema.",NO_VARIATION_FOR_EXPERIMENT_KEY:"%s: No variation key %s defined in datafile for experiment %s.",UNDEFINED_ATTRIBUTE:"%s: Provided attribute: %s has an undefined value.",UNRECOGNIZED_ATTRIBUTE:"%s: Unrecognized attribute %s provided. Pruning before sending event to Optimizely.",UNABLE_TO_CAST_VALUE:"%s: Unable to cast value %s to type %s, returning null.",USER_NOT_IN_FORCED_VARIATION:"%s: User %s is not in the forced variation map. Cannot remove their forced variation.",USER_PROFILE_LOOKUP_ERROR:'%s: Error while looking up user profile for user ID "%s": %s.',USER_PROFILE_SAVE_ERROR:'%s: Error while saving user profile for user ID "%s": %s.',VARIABLE_KEY_NOT_IN_DATAFILE:'%s: Variable with key "%s" associated with feature with key "%s" is not in datafile.',VARIATION_ID_NOT_IN_DATAFILE:"%s: No variation ID %s defined in datafile for experiment %s.",VARIATION_ID_NOT_IN_DATAFILE_NO_EXPERIMENT:"%s: Variation ID %s is not in the datafile.",INVALID_INPUT_FORMAT:"%s: Provided %s is in an invalid format.",INVALID_DATAFILE_VERSION:"%s: This version of the JavaScript SDK does not support the given datafile version: %s",INVALID_VARIATION_KEY:"%s: Provided variation key is in an invalid format."},df={ACTIVATE_USER:"%s: Activating user %s in experiment %s.",DISPATCH_CONVERSION_EVENT:"%s: Dispatching conversion event to URL %s with params %s.",DISPATCH_IMPRESSION_EVENT:"%s: Dispatching impression event to URL %s with params %s.",DEPRECATED_EVENT_VALUE:"%s: Event value is deprecated in %s call.",EVENT_KEY_NOT_FOUND:"%s: Event key %s is not in datafile.",EXPERIMENT_NOT_RUNNING:"%s: Experiment %s is not running.",FEATURE_ENABLED_FOR_USER:"%s: Feature %s is enabled for user %s.",FEATURE_NOT_ENABLED_FOR_USER:"%s: Feature %s is not enabled for user %s.",FEATURE_HAS_NO_EXPERIMENTS:"%s: Feature %s is not attached to any experiments.",FAILED_TO_PARSE_VALUE:'%s: Failed to parse event value "%s" from event tags.',FAILED_TO_PARSE_REVENUE:'%s: Failed to parse revenue value "%s" from event tags.',FORCED_BUCKETING_FAILED:"%s: Variation key %s is not in datafile. Not activating user %s.",INVALID_OBJECT:"%s: Optimizely object is not valid. Failing %s.",INVALID_CLIENT_ENGINE:"%s: Invalid client engine passed: %s. Defaulting to node-sdk.",INVALID_DEFAULT_DECIDE_OPTIONS:"%s: Provided default decide options is not an array.",INVALID_DECIDE_OPTIONS:"%s: Provided decide options is not an array. Using default decide options.",INVALID_VARIATION_ID:"%s: Bucketed into an invalid variation ID. Returning null.",NOTIFICATION_LISTENER_EXCEPTION:"%s: Notification listener for (%s) threw exception: %s",NO_ROLLOUT_EXISTS:"%s: There is no rollout of feature %s.",NOT_ACTIVATING_USER:"%s: Not activating user %s for experiment %s.",NOT_TRACKING_USER:"%s: Not tracking user %s.",PARSED_REVENUE_VALUE:'%s: Parsed revenue value "%s" from event tags.',PARSED_NUMERIC_VALUE:'%s: Parsed event value "%s" from event tags.',RETURNING_STORED_VARIATION:'%s: Returning previously activated variation "%s" of experiment "%s" for user "%s" from user profile.',ROLLOUT_HAS_NO_EXPERIMENTS:"%s: Rollout of feature %s has no experiments",SAVED_VARIATION:'%s: Saved variation "%s" of experiment "%s" for user "%s".',SAVED_VARIATION_NOT_FOUND:"%s: User %s was previously bucketed into variation with ID %s for experiment %s, but no matching variation was found.",SHOULD_NOT_DISPATCH_ACTIVATE:'%s: Experiment %s is not in "Running" state. Not activating user.',SKIPPING_JSON_VALIDATION:"%s: Skipping JSON schema validation.",TRACK_EVENT:"%s: Tracking event %s for user %s.",UNRECOGNIZED_DECIDE_OPTION:"%s: Unrecognized decide option %s provided.",USER_ASSIGNED_TO_EXPERIMENT_BUCKET:"%s: Assigned bucket %s to user with bucketing ID %s.",USER_BUCKETED_INTO_EXPERIMENT_IN_GROUP:"%s: User %s is in experiment %s of group %s.",USER_BUCKETED_INTO_TARGETING_RULE:"%s: User %s bucketed into targeting rule %s.",USER_IN_FEATURE_EXPERIMENT:"%s: User %s is in variation %s of experiment %s on the feature %s.",USER_IN_ROLLOUT:"%s: User %s is in rollout of feature %s.",USER_NOT_BUCKETED_INTO_EVERYONE_TARGETING_RULE:"%s: User %s not bucketed into everyone targeting rule due to traffic allocation.",USER_NOT_BUCKETED_INTO_EXPERIMENT_IN_GROUP:"%s: User %s is not in experiment %s of group %s.",USER_NOT_BUCKETED_INTO_ANY_EXPERIMENT_IN_GROUP:"%s: User %s is not in any experiment of group %s.",USER_NOT_BUCKETED_INTO_TARGETING_RULE:"%s User %s not bucketed into targeting rule %s due to traffic allocation. Trying everyone rule.",USER_NOT_IN_FEATURE_EXPERIMENT:"%s: User %s is not in any experiment on the feature %s.",USER_NOT_IN_ROLLOUT:"%s: User %s is not in rollout of feature %s.",USER_FORCED_IN_VARIATION:"%s: User %s is forced in variation %s.",USER_MAPPED_TO_FORCED_VARIATION:"%s: Set variation %s for experiment %s and user %s in the forced variation map.",USER_DOESNT_MEET_CONDITIONS_FOR_TARGETING_RULE:"%s: User %s does not meet conditions for targeting rule %s.",USER_MEETS_CONDITIONS_FOR_TARGETING_RULE:"%s: User %s meets conditions for targeting rule %s.",USER_HAS_VARIATION:"%s: User %s is in variation %s of experiment %s.",USER_HAS_FORCED_DECISION_WITH_RULE_SPECIFIED:"Variation (%s) is mapped to flag (%s), rule (%s) and user (%s) in the forced decision map.",USER_HAS_FORCED_DECISION_WITH_NO_RULE_SPECIFIED:"Variation (%s) is mapped to flag (%s) and user (%s) in the forced decision map.",USER_HAS_FORCED_DECISION_WITH_RULE_SPECIFIED_BUT_INVALID:"Invalid variation is mapped to flag (%s), rule (%s) and user (%s) in the forced decision map.",USER_HAS_FORCED_DECISION_WITH_NO_RULE_SPECIFIED_BUT_INVALID:"Invalid variation is mapped to flag (%s) and user (%s) in the forced decision map.",USER_HAS_FORCED_VARIATION:"%s: Variation %s is mapped to experiment %s and user %s in the forced variation map.",USER_HAS_NO_VARIATION:"%s: User %s is in no variation of experiment %s.",USER_HAS_NO_FORCED_VARIATION:"%s: User %s is not in the forced variation map.",USER_HAS_NO_FORCED_VARIATION_FOR_EXPERIMENT:"%s: No experiment %s mapped to user %s in the forced variation map.",USER_NOT_IN_ANY_EXPERIMENT:"%s: User %s is not in any experiment of group %s.",USER_NOT_IN_EXPERIMENT:"%s: User %s does not meet conditions to be in experiment %s.",USER_RECEIVED_DEFAULT_VARIABLE_VALUE:'%s: User "%s" is not in any variation or rollout rule. Returning default value for variable "%s" of feature flag "%s".',FEATURE_NOT_ENABLED_RETURN_DEFAULT_VARIABLE_VALUE:'%s: Feature "%s" is not enabled for user %s. Returning the default variable value "%s".',VARIABLE_NOT_USED_RETURN_DEFAULT_VARIABLE_VALUE:'%s: Variable "%s" is not used in variation "%s". Returning default value.',USER_RECEIVED_VARIABLE_VALUE:'%s: Got variable value "%s" for variable "%s" of feature flag "%s"',VALID_DATAFILE:"%s: Datafile is valid.",VALID_USER_PROFILE_SERVICE:"%s: Valid user profile service provided.",VARIATION_REMOVED_FOR_USER:"%s: Variation mapped to experiment %s has been removed for user %s.",VARIABLE_REQUESTED_WITH_WRONG_TYPE:'%s: Requested variable type "%s", but variable is of type "%s". Use correct API to retrieve value. Returning None.',VALID_BUCKETING_ID:'%s: BucketingId is valid: "%s"',BUCKETING_ID_NOT_STRING:"%s: BucketingID attribute is not a string. Defaulted to userId",EVALUATING_AUDIENCE:'%s: Starting to evaluate audience "%s" with conditions: %s.',EVALUATING_AUDIENCES_COMBINED:'%s: Evaluating audiences for %s "%s": %s.',AUDIENCE_EVALUATION_RESULT:'%s: Audience "%s" evaluated to %s.',AUDIENCE_EVALUATION_RESULT_COMBINED:"%s: Audiences for %s %s collectively evaluated to %s.",MISSING_ATTRIBUTE_VALUE:'%s: Audience condition %s evaluated to UNKNOWN because no value was passed for user attribute "%s".',UNEXPECTED_CONDITION_VALUE:"%s: Audience condition %s evaluated to UNKNOWN because the condition value is not supported.",UNEXPECTED_TYPE:'%s: Audience condition %s evaluated to UNKNOWN because a value of type "%s" was passed for user attribute "%s".',UNEXPECTED_TYPE_NULL:'%s: Audience condition %s evaluated to UNKNOWN because a null value was passed for user attribute "%s".',UNKNOWN_CONDITION_TYPE:"%s: Audience condition %s has an unknown condition type. You may need to upgrade to a newer release of the Optimizely SDK.",UNKNOWN_MATCH_TYPE:"%s: Audience condition %s uses an unknown match type. You may need to upgrade to a newer release of the Optimizely SDK.",UPDATED_OPTIMIZELY_CONFIG:"%s: Updated Optimizely config to revision %s (project id %s)",OUT_OF_BOUNDS:'%s: Audience condition %s evaluated to UNKNOWN because the number value for user attribute "%s" is not in the range [-2^53, +2^53].',UNABLE_TO_ATTACH_UNLOAD:'%s: unable to bind optimizely.close() to page unload event: "%s"'},ff={BOT_FILTERING:"$opt_bot_filtering",BUCKETING_ID:"$opt_bucketing_id",STICKY_BUCKETING_KEY:"$opt_experiment_bucket_map",USER_AGENT:"$opt_user_agent",FORCED_DECISION_NULL_RULE_KEY:"$opt_null_rule_key"},pf="javascript-sdk",hf="node-sdk",vf="react-sdk",mf="react-native-sdk",gf="react-native-js-sdk",yf="4.9.4",_f="4.9.4",wf={AB_TEST:"ab-test",FEATURE:"feature",FEATURE_TEST:"feature-test",FEATURE_VARIABLE:"feature-variable",ALL_FEATURE_VARIABLES:"all-feature-variables",FLAG:"flag"},bf={FEATURE_TEST:"feature-test",ROLLOUT:"rollout",EXPERIMENT:"experiment"},Ef={RULE:"rule",EXPERIMENT:"experiment"},xf={BOOLEAN:"boolean",DOUBLE:"double",INTEGER:"integer",STRING:"string",JSON:"json"},ar={V2:"2",V3:"3",V4:"4"},Sf={SDK_NOT_READY:"Optimizely SDK not configured properly yet.",FLAG_KEY_INVALID:'No flag was found for key "%s".',VARIABLE_VALUE_INVALID:'Variable value for key "%s" is invalid or wrong type.'},Ci;(function(e){e.ACTIVATE="ACTIVATE:experiment, user_id,attributes, variation, event",e.DECISION="DECISION:type, userId, attributes, decisionInfo",e.LOG_EVENT="LOG_EVENT:logEvent",e.OPTIMIZELY_CONFIG_UPDATE="OPTIMIZELY_CONFIG_UPDATE",e.TRACK="TRACK:event_key, user_id, attributes, event_tags, event"})(Ci||(Ci={}));var Cf=Object.freeze({__proto__:null,LOG_LEVEL:uf,ERROR_MESSAGES:cf,LOG_MESSAGES:df,CONTROL_ATTRIBUTES:ff,JAVASCRIPT_CLIENT_ENGINE:pf,NODE_CLIENT_ENGINE:hf,REACT_CLIENT_ENGINE:vf,REACT_NATIVE_CLIENT_ENGINE:mf,REACT_NATIVE_JS_CLIENT_ENGINE:gf,BROWSER_CLIENT_VERSION:yf,NODE_CLIENT_VERSION:_f,DECISION_NOTIFICATION_TYPES:wf,DECISION_SOURCES:bf,AUDIENCE_EVALUATION_TYPES:Ef,FEATURE_VARIABLE_TYPES:xf,DATAFILE_VERSIONS:ar,DECISION_MESSAGES:Sf,get NOTIFICATION_TYPES(){return Ci}});ar.V2,ar.V3,ar.V4;(function(){function e(){}return e.prototype.log=function(){},e})();function If(e){return new le.ConsoleLogHandler(e)}var xa;(function(e){e.BOOLEAN="boolean",e.DOUBLE="double",e.INTEGER="integer",e.STRING="string",e.JSON="json"})(xa||(xa={}));var Sa;(function(e){e.DISABLE_DECISION_EVENT="DISABLE_DECISION_EVENT",e.ENABLED_FLAGS_ONLY="ENABLED_FLAGS_ONLY",e.IGNORE_USER_PROFILE_SERVICE="IGNORE_USER_PROFILE_SERVICE",e.INCLUDE_REASONS="INCLUDE_REASONS",e.EXCLUDE_VARIABLES="EXCLUDE_VARIABLES"})(Sa||(Sa={}));le.getLogger();le.getLogger();le.getLogger();le.getLogger();le.getLogger("EVENT_BUILDER");le.getLogger();le.setLogHandler(If());le.setLogLevel(le.LogLevel.INFO);let Xn;const kf=new Uint8Array(16);function Tf(){if(!Xn&&(Xn=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!Xn))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Xn(kf)}const ce=[];for(let e=0;e<256;++e)ce.push((e+256).toString(16).slice(1));function Lf(e,t=0){return(ce[e[t+0]]+ce[e[t+1]]+ce[e[t+2]]+ce[e[t+3]]+"-"+ce[e[t+4]]+ce[e[t+5]]+"-"+ce[e[t+6]]+ce[e[t+7]]+"-"+ce[e[t+8]]+ce[e[t+9]]+"-"+ce[e[t+10]]+ce[e[t+11]]+ce[e[t+12]]+ce[e[t+13]]+ce[e[t+14]]+ce[e[t+15]]).toLowerCase()}const Rf=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),Ca={randomUUID:Rf};function mt(e,t,n){if(Ca.randomUUID&&!t&&!e)return Ca.randomUUID();e=e||{};const r=e.random||(e.rng||Tf)();if(r[6]=r[6]&15|64,r[8]=r[8]&63|128,t){n=n||0;for(let i=0;i<16;++i)t[n+i]=r[i];return t}return Lf(r)}const zt="ul-app";var U=(e=>(e.Caption="ul-caption",e.CardContainer="ul-card__container",e.CardMainContent="ul-card-main-content",e.Choice="choice",e.ChoiceCheckbox="select-checkbox",e.ChoiceGroup="ul-card__choices",e.ChoiceLabel="select-label",e.ChoiceLabelContainer="choice-label-container",e.ChoiceRadio="select-radio",e.ChoiceTextEntryContainer="choice-text-entry-container",e.ChoiceTextInput="choice-text-input",e.CloseButton="close-btn",e.CloseContainer="close-container",e.ConsentLegalNameInput="ul-consent-legal__name-input",e.CustomStyle="ul-custom-style",e.DesktopSuffix="--desktop",e.FadeInTransition="fade-in-transition",e.LikertNumber="likert-number",e.LikertSmiley="likert-smiley",e.LikertStar="likert-star",e.LoadingSpinner="ul-loading-spinner",e.LoadingSpinnerContainer="ul-loading-spinner-container",e.LoadingSpinnerFirst="first",e.LoadingSpinnerFourth="fourth",e.LoadingSpinnerSecond="second",e.LoadingSpinnerThird="third",e.MobileSuffix="--mobile",e.NPSNumber="nps-number",e.OpenTextInput="ul-card-text__input",e.QuestionHeader="ul-question",e.VideoCard="ul-card--video",e.CheckmarkButton="ul-button-checkmark",e.InactiveButton="ul-button-inactive",e.LeftAlignButton="ul-button-left-align",e.ButtonDisabled="sprig-button-disabled",e.SkipButton="ul-card-skip__button",e))(U||{});const To="#e6e6e6",En="#bd282a",Af=500,Uf=1030;var be=(e=>(e.Preview="sprig.previewKey",e.Credentials="userleap.ids",e.PageViews="userleap.pageviews",e))(be||{});const Zs=()=>{try{return window.parent.Intercom}catch(e){return console.error(e),null}},Of=()=>{const e=Zs();!e||(e.ul_wasVisible&&e("update",{hide_default_launcher:!1}),delete e.ul_wasVisible)},Df=()=>{const e=Zs();!e||(e.ul_wasVisible=!!document.querySelector("iframe.intercom-launcher-frame"),e.ul_wasVisible&&e("update",{hide_default_launcher:!0}))},Pf=Object.freeze(Object.defineProperty({__proto__:null,enable:Of,disable:Df},Symbol.toStringTag,{value:"Module"})),Ia=[Pf];class Ii{static disable(){Ia.forEach(t=>t.disable())}static enable(){Ia.forEach(t=>t.enable())}}const Nf=1,Jt=e=>e instanceof HTMLElement,Vf=e=>e instanceof HTMLInputElement,xn=e=>e instanceof HTMLTextAreaElement,Xs=(e,t,n)=>{const r=e.createElement("style");n&&(r.nonce=n),r.textContent=t,r.id=U.CustomStyle,e.head.appendChild(r)},Js=e=>{const t=e.querySelector(`.${U.CardContainer}`);let n=600,r=0;if(t){n=t.scrollHeight;const i=getComputedStyle(t),o=parseFloat(i.marginTop)+parseFloat(i.marginBottom),a=parseFloat(i.borderTopWidth)+parseFloat(i.borderBottomWidth);r=o+a}return n+r+Nf},Mf=e=>{const t=e.querySelector(`.${U.CardContainer}`);t&&(t.scrollTop=0)};var jf=class extends Error{constructor(e,t,n){super(`Possible EventEmitter memory leak detected. ${n} ${t.toString()} listeners added. Use emitter.setMaxListeners() to increase limit`),this.emitter=e,this.type=t,this.count=n,this.name="MaxListenersExceededWarning"}},el=class{static listenerCount(e,t){return e.listenerCount(t)}constructor(){this.events=new Map,this.maxListeners=el.defaultMaxListeners,this.hasWarnedAboutPotentialMemoryLeak=!1}_emitInternalEvent(e,t,n){this.emit(e,t,n)}_getListeners(e){return Array.prototype.concat.apply([],this.events.get(e))||[]}_removeListener(e,t){const n=e.indexOf(t);return n>-1&&e.splice(n,1),[]}_wrapOnceListener(e,t){const n=(...r)=>(this.removeListener(e,n),t.apply(this,r));return Object.defineProperty(n,"name",{value:t.name}),n}setMaxListeners(e){return this.maxListeners=e,this}getMaxListeners(){return this.maxListeners}eventNames(){return Array.from(this.events.keys())}emit(e,...t){const n=this._getListeners(e);return n.forEach(r=>{r.apply(this,t)}),n.length>0}addListener(e,t){this._emitInternalEvent("newListener",e,t);const n=this._getListeners(e).concat(t);if(this.events.set(e,n),this.maxListeners>0&&this.listenerCount(e)>this.maxListeners&&!this.hasWarnedAboutPotentialMemoryLeak){this.hasWarnedAboutPotentialMemoryLeak=!0;const r=new jf(this,e,this.listenerCount(e));console.warn(r)}return this}on(e,t){return this.addListener(e,t)}once(e,t){return this.addListener(e,this._wrapOnceListener(e,t))}prependListener(e,t){const n=this._getListeners(e);if(n.length>0){const r=[t].concat(n);this.events.set(e,r)}else this.events.set(e,n.concat(t));return this}prependOnceListener(e,t){return this.prependListener(e,this._wrapOnceListener(e,t))}removeListener(e,t){const n=this._getListeners(e);return n.length>0&&(this._removeListener(n,t),this.events.set(e,n),this._emitInternalEvent("removeListener",e,t)),this}off(e,t){return this.removeListener(e,t)}removeAllListeners(e){return e?this.events.delete(e):this.events.clear(),this}listeners(e){return Array.from(this._getListeners(e))}listenerCount(e){return this._getListeners(e).length}rawListeners(e){return this.listeners(e)}},tl=el;tl.defaultMaxListeners=10;const $=new tl;var _n=(e=>(e.BottomLeft="bottomLeft",e.BottomRight="bottomRight",e.Center="center",e.TopLeft="topLeft",e.TopRight="topRight",e))(_n||{}),He=(e=>(e.Error="x-ul-error",e.EnvironmentID="x-ul-environment-id",e.InstallationMethod="x-ul-installation-method",e.PartnerAnonymousId="x-ul-anonymous-id",e.Platform="userleap-platform",e.PreviewMode="x-ul-preview-mode",e.UserID="x-ul-user-id",e.VisitorID="x-ul-visitor-id",e))(He||{}),Pt=(e=>(e.Email="email",e.Link="link",e.Web="web",e))(Pt||{}),rt=(e=>(e.Npm="web-npm",e.NpmBundled="web-npm-bundled",e.Gtm="web-gtm",e.Segment="web-segment",e.SegmentAndroid="android-segment",e.SegmentReactNative="react-native-segment",e.SegmentIOS="ios-segment",e.Snippet="web-snippet",e))(rt||{});const Sr=e=>new Promise(t=>{setTimeout(()=>{t()},e)}),Wt=({"userleap-platform":e})=>e!==Pt.Web,ie=(e,t)=>{const n=t?U.MobileSuffix:U.DesktopSuffix;return[e+n,e]},Bf=(e,t)=>[e,`${e}__${t}`];class Ff{constructor(t){fe(this,"payload");fe(this,"promise");fe(this,"reject",()=>{});fe(this,"resolve",()=>{});this.payload=t,this.promise=new Promise((n,r)=>{this.reject=r,this.resolve=n})}resolveRequest(t){this.resolve(t)}}const Hf={RATELIMIT_RESET_DEFAULT:10};let nl=!1,rl="",Jn=!1,il=!1,sr=[];const Kf=e=>e._config&&e._config.installationMethod?e._config.installationMethod:e._gtm?rt.Gtm:e._segment?rt.Segment:rt.Snippet,ki=e=>{var t;(t=e==null?void 0:e.blockedURI)!=null&&t.includes(window.UserLeap._API_URL)&&(il=!0,console.warn(`[Sprig] ${e.blockedURI} is blocked by Content-Security-Policy`),document.removeEventListener("securitypolicyviolation",ki))},Ti=(e="")=>{nl=!0,rl=e};function en(e={}){const t={"Content-Type":"application/json","userleap-platform":Pt.Web,"x-ul-sdk-version":"2.24.11",[He.InstallationMethod]:Kf(e)};if(e.envId&&(t[He.EnvironmentID]=e.envId),e.token&&(t.Authorization="Bearer "+e.token),e.userId&&(t[He.UserID]=e.userId),e.visitorId&&(t[He.VisitorID]=e.visitorId),e.partnerAnonymousId&&(t[He.PartnerAnonymousId]=e.partnerAnonymousId),e.mobileHeadersJSON){const n=JSON.parse(e.mobileHeadersJSON);Object.assign(t,n)}return e.locale&&(t["accept-language"]=e.locale),window.previewMode&&(t[He.PreviewMode]="1"),t}const ka=async(e,t,n)=>{if(e)return{status:429};{const r=new Ff(n);return sr.push(r),r.promise}},it=async(e,t,n=0,r=!1,i=!1)=>{const o={url:e,options:t,attempt:n,shouldDropOnRateLimit:r};if(Jn&&!i)return ka(r,i,o);const a={ok:!1,reportError:!1};if(nl)return console.info(`UserLeap - ${rl}`),a;try{t.headers=Object.assign(en(),t.headers);const s=await fetch(e,t);if(s.status===429)if(!Jn&&!r||i){Jn=!0;const u=s.headers.has("ratelimit-reset")?Number(s.headers.get("ratelimit-reset")):Hf.RATELIMIT_RESET_DEFAULT;return await Sr(u*1e3),it(e,t,0,r,!0)}else return ka(r,!1,o);if(Jn=!1,sr.length&&(sr.map(l=>{const{url:u,options:c,attempt:d,shouldDropOnRateLimit:f}=l.payload;it(u,c,d,f).then(p=>{l.resolveRequest(p)})}),sr=[]),s.ok){if(s.status===249)return Ti(),a;const l=await s.text();try{return l&&l!=="OK"&&(s.json=JSON.parse(l)),s}catch{return{ok:!1,reportError:!1,error:new Error(`failed parsing response json for ${e} - ${l}`)}}}return s}catch(s){const l=n+1;return l>5||il?{ok:!1,reportError:!1,error:s}:(await Sr(Math.pow(2,n)*1e3),it(e,t,l))}};var ol={exports:{}};(function(e,t){(function(n,r){e.exports=r()})(X,function(){var n=function(o,a){if(a=a||{},typeof o!="function")throw new i("fetch must be a function");if(typeof a!="object")throw new i("defaults must be an object");if(a.retries!==void 0&&!r(a.retries))throw new i("retries must be a positive integer");if(a.retryDelay!==void 0&&!r(a.retryDelay)&&typeof a.retryDelay!="function")throw new i("retryDelay must be a positive integer or a function returning a positive integer");if(a.retryOn!==void 0&&!Array.isArray(a.retryOn)&&typeof a.retryOn!="function")throw new i("retryOn property expects an array or function");var s={retries:3,retryDelay:1e3,retryOn:[]};return a=Object.assign(s,a),function(u,c){var d=a.retries,f=a.retryDelay,p=a.retryOn;if(c&&c.retries!==void 0)if(r(c.retries))d=c.retries;else throw new i("retries must be a positive integer");if(c&&c.retryDelay!==void 0)if(r(c.retryDelay)||typeof c.retryDelay=="function")f=c.retryDelay;else throw new i("retryDelay must be a positive integer or a function returning a positive integer");if(c&&c.retryOn)if(Array.isArray(c.retryOn)||typeof c.retryOn=="function")p=c.retryOn;else throw new i("retryOn property expects an array or function");return new Promise(function(h,v){var g=function(_){var b=typeof Request<"u"&&u instanceof Request?u.clone():u;o(b,c).then(function(E){if(Array.isArray(p)&&p.indexOf(E.status)===-1)h(E);else if(typeof p=="function")try{return Promise.resolve(p(_,null,E)).then(function(m){m?w(_,null,E):h(E)}).catch(v)}catch(m){v(m)}else _<d?w(_,null,E):h(E)}).catch(function(E){if(typeof p=="function")try{Promise.resolve(p(_,E,null)).then(function(m){m?w(_,E,null):v(E)}).catch(function(m){v(m)})}catch(m){v(m)}else _<d?w(_,E,null):v(E)})};function w(_,b,E){var m=typeof f=="function"?f(_,b,E):f;setTimeout(function(){g(++_)},m)}g(0)})}};function r(o){return Number.isInteger(o)&&o>=0}function i(o){this.name="ArgumentError",this.message=o}return n})})(ol);const $f=ol.exports;class qf{constructor(t){fe(this,"awaitingResolvers",[]);fe(this,"activeCount",0);this.capacity=t}async acquire(){if(this.activeCount<this.capacity){this.activeCount++;return}return new Promise(t=>{this.awaitingResolvers.push(t)})}release(){const t=this.awaitingResolvers.shift();t&&this.activeCount<=this.capacity?t():this.activeCount--}async execute(t){try{return await this.acquire(),await t()}finally{this.release()}}setLimit(t){this.capacity=t}}const al=new qf(2),Gf=e=>al.setLimit(e),zf=$f(fetch),Wf=async(e,t=3)=>al.execute(async()=>{const r=(await zf(e.uploadUrl,{body:e.data,method:"PUT",retries:t,retryDelay:i=>Math.pow(2,i)*1e3})).headers.get("ETag");if(!r)throw new Error(`Upload response did not include etag for upload ${e.uploadId}, part ${e.chunkIndex}`);return r}),sl=async({apiUrl:e,surveyId:t,uploadId:n,etags:r,headers:i,responseGroupUuid:o,replayDuration:a,eventDigest:s},l=!1)=>{var u;if(!(!l&&!n&&!r))return it(`${e}/sdk/1/completeSessionReplay`,{method:"POST",body:JSON.stringify({etags:r,uploadId:n,responseGroupUuid:o,surveyId:t,replayDuration:a,eventDigest:s,userAgent:(u=window==null?void 0:window.navigator)==null?void 0:u.userAgent}),headers:i})};/*! *****************************************************************************
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
  `,Vm=e=>{const t=M.document.createElement("div");return t.className="ul-video-player-loading",t.id=ia(e),["first","second","third","fourth"].map(n=>{const r=M.document.createElement("div");r.className=n,t.appendChild(r)}),t},ia=e=>e+"-loading-spiner",se="hidden",Cs=".m3u8",gi="questionId",yi="ul-video-recorder-camera-off-button",_i="ul-recording-in-session",Mm=[{type:"link",content:`${Tt}/dependencies/videojs-record-4.5.0.min.css`},{type:"script",content:`${Tt}/dependencies/RecordRTC-5.6.2.js`},{type:"script",content:`${Tt}/dependencies/adapter.8.0.0.min.js`},{type:"script",content:`${Tt}/dependencies/videojs-record-4.5.0.min.js`},{type:"script",content:`${Tt}/userleap-web-upchunk-v2.2.2.js`}],ic=[{type:"link",content:`${Tt}/dependencies/video-js-7.18.0.min.css`},{type:"script",content:`${Tt}/dependencies/video-js-7.18.0.min.js`},{type:"style",content:Nm}],oc="-video-player",ac="-secondary-video-player",sc="-video-recorder";let Fe,Is;const pt=async({event:e,apiBase:t,headers:n,visitorId:r,envId:i,metadata:o})=>{const a=M.document.documentElement;if(!r||!i)return;const s={event:`SDK - ${e}`,visitorId:r,environmentId:i,metadata:{...o||{},screenWidth:window.screen.width,screenHeight:window.screen.height,clientWidth:a.clientWidth,clientHeight:a.clientHeight,location:window.location.href,language:navigator.language}};(await fetch(`${t}/sdk/1/visitors/${r}/analytics`,{method:"POST",cache:"no-cache",headers:n,body:JSON.stringify(s)})).ok||console.warn("[Sprig] (ERR-444) Failed to track analytics",e)},et=async(e,t,n,r,i,o)=>{pt({event:`Video Error ${t}`,apiBase:n,headers:r,visitorId:i,envId:o,metadata:{errorMessage:e.message}});const a=M.document.documentElement,s={screenWidth:window.screen.width,screenHeight:window.screen.height,clientWidth:a.clientWidth,clientHeight:a.clientHeight,location:window.location.href,language:navigator.language},l={action:t,err:{message:e.message,stack:e.stack},meta:s,vid:i,envId:o};(await fetch(`${n}/sdk/1/errors`,{method:"POST",cache:"no-cache",headers:{...r,"userleap-platform":"video_recorder","x-ul-error":window.btoa(`userleap-${Date.now()}-error`)},body:JSON.stringify(l)})).ok||console.warn("[Sprig] (ERR-444) Failed to report error to API",e)},jm=(e,{type:t,content:n})=>new Promise(function(r,i){let o;t==="script"?(o=M.document.createElement("script"),o.src=n):t==="link"?(o=M.document.createElement("link"),o.rel="stylesheet",o.href=n,o.type="text/css"):(o=M.document.createElement("style"),o.innerHTML=n),o.onload=function(){r(n)},o.onerror=function(){i(n)},o.async=!1,o.id=btoa(n),e.appendChild(o)}),lc=(e,t)=>{if(e.length===0)return t&&t();Promise.all(e.reduce((n,r)=>(n.push(jm(M.document.head,r)),n),[])).then(()=>{M.videojs=M.document.defaultView.videojs,t&&t()}).catch(function(n){console.log(n+" failed to load")})},ks=(e,t,n)=>{if(t==="start"&&(e.style.visibility="visible"),t==="none")e.style.visibility=se;else if(t==="success")e.style.visibility=se,e.innerHTML="Upload succeeded!";else{const r=Math.round(parseFloat(n));e.innerHTML=`Uploading <span class="ul-upload-progress-label__time">${r}%</span>`,e.style.background=`linear-gradient(to right, #E0E0EB 0%, #E0E0EB ${r}%, #FCFCFD ${r}%, #FCFCFD 100%)`}},wi=(e,t)=>{const n=M.videojs(e.id());return n==null?void 0:n.payload[t]},Bm=(e,t,n,r,i)=>{const{surveyId:o,responseGroupUid:a,visitorId:s,envId:l}=e.payload;e.on("deviceError",function(){console.warn("device error: ",e.deviceErrorCode),e.deviceErrorCode.message==="Permission denied"?(e.deviceButton.addClass("permission-denied"),n&&n(F.ERROR,{type:F.PERMISSION_DENIED}),pt({event:"Video Permission Denied",apiBase:t,headers:i,visitorId:s,envId:l,metadata:{questionId:wi(e,gi),responseGroupUid:a,surveyId:o}})):(n&&n(F.ERROR,{type:F.OTHER}),et(new Error(e.deviceErrorCode.message),"recorderDeviceError",t,i,s,l))}),e.on("error",function(u,c){et(c||e.error(),"recorderError",t,i,s,l)}),e.on("startRecord",function(u,c){r(e.uploadProgressLabel,"none"),pt({event:"Video Record Start",apiBase:t,headers:i,visitorId:s,envId:l,metadata:{questionId:wi(e,gi),responseGroupUid:a,surveyId:o}})}),e.on("finishRecord",async function(){r(e.uploadProgressLabel,"start",0);const u=wi(e,gi);if(!o){const v="internal error: missing fields in payload";return n&&n(F.ERROR,{type:F.OTHER}),et(new Error(v),"finishRecord",t,i,s,l),null}e.record().stopDevice();const c=e.cameraOff?F.MEDIA_TYPE_AUDIO:F.MEDIA_TYPE_VIDEO,d=mt();pt({event:"Video Record Finish",apiBase:t,headers:i,visitorId:s,envId:l,metadata:{mediaRecordingUid:d,questionId:u,responseGroupUid:a,surveyId:o,mediaType:c}});const f={surveyId:o,updatedAt:new Date().toISOString(),mediaType:c,mediaRecordingUid:d};u&&(f.questionId=u),a&&(f.responseGroupUid=a),s&&(f.visitorId=s);const h=await(async()=>{const v=await fetch(`${t}/2/environments/integrations/upload`,{method:"POST",cache:"no-cache",headers:{"Content-Type":"application/json"},body:JSON.stringify(f)});if(v.ok){const g=await v.json();return n&&n(F.UPLOAD_STARTED,{[F.UPLOAD_ID]:g.upload.id,[F.MEDIA_TYPE]:c,[F.MEDIA_RECORDING_UID]:d}),g.upload.url}else return n&&n(F.ERROR,{type:F.OTHER,response:v}),et(new Error("failed to get upload response with url"),"finishRecord",t,i,s,l),null})();!h||(Fe=M.document.defaultView.UpChunk.createUpload({endpoint:h,file:new M.document.defaultView.File([e.recordedData],`recording ${c} ${Date.now()}`),chunkSize:5120}),Fe.startTime=Date.now(),pt({event:"Video Upload Start",apiBase:t,headers:i,visitorId:s,envId:l,metadata:{mediaRecordingUid:d,questionId:u,responseGroupUid:a,surveyId:o,mediaType:c,url:h}}),Fe.on("error",v=>{r(e.uploadProgressLabel,"none"),n&&n(F.UPLOAD_FINISHED,{[F.MEDIA_RECORDING_UID]:d}),et(v,"finishRecord",t,i,s,l)}),Fe.on("progress",v=>{n&&n(F.UPLOAD_PROGRESS,{[F.MEDIA_RECORDING_UID]:d,[F.UPLOAD_PROGRESS_PCT]:v.detail}),r(e.uploadProgressLabel,"progress",v.detail)}),Fe.on("success",()=>{r(e.uploadProgressLabel,"success"),n&&n(F.UPLOAD_FINISHED,{[F.MEDIA_RECORDING_UID]:d}),pt({event:"Video Upload Success",apiBase:t,headers:i,visitorId:s,envId:l,metadata:{mediaRecordingUid:d,questionId:u,responseGroupUid:a,surveyId:o,mediaType:c,url:h,elapsedMs:Fe.startTime&&Date.now()-Fe.startTime}})}))})},uc=(e,t)=>{const n=new(M.videojs.getComponent("Component"))(e);return n.addClass("ul-buttons-panel"),t.map(r=>{n.addChild(r)}),Fm(n),n},Fm=e=>{e.children().forEach(t=>{if(Oe[t.name_]){const n=yr(Oe[t.name_],`ul-${Oe[t.name_]}`);t.el_.appendChild(n)}})},yr=(e,t="")=>{const n=M.document.createElement("span");return n.className="ul-button-text",n.innerHTML=e,n.id=t,n},cc=(e,t,n,r,i=!1,o)=>{e.addClass("ul-video-player");const a=new(M.videojs.getComponent("Component"))(e);a.addClass("ul-control-panel"),e.progressBar=a.addChild("ProgressControl"),n&&e.src(n),e.audioPlayerPlaceholder=new(M.videojs.getComponent("Component"))(e),e.audioPlayerPlaceholder.addClass("ul-audio-recorder-placeholder");const s=n&&n.src?Ym(n.src):null;n&&(i||!s)?(e.children()[0].classList.add("vjs-hidden"),M.document.getElementById(`${e.id()}_html5_api`).style.height="0px"):(e.audioPlayerPlaceholder.hide(),M.document.getElementById(`${e.id()}_html5_api`).style.height="100%",s&&e.poster(s)),e.on("play",()=>{!i&&n&&!s&&$m(e,!1),o==null||o.play()}),e.on("pause",()=>{o==null||o.pause()}),e.on("seeked",()=>{o==null||o.currentTime(e.currentTime())}),e.on("ratechange",()=>{o==null||o.playbackRate(e.playbackRate())}),e.addChild(e.audioPlayerPlaceholder,{},1),a.addChild(t),e.addChild(a),r&&r(e)},Hm=(e,t,n)=>{e.addClass(`ul${ac}`);const r=new(M.videojs.getComponent("Component"))(e);t&&e.src(t),e.addChild(r),n&&n(e)},Km=(e,t,n,r,i,o,a,s=!1)=>{Is=Date.now();const u=jr(t,{controls:!1,bigPlayButton:!1,fluid:!1,width:1280,height:720,playsinline:!0,plugins:{record:{audio:!0,video:{mandatory:{minWidth:1280,minHeight:720}},frameWidth:1280,frameHeight:720,maxLength:600,autoMuteDevice:!0}}});if(!u)return;u.payload=n;const{surveyId:c,questionId:d,responseGroupUid:f,visitorId:p,envId:h}=n;let v;const g=D=>{const k=yi,P=yi+"-audio-only";ks(u.uploadProgressLabel,"none"),Fe&&Fe.startTime>=Is&&Fe.abort();const R=M.document.getElementById("ul-camera-button");D?(u.children()[0].classList.add("vjs-hidden"),E.removeClass(k),E.addClass(P),R.innerHTML=Oe.TurnOnCamera,u.audioPlayerPlaceholder.removeClass("vjs-hidden"),v==null||v.getTracks().forEach(O=>{O.stop()}),window.navigator.mediaDevices.getUserMedia({video:!0,audio:!0}).then(O=>{v=O,O.getVideoTracks().forEach(Y=>{Y.enabled=!1}),u.record().onDeviceReady(O)}).catch(u.record().onDeviceError.bind(u.record()))):(v==null||v.getVideoTracks().forEach(O=>{O.enabled=!0}),u.children()[0].classList.remove("vjs-hidden"),u.record().getDevice(),E.removeClass(P),E.addClass(k),R.innerHTML=Oe.TurnOffCamera,u.audioPlayerPlaceholder.addClass("vjs-hidden"))},w=new(M.videojs.getComponent("Button"))(u,{clickHandler:()=>{w.hasClass(se)||(pt({event:"Video Delete Button Clicked",apiBase:r,headers:a,visitorId:p,envId:h,metadata:{questionId:d,responseGroupUid:f,surveyId:c}}),g(u.cameraOff),i(F.DELETE,{}),E.removeClass(se),w.addClass(se))}});w.addClass("ul-video-recorder-delete-button"),w.el_.appendChild(yr(Oe.DeleteButton,"ul-delete-button"));const _=M.document.getElementById(t),b=()=>{_.classList.contains("vjs-fullscreen")&&u.cameraOff?_.style.display="table":_.style.display="flex"};b();const E=new(M.videojs.getComponent("Button"))(u,{clickHandler:()=>{u.record().isRecording()||(u.cameraOff=!u.cameraOff,pt({event:"Video Camera Button Clicked",apiBase:r,headers:a,visitorId:n.visitorId,envId:n.envId,metadata:{questionId:d,responseGroupUid:f,surveyId:c,cameraOff:u.cameraOff}}),g(u.cameraOff),!w.hasClass(se)&&w.addClass(se),i(F.DELETE,{}),b())}});E.addClass(yi),E.el_.appendChild(yr(Oe.TurnOffCamera,"ul-camera-button"));const m=new(M.videojs.getComponent("Button"))(u,{clickHandler:()=>{const D=M.document.getElementById("ul-recorder-toggle");if(u.record().isRecording())u.record().stop(),D&&(D.innerHTML=Oe.RecordButton),m.removeClass(_i),w.removeClass(se);else{const k=M.document.getElementById("ul-recording-countdown-screen");if(k)k.remove(),D&&(D.innerHTML=Oe.RecordButton),g(u.cameraOff),i(F.DELETE,{}),E.removeClass(se),w.addClass(se),m.removeClass(_i),C.show();else{m.addClass(_i),C.hide(),E.addClass(se),w.addClass(se),D&&(D.innerHTML=Oe.StopButton);const P=M.document.createElement("div");P.id="ul-recording-countdown-screen",_.insertBefore(P,_.children[1]),P.style.height=`${_.offsetHeight}px`,dc(u,3)}}}});m.addClass("ul-video-recorder-toggle-button"),m.el_.appendChild(yr(Oe.RecordButton,"ul-recorder-toggle"));const x=M.document.createElement("p");x.style.visibility="hidden",x.className="ul-upload-progress-label",e.appendChild(x),u.uploadProgressLabel=x;const I=uc(u,[w,E,"PlayToggle",m,"FullscreenToggle"]),C=I.children().find(D=>D.name_==="FullscreenToggle");C.hasClass("vjs-disabled")&&C.hide();const S=I.children().find(D=>D.name_==="PlayToggle");S.hide(),o&&E.addClass(se),!o&&w.addClass(se),cc(u,I,o,!1,s),u.on("stopRecord",()=>{m.hide(),S.show(),C.show(),w.removeClass(se)}),u.on("deviceReady",()=>{m.show(),S.hide(),w.addClass(se)}),Bm(u,r,i,ks,a),o&&(u.deviceButton&&u.deviceButton.hide(),u.src(o),S.show(),m.hide(),w.removeClass(se));const L=[{name:"microphone"}];!u.cameraOff&&L.push({name:"camera"}),Promise.all(L.map(D=>{var k;return(k=navigator==null?void 0:navigator.permissions)==null?void 0:k.query(D)})).then(D=>{D.reduce((P,R)=>P&R.state==="granted",!0)&&u&&(u.deviceButton&&u.deviceButton.hide(),!o&&u.record().getDevice())}).catch(D=>{})},dc=(e,t=3)=>{const n=M.document.getElementById("ul-recording-countdown-screen");n&&t===0?(n.remove(),e.record().start()):n&&(n.innerHTML=`<span class='ul-countdown-text'>Recording in... ${t}</span>`,setTimeout(()=>{dc(e,t-1)},1e3))},fc=e=>{const t=M.document.createElement("div");return t.className="ul-video-container",t.appendChild(Vm(e)),t},uo=(e,t)=>{const n=M.document.createElement("video");n.id=e,n.className="video-js vjs-default-skin ul-video-player-video";const r=M.document.createElement("p");r.className="vjs-no-js",r.innerHTML="To view this video please enable JavaScript, and consider upgrading to a web browser that";const i=M.document.createElement("a");return i.href="https://videojs.com/html5-video-support/",i.target="_blank",i.innerHTML="supports HTML5 video",r.appendChild(i),n.appendChild(r),t.appendChild(n),t},$m=(e,t)=>{t?(e.children()[0].classList.add("vjs-hidden"),e.audioPlayerPlaceholder.show(),M.document.getElementById(`${e.id()}_html5_api`).style.height="0px"):(e.children()[0].classList.remove("vjs-hidden"),e.audioPlayerPlaceholder.hide(),M.document.getElementById(`${e.id()}_html5_api`).style.height="100%")},jr=(e,t)=>M.document.getElementById(e)?t?M.videojs(e,t):M.videojs(e):(console.error(`Error in finding player element with ID, ${e}`),null),qm=(e,t,n,r=!1,i="https://api.sprig.com",o=document,a=null,s=null)=>{M.document=o;const l=e+oc,u=fc(l);return M.document.addEventListener("securitypolicyviolation",c=>{et(new Error(`Voice & Video feature violates ${c.violatedDirective} web page CSP policies for the question player.`),"playerDeviceError",i,{})}),lc(ic,()=>{M.document.getElementById(ia(l)).remove(),uo(l,u);const c={playsinline:!0,playbackRates:[.5,1,1.5,2],fill:!0};try{const d=e+ac;uo(d,u);const f=jr(l,c),p=jr(d,{muted:!0,...c});if(!f||!p)return;Hm(p,a,s),a||p.addClass(se);const h=uc(f,["PlaybackRateMenuButton","PlayToggle","FullscreenToggle"]),v=h.children().find(g=>g.name_==="FullscreenToggle");v.hasClass("vjs-disabled")&&v.hide(),cc(f,h,t,n,r,p)}catch(d){et(new Error(`Error when creating video player object ${d}`),"playerDeviceError",i,{});return}}),u},Gm=(e,t={},n="https://api.userleap.com",r,i,o,a=!1,s=document)=>{M.document=s;const l=e+sc,u=fc(l);return M.document.addEventListener("securitypolicyviolation",c=>{et(new Error(`Voice & Video feature violates ${c.violatedDirective} web page CSP policies for the recorder player.`),"recorderDeviceError",n,o,t.visitorId,t.envId)}),lc(ic.concat(Mm),()=>{uo(l,u),M.document.getElementById(ia(l)).remove();try{Km(u,l,t,n,r,i,o,a)}catch(c){et(new Error(`Error when creating video recorder player object ${c}`),"recorderDeviceError",n,o,t.visitorId,t.envId);return}}),u},zm=e=>{const t=e+sc;if(!!M.document.getElementById(t)&&!!M.videojs){try{if(!M.videojs(t).record().stream)return}catch{return}M.videojs(t).record().stop(),M.videojs(t).record().stopDevice()}},Wm=e=>{const t=jr(e+oc);t==null||t.pause()},Ym=e=>{if(!e)return null;const t=e.match(/https:\/\/stream.mux.com\/(.*)/);let n=t?t[1]:null;return n.includes(Cs)&&(n=n.replace(Cs,"")),n?`https://image.mux.com/${n}/thumbnail.jpg?time=0`:null},F={UPLOAD_STARTED:"upload.started",UPLOAD_PROGRESS:"upload.progress",UPLOAD_FINISHED:"upload.finished",DELETE:"delete",ERROR:"error",MEDIA_TYPE:"media.type",PERMISSION_DENIED:"permission_denied",OTHER:"other",UPLOAD_ID:"upload.id",UPLOAD_PROGRESS_PCT:"upload.progress.pct",MEDIA_RECORDING_UID:"media.recording.uid",MEDIA_TYPE_VIDEO:"video",MEDIA_TYPE_AUDIO:"audio"},Oe={PlaybackRateMenuButton:"Speed",PlayToggle:"Play",FullscreenToggle:"Expand",TurnOnCamera:"Turn on",TurnOffCamera:"Turn off",DeleteButton:"Delete",RecordButton:"Record",StopButton:"Stop",PauseButton:"Pause"},mn="ul-card-video__player_recorder",Qm="ul-card-video__skip_button",Zm="ul-video-interview-form",Ts="ul-video-btn",Xm=({className:e,message:t,next:n,properties:r,questionId:i,type:o})=>{const{apiURL:a,envId:s,handleUploadUpdate:l,headers:u,responseGroupUid:c,surveyId:d,viewDocument:f,visitorId:p}=ee(k=>({apiURL:k.apiURL,envId:k.envId,handleUploadUpdate:k.handleUploadUpdate,headers:k.headers,responseGroupUid:k.responseGroupUid,surveyId:k.surveyId,viewDocument:k.viewDocument,visitorId:k.userId})),[h,v]=de(!1),[g,w]=de(null),[_,b]=de(null),[E,m]=de(0),x=r&&r.videoUrl,I=(k,P)=>{k===F.UPLOAD_STARTED?(w(P[F.UPLOAD_ID]),b(P[F.MEDIA_RECORDING_UID]),v(!0)):k===F.DELETE?(w(null),b(null),v(!1)):k===F.UPLOAD_PROGRESS?isNaN(P[F.UPLOAD_PROGRESS_PCT])?l({mediaRecordingUid:P[F.MEDIA_RECORDING_UID],isComplete:!0}):l({mediaRecordingUid:P[F.MEDIA_RECORDING_UID],progressPct:P[F.UPLOAD_PROGRESS_PCT]}):k===F.UPLOAD_FINISHED&&l({mediaRecordingUid:P[F.MEDIA_RECORDING_UID],isComplete:!0})},C=k=>{if(k&&k.children.length===0){const P=qm(mn,{src:x,type:"application/x-mpegURL"},void 0,r.mediaType===F.MEDIA_TYPE_AUDIO,a,f);k.appendChild(P)}},S=k=>{if(k&&k.children.length===0){const P=Gm(mn,{surveyId:d,responseGroupUid:c,questionId:i,visitorId:p,envId:s},a,I,void 0,{...u,"x-ul-video-recorder-origin":"sdk"},r.mediaType===F.MEDIA_TYPE_AUDIO,f);k.appendChild(P)}},L=k=>{k.preventDefault(),k.stopPropagation(),zm(mn),g&&_?(l({mediaRecordingUid:_,isSubmitted:!0}),n({value:{mediaRecordingUid:_},questionId:i,type:o})):n({value:null,questionId:i,type:o})},D=()=>y(xt,{defaultBody:()=>y("button",{className:`${Ts} ul-record-response-btn`,onClick:k=>{k.preventDefault(),k.stopPropagation(),Wm(mn),m(1)}}),properties:r});return y("form",{className:q([e,U.VideoCard,U.FadeInTransition]),id:Zm,children:[y(ze,{message:t,properties:r}),y("div",{id:"ul-card-voice__video",children:[y("div",{children:[y("div",{id:"ul-question-player-container",style:{display:E===0?"":"none"},children:[y("div",{id:mn,ref:C}),D()]}),y("div",{style:{display:E===1?"block":"none"},children:[y("button",{className:`${Ts} ul-back-question-btn`,onClick:k=>{k.preventDefault(),k.stopPropagation(),m(0)}}),y("div",{id:"ul-recorder-player-container",ref:S})]})]}),y(xe,{disabled:!h,onClick:L,children:hn(r)}),y("button",{className:`ul-card-text__button ${U.InactiveButton} ${U.SkipButton}`,id:Qm,onClick:L,style:{display:r.required?"none":"block",...h?{display:"none"}:{}},children:ta(r)})]})]})},Jm=({className:e})=>{const{uploadProgress:t}=ee(o=>({uploadProgress:o.uploadProgress}));let n,r;Object.values(t).filter(o=>o.isSubmitted).length>1?(n="Your responses are processing",r="Please keep this tab open until your responses are fully processed."):(n="Your response is processing",r="Please keep this tab open until your response is fully processed.");const i=Math.round(Math.min(99,...Object.values(t).filter(o=>o.isSubmitted).map(o=>o.progressPct)));return y("div",{className:q([e,"ul-card--uploading",U.FadeInTransition]),children:[y("div",{"aria-busy":"true","aria-label":"Processing...","aria-live":"polite",className:U.LoadingSpinnerContainer,role:"progressbar",children:y("div",{className:U.LoadingSpinner,children:[y("div",{className:U.LoadingSpinnerFirst}),y("div",{className:U.LoadingSpinnerSecond}),y("div",{className:U.LoadingSpinnerThird}),y("div",{className:U.LoadingSpinnerFourth})]})}),y(ze,{message:`${n} (${i}% complete)`}),y("p",{className:U.Caption,children:r})]})},Ls=({logoOnly:e=!1,style:t={}})=>y("svg",{alt:`${e?"Powered by ":""}Sprig`,width:e?"35":"112",height:"15",viewBox:e?"79 0 31 15":"0 0 112 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{display:"block",...t},children:[!e&&y("path",{d:"M0.648926 12.0181V2.8584H4.21631C6.0127 2.8584 7.25684 4.06445 7.25684 5.86084V5.87354C7.25684 7.66357 6.0127 8.88867 4.21631 8.88867H2.0708V12.0181H0.648926ZM3.86084 4.05811H2.0708V7.69531H3.86084C5.09229 7.69531 5.80957 7.02881 5.80957 5.87988V5.86719C5.80957 4.72461 5.09229 4.05811 3.86084 4.05811ZM11.6621 12.1514C9.63721 12.1514 8.39941 10.7993 8.39941 8.57764V8.56494C8.39941 6.34961 9.64355 4.99121 11.6621 4.99121C13.6743 4.99121 14.9185 6.34326 14.9185 8.56494V8.57764C14.9185 10.7993 13.6807 12.1514 11.6621 12.1514ZM11.6621 11.0024C12.8428 11.0024 13.5156 10.1011 13.5156 8.57764V8.56494C13.5156 7.03516 12.8428 6.14014 11.6621 6.14014C10.4751 6.14014 9.80859 7.03516 9.80859 8.56494V8.57764C9.80859 10.1074 10.4751 11.0024 11.6621 11.0024ZM17.6226 12.0181L15.7183 5.12451H17.1021L18.3398 10.4438H18.4414L19.8633 5.12451H21.1709L22.5928 10.4438H22.7007L23.9321 5.12451H25.2969L23.3989 12.0181H21.9834L20.5552 6.87646H20.4473L19.0254 12.0181H17.6226ZM29.334 12.1514C27.3154 12.1514 26.0967 10.7739 26.0967 8.59033V8.58398C26.0967 6.43213 27.3408 4.99121 29.2642 4.99121C31.1875 4.99121 32.3682 6.38135 32.3682 8.45068V8.93311H27.4805C27.5059 10.2534 28.2295 11.0215 29.3657 11.0215C30.248 11.0215 30.7749 10.5835 30.9399 10.228L30.9653 10.1772L32.292 10.1709L32.2793 10.228C32.0508 11.1357 31.0986 12.1514 29.334 12.1514ZM29.2705 6.12109C28.3311 6.12109 27.6201 6.76221 27.4995 7.94922H31.0034C30.8955 6.71777 30.2036 6.12109 29.2705 6.12109ZM34.0059 12.0181V5.12451H35.3833V6.16553H35.4849C35.7324 5.43555 36.3735 5.00391 37.2939 5.00391C37.5161 5.00391 37.7573 5.03564 37.897 5.06738V6.33691C37.6494 6.28613 37.4146 6.25439 37.1543 6.25439C36.1006 6.25439 35.3833 6.90186 35.3833 7.89844V12.0181H34.0059ZM41.9277 12.1514C39.9092 12.1514 38.6904 10.7739 38.6904 8.59033V8.58398C38.6904 6.43213 39.9346 4.99121 41.8579 4.99121C43.7812 4.99121 44.9619 6.38135 44.9619 8.45068V8.93311H40.0742C40.0996 10.2534 40.8232 11.0215 41.9595 11.0215C42.8418 11.0215 43.3687 10.5835 43.5337 10.228L43.5591 10.1772L44.8857 10.1709L44.873 10.228C44.6445 11.1357 43.6924 12.1514 41.9277 12.1514ZM41.8643 6.12109C40.9248 6.12109 40.2139 6.76221 40.0933 7.94922H43.5972C43.4893 6.71777 42.7974 6.12109 41.8643 6.12109ZM49.1133 12.1323C47.3804 12.1323 46.2568 10.7422 46.2568 8.57764V8.56494C46.2568 6.38135 47.3613 5.00391 49.1133 5.00391C50.0591 5.00391 50.8652 5.47363 51.2334 6.21631H51.3413V2.42041H52.7124V12.0181H51.3413V10.9326H51.2334C50.8335 11.688 50.0781 12.1323 49.1133 12.1323ZM49.5068 10.958C50.6558 10.958 51.3604 10.0503 51.3604 8.57764V8.56494C51.3604 7.09229 50.6494 6.18457 49.5068 6.18457C48.3516 6.18457 47.6597 7.08594 47.6597 8.56494V8.57764C47.6597 10.0566 48.3516 10.958 49.5068 10.958ZM61.98 12.1323C61.0151 12.1323 60.2598 11.688 59.8599 10.9326H59.7583V12.0181H58.3809V2.42041H59.7583V6.21631H59.8599C60.228 5.47363 61.0342 5.00391 61.98 5.00391C63.7319 5.00391 64.8364 6.38135 64.8364 8.56494V8.57764C64.8364 10.7422 63.7192 12.1323 61.98 12.1323ZM61.5928 10.958C62.7417 10.958 63.4336 10.0566 63.4336 8.57764V8.56494C63.4336 7.08594 62.7417 6.18457 61.5928 6.18457C60.4438 6.18457 59.7329 7.09229 59.7329 8.56494V8.57764C59.7329 10.0503 60.4438 10.958 61.5928 10.958ZM66.8867 14.4429C66.7153 14.4429 66.5122 14.4302 66.3345 14.4111V13.3257C66.4678 13.3447 66.6392 13.3511 66.7979 13.3511C67.439 13.3511 67.8262 13.0781 68.0293 12.3799L68.1309 12.0244L65.6299 5.12451H67.1152L68.8418 10.6343H68.9624L70.6826 5.12451H72.1299L69.5654 12.2847C68.9814 13.9287 68.2832 14.4429 66.8867 14.4429Z",fill:"black",fillOpacity:"0.7"}),y("path",{d:"M81.1088 6.63629C79.6878 6.32154 78.9672 5.76865 78.9672 4.99369C78.9672 4.19299 79.736 3.5886 80.7556 3.5886C81.8066 3.5886 82.5995 4.25285 82.5995 5.13336V5.20352H84.0518V5.13336C84.0518 3.52424 82.6405 2.30774 80.7693 2.30774C79.8676 2.30774 79.0414 2.58451 78.4433 3.08655C78.1463 3.33144 77.9077 3.63818 77.7448 3.98479C77.5818 4.33141 77.4984 4.70934 77.5005 5.09153C77.4946 5.44197 77.5675 5.78934 77.714 6.10857C77.8605 6.42779 78.0769 6.71092 78.3475 6.93752C78.8512 7.37584 79.5659 7.70024 80.4709 7.90299C81.9949 8.23898 82.7676 8.81054 82.7676 9.60094C82.7676 10.4576 81.9258 11.1032 80.813 11.1032C79.6571 11.1032 78.7854 10.3856 78.7854 9.43424V9.36408H77.3318V9.43424C77.3318 11.1167 78.8219 12.3847 80.7973 12.3847C81.7421 12.3847 82.6093 12.0983 83.2393 11.5769C83.5519 11.3237 83.8034 11.0048 83.9753 10.6433C84.1472 10.2818 84.2352 9.88702 84.2329 9.48766C84.2329 8.05875 83.1833 7.09907 81.1088 6.63629Z",fill:"black",fillOpacity:"0.7"}),y("path",{d:"M89.2394 4.68276C88.6963 4.67605 88.1596 4.79915 87.6751 5.04156C87.1905 5.28397 86.7725 5.63851 86.4566 6.07497V4.85204H85.0747V14.8479H86.4566V11.0356C86.7725 11.472 87.1906 11.8265 87.6751 12.0688C88.1596 12.3111 88.6963 12.434 89.2394 12.4272C91.3836 12.4272 93 10.7627 93 8.55495C93 6.34723 91.3836 4.68276 89.2394 4.68276ZM91.5608 8.84202C91.5057 9.41605 91.2512 9.95356 90.8406 10.3633C90.4299 10.773 89.8883 11.0296 89.3078 11.0896C88.5363 11.1669 87.8177 10.9461 87.2841 10.4692C86.7505 9.99222 86.4566 9.3106 86.4566 8.55495C86.4566 7.10159 87.5538 6.00546 89.0087 6.00546C89.7619 6.00546 90.4421 6.29124 90.9171 6.81002C91.407 7.34232 91.6357 8.06385 91.5608 8.84202Z",fill:"black",fillOpacity:"0.7"}),y("path",{d:"M109.95 4.85407V6.06349C109.298 5.18298 108.292 4.68286 107.153 4.68286C105.017 4.68286 103.406 6.31709 103.406 8.48426C103.406 10.6514 105.017 12.285 107.153 12.285C108.296 12.285 109.303 11.79 109.95 10.9185V11.1046C109.95 12.6101 108.993 13.5826 107.513 13.5826C106.513 13.5826 105.68 13.1494 105.284 12.424L105.264 12.3867H103.838L103.871 12.48C104.112 13.1892 104.583 13.8001 105.211 14.2179C105.841 14.6324 106.637 14.8512 107.513 14.8512C108.637 14.8512 109.594 14.4972 110.28 13.8285C110.967 13.1597 111.332 12.2194 111.332 11.1213V4.85407H109.95ZM109.175 10.3502C108.588 10.905 107.752 11.138 106.879 10.9887C106.361 10.8984 105.886 10.6475 105.523 10.2725C105.16 9.89751 104.927 9.41787 104.859 8.90328C104.736 8.03757 104.999 7.21756 105.581 6.655C106.069 6.19093 106.723 5.93643 107.401 5.94699C107.565 5.94713 107.729 5.96026 107.891 5.98625C108.946 6.15489 109.781 7.01609 109.921 8.0852C110.039 8.96507 109.766 9.78958 109.175 10.3502Z",fill:"black",fillOpacity:"0.7"}),y("path",{d:"M101.89 2.12378C101.63 2.06766 101.358 2.11486 101.133 2.25518C100.908 2.39551 100.747 2.61769 100.687 2.87371C100.626 3.12973 100.67 3.39902 100.809 3.62339C100.947 3.84775 101.17 4.00917 101.428 4.07275C101.503 4.08936 101.58 4.09778 101.657 4.09786C101.906 4.09824 102.146 4.0083 102.331 3.84518C102.517 3.68206 102.636 3.45714 102.664 3.21327C102.693 2.9694 102.63 2.72361 102.487 2.5227C102.344 2.32179 102.132 2.17981 101.89 2.12378Z",fill:"black",fillOpacity:"0.7"}),y("path",{d:"M100.967 10.934H99.7755C98.9285 10.934 98.4196 10.3644 98.4196 9.40982C98.4196 8.4791 98.8757 7.36945 99.8054 6.01778L99.8178 5.99976V5.61807L95.8571 5.06453C95.8585 4.90331 95.8162 4.74466 95.7346 4.60501C95.653 4.46536 95.5352 4.34979 95.3932 4.27027C95.0381 4.07718 94.6498 4.07717 94.3279 4.26383C94.1667 4.35799 94.035 4.4945 93.9476 4.65816C93.8602 4.82182 93.8205 5.00623 93.8328 5.19087C93.8452 5.37552 93.9092 5.55315 94.0176 5.70402C94.1261 5.85489 94.2748 5.97309 94.4472 6.04546L93.2151 12.258H94.5833L95.7196 6.35891L97.8593 6.7155C97.284 7.73439 96.9921 8.68442 96.9921 9.53919C96.9921 11.1168 97.9577 12.1498 99.5187 12.2496V12.258H102.346V4.87723H100.967V10.934Z",fill:"black",fillOpacity:"0.7"})]}),eg=()=>{const{border:e,cards:t,forceBrandedLogo:n,headers:r,index:i,marketingUrl:o,showSurveyBrand:a,slugName:s,surveyId:l,viewedCardCount:u}=ee(b=>({border:b.border,cards:b.cards,forceBrandedLogo:b.forceBrandedLogo,headers:b.headers,index:b.index,marketingUrl:b.marketingUrl,showSurveyBrand:b.showSurveyBrand,slugName:b.slugName,surveyId:b.surveyId,viewedCardCount:b.viewedCardCount})),c=wt(null),d=t.filter(b=>b.type!==T.Uploading&&b.type!==T.Thanks),f=rm(t,i),p=u+1,h=p/(p+f),v=`${o}?utm_source=survey_branding&utm_medium=website&utm_campaign=${s}&utm_content=${l}${n&&"&utm_term=poweredby_pill"}`;Le(()=>{c.current&&(c.current.style.width=`${h*100}%`)},[h]);const g=()=>y(Ae,{children:[d.length>1&&y("div",{id:"ul-progress-bar-container",children:y("div",{id:"ul-progress-bar-current",ref:c,style:{border:`1px solid ${e||"#000"}`}})}),a?y("div",{className:n?"yellow-footer-logo":"",style:{marginTop:"4px"},children:y("a",{href:v,rel:"noreferrer",target:"_blank",children:y("div",{style:{display:"flex"},children:[y(Ls,{logoOnly:!1}),n&&y(Rs,{style:{display:"block",margin:"auto 0 auto 4px",transform:"rotateY(0deg) rotate(-45deg)"}})]})})}):null]}),w=()=>y("a",{dir:"ltr",href:v,rel:"noreferrer",target:"_blank",children:y("div",{className:"thank-you-card-link",children:[y("div",{className:"sprig-box-logo",children:y(Ls,{logoOnly:!0,style:{margin:"auto"}})}),y("div",{children:y("p",{children:["Capture insights about your own product",y(Rs,{style:{display:"inline-flex",marginInlineStart:"4px",verticalAlign:"middle"}})]})})]})}),_=t[i].type===T.Thanks;return y("footer",{className:`ul-footer ${r["userleap-platform"]==="link"?"ul-footer__link":""}`,style:a?{}:{marginBottom:"10px"},children:_&&n?w():g()})},Rs=({style:e})=>y("svg",{fill:"none",height:"10",style:e,viewBox:"0 0 12 10",width:"12",xmlns:"http://www.w3.org/2000/svg",children:[y("path",{d:"M1.47839 5.2085L10.9384 5.2085",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.35"}),y("path",{d:"M7.0686 1.15845L10.9386 5.20845L7.0686 9.25845",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.35"})]}),tg=()=>{const{answers:e,border:t,cards:n,close:r,configureExitOnOverlayClick:i,destroy:o,endCard:a,eventEmitFn:s,fontFamily:l,headers:u,index:c,next:d,showStripes:f,update:p,useMobileStyling:h,viewDocument:v}=ee(R=>({answers:R.answers,border:R.border,cards:R.cards,close:R.close,configureExitOnOverlayClick:R.configureExitOnOverlayClick,destroy:R.destroy,endCard:R.endCard,eventEmitFn:R.eventEmitFn,fontFamily:R.fontFamily,headers:R.headers,index:R.index,next:R.next,showStripes:R.showStripes,update:R.update,useMobileStyling:R.useMobileStyling,viewDocument:R.viewDocument})),g=wt(null),w=wt(!1),_=u["userleap-platform"],{props:b,type:E,name:m}=n[c],x=n.length;Le(()=>{g.current&&(g.current.classList.contains("ul-app--visible")||g.current.classList.add("ul-app--visible"),!w.current&&s&&(w.current=!0,s(B.SurveyAppeared)))},[s]),Le(()=>{p()},[c,p]),Le(()=>{i(()=>r())},[r,i]);const I=()=>r(zt),C=R=>{R.key==="Enter"&&I()},S=async function(R){d({data:R,completeSurvey:()=>{o(zt)},endCard:a}),Mf(v)};if(e){for(const R of e)if(R.questionId===m){let O;if(E===T.MultipleChoice){const Y=b.options.find(({value:ae})=>ae===R.value);if(!Y)break;O={[Y.id]:Y.value}}else O=R.value;S({value:O,type:E,questionId:R.questionId});break}}const L=()=>[Pt.Email,Pt.Link].includes(u["userleap-platform"])?!1:!a||c+1!==x,D=()=>h?{borderColor:t}:{borderColor:t,margin:"15px"},k=()=>{const R={className:"ul-card",next:S,questionId:m,type:E};switch(E){case T.ConsentLegal:return te(hm,{...R,...b,key:m});case T.Likert:return te(mm,{...R,...b,key:m});case T.MultipleChoice:return te(gm,{...R,...b,key:m});case T.MultipleSelect:return te(ym,{...R,...b,key:m});case T.NPS:return te(_m,{...R,key:m,props:b});case T.Open:return te(wm,{...R,...b,key:m});case T.RecordedTask:return te(Am,{...R,...b,key:m});case T.TextUrlPrompt:return te(Dm,{...R,...b,key:m});case T.Thanks:return te(Pm,{...R,...b,key:m});case T.Uploading:return te(Jm,{...R,...b,key:m});case T.VideoVoice:return te(Xm,{...R,...b,key:m});default:return null}},P=R=>{var G;const O=window.sprigAPI,Y=R.target;if(!O||!Y)return;const ae=[Y,Y.parentElement];for(const ue of ae)if(((G=ue==null?void 0:ue.tagName)==null?void 0:G.toLowerCase())==="a"){R.preventDefault(),O==null||O.openUrl(ue.href);return}};return y("div",{className:q("ul-app",Wt(u)?"ul-app--visible":"ul-app--overlay"),dir:"auto",id:zt,onClick:P,ref:g,style:{"--theme":t,...l?{fontFamily:l.replace(";","")}:{}},children:y("div",{className:"ul-app__container",children:y("div",{className:q(ie(U.CardContainer,h)),style:D(),children:[L()&&y("div",{className:q(ie(U.CloseContainer,h)),children:y("div",{"aria-label":"Close button",className:U.CloseButton,onClick:I,onKeyPress:C,role:"button",tabIndex:0,children:y("svg",{fill:"none",height:"18px",viewBox:"0 0 13 13",width:"18px",xmlns:"http://www.w3.org/2000/svg",children:y("path",{d:"M2.54964 1.78369L1.78369 2.54964L5.73405 6.5L1.78369 10.4504L2.54964 11.2163L6.5 7.26595L10.4504 11.2163L11.2163 10.4504L7.26595 6.5L11.2163 2.54964L10.4504 1.78369L6.5 5.73405L2.54964 1.78369Z",fill:"#262136"})})})}),f&&y("div",{className:"ul-header__container",dir:"ltr",children:y("div",{className:"ul-header",children:"For development purposes only"})}),y("div",{className:q(Bf(U.CardMainContent,_)),children:k()}),y(eg,{})]})})})},ng=`html,body,p,ol,ul,li,dl,dt,dd,blockquote,figure,fieldset,legend,textarea,pre,iframe,hr,h1,h2,h3,h4,h5,h6{margin:0;padding:0}h1,h2,h3,h4,h5,h6{font-size:100%;font-weight:400}button,input,select,textarea{margin:0}html{box-sizing:border-box}*,*:before,*:after{box-sizing:inherit}ol,ul{padding-inline-start:1em}.ul-card{flex:1 1 auto;border-radius:2px;display:flex;flex-direction:column;font-size:17px;line-height:19px;text-align:start;margin:auto}.ul-card__container--desktop{border:2px solid #fff;box-shadow:0 0 15px #00000026}.ul-card__container--mobile{border-width:0;box-shadow:0 0 5px #00000040;margin-top:5px}.ul-card__container{background:#ffffff;border-radius:6px;display:flex;flex-direction:column;flex-grow:1;flex:1 1 auto;font-size:17px;line-height:23px;overflow:auto;padding:20px 20px 5px;position:relative;text-align:center;word-break:break-word}.ul-card-vertical__button-wrapper{flex-direction:column;align-items:center}.ul-card__button-wrapper{margin-top:4px;margin-bottom:3px;display:flex;gap:16px;justify-content:center}.ul-rich-text-body{min-height:2em}.ul-rich-text-body,.ul-rich-text-body p{margin-top:10px;margin-bottom:10px}.ul-rich-text-body li{margin:5px 0}.ul-rich-text-body p,.ul-rich-text-body li{font-size:15px;line-height:130.35%;letter-spacing:.02em;color:#343442;text-align:start;white-space:pre-line}.ul-rich-text-body:last-child,.ul-rich-text-body li:last-child{margin-bottom:15px}.ul-card-main-content__link,.ul-card-main-content__email{flex-grow:55;display:flex}.ul-card-main-content__web,.ul-card-main-content__android,.ul-card-main-content__ios{margin-bottom:5px}.ul-question{color:#343442;display:block;font-size:20px;line-height:125%;font-weight:500;cursor:default;text-align:start}.ul-caption{flex:1 0 auto;margin-top:8px;margin-bottom:15px;font-size:15px;line-height:130.35%;letter-spacing:.02em;color:#6c6c6e;text-align:start}.ul-card__choices{margin:5px 0 0;flex:1 0}.choice--mobile{border:2px solid #e6e6e6}.choice--desktop{border:1px solid #e6e6e6}.choice{align-items:flex-start;color:#262136;cursor:pointer;display:flex;justify-content:flex-start;flex-direction:column;box-sizing:border-box;border-radius:3px;margin-bottom:7px;font-size:15px;line-height:20px;padding:10px 20px 10px 15px;background-color:#00000003}.choice--desktop:hover,.choice--desktop:active,.choice--mobile:active{background-color:#0000000d}.choice-label-container{align-items:center;display:flex;flex-direction:row;flex:0 0 fit-content;gap:15px;height:fit-content;justify-content:flex-start;width:100%}.choice-text-entry-container{width:100%;height:fit-content;flex:0 1 fit-content;overflow:hidden}.choice .choice-text-input--mobile{max-height:63px}.choice .choice-text-input--desktop{max-height:150px}.choice .choice-text-input{box-sizing:border-box;background-color:transparent;color:#343442;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol;min-height:20px;max-height:60px;padding:0;margin-top:8px;resize:none;width:100%;font-size:14px;line-height:20px;outline:none;border:none;overflow-wrap:break-word}.choice .choice-text-input::placeholder{color:#6c6c6e80}.ul-thanks-check{text-align:center;margin-bottom:20px}.ul-card--thanks-content{padding:20px 0 10px}.ul-card--thanks .ul-question{padding-top:0;text-align:center}.ul-card--thanks .ul-caption{padding-top:0;text-align:center;overflow-wrap:break-word;hyphens:auto;hyphenate-limit-lines:no-limit}.ul-card--uploading .ul-question{padding-top:15px;text-align:center}.ul-card--uploading .ul-caption{padding-top:5px;text-align:center;overflow-wrap:break-word}.ul-loading-spinner-container{font-size:1.8rem;flex-grow:1;width:100%;height:100%;display:flex;align-items:center;justify-content:center}.ul-loading-spinner{display:inline-block;position:relative;width:6rem;height:6rem}.ul-loading-spinner div{box-sizing:border-box;display:block;position:absolute;width:80%;height:80%;margin:5px;border:5px solid #152e3e;border-radius:50%;animation:lds-ring 1.2s cubic-bezier(.5,0,.5,1) infinite;border-color:#152e3e transparent transparent transparent}.ul-loading-spinner .first{animation-delay:-.45s}.ul-loading-spinner .second{animation-delay:-.3s}.ul-loading-spinner .third{animation-delay:-.15s}@keyframes lds-ring{0%{transform:rotate(0)}to{transform:rotate(360deg)}}.select-checkbox{height:16px;width:16px;border-radius:3px;border:1px solid #323232;display:flex;box-sizing:border-box;box-shadow:inset 3px 3px #0000001a;background-color:"transparent";align-items:center;justify-content:center}.select-radio{height:16px;width:16px;border-radius:16px;border:1px solid #323232;display:flex;box-sizing:border-box;box-shadow:inset 2px 2px #0000001a;background-color:"transparent";align-items:center;justify-content:center}.fade-in-transition{animation:fadeIn .4s ease-in;-webkit-animation:fadeIn .4s ease-in;-moz-animation:fadeIn .4s ease-in;-o-animation:fadeIn .4s ease-in;-ms-animation:fadeIn .4s ease-in}@keyframes fadeIn{0%{opacity:0}to{opacity:1}}@-moz-keyframes fadeIn{0%{opacity:0}to{opacity:1}}@-webkit-keyframes fadeIn{0%{opacity:0}to{opacity:1}}@-o-keyframes fadeIn{0%{opacity:0}to{opacity:1}}@-ms-keyframes fadeIn{0%{opacity:0}to{opacity:1}}[class^=CenteredSurveyLayout] .ul-header__container,[class^=QuestionConceptTestLayout] .ul-header__container,.ul-websurvey-frame .ul-card__container,.ul-websurvey-frame-mobile .ul-card__container{margin-bottom:unset}[class^=CenteredSurveyLayout] .ul-card__container,[class^=QuestionConceptTestLayout] .ul-card__container,.ul-websurvey-frame .ul-card__container,.ul-websurvey-frame-mobile .ul-card__container{box-shadow:unset;border-radius:unset;border:none!important;position:unset}@media only screen and (min-height: 600px) and (width: 600px){.ul-card{position:relative;top:-20px}}.ul-vertical-centered-container{display:flex;flex-direction:column;align-items:center}.ul-consent-legal__name-input--mobile{border:2px solid #e6e6e6}.ul-consent-legal__name-input--desktop{border:1px solid #e6e6e6}.ul-consent-legal__name-input{background:rgba(0,0,0,.01);box-sizing:border-box;color:#343442;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol;padding:10px 20px 10px 15px;border-radius:3px;font-size:15px;line-height:20px;margin-bottom:7px;width:100%}.ul-consent-legal__name-input::placeholder{color:#6c6c6e80}.ul-consent-legal__name-input:focus{outline:none;background:white}.ul-consent-legal__name-input--desktop:hover:not(:focus){background-color:#0000000d}.ul-card__consent-legal .choice{font-size:15px;padding:10px 15px;background-color:#00000003}.ul-card__consent-legal .choice--desktop:hover,.ul-card__consent-legal .choice--desktop:active,.ul-card__consent-legal .choice--mobile:active{background-color:#0000000d}.ul-card--likert__numbers{align-items:center;border-radius:5px;display:flex;flex-direction:row;flex:1 0;justify-content:center;margin:5px 0 0}.likert-number--mobile{border:2px solid #e6e6e6}.likert-number--mobile:not(:first-child){margin-inline-start:-2px}.likert-number--desktop{border:1px solid #e6e6e6}.likert-number--desktop:not(:first-child){margin-inline-start:-1px}.likert-number{align-items:center;cursor:pointer;display:flex;justify-content:center;flex:1 0;background-color:#00000003;font-size:18px;line-height:24px;height:67px}.likert-number:first-child{border-start-start-radius:5px;border-end-start-radius:5px}.likert-number:last-child{border-start-end-radius:5px;border-end-end-radius:5px}.likert-number:active,.likert-number--desktop:hover{background-color:#0000000d;font-weight:500}.likert-star--mobile:not(:first-child){margin-inline-start:-2px}.likert-star--desktop:not(:first-child){margin-inline-start:-1px}.likert-star{align-items:center;cursor:pointer;display:flex;justify-content:space-between;flex:1 0;color:transparent;font-size:18px;line-height:24px;height:67px}.likert-smiley--mobile:not(:first-child){margin-inline-start:-2px}.likert-smiley--desktop:not(:first-child){margin-inline-start:-1px}.likert-smiley{align-items:center;cursor:pointer;display:flex;justify-content:space-between;flex:1 0;color:transparent;line-height:24px;height:67px}.likert-smiley circle:not(:first-child){fill-opacity:1}.ul-card--likert__labels{align-items:center;color:#262136;display:flex;flex-direction:row;flex:1 0;font-weight:500;font-size:13px;line-height:15px;justify-content:space-between;margin:7px 0 10px}.select-label{cursor:pointer;flex:1;overflow-wrap:anywhere;text-align:start}.ul-card--nps__numbers{align-items:center;border-radius:5px;display:flex;flex-direction:row;flex:1 0;justify-content:center;margin:5px 0 0}.nps-number--mobile{border:2px solid #e6e6e6}.nps-number--mobile:not(:first-child){margin-inline-start:-2px}.nps-number--desktop{border:1px solid #e6e6e6}.nps-number--desktop:not(:first-child){margin-inline-start:-1px}.nps-number{align-items:center;cursor:pointer;display:flex;justify-content:center;flex:1 0;background-color:#00000003;font-size:18px;line-height:24px;height:67px}.nps-number:first-child{border-start-start-radius:5px;border-end-start-radius:5px}.nps-number:last-child{border-start-end-radius:5px;border-end-end-radius:5px}.nps-number:active,.nps-number--desktop:hover{background-color:#0000000d;font-weight:500}.ul-card--nps__labels{align-items:center;color:#262136;display:flex;flex-direction:row;flex:1 0;font-weight:500;font-size:13px;line-height:15px;justify-content:space-between;margin:7px 0 10px}.ul-card-text{flex:1 0 auto;margin-top:2px;margin-bottom:3px;align-items:center;display:flex;flex-wrap:wrap;justify-content:center;padding:0}.ul-card-text__container{align-items:center;box-sizing:border-box;border-radius:3px;display:flex;justify-content:center;margin-bottom:12px;flex:1 0 100%}.ul-card-text__input--mobile{border:2px solid #e6e6e6;max-height:63px}.ul-card-text__input--desktop{border:1px solid #e6e6e6;max-height:150px}.ul-card-text__input{background:rgba(0,0,0,.01);box-sizing:border-box;color:#343442;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol;min-height:63px;overflow:auto;padding:12px;resize:none;width:100%;border-radius:3px;font-size:15px;line-height:20px;overflow-wrap:break-word}.ul-card-text__input::placeholder{color:#6c6c6e80}.ul-card-text__input:focus{outline:none;background:white}.ul-card-text__input--desktop:hover:not(:focus){background-color:#0000000d}.ul-card__text-url-prompt-button{text-decoration:none;text-overflow:ellipsis;overflow:hidden;white-space:nowrap}#ul-card-voice__video{align-items:center;display:flex;flex-direction:column}#ul-card-voice__video>div{margin-bottom:10px;width:100%}#ul-card-video__player_recorder{width:100%;width:-moz-available;width:-webkit-fill-available;width:fill-available}.ul-card-record__task{flex:1 0 auto;margin-top:2px;margin-bottom:3px;align-items:center;display:flex;flex-wrap:wrap;justify-content:center;padding:0}#ul-record-task-upload-progress,#ul-record-task-video-preview{width:100%;height:150px}.ul-permission-graphics-container{width:100%;height:150px;background-color:#0000000d;text-align:center;flex-direction:column;margin-left:auto;margin-right:auto;border-radius:5px;display:flex;align-items:center;font-size:15px;color:#000000b3}.ul-av-permission-denied-paragraph{margin:auto 15px;font-size:12px}.ul-av-permission-denied-headline{font-size:14px;color:#262136;text-decoration:underline;font-size:12px}.ul-permission-body{color:#000;margin:5px auto 5px 5px;line-height:135%;text-align:center}.ul-select-tab-container{width:240px;height:46px;background:#ffffff;border-radius:5px;text-align:start;align-items:center;display:flex;padding:0 5px;margin-top:20px;margin-bottom:auto}.ul-select-tab-text{color:#4b575d;margin:5px;line-height:135%;text-align:center}button.ul-task-skip-button{color:#000;background-color:#fff}#ul-task-detail-container{margin-top:0;margin-bottom:0;overflow:auto}#ul-task-detail-container.ul-rich-text-body p,#ul-task-detail-container.ul-rich-text-body li,#ul-task-detail-container.ul-rich-text-body{color:#4c4c4c}#ul-task-detail-container :first-child{margin-top:0}#ul-task-detail-container :last-child{margin-bottom:20px}.ul-horizontal-button-container{width:100%;display:flex;flex-direction:row}.ul-skip-button-below{margin-top:5px}.ul-horizontal-button-container-center{justify-content:center}.ul-vertical-button-container-center{display:flex;flex-direction:column;align-items:center}.ul-horizontal-button-container-left{justify-content:flex-start}.ul_recorded-task-inset-spacing{margin-top:5px;margin-bottom:24px}.ul_permission_svg_container{justify-content:center}.ul-card-text__button{background-color:var(--theme);border-radius:3px;border:none;color:#fff;cursor:pointer;font-size:15px;font-weight:500;line-height:18px;padding:10.5px 21px}.ul-card-text__button:disabled,.ul-card-text__button.sprig-button-disabled{background-color:#0000001a;color:#0003}.ul-card-text__button.ul-button-inactive{background-color:#fff!important;color:#5d696f!important}.ul-card-skip__button{color:#00000080;background:none;border:none;font-size:15px;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol;cursor:pointer}.ul-card-button-group{align-items:center;display:flex;gap:30px;justify-content:center}html,body{cursor:default;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol;height:100%;overflow:hidden;-webkit-tap-highlight-color:transparent;-webkit-user-select:none;-webkit-touch-callout:none}b{font-weight:500}#ul-app{opacity:0;width:100%;flex-grow:2;display:flex}#ul-app.ul-app--overlay{position:absolute;bottom:0;transition:opacity .1s ease-out;transition-delay:.1s}#ul-app.ul-app--visible{opacity:1;bottom:0}.ul-app__container{width:100%;display:flex;flex-direction:column;max-height:100vh}.ul-header__container{margin-bottom:15px}.ul-header{align-items:center;background:repeating-linear-gradient(120deg,#ebebeb,#ebebeb 24px,#fff 24px,#fff 48px);border-bottom:2px solid #ebebeb;display:flex;font-size:14px;font-weight:500;height:40px;justify-content:center;left:0;position:absolute;top:0;width:100%}.ul-footer{display:flex;flex-direction:column;align-items:center;justify-content:center;margin-top:auto;flex-grow:1;width:100%}.ul-footer>.yellow-footer-logo{background:#fad133;border:1px solid #f9c600;border-radius:14px;padding:6px 12px}.ul-footer>.yellow-footer-logo:hover{background:#f9c600}.ul-footer .thank-you-card-link{background:rgba(0,0,0,.01);border:1px solid #e6e6e6;border-radius:8px;cursor:pointer;display:inline-flex;font-size:14px;gap:8px;margin-bottom:15px;padding:12px;text-align:initial}.ul-footer .thank-you-card-link:hover{background:rgba(0,0,0,.03)}.ul-footer>a{color:inherit}.ul-footer-bubble{display:inline-block;margin:0 3px;width:7px;height:7px;border-radius:3px;border:1px solid transparent}.sprig-box-logo{background:rgba(249,198,0,1);border-radius:5px;display:flex;padding:4px}.close-container{display:flex;justify-content:flex-end;width:100%}.close-btn{cursor:pointer;height:18px;margin-inline-end:-10px;position:relative;top:-10px;width:18px;z-index:1}.ul-app__container{transition:opacity .3s ease-out}.ul-center-horizontally{text-align:center}#ul-progress-bar-container{width:100%;height:2px;background-color:#0000001a;border-radius:2px;max-width:250px;margin:25px 0}#ul-progress-bar-current{transition:width 1s ease;width:0%;height:0;border-radius:2px}.prototype-button{width:100%;background:rgba(0,0,0,.01);border:1.5px solid #e6e6e6;border-radius:4px 0 0 4px;flex:none;flex-grow:1;margin:0;padding:20px 0;font-size:14px;font-family:inherit;text-decoration:underline}.prototype-button:hover{cursor:pointer}
704
- `,rg=(e,t)=>{const n=[...e],r=new Set([T.VideoVoice,T.RecordedTask]);return e.some(i=>r.has(i.type))&&n.push({name:-2,props:{routingOptions:[]},type:T.Uploading}),t&&n.push({name:-1,props:{routingOptions:[]},type:T.Thanks}),n},ig=({mode:e=null,viewWindow:t,viewDocument:n})=>{const r=n.documentElement;return{mode:e,sw:t.screen.width,sh:t.screen.height,cw:r.clientWidth,ch:r.clientHeight,p:t.location.href,l:t.navigator.language}};function og(e,t=!0){var m;const{answers:n,apiURL:r,customStyles:i,endCard:o,eventEmitFn:a,fontFamilyURL:s,frame:l,previewKey:u,viewDocument:c,viewWindow:d}=e,f=Wt(e.headers)?e.frame:c.body,p=e.UpChunk||window.UpChunk,h=$,v=rg(e.cards,!!o);mr.configure(h,{cards:v,hasEndCard:!!o,apiURL:r,UpChunk:p}),ee.setState({apiURL:r,answers:n,border:e.border,index:e.startingQuestionIdx||0,cards:v,configureExitOnOverlayClick:e.configureExitOnOverlayClick,customMetadata:e.customMetadata,endCard:e.endCard,envId:e.envId,eventEmitFn:a,fontFamily:e.fontFamily,forceBrandedLogo:e.forceBrandedLogo,frame:l,headers:e.headers,hasViewedEmbed:!1,isPreview:e.isPreview,marketingUrl:"https://sprig.com",meta:ig({mode:e.mode,viewWindow:d,viewDocument:c}),mode:e.mode,previewKey:u,recorder:mr,recorderEventEmitter:h,responseGroupUid:e.responseGroupUid,showStripes:e.showStripes,showSurveyBrand:e.showSurveyBrand,slugName:e.slugName,styleNonce:e.styleNonce,surveyId:e.surveyId,tabTitle:e.tabTitle,uploadingCardViewed:!1,uploadProgress:{},useMobileStyling:e.useMobileStyling,useDesktopPrototype:e.useDesktopPrototype,userId:e.userId,viewDocument:e.viewDocument,visitorAttributes:e.visitorAttributes,viewedCardCount:e.startingQuestionIdx||0});const{seen:g}=ee.getState();g();const{head:w}=c,_=c.createElement("style");if(_.id="sprig-style",_.textContent=ng,_.nonce=e.styleNonce,w.appendChild(_),e.fontFamily&&s&&parent){const x=c.createElement("link");x.rel="stylesheet",x.href=s,w.appendChild(x)}if(e.customStyles&&Xs(c,i,e.styleNonce),!p)if(e.installationMethod!==rt.Npm){const x=c.createElement("script");x.src="https://cdn.sprig.com/userleap-web-upchunk-v2.2.2.js",x.onload=()=>{mr.setUpChunk(d.UpChunk)},x.onerror=()=>{console.warn("[Sprig] - recording functionality not configured due to UpChunk library load failure")},w.appendChild(x)}else console.warn("[Sprig] - recording functionality not configured due to missing UpChunk dependency");const b="2.24.10",E=a||((m=l.eventEmitter)==null?void 0:m.emit);E==null||E(Re.VerifyViewVersion,{[Lt.ViewVersion]:b}),f&&t&&on(y(tg,{}),f)}const ag={configure:og};window.UserLeap&&window.Sprig&&(window.Sprig._gtm?window.Sprig=window.UserLeap:window.UserLeap=window.Sprig);window.UserLeap||(window.UserLeap=window.Sprig);window.Sprig||(window.Sprig=window.UserLeap);const sg="rgba(255,255,255, 0.95)",lg="rgba(0,0,0,0.9)",ug="360px",bi="0px",pc=()=>{window.UserLeap.container=document.createElement("div"),window.UserLeap.container.className="ul-container",document.body.appendChild(window.UserLeap.container)},hc=e=>{hg();const t=window.UserLeap.container;if(!(!t||!t.parentNode))try{t.parentNode.removeChild(t),window.UserLeap.container=null,we("trackStartUrl",null),$.emit(B.SurveyLifeCycle,{state:"dismissed"}),$.emit(B.SurveyClosed,{name:B.SurveyClosed,initiator:e})}catch(n){console.warn(`[Sprig] (ERR-412) Error removing UserLeap container by ${e} `+t),n instanceof Error&&window.UserLeap.reportError("dismissActiveSurvey",n)}},vc=()=>{$.on(B.SurveyWillClose,({initiator:e})=>{hc(e)})},cg=(e,t)=>{const r={...{position:"fixed",overflow:"auto",top:"0px",left:"0px",display:"none",height:"100%",width:"100%",transition:"background-color 0.3s ease-out",zIndex:2147483646}},i=t?e.overlayStyleMobile:e.overlayStyle;r["background-color"]=i==="light"?sg:lg,t||(r.margin="auto"),window.UserLeap.container&&Object.assign(window.UserLeap.container.style,r)},dg=(e,t,n)=>{var s,l;const r={position:"fixed",bottom:"0px",right:bi,border:0,backgroundColor:"rgba(0,0,0,0)",zIndex:2147483646},i=Object.assign({},t,window.UserLeap);let o,a=!1;return n?((s=window.UserLeap.windowDimensions)!=null&&s.width?r.width=`${window.UserLeap.windowDimensions.width}px`:r.width="100%",(l=window.UserLeap.windowDimensions)!=null&&l.height?r.maxHeight=`${window.UserLeap.windowDimensions.height-20}px`:window.UserLeap.maxHeight?r.maxHeight=window.UserLeap.maxHeight:r.maxHeight=`${document.body.clientHeight-20}px`,["light","dark"].includes(i.overlayStyleMobile)&&(a=!0)):(r.width=ug,r.maxHeight=window.UserLeap.maxHeight||"66vh",i.framePosition===_n.BottomLeft?o={left:bi}:i.framePosition===_n.TopLeft?o={left:bi,top:"0px"}:i.framePosition===_n.TopRight?o={top:"0px"}:i.framePosition===_n.Center&&(a=!0,o={margin:"auto",position:"static"},r.maxHeight=null)),a&&cg(i,n),Object.assign(e.style,r,o),a},fg=(e,t)=>{var s,l;const n="ul-frame";pc(),pg();const r=document.createElement("iframe");r.id=n,r.setAttribute("title","Sprig User Feedback Dialog");const i=dg(r,e,t);vc(),r.setHeight=u=>{parseInt(r.style.height)!=u&&(r.style.height=`${u}px`,$.emit(B.SurveyHeight,{name:B.SurveyHeight,contentFrameHeight:u}))},(s=window.UserLeap.container)==null||s.appendChild(r),e&&(t?e.exitOnOverlayClickMobile:e.exitOnOverlayClick)&&window.UserLeap.container&&(window.UserLeap.container.onclick=()=>{$.emit(B.CloseSurveyOnOverlayClick)}),$.emit(B.SurveyLifeCycle,{state:"presented"}),$.emit(B.SurveyPresented,{name:B.SurveyPresented});const o=(l=r.contentWindow)==null?void 0:l.document;o&&(o.open("text/html","replace"),o.write("<!doctype html><head></head><body></body></html>"),o.close());const a=o==null?void 0:o.head;return{frameId:n,contentWinDocHead:a,contentWindow:r.contentWindow,hasOverlay:i,iframe:r}},mc={[B.SurveyFadingOut]:()=>{window.UserLeap.container&&Object.assign(window.UserLeap.container.style,{"background-color":"rgba(0,0,0,0)"})}},pg=()=>{Object.entries(mc).forEach(([e,t])=>{$.on(e,t)})},hg=()=>{Object.entries(mc).forEach(([e,t])=>{$.off(e,t)})},vg="!launch_darkly_";class mg{constructor(){fe(this,"_ldData",{})}getAllLaunchDarklyVariations(){return this._ldData}setLDFlagsVariations(t){try{return!t||typeof t!="object"||Array.isArray(t)?!1:(Object.keys(this._ldData).forEach(n=>{delete this._ldData[n]}),Object.keys(t).forEach(n=>{var r;return this._ldData[`${vg}${n}`]=((r=t[n])!=null?r:0)+1}),!0)}catch(n){return n instanceof Error&&window.UserLeap.reportError("setAllLDFlagsVariations",n),console.warn("[Sprig] An issue had occured when setting LaunchDarkly flags and variations."),!1}}}const co=new mg;Object.freeze(co);const gg="!optimizely_experiments_";class yg{constructor(){fe(this,"_optimizelyData",{})}setOptimizelyExperiment(t,n=!0){if(!t||typeof t!="object")return!1;const{experiments:r}=t;try{return n&&Object.keys(this._optimizelyData).map(i=>{delete this._optimizelyData[i]}),r&&r.map(i=>{const{id:o,variation:a}=i,s=this.transformExperimentId(o);a&&typeof a=="string"&&(this._optimizelyData[s]=a)}),!0}catch(i){return i instanceof Error&&window.UserLeap.reportError("setOptimizelyExperiment",i),!1}}getAllOptimizelyExperiments(){return this._optimizelyData}getOptimizelyVariationName(t){return this._optimizelyData[this.transformExperimentId(t)]}transformExperimentId(t){return gg+t}getAndSetWebOptimizelyExperiments(){var t;try{if(window&&window.optimizely&&typeof window.optimizely.get=="function"){const n=(t=window.optimizely.get("state"))==null?void 0:t.getExperimentStates({isActive:!0});if(n){const r=Object.keys(n).map(i=>{var o,a;return(o=n[i].variation)!=null&&o.name?{id:i,variation:(a=n[i].variation)==null?void 0:a.name}:{id:i,variation:"Original"}});return this.setOptimizelyExperiment({experiments:r},!1),!0}return!1}return!1}catch(n){return n instanceof Error&&window.UserLeap.reportError("getAndSetWebOptimizely",n),!1}}}const _r=new yg;Object.freeze(_r);class _g{constructor(t,n){fe(this,"paused");fe(this,"queue");fe(this,"ul");this.ul=t,this.paused=!1,this.queue=[],this.flush(n)}flush(t){const n=t.length;if(n)for(let r=0;r<n;r++)this.push(t[r])}isPaused(){return this.paused}pause(){this.paused=!0}unpause(){this.paused=!1;const t=this.queue.slice();this.empty(),this.flush(t)}push(t){if(this.paused)this.queue.push(t);else if(t instanceof Function)t();else{const n=Array.prototype.slice.call(t,1),r=t[0],i=this.ul[r];i instanceof Function?i.apply(this.ul,n):r&&console.warn("[Sprig] (ERR-100) No valid UserLeap action called",r)}}perform(t){if(this.paused){let n=()=>{};const r=new Promise(function(i){n=function(){i(t())}});return this.queue.push(n),r}else return t()}empty(){this.queue.length=0}}var Ie=(e=>(e.Ready="ready",e.NoSurvey="no survey",e))(Ie||{}),gc=(e=>(e.Preview="sprigPreviewKey",e))(gc||{});const wg=["popState","pushState","replaceState"],bg={test:"test"},gn="!email",Eg=["ios","android"],Ut="environments",fo="pageUrl",St="visitors",As="ul-view-sdk-script",Us=Object.freeze({contains:(e,t)=>t.includes(e),notContains:(e,t)=>!t.includes(e),exactly:(e,t)=>t===e,notExactly:(e,t)=>t!==e,startsWith:(e,t)=>t.startsWith(e),endsWith:(e,t)=>t.endsWith(e),regex:(e,t)=>new RegExp(e).test(t),legacy:(e,t)=>new RegExp(e,"i").test(t)});function oa(e,t){const{matchType:n,pattern:r}=e,i=n?Us[n]:Us.legacy;let o=!1;try{o=i(r,t)}catch(a){const s=`[Sprig] (ERR-445) Failed to check url match with pattern ${r}`;a instanceof Error&&(console.warn(s,a),a.stack=JSON.stringify(e),window.UserLeap.reportError(s,a))}return o}function xg(e,t){const{pageUrlEvents:n,interactiveEvents:r,dismissOnPageChange:i}=window.UserLeap._config;if(!i)return!0;const o=[];n&&n.length&&o.push(...n),r&&r.length&&o.push(...r);const a=e&&o.find(s=>s.id===e);return a?oa(a,window.location.href):t===window.location.href}function Mn(e){const{pageUrlEvents:t,interactiveEvents:n,dismissOnPageChange:r,platform:i}=window.UserLeap._config;if(i&&i!==Pt.Web)return;const o=Ct("trackStartUrl"),a=o?String(o):null;t&&Ec(window.location.href),n&&(_c(),Sg()),r&&a&&a!==window.location.href&&e&&wg.includes(e.type)&&window.UserLeap("dismissActiveSurvey",Ke.PageChange)}const yc={capture:!0},Sg=()=>{const t=window.UserLeap._config.interactiveEvents.filter(r=>oa(r,window.location.href)).map(r=>{const{name:i,properties:o}=r,{selector:a,innerText:s}=o;return a?l=>{if(Jt(l.target))try{l.target.closest(a)&&window.UserLeap("track",i)}catch{}return!1}:l=>(Jt(l.target)&&l.target.innerText===s&&window.UserLeap("track",i),!1)}),n=r=>t.forEach(i=>i(r));window.UserLeap._config.interactiveEventsHandler=n,window.addEventListener("click",n,yc)},_c=()=>{window.UserLeap._config.interactiveEventsHandler&&window.removeEventListener("click",window.UserLeap._config.interactiveEventsHandler,yc),delete window.UserLeap._config.interactiveEventsHandler};function Cg(){["hashchange","popstate"].forEach(e=>window.addEventListener(e,Mn,!0))}function Ig(){["hashchange","popstate"].forEach(e=>window.removeEventListener(e,Mn,!0)),window.UserLeap._config.interactiveEvents&&_c()}function Qe(e,t,n){const r=[window.UserLeap._API_URL,"sdk",e];return t&&t.forEach(i=>{r.push(i),i===Ut?r.push(window.UserLeap.envId):i===St&&r.push(aa())}),n&&r.push(n),r.join("/")}function kg(e,t){let n=Qe("1",[Ut],"questions?");return e!=null&&(n+=`&vid=${e}`),t&&(t.surveyId&&(n+=`&surveyid=${t.surveyId}`),t.surveyTemplateId&&(n+=`&surveytemplateid=${t.surveyTemplateId}`),t.previewLanguage&&(n+=`&previewLanguage=${encodeURIComponent(t.previewLanguage)}`)),n}function wc(){try{if(typeof localStorage<"u"&&(localStorage.setItem("is_available","yes"),localStorage.getItem("is_available")==="yes"))return localStorage.removeItem("is_available"),!0}catch{return!1}return!1}function Ct(e){if(!window.UserLeap.localStorageAvailable)return null;const t=localStorage.getItem(be.Credentials);if(t)try{const r=JSON.parse(t)[window.UserLeap.envId];return r&&r[e]||null}catch(n){n instanceof Error&&(n.stack=t,window.UserLeap.reportError("Failed to parse local storage credentials",n)),console.warn("[Sprig] (ERR-427) Failed to lookup saved ids",n)}return null}function we(e,t){if(!window.UserLeap.localStorageAvailable)return;const n=localStorage.getItem(be.Credentials);let r={};if(n)try{r=JSON.parse(n)}catch(o){o instanceof Error&&(o.stack=n,window.UserLeap.reportError("Failed to parse local storage credentials",o)),console.warn("[Sprig] (ERR-427) Failed to lookup saved ids",o)}let i=r[window.UserLeap.envId];i?i[e]=t:i={[e]:t},r[window.UserLeap.envId]=i;try{localStorage.setItem(be.Credentials,JSON.stringify(r))}catch(o){o instanceof Error&&console.warn(`[Sprig] (ERR-426) Unable to write to Local Storage:: ${o.message}`)}}function bc(){window.previewMode||(window.UserLeap.visitorId=mt(),we("vid",window.UserLeap.visitorId),$.emit(B.VisitorIDUpdated,{visitorId:window.UserLeap.visitorId}))}function aa(){return window.previewMode?"0":window.UserLeap.visitorId||""}function Ec(e,t,n){if(!window.UserLeap.localStorageAvailable||e.endsWith("mock_snippet.html"))return;const r=window.UserLeap._config.pageUrlEvents;let i=!1;if(r&&r.length)for(let c=0;c<r.length&&(i=oa(r[c],e),!i);c++);if(!i)return;window.UserLeap.debugMode&&console.info("[DEBUG] Sprig trackPageView",e);const o=10,a=1;let s=[];const l={viewedAt:Date.now(),location:e},u=localStorage.getItem(be.PageViews);try{if(s=u?JSON.parse(u):[],Array.isArray(s)||(s=[]),s.length>0){const c=s[s.length-1],d=(Date.now()-c.viewedAt)/1e3;c.location!=e&&d>a&&Wa({url:e}),(c.location!=e&&d>a||d>o)&&(window.UserLeap._queue.push(["track",fo,t,{url:e},n]),s.push(l))}else window.UserLeap._queue.push(["track",fo,t,{url:e},n]),s.push(l),Wa({url:e});s.length>5&&s.splice(0,s.length-5);try{localStorage.setItem(be.PageViews,JSON.stringify(s))}catch(c){c instanceof Error&&console.warn(`[Sprig] Unable to write to Local Storage: ${c.message}`)}}catch(c){c instanceof Error&&window.UserLeap.reportError("trackPageView",c,{pageViewsStorage:u}),console.warn("[Sprig] (ERR-425) Failed to update page views in local storage")}}function Tg(){const e="Backbone"in window&&window.Backbone&&window.Backbone.history?window.Backbone.history:window.history;"pushState"in e&&(e.pushState=(t=>function(...r){const i=t.apply(this,r),o=new Event("pushState");return window.dispatchEvent(o),Mn(o),i})(e.pushState)),"replaceState"in e&&(e.replaceState=(t=>function(...r){const i=t.apply(this,r),o=new Event("replaceState");return window.dispatchEvent(o),Mn(o),i})(e.replaceState)),Cg()}async function Ei(e,t){const n=aa();e&&!t&&(window.UserLeap._config.mode=bg.test);const r=await ft(kg(n,{...e,previewLanguage:window.UserLeap._config.previewLanguage}),{},0,!0);return r.ok?(r.json.delay&&await Sr(r.json.delay),xc(r.json)):(r.reportError&&r.error&&(console.warn("[Sprig] (ERR-414) Failed to request questions from the server",r.error),window.UserLeap.reportError("getQuestions",r.error)),{success:!1,surveyState:Ie.NoSurvey})}const Lg=e=>e.some(t=>t.type===T.VideoVoice),xc=async e=>{var k,P,R,O,Y,ae;const{context:t,forceBrandedLogo:n,endCard:r,locale:i,productConfig:o,questions:a,responseGroupUid:s,surveyId:l,uuid:u,vid:c,sessionReplay:d}=e,f=en(window.UserLeap),p=sa(f),h=Rg(f);if(d&&ql({responseGroupId:s,surveyId:l,visitorId:c,replayParams:d,completeUploadHeaders:f,apiUrl:window.UserLeap._API_URL,triggerTimestamp:Date.now(),isStandalone:a.length===0}),c==null||!a||!a.length)return{success:!1,message:"[Sprig] no survey found",surveyState:Ie.NoSurvey};if(((P=(k=window.UserLeap)==null?void 0:k._config)==null?void 0:P.installationMethod)===rt.NpmBundled&&Lg(a))return{success:!1,message:"[Sprig] bundled version does not support video voice",surveyState:Ie.NoSurvey};if(window.UserLeap.container){const G="[Sprig] (ERR-409) Found an existing Survey container, aborting rendering of this survey";return console.warn(G),{success:!1,message:G,surveyState:Ie.NoSurvey}}if(c!==window.UserLeap.visitorId&&u!==window.UserLeap.visitorId&&!window.previewMode){const G="Attempted to display survey to a different visitor";return window.UserLeap.reportError("DisplaySurvey",new Error(G)),{success:!1,message:G,surveyState:Ie.NoSurvey}}ov({id:l}),Ii.disable(),$.emit(B.SurveyWillPresent,{name:B.SurveyWillPresent,[Os.SurveyId]:l});let v,g=document.createElement("div"),w,_,b;const E=G=>{const{[Lt.ViewVersion]:ue}=G;ue!==f["x-ul-sdk-version"]&&hc(),$.removeListener(Re.VerifyViewVersion,E)};$.on(Re.VerifyViewVersion,E),Wt(f)?(v="ul-direct-embeded-frame",w=document.head,_=window,b=!1,p&&(pc(),g.id=v,window.UserLeap.container.appendChild(g),vc(),$.emit(B.SurveyLifeCycle,{state:"presented"}),$.emit(B.SurveyPresented,{name:B.SurveyPresented}))):{frameId:v,contentWinDocHead:w,contentWindow:_,hasOverlay:b,iframe:g}=fg(o,h),window.UserLeap.frameId=v,window.UserLeap.useMobileStyling=h;const m=G=>{$.on(B.CloseSurveyOnOverlayClick,G)},x=Object.assign({frame:g,envId:window.UserLeap.envId,surveyId:l,userId:u,visitorAttributes:{externalUserId:window.UserLeap.userId,email:window.UserLeap.email},cards:a,context:t,locale:i,fontFamily:window.UserLeap.fontFamily,fontFamilyURL:window.UserLeap.fontFamilyURL,apiURL:window.UserLeap._API_URL,responseGroupUid:s,headers:f,endCard:r,useMobileStyling:h,mobileSDKVersion:window.UserLeap.mobileSDKVersion,configureExitOnOverlayClick:m,eventEmitFn:$.emit.bind($),ulEvents:ho,viewDocument:_==null?void 0:_.document,viewWindow:_,tabTitle:document.title,startingQuestionIdx:(R=window.UserLeap.config)==null?void 0:R.startingQuestionIdx,styleNonce:window.UserLeap.styleNonce,previewKey:(O=window.UserLeap)!=null&&O.localStorageAvailable?(Y=window.localStorage)==null?void 0:Y.getItem(be.Preview):null,forceBrandedLogo:n},window.UserLeap._config);(ae=window.UserLeap.config)!=null&&ae.startingQuestionIdx&&(window.UserLeap.config={...window.UserLeap.config,startingQuestionIdx:null}),window.UserLeap.customStyles&&(x.customStyles=window.UserLeap.customStyles),_&&(_.__cfg=x);function I(){const G=document.createElement("script");return window.UserLeap.nonce&&G.setAttribute("nonce",window.UserLeap.nonce),G.id=As,G}const C=window.UserLeap.viewSDKURL?window.UserLeap.viewSDKURL:x.path,S=document.getElementById(As);S&&S.remove();const L=I(),D=()=>{window.UserLeap.container&&Object.assign(window.UserLeap.container.style,{display:"flex"})};return x.installationMethod===rt.Npm||x.installationMethod===rt.NpmBundled?(ag.configure(x),b&&window.UserLeap.container&&D()):C&&(L.src=C,b&&L.addEventListener("load",()=>{window.UserLeap.container&&D()}),_==null||_.addEventListener("error",G=>{G.target instanceof HTMLScriptElement&&G.target.src===C&&window.UserLeap.reportError("loadFrameScript",new Error("Frame script failed to load"))},{capture:!0,once:!0})),w==null||w.appendChild(L),{success:!0,surveyState:Ie.Ready,surveyId:l,responseGroupUid:s}};function Rg(e){if(window.UserLeap.useMobileStyling!==void 0)return window.UserLeap.useMobileStyling;const t=window.UserLeap.windowDimensions&&window.UserLeap.windowDimensions.width||document.body.clientWidth;return sa(e)||t>10&&t<Af}function sa(e){return Eg.includes(e[He.Platform])}function Ag(e){let t=e.length;for(;t;){const n=Math.floor(Math.random()*t);t-=1;const r=e[t];e[t]=e[n],e[n]=r}}function Ug(e){if(!e)return;window.UserLeap._config=e,e.mute&&window.UserLeap._queue.pause();const{interactiveEvents:t,pageUrlEvents:n,dismissOnPageChange:r}=e;t&&Ag(t),(t||n||r)&&(Tg(),Mn())}async function ft(e,t,n=0,r=!1){var o,a;t.headers=Object.assign(en(window.UserLeap),t.headers);const i=await it(e,t,n,r);if(i.ok){const s=(o=i.headers)==null?void 0:o.get("Authorization"),l=s?s.split(" "):void 0,u=l&&l.length===2?l[1]:void 0,c=(a=i.headers)==null?void 0:a.get(He.VisitorID);u&&c&&(c!==window.UserLeap.visitorId||window.UserLeap.token!==u)&&(we("token",u),we("vid",c),$.emit(B.VisitorIDUpdated,{visitorId:c}),window.UserLeap.token=u,window.UserLeap.visitorId=c)}return i.json&&i.json.logMessage&&console.warn(`[Sprig] ${i.json.logMessage}`),i}async function Og(e,t){var r,i;let n=!0;return t&&((r=e==null?void 0:e.json)==null?void 0:r.surveyId)&&(window.UserLeap.delayingSurvey=!0,n=await t(e.json.surveyId),window.UserLeap.delayingSurvey=!1,!n)?!1:((i=e==null?void 0:e.json)!=null&&i.delay&&(window.UserLeap.delayingSurvey=!0,await Sr(e.json.delay),window.UserLeap.delayingSurvey=!1),n)}const Dg=function(e){if(!window.UserLeap)return;const t=async(r={})=>{var v,g,w,_,b;const{userId:i,anonymousId:o,metadata:a={},properties:s,showSurveyCallback:l}=r;let{eventName:u}=r;if(window.UserLeap.debugMode&&u!==fo&&console.info("[DEBUG] Sprig track",r),e.mode==="test")return;const c=window.UserLeap.localStorageAvailable&&(v=localStorage.getItem(be.Preview))!=null?v:void 0;if(e.requireUserIdForTracking&&!window.UserLeap.userId&&!i){const E="[Sprig] - Skipping tracking without userId";return console.warn(E),{success:!1,message:E,surveyState:Ie.NoSurvey}}if(!u||u.trim().length===0){u=u?String(u):"";const E="[Sprig] - Invalid event name "+u;return console.warn(E),{success:!1,message:E,surveyState:Ie.NoSurvey}}const d=window.location.href;if(a.url||(a.url=d),we("trackStartUrl",d),(w=(g=window.UserLeap)==null?void 0:g._config)!=null&&w.optimizelyEnabled){const E=en(window.UserLeap);sa(E)||_r.getAndSetWebOptimizelyExperiments(),a.optimizelyExperiments=Object.assign({},_r.getAllOptimizelyExperiments())}(b=(_=window.UserLeap)==null?void 0:_._config)!=null&&b.launchDarklyEnabled&&(a.launchDarklyFlags=co.getAllLaunchDarklyVariations()),i&&(window.UserLeap.userId=i),o&&(window.UserLeap.partnerAnonymousId=o),s&&(a.eventProperties=s),iv({name:u});const f=window.UserLeap.delayingSurvey?await ft(Qe("1",[St],"events/batch"),{body:JSON.stringify({events:[{event:u,metadata:a}],previewKey:c}),method:"POST"},0,!0):await ft(Qe("1",[St],"events"),{body:JSON.stringify({event:u,metadata:a,previewKey:c}),method:"POST"},0,!0);if(!f.ok){const E="[Sprig] (ERR-421) Failed to track event";return f.reportError&&(console.warn(E,f.error),f.error&&window.UserLeap.reportError("track",f.error)),{success:!1,message:E,error:f.error,surveyState:Ie.NoSurvey}}i&&we("uid",i),o&&we("aid",o);const p=f.json;return p.invalidPreviewKey&&window.UserLeap.localStorageAvailable&&localStorage.removeItem(be.Preview),await Og(f,l)?xg(p.eventId,d)?xc(p):{success:!1,message:"Study should not be displayed after page navigation",surveyState:Ie.NoSurvey}:{success:!1,message:"[Sprig] Callback returned false, aborting rendering of survey",surveyState:Ie.NoSurvey}},n={async displaySurvey(r){return console.warn("[Sprig] displaySurvey should only be used to debug your studies; not intended for production usage."),window.UserLeap("dismissActiveSurvey",Ke.Override),Ei({surveyId:r},!0)},_previewSurvey(r){window.UserLeap("dismissActiveSurvey",Ke.Override),Ei({surveyTemplateId:r},!1)},_reviewSurvey(r){window.UserLeap("dismissActiveSurvey",Ke.Override),Ei({surveyId:r},!1)},previewSurvey(r){n._previewSurvey(r)},reviewSurvey(r){n._reviewSurvey(r)},mute(){window.UserLeap._queue.pause()},unmute(){window.UserLeap._queue.unpause()},setVisitorToken(){console.warn("[Sprig] setVisitorToken is deprecated.")},dismissActiveSurvey(r=Ke.API){$.emit(B.SurveyWillClose,{name:B.SurveyWillClose,initiator:r})},async setAttribute(r,i){if(!r||!i&&i!==0){const o="[Sprig] - Disregarding empty attribute / value provided";return console.warn(o),{success:!1,message:o}}return this.setAttributes({[r]:i})},async setAttributes(r){if(r==null||Object.keys(r).length===0){const i="[Sprig] - Disregarding empty attributes provided";return console.warn(i),{success:!1,message:i}}return this.identifyAndSetAttributes({attributes:r})},async identifyAndSetAttributes(r){if(window.UserLeap.debugMode&&console.info("[DEBUG] Sprig identifyAndSetAttributes",r),e.mode==="test")return;if(r===null||typeof r!="object"||!(r.userId||r.anonymousId||r.attributes)){const u="[Sprig] - Disregarding empty payload provided";return console.warn(u),{success:!1,message:u}}const{userId:i,anonymousId:o,attributes:a}=r;if(e.requireUserIdForTracking&&!window.UserLeap.userId&&!i){const u="[Sprig] - Skipping tracking without userId";return console.warn(u),{success:!1,message:u}}if(!a&&(!i||window.UserLeap.userId===i)&&(!o||window.UserLeap.partnerAnonymousId===o))return{success:!0};const s={};i&&(s.userId=window.UserLeap.userId=i),o&&(s.partnerAnonymousId=window.UserLeap.partnerAnonymousId=o);let l;return a?(a.email&&!Object.prototype.hasOwnProperty.call(a,gn)&&(a[gn]=a.email,delete a.email),l=await ft(Qe("1",[Ut,St],"attributes"),{body:JSON.stringify(a),method:"PUT"}),!l.ok&&l.reportError&&(console.warn("[Sprig] (ERR-432) identifyAndSetAttributes failed",l.error),l.error&&window.UserLeap.reportError("identifyAndSetAttributes",l.error))):l=await ft(Qe("1",[Ut,St]),{body:JSON.stringify(s),method:"PUT"}),a&&a[gn]&&(window.UserLeap.email=a[gn]),l.ok&&(i&&we("uid",i),o&&we("aid",o)),{success:!!l.ok}},async removeAttributes(r){if(window.UserLeap.debugMode&&console.info("[DEBUG] Sprig removeAttributes",r),e.mode==="test")return;if(r==null||r.length===0){const o="[Sprig] - Disregarding empty attributes provided";return console.warn(o),{success:!1,message:o}}if(e.requireUserIdForTracking&&!window.UserLeap.userId){const o="[Sprig] - Skipping tracking without userId";return console.warn(o),{success:!1,message:o}}const i=await ft(Qe("1",[Ut,St],"attributes"),{body:JSON.stringify({delete:r}),method:"DELETE"});return!i.ok&&i.reportError&&(console.warn("[Sprig] (ERR-433) Remove attributes failed",i.error),i.error&&window.UserLeap.reportError("removeAttributes",i.error)),{success:!!i.ok}},async addSurveyListener(r){$.on(B.SurveyLifeCycle,r)},async removeSurveyListener(r){$.removeListener(B.SurveyLifeCycle,r)},async addListener(r,i){$.on(r,i)},async removeListener(r,i){$.removeListener(r,i)},async removeAllListeners(){$.removeAllListeners()},setPreviewKey(r){if(!r||typeof r!="string")return;const i=wc();window.UserLeap.localStorageAvailable=i,i&&r&&localStorage.setItem(be.Preview,r)},async setUserId(r){if(window.UserLeap.debugMode&&console.info("[DEBUG] Sprig setUserId",r),r==null){const a=`[Sprig] - Invalid userId ${r}`;return console.warn(a),{success:!1,message:a}}if(e.mode==="test"||r===window.UserLeap.userId)return;window.UserLeap.userId=r;const i=window.UserLeap.visitorId,o=await ft(Qe("1",[Ut,St]),{body:JSON.stringify({userId:r}),method:"PUT"});if(!o.ok){o.reportError&&(console.warn("[Sprig] (ERR-420) Failed to set user id",o.error),o.error&&window.UserLeap.reportError("setUserId",o.error));return}i!==window.UserLeap.visitorId&&za(),we("uid",r)},async setPartnerAnonymousId(r){if(window.UserLeap.debugMode&&console.info("[DEBUG] Sprig setPartnerAnonymousId",r),r==null){const i=`[Sprig] - Invalid partnerAnonymousId ${r}`;return console.warn(i),{success:!1,message:i}}return window.UserLeap.partnerAnonymousId=r,we("aid",r),{success:!0}},async track(r,i,o={},a=void 0){return t({eventName:r,properties:i,metadata:o,showSurveyCallback:a})},async identifyAndTrack(r){return await t(r)},trackPageView(r,i=void 0,o=void 0){Ec(r,i,o)},applyStyles(r){if(window.UserLeap.customStyles=r,window.UserLeap.container){const i=window.UserLeap.container.children[0].contentDocument;if(i){const o=i.getElementById(U.CustomStyle);o?o.textContent=r:Xs(i,r,window.UserLeap.styleNonce)}}},setWindowDimensions(r,i){var l,u;const o=typeof r=="string"?parseInt(r,10):r,a=typeof i=="string"?parseInt(i,10):i;if(!isNaN(o)&&!isNaN(a)&&(window.UserLeap.windowDimensions={width:o,height:a}),!window.UserLeap.frameId)return;const s=document.getElementById(window.UserLeap.frameId);!s||(window.UserLeap.useMobileStyling&&((l=window.UserLeap.windowDimensions)!=null&&l.width&&(s.style.width=`${window.UserLeap.windowDimensions.width}px`),(u=window.UserLeap.windowDimensions)!=null&&u.height&&(s.style.maxHeight=`${window.UserLeap.windowDimensions.height-20}px`),s.contentDocument&&(s.style.height=String(Js(s.contentDocument))+"px")),$.emit(B.SurveyDimensions,{name:B.SurveyDimensions,contentFrameWidth:s.clientWidth,contentFrameHeight:s.clientHeight}))},logoutUser(){window.UserLeap.debugMode&&console.info("[DEBUG] Sprig logout"),window.UserLeap.visitorId=null,window.UserLeap.userId=null,window.UserLeap.partnerAnonymousId=null,window.UserLeap.token=null,window.UserLeap.email=null,window.UserLeap.localStorageAvailable&&(localStorage.removeItem(be.Credentials),localStorage.removeItem(be.PageViews)),window.UserLeap._queue.isPaused()&&window.UserLeap._queue.empty(),bc(),za(),window.UserLeap._queue.unpause()},teardown(){Ig(),window.UserLeap("dismissActiveSurvey",Ke.API),delete window.UserLeap,delete window.Sprig,delete window._Sprig},integrateOptimizely(r,i=!0){var o,a;if(!((a=(o=window.UserLeap)==null?void 0:o._config)!=null&&a.optimizelyEnabled)){console.warn("[SPRIG] Optimizely integration is currently not enabled for your product.");return}try{const s=typeof r=="string"?JSON.parse(r):r;_r.setOptimizelyExperiment(s,i)}catch(s){console.warn("[Sprig] Error with integrating Optimizely data"),s instanceof Error&&window.UserLeap.reportError("integrateOptimizely",s)}},integrateOptimizelyClient(r){var o,a;if(!((a=(o=window.UserLeap)==null?void 0:o._config)!=null&&a.optimizelyEnabled)){console.warn("[SPRIG] Optimizely integration is currently not enabled for your product.");return}const i=({experiment:s,variation:l})=>{const u={experiments:[{id:s.id,variation:l.key}]};window.UserLeap("integrateOptimizely",u,!1)};r.notificationCenter.addNotificationListener(Cf.NOTIFICATION_TYPES.ACTIVATE,i)},importLaunchDarklyData(r){var i,o;if(!((o=(i=window.UserLeap)==null?void 0:i._config)!=null&&o.launchDarklyEnabled)){console.warn("[SPRIG] LaunchDarkly integration is currently not enabled for your product.");return}co.setLDFlagsVariations(r)},setVisitorAttribute(r,i){return console.warn("[Sprig] setVisitorAttribute is deprecated. Please use setAttribute"),n.setAttribute(r,i)},async setEmail(r){return n.setAttribute(gn,r)},async setVisitorEmail(r){return console.warn("[Sprig] setVisitorEmail is deprecated. Please use setEmail"),n.setEmail(r)},async _generateVideoUploadUrl(r){return Vg(r)},async _completeSessionReplay({surveyId:r,responseGroupUuid:i,eventDigest:o}){if(!r||!i)return;const a=window.UserLeap._API_URL;try{await sl({surveyId:r,responseGroupUuid:i,eventDigest:o,apiUrl:a,headers:en(window.UserLeap)},!0)}catch(s){console.warn("[Sprig] Error with completing session replay"),s instanceof Error&&window.UserLeap.reportError("completeSessionReplay",s)}}};Object.assign(window.UserLeap,n)};async function Pg(e){const t=en(window.UserLeap);document.addEventListener("securitypolicyviolation",ki);const n=await it(Qe("1",[Ut],"config"),{headers:t}),r="TypeError";if(window.UserLeap.error=n.error,!n.ok&&n.error&&n.error.name===r?(window.UserLeap._API_URL="https://api.sprig.com",window.UserLeap.reportError("sprigDomainRequest",n.error)):document.removeEventListener("securitypolicyviolation",ki),!n.ok)return n.reportError&&(console.warn("[Sprig] (ERR-422) Failed to load configuration",n.error),n.error&&window.UserLeap.reportError("applyRemoteConfig",n.error)),Ti("Disabled: failed to fetch configuration"),e;const i=n.json;return i!=null&&i.disabled?(Ti(`Disabled: ${i.disabled}`),{disabled:i.disabled}):Object.assign({},i,e)}async function Ng(e,t,n={}){const r=window.__cfg&&window.__cfg.mode,i=aa(),o=window.UserLeap.envId,a=window.document.documentElement,s={mode:r,screenWidth:window.screen.width,screenHeight:window.screen.height,clientWidth:a.clientWidth,clientHeight:a.clientHeight,location:window.location.href,language:window.navigator.language,...n},l={action:e,err:{message:t.message,stack:t.stack},meta:s,vid:i,envId:o};(await ft(Qe("1",null,"errors"),{method:"POST",headers:{[He.Error]:window.btoa(`userleap-${Date.now()}-error`)},body:JSON.stringify(l)},0,!0)).ok||console.warn("[Sprig] (ERR-444) Failed to report error to API",t)}async function Vg(e){var n;if(!e)return;const t=`${window.UserLeap._API_URL}/2/environments/integrations/upload`;try{const r=await fetch(t,{method:"POST",cache:"no-cache",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(r.ok){const i=await r.json();return(n=i==null?void 0:i.upload)==null?void 0:n.url}else return null}catch(r){console.warn("[Sprig] Error with generating video upload url"),r instanceof Error&&window.UserLeap.reportError("generateVideoUploadUrl",r)}}function Mg(e={}){var i;const t=(i=new URLSearchParams(window.location.search).get(gc.Preview))!=null?i:"",n=wc();window.UserLeap.localStorageAvailable=n,window.UserLeap.UPDATES=ho,window.UserLeap("setPreviewKey",t);async function r(){if(window.UserLeap.loaded)return;if(window.UserLeap.reportError=Ng,window.UserLeap.loaded=!0,window.UserLeap._config=Object.assign({},e,window.UserLeap.config),window.UserLeap.delayingSurvey=!1,window.UserLeap._config&&typeof window.UserLeap._config=="object")for(const u in window.UserLeap._config)window.UserLeap[u]=window.UserLeap._config[u];if(!window.UserLeap.envId)if(window.UserLeap.appId)window.UserLeap.envId=window.UserLeap.appId;else throw new Error("Missing Environment id");window.UserLeap.debugMode&&console.info("[DEBUG] Sprig debug mode enabled");const o=window.UserLeap.sampleRate;if(o)if(!n)window.UserLeap.debugMode&&console.info("[DEBUG] Sprig cannot sample users without localStorage permissions");else{let u=Ct("sampled");if(u===null&&(u=Math.random()<o,we("sampled",u)),!u)return}else n&&Ct("sampled")!==null&&we("sampled",null);window.UserLeap._API_URL||(window.UserLeap._API_URL="https://api.sprig.com");const a=[...window.UserLeap._queue];window.UserLeap._queue=new _g(window.UserLeap,[]),window.UserLeap._queue.pause();for(let u=0;u<a.length;u++)window.UserLeap._queue.push(a[u]);const s=Ct("token");s?(window.UserLeap.token=s,window.UserLeap.visitorId=Ct("vid"),window.UserLeap.userId=Ct("uid"),window.UserLeap.partnerAnonymousId=Ct("aid")):(window.UserLeap.localStorageAvailable&&localStorage.removeItem(be.Credentials),bc());const l=await Pg(e);qh(window.document,l.maxReplayDurationSeconds,window.UserLeap.replayNonce,window.UserLeap.maxInflightReplayRequests,l.replaySettings),Dg(l),await Ug(l),window.UserLeap._queue.unpause(),$.emit(B.SDKReady),$.emit(B.VisitorIDUpdated,{visitorId:window.UserLeap.visitorId})}document.readyState==="complete"?r():window.attachEvent?window.attachEvent("onload",r):window.addEventListener("load",r,!1)}class Br{constructor(){fe(this,"UPDATES",ho)}displaySurvey(t){window.Sprig("displaySurvey",t)}mute(){window.Sprig("mute")}unmute(){window.Sprig("unmute")}dismissActiveSurvey(){window.Sprig("dismissActiveSurvey")}setAttribute(t,n){window.Sprig("setAttribute",t,n)}setAttributes(t){window.Sprig("setAttributes",t)}identifyAndSetAttributes(t){window.Sprig("identifyAndSetAttributes",t)}removeAttributes(t){window.Sprig("removeAttributes",t)}addListener(t,n){window.Sprig("addListener",t,n)}removeListener(t,n){window.Sprig("removeListener",t,n)}removeAllListeners(){window.Sprig("removeAllListeners")}setEmail(t){window.Sprig("setAttribute","!email",t)}setUserId(t){window.Sprig("setUserId",t)}setPartnerAnonymousId(t){window.Sprig("setPartnerAnonymousId",t)}track(t,n={},r={}){window.Sprig("track",t,n,r)}identifyAndTrack(t){window.Sprig("identifyAndTrack",t)}trackPageView(t,n,r){window.Sprig("trackPageView",t,n,r)}applyStyles(t){window.Sprig("applyStyles",t)}setWindowDimensions(t,n){window.Sprig("setWindowDimensions",t,n)}logoutUser(){window.Sprig("logoutUser")}teardown(){window.Sprig("teardown")}}const po={configure:e=>{if(!e.envId&&!e.environmentId)throw new Error("Initialization Error: Sprig configure requires an environmentId");if(e.envId||(e.envId=e.environmentId||""),e.installationMethod="web-npm",window.Sprig)return window.Sprig;window.Sprig=function(){window.Sprig._queue.push(arguments)},Object.getOwnPropertyNames(Br.prototype).map(n=>{n!=="constructor"&&(window.Sprig[n]=Br.prototype[n])});const t=window.Sprig;return t.appId=e.envId,t._queue=[],window.UserLeap=t,Mg(e),window.Sprig}},jg={sprig:po,SprigAPI:Br,configure:po.configure};exports.DismissReason=Ke;exports.SprigAPI=Br;exports.SprigEvent=B;exports.default=jg;exports.sprig=po;
704
+ `,rg=(e,t)=>{const n=[...e],r=new Set([T.VideoVoice,T.RecordedTask]);return e.some(i=>r.has(i.type))&&n.push({name:-2,props:{routingOptions:[]},type:T.Uploading}),t&&n.push({name:-1,props:{routingOptions:[]},type:T.Thanks}),n},ig=({mode:e=null,viewWindow:t,viewDocument:n})=>{const r=n.documentElement;return{mode:e,sw:t.screen.width,sh:t.screen.height,cw:r.clientWidth,ch:r.clientHeight,p:t.location.href,l:t.navigator.language}};function og(e,t=!0){var m;const{answers:n,apiURL:r,customStyles:i,endCard:o,eventEmitFn:a,fontFamilyURL:s,frame:l,previewKey:u,viewDocument:c,viewWindow:d}=e,f=Wt(e.headers)?e.frame:c.body,p=e.UpChunk||window.UpChunk,h=$,v=rg(e.cards,!!o);mr.configure(h,{cards:v,hasEndCard:!!o,apiURL:r,UpChunk:p}),ee.setState({apiURL:r,answers:n,border:e.border,index:e.startingQuestionIdx||0,cards:v,configureExitOnOverlayClick:e.configureExitOnOverlayClick,customMetadata:e.customMetadata,endCard:e.endCard,envId:e.envId,eventEmitFn:a,fontFamily:e.fontFamily,forceBrandedLogo:e.forceBrandedLogo,frame:l,headers:e.headers,hasViewedEmbed:!1,isPreview:e.isPreview,marketingUrl:"https://sprig.com",meta:ig({mode:e.mode,viewWindow:d,viewDocument:c}),mode:e.mode,previewKey:u,recorder:mr,recorderEventEmitter:h,responseGroupUid:e.responseGroupUid,showStripes:e.showStripes,showSurveyBrand:e.showSurveyBrand,slugName:e.slugName,styleNonce:e.styleNonce,surveyId:e.surveyId,tabTitle:e.tabTitle,uploadingCardViewed:!1,uploadProgress:{},useMobileStyling:e.useMobileStyling,useDesktopPrototype:e.useDesktopPrototype,userId:e.userId,viewDocument:e.viewDocument,visitorAttributes:e.visitorAttributes,viewedCardCount:e.startingQuestionIdx||0});const{seen:g}=ee.getState();g();const{head:w}=c,_=c.createElement("style");if(_.id="sprig-style",_.textContent=ng,_.nonce=e.styleNonce,w.appendChild(_),e.fontFamily&&s&&parent){const x=c.createElement("link");x.rel="stylesheet",x.href=s,w.appendChild(x)}if(e.customStyles&&Xs(c,i,e.styleNonce),!p)if(e.installationMethod!==rt.Npm){const x=c.createElement("script");x.src="https://cdn.sprig.com/userleap-web-upchunk-v2.2.2.js",x.onload=()=>{mr.setUpChunk(d.UpChunk)},x.onerror=()=>{console.warn("[Sprig] - recording functionality not configured due to UpChunk library load failure")},w.appendChild(x)}else console.warn("[Sprig] - recording functionality not configured due to missing UpChunk dependency");const b="2.24.11",E=a||((m=l.eventEmitter)==null?void 0:m.emit);E==null||E(Re.VerifyViewVersion,{[Lt.ViewVersion]:b}),f&&t&&on(y(tg,{}),f)}const ag={configure:og};window.UserLeap&&window.Sprig&&(window.Sprig._gtm?window.Sprig=window.UserLeap:window.UserLeap=window.Sprig);window.UserLeap||(window.UserLeap=window.Sprig);window.Sprig||(window.Sprig=window.UserLeap);const sg="rgba(255,255,255, 0.95)",lg="rgba(0,0,0,0.9)",ug="360px",bi="0px",pc=()=>{window.UserLeap.container=document.createElement("div"),window.UserLeap.container.className="ul-container",document.body.appendChild(window.UserLeap.container)},hc=e=>{hg();const t=window.UserLeap.container;if(!(!t||!t.parentNode))try{t.parentNode.removeChild(t),window.UserLeap.container=null,we("trackStartUrl",null),$.emit(B.SurveyLifeCycle,{state:"dismissed"}),$.emit(B.SurveyClosed,{name:B.SurveyClosed,initiator:e})}catch(n){console.warn(`[Sprig] (ERR-412) Error removing UserLeap container by ${e} `+t),n instanceof Error&&window.UserLeap.reportError("dismissActiveSurvey",n)}},vc=()=>{$.on(B.SurveyWillClose,({initiator:e})=>{hc(e)})},cg=(e,t)=>{const r={...{position:"fixed",overflow:"auto",top:"0px",left:"0px",display:"none",height:"100%",width:"100%",transition:"background-color 0.3s ease-out",zIndex:2147483646}},i=t?e.overlayStyleMobile:e.overlayStyle;r["background-color"]=i==="light"?sg:lg,t||(r.margin="auto"),window.UserLeap.container&&Object.assign(window.UserLeap.container.style,r)},dg=(e,t,n)=>{var s,l;const r={position:"fixed",bottom:"0px",right:bi,border:0,backgroundColor:"rgba(0,0,0,0)",zIndex:2147483646},i=Object.assign({},t,window.UserLeap);let o,a=!1;return n?((s=window.UserLeap.windowDimensions)!=null&&s.width?r.width=`${window.UserLeap.windowDimensions.width}px`:r.width="100%",(l=window.UserLeap.windowDimensions)!=null&&l.height?r.maxHeight=`${window.UserLeap.windowDimensions.height-20}px`:window.UserLeap.maxHeight?r.maxHeight=window.UserLeap.maxHeight:r.maxHeight=`${document.body.clientHeight-20}px`,["light","dark"].includes(i.overlayStyleMobile)&&(a=!0)):(r.width=ug,r.maxHeight=window.UserLeap.maxHeight||"66vh",i.framePosition===_n.BottomLeft?o={left:bi}:i.framePosition===_n.TopLeft?o={left:bi,top:"0px"}:i.framePosition===_n.TopRight?o={top:"0px"}:i.framePosition===_n.Center&&(a=!0,o={margin:"auto",position:"static"},r.maxHeight=null)),a&&cg(i,n),Object.assign(e.style,r,o),a},fg=(e,t)=>{var s,l;const n="ul-frame";pc(),pg();const r=document.createElement("iframe");r.id=n,r.setAttribute("title","Sprig User Feedback Dialog");const i=dg(r,e,t);vc(),r.setHeight=u=>{parseInt(r.style.height)!=u&&(r.style.height=`${u}px`,$.emit(B.SurveyHeight,{name:B.SurveyHeight,contentFrameHeight:u}))},(s=window.UserLeap.container)==null||s.appendChild(r),e&&(t?e.exitOnOverlayClickMobile:e.exitOnOverlayClick)&&window.UserLeap.container&&(window.UserLeap.container.onclick=()=>{$.emit(B.CloseSurveyOnOverlayClick)}),$.emit(B.SurveyLifeCycle,{state:"presented"}),$.emit(B.SurveyPresented,{name:B.SurveyPresented});const o=(l=r.contentWindow)==null?void 0:l.document;o&&(o.open("text/html","replace"),o.write("<!doctype html><head></head><body></body></html>"),o.close());const a=o==null?void 0:o.head;return{frameId:n,contentWinDocHead:a,contentWindow:r.contentWindow,hasOverlay:i,iframe:r}},mc={[B.SurveyFadingOut]:()=>{window.UserLeap.container&&Object.assign(window.UserLeap.container.style,{"background-color":"rgba(0,0,0,0)"})}},pg=()=>{Object.entries(mc).forEach(([e,t])=>{$.on(e,t)})},hg=()=>{Object.entries(mc).forEach(([e,t])=>{$.off(e,t)})},vg="!launch_darkly_";class mg{constructor(){fe(this,"_ldData",{})}getAllLaunchDarklyVariations(){return this._ldData}setLDFlagsVariations(t){try{return!t||typeof t!="object"||Array.isArray(t)?!1:(Object.keys(this._ldData).forEach(n=>{delete this._ldData[n]}),Object.keys(t).forEach(n=>{var r;return this._ldData[`${vg}${n}`]=((r=t[n])!=null?r:0)+1}),!0)}catch(n){return n instanceof Error&&window.UserLeap.reportError("setAllLDFlagsVariations",n),console.warn("[Sprig] An issue had occured when setting LaunchDarkly flags and variations."),!1}}}const co=new mg;Object.freeze(co);const gg="!optimizely_experiments_";class yg{constructor(){fe(this,"_optimizelyData",{})}setOptimizelyExperiment(t,n=!0){if(!t||typeof t!="object")return!1;const{experiments:r}=t;try{return n&&Object.keys(this._optimizelyData).map(i=>{delete this._optimizelyData[i]}),r&&r.map(i=>{const{id:o,variation:a}=i,s=this.transformExperimentId(o);a&&typeof a=="string"&&(this._optimizelyData[s]=a)}),!0}catch(i){return i instanceof Error&&window.UserLeap.reportError("setOptimizelyExperiment",i),!1}}getAllOptimizelyExperiments(){return this._optimizelyData}getOptimizelyVariationName(t){return this._optimizelyData[this.transformExperimentId(t)]}transformExperimentId(t){return gg+t}getAndSetWebOptimizelyExperiments(){var t;try{if(window&&window.optimizely&&typeof window.optimizely.get=="function"){const n=(t=window.optimizely.get("state"))==null?void 0:t.getExperimentStates({isActive:!0});if(n){const r=Object.keys(n).map(i=>{var o,a;return(o=n[i].variation)!=null&&o.name?{id:i,variation:(a=n[i].variation)==null?void 0:a.name}:{id:i,variation:"Original"}});return this.setOptimizelyExperiment({experiments:r},!1),!0}return!1}return!1}catch(n){return n instanceof Error&&window.UserLeap.reportError("getAndSetWebOptimizely",n),!1}}}const _r=new yg;Object.freeze(_r);class _g{constructor(t,n){fe(this,"paused");fe(this,"queue");fe(this,"ul");this.ul=t,this.paused=!1,this.queue=[],this.flush(n)}flush(t){const n=t.length;if(n)for(let r=0;r<n;r++)this.push(t[r])}isPaused(){return this.paused}pause(){this.paused=!0}unpause(){this.paused=!1;const t=this.queue.slice();this.empty(),this.flush(t)}push(t){if(this.paused)this.queue.push(t);else if(t instanceof Function)t();else{const n=Array.prototype.slice.call(t,1),r=t[0],i=this.ul[r];i instanceof Function?i.apply(this.ul,n):r&&console.warn("[Sprig] (ERR-100) No valid UserLeap action called",r)}}perform(t){if(this.paused){let n=()=>{};const r=new Promise(function(i){n=function(){i(t())}});return this.queue.push(n),r}else return t()}empty(){this.queue.length=0}}var Ie=(e=>(e.Ready="ready",e.NoSurvey="no survey",e))(Ie||{}),gc=(e=>(e.Preview="sprigPreviewKey",e))(gc||{});const wg=["popState","pushState","replaceState"],bg={test:"test"},gn="!email",Eg=["ios","android"],Ut="environments",fo="pageUrl",St="visitors",As="ul-view-sdk-script",Us=Object.freeze({contains:(e,t)=>t.includes(e),notContains:(e,t)=>!t.includes(e),exactly:(e,t)=>t===e,notExactly:(e,t)=>t!==e,startsWith:(e,t)=>t.startsWith(e),endsWith:(e,t)=>t.endsWith(e),regex:(e,t)=>new RegExp(e).test(t),legacy:(e,t)=>new RegExp(e,"i").test(t)});function oa(e,t){const{matchType:n,pattern:r}=e,i=n?Us[n]:Us.legacy;let o=!1;try{o=i(r,t)}catch(a){const s=`[Sprig] (ERR-445) Failed to check url match with pattern ${r}`;a instanceof Error&&(console.warn(s,a),a.stack=JSON.stringify(e),window.UserLeap.reportError(s,a))}return o}function xg(e,t){const{pageUrlEvents:n,interactiveEvents:r,dismissOnPageChange:i}=window.UserLeap._config;if(!i)return!0;const o=[];n&&n.length&&o.push(...n),r&&r.length&&o.push(...r);const a=e&&o.find(s=>s.id===e);return a?oa(a,window.location.href):t===window.location.href}function Mn(e){const{pageUrlEvents:t,interactiveEvents:n,dismissOnPageChange:r,platform:i}=window.UserLeap._config;if(i&&i!==Pt.Web)return;const o=Ct("trackStartUrl"),a=o?String(o):null;t&&Ec(window.location.href),n&&(_c(),Sg()),r&&a&&a!==window.location.href&&e&&wg.includes(e.type)&&window.UserLeap("dismissActiveSurvey",Ke.PageChange)}const yc={capture:!0},Sg=()=>{const t=window.UserLeap._config.interactiveEvents.filter(r=>oa(r,window.location.href)).map(r=>{const{name:i,properties:o}=r,{selector:a,innerText:s}=o;return a?l=>{if(Jt(l.target))try{l.target.closest(a)&&window.UserLeap("track",i)}catch{}return!1}:l=>(Jt(l.target)&&l.target.innerText===s&&window.UserLeap("track",i),!1)}),n=r=>t.forEach(i=>i(r));window.UserLeap._config.interactiveEventsHandler=n,window.addEventListener("click",n,yc)},_c=()=>{window.UserLeap._config.interactiveEventsHandler&&window.removeEventListener("click",window.UserLeap._config.interactiveEventsHandler,yc),delete window.UserLeap._config.interactiveEventsHandler};function Cg(){["hashchange","popstate"].forEach(e=>window.addEventListener(e,Mn,!0))}function Ig(){["hashchange","popstate"].forEach(e=>window.removeEventListener(e,Mn,!0)),window.UserLeap._config.interactiveEvents&&_c()}function Qe(e,t,n){const r=[window.UserLeap._API_URL,"sdk",e];return t&&t.forEach(i=>{r.push(i),i===Ut?r.push(window.UserLeap.envId):i===St&&r.push(aa())}),n&&r.push(n),r.join("/")}function kg(e,t){let n=Qe("1",[Ut],"questions?");return e!=null&&(n+=`&vid=${e}`),t&&(t.surveyId&&(n+=`&surveyid=${t.surveyId}`),t.surveyTemplateId&&(n+=`&surveytemplateid=${t.surveyTemplateId}`),t.previewLanguage&&(n+=`&previewLanguage=${encodeURIComponent(t.previewLanguage)}`)),n}function wc(){try{if(typeof localStorage<"u"&&(localStorage.setItem("is_available","yes"),localStorage.getItem("is_available")==="yes"))return localStorage.removeItem("is_available"),!0}catch{return!1}return!1}function Ct(e){if(!window.UserLeap.localStorageAvailable)return null;const t=localStorage.getItem(be.Credentials);if(t)try{const r=JSON.parse(t)[window.UserLeap.envId];return r&&r[e]||null}catch(n){n instanceof Error&&(n.stack=t,window.UserLeap.reportError("Failed to parse local storage credentials",n)),console.warn("[Sprig] (ERR-427) Failed to lookup saved ids",n)}return null}function we(e,t){if(!window.UserLeap.localStorageAvailable)return;const n=localStorage.getItem(be.Credentials);let r={};if(n)try{r=JSON.parse(n)}catch(o){o instanceof Error&&(o.stack=n,window.UserLeap.reportError("Failed to parse local storage credentials",o)),console.warn("[Sprig] (ERR-427) Failed to lookup saved ids",o)}let i=r[window.UserLeap.envId];i?i[e]=t:i={[e]:t},r[window.UserLeap.envId]=i;try{localStorage.setItem(be.Credentials,JSON.stringify(r))}catch(o){o instanceof Error&&console.warn(`[Sprig] (ERR-426) Unable to write to Local Storage:: ${o.message}`)}}function bc(){window.previewMode||(window.UserLeap.visitorId=mt(),we("vid",window.UserLeap.visitorId),$.emit(B.VisitorIDUpdated,{visitorId:window.UserLeap.visitorId}))}function aa(){return window.previewMode?"0":window.UserLeap.visitorId||""}function Ec(e,t,n){if(!window.UserLeap.localStorageAvailable||e.endsWith("mock_snippet.html"))return;const r=window.UserLeap._config.pageUrlEvents;let i=!1;if(r&&r.length)for(let c=0;c<r.length&&(i=oa(r[c],e),!i);c++);if(!i)return;window.UserLeap.debugMode&&console.info("[DEBUG] Sprig trackPageView",e);const o=10,a=1;let s=[];const l={viewedAt:Date.now(),location:e},u=localStorage.getItem(be.PageViews);try{if(s=u?JSON.parse(u):[],Array.isArray(s)||(s=[]),s.length>0){const c=s[s.length-1],d=(Date.now()-c.viewedAt)/1e3;c.location!=e&&d>a&&Wa({url:e}),(c.location!=e&&d>a||d>o)&&(window.UserLeap._queue.push(["track",fo,t,{url:e},n]),s.push(l))}else window.UserLeap._queue.push(["track",fo,t,{url:e},n]),s.push(l),Wa({url:e});s.length>5&&s.splice(0,s.length-5);try{localStorage.setItem(be.PageViews,JSON.stringify(s))}catch(c){c instanceof Error&&console.warn(`[Sprig] Unable to write to Local Storage: ${c.message}`)}}catch(c){c instanceof Error&&window.UserLeap.reportError("trackPageView",c,{pageViewsStorage:u}),console.warn("[Sprig] (ERR-425) Failed to update page views in local storage")}}function Tg(){const e="Backbone"in window&&window.Backbone&&window.Backbone.history?window.Backbone.history:window.history;"pushState"in e&&(e.pushState=(t=>function(...r){const i=t.apply(this,r),o=new Event("pushState");return window.dispatchEvent(o),Mn(o),i})(e.pushState)),"replaceState"in e&&(e.replaceState=(t=>function(...r){const i=t.apply(this,r),o=new Event("replaceState");return window.dispatchEvent(o),Mn(o),i})(e.replaceState)),Cg()}async function Ei(e,t){const n=aa();e&&!t&&(window.UserLeap._config.mode=bg.test);const r=await ft(kg(n,{...e,previewLanguage:window.UserLeap._config.previewLanguage}),{},0,!0);return r.ok?(r.json.delay&&await Sr(r.json.delay),xc(r.json)):(r.reportError&&r.error&&(console.warn("[Sprig] (ERR-414) Failed to request questions from the server",r.error),window.UserLeap.reportError("getQuestions",r.error)),{success:!1,surveyState:Ie.NoSurvey})}const Lg=e=>e.some(t=>t.type===T.VideoVoice),xc=async e=>{var k,P,R,O,Y,ae;const{context:t,forceBrandedLogo:n,endCard:r,locale:i,productConfig:o,questions:a,responseGroupUid:s,surveyId:l,uuid:u,vid:c,sessionReplay:d}=e,f=en(window.UserLeap),p=sa(f),h=Rg(f);if(d&&ql({responseGroupId:s,surveyId:l,visitorId:c,replayParams:d,completeUploadHeaders:f,apiUrl:window.UserLeap._API_URL,triggerTimestamp:Date.now(),isStandalone:a.length===0}),c==null||!a||!a.length)return{success:!1,message:"[Sprig] no survey found",surveyState:Ie.NoSurvey};if(((P=(k=window.UserLeap)==null?void 0:k._config)==null?void 0:P.installationMethod)===rt.NpmBundled&&Lg(a))return{success:!1,message:"[Sprig] bundled version does not support video voice",surveyState:Ie.NoSurvey};if(window.UserLeap.container){const G="[Sprig] (ERR-409) Found an existing Survey container, aborting rendering of this survey";return console.warn(G),{success:!1,message:G,surveyState:Ie.NoSurvey}}if(c!==window.UserLeap.visitorId&&u!==window.UserLeap.visitorId&&!window.previewMode){const G="Attempted to display survey to a different visitor";return window.UserLeap.reportError("DisplaySurvey",new Error(G)),{success:!1,message:G,surveyState:Ie.NoSurvey}}ov({id:l}),Ii.disable(),$.emit(B.SurveyWillPresent,{name:B.SurveyWillPresent,[Os.SurveyId]:l});let v,g=document.createElement("div"),w,_,b;const E=G=>{const{[Lt.ViewVersion]:ue}=G;ue!==f["x-ul-sdk-version"]&&hc(),$.removeListener(Re.VerifyViewVersion,E)};$.on(Re.VerifyViewVersion,E),Wt(f)?(v="ul-direct-embeded-frame",w=document.head,_=window,b=!1,p&&(pc(),g.id=v,window.UserLeap.container.appendChild(g),vc(),$.emit(B.SurveyLifeCycle,{state:"presented"}),$.emit(B.SurveyPresented,{name:B.SurveyPresented}))):{frameId:v,contentWinDocHead:w,contentWindow:_,hasOverlay:b,iframe:g}=fg(o,h),window.UserLeap.frameId=v,window.UserLeap.useMobileStyling=h;const m=G=>{$.on(B.CloseSurveyOnOverlayClick,G)},x=Object.assign({frame:g,envId:window.UserLeap.envId,surveyId:l,userId:u,visitorAttributes:{externalUserId:window.UserLeap.userId,email:window.UserLeap.email},cards:a,context:t,locale:i,fontFamily:window.UserLeap.fontFamily,fontFamilyURL:window.UserLeap.fontFamilyURL,apiURL:window.UserLeap._API_URL,responseGroupUid:s,headers:f,endCard:r,useMobileStyling:h,mobileSDKVersion:window.UserLeap.mobileSDKVersion,configureExitOnOverlayClick:m,eventEmitFn:$.emit.bind($),ulEvents:ho,viewDocument:_==null?void 0:_.document,viewWindow:_,tabTitle:document.title,startingQuestionIdx:(R=window.UserLeap.config)==null?void 0:R.startingQuestionIdx,styleNonce:window.UserLeap.styleNonce,previewKey:(O=window.UserLeap)!=null&&O.localStorageAvailable?(Y=window.localStorage)==null?void 0:Y.getItem(be.Preview):null,forceBrandedLogo:n},window.UserLeap._config);(ae=window.UserLeap.config)!=null&&ae.startingQuestionIdx&&(window.UserLeap.config={...window.UserLeap.config,startingQuestionIdx:null}),window.UserLeap.customStyles&&(x.customStyles=window.UserLeap.customStyles),_&&(_.__cfg=x);function I(){const G=document.createElement("script");return window.UserLeap.nonce&&G.setAttribute("nonce",window.UserLeap.nonce),G.id=As,G}const C=window.UserLeap.viewSDKURL?window.UserLeap.viewSDKURL:x.path,S=document.getElementById(As);S&&S.remove();const L=I(),D=()=>{window.UserLeap.container&&Object.assign(window.UserLeap.container.style,{display:"flex"})};return x.installationMethod===rt.Npm||x.installationMethod===rt.NpmBundled?(ag.configure(x),b&&window.UserLeap.container&&D()):C&&(L.src=C,b&&L.addEventListener("load",()=>{window.UserLeap.container&&D()}),_==null||_.addEventListener("error",G=>{G.target instanceof HTMLScriptElement&&G.target.src===C&&window.UserLeap.reportError("loadFrameScript",new Error("Frame script failed to load"))},{capture:!0,once:!0})),w==null||w.appendChild(L),{success:!0,surveyState:Ie.Ready,surveyId:l,responseGroupUid:s}};function Rg(e){if(window.UserLeap.useMobileStyling!==void 0)return window.UserLeap.useMobileStyling;const t=window.UserLeap.windowDimensions&&window.UserLeap.windowDimensions.width||document.body.clientWidth;return sa(e)||t>10&&t<Af}function sa(e){return Eg.includes(e[He.Platform])}function Ag(e){let t=e.length;for(;t;){const n=Math.floor(Math.random()*t);t-=1;const r=e[t];e[t]=e[n],e[n]=r}}function Ug(e){if(!e)return;window.UserLeap._config=e,e.mute&&window.UserLeap._queue.pause();const{interactiveEvents:t,pageUrlEvents:n,dismissOnPageChange:r}=e;t&&Ag(t),(t||n||r)&&(Tg(),Mn())}async function ft(e,t,n=0,r=!1){var o,a;t.headers=Object.assign(en(window.UserLeap),t.headers);const i=await it(e,t,n,r);if(i.ok){const s=(o=i.headers)==null?void 0:o.get("Authorization"),l=s?s.split(" "):void 0,u=l&&l.length===2?l[1]:void 0,c=(a=i.headers)==null?void 0:a.get(He.VisitorID);u&&c&&(c!==window.UserLeap.visitorId||window.UserLeap.token!==u)&&(we("token",u),we("vid",c),$.emit(B.VisitorIDUpdated,{visitorId:c}),window.UserLeap.token=u,window.UserLeap.visitorId=c)}return i.json&&i.json.logMessage&&console.warn(`[Sprig] ${i.json.logMessage}`),i}async function Og(e,t){var r,i;let n=!0;return t&&((r=e==null?void 0:e.json)==null?void 0:r.surveyId)&&(window.UserLeap.delayingSurvey=!0,n=await t(e.json.surveyId),window.UserLeap.delayingSurvey=!1,!n)?!1:((i=e==null?void 0:e.json)!=null&&i.delay&&(window.UserLeap.delayingSurvey=!0,await Sr(e.json.delay),window.UserLeap.delayingSurvey=!1),n)}const Dg=function(e){if(!window.UserLeap)return;const t=async(r={})=>{var v,g,w,_,b;const{userId:i,anonymousId:o,metadata:a={},properties:s,showSurveyCallback:l}=r;let{eventName:u}=r;if(window.UserLeap.debugMode&&u!==fo&&console.info("[DEBUG] Sprig track",r),e.mode==="test")return;const c=window.UserLeap.localStorageAvailable&&(v=localStorage.getItem(be.Preview))!=null?v:void 0;if(e.requireUserIdForTracking&&!window.UserLeap.userId&&!i){const E="[Sprig] - Skipping tracking without userId";return console.warn(E),{success:!1,message:E,surveyState:Ie.NoSurvey}}if(!u||u.trim().length===0){u=u?String(u):"";const E="[Sprig] - Invalid event name "+u;return console.warn(E),{success:!1,message:E,surveyState:Ie.NoSurvey}}const d=window.location.href;if(a.url||(a.url=d),we("trackStartUrl",d),(w=(g=window.UserLeap)==null?void 0:g._config)!=null&&w.optimizelyEnabled){const E=en(window.UserLeap);sa(E)||_r.getAndSetWebOptimizelyExperiments(),a.optimizelyExperiments=Object.assign({},_r.getAllOptimizelyExperiments())}(b=(_=window.UserLeap)==null?void 0:_._config)!=null&&b.launchDarklyEnabled&&(a.launchDarklyFlags=co.getAllLaunchDarklyVariations()),i&&(window.UserLeap.userId=i),o&&(window.UserLeap.partnerAnonymousId=o),s&&(a.eventProperties=s),iv({name:u});const f=window.UserLeap.delayingSurvey?await ft(Qe("1",[St],"events/batch"),{body:JSON.stringify({events:[{event:u,metadata:a}],previewKey:c}),method:"POST"},0,!0):await ft(Qe("1",[St],"events"),{body:JSON.stringify({event:u,metadata:a,previewKey:c}),method:"POST"},0,!0);if(!f.ok){const E="[Sprig] (ERR-421) Failed to track event";return f.reportError&&(console.warn(E,f.error),f.error&&window.UserLeap.reportError("track",f.error)),{success:!1,message:E,error:f.error,surveyState:Ie.NoSurvey}}i&&we("uid",i),o&&we("aid",o);const p=f.json;return p.invalidPreviewKey&&window.UserLeap.localStorageAvailable&&localStorage.removeItem(be.Preview),await Og(f,l)?xg(p.eventId,d)?xc(p):{success:!1,message:"Study should not be displayed after page navigation",surveyState:Ie.NoSurvey}:{success:!1,message:"[Sprig] Callback returned false, aborting rendering of survey",surveyState:Ie.NoSurvey}},n={async displaySurvey(r){return console.warn("[Sprig] displaySurvey should only be used to debug your studies; not intended for production usage."),window.UserLeap("dismissActiveSurvey",Ke.Override),Ei({surveyId:r},!0)},_previewSurvey(r){window.UserLeap("dismissActiveSurvey",Ke.Override),Ei({surveyTemplateId:r},!1)},_reviewSurvey(r){window.UserLeap("dismissActiveSurvey",Ke.Override),Ei({surveyId:r},!1)},previewSurvey(r){n._previewSurvey(r)},reviewSurvey(r){n._reviewSurvey(r)},mute(){window.UserLeap._queue.pause()},unmute(){window.UserLeap._queue.unpause()},setVisitorToken(){console.warn("[Sprig] setVisitorToken is deprecated.")},dismissActiveSurvey(r=Ke.API){$.emit(B.SurveyWillClose,{name:B.SurveyWillClose,initiator:r})},async setAttribute(r,i){if(!r||!i&&i!==0){const o="[Sprig] - Disregarding empty attribute / value provided";return console.warn(o),{success:!1,message:o}}return this.setAttributes({[r]:i})},async setAttributes(r){if(r==null||Object.keys(r).length===0){const i="[Sprig] - Disregarding empty attributes provided";return console.warn(i),{success:!1,message:i}}return this.identifyAndSetAttributes({attributes:r})},async identifyAndSetAttributes(r){if(window.UserLeap.debugMode&&console.info("[DEBUG] Sprig identifyAndSetAttributes",r),e.mode==="test")return;if(r===null||typeof r!="object"||!(r.userId||r.anonymousId||r.attributes)){const u="[Sprig] - Disregarding empty payload provided";return console.warn(u),{success:!1,message:u}}const{userId:i,anonymousId:o,attributes:a}=r;if(e.requireUserIdForTracking&&!window.UserLeap.userId&&!i){const u="[Sprig] - Skipping tracking without userId";return console.warn(u),{success:!1,message:u}}if(!a&&(!i||window.UserLeap.userId===i)&&(!o||window.UserLeap.partnerAnonymousId===o))return{success:!0};const s={};i&&(s.userId=window.UserLeap.userId=i),o&&(s.partnerAnonymousId=window.UserLeap.partnerAnonymousId=o);let l;return a?(a.email&&!Object.prototype.hasOwnProperty.call(a,gn)&&(a[gn]=a.email,delete a.email),l=await ft(Qe("1",[Ut,St],"attributes"),{body:JSON.stringify(a),method:"PUT"}),!l.ok&&l.reportError&&(console.warn("[Sprig] (ERR-432) identifyAndSetAttributes failed",l.error),l.error&&window.UserLeap.reportError("identifyAndSetAttributes",l.error))):l=await ft(Qe("1",[Ut,St]),{body:JSON.stringify(s),method:"PUT"}),a&&a[gn]&&(window.UserLeap.email=a[gn]),l.ok&&(i&&we("uid",i),o&&we("aid",o)),{success:!!l.ok}},async removeAttributes(r){if(window.UserLeap.debugMode&&console.info("[DEBUG] Sprig removeAttributes",r),e.mode==="test")return;if(r==null||r.length===0){const o="[Sprig] - Disregarding empty attributes provided";return console.warn(o),{success:!1,message:o}}if(e.requireUserIdForTracking&&!window.UserLeap.userId){const o="[Sprig] - Skipping tracking without userId";return console.warn(o),{success:!1,message:o}}const i=await ft(Qe("1",[Ut,St],"attributes"),{body:JSON.stringify({delete:r}),method:"DELETE"});return!i.ok&&i.reportError&&(console.warn("[Sprig] (ERR-433) Remove attributes failed",i.error),i.error&&window.UserLeap.reportError("removeAttributes",i.error)),{success:!!i.ok}},async addSurveyListener(r){$.on(B.SurveyLifeCycle,r)},async removeSurveyListener(r){$.removeListener(B.SurveyLifeCycle,r)},async addListener(r,i){$.on(r,i)},async removeListener(r,i){$.removeListener(r,i)},async removeAllListeners(){$.removeAllListeners()},setPreviewKey(r){if(!r||typeof r!="string")return;const i=wc();window.UserLeap.localStorageAvailable=i,i&&r&&localStorage.setItem(be.Preview,r)},async setUserId(r){if(window.UserLeap.debugMode&&console.info("[DEBUG] Sprig setUserId",r),r==null){const a=`[Sprig] - Invalid userId ${r}`;return console.warn(a),{success:!1,message:a}}if(e.mode==="test"||r===window.UserLeap.userId)return;window.UserLeap.userId=r;const i=window.UserLeap.visitorId,o=await ft(Qe("1",[Ut,St]),{body:JSON.stringify({userId:r}),method:"PUT"});if(!o.ok){o.reportError&&(console.warn("[Sprig] (ERR-420) Failed to set user id",o.error),o.error&&window.UserLeap.reportError("setUserId",o.error));return}i!==window.UserLeap.visitorId&&za(),we("uid",r)},async setPartnerAnonymousId(r){if(window.UserLeap.debugMode&&console.info("[DEBUG] Sprig setPartnerAnonymousId",r),r==null){const i=`[Sprig] - Invalid partnerAnonymousId ${r}`;return console.warn(i),{success:!1,message:i}}return window.UserLeap.partnerAnonymousId=r,we("aid",r),{success:!0}},async track(r,i,o={},a=void 0){return t({eventName:r,properties:i,metadata:o,showSurveyCallback:a})},async identifyAndTrack(r){return await t(r)},trackPageView(r,i=void 0,o=void 0){Ec(r,i,o)},applyStyles(r){if(window.UserLeap.customStyles=r,window.UserLeap.container){const i=window.UserLeap.container.children[0].contentDocument;if(i){const o=i.getElementById(U.CustomStyle);o?o.textContent=r:Xs(i,r,window.UserLeap.styleNonce)}}},setWindowDimensions(r,i){var l,u;const o=typeof r=="string"?parseInt(r,10):r,a=typeof i=="string"?parseInt(i,10):i;if(!isNaN(o)&&!isNaN(a)&&(window.UserLeap.windowDimensions={width:o,height:a}),!window.UserLeap.frameId)return;const s=document.getElementById(window.UserLeap.frameId);!s||(window.UserLeap.useMobileStyling&&((l=window.UserLeap.windowDimensions)!=null&&l.width&&(s.style.width=`${window.UserLeap.windowDimensions.width}px`),(u=window.UserLeap.windowDimensions)!=null&&u.height&&(s.style.maxHeight=`${window.UserLeap.windowDimensions.height-20}px`),s.contentDocument&&(s.style.height=String(Js(s.contentDocument))+"px")),$.emit(B.SurveyDimensions,{name:B.SurveyDimensions,contentFrameWidth:s.clientWidth,contentFrameHeight:s.clientHeight}))},logoutUser(){window.UserLeap.debugMode&&console.info("[DEBUG] Sprig logout"),window.UserLeap.visitorId=null,window.UserLeap.userId=null,window.UserLeap.partnerAnonymousId=null,window.UserLeap.token=null,window.UserLeap.email=null,window.UserLeap.localStorageAvailable&&(localStorage.removeItem(be.Credentials),localStorage.removeItem(be.PageViews)),window.UserLeap._queue.isPaused()&&window.UserLeap._queue.empty(),bc(),za(),window.UserLeap._queue.unpause()},teardown(){Ig(),window.UserLeap("dismissActiveSurvey",Ke.API),delete window.UserLeap,delete window.Sprig,delete window._Sprig},integrateOptimizely(r,i=!0){var o,a;if(!((a=(o=window.UserLeap)==null?void 0:o._config)!=null&&a.optimizelyEnabled)){console.warn("[SPRIG] Optimizely integration is currently not enabled for your product.");return}try{const s=typeof r=="string"?JSON.parse(r):r;_r.setOptimizelyExperiment(s,i)}catch(s){console.warn("[Sprig] Error with integrating Optimizely data"),s instanceof Error&&window.UserLeap.reportError("integrateOptimizely",s)}},integrateOptimizelyClient(r){var o,a;if(!((a=(o=window.UserLeap)==null?void 0:o._config)!=null&&a.optimizelyEnabled)){console.warn("[SPRIG] Optimizely integration is currently not enabled for your product.");return}const i=({experiment:s,variation:l})=>{const u={experiments:[{id:s.id,variation:l.key}]};window.UserLeap("integrateOptimizely",u,!1)};r.notificationCenter.addNotificationListener(Cf.NOTIFICATION_TYPES.ACTIVATE,i)},importLaunchDarklyData(r){var i,o;if(!((o=(i=window.UserLeap)==null?void 0:i._config)!=null&&o.launchDarklyEnabled)){console.warn("[SPRIG] LaunchDarkly integration is currently not enabled for your product.");return}co.setLDFlagsVariations(r)},setVisitorAttribute(r,i){return console.warn("[Sprig] setVisitorAttribute is deprecated. Please use setAttribute"),n.setAttribute(r,i)},async setEmail(r){return n.setAttribute(gn,r)},async setVisitorEmail(r){return console.warn("[Sprig] setVisitorEmail is deprecated. Please use setEmail"),n.setEmail(r)},async _generateVideoUploadUrl(r){return Vg(r)},async _completeSessionReplay({surveyId:r,responseGroupUuid:i,eventDigest:o}){if(!r||!i)return;const a=window.UserLeap._API_URL;try{await sl({surveyId:r,responseGroupUuid:i,eventDigest:o,apiUrl:a,headers:en(window.UserLeap)},!0)}catch(s){console.warn("[Sprig] Error with completing session replay"),s instanceof Error&&window.UserLeap.reportError("completeSessionReplay",s)}}};Object.assign(window.UserLeap,n)};async function Pg(e){const t=en(window.UserLeap);document.addEventListener("securitypolicyviolation",ki);const n=await it(Qe("1",[Ut],"config"),{headers:t}),r="TypeError";if(window.UserLeap.error=n.error,!n.ok&&n.error&&n.error.name===r?(window.UserLeap._API_URL="https://api.sprig.com",window.UserLeap.reportError("sprigDomainRequest",n.error)):document.removeEventListener("securitypolicyviolation",ki),!n.ok)return n.reportError&&(console.warn("[Sprig] (ERR-422) Failed to load configuration",n.error),n.error&&window.UserLeap.reportError("applyRemoteConfig",n.error)),Ti("Disabled: failed to fetch configuration"),e;const i=n.json;return i!=null&&i.disabled?(Ti(`Disabled: ${i.disabled}`),{disabled:i.disabled}):Object.assign({},i,e)}async function Ng(e,t,n={}){const r=window.__cfg&&window.__cfg.mode,i=aa(),o=window.UserLeap.envId,a=window.document.documentElement,s={mode:r,screenWidth:window.screen.width,screenHeight:window.screen.height,clientWidth:a.clientWidth,clientHeight:a.clientHeight,location:window.location.href,language:window.navigator.language,...n},l={action:e,err:{message:t.message,stack:t.stack},meta:s,vid:i,envId:o};(await ft(Qe("1",null,"errors"),{method:"POST",headers:{[He.Error]:window.btoa(`userleap-${Date.now()}-error`)},body:JSON.stringify(l)},0,!0)).ok||console.warn("[Sprig] (ERR-444) Failed to report error to API",t)}async function Vg(e){var n;if(!e)return;const t=`${window.UserLeap._API_URL}/2/environments/integrations/upload`;try{const r=await fetch(t,{method:"POST",cache:"no-cache",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(r.ok){const i=await r.json();return(n=i==null?void 0:i.upload)==null?void 0:n.url}else return null}catch(r){console.warn("[Sprig] Error with generating video upload url"),r instanceof Error&&window.UserLeap.reportError("generateVideoUploadUrl",r)}}function Mg(e={}){var i;const t=(i=new URLSearchParams(window.location.search).get(gc.Preview))!=null?i:"",n=wc();window.UserLeap.localStorageAvailable=n,window.UserLeap.UPDATES=ho,window.UserLeap("setPreviewKey",t);async function r(){if(window.UserLeap.loaded)return;if(window.UserLeap.reportError=Ng,window.UserLeap.loaded=!0,window.UserLeap._config=Object.assign({},e,window.UserLeap.config),window.UserLeap.delayingSurvey=!1,window.UserLeap._config&&typeof window.UserLeap._config=="object")for(const u in window.UserLeap._config)window.UserLeap[u]=window.UserLeap._config[u];if(!window.UserLeap.envId)if(window.UserLeap.appId)window.UserLeap.envId=window.UserLeap.appId;else throw new Error("Missing Environment id");window.UserLeap.debugMode&&console.info("[DEBUG] Sprig debug mode enabled");const o=window.UserLeap.sampleRate;if(o)if(!n)window.UserLeap.debugMode&&console.info("[DEBUG] Sprig cannot sample users without localStorage permissions");else{let u=Ct("sampled");if(u===null&&(u=Math.random()<o,we("sampled",u)),!u)return}else n&&Ct("sampled")!==null&&we("sampled",null);window.UserLeap._API_URL||(window.UserLeap._API_URL="https://api.sprig.com");const a=[...window.UserLeap._queue];window.UserLeap._queue=new _g(window.UserLeap,[]),window.UserLeap._queue.pause();for(let u=0;u<a.length;u++)window.UserLeap._queue.push(a[u]);const s=Ct("token");s?(window.UserLeap.token=s,window.UserLeap.visitorId=Ct("vid"),window.UserLeap.userId=Ct("uid"),window.UserLeap.partnerAnonymousId=Ct("aid")):(window.UserLeap.localStorageAvailable&&localStorage.removeItem(be.Credentials),bc());const l=await Pg(e);qh(window.document,l.maxReplayDurationSeconds,window.UserLeap.replayNonce,window.UserLeap.maxInflightReplayRequests,l.replaySettings),Dg(l),await Ug(l),window.UserLeap._queue.unpause(),$.emit(B.SDKReady),$.emit(B.VisitorIDUpdated,{visitorId:window.UserLeap.visitorId})}document.readyState==="complete"?r():window.attachEvent?window.attachEvent("onload",r):window.addEventListener("load",r,!1)}class Br{constructor(){fe(this,"UPDATES",ho)}displaySurvey(t){window.Sprig("displaySurvey",t)}mute(){window.Sprig("mute")}unmute(){window.Sprig("unmute")}dismissActiveSurvey(){window.Sprig("dismissActiveSurvey")}setAttribute(t,n){window.Sprig("setAttribute",t,n)}setAttributes(t){window.Sprig("setAttributes",t)}identifyAndSetAttributes(t){window.Sprig("identifyAndSetAttributes",t)}removeAttributes(t){window.Sprig("removeAttributes",t)}addListener(t,n){window.Sprig("addListener",t,n)}removeListener(t,n){window.Sprig("removeListener",t,n)}removeAllListeners(){window.Sprig("removeAllListeners")}setEmail(t){window.Sprig("setAttribute","!email",t)}setUserId(t){window.Sprig("setUserId",t)}setPartnerAnonymousId(t){window.Sprig("setPartnerAnonymousId",t)}track(t,n={},r={}){window.Sprig("track",t,n,r)}identifyAndTrack(t){window.Sprig("identifyAndTrack",t)}trackPageView(t,n,r){window.Sprig("trackPageView",t,n,r)}applyStyles(t){window.Sprig("applyStyles",t)}setWindowDimensions(t,n){window.Sprig("setWindowDimensions",t,n)}logoutUser(){window.Sprig("logoutUser")}teardown(){window.Sprig("teardown")}}const po={configure:e=>{if(!e.envId&&!e.environmentId)throw new Error("Initialization Error: Sprig configure requires an environmentId");if(e.envId||(e.envId=e.environmentId||""),e.installationMethod="web-npm",window.Sprig)return window.Sprig;window.Sprig=function(){window.Sprig._queue.push(arguments)},Object.getOwnPropertyNames(Br.prototype).map(n=>{n!=="constructor"&&(window.Sprig[n]=Br.prototype[n])});const t=window.Sprig;return t.appId=e.envId,t._queue=[],window.UserLeap=t,Mg(e),window.Sprig}},jg={sprig:po,SprigAPI:Br,configure:po.configure};exports.DismissReason=Ke;exports.SprigAPI=Br;exports.SprigEvent=B;exports.default=jg;exports.sprig=po;
package/dist/index.js CHANGED
@@ -1690,7 +1690,7 @@ function en(e = {}) {
1690
1690
  const t = {
1691
1691
  "Content-Type": "application/json",
1692
1692
  "userleap-platform": Pt.Web,
1693
- "x-ul-sdk-version": "2.24.10",
1693
+ "x-ul-sdk-version": "2.24.11",
1694
1694
  [He.InstallationMethod]: Kf(e)
1695
1695
  };
1696
1696
  if (e.envId && (t[He.EnvironmentID] = e.envId), e.token && (t.Authorization = "Bearer " + e.token), e.userId && (t[He.UserID] = e.userId), e.visitorId && (t[He.VisitorID] = e.visitorId), e.partnerAnonymousId && (t[He.PartnerAnonymousId] = e.partnerAnonymousId), e.mobileHeadersJSON) {
@@ -11061,7 +11061,7 @@ function og(e, t = !0) {
11061
11061
  }, w.appendChild(x);
11062
11062
  } else
11063
11063
  console.warn("[Sprig] - recording functionality not configured due to missing UpChunk dependency");
11064
- const b = "2.24.10", E = a || ((m = l.eventEmitter) == null ? void 0 : m.emit);
11064
+ const b = "2.24.11", E = a || ((m = l.eventEmitter) == null ? void 0 : m.emit);
11065
11065
  E == null || E(Re.VerifyViewVersion, {
11066
11066
  [Lt.ViewVersion]: b
11067
11067
  }), f && t && on(y(tg, {}), f);
package/package.json CHANGED
@@ -36,5 +36,5 @@
36
36
  },
37
37
  "homepage": "https://docs.sprig.com/docs/web-javascript",
38
38
  "license": "See LICENSE file",
39
- "version": "2.24.10"
39
+ "version": "2.24.11"
40
40
  }