@molin.ai/shop-ai 0.7.18 → 0.7.19

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.
@@ -180,7 +180,7 @@ var Kp=Object.defineProperty;var Nl=i=>{throw TypeError(i)};var Zp=(i,e,t)=>e in
180
180
  </div>
181
181
  </div>
182
182
  </div>
183
- `;default:throw new Error(`Unknown side: ${this.side}`)}}};T(Tn,"properties",{side:{type:String},status:{type:String},color:{type:String},logoUrl:{type:String,attribute:"logo"},position:{type:String}});customElements.get("mw-chat-message")||customElements.define("mw-chat-message",Tn);var gr,je,ct,vr,$o,Pn=class{constructor(e,t){y(this,vr);y(this,gr);y(this,je);y(this,ct);if(!e)throw new Error("host is required");if(!t)throw new Error("config is required");E(this,gr,e),f(this,gr).addController(this),E(this,je,t)}connect(e){E(this,je,e),E(this,ct,$(this,vr,$o).call(this))}hostConnected(){setTimeout(()=>{E(this,ct,$(this,vr,$o).call(this))},0)}hostDisconnected(){f(this,ct)?.close(1e3,"lit_host_disconnected"),E(this,ct,void 0)}send(e){f(this,ct)?.send(e)}close(e,t){f(this,ct)?.close(e,t)}get isConnected(){return f(this,ct)?.readyState===WebSocket.OPEN}};gr=new WeakMap,je=new WeakMap,ct=new WeakMap,vr=new WeakSet,$o=function(){let e=new WebSocket(f(this,je).url());return f(this,je).onClose&&(e.onclose=f(this,je).onClose),f(this,je).onOpen&&(e.onopen=f(this,je).onOpen),f(this,je).onError&&(e.onerror=f(this,je).onError),f(this,je).onMessage&&(e.onmessage=f(this,je).onMessage),e};var tc="664df22d-d461-42d6-801e-f70247e2cd7c",be,we,nt,Ii,Ai,Se,ei,ic,rc,nc,sc,Rn=class{constructor(e,t){y(this,Se);y(this,be);y(this,we);y(this,nt);T(this,"isStreaming",!1);T(this,"typingIndicator");T(this,"ranOutOfCredits",!1);T(this,"messages",[]);T(this,"conversationId","");y(this,Ii,0);y(this,Ai);T(this,"isLiveMode",!1);E(this,be,e),E(this,we,t),E(this,nt,this.initWS()),e.addController(this)}sendUserInput(e,{xUserData:t,xPromptExt:r,role:n="user",expectStreaming:s=!1}={}){return $(this,Se,ei).call(this,{type:"USER_INPUT",value:e,role:n,xUserData:t,xPromptExt:r},{expectStreaming:s})}sendUserCancel(){return $(this,Se,ei).call(this,{type:"USER_CANCEL"})}sendUserTypingStart(){return $(this,Se,ei).call(this,{type:"USER_TYPING_START"})}sendUserTypingStop(){return $(this,Se,ei).call(this,{type:"USER_TYPING_STOP"})}reloadConfig(){$(this,Se,ei).call(this,{type:"RELOAD_CONFIG"})}close(){f(this,nt).close(1e3,"closed by user")}retry(){clearTimeout(f(this,Ai)),E(this,Ai,setTimeout(()=>{f(this,we).onReconnect?.(),E(this,nt,this.initWS())},1e3*f(this,Ii))),Ul(this,Ii)._++}initWS(){return new Pn(f(this,be),{url:()=>f(this,we).url(this.conversationId,{}),onOpen:e=>$(this,Se,ic).call(this,e),onMessage:e=>$(this,Se,rc).call(this,JSON.parse(e.data)),onError:e=>$(this,Se,nc).call(this,e),onClose:e=>$(this,Se,sc).call(this,e)})}hostConnected(){this.conversationId=f(this,we).restoreConversationState?.()?.conversationId||"",this.messages=f(this,we).restoreConversationState?.()?.messages||[]}reset(){$(this,Se,ei).call(this,{type:"NEW_CHAT"}),f(this,we).onReset?.(),this.isStreaming=!1,this.typingIndicator=void 0,this.ranOutOfCredits=!1,this.messages=[],this.conversationId="",this.isLiveMode=!1,f(this,be).requestUpdate()}hostDisconnected(){clearTimeout(f(this,Ai))}reconnectSocket(){f(this,nt).close(1e3,"destroy"),E(this,nt,this.initWS())}get lastMsg(){if(this.messages.length>0)return this.messages[this.messages.length-1]}};be=new WeakMap,we=new WeakMap,nt=new WeakMap,Ii=new WeakMap,Ai=new WeakMap,Se=new WeakSet,ei=function(e,{expectStreaming:t=!1}={}){return f(this,nt).isConnected?(t&&!this.isLiveMode&&(this.isStreaming=!0,f(this,be).requestUpdate()),f(this,nt).send(JSON.stringify(e)),!0):(console.warn("WebSocket is not connected, message not sent - reconnecting now",e),this.retry(),!1)},ic=function(e){E(this,Ii,0)},rc=function(e){switch(e.type){case"NEW_MESSAGE":{this.messages=[...this.messages,e.message].filter((t,r,n)=>r===n.findIndex(s=>s.id===t.id)),this.typingIndicator=void 0,f(this,be).requestUpdate(),f(this,we).onNewMessage?.(e.message);break}case"UPDATE_MESSAGE":{let t=this.messages.find(r=>r.id===e.message.id);if(t)Object.assign(t,e.message),f(this,be).requestUpdate(),f(this,we).onUpdateMessage?.(e);else throw new Error(`Message with id ${e.message.id} not found`);break}case"MESSAGE_DONE":{let t=this.messages.find(r=>r.id===e.message.id);if(t)Object.assign(t,e.message);else throw new Error(`Message with id ${e.message.id} not found`);this.isStreaming=!1,f(this,be).requestUpdate(),f(this,we).onMessageDone?.(e,t),f(this,we).persistConversationState?.(this.conversationId,this.messages);break}case"MESSAGE_CANCEL":{this.isStreaming=!1,this.typingIndicator=void 0,f(this,be).requestUpdate();break}case"ERROR":{f(this,we).onMessageError?.(e);break}case"CONNECTED":{this.conversationId=e.conversationId,this.messages=e.messages,f(this,we).onConnect?.(e.conversationId),f(this,we).persistConversationState?.(this.conversationId,this.messages),this.isLiveMode=e.metadata?.isLiveMode,f(this,be).requestUpdate();break}case"TYPING_START":{e.role==="assistant"&&(this.isStreaming=!0),this.typingIndicator={role:e.role,metadata:e.metadata},f(this,be).requestUpdate();break}case"TYPING_STOP":{this.typingIndicator=void 0,f(this,be).requestUpdate();break}case"RAN_OUT_OF_CREDITS":{this.messages.some(t=>t.id===tc)||this.messages.push({id:tc,role:"assistant",content:"Sorry, I've run out of credits. Please contact the shop directly.",timestamp:Date.now()}),this.ranOutOfCredits=!0,f(this,be).requestUpdate();break}case"RECONNECT":{this.reconnectSocket(),f(this,be).requestUpdate();break}default:console.warn(`Unknown message type: ${JSON.stringify(e)}`)}},nc=function(e){console.error("onError",e),f(this,we).onError?.(e)},sc=function(e){f(this,be).isConnected&&!f(this,nt).isConnected&&e.reason==="reconnect"&&this.retry(),this.isStreaming=!1,this.typingIndicator=void 0,f(this,be).requestUpdate(),f(this,we).onClose?.()};var mr,Ti,Rt,ti,Fn,oc,On=class{constructor(e,t,{timeoutMs:r=2e3}={}){y(this,Fn);y(this,mr);y(this,Ti);y(this,Rt);y(this,ti,!1);T(this,"timeoutMs");E(this,mr,e),E(this,Ti,t),this.timeoutMs=r,e.addController(this)}get isTyping(){return f(this,ti)}hostDisconnected(){clearTimeout(f(this,Rt)),E(this,Rt,void 0)}onInput(e){if(f(this,mr).isConnected){if(!e.trim()){this.typingStopped();return}clearTimeout(f(this,Rt)),E(this,Rt,setTimeout(()=>this.typingStopped(),this.timeoutMs)),f(this,ti)||$(this,Fn,oc).call(this)}}typingStopped(){clearTimeout(f(this,Rt)),E(this,ti,!1),f(this,Ti).typingStopped()}};mr=new WeakMap,Ti=new WeakMap,Rt=new WeakMap,ti=new WeakMap,Fn=new WeakSet,oc=function(){E(this,ti,!0),f(this,Ti).typingStarted()};function ac(i,e){let t=new Map;for(let r of i){let n=e(r);t.has(n)||t.set(n,[]),(t.get(n)||[]).push(r)}return t}function lc(i,e="en-US"){let t=new Intl.DateTimeFormat(e,{hour:"numeric",minute:"numeric"}).format(i);return`${i.toLocaleDateString(e,{year:"numeric",month:"short",day:"numeric"})}, ${t}`}var Io;function Ao(i){return{lang:i?.lang??Io?.lang,message:i?.message,abortEarly:i?.abortEarly??Io?.abortEarly,abortPipeEarly:i?.abortPipeEarly??Io?.abortPipeEarly}}var Xh;function Yh(i){return Xh?.get(i)}var Kh;function Zh(i){return Kh?.get(i)}var Qh;function ef(i,e){return Qh?.get(i)?.get(e)}function Pi(i){let e=typeof i;return e==="string"?`"${i}"`:e==="number"||e==="bigint"||e==="boolean"?`${i}`:e==="object"||e==="function"?(i&&Object.getPrototypeOf(i)?.constructor?.name)??"null":e}function qe(i,e,t,r,n){let s=n&&"input"in n?n.input:t.value,o=n?.expected??i.expects??null,l=n?.received??Pi(s),a={kind:i.kind,type:i.type,input:s,expected:o,received:l,message:`Invalid ${e}: ${o?`Expected ${o} but r`:"R"}eceived ${l}`,requirement:i.requirement,path:n?.path,issues:n?.issues,lang:r.lang,abortEarly:r.abortEarly,abortPipeEarly:r.abortPipeEarly},c=i.kind==="schema",d=n?.message??i.message??ef(i.reference,a.lang)??(c?Zh(a.lang):null)??r.message??Yh(a.lang);d&&(a.message=typeof d=="function"?d(a):d),c&&(t.typed=!1),t.issues?t.issues.push(a):t.issues=[a]}function st(i){return{version:1,vendor:"valibot",validate(e){return i["~run"]({value:e},Ao())}}}function tf(i,e){return Object.hasOwn(i,e)&&e!=="__proto__"&&e!=="prototype"&&e!=="constructor"}function cc(i,e){let t=[...new Set(i)];return t.length>1?`(${t.join(` ${e} `)})`:t[0]??"never"}var rf=class extends Error{constructor(e){super(e[0].message);T(this,"issues");this.name="ValiError",this.issues=e}};function To(i,e){return{kind:"validation",type:"max_length",reference:To,async:!1,expects:`<=${i}`,requirement:i,message:e,"~run"(t,r){return t.typed&&t.value.length>this.requirement&&qe(this,"length",t,r,{received:`${t.value.length}`}),t}}}function Po(i,e){return{kind:"validation",type:"max_value",reference:Po,async:!1,expects:`<=${i instanceof Date?i.toJSON():Pi(i)}`,requirement:i,message:e,"~run"(t,r){return t.typed&&!(t.value<=this.requirement)&&qe(this,"value",t,r,{received:t.value instanceof Date?t.value.toJSON():Pi(t.value)}),t}}}function Ro(i,e){return{kind:"validation",type:"min_length",reference:Ro,async:!1,expects:`>=${i}`,requirement:i,message:e,"~run"(t,r){return t.typed&&t.value.length<this.requirement&&qe(this,"length",t,r,{received:`${t.value.length}`}),t}}}function Oo(i,e){return{kind:"validation",type:"min_value",reference:Oo,async:!1,expects:`>=${i instanceof Date?i.toJSON():Pi(i)}`,requirement:i,message:e,"~run"(t,r){return t.typed&&!(t.value>=this.requirement)&&qe(this,"value",t,r,{received:t.value instanceof Date?t.value.toJSON():Pi(t.value)}),t}}}function nf(i,e,t){return typeof i.default=="function"?i.default(e,t):i.default}function yt(i,e){return{kind:"schema",type:"array",reference:yt,expects:"Array",async:!1,item:i,message:e,get"~standard"(){return st(this)},"~run"(t,r){let n=t.value;if(Array.isArray(n)){t.typed=!0,t.value=[];for(let s=0;s<n.length;s++){let o=n[s],l=this.item["~run"]({value:o},r);if(l.issues){let a={type:"array",origin:"value",input:n,key:s,value:o};for(let c of l.issues)c.path?c.path.unshift(a):c.path=[a],t.issues?.push(c);if(t.issues||(t.issues=l.issues),r.abortEarly){t.typed=!1;break}}l.typed||(t.typed=!1),t.value.push(l.value)}}else qe(this,"type",t,r);return t}}}function xe(i){return{kind:"schema",type:"boolean",reference:xe,expects:"boolean",async:!1,message:i,get"~standard"(){return st(this)},"~run"(e,t){return typeof e.value=="boolean"?e.typed=!0:qe(this,"type",e,t),e}}}function Fo(i){return{kind:"schema",type:"null",reference:Fo,expects:"null",async:!1,message:i,get"~standard"(){return st(this)},"~run"(e,t){return e.value===null?e.typed=!0:qe(this,"type",e,t),e}}}function Te(i){return{kind:"schema",type:"number",reference:Te,expects:"number",async:!1,message:i,get"~standard"(){return st(this)},"~run"(e,t){return typeof e.value=="number"&&!isNaN(e.value)?e.typed=!0:qe(this,"type",e,t),e}}}function re(i,e){return{kind:"schema",type:"object",reference:re,expects:"Object",async:!1,entries:i,message:e,get"~standard"(){return st(this)},"~run"(t,r){let n=t.value;if(n&&typeof n=="object"){t.typed=!0,t.value={};for(let s in this.entries){let o=n[s],l=this.entries[s]["~run"]({value:o},r);if(l.issues){let a={type:"object",origin:"value",input:n,key:s,value:o};for(let c of l.issues)c.path?c.path.unshift(a):c.path=[a],t.issues?.push(c);if(t.issues||(t.issues=l.issues),r.abortEarly){t.typed=!1;break}}l.typed||(t.typed=!1),(l.value!==void 0||s in n)&&(t.value[s]=l.value)}}else qe(this,"type",t,r);return t}}}function I(i,e){return{kind:"schema",type:"optional",reference:I,expects:`(${i.expects} | undefined)`,async:!1,wrapped:i,default:e,get"~standard"(){return st(this)},"~run"(t,r){return t.value===void 0&&(this.default!==void 0&&(t.value=nf(this,t,r)),t.value===void 0)?(t.typed=!0,t):this.wrapped["~run"](t,r)}}}function Ri(i,e){return{kind:"schema",type:"picklist",reference:Ri,expects:cc(i.map(Pi),"|"),async:!1,options:i,message:e,get"~standard"(){return st(this)},"~run"(t,r){return this.options.includes(t.value)?t.typed=!0:qe(this,"type",t,r),t}}}function Mo(i,e,t){return{kind:"schema",type:"record",reference:Mo,expects:"Object",async:!1,key:i,value:e,message:t,get"~standard"(){return st(this)},"~run"(r,n){let s=r.value;if(s&&typeof s=="object"){r.typed=!0,r.value={};for(let o in s)if(tf(s,o)){let l=s[o],a=this.key["~run"]({value:o},n);if(a.issues){let d={type:"object",origin:"key",input:s,key:o,value:l};for(let u of a.issues)u.path=[d],r.issues?.push(u);if(r.issues||(r.issues=a.issues),n.abortEarly){r.typed=!1;break}}let c=this.value["~run"]({value:l},n);if(c.issues){let d={type:"object",origin:"value",input:s,key:o,value:l};for(let u of c.issues)u.path?u.path.unshift(d):u.path=[d],r.issues?.push(u);if(r.issues||(r.issues=c.issues),n.abortEarly){r.typed=!1;break}}(!a.typed||!c.typed)&&(r.typed=!1),a.typed&&(r.value[a.value]=c.value)}}else qe(this,"type",r,n);return r}}}function N(i){return{kind:"schema",type:"string",reference:N,expects:"string",async:!1,message:i,get"~standard"(){return st(this)},"~run"(e,t){return typeof e.value=="string"?e.typed=!0:qe(this,"type",e,t),e}}}function uc(i){let e;if(i)for(let t of i)e?e.push(...t.issues):e=t.issues;return e}function Do(i,e){return{kind:"schema",type:"union",reference:Do,expects:cc(i.map(t=>t.expects),"|"),async:!1,options:i,message:e,get"~standard"(){return st(this)},"~run"(t,r){let n,s,o;for(let l of this.options){let a=l["~run"]({value:t.value},r);if(a.typed)if(a.issues)s?s.push(a):s=[a];else{n=a;break}else o?o.push(a):o=[a]}if(n)return n;if(s){if(s.length===1)return s[0];qe(this,"type",t,r,{issues:uc(s)}),t.typed=!0}else{if(o?.length===1)return o[0];qe(this,"type",t,r,{issues:uc(o)})}return t}}}function dc(i,e,t){let r=i["~run"]({value:e},Ao(t));if(r.issues)throw new rf(r.issues);return r.value}function Mn(...i){return{...i[0],pipe:i,get"~standard"(){return st(this)},"~run"(e,t){for(let r of i)if(r.kind!=="metadata"){if(e.issues&&(r.kind==="schema"||r.kind==="transformation")){e.typed=!1;break}(!e.issues||!t.abortEarly&&!t.abortPipeEarly)&&(e=r["~run"](e,t))}return e}}}function Lo(i,e,t){let r=i["~run"]({value:e},Ao(t));return{typed:r.typed,success:!r.issues,output:r.value,issues:r.issues}}var _r={SCRAPER:"scraper",UNAS:"unas",SHOPRENTER:"shoprenter",SHOPIFY:"shopify",SHOPER:"shoper"},sf=Object.freeze([_r.UNAS,_r.SHOPRENTER,_r.SHOPIFY,_r.SHOPER]),hc=Object.freeze([...sf,_r.SCRAPER]);var jm=re({wsApiUrl:N(),url:N(),logoUrl:I(N()),title:N(),status:N(),color:N(),showStillLearningBanner:I(xe()),allowedOrigins:I(yt(N())),input:re({placeholder:N()}),bubble:re({imageUrl:I(N()),position:re({bottom:I(N()),right:I(N()),left:I(N())}),mobilePosition:I(re({bottom:I(N()),right:I(N()),left:I(N())})),zIndex:I(Te())}),examples:re({title:N(),items:yt(N())}),instructions:re({items:yt(N()),limit:I(Te())}),popup:I(re({mobileEnabled:I(xe()),desktopEnabled:I(xe()),delayMs:I(Te()),text:I(N()),mobileTitleText:I(N()),mobileButtonText:I(N())})),tryItOut:I(re({mobileEnabled:I(xe()),desktopEnabled:I(xe()),text:I(N())})),contactDetails:I(re({email:I(N()),phone:I(N()),socialMedia:I(re({facebook:I(N()),instagram:I(N()),twitter:I(N())}))})),notifications:I(re({email:I(N())})),neverShowStillLearningBanner:I(xe()),hidden:I(xe()),newChatTitle:I(N()),webhookURL:I(N()),automatedResponse:I(re({enabled:I(xe()),text:I(N()),latencyThresholdMs:I(Te())})),removePoweredBy:I(xe()),claimable:I(xe()),feed:I(N()),scraper:I(Ri(["netkazan","jateknet","json-schema-org","arukereso-xml","partocean","google-rev1"])),scraperAuthorization:I(N()),platform:I(Ri(hc)),workingHours:I(re({dailyAvailability:yt(re({dayOfWeek:Mn(Te(),Oo(0),Po(6)),startTime:N(),endTime:N(),isActive:xe()})),userTimeZone:I(N())})),planOverrides:I(re({maxProducts:I(Te()),conversations:I(Te()),faqs:I(re({max:I(Te()),questionLength:I(Te()),answerLength:I(Te())}))})),omitGeneralGuidelines:I(xe()),forceStripe:I(xe()),products:I(re({blocklistUrls:I(yt(N()))})),autoRefresh:I(re({enabled:I(xe()),intervalMins:I(Te())})),lang:I(N())});var yr=class extends ki{constructor(e){if(super(e),this.it=U,e.type!==En.CHILD)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(e){if(e===U||e==null)return this._t=void 0,this.it=e;if(e===it)return e;if(typeof e!="string")throw Error(this.constructor.directiveName+"() called with a non-string value");if(e===this.it)return this._t;this.it=e;let t=[e];return t.raw=t,this._t={_$litType$:this.constructor.resultType,strings:t,values:[]}}};yr.directiveName="unsafeHTML",yr.resultType=1;var fc=Cn(yr);var of=!0,No="Invariant failed";function gc(i,e){if(!i){if(of)throw new Error(No);var t=typeof e=="function"?e():e,r=t?"".concat(No,": ").concat(t):No;throw new Error(r)}}var af="\xB7 \xB7 \xB7",lf=re({conversationId:I(N()),messages:I(yt(re({id:N(),timestamp:Te(),role:Ri(["user","assistant","support"]),content:N(),content_html:I(N())})))}),uf=Mo(N(),Do([N(),Te(),xe(),Fo()])),cf=Mn(N(),Ro(1),To(1e3)),Oi,Fi,Q,jo,Dn,wr,ue,xr,vc,mc,_c,yc,bc,wc,xc,qo,Ln=class Ln extends J(H){constructor(){super();y(this,Q);y(this,Oi);y(this,Fi);y(this,wr,new On(this,{typingStarted:()=>f(this,ue).sendUserTypingStart(),typingStopped:()=>f(this,ue).sendUserTypingStop()}));y(this,ue,new Rn(this,{url:t=>{let r=new URL(this.config.wsApiUrl);return r.searchParams.set("widgetId",this.widgetId),r.searchParams.set("conversationId",t),r.searchParams.set("pageUrl",window.location.href),r},onReconnect:()=>{},onError:t=>{console.error("ws error",t)},onClose:()=>{},onNewMessage:t=>{t.role==="user"&&f(this,Q,qo)?.scrollTo(0,f(this,Q,qo).scrollHeight),t.role==="assistant"&&this.callbacks.onNewMessageStartedStreaming?.({widgetId:this.widgetId,message:t,conversationId:this.conversationId})},onMessageDone:(t,r)=>{r.role==="assistant"&&this.callbacks.onMessageEndedStreaming?.({widgetId:this.widgetId,text:r.content??"",message:r,usage_TOKENS_COMPLETION:t.message.usage.TOKENS_COMPLETION,conversationId:this.conversationId})},onMessageError:t=>{console.error("ws message error",t),t.message&&this.callbacks.onError?.({widgetId:this.widgetId,error:"WS: "+t.message})},onReset:()=>{localStorage.removeItem(f(this,Q,Dn))},onConnect:t=>{},persistConversationState:(t,r)=>{localStorage.setItem(f(this,Q,Dn),JSON.stringify({conversationId:t,messages:r}))},restoreConversationState:()=>{try{let t=JSON.parse(localStorage.getItem(f(this,Q,Dn))||"{}"),r=dc(lf,t);return{conversationId:r.conversationId||"",messages:r.messages||[]}}catch(t){return console.error(t),{conversationId:"",messages:[]}}}}));y(this,xr,"single");this.config={},this.callbacks={},this.showClose=!1,this.xUserData="",this.xPromptExt=""}get widgetId(){return this.config.widgetId}get conversationId(){return f(this,ue).conversationId}get messages(){return f(this,ue).messages}firstUpdated(){$(this,Q,jo).call(this)}updated(){$(this,Q,jo).call(this)}render(){gc(this.config,"config is required");let t=ac(this.messages,r=>{try{let n=new Date(r.timestamp),s=Math.floor(n.getUTCMinutes()/5)*5;return n.setUTCMinutes(s,0,0),n.valueOf().toString()}catch(n){console.error(n)}});return L`
183
+ `;default:throw new Error(`Unknown side: ${this.side}`)}}};T(Tn,"properties",{side:{type:String},status:{type:String},color:{type:String},logoUrl:{type:String,attribute:"logo"},position:{type:String}});customElements.get("mw-chat-message")||customElements.define("mw-chat-message",Tn);var gr,je,ct,vr,$o,Pn=class{constructor(e,t){y(this,vr);y(this,gr);y(this,je);y(this,ct);if(!e)throw new Error("host is required");if(!t)throw new Error("config is required");E(this,gr,e),f(this,gr).addController(this),E(this,je,t)}connect(e){E(this,je,e),E(this,ct,$(this,vr,$o).call(this))}hostConnected(){setTimeout(()=>{E(this,ct,$(this,vr,$o).call(this))},0)}hostDisconnected(){f(this,ct)?.close(1e3,"lit_host_disconnected"),E(this,ct,void 0)}send(e){f(this,ct)?.send(e)}close(e,t){f(this,ct)?.close(e,t)}get isConnected(){return f(this,ct)?.readyState===WebSocket.OPEN}};gr=new WeakMap,je=new WeakMap,ct=new WeakMap,vr=new WeakSet,$o=function(){let e=new WebSocket(f(this,je).url());return f(this,je).onClose&&(e.onclose=f(this,je).onClose),f(this,je).onOpen&&(e.onopen=f(this,je).onOpen),f(this,je).onError&&(e.onerror=f(this,je).onError),f(this,je).onMessage&&(e.onmessage=f(this,je).onMessage),e};var tc="664df22d-d461-42d6-801e-f70247e2cd7c",be,we,nt,Ii,Ai,Se,ei,ic,rc,nc,sc,Rn=class{constructor(e,t){y(this,Se);y(this,be);y(this,we);y(this,nt);T(this,"isStreaming",!1);T(this,"typingIndicator");T(this,"ranOutOfCredits",!1);T(this,"messages",[]);T(this,"conversationId","");y(this,Ii,0);y(this,Ai);T(this,"isLiveMode",!1);E(this,be,e),E(this,we,t),E(this,nt,this.initWS()),e.addController(this)}sendUserInput(e,{xUserData:t,xPromptExt:r,role:n="user",expectStreaming:s=!1}={}){return $(this,Se,ei).call(this,{type:"USER_INPUT",value:e,role:n,xUserData:t,xPromptExt:r},{expectStreaming:s})}sendUserCancel(){return $(this,Se,ei).call(this,{type:"USER_CANCEL"})}sendUserTypingStart(){return $(this,Se,ei).call(this,{type:"USER_TYPING_START"})}sendUserTypingStop(){return $(this,Se,ei).call(this,{type:"USER_TYPING_STOP"})}reloadConfig(){$(this,Se,ei).call(this,{type:"RELOAD_CONFIG"})}close(){f(this,nt).close(1e3,"closed by user")}retry(){clearTimeout(f(this,Ai)),E(this,Ai,setTimeout(()=>{f(this,we).onReconnect?.(),E(this,nt,this.initWS())},1e3*f(this,Ii))),Ul(this,Ii)._++}initWS(){return new Pn(f(this,be),{url:()=>f(this,we).url(this.conversationId,{}),onOpen:e=>$(this,Se,ic).call(this,e),onMessage:e=>$(this,Se,rc).call(this,JSON.parse(e.data)),onError:e=>$(this,Se,nc).call(this,e),onClose:e=>$(this,Se,sc).call(this,e)})}hostConnected(){this.conversationId=f(this,we).restoreConversationState?.()?.conversationId||"",this.messages=f(this,we).restoreConversationState?.()?.messages||[]}reset(){$(this,Se,ei).call(this,{type:"NEW_CHAT"}),f(this,we).onReset?.(),this.isStreaming=!1,this.typingIndicator=void 0,this.ranOutOfCredits=!1,this.messages=[],this.conversationId="",this.isLiveMode=!1,f(this,be).requestUpdate()}hostDisconnected(){clearTimeout(f(this,Ai))}reconnectSocket(){f(this,nt).close(1e3,"destroy"),E(this,nt,this.initWS())}get lastMsg(){if(this.messages.length>0)return this.messages[this.messages.length-1]}};be=new WeakMap,we=new WeakMap,nt=new WeakMap,Ii=new WeakMap,Ai=new WeakMap,Se=new WeakSet,ei=function(e,{expectStreaming:t=!1}={}){return f(this,nt).isConnected?(t&&!this.isLiveMode&&(this.isStreaming=!0,f(this,be).requestUpdate()),f(this,nt).send(JSON.stringify(e)),!0):(console.warn("WebSocket is not connected, message not sent - reconnecting now",e),this.retry(),!1)},ic=function(e){E(this,Ii,0)},rc=function(e){switch(e.type){case"NEW_MESSAGE":{this.messages=[...this.messages,e.message].filter((t,r,n)=>r===n.findIndex(s=>s.id===t.id)),this.typingIndicator=void 0,f(this,be).requestUpdate(),f(this,we).onNewMessage?.(e.message);break}case"UPDATE_MESSAGE":{let t=this.messages.find(r=>r.id===e.message.id);if(t)Object.assign(t,e.message),f(this,be).requestUpdate(),f(this,we).onUpdateMessage?.(e);else throw new Error(`Message with id ${e.message.id} not found`);break}case"MESSAGE_DONE":{let t=this.messages.find(r=>r.id===e.message.id);if(t)Object.assign(t,e.message);else throw new Error(`Message with id ${e.message.id} not found`);this.isStreaming=!1,f(this,be).requestUpdate(),f(this,we).onMessageDone?.(e,t),f(this,we).persistConversationState?.(this.conversationId,this.messages);break}case"MESSAGE_CANCEL":{this.isStreaming=!1,this.typingIndicator=void 0,f(this,be).requestUpdate();break}case"ERROR":{f(this,we).onMessageError?.(e);break}case"CONNECTED":{this.conversationId=e.conversationId,this.messages=e.messages,f(this,we).onConnect?.(e.conversationId),f(this,we).persistConversationState?.(this.conversationId,this.messages),this.isLiveMode=e.metadata?.isLiveMode,f(this,be).requestUpdate();break}case"TYPING_START":{e.role==="assistant"&&(this.isStreaming=!0),this.typingIndicator={role:e.role,metadata:e.metadata},f(this,be).requestUpdate();break}case"TYPING_STOP":{this.typingIndicator=void 0,f(this,be).requestUpdate();break}case"RAN_OUT_OF_CREDITS":{this.messages.some(t=>t.id===tc)||this.messages.push({id:tc,role:"assistant",content:"Sorry, I've run out of credits. Please contact the shop directly.",timestamp:Date.now()}),this.ranOutOfCredits=!0,f(this,be).requestUpdate();break}case"RECONNECT":{this.reconnectSocket(),f(this,be).requestUpdate();break}default:console.warn(`Unknown message type: ${JSON.stringify(e)}`)}},nc=function(e){console.error("onError",e),f(this,we).onError?.(e)},sc=function(e){f(this,be).isConnected&&!f(this,nt).isConnected&&e.reason==="reconnect"&&this.retry(),this.isStreaming=!1,this.typingIndicator=void 0,f(this,be).requestUpdate(),f(this,we).onClose?.()};var mr,Ti,Rt,ti,Fn,oc,On=class{constructor(e,t,{timeoutMs:r=2e3}={}){y(this,Fn);y(this,mr);y(this,Ti);y(this,Rt);y(this,ti,!1);T(this,"timeoutMs");E(this,mr,e),E(this,Ti,t),this.timeoutMs=r,e.addController(this)}get isTyping(){return f(this,ti)}hostDisconnected(){clearTimeout(f(this,Rt)),E(this,Rt,void 0)}onInput(e){if(f(this,mr).isConnected){if(!e.trim()){this.typingStopped();return}clearTimeout(f(this,Rt)),E(this,Rt,setTimeout(()=>this.typingStopped(),this.timeoutMs)),f(this,ti)||$(this,Fn,oc).call(this)}}typingStopped(){clearTimeout(f(this,Rt)),E(this,ti,!1),f(this,Ti).typingStopped()}};mr=new WeakMap,Ti=new WeakMap,Rt=new WeakMap,ti=new WeakMap,Fn=new WeakSet,oc=function(){E(this,ti,!0),f(this,Ti).typingStarted()};function ac(i,e){let t=new Map;for(let r of i){let n=e(r);t.has(n)||t.set(n,[]),(t.get(n)||[]).push(r)}return t}function lc(i,e="en-US"){let t=new Intl.DateTimeFormat(e,{hour:"numeric",minute:"numeric"}).format(i);return`${i.toLocaleDateString(e,{year:"numeric",month:"short",day:"numeric"})}, ${t}`}var Io;function Ao(i){return{lang:i?.lang??Io?.lang,message:i?.message,abortEarly:i?.abortEarly??Io?.abortEarly,abortPipeEarly:i?.abortPipeEarly??Io?.abortPipeEarly}}var Xh;function Yh(i){return Xh?.get(i)}var Kh;function Zh(i){return Kh?.get(i)}var Qh;function ef(i,e){return Qh?.get(i)?.get(e)}function Pi(i){let e=typeof i;return e==="string"?`"${i}"`:e==="number"||e==="bigint"||e==="boolean"?`${i}`:e==="object"||e==="function"?(i&&Object.getPrototypeOf(i)?.constructor?.name)??"null":e}function qe(i,e,t,r,n){let s=n&&"input"in n?n.input:t.value,o=n?.expected??i.expects??null,l=n?.received??Pi(s),a={kind:i.kind,type:i.type,input:s,expected:o,received:l,message:`Invalid ${e}: ${o?`Expected ${o} but r`:"R"}eceived ${l}`,requirement:i.requirement,path:n?.path,issues:n?.issues,lang:r.lang,abortEarly:r.abortEarly,abortPipeEarly:r.abortPipeEarly},c=i.kind==="schema",d=n?.message??i.message??ef(i.reference,a.lang)??(c?Zh(a.lang):null)??r.message??Yh(a.lang);d&&(a.message=typeof d=="function"?d(a):d),c&&(t.typed=!1),t.issues?t.issues.push(a):t.issues=[a]}function st(i){return{version:1,vendor:"valibot",validate(e){return i["~run"]({value:e},Ao())}}}function tf(i,e){return Object.hasOwn(i,e)&&e!=="__proto__"&&e!=="prototype"&&e!=="constructor"}function cc(i,e){let t=[...new Set(i)];return t.length>1?`(${t.join(` ${e} `)})`:t[0]??"never"}var rf=class extends Error{constructor(e){super(e[0].message);T(this,"issues");this.name="ValiError",this.issues=e}};function To(i,e){return{kind:"validation",type:"max_length",reference:To,async:!1,expects:`<=${i}`,requirement:i,message:e,"~run"(t,r){return t.typed&&t.value.length>this.requirement&&qe(this,"length",t,r,{received:`${t.value.length}`}),t}}}function Po(i,e){return{kind:"validation",type:"max_value",reference:Po,async:!1,expects:`<=${i instanceof Date?i.toJSON():Pi(i)}`,requirement:i,message:e,"~run"(t,r){return t.typed&&!(t.value<=this.requirement)&&qe(this,"value",t,r,{received:t.value instanceof Date?t.value.toJSON():Pi(t.value)}),t}}}function Ro(i,e){return{kind:"validation",type:"min_length",reference:Ro,async:!1,expects:`>=${i}`,requirement:i,message:e,"~run"(t,r){return t.typed&&t.value.length<this.requirement&&qe(this,"length",t,r,{received:`${t.value.length}`}),t}}}function Oo(i,e){return{kind:"validation",type:"min_value",reference:Oo,async:!1,expects:`>=${i instanceof Date?i.toJSON():Pi(i)}`,requirement:i,message:e,"~run"(t,r){return t.typed&&!(t.value>=this.requirement)&&qe(this,"value",t,r,{received:t.value instanceof Date?t.value.toJSON():Pi(t.value)}),t}}}function nf(i,e,t){return typeof i.default=="function"?i.default(e,t):i.default}function yt(i,e){return{kind:"schema",type:"array",reference:yt,expects:"Array",async:!1,item:i,message:e,get"~standard"(){return st(this)},"~run"(t,r){let n=t.value;if(Array.isArray(n)){t.typed=!0,t.value=[];for(let s=0;s<n.length;s++){let o=n[s],l=this.item["~run"]({value:o},r);if(l.issues){let a={type:"array",origin:"value",input:n,key:s,value:o};for(let c of l.issues)c.path?c.path.unshift(a):c.path=[a],t.issues?.push(c);if(t.issues||(t.issues=l.issues),r.abortEarly){t.typed=!1;break}}l.typed||(t.typed=!1),t.value.push(l.value)}}else qe(this,"type",t,r);return t}}}function xe(i){return{kind:"schema",type:"boolean",reference:xe,expects:"boolean",async:!1,message:i,get"~standard"(){return st(this)},"~run"(e,t){return typeof e.value=="boolean"?e.typed=!0:qe(this,"type",e,t),e}}}function Fo(i){return{kind:"schema",type:"null",reference:Fo,expects:"null",async:!1,message:i,get"~standard"(){return st(this)},"~run"(e,t){return e.value===null?e.typed=!0:qe(this,"type",e,t),e}}}function Te(i){return{kind:"schema",type:"number",reference:Te,expects:"number",async:!1,message:i,get"~standard"(){return st(this)},"~run"(e,t){return typeof e.value=="number"&&!isNaN(e.value)?e.typed=!0:qe(this,"type",e,t),e}}}function re(i,e){return{kind:"schema",type:"object",reference:re,expects:"Object",async:!1,entries:i,message:e,get"~standard"(){return st(this)},"~run"(t,r){let n=t.value;if(n&&typeof n=="object"){t.typed=!0,t.value={};for(let s in this.entries){let o=n[s],l=this.entries[s]["~run"]({value:o},r);if(l.issues){let a={type:"object",origin:"value",input:n,key:s,value:o};for(let c of l.issues)c.path?c.path.unshift(a):c.path=[a],t.issues?.push(c);if(t.issues||(t.issues=l.issues),r.abortEarly){t.typed=!1;break}}l.typed||(t.typed=!1),(l.value!==void 0||s in n)&&(t.value[s]=l.value)}}else qe(this,"type",t,r);return t}}}function I(i,e){return{kind:"schema",type:"optional",reference:I,expects:`(${i.expects} | undefined)`,async:!1,wrapped:i,default:e,get"~standard"(){return st(this)},"~run"(t,r){return t.value===void 0&&(this.default!==void 0&&(t.value=nf(this,t,r)),t.value===void 0)?(t.typed=!0,t):this.wrapped["~run"](t,r)}}}function Ri(i,e){return{kind:"schema",type:"picklist",reference:Ri,expects:cc(i.map(Pi),"|"),async:!1,options:i,message:e,get"~standard"(){return st(this)},"~run"(t,r){return this.options.includes(t.value)?t.typed=!0:qe(this,"type",t,r),t}}}function Mo(i,e,t){return{kind:"schema",type:"record",reference:Mo,expects:"Object",async:!1,key:i,value:e,message:t,get"~standard"(){return st(this)},"~run"(r,n){let s=r.value;if(s&&typeof s=="object"){r.typed=!0,r.value={};for(let o in s)if(tf(s,o)){let l=s[o],a=this.key["~run"]({value:o},n);if(a.issues){let d={type:"object",origin:"key",input:s,key:o,value:l};for(let u of a.issues)u.path=[d],r.issues?.push(u);if(r.issues||(r.issues=a.issues),n.abortEarly){r.typed=!1;break}}let c=this.value["~run"]({value:l},n);if(c.issues){let d={type:"object",origin:"value",input:s,key:o,value:l};for(let u of c.issues)u.path?u.path.unshift(d):u.path=[d],r.issues?.push(u);if(r.issues||(r.issues=c.issues),n.abortEarly){r.typed=!1;break}}(!a.typed||!c.typed)&&(r.typed=!1),a.typed&&(r.value[a.value]=c.value)}}else qe(this,"type",r,n);return r}}}function N(i){return{kind:"schema",type:"string",reference:N,expects:"string",async:!1,message:i,get"~standard"(){return st(this)},"~run"(e,t){return typeof e.value=="string"?e.typed=!0:qe(this,"type",e,t),e}}}function uc(i){let e;if(i)for(let t of i)e?e.push(...t.issues):e=t.issues;return e}function Do(i,e){return{kind:"schema",type:"union",reference:Do,expects:cc(i.map(t=>t.expects),"|"),async:!1,options:i,message:e,get"~standard"(){return st(this)},"~run"(t,r){let n,s,o;for(let l of this.options){let a=l["~run"]({value:t.value},r);if(a.typed)if(a.issues)s?s.push(a):s=[a];else{n=a;break}else o?o.push(a):o=[a]}if(n)return n;if(s){if(s.length===1)return s[0];qe(this,"type",t,r,{issues:uc(s)}),t.typed=!0}else{if(o?.length===1)return o[0];qe(this,"type",t,r,{issues:uc(o)})}return t}}}function dc(i,e,t){let r=i["~run"]({value:e},Ao(t));if(r.issues)throw new rf(r.issues);return r.value}function Mn(...i){return{...i[0],pipe:i,get"~standard"(){return st(this)},"~run"(e,t){for(let r of i)if(r.kind!=="metadata"){if(e.issues&&(r.kind==="schema"||r.kind==="transformation")){e.typed=!1;break}(!e.issues||!t.abortEarly&&!t.abortPipeEarly)&&(e=r["~run"](e,t))}return e}}}function Lo(i,e,t){let r=i["~run"]({value:e},Ao(t));return{typed:r.typed,success:!r.issues,output:r.value,issues:r.issues}}var _r={SCRAPER:"scraper",UNAS:"unas",SHOPRENTER:"shoprenter",SHOPIFY:"shopify",SHOPER:"shoper"},sf=Object.freeze([_r.UNAS,_r.SHOPRENTER,_r.SHOPIFY,_r.SHOPER]),hc=Object.freeze([...sf,_r.SCRAPER]);var jm=re({wsApiUrl:N(),url:N(),logoUrl:I(N()),title:N(),status:N(),color:N(),showStillLearningBanner:I(xe()),allowedOrigins:I(yt(N())),input:re({placeholder:N()}),bubble:re({imageUrl:I(N()),position:re({bottom:I(N()),right:I(N()),left:I(N())}),mobilePosition:I(re({bottom:I(N()),right:I(N()),left:I(N())})),zIndex:I(Te())}),examples:re({title:N(),items:yt(N())}),instructions:re({items:yt(N()),limit:I(Te())}),popup:I(re({mobileEnabled:I(xe()),desktopEnabled:I(xe()),delayMs:I(Te()),text:I(N()),mobileTitleText:I(N()),mobileButtonText:I(N())})),tryItOut:I(re({mobileEnabled:I(xe()),desktopEnabled:I(xe()),text:I(N())})),contactDetails:I(re({email:I(N()),phone:I(N()),socialMedia:I(re({facebook:I(N()),instagram:I(N()),twitter:I(N())}))})),notifications:I(re({email:I(N())})),neverShowStillLearningBanner:I(xe()),hidden:I(xe()),newChatTitle:I(N()),webhookURL:I(N()),automatedResponse:I(re({enabled:I(xe()),text:I(N()),latencyThresholdMs:I(Te())})),removePoweredBy:I(xe()),claimable:I(xe()),feed:I(N()),scraper:I(Ri(["netkazan","jateknet","json-schema-org","arukereso-xml","partocean","google-rev1","bookline-hu"])),scraperAuthorization:I(N()),platform:I(Ri(hc)),workingHours:I(re({dailyAvailability:yt(re({dayOfWeek:Mn(Te(),Oo(0),Po(6)),startTime:N(),endTime:N(),isActive:xe()})),userTimeZone:I(N())})),planOverrides:I(re({maxProducts:I(Te()),conversations:I(Te()),faqs:I(re({max:I(Te()),questionLength:I(Te()),answerLength:I(Te())}))})),omitGeneralGuidelines:I(xe()),forceStripe:I(xe()),products:I(re({blocklistUrls:I(yt(N()))})),autoRefresh:I(re({enabled:I(xe()),intervalMins:I(Te())})),lang:I(N())});var yr=class extends ki{constructor(e){if(super(e),this.it=U,e.type!==En.CHILD)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(e){if(e===U||e==null)return this._t=void 0,this.it=e;if(e===it)return e;if(typeof e!="string")throw Error(this.constructor.directiveName+"() called with a non-string value");if(e===this.it)return this._t;this.it=e;let t=[e];return t.raw=t,this._t={_$litType$:this.constructor.resultType,strings:t,values:[]}}};yr.directiveName="unsafeHTML",yr.resultType=1;var fc=Cn(yr);var of=!0,No="Invariant failed";function gc(i,e){if(!i){if(of)throw new Error(No);var t=typeof e=="function"?e():e,r=t?"".concat(No,": ").concat(t):No;throw new Error(r)}}var af="\xB7 \xB7 \xB7",lf=re({conversationId:I(N()),messages:I(yt(re({id:N(),timestamp:Te(),role:Ri(["user","assistant","support"]),content:N(),content_html:I(N())})))}),uf=Mo(N(),Do([N(),Te(),xe(),Fo()])),cf=Mn(N(),Ro(1),To(1e3)),Oi,Fi,Q,jo,Dn,wr,ue,xr,vc,mc,_c,yc,bc,wc,xc,qo,Ln=class Ln extends J(H){constructor(){super();y(this,Q);y(this,Oi);y(this,Fi);y(this,wr,new On(this,{typingStarted:()=>f(this,ue).sendUserTypingStart(),typingStopped:()=>f(this,ue).sendUserTypingStop()}));y(this,ue,new Rn(this,{url:t=>{let r=new URL(this.config.wsApiUrl);return r.searchParams.set("widgetId",this.widgetId),r.searchParams.set("conversationId",t),r.searchParams.set("pageUrl",window.location.href),r},onReconnect:()=>{},onError:t=>{console.error("ws error",t)},onClose:()=>{},onNewMessage:t=>{t.role==="user"&&f(this,Q,qo)?.scrollTo(0,f(this,Q,qo).scrollHeight),t.role==="assistant"&&this.callbacks.onNewMessageStartedStreaming?.({widgetId:this.widgetId,message:t,conversationId:this.conversationId})},onMessageDone:(t,r)=>{r.role==="assistant"&&this.callbacks.onMessageEndedStreaming?.({widgetId:this.widgetId,text:r.content??"",message:r,usage_TOKENS_COMPLETION:t.message.usage.TOKENS_COMPLETION,conversationId:this.conversationId})},onMessageError:t=>{console.error("ws message error",t),t.message&&this.callbacks.onError?.({widgetId:this.widgetId,error:"WS: "+t.message})},onReset:()=>{localStorage.removeItem(f(this,Q,Dn))},onConnect:t=>{},persistConversationState:(t,r)=>{localStorage.setItem(f(this,Q,Dn),JSON.stringify({conversationId:t,messages:r}))},restoreConversationState:()=>{try{let t=JSON.parse(localStorage.getItem(f(this,Q,Dn))||"{}"),r=dc(lf,t);return{conversationId:r.conversationId||"",messages:r.messages||[]}}catch(t){return console.error(t),{conversationId:"",messages:[]}}}}));y(this,xr,"single");this.config={},this.callbacks={},this.showClose=!1,this.xUserData="",this.xPromptExt=""}get widgetId(){return this.config.widgetId}get conversationId(){return f(this,ue).conversationId}get messages(){return f(this,ue).messages}firstUpdated(){$(this,Q,jo).call(this)}updated(){$(this,Q,jo).call(this)}render(){gc(this.config,"config is required");let t=ac(this.messages,r=>{try{let n=new Date(r.timestamp),s=Math.floor(n.getUTCMinutes()/5)*5;return n.setUTCMinutes(s,0,0),n.valueOf().toString()}catch(n){console.error(n)}});return L`
184
184
  <div class="relative mx-auto h-full bg-[#FDFDFD] font-sans text-base before:absolute before:inset-0 before:bg-[#8d8d8d] before:opacity-10 sm:rounded-[36px] sm:p-1.5 sm:before:rounded-[36px]">
185
185
  <div
186
186
  class="relative flex h-full flex-col bg-white shadow-[0px_4px_4px_0px_rgba(0,0,0,0.25),-116px_177px_59px_0px_rgba(0,0,0,0.00),-74px_113px_54px_0px_rgba(0,0,0,0.01),-42px_64px_46px_0px_rgba(0,0,0,0.03),-19px_28px_34px_0px_rgba(0,0,0,0.06)] sm:rounded-[30px]">
@@ -394,7 +394,7 @@ var Kp=Object.defineProperty;var Nl=i=>{throw TypeError(i)};var Zp=(i,e,t)=>e in
394
394
  stroke-linecap="round"></path>
395
395
  </svg>
396
396
  </div>
397
- `);this.positionClasses="",this.text="Try it out"}};T(Wn,"properties",{positionClasses:{type:String,attribute:"position"},text:{type:String}});customElements.get("mw-try-it-out")||customElements.define("mw-try-it-out",Wn);window.__INIT_MOLIN_SHOP_AI=function(e){if(hf(e),e.auto){let t=document.createElement("molin-shop-ai");t.setAttribute("cdn",e.cdn),t.setAttribute("widget",e.widgetId),document.body.appendChild(t)}};function hf(i){window.__INIT_MOLIN_SHOP_AI_OPTIONS=i}function Ac(){return window.__INIT_MOLIN_SHOP_AI_OPTIONS}var Fe,wt,Gn,Ar,Ui,Ko=class{constructor(){y(this,Fe,[]);y(this,wt);y(this,Gn,10);y(this,Ar,5e3);y(this,Ui,!1)}async add(e,t){if(f(this,Fe).push({event:e,properties:Object.assign({},t,Rc()),distinct_id:Pc(t.distinct_id),timestamp:new Date().toISOString()}),f(this,Fe).length>=f(this,Gn))return this.flush();f(this,wt)||E(this,wt,setTimeout(()=>{this.flush().catch(console.error)},f(this,Ar)))}async flush(){if(f(this,Ui)||f(this,Fe).length===0)return;let e=[...f(this,Fe)];try{E(this,Ui,!0),clearTimeout(f(this,wt)),E(this,wt,void 0),E(this,Fe,[]);let t=new AbortController,r=setTimeout(()=>t.abort(),5e3),n=new FormData;n.append("events",JSON.stringify(e));let s=await fetch(new URL("/widgets/data/collect",Zo()).href,{method:"POST",body:n,signal:t.signal});if(clearTimeout(r),!s.ok)throw new Error(`HTTP error! status: ${s.status}`);return s}catch(t){if(t.name==="AbortError")console.error("Request timed out, retrying events"),E(this,Fe,[...e,...f(this,Fe)]);else{console.error("Failed to send events to backend:",t);let r=e.filter(n=>n.event.includes("error"));E(this,Fe,[...r,...f(this,Fe)])}}finally{E(this,Ui,!1),f(this,Fe).length>0&&!f(this,wt)&&E(this,wt,setTimeout(()=>{this.flush().catch(console.error)},f(this,Ar)))}}async flushBeforeUnload(){if(f(this,Fe).length>0)try{let e=new FormData;e.append("events",JSON.stringify(f(this,Fe))),navigator.sendBeacon(new URL("/widgets/data/collect",Zo()).href,e)}catch(e){console.error("Failed to send final events:",e)}}};Fe=new WeakMap,wt=new WeakMap,Gn=new WeakMap,Ar=new WeakMap,Ui=new WeakMap;var Tc=new Ko;window.addEventListener("unload",()=>{Tc.flushBeforeUnload().catch(console.error)});async function he(i,e){try{if(e.immediate){let t=new FormData;t.append("events",JSON.stringify([{event:i,properties:Object.assign({},e,Rc()),distinct_id:Pc(e.distinct_id),timestamp:new Date().toISOString()}]));let r=await fetch(new URL("/widgets/data/collect",Zo()).href,{method:"POST",body:t});if(!r.ok)throw new Error(`HTTP error! status: ${r.status}`);return await r.json()}return Tc.add(i,e)}catch(t){console.error("Failed to send event:",t)}}function Pc(i=crypto.randomUUID()){let e="molin_shop_assistant_distinct_id";try{let t=localStorage.getItem(e);return t||(t=i,localStorage.setItem(e,t)),t}catch(t){console.error("Failed to handle distinct ID:",t);try{localStorage.setItem(e,i)}catch(r){console.error("Failed to store new distinct ID:",r)}return i}}function Rc(){return{referrer:document.referrer,userAgent:navigator.userAgent,language:navigator.language,screenWidth:window.innerWidth,screenHeight:window.innerHeight,timestamp:new Date().toISOString(),timezoneOffset:new Date().getTimezoneOffset(),doNotTrack:navigator.doNotTrack}}var Vn;function Zo(){if(Vn)return Vn;let i=new URL(import.meta.url).hostname;return Vn=new Map([["localhost","http://localhost:8787"],["widget.molin.foo","https://molin.foo"],["widget.molin.ai","https://molin.ai"],["molin.foo","https://molin.foo"]]).get(i)||"https://molin.ai",Vn}var ai,Tr,Ft,li,Xn,Fc,Jn=class{constructor(e,t,r){y(this,Xn);y(this,ai);y(this,Tr);y(this,Ft);y(this,li);T(this,"isLoading",!1);T(this,"data");E(this,ai,e),E(this,Tr,t),E(this,Ft,r),e.addController(this)}fetch(){if(this.isLoading)return;f(this,li)?.abort();let e=new AbortController;E(this,li,e),this.isLoading=!0,this.data=void 0,f(this,ai).requestUpdate(),(async()=>{let t=$(this,Xn,Fc).call(this);return t.signal?.addEventListener("abort",()=>e.abort(),{signal:e.signal}),fetch(t,{signal:e.signal})})().then(async t=>{if(!t.ok)throw new Error(`${t.statusText}: ${await t.text()}`);this.isLoading=!1,this.data=typeof f(this,Ft)?.transform=="function"?await f(this,Ft).transform(t):t,f(this,ai).requestUpdate()}).catch(t=>{f(this,Ft)?.onError?.(t),this.isLoading=!1,this.data=void 0,f(this,ai).requestUpdate()}).finally(()=>{e.abort()})}hostConnected(){this.isLoading||f(this,Ft)?.fetchWhenConnected&&this.fetch()}hostDisconnected(){f(this,li)?.abort(),E(this,li,void 0)}};ai=new WeakMap,Tr=new WeakMap,Ft=new WeakMap,li=new WeakMap,Xn=new WeakSet,Fc=function(){let e=f(this,Tr);if(typeof e=="function"&&(e=e()),!e)throw new Error("missing request");return new Request(e)};var dt,Pr,ji,qi,Mt=class{constructor(e,t){y(this,dt);y(this,Pr);y(this,ji);y(this,qi);E(this,dt,e),E(this,Pr,t),e.addController(this)}get data(){return f(this,qi)||f(this,ji)?.data}hostConnected(){if(f(this,ji)||f(this,qi))return;let e=Ac();e&&e.widgetId===f(this,dt).widgetId?E(this,qi,e.config):E(this,ji,new Jn(f(this,dt),()=>{if(f(this,dt).cdn&&f(this,dt).widgetId)return`${f(this,dt).cdn}/config?w=${f(this,dt).widgetId}`;throw new Error("missing cdn or widgetId")},{fetchWhenConnected:!0,transform:t=>t.json(),onError:f(this,Pr)?.onError}))}};dt=new WeakMap,Pr=new WeakMap,ji=new WeakMap,qi=new WeakMap;function Mc(i,e){var t=Object.keys(i);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(i);e&&(r=r.filter(function(n){return Object.getOwnPropertyDescriptor(i,n).enumerable})),t.push.apply(t,r)}return t}function b(i){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Mc(Object(t),!0).forEach(function(r){C(i,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(t)):Mc(Object(t)).forEach(function(r){Object.defineProperty(i,r,Object.getOwnPropertyDescriptor(t,r))})}return i}function C(i,e,t){return e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function Rd(i,e){if(i==null)return{};var t,r,n=function(o,l){if(o==null)return{};var a,c,d={},u=Object.keys(o);for(c=0;c<u.length;c++)a=u[c],l.indexOf(a)>=0||(d[a]=o[a]);return d}(i,e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(i);for(r=0;r<s.length;r++)t=s[r],e.indexOf(t)>=0||Object.prototype.propertyIsEnumerable.call(i,t)&&(n[t]=i[t])}return n}var lt,Nt={DEBUG:!1,LIB_VERSION:"1.195.0"},v=typeof window<"u"?window:void 0,He=typeof globalThis<"u"?globalThis:v,Od=Array.prototype,Dc=Od.forEach,Lc=Od.indexOf,Xe=He?.navigator,O=He?.document,Be=He?.location,ca=He?.fetch,da=He!=null&&He.XMLHttpRequest&&"withCredentials"in new He.XMLHttpRequest?He.XMLHttpRequest:void 0,Nc=He?.AbortController,ke=Xe?.userAgent,j=v??{},Qo="$copy_autocapture",ff=["$snapshot","$pageview","$pageleave","$set","survey dismissed","survey sent","survey shown","$identify","$groupidentify","$create_alias","$$client_ingestion_warning","$web_experiment_applied","$feature_enrollment_update","$feature_flag_called"];(function(i){i.GZipJS="gzip-js",i.Base64="base64"})(lt||(lt={}));var gf=Array.isArray,Fd=Object.prototype,Md=Fd.hasOwnProperty,As=Fd.toString,ce=gf||function(i){return As.call(i)==="[object Array]"},Qe=i=>typeof i=="function",fe=i=>i===Object(i)&&!ce(i),Hi=i=>{if(fe(i)){for(var e in i)if(Md.call(i,e))return!1;return!0}return!1},F=i=>i===void 0,Ce=i=>As.call(i)=="[object String]",Uc=i=>Ce(i)&&i.trim().length===0,zt=i=>i===null,ee=i=>F(i)||zt(i),Je=i=>As.call(i)=="[object Number]",fi=i=>As.call(i)==="[object Boolean]",vf=i=>i instanceof FormData,mf=i=>W(ff,i),Dd=i=>{var e={_log:function(t){if(v&&(Nt.DEBUG||j.POSTHOG_DEBUG)&&!F(v.console)&&v.console){for(var r=("__rrweb_original__"in v.console[t])?v.console[t].__rrweb_original__:v.console[t],n=arguments.length,s=new Array(n>1?n-1:0),o=1;o<n;o++)s[o-1]=arguments[o];r(i,...s)}},info:function(){for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];e._log("log",...r)},warn:function(){for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];e._log("warn",...r)},error:function(){for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];e._log("error",...r)},critical:function(){for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];console.error(i,...r)},uninitializedWarning:t=>{e.error("You must initialize PostHog before calling ".concat(t))},createLogger:t=>Dd("".concat(i," ").concat(t))};return e},D=Dd("[PostHog.js]"),ze=D.createLogger,cs={},Ts=function(i){return i.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"")};function Vi(i,e,t){if(ce(i)){if(Dc&&i.forEach===Dc)i.forEach(e,t);else if("length"in i&&i.length===+i.length){for(var r=0,n=i.length;r<n;r++)if(r in i&&e.call(t,i[r],r)===cs)return}}}function K(i,e,t){if(!ee(i)){if(ce(i))return Vi(i,e,t);if(vf(i)){for(var r of i.entries())if(e.call(t,r[1],r[0])===cs)return}else for(var n in i)if(Md.call(i,n)&&e.call(t,i[n],n)===cs)return}}var De=function(i){for(var e=arguments.length,t=new Array(e>1?e-1:0),r=1;r<e;r++)t[r-1]=arguments[r];return Vi(t,function(n){for(var s in n)n[s]!==void 0&&(i[s]=n[s])}),i};function W(i,e){return i.indexOf(e)!==-1}function as(i){for(var e=Object.keys(i),t=e.length,r=new Array(t);t--;)r[t]=[e[t],i[e[t]]];return r}var jc=function(i){try{return i()}catch{return}},_f=function(i){return function(){try{for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return i.apply(this,t)}catch(n){D.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),D.critical(n)}}},ds=function(i){var e={};return K(i,function(t,r){Ce(t)&&t.length>0&&(e[r]=t)}),e},pa=function(i){return i.replace(/^\$/,"")};function yf(i,e){return t=i,r=s=>Ce(s)&&!zt(e)?s.slice(0,e):s,n=new Set,function s(o,l){return o!==Object(o)?r?r(o,l):o:n.has(o)?void 0:(n.add(o),ce(o)?(a=[],Vi(o,c=>{a.push(s(c))})):(a={},K(o,(c,d)=>{n.has(c)||(a[d]=s(c,d))})),a);var a}(t);var t,r,n}var bf=function(i){var e,t,r,n,s="";for(e=t=0,r=(i=(i+"").replace(/\r\n/g,`
397
+ `);this.positionClasses="",this.text="Try it out"}};T(Wn,"properties",{positionClasses:{type:String,attribute:"position"},text:{type:String}});customElements.get("mw-try-it-out")||customElements.define("mw-try-it-out",Wn);window.__INIT_MOLIN_SHOP_AI=function(e){if(hf(e),e.auto){let t=document.createElement("molin-shop-ai");t.setAttribute("cdn",e.cdn),t.setAttribute("widget",e.widgetId),document.body.appendChild(t)}};function hf(i){window.__INIT_MOLIN_SHOP_AI_OPTIONS=i}function Ac(){return window.__INIT_MOLIN_SHOP_AI_OPTIONS}var Fe,wt,Gn,Ar,Ui,Ko=class{constructor(){y(this,Fe,[]);y(this,wt);y(this,Gn,10);y(this,Ar,5e3);y(this,Ui,!1)}async add(e,t){if(f(this,Fe).push({event:e,properties:Object.assign({},t,Rc()),distinct_id:Pc(t.distinct_id),timestamp:new Date().toISOString()}),f(this,Fe).length>=f(this,Gn))return this.flush();f(this,wt)||E(this,wt,setTimeout(()=>{this.flush().catch(console.error)},f(this,Ar)))}async flush(){if(f(this,Ui)||f(this,Fe).length===0)return;let e=[...f(this,Fe)];try{E(this,Ui,!0),clearTimeout(f(this,wt)),E(this,wt,void 0),E(this,Fe,[]);let t=new AbortController,r=setTimeout(()=>t.abort(),5e3),n=new FormData;n.append("events",JSON.stringify(e));let s=await fetch(new URL("/widgets/data/collect",Zo()).href,{method:"POST",body:n,signal:t.signal});if(clearTimeout(r),!s.ok)throw new Error(`HTTP error! status: ${s.status}`);return s}catch(t){if(t.name==="AbortError")console.error("Request timed out, retrying events"),E(this,Fe,[...e,...f(this,Fe)]);else{console.error("Failed to send events to backend:",t);let r=e.filter(n=>n.event.includes("error"));E(this,Fe,[...r,...f(this,Fe)])}}finally{E(this,Ui,!1),f(this,Fe).length>0&&!f(this,wt)&&E(this,wt,setTimeout(()=>{this.flush().catch(console.error)},f(this,Ar)))}}async flushBeforeUnload(){if(f(this,Fe).length>0)try{let e=new FormData;e.append("events",JSON.stringify(f(this,Fe))),navigator.sendBeacon(new URL("/widgets/data/collect",Zo()).href,e)}catch(e){console.error("Failed to send final events:",e)}}};Fe=new WeakMap,wt=new WeakMap,Gn=new WeakMap,Ar=new WeakMap,Ui=new WeakMap;var Tc=new Ko;window.addEventListener("beforeunload",()=>{Tc.flushBeforeUnload().catch(console.error)});async function he(i,e){try{if(e.immediate){let t=new FormData;t.append("events",JSON.stringify([{event:i,properties:Object.assign({},e,Rc()),distinct_id:Pc(e.distinct_id),timestamp:new Date().toISOString()}]));let r=await fetch(new URL("/widgets/data/collect",Zo()).href,{method:"POST",body:t});if(!r.ok)throw new Error(`HTTP error! status: ${r.status}`);return await r.json()}return Tc.add(i,e)}catch(t){console.error("Failed to send event:",t)}}function Pc(i=crypto.randomUUID()){let e="molin_shop_assistant_distinct_id";try{let t=localStorage.getItem(e);return t||(t=i,localStorage.setItem(e,t)),t}catch(t){console.error("Failed to handle distinct ID:",t);try{localStorage.setItem(e,i)}catch(r){console.error("Failed to store new distinct ID:",r)}return i}}function Rc(){return{referrer:document.referrer,userAgent:navigator.userAgent,language:navigator.language,screenWidth:window.innerWidth,screenHeight:window.innerHeight,timestamp:new Date().toISOString(),timezoneOffset:new Date().getTimezoneOffset(),doNotTrack:navigator.doNotTrack}}var Vn;function Zo(){if(Vn)return Vn;let i=new URL(import.meta.url).hostname;return Vn=new Map([["localhost","http://localhost:8787"],["widget.molin.foo","https://molin.foo"],["widget.molin.ai","https://molin.ai"],["molin.foo","https://molin.foo"]]).get(i)||"https://molin.ai",Vn}var ai,Tr,Ft,li,Xn,Fc,Jn=class{constructor(e,t,r){y(this,Xn);y(this,ai);y(this,Tr);y(this,Ft);y(this,li);T(this,"isLoading",!1);T(this,"data");E(this,ai,e),E(this,Tr,t),E(this,Ft,r),e.addController(this)}fetch(){if(this.isLoading)return;f(this,li)?.abort();let e=new AbortController;E(this,li,e),this.isLoading=!0,this.data=void 0,f(this,ai).requestUpdate(),(async()=>{let t=$(this,Xn,Fc).call(this);return t.signal?.addEventListener("abort",()=>e.abort(),{signal:e.signal}),fetch(t,{signal:e.signal})})().then(async t=>{if(!t.ok)throw new Error(`${t.statusText}: ${await t.text()}`);this.isLoading=!1,this.data=typeof f(this,Ft)?.transform=="function"?await f(this,Ft).transform(t):t,f(this,ai).requestUpdate()}).catch(t=>{f(this,Ft)?.onError?.(t),this.isLoading=!1,this.data=void 0,f(this,ai).requestUpdate()}).finally(()=>{e.abort()})}hostConnected(){this.isLoading||f(this,Ft)?.fetchWhenConnected&&this.fetch()}hostDisconnected(){f(this,li)?.abort(),E(this,li,void 0)}};ai=new WeakMap,Tr=new WeakMap,Ft=new WeakMap,li=new WeakMap,Xn=new WeakSet,Fc=function(){let e=f(this,Tr);if(typeof e=="function"&&(e=e()),!e)throw new Error("missing request");return new Request(e)};var dt,Pr,ji,qi,Mt=class{constructor(e,t){y(this,dt);y(this,Pr);y(this,ji);y(this,qi);E(this,dt,e),E(this,Pr,t),e.addController(this)}get data(){return f(this,qi)||f(this,ji)?.data}hostConnected(){if(f(this,ji)||f(this,qi))return;let e=Ac();e&&e.widgetId===f(this,dt).widgetId?E(this,qi,e.config):E(this,ji,new Jn(f(this,dt),()=>{if(f(this,dt).cdn&&f(this,dt).widgetId)return`${f(this,dt).cdn}/config?w=${f(this,dt).widgetId}`;throw new Error("missing cdn or widgetId")},{fetchWhenConnected:!0,transform:t=>t.json(),onError:f(this,Pr)?.onError}))}};dt=new WeakMap,Pr=new WeakMap,ji=new WeakMap,qi=new WeakMap;function Mc(i,e){var t=Object.keys(i);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(i);e&&(r=r.filter(function(n){return Object.getOwnPropertyDescriptor(i,n).enumerable})),t.push.apply(t,r)}return t}function b(i){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Mc(Object(t),!0).forEach(function(r){C(i,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(t)):Mc(Object(t)).forEach(function(r){Object.defineProperty(i,r,Object.getOwnPropertyDescriptor(t,r))})}return i}function C(i,e,t){return e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function Rd(i,e){if(i==null)return{};var t,r,n=function(o,l){if(o==null)return{};var a,c,d={},u=Object.keys(o);for(c=0;c<u.length;c++)a=u[c],l.indexOf(a)>=0||(d[a]=o[a]);return d}(i,e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(i);for(r=0;r<s.length;r++)t=s[r],e.indexOf(t)>=0||Object.prototype.propertyIsEnumerable.call(i,t)&&(n[t]=i[t])}return n}var lt,Nt={DEBUG:!1,LIB_VERSION:"1.195.0"},v=typeof window<"u"?window:void 0,He=typeof globalThis<"u"?globalThis:v,Od=Array.prototype,Dc=Od.forEach,Lc=Od.indexOf,Xe=He?.navigator,O=He?.document,Be=He?.location,ca=He?.fetch,da=He!=null&&He.XMLHttpRequest&&"withCredentials"in new He.XMLHttpRequest?He.XMLHttpRequest:void 0,Nc=He?.AbortController,ke=Xe?.userAgent,j=v??{},Qo="$copy_autocapture",ff=["$snapshot","$pageview","$pageleave","$set","survey dismissed","survey sent","survey shown","$identify","$groupidentify","$create_alias","$$client_ingestion_warning","$web_experiment_applied","$feature_enrollment_update","$feature_flag_called"];(function(i){i.GZipJS="gzip-js",i.Base64="base64"})(lt||(lt={}));var gf=Array.isArray,Fd=Object.prototype,Md=Fd.hasOwnProperty,As=Fd.toString,ce=gf||function(i){return As.call(i)==="[object Array]"},Qe=i=>typeof i=="function",fe=i=>i===Object(i)&&!ce(i),Hi=i=>{if(fe(i)){for(var e in i)if(Md.call(i,e))return!1;return!0}return!1},F=i=>i===void 0,Ce=i=>As.call(i)=="[object String]",Uc=i=>Ce(i)&&i.trim().length===0,zt=i=>i===null,ee=i=>F(i)||zt(i),Je=i=>As.call(i)=="[object Number]",fi=i=>As.call(i)==="[object Boolean]",vf=i=>i instanceof FormData,mf=i=>W(ff,i),Dd=i=>{var e={_log:function(t){if(v&&(Nt.DEBUG||j.POSTHOG_DEBUG)&&!F(v.console)&&v.console){for(var r=("__rrweb_original__"in v.console[t])?v.console[t].__rrweb_original__:v.console[t],n=arguments.length,s=new Array(n>1?n-1:0),o=1;o<n;o++)s[o-1]=arguments[o];r(i,...s)}},info:function(){for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];e._log("log",...r)},warn:function(){for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];e._log("warn",...r)},error:function(){for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];e._log("error",...r)},critical:function(){for(var t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];console.error(i,...r)},uninitializedWarning:t=>{e.error("You must initialize PostHog before calling ".concat(t))},createLogger:t=>Dd("".concat(i," ").concat(t))};return e},D=Dd("[PostHog.js]"),ze=D.createLogger,cs={},Ts=function(i){return i.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"")};function Vi(i,e,t){if(ce(i)){if(Dc&&i.forEach===Dc)i.forEach(e,t);else if("length"in i&&i.length===+i.length){for(var r=0,n=i.length;r<n;r++)if(r in i&&e.call(t,i[r],r)===cs)return}}}function K(i,e,t){if(!ee(i)){if(ce(i))return Vi(i,e,t);if(vf(i)){for(var r of i.entries())if(e.call(t,r[1],r[0])===cs)return}else for(var n in i)if(Md.call(i,n)&&e.call(t,i[n],n)===cs)return}}var De=function(i){for(var e=arguments.length,t=new Array(e>1?e-1:0),r=1;r<e;r++)t[r-1]=arguments[r];return Vi(t,function(n){for(var s in n)n[s]!==void 0&&(i[s]=n[s])}),i};function W(i,e){return i.indexOf(e)!==-1}function as(i){for(var e=Object.keys(i),t=e.length,r=new Array(t);t--;)r[t]=[e[t],i[e[t]]];return r}var jc=function(i){try{return i()}catch{return}},_f=function(i){return function(){try{for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return i.apply(this,t)}catch(n){D.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),D.critical(n)}}},ds=function(i){var e={};return K(i,function(t,r){Ce(t)&&t.length>0&&(e[r]=t)}),e},pa=function(i){return i.replace(/^\$/,"")};function yf(i,e){return t=i,r=s=>Ce(s)&&!zt(e)?s.slice(0,e):s,n=new Set,function s(o,l){return o!==Object(o)?r?r(o,l):o:n.has(o)?void 0:(n.add(o),ce(o)?(a=[],Vi(o,c=>{a.push(s(c))})):(a={},K(o,(c,d)=>{n.has(c)||(a[d]=s(c,d))})),a);var a}(t);var t,r,n}var bf=function(i){var e,t,r,n,s="";for(e=t=0,r=(i=(i+"").replace(/\r\n/g,`
398
398
  `).replace(/\r/g,`
399
399
  `)).length,n=0;n<r;n++){var o=i.charCodeAt(n),l=null;o<128?t++:l=o>127&&o<2048?String.fromCharCode(o>>6|192,63&o|128):String.fromCharCode(o>>12|224,o>>6&63|128,63&o|128),zt(l)||(t>e&&(s+=i.substring(e,t)),s+=l,e=t=n+1)}return t>e&&(s+=i.substring(e,i.length)),s},Ct=function(){function i(e){return e&&(e.preventDefault=i.preventDefault,e.stopPropagation=i.stopPropagation),e}return i.preventDefault=function(){this.returnValue=!1},i.stopPropagation=function(){this.cancelBubble=!0},function(e,t,r,n,s){if(e)if(e.addEventListener&&!n)e.addEventListener(t,r,!!s);else{var o="on"+t,l=e[o];e[o]=function(a,c,d){return function(u){if(u=u||i(v?.event)){var p,h=!0;Qe(d)&&(p=d(u));var g=c.call(a,u);return p!==!1&&g!==!1||(h=!1),h}}}(e,r,l)}else D.error("No valid element provided to register_event")}}();function Ld(i,e){for(var t=0;t<i.length;t++)if(e(i[t]))return i[t]}var Nd="$people_distinct_id",Dr="__alias",Lr="__timers",qc="$autocapture_disabled_server_side",ha="$heatmaps_enabled_server_side",Bc="$exception_capture_enabled_server_side",Hc="$web_vitals_enabled_server_side",Ud="$dead_clicks_enabled_server_side",zc="$web_vitals_allowed_metrics",fa="$session_recording_enabled_server_side",Wc="$console_log_recording_enabled_server_side",Vc="$session_recording_network_payload_capture",Gc="$session_recording_canvas_recording",Jc="$replay_sample_rate",Xc="$replay_minimum_duration",Yc="$replay_script_config",ps="$sesid",Nr="$session_is_sampled",ea="$session_recording_url_trigger_activated_session",ta="$session_recording_event_trigger_activated_session",zi="$enabled_feature_flags",ga="$early_access_features",Wi="$stored_person_properties",Ut="$stored_group_properties",va="$surveys",Yn="$surveys_activated",hs="$flag_call_reported",kt="$user_state",ma="$client_session_props",_a="$capture_rate_limit",ya="$initial_campaign_params",ba="$initial_referrer_info",wa="$initial_person_info",fs="$epp",jd="__POSTHOG_TOOLBAR__",wf=[Nd,Dr,"__cmpns",Lr,fa,ha,ps,zi,kt,ga,Ut,Wi,va,hs,ma,_a,ya,ba,fs],Kn=ze("[FeatureFlags]"),ia="$active_feature_flags",Zn="$override_feature_flags",Kc="$feature_flag_payloads",Zc=i=>{var e={};for(var[t,r]of as(i||{}))r&&(e[t]=r);return e},xa=class{constructor(e){this.instance=e,this._override_warning=!1,this.featureFlagEventHandlers=[],this.reloadFeatureFlagsQueued=!1,this.reloadFeatureFlagsInAction=!1}getFlags(){return Object.keys(this.getFlagVariants())}getFlagVariants(){var e=this.instance.get_property(zi),t=this.instance.get_property(Zn);if(!t)return e||{};for(var r=De({},e),n=Object.keys(t),s=0;s<n.length;s++)r[n[s]]=t[n[s]];return this._override_warning||(Kn.warn(" Overriding feature flags!",{enabledFlags:e,overriddenFlags:t,finalFlags:r}),this._override_warning=!0),r}getFlagPayloads(){return this.instance.get_property(Kc)||{}}reloadFeatureFlags(){this.reloadFeatureFlagsQueued||(this.reloadFeatureFlagsQueued=!0,this._startReloadTimer())}setAnonymousDistinctId(e){this.$anon_distinct_id=e}setReloadingPaused(e){this.reloadFeatureFlagsInAction=e}resetRequestQueue(){this.reloadFeatureFlagsQueued=!1}_startReloadTimer(){this.reloadFeatureFlagsQueued&&!this.reloadFeatureFlagsInAction&&setTimeout(()=>{!this.reloadFeatureFlagsInAction&&this.reloadFeatureFlagsQueued&&(this.reloadFeatureFlagsQueued=!1,this._reloadFeatureFlagsRequest())},5)}_reloadFeatureFlagsRequest(){if(!this.instance.config.advanced_disable_feature_flags){this.setReloadingPaused(!0);var e=this.instance.config.token,t=this.instance.get_property(Wi),r=this.instance.get_property(Ut),n={token:e,distinct_id:this.instance.get_distinct_id(),groups:this.instance.getGroups(),$anon_distinct_id:this.$anon_distinct_id,person_properties:t,group_properties:r,disable_flags:this.instance.config.advanced_disable_feature_flags||void 0};this.instance._send_request({method:"POST",url:this.instance.requestRouter.endpointFor("api","/decide/?v=3"),data:n,compression:this.instance.config.disable_compression?void 0:lt.Base64,timeout:this.instance.config.feature_flag_request_timeout_ms,callback:s=>{var o;this.setReloadingPaused(!1);var l=!0;s.statusCode===200&&(this.$anon_distinct_id=void 0,l=!1),this.receivedFeatureFlags((o=s.json)!==null&&o!==void 0?o:{},l),this._startReloadTimer()}})}}getFeatureFlag(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(this.instance.decideEndpointWasHit||this.getFlags()&&this.getFlags().length>0){var r,n=this.getFlagVariants()[e],s="".concat(n),o=this.instance.get_property(hs)||{};return(t.send_event||!("send_event"in t))&&(!(e in o)||!o[e].includes(s))&&(ce(o[e])?o[e].push(s):o[e]=[s],(r=this.instance.persistence)===null||r===void 0||r.register({[hs]:o}),this.instance.capture("$feature_flag_called",{$feature_flag:e,$feature_flag_response:n})),n}Kn.warn('getFeatureFlag for key "'+e+`" failed. Feature flags didn't load in time.`)}getFeatureFlagPayload(e){return this.getFlagPayloads()[e]}isFeatureEnabled(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(this.instance.decideEndpointWasHit||this.getFlags()&&this.getFlags().length>0)return!!this.getFeatureFlag(e,t);Kn.warn('isFeatureEnabled for key "'+e+`" failed. Feature flags didn't load in time.`)}addFeatureFlagsHandler(e){this.featureFlagEventHandlers.push(e)}removeFeatureFlagsHandler(e){this.featureFlagEventHandlers=this.featureFlagEventHandlers.filter(t=>t!==e)}receivedFeatureFlags(e,t){if(this.instance.persistence){this.instance.decideEndpointWasHit=!0;var r=this.getFlagVariants(),n=this.getFlagPayloads();(function(s,o){var l=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{},c=s.featureFlags,d=s.featureFlagPayloads;if(c)if(ce(c)){var u={};if(c)for(var p=0;p<c.length;p++)u[c[p]]=!0;o&&o.register({[ia]:c,[zi]:u})}else{var h=c,g=d;s.errorsWhileComputingFlags&&(h=b(b({},l),h),g=b(b({},a),g)),o&&o.register({[ia]:Object.keys(Zc(h)),[zi]:h||{},[Kc]:g||{}})}})(e,this.instance.persistence,r,n),this._fireFeatureFlagsCallbacks(t)}}override(e){var t=arguments.length>1&&arguments[1]!==void 0&&arguments[1];if(!this.instance.__loaded||!this.instance.persistence)return Kn.uninitializedWarning("posthog.feature_flags.override");if(this._override_warning=t,e===!1)this.instance.persistence.unregister(Zn);else if(ce(e)){for(var r={},n=0;n<e.length;n++)r[e[n]]=!0;this.instance.persistence.register({[Zn]:r})}else this.instance.persistence.register({[Zn]:e})}onFeatureFlags(e){if(this.addFeatureFlagsHandler(e),this.instance.decideEndpointWasHit){var{flags:t,flagVariants:r}=this._prepareFeatureFlagsForCallbacks();e(t,r)}return()=>this.removeFeatureFlagsHandler(e)}updateEarlyAccessFeatureEnrollment(e,t){var r,n={["$feature_enrollment/".concat(e)]:t};this.instance.capture("$feature_enrollment_update",{$feature_flag:e,$feature_enrollment:t,$set:n}),this.setPersonPropertiesForFlags(n,!1);var s=b(b({},this.getFlagVariants()),{},{[e]:t});(r=this.instance.persistence)===null||r===void 0||r.register({[ia]:Object.keys(Zc(s)),[zi]:s}),this._fireFeatureFlagsCallbacks()}getEarlyAccessFeatures(e){var t=arguments.length>1&&arguments[1]!==void 0&&arguments[1],r=this.instance.get_property(ga);if(r&&!t)return e(r);this.instance._send_request({transport:"XHR",url:this.instance.requestRouter.endpointFor("api","/api/early_access_features/?token=".concat(this.instance.config.token)),method:"GET",callback:n=>{var s;if(n.json){var o=n.json.earlyAccessFeatures;return(s=this.instance.persistence)===null||s===void 0||s.register({[ga]:o}),e(o)}}})}_prepareFeatureFlagsForCallbacks(){var e=this.getFlags(),t=this.getFlagVariants();return{flags:e.filter(r=>t[r]),flagVariants:Object.keys(t).filter(r=>t[r]).reduce((r,n)=>(r[n]=t[n],r),{})}}_fireFeatureFlagsCallbacks(e){var{flags:t,flagVariants:r}=this._prepareFeatureFlagsForCallbacks();this.featureFlagEventHandlers.forEach(n=>n(t,r,{errorsLoading:e}))}setPersonPropertiesForFlags(e){var t=!(arguments.length>1&&arguments[1]!==void 0)||arguments[1],r=this.instance.get_property(Wi)||{};this.instance.register({[Wi]:b(b({},r),e)}),t&&this.instance.reloadFeatureFlags()}resetPersonPropertiesForFlags(){this.instance.unregister(Wi)}setGroupPropertiesForFlags(e){var t=!(arguments.length>1&&arguments[1]!==void 0)||arguments[1],r=this.instance.get_property(Ut)||{};Object.keys(r).length!==0&&Object.keys(r).forEach(n=>{r[n]=b(b({},r[n]),e[n]),delete e[n]}),this.instance.register({[Ut]:b(b({},r),e)}),t&&this.instance.reloadFeatureFlags()}resetGroupPropertiesForFlags(e){if(e){var t=this.instance.get_property(Ut)||{};this.instance.register({[Ut]:b(b({},t),{},{[e]:{}})})}else this.instance.unregister(Ut)}};Math.trunc||(Math.trunc=function(i){return i<0?Math.ceil(i):Math.floor(i)}),Number.isInteger||(Number.isInteger=function(i){return Je(i)&&isFinite(i)&&Math.floor(i)===i});var Qc="0123456789abcdef",ka=class i{constructor(e){if(this.bytes=e,e.length!==16)throw new TypeError("not 128-bit length")}static fromFieldsV7(e,t,r,n){if(!Number.isInteger(e)||!Number.isInteger(t)||!Number.isInteger(r)||!Number.isInteger(n)||e<0||t<0||r<0||n<0||e>0xffffffffffff||t>4095||r>1073741823||n>4294967295)throw new RangeError("invalid field value");var s=new Uint8Array(16);return s[0]=e/Math.pow(2,40),s[1]=e/Math.pow(2,32),s[2]=e/Math.pow(2,24),s[3]=e/Math.pow(2,16),s[4]=e/Math.pow(2,8),s[5]=e,s[6]=112|t>>>8,s[7]=t,s[8]=128|r>>>24,s[9]=r>>>16,s[10]=r>>>8,s[11]=r,s[12]=n>>>24,s[13]=n>>>16,s[14]=n>>>8,s[15]=n,new i(s)}toString(){for(var e="",t=0;t<this.bytes.length;t++)e=e+Qc.charAt(this.bytes[t]>>>4)+Qc.charAt(15&this.bytes[t]),t!==3&&t!==5&&t!==7&&t!==9||(e+="-");if(e.length!==36)throw new Error("Invalid UUIDv7 was generated");return e}clone(){return new i(this.bytes.slice(0))}equals(e){return this.compareTo(e)===0}compareTo(e){for(var t=0;t<16;t++){var r=this.bytes[t]-e.bytes[t];if(r!==0)return Math.sign(r)}return 0}},Sa=class{constructor(){C(this,"timestamp",0),C(this,"counter",0),C(this,"random",new Ea)}generate(){var e=this.generateOrAbort();if(F(e)){this.timestamp=0;var t=this.generateOrAbort();if(F(t))throw new Error("Could not generate UUID after timestamp reset");return t}return e}generateOrAbort(){var e=Date.now();if(e>this.timestamp)this.timestamp=e,this.resetCounter();else{if(!(e+1e4>this.timestamp))return;this.counter++,this.counter>4398046511103&&(this.timestamp++,this.resetCounter())}return ka.fromFieldsV7(this.timestamp,Math.trunc(this.counter/Math.pow(2,30)),this.counter&Math.pow(2,30)-1,this.random.nextUint32())}resetCounter(){this.counter=1024*this.random.nextUint32()+(1023&this.random.nextUint32())}},ed,qd=i=>{if(typeof UUIDV7_DENY_WEAK_RNG<"u"&&UUIDV7_DENY_WEAK_RNG)throw new Error("no cryptographically strong RNG available");for(var e=0;e<i.length;e++)i[e]=65536*Math.trunc(65536*Math.random())+Math.trunc(65536*Math.random());return i};v&&!F(v.crypto)&&crypto.getRandomValues&&(qd=i=>crypto.getRandomValues(i));var Ea=class{constructor(){C(this,"buffer",new Uint32Array(8)),C(this,"cursor",1/0)}nextUint32(){return this.cursor>=this.buffer.length&&(qd(this.buffer),this.cursor=0),this.buffer[this.cursor++]}},qt=()=>xf().toString(),xf=()=>(ed||(ed=new Sa)).generate(),kf="Thu, 01 Jan 1970 00:00:00 GMT",Rr="",Sf=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i;function Ef(i,e){if(e){var t=function(n){var s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:O;if(Rr)return Rr;if(!s||["localhost","127.0.0.1"].includes(n))return"";for(var o=n.split("."),l=Math.min(o.length,8),a="dmn_chk_"+qt(),c=new RegExp("(^|;)\\s*"+a+"=1");!Rr&&l--;){var d=o.slice(l).join("."),u=a+"=1;domain=."+d;s.cookie=u,c.test(s.cookie)&&(s.cookie=u+";expires="+kf,Rr=d)}return Rr}(i);if(!t){var r=(n=>{var s=n.match(Sf);return s?s[0]:""})(i);r!==t&&D.info("Warning: cookie subdomain discovery mismatch",r,t),t=r}return t?"; domain=."+t:""}return""}var $t={is_supported:()=>!!O,error:function(i){D.error("cookieStore error: "+i)},get:function(i){if(O){try{for(var e=i+"=",t=O.cookie.split(";").filter(s=>s.length),r=0;r<t.length;r++){for(var n=t[r];n.charAt(0)==" ";)n=n.substring(1,n.length);if(n.indexOf(e)===0)return decodeURIComponent(n.substring(e.length,n.length))}}catch{}return null}},parse:function(i){var e;try{e=JSON.parse($t.get(i))||{}}catch{}return e},set:function(i,e,t,r,n){if(O)try{var s="",o="",l=Ef(O.location.hostname,r);if(t){var a=new Date;a.setTime(a.getTime()+24*t*60*60*1e3),s="; expires="+a.toUTCString()}n&&(o="; secure");var c=i+"="+encodeURIComponent(JSON.stringify(e))+s+"; SameSite=Lax; path=/"+l+o;return c.length>3686.4&&D.warn("cookieStore warning: large cookie, len="+c.length),O.cookie=c,c}catch{return}},remove:function(i,e){try{$t.set(i,"",-1,e)}catch{return}}},ra=null,me={is_supported:function(){if(!zt(ra))return ra;var i=!0;if(F(v))i=!1;else try{var e="__mplssupport__";me.set(e,"xyz"),me.get(e)!=='"xyz"'&&(i=!1),me.remove(e)}catch{i=!1}return i||D.error("localStorage unsupported; falling back to cookie store"),ra=i,i},error:function(i){D.error("localStorage error: "+i)},get:function(i){try{return v?.localStorage.getItem(i)}catch(e){me.error(e)}return null},parse:function(i){try{return JSON.parse(me.get(i))||{}}catch{}return null},set:function(i,e){try{v?.localStorage.setItem(i,JSON.stringify(e))}catch(t){me.error(t)}},remove:function(i){try{v?.localStorage.removeItem(i)}catch(e){me.error(e)}}},Cf=["distinct_id",ps,Nr,fs,wa],Qn=b(b({},me),{},{parse:function(i){try{var e={};try{e=$t.parse(i)||{}}catch{}var t=De(e,JSON.parse(me.get(i)||"{}"));return me.set(i,t),t}catch{}return null},set:function(i,e,t,r,n,s){try{me.set(i,e,void 0,void 0,s);var o={};Cf.forEach(l=>{e[l]&&(o[l]=e[l])}),Object.keys(o).length&&$t.set(i,o,t,r,n,s)}catch(l){me.error(l)}},remove:function(i,e){try{v?.localStorage.removeItem(i),$t.remove(i,e)}catch(t){me.error(t)}}}),es={},$f={is_supported:function(){return!0},error:function(i){D.error("memoryStorage error: "+i)},get:function(i){return es[i]||null},parse:function(i){return es[i]||null},set:function(i,e){es[i]=e},remove:function(i){delete es[i]}},ui=null,Ee={is_supported:function(){if(!zt(ui))return ui;if(ui=!0,F(v))ui=!1;else try{var i="__support__";Ee.set(i,"xyz"),Ee.get(i)!=='"xyz"'&&(ui=!1),Ee.remove(i)}catch{ui=!1}return ui},error:function(i){D.error("sessionStorage error: ",i)},get:function(i){try{return v?.sessionStorage.getItem(i)}catch(e){Ee.error(e)}return null},parse:function(i){try{return JSON.parse(Ee.get(i))||null}catch{}return null},set:function(i,e){try{v?.sessionStorage.setItem(i,JSON.stringify(e))}catch(t){Ee.error(t)}},remove:function(i){try{v?.sessionStorage.removeItem(i)}catch(e){Ee.error(e)}}},If=["localhost","127.0.0.1"],Gi=i=>{var e=O?.createElement("a");return F(e)?null:(e.href=i,e)},Yi=function(i,e){return!!function(t){try{new RegExp(t)}catch{return!1}return!0}(e)&&new RegExp(e).test(i)},Af=function(i){var e,t,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"&",n=[];return K(i,function(s,o){F(s)||F(o)||o==="undefined"||(e=encodeURIComponent((l=>l instanceof File)(s)?s.name:s.toString()),t=encodeURIComponent(o),n[n.length]=t+"="+e)}),n.join(r)},gs=function(i,e){for(var t,r=((i.split("#")[0]||"").split("?")[1]||"").split("&"),n=0;n<r.length;n++){var s=r[n].split("=");if(s[0]===e){t=s;break}}if(!ce(t)||t.length<2)return"";var o=t[1];try{o=decodeURIComponent(o)}catch{D.error("Skipping decoding for malformed query param: "+o)}return o.replace(/\+/g," ")},vs=function(i,e){var t=i.match(new RegExp(e+"=([^&]*)"));return t?t[1]:null},et="Mobile",ms="iOS",pt="Android",zr="Tablet",Bd=pt+" "+zr,Hd="iPad",zd="Apple",Wd=zd+" Watch",Wr="Safari",Ki="BlackBerry",Vd="Samsung",Gd=Vd+"Browser",Jd=Vd+" Internet",vi="Chrome",Tf=vi+" OS",Xd=vi+" "+ms,gl="Internet Explorer",Yd=gl+" "+et,vl="Opera",Pf=vl+" Mini",ml="Edge",Kd="Microsoft "+ml,Ji="Firefox",Zd=Ji+" "+ms,Vr="Nintendo",Gr="PlayStation",Xi="Xbox",Qd=pt+" "+et,ep=et+" "+Wr,Ur="Windows",Ca=Ur+" Phone",td="Nokia",$a="Ouya",tp="Generic",Rf=tp+" "+et.toLowerCase(),ip=tp+" "+zr.toLowerCase(),Ia="Konqueror",Me="(\\d+(\\.\\d+)?)",na=new RegExp("Version/"+Me),Of=new RegExp(Xi,"i"),Ff=new RegExp(Gr+" \\w+","i"),Mf=new RegExp(Vr+" \\w+","i"),_l=new RegExp(Ki+"|PlayBook|BB10","i"),Df={"NT3.51":"NT 3.11","NT4.0":"NT 4.0","5.0":"2000",5.1:"XP",5.2:"XP","6.0":"Vista",6.1:"7",6.2:"8",6.3:"8.1",6.4:"10","10.0":"10"},Lf=(i,e)=>e&&W(e,zd)||function(t){return W(t,Wr)&&!W(t,vi)&&!W(t,pt)}(i),id=function(i,e){return e=e||"",W(i," OPR/")&&W(i,"Mini")?Pf:W(i," OPR/")?vl:_l.test(i)?Ki:W(i,"IE"+et)||W(i,"WPDesktop")?Yd:W(i,Gd)?Jd:W(i,ml)||W(i,"Edg/")?Kd:W(i,"FBIOS")?"Facebook "+et:W(i,"UCWEB")||W(i,"UCBrowser")?"UC Browser":W(i,"CriOS")?Xd:W(i,"CrMo")||W(i,vi)?vi:W(i,pt)&&W(i,Wr)?Qd:W(i,"FxiOS")?Zd:W(i.toLowerCase(),Ia.toLowerCase())?Ia:Lf(i,e)?W(i,et)?ep:Wr:W(i,Ji)?Ji:W(i,"MSIE")||W(i,"Trident/")?gl:W(i,"Gecko")?Ji:""},Nf={[Yd]:[new RegExp("rv:"+Me)],[Kd]:[new RegExp(ml+"?\\/"+Me)],[vi]:[new RegExp("("+vi+"|CrMo)\\/"+Me)],[Xd]:[new RegExp("CriOS\\/"+Me)],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/"+Me)],[Wr]:[na],[ep]:[na],[vl]:[new RegExp("(Opera|OPR)\\/"+Me)],[Ji]:[new RegExp(Ji+"\\/"+Me)],[Zd]:[new RegExp("FxiOS\\/"+Me)],[Ia]:[new RegExp("Konqueror[:/]?"+Me,"i")],[Ki]:[new RegExp(Ki+" "+Me),na],[Qd]:[new RegExp("android\\s"+Me,"i")],[Jd]:[new RegExp(Gd+"\\/"+Me)],[gl]:[new RegExp("(rv:|MSIE )"+Me)],Mozilla:[new RegExp("rv:"+Me)]},rd=[[new RegExp(Xi+"; "+Xi+" (.*?)[);]","i"),i=>[Xi,i&&i[1]||""]],[new RegExp(Vr,"i"),[Vr,""]],[new RegExp(Gr,"i"),[Gr,""]],[_l,[Ki,""]],[new RegExp(Ur,"i"),(i,e)=>{if(/Phone/.test(e)||/WPDesktop/.test(e))return[Ca,""];if(new RegExp(et).test(e)&&!/IEMobile\b/.test(e))return[Ur+" "+et,""];var t=/Windows NT ([0-9.]+)/i.exec(e);if(t&&t[1]){var r=t[1],n=Df[r]||"";return/arm/i.test(e)&&(n="RT"),[Ur,n]}return[Ur,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,i=>{if(i&&i[3]){var e=[i[3],i[4],i[5]||"0"];return[ms,e.join(".")]}return[ms,""]}],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,i=>{var e="";return i&&i.length>=3&&(e=F(i[2])?i[3]:i[2]),["watchOS",e]}],[new RegExp("("+pt+" (\\d+)\\.(\\d+)\\.?(\\d+)?|"+pt+")","i"),i=>{if(i&&i[2]){var e=[i[2],i[3],i[4]||"0"];return[pt,e.join(".")]}return[pt,""]}],[/Mac OS X (\d+)[_.](\d+)[_.]?(\d+)?/i,i=>{var e=["Mac OS X",""];if(i&&i[1]){var t=[i[1],i[2],i[3]||"0"];e[1]=t.join(".")}return e}],[/Mac/i,["Mac OS X",""]],[/CrOS/,[Tf,""]],[/Linux|debian/i,["Linux",""]]],nd=function(i){return Mf.test(i)?Vr:Ff.test(i)?Gr:Of.test(i)?Xi:new RegExp($a,"i").test(i)?$a:new RegExp("("+Ca+"|WPDesktop)","i").test(i)?Ca:/iPad/.test(i)?Hd:/iPod/.test(i)?"iPod Touch":/iPhone/.test(i)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(i)?Wd:_l.test(i)?Ki:/(kobo)\s(ereader|touch)/i.test(i)?"Kobo":new RegExp(td,"i").test(i)?td:/(kf[a-z]{2}wi|aeo[c-r]{2})( bui|\))/i.test(i)||/(kf[a-z]+)( bui|\)).+silk\//i.test(i)?"Kindle Fire":/(Android|ZTE)/i.test(i)?!new RegExp(et).test(i)||/(9138B|TB782B|Nexus [97]|pixel c|HUAWEISHT|BTV|noble nook|smart ultra 6)/i.test(i)?/pixel[\daxl ]{1,6}/i.test(i)&&!/pixel c/i.test(i)||/(huaweimed-al00|tah-|APA|SM-G92|i980|zte|U304AA)/i.test(i)||/lmy47v/i.test(i)&&!/QTAQZ3/i.test(i)?pt:Bd:pt:new RegExp("(pda|"+et+")","i").test(i)?Rf:new RegExp(zr,"i").test(i)&&!new RegExp(zr+" pc","i").test(i)?ip:""},ts="https?://(.*)",Uf=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gclid","gad_source","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","mc_cid","igshid","ttclid","rdt_cid"],oe={campaignParams:function(i){return O?this._campaignParamsFromUrl(O.URL,i):{}},_campaignParamsFromUrl:function(i,e){var t=Uf.concat(e||[]),r={};return K(t,function(n){var s=gs(i,n);r[n]=s||null}),r},_searchEngine:function(i){return i?i.search(ts+"google.([^/?]*)")===0?"google":i.search(ts+"bing.com")===0?"bing":i.search(ts+"yahoo.com")===0?"yahoo":i.search(ts+"duckduckgo.com")===0?"duckduckgo":null:null},_searchInfoFromReferrer:function(i){var e=oe._searchEngine(i),t=e!="yahoo"?"q":"p",r={};if(!zt(e)){r.$search_engine=e;var n=O?gs(O.referrer,t):"";n.length&&(r.ph_keyword=n)}return r},searchInfo:function(){var i=O?.referrer;return i?this._searchInfoFromReferrer(i):{}},browser:id,browserVersion:function(i,e){var t=id(i,e),r=Nf[t];if(F(r))return null;for(var n=0;n<r.length;n++){var s=r[n],o=i.match(s);if(o)return parseFloat(o[o.length-2])}return null},browserLanguage:function(){return navigator.language||navigator.userLanguage},browserLanguagePrefix:function(){var i=this.browserLanguage();return typeof i=="string"?i.split("-")[0]:void 0},os:function(i){for(var e=0;e<rd.length;e++){var[t,r]=rd[e],n=t.exec(i),s=n&&(Qe(r)?r(n,i):r);if(s)return s}return["",""]},device:nd,deviceType:function(i){var e=nd(i);return e===Hd||e===Bd||e==="Kobo"||e==="Kindle Fire"||e===ip?zr:e===Vr||e===Xi||e===Gr||e===$a?"Console":e===Wd?"Wearable":e?et:"Desktop"},referrer:function(){return O?.referrer||"$direct"},referringDomain:function(){var i;return O!=null&&O.referrer&&((i=Gi(O.referrer))===null||i===void 0?void 0:i.host)||"$direct"},referrerInfo:function(){return{$referrer:this.referrer(),$referring_domain:this.referringDomain()}},initialPersonInfo:function(){return{r:this.referrer().substring(0,1e3),u:Be?.href.substring(0,1e3)}},initialPersonPropsFromInfo:function(i){var e,{r:t,u:r}=i,n={$initial_referrer:t,$initial_referring_domain:t==null?void 0:t=="$direct"?"$direct":(e=Gi(t))===null||e===void 0?void 0:e.host};if(r){n.$initial_current_url=r;var s=Gi(r);n.$initial_host=s?.host,n.$initial_pathname=s?.pathname,K(this._campaignParamsFromUrl(r),function(o,l){n["$initial_"+pa(l)]=o})}return t&&K(this._searchInfoFromReferrer(t),function(o,l){n["$initial_"+pa(l)]=o}),n},timezone:function(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch{return}},timezoneOffset:function(){try{return new Date().getTimezoneOffset()}catch{return}},properties:function(){if(!ke)return{};var[i,e]=oe.os(ke);return De(ds({$os:i,$os_version:e,$browser:oe.browser(ke,navigator.vendor),$device:oe.device(ke),$device_type:oe.deviceType(ke),$timezone:oe.timezone(),$timezone_offset:oe.timezoneOffset()}),{$current_url:Be?.href,$host:Be?.host,$pathname:Be?.pathname,$raw_user_agent:ke.length>1e3?ke.substring(0,997)+"...":ke,$browser_version:oe.browserVersion(ke,navigator.vendor),$browser_language:oe.browserLanguage(),$browser_language_prefix:oe.browserLanguagePrefix(),$screen_height:v?.screen.height,$screen_width:v?.screen.width,$viewport_height:v?.innerHeight,$viewport_width:v?.innerWidth,$lib:"web",$lib_version:Nt.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3})},people_properties:function(){if(!ke)return{};var[i,e]=oe.os(ke);return De(ds({$os:i,$os_version:e,$browser:oe.browser(ke,navigator.vendor)}),{$browser_version:oe.browserVersion(ke,navigator.vendor)})}},jf=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"],jr=class{constructor(e){this.config=e,this.props={},this.campaign_params_saved=!1,this.name=(t=>{var r="";return t.token&&(r=t.token.replace(/\+/g,"PL").replace(/\//g,"SL").replace(/=/g,"EQ")),t.persistence_name?"ph_"+t.persistence_name:"ph_"+r+"_posthog"})(e),this.storage=this.buildStorage(e),this.load(),e.debug&&D.info("Persistence loaded",e.persistence,b({},this.props)),this.update_config(e,e),this.save()}buildStorage(e){jf.indexOf(e.persistence.toLowerCase())===-1&&(D.critical("Unknown persistence type "+e.persistence+"; falling back to localStorage+cookie"),e.persistence="localStorage+cookie");var t=e.persistence.toLowerCase();return t==="localstorage"&&me.is_supported()?me:t==="localstorage+cookie"&&Qn.is_supported()?Qn:t==="sessionstorage"&&Ee.is_supported()?Ee:t==="memory"?$f:t==="cookie"?$t:Qn.is_supported()?Qn:$t}properties(){var e={};return K(this.props,function(t,r){if(r===zi&&fe(t))for(var n=Object.keys(t),s=0;s<n.length;s++)e["$feature/".concat(n[s])]=t[n[s]];else l=r,a=!1,(zt(o=wf)?a:Lc&&o.indexOf===Lc?o.indexOf(l)!=-1:(K(o,function(c){if(a||(a=c===l))return cs}),a))||(e[r]=t);var o,l,a}),e}load(){if(!this.disabled){var e=this.storage.parse(this.name);e&&(this.props=De({},e))}}save(){this.disabled||this.storage.set(this.name,this.props,this.expire_days,this.cross_subdomain,this.secure,this.config.debug)}remove(){this.storage.remove(this.name,!1),this.storage.remove(this.name,!0)}clear(){this.remove(),this.props={}}register_once(e,t,r){if(fe(e)){F(t)&&(t="None"),this.expire_days=F(r)?this.default_expiry:r;var n=!1;if(K(e,(s,o)=>{this.props.hasOwnProperty(o)&&this.props[o]!==t||(this.props[o]=s,n=!0)}),n)return this.save(),!0}return!1}register(e,t){if(fe(e)){this.expire_days=F(t)?this.default_expiry:t;var r=!1;if(K(e,(n,s)=>{e.hasOwnProperty(s)&&this.props[s]!==n&&(this.props[s]=n,r=!0)}),r)return this.save(),!0}return!1}unregister(e){e in this.props&&(delete this.props[e],this.save())}update_campaign_params(){if(!this.campaign_params_saved){var e=oe.campaignParams(this.config.custom_campaign_params);Hi(ds(e))||this.register(e),this.campaign_params_saved=!0}}update_search_keyword(){this.register(oe.searchInfo())}update_referrer_info(){this.register_once(oe.referrerInfo(),void 0)}set_initial_person_info(){this.props[ya]||this.props[ba]||this.register_once({[wa]:oe.initialPersonInfo()},void 0)}get_referrer_info(){return ds({$referrer:this.props.$referrer,$referring_domain:this.props.$referring_domain})}get_initial_props(){var e={};K([ba,ya],n=>{var s=this.props[n];s&&K(s,function(o,l){e["$initial_"+pa(l)]=o})});var t=this.props[wa];if(t){var r=oe.initialPersonPropsFromInfo(t);De(e,r)}return e}safe_merge(e){return K(this.props,function(t,r){r in e||(e[r]=t)}),e}update_config(e,t){if(this.default_expiry=this.expire_days=e.cookie_expiration,this.set_disabled(e.disable_persistence),this.set_cross_subdomain(e.cross_subdomain_cookie),this.set_secure(e.secure_cookie),e.persistence!==t.persistence){var r=this.buildStorage(e),n=this.props;this.clear(),this.storage=r,this.props=n,this.save()}}set_disabled(e){this.disabled=e,this.disabled?this.remove():this.save()}set_cross_subdomain(e){e!==this.cross_subdomain&&(this.cross_subdomain=e,this.remove(),this.save())}get_cross_subdomain(){return!!this.cross_subdomain}set_secure(e){e!==this.secure&&(this.secure=e,this.remove(),this.save())}set_event_timer(e,t){var r=this.props[Lr]||{};r[e]=t,this.props[Lr]=r,this.save()}remove_event_timer(e){var t=(this.props[Lr]||{})[e];return F(t)||(delete this.props[Lr][e],this.save()),t}get_property(e){return this.props[e]}set_property(e,t){this.props[e]=t,this.save()}};function _s(i){var e,t;return((e=JSON.stringify(i,(t=[],function(r,n){if(fe(n)){for(;t.length>0&&t[t.length-1]!==this;)t.pop();return t.includes(n)?"[Circular]":(t.push(n),n)}return n})))===null||e===void 0?void 0:e.length)||0}function Aa(i){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:66060288e-1;if(i.size>=e&&i.data.length>1){var t=Math.floor(i.data.length/2),r=i.data.slice(0,t),n=i.data.slice(t);return[Aa({size:_s(r),data:r,sessionId:i.sessionId,windowId:i.windowId}),Aa({size:_s(n),data:n,sessionId:i.sessionId,windowId:i.windowId})].flatMap(s=>s)}return[i]}var St=(i=>(i[i.DomContentLoaded=0]="DomContentLoaded",i[i.Load=1]="Load",i[i.FullSnapshot=2]="FullSnapshot",i[i.IncrementalSnapshot=3]="IncrementalSnapshot",i[i.Meta=4]="Meta",i[i.Custom=5]="Custom",i[i.Plugin=6]="Plugin",i))(St||{}),at=(i=>(i[i.Mutation=0]="Mutation",i[i.MouseMove=1]="MouseMove",i[i.MouseInteraction=2]="MouseInteraction",i[i.Scroll=3]="Scroll",i[i.ViewportResize=4]="ViewportResize",i[i.Input=5]="Input",i[i.TouchMove=6]="TouchMove",i[i.MediaInteraction=7]="MediaInteraction",i[i.StyleSheetRule=8]="StyleSheetRule",i[i.CanvasMutation=9]="CanvasMutation",i[i.Font=10]="Font",i[i.Log=11]="Log",i[i.Drag=12]="Drag",i[i.StyleDeclaration=13]="StyleDeclaration",i[i.Selection=14]="Selection",i[i.AdoptedStyleSheet=15]="AdoptedStyleSheet",i[i.CustomElement=16]="CustomElement",i))(at||{});function sd(i){var e;return i.id===jd||!((e=i.closest)===null||e===void 0||!e.call(i,".toolbar-global-fade-container"))}function Ps(i){return!!i&&i.nodeType===1}function Ht(i,e){return!!i&&!!i.tagName&&i.tagName.toLowerCase()===e.toLowerCase()}function rp(i){return!!i&&i.nodeType===3}function np(i){return!!i&&i.nodeType===11}function yl(i){return i?Ts(i).split(/\s+/):[]}function od(i){var e=v?.location.href;return!!(e&&i&&i.some(t=>e.match(t)))}function ys(i){var e="";switch(typeof i.className){case"string":e=i.className;break;case"object":e=(i.className&&"baseVal"in i.className?i.className.baseVal:null)||i.getAttribute("class")||"";break;default:e=""}return yl(e)}function sp(i){return ee(i)?null:Ts(i).split(/(\s+)/).filter(e=>Zi(e)).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function Rs(i){var e="";return Pa(i)&&!lp(i)&&i.childNodes&&i.childNodes.length&&K(i.childNodes,function(t){var r;rp(t)&&t.textContent&&(e+=(r=sp(t.textContent))!==null&&r!==void 0?r:"")}),Ts(e)}function op(i){return F(i.target)?i.srcElement||null:(e=i.target)!==null&&e!==void 0&&e.shadowRoot?i.composedPath()[0]||null:i.target||null;var e}var Ta=["a","button","form","input","select","textarea","label"];function ap(i){var e=i.parentNode;return!(!e||!Ps(e))&&e}function qf(i,e){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:void 0,r=arguments.length>3?arguments[3]:void 0,n=arguments.length>4?arguments[4]:void 0;if(!v||!i||Ht(i,"html")||!Ps(i)||t!=null&&t.url_allowlist&&!od(t.url_allowlist)||t!=null&&t.url_ignorelist&&od(t.url_ignorelist))return!1;if(t!=null&&t.dom_event_allowlist){var s=t.dom_event_allowlist;if(s&&!s.some(h=>e.type===h))return!1}for(var o=!1,l=[i],a=!0,c=i;c.parentNode&&!Ht(c,"body");)if(np(c.parentNode))l.push(c.parentNode.host),c=c.parentNode.host;else{if(!(a=ap(c)))break;if(r||Ta.indexOf(a.tagName.toLowerCase())>-1)o=!0;else{var d=v.getComputedStyle(a);d&&d.getPropertyValue("cursor")==="pointer"&&(o=!0)}l.push(a),c=a}if(!function(h,g){var m=g?.element_allowlist;if(F(m))return!0;var x=function(A){if(m.some(R=>A.tagName.toLowerCase()===R))return{v:!0}};for(var S of h){var _=x(S);if(typeof _=="object")return _.v}return!1}(l,t)||!function(h,g){var m=g?.css_selector_allowlist;if(F(m))return!0;var x=function(A){if(m.some(R=>A.matches(R)))return{v:!0}};for(var S of h){var _=x(S);if(typeof _=="object")return _.v}return!1}(l,t))return!1;var u=v.getComputedStyle(i);if(u&&u.getPropertyValue("cursor")==="pointer"&&e.type==="click")return!0;var p=i.tagName.toLowerCase();switch(p){case"html":return!1;case"form":return(n||["submit"]).indexOf(e.type)>=0;case"input":case"select":case"textarea":return(n||["change","click"]).indexOf(e.type)>=0;default:return o?(n||["click"]).indexOf(e.type)>=0:(n||["click"]).indexOf(e.type)>=0&&(Ta.indexOf(p)>-1||i.getAttribute("contenteditable")==="true")}}function Pa(i){for(var e=i;e.parentNode&&!Ht(e,"body");e=e.parentNode){var t=ys(e);if(W(t,"ph-sensitive")||W(t,"ph-no-capture"))return!1}if(W(ys(i),"ph-include"))return!0;var r=i.type||"";if(Ce(r))switch(r.toLowerCase()){case"hidden":case"password":return!1}var n=i.name||i.id||"";return!(Ce(n)&&/^cc|cardnum|ccnum|creditcard|csc|cvc|cvv|exp|pass|pwd|routing|seccode|securitycode|securitynum|socialsec|socsec|ssn/i.test(n.replace(/[^a-zA-Z0-9]/g,"")))}function lp(i){return!!(Ht(i,"input")&&!["button","checkbox","submit","reset"].includes(i.type)||Ht(i,"select")||Ht(i,"textarea")||i.getAttribute("contenteditable")==="true")}var up="(4[0-9]{12}(?:[0-9]{3})?)|(5[1-5][0-9]{14})|(6(?:011|5[0-9]{2})[0-9]{12})|(3[47][0-9]{13})|(3(?:0[0-5]|[68][0-9])[0-9]{11})|((?:2131|1800|35[0-9]{3})[0-9]{11})",Bf=new RegExp("^(?:".concat(up,")$")),Hf=new RegExp(up),cp="\\d{3}-?\\d{2}-?\\d{4}",zf=new RegExp("^(".concat(cp,")$")),Wf=new RegExp("(".concat(cp,")"));function Zi(i){var e=!(arguments.length>1&&arguments[1]!==void 0)||arguments[1];return!(ee(i)||Ce(i)&&(i=Ts(i),(e?Bf:Hf).test((i||"").replace(/[- ]/g,""))||(e?zf:Wf).test(i)))}function dp(i){var e=Rs(i);return Zi(e="".concat(e," ").concat(pp(i)).trim())?e:""}function pp(i){var e="";return i&&i.childNodes&&i.childNodes.length&&K(i.childNodes,function(t){var r;if(t&&((r=t.tagName)===null||r===void 0?void 0:r.toLowerCase())==="span")try{var n=Rs(t);e="".concat(e," ").concat(n).trim(),t.childNodes&&t.childNodes.length&&(e="".concat(e," ").concat(pp(t)).trim())}catch(s){D.error("[AutoCapture]",s)}}),e}function Vf(i){return function(e){var t=e.map(r=>{var n,s,o="";if(r.tag_name&&(o+=r.tag_name),r.attr_class)for(var l of(r.attr_class.sort(),r.attr_class))o+=".".concat(l.replace(/"/g,""));var a=b(b(b(b({},r.text?{text:r.text}:{}),{},{"nth-child":(n=r.nth_child)!==null&&n!==void 0?n:0,"nth-of-type":(s=r.nth_of_type)!==null&&s!==void 0?s:0},r.href?{href:r.href}:{}),r.attr_id?{attr_id:r.attr_id}:{}),r.attributes),c={};return as(a).sort((d,u)=>{var[p]=d,[h]=u;return p.localeCompare(h)}).forEach(d=>{var[u,p]=d;return c[ad(u.toString())]=ad(p.toString())}),o+=":",o+=as(a).map(d=>{var[u,p]=d;return"".concat(u,'="').concat(p,'"')}).join("")});return t.join(";")}(function(e){return e.map(t=>{var r,n,s={text:(r=t.$el_text)===null||r===void 0?void 0:r.slice(0,400),tag_name:t.tag_name,href:(n=t.attr__href)===null||n===void 0?void 0:n.slice(0,2048),attr_class:Gf(t),attr_id:t.attr__id,nth_child:t.nth_child,nth_of_type:t.nth_of_type,attributes:{}};return as(t).filter(o=>{var[l]=o;return l.indexOf("attr__")===0}).forEach(o=>{var[l,a]=o;return s.attributes[l]=a}),s})}(i))}function ad(i){return i.replace(/"|\\"/g,'\\"')}function Gf(i){var e=i.attr__class;return e?ce(e)?e:yl(e):void 0}var Ra="[SessionRecording]",Oa="redacted",is={initiatorTypes:["audio","beacon","body","css","early-hint","embed","fetch","frame","iframe","icon","image","img","input","link","navigation","object","ping","script","track","video","xmlhttprequest"],maskRequestFn:i=>i,recordHeaders:!1,recordBody:!1,recordInitialRequests:!1,recordPerformance:!1,performanceEntryTypeToObserve:["first-input","navigation","paint","resource"],payloadSizeLimitBytes:1e6,payloadHostDenyList:[".lr-ingest.io",".ingest.sentry.io"]},Jf=["authorization","x-forwarded-for","authorization","cookie","set-cookie","x-api-key","x-real-ip","remote-addr","forwarded","proxy-authorization","x-csrf-token","x-csrftoken","x-xsrf-token"],Xf=["password","secret","passwd","api_key","apikey","auth","credentials","mysql_pwd","privatekey","private_key","token"],Yf=["/s/","/e/","/i/"];function ld(i,e,t,r){if(ee(i))return i;var n=e?.["content-length"]||function(s){return new Blob([s]).size}(i);return Ce(n)&&(n=parseInt(n)),n>t?Ra+" ".concat(r," body too large to record (").concat(n," bytes)"):i}function ud(i,e){if(ee(i))return i;var t=i;return Zi(t,!1)||(t=Ra+" "+e+" body "+Oa),K(Xf,r=>{var n,s;(n=t)!==null&&n!==void 0&&n.length&&((s=t)===null||s===void 0?void 0:s.indexOf(r))!==-1&&(t=Ra+" "+e+" body "+Oa+" as might contain: "+r)}),t}var Kf=(i,e)=>{var t,r,n,s={payloadSizeLimitBytes:is.payloadSizeLimitBytes,performanceEntryTypeToObserve:[...is.performanceEntryTypeToObserve],payloadHostDenyList:[...e.payloadHostDenyList||[],...is.payloadHostDenyList]},o=i.session_recording.recordHeaders!==!1&&e.recordHeaders,l=i.session_recording.recordBody!==!1&&e.recordBody,a=i.capture_performance!==!1&&e.recordPerformance,c=(t=s,n=Math.min(1e6,(r=t.payloadSizeLimitBytes)!==null&&r!==void 0?r:1e6),p=>(p!=null&&p.requestBody&&(p.requestBody=ld(p.requestBody,p.requestHeaders,n,"Request")),p!=null&&p.responseBody&&(p.responseBody=ld(p.responseBody,p.responseHeaders,n,"Response")),p)),d=p=>{return c(((m,x)=>{var S,_=Gi(m.name),A=x.indexOf("http")===0?(S=Gi(x))===null||S===void 0?void 0:S.pathname:x;A==="/"&&(A="");var R=_?.pathname.replace(A||"","");if(!(_&&R&&Yf.some(q=>R.indexOf(q)===0)))return m})((g=(h=p).requestHeaders,ee(g)||K(Object.keys(g??{}),m=>{Jf.includes(m.toLowerCase())&&(g[m]=Oa)}),h),i.api_host));var h,g},u=Qe(i.session_recording.maskNetworkRequestFn);return u&&Qe(i.session_recording.maskCapturedNetworkRequestFn)&&D.warn("Both `maskNetworkRequestFn` and `maskCapturedNetworkRequestFn` are defined. `maskNetworkRequestFn` will be ignored."),u&&(i.session_recording.maskCapturedNetworkRequestFn=p=>{var h=i.session_recording.maskNetworkRequestFn({url:p.name});return b(b({},p),{},{name:h?.url})}),s.maskRequestFn=Qe(i.session_recording.maskCapturedNetworkRequestFn)?p=>{var h,g,m,x=d(p);return x&&(h=(g=(m=i.session_recording).maskCapturedNetworkRequestFn)===null||g===void 0?void 0:g.call(m,x))!==null&&h!==void 0?h:void 0}:p=>function(h){if(!F(h))return h.requestBody=ud(h.requestBody,"Request"),h.responseBody=ud(h.responseBody,"Response"),h}(d(p)),b(b(b({},is),s),{},{recordHeaders:o,recordBody:l,recordPerformance:a,recordInitialRequests:a})};function ht(i,e,t,r,n){return e>t&&(D.warn("min cannot be greater than max."),e=t),Je(i)?i>t?(r&&D.warn(r+" cannot be greater than max: "+t+". Using max value instead."),t):i<e?(r&&D.warn(r+" cannot be less than min: "+e+". Using min value instead."),e):i:(r&&D.warn(r+" must be a number. using max or fallback. max: "+t+", fallback: "+n),ht(n||t,e,t,r))}var Fa=class{constructor(e){var t,r,n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};C(this,"bucketSize",100),C(this,"refillRate",10),C(this,"mutationBuckets",{}),C(this,"loggedTracker",{}),C(this,"refillBuckets",()=>{Object.keys(this.mutationBuckets).forEach(s=>{this.mutationBuckets[s]=this.mutationBuckets[s]+this.refillRate,this.mutationBuckets[s]>=this.bucketSize&&delete this.mutationBuckets[s]})}),C(this,"getNodeOrRelevantParent",s=>{var o=this.rrweb.mirror.getNode(s);if(o?.nodeName!=="svg"&&o instanceof Element){var l=o.closest("svg");if(l)return[this.rrweb.mirror.getId(l),l]}return[s,o]}),C(this,"numberOfChanges",s=>{var o,l,a,c,d,u,p,h;return((o=(l=s.removes)===null||l===void 0?void 0:l.length)!==null&&o!==void 0?o:0)+((a=(c=s.attributes)===null||c===void 0?void 0:c.length)!==null&&a!==void 0?a:0)+((d=(u=s.texts)===null||u===void 0?void 0:u.length)!==null&&d!==void 0?d:0)+((p=(h=s.adds)===null||h===void 0?void 0:h.length)!==null&&p!==void 0?p:0)}),C(this,"throttleMutations",s=>{if(s.type!==3||s.data.source!==0)return s;var o=s.data,l=this.numberOfChanges(o);o.attributes&&(o.attributes=o.attributes.filter(c=>{var d,u,p,[h,g]=this.getNodeOrRelevantParent(c.id);return this.mutationBuckets[h]===0?!1:(this.mutationBuckets[h]=(d=this.mutationBuckets[h])!==null&&d!==void 0?d:this.bucketSize,this.mutationBuckets[h]=Math.max(this.mutationBuckets[h]-1,0),this.mutationBuckets[h]===0&&(this.loggedTracker[h]||(this.loggedTracker[h]=!0,(u=(p=this.options).onBlockedNode)===null||u===void 0||u.call(p,h,g))),c)}));var a=this.numberOfChanges(o);return a!==0||l===a?s:void 0}),this.rrweb=e,this.options=n,this.refillRate=ht((t=this.options.refillRate)!==null&&t!==void 0?t:this.refillRate,0,100,"mutation throttling refill rate"),this.bucketSize=ht((r=this.options.bucketSize)!==null&&r!==void 0?r:this.bucketSize,0,100,"mutation throttling bucket size"),setInterval(()=>{this.refillBuckets()},1e3)}},tt=Uint8Array,Le=Uint16Array,Qi=Uint32Array,bl=new tt([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),wl=new tt([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),cd=new tt([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),hp=function(i,e){for(var t=new Le(31),r=0;r<31;++r)t[r]=e+=1<<i[r-1];var n=new Qi(t[30]);for(r=1;r<30;++r)for(var s=t[r];s<t[r+1];++s)n[s]=s-t[r]<<5|r;return[t,n]},fp=hp(bl,2),Zf=fp[0],Ma=fp[1];Zf[28]=258,Ma[258]=28;for(Da=hp(wl,0)[1],bs=new Le(32768),te=0;te<32768;++te)Dt=(43690&te)>>>1|(21845&te)<<1,Dt=(61680&(Dt=(52428&Dt)>>>2|(13107&Dt)<<2))>>>4|(3855&Dt)<<4,bs[te]=((65280&Dt)>>>8|(255&Dt)<<8)>>>1;var Dt,Da,bs,te,qr=function(i,e,t){for(var r=i.length,n=0,s=new Le(e);n<r;++n)++s[i[n]-1];var o,l=new Le(e);for(n=0;n<e;++n)l[n]=l[n-1]+s[n-1]<<1;if(t){o=new Le(1<<e);var a=15-e;for(n=0;n<r;++n)if(i[n])for(var c=n<<4|i[n],d=e-i[n],u=l[i[n]-1]++<<d,p=u|(1<<d)-1;u<=p;++u)o[bs[u]>>>a]=c}else for(o=new Le(r),n=0;n<r;++n)o[n]=bs[l[i[n]-1]++]>>>15-i[n];return o},mi=new tt(288);for(te=0;te<144;++te)mi[te]=8;for(te=144;te<256;++te)mi[te]=9;for(te=256;te<280;++te)mi[te]=7;for(te=280;te<288;++te)mi[te]=8;var ws=new tt(32);for(te=0;te<32;++te)ws[te]=5;var Qf=qr(mi,9,0),eg=qr(ws,5,0),gp=function(i){return(i/8>>0)+(7&i&&1)},vp=function(i,e,t){(t==null||t>i.length)&&(t=i.length);var r=new(i instanceof Le?Le:i instanceof Qi?Qi:tt)(t-e);return r.set(i.subarray(e,t)),r},xt=function(i,e,t){t<<=7&e;var r=e/8>>0;i[r]|=t,i[r+1]|=t>>>8},Or=function(i,e,t){t<<=7&e;var r=e/8>>0;i[r]|=t,i[r+1]|=t>>>8,i[r+2]|=t>>>16},sa=function(i,e){for(var t=[],r=0;r<i.length;++r)i[r]&&t.push({s:r,f:i[r]});var n=t.length,s=t.slice();if(!n)return[new tt(0),0];if(n==1){var o=new tt(t[0].s+1);return o[t[0].s]=1,[o,1]}t.sort(function(q,X){return q.f-X.f}),t.push({s:-1,f:25001});var l=t[0],a=t[1],c=0,d=1,u=2;for(t[0]={s:-1,f:l.f+a.f,l,r:a};d!=n-1;)l=t[t[c].f<t[u].f?c++:u++],a=t[c!=d&&t[c].f<t[u].f?c++:u++],t[d++]={s:-1,f:l.f+a.f,l,r:a};var p=s[0].s;for(r=1;r<n;++r)s[r].s>p&&(p=s[r].s);var h=new Le(p+1),g=La(t[d-1],h,0);if(g>e){r=0;var m=0,x=g-e,S=1<<x;for(s.sort(function(q,X){return h[X.s]-h[q.s]||q.f-X.f});r<n;++r){var _=s[r].s;if(!(h[_]>e))break;m+=S-(1<<g-h[_]),h[_]=e}for(m>>>=x;m>0;){var A=s[r].s;h[A]<e?m-=1<<e-h[A]++-1:++r}for(;r>=0&&m;--r){var R=s[r].s;h[R]==e&&(--h[R],++m)}g=e}return[new tt(h),g]},La=function(i,e,t){return i.s==-1?Math.max(La(i.l,e,t+1),La(i.r,e,t+1)):e[i.s]=t},dd=function(i){for(var e=i.length;e&&!i[--e];);for(var t=new Le(++e),r=0,n=i[0],s=1,o=function(a){t[r++]=a},l=1;l<=e;++l)if(i[l]==n&&l!=e)++s;else{if(!n&&s>2){for(;s>138;s-=138)o(32754);s>2&&(o(s>10?s-11<<5|28690:s-3<<5|12305),s=0)}else if(s>3){for(o(n),--s;s>6;s-=6)o(8304);s>2&&(o(s-3<<5|8208),s=0)}for(;s--;)o(n);s=1,n=i[l]}return[t.subarray(0,r),e]},Fr=function(i,e){for(var t=0,r=0;r<e.length;++r)t+=i[r]*e[r];return t},Na=function(i,e,t){var r=t.length,n=gp(e+2);i[n]=255&r,i[n+1]=r>>>8,i[n+2]=255^i[n],i[n+3]=255^i[n+1];for(var s=0;s<r;++s)i[n+s+4]=t[s];return 8*(n+4+r)},pd=function(i,e,t,r,n,s,o,l,a,c,d){xt(e,d++,t),++n[256];for(var u=sa(n,15),p=u[0],h=u[1],g=sa(s,15),m=g[0],x=g[1],S=dd(p),_=S[0],A=S[1],R=dd(m),q=R[0],X=R[1],z=new Le(19),P=0;P<_.length;++P)z[31&_[P]]++;for(P=0;P<q.length;++P)z[31&q[P]]++;for(var B=sa(z,7),V=B[0],Re=B[1],_e=19;_e>4&&!V[cd[_e-1]];--_e);var Ye,Y,ie,pe,Ue=c+5<<3,We=Fr(n,mi)+Fr(s,ws)+o,le=Fr(n,p)+Fr(s,m)+o+14+3*_e+Fr(z,V)+(2*z[16]+3*z[17]+7*z[18]);if(Ue<=We&&Ue<=le)return Na(e,d,i.subarray(a,a+c));if(xt(e,d,1+(le<We)),d+=2,le<We){Ye=qr(p,h,0),Y=p,ie=qr(m,x,0),pe=m;var $e=qr(V,Re,0);for(xt(e,d,A-257),xt(e,d+5,X-1),xt(e,d+10,_e-4),d+=14,P=0;P<_e;++P)xt(e,d+3*P,V[cd[P]]);d+=3*_e;for(var Ie=[_,q],se=0;se<2;++se){var ye=Ie[se];for(P=0;P<ye.length;++P){var Oe=31&ye[P];xt(e,d,$e[Oe]),d+=V[Oe],Oe>15&&(xt(e,d,ye[P]>>>5&127),d+=ye[P]>>>12)}}}else Ye=Qf,Y=mi,ie=eg,pe=ws;for(P=0;P<l;++P)if(r[P]>255){Oe=r[P]>>>18&31,Or(e,d,Ye[Oe+257]),d+=Y[Oe+257],Oe>7&&(xt(e,d,r[P]>>>23&31),d+=bl[Oe]);var yi=31&r[P];Or(e,d,ie[yi]),d+=pe[yi],yi>3&&(Or(e,d,r[P]>>>5&8191),d+=wl[yi])}else Or(e,d,Ye[r[P]]),d+=Y[r[P]];return Or(e,d,Ye[256]),d+Y[256]},tg=new Qi([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),ig=function(){for(var i=new Qi(256),e=0;e<256;++e){for(var t=e,r=9;--r;)t=(1&t&&3988292384)^t>>>1;i[e]=t}return i}(),rg=function(){var i=4294967295;return{p:function(e){for(var t=i,r=0;r<e.length;++r)t=ig[255&t^e[r]]^t>>>8;i=t},d:function(){return 4294967295^i}}},ng=function(i,e,t,r,n){return function(s,o,l,a,c,d){var u=s.length,p=new tt(a+u+5*(1+Math.floor(u/7e3))+c),h=p.subarray(a,p.length-c),g=0;if(!o||u<8)for(var m=0;m<=u;m+=65535){var x=m+65535;x<u?g=Na(h,g,s.subarray(m,x)):(h[m]=d,g=Na(h,g,s.subarray(m,u)))}else{for(var S=tg[o-1],_=S>>>13,A=8191&S,R=(1<<l)-1,q=new Le(32768),X=new Le(R+1),z=Math.ceil(l/3),P=2*z,B=function(qs){return(s[qs]^s[qs+1]<<z^s[qs+2]<<P)&R},V=new Qi(25e3),Re=new Le(288),_e=new Le(32),Ye=0,Y=0,ie=(m=0,0),pe=0,Ue=0;m<u;++m){var We=B(m),le=32767&m,$e=X[We];if(q[le]=$e,X[We]=le,pe<=m){var Ie=u-m;if((Ye>7e3||ie>24576)&&Ie>423){g=pd(s,h,0,V,Re,_e,Y,ie,Ue,m-Ue,g),ie=Ye=Y=0,Ue=m;for(var se=0;se<286;++se)Re[se]=0;for(se=0;se<30;++se)_e[se]=0}var ye=2,Oe=0,yi=A,It=le-$e&32767;if(Ie>2&&We==B(m-It))for(var Gp=Math.min(_,Ie)-1,Jp=Math.min(32767,m),Xp=Math.min(258,Ie);It<=Jp&&--yi&&le!=$e;){if(s[m+ye]==s[m+ye-It]){for(var At=0;At<Xp&&s[m+At]==s[m+At-It];++At);if(At>ye){if(ye=At,Oe=It,At>Gp)break;var Yp=Math.min(It,At-2),Fl=0;for(se=0;se<Yp;++se){var js=m-It+se+32768&32767,Ml=js-q[js]+32768&32767;Ml>Fl&&(Fl=Ml,$e=js)}}}It+=(le=$e)-($e=q[le])+32768&32767}if(Oe){V[ie++]=268435456|Ma[ye]<<18|Da[Oe];var Dl=31&Ma[ye],Ll=31&Da[Oe];Y+=bl[Dl]+wl[Ll],++Re[257+Dl],++_e[Ll],pe=m+ye,++Ye}else V[ie++]=s[m],++Re[s[m]]}}g=pd(s,h,d,V,Re,_e,Y,ie,Ue,m-Ue,g)}return vp(p,0,a+gp(g)+c)}(i,e.level==null?6:e.level,e.mem==null?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(i.length)))):12+e.mem,t,r,!n)},Ua=function(i,e,t){for(;t;++e)i[e]=t,t>>>=8},sg=function(i,e){var t=e.filename;if(i[0]=31,i[1]=139,i[2]=8,i[8]=e.level<2?4:e.level==9?2:0,i[9]=3,e.mtime!=0&&Ua(i,4,Math.floor(new Date(e.mtime||Date.now())/1e3)),t){i[3]=8;for(var r=0;r<=t.length;++r)i[r+10]=t.charCodeAt(r)}},og=function(i){return 10+(i.filename&&i.filename.length+1||0)};function mp(i,e){e===void 0&&(e={});var t=rg(),r=i.length;t.p(i);var n=ng(i,e,og(e),8),s=n.length;return sg(n,e),Ua(n,s-8,t.d()),Ua(n,s-4,r),n}function _p(i,e){var t=i.length;if(typeof TextEncoder<"u")return new TextEncoder().encode(i);for(var r=new tt(i.length+(i.length>>>1)),n=0,s=function(c){r[n++]=c},o=0;o<t;++o){if(n+5>r.length){var l=new tt(n+8+(t-o<<1));l.set(r),r=l}var a=i.charCodeAt(o);a<128||e?s(a):a<2048?(s(192|a>>>6),s(128|63&a)):a>55295&&a<57344?(s(240|(a=65536+(1047552&a)|1023&i.charCodeAt(++o))>>>18),s(128|a>>>12&63),s(128|a>>>6&63),s(128|63&a)):(s(224|a>>>12),s(128|a>>>6&63),s(128|63&a))}return vp(r,0,n)}var ls="[SessionRecording]",Pe=ze(ls),ag=3e5,lg=[at.MouseMove,at.MouseInteraction,at.Scroll,at.ViewportResize,at.Input,at.TouchMove,at.MediaInteraction,at.Drag],hd=i=>({rrwebMethod:i,enqueuedAt:Date.now(),attempt:1});function ci(i){return function(e,t){for(var r="",n=0;n<e.length;){var s=e[n++];s<128||t?r+=String.fromCharCode(s):s<224?r+=String.fromCharCode((31&s)<<6|63&e[n++]):s<240?r+=String.fromCharCode((15&s)<<12|(63&e[n++])<<6|63&e[n++]):(s=((15&s)<<18|(63&e[n++])<<12|(63&e[n++])<<6|63&e[n++])-65536,r+=String.fromCharCode(55296|s>>10,56320|1023&s))}return r}(mp(_p(JSON.stringify(i))),!0)}function fd(i){return i.type===St.Custom&&i.data.tag==="sessionIdle"}function gd(i,e){return e.some(t=>t.matching==="regex"&&new RegExp(t.url).test(i))}var ja=class{get sessionIdleThresholdMilliseconds(){return this.instance.config.session_recording.session_idle_threshold_ms||3e5}get rrwebRecord(){var e,t;return j==null||(e=j.__PosthogExtensions__)===null||e===void 0||(t=e.rrweb)===null||t===void 0?void 0:t.record}get started(){return this._captureStarted}get sessionManager(){if(!this.instance.sessionManager)throw new Error(ls+" must be started with a valid sessionManager.");return this.instance.sessionManager}get fullSnapshotIntervalMillis(){var e,t;return this.triggerStatus==="trigger_pending"?6e4:(e=(t=this.instance.config.session_recording)===null||t===void 0?void 0:t.full_snapshot_interval_millis)!==null&&e!==void 0?e:ag}get isSampled(){var e=this.instance.get_property(Nr);return fi(e)?e:null}get sessionDuration(){var e,t,r=(e=this.buffer)===null||e===void 0?void 0:e.data[((t=this.buffer)===null||t===void 0?void 0:t.data.length)-1],{sessionStartTimestamp:n}=this.sessionManager.checkAndGetSessionAndWindowId(!0);return r?r.timestamp-n:null}get isRecordingEnabled(){var e=!!this.instance.get_property(fa),t=!this.instance.config.disable_session_recording;return v&&e&&t}get isConsoleLogCaptureEnabled(){var e=!!this.instance.get_property(Wc),t=this.instance.config.enable_recording_console_log;return t??e}get canvasRecording(){var e,t,r,n,s,o,l=this.instance.config.session_recording.captureCanvas,a=this.instance.get_property(Gc),c=(e=(t=l?.recordCanvas)!==null&&t!==void 0?t:a?.enabled)!==null&&e!==void 0&&e,d=(r=(n=l?.canvasFps)!==null&&n!==void 0?n:a?.fps)!==null&&r!==void 0?r:0,u=(s=(o=l?.canvasQuality)!==null&&o!==void 0?o:a?.quality)!==null&&s!==void 0?s:0;return{enabled:c,fps:ht(d,0,12,"canvas recording fps"),quality:ht(u,0,1,"canvas recording quality")}}get networkPayloadCapture(){var e,t,r=this.instance.get_property(Vc),n={recordHeaders:(e=this.instance.config.session_recording)===null||e===void 0?void 0:e.recordHeaders,recordBody:(t=this.instance.config.session_recording)===null||t===void 0?void 0:t.recordBody},s=n?.recordHeaders||r?.recordHeaders,o=n?.recordBody||r?.recordBody,l=fe(this.instance.config.capture_performance)?this.instance.config.capture_performance.network_timing:this.instance.config.capture_performance,a=!!(fi(l)?l:r?.capturePerformance);return s||o||a?{recordHeaders:s,recordBody:o,recordPerformance:a}:void 0}get sampleRate(){var e=this.instance.get_property(Jc);return Je(e)?e:null}get minimumDuration(){var e=this.instance.get_property(Xc);return Je(e)?e:null}get status(){return this.receivedDecide?this.isRecordingEnabled?this._urlBlocked?"paused":ee(this._linkedFlag)||this._linkedFlagSeen?this.triggerStatus==="trigger_pending"?"buffering":fi(this.isSampled)?this.isSampled?"sampled":"disabled":"active":"buffering":"disabled":"buffering"}get urlTriggerStatus(){var e;return this._urlTriggers.length===0?"trigger_disabled":((e=this.instance)===null||e===void 0?void 0:e.get_property(ea))===this.sessionId?"trigger_activated":"trigger_pending"}get eventTriggerStatus(){var e;return this._eventTriggers.length===0?"trigger_disabled":((e=this.instance)===null||e===void 0?void 0:e.get_property(ta))===this.sessionId?"trigger_activated":"trigger_pending"}get triggerStatus(){var e=this.eventTriggerStatus==="trigger_activated"||this.urlTriggerStatus==="trigger_activated",t=this.eventTriggerStatus==="trigger_pending"||this.urlTriggerStatus==="trigger_pending";return e?"trigger_activated":t?"trigger_pending":"trigger_disabled"}constructor(e){if(C(this,"queuedRRWebEvents",[]),C(this,"isIdle",!1),C(this,"_linkedFlagSeen",!1),C(this,"_lastActivityTimestamp",Date.now()),C(this,"_linkedFlag",null),C(this,"_removePageViewCaptureHook",void 0),C(this,"_onSessionIdListener",void 0),C(this,"_persistDecideOnSessionListener",void 0),C(this,"_samplingSessionListener",void 0),C(this,"_urlTriggers",[]),C(this,"_urlBlocklist",[]),C(this,"_urlBlocked",!1),C(this,"_eventTriggers",[]),C(this,"_removeEventTriggerCaptureHook",void 0),C(this,"_forceAllowLocalhostNetworkCapture",!1),C(this,"_onBeforeUnload",()=>{this._flushBuffer()}),C(this,"_onOffline",()=>{this._tryAddCustomEvent("browser offline",{})}),C(this,"_onOnline",()=>{this._tryAddCustomEvent("browser online",{})}),C(this,"_onVisibilityChange",()=>{if(O!=null&&O.visibilityState){var n="window "+O.visibilityState;this._tryAddCustomEvent(n,{})}}),this.instance=e,this._captureStarted=!1,this._endpoint="/s/",this.stopRrweb=void 0,this.receivedDecide=!1,!this.instance.sessionManager)throw Pe.error("started without valid sessionManager"),new Error(ls+" started without valid sessionManager. This is a bug.");var{sessionId:t,windowId:r}=this.sessionManager.checkAndGetSessionAndWindowId();this.sessionId=t,this.windowId=r,this.buffer=this.clearBuffer(),this.sessionIdleThresholdMilliseconds>=this.sessionManager.sessionTimeoutMs&&Pe.warn("session_idle_threshold_ms (".concat(this.sessionIdleThresholdMilliseconds,") is greater than the session timeout (").concat(this.sessionManager.sessionTimeoutMs,"). Session will never be detected as idle"))}startIfEnabledOrStop(e){this.isRecordingEnabled?(this._startCapture(e),v?.addEventListener("beforeunload",this._onBeforeUnload),v?.addEventListener("offline",this._onOffline),v?.addEventListener("online",this._onOnline),v?.addEventListener("visibilitychange",this._onVisibilityChange),this._setupSampling(),this._addEventTriggerListener(),ee(this._removePageViewCaptureHook)&&(this._removePageViewCaptureHook=this.instance.on("eventCaptured",t=>{try{if(t.event==="$pageview"){var r=t!=null&&t.properties.$current_url?this._maskUrl(t?.properties.$current_url):"";if(!r)return;this._tryAddCustomEvent("$pageview",{href:r})}}catch(n){Pe.error("Could not add $pageview to rrweb session",n)}})),this._onSessionIdListener||(this._onSessionIdListener=this.sessionManager.onSessionId((t,r,n)=>{var s,o,l,a;n&&(this._tryAddCustomEvent("$session_id_change",{sessionId:t,windowId:r,changeReason:n}),(s=this.instance)===null||s===void 0||(o=s.persistence)===null||o===void 0||o.unregister(ta),(l=this.instance)===null||l===void 0||(a=l.persistence)===null||a===void 0||a.unregister(ea))}))):this.stopRecording()}stopRecording(){var e,t,r,n;this._captureStarted&&this.stopRrweb&&(this.stopRrweb(),this.stopRrweb=void 0,this._captureStarted=!1,v?.removeEventListener("beforeunload",this._onBeforeUnload),v?.removeEventListener("offline",this._onOffline),v?.removeEventListener("online",this._onOnline),v?.removeEventListener("visibilitychange",this._onVisibilityChange),this.clearBuffer(),clearInterval(this._fullSnapshotTimer),(e=this._removePageViewCaptureHook)===null||e===void 0||e.call(this),this._removePageViewCaptureHook=void 0,(t=this._removeEventTriggerCaptureHook)===null||t===void 0||t.call(this),this._removeEventTriggerCaptureHook=void 0,(r=this._onSessionIdListener)===null||r===void 0||r.call(this),this._onSessionIdListener=void 0,(n=this._samplingSessionListener)===null||n===void 0||n.call(this),this._samplingSessionListener=void 0,Pe.info("stopped"))}makeSamplingDecision(e){var t,r=this.sessionId!==e,n=this.sampleRate;if(Je(n)){var s,o=this.isSampled,l=r||!fi(o);l?s=Math.random()<n:s=o,l&&(s?this._reportStarted("sampled"):Pe.warn("Sample rate (".concat(n,") has determined that this sessionId (").concat(e,") will not be sent to the server.")),this._tryAddCustomEvent("samplingDecisionMade",{sampleRate:n,isSampled:s})),(t=this.instance.persistence)===null||t===void 0||t.register({[Nr]:s})}else{var a;(a=this.instance.persistence)===null||a===void 0||a.register({[Nr]:null})}}onRemoteConfig(e){var t,r,n,s,o,l;if(this._persistRemoteConfig(e),this._linkedFlag=((t=e.sessionRecording)===null||t===void 0?void 0:t.linkedFlag)||null,(r=e.sessionRecording)!==null&&r!==void 0&&r.endpoint&&(this._endpoint=(l=e.sessionRecording)===null||l===void 0?void 0:l.endpoint),this._setupSampling(),!ee(this._linkedFlag)&&!this._linkedFlagSeen){var a=Ce(this._linkedFlag)?this._linkedFlag:this._linkedFlag.flag,c=Ce(this._linkedFlag)?null:this._linkedFlag.variant;this.instance.onFeatureFlags((d,u)=>{var p=fe(u)&&a in u,h=c?u[a]===c:p;h&&this._reportStarted("linked_flag_matched",{linkedFlag:a,linkedVariant:c}),this._linkedFlagSeen=h})}(n=e.sessionRecording)!==null&&n!==void 0&&n.urlTriggers&&(this._urlTriggers=e.sessionRecording.urlTriggers),(s=e.sessionRecording)!==null&&s!==void 0&&s.urlBlocklist&&(this._urlBlocklist=e.sessionRecording.urlBlocklist),(o=e.sessionRecording)!==null&&o!==void 0&&o.eventTriggers&&(this._eventTriggers=e.sessionRecording.eventTriggers),this.receivedDecide=!0,this.startIfEnabledOrStop()}_setupSampling(){Je(this.sampleRate)&&ee(this._samplingSessionListener)&&(this._samplingSessionListener=this.sessionManager.onSessionId(e=>{this.makeSamplingDecision(e)}))}_persistRemoteConfig(e){if(this.instance.persistence){var t,r=this.instance.persistence,n=()=>{var s,o,l,a,c,d,u,p,h=(s=e.sessionRecording)===null||s===void 0?void 0:s.sampleRate,g=ee(h)?null:parseFloat(h),m=(o=e.sessionRecording)===null||o===void 0?void 0:o.minimumDurationMilliseconds;r.register({[fa]:!!e.sessionRecording,[Wc]:(l=e.sessionRecording)===null||l===void 0?void 0:l.consoleLogRecordingEnabled,[Vc]:b({capturePerformance:e.capturePerformance},(a=e.sessionRecording)===null||a===void 0?void 0:a.networkPayloadCapture),[Gc]:{enabled:(c=e.sessionRecording)===null||c===void 0?void 0:c.recordCanvas,fps:(d=e.sessionRecording)===null||d===void 0?void 0:d.canvasFps,quality:(u=e.sessionRecording)===null||u===void 0?void 0:u.canvasQuality},[Jc]:g,[Xc]:F(m)?null:m,[Yc]:(p=e.sessionRecording)===null||p===void 0?void 0:p.scriptConfig})};n(),(t=this._persistDecideOnSessionListener)===null||t===void 0||t.call(this),this._persistDecideOnSessionListener=this.sessionManager.onSessionId(n)}}log(e){var t,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"log";(t=this.instance.sessionRecording)===null||t===void 0||t.onRRwebEmit({type:6,data:{plugin:"rrweb/console@1",payload:{level:r,trace:[],payload:[JSON.stringify(e)]}},timestamp:Date.now()})}_startCapture(e){if(!F(Object.assign)&&!F(Array.from)&&!(this._captureStarted||this.instance.config.disable_session_recording||this.instance.consent.isOptedOut())){var t,r;this._captureStarted=!0,this.sessionManager.checkAndGetSessionAndWindowId(),this.rrwebRecord?this._onScriptLoaded():(t=j.__PosthogExtensions__)===null||t===void 0||(r=t.loadExternalDependency)===null||r===void 0||r.call(t,this.instance,this.scriptName,n=>{if(n)return Pe.error("could not load recorder",n);this._onScriptLoaded()}),Pe.info("starting"),this.status==="active"&&this._reportStarted(e||"recording_initialized")}}get scriptName(){var e,t,r;return((e=this.instance)===null||e===void 0||(t=e.persistence)===null||t===void 0||(r=t.get_property(Yc))===null||r===void 0?void 0:r.script)||"recorder"}isInteractiveEvent(e){var t;return e.type===3&&lg.indexOf((t=e.data)===null||t===void 0?void 0:t.source)!==-1}_updateWindowAndSessionIds(e){var t=this.isInteractiveEvent(e);t||this.isIdle||e.timestamp-this._lastActivityTimestamp>this.sessionIdleThresholdMilliseconds&&(this.isIdle=!0,clearInterval(this._fullSnapshotTimer),this._tryAddCustomEvent("sessionIdle",{eventTimestamp:e.timestamp,lastActivityTimestamp:this._lastActivityTimestamp,threshold:this.sessionIdleThresholdMilliseconds,bufferLength:this.buffer.data.length,bufferSize:this.buffer.size}),this._flushBuffer());var r=!1;if(t&&(this._lastActivityTimestamp=e.timestamp,this.isIdle&&(this.isIdle=!1,this._tryAddCustomEvent("sessionNoLongerIdle",{reason:"user activity",type:e.type}),r=!0)),!this.isIdle){var{windowId:n,sessionId:s}=this.sessionManager.checkAndGetSessionAndWindowId(!t,e.timestamp),o=this.sessionId!==s,l=this.windowId!==n;this.windowId=n,this.sessionId=s,o||l?(this.stopRecording(),this.startIfEnabledOrStop("session_id_changed")):r&&this._scheduleFullSnapshot()}}_tryRRWebMethod(e){try{return e.rrwebMethod(),!0}catch(t){return this.queuedRRWebEvents.length<10?this.queuedRRWebEvents.push({enqueuedAt:e.enqueuedAt||Date.now(),attempt:e.attempt++,rrwebMethod:e.rrwebMethod}):Pe.warn("could not emit queued rrweb event.",t,e),!1}}_tryAddCustomEvent(e,t){return this._tryRRWebMethod(hd(()=>this.rrwebRecord.addCustomEvent(e,t)))}_tryTakeFullSnapshot(){return this._tryRRWebMethod(hd(()=>this.rrwebRecord.takeFullSnapshot()))}_onScriptLoaded(){var e,t={blockClass:"ph-no-capture",blockSelector:void 0,ignoreClass:"ph-ignore-input",maskTextClass:"ph-mask",maskTextSelector:void 0,maskTextFn:void 0,maskAllInputs:!0,maskInputOptions:{password:!0},maskInputFn:void 0,slimDOMOptions:{},collectFonts:!1,inlineStylesheet:!0,recordCrossOriginIframes:!1},r=this.instance.config.session_recording;for(var[n,s]of Object.entries(r||{}))n in t&&(n==="maskInputOptions"?t.maskInputOptions=b({password:!0},s):t[n]=s);if(this.canvasRecording&&this.canvasRecording.enabled&&(t.recordCanvas=!0,t.sampling={canvas:this.canvasRecording.fps},t.dataURLOptions={type:"image/webp",quality:this.canvasRecording.quality}),this.rrwebRecord){this.mutationRateLimiter=(e=this.mutationRateLimiter)!==null&&e!==void 0?e:new Fa(this.rrwebRecord,{refillRate:this.instance.config.session_recording.__mutationRateLimiterRefillRate,bucketSize:this.instance.config.session_recording.__mutationRateLimiterBucketSize,onBlockedNode:(l,a)=>{var c="Too many mutations on node '".concat(l,"'. Rate limiting. This could be due to SVG animations or something similar");Pe.info(c,{node:a}),this.log(ls+" "+c,"warn")}});var o=this._gatherRRWebPlugins();this.stopRrweb=this.rrwebRecord(b({emit:l=>{this.onRRwebEmit(l)},plugins:o},t)),this._lastActivityTimestamp=Date.now(),this.isIdle=!1,this._tryAddCustomEvent("$session_options",{sessionRecordingOptions:t,activePlugins:o.map(l=>l?.name)}),this._tryAddCustomEvent("$posthog_config",{config:this.instance.config})}else Pe.error("onScriptLoaded was called but rrwebRecord is not available. This indicates something has gone wrong.")}_scheduleFullSnapshot(){if(this._fullSnapshotTimer&&clearInterval(this._fullSnapshotTimer),!this.isIdle){var e=this.fullSnapshotIntervalMillis;e&&(this._fullSnapshotTimer=setInterval(()=>{this._tryTakeFullSnapshot()},e))}}_gatherRRWebPlugins(){var e,t,r,n,s=[],o=(e=j.__PosthogExtensions__)===null||e===void 0||(t=e.rrwebPlugins)===null||t===void 0?void 0:t.getRecordConsolePlugin;o&&this.isConsoleLogCaptureEnabled&&s.push(o());var l=(r=j.__PosthogExtensions__)===null||r===void 0||(n=r.rrwebPlugins)===null||n===void 0?void 0:n.getRecordNetworkPlugin;return this.networkPayloadCapture&&Qe(l)&&(!If.includes(location.hostname)||this._forceAllowLocalhostNetworkCapture?s.push(l(Kf(this.instance.config,this.networkPayloadCapture))):Pe.info("NetworkCapture not started because we are on localhost.")),s}onRRwebEmit(e){var t;if(this._processQueuedEvents(),e&&fe(e)){if(e.type===St.Meta){var r=this._maskUrl(e.data.href);if(this._lastHref=r,!r)return;e.data.href=r}else this._pageViewFallBack();if(this._checkUrlTriggerConditions(),this.status!=="paused"||function(u){return u.type===St.Custom&&u.data.tag==="recording paused"}(e)){e.type===St.FullSnapshot&&this._scheduleFullSnapshot(),e.type===St.FullSnapshot&&this.triggerStatus==="trigger_pending"&&this.clearBuffer();var n=this.mutationRateLimiter?this.mutationRateLimiter.throttleMutations(e):e;if(n){var s=function(u){var p=u;if(p&&fe(p)&&p.type===6&&fe(p.data)&&p.data.plugin==="rrweb/console@1"){p.data.payload.payload.length>10&&(p.data.payload.payload=p.data.payload.payload.slice(0,10),p.data.payload.payload.push("...[truncated]"));for(var h=[],g=0;g<p.data.payload.payload.length;g++)p.data.payload.payload[g]&&p.data.payload.payload[g].length>2e3?h.push(p.data.payload.payload[g].slice(0,2e3)+"...[truncated]"):h.push(p.data.payload.payload[g]);return p.data.payload.payload=h,u}return u}(n);if(this._updateWindowAndSessionIds(s),!this.isIdle||fd(s)){if(fd(s)){var o=s.data.payload;if(o){var l=o.lastActivityTimestamp,a=o.threshold;s.timestamp=l+a}}var c=(t=this.instance.config.session_recording.compress_events)===null||t===void 0||t?function(u){if(_s(u)<1024)return u;try{if(u.type===St.FullSnapshot)return b(b({},u),{},{data:ci(u.data),cv:"2024-10"});if(u.type===St.IncrementalSnapshot&&u.data.source===at.Mutation)return b(b({},u),{},{cv:"2024-10",data:b(b({},u.data),{},{texts:ci(u.data.texts),attributes:ci(u.data.attributes),removes:ci(u.data.removes),adds:ci(u.data.adds)})});if(u.type===St.IncrementalSnapshot&&u.data.source===at.StyleSheetRule)return b(b({},u),{},{cv:"2024-10",data:b(b({},u.data),{},{adds:ci(u.data.adds),removes:ci(u.data.removes)})})}catch(p){Pe.error("could not compress event - will use uncompressed event",p)}return u}(s):s,d={$snapshot_bytes:_s(c),$snapshot_data:c,$session_id:this.sessionId,$window_id:this.windowId};this.status!=="disabled"?this._captureSnapshotBuffered(d):this.clearBuffer()}}}}}_pageViewFallBack(){if(!this.instance.config.capture_pageview&&v){var e=this._maskUrl(v.location.href);this._lastHref!==e&&(this._tryAddCustomEvent("$url_changed",{href:e}),this._lastHref=e)}}_processQueuedEvents(){if(this.queuedRRWebEvents.length){var e=[...this.queuedRRWebEvents];this.queuedRRWebEvents=[],e.forEach(t=>{Date.now()-t.enqueuedAt<=2e3&&this._tryRRWebMethod(t)})}}_maskUrl(e){var t=this.instance.config.session_recording;if(t.maskNetworkRequestFn){var r,n={url:e};return(r=n=t.maskNetworkRequestFn(n))===null||r===void 0?void 0:r.url}return e}clearBuffer(){return this.buffer={size:0,data:[],sessionId:this.sessionId,windowId:this.windowId},this.buffer}_flushBuffer(){this.flushBufferTimer&&(clearTimeout(this.flushBufferTimer),this.flushBufferTimer=void 0);var e=this.minimumDuration,t=this.sessionDuration,r=Je(t)&&t>=0,n=Je(e)&&r&&t<e;return this.status==="buffering"||n?(this.flushBufferTimer=setTimeout(()=>{this._flushBuffer()},2e3),this.buffer):(this.buffer.data.length>0&&Aa(this.buffer).forEach(s=>{this._captureSnapshot({$snapshot_bytes:s.size,$snapshot_data:s.data,$session_id:s.sessionId,$window_id:s.windowId})}),this.clearBuffer())}_captureSnapshotBuffered(e){var t,r=2+(((t=this.buffer)===null||t===void 0?void 0:t.data.length)||0);!this.isIdle&&(this.buffer.size+e.$snapshot_bytes+r>943718.4||this.buffer.sessionId!==this.sessionId)&&(this.buffer=this._flushBuffer()),this.buffer.size+=e.$snapshot_bytes,this.buffer.data.push(e.$snapshot_data),this.flushBufferTimer||this.isIdle||(this.flushBufferTimer=setTimeout(()=>{this._flushBuffer()},2e3))}_captureSnapshot(e){this.instance.capture("$snapshot",e,{_url:this.instance.requestRouter.endpointFor("api",this._endpoint),_noTruncate:!0,_batchKey:"recordings",skip_client_rate_limiting:!0})}_checkUrlTriggerConditions(){if(v!==void 0&&v.location.href){var e=v.location.href,t=this.status==="paused",r=gd(e,this._urlBlocklist);r&&!t?this._pauseRecording():!r&&t&&this._resumeRecording(),gd(e,this._urlTriggers)&&this._activateTrigger("url")}}_activateTrigger(e){var t,r;this.triggerStatus==="trigger_pending"&&((t=this.instance)===null||t===void 0||(r=t.persistence)===null||r===void 0||r.register({[e==="url"?ea:ta]:this.sessionId}),this._flushBuffer(),this._reportStarted(e+"_trigger_matched"))}_pauseRecording(){var e,t;this.status!=="paused"&&(this._urlBlocked=!0,O==null||(e=O.body)===null||e===void 0||(t=e.classList)===null||t===void 0||t.add("ph-no-capture"),clearInterval(this._fullSnapshotTimer),setTimeout(()=>{this._flushBuffer()},100),Pe.info("recording paused due to URL blocker"),this._tryAddCustomEvent("recording paused",{reason:"url blocker"}))}_resumeRecording(){var e,t;this.status==="paused"&&(this._urlBlocked=!1,O==null||(e=O.body)===null||e===void 0||(t=e.classList)===null||t===void 0||t.remove("ph-no-capture"),this._tryTakeFullSnapshot(),this._scheduleFullSnapshot(),this._tryAddCustomEvent("recording resumed",{reason:"left blocked url"}),Pe.info("recording resumed"))}_addEventTriggerListener(){this._eventTriggers.length!==0&&ee(this._removeEventTriggerCaptureHook)&&(this._removeEventTriggerCaptureHook=this.instance.on("eventCaptured",e=>{try{this._eventTriggers.includes(e.event)&&this._activateTrigger("event")}catch(t){Pe.error("Could not activate event trigger",t)}}))}overrideLinkedFlag(){this._linkedFlagSeen=!0,this._reportStarted("linked_flag_overridden")}overrideSampling(){var e;(e=this.instance.persistence)===null||e===void 0||e.register({[Nr]:!0}),this._reportStarted("sampling_overridden")}overrideTrigger(e){this._activateTrigger(e)}_reportStarted(e,t){this.instance.register_for_session({$session_recording_start_reason:e}),Pe.info(e.replace("_"," "),t),W(["recording_initialized","session_id_changed"],e)||this._tryAddCustomEvent(e,t)}},Lt=ze("[Decide]"),qa=class{constructor(e){this.instance=e,this.instance.decideEndpointWasHit=this.instance._hasBootstrappedFeatureFlags()}_loadRemoteConfigJs(e){var t,r,n;(t=j.__PosthogExtensions__)!==null&&t!==void 0&&t.loadExternalDependency?(r=j.__PosthogExtensions__)===null||r===void 0||(n=r.loadExternalDependency)===null||n===void 0||n.call(r,this.instance,"remote-config",()=>e(j._POSTHOG_CONFIG)):(Lt.error("PostHog Extensions not found. Cannot load remote config."),e())}_loadRemoteConfigJSON(e){this.instance._send_request({method:"GET",url:this.instance.requestRouter.endpointFor("assets","/array/".concat(this.instance.config.token,"/config")),callback:t=>{e(t.json)}})}call(){var e=!!this.instance.config.advanced_disable_decide;if(e||this.instance.featureFlags.resetRequestQueue(),this.instance.config.__preview_remote_config)return j._POSTHOG_CONFIG?(Lt.info("Using preloaded remote config",j._POSTHOG_CONFIG),void this.onRemoteConfig(j._POSTHOG_CONFIG)):e?void Lt.warn("Remote config is disabled. Falling back to local config."):void this._loadRemoteConfigJs(r=>{if(!r)return Lt.info("No config found after loading remote JS config. Falling back to JSON."),void this._loadRemoteConfigJSON(n=>{this.onRemoteConfig(n)});this.onRemoteConfig(r)});if(!e){var t={token:this.instance.config.token,distinct_id:this.instance.get_distinct_id(),groups:this.instance.getGroups(),person_properties:this.instance.get_property(Wi),group_properties:this.instance.get_property(Ut),disable_flags:this.instance.config.advanced_disable_feature_flags||this.instance.config.advanced_disable_feature_flags_on_first_load||void 0};this.instance._send_request({method:"POST",url:this.instance.requestRouter.endpointFor("api","/decide/?v=3"),data:t,compression:this.instance.config.disable_compression?void 0:lt.Base64,timeout:this.instance.config.feature_flag_request_timeout_ms,callback:r=>this.parseDecideResponse(r.json)})}}parseDecideResponse(e){this.instance.featureFlags.setReloadingPaused(!1),this.instance.featureFlags._startReloadTimer();var t=!e;if(this.instance.config.advanced_disable_feature_flags_on_first_load||this.instance.config.advanced_disable_feature_flags||this.instance.featureFlags.receivedFeatureFlags(e??{},t),!t)return O&&O.body?void this.instance._onRemoteConfig(e):(Lt.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout(()=>{this.parseDecideResponse(e)},500));Lt.error("Failed to fetch feature flags from PostHog.")}onRemoteConfig(e){if(e){if(!O||!O.body)return Lt.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout(()=>{this.onRemoteConfig(e)},500);this.instance._onRemoteConfig(e),e.hasFeatureFlags!==!1&&(this.instance.featureFlags.setReloadingPaused(!1),this.instance.featureFlags.reloadFeatureFlags())}else Lt.error("Failed to fetch remote config from PostHog.")}},Et,ug=v!=null&&v.location?vs(v.location.hash,"__posthog")||vs(location.hash,"state"):null,vd="_postHogToolbarParams";(function(i){i[i.UNINITIALIZED=0]="UNINITIALIZED",i[i.LOADING=1]="LOADING",i[i.LOADED=2]="LOADED"})(Et||(Et={}));var Ba=class{constructor(e){this.instance=e}setToolbarState(e){j.ph_toolbar_state=e}getToolbarState(){var e;return(e=j.ph_toolbar_state)!==null&&e!==void 0?e:Et.UNINITIALIZED}maybeLoadToolbar(){var e,t,r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:void 0,n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:void 0,s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:void 0;if(!v||!O)return!1;r=(e=r)!==null&&e!==void 0?e:v.location,s=(t=s)!==null&&t!==void 0?t:v.history;try{if(!n){try{v.localStorage.setItem("test","test"),v.localStorage.removeItem("test")}catch{return!1}n=v?.localStorage}var o,l=ug||vs(r.hash,"__posthog")||vs(r.hash,"state"),a=l?jc(()=>JSON.parse(atob(decodeURIComponent(l))))||jc(()=>JSON.parse(decodeURIComponent(l))):null;return a&&a.action==="ph_authorize"?((o=a).source="url",o&&Object.keys(o).length>0&&(a.desiredHash?r.hash=a.desiredHash:s?s.replaceState(s.state,"",r.pathname+r.search):r.hash="")):((o=JSON.parse(n.getItem(vd)||"{}")).source="localstorage",delete o.userIntent),!(!o.token||this.instance.config.token!==o.token)&&(this.loadToolbar(o),!0)}catch{return!1}}_callLoadToolbar(e){(j.ph_load_toolbar||j.ph_load_editor)(e,this.instance)}loadToolbar(e){var t=!(O==null||!O.getElementById(jd));if(!v||t)return!1;var r=this.instance.requestRouter.region==="custom"&&this.instance.config.advanced_disable_toolbar_metrics,n=b(b({token:this.instance.config.token},e),{},{apiURL:this.instance.requestRouter.endpointFor("ui")},r?{instrument:!1}:{});if(v.localStorage.setItem(vd,JSON.stringify(b(b({},n),{},{source:void 0}))),this.getToolbarState()===Et.LOADED)this._callLoadToolbar(n);else if(this.getToolbarState()===Et.UNINITIALIZED){var s,o;this.setToolbarState(Et.LOADING),(s=j.__PosthogExtensions__)===null||s===void 0||(o=s.loadExternalDependency)===null||o===void 0||o.call(s,this.instance,"toolbar",l=>{if(l)return D.error("[Toolbar] Failed to load",l),void this.setToolbarState(Et.UNINITIALIZED);this.setToolbarState(Et.LOADED),this._callLoadToolbar(n)}),Ct(v,"turbolinks:load",()=>{this.setToolbarState(Et.UNINITIALIZED),this.loadToolbar(n)})}return!0}_loadEditor(e){return this.loadToolbar(e)}maybeLoadEditor(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:void 0,t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:void 0,r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:void 0;return this.maybeLoadToolbar(e,t,r)}},Ha=class{constructor(e){C(this,"isPaused",!0),C(this,"queue",[]),C(this,"flushTimeoutMs",3e3),this.sendRequest=e}enqueue(e){this.queue.push(e),this.flushTimeout||this.setFlushTimeout()}unload(){this.clearFlushTimeout();var e=this.queue.length>0?this.formatQueue():{},t=Object.values(e),r=[...t.filter(n=>n.url.indexOf("/e")===0),...t.filter(n=>n.url.indexOf("/e")!==0)];r.map(n=>{this.sendRequest(b(b({},n),{},{transport:"sendBeacon"}))})}enable(){this.isPaused=!1,this.setFlushTimeout()}setFlushTimeout(){var e=this;this.isPaused||(this.flushTimeout=setTimeout(()=>{if(this.clearFlushTimeout(),this.queue.length>0){var t=this.formatQueue(),r=function(s){var o=t[s],l=new Date().getTime();o.data&&ce(o.data)&&K(o.data,a=>{a.offset=Math.abs(a.timestamp-l),delete a.timestamp}),e.sendRequest(o)};for(var n in t)r(n)}},this.flushTimeoutMs))}clearFlushTimeout(){clearTimeout(this.flushTimeout),this.flushTimeout=void 0}formatQueue(){var e={};return K(this.queue,t=>{var r,n=t,s=(n?n.batchKey:null)||n.url;F(e[s])&&(e[s]=b(b({},n),{},{data:[]})),(r=e[s].data)===null||r===void 0||r.push(n.data)}),this.queue=[],e}},cg=!!da||!!ca,md="text/plain",xs=(i,e)=>{var[t,r]=i.split("?"),n=b({},e);r?.split("&").forEach(o=>{var[l]=o.split("=");delete n[l]});var s=Af(n);return s=s?(r?r+"&":"")+s:r,"".concat(t,"?").concat(s)},rs=(i,e)=>JSON.stringify(i,(t,r)=>typeof r=="bigint"?r.toString():r,e),oa=i=>{var{data:e,compression:t}=i;if(e){if(t===lt.GZipJS){var r=mp(_p(rs(e)),{mtime:0}),n=new Blob([r],{type:md});return{contentType:md,body:n,estimatedSize:n.size}}if(t===lt.Base64){var s=function(a){var c,d,u,p,h,g="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",m=0,x=0,S="",_=[];if(!a)return a;a=bf(a);do c=(h=a.charCodeAt(m++)<<16|a.charCodeAt(m++)<<8|a.charCodeAt(m++))>>18&63,d=h>>12&63,u=h>>6&63,p=63&h,_[x++]=g.charAt(c)+g.charAt(d)+g.charAt(u)+g.charAt(p);while(m<a.length);switch(S=_.join(""),a.length%3){case 1:S=S.slice(0,-2)+"==";break;case 2:S=S.slice(0,-1)+"="}return S}(rs(e)),o=(a=>"data="+encodeURIComponent(typeof a=="string"?a:rs(a)))(s);return{contentType:"application/x-www-form-urlencoded",body:o,estimatedSize:new Blob([o]).size}}var l=rs(e);return{contentType:"application/json",body:l,estimatedSize:new Blob([l]).size}}},Br=[];da&&Br.push({transport:"XHR",method:i=>{var e,t=new da;t.open(i.method||"GET",i.url,!0);var{contentType:r,body:n}=(e=oa(i))!==null&&e!==void 0?e:{};K(i.headers,function(s,o){t.setRequestHeader(o,s)}),r&&t.setRequestHeader("Content-Type",r),i.timeout&&(t.timeout=i.timeout),t.withCredentials=!0,t.onreadystatechange=()=>{if(t.readyState===4){var s,o={statusCode:t.status,text:t.responseText};if(t.status===200)try{o.json=JSON.parse(t.responseText)}catch{}(s=i.callback)===null||s===void 0||s.call(i,o)}},t.send(n)}}),ca&&Br.push({transport:"fetch",method:i=>{var e,t,{contentType:r,body:n,estimatedSize:s}=(e=oa(i))!==null&&e!==void 0?e:{},o=new Headers;K(i.headers,function(d,u){o.append(u,d)}),r&&o.append("Content-Type",r);var l=i.url,a=null;if(Nc){var c=new Nc;a={signal:c.signal,timeout:setTimeout(()=>c.abort(),i.timeout)}}ca(l,{method:i?.method||"GET",headers:o,keepalive:i.method==="POST"&&(s||0)<52428.8,body:n,signal:(t=a)===null||t===void 0?void 0:t.signal}).then(d=>d.text().then(u=>{var p,h={statusCode:d.status,text:u};if(d.status===200)try{h.json=JSON.parse(u)}catch(g){D.error(g)}(p=i.callback)===null||p===void 0||p.call(i,h)})).catch(d=>{var u;D.error(d),(u=i.callback)===null||u===void 0||u.call(i,{statusCode:0,text:d})}).finally(()=>a?clearTimeout(a.timeout):null)}}),Xe!=null&&Xe.sendBeacon&&Br.push({transport:"sendBeacon",method:i=>{var e=xs(i.url,{beacon:"1"});try{var t,{contentType:r,body:n}=(t=oa(i))!==null&&t!==void 0?t:{},s=typeof n=="string"?new Blob([n],{type:r}):n;Xe.sendBeacon(e,s)}catch{}}});var dg=["retriesPerformedSoFar"],za=class{constructor(e){C(this,"isPolling",!1),C(this,"pollIntervalMs",3e3),C(this,"queue",[]),this.instance=e,this.queue=[],this.areWeOnline=!0,!F(v)&&"onLine"in v.navigator&&(this.areWeOnline=v.navigator.onLine,v.addEventListener("online",()=>{this.areWeOnline=!0,this.flush()}),v.addEventListener("offline",()=>{this.areWeOnline=!1}))}retriableRequest(e){var{retriesPerformedSoFar:t}=e,r=Rd(e,dg);Je(t)&&t>0&&(r.url=xs(r.url,{retry_count:t})),this.instance._send_request(b(b({},r),{},{callback:n=>{var s;n.statusCode!==200&&(n.statusCode<400||n.statusCode>=500)&&(t??0)<10?this.enqueue(b({retriesPerformedSoFar:t},r)):(s=r.callback)===null||s===void 0||s.call(r,n)}}))}enqueue(e){var t=e.retriesPerformedSoFar||0;e.retriesPerformedSoFar=t+1;var r=function(o){var l=3e3*Math.pow(2,o),a=l/2,c=Math.min(18e5,l),d=(Math.random()-.5)*(c-a);return Math.ceil(c+d)}(t),n=Date.now()+r;this.queue.push({retryAt:n,requestOptions:e});var s="Enqueued failed request for retry in ".concat(r);navigator.onLine||(s+=" (Browser is offline)"),D.warn(s),this.isPolling||(this.isPolling=!0,this.poll())}poll(){this.poller&&clearTimeout(this.poller),this.poller=setTimeout(()=>{this.areWeOnline&&this.queue.length>0&&this.flush(),this.poll()},this.pollIntervalMs)}flush(){var e=Date.now(),t=[],r=this.queue.filter(s=>s.retryAt<e||(t.push(s),!1));if(this.queue=t,r.length>0)for(var{requestOptions:n}of r)this.retriableRequest(n)}unload(){for(var{requestOptions:e}of(this.poller&&(clearTimeout(this.poller),this.poller=void 0),this.queue))try{this.instance._send_request(b(b({},e),{},{transport:"sendBeacon"}))}catch(t){D.error(t)}this.queue=[]}},gi,_d=ze("[SessionId]"),Wa=class{constructor(e,t,r){var n;if(C(this,"_sessionIdChangedHandlers",[]),!e.persistence)throw new Error("SessionIdManager requires a PostHogPersistence instance");this.config=e.config,this.persistence=e.persistence,this._windowId=void 0,this._sessionId=void 0,this._sessionStartTimestamp=null,this._sessionActivityTimestamp=null,this._sessionIdGenerator=t||qt,this._windowIdGenerator=r||qt;var s=this.config.persistence_name||this.config.token,o=this.config.session_idle_timeout_seconds||1800;if(this._sessionTimeoutMs=1e3*ht(o,60,36e3,"session_idle_timeout_seconds",1800),e.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this._window_id_storage_key="ph_"+s+"_window_id",this._primary_window_exists_storage_key="ph_"+s+"_primary_window_exists",this._canUseSessionStorage()){var l=Ee.parse(this._window_id_storage_key),a=Ee.parse(this._primary_window_exists_storage_key);l&&!a?this._windowId=l:Ee.remove(this._window_id_storage_key),Ee.set(this._primary_window_exists_storage_key,!0)}if((n=this.config.bootstrap)!==null&&n!==void 0&&n.sessionID)try{var c=(d=>{var u=d.replace(/-/g,"");if(u.length!==32)throw new Error("Not a valid UUID");if(u[12]!=="7")throw new Error("Not a UUIDv7");return parseInt(u.substring(0,12),16)})(this.config.bootstrap.sessionID);this._setSessionId(this.config.bootstrap.sessionID,new Date().getTime(),c)}catch(d){_d.error("Invalid sessionID in bootstrap",d)}this._listenToReloadWindow()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(e){return F(this._sessionIdChangedHandlers)&&(this._sessionIdChangedHandlers=[]),this._sessionIdChangedHandlers.push(e),this._sessionId&&e(this._sessionId,this._windowId),()=>{this._sessionIdChangedHandlers=this._sessionIdChangedHandlers.filter(t=>t!==e)}}_canUseSessionStorage(){return this.config.persistence!=="memory"&&!this.persistence.disabled&&Ee.is_supported()}_setWindowId(e){e!==this._windowId&&(this._windowId=e,this._canUseSessionStorage()&&Ee.set(this._window_id_storage_key,e))}_getWindowId(){return this._windowId?this._windowId:this._canUseSessionStorage()?Ee.parse(this._window_id_storage_key):null}_setSessionId(e,t,r){e===this._sessionId&&t===this._sessionActivityTimestamp&&r===this._sessionStartTimestamp||(this._sessionStartTimestamp=r,this._sessionActivityTimestamp=t,this._sessionId=e,this.persistence.register({[ps]:[t,e,r]}))}_getSessionId(){if(this._sessionId&&this._sessionActivityTimestamp&&this._sessionStartTimestamp)return[this._sessionActivityTimestamp,this._sessionId,this._sessionStartTimestamp];var e=this.persistence.props[ps];return ce(e)&&e.length===2&&e.push(e[0]),e||[0,null,0]}resetSessionId(){this._setSessionId(null,null,null)}_listenToReloadWindow(){v?.addEventListener("beforeunload",()=>{this._canUseSessionStorage()&&Ee.remove(this._primary_window_exists_storage_key)})}checkAndGetSessionAndWindowId(){var e=arguments.length>0&&arguments[0]!==void 0&&arguments[0],t=(arguments.length>1&&arguments[1]!==void 0?arguments[1]:null)||new Date().getTime(),[r,n,s]=this._getSessionId(),o=this._getWindowId(),l=Je(s)&&s>0&&Math.abs(t-s)>864e5,a=!1,c=!n,d=!e&&Math.abs(t-r)>this.sessionTimeoutMs;c||d||l?(n=this._sessionIdGenerator(),o=this._windowIdGenerator(),_d.info("new session ID generated",{sessionId:n,windowId:o,changeReason:{noSessionId:c,activityTimeout:d,sessionPastMaximumLength:l}}),s=t,a=!0):o||(o=this._windowIdGenerator(),a=!0);var u=r===0||!e||l?t:r,p=s===0?new Date().getTime():s;return this._setWindowId(o),this._setSessionId(n,u,p),a&&this._sessionIdChangedHandlers.forEach(h=>h(n,o,a?{noSessionId:c,activityTimeout:d,sessionPastMaximumLength:l}:void 0)),{sessionId:n,windowId:o,sessionStartTimestamp:p,changeReason:a?{noSessionId:c,activityTimeout:d,sessionPastMaximumLength:l}:void 0,lastActivityTimestamp:r}}};(function(i){i.US="us",i.EU="eu",i.CUSTOM="custom"})(gi||(gi={}));var yd="i.posthog.com",Va=class{constructor(e){C(this,"_regionCache",{}),this.instance=e}get apiHost(){var e=this.instance.config.api_host.trim().replace(/\/$/,"");return e==="https://app.posthog.com"?"https://us.i.posthog.com":e}get uiHost(){var e,t=(e=this.instance.config.ui_host)===null||e===void 0?void 0:e.replace(/\/$/,"");return t||(t=this.apiHost.replace(".".concat(yd),".posthog.com")),t==="https://app.posthog.com"?"https://us.posthog.com":t}get region(){return this._regionCache[this.apiHost]||(/https:\/\/(app|us|us-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?this._regionCache[this.apiHost]=gi.US:/https:\/\/(eu|eu-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?this._regionCache[this.apiHost]=gi.EU:this._regionCache[this.apiHost]=gi.CUSTOM),this._regionCache[this.apiHost]}endpointFor(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"";if(t&&(t=t[0]==="/"?t:"/".concat(t)),e==="ui")return this.uiHost+t;if(this.region===gi.CUSTOM)return this.apiHost+t;var r=yd+t;switch(e){case"assets":return"https://".concat(this.region,"-assets.").concat(r);case"api":return"https://".concat(this.region,".").concat(r)}}},yp="posthog-js";function bp(i){var{organization:e,projectId:t,prefix:r,severityAllowList:n=["error"]}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return s=>{var o,l,a,c,d;if(!(n==="*"||n.includes(s.level))||!i.__loaded)return s;s.tags||(s.tags={});var u=i.requestRouter.endpointFor("ui","/project/".concat(i.config.token,"/person/").concat(i.get_distinct_id()));s.tags["PostHog Person URL"]=u,i.sessionRecordingStarted()&&(s.tags["PostHog Recording URL"]=i.get_session_replay_url({withTimestamp:!0}));var p=((o=s.exception)===null||o===void 0?void 0:o.values)||[];p.map(g=>{g.stacktrace&&(g.stacktrace.type="raw")});var h={$exception_message:((l=p[0])===null||l===void 0?void 0:l.value)||s.message,$exception_type:(a=p[0])===null||a===void 0?void 0:a.type,$exception_personURL:u,$exception_level:s.level,$exception_list:p,$sentry_event_id:s.event_id,$sentry_exception:s.exception,$sentry_exception_message:((c=p[0])===null||c===void 0?void 0:c.value)||s.message,$sentry_exception_type:(d=p[0])===null||d===void 0?void 0:d.type,$sentry_tags:s.tags};return e&&t&&(h.$sentry_url=(r||"https://sentry.io/organizations/")+e+"/issues/?project="+t+"&query="+s.event_id),i.exceptions.sendExceptionEvent(h),s}}var Ga=class{constructor(e,t,r,n,s){this.name=yp,this.setupOnce=function(o){o(bp(e,{organization:t,projectId:r,prefix:n,severityAllowList:s}))}}},bd,ks,ot,aa=ze("[SegmentIntegration]");function pg(i,e){var t=i.config.segment;if(!t)return e();(function(r,n){var s=r.config.segment;if(!s)return n();var o=a=>{var c=()=>a.anonymousId()||qt();r.config.get_device_id=c,a.id()&&(r.register({distinct_id:a.id(),$device_id:c()}),r.persistence.set_property(kt,"identified")),n()},l=s.user();"then"in l&&Qe(l.then)?l.then(a=>o(a)):o(l)})(i,()=>{t.register((r=>{Promise&&Promise.resolve||aa.warn("This browser does not have Promise support, and can not use the segment integration");var n=(s,o)=>{var l;if(!o)return s;s.event.userId||s.event.anonymousId===r.get_distinct_id()||(aa.info("No userId set, resetting PostHog"),r.reset()),s.event.userId&&s.event.userId!==r.get_distinct_id()&&(aa.info("UserId set, identifying with PostHog"),r.identify(s.event.userId));var a=r._calculate_event_properties(o,(l=s.event.properties)!==null&&l!==void 0?l:{},new Date);return s.event.properties=Object.assign({},a,s.event.properties),s};return{name:"PostHog JS",type:"enrichment",version:"1.0.0",isLoaded:()=>!0,load:()=>Promise.resolve(),track:s=>n(s,s.event.event),page:s=>n(s,"$pageview"),identify:s=>n(s,"$identify"),screen:s=>n(s,"$screen")}})(i)).then(()=>{e()})})}var Ja=class{constructor(e){this._instance=e}doPageView(e){var t,r=this._previousPageViewProperties(e);return this._currentPath=(t=v?.location.pathname)!==null&&t!==void 0?t:"",this._instance.scrollManager.resetContext(),this._prevPageviewTimestamp=e,r}doPageLeave(e){return this._previousPageViewProperties(e)}_previousPageViewProperties(e){var t=this._currentPath,r=this._prevPageviewTimestamp,n=this._instance.scrollManager.getContext();if(!r)return{};var s={};if(n){var{maxScrollHeight:o,lastScrollY:l,maxScrollY:a,maxContentHeight:c,lastContentY:d,maxContentY:u}=n;F(o)||F(l)||F(a)||F(c)||F(d)||F(u)||(o=Math.ceil(o),l=Math.ceil(l),a=Math.ceil(a),c=Math.ceil(c),d=Math.ceil(d),u=Math.ceil(u),s={$prev_pageview_last_scroll:l,$prev_pageview_last_scroll_percentage:o<=1?1:ht(l/o,0,1),$prev_pageview_max_scroll:a,$prev_pageview_max_scroll_percentage:o<=1?1:ht(a/o,0,1),$prev_pageview_last_content:d,$prev_pageview_last_content_percentage:c<=1?1:ht(d/c,0,1),$prev_pageview_max_content:u,$prev_pageview_max_content_percentage:c<=1?1:ht(u/c,0,1)})}return t&&(s.$prev_pageview_pathname=t),r&&(s.$prev_pageview_duration=(e.getTime()-r.getTime())/1e3),s}};(function(i){i.Popover="popover",i.API="api",i.Widget="widget"})(bd||(bd={})),function(i){i.Open="open",i.MultipleChoice="multiple_choice",i.SingleChoice="single_choice",i.Rating="rating",i.Link="link"}(ks||(ks={})),function(i){i.NextQuestion="next_question",i.End="end",i.ResponseBased="response_based",i.SpecificQuestion="specific_question"}(ot||(ot={}));var Ss=class{constructor(){C(this,"events",{}),this.events={}}on(e,t){return this.events[e]||(this.events[e]=[]),this.events[e].push(t),()=>{this.events[e]=this.events[e].filter(r=>r!==t)}}emit(e,t){for(var r of this.events[e]||[])r(t);for(var n of this.events["*"]||[])n(e,t)}},Xa=class i{constructor(e){C(this,"_debugEventEmitter",new Ss),C(this,"checkStep",(t,r)=>this.checkStepEvent(t,r)&&this.checkStepUrl(t,r)&&this.checkStepElement(t,r)),C(this,"checkStepEvent",(t,r)=>r==null||!r.event||t?.event===r?.event),this.instance=e,this.actionEvents=new Set,this.actionRegistry=new Set}init(){var e;if(!F((e=this.instance)===null||e===void 0?void 0:e._addCaptureHook)){var t;(t=this.instance)===null||t===void 0||t._addCaptureHook((r,n)=>{this.on(r,n)})}}register(e){var t,r;if(!F((t=this.instance)===null||t===void 0?void 0:t._addCaptureHook)&&(e.forEach(o=>{var l,a;(l=this.actionRegistry)===null||l===void 0||l.add(o),(a=o.steps)===null||a===void 0||a.forEach(c=>{var d;(d=this.actionEvents)===null||d===void 0||d.add(c?.event||"")})}),(r=this.instance)!==null&&r!==void 0&&r.autocapture)){var n,s=new Set;e.forEach(o=>{var l;(l=o.steps)===null||l===void 0||l.forEach(a=>{a!=null&&a.selector&&s.add(a?.selector)})}),(n=this.instance)===null||n===void 0||n.autocapture.setElementSelectors(s)}}on(e,t){var r;t!=null&&e.length!=0&&(this.actionEvents.has(e)||this.actionEvents.has(t?.event))&&this.actionRegistry&&((r=this.actionRegistry)===null||r===void 0?void 0:r.size)>0&&this.actionRegistry.forEach(n=>{this.checkAction(t,n)&&this._debugEventEmitter.emit("actionCaptured",n.name)})}_addActionHook(e){this.onAction("actionCaptured",t=>e(t))}checkAction(e,t){if(t?.steps==null)return!1;for(var r of t.steps)if(this.checkStep(e,r))return!0;return!1}onAction(e,t){return this._debugEventEmitter.on(e,t)}checkStepUrl(e,t){if(t!=null&&t.url){var r,n=e==null||(r=e.properties)===null||r===void 0?void 0:r.$current_url;if(!n||typeof n!="string"||!i.matchString(n,t?.url,t?.url_matching||"contains"))return!1}return!0}static matchString(e,t,r){switch(r){case"regex":return!!v&&Yi(e,t);case"exact":return t===e;case"contains":var n=i.escapeStringRegexp(t).replace(/_/g,".").replace(/%/g,".*");return Yi(e,n);default:return!1}}static escapeStringRegexp(e){return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}checkStepElement(e,t){if((t!=null&&t.href||t!=null&&t.tag_name||t!=null&&t.text)&&!this.getElementsList(e).some(s=>!(t!=null&&t.href&&!i.matchString(s.href||"",t?.href,t?.href_matching||"exact"))&&(t==null||!t.tag_name||s.tag_name===t?.tag_name)&&!(t!=null&&t.text&&!i.matchString(s.text||"",t?.text,t?.text_matching||"exact")&&!i.matchString(s.$el_text||"",t?.text,t?.text_matching||"exact"))))return!1;if(t!=null&&t.selector){var r,n=e==null||(r=e.properties)===null||r===void 0?void 0:r.$element_selectors;if(!n||!n.includes(t?.selector))return!1}return!0}getElementsList(e){return e?.properties.$elements==null?[]:e?.properties.$elements}},Jr=class i{constructor(e){this.instance=e,this.eventToSurveys=new Map,this.actionToSurveys=new Map}register(e){var t;F((t=this.instance)===null||t===void 0?void 0:t._addCaptureHook)||(this.setupEventBasedSurveys(e),this.setupActionBasedSurveys(e))}setupActionBasedSurveys(e){var t=e.filter(r=>{var n,s,o,l;return((n=r.conditions)===null||n===void 0?void 0:n.actions)&&((s=r.conditions)===null||s===void 0||(o=s.actions)===null||o===void 0||(l=o.values)===null||l===void 0?void 0:l.length)>0});t.length!==0&&(this.actionMatcher==null&&(this.actionMatcher=new Xa(this.instance),this.actionMatcher.init(),this.actionMatcher._addActionHook(r=>{this.onAction(r)})),t.forEach(r=>{var n,s,o,l,a,c,d,u,p,h;r.conditions&&(n=r.conditions)!==null&&n!==void 0&&n.actions&&(s=r.conditions)!==null&&s!==void 0&&(o=s.actions)!==null&&o!==void 0&&o.values&&((l=r.conditions)===null||l===void 0||(a=l.actions)===null||a===void 0||(c=a.values)===null||c===void 0?void 0:c.length)>0&&((d=this.actionMatcher)===null||d===void 0||d.register(r.conditions.actions.values),(u=r.conditions)===null||u===void 0||(p=u.actions)===null||p===void 0||(h=p.values)===null||h===void 0||h.forEach(g=>{if(g&&g.name){var m=this.actionToSurveys.get(g.name);m&&m.push(r.id),this.actionToSurveys.set(g.name,m||[r.id])}}))}))}setupEventBasedSurveys(e){var t;e.filter(r=>{var n,s,o,l;return((n=r.conditions)===null||n===void 0?void 0:n.events)&&((s=r.conditions)===null||s===void 0||(o=s.events)===null||o===void 0||(l=o.values)===null||l===void 0?void 0:l.length)>0}).length!==0&&((t=this.instance)===null||t===void 0||t._addCaptureHook((r,n)=>{this.onEvent(r,n)}),e.forEach(r=>{var n,s,o;(n=r.conditions)===null||n===void 0||(s=n.events)===null||s===void 0||(o=s.values)===null||o===void 0||o.forEach(l=>{if(l&&l.name){var a=this.eventToSurveys.get(l.name);a&&a.push(r.id),this.eventToSurveys.set(l.name,a||[r.id])}})}))}onEvent(e,t){var r,n,s=((r=this.instance)===null||r===void 0||(n=r.persistence)===null||n===void 0?void 0:n.props[Yn])||[];if(i.SURVEY_SHOWN_EVENT_NAME==e&&t&&s.length>0){var o,l=t==null||(o=t.properties)===null||o===void 0?void 0:o.$survey_id;if(l){var a=s.indexOf(l);a>=0&&(s.splice(a,1),this._updateActivatedSurveys(s))}}else this.eventToSurveys.has(e)&&this._updateActivatedSurveys(s.concat(this.eventToSurveys.get(e)||[]))}onAction(e){var t,r,n=((t=this.instance)===null||t===void 0||(r=t.persistence)===null||r===void 0?void 0:r.props[Yn])||[];this.actionToSurveys.has(e)&&this._updateActivatedSurveys(n.concat(this.actionToSurveys.get(e)||[]))}_updateActivatedSurveys(e){var t,r;(t=this.instance)===null||t===void 0||(r=t.persistence)===null||r===void 0||r.register({[Yn]:[...new Set(e)]})}getSurveys(){var e,t,r=(e=this.instance)===null||e===void 0||(t=e.persistence)===null||t===void 0?void 0:t.props[Yn];return r||[]}getEventToSurveys(){return this.eventToSurveys}_getActionMatcher(){return this.actionMatcher}};C(Jr,"SURVEY_SHOWN_EVENT_NAME","survey shown");var wp,ae,xp,hi,wd,kp,Ya,Sp,Ka={},Ep=[],hg=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,xl=Array.isArray;function Bt(i,e){for(var t in e)i[t]=e[t];return i}function Cp(i){var e=i.parentNode;e&&e.removeChild(i)}function la(i,e,t,r,n){var s={type:i,props:e,key:t,ref:r,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,constructor:void 0,__v:n??++xp,__i:-1,__u:0};return n==null&&ae.vnode!=null&&ae.vnode(s),s}function kl(i){return i.children}function us(i,e){this.props=i,this.context=e}function er(i,e){if(e==null)return i.__?er(i.__,i.__i+1):null;for(var t;e<i.__k.length;e++)if((t=i.__k[e])!=null&&t.__e!=null)return t.__e;return typeof i.type=="function"?er(i):null}function $p(i){var e,t;if((i=i.__)!=null&&i.__c!=null){for(i.__e=i.__c.base=null,e=0;e<i.__k.length;e++)if((t=i.__k[e])!=null&&t.__e!=null){i.__e=i.__c.base=t.__e;break}return $p(i)}}function Za(i){(!i.__d&&(i.__d=!0)&&hi.push(i)&&!Es.__r++||wd!==ae.debounceRendering)&&((wd=ae.debounceRendering)||kp)(Es)}function Es(){var i,e,t,r,n,s,o,l,a;for(hi.sort(Ya);i=hi.shift();)i.__d&&(e=hi.length,r=void 0,s=(n=(t=i).__v).__e,l=[],a=[],(o=t.__P)&&((r=Bt({},n)).__v=n.__v+1,ae.vnode&&ae.vnode(r),Tp(o,r,n,t.__n,o.ownerSVGElement!==void 0,32&n.__u?[s]:null,l,s??er(n),!!(32&n.__u),a),r.__.__k[r.__i]=r,vg(l,r,a),r.__e!=s&&$p(r)),hi.length>e&&hi.sort(Ya));Es.__r=0}function Ip(i,e,t,r,n,s,o,l,a,c,d){var u,p,h,g,m,x=r&&r.__k||Ep,S=e.length;for(t.__d=a,fg(t,e,x),a=t.__d,u=0;u<S;u++)(h=t.__k[u])!=null&&typeof h!="boolean"&&typeof h!="function"&&(p=h.__i===-1?Ka:x[h.__i]||Ka,h.__i=u,Tp(i,h,p,n,s,o,l,a,c,d),g=h.__e,h.ref&&p.ref!=h.ref&&(p.ref&&Sl(p.ref,null,h),d.push(h.ref,h.__c||g,h)),m==null&&g!=null&&(m=g),65536&h.__u||p.__k===h.__k?a=Ap(h,a,i):typeof h.type=="function"&&h.__d!==void 0?a=h.__d:g&&(a=g.nextSibling),h.__d=void 0,h.__u&=-196609);t.__d=a,t.__e=m}function fg(i,e,t){var r,n,s,o,l,a=e.length,c=t.length,d=c,u=0;for(i.__k=[],r=0;r<a;r++)(n=i.__k[r]=(n=e[r])==null||typeof n=="boolean"||typeof n=="function"?null:typeof n=="string"||typeof n=="number"||typeof n=="bigint"||n.constructor==String?la(null,n,null,null,n):xl(n)?la(kl,{children:n},null,null,null):n.constructor===void 0&&n.__b>0?la(n.type,n.props,n.key,n.ref?n.ref:null,n.__v):n)!=null?(n.__=i,n.__b=i.__b+1,l=gg(n,t,o=r+u,d),n.__i=l,s=null,l!==-1&&(d--,(s=t[l])&&(s.__u|=131072)),s==null||s.__v===null?(l==-1&&u--,typeof n.type!="function"&&(n.__u|=65536)):l!==o&&(l===o+1?u++:l>o?d>a-o?u+=l-o:u--:u=l<o&&l==o-1?l-o:0,l!==r+u&&(n.__u|=65536))):(s=t[r])&&s.key==null&&s.__e&&(s.__e==i.__d&&(i.__d=er(s)),Qa(s,s,!1),t[r]=null,d--);if(d)for(r=0;r<c;r++)(s=t[r])!=null&&!(131072&s.__u)&&(s.__e==i.__d&&(i.__d=er(s)),Qa(s,s))}function Ap(i,e,t){var r,n;if(typeof i.type=="function"){for(r=i.__k,n=0;r&&n<r.length;n++)r[n]&&(r[n].__=i,e=Ap(r[n],e,t));return e}return i.__e!=e&&(t.insertBefore(i.__e,e||null),e=i.__e),e&&e.nextSibling}function gg(i,e,t,r){var n=i.key,s=i.type,o=t-1,l=t+1,a=e[t];if(a===null||a&&n==a.key&&s===a.type)return t;if(r>(a!=null&&!(131072&a.__u)?1:0))for(;o>=0||l<e.length;){if(o>=0){if((a=e[o])&&!(131072&a.__u)&&n==a.key&&s===a.type)return o;o--}if(l<e.length){if((a=e[l])&&!(131072&a.__u)&&n==a.key&&s===a.type)return l;l++}}return-1}function xd(i,e,t){e[0]==="-"?i.setProperty(e,t??""):i[e]=t==null?"":typeof t!="number"||hg.test(e)?t:t+"px"}function ns(i,e,t,r,n){var s;e:if(e==="style")if(typeof t=="string")i.style.cssText=t;else{if(typeof r=="string"&&(i.style.cssText=r=""),r)for(e in r)t&&e in t||xd(i.style,e,"");if(t)for(e in t)r&&t[e]===r[e]||xd(i.style,e,t[e])}else if(e[0]==="o"&&e[1]==="n")s=e!==(e=e.replace(/(PointerCapture)$|Capture$/,"$1")),e=e.toLowerCase()in i?e.toLowerCase().slice(2):e.slice(2),i.l||(i.l={}),i.l[e+s]=t,t?r?t.u=r.u:(t.u=Date.now(),i.addEventListener(e,s?Sd:kd,s)):i.removeEventListener(e,s?Sd:kd,s);else{if(n)e=e.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(e!=="width"&&e!=="height"&&e!=="href"&&e!=="list"&&e!=="form"&&e!=="tabIndex"&&e!=="download"&&e!=="rowSpan"&&e!=="colSpan"&&e!=="role"&&e in i)try{i[e]=t??"";break e}catch{}typeof t=="function"||(t==null||t===!1&&e[4]!=="-"?i.removeAttribute(e):i.setAttribute(e,t))}}function kd(i){var e=this.l[i.type+!1];if(i.t){if(i.t<=e.u)return}else i.t=Date.now();return e(ae.event?ae.event(i):i)}function Sd(i){return this.l[i.type+!0](ae.event?ae.event(i):i)}function Tp(i,e,t,r,n,s,o,l,a,c){var d,u,p,h,g,m,x,S,_,A,R,q,X,z,P,B=e.type;if(e.constructor!==void 0)return null;128&t.__u&&(a=!!(32&t.__u),s=[l=e.__e=t.__e]),(d=ae.__b)&&d(e);e:if(typeof B=="function")try{if(S=e.props,_=(d=B.contextType)&&r[d.__c],A=d?_?_.props.value:d.__:r,t.__c?x=(u=e.__c=t.__c).__=u.__E:("prototype"in B&&B.prototype.render?e.__c=u=new B(S,A):(e.__c=u=new us(S,A),u.constructor=B,u.render=_g),_&&_.sub(u),u.props=S,u.state||(u.state={}),u.context=A,u.__n=r,p=u.__d=!0,u.__h=[],u._sb=[]),u.__s==null&&(u.__s=u.state),B.getDerivedStateFromProps!=null&&(u.__s==u.state&&(u.__s=Bt({},u.__s)),Bt(u.__s,B.getDerivedStateFromProps(S,u.__s))),h=u.props,g=u.state,u.__v=e,p)B.getDerivedStateFromProps==null&&u.componentWillMount!=null&&u.componentWillMount(),u.componentDidMount!=null&&u.__h.push(u.componentDidMount);else{if(B.getDerivedStateFromProps==null&&S!==h&&u.componentWillReceiveProps!=null&&u.componentWillReceiveProps(S,A),!u.__e&&(u.shouldComponentUpdate!=null&&u.shouldComponentUpdate(S,u.__s,A)===!1||e.__v===t.__v)){for(e.__v!==t.__v&&(u.props=S,u.state=u.__s,u.__d=!1),e.__e=t.__e,e.__k=t.__k,e.__k.forEach(function(V){V&&(V.__=e)}),R=0;R<u._sb.length;R++)u.__h.push(u._sb[R]);u._sb=[],u.__h.length&&o.push(u);break e}u.componentWillUpdate!=null&&u.componentWillUpdate(S,u.__s,A),u.componentDidUpdate!=null&&u.__h.push(function(){u.componentDidUpdate(h,g,m)})}if(u.context=A,u.props=S,u.__P=i,u.__e=!1,q=ae.__r,X=0,"prototype"in B&&B.prototype.render){for(u.state=u.__s,u.__d=!1,q&&q(e),d=u.render(u.props,u.state,u.context),z=0;z<u._sb.length;z++)u.__h.push(u._sb[z]);u._sb=[]}else do u.__d=!1,q&&q(e),d=u.render(u.props,u.state,u.context),u.state=u.__s;while(u.__d&&++X<25);u.state=u.__s,u.getChildContext!=null&&(r=Bt(Bt({},r),u.getChildContext())),p||u.getSnapshotBeforeUpdate==null||(m=u.getSnapshotBeforeUpdate(h,g)),Ip(i,xl(P=d!=null&&d.type===kl&&d.key==null?d.props.children:d)?P:[P],e,t,r,n,s,o,l,a,c),u.base=e.__e,e.__u&=-161,u.__h.length&&o.push(u),x&&(u.__E=u.__=null)}catch(V){e.__v=null,a||s!=null?(e.__e=l,e.__u|=a?160:32,s[s.indexOf(l)]=null):(e.__e=t.__e,e.__k=t.__k),ae.__e(V,e,t)}else s==null&&e.__v===t.__v?(e.__k=t.__k,e.__e=t.__e):e.__e=mg(t.__e,e,t,r,n,s,o,a,c);(d=ae.diffed)&&d(e)}function vg(i,e,t){e.__d=void 0;for(var r=0;r<t.length;r++)Sl(t[r],t[++r],t[++r]);ae.__c&&ae.__c(e,i),i.some(function(n){try{i=n.__h,n.__h=[],i.some(function(s){s.call(n)})}catch(s){ae.__e(s,n.__v)}})}function mg(i,e,t,r,n,s,o,l,a){var c,d,u,p,h,g,m,x=t.props,S=e.props,_=e.type;if(_==="svg"&&(n=!0),s!=null){for(c=0;c<s.length;c++)if((h=s[c])&&"setAttribute"in h==!!_&&(_?h.localName===_:h.nodeType===3)){i=h,s[c]=null;break}}if(i==null){if(_===null)return document.createTextNode(S);i=n?document.createElementNS("http://www.w3.org/2000/svg",_):document.createElement(_,S.is&&S),s=null,l=!1}if(_===null)x===S||l&&i.data===S||(i.data=S);else{if(s=s&&wp.call(i.childNodes),x=t.props||Ka,!l&&s!=null)for(x={},c=0;c<i.attributes.length;c++)x[(h=i.attributes[c]).name]=h.value;for(c in x)h=x[c],c=="children"||(c=="dangerouslySetInnerHTML"?u=h:c==="key"||c in S||ns(i,c,null,h,n));for(c in S)h=S[c],c=="children"?p=h:c=="dangerouslySetInnerHTML"?d=h:c=="value"?g=h:c=="checked"?m=h:c==="key"||l&&typeof h!="function"||x[c]===h||ns(i,c,h,x[c],n);if(d)l||u&&(d.__html===u.__html||d.__html===i.innerHTML)||(i.innerHTML=d.__html),e.__k=[];else if(u&&(i.innerHTML=""),Ip(i,xl(p)?p:[p],e,t,r,n&&_!=="foreignObject",s,o,s?s[0]:t.__k&&er(t,0),l,a),s!=null)for(c=s.length;c--;)s[c]!=null&&Cp(s[c]);l||(c="value",g!==void 0&&(g!==i[c]||_==="progress"&&!g||_==="option"&&g!==x[c])&&ns(i,c,g,x[c],!1),c="checked",m!==void 0&&m!==i[c]&&ns(i,c,m,x[c],!1))}return i}function Sl(i,e,t){try{typeof i=="function"?i(e):i.current=e}catch(r){ae.__e(r,t)}}function Qa(i,e,t){var r,n;if(ae.unmount&&ae.unmount(i),(r=i.ref)&&(r.current&&r.current!==i.__e||Sl(r,null,e)),(r=i.__c)!=null){if(r.componentWillUnmount)try{r.componentWillUnmount()}catch(s){ae.__e(s,e)}r.base=r.__P=null,i.__c=void 0}if(r=i.__k)for(n=0;n<r.length;n++)r[n]&&Qa(r[n],e,t||typeof i.type!="function");t||i.__e==null||Cp(i.__e),i.__=i.__e=i.__d=void 0}function _g(i,e,t){return this.constructor(i,t)}wp=Ep.slice,ae={__e:function(i,e,t,r){for(var n,s,o;e=e.__;)if((n=e.__c)&&!n.__)try{if((s=n.constructor)&&s.getDerivedStateFromError!=null&&(n.setState(s.getDerivedStateFromError(i)),o=n.__d),n.componentDidCatch!=null&&(n.componentDidCatch(i,r||{}),o=n.__d),o)return n.__E=n}catch(l){i=l}throw i}},xp=0,us.prototype.setState=function(i,e){var t;t=this.__s!=null&&this.__s!==this.state?this.__s:this.__s=Bt({},this.state),typeof i=="function"&&(i=i(Bt({},t),this.props)),i&&Bt(t,i),i!=null&&this.__v&&(e&&this._sb.push(e),Za(this))},us.prototype.forceUpdate=function(i){this.__v&&(this.__e=!0,i&&this.__h.push(i),Za(this))},us.prototype.render=kl,hi=[],kp=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,Ya=function(i,e){return i.__v.__b-e.__v.__b},Es.__r=0,Sp=0;(function(i,e){var t={__c:e="__cC"+Sp++,__:i,Consumer:function(r,n){return r.children(n)},Provider:function(r){var n,s;return this.getChildContext||(n=[],(s={})[e]=this,this.getChildContext=function(){return s},this.shouldComponentUpdate=function(o){this.props.value!==o.value&&n.some(function(l){l.__e=!0,Za(l)})},this.sub=function(o){n.push(o);var l=o.componentWillUnmount;o.componentWillUnmount=function(){n.splice(n.indexOf(o),1),l&&l.call(o)}}),r.children}};t.Provider.__=t.Consumer.contextType=t})({isPreviewMode:!1,previewPageIndex:0,handleCloseSurveyPopup:()=>{},isPopup:!0});var Mr=ze("[Surveys]"),yg={icontains:i=>!!v&&v.location.href.toLowerCase().indexOf(i.toLowerCase())>-1,not_icontains:i=>!!v&&v.location.href.toLowerCase().indexOf(i.toLowerCase())===-1,regex:i=>!!v&&Yi(v.location.href,i),not_regex:i=>!!v&&!Yi(v.location.href,i),exact:i=>v?.location.href===i,is_not:i=>v?.location.href!==i},el=class{constructor(e){this.instance=e,this._surveyEventReceiver=null}onRemoteConfig(e){this._decideServerResponse=!!e.surveys,this.loadIfEnabled()}reset(){localStorage.removeItem("lastSeenSurveyDate");var e=(()=>{for(var t=[],r=0;r<localStorage.length;r++){var n=localStorage.key(r);n!=null&&n.startsWith("seenSurvey_")&&t.push(n)}return t})();e.forEach(t=>localStorage.removeItem(t))}loadIfEnabled(){var e,t,r,n=j==null||(e=j.__PosthogExtensions__)===null||e===void 0?void 0:e.generateSurveys;this.instance.config.disable_surveys||!this._decideServerResponse||n||(this._surveyEventReceiver==null&&(this._surveyEventReceiver=new Jr(this.instance)),(t=j.__PosthogExtensions__)===null||t===void 0||(r=t.loadExternalDependency)===null||r===void 0||r.call(t,this.instance,"surveys",s=>{var o,l;if(s)return Mr.error("Could not load surveys script",s);this._surveyManager=(o=j.__PosthogExtensions__)===null||o===void 0||(l=o.generateSurveys)===null||l===void 0?void 0:l.call(o,this.instance)}))}getSurveys(e){var t=arguments.length>1&&arguments[1]!==void 0&&arguments[1];if(this.instance.config.disable_surveys)return e([]);this._surveyEventReceiver==null&&(this._surveyEventReceiver=new Jr(this.instance));var r=this.instance.get_property(va);if(r&&!t)return e(r);this.instance._send_request({url:this.instance.requestRouter.endpointFor("api","/api/surveys/?token=".concat(this.instance.config.token)),method:"GET",transport:"XHR",callback:n=>{var s;if(n.statusCode!==200||!n.json)return e([]);var o,l=n.json.surveys||[],a=l.filter(c=>{var d,u,p,h,g,m,x,S,_,A,R,q;return((d=c.conditions)===null||d===void 0?void 0:d.events)&&((u=c.conditions)===null||u===void 0||(p=u.events)===null||p===void 0?void 0:p.values)&&((h=c.conditions)===null||h===void 0||(g=h.events)===null||g===void 0||(m=g.values)===null||m===void 0?void 0:m.length)>0||((x=c.conditions)===null||x===void 0?void 0:x.actions)&&((S=c.conditions)===null||S===void 0||(_=S.actions)===null||_===void 0?void 0:_.values)&&((A=c.conditions)===null||A===void 0||(R=A.actions)===null||R===void 0||(q=R.values)===null||q===void 0?void 0:q.length)>0});return a.length>0&&((o=this._surveyEventReceiver)===null||o===void 0||o.register(a)),(s=this.instance.persistence)===null||s===void 0||s.register({[va]:l}),e(l)}})}getActiveMatchingSurveys(e){var t=arguments.length>1&&arguments[1]!==void 0&&arguments[1];this.getSurveys(r=>{var n,s=r.filter(a=>!(!a.start_date||a.end_date)).filter(a=>{var c,d,u,p;if(!a.conditions)return!0;var h=(c=a.conditions)===null||c===void 0||!c.url||yg[(d=(u=a.conditions)===null||u===void 0?void 0:u.urlMatchType)!==null&&d!==void 0?d:"icontains"](a.conditions.url),g=(p=a.conditions)===null||p===void 0||!p.selector||O?.querySelector(a.conditions.selector);return h&&g}),o=(n=this._surveyEventReceiver)===null||n===void 0?void 0:n.getSurveys(),l=s.filter(a=>{var c,d,u,p,h,g,m,x,S,_,A;if(!(a.linked_flag_key||a.targeting_flag_key||a.internal_targeting_flag_key||(c=a.feature_flag_keys)!==null&&c!==void 0&&c.length))return!0;var R=!a.linked_flag_key||this.instance.featureFlags.isFeatureEnabled(a.linked_flag_key),q=!a.targeting_flag_key||this.instance.featureFlags.isFeatureEnabled(a.targeting_flag_key),X=((d=a.conditions)===null||d===void 0?void 0:d.events)&&((u=a.conditions)===null||u===void 0||(p=u.events)===null||p===void 0?void 0:p.values)&&((h=a.conditions)===null||h===void 0||(g=h.events)===null||g===void 0?void 0:g.values.length)>0,z=((m=a.conditions)===null||m===void 0?void 0:m.actions)&&((x=a.conditions)===null||x===void 0||(S=x.actions)===null||S===void 0?void 0:S.values)&&((_=a.conditions)===null||_===void 0||(A=_.actions)===null||A===void 0?void 0:A.values.length)>0,P=!X&&!z||o?.includes(a.id),B=this._canActivateRepeatedly(a),V=!(a.internal_targeting_flag_key&&!B)||this.instance.featureFlags.isFeatureEnabled(a.internal_targeting_flag_key),Re=this.checkFlags(a);return R&&q&&V&&P&&Re});return e(l)},t)}checkFlags(e){var t;return(t=e.feature_flag_keys)===null||t===void 0||!t.length||e.feature_flag_keys.every(r=>{var{key:n,value:s}=r;return!n||!s||this.instance.featureFlags.isFeatureEnabled(s)})}getNextSurveyStep(e,t,r){var n,s=e.questions[t],o=t+1;if((n=s.branching)===null||n===void 0||!n.type)return t===e.questions.length-1?ot.End:o;if(s.branching.type===ot.End)return ot.End;if(s.branching.type===ot.SpecificQuestion){if(Number.isInteger(s.branching.index))return s.branching.index}else if(s.branching.type===ot.ResponseBased){if(s.type===ks.SingleChoice){var l,a,c=s.choices.indexOf("".concat(r));if((l=s.branching)!==null&&l!==void 0&&(a=l.responseValues)!==null&&a!==void 0&&a.hasOwnProperty(c)){var d=s.branching.responseValues[c];return Number.isInteger(d)?d:d===ot.End?ot.End:o}}else if(s.type===ks.Rating){var u,p;if(typeof r!="number"||!Number.isInteger(r))throw new Error("The response type must be an integer");var h=function(m,x){if(x===3){if(m<1||m>3)throw new Error("The response must be in range 1-3");return m===1?"negative":m===2?"neutral":"positive"}if(x===5){if(m<1||m>5)throw new Error("The response must be in range 1-5");return m<=2?"negative":m===3?"neutral":"positive"}if(x===7){if(m<1||m>7)throw new Error("The response must be in range 1-7");return m<=3?"negative":m===4?"neutral":"positive"}if(x===10){if(m<0||m>10)throw new Error("The response must be in range 0-10");return m<=6?"detractors":m<=8?"passives":"promoters"}throw new Error("The scale must be one of: 3, 5, 7, 10")}(r,s.scale);if((u=s.branching)!==null&&u!==void 0&&(p=u.responseValues)!==null&&p!==void 0&&p.hasOwnProperty(h)){var g=s.branching.responseValues[h];return Number.isInteger(g)?g:g===ot.End?ot.End:o}}return o}return Mr.warn("Falling back to next question index due to unexpected branching type"),o}_canActivateRepeatedly(e){var t;return ee((t=j.__PosthogExtensions__)===null||t===void 0?void 0:t.canActivateRepeatedly)?(Mr.warn("init was not called"),!1):j.__PosthogExtensions__.canActivateRepeatedly(e)}canRenderSurvey(e){ee(this._surveyManager)?Mr.warn("init was not called"):this.getSurveys(t=>{var r=t.filter(n=>n.id===e)[0];this._surveyManager.canRenderSurvey(r)})}renderSurvey(e,t){ee(this._surveyManager)?Mr.warn("init was not called"):this.getSurveys(r=>{var n=r.filter(s=>s.id===e)[0];this._surveyManager.renderSurvey(n,O?.querySelector(t))})}},Ed=ze("[RateLimiter]"),tl=class{constructor(e){var t,r;C(this,"serverLimits",{}),C(this,"lastEventRateLimited",!1),C(this,"checkForLimiting",n=>{var s=n.text;if(s&&s.length)try{(JSON.parse(s).quota_limited||[]).forEach(o=>{Ed.info("".concat(o||"events"," is quota limited.")),this.serverLimits[o]=new Date().getTime()+6e4})}catch(o){return void Ed.warn('could not rate limit - continuing. Error: "'.concat(o?.message,'"'),{text:s})}}),this.instance=e,this.captureEventsPerSecond=((t=e.config.rate_limiting)===null||t===void 0?void 0:t.events_per_second)||10,this.captureEventsBurstLimit=Math.max(((r=e.config.rate_limiting)===null||r===void 0?void 0:r.events_burst_limit)||10*this.captureEventsPerSecond,this.captureEventsPerSecond),this.lastEventRateLimited=this.clientRateLimitContext(!0).isRateLimited}clientRateLimitContext(){var e,t,r,n=arguments.length>0&&arguments[0]!==void 0&&arguments[0],s=new Date().getTime(),o=(e=(t=this.instance.persistence)===null||t===void 0?void 0:t.get_property(_a))!==null&&e!==void 0?e:{tokens:this.captureEventsBurstLimit,last:s};o.tokens+=(s-o.last)/1e3*this.captureEventsPerSecond,o.last=s,o.tokens>this.captureEventsBurstLimit&&(o.tokens=this.captureEventsBurstLimit);var l=o.tokens<1;return l||n||(o.tokens=Math.max(0,o.tokens-1)),!l||this.lastEventRateLimited||n||this.instance.capture("$$client_ingestion_warning",{$$client_ingestion_warning_message:"posthog-js client rate limited. Config is set to ".concat(this.captureEventsPerSecond," events per second and ").concat(this.captureEventsBurstLimit," events burst limit.")},{skip_client_rate_limiting:!0}),this.lastEventRateLimited=l,(r=this.instance.persistence)===null||r===void 0||r.set_property(_a,o),{isRateLimited:l,remainingTokens:o.tokens}}isServerRateLimited(e){var t=this.serverLimits[e||"events"]||!1;return t!==!1&&new Date().getTime()<t}},bg=()=>b({initialPathName:Be?.pathname||"",referringDomain:oe.referringDomain()},oe.campaignParams()),il=class{constructor(e,t,r){C(this,"_onSessionIdCallback",n=>{var s=this._getStoredProps();if(!s||s.sessionId!==n){var o={sessionId:n,props:this._sessionSourceParamGenerator()};this._persistence.register({[ma]:o})}}),this._sessionIdManager=e,this._persistence=t,this._sessionSourceParamGenerator=r||bg,this._sessionIdManager.onSessionId(this._onSessionIdCallback)}_getStoredProps(){return this._persistence.props[ma]}getSessionProps(){var e,t=(e=this._getStoredProps())===null||e===void 0?void 0:e.props;return t?{$client_session_initial_referring_host:t.referringDomain,$client_session_initial_pathname:t.initialPathName,$client_session_initial_utm_source:t.utm_source,$client_session_initial_utm_campaign:t.utm_campaign,$client_session_initial_utm_medium:t.utm_medium,$client_session_initial_utm_content:t.utm_content,$client_session_initial_utm_term:t.utm_term}:{}}},wg=["ahrefsbot","ahrefssiteaudit","applebot","baiduspider","bingbot","bingpreview","bot.htm","bot.php","crawler","deepscan","duckduckbot","facebookexternal","facebookcatalog","gptbot","http://yandex.com/bots","hubspot","ia_archiver","linkedinbot","mj12bot","msnbot","nessus","petalbot","pinterest","prerender","rogerbot","screaming frog","semrushbot","sitebulb","slurp","turnitin","twitterbot","vercelbot","yahoo! slurp","yandexbot","headlesschrome","cypress","Google-HotelAdsVerifier","adsbot-google","apis-google","duplexweb-google","feedfetcher-google","google favicon","google web preview","google-read-aloud","googlebot","googleweblight","mediapartners-google","storebot-google","Bytespider;"],Cd=function(i,e){if(!i)return!1;var t=i.toLowerCase();return wg.concat(e||[]).some(r=>{var n=r.toLowerCase();return t.indexOf(n)!==-1})},Pp=function(i,e){if(!i)return!1;var t=i.userAgent;if(t&&Cd(t,e))return!0;try{var r=i?.userAgentData;if(r!=null&&r.brands&&r.brands.some(n=>Cd(n?.brand,e)))return!0}catch{}return!!i.webdriver},Cs=class{constructor(){this.clicks=[]}isRageClick(e,t,r){var n=this.clicks[this.clicks.length-1];if(n&&Math.abs(e-n.x)+Math.abs(t-n.y)<30&&r-n.timestamp<1e3){if(this.clicks.push({x:e,y:t,timestamp:r}),this.clicks.length===3)return!0}else this.clicks=[{x:e,y:t,timestamp:r}];return!1}},ss=ze("[Dead Clicks]"),xg=()=>!0,kg=i=>{var e,t=!((e=i.instance.persistence)===null||e===void 0||!e.get_property(Ud)),r=i.instance.config.capture_dead_clicks;return fi(r)?r:t},$s=class{get lazyLoadedDeadClicksAutocapture(){return this._lazyLoadedDeadClicksAutocapture}constructor(e,t,r){this.instance=e,this.isEnabled=t,this.onCapture=r,this.startIfEnabled()}onRemoteConfig(e){this.instance.persistence&&this.instance.persistence.register({[Ud]:e?.captureDeadClicks}),this.startIfEnabled()}startIfEnabled(){this.isEnabled(this)&&this.loadScript(()=>{this.start()})}loadScript(e){var t,r,n;(t=j.__PosthogExtensions__)!==null&&t!==void 0&&t.initDeadClicksAutocapture&&e(),(r=j.__PosthogExtensions__)===null||r===void 0||(n=r.loadExternalDependency)===null||n===void 0||n.call(r,this.instance,"dead-clicks-autocapture",s=>{s?ss.error("failed to load script",s):e()})}start(){var e;if(O){if(!this._lazyLoadedDeadClicksAutocapture&&(e=j.__PosthogExtensions__)!==null&&e!==void 0&&e.initDeadClicksAutocapture){var t=fe(this.instance.config.capture_dead_clicks)?this.instance.config.capture_dead_clicks:{};t.__onCapture=this.onCapture,this._lazyLoadedDeadClicksAutocapture=j.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,t),this._lazyLoadedDeadClicksAutocapture.start(O),ss.info("starting...")}}else ss.error("`document` not found. Cannot start.")}stop(){this._lazyLoadedDeadClicksAutocapture&&(this._lazyLoadedDeadClicksAutocapture.stop(),this._lazyLoadedDeadClicksAutocapture=void 0,ss.info("stopping..."))}},Sg=ze("[Heatmaps]"),rl=class{constructor(e){var t;C(this,"rageclicks",new Cs),C(this,"_enabledServerSide",!1),C(this,"_initialized",!1),C(this,"_flushInterval",null),this.instance=e,this._enabledServerSide=!((t=this.instance.persistence)===null||t===void 0||!t.props[ha]),v?.addEventListener("beforeunload",()=>{this.flush()})}get flushIntervalMilliseconds(){var e=5e3;return fe(this.instance.config.capture_heatmaps)&&this.instance.config.capture_heatmaps.flush_interval_milliseconds&&(e=this.instance.config.capture_heatmaps.flush_interval_milliseconds),e}get isEnabled(){return F(this.instance.config.capture_heatmaps)?F(this.instance.config.enable_heatmaps)?this._enabledServerSide:this.instance.config.enable_heatmaps:this.instance.config.capture_heatmaps!==!1}startIfEnabled(){if(this.isEnabled){if(this._initialized)return;Sg.info("starting..."),this._setupListeners(),this._flushInterval=setInterval(this.flush.bind(this),this.flushIntervalMilliseconds)}else{var e,t;clearInterval((e=this._flushInterval)!==null&&e!==void 0?e:void 0),(t=this.deadClicksCapture)===null||t===void 0||t.stop(),this.getAndClearBuffer()}}onRemoteConfig(e){var t=!!e.heatmaps;this.instance.persistence&&this.instance.persistence.register({[ha]:t}),this._enabledServerSide=t,this.startIfEnabled()}getAndClearBuffer(){var e=this.buffer;return this.buffer=void 0,e}_onDeadClick(e){this._onClick(e.originalEvent,"deadclick")}_setupListeners(){v&&O&&(Ct(O,"click",e=>this._onClick(e||v?.event),!1,!0),Ct(O,"mousemove",e=>this._onMouseMove(e||v?.event),!1,!0),this.deadClicksCapture=new $s(this.instance,xg,this._onDeadClick.bind(this)),this.deadClicksCapture.startIfEnabled(),this._initialized=!0)}_getProperties(e,t){var r=this.instance.scrollManager.scrollY(),n=this.instance.scrollManager.scrollX(),s=this.instance.scrollManager.scrollElement(),o=function(l,a,c){for(var d=l;d&&Ps(d)&&!Ht(d,"body");){if(d===c)return!1;if(W(a,v?.getComputedStyle(d).position))return!0;d=ap(d)}return!1}(op(e),["fixed","sticky"],s);return{x:e.clientX+(o?0:n),y:e.clientY+(o?0:r),target_fixed:o,type:t}}_onClick(e){var t,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"click";if(!sd(e.target)){var n=this._getProperties(e,r);(t=this.rageclicks)!==null&&t!==void 0&&t.isRageClick(e.clientX,e.clientY,new Date().getTime())&&this._capture(b(b({},n),{},{type:"rageclick"})),this._capture(n)}}_onMouseMove(e){sd(e.target)||(clearTimeout(this._mouseMoveTimeout),this._mouseMoveTimeout=setTimeout(()=>{this._capture(this._getProperties(e,"mousemove"))},500))}_capture(e){if(v){var t=v.location.href;this.buffer=this.buffer||{},this.buffer[t]||(this.buffer[t]=[]),this.buffer[t].push(e)}}flush(){this.buffer&&!Hi(this.buffer)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}},nl=class{constructor(e){C(this,"_updateScrollData",()=>{var t,r,n,s;this.context||(this.context={});var o=this.scrollElement(),l=this.scrollY(),a=o?Math.max(0,o.scrollHeight-o.clientHeight):0,c=l+(o?.clientHeight||0),d=o?.scrollHeight||0;this.context.lastScrollY=Math.ceil(l),this.context.maxScrollY=Math.max(l,(t=this.context.maxScrollY)!==null&&t!==void 0?t:0),this.context.maxScrollHeight=Math.max(a,(r=this.context.maxScrollHeight)!==null&&r!==void 0?r:0),this.context.lastContentY=c,this.context.maxContentY=Math.max(c,(n=this.context.maxContentY)!==null&&n!==void 0?n:0),this.context.maxContentHeight=Math.max(d,(s=this.context.maxContentHeight)!==null&&s!==void 0?s:0)}),this.instance=e}getContext(){return this.context}resetContext(){var e=this.context;return setTimeout(this._updateScrollData,0),e}startMeasuringScrollPosition(){v?.addEventListener("scroll",this._updateScrollData,!0),v?.addEventListener("scrollend",this._updateScrollData,!0),v?.addEventListener("resize",this._updateScrollData)}scrollElement(){if(!this.instance.config.scroll_root_selector)return v?.document.documentElement;var e=ce(this.instance.config.scroll_root_selector)?this.instance.config.scroll_root_selector:[this.instance.config.scroll_root_selector];for(var t of e){var r=v?.document.querySelector(t);if(r)return r}}scrollY(){if(this.instance.config.scroll_root_selector){var e=this.scrollElement();return e&&e.scrollTop||0}return v&&(v.scrollY||v.pageYOffset||v.document.documentElement.scrollTop)||0}scrollX(){if(this.instance.config.scroll_root_selector){var e=this.scrollElement();return e&&e.scrollLeft||0}return v&&(v.scrollX||v.pageXOffset||v.document.documentElement.scrollLeft)||0}},$d=ze("[AutoCapture]");function ua(i,e){return e.length>i?e.slice(0,i)+"...":e}function Eg(i){if(i.previousElementSibling)return i.previousElementSibling;var e=i;do e=e.previousSibling;while(e&&!Ps(e));return e}function Cg(i,e,t,r){var n=i.tagName.toLowerCase(),s={tag_name:n};Ta.indexOf(n)>-1&&!t&&(n.toLowerCase()==="a"||n.toLowerCase()==="button"?s.$el_text=ua(1024,dp(i)):s.$el_text=ua(1024,Rs(i)));var o=ys(i);o.length>0&&(s.classes=o.filter(function(d){return d!==""})),K(i.attributes,function(d){var u;if((!lp(i)||["name","id","class","aria-label"].indexOf(d.name)!==-1)&&(r==null||!r.includes(d.name))&&!e&&Zi(d.value)&&(u=d.name,!Ce(u)||u.substring(0,10)!=="_ngcontent"&&u.substring(0,7)!=="_nghost")){var p=d.value;d.name==="class"&&(p=yl(p).join(" ")),s["attr__"+d.name]=ua(1024,p)}});for(var l=1,a=1,c=i;c=Eg(c);)l++,c.tagName===i.tagName&&a++;return s.nth_child=l,s.nth_of_type=a,s}function $g(i,e){for(var t,r,{e:n,maskAllElementAttributes:s,maskAllText:o,elementAttributeIgnoreList:l,elementsChainAsString:a}=e,c=[i],d=i;d.parentNode&&!Ht(d,"body");)np(d.parentNode)?(c.push(d.parentNode.host),d=d.parentNode.host):(c.push(d.parentNode),d=d.parentNode);var u,p=[],h={},g=!1,m=!1;if(K(c,R=>{var q=Pa(R);R.tagName.toLowerCase()==="a"&&(g=R.getAttribute("href"),g=q&&g&&Zi(g)&&g),W(ys(R),"ph-no-capture")&&(m=!0),p.push(Cg(R,s,o,l));var X=function(z){if(!Pa(z))return{};var P={};return K(z.attributes,function(B){if(B.name&&B.name.indexOf("data-ph-capture-attribute")===0){var V=B.name.replace("data-ph-capture-attribute-",""),Re=B.value;V&&Re&&Zi(Re)&&(P[V]=Re)}}),P}(R);De(h,X)}),m)return{props:{},explicitNoCapture:m};if(o||(i.tagName.toLowerCase()==="a"||i.tagName.toLowerCase()==="button"?p[0].$el_text=dp(i):p[0].$el_text=Rs(i)),g){var x,S;p[0].attr__href=g;var _=(x=Gi(g))===null||x===void 0?void 0:x.host,A=v==null||(S=v.location)===null||S===void 0?void 0:S.host;_&&A&&_!==A&&(u=g)}return{props:De({$event_type:n.type,$ce_version:1},a?{}:{$elements:p},{$elements_chain:Vf(p)},(t=p[0])!==null&&t!==void 0&&t.$el_text?{$el_text:(r=p[0])===null||r===void 0?void 0:r.$el_text}:{},u&&n.type==="click"?{$external_click_url:u}:{},h)}}var sl=class{constructor(e){C(this,"_initialized",!1),C(this,"_isDisabledServerSide",null),C(this,"rageclicks",new Cs),C(this,"_elementsChainAsString",!1),this.instance=e,this._elementSelectors=null}get config(){var e,t,r=fe(this.instance.config.autocapture)?this.instance.config.autocapture:{};return r.url_allowlist=(e=r.url_allowlist)===null||e===void 0?void 0:e.map(n=>new RegExp(n)),r.url_ignorelist=(t=r.url_ignorelist)===null||t===void 0?void 0:t.map(n=>new RegExp(n)),r}_addDomEventHandlers(){if(this.isBrowserSupported()){if(v&&O){var e=r=>{r=r||v?.event;try{this._captureEvent(r)}catch(n){$d.error("Failed to capture event",n)}},t=r=>{r=r||v?.event,this._captureEvent(r,Qo)};Ct(O,"submit",e,!1,!0),Ct(O,"change",e,!1,!0),Ct(O,"click",e,!1,!0),this.config.capture_copied_text&&(Ct(O,"copy",t,!1,!0),Ct(O,"cut",t,!1,!0))}}else $d.info("Disabling Automatic Event Collection because this browser is not supported")}startIfEnabled(){this.isEnabled&&!this._initialized&&(this._addDomEventHandlers(),this._initialized=!0)}onRemoteConfig(e){e.elementsChainAsString&&(this._elementsChainAsString=e.elementsChainAsString),this.instance.persistence&&this.instance.persistence.register({[qc]:!!e.autocapture_opt_out}),this._isDisabledServerSide=!!e.autocapture_opt_out,this.startIfEnabled()}setElementSelectors(e){this._elementSelectors=e}getElementSelectors(e){var t,r=[];return(t=this._elementSelectors)===null||t===void 0||t.forEach(n=>{var s=O?.querySelectorAll(n);s?.forEach(o=>{e===o&&r.push(n)})}),r}get isEnabled(){var e,t,r=(e=this.instance.persistence)===null||e===void 0?void 0:e.props[qc],n=this._isDisabledServerSide;if(zt(n)&&!fi(r)&&!this.instance.config.advanced_disable_decide)return!1;var s=(t=this._isDisabledServerSide)!==null&&t!==void 0?t:!!r;return!!this.instance.config.autocapture&&!s}_captureEvent(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"$autocapture";if(this.isEnabled){var r,n=op(e);rp(n)&&(n=n.parentNode||null),t==="$autocapture"&&e.type==="click"&&e instanceof MouseEvent&&this.instance.config.rageclick&&(r=this.rageclicks)!==null&&r!==void 0&&r.isRageClick(e.clientX,e.clientY,new Date().getTime())&&this._captureEvent(e,"$rageclick");var s=t===Qo;if(n&&qf(n,e,this.config,s,s?["copy","cut"]:void 0)){var{props:o,explicitNoCapture:l}=$g(n,{e,maskAllElementAttributes:this.instance.config.mask_all_element_attributes,maskAllText:this.instance.config.mask_all_text,elementAttributeIgnoreList:this.config.element_attribute_ignorelist,elementsChainAsString:this._elementsChainAsString});if(l)return!1;var a=this.getElementSelectors(n);if(a&&a.length>0&&(o.$element_selectors=a),t===Qo){var c,d=sp(v==null||(c=v.getSelection())===null||c===void 0?void 0:c.toString()),u=e.type||"clipboard";if(!d)return!1;o.$selected_content=d,o.$copy_type=u}return this.instance.capture(t,o),!0}}}isBrowserSupported(){return Qe(O?.querySelectorAll)}},Ig=ze("[TracingHeaders]"),ol=class{constructor(e){C(this,"_restoreXHRPatch",void 0),C(this,"_restoreFetchPatch",void 0),C(this,"_startCapturing",()=>{var t,r,n,s;F(this._restoreXHRPatch)&&((t=j.__PosthogExtensions__)===null||t===void 0||(r=t.tracingHeadersPatchFns)===null||r===void 0||r._patchXHR(this.instance.sessionManager)),F(this._restoreFetchPatch)&&((n=j.__PosthogExtensions__)===null||n===void 0||(s=n.tracingHeadersPatchFns)===null||s===void 0||s._patchFetch(this.instance.sessionManager))}),this.instance=e}_loadScript(e){var t,r,n;(t=j.__PosthogExtensions__)!==null&&t!==void 0&&t.tracingHeadersPatchFns&&e(),(r=j.__PosthogExtensions__)===null||r===void 0||(n=r.loadExternalDependency)===null||n===void 0||n.call(r,this.instance,"tracing-headers",s=>{if(s)return Ig.error("failed to load script",s);e()})}startIfEnabledOrStop(){var e,t;this.instance.config.__add_tracing_headers?this._loadScript(this._startCapturing):((e=this._restoreXHRPatch)===null||e===void 0||e.call(this),(t=this._restoreFetchPatch)===null||t===void 0||t.call(this),this._restoreXHRPatch=void 0,this._restoreFetchPatch=void 0)}},jt;(function(i){i[i.PENDING=-1]="PENDING",i[i.DENIED=0]="DENIED",i[i.GRANTED=1]="GRANTED"})(jt||(jt={}));var al=class{constructor(e){this.instance=e}get config(){return this.instance.config}get consent(){return this.getDnt()?jt.DENIED:this.storedConsent}isOptedOut(){return this.consent===jt.DENIED||this.consent===jt.PENDING&&this.config.opt_out_capturing_by_default}isOptedIn(){return!this.isOptedOut()}optInOut(e){this.storage.set(this.storageKey,e?1:0,this.config.cookie_expiration,this.config.cross_subdomain_cookie,this.config.secure_cookie)}reset(){this.storage.remove(this.storageKey,this.config.cross_subdomain_cookie)}get storageKey(){var{token:e,opt_out_capturing_cookie_prefix:t}=this.instance.config;return(t||"__ph_opt_in_out_")+e}get storedConsent(){var e=this.storage.get(this.storageKey);return e==="1"?jt.GRANTED:e==="0"?jt.DENIED:jt.PENDING}get storage(){if(!this._storage){var e=this.config.opt_out_capturing_persistence_type;this._storage=e==="localStorage"?me:$t;var t=e==="localStorage"?$t:me;t.get(this.storageKey)&&(this._storage.get(this.storageKey)||this.optInOut(t.get(this.storageKey)==="1"),t.remove(this.storageKey,this.config.cross_subdomain_cookie))}return this._storage}getDnt(){return!!this.config.respect_dnt&&!!Ld([Xe?.doNotTrack,Xe?.msDoNotTrack,j.doNotTrack],e=>W([!0,1,"1","yes"],e))}},os=ze("[ExceptionAutocapture]"),ll=class{constructor(e){var t;C(this,"originalOnUnhandledRejectionHandler",void 0),C(this,"startCapturing",()=>{var r,n,s,o;if(v&&this.isEnabled&&!this.hasHandlers&&!this.isCapturing){var l=(r=j.__PosthogExtensions__)===null||r===void 0||(n=r.errorWrappingFunctions)===null||n===void 0?void 0:n.wrapOnError,a=(s=j.__PosthogExtensions__)===null||s===void 0||(o=s.errorWrappingFunctions)===null||o===void 0?void 0:o.wrapUnhandledRejection;if(l&&a)try{this.unwrapOnError=l(this.captureException.bind(this)),this.unwrapUnhandledRejection=a(this.captureException.bind(this))}catch(c){os.error("failed to start",c),this.stopCapturing()}else os.error("failed to load error wrapping functions - cannot start")}}),this.instance=e,this.remoteEnabled=!((t=this.instance.persistence)===null||t===void 0||!t.props[Bc]),this.startIfEnabled()}get isEnabled(){var e;return(e=this.remoteEnabled)!==null&&e!==void 0&&e}get isCapturing(){var e;return!(v==null||(e=v.onerror)===null||e===void 0||!e.__POSTHOG_INSTRUMENTED__)}get hasHandlers(){return this.originalOnUnhandledRejectionHandler||this.unwrapOnError}startIfEnabled(){this.isEnabled&&!this.isCapturing&&(os.info("enabled, starting..."),this.loadScript(this.startCapturing))}loadScript(e){var t,r;this.hasHandlers&&e(),(t=j.__PosthogExtensions__)===null||t===void 0||(r=t.loadExternalDependency)===null||r===void 0||r.call(t,this.instance,"exception-autocapture",n=>{if(n)return os.error("failed to load script",n);e()})}stopCapturing(){var e,t;(e=this.unwrapOnError)===null||e===void 0||e.call(this),(t=this.unwrapUnhandledRejection)===null||t===void 0||t.call(this)}onRemoteConfig(e){var t=e.autocaptureExceptions;this.remoteEnabled=!!t||!1,this.instance.persistence&&this.instance.persistence.register({[Bc]:this.remoteEnabled}),this.startIfEnabled()}captureException(e){var t=this.instance.requestRouter.endpointFor("ui");e.$exception_personURL="".concat(t,"/project/").concat(this.instance.config.token,"/person/").concat(this.instance.get_distinct_id()),this.instance.exceptions.sendExceptionEvent(e)}},di=ze("[Web Vitals]"),Id=9e5,ul=class{constructor(e){var t;C(this,"_enabledServerSide",!1),C(this,"_initialized",!1),C(this,"buffer",{url:void 0,metrics:[],firstMetricTimestamp:void 0}),C(this,"_flushToCapture",()=>{clearTimeout(this._delayedFlushTimer),this.buffer.metrics.length!==0&&(this.instance.capture("$web_vitals",this.buffer.metrics.reduce((r,n)=>b(b({},r),{},{["$web_vitals_".concat(n.name,"_event")]:b({},n),["$web_vitals_".concat(n.name,"_value")]:n.value}),{})),this.buffer={url:void 0,metrics:[],firstMetricTimestamp:void 0})}),C(this,"_addToBuffer",r=>{var n,s=(n=this.instance.sessionManager)===null||n===void 0?void 0:n.checkAndGetSessionAndWindowId(!0);if(F(s))di.error("Could not read session ID. Dropping metrics!");else{this.buffer=this.buffer||{url:void 0,metrics:[],firstMetricTimestamp:void 0};var o=this._currentURL();F(o)||(ee(r?.name)||ee(r?.value)?di.error("Invalid metric received",r):this._maxAllowedValue&&r.value>=this._maxAllowedValue?di.error("Ignoring metric with value >= "+this._maxAllowedValue,r):(this.buffer.url!==o&&(this._flushToCapture(),this._delayedFlushTimer=setTimeout(this._flushToCapture,this.flushToCaptureTimeoutMs)),F(this.buffer.url)&&(this.buffer.url=o),this.buffer.firstMetricTimestamp=F(this.buffer.firstMetricTimestamp)?Date.now():this.buffer.firstMetricTimestamp,r.attribution&&r.attribution.interactionTargetElement&&(r.attribution.interactionTargetElement=void 0),this.buffer.metrics.push(b(b({},r),{},{$current_url:o,$session_id:s.sessionId,$window_id:s.windowId,timestamp:Date.now()})),this.buffer.metrics.length===this.allowedMetrics.length&&this._flushToCapture()))}}),C(this,"_startCapturing",()=>{var r,n,s,o,l=j.__PosthogExtensions__;F(l)||F(l.postHogWebVitalsCallbacks)||({onLCP:r,onCLS:n,onFCP:s,onINP:o}=l.postHogWebVitalsCallbacks),r&&n&&s&&o?(this.allowedMetrics.indexOf("LCP")>-1&&r(this._addToBuffer.bind(this)),this.allowedMetrics.indexOf("CLS")>-1&&n(this._addToBuffer.bind(this)),this.allowedMetrics.indexOf("FCP")>-1&&s(this._addToBuffer.bind(this)),this.allowedMetrics.indexOf("INP")>-1&&o(this._addToBuffer.bind(this)),this._initialized=!0):di.error("web vitals callbacks not loaded - not starting")}),this.instance=e,this._enabledServerSide=!((t=this.instance.persistence)===null||t===void 0||!t.props[Hc]),this.startIfEnabled()}get allowedMetrics(){var e,t,r=fe(this.instance.config.capture_performance)?(e=this.instance.config.capture_performance)===null||e===void 0?void 0:e.web_vitals_allowed_metrics:void 0;return F(r)?((t=this.instance.persistence)===null||t===void 0?void 0:t.props[zc])||["CLS","FCP","INP","LCP"]:r}get flushToCaptureTimeoutMs(){return(fe(this.instance.config.capture_performance)?this.instance.config.capture_performance.web_vitals_delayed_flush_ms:void 0)||5e3}get _maxAllowedValue(){var e=fe(this.instance.config.capture_performance)&&Je(this.instance.config.capture_performance.__web_vitals_max_value)?this.instance.config.capture_performance.__web_vitals_max_value:Id;return 0<e&&e<=6e4?Id:e}get isEnabled(){var e=fe(this.instance.config.capture_performance)?this.instance.config.capture_performance.web_vitals:void 0;return fi(e)?e:this._enabledServerSide}startIfEnabled(){this.isEnabled&&!this._initialized&&(di.info("enabled, starting..."),this.loadScript(this._startCapturing))}onRemoteConfig(e){var t=fe(e.capturePerformance)&&!!e.capturePerformance.web_vitals,r=fe(e.capturePerformance)?e.capturePerformance.web_vitals_allowed_metrics:void 0;this.instance.persistence&&(this.instance.persistence.register({[Hc]:t}),this.instance.persistence.register({[zc]:r})),this._enabledServerSide=t,this.startIfEnabled()}loadScript(e){var t,r,n;(t=j.__PosthogExtensions__)!==null&&t!==void 0&&t.postHogWebVitalsCallbacks&&e(),(r=j.__PosthogExtensions__)===null||r===void 0||(n=r.loadExternalDependency)===null||n===void 0||n.call(r,this.instance,"web-vitals",s=>{s?di.error("failed to load script",s):e()})}_currentURL(){var e=v?v.location.href:void 0;return e||di.error("Could not determine current URL"),e}},Ag={icontains:(i,e)=>!!v&&e.href.toLowerCase().indexOf(i.toLowerCase())>-1,not_icontains:(i,e)=>!!v&&e.href.toLowerCase().indexOf(i.toLowerCase())===-1,regex:(i,e)=>!!v&&Yi(e.href,i),not_regex:(i,e)=>!!v&&!Yi(e.href,i),exact:(i,e)=>e.href===i,is_not:(i,e)=>e.href!==i},cl=class i{constructor(e){var t=this;C(this,"getWebExperimentsAndEvaluateDisplayLogic",function(){var r=arguments.length>0&&arguments[0]!==void 0&&arguments[0];t.getWebExperiments(n=>{i.logInfo("retrieved web experiments from the server"),t._flagToExperiments=new Map,n.forEach(s=>{if(s.feature_flag_key){var o;t._flagToExperiments&&(i.logInfo("setting flag key ",s.feature_flag_key," to web experiment ",s),(o=t._flagToExperiments)===null||o===void 0||o.set(s.feature_flag_key,s));var l=t.instance.getFeatureFlag(s.feature_flag_key);Ce(l)&&s.variants[l]&&t.applyTransforms(s.name,l,s.variants[l].transforms)}else if(s.variants)for(var a in s.variants){var c=s.variants[a];i.matchesTestVariant(c)&&t.applyTransforms(s.name,a,c.transforms)}})},r)}),this.instance=e,this.instance.onFeatureFlags(r=>{this.onFeatureFlags(r)})}onFeatureFlags(e){if(this._is_bot())i.logInfo("Refusing to render web experiment since the viewer is a likely bot");else if(!this.instance.config.disable_web_experiments){if(ee(this._flagToExperiments))return this._flagToExperiments=new Map,this.loadIfEnabled(),void this.previewWebExperiment();i.logInfo("applying feature flags",e),e.forEach(t=>{var r;if(this._flagToExperiments&&(r=this._flagToExperiments)!==null&&r!==void 0&&r.has(t)){var n,s=this.instance.getFeatureFlag(t),o=(n=this._flagToExperiments)===null||n===void 0?void 0:n.get(t);s&&o!=null&&o.variants[s]&&this.applyTransforms(o.name,s,o.variants[s].transforms)}})}}previewWebExperiment(){var e=i.getWindowLocation();if(e!=null&&e.search){var t=gs(e?.search,"__experiment_id"),r=gs(e?.search,"__experiment_variant");t&&r&&(i.logInfo("previewing web experiments ".concat(t," && ").concat(r)),this.getWebExperiments(n=>{this.showPreviewWebExperiment(parseInt(t),r,n)},!1,!0))}}loadIfEnabled(){this.instance.config.disable_web_experiments||this.getWebExperimentsAndEvaluateDisplayLogic()}getWebExperiments(e,t,r){if(this.instance.config.disable_web_experiments&&!r)return e([]);var n=this.instance.get_property("$web_experiments");if(n&&!t)return e(n);this.instance._send_request({url:this.instance.requestRouter.endpointFor("api","/api/web_experiments/?token=".concat(this.instance.config.token)),method:"GET",transport:"XHR",callback:s=>{if(s.statusCode!==200||!s.json)return e([]);var o=s.json.experiments||[];return e(o)}})}showPreviewWebExperiment(e,t,r){var n=r.filter(s=>s.id===e);n&&n.length>0&&(i.logInfo("Previewing web experiment [".concat(n[0].name,"] with variant [").concat(t,"]")),this.applyTransforms(n[0].name,t,n[0].variants[t].transforms,!0))}static matchesTestVariant(e){return!ee(e.conditions)&&i.matchUrlConditions(e)&&i.matchUTMConditions(e)}static matchUrlConditions(e){var t;if(ee(e.conditions)||ee((t=e.conditions)===null||t===void 0?void 0:t.url))return!0;var r,n,s,o=i.getWindowLocation();return!!o&&((r=e.conditions)===null||r===void 0||!r.url||Ag[(n=(s=e.conditions)===null||s===void 0?void 0:s.urlMatchType)!==null&&n!==void 0?n:"icontains"](e.conditions.url,o))}static getWindowLocation(){return v?.location}static matchUTMConditions(e){var t;if(ee(e.conditions)||ee((t=e.conditions)===null||t===void 0?void 0:t.utm))return!0;var r=oe.campaignParams();if(r.utm_source){var n,s,o,l,a,c,d,u,p,h,g,m,x,S,_,A,R=(n=e.conditions)===null||n===void 0||(s=n.utm)===null||s===void 0||!s.utm_campaign||((o=e.conditions)===null||o===void 0||(l=o.utm)===null||l===void 0?void 0:l.utm_campaign)==r.utm_campaign,q=(a=e.conditions)===null||a===void 0||(c=a.utm)===null||c===void 0||!c.utm_source||((d=e.conditions)===null||d===void 0||(u=d.utm)===null||u===void 0?void 0:u.utm_source)==r.utm_source,X=(p=e.conditions)===null||p===void 0||(h=p.utm)===null||h===void 0||!h.utm_medium||((g=e.conditions)===null||g===void 0||(m=g.utm)===null||m===void 0?void 0:m.utm_medium)==r.utm_medium,z=(x=e.conditions)===null||x===void 0||(S=x.utm)===null||S===void 0||!S.utm_term||((_=e.conditions)===null||_===void 0||(A=_.utm)===null||A===void 0?void 0:A.utm_term)==r.utm_term;return R&&X&&z&&q}return!1}static logInfo(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];D.info("[WebExperiments] ".concat(e),r)}applyTransforms(e,t,r,n){var s;this._is_bot()?i.logInfo("Refusing to render web experiment since the viewer is a likely bot"):t!=="control"?r.forEach(o=>{if(o.selector){var l;i.logInfo("applying transform of variant ".concat(t," for experiment ").concat(e," "),o);var a,c=0,d=(l=document)===null||l===void 0?void 0:l.querySelectorAll(o.selector);d?.forEach(u=>{var p=u;c+=1,o.attributes&&o.attributes.forEach(h=>{switch(h.name){case"text":p.innerText=h.value;break;case"html":p.innerHTML=h.value;break;case"cssClass":p.className=h.value;break;default:p.setAttribute(h.name,h.value)}}),o.text&&(p.innerText=o.text),o.html&&(p.parentElement?p.parentElement.innerHTML=o.html:p.innerHTML=o.html),o.css&&p.setAttribute("style",o.css)}),this.instance&&this.instance.capture&&this.instance.capture("$web_experiment_applied",{$web_experiment_name:e,$web_experiment_variant:t,$web_experiment_preview:n,$web_experiment_document_url:(a=i.getWindowLocation())===null||a===void 0?void 0:a.href,$web_experiment_elements_modified:c})}}):(i.logInfo("Control variants leave the page unmodified."),this.instance&&this.instance.capture&&this.instance.capture("$web_experiment_applied",{$web_experiment_name:e,$web_experiment_preview:n,$web_experiment_variant:t,$web_experiment_document_url:(s=i.getWindowLocation())===null||s===void 0?void 0:s.href,$web_experiment_elements_modified:0}))}_is_bot(){return Xe&&this.instance?Pp(Xe,this.instance.config.custom_blocked_useragents):void 0}},dl=class{constructor(e){this.instance=e}sendExceptionEvent(e){this.instance.capture("$exception",e,{_noTruncate:!0,_batchKey:"exceptionEvent"})}},Tg=["$set_once","$set"],pi=ze("[SiteApps]"),pl=class{constructor(e){this.instance=e,this.bufferedInvocations=[],this.apps={}}get isEnabled(){return!!this.instance.config.opt_in_site_apps}eventCollector(e,t){if(t){var r=this.globalsForEvent(t);this.bufferedInvocations.push(r),this.bufferedInvocations.length>1e3&&(this.bufferedInvocations=this.bufferedInvocations.slice(10))}}init(){if(this.isEnabled){var e=this.instance._addCaptureHook(this.eventCollector.bind(this));this.stopBuffering=()=>{e(),this.bufferedInvocations=[],this.stopBuffering=void 0}}}globalsForEvent(e){var t,r,n,s,o,l,a;if(!e)throw new Error("Event payload is required");var c={},d=this.instance.get_property("$groups")||[],u=this.instance.get_property("$stored_group_properties")||{};for(var[p,h]of Object.entries(u))c[p]={id:d[p],type:p,properties:h};var{$set_once:g,$set:m}=e;return{event:b(b({},Rd(e,Tg)),{},{properties:b(b(b({},e.properties),m?{$set:b(b({},(t=(r=e.properties)===null||r===void 0?void 0:r.$set)!==null&&t!==void 0?t:{}),m)}:{}),g?{$set_once:b(b({},(n=(s=e.properties)===null||s===void 0?void 0:s.$set_once)!==null&&n!==void 0?n:{}),g)}:{}),elements_chain:(o=(l=e.properties)===null||l===void 0?void 0:l.$elements_chain)!==null&&o!==void 0?o:"",distinct_id:(a=e.properties)===null||a===void 0?void 0:a.distinct_id}),person:{properties:this.instance.get_property("$stored_person_properties")},groups:c}}setupSiteApp(e){var t={id:e.id,loaded:!1,errored:!1};this.apps[e.id]=t;var r=s=>{var o;for(var l of(this.apps[e.id].errored=!s,this.apps[e.id].loaded=!0,pi.info("Site app with id ".concat(e.id," ").concat(s?"loaded":"errored")),s&&this.bufferedInvocations.length&&(pi.info("Processing ".concat(this.bufferedInvocations.length," events for site app with id ").concat(e.id)),this.bufferedInvocations.forEach(a=>{var c;return(c=t.processEvent)===null||c===void 0?void 0:c.call(t,a)})),Object.values(this.apps)))if(!l.loaded)return;(o=this.stopBuffering)===null||o===void 0||o.call(this)};try{var{processEvent:n}=e.init({posthog:this.instance,callback:s=>{r(s)}});n&&(t.processEvent=n)}catch(s){pi.error("Error while initializing PostHog app with config id ".concat(e.id),s),r(!1)}}onCapturedEvent(e){if(Object.keys(this.apps).length!==0){var t=this.globalsForEvent(e);for(var r of Object.values(this.apps))try{var n;(n=r.processEvent)===null||n===void 0||n.call(r,t)}catch(s){pi.error("Error while processing event ".concat(e.event," for site app ").concat(r.id),s)}}}onRemoteConfig(e){var t,r,n=this;if(ce(j._POSTHOG_JS_APPS)){if(!this.isEnabled)return void pi.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.');for(var s of j._POSTHOG_JS_APPS)this.setupSiteApp(s);var o;j._POSTHOG_JS_APPS.length?this.instance.on("eventCaptured",d=>this.onCapturedEvent(d)):(o=this.stopBuffering)===null||o===void 0||o.call(this)}else if((t=this.stopBuffering)===null||t===void 0||t.call(this),(r=e.siteApps)!==null&&r!==void 0&&r.length)if(this.isEnabled){var l=function(d,u){var p,h;j["__$$ph_site_app_".concat(d)]=n.instance,(p=j.__PosthogExtensions__)===null||p===void 0||(h=p.loadSiteApp)===null||h===void 0||h.call(p,n.instance,u,g=>{if(g)return pi.error("Error while initializing PostHog app with config id ".concat(d),g)})};for(var{id:a,url:c}of e.siteApps)l(a,c)}else pi.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}},Hr={},hl=()=>{},Bi="posthog",Rp=!cg&&ke?.indexOf("MSIE")===-1&&ke?.indexOf("Mozilla")===-1,Ad=()=>{var i,e,t;return{api_host:"https://us.i.posthog.com",ui_host:null,token:"",autocapture:!0,rageclick:!0,cross_subdomain_cookie:(e=O?.location,t=e?.hostname,!!Ce(t)&&t.split(".").slice(-2).join(".")!=="herokuapp.com"),persistence:"localStorage+cookie",persistence_name:"",loaded:hl,store_google:!0,custom_campaign_params:[],custom_blocked_useragents:[],save_referrer:!0,capture_pageview:!0,capture_pageleave:"if_capture_pageview",debug:Be&&Ce(Be?.search)&&Be.search.indexOf("__posthog_debug=true")!==-1||!1,verbose:!1,cookie_expiration:365,upgrade:!1,disable_session_recording:!1,disable_persistence:!1,disable_web_experiments:!0,disable_surveys:!1,enable_recording_console_log:void 0,secure_cookie:(v==null||(i=v.location)===null||i===void 0?void 0:i.protocol)==="https:",ip:!0,opt_out_capturing_by_default:!1,opt_out_persistence_by_default:!1,opt_out_useragent_filter:!1,opt_out_capturing_persistence_type:"localStorage",opt_out_capturing_cookie_prefix:null,opt_in_site_apps:!1,property_denylist:[],respect_dnt:!1,sanitize_properties:null,request_headers:{},inapp_protocol:"//",inapp_link_new_window:!1,request_batching:!0,properties_string_max_length:65535,session_recording:{},mask_all_element_attributes:!1,mask_all_text:!1,advanced_disable_decide:!1,advanced_disable_feature_flags:!1,advanced_disable_feature_flags_on_first_load:!1,advanced_disable_toolbar_metrics:!1,feature_flag_request_timeout_ms:3e3,on_request_error:r=>{var n="Bad HTTP status: "+r.statusCode+" "+r.text;D.error(n)},get_device_id:r=>r,_onCapture:hl,capture_performance:void 0,name:"posthog",bootstrap:{},disable_compression:!1,session_idle_timeout_seconds:1800,person_profiles:"identified_only",__add_tracing_headers:!1,before_send:void 0}},Td=i=>{var e={};F(i.process_person)||(e.person_profiles=i.process_person),F(i.xhr_headers)||(e.request_headers=i.xhr_headers),F(i.cookie_name)||(e.persistence_name=i.cookie_name),F(i.disable_cookie)||(e.disable_persistence=i.disable_cookie);var t=De({},e,i);return ce(i.property_blacklist)&&(F(i.property_denylist)?t.property_denylist=i.property_blacklist:ce(i.property_denylist)?t.property_denylist=[...i.property_blacklist,...i.property_denylist]:D.error("Invalid value for property_denylist config: "+i.property_denylist)),t},fl=class{constructor(){C(this,"__forceAllowLocalhost",!1)}get _forceAllowLocalhost(){return this.__forceAllowLocalhost}set _forceAllowLocalhost(e){D.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=e}},Is=class i{constructor(){C(this,"webPerformance",new fl),C(this,"version",Nt.LIB_VERSION),C(this,"_internalEventEmitter",new Ss),this.config=Ad(),this.decideEndpointWasHit=!1,this.SentryIntegration=Ga,this.sentryIntegration=e=>function(t,r){var n=bp(t,r);return{name:yp,processEvent:s=>n(s)}}(this,e),this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this._initialPageviewCaptured=!1,this._initialPersonProfilesConfig=null,this.featureFlags=new xa(this),this.toolbar=new Ba(this),this.scrollManager=new nl(this),this.pageViewManager=new Ja(this),this.surveys=new el(this),this.experiments=new cl(this),this.exceptions=new dl(this),this.rateLimiter=new tl(this),this.requestRouter=new Va(this),this.consent=new al(this),this.people={set:(e,t,r)=>{var n=Ce(e)?{[e]:t}:e;this.setPersonProperties(n),r?.({})},set_once:(e,t,r)=>{var n=Ce(e)?{[e]:t}:e;this.setPersonProperties(void 0,n),r?.({})}},this.on("eventCaptured",e=>D.info('send "'.concat(e?.event,'"'),e))}init(e,t,r){if(r&&r!==Bi){var n,s=(n=Hr[r])!==null&&n!==void 0?n:new i;return s._init(e,t,r),Hr[r]=s,Hr[Bi][r]=s,s}return this._init(e,t,r)}_init(e){var t,r,n,s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},o=arguments.length>2?arguments[2]:void 0;if(F(e)||Uc(e))return D.critical("PostHog was initialized without a token. This likely indicates a misconfiguration. Please check the first argument passed to posthog.init()"),this;if(this.__loaded)return D.warn("You have already initialized PostHog! Re-initializing is a no-op"),this;this.__loaded=!0,this.config={},this._triggered_notifs=[],s.person_profiles&&(this._initialPersonProfilesConfig=s.person_profiles),this.set_config(De({},Ad(),Td(s),{name:o,token:e})),this.config.on_xhr_error&&D.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=s.disable_compression?void 0:lt.GZipJS,this.persistence=new jr(this.config),this.sessionPersistence=this.config.persistence==="sessionStorage"||this.config.persistence==="memory"?this.persistence:new jr(b(b({},this.config),{},{persistence:"sessionStorage"}));var l=b({},this.persistence.props),a=b({},this.sessionPersistence.props);if(this._requestQueue=new Ha(_=>this._send_retriable_request(_)),this._retryQueue=new za(this),this.__request_queue=[],this.sessionManager=new Wa(this),this.sessionPropsManager=new il(this.sessionManager,this.persistence),new ol(this).startIfEnabledOrStop(),this.siteApps=new pl(this),(t=this.siteApps)===null||t===void 0||t.init(),this.sessionRecording=new ja(this),this.sessionRecording.startIfEnabledOrStop(),this.config.disable_scroll_properties||this.scrollManager.startMeasuringScrollPosition(),this.autocapture=new sl(this),this.autocapture.startIfEnabled(),this.surveys.loadIfEnabled(),this.heatmaps=new rl(this),this.heatmaps.startIfEnabled(),this.webVitalsAutocapture=new ul(this),this.exceptionObserver=new ll(this),this.exceptionObserver.startIfEnabled(),this.deadClicksAutocapture=new $s(this,kg),this.deadClicksAutocapture.startIfEnabled(),Nt.DEBUG=Nt.DEBUG||this.config.debug,Nt.DEBUG&&D.info("Starting in debug mode",{this:this,config:s,thisC:b({},this.config),p:l,s:a}),this._sync_opt_out_with_persistence(),((r=s.bootstrap)===null||r===void 0?void 0:r.distinctID)!==void 0){var c,d,u=this.config.get_device_id(qt()),p=(c=s.bootstrap)!==null&&c!==void 0&&c.isIdentifiedID?u:s.bootstrap.distinctID;this.persistence.set_property(kt,(d=s.bootstrap)!==null&&d!==void 0&&d.isIdentifiedID?"identified":"anonymous"),this.register({distinct_id:s.bootstrap.distinctID,$device_id:p})}if(this._hasBootstrappedFeatureFlags()){var h,g,m=Object.keys(((h=s.bootstrap)===null||h===void 0?void 0:h.featureFlags)||{}).filter(_=>{var A,R;return!((A=s.bootstrap)===null||A===void 0||(R=A.featureFlags)===null||R===void 0||!R[_])}).reduce((_,A)=>{var R,q;return _[A]=((R=s.bootstrap)===null||R===void 0||(q=R.featureFlags)===null||q===void 0?void 0:q[A])||!1,_},{}),x=Object.keys(((g=s.bootstrap)===null||g===void 0?void 0:g.featureFlagPayloads)||{}).filter(_=>m[_]).reduce((_,A)=>{var R,q,X,z;return(R=s.bootstrap)!==null&&R!==void 0&&(q=R.featureFlagPayloads)!==null&&q!==void 0&&q[A]&&(_[A]=(X=s.bootstrap)===null||X===void 0||(z=X.featureFlagPayloads)===null||z===void 0?void 0:z[A]),_},{});this.featureFlags.receivedFeatureFlags({featureFlags:m,featureFlagPayloads:x})}if(!this.get_distinct_id()){var S=this.config.get_device_id(qt());this.register_once({distinct_id:S,$device_id:S},""),this.persistence.set_property(kt,"anonymous")}return v==null||(n=v.addEventListener)===null||n===void 0||n.call(v,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this)),this.toolbar.maybeLoadToolbar(),s.segment?pg(this,()=>this._loaded()):this._loaded(),Qe(this.config._onCapture)&&this.config._onCapture!==hl&&(D.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",_=>this.config._onCapture(_.event,_))),this}_onRemoteConfig(e){var t,r,n,s,o,l,a,c,d;this.compression=void 0,e.supportedCompression&&!this.config.disable_compression&&(this.compression=W(e.supportedCompression,lt.GZipJS)?lt.GZipJS:W(e.supportedCompression,lt.Base64)?lt.Base64:void 0),(t=e.analytics)!==null&&t!==void 0&&t.endpoint&&(this.analyticsDefaultEndpoint=e.analytics.endpoint),this.set_config({person_profiles:this._initialPersonProfilesConfig?this._initialPersonProfilesConfig:e.defaultIdentifiedOnly?"identified_only":"always"}),(r=this.siteApps)===null||r===void 0||r.onRemoteConfig(e),(n=this.sessionRecording)===null||n===void 0||n.onRemoteConfig(e),(s=this.autocapture)===null||s===void 0||s.onRemoteConfig(e),(o=this.heatmaps)===null||o===void 0||o.onRemoteConfig(e),(l=this.surveys)===null||l===void 0||l.onRemoteConfig(e),(a=this.webVitalsAutocapture)===null||a===void 0||a.onRemoteConfig(e),(c=this.exceptionObserver)===null||c===void 0||c.onRemoteConfig(e),(d=this.deadClicksAutocapture)===null||d===void 0||d.onRemoteConfig(e)}_loaded(){this.config.advanced_disable_decide||this.featureFlags.setReloadingPaused(!0);try{this.config.loaded(this)}catch(e){D.critical("`loaded` function failed",e)}this._start_queue_if_opted_in(),this.config.capture_pageview&&setTimeout(()=>{this.consent.isOptedIn()&&this._captureInitialPageview()},1),new qa(this).call()}_start_queue_if_opted_in(){var e;this.has_opted_out_capturing()||this.config.request_batching&&((e=this._requestQueue)===null||e===void 0||e.enable())}_dom_loaded(){this.has_opted_out_capturing()||Vi(this.__request_queue,e=>this._send_retriable_request(e)),this.__request_queue=[],this._start_queue_if_opted_in()}_handle_unload(){var e,t;this.config.request_batching?(this._shouldCapturePageleave()&&this.capture("$pageleave"),(e=this._requestQueue)===null||e===void 0||e.unload(),(t=this._retryQueue)===null||t===void 0||t.unload()):this._shouldCapturePageleave()&&this.capture("$pageleave",null,{transport:"sendBeacon"})}_send_request(e){this.__loaded&&(Rp?this.__request_queue.push(e):this.rateLimiter.isServerRateLimited(e.batchKey)||(e.transport=e.transport||this.config.api_transport,e.url=xs(e.url,{ip:this.config.ip?1:0}),e.headers=b({},this.config.request_headers),e.compression=e.compression==="best-available"?this.compression:e.compression,(t=>{var r,n,s,o=b({},t);o.timeout=o.timeout||6e4,o.url=xs(o.url,{_:new Date().getTime().toString(),ver:Nt.LIB_VERSION,compression:o.compression});var l=(r=o.transport)!==null&&r!==void 0?r:"XHR",a=(n=(s=Ld(Br,c=>c.transport===l))===null||s===void 0?void 0:s.method)!==null&&n!==void 0?n:Br[0].method;if(!a)throw new Error("No available transport method");a(o)})(b(b({},e),{},{callback:t=>{var r,n,s;this.rateLimiter.checkForLimiting(t),t.statusCode>=400&&((n=(s=this.config).on_request_error)===null||n===void 0||n.call(s,t)),(r=e.callback)===null||r===void 0||r.call(e,t)}}))))}_send_retriable_request(e){this._retryQueue?this._retryQueue.retriableRequest(e):this._send_request(e)}_execute_array(e){var t,r=[],n=[],s=[];Vi(e,l=>{l&&(t=l[0],ce(t)?s.push(l):Qe(l)?l.call(this):ce(l)&&t==="alias"?r.push(l):ce(l)&&t.indexOf("capture")!==-1&&Qe(this[t])?s.push(l):n.push(l))});var o=function(l,a){Vi(l,function(c){if(ce(c[0])){var d=a;K(c,function(u){d=d[u[0]].apply(d,u.slice(1))})}else this[c[0]].apply(this,c.slice(1))},a)};o(r,this),o(n,this),o(s,this)}_hasBootstrappedFeatureFlags(){var e,t;return((e=this.config.bootstrap)===null||e===void 0?void 0:e.featureFlags)&&Object.keys((t=this.config.bootstrap)===null||t===void 0?void 0:t.featureFlags).length>0||!1}push(e){this._execute_array([e])}capture(e,t,r){var n;if(this.__loaded&&this.persistence&&this.sessionPersistence&&this._requestQueue){if(!this.consent.isOptedOut())if(!F(e)&&Ce(e)){if(this.config.opt_out_useragent_filter||!this._is_bot()){var s=r!=null&&r.skip_client_rate_limiting?void 0:this.rateLimiter.clientRateLimitContext();if(s==null||!s.isRateLimited){this.sessionPersistence.update_search_keyword(),this.config.store_google&&this.sessionPersistence.update_campaign_params(),this.config.save_referrer&&this.sessionPersistence.update_referrer_info(),(this.config.store_google||this.config.save_referrer)&&this.persistence.set_initial_person_info();var o=new Date,l=r?.timestamp||o,a={uuid:qt(),event:e,properties:this._calculate_event_properties(e,t||{},l)};s&&(a.properties.$lib_rate_limit_remaining_tokens=s.remainingTokens),r?.$set&&(a.$set=r?.$set);var c=this._calculate_set_once_properties(r?.$set_once);c&&(a.$set_once=c),(a=yf(a,r!=null&&r._noTruncate?null:this.config.properties_string_max_length)).timestamp=l,F(r?.timestamp)||(a.properties.$event_time_override_provided=!0,a.properties.$event_time_override_system_time=o);var d=b(b({},a.properties.$set),a.$set);if(Hi(d)||this.setPersonPropertiesForFlags(d),!ee(this.config.before_send)){var u=this._runBeforeSend(a);if(!u)return;a=u}this._internalEventEmitter.emit("eventCaptured",a);var p={method:"POST",url:(n=r?._url)!==null&&n!==void 0?n:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),data:a,compression:"best-available",batchKey:r?._batchKey};return!this.config.request_batching||r&&(r==null||!r._batchKey)||r!=null&&r.send_instantly?this._send_retriable_request(p):this._requestQueue.enqueue(p),a}D.critical("This capture call is ignored due to client rate limiting.")}}else D.error("No event name provided to posthog.capture")}else D.uninitializedWarning("posthog.capture")}_addCaptureHook(e){return this.on("eventCaptured",t=>e(t.event,t))}_calculate_event_properties(e,t,r){if(r=r||new Date,!this.persistence||!this.sessionPersistence)return t;var n=this.persistence.remove_event_timer(e),s=b({},t);if(s.token=this.config.token,e==="$snapshot"){var o=b(b({},this.persistence.properties()),this.sessionPersistence.properties());return s.distinct_id=o.distinct_id,(!Ce(s.distinct_id)&&!Je(s.distinct_id)||Uc(s.distinct_id))&&D.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),s}var l=oe.properties();if(this.sessionManager){var{sessionId:a,windowId:c}=this.sessionManager.checkAndGetSessionAndWindowId();s.$session_id=a,s.$window_id=c}if(this.sessionRecording&&(s.$recording_status=this.sessionRecording.status),this.requestRouter.region===gi.CUSTOM&&(s.$lib_custom_api_host=this.config.api_host),this.sessionPropsManager&&this.config.__preview_send_client_session_params&&(e==="$pageview"||e==="$pageleave"||e==="$autocapture")){var d=this.sessionPropsManager.getSessionProps();s=De(s,d)}if(!this.config.disable_scroll_properties){var u={};e==="$pageview"?u=this.pageViewManager.doPageView(r):e==="$pageleave"&&(u=this.pageViewManager.doPageLeave(r)),s=De(s,u)}if(e==="$pageview"&&O&&(s.title=O.title),!F(n)){var p=r.getTime()-n;s.$duration=parseFloat((p/1e3).toFixed(3))}ke&&this.config.opt_out_useragent_filter&&(s.$browser_type=this._is_bot()?"bot":"browser"),(s=De({},l,this.persistence.properties(),this.sessionPersistence.properties(),s)).$is_identified=this._isIdentified(),ce(this.config.property_denylist)?K(this.config.property_denylist,function(m){delete s[m]}):D.error("Invalid value for property_denylist config: "+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);var h=this.config.sanitize_properties;h&&(s=h(s,e));var g=this._hasPersonProcessing();return s.$process_person_profile=g,g&&this._requirePersonProcessing("_calculate_event_properties"),s}_calculate_set_once_properties(e){if(!this.persistence||!this._hasPersonProcessing())return e;var t=De({},this.persistence.get_initial_props(),e||{}),r=this.config.sanitize_properties;return r&&(t=r(t,"$set_once")),Hi(t)?void 0:t}register(e,t){var r;(r=this.persistence)===null||r===void 0||r.register(e,t)}register_once(e,t,r){var n;(n=this.persistence)===null||n===void 0||n.register_once(e,t,r)}register_for_session(e){var t;(t=this.sessionPersistence)===null||t===void 0||t.register(e)}unregister(e){var t;(t=this.persistence)===null||t===void 0||t.unregister(e)}unregister_for_session(e){var t;(t=this.sessionPersistence)===null||t===void 0||t.unregister(e)}_register_single(e,t){this.register({[e]:t})}getFeatureFlag(e,t){return this.featureFlags.getFeatureFlag(e,t)}getFeatureFlagPayload(e){var t=this.featureFlags.getFeatureFlagPayload(e);try{return JSON.parse(t)}catch{return t}}isFeatureEnabled(e,t){return this.featureFlags.isFeatureEnabled(e,t)}reloadFeatureFlags(){this.featureFlags.reloadFeatureFlags()}updateEarlyAccessFeatureEnrollment(e,t){this.featureFlags.updateEarlyAccessFeatureEnrollment(e,t)}getEarlyAccessFeatures(e){var t=arguments.length>1&&arguments[1]!==void 0&&arguments[1];return this.featureFlags.getEarlyAccessFeatures(e,t)}on(e,t){return this._internalEventEmitter.on(e,t)}onFeatureFlags(e){return this.featureFlags.onFeatureFlags(e)}onSessionId(e){var t,r;return(t=(r=this.sessionManager)===null||r===void 0?void 0:r.onSessionId(e))!==null&&t!==void 0?t:()=>{}}getSurveys(e){var t=arguments.length>1&&arguments[1]!==void 0&&arguments[1];this.surveys.getSurveys(e,t)}getActiveMatchingSurveys(e){var t=arguments.length>1&&arguments[1]!==void 0&&arguments[1];this.surveys.getActiveMatchingSurveys(e,t)}renderSurvey(e,t){this.surveys.renderSurvey(e,t)}canRenderSurvey(e){this.surveys.canRenderSurvey(e)}getNextSurveyStep(e,t,r){return this.surveys.getNextSurveyStep(e,t,r)}identify(e,t,r){if(!this.__loaded||!this.persistence)return D.uninitializedWarning("posthog.identify");if(Je(e)&&(e=e.toString(),D.warn("The first argument to posthog.identify was a number, but it should be a string. It has been converted to a string.")),e){if(["distinct_id","distinctid"].includes(e.toLowerCase()))D.critical('The string "'.concat(e,'" was set in posthog.identify which indicates an error. This ID should be unique to the user and not a hardcoded string.'));else if(this._requirePersonProcessing("posthog.identify")){var n=this.get_distinct_id();if(this.register({$user_id:e}),!this.get_property("$device_id")){var s=n;this.register_once({$had_persisted_distinct_id:!0,$device_id:s},"")}e!==n&&e!==this.get_property(Dr)&&(this.unregister(Dr),this.register({distinct_id:e}));var o=(this.persistence.get_property(kt)||"anonymous")==="anonymous";e!==n&&o?(this.persistence.set_property(kt,"identified"),this.setPersonPropertiesForFlags(t||{},!1),this.capture("$identify",{distinct_id:e,$anon_distinct_id:n},{$set:t||{},$set_once:r||{}}),this.featureFlags.setAnonymousDistinctId(n)):(t||r)&&this.setPersonProperties(t,r),e!==n&&(this.reloadFeatureFlags(),this.unregister(hs))}}else D.error("Unique user id has not been set in posthog.identify")}setPersonProperties(e,t){(e||t)&&this._requirePersonProcessing("posthog.setPersonProperties")&&(this.setPersonPropertiesForFlags(e||{}),this.capture("$set",{$set:e||{},$set_once:t||{}}))}group(e,t,r){if(e&&t){if(this._requirePersonProcessing("posthog.group")){var n=this.getGroups();n[e]!==t&&this.resetGroupPropertiesForFlags(e),this.register({$groups:b(b({},n),{},{[e]:t})}),r&&(this.capture("$groupidentify",{$group_type:e,$group_key:t,$group_set:r}),this.setGroupPropertiesForFlags({[e]:r})),n[e]===t||r||this.reloadFeatureFlags()}}else D.error("posthog.group requires a group type and group key")}resetGroups(){this.register({$groups:{}}),this.resetGroupPropertiesForFlags(),this.reloadFeatureFlags()}setPersonPropertiesForFlags(e){var t=!(arguments.length>1&&arguments[1]!==void 0)||arguments[1];this._requirePersonProcessing("posthog.setPersonPropertiesForFlags")&&this.featureFlags.setPersonPropertiesForFlags(e,t)}resetPersonPropertiesForFlags(){this.featureFlags.resetPersonPropertiesForFlags()}setGroupPropertiesForFlags(e){var t=!(arguments.length>1&&arguments[1]!==void 0)||arguments[1];this._requirePersonProcessing("posthog.setGroupPropertiesForFlags")&&this.featureFlags.setGroupPropertiesForFlags(e,t)}resetGroupPropertiesForFlags(e){this.featureFlags.resetGroupPropertiesForFlags(e)}reset(e){var t,r,n,s,o;if(D.info("reset"),!this.__loaded)return D.uninitializedWarning("posthog.reset");var l=this.get_property("$device_id");this.consent.reset(),(t=this.persistence)===null||t===void 0||t.clear(),(r=this.sessionPersistence)===null||r===void 0||r.clear(),(n=this.surveys)===null||n===void 0||n.reset(),(s=this.persistence)===null||s===void 0||s.set_property(kt,"anonymous"),(o=this.sessionManager)===null||o===void 0||o.resetSessionId();var a=this.config.get_device_id(qt());this.register_once({distinct_id:a,$device_id:e?a:l},"")}get_distinct_id(){return this.get_property("distinct_id")}getGroups(){return this.get_property("$groups")||{}}get_session_id(){var e,t;return(e=(t=this.sessionManager)===null||t===void 0?void 0:t.checkAndGetSessionAndWindowId(!0).sessionId)!==null&&e!==void 0?e:""}get_session_replay_url(e){if(!this.sessionManager)return"";var{sessionId:t,sessionStartTimestamp:r}=this.sessionManager.checkAndGetSessionAndWindowId(!0),n=this.requestRouter.endpointFor("ui","/project/".concat(this.config.token,"/replay/").concat(t));if(e!=null&&e.withTimestamp&&r){var s,o=(s=e.timestampLookBack)!==null&&s!==void 0?s:10;if(!r)return n;var l=Math.max(Math.floor((new Date().getTime()-r)/1e3)-o,0);n+="?t=".concat(l)}return n}alias(e,t){return e===this.get_property(Nd)?(D.critical("Attempting to create alias for existing People user - aborting."),-2):this._requirePersonProcessing("posthog.alias")?(F(t)&&(t=this.get_distinct_id()),e!==t?(this._register_single(Dr,e),this.capture("$create_alias",{alias:e,distinct_id:t})):(D.warn("alias matches current distinct_id - skipping api call."),this.identify(e),-1)):void 0}set_config(e){var t,r,n,s,o=b({},this.config);fe(e)&&(De(this.config,Td(e)),(t=this.persistence)===null||t===void 0||t.update_config(this.config,o),this.sessionPersistence=this.config.persistence==="sessionStorage"||this.config.persistence==="memory"?this.persistence:new jr(b(b({},this.config),{},{persistence:"sessionStorage"})),me.is_supported()&&me.get("ph_debug")==="true"&&(this.config.debug=!0),this.config.debug&&(Nt.DEBUG=!0,D.info("set_config",{config:e,oldConfig:o,newConfig:b({},this.config)})),(r=this.sessionRecording)===null||r===void 0||r.startIfEnabledOrStop(),(n=this.autocapture)===null||n===void 0||n.startIfEnabled(),(s=this.heatmaps)===null||s===void 0||s.startIfEnabled(),this.surveys.loadIfEnabled(),this._sync_opt_out_with_persistence())}startSessionRecording(e){var t=e===!0,r={sampling:t||!(e==null||!e.sampling),linked_flag:t||!(e==null||!e.linked_flag),url_trigger:t||!(e==null||!e.url_trigger),event_trigger:t||!(e==null||!e.event_trigger)};if(Object.values(r).some(Boolean)){var n,s,o,l,a;(n=this.sessionManager)===null||n===void 0||n.checkAndGetSessionAndWindowId(),r.sampling&&((s=this.sessionRecording)===null||s===void 0||s.overrideSampling()),r.linked_flag&&((o=this.sessionRecording)===null||o===void 0||o.overrideLinkedFlag()),r.url_trigger&&((l=this.sessionRecording)===null||l===void 0||l.overrideTrigger("url")),r.event_trigger&&((a=this.sessionRecording)===null||a===void 0||a.overrideTrigger("event"))}this.set_config({disable_session_recording:!1})}stopSessionRecording(){this.set_config({disable_session_recording:!0})}sessionRecordingStarted(){var e;return!((e=this.sessionRecording)===null||e===void 0||!e.started)}captureException(e,t){var r,n=new Error("PostHog syntheticException"),s=Qe((r=j.__PosthogExtensions__)===null||r===void 0?void 0:r.parseErrorAsProperties)?j.__PosthogExtensions__.parseErrorAsProperties([e.message,void 0,void 0,void 0,e],{syntheticException:n}):b({$exception_level:"error",$exception_list:[{type:e.name,value:e.message,mechanism:{handled:!0,synthetic:!1}}]},t);this.exceptions.sendExceptionEvent(s)}loadToolbar(e){return this.toolbar.loadToolbar(e)}get_property(e){var t;return(t=this.persistence)===null||t===void 0?void 0:t.props[e]}getSessionProperty(e){var t;return(t=this.sessionPersistence)===null||t===void 0?void 0:t.props[e]}toString(){var e,t=(e=this.config.name)!==null&&e!==void 0?e:Bi;return t!==Bi&&(t=Bi+"."+t),t}_isIdentified(){var e,t;return((e=this.persistence)===null||e===void 0?void 0:e.get_property(kt))==="identified"||((t=this.sessionPersistence)===null||t===void 0?void 0:t.get_property(kt))==="identified"}_hasPersonProcessing(){var e,t,r,n;return!(this.config.person_profiles==="never"||this.config.person_profiles==="identified_only"&&!this._isIdentified()&&Hi(this.getGroups())&&((e=this.persistence)===null||e===void 0||(t=e.props)===null||t===void 0||!t[Dr])&&((r=this.persistence)===null||r===void 0||(n=r.props)===null||n===void 0||!n[fs]))}_shouldCapturePageleave(){return this.config.capture_pageleave===!0||this.config.capture_pageleave==="if_capture_pageview"&&this.config.capture_pageview}createPersonProfile(){this._hasPersonProcessing()||this._requirePersonProcessing("posthog.createPersonProfile")&&this.setPersonProperties({},{})}_requirePersonProcessing(e){return this.config.person_profiles==="never"?(D.error(e+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this._register_single(fs,!0),!0)}_sync_opt_out_with_persistence(){var e,t,r,n,s=this.consent.isOptedOut(),o=this.config.opt_out_persistence_by_default,l=this.config.disable_persistence||s&&!!o;((e=this.persistence)===null||e===void 0?void 0:e.disabled)!==l&&((r=this.persistence)===null||r===void 0||r.set_disabled(l)),((t=this.sessionPersistence)===null||t===void 0?void 0:t.disabled)!==l&&((n=this.sessionPersistence)===null||n===void 0||n.set_disabled(l))}opt_in_capturing(e){var t;this.consent.optInOut(!0),this._sync_opt_out_with_persistence(),(F(e?.captureEventName)||e!=null&&e.captureEventName)&&this.capture((t=e?.captureEventName)!==null&&t!==void 0?t:"$opt_in",e?.captureProperties,{send_instantly:!0}),this.config.capture_pageview&&this._captureInitialPageview()}opt_out_capturing(){this.consent.optInOut(!1),this._sync_opt_out_with_persistence()}has_opted_in_capturing(){return this.consent.isOptedIn()}has_opted_out_capturing(){return this.consent.isOptedOut()}clear_opt_in_out_capturing(){this.consent.reset(),this._sync_opt_out_with_persistence()}_is_bot(){return Xe?Pp(Xe,this.config.custom_blocked_useragents):void 0}_captureInitialPageview(){O&&!this._initialPageviewCaptured&&(this._initialPageviewCaptured=!0,this.capture("$pageview",{title:O.title},{send_instantly:!0}))}debug(e){e===!1?(v?.console.log("You've disabled debug mode."),localStorage&&localStorage.removeItem("ph_debug"),this.set_config({debug:!1})):(v?.console.log("You're now in debug mode. All calls to PostHog will be logged in your console.\nYou can disable this with `posthog.debug(false)`."),localStorage&&localStorage.setItem("ph_debug","true"),this.set_config({debug:!0}))}_runBeforeSend(e){if(ee(this.config.before_send))return e;var t=ce(this.config.before_send)?this.config.before_send:[this.config.before_send],r=e;for(var n of t){if(r=n(r),ee(r)){var s="Event '".concat(e.event,"' was rejected in beforeSend function");return mf(e.event)?D.warn("".concat(s,". This can cause unexpected behavior.")):D.info(s),null}r.properties&&!Hi(r.properties)||D.warn("Event '".concat(e.event,"' has no properties after beforeSend function, this is likely an error."))}return r}};(function(i,e){for(var t=0;t<e.length;t++)i.prototype[e[t]]=_f(i.prototype[e[t]])})(Is,["identify"]);var Pd,Op=(Pd=Hr[Bi]=new Is,function(){function i(){i.done||(i.done=!0,Rp=!1,K(Hr,function(e){e._dom_loaded()}))}O!=null&&O.addEventListener&&(O.readyState==="complete"?i():O.addEventListener("DOMContentLoaded",i,!1)),v&&Ct(v,"load",i,!0)}(),Pd);var Fp=Op.init("phc_OTZ3wJ6VemgVupCRKS5Sbqb9Ks0JYe0hMYZPtLwl0nu",{api_host:"https://pheu.molin.ai",ui_host:"https://eu.posthog.com",secure_cookie:document.location.protocol==="https:",persistence:"cookie",autocapture:!1,rageclick:!1,capture_pageview:!1,capture_pageleave:!1,disable_session_recording:!0,advanced_disable_decide:!0},"MolinShopAI");function Ne(i,e){if(!Fp)throw new Error("Failed to initialize PostHog");Fp.capture(i,e)}var Fs,Kr,Ms,Wt,Dp,Os,Xr=class Xr extends J(H){constructor(){super();y(this,Wt);y(this,Fs,new Mt(this,{onError:console.error}));y(this,Kr);y(this,Ms,{onError:t=>{alert(t.error),console.error(t.widgetId,t.error),Ne("ShopAssistant: error",t),he("ShopAssistant: error",{...t,immediate:!0})},onNewMessageStartedStreaming:t=>{Ne("ShopAssistant: user received bot message (streaming started)",t),he("ShopAssistant: user received bot message (streaming started)",t)},onMessageEndedStreaming:t=>{Ne("ShopAssistant: user received bot message (streaming ended)",t),he("ShopAssistant: user received bot message (streaming ended)",t)},onUserCanceledStreaming:t=>{Ne("ShopAssistant: user canceled streaming",t),he("ShopAssistant: user canceled streaming",t)},onUserClickedLink:t=>{Ne("ShopAssistant: user clicked link",t),he("ShopAssistant: user clicked link",t)},onUserSentInput:t=>{Ne("ShopAssistant: user sent input",t),he("ShopAssistant: user sent input",t)}});this.cdn="https://widget.molin.ai",this.widgetId="",this.showClose=!1,this.xUserData="",this.xPromptExt=""}get config(){return f(this,Kr)||f(this,Fs).data}render(){return this.config?L`
400
400
  <!-- embed our chat component forwarding props -->
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@molin.ai/shop-ai",
3
- "version": "0.7.18",
3
+ "version": "0.7.19",
4
4
  "description": "Molin Shop AI",
5
5
  "keywords": [
6
6
  "molin",