@debales/ai 1.1.3-canary.1 → 1.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser/ai-browser.js +4 -4
- package/dist/browser/constants/index.d.ts +1 -1
- package/dist/module/ai.js +1873 -1873
- package/dist/module/ai.umd.js +87 -87
- package/dist/module/constants/index.d.ts +1 -1
- package/package.json +2 -2
|
@@ -75,7 +75,7 @@ Error generating stack: `+f.message+`
|
|
|
75
75
|
`,...o.current()});return/^[\t ]/.test(d)&&(d=Tc(d.charCodeAt(0))+d.slice(1)),d=d?s+" "+d:s,n.options.closeAtx&&(d+=" "+s),c(),u(),d}ok.peek=hF;function ok(e){return e.value||""}function hF(){return"<"}ak.peek=pF;function ak(e,t,n,r){const i=Dy(n),o=i==='"'?"Quote":"Apostrophe",s=n.enter("image");let u=n.enter("label");const c=n.createTracker(r);let d=c.move("![");return d+=c.move(n.safe(e.alt,{before:d,after:"]",...c.current()})),d+=c.move("]("),u(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(u=n.enter("destinationLiteral"),d+=c.move("<"),d+=c.move(n.safe(e.url,{before:d,after:">",...c.current()})),d+=c.move(">")):(u=n.enter("destinationRaw"),d+=c.move(n.safe(e.url,{before:d,after:e.title?" ":")",...c.current()}))),u(),e.title&&(u=n.enter(`title${o}`),d+=c.move(" "+i),d+=c.move(n.safe(e.title,{before:d,after:i,...c.current()})),d+=c.move(i),u()),d+=c.move(")"),s(),d}function pF(){return"!"}sk.peek=gF;function sk(e,t,n,r){const i=e.referenceType,o=n.enter("imageReference");let s=n.enter("label");const u=n.createTracker(r);let c=u.move("![");const d=n.safe(e.alt,{before:c,after:"]",...u.current()});c+=u.move(d+"]["),s();const p=n.stack;n.stack=[],s=n.enter("reference");const h=n.safe(n.associationId(e),{before:c,after:"]",...u.current()});return s(),n.stack=p,o(),i==="full"||!d||d!==h?c+=u.move(h+"]"):i==="shortcut"?c=c.slice(0,-1):c+=u.move("]"),c}function gF(){return"!"}lk.peek=mF;function lk(e,t,n){let r=e.value||"",i="`",o=-1;for(;new RegExp("(^|[^`])"+i+"([^`]|$)").test(r);)i+="`";for(/[^ \r\n]/.test(r)&&(/^[ \r\n]/.test(r)&&/[ \r\n]$/.test(r)||/^`|`$/.test(r))&&(r=" "+r+" ");++o<n.unsafe.length;){const s=n.unsafe[o],u=n.compilePattern(s);let c;if(s.atBreak)for(;c=u.exec(r);){let d=c.index;r.charCodeAt(d)===10&&r.charCodeAt(d-1)===13&&d--,r=r.slice(0,d)+" "+r.slice(c.index+1)}}return i+r+i}function mF(){return"`"}function uk(e,t){const n=oy(e);return!!(!t.options.resourceLink&&e.url&&!e.title&&e.children&&e.children.length===1&&e.children[0].type==="text"&&(n===e.url||"mailto:"+n===e.url)&&/^[a-z][a-z+.-]+:/i.test(e.url)&&!/[\0- <>\u007F]/.test(e.url))}ck.peek=vF;function ck(e,t,n,r){const i=Dy(n),o=i==='"'?"Quote":"Apostrophe",s=n.createTracker(r);let u,c;if(uk(e,n)){const p=n.stack;n.stack=[],u=n.enter("autolink");let h=s.move("<");return h+=s.move(n.containerPhrasing(e,{before:h,after:">",...s.current()})),h+=s.move(">"),u(),n.stack=p,h}u=n.enter("link"),c=n.enter("label");let d=s.move("[");return d+=s.move(n.containerPhrasing(e,{before:d,after:"](",...s.current()})),d+=s.move("]("),c(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(c=n.enter("destinationLiteral"),d+=s.move("<"),d+=s.move(n.safe(e.url,{before:d,after:">",...s.current()})),d+=s.move(">")):(c=n.enter("destinationRaw"),d+=s.move(n.safe(e.url,{before:d,after:e.title?" ":")",...s.current()}))),c(),e.title&&(c=n.enter(`title${o}`),d+=s.move(" "+i),d+=s.move(n.safe(e.title,{before:d,after:i,...s.current()})),d+=s.move(i),c()),d+=s.move(")"),u(),d}function vF(e,t,n){return uk(e,n)?"<":"["}fk.peek=yF;function fk(e,t,n,r){const i=e.referenceType,o=n.enter("linkReference");let s=n.enter("label");const u=n.createTracker(r);let c=u.move("[");const d=n.containerPhrasing(e,{before:c,after:"]",...u.current()});c+=u.move(d+"]["),s();const p=n.stack;n.stack=[],s=n.enter("reference");const h=n.safe(n.associationId(e),{before:c,after:"]",...u.current()});return s(),n.stack=p,o(),i==="full"||!d||d!==h?c+=u.move(h+"]"):i==="shortcut"?c=c.slice(0,-1):c+=u.move("]"),c}function yF(){return"["}function $y(e){const t=e.options.bullet||"*";if(t!=="*"&&t!=="+"&&t!=="-")throw new Error("Cannot serialize items with `"+t+"` for `options.bullet`, expected `*`, `+`, or `-`");return t}function _F(e){const t=$y(e),n=e.options.bulletOther;if(!n)return t==="*"?"-":"*";if(n!=="*"&&n!=="+"&&n!=="-")throw new Error("Cannot serialize items with `"+n+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(n===t)throw new Error("Expected `bullet` (`"+t+"`) and `bulletOther` (`"+n+"`) to be different");return n}function bF(e){const t=e.options.bulletOrdered||".";if(t!=="."&&t!==")")throw new Error("Cannot serialize items with `"+t+"` for `options.bulletOrdered`, expected `.` or `)`");return t}function dk(e){const t=e.options.rule||"*";if(t!=="*"&&t!=="-"&&t!=="_")throw new Error("Cannot serialize rules with `"+t+"` for `options.rule`, expected `*`, `-`, or `_`");return t}function SF(e,t,n,r){const i=n.enter("list"),o=n.bulletCurrent;let s=e.ordered?bF(n):$y(n);const u=e.ordered?s==="."?")":".":_F(n);let c=t&&n.bulletLastUsed?s===n.bulletLastUsed:!1;if(!e.ordered){const p=e.children?e.children[0]:void 0;if((s==="*"||s==="-")&&p&&(!p.children||!p.children[0])&&n.stack[n.stack.length-1]==="list"&&n.stack[n.stack.length-2]==="listItem"&&n.stack[n.stack.length-3]==="list"&&n.stack[n.stack.length-4]==="listItem"&&n.indexStack[n.indexStack.length-1]===0&&n.indexStack[n.indexStack.length-2]===0&&n.indexStack[n.indexStack.length-3]===0&&(c=!0),dk(n)===s&&p){let h=-1;for(;++h<e.children.length;){const m=e.children[h];if(m&&m.type==="listItem"&&m.children&&m.children[0]&&m.children[0].type==="thematicBreak"){c=!0;break}}}}c&&(s=u),n.bulletCurrent=s;const d=n.containerFlow(e,r);return n.bulletLastUsed=s,n.bulletCurrent=o,i(),d}function wF(e){const t=e.options.listItemIndent||"one";if(t!=="tab"&&t!=="one"&&t!=="mixed")throw new Error("Cannot serialize items with `"+t+"` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`");return t}function xF(e,t,n,r){const i=wF(n);let o=n.bulletCurrent||$y(n);t&&t.type==="list"&&t.ordered&&(o=(typeof t.start=="number"&&t.start>-1?t.start:1)+(n.options.incrementListMarker===!1?0:t.children.indexOf(e))+o);let s=o.length+1;(i==="tab"||i==="mixed"&&(t&&t.type==="list"&&t.spread||e.spread))&&(s=Math.ceil(s/4)*4);const u=n.createTracker(r);u.move(o+" ".repeat(s-o.length)),u.shift(s);const c=n.enter("listItem"),d=n.indentLines(n.containerFlow(e,u.current()),p);return c(),d;function p(h,m,v){return m?(v?"":" ".repeat(s))+h:(v?o:o+" ".repeat(s-o.length))+h}}function CF(e,t,n,r){const i=n.enter("paragraph"),o=n.enter("phrasing"),s=n.containerPhrasing(e,r);return o(),i(),s}const EF=ah(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function kF(e,t,n,r){return(e.children.some(function(s){return EF(s)})?n.containerPhrasing:n.containerFlow).call(n,e,r)}function AF(e){const t=e.options.strong||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}hk.peek=IF;function hk(e,t,n,r){const i=AF(n),o=n.enter("strong"),s=n.createTracker(r),u=s.move(i+i);let c=s.move(n.containerPhrasing(e,{after:i,before:u,...s.current()}));const d=c.charCodeAt(0),p=uh(r.before.charCodeAt(r.before.length-1),d,i);p.inside&&(c=Tc(d)+c.slice(1));const h=c.charCodeAt(c.length-1),m=uh(r.after.charCodeAt(0),h,i);m.inside&&(c=c.slice(0,-1)+Tc(h));const v=s.move(i+i);return o(),n.attentionEncodeSurroundingInfo={after:m.outside,before:p.outside},u+c+v}function IF(e,t,n){return n.options.strong||"*"}function RF(e,t,n,r){return n.safe(e.value,r)}function OF(e){const t=e.options.ruleRepetition||3;if(t<3)throw new Error("Cannot serialize rules with repetition `"+t+"` for `options.ruleRepetition`, expected `3` or more");return t}function TF(e,t,n){const r=(dk(n)+(n.options.ruleSpaces?" ":"")).repeat(OF(n));return n.options.ruleSpaces?r.slice(0,-1):r}const pk={blockquote:eF,break:rk,code:aF,definition:lF,emphasis:ik,hardBreak:rk,heading:dF,html:ok,image:ak,imageReference:sk,inlineCode:lk,link:ck,linkReference:fk,list:SF,listItem:xF,paragraph:CF,root:kF,strong:hk,text:RF,thematicBreak:TF};function MF(){return{enter:{table:DF,tableData:gk,tableHeader:gk,tableRow:LF},exit:{codeText:NF,table:$F,tableData:Ly,tableHeader:Ly,tableRow:Ly}}}function DF(e){const t=e._align;this.enter({type:"table",align:t.map(function(n){return n==="none"?null:n}),children:[]},e),this.data.inTable=!0}function $F(e){this.exit(e),this.data.inTable=void 0}function LF(e){this.enter({type:"tableRow",children:[]},e)}function Ly(e){this.exit(e)}function gk(e){this.enter({type:"tableCell",children:[]},e)}function NF(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,PF));const n=this.stack[this.stack.length-1];n.type,n.value=t,this.exit(e)}function PF(e,t){return t==="|"?t:e}function BF(e){const t=e||{},n=t.tableCellPadding,r=t.tablePipeAlign,i=t.stringLength,o=n?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:`
|
|
76
76
|
`,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:m,table:s,tableCell:c,tableRow:u}};function s(v,_,x,b){return d(p(v,x,b),v.align)}function u(v,_,x,b){const w=h(v,x,b),C=d([w]);return C.slice(0,C.indexOf(`
|
|
77
77
|
`))}function c(v,_,x,b){const w=x.enter("tableCell"),C=x.enter("phrasing"),E=x.containerPhrasing(v,{...b,before:o,after:o});return C(),w(),E}function d(v,_){return X8(v,{align:_,alignDelimiters:r,padding:n,stringLength:i})}function p(v,_,x){const b=v.children;let w=-1;const C=[],E=_.enter("table");for(;++w<b.length;)C[w]=h(b[w],_,x);return E(),C}function h(v,_,x){const b=v.children;let w=-1;const C=[],E=_.enter("tableRow");for(;++w<b.length;)C[w]=c(b[w],v,_,x);return E(),C}function m(v,_,x){let b=pk.inlineCode(v,_,x);return x.stack.includes("tableCell")&&(b=b.replace(/\|/g,"\\$&")),b}}function FF(){return{exit:{taskListCheckValueChecked:mk,taskListCheckValueUnchecked:mk,paragraph:zF}}}function UF(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:qF}}}function mk(e){const t=this.stack[this.stack.length-2];t.type,t.checked=e.type==="taskListCheckValueChecked"}function zF(e){const t=this.stack[this.stack.length-2];if(t&&t.type==="listItem"&&typeof t.checked=="boolean"){const n=this.stack[this.stack.length-1];n.type;const r=n.children[0];if(r&&r.type==="text"){const i=t.children;let o=-1,s;for(;++o<i.length;){const u=i[o];if(u.type==="paragraph"){s=u;break}}s===n&&(r.value=r.value.slice(1),r.value.length===0?n.children.shift():n.position&&r.position&&typeof r.position.start.offset=="number"&&(r.position.start.column++,r.position.start.offset++,n.position.start=Object.assign({},r.position.start)))}}this.exit(e)}function qF(e,t,n,r){const i=e.children[0],o=typeof e.checked=="boolean"&&i&&i.type==="paragraph",s="["+(e.checked?"x":" ")+"] ",u=n.createTracker(r);o&&u.move(s);let c=pk.listItem(e,t,n,{...r,...u.current()});return o&&(c=c.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,d)),c;function d(p){return p+s}}function jF(){return[S8(),q8(),V8(),MF(),FF()]}function HF(e){return{extensions:[w8(),j8(e),Z8(),BF(e),UF()]}}const GF={tokenize:QF,partial:!0},vk={tokenize:XF,partial:!0},yk={tokenize:JF,partial:!0},_k={tokenize:eU,partial:!0},VF={tokenize:tU,partial:!0},bk={name:"wwwAutolink",tokenize:WF,previous:wk},Sk={name:"protocolAutolink",tokenize:KF,previous:xk},No={name:"emailAutolink",tokenize:YF,previous:Ck},ro={};function ZF(){return{text:ro}}let ks=48;for(;ks<123;)ro[ks]=No,ks++,ks===58?ks=65:ks===91&&(ks=97);ro[43]=No,ro[45]=No,ro[46]=No,ro[95]=No,ro[72]=[No,Sk],ro[104]=[No,Sk],ro[87]=[No,bk],ro[119]=[No,bk];function YF(e,t,n){const r=this;let i,o;return s;function s(h){return!Ny(h)||!Ck.call(r,r.previous)||Py(r.events)?n(h):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),u(h))}function u(h){return Ny(h)?(e.consume(h),u):h===64?(e.consume(h),c):n(h)}function c(h){return h===46?e.check(VF,p,d)(h):h===45||h===95||_r(h)?(o=!0,e.consume(h),c):p(h)}function d(h){return e.consume(h),i=!0,c}function p(h){return o&&i&&Or(r.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),t(h)):n(h)}}function WF(e,t,n){const r=this;return i;function i(s){return s!==87&&s!==119||!wk.call(r,r.previous)||Py(r.events)?n(s):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(GF,e.attempt(vk,e.attempt(yk,o),n),n)(s))}function o(s){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),t(s)}}function KF(e,t,n){const r=this;let i="",o=!1;return s;function s(h){return(h===72||h===104)&&xk.call(r,r.previous)&&!Py(r.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),i+=String.fromCodePoint(h),e.consume(h),u):n(h)}function u(h){if(Or(h)&&i.length<5)return i+=String.fromCodePoint(h),e.consume(h),u;if(h===58){const m=i.toLowerCase();if(m==="http"||m==="https")return e.consume(h),c}return n(h)}function c(h){return h===47?(e.consume(h),o?d:(o=!0,c)):n(h)}function d(h){return h===null||Qd(h)||nn(h)||Es(h)||Xd(h)?n(h):e.attempt(vk,e.attempt(yk,p),n)(h)}function p(h){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),t(h)}}function QF(e,t,n){let r=0;return i;function i(s){return(s===87||s===119)&&r<3?(r++,e.consume(s),i):s===46&&r===3?(e.consume(s),o):n(s)}function o(s){return s===null?n(s):t(s)}}function XF(e,t,n){let r,i,o;return s;function s(d){return d===46||d===95?e.check(_k,c,u)(d):d===null||nn(d)||Es(d)||d!==45&&Xd(d)?c(d):(o=!0,e.consume(d),s)}function u(d){return d===95?r=!0:(i=r,r=void 0),e.consume(d),s}function c(d){return i||r||!o?n(d):t(d)}}function JF(e,t){let n=0,r=0;return i;function i(s){return s===40?(n++,e.consume(s),i):s===41&&r<n?o(s):s===33||s===34||s===38||s===39||s===41||s===42||s===44||s===46||s===58||s===59||s===60||s===63||s===93||s===95||s===126?e.check(_k,t,o)(s):s===null||nn(s)||Es(s)?t(s):(e.consume(s),i)}function o(s){return s===41&&r++,e.consume(s),i}}function eU(e,t,n){return r;function r(u){return u===33||u===34||u===39||u===41||u===42||u===44||u===46||u===58||u===59||u===63||u===95||u===126?(e.consume(u),r):u===38?(e.consume(u),o):u===93?(e.consume(u),i):u===60||u===null||nn(u)||Es(u)?t(u):n(u)}function i(u){return u===null||u===40||u===91||nn(u)||Es(u)?t(u):r(u)}function o(u){return Or(u)?s(u):n(u)}function s(u){return u===59?(e.consume(u),r):Or(u)?(e.consume(u),s):n(u)}}function tU(e,t,n){return r;function r(o){return e.consume(o),i}function i(o){return _r(o)?n(o):t(o)}}function wk(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||nn(e)}function xk(e){return!Or(e)}function Ck(e){return!(e===47||Ny(e))}function Ny(e){return e===43||e===45||e===46||e===95||_r(e)}function Py(e){let t=e.length,n=!1;for(;t--;){const r=e[t][1];if((r.type==="labelLink"||r.type==="labelImage")&&!r._balanced){n=!0;break}if(r._gfmAutolinkLiteralWalkedInto){n=!1;break}}return e.length>0&&!n&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}const nU={tokenize:cU,partial:!0};function rU(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:sU,continuation:{tokenize:lU},exit:uU}},text:{91:{name:"gfmFootnoteCall",tokenize:aU},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:iU,resolveTo:oU}}}}function iU(e,t,n){const r=this;let i=r.events.length;const o=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let s;for(;i--;){const c=r.events[i][1];if(c.type==="labelImage"){s=c;break}if(c.type==="gfmFootnoteCall"||c.type==="labelLink"||c.type==="label"||c.type==="image"||c.type==="link")break}return u;function u(c){if(!s||!s._balanced)return n(c);const d=Fi(r.sliceSerialize({start:s.end,end:r.now()}));return d.codePointAt(0)!==94||!o.includes(d.slice(1))?n(c):(e.enter("gfmFootnoteCallLabelMarker"),e.consume(c),e.exit("gfmFootnoteCallLabelMarker"),t(c))}}function oU(e,t){let n=e.length;for(;n--;)if(e[n][1].type==="labelImage"&&e[n][0]==="enter"){e[n][1];break}e[n+1][1].type="data",e[n+3][1].type="gfmFootnoteCallLabelMarker";const r={type:"gfmFootnoteCall",start:Object.assign({},e[n+3][1].start),end:Object.assign({},e[e.length-1][1].end)},i={type:"gfmFootnoteCallMarker",start:Object.assign({},e[n+3][1].end),end:Object.assign({},e[n+3][1].end)};i.end.column++,i.end.offset++,i.end._bufferIndex++;const o={type:"gfmFootnoteCallString",start:Object.assign({},i.end),end:Object.assign({},e[e.length-1][1].start)},s={type:"chunkString",contentType:"string",start:Object.assign({},o.start),end:Object.assign({},o.end)},u=[e[n+1],e[n+2],["enter",r,t],e[n+3],e[n+4],["enter",i,t],["exit",i,t],["enter",o,t],["enter",s,t],["exit",s,t],["exit",o,t],e[e.length-2],e[e.length-1],["exit",r,t]];return e.splice(n,e.length-n+1,...u),e}function aU(e,t,n){const r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let o=0,s;return u;function u(h){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(h),e.exit("gfmFootnoteCallLabelMarker"),c}function c(h){return h!==94?n(h):(e.enter("gfmFootnoteCallMarker"),e.consume(h),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",d)}function d(h){if(o>999||h===93&&!s||h===null||h===91||nn(h))return n(h);if(h===93){e.exit("chunkString");const m=e.exit("gfmFootnoteCallString");return i.includes(Fi(r.sliceSerialize(m)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(h),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):n(h)}return nn(h)||(s=!0),o++,e.consume(h),h===92?p:d}function p(h){return h===91||h===92||h===93?(e.consume(h),o++,d):d(h)}}function sU(e,t,n){const r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let o,s=0,u;return c;function c(_){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(_),e.exit("gfmFootnoteDefinitionLabelMarker"),d}function d(_){return _===94?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(_),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",p):n(_)}function p(_){if(s>999||_===93&&!u||_===null||_===91||nn(_))return n(_);if(_===93){e.exit("chunkString");const x=e.exit("gfmFootnoteDefinitionLabelString");return o=Fi(r.sliceSerialize(x)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(_),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),m}return nn(_)||(u=!0),s++,e.consume(_),_===92?h:p}function h(_){return _===91||_===92||_===93?(e.consume(_),s++,p):p(_)}function m(_){return _===58?(e.enter("definitionMarker"),e.consume(_),e.exit("definitionMarker"),i.includes(o)||i.push(o),Lt(e,v,"gfmFootnoteDefinitionWhitespace")):n(_)}function v(_){return t(_)}}function lU(e,t,n){return e.check(Ec,t,e.attempt(nU,t,n))}function uU(e){e.exit("gfmFootnoteDefinition")}function cU(e,t,n){const r=this;return Lt(e,i,"gfmFootnoteDefinitionIndent",5);function i(o){const s=r.events[r.events.length-1];return s&&s[1].type==="gfmFootnoteDefinitionIndent"&&s[2].sliceSerialize(s[1],!0).length===4?t(o):n(o)}}function fU(e){let n=(e||{}).singleTilde;const r={name:"strikethrough",tokenize:o,resolveAll:i};return n==null&&(n=!0),{text:{126:r},insideSpan:{null:[r]},attentionMarkers:{null:[126]}};function i(s,u){let c=-1;for(;++c<s.length;)if(s[c][0]==="enter"&&s[c][1].type==="strikethroughSequenceTemporary"&&s[c][1]._close){let d=c;for(;d--;)if(s[d][0]==="exit"&&s[d][1].type==="strikethroughSequenceTemporary"&&s[d][1]._open&&s[c][1].end.offset-s[c][1].start.offset===s[d][1].end.offset-s[d][1].start.offset){s[c][1].type="strikethroughSequence",s[d][1].type="strikethroughSequence";const p={type:"strikethrough",start:Object.assign({},s[d][1].start),end:Object.assign({},s[c][1].end)},h={type:"strikethroughText",start:Object.assign({},s[d][1].end),end:Object.assign({},s[c][1].start)},m=[["enter",p,u],["enter",s[d][1],u],["exit",s[d][1],u],["enter",h,u]],v=u.parser.constructs.insideSpan.null;v&&Jr(m,m.length,0,Jd(v,s.slice(d+1,c),u)),Jr(m,m.length,0,[["exit",h,u],["enter",s[c][1],u],["exit",s[c][1],u],["exit",p,u]]),Jr(s,d-1,c-d+3,m),c=d+m.length-2;break}}for(c=-1;++c<s.length;)s[c][1].type==="strikethroughSequenceTemporary"&&(s[c][1].type="data");return s}function o(s,u,c){const d=this.previous,p=this.events;let h=0;return m;function m(_){return d===126&&p[p.length-1][1].type!=="characterEscape"?c(_):(s.enter("strikethroughSequenceTemporary"),v(_))}function v(_){const x=xl(d);if(_===126)return h>1?c(_):(s.consume(_),h++,v);if(h<2&&!n)return c(_);const b=s.exit("strikethroughSequenceTemporary"),w=xl(_);return b._open=!w||w===2&&!!x,b._close=!x||x===2&&!!w,u(_)}}}class dU{constructor(){this.map=[]}add(t,n,r){hU(this,t,n,r)}consume(t){if(this.map.sort(function(o,s){return o[0]-s[0]}),this.map.length===0)return;let n=this.map.length;const r=[];for(;n>0;)n-=1,r.push(t.slice(this.map[n][0]+this.map[n][1]),this.map[n][2]),t.length=this.map[n][0];r.push(t.slice()),t.length=0;let i=r.pop();for(;i;){for(const o of i)t.push(o);i=r.pop()}this.map.length=0}}function hU(e,t,n,r){let i=0;if(!(n===0&&r.length===0)){for(;i<e.map.length;){if(e.map[i][0]===t){e.map[i][1]+=n,e.map[i][2].push(...r);return}i+=1}e.map.push([t,n,r])}}function pU(e,t){let n=!1;const r=[];for(;t<e.length;){const i=e[t];if(n){if(i[0]==="enter")i[1].type==="tableContent"&&r.push(e[t+1][1].type==="tableDelimiterMarker"?"left":"none");else if(i[1].type==="tableContent"){if(e[t-1][1].type==="tableDelimiterMarker"){const o=r.length-1;r[o]=r[o]==="left"?"center":"right"}}else if(i[1].type==="tableDelimiterRow")break}else i[0]==="enter"&&i[1].type==="tableDelimiterRow"&&(n=!0);t+=1}return r}function gU(){return{flow:{null:{name:"table",tokenize:mU,resolveAll:vU}}}}function mU(e,t,n){const r=this;let i=0,o=0,s;return u;function u(P){let V=r.events.length-1;for(;V>-1;){const G=r.events[V][1].type;if(G==="lineEnding"||G==="linePrefix")V--;else break}const J=V>-1?r.events[V][1].type:null,le=J==="tableHead"||J==="tableRow"?T:c;return le===T&&r.parser.lazy[r.now().line]?n(P):le(P)}function c(P){return e.enter("tableHead"),e.enter("tableRow"),d(P)}function d(P){return P===124||(s=!0,o+=1),p(P)}function p(P){return P===null?n(P):rt(P)?o>1?(o=0,r.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(P),e.exit("lineEnding"),v):n(P):Et(P)?Lt(e,p,"whitespace")(P):(o+=1,s&&(s=!1,i+=1),P===124?(e.enter("tableCellDivider"),e.consume(P),e.exit("tableCellDivider"),s=!0,p):(e.enter("data"),h(P)))}function h(P){return P===null||P===124||nn(P)?(e.exit("data"),p(P)):(e.consume(P),P===92?m:h)}function m(P){return P===92||P===124?(e.consume(P),h):h(P)}function v(P){return r.interrupt=!1,r.parser.lazy[r.now().line]?n(P):(e.enter("tableDelimiterRow"),s=!1,Et(P)?Lt(e,_,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(P):_(P))}function _(P){return P===45||P===58?b(P):P===124?(s=!0,e.enter("tableCellDivider"),e.consume(P),e.exit("tableCellDivider"),x):O(P)}function x(P){return Et(P)?Lt(e,b,"whitespace")(P):b(P)}function b(P){return P===58?(o+=1,s=!0,e.enter("tableDelimiterMarker"),e.consume(P),e.exit("tableDelimiterMarker"),w):P===45?(o+=1,w(P)):P===null||rt(P)?R(P):O(P)}function w(P){return P===45?(e.enter("tableDelimiterFiller"),C(P)):O(P)}function C(P){return P===45?(e.consume(P),C):P===58?(s=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(P),e.exit("tableDelimiterMarker"),E):(e.exit("tableDelimiterFiller"),E(P))}function E(P){return Et(P)?Lt(e,R,"whitespace")(P):R(P)}function R(P){return P===124?_(P):P===null||rt(P)?!s||i!==o?O(P):(e.exit("tableDelimiterRow"),e.exit("tableHead"),t(P)):O(P)}function O(P){return n(P)}function T(P){return e.enter("tableRow"),L(P)}function L(P){return P===124?(e.enter("tableCellDivider"),e.consume(P),e.exit("tableCellDivider"),L):P===null||rt(P)?(e.exit("tableRow"),t(P)):Et(P)?Lt(e,L,"whitespace")(P):(e.enter("data"),B(P))}function B(P){return P===null||P===124||nn(P)?(e.exit("data"),L(P)):(e.consume(P),P===92?z:B)}function z(P){return P===92||P===124?(e.consume(P),B):B(P)}}function vU(e,t){let n=-1,r=!0,i=0,o=[0,0,0,0],s=[0,0,0,0],u=!1,c=0,d,p,h;const m=new dU;for(;++n<e.length;){const v=e[n],_=v[1];v[0]==="enter"?_.type==="tableHead"?(u=!1,c!==0&&(Ek(m,t,c,d,p),p=void 0,c=0),d={type:"table",start:Object.assign({},_.start),end:Object.assign({},_.end)},m.add(n,0,[["enter",d,t]])):_.type==="tableRow"||_.type==="tableDelimiterRow"?(r=!0,h=void 0,o=[0,0,0,0],s=[0,n+1,0,0],u&&(u=!1,p={type:"tableBody",start:Object.assign({},_.start),end:Object.assign({},_.end)},m.add(n,0,[["enter",p,t]])),i=_.type==="tableDelimiterRow"?2:p?3:1):i&&(_.type==="data"||_.type==="tableDelimiterMarker"||_.type==="tableDelimiterFiller")?(r=!1,s[2]===0&&(o[1]!==0&&(s[0]=s[1],h=ch(m,t,o,i,void 0,h),o=[0,0,0,0]),s[2]=n)):_.type==="tableCellDivider"&&(r?r=!1:(o[1]!==0&&(s[0]=s[1],h=ch(m,t,o,i,void 0,h)),o=s,s=[o[1],n,0,0])):_.type==="tableHead"?(u=!0,c=n):_.type==="tableRow"||_.type==="tableDelimiterRow"?(c=n,o[1]!==0?(s[0]=s[1],h=ch(m,t,o,i,n,h)):s[1]!==0&&(h=ch(m,t,s,i,n,h)),i=0):i&&(_.type==="data"||_.type==="tableDelimiterMarker"||_.type==="tableDelimiterFiller")&&(s[3]=n)}for(c!==0&&Ek(m,t,c,d,p),m.consume(t.events),n=-1;++n<t.events.length;){const v=t.events[n];v[0]==="enter"&&v[1].type==="table"&&(v[1]._align=pU(t.events,n))}return e}function ch(e,t,n,r,i,o){const s=r===1?"tableHeader":r===2?"tableDelimiter":"tableData",u="tableContent";n[0]!==0&&(o.end=Object.assign({},El(t.events,n[0])),e.add(n[0],0,[["exit",o,t]]));const c=El(t.events,n[1]);if(o={type:s,start:Object.assign({},c),end:Object.assign({},c)},e.add(n[1],0,[["enter",o,t]]),n[2]!==0){const d=El(t.events,n[2]),p=El(t.events,n[3]),h={type:u,start:Object.assign({},d),end:Object.assign({},p)};if(e.add(n[2],0,[["enter",h,t]]),r!==2){const m=t.events[n[2]],v=t.events[n[3]];if(m[1].end=Object.assign({},v[1].end),m[1].type="chunkText",m[1].contentType="text",n[3]>n[2]+1){const _=n[2]+1,x=n[3]-n[2]-1;e.add(_,x,[])}}e.add(n[3]+1,0,[["exit",h,t]])}return i!==void 0&&(o.end=Object.assign({},El(t.events,i)),e.add(i,0,[["exit",o,t]]),o=void 0),o}function Ek(e,t,n,r,i){const o=[],s=El(t.events,n);i&&(i.end=Object.assign({},s),o.push(["exit",i,t])),r.end=Object.assign({},s),o.push(["exit",r,t]),e.add(n+1,0,o)}function El(e,t){const n=e[t],r=n[0]==="enter"?"start":"end";return n[1][r]}const yU={name:"tasklistCheck",tokenize:bU};function _U(){return{text:{91:yU}}}function bU(e,t,n){const r=this;return i;function i(c){return r.previous!==null||!r._gfmTasklistFirstContentOfListItem?n(c):(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(c),e.exit("taskListCheckMarker"),o)}function o(c){return nn(c)?(e.enter("taskListCheckValueUnchecked"),e.consume(c),e.exit("taskListCheckValueUnchecked"),s):c===88||c===120?(e.enter("taskListCheckValueChecked"),e.consume(c),e.exit("taskListCheckValueChecked"),s):n(c)}function s(c){return c===93?(e.enter("taskListCheckMarker"),e.consume(c),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),u):n(c)}function u(c){return rt(c)?t(c):Et(c)?e.check({tokenize:SU},t,n)(c):n(c)}}function SU(e,t,n){return Lt(e,r,"whitespace");function r(i){return i===null?n(i):t(i)}}function wU(e){return iE([ZF(),rU(),fU(e),gU(),_U()])}const xU={};function CU(e){const t=this,n=e||xU,r=t.data(),i=r.micromarkExtensions||(r.micromarkExtensions=[]),o=r.fromMarkdownExtensions||(r.fromMarkdownExtensions=[]),s=r.toMarkdownExtensions||(r.toMarkdownExtensions=[]);i.push(wU(n)),o.push(jF()),s.push(HF(n))}var nr=function(){return nr=Object.assign||function(t){for(var n,r=1,i=arguments.length;r<i;r++){n=arguments[r];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(t[o]=n[o])}return t},nr.apply(this,arguments)};function Mc(e,t,n){if(n||arguments.length===2)for(var r=0,i=t.length,o;r<i;r++)(o||!(r in t))&&(o||(o=Array.prototype.slice.call(t,0,r)),o[r]=t[r]);return e.concat(o||Array.prototype.slice.call(t))}typeof SuppressedError=="function"&&SuppressedError;var By,kk;function EU(){return kk||(kk=1,By=function(t,n,r,i){var o=r?r.call(i,t,n):void 0;if(o!==void 0)return!!o;if(t===n)return!0;if(typeof t!="object"||!t||typeof n!="object"||!n)return!1;var s=Object.keys(t),u=Object.keys(n);if(s.length!==u.length)return!1;for(var c=Object.prototype.hasOwnProperty.bind(n),d=0;d<s.length;d++){var p=s[d];if(!c(p))return!1;var h=t[p],m=n[p];if(o=r?r.call(i,h,m,p):void 0,o===!1||o===void 0&&h!==m)return!1}return!0}),By}var kU=EU();const AU=fi(kU);var dn="-ms-",Dc="-moz-",Gt="-webkit-",Ak="comm",fh="rule",Fy="decl",IU="@import",Ik="@keyframes",RU="@layer",Rk=Math.abs,Uy=String.fromCharCode,zy=Object.assign;function OU(e,t){return rr(e,0)^45?(((t<<2^rr(e,0))<<2^rr(e,1))<<2^rr(e,2))<<2^rr(e,3):0}function Ok(e){return e.trim()}function Po(e,t){return(e=t.exec(e))?e[0]:e}function bt(e,t,n){return e.replace(t,n)}function dh(e,t,n){return e.indexOf(t,n)}function rr(e,t){return e.charCodeAt(t)|0}function kl(e,t,n){return e.slice(t,n)}function io(e){return e.length}function Tk(e){return e.length}function $c(e,t){return t.push(e),e}function TU(e,t){return e.map(t).join("")}function Mk(e,t){return e.filter(function(n){return!Po(n,t)})}var hh=1,Al=1,Dk=0,hi=0,Un=0,Il="";function ph(e,t,n,r,i,o,s,u){return{value:e,root:t,parent:n,type:r,props:i,children:o,line:hh,column:Al,length:s,return:"",siblings:u}}function wa(e,t){return zy(ph("",null,null,"",null,null,0,e.siblings),e,{length:-e.length},t)}function Rl(e){for(;e.root;)e=wa(e.root,{children:[e]});$c(e,e.siblings)}function MU(){return Un}function DU(){return Un=hi>0?rr(Il,--hi):0,Al--,Un===10&&(Al=1,hh--),Un}function Ui(){return Un=hi<Dk?rr(Il,hi++):0,Al++,Un===10&&(Al=1,hh++),Un}function As(){return rr(Il,hi)}function gh(){return hi}function mh(e,t){return kl(Il,e,t)}function qy(e){switch(e){case 0:case 9:case 10:case 13:case 32:return 5;case 33:case 43:case 44:case 47:case 62:case 64:case 126:case 59:case 123:case 125:return 4;case 58:return 3;case 34:case 39:case 40:case 91:return 2;case 41:case 93:return 1}return 0}function $U(e){return hh=Al=1,Dk=io(Il=e),hi=0,[]}function LU(e){return Il="",e}function jy(e){return Ok(mh(hi-1,Hy(e===91?e+2:e===40?e+1:e)))}function NU(e){for(;(Un=As())&&Un<33;)Ui();return qy(e)>2||qy(Un)>3?"":" "}function PU(e,t){for(;--t&&Ui()&&!(Un<48||Un>102||Un>57&&Un<65||Un>70&&Un<97););return mh(e,gh()+(t<6&&As()==32&&Ui()==32))}function Hy(e){for(;Ui();)switch(Un){case e:return hi;case 34:case 39:e!==34&&e!==39&&Hy(Un);break;case 40:e===41&&Hy(e);break;case 92:Ui();break}return hi}function BU(e,t){for(;Ui()&&e+Un!==57;)if(e+Un===84&&As()===47)break;return"/*"+mh(t,hi-1)+"*"+Uy(e===47?e:Ui())}function FU(e){for(;!qy(As());)Ui();return mh(e,hi)}function UU(e){return LU(vh("",null,null,null,[""],e=$U(e),0,[0],e))}function vh(e,t,n,r,i,o,s,u,c){for(var d=0,p=0,h=s,m=0,v=0,_=0,x=1,b=1,w=1,C=0,E="",R=i,O=o,T=r,L=E;b;)switch(_=C,C=Ui()){case 40:if(_!=108&&rr(L,h-1)==58){dh(L+=bt(jy(C),"&","&\f"),"&\f",Rk(d?u[d-1]:0))!=-1&&(w=-1);break}case 34:case 39:case 91:L+=jy(C);break;case 9:case 10:case 13:case 32:L+=NU(_);break;case 92:L+=PU(gh()-1,7);continue;case 47:switch(As()){case 42:case 47:$c(zU(BU(Ui(),gh()),t,n,c),c);break;default:L+="/"}break;case 123*x:u[d++]=io(L)*w;case 125*x:case 59:case 0:switch(C){case 0:case 125:b=0;case 59+p:w==-1&&(L=bt(L,/\f/g,"")),v>0&&io(L)-h&&$c(v>32?Lk(L+";",r,n,h-1,c):Lk(bt(L," ","")+";",r,n,h-2,c),c);break;case 59:L+=";";default:if($c(T=$k(L,t,n,d,p,i,u,E,R=[],O=[],h,o),o),C===123)if(p===0)vh(L,t,T,T,R,o,h,u,O);else switch(m===99&&rr(L,3)===110?100:m){case 100:case 108:case 109:case 115:vh(e,T,T,r&&$c($k(e,T,T,0,0,i,u,E,i,R=[],h,O),O),i,O,h,u,r?R:O);break;default:vh(L,T,T,T,[""],O,0,u,O)}}d=p=v=0,x=w=1,E=L="",h=s;break;case 58:h=1+io(L),v=_;default:if(x<1){if(C==123)--x;else if(C==125&&x++==0&&DU()==125)continue}switch(L+=Uy(C),C*x){case 38:w=p>0?1:(L+="\f",-1);break;case 44:u[d++]=(io(L)-1)*w,w=1;break;case 64:As()===45&&(L+=jy(Ui())),m=As(),p=h=io(E=L+=FU(gh())),C++;break;case 45:_===45&&io(L)==2&&(x=0)}}return o}function $k(e,t,n,r,i,o,s,u,c,d,p,h){for(var m=i-1,v=i===0?o:[""],_=Tk(v),x=0,b=0,w=0;x<r;++x)for(var C=0,E=kl(e,m+1,m=Rk(b=s[x])),R=e;C<_;++C)(R=Ok(b>0?v[C]+" "+E:bt(E,/&\f/g,v[C])))&&(c[w++]=R);return ph(e,t,n,i===0?fh:u,c,d,p,h)}function zU(e,t,n,r){return ph(e,t,n,Ak,Uy(MU()),kl(e,2,-2),0,r)}function Lk(e,t,n,r,i){return ph(e,t,n,Fy,kl(e,0,r),kl(e,r+1,-1),r,i)}function Nk(e,t,n){switch(OU(e,t)){case 5103:return Gt+"print-"+e+e;case 5737:case 4201:case 3177:case 3433:case 1641:case 4457:case 2921:case 5572:case 6356:case 5844:case 3191:case 6645:case 3005:case 6391:case 5879:case 5623:case 6135:case 4599:case 4855:case 4215:case 6389:case 5109:case 5365:case 5621:case 3829:return Gt+e+e;case 4789:return Dc+e+e;case 5349:case 4246:case 4810:case 6968:case 2756:return Gt+e+Dc+e+dn+e+e;case 5936:switch(rr(e,t+11)){case 114:return Gt+e+dn+bt(e,/[svh]\w+-[tblr]{2}/,"tb")+e;case 108:return Gt+e+dn+bt(e,/[svh]\w+-[tblr]{2}/,"tb-rl")+e;case 45:return Gt+e+dn+bt(e,/[svh]\w+-[tblr]{2}/,"lr")+e}case 6828:case 4268:case 2903:return Gt+e+dn+e+e;case 6165:return Gt+e+dn+"flex-"+e+e;case 5187:return Gt+e+bt(e,/(\w+).+(:[^]+)/,Gt+"box-$1$2"+dn+"flex-$1$2")+e;case 5443:return Gt+e+dn+"flex-item-"+bt(e,/flex-|-self/g,"")+(Po(e,/flex-|baseline/)?"":dn+"grid-row-"+bt(e,/flex-|-self/g,""))+e;case 4675:return Gt+e+dn+"flex-line-pack"+bt(e,/align-content|flex-|-self/g,"")+e;case 5548:return Gt+e+dn+bt(e,"shrink","negative")+e;case 5292:return Gt+e+dn+bt(e,"basis","preferred-size")+e;case 6060:return Gt+"box-"+bt(e,"-grow","")+Gt+e+dn+bt(e,"grow","positive")+e;case 4554:return Gt+bt(e,/([^-])(transform)/g,"$1"+Gt+"$2")+e;case 6187:return bt(bt(bt(e,/(zoom-|grab)/,Gt+"$1"),/(image-set)/,Gt+"$1"),e,"")+e;case 5495:case 3959:return bt(e,/(image-set\([^]*)/,Gt+"$1$`$1");case 4968:return bt(bt(e,/(.+:)(flex-)?(.*)/,Gt+"box-pack:$3"+dn+"flex-pack:$3"),/s.+-b[^;]+/,"justify")+Gt+e+e;case 4200:if(!Po(e,/flex-|baseline/))return dn+"grid-column-align"+kl(e,t)+e;break;case 2592:case 3360:return dn+bt(e,"template-","")+e;case 4384:case 3616:return n&&n.some(function(r,i){return t=i,Po(r.props,/grid-\w+-end/)})?~dh(e+(n=n[t].value),"span",0)?e:dn+bt(e,"-start","")+e+dn+"grid-row-span:"+(~dh(n,"span",0)?Po(n,/\d+/):+Po(n,/\d+/)-+Po(e,/\d+/))+";":dn+bt(e,"-start","")+e;case 4896:case 4128:return n&&n.some(function(r){return Po(r.props,/grid-\w+-start/)})?e:dn+bt(bt(e,"-end","-span"),"span ","")+e;case 4095:case 3583:case 4068:case 2532:return bt(e,/(.+)-inline(.+)/,Gt+"$1$2")+e;case 8116:case 7059:case 5753:case 5535:case 5445:case 5701:case 4933:case 4677:case 5533:case 5789:case 5021:case 4765:if(io(e)-1-t>6)switch(rr(e,t+1)){case 109:if(rr(e,t+4)!==45)break;case 102:return bt(e,/(.+:)(.+)-([^]+)/,"$1"+Gt+"$2-$3$1"+Dc+(rr(e,t+3)==108?"$3":"$2-$3"))+e;case 115:return~dh(e,"stretch",0)?Nk(bt(e,"stretch","fill-available"),t,n)+e:e}break;case 5152:case 5920:return bt(e,/(.+?):(\d+)(\s*\/\s*(span)?\s*(\d+))?(.*)/,function(r,i,o,s,u,c,d){return dn+i+":"+o+d+(s?dn+i+"-span:"+(u?c:+c-+o)+d:"")+e});case 4949:if(rr(e,t+6)===121)return bt(e,":",":"+Gt)+e;break;case 6444:switch(rr(e,rr(e,14)===45?18:11)){case 120:return bt(e,/(.+:)([^;\s!]+)(;|(\s+)?!.+)?/,"$1"+Gt+(rr(e,14)===45?"inline-":"")+"box$3$1"+Gt+"$2$3$1"+dn+"$2box$3")+e;case 100:return bt(e,":",":"+dn)+e}break;case 5719:case 2647:case 2135:case 3927:case 2391:return bt(e,"scroll-","scroll-snap-")+e}return e}function yh(e,t){for(var n="",r=0;r<e.length;r++)n+=t(e[r],r,e,t)||"";return n}function qU(e,t,n,r){switch(e.type){case RU:if(e.children.length)break;case IU:case Fy:return e.return=e.return||e.value;case Ak:return"";case Ik:return e.return=e.value+"{"+yh(e.children,r)+"}";case fh:if(!io(e.value=e.props.join(",")))return""}return io(n=yh(e.children,r))?e.return=e.value+"{"+n+"}":""}function jU(e){var t=Tk(e);return function(n,r,i,o){for(var s="",u=0;u<t;u++)s+=e[u](n,r,i,o)||"";return s}}function HU(e){return function(t){t.root||(t=t.return)&&e(t)}}function GU(e,t,n,r){if(e.length>-1&&!e.return)switch(e.type){case Fy:e.return=Nk(e.value,e.length,n);return;case Ik:return yh([wa(e,{value:bt(e.value,"@","@"+Gt)})],r);case fh:if(e.length)return TU(n=e.props,function(i){switch(Po(i,r=/(::plac\w+|:read-\w+)/)){case":read-only":case":read-write":Rl(wa(e,{props:[bt(i,/:(read-\w+)/,":"+Dc+"$1")]})),Rl(wa(e,{props:[i]})),zy(e,{props:Mk(n,r)});break;case"::placeholder":Rl(wa(e,{props:[bt(i,/:(plac\w+)/,":"+Gt+"input-$1")]})),Rl(wa(e,{props:[bt(i,/:(plac\w+)/,":"+Dc+"$1")]})),Rl(wa(e,{props:[bt(i,/:(plac\w+)/,dn+"input-$1")]})),Rl(wa(e,{props:[i]})),zy(e,{props:Mk(n,r)});break}return""})}}var VU={animationIterationCount:1,aspectRatio:1,borderImageOutset:1,borderImageSlice:1,borderImageWidth:1,boxFlex:1,boxFlexGroup:1,boxOrdinalGroup:1,columnCount:1,columns:1,flex:1,flexGrow:1,flexPositive:1,flexShrink:1,flexNegative:1,flexOrder:1,gridRow:1,gridRowEnd:1,gridRowSpan:1,gridRowStart:1,gridColumn:1,gridColumnEnd:1,gridColumnSpan:1,gridColumnStart:1,msGridRow:1,msGridRowSpan:1,msGridColumn:1,msGridColumnSpan:1,fontWeight:1,lineHeight:1,opacity:1,order:1,orphans:1,tabSize:1,widows:1,zIndex:1,zoom:1,WebkitLineClamp:1,fillOpacity:1,floodOpacity:1,stopOpacity:1,strokeDasharray:1,strokeDashoffset:1,strokeMiterlimit:1,strokeOpacity:1,strokeWidth:1},br={NODE_ENV:"production"},Ol=typeof process<"u"&&br!==void 0&&(br.REACT_APP_SC_ATTR||br.SC_ATTR)||"data-styled",Pk="active",Bk="data-styled-version",_h="6.1.17",Gy=`/*!sc*/
|
|
78
|
-
`,bh=typeof window<"u"&&"HTMLElement"in window,ZU=!!(typeof SC_DISABLE_SPEEDY=="boolean"?SC_DISABLE_SPEEDY:typeof process<"u"&&br!==void 0&&br.REACT_APP_SC_DISABLE_SPEEDY!==void 0&&br.REACT_APP_SC_DISABLE_SPEEDY!==""?br.REACT_APP_SC_DISABLE_SPEEDY!=="false"&&br.REACT_APP_SC_DISABLE_SPEEDY:typeof process<"u"&&br!==void 0&&br.SC_DISABLE_SPEEDY!==void 0&&br.SC_DISABLE_SPEEDY!==""?br.SC_DISABLE_SPEEDY!=="false"&&br.SC_DISABLE_SPEEDY:br.NODE_ENV!=="production"),YU={},Sh=Object.freeze([]),Tl=Object.freeze({});function Fk(e,t,n){return n===void 0&&(n=Tl),e.theme!==n.theme&&e.theme||t||n.theme}var Uk=new Set(["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","big","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","keygen","label","legend","li","link","main","map","mark","menu","menuitem","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","section","select","small","source","span","strong","style","sub","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","track","u","ul","use","var","video","wbr","circle","clipPath","defs","ellipse","foreignObject","g","image","line","linearGradient","marker","mask","path","pattern","polygon","polyline","radialGradient","rect","stop","svg","text","tspan"]),WU=/[!"#$%&'()*+,./:;<=>?@[\\\]^`{|}~-]+/g,KU=/(^-|-$)/g;function zk(e){return e.replace(WU,"-").replace(KU,"")}var QU=/(a)(d)/gi,wh=52,qk=function(e){return String.fromCharCode(e+(e>25?39:97))};function Vy(e){var t,n="";for(t=Math.abs(e);t>wh;t=t/wh|0)n=qk(t%wh)+n;return(qk(t%wh)+n).replace(QU,"$1-$2")}var Zy,jk=5381,Ml=function(e,t){for(var n=t.length;n;)e=33*e^t.charCodeAt(--n);return e},Hk=function(e){return Ml(jk,e)};function Gk(e){return Vy(Hk(e)>>>0)}function XU(e){return e.displayName||e.name||"Component"}function Yy(e){return typeof e=="string"&&br.NODE_ENV==="production"}var Vk=typeof Symbol=="function"&&Symbol.for,Zk=Vk?Symbol.for("react.memo"):60115,JU=Vk?Symbol.for("react.forward_ref"):60112,ez={childContextTypes:!0,contextType:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,getDerivedStateFromError:!0,getDerivedStateFromProps:!0,mixins:!0,propTypes:!0,type:!0},tz={name:!0,length:!0,prototype:!0,caller:!0,callee:!0,arguments:!0,arity:!0},Yk={$$typeof:!0,compare:!0,defaultProps:!0,displayName:!0,propTypes:!0,type:!0},nz=((Zy={})[JU]={$$typeof:!0,render:!0,defaultProps:!0,displayName:!0,propTypes:!0},Zy[Zk]=Yk,Zy);function Wk(e){return("type"in(t=e)&&t.type.$$typeof)===Zk?Yk:"$$typeof"in e?nz[e.$$typeof]:ez;var t}var rz=Object.defineProperty,iz=Object.getOwnPropertyNames,Kk=Object.getOwnPropertySymbols,oz=Object.getOwnPropertyDescriptor,az=Object.getPrototypeOf,Qk=Object.prototype;function Xk(e,t,n){if(typeof t!="string"){if(Qk){var r=az(t);r&&r!==Qk&&Xk(e,r,n)}var i=iz(t);Kk&&(i=i.concat(Kk(t)));for(var o=Wk(e),s=Wk(t),u=0;u<i.length;++u){var c=i[u];if(!(c in tz||n&&n[c]||s&&c in s||o&&c in o)){var d=oz(t,c);try{rz(e,c,d)}catch{}}}}return e}function Is(e){return typeof e=="function"}function Wy(e){return typeof e=="object"&&"styledComponentId"in e}function Rs(e,t){return e&&t?"".concat(e," ").concat(t):e||t||""}function Ky(e,t){if(e.length===0)return"";for(var n=e[0],r=1;r<e.length;r++)n+=e[r];return n}function Lc(e){return e!==null&&typeof e=="object"&&e.constructor.name===Object.name&&!("props"in e&&e.$$typeof)}function Qy(e,t,n){if(n===void 0&&(n=!1),!n&&!Lc(e)&&!Array.isArray(e))return t;if(Array.isArray(t))for(var r=0;r<t.length;r++)e[r]=Qy(e[r],t[r]);else if(Lc(t))for(var r in t)e[r]=Qy(e[r],t[r]);return e}function Xy(e,t){Object.defineProperty(e,"toString",{value:t})}function Os(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];return new Error("An error occurred. See https://github.com/styled-components/styled-components/blob/main/packages/styled-components/src/utils/errors.md#".concat(e," for more information.").concat(t.length>0?" Args: ".concat(t.join(", ")):""))}var sz=function(){function e(t){this.groupSizes=new Uint32Array(512),this.length=512,this.tag=t}return e.prototype.indexOfGroup=function(t){for(var n=0,r=0;r<t;r++)n+=this.groupSizes[r];return n},e.prototype.insertRules=function(t,n){if(t>=this.groupSizes.length){for(var r=this.groupSizes,i=r.length,o=i;t>=o;)if((o<<=1)<0)throw Os(16,"".concat(t));this.groupSizes=new Uint32Array(o),this.groupSizes.set(r),this.length=o;for(var s=i;s<o;s++)this.groupSizes[s]=0}for(var u=this.indexOfGroup(t+1),c=(s=0,n.length);s<c;s++)this.tag.insertRule(u,n[s])&&(this.groupSizes[t]++,u++)},e.prototype.clearGroup=function(t){if(t<this.length){var n=this.groupSizes[t],r=this.indexOfGroup(t),i=r+n;this.groupSizes[t]=0;for(var o=r;o<i;o++)this.tag.deleteRule(r)}},e.prototype.getGroup=function(t){var n="";if(t>=this.length||this.groupSizes[t]===0)return n;for(var r=this.groupSizes[t],i=this.indexOfGroup(t),o=i+r,s=i;s<o;s++)n+="".concat(this.tag.getRule(s)).concat(Gy);return n},e}(),xh=new Map,Ch=new Map,Eh=1,kh=function(e){if(xh.has(e))return xh.get(e);for(;Ch.has(Eh);)Eh++;var t=Eh++;return xh.set(e,t),Ch.set(t,e),t},lz=function(e,t){Eh=t+1,xh.set(e,t),Ch.set(t,e)},uz="style[".concat(Ol,"][").concat(Bk,'="').concat(_h,'"]'),cz=new RegExp("^".concat(Ol,'\\.g(\\d+)\\[id="([\\w\\d-]+)"\\].*?"([^"]*)')),fz=function(e,t,n){for(var r,i=n.split(","),o=0,s=i.length;o<s;o++)(r=i[o])&&e.registerName(t,r)},dz=function(e,t){for(var n,r=((n=t.textContent)!==null&&n!==void 0?n:"").split(Gy),i=[],o=0,s=r.length;o<s;o++){var u=r[o].trim();if(u){var c=u.match(cz);if(c){var d=0|parseInt(c[1],10),p=c[2];d!==0&&(lz(p,d),fz(e,p,c[3]),e.getTag().insertRules(d,i)),i.length=0}else i.push(u)}}},Jk=function(e){for(var t=document.querySelectorAll(uz),n=0,r=t.length;n<r;n++){var i=t[n];i&&i.getAttribute(Ol)!==Pk&&(dz(e,i),i.parentNode&&i.parentNode.removeChild(i))}};function hz(){return typeof __webpack_nonce__<"u"?__webpack_nonce__:null}var eA=function(e){var t=document.head,n=e||t,r=document.createElement("style"),i=function(u){var c=Array.from(u.querySelectorAll("style[".concat(Ol,"]")));return c[c.length-1]}(n),o=i!==void 0?i.nextSibling:null;r.setAttribute(Ol,Pk),r.setAttribute(Bk,_h);var s=hz();return s&&r.setAttribute("nonce",s),n.insertBefore(r,o),r},pz=function(){function e(t){this.element=eA(t),this.element.appendChild(document.createTextNode("")),this.sheet=function(n){if(n.sheet)return n.sheet;for(var r=document.styleSheets,i=0,o=r.length;i<o;i++){var s=r[i];if(s.ownerNode===n)return s}throw Os(17)}(this.element),this.length=0}return e.prototype.insertRule=function(t,n){try{return this.sheet.insertRule(n,t),this.length++,!0}catch{return!1}},e.prototype.deleteRule=function(t){this.sheet.deleteRule(t),this.length--},e.prototype.getRule=function(t){var n=this.sheet.cssRules[t];return n&&n.cssText?n.cssText:""},e}(),gz=function(){function e(t){this.element=eA(t),this.nodes=this.element.childNodes,this.length=0}return e.prototype.insertRule=function(t,n){if(t<=this.length&&t>=0){var r=document.createTextNode(n);return this.element.insertBefore(r,this.nodes[t]||null),this.length++,!0}return!1},e.prototype.deleteRule=function(t){this.element.removeChild(this.nodes[t]),this.length--},e.prototype.getRule=function(t){return t<this.length?this.nodes[t].textContent:""},e}(),mz=function(){function e(t){this.rules=[],this.length=0}return e.prototype.insertRule=function(t,n){return t<=this.length&&(this.rules.splice(t,0,n),this.length++,!0)},e.prototype.deleteRule=function(t){this.rules.splice(t,1),this.length--},e.prototype.getRule=function(t){return t<this.length?this.rules[t]:""},e}(),tA=bh,vz={isServer:!bh,useCSSOMInjection:!ZU},Ah=function(){function e(t,n,r){t===void 0&&(t=Tl),n===void 0&&(n={});var i=this;this.options=nr(nr({},vz),t),this.gs=n,this.names=new Map(r),this.server=!!t.isServer,!this.server&&bh&&tA&&(tA=!1,Jk(this)),Xy(this,function(){return function(o){for(var s=o.getTag(),u=s.length,c="",d=function(h){var m=function(w){return Ch.get(w)}(h);if(m===void 0)return"continue";var v=o.names.get(m),_=s.getGroup(h);if(v===void 0||!v.size||_.length===0)return"continue";var x="".concat(Ol,".g").concat(h,'[id="').concat(m,'"]'),b="";v!==void 0&&v.forEach(function(w){w.length>0&&(b+="".concat(w,","))}),c+="".concat(_).concat(x,'{content:"').concat(b,'"}').concat(Gy)},p=0;p<u;p++)d(p);return c}(i)})}return e.registerId=function(t){return kh(t)},e.prototype.rehydrate=function(){!this.server&&bh&&Jk(this)},e.prototype.reconstructWithOptions=function(t,n){return n===void 0&&(n=!0),new e(nr(nr({},this.options),t),this.gs,n&&this.names||void 0)},e.prototype.allocateGSInstance=function(t){return this.gs[t]=(this.gs[t]||0)+1},e.prototype.getTag=function(){return this.tag||(this.tag=(t=function(n){var r=n.useCSSOMInjection,i=n.target;return n.isServer?new mz(i):r?new pz(i):new gz(i)}(this.options),new sz(t)));var t},e.prototype.hasNameForId=function(t,n){return this.names.has(t)&&this.names.get(t).has(n)},e.prototype.registerName=function(t,n){if(kh(t),this.names.has(t))this.names.get(t).add(n);else{var r=new Set;r.add(n),this.names.set(t,r)}},e.prototype.insertRules=function(t,n,r){this.registerName(t,n),this.getTag().insertRules(kh(t),r)},e.prototype.clearNames=function(t){this.names.has(t)&&this.names.get(t).clear()},e.prototype.clearRules=function(t){this.getTag().clearGroup(kh(t)),this.clearNames(t)},e.prototype.clearTag=function(){this.tag=void 0},e}(),yz=/&/g,_z=/^\s*\/\/.*$/gm;function nA(e,t){return e.map(function(n){return n.type==="rule"&&(n.value="".concat(t," ").concat(n.value),n.value=n.value.replaceAll(",",",".concat(t," ")),n.props=n.props.map(function(r){return"".concat(t," ").concat(r)})),Array.isArray(n.children)&&n.type!=="@keyframes"&&(n.children=nA(n.children,t)),n})}function rA(e){var t,n,r,i=e===void 0?Tl:e,o=i.options,s=o===void 0?Tl:o,u=i.plugins,c=u===void 0?Sh:u,d=function(m,v,_){return _.startsWith(n)&&_.endsWith(n)&&_.replaceAll(n,"").length>0?".".concat(t):m},p=c.slice();p.push(function(m){m.type===fh&&m.value.includes("&")&&(m.props[0]=m.props[0].replace(yz,n).replace(r,d))}),s.prefix&&p.push(GU),p.push(qU);var h=function(m,v,_,x){v===void 0&&(v=""),_===void 0&&(_=""),x===void 0&&(x="&"),t=x,n=v,r=new RegExp("\\".concat(n,"\\b"),"g");var b=m.replace(_z,""),w=UU(_||v?"".concat(_," ").concat(v," { ").concat(b," }"):b);s.namespace&&(w=nA(w,s.namespace));var C=[];return yh(w,jU(p.concat(HU(function(E){return C.push(E)})))),C};return h.hash=c.length?c.reduce(function(m,v){return v.name||Os(15),Ml(m,v.name)},jk).toString():"",h}var bz=new Ah,Jy=rA(),e_=Tn.createContext({shouldForwardProp:void 0,styleSheet:bz,stylis:Jy});e_.Consumer;var Sz=Tn.createContext(void 0);function Ih(){return W.useContext(e_)}function wz(e){var t=W.useState(e.stylisPlugins),n=t[0],r=t[1],i=Ih().styleSheet,o=W.useMemo(function(){var c=i;return e.sheet?c=e.sheet:e.target&&(c=c.reconstructWithOptions({target:e.target},!1)),e.disableCSSOMInjection&&(c=c.reconstructWithOptions({useCSSOMInjection:!1})),c},[e.disableCSSOMInjection,e.sheet,e.target,i]),s=W.useMemo(function(){return rA({options:{namespace:e.namespace,prefix:e.enableVendorPrefixes},plugins:n})},[e.enableVendorPrefixes,e.namespace,n]);W.useEffect(function(){AU(n,e.stylisPlugins)||r(e.stylisPlugins)},[e.stylisPlugins]);var u=W.useMemo(function(){return{shouldForwardProp:e.shouldForwardProp,styleSheet:o,stylis:s}},[e.shouldForwardProp,o,s]);return Tn.createElement(e_.Provider,{value:u},Tn.createElement(Sz.Provider,{value:s},e.children))}var xz=function(){function e(t,n){var r=this;this.inject=function(i,o){o===void 0&&(o=Jy);var s=r.name+o.hash;i.hasNameForId(r.id,s)||i.insertRules(r.id,s,o(r.rules,s,"@keyframes"))},this.name=t,this.id="sc-keyframes-".concat(t),this.rules=n,Xy(this,function(){throw Os(12,String(r.name))})}return e.prototype.getName=function(t){return t===void 0&&(t=Jy),this.name+t.hash},e}(),Cz=function(e){return e>="A"&&e<="Z"};function iA(e){for(var t="",n=0;n<e.length;n++){var r=e[n];if(n===1&&r==="-"&&e[0]==="-")return e;Cz(r)?t+="-"+r.toLowerCase():t+=r}return t.startsWith("ms-")?"-"+t:t}var oA=function(e){return e==null||e===!1||e===""},aA=function(e){var t,n,r=[];for(var i in e){var o=e[i];e.hasOwnProperty(i)&&!oA(o)&&(Array.isArray(o)&&o.isCss||Is(o)?r.push("".concat(iA(i),":"),o,";"):Lc(o)?r.push.apply(r,Mc(Mc(["".concat(i," {")],aA(o),!1),["}"],!1)):r.push("".concat(iA(i),": ").concat((t=i,(n=o)==null||typeof n=="boolean"||n===""?"":typeof n!="number"||n===0||t in VU||t.startsWith("--")?String(n).trim():"".concat(n,"px")),";")))}return r};function xa(e,t,n,r){if(oA(e))return[];if(Wy(e))return[".".concat(e.styledComponentId)];if(Is(e)){if(!Is(o=e)||o.prototype&&o.prototype.isReactComponent||!t)return[e];var i=e(t);return xa(i,t,n,r)}var o;return e instanceof xz?n?(e.inject(n,r),[e.getName(r)]):[e]:Lc(e)?aA(e):Array.isArray(e)?Array.prototype.concat.apply(Sh,e.map(function(s){return xa(s,t,n,r)})):[e.toString()]}function sA(e){for(var t=0;t<e.length;t+=1){var n=e[t];if(Is(n)&&!Wy(n))return!1}return!0}var Ez=Hk(_h),kz=function(){function e(t,n,r){this.rules=t,this.staticRulesId="",this.isStatic=(r===void 0||r.isStatic)&&sA(t),this.componentId=n,this.baseHash=Ml(Ez,n),this.baseStyle=r,Ah.registerId(n)}return e.prototype.generateAndInjectStyles=function(t,n,r){var i=this.baseStyle?this.baseStyle.generateAndInjectStyles(t,n,r):"";if(this.isStatic&&!r.hash)if(this.staticRulesId&&n.hasNameForId(this.componentId,this.staticRulesId))i=Rs(i,this.staticRulesId);else{var o=Ky(xa(this.rules,t,n,r)),s=Vy(Ml(this.baseHash,o)>>>0);if(!n.hasNameForId(this.componentId,s)){var u=r(o,".".concat(s),void 0,this.componentId);n.insertRules(this.componentId,s,u)}i=Rs(i,s),this.staticRulesId=s}else{for(var c=Ml(this.baseHash,r.hash),d="",p=0;p<this.rules.length;p++){var h=this.rules[p];if(typeof h=="string")d+=h;else if(h){var m=Ky(xa(h,t,n,r));c=Ml(c,m+p),d+=m}}if(d){var v=Vy(c>>>0);n.hasNameForId(this.componentId,v)||n.insertRules(this.componentId,v,r(d,".".concat(v),void 0,this.componentId)),i=Rs(i,v)}}return i},e}(),Nc=Tn.createContext(void 0);Nc.Consumer;function Az(e){var t=Tn.useContext(Nc),n=W.useMemo(function(){return function(r,i){if(!r)throw Os(14);if(Is(r)){var o=r(i);return o}if(Array.isArray(r)||typeof r!="object")throw Os(8);return i?nr(nr({},i),r):r}(e.theme,t)},[e.theme,t]);return e.children?Tn.createElement(Nc.Provider,{value:n},e.children):null}var t_={};function Iz(e,t,n){var r=Wy(e),i=e,o=!Yy(e),s=t.attrs,u=s===void 0?Sh:s,c=t.componentId,d=c===void 0?function(R,O){var T=typeof R!="string"?"sc":zk(R);t_[T]=(t_[T]||0)+1;var L="".concat(T,"-").concat(Gk(_h+T+t_[T]));return O?"".concat(O,"-").concat(L):L}(t.displayName,t.parentComponentId):c,p=t.displayName,h=p===void 0?function(R){return Yy(R)?"styled.".concat(R):"Styled(".concat(XU(R),")")}(e):p,m=t.displayName&&t.componentId?"".concat(zk(t.displayName),"-").concat(t.componentId):t.componentId||d,v=r&&i.attrs?i.attrs.concat(u).filter(Boolean):u,_=t.shouldForwardProp;if(r&&i.shouldForwardProp){var x=i.shouldForwardProp;if(t.shouldForwardProp){var b=t.shouldForwardProp;_=function(R,O){return x(R,O)&&b(R,O)}}else _=x}var w=new kz(n,m,r?i.componentStyle:void 0);function C(R,O){return function(T,L,B){var z=T.attrs,P=T.componentStyle,V=T.defaultProps,J=T.foldedComponentIds,le=T.styledComponentId,G=T.target,Z=Tn.useContext(Nc),q=Ih(),H=T.shouldForwardProp||q.shouldForwardProp,fe=Fk(L,Z,V)||Tl,we=function(Re,ie,Ne){for(var De,Fe=nr(nr({},ie),{className:void 0,theme:Ne}),We=0;We<Re.length;We+=1){var Pe=Is(De=Re[We])?De(Fe):De;for(var be in Pe)Fe[be]=be==="className"?Rs(Fe[be],Pe[be]):be==="style"?nr(nr({},Fe[be]),Pe[be]):Pe[be]}return ie.className&&(Fe.className=Rs(Fe.className,ie.className)),Fe}(z,L,fe),k=we.as||G,ne={};for(var de in we)we[de]===void 0||de[0]==="$"||de==="as"||de==="theme"&&we.theme===fe||(de==="forwardedAs"?ne.as=we.forwardedAs:H&&!H(de,k)||(ne[de]=we[de],H||br.NODE_ENV));var D=function(Re,ie){var Ne=Ih(),De=Re.generateAndInjectStyles(ie,Ne.styleSheet,Ne.stylis);return De}(P,we),ue=Rs(J,le);return D&&(ue+=" "+D),we.className&&(ue+=" "+we.className),ne[Yy(k)&&!Uk.has(k)?"class":"className"]=ue,B&&(ne.ref=B),W.createElement(k,ne)}(E,R,O)}C.displayName=h;var E=Tn.forwardRef(C);return E.attrs=v,E.componentStyle=w,E.displayName=h,E.shouldForwardProp=_,E.foldedComponentIds=r?Rs(i.foldedComponentIds,i.styledComponentId):"",E.styledComponentId=m,E.target=r?i.target:e,Object.defineProperty(E,"defaultProps",{get:function(){return this._foldedDefaultProps},set:function(R){this._foldedDefaultProps=r?function(O){for(var T=[],L=1;L<arguments.length;L++)T[L-1]=arguments[L];for(var B=0,z=T;B<z.length;B++)Qy(O,z[B],!0);return O}({},i.defaultProps,R):R}}),Xy(E,function(){return".".concat(E.styledComponentId)}),o&&Xk(E,e,{attrs:!0,componentStyle:!0,displayName:!0,foldedComponentIds:!0,shouldForwardProp:!0,styledComponentId:!0,target:!0}),E}function lA(e,t){for(var n=[e[0]],r=0,i=t.length;r<i;r+=1)n.push(t[r],e[r+1]);return n}var uA=function(e){return Object.assign(e,{isCss:!0})};function Bo(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];if(Is(e)||Lc(e))return uA(xa(lA(Sh,Mc([e],t,!0))));var r=e;return t.length===0&&r.length===1&&typeof r[0]=="string"?xa(r):uA(xa(lA(r,t)))}function n_(e,t,n){if(n===void 0&&(n=Tl),!t)throw Os(1,t);var r=function(i){for(var o=[],s=1;s<arguments.length;s++)o[s-1]=arguments[s];return e(t,n,Bo.apply(void 0,Mc([i],o,!1)))};return r.attrs=function(i){return n_(e,t,nr(nr({},n),{attrs:Array.prototype.concat(n.attrs,i).filter(Boolean)}))},r.withConfig=function(i){return n_(e,t,nr(nr({},n),i))},r}var cA=function(e){return n_(Iz,e)},se=cA;Uk.forEach(function(e){se[e]=cA(e)});var Rz=function(){function e(t,n){this.rules=t,this.componentId=n,this.isStatic=sA(t),Ah.registerId(this.componentId+1)}return e.prototype.createStyles=function(t,n,r,i){var o=i(Ky(xa(this.rules,n,r,i)),""),s=this.componentId+t;r.insertRules(s,s,o)},e.prototype.removeStyles=function(t,n){n.clearRules(this.componentId+t)},e.prototype.renderStyles=function(t,n,r,i){t>2&&Ah.registerId(this.componentId+t),this.removeStyles(t,r),this.createStyles(t,n,r,i)},e}();function Oz(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];var r=Bo.apply(void 0,Mc([e],t,!1)),i="sc-global-".concat(Gk(JSON.stringify(r))),o=new Rz(r,i),s=function(c){var d=Ih(),p=Tn.useContext(Nc),h=Tn.useRef(d.styleSheet.allocateGSInstance(i)).current;return d.styleSheet.server&&u(h,c,d.styleSheet,p,d.stylis),Tn.useLayoutEffect(function(){if(!d.styleSheet.server)return u(h,c,d.styleSheet,p,d.stylis),function(){return o.removeStyles(h,d.styleSheet)}},[h,c,d.styleSheet,p,d.stylis]),null};function u(c,d,p,h,m){if(o.isStatic)o.renderStyles(c,YU,p,m);else{var v=nr(nr({},d),{theme:Fk(d,h,s.defaultProps)});o.renderStyles(c,v,p,m)}}return Tn.memo(s)}const pi={CHAT_HISTORY:"chat_history",CLICKED_QUESTIONS:"clicked_questions",PENDING_BULK_ITEMS:"pending_bulk_items",LAST_SHOWN_MESSAGE_ID:"last_shown_message_id",HIDDEN_DYNAMIC_SUGGESTED_QUESTIONS:"hidden_dynamic_suggested_questions",CHAT_RATING:"chat_rating",SHOPIFY_META_DATA:"shopify_meta_data",SESSION_ID:"session_id"};var Rh={USER:"anurag",npm_config_user_agent:"pnpm/10.7.1 npm/? node/v20.11.1 linux x64",npm_node_execpath:"/home/anurag/.local/share/pnpm/nodejs/22.15.0/bin/node",WT_PROFILE_ID:"{51855cb2-8cce-5362-8f54-464b92b32386}",SHLVL:"1",npm_config_noproxy:"",HOME:"/home/anurag",OLDPWD:"/home/anurag/workstation/debales",LESS:"-R",npm_package_json:"/home/anurag/workstation/debales/debales/packages/ai/package.json",ZSH:"/home/anurag/.oh-my-zsh",LSCOLORS:"Gxfxcxdxbxegedabagacad",PAGER:"less",npm_config_userconfig:"/home/anurag/.npmrc",npm_config_local_prefix:"/home/anurag/workstation/debales/debales/packages/ai",DBUS_SESSION_BUS_ADDRESS:"unix:path=/run/user/1000/bus",P9K_TTY:"old",npm_config_engine_strict:"true",WSL_DISTRO_NAME:"Ubuntu",COLOR:"0",npm_config_otp:"343992",WAYLAND_DISPLAY:"wayland-0",LOGNAME:"anurag",PULSE_SERVER:"unix:/mnt/wslg/PulseServer",WSL_INTEROP:"/run/WSL/391_interop",NAME:"Anurag-PC",_P9K_SSH_TTY:"/dev/pts/0",_:"/home/anurag/.local/share/pnpm/pnpm",npm_config_prefix:"/home/anurag/.local/share/pnpm/nodejs/22.15.0",npm_config_npm_version:"10.9.2",npm_config_registry:"https://registry.npmjs.org/",TERM:"xterm-256color",npm_config_cache:"/home/anurag/.npm",npm_config_node_gyp:"/home/anurag/.local/share/pnpm/nodejs/22.15.0/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js",PATH:"/home/anurag/workstation/debales/debales/packages/ai/node_modules/.bin:/home/anurag/workstation/debales/debales/packages/node_modules/.bin:/home/anurag/workstation/debales/debales/node_modules/.bin:/home/anurag/workstation/debales/node_modules/.bin:/home/anurag/workstation/node_modules/.bin:/home/anurag/node_modules/.bin:/home/node_modules/.bin:/node_modules/.bin:/home/anurag/.local/share/pnpm/nodejs/22.15.0/lib/node_modules/npm/node_modules/@npmcli/run-script/lib/node-gyp-bin:/home/anurag/workstation/debales/debales/packages/ai/node_modules/.bin:/snapshot/dist/node-gyp-bin:/home/anurag/workstation/debales/debales/node_modules/.bin:/home/anurag/workstation/debales/debales/packages/ai/node_modules/.bin:/snapshot/dist/node-gyp-bin:/home/anurag/workstation/debales/debales/node_modules/.bin:/home/anurag/workstation/debales/debales/node_modules/.bin:/snapshot/dist/node-gyp-bin:/home/anurag/workstation/debales/debales/node_modules/.bin:/home/anurag/.local/share/pnpm/.tools/@pnpm+linux-x64/10.7.1/bin:/home/anurag/.gvm/bin:/mnt/c/Users/anura/AppData/Local/Programs/cursor/resources/app/bin:/home/anurag/go/bin:/usr/local/go/bin:/home/anurag/bin:/usr/local/bin:/home/anurag/.local/share/pnpm:/usr/local/sbin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/usr/lib/wsl/lib:/mnt/c/Windows/system32:/mnt/c/Windows:/mnt/c/Windows/System32/Wbem:/mnt/c/Windows/System32/WindowsPowerShell/v1.0/:/mnt/c/Windows/System32/OpenSSH/:/mnt/c/Program:Files:(x86)/NVIDIA:Corporation/PhysX/Common:Files/NVIDIA:Corporation/NVIDIA:app/NvDLISR:/mnt/c/WINDOWS/system32:/mnt/c/WINDOWS:/mnt/c/WINDOWS/System32/Wbem:/mnt/c/WINDOWS/System32/WindowsPowerShell/v1.0/:/mnt/c/WINDOWS/System32/OpenSSH/:Files/Docker/Docker/resources/bin:/mnt/c/Users/anura/AppData/Local/Microsoft/WindowsApps:/mnt/c/Users/anura/AppData/Local/Programs/Microsoft:VS:Code/bin:/home/linuxbrew/.linuxbrew/bin",NODE:"/home/anurag/.local/share/pnpm/nodejs/22.15.0/bin/node",npm_package_name:"@debales/ai",XDG_RUNTIME_DIR:"/run/user/1000/",WT_SESSION:"4bf217c8-e079-4e82-ae35-eca5fede312c",npm_config_frozen_lockfile:"",DISPLAY:":0",LANG:"C.UTF-8",LS_COLORS:"rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:mi=00:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arc=01;31:*.arj=01;31:*.taz=01;31:*.lha=01;31:*.lz4=01;31:*.lzh=01;31:*.lzma=01;31:*.tlz=01;31:*.txz=01;31:*.tzo=01;31:*.t7z=01;31:*.zip=01;31:*.z=01;31:*.dz=01;31:*.gz=01;31:*.lrz=01;31:*.lz=01;31:*.lzo=01;31:*.xz=01;31:*.zst=01;31:*.tzst=01;31:*.bz2=01;31:*.bz=01;31:*.tbz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.war=01;31:*.ear=01;31:*.sar=01;31:*.rar=01;31:*.alz=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.cab=01;31:*.wim=01;31:*.swm=01;31:*.dwm=01;31:*.esd=01;31:*.jpg=01;35:*.jpeg=01;35:*.mjpg=01;35:*.mjpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.webm=01;35:*.webp=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.cgm=01;35:*.emf=01;35:*.ogv=01;35:*.ogx=01;35:*.aac=00;36:*.au=00;36:*.flac=00;36:*.m4a=00;36:*.mid=00;36:*.midi=00;36:*.mka=00;36:*.mp3=00;36:*.mpc=00;36:*.ogg=00;36:*.ra=00;36:*.wav=00;36:*.oga=00;36:*.opus=00;36:*.spx=00;36:*.xspf=00;36:",npm_lifecycle_script:"tsc -b && vite build --config vite.browser.config.ts",GVM_VERSION:"1.0.22",SHELL:"/usr/bin/zsh",NODE_PATH:"/home/anurag/workstation/debales/debales/node_modules/.pnpm/vite@6.2.5_@types+node@22.14.0_jiti@2.4.2_lightningcss@1.29.2_terser@5.39.0_yaml@2.7.1/node_modules/vite/bin/node_modules:/home/anurag/workstation/debales/debales/node_modules/.pnpm/vite@6.2.5_@types+node@22.14.0_jiti@2.4.2_lightningcss@1.29.2_terser@5.39.0_yaml@2.7.1/node_modules/vite/node_modules:/home/anurag/workstation/debales/debales/node_modules/.pnpm/vite@6.2.5_@types+node@22.14.0_jiti@2.4.2_lightningcss@1.29.2_terser@5.39.0_yaml@2.7.1/node_modules:/home/anurag/workstation/debales/debales/node_modules/.pnpm/node_modules:/home/anurag/workstation/debales/debales/node_modules/.pnpm/@changesets+cli@2.28.1/node_modules/@changesets/cli/node_modules:/home/anurag/workstation/debales/debales/node_modules/.pnpm/@changesets+cli@2.28.1/node_modules/@changesets/node_modules:/home/anurag/workstation/debales/debales/node_modules/.pnpm/@changesets+cli@2.28.1/node_modules:/home/anurag/workstation/debales/debales/node_modules/.pnpm/node_modules:/home/anurag/.local/share/pnpm/global/5/.pnpm/@pnpm+exe@10.6.3/node_modules/@pnpm/exe/node_modules:/home/anurag/.local/share/pnpm/global/5/.pnpm/@pnpm+exe@10.6.3/node_modules/@pnpm/node_modules:/home/anurag/.local/share/pnpm/global/5/.pnpm/@pnpm+exe@10.6.3/node_modules:/home/anurag/.local/share/pnpm/global/5/.pnpm/node_modules",npm_package_version:"1.1.3-canary.1",npm_config_verify_deps_before_run:"false",npm_config_access:"public",npm_lifecycle_event:"build:browser",npm_config_tag:"canary",P9K_SSH:"0",npm_config_globalconfig:"/home/anurag/.config/pnpm/npmrc",npm_config_init_module:"/home/anurag/.npm-init.js",PWD:"/home/anurag/workstation/debales/debales/packages/ai",npm_execpath:"/home/anurag/.local/share/pnpm/nodejs/22.15.0/lib/node_modules/npm/bin/npm-cli.js",_P9K_TTY:"/dev/pts/0",GVM_ROOT:"/home/anurag/.gvm",npm_config_global_prefix:"/home/anurag/.local/share/pnpm/nodejs/22.15.0",PNPM_SCRIPT_SRC_DIR:"/home/anurag/workstation/debales/debales/packages/ai",npm_command:"run-script",BREW_HOME:"/home/linuxbrew/.linuxbrew/bin",HOSTTYPE:"x86_64",WSL2_GUI_APPS_ENABLED:"1",PNPM_HOME:"/home/anurag/.local/share/pnpm",GVM_PATH_BACKUP:"/home/anurag/.gvm/bin:/mnt/c/Users/anura/AppData/Local/Programs/cursor/resources/app/bin:/home/anurag/go/bin:/usr/local/go/bin:/home/anurag/bin:/usr/local/bin:/home/anurag/.local/share/pnpm:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/usr/lib/wsl/lib:/mnt/c/Windows/system32:/mnt/c/Windows:/mnt/c/Windows/System32/Wbem:/mnt/c/Windows/System32/WindowsPowerShell/v1.0/:/mnt/c/Windows/System32/OpenSSH/:/mnt/c/Program Files (x86)/NVIDIA Corporation/PhysX/Common:/mnt/c/Program Files/NVIDIA Corporation/NVIDIA app/NvDLISR:/mnt/c/WINDOWS/system32:/mnt/c/WINDOWS:/mnt/c/WINDOWS/System32/Wbem:/mnt/c/WINDOWS/System32/WindowsPowerShell/v1.0/:/mnt/c/WINDOWS/System32/OpenSSH/:/mnt/c/Program Files/Docker/Docker/resources/bin:/mnt/c/Users/anura/AppData/Local/Microsoft/WindowsApps:/mnt/c/Users/anura/AppData/Local/Programs/Microsoft VS Code/bin:/mnt/c/Users/anura/AppData/Local/Programs/cursor/resources/app/bin:/home/linuxbrew/.linuxbrew/bin",WSLENV:"WT_SESSION:WT_PROFILE_ID:",INIT_CWD:"/home/anurag/workstation/debales/debales/packages/ai",npm_config_json:"true",EDITOR:"vi",NODE_ENV:"production"},Ue;if(typeof window>"u"){var fA={hostname:""};Ue={crypto:{randomUUID:function(){throw Error("unsupported")}},navigator:{userAgent:"",onLine:!0},document:{createElement:function(){return{}},location:fA,referrer:""},screen:{width:0,height:0},location:fA,addEventListener:function(){},removeEventListener:function(){}}}else Ue=window;function dA(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function hA(e,t,n,r,i,o,s){try{var u=e[o](s),c=u.value}catch(d){n(d);return}u.done?t(c):Promise.resolve(c).then(r,i)}function r_(e){return function(){var t=this,n=arguments;return new Promise(function(r,i){var o=e.apply(t,n);function s(c){hA(o,r,i,s,u,"next",c)}function u(c){hA(o,r,i,s,u,"throw",c)}s(void 0)})}}function Oh(e,t,n){return pA()?Oh=Reflect.construct:Oh=function(i,o,s){var u=[null];u.push.apply(u,o);var c=Function.bind.apply(i,u),d=new c;return s&&Bc(d,s.prototype),d},Oh.apply(null,arguments)}function Tz(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function sr(e,t,n){return t&&Tz(e.prototype,t),e}function Bt(){return Bt=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Bt.apply(this,arguments)}function i_(e){return i_=Object.setPrototypeOf?Object.getPrototypeOf:function(n){return n.__proto__||Object.getPrototypeOf(n)},i_(e)}function Sr(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Bc(e,t)}function vt(e,t){return t!=null&&typeof Symbol<"u"&&t[Symbol.hasInstance]?!!t[Symbol.hasInstance](e):e instanceof t}function Mz(e){return Function.toString.call(e).indexOf("[native code]")!==-1}function Pc(e,t){if(e==null)return{};var n={},r=Object.keys(e),i,o;for(o=0;o<r.length;o++)i=r[o],!(t.indexOf(i)>=0)&&(n[i]=e[i]);return n}function Bc(e,t){return Bc=Object.setPrototypeOf||function(r,i){return r.__proto__=i,r},Bc(e,t)}function Rt(e){"@swc/helpers - typeof";return e&&typeof Symbol<"u"&&e.constructor===Symbol?"symbol":typeof e}function Dz(e,t){if(e){if(typeof e=="string")return dA(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(n);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return dA(e,t)}}function Th(e){var t=typeof Map=="function"?new Map:void 0;return Th=function(r){if(r===null||!Mz(r))return r;if(typeof r!="function")throw new TypeError("Super expression must either be null or a function");if(typeof t<"u"){if(t.has(r))return t.get(r);t.set(r,i)}function i(){return Oh(r,arguments,i_(this).constructor)}return i.prototype=Object.create(r.prototype,{constructor:{value:i,enumerable:!1,writable:!0,configurable:!0}}),Bc(i,r)},Th(e)}function pA(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(pA=function(){return!!e})()}function Ve(e,t){var n=typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=Dz(e))||t){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function Fc(e,t){var n,r,i,o,s={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]};return o={next:u(0),throw:u(1),return:u(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function u(d){return function(p){return c([d,p])}}function c(d){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=d[0]&2?r.return:d[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,d[1])).done)return i;switch(r=0,i&&(d=[d[0]&2,i.value]),d[0]){case 0:case 1:i=d;break;case 4:return s.label++,{value:d[1],done:!1};case 5:s.label++,r=d[1],d=[0];continue;case 7:d=s.ops.pop(),s.trys.pop();continue;default:if(i=s.trys,!(i=i.length>0&&i[i.length-1])&&(d[0]===6||d[0]===2)){s=0;continue}if(d[0]===3&&(!i||d[1]>i[0]&&d[1]<i[3])){s.label=d[1];break}if(d[0]===6&&s.label<i[1]){s.label=i[1],i=d;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(d);break}i[2]&&s.ops.pop(),s.trys.pop();continue}d=t.call(e,s)}catch(p){d=[6,p],r=0}finally{n=i=0}if(d[0]&5)throw d[1];return{value:d[0]?d[1]:void 0,done:!0}}}function gA(e){var t=typeof Symbol=="function"&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}var $z=Object.defineProperty,Lz=function(e,t,n){return t in e?$z(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n},Le=function(e,t,n){return Lz(e,(typeof t>"u"?"undefined":Rt(t))!=="symbol"?t+"":t,n)},mA,Nz=Object.defineProperty,Pz=function(e,t,n){return t in e?Nz(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n},vA=function(e,t,n){return Pz(e,(typeof t>"u"?"undefined":Rt(t))!=="symbol"?t+"":t,n)},Kn=function(e){return e[e.Document=0]="Document",e[e.DocumentType=1]="DocumentType",e[e.Element=2]="Element",e[e.Text=3]="Text",e[e.CDATA=4]="CDATA",e[e.Comment=5]="Comment",e}(Kn||{}),yA={Node:["childNodes","parentNode","parentElement","textContent"],ShadowRoot:["host","styleSheets"],Element:["shadowRoot","querySelector","querySelectorAll"],MutationObserver:[]},_A={Node:["contains","getRootNode"],ShadowRoot:["getSelection"],Element:[],MutationObserver:["constructor"]},Mh={},Bz=function(){return!!globalThis.Zone};function o_(e){if(Mh[e])return Mh[e];var t=globalThis[e],n=t.prototype,r=e in yA?yA[e]:void 0,i=!!(r&&r.every(function(p){var h,m;return!!((m=(h=Object.getOwnPropertyDescriptor(n,p))==null?void 0:h.get)!=null&&m.toString().includes("[native code]"))})),o=e in _A?_A[e]:void 0,s=!!(o&&o.every(function(p){var h;return typeof n[p]=="function"&&((h=n[p])==null?void 0:h.toString().includes("[native code]"))}));if(i&&s&&!Bz())return Mh[e]=t.prototype,t.prototype;try{var u=document.createElement("iframe");document.body.appendChild(u);var c=u.contentWindow;if(!c)return t.prototype;var d=c[e].prototype;return document.body.removeChild(u),d?Mh[e]=d:n}catch{return n}}var a_={};function Ca(e,t,n){var r,i=e+"."+String(n);if(a_[i])return a_[i].call(t);var o=o_(e),s=(r=Object.getOwnPropertyDescriptor(o,n))==null?void 0:r.get;return s?(a_[i]=s,s.call(t)):t[n]}var s_={};function bA(e,t,n){var r=e+"."+String(n);if(s_[r])return s_[r].bind(t);var i=o_(e),o=i[n];return typeof o!="function"?t[n]:(s_[r]=o,o.bind(t))}function Fz(e){return Ca("Node",e,"childNodes")}function Uz(e){return Ca("Node",e,"parentNode")}function zz(e){return Ca("Node",e,"parentElement")}function qz(e){return Ca("Node",e,"textContent")}function jz(e,t){return bA("Node",e,"contains")(t)}function Hz(e){return bA("Node",e,"getRootNode")()}function Gz(e){return!e||!("host"in e)?null:Ca("ShadowRoot",e,"host")}function Vz(e){return e.styleSheets}function Zz(e){return!e||!("shadowRoot"in e)?null:Ca("Element",e,"shadowRoot")}function Yz(e,t){return Ca("Element",e,"querySelector")(t)}function Wz(e,t){return Ca("Element",e,"querySelectorAll")(t)}function Kz(){return o_("MutationObserver").constructor}var wr={childNodes:Fz,parentNode:Uz,parentElement:zz,textContent:qz,contains:jz,getRootNode:Hz,host:Gz,styleSheets:Vz,shadowRoot:Zz,querySelector:Yz,querySelectorAll:Wz,mutationObserver:Kz};function SA(e){return e.nodeType===e.ELEMENT_NODE}function Uc(e){var t=e&&"host"in e&&"mode"in e&&wr.host(e)||null;return!!(t&&"shadowRoot"in t&&wr.shadowRoot(t)===e)}function zc(e){return Object.prototype.toString.call(e)==="[object ShadowRoot]"}function Qz(e){return e.includes(" background-clip: text;")&&!e.includes(" -webkit-background-clip: text;")&&(e=e.replace(/\sbackground-clip:\s*text;/g," -webkit-background-clip: text; background-clip: text;")),e}function Xz(e){var t=e.cssText;if(t.split('"').length<3)return t;var n=["@import","url("+JSON.stringify(e.href)+")"];return e.layerName===""?n.push("layer"):e.layerName&&n.push("layer("+e.layerName+")"),e.supportsText&&n.push("supports("+e.supportsText+")"),e.media.length&&n.push(e.media.mediaText),n.join(" ")+";"}function l_(e){try{var t=e.rules||e.cssRules;if(!t)return null;var n=e.href;!n&&e.ownerNode&&e.ownerNode.ownerDocument&&(n=e.ownerNode.ownerDocument.location.href);var r=Array.from(t,function(i){return wA(i,n)}).join("");return Qz(r)}catch{return null}}function wA(e,t){if(e7(e)){var n;try{n=l_(e.styleSheet)||Xz(e)}catch{n=e.cssText}return e.styleSheet.href?Dh(n,e.styleSheet.href):n}else{var r=e.cssText;return t7(e)&&e.selectorText.includes(":")&&(r=Jz(r)),t?Dh(r,t):r}}function Jz(e){var t=/(\[(?:[\w-]+)[^\\])(:(?:[\w-]+)\])/gm;return e.replace(t,"$1\\$2")}function e7(e){return"styleSheet"in e}function t7(e){return"selectorText"in e}var xA=function(){function e(){vA(this,"idNodeMap",new Map),vA(this,"nodeMetaMap",new WeakMap)}var t=e.prototype;return t.getId=function(r){var i;if(!r)return-1;var o=(i=this.getMeta(r))==null?void 0:i.id;return o??-1},t.getNode=function(r){return this.idNodeMap.get(r)||null},t.getIds=function(){return Array.from(this.idNodeMap.keys())},t.getMeta=function(r){return this.nodeMetaMap.get(r)||null},t.removeNodeFromMap=function(r){var i=this,o=this.getId(r);this.idNodeMap.delete(o),r.childNodes&&r.childNodes.forEach(function(s){return i.removeNodeFromMap(s)})},t.has=function(r){return this.idNodeMap.has(r)},t.hasNode=function(r){return this.nodeMetaMap.has(r)},t.add=function(r,i){var o=i.id;this.idNodeMap.set(o,r),this.nodeMetaMap.set(r,i)},t.replace=function(r,i){var o=this.getNode(r);if(o){var s=this.nodeMetaMap.get(o);s&&this.nodeMetaMap.set(i,s)}this.idNodeMap.set(r,i)},t.reset=function(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap},e}();function n7(){return new xA}function u_(e){var t=e.element,n=e.maskInputOptions,r=e.tagName,i=e.type,o=e.value,s=e.maskInputFn,u=o||"",c=i&&Ts(i);return(n[r.toLowerCase()]||c&&n[c])&&(s?u=s(u,t):u="*".repeat(u.length)),u}function Ts(e){return e.toLowerCase()}var CA="__rrweb_original__";function r7(e){var t=e.getContext("2d");if(!t)return!0;for(var n=50,r=0;r<e.width;r+=n)for(var i=0;i<e.height;i+=n){var o=t.getImageData,s=CA in o?o[CA]:o,u=new Uint32Array(s.call(t,r,i,Math.min(n,e.width-r),Math.min(n,e.height-i)).data.buffer);if(u.some(function(c){return c!==0}))return!1}return!0}function c_(e){var t=e.type;return e.hasAttribute("data-rr-is-password")?"password":t?Ts(t):null}function EA(e,t){var n;try{n=new URL(e,t??window.location.href)}catch{return null}var r=/\.([0-9a-z]+)(?:$)/i,i=n.pathname.match(r),o;return(o=i==null?void 0:i[1])!=null?o:null}function i7(e){var t="";return e.indexOf("//")>-1?t=e.split("/").slice(0,3).join("/"):t=e.split("/")[0],t=t.split("?")[0],t}var o7=/url\((?:(')([^']*)'|(")(.*?)"|([^)]*))\)/gm,a7=/^(?:[a-z+]+:)?\/\//i,s7=/^www\..*/i,l7=/^(data:)([^,]*),(.*)/i;function Dh(e,t){return(e||"").replace(o7,function(n,r,i,o,s,u){var c=i||s||u,d=r||o||"";if(!c)return n;if(a7.test(c)||s7.test(c)||l7.test(c))return"url("+d+c+d+")";if(c[0]==="/")return"url("+d+(i7(t)+c)+d+")";var p=t.split("/"),h=c.split("/");p.pop();for(var m=Ve(h),v;!(v=m()).done;){var _=v.value;_!=="."&&(_===".."?p.pop():p.push(_))}return"url("+d+p.join("/")+d+")"})}function f_(e){return e.replace(/(\/\*[^*]*\*\/)|[\s;]/g,"")}function u7(e,t){var n=Array.from(t.childNodes),r=[];if(n.length>1&&e&&typeof e=="string"){for(var i=f_(e),o=1;o<n.length;o++)if(n[o].textContent&&typeof n[o].textContent=="string")for(var s=f_(n[o].textContent),u=3;u<s.length;u++){var c=s.substring(0,u);if(i.split(c).length===2){for(var d=i.indexOf(c),p=d;p<e.length;p++)if(f_(e.substring(0,p)).length===d){r.push(e.substring(0,p)),e=e.substring(p);break}break}}}return r.push(e),r}function c7(e,t){return u7(e,t).join("/* rr_split */")}var f7=1,d7=new RegExp("[^a-z0-9-_:]"),qc=-2;function kA(){return f7++}function h7(e){if(vt(e,HTMLFormElement))return"form";var t=Ts(e.tagName);return d7.test(t)?"div":t}var Dl,AA,p7=/^[^ \t\n\r\u000c]+/,g7=/^[, \t\n\r\u000c]+/;function m7(e,t){if(t.trim()==="")return t;var n=0;function r(d){var p,h=d.exec(t.substring(n));return h?(p=h[0],n+=p.length,p):""}for(var i=[];r(g7),!(n>=t.length);){var o=r(p7);if(o.slice(-1)===",")o=$l(e,o.substring(0,o.length-1)),i.push(o);else{var s="";o=$l(e,o);for(var u=!1;;){var c=t.charAt(n);if(c===""){i.push((o+s).trim());break}else if(u)c===")"&&(u=!1);else if(c===","){n+=1,i.push((o+s).trim());break}else c==="("&&(u=!0);s+=c,n+=1}}}return i.join(", ")}var IA=new WeakMap;function $l(e,t){return!t||t.trim()===""?t:d_(e,t)}function v7(e){return!!(e.tagName==="svg"||e.ownerSVGElement)}function d_(e,t){var n=IA.get(e);if(n||(n=e.createElement("a"),IA.set(e,n)),!t)t="";else if(t.startsWith("blob:")||t.startsWith("data:"))return t;return n.setAttribute("href",t),n.href}function RA(e,t,n,r){return r&&(n==="src"||n==="href"&&!(t==="use"&&r[0]==="#")||n==="xlink:href"&&r[0]!=="#"||n==="background"&&(t==="table"||t==="td"||t==="th")?$l(e,r):n==="srcset"?m7(e,r):n==="style"?Dh(r,d_(e)):t==="object"&&n==="data"?$l(e,r):r)}function OA(e,t,n){return(e==="video"||e==="audio")&&t==="autoplay"}function y7(e,t,n){try{if(typeof t=="string"){if(e.classList.contains(t))return!0}else for(var r=e.classList.length;r--;){var i=e.classList[r];if(t.test(i))return!0}if(n)return e.matches(n)}catch{}return!1}function $h(e,t,n){if(!e)return!1;if(e.nodeType!==e.ELEMENT_NODE)return n?$h(wr.parentNode(e),t,n):!1;for(var r=e.classList.length;r--;){var i=e.classList[r];if(t.test(i))return!0}return n?$h(wr.parentNode(e),t,n):!1}function TA(e,t,n,r){var i;if(SA(e)){if(i=e,!wr.childNodes(i).length)return!1}else{if(wr.parentElement(e)===null)return!1;i=wr.parentElement(e)}try{if(typeof t=="string"){if(r){if(i.closest("."+t))return!0}else if(i.classList.contains(t))return!0}else if($h(i,t,r))return!0;if(n){if(r){if(i.closest(n))return!0}else if(i.matches(n))return!0}}catch{}return!1}function _7(e,t,n){var r=e.contentWindow;if(r){var i=!1,o;try{o=r.document.readyState}catch{return}if(o!=="complete"){var s=setTimeout(function(){i||(t(),i=!0)},n);e.addEventListener("load",function(){clearTimeout(s),i=!0,t()});return}var u="about:blank";if(r.location.href!==u||e.src===u||e.src==="")return setTimeout(t,0),e.addEventListener("load",t);e.addEventListener("load",t)}}function b7(e,t,n){var r=!1,i;try{i=e.sheet}catch{return}if(!i){var o=setTimeout(function(){r||(t(),r=!0)},n);e.addEventListener("load",function(){clearTimeout(o),r=!0,t()})}}function S7(e,t){var n=t.doc,r=t.mirror,i=t.blockClass,o=t.blockSelector,s=t.needsMask,u=t.inlineStylesheet,c=t.maskInputOptions,d=c===void 0?{}:c,p=t.maskTextFn,h=t.maskInputFn,m=t.dataURLOptions,v=m===void 0?{}:m,_=t.inlineImages,x=t.recordCanvas,b=t.keepIframeSrcFn,w=t.newlyAddedElement,C=w===void 0?!1:w,E=t.cssCaptured,R=E===void 0?!1:E,O=w7(n,r);switch(e.nodeType){case e.DOCUMENT_NODE:return e.compatMode!=="CSS1Compat"?{type:Kn.Document,childNodes:[],compatMode:e.compatMode}:{type:Kn.Document,childNodes:[]};case e.DOCUMENT_TYPE_NODE:return{type:Kn.DocumentType,name:e.name,publicId:e.publicId,systemId:e.systemId,rootId:O};case e.ELEMENT_NODE:return C7(e,{doc:n,blockClass:i,blockSelector:o,inlineStylesheet:u,maskInputOptions:d,maskInputFn:h,dataURLOptions:v,inlineImages:_,recordCanvas:x,keepIframeSrcFn:b,newlyAddedElement:C,rootId:O});case e.TEXT_NODE:return x7(e,{doc:n,needsMask:s,maskTextFn:p,rootId:O,cssCaptured:R});case e.CDATA_SECTION_NODE:return{type:Kn.CDATA,textContent:"",rootId:O};case e.COMMENT_NODE:return{type:Kn.Comment,textContent:wr.textContent(e)||"",rootId:O};default:return!1}}function w7(e,t){if(t.hasNode(e)){var n=t.getId(e);return n===1?void 0:n}}function x7(e,t){var n=t.needsMask,r=t.maskTextFn,i=t.rootId,o=t.cssCaptured,s=wr.parentNode(e),u=s&&s.tagName,c="",d=u==="STYLE"?!0:void 0,p=u==="SCRIPT"?!0:void 0;return p?c="SCRIPT_PLACEHOLDER":o||(c=wr.textContent(e),d&&c&&(c=Dh(c,d_(t.doc)))),!d&&!p&&c&&n&&(c=r?r(c,wr.parentElement(e)):c.replace(/[\S]/g,"*")),{type:Kn.Text,textContent:c||"",rootId:i}}function C7(e,t){for(var n=t.doc,r=t.blockClass,i=t.blockSelector,o=t.inlineStylesheet,s=t.maskInputOptions,u=s===void 0?{}:s,c=t.maskInputFn,d=t.dataURLOptions,p=d===void 0?{}:d,h=t.inlineImages,m=t.recordCanvas,v=t.keepIframeSrcFn,_=t.newlyAddedElement,x=_===void 0?!1:_,b=t.rootId,w=y7(e,r,i),C=h7(e),E={},R=e.attributes.length,O=0;O<R;O++){var T=e.attributes[O];OA(C,T.name,T.value)||(E[T.name]=RA(n,C,Ts(T.name),T.value))}if(C==="link"&&o){var L=Array.from(n.styleSheets).find(function(ue){return ue.href===e.href}),B=null;L&&(B=l_(L)),B&&(delete E.rel,delete E.href,E._cssText=B)}if(C==="style"&&e.sheet){var z=l_(e.sheet);z&&(e.childNodes.length>1&&(z=c7(z,e)),E._cssText=z)}if(C==="input"||C==="textarea"||C==="select"){var P=e.value,V=e.checked;E.type!=="radio"&&E.type!=="checkbox"&&E.type!=="submit"&&E.type!=="button"&&P?E.value=u_({element:e,type:c_(e),tagName:C,value:P,maskInputOptions:u,maskInputFn:c}):V&&(E.checked=V)}if(C==="option"&&(e.selected&&!u.select?E.selected=!0:delete E.selected),C==="dialog"&&e.open&&(E.rr_open_mode=e.matches("dialog:modal")?"modal":"non-modal"),C==="canvas"&&m){if(e.__context==="2d")r7(e)||(E.rr_dataURL=e.toDataURL(p.type,p.quality));else if(!("__context"in e)){var J=e.toDataURL(p.type,p.quality),le=n.createElement("canvas");le.width=e.width,le.height=e.height;var G=le.toDataURL(p.type,p.quality);J!==G&&(E.rr_dataURL=J)}}if(C==="img"&&h){Dl||(Dl=n.createElement("canvas"),AA=Dl.getContext("2d"));var Z=e,q=Z.currentSrc||Z.getAttribute("src")||"<unknown-src>",H=Z.crossOrigin,fe=function(){Z.removeEventListener("load",fe);try{Dl.width=Z.naturalWidth,Dl.height=Z.naturalHeight,AA.drawImage(Z,0,0),E.rr_dataURL=Dl.toDataURL(p.type,p.quality)}catch(ue){if(Z.crossOrigin!=="anonymous"){Z.crossOrigin="anonymous",Z.complete&&Z.naturalWidth!==0?fe():Z.addEventListener("load",fe);return}else console.warn("Cannot inline img src="+q+"! Error: "+ue)}Z.crossOrigin==="anonymous"&&(H?E.crossOrigin=H:Z.removeAttribute("crossorigin"))};Z.complete&&Z.naturalWidth!==0?fe():Z.addEventListener("load",fe)}if(C==="audio"||C==="video"){var we=E;we.rr_mediaState=e.paused?"paused":"played",we.rr_mediaCurrentTime=e.currentTime,we.rr_mediaPlaybackRate=e.playbackRate,we.rr_mediaMuted=e.muted,we.rr_mediaLoop=e.loop,we.rr_mediaVolume=e.volume}if(x||(e.scrollLeft&&(E.rr_scrollLeft=e.scrollLeft),e.scrollTop&&(E.rr_scrollTop=e.scrollTop)),w){var k=e.getBoundingClientRect(),ne=k.width,de=k.height;E={class:E.class,rr_width:""+ne+"px",rr_height:""+de+"px"}}C==="iframe"&&!v(E.src)&&(e.contentDocument||(E.rr_src=E.src),delete E.src);var D;try{customElements.get(C)&&(D=!0)}catch{}return{type:Kn.Element,tagName:C,attributes:E,childNodes:[],isSVG:v7(e)||void 0,needBlock:w,rootId:b,isCustom:D}}function ln(e){return e==null?"":e.toLowerCase()}function E7(e,t){if(t.comment&&e.type===Kn.Comment)return!0;if(e.type===Kn.Element){if(t.script&&(e.tagName==="script"||e.tagName==="link"&&(e.attributes.rel==="preload"||e.attributes.rel==="modulepreload")&&e.attributes.as==="script"||e.tagName==="link"&&e.attributes.rel==="prefetch"&&typeof e.attributes.href=="string"&&EA(e.attributes.href)==="js"))return!0;if(t.headFavicon&&(e.tagName==="link"&&e.attributes.rel==="shortcut icon"||e.tagName==="meta"&&(ln(e.attributes.name).match(/^msapplication-tile(image|color)$/)||ln(e.attributes.name)==="application-name"||ln(e.attributes.rel)==="icon"||ln(e.attributes.rel)==="apple-touch-icon"||ln(e.attributes.rel)==="shortcut icon")))return!0;if(e.tagName==="meta"){if(t.headMetaDescKeywords&&ln(e.attributes.name).match(/^description|keywords$/))return!0;if(t.headMetaSocial&&(ln(e.attributes.property).match(/^(og|twitter|fb):/)||ln(e.attributes.name).match(/^(og|twitter):/)||ln(e.attributes.name)==="pinterest"))return!0;if(t.headMetaRobots&&(ln(e.attributes.name)==="robots"||ln(e.attributes.name)==="googlebot"||ln(e.attributes.name)==="bingbot"))return!0;if(t.headMetaHttpEquiv&&e.attributes["http-equiv"]!==void 0)return!0;if(t.headMetaAuthorship&&(ln(e.attributes.name)==="author"||ln(e.attributes.name)==="generator"||ln(e.attributes.name)==="framework"||ln(e.attributes.name)==="publisher"||ln(e.attributes.name)==="progid"||ln(e.attributes.property).match(/^article:/)||ln(e.attributes.property).match(/^product:/)))return!0;if(t.headMetaVerification&&(ln(e.attributes.name)==="google-site-verification"||ln(e.attributes.name)==="yandex-verification"||ln(e.attributes.name)==="csrf-token"||ln(e.attributes.name)==="p:domain_verify"||ln(e.attributes.name)==="verify-v1"||ln(e.attributes.name)==="verification"||ln(e.attributes.name)==="shopify-checkout-api-token"))return!0}}return!1}function Ll(e,t){var n=t.doc,r=t.mirror,i=t.blockClass,o=t.blockSelector,s=t.maskTextClass,u=t.maskTextSelector,c=t.skipChild,d=c===void 0?!1:c,p=t.inlineStylesheet,h=p===void 0?!0:p,m=t.maskInputOptions,v=m===void 0?{}:m,_=t.maskTextFn,x=t.maskInputFn,b=t.slimDOMOptions,w=t.dataURLOptions,C=w===void 0?{}:w,E=t.inlineImages,R=E===void 0?!1:E,O=t.recordCanvas,T=O===void 0?!1:O,L=t.onSerialize,B=t.onIframeLoad,z=t.iframeLoadTimeout,P=z===void 0?5e3:z,V=t.onStylesheetLoad,J=t.stylesheetLoadTimeout,le=J===void 0?5e3:J,G=t.keepIframeSrcFn,Z=G===void 0?function(){return!1}:G,q=t.newlyAddedElement,H=q===void 0?!1:q,fe=t.cssCaptured,we=fe===void 0?!1:fe,k=t.needsMask,ne=t.preserveWhiteSpace,de=ne===void 0?!0:ne;if(!k){var D=k===void 0;k=TA(e,s,u,D)}var ue=S7(e,{doc:n,mirror:r,blockClass:i,blockSelector:o,needsMask:k,inlineStylesheet:h,maskInputOptions:v,maskTextFn:_,maskInputFn:x,dataURLOptions:C,inlineImages:R,recordCanvas:T,keepIframeSrcFn:Z,newlyAddedElement:H,cssCaptured:we});if(!ue)return console.warn(e,"not serialized"),null;var Re;r.hasNode(e)?Re=r.getId(e):E7(ue,b)||!de&&ue.type===Kn.Text&&!ue.textContent.replace(/^\s+|\s+$/gm,"").length?Re=qc:Re=kA();var ie=Object.assign(ue,{id:Re});if(r.add(e,ie),Re===qc)return null;L&&L(e);var Ne=!d;if(ie.type===Kn.Element){Ne=Ne&&!ie.needBlock,delete ie.needBlock;var De=wr.shadowRoot(e);De&&zc(De)&&(ie.isShadowHost=!0)}if((ie.type===Kn.Document||ie.type===Kn.Element)&&Ne){b.headWhitespace&&ie.type===Kn.Element&&ie.tagName==="head"&&(de=!1);var Fe={doc:n,mirror:r,blockClass:i,blockSelector:o,needsMask:k,maskTextClass:s,maskTextSelector:u,skipChild:d,inlineStylesheet:h,maskInputOptions:v,maskTextFn:_,maskInputFn:x,slimDOMOptions:b,dataURLOptions:C,inlineImages:R,recordCanvas:T,preserveWhiteSpace:de,onSerialize:L,onIframeLoad:B,iframeLoadTimeout:P,onStylesheetLoad:V,stylesheetLoadTimeout:le,keepIframeSrcFn:Z,cssCaptured:!1};if(!(ie.type===Kn.Element&&ie.tagName==="textarea"&&ie.attributes.value!==void 0)){ie.type===Kn.Element&&ie.attributes._cssText!==void 0&&typeof ie.attributes._cssText=="string"&&(Fe.cssCaptured=!0);for(var We=Ve(Array.from(wr.childNodes(e))),Pe;!(Pe=We()).done;){var be=Pe.value,Ke=Ll(be,Fe);Ke&&ie.childNodes.push(Ke)}}var Je=null;if(SA(e)&&(Je=wr.shadowRoot(e)))for(var dt=Ve(Array.from(wr.childNodes(Je))),tt;!(tt=dt()).done;){var lt=tt.value,N=Ll(lt,Fe);N&&(zc(Je)&&(N.isShadow=!0),ie.childNodes.push(N))}}var F=wr.parentNode(e);return F&&Uc(F)&&zc(F)&&(ie.isShadow=!0),ie.type===Kn.Element&&ie.tagName==="iframe"&&_7(e,function(){var K=e.contentDocument;if(K&&B){var me=Ll(K,{doc:K,mirror:r,blockClass:i,blockSelector:o,needsMask:k,maskTextClass:s,maskTextSelector:u,skipChild:!1,inlineStylesheet:h,maskInputOptions:v,maskTextFn:_,maskInputFn:x,slimDOMOptions:b,dataURLOptions:C,inlineImages:R,recordCanvas:T,preserveWhiteSpace:de,onSerialize:L,onIframeLoad:B,iframeLoadTimeout:P,onStylesheetLoad:V,stylesheetLoadTimeout:le,keepIframeSrcFn:Z});me&&B(e,me)}},P),ie.type===Kn.Element&&ie.tagName==="link"&&typeof ie.attributes.rel=="string"&&(ie.attributes.rel==="stylesheet"||ie.attributes.rel==="preload"&&typeof ie.attributes.href=="string"&&EA(ie.attributes.href)==="css")&&b7(e,function(){if(V){var K=Ll(e,{doc:n,mirror:r,blockClass:i,blockSelector:o,needsMask:k,maskTextClass:s,maskTextSelector:u,skipChild:!1,inlineStylesheet:h,maskInputOptions:v,maskTextFn:_,maskInputFn:x,slimDOMOptions:b,dataURLOptions:C,inlineImages:R,recordCanvas:T,preserveWhiteSpace:de,onSerialize:L,onIframeLoad:B,iframeLoadTimeout:P,onStylesheetLoad:V,stylesheetLoadTimeout:le,keepIframeSrcFn:Z});K&&V(e,K)}},le),ie}function k7(e,t){var n=t||{},r=n.mirror,i=r===void 0?new xA:r,o=n.blockClass,s=o===void 0?"rr-block":o,u=n.blockSelector,c=u===void 0?null:u,d=n.maskTextClass,p=d===void 0?"rr-mask":d,h=n.maskTextSelector,m=h===void 0?null:h,v=n.inlineStylesheet,_=v===void 0?!0:v,x=n.inlineImages,b=x===void 0?!1:x,w=n.recordCanvas,C=w===void 0?!1:w,E=n.maskAllInputs,R=E===void 0?!1:E,O=n.maskTextFn,T=n.maskInputFn,L=n.slimDOM,B=L===void 0?!1:L,z=n.dataURLOptions,P=n.preserveWhiteSpace,V=n.onSerialize,J=n.onIframeLoad,le=n.iframeLoadTimeout,G=n.onStylesheetLoad,Z=n.stylesheetLoadTimeout,q=n.keepIframeSrcFn,H=q===void 0?function(){return!1}:q,fe=R===!0?{color:!0,date:!0,"datetime-local":!0,email:!0,month:!0,number:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0,textarea:!0,select:!0,password:!0}:R===!1?{password:!0}:R,we=B===!0||B==="all"?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaDescKeywords:B==="all",headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaAuthorship:!0,headMetaVerification:!0}:B===!1?{}:B;return Ll(e,{doc:e,mirror:i,blockClass:s,blockSelector:c,maskTextClass:p,maskTextSelector:m,skipChild:!1,inlineStylesheet:_,maskInputOptions:fe,maskTextFn:O,maskInputFn:T,slimDOMOptions:we,dataURLOptions:z,inlineImages:b,recordCanvas:C,preserveWhiteSpace:P,onSerialize:V,onIframeLoad:J,iframeLoadTimeout:le,onStylesheetLoad:G,stylesheetLoadTimeout:Z,keepIframeSrcFn:H,newlyAddedElement:!1})}function A7(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function I7(e){if(e.__esModule)return e;var t=e.default;if(typeof t=="function"){var n=function r(){return vt(this,r)?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};n.prototype=t.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(e).forEach(function(r){var i=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(n,r,i.get?i:{enumerable:!0,get:function(){return e[r]}})}),n}var h_={exports:{}},hn=String,MA=function(){return{isColorSupported:!1,reset:hn,bold:hn,dim:hn,italic:hn,underline:hn,inverse:hn,hidden:hn,strikethrough:hn,black:hn,red:hn,green:hn,yellow:hn,blue:hn,magenta:hn,cyan:hn,white:hn,gray:hn,bgBlack:hn,bgRed:hn,bgGreen:hn,bgYellow:hn,bgBlue:hn,bgMagenta:hn,bgCyan:hn,bgWhite:hn}};h_.exports=MA(),h_.exports.createColors=MA;var R7=h_.exports,O7={},T7=Object.freeze(Object.defineProperty({__proto__:null,default:O7},Symbol.toStringTag,{value:"Module"})),Mn=I7(T7),DA=R7,$A=Mn,p_=function(e){Sr(t,e);function t(r,i,o,s,u,c){var d;return d=e.call(this,r)||this,d.name="CssSyntaxError",d.reason=r,u&&(d.file=u),s&&(d.source=s),c&&(d.plugin=c),typeof i<"u"&&typeof o<"u"&&(typeof i=="number"?(d.line=i,d.column=o):(d.line=i.line,d.column=i.column,d.endLine=o.line,d.endColumn=o.column)),d.setMessage(),Error.captureStackTrace&&Error.captureStackTrace(d,t),d}var n=t.prototype;return n.setMessage=function(){this.message=this.plugin?this.plugin+": ":"",this.message+=this.file?this.file:"<css input>",typeof this.line<"u"&&(this.message+=":"+this.line+":"+this.column),this.message+=": "+this.reason},n.showSourceCode=function(i){var o=this;if(!this.source)return"";var s=this.source;i==null&&(i=DA.isColorSupported),$A&&i&&(s=$A(s));var u=s.split(/\r?\n/),c=Math.max(this.line-3,0),d=Math.min(this.line+2,u.length),p=String(d).length,h,m;if(i){var v=DA.createColors(!0),_=v.bold,x=v.gray,b=v.red;h=function(w){return _(b(w))},m=function(w){return x(w)}}else h=m=function(w){return w};return u.slice(c,d).map(function(w,C){var E=c+1+C,R=" "+(" "+E).slice(-p)+" | ";if(E===o.line){var O=m(R.replace(/\d/g," "))+w.slice(0,o.column-1).replace(/[^\t]/g," ");return h(">")+m(R)+w+`
|
|
78
|
+
`,bh=typeof window<"u"&&"HTMLElement"in window,ZU=!!(typeof SC_DISABLE_SPEEDY=="boolean"?SC_DISABLE_SPEEDY:typeof process<"u"&&br!==void 0&&br.REACT_APP_SC_DISABLE_SPEEDY!==void 0&&br.REACT_APP_SC_DISABLE_SPEEDY!==""?br.REACT_APP_SC_DISABLE_SPEEDY!=="false"&&br.REACT_APP_SC_DISABLE_SPEEDY:typeof process<"u"&&br!==void 0&&br.SC_DISABLE_SPEEDY!==void 0&&br.SC_DISABLE_SPEEDY!==""?br.SC_DISABLE_SPEEDY!=="false"&&br.SC_DISABLE_SPEEDY:br.NODE_ENV!=="production"),YU={},Sh=Object.freeze([]),Tl=Object.freeze({});function Fk(e,t,n){return n===void 0&&(n=Tl),e.theme!==n.theme&&e.theme||t||n.theme}var Uk=new Set(["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","big","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","keygen","label","legend","li","link","main","map","mark","menu","menuitem","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","section","select","small","source","span","strong","style","sub","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","track","u","ul","use","var","video","wbr","circle","clipPath","defs","ellipse","foreignObject","g","image","line","linearGradient","marker","mask","path","pattern","polygon","polyline","radialGradient","rect","stop","svg","text","tspan"]),WU=/[!"#$%&'()*+,./:;<=>?@[\\\]^`{|}~-]+/g,KU=/(^-|-$)/g;function zk(e){return e.replace(WU,"-").replace(KU,"")}var QU=/(a)(d)/gi,wh=52,qk=function(e){return String.fromCharCode(e+(e>25?39:97))};function Vy(e){var t,n="";for(t=Math.abs(e);t>wh;t=t/wh|0)n=qk(t%wh)+n;return(qk(t%wh)+n).replace(QU,"$1-$2")}var Zy,jk=5381,Ml=function(e,t){for(var n=t.length;n;)e=33*e^t.charCodeAt(--n);return e},Hk=function(e){return Ml(jk,e)};function Gk(e){return Vy(Hk(e)>>>0)}function XU(e){return e.displayName||e.name||"Component"}function Yy(e){return typeof e=="string"&&br.NODE_ENV==="production"}var Vk=typeof Symbol=="function"&&Symbol.for,Zk=Vk?Symbol.for("react.memo"):60115,JU=Vk?Symbol.for("react.forward_ref"):60112,ez={childContextTypes:!0,contextType:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,getDerivedStateFromError:!0,getDerivedStateFromProps:!0,mixins:!0,propTypes:!0,type:!0},tz={name:!0,length:!0,prototype:!0,caller:!0,callee:!0,arguments:!0,arity:!0},Yk={$$typeof:!0,compare:!0,defaultProps:!0,displayName:!0,propTypes:!0,type:!0},nz=((Zy={})[JU]={$$typeof:!0,render:!0,defaultProps:!0,displayName:!0,propTypes:!0},Zy[Zk]=Yk,Zy);function Wk(e){return("type"in(t=e)&&t.type.$$typeof)===Zk?Yk:"$$typeof"in e?nz[e.$$typeof]:ez;var t}var rz=Object.defineProperty,iz=Object.getOwnPropertyNames,Kk=Object.getOwnPropertySymbols,oz=Object.getOwnPropertyDescriptor,az=Object.getPrototypeOf,Qk=Object.prototype;function Xk(e,t,n){if(typeof t!="string"){if(Qk){var r=az(t);r&&r!==Qk&&Xk(e,r,n)}var i=iz(t);Kk&&(i=i.concat(Kk(t)));for(var o=Wk(e),s=Wk(t),u=0;u<i.length;++u){var c=i[u];if(!(c in tz||n&&n[c]||s&&c in s||o&&c in o)){var d=oz(t,c);try{rz(e,c,d)}catch{}}}}return e}function Is(e){return typeof e=="function"}function Wy(e){return typeof e=="object"&&"styledComponentId"in e}function Rs(e,t){return e&&t?"".concat(e," ").concat(t):e||t||""}function Ky(e,t){if(e.length===0)return"";for(var n=e[0],r=1;r<e.length;r++)n+=e[r];return n}function Lc(e){return e!==null&&typeof e=="object"&&e.constructor.name===Object.name&&!("props"in e&&e.$$typeof)}function Qy(e,t,n){if(n===void 0&&(n=!1),!n&&!Lc(e)&&!Array.isArray(e))return t;if(Array.isArray(t))for(var r=0;r<t.length;r++)e[r]=Qy(e[r],t[r]);else if(Lc(t))for(var r in t)e[r]=Qy(e[r],t[r]);return e}function Xy(e,t){Object.defineProperty(e,"toString",{value:t})}function Os(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];return new Error("An error occurred. See https://github.com/styled-components/styled-components/blob/main/packages/styled-components/src/utils/errors.md#".concat(e," for more information.").concat(t.length>0?" Args: ".concat(t.join(", ")):""))}var sz=function(){function e(t){this.groupSizes=new Uint32Array(512),this.length=512,this.tag=t}return e.prototype.indexOfGroup=function(t){for(var n=0,r=0;r<t;r++)n+=this.groupSizes[r];return n},e.prototype.insertRules=function(t,n){if(t>=this.groupSizes.length){for(var r=this.groupSizes,i=r.length,o=i;t>=o;)if((o<<=1)<0)throw Os(16,"".concat(t));this.groupSizes=new Uint32Array(o),this.groupSizes.set(r),this.length=o;for(var s=i;s<o;s++)this.groupSizes[s]=0}for(var u=this.indexOfGroup(t+1),c=(s=0,n.length);s<c;s++)this.tag.insertRule(u,n[s])&&(this.groupSizes[t]++,u++)},e.prototype.clearGroup=function(t){if(t<this.length){var n=this.groupSizes[t],r=this.indexOfGroup(t),i=r+n;this.groupSizes[t]=0;for(var o=r;o<i;o++)this.tag.deleteRule(r)}},e.prototype.getGroup=function(t){var n="";if(t>=this.length||this.groupSizes[t]===0)return n;for(var r=this.groupSizes[t],i=this.indexOfGroup(t),o=i+r,s=i;s<o;s++)n+="".concat(this.tag.getRule(s)).concat(Gy);return n},e}(),xh=new Map,Ch=new Map,Eh=1,kh=function(e){if(xh.has(e))return xh.get(e);for(;Ch.has(Eh);)Eh++;var t=Eh++;return xh.set(e,t),Ch.set(t,e),t},lz=function(e,t){Eh=t+1,xh.set(e,t),Ch.set(t,e)},uz="style[".concat(Ol,"][").concat(Bk,'="').concat(_h,'"]'),cz=new RegExp("^".concat(Ol,'\\.g(\\d+)\\[id="([\\w\\d-]+)"\\].*?"([^"]*)')),fz=function(e,t,n){for(var r,i=n.split(","),o=0,s=i.length;o<s;o++)(r=i[o])&&e.registerName(t,r)},dz=function(e,t){for(var n,r=((n=t.textContent)!==null&&n!==void 0?n:"").split(Gy),i=[],o=0,s=r.length;o<s;o++){var u=r[o].trim();if(u){var c=u.match(cz);if(c){var d=0|parseInt(c[1],10),p=c[2];d!==0&&(lz(p,d),fz(e,p,c[3]),e.getTag().insertRules(d,i)),i.length=0}else i.push(u)}}},Jk=function(e){for(var t=document.querySelectorAll(uz),n=0,r=t.length;n<r;n++){var i=t[n];i&&i.getAttribute(Ol)!==Pk&&(dz(e,i),i.parentNode&&i.parentNode.removeChild(i))}};function hz(){return typeof __webpack_nonce__<"u"?__webpack_nonce__:null}var eA=function(e){var t=document.head,n=e||t,r=document.createElement("style"),i=function(u){var c=Array.from(u.querySelectorAll("style[".concat(Ol,"]")));return c[c.length-1]}(n),o=i!==void 0?i.nextSibling:null;r.setAttribute(Ol,Pk),r.setAttribute(Bk,_h);var s=hz();return s&&r.setAttribute("nonce",s),n.insertBefore(r,o),r},pz=function(){function e(t){this.element=eA(t),this.element.appendChild(document.createTextNode("")),this.sheet=function(n){if(n.sheet)return n.sheet;for(var r=document.styleSheets,i=0,o=r.length;i<o;i++){var s=r[i];if(s.ownerNode===n)return s}throw Os(17)}(this.element),this.length=0}return e.prototype.insertRule=function(t,n){try{return this.sheet.insertRule(n,t),this.length++,!0}catch{return!1}},e.prototype.deleteRule=function(t){this.sheet.deleteRule(t),this.length--},e.prototype.getRule=function(t){var n=this.sheet.cssRules[t];return n&&n.cssText?n.cssText:""},e}(),gz=function(){function e(t){this.element=eA(t),this.nodes=this.element.childNodes,this.length=0}return e.prototype.insertRule=function(t,n){if(t<=this.length&&t>=0){var r=document.createTextNode(n);return this.element.insertBefore(r,this.nodes[t]||null),this.length++,!0}return!1},e.prototype.deleteRule=function(t){this.element.removeChild(this.nodes[t]),this.length--},e.prototype.getRule=function(t){return t<this.length?this.nodes[t].textContent:""},e}(),mz=function(){function e(t){this.rules=[],this.length=0}return e.prototype.insertRule=function(t,n){return t<=this.length&&(this.rules.splice(t,0,n),this.length++,!0)},e.prototype.deleteRule=function(t){this.rules.splice(t,1),this.length--},e.prototype.getRule=function(t){return t<this.length?this.rules[t]:""},e}(),tA=bh,vz={isServer:!bh,useCSSOMInjection:!ZU},Ah=function(){function e(t,n,r){t===void 0&&(t=Tl),n===void 0&&(n={});var i=this;this.options=nr(nr({},vz),t),this.gs=n,this.names=new Map(r),this.server=!!t.isServer,!this.server&&bh&&tA&&(tA=!1,Jk(this)),Xy(this,function(){return function(o){for(var s=o.getTag(),u=s.length,c="",d=function(h){var m=function(w){return Ch.get(w)}(h);if(m===void 0)return"continue";var v=o.names.get(m),_=s.getGroup(h);if(v===void 0||!v.size||_.length===0)return"continue";var x="".concat(Ol,".g").concat(h,'[id="').concat(m,'"]'),b="";v!==void 0&&v.forEach(function(w){w.length>0&&(b+="".concat(w,","))}),c+="".concat(_).concat(x,'{content:"').concat(b,'"}').concat(Gy)},p=0;p<u;p++)d(p);return c}(i)})}return e.registerId=function(t){return kh(t)},e.prototype.rehydrate=function(){!this.server&&bh&&Jk(this)},e.prototype.reconstructWithOptions=function(t,n){return n===void 0&&(n=!0),new e(nr(nr({},this.options),t),this.gs,n&&this.names||void 0)},e.prototype.allocateGSInstance=function(t){return this.gs[t]=(this.gs[t]||0)+1},e.prototype.getTag=function(){return this.tag||(this.tag=(t=function(n){var r=n.useCSSOMInjection,i=n.target;return n.isServer?new mz(i):r?new pz(i):new gz(i)}(this.options),new sz(t)));var t},e.prototype.hasNameForId=function(t,n){return this.names.has(t)&&this.names.get(t).has(n)},e.prototype.registerName=function(t,n){if(kh(t),this.names.has(t))this.names.get(t).add(n);else{var r=new Set;r.add(n),this.names.set(t,r)}},e.prototype.insertRules=function(t,n,r){this.registerName(t,n),this.getTag().insertRules(kh(t),r)},e.prototype.clearNames=function(t){this.names.has(t)&&this.names.get(t).clear()},e.prototype.clearRules=function(t){this.getTag().clearGroup(kh(t)),this.clearNames(t)},e.prototype.clearTag=function(){this.tag=void 0},e}(),yz=/&/g,_z=/^\s*\/\/.*$/gm;function nA(e,t){return e.map(function(n){return n.type==="rule"&&(n.value="".concat(t," ").concat(n.value),n.value=n.value.replaceAll(",",",".concat(t," ")),n.props=n.props.map(function(r){return"".concat(t," ").concat(r)})),Array.isArray(n.children)&&n.type!=="@keyframes"&&(n.children=nA(n.children,t)),n})}function rA(e){var t,n,r,i=e===void 0?Tl:e,o=i.options,s=o===void 0?Tl:o,u=i.plugins,c=u===void 0?Sh:u,d=function(m,v,_){return _.startsWith(n)&&_.endsWith(n)&&_.replaceAll(n,"").length>0?".".concat(t):m},p=c.slice();p.push(function(m){m.type===fh&&m.value.includes("&")&&(m.props[0]=m.props[0].replace(yz,n).replace(r,d))}),s.prefix&&p.push(GU),p.push(qU);var h=function(m,v,_,x){v===void 0&&(v=""),_===void 0&&(_=""),x===void 0&&(x="&"),t=x,n=v,r=new RegExp("\\".concat(n,"\\b"),"g");var b=m.replace(_z,""),w=UU(_||v?"".concat(_," ").concat(v," { ").concat(b," }"):b);s.namespace&&(w=nA(w,s.namespace));var C=[];return yh(w,jU(p.concat(HU(function(E){return C.push(E)})))),C};return h.hash=c.length?c.reduce(function(m,v){return v.name||Os(15),Ml(m,v.name)},jk).toString():"",h}var bz=new Ah,Jy=rA(),e_=Tn.createContext({shouldForwardProp:void 0,styleSheet:bz,stylis:Jy});e_.Consumer;var Sz=Tn.createContext(void 0);function Ih(){return W.useContext(e_)}function wz(e){var t=W.useState(e.stylisPlugins),n=t[0],r=t[1],i=Ih().styleSheet,o=W.useMemo(function(){var c=i;return e.sheet?c=e.sheet:e.target&&(c=c.reconstructWithOptions({target:e.target},!1)),e.disableCSSOMInjection&&(c=c.reconstructWithOptions({useCSSOMInjection:!1})),c},[e.disableCSSOMInjection,e.sheet,e.target,i]),s=W.useMemo(function(){return rA({options:{namespace:e.namespace,prefix:e.enableVendorPrefixes},plugins:n})},[e.enableVendorPrefixes,e.namespace,n]);W.useEffect(function(){AU(n,e.stylisPlugins)||r(e.stylisPlugins)},[e.stylisPlugins]);var u=W.useMemo(function(){return{shouldForwardProp:e.shouldForwardProp,styleSheet:o,stylis:s}},[e.shouldForwardProp,o,s]);return Tn.createElement(e_.Provider,{value:u},Tn.createElement(Sz.Provider,{value:s},e.children))}var xz=function(){function e(t,n){var r=this;this.inject=function(i,o){o===void 0&&(o=Jy);var s=r.name+o.hash;i.hasNameForId(r.id,s)||i.insertRules(r.id,s,o(r.rules,s,"@keyframes"))},this.name=t,this.id="sc-keyframes-".concat(t),this.rules=n,Xy(this,function(){throw Os(12,String(r.name))})}return e.prototype.getName=function(t){return t===void 0&&(t=Jy),this.name+t.hash},e}(),Cz=function(e){return e>="A"&&e<="Z"};function iA(e){for(var t="",n=0;n<e.length;n++){var r=e[n];if(n===1&&r==="-"&&e[0]==="-")return e;Cz(r)?t+="-"+r.toLowerCase():t+=r}return t.startsWith("ms-")?"-"+t:t}var oA=function(e){return e==null||e===!1||e===""},aA=function(e){var t,n,r=[];for(var i in e){var o=e[i];e.hasOwnProperty(i)&&!oA(o)&&(Array.isArray(o)&&o.isCss||Is(o)?r.push("".concat(iA(i),":"),o,";"):Lc(o)?r.push.apply(r,Mc(Mc(["".concat(i," {")],aA(o),!1),["}"],!1)):r.push("".concat(iA(i),": ").concat((t=i,(n=o)==null||typeof n=="boolean"||n===""?"":typeof n!="number"||n===0||t in VU||t.startsWith("--")?String(n).trim():"".concat(n,"px")),";")))}return r};function xa(e,t,n,r){if(oA(e))return[];if(Wy(e))return[".".concat(e.styledComponentId)];if(Is(e)){if(!Is(o=e)||o.prototype&&o.prototype.isReactComponent||!t)return[e];var i=e(t);return xa(i,t,n,r)}var o;return e instanceof xz?n?(e.inject(n,r),[e.getName(r)]):[e]:Lc(e)?aA(e):Array.isArray(e)?Array.prototype.concat.apply(Sh,e.map(function(s){return xa(s,t,n,r)})):[e.toString()]}function sA(e){for(var t=0;t<e.length;t+=1){var n=e[t];if(Is(n)&&!Wy(n))return!1}return!0}var Ez=Hk(_h),kz=function(){function e(t,n,r){this.rules=t,this.staticRulesId="",this.isStatic=(r===void 0||r.isStatic)&&sA(t),this.componentId=n,this.baseHash=Ml(Ez,n),this.baseStyle=r,Ah.registerId(n)}return e.prototype.generateAndInjectStyles=function(t,n,r){var i=this.baseStyle?this.baseStyle.generateAndInjectStyles(t,n,r):"";if(this.isStatic&&!r.hash)if(this.staticRulesId&&n.hasNameForId(this.componentId,this.staticRulesId))i=Rs(i,this.staticRulesId);else{var o=Ky(xa(this.rules,t,n,r)),s=Vy(Ml(this.baseHash,o)>>>0);if(!n.hasNameForId(this.componentId,s)){var u=r(o,".".concat(s),void 0,this.componentId);n.insertRules(this.componentId,s,u)}i=Rs(i,s),this.staticRulesId=s}else{for(var c=Ml(this.baseHash,r.hash),d="",p=0;p<this.rules.length;p++){var h=this.rules[p];if(typeof h=="string")d+=h;else if(h){var m=Ky(xa(h,t,n,r));c=Ml(c,m+p),d+=m}}if(d){var v=Vy(c>>>0);n.hasNameForId(this.componentId,v)||n.insertRules(this.componentId,v,r(d,".".concat(v),void 0,this.componentId)),i=Rs(i,v)}}return i},e}(),Nc=Tn.createContext(void 0);Nc.Consumer;function Az(e){var t=Tn.useContext(Nc),n=W.useMemo(function(){return function(r,i){if(!r)throw Os(14);if(Is(r)){var o=r(i);return o}if(Array.isArray(r)||typeof r!="object")throw Os(8);return i?nr(nr({},i),r):r}(e.theme,t)},[e.theme,t]);return e.children?Tn.createElement(Nc.Provider,{value:n},e.children):null}var t_={};function Iz(e,t,n){var r=Wy(e),i=e,o=!Yy(e),s=t.attrs,u=s===void 0?Sh:s,c=t.componentId,d=c===void 0?function(R,O){var T=typeof R!="string"?"sc":zk(R);t_[T]=(t_[T]||0)+1;var L="".concat(T,"-").concat(Gk(_h+T+t_[T]));return O?"".concat(O,"-").concat(L):L}(t.displayName,t.parentComponentId):c,p=t.displayName,h=p===void 0?function(R){return Yy(R)?"styled.".concat(R):"Styled(".concat(XU(R),")")}(e):p,m=t.displayName&&t.componentId?"".concat(zk(t.displayName),"-").concat(t.componentId):t.componentId||d,v=r&&i.attrs?i.attrs.concat(u).filter(Boolean):u,_=t.shouldForwardProp;if(r&&i.shouldForwardProp){var x=i.shouldForwardProp;if(t.shouldForwardProp){var b=t.shouldForwardProp;_=function(R,O){return x(R,O)&&b(R,O)}}else _=x}var w=new kz(n,m,r?i.componentStyle:void 0);function C(R,O){return function(T,L,B){var z=T.attrs,P=T.componentStyle,V=T.defaultProps,J=T.foldedComponentIds,le=T.styledComponentId,G=T.target,Z=Tn.useContext(Nc),q=Ih(),H=T.shouldForwardProp||q.shouldForwardProp,fe=Fk(L,Z,V)||Tl,we=function(Re,ie,Ne){for(var De,Fe=nr(nr({},ie),{className:void 0,theme:Ne}),We=0;We<Re.length;We+=1){var Pe=Is(De=Re[We])?De(Fe):De;for(var be in Pe)Fe[be]=be==="className"?Rs(Fe[be],Pe[be]):be==="style"?nr(nr({},Fe[be]),Pe[be]):Pe[be]}return ie.className&&(Fe.className=Rs(Fe.className,ie.className)),Fe}(z,L,fe),k=we.as||G,ne={};for(var de in we)we[de]===void 0||de[0]==="$"||de==="as"||de==="theme"&&we.theme===fe||(de==="forwardedAs"?ne.as=we.forwardedAs:H&&!H(de,k)||(ne[de]=we[de],H||br.NODE_ENV));var D=function(Re,ie){var Ne=Ih(),De=Re.generateAndInjectStyles(ie,Ne.styleSheet,Ne.stylis);return De}(P,we),ue=Rs(J,le);return D&&(ue+=" "+D),we.className&&(ue+=" "+we.className),ne[Yy(k)&&!Uk.has(k)?"class":"className"]=ue,B&&(ne.ref=B),W.createElement(k,ne)}(E,R,O)}C.displayName=h;var E=Tn.forwardRef(C);return E.attrs=v,E.componentStyle=w,E.displayName=h,E.shouldForwardProp=_,E.foldedComponentIds=r?Rs(i.foldedComponentIds,i.styledComponentId):"",E.styledComponentId=m,E.target=r?i.target:e,Object.defineProperty(E,"defaultProps",{get:function(){return this._foldedDefaultProps},set:function(R){this._foldedDefaultProps=r?function(O){for(var T=[],L=1;L<arguments.length;L++)T[L-1]=arguments[L];for(var B=0,z=T;B<z.length;B++)Qy(O,z[B],!0);return O}({},i.defaultProps,R):R}}),Xy(E,function(){return".".concat(E.styledComponentId)}),o&&Xk(E,e,{attrs:!0,componentStyle:!0,displayName:!0,foldedComponentIds:!0,shouldForwardProp:!0,styledComponentId:!0,target:!0}),E}function lA(e,t){for(var n=[e[0]],r=0,i=t.length;r<i;r+=1)n.push(t[r],e[r+1]);return n}var uA=function(e){return Object.assign(e,{isCss:!0})};function Bo(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];if(Is(e)||Lc(e))return uA(xa(lA(Sh,Mc([e],t,!0))));var r=e;return t.length===0&&r.length===1&&typeof r[0]=="string"?xa(r):uA(xa(lA(r,t)))}function n_(e,t,n){if(n===void 0&&(n=Tl),!t)throw Os(1,t);var r=function(i){for(var o=[],s=1;s<arguments.length;s++)o[s-1]=arguments[s];return e(t,n,Bo.apply(void 0,Mc([i],o,!1)))};return r.attrs=function(i){return n_(e,t,nr(nr({},n),{attrs:Array.prototype.concat(n.attrs,i).filter(Boolean)}))},r.withConfig=function(i){return n_(e,t,nr(nr({},n),i))},r}var cA=function(e){return n_(Iz,e)},se=cA;Uk.forEach(function(e){se[e]=cA(e)});var Rz=function(){function e(t,n){this.rules=t,this.componentId=n,this.isStatic=sA(t),Ah.registerId(this.componentId+1)}return e.prototype.createStyles=function(t,n,r,i){var o=i(Ky(xa(this.rules,n,r,i)),""),s=this.componentId+t;r.insertRules(s,s,o)},e.prototype.removeStyles=function(t,n){n.clearRules(this.componentId+t)},e.prototype.renderStyles=function(t,n,r,i){t>2&&Ah.registerId(this.componentId+t),this.removeStyles(t,r),this.createStyles(t,n,r,i)},e}();function Oz(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];var r=Bo.apply(void 0,Mc([e],t,!1)),i="sc-global-".concat(Gk(JSON.stringify(r))),o=new Rz(r,i),s=function(c){var d=Ih(),p=Tn.useContext(Nc),h=Tn.useRef(d.styleSheet.allocateGSInstance(i)).current;return d.styleSheet.server&&u(h,c,d.styleSheet,p,d.stylis),Tn.useLayoutEffect(function(){if(!d.styleSheet.server)return u(h,c,d.styleSheet,p,d.stylis),function(){return o.removeStyles(h,d.styleSheet)}},[h,c,d.styleSheet,p,d.stylis]),null};function u(c,d,p,h,m){if(o.isStatic)o.renderStyles(c,YU,p,m);else{var v=nr(nr({},d),{theme:Fk(d,h,s.defaultProps)});o.renderStyles(c,v,p,m)}}return Tn.memo(s)}const pi={CHAT_HISTORY:"chat_history",CLICKED_QUESTIONS:"clicked_questions",PENDING_BULK_ITEMS:"pending_bulk_items",LAST_SHOWN_MESSAGE_ID:"last_shown_message_id",HIDDEN_DYNAMIC_SUGGESTED_QUESTIONS:"hidden_dynamic_suggested_questions",CHAT_RATING:"chat_rating",SHOPIFY_META_DATA:"shopify_meta_data",SESSION_ID:"session_id"};var Rh={USER:"anurag",npm_config_user_agent:"pnpm/10.7.1 npm/? node/v20.11.1 linux x64",npm_node_execpath:"/home/anurag/.local/share/pnpm/nodejs/22.15.0/bin/node",WT_PROFILE_ID:"{51855cb2-8cce-5362-8f54-464b92b32386}",SHLVL:"1",npm_config_noproxy:"",HOME:"/home/anurag",OLDPWD:"/home/anurag/workstation/debales",LESS:"-R",npm_package_json:"/home/anurag/workstation/debales/debales/packages/ai/package.json",ZSH:"/home/anurag/.oh-my-zsh",LSCOLORS:"Gxfxcxdxbxegedabagacad",PAGER:"less",npm_config_userconfig:"/home/anurag/.npmrc",npm_config_local_prefix:"/home/anurag/workstation/debales/debales/packages/ai",DBUS_SESSION_BUS_ADDRESS:"unix:path=/run/user/1000/bus",P9K_TTY:"old",npm_config_engine_strict:"true",WSL_DISTRO_NAME:"Ubuntu",COLOR:"0",npm_config_otp:"119989",WAYLAND_DISPLAY:"wayland-0",LOGNAME:"anurag",PULSE_SERVER:"unix:/mnt/wslg/PulseServer",WSL_INTEROP:"/run/WSL/391_interop",NAME:"Anurag-PC",_P9K_SSH_TTY:"/dev/pts/0",_:"/home/anurag/.local/share/pnpm/pnpm",npm_config_prefix:"/home/anurag/.local/share/pnpm/nodejs/22.15.0",npm_config_npm_version:"10.9.2",npm_config_registry:"https://registry.npmjs.org/",TERM:"xterm-256color",npm_config_cache:"/home/anurag/.npm",npm_config_node_gyp:"/home/anurag/.local/share/pnpm/nodejs/22.15.0/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js",PATH:"/home/anurag/workstation/debales/debales/packages/ai/node_modules/.bin:/home/anurag/workstation/debales/debales/packages/node_modules/.bin:/home/anurag/workstation/debales/debales/node_modules/.bin:/home/anurag/workstation/debales/node_modules/.bin:/home/anurag/workstation/node_modules/.bin:/home/anurag/node_modules/.bin:/home/node_modules/.bin:/node_modules/.bin:/home/anurag/.local/share/pnpm/nodejs/22.15.0/lib/node_modules/npm/node_modules/@npmcli/run-script/lib/node-gyp-bin:/home/anurag/workstation/debales/debales/packages/ai/node_modules/.bin:/snapshot/dist/node-gyp-bin:/home/anurag/workstation/debales/debales/node_modules/.bin:/home/anurag/workstation/debales/debales/packages/ai/node_modules/.bin:/snapshot/dist/node-gyp-bin:/home/anurag/workstation/debales/debales/node_modules/.bin:/home/anurag/workstation/debales/debales/node_modules/.bin:/snapshot/dist/node-gyp-bin:/home/anurag/workstation/debales/debales/node_modules/.bin:/home/anurag/.local/share/pnpm/.tools/@pnpm+linux-x64/10.7.1/bin:/home/anurag/.gvm/bin:/mnt/c/Users/anura/AppData/Local/Programs/cursor/resources/app/bin:/home/anurag/go/bin:/usr/local/go/bin:/home/anurag/bin:/usr/local/bin:/home/anurag/.local/share/pnpm:/usr/local/sbin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/usr/lib/wsl/lib:/mnt/c/Windows/system32:/mnt/c/Windows:/mnt/c/Windows/System32/Wbem:/mnt/c/Windows/System32/WindowsPowerShell/v1.0/:/mnt/c/Windows/System32/OpenSSH/:/mnt/c/Program:Files:(x86)/NVIDIA:Corporation/PhysX/Common:Files/NVIDIA:Corporation/NVIDIA:app/NvDLISR:/mnt/c/WINDOWS/system32:/mnt/c/WINDOWS:/mnt/c/WINDOWS/System32/Wbem:/mnt/c/WINDOWS/System32/WindowsPowerShell/v1.0/:/mnt/c/WINDOWS/System32/OpenSSH/:Files/Docker/Docker/resources/bin:/mnt/c/Users/anura/AppData/Local/Microsoft/WindowsApps:/mnt/c/Users/anura/AppData/Local/Programs/Microsoft:VS:Code/bin:/home/linuxbrew/.linuxbrew/bin",NODE:"/home/anurag/.local/share/pnpm/nodejs/22.15.0/bin/node",npm_package_name:"@debales/ai",XDG_RUNTIME_DIR:"/run/user/1000/",WT_SESSION:"4bf217c8-e079-4e82-ae35-eca5fede312c",npm_config_frozen_lockfile:"",DISPLAY:":0",LANG:"C.UTF-8",LS_COLORS:"rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:mi=00:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arc=01;31:*.arj=01;31:*.taz=01;31:*.lha=01;31:*.lz4=01;31:*.lzh=01;31:*.lzma=01;31:*.tlz=01;31:*.txz=01;31:*.tzo=01;31:*.t7z=01;31:*.zip=01;31:*.z=01;31:*.dz=01;31:*.gz=01;31:*.lrz=01;31:*.lz=01;31:*.lzo=01;31:*.xz=01;31:*.zst=01;31:*.tzst=01;31:*.bz2=01;31:*.bz=01;31:*.tbz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.war=01;31:*.ear=01;31:*.sar=01;31:*.rar=01;31:*.alz=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.cab=01;31:*.wim=01;31:*.swm=01;31:*.dwm=01;31:*.esd=01;31:*.jpg=01;35:*.jpeg=01;35:*.mjpg=01;35:*.mjpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.webm=01;35:*.webp=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.cgm=01;35:*.emf=01;35:*.ogv=01;35:*.ogx=01;35:*.aac=00;36:*.au=00;36:*.flac=00;36:*.m4a=00;36:*.mid=00;36:*.midi=00;36:*.mka=00;36:*.mp3=00;36:*.mpc=00;36:*.ogg=00;36:*.ra=00;36:*.wav=00;36:*.oga=00;36:*.opus=00;36:*.spx=00;36:*.xspf=00;36:",npm_lifecycle_script:"tsc -b && vite build --config vite.browser.config.ts",GVM_VERSION:"1.0.22",SHELL:"/usr/bin/zsh",NODE_PATH:"/home/anurag/workstation/debales/debales/node_modules/.pnpm/vite@6.2.5_@types+node@22.14.0_jiti@2.4.2_lightningcss@1.29.2_terser@5.39.0_yaml@2.7.1/node_modules/vite/bin/node_modules:/home/anurag/workstation/debales/debales/node_modules/.pnpm/vite@6.2.5_@types+node@22.14.0_jiti@2.4.2_lightningcss@1.29.2_terser@5.39.0_yaml@2.7.1/node_modules/vite/node_modules:/home/anurag/workstation/debales/debales/node_modules/.pnpm/vite@6.2.5_@types+node@22.14.0_jiti@2.4.2_lightningcss@1.29.2_terser@5.39.0_yaml@2.7.1/node_modules:/home/anurag/workstation/debales/debales/node_modules/.pnpm/node_modules:/home/anurag/workstation/debales/debales/node_modules/.pnpm/@changesets+cli@2.28.1/node_modules/@changesets/cli/node_modules:/home/anurag/workstation/debales/debales/node_modules/.pnpm/@changesets+cli@2.28.1/node_modules/@changesets/node_modules:/home/anurag/workstation/debales/debales/node_modules/.pnpm/@changesets+cli@2.28.1/node_modules:/home/anurag/workstation/debales/debales/node_modules/.pnpm/node_modules:/home/anurag/.local/share/pnpm/global/5/.pnpm/@pnpm+exe@10.6.3/node_modules/@pnpm/exe/node_modules:/home/anurag/.local/share/pnpm/global/5/.pnpm/@pnpm+exe@10.6.3/node_modules/@pnpm/node_modules:/home/anurag/.local/share/pnpm/global/5/.pnpm/@pnpm+exe@10.6.3/node_modules:/home/anurag/.local/share/pnpm/global/5/.pnpm/node_modules",npm_package_version:"1.1.3",npm_config_verify_deps_before_run:"false",npm_config_access:"public",npm_lifecycle_event:"build:browser",npm_config_tag:"latest",P9K_SSH:"0",npm_config_globalconfig:"/home/anurag/.config/pnpm/npmrc",npm_config_init_module:"/home/anurag/.npm-init.js",PWD:"/home/anurag/workstation/debales/debales/packages/ai",npm_execpath:"/home/anurag/.local/share/pnpm/nodejs/22.15.0/lib/node_modules/npm/bin/npm-cli.js",_P9K_TTY:"/dev/pts/0",GVM_ROOT:"/home/anurag/.gvm",npm_config_global_prefix:"/home/anurag/.local/share/pnpm/nodejs/22.15.0",PNPM_SCRIPT_SRC_DIR:"/home/anurag/workstation/debales/debales/packages/ai",npm_command:"run-script",BREW_HOME:"/home/linuxbrew/.linuxbrew/bin",HOSTTYPE:"x86_64",WSL2_GUI_APPS_ENABLED:"1",PNPM_HOME:"/home/anurag/.local/share/pnpm",GVM_PATH_BACKUP:"/home/anurag/.gvm/bin:/mnt/c/Users/anura/AppData/Local/Programs/cursor/resources/app/bin:/home/anurag/go/bin:/usr/local/go/bin:/home/anurag/bin:/usr/local/bin:/home/anurag/.local/share/pnpm:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/usr/lib/wsl/lib:/mnt/c/Windows/system32:/mnt/c/Windows:/mnt/c/Windows/System32/Wbem:/mnt/c/Windows/System32/WindowsPowerShell/v1.0/:/mnt/c/Windows/System32/OpenSSH/:/mnt/c/Program Files (x86)/NVIDIA Corporation/PhysX/Common:/mnt/c/Program Files/NVIDIA Corporation/NVIDIA app/NvDLISR:/mnt/c/WINDOWS/system32:/mnt/c/WINDOWS:/mnt/c/WINDOWS/System32/Wbem:/mnt/c/WINDOWS/System32/WindowsPowerShell/v1.0/:/mnt/c/WINDOWS/System32/OpenSSH/:/mnt/c/Program Files/Docker/Docker/resources/bin:/mnt/c/Users/anura/AppData/Local/Microsoft/WindowsApps:/mnt/c/Users/anura/AppData/Local/Programs/Microsoft VS Code/bin:/mnt/c/Users/anura/AppData/Local/Programs/cursor/resources/app/bin:/home/linuxbrew/.linuxbrew/bin",WSLENV:"WT_SESSION:WT_PROFILE_ID:",INIT_CWD:"/home/anurag/workstation/debales/debales/packages/ai",npm_config_json:"true",EDITOR:"vi",NODE_ENV:"production"},Ue;if(typeof window>"u"){var fA={hostname:""};Ue={crypto:{randomUUID:function(){throw Error("unsupported")}},navigator:{userAgent:"",onLine:!0},document:{createElement:function(){return{}},location:fA,referrer:""},screen:{width:0,height:0},location:fA,addEventListener:function(){},removeEventListener:function(){}}}else Ue=window;function dA(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function hA(e,t,n,r,i,o,s){try{var u=e[o](s),c=u.value}catch(d){n(d);return}u.done?t(c):Promise.resolve(c).then(r,i)}function r_(e){return function(){var t=this,n=arguments;return new Promise(function(r,i){var o=e.apply(t,n);function s(c){hA(o,r,i,s,u,"next",c)}function u(c){hA(o,r,i,s,u,"throw",c)}s(void 0)})}}function Oh(e,t,n){return pA()?Oh=Reflect.construct:Oh=function(i,o,s){var u=[null];u.push.apply(u,o);var c=Function.bind.apply(i,u),d=new c;return s&&Bc(d,s.prototype),d},Oh.apply(null,arguments)}function Tz(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function sr(e,t,n){return t&&Tz(e.prototype,t),e}function Bt(){return Bt=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Bt.apply(this,arguments)}function i_(e){return i_=Object.setPrototypeOf?Object.getPrototypeOf:function(n){return n.__proto__||Object.getPrototypeOf(n)},i_(e)}function Sr(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Bc(e,t)}function vt(e,t){return t!=null&&typeof Symbol<"u"&&t[Symbol.hasInstance]?!!t[Symbol.hasInstance](e):e instanceof t}function Mz(e){return Function.toString.call(e).indexOf("[native code]")!==-1}function Pc(e,t){if(e==null)return{};var n={},r=Object.keys(e),i,o;for(o=0;o<r.length;o++)i=r[o],!(t.indexOf(i)>=0)&&(n[i]=e[i]);return n}function Bc(e,t){return Bc=Object.setPrototypeOf||function(r,i){return r.__proto__=i,r},Bc(e,t)}function Rt(e){"@swc/helpers - typeof";return e&&typeof Symbol<"u"&&e.constructor===Symbol?"symbol":typeof e}function Dz(e,t){if(e){if(typeof e=="string")return dA(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(n);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return dA(e,t)}}function Th(e){var t=typeof Map=="function"?new Map:void 0;return Th=function(r){if(r===null||!Mz(r))return r;if(typeof r!="function")throw new TypeError("Super expression must either be null or a function");if(typeof t<"u"){if(t.has(r))return t.get(r);t.set(r,i)}function i(){return Oh(r,arguments,i_(this).constructor)}return i.prototype=Object.create(r.prototype,{constructor:{value:i,enumerable:!1,writable:!0,configurable:!0}}),Bc(i,r)},Th(e)}function pA(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(pA=function(){return!!e})()}function Ve(e,t){var n=typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n)return(n=n.call(e)).next.bind(n);if(Array.isArray(e)||(n=Dz(e))||t){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function Fc(e,t){var n,r,i,o,s={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]};return o={next:u(0),throw:u(1),return:u(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function u(d){return function(p){return c([d,p])}}function c(d){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(i=d[0]&2?r.return:d[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,d[1])).done)return i;switch(r=0,i&&(d=[d[0]&2,i.value]),d[0]){case 0:case 1:i=d;break;case 4:return s.label++,{value:d[1],done:!1};case 5:s.label++,r=d[1],d=[0];continue;case 7:d=s.ops.pop(),s.trys.pop();continue;default:if(i=s.trys,!(i=i.length>0&&i[i.length-1])&&(d[0]===6||d[0]===2)){s=0;continue}if(d[0]===3&&(!i||d[1]>i[0]&&d[1]<i[3])){s.label=d[1];break}if(d[0]===6&&s.label<i[1]){s.label=i[1],i=d;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(d);break}i[2]&&s.ops.pop(),s.trys.pop();continue}d=t.call(e,s)}catch(p){d=[6,p],r=0}finally{n=i=0}if(d[0]&5)throw d[1];return{value:d[0]?d[1]:void 0,done:!0}}}function gA(e){var t=typeof Symbol=="function"&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}var $z=Object.defineProperty,Lz=function(e,t,n){return t in e?$z(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n},Le=function(e,t,n){return Lz(e,(typeof t>"u"?"undefined":Rt(t))!=="symbol"?t+"":t,n)},mA,Nz=Object.defineProperty,Pz=function(e,t,n){return t in e?Nz(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n},vA=function(e,t,n){return Pz(e,(typeof t>"u"?"undefined":Rt(t))!=="symbol"?t+"":t,n)},Kn=function(e){return e[e.Document=0]="Document",e[e.DocumentType=1]="DocumentType",e[e.Element=2]="Element",e[e.Text=3]="Text",e[e.CDATA=4]="CDATA",e[e.Comment=5]="Comment",e}(Kn||{}),yA={Node:["childNodes","parentNode","parentElement","textContent"],ShadowRoot:["host","styleSheets"],Element:["shadowRoot","querySelector","querySelectorAll"],MutationObserver:[]},_A={Node:["contains","getRootNode"],ShadowRoot:["getSelection"],Element:[],MutationObserver:["constructor"]},Mh={},Bz=function(){return!!globalThis.Zone};function o_(e){if(Mh[e])return Mh[e];var t=globalThis[e],n=t.prototype,r=e in yA?yA[e]:void 0,i=!!(r&&r.every(function(p){var h,m;return!!((m=(h=Object.getOwnPropertyDescriptor(n,p))==null?void 0:h.get)!=null&&m.toString().includes("[native code]"))})),o=e in _A?_A[e]:void 0,s=!!(o&&o.every(function(p){var h;return typeof n[p]=="function"&&((h=n[p])==null?void 0:h.toString().includes("[native code]"))}));if(i&&s&&!Bz())return Mh[e]=t.prototype,t.prototype;try{var u=document.createElement("iframe");document.body.appendChild(u);var c=u.contentWindow;if(!c)return t.prototype;var d=c[e].prototype;return document.body.removeChild(u),d?Mh[e]=d:n}catch{return n}}var a_={};function Ca(e,t,n){var r,i=e+"."+String(n);if(a_[i])return a_[i].call(t);var o=o_(e),s=(r=Object.getOwnPropertyDescriptor(o,n))==null?void 0:r.get;return s?(a_[i]=s,s.call(t)):t[n]}var s_={};function bA(e,t,n){var r=e+"."+String(n);if(s_[r])return s_[r].bind(t);var i=o_(e),o=i[n];return typeof o!="function"?t[n]:(s_[r]=o,o.bind(t))}function Fz(e){return Ca("Node",e,"childNodes")}function Uz(e){return Ca("Node",e,"parentNode")}function zz(e){return Ca("Node",e,"parentElement")}function qz(e){return Ca("Node",e,"textContent")}function jz(e,t){return bA("Node",e,"contains")(t)}function Hz(e){return bA("Node",e,"getRootNode")()}function Gz(e){return!e||!("host"in e)?null:Ca("ShadowRoot",e,"host")}function Vz(e){return e.styleSheets}function Zz(e){return!e||!("shadowRoot"in e)?null:Ca("Element",e,"shadowRoot")}function Yz(e,t){return Ca("Element",e,"querySelector")(t)}function Wz(e,t){return Ca("Element",e,"querySelectorAll")(t)}function Kz(){return o_("MutationObserver").constructor}var wr={childNodes:Fz,parentNode:Uz,parentElement:zz,textContent:qz,contains:jz,getRootNode:Hz,host:Gz,styleSheets:Vz,shadowRoot:Zz,querySelector:Yz,querySelectorAll:Wz,mutationObserver:Kz};function SA(e){return e.nodeType===e.ELEMENT_NODE}function Uc(e){var t=e&&"host"in e&&"mode"in e&&wr.host(e)||null;return!!(t&&"shadowRoot"in t&&wr.shadowRoot(t)===e)}function zc(e){return Object.prototype.toString.call(e)==="[object ShadowRoot]"}function Qz(e){return e.includes(" background-clip: text;")&&!e.includes(" -webkit-background-clip: text;")&&(e=e.replace(/\sbackground-clip:\s*text;/g," -webkit-background-clip: text; background-clip: text;")),e}function Xz(e){var t=e.cssText;if(t.split('"').length<3)return t;var n=["@import","url("+JSON.stringify(e.href)+")"];return e.layerName===""?n.push("layer"):e.layerName&&n.push("layer("+e.layerName+")"),e.supportsText&&n.push("supports("+e.supportsText+")"),e.media.length&&n.push(e.media.mediaText),n.join(" ")+";"}function l_(e){try{var t=e.rules||e.cssRules;if(!t)return null;var n=e.href;!n&&e.ownerNode&&e.ownerNode.ownerDocument&&(n=e.ownerNode.ownerDocument.location.href);var r=Array.from(t,function(i){return wA(i,n)}).join("");return Qz(r)}catch{return null}}function wA(e,t){if(e7(e)){var n;try{n=l_(e.styleSheet)||Xz(e)}catch{n=e.cssText}return e.styleSheet.href?Dh(n,e.styleSheet.href):n}else{var r=e.cssText;return t7(e)&&e.selectorText.includes(":")&&(r=Jz(r)),t?Dh(r,t):r}}function Jz(e){var t=/(\[(?:[\w-]+)[^\\])(:(?:[\w-]+)\])/gm;return e.replace(t,"$1\\$2")}function e7(e){return"styleSheet"in e}function t7(e){return"selectorText"in e}var xA=function(){function e(){vA(this,"idNodeMap",new Map),vA(this,"nodeMetaMap",new WeakMap)}var t=e.prototype;return t.getId=function(r){var i;if(!r)return-1;var o=(i=this.getMeta(r))==null?void 0:i.id;return o??-1},t.getNode=function(r){return this.idNodeMap.get(r)||null},t.getIds=function(){return Array.from(this.idNodeMap.keys())},t.getMeta=function(r){return this.nodeMetaMap.get(r)||null},t.removeNodeFromMap=function(r){var i=this,o=this.getId(r);this.idNodeMap.delete(o),r.childNodes&&r.childNodes.forEach(function(s){return i.removeNodeFromMap(s)})},t.has=function(r){return this.idNodeMap.has(r)},t.hasNode=function(r){return this.nodeMetaMap.has(r)},t.add=function(r,i){var o=i.id;this.idNodeMap.set(o,r),this.nodeMetaMap.set(r,i)},t.replace=function(r,i){var o=this.getNode(r);if(o){var s=this.nodeMetaMap.get(o);s&&this.nodeMetaMap.set(i,s)}this.idNodeMap.set(r,i)},t.reset=function(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap},e}();function n7(){return new xA}function u_(e){var t=e.element,n=e.maskInputOptions,r=e.tagName,i=e.type,o=e.value,s=e.maskInputFn,u=o||"",c=i&&Ts(i);return(n[r.toLowerCase()]||c&&n[c])&&(s?u=s(u,t):u="*".repeat(u.length)),u}function Ts(e){return e.toLowerCase()}var CA="__rrweb_original__";function r7(e){var t=e.getContext("2d");if(!t)return!0;for(var n=50,r=0;r<e.width;r+=n)for(var i=0;i<e.height;i+=n){var o=t.getImageData,s=CA in o?o[CA]:o,u=new Uint32Array(s.call(t,r,i,Math.min(n,e.width-r),Math.min(n,e.height-i)).data.buffer);if(u.some(function(c){return c!==0}))return!1}return!0}function c_(e){var t=e.type;return e.hasAttribute("data-rr-is-password")?"password":t?Ts(t):null}function EA(e,t){var n;try{n=new URL(e,t??window.location.href)}catch{return null}var r=/\.([0-9a-z]+)(?:$)/i,i=n.pathname.match(r),o;return(o=i==null?void 0:i[1])!=null?o:null}function i7(e){var t="";return e.indexOf("//")>-1?t=e.split("/").slice(0,3).join("/"):t=e.split("/")[0],t=t.split("?")[0],t}var o7=/url\((?:(')([^']*)'|(")(.*?)"|([^)]*))\)/gm,a7=/^(?:[a-z+]+:)?\/\//i,s7=/^www\..*/i,l7=/^(data:)([^,]*),(.*)/i;function Dh(e,t){return(e||"").replace(o7,function(n,r,i,o,s,u){var c=i||s||u,d=r||o||"";if(!c)return n;if(a7.test(c)||s7.test(c)||l7.test(c))return"url("+d+c+d+")";if(c[0]==="/")return"url("+d+(i7(t)+c)+d+")";var p=t.split("/"),h=c.split("/");p.pop();for(var m=Ve(h),v;!(v=m()).done;){var _=v.value;_!=="."&&(_===".."?p.pop():p.push(_))}return"url("+d+p.join("/")+d+")"})}function f_(e){return e.replace(/(\/\*[^*]*\*\/)|[\s;]/g,"")}function u7(e,t){var n=Array.from(t.childNodes),r=[];if(n.length>1&&e&&typeof e=="string"){for(var i=f_(e),o=1;o<n.length;o++)if(n[o].textContent&&typeof n[o].textContent=="string")for(var s=f_(n[o].textContent),u=3;u<s.length;u++){var c=s.substring(0,u);if(i.split(c).length===2){for(var d=i.indexOf(c),p=d;p<e.length;p++)if(f_(e.substring(0,p)).length===d){r.push(e.substring(0,p)),e=e.substring(p);break}break}}}return r.push(e),r}function c7(e,t){return u7(e,t).join("/* rr_split */")}var f7=1,d7=new RegExp("[^a-z0-9-_:]"),qc=-2;function kA(){return f7++}function h7(e){if(vt(e,HTMLFormElement))return"form";var t=Ts(e.tagName);return d7.test(t)?"div":t}var Dl,AA,p7=/^[^ \t\n\r\u000c]+/,g7=/^[, \t\n\r\u000c]+/;function m7(e,t){if(t.trim()==="")return t;var n=0;function r(d){var p,h=d.exec(t.substring(n));return h?(p=h[0],n+=p.length,p):""}for(var i=[];r(g7),!(n>=t.length);){var o=r(p7);if(o.slice(-1)===",")o=$l(e,o.substring(0,o.length-1)),i.push(o);else{var s="";o=$l(e,o);for(var u=!1;;){var c=t.charAt(n);if(c===""){i.push((o+s).trim());break}else if(u)c===")"&&(u=!1);else if(c===","){n+=1,i.push((o+s).trim());break}else c==="("&&(u=!0);s+=c,n+=1}}}return i.join(", ")}var IA=new WeakMap;function $l(e,t){return!t||t.trim()===""?t:d_(e,t)}function v7(e){return!!(e.tagName==="svg"||e.ownerSVGElement)}function d_(e,t){var n=IA.get(e);if(n||(n=e.createElement("a"),IA.set(e,n)),!t)t="";else if(t.startsWith("blob:")||t.startsWith("data:"))return t;return n.setAttribute("href",t),n.href}function RA(e,t,n,r){return r&&(n==="src"||n==="href"&&!(t==="use"&&r[0]==="#")||n==="xlink:href"&&r[0]!=="#"||n==="background"&&(t==="table"||t==="td"||t==="th")?$l(e,r):n==="srcset"?m7(e,r):n==="style"?Dh(r,d_(e)):t==="object"&&n==="data"?$l(e,r):r)}function OA(e,t,n){return(e==="video"||e==="audio")&&t==="autoplay"}function y7(e,t,n){try{if(typeof t=="string"){if(e.classList.contains(t))return!0}else for(var r=e.classList.length;r--;){var i=e.classList[r];if(t.test(i))return!0}if(n)return e.matches(n)}catch{}return!1}function $h(e,t,n){if(!e)return!1;if(e.nodeType!==e.ELEMENT_NODE)return n?$h(wr.parentNode(e),t,n):!1;for(var r=e.classList.length;r--;){var i=e.classList[r];if(t.test(i))return!0}return n?$h(wr.parentNode(e),t,n):!1}function TA(e,t,n,r){var i;if(SA(e)){if(i=e,!wr.childNodes(i).length)return!1}else{if(wr.parentElement(e)===null)return!1;i=wr.parentElement(e)}try{if(typeof t=="string"){if(r){if(i.closest("."+t))return!0}else if(i.classList.contains(t))return!0}else if($h(i,t,r))return!0;if(n){if(r){if(i.closest(n))return!0}else if(i.matches(n))return!0}}catch{}return!1}function _7(e,t,n){var r=e.contentWindow;if(r){var i=!1,o;try{o=r.document.readyState}catch{return}if(o!=="complete"){var s=setTimeout(function(){i||(t(),i=!0)},n);e.addEventListener("load",function(){clearTimeout(s),i=!0,t()});return}var u="about:blank";if(r.location.href!==u||e.src===u||e.src==="")return setTimeout(t,0),e.addEventListener("load",t);e.addEventListener("load",t)}}function b7(e,t,n){var r=!1,i;try{i=e.sheet}catch{return}if(!i){var o=setTimeout(function(){r||(t(),r=!0)},n);e.addEventListener("load",function(){clearTimeout(o),r=!0,t()})}}function S7(e,t){var n=t.doc,r=t.mirror,i=t.blockClass,o=t.blockSelector,s=t.needsMask,u=t.inlineStylesheet,c=t.maskInputOptions,d=c===void 0?{}:c,p=t.maskTextFn,h=t.maskInputFn,m=t.dataURLOptions,v=m===void 0?{}:m,_=t.inlineImages,x=t.recordCanvas,b=t.keepIframeSrcFn,w=t.newlyAddedElement,C=w===void 0?!1:w,E=t.cssCaptured,R=E===void 0?!1:E,O=w7(n,r);switch(e.nodeType){case e.DOCUMENT_NODE:return e.compatMode!=="CSS1Compat"?{type:Kn.Document,childNodes:[],compatMode:e.compatMode}:{type:Kn.Document,childNodes:[]};case e.DOCUMENT_TYPE_NODE:return{type:Kn.DocumentType,name:e.name,publicId:e.publicId,systemId:e.systemId,rootId:O};case e.ELEMENT_NODE:return C7(e,{doc:n,blockClass:i,blockSelector:o,inlineStylesheet:u,maskInputOptions:d,maskInputFn:h,dataURLOptions:v,inlineImages:_,recordCanvas:x,keepIframeSrcFn:b,newlyAddedElement:C,rootId:O});case e.TEXT_NODE:return x7(e,{doc:n,needsMask:s,maskTextFn:p,rootId:O,cssCaptured:R});case e.CDATA_SECTION_NODE:return{type:Kn.CDATA,textContent:"",rootId:O};case e.COMMENT_NODE:return{type:Kn.Comment,textContent:wr.textContent(e)||"",rootId:O};default:return!1}}function w7(e,t){if(t.hasNode(e)){var n=t.getId(e);return n===1?void 0:n}}function x7(e,t){var n=t.needsMask,r=t.maskTextFn,i=t.rootId,o=t.cssCaptured,s=wr.parentNode(e),u=s&&s.tagName,c="",d=u==="STYLE"?!0:void 0,p=u==="SCRIPT"?!0:void 0;return p?c="SCRIPT_PLACEHOLDER":o||(c=wr.textContent(e),d&&c&&(c=Dh(c,d_(t.doc)))),!d&&!p&&c&&n&&(c=r?r(c,wr.parentElement(e)):c.replace(/[\S]/g,"*")),{type:Kn.Text,textContent:c||"",rootId:i}}function C7(e,t){for(var n=t.doc,r=t.blockClass,i=t.blockSelector,o=t.inlineStylesheet,s=t.maskInputOptions,u=s===void 0?{}:s,c=t.maskInputFn,d=t.dataURLOptions,p=d===void 0?{}:d,h=t.inlineImages,m=t.recordCanvas,v=t.keepIframeSrcFn,_=t.newlyAddedElement,x=_===void 0?!1:_,b=t.rootId,w=y7(e,r,i),C=h7(e),E={},R=e.attributes.length,O=0;O<R;O++){var T=e.attributes[O];OA(C,T.name,T.value)||(E[T.name]=RA(n,C,Ts(T.name),T.value))}if(C==="link"&&o){var L=Array.from(n.styleSheets).find(function(ue){return ue.href===e.href}),B=null;L&&(B=l_(L)),B&&(delete E.rel,delete E.href,E._cssText=B)}if(C==="style"&&e.sheet){var z=l_(e.sheet);z&&(e.childNodes.length>1&&(z=c7(z,e)),E._cssText=z)}if(C==="input"||C==="textarea"||C==="select"){var P=e.value,V=e.checked;E.type!=="radio"&&E.type!=="checkbox"&&E.type!=="submit"&&E.type!=="button"&&P?E.value=u_({element:e,type:c_(e),tagName:C,value:P,maskInputOptions:u,maskInputFn:c}):V&&(E.checked=V)}if(C==="option"&&(e.selected&&!u.select?E.selected=!0:delete E.selected),C==="dialog"&&e.open&&(E.rr_open_mode=e.matches("dialog:modal")?"modal":"non-modal"),C==="canvas"&&m){if(e.__context==="2d")r7(e)||(E.rr_dataURL=e.toDataURL(p.type,p.quality));else if(!("__context"in e)){var J=e.toDataURL(p.type,p.quality),le=n.createElement("canvas");le.width=e.width,le.height=e.height;var G=le.toDataURL(p.type,p.quality);J!==G&&(E.rr_dataURL=J)}}if(C==="img"&&h){Dl||(Dl=n.createElement("canvas"),AA=Dl.getContext("2d"));var Z=e,q=Z.currentSrc||Z.getAttribute("src")||"<unknown-src>",H=Z.crossOrigin,fe=function(){Z.removeEventListener("load",fe);try{Dl.width=Z.naturalWidth,Dl.height=Z.naturalHeight,AA.drawImage(Z,0,0),E.rr_dataURL=Dl.toDataURL(p.type,p.quality)}catch(ue){if(Z.crossOrigin!=="anonymous"){Z.crossOrigin="anonymous",Z.complete&&Z.naturalWidth!==0?fe():Z.addEventListener("load",fe);return}else console.warn("Cannot inline img src="+q+"! Error: "+ue)}Z.crossOrigin==="anonymous"&&(H?E.crossOrigin=H:Z.removeAttribute("crossorigin"))};Z.complete&&Z.naturalWidth!==0?fe():Z.addEventListener("load",fe)}if(C==="audio"||C==="video"){var we=E;we.rr_mediaState=e.paused?"paused":"played",we.rr_mediaCurrentTime=e.currentTime,we.rr_mediaPlaybackRate=e.playbackRate,we.rr_mediaMuted=e.muted,we.rr_mediaLoop=e.loop,we.rr_mediaVolume=e.volume}if(x||(e.scrollLeft&&(E.rr_scrollLeft=e.scrollLeft),e.scrollTop&&(E.rr_scrollTop=e.scrollTop)),w){var k=e.getBoundingClientRect(),ne=k.width,de=k.height;E={class:E.class,rr_width:""+ne+"px",rr_height:""+de+"px"}}C==="iframe"&&!v(E.src)&&(e.contentDocument||(E.rr_src=E.src),delete E.src);var D;try{customElements.get(C)&&(D=!0)}catch{}return{type:Kn.Element,tagName:C,attributes:E,childNodes:[],isSVG:v7(e)||void 0,needBlock:w,rootId:b,isCustom:D}}function ln(e){return e==null?"":e.toLowerCase()}function E7(e,t){if(t.comment&&e.type===Kn.Comment)return!0;if(e.type===Kn.Element){if(t.script&&(e.tagName==="script"||e.tagName==="link"&&(e.attributes.rel==="preload"||e.attributes.rel==="modulepreload")&&e.attributes.as==="script"||e.tagName==="link"&&e.attributes.rel==="prefetch"&&typeof e.attributes.href=="string"&&EA(e.attributes.href)==="js"))return!0;if(t.headFavicon&&(e.tagName==="link"&&e.attributes.rel==="shortcut icon"||e.tagName==="meta"&&(ln(e.attributes.name).match(/^msapplication-tile(image|color)$/)||ln(e.attributes.name)==="application-name"||ln(e.attributes.rel)==="icon"||ln(e.attributes.rel)==="apple-touch-icon"||ln(e.attributes.rel)==="shortcut icon")))return!0;if(e.tagName==="meta"){if(t.headMetaDescKeywords&&ln(e.attributes.name).match(/^description|keywords$/))return!0;if(t.headMetaSocial&&(ln(e.attributes.property).match(/^(og|twitter|fb):/)||ln(e.attributes.name).match(/^(og|twitter):/)||ln(e.attributes.name)==="pinterest"))return!0;if(t.headMetaRobots&&(ln(e.attributes.name)==="robots"||ln(e.attributes.name)==="googlebot"||ln(e.attributes.name)==="bingbot"))return!0;if(t.headMetaHttpEquiv&&e.attributes["http-equiv"]!==void 0)return!0;if(t.headMetaAuthorship&&(ln(e.attributes.name)==="author"||ln(e.attributes.name)==="generator"||ln(e.attributes.name)==="framework"||ln(e.attributes.name)==="publisher"||ln(e.attributes.name)==="progid"||ln(e.attributes.property).match(/^article:/)||ln(e.attributes.property).match(/^product:/)))return!0;if(t.headMetaVerification&&(ln(e.attributes.name)==="google-site-verification"||ln(e.attributes.name)==="yandex-verification"||ln(e.attributes.name)==="csrf-token"||ln(e.attributes.name)==="p:domain_verify"||ln(e.attributes.name)==="verify-v1"||ln(e.attributes.name)==="verification"||ln(e.attributes.name)==="shopify-checkout-api-token"))return!0}}return!1}function Ll(e,t){var n=t.doc,r=t.mirror,i=t.blockClass,o=t.blockSelector,s=t.maskTextClass,u=t.maskTextSelector,c=t.skipChild,d=c===void 0?!1:c,p=t.inlineStylesheet,h=p===void 0?!0:p,m=t.maskInputOptions,v=m===void 0?{}:m,_=t.maskTextFn,x=t.maskInputFn,b=t.slimDOMOptions,w=t.dataURLOptions,C=w===void 0?{}:w,E=t.inlineImages,R=E===void 0?!1:E,O=t.recordCanvas,T=O===void 0?!1:O,L=t.onSerialize,B=t.onIframeLoad,z=t.iframeLoadTimeout,P=z===void 0?5e3:z,V=t.onStylesheetLoad,J=t.stylesheetLoadTimeout,le=J===void 0?5e3:J,G=t.keepIframeSrcFn,Z=G===void 0?function(){return!1}:G,q=t.newlyAddedElement,H=q===void 0?!1:q,fe=t.cssCaptured,we=fe===void 0?!1:fe,k=t.needsMask,ne=t.preserveWhiteSpace,de=ne===void 0?!0:ne;if(!k){var D=k===void 0;k=TA(e,s,u,D)}var ue=S7(e,{doc:n,mirror:r,blockClass:i,blockSelector:o,needsMask:k,inlineStylesheet:h,maskInputOptions:v,maskTextFn:_,maskInputFn:x,dataURLOptions:C,inlineImages:R,recordCanvas:T,keepIframeSrcFn:Z,newlyAddedElement:H,cssCaptured:we});if(!ue)return console.warn(e,"not serialized"),null;var Re;r.hasNode(e)?Re=r.getId(e):E7(ue,b)||!de&&ue.type===Kn.Text&&!ue.textContent.replace(/^\s+|\s+$/gm,"").length?Re=qc:Re=kA();var ie=Object.assign(ue,{id:Re});if(r.add(e,ie),Re===qc)return null;L&&L(e);var Ne=!d;if(ie.type===Kn.Element){Ne=Ne&&!ie.needBlock,delete ie.needBlock;var De=wr.shadowRoot(e);De&&zc(De)&&(ie.isShadowHost=!0)}if((ie.type===Kn.Document||ie.type===Kn.Element)&&Ne){b.headWhitespace&&ie.type===Kn.Element&&ie.tagName==="head"&&(de=!1);var Fe={doc:n,mirror:r,blockClass:i,blockSelector:o,needsMask:k,maskTextClass:s,maskTextSelector:u,skipChild:d,inlineStylesheet:h,maskInputOptions:v,maskTextFn:_,maskInputFn:x,slimDOMOptions:b,dataURLOptions:C,inlineImages:R,recordCanvas:T,preserveWhiteSpace:de,onSerialize:L,onIframeLoad:B,iframeLoadTimeout:P,onStylesheetLoad:V,stylesheetLoadTimeout:le,keepIframeSrcFn:Z,cssCaptured:!1};if(!(ie.type===Kn.Element&&ie.tagName==="textarea"&&ie.attributes.value!==void 0)){ie.type===Kn.Element&&ie.attributes._cssText!==void 0&&typeof ie.attributes._cssText=="string"&&(Fe.cssCaptured=!0);for(var We=Ve(Array.from(wr.childNodes(e))),Pe;!(Pe=We()).done;){var be=Pe.value,Ke=Ll(be,Fe);Ke&&ie.childNodes.push(Ke)}}var Je=null;if(SA(e)&&(Je=wr.shadowRoot(e)))for(var dt=Ve(Array.from(wr.childNodes(Je))),tt;!(tt=dt()).done;){var lt=tt.value,N=Ll(lt,Fe);N&&(zc(Je)&&(N.isShadow=!0),ie.childNodes.push(N))}}var F=wr.parentNode(e);return F&&Uc(F)&&zc(F)&&(ie.isShadow=!0),ie.type===Kn.Element&&ie.tagName==="iframe"&&_7(e,function(){var K=e.contentDocument;if(K&&B){var me=Ll(K,{doc:K,mirror:r,blockClass:i,blockSelector:o,needsMask:k,maskTextClass:s,maskTextSelector:u,skipChild:!1,inlineStylesheet:h,maskInputOptions:v,maskTextFn:_,maskInputFn:x,slimDOMOptions:b,dataURLOptions:C,inlineImages:R,recordCanvas:T,preserveWhiteSpace:de,onSerialize:L,onIframeLoad:B,iframeLoadTimeout:P,onStylesheetLoad:V,stylesheetLoadTimeout:le,keepIframeSrcFn:Z});me&&B(e,me)}},P),ie.type===Kn.Element&&ie.tagName==="link"&&typeof ie.attributes.rel=="string"&&(ie.attributes.rel==="stylesheet"||ie.attributes.rel==="preload"&&typeof ie.attributes.href=="string"&&EA(ie.attributes.href)==="css")&&b7(e,function(){if(V){var K=Ll(e,{doc:n,mirror:r,blockClass:i,blockSelector:o,needsMask:k,maskTextClass:s,maskTextSelector:u,skipChild:!1,inlineStylesheet:h,maskInputOptions:v,maskTextFn:_,maskInputFn:x,slimDOMOptions:b,dataURLOptions:C,inlineImages:R,recordCanvas:T,preserveWhiteSpace:de,onSerialize:L,onIframeLoad:B,iframeLoadTimeout:P,onStylesheetLoad:V,stylesheetLoadTimeout:le,keepIframeSrcFn:Z});K&&V(e,K)}},le),ie}function k7(e,t){var n=t||{},r=n.mirror,i=r===void 0?new xA:r,o=n.blockClass,s=o===void 0?"rr-block":o,u=n.blockSelector,c=u===void 0?null:u,d=n.maskTextClass,p=d===void 0?"rr-mask":d,h=n.maskTextSelector,m=h===void 0?null:h,v=n.inlineStylesheet,_=v===void 0?!0:v,x=n.inlineImages,b=x===void 0?!1:x,w=n.recordCanvas,C=w===void 0?!1:w,E=n.maskAllInputs,R=E===void 0?!1:E,O=n.maskTextFn,T=n.maskInputFn,L=n.slimDOM,B=L===void 0?!1:L,z=n.dataURLOptions,P=n.preserveWhiteSpace,V=n.onSerialize,J=n.onIframeLoad,le=n.iframeLoadTimeout,G=n.onStylesheetLoad,Z=n.stylesheetLoadTimeout,q=n.keepIframeSrcFn,H=q===void 0?function(){return!1}:q,fe=R===!0?{color:!0,date:!0,"datetime-local":!0,email:!0,month:!0,number:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0,textarea:!0,select:!0,password:!0}:R===!1?{password:!0}:R,we=B===!0||B==="all"?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaDescKeywords:B==="all",headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaAuthorship:!0,headMetaVerification:!0}:B===!1?{}:B;return Ll(e,{doc:e,mirror:i,blockClass:s,blockSelector:c,maskTextClass:p,maskTextSelector:m,skipChild:!1,inlineStylesheet:_,maskInputOptions:fe,maskTextFn:O,maskInputFn:T,slimDOMOptions:we,dataURLOptions:z,inlineImages:b,recordCanvas:C,preserveWhiteSpace:P,onSerialize:V,onIframeLoad:J,iframeLoadTimeout:le,onStylesheetLoad:G,stylesheetLoadTimeout:Z,keepIframeSrcFn:H,newlyAddedElement:!1})}function A7(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function I7(e){if(e.__esModule)return e;var t=e.default;if(typeof t=="function"){var n=function r(){return vt(this,r)?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};n.prototype=t.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(e).forEach(function(r){var i=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(n,r,i.get?i:{enumerable:!0,get:function(){return e[r]}})}),n}var h_={exports:{}},hn=String,MA=function(){return{isColorSupported:!1,reset:hn,bold:hn,dim:hn,italic:hn,underline:hn,inverse:hn,hidden:hn,strikethrough:hn,black:hn,red:hn,green:hn,yellow:hn,blue:hn,magenta:hn,cyan:hn,white:hn,gray:hn,bgBlack:hn,bgRed:hn,bgGreen:hn,bgYellow:hn,bgBlue:hn,bgMagenta:hn,bgCyan:hn,bgWhite:hn}};h_.exports=MA(),h_.exports.createColors=MA;var R7=h_.exports,O7={},T7=Object.freeze(Object.defineProperty({__proto__:null,default:O7},Symbol.toStringTag,{value:"Module"})),Mn=I7(T7),DA=R7,$A=Mn,p_=function(e){Sr(t,e);function t(r,i,o,s,u,c){var d;return d=e.call(this,r)||this,d.name="CssSyntaxError",d.reason=r,u&&(d.file=u),s&&(d.source=s),c&&(d.plugin=c),typeof i<"u"&&typeof o<"u"&&(typeof i=="number"?(d.line=i,d.column=o):(d.line=i.line,d.column=i.column,d.endLine=o.line,d.endColumn=o.column)),d.setMessage(),Error.captureStackTrace&&Error.captureStackTrace(d,t),d}var n=t.prototype;return n.setMessage=function(){this.message=this.plugin?this.plugin+": ":"",this.message+=this.file?this.file:"<css input>",typeof this.line<"u"&&(this.message+=":"+this.line+":"+this.column),this.message+=": "+this.reason},n.showSourceCode=function(i){var o=this;if(!this.source)return"";var s=this.source;i==null&&(i=DA.isColorSupported),$A&&i&&(s=$A(s));var u=s.split(/\r?\n/),c=Math.max(this.line-3,0),d=Math.min(this.line+2,u.length),p=String(d).length,h,m;if(i){var v=DA.createColors(!0),_=v.bold,x=v.gray,b=v.red;h=function(w){return _(b(w))},m=function(w){return x(w)}}else h=m=function(w){return w};return u.slice(c,d).map(function(w,C){var E=c+1+C,R=" "+(" "+E).slice(-p)+" | ";if(E===o.line){var O=m(R.replace(/\d/g," "))+w.slice(0,o.column-1).replace(/[^\t]/g," ");return h(">")+m(R)+w+`
|
|
79
79
|
`+O+h("^")}return" "+m(R)+w}).join(`
|
|
80
80
|
`)},n.toString=function(){var i=this.showSourceCode();return i&&(i=`
|
|
81
81
|
|
|
@@ -133,7 +133,7 @@ or you can use record.mirror to access the mirror instance during recording.`,kR
|
|
|
133
133
|
`+m+"]":"["+v.join(",")+"]",s=m,p}for(d in _)Dp.call(_,d)&&(p=r(d,_),p&&v.push(n(d)+(s?": ":":")+p));return p=v.length===0?"{}":s?"{"+v.join(",")+m+"}":"{"+v.join(",")+"}",s=m,p}};return r("",{"":t})}}(),I.JSONDecode=function(){var e,t,n={'"':'"',"\\":"\\","/":"/",b:"\b",f:"\f",n:`
|
|
134
134
|
`,r:"\r",t:" "},r,i=function(v){var _=new SyntaxError(v);throw _.at=e,_.text=r,_},o=function(v){return v&&v!==t&&i("Expected '"+v+"' instead of '"+t+"'"),t=r.charAt(e),e+=1,t},s=function(){var v,_="";for(t==="-"&&(_="-",o("-"));t>="0"&&t<="9";)_+=t,o();if(t===".")for(_+=".";o()&&t>="0"&&t<="9";)_+=t;if(t==="e"||t==="E")for(_+=t,o(),(t==="-"||t==="+")&&(_+=t,o());t>="0"&&t<="9";)_+=t,o();if(v=+_,!isFinite(v))i("Bad number");else return v},u=function(){var v,_,x="",b;if(t==='"')for(;o();){if(t==='"')return o(),x;if(t==="\\")if(o(),t==="u"){for(b=0,_=0;_<4&&(v=parseInt(o(),16),!!isFinite(v));_+=1)b=b*16+v;x+=String.fromCharCode(b)}else if(typeof n[t]=="string")x+=n[t];else break;else x+=t}i("Bad string")},c=function(){for(;t&&t<=" ";)o()},d=function(){switch(t){case"t":return o("t"),o("r"),o("u"),o("e"),!0;case"f":return o("f"),o("a"),o("l"),o("s"),o("e"),!1;case"n":return o("n"),o("u"),o("l"),o("l"),null}i('Unexpected "'+t+'"')},p,h=function(){var v=[];if(t==="["){if(o("["),c(),t==="]")return o("]"),v;for(;t;){if(v.push(p()),c(),t==="]")return o("]"),v;o(","),c()}}i("Bad array")},m=function(){var v,_={};if(t==="{"){if(o("{"),c(),t==="}")return o("}"),_;for(;t;){if(v=u(),c(),o(":"),Object.hasOwnProperty.call(_,v)&&i('Duplicate key "'+v+'"'),_[v]=p(),c(),t==="}")return o("}"),_;o(","),c()}}i("Bad object")};return p=function(){switch(c(),t){case"{":return m();case"[":return h();case'"':return u();case"-":return s();default:return t>="0"&&t<="9"?s():d()}},function(v){var _;return r=v,e=0,t=" ",_=p(),c(),t&&i("Syntax error"),_}}(),I.base64Encode=function(e){var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",n,r,i,o,s,u,c,d,p=0,h=0,m="",v=[];if(!e)return e;e=I.utf8Encode(e);do n=e.charCodeAt(p++),r=e.charCodeAt(p++),i=e.charCodeAt(p++),d=n<<16|r<<8|i,o=d>>18&63,s=d>>12&63,u=d>>6&63,c=d&63,v[h++]=t.charAt(o)+t.charAt(s)+t.charAt(u)+t.charAt(c);while(p<e.length);switch(m=v.join(""),e.length%3){case 1:m=m.slice(0,-2)+"==";break;case 2:m=m.slice(0,-1)+"=";break}return m},I.utf8Encode=function(e){e=(e+"").replace(/\r\n/g,`
|
|
135
135
|
`).replace(/\r/g,`
|
|
136
|
-
`);var t="",n,r,i=0,o;for(n=r=0,i=e.length,o=0;o<i;o++){var s=e.charCodeAt(o),u=null;s<128?r++:s>127&&s<2048?u=String.fromCharCode(s>>6|192,s&63|128):u=String.fromCharCode(s>>12|224,s>>6&63|128,s&63|128),u!==null&&(r>n&&(t+=e.substring(n,r)),t+=u,n=r=o+1)}return r>n&&(t+=e.substring(n,e.length)),t},I.UUID=function(){try{return Ue.crypto.randomUUID()}catch{for(var e=new Array(36),t=0;t<36;t++)e[t]=Math.floor(Math.random()*16);return e[14]=4,e[19]=e[19]&=-5,e[19]=e[19]|=8,e[8]=e[13]=e[18]=e[23]="-",I.map(e,function(r){return r.toString(16)}).join("")}};var pO=["ahrefsbot","ahrefssiteaudit","amazonbot","baiduspider","bingbot","bingpreview","chrome-lighthouse","facebookexternal","petalbot","pinterest","screaming frog","yahoo! slurp","yandex","adsbot-google","apis-google","duplexweb-google","feedfetcher-google","google favicon","google web preview","google-read-aloud","googlebot","googleweblight","mediapartners-google","storebot-google"];I.isBlockedUA=function(e){var t;for(e=e.toLowerCase(),t=0;t<pO.length;t++)if(e.indexOf(pO[t])!==-1)return!0;return!1},I.HTTPBuildQuery=function(e,t){var n,r,i=[];return I.isUndefined(t)&&(t="&"),I.each(e,function(o,s){n=encodeURIComponent(o.toString()),r=encodeURIComponent(s),i[i.length]=r+"="+n}),i.join(t)},I.getQueryParam=function(e,t){t=t.replace(/[[]/g,"\\[").replace(/[\]]/g,"\\]");var n="[\\?&]"+t+"=([^&#]*)",r=new RegExp(n),i=r.exec(e);if(i===null||i&&typeof i[1]!="string"&&i[1].length)return"";var o=i[1];try{o=decodeURIComponent(o)}catch{Ut.error("Skipping decoding for malformed query param: "+o)}return o.replace(/\+/g," ")},I.cookie={get:function(e){for(var t=e+"=",n=Vt.cookie.split(";"),r=0;r<n.length;r++){for(var i=n[r];i.charAt(0)==" ";)i=i.substring(1,i.length);if(i.indexOf(t)===0)return decodeURIComponent(i.substring(t.length,i.length))}return null},parse:function(e){var t;try{t=I.JSONDecode(I.cookie.get(e))||{}}catch{}return t},set_seconds:function(e,t,n,r,i,o,s){var u="",c="",d="";if(s)u="; domain="+s;else if(r){var p=vO(Vt.location.hostname);u=p?"; domain=."+p:""}if(n){var h=new Date;h.setTime(h.getTime()+n*1e3),c="; expires="+h.toGMTString()}o&&(i=!0,d="; SameSite=None"),i&&(d+="; secure"),Vt.cookie=e+"="+encodeURIComponent(t)+c+"; path=/"+u+d},set:function(e,t,n,r,i,o,s){var u="",c="",d="";if(s)u="; domain="+s;else if(r){var p=vO(Vt.location.hostname);u=p?"; domain=."+p:""}if(n){var h=new Date;h.setTime(h.getTime()+n*24*60*60*1e3),c="; expires="+h.toGMTString()}o&&(i=!0,d="; SameSite=None"),i&&(d+="; secure");var m=e+"="+encodeURIComponent(t)+c+"; path=/"+u+d;return Vt.cookie=m,m},remove:function(e,t,n){I.cookie.set(e,"",-1,t,!1,!1,n)}};var gO=function(e){var t=!0;try{var n="__mplss_"+Nb(8),r="xyz";e.setItem(n,r),e.getItem(n)!==r&&(t=!1),e.removeItem(n)}catch{t=!1}return t},$b=null,cf=function(e,t){return $b!==null&&!t?$b:$b=gO(e||Ue.localStorage)},Lb=null,sV=function(e,t){return Lb!==null&&!t?Lb:Lb=gO(e||Ue.sessionStorage)};function mO(e,t,n){var r=function(i){Ut.error(t+" error: "+i)};return{is_supported:function(i){var o=n(e,i);return o||Ut.error(t+" unsupported"),o},error:r,get:function(i){try{return e.getItem(i)}catch(o){r(o)}return null},parse:function(i){try{return I.JSONDecode(e.getItem(i))||{}}catch{}return null},set:function(i,o){try{e.setItem(i,o)}catch(s){r(s)}},remove:function(i){try{e.removeItem(i)}catch(o){r(o)}}}}I.localStorage=mO(Ue.localStorage,"localStorage",cf),I.sessionStorage=mO(Ue.sessionStorage,"sessionStorage",sV),I.register_event=function(){var e=function(r,i,o,s,u){if(!r){Ut.error("No valid element provided to register_event");return}if(r.addEventListener&&!s)r.addEventListener(i,o,!!u);else{var c="on"+i,d=r[c];r[c]=t(r,o,d)}};function t(r,i,o){var s=function(u){if(u=u||n(Ue.event),!!u){var c=!0,d,p;return I.isFunction(o)&&(d=o(u)),p=i.call(r,u),(d===!1||p===!1)&&(c=!1),c}};return s}function n(r){return r&&(r.preventDefault=n.preventDefault,r.stopPropagation=n.stopPropagation),r}return n.preventDefault=function(){this.returnValue=!1},n.stopPropagation=function(){this.cancelBubble=!0},e}();var lV=new RegExp('^(\\w*)\\[(\\w+)([=~\\|\\^\\$\\*]?)=?"?([^\\]"]*)"?\\]$');I.dom_query=function(){function e(i){return i.all?i.all:i.getElementsByTagName("*")}var t=/[\t\r\n]/g;function n(i,o){var s=" "+o+" ";return(" "+i.className+" ").replace(t," ").indexOf(s)>=0}function r(i){if(!Vt.getElementsByTagName)return[];var o=i.split(" "),s,u,c,d,p,h,m,v,_,x,b=[Vt];for(h=0;h<o.length;h++){if(s=o[h].replace(/^\s+/,"").replace(/\s+$/,""),s.indexOf("#")>-1){u=s.split("#"),c=u[0];var w=u[1],C=Vt.getElementById(w);if(!C||c&&C.nodeName.toLowerCase()!=c)return[];b=[C];continue}if(s.indexOf(".")>-1){u=s.split("."),c=u[0];var E=u[1];for(c||(c="*"),d=[],p=0,m=0;m<b.length;m++)for(c=="*"?_=e(b[m]):_=b[m].getElementsByTagName(c),v=0;v<_.length;v++)d[p++]=_[v];for(b=[],x=0,m=0;m<d.length;m++)d[m].className&&I.isString(d[m].className)&&n(d[m],E)&&(b[x++]=d[m]);continue}var R=s.match(lV);if(R){c=R[1];var O=R[2],T=R[3],L=R[4];for(c||(c="*"),d=[],p=0,m=0;m<b.length;m++)for(c=="*"?_=e(b[m]):_=b[m].getElementsByTagName(c),v=0;v<_.length;v++)d[p++]=_[v];b=[],x=0;var B;switch(T){case"=":B=function(z){return z.getAttribute(O)==L};break;case"~":B=function(z){return z.getAttribute(O).match(new RegExp("\\b"+L+"\\b"))};break;case"|":B=function(z){return z.getAttribute(O).match(new RegExp("^"+L+"-?"))};break;case"^":B=function(z){return z.getAttribute(O).indexOf(L)===0};break;case"$":B=function(z){return z.getAttribute(O).lastIndexOf(L)==z.getAttribute(O).length-L.length};break;case"*":B=function(z){return z.getAttribute(O).indexOf(L)>-1};break;default:B=function(z){return z.getAttribute(O)}}for(b=[],x=0,m=0;m<d.length;m++)B(d[m])&&(b[x++]=d[m]);continue}for(c=s,d=[],p=0,m=0;m<b.length;m++)for(_=b[m].getElementsByTagName(c),v=0;v<_.length;v++)d[p++]=_[v];b=d}return b}return function(i){return I.isElement(i)?[i]:I.isObject(i)&&!I.isUndefined(i.length)?i:r.call(this,i)}}();var uV=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","utm_id","utm_source_platform","utm_campaign_id","utm_creative_format","utm_marketing_tactic"],cV=["dclid","fbclid","gclid","ko_click_id","li_fat_id","msclkid","sccid","ttclid","twclid","wbraid"];I.info={campaignParams:function(e){var t="",n={};return I.each(uV,function(r){t=I.getQueryParam(Vt.URL,r),t.length?n[r]=t:e!==void 0&&(n[r]=e)}),n},clickParams:function(){var e="",t={};return I.each(cV,function(n){e=I.getQueryParam(Vt.URL,n),e.length&&(t[n]=e)}),t},marketingParams:function(){return I.extend(I.info.campaignParams(),I.info.clickParams())},searchEngine:function(e){return e.search("https?://(.*)google.([^/?]*)")===0?"google":e.search("https?://(.*)bing.com")===0?"bing":e.search("https?://(.*)yahoo.com")===0?"yahoo":e.search("https?://(.*)duckduckgo.com")===0?"duckduckgo":null},searchInfo:function(e){var t=I.info.searchEngine(e),n=t!="yahoo"?"q":"p",r={};if(t!==null){r.$search_engine=t;var i=I.getQueryParam(e,n);i.length&&(r.mp_keyword=i)}return r},browser:function(e,t,n){return t=t||"",n||I.includes(e," OPR/")?I.includes(e,"Mini")?"Opera Mini":"Opera":/(BlackBerry|PlayBook|BB10)/i.test(e)?"BlackBerry":I.includes(e,"IEMobile")||I.includes(e,"WPDesktop")?"Internet Explorer Mobile":I.includes(e,"SamsungBrowser/")?"Samsung Internet":I.includes(e,"Edge")||I.includes(e,"Edg/")?"Microsoft Edge":I.includes(e,"FBIOS")?"Facebook Mobile":I.includes(e,"Chrome")?"Chrome":I.includes(e,"CriOS")?"Chrome iOS":I.includes(e,"UCWEB")||I.includes(e,"UCBrowser")?"UC Browser":I.includes(e,"FxiOS")?"Firefox iOS":I.includes(t,"Apple")?I.includes(e,"Mobile")?"Mobile Safari":"Safari":I.includes(e,"Android")?"Android Mobile":I.includes(e,"Konqueror")?"Konqueror":I.includes(e,"Firefox")?"Firefox":I.includes(e,"MSIE")||I.includes(e,"Trident/")?"Internet Explorer":I.includes(e,"Gecko")?"Mozilla":""},browserVersion:function(e,t,n){var r=I.info.browser(e,t,n),i={"Internet Explorer Mobile":/rv:(\d+(\.\d+)?)/,"Microsoft Edge":/Edge?\/(\d+(\.\d+)?)/,Chrome:/Chrome\/(\d+(\.\d+)?)/,"Chrome iOS":/CriOS\/(\d+(\.\d+)?)/,"UC Browser":/(UCBrowser|UCWEB)\/(\d+(\.\d+)?)/,Safari:/Version\/(\d+(\.\d+)?)/,"Mobile Safari":/Version\/(\d+(\.\d+)?)/,Opera:/(Opera|OPR)\/(\d+(\.\d+)?)/,Firefox:/Firefox\/(\d+(\.\d+)?)/,"Firefox iOS":/FxiOS\/(\d+(\.\d+)?)/,Konqueror:/Konqueror:(\d+(\.\d+)?)/,BlackBerry:/BlackBerry (\d+(\.\d+)?)/,"Android Mobile":/android\s(\d+(\.\d+)?)/,"Samsung Internet":/SamsungBrowser\/(\d+(\.\d+)?)/,"Internet Explorer":/(rv:|MSIE )(\d+(\.\d+)?)/,Mozilla:/rv:(\d+(\.\d+)?)/},o=i[r];if(o===void 0)return null;var s=e.match(o);return s?parseFloat(s[s.length-2]):null},os:function(){var e=qo;return/Windows/i.test(e)?/Phone/.test(e)||/WPDesktop/.test(e)?"Windows Phone":"Windows":/(iPhone|iPad|iPod)/.test(e)?"iOS":/Android/.test(e)?"Android":/(BlackBerry|PlayBook|BB10)/i.test(e)?"BlackBerry":/Mac/i.test(e)?"Mac OS X":/Linux/.test(e)?"Linux":/CrOS/.test(e)?"Chrome OS":""},device:function(e){return/Windows Phone/i.test(e)||/WPDesktop/.test(e)?"Windows Phone":/iPad/.test(e)?"iPad":/iPod/.test(e)?"iPod Touch":/iPhone/.test(e)?"iPhone":/(BlackBerry|PlayBook|BB10)/i.test(e)?"BlackBerry":/Android/.test(e)?"Android":""},referringDomain:function(e){var t=e.split("/");return t.length>=3?t[2]:""},currentUrl:function(){return Ue.location.href},properties:function(e){return typeof e!="object"&&(e={}),I.extend(I.strip_empty_properties({$os:I.info.os(),$browser:I.info.browser(qo,Da.vendor,$p),$referrer:Vt.referrer,$referring_domain:I.info.referringDomain(Vt.referrer),$device:I.info.device(qo)}),{$current_url:I.info.currentUrl(),$browser_version:I.info.browserVersion(qo,Da.vendor,$p),$screen_height:cO.height,$screen_width:cO.width,mp_lib:"web",$lib_version:qi.LIB_VERSION,$insert_id:Nb(),time:I.timestamp()/1e3},I.strip_empty_properties(e))},people_properties:function(){return I.extend(I.strip_empty_properties({$os:I.info.os(),$browser:I.info.browser(qo,Da.vendor,$p)}),{$browser_version:I.info.browserVersion(qo,Da.vendor,$p)})},mpPageViewProperties:function(){return I.strip_empty_properties({current_page_title:Vt.title,current_domain:Ue.location.hostname,current_url_path:Ue.location.pathname,current_url_protocol:Ue.location.protocol,current_url_search:Ue.location.search})}};var fV=function(e,t){var n=null,r=[];return function(i){var o=this;return r.push(i),n||(n=new qt(function(s){setTimeout(function(){var u=e.apply(o,[r]);n=null,r=[],s(u)},t)})),n}},Nb=function(e){var t=Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10);return e?t.substring(0,e):t},dV=/[a-z0-9][a-z0-9-]*\.[a-z]+$/i,hV=/[a-z0-9][a-z0-9-]+\.[a-z.]{2,6}$/i,vO=function(e){var t=hV,n=e.split("."),r=n[n.length-1];(r.length>4||r==="com"||r==="org")&&(t=dV);var i=e.match(t);return i?i[0]:""},pV=function(){var e=Ue.navigator.onLine;return I.isUndefined(e)||e},$a=function(){},Yl=null,Lp=null;typeof JSON<"u"&&(Yl=JSON.stringify,Lp=JSON.parse),Yl=Yl||I.JSONEncode,Lp=Lp||I.JSONDecode,I.info=I.info,I.info.browser=I.info.browser,I.info.browserVersion=I.info.browserVersion,I.info.device=I.info.device,I.info.properties=I.info.properties,I.isBlockedUA=I.isBlockedUA,I.isEmptyObject=I.isEmptyObject,I.isObject=I.isObject,I.JSONDecode=I.JSONDecode,I.JSONEncode=I.JSONEncode,I.toArray=I.toArray,I.NPO=Ta;var gV="mixpanelBrowserDb",yO="mixpanelRecordingEvents",Pb="mixpanelRecordingRegistry",mV=1,vV=[yO,Pb],so=function(e){this.dbPromise=null,this.storeName=e};so.prototype._openDb=function(){return new qt(function(e,t){var n=Ue.indexedDB.open(gV,mV);n.onerror=function(){t(n.error)},n.onsuccess=function(){e(n.result)},n.onupgradeneeded=function(r){var i=r.target.result;vV.forEach(function(o){i.createObjectStore(o)})}})},so.prototype.init=function(){return Ue.indexedDB?(this.dbPromise||(this.dbPromise=this._openDb()),this.dbPromise.then(function(e){return e instanceof Ue.IDBDatabase?qt.resolve():qt.reject(e)})):qt.reject("indexedDB is not supported in this browser")},so.prototype.makeTransaction=function(e,t){var n=this.storeName,r=function(i){return new qt(function(o,s){var u=i.transaction(n,e);u.oncomplete=function(){o(u)},u.onabort=u.onerror=function(){s(u.error)},t(u.objectStore(n))})};return this.dbPromise.then(r).catch((function(i){return i&&i.name==="InvalidStateError"?(this.dbPromise=this._openDb(),this.dbPromise.then(r)):qt.reject(i)}).bind(this))},so.prototype.setItem=function(e,t){return this.makeTransaction("readwrite",function(n){n.put(t,e)})},so.prototype.getItem=function(e){var t;return this.makeTransaction("readonly",function(n){t=n.get(e)}).then(function(){return t.result})},so.prototype.removeItem=function(e){return this.makeTransaction("readwrite",function(t){t.delete(e)})},so.prototype.getAll=function(){var e;return this.makeTransaction("readonly",function(t){e=t.getAll()}).then(function(){return e.result})};var yV="__mp_opt_in_out_";function _V(e,t){SO(!0,e,t)}function bV(e,t){SO(!1,e,t)}function SV(e,t){return bO(e,t)==="1"}function _O(e,t){if(xV(t))return Ut.warn('This browser has "Do Not Track" enabled. This will prevent the Mixpanel SDK from sending any data. To ignore the "Do Not Track" browser setting, initialize the Mixpanel instance with the config "ignore_dnt: true"'),!0;var n=bO(e,t)==="0";return n&&Ut.warn("You are opted out of Mixpanel tracking. This will prevent the Mixpanel SDK from sending any data."),n}function La(e){return Ub(e,function(t){return this.get_config(t)})}function Na(e){return Ub(e,function(t){return this._get_config(t)})}function Wl(e){return Ub(e,function(t){return this._get_config(t)})}function wV(e,t){t=t||{},Bb(t).remove(Fb(e,t),!!t.crossSubdomainCookie,t.cookieDomain)}function Bb(e){return e=e||{},e.persistenceType==="localStorage"?I.localStorage:I.cookie}function Fb(e,t){return t=t||{},(t.persistencePrefix||yV)+e}function bO(e,t){return Bb(t).get(Fb(e,t))}function xV(e){if(e&&e.ignoreDnt)return!1;var t=e&&e.window||Ue,n=t.navigator||{},r=!1;return I.each([n.doNotTrack,n.msDoNotTrack,t.doNotTrack],function(i){I.includes([!0,1,"1","yes"],i)&&(r=!0)}),r}function SO(e,t,n){if(!I.isString(t)||!t.length){Ut.error("gdpr."+(e?"optIn":"optOut")+" called with an invalid token");return}n=n||{},Bb(n).set(Fb(t,n),e?1:0,I.isNumber(n.cookieExpiration)?n.cookieExpiration:null,!!n.crossSubdomainCookie,!!n.secureCookie,!!n.crossSiteCookie,n.cookieDomain),n.track&&e&&n.track(n.trackEventName||"$opt_in",n.trackProperties,{send_immediately:!0})}function Ub(e,t){return function(){var n=!1;try{var r=t.call(this,"token"),i=t.call(this,"ignore_dnt"),o=t.call(this,"opt_out_tracking_persistence_type"),s=t.call(this,"opt_out_tracking_cookie_prefix"),u=t.call(this,"window");r&&(n=_O(r,{ignoreDnt:i,persistenceType:o,persistencePrefix:s,window:u}))}catch(d){Ut.error("Unexpected error when checking tracking opt-out status: "+d)}if(!n)return e.apply(this,arguments);var c=arguments[arguments.length-1];typeof c=="function"&&c(0)}}var CV=Zl("lock"),wO=function(e,t){t=t||{},this.storageKey=e,this.storage=t.storage||Ue.localStorage,this.pollIntervalMS=t.pollIntervalMS||100,this.timeoutMS=t.timeoutMS||2e3,this.promiseImpl=t.promiseImpl||qt};wO.prototype.withLock=function(e,t){var n=this.promiseImpl;return new n(I.bind(function(r,i){var o=t||new Date().getTime()+"|"+Math.random(),s=new Date().getTime(),u=this.storageKey,c=this.pollIntervalMS,d=this.timeoutMS,p=this.storage,h=u+":X",m=u+":Y",v=u+":Z",_=function(E){if(new Date().getTime()-s>d){CV.error("Timeout waiting for mutex on "+u+"; clearing lock. ["+o+"]"),p.removeItem(v),p.removeItem(m),w();return}setTimeout(function(){try{E()}catch(R){i(R)}},c*(Math.random()+.1))},x=function(E,R){E()?R():_(function(){x(E,R)})},b=function(){var E=p.getItem(m);return E&&E!==o?!1:(p.setItem(m,o),p.getItem(m)===o?!0:(cf(p,!0)||i(new Error("localStorage support dropped while acquiring lock")),!1))},w=function(){p.setItem(h,o),x(b,function(){if(p.getItem(h)===o){C();return}_(function(){if(p.getItem(m)!==o){w();return}x(function(){return!p.getItem(v)},C)})})},C=function(){p.setItem(v,"1");var E=function(){p.removeItem(v),p.getItem(m)===o&&p.removeItem(m),p.getItem(h)===o&&p.removeItem(h)};e().then(function(R){E(),r(R)}).catch(function(R){E(),i(R)})};try{if(cf(p,!0))w();else throw new Error("localStorage support check failed")}catch(E){i(E)}},this))};var ff=function(e){this.storage=e||Ue.localStorage};ff.prototype.init=function(){return qt.resolve()},ff.prototype.setItem=function(e,t){return new qt(I.bind(function(n,r){try{this.storage.setItem(e,Yl(t))}catch(i){r(i)}n()},this))},ff.prototype.getItem=function(e){return new qt(I.bind(function(t,n){var r;try{r=Lp(this.storage.getItem(e))}catch(i){n(i)}t(r)},this))},ff.prototype.removeItem=function(e){return new qt(I.bind(function(t,n){try{this.storage.removeItem(e)}catch(r){n(r)}t()},this))};var xO=Zl("batch"),lo=function(e,t){t=t||{},this.storageKey=e,this.usePersistence=t.usePersistence,this.usePersistence&&(this.queueStorage=t.queueStorage||new ff,this.lock=new wO(e,{storage:t.sharedLockStorage||Ue.localStorage,timeoutMS:t.sharedLockTimeoutMS})),this.reportError=t.errorReporter||I.bind(xO.error,xO),this.pid=t.pid||null,this.memQueue=[],this.initialized=!1,t.enqueueThrottleMs?this.enqueuePersisted=fV(I.bind(this._enqueuePersisted,this),t.enqueueThrottleMs):this.enqueuePersisted=I.bind(function(n){return this._enqueuePersisted([n])},this)};lo.prototype.ensureInit=function(){return this.initialized?qt.resolve():this.queueStorage.init().then(I.bind(function(){this.initialized=!0},this)).catch(I.bind(function(e){this.reportError("Error initializing queue persistence. Disabling persistence",e),this.initialized=!0,this.usePersistence=!1},this))},lo.prototype.enqueue=function(e,t){var n={id:Nb(),flushAfter:new Date().getTime()+t*2,payload:e};return this.usePersistence?this.enqueuePersisted(n):(this.memQueue.push(n),qt.resolve(!0))},lo.prototype._enqueuePersisted=function(e){var t=I.bind(function(){return this.ensureInit().then(I.bind(function(){return this.readFromStorage()},this)).then(I.bind(function(n){return this.saveToStorage(n.concat(e))},this)).then(I.bind(function(n){return n&&(this.memQueue=this.memQueue.concat(e)),n},this)).catch(I.bind(function(n){return this.reportError("Error enqueueing items",n,e),!1},this))},this);return this.lock.withLock(t,this.pid).catch(I.bind(function(n){return this.reportError("Error acquiring storage lock",n),!1},this))},lo.prototype.fillBatch=function(e){var t=this.memQueue.slice(0,e);return this.usePersistence&&t.length<e?this.ensureInit().then(I.bind(function(){return this.readFromStorage()},this)).then(I.bind(function(n){if(n.length){var r={};I.each(t,function(s){r[s.id]=!0});for(var i=0;i<n.length;i++){var o=n[i];if(new Date().getTime()>o.flushAfter&&!r[o.id]&&(o.orphaned=!0,t.push(o),t.length>=e))break}}return t},this)):qt.resolve(t)};var CO=function(e,t){var n=[];return I.each(e,function(r){r.id&&!t[r.id]&&n.push(r)}),n};lo.prototype.removeItemsByID=function(e){var t={};if(I.each(e,function(r){t[r]=!0}),this.memQueue=CO(this.memQueue,t),this.usePersistence){var n=I.bind(function(){return this.ensureInit().then(I.bind(function(){return this.readFromStorage()},this)).then(I.bind(function(r){return r=CO(r,t),this.saveToStorage(r)},this)).then(I.bind(function(){return this.readFromStorage()},this)).then(I.bind(function(r){for(var i=0;i<r.length;i++){var o=r[i];if(o.id&&t[o.id])throw new Error("Item not removed from storage")}return!0},this)).catch(I.bind(function(r){return this.reportError("Error removing items",r,e),!1},this))},this);return this.lock.withLock(n,this.pid).catch(I.bind(function(r){return this.reportError("Error acquiring storage lock",r),cf(this.lock.storage,!0)?!1:n().then(I.bind(function(i){return i||this.queueStorage.removeItem(this.storageKey).then(function(){return i})},this)).catch(I.bind(function(i){return this.reportError("Error clearing queue",i),!1},this))},this))}else return qt.resolve(!0)};var EO=function(e,t){var n=[];return I.each(e,function(r){var i=r.id;if(i in t){var o=t[i];o!==null&&(r.payload=o,n.push(r))}else n.push(r)}),n};lo.prototype.updatePayloads=function(e){return this.memQueue=EO(this.memQueue,e),this.usePersistence?this.lock.withLock(I.bind(function(){return this.ensureInit().then(I.bind(function(){return this.readFromStorage()},this)).then(I.bind(function(n){return n=EO(n,e),this.saveToStorage(n)},this)).catch(I.bind(function(n){return this.reportError("Error updating items",e,n),!1},this))},this),this.pid).catch(I.bind(function(t){return this.reportError("Error acquiring storage lock",t),!1},this)):qt.resolve(!0)},lo.prototype.readFromStorage=function(){return this.ensureInit().then(I.bind(function(){return this.queueStorage.getItem(this.storageKey)},this)).then(I.bind(function(e){return e&&(I.isArray(e)||(this.reportError("Invalid storage entry:",e),e=null)),e||[]},this)).catch(I.bind(function(e){return this.reportError("Error retrieving queue",e),[]},this))},lo.prototype.saveToStorage=function(e){return this.ensureInit().then(I.bind(function(){return this.queueStorage.setItem(this.storageKey,e)},this)).then(function(){return!0}).catch(I.bind(function(t){return this.reportError("Error saving queue",t),!1},this))},lo.prototype.clear=function(){return this.memQueue=[],this.usePersistence?this.ensureInit().then(I.bind(function(){return this.queueStorage.removeItem(this.storageKey)},this)):qt.resolve()};var EV=10*60*1e3,df=Zl("batch"),mi=function(e,t){this.errorReporter=t.errorReporter,this.queue=new lo(e,{errorReporter:I.bind(this.reportError,this),queueStorage:t.queueStorage,sharedLockStorage:t.sharedLockStorage,sharedLockTimeoutMS:t.sharedLockTimeoutMS,usePersistence:t.usePersistence,enqueueThrottleMs:t.enqueueThrottleMs}),this.libConfig=t.libConfig,this.sendRequest=t.sendRequestFunc,this.beforeSendHook=t.beforeSendHook,this.stopAllBatching=t.stopAllBatchingFunc,this.batchSize=this.libConfig.batch_size,this.flushInterval=this.libConfig.batch_flush_interval_ms,this.stopped=!this.libConfig.batch_autostart,this.consecutiveRemovalFailures=0,this.itemIdsSentSuccessfully={},this.flushOnlyOnInterval=t.flushOnlyOnInterval||!1,this._flushPromise=null};mi.prototype.enqueue=function(e){return this.queue.enqueue(e,this.flushInterval)},mi.prototype.start=function(){return this.stopped=!1,this.consecutiveRemovalFailures=0,this.flush()},mi.prototype.stop=function(){this.stopped=!0,this.timeoutID&&(clearTimeout(this.timeoutID),this.timeoutID=null)},mi.prototype.clear=function(){return this.queue.clear()},mi.prototype.resetBatchSize=function(){this.batchSize=this.libConfig.batch_size},mi.prototype.resetFlush=function(){this.scheduleFlush(this.libConfig.batch_flush_interval_ms)},mi.prototype.scheduleFlush=function(e){this.flushInterval=e,this.stopped||(this.timeoutID=setTimeout(I.bind(function(){this.stopped||(this._flushPromise=this.flush())},this),this.flushInterval))},mi.prototype.sendRequestPromise=function(e,t){return new qt(I.bind(function(n){this.sendRequest(e,t,n)},this))},mi.prototype.flush=function(e){if(this.requestInProgress)return df.log("Flush: Request already in progress"),qt.resolve();this.requestInProgress=!0,e=e||{};var t=this.libConfig.batch_request_timeout_ms,n=new Date().getTime(),r=this.batchSize;return this.queue.fillBatch(r).then(I.bind(function(i){var o=i.length===r,s=[],u={};if(I.each(i,function(h){var m=h.payload;if(this.beforeSendHook&&!h.orphaned&&(m=this.beforeSendHook(m)),m){m.event&&m.properties&&(m.properties=I.extend({},m.properties,{mp_sent_by_lib_version:qi.LIB_VERSION}));var v=!0,_=h.id;_?(this.itemIdsSentSuccessfully[_]||0)>5&&(this.reportError("[dupe] item ID sent too many times, not sending",{item:h,batchSize:i.length,timesSent:this.itemIdsSentSuccessfully[_]}),v=!1):this.reportError("[dupe] found item with no ID",{item:h}),v&&s.push(m)}u[h.id]=m},this),s.length<1)return this.requestInProgress=!1,this.resetFlush(),qt.resolve();var c=I.bind(function(){return this.queue.removeItemsByID(I.map(i,function(h){return h.id})).then(I.bind(function(h){return I.each(i,I.bind(function(m){var v=m.id;v?(this.itemIdsSentSuccessfully[v]=this.itemIdsSentSuccessfully[v]||0,this.itemIdsSentSuccessfully[v]++,this.itemIdsSentSuccessfully[v]>5&&this.reportError("[dupe] item ID sent too many times",{item:m,batchSize:i.length,timesSent:this.itemIdsSentSuccessfully[v]})):this.reportError("[dupe] found item with no ID while removing",{item:m})},this)),h?(this.consecutiveRemovalFailures=0,this.flushOnlyOnInterval&&!o?(this.resetFlush(),qt.resolve()):this.flush()):(++this.consecutiveRemovalFailures>5?(this.reportError("Too many queue failures; disabling batching system."),this.stopAllBatching()):this.resetFlush(),qt.resolve())},this))},this),d=I.bind(function(h){this.requestInProgress=!1;try{if(e.unloading)return this.queue.updatePayloads(u);if(I.isObject(h)&&h.error==="timeout"&&new Date().getTime()-n>=t)return this.reportError("Network timeout; retrying"),this.flush();if(I.isObject(h)&&(h.httpStatusCode>=500||h.httpStatusCode===429||h.httpStatusCode<=0&&!pV()||h.error==="timeout")){var m=this.flushInterval*2;return h.retryAfter&&(m=parseInt(h.retryAfter,10)*1e3||m),m=Math.min(EV,m),this.reportError("Error; retry in "+m+" ms"),this.scheduleFlush(m),qt.resolve()}else if(I.isObject(h)&&h.httpStatusCode===413)if(i.length>1){var v=Math.max(1,Math.floor(r/2));return this.batchSize=Math.min(this.batchSize,v,i.length-1),this.reportError("413 response; reducing batch size to "+this.batchSize),this.resetFlush(),qt.resolve()}else return this.reportError("Single-event request too large; dropping",i),this.resetBatchSize(),c();else return c()}catch(_){this.reportError("Error handling API response",_),this.resetFlush()}},this),p={method:"POST",verbose:!0,ignore_json_errors:!0,timeout_ms:t};return e.unloading&&(p.transport="sendBeacon"),df.log("MIXPANEL REQUEST:",s),this.sendRequestPromise(s,p).then(d)},this)).catch(I.bind(function(i){this.reportError("Error flushing request queue",i),this.resetFlush()},this))},mi.prototype.reportError=function(e,t){if(df.error.apply(df.error,arguments),this.errorReporter)try{t instanceof Error||(t=new Error(e)),this.errorReporter(e,t)}catch(n){df.error(n)}};var zb=function(e){var t=Date.now();return!e||t>e.maxExpires||t>e.idleExpires},kV=250,Kl=Zl("recorder"),kO=Ue.CompressionStream,AV={batch_size:1e3,batch_flush_interval_ms:10*1e3,batch_request_timeout_ms:90*1e3,batch_autostart:!0},IV=new Set([ft.MouseMove,ft.MouseInteraction,ft.Scroll,ft.ViewportResize,ft.Input,ft.TouchMove,ft.MediaInteraction,ft.Drag,ft.Selection]);function RV(e){return e.type===Dt.IncrementalSnapshot&&IV.has(e.data.source)}var xr=function(e){this._mixpanel=e.mixpanelInstance,this._onIdleTimeout=e.onIdleTimeout||$a,this._onMaxLengthReached=e.onMaxLengthReached||$a,this._onBatchSent=e.onBatchSent||$a,this._rrwebRecord=e.rrwebRecord||null,this._stopRecording=null,this.replayId=e.replayId,this.batchStartUrl=e.batchStartUrl||null,this.replayStartUrl=e.replayStartUrl||null,this.idleExpires=e.idleExpires||null,this.maxExpires=e.maxExpires||null,this.replayStartTime=e.replayStartTime||null,this.seqNo=e.seqNo||0,this.idleTimeoutId=null,this.maxTimeoutId=null,this.recordMaxMs=lf,this.recordMinMs=0;var t=cf(e.sharedLockStorage,!0);this.batcherKey="__mprec_"+this.getConfig("name")+"_"+this.getConfig("token")+"_"+this.replayId,this.queueStorage=new so(yO),this.batcher=new mi(this.batcherKey,{errorReporter:this.reportError.bind(this),flushOnlyOnInterval:!0,libConfig:AV,sendRequestFunc:this.flushEventsWithOptOut.bind(this),queueStorage:this.queueStorage,sharedLockStorage:e.sharedLockStorage,usePersistence:t,stopAllBatchingFunc:this.stopRecording.bind(this),enqueueThrottleMs:kV,sharedLockTimeoutMS:10*1e3})};xr.prototype.unloadPersistedData=function(){return this.batcher.stop(),this.batcher.flush().then((function(){return this.queueStorage.removeItem(this.batcherKey)}).bind(this))},xr.prototype.getConfig=function(e){return this._mixpanel.get_config(e)},xr.prototype.get_config=function(e){return this.getConfig(e)},xr.prototype.startRecording=function(e){if(this._rrwebRecord===null){this.reportError("rrweb record function not provided. ");return}if(this._stopRecording!==null){Kl.log("Recording already in progress, skipping startRecording.");return}this.recordMaxMs=this.getConfig("record_max_ms"),this.recordMaxMs>lf&&(this.recordMaxMs=lf,Kl.critical("record_max_ms cannot be greater than "+lf+"ms. Capping value.")),this.maxExpires||(this.maxExpires=new Date().getTime()+this.recordMaxMs),this.recordMinMs=this.getConfig("record_min_ms"),this.recordMinMs>Rb&&(this.recordMinMs=Rb,Kl.critical("record_min_ms cannot be greater than "+Rb+"ms. Capping value.")),this.replayStartTime||(this.replayStartTime=new Date().getTime(),this.batchStartUrl=I.info.currentUrl(),this.replayStartUrl=I.info.currentUrl()),e||this.recordMinMs>0?this.batcher.stop():this.batcher.start();var t=(function(){clearTimeout(this.idleTimeoutId);var i=this.getConfig("record_idle_timeout_ms");this.idleTimeoutId=setTimeout(this._onIdleTimeout,i),this.idleExpires=new Date().getTime()+i}).bind(this);t();var n=this.getConfig("record_block_selector");(n===""||n===null)&&(n=void 0);try{this._stopRecording=this._rrwebRecord({emit:(function(i){if(this.idleExpires&&this.idleExpires<i.timestamp){this._onIdleTimeout();return}RV(i)&&(this.batcher.stopped&&new Date().getTime()-this.replayStartTime>=this.recordMinMs&&this.batcher.start(),t()),this.__enqueuePromise=this.batcher.enqueue(i)}).bind(this),blockClass:this.getConfig("record_block_class"),blockSelector:n,collectFonts:this.getConfig("record_collect_fonts"),dataURLOptions:{type:"image/webp",quality:.6},maskAllInputs:!0,maskTextClass:this.getConfig("record_mask_text_class"),maskTextSelector:this.getConfig("record_mask_text_selector"),recordCanvas:this.getConfig("record_canvas"),sampling:{canvas:15}})}catch(i){this.reportError("Unexpected error when starting rrweb recording.",i)}if(typeof this._stopRecording!="function"){this.reportError("rrweb failed to start, skipping this recording."),this._stopRecording=null,this.stopRecording();return}var r=this.maxExpires-new Date().getTime();this.maxTimeoutId=setTimeout(this._onMaxLengthReached.bind(this),r)},xr.prototype.stopRecording=function(e){if(!this.isRrwebStopped()){try{this._stopRecording()}catch(n){this.reportError("Error with rrweb stopRecording",n)}this._stopRecording=null}var t;return this.batcher.stopped?t=this.batcher.clear():e||(t=this.batcher.flush()),this.batcher.stop(),clearTimeout(this.idleTimeoutId),clearTimeout(this.maxTimeoutId),t},xr.prototype.isRrwebStopped=function(){return this._stopRecording===null},xr.prototype.flushEventsWithOptOut=function(e,t,n){var r=(function(i){i===0&&(this.stopRecording(),n({error:"Tracking has been opted out, stopping recording."}))}).bind(this);this._flushEvents(e,t,n,r)},xr.prototype.serialize=function(){var e;try{e=this._mixpanel.get_tab_id()}catch(t){this.reportError("Error getting tab ID for serialization ",t),e=null}return{replayId:this.replayId,seqNo:this.seqNo,replayStartTime:this.replayStartTime,batchStartUrl:this.batchStartUrl,replayStartUrl:this.replayStartUrl,idleExpires:this.idleExpires,maxExpires:this.maxExpires,tabId:e}},xr.deserialize=function(e,t){var n=new xr(I.extend({},t,{replayId:e.replayId,batchStartUrl:e.batchStartUrl,replayStartUrl:e.replayStartUrl,idleExpires:e.idleExpires,maxExpires:e.maxExpires,replayStartTime:e.replayStartTime,seqNo:e.seqNo,sharedLockStorage:t.sharedLockStorage}));return n},xr.prototype._sendRequest=function(e,t,n,r){var i=(function(o,s){o.status===200&&this.replayId===e&&(this.seqNo++,this.batchStartUrl=I.info.currentUrl()),this._onBatchSent(),r({status:0,httpStatusCode:o.status,responseBody:s,retryAfter:o.headers.get("Retry-After")})}).bind(this);Ue.fetch(this.getConfig("api_host")+"/"+this.getConfig("api_routes").record+"?"+new URLSearchParams(t),{method:"POST",headers:{Authorization:"Basic "+btoa(this.getConfig("token")+":"),"Content-Type":"application/octet-stream"},body:n}).then(function(o){o.json().then(function(s){i(o,s)}).catch(function(s){r({error:s})})}).catch(function(o){r({error:o,httpStatusCode:0})})},xr.prototype._flushEvents=La(function(e,t,n){var r=e.length;if(r>0){for(var i=this.replayId,o=1/0,s=-1/0,u=!1,c=0;c<r;c++)o=Math.min(o,e[c].timestamp),s=Math.max(s,e[c].timestamp),e[c].type===Dt.FullSnapshot&&(u=!0);if(this.seqNo===0){if(!u){n({error:"First batch does not contain a full snapshot. Aborting recording."}),this.stopRecording(!0);return}this.replayStartTime=o}else this.replayStartTime||(this.reportError("Replay start time not set but seqNo is not 0. Using current batch start time as a fallback."),this.replayStartTime=o);var d=s-this.replayStartTime,p={$current_url:this.batchStartUrl,$lib_version:qi.LIB_VERSION,batch_start_time:o/1e3,distinct_id:String(this._mixpanel.get_distinct_id()),mp_lib:"web",replay_id:i,replay_length_ms:d,replay_start_time:this.replayStartTime/1e3,replay_start_url:this.replayStartUrl,seq:this.seqNo},h=JSON.stringify(e),m=this._mixpanel.get_property("$device_id");m&&(p.$device_id=m);var v=this._mixpanel.get_property("$user_id");if(v&&(p.$user_id=v),kO){var _=new Blob([h],{type:"application/json"}).stream(),x=_.pipeThrough(new kO("gzip"));new Response(x).blob().then((function(b){p.format="gzip",this._sendRequest(i,p,b,n)}).bind(this))}else p.format="body",this._sendRequest(i,p,h,n)}}),xr.prototype.reportError=function(e,t){Kl.error.apply(Kl.error,arguments);try{!t&&!(e instanceof Error)&&(e=new Error(e)),this.getConfig("error_reporter")(e,t)}catch(n){Kl.error(n)}};var Ql=function(e){this.idb=new so(Pb),this.errorReporter=e.errorReporter,this.mixpanelInstance=e.mixpanelInstance,this.sharedLockStorage=e.sharedLockStorage};Ql.prototype.handleError=function(e){this.errorReporter("IndexedDB error: ",e)},Ql.prototype.setActiveRecording=function(e){var t=e.tabId;return t?this.idb.init().then((function(){return this.idb.setItem(t,e)}).bind(this)).catch(this.handleError.bind(this)):(console.warn("No tab ID is set, cannot persist recording metadata."),qt.resolve())},Ql.prototype.getActiveRecording=function(){return this.idb.init().then((function(){return this.idb.getItem(this.mixpanelInstance.get_tab_id())}).bind(this)).then((function(e){return zb(e)?null:e}).bind(this)).catch(this.handleError.bind(this))},Ql.prototype.clearActiveRecording=function(){return this.getActiveRecording().then((function(e){if(e)return e.maxExpires=0,this.setActiveRecording(e)}).bind(this)).catch(this.handleError.bind(this))},Ql.prototype.flushInactiveRecordings=function(){return this.idb.init().then((function(){return this.idb.getAll()}).bind(this)).then((function(e){var t=e.filter(function(n){return zb(n)}).map((function(n){var r=xr.deserialize(n,{mixpanelInstance:this.mixpanelInstance,sharedLockStorage:this.sharedLockStorage});return r.unloadPersistedData().then((function(){return this.idb.removeItem(n.tabId)}).bind(this)).catch(this.handleError.bind(this))}).bind(this));return qt.all(t)}).bind(this)).catch(this.handleError.bind(this))};var hf=Zl("recorder"),jo=function(e,t,n){this.mixpanelInstance=e,this.rrwebRecord=t||Ra,this.sharedLockStorage=n,this.recordingRegistry=new Ql({mixpanelInstance:this.mixpanelInstance,errorReporter:hf.error,sharedLockStorage:n}),this._flushInactivePromise=this.recordingRegistry.flushInactiveRecordings(),this.activeRecording=null};jo.prototype.startRecording=function(e){if(e=e||{},this.activeRecording&&!this.activeRecording.isRrwebStopped()){hf.log("Recording already in progress, skipping startRecording.");return}var t=(function(){hf.log("Idle timeout reached, restarting recording."),this.resetRecording()}).bind(this),n=(function(){hf.log("Max recording length reached, stopping recording."),this.resetRecording()}).bind(this),r=(function(){this.recordingRegistry.setActiveRecording(this.activeRecording.serialize()),this.__flushPromise=this.activeRecording.batcher._flushPromise}).bind(this),i={mixpanelInstance:this.mixpanelInstance,onBatchSent:r,onIdleTimeout:t,onMaxLengthReached:n,replayId:I.UUID(),rrwebRecord:this.rrwebRecord,sharedLockStorage:this.sharedLockStorage};return e.activeSerializedRecording?this.activeRecording=xr.deserialize(e.activeSerializedRecording,i):this.activeRecording=new xr(i),this.activeRecording.startRecording(e.shouldStopBatcher),this.recordingRegistry.setActiveRecording(this.activeRecording.serialize())},jo.prototype.stopRecording=function(){var e=this._stopCurrentRecording(!1);return this.recordingRegistry.clearActiveRecording(),this.activeRecording=null,e},jo.prototype.pauseRecording=function(){return this._stopCurrentRecording(!1)},jo.prototype._stopCurrentRecording=function(e){return this.activeRecording?this.activeRecording.stopRecording(e):qt.resolve()},jo.prototype.resumeRecording=function(e){return this.activeRecording&&this.activeRecording.isRrwebStopped()?(this.activeRecording.startRecording(!1),qt.resolve(null)):this.recordingRegistry.getActiveRecording().then((function(t){return t?this.startRecording({activeSerializedRecording:t}):e?this.startRecording({shouldStopBatcher:!1}):(hf.log("No resumable recording found."),null)}).bind(this))},jo.prototype.resetRecording=function(){this.stopRecording(),this.startRecording({shouldStopBatcher:!0})},jo.prototype.getActiveReplayId=function(){return this.activeRecording&&!this.activeRecording.isRrwebStopped()?this.activeRecording.replayId:null},Object.defineProperty(jo.prototype,"replayId",{get:function(){return this.getActiveReplayId()}}),Ue.__mp_recorder=jo;var Np="change",pf="click",AO="hashchange",Xl="mp_locationchange",IO="popstate",RO="scrollend",qb="submit",OV=["clientX","clientY","offsetX","offsetY","pageX","pageY","screenX","screenY","x","y"],OO=["mp-include"],jb=["mp-no-track"],TO=jb.concat(["mp-sensitive"]),TV=["aria-label","aria-labelledby","aria-describedby","href","name","role","title","type"],Ur=Zl("autocapture");function Hb(e){for(var t={},n=MO(e).split(" "),r=0;r<n.length;r++){var i=n[r];i&&(t[i]=!0)}return t}function MO(e){switch(typeof e.className){case"string":return e.className;case"object":return e.className.baseVal||e.getAttribute("class")||"";default:return""}}function MV(e){if(e.previousElementSibling)return e.previousElementSibling;do e=e.previousSibling;while(e&&!LO(e));return e}function DO(e,t,n,r,i,o){var s={$classes:MO(e).split(" "),$tag_name:e.tagName.toLowerCase()},u=e.id;u&&(s.$id=u),Zb(e,t,i,o)&&I.each(TV.concat(r),function(h){if(e.hasAttribute(h)&&!n[h]){var m=e.getAttribute(h);Pp(m)&&(s["$attr-"+h]=m)}});for(var c=1,d=1,p=e;p=MV(p);)c++,p.tagName===e.tagName&&d++;return s.$nth_child=c,s.$nth_of_type=d,s}function DV(e,t){var n=t.allowElementCallback,r=t.allowSelectors||[],i=t.blockAttrs||[],o=t.blockElementCallback,s=t.blockSelectors||[],u=t.captureTextContent||!1,c=t.captureExtraAttrs||[],d={};I.each(i,function(R){d[R]=!0});var p=null,h=typeof e.target>"u"?e.srcElement:e.target;if(NO(h)&&(h=h.parentNode),NV(h,e)&&Gb(h,e,n,r)&&!Vb(h,e,o,s)){for(var m=[h],v=h;v.parentNode&&!uo(v,"body");)m.push(v.parentNode),v=v.parentNode;var _=[],x,b=!1;if(I.each(m,function(R){var O=Zb(R,e,n,r);!d.href&&R.tagName.toLowerCase()==="a"&&(x=R.getAttribute("href"),x=O&&Pp(x)&&x),Vb(R,e,o,s)&&(b=!0),_.push(DO(R,e,d,c,n,r))},this),!b){var w=Vt.documentElement;if(p={$event_type:e.type,$host:Ue.location.host,$pathname:Ue.location.pathname,$elements:_,$el_attr__href:x,$viewportHeight:Math.max(w.clientHeight,Ue.innerHeight||0),$viewportWidth:Math.max(w.clientWidth,Ue.innerWidth||0)},I.each(c,function(R){if(!d[R]&&h.hasAttribute(R)){var O=h.getAttribute(R);Pp(O)&&(p["$el_attr__"+R]=O)}}),u&&(C=$O(h,e,n,r),C&&C.length&&(p.$el_text=C)),e.type===pf&&(I.each(OV,function(R){R in e&&(p["$"+R]=e[R])}),h=$V(e)),u){var C=$O(h,e,n,r);C&&C.length&&(p.$el_text=C)}if(h){if(!Gb(h,e,n,r)||Vb(h,e,o,s))return null;var E=DO(h,e,d,c,n,r);p.$target=E,p.$el_classes=E.$classes,I.extend(p,I.strip_empty_properties({$el_id:E.$id,$el_tag_name:E.$tag_name}))}}}return p}function $O(e,t,n,r){var i="";return Zb(e,t,n,r)&&e.childNodes&&e.childNodes.length&&I.each(e.childNodes,function(o){NO(o)&&o.textContent&&(i+=I.trim(o.textContent).split(/(\s+)/).filter(Pp).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255))}),I.trim(i)}function $V(e){for(var t=e.target,n=e.composedPath(),r=0;r<n.length;r++){var i=n[r];if(uo(i,"a")||uo(i,"button")||uo(i,"input")||uo(i,"select")||i.getAttribute&&i.getAttribute("role")==="button"){t=i;break}if(i===t)break}return t}function Gb(e,t,n,r){if(n)try{if(!n(e,t))return!1}catch(s){return Ur.critical("Error while checking element in allowElementCallback",s),!1}if(!r.length)return!0;for(var i=0;i<r.length;i++){var o=r[i];try{if(e.matches(o))return!0}catch(s){Ur.critical("Error while checking selector: "+o,s)}}return!1}function Vb(e,t,n,r){var i;if(n)try{if(n(e,t))return!0}catch(u){return Ur.critical("Error while checking element in blockElementCallback",u),!0}if(r&&r.length)for(i=0;i<r.length;i++){var o=r[i];try{if(e.matches(o))return!0}catch(u){Ur.critical("Error while checking selector: "+o,u)}}var s=Hb(e);for(i=0;i<jb.length;i++)if(s[jb[i]])return!0;return!1}function LO(e){return e&&e.nodeType===1}function uo(e,t){return e&&e.tagName&&e.tagName.toLowerCase()===t.toLowerCase()}function NO(e){return e&&e.nodeType===3}function LV(){try{var e=Vt.createElement("div");return!!e.matches}catch{return!1}}function NV(e,t){if(!e||uo(e,"html")||!LO(e))return!1;var n=e.tagName.toLowerCase();switch(n){case"form":return t.type===qb;case"input":return["button","submit"].indexOf(e.getAttribute("type"))===-1?t.type===Np:t.type===pf;case"select":case"textarea":return t.type===Np;default:return t.type===pf}}function Zb(e,t,n,r){var i;if(!Gb(e,t,n,r))return!1;for(var o=e;o.parentNode&&!uo(o,"body");o=o.parentNode){var s=Hb(o);for(i=0;i<TO.length;i++)if(s[TO[i]])return!1}var u=Hb(e);for(i=0;i<OO.length;i++)if(u[OO[i]])return!0;if(uo(e,"input")||uo(e,"select")||uo(e,"textarea")||e.getAttribute("contenteditable")==="true")return!1;var c=e.type||"";if(typeof c=="string")switch(c.toLowerCase()){case"hidden":return!1;case"password":return!1}var d=e.name||e.id||"";if(typeof d=="string"){var p=/^cc|cardnum|ccnum|creditcard|csc|cvc|cvv|exp|pass|pwd|routing|seccode|securitycode|securitynum|socialsec|socsec|ssn/i;if(p.test(d.replace(/[^a-zA-Z0-9]/g,"")))return!1}return!0}function Pp(e){if(e===null||I.isUndefined(e))return!1;if(typeof e=="string"){e=I.trim(e);var t=/^(?:(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}))$/;if(t.test((e||"").replace(/[- ]/g,"")))return!1;var n=/(^\d{3}-?\d{2}-?\d{4}$)/;if(n.test(e))return!1}return!0}var PO="autocapture",PV="track_pageview",BO="full-url",BV="url-with-path-and-query-string",FV="url-with-path",UV="allow_element_callback",FO="allow_selectors",UO="allow_url_regexes",zO="block_attrs",qO="block_element_callback",jO="block_selectors",HO="block_url_regexes",GO="capture_extra_attrs",VO="capture_text_content",ZO="scroll_capture_all",YO="scroll_depth_percent_checkpoints",Yb="click",Wb="input",WO="pageview",Kb="scroll",Qb="submit",lr={};lr[FO]=[],lr[UO]=[],lr[zO]=[],lr[qO]=null,lr[jO]=[],lr[HO]=[],lr[GO]=[],lr[VO]=!1,lr[ZO]=!1,lr[YO]=[25,50,75,100],lr[Yb]=!0,lr[Wb]=!0,lr[WO]=BO,lr[Kb]=!0,lr[Qb]=!0;var Bp={$mp_autocapture:!0},zV="$mp_click",qV="$mp_input_change",jV="$mp_scroll",HV="$mp_submit",ei=function(e){this.mp=e};ei.prototype.init=function(){if(!LV()){Ur.critical("Autocapture unavailable: missing required DOM APIs");return}this.initPageviewTracking(),this.initClickTracking(),this.initInputTracking(),this.initScrollTracking(),this.initSubmitTracking()},ei.prototype.getFullConfig=function(){var e=this.mp.get_config(PO);return e?I.isObject(e)?I.extend({},lr,e):lr:{}},ei.prototype.getConfig=function(e){return this.getFullConfig()[e]},ei.prototype.currentUrlBlocked=function(){var e,t=I.info.currentUrl(),n=this.getConfig(UO)||[];if(n.length){var r=!1;for(e=0;e<n.length;e++){var i=n[e];try{if(t.match(i)){r=!0;break}}catch(s){return Ur.critical("Error while checking block URL regex: "+i,s),!0}}if(!r)return!0}var o=this.getConfig(HO)||[];if(!o||!o.length)return!1;for(e=0;e<o.length;e++)try{if(t.match(o[e]))return!0}catch(s){return Ur.critical("Error while checking block URL regex: "+o[e],s),!0}return!1},ei.prototype.pageviewTrackingConfig=function(){return this.mp.get_config(PO)?this.getConfig(WO):this.mp.get_config(PV)},ei.prototype.trackDomEvent=function(e,t){if(!this.currentUrlBlocked()){var n=DV(e,{allowElementCallback:this.getConfig(UV),allowSelectors:this.getConfig(FO),blockAttrs:this.getConfig(zO),blockElementCallback:this.getConfig(qO),blockSelectors:this.getConfig(jO),captureExtraAttrs:this.getConfig(GO),captureTextContent:this.getConfig(VO)});n&&(I.extend(n,Bp),this.mp.track(t,n))}},ei.prototype.initClickTracking=function(){Ue.removeEventListener(pf,this.listenerClick),this.getConfig(Yb)&&(Ur.log("Initializing click tracking"),this.listenerClick=Ue.addEventListener(pf,(function(e){this.getConfig(Yb)&&this.trackDomEvent(e,zV)}).bind(this)))},ei.prototype.initInputTracking=function(){Ue.removeEventListener(Np,this.listenerChange),this.getConfig(Wb)&&(Ur.log("Initializing input tracking"),this.listenerChange=Ue.addEventListener(Np,(function(e){this.getConfig(Wb)&&this.trackDomEvent(e,qV)}).bind(this)))},ei.prototype.initPageviewTracking=function(){if(Ue.removeEventListener(IO,this.listenerPopstate),Ue.removeEventListener(AO,this.listenerHashchange),Ue.removeEventListener(Xl,this.listenerLocationchange),!!this.pageviewTrackingConfig()){Ur.log("Initializing pageview tracking");var e="",t=!1;this.currentUrlBlocked()||(t=this.mp.track_pageview(Bp)),t&&(e=I.info.currentUrl()),this.listenerPopstate=Ue.addEventListener(IO,function(){Ue.dispatchEvent(new Event(Xl))}),this.listenerHashchange=Ue.addEventListener(AO,function(){Ue.dispatchEvent(new Event(Xl))});var n=Ue.history.pushState;typeof n=="function"&&(Ue.history.pushState=function(i,o,s){n.call(Ue.history,i,o,s),Ue.dispatchEvent(new Event(Xl))});var r=Ue.history.replaceState;typeof r=="function"&&(Ue.history.replaceState=function(i,o,s){r.call(Ue.history,i,o,s),Ue.dispatchEvent(new Event(Xl))}),this.listenerLocationchange=Ue.addEventListener(Xl,Db((function(){if(!this.currentUrlBlocked()){var i=I.info.currentUrl(),o=!1,s=i.split("#")[0].split("?")[0]!==e.split("#")[0].split("?")[0],u=this.pageviewTrackingConfig();if(u===BO?o=i!==e:u===BV?o=i.split("#")[0]!==e.split("#")[0]:u===FV&&(o=s),o){var c=this.mp.track_pageview(Bp);c&&(e=i),s&&(this.lastScrollCheckpoint=0,Ur.log("Path change: re-initializing scroll depth checkpoints"))}}}).bind(this)))}},ei.prototype.initScrollTracking=function(){Ue.removeEventListener(RO,this.listenerScroll),this.getConfig(Kb)&&(Ur.log("Initializing scroll tracking"),this.lastScrollCheckpoint=0,this.listenerScroll=Ue.addEventListener(RO,Db((function(){if(this.getConfig(Kb)&&!this.currentUrlBlocked()){var e=this.getConfig(ZO),t=(this.getConfig(YO)||[]).slice().sort(function(c,d){return c-d}),n=Ue.scrollY,r=I.extend({$scroll_top:n},Bp);try{var i=Vt.body.scrollHeight,o=Math.round(n/(i-Ue.innerHeight)*100);if(r.$scroll_height=i,r.$scroll_percentage=o,o>this.lastScrollCheckpoint)for(var s=0;s<t.length;s++){var u=t[s];o>=u&&this.lastScrollCheckpoint<u&&(r.$scroll_checkpoint=u,this.lastScrollCheckpoint=u,e=!0)}}catch(c){Ur.critical("Error while calculating scroll percentage",c)}e&&this.mp.track(jV,r)}}).bind(this))))},ei.prototype.initSubmitTracking=function(){Ue.removeEventListener(qb,this.listenerSubmit),this.getConfig(Qb)&&(Ur.log("Initializing submit tracking"),this.listenerSubmit=Ue.addEventListener(qb,(function(e){this.getConfig(Qb)&&this.trackDomEvent(e,HV)}).bind(this)))},aV(ei);var Ho=function(){};Ho.prototype.create_properties=function(){},Ho.prototype.event_handler=function(){},Ho.prototype.after_track_handler=function(){},Ho.prototype.init=function(e){return this.mp=e,this},Ho.prototype.track=function(e,t,n,r){var i=this,o=I.dom_query(e);if(o.length===0){Ut.error("The DOM query ("+e+") returned 0 elements");return}return I.each(o,function(s){I.register_event(s,this.override_event,function(u){var c={},d=i.create_properties(n,this),p=i.mp.get_config("track_links_timeout");i.event_handler(u,this,c),window.setTimeout(i.track_callback(r,d,c,!0),p),i.mp.track(t,d,i.track_callback(r,d,c))})},this),!0},Ho.prototype.track_callback=function(e,t,n,r){r=r||!1;var i=this;return function(){n.callback_fired||(n.callback_fired=!0,!(e&&e(r,t)===!1)&&i.after_track_handler(t,n,r))}},Ho.prototype.create_properties=function(e,t){var n;return typeof e=="function"?n=e(t):n=I.extend({},e),n};var Jl=function(){this.override_event="click"};I.inherit(Jl,Ho),Jl.prototype.create_properties=function(e,t){var n=Jl.superclass.create_properties.apply(this,arguments);return t.href&&(n.url=t.href),n},Jl.prototype.event_handler=function(e,t,n){n.new_tab=e.which===2||e.metaKey||e.ctrlKey||t.target==="_blank",n.href=t.href,n.new_tab||e.preventDefault()},Jl.prototype.after_track_handler=function(e,t){t.new_tab||setTimeout(function(){window.location=t.href},0)};var Fp=function(){this.override_event="submit"};I.inherit(Fp,Ho),Fp.prototype.event_handler=function(e,t,n){n.element=t,e.preventDefault()},Fp.prototype.after_track_handler=function(e,t){setTimeout(function(){t.element.submit()},0)};var Pa="$set",eu="$set_once",ji="$unset",Ls="$add",co="$append",Ns="$union",Go="$remove",GV="$delete",KO={set_action:function(e,t){var n={},r={};return I.isObject(e)?I.each(e,function(i,o){this._is_reserved_property(o)||(r[o]=i)},this):r[e]=t,n[Pa]=r,n},unset_action:function(e){var t={},n=[];return I.isArray(e)||(e=[e]),I.each(e,function(r){this._is_reserved_property(r)||n.push(r)},this),t[ji]=n,t},set_once_action:function(e,t){var n={},r={};return I.isObject(e)?I.each(e,function(i,o){this._is_reserved_property(o)||(r[o]=i)},this):r[e]=t,n[eu]=r,n},union_action:function(e,t){var n={},r={};return I.isObject(e)?I.each(e,function(i,o){this._is_reserved_property(o)||(r[o]=I.isArray(i)?i:[i])},this):r[e]=I.isArray(t)?t:[t],n[Ns]=r,n},append_action:function(e,t){var n={},r={};return I.isObject(e)?I.each(e,function(i,o){this._is_reserved_property(o)||(r[o]=i)},this):r[e]=t,n[co]=r,n},remove_action:function(e,t){var n={},r={};return I.isObject(e)?I.each(e,function(i,o){this._is_reserved_property(o)||(r[o]=i)},this):r[e]=t,n[Go]=r,n},delete_action:function(){var e={};return e[GV]="",e}},gn=function(){};I.extend(gn.prototype,KO),gn.prototype._init=function(e,t,n){this._mixpanel=e,this._group_key=t,this._group_id=n},gn.prototype.set=Wl(function(e,t,n){var r=this.set_action(e,t);return I.isObject(e)&&(n=t),this._send_request(r,n)}),gn.prototype.set_once=Wl(function(e,t,n){var r=this.set_once_action(e,t);return I.isObject(e)&&(n=t),this._send_request(r,n)}),gn.prototype.unset=Wl(function(e,t){var n=this.unset_action(e);return this._send_request(n,t)}),gn.prototype.union=Wl(function(e,t,n){I.isObject(e)&&(n=t);var r=this.union_action(e,t);return this._send_request(r,n)}),gn.prototype.delete=Wl(function(e){var t=this.delete_action();return this._send_request(t,e)}),gn.prototype.remove=Wl(function(e,t,n){var r=this.remove_action(e,t);return this._send_request(r,n)}),gn.prototype._send_request=function(e,t){e.$group_key=this._group_key,e.$group_id=this._group_id,e.$token=this._get_config("token");var n=I.encodeDates(e);return this._mixpanel._track_or_batch({type:"groups",data:n,endpoint:this._get_config("api_host")+"/"+this._get_config("api_routes").groups,batcher:this._mixpanel.request_batchers.groups},t)},gn.prototype._is_reserved_property=function(e){return e==="$group_key"||e==="$group_id"},gn.prototype._get_config=function(e){return this._mixpanel.get_config(e)},gn.prototype.toString=function(){return this._mixpanel.toString()+".group."+this._group_key+"."+this._group_id},gn.prototype.remove=gn.prototype.remove,gn.prototype.set=gn.prototype.set,gn.prototype.set_once=gn.prototype.set_once,gn.prototype.union=gn.prototype.union,gn.prototype.unset=gn.prototype.unset,gn.prototype.toString=gn.prototype.toString;var ht=function(){};I.extend(ht.prototype,KO),ht.prototype._init=function(e){this._mixpanel=e},ht.prototype.set=Na(function(e,t,n){var r=this.set_action(e,t);return I.isObject(e)&&(n=t),this._get_config("save_referrer")&&this._mixpanel.persistence.update_referrer_info(document.referrer),r[Pa]=I.extend({},I.info.people_properties(),r[Pa]),this._send_request(r,n)}),ht.prototype.set_once=Na(function(e,t,n){var r=this.set_once_action(e,t);return I.isObject(e)&&(n=t),this._send_request(r,n)}),ht.prototype.unset=Na(function(e,t){var n=this.unset_action(e);return this._send_request(n,t)}),ht.prototype.increment=Na(function(e,t,n){var r={},i={};return I.isObject(e)?(I.each(e,function(o,s){if(!this._is_reserved_property(s))if(isNaN(parseFloat(o))){Ut.error("Invalid increment value passed to mixpanel.people.increment - must be a number");return}else i[s]=o},this),n=t):(I.isUndefined(t)&&(t=1),i[e]=t),r[Ls]=i,this._send_request(r,n)}),ht.prototype.append=Na(function(e,t,n){I.isObject(e)&&(n=t);var r=this.append_action(e,t);return this._send_request(r,n)}),ht.prototype.remove=Na(function(e,t,n){I.isObject(e)&&(n=t);var r=this.remove_action(e,t);return this._send_request(r,n)}),ht.prototype.union=Na(function(e,t,n){I.isObject(e)&&(n=t);var r=this.union_action(e,t);return this._send_request(r,n)}),ht.prototype.track_charge=Na(function(e,t,n){if(!I.isNumber(e)&&(e=parseFloat(e),isNaN(e))){Ut.error("Invalid value passed to mixpanel.people.track_charge - must be a number");return}return this.append("$transactions",I.extend({$amount:e},t),n)}),ht.prototype.clear_charges=function(e){return this.set("$transactions",[],e)},ht.prototype.delete_user=function(){if(!this._identify_called()){Ut.error("mixpanel.people.delete_user() requires you to call identify() first");return}var e={$delete:this._mixpanel.get_distinct_id()};return this._send_request(e)},ht.prototype.toString=function(){return this._mixpanel.toString()+".people"},ht.prototype._send_request=function(e,t){e.$token=this._get_config("token"),e.$distinct_id=this._mixpanel.get_distinct_id();var n=this._mixpanel.get_property("$device_id"),r=this._mixpanel.get_property("$user_id"),i=this._mixpanel.get_property("$had_persisted_distinct_id");n&&(e.$device_id=n),r&&(e.$user_id=r),i&&(e.$had_persisted_distinct_id=i);var o=I.encodeDates(e);return this._identify_called()?this._mixpanel._track_or_batch({type:"people",data:o,endpoint:this._get_config("api_host")+"/"+this._get_config("api_routes").engage,batcher:this._mixpanel.request_batchers.people},t):(this._enqueue(e),I.isUndefined(t)||(this._get_config("verbose")?t({status:-1,error:null}):t(-1)),I.truncate(o,255))},ht.prototype._get_config=function(e){return this._mixpanel.get_config(e)},ht.prototype._identify_called=function(){return this._mixpanel._flags.identify_called===!0},ht.prototype._enqueue=function(e){Pa in e?this._mixpanel.persistence._add_to_people_queue(Pa,e):eu in e?this._mixpanel.persistence._add_to_people_queue(eu,e):ji in e?this._mixpanel.persistence._add_to_people_queue(ji,e):Ls in e?this._mixpanel.persistence._add_to_people_queue(Ls,e):co in e?this._mixpanel.persistence._add_to_people_queue(co,e):Go in e?this._mixpanel.persistence._add_to_people_queue(Go,e):Ns in e?this._mixpanel.persistence._add_to_people_queue(Ns,e):Ut.error("Invalid call to _enqueue():",e)},ht.prototype._flush_one_queue=function(e,t,n,r){var i=this,o=I.extend({},this._mixpanel.persistence.load_queue(e)),s=o;!I.isUndefined(o)&&I.isObject(o)&&!I.isEmptyObject(o)&&(i._mixpanel.persistence._pop_from_people_queue(e,o),i._mixpanel.persistence.save(),r&&(s=r(o)),t.call(i,s,function(u,c){u===0&&i._mixpanel.persistence._add_to_people_queue(e,o),I.isUndefined(n)||n(u,c)}))},ht.prototype._flush=function(e,t,n,r,i,o,s){var u=this;this._flush_one_queue(Pa,this.set,e),this._flush_one_queue(eu,this.set_once,r),this._flush_one_queue(ji,this.unset,o,function(b){return I.keys(b)}),this._flush_one_queue(Ls,this.increment,t),this._flush_one_queue(Ns,this.union,i);var c=this._mixpanel.persistence.load_queue(co);if(!I.isUndefined(c)&&I.isArray(c)&&c.length)for(var d,p=function(b,w){b===0&&u._mixpanel.persistence._add_to_people_queue(co,d),I.isUndefined(n)||n(b,w)},h=c.length-1;h>=0;h--)c=this._mixpanel.persistence.load_queue(co),d=c.pop(),u._mixpanel.persistence.save(),I.isEmptyObject(d)||u.append(d,p);var m=this._mixpanel.persistence.load_queue(Go);if(!I.isUndefined(m)&&I.isArray(m)&&m.length)for(var v,_=function(b,w){b===0&&u._mixpanel.persistence._add_to_people_queue(Go,v),I.isUndefined(s)||s(b,w)},x=m.length-1;x>=0;x--)m=this._mixpanel.persistence.load_queue(Go),v=m.pop(),u._mixpanel.persistence.save(),I.isEmptyObject(v)||u.remove(v,_)},ht.prototype._is_reserved_property=function(e){return e==="$distinct_id"||e==="$token"||e==="$device_id"||e==="$user_id"||e==="$had_persisted_distinct_id"},ht.prototype.set=ht.prototype.set,ht.prototype.set_once=ht.prototype.set_once,ht.prototype.unset=ht.prototype.unset,ht.prototype.increment=ht.prototype.increment,ht.prototype.append=ht.prototype.append,ht.prototype.remove=ht.prototype.remove,ht.prototype.union=ht.prototype.union,ht.prototype.track_charge=ht.prototype.track_charge,ht.prototype.clear_charges=ht.prototype.clear_charges,ht.prototype.delete_user=ht.prototype.delete_user,ht.prototype.toString=ht.prototype.toString;var Xb="__mps",Jb="__mpso",e1="__mpus",t1="__mpa",n1="__mpap",r1="__mpr",i1="__mpu",QO="$people_distinct_id",Up="__alias",gf="__timers",VV=[Xb,Jb,e1,t1,n1,r1,i1,QO,Up,gf],xt=function(e){this.props={},this.campaign_params_saved=!1,e.persistence_name?this.name="mp_"+e.persistence_name:this.name="mp_"+e.token+"_mixpanel";var t=e.persistence;t!=="cookie"&&t!=="localStorage"&&(Ut.critical("Unknown persistence type "+t+"; falling back to cookie"),t=e.persistence="cookie"),t==="localStorage"&&I.localStorage.is_supported()?this.storage=I.localStorage:this.storage=I.cookie,this.load(),this.update_config(e),this.upgrade(),this.save()};xt.prototype.properties=function(){var e={};return this.load(),I.each(this.props,function(t,n){I.include(VV,n)||(e[n]=t)}),e},xt.prototype.load=function(){if(!this.disabled){var e=this.storage.parse(this.name);e&&(this.props=I.extend({},e))}},xt.prototype.upgrade=function(){var e,t;this.storage===I.localStorage?(e=I.cookie.parse(this.name),I.cookie.remove(this.name),I.cookie.remove(this.name,!0),e&&this.register_once(e)):this.storage===I.cookie&&(t=I.localStorage.parse(this.name),I.localStorage.remove(this.name),t&&this.register_once(t))},xt.prototype.save=function(){this.disabled||this.storage.set(this.name,Yl(this.props),this.expire_days,this.cross_subdomain,this.secure,this.cross_site,this.cookie_domain)},xt.prototype.load_prop=function(e){return this.load(),this.props[e]},xt.prototype.remove=function(){this.storage.remove(this.name,!1,this.cookie_domain),this.storage.remove(this.name,!0,this.cookie_domain)},xt.prototype.clear=function(){this.remove(),this.props={}},xt.prototype.register_once=function(e,t,n){return I.isObject(e)?(typeof t>"u"&&(t="None"),this.expire_days=typeof n>"u"?this.default_expiry:n,this.load(),I.each(e,function(r,i){(!this.props.hasOwnProperty(i)||this.props[i]===t)&&(this.props[i]=r)},this),this.save(),!0):!1},xt.prototype.register=function(e,t){return I.isObject(e)?(this.expire_days=typeof t>"u"?this.default_expiry:t,this.load(),I.extend(this.props,e),this.save(),!0):!1},xt.prototype.unregister=function(e){this.load(),e in this.props&&(delete this.props[e],this.save())},xt.prototype.update_search_keyword=function(e){this.register(I.info.searchInfo(e))},xt.prototype.update_referrer_info=function(e){this.register_once({$initial_referrer:e||"$direct",$initial_referring_domain:I.info.referringDomain(e)||"$direct"},"")},xt.prototype.get_referrer_info=function(){return I.strip_empty_properties({$initial_referrer:this.props.$initial_referrer,$initial_referring_domain:this.props.$initial_referring_domain})},xt.prototype.update_config=function(e){this.default_expiry=this.expire_days=e.cookie_expiration,this.set_disabled(e.disable_persistence),this.set_cookie_domain(e.cookie_domain),this.set_cross_site(e.cross_site_cookie),this.set_cross_subdomain(e.cross_subdomain_cookie),this.set_secure(e.secure_cookie)},xt.prototype.set_disabled=function(e){this.disabled=e,this.disabled?this.remove():this.save()},xt.prototype.set_cookie_domain=function(e){e!==this.cookie_domain&&(this.remove(),this.cookie_domain=e,this.save())},xt.prototype.set_cross_site=function(e){e!==this.cross_site&&(this.cross_site=e,this.remove(),this.save())},xt.prototype.set_cross_subdomain=function(e){e!==this.cross_subdomain&&(this.cross_subdomain=e,this.remove(),this.save())},xt.prototype.get_cross_subdomain=function(){return this.cross_subdomain},xt.prototype.set_secure=function(e){e!==this.secure&&(this.secure=!!e,this.remove(),this.save())},xt.prototype._add_to_people_queue=function(e,t){var n=this._get_queue_key(e),r=t[e],i=this._get_or_create_queue(Pa),o=this._get_or_create_queue(eu),s=this._get_or_create_queue(ji),u=this._get_or_create_queue(Ls),c=this._get_or_create_queue(Ns),d=this._get_or_create_queue(Go,[]),p=this._get_or_create_queue(co,[]);n===Xb?(I.extend(i,r),this._pop_from_people_queue(Ls,r),this._pop_from_people_queue(Ns,r),this._pop_from_people_queue(ji,r)):n===Jb?(I.each(r,function(h,m){m in o||(o[m]=h)}),this._pop_from_people_queue(ji,r)):n===e1?I.each(r,function(h){I.each([i,o,u,c],function(m){h in m&&delete m[h]}),I.each(p,function(m){h in m&&delete m[h]}),s[h]=!0}):n===t1?(I.each(r,function(h,m){m in i?i[m]+=h:(m in u||(u[m]=0),u[m]+=h)},this),this._pop_from_people_queue(ji,r)):n===i1?(I.each(r,function(h,m){I.isArray(h)&&(m in c||(c[m]=[]),I.each(h,function(v){I.include(c[m],v)||c[m].push(v)}))}),this._pop_from_people_queue(ji,r)):n===r1?(d.push(r),this._pop_from_people_queue(co,r)):n===n1&&(p.push(r),this._pop_from_people_queue(ji,r)),Ut.log("MIXPANEL PEOPLE REQUEST (QUEUED, PENDING IDENTIFY):"),Ut.log(t),this.save()},xt.prototype._pop_from_people_queue=function(e,t){var n=this.props[this._get_queue_key(e)];I.isUndefined(n)||I.each(t,function(r,i){e===co||e===Go?I.each(n,function(o){o[i]===r&&delete o[i]}):delete n[i]},this)},xt.prototype.load_queue=function(e){return this.load_prop(this._get_queue_key(e))},xt.prototype._get_queue_key=function(e){if(e===Pa)return Xb;if(e===eu)return Jb;if(e===ji)return e1;if(e===Ls)return t1;if(e===co)return n1;if(e===Go)return r1;if(e===Ns)return i1;Ut.error("Invalid queue:",e)},xt.prototype._get_or_create_queue=function(e,t){var n=this._get_queue_key(e);return t=I.isUndefined(t)?{}:t,this.props[n]||(this.props[n]=t)},xt.prototype.set_event_timer=function(e,t){var n=this.load_prop(gf)||{};n[e]=t,this.props[gf]=n,this.save()},xt.prototype.remove_event_timer=function(e){var t=this.load_prop(gf)||{},n=t[e];return I.isUndefined(n)||(delete this.props[gf][e],this.save()),n};var o1,XO=function(e,t){throw new Error(e+" not available in this build.")},Cr,JO=0,ZV=1,YV=function(e){return e},vi="mixpanel",eT="base64",WV="json",a1="$device:",tu=Ue.XMLHttpRequest&&"withCredentials"in new XMLHttpRequest,tT=!tu&&qo.indexOf("MSIE")===-1&&qo.indexOf("Mozilla")===-1,zp=null;Da.sendBeacon&&(zp=function(){return Da.sendBeacon.apply(Da,arguments)});var nT={track:"track/",engage:"engage/",groups:"groups/",record:"record/"},rT={api_host:"https://api-js.mixpanel.com",api_routes:nT,api_method:"POST",api_transport:"XHR",api_payload_format:eT,app_host:"https://mixpanel.com",autocapture:!1,cdn:"https://cdn.mxpnl.com",cross_site_cookie:!1,cross_subdomain_cookie:!0,error_reporter:$a,persistence:"cookie",persistence_name:"",cookie_domain:"",cookie_name:"",loaded:$a,mp_loader:null,track_marketing:!0,track_pageview:!1,skip_first_touch_marketing:!1,store_google:!0,stop_utm_persistence:!1,save_referrer:!0,test:!1,verbose:!1,img:!1,debug:!1,track_links_timeout:300,cookie_expiration:365,upgrade:!1,disable_persistence:!1,disable_cookie:!1,secure_cookie:!1,ip:!0,opt_out_tracking_by_default:!1,opt_out_persistence_by_default:!1,opt_out_tracking_persistence_type:"localStorage",opt_out_tracking_cookie_prefix:null,property_blacklist:[],xhr_headers:{},ignore_dnt:!1,batch_requests:!0,batch_size:50,batch_flush_interval_ms:5e3,batch_request_timeout_ms:9e4,batch_autostart:!0,hooks:{},record_block_class:new RegExp("^(mp-block|fs-exclude|amp-block|rr-block|ph-no-capture)$"),record_block_selector:"img, video",record_canvas:!1,record_collect_fonts:!1,record_idle_timeout_ms:30*60*1e3,record_mask_text_class:new RegExp("^(mp-mask|fs-mask|amp-mask|rr-mask|ph-mask)$"),record_mask_text_selector:"*",record_max_ms:lf,record_min_ms:0,record_sessions_percent:0,recorder_src:"https://cdn.mxpnl.com/libs/mixpanel-recorder.min.js"},iT=!1,ae=function(){},s1=function(e,t,n){var r,i=n===vi?Cr:Cr[n];if(i&&o1===JO)r=i;else{if(i&&!I.isArray(i)){Ut.error("You have already initialized "+n);return}r=new ae}if(r._cached_groups={},r._init(e,t,n),r.people=new ht,r.people._init(r),!r.get_config("skip_first_touch_marketing")){var o=I.info.campaignParams(null),s={},u=!1;I.each(o,function(c,d){s["initial_"+d]=c,c&&(u=!0)}),u&&r.people.set_once(s)}return qi.DEBUG=qi.DEBUG||r.get_config("debug"),!I.isUndefined(i)&&I.isArray(i)&&(r._execute_array.call(r.people,i.people),r._execute_array(i)),r};ae.prototype.init=function(e,t,n){if(I.isUndefined(n)){this.report_error("You must name your new library: init(token, config, name)");return}if(n===vi){this.report_error("You must initialize the main mixpanel object right after you include the Mixpanel js snippet");return}var r=s1(e,t,n);return Cr[n]=r,r._loaded(),r},ae.prototype._init=function(e,t,n){t=t||{},this.__loaded=!0,this.config={};var r={};if(!("api_payload_format"in t)){var i=t.api_host||rT.api_host;i.match(/\.mixpanel\.com/)&&(r.api_payload_format=WV)}if(this.set_config(I.extend({},rT,r,t,{name:n,token:e,callback_fn:(n===vi?n:vi+"."+n)+"._jsc"})),this._jsc=$a,this.__dom_loaded_queue=[],this.__request_queue=[],this.__disabled_events=[],this._flags={disable_all_events:!1,identify_called:!1},this.request_batchers={},this._batch_requests=this.get_config("batch_requests"),this._batch_requests){if(!I.localStorage.is_supported(!0)||!tu)this._batch_requests=!1,Ut.log("Turning off Mixpanel request-queueing; needs XHR and localStorage support"),I.each(this.get_batcher_configs(),function(u){Ut.log("Clearing batch queue "+u.queue_key),I.localStorage.remove(u.queue_key)});else if(this.init_batchers(),zp&&Ue.addEventListener){var o=I.bind(function(){this.request_batchers.events.stopped||this.request_batchers.events.flush({unloading:!0})},this);Ue.addEventListener("pagehide",function(u){u.persisted&&o()}),Ue.addEventListener("visibilitychange",function(){Vt.visibilityState==="hidden"&&o()})}}this.persistence=this.cookie=new xt(this.config),this.unpersisted_superprops={},this._gdpr_init();var s=I.UUID();this.get_distinct_id()||this.register_once({distinct_id:a1+s,$device_id:s},""),this.autocapture=new ei(this),this.autocapture.init(),this._init_tab_id(),this._check_and_start_session_recording()},ae.prototype._init_tab_id=function(){if(I.sessionStorage.is_supported())try{var e=this.get_config("name")+"_"+this.get_config("token"),t="mp_tab_id_"+e,n="mp_gen_new_tab_id_"+e;(I.sessionStorage.get(n)||!I.sessionStorage.get(t))&&I.sessionStorage.set(t,"$tab-"+I.UUID()),I.sessionStorage.set(n,"1"),this.tab_id=I.sessionStorage.get(t),Ue.addEventListener("beforeunload",function(){I.sessionStorage.remove(n)})}catch(r){this.report_error("Error initializing tab id",r)}else this.report_error("Session storage is not supported, cannot keep track of unique tab ID.")},ae.prototype.get_tab_id=function(){return this.tab_id||null},ae.prototype._should_load_recorder=function(){var e=new so(Pb),t=this.get_tab_id();return e.init().then(function(){return e.getAll()}).then(function(n){for(var r=0;r<n.length;r++)if(zb(n[r])||n[r].tabId===t)return!0;return!1}).catch(I.bind(function(n){this.report_error("Error checking recording registry",n)},this))},ae.prototype._check_and_start_session_recording=La(function(e){if(!Ue.MutationObserver){Ut.critical("Browser does not support MutationObserver; skipping session recording");return}var t=I.bind(function(r){var i=I.bind(function(){this._recorder=this._recorder||new Ue.__mp_recorder(this),this._recorder.resumeRecording(r)},this);I.isUndefined(Ue.__mp_recorder)?XO(this.get_config("recorder_src"),i):i()},this),n=this.get_config("record_sessions_percent")>0&&Math.random()*100<=this.get_config("record_sessions_percent");e||n?t(!0):this._should_load_recorder().then(function(r){r&&t(!1)})}),ae.prototype.start_session_recording=function(){this._check_and_start_session_recording(!0)},ae.prototype.stop_session_recording=function(){this._recorder&&this._recorder.stopRecording()},ae.prototype.pause_session_recording=function(){this._recorder&&this._recorder.pauseRecording()},ae.prototype.resume_session_recording=function(){this._recorder&&this._recorder.resumeRecording()},ae.prototype.get_session_recording_properties=function(){var e={},t=this._get_session_replay_id();return t&&(e.$mp_replay_id=t),e},ae.prototype.get_session_replay_url=function(){var e=null,t=this._get_session_replay_id();if(t){var n=I.HTTPBuildQuery({replay_id:t,distinct_id:this.get_distinct_id(),token:this.get_config("token")});e="https://mixpanel.com/projects/replay-redirect?"+n}return e},ae.prototype._get_session_replay_id=function(){var e=null;return this._recorder&&(e=this._recorder.replayId),e||null},ae.prototype.__get_recorder=function(){return this._recorder},ae.prototype._loaded=function(){if(this.get_config("loaded")(this),this._set_default_superprops(),this.people.set_once(this.persistence.get_referrer_info()),this.get_config("store_google")&&this.get_config("stop_utm_persistence")){var e=I.info.campaignParams(null);I.each(e,(function(t,n){this.unregister(n)}).bind(this))}},ae.prototype._set_default_superprops=function(){this.persistence.update_search_keyword(Vt.referrer),this.get_config("store_google")&&!this.get_config("stop_utm_persistence")&&this.register(I.info.campaignParams()),this.get_config("save_referrer")&&this.persistence.update_referrer_info(Vt.referrer)},ae.prototype._dom_loaded=function(){I.each(this.__dom_loaded_queue,function(e){this._track_dom.apply(this,e)},this),this.has_opted_out_tracking()||I.each(this.__request_queue,function(e){this._send_request.apply(this,e)},this),delete this.__dom_loaded_queue,delete this.__request_queue},ae.prototype._track_dom=function(e,t){if(this.get_config("img"))return this.report_error("You can't use DOM tracking functions with img = true."),!1;if(!iT)return this.__dom_loaded_queue.push([e,t]),!1;var n=new e().init(this);return n.track.apply(n,t)},ae.prototype._prepare_callback=function(e,t){if(I.isUndefined(e))return null;if(tu){var n=function(s){e(s,t)};return n}else{var r=this._jsc,i=""+Math.floor(Math.random()*1e8),o=this.get_config("callback_fn")+"["+i+"]";return r[i]=function(s){delete r[i],e(s,t)},o}},ae.prototype._send_request=function(e,t,n,r){var i=!0;if(tT)return this.__request_queue.push(arguments),i;var o={method:this.get_config("api_method"),transport:this.get_config("api_transport"),verbose:this.get_config("verbose")},s=null;!r&&(I.isFunction(n)||typeof n=="string")&&(r=n,n=null),n=I.extend(o,n||{}),tu||(n.method="GET");var u=n.method==="POST",c=zp&&u&&n.transport.toLowerCase()==="sendbeacon",d=n.verbose;t.verbose&&(d=!0),this.get_config("test")&&(t.test=1),d&&(t.verbose=1),this.get_config("img")&&(t.img=1),tu||(r?t.callback=r:(d||this.get_config("test"))&&(t.callback="(function(){})")),t.ip=this.get_config("ip")?1:0,t._=new Date().getTime().toString(),u&&(s="data="+encodeURIComponent(t.data),delete t.data),e+="?"+I.HTTPBuildQuery(t);var p=this;if("img"in t){var h=Vt.createElement("img");h.src=e,Vt.body.appendChild(h)}else if(c){try{i=zp(e,s)}catch(w){p.report_error(w),i=!1}try{r&&r(i?1:0)}catch(w){p.report_error(w)}}else if(tu)try{var m=new XMLHttpRequest;m.open(n.method,e,!0);var v=this.get_config("xhr_headers");if(u&&(v["Content-Type"]="application/x-www-form-urlencoded"),I.each(v,function(w,C){m.setRequestHeader(C,w)}),n.timeout_ms&&typeof m.timeout<"u"){m.timeout=n.timeout_ms;var _=new Date().getTime()}m.withCredentials=!0,m.onreadystatechange=function(){if(m.readyState===4)if(m.status===200){if(r)if(d){var w;try{w=I.JSONDecode(m.responseText)}catch(R){if(p.report_error(R),n.ignore_json_errors)w=m.responseText;else return}r(w)}else r(Number(m.responseText))}else{var C;if(m.timeout&&!m.status&&new Date().getTime()-_>=m.timeout?C="timeout":C="Bad HTTP status: "+m.status+" "+m.statusText,p.report_error(C),r)if(d){var E=m.responseHeaders||{};r({status:0,httpStatusCode:m.status,error:C,retryAfter:E["Retry-After"]})}else r(0)}},m.send(s)}catch(w){p.report_error(w),i=!1}else{var x=Vt.createElement("script");x.type="text/javascript",x.async=!0,x.defer=!0,x.src=e;var b=Vt.getElementsByTagName("script")[0];b.parentNode.insertBefore(x,b)}return i},ae.prototype._execute_array=function(e){var t,n=[],r=[],i=[];I.each(e,function(s){s&&(t=s[0],I.isArray(t)?i.push(s):typeof s=="function"?s.call(this):I.isArray(s)&&t==="alias"?n.push(s):I.isArray(s)&&t.indexOf("track")!==-1&&typeof this[t]=="function"?i.push(s):r.push(s))},this);var o=function(s,u){I.each(s,function(c){if(I.isArray(c[0])){var d=u;I.each(c,function(p){d=d[p[0]].apply(d,p.slice(1))})}else this[c[0]].apply(this,c.slice(1))},u)};o(n,this),o(r,this),o(i,this)},ae.prototype.are_batchers_initialized=function(){return!!this.request_batchers.events},ae.prototype.get_batcher_configs=function(){var e="__mpq_"+this.get_config("token"),t=this.get_config("api_routes");return this._batcher_configs=this._batcher_configs||{events:{type:"events",endpoint:"/"+t.track,queue_key:e+"_ev"},people:{type:"people",endpoint:"/"+t.engage,queue_key:e+"_pp"},groups:{type:"groups",endpoint:"/"+t.groups,queue_key:e+"_gr"}},this._batcher_configs},ae.prototype.init_batchers=function(){if(!this.are_batchers_initialized()){var e=I.bind(function(n){return new mi(n.queue_key,{libConfig:this.config,errorReporter:this.get_config("error_reporter"),sendRequestFunc:I.bind(function(r,i,o){this._send_request(this.get_config("api_host")+n.endpoint,this._encode_data_for_request(r),i,this._prepare_callback(o,r))},this),beforeSendHook:I.bind(function(r){return this._run_hook("before_send_"+n.type,r)},this),stopAllBatchingFunc:I.bind(this.stop_batch_senders,this),usePersistence:!0})},this),t=this.get_batcher_configs();this.request_batchers={events:e(t.events),people:e(t.people),groups:e(t.groups)}}this.get_config("batch_autostart")&&this.start_batch_senders()},ae.prototype.start_batch_senders=function(){this._batchers_were_started=!0,this.are_batchers_initialized()&&(this._batch_requests=!0,I.each(this.request_batchers,function(e){e.start()}))},ae.prototype.stop_batch_senders=function(){this._batch_requests=!1,I.each(this.request_batchers,function(e){e.stop(),e.clear()})},ae.prototype.push=function(e){this._execute_array([e])},ae.prototype.disable=function(e){typeof e>"u"?this._flags.disable_all_events=!0:this.__disabled_events=this.__disabled_events.concat(e)},ae.prototype._encode_data_for_request=function(e){var t=Yl(e);return this.get_config("api_payload_format")===eT&&(t=I.base64Encode(t)),{data:t}},ae.prototype._track_or_batch=function(e,t){var n=I.truncate(e.data,255),r=e.endpoint,i=e.batcher,o=e.should_send_immediately,s=e.send_request_options||{};t=t||$a;var u=!0,c=I.bind(function(){return s.skip_hooks||(n=this._run_hook("before_send_"+e.type,n)),n?(Ut.log("MIXPANEL REQUEST:"),Ut.log(n),this._send_request(r,this._encode_data_for_request(n),s,this._prepare_callback(t,n))):null},this);return this._batch_requests&&!o?i.enqueue(n).then(function(d){d?t(1,n):c()}):u=c(),u&&n},ae.prototype.track=La(function(e,t,n,r){!r&&typeof n=="function"&&(r=n,n=null),n=n||{};var i=n.transport;i&&(n.transport=i);var o=n.send_immediately;if(typeof r!="function"&&(r=$a),I.isUndefined(e)){this.report_error("No event name provided to mixpanel.track");return}if(this._event_is_disabled(e)){r(0);return}t=I.extend({},t),t.token=this.get_config("token");var s=this.persistence.remove_event_timer(e);if(!I.isUndefined(s)){var u=new Date().getTime()-s;t.$duration=parseFloat((u/1e3).toFixed(3))}this._set_default_superprops();var c=this.get_config("track_marketing")?I.info.marketingParams():{};t=I.extend({},I.info.properties({mp_loader:this.get_config("mp_loader")}),c,this.persistence.properties(),this.unpersisted_superprops,this.get_session_recording_properties(),t);var d=this.get_config("property_blacklist");I.isArray(d)?I.each(d,function(m){delete t[m]}):this.report_error("Invalid value for property_blacklist config: "+d);var p={event:e,properties:t},h=this._track_or_batch({type:"events",data:p,endpoint:this.get_config("api_host")+"/"+this.get_config("api_routes").track,batcher:this.request_batchers.events,should_send_immediately:o,send_request_options:n},r);return h}),ae.prototype.set_group=La(function(e,t,n){I.isArray(t)||(t=[t]);var r={};return r[e]=t,this.register(r),this.people.set(e,t,n)}),ae.prototype.add_group=La(function(e,t,n){var r=this.get_property(e),i={};return r===void 0?(i[e]=[t],this.register(i)):r.indexOf(t)===-1&&(r.push(t),i[e]=r,this.register(i)),this.people.union(e,t,n)}),ae.prototype.remove_group=La(function(e,t,n){var r=this.get_property(e);if(r!==void 0){var i=r.indexOf(t);i>-1&&(r.splice(i,1),this.register({group_key:r})),r.length===0&&this.unregister(e)}return this.people.remove(e,t,n)}),ae.prototype.track_with_groups=La(function(e,t,n,r){var i=I.extend({},t||{});return I.each(n,function(o,s){o!=null&&(i[s]=o)}),this.track(e,i,r)}),ae.prototype._create_map_key=function(e,t){return e+"_"+JSON.stringify(t)},ae.prototype._remove_group_from_cache=function(e,t){delete this._cached_groups[this._create_map_key(e,t)]},ae.prototype.get_group=function(e,t){var n=this._create_map_key(e,t),r=this._cached_groups[n];return(r===void 0||r._group_key!==e||r._group_id!==t)&&(r=new gn,r._init(this,e,t),this._cached_groups[n]=r),r},ae.prototype.track_pageview=La(function(e,t){typeof e!="object"&&(e={}),t=t||{};var n=t.event_name||"$mp_web_page_view",r=I.extend(I.info.mpPageViewProperties(),I.info.campaignParams(),I.info.clickParams()),i=I.extend({},r,e);return this.track(n,i)}),ae.prototype.track_links=function(){return this._track_dom.call(this,Jl,arguments)},ae.prototype.track_forms=function(){return this._track_dom.call(this,Fp,arguments)},ae.prototype.time_event=function(e){if(I.isUndefined(e)){this.report_error("No event name provided to mixpanel.time_event");return}this._event_is_disabled(e)||this.persistence.set_event_timer(e,new Date().getTime())};var KV={persistent:!0},l1=function(e){var t;return I.isObject(e)?t=e:I.isUndefined(e)?t={}:t={days:e},I.extend({},KV,t)};ae.prototype.register=function(e,t){var n=l1(t);n.persistent?this.persistence.register(e,n.days):I.extend(this.unpersisted_superprops,e)},ae.prototype.register_once=function(e,t,n){var r=l1(n);r.persistent?this.persistence.register_once(e,t,r.days):(typeof t>"u"&&(t="None"),I.each(e,function(i,o){(!this.unpersisted_superprops.hasOwnProperty(o)||this.unpersisted_superprops[o]===t)&&(this.unpersisted_superprops[o]=i)},this))},ae.prototype.unregister=function(e,t){t=l1(t),t.persistent?this.persistence.unregister(e):delete this.unpersisted_superprops[e]},ae.prototype._register_single=function(e,t){var n={};n[e]=t,this.register(n)},ae.prototype.identify=function(e,t,n,r,i,o,s,u){var c=this.get_distinct_id();if(e&&c!==e){if(typeof e=="string"&&e.indexOf(a1)===0)return this.report_error("distinct_id cannot have $device: prefix"),-1;this.register({$user_id:e})}if(!this.get_property("$device_id")){var d=c;this.register_once({$had_persisted_distinct_id:!0,$device_id:d},"")}e!==c&&e!==this.get_property(Up)&&(this.unregister(Up),this.register({distinct_id:e})),this._flags.identify_called=!0,this.people._flush(t,n,r,i,o,s,u),e!==c&&this.track("$identify",{distinct_id:e,$anon_distinct_id:c},{skip_hooks:!0})},ae.prototype.reset=function(){this.persistence.clear(),this._flags.identify_called=!1;var e=I.UUID();this.register_once({distinct_id:a1+e,$device_id:e},"")},ae.prototype.get_distinct_id=function(){return this.get_property("distinct_id")},ae.prototype.alias=function(e,t){if(e===this.get_property(QO))return this.report_error("Attempting to create alias for existing People user - aborting."),-2;var n=this;return I.isUndefined(t)&&(t=this.get_distinct_id()),e!==t?(this._register_single(Up,e),this.track("$create_alias",{alias:e,distinct_id:t},{skip_hooks:!0},function(){n.identify(e)})):(this.report_error("alias matches current distinct_id - skipping api call."),this.identify(e),-1)},ae.prototype.name_tag=function(e){this._register_single("mp_name_tag",e)},ae.prototype.set_config=function(e){if(I.isObject(e)){I.extend(this.config,e);var t=e.batch_size;t&&I.each(this.request_batchers,function(n){n.resetBatchSize()}),this.get_config("persistence_name")||(this.config.persistence_name=this.config.cookie_name),this.get_config("disable_persistence")||(this.config.disable_persistence=this.config.disable_cookie),this.persistence&&this.persistence.update_config(this.config),qi.DEBUG=qi.DEBUG||this.get_config("debug"),"autocapture"in e&&this.autocapture&&this.autocapture.init()}},ae.prototype.get_config=function(e){return this.config[e]},ae.prototype._run_hook=function(e){var t=(this.config.hooks[e]||YV).apply(this,Ma.call(arguments,1));return typeof t>"u"&&(this.report_error(e+" hook did not return a value"),t=null),t},ae.prototype.get_property=function(e){return this.persistence.load_prop([e])},ae.prototype.toString=function(){var e=this.get_config("name");return e!==vi&&(e=vi+"."+e),e},ae.prototype._event_is_disabled=function(e){return I.isBlockedUA(qo)||this._flags.disable_all_events||I.include(this.__disabled_events,e)},ae.prototype._gdpr_init=function(){var e=this.get_config("opt_out_tracking_persistence_type")==="localStorage";e&&I.localStorage.is_supported()&&(!this.has_opted_in_tracking()&&this.has_opted_in_tracking({persistence_type:"cookie"})&&this.opt_in_tracking({enable_persistence:!1}),!this.has_opted_out_tracking()&&this.has_opted_out_tracking({persistence_type:"cookie"})&&this.opt_out_tracking({clear_persistence:!1}),this.clear_opt_in_out_tracking({persistence_type:"cookie",enable_persistence:!1})),this.has_opted_out_tracking()?this._gdpr_update_persistence({clear_persistence:!0}):!this.has_opted_in_tracking()&&(this.get_config("opt_out_tracking_by_default")||I.cookie.get("mp_optout"))&&(I.cookie.remove("mp_optout"),this.opt_out_tracking({clear_persistence:this.get_config("opt_out_persistence_by_default")}))},ae.prototype._gdpr_update_persistence=function(e){var t;if(e&&e.clear_persistence)t=!0;else if(e&&e.enable_persistence)t=!1;else return;!this.get_config("disable_persistence")&&this.persistence.disabled!==t&&this.persistence.set_disabled(t),t?(this.stop_batch_senders(),this.stop_session_recording()):this._batchers_were_started&&this.start_batch_senders()},ae.prototype._gdpr_call_func=function(e,t){return t=I.extend({track:I.bind(this.track,this),persistence_type:this.get_config("opt_out_tracking_persistence_type"),cookie_prefix:this.get_config("opt_out_tracking_cookie_prefix"),cookie_expiration:this.get_config("cookie_expiration"),cross_site_cookie:this.get_config("cross_site_cookie"),cross_subdomain_cookie:this.get_config("cross_subdomain_cookie"),cookie_domain:this.get_config("cookie_domain"),secure_cookie:this.get_config("secure_cookie"),ignore_dnt:this.get_config("ignore_dnt")},t),I.localStorage.is_supported()||(t.persistence_type="cookie"),e(this.get_config("token"),{track:t.track,trackEventName:t.track_event_name,trackProperties:t.track_properties,persistenceType:t.persistence_type,persistencePrefix:t.cookie_prefix,cookieDomain:t.cookie_domain,cookieExpiration:t.cookie_expiration,crossSiteCookie:t.cross_site_cookie,crossSubdomainCookie:t.cross_subdomain_cookie,secureCookie:t.secure_cookie,ignoreDnt:t.ignore_dnt})},ae.prototype.opt_in_tracking=function(e){e=I.extend({enable_persistence:!0},e),this._gdpr_call_func(_V,e),this._gdpr_update_persistence(e)},ae.prototype.opt_out_tracking=function(e){e=I.extend({clear_persistence:!0,delete_user:!0},e),e.delete_user&&this.people&&this.people._identify_called()&&(this.people.delete_user(),this.people.clear_charges()),this._gdpr_call_func(bV,e),this._gdpr_update_persistence(e)},ae.prototype.has_opted_in_tracking=function(e){return this._gdpr_call_func(SV,e)},ae.prototype.has_opted_out_tracking=function(e){return this._gdpr_call_func(_O,e)},ae.prototype.clear_opt_in_out_tracking=function(e){e=I.extend({enable_persistence:!0},e),this._gdpr_call_func(wV,e),this._gdpr_update_persistence(e)},ae.prototype.report_error=function(e,t){Ut.error.apply(Ut.error,arguments);try{!t&&!(e instanceof Error)&&(e=new Error(e)),this.get_config("error_reporter")(e,t)}catch(n){Ut.error(n)}},ae.prototype.init=ae.prototype.init,ae.prototype.reset=ae.prototype.reset,ae.prototype.disable=ae.prototype.disable,ae.prototype.time_event=ae.prototype.time_event,ae.prototype.track=ae.prototype.track,ae.prototype.track_links=ae.prototype.track_links,ae.prototype.track_forms=ae.prototype.track_forms,ae.prototype.track_pageview=ae.prototype.track_pageview,ae.prototype.register=ae.prototype.register,ae.prototype.register_once=ae.prototype.register_once,ae.prototype.unregister=ae.prototype.unregister,ae.prototype.identify=ae.prototype.identify,ae.prototype.alias=ae.prototype.alias,ae.prototype.name_tag=ae.prototype.name_tag,ae.prototype.set_config=ae.prototype.set_config,ae.prototype.get_config=ae.prototype.get_config,ae.prototype.get_property=ae.prototype.get_property,ae.prototype.get_distinct_id=ae.prototype.get_distinct_id,ae.prototype.toString=ae.prototype.toString,ae.prototype.opt_out_tracking=ae.prototype.opt_out_tracking,ae.prototype.opt_in_tracking=ae.prototype.opt_in_tracking,ae.prototype.has_opted_out_tracking=ae.prototype.has_opted_out_tracking,ae.prototype.has_opted_in_tracking=ae.prototype.has_opted_in_tracking,ae.prototype.clear_opt_in_out_tracking=ae.prototype.clear_opt_in_out_tracking,ae.prototype.get_group=ae.prototype.get_group,ae.prototype.set_group=ae.prototype.set_group,ae.prototype.add_group=ae.prototype.add_group,ae.prototype.remove_group=ae.prototype.remove_group,ae.prototype.track_with_groups=ae.prototype.track_with_groups,ae.prototype.start_batch_senders=ae.prototype.start_batch_senders,ae.prototype.stop_batch_senders=ae.prototype.stop_batch_senders,ae.prototype.start_session_recording=ae.prototype.start_session_recording,ae.prototype.stop_session_recording=ae.prototype.stop_session_recording,ae.prototype.pause_session_recording=ae.prototype.pause_session_recording,ae.prototype.resume_session_recording=ae.prototype.resume_session_recording,ae.prototype.get_session_recording_properties=ae.prototype.get_session_recording_properties,ae.prototype.get_session_replay_url=ae.prototype.get_session_replay_url,ae.prototype.get_tab_id=ae.prototype.get_tab_id,ae.prototype.DEFAULT_API_ROUTES=nT,ae.prototype.__get_recorder=ae.prototype.__get_recorder,xt.prototype.properties=xt.prototype.properties,xt.prototype.update_search_keyword=xt.prototype.update_search_keyword,xt.prototype.update_referrer_info=xt.prototype.update_referrer_info,xt.prototype.get_cross_subdomain=xt.prototype.get_cross_subdomain,xt.prototype.clear=xt.prototype.clear;var nu={},QV=function(){I.each(nu,function(e,t){t!==vi&&(Cr[t]=e)}),Cr._=I},XV=function(){Cr.init=function(e,t,n){if(n)return Cr[n]||(Cr[n]=nu[n]=s1(e,t,n),Cr[n]._loaded()),Cr[n];var r=Cr;nu[vi]?r=nu[vi]:e&&(r=s1(e,t,vi),r._loaded(),nu[vi]=r),Cr=r,o1===ZV&&(Ue[vi]=Cr),QV()}},JV=function(){function e(){e.done||(e.done=!0,iT=!0,tT=!1,I.each(nu,function(r){r._dom_loaded()}))}function t(){try{Vt.documentElement.doScroll("left")}catch{setTimeout(t,1);return}e()}if(Vt.addEventListener)Vt.readyState==="complete"?e():Vt.addEventListener("DOMContentLoaded",e,!1);else if(Vt.attachEvent){Vt.attachEvent("onreadystatechange",e);var n=!1;try{n=Ue.frameElement===null}catch{}Vt.documentElement.doScroll&&n&&t()}I.register_event(Ue,"load",e,!0)};function eZ(e){return XO=e,o1=JO,Cr=new ae,XV(),Cr.init(),JV(),Cr}function tZ(e,t){t()}var Ba=eZ(tZ);const fo="https://saas.brainlox.com",nZ="https://debales-web-app-server.azurewebsites.net",oT={"blossom-and-rhyme-6":"84e28f5a553bc260c8276723d0f365bc","doorbellmount-dea1de94-1728660454527":"f825468f4202c28be0d29c849a997208",artzfolio:"789feea8eb479f2db1144448f6465f7f",minature:"b22ef9c8fdbeb4a297947903891c5fd9","nonetz-3f0b8348-1736183595738":"a19d837ea53890c892a2b351e54afc11",bodytales:"703aa3f61539de0786fa19f82644fa8b",athflex:"b9f412aa0c6991abf8b8e3db70b2a506",www:"2637bf921fb09742d550941fbebe7160","GTK-Restaurant":"dbcb03738f942ec7c968f45833ee47bf","derkins-co-uk":"f109fd32c98dac150ba902bd69feeeed","imemyselfcare-com":"bbbe4af618eeab278a4015b4ddf8827f"},rZ="phc_nzwftWluHb06OLHwbfhb2xmhk88Ffc9OjjR8Jz5Q327",iZ=e=>({layout:{position:{isLeft:e.isLeft??!1,zIndex:e.zIndex??1e3},height:{option:e.heightOption??"Normal"},responsive:{fullScreenOnMobile:e.fullScreenOnMobile??!0,mobileDisplayMode:e.mobileDisplayMode??"normal"}},colors:{background:e.backgroundColor,font:e.fontColor,supportButtonBackgroundColor:e.supportButtonBackgroundColor??"'#ffa500'",bot:{background:e.botBackgroundColor,message:e.botMessageColor,font:e.botFontColor},user:{message:e.userMessageColor,font:e.userFontColor},header:{font:e.headerFontColor},footer:{background:e.footerBackgroundColor,inputBorder:e.fonterInputBorderColor},cta:{background:e.callToActionBackgroundColor,font:e.callToActionFontColor},suggestedQuestions:{font:e.suggestedQuestionsFontColor,background:e.suggestedQuestionsBackgroundColor,hover:e.suggestedQuestionsHoverColor,crossButton:{color:e.suggestedQuestionsCrossButtonColor,background:e.suggestedQuestionsCrossButtonBackgroundColor},highlight:e.suggestedQuestionsHighlightColor},chatButton:{animation:e.chatButtonBackgroundAnimationColor}},typography:{fontFamily:void 0,fontSize:void 0,lineHeight:void 0},borders:{radius:"4px",width:"1px"},animations:{chatButton:{type:e.chatButtonBackgroundAnimationType??"Ping",enabled:e.enableChatButtonBackgroundAnimation??!1}},branding:{visibility:{showBot:e.show_bot??!0,debalesBranding:e.debales_branding??!0},logo:{removeBackground:e.removeLogoBackground??!1}}});function ur(){const e=sessionStorage.getItem("debalesSessionID");if(e)return e;const t=crypto.randomUUID();return sessionStorage.setItem("debalesSessionID",t),t}function oZ(){return sessionStorage.getItem(yi(window.DebalesChat.projectId,pi.LAST_SHOWN_MESSAGE_ID))}function u1(e){sessionStorage.setItem("formstate",e.toString())}function ho(){const e=localStorage.getItem("debalesUserInfo");return e?JSON.parse(e):null}function qp(e){localStorage.setItem("debalesUserInfo",JSON.stringify(e))}function jp(e){if(e.current){const t=e.current.lastElementChild;if(t)if(window.matchMedia("(max-width: 768px)").matches)e.current.scrollTop=e.current.scrollHeight,setTimeout(()=>{e.current&&(e.current.scrollTop=e.current.scrollHeight)},50);else{const r=e.current.scrollTop,i=t.getBoundingClientRect().bottom+e.current.scrollTop-e.current.clientHeight,o=300,s=performance.now(),u=c=>{const d=c-s,p=Math.min(d/o,1),h=p<.5?4*p*p*p:1-Math.pow(-2*p+2,3)/2;e.current.scrollTop=r+(i-r)*h,p<1&&requestAnimationFrame(u)};requestAnimationFrame(u)}}}function aZ(){return window.location.pathname}function aT(){const e=/test|demo|example|debales/i,t=ho()??"";return!!(t&&e.test(t.email))}function sZ(e){const t=aZ(),r=Array.from(new Set(e.map(o=>o.path))).filter(o=>new RegExp(`^${o}(/|$)`).test(t));if(r.length>0){r.sort((u,c)=>c.length-u.length);const o=r[0];return e.filter(u=>u.path===o&&u.enable!==!1).sort((u,c)=>(u.sortOrder??0)-(c.sortOrder??0))}return e.filter(o=>o.path==="/"&&o.enable!==!1).sort((o,s)=>(o.sortOrder??0)-(s.sortOrder??0))}const sT=new Set,lZ=e=>{const t=oT[e];if(!t)return console.warn("No Mixpanel token found"),null;if(sT.has(e))return Ba;Ba.init(t,{debug:!0,track_pageview:!0,persistence:"localStorage"}),console.log("Mixpanel initialized");const n=ho();return n&&n.email&&Ba.identify(n.email),sT.add(e),Ba},uZ=async(e,t)=>{if(aT())return;const n=window.DebalesChat.projectId??t.projectId;if(!oT[n]){console.warn("No Mixpanel token found");return}Ba.track(e,t)},cZ=()=>{const e=localStorage.getItem("anonymousUserId");if(e)return e;const t=crypto.randomUUID();return localStorage.setItem("anonymousUserId",t),t};function fZ(e){return e?e.split("<br>").filter(n=>n.trim().length>0).map(n=>n.trim()):[""]}const cr=e=>e.toLowerCase().includes("gaiabay")||e.toLowerCase().includes("debales-testing"),dZ=e=>{const t=e.findIndex(o=>o.type==="dynamic");if(t===-1)return e;const n=e.filter(o=>o.type==="static"),r=e.filter(o=>o.type==="dynamic");return[...n.slice(0,t),r,...n.slice(t)]};function yi(e,t){return`debales_${e}_${t}`}const lT=W.createContext(null),uT=()=>{const e=W.useContext(lT);if(!e)throw new Error("useCart must be used within a CartProvider");return e};var hZ="2.0.0",ru="",cT="?",Hp="function",Fa="undefined",iu="object",c1="string",mf="major",Ie="model",Ce="name",xe="type",Te="vendor",Ae="version",zr="architecture",ou="console",yt="mobile",bn="tablet",Er="smarttv",vf="wearable",f1="xr",d1="embedded",yf="inapp",fT="user-agent",h1=500,p1="brands",Ps="formFactors",g1="fullVersionList",au="platform",m1="platformVersion",Gp="bitness",Ua="sec-ch-ua",pZ=Ua+"-full-version-list",gZ=Ua+"-arch",mZ=Ua+"-"+Gp,vZ=Ua+"-form-factors",yZ=Ua+"-"+yt,_Z=Ua+"-"+Ie,dT=Ua+"-"+au,bZ=dT+"-version",hT=[p1,g1,yt,Ie,au,m1,zr,Ps,Gp],ti="browser",Vo="cpu",po="device",Zo="engine",_i="os",su="result",Vp="Amazon",_f="Apple",pT="ASUS",gT="BlackBerry",Bs="Google",mT="Huawei",vT="Lenovo",SZ="Honor",v1="LG",Zp="Microsoft",yT="Motorola",bf="Samsung",_T="Sharp",Yp="Sony",y1="Xiaomi",_1="Zebra",lu="Mobile ",Sf=" Browser",bT="Chrome",za="Chromecast",wZ="Edge",wf="Firefox",xf="Opera",ST="Facebook",wT="Sogou",b1="Windows",xZ=typeof window!==Fa,qr=xZ&&window.navigator?window.navigator:void 0,qa=qr&&qr.userAgentData?qr.userAgentData:void 0,CZ=function(e,t){var n={},r=t;if(!Kp(t)){r={};for(var i in t)for(var o in t[i])r[o]=t[i][o].concat(r[o]?r[o]:[])}for(var s in e)n[s]=r[s]&&r[s].length%2===0?r[s].concat(e[s]):e[s];return n},Wp=function(e){for(var t={},n=0;n<e.length;n++)t[e[n].toUpperCase()]=e[n];return t},S1=function(e,t){if(typeof e===iu&&e.length>0){for(var n in e)if(Yo(e[n])==Yo(t))return!0;return!1}return uu(e)?Yo(t).indexOf(Yo(e))!==-1:!1},Kp=function(e,t){for(var n in e)return/^(browser|cpu|device|engine|os)$/.test(n)||(t?Kp(e[n]):!1)},uu=function(e){return typeof e===c1},w1=function(e){if(e){for(var t=[],n=Fs(/\\?\"/g,e).split(","),r=0;r<n.length;r++)if(n[r].indexOf(";")>-1){var i=Ef(n[r]).split(";v=");t[r]={brand:i[0],version:i[1]}}else t[r]=Ef(n[r]);return t}},Yo=function(e){return uu(e)?e.toLowerCase():e},x1=function(e){return uu(e)?Fs(/[^\d\.]/g,e).split(".")[0]:void 0},Wo=function(e){for(var t in e){var n=e[t];typeof n==iu&&n.length==2?this[n[0]]=n[1]:this[n]=void 0}return this},Fs=function(e,t){return uu(t)?t.replace(e,ru):t},Cf=function(e){return Fs(/\\?\"/g,e)},Ef=function(e,t){if(uu(e))return e=Fs(/^\s\s*/,e),typeof t===Fa?e:e.substring(0,h1)},xT=function(e,t){if(!(!e||!t))for(var n=0,r,i,o,s,u,c;n<t.length&&!u;){var d=t[n],p=t[n+1];for(r=i=0;r<d.length&&!u&&d[r];)if(u=d[r++].exec(e),u)for(o=0;o<p.length;o++)c=u[++i],s=p[o],typeof s===iu&&s.length>0?s.length===2?typeof s[1]==Hp?this[s[0]]=s[1].call(this,c):this[s[0]]=s[1]:s.length===3?typeof s[1]===Hp&&!(s[1].exec&&s[1].test)?this[s[0]]=c?s[1].call(this,c,s[2]):void 0:this[s[0]]=c?c.replace(s[1],s[2]):void 0:s.length===4&&(this[s[0]]=c?s[3].call(this,c.replace(s[1],s[2])):void 0):this[s]=c||void 0;n+=2}},kf=function(e,t){for(var n in t)if(typeof t[n]===iu&&t[n].length>0){for(var r=0;r<t[n].length;r++)if(S1(t[n][r],e))return n===cT?void 0:n}else if(S1(t[n],e))return n===cT?void 0:n;return t.hasOwnProperty("*")?t["*"]:e},CT={ME:"4.90","NT 3.11":"NT3.51","NT 4.0":"NT4.0",2e3:"NT 5.0",XP:["NT 5.1","NT 5.2"],Vista:"NT 6.0",7:"NT 6.1",8:"NT 6.2","8.1":"NT 6.3",10:["NT 6.4","NT 10.0"],RT:"ARM"},ET={embedded:"Automotive",mobile:"Mobile",tablet:["Tablet","EInk"],smarttv:"TV",wearable:"Watch",xr:["VR","XR"],"?":["Desktop","Unknown"],"*":void 0},kT={browser:[[/\b(?:crmo|crios)\/([\w\.]+)/i],[Ae,[Ce,lu+"Chrome"]],[/edg(?:e|ios|a)?\/([\w\.]+)/i],[Ae,[Ce,"Edge"]],[/(opera mini)\/([-\w\.]+)/i,/(opera [mobiletab]{3,6})\b.+version\/([-\w\.]+)/i,/(opera)(?:.+version\/|[\/ ]+)([\w\.]+)/i],[Ce,Ae],[/opios[\/ ]+([\w\.]+)/i],[Ae,[Ce,xf+" Mini"]],[/\bop(?:rg)?x\/([\w\.]+)/i],[Ae,[Ce,xf+" GX"]],[/\bopr\/([\w\.]+)/i],[Ae,[Ce,xf]],[/\bb[ai]*d(?:uhd|[ub]*[aekoprswx]{5,6})[\/ ]?([\w\.]+)/i],[Ae,[Ce,"Baidu"]],[/\b(?:mxbrowser|mxios|myie2)\/?([-\w\.]*)\b/i],[Ae,[Ce,"Maxthon"]],[/(kindle)\/([\w\.]+)/i,/(lunascape|maxthon|netfront|jasmine|blazer|sleipnir)[\/ ]?([\w\.]*)/i,/(avant|iemobile|slim(?:browser|boat|jet))[\/ ]?([\d\.]*)/i,/(?:ms|\()(ie) ([\w\.]+)/i,/(flock|rockmelt|midori|epiphany|silk|skyfire|ovibrowser|bolt|iron|vivaldi|iridium|phantomjs|bowser|qupzilla|falkon|rekonq|puffin|brave|whale(?!.+naver)|qqbrowserlite|duckduckgo|klar|helio|(?=comodo_)?dragon)\/([-\w\.]+)/i,/(heytap|ovi|115)browser\/([\d\.]+)/i,/(weibo)__([\d\.]+)/i],[Ce,Ae],[/quark(?:pc)?\/([-\w\.]+)/i],[Ae,[Ce,"Quark"]],[/\bddg\/([\w\.]+)/i],[Ae,[Ce,"DuckDuckGo"]],[/(?:\buc? ?browser|(?:juc.+)ucweb)[\/ ]?([\w\.]+)/i],[Ae,[Ce,"UCBrowser"]],[/microm.+\bqbcore\/([\w\.]+)/i,/\bqbcore\/([\w\.]+).+microm/i,/micromessenger\/([\w\.]+)/i],[Ae,[Ce,"WeChat"]],[/konqueror\/([\w\.]+)/i],[Ae,[Ce,"Konqueror"]],[/trident.+rv[: ]([\w\.]{1,9})\b.+like gecko/i],[Ae,[Ce,"IE"]],[/ya(?:search)?browser\/([\w\.]+)/i],[Ae,[Ce,"Yandex"]],[/slbrowser\/([\w\.]+)/i],[Ae,[Ce,"Smart "+vT+Sf]],[/(avast|avg)\/([\w\.]+)/i],[[Ce,/(.+)/,"$1 Secure"+Sf],Ae],[/\bfocus\/([\w\.]+)/i],[Ae,[Ce,wf+" Focus"]],[/\bopt\/([\w\.]+)/i],[Ae,[Ce,xf+" Touch"]],[/coc_coc\w+\/([\w\.]+)/i],[Ae,[Ce,"Coc Coc"]],[/dolfin\/([\w\.]+)/i],[Ae,[Ce,"Dolphin"]],[/coast\/([\w\.]+)/i],[Ae,[Ce,xf+" Coast"]],[/miuibrowser\/([\w\.]+)/i],[Ae,[Ce,"MIUI"+Sf]],[/fxios\/([\w\.-]+)/i],[Ae,[Ce,lu+wf]],[/\bqihoobrowser\/?([\w\.]*)/i],[Ae,[Ce,"360"]],[/\b(qq)\/([\w\.]+)/i],[[Ce,/(.+)/,"$1Browser"],Ae],[/(oculus|sailfish|huawei|vivo|pico)browser\/([\w\.]+)/i],[[Ce,/(.+)/,"$1"+Sf],Ae],[/samsungbrowser\/([\w\.]+)/i],[Ae,[Ce,bf+" Internet"]],[/metasr[\/ ]?([\d\.]+)/i],[Ae,[Ce,wT+" Explorer"]],[/(sogou)mo\w+\/([\d\.]+)/i],[[Ce,wT+" Mobile"],Ae],[/(electron)\/([\w\.]+) safari/i,/(tesla)(?: qtcarbrowser|\/(20\d\d\.[-\w\.]+))/i,/m?(qqbrowser|2345(?=browser|chrome|explorer))\w*[\/ ]?v?([\w\.]+)/i],[Ce,Ae],[/(lbbrowser|rekonq)/i],[Ce],[/ome\/([\w\.]+) \w* ?(iron) saf/i,/ome\/([\w\.]+).+qihu (360)[es]e/i],[Ae,Ce],[/((?:fban\/fbios|fb_iab\/fb4a)(?!.+fbav)|;fbav\/([\w\.]+);)/i],[[Ce,ST],Ae,[xe,yf]],[/(Klarna)\/([\w\.]+)/i,/(kakao(?:talk|story))[\/ ]([\w\.]+)/i,/(naver)\(.*?(\d+\.[\w\.]+).*\)/i,/safari (line)\/([\w\.]+)/i,/\b(line)\/([\w\.]+)\/iab/i,/(alipay)client\/([\w\.]+)/i,/(twitter)(?:and| f.+e\/([\w\.]+))/i,/(instagram|snapchat)[\/ ]([-\w\.]+)/i],[Ce,Ae,[xe,yf]],[/\bgsa\/([\w\.]+) .*safari\//i],[Ae,[Ce,"GSA"],[xe,yf]],[/musical_ly(?:.+app_?version\/|_)([\w\.]+)/i],[Ae,[Ce,"TikTok"],[xe,yf]],[/\[(linkedin)app\]/i],[Ce,[xe,yf]],[/(chromium)[\/ ]([-\w\.]+)/i],[Ce,Ae],[/headlesschrome(?:\/([\w\.]+)| )/i],[Ae,[Ce,bT+" Headless"]],[/ wv\).+(chrome)\/([\w\.]+)/i],[[Ce,bT+" WebView"],Ae],[/droid.+ version\/([\w\.]+)\b.+(?:mobile safari|safari)/i],[Ae,[Ce,"Android"+Sf]],[/chrome\/([\w\.]+) mobile/i],[Ae,[Ce,lu+"Chrome"]],[/(chrome|omniweb|arora|[tizenoka]{5} ?browser)\/v?([\w\.]+)/i],[Ce,Ae],[/version\/([\w\.\,]+) .*mobile(?:\/\w+ | ?)safari/i],[Ae,[Ce,lu+"Safari"]],[/iphone .*mobile(?:\/\w+ | ?)safari/i],[[Ce,lu+"Safari"]],[/version\/([\w\.\,]+) .*(safari)/i],[Ae,Ce],[/webkit.+?(mobile ?safari|safari)(\/[\w\.]+)/i],[Ce,[Ae,"1"]],[/(webkit|khtml)\/([\w\.]+)/i],[Ce,Ae],[/(?:mobile|tablet);.*(firefox)\/([\w\.-]+)/i],[[Ce,lu+wf],Ae],[/(navigator|netscape\d?)\/([-\w\.]+)/i],[[Ce,"Netscape"],Ae],[/(wolvic|librewolf)\/([\w\.]+)/i],[Ce,Ae],[/mobile vr; rv:([\w\.]+)\).+firefox/i],[Ae,[Ce,wf+" Reality"]],[/ekiohf.+(flow)\/([\w\.]+)/i,/(swiftfox)/i,/(icedragon|iceweasel|camino|chimera|fennec|maemo browser|minimo|conkeror)[\/ ]?([\w\.\+]+)/i,/(seamonkey|k-meleon|icecat|iceape|firebird|phoenix|palemoon|basilisk|waterfox)\/([-\w\.]+)$/i,/(firefox)\/([\w\.]+)/i,/(mozilla)\/([\w\.]+) .+rv\:.+gecko\/\d+/i,/(polaris|lynx|dillo|icab|doris|amaya|w3m|netsurf|obigo|mosaic|(?:go|ice|up)[\. ]?browser)[-\/ ]?v?([\w\.]+)/i,/\b(links) \(([\w\.]+)/i],[Ce,[Ae,/_/g,"."]],[/(cobalt)\/([\w\.]+)/i],[Ce,[Ae,/[^\d\.]+./,ru]]],cpu:[[/\b(?:(amd|x|x86[-_]?|wow|win)64)\b/i],[[zr,"amd64"]],[/(ia32(?=;))/i,/((?:i[346]|x)86)[;\)]/i],[[zr,"ia32"]],[/\b(aarch64|arm(v?8e?l?|_?64))\b/i],[[zr,"arm64"]],[/\b(arm(?:v[67])?ht?n?[fl]p?)\b/i],[[zr,"armhf"]],[/windows (ce|mobile); ppc;/i],[[zr,"arm"]],[/((?:ppc|powerpc)(?:64)?)(?: mac|;|\))/i],[[zr,/ower/,ru,Yo]],[/(sun4\w)[;\)]/i],[[zr,"sparc"]],[/((?:avr32|ia64(?=;))|68k(?=\))|\barm(?=v(?:[1-7]|[5-7]1)l?|;|eabi)|(?=atmel )avr|(?:irix|mips|sparc)(?:64)?\b|pa-risc)/i],[[zr,Yo]]],device:[[/\b(sch-i[89]0\d|shw-m380s|sm-[ptx]\w{2,4}|gt-[pn]\d{2,4}|sgh-t8[56]9|nexus 10)/i],[Ie,[Te,bf],[xe,bn]],[/\b((?:s[cgp]h|gt|sm)-(?![lr])\w+|sc[g-]?[\d]+a?|galaxy nexus)/i,/samsung[- ]((?!sm-[lr])[-\w]+)/i,/sec-(sgh\w+)/i],[Ie,[Te,bf],[xe,yt]],[/(?:\/|\()(ip(?:hone|od)[\w, ]*)(?:\/|;)/i],[Ie,[Te,_f],[xe,yt]],[/\((ipad);[-\w\),; ]+apple/i,/applecoremedia\/[\w\.]+ \((ipad)/i,/\b(ipad)\d\d?,\d\d?[;\]].+ios/i],[Ie,[Te,_f],[xe,bn]],[/(macintosh);/i],[Ie,[Te,_f]],[/\b(sh-?[altvz]?\d\d[a-ekm]?)/i],[Ie,[Te,_T],[xe,yt]],[/(?:honor)([-\w ]+)[;\)]/i],[Ie,[Te,SZ],[xe,yt]],[/\b((?:ag[rs][23]?|bah2?|sht?|btv)-a?[lw]\d{2})\b(?!.+d\/s)/i],[Ie,[Te,mT],[xe,bn]],[/(?:huawei)([-\w ]+)[;\)]/i,/\b(nexus 6p|\w{2,4}e?-[atu]?[ln][\dx][012359c][adn]?)\b(?!.+d\/s)/i],[Ie,[Te,mT],[xe,yt]],[/\b(poco[\w ]+|m2\d{3}j\d\d[a-z]{2})(?: bui|\))/i,/\b; (\w+) build\/hm\1/i,/\b(hm[-_ ]?note?[_ ]?(?:\d\w)?) bui/i,/\b(redmi[\-_ ]?(?:note|k)?[\w_ ]+)(?: bui|\))/i,/oid[^\)]+; (m?[12][0-389][01]\w{3,6}[c-y])( bui|; wv|\))/i,/\b(mi[-_ ]?(?:a\d|one|one[_ ]plus|note lte|max|cc)?[_ ]?(?:\d?\w?)[_ ]?(?:plus|se|lite|pro)?)(?: bui|\))/i],[[Ie,/_/g," "],[Te,y1],[xe,yt]],[/oid[^\)]+; (2\d{4}(283|rpbf)[cgl])( bui|\))/i,/\b(mi[-_ ]?(?:pad)(?:[\w_ ]+))(?: bui|\))/i],[[Ie,/_/g," "],[Te,y1],[xe,bn]],[/; (\w+) bui.+ oppo/i,/\b(cph[12]\d{3}|p(?:af|c[al]|d\w|e[ar])[mt]\d0|x9007|a101op)\b/i],[Ie,[Te,"OPPO"],[xe,yt]],[/\b(opd2\d{3}a?) bui/i],[Ie,[Te,"OPPO"],[xe,bn]],[/vivo (\w+)(?: bui|\))/i,/\b(v[12]\d{3}\w?[at])(?: bui|;)/i],[Ie,[Te,"Vivo"],[xe,yt]],[/\b(rmx[1-3]\d{3})(?: bui|;|\))/i],[Ie,[Te,"Realme"],[xe,yt]],[/\b(milestone|droid(?:[2-4x]| (?:bionic|x2|pro|razr))?:?( 4g)?)\b[\w ]+build\//i,/\bmot(?:orola)?[- ](\w*)/i,/((?:moto[\w\(\) ]+|xt\d{3,4}|nexus 6)(?= bui|\)))/i],[Ie,[Te,yT],[xe,yt]],[/\b(mz60\d|xoom[2 ]{0,2}) build\//i],[Ie,[Te,yT],[xe,bn]],[/((?=lg)?[vl]k\-?\d{3}) bui| 3\.[-\w; ]{10}lg?-([06cv9]{3,4})/i],[Ie,[Te,v1],[xe,bn]],[/(lm(?:-?f100[nv]?|-[\w\.]+)(?= bui|\))|nexus [45])/i,/\blg[-e;\/ ]+((?!browser|netcast|android tv)\w+)/i,/\blg-?([\d\w]+) bui/i],[Ie,[Te,v1],[xe,yt]],[/(ideatab[-\w ]+)/i,/lenovo ?(s[56]000[-\w]+|tab(?:[\w ]+)|yt[-\d\w]{6}|tb[-\d\w]{6})/i],[Ie,[Te,vT],[xe,bn]],[/(?:maemo|nokia).*(n900|lumia \d+)/i,/nokia[-_ ]?([-\w\.]*)/i],[[Ie,/_/g," "],[Te,"Nokia"],[xe,yt]],[/(pixel c)\b/i],[Ie,[Te,Bs],[xe,bn]],[/droid.+; (pixel[\daxl ]{0,6})(?: bui|\))/i],[Ie,[Te,Bs],[xe,yt]],[/droid.+; (a?\d[0-2]{2}so|[c-g]\d{4}|so[-gl]\w+|xq-a\w[4-7][12])(?= bui|\).+chrome\/(?![1-6]{0,1}\d\.))/i],[Ie,[Te,Yp],[xe,yt]],[/sony tablet [ps]/i,/\b(?:sony)?sgp\w+(?: bui|\))/i],[[Ie,"Xperia Tablet"],[Te,Yp],[xe,bn]],[/ (kb2005|in20[12]5|be20[12][59])\b/i,/(?:one)?(?:plus)? (a\d0\d\d)(?: b|\))/i],[Ie,[Te,"OnePlus"],[xe,yt]],[/(alexa)webm/i,/(kf[a-z]{2}wi|aeo(?!bc)\w\w)( bui|\))/i,/(kf[a-z]+)( bui|\)).+silk\//i],[Ie,[Te,Vp],[xe,bn]],[/((?:sd|kf)[0349hijorstuw]+)( bui|\)).+silk\//i],[[Ie,/(.+)/g,"Fire Phone $1"],[Te,Vp],[xe,yt]],[/(playbook);[-\w\),; ]+(rim)/i],[Ie,Te,[xe,bn]],[/\b((?:bb[a-f]|st[hv])100-\d)/i,/\(bb10; (\w+)/i],[Ie,[Te,gT],[xe,yt]],[/(?:\b|asus_)(transfo[prime ]{4,10} \w+|eeepc|slider \w+|nexus 7|padfone|p00[cj])/i],[Ie,[Te,pT],[xe,bn]],[/ (z[bes]6[027][012][km][ls]|zenfone \d\w?)\b/i],[Ie,[Te,pT],[xe,yt]],[/(nexus 9)/i],[Ie,[Te,"HTC"],[xe,bn]],[/(htc)[-;_ ]{1,2}([\w ]+(?=\)| bui)|\w+)/i,/(zte)[- ]([\w ]+?)(?: bui|\/|\))/i,/(alcatel|geeksphone|nexian|panasonic(?!(?:;|\.))|sony(?!-bra))[-_ ]?([-\w]*)/i],[Te,[Ie,/_/g," "],[xe,yt]],[/tcl (xess p17aa)/i,/droid [\w\.]+; ((?:8[14]9[16]|9(?:0(?:48|60|8[01])|1(?:3[27]|66)|2(?:6[69]|9[56])|466))[gqswx])(_\w(\w|\w\w))?(\)| bui)/i],[Ie,[Te,"TCL"],[xe,bn]],[/droid [\w\.]+; (418(?:7d|8v)|5087z|5102l|61(?:02[dh]|25[adfh]|27[ai]|56[dh]|59k|65[ah])|a509dl|t(?:43(?:0w|1[adepqu])|50(?:6d|7[adju])|6(?:09dl|10k|12b|71[efho]|76[hjk])|7(?:66[ahju]|67[hw]|7[045][bh]|71[hk]|73o|76[ho]|79w|81[hks]?|82h|90[bhsy]|99b)|810[hs]))(_\w(\w|\w\w))?(\)| bui)/i],[Ie,[Te,"TCL"],[xe,yt]],[/(itel) ((\w+))/i],[[Te,Yo],Ie,[xe,kf,{tablet:["p10001l","w7001"],"*":"mobile"}]],[/droid.+; ([ab][1-7]-?[0178a]\d\d?)/i],[Ie,[Te,"Acer"],[xe,bn]],[/droid.+; (m[1-5] note) bui/i,/\bmz-([-\w]{2,})/i],[Ie,[Te,"Meizu"],[xe,yt]],[/; ((?:power )?armor(?:[\w ]{0,8}))(?: bui|\))/i],[Ie,[Te,"Ulefone"],[xe,yt]],[/; (energy ?\w+)(?: bui|\))/i,/; energizer ([\w ]+)(?: bui|\))/i],[Ie,[Te,"Energizer"],[xe,yt]],[/; cat (b35);/i,/; (b15q?|s22 flip|s48c|s62 pro)(?: bui|\))/i],[Ie,[Te,"Cat"],[xe,yt]],[/((?:new )?andromax[\w- ]+)(?: bui|\))/i],[Ie,[Te,"Smartfren"],[xe,yt]],[/droid.+; (a(?:015|06[35]|142p?))/i],[Ie,[Te,"Nothing"],[xe,yt]],[/(blackberry|benq|palm(?=\-)|sonyericsson|acer|asus|dell|meizu|motorola|polytron|infinix|tecno|micromax|advan)[-_ ]?([-\w]*)/i,/; (imo) ((?!tab)[\w ]+?)(?: bui|\))/i,/(hp) ([\w ]+\w)/i,/(asus)-?(\w+)/i,/(microsoft); (lumia[\w ]+)/i,/(lenovo)[-_ ]?([-\w]+)/i,/(jolla)/i,/(oppo) ?([\w ]+) bui/i],[Te,Ie,[xe,yt]],[/(imo) (tab \w+)/i,/(kobo)\s(ereader|touch)/i,/(archos) (gamepad2?)/i,/(hp).+(touchpad(?!.+tablet)|tablet)/i,/(kindle)\/([\w\.]+)/i],[Te,Ie,[xe,bn]],[/(surface duo)/i],[Ie,[Te,Zp],[xe,bn]],[/droid [\d\.]+; (fp\du?)(?: b|\))/i],[Ie,[Te,"Fairphone"],[xe,yt]],[/(shield[\w ]+) b/i],[Ie,[Te,"Nvidia"],[xe,bn]],[/(sprint) (\w+)/i],[Te,Ie,[xe,yt]],[/(kin\.[onetw]{3})/i],[[Ie,/\./g," "],[Te,Zp],[xe,yt]],[/droid.+; ([c6]+|et5[16]|mc[239][23]x?|vc8[03]x?)\)/i],[Ie,[Te,_1],[xe,bn]],[/droid.+; (ec30|ps20|tc[2-8]\d[kx])\)/i],[Ie,[Te,_1],[xe,yt]],[/smart-tv.+(samsung)/i],[Te,[xe,Er]],[/hbbtv.+maple;(\d+)/i],[[Ie,/^/,"SmartTV"],[Te,bf],[xe,Er]],[/(nux; netcast.+smarttv|lg (netcast\.tv-201\d|android tv))/i],[[Te,v1],[xe,Er]],[/(apple) ?tv/i],[Te,[Ie,_f+" TV"],[xe,Er]],[/crkey.*devicetype\/chromecast/i],[[Ie,za+" Third Generation"],[Te,Bs],[xe,Er]],[/crkey.*devicetype\/([^/]*)/i],[[Ie,/^/,"Chromecast "],[Te,Bs],[xe,Er]],[/fuchsia.*crkey/i],[[Ie,za+" Nest Hub"],[Te,Bs],[xe,Er]],[/crkey/i],[[Ie,za],[Te,Bs],[xe,Er]],[/droid.+aft(\w+)( bui|\))/i],[Ie,[Te,Vp],[xe,Er]],[/\(dtv[\);].+(aquos)/i,/(aquos-tv[\w ]+)\)/i],[Ie,[Te,_T],[xe,Er]],[/(bravia[\w ]+)( bui|\))/i],[Ie,[Te,Yp],[xe,Er]],[/(mitv-\w{5}) bui/i],[Ie,[Te,y1],[xe,Er]],[/Hbbtv.*(technisat) (.*);/i],[Te,Ie,[xe,Er]],[/\b(roku)[\dx]*[\)\/]((?:dvp-)?[\d\.]*)/i,/hbbtv\/\d+\.\d+\.\d+ +\([\w\+ ]*; *([\w\d][^;]*);([^;]*)/i],[[Te,Ef],[Ie,Ef],[xe,Er]],[/\b(android tv|smart[- ]?tv|opera tv|tv; rv:)\b/i],[[xe,Er]],[/(ouya)/i,/(nintendo) (\w+)/i],[Te,Ie,[xe,ou]],[/droid.+; (shield) bui/i],[Ie,[Te,"Nvidia"],[xe,ou]],[/(playstation \w+)/i],[Ie,[Te,Yp],[xe,ou]],[/\b(xbox(?: one)?(?!; xbox))[\); ]/i],[Ie,[Te,Zp],[xe,ou]],[/\b(sm-[lr]\d\d[05][fnuw]?s?)\b/i],[Ie,[Te,bf],[xe,vf]],[/((pebble))app/i],[Te,Ie,[xe,vf]],[/(watch)(?: ?os[,\/]|\d,\d\/)[\d\.]+/i],[Ie,[Te,_f],[xe,vf]],[/droid.+; (wt63?0{2,3})\)/i],[Ie,[Te,_1],[xe,vf]],[/droid.+; (glass) \d/i],[Ie,[Te,Bs],[xe,f1]],[/(pico) (4|neo3(?: link|pro)?)/i],[Te,Ie,[xe,f1]],[/; (quest( \d| pro)?)/i],[Ie,[Te,ST],[xe,f1]],[/(tesla)(?: qtcarbrowser|\/[-\w\.]+)/i],[Te,[xe,d1]],[/(aeobc)\b/i],[Ie,[Te,Vp],[xe,d1]],[/droid .+?; ([^;]+?)(?: bui|; wv\)|\) applew).+? mobile safari/i],[Ie,[xe,yt]],[/droid .+?; ([^;]+?)(?: bui|\) applew).+?(?! mobile) safari/i],[Ie,[xe,bn]],[/\b((tablet|tab)[;\/]|focus\/\d(?!.+mobile))/i],[[xe,bn]],[/(phone|mobile(?:[;\/]| [ \w\/\.]*safari)|pda(?=.+windows ce))/i],[[xe,yt]],[/(android[-\w\. ]{0,9});.+buil/i],[Ie,[Te,"Generic"]]],engine:[[/windows.+ edge\/([\w\.]+)/i],[Ae,[Ce,wZ+"HTML"]],[/(arkweb)\/([\w\.]+)/i],[Ce,Ae],[/webkit\/537\.36.+chrome\/(?!27)([\w\.]+)/i],[Ae,[Ce,"Blink"]],[/(presto)\/([\w\.]+)/i,/(webkit|trident|netfront|netsurf|amaya|lynx|w3m|goanna|servo)\/([\w\.]+)/i,/ekioh(flow)\/([\w\.]+)/i,/(khtml|tasman|links)[\/ ]\(?([\w\.]+)/i,/(icab)[\/ ]([23]\.[\d\.]+)/i,/\b(libweb)/i],[Ce,Ae],[/rv\:([\w\.]{1,9})\b.+(gecko)/i],[Ae,Ce]],os:[[/microsoft (windows) (vista|xp)/i],[Ce,Ae],[/(windows (?:phone(?: os)?|mobile))[\/ ]?([\d\.\w ]*)/i],[Ce,[Ae,kf,CT]],[/windows nt 6\.2; (arm)/i,/windows[\/ ]?([ntce\d\. ]+\w)(?!.+xbox)/i,/(?:win(?=3|9|n)|win 9x )([nt\d\.]+)/i],[[Ae,kf,CT],[Ce,b1]],[/ip[honead]{2,4}\b(?:.*os ([\w]+) like mac|; opera)/i,/(?:ios;fbsv\/|iphone.+ios[\/ ])([\d\.]+)/i,/cfnetwork\/.+darwin/i],[[Ae,/_/g,"."],[Ce,"iOS"]],[/(mac os x) ?([\w\. ]*)/i,/(macintosh|mac_powerpc\b)(?!.+haiku)/i],[[Ce,"macOS"],[Ae,/_/g,"."]],[/android ([\d\.]+).*crkey/i],[Ae,[Ce,za+" Android"]],[/fuchsia.*crkey\/([\d\.]+)/i],[Ae,[Ce,za+" Fuchsia"]],[/crkey\/([\d\.]+).*devicetype\/smartspeaker/i],[Ae,[Ce,za+" SmartSpeaker"]],[/linux.*crkey\/([\d\.]+)/i],[Ae,[Ce,za+" Linux"]],[/crkey\/([\d\.]+)/i],[Ae,[Ce,za]],[/droid ([\w\.]+)\b.+(android[- ]x86|harmonyos)/i],[Ae,Ce],[/(android|webos|qnx|bada|rim tablet os|maemo|meego|sailfish|openharmony)[-\/ ]?([\w\.]*)/i,/(blackberry)\w*\/([\w\.]*)/i,/(tizen|kaios)[\/ ]([\w\.]+)/i,/\((series40);/i],[Ce,Ae],[/\(bb(10);/i],[Ae,[Ce,gT]],[/(?:symbian ?os|symbos|s60(?=;)|series60)[-\/ ]?([\w\.]*)/i],[Ae,[Ce,"Symbian"]],[/mozilla\/[\d\.]+ \((?:mobile|tablet|tv|mobile; [\w ]+); rv:.+ gecko\/([\w\.]+)/i],[Ae,[Ce,wf+" OS"]],[/web0s;.+rt(tv)/i,/\b(?:hp)?wos(?:browser)?\/([\w\.]+)/i],[Ae,[Ce,"webOS"]],[/watch(?: ?os[,\/]|\d,\d\/)([\d\.]+)/i],[Ae,[Ce,"watchOS"]],[/(cros) [\w]+(?:\)| ([\w\.]+)\b)/i],[[Ce,"Chrome OS"],Ae],[/panasonic;(viera)/i,/(netrange)mmh/i,/(nettv)\/(\d+\.[\w\.]+)/i,/(nintendo|playstation) (\w+)/i,/(xbox); +xbox ([^\);]+)/i,/(pico) .+os([\w\.]+)/i,/\b(joli|palm)\b ?(?:os)?\/?([\w\.]*)/i,/(mint)[\/\(\) ]?(\w*)/i,/(mageia|vectorlinux)[; ]/i,/([kxln]?ubuntu|debian|suse|opensuse|gentoo|arch(?= linux)|slackware|fedora|mandriva|centos|pclinuxos|red ?hat|zenwalk|linpus|raspbian|plan 9|minix|risc os|contiki|deepin|manjaro|elementary os|sabayon|linspire)(?: gnu\/linux)?(?: enterprise)?(?:[- ]linux)?(?:-gnu)?[-\/ ]?(?!chrom|package)([-\w\.]*)/i,/(hurd|linux) ?([\w\.]*)/i,/(gnu) ?([\w\.]*)/i,/\b([-frentopcghs]{0,5}bsd|dragonfly)[\/ ]?(?!amd|[ix346]{1,2}86)([\w\.]*)/i,/(haiku) (\w+)/i],[Ce,Ae],[/(sunos) ?([\w\.\d]*)/i],[[Ce,"Solaris"],Ae],[/((?:open)?solaris)[-\/ ]?([\w\.]*)/i,/(aix) ((\d)(?=\.|\)| )[\w\.])*/i,/\b(beos|os\/2|amigaos|morphos|openvms|fuchsia|hp-ux|serenityos)/i,/(unix) ?([\w\.]*)/i],[Ce,Ae]]},Qp=function(){var e={init:{},isIgnore:{},isIgnoreRgx:{},toString:{}};return Wo.call(e.init,[[ti,[Ce,Ae,mf,xe]],[Vo,[zr]],[po,[xe,Ie,Te]],[Zo,[Ce,Ae]],[_i,[Ce,Ae]]]),Wo.call(e.isIgnore,[[ti,[Ae,mf]],[Zo,[Ae]],[_i,[Ae]]]),Wo.call(e.isIgnoreRgx,[[ti,/ ?browser$/i],[_i,/ ?os$/i]]),Wo.call(e.toString,[[ti,[Ce,Ae]],[Vo,[zr]],[po,[Te,Ie]],[Zo,[Ce,Ae]],[_i,[Ce,Ae]]]),e}(),EZ=function(e,t){var n=Qp.init[t],r=Qp.isIgnore[t]||0,i=Qp.isIgnoreRgx[t]||0,o=Qp.toString[t]||0;function s(){Wo.call(this,n)}return s.prototype.getItem=function(){return e},s.prototype.withClientHints=function(){return qa?qa.getHighEntropyValues(hT).then(function(u){return e.setCH(new AT(u,!1)).parseCH().get()}):e.parseCH().get()},s.prototype.withFeatureCheck=function(){return e.detectFeature().get()},t!=su&&(s.prototype.is=function(u){var c=!1;for(var d in this)if(this.hasOwnProperty(d)&&!S1(r,d)&&Yo(i?Fs(i,this[d]):this[d])==Yo(i?Fs(i,u):u)){if(c=!0,u!=Fa)break}else if(u==Fa&&c){c=!c;break}return c},s.prototype.toString=function(){var u=ru;for(var c in o)typeof this[o[c]]!==Fa&&(u+=(u?" ":ru)+this[o[c]]);return u||Fa}),qa||(s.prototype.then=function(u){var c=this,d=function(){for(var h in c)c.hasOwnProperty(h)&&(this[h]=c[h])};d.prototype={is:s.prototype.is,toString:s.prototype.toString};var p=new d;return u(p),p}),new s};function AT(e,t){if(e=e||{},Wo.call(this,hT),t)Wo.call(this,[[p1,w1(e[Ua])],[g1,w1(e[pZ])],[yt,/\?1/.test(e[yZ])],[Ie,Cf(e[_Z])],[au,Cf(e[dT])],[m1,Cf(e[bZ])],[zr,Cf(e[gZ])],[Ps,w1(e[vZ])],[Gp,Cf(e[mZ])]]);else for(var n in e)this.hasOwnProperty(n)&&typeof e[n]!==Fa&&(this[n]=e[n])}function IT(e,t,n,r){return this.get=function(i){return i?this.data.hasOwnProperty(i)?this.data[i]:void 0:this.data},this.set=function(i,o){return this.data[i]=o,this},this.setCH=function(i){return this.uaCH=i,this},this.detectFeature=function(){if(qr&&qr.userAgent==this.ua)switch(this.itemType){case ti:qr.brave&&typeof qr.brave.isBrave==Hp&&this.set(Ce,"Brave");break;case po:!this.get(xe)&&qa&&qa[yt]&&this.set(xe,yt),this.get(Ie)=="Macintosh"&&qr&&typeof qr.standalone!==Fa&&qr.maxTouchPoints&&qr.maxTouchPoints>2&&this.set(Ie,"iPad").set(xe,bn);break;case _i:!this.get(Ce)&&qa&&qa[au]&&this.set(Ce,qa[au]);break;case su:var i=this.data,o=function(s){return i[s].getItem().detectFeature().get()};this.set(ti,o(ti)).set(Vo,o(Vo)).set(po,o(po)).set(Zo,o(Zo)).set(_i,o(_i))}return this},this.parseUA=function(){return this.itemType!=su&&xT.call(this.data,this.ua,this.rgxMap),this.itemType==ti&&this.set(mf,x1(this.get(Ae))),this},this.parseCH=function(){var i=this.uaCH,o=this.rgxMap;switch(this.itemType){case ti:var s=i[g1]||i[p1],u;if(s)for(var c in s){var d=Fs(/(Google|Microsoft) /,s[c].brand||s[c]),p=s[c].version;!/not.a.brand/i.test(d)&&(!u||/chrom/i.test(u)&&!/chromi/i.test(d))&&(this.set(Ce,d).set(Ae,p).set(mf,x1(p)),u=d)}break;case Vo:var h=i[zr];h&&(h&&i[Gp]=="64"&&(h+="64"),xT.call(this.data,h+";",o));break;case po:if(i[yt]&&this.set(xe,yt),i[Ie]&&this.set(Ie,i[Ie]),i[Ie]=="Xbox"&&this.set(xe,ou).set(Te,Zp),i[Ps]){var m;if(typeof i[Ps]!="string")for(var v=0;!m&&v<i[Ps].length;)m=kf(i[Ps][v++],ET);else m=kf(i[Ps],ET);this.set(xe,m)}break;case _i:var _=i[au];if(_){var x=i[m1];_==b1&&(x=parseInt(x1(x),10)>=13?"11":"10"),this.set(Ce,_).set(Ae,x)}this.get(Ce)==b1&&i[Ie]=="Xbox"&&this.set(Ce,"Xbox").set(Ae,void 0);break;case su:var b=this.data,w=function(C){return b[C].getItem().setCH(i).parseCH().get()};this.set(ti,w(ti)).set(Vo,w(Vo)).set(po,w(po)).set(Zo,w(Zo)).set(_i,w(_i))}return this},Wo.call(this,[["itemType",e],["ua",t],["uaCH",r],["rgxMap",n],["data",EZ(this,e)]]),this}function Ko(e,t,n){if(typeof e===iu?(Kp(e,!0)?(typeof t===iu&&(n=t),t=e):(n=e,t=void 0),e=void 0):typeof e===c1&&!Kp(t,!0)&&(n=t,t=void 0),n&&typeof n.append===Hp){var r={};n.forEach(function(c,d){r[d]=c}),n=r}if(!(this instanceof Ko))return new Ko(e,t,n).getResult();var i=typeof e===c1?e:n&&n[fT]?n[fT]:qr&&qr.userAgent?qr.userAgent:ru,o=new AT(n,!0),s=t?CZ(kT,t):kT,u=function(c){return c==su?function(){return new IT(c,i,s,o).set("ua",i).set(ti,this.getBrowser()).set(Vo,this.getCPU()).set(po,this.getDevice()).set(Zo,this.getEngine()).set(_i,this.getOS()).get()}:function(){return new IT(c,i,s[c],o).parseUA().get()}};return Wo.call(this,[["getBrowser",u(ti)],["getCPU",u(Vo)],["getDevice",u(po)],["getEngine",u(Zo)],["getOS",u(_i)],["getResult",u(su)],["getUA",function(){return i}],["setUA",function(c){return uu(c)&&(i=c.length>h1?Ef(c,h1):c),this}]]).setUA(i),this}Ko.VERSION=hZ,Ko.BROWSER=Wp([Ce,Ae,mf,xe]),Ko.CPU=Wp([zr]),Ko.DEVICE=Wp([Ie,Te,xe,ou,yt,Er,bn,vf,d1]),Ko.ENGINE=Ko.OS=Wp([Ce,Ae]);const ki=class ki{constructor(t){tr(this,"config");tr(this,"storedData");tr(this,"deviceInfo");tr(this,"localStorageKey","_dsjfs312313kj3debales_analytics_");this.config=t,this.deviceInfo=this.getDeviceInfo(),this.localStorageKey=t.localStorageKey||this.localStorageKey+this.config.projectName,this.config.testing=t.testing||(()=>!1);const n=localStorage.getItem(this.localStorageKey);if(n)this.storedData=JSON.parse(n),this.config.debug&&console.log("Using Existing Stored data:",this.storedData);else{const r=crypto.randomUUID();this.storedData={projectName:this.config.projectName,anonId:r,distinctId:r},this.config.debug&&console.log("Using New Stored data:",this.storedData),this.updateStorage()}this.config.debug&&console.log("Analytics initialized:",this.storedData)}static init(t){ki.instance||(ki.instance=new ki(t))}static getInstance(){if(!ki.instance)throw new Error("DebalesAnalytics is not initialized. Call init() first.");return ki.instance}static async identify(t,n){return ki.getInstance().identifyInternal(t,n)}static track(t,n){ki.getInstance().trackInternal(t,n)}static getDistinctId(){return ki.getInstance().storedData.distinctId}static getAnonId(){return ki.getInstance().storedData.anonId}async identifyInternal(t,n){try{if(this.config.testing&&this.config.testing())return;let r,i,o;if(n){const{name:c,phone:d,...p}=n;r=c,i=d,o=p}const s={distinctId:this.storedData.distinctId,anonId:[this.storedData.anonId],projectName:this.config.projectName,email:t,name:r,phone:i,properties:o},u=await this.sendRequest("/api/analytic/identify",s);u&&u.success&&u.distinctId&&(this.config.debug&&console.log("identify success new distint id"),this.storedData.distinctId=u.distinctId,this.storedData.email=t,this.updateStorage(),u.isIdentified&&this.trackInternal("identify")),this.config.debug&&console.log("Identify event sent:",s)}catch(r){console.error("Failed to identify user:",r)}}trackInternal(t,n){if(this.config.testing&&this.config.testing())return;const r={projectName:this.config.projectName,distinctId:this.storedData.distinctId,anonId:this.storedData.anonId,eventName:t,osVersion:this.deviceInfo.osVersion,browserVersion:this.deviceInfo.browserVersion,operatingSystem:this.deviceInfo.os,browser:this.deviceInfo.browser,currentUrl:window.location.href,chatId:ur()+this.config.projectName,properties:n};this.sendRequest("/api/analytic/track",r),this.config.debug&&console.log("Track event sent:",r)}updateStorage(){localStorage.setItem(this.localStorageKey,JSON.stringify(this.storedData))}async sendRequest(t,n){try{const r=await fetch(`${fo}${t}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)});if(!r.ok)throw new Error(`HTTP error! status: ${r.status}`);return await r.json()}catch(r){console.error("Failed to send analytics data:",r)}}getDeviceInfo(){const n=new Ko().getResult();return{browser:n.browser.name,os:n.os.name,browserVersion:n.browser.version,osVersion:n.os.version}}};tr(ki,"instance",null);let C1=ki;const Us=C1;var Hi,ce=typeof window<"u"?window:void 0,jr=typeof globalThis<"u"?globalThis:ce,RT=Array.prototype,OT=RT.forEach,TT=RT.indexOf,ni=jr==null?void 0:jr.navigator,He=jr==null?void 0:jr.document,Hr=jr==null?void 0:jr.location,E1=jr==null?void 0:jr.fetch,k1=jr!=null&&jr.XMLHttpRequest&&"withCredentials"in new jr.XMLHttpRequest?jr.XMLHttpRequest:void 0,MT=jr==null?void 0:jr.AbortController,qn=ni==null?void 0:ni.userAgent,pt=ce??{},Qo={DEBUG:!1,LIB_VERSION:"1.235.0"},A1="$copy_autocapture",kZ=["$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(e){e.GZipJS="gzip-js",e.Base64="base64"})(Hi||(Hi={}));var AZ=["fatal","error","warning","log","info","debug"];function kt(e,t){return e.indexOf(t)!==-1}var Xp=function(e){return e.trim()},I1=function(e){return e.replace(/^\$/,"")},IZ=Array.isArray,DT=Object.prototype,$T=DT.hasOwnProperty,Jp=DT.toString,kn=IZ||function(e){return Jp.call(e)==="[object Array]"},Gi=e=>typeof e=="function",An=e=>e===Object(e)&&!kn(e),cu=e=>{if(An(e)){for(var t in e)if($T.call(e,t))return!1;return!0}return!1},Be=e=>e===void 0,jn=e=>Jp.call(e)=="[object String]",R1=e=>jn(e)&&e.trim().length===0,ja=e=>e===null,Wt=e=>Be(e)||ja(e),Dr=e=>Jp.call(e)=="[object Number]",Ha=e=>Jp.call(e)==="[object Boolean]",RZ=e=>e instanceof FormData,OZ=e=>kt(kZ,e),LT=e=>{var t={_log:function(n){if(ce&&(Qo.DEBUG||pt.POSTHOG_DEBUG)&&!Be(ce.console)&&ce.console){for(var r=("__rrweb_original__"in ce.console[n])?ce.console[n].__rrweb_original__:ce.console[n],i=arguments.length,o=new Array(i>1?i-1:0),s=1;s<i;s++)o[s-1]=arguments[s];r(e,...o)}},info:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];t._log("log",...r)},warn:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];t._log("warn",...r)},error:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];t._log("error",...r)},critical:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];console.error(e,...r)},uninitializedWarning:n=>{t.error("You must initialize PostHog before calling ".concat(n))},createLogger:n=>LT("".concat(e," ").concat(n))};return t},Qe=LT("[PostHog.js]"),kr=Qe.createLogger,TZ=kr("[ExternalScriptsLoader]"),NT=(e,t,n)=>{if(e.config.disable_external_dependency_loading)return TZ.warn("".concat(t," was requested but loading of external scripts is disabled.")),n("Loading of external scripts is disabled");var r=He==null?void 0:He.querySelectorAll("script");if(r){for(var i=0;i<r.length;i++)if(r[i].src===t)return n()}var o=()=>{if(!He)return n("document not found");var s=He.createElement("script");if(s.type="text/javascript",s.crossOrigin="anonymous",s.src=t,s.onload=d=>n(void 0,d),s.onerror=d=>n(d),e.config.prepare_external_dependency_script&&(s=e.config.prepare_external_dependency_script(s)),!s)return n("prepare_external_dependency_script returned null");var u,c=He.querySelectorAll("body > script");c.length>0?(u=c[0].parentNode)===null||u===void 0||u.insertBefore(s,c[0]):He.body.appendChild(s)};He!=null&&He.body?o():He==null||He.addEventListener("DOMContentLoaded",o)};function PT(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function pe(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?PT(Object(n),!0).forEach(function(r){Me(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):PT(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function Me(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function BT(e,t){if(e==null)return{};var n,r,i=function(s,u){if(s==null)return{};var c,d,p={},h=Object.keys(s);for(d=0;d<h.length;d++)c=h[d],u.indexOf(c)>=0||(p[c]=s[c]);return p}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}pt.__PosthogExtensions__=pt.__PosthogExtensions__||{},pt.__PosthogExtensions__.loadExternalDependency=(e,t,n)=>{var r="/static/".concat(t,".js")+"?v=".concat(e.version);if(t==="remote-config"&&(r="/array/".concat(e.config.token,"/config.js")),t==="toolbar"){var i=3e5,o=Math.floor(Date.now()/i)*i;r="".concat(r,"&t=").concat(o)}var s=e.requestRouter.endpointFor("assets",r);NT(e,s,n)},pt.__PosthogExtensions__.loadSiteApp=(e,t,n)=>{var r=e.requestRouter.endpointFor("api",t);NT(e,r,n)};var eg={};function Ga(e,t,n){if(kn(e)){if(OT&&e.forEach===OT)e.forEach(t,n);else if("length"in e&&e.length===+e.length){for(var r=0,i=e.length;r<i;r++)if(r in e&&t.call(n,e[r],r)===eg)return}}}function rn(e,t,n){if(!Wt(e)){if(kn(e))return Ga(e,t,n);if(RZ(e)){for(var r of e.entries())if(t.call(n,r[1],r[0])===eg)return}else for(var i in e)if($T.call(e,i)&&t.call(n,e[i],i)===eg)return}}var Hn=function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return Ga(n,function(i){for(var o in i)i[o]!==void 0&&(e[o]=i[o])}),e},tg=function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return Ga(n,function(i){Ga(i,function(o){e.push(o)})}),e};function ng(e){for(var t=Object.keys(e),n=t.length,r=new Array(n);n--;)r[n]=[t[n],e[t[n]]];return r}var FT=function(e){try{return e()}catch{return}},MZ=function(e){return function(){try{for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return e.apply(this,n)}catch(i){Qe.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),Qe.critical(i)}}},Af=function(e){var t={};return rn(e,function(n,r){jn(n)&&n.length>0&&(t[r]=n)}),t};function DZ(e,t){return n=e,r=o=>jn(o)&&!ja(t)?o.slice(0,t):o,i=new Set,function o(s,u){return s!==Object(s)?r?r(s,u):s:i.has(s)?void 0:(i.add(s),kn(s)?(c=[],Ga(s,d=>{c.push(o(d))})):(c={},rn(s,(d,p)=>{i.has(d)||(c[p]=o(d,p))})),c);var c}(n);var n,r,i}var $Z=["herokuapp.com","vercel.app","netlify.app"];function LZ(e){var t=e==null?void 0:e.hostname;if(!jn(t))return!1;var n=t.split(".").slice(-2).join(".");for(var r of $Z)if(n===r)return!1;return!0}function UT(e,t){for(var n=0;n<e.length;n++)if(t(e[n]))return e[n]}function $n(e,t,n,r){var{capture:i=!1,passive:o=!0}=r??{};e==null||e.addEventListener(t,n,{capture:i,passive:o})}var zT="$people_distinct_id",If="__alias",Rf="__timers",qT="$autocapture_disabled_server_side",O1="$heatmaps_enabled_server_side",jT="$exception_capture_enabled_server_side",HT="$web_vitals_enabled_server_side",GT="$dead_clicks_enabled_server_side",VT="$web_vitals_allowed_metrics",T1="$session_recording_enabled_server_side",ZT="$console_log_recording_enabled_server_side",YT="$session_recording_network_payload_capture",WT="$session_recording_masking",KT="$session_recording_canvas_recording",QT="$replay_sample_rate",XT="$replay_minimum_duration",JT="$replay_script_config",rg="$sesid",Of="$session_is_sampled",M1="$session_recording_url_trigger_activated_session",D1="$session_recording_event_trigger_activated_session",fu="$enabled_feature_flags",ig="$early_access_features",$1="$feature_flag_details",Tf="$stored_person_properties",zs="$stored_group_properties",L1="$surveys",og="$surveys_activated",ag="$flag_call_reported",Xo="$user_state",N1="$client_session_props",P1="$capture_rate_limit",B1="$initial_campaign_params",F1="$initial_referrer_info",U1="$initial_person_info",sg="$epp",eM="__POSTHOG_TOOLBAR__",tM="$posthog_cookieless",NZ=[zT,If,"__cmpns",Rf,T1,O1,rg,fu,Xo,ig,$1,zs,Tf,L1,ag,N1,P1,B1,F1,sg];function nM(e){var t;return e instanceof Element&&(e.id===eM||!((t=e.closest)===null||t===void 0||!t.call(e,".toolbar-global-fade-container")))}function lg(e){return!!e&&e.nodeType===1}function Va(e,t){return!!e&&!!e.tagName&&e.tagName.toLowerCase()===t.toLowerCase()}function rM(e){return!!e&&e.nodeType===3}function iM(e){return!!e&&e.nodeType===11}function z1(e){return e?Xp(e).split(/\s+/):[]}function oM(e){var t=ce==null?void 0:ce.location.href;return!!(t&&e&&e.some(n=>t.match(n)))}function ug(e){var t="";switch(typeof e.className){case"string":t=e.className;break;case"object":t=(e.className&&"baseVal"in e.className?e.className.baseVal:null)||e.getAttribute("class")||"";break;default:t=""}return z1(t)}function aM(e){return Wt(e)?null:Xp(e).split(/(\s+)/).filter(t=>du(t)).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function cg(e){var t="";return j1(e)&&!uM(e)&&e.childNodes&&e.childNodes.length&&rn(e.childNodes,function(n){var r;rM(n)&&n.textContent&&(t+=(r=aM(n.textContent))!==null&&r!==void 0?r:"")}),Xp(t)}function sM(e){return Be(e.target)?e.srcElement||null:(t=e.target)!==null&&t!==void 0&&t.shadowRoot?e.composedPath()[0]||null:e.target||null;var t}var q1=["a","button","form","input","select","textarea","label"];function lM(e){var t=e.parentNode;return!(!t||!lg(t))&&t}function PZ(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:void 0,r=arguments.length>3?arguments[3]:void 0,i=arguments.length>4?arguments[4]:void 0;if(!ce||!e||Va(e,"html")||!lg(e)||n!=null&&n.url_allowlist&&!oM(n.url_allowlist)||n!=null&&n.url_ignorelist&&oM(n.url_ignorelist))return!1;if(n!=null&&n.dom_event_allowlist){var o=n.dom_event_allowlist;if(o&&!o.some(v=>t.type===v))return!1}for(var s=!1,u=[e],c=!0,d=e;d.parentNode&&!Va(d,"body");)if(iM(d.parentNode))u.push(d.parentNode.host),d=d.parentNode.host;else{if(!(c=lM(d)))break;if(r||q1.indexOf(c.tagName.toLowerCase())>-1)s=!0;else{var p=ce.getComputedStyle(c);p&&p.getPropertyValue("cursor")==="pointer"&&(s=!0)}u.push(c),d=c}if(!function(v,_){var x=_==null?void 0:_.element_allowlist;if(Be(x))return!0;var b=function(E){if(x.some(R=>E.tagName.toLowerCase()===R))return{v:!0}};for(var w of v){var C=b(w);if(typeof C=="object")return C.v}return!1}(u,n)||!function(v,_){var x=_==null?void 0:_.css_selector_allowlist;if(Be(x))return!0;var b=function(E){if(x.some(R=>E.matches(R)))return{v:!0}};for(var w of v){var C=b(w);if(typeof C=="object")return C.v}return!1}(u,n))return!1;var h=ce.getComputedStyle(e);if(h&&h.getPropertyValue("cursor")==="pointer"&&t.type==="click")return!0;var m=e.tagName.toLowerCase();switch(m){case"html":return!1;case"form":return(i||["submit"]).indexOf(t.type)>=0;case"input":case"select":case"textarea":return(i||["change","click"]).indexOf(t.type)>=0;default:return s?(i||["click"]).indexOf(t.type)>=0:(i||["click"]).indexOf(t.type)>=0&&(q1.indexOf(m)>-1||e.getAttribute("contenteditable")==="true")}}function j1(e){for(var t=e;t.parentNode&&!Va(t,"body");t=t.parentNode){var n=ug(t);if(kt(n,"ph-sensitive")||kt(n,"ph-no-capture"))return!1}if(kt(ug(e),"ph-include"))return!0;var r=e.type||"";if(jn(r))switch(r.toLowerCase()){case"hidden":case"password":return!1}var i=e.name||e.id||"";return!(jn(i)&&/^cc|cardnum|ccnum|creditcard|csc|cvc|cvv|exp|pass|pwd|routing|seccode|securitycode|securitynum|socialsec|socsec|ssn/i.test(i.replace(/[^a-zA-Z0-9]/g,"")))}function uM(e){return!!(Va(e,"input")&&!["button","checkbox","submit","reset"].includes(e.type)||Va(e,"select")||Va(e,"textarea")||e.getAttribute("contenteditable")==="true")}var cM="(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})",BZ=new RegExp("^(?:".concat(cM,")$")),FZ=new RegExp(cM),fM="\\d{3}-?\\d{2}-?\\d{4}",UZ=new RegExp("^(".concat(fM,")$")),zZ=new RegExp("(".concat(fM,")"));function du(e){var t=!(arguments.length>1&&arguments[1]!==void 0)||arguments[1];return!(Wt(e)||jn(e)&&(e=Xp(e),(t?BZ:FZ).test((e||"").replace(/[- ]/g,""))||(t?UZ:zZ).test(e)))}function dM(e){var t=cg(e);return du(t="".concat(t," ").concat(hM(e)).trim())?t:""}function hM(e){var t="";return e&&e.childNodes&&e.childNodes.length&&rn(e.childNodes,function(n){var r;if(n&&((r=n.tagName)===null||r===void 0?void 0:r.toLowerCase())==="span")try{var i=cg(n);t="".concat(t," ").concat(i).trim(),n.childNodes&&n.childNodes.length&&(t="".concat(t," ").concat(hM(n)).trim())}catch(o){Qe.error("[AutoCapture]",o)}}),t}function qZ(e){return function(t){var n=t.map(r=>{var i,o,s="";if(r.tag_name&&(s+=r.tag_name),r.attr_class)for(var u of(r.attr_class.sort(),r.attr_class))s+=".".concat(u.replace(/"/g,""));var c=pe(pe(pe(pe({},r.text?{text:r.text}:{}),{},{"nth-child":(i=r.nth_child)!==null&&i!==void 0?i:0,"nth-of-type":(o=r.nth_of_type)!==null&&o!==void 0?o:0},r.href?{href:r.href}:{}),r.attr_id?{attr_id:r.attr_id}:{}),r.attributes),d={};return ng(c).sort((p,h)=>{var[m]=p,[v]=h;return m.localeCompare(v)}).forEach(p=>{var[h,m]=p;return d[pM(h.toString())]=pM(m.toString())}),s+=":",s+=ng(c).map(p=>{var[h,m]=p;return"".concat(h,'="').concat(m,'"')}).join("")});return n.join(";")}(function(t){return t.map(n=>{var r,i,o={text:(r=n.$el_text)===null||r===void 0?void 0:r.slice(0,400),tag_name:n.tag_name,href:(i=n.attr__href)===null||i===void 0?void 0:i.slice(0,2048),attr_class:jZ(n),attr_id:n.attr__id,nth_child:n.nth_child,nth_of_type:n.nth_of_type,attributes:{}};return ng(n).filter(s=>{var[u]=s;return u.indexOf("attr__")===0}).forEach(s=>{var[u,c]=s;return o.attributes[u]=c}),o})}(e))}function pM(e){return e.replace(/"|\\"/g,'\\"')}function jZ(e){var t=e.attr__class;return t?kn(t)?t:z1(t):void 0}class gM{constructor(){this.clicks=[]}isRageClick(t,n,r){var i=this.clicks[this.clicks.length-1];if(i&&Math.abs(t-i.x)+Math.abs(n-i.y)<30&&r-i.timestamp<1e3){if(this.clicks.push({x:t,y:n,timestamp:r}),this.clicks.length===3)return!0}else this.clicks=[{x:t,y:n,timestamp:r}];return!1}}var HZ=["localhost","127.0.0.1"],hu=e=>{var t=He==null?void 0:He.createElement("a");return Be(t)?null:(t.href=e,t)},GZ=function(e){var t,n,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"&",i=[];return rn(e,function(o,s){Be(o)||Be(s)||s==="undefined"||(t=encodeURIComponent((u=>u instanceof File)(o)?o.name:o.toString()),n=encodeURIComponent(s),i[i.length]=n+"="+t)}),i.join(r)},fg=function(e,t){for(var n,r=((e.split("#")[0]||"").split(/\?(.*)/)[1]||"").replace(/^\?+/g,"").split("&"),i=0;i<r.length;i++){var o=r[i].split("=");if(o[0]===t){n=o;break}}if(!kn(n)||n.length<2)return"";var s=n[1];try{s=decodeURIComponent(s)}catch{Qe.error("Skipping decoding for malformed query param: "+s)}return s.replace(/\+/g," ")},H1=function(e,t,n){if(!e||!t||!t.length)return e;for(var r=e.split("#"),i=r[0]||"",o=r[1],s=i.split("?"),u=s[1],c=s[0],d=(u||"").split("&"),p=[],h=0;h<d.length;h++){var m=d[h].split("=");kn(m)&&(t.includes(m[0])?p.push(m[0]+"="+n):p.push(d[h]))}var v=c;return u!=null&&(v+="?"+p.join("&")),o!=null&&(v+="#"+o),v},dg=function(e,t){var n=e.match(new RegExp(t+"=([^&]*)"));return n?n[1]:null},mM=kr("[AutoCapture]");function G1(e,t){return t.length>e?t.slice(0,e)+"...":t}function VZ(e){if(e.previousElementSibling)return e.previousElementSibling;var t=e;do t=t.previousSibling;while(t&&!lg(t));return t}function ZZ(e,t,n,r){var i=e.tagName.toLowerCase(),o={tag_name:i};q1.indexOf(i)>-1&&!n&&(i.toLowerCase()==="a"||i.toLowerCase()==="button"?o.$el_text=G1(1024,dM(e)):o.$el_text=G1(1024,cg(e)));var s=ug(e);s.length>0&&(o.classes=s.filter(function(p){return p!==""})),rn(e.attributes,function(p){var h;if((!uM(e)||["name","id","class","aria-label"].indexOf(p.name)!==-1)&&(r==null||!r.includes(p.name))&&!t&&du(p.value)&&(h=p.name,!jn(h)||h.substring(0,10)!=="_ngcontent"&&h.substring(0,7)!=="_nghost")){var m=p.value;p.name==="class"&&(m=z1(m).join(" ")),o["attr__"+p.name]=G1(1024,m)}});for(var u=1,c=1,d=e;d=VZ(d);)u++,d.tagName===e.tagName&&c++;return o.nth_child=u,o.nth_of_type=c,o}function YZ(e,t){for(var n,r,{e:i,maskAllElementAttributes:o,maskAllText:s,elementAttributeIgnoreList:u,elementsChainAsString:c}=t,d=[e],p=e;p.parentNode&&!Va(p,"body");)iM(p.parentNode)?(d.push(p.parentNode.host),p=p.parentNode.host):(d.push(p.parentNode),p=p.parentNode);var h,m=[],v={},_=!1,x=!1;if(rn(d,R=>{var O=j1(R);R.tagName.toLowerCase()==="a"&&(_=R.getAttribute("href"),_=O&&_&&du(_)&&_),kt(ug(R),"ph-no-capture")&&(x=!0),m.push(ZZ(R,o,s,u));var T=function(L){if(!j1(L))return{};var B={};return rn(L.attributes,function(z){if(z.name&&z.name.indexOf("data-ph-capture-attribute")===0){var P=z.name.replace("data-ph-capture-attribute-",""),V=z.value;P&&V&&du(V)&&(B[P]=V)}}),B}(R);Hn(v,T)}),x)return{props:{},explicitNoCapture:x};if(s||(e.tagName.toLowerCase()==="a"||e.tagName.toLowerCase()==="button"?m[0].$el_text=dM(e):m[0].$el_text=cg(e)),_){var b,w;m[0].attr__href=_;var C=(b=hu(_))===null||b===void 0?void 0:b.host,E=ce==null||(w=ce.location)===null||w===void 0?void 0:w.host;C&&E&&C!==E&&(h=_)}return{props:Hn({$event_type:i.type,$ce_version:1},c?{}:{$elements:m},{$elements_chain:qZ(m)},(n=m[0])!==null&&n!==void 0&&n.$el_text?{$el_text:(r=m[0])===null||r===void 0?void 0:r.$el_text}:{},h&&i.type==="click"?{$external_click_url:h}:{},v)}}class WZ{constructor(t){Me(this,"_initialized",!1),Me(this,"_isDisabledServerSide",null),Me(this,"rageclicks",new gM),Me(this,"_elementsChainAsString",!1),this.instance=t,this._elementSelectors=null}get config(){var t,n,r=An(this.instance.config.autocapture)?this.instance.config.autocapture:{};return r.url_allowlist=(t=r.url_allowlist)===null||t===void 0?void 0:t.map(i=>new RegExp(i)),r.url_ignorelist=(n=r.url_ignorelist)===null||n===void 0?void 0:n.map(i=>new RegExp(i)),r}_addDomEventHandlers(){if(this.isBrowserSupported()){if(ce&&He){var t=r=>{r=r||(ce==null?void 0:ce.event);try{this._captureEvent(r)}catch(i){mM.error("Failed to capture event",i)}};if($n(He,"submit",t,{capture:!0}),$n(He,"change",t,{capture:!0}),$n(He,"click",t,{capture:!0}),this.config.capture_copied_text){var n=r=>{r=r||(ce==null?void 0:ce.event),this._captureEvent(r,A1)};$n(He,"copy",n,{capture:!0}),$n(He,"cut",n,{capture:!0})}}}else mM.info("Disabling Automatic Event Collection because this browser is not supported")}startIfEnabled(){this.isEnabled&&!this._initialized&&(this._addDomEventHandlers(),this._initialized=!0)}onRemoteConfig(t){t.elementsChainAsString&&(this._elementsChainAsString=t.elementsChainAsString),this.instance.persistence&&this.instance.persistence.register({[qT]:!!t.autocapture_opt_out}),this._isDisabledServerSide=!!t.autocapture_opt_out,this.startIfEnabled()}setElementSelectors(t){this._elementSelectors=t}getElementSelectors(t){var n,r=[];return(n=this._elementSelectors)===null||n===void 0||n.forEach(i=>{var o=He==null?void 0:He.querySelectorAll(i);o==null||o.forEach(s=>{t===s&&r.push(i)})}),r}get isEnabled(){var t,n,r=(t=this.instance.persistence)===null||t===void 0?void 0:t.props[qT],i=this._isDisabledServerSide;if(ja(i)&&!Ha(r)&&!this.instance.config.advanced_disable_decide)return!1;var o=(n=this._isDisabledServerSide)!==null&&n!==void 0?n:!!r;return!!this.instance.config.autocapture&&!o}_captureEvent(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"$autocapture";if(this.isEnabled){var r,i=sM(t);rM(i)&&(i=i.parentNode||null),n==="$autocapture"&&t.type==="click"&&t instanceof MouseEvent&&this.instance.config.rageclick&&(r=this.rageclicks)!==null&&r!==void 0&&r.isRageClick(t.clientX,t.clientY,new Date().getTime())&&this._captureEvent(t,"$rageclick");var o=n===A1;if(i&&PZ(i,t,this.config,o,o?["copy","cut"]:void 0)){var{props:s,explicitNoCapture:u}=YZ(i,{e:t,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(u)return!1;var c=this.getElementSelectors(i);if(c&&c.length>0&&(s.$element_selectors=c),n===A1){var d,p=aM(ce==null||(d=ce.getSelection())===null||d===void 0?void 0:d.toString()),h=t.type||"clipboard";if(!p)return!1;s.$selected_content=p,s.$copy_type=h}return this.instance.capture(n,s),!0}}}isBrowserSupported(){return Gi(He==null?void 0:He.querySelectorAll)}}Math.trunc||(Math.trunc=function(e){return e<0?Math.ceil(e):Math.floor(e)}),Number.isInteger||(Number.isInteger=function(e){return Dr(e)&&isFinite(e)&&Math.floor(e)===e});var vM="0123456789abcdef";class hg{constructor(t){if(this.bytes=t,t.length!==16)throw new TypeError("not 128-bit length")}static fromFieldsV7(t,n,r,i){if(!Number.isInteger(t)||!Number.isInteger(n)||!Number.isInteger(r)||!Number.isInteger(i)||t<0||n<0||r<0||i<0||t>0xffffffffffff||n>4095||r>1073741823||i>4294967295)throw new RangeError("invalid field value");var o=new Uint8Array(16);return o[0]=t/Math.pow(2,40),o[1]=t/Math.pow(2,32),o[2]=t/Math.pow(2,24),o[3]=t/Math.pow(2,16),o[4]=t/Math.pow(2,8),o[5]=t,o[6]=112|n>>>8,o[7]=n,o[8]=128|r>>>24,o[9]=r>>>16,o[10]=r>>>8,o[11]=r,o[12]=i>>>24,o[13]=i>>>16,o[14]=i>>>8,o[15]=i,new hg(o)}toString(){for(var t="",n=0;n<this.bytes.length;n++)t=t+vM.charAt(this.bytes[n]>>>4)+vM.charAt(15&this.bytes[n]),n!==3&&n!==5&&n!==7&&n!==9||(t+="-");if(t.length!==36)throw new Error("Invalid UUIDv7 was generated");return t}clone(){return new hg(this.bytes.slice(0))}equals(t){return this.compareTo(t)===0}compareTo(t){for(var n=0;n<16;n++){var r=this.bytes[n]-t.bytes[n];if(r!==0)return Math.sign(r)}return 0}}class KZ{constructor(){Me(this,"timestamp",0),Me(this,"counter",0),Me(this,"random",new QZ)}generate(){var t=this.generateOrAbort();if(Be(t)){this.timestamp=0;var n=this.generateOrAbort();if(Be(n))throw new Error("Could not generate UUID after timestamp reset");return n}return t}generateOrAbort(){var t=Date.now();if(t>this.timestamp)this.timestamp=t,this.resetCounter();else{if(!(t+1e4>this.timestamp))return;this.counter++,this.counter>4398046511103&&(this.timestamp++,this.resetCounter())}return hg.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())}}var yM,_M=e=>{if(typeof UUIDV7_DENY_WEAK_RNG<"u"&&UUIDV7_DENY_WEAK_RNG)throw new Error("no cryptographically strong RNG available");for(var t=0;t<e.length;t++)e[t]=65536*Math.trunc(65536*Math.random())+Math.trunc(65536*Math.random());return e};ce&&!Be(ce.crypto)&&crypto.getRandomValues&&(_M=e=>crypto.getRandomValues(e));class QZ{constructor(){Me(this,"buffer",new Uint32Array(8)),Me(this,"cursor",1/0)}nextUint32(){return this.cursor>=this.buffer.length&&(_M(this.buffer),this.cursor=0),this.buffer[this.cursor++]}}var Za=()=>XZ().toString(),XZ=()=>(yM||(yM=new KZ)).generate(),JZ="Thu, 01 Jan 1970 00:00:00 GMT",Mf="",eY=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i;function tY(e,t){if(t){var n=function(i){var o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:He;if(Mf)return Mf;if(!o||["localhost","127.0.0.1"].includes(i))return"";for(var s=i.split("."),u=Math.min(s.length,8),c="dmn_chk_"+Za(),d=new RegExp("(^|;)\\s*"+c+"=1");!Mf&&u--;){var p=s.slice(u).join("."),h=c+"=1;domain=."+p;o.cookie=h,d.test(o.cookie)&&(o.cookie=h+";expires="+JZ,Mf=p)}return Mf}(e);if(!n){var r=(i=>{var o=i.match(eY);return o?o[0]:""})(e);r!==n&&Qe.info("Warning: cookie subdomain discovery mismatch",r,n),n=r}return n?"; domain=."+n:""}return""}var Ya,Jo={is_supported:()=>!!He,error:function(e){Qe.error("cookieStore error: "+e)},get:function(e){if(He){try{for(var t=e+"=",n=He.cookie.split(";").filter(o=>o.length),r=0;r<n.length;r++){for(var i=n[r];i.charAt(0)==" ";)i=i.substring(1,i.length);if(i.indexOf(t)===0)return decodeURIComponent(i.substring(t.length,i.length))}}catch{}return null}},parse:function(e){var t;try{t=JSON.parse(Jo.get(e))||{}}catch{}return t},set:function(e,t,n,r,i){if(He)try{var o="",s="",u=tY(He.location.hostname,r);if(n){var c=new Date;c.setTime(c.getTime()+24*n*60*60*1e3),o="; expires="+c.toUTCString()}i&&(s="; secure");var d=e+"="+encodeURIComponent(JSON.stringify(t))+o+"; SameSite=Lax; path=/"+u+s;return d.length>3686.4&&Qe.warn("cookieStore warning: large cookie, len="+d.length),He.cookie=d,d}catch{return}},remove:function(e,t){try{Jo.set(e,"",-1,t)}catch{return}}},V1=null,Qn={is_supported:function(){if(!ja(V1))return V1;var e=!0;if(Be(ce))e=!1;else try{var t="__mplssupport__";Qn.set(t,"xyz"),Qn.get(t)!=='"xyz"'&&(e=!1),Qn.remove(t)}catch{e=!1}return e||Qe.error("localStorage unsupported; falling back to cookie store"),V1=e,e},error:function(e){Qe.error("localStorage error: "+e)},get:function(e){try{return ce==null?void 0:ce.localStorage.getItem(e)}catch(t){Qn.error(t)}return null},parse:function(e){try{return JSON.parse(Qn.get(e))||{}}catch{}return null},set:function(e,t){try{ce==null||ce.localStorage.setItem(e,JSON.stringify(t))}catch(n){Qn.error(n)}},remove:function(e){try{ce==null||ce.localStorage.removeItem(e)}catch(t){Qn.error(t)}}},nY=["distinct_id",rg,Of,sg,U1],pg=pe(pe({},Qn),{},{parse:function(e){try{var t={};try{t=Jo.parse(e)||{}}catch{}var n=Hn(t,JSON.parse(Qn.get(e)||"{}"));return Qn.set(e,n),n}catch{}return null},set:function(e,t,n,r,i,o){try{Qn.set(e,t,void 0,void 0,o);var s={};nY.forEach(u=>{t[u]&&(s[u]=t[u])}),Object.keys(s).length&&Jo.set(e,s,n,r,i,o)}catch(u){Qn.error(u)}},remove:function(e,t){try{ce==null||ce.localStorage.removeItem(e),Jo.remove(e,t)}catch(n){Qn.error(n)}}}),gg={},rY={is_supported:function(){return!0},error:function(e){Qe.error("memoryStorage error: "+e)},get:function(e){return gg[e]||null},parse:function(e){return gg[e]||null},set:function(e,t){gg[e]=t},remove:function(e){delete gg[e]}},qs=null,fr={is_supported:function(){if(!ja(qs))return qs;if(qs=!0,Be(ce))qs=!1;else try{var e="__support__";fr.set(e,"xyz"),fr.get(e)!=='"xyz"'&&(qs=!1),fr.remove(e)}catch{qs=!1}return qs},error:function(e){Qe.error("sessionStorage error: ",e)},get:function(e){try{return ce==null?void 0:ce.sessionStorage.getItem(e)}catch(t){fr.error(t)}return null},parse:function(e){try{return JSON.parse(fr.get(e))||null}catch{}return null},set:function(e,t){try{ce==null||ce.sessionStorage.setItem(e,JSON.stringify(t))}catch(n){fr.error(n)}},remove:function(e){try{ce==null||ce.sessionStorage.removeItem(e)}catch(t){fr.error(t)}}};(function(e){e[e.PENDING=-1]="PENDING",e[e.DENIED=0]="DENIED",e[e.GRANTED=1]="GRANTED"})(Ya||(Ya={}));class iY{constructor(t){this.instance=t}get config(){return this.instance.config}get consent(){return this.getDnt()?Ya.DENIED:this.storedConsent}isOptedOut(){return this.consent===Ya.DENIED||this.consent===Ya.PENDING&&this.config.opt_out_capturing_by_default}isOptedIn(){return!this.isOptedOut()}optInOut(t){this.storage.set(this.storageKey,t?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:t,opt_out_capturing_cookie_prefix:n}=this.instance.config;return(n||"__ph_opt_in_out_")+t}get storedConsent(){var t=this.storage.get(this.storageKey);return t==="1"?Ya.GRANTED:t==="0"?Ya.DENIED:Ya.PENDING}get storage(){if(!this._storage){var t=this.config.opt_out_capturing_persistence_type;this._storage=t==="localStorage"?Qn:Jo;var n=t==="localStorage"?Jo:Qn;n.get(this.storageKey)&&(this._storage.get(this.storageKey)||this.optInOut(n.get(this.storageKey)==="1"),n.remove(this.storageKey,this.config.cross_subdomain_cookie))}return this._storage}getDnt(){return!!this.config.respect_dnt&&!!UT([ni==null?void 0:ni.doNotTrack,ni==null?void 0:ni.msDoNotTrack,pt.doNotTrack],t=>kt([!0,1,"1","yes"],t))}}var mg=kr("[Dead Clicks]"),oY=()=>!0,aY=e=>{var t,n=!((t=e.instance.persistence)===null||t===void 0||!t.get_property(GT)),r=e.instance.config.capture_dead_clicks;return Ha(r)?r:n};class bM{get lazyLoadedDeadClicksAutocapture(){return this._lazyLoadedDeadClicksAutocapture}constructor(t,n,r){this.instance=t,this.isEnabled=n,this.onCapture=r,this.startIfEnabled()}onRemoteConfig(t){this.instance.persistence&&this.instance.persistence.register({[GT]:t==null?void 0:t.captureDeadClicks}),this.startIfEnabled()}startIfEnabled(){this.isEnabled(this)&&this.loadScript(()=>{this.start()})}loadScript(t){var n,r,i;(n=pt.__PosthogExtensions__)!==null&&n!==void 0&&n.initDeadClicksAutocapture&&t(),(r=pt.__PosthogExtensions__)===null||r===void 0||(i=r.loadExternalDependency)===null||i===void 0||i.call(r,this.instance,"dead-clicks-autocapture",o=>{o?mg.error("failed to load script",o):t()})}start(){var t;if(He){if(!this._lazyLoadedDeadClicksAutocapture&&(t=pt.__PosthogExtensions__)!==null&&t!==void 0&&t.initDeadClicksAutocapture){var n=An(this.instance.config.capture_dead_clicks)?this.instance.config.capture_dead_clicks:{};n.__onCapture=this.onCapture,this._lazyLoadedDeadClicksAutocapture=pt.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,n),this._lazyLoadedDeadClicksAutocapture.start(He),mg.info("starting...")}}else mg.error("`document` not found. Cannot start.")}stop(){this._lazyLoadedDeadClicksAutocapture&&(this._lazyLoadedDeadClicksAutocapture.stop(),this._lazyLoadedDeadClicksAutocapture=void 0,mg.info("stopping..."))}}var Z1=kr("[ExceptionAutocapture]");class sY{constructor(t){var n;Me(this,"startCapturing",()=>{var r;if(ce&&this.isEnabled&&(r=pt.__PosthogExtensions__)!==null&&r!==void 0&&r.errorWrappingFunctions){var i=pt.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,o=pt.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,s=pt.__PosthogExtensions__.errorWrappingFunctions.wrapConsoleError;try{!this.unwrapOnError&&this.config.capture_unhandled_errors&&(this.unwrapOnError=i(this.captureException.bind(this))),!this.unwrapUnhandledRejection&&this.config.capture_unhandled_rejections&&(this.unwrapUnhandledRejection=o(this.captureException.bind(this))),!this.unwrapConsoleError&&this.config.capture_console_errors&&(this.unwrapConsoleError=s(this.captureException.bind(this)))}catch(u){Z1.error("failed to start",u),this.stopCapturing()}}}),this.instance=t,this.remoteEnabled=!((n=this.instance.persistence)===null||n===void 0||!n.props[jT]),this.config=this.requiredConfig(),this.startIfEnabled()}requiredConfig(){var t=this.instance.config.capture_exceptions,n={capture_unhandled_errors:!1,capture_unhandled_rejections:!1,capture_console_errors:!1};return An(t)?n=pe(pe({},n),t):(Be(t)?this.remoteEnabled:t)&&(n=pe(pe({},n),{},{capture_unhandled_errors:!0,capture_unhandled_rejections:!0})),n}get isEnabled(){return this.config.capture_console_errors||this.config.capture_unhandled_errors||this.config.capture_unhandled_rejections}startIfEnabled(){this.isEnabled&&(Z1.info("enabled"),this.loadScript(this.startCapturing))}loadScript(t){var n,r,i;(n=pt.__PosthogExtensions__)!==null&&n!==void 0&&n.errorWrappingFunctions&&t(),(r=pt.__PosthogExtensions__)===null||r===void 0||(i=r.loadExternalDependency)===null||i===void 0||i.call(r,this.instance,"exception-autocapture",o=>{if(o)return Z1.error("failed to load script",o);t()})}stopCapturing(){var t,n,r;(t=this.unwrapOnError)===null||t===void 0||t.call(this),this.unwrapOnError=void 0,(n=this.unwrapUnhandledRejection)===null||n===void 0||n.call(this),this.unwrapUnhandledRejection=void 0,(r=this.unwrapConsoleError)===null||r===void 0||r.call(this),this.unwrapConsoleError=void 0}onRemoteConfig(t){var n=t.autocaptureExceptions;this.remoteEnabled=!!n||!1,this.config=this.requiredConfig(),this.instance.persistence&&this.instance.persistence.register({[jT]:this.remoteEnabled}),this.startIfEnabled()}captureException(t){var n=this.instance.requestRouter.endpointFor("ui");t.$exception_personURL="".concat(n,"/project/").concat(this.instance.config.token,"/person/").concat(this.instance.get_distinct_id()),this.instance.exceptions.sendExceptionEvent(t)}}function SM(e){return!Be(Event)&&wM(e,Event)}function wM(e,t){try{return e instanceof t}catch{return!1}}function vg(e,t){return Object.prototype.toString.call(e)==="[object ".concat(t,"]")}function Y1(e){return vg(e,"DOMError")}var xM=/\(error: (.*)\)/,CM=50,pu="?";function W1(e,t,n,r){var i={platform:"web:javascript",filename:e,function:t==="<anonymous>"?pu:t,in_app:!0};return Be(n)||(i.lineno=n),Be(r)||(i.colno=r),i}var lY=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,uY=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,cY=/\((\S*)(?::(\d+))(?::(\d+))\)/,fY=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,dY=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,hY=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];var r=t.sort((i,o)=>i[0]-o[0]).map(i=>i[1]);return function(i){for(var o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,s=[],u=i.split(`
|
|
136
|
+
`);var t="",n,r,i=0,o;for(n=r=0,i=e.length,o=0;o<i;o++){var s=e.charCodeAt(o),u=null;s<128?r++:s>127&&s<2048?u=String.fromCharCode(s>>6|192,s&63|128):u=String.fromCharCode(s>>12|224,s>>6&63|128,s&63|128),u!==null&&(r>n&&(t+=e.substring(n,r)),t+=u,n=r=o+1)}return r>n&&(t+=e.substring(n,e.length)),t},I.UUID=function(){try{return Ue.crypto.randomUUID()}catch{for(var e=new Array(36),t=0;t<36;t++)e[t]=Math.floor(Math.random()*16);return e[14]=4,e[19]=e[19]&=-5,e[19]=e[19]|=8,e[8]=e[13]=e[18]=e[23]="-",I.map(e,function(r){return r.toString(16)}).join("")}};var pO=["ahrefsbot","ahrefssiteaudit","amazonbot","baiduspider","bingbot","bingpreview","chrome-lighthouse","facebookexternal","petalbot","pinterest","screaming frog","yahoo! slurp","yandex","adsbot-google","apis-google","duplexweb-google","feedfetcher-google","google favicon","google web preview","google-read-aloud","googlebot","googleweblight","mediapartners-google","storebot-google"];I.isBlockedUA=function(e){var t;for(e=e.toLowerCase(),t=0;t<pO.length;t++)if(e.indexOf(pO[t])!==-1)return!0;return!1},I.HTTPBuildQuery=function(e,t){var n,r,i=[];return I.isUndefined(t)&&(t="&"),I.each(e,function(o,s){n=encodeURIComponent(o.toString()),r=encodeURIComponent(s),i[i.length]=r+"="+n}),i.join(t)},I.getQueryParam=function(e,t){t=t.replace(/[[]/g,"\\[").replace(/[\]]/g,"\\]");var n="[\\?&]"+t+"=([^&#]*)",r=new RegExp(n),i=r.exec(e);if(i===null||i&&typeof i[1]!="string"&&i[1].length)return"";var o=i[1];try{o=decodeURIComponent(o)}catch{Ut.error("Skipping decoding for malformed query param: "+o)}return o.replace(/\+/g," ")},I.cookie={get:function(e){for(var t=e+"=",n=Vt.cookie.split(";"),r=0;r<n.length;r++){for(var i=n[r];i.charAt(0)==" ";)i=i.substring(1,i.length);if(i.indexOf(t)===0)return decodeURIComponent(i.substring(t.length,i.length))}return null},parse:function(e){var t;try{t=I.JSONDecode(I.cookie.get(e))||{}}catch{}return t},set_seconds:function(e,t,n,r,i,o,s){var u="",c="",d="";if(s)u="; domain="+s;else if(r){var p=vO(Vt.location.hostname);u=p?"; domain=."+p:""}if(n){var h=new Date;h.setTime(h.getTime()+n*1e3),c="; expires="+h.toGMTString()}o&&(i=!0,d="; SameSite=None"),i&&(d+="; secure"),Vt.cookie=e+"="+encodeURIComponent(t)+c+"; path=/"+u+d},set:function(e,t,n,r,i,o,s){var u="",c="",d="";if(s)u="; domain="+s;else if(r){var p=vO(Vt.location.hostname);u=p?"; domain=."+p:""}if(n){var h=new Date;h.setTime(h.getTime()+n*24*60*60*1e3),c="; expires="+h.toGMTString()}o&&(i=!0,d="; SameSite=None"),i&&(d+="; secure");var m=e+"="+encodeURIComponent(t)+c+"; path=/"+u+d;return Vt.cookie=m,m},remove:function(e,t,n){I.cookie.set(e,"",-1,t,!1,!1,n)}};var gO=function(e){var t=!0;try{var n="__mplss_"+Nb(8),r="xyz";e.setItem(n,r),e.getItem(n)!==r&&(t=!1),e.removeItem(n)}catch{t=!1}return t},$b=null,cf=function(e,t){return $b!==null&&!t?$b:$b=gO(e||Ue.localStorage)},Lb=null,sV=function(e,t){return Lb!==null&&!t?Lb:Lb=gO(e||Ue.sessionStorage)};function mO(e,t,n){var r=function(i){Ut.error(t+" error: "+i)};return{is_supported:function(i){var o=n(e,i);return o||Ut.error(t+" unsupported"),o},error:r,get:function(i){try{return e.getItem(i)}catch(o){r(o)}return null},parse:function(i){try{return I.JSONDecode(e.getItem(i))||{}}catch{}return null},set:function(i,o){try{e.setItem(i,o)}catch(s){r(s)}},remove:function(i){try{e.removeItem(i)}catch(o){r(o)}}}}I.localStorage=mO(Ue.localStorage,"localStorage",cf),I.sessionStorage=mO(Ue.sessionStorage,"sessionStorage",sV),I.register_event=function(){var e=function(r,i,o,s,u){if(!r){Ut.error("No valid element provided to register_event");return}if(r.addEventListener&&!s)r.addEventListener(i,o,!!u);else{var c="on"+i,d=r[c];r[c]=t(r,o,d)}};function t(r,i,o){var s=function(u){if(u=u||n(Ue.event),!!u){var c=!0,d,p;return I.isFunction(o)&&(d=o(u)),p=i.call(r,u),(d===!1||p===!1)&&(c=!1),c}};return s}function n(r){return r&&(r.preventDefault=n.preventDefault,r.stopPropagation=n.stopPropagation),r}return n.preventDefault=function(){this.returnValue=!1},n.stopPropagation=function(){this.cancelBubble=!0},e}();var lV=new RegExp('^(\\w*)\\[(\\w+)([=~\\|\\^\\$\\*]?)=?"?([^\\]"]*)"?\\]$');I.dom_query=function(){function e(i){return i.all?i.all:i.getElementsByTagName("*")}var t=/[\t\r\n]/g;function n(i,o){var s=" "+o+" ";return(" "+i.className+" ").replace(t," ").indexOf(s)>=0}function r(i){if(!Vt.getElementsByTagName)return[];var o=i.split(" "),s,u,c,d,p,h,m,v,_,x,b=[Vt];for(h=0;h<o.length;h++){if(s=o[h].replace(/^\s+/,"").replace(/\s+$/,""),s.indexOf("#")>-1){u=s.split("#"),c=u[0];var w=u[1],C=Vt.getElementById(w);if(!C||c&&C.nodeName.toLowerCase()!=c)return[];b=[C];continue}if(s.indexOf(".")>-1){u=s.split("."),c=u[0];var E=u[1];for(c||(c="*"),d=[],p=0,m=0;m<b.length;m++)for(c=="*"?_=e(b[m]):_=b[m].getElementsByTagName(c),v=0;v<_.length;v++)d[p++]=_[v];for(b=[],x=0,m=0;m<d.length;m++)d[m].className&&I.isString(d[m].className)&&n(d[m],E)&&(b[x++]=d[m]);continue}var R=s.match(lV);if(R){c=R[1];var O=R[2],T=R[3],L=R[4];for(c||(c="*"),d=[],p=0,m=0;m<b.length;m++)for(c=="*"?_=e(b[m]):_=b[m].getElementsByTagName(c),v=0;v<_.length;v++)d[p++]=_[v];b=[],x=0;var B;switch(T){case"=":B=function(z){return z.getAttribute(O)==L};break;case"~":B=function(z){return z.getAttribute(O).match(new RegExp("\\b"+L+"\\b"))};break;case"|":B=function(z){return z.getAttribute(O).match(new RegExp("^"+L+"-?"))};break;case"^":B=function(z){return z.getAttribute(O).indexOf(L)===0};break;case"$":B=function(z){return z.getAttribute(O).lastIndexOf(L)==z.getAttribute(O).length-L.length};break;case"*":B=function(z){return z.getAttribute(O).indexOf(L)>-1};break;default:B=function(z){return z.getAttribute(O)}}for(b=[],x=0,m=0;m<d.length;m++)B(d[m])&&(b[x++]=d[m]);continue}for(c=s,d=[],p=0,m=0;m<b.length;m++)for(_=b[m].getElementsByTagName(c),v=0;v<_.length;v++)d[p++]=_[v];b=d}return b}return function(i){return I.isElement(i)?[i]:I.isObject(i)&&!I.isUndefined(i.length)?i:r.call(this,i)}}();var uV=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","utm_id","utm_source_platform","utm_campaign_id","utm_creative_format","utm_marketing_tactic"],cV=["dclid","fbclid","gclid","ko_click_id","li_fat_id","msclkid","sccid","ttclid","twclid","wbraid"];I.info={campaignParams:function(e){var t="",n={};return I.each(uV,function(r){t=I.getQueryParam(Vt.URL,r),t.length?n[r]=t:e!==void 0&&(n[r]=e)}),n},clickParams:function(){var e="",t={};return I.each(cV,function(n){e=I.getQueryParam(Vt.URL,n),e.length&&(t[n]=e)}),t},marketingParams:function(){return I.extend(I.info.campaignParams(),I.info.clickParams())},searchEngine:function(e){return e.search("https?://(.*)google.([^/?]*)")===0?"google":e.search("https?://(.*)bing.com")===0?"bing":e.search("https?://(.*)yahoo.com")===0?"yahoo":e.search("https?://(.*)duckduckgo.com")===0?"duckduckgo":null},searchInfo:function(e){var t=I.info.searchEngine(e),n=t!="yahoo"?"q":"p",r={};if(t!==null){r.$search_engine=t;var i=I.getQueryParam(e,n);i.length&&(r.mp_keyword=i)}return r},browser:function(e,t,n){return t=t||"",n||I.includes(e," OPR/")?I.includes(e,"Mini")?"Opera Mini":"Opera":/(BlackBerry|PlayBook|BB10)/i.test(e)?"BlackBerry":I.includes(e,"IEMobile")||I.includes(e,"WPDesktop")?"Internet Explorer Mobile":I.includes(e,"SamsungBrowser/")?"Samsung Internet":I.includes(e,"Edge")||I.includes(e,"Edg/")?"Microsoft Edge":I.includes(e,"FBIOS")?"Facebook Mobile":I.includes(e,"Chrome")?"Chrome":I.includes(e,"CriOS")?"Chrome iOS":I.includes(e,"UCWEB")||I.includes(e,"UCBrowser")?"UC Browser":I.includes(e,"FxiOS")?"Firefox iOS":I.includes(t,"Apple")?I.includes(e,"Mobile")?"Mobile Safari":"Safari":I.includes(e,"Android")?"Android Mobile":I.includes(e,"Konqueror")?"Konqueror":I.includes(e,"Firefox")?"Firefox":I.includes(e,"MSIE")||I.includes(e,"Trident/")?"Internet Explorer":I.includes(e,"Gecko")?"Mozilla":""},browserVersion:function(e,t,n){var r=I.info.browser(e,t,n),i={"Internet Explorer Mobile":/rv:(\d+(\.\d+)?)/,"Microsoft Edge":/Edge?\/(\d+(\.\d+)?)/,Chrome:/Chrome\/(\d+(\.\d+)?)/,"Chrome iOS":/CriOS\/(\d+(\.\d+)?)/,"UC Browser":/(UCBrowser|UCWEB)\/(\d+(\.\d+)?)/,Safari:/Version\/(\d+(\.\d+)?)/,"Mobile Safari":/Version\/(\d+(\.\d+)?)/,Opera:/(Opera|OPR)\/(\d+(\.\d+)?)/,Firefox:/Firefox\/(\d+(\.\d+)?)/,"Firefox iOS":/FxiOS\/(\d+(\.\d+)?)/,Konqueror:/Konqueror:(\d+(\.\d+)?)/,BlackBerry:/BlackBerry (\d+(\.\d+)?)/,"Android Mobile":/android\s(\d+(\.\d+)?)/,"Samsung Internet":/SamsungBrowser\/(\d+(\.\d+)?)/,"Internet Explorer":/(rv:|MSIE )(\d+(\.\d+)?)/,Mozilla:/rv:(\d+(\.\d+)?)/},o=i[r];if(o===void 0)return null;var s=e.match(o);return s?parseFloat(s[s.length-2]):null},os:function(){var e=qo;return/Windows/i.test(e)?/Phone/.test(e)||/WPDesktop/.test(e)?"Windows Phone":"Windows":/(iPhone|iPad|iPod)/.test(e)?"iOS":/Android/.test(e)?"Android":/(BlackBerry|PlayBook|BB10)/i.test(e)?"BlackBerry":/Mac/i.test(e)?"Mac OS X":/Linux/.test(e)?"Linux":/CrOS/.test(e)?"Chrome OS":""},device:function(e){return/Windows Phone/i.test(e)||/WPDesktop/.test(e)?"Windows Phone":/iPad/.test(e)?"iPad":/iPod/.test(e)?"iPod Touch":/iPhone/.test(e)?"iPhone":/(BlackBerry|PlayBook|BB10)/i.test(e)?"BlackBerry":/Android/.test(e)?"Android":""},referringDomain:function(e){var t=e.split("/");return t.length>=3?t[2]:""},currentUrl:function(){return Ue.location.href},properties:function(e){return typeof e!="object"&&(e={}),I.extend(I.strip_empty_properties({$os:I.info.os(),$browser:I.info.browser(qo,Da.vendor,$p),$referrer:Vt.referrer,$referring_domain:I.info.referringDomain(Vt.referrer),$device:I.info.device(qo)}),{$current_url:I.info.currentUrl(),$browser_version:I.info.browserVersion(qo,Da.vendor,$p),$screen_height:cO.height,$screen_width:cO.width,mp_lib:"web",$lib_version:qi.LIB_VERSION,$insert_id:Nb(),time:I.timestamp()/1e3},I.strip_empty_properties(e))},people_properties:function(){return I.extend(I.strip_empty_properties({$os:I.info.os(),$browser:I.info.browser(qo,Da.vendor,$p)}),{$browser_version:I.info.browserVersion(qo,Da.vendor,$p)})},mpPageViewProperties:function(){return I.strip_empty_properties({current_page_title:Vt.title,current_domain:Ue.location.hostname,current_url_path:Ue.location.pathname,current_url_protocol:Ue.location.protocol,current_url_search:Ue.location.search})}};var fV=function(e,t){var n=null,r=[];return function(i){var o=this;return r.push(i),n||(n=new qt(function(s){setTimeout(function(){var u=e.apply(o,[r]);n=null,r=[],s(u)},t)})),n}},Nb=function(e){var t=Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10);return e?t.substring(0,e):t},dV=/[a-z0-9][a-z0-9-]*\.[a-z]+$/i,hV=/[a-z0-9][a-z0-9-]+\.[a-z.]{2,6}$/i,vO=function(e){var t=hV,n=e.split("."),r=n[n.length-1];(r.length>4||r==="com"||r==="org")&&(t=dV);var i=e.match(t);return i?i[0]:""},pV=function(){var e=Ue.navigator.onLine;return I.isUndefined(e)||e},$a=function(){},Yl=null,Lp=null;typeof JSON<"u"&&(Yl=JSON.stringify,Lp=JSON.parse),Yl=Yl||I.JSONEncode,Lp=Lp||I.JSONDecode,I.info=I.info,I.info.browser=I.info.browser,I.info.browserVersion=I.info.browserVersion,I.info.device=I.info.device,I.info.properties=I.info.properties,I.isBlockedUA=I.isBlockedUA,I.isEmptyObject=I.isEmptyObject,I.isObject=I.isObject,I.JSONDecode=I.JSONDecode,I.JSONEncode=I.JSONEncode,I.toArray=I.toArray,I.NPO=Ta;var gV="mixpanelBrowserDb",yO="mixpanelRecordingEvents",Pb="mixpanelRecordingRegistry",mV=1,vV=[yO,Pb],so=function(e){this.dbPromise=null,this.storeName=e};so.prototype._openDb=function(){return new qt(function(e,t){var n=Ue.indexedDB.open(gV,mV);n.onerror=function(){t(n.error)},n.onsuccess=function(){e(n.result)},n.onupgradeneeded=function(r){var i=r.target.result;vV.forEach(function(o){i.createObjectStore(o)})}})},so.prototype.init=function(){return Ue.indexedDB?(this.dbPromise||(this.dbPromise=this._openDb()),this.dbPromise.then(function(e){return e instanceof Ue.IDBDatabase?qt.resolve():qt.reject(e)})):qt.reject("indexedDB is not supported in this browser")},so.prototype.makeTransaction=function(e,t){var n=this.storeName,r=function(i){return new qt(function(o,s){var u=i.transaction(n,e);u.oncomplete=function(){o(u)},u.onabort=u.onerror=function(){s(u.error)},t(u.objectStore(n))})};return this.dbPromise.then(r).catch((function(i){return i&&i.name==="InvalidStateError"?(this.dbPromise=this._openDb(),this.dbPromise.then(r)):qt.reject(i)}).bind(this))},so.prototype.setItem=function(e,t){return this.makeTransaction("readwrite",function(n){n.put(t,e)})},so.prototype.getItem=function(e){var t;return this.makeTransaction("readonly",function(n){t=n.get(e)}).then(function(){return t.result})},so.prototype.removeItem=function(e){return this.makeTransaction("readwrite",function(t){t.delete(e)})},so.prototype.getAll=function(){var e;return this.makeTransaction("readonly",function(t){e=t.getAll()}).then(function(){return e.result})};var yV="__mp_opt_in_out_";function _V(e,t){SO(!0,e,t)}function bV(e,t){SO(!1,e,t)}function SV(e,t){return bO(e,t)==="1"}function _O(e,t){if(xV(t))return Ut.warn('This browser has "Do Not Track" enabled. This will prevent the Mixpanel SDK from sending any data. To ignore the "Do Not Track" browser setting, initialize the Mixpanel instance with the config "ignore_dnt: true"'),!0;var n=bO(e,t)==="0";return n&&Ut.warn("You are opted out of Mixpanel tracking. This will prevent the Mixpanel SDK from sending any data."),n}function La(e){return Ub(e,function(t){return this.get_config(t)})}function Na(e){return Ub(e,function(t){return this._get_config(t)})}function Wl(e){return Ub(e,function(t){return this._get_config(t)})}function wV(e,t){t=t||{},Bb(t).remove(Fb(e,t),!!t.crossSubdomainCookie,t.cookieDomain)}function Bb(e){return e=e||{},e.persistenceType==="localStorage"?I.localStorage:I.cookie}function Fb(e,t){return t=t||{},(t.persistencePrefix||yV)+e}function bO(e,t){return Bb(t).get(Fb(e,t))}function xV(e){if(e&&e.ignoreDnt)return!1;var t=e&&e.window||Ue,n=t.navigator||{},r=!1;return I.each([n.doNotTrack,n.msDoNotTrack,t.doNotTrack],function(i){I.includes([!0,1,"1","yes"],i)&&(r=!0)}),r}function SO(e,t,n){if(!I.isString(t)||!t.length){Ut.error("gdpr."+(e?"optIn":"optOut")+" called with an invalid token");return}n=n||{},Bb(n).set(Fb(t,n),e?1:0,I.isNumber(n.cookieExpiration)?n.cookieExpiration:null,!!n.crossSubdomainCookie,!!n.secureCookie,!!n.crossSiteCookie,n.cookieDomain),n.track&&e&&n.track(n.trackEventName||"$opt_in",n.trackProperties,{send_immediately:!0})}function Ub(e,t){return function(){var n=!1;try{var r=t.call(this,"token"),i=t.call(this,"ignore_dnt"),o=t.call(this,"opt_out_tracking_persistence_type"),s=t.call(this,"opt_out_tracking_cookie_prefix"),u=t.call(this,"window");r&&(n=_O(r,{ignoreDnt:i,persistenceType:o,persistencePrefix:s,window:u}))}catch(d){Ut.error("Unexpected error when checking tracking opt-out status: "+d)}if(!n)return e.apply(this,arguments);var c=arguments[arguments.length-1];typeof c=="function"&&c(0)}}var CV=Zl("lock"),wO=function(e,t){t=t||{},this.storageKey=e,this.storage=t.storage||Ue.localStorage,this.pollIntervalMS=t.pollIntervalMS||100,this.timeoutMS=t.timeoutMS||2e3,this.promiseImpl=t.promiseImpl||qt};wO.prototype.withLock=function(e,t){var n=this.promiseImpl;return new n(I.bind(function(r,i){var o=t||new Date().getTime()+"|"+Math.random(),s=new Date().getTime(),u=this.storageKey,c=this.pollIntervalMS,d=this.timeoutMS,p=this.storage,h=u+":X",m=u+":Y",v=u+":Z",_=function(E){if(new Date().getTime()-s>d){CV.error("Timeout waiting for mutex on "+u+"; clearing lock. ["+o+"]"),p.removeItem(v),p.removeItem(m),w();return}setTimeout(function(){try{E()}catch(R){i(R)}},c*(Math.random()+.1))},x=function(E,R){E()?R():_(function(){x(E,R)})},b=function(){var E=p.getItem(m);return E&&E!==o?!1:(p.setItem(m,o),p.getItem(m)===o?!0:(cf(p,!0)||i(new Error("localStorage support dropped while acquiring lock")),!1))},w=function(){p.setItem(h,o),x(b,function(){if(p.getItem(h)===o){C();return}_(function(){if(p.getItem(m)!==o){w();return}x(function(){return!p.getItem(v)},C)})})},C=function(){p.setItem(v,"1");var E=function(){p.removeItem(v),p.getItem(m)===o&&p.removeItem(m),p.getItem(h)===o&&p.removeItem(h)};e().then(function(R){E(),r(R)}).catch(function(R){E(),i(R)})};try{if(cf(p,!0))w();else throw new Error("localStorage support check failed")}catch(E){i(E)}},this))};var ff=function(e){this.storage=e||Ue.localStorage};ff.prototype.init=function(){return qt.resolve()},ff.prototype.setItem=function(e,t){return new qt(I.bind(function(n,r){try{this.storage.setItem(e,Yl(t))}catch(i){r(i)}n()},this))},ff.prototype.getItem=function(e){return new qt(I.bind(function(t,n){var r;try{r=Lp(this.storage.getItem(e))}catch(i){n(i)}t(r)},this))},ff.prototype.removeItem=function(e){return new qt(I.bind(function(t,n){try{this.storage.removeItem(e)}catch(r){n(r)}t()},this))};var xO=Zl("batch"),lo=function(e,t){t=t||{},this.storageKey=e,this.usePersistence=t.usePersistence,this.usePersistence&&(this.queueStorage=t.queueStorage||new ff,this.lock=new wO(e,{storage:t.sharedLockStorage||Ue.localStorage,timeoutMS:t.sharedLockTimeoutMS})),this.reportError=t.errorReporter||I.bind(xO.error,xO),this.pid=t.pid||null,this.memQueue=[],this.initialized=!1,t.enqueueThrottleMs?this.enqueuePersisted=fV(I.bind(this._enqueuePersisted,this),t.enqueueThrottleMs):this.enqueuePersisted=I.bind(function(n){return this._enqueuePersisted([n])},this)};lo.prototype.ensureInit=function(){return this.initialized?qt.resolve():this.queueStorage.init().then(I.bind(function(){this.initialized=!0},this)).catch(I.bind(function(e){this.reportError("Error initializing queue persistence. Disabling persistence",e),this.initialized=!0,this.usePersistence=!1},this))},lo.prototype.enqueue=function(e,t){var n={id:Nb(),flushAfter:new Date().getTime()+t*2,payload:e};return this.usePersistence?this.enqueuePersisted(n):(this.memQueue.push(n),qt.resolve(!0))},lo.prototype._enqueuePersisted=function(e){var t=I.bind(function(){return this.ensureInit().then(I.bind(function(){return this.readFromStorage()},this)).then(I.bind(function(n){return this.saveToStorage(n.concat(e))},this)).then(I.bind(function(n){return n&&(this.memQueue=this.memQueue.concat(e)),n},this)).catch(I.bind(function(n){return this.reportError("Error enqueueing items",n,e),!1},this))},this);return this.lock.withLock(t,this.pid).catch(I.bind(function(n){return this.reportError("Error acquiring storage lock",n),!1},this))},lo.prototype.fillBatch=function(e){var t=this.memQueue.slice(0,e);return this.usePersistence&&t.length<e?this.ensureInit().then(I.bind(function(){return this.readFromStorage()},this)).then(I.bind(function(n){if(n.length){var r={};I.each(t,function(s){r[s.id]=!0});for(var i=0;i<n.length;i++){var o=n[i];if(new Date().getTime()>o.flushAfter&&!r[o.id]&&(o.orphaned=!0,t.push(o),t.length>=e))break}}return t},this)):qt.resolve(t)};var CO=function(e,t){var n=[];return I.each(e,function(r){r.id&&!t[r.id]&&n.push(r)}),n};lo.prototype.removeItemsByID=function(e){var t={};if(I.each(e,function(r){t[r]=!0}),this.memQueue=CO(this.memQueue,t),this.usePersistence){var n=I.bind(function(){return this.ensureInit().then(I.bind(function(){return this.readFromStorage()},this)).then(I.bind(function(r){return r=CO(r,t),this.saveToStorage(r)},this)).then(I.bind(function(){return this.readFromStorage()},this)).then(I.bind(function(r){for(var i=0;i<r.length;i++){var o=r[i];if(o.id&&t[o.id])throw new Error("Item not removed from storage")}return!0},this)).catch(I.bind(function(r){return this.reportError("Error removing items",r,e),!1},this))},this);return this.lock.withLock(n,this.pid).catch(I.bind(function(r){return this.reportError("Error acquiring storage lock",r),cf(this.lock.storage,!0)?!1:n().then(I.bind(function(i){return i||this.queueStorage.removeItem(this.storageKey).then(function(){return i})},this)).catch(I.bind(function(i){return this.reportError("Error clearing queue",i),!1},this))},this))}else return qt.resolve(!0)};var EO=function(e,t){var n=[];return I.each(e,function(r){var i=r.id;if(i in t){var o=t[i];o!==null&&(r.payload=o,n.push(r))}else n.push(r)}),n};lo.prototype.updatePayloads=function(e){return this.memQueue=EO(this.memQueue,e),this.usePersistence?this.lock.withLock(I.bind(function(){return this.ensureInit().then(I.bind(function(){return this.readFromStorage()},this)).then(I.bind(function(n){return n=EO(n,e),this.saveToStorage(n)},this)).catch(I.bind(function(n){return this.reportError("Error updating items",e,n),!1},this))},this),this.pid).catch(I.bind(function(t){return this.reportError("Error acquiring storage lock",t),!1},this)):qt.resolve(!0)},lo.prototype.readFromStorage=function(){return this.ensureInit().then(I.bind(function(){return this.queueStorage.getItem(this.storageKey)},this)).then(I.bind(function(e){return e&&(I.isArray(e)||(this.reportError("Invalid storage entry:",e),e=null)),e||[]},this)).catch(I.bind(function(e){return this.reportError("Error retrieving queue",e),[]},this))},lo.prototype.saveToStorage=function(e){return this.ensureInit().then(I.bind(function(){return this.queueStorage.setItem(this.storageKey,e)},this)).then(function(){return!0}).catch(I.bind(function(t){return this.reportError("Error saving queue",t),!1},this))},lo.prototype.clear=function(){return this.memQueue=[],this.usePersistence?this.ensureInit().then(I.bind(function(){return this.queueStorage.removeItem(this.storageKey)},this)):qt.resolve()};var EV=10*60*1e3,df=Zl("batch"),mi=function(e,t){this.errorReporter=t.errorReporter,this.queue=new lo(e,{errorReporter:I.bind(this.reportError,this),queueStorage:t.queueStorage,sharedLockStorage:t.sharedLockStorage,sharedLockTimeoutMS:t.sharedLockTimeoutMS,usePersistence:t.usePersistence,enqueueThrottleMs:t.enqueueThrottleMs}),this.libConfig=t.libConfig,this.sendRequest=t.sendRequestFunc,this.beforeSendHook=t.beforeSendHook,this.stopAllBatching=t.stopAllBatchingFunc,this.batchSize=this.libConfig.batch_size,this.flushInterval=this.libConfig.batch_flush_interval_ms,this.stopped=!this.libConfig.batch_autostart,this.consecutiveRemovalFailures=0,this.itemIdsSentSuccessfully={},this.flushOnlyOnInterval=t.flushOnlyOnInterval||!1,this._flushPromise=null};mi.prototype.enqueue=function(e){return this.queue.enqueue(e,this.flushInterval)},mi.prototype.start=function(){return this.stopped=!1,this.consecutiveRemovalFailures=0,this.flush()},mi.prototype.stop=function(){this.stopped=!0,this.timeoutID&&(clearTimeout(this.timeoutID),this.timeoutID=null)},mi.prototype.clear=function(){return this.queue.clear()},mi.prototype.resetBatchSize=function(){this.batchSize=this.libConfig.batch_size},mi.prototype.resetFlush=function(){this.scheduleFlush(this.libConfig.batch_flush_interval_ms)},mi.prototype.scheduleFlush=function(e){this.flushInterval=e,this.stopped||(this.timeoutID=setTimeout(I.bind(function(){this.stopped||(this._flushPromise=this.flush())},this),this.flushInterval))},mi.prototype.sendRequestPromise=function(e,t){return new qt(I.bind(function(n){this.sendRequest(e,t,n)},this))},mi.prototype.flush=function(e){if(this.requestInProgress)return df.log("Flush: Request already in progress"),qt.resolve();this.requestInProgress=!0,e=e||{};var t=this.libConfig.batch_request_timeout_ms,n=new Date().getTime(),r=this.batchSize;return this.queue.fillBatch(r).then(I.bind(function(i){var o=i.length===r,s=[],u={};if(I.each(i,function(h){var m=h.payload;if(this.beforeSendHook&&!h.orphaned&&(m=this.beforeSendHook(m)),m){m.event&&m.properties&&(m.properties=I.extend({},m.properties,{mp_sent_by_lib_version:qi.LIB_VERSION}));var v=!0,_=h.id;_?(this.itemIdsSentSuccessfully[_]||0)>5&&(this.reportError("[dupe] item ID sent too many times, not sending",{item:h,batchSize:i.length,timesSent:this.itemIdsSentSuccessfully[_]}),v=!1):this.reportError("[dupe] found item with no ID",{item:h}),v&&s.push(m)}u[h.id]=m},this),s.length<1)return this.requestInProgress=!1,this.resetFlush(),qt.resolve();var c=I.bind(function(){return this.queue.removeItemsByID(I.map(i,function(h){return h.id})).then(I.bind(function(h){return I.each(i,I.bind(function(m){var v=m.id;v?(this.itemIdsSentSuccessfully[v]=this.itemIdsSentSuccessfully[v]||0,this.itemIdsSentSuccessfully[v]++,this.itemIdsSentSuccessfully[v]>5&&this.reportError("[dupe] item ID sent too many times",{item:m,batchSize:i.length,timesSent:this.itemIdsSentSuccessfully[v]})):this.reportError("[dupe] found item with no ID while removing",{item:m})},this)),h?(this.consecutiveRemovalFailures=0,this.flushOnlyOnInterval&&!o?(this.resetFlush(),qt.resolve()):this.flush()):(++this.consecutiveRemovalFailures>5?(this.reportError("Too many queue failures; disabling batching system."),this.stopAllBatching()):this.resetFlush(),qt.resolve())},this))},this),d=I.bind(function(h){this.requestInProgress=!1;try{if(e.unloading)return this.queue.updatePayloads(u);if(I.isObject(h)&&h.error==="timeout"&&new Date().getTime()-n>=t)return this.reportError("Network timeout; retrying"),this.flush();if(I.isObject(h)&&(h.httpStatusCode>=500||h.httpStatusCode===429||h.httpStatusCode<=0&&!pV()||h.error==="timeout")){var m=this.flushInterval*2;return h.retryAfter&&(m=parseInt(h.retryAfter,10)*1e3||m),m=Math.min(EV,m),this.reportError("Error; retry in "+m+" ms"),this.scheduleFlush(m),qt.resolve()}else if(I.isObject(h)&&h.httpStatusCode===413)if(i.length>1){var v=Math.max(1,Math.floor(r/2));return this.batchSize=Math.min(this.batchSize,v,i.length-1),this.reportError("413 response; reducing batch size to "+this.batchSize),this.resetFlush(),qt.resolve()}else return this.reportError("Single-event request too large; dropping",i),this.resetBatchSize(),c();else return c()}catch(_){this.reportError("Error handling API response",_),this.resetFlush()}},this),p={method:"POST",verbose:!0,ignore_json_errors:!0,timeout_ms:t};return e.unloading&&(p.transport="sendBeacon"),df.log("MIXPANEL REQUEST:",s),this.sendRequestPromise(s,p).then(d)},this)).catch(I.bind(function(i){this.reportError("Error flushing request queue",i),this.resetFlush()},this))},mi.prototype.reportError=function(e,t){if(df.error.apply(df.error,arguments),this.errorReporter)try{t instanceof Error||(t=new Error(e)),this.errorReporter(e,t)}catch(n){df.error(n)}};var zb=function(e){var t=Date.now();return!e||t>e.maxExpires||t>e.idleExpires},kV=250,Kl=Zl("recorder"),kO=Ue.CompressionStream,AV={batch_size:1e3,batch_flush_interval_ms:10*1e3,batch_request_timeout_ms:90*1e3,batch_autostart:!0},IV=new Set([ft.MouseMove,ft.MouseInteraction,ft.Scroll,ft.ViewportResize,ft.Input,ft.TouchMove,ft.MediaInteraction,ft.Drag,ft.Selection]);function RV(e){return e.type===Dt.IncrementalSnapshot&&IV.has(e.data.source)}var xr=function(e){this._mixpanel=e.mixpanelInstance,this._onIdleTimeout=e.onIdleTimeout||$a,this._onMaxLengthReached=e.onMaxLengthReached||$a,this._onBatchSent=e.onBatchSent||$a,this._rrwebRecord=e.rrwebRecord||null,this._stopRecording=null,this.replayId=e.replayId,this.batchStartUrl=e.batchStartUrl||null,this.replayStartUrl=e.replayStartUrl||null,this.idleExpires=e.idleExpires||null,this.maxExpires=e.maxExpires||null,this.replayStartTime=e.replayStartTime||null,this.seqNo=e.seqNo||0,this.idleTimeoutId=null,this.maxTimeoutId=null,this.recordMaxMs=lf,this.recordMinMs=0;var t=cf(e.sharedLockStorage,!0);this.batcherKey="__mprec_"+this.getConfig("name")+"_"+this.getConfig("token")+"_"+this.replayId,this.queueStorage=new so(yO),this.batcher=new mi(this.batcherKey,{errorReporter:this.reportError.bind(this),flushOnlyOnInterval:!0,libConfig:AV,sendRequestFunc:this.flushEventsWithOptOut.bind(this),queueStorage:this.queueStorage,sharedLockStorage:e.sharedLockStorage,usePersistence:t,stopAllBatchingFunc:this.stopRecording.bind(this),enqueueThrottleMs:kV,sharedLockTimeoutMS:10*1e3})};xr.prototype.unloadPersistedData=function(){return this.batcher.stop(),this.batcher.flush().then((function(){return this.queueStorage.removeItem(this.batcherKey)}).bind(this))},xr.prototype.getConfig=function(e){return this._mixpanel.get_config(e)},xr.prototype.get_config=function(e){return this.getConfig(e)},xr.prototype.startRecording=function(e){if(this._rrwebRecord===null){this.reportError("rrweb record function not provided. ");return}if(this._stopRecording!==null){Kl.log("Recording already in progress, skipping startRecording.");return}this.recordMaxMs=this.getConfig("record_max_ms"),this.recordMaxMs>lf&&(this.recordMaxMs=lf,Kl.critical("record_max_ms cannot be greater than "+lf+"ms. Capping value.")),this.maxExpires||(this.maxExpires=new Date().getTime()+this.recordMaxMs),this.recordMinMs=this.getConfig("record_min_ms"),this.recordMinMs>Rb&&(this.recordMinMs=Rb,Kl.critical("record_min_ms cannot be greater than "+Rb+"ms. Capping value.")),this.replayStartTime||(this.replayStartTime=new Date().getTime(),this.batchStartUrl=I.info.currentUrl(),this.replayStartUrl=I.info.currentUrl()),e||this.recordMinMs>0?this.batcher.stop():this.batcher.start();var t=(function(){clearTimeout(this.idleTimeoutId);var i=this.getConfig("record_idle_timeout_ms");this.idleTimeoutId=setTimeout(this._onIdleTimeout,i),this.idleExpires=new Date().getTime()+i}).bind(this);t();var n=this.getConfig("record_block_selector");(n===""||n===null)&&(n=void 0);try{this._stopRecording=this._rrwebRecord({emit:(function(i){if(this.idleExpires&&this.idleExpires<i.timestamp){this._onIdleTimeout();return}RV(i)&&(this.batcher.stopped&&new Date().getTime()-this.replayStartTime>=this.recordMinMs&&this.batcher.start(),t()),this.__enqueuePromise=this.batcher.enqueue(i)}).bind(this),blockClass:this.getConfig("record_block_class"),blockSelector:n,collectFonts:this.getConfig("record_collect_fonts"),dataURLOptions:{type:"image/webp",quality:.6},maskAllInputs:!0,maskTextClass:this.getConfig("record_mask_text_class"),maskTextSelector:this.getConfig("record_mask_text_selector"),recordCanvas:this.getConfig("record_canvas"),sampling:{canvas:15}})}catch(i){this.reportError("Unexpected error when starting rrweb recording.",i)}if(typeof this._stopRecording!="function"){this.reportError("rrweb failed to start, skipping this recording."),this._stopRecording=null,this.stopRecording();return}var r=this.maxExpires-new Date().getTime();this.maxTimeoutId=setTimeout(this._onMaxLengthReached.bind(this),r)},xr.prototype.stopRecording=function(e){if(!this.isRrwebStopped()){try{this._stopRecording()}catch(n){this.reportError("Error with rrweb stopRecording",n)}this._stopRecording=null}var t;return this.batcher.stopped?t=this.batcher.clear():e||(t=this.batcher.flush()),this.batcher.stop(),clearTimeout(this.idleTimeoutId),clearTimeout(this.maxTimeoutId),t},xr.prototype.isRrwebStopped=function(){return this._stopRecording===null},xr.prototype.flushEventsWithOptOut=function(e,t,n){var r=(function(i){i===0&&(this.stopRecording(),n({error:"Tracking has been opted out, stopping recording."}))}).bind(this);this._flushEvents(e,t,n,r)},xr.prototype.serialize=function(){var e;try{e=this._mixpanel.get_tab_id()}catch(t){this.reportError("Error getting tab ID for serialization ",t),e=null}return{replayId:this.replayId,seqNo:this.seqNo,replayStartTime:this.replayStartTime,batchStartUrl:this.batchStartUrl,replayStartUrl:this.replayStartUrl,idleExpires:this.idleExpires,maxExpires:this.maxExpires,tabId:e}},xr.deserialize=function(e,t){var n=new xr(I.extend({},t,{replayId:e.replayId,batchStartUrl:e.batchStartUrl,replayStartUrl:e.replayStartUrl,idleExpires:e.idleExpires,maxExpires:e.maxExpires,replayStartTime:e.replayStartTime,seqNo:e.seqNo,sharedLockStorage:t.sharedLockStorage}));return n},xr.prototype._sendRequest=function(e,t,n,r){var i=(function(o,s){o.status===200&&this.replayId===e&&(this.seqNo++,this.batchStartUrl=I.info.currentUrl()),this._onBatchSent(),r({status:0,httpStatusCode:o.status,responseBody:s,retryAfter:o.headers.get("Retry-After")})}).bind(this);Ue.fetch(this.getConfig("api_host")+"/"+this.getConfig("api_routes").record+"?"+new URLSearchParams(t),{method:"POST",headers:{Authorization:"Basic "+btoa(this.getConfig("token")+":"),"Content-Type":"application/octet-stream"},body:n}).then(function(o){o.json().then(function(s){i(o,s)}).catch(function(s){r({error:s})})}).catch(function(o){r({error:o,httpStatusCode:0})})},xr.prototype._flushEvents=La(function(e,t,n){var r=e.length;if(r>0){for(var i=this.replayId,o=1/0,s=-1/0,u=!1,c=0;c<r;c++)o=Math.min(o,e[c].timestamp),s=Math.max(s,e[c].timestamp),e[c].type===Dt.FullSnapshot&&(u=!0);if(this.seqNo===0){if(!u){n({error:"First batch does not contain a full snapshot. Aborting recording."}),this.stopRecording(!0);return}this.replayStartTime=o}else this.replayStartTime||(this.reportError("Replay start time not set but seqNo is not 0. Using current batch start time as a fallback."),this.replayStartTime=o);var d=s-this.replayStartTime,p={$current_url:this.batchStartUrl,$lib_version:qi.LIB_VERSION,batch_start_time:o/1e3,distinct_id:String(this._mixpanel.get_distinct_id()),mp_lib:"web",replay_id:i,replay_length_ms:d,replay_start_time:this.replayStartTime/1e3,replay_start_url:this.replayStartUrl,seq:this.seqNo},h=JSON.stringify(e),m=this._mixpanel.get_property("$device_id");m&&(p.$device_id=m);var v=this._mixpanel.get_property("$user_id");if(v&&(p.$user_id=v),kO){var _=new Blob([h],{type:"application/json"}).stream(),x=_.pipeThrough(new kO("gzip"));new Response(x).blob().then((function(b){p.format="gzip",this._sendRequest(i,p,b,n)}).bind(this))}else p.format="body",this._sendRequest(i,p,h,n)}}),xr.prototype.reportError=function(e,t){Kl.error.apply(Kl.error,arguments);try{!t&&!(e instanceof Error)&&(e=new Error(e)),this.getConfig("error_reporter")(e,t)}catch(n){Kl.error(n)}};var Ql=function(e){this.idb=new so(Pb),this.errorReporter=e.errorReporter,this.mixpanelInstance=e.mixpanelInstance,this.sharedLockStorage=e.sharedLockStorage};Ql.prototype.handleError=function(e){this.errorReporter("IndexedDB error: ",e)},Ql.prototype.setActiveRecording=function(e){var t=e.tabId;return t?this.idb.init().then((function(){return this.idb.setItem(t,e)}).bind(this)).catch(this.handleError.bind(this)):(console.warn("No tab ID is set, cannot persist recording metadata."),qt.resolve())},Ql.prototype.getActiveRecording=function(){return this.idb.init().then((function(){return this.idb.getItem(this.mixpanelInstance.get_tab_id())}).bind(this)).then((function(e){return zb(e)?null:e}).bind(this)).catch(this.handleError.bind(this))},Ql.prototype.clearActiveRecording=function(){return this.getActiveRecording().then((function(e){if(e)return e.maxExpires=0,this.setActiveRecording(e)}).bind(this)).catch(this.handleError.bind(this))},Ql.prototype.flushInactiveRecordings=function(){return this.idb.init().then((function(){return this.idb.getAll()}).bind(this)).then((function(e){var t=e.filter(function(n){return zb(n)}).map((function(n){var r=xr.deserialize(n,{mixpanelInstance:this.mixpanelInstance,sharedLockStorage:this.sharedLockStorage});return r.unloadPersistedData().then((function(){return this.idb.removeItem(n.tabId)}).bind(this)).catch(this.handleError.bind(this))}).bind(this));return qt.all(t)}).bind(this)).catch(this.handleError.bind(this))};var hf=Zl("recorder"),jo=function(e,t,n){this.mixpanelInstance=e,this.rrwebRecord=t||Ra,this.sharedLockStorage=n,this.recordingRegistry=new Ql({mixpanelInstance:this.mixpanelInstance,errorReporter:hf.error,sharedLockStorage:n}),this._flushInactivePromise=this.recordingRegistry.flushInactiveRecordings(),this.activeRecording=null};jo.prototype.startRecording=function(e){if(e=e||{},this.activeRecording&&!this.activeRecording.isRrwebStopped()){hf.log("Recording already in progress, skipping startRecording.");return}var t=(function(){hf.log("Idle timeout reached, restarting recording."),this.resetRecording()}).bind(this),n=(function(){hf.log("Max recording length reached, stopping recording."),this.resetRecording()}).bind(this),r=(function(){this.recordingRegistry.setActiveRecording(this.activeRecording.serialize()),this.__flushPromise=this.activeRecording.batcher._flushPromise}).bind(this),i={mixpanelInstance:this.mixpanelInstance,onBatchSent:r,onIdleTimeout:t,onMaxLengthReached:n,replayId:I.UUID(),rrwebRecord:this.rrwebRecord,sharedLockStorage:this.sharedLockStorage};return e.activeSerializedRecording?this.activeRecording=xr.deserialize(e.activeSerializedRecording,i):this.activeRecording=new xr(i),this.activeRecording.startRecording(e.shouldStopBatcher),this.recordingRegistry.setActiveRecording(this.activeRecording.serialize())},jo.prototype.stopRecording=function(){var e=this._stopCurrentRecording(!1);return this.recordingRegistry.clearActiveRecording(),this.activeRecording=null,e},jo.prototype.pauseRecording=function(){return this._stopCurrentRecording(!1)},jo.prototype._stopCurrentRecording=function(e){return this.activeRecording?this.activeRecording.stopRecording(e):qt.resolve()},jo.prototype.resumeRecording=function(e){return this.activeRecording&&this.activeRecording.isRrwebStopped()?(this.activeRecording.startRecording(!1),qt.resolve(null)):this.recordingRegistry.getActiveRecording().then((function(t){return t?this.startRecording({activeSerializedRecording:t}):e?this.startRecording({shouldStopBatcher:!1}):(hf.log("No resumable recording found."),null)}).bind(this))},jo.prototype.resetRecording=function(){this.stopRecording(),this.startRecording({shouldStopBatcher:!0})},jo.prototype.getActiveReplayId=function(){return this.activeRecording&&!this.activeRecording.isRrwebStopped()?this.activeRecording.replayId:null},Object.defineProperty(jo.prototype,"replayId",{get:function(){return this.getActiveReplayId()}}),Ue.__mp_recorder=jo;var Np="change",pf="click",AO="hashchange",Xl="mp_locationchange",IO="popstate",RO="scrollend",qb="submit",OV=["clientX","clientY","offsetX","offsetY","pageX","pageY","screenX","screenY","x","y"],OO=["mp-include"],jb=["mp-no-track"],TO=jb.concat(["mp-sensitive"]),TV=["aria-label","aria-labelledby","aria-describedby","href","name","role","title","type"],Ur=Zl("autocapture");function Hb(e){for(var t={},n=MO(e).split(" "),r=0;r<n.length;r++){var i=n[r];i&&(t[i]=!0)}return t}function MO(e){switch(typeof e.className){case"string":return e.className;case"object":return e.className.baseVal||e.getAttribute("class")||"";default:return""}}function MV(e){if(e.previousElementSibling)return e.previousElementSibling;do e=e.previousSibling;while(e&&!LO(e));return e}function DO(e,t,n,r,i,o){var s={$classes:MO(e).split(" "),$tag_name:e.tagName.toLowerCase()},u=e.id;u&&(s.$id=u),Zb(e,t,i,o)&&I.each(TV.concat(r),function(h){if(e.hasAttribute(h)&&!n[h]){var m=e.getAttribute(h);Pp(m)&&(s["$attr-"+h]=m)}});for(var c=1,d=1,p=e;p=MV(p);)c++,p.tagName===e.tagName&&d++;return s.$nth_child=c,s.$nth_of_type=d,s}function DV(e,t){var n=t.allowElementCallback,r=t.allowSelectors||[],i=t.blockAttrs||[],o=t.blockElementCallback,s=t.blockSelectors||[],u=t.captureTextContent||!1,c=t.captureExtraAttrs||[],d={};I.each(i,function(R){d[R]=!0});var p=null,h=typeof e.target>"u"?e.srcElement:e.target;if(NO(h)&&(h=h.parentNode),NV(h,e)&&Gb(h,e,n,r)&&!Vb(h,e,o,s)){for(var m=[h],v=h;v.parentNode&&!uo(v,"body");)m.push(v.parentNode),v=v.parentNode;var _=[],x,b=!1;if(I.each(m,function(R){var O=Zb(R,e,n,r);!d.href&&R.tagName.toLowerCase()==="a"&&(x=R.getAttribute("href"),x=O&&Pp(x)&&x),Vb(R,e,o,s)&&(b=!0),_.push(DO(R,e,d,c,n,r))},this),!b){var w=Vt.documentElement;if(p={$event_type:e.type,$host:Ue.location.host,$pathname:Ue.location.pathname,$elements:_,$el_attr__href:x,$viewportHeight:Math.max(w.clientHeight,Ue.innerHeight||0),$viewportWidth:Math.max(w.clientWidth,Ue.innerWidth||0)},I.each(c,function(R){if(!d[R]&&h.hasAttribute(R)){var O=h.getAttribute(R);Pp(O)&&(p["$el_attr__"+R]=O)}}),u&&(C=$O(h,e,n,r),C&&C.length&&(p.$el_text=C)),e.type===pf&&(I.each(OV,function(R){R in e&&(p["$"+R]=e[R])}),h=$V(e)),u){var C=$O(h,e,n,r);C&&C.length&&(p.$el_text=C)}if(h){if(!Gb(h,e,n,r)||Vb(h,e,o,s))return null;var E=DO(h,e,d,c,n,r);p.$target=E,p.$el_classes=E.$classes,I.extend(p,I.strip_empty_properties({$el_id:E.$id,$el_tag_name:E.$tag_name}))}}}return p}function $O(e,t,n,r){var i="";return Zb(e,t,n,r)&&e.childNodes&&e.childNodes.length&&I.each(e.childNodes,function(o){NO(o)&&o.textContent&&(i+=I.trim(o.textContent).split(/(\s+)/).filter(Pp).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255))}),I.trim(i)}function $V(e){for(var t=e.target,n=e.composedPath(),r=0;r<n.length;r++){var i=n[r];if(uo(i,"a")||uo(i,"button")||uo(i,"input")||uo(i,"select")||i.getAttribute&&i.getAttribute("role")==="button"){t=i;break}if(i===t)break}return t}function Gb(e,t,n,r){if(n)try{if(!n(e,t))return!1}catch(s){return Ur.critical("Error while checking element in allowElementCallback",s),!1}if(!r.length)return!0;for(var i=0;i<r.length;i++){var o=r[i];try{if(e.matches(o))return!0}catch(s){Ur.critical("Error while checking selector: "+o,s)}}return!1}function Vb(e,t,n,r){var i;if(n)try{if(n(e,t))return!0}catch(u){return Ur.critical("Error while checking element in blockElementCallback",u),!0}if(r&&r.length)for(i=0;i<r.length;i++){var o=r[i];try{if(e.matches(o))return!0}catch(u){Ur.critical("Error while checking selector: "+o,u)}}var s=Hb(e);for(i=0;i<jb.length;i++)if(s[jb[i]])return!0;return!1}function LO(e){return e&&e.nodeType===1}function uo(e,t){return e&&e.tagName&&e.tagName.toLowerCase()===t.toLowerCase()}function NO(e){return e&&e.nodeType===3}function LV(){try{var e=Vt.createElement("div");return!!e.matches}catch{return!1}}function NV(e,t){if(!e||uo(e,"html")||!LO(e))return!1;var n=e.tagName.toLowerCase();switch(n){case"form":return t.type===qb;case"input":return["button","submit"].indexOf(e.getAttribute("type"))===-1?t.type===Np:t.type===pf;case"select":case"textarea":return t.type===Np;default:return t.type===pf}}function Zb(e,t,n,r){var i;if(!Gb(e,t,n,r))return!1;for(var o=e;o.parentNode&&!uo(o,"body");o=o.parentNode){var s=Hb(o);for(i=0;i<TO.length;i++)if(s[TO[i]])return!1}var u=Hb(e);for(i=0;i<OO.length;i++)if(u[OO[i]])return!0;if(uo(e,"input")||uo(e,"select")||uo(e,"textarea")||e.getAttribute("contenteditable")==="true")return!1;var c=e.type||"";if(typeof c=="string")switch(c.toLowerCase()){case"hidden":return!1;case"password":return!1}var d=e.name||e.id||"";if(typeof d=="string"){var p=/^cc|cardnum|ccnum|creditcard|csc|cvc|cvv|exp|pass|pwd|routing|seccode|securitycode|securitynum|socialsec|socsec|ssn/i;if(p.test(d.replace(/[^a-zA-Z0-9]/g,"")))return!1}return!0}function Pp(e){if(e===null||I.isUndefined(e))return!1;if(typeof e=="string"){e=I.trim(e);var t=/^(?:(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}))$/;if(t.test((e||"").replace(/[- ]/g,"")))return!1;var n=/(^\d{3}-?\d{2}-?\d{4}$)/;if(n.test(e))return!1}return!0}var PO="autocapture",PV="track_pageview",BO="full-url",BV="url-with-path-and-query-string",FV="url-with-path",UV="allow_element_callback",FO="allow_selectors",UO="allow_url_regexes",zO="block_attrs",qO="block_element_callback",jO="block_selectors",HO="block_url_regexes",GO="capture_extra_attrs",VO="capture_text_content",ZO="scroll_capture_all",YO="scroll_depth_percent_checkpoints",Yb="click",Wb="input",WO="pageview",Kb="scroll",Qb="submit",lr={};lr[FO]=[],lr[UO]=[],lr[zO]=[],lr[qO]=null,lr[jO]=[],lr[HO]=[],lr[GO]=[],lr[VO]=!1,lr[ZO]=!1,lr[YO]=[25,50,75,100],lr[Yb]=!0,lr[Wb]=!0,lr[WO]=BO,lr[Kb]=!0,lr[Qb]=!0;var Bp={$mp_autocapture:!0},zV="$mp_click",qV="$mp_input_change",jV="$mp_scroll",HV="$mp_submit",ei=function(e){this.mp=e};ei.prototype.init=function(){if(!LV()){Ur.critical("Autocapture unavailable: missing required DOM APIs");return}this.initPageviewTracking(),this.initClickTracking(),this.initInputTracking(),this.initScrollTracking(),this.initSubmitTracking()},ei.prototype.getFullConfig=function(){var e=this.mp.get_config(PO);return e?I.isObject(e)?I.extend({},lr,e):lr:{}},ei.prototype.getConfig=function(e){return this.getFullConfig()[e]},ei.prototype.currentUrlBlocked=function(){var e,t=I.info.currentUrl(),n=this.getConfig(UO)||[];if(n.length){var r=!1;for(e=0;e<n.length;e++){var i=n[e];try{if(t.match(i)){r=!0;break}}catch(s){return Ur.critical("Error while checking block URL regex: "+i,s),!0}}if(!r)return!0}var o=this.getConfig(HO)||[];if(!o||!o.length)return!1;for(e=0;e<o.length;e++)try{if(t.match(o[e]))return!0}catch(s){return Ur.critical("Error while checking block URL regex: "+o[e],s),!0}return!1},ei.prototype.pageviewTrackingConfig=function(){return this.mp.get_config(PO)?this.getConfig(WO):this.mp.get_config(PV)},ei.prototype.trackDomEvent=function(e,t){if(!this.currentUrlBlocked()){var n=DV(e,{allowElementCallback:this.getConfig(UV),allowSelectors:this.getConfig(FO),blockAttrs:this.getConfig(zO),blockElementCallback:this.getConfig(qO),blockSelectors:this.getConfig(jO),captureExtraAttrs:this.getConfig(GO),captureTextContent:this.getConfig(VO)});n&&(I.extend(n,Bp),this.mp.track(t,n))}},ei.prototype.initClickTracking=function(){Ue.removeEventListener(pf,this.listenerClick),this.getConfig(Yb)&&(Ur.log("Initializing click tracking"),this.listenerClick=Ue.addEventListener(pf,(function(e){this.getConfig(Yb)&&this.trackDomEvent(e,zV)}).bind(this)))},ei.prototype.initInputTracking=function(){Ue.removeEventListener(Np,this.listenerChange),this.getConfig(Wb)&&(Ur.log("Initializing input tracking"),this.listenerChange=Ue.addEventListener(Np,(function(e){this.getConfig(Wb)&&this.trackDomEvent(e,qV)}).bind(this)))},ei.prototype.initPageviewTracking=function(){if(Ue.removeEventListener(IO,this.listenerPopstate),Ue.removeEventListener(AO,this.listenerHashchange),Ue.removeEventListener(Xl,this.listenerLocationchange),!!this.pageviewTrackingConfig()){Ur.log("Initializing pageview tracking");var e="",t=!1;this.currentUrlBlocked()||(t=this.mp.track_pageview(Bp)),t&&(e=I.info.currentUrl()),this.listenerPopstate=Ue.addEventListener(IO,function(){Ue.dispatchEvent(new Event(Xl))}),this.listenerHashchange=Ue.addEventListener(AO,function(){Ue.dispatchEvent(new Event(Xl))});var n=Ue.history.pushState;typeof n=="function"&&(Ue.history.pushState=function(i,o,s){n.call(Ue.history,i,o,s),Ue.dispatchEvent(new Event(Xl))});var r=Ue.history.replaceState;typeof r=="function"&&(Ue.history.replaceState=function(i,o,s){r.call(Ue.history,i,o,s),Ue.dispatchEvent(new Event(Xl))}),this.listenerLocationchange=Ue.addEventListener(Xl,Db((function(){if(!this.currentUrlBlocked()){var i=I.info.currentUrl(),o=!1,s=i.split("#")[0].split("?")[0]!==e.split("#")[0].split("?")[0],u=this.pageviewTrackingConfig();if(u===BO?o=i!==e:u===BV?o=i.split("#")[0]!==e.split("#")[0]:u===FV&&(o=s),o){var c=this.mp.track_pageview(Bp);c&&(e=i),s&&(this.lastScrollCheckpoint=0,Ur.log("Path change: re-initializing scroll depth checkpoints"))}}}).bind(this)))}},ei.prototype.initScrollTracking=function(){Ue.removeEventListener(RO,this.listenerScroll),this.getConfig(Kb)&&(Ur.log("Initializing scroll tracking"),this.lastScrollCheckpoint=0,this.listenerScroll=Ue.addEventListener(RO,Db((function(){if(this.getConfig(Kb)&&!this.currentUrlBlocked()){var e=this.getConfig(ZO),t=(this.getConfig(YO)||[]).slice().sort(function(c,d){return c-d}),n=Ue.scrollY,r=I.extend({$scroll_top:n},Bp);try{var i=Vt.body.scrollHeight,o=Math.round(n/(i-Ue.innerHeight)*100);if(r.$scroll_height=i,r.$scroll_percentage=o,o>this.lastScrollCheckpoint)for(var s=0;s<t.length;s++){var u=t[s];o>=u&&this.lastScrollCheckpoint<u&&(r.$scroll_checkpoint=u,this.lastScrollCheckpoint=u,e=!0)}}catch(c){Ur.critical("Error while calculating scroll percentage",c)}e&&this.mp.track(jV,r)}}).bind(this))))},ei.prototype.initSubmitTracking=function(){Ue.removeEventListener(qb,this.listenerSubmit),this.getConfig(Qb)&&(Ur.log("Initializing submit tracking"),this.listenerSubmit=Ue.addEventListener(qb,(function(e){this.getConfig(Qb)&&this.trackDomEvent(e,HV)}).bind(this)))},aV(ei);var Ho=function(){};Ho.prototype.create_properties=function(){},Ho.prototype.event_handler=function(){},Ho.prototype.after_track_handler=function(){},Ho.prototype.init=function(e){return this.mp=e,this},Ho.prototype.track=function(e,t,n,r){var i=this,o=I.dom_query(e);if(o.length===0){Ut.error("The DOM query ("+e+") returned 0 elements");return}return I.each(o,function(s){I.register_event(s,this.override_event,function(u){var c={},d=i.create_properties(n,this),p=i.mp.get_config("track_links_timeout");i.event_handler(u,this,c),window.setTimeout(i.track_callback(r,d,c,!0),p),i.mp.track(t,d,i.track_callback(r,d,c))})},this),!0},Ho.prototype.track_callback=function(e,t,n,r){r=r||!1;var i=this;return function(){n.callback_fired||(n.callback_fired=!0,!(e&&e(r,t)===!1)&&i.after_track_handler(t,n,r))}},Ho.prototype.create_properties=function(e,t){var n;return typeof e=="function"?n=e(t):n=I.extend({},e),n};var Jl=function(){this.override_event="click"};I.inherit(Jl,Ho),Jl.prototype.create_properties=function(e,t){var n=Jl.superclass.create_properties.apply(this,arguments);return t.href&&(n.url=t.href),n},Jl.prototype.event_handler=function(e,t,n){n.new_tab=e.which===2||e.metaKey||e.ctrlKey||t.target==="_blank",n.href=t.href,n.new_tab||e.preventDefault()},Jl.prototype.after_track_handler=function(e,t){t.new_tab||setTimeout(function(){window.location=t.href},0)};var Fp=function(){this.override_event="submit"};I.inherit(Fp,Ho),Fp.prototype.event_handler=function(e,t,n){n.element=t,e.preventDefault()},Fp.prototype.after_track_handler=function(e,t){setTimeout(function(){t.element.submit()},0)};var Pa="$set",eu="$set_once",ji="$unset",Ls="$add",co="$append",Ns="$union",Go="$remove",GV="$delete",KO={set_action:function(e,t){var n={},r={};return I.isObject(e)?I.each(e,function(i,o){this._is_reserved_property(o)||(r[o]=i)},this):r[e]=t,n[Pa]=r,n},unset_action:function(e){var t={},n=[];return I.isArray(e)||(e=[e]),I.each(e,function(r){this._is_reserved_property(r)||n.push(r)},this),t[ji]=n,t},set_once_action:function(e,t){var n={},r={};return I.isObject(e)?I.each(e,function(i,o){this._is_reserved_property(o)||(r[o]=i)},this):r[e]=t,n[eu]=r,n},union_action:function(e,t){var n={},r={};return I.isObject(e)?I.each(e,function(i,o){this._is_reserved_property(o)||(r[o]=I.isArray(i)?i:[i])},this):r[e]=I.isArray(t)?t:[t],n[Ns]=r,n},append_action:function(e,t){var n={},r={};return I.isObject(e)?I.each(e,function(i,o){this._is_reserved_property(o)||(r[o]=i)},this):r[e]=t,n[co]=r,n},remove_action:function(e,t){var n={},r={};return I.isObject(e)?I.each(e,function(i,o){this._is_reserved_property(o)||(r[o]=i)},this):r[e]=t,n[Go]=r,n},delete_action:function(){var e={};return e[GV]="",e}},gn=function(){};I.extend(gn.prototype,KO),gn.prototype._init=function(e,t,n){this._mixpanel=e,this._group_key=t,this._group_id=n},gn.prototype.set=Wl(function(e,t,n){var r=this.set_action(e,t);return I.isObject(e)&&(n=t),this._send_request(r,n)}),gn.prototype.set_once=Wl(function(e,t,n){var r=this.set_once_action(e,t);return I.isObject(e)&&(n=t),this._send_request(r,n)}),gn.prototype.unset=Wl(function(e,t){var n=this.unset_action(e);return this._send_request(n,t)}),gn.prototype.union=Wl(function(e,t,n){I.isObject(e)&&(n=t);var r=this.union_action(e,t);return this._send_request(r,n)}),gn.prototype.delete=Wl(function(e){var t=this.delete_action();return this._send_request(t,e)}),gn.prototype.remove=Wl(function(e,t,n){var r=this.remove_action(e,t);return this._send_request(r,n)}),gn.prototype._send_request=function(e,t){e.$group_key=this._group_key,e.$group_id=this._group_id,e.$token=this._get_config("token");var n=I.encodeDates(e);return this._mixpanel._track_or_batch({type:"groups",data:n,endpoint:this._get_config("api_host")+"/"+this._get_config("api_routes").groups,batcher:this._mixpanel.request_batchers.groups},t)},gn.prototype._is_reserved_property=function(e){return e==="$group_key"||e==="$group_id"},gn.prototype._get_config=function(e){return this._mixpanel.get_config(e)},gn.prototype.toString=function(){return this._mixpanel.toString()+".group."+this._group_key+"."+this._group_id},gn.prototype.remove=gn.prototype.remove,gn.prototype.set=gn.prototype.set,gn.prototype.set_once=gn.prototype.set_once,gn.prototype.union=gn.prototype.union,gn.prototype.unset=gn.prototype.unset,gn.prototype.toString=gn.prototype.toString;var ht=function(){};I.extend(ht.prototype,KO),ht.prototype._init=function(e){this._mixpanel=e},ht.prototype.set=Na(function(e,t,n){var r=this.set_action(e,t);return I.isObject(e)&&(n=t),this._get_config("save_referrer")&&this._mixpanel.persistence.update_referrer_info(document.referrer),r[Pa]=I.extend({},I.info.people_properties(),r[Pa]),this._send_request(r,n)}),ht.prototype.set_once=Na(function(e,t,n){var r=this.set_once_action(e,t);return I.isObject(e)&&(n=t),this._send_request(r,n)}),ht.prototype.unset=Na(function(e,t){var n=this.unset_action(e);return this._send_request(n,t)}),ht.prototype.increment=Na(function(e,t,n){var r={},i={};return I.isObject(e)?(I.each(e,function(o,s){if(!this._is_reserved_property(s))if(isNaN(parseFloat(o))){Ut.error("Invalid increment value passed to mixpanel.people.increment - must be a number");return}else i[s]=o},this),n=t):(I.isUndefined(t)&&(t=1),i[e]=t),r[Ls]=i,this._send_request(r,n)}),ht.prototype.append=Na(function(e,t,n){I.isObject(e)&&(n=t);var r=this.append_action(e,t);return this._send_request(r,n)}),ht.prototype.remove=Na(function(e,t,n){I.isObject(e)&&(n=t);var r=this.remove_action(e,t);return this._send_request(r,n)}),ht.prototype.union=Na(function(e,t,n){I.isObject(e)&&(n=t);var r=this.union_action(e,t);return this._send_request(r,n)}),ht.prototype.track_charge=Na(function(e,t,n){if(!I.isNumber(e)&&(e=parseFloat(e),isNaN(e))){Ut.error("Invalid value passed to mixpanel.people.track_charge - must be a number");return}return this.append("$transactions",I.extend({$amount:e},t),n)}),ht.prototype.clear_charges=function(e){return this.set("$transactions",[],e)},ht.prototype.delete_user=function(){if(!this._identify_called()){Ut.error("mixpanel.people.delete_user() requires you to call identify() first");return}var e={$delete:this._mixpanel.get_distinct_id()};return this._send_request(e)},ht.prototype.toString=function(){return this._mixpanel.toString()+".people"},ht.prototype._send_request=function(e,t){e.$token=this._get_config("token"),e.$distinct_id=this._mixpanel.get_distinct_id();var n=this._mixpanel.get_property("$device_id"),r=this._mixpanel.get_property("$user_id"),i=this._mixpanel.get_property("$had_persisted_distinct_id");n&&(e.$device_id=n),r&&(e.$user_id=r),i&&(e.$had_persisted_distinct_id=i);var o=I.encodeDates(e);return this._identify_called()?this._mixpanel._track_or_batch({type:"people",data:o,endpoint:this._get_config("api_host")+"/"+this._get_config("api_routes").engage,batcher:this._mixpanel.request_batchers.people},t):(this._enqueue(e),I.isUndefined(t)||(this._get_config("verbose")?t({status:-1,error:null}):t(-1)),I.truncate(o,255))},ht.prototype._get_config=function(e){return this._mixpanel.get_config(e)},ht.prototype._identify_called=function(){return this._mixpanel._flags.identify_called===!0},ht.prototype._enqueue=function(e){Pa in e?this._mixpanel.persistence._add_to_people_queue(Pa,e):eu in e?this._mixpanel.persistence._add_to_people_queue(eu,e):ji in e?this._mixpanel.persistence._add_to_people_queue(ji,e):Ls in e?this._mixpanel.persistence._add_to_people_queue(Ls,e):co in e?this._mixpanel.persistence._add_to_people_queue(co,e):Go in e?this._mixpanel.persistence._add_to_people_queue(Go,e):Ns in e?this._mixpanel.persistence._add_to_people_queue(Ns,e):Ut.error("Invalid call to _enqueue():",e)},ht.prototype._flush_one_queue=function(e,t,n,r){var i=this,o=I.extend({},this._mixpanel.persistence.load_queue(e)),s=o;!I.isUndefined(o)&&I.isObject(o)&&!I.isEmptyObject(o)&&(i._mixpanel.persistence._pop_from_people_queue(e,o),i._mixpanel.persistence.save(),r&&(s=r(o)),t.call(i,s,function(u,c){u===0&&i._mixpanel.persistence._add_to_people_queue(e,o),I.isUndefined(n)||n(u,c)}))},ht.prototype._flush=function(e,t,n,r,i,o,s){var u=this;this._flush_one_queue(Pa,this.set,e),this._flush_one_queue(eu,this.set_once,r),this._flush_one_queue(ji,this.unset,o,function(b){return I.keys(b)}),this._flush_one_queue(Ls,this.increment,t),this._flush_one_queue(Ns,this.union,i);var c=this._mixpanel.persistence.load_queue(co);if(!I.isUndefined(c)&&I.isArray(c)&&c.length)for(var d,p=function(b,w){b===0&&u._mixpanel.persistence._add_to_people_queue(co,d),I.isUndefined(n)||n(b,w)},h=c.length-1;h>=0;h--)c=this._mixpanel.persistence.load_queue(co),d=c.pop(),u._mixpanel.persistence.save(),I.isEmptyObject(d)||u.append(d,p);var m=this._mixpanel.persistence.load_queue(Go);if(!I.isUndefined(m)&&I.isArray(m)&&m.length)for(var v,_=function(b,w){b===0&&u._mixpanel.persistence._add_to_people_queue(Go,v),I.isUndefined(s)||s(b,w)},x=m.length-1;x>=0;x--)m=this._mixpanel.persistence.load_queue(Go),v=m.pop(),u._mixpanel.persistence.save(),I.isEmptyObject(v)||u.remove(v,_)},ht.prototype._is_reserved_property=function(e){return e==="$distinct_id"||e==="$token"||e==="$device_id"||e==="$user_id"||e==="$had_persisted_distinct_id"},ht.prototype.set=ht.prototype.set,ht.prototype.set_once=ht.prototype.set_once,ht.prototype.unset=ht.prototype.unset,ht.prototype.increment=ht.prototype.increment,ht.prototype.append=ht.prototype.append,ht.prototype.remove=ht.prototype.remove,ht.prototype.union=ht.prototype.union,ht.prototype.track_charge=ht.prototype.track_charge,ht.prototype.clear_charges=ht.prototype.clear_charges,ht.prototype.delete_user=ht.prototype.delete_user,ht.prototype.toString=ht.prototype.toString;var Xb="__mps",Jb="__mpso",e1="__mpus",t1="__mpa",n1="__mpap",r1="__mpr",i1="__mpu",QO="$people_distinct_id",Up="__alias",gf="__timers",VV=[Xb,Jb,e1,t1,n1,r1,i1,QO,Up,gf],xt=function(e){this.props={},this.campaign_params_saved=!1,e.persistence_name?this.name="mp_"+e.persistence_name:this.name="mp_"+e.token+"_mixpanel";var t=e.persistence;t!=="cookie"&&t!=="localStorage"&&(Ut.critical("Unknown persistence type "+t+"; falling back to cookie"),t=e.persistence="cookie"),t==="localStorage"&&I.localStorage.is_supported()?this.storage=I.localStorage:this.storage=I.cookie,this.load(),this.update_config(e),this.upgrade(),this.save()};xt.prototype.properties=function(){var e={};return this.load(),I.each(this.props,function(t,n){I.include(VV,n)||(e[n]=t)}),e},xt.prototype.load=function(){if(!this.disabled){var e=this.storage.parse(this.name);e&&(this.props=I.extend({},e))}},xt.prototype.upgrade=function(){var e,t;this.storage===I.localStorage?(e=I.cookie.parse(this.name),I.cookie.remove(this.name),I.cookie.remove(this.name,!0),e&&this.register_once(e)):this.storage===I.cookie&&(t=I.localStorage.parse(this.name),I.localStorage.remove(this.name),t&&this.register_once(t))},xt.prototype.save=function(){this.disabled||this.storage.set(this.name,Yl(this.props),this.expire_days,this.cross_subdomain,this.secure,this.cross_site,this.cookie_domain)},xt.prototype.load_prop=function(e){return this.load(),this.props[e]},xt.prototype.remove=function(){this.storage.remove(this.name,!1,this.cookie_domain),this.storage.remove(this.name,!0,this.cookie_domain)},xt.prototype.clear=function(){this.remove(),this.props={}},xt.prototype.register_once=function(e,t,n){return I.isObject(e)?(typeof t>"u"&&(t="None"),this.expire_days=typeof n>"u"?this.default_expiry:n,this.load(),I.each(e,function(r,i){(!this.props.hasOwnProperty(i)||this.props[i]===t)&&(this.props[i]=r)},this),this.save(),!0):!1},xt.prototype.register=function(e,t){return I.isObject(e)?(this.expire_days=typeof t>"u"?this.default_expiry:t,this.load(),I.extend(this.props,e),this.save(),!0):!1},xt.prototype.unregister=function(e){this.load(),e in this.props&&(delete this.props[e],this.save())},xt.prototype.update_search_keyword=function(e){this.register(I.info.searchInfo(e))},xt.prototype.update_referrer_info=function(e){this.register_once({$initial_referrer:e||"$direct",$initial_referring_domain:I.info.referringDomain(e)||"$direct"},"")},xt.prototype.get_referrer_info=function(){return I.strip_empty_properties({$initial_referrer:this.props.$initial_referrer,$initial_referring_domain:this.props.$initial_referring_domain})},xt.prototype.update_config=function(e){this.default_expiry=this.expire_days=e.cookie_expiration,this.set_disabled(e.disable_persistence),this.set_cookie_domain(e.cookie_domain),this.set_cross_site(e.cross_site_cookie),this.set_cross_subdomain(e.cross_subdomain_cookie),this.set_secure(e.secure_cookie)},xt.prototype.set_disabled=function(e){this.disabled=e,this.disabled?this.remove():this.save()},xt.prototype.set_cookie_domain=function(e){e!==this.cookie_domain&&(this.remove(),this.cookie_domain=e,this.save())},xt.prototype.set_cross_site=function(e){e!==this.cross_site&&(this.cross_site=e,this.remove(),this.save())},xt.prototype.set_cross_subdomain=function(e){e!==this.cross_subdomain&&(this.cross_subdomain=e,this.remove(),this.save())},xt.prototype.get_cross_subdomain=function(){return this.cross_subdomain},xt.prototype.set_secure=function(e){e!==this.secure&&(this.secure=!!e,this.remove(),this.save())},xt.prototype._add_to_people_queue=function(e,t){var n=this._get_queue_key(e),r=t[e],i=this._get_or_create_queue(Pa),o=this._get_or_create_queue(eu),s=this._get_or_create_queue(ji),u=this._get_or_create_queue(Ls),c=this._get_or_create_queue(Ns),d=this._get_or_create_queue(Go,[]),p=this._get_or_create_queue(co,[]);n===Xb?(I.extend(i,r),this._pop_from_people_queue(Ls,r),this._pop_from_people_queue(Ns,r),this._pop_from_people_queue(ji,r)):n===Jb?(I.each(r,function(h,m){m in o||(o[m]=h)}),this._pop_from_people_queue(ji,r)):n===e1?I.each(r,function(h){I.each([i,o,u,c],function(m){h in m&&delete m[h]}),I.each(p,function(m){h in m&&delete m[h]}),s[h]=!0}):n===t1?(I.each(r,function(h,m){m in i?i[m]+=h:(m in u||(u[m]=0),u[m]+=h)},this),this._pop_from_people_queue(ji,r)):n===i1?(I.each(r,function(h,m){I.isArray(h)&&(m in c||(c[m]=[]),I.each(h,function(v){I.include(c[m],v)||c[m].push(v)}))}),this._pop_from_people_queue(ji,r)):n===r1?(d.push(r),this._pop_from_people_queue(co,r)):n===n1&&(p.push(r),this._pop_from_people_queue(ji,r)),Ut.log("MIXPANEL PEOPLE REQUEST (QUEUED, PENDING IDENTIFY):"),Ut.log(t),this.save()},xt.prototype._pop_from_people_queue=function(e,t){var n=this.props[this._get_queue_key(e)];I.isUndefined(n)||I.each(t,function(r,i){e===co||e===Go?I.each(n,function(o){o[i]===r&&delete o[i]}):delete n[i]},this)},xt.prototype.load_queue=function(e){return this.load_prop(this._get_queue_key(e))},xt.prototype._get_queue_key=function(e){if(e===Pa)return Xb;if(e===eu)return Jb;if(e===ji)return e1;if(e===Ls)return t1;if(e===co)return n1;if(e===Go)return r1;if(e===Ns)return i1;Ut.error("Invalid queue:",e)},xt.prototype._get_or_create_queue=function(e,t){var n=this._get_queue_key(e);return t=I.isUndefined(t)?{}:t,this.props[n]||(this.props[n]=t)},xt.prototype.set_event_timer=function(e,t){var n=this.load_prop(gf)||{};n[e]=t,this.props[gf]=n,this.save()},xt.prototype.remove_event_timer=function(e){var t=this.load_prop(gf)||{},n=t[e];return I.isUndefined(n)||(delete this.props[gf][e],this.save()),n};var o1,XO=function(e,t){throw new Error(e+" not available in this build.")},Cr,JO=0,ZV=1,YV=function(e){return e},vi="mixpanel",eT="base64",WV="json",a1="$device:",tu=Ue.XMLHttpRequest&&"withCredentials"in new XMLHttpRequest,tT=!tu&&qo.indexOf("MSIE")===-1&&qo.indexOf("Mozilla")===-1,zp=null;Da.sendBeacon&&(zp=function(){return Da.sendBeacon.apply(Da,arguments)});var nT={track:"track/",engage:"engage/",groups:"groups/",record:"record/"},rT={api_host:"https://api-js.mixpanel.com",api_routes:nT,api_method:"POST",api_transport:"XHR",api_payload_format:eT,app_host:"https://mixpanel.com",autocapture:!1,cdn:"https://cdn.mxpnl.com",cross_site_cookie:!1,cross_subdomain_cookie:!0,error_reporter:$a,persistence:"cookie",persistence_name:"",cookie_domain:"",cookie_name:"",loaded:$a,mp_loader:null,track_marketing:!0,track_pageview:!1,skip_first_touch_marketing:!1,store_google:!0,stop_utm_persistence:!1,save_referrer:!0,test:!1,verbose:!1,img:!1,debug:!1,track_links_timeout:300,cookie_expiration:365,upgrade:!1,disable_persistence:!1,disable_cookie:!1,secure_cookie:!1,ip:!0,opt_out_tracking_by_default:!1,opt_out_persistence_by_default:!1,opt_out_tracking_persistence_type:"localStorage",opt_out_tracking_cookie_prefix:null,property_blacklist:[],xhr_headers:{},ignore_dnt:!1,batch_requests:!0,batch_size:50,batch_flush_interval_ms:5e3,batch_request_timeout_ms:9e4,batch_autostart:!0,hooks:{},record_block_class:new RegExp("^(mp-block|fs-exclude|amp-block|rr-block|ph-no-capture)$"),record_block_selector:"img, video",record_canvas:!1,record_collect_fonts:!1,record_idle_timeout_ms:30*60*1e3,record_mask_text_class:new RegExp("^(mp-mask|fs-mask|amp-mask|rr-mask|ph-mask)$"),record_mask_text_selector:"*",record_max_ms:lf,record_min_ms:0,record_sessions_percent:0,recorder_src:"https://cdn.mxpnl.com/libs/mixpanel-recorder.min.js"},iT=!1,ae=function(){},s1=function(e,t,n){var r,i=n===vi?Cr:Cr[n];if(i&&o1===JO)r=i;else{if(i&&!I.isArray(i)){Ut.error("You have already initialized "+n);return}r=new ae}if(r._cached_groups={},r._init(e,t,n),r.people=new ht,r.people._init(r),!r.get_config("skip_first_touch_marketing")){var o=I.info.campaignParams(null),s={},u=!1;I.each(o,function(c,d){s["initial_"+d]=c,c&&(u=!0)}),u&&r.people.set_once(s)}return qi.DEBUG=qi.DEBUG||r.get_config("debug"),!I.isUndefined(i)&&I.isArray(i)&&(r._execute_array.call(r.people,i.people),r._execute_array(i)),r};ae.prototype.init=function(e,t,n){if(I.isUndefined(n)){this.report_error("You must name your new library: init(token, config, name)");return}if(n===vi){this.report_error("You must initialize the main mixpanel object right after you include the Mixpanel js snippet");return}var r=s1(e,t,n);return Cr[n]=r,r._loaded(),r},ae.prototype._init=function(e,t,n){t=t||{},this.__loaded=!0,this.config={};var r={};if(!("api_payload_format"in t)){var i=t.api_host||rT.api_host;i.match(/\.mixpanel\.com/)&&(r.api_payload_format=WV)}if(this.set_config(I.extend({},rT,r,t,{name:n,token:e,callback_fn:(n===vi?n:vi+"."+n)+"._jsc"})),this._jsc=$a,this.__dom_loaded_queue=[],this.__request_queue=[],this.__disabled_events=[],this._flags={disable_all_events:!1,identify_called:!1},this.request_batchers={},this._batch_requests=this.get_config("batch_requests"),this._batch_requests){if(!I.localStorage.is_supported(!0)||!tu)this._batch_requests=!1,Ut.log("Turning off Mixpanel request-queueing; needs XHR and localStorage support"),I.each(this.get_batcher_configs(),function(u){Ut.log("Clearing batch queue "+u.queue_key),I.localStorage.remove(u.queue_key)});else if(this.init_batchers(),zp&&Ue.addEventListener){var o=I.bind(function(){this.request_batchers.events.stopped||this.request_batchers.events.flush({unloading:!0})},this);Ue.addEventListener("pagehide",function(u){u.persisted&&o()}),Ue.addEventListener("visibilitychange",function(){Vt.visibilityState==="hidden"&&o()})}}this.persistence=this.cookie=new xt(this.config),this.unpersisted_superprops={},this._gdpr_init();var s=I.UUID();this.get_distinct_id()||this.register_once({distinct_id:a1+s,$device_id:s},""),this.autocapture=new ei(this),this.autocapture.init(),this._init_tab_id(),this._check_and_start_session_recording()},ae.prototype._init_tab_id=function(){if(I.sessionStorage.is_supported())try{var e=this.get_config("name")+"_"+this.get_config("token"),t="mp_tab_id_"+e,n="mp_gen_new_tab_id_"+e;(I.sessionStorage.get(n)||!I.sessionStorage.get(t))&&I.sessionStorage.set(t,"$tab-"+I.UUID()),I.sessionStorage.set(n,"1"),this.tab_id=I.sessionStorage.get(t),Ue.addEventListener("beforeunload",function(){I.sessionStorage.remove(n)})}catch(r){this.report_error("Error initializing tab id",r)}else this.report_error("Session storage is not supported, cannot keep track of unique tab ID.")},ae.prototype.get_tab_id=function(){return this.tab_id||null},ae.prototype._should_load_recorder=function(){var e=new so(Pb),t=this.get_tab_id();return e.init().then(function(){return e.getAll()}).then(function(n){for(var r=0;r<n.length;r++)if(zb(n[r])||n[r].tabId===t)return!0;return!1}).catch(I.bind(function(n){this.report_error("Error checking recording registry",n)},this))},ae.prototype._check_and_start_session_recording=La(function(e){if(!Ue.MutationObserver){Ut.critical("Browser does not support MutationObserver; skipping session recording");return}var t=I.bind(function(r){var i=I.bind(function(){this._recorder=this._recorder||new Ue.__mp_recorder(this),this._recorder.resumeRecording(r)},this);I.isUndefined(Ue.__mp_recorder)?XO(this.get_config("recorder_src"),i):i()},this),n=this.get_config("record_sessions_percent")>0&&Math.random()*100<=this.get_config("record_sessions_percent");e||n?t(!0):this._should_load_recorder().then(function(r){r&&t(!1)})}),ae.prototype.start_session_recording=function(){this._check_and_start_session_recording(!0)},ae.prototype.stop_session_recording=function(){this._recorder&&this._recorder.stopRecording()},ae.prototype.pause_session_recording=function(){this._recorder&&this._recorder.pauseRecording()},ae.prototype.resume_session_recording=function(){this._recorder&&this._recorder.resumeRecording()},ae.prototype.get_session_recording_properties=function(){var e={},t=this._get_session_replay_id();return t&&(e.$mp_replay_id=t),e},ae.prototype.get_session_replay_url=function(){var e=null,t=this._get_session_replay_id();if(t){var n=I.HTTPBuildQuery({replay_id:t,distinct_id:this.get_distinct_id(),token:this.get_config("token")});e="https://mixpanel.com/projects/replay-redirect?"+n}return e},ae.prototype._get_session_replay_id=function(){var e=null;return this._recorder&&(e=this._recorder.replayId),e||null},ae.prototype.__get_recorder=function(){return this._recorder},ae.prototype._loaded=function(){if(this.get_config("loaded")(this),this._set_default_superprops(),this.people.set_once(this.persistence.get_referrer_info()),this.get_config("store_google")&&this.get_config("stop_utm_persistence")){var e=I.info.campaignParams(null);I.each(e,(function(t,n){this.unregister(n)}).bind(this))}},ae.prototype._set_default_superprops=function(){this.persistence.update_search_keyword(Vt.referrer),this.get_config("store_google")&&!this.get_config("stop_utm_persistence")&&this.register(I.info.campaignParams()),this.get_config("save_referrer")&&this.persistence.update_referrer_info(Vt.referrer)},ae.prototype._dom_loaded=function(){I.each(this.__dom_loaded_queue,function(e){this._track_dom.apply(this,e)},this),this.has_opted_out_tracking()||I.each(this.__request_queue,function(e){this._send_request.apply(this,e)},this),delete this.__dom_loaded_queue,delete this.__request_queue},ae.prototype._track_dom=function(e,t){if(this.get_config("img"))return this.report_error("You can't use DOM tracking functions with img = true."),!1;if(!iT)return this.__dom_loaded_queue.push([e,t]),!1;var n=new e().init(this);return n.track.apply(n,t)},ae.prototype._prepare_callback=function(e,t){if(I.isUndefined(e))return null;if(tu){var n=function(s){e(s,t)};return n}else{var r=this._jsc,i=""+Math.floor(Math.random()*1e8),o=this.get_config("callback_fn")+"["+i+"]";return r[i]=function(s){delete r[i],e(s,t)},o}},ae.prototype._send_request=function(e,t,n,r){var i=!0;if(tT)return this.__request_queue.push(arguments),i;var o={method:this.get_config("api_method"),transport:this.get_config("api_transport"),verbose:this.get_config("verbose")},s=null;!r&&(I.isFunction(n)||typeof n=="string")&&(r=n,n=null),n=I.extend(o,n||{}),tu||(n.method="GET");var u=n.method==="POST",c=zp&&u&&n.transport.toLowerCase()==="sendbeacon",d=n.verbose;t.verbose&&(d=!0),this.get_config("test")&&(t.test=1),d&&(t.verbose=1),this.get_config("img")&&(t.img=1),tu||(r?t.callback=r:(d||this.get_config("test"))&&(t.callback="(function(){})")),t.ip=this.get_config("ip")?1:0,t._=new Date().getTime().toString(),u&&(s="data="+encodeURIComponent(t.data),delete t.data),e+="?"+I.HTTPBuildQuery(t);var p=this;if("img"in t){var h=Vt.createElement("img");h.src=e,Vt.body.appendChild(h)}else if(c){try{i=zp(e,s)}catch(w){p.report_error(w),i=!1}try{r&&r(i?1:0)}catch(w){p.report_error(w)}}else if(tu)try{var m=new XMLHttpRequest;m.open(n.method,e,!0);var v=this.get_config("xhr_headers");if(u&&(v["Content-Type"]="application/x-www-form-urlencoded"),I.each(v,function(w,C){m.setRequestHeader(C,w)}),n.timeout_ms&&typeof m.timeout<"u"){m.timeout=n.timeout_ms;var _=new Date().getTime()}m.withCredentials=!0,m.onreadystatechange=function(){if(m.readyState===4)if(m.status===200){if(r)if(d){var w;try{w=I.JSONDecode(m.responseText)}catch(R){if(p.report_error(R),n.ignore_json_errors)w=m.responseText;else return}r(w)}else r(Number(m.responseText))}else{var C;if(m.timeout&&!m.status&&new Date().getTime()-_>=m.timeout?C="timeout":C="Bad HTTP status: "+m.status+" "+m.statusText,p.report_error(C),r)if(d){var E=m.responseHeaders||{};r({status:0,httpStatusCode:m.status,error:C,retryAfter:E["Retry-After"]})}else r(0)}},m.send(s)}catch(w){p.report_error(w),i=!1}else{var x=Vt.createElement("script");x.type="text/javascript",x.async=!0,x.defer=!0,x.src=e;var b=Vt.getElementsByTagName("script")[0];b.parentNode.insertBefore(x,b)}return i},ae.prototype._execute_array=function(e){var t,n=[],r=[],i=[];I.each(e,function(s){s&&(t=s[0],I.isArray(t)?i.push(s):typeof s=="function"?s.call(this):I.isArray(s)&&t==="alias"?n.push(s):I.isArray(s)&&t.indexOf("track")!==-1&&typeof this[t]=="function"?i.push(s):r.push(s))},this);var o=function(s,u){I.each(s,function(c){if(I.isArray(c[0])){var d=u;I.each(c,function(p){d=d[p[0]].apply(d,p.slice(1))})}else this[c[0]].apply(this,c.slice(1))},u)};o(n,this),o(r,this),o(i,this)},ae.prototype.are_batchers_initialized=function(){return!!this.request_batchers.events},ae.prototype.get_batcher_configs=function(){var e="__mpq_"+this.get_config("token"),t=this.get_config("api_routes");return this._batcher_configs=this._batcher_configs||{events:{type:"events",endpoint:"/"+t.track,queue_key:e+"_ev"},people:{type:"people",endpoint:"/"+t.engage,queue_key:e+"_pp"},groups:{type:"groups",endpoint:"/"+t.groups,queue_key:e+"_gr"}},this._batcher_configs},ae.prototype.init_batchers=function(){if(!this.are_batchers_initialized()){var e=I.bind(function(n){return new mi(n.queue_key,{libConfig:this.config,errorReporter:this.get_config("error_reporter"),sendRequestFunc:I.bind(function(r,i,o){this._send_request(this.get_config("api_host")+n.endpoint,this._encode_data_for_request(r),i,this._prepare_callback(o,r))},this),beforeSendHook:I.bind(function(r){return this._run_hook("before_send_"+n.type,r)},this),stopAllBatchingFunc:I.bind(this.stop_batch_senders,this),usePersistence:!0})},this),t=this.get_batcher_configs();this.request_batchers={events:e(t.events),people:e(t.people),groups:e(t.groups)}}this.get_config("batch_autostart")&&this.start_batch_senders()},ae.prototype.start_batch_senders=function(){this._batchers_were_started=!0,this.are_batchers_initialized()&&(this._batch_requests=!0,I.each(this.request_batchers,function(e){e.start()}))},ae.prototype.stop_batch_senders=function(){this._batch_requests=!1,I.each(this.request_batchers,function(e){e.stop(),e.clear()})},ae.prototype.push=function(e){this._execute_array([e])},ae.prototype.disable=function(e){typeof e>"u"?this._flags.disable_all_events=!0:this.__disabled_events=this.__disabled_events.concat(e)},ae.prototype._encode_data_for_request=function(e){var t=Yl(e);return this.get_config("api_payload_format")===eT&&(t=I.base64Encode(t)),{data:t}},ae.prototype._track_or_batch=function(e,t){var n=I.truncate(e.data,255),r=e.endpoint,i=e.batcher,o=e.should_send_immediately,s=e.send_request_options||{};t=t||$a;var u=!0,c=I.bind(function(){return s.skip_hooks||(n=this._run_hook("before_send_"+e.type,n)),n?(Ut.log("MIXPANEL REQUEST:"),Ut.log(n),this._send_request(r,this._encode_data_for_request(n),s,this._prepare_callback(t,n))):null},this);return this._batch_requests&&!o?i.enqueue(n).then(function(d){d?t(1,n):c()}):u=c(),u&&n},ae.prototype.track=La(function(e,t,n,r){!r&&typeof n=="function"&&(r=n,n=null),n=n||{};var i=n.transport;i&&(n.transport=i);var o=n.send_immediately;if(typeof r!="function"&&(r=$a),I.isUndefined(e)){this.report_error("No event name provided to mixpanel.track");return}if(this._event_is_disabled(e)){r(0);return}t=I.extend({},t),t.token=this.get_config("token");var s=this.persistence.remove_event_timer(e);if(!I.isUndefined(s)){var u=new Date().getTime()-s;t.$duration=parseFloat((u/1e3).toFixed(3))}this._set_default_superprops();var c=this.get_config("track_marketing")?I.info.marketingParams():{};t=I.extend({},I.info.properties({mp_loader:this.get_config("mp_loader")}),c,this.persistence.properties(),this.unpersisted_superprops,this.get_session_recording_properties(),t);var d=this.get_config("property_blacklist");I.isArray(d)?I.each(d,function(m){delete t[m]}):this.report_error("Invalid value for property_blacklist config: "+d);var p={event:e,properties:t},h=this._track_or_batch({type:"events",data:p,endpoint:this.get_config("api_host")+"/"+this.get_config("api_routes").track,batcher:this.request_batchers.events,should_send_immediately:o,send_request_options:n},r);return h}),ae.prototype.set_group=La(function(e,t,n){I.isArray(t)||(t=[t]);var r={};return r[e]=t,this.register(r),this.people.set(e,t,n)}),ae.prototype.add_group=La(function(e,t,n){var r=this.get_property(e),i={};return r===void 0?(i[e]=[t],this.register(i)):r.indexOf(t)===-1&&(r.push(t),i[e]=r,this.register(i)),this.people.union(e,t,n)}),ae.prototype.remove_group=La(function(e,t,n){var r=this.get_property(e);if(r!==void 0){var i=r.indexOf(t);i>-1&&(r.splice(i,1),this.register({group_key:r})),r.length===0&&this.unregister(e)}return this.people.remove(e,t,n)}),ae.prototype.track_with_groups=La(function(e,t,n,r){var i=I.extend({},t||{});return I.each(n,function(o,s){o!=null&&(i[s]=o)}),this.track(e,i,r)}),ae.prototype._create_map_key=function(e,t){return e+"_"+JSON.stringify(t)},ae.prototype._remove_group_from_cache=function(e,t){delete this._cached_groups[this._create_map_key(e,t)]},ae.prototype.get_group=function(e,t){var n=this._create_map_key(e,t),r=this._cached_groups[n];return(r===void 0||r._group_key!==e||r._group_id!==t)&&(r=new gn,r._init(this,e,t),this._cached_groups[n]=r),r},ae.prototype.track_pageview=La(function(e,t){typeof e!="object"&&(e={}),t=t||{};var n=t.event_name||"$mp_web_page_view",r=I.extend(I.info.mpPageViewProperties(),I.info.campaignParams(),I.info.clickParams()),i=I.extend({},r,e);return this.track(n,i)}),ae.prototype.track_links=function(){return this._track_dom.call(this,Jl,arguments)},ae.prototype.track_forms=function(){return this._track_dom.call(this,Fp,arguments)},ae.prototype.time_event=function(e){if(I.isUndefined(e)){this.report_error("No event name provided to mixpanel.time_event");return}this._event_is_disabled(e)||this.persistence.set_event_timer(e,new Date().getTime())};var KV={persistent:!0},l1=function(e){var t;return I.isObject(e)?t=e:I.isUndefined(e)?t={}:t={days:e},I.extend({},KV,t)};ae.prototype.register=function(e,t){var n=l1(t);n.persistent?this.persistence.register(e,n.days):I.extend(this.unpersisted_superprops,e)},ae.prototype.register_once=function(e,t,n){var r=l1(n);r.persistent?this.persistence.register_once(e,t,r.days):(typeof t>"u"&&(t="None"),I.each(e,function(i,o){(!this.unpersisted_superprops.hasOwnProperty(o)||this.unpersisted_superprops[o]===t)&&(this.unpersisted_superprops[o]=i)},this))},ae.prototype.unregister=function(e,t){t=l1(t),t.persistent?this.persistence.unregister(e):delete this.unpersisted_superprops[e]},ae.prototype._register_single=function(e,t){var n={};n[e]=t,this.register(n)},ae.prototype.identify=function(e,t,n,r,i,o,s,u){var c=this.get_distinct_id();if(e&&c!==e){if(typeof e=="string"&&e.indexOf(a1)===0)return this.report_error("distinct_id cannot have $device: prefix"),-1;this.register({$user_id:e})}if(!this.get_property("$device_id")){var d=c;this.register_once({$had_persisted_distinct_id:!0,$device_id:d},"")}e!==c&&e!==this.get_property(Up)&&(this.unregister(Up),this.register({distinct_id:e})),this._flags.identify_called=!0,this.people._flush(t,n,r,i,o,s,u),e!==c&&this.track("$identify",{distinct_id:e,$anon_distinct_id:c},{skip_hooks:!0})},ae.prototype.reset=function(){this.persistence.clear(),this._flags.identify_called=!1;var e=I.UUID();this.register_once({distinct_id:a1+e,$device_id:e},"")},ae.prototype.get_distinct_id=function(){return this.get_property("distinct_id")},ae.prototype.alias=function(e,t){if(e===this.get_property(QO))return this.report_error("Attempting to create alias for existing People user - aborting."),-2;var n=this;return I.isUndefined(t)&&(t=this.get_distinct_id()),e!==t?(this._register_single(Up,e),this.track("$create_alias",{alias:e,distinct_id:t},{skip_hooks:!0},function(){n.identify(e)})):(this.report_error("alias matches current distinct_id - skipping api call."),this.identify(e),-1)},ae.prototype.name_tag=function(e){this._register_single("mp_name_tag",e)},ae.prototype.set_config=function(e){if(I.isObject(e)){I.extend(this.config,e);var t=e.batch_size;t&&I.each(this.request_batchers,function(n){n.resetBatchSize()}),this.get_config("persistence_name")||(this.config.persistence_name=this.config.cookie_name),this.get_config("disable_persistence")||(this.config.disable_persistence=this.config.disable_cookie),this.persistence&&this.persistence.update_config(this.config),qi.DEBUG=qi.DEBUG||this.get_config("debug"),"autocapture"in e&&this.autocapture&&this.autocapture.init()}},ae.prototype.get_config=function(e){return this.config[e]},ae.prototype._run_hook=function(e){var t=(this.config.hooks[e]||YV).apply(this,Ma.call(arguments,1));return typeof t>"u"&&(this.report_error(e+" hook did not return a value"),t=null),t},ae.prototype.get_property=function(e){return this.persistence.load_prop([e])},ae.prototype.toString=function(){var e=this.get_config("name");return e!==vi&&(e=vi+"."+e),e},ae.prototype._event_is_disabled=function(e){return I.isBlockedUA(qo)||this._flags.disable_all_events||I.include(this.__disabled_events,e)},ae.prototype._gdpr_init=function(){var e=this.get_config("opt_out_tracking_persistence_type")==="localStorage";e&&I.localStorage.is_supported()&&(!this.has_opted_in_tracking()&&this.has_opted_in_tracking({persistence_type:"cookie"})&&this.opt_in_tracking({enable_persistence:!1}),!this.has_opted_out_tracking()&&this.has_opted_out_tracking({persistence_type:"cookie"})&&this.opt_out_tracking({clear_persistence:!1}),this.clear_opt_in_out_tracking({persistence_type:"cookie",enable_persistence:!1})),this.has_opted_out_tracking()?this._gdpr_update_persistence({clear_persistence:!0}):!this.has_opted_in_tracking()&&(this.get_config("opt_out_tracking_by_default")||I.cookie.get("mp_optout"))&&(I.cookie.remove("mp_optout"),this.opt_out_tracking({clear_persistence:this.get_config("opt_out_persistence_by_default")}))},ae.prototype._gdpr_update_persistence=function(e){var t;if(e&&e.clear_persistence)t=!0;else if(e&&e.enable_persistence)t=!1;else return;!this.get_config("disable_persistence")&&this.persistence.disabled!==t&&this.persistence.set_disabled(t),t?(this.stop_batch_senders(),this.stop_session_recording()):this._batchers_were_started&&this.start_batch_senders()},ae.prototype._gdpr_call_func=function(e,t){return t=I.extend({track:I.bind(this.track,this),persistence_type:this.get_config("opt_out_tracking_persistence_type"),cookie_prefix:this.get_config("opt_out_tracking_cookie_prefix"),cookie_expiration:this.get_config("cookie_expiration"),cross_site_cookie:this.get_config("cross_site_cookie"),cross_subdomain_cookie:this.get_config("cross_subdomain_cookie"),cookie_domain:this.get_config("cookie_domain"),secure_cookie:this.get_config("secure_cookie"),ignore_dnt:this.get_config("ignore_dnt")},t),I.localStorage.is_supported()||(t.persistence_type="cookie"),e(this.get_config("token"),{track:t.track,trackEventName:t.track_event_name,trackProperties:t.track_properties,persistenceType:t.persistence_type,persistencePrefix:t.cookie_prefix,cookieDomain:t.cookie_domain,cookieExpiration:t.cookie_expiration,crossSiteCookie:t.cross_site_cookie,crossSubdomainCookie:t.cross_subdomain_cookie,secureCookie:t.secure_cookie,ignoreDnt:t.ignore_dnt})},ae.prototype.opt_in_tracking=function(e){e=I.extend({enable_persistence:!0},e),this._gdpr_call_func(_V,e),this._gdpr_update_persistence(e)},ae.prototype.opt_out_tracking=function(e){e=I.extend({clear_persistence:!0,delete_user:!0},e),e.delete_user&&this.people&&this.people._identify_called()&&(this.people.delete_user(),this.people.clear_charges()),this._gdpr_call_func(bV,e),this._gdpr_update_persistence(e)},ae.prototype.has_opted_in_tracking=function(e){return this._gdpr_call_func(SV,e)},ae.prototype.has_opted_out_tracking=function(e){return this._gdpr_call_func(_O,e)},ae.prototype.clear_opt_in_out_tracking=function(e){e=I.extend({enable_persistence:!0},e),this._gdpr_call_func(wV,e),this._gdpr_update_persistence(e)},ae.prototype.report_error=function(e,t){Ut.error.apply(Ut.error,arguments);try{!t&&!(e instanceof Error)&&(e=new Error(e)),this.get_config("error_reporter")(e,t)}catch(n){Ut.error(n)}},ae.prototype.init=ae.prototype.init,ae.prototype.reset=ae.prototype.reset,ae.prototype.disable=ae.prototype.disable,ae.prototype.time_event=ae.prototype.time_event,ae.prototype.track=ae.prototype.track,ae.prototype.track_links=ae.prototype.track_links,ae.prototype.track_forms=ae.prototype.track_forms,ae.prototype.track_pageview=ae.prototype.track_pageview,ae.prototype.register=ae.prototype.register,ae.prototype.register_once=ae.prototype.register_once,ae.prototype.unregister=ae.prototype.unregister,ae.prototype.identify=ae.prototype.identify,ae.prototype.alias=ae.prototype.alias,ae.prototype.name_tag=ae.prototype.name_tag,ae.prototype.set_config=ae.prototype.set_config,ae.prototype.get_config=ae.prototype.get_config,ae.prototype.get_property=ae.prototype.get_property,ae.prototype.get_distinct_id=ae.prototype.get_distinct_id,ae.prototype.toString=ae.prototype.toString,ae.prototype.opt_out_tracking=ae.prototype.opt_out_tracking,ae.prototype.opt_in_tracking=ae.prototype.opt_in_tracking,ae.prototype.has_opted_out_tracking=ae.prototype.has_opted_out_tracking,ae.prototype.has_opted_in_tracking=ae.prototype.has_opted_in_tracking,ae.prototype.clear_opt_in_out_tracking=ae.prototype.clear_opt_in_out_tracking,ae.prototype.get_group=ae.prototype.get_group,ae.prototype.set_group=ae.prototype.set_group,ae.prototype.add_group=ae.prototype.add_group,ae.prototype.remove_group=ae.prototype.remove_group,ae.prototype.track_with_groups=ae.prototype.track_with_groups,ae.prototype.start_batch_senders=ae.prototype.start_batch_senders,ae.prototype.stop_batch_senders=ae.prototype.stop_batch_senders,ae.prototype.start_session_recording=ae.prototype.start_session_recording,ae.prototype.stop_session_recording=ae.prototype.stop_session_recording,ae.prototype.pause_session_recording=ae.prototype.pause_session_recording,ae.prototype.resume_session_recording=ae.prototype.resume_session_recording,ae.prototype.get_session_recording_properties=ae.prototype.get_session_recording_properties,ae.prototype.get_session_replay_url=ae.prototype.get_session_replay_url,ae.prototype.get_tab_id=ae.prototype.get_tab_id,ae.prototype.DEFAULT_API_ROUTES=nT,ae.prototype.__get_recorder=ae.prototype.__get_recorder,xt.prototype.properties=xt.prototype.properties,xt.prototype.update_search_keyword=xt.prototype.update_search_keyword,xt.prototype.update_referrer_info=xt.prototype.update_referrer_info,xt.prototype.get_cross_subdomain=xt.prototype.get_cross_subdomain,xt.prototype.clear=xt.prototype.clear;var nu={},QV=function(){I.each(nu,function(e,t){t!==vi&&(Cr[t]=e)}),Cr._=I},XV=function(){Cr.init=function(e,t,n){if(n)return Cr[n]||(Cr[n]=nu[n]=s1(e,t,n),Cr[n]._loaded()),Cr[n];var r=Cr;nu[vi]?r=nu[vi]:e&&(r=s1(e,t,vi),r._loaded(),nu[vi]=r),Cr=r,o1===ZV&&(Ue[vi]=Cr),QV()}},JV=function(){function e(){e.done||(e.done=!0,iT=!0,tT=!1,I.each(nu,function(r){r._dom_loaded()}))}function t(){try{Vt.documentElement.doScroll("left")}catch{setTimeout(t,1);return}e()}if(Vt.addEventListener)Vt.readyState==="complete"?e():Vt.addEventListener("DOMContentLoaded",e,!1);else if(Vt.attachEvent){Vt.attachEvent("onreadystatechange",e);var n=!1;try{n=Ue.frameElement===null}catch{}Vt.documentElement.doScroll&&n&&t()}I.register_event(Ue,"load",e,!0)};function eZ(e){return XO=e,o1=JO,Cr=new ae,XV(),Cr.init(),JV(),Cr}function tZ(e,t){t()}var Ba=eZ(tZ);const fo="https://debales.ai",nZ="https://debales-web-app-server-prod.azurewebsites.net",oT={"blossom-and-rhyme-6":"84e28f5a553bc260c8276723d0f365bc","doorbellmount-dea1de94-1728660454527":"f825468f4202c28be0d29c849a997208",artzfolio:"789feea8eb479f2db1144448f6465f7f",minature:"b22ef9c8fdbeb4a297947903891c5fd9","nonetz-3f0b8348-1736183595738":"a19d837ea53890c892a2b351e54afc11",bodytales:"703aa3f61539de0786fa19f82644fa8b",athflex:"b9f412aa0c6991abf8b8e3db70b2a506",www:"2637bf921fb09742d550941fbebe7160","GTK-Restaurant":"dbcb03738f942ec7c968f45833ee47bf","derkins-co-uk":"f109fd32c98dac150ba902bd69feeeed","imemyselfcare-com":"bbbe4af618eeab278a4015b4ddf8827f"},rZ="phc_OKaClHZDmbEpVscrwceWJB5lsMYbMaV586L7pai6ZKD",iZ=e=>({layout:{position:{isLeft:e.isLeft??!1,zIndex:e.zIndex??1e3},height:{option:e.heightOption??"Normal"},responsive:{fullScreenOnMobile:e.fullScreenOnMobile??!0,mobileDisplayMode:e.mobileDisplayMode??"normal"}},colors:{background:e.backgroundColor,font:e.fontColor,supportButtonBackgroundColor:e.supportButtonBackgroundColor??"'#ffa500'",bot:{background:e.botBackgroundColor,message:e.botMessageColor,font:e.botFontColor},user:{message:e.userMessageColor,font:e.userFontColor},header:{font:e.headerFontColor},footer:{background:e.footerBackgroundColor,inputBorder:e.fonterInputBorderColor},cta:{background:e.callToActionBackgroundColor,font:e.callToActionFontColor},suggestedQuestions:{font:e.suggestedQuestionsFontColor,background:e.suggestedQuestionsBackgroundColor,hover:e.suggestedQuestionsHoverColor,crossButton:{color:e.suggestedQuestionsCrossButtonColor,background:e.suggestedQuestionsCrossButtonBackgroundColor},highlight:e.suggestedQuestionsHighlightColor},chatButton:{animation:e.chatButtonBackgroundAnimationColor}},typography:{fontFamily:void 0,fontSize:void 0,lineHeight:void 0},borders:{radius:"4px",width:"1px"},animations:{chatButton:{type:e.chatButtonBackgroundAnimationType??"Ping",enabled:e.enableChatButtonBackgroundAnimation??!1}},branding:{visibility:{showBot:e.show_bot??!0,debalesBranding:e.debales_branding??!0},logo:{removeBackground:e.removeLogoBackground??!1}}});function ur(){const e=sessionStorage.getItem("debalesSessionID");if(e)return e;const t=crypto.randomUUID();return sessionStorage.setItem("debalesSessionID",t),t}function oZ(){return sessionStorage.getItem(yi(window.DebalesChat.projectId,pi.LAST_SHOWN_MESSAGE_ID))}function u1(e){sessionStorage.setItem("formstate",e.toString())}function ho(){const e=localStorage.getItem("debalesUserInfo");return e?JSON.parse(e):null}function qp(e){localStorage.setItem("debalesUserInfo",JSON.stringify(e))}function jp(e){if(e.current){const t=e.current.lastElementChild;if(t)if(window.matchMedia("(max-width: 768px)").matches)e.current.scrollTop=e.current.scrollHeight,setTimeout(()=>{e.current&&(e.current.scrollTop=e.current.scrollHeight)},50);else{const r=e.current.scrollTop,i=t.getBoundingClientRect().bottom+e.current.scrollTop-e.current.clientHeight,o=300,s=performance.now(),u=c=>{const d=c-s,p=Math.min(d/o,1),h=p<.5?4*p*p*p:1-Math.pow(-2*p+2,3)/2;e.current.scrollTop=r+(i-r)*h,p<1&&requestAnimationFrame(u)};requestAnimationFrame(u)}}}function aZ(){return window.location.pathname}function aT(){const e=/test|demo|example|debales/i,t=ho()??"";return!!(t&&e.test(t.email))}function sZ(e){const t=aZ(),r=Array.from(new Set(e.map(o=>o.path))).filter(o=>new RegExp(`^${o}(/|$)`).test(t));if(r.length>0){r.sort((u,c)=>c.length-u.length);const o=r[0];return e.filter(u=>u.path===o&&u.enable!==!1).sort((u,c)=>(u.sortOrder??0)-(c.sortOrder??0))}return e.filter(o=>o.path==="/"&&o.enable!==!1).sort((o,s)=>(o.sortOrder??0)-(s.sortOrder??0))}const sT=new Set,lZ=e=>{const t=oT[e];if(!t)return console.warn("No Mixpanel token found"),null;if(sT.has(e))return Ba;Ba.init(t,{debug:!1,track_pageview:!0,persistence:"localStorage"}),console.log("Mixpanel initialized");const n=ho();return n&&n.email&&Ba.identify(n.email),sT.add(e),Ba},uZ=async(e,t)=>{if(aT())return;const n=window.DebalesChat.projectId??t.projectId;if(!oT[n]){console.warn("No Mixpanel token found");return}Ba.track(e,t)},cZ=()=>{const e=localStorage.getItem("anonymousUserId");if(e)return e;const t=crypto.randomUUID();return localStorage.setItem("anonymousUserId",t),t};function fZ(e){return e?e.split("<br>").filter(n=>n.trim().length>0).map(n=>n.trim()):[""]}const cr=e=>e.toLowerCase().includes("gaiabay")||e.toLowerCase().includes("debales-testing"),dZ=e=>{const t=e.findIndex(o=>o.type==="dynamic");if(t===-1)return e;const n=e.filter(o=>o.type==="static"),r=e.filter(o=>o.type==="dynamic");return[...n.slice(0,t),r,...n.slice(t)]};function yi(e,t){return`debales_${e}_${t}`}const lT=W.createContext(null),uT=()=>{const e=W.useContext(lT);if(!e)throw new Error("useCart must be used within a CartProvider");return e};var hZ="2.0.0",ru="",cT="?",Hp="function",Fa="undefined",iu="object",c1="string",mf="major",Ie="model",Ce="name",xe="type",Te="vendor",Ae="version",zr="architecture",ou="console",yt="mobile",bn="tablet",Er="smarttv",vf="wearable",f1="xr",d1="embedded",yf="inapp",fT="user-agent",h1=500,p1="brands",Ps="formFactors",g1="fullVersionList",au="platform",m1="platformVersion",Gp="bitness",Ua="sec-ch-ua",pZ=Ua+"-full-version-list",gZ=Ua+"-arch",mZ=Ua+"-"+Gp,vZ=Ua+"-form-factors",yZ=Ua+"-"+yt,_Z=Ua+"-"+Ie,dT=Ua+"-"+au,bZ=dT+"-version",hT=[p1,g1,yt,Ie,au,m1,zr,Ps,Gp],ti="browser",Vo="cpu",po="device",Zo="engine",_i="os",su="result",Vp="Amazon",_f="Apple",pT="ASUS",gT="BlackBerry",Bs="Google",mT="Huawei",vT="Lenovo",SZ="Honor",v1="LG",Zp="Microsoft",yT="Motorola",bf="Samsung",_T="Sharp",Yp="Sony",y1="Xiaomi",_1="Zebra",lu="Mobile ",Sf=" Browser",bT="Chrome",za="Chromecast",wZ="Edge",wf="Firefox",xf="Opera",ST="Facebook",wT="Sogou",b1="Windows",xZ=typeof window!==Fa,qr=xZ&&window.navigator?window.navigator:void 0,qa=qr&&qr.userAgentData?qr.userAgentData:void 0,CZ=function(e,t){var n={},r=t;if(!Kp(t)){r={};for(var i in t)for(var o in t[i])r[o]=t[i][o].concat(r[o]?r[o]:[])}for(var s in e)n[s]=r[s]&&r[s].length%2===0?r[s].concat(e[s]):e[s];return n},Wp=function(e){for(var t={},n=0;n<e.length;n++)t[e[n].toUpperCase()]=e[n];return t},S1=function(e,t){if(typeof e===iu&&e.length>0){for(var n in e)if(Yo(e[n])==Yo(t))return!0;return!1}return uu(e)?Yo(t).indexOf(Yo(e))!==-1:!1},Kp=function(e,t){for(var n in e)return/^(browser|cpu|device|engine|os)$/.test(n)||(t?Kp(e[n]):!1)},uu=function(e){return typeof e===c1},w1=function(e){if(e){for(var t=[],n=Fs(/\\?\"/g,e).split(","),r=0;r<n.length;r++)if(n[r].indexOf(";")>-1){var i=Ef(n[r]).split(";v=");t[r]={brand:i[0],version:i[1]}}else t[r]=Ef(n[r]);return t}},Yo=function(e){return uu(e)?e.toLowerCase():e},x1=function(e){return uu(e)?Fs(/[^\d\.]/g,e).split(".")[0]:void 0},Wo=function(e){for(var t in e){var n=e[t];typeof n==iu&&n.length==2?this[n[0]]=n[1]:this[n]=void 0}return this},Fs=function(e,t){return uu(t)?t.replace(e,ru):t},Cf=function(e){return Fs(/\\?\"/g,e)},Ef=function(e,t){if(uu(e))return e=Fs(/^\s\s*/,e),typeof t===Fa?e:e.substring(0,h1)},xT=function(e,t){if(!(!e||!t))for(var n=0,r,i,o,s,u,c;n<t.length&&!u;){var d=t[n],p=t[n+1];for(r=i=0;r<d.length&&!u&&d[r];)if(u=d[r++].exec(e),u)for(o=0;o<p.length;o++)c=u[++i],s=p[o],typeof s===iu&&s.length>0?s.length===2?typeof s[1]==Hp?this[s[0]]=s[1].call(this,c):this[s[0]]=s[1]:s.length===3?typeof s[1]===Hp&&!(s[1].exec&&s[1].test)?this[s[0]]=c?s[1].call(this,c,s[2]):void 0:this[s[0]]=c?c.replace(s[1],s[2]):void 0:s.length===4&&(this[s[0]]=c?s[3].call(this,c.replace(s[1],s[2])):void 0):this[s]=c||void 0;n+=2}},kf=function(e,t){for(var n in t)if(typeof t[n]===iu&&t[n].length>0){for(var r=0;r<t[n].length;r++)if(S1(t[n][r],e))return n===cT?void 0:n}else if(S1(t[n],e))return n===cT?void 0:n;return t.hasOwnProperty("*")?t["*"]:e},CT={ME:"4.90","NT 3.11":"NT3.51","NT 4.0":"NT4.0",2e3:"NT 5.0",XP:["NT 5.1","NT 5.2"],Vista:"NT 6.0",7:"NT 6.1",8:"NT 6.2","8.1":"NT 6.3",10:["NT 6.4","NT 10.0"],RT:"ARM"},ET={embedded:"Automotive",mobile:"Mobile",tablet:["Tablet","EInk"],smarttv:"TV",wearable:"Watch",xr:["VR","XR"],"?":["Desktop","Unknown"],"*":void 0},kT={browser:[[/\b(?:crmo|crios)\/([\w\.]+)/i],[Ae,[Ce,lu+"Chrome"]],[/edg(?:e|ios|a)?\/([\w\.]+)/i],[Ae,[Ce,"Edge"]],[/(opera mini)\/([-\w\.]+)/i,/(opera [mobiletab]{3,6})\b.+version\/([-\w\.]+)/i,/(opera)(?:.+version\/|[\/ ]+)([\w\.]+)/i],[Ce,Ae],[/opios[\/ ]+([\w\.]+)/i],[Ae,[Ce,xf+" Mini"]],[/\bop(?:rg)?x\/([\w\.]+)/i],[Ae,[Ce,xf+" GX"]],[/\bopr\/([\w\.]+)/i],[Ae,[Ce,xf]],[/\bb[ai]*d(?:uhd|[ub]*[aekoprswx]{5,6})[\/ ]?([\w\.]+)/i],[Ae,[Ce,"Baidu"]],[/\b(?:mxbrowser|mxios|myie2)\/?([-\w\.]*)\b/i],[Ae,[Ce,"Maxthon"]],[/(kindle)\/([\w\.]+)/i,/(lunascape|maxthon|netfront|jasmine|blazer|sleipnir)[\/ ]?([\w\.]*)/i,/(avant|iemobile|slim(?:browser|boat|jet))[\/ ]?([\d\.]*)/i,/(?:ms|\()(ie) ([\w\.]+)/i,/(flock|rockmelt|midori|epiphany|silk|skyfire|ovibrowser|bolt|iron|vivaldi|iridium|phantomjs|bowser|qupzilla|falkon|rekonq|puffin|brave|whale(?!.+naver)|qqbrowserlite|duckduckgo|klar|helio|(?=comodo_)?dragon)\/([-\w\.]+)/i,/(heytap|ovi|115)browser\/([\d\.]+)/i,/(weibo)__([\d\.]+)/i],[Ce,Ae],[/quark(?:pc)?\/([-\w\.]+)/i],[Ae,[Ce,"Quark"]],[/\bddg\/([\w\.]+)/i],[Ae,[Ce,"DuckDuckGo"]],[/(?:\buc? ?browser|(?:juc.+)ucweb)[\/ ]?([\w\.]+)/i],[Ae,[Ce,"UCBrowser"]],[/microm.+\bqbcore\/([\w\.]+)/i,/\bqbcore\/([\w\.]+).+microm/i,/micromessenger\/([\w\.]+)/i],[Ae,[Ce,"WeChat"]],[/konqueror\/([\w\.]+)/i],[Ae,[Ce,"Konqueror"]],[/trident.+rv[: ]([\w\.]{1,9})\b.+like gecko/i],[Ae,[Ce,"IE"]],[/ya(?:search)?browser\/([\w\.]+)/i],[Ae,[Ce,"Yandex"]],[/slbrowser\/([\w\.]+)/i],[Ae,[Ce,"Smart "+vT+Sf]],[/(avast|avg)\/([\w\.]+)/i],[[Ce,/(.+)/,"$1 Secure"+Sf],Ae],[/\bfocus\/([\w\.]+)/i],[Ae,[Ce,wf+" Focus"]],[/\bopt\/([\w\.]+)/i],[Ae,[Ce,xf+" Touch"]],[/coc_coc\w+\/([\w\.]+)/i],[Ae,[Ce,"Coc Coc"]],[/dolfin\/([\w\.]+)/i],[Ae,[Ce,"Dolphin"]],[/coast\/([\w\.]+)/i],[Ae,[Ce,xf+" Coast"]],[/miuibrowser\/([\w\.]+)/i],[Ae,[Ce,"MIUI"+Sf]],[/fxios\/([\w\.-]+)/i],[Ae,[Ce,lu+wf]],[/\bqihoobrowser\/?([\w\.]*)/i],[Ae,[Ce,"360"]],[/\b(qq)\/([\w\.]+)/i],[[Ce,/(.+)/,"$1Browser"],Ae],[/(oculus|sailfish|huawei|vivo|pico)browser\/([\w\.]+)/i],[[Ce,/(.+)/,"$1"+Sf],Ae],[/samsungbrowser\/([\w\.]+)/i],[Ae,[Ce,bf+" Internet"]],[/metasr[\/ ]?([\d\.]+)/i],[Ae,[Ce,wT+" Explorer"]],[/(sogou)mo\w+\/([\d\.]+)/i],[[Ce,wT+" Mobile"],Ae],[/(electron)\/([\w\.]+) safari/i,/(tesla)(?: qtcarbrowser|\/(20\d\d\.[-\w\.]+))/i,/m?(qqbrowser|2345(?=browser|chrome|explorer))\w*[\/ ]?v?([\w\.]+)/i],[Ce,Ae],[/(lbbrowser|rekonq)/i],[Ce],[/ome\/([\w\.]+) \w* ?(iron) saf/i,/ome\/([\w\.]+).+qihu (360)[es]e/i],[Ae,Ce],[/((?:fban\/fbios|fb_iab\/fb4a)(?!.+fbav)|;fbav\/([\w\.]+);)/i],[[Ce,ST],Ae,[xe,yf]],[/(Klarna)\/([\w\.]+)/i,/(kakao(?:talk|story))[\/ ]([\w\.]+)/i,/(naver)\(.*?(\d+\.[\w\.]+).*\)/i,/safari (line)\/([\w\.]+)/i,/\b(line)\/([\w\.]+)\/iab/i,/(alipay)client\/([\w\.]+)/i,/(twitter)(?:and| f.+e\/([\w\.]+))/i,/(instagram|snapchat)[\/ ]([-\w\.]+)/i],[Ce,Ae,[xe,yf]],[/\bgsa\/([\w\.]+) .*safari\//i],[Ae,[Ce,"GSA"],[xe,yf]],[/musical_ly(?:.+app_?version\/|_)([\w\.]+)/i],[Ae,[Ce,"TikTok"],[xe,yf]],[/\[(linkedin)app\]/i],[Ce,[xe,yf]],[/(chromium)[\/ ]([-\w\.]+)/i],[Ce,Ae],[/headlesschrome(?:\/([\w\.]+)| )/i],[Ae,[Ce,bT+" Headless"]],[/ wv\).+(chrome)\/([\w\.]+)/i],[[Ce,bT+" WebView"],Ae],[/droid.+ version\/([\w\.]+)\b.+(?:mobile safari|safari)/i],[Ae,[Ce,"Android"+Sf]],[/chrome\/([\w\.]+) mobile/i],[Ae,[Ce,lu+"Chrome"]],[/(chrome|omniweb|arora|[tizenoka]{5} ?browser)\/v?([\w\.]+)/i],[Ce,Ae],[/version\/([\w\.\,]+) .*mobile(?:\/\w+ | ?)safari/i],[Ae,[Ce,lu+"Safari"]],[/iphone .*mobile(?:\/\w+ | ?)safari/i],[[Ce,lu+"Safari"]],[/version\/([\w\.\,]+) .*(safari)/i],[Ae,Ce],[/webkit.+?(mobile ?safari|safari)(\/[\w\.]+)/i],[Ce,[Ae,"1"]],[/(webkit|khtml)\/([\w\.]+)/i],[Ce,Ae],[/(?:mobile|tablet);.*(firefox)\/([\w\.-]+)/i],[[Ce,lu+wf],Ae],[/(navigator|netscape\d?)\/([-\w\.]+)/i],[[Ce,"Netscape"],Ae],[/(wolvic|librewolf)\/([\w\.]+)/i],[Ce,Ae],[/mobile vr; rv:([\w\.]+)\).+firefox/i],[Ae,[Ce,wf+" Reality"]],[/ekiohf.+(flow)\/([\w\.]+)/i,/(swiftfox)/i,/(icedragon|iceweasel|camino|chimera|fennec|maemo browser|minimo|conkeror)[\/ ]?([\w\.\+]+)/i,/(seamonkey|k-meleon|icecat|iceape|firebird|phoenix|palemoon|basilisk|waterfox)\/([-\w\.]+)$/i,/(firefox)\/([\w\.]+)/i,/(mozilla)\/([\w\.]+) .+rv\:.+gecko\/\d+/i,/(polaris|lynx|dillo|icab|doris|amaya|w3m|netsurf|obigo|mosaic|(?:go|ice|up)[\. ]?browser)[-\/ ]?v?([\w\.]+)/i,/\b(links) \(([\w\.]+)/i],[Ce,[Ae,/_/g,"."]],[/(cobalt)\/([\w\.]+)/i],[Ce,[Ae,/[^\d\.]+./,ru]]],cpu:[[/\b(?:(amd|x|x86[-_]?|wow|win)64)\b/i],[[zr,"amd64"]],[/(ia32(?=;))/i,/((?:i[346]|x)86)[;\)]/i],[[zr,"ia32"]],[/\b(aarch64|arm(v?8e?l?|_?64))\b/i],[[zr,"arm64"]],[/\b(arm(?:v[67])?ht?n?[fl]p?)\b/i],[[zr,"armhf"]],[/windows (ce|mobile); ppc;/i],[[zr,"arm"]],[/((?:ppc|powerpc)(?:64)?)(?: mac|;|\))/i],[[zr,/ower/,ru,Yo]],[/(sun4\w)[;\)]/i],[[zr,"sparc"]],[/((?:avr32|ia64(?=;))|68k(?=\))|\barm(?=v(?:[1-7]|[5-7]1)l?|;|eabi)|(?=atmel )avr|(?:irix|mips|sparc)(?:64)?\b|pa-risc)/i],[[zr,Yo]]],device:[[/\b(sch-i[89]0\d|shw-m380s|sm-[ptx]\w{2,4}|gt-[pn]\d{2,4}|sgh-t8[56]9|nexus 10)/i],[Ie,[Te,bf],[xe,bn]],[/\b((?:s[cgp]h|gt|sm)-(?![lr])\w+|sc[g-]?[\d]+a?|galaxy nexus)/i,/samsung[- ]((?!sm-[lr])[-\w]+)/i,/sec-(sgh\w+)/i],[Ie,[Te,bf],[xe,yt]],[/(?:\/|\()(ip(?:hone|od)[\w, ]*)(?:\/|;)/i],[Ie,[Te,_f],[xe,yt]],[/\((ipad);[-\w\),; ]+apple/i,/applecoremedia\/[\w\.]+ \((ipad)/i,/\b(ipad)\d\d?,\d\d?[;\]].+ios/i],[Ie,[Te,_f],[xe,bn]],[/(macintosh);/i],[Ie,[Te,_f]],[/\b(sh-?[altvz]?\d\d[a-ekm]?)/i],[Ie,[Te,_T],[xe,yt]],[/(?:honor)([-\w ]+)[;\)]/i],[Ie,[Te,SZ],[xe,yt]],[/\b((?:ag[rs][23]?|bah2?|sht?|btv)-a?[lw]\d{2})\b(?!.+d\/s)/i],[Ie,[Te,mT],[xe,bn]],[/(?:huawei)([-\w ]+)[;\)]/i,/\b(nexus 6p|\w{2,4}e?-[atu]?[ln][\dx][012359c][adn]?)\b(?!.+d\/s)/i],[Ie,[Te,mT],[xe,yt]],[/\b(poco[\w ]+|m2\d{3}j\d\d[a-z]{2})(?: bui|\))/i,/\b; (\w+) build\/hm\1/i,/\b(hm[-_ ]?note?[_ ]?(?:\d\w)?) bui/i,/\b(redmi[\-_ ]?(?:note|k)?[\w_ ]+)(?: bui|\))/i,/oid[^\)]+; (m?[12][0-389][01]\w{3,6}[c-y])( bui|; wv|\))/i,/\b(mi[-_ ]?(?:a\d|one|one[_ ]plus|note lte|max|cc)?[_ ]?(?:\d?\w?)[_ ]?(?:plus|se|lite|pro)?)(?: bui|\))/i],[[Ie,/_/g," "],[Te,y1],[xe,yt]],[/oid[^\)]+; (2\d{4}(283|rpbf)[cgl])( bui|\))/i,/\b(mi[-_ ]?(?:pad)(?:[\w_ ]+))(?: bui|\))/i],[[Ie,/_/g," "],[Te,y1],[xe,bn]],[/; (\w+) bui.+ oppo/i,/\b(cph[12]\d{3}|p(?:af|c[al]|d\w|e[ar])[mt]\d0|x9007|a101op)\b/i],[Ie,[Te,"OPPO"],[xe,yt]],[/\b(opd2\d{3}a?) bui/i],[Ie,[Te,"OPPO"],[xe,bn]],[/vivo (\w+)(?: bui|\))/i,/\b(v[12]\d{3}\w?[at])(?: bui|;)/i],[Ie,[Te,"Vivo"],[xe,yt]],[/\b(rmx[1-3]\d{3})(?: bui|;|\))/i],[Ie,[Te,"Realme"],[xe,yt]],[/\b(milestone|droid(?:[2-4x]| (?:bionic|x2|pro|razr))?:?( 4g)?)\b[\w ]+build\//i,/\bmot(?:orola)?[- ](\w*)/i,/((?:moto[\w\(\) ]+|xt\d{3,4}|nexus 6)(?= bui|\)))/i],[Ie,[Te,yT],[xe,yt]],[/\b(mz60\d|xoom[2 ]{0,2}) build\//i],[Ie,[Te,yT],[xe,bn]],[/((?=lg)?[vl]k\-?\d{3}) bui| 3\.[-\w; ]{10}lg?-([06cv9]{3,4})/i],[Ie,[Te,v1],[xe,bn]],[/(lm(?:-?f100[nv]?|-[\w\.]+)(?= bui|\))|nexus [45])/i,/\blg[-e;\/ ]+((?!browser|netcast|android tv)\w+)/i,/\blg-?([\d\w]+) bui/i],[Ie,[Te,v1],[xe,yt]],[/(ideatab[-\w ]+)/i,/lenovo ?(s[56]000[-\w]+|tab(?:[\w ]+)|yt[-\d\w]{6}|tb[-\d\w]{6})/i],[Ie,[Te,vT],[xe,bn]],[/(?:maemo|nokia).*(n900|lumia \d+)/i,/nokia[-_ ]?([-\w\.]*)/i],[[Ie,/_/g," "],[Te,"Nokia"],[xe,yt]],[/(pixel c)\b/i],[Ie,[Te,Bs],[xe,bn]],[/droid.+; (pixel[\daxl ]{0,6})(?: bui|\))/i],[Ie,[Te,Bs],[xe,yt]],[/droid.+; (a?\d[0-2]{2}so|[c-g]\d{4}|so[-gl]\w+|xq-a\w[4-7][12])(?= bui|\).+chrome\/(?![1-6]{0,1}\d\.))/i],[Ie,[Te,Yp],[xe,yt]],[/sony tablet [ps]/i,/\b(?:sony)?sgp\w+(?: bui|\))/i],[[Ie,"Xperia Tablet"],[Te,Yp],[xe,bn]],[/ (kb2005|in20[12]5|be20[12][59])\b/i,/(?:one)?(?:plus)? (a\d0\d\d)(?: b|\))/i],[Ie,[Te,"OnePlus"],[xe,yt]],[/(alexa)webm/i,/(kf[a-z]{2}wi|aeo(?!bc)\w\w)( bui|\))/i,/(kf[a-z]+)( bui|\)).+silk\//i],[Ie,[Te,Vp],[xe,bn]],[/((?:sd|kf)[0349hijorstuw]+)( bui|\)).+silk\//i],[[Ie,/(.+)/g,"Fire Phone $1"],[Te,Vp],[xe,yt]],[/(playbook);[-\w\),; ]+(rim)/i],[Ie,Te,[xe,bn]],[/\b((?:bb[a-f]|st[hv])100-\d)/i,/\(bb10; (\w+)/i],[Ie,[Te,gT],[xe,yt]],[/(?:\b|asus_)(transfo[prime ]{4,10} \w+|eeepc|slider \w+|nexus 7|padfone|p00[cj])/i],[Ie,[Te,pT],[xe,bn]],[/ (z[bes]6[027][012][km][ls]|zenfone \d\w?)\b/i],[Ie,[Te,pT],[xe,yt]],[/(nexus 9)/i],[Ie,[Te,"HTC"],[xe,bn]],[/(htc)[-;_ ]{1,2}([\w ]+(?=\)| bui)|\w+)/i,/(zte)[- ]([\w ]+?)(?: bui|\/|\))/i,/(alcatel|geeksphone|nexian|panasonic(?!(?:;|\.))|sony(?!-bra))[-_ ]?([-\w]*)/i],[Te,[Ie,/_/g," "],[xe,yt]],[/tcl (xess p17aa)/i,/droid [\w\.]+; ((?:8[14]9[16]|9(?:0(?:48|60|8[01])|1(?:3[27]|66)|2(?:6[69]|9[56])|466))[gqswx])(_\w(\w|\w\w))?(\)| bui)/i],[Ie,[Te,"TCL"],[xe,bn]],[/droid [\w\.]+; (418(?:7d|8v)|5087z|5102l|61(?:02[dh]|25[adfh]|27[ai]|56[dh]|59k|65[ah])|a509dl|t(?:43(?:0w|1[adepqu])|50(?:6d|7[adju])|6(?:09dl|10k|12b|71[efho]|76[hjk])|7(?:66[ahju]|67[hw]|7[045][bh]|71[hk]|73o|76[ho]|79w|81[hks]?|82h|90[bhsy]|99b)|810[hs]))(_\w(\w|\w\w))?(\)| bui)/i],[Ie,[Te,"TCL"],[xe,yt]],[/(itel) ((\w+))/i],[[Te,Yo],Ie,[xe,kf,{tablet:["p10001l","w7001"],"*":"mobile"}]],[/droid.+; ([ab][1-7]-?[0178a]\d\d?)/i],[Ie,[Te,"Acer"],[xe,bn]],[/droid.+; (m[1-5] note) bui/i,/\bmz-([-\w]{2,})/i],[Ie,[Te,"Meizu"],[xe,yt]],[/; ((?:power )?armor(?:[\w ]{0,8}))(?: bui|\))/i],[Ie,[Te,"Ulefone"],[xe,yt]],[/; (energy ?\w+)(?: bui|\))/i,/; energizer ([\w ]+)(?: bui|\))/i],[Ie,[Te,"Energizer"],[xe,yt]],[/; cat (b35);/i,/; (b15q?|s22 flip|s48c|s62 pro)(?: bui|\))/i],[Ie,[Te,"Cat"],[xe,yt]],[/((?:new )?andromax[\w- ]+)(?: bui|\))/i],[Ie,[Te,"Smartfren"],[xe,yt]],[/droid.+; (a(?:015|06[35]|142p?))/i],[Ie,[Te,"Nothing"],[xe,yt]],[/(blackberry|benq|palm(?=\-)|sonyericsson|acer|asus|dell|meizu|motorola|polytron|infinix|tecno|micromax|advan)[-_ ]?([-\w]*)/i,/; (imo) ((?!tab)[\w ]+?)(?: bui|\))/i,/(hp) ([\w ]+\w)/i,/(asus)-?(\w+)/i,/(microsoft); (lumia[\w ]+)/i,/(lenovo)[-_ ]?([-\w]+)/i,/(jolla)/i,/(oppo) ?([\w ]+) bui/i],[Te,Ie,[xe,yt]],[/(imo) (tab \w+)/i,/(kobo)\s(ereader|touch)/i,/(archos) (gamepad2?)/i,/(hp).+(touchpad(?!.+tablet)|tablet)/i,/(kindle)\/([\w\.]+)/i],[Te,Ie,[xe,bn]],[/(surface duo)/i],[Ie,[Te,Zp],[xe,bn]],[/droid [\d\.]+; (fp\du?)(?: b|\))/i],[Ie,[Te,"Fairphone"],[xe,yt]],[/(shield[\w ]+) b/i],[Ie,[Te,"Nvidia"],[xe,bn]],[/(sprint) (\w+)/i],[Te,Ie,[xe,yt]],[/(kin\.[onetw]{3})/i],[[Ie,/\./g," "],[Te,Zp],[xe,yt]],[/droid.+; ([c6]+|et5[16]|mc[239][23]x?|vc8[03]x?)\)/i],[Ie,[Te,_1],[xe,bn]],[/droid.+; (ec30|ps20|tc[2-8]\d[kx])\)/i],[Ie,[Te,_1],[xe,yt]],[/smart-tv.+(samsung)/i],[Te,[xe,Er]],[/hbbtv.+maple;(\d+)/i],[[Ie,/^/,"SmartTV"],[Te,bf],[xe,Er]],[/(nux; netcast.+smarttv|lg (netcast\.tv-201\d|android tv))/i],[[Te,v1],[xe,Er]],[/(apple) ?tv/i],[Te,[Ie,_f+" TV"],[xe,Er]],[/crkey.*devicetype\/chromecast/i],[[Ie,za+" Third Generation"],[Te,Bs],[xe,Er]],[/crkey.*devicetype\/([^/]*)/i],[[Ie,/^/,"Chromecast "],[Te,Bs],[xe,Er]],[/fuchsia.*crkey/i],[[Ie,za+" Nest Hub"],[Te,Bs],[xe,Er]],[/crkey/i],[[Ie,za],[Te,Bs],[xe,Er]],[/droid.+aft(\w+)( bui|\))/i],[Ie,[Te,Vp],[xe,Er]],[/\(dtv[\);].+(aquos)/i,/(aquos-tv[\w ]+)\)/i],[Ie,[Te,_T],[xe,Er]],[/(bravia[\w ]+)( bui|\))/i],[Ie,[Te,Yp],[xe,Er]],[/(mitv-\w{5}) bui/i],[Ie,[Te,y1],[xe,Er]],[/Hbbtv.*(technisat) (.*);/i],[Te,Ie,[xe,Er]],[/\b(roku)[\dx]*[\)\/]((?:dvp-)?[\d\.]*)/i,/hbbtv\/\d+\.\d+\.\d+ +\([\w\+ ]*; *([\w\d][^;]*);([^;]*)/i],[[Te,Ef],[Ie,Ef],[xe,Er]],[/\b(android tv|smart[- ]?tv|opera tv|tv; rv:)\b/i],[[xe,Er]],[/(ouya)/i,/(nintendo) (\w+)/i],[Te,Ie,[xe,ou]],[/droid.+; (shield) bui/i],[Ie,[Te,"Nvidia"],[xe,ou]],[/(playstation \w+)/i],[Ie,[Te,Yp],[xe,ou]],[/\b(xbox(?: one)?(?!; xbox))[\); ]/i],[Ie,[Te,Zp],[xe,ou]],[/\b(sm-[lr]\d\d[05][fnuw]?s?)\b/i],[Ie,[Te,bf],[xe,vf]],[/((pebble))app/i],[Te,Ie,[xe,vf]],[/(watch)(?: ?os[,\/]|\d,\d\/)[\d\.]+/i],[Ie,[Te,_f],[xe,vf]],[/droid.+; (wt63?0{2,3})\)/i],[Ie,[Te,_1],[xe,vf]],[/droid.+; (glass) \d/i],[Ie,[Te,Bs],[xe,f1]],[/(pico) (4|neo3(?: link|pro)?)/i],[Te,Ie,[xe,f1]],[/; (quest( \d| pro)?)/i],[Ie,[Te,ST],[xe,f1]],[/(tesla)(?: qtcarbrowser|\/[-\w\.]+)/i],[Te,[xe,d1]],[/(aeobc)\b/i],[Ie,[Te,Vp],[xe,d1]],[/droid .+?; ([^;]+?)(?: bui|; wv\)|\) applew).+? mobile safari/i],[Ie,[xe,yt]],[/droid .+?; ([^;]+?)(?: bui|\) applew).+?(?! mobile) safari/i],[Ie,[xe,bn]],[/\b((tablet|tab)[;\/]|focus\/\d(?!.+mobile))/i],[[xe,bn]],[/(phone|mobile(?:[;\/]| [ \w\/\.]*safari)|pda(?=.+windows ce))/i],[[xe,yt]],[/(android[-\w\. ]{0,9});.+buil/i],[Ie,[Te,"Generic"]]],engine:[[/windows.+ edge\/([\w\.]+)/i],[Ae,[Ce,wZ+"HTML"]],[/(arkweb)\/([\w\.]+)/i],[Ce,Ae],[/webkit\/537\.36.+chrome\/(?!27)([\w\.]+)/i],[Ae,[Ce,"Blink"]],[/(presto)\/([\w\.]+)/i,/(webkit|trident|netfront|netsurf|amaya|lynx|w3m|goanna|servo)\/([\w\.]+)/i,/ekioh(flow)\/([\w\.]+)/i,/(khtml|tasman|links)[\/ ]\(?([\w\.]+)/i,/(icab)[\/ ]([23]\.[\d\.]+)/i,/\b(libweb)/i],[Ce,Ae],[/rv\:([\w\.]{1,9})\b.+(gecko)/i],[Ae,Ce]],os:[[/microsoft (windows) (vista|xp)/i],[Ce,Ae],[/(windows (?:phone(?: os)?|mobile))[\/ ]?([\d\.\w ]*)/i],[Ce,[Ae,kf,CT]],[/windows nt 6\.2; (arm)/i,/windows[\/ ]?([ntce\d\. ]+\w)(?!.+xbox)/i,/(?:win(?=3|9|n)|win 9x )([nt\d\.]+)/i],[[Ae,kf,CT],[Ce,b1]],[/ip[honead]{2,4}\b(?:.*os ([\w]+) like mac|; opera)/i,/(?:ios;fbsv\/|iphone.+ios[\/ ])([\d\.]+)/i,/cfnetwork\/.+darwin/i],[[Ae,/_/g,"."],[Ce,"iOS"]],[/(mac os x) ?([\w\. ]*)/i,/(macintosh|mac_powerpc\b)(?!.+haiku)/i],[[Ce,"macOS"],[Ae,/_/g,"."]],[/android ([\d\.]+).*crkey/i],[Ae,[Ce,za+" Android"]],[/fuchsia.*crkey\/([\d\.]+)/i],[Ae,[Ce,za+" Fuchsia"]],[/crkey\/([\d\.]+).*devicetype\/smartspeaker/i],[Ae,[Ce,za+" SmartSpeaker"]],[/linux.*crkey\/([\d\.]+)/i],[Ae,[Ce,za+" Linux"]],[/crkey\/([\d\.]+)/i],[Ae,[Ce,za]],[/droid ([\w\.]+)\b.+(android[- ]x86|harmonyos)/i],[Ae,Ce],[/(android|webos|qnx|bada|rim tablet os|maemo|meego|sailfish|openharmony)[-\/ ]?([\w\.]*)/i,/(blackberry)\w*\/([\w\.]*)/i,/(tizen|kaios)[\/ ]([\w\.]+)/i,/\((series40);/i],[Ce,Ae],[/\(bb(10);/i],[Ae,[Ce,gT]],[/(?:symbian ?os|symbos|s60(?=;)|series60)[-\/ ]?([\w\.]*)/i],[Ae,[Ce,"Symbian"]],[/mozilla\/[\d\.]+ \((?:mobile|tablet|tv|mobile; [\w ]+); rv:.+ gecko\/([\w\.]+)/i],[Ae,[Ce,wf+" OS"]],[/web0s;.+rt(tv)/i,/\b(?:hp)?wos(?:browser)?\/([\w\.]+)/i],[Ae,[Ce,"webOS"]],[/watch(?: ?os[,\/]|\d,\d\/)([\d\.]+)/i],[Ae,[Ce,"watchOS"]],[/(cros) [\w]+(?:\)| ([\w\.]+)\b)/i],[[Ce,"Chrome OS"],Ae],[/panasonic;(viera)/i,/(netrange)mmh/i,/(nettv)\/(\d+\.[\w\.]+)/i,/(nintendo|playstation) (\w+)/i,/(xbox); +xbox ([^\);]+)/i,/(pico) .+os([\w\.]+)/i,/\b(joli|palm)\b ?(?:os)?\/?([\w\.]*)/i,/(mint)[\/\(\) ]?(\w*)/i,/(mageia|vectorlinux)[; ]/i,/([kxln]?ubuntu|debian|suse|opensuse|gentoo|arch(?= linux)|slackware|fedora|mandriva|centos|pclinuxos|red ?hat|zenwalk|linpus|raspbian|plan 9|minix|risc os|contiki|deepin|manjaro|elementary os|sabayon|linspire)(?: gnu\/linux)?(?: enterprise)?(?:[- ]linux)?(?:-gnu)?[-\/ ]?(?!chrom|package)([-\w\.]*)/i,/(hurd|linux) ?([\w\.]*)/i,/(gnu) ?([\w\.]*)/i,/\b([-frentopcghs]{0,5}bsd|dragonfly)[\/ ]?(?!amd|[ix346]{1,2}86)([\w\.]*)/i,/(haiku) (\w+)/i],[Ce,Ae],[/(sunos) ?([\w\.\d]*)/i],[[Ce,"Solaris"],Ae],[/((?:open)?solaris)[-\/ ]?([\w\.]*)/i,/(aix) ((\d)(?=\.|\)| )[\w\.])*/i,/\b(beos|os\/2|amigaos|morphos|openvms|fuchsia|hp-ux|serenityos)/i,/(unix) ?([\w\.]*)/i],[Ce,Ae]]},Qp=function(){var e={init:{},isIgnore:{},isIgnoreRgx:{},toString:{}};return Wo.call(e.init,[[ti,[Ce,Ae,mf,xe]],[Vo,[zr]],[po,[xe,Ie,Te]],[Zo,[Ce,Ae]],[_i,[Ce,Ae]]]),Wo.call(e.isIgnore,[[ti,[Ae,mf]],[Zo,[Ae]],[_i,[Ae]]]),Wo.call(e.isIgnoreRgx,[[ti,/ ?browser$/i],[_i,/ ?os$/i]]),Wo.call(e.toString,[[ti,[Ce,Ae]],[Vo,[zr]],[po,[Te,Ie]],[Zo,[Ce,Ae]],[_i,[Ce,Ae]]]),e}(),EZ=function(e,t){var n=Qp.init[t],r=Qp.isIgnore[t]||0,i=Qp.isIgnoreRgx[t]||0,o=Qp.toString[t]||0;function s(){Wo.call(this,n)}return s.prototype.getItem=function(){return e},s.prototype.withClientHints=function(){return qa?qa.getHighEntropyValues(hT).then(function(u){return e.setCH(new AT(u,!1)).parseCH().get()}):e.parseCH().get()},s.prototype.withFeatureCheck=function(){return e.detectFeature().get()},t!=su&&(s.prototype.is=function(u){var c=!1;for(var d in this)if(this.hasOwnProperty(d)&&!S1(r,d)&&Yo(i?Fs(i,this[d]):this[d])==Yo(i?Fs(i,u):u)){if(c=!0,u!=Fa)break}else if(u==Fa&&c){c=!c;break}return c},s.prototype.toString=function(){var u=ru;for(var c in o)typeof this[o[c]]!==Fa&&(u+=(u?" ":ru)+this[o[c]]);return u||Fa}),qa||(s.prototype.then=function(u){var c=this,d=function(){for(var h in c)c.hasOwnProperty(h)&&(this[h]=c[h])};d.prototype={is:s.prototype.is,toString:s.prototype.toString};var p=new d;return u(p),p}),new s};function AT(e,t){if(e=e||{},Wo.call(this,hT),t)Wo.call(this,[[p1,w1(e[Ua])],[g1,w1(e[pZ])],[yt,/\?1/.test(e[yZ])],[Ie,Cf(e[_Z])],[au,Cf(e[dT])],[m1,Cf(e[bZ])],[zr,Cf(e[gZ])],[Ps,w1(e[vZ])],[Gp,Cf(e[mZ])]]);else for(var n in e)this.hasOwnProperty(n)&&typeof e[n]!==Fa&&(this[n]=e[n])}function IT(e,t,n,r){return this.get=function(i){return i?this.data.hasOwnProperty(i)?this.data[i]:void 0:this.data},this.set=function(i,o){return this.data[i]=o,this},this.setCH=function(i){return this.uaCH=i,this},this.detectFeature=function(){if(qr&&qr.userAgent==this.ua)switch(this.itemType){case ti:qr.brave&&typeof qr.brave.isBrave==Hp&&this.set(Ce,"Brave");break;case po:!this.get(xe)&&qa&&qa[yt]&&this.set(xe,yt),this.get(Ie)=="Macintosh"&&qr&&typeof qr.standalone!==Fa&&qr.maxTouchPoints&&qr.maxTouchPoints>2&&this.set(Ie,"iPad").set(xe,bn);break;case _i:!this.get(Ce)&&qa&&qa[au]&&this.set(Ce,qa[au]);break;case su:var i=this.data,o=function(s){return i[s].getItem().detectFeature().get()};this.set(ti,o(ti)).set(Vo,o(Vo)).set(po,o(po)).set(Zo,o(Zo)).set(_i,o(_i))}return this},this.parseUA=function(){return this.itemType!=su&&xT.call(this.data,this.ua,this.rgxMap),this.itemType==ti&&this.set(mf,x1(this.get(Ae))),this},this.parseCH=function(){var i=this.uaCH,o=this.rgxMap;switch(this.itemType){case ti:var s=i[g1]||i[p1],u;if(s)for(var c in s){var d=Fs(/(Google|Microsoft) /,s[c].brand||s[c]),p=s[c].version;!/not.a.brand/i.test(d)&&(!u||/chrom/i.test(u)&&!/chromi/i.test(d))&&(this.set(Ce,d).set(Ae,p).set(mf,x1(p)),u=d)}break;case Vo:var h=i[zr];h&&(h&&i[Gp]=="64"&&(h+="64"),xT.call(this.data,h+";",o));break;case po:if(i[yt]&&this.set(xe,yt),i[Ie]&&this.set(Ie,i[Ie]),i[Ie]=="Xbox"&&this.set(xe,ou).set(Te,Zp),i[Ps]){var m;if(typeof i[Ps]!="string")for(var v=0;!m&&v<i[Ps].length;)m=kf(i[Ps][v++],ET);else m=kf(i[Ps],ET);this.set(xe,m)}break;case _i:var _=i[au];if(_){var x=i[m1];_==b1&&(x=parseInt(x1(x),10)>=13?"11":"10"),this.set(Ce,_).set(Ae,x)}this.get(Ce)==b1&&i[Ie]=="Xbox"&&this.set(Ce,"Xbox").set(Ae,void 0);break;case su:var b=this.data,w=function(C){return b[C].getItem().setCH(i).parseCH().get()};this.set(ti,w(ti)).set(Vo,w(Vo)).set(po,w(po)).set(Zo,w(Zo)).set(_i,w(_i))}return this},Wo.call(this,[["itemType",e],["ua",t],["uaCH",r],["rgxMap",n],["data",EZ(this,e)]]),this}function Ko(e,t,n){if(typeof e===iu?(Kp(e,!0)?(typeof t===iu&&(n=t),t=e):(n=e,t=void 0),e=void 0):typeof e===c1&&!Kp(t,!0)&&(n=t,t=void 0),n&&typeof n.append===Hp){var r={};n.forEach(function(c,d){r[d]=c}),n=r}if(!(this instanceof Ko))return new Ko(e,t,n).getResult();var i=typeof e===c1?e:n&&n[fT]?n[fT]:qr&&qr.userAgent?qr.userAgent:ru,o=new AT(n,!0),s=t?CZ(kT,t):kT,u=function(c){return c==su?function(){return new IT(c,i,s,o).set("ua",i).set(ti,this.getBrowser()).set(Vo,this.getCPU()).set(po,this.getDevice()).set(Zo,this.getEngine()).set(_i,this.getOS()).get()}:function(){return new IT(c,i,s[c],o).parseUA().get()}};return Wo.call(this,[["getBrowser",u(ti)],["getCPU",u(Vo)],["getDevice",u(po)],["getEngine",u(Zo)],["getOS",u(_i)],["getResult",u(su)],["getUA",function(){return i}],["setUA",function(c){return uu(c)&&(i=c.length>h1?Ef(c,h1):c),this}]]).setUA(i),this}Ko.VERSION=hZ,Ko.BROWSER=Wp([Ce,Ae,mf,xe]),Ko.CPU=Wp([zr]),Ko.DEVICE=Wp([Ie,Te,xe,ou,yt,Er,bn,vf,d1]),Ko.ENGINE=Ko.OS=Wp([Ce,Ae]);const ki=class ki{constructor(t){tr(this,"config");tr(this,"storedData");tr(this,"deviceInfo");tr(this,"localStorageKey","_dsjfs312313kj3debales_analytics_");this.config=t,this.deviceInfo=this.getDeviceInfo(),this.localStorageKey=t.localStorageKey||this.localStorageKey+this.config.projectName,this.config.testing=t.testing||(()=>!1);const n=localStorage.getItem(this.localStorageKey);if(n)this.storedData=JSON.parse(n),this.config.debug&&console.log("Using Existing Stored data:",this.storedData);else{const r=crypto.randomUUID();this.storedData={projectName:this.config.projectName,anonId:r,distinctId:r},this.config.debug&&console.log("Using New Stored data:",this.storedData),this.updateStorage()}this.config.debug&&console.log("Analytics initialized:",this.storedData)}static init(t){ki.instance||(ki.instance=new ki(t))}static getInstance(){if(!ki.instance)throw new Error("DebalesAnalytics is not initialized. Call init() first.");return ki.instance}static async identify(t,n){return ki.getInstance().identifyInternal(t,n)}static track(t,n){ki.getInstance().trackInternal(t,n)}static getDistinctId(){return ki.getInstance().storedData.distinctId}static getAnonId(){return ki.getInstance().storedData.anonId}async identifyInternal(t,n){try{if(this.config.testing&&this.config.testing())return;let r,i,o;if(n){const{name:c,phone:d,...p}=n;r=c,i=d,o=p}const s={distinctId:this.storedData.distinctId,anonId:[this.storedData.anonId],projectName:this.config.projectName,email:t,name:r,phone:i,properties:o},u=await this.sendRequest("/api/analytic/identify",s);u&&u.success&&u.distinctId&&(this.config.debug&&console.log("identify success new distint id"),this.storedData.distinctId=u.distinctId,this.storedData.email=t,this.updateStorage(),u.isIdentified&&this.trackInternal("identify")),this.config.debug&&console.log("Identify event sent:",s)}catch(r){console.error("Failed to identify user:",r)}}trackInternal(t,n){if(this.config.testing&&this.config.testing())return;const r={projectName:this.config.projectName,distinctId:this.storedData.distinctId,anonId:this.storedData.anonId,eventName:t,osVersion:this.deviceInfo.osVersion,browserVersion:this.deviceInfo.browserVersion,operatingSystem:this.deviceInfo.os,browser:this.deviceInfo.browser,currentUrl:window.location.href,chatId:ur()+this.config.projectName,properties:n};this.sendRequest("/api/analytic/track",r),this.config.debug&&console.log("Track event sent:",r)}updateStorage(){localStorage.setItem(this.localStorageKey,JSON.stringify(this.storedData))}async sendRequest(t,n){try{const r=await fetch(`${fo}${t}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)});if(!r.ok)throw new Error(`HTTP error! status: ${r.status}`);return await r.json()}catch(r){console.error("Failed to send analytics data:",r)}}getDeviceInfo(){const n=new Ko().getResult();return{browser:n.browser.name,os:n.os.name,browserVersion:n.browser.version,osVersion:n.os.version}}};tr(ki,"instance",null);let C1=ki;const Us=C1;var Hi,ce=typeof window<"u"?window:void 0,jr=typeof globalThis<"u"?globalThis:ce,RT=Array.prototype,OT=RT.forEach,TT=RT.indexOf,ni=jr==null?void 0:jr.navigator,He=jr==null?void 0:jr.document,Hr=jr==null?void 0:jr.location,E1=jr==null?void 0:jr.fetch,k1=jr!=null&&jr.XMLHttpRequest&&"withCredentials"in new jr.XMLHttpRequest?jr.XMLHttpRequest:void 0,MT=jr==null?void 0:jr.AbortController,qn=ni==null?void 0:ni.userAgent,pt=ce??{},Qo={DEBUG:!1,LIB_VERSION:"1.235.0"},A1="$copy_autocapture",kZ=["$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(e){e.GZipJS="gzip-js",e.Base64="base64"})(Hi||(Hi={}));var AZ=["fatal","error","warning","log","info","debug"];function kt(e,t){return e.indexOf(t)!==-1}var Xp=function(e){return e.trim()},I1=function(e){return e.replace(/^\$/,"")},IZ=Array.isArray,DT=Object.prototype,$T=DT.hasOwnProperty,Jp=DT.toString,kn=IZ||function(e){return Jp.call(e)==="[object Array]"},Gi=e=>typeof e=="function",An=e=>e===Object(e)&&!kn(e),cu=e=>{if(An(e)){for(var t in e)if($T.call(e,t))return!1;return!0}return!1},Be=e=>e===void 0,jn=e=>Jp.call(e)=="[object String]",R1=e=>jn(e)&&e.trim().length===0,ja=e=>e===null,Wt=e=>Be(e)||ja(e),Dr=e=>Jp.call(e)=="[object Number]",Ha=e=>Jp.call(e)==="[object Boolean]",RZ=e=>e instanceof FormData,OZ=e=>kt(kZ,e),LT=e=>{var t={_log:function(n){if(ce&&(Qo.DEBUG||pt.POSTHOG_DEBUG)&&!Be(ce.console)&&ce.console){for(var r=("__rrweb_original__"in ce.console[n])?ce.console[n].__rrweb_original__:ce.console[n],i=arguments.length,o=new Array(i>1?i-1:0),s=1;s<i;s++)o[s-1]=arguments[s];r(e,...o)}},info:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];t._log("log",...r)},warn:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];t._log("warn",...r)},error:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];t._log("error",...r)},critical:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];console.error(e,...r)},uninitializedWarning:n=>{t.error("You must initialize PostHog before calling ".concat(n))},createLogger:n=>LT("".concat(e," ").concat(n))};return t},Qe=LT("[PostHog.js]"),kr=Qe.createLogger,TZ=kr("[ExternalScriptsLoader]"),NT=(e,t,n)=>{if(e.config.disable_external_dependency_loading)return TZ.warn("".concat(t," was requested but loading of external scripts is disabled.")),n("Loading of external scripts is disabled");var r=He==null?void 0:He.querySelectorAll("script");if(r){for(var i=0;i<r.length;i++)if(r[i].src===t)return n()}var o=()=>{if(!He)return n("document not found");var s=He.createElement("script");if(s.type="text/javascript",s.crossOrigin="anonymous",s.src=t,s.onload=d=>n(void 0,d),s.onerror=d=>n(d),e.config.prepare_external_dependency_script&&(s=e.config.prepare_external_dependency_script(s)),!s)return n("prepare_external_dependency_script returned null");var u,c=He.querySelectorAll("body > script");c.length>0?(u=c[0].parentNode)===null||u===void 0||u.insertBefore(s,c[0]):He.body.appendChild(s)};He!=null&&He.body?o():He==null||He.addEventListener("DOMContentLoaded",o)};function PT(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function pe(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?PT(Object(n),!0).forEach(function(r){Me(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):PT(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function Me(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function BT(e,t){if(e==null)return{};var n,r,i=function(s,u){if(s==null)return{};var c,d,p={},h=Object.keys(s);for(d=0;d<h.length;d++)c=h[d],u.indexOf(c)>=0||(p[c]=s[c]);return p}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}pt.__PosthogExtensions__=pt.__PosthogExtensions__||{},pt.__PosthogExtensions__.loadExternalDependency=(e,t,n)=>{var r="/static/".concat(t,".js")+"?v=".concat(e.version);if(t==="remote-config"&&(r="/array/".concat(e.config.token,"/config.js")),t==="toolbar"){var i=3e5,o=Math.floor(Date.now()/i)*i;r="".concat(r,"&t=").concat(o)}var s=e.requestRouter.endpointFor("assets",r);NT(e,s,n)},pt.__PosthogExtensions__.loadSiteApp=(e,t,n)=>{var r=e.requestRouter.endpointFor("api",t);NT(e,r,n)};var eg={};function Ga(e,t,n){if(kn(e)){if(OT&&e.forEach===OT)e.forEach(t,n);else if("length"in e&&e.length===+e.length){for(var r=0,i=e.length;r<i;r++)if(r in e&&t.call(n,e[r],r)===eg)return}}}function rn(e,t,n){if(!Wt(e)){if(kn(e))return Ga(e,t,n);if(RZ(e)){for(var r of e.entries())if(t.call(n,r[1],r[0])===eg)return}else for(var i in e)if($T.call(e,i)&&t.call(n,e[i],i)===eg)return}}var Hn=function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return Ga(n,function(i){for(var o in i)i[o]!==void 0&&(e[o]=i[o])}),e},tg=function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return Ga(n,function(i){Ga(i,function(o){e.push(o)})}),e};function ng(e){for(var t=Object.keys(e),n=t.length,r=new Array(n);n--;)r[n]=[t[n],e[t[n]]];return r}var FT=function(e){try{return e()}catch{return}},MZ=function(e){return function(){try{for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return e.apply(this,n)}catch(i){Qe.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),Qe.critical(i)}}},Af=function(e){var t={};return rn(e,function(n,r){jn(n)&&n.length>0&&(t[r]=n)}),t};function DZ(e,t){return n=e,r=o=>jn(o)&&!ja(t)?o.slice(0,t):o,i=new Set,function o(s,u){return s!==Object(s)?r?r(s,u):s:i.has(s)?void 0:(i.add(s),kn(s)?(c=[],Ga(s,d=>{c.push(o(d))})):(c={},rn(s,(d,p)=>{i.has(d)||(c[p]=o(d,p))})),c);var c}(n);var n,r,i}var $Z=["herokuapp.com","vercel.app","netlify.app"];function LZ(e){var t=e==null?void 0:e.hostname;if(!jn(t))return!1;var n=t.split(".").slice(-2).join(".");for(var r of $Z)if(n===r)return!1;return!0}function UT(e,t){for(var n=0;n<e.length;n++)if(t(e[n]))return e[n]}function $n(e,t,n,r){var{capture:i=!1,passive:o=!0}=r??{};e==null||e.addEventListener(t,n,{capture:i,passive:o})}var zT="$people_distinct_id",If="__alias",Rf="__timers",qT="$autocapture_disabled_server_side",O1="$heatmaps_enabled_server_side",jT="$exception_capture_enabled_server_side",HT="$web_vitals_enabled_server_side",GT="$dead_clicks_enabled_server_side",VT="$web_vitals_allowed_metrics",T1="$session_recording_enabled_server_side",ZT="$console_log_recording_enabled_server_side",YT="$session_recording_network_payload_capture",WT="$session_recording_masking",KT="$session_recording_canvas_recording",QT="$replay_sample_rate",XT="$replay_minimum_duration",JT="$replay_script_config",rg="$sesid",Of="$session_is_sampled",M1="$session_recording_url_trigger_activated_session",D1="$session_recording_event_trigger_activated_session",fu="$enabled_feature_flags",ig="$early_access_features",$1="$feature_flag_details",Tf="$stored_person_properties",zs="$stored_group_properties",L1="$surveys",og="$surveys_activated",ag="$flag_call_reported",Xo="$user_state",N1="$client_session_props",P1="$capture_rate_limit",B1="$initial_campaign_params",F1="$initial_referrer_info",U1="$initial_person_info",sg="$epp",eM="__POSTHOG_TOOLBAR__",tM="$posthog_cookieless",NZ=[zT,If,"__cmpns",Rf,T1,O1,rg,fu,Xo,ig,$1,zs,Tf,L1,ag,N1,P1,B1,F1,sg];function nM(e){var t;return e instanceof Element&&(e.id===eM||!((t=e.closest)===null||t===void 0||!t.call(e,".toolbar-global-fade-container")))}function lg(e){return!!e&&e.nodeType===1}function Va(e,t){return!!e&&!!e.tagName&&e.tagName.toLowerCase()===t.toLowerCase()}function rM(e){return!!e&&e.nodeType===3}function iM(e){return!!e&&e.nodeType===11}function z1(e){return e?Xp(e).split(/\s+/):[]}function oM(e){var t=ce==null?void 0:ce.location.href;return!!(t&&e&&e.some(n=>t.match(n)))}function ug(e){var t="";switch(typeof e.className){case"string":t=e.className;break;case"object":t=(e.className&&"baseVal"in e.className?e.className.baseVal:null)||e.getAttribute("class")||"";break;default:t=""}return z1(t)}function aM(e){return Wt(e)?null:Xp(e).split(/(\s+)/).filter(t=>du(t)).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function cg(e){var t="";return j1(e)&&!uM(e)&&e.childNodes&&e.childNodes.length&&rn(e.childNodes,function(n){var r;rM(n)&&n.textContent&&(t+=(r=aM(n.textContent))!==null&&r!==void 0?r:"")}),Xp(t)}function sM(e){return Be(e.target)?e.srcElement||null:(t=e.target)!==null&&t!==void 0&&t.shadowRoot?e.composedPath()[0]||null:e.target||null;var t}var q1=["a","button","form","input","select","textarea","label"];function lM(e){var t=e.parentNode;return!(!t||!lg(t))&&t}function PZ(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:void 0,r=arguments.length>3?arguments[3]:void 0,i=arguments.length>4?arguments[4]:void 0;if(!ce||!e||Va(e,"html")||!lg(e)||n!=null&&n.url_allowlist&&!oM(n.url_allowlist)||n!=null&&n.url_ignorelist&&oM(n.url_ignorelist))return!1;if(n!=null&&n.dom_event_allowlist){var o=n.dom_event_allowlist;if(o&&!o.some(v=>t.type===v))return!1}for(var s=!1,u=[e],c=!0,d=e;d.parentNode&&!Va(d,"body");)if(iM(d.parentNode))u.push(d.parentNode.host),d=d.parentNode.host;else{if(!(c=lM(d)))break;if(r||q1.indexOf(c.tagName.toLowerCase())>-1)s=!0;else{var p=ce.getComputedStyle(c);p&&p.getPropertyValue("cursor")==="pointer"&&(s=!0)}u.push(c),d=c}if(!function(v,_){var x=_==null?void 0:_.element_allowlist;if(Be(x))return!0;var b=function(E){if(x.some(R=>E.tagName.toLowerCase()===R))return{v:!0}};for(var w of v){var C=b(w);if(typeof C=="object")return C.v}return!1}(u,n)||!function(v,_){var x=_==null?void 0:_.css_selector_allowlist;if(Be(x))return!0;var b=function(E){if(x.some(R=>E.matches(R)))return{v:!0}};for(var w of v){var C=b(w);if(typeof C=="object")return C.v}return!1}(u,n))return!1;var h=ce.getComputedStyle(e);if(h&&h.getPropertyValue("cursor")==="pointer"&&t.type==="click")return!0;var m=e.tagName.toLowerCase();switch(m){case"html":return!1;case"form":return(i||["submit"]).indexOf(t.type)>=0;case"input":case"select":case"textarea":return(i||["change","click"]).indexOf(t.type)>=0;default:return s?(i||["click"]).indexOf(t.type)>=0:(i||["click"]).indexOf(t.type)>=0&&(q1.indexOf(m)>-1||e.getAttribute("contenteditable")==="true")}}function j1(e){for(var t=e;t.parentNode&&!Va(t,"body");t=t.parentNode){var n=ug(t);if(kt(n,"ph-sensitive")||kt(n,"ph-no-capture"))return!1}if(kt(ug(e),"ph-include"))return!0;var r=e.type||"";if(jn(r))switch(r.toLowerCase()){case"hidden":case"password":return!1}var i=e.name||e.id||"";return!(jn(i)&&/^cc|cardnum|ccnum|creditcard|csc|cvc|cvv|exp|pass|pwd|routing|seccode|securitycode|securitynum|socialsec|socsec|ssn/i.test(i.replace(/[^a-zA-Z0-9]/g,"")))}function uM(e){return!!(Va(e,"input")&&!["button","checkbox","submit","reset"].includes(e.type)||Va(e,"select")||Va(e,"textarea")||e.getAttribute("contenteditable")==="true")}var cM="(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})",BZ=new RegExp("^(?:".concat(cM,")$")),FZ=new RegExp(cM),fM="\\d{3}-?\\d{2}-?\\d{4}",UZ=new RegExp("^(".concat(fM,")$")),zZ=new RegExp("(".concat(fM,")"));function du(e){var t=!(arguments.length>1&&arguments[1]!==void 0)||arguments[1];return!(Wt(e)||jn(e)&&(e=Xp(e),(t?BZ:FZ).test((e||"").replace(/[- ]/g,""))||(t?UZ:zZ).test(e)))}function dM(e){var t=cg(e);return du(t="".concat(t," ").concat(hM(e)).trim())?t:""}function hM(e){var t="";return e&&e.childNodes&&e.childNodes.length&&rn(e.childNodes,function(n){var r;if(n&&((r=n.tagName)===null||r===void 0?void 0:r.toLowerCase())==="span")try{var i=cg(n);t="".concat(t," ").concat(i).trim(),n.childNodes&&n.childNodes.length&&(t="".concat(t," ").concat(hM(n)).trim())}catch(o){Qe.error("[AutoCapture]",o)}}),t}function qZ(e){return function(t){var n=t.map(r=>{var i,o,s="";if(r.tag_name&&(s+=r.tag_name),r.attr_class)for(var u of(r.attr_class.sort(),r.attr_class))s+=".".concat(u.replace(/"/g,""));var c=pe(pe(pe(pe({},r.text?{text:r.text}:{}),{},{"nth-child":(i=r.nth_child)!==null&&i!==void 0?i:0,"nth-of-type":(o=r.nth_of_type)!==null&&o!==void 0?o:0},r.href?{href:r.href}:{}),r.attr_id?{attr_id:r.attr_id}:{}),r.attributes),d={};return ng(c).sort((p,h)=>{var[m]=p,[v]=h;return m.localeCompare(v)}).forEach(p=>{var[h,m]=p;return d[pM(h.toString())]=pM(m.toString())}),s+=":",s+=ng(c).map(p=>{var[h,m]=p;return"".concat(h,'="').concat(m,'"')}).join("")});return n.join(";")}(function(t){return t.map(n=>{var r,i,o={text:(r=n.$el_text)===null||r===void 0?void 0:r.slice(0,400),tag_name:n.tag_name,href:(i=n.attr__href)===null||i===void 0?void 0:i.slice(0,2048),attr_class:jZ(n),attr_id:n.attr__id,nth_child:n.nth_child,nth_of_type:n.nth_of_type,attributes:{}};return ng(n).filter(s=>{var[u]=s;return u.indexOf("attr__")===0}).forEach(s=>{var[u,c]=s;return o.attributes[u]=c}),o})}(e))}function pM(e){return e.replace(/"|\\"/g,'\\"')}function jZ(e){var t=e.attr__class;return t?kn(t)?t:z1(t):void 0}class gM{constructor(){this.clicks=[]}isRageClick(t,n,r){var i=this.clicks[this.clicks.length-1];if(i&&Math.abs(t-i.x)+Math.abs(n-i.y)<30&&r-i.timestamp<1e3){if(this.clicks.push({x:t,y:n,timestamp:r}),this.clicks.length===3)return!0}else this.clicks=[{x:t,y:n,timestamp:r}];return!1}}var HZ=["localhost","127.0.0.1"],hu=e=>{var t=He==null?void 0:He.createElement("a");return Be(t)?null:(t.href=e,t)},GZ=function(e){var t,n,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"&",i=[];return rn(e,function(o,s){Be(o)||Be(s)||s==="undefined"||(t=encodeURIComponent((u=>u instanceof File)(o)?o.name:o.toString()),n=encodeURIComponent(s),i[i.length]=n+"="+t)}),i.join(r)},fg=function(e,t){for(var n,r=((e.split("#")[0]||"").split(/\?(.*)/)[1]||"").replace(/^\?+/g,"").split("&"),i=0;i<r.length;i++){var o=r[i].split("=");if(o[0]===t){n=o;break}}if(!kn(n)||n.length<2)return"";var s=n[1];try{s=decodeURIComponent(s)}catch{Qe.error("Skipping decoding for malformed query param: "+s)}return s.replace(/\+/g," ")},H1=function(e,t,n){if(!e||!t||!t.length)return e;for(var r=e.split("#"),i=r[0]||"",o=r[1],s=i.split("?"),u=s[1],c=s[0],d=(u||"").split("&"),p=[],h=0;h<d.length;h++){var m=d[h].split("=");kn(m)&&(t.includes(m[0])?p.push(m[0]+"="+n):p.push(d[h]))}var v=c;return u!=null&&(v+="?"+p.join("&")),o!=null&&(v+="#"+o),v},dg=function(e,t){var n=e.match(new RegExp(t+"=([^&]*)"));return n?n[1]:null},mM=kr("[AutoCapture]");function G1(e,t){return t.length>e?t.slice(0,e)+"...":t}function VZ(e){if(e.previousElementSibling)return e.previousElementSibling;var t=e;do t=t.previousSibling;while(t&&!lg(t));return t}function ZZ(e,t,n,r){var i=e.tagName.toLowerCase(),o={tag_name:i};q1.indexOf(i)>-1&&!n&&(i.toLowerCase()==="a"||i.toLowerCase()==="button"?o.$el_text=G1(1024,dM(e)):o.$el_text=G1(1024,cg(e)));var s=ug(e);s.length>0&&(o.classes=s.filter(function(p){return p!==""})),rn(e.attributes,function(p){var h;if((!uM(e)||["name","id","class","aria-label"].indexOf(p.name)!==-1)&&(r==null||!r.includes(p.name))&&!t&&du(p.value)&&(h=p.name,!jn(h)||h.substring(0,10)!=="_ngcontent"&&h.substring(0,7)!=="_nghost")){var m=p.value;p.name==="class"&&(m=z1(m).join(" ")),o["attr__"+p.name]=G1(1024,m)}});for(var u=1,c=1,d=e;d=VZ(d);)u++,d.tagName===e.tagName&&c++;return o.nth_child=u,o.nth_of_type=c,o}function YZ(e,t){for(var n,r,{e:i,maskAllElementAttributes:o,maskAllText:s,elementAttributeIgnoreList:u,elementsChainAsString:c}=t,d=[e],p=e;p.parentNode&&!Va(p,"body");)iM(p.parentNode)?(d.push(p.parentNode.host),p=p.parentNode.host):(d.push(p.parentNode),p=p.parentNode);var h,m=[],v={},_=!1,x=!1;if(rn(d,R=>{var O=j1(R);R.tagName.toLowerCase()==="a"&&(_=R.getAttribute("href"),_=O&&_&&du(_)&&_),kt(ug(R),"ph-no-capture")&&(x=!0),m.push(ZZ(R,o,s,u));var T=function(L){if(!j1(L))return{};var B={};return rn(L.attributes,function(z){if(z.name&&z.name.indexOf("data-ph-capture-attribute")===0){var P=z.name.replace("data-ph-capture-attribute-",""),V=z.value;P&&V&&du(V)&&(B[P]=V)}}),B}(R);Hn(v,T)}),x)return{props:{},explicitNoCapture:x};if(s||(e.tagName.toLowerCase()==="a"||e.tagName.toLowerCase()==="button"?m[0].$el_text=dM(e):m[0].$el_text=cg(e)),_){var b,w;m[0].attr__href=_;var C=(b=hu(_))===null||b===void 0?void 0:b.host,E=ce==null||(w=ce.location)===null||w===void 0?void 0:w.host;C&&E&&C!==E&&(h=_)}return{props:Hn({$event_type:i.type,$ce_version:1},c?{}:{$elements:m},{$elements_chain:qZ(m)},(n=m[0])!==null&&n!==void 0&&n.$el_text?{$el_text:(r=m[0])===null||r===void 0?void 0:r.$el_text}:{},h&&i.type==="click"?{$external_click_url:h}:{},v)}}class WZ{constructor(t){Me(this,"_initialized",!1),Me(this,"_isDisabledServerSide",null),Me(this,"rageclicks",new gM),Me(this,"_elementsChainAsString",!1),this.instance=t,this._elementSelectors=null}get config(){var t,n,r=An(this.instance.config.autocapture)?this.instance.config.autocapture:{};return r.url_allowlist=(t=r.url_allowlist)===null||t===void 0?void 0:t.map(i=>new RegExp(i)),r.url_ignorelist=(n=r.url_ignorelist)===null||n===void 0?void 0:n.map(i=>new RegExp(i)),r}_addDomEventHandlers(){if(this.isBrowserSupported()){if(ce&&He){var t=r=>{r=r||(ce==null?void 0:ce.event);try{this._captureEvent(r)}catch(i){mM.error("Failed to capture event",i)}};if($n(He,"submit",t,{capture:!0}),$n(He,"change",t,{capture:!0}),$n(He,"click",t,{capture:!0}),this.config.capture_copied_text){var n=r=>{r=r||(ce==null?void 0:ce.event),this._captureEvent(r,A1)};$n(He,"copy",n,{capture:!0}),$n(He,"cut",n,{capture:!0})}}}else mM.info("Disabling Automatic Event Collection because this browser is not supported")}startIfEnabled(){this.isEnabled&&!this._initialized&&(this._addDomEventHandlers(),this._initialized=!0)}onRemoteConfig(t){t.elementsChainAsString&&(this._elementsChainAsString=t.elementsChainAsString),this.instance.persistence&&this.instance.persistence.register({[qT]:!!t.autocapture_opt_out}),this._isDisabledServerSide=!!t.autocapture_opt_out,this.startIfEnabled()}setElementSelectors(t){this._elementSelectors=t}getElementSelectors(t){var n,r=[];return(n=this._elementSelectors)===null||n===void 0||n.forEach(i=>{var o=He==null?void 0:He.querySelectorAll(i);o==null||o.forEach(s=>{t===s&&r.push(i)})}),r}get isEnabled(){var t,n,r=(t=this.instance.persistence)===null||t===void 0?void 0:t.props[qT],i=this._isDisabledServerSide;if(ja(i)&&!Ha(r)&&!this.instance.config.advanced_disable_decide)return!1;var o=(n=this._isDisabledServerSide)!==null&&n!==void 0?n:!!r;return!!this.instance.config.autocapture&&!o}_captureEvent(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"$autocapture";if(this.isEnabled){var r,i=sM(t);rM(i)&&(i=i.parentNode||null),n==="$autocapture"&&t.type==="click"&&t instanceof MouseEvent&&this.instance.config.rageclick&&(r=this.rageclicks)!==null&&r!==void 0&&r.isRageClick(t.clientX,t.clientY,new Date().getTime())&&this._captureEvent(t,"$rageclick");var o=n===A1;if(i&&PZ(i,t,this.config,o,o?["copy","cut"]:void 0)){var{props:s,explicitNoCapture:u}=YZ(i,{e:t,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(u)return!1;var c=this.getElementSelectors(i);if(c&&c.length>0&&(s.$element_selectors=c),n===A1){var d,p=aM(ce==null||(d=ce.getSelection())===null||d===void 0?void 0:d.toString()),h=t.type||"clipboard";if(!p)return!1;s.$selected_content=p,s.$copy_type=h}return this.instance.capture(n,s),!0}}}isBrowserSupported(){return Gi(He==null?void 0:He.querySelectorAll)}}Math.trunc||(Math.trunc=function(e){return e<0?Math.ceil(e):Math.floor(e)}),Number.isInteger||(Number.isInteger=function(e){return Dr(e)&&isFinite(e)&&Math.floor(e)===e});var vM="0123456789abcdef";class hg{constructor(t){if(this.bytes=t,t.length!==16)throw new TypeError("not 128-bit length")}static fromFieldsV7(t,n,r,i){if(!Number.isInteger(t)||!Number.isInteger(n)||!Number.isInteger(r)||!Number.isInteger(i)||t<0||n<0||r<0||i<0||t>0xffffffffffff||n>4095||r>1073741823||i>4294967295)throw new RangeError("invalid field value");var o=new Uint8Array(16);return o[0]=t/Math.pow(2,40),o[1]=t/Math.pow(2,32),o[2]=t/Math.pow(2,24),o[3]=t/Math.pow(2,16),o[4]=t/Math.pow(2,8),o[5]=t,o[6]=112|n>>>8,o[7]=n,o[8]=128|r>>>24,o[9]=r>>>16,o[10]=r>>>8,o[11]=r,o[12]=i>>>24,o[13]=i>>>16,o[14]=i>>>8,o[15]=i,new hg(o)}toString(){for(var t="",n=0;n<this.bytes.length;n++)t=t+vM.charAt(this.bytes[n]>>>4)+vM.charAt(15&this.bytes[n]),n!==3&&n!==5&&n!==7&&n!==9||(t+="-");if(t.length!==36)throw new Error("Invalid UUIDv7 was generated");return t}clone(){return new hg(this.bytes.slice(0))}equals(t){return this.compareTo(t)===0}compareTo(t){for(var n=0;n<16;n++){var r=this.bytes[n]-t.bytes[n];if(r!==0)return Math.sign(r)}return 0}}class KZ{constructor(){Me(this,"timestamp",0),Me(this,"counter",0),Me(this,"random",new QZ)}generate(){var t=this.generateOrAbort();if(Be(t)){this.timestamp=0;var n=this.generateOrAbort();if(Be(n))throw new Error("Could not generate UUID after timestamp reset");return n}return t}generateOrAbort(){var t=Date.now();if(t>this.timestamp)this.timestamp=t,this.resetCounter();else{if(!(t+1e4>this.timestamp))return;this.counter++,this.counter>4398046511103&&(this.timestamp++,this.resetCounter())}return hg.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())}}var yM,_M=e=>{if(typeof UUIDV7_DENY_WEAK_RNG<"u"&&UUIDV7_DENY_WEAK_RNG)throw new Error("no cryptographically strong RNG available");for(var t=0;t<e.length;t++)e[t]=65536*Math.trunc(65536*Math.random())+Math.trunc(65536*Math.random());return e};ce&&!Be(ce.crypto)&&crypto.getRandomValues&&(_M=e=>crypto.getRandomValues(e));class QZ{constructor(){Me(this,"buffer",new Uint32Array(8)),Me(this,"cursor",1/0)}nextUint32(){return this.cursor>=this.buffer.length&&(_M(this.buffer),this.cursor=0),this.buffer[this.cursor++]}}var Za=()=>XZ().toString(),XZ=()=>(yM||(yM=new KZ)).generate(),JZ="Thu, 01 Jan 1970 00:00:00 GMT",Mf="",eY=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i;function tY(e,t){if(t){var n=function(i){var o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:He;if(Mf)return Mf;if(!o||["localhost","127.0.0.1"].includes(i))return"";for(var s=i.split("."),u=Math.min(s.length,8),c="dmn_chk_"+Za(),d=new RegExp("(^|;)\\s*"+c+"=1");!Mf&&u--;){var p=s.slice(u).join("."),h=c+"=1;domain=."+p;o.cookie=h,d.test(o.cookie)&&(o.cookie=h+";expires="+JZ,Mf=p)}return Mf}(e);if(!n){var r=(i=>{var o=i.match(eY);return o?o[0]:""})(e);r!==n&&Qe.info("Warning: cookie subdomain discovery mismatch",r,n),n=r}return n?"; domain=."+n:""}return""}var Ya,Jo={is_supported:()=>!!He,error:function(e){Qe.error("cookieStore error: "+e)},get:function(e){if(He){try{for(var t=e+"=",n=He.cookie.split(";").filter(o=>o.length),r=0;r<n.length;r++){for(var i=n[r];i.charAt(0)==" ";)i=i.substring(1,i.length);if(i.indexOf(t)===0)return decodeURIComponent(i.substring(t.length,i.length))}}catch{}return null}},parse:function(e){var t;try{t=JSON.parse(Jo.get(e))||{}}catch{}return t},set:function(e,t,n,r,i){if(He)try{var o="",s="",u=tY(He.location.hostname,r);if(n){var c=new Date;c.setTime(c.getTime()+24*n*60*60*1e3),o="; expires="+c.toUTCString()}i&&(s="; secure");var d=e+"="+encodeURIComponent(JSON.stringify(t))+o+"; SameSite=Lax; path=/"+u+s;return d.length>3686.4&&Qe.warn("cookieStore warning: large cookie, len="+d.length),He.cookie=d,d}catch{return}},remove:function(e,t){try{Jo.set(e,"",-1,t)}catch{return}}},V1=null,Qn={is_supported:function(){if(!ja(V1))return V1;var e=!0;if(Be(ce))e=!1;else try{var t="__mplssupport__";Qn.set(t,"xyz"),Qn.get(t)!=='"xyz"'&&(e=!1),Qn.remove(t)}catch{e=!1}return e||Qe.error("localStorage unsupported; falling back to cookie store"),V1=e,e},error:function(e){Qe.error("localStorage error: "+e)},get:function(e){try{return ce==null?void 0:ce.localStorage.getItem(e)}catch(t){Qn.error(t)}return null},parse:function(e){try{return JSON.parse(Qn.get(e))||{}}catch{}return null},set:function(e,t){try{ce==null||ce.localStorage.setItem(e,JSON.stringify(t))}catch(n){Qn.error(n)}},remove:function(e){try{ce==null||ce.localStorage.removeItem(e)}catch(t){Qn.error(t)}}},nY=["distinct_id",rg,Of,sg,U1],pg=pe(pe({},Qn),{},{parse:function(e){try{var t={};try{t=Jo.parse(e)||{}}catch{}var n=Hn(t,JSON.parse(Qn.get(e)||"{}"));return Qn.set(e,n),n}catch{}return null},set:function(e,t,n,r,i,o){try{Qn.set(e,t,void 0,void 0,o);var s={};nY.forEach(u=>{t[u]&&(s[u]=t[u])}),Object.keys(s).length&&Jo.set(e,s,n,r,i,o)}catch(u){Qn.error(u)}},remove:function(e,t){try{ce==null||ce.localStorage.removeItem(e),Jo.remove(e,t)}catch(n){Qn.error(n)}}}),gg={},rY={is_supported:function(){return!0},error:function(e){Qe.error("memoryStorage error: "+e)},get:function(e){return gg[e]||null},parse:function(e){return gg[e]||null},set:function(e,t){gg[e]=t},remove:function(e){delete gg[e]}},qs=null,fr={is_supported:function(){if(!ja(qs))return qs;if(qs=!0,Be(ce))qs=!1;else try{var e="__support__";fr.set(e,"xyz"),fr.get(e)!=='"xyz"'&&(qs=!1),fr.remove(e)}catch{qs=!1}return qs},error:function(e){Qe.error("sessionStorage error: ",e)},get:function(e){try{return ce==null?void 0:ce.sessionStorage.getItem(e)}catch(t){fr.error(t)}return null},parse:function(e){try{return JSON.parse(fr.get(e))||null}catch{}return null},set:function(e,t){try{ce==null||ce.sessionStorage.setItem(e,JSON.stringify(t))}catch(n){fr.error(n)}},remove:function(e){try{ce==null||ce.sessionStorage.removeItem(e)}catch(t){fr.error(t)}}};(function(e){e[e.PENDING=-1]="PENDING",e[e.DENIED=0]="DENIED",e[e.GRANTED=1]="GRANTED"})(Ya||(Ya={}));class iY{constructor(t){this.instance=t}get config(){return this.instance.config}get consent(){return this.getDnt()?Ya.DENIED:this.storedConsent}isOptedOut(){return this.consent===Ya.DENIED||this.consent===Ya.PENDING&&this.config.opt_out_capturing_by_default}isOptedIn(){return!this.isOptedOut()}optInOut(t){this.storage.set(this.storageKey,t?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:t,opt_out_capturing_cookie_prefix:n}=this.instance.config;return(n||"__ph_opt_in_out_")+t}get storedConsent(){var t=this.storage.get(this.storageKey);return t==="1"?Ya.GRANTED:t==="0"?Ya.DENIED:Ya.PENDING}get storage(){if(!this._storage){var t=this.config.opt_out_capturing_persistence_type;this._storage=t==="localStorage"?Qn:Jo;var n=t==="localStorage"?Jo:Qn;n.get(this.storageKey)&&(this._storage.get(this.storageKey)||this.optInOut(n.get(this.storageKey)==="1"),n.remove(this.storageKey,this.config.cross_subdomain_cookie))}return this._storage}getDnt(){return!!this.config.respect_dnt&&!!UT([ni==null?void 0:ni.doNotTrack,ni==null?void 0:ni.msDoNotTrack,pt.doNotTrack],t=>kt([!0,1,"1","yes"],t))}}var mg=kr("[Dead Clicks]"),oY=()=>!0,aY=e=>{var t,n=!((t=e.instance.persistence)===null||t===void 0||!t.get_property(GT)),r=e.instance.config.capture_dead_clicks;return Ha(r)?r:n};class bM{get lazyLoadedDeadClicksAutocapture(){return this._lazyLoadedDeadClicksAutocapture}constructor(t,n,r){this.instance=t,this.isEnabled=n,this.onCapture=r,this.startIfEnabled()}onRemoteConfig(t){this.instance.persistence&&this.instance.persistence.register({[GT]:t==null?void 0:t.captureDeadClicks}),this.startIfEnabled()}startIfEnabled(){this.isEnabled(this)&&this.loadScript(()=>{this.start()})}loadScript(t){var n,r,i;(n=pt.__PosthogExtensions__)!==null&&n!==void 0&&n.initDeadClicksAutocapture&&t(),(r=pt.__PosthogExtensions__)===null||r===void 0||(i=r.loadExternalDependency)===null||i===void 0||i.call(r,this.instance,"dead-clicks-autocapture",o=>{o?mg.error("failed to load script",o):t()})}start(){var t;if(He){if(!this._lazyLoadedDeadClicksAutocapture&&(t=pt.__PosthogExtensions__)!==null&&t!==void 0&&t.initDeadClicksAutocapture){var n=An(this.instance.config.capture_dead_clicks)?this.instance.config.capture_dead_clicks:{};n.__onCapture=this.onCapture,this._lazyLoadedDeadClicksAutocapture=pt.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,n),this._lazyLoadedDeadClicksAutocapture.start(He),mg.info("starting...")}}else mg.error("`document` not found. Cannot start.")}stop(){this._lazyLoadedDeadClicksAutocapture&&(this._lazyLoadedDeadClicksAutocapture.stop(),this._lazyLoadedDeadClicksAutocapture=void 0,mg.info("stopping..."))}}var Z1=kr("[ExceptionAutocapture]");class sY{constructor(t){var n;Me(this,"startCapturing",()=>{var r;if(ce&&this.isEnabled&&(r=pt.__PosthogExtensions__)!==null&&r!==void 0&&r.errorWrappingFunctions){var i=pt.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,o=pt.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,s=pt.__PosthogExtensions__.errorWrappingFunctions.wrapConsoleError;try{!this.unwrapOnError&&this.config.capture_unhandled_errors&&(this.unwrapOnError=i(this.captureException.bind(this))),!this.unwrapUnhandledRejection&&this.config.capture_unhandled_rejections&&(this.unwrapUnhandledRejection=o(this.captureException.bind(this))),!this.unwrapConsoleError&&this.config.capture_console_errors&&(this.unwrapConsoleError=s(this.captureException.bind(this)))}catch(u){Z1.error("failed to start",u),this.stopCapturing()}}}),this.instance=t,this.remoteEnabled=!((n=this.instance.persistence)===null||n===void 0||!n.props[jT]),this.config=this.requiredConfig(),this.startIfEnabled()}requiredConfig(){var t=this.instance.config.capture_exceptions,n={capture_unhandled_errors:!1,capture_unhandled_rejections:!1,capture_console_errors:!1};return An(t)?n=pe(pe({},n),t):(Be(t)?this.remoteEnabled:t)&&(n=pe(pe({},n),{},{capture_unhandled_errors:!0,capture_unhandled_rejections:!0})),n}get isEnabled(){return this.config.capture_console_errors||this.config.capture_unhandled_errors||this.config.capture_unhandled_rejections}startIfEnabled(){this.isEnabled&&(Z1.info("enabled"),this.loadScript(this.startCapturing))}loadScript(t){var n,r,i;(n=pt.__PosthogExtensions__)!==null&&n!==void 0&&n.errorWrappingFunctions&&t(),(r=pt.__PosthogExtensions__)===null||r===void 0||(i=r.loadExternalDependency)===null||i===void 0||i.call(r,this.instance,"exception-autocapture",o=>{if(o)return Z1.error("failed to load script",o);t()})}stopCapturing(){var t,n,r;(t=this.unwrapOnError)===null||t===void 0||t.call(this),this.unwrapOnError=void 0,(n=this.unwrapUnhandledRejection)===null||n===void 0||n.call(this),this.unwrapUnhandledRejection=void 0,(r=this.unwrapConsoleError)===null||r===void 0||r.call(this),this.unwrapConsoleError=void 0}onRemoteConfig(t){var n=t.autocaptureExceptions;this.remoteEnabled=!!n||!1,this.config=this.requiredConfig(),this.instance.persistence&&this.instance.persistence.register({[jT]:this.remoteEnabled}),this.startIfEnabled()}captureException(t){var n=this.instance.requestRouter.endpointFor("ui");t.$exception_personURL="".concat(n,"/project/").concat(this.instance.config.token,"/person/").concat(this.instance.get_distinct_id()),this.instance.exceptions.sendExceptionEvent(t)}}function SM(e){return!Be(Event)&&wM(e,Event)}function wM(e,t){try{return e instanceof t}catch{return!1}}function vg(e,t){return Object.prototype.toString.call(e)==="[object ".concat(t,"]")}function Y1(e){return vg(e,"DOMError")}var xM=/\(error: (.*)\)/,CM=50,pu="?";function W1(e,t,n,r){var i={platform:"web:javascript",filename:e,function:t==="<anonymous>"?pu:t,in_app:!0};return Be(n)||(i.lineno=n),Be(r)||(i.colno=r),i}var lY=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,uY=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,cY=/\((\S*)(?::(\d+))(?::(\d+))\)/,fY=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,dY=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,hY=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];var r=t.sort((i,o)=>i[0]-o[0]).map(i=>i[1]);return function(i){for(var o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,s=[],u=i.split(`
|
|
137
137
|
`),c=o;c<u.length;c++){var d=u[c];if(!(d.length>1024)){var p=xM.test(d)?d.replace(xM,"$1"):d;if(!p.match(/\S*Error: /)){for(var h of r){var m=h(p);if(m){s.push(m);break}}if(s.length>=CM)break}}}return function(v){if(!v.length)return[];var _=Array.from(v);return _.reverse(),_.slice(0,CM).map(x=>pe(pe({},x),{},{filename:x.filename||pY(_).filename,function:x.function||pu}))}(s)}}([30,e=>{var t=lY.exec(e);if(t){var[,n,r,i]=t;return W1(n,pu,+r,+i)}var o=uY.exec(e);if(o){if(o[2]&&o[2].indexOf("eval")===0){var s=cY.exec(o[2]);s&&(o[2]=s[1],o[3]=s[2],o[4]=s[3])}var[u,c]=kM(o[1]||pu,o[2]);return W1(c,u,o[3]?+o[3]:void 0,o[4]?+o[4]:void 0)}}],[50,e=>{var t=fY.exec(e);if(t){if(t[3]&&t[3].indexOf(" > eval")>-1){var n=dY.exec(t[3]);n&&(t[1]=t[1]||"eval",t[3]=n[1],t[4]=n[2],t[5]="")}var r=t[3],i=t[1]||pu;return[i,r]=kM(i,r),W1(r,i,t[4]?+t[4]:void 0,t[5]?+t[5]:void 0)}}]);function pY(e){return e[e.length-1]||{}}var yg,EM,K1,kM=(e,t)=>{var n=e.indexOf("safari-extension")!==-1,r=e.indexOf("safari-web-extension")!==-1;return n||r?[e.indexOf("@")!==-1?e.split("@")[0]:pu,n?"safari-extension:".concat(t):"safari-web-extension:".concat(t)]:[e,t]},gY=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;function Q1(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n=e.stacktrace||e.stack||"",r=function(s){return s&&mY.test(s.message)?1:0}(e);try{var i=hY,o=function(s,u){var c=function(d){var p=globalThis._posthogChunkIds;if(!p)return{};var h=Object.keys(p);return K1&&h.length===EM||(EM=h.length,K1=h.reduce((m,v)=>{yg||(yg={});var _=yg[v];if(_)m[_[0]]=_[1];else for(var x=d(v),b=x.length-1;b>=0;b--){var w=x[b],C=w==null?void 0:w.filename,E=p[v];if(C&&E){m[C]=E,yg[v]=[C,E];break}}return m},{})),K1}(u);return s.forEach(d=>{d.filename&&(d.chunk_id=c[d.filename])}),s}(i(n,r),i);return o.slice(0,o.length-t)}catch{}return[]}var mY=/Minified React error #\d+;/i;function X1(e,t){var n,r,i=Q1(e),o=(n=t==null?void 0:t.handled)===null||n===void 0||n,s=(r=t==null?void 0:t.synthetic)!==null&&r!==void 0&&r;return{$exception_list:[{type:t!=null&&t.overrideExceptionType?t.overrideExceptionType:e.name,value:function(u){var c=u.message;return c.error&&typeof c.error.message=="string"?String(c.error.message):String(c)}(e),stacktrace:{frames:i,type:"raw"},mechanism:{handled:o,synthetic:s}}],$exception_level:"error"}}function J1(e,t){var n,r,i,o=(n=t==null?void 0:t.handled)===null||n===void 0||n,s=(r=t==null?void 0:t.synthetic)===null||r===void 0||r,u={type:t!=null&&t.overrideExceptionType?t.overrideExceptionType:(i=t==null?void 0:t.defaultExceptionType)!==null&&i!==void 0?i:"Error",value:e||(t==null?void 0:t.defaultExceptionMessage),mechanism:{handled:o,synthetic:s}};if(t!=null&&t.syntheticException){var c=Q1(t.syntheticException,1);c.length&&(u.stacktrace={frames:c,type:"raw"})}return{$exception_list:[u],$exception_level:"error"}}function vY(e){return jn(e)&&!R1(e)&&AZ.indexOf(e)>=0}function yY(e,t){var n,r,i=(n=t==null?void 0:t.handled)===null||n===void 0||n,o=(r=t==null?void 0:t.synthetic)===null||r===void 0||r,s=t!=null&&t.overrideExceptionType?t.overrideExceptionType:SM(e)?e.constructor.name:"Error",u="Non-Error 'exception' captured with keys: ".concat(function(p){var h=arguments.length>1&&arguments[1]!==void 0?arguments[1]:40,m=Object.keys(p);if(m.sort(),!m.length)return"[object has no keys]";for(var v=m.length;v>0;v--){var _=m.slice(0,v).join(", ");if(!(_.length>h))return v===m.length||_.length<=h?_:"".concat(_.slice(0,h),"...")}return""}(e)),c={type:s,value:u,mechanism:{handled:i,synthetic:o}};if(t!=null&&t.syntheticException){var d=Q1(t==null?void 0:t.syntheticException,1);d.length&&(c.stacktrace={frames:d,type:"raw"})}return{$exception_list:[c],$exception_level:vY(e.level)?e.level:"error"}}function _Y(e,t){var{error:n,event:r}=e,i={$exception_list:[]},o=n||r;if(Y1(o)||function(v){return vg(v,"DOMException")}(o)){var s=o;if(function(v){return"stack"in v}(o))i=X1(o,t);else{var u=s.name||(Y1(s)?"DOMError":"DOMException"),c=s.message?"".concat(u,": ").concat(s.message):u,d=Y1(s)?"DOMError":"DOMException";i=J1(c,pe(pe({},t),{},{overrideExceptionType:d,defaultExceptionMessage:c}))}return"code"in s&&(i.$exception_DOMException_code="".concat(s.code)),i}if(function(v){return vg(v,"ErrorEvent")}(o)&&o.error)return X1(o.error,t);if(function(v){switch(Object.prototype.toString.call(v)){case"[object Error]":case"[object Exception]":case"[object DOMException]":case"[object DOMError]":return!0;default:return wM(v,Error)}}(o))return X1(o,t);if(function(v){return vg(v,"Object")}(o)||SM(o))return yY(o,t);if(Be(n)&&jn(r)){var p="Error",h=r,m=r.match(gY);return m&&(p=m[1],h=m[2]),J1(h,pe(pe({},t),{},{overrideExceptionType:p,defaultExceptionMessage:h}))}return J1(o,t)}function _g(e){var t,n;return((t=JSON.stringify(e,(n=[],function(r,i){if(An(i)){for(;n.length>0&&n[n.length-1]!==this;)n.pop();return n.includes(i)?"[Circular]":(n.push(i),i)}return i})))===null||t===void 0?void 0:t.length)||0}function eS(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:66060288e-1;if(e.size>=t&&e.data.length>1){var n=Math.floor(e.data.length/2),r=e.data.slice(0,n),i=e.data.slice(n);return[eS({size:_g(r),data:r,sessionId:e.sessionId,windowId:e.windowId}),eS({size:_g(i),data:i,sessionId:e.sessionId,windowId:e.windowId})].flatMap(o=>o)}return[e]}var ea=(e=>(e[e.DomContentLoaded=0]="DomContentLoaded",e[e.Load=1]="Load",e[e.FullSnapshot=2]="FullSnapshot",e[e.IncrementalSnapshot=3]="IncrementalSnapshot",e[e.Meta=4]="Meta",e[e.Custom=5]="Custom",e[e.Plugin=6]="Plugin",e))(ea||{}),Vi=(e=>(e[e.Mutation=0]="Mutation",e[e.MouseMove=1]="MouseMove",e[e.MouseInteraction=2]="MouseInteraction",e[e.Scroll=3]="Scroll",e[e.ViewportResize=4]="ViewportResize",e[e.Input=5]="Input",e[e.TouchMove=6]="TouchMove",e[e.MediaInteraction=7]="MediaInteraction",e[e.StyleSheetRule=8]="StyleSheetRule",e[e.CanvasMutation=9]="CanvasMutation",e[e.Font=10]="Font",e[e.Log=11]="Log",e[e.Drag=12]="Drag",e[e.StyleDeclaration=13]="StyleDeclaration",e[e.Selection=14]="Selection",e[e.AdoptedStyleSheet=15]="AdoptedStyleSheet",e[e.CustomElement=16]="CustomElement",e))(Vi||{}),tS="[SessionRecording]",nS="redacted",bg={initiatorTypes:["audio","beacon","body","css","early-hint","embed","fetch","frame","iframe","icon","image","img","input","link","navigation","object","ping","script","track","video","xmlhttprequest"],maskRequestFn:e=>e,recordHeaders:!1,recordBody:!1,recordInitialRequests:!1,recordPerformance:!1,performanceEntryTypeToObserve:["first-input","navigation","paint","resource"],payloadSizeLimitBytes:1e6,payloadHostDenyList:[".lr-ingest.io",".ingest.sentry.io",".clarity.ms","analytics.google.com"]},bY=["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"],SY=["password","secret","passwd","api_key","apikey","auth","credentials","mysql_pwd","privatekey","private_key","token"],wY=["/s/","/e/","/i/"];function AM(e,t,n,r){if(Wt(e))return e;var i=(t==null?void 0:t["content-length"])||function(o){return new Blob([o]).size}(e);return jn(i)&&(i=parseInt(i)),i>n?tS+" ".concat(r," body too large to record (").concat(i," bytes)"):e}function IM(e,t){if(Wt(e))return e;var n=e;return du(n,!1)||(n=tS+" "+t+" body "+nS),rn(SY,r=>{var i,o;(i=n)!==null&&i!==void 0&&i.length&&((o=n)===null||o===void 0?void 0:o.indexOf(r))!==-1&&(n=tS+" "+t+" body "+nS+" as might contain: "+r)}),n}var xY=(e,t)=>{var n,r,i,o={payloadSizeLimitBytes:bg.payloadSizeLimitBytes,performanceEntryTypeToObserve:[...bg.performanceEntryTypeToObserve],payloadHostDenyList:[...t.payloadHostDenyList||[],...bg.payloadHostDenyList]},s=e.session_recording.recordHeaders!==!1&&t.recordHeaders,u=e.session_recording.recordBody!==!1&&t.recordBody,c=e.capture_performance!==!1&&t.recordPerformance,d=(n=o,i=Math.min(1e6,(r=n.payloadSizeLimitBytes)!==null&&r!==void 0?r:1e6),m=>(m!=null&&m.requestBody&&(m.requestBody=AM(m.requestBody,m.requestHeaders,i,"Request")),m!=null&&m.responseBody&&(m.responseBody=AM(m.responseBody,m.responseHeaders,i,"Response")),m)),p=m=>{return d(((x,b)=>{var w,C=hu(x.name),E=b.indexOf("http")===0?(w=hu(b))===null||w===void 0?void 0:w.pathname:b;E==="/"&&(E="");var R=C==null?void 0:C.pathname.replace(E||"","");if(!(C&&R&&wY.some(O=>R.indexOf(O)===0)))return x})((_=(v=m).requestHeaders,Wt(_)||rn(Object.keys(_??{}),x=>{bY.includes(x.toLowerCase())&&(_[x]=nS)}),v),e.api_host));var v,_},h=Gi(e.session_recording.maskNetworkRequestFn);return h&&Gi(e.session_recording.maskCapturedNetworkRequestFn)&&Qe.warn("Both `maskNetworkRequestFn` and `maskCapturedNetworkRequestFn` are defined. `maskNetworkRequestFn` will be ignored."),h&&(e.session_recording.maskCapturedNetworkRequestFn=m=>{var v=e.session_recording.maskNetworkRequestFn({url:m.name});return pe(pe({},m),{},{name:v==null?void 0:v.url})}),o.maskRequestFn=Gi(e.session_recording.maskCapturedNetworkRequestFn)?m=>{var v,_,x,b=p(m);return b&&(v=(_=(x=e.session_recording).maskCapturedNetworkRequestFn)===null||_===void 0?void 0:_.call(x,b))!==null&&v!==void 0?v:void 0}:m=>function(v){if(!Be(v))return v.requestBody=IM(v.requestBody,"Request"),v.responseBody=IM(v.responseBody,"Response"),v}(p(m)),pe(pe(pe({},bg),o),{},{recordHeaders:s,recordBody:u,recordPerformance:c,recordInitialRequests:c})};function bi(e,t,n,r,i){return t>n&&(Qe.warn("min cannot be greater than max."),t=n),Dr(e)?e>n?(r&&Qe.warn(r+" cannot be greater than max: "+n+". Using max value instead."),n):e<t?(r&&Qe.warn(r+" cannot be less than min: "+t+". Using min value instead."),t):e:(r&&Qe.warn(r+" must be a number. using max or fallback. max: "+n+", fallback: "+i),bi(i||n,t,n,r))}class CY{constructor(t){var n,r,i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};Me(this,"bucketSize",100),Me(this,"refillRate",10),Me(this,"mutationBuckets",{}),Me(this,"loggedTracker",{}),Me(this,"refillBuckets",()=>{Object.keys(this.mutationBuckets).forEach(o=>{this.mutationBuckets[o]=this.mutationBuckets[o]+this.refillRate,this.mutationBuckets[o]>=this.bucketSize&&delete this.mutationBuckets[o]})}),Me(this,"getNodeOrRelevantParent",o=>{var s=this.rrweb.mirror.getNode(o);if((s==null?void 0:s.nodeName)!=="svg"&&s instanceof Element){var u=s.closest("svg");if(u)return[this.rrweb.mirror.getId(u),u]}return[o,s]}),Me(this,"numberOfChanges",o=>{var s,u,c,d,p,h,m,v;return((s=(u=o.removes)===null||u===void 0?void 0:u.length)!==null&&s!==void 0?s:0)+((c=(d=o.attributes)===null||d===void 0?void 0:d.length)!==null&&c!==void 0?c:0)+((p=(h=o.texts)===null||h===void 0?void 0:h.length)!==null&&p!==void 0?p:0)+((m=(v=o.adds)===null||v===void 0?void 0:v.length)!==null&&m!==void 0?m:0)}),Me(this,"throttleMutations",o=>{if(o.type!==3||o.data.source!==0)return o;var s=o.data,u=this.numberOfChanges(s);s.attributes&&(s.attributes=s.attributes.filter(d=>{var p,h,m,[v,_]=this.getNodeOrRelevantParent(d.id);return this.mutationBuckets[v]===0?!1:(this.mutationBuckets[v]=(p=this.mutationBuckets[v])!==null&&p!==void 0?p:this.bucketSize,this.mutationBuckets[v]=Math.max(this.mutationBuckets[v]-1,0),this.mutationBuckets[v]===0&&(this.loggedTracker[v]||(this.loggedTracker[v]=!0,(h=(m=this.options).onBlockedNode)===null||h===void 0||h.call(m,v,_))),d)}));var c=this.numberOfChanges(s);return c!==0||u===c?o:void 0}),this.rrweb=t,this.options=i,this.refillRate=bi((n=this.options.refillRate)!==null&&n!==void 0?n:this.refillRate,0,100,"mutation throttling refill rate"),this.bucketSize=bi((r=this.options.bucketSize)!==null&&r!==void 0?r:this.bucketSize,0,100,"mutation throttling bucket size"),setInterval(()=>{this.refillBuckets()},1e3)}}var Si=Uint8Array,Gr=Uint16Array,gu=Uint32Array,rS=new Si([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]),iS=new Si([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]),RM=new Si([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),OM=function(e,t){for(var n=new Gr(31),r=0;r<31;++r)n[r]=t+=1<<e[r-1];var i=new gu(n[30]);for(r=1;r<30;++r)for(var o=n[r];o<n[r+1];++o)i[o]=o-n[r]<<5|r;return[n,i]},TM=OM(rS,2),EY=TM[0],oS=TM[1];EY[28]=258,oS[258]=28;for(var MM=OM(iS,0)[1],DM=new Gr(32768),mn=0;mn<32768;++mn){var js=(43690&mn)>>>1|(21845&mn)<<1;js=(61680&(js=(52428&js)>>>2|(13107&js)<<2))>>>4|(3855&js)<<4,DM[mn]=((65280&js)>>>8|(255&js)<<8)>>>1}var Df=function(e,t,n){for(var r=e.length,i=0,o=new Gr(t);i<r;++i)++o[e[i]-1];var s,u=new Gr(t);for(i=0;i<t;++i)u[i]=u[i-1]+o[i-1]<<1;for(s=new Gr(r),i=0;i<r;++i)s[i]=DM[u[e[i]-1]++]>>>15-e[i];return s},Hs=new Si(288);for(mn=0;mn<144;++mn)Hs[mn]=8;for(mn=144;mn<256;++mn)Hs[mn]=9;for(mn=256;mn<280;++mn)Hs[mn]=7;for(mn=280;mn<288;++mn)Hs[mn]=8;var Sg=new Si(32);for(mn=0;mn<32;++mn)Sg[mn]=5;var kY=Df(Hs,9),AY=Df(Sg,5),$M=function(e){return(e/8>>0)+(7&e&&1)},LM=function(e,t,n){(n==null||n>e.length)&&(n=e.length);var r=new(e instanceof Gr?Gr:e instanceof gu?gu:Si)(n-t);return r.set(e.subarray(t,n)),r},ta=function(e,t,n){n<<=7&t;var r=t/8>>0;e[r]|=n,e[r+1]|=n>>>8},$f=function(e,t,n){n<<=7&t;var r=t/8>>0;e[r]|=n,e[r+1]|=n>>>8,e[r+2]|=n>>>16},aS=function(e,t){for(var n=[],r=0;r<e.length;++r)e[r]&&n.push({s:r,f:e[r]});var i=n.length,o=n.slice();if(!i)return[new Si(0),0];if(i==1){var s=new Si(n[0].s+1);return s[n[0].s]=1,[s,1]}n.sort(function(O,T){return O.f-T.f}),n.push({s:-1,f:25001});var u=n[0],c=n[1],d=0,p=1,h=2;for(n[0]={s:-1,f:u.f+c.f,l:u,r:c};p!=i-1;)u=n[n[d].f<n[h].f?d++:h++],c=n[d!=p&&n[d].f<n[h].f?d++:h++],n[p++]={s:-1,f:u.f+c.f,l:u,r:c};var m=o[0].s;for(r=1;r<i;++r)o[r].s>m&&(m=o[r].s);var v=new Gr(m+1),_=sS(n[p-1],v,0);if(_>t){r=0;var x=0,b=_-t,w=1<<b;for(o.sort(function(O,T){return v[T.s]-v[O.s]||O.f-T.f});r<i;++r){var C=o[r].s;if(!(v[C]>t))break;x+=w-(1<<_-v[C]),v[C]=t}for(x>>>=b;x>0;){var E=o[r].s;v[E]<t?x-=1<<t-v[E]++-1:++r}for(;r>=0&&x;--r){var R=o[r].s;v[R]==t&&(--v[R],++x)}_=t}return[new Si(v),_]},sS=function(e,t,n){return e.s==-1?Math.max(sS(e.l,t,n+1),sS(e.r,t,n+1)):t[e.s]=n},NM=function(e){for(var t=e.length;t&&!e[--t];);for(var n=new Gr(++t),r=0,i=e[0],o=1,s=function(c){n[r++]=c},u=1;u<=t;++u)if(e[u]==i&&u!=t)++o;else{if(!i&&o>2){for(;o>138;o-=138)s(32754);o>2&&(s(o>10?o-11<<5|28690:o-3<<5|12305),o=0)}else if(o>3){for(s(i),--o;o>6;o-=6)s(8304);o>2&&(s(o-3<<5|8208),o=0)}for(;o--;)s(i);o=1,i=e[u]}return[n.subarray(0,r),t]},Lf=function(e,t){for(var n=0,r=0;r<t.length;++r)n+=e[r]*t[r];return n},lS=function(e,t,n){var r=n.length,i=$M(t+2);e[i]=255&r,e[i+1]=r>>>8,e[i+2]=255^e[i],e[i+3]=255^e[i+1];for(var o=0;o<r;++o)e[i+o+4]=n[o];return 8*(i+4+r)},PM=function(e,t,n,r,i,o,s,u,c,d,p){ta(t,p++,n),++i[256];for(var h=aS(i,15),m=h[0],v=h[1],_=aS(o,15),x=_[0],b=_[1],w=NM(m),C=w[0],E=w[1],R=NM(x),O=R[0],T=R[1],L=new Gr(19),B=0;B<C.length;++B)L[31&C[B]]++;for(B=0;B<O.length;++B)L[31&O[B]]++;for(var z=aS(L,7),P=z[0],V=z[1],J=19;J>4&&!P[RM[J-1]];--J);var le,G,Z,q,H=d+5<<3,fe=Lf(i,Hs)+Lf(o,Sg)+s,we=Lf(i,m)+Lf(o,x)+s+14+3*J+Lf(L,P)+(2*L[16]+3*L[17]+7*L[18]);if(H<=fe&&H<=we)return lS(t,p,e.subarray(c,c+d));if(ta(t,p,1+(we<fe)),p+=2,we<fe){le=Df(m,v),G=m,Z=Df(x,b),q=x;var k=Df(P,V);for(ta(t,p,E-257),ta(t,p+5,T-1),ta(t,p+10,J-4),p+=14,B=0;B<J;++B)ta(t,p+3*B,P[RM[B]]);p+=3*J;for(var ne=[C,O],de=0;de<2;++de){var D=ne[de];for(B=0;B<D.length;++B){var ue=31&D[B];ta(t,p,k[ue]),p+=P[ue],ue>15&&(ta(t,p,D[B]>>>5&127),p+=D[B]>>>12)}}}else le=kY,G=Hs,Z=AY,q=Sg;for(B=0;B<u;++B)if(r[B]>255){ue=r[B]>>>18&31,$f(t,p,le[ue+257]),p+=G[ue+257],ue>7&&(ta(t,p,r[B]>>>23&31),p+=rS[ue]);var Re=31&r[B];$f(t,p,Z[Re]),p+=q[Re],Re>3&&($f(t,p,r[B]>>>5&8191),p+=iS[Re])}else $f(t,p,le[r[B]]),p+=G[r[B]];return $f(t,p,le[256]),p+G[256]},IY=new gu([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),RY=function(){for(var e=new gu(256),t=0;t<256;++t){for(var n=t,r=9;--r;)n=(1&n&&3988292384)^n>>>1;e[t]=n}return e}(),OY=function(){var e=4294967295;return{p:function(t){for(var n=e,r=0;r<t.length;++r)n=RY[255&n^t[r]]^n>>>8;e=n},d:function(){return 4294967295^e}}},TY=function(e,t,n,r,i){return function(o,s,u,c,d,p){var h=o.length,m=new Si(c+h+5*(1+Math.floor(h/7e3))+d),v=m.subarray(c,m.length-d),_=0;if(!s||h<8)for(var x=0;x<=h;x+=65535){var b=x+65535;b<h?_=lS(v,_,o.subarray(x,b)):(v[x]=p,_=lS(v,_,o.subarray(x,h)))}else{for(var w=IY[s-1],C=w>>>13,E=8191&w,R=(1<<u)-1,O=new Gr(32768),T=new Gr(R+1),L=Math.ceil(u/3),B=2*L,z=function(lt){return(o[lt]^o[lt+1]<<L^o[lt+2]<<B)&R},P=new gu(25e3),V=new Gr(288),J=new Gr(32),le=0,G=0,Z=(x=0,0),q=0,H=0;x<h;++x){var fe=z(x),we=32767&x,k=T[fe];if(O[we]=k,T[fe]=we,q<=x){var ne=h-x;if((le>7e3||Z>24576)&&ne>423){_=PM(o,v,0,P,V,J,G,Z,H,x-H,_),Z=le=G=0,H=x;for(var de=0;de<286;++de)V[de]=0;for(de=0;de<30;++de)J[de]=0}var D=2,ue=0,Re=E,ie=we-k&32767;if(ne>2&&fe==z(x-ie))for(var Ne=Math.min(C,ne)-1,De=Math.min(32767,x),Fe=Math.min(258,ne);ie<=De&&--Re&&we!=k;){if(o[x+D]==o[x+D-ie]){for(var We=0;We<Fe&&o[x+We]==o[x+We-ie];++We);if(We>D){if(D=We,ue=ie,We>Ne)break;var Pe=Math.min(ie,We-2),be=0;for(de=0;de<Pe;++de){var Ke=x-ie+de+32768&32767,Je=Ke-O[Ke]+32768&32767;Je>be&&(be=Je,k=Ke)}}}ie+=(we=k)-(k=O[we])+32768&32767}if(ue){P[Z++]=268435456|oS[D]<<18|MM[ue];var dt=31&oS[D],tt=31&MM[ue];G+=rS[dt]+iS[tt],++V[257+dt],++J[tt],q=x+D,++le}else P[Z++]=o[x],++V[o[x]]}}_=PM(o,v,p,P,V,J,G,Z,H,x-H,_)}return LM(m,0,c+$M(_)+d)}(e,t.level==null?6:t.level,t.mem==null?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(e.length)))):12+t.mem,n,r,!0)},uS=function(e,t,n){for(;n;++t)e[t]=n,n>>>=8},MY=function(e,t){var n=t.filename;if(e[0]=31,e[1]=139,e[2]=8,e[8]=t.level<2?4:t.level==9?2:0,e[9]=3,t.mtime!=0&&uS(e,4,Math.floor(new Date(t.mtime||Date.now())/1e3)),n){e[3]=8;for(var r=0;r<=n.length;++r)e[r+10]=n.charCodeAt(r)}},DY=function(e){return 10+(e.filename&&e.filename.length+1||0)};function BM(e,t){t===void 0&&(t={});var n=OY(),r=e.length;n.p(e);var i=TY(e,t,DY(t),8),o=i.length;return MY(i,t),uS(i,o-8,n.d()),uS(i,o-4,r),i}function FM(e,t){var n=e.length;if(typeof TextEncoder<"u")return new TextEncoder().encode(e);for(var r=new Si(e.length+(e.length>>>1)),i=0,o=function(d){r[i++]=d},s=0;s<n;++s){if(i+5>r.length){var u=new Si(i+8+(n-s<<1));u.set(r),r=u}var c=e.charCodeAt(s);c<128||t?o(c):c<2048?(o(192|c>>>6),o(128|63&c)):c>55295&&c<57344?(o(240|(c=65536+(1047552&c)|1023&e.charCodeAt(++s))>>>18),o(128|c>>>12&63),o(128|c>>>6&63),o(128|63&c)):(o(224|c>>>12),o(128|c>>>6&63),o(128|63&c))}return LM(r,0,i)}function $Y(e,t){return function(n){for(var r=0,i=0;i<n.length;i++)r=(r<<5)-r+n.charCodeAt(i),r|=0;return Math.abs(r)}(e)%100<bi(100*t,0,100)}var Nf="[SessionRecording]",Ar=kr(Nf);function wg(){var e,t;return pt==null||(e=pt.__PosthogExtensions__)===null||e===void 0||(t=e.rrweb)===null||t===void 0?void 0:t.record}var LY=3e5,NY=[Vi.MouseMove,Vi.MouseInteraction,Vi.Scroll,Vi.ViewportResize,Vi.Input,Vi.TouchMove,Vi.MediaInteraction,Vi.Drag],UM=e=>({rrwebMethod:e,enqueuedAt:Date.now(),attempt:1});function Gs(e){return function(t,n){for(var r="",i=0;i<t.length;){var o=t[i++];r+=String.fromCharCode(o)}return r}(BM(FM(JSON.stringify(e))))}function zM(e){return e.type===ea.Custom&&e.data.tag==="sessionIdle"}function qM(e,t){return t.some(n=>n.matching==="regex"&&new RegExp(n.url).test(e))}class PY{get sessionIdleThresholdMilliseconds(){return this.instance.config.session_recording.session_idle_threshold_ms||3e5}get started(){return this._captureStarted}get sessionManager(){if(!this.instance.sessionManager)throw new Error(Nf+" must be started with a valid sessionManager.");return this.instance.sessionManager}get fullSnapshotIntervalMillis(){var t,n;return this.triggerStatus==="trigger_pending"?6e4:(t=(n=this.instance.config.session_recording)===null||n===void 0?void 0:n.full_snapshot_interval_millis)!==null&&t!==void 0?t:LY}get isSampled(){var t=this.instance.get_property(Of);return Ha(t)?t:null}get sessionDuration(){var t,n,r=(t=this.buffer)===null||t===void 0?void 0:t.data[((n=this.buffer)===null||n===void 0?void 0:n.data.length)-1],{sessionStartTimestamp:i}=this.sessionManager.checkAndGetSessionAndWindowId(!0);return r?r.timestamp-i:null}get isRecordingEnabled(){var t=!!this.instance.get_property(T1),n=!this.instance.config.disable_session_recording;return ce&&t&&n}get isConsoleLogCaptureEnabled(){var t=!!this.instance.get_property(ZT),n=this.instance.config.enable_recording_console_log;return n??t}get canvasRecording(){var t,n,r,i,o,s,u=this.instance.config.session_recording.captureCanvas,c=this.instance.get_property(KT),d=(t=(n=u==null?void 0:u.recordCanvas)!==null&&n!==void 0?n:c==null?void 0:c.enabled)!==null&&t!==void 0&&t,p=(r=(i=u==null?void 0:u.canvasFps)!==null&&i!==void 0?i:c==null?void 0:c.fps)!==null&&r!==void 0?r:4,h=(o=(s=u==null?void 0:u.canvasQuality)!==null&&s!==void 0?s:c==null?void 0:c.quality)!==null&&o!==void 0?o:.4;if(typeof h=="string"){var m=parseFloat(h);h=isNaN(m)?.4:m}return{enabled:d,fps:bi(p,0,12,"canvas recording fps",4),quality:bi(h,0,1,"canvas recording quality",.4)}}get networkPayloadCapture(){var t,n,r=this.instance.get_property(YT),i={recordHeaders:(t=this.instance.config.session_recording)===null||t===void 0?void 0:t.recordHeaders,recordBody:(n=this.instance.config.session_recording)===null||n===void 0?void 0:n.recordBody},o=(i==null?void 0:i.recordHeaders)||(r==null?void 0:r.recordHeaders),s=(i==null?void 0:i.recordBody)||(r==null?void 0:r.recordBody),u=An(this.instance.config.capture_performance)?this.instance.config.capture_performance.network_timing:this.instance.config.capture_performance,c=!!(Ha(u)?u:r!=null&&r.capturePerformance);return o||s||c?{recordHeaders:o,recordBody:s,recordPerformance:c}:void 0}get masking(){var t,n,r,i,o,s,u=this.instance.get_property(WT),c={maskAllInputs:(t=this.instance.config.session_recording)===null||t===void 0?void 0:t.maskAllInputs,maskTextSelector:(n=this.instance.config.session_recording)===null||n===void 0?void 0:n.maskTextSelector,blockSelector:(r=this.instance.config.session_recording)===null||r===void 0?void 0:r.blockSelector},d=(i=c==null?void 0:c.maskAllInputs)!==null&&i!==void 0?i:u==null?void 0:u.maskAllInputs,p=(o=c==null?void 0:c.maskTextSelector)!==null&&o!==void 0?o:u==null?void 0:u.maskTextSelector,h=(s=c==null?void 0:c.blockSelector)!==null&&s!==void 0?s:u==null?void 0:u.blockSelector;return Be(d)&&Be(p)&&Be(h)?void 0:{maskAllInputs:d==null||d,maskTextSelector:p,blockSelector:h}}get sampleRate(){var t=this.instance.get_property(QT);return Dr(t)?t:null}get minimumDuration(){var t=this.instance.get_property(XT);return Dr(t)?t:null}get status(){return this.receivedDecide?this.isRecordingEnabled?this.isSampled===!1?"disabled":this._urlBlocked?"paused":Wt(this._linkedFlag)||this._linkedFlagSeen?this.triggerStatus==="trigger_pending"?"buffering":Ha(this.isSampled)?this.isSampled?"sampled":"disabled":"active":"buffering":"disabled":"buffering"}get urlTriggerStatus(){var t;return this._urlTriggers.length===0?"trigger_disabled":((t=this.instance)===null||t===void 0?void 0:t.get_property(M1))===this.sessionId?"trigger_activated":"trigger_pending"}get eventTriggerStatus(){var t;return this._eventTriggers.length===0?"trigger_disabled":((t=this.instance)===null||t===void 0?void 0:t.get_property(D1))===this.sessionId?"trigger_activated":"trigger_pending"}get triggerStatus(){var t=this.eventTriggerStatus==="trigger_activated"||this.urlTriggerStatus==="trigger_activated",n=this.eventTriggerStatus==="trigger_pending"||this.urlTriggerStatus==="trigger_pending";return t?"trigger_activated":n?"trigger_pending":"trigger_disabled"}constructor(t){if(Me(this,"queuedRRWebEvents",[]),Me(this,"isIdle","unknown"),Me(this,"_linkedFlagSeen",!1),Me(this,"_lastActivityTimestamp",Date.now()),Me(this,"_linkedFlag",null),Me(this,"_removePageViewCaptureHook",void 0),Me(this,"_onSessionIdListener",void 0),Me(this,"_persistDecideOnSessionListener",void 0),Me(this,"_samplingSessionListener",void 0),Me(this,"_urlTriggers",[]),Me(this,"_urlBlocklist",[]),Me(this,"_urlBlocked",!1),Me(this,"_eventTriggers",[]),Me(this,"_removeEventTriggerCaptureHook",void 0),Me(this,"_forceAllowLocalhostNetworkCapture",!1),Me(this,"_onBeforeUnload",()=>{this._flushBuffer()}),Me(this,"_onOffline",()=>{this._tryAddCustomEvent("browser offline",{})}),Me(this,"_onOnline",()=>{this._tryAddCustomEvent("browser online",{})}),Me(this,"_onVisibilityChange",()=>{if(He!=null&&He.visibilityState){var i="window "+He.visibilityState;this._tryAddCustomEvent(i,{})}}),this.instance=t,this._captureStarted=!1,this._endpoint="/s/",this.stopRrweb=void 0,this.receivedDecide=!1,!this.instance.sessionManager)throw Ar.error("started without valid sessionManager"),new Error(Nf+" started without valid sessionManager. This is a bug.");if(this.instance.config.__preview_experimental_cookieless_mode)throw new Error(Nf+" cannot be used with __preview_experimental_cookieless_mode.");var{sessionId:n,windowId:r}=this.sessionManager.checkAndGetSessionAndWindowId();this.sessionId=n,this.windowId=r,this.buffer=this.clearBuffer(),this.sessionIdleThresholdMilliseconds>=this.sessionManager.sessionTimeoutMs&&Ar.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(t){this.isRecordingEnabled?(this._startCapture(t),$n(ce,"beforeunload",this._onBeforeUnload),$n(ce,"offline",this._onOffline),$n(ce,"online",this._onOnline),$n(ce,"visibilitychange",this._onVisibilityChange),this._setupSampling(),this._addEventTriggerListener(),Wt(this._removePageViewCaptureHook)&&(this._removePageViewCaptureHook=this.instance.on("eventCaptured",n=>{try{if(n.event==="$pageview"){var r=n!=null&&n.properties.$current_url?this._maskUrl(n==null?void 0:n.properties.$current_url):"";if(!r)return;this._tryAddCustomEvent("$pageview",{href:r})}}catch(i){Ar.error("Could not add $pageview to rrweb session",i)}})),this._onSessionIdListener||(this._onSessionIdListener=this.sessionManager.onSessionId((n,r,i)=>{var o,s,u,c;i&&(this._tryAddCustomEvent("$session_id_change",{sessionId:n,windowId:r,changeReason:i}),(o=this.instance)===null||o===void 0||(s=o.persistence)===null||s===void 0||s.unregister(D1),(u=this.instance)===null||u===void 0||(c=u.persistence)===null||c===void 0||c.unregister(M1))}))):this.stopRecording()}stopRecording(){var t,n,r,i;this._captureStarted&&this.stopRrweb&&(this.stopRrweb(),this.stopRrweb=void 0,this._captureStarted=!1,ce==null||ce.removeEventListener("beforeunload",this._onBeforeUnload),ce==null||ce.removeEventListener("offline",this._onOffline),ce==null||ce.removeEventListener("online",this._onOnline),ce==null||ce.removeEventListener("visibilitychange",this._onVisibilityChange),this.clearBuffer(),clearInterval(this._fullSnapshotTimer),(t=this._removePageViewCaptureHook)===null||t===void 0||t.call(this),this._removePageViewCaptureHook=void 0,(n=this._removeEventTriggerCaptureHook)===null||n===void 0||n.call(this),this._removeEventTriggerCaptureHook=void 0,(r=this._onSessionIdListener)===null||r===void 0||r.call(this),this._onSessionIdListener=void 0,(i=this._samplingSessionListener)===null||i===void 0||i.call(this),this._samplingSessionListener=void 0,Ar.info("stopped"))}_resetSampling(){var t;(t=this.instance.persistence)===null||t===void 0||t.unregister(Of)}makeSamplingDecision(t){var n,r=this.sessionId!==t,i=this.sampleRate;if(Dr(i)){var o=this.isSampled,s=r||!Ha(o),u=s?$Y(t,i):o;s&&(u?this._reportStarted("sampled"):Ar.warn("Sample rate (".concat(i,") has determined that this sessionId (").concat(t,") will not be sent to the server.")),this._tryAddCustomEvent("samplingDecisionMade",{sampleRate:i,isSampled:u})),(n=this.instance.persistence)===null||n===void 0||n.register({[Of]:u})}else this._resetSampling()}onRemoteConfig(t){var n,r,i,o,s,u;if(this._tryAddCustomEvent("$remote_config_received",t),this._persistRemoteConfig(t),this._linkedFlag=((n=t.sessionRecording)===null||n===void 0?void 0:n.linkedFlag)||null,(r=t.sessionRecording)!==null&&r!==void 0&&r.endpoint&&(this._endpoint=(u=t.sessionRecording)===null||u===void 0?void 0:u.endpoint),this._setupSampling(),!Wt(this._linkedFlag)&&!this._linkedFlagSeen){var c=jn(this._linkedFlag)?this._linkedFlag:this._linkedFlag.flag,d=jn(this._linkedFlag)?null:this._linkedFlag.variant;this.instance.onFeatureFlags((p,h)=>{var m=An(h)&&c in h,v=d?h[c]===d:m;v&&this._reportStarted("linked_flag_matched",{linkedFlag:c,linkedVariant:d}),this._linkedFlagSeen=v})}(i=t.sessionRecording)!==null&&i!==void 0&&i.urlTriggers&&(this._urlTriggers=t.sessionRecording.urlTriggers),(o=t.sessionRecording)!==null&&o!==void 0&&o.urlBlocklist&&(this._urlBlocklist=t.sessionRecording.urlBlocklist),(s=t.sessionRecording)!==null&&s!==void 0&&s.eventTriggers&&(this._eventTriggers=t.sessionRecording.eventTriggers),this.receivedDecide=!0,this.startIfEnabledOrStop()}_setupSampling(){Dr(this.sampleRate)&&Wt(this._samplingSessionListener)&&(this._samplingSessionListener=this.sessionManager.onSessionId(t=>{this.makeSamplingDecision(t)}))}_persistRemoteConfig(t){if(this.instance.persistence){var n,r=this.instance.persistence,i=()=>{var o,s,u,c,d,p,h,m,v,_=(o=t.sessionRecording)===null||o===void 0?void 0:o.sampleRate,x=Wt(_)?null:parseFloat(_);Wt(x)&&this._resetSampling();var b=(s=t.sessionRecording)===null||s===void 0?void 0:s.minimumDurationMilliseconds;r.register({[T1]:!!t.sessionRecording,[ZT]:(u=t.sessionRecording)===null||u===void 0?void 0:u.consoleLogRecordingEnabled,[YT]:pe({capturePerformance:t.capturePerformance},(c=t.sessionRecording)===null||c===void 0?void 0:c.networkPayloadCapture),[WT]:(d=t.sessionRecording)===null||d===void 0?void 0:d.masking,[KT]:{enabled:(p=t.sessionRecording)===null||p===void 0?void 0:p.recordCanvas,fps:(h=t.sessionRecording)===null||h===void 0?void 0:h.canvasFps,quality:(m=t.sessionRecording)===null||m===void 0?void 0:m.canvasQuality},[QT]:x,[XT]:Be(b)?null:b,[JT]:(v=t.sessionRecording)===null||v===void 0?void 0:v.scriptConfig})};i(),(n=this._persistDecideOnSessionListener)===null||n===void 0||n.call(this),this._persistDecideOnSessionListener=this.sessionManager.onSessionId(i)}}log(t){var n,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"log";(n=this.instance.sessionRecording)===null||n===void 0||n.onRRwebEmit({type:6,data:{plugin:"rrweb/console@1",payload:{level:r,trace:[],payload:[JSON.stringify(t)]}},timestamp:Date.now()})}_startCapture(t){if(!Be(Object.assign)&&!Be(Array.from)&&!(this._captureStarted||this.instance.config.disable_session_recording||this.instance.consent.isOptedOut())){var n,r;this._captureStarted=!0,this.sessionManager.checkAndGetSessionAndWindowId(),wg()?this._onScriptLoaded():(n=pt.__PosthogExtensions__)===null||n===void 0||(r=n.loadExternalDependency)===null||r===void 0||r.call(n,this.instance,this.scriptName,i=>{if(i)return Ar.error("could not load recorder",i);this._onScriptLoaded()}),Ar.info("starting"),this.status==="active"&&this._reportStarted(t||"recording_initialized")}}get scriptName(){var t,n,r;return((t=this.instance)===null||t===void 0||(n=t.persistence)===null||n===void 0||(r=n.get_property(JT))===null||r===void 0?void 0:r.script)||"recorder"}isInteractiveEvent(t){var n;return t.type===3&&NY.indexOf((n=t.data)===null||n===void 0?void 0:n.source)!==-1}_updateWindowAndSessionIds(t){var n=this.isInteractiveEvent(t);n||this.isIdle||t.timestamp-this._lastActivityTimestamp>this.sessionIdleThresholdMilliseconds&&(this.isIdle=!0,clearInterval(this._fullSnapshotTimer),this._tryAddCustomEvent("sessionIdle",{eventTimestamp:t.timestamp,lastActivityTimestamp:this._lastActivityTimestamp,threshold:this.sessionIdleThresholdMilliseconds,bufferLength:this.buffer.data.length,bufferSize:this.buffer.size}),this._flushBuffer());var r=!1;if(n&&(this._lastActivityTimestamp=t.timestamp,this.isIdle)){var i=this.isIdle==="unknown";this.isIdle=!1,i||(this._tryAddCustomEvent("sessionNoLongerIdle",{reason:"user activity",type:t.type}),r=!0)}if(!this.isIdle){var{windowId:o,sessionId:s}=this.sessionManager.checkAndGetSessionAndWindowId(!n,t.timestamp),u=this.sessionId!==s,c=this.windowId!==o;this.windowId=o,this.sessionId=s,u||c?(this.stopRecording(),this.startIfEnabledOrStop("session_id_changed")):r&&this._scheduleFullSnapshot()}}_tryRRWebMethod(t){try{return t.rrwebMethod(),!0}catch(n){return this.queuedRRWebEvents.length<10?this.queuedRRWebEvents.push({enqueuedAt:t.enqueuedAt||Date.now(),attempt:t.attempt++,rrwebMethod:t.rrwebMethod}):Ar.warn("could not emit queued rrweb event.",n,t),!1}}_tryAddCustomEvent(t,n){return this._tryRRWebMethod(UM(()=>wg().addCustomEvent(t,n)))}_tryTakeFullSnapshot(){return this._tryRRWebMethod(UM(()=>wg().takeFullSnapshot()))}_onScriptLoaded(){var t,n,r,i,o={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},s=this.instance.config.session_recording;for(var[u,c]of Object.entries(s||{}))u in o&&(u==="maskInputOptions"?o.maskInputOptions=pe({password:!0},c):o[u]=c);this.canvasRecording&&this.canvasRecording.enabled&&(o.recordCanvas=!0,o.sampling={canvas:this.canvasRecording.fps},o.dataURLOptions={type:"image/webp",quality:this.canvasRecording.quality}),this.masking&&(o.maskAllInputs=(n=this.masking.maskAllInputs)===null||n===void 0||n,o.maskTextSelector=(r=this.masking.maskTextSelector)!==null&&r!==void 0?r:void 0,o.blockSelector=(i=this.masking.blockSelector)!==null&&i!==void 0?i:void 0);var d=wg();if(d){this.mutationRateLimiter=(t=this.mutationRateLimiter)!==null&&t!==void 0?t:new CY(d,{refillRate:this.instance.config.session_recording.__mutationRateLimiterRefillRate,bucketSize:this.instance.config.session_recording.__mutationRateLimiterBucketSize,onBlockedNode:(h,m)=>{var v="Too many mutations on node '".concat(h,"'. Rate limiting. This could be due to SVG animations or something similar");Ar.info(v,{node:m}),this.log(Nf+" "+v,"warn")}});var p=this._gatherRRWebPlugins();this.stopRrweb=d(pe({emit:h=>{this.onRRwebEmit(h)},plugins:p},o)),this._lastActivityTimestamp=Date.now(),this.isIdle=Ha(this.isIdle)?this.isIdle:"unknown",this._tryAddCustomEvent("$session_options",{sessionRecordingOptions:o,activePlugins:p.map(h=>h==null?void 0:h.name)}),this._tryAddCustomEvent("$posthog_config",{config:this.instance.config})}else Ar.error("onScriptLoaded was called but rrwebRecord is not available. This indicates something has gone wrong.")}_scheduleFullSnapshot(){if(this._fullSnapshotTimer&&clearInterval(this._fullSnapshotTimer),this.isIdle!==!0){var t=this.fullSnapshotIntervalMillis;t&&(this._fullSnapshotTimer=setInterval(()=>{this._tryTakeFullSnapshot()},t))}}_gatherRRWebPlugins(){var t,n,r,i,o=[],s=(t=pt.__PosthogExtensions__)===null||t===void 0||(n=t.rrwebPlugins)===null||n===void 0?void 0:n.getRecordConsolePlugin;s&&this.isConsoleLogCaptureEnabled&&o.push(s());var u=(r=pt.__PosthogExtensions__)===null||r===void 0||(i=r.rrwebPlugins)===null||i===void 0?void 0:i.getRecordNetworkPlugin;return this.networkPayloadCapture&&Gi(u)&&(!HZ.includes(location.hostname)||this._forceAllowLocalhostNetworkCapture?o.push(u(xY(this.instance.config,this.networkPayloadCapture))):Ar.info("NetworkCapture not started because we are on localhost.")),o}onRRwebEmit(t){var n;if(this._processQueuedEvents(),t&&An(t)){if(t.type===ea.Meta){var r=this._maskUrl(t.data.href);if(this._lastHref=r,!r)return;t.data.href=r}else this._pageViewFallBack();if(this._checkUrlTriggerConditions(),!this._urlBlocked||function(h){return h.type===ea.Custom&&h.data.tag==="recording paused"}(t)){t.type===ea.FullSnapshot&&this._scheduleFullSnapshot(),t.type===ea.FullSnapshot&&this.triggerStatus==="trigger_pending"&&this.clearBuffer();var i=this.mutationRateLimiter?this.mutationRateLimiter.throttleMutations(t):t;if(i){var o=function(h){var m=h;if(m&&An(m)&&m.type===6&&An(m.data)&&m.data.plugin==="rrweb/console@1"){m.data.payload.payload.length>10&&(m.data.payload.payload=m.data.payload.payload.slice(0,10),m.data.payload.payload.push("...[truncated]"));for(var v=[],_=0;_<m.data.payload.payload.length;_++)m.data.payload.payload[_]&&m.data.payload.payload[_].length>2e3?v.push(m.data.payload.payload[_].slice(0,2e3)+"...[truncated]"):v.push(m.data.payload.payload[_]);return m.data.payload.payload=v,h}return h}(i);if(this._updateWindowAndSessionIds(o),this.isIdle!==!0||zM(o)){if(zM(o)){var s=o.data.payload;if(s){var u=s.lastActivityTimestamp,c=s.threshold;o.timestamp=u+c}}var d=(n=this.instance.config.session_recording.compress_events)===null||n===void 0||n?function(h){if(_g(h)<1024)return h;try{if(h.type===ea.FullSnapshot)return pe(pe({},h),{},{data:Gs(h.data),cv:"2024-10"});if(h.type===ea.IncrementalSnapshot&&h.data.source===Vi.Mutation)return pe(pe({},h),{},{cv:"2024-10",data:pe(pe({},h.data),{},{texts:Gs(h.data.texts),attributes:Gs(h.data.attributes),removes:Gs(h.data.removes),adds:Gs(h.data.adds)})});if(h.type===ea.IncrementalSnapshot&&h.data.source===Vi.StyleSheetRule)return pe(pe({},h),{},{cv:"2024-10",data:pe(pe({},h.data),{},{adds:h.data.adds?Gs(h.data.adds):void 0,removes:h.data.removes?Gs(h.data.removes):void 0})})}catch(m){Ar.error("could not compress event - will use uncompressed event",m)}return h}(o):o,p={$snapshot_bytes:_g(d),$snapshot_data:d,$session_id:this.sessionId,$window_id:this.windowId};this.status!=="disabled"?this._captureSnapshotBuffered(p):this.clearBuffer()}}}}}_pageViewFallBack(){if(!this.instance.config.capture_pageview&&ce){var t=this._maskUrl(ce.location.href);this._lastHref!==t&&(this._tryAddCustomEvent("$url_changed",{href:t}),this._lastHref=t)}}_processQueuedEvents(){if(this.queuedRRWebEvents.length){var t=[...this.queuedRRWebEvents];this.queuedRRWebEvents=[],t.forEach(n=>{Date.now()-n.enqueuedAt<=2e3&&this._tryRRWebMethod(n)})}}_maskUrl(t){var n=this.instance.config.session_recording;if(n.maskNetworkRequestFn){var r,i={url:t};return(r=i=n.maskNetworkRequestFn(i))===null||r===void 0?void 0:r.url}return t}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 t=this.minimumDuration,n=this.sessionDuration,r=Dr(n)&&n>=0,i=Dr(t)&&r&&n<t;return this.status==="buffering"||this.status==="paused"||this.status==="disabled"||i?(this.flushBufferTimer=setTimeout(()=>{this._flushBuffer()},2e3),this.buffer):(this.buffer.data.length>0&&eS(this.buffer).forEach(o=>{this._captureSnapshot({$snapshot_bytes:o.size,$snapshot_data:o.data,$session_id:o.sessionId,$window_id:o.windowId,$lib:"web",$lib_version:Qo.LIB_VERSION})}),this.clearBuffer())}_captureSnapshotBuffered(t){var n,r=2+(((n=this.buffer)===null||n===void 0?void 0:n.data.length)||0);!this.isIdle&&(this.buffer.size+t.$snapshot_bytes+r>943718.4||this.buffer.sessionId!==this.sessionId)&&(this.buffer=this._flushBuffer()),this.buffer.size+=t.$snapshot_bytes,this.buffer.data.push(t.$snapshot_data),this.flushBufferTimer||this.isIdle||(this.flushBufferTimer=setTimeout(()=>{this._flushBuffer()},2e3))}_captureSnapshot(t){this.instance.capture("$snapshot",t,{_url:this.instance.requestRouter.endpointFor("api",this._endpoint),_noTruncate:!0,_batchKey:"recordings",skip_client_rate_limiting:!0})}_checkUrlTriggerConditions(){if(ce!==void 0&&ce.location.href){var t=ce.location.href,n=this._urlBlocked,r=qM(t,this._urlBlocklist);r&&!n?this._pauseRecording():!r&&n&&this._resumeRecording(),qM(t,this._urlTriggers)&&this._activateTrigger("url")}}_activateTrigger(t){var n,r;this.triggerStatus==="trigger_pending"&&((n=this.instance)===null||n===void 0||(r=n.persistence)===null||r===void 0||r.register({[t==="url"?M1:D1]:this.sessionId}),this._flushBuffer(),this._reportStarted(t+"_trigger_matched"))}_pauseRecording(){this._urlBlocked||(this._urlBlocked=!0,clearInterval(this._fullSnapshotTimer),Ar.info("recording paused due to URL blocker"),this._tryAddCustomEvent("recording paused",{reason:"url blocker"}))}_resumeRecording(){this._urlBlocked&&(this._urlBlocked=!1,this._tryTakeFullSnapshot(),this._scheduleFullSnapshot(),this._tryAddCustomEvent("recording resumed",{reason:"left blocked url"}),Ar.info("recording resumed"))}_addEventTriggerListener(){this._eventTriggers.length!==0&&Wt(this._removeEventTriggerCaptureHook)&&(this._removeEventTriggerCaptureHook=this.instance.on("eventCaptured",t=>{try{this._eventTriggers.includes(t.event)&&this._activateTrigger("event")}catch(n){Ar.error("Could not activate event trigger",n)}}))}overrideLinkedFlag(){this._linkedFlagSeen=!0,this._tryTakeFullSnapshot(),this._reportStarted("linked_flag_overridden")}overrideSampling(){var t;(t=this.instance.persistence)===null||t===void 0||t.register({[Of]:!0}),this._tryTakeFullSnapshot(),this._reportStarted("sampling_overridden")}overrideTrigger(t){this._activateTrigger(t)}_reportStarted(t,n){this.instance.register_for_session({$session_recording_start_reason:t}),Ar.info(t.replace("_"," "),n),kt(["recording_initialized","session_id_changed"],t)||this._tryAddCustomEvent(t,n)}}var cS=kr("[SegmentIntegration]");function BY(e,t){var n=e.config.segment;if(!n)return t();(function(r,i){var o=r.config.segment;if(!o)return i();var s=c=>{var d=()=>c.anonymousId()||Za();r.config.get_device_id=d,c.id()&&(r.register({distinct_id:c.id(),$device_id:d()}),r.persistence.set_property(Xo,"identified")),i()},u=o.user();"then"in u&&Gi(u.then)?u.then(c=>s(c)):s(u)})(e,()=>{n.register((r=>{Promise&&Promise.resolve||cS.warn("This browser does not have Promise support, and can not use the segment integration");var i=(o,s)=>{var u;if(!s)return o;o.event.userId||o.event.anonymousId===r.get_distinct_id()||(cS.info("No userId set, resetting PostHog"),r.reset()),o.event.userId&&o.event.userId!==r.get_distinct_id()&&(cS.info("UserId set, identifying with PostHog"),r.identify(o.event.userId));var c=r._calculate_event_properties(s,(u=o.event.properties)!==null&&u!==void 0?u:{},new Date);return o.event.properties=Object.assign({},c,o.event.properties),o};return{name:"PostHog JS",type:"enrichment",version:"1.0.0",isLoaded:()=>!0,load:()=>Promise.resolve(),track:o=>i(o,o.event.event),page:o=>i(o,"$pageview"),identify:o=>i(o,"$identify"),screen:o=>i(o,"$screen")}})(e)).then(()=>{t()})})}var jM="posthog-js";function HM(e){var{organization:t,projectId:n,prefix:r,severityAllowList:i=["error"]}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return o=>{var s,u,c,d,p;if(!(i==="*"||i.includes(o.level))||!e.__loaded)return o;o.tags||(o.tags={});var h=e.requestRouter.endpointFor("ui","/project/".concat(e.config.token,"/person/").concat(e.get_distinct_id()));o.tags["PostHog Person URL"]=h,e.sessionRecordingStarted()&&(o.tags["PostHog Recording URL"]=e.get_session_replay_url({withTimestamp:!0}));var m=((s=o.exception)===null||s===void 0?void 0:s.values)||[],v=m.map(x=>pe(pe({},x),{},{stacktrace:x.stacktrace?pe(pe({},x.stacktrace),{},{type:"raw",frames:(x.stacktrace.frames||[]).map(b=>pe(pe({},b),{},{platform:"web:javascript"}))}):void 0})),_={$exception_message:((u=m[0])===null||u===void 0?void 0:u.value)||o.message,$exception_type:(c=m[0])===null||c===void 0?void 0:c.type,$exception_personURL:h,$exception_level:o.level,$exception_list:v,$sentry_event_id:o.event_id,$sentry_exception:o.exception,$sentry_exception_message:((d=m[0])===null||d===void 0?void 0:d.value)||o.message,$sentry_exception_type:(p=m[0])===null||p===void 0?void 0:p.type,$sentry_tags:o.tags};return t&&n&&(_.$sentry_url=(r||"https://sentry.io/organizations/")+t+"/issues/?project="+n+"&query="+o.event_id),e.exceptions.sendExceptionEvent(_),o}}class FY{constructor(t,n,r,i,o){this.name=jM,this.setupOnce=function(s){s(HM(t,{organization:n,projectId:r,prefix:i,severityAllowList:o}))}}}var na,UY=ce!=null&&ce.location?dg(ce.location.hash,"__posthog")||dg(location.hash,"state"):null,GM="_postHogToolbarParams",VM=kr("[Toolbar]");(function(e){e[e.UNINITIALIZED=0]="UNINITIALIZED",e[e.LOADING=1]="LOADING",e[e.LOADED=2]="LOADED"})(na||(na={}));class zY{constructor(t){this.instance=t}setToolbarState(t){pt.ph_toolbar_state=t}getToolbarState(){var t;return(t=pt.ph_toolbar_state)!==null&&t!==void 0?t:na.UNINITIALIZED}maybeLoadToolbar(){var t,n,r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:void 0,i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:void 0,o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:void 0;if(!ce||!He)return!1;r=(t=r)!==null&&t!==void 0?t:ce.location,o=(n=o)!==null&&n!==void 0?n:ce.history;try{if(!i){try{ce.localStorage.setItem("test","test"),ce.localStorage.removeItem("test")}catch{return!1}i=ce==null?void 0:ce.localStorage}var s,u=UY||dg(r.hash,"__posthog")||dg(r.hash,"state"),c=u?FT(()=>JSON.parse(atob(decodeURIComponent(u))))||FT(()=>JSON.parse(decodeURIComponent(u))):null;return c&&c.action==="ph_authorize"?((s=c).source="url",s&&Object.keys(s).length>0&&(c.desiredHash?r.hash=c.desiredHash:o?o.replaceState(o.state,"",r.pathname+r.search):r.hash="")):((s=JSON.parse(i.getItem(GM)||"{}")).source="localstorage",delete s.userIntent),!(!s.token||this.instance.config.token!==s.token)&&(this.loadToolbar(s),!0)}catch{return!1}}_callLoadToolbar(t){var n=pt.ph_load_toolbar||pt.ph_load_editor;!Wt(n)&&Gi(n)?n(t,this.instance):VM.warn("No toolbar load function found")}loadToolbar(t){var n=!(He==null||!He.getElementById(eM));if(!ce||n)return!1;var r=this.instance.requestRouter.region==="custom"&&this.instance.config.advanced_disable_toolbar_metrics,i=pe(pe({token:this.instance.config.token},t),{},{apiURL:this.instance.requestRouter.endpointFor("ui")},r?{instrument:!1}:{});if(ce.localStorage.setItem(GM,JSON.stringify(pe(pe({},i),{},{source:void 0}))),this.getToolbarState()===na.LOADED)this._callLoadToolbar(i);else if(this.getToolbarState()===na.UNINITIALIZED){var o,s;this.setToolbarState(na.LOADING),(o=pt.__PosthogExtensions__)===null||o===void 0||(s=o.loadExternalDependency)===null||s===void 0||s.call(o,this.instance,"toolbar",u=>{if(u)return VM.error("[Toolbar] Failed to load",u),void this.setToolbarState(na.UNINITIALIZED);this.setToolbarState(na.LOADED),this._callLoadToolbar(i)}),$n(ce,"turbolinks:load",()=>{this.setToolbarState(na.UNINITIALIZED),this.loadToolbar(i)})}return!0}_loadEditor(t){return this.loadToolbar(t)}maybeLoadEditor(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:void 0,n=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(t,n,r)}}var qY=kr("[TracingHeaders]");class jY{constructor(t){Me(this,"_restoreXHRPatch",void 0),Me(this,"_restoreFetchPatch",void 0),Me(this,"_startCapturing",()=>{var n,r,i,o;Be(this._restoreXHRPatch)&&((n=pt.__PosthogExtensions__)===null||n===void 0||(r=n.tracingHeadersPatchFns)===null||r===void 0||r._patchXHR(this.instance.sessionManager)),Be(this._restoreFetchPatch)&&((i=pt.__PosthogExtensions__)===null||i===void 0||(o=i.tracingHeadersPatchFns)===null||o===void 0||o._patchFetch(this.instance.sessionManager))}),this.instance=t}_loadScript(t){var n,r,i;(n=pt.__PosthogExtensions__)!==null&&n!==void 0&&n.tracingHeadersPatchFns&&t(),(r=pt.__PosthogExtensions__)===null||r===void 0||(i=r.loadExternalDependency)===null||i===void 0||i.call(r,this.instance,"tracing-headers",o=>{if(o)return qY.error("failed to load script",o);t()})}startIfEnabledOrStop(){var t,n;this.instance.config.__add_tracing_headers?this._loadScript(this._startCapturing):((t=this._restoreXHRPatch)===null||t===void 0||t.call(this),(n=this._restoreFetchPatch)===null||n===void 0||n.call(this),this._restoreXHRPatch=void 0,this._restoreFetchPatch=void 0)}}var Wa=kr("[Web Vitals]"),ZM=9e5;let HY=class{constructor(t){var n;Me(this,"_enabledServerSide",!1),Me(this,"_initialized",!1),Me(this,"buffer",{url:void 0,metrics:[],firstMetricTimestamp:void 0}),Me(this,"_flushToCapture",()=>{clearTimeout(this._delayedFlushTimer),this.buffer.metrics.length!==0&&(this.instance.capture("$web_vitals",this.buffer.metrics.reduce((r,i)=>pe(pe({},r),{},{["$web_vitals_".concat(i.name,"_event")]:pe({},i),["$web_vitals_".concat(i.name,"_value")]:i.value}),{})),this.buffer={url:void 0,metrics:[],firstMetricTimestamp:void 0})}),Me(this,"_addToBuffer",r=>{var i,o=(i=this.instance.sessionManager)===null||i===void 0?void 0:i.checkAndGetSessionAndWindowId(!0);if(Be(o))Wa.error("Could not read session ID. Dropping metrics!");else{this.buffer=this.buffer||{url:void 0,metrics:[],firstMetricTimestamp:void 0};var s=this._currentURL();Be(s)||(Wt(r==null?void 0:r.name)||Wt(r==null?void 0:r.value)?Wa.error("Invalid metric received",r):this._maxAllowedValue&&r.value>=this._maxAllowedValue?Wa.error("Ignoring metric with value >= "+this._maxAllowedValue,r):(this.buffer.url!==s&&(this._flushToCapture(),this._delayedFlushTimer=setTimeout(this._flushToCapture,this.flushToCaptureTimeoutMs)),Be(this.buffer.url)&&(this.buffer.url=s),this.buffer.firstMetricTimestamp=Be(this.buffer.firstMetricTimestamp)?Date.now():this.buffer.firstMetricTimestamp,r.attribution&&r.attribution.interactionTargetElement&&(r.attribution.interactionTargetElement=void 0),this.buffer.metrics.push(pe(pe({},r),{},{$current_url:s,$session_id:o.sessionId,$window_id:o.windowId,timestamp:Date.now()})),this.buffer.metrics.length===this.allowedMetrics.length&&this._flushToCapture()))}}),Me(this,"_startCapturing",()=>{var r,i,o,s,u=pt.__PosthogExtensions__;Be(u)||Be(u.postHogWebVitalsCallbacks)||({onLCP:r,onCLS:i,onFCP:o,onINP:s}=u.postHogWebVitalsCallbacks),r&&i&&o&&s?(this.allowedMetrics.indexOf("LCP")>-1&&r(this._addToBuffer.bind(this)),this.allowedMetrics.indexOf("CLS")>-1&&i(this._addToBuffer.bind(this)),this.allowedMetrics.indexOf("FCP")>-1&&o(this._addToBuffer.bind(this)),this.allowedMetrics.indexOf("INP")>-1&&s(this._addToBuffer.bind(this)),this._initialized=!0):Wa.error("web vitals callbacks not loaded - not starting")}),this.instance=t,this._enabledServerSide=!((n=this.instance.persistence)===null||n===void 0||!n.props[HT]),this.startIfEnabled()}get allowedMetrics(){var t,n,r=An(this.instance.config.capture_performance)?(t=this.instance.config.capture_performance)===null||t===void 0?void 0:t.web_vitals_allowed_metrics:void 0;return Be(r)?((n=this.instance.persistence)===null||n===void 0?void 0:n.props[VT])||["CLS","FCP","INP","LCP"]:r}get flushToCaptureTimeoutMs(){return(An(this.instance.config.capture_performance)?this.instance.config.capture_performance.web_vitals_delayed_flush_ms:void 0)||5e3}get _maxAllowedValue(){var t=An(this.instance.config.capture_performance)&&Dr(this.instance.config.capture_performance.__web_vitals_max_value)?this.instance.config.capture_performance.__web_vitals_max_value:ZM;return 0<t&&t<=6e4?ZM:t}get isEnabled(){var t=Hr==null?void 0:Hr.protocol;if(t!=="http:"&&t!=="https:")return Wa.info("Web Vitals are disabled on non-http/https protocols"),!1;var n=An(this.instance.config.capture_performance)?this.instance.config.capture_performance.web_vitals:void 0;return Ha(n)?n:this._enabledServerSide}startIfEnabled(){this.isEnabled&&!this._initialized&&(Wa.info("enabled, starting..."),this.loadScript(this._startCapturing))}onRemoteConfig(t){var n=An(t.capturePerformance)&&!!t.capturePerformance.web_vitals,r=An(t.capturePerformance)?t.capturePerformance.web_vitals_allowed_metrics:void 0;this.instance.persistence&&(this.instance.persistence.register({[HT]:n}),this.instance.persistence.register({[VT]:r})),this._enabledServerSide=n,this.startIfEnabled()}loadScript(t){var n,r,i;(n=pt.__PosthogExtensions__)!==null&&n!==void 0&&n.postHogWebVitalsCallbacks&&t(),(r=pt.__PosthogExtensions__)===null||r===void 0||(i=r.loadExternalDependency)===null||i===void 0||i.call(r,this.instance,"web-vitals",o=>{o?Wa.error("failed to load script",o):t()})}_currentURL(){var t=ce?ce.location.href:void 0;return t||Wa.error("Could not determine current URL"),t}};var GY=kr("[Heatmaps]");function YM(e){return An(e)&&"clientX"in e&&"clientY"in e&&Dr(e.clientX)&&Dr(e.clientY)}class VY{constructor(t){var n;Me(this,"rageclicks",new gM),Me(this,"_enabledServerSide",!1),Me(this,"_initialized",!1),Me(this,"_flushInterval",null),this.instance=t,this._enabledServerSide=!((n=this.instance.persistence)===null||n===void 0||!n.props[O1])}get flushIntervalMilliseconds(){var t=5e3;return An(this.instance.config.capture_heatmaps)&&this.instance.config.capture_heatmaps.flush_interval_milliseconds&&(t=this.instance.config.capture_heatmaps.flush_interval_milliseconds),t}get isEnabled(){return Be(this.instance.config.capture_heatmaps)?Be(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;GY.info("starting..."),this._setupListeners(),this._flushInterval=setInterval(this.flush.bind(this),this.flushIntervalMilliseconds)}else{var t,n;clearInterval((t=this._flushInterval)!==null&&t!==void 0?t:void 0),(n=this.deadClicksCapture)===null||n===void 0||n.stop(),this.getAndClearBuffer()}}onRemoteConfig(t){var n=!!t.heatmaps;this.instance.persistence&&this.instance.persistence.register({[O1]:n}),this._enabledServerSide=n,this.startIfEnabled()}getAndClearBuffer(){var t=this.buffer;return this.buffer=void 0,t}_onDeadClick(t){this._onClick(t.originalEvent,"deadclick")}_setupListeners(){ce&&He&&($n(ce,"beforeunload",this.flush.bind(this)),$n(He,"click",t=>this._onClick(t||(ce==null?void 0:ce.event)),{capture:!0}),$n(He,"mousemove",t=>this._onMouseMove(t||(ce==null?void 0:ce.event)),{capture:!0}),this.deadClicksCapture=new bM(this.instance,oY,this._onDeadClick.bind(this)),this.deadClicksCapture.startIfEnabled(),this._initialized=!0)}_getProperties(t,n){var r=this.instance.scrollManager.scrollY(),i=this.instance.scrollManager.scrollX(),o=this.instance.scrollManager.scrollElement(),s=function(u,c,d){for(var p=u;p&&lg(p)&&!Va(p,"body");){if(p===d)return!1;if(kt(c,ce==null?void 0:ce.getComputedStyle(p).position))return!0;p=lM(p)}return!1}(sM(t),["fixed","sticky"],o);return{x:t.clientX+(s?0:i),y:t.clientY+(s?0:r),target_fixed:s,type:n}}_onClick(t){var n,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"click";if(!nM(t.target)&&YM(t)){var i=this._getProperties(t,r);(n=this.rageclicks)!==null&&n!==void 0&&n.isRageClick(t.clientX,t.clientY,new Date().getTime())&&this._capture(pe(pe({},i),{},{type:"rageclick"})),this._capture(i)}}_onMouseMove(t){!nM(t.target)&&YM(t)&&(clearTimeout(this._mouseMoveTimeout),this._mouseMoveTimeout=setTimeout(()=>{this._capture(this._getProperties(t,"mousemove"))},500))}_capture(t){if(ce){var n=ce.location.href;this.buffer=this.buffer||{},this.buffer[n]||(this.buffer[n]=[]),this.buffer[n].push(t)}}flush(){this.buffer&&!cu(this.buffer)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}}class ZY{constructor(t){this._instance=t}doPageView(t,n){var r,i=this._previousPageViewProperties(t,n);return this._currentPageview={pathname:(r=ce==null?void 0:ce.location.pathname)!==null&&r!==void 0?r:"",pageViewId:n,timestamp:t},this._instance.scrollManager.resetContext(),i}doPageLeave(t){var n;return this._previousPageViewProperties(t,(n=this._currentPageview)===null||n===void 0?void 0:n.pageViewId)}doEvent(){var t;return{$pageview_id:(t=this._currentPageview)===null||t===void 0?void 0:t.pageViewId}}_previousPageViewProperties(t,n){var r=this._currentPageview;if(!r)return{$pageview_id:n};var i={$pageview_id:n,$prev_pageview_id:r.pageViewId},o=this._instance.scrollManager.getContext();if(o&&!this._instance.config.disable_scroll_properties){var{maxScrollHeight:s,lastScrollY:u,maxScrollY:c,maxContentHeight:d,lastContentY:p,maxContentY:h}=o;if(!(Be(s)||Be(u)||Be(c)||Be(d)||Be(p)||Be(h))){s=Math.ceil(s),u=Math.ceil(u),c=Math.ceil(c),d=Math.ceil(d),p=Math.ceil(p),h=Math.ceil(h);var m=s<=1?1:bi(u/s,0,1),v=s<=1?1:bi(c/s,0,1),_=d<=1?1:bi(p/d,0,1),x=d<=1?1:bi(h/d,0,1);i=Hn(i,{$prev_pageview_last_scroll:u,$prev_pageview_last_scroll_percentage:m,$prev_pageview_max_scroll:c,$prev_pageview_max_scroll_percentage:v,$prev_pageview_last_content:p,$prev_pageview_last_content_percentage:_,$prev_pageview_max_content:h,$prev_pageview_max_content_percentage:x})}}return r.pathname&&(i.$prev_pageview_pathname=r.pathname),r.timestamp&&(i.$prev_pageview_duration=(t.getTime()-r.timestamp.getTime())/1e3),i}}class YY{constructor(t){this.instance=t}sendExceptionEvent(t){this.instance.capture("$exception",t,{_noTruncate:!0,_batchKey:"exceptionEvent"})}}var wi="Mobile",xg="iOS",go="Android",Pf="Tablet",WM=go+" "+Pf,KM="iPad",QM="Apple",XM=QM+" Watch",Bf="Safari",mu="BlackBerry",JM="Samsung",e3=JM+"Browser",t3=JM+" Internet",Vs="Chrome",WY=Vs+" OS",n3=Vs+" "+xg,fS="Internet Explorer",r3=fS+" "+wi,dS="Opera",KY=dS+" Mini",hS="Edge",i3="Microsoft "+hS,vu="Firefox",o3=vu+" "+xg,Ff="Nintendo",Uf="PlayStation",yu="Xbox",a3=go+" "+wi,s3=wi+" "+Bf,zf="Windows",pS=zf+" Phone",l3="Nokia",gS="Ouya",u3="Generic",QY=u3+" "+wi.toLowerCase(),c3=u3+" "+Pf.toLowerCase(),mS="Konqueror",$r="(\\d+(\\.\\d+)?)",vS=new RegExp("Version/"+$r),XY=new RegExp(yu,"i"),JY=new RegExp(Uf+" \\w+","i"),eW=new RegExp(Ff+" \\w+","i"),yS=new RegExp(mu+"|PlayBook|BB10","i"),tW={"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"},_S,nW=(e,t)=>t&&kt(t,QM)||function(n){return kt(n,Bf)&&!kt(n,Vs)&&!kt(n,go)}(e),f3=function(e,t){return t=t||"",kt(e," OPR/")&&kt(e,"Mini")?KY:kt(e," OPR/")?dS:yS.test(e)?mu:kt(e,"IE"+wi)||kt(e,"WPDesktop")?r3:kt(e,e3)?t3:kt(e,hS)||kt(e,"Edg/")?i3:kt(e,"FBIOS")?"Facebook "+wi:kt(e,"UCWEB")||kt(e,"UCBrowser")?"UC Browser":kt(e,"CriOS")?n3:kt(e,"CrMo")||kt(e,Vs)?Vs:kt(e,go)&&kt(e,Bf)?a3:kt(e,"FxiOS")?o3:kt(e.toLowerCase(),mS.toLowerCase())?mS:nW(e,t)?kt(e,wi)?s3:Bf:kt(e,vu)?vu:kt(e,"MSIE")||kt(e,"Trident/")?fS:kt(e,"Gecko")?vu:""},rW={[r3]:[new RegExp("rv:"+$r)],[i3]:[new RegExp(hS+"?\\/"+$r)],[Vs]:[new RegExp("("+Vs+"|CrMo)\\/"+$r)],[n3]:[new RegExp("CriOS\\/"+$r)],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/"+$r)],[Bf]:[vS],[s3]:[vS],[dS]:[new RegExp("(Opera|OPR)\\/"+$r)],[vu]:[new RegExp(vu+"\\/"+$r)],[o3]:[new RegExp("FxiOS\\/"+$r)],[mS]:[new RegExp("Konqueror[:/]?"+$r,"i")],[mu]:[new RegExp(mu+" "+$r),vS],[a3]:[new RegExp("android\\s"+$r,"i")],[t3]:[new RegExp(e3+"\\/"+$r)],[fS]:[new RegExp("(rv:|MSIE )"+$r)],Mozilla:[new RegExp("rv:"+$r)]},d3=[[new RegExp(yu+"; "+yu+" (.*?)[);]","i"),e=>[yu,e&&e[1]||""]],[new RegExp(Ff,"i"),[Ff,""]],[new RegExp(Uf,"i"),[Uf,""]],[yS,[mu,""]],[new RegExp(zf,"i"),(e,t)=>{if(/Phone/.test(t)||/WPDesktop/.test(t))return[pS,""];if(new RegExp(wi).test(t)&&!/IEMobile\b/.test(t))return[zf+" "+wi,""];var n=/Windows NT ([0-9.]+)/i.exec(t);if(n&&n[1]){var r=n[1],i=tW[r]||"";return/arm/i.test(t)&&(i="RT"),[zf,i]}return[zf,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,e=>{if(e&&e[3]){var t=[e[3],e[4],e[5]||"0"];return[xg,t.join(".")]}return[xg,""]}],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,e=>{var t="";return e&&e.length>=3&&(t=Be(e[2])?e[3]:e[2]),["watchOS",t]}],[new RegExp("("+go+" (\\d+)\\.(\\d+)\\.?(\\d+)?|"+go+")","i"),e=>{if(e&&e[2]){var t=[e[2],e[3],e[4]||"0"];return[go,t.join(".")]}return[go,""]}],[/Mac OS X (\d+)[_.](\d+)[_.]?(\d+)?/i,e=>{var t=["Mac OS X",""];if(e&&e[1]){var n=[e[1],e[2],e[3]||"0"];t[1]=n.join(".")}return t}],[/Mac/i,["Mac OS X",""]],[/CrOS/,[WY,""]],[/Linux|debian/i,["Linux",""]]],h3=function(e){return eW.test(e)?Ff:JY.test(e)?Uf:XY.test(e)?yu:new RegExp(gS,"i").test(e)?gS:new RegExp("("+pS+"|WPDesktop)","i").test(e)?pS:/iPad/.test(e)?KM:/iPod/.test(e)?"iPod Touch":/iPhone/.test(e)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(e)?XM:yS.test(e)?mu:/(kobo)\s(ereader|touch)/i.test(e)?"Kobo":new RegExp(l3,"i").test(e)?l3:/(kf[a-z]{2}wi|aeo[c-r]{2})( bui|\))/i.test(e)||/(kf[a-z]+)( bui|\)).+silk\//i.test(e)?"Kindle Fire":/(Android|ZTE)/i.test(e)?!new RegExp(wi).test(e)||/(9138B|TB782B|Nexus [97]|pixel c|HUAWEISHT|BTV|noble nook|smart ultra 6)/i.test(e)?/pixel[\daxl ]{1,6}/i.test(e)&&!/pixel c/i.test(e)||/(huaweimed-al00|tah-|APA|SM-G92|i980|zte|U304AA)/i.test(e)||/lmy47v/i.test(e)&&!/QTAQZ3/i.test(e)?go:WM:go:new RegExp("(pda|"+wi+")","i").test(e)?QY:new RegExp(Pf,"i").test(e)&&!new RegExp(Pf+" pc","i").test(e)?c3:""},Cg="https?://(.*)",Eg=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","irclid","_kx"],iW=tg(["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid"],Eg),bS="<masked>",Sn={campaignParams:function(){var{customTrackedParams:e,maskPersonalDataProperties:t,customPersonalDataProperties:n}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!He)return{};var r=t?tg([],Eg,n||[]):[];return this._campaignParamsFromUrl(H1(He.URL,r,bS),e)},_campaignParamsFromUrl:function(e,t){var n=iW.concat(t||[]),r={};return rn(n,function(i){var o=fg(e,i);r[i]=o||null}),r},_searchEngine:function(e){return e?e.search(Cg+"google.([^/?]*)")===0?"google":e.search(Cg+"bing.com")===0?"bing":e.search(Cg+"yahoo.com")===0?"yahoo":e.search(Cg+"duckduckgo.com")===0?"duckduckgo":null:null},_searchInfoFromReferrer:function(e){var t=Sn._searchEngine(e),n=t!="yahoo"?"q":"p",r={};if(!ja(t)){r.$search_engine=t;var i=He?fg(He.referrer,n):"";i.length&&(r.ph_keyword=i)}return r},searchInfo:function(){var e=He==null?void 0:He.referrer;return e?this._searchInfoFromReferrer(e):{}},browser:f3,browserVersion:function(e,t){var n=f3(e,t),r=rW[n];if(Be(r))return null;for(var i=0;i<r.length;i++){var o=r[i],s=e.match(o);if(s)return parseFloat(s[s.length-2])}return null},browserLanguage:function(){return navigator.language||navigator.userLanguage},browserLanguagePrefix:function(){var e=this.browserLanguage();return typeof e=="string"?e.split("-")[0]:void 0},os:function(e){for(var t=0;t<d3.length;t++){var[n,r]=d3[t],i=n.exec(e),o=i&&(Gi(r)?r(i,e):r);if(o)return o}return["",""]},device:h3,deviceType:function(e){var t=h3(e);return t===KM||t===WM||t==="Kobo"||t==="Kindle Fire"||t===c3?Pf:t===Ff||t===yu||t===Uf||t===gS?"Console":t===XM?"Wearable":t?wi:"Desktop"},referrer:function(){return(He==null?void 0:He.referrer)||"$direct"},referringDomain:function(){var e;return He!=null&&He.referrer&&((e=hu(He.referrer))===null||e===void 0?void 0:e.host)||"$direct"},referrerInfo:function(){return{$referrer:this.referrer(),$referring_domain:this.referringDomain()}},personInfo:function(){var{maskPersonalDataProperties:e,customPersonalDataProperties:t}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=e?tg([],Eg,t||[]):[],r=Hr==null?void 0:Hr.href.substring(0,1e3);return{r:this.referrer().substring(0,1e3),u:r?H1(r,n,bS):void 0}},personPropsFromInfo:function(e){var t,{r:n,u:r}=e,i={$referrer:n,$referring_domain:n==null?void 0:n=="$direct"?"$direct":(t=hu(n))===null||t===void 0?void 0:t.host};if(r){i.$current_url=r;var o=hu(r);i.$host=o==null?void 0:o.host,i.$pathname=o==null?void 0:o.pathname;var s=this._campaignParamsFromUrl(r);Hn(i,s)}if(n){var u=this._searchInfoFromReferrer(n);Hn(i,u)}return i},initialPersonPropsFromInfo:function(e){var t=this.personPropsFromInfo(e),n={};return rn(t,function(r,i){n["$initial_".concat(I1(i))]=r}),n},timezone:function(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch{return}},timezoneOffset:function(){try{return new Date().getTimezoneOffset()}catch{return}},properties:function(){var{maskPersonalDataProperties:e,customPersonalDataProperties:t}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!qn)return{};var n=e?tg([],Eg,t||[]):[],[r,i]=Sn.os(qn);return Hn(Af({$os:r,$os_version:i,$browser:Sn.browser(qn,navigator.vendor),$device:Sn.device(qn),$device_type:Sn.deviceType(qn),$timezone:Sn.timezone(),$timezone_offset:Sn.timezoneOffset()}),{$current_url:H1(Hr==null?void 0:Hr.href,n,bS),$host:Hr==null?void 0:Hr.host,$pathname:Hr==null?void 0:Hr.pathname,$raw_user_agent:qn.length>1e3?qn.substring(0,997)+"...":qn,$browser_version:Sn.browserVersion(qn,navigator.vendor),$browser_language:Sn.browserLanguage(),$browser_language_prefix:Sn.browserLanguagePrefix(),$screen_height:ce==null?void 0:ce.screen.height,$screen_width:ce==null?void 0:ce.screen.width,$viewport_height:ce==null?void 0:ce.innerHeight,$viewport_width:ce==null?void 0:ce.innerWidth,$lib:"web",$lib_version:Qo.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(!qn)return{};var[e,t]=Sn.os(qn);return Hn(Af({$os:e,$os_version:t,$browser:Sn.browser(qn,navigator.vendor)}),{$browser_version:Sn.browserVersion(qn,navigator.vendor)})}},mo=kr("[FeatureFlags]"),SS="$active_feature_flags",_u="$override_feature_flags",p3="$feature_flag_payloads",qf="$override_feature_flag_payloads",g3="$feature_flag_request_id",m3=e=>{var t={};for(var[n,r]of ng(e||{}))r&&(t[n]=r);return t},oW=e=>{var t=e.flags;return t?(e.featureFlags=Object.fromEntries(Object.keys(t).map(n=>{var r;return[n,(r=t[n].variant)!==null&&r!==void 0?r:t[n].enabled]})),e.featureFlagPayloads=Object.fromEntries(Object.keys(t).filter(n=>t[n].enabled).filter(n=>{var r;return(r=t[n].metadata)===null||r===void 0?void 0:r.payload}).map(n=>{var r;return[n,(r=t[n].metadata)===null||r===void 0?void 0:r.payload]}))):mo.warn("Using an older version of the feature flags endpoint. Please upgrade your PostHog server to the latest version"),e};(function(e){e.FeatureFlags="feature_flags",e.Recordings="recordings"})(_S||(_S={}));class aW{constructor(t){Me(this,"_override_warning",!1),Me(this,"_hasLoadedFlags",!1),Me(this,"_requestInFlight",!1),Me(this,"_reloadingDisabled",!1),Me(this,"_additionalReloadRequested",!1),Me(this,"_decideCalled",!1),Me(this,"_flagsLoadedFromRemote",!1),this.instance=t,this.featureFlagEventHandlers=[]}decide(){if(this.instance.config.__preview_remote_config)this._decideCalled=!0;else{var t=!this._reloadDebouncer&&(this.instance.config.advanced_disable_feature_flags||this.instance.config.advanced_disable_feature_flags_on_first_load);this._callDecideEndpoint({disableFlags:t})}}get hasLoadedFlags(){return this._hasLoadedFlags}getFlags(){return Object.keys(this.getFlagVariants())}getFlagsWithDetails(){var t=this.instance.get_property($1),n=this.instance.get_property(_u),r=this.instance.get_property(qf);if(!r&&!n)return t||{};var i=Hn({},t||{}),o=[...new Set([...Object.keys(r||{}),...Object.keys(n||{})])];for(var s of o){var u,c,d=i[s],p=n==null?void 0:n[s],h=Be(p)?(u=d==null?void 0:d.enabled)!==null&&u!==void 0&&u:!!p,m=Be(p)?d.variant:typeof p=="string"?p:void 0,v=r==null?void 0:r[s],_=pe(pe({},d),{},{enabled:h,variant:h?m??(d==null?void 0:d.variant):void 0});h!==(d==null?void 0:d.enabled)&&(_.original_enabled=d==null?void 0:d.enabled),m!==(d==null?void 0:d.variant)&&(_.original_variant=d==null?void 0:d.variant),v&&(_.metadata=pe(pe({},d==null?void 0:d.metadata),{},{payload:v,original_payload:d==null||(c=d.metadata)===null||c===void 0?void 0:c.payload})),i[s]=_}return this._override_warning||(mo.warn(" Overriding feature flag details!",{flagDetails:t,overriddenPayloads:r,finalDetails:i}),this._override_warning=!0),i}getFlagVariants(){var t=this.instance.get_property(fu),n=this.instance.get_property(_u);if(!n)return t||{};for(var r=Hn({},t),i=Object.keys(n),o=0;o<i.length;o++)r[i[o]]=n[i[o]];return this._override_warning||(mo.warn(" Overriding feature flags!",{enabledFlags:t,overriddenFlags:n,finalFlags:r}),this._override_warning=!0),r}getFlagPayloads(){var t=this.instance.get_property(p3),n=this.instance.get_property(qf);if(!n)return t||{};for(var r=Hn({},t||{}),i=Object.keys(n),o=0;o<i.length;o++)r[i[o]]=n[i[o]];return this._override_warning||(mo.warn(" Overriding feature flag payloads!",{flagPayloads:t,overriddenPayloads:n,finalPayloads:r}),this._override_warning=!0),r}reloadFeatureFlags(){this._reloadingDisabled||this.instance.config.advanced_disable_feature_flags||this._reloadDebouncer||(this._reloadDebouncer=setTimeout(()=>{this._callDecideEndpoint()},5))}clearDebouncer(){clearTimeout(this._reloadDebouncer),this._reloadDebouncer=void 0}ensureFlagsLoaded(){this._hasLoadedFlags||this._requestInFlight||this._reloadDebouncer||this.reloadFeatureFlags()}setAnonymousDistinctId(t){this.$anon_distinct_id=t}setReloadingPaused(t){this._reloadingDisabled=t}_callDecideEndpoint(t){var n;if(this.clearDebouncer(),!this.instance.config.advanced_disable_decide)if(this._requestInFlight)this._additionalReloadRequested=!0;else{var r={token:this.instance.config.token,distinct_id:this.instance.get_distinct_id(),groups:this.instance.getGroups(),$anon_distinct_id:this.$anon_distinct_id,person_properties:pe(pe({},((n=this.instance.persistence)===null||n===void 0?void 0:n.get_initial_props())||{}),this.instance.get_property(Tf)||{}),group_properties:this.instance.get_property(zs)};(t!=null&&t.disableFlags||this.instance.config.advanced_disable_feature_flags)&&(r.disable_flags=!0);var i=this.instance.config.__preview_flags_v2&&this.instance.config.__preview_remote_config;i&&(r.timezone=Sn.timezone()),this._requestInFlight=!0,this.instance._send_request({method:"POST",url:this.instance.requestRouter.endpointFor("api",i?"/flags/?v=2":"/decide/?v=4"),data:r,compression:this.instance.config.disable_compression?void 0:Hi.Base64,timeout:this.instance.config.feature_flag_request_timeout_ms,callback:o=>{var s,u,c,d=!0;o.statusCode===200&&(this._additionalReloadRequested||(this.$anon_distinct_id=void 0),d=!1),this._requestInFlight=!1,this._decideCalled||(this._decideCalled=!0,this.instance._onRemoteConfig((c=o.json)!==null&&c!==void 0?c:{})),r.disable_flags&&!this._additionalReloadRequested||(this._flagsLoadedFromRemote=!d,o.json&&(s=o.json.quotaLimited)!==null&&s!==void 0&&s.includes(_S.FeatureFlags)?mo.warn("You have hit your feature flags quota limit, and will not be able to load feature flags until the quota is reset. Please visit https://posthog.com/docs/billing/limits-alerts to learn more."):(this.receivedFeatureFlags((u=o.json)!==null&&u!==void 0?u:{},d),this._additionalReloadRequested&&(this._additionalReloadRequested=!1,this._callDecideEndpoint())))}})}}getFeatureFlag(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(this._hasLoadedFlags||this.getFlags()&&this.getFlags().length>0){var r=this.getFlagVariants()[t],i="".concat(r),o=this.instance.get_property(g3)||void 0,s=this.instance.get_property(ag)||{};if((n.send_event||!("send_event"in n))&&(!(t in s)||!s[t].includes(i))){var u,c,d,p,h,m,v,_,x,b,w;kn(s[t])?s[t].push(i):s[t]=[i],(u=this.instance.persistence)===null||u===void 0||u.register({[ag]:s});var C=this.getFeatureFlagDetails(t),E={$feature_flag:t,$feature_flag_response:r,$feature_flag_payload:this.getFeatureFlagPayload(t)||null,$feature_flag_request_id:o,$feature_flag_bootstrapped_response:((c=this.instance.config.bootstrap)===null||c===void 0||(d=c.featureFlags)===null||d===void 0?void 0:d[t])||null,$feature_flag_bootstrapped_payload:((p=this.instance.config.bootstrap)===null||p===void 0||(h=p.featureFlagPayloads)===null||h===void 0?void 0:h[t])||null,$used_bootstrap_value:!this._flagsLoadedFromRemote};Be(C==null||(m=C.metadata)===null||m===void 0?void 0:m.version)||(E.$feature_flag_version=C.metadata.version);var R,O=(v=C==null||(_=C.reason)===null||_===void 0?void 0:_.description)!==null&&v!==void 0?v:C==null||(x=C.reason)===null||x===void 0?void 0:x.code;O&&(E.$feature_flag_reason=O),C!=null&&(b=C.metadata)!==null&&b!==void 0&&b.id&&(E.$feature_flag_id=C.metadata.id),Be(C==null?void 0:C.original_variant)&&Be(C==null?void 0:C.original_enabled)||(E.$feature_flag_original_response=Be(C.original_variant)?C.original_enabled:C.original_variant),C!=null&&(w=C.metadata)!==null&&w!==void 0&&w.original_payload&&(E.$feature_flag_original_payload=C==null||(R=C.metadata)===null||R===void 0?void 0:R.original_payload),this.instance.capture("$feature_flag_called",E)}return r}mo.warn('getFeatureFlag for key "'+t+`" failed. Feature flags didn't load in time.`)}getFeatureFlagDetails(t){return this.getFlagsWithDetails()[t]}getFeatureFlagPayload(t){return this.getFlagPayloads()[t]}getRemoteConfigPayload(t,n){var r=this.instance.config.token;this.instance._send_request({method:"POST",url:this.instance.requestRouter.endpointFor("api","/decide/?v=4"),data:{distinct_id:this.instance.get_distinct_id(),token:r},compression:this.instance.config.disable_compression?void 0:Hi.Base64,timeout:this.instance.config.feature_flag_request_timeout_ms,callback:i=>{var o,s=(o=i.json)===null||o===void 0?void 0:o.featureFlagPayloads;n((s==null?void 0:s[t])||void 0)}})}isFeatureEnabled(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(this._hasLoadedFlags||this.getFlags()&&this.getFlags().length>0)return!!this.getFeatureFlag(t,n);mo.warn('isFeatureEnabled for key "'+t+`" failed. Feature flags didn't load in time.`)}addFeatureFlagsHandler(t){this.featureFlagEventHandlers.push(t)}removeFeatureFlagsHandler(t){this.featureFlagEventHandlers=this.featureFlagEventHandlers.filter(n=>n!==t)}receivedFeatureFlags(t,n){if(this.instance.persistence){this._hasLoadedFlags=!0;var r=this.getFlagVariants(),i=this.getFlagPayloads(),o=this.getFlagsWithDetails();(function(s,u){var c=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},d=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{},p=arguments.length>4&&arguments[4]!==void 0?arguments[4]:{},h=oW(s),m=h.flags,v=h.featureFlags,_=h.featureFlagPayloads;if(v){var x=s.requestId;if(kn(v)){mo.warn("v1 of the feature flags endpoint is deprecated. Please use the latest version.");var b={};if(v)for(var w=0;w<v.length;w++)b[v[w]]=!0;u&&u.register({[SS]:v,[fu]:b})}else{var C=v,E=_,R=m;s.errorsWhileComputingFlags&&(C=pe(pe({},c),C),E=pe(pe({},d),E),R=pe(pe({},p),R)),u&&u.register(pe({[SS]:Object.keys(m3(C)),[fu]:C||{},[p3]:E||{},[$1]:R||{}},x?{[g3]:x}:{}))}}})(t,this.instance.persistence,r,i,o),this._fireFeatureFlagsCallbacks(n)}}override(t){var n=arguments.length>1&&arguments[1]!==void 0&&arguments[1];mo.warn("override is deprecated. Please use overrideFeatureFlags instead."),this.overrideFeatureFlags({flags:t,suppressWarning:n})}overrideFeatureFlags(t){if(!this.instance.__loaded||!this.instance.persistence)return mo.uninitializedWarning("posthog.featureFlags.overrideFeatureFlags");if(t===!1)return this.instance.persistence.unregister(_u),this.instance.persistence.unregister(qf),void this._fireFeatureFlagsCallbacks();if(t&&typeof t=="object"&&("flags"in t||"payloads"in t)){var n,r=t;if(this._override_warning=!!((n=r.suppressWarning)!==null&&n!==void 0&&n),"flags"in r){if(r.flags===!1)this.instance.persistence.unregister(_u);else if(r.flags)if(kn(r.flags)){for(var i={},o=0;o<r.flags.length;o++)i[r.flags[o]]=!0;this.instance.persistence.register({[_u]:i})}else this.instance.persistence.register({[_u]:r.flags})}return"payloads"in r&&(r.payloads===!1?this.instance.persistence.unregister(qf):r.payloads&&this.instance.persistence.register({[qf]:r.payloads})),void this._fireFeatureFlagsCallbacks()}this._fireFeatureFlagsCallbacks()}onFeatureFlags(t){if(this.addFeatureFlagsHandler(t),this._hasLoadedFlags){var{flags:n,flagVariants:r}=this._prepareFeatureFlagsForCallbacks();t(n,r)}return()=>this.removeFeatureFlagsHandler(t)}updateEarlyAccessFeatureEnrollment(t,n){var r,i=(this.instance.get_property(ig)||[]).find(c=>c.flagKey===t),o={["$feature_enrollment/".concat(t)]:n},s={$feature_flag:t,$feature_enrollment:n,$set:o};i&&(s.$early_access_feature_name=i.name),this.instance.capture("$feature_enrollment_update",s),this.setPersonPropertiesForFlags(o,!1);var u=pe(pe({},this.getFlagVariants()),{},{[t]:n});(r=this.instance.persistence)===null||r===void 0||r.register({[SS]:Object.keys(m3(u)),[fu]:u}),this._fireFeatureFlagsCallbacks()}getEarlyAccessFeatures(t){var n=arguments.length>1&&arguments[1]!==void 0&&arguments[1],r=arguments.length>2?arguments[2]:void 0,i=this.instance.get_property(ig),o=r?"&".concat(r.map(s=>"stage=".concat(s)).join("&")):"";if(i&&!n)return t(i);this.instance._send_request({url:this.instance.requestRouter.endpointFor("api","/api/early_access_features/?token=".concat(this.instance.config.token).concat(o)),method:"GET",callback:s=>{var u;if(s.json){var c=s.json.earlyAccessFeatures;return(u=this.instance.persistence)===null||u===void 0||u.register({[ig]:c}),t(c)}}})}_prepareFeatureFlagsForCallbacks(){var t=this.getFlags(),n=this.getFlagVariants();return{flags:t.filter(r=>n[r]),flagVariants:Object.keys(n).filter(r=>n[r]).reduce((r,i)=>(r[i]=n[i],r),{})}}_fireFeatureFlagsCallbacks(t){var{flags:n,flagVariants:r}=this._prepareFeatureFlagsForCallbacks();this.featureFlagEventHandlers.forEach(i=>i(n,r,{errorsLoading:t}))}setPersonPropertiesForFlags(t){var n=!(arguments.length>1&&arguments[1]!==void 0)||arguments[1],r=this.instance.get_property(Tf)||{};this.instance.register({[Tf]:pe(pe({},r),t)}),n&&this.instance.reloadFeatureFlags()}resetPersonPropertiesForFlags(){this.instance.unregister(Tf)}setGroupPropertiesForFlags(t){var n=!(arguments.length>1&&arguments[1]!==void 0)||arguments[1],r=this.instance.get_property(zs)||{};Object.keys(r).length!==0&&Object.keys(r).forEach(i=>{r[i]=pe(pe({},r[i]),t[i]),delete t[i]}),this.instance.register({[zs]:pe(pe({},r),t)}),n&&this.instance.reloadFeatureFlags()}resetGroupPropertiesForFlags(t){if(t){var n=this.instance.get_property(zs)||{};this.instance.register({[zs]:pe(pe({},n),{},{[t]:{}})})}else this.instance.unregister(zs)}}var sW=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"];class wS{constructor(t){this.config=t,this.props={},this.campaign_params_saved=!1,this.name=(n=>{var r="";return n.token&&(r=n.token.replace(/\+/g,"PL").replace(/\//g,"SL").replace(/=/g,"EQ")),n.persistence_name?"ph_"+n.persistence_name:"ph_"+r+"_posthog"})(t),this.storage=this.buildStorage(t),this.load(),t.debug&&Qe.info("Persistence loaded",t.persistence,pe({},this.props)),this.update_config(t,t),this.save()}buildStorage(t){sW.indexOf(t.persistence.toLowerCase())===-1&&(Qe.critical("Unknown persistence type "+t.persistence+"; falling back to localStorage+cookie"),t.persistence="localStorage+cookie");var n=t.persistence.toLowerCase();return n==="localstorage"&&Qn.is_supported()?Qn:n==="localstorage+cookie"&&pg.is_supported()?pg:n==="sessionstorage"&&fr.is_supported()?fr:n==="memory"?rY:n==="cookie"?Jo:pg.is_supported()?pg:Jo}properties(){var t={};return rn(this.props,function(n,r){if(r===fu&&An(n))for(var i=Object.keys(n),o=0;o<i.length;o++)t["$feature/".concat(i[o])]=n[i[o]];else u=r,c=!1,(ja(s=NZ)?c:TT&&s.indexOf===TT?s.indexOf(u)!=-1:(rn(s,function(d){if(c||(c=d===u))return eg}),c))||(t[r]=n);var s,u,c}),t}load(){if(!this.disabled){var t=this.storage.parse(this.name);t&&(this.props=Hn({},t))}}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(t,n,r){if(An(t)){Be(n)&&(n="None"),this.expire_days=Be(r)?this.default_expiry:r;var i=!1;if(rn(t,(o,s)=>{this.props.hasOwnProperty(s)&&this.props[s]!==n||(this.props[s]=o,i=!0)}),i)return this.save(),!0}return!1}register(t,n){if(An(t)){this.expire_days=Be(n)?this.default_expiry:n;var r=!1;if(rn(t,(i,o)=>{t.hasOwnProperty(o)&&this.props[o]!==i&&(this.props[o]=i,r=!0)}),r)return this.save(),!0}return!1}unregister(t){t in this.props&&(delete this.props[t],this.save())}update_campaign_params(){if(!this.campaign_params_saved){var t=Sn.campaignParams({customTrackedParams:this.config.custom_campaign_params,maskPersonalDataProperties:this.config.mask_personal_data_properties,customPersonalDataProperties:this.config.custom_personal_data_properties});cu(Af(t))||this.register(t),this.campaign_params_saved=!0}}update_search_keyword(){this.register(Sn.searchInfo())}update_referrer_info(){this.register_once(Sn.referrerInfo(),void 0)}set_initial_person_info(){this.props[B1]||this.props[F1]||this.register_once({[U1]:Sn.personInfo({maskPersonalDataProperties:this.config.mask_personal_data_properties,customPersonalDataProperties:this.config.custom_personal_data_properties})},void 0)}get_referrer_info(){return Af({$referrer:this.props.$referrer,$referring_domain:this.props.$referring_domain})}get_initial_props(){var t={};rn([F1,B1],i=>{var o=this.props[i];o&&rn(o,function(s,u){t["$initial_"+I1(u)]=s})});var n=this.props[U1];if(n){var r=Sn.initialPersonPropsFromInfo(n);Hn(t,r)}return t}safe_merge(t){return rn(this.props,function(n,r){r in t||(t[r]=n)}),t}update_config(t,n){if(this.default_expiry=this.expire_days=t.cookie_expiration,this.set_disabled(t.disable_persistence),this.set_cross_subdomain(t.cross_subdomain_cookie),this.set_secure(t.secure_cookie),t.persistence!==n.persistence){var r=this.buildStorage(t),i=this.props;this.clear(),this.storage=r,this.props=i,this.save()}}set_disabled(t){this.disabled=t,this.disabled?this.remove():this.save()}set_cross_subdomain(t){t!==this.cross_subdomain&&(this.cross_subdomain=t,this.remove(),this.save())}get_cross_subdomain(){return!!this.cross_subdomain}set_secure(t){t!==this.secure&&(this.secure=t,this.remove(),this.save())}set_event_timer(t,n){var r=this.props[Rf]||{};r[t]=n,this.props[Rf]=r,this.save()}remove_event_timer(t){var n=(this.props[Rf]||{})[t];return Be(n)||(delete this.props[Rf][t],this.save()),n}get_property(t){return this.props[t]}set_property(t,n){this.props[t]=n,this.save()}}var v3,In,y3,Zs,_3,b3,xS,S3,w3,x3,C3,E3,k3,CS={},A3=[],lW=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,ES=Array.isArray;function Ka(e,t){for(var n in t)e[n]=t[n];return e}function I3(e){var t=e.parentNode;t&&t.removeChild(e)}function kS(e,t,n,r,i){var o={type:e,props:t,key:n,ref:r,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,constructor:void 0,__v:i??++y3,__i:-1,__u:0};return i==null&&In.vnode!=null&&In.vnode(o),o}function AS(e){return e.children}function kg(e,t){this.props=e,this.context=t}function bu(e,t){if(t==null)return e.__?bu(e.__,e.__i+1):null;for(var n;t<e.__k.length;t++)if((n=e.__k[t])!=null&&n.__e!=null)return n.__e;return typeof e.type=="function"?bu(e):null}function R3(e){var t,n;if((e=e.__)!=null&&e.__c!=null){for(e.__e=e.__c.base=null,t=0;t<e.__k.length;t++)if((n=e.__k[t])!=null&&n.__e!=null){e.__e=e.__c.base=n.__e;break}return R3(e)}}function IS(e){(!e.__d&&(e.__d=!0)&&Zs.push(e)&&!Ag.__r++||_3!==In.debounceRendering)&&((_3=In.debounceRendering)||b3)(Ag)}function Ag(){var e,t,n,r,i,o,s,u,c;for(Zs.sort(xS);e=Zs.shift();)e.__d&&(t=Zs.length,r=void 0,o=(i=(n=e).__v).__e,u=[],c=[],(s=n.__P)&&((r=Ka({},i)).__v=i.__v+1,In.vnode&&In.vnode(r),L3(s,r,i,n.__n,s.ownerSVGElement!==void 0,32&i.__u?[o]:null,u,o??bu(i),!!(32&i.__u),c),r.__.__k[r.__i]=r,fW(u,r,c),r.__e!=o&&R3(r)),Zs.length>t&&Zs.sort(xS));Ag.__r=0}function O3(e,t,n,r,i,o,s,u,c,d,p){var h,m,v,_,x,b=r&&r.__k||A3,w=t.length;for(n.__d=c,uW(n,t,b),c=n.__d,h=0;h<w;h++)(v=n.__k[h])!=null&&typeof v!="boolean"&&typeof v!="function"&&(m=v.__i===-1?CS:b[v.__i]||CS,v.__i=h,L3(e,v,m,i,o,s,u,c,d,p),_=v.__e,v.ref&&m.ref!=v.ref&&(m.ref&&RS(m.ref,null,v),p.push(v.ref,v.__c||_,v)),x==null&&_!=null&&(x=_),65536&v.__u||m.__k===v.__k?c=T3(v,c,e):typeof v.type=="function"&&v.__d!==void 0?c=v.__d:_&&(c=_.nextSibling),v.__d=void 0,v.__u&=-196609);n.__d=c,n.__e=x}function uW(e,t,n){var r,i,o,s,u,c=t.length,d=n.length,p=d,h=0;for(e.__k=[],r=0;r<c;r++)(i=e.__k[r]=(i=t[r])==null||typeof i=="boolean"||typeof i=="function"?null:typeof i=="string"||typeof i=="number"||typeof i=="bigint"||i.constructor==String?kS(null,i,null,null,i):ES(i)?kS(AS,{children:i},null,null,null):i.constructor===void 0&&i.__b>0?kS(i.type,i.props,i.key,i.ref?i.ref:null,i.__v):i)!=null?(i.__=e,i.__b=e.__b+1,u=cW(i,n,s=r+h,p),i.__i=u,o=null,u!==-1&&(p--,(o=n[u])&&(o.__u|=131072)),o==null||o.__v===null?(u==-1&&h--,typeof i.type!="function"&&(i.__u|=65536)):u!==s&&(u===s+1?h++:u>s?p>c-s?h+=u-s:h--:h=u<s&&u==s-1?u-s:0,u!==r+h&&(i.__u|=65536))):(o=n[r])&&o.key==null&&o.__e&&(o.__e==e.__d&&(e.__d=bu(o)),OS(o,o,!1),n[r]=null,p--);if(p)for(r=0;r<d;r++)(o=n[r])!=null&&(131072&o.__u)==0&&(o.__e==e.__d&&(e.__d=bu(o)),OS(o,o))}function T3(e,t,n){var r,i;if(typeof e.type=="function"){for(r=e.__k,i=0;r&&i<r.length;i++)r[i]&&(r[i].__=e,t=T3(r[i],t,n));return t}return e.__e!=t&&(n.insertBefore(e.__e,t||null),t=e.__e),t&&t.nextSibling}function cW(e,t,n,r){var i=e.key,o=e.type,s=n-1,u=n+1,c=t[n];if(c===null||c&&i==c.key&&o===c.type)return n;if(r>(c!=null&&(131072&c.__u)==0?1:0))for(;s>=0||u<t.length;){if(s>=0){if((c=t[s])&&(131072&c.__u)==0&&i==c.key&&o===c.type)return s;s--}if(u<t.length){if((c=t[u])&&(131072&c.__u)==0&&i==c.key&&o===c.type)return u;u++}}return-1}function M3(e,t,n){t[0]==="-"?e.setProperty(t,n??""):e[t]=n==null?"":typeof n!="number"||lW.test(t)?n:n+"px"}function Ig(e,t,n,r,i){var o;e:if(t==="style")if(typeof n=="string")e.style.cssText=n;else{if(typeof r=="string"&&(e.style.cssText=r=""),r)for(t in r)n&&t in n||M3(e.style,t,"");if(n)for(t in n)r&&n[t]===r[t]||M3(e.style,t,n[t])}else if(t[0]==="o"&&t[1]==="n")o=t!==(t=t.replace(/(PointerCapture)$|Capture$/,"$1")),t=t.toLowerCase()in e?t.toLowerCase().slice(2):t.slice(2),e.l||(e.l={}),e.l[t+o]=n,n?r?n.u=r.u:(n.u=Date.now(),e.addEventListener(t,o?$3:D3,o)):e.removeEventListener(t,o?$3:D3,o);else{if(i)t=t.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(t!=="width"&&t!=="height"&&t!=="href"&&t!=="list"&&t!=="form"&&t!=="tabIndex"&&t!=="download"&&t!=="rowSpan"&&t!=="colSpan"&&t!=="role"&&t in e)try{e[t]=n??"";break e}catch{}typeof n=="function"||(n==null||n===!1&&t[4]!=="-"?e.removeAttribute(t):e.setAttribute(t,n))}}function D3(e){var t=this.l[e.type+!1];if(e.t){if(e.t<=t.u)return}else e.t=Date.now();return t(In.event?In.event(e):e)}function $3(e){return this.l[e.type+!0](In.event?In.event(e):e)}function L3(e,t,n,r,i,o,s,u,c,d){var p,h,m,v,_,x,b,w,C,E,R,O,T,L,B,z=t.type;if(t.constructor!==void 0)return null;128&n.__u&&(c=!!(32&n.__u),o=[u=t.__e=n.__e]),(p=In.__b)&&p(t);e:if(typeof z=="function")try{if(w=t.props,C=(p=z.contextType)&&r[p.__c],E=p?C?C.props.value:p.__:r,n.__c?b=(h=t.__c=n.__c).__=h.__E:("prototype"in z&&z.prototype.render?t.__c=h=new z(w,E):(t.__c=h=new kg(w,E),h.constructor=z,h.render=hW),C&&C.sub(h),h.props=w,h.state||(h.state={}),h.context=E,h.__n=r,m=h.__d=!0,h.__h=[],h._sb=[]),h.__s==null&&(h.__s=h.state),z.getDerivedStateFromProps!=null&&(h.__s==h.state&&(h.__s=Ka({},h.__s)),Ka(h.__s,z.getDerivedStateFromProps(w,h.__s))),v=h.props,_=h.state,h.__v=t,m)z.getDerivedStateFromProps==null&&h.componentWillMount!=null&&h.componentWillMount(),h.componentDidMount!=null&&h.__h.push(h.componentDidMount);else{if(z.getDerivedStateFromProps==null&&w!==v&&h.componentWillReceiveProps!=null&&h.componentWillReceiveProps(w,E),!h.__e&&(h.shouldComponentUpdate!=null&&h.shouldComponentUpdate(w,h.__s,E)===!1||t.__v===n.__v)){for(t.__v!==n.__v&&(h.props=w,h.state=h.__s,h.__d=!1),t.__e=n.__e,t.__k=n.__k,t.__k.forEach(function(P){P&&(P.__=t)}),R=0;R<h._sb.length;R++)h.__h.push(h._sb[R]);h._sb=[],h.__h.length&&s.push(h);break e}h.componentWillUpdate!=null&&h.componentWillUpdate(w,h.__s,E),h.componentDidUpdate!=null&&h.__h.push(function(){h.componentDidUpdate(v,_,x)})}if(h.context=E,h.props=w,h.__P=e,h.__e=!1,O=In.__r,T=0,"prototype"in z&&z.prototype.render){for(h.state=h.__s,h.__d=!1,O&&O(t),p=h.render(h.props,h.state,h.context),L=0;L<h._sb.length;L++)h.__h.push(h._sb[L]);h._sb=[]}else do h.__d=!1,O&&O(t),p=h.render(h.props,h.state,h.context),h.state=h.__s;while(h.__d&&++T<25);h.state=h.__s,h.getChildContext!=null&&(r=Ka(Ka({},r),h.getChildContext())),m||h.getSnapshotBeforeUpdate==null||(x=h.getSnapshotBeforeUpdate(v,_)),O3(e,ES(B=p!=null&&p.type===AS&&p.key==null?p.props.children:p)?B:[B],t,n,r,i,o,s,u,c,d),h.base=t.__e,t.__u&=-161,h.__h.length&&s.push(h),b&&(h.__E=h.__=null)}catch(P){t.__v=null,c||o!=null?(t.__e=u,t.__u|=c?160:32,o[o.indexOf(u)]=null):(t.__e=n.__e,t.__k=n.__k),In.__e(P,t,n)}else o==null&&t.__v===n.__v?(t.__k=n.__k,t.__e=n.__e):t.__e=dW(n.__e,t,n,r,i,o,s,c,d);(p=In.diffed)&&p(t)}function fW(e,t,n){t.__d=void 0;for(var r=0;r<n.length;r++)RS(n[r],n[++r],n[++r]);In.__c&&In.__c(t,e),e.some(function(i){try{e=i.__h,i.__h=[],e.some(function(o){o.call(i)})}catch(o){In.__e(o,i.__v)}})}function dW(e,t,n,r,i,o,s,u,c){var d,p,h,m,v,_,x,b=n.props,w=t.props,C=t.type;if(C==="svg"&&(i=!0),o!=null){for(d=0;d<o.length;d++)if((v=o[d])&&"setAttribute"in v==!!C&&(C?v.localName===C:v.nodeType===3)){e=v,o[d]=null;break}}if(e==null){if(C===null)return document.createTextNode(w);e=i?document.createElementNS("http://www.w3.org/2000/svg",C):document.createElement(C,w.is&&w),o=null,u=!1}if(C===null)b===w||u&&e.data===w||(e.data=w);else{if(o=o&&v3.call(e.childNodes),b=n.props||CS,!u&&o!=null)for(b={},d=0;d<e.attributes.length;d++)b[(v=e.attributes[d]).name]=v.value;for(d in b)v=b[d],d=="children"||(d=="dangerouslySetInnerHTML"?h=v:d==="key"||d in w||Ig(e,d,null,v,i));for(d in w)v=w[d],d=="children"?m=v:d=="dangerouslySetInnerHTML"?p=v:d=="value"?_=v:d=="checked"?x=v:d==="key"||u&&typeof v!="function"||b[d]===v||Ig(e,d,v,b[d],i);if(p)u||h&&(p.__html===h.__html||p.__html===e.innerHTML)||(e.innerHTML=p.__html),t.__k=[];else if(h&&(e.innerHTML=""),O3(e,ES(m)?m:[m],t,n,r,i&&C!=="foreignObject",o,s,o?o[0]:n.__k&&bu(n,0),u,c),o!=null)for(d=o.length;d--;)o[d]!=null&&I3(o[d]);u||(d="value",_!==void 0&&(_!==e[d]||C==="progress"&&!_||C==="option"&&_!==b[d])&&Ig(e,d,_,b[d],!1),d="checked",x!==void 0&&x!==e[d]&&Ig(e,d,x,b[d],!1))}return e}function RS(e,t,n){try{typeof e=="function"?e(t):e.current=t}catch(r){In.__e(r,n)}}function OS(e,t,n){var r,i;if(In.unmount&&In.unmount(e),(r=e.ref)&&(r.current&&r.current!==e.__e||RS(r,null,t)),(r=e.__c)!=null){if(r.componentWillUnmount)try{r.componentWillUnmount()}catch(o){In.__e(o,t)}r.base=r.__P=null,e.__c=void 0}if(r=e.__k)for(i=0;i<r.length;i++)r[i]&&OS(r[i],t,n||typeof e.type!="function");n||e.__e==null||I3(e.__e),e.__=e.__e=e.__d=void 0}function hW(e,t,n){return this.constructor(e,n)}v3=A3.slice,In={__e:function(e,t,n,r){for(var i,o,s;t=t.__;)if((i=t.__c)&&!i.__)try{if((o=i.constructor)&&o.getDerivedStateFromError!=null&&(i.setState(o.getDerivedStateFromError(e)),s=i.__d),i.componentDidCatch!=null&&(i.componentDidCatch(e,r||{}),s=i.__d),s)return i.__E=i}catch(u){e=u}throw e}},y3=0,kg.prototype.setState=function(e,t){var n;n=this.__s!=null&&this.__s!==this.state?this.__s:this.__s=Ka({},this.state),typeof e=="function"&&(e=e(Ka({},n),this.props)),e&&Ka(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),IS(this))},kg.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),IS(this))},kg.prototype.render=AS,Zs=[],b3=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,xS=function(e,t){return e.__v.__b-t.__v.__b},Ag.__r=0,S3=0,function(e){e.Button="button",e.Tab="tab",e.Selector="selector"}(w3||(w3={})),function(e){e.Popover="popover",e.API="api",e.Widget="widget"}(x3||(x3={})),function(e){e.Open="open",e.MultipleChoice="multiple_choice",e.SingleChoice="single_choice",e.Rating="rating",e.Link="link"}(C3||(C3={})),function(e){e.NextQuestion="next_question",e.End="end",e.ResponseBased="response_based",e.SpecificQuestion="specific_question"}(E3||(E3={})),function(e){e.Once="once",e.Recurring="recurring",e.Always="always"}(k3||(k3={})),function(e,t){var n={__c:t="__cC"+S3++,__:e,Consumer:function(r,i){return r.children(i)},Provider:function(r){var i,o;return this.getChildContext||(i=[],(o={})[t]=this,this.getChildContext=function(){return o},this.shouldComponentUpdate=function(s){this.props.value!==s.value&&i.some(function(u){u.__e=!0,IS(u)})},this.sub=function(s){i.push(s);var u=s.componentWillUnmount;s.componentWillUnmount=function(){i.splice(i.indexOf(s),1),u&&u.call(s)}}),r.children}};n.Provider.__=n.Consumer.contextType=n}({isPreviewMode:!1,previewPageIndex:0,onPopupSurveyDismissed:()=>{},isPopup:!0,onPreviewSubmit:()=>{}});var Su=function(e,t){if(!function(n){try{new RegExp(n)}catch{return!1}return!0}(t))return!1;try{return new RegExp(t).test(e)}catch{return!1}};class N3{constructor(){Me(this,"events",{}),this.events={}}on(t,n){return this.events[t]||(this.events[t]=[]),this.events[t].push(n),()=>{this.events[t]=this.events[t].filter(r=>r!==n)}}emit(t,n){for(var r of this.events[t]||[])r(n);for(var i of this.events["*"]||[])i(t,n)}}class Ys{constructor(t){Me(this,"_debugEventEmitter",new N3),Me(this,"checkStep",(n,r)=>this.checkStepEvent(n,r)&&this.checkStepUrl(n,r)&&this.checkStepElement(n,r)),Me(this,"checkStepEvent",(n,r)=>r==null||!r.event||(n==null?void 0:n.event)===(r==null?void 0:r.event)),this.instance=t,this.actionEvents=new Set,this.actionRegistry=new Set}init(){var t;if(!Be((t=this.instance)===null||t===void 0?void 0:t._addCaptureHook)){var n;(n=this.instance)===null||n===void 0||n._addCaptureHook((r,i)=>{this.on(r,i)})}}register(t){var n,r;if(!Be((n=this.instance)===null||n===void 0?void 0:n._addCaptureHook)&&(t.forEach(s=>{var u,c;(u=this.actionRegistry)===null||u===void 0||u.add(s),(c=s.steps)===null||c===void 0||c.forEach(d=>{var p;(p=this.actionEvents)===null||p===void 0||p.add((d==null?void 0:d.event)||"")})}),(r=this.instance)!==null&&r!==void 0&&r.autocapture)){var i,o=new Set;t.forEach(s=>{var u;(u=s.steps)===null||u===void 0||u.forEach(c=>{c!=null&&c.selector&&o.add(c==null?void 0:c.selector)})}),(i=this.instance)===null||i===void 0||i.autocapture.setElementSelectors(o)}}on(t,n){var r;n!=null&&t.length!=0&&(this.actionEvents.has(t)||this.actionEvents.has(n==null?void 0:n.event))&&this.actionRegistry&&((r=this.actionRegistry)===null||r===void 0?void 0:r.size)>0&&this.actionRegistry.forEach(i=>{this.checkAction(n,i)&&this._debugEventEmitter.emit("actionCaptured",i.name)})}_addActionHook(t){this.onAction("actionCaptured",n=>t(n))}checkAction(t,n){if((n==null?void 0:n.steps)==null)return!1;for(var r of n.steps)if(this.checkStep(t,r))return!0;return!1}onAction(t,n){return this._debugEventEmitter.on(t,n)}checkStepUrl(t,n){if(n!=null&&n.url){var r,i=t==null||(r=t.properties)===null||r===void 0?void 0:r.$current_url;if(!i||typeof i!="string"||!Ys.matchString(i,n==null?void 0:n.url,(n==null?void 0:n.url_matching)||"contains"))return!1}return!0}static matchString(t,n,r){switch(r){case"regex":return!!ce&&Su(t,n);case"exact":return n===t;case"contains":var i=Ys.escapeStringRegexp(n).replace(/_/g,".").replace(/%/g,".*");return Su(t,i);default:return!1}}static escapeStringRegexp(t){return t.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}checkStepElement(t,n){if((n!=null&&n.href||n!=null&&n.tag_name||n!=null&&n.text)&&!this.getElementsList(t).some(o=>!(n!=null&&n.href&&!Ys.matchString(o.href||"",n==null?void 0:n.href,(n==null?void 0:n.href_matching)||"exact"))&&(n==null||!n.tag_name||o.tag_name===(n==null?void 0:n.tag_name))&&!(n!=null&&n.text&&!Ys.matchString(o.text||"",n==null?void 0:n.text,(n==null?void 0:n.text_matching)||"exact")&&!Ys.matchString(o.$el_text||"",n==null?void 0:n.text,(n==null?void 0:n.text_matching)||"exact"))))return!1;if(n!=null&&n.selector){var r,i=t==null||(r=t.properties)===null||r===void 0?void 0:r.$element_selectors;if(!i||!i.includes(n==null?void 0:n.selector))return!1}return!0}getElementsList(t){return(t==null?void 0:t.properties.$elements)==null?[]:t==null?void 0:t.properties.$elements}}class jf{constructor(t){this.instance=t,this.eventToSurveys=new Map,this.actionToSurveys=new Map}register(t){var n;Be((n=this.instance)===null||n===void 0?void 0:n._addCaptureHook)||(this.setupEventBasedSurveys(t),this.setupActionBasedSurveys(t))}setupActionBasedSurveys(t){var n=t.filter(r=>{var i,o,s,u;return((i=r.conditions)===null||i===void 0?void 0:i.actions)&&((o=r.conditions)===null||o===void 0||(s=o.actions)===null||s===void 0||(u=s.values)===null||u===void 0?void 0:u.length)>0});n.length!==0&&(this.actionMatcher==null&&(this.actionMatcher=new Ys(this.instance),this.actionMatcher.init(),this.actionMatcher._addActionHook(r=>{this.onAction(r)})),n.forEach(r=>{var i,o,s,u,c,d,p,h,m,v;r.conditions&&(i=r.conditions)!==null&&i!==void 0&&i.actions&&(o=r.conditions)!==null&&o!==void 0&&(s=o.actions)!==null&&s!==void 0&&s.values&&((u=r.conditions)===null||u===void 0||(c=u.actions)===null||c===void 0||(d=c.values)===null||d===void 0?void 0:d.length)>0&&((p=this.actionMatcher)===null||p===void 0||p.register(r.conditions.actions.values),(h=r.conditions)===null||h===void 0||(m=h.actions)===null||m===void 0||(v=m.values)===null||v===void 0||v.forEach(_=>{if(_&&_.name){var x=this.actionToSurveys.get(_.name);x&&x.push(r.id),this.actionToSurveys.set(_.name,x||[r.id])}}))}))}setupEventBasedSurveys(t){var n;t.filter(r=>{var i,o,s,u;return((i=r.conditions)===null||i===void 0?void 0:i.events)&&((o=r.conditions)===null||o===void 0||(s=o.events)===null||s===void 0||(u=s.values)===null||u===void 0?void 0:u.length)>0}).length!==0&&((n=this.instance)===null||n===void 0||n._addCaptureHook((r,i)=>{this.onEvent(r,i)}),t.forEach(r=>{var i,o,s;(i=r.conditions)===null||i===void 0||(o=i.events)===null||o===void 0||(s=o.values)===null||s===void 0||s.forEach(u=>{if(u&&u.name){var c=this.eventToSurveys.get(u.name);c&&c.push(r.id),this.eventToSurveys.set(u.name,c||[r.id])}})}))}onEvent(t,n){var r,i,o=((r=this.instance)===null||r===void 0||(i=r.persistence)===null||i===void 0?void 0:i.props[og])||[];if(jf.SURVEY_SHOWN_EVENT_NAME==t&&n&&o.length>0){var s,u=n==null||(s=n.properties)===null||s===void 0?void 0:s.$survey_id;if(u){var c=o.indexOf(u);c>=0&&(o.splice(c,1),this._updateActivatedSurveys(o))}}else this.eventToSurveys.has(t)&&this._updateActivatedSurveys(o.concat(this.eventToSurveys.get(t)||[]))}onAction(t){var n,r,i=((n=this.instance)===null||n===void 0||(r=n.persistence)===null||r===void 0?void 0:r.props[og])||[];this.actionToSurveys.has(t)&&this._updateActivatedSurveys(i.concat(this.actionToSurveys.get(t)||[]))}_updateActivatedSurveys(t){var n,r;(n=this.instance)===null||n===void 0||(r=n.persistence)===null||r===void 0||r.register({[og]:[...new Set(t)]})}getSurveys(){var t,n,r=(t=this.instance)===null||t===void 0||(n=t.persistence)===null||n===void 0?void 0:n.props[og];return r||[]}getEventToSurveys(){return this.eventToSurveys}_getActionMatcher(){return this.actionMatcher}}Me(jf,"SURVEY_SHOWN_EVENT_NAME","survey shown");var dr=kr("[Surveys]"),P3={icontains:(e,t)=>e.some(n=>t.toLowerCase().includes(n.toLowerCase())),not_icontains:(e,t)=>e.every(n=>!t.toLowerCase().includes(n.toLowerCase())),regex:(e,t)=>e.some(n=>Su(t,n)),not_regex:(e,t)=>e.every(n=>!Su(t,n)),exact:(e,t)=>e.some(n=>t===n),is_not:(e,t)=>e.every(n=>t!==n)};function B3(e){return e??"icontains"}class pW{constructor(t){Me(this,"_isFetchingSurveys",!1),Me(this,"_isInitializingSurveys",!1),Me(this,"_surveyCallbacks",[]),this.instance=t,this._surveyEventReceiver=null}onRemoteConfig(t){var n=t.surveys;if(Wt(n))return dr.warn("Decide not loaded yet. Not loading surveys.");var r=kn(n);this._hasSurveys=r?n.length>0:n,dr.info("decide response received, hasSurveys: ".concat(this._hasSurveys)),this._hasSurveys&&this.loadIfEnabled()}reset(){localStorage.removeItem("lastSeenSurveyDate");var t=(()=>{for(var n=[],r=0;r<localStorage.length;r++){var i=localStorage.key(r);i!=null&&i.startsWith("seenSurvey_")&&n.push(i)}return n})();t.forEach(n=>localStorage.removeItem(n))}loadIfEnabled(){if(!this._surveyManager)if(this._isInitializingSurveys)dr.info("Already initializing surveys, skipping...");else if(this.instance.config.disable_surveys)dr.info("Disabled. Not loading surveys.");else{var t=pt==null?void 0:pt.__PosthogExtensions__;if(t)if(this._hasSurveys){this._isInitializingSurveys=!0;try{var n=t.generateSurveys;if(n)this._surveyManager=n(this.instance),this._isInitializingSurveys=!1,this._surveyEventReceiver=new jf(this.instance),dr.info("Surveys loaded successfully"),this._notifySurveyCallbacks({isLoaded:!0});else{var r=t.loadExternalDependency;if(r)r(this.instance,"surveys",o=>{if(o||!t.generateSurveys)return dr.error("Could not load surveys script",o),void(this._isInitializingSurveys=!1);this._surveyManager=t.generateSurveys(this.instance),this._isInitializingSurveys=!1,this._surveyEventReceiver=new jf(this.instance),dr.info("Surveys loaded successfully"),this._notifySurveyCallbacks({isLoaded:!0})});else{var i="PostHog loadExternalDependency extension not found. Cannot load remote config.";dr.error(i),this._isInitializingSurveys=!1,this._notifySurveyCallbacks({isLoaded:!1,error:i})}}}catch(o){throw dr.error("Error initializing surveys",o),this._isInitializingSurveys=!1,this._notifySurveyCallbacks({isLoaded:!1,error:"Error initializing surveys"}),o}}else dr.info("No surveys to load.");else dr.error("PostHog Extensions not found.")}}onSurveysLoaded(t){return this._surveyCallbacks.push(t),this._surveyManager&&this._notifySurveyCallbacks({isLoaded:!0}),()=>{this._surveyCallbacks=this._surveyCallbacks.filter(n=>n!==t)}}getSurveys(t){var n=arguments.length>1&&arguments[1]!==void 0&&arguments[1];if(this.instance.config.disable_surveys)return dr.info("Disabled. Not loading surveys."),t([]);var r=this.instance.get_property(L1);if(r&&!n)return t(r,{isLoaded:!0});if(this._isFetchingSurveys)return t([],{isLoaded:!1,error:"Surveys are already being loaded"});try{this._isFetchingSurveys=!0,this.instance._send_request({url:this.instance.requestRouter.endpointFor("api","/api/surveys/?token=".concat(this.instance.config.token)),method:"GET",timeout:this.instance.config.surveys_request_timeout_ms,callback:i=>{var o;this._isFetchingSurveys=!1;var s=i.statusCode;if(s!==200||!i.json){var u="Surveys API could not be loaded, status: ".concat(s);return dr.error(u),t([],{isLoaded:!1,error:u})}var c,d=i.json.surveys||[],p=d.filter(h=>{var m,v,_,x,b,w,C,E,R,O,T,L;return((m=h.conditions)===null||m===void 0?void 0:m.events)&&((v=h.conditions)===null||v===void 0||(_=v.events)===null||_===void 0?void 0:_.values)&&((x=h.conditions)===null||x===void 0||(b=x.events)===null||b===void 0||(w=b.values)===null||w===void 0?void 0:w.length)>0||((C=h.conditions)===null||C===void 0?void 0:C.actions)&&((E=h.conditions)===null||E===void 0||(R=E.actions)===null||R===void 0?void 0:R.values)&&((O=h.conditions)===null||O===void 0||(T=O.actions)===null||T===void 0||(L=T.values)===null||L===void 0?void 0:L.length)>0});return p.length>0&&((c=this._surveyEventReceiver)===null||c===void 0||c.register(p)),(o=this.instance.persistence)===null||o===void 0||o.register({[L1]:d}),t(d,{isLoaded:!0})}})}catch(i){throw this._isFetchingSurveys=!1,i}}_notifySurveyCallbacks(t){for(var n of this._surveyCallbacks)try{t.isLoaded?this.getSurveys(n):n([],t)}catch(r){dr.error("Error in survey callback",r)}}isSurveyFeatureFlagEnabled(t){return!t||this.instance.featureFlags.isFeatureEnabled(t)}getActiveMatchingSurveys(t){var n=arguments.length>1&&arguments[1]!==void 0&&arguments[1];this.getSurveys(r=>{var i,o=r.filter(c=>!(!c.start_date||c.end_date)).filter(c=>{var d;if(!c.conditions)return!0;var p=function(v){var _,x,b;if((_=v.conditions)===null||_===void 0||!_.url)return!0;var w=ce==null||(x=ce.location)===null||x===void 0?void 0:x.href;if(!w)return!1;var C=[v.conditions.url];return P3[B3((b=v.conditions)===null||b===void 0?void 0:b.urlMatchType)](C,w)}(c),h=(d=c.conditions)===null||d===void 0||!d.selector||(He==null?void 0:He.querySelector(c.conditions.selector)),m=function(v){var _,x,b;if((_=v.conditions)===null||_===void 0||!_.deviceTypes||((x=v.conditions)===null||x===void 0?void 0:x.deviceTypes.length)===0)return!0;if(!qn)return!1;var w=Sn.deviceType(qn);return P3[B3((b=v.conditions)===null||b===void 0?void 0:b.deviceTypesMatchType)](v.conditions.deviceTypes,w)}(c);return p&&h&&m}),s=(i=this._surveyEventReceiver)===null||i===void 0?void 0:i.getSurveys(),u=o.filter(c=>{var d,p,h,m,v,_,x,b,w;if(!(c.linked_flag_key||c.targeting_flag_key||c.internal_targeting_flag_key||(d=c.feature_flag_keys)!==null&&d!==void 0&&d.length))return!0;var C=this.isSurveyFeatureFlagEnabled(c.linked_flag_key),E=this.isSurveyFeatureFlagEnabled(c.targeting_flag_key),R=((p=(h=c.conditions)===null||h===void 0||(m=h.events)===null||m===void 0||(v=m.values)===null||v===void 0?void 0:v.length)!==null&&p!==void 0?p:0)>0,O=((_=(x=c.conditions)===null||x===void 0||(b=x.actions)===null||b===void 0||(w=b.values)===null||w===void 0?void 0:w.length)!==null&&_!==void 0?_:0)>0,T=!R&&!O||(s==null?void 0:s.includes(c.id)),L=this._canActivateRepeatedly(c)||this.isSurveyFeatureFlagEnabled(c.internal_targeting_flag_key),B=this.checkFlags(c);return C&&E&&L&&T&&B});return t(u)},n)}checkFlags(t){var n;return(n=t.feature_flag_keys)===null||n===void 0||!n.length||t.feature_flag_keys.every(r=>{var{key:i,value:o}=r;return!i||!o||this.instance.featureFlags.isFeatureEnabled(o)})}_canActivateRepeatedly(t){var n;return Wt((n=pt.__PosthogExtensions__)===null||n===void 0?void 0:n.canActivateRepeatedly)?(dr.warn("init was not called"),!1):pt.__PosthogExtensions__.canActivateRepeatedly(t)}canRenderSurvey(t){if(Wt(this._surveyManager))return dr.warn("init was not called"),{visible:!1,disabledReason:"SDK is not enabled or survey functionality is not yet loaded"};var n=null;return this.getSurveys(r=>{var i=r.filter(o=>o.id===t)[0];n=i?pe({},this._surveyManager.canRenderSurvey(i)):{visible:!1,disabledReason:"Survey not found"}}),n}renderSurvey(t,n){Wt(this._surveyManager)?dr.warn("init was not called"):this.getSurveys(r=>{var i=r.filter(o=>o.id===t)[0];this._surveyManager.renderSurvey(i,He==null?void 0:He.querySelector(n))})}}var F3=kr("[RateLimiter]");class gW{constructor(t){var n,r;Me(this,"serverLimits",{}),Me(this,"lastEventRateLimited",!1),Me(this,"checkForLimiting",i=>{var o=i.text;if(o&&o.length)try{(JSON.parse(o).quota_limited||[]).forEach(s=>{F3.info("".concat(s||"events"," is quota limited.")),this.serverLimits[s]=new Date().getTime()+6e4})}catch(s){return void F3.warn('could not rate limit - continuing. Error: "'.concat(s==null?void 0:s.message,'"'),{text:o})}}),this.instance=t,this.captureEventsPerSecond=((n=t.config.rate_limiting)===null||n===void 0?void 0:n.events_per_second)||10,this.captureEventsBurstLimit=Math.max(((r=t.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 t,n,r,i=arguments.length>0&&arguments[0]!==void 0&&arguments[0],o=new Date().getTime(),s=(t=(n=this.instance.persistence)===null||n===void 0?void 0:n.get_property(P1))!==null&&t!==void 0?t:{tokens:this.captureEventsBurstLimit,last:o};s.tokens+=(o-s.last)/1e3*this.captureEventsPerSecond,s.last=o,s.tokens>this.captureEventsBurstLimit&&(s.tokens=this.captureEventsBurstLimit);var u=s.tokens<1;return u||i||(s.tokens=Math.max(0,s.tokens-1)),!u||this.lastEventRateLimited||i||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=u,(r=this.instance.persistence)===null||r===void 0||r.set_property(P1,s),{isRateLimited:u,remainingTokens:s.tokens}}isServerRateLimited(t){var n=this.serverLimits[t||"events"]||!1;return n!==!1&&new Date().getTime()<n}}var Ws=kr("[RemoteConfig]");class mW{constructor(t){this.instance=t}get remoteConfig(){var t,n;return(t=pt._POSTHOG_REMOTE_CONFIG)===null||t===void 0||(n=t[this.instance.config.token])===null||n===void 0?void 0:n.config}_loadRemoteConfigJs(t){var n,r,i;(n=pt.__PosthogExtensions__)!==null&&n!==void 0&&n.loadExternalDependency?(r=pt.__PosthogExtensions__)===null||r===void 0||(i=r.loadExternalDependency)===null||i===void 0||i.call(r,this.instance,"remote-config",()=>t(this.remoteConfig)):(Ws.error("PostHog Extensions not found. Cannot load remote config."),t())}_loadRemoteConfigJSON(t){this.instance._send_request({method:"GET",url:this.instance.requestRouter.endpointFor("assets","/array/".concat(this.instance.config.token,"/config")),callback:n=>{t(n.json)}})}load(){try{if(this.remoteConfig)return Ws.info("Using preloaded remote config",this.remoteConfig),void this.onRemoteConfig(this.remoteConfig);if(this.instance.config.advanced_disable_decide)return void Ws.warn("Remote config is disabled. Falling back to local config.");this._loadRemoteConfigJs(t=>{if(!t)return Ws.info("No config found after loading remote JS config. Falling back to JSON."),void this._loadRemoteConfigJSON(n=>{this.onRemoteConfig(n)});this.onRemoteConfig(t)})}catch(t){Ws.error("Error loading remote config",t)}}onRemoteConfig(t){t?this.instance.config.__preview_remote_config?(this.instance._onRemoteConfig(t),t.hasFeatureFlags!==!1&&this.instance.featureFlags.ensureFlagsLoaded()):Ws.info("__preview_remote_config is disabled. Logging config instead",t):Ws.error("Failed to fetch remote config from PostHog.")}}var vW=function(e){var t,n,r,i,o="";for(t=n=0,r=(e=(e+"").replace(/\r\n/g,`
|
|
138
138
|
`).replace(/\r/g,`
|
|
139
139
|
`)).length,i=0;i<r;i++){var s=e.charCodeAt(i),u=null;s<128?n++:u=s>127&&s<2048?String.fromCharCode(s>>6|192,63&s|128):String.fromCharCode(s>>12|224,s>>6&63|128,63&s|128),ja(u)||(n>t&&(o+=e.substring(t,n)),o+=u,t=n=i+1)}return n>t&&(o+=e.substring(t,e.length)),o},yW=!!k1||!!E1,U3="text/plain",Rg=(e,t)=>{var[n,r]=e.split("?"),i=pe({},t);r==null||r.split("&").forEach(s=>{var[u]=s.split("=");delete i[u]});var o=GZ(i);return o=o?(r?r+"&":"")+o:r,"".concat(n,"?").concat(o)},Hf=(e,t)=>JSON.stringify(e,(n,r)=>typeof r=="bigint"?r.toString():r,t),TS=e=>{var{data:t,compression:n}=e;if(t){if(n===Hi.GZipJS){var r=BM(FM(Hf(t)),{mtime:0}),i=new Blob([r],{type:U3});return{contentType:U3,body:i,estimatedSize:i.size}}if(n===Hi.Base64){var o=function(c){var d,p,h,m,v,_="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",x=0,b=0,w="",C=[];if(!c)return c;c=vW(c);do d=(v=c.charCodeAt(x++)<<16|c.charCodeAt(x++)<<8|c.charCodeAt(x++))>>18&63,p=v>>12&63,h=v>>6&63,m=63&v,C[b++]=_.charAt(d)+_.charAt(p)+_.charAt(h)+_.charAt(m);while(x<c.length);switch(w=C.join(""),c.length%3){case 1:w=w.slice(0,-2)+"==";break;case 2:w=w.slice(0,-1)+"="}return w}(Hf(t)),s=(c=>"data="+encodeURIComponent(typeof c=="string"?c:Hf(c)))(o);return{contentType:"application/x-www-form-urlencoded",body:s,estimatedSize:new Blob([s]).size}}var u=Hf(t);return{contentType:"application/json",body:u,estimatedSize:new Blob([u]).size}}},Gf=[];E1&&Gf.push({transport:"fetch",method:e=>{var t,n,{contentType:r,body:i,estimatedSize:o}=(t=TS(e))!==null&&t!==void 0?t:{},s=new Headers;rn(e.headers,function(p,h){s.append(h,p)}),r&&s.append("Content-Type",r);var u=e.url,c=null;if(MT){var d=new MT;c={signal:d.signal,timeout:setTimeout(()=>d.abort(),e.timeout)}}E1(u,pe({method:(e==null?void 0:e.method)||"GET",headers:s,keepalive:e.method==="POST"&&(o||0)<52428.8,body:i,signal:(n=c)===null||n===void 0?void 0:n.signal},e.fetchOptions)).then(p=>p.text().then(h=>{var m,v={statusCode:p.status,text:h};if(p.status===200)try{v.json=JSON.parse(h)}catch(_){Qe.error(_)}(m=e.callback)===null||m===void 0||m.call(e,v)})).catch(p=>{var h;Qe.error(p),(h=e.callback)===null||h===void 0||h.call(e,{statusCode:0,text:p})}).finally(()=>c?clearTimeout(c.timeout):null)}}),k1&&Gf.push({transport:"XHR",method:e=>{var t,n=new k1;n.open(e.method||"GET",e.url,!0);var{contentType:r,body:i}=(t=TS(e))!==null&&t!==void 0?t:{};rn(e.headers,function(o,s){n.setRequestHeader(s,o)}),r&&n.setRequestHeader("Content-Type",r),e.timeout&&(n.timeout=e.timeout),n.withCredentials=!0,n.onreadystatechange=()=>{if(n.readyState===4){var o,s={statusCode:n.status,text:n.responseText};if(n.status===200)try{s.json=JSON.parse(n.responseText)}catch{}(o=e.callback)===null||o===void 0||o.call(e,s)}},n.send(i)}}),ni!=null&&ni.sendBeacon&&Gf.push({transport:"sendBeacon",method:e=>{var t=Rg(e.url,{beacon:"1"});try{var n,{contentType:r,body:i}=(n=TS(e))!==null&&n!==void 0?n:{},o=typeof i=="string"?new Blob([i],{type:r}):i;ni.sendBeacon(t,o)}catch{}}});var MS=3e3;class _W{constructor(t,n){Me(this,"isPaused",!0),Me(this,"queue",[]),this.flushTimeoutMs=bi((n==null?void 0:n.flush_interval_ms)||MS,250,5e3,"flush interval",MS),this.sendRequest=t}enqueue(t){this.queue.push(t),this.flushTimeout||this.setFlushTimeout()}unload(){this.clearFlushTimeout();var t=this.queue.length>0?this.formatQueue():{},n=Object.values(t),r=[...n.filter(i=>i.url.indexOf("/e")===0),...n.filter(i=>i.url.indexOf("/e")!==0)];r.map(i=>{this.sendRequest(pe(pe({},i),{},{transport:"sendBeacon"}))})}enable(){this.isPaused=!1,this.setFlushTimeout()}setFlushTimeout(){var t=this;this.isPaused||(this.flushTimeout=setTimeout(()=>{if(this.clearFlushTimeout(),this.queue.length>0){var n=this.formatQueue(),r=function(o){var s=n[o],u=new Date().getTime();s.data&&kn(s.data)&&rn(s.data,c=>{c.offset=Math.abs(c.timestamp-u),delete c.timestamp}),t.sendRequest(s)};for(var i in n)r(i)}},this.flushTimeoutMs))}clearFlushTimeout(){clearTimeout(this.flushTimeout),this.flushTimeout=void 0}formatQueue(){var t={};return rn(this.queue,n=>{var r,i=n,o=(i?i.batchKey:null)||i.url;Be(t[o])&&(t[o]=pe(pe({},i),{},{data:[]})),(r=t[o].data)===null||r===void 0||r.push(i.data)}),this.queue=[],t}}var bW=["retriesPerformedSoFar"];class SW{constructor(t){Me(this,"isPolling",!1),Me(this,"pollIntervalMs",3e3),Me(this,"queue",[]),this.instance=t,this.queue=[],this.areWeOnline=!0,!Be(ce)&&"onLine"in ce.navigator&&(this.areWeOnline=ce.navigator.onLine,$n(ce,"online",()=>{this.areWeOnline=!0,this.flush()}),$n(ce,"offline",()=>{this.areWeOnline=!1}))}retriableRequest(t){var{retriesPerformedSoFar:n}=t,r=BT(t,bW);Dr(n)&&n>0&&(r.url=Rg(r.url,{retry_count:n})),this.instance._send_request(pe(pe({},r),{},{callback:i=>{var o;i.statusCode!==200&&(i.statusCode<400||i.statusCode>=500)&&(n??0)<10?this.enqueue(pe({retriesPerformedSoFar:n},r)):(o=r.callback)===null||o===void 0||o.call(r,i)}}))}enqueue(t){var n=t.retriesPerformedSoFar||0;t.retriesPerformedSoFar=n+1;var r=function(s){var u=3e3*Math.pow(2,s),c=u/2,d=Math.min(18e5,u),p=(Math.random()-.5)*(d-c);return Math.ceil(d+p)}(n),i=Date.now()+r;this.queue.push({retryAt:i,requestOptions:t});var o="Enqueued failed request for retry in ".concat(r);navigator.onLine||(o+=" (Browser is offline)"),Qe.warn(o),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 t=Date.now(),n=[],r=this.queue.filter(o=>o.retryAt<t||(n.push(o),!1));if(this.queue=n,r.length>0)for(var{requestOptions:i}of r)this.retriableRequest(i)}unload(){for(var{requestOptions:t}of(this.poller&&(clearTimeout(this.poller),this.poller=void 0),this.queue))try{this.instance._send_request(pe(pe({},t),{},{transport:"sendBeacon"}))}catch(n){Qe.error(n)}this.queue=[]}}class wW{constructor(t){Me(this,"_updateScrollData",()=>{var n,r,i,o;this.context||(this.context={});var s=this.scrollElement(),u=this.scrollY(),c=s?Math.max(0,s.scrollHeight-s.clientHeight):0,d=u+((s==null?void 0:s.clientHeight)||0),p=(s==null?void 0:s.scrollHeight)||0;this.context.lastScrollY=Math.ceil(u),this.context.maxScrollY=Math.max(u,(n=this.context.maxScrollY)!==null&&n!==void 0?n:0),this.context.maxScrollHeight=Math.max(c,(r=this.context.maxScrollHeight)!==null&&r!==void 0?r:0),this.context.lastContentY=d,this.context.maxContentY=Math.max(d,(i=this.context.maxContentY)!==null&&i!==void 0?i:0),this.context.maxContentHeight=Math.max(p,(o=this.context.maxContentHeight)!==null&&o!==void 0?o:0)}),this.instance=t}getContext(){return this.context}resetContext(){var t=this.context;return setTimeout(this._updateScrollData,0),t}startMeasuringScrollPosition(){$n(ce,"scroll",this._updateScrollData,{capture:!0}),$n(ce,"scrollend",this._updateScrollData,{capture:!0}),$n(ce,"resize",this._updateScrollData)}scrollElement(){if(!this.instance.config.scroll_root_selector)return ce==null?void 0:ce.document.documentElement;var t=kn(this.instance.config.scroll_root_selector)?this.instance.config.scroll_root_selector:[this.instance.config.scroll_root_selector];for(var n of t){var r=ce==null?void 0:ce.document.querySelector(n);if(r)return r}}scrollY(){if(this.instance.config.scroll_root_selector){var t=this.scrollElement();return t&&t.scrollTop||0}return ce&&(ce.scrollY||ce.pageYOffset||ce.document.documentElement.scrollTop)||0}scrollX(){if(this.instance.config.scroll_root_selector){var t=this.scrollElement();return t&&t.scrollLeft||0}return ce&&(ce.scrollX||ce.pageXOffset||ce.document.documentElement.scrollLeft)||0}}var xW=e=>Sn.personInfo({maskPersonalDataProperties:e==null?void 0:e.config.mask_personal_data_properties,customPersonalDataProperties:e==null?void 0:e.config.custom_personal_data_properties});class CW{constructor(t,n,r,i){Me(this,"_onSessionIdCallback",o=>{var s=this._getStored();if(!s||s.sessionId!==o){var u={sessionId:o,props:this._sessionSourceParamGenerator(this.instance)};this._persistence.register({[N1]:u})}}),this.instance=t,this._sessionIdManager=n,this._persistence=r,this._sessionSourceParamGenerator=i||xW,this._sessionIdManager.onSessionId(this._onSessionIdCallback)}_getStored(){return this._persistence.props[N1]}getSetOnceProps(){var t,n=(t=this._getStored())===null||t===void 0?void 0:t.props;return n?"r"in n?Sn.personPropsFromInfo(n):{$referring_domain:n.referringDomain,$pathname:n.initialPathName,utm_source:n.utm_source,utm_campaign:n.utm_campaign,utm_medium:n.utm_medium,utm_content:n.utm_content,utm_term:n.utm_term}:{}}getSessionProps(){var t={};return rn(Af(this.getSetOnceProps()),(n,r)=>{r==="$current_url"&&(r="url"),t["$session_entry_".concat(I1(r))]=n}),t}}var z3=kr("[SessionId]");class EW{constructor(t,n,r){var i;if(Me(this,"_sessionIdChangedHandlers",[]),!t.persistence)throw new Error("SessionIdManager requires a PostHogPersistence instance");if(t.config.__preview_experimental_cookieless_mode)throw new Error("SessionIdManager cannot be used with __preview_experimental_cookieless_mode");this.config=t.config,this.persistence=t.persistence,this._windowId=void 0,this._sessionId=void 0,this._sessionStartTimestamp=null,this._sessionActivityTimestamp=null,this._sessionIdGenerator=n||Za,this._windowIdGenerator=r||Za;var o=this.config.persistence_name||this.config.token,s=this.config.session_idle_timeout_seconds||1800;if(this._sessionTimeoutMs=1e3*bi(s,60,36e3,"session_idle_timeout_seconds",1800),t.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this.resetIdleTimer(),this._window_id_storage_key="ph_"+o+"_window_id",this._primary_window_exists_storage_key="ph_"+o+"_primary_window_exists",this._canUseSessionStorage()){var u=fr.parse(this._window_id_storage_key),c=fr.parse(this._primary_window_exists_storage_key);u&&!c?this._windowId=u:fr.remove(this._window_id_storage_key),fr.set(this._primary_window_exists_storage_key,!0)}if((i=this.config.bootstrap)!==null&&i!==void 0&&i.sessionID)try{var d=(p=>{var h=p.replace(/-/g,"");if(h.length!==32)throw new Error("Not a valid UUID");if(h[12]!=="7")throw new Error("Not a UUIDv7");return parseInt(h.substring(0,12),16)})(this.config.bootstrap.sessionID);this._setSessionId(this.config.bootstrap.sessionID,new Date().getTime(),d)}catch(p){z3.error("Invalid sessionID in bootstrap",p)}this._listenToReloadWindow()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(t){return Be(this._sessionIdChangedHandlers)&&(this._sessionIdChangedHandlers=[]),this._sessionIdChangedHandlers.push(t),this._sessionId&&t(this._sessionId,this._windowId),()=>{this._sessionIdChangedHandlers=this._sessionIdChangedHandlers.filter(n=>n!==t)}}_canUseSessionStorage(){return this.config.persistence!=="memory"&&!this.persistence.disabled&&fr.is_supported()}_setWindowId(t){t!==this._windowId&&(this._windowId=t,this._canUseSessionStorage()&&fr.set(this._window_id_storage_key,t))}_getWindowId(){return this._windowId?this._windowId:this._canUseSessionStorage()?fr.parse(this._window_id_storage_key):null}_setSessionId(t,n,r){t===this._sessionId&&n===this._sessionActivityTimestamp&&r===this._sessionStartTimestamp||(this._sessionStartTimestamp=r,this._sessionActivityTimestamp=n,this._sessionId=t,this.persistence.register({[rg]:[n,t,r]}))}_getSessionId(){if(this._sessionId&&this._sessionActivityTimestamp&&this._sessionStartTimestamp)return[this._sessionActivityTimestamp,this._sessionId,this._sessionStartTimestamp];var t=this.persistence.props[rg];return kn(t)&&t.length===2&&t.push(t[0]),t||[0,null,0]}resetSessionId(){this._setSessionId(null,null,null)}_listenToReloadWindow(){$n(ce,"beforeunload",()=>{this._canUseSessionStorage()&&fr.remove(this._primary_window_exists_storage_key)},{capture:!1})}checkAndGetSessionAndWindowId(){var t=arguments.length>0&&arguments[0]!==void 0&&arguments[0],n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null;if(this.config.__preview_experimental_cookieless_mode)throw new Error("checkAndGetSessionAndWindowId should not be called in __preview_experimental_cookieless_mode");var r=n||new Date().getTime(),[i,o,s]=this._getSessionId(),u=this._getWindowId(),c=Dr(s)&&s>0&&Math.abs(r-s)>864e5,d=!1,p=!o,h=!t&&Math.abs(r-i)>this.sessionTimeoutMs;p||h||c?(o=this._sessionIdGenerator(),u=this._windowIdGenerator(),z3.info("new session ID generated",{sessionId:o,windowId:u,changeReason:{noSessionId:p,activityTimeout:h,sessionPastMaximumLength:c}}),s=r,d=!0):u||(u=this._windowIdGenerator(),d=!0);var m=i===0||!t||c?r:i,v=s===0?new Date().getTime():s;return this._setWindowId(u),this._setSessionId(o,m,v),t||this.resetIdleTimer(),d&&this._sessionIdChangedHandlers.forEach(_=>_(o,u,d?{noSessionId:p,activityTimeout:h,sessionPastMaximumLength:c}:void 0)),{sessionId:o,windowId:u,sessionStartTimestamp:v,changeReason:d?{noSessionId:p,activityTimeout:h,sessionPastMaximumLength:c}:void 0,lastActivityTimestamp:i}}resetIdleTimer(){clearTimeout(this._enforceIdleTimeout),this._enforceIdleTimeout=setTimeout(()=>{this.resetSessionId()},1.1*this.sessionTimeoutMs)}}var kW=["$set_once","$set"],Qa=kr("[SiteApps]");class AW{constructor(t){this.instance=t,this.bufferedInvocations=[],this.apps={}}get isEnabled(){return!!this.instance.config.opt_in_site_apps}eventCollector(t,n){if(n){var r=this.globalsForEvent(n);this.bufferedInvocations.push(r),this.bufferedInvocations.length>1e3&&(this.bufferedInvocations=this.bufferedInvocations.slice(10))}}get siteAppLoaders(){var t,n;return(t=pt._POSTHOG_REMOTE_CONFIG)===null||t===void 0||(n=t[this.instance.config.token])===null||n===void 0?void 0:n.siteApps}init(){if(this.isEnabled){var t=this.instance._addCaptureHook(this.eventCollector.bind(this));this.stopBuffering=()=>{t(),this.bufferedInvocations=[],this.stopBuffering=void 0}}}globalsForEvent(t){var n,r,i,o,s,u,c;if(!t)throw new Error("Event payload is required");var d={},p=this.instance.get_property("$groups")||[],h=this.instance.get_property("$stored_group_properties")||{};for(var[m,v]of Object.entries(h))d[m]={id:p[m],type:m,properties:v};var{$set_once:_,$set:x}=t;return{event:pe(pe({},BT(t,kW)),{},{properties:pe(pe(pe({},t.properties),x?{$set:pe(pe({},(n=(r=t.properties)===null||r===void 0?void 0:r.$set)!==null&&n!==void 0?n:{}),x)}:{}),_?{$set_once:pe(pe({},(i=(o=t.properties)===null||o===void 0?void 0:o.$set_once)!==null&&i!==void 0?i:{}),_)}:{}),elements_chain:(s=(u=t.properties)===null||u===void 0?void 0:u.$elements_chain)!==null&&s!==void 0?s:"",distinct_id:(c=t.properties)===null||c===void 0?void 0:c.distinct_id}),person:{properties:this.instance.get_property("$stored_person_properties")},groups:d}}setupSiteApp(t){var n=this.apps[t.id],r=()=>{var u;!n.errored&&this.bufferedInvocations.length&&(Qa.info("Processing ".concat(this.bufferedInvocations.length," events for site app with id ").concat(t.id)),this.bufferedInvocations.forEach(c=>{var d;return(d=n.processEvent)===null||d===void 0?void 0:d.call(n,c)}),n.processedBuffer=!0),Object.values(this.apps).every(c=>c.processedBuffer||c.errored)&&((u=this.stopBuffering)===null||u===void 0||u.call(this))},i=!1,o=u=>{n.errored=!u,n.loaded=!0,Qa.info("Site app with id ".concat(t.id," ").concat(u?"loaded":"errored")),i&&r()};try{var{processEvent:s}=t.init({posthog:this.instance,callback:u=>{o(u)}});s&&(n.processEvent=s),i=!0}catch(u){Qa.error("Error while initializing PostHog app with config id ".concat(t.id),u),o(!1)}if(i&&n.loaded)try{r()}catch(u){Qa.error("Error while processing buffered events PostHog app with config id ".concat(t.id),u),n.errored=!0}}setupSiteApps(){var t=this.siteAppLoaders||[];for(var n of t)this.apps[n.id]={id:n.id,loaded:!1,errored:!1,processedBuffer:!1};for(var r of t)this.setupSiteApp(r)}onCapturedEvent(t){if(Object.keys(this.apps).length!==0){var n=this.globalsForEvent(t);for(var r of Object.values(this.apps))try{var i;(i=r.processEvent)===null||i===void 0||i.call(r,n)}catch(o){Qa.error("Error while processing event ".concat(t.event," for site app ").concat(r.id),o)}}}onRemoteConfig(t){var n,r,i,o=this;if((n=this.siteAppLoaders)!==null&&n!==void 0&&n.length)return this.isEnabled?(this.setupSiteApps(),void this.instance.on("eventCaptured",d=>this.onCapturedEvent(d))):void Qa.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.');if((r=this.stopBuffering)===null||r===void 0||r.call(this),(i=t.siteApps)!==null&&i!==void 0&&i.length)if(this.isEnabled){var s=function(d,p){var h,m;pt["__$$ph_site_app_".concat(d)]=o.instance,(h=pt.__PosthogExtensions__)===null||h===void 0||(m=h.loadSiteApp)===null||m===void 0||m.call(h,o.instance,p,v=>{if(v)return Qa.error("Error while initializing PostHog app with config id ".concat(d),v)})};for(var{id:u,url:c}of t.siteApps)s(u,c)}else Qa.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}}var Ks,IW=["amazonbot","amazonproductbot","app.hypefactors.com","applebot","archive.org_bot","awariobot","backlinksextendedbot","baiduspider","bingbot","bingpreview","chrome-lighthouse","dataforseobot","deepscan","duckduckbot","facebookexternal","facebookcatalog","http://yandex.com/bots","hubspot","ia_archiver","linkedinbot","meta-externalagent","mj12bot","msnbot","nessus","petalbot","pinterest","prerender","rogerbot","screaming frog","sebot-wa","sitebulb","slackbot","slurp","trendictionbot","turnitin","twitterbot","vercelbot","yahoo! slurp","yandexbot","zoombot","bot.htm","bot.php","(bot;","bot/","crawler","ahrefsbot","ahrefssiteaudit","semrushbot","siteauditbot","splitsignalbot","gptbot","oai-searchbot","chatgpt-user","perplexitybot","better uptime bot","sentryuptimebot","uptimerobot","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"],q3=function(e,t){if(!e)return!1;var n=e.toLowerCase();return IW.concat(t||[]).some(r=>{var i=r.toLowerCase();return n.indexOf(i)!==-1})},j3=function(e,t){if(!e)return!1;var n=e.userAgent;if(n&&q3(n,t))return!0;try{var r=e==null?void 0:e.userAgentData;if(r!=null&&r.brands&&r.brands.some(i=>q3(i==null?void 0:i.brand,t)))return!0}catch{}return!!e.webdriver};function H3(e,t,n){return Hf({distinct_id:e,userPropertiesToSet:t,userPropertiesToSetOnce:n})}(function(e){e.US="us",e.EU="eu",e.CUSTOM="custom"})(Ks||(Ks={}));var G3="i.posthog.com";class RW{constructor(t){Me(this,"_regionCache",{}),this.instance=t}get apiHost(){var t=this.instance.config.api_host.trim().replace(/\/$/,"");return t==="https://app.posthog.com"?"https://us.i.posthog.com":t}get uiHost(){var t,n=(t=this.instance.config.ui_host)===null||t===void 0?void 0:t.replace(/\/$/,"");return n||(n=this.apiHost.replace(".".concat(G3),".posthog.com")),n==="https://app.posthog.com"?"https://us.posthog.com":n}get region(){return this._regionCache[this.apiHost]||(/https:\/\/(app|us|us-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?this._regionCache[this.apiHost]=Ks.US:/https:\/\/(eu|eu-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?this._regionCache[this.apiHost]=Ks.EU:this._regionCache[this.apiHost]=Ks.CUSTOM),this._regionCache[this.apiHost]}endpointFor(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"";if(n&&(n=n[0]==="/"?n:"/".concat(n)),t==="ui")return this.uiHost+n;if(this.region===Ks.CUSTOM)return this.apiHost+n;var r=G3+n;switch(t){case"assets":return"https://".concat(this.region,"-assets.").concat(r);case"api":return"https://".concat(this.region,".").concat(r)}}}var OW={icontains:(e,t)=>!!ce&&t.href.toLowerCase().indexOf(e.toLowerCase())>-1,not_icontains:(e,t)=>!!ce&&t.href.toLowerCase().indexOf(e.toLowerCase())===-1,regex:(e,t)=>!!ce&&Su(t.href,e),not_regex:(e,t)=>!!ce&&!Su(t.href,e),exact:(e,t)=>t.href===e,is_not:(e,t)=>t.href!==e};class Ir{constructor(t){var n=this;Me(this,"getWebExperimentsAndEvaluateDisplayLogic",function(){var r=arguments.length>0&&arguments[0]!==void 0&&arguments[0];n.getWebExperiments(i=>{Ir.logInfo("retrieved web experiments from the server"),n._flagToExperiments=new Map,i.forEach(o=>{if(o.feature_flag_key){var s;n._flagToExperiments&&(Ir.logInfo("setting flag key ",o.feature_flag_key," to web experiment ",o),(s=n._flagToExperiments)===null||s===void 0||s.set(o.feature_flag_key,o));var u=n.instance.getFeatureFlag(o.feature_flag_key);jn(u)&&o.variants[u]&&n.applyTransforms(o.name,u,o.variants[u].transforms)}else if(o.variants)for(var c in o.variants){var d=o.variants[c];Ir.matchesTestVariant(d)&&n.applyTransforms(o.name,c,d.transforms)}})},r)}),this.instance=t,this.instance.onFeatureFlags(r=>{this.onFeatureFlags(r)})}onFeatureFlags(t){if(this._is_bot())Ir.logInfo("Refusing to render web experiment since the viewer is a likely bot");else if(!this.instance.config.disable_web_experiments){if(Wt(this._flagToExperiments))return this._flagToExperiments=new Map,this.loadIfEnabled(),void this.previewWebExperiment();Ir.logInfo("applying feature flags",t),t.forEach(n=>{var r;if(this._flagToExperiments&&(r=this._flagToExperiments)!==null&&r!==void 0&&r.has(n)){var i,o=this.instance.getFeatureFlag(n),s=(i=this._flagToExperiments)===null||i===void 0?void 0:i.get(n);o&&s!=null&&s.variants[o]&&this.applyTransforms(s.name,o,s.variants[o].transforms)}})}}previewWebExperiment(){var t=Ir.getWindowLocation();if(t!=null&&t.search){var n=fg(t==null?void 0:t.search,"__experiment_id"),r=fg(t==null?void 0:t.search,"__experiment_variant");n&&r&&(Ir.logInfo("previewing web experiments ".concat(n," && ").concat(r)),this.getWebExperiments(i=>{this.showPreviewWebExperiment(parseInt(n),r,i)},!1,!0))}}loadIfEnabled(){this.instance.config.disable_web_experiments||this.getWebExperimentsAndEvaluateDisplayLogic()}getWebExperiments(t,n,r){if(this.instance.config.disable_web_experiments&&!r)return t([]);var i=this.instance.get_property("$web_experiments");if(i&&!n)return t(i);this.instance._send_request({url:this.instance.requestRouter.endpointFor("api","/api/web_experiments/?token=".concat(this.instance.config.token)),method:"GET",callback:o=>{if(o.statusCode!==200||!o.json)return t([]);var s=o.json.experiments||[];return t(s)}})}showPreviewWebExperiment(t,n,r){var i=r.filter(o=>o.id===t);i&&i.length>0&&(Ir.logInfo("Previewing web experiment [".concat(i[0].name,"] with variant [").concat(n,"]")),this.applyTransforms(i[0].name,n,i[0].variants[n].transforms))}static matchesTestVariant(t){return!Wt(t.conditions)&&Ir.matchUrlConditions(t)&&Ir.matchUTMConditions(t)}static matchUrlConditions(t){var n;if(Wt(t.conditions)||Wt((n=t.conditions)===null||n===void 0?void 0:n.url))return!0;var r,i,o,s=Ir.getWindowLocation();return!!s&&((r=t.conditions)===null||r===void 0||!r.url||OW[(i=(o=t.conditions)===null||o===void 0?void 0:o.urlMatchType)!==null&&i!==void 0?i:"icontains"](t.conditions.url,s))}static getWindowLocation(){return ce==null?void 0:ce.location}static matchUTMConditions(t){var n;if(Wt(t.conditions)||Wt((n=t.conditions)===null||n===void 0?void 0:n.utm))return!0;var r=Sn.campaignParams();if(r.utm_source){var i,o,s,u,c,d,p,h,m,v,_,x,b,w,C,E,R=(i=t.conditions)===null||i===void 0||(o=i.utm)===null||o===void 0||!o.utm_campaign||((s=t.conditions)===null||s===void 0||(u=s.utm)===null||u===void 0?void 0:u.utm_campaign)==r.utm_campaign,O=(c=t.conditions)===null||c===void 0||(d=c.utm)===null||d===void 0||!d.utm_source||((p=t.conditions)===null||p===void 0||(h=p.utm)===null||h===void 0?void 0:h.utm_source)==r.utm_source,T=(m=t.conditions)===null||m===void 0||(v=m.utm)===null||v===void 0||!v.utm_medium||((_=t.conditions)===null||_===void 0||(x=_.utm)===null||x===void 0?void 0:x.utm_medium)==r.utm_medium,L=(b=t.conditions)===null||b===void 0||(w=b.utm)===null||w===void 0||!w.utm_term||((C=t.conditions)===null||C===void 0||(E=C.utm)===null||E===void 0?void 0:E.utm_term)==r.utm_term;return R&&T&&L&&O}return!1}static logInfo(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];Qe.info("[WebExperiments] ".concat(t),r)}applyTransforms(t,n,r){this._is_bot()?Ir.logInfo("Refusing to render web experiment since the viewer is a likely bot"):n!=="control"?r.forEach(i=>{if(i.selector){var o;Ir.logInfo("applying transform of variant ".concat(n," for experiment ").concat(t," "),i);var s=(o=document)===null||o===void 0?void 0:o.querySelectorAll(i.selector);s==null||s.forEach(u=>{var c=u;i.html&&(c.innerHTML=i.html),i.css&&c.setAttribute("style",i.css)})}}):Ir.logInfo("Control variants leave the page unmodified.")}_is_bot(){return ni&&this.instance?j3(ni,this.instance.config.custom_blocked_useragents):void 0}}var Vf={},DS=()=>{},wu="posthog",V3=!yW&&(qn==null?void 0:qn.indexOf("MSIE"))===-1&&(qn==null?void 0:qn.indexOf("Mozilla"))===-1,Z3=()=>{var e;return{api_host:"https://us.i.posthog.com",ui_host:null,token:"",autocapture:!0,rageclick:!0,cross_subdomain_cookie:LZ(He==null?void 0:He.location),persistence:"localStorage+cookie",persistence_name:"",loaded:DS,save_campaign_params:!0,custom_campaign_params:[],custom_blocked_useragents:[],save_referrer:!0,capture_pageview:!0,capture_pageleave:"if_capture_pageview",debug:Hr&&jn(Hr==null?void 0:Hr.search)&&Hr.search.indexOf("__posthog_debug=true")!==-1||!1,cookie_expiration:365,upgrade:!1,disable_session_recording:!1,disable_persistence:!1,disable_web_experiments:!0,disable_surveys:!1,disable_external_dependency_loading:!1,enable_recording_console_log:void 0,secure_cookie:(ce==null||(e=ce.location)===null||e===void 0?void 0:e.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:{},request_batching:!0,properties_string_max_length:65535,session_recording:{},mask_all_element_attributes:!1,mask_all_text:!1,mask_personal_data_properties:!1,custom_personal_data_properties:[],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,surveys_request_timeout_ms:1e4,on_request_error:t=>{var n="Bad HTTP status: "+t.statusCode+" "+t.text;Qe.error(n)},get_device_id:t=>t,capture_performance:void 0,name:"posthog",bootstrap:{},disable_compression:!1,session_idle_timeout_seconds:1800,person_profiles:"identified_only",before_send:void 0,request_queue_config:{flush_interval_ms:MS},_onCapture:DS}},Y3=e=>{var t={};Be(e.process_person)||(t.person_profiles=e.process_person),Be(e.xhr_headers)||(t.request_headers=e.xhr_headers),Be(e.cookie_name)||(t.persistence_name=e.cookie_name),Be(e.disable_cookie)||(t.disable_persistence=e.disable_cookie),Be(e.store_google)||(t.save_campaign_params=e.store_google),Be(e.verbose)||(t.debug=e.verbose);var n=Hn({},t,e);return kn(e.property_blacklist)&&(Be(e.property_denylist)?n.property_denylist=e.property_blacklist:kn(e.property_denylist)?n.property_denylist=[...e.property_blacklist,...e.property_denylist]:Qe.error("Invalid value for property_denylist config: "+e.property_denylist)),n};class TW{constructor(){Me(this,"__forceAllowLocalhost",!1)}get _forceAllowLocalhost(){return this.__forceAllowLocalhost}set _forceAllowLocalhost(t){Qe.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=t}}class Og{get decideEndpointWasHit(){var t,n;return(t=(n=this.featureFlags)===null||n===void 0?void 0:n.hasLoadedFlags)!==null&&t!==void 0&&t}constructor(){Me(this,"webPerformance",new TW),Me(this,"_personProcessingSetOncePropertiesSent",!1),Me(this,"version",Qo.LIB_VERSION),Me(this,"_internalEventEmitter",new N3),this.config=Z3(),this.SentryIntegration=FY,this.sentryIntegration=t=>function(n,r){var i=HM(n,r);return{name:jM,processEvent:o=>i(o)}}(this,t),this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this._initialPageviewCaptured=!1,this._initialPersonProfilesConfig=null,this._cachedPersonProperties=null,this.featureFlags=new aW(this),this.toolbar=new zY(this),this.scrollManager=new wW(this),this.pageViewManager=new ZY(this),this.surveys=new pW(this),this.experiments=new Ir(this),this.exceptions=new YY(this),this.rateLimiter=new gW(this),this.requestRouter=new RW(this),this.consent=new iY(this),this.people={set:(t,n,r)=>{var i=jn(t)?{[t]:n}:t;this.setPersonProperties(i),r==null||r({})},set_once:(t,n,r)=>{var i=jn(t)?{[t]:n}:t;this.setPersonProperties(void 0,i),r==null||r({})}},this.on("eventCaptured",t=>Qe.info('send "'.concat(t==null?void 0:t.event,'"'),t))}init(t,n,r){if(r&&r!==wu){var i,o=(i=Vf[r])!==null&&i!==void 0?i:new Og;return o._init(t,n,r),Vf[r]=o,Vf[wu][r]=o,o}return this._init(t,n,r)}_init(t){var n,r,i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},o=arguments.length>2?arguments[2]:void 0;if(Be(t)||R1(t))return Qe.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 Qe.warn("You have already initialized PostHog! Re-initializing is a no-op"),this;this.__loaded=!0,this.config={},this._triggered_notifs=[],i.person_profiles&&(this._initialPersonProfilesConfig=i.person_profiles),this.set_config(Hn({},Z3(),Y3(i),{name:o,token:t})),this.config.on_xhr_error&&Qe.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=i.disable_compression?void 0:Hi.GZipJS,this.persistence=new wS(this.config),this.sessionPersistence=this.config.persistence==="sessionStorage"||this.config.persistence==="memory"?this.persistence:new wS(pe(pe({},this.config),{},{persistence:"sessionStorage"}));var s=pe({},this.persistence.props),u=pe({},this.sessionPersistence.props);if(this._requestQueue=new _W(w=>this._send_retriable_request(w),this.config.request_queue_config),this._retryQueue=new SW(this),this.__request_queue=[],this.config.__preview_experimental_cookieless_mode||(this.sessionManager=new EW(this),this.sessionPropsManager=new CW(this,this.sessionManager,this.persistence)),new jY(this).startIfEnabledOrStop(),this.siteApps=new AW(this),(n=this.siteApps)===null||n===void 0||n.init(),this.config.__preview_experimental_cookieless_mode||(this.sessionRecording=new PY(this),this.sessionRecording.startIfEnabledOrStop()),this.config.disable_scroll_properties||this.scrollManager.startMeasuringScrollPosition(),this.autocapture=new WZ(this),this.autocapture.startIfEnabled(),this.surveys.loadIfEnabled(),this.heatmaps=new VY(this),this.heatmaps.startIfEnabled(),this.webVitalsAutocapture=new HY(this),this.exceptionObserver=new sY(this),this.exceptionObserver.startIfEnabled(),this.deadClicksAutocapture=new bM(this,aY),this.deadClicksAutocapture.startIfEnabled(),Qo.DEBUG=Qo.DEBUG||this.config.debug,Qo.DEBUG&&Qe.info("Starting in debug mode",{this:this,config:i,thisC:pe({},this.config),p:s,s:u}),this._sync_opt_out_with_persistence(),((r=i.bootstrap)===null||r===void 0?void 0:r.distinctID)!==void 0){var c,d,p=this.config.get_device_id(Za()),h=(c=i.bootstrap)!==null&&c!==void 0&&c.isIdentifiedID?p:i.bootstrap.distinctID;this.persistence.set_property(Xo,(d=i.bootstrap)!==null&&d!==void 0&&d.isIdentifiedID?"identified":"anonymous"),this.register({distinct_id:i.bootstrap.distinctID,$device_id:h})}if(this._hasBootstrappedFeatureFlags()){var m,v,_=Object.keys(((m=i.bootstrap)===null||m===void 0?void 0:m.featureFlags)||{}).filter(w=>{var C,E;return!((C=i.bootstrap)===null||C===void 0||(E=C.featureFlags)===null||E===void 0||!E[w])}).reduce((w,C)=>{var E,R;return w[C]=((E=i.bootstrap)===null||E===void 0||(R=E.featureFlags)===null||R===void 0?void 0:R[C])||!1,w},{}),x=Object.keys(((v=i.bootstrap)===null||v===void 0?void 0:v.featureFlagPayloads)||{}).filter(w=>_[w]).reduce((w,C)=>{var E,R,O,T;return(E=i.bootstrap)!==null&&E!==void 0&&(R=E.featureFlagPayloads)!==null&&R!==void 0&&R[C]&&(w[C]=(O=i.bootstrap)===null||O===void 0||(T=O.featureFlagPayloads)===null||T===void 0?void 0:T[C]),w},{});this.featureFlags.receivedFeatureFlags({featureFlags:_,featureFlagPayloads:x})}if(this.config.__preview_experimental_cookieless_mode)this.register_once({distinct_id:tM,$device_id:null},"");else if(!this.get_distinct_id()){var b=this.config.get_device_id(Za());this.register_once({distinct_id:b,$device_id:b},""),this.persistence.set_property(Xo,"anonymous")}return $n(ce,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),this.toolbar.maybeLoadToolbar(),i.segment?BY(this,()=>this._loaded()):this._loaded(),Gi(this.config._onCapture)&&this.config._onCapture!==DS&&(Qe.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",w=>this.config._onCapture(w.event,w))),this}_onRemoteConfig(t){var n,r,i,o,s,u,c,d;if(!He||!He.body)return Qe.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout(()=>{this._onRemoteConfig(t)},500);this.compression=void 0,t.supportedCompression&&!this.config.disable_compression&&(this.compression=kt(t.supportedCompression,Hi.GZipJS)?Hi.GZipJS:kt(t.supportedCompression,Hi.Base64)?Hi.Base64:void 0),(n=t.analytics)!==null&&n!==void 0&&n.endpoint&&(this.analyticsDefaultEndpoint=t.analytics.endpoint),this.set_config({person_profiles:this._initialPersonProfilesConfig?this._initialPersonProfilesConfig:"identified_only"}),(r=this.siteApps)===null||r===void 0||r.onRemoteConfig(t),(i=this.sessionRecording)===null||i===void 0||i.onRemoteConfig(t),(o=this.autocapture)===null||o===void 0||o.onRemoteConfig(t),(s=this.heatmaps)===null||s===void 0||s.onRemoteConfig(t),this.surveys.onRemoteConfig(t),(u=this.webVitalsAutocapture)===null||u===void 0||u.onRemoteConfig(t),(c=this.exceptionObserver)===null||c===void 0||c.onRemoteConfig(t),(d=this.deadClicksAutocapture)===null||d===void 0||d.onRemoteConfig(t)}_loaded(){try{this.config.loaded(this)}catch(t){Qe.critical("`loaded` function failed",t)}this._start_queue_if_opted_in(),this.config.capture_pageview&&setTimeout(()=>{this.consent.isOptedIn()&&this._captureInitialPageview()},1),new mW(this).load(),this.featureFlags.decide()}_start_queue_if_opted_in(){var t;this.has_opted_out_capturing()||this.config.request_batching&&((t=this._requestQueue)===null||t===void 0||t.enable())}_dom_loaded(){this.has_opted_out_capturing()||Ga(this.__request_queue,t=>this._send_retriable_request(t)),this.__request_queue=[],this._start_queue_if_opted_in()}_handle_unload(){var t,n;this.config.request_batching?(this._shouldCapturePageleave()&&this.capture("$pageleave"),(t=this._requestQueue)===null||t===void 0||t.unload(),(n=this._retryQueue)===null||n===void 0||n.unload()):this._shouldCapturePageleave()&&this.capture("$pageleave",null,{transport:"sendBeacon"})}_send_request(t){this.__loaded&&(V3?this.__request_queue.push(t):this.rateLimiter.isServerRateLimited(t.batchKey)||(t.transport=t.transport||this.config.api_transport,t.url=Rg(t.url,{ip:this.config.ip?1:0}),t.headers=pe({},this.config.request_headers),t.compression=t.compression==="best-available"?this.compression:t.compression,t.fetchOptions=t.fetchOptions||this.config.fetch_options,(n=>{var r,i,o,s=pe({},n);s.timeout=s.timeout||6e4,s.url=Rg(s.url,{_:new Date().getTime().toString(),ver:Qo.LIB_VERSION,compression:s.compression});var u=(r=s.transport)!==null&&r!==void 0?r:"fetch",c=(i=(o=UT(Gf,d=>d.transport===u))===null||o===void 0?void 0:o.method)!==null&&i!==void 0?i:Gf[0].method;if(!c)throw new Error("No available transport method");c(s)})(pe(pe({},t),{},{callback:n=>{var r,i,o;this.rateLimiter.checkForLimiting(n),n.statusCode>=400&&((i=(o=this.config).on_request_error)===null||i===void 0||i.call(o,n)),(r=t.callback)===null||r===void 0||r.call(t,n)}}))))}_send_retriable_request(t){this._retryQueue?this._retryQueue.retriableRequest(t):this._send_request(t)}_execute_array(t){var n,r=[],i=[],o=[];Ga(t,u=>{u&&(n=u[0],kn(n)?o.push(u):Gi(u)?u.call(this):kn(u)&&n==="alias"?r.push(u):kn(u)&&n.indexOf("capture")!==-1&&Gi(this[n])?o.push(u):i.push(u))});var s=function(u,c){Ga(u,function(d){if(kn(d[0])){var p=c;rn(d,function(h){p=p[h[0]].apply(p,h.slice(1))})}else this[d[0]].apply(this,d.slice(1))},c)};s(r,this),s(i,this),s(o,this)}_hasBootstrappedFeatureFlags(){var t,n;return((t=this.config.bootstrap)===null||t===void 0?void 0:t.featureFlags)&&Object.keys((n=this.config.bootstrap)===null||n===void 0?void 0:n.featureFlags).length>0||!1}push(t){this._execute_array([t])}capture(t,n,r){var i;if(this.__loaded&&this.persistence&&this.sessionPersistence&&this._requestQueue){if(!this.consent.isOptedOut())if(!Be(t)&&jn(t)){if(this.config.opt_out_useragent_filter||!this._is_bot()){var o=r!=null&&r.skip_client_rate_limiting?void 0:this.rateLimiter.clientRateLimitContext();if(o==null||!o.isRateLimited){n!=null&&n.$current_url&&!jn(n==null?void 0:n.$current_url)&&(Qe.error("Invalid `$current_url` property provided to `posthog.capture`. Input must be a string. Ignoring provided value."),n==null||delete n.$current_url),this.sessionPersistence.update_search_keyword(),this.config.save_campaign_params&&this.sessionPersistence.update_campaign_params(),this.config.save_referrer&&this.sessionPersistence.update_referrer_info(),(this.config.save_campaign_params||this.config.save_referrer)&&this.persistence.set_initial_person_info();var s=new Date,u=(r==null?void 0:r.timestamp)||s,c=Za(),d={uuid:c,event:t,properties:this._calculate_event_properties(t,n||{},u,c)};o&&(d.properties.$lib_rate_limit_remaining_tokens=o.remainingTokens),r!=null&&r.$set&&(d.$set=r==null?void 0:r.$set);var p=this._calculate_set_once_properties(r==null?void 0:r.$set_once);p&&(d.$set_once=p),(d=DZ(d,r!=null&&r._noTruncate?null:this.config.properties_string_max_length)).timestamp=u,Be(r==null?void 0:r.timestamp)||(d.properties.$event_time_override_provided=!0,d.properties.$event_time_override_system_time=s);var h=pe(pe({},d.properties.$set),d.$set);if(cu(h)||this.setPersonPropertiesForFlags(h),!Wt(this.config.before_send)){var m=this._runBeforeSend(d);if(!m)return;d=m}this._internalEventEmitter.emit("eventCaptured",d);var v={method:"POST",url:(i=r==null?void 0:r._url)!==null&&i!==void 0?i:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),data:d,compression:"best-available",batchKey:r==null?void 0:r._batchKey};return!this.config.request_batching||r&&(r==null||!r._batchKey)||r!=null&&r.send_instantly?this._send_retriable_request(v):this._requestQueue.enqueue(v),d}Qe.critical("This capture call is ignored due to client rate limiting.")}}else Qe.error("No event name provided to posthog.capture")}else Qe.uninitializedWarning("posthog.capture")}_addCaptureHook(t){return this.on("eventCaptured",n=>t(n.event,n))}_calculate_event_properties(t,n,r,i){if(r=r||new Date,!this.persistence||!this.sessionPersistence)return n;var o=this.persistence.remove_event_timer(t),s=pe({},n);if(s.token=this.config.token,this.config.__preview_experimental_cookieless_mode&&(s.$cookieless_mode=!0),t==="$snapshot"){var u=pe(pe({},this.persistence.properties()),this.sessionPersistence.properties());return s.distinct_id=u.distinct_id,(!jn(s.distinct_id)&&!Dr(s.distinct_id)||R1(s.distinct_id))&&Qe.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),s}var c,d=Sn.properties({maskPersonalDataProperties:this.config.mask_personal_data_properties,customPersonalDataProperties:this.config.custom_personal_data_properties});if(this.sessionManager){var{sessionId:p,windowId:h}=this.sessionManager.checkAndGetSessionAndWindowId();s.$session_id=p,s.$window_id=h}this.sessionPropsManager&&Hn(s,this.sessionPropsManager.getSessionProps());try{var m,v;this.sessionRecording&&(s.$recording_status=this.sessionRecording.status,s.$sdk_debug_replay_internal_buffer_length=this.sessionRecording.buffer.data.length,s.$sdk_debug_replay_internal_buffer_size=this.sessionRecording.buffer.size),s.$sdk_debug_retry_queue_size=(m=this._retryQueue)===null||m===void 0||(v=m.queue)===null||v===void 0?void 0:v.length}catch(w){s.$sdk_debug_error_capturing_properties=String(w)}if(this.requestRouter.region===Ks.CUSTOM&&(s.$lib_custom_api_host=this.config.api_host),c=t==="$pageview"?this.pageViewManager.doPageView(r,i):t==="$pageleave"?this.pageViewManager.doPageLeave(r):this.pageViewManager.doEvent(),s=Hn(s,c),t==="$pageview"&&He&&(s.title=He.title),!Be(o)){var _=r.getTime()-o;s.$duration=parseFloat((_/1e3).toFixed(3))}qn&&this.config.opt_out_useragent_filter&&(s.$browser_type=this._is_bot()?"bot":"browser"),(s=Hn({},d,this.persistence.properties(),this.sessionPersistence.properties(),s)).$is_identified=this._isIdentified(),kn(this.config.property_denylist)?rn(this.config.property_denylist,function(w){delete s[w]}):Qe.error("Invalid value for property_denylist config: "+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);var x=this.config.sanitize_properties;x&&(Qe.error("sanitize_properties is deprecated. Use before_send instead"),s=x(s,t));var b=this._hasPersonProcessing();return s.$process_person_profile=b,b&&this._requirePersonProcessing("_calculate_event_properties"),s}_calculate_set_once_properties(t){var n;if(!this.persistence||!this._hasPersonProcessing()||this._personProcessingSetOncePropertiesSent)return t;var r=this.persistence.get_initial_props(),i=(n=this.sessionPropsManager)===null||n===void 0?void 0:n.getSetOnceProps(),o=Hn({},r,i||{},t||{}),s=this.config.sanitize_properties;return s&&(Qe.error("sanitize_properties is deprecated. Use before_send instead"),o=s(o,"$set_once")),this._personProcessingSetOncePropertiesSent=!0,cu(o)?void 0:o}register(t,n){var r;(r=this.persistence)===null||r===void 0||r.register(t,n)}register_once(t,n,r){var i;(i=this.persistence)===null||i===void 0||i.register_once(t,n,r)}register_for_session(t){var n;(n=this.sessionPersistence)===null||n===void 0||n.register(t)}unregister(t){var n;(n=this.persistence)===null||n===void 0||n.unregister(t)}unregister_for_session(t){var n;(n=this.sessionPersistence)===null||n===void 0||n.unregister(t)}_register_single(t,n){this.register({[t]:n})}getFeatureFlag(t,n){return this.featureFlags.getFeatureFlag(t,n)}getFeatureFlagPayload(t){var n=this.featureFlags.getFeatureFlagPayload(t);try{return JSON.parse(n)}catch{return n}}isFeatureEnabled(t,n){return this.featureFlags.isFeatureEnabled(t,n)}reloadFeatureFlags(){this.featureFlags.reloadFeatureFlags()}updateEarlyAccessFeatureEnrollment(t,n){this.featureFlags.updateEarlyAccessFeatureEnrollment(t,n)}getEarlyAccessFeatures(t){var n=arguments.length>1&&arguments[1]!==void 0&&arguments[1],r=arguments.length>2?arguments[2]:void 0;return this.featureFlags.getEarlyAccessFeatures(t,n,r)}on(t,n){return this._internalEventEmitter.on(t,n)}onFeatureFlags(t){return this.featureFlags.onFeatureFlags(t)}onSurveysLoaded(t){return this.surveys.onSurveysLoaded(t)}onSessionId(t){var n,r;return(n=(r=this.sessionManager)===null||r===void 0?void 0:r.onSessionId(t))!==null&&n!==void 0?n:()=>{}}getSurveys(t){var n=arguments.length>1&&arguments[1]!==void 0&&arguments[1];this.surveys.getSurveys(t,n)}getActiveMatchingSurveys(t){var n=arguments.length>1&&arguments[1]!==void 0&&arguments[1];this.surveys.getActiveMatchingSurveys(t,n)}renderSurvey(t,n){this.surveys.renderSurvey(t,n)}canRenderSurvey(t){return this.surveys.canRenderSurvey(t)}identify(t,n,r){if(!this.__loaded||!this.persistence)return Qe.uninitializedWarning("posthog.identify");if(Dr(t)&&(t=t.toString(),Qe.warn("The first argument to posthog.identify was a number, but it should be a string. It has been converted to a string.")),t){if(["distinct_id","distinctid"].includes(t.toLowerCase()))Qe.critical('The string "'.concat(t,'" 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 i=this.get_distinct_id();if(this.register({$user_id:t}),!this.get_property("$device_id")){var o=i;this.register_once({$had_persisted_distinct_id:!0,$device_id:o},"")}t!==i&&t!==this.get_property(If)&&(this.unregister(If),this.register({distinct_id:t}));var s=(this.persistence.get_property(Xo)||"anonymous")==="anonymous";t!==i&&s?(this.persistence.set_property(Xo,"identified"),this.setPersonPropertiesForFlags(pe(pe({},r||{}),n||{}),!1),this.capture("$identify",{distinct_id:t,$anon_distinct_id:i},{$set:n||{},$set_once:r||{}}),this._cachedPersonProperties=H3(t,n,r),this.featureFlags.setAnonymousDistinctId(i)):(n||r)&&this.setPersonProperties(n,r),t!==i&&(this.reloadFeatureFlags(),this.unregister(ag))}}else Qe.error("Unique user id has not been set in posthog.identify")}setPersonProperties(t,n){if((t||n)&&this._requirePersonProcessing("posthog.setPersonProperties")){var r=H3(this.get_distinct_id(),t,n);this._cachedPersonProperties!==r?(this.setPersonPropertiesForFlags(pe(pe({},n||{}),t||{})),this.capture("$set",{$set:t||{},$set_once:n||{}}),this._cachedPersonProperties=r):Qe.info("A duplicate setPersonProperties call was made with the same properties. It has been ignored.")}}group(t,n,r){if(t&&n){if(this._requirePersonProcessing("posthog.group")){var i=this.getGroups();i[t]!==n&&this.resetGroupPropertiesForFlags(t),this.register({$groups:pe(pe({},i),{},{[t]:n})}),r&&(this.capture("$groupidentify",{$group_type:t,$group_key:n,$group_set:r}),this.setGroupPropertiesForFlags({[t]:r})),i[t]===n||r||this.reloadFeatureFlags()}}else Qe.error("posthog.group requires a group type and group key")}resetGroups(){this.register({$groups:{}}),this.resetGroupPropertiesForFlags(),this.reloadFeatureFlags()}setPersonPropertiesForFlags(t){var n=!(arguments.length>1&&arguments[1]!==void 0)||arguments[1];this.featureFlags.setPersonPropertiesForFlags(t,n)}resetPersonPropertiesForFlags(){this.featureFlags.resetPersonPropertiesForFlags()}setGroupPropertiesForFlags(t){var n=!(arguments.length>1&&arguments[1]!==void 0)||arguments[1];this._requirePersonProcessing("posthog.setGroupPropertiesForFlags")&&this.featureFlags.setGroupPropertiesForFlags(t,n)}resetGroupPropertiesForFlags(t){this.featureFlags.resetGroupPropertiesForFlags(t)}reset(t){var n,r,i,o;if(Qe.info("reset"),!this.__loaded)return Qe.uninitializedWarning("posthog.reset");var s=this.get_property("$device_id");if(this.consent.reset(),(n=this.persistence)===null||n===void 0||n.clear(),(r=this.sessionPersistence)===null||r===void 0||r.clear(),this.surveys.reset(),(i=this.persistence)===null||i===void 0||i.set_property(Xo,"anonymous"),(o=this.sessionManager)===null||o===void 0||o.resetSessionId(),this._cachedPersonProperties=null,this.config.__preview_experimental_cookieless_mode)this.register_once({distinct_id:tM,$device_id:null},"");else{var u=this.config.get_device_id(Za());this.register_once({distinct_id:u,$device_id:t?u:s},"")}this.register({$last_posthog_reset:new Date().toISOString()},1)}get_distinct_id(){return this.get_property("distinct_id")}getGroups(){return this.get_property("$groups")||{}}get_session_id(){var t,n;return(t=(n=this.sessionManager)===null||n===void 0?void 0:n.checkAndGetSessionAndWindowId(!0).sessionId)!==null&&t!==void 0?t:""}get_session_replay_url(t){if(!this.sessionManager)return"";var{sessionId:n,sessionStartTimestamp:r}=this.sessionManager.checkAndGetSessionAndWindowId(!0),i=this.requestRouter.endpointFor("ui","/project/".concat(this.config.token,"/replay/").concat(n));if(t!=null&&t.withTimestamp&&r){var o,s=(o=t.timestampLookBack)!==null&&o!==void 0?o:10;if(!r)return i;var u=Math.max(Math.floor((new Date().getTime()-r)/1e3)-s,0);i+="?t=".concat(u)}return i}alias(t,n){return t===this.get_property(zT)?(Qe.critical("Attempting to create alias for existing People user - aborting."),-2):this._requirePersonProcessing("posthog.alias")?(Be(n)&&(n=this.get_distinct_id()),t!==n?(this._register_single(If,t),this.capture("$create_alias",{alias:t,distinct_id:n})):(Qe.warn("alias matches current distinct_id - skipping api call."),this.identify(t),-1)):void 0}set_config(t){var n,r,i,o,s=pe({},this.config);An(t)&&(Hn(this.config,Y3(t)),(n=this.persistence)===null||n===void 0||n.update_config(this.config,s),this.sessionPersistence=this.config.persistence==="sessionStorage"||this.config.persistence==="memory"?this.persistence:new wS(pe(pe({},this.config),{},{persistence:"sessionStorage"})),Qn.is_supported()&&Qn.get("ph_debug")==="true"&&(this.config.debug=!0),this.config.debug&&(Qo.DEBUG=!0,Qe.info("set_config",JSON.stringify({config:t,oldConfig:s,newConfig:pe({},this.config)},null,2))),(r=this.sessionRecording)===null||r===void 0||r.startIfEnabledOrStop(),(i=this.autocapture)===null||i===void 0||i.startIfEnabled(),(o=this.heatmaps)===null||o===void 0||o.startIfEnabled(),this.surveys.loadIfEnabled(),this._sync_opt_out_with_persistence())}startSessionRecording(t){var n=t===!0,r={sampling:n||!(t==null||!t.sampling),linked_flag:n||!(t==null||!t.linked_flag),url_trigger:n||!(t==null||!t.url_trigger),event_trigger:n||!(t==null||!t.event_trigger)};if(Object.values(r).some(Boolean)){var i,o,s,u,c;(i=this.sessionManager)===null||i===void 0||i.checkAndGetSessionAndWindowId(),r.sampling&&((o=this.sessionRecording)===null||o===void 0||o.overrideSampling()),r.linked_flag&&((s=this.sessionRecording)===null||s===void 0||s.overrideLinkedFlag()),r.url_trigger&&((u=this.sessionRecording)===null||u===void 0||u.overrideTrigger("url")),r.event_trigger&&((c=this.sessionRecording)===null||c===void 0||c.overrideTrigger("event"))}this.set_config({disable_session_recording:!1})}stopSessionRecording(){this.set_config({disable_session_recording:!0})}sessionRecordingStarted(){var t;return!((t=this.sessionRecording)===null||t===void 0||!t.started)}captureException(t,n){var r=new Error("PostHog syntheticException");this.exceptions.sendExceptionEvent(pe(pe({},_Y((i=>i instanceof Error)(t)?{error:t,event:t.message}:{event:t},{syntheticException:r})),n))}loadToolbar(t){return this.toolbar.loadToolbar(t)}get_property(t){var n;return(n=this.persistence)===null||n===void 0?void 0:n.props[t]}getSessionProperty(t){var n;return(n=this.sessionPersistence)===null||n===void 0?void 0:n.props[t]}toString(){var t,n=(t=this.config.name)!==null&&t!==void 0?t:wu;return n!==wu&&(n=wu+"."+n),n}_isIdentified(){var t,n;return((t=this.persistence)===null||t===void 0?void 0:t.get_property(Xo))==="identified"||((n=this.sessionPersistence)===null||n===void 0?void 0:n.get_property(Xo))==="identified"}_hasPersonProcessing(){var t,n,r,i;return!(this.config.person_profiles==="never"||this.config.person_profiles==="identified_only"&&!this._isIdentified()&&cu(this.getGroups())&&((t=this.persistence)===null||t===void 0||(n=t.props)===null||n===void 0||!n[If])&&((r=this.persistence)===null||r===void 0||(i=r.props)===null||i===void 0||!i[sg]))}_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(t){return this.config.person_profiles==="never"?(Qe.error(t+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this._register_single(sg,!0),!0)}_sync_opt_out_with_persistence(){var t,n,r,i,o=this.consent.isOptedOut(),s=this.config.opt_out_persistence_by_default,u=this.config.disable_persistence||o&&!!s;((t=this.persistence)===null||t===void 0?void 0:t.disabled)!==u&&((r=this.persistence)===null||r===void 0||r.set_disabled(u)),((n=this.sessionPersistence)===null||n===void 0?void 0:n.disabled)!==u&&((i=this.sessionPersistence)===null||i===void 0||i.set_disabled(u))}opt_in_capturing(t){var n;this.consent.optInOut(!0),this._sync_opt_out_with_persistence(),(Be(t==null?void 0:t.captureEventName)||t!=null&&t.captureEventName)&&this.capture((n=t==null?void 0:t.captureEventName)!==null&&n!==void 0?n:"$opt_in",t==null?void 0:t.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 ni?j3(ni,this.config.custom_blocked_useragents):void 0}_captureInitialPageview(){He&&!this._initialPageviewCaptured&&(this._initialPageviewCaptured=!0,this.capture("$pageview",{title:He.title},{send_instantly:!0}))}debug(t){t===!1?(ce==null||ce.console.log("You've disabled debug mode."),localStorage&&localStorage.removeItem("ph_debug"),this.set_config({debug:!1})):(ce==null||ce.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(t){if(Wt(this.config.before_send))return t;var n=kn(this.config.before_send)?this.config.before_send:[this.config.before_send],r=t;for(var i of n){if(r=i(r),Wt(r)){var o="Event '".concat(t.event,"' was rejected in beforeSend function");return OZ(t.event)?Qe.warn("".concat(o,". This can cause unexpected behavior.")):Qe.info(o),null}r.properties&&!cu(r.properties)||Qe.warn("Event '".concat(t.event,"' has no properties after beforeSend function, this is likely an error."))}return r}getPageViewId(){var t;return(t=this.pageViewManager._currentPageview)===null||t===void 0?void 0:t.pageViewId}captureTraceFeedback(t,n){this.capture("$ai_feedback",{$ai_trace_id:String(t),$ai_feedback_text:n})}captureTraceMetric(t,n,r){this.capture("$ai_metric",{$ai_trace_id:String(t),$ai_metric_name:n,$ai_metric_value:String(r)})}}(function(e,t){for(var n=0;n<t.length;n++)e.prototype[t[n]]=MZ(e.prototype[t[n]])})(Og,["identify"]);var W3,xi=(W3=Vf[wu]=new Og,function(){function e(){e.done||(e.done=!0,V3=!1,rn(Vf,function(t){t._dom_loaded()}))}He!=null&&He.addEventListener?He.readyState==="complete"?e():$n(He,"DOMContentLoaded",e,{capture:!1}):ce&&Qe.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")}(),W3),K3=W.createContext({client:xi});function Q3(e,t,n){if(n===void 0&&(n=new WeakMap),e===t)return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;if(n.has(e)&&n.get(e)===t)return!0;n.set(e,t);var r=Object.keys(e),i=Object.keys(t);if(r.length!==i.length)return!1;for(var o=0,s=r;o<s.length;o++){var u=s[o];if(!i.includes(u)||!Q3(e[u],t[u],n))return!1}return!0}function MW(e){var t=e.children,n=e.client,r=e.apiKey,i=e.options,o=W.useState(!1),s=o[0],u=o[1],c=W.useMemo(function(){return n?(r&&console.warn("[PostHog.js] You have provided both `client` and `apiKey` to `PostHogProvider`. `apiKey` will be ignored in favour of `client`."),i&&console.warn("[PostHog.js] You have provided both `client` and `options` to `PostHogProvider`. `options` will be ignored in favour of `client`."),n):r?s!==!1?(r!==s.previousAPIKey&&console.warn("[PostHog.js] You have provided a different `apiKey` to `PostHogProvider` than the one that was already initialized. This is not supported by our provider and we'll keep using the previous key. If you need to toggle between API Keys you need to control the `client` yourself and pass it in as a prop rather than an `apiKey` prop."),i&&!Q3(i,s.previousOptions)&&xi.set_config(i),u({previousAPIKey:r,previousOptions:i??{}}),xi):(xi.__loaded&&console.warn("[PostHog.js] `posthog` was already loaded elsewhere. This may cause issues."),xi.init(r,i),u({previousAPIKey:r,previousOptions:i??{}}),xi):(console.warn("[PostHog.js] No `apiKey` or `client` were provided to `PostHogProvider`. Using default global `window.posthog` instance. You must initialize it manually. This is not recommended behavior."),xi)},[n,r,JSON.stringify(i)]);return Tn.createElement(K3.Provider,{value:{client:c}},t)}var X3=function(){var e=W.useContext(K3).client;return e};function $S(e){var t=X3(),n=W.useState(function(){return t.isFeatureEnabled(e)}),r=n[0],i=n[1];return W.useEffect(function(){return t.onFeatureFlags(function(){i(t.isFeatureEnabled(e))})},[t,e]),r}function DW(e){var t=X3(),n=W.useState(function(){return t.getFeatureFlagPayload(e)}),r=n[0],i=n[1];return W.useEffect(function(){return t.onFeatureFlags(function(){i(t.getFeatureFlagPayload(e))})},[t,e]),r}function $W(e){KE(e,[/\r?\n|\r/g,LW])}function LW(){return{type:"break"}}function NW(){return function(e){$W(e)}}const un={OPEN_STATE_CHANGE:"open_state_change",CHAT_BUTTON_CLICKED:"Chat button clicked",USER_FORM_FILLED:"User form filled",ADD_BULK_ITEM:"Add bulk item",USER_FORM_CLOSE:"user_form_close",CHECKOUT_CLICKED:"Checkout Clicked",ADD_TO_CART_CLICKED:"add to cart clicked",SUGGESTED_QUESTION_CLICKED:"Suggested Question Clicked",INITIAL_LEADING_QUERY_SUGGESTED_QUESTION_CLICKED:"Initial Leading Query Suggested Question Clicked",LEADING_QUERY_CLICKED:"Leading Query Clicked",COLLECTION_VIDEO_CLICKED:"Collection Video Clicked",COLLECTION_IMAGE_CLICKED:"Collection Image Clicked",VIEW_PRODUCT_CLICKED:"view product clicked",PRODUCT_VIDEO_CLICKED:"Product Video Clicked",PRODUCT_IMAGE_CLICKED:"Product Image Clicked",SHOW_SIMILAR_CLICKED:"show similar clicked",CHAT_MESSAGE_SENT:"chat_message_sent",CHAT_MESSAGE_TYPING_STARTED:"chat_message_typing_started",CHAT_MESSAGE_TYPING_ENDED:"chat_message_typing_ended",DISCOUNT_VIEWED:"discount_viewed"},Ci={OPEN_STATE_CHANGE:"open_state_change"},PW=e=>{window.DebalesChat||(window.DebalesChat={isOpen:!1,projectId:e,getSessionId:()=>ur(),getChatId:()=>ur()+"_"+e,getAnonId:()=>Us.getAnonId(),isIdentified:()=>{if(xi._isIdentified())return!0;const t=ho();return!!(t&&t.email)},getIdentifiedUser:()=>ho(),getDistinctId:()=>xi.get_distinct_id(),getOldDistinctId:()=>Us.getDistinctId(),debug:!1,identify:(t,n)=>{xi._isIdentified()||xi.identify(t,{...n,project:e}),Us.identify(t,n),qp({email:t,name:n==null?void 0:n.name,phone:n==null?void 0:n.phone})},track:(t,n)=>{Us.track(t,{...n,sessionId:window.DebalesChat.getSessionId()}),xi.capture(t,{...n}),uZ(t,{...n,sessionId:ur(),projectId:e})},onOpenChange:t=>{const n=r=>{t(r.detail.isOpen)};return window.addEventListener(Ci.OPEN_STATE_CHANGE,n),()=>window.removeEventListener(Ci.OPEN_STATE_CHANGE,n)},removeOpenChangeListener:t=>{const n=r=>{t(r.detail.isOpen)};window.removeEventListener(Ci.OPEN_STATE_CHANGE,n)},open:()=>{window.DebalesChat.isOpen||window.dispatchEvent(new CustomEvent(Ci.OPEN_STATE_CHANGE,{detail:{isOpen:!0,projectId:e}}))},close:()=>{window.DebalesChat.isOpen&&window.dispatchEvent(new CustomEvent(Ci.OPEN_STATE_CHANGE,{detail:{isOpen:!1,projectId:e}}))},toggle:()=>{window.dispatchEvent(new CustomEvent(Ci.OPEN_STATE_CHANGE,{detail:{isOpen:!window.DebalesChat.isOpen,projectId:e}}))}})};var hr=(e=>(e.DEFAULT="DEFAULT",e.SHOPIFY="SHOPIFY",e.WOOCOMMERCE="WOOCOMMERCE",e.MAGENTO="MAGENTO",e.UNKNOWN="UNKNOWN",e))(hr||{});class Zf{static detect(){var t,n,r,i,o,s;if(typeof window<"u"&&window.Shopify!==void 0&&window.Shopify.routes!==void 0)return hr.SHOPIFY;if(typeof window<"u"&&document.body.classList.contains("woocommerce"))return hr.WOOCOMMERCE;if(typeof window<"u"){if(window.MAGENTO_VERSION!==void 0||window.MAGE!==void 0||window.Mage!==void 0||["page-wrapper","magento-theme","catalog-product-view","catalog-category-view"].some(h=>document.body.classList.contains(h)))return hr.MAGENTO;const c=document.getElementsByTagName("script");for(const h of Array.from(c))if(h.src.includes("mage/")||h.src.includes("magento")||(t=h.textContent)!=null&&t.includes("Mage.")||(n=h.textContent)!=null&&n.includes("require(")||(r=h.getAttribute("data-requiremodule"))!=null&&r.startsWith("mage")||(i=h.getAttribute("data-requiremodule"))!=null&&i.startsWith("Magento"))return hr.MAGENTO;if(document.cookie.split(";").some(h=>h.trim().startsWith("mage-")||h.trim().startsWith("form_key")))return hr.MAGENTO;const p=document.getElementsByTagName("meta");for(const h of Array.from(p))if((o=h.getAttribute("content"))!=null&&o.includes("Magento")||(s=h.getAttribute("name"))!=null&&s.includes("magento"))return hr.MAGENTO}return hr.UNKNOWN}}const BW=se.button`
|
|
@@ -2320,8 +2320,8 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
2320
2320
|
margin-top: 16px;
|
|
2321
2321
|
display: flex;
|
|
2322
2322
|
justify-content: flex-end;
|
|
2323
|
-
`,Oee=({botId:e})=>{var Xn,Ki;const{uiData:t,storeMetaData:n,onSendMessage:r,isKlaviyoMessage:i,isLoading:o,lastedBotmessageId:s,setLastedBotmessageId:u,messages:c,isMessageLoading:d,setIsMessageLoading:p,setMessages:h,saveConversation:m,changeDisplayModel:v,loadConversation:_,suggestedQuestions:x,setSuggestedQuestions:b,showUserInfoModel:w,setShowUserInfoModel:C}=HW(),{cart:E,addToCart:R,generateCartUrl:O,addCartAttributes:T}=uT(),L=DW("use-chatbot-icon-size"),B=Zf.detect(),z=t==null?void 0:t.isLeft,P=jW(),V=t==null?void 0:t.heightOption,[J,le]=W.useState(!1);W.useEffect(()=>{const X=()=>{le(window.matchMedia("(max-width: 768px)").matches)};return X(),window.addEventListener("resize",X),()=>window.removeEventListener("resize",X)},[]);const[G,Z]=W.useState(!1),[q,H]=W.useState(!1),[fe,we]=W.useState(""),[k,ne]=W.useState(""),[,de]=W.useState(0);W.useEffect(()=>{e&&PW(e)},[e]),W.useEffect(()=>{lZ(e)},[e]),W.useEffect(()=>{let X=ho();if(!X&&window.Thinkific){const qe=window.Thinkific.current_user;qe&&(X={name:qe.full_name,email:qe.email},qp(X))}Us.init({projectName:e,debug:!0,testing:aT}),X&&X.email&&(window.DebalesChat.identify(X.email,{name:X.name,phone:X.phone,email:X.email}),t!=null&&t.KlaviyoIntegration&&window.klaviyo&&window.klaviyo.identify({email:X.email,first_name:X.name,phone:X.phone,from:"Debales-Chatbot"}))},[e,t==null?void 0:t.KlaviyoIntegration]);const D=W.useRef(null),ue=yi(e,pi.CLICKED_QUESTIONS),[Re,ie]=W.useState(()=>{try{const X=sessionStorage.getItem(ue);return X?new Set(JSON.parse(X)):new Set}catch{return new Set}});W.useEffect(()=>{try{sessionStorage.setItem(ue,JSON.stringify(Array.from(Re)))}catch(X){console.error("Failed to save to sessionStorage:",X)}},[Re]);const Ne=W.useCallback((X,qe)=>{X?(window.dispatchEvent(new CustomEvent(Ci.OPEN_STATE_CHANGE,{detail:{isOpen:X,source:qe,projectId:e}})),setTimeout(()=>{H(!0)},50)):(H(!1),window.dispatchEvent(new CustomEvent(Ci.OPEN_STATE_CHANGE,{detail:{isOpen:X,source:qe,projectId:e}})))},[]);W.useEffect(()=>{const X=qe=>{Z(qe.detail.isOpen),qe.detail.isOpen&&setTimeout(()=>H(!0),50),window.DebalesChat.isOpen=qe.detail.isOpen,window.DebalesChat.track(un.OPEN_STATE_CHANGE,{isOpen:qe.detail.isOpen,source:qe.detail.source})};return window.addEventListener(Ci.OPEN_STATE_CHANGE,X),()=>{window.removeEventListener(Ci.OPEN_STATE_CHANGE,X)}},[]),W.useEffect(()=>{const X=qe=>{Z(qe.detail.isOpen),window.DebalesChat.isOpen=qe.detail.isOpen,window.DebalesChat.track(un.OPEN_STATE_CHANGE,{isOpen:qe.detail.isOpen})};return window.addEventListener(Ci.OPEN_STATE_CHANGE,X),()=>{window.removeEventListener(Ci.OPEN_STATE_CHANGE,X)}},[]);const[De,Fe]=W.useState(!1),[We,Pe]=W.useState(null),[be,Ke]=W.useState(()=>{const X=yi(e,pi.PENDING_BULK_ITEMS),qe=sessionStorage.getItem(X);return qe?JSON.parse(qe):[]});W.useEffect(()=>{const X=yi(e,pi.PENDING_BULK_ITEMS);sessionStorage.setItem(X,JSON.stringify(be))},[be,e]);const[Je,dt]=W.useState(!1),[tt,lt]=W.useState({name:"",email:"",message:""}),N=$S("exit_model"),[F,K]=W.useState({text:!0,leadingQueries:!0,collections:!0,products:!0,variants:!0,cartSummary:!0,bulkItems:!0}),[me,_e]=W.useState(!1),[Se,Ye]=W.useState(!0),Xe=W.useCallback(X=>{const qe=X.target,ot=qe.scrollHeight-qe.scrollTop<=qe.clientHeight+0;Ye(ot)},[]);W.useEffect(()=>{var X,qe,ot,ut,$e,Tt;if(c.length>0&&!d){const Mt=c[c.length-1],Nn=sessionStorage.getItem(yi(e,pi.LAST_SHOWN_MESSAGE_ID)),Ri=Mt.isBot&&Mt.conversationId===s&&Mt.conversationId!==Nn,Eo=(E==null?void 0:E.itemCount)&&(E==null?void 0:E.itemCount)>0&&Mt.conversationId===s;if(Ri){_e(!0),sessionStorage.setItem(yi(e,pi.LAST_SHOWN_MESSAGE_ID),Mt.conversationId||""),K({text:!0,leadingQueries:!1,collections:!1,products:!1,variants:!1,cartSummary:!1,bulkItems:!1});const vn=1600;let nl=vn;const es=[{type:"collections",condition:((X=Mt.collections)==null?void 0:X.length)&&((qe=Mt.collections)==null?void 0:qe.length)>0},{type:"products",condition:((ot=Mt.products)==null?void 0:ot.length)&&((ut=Mt.products)==null?void 0:ut.length)>0},{type:"leadingQueries",condition:(($e=Mt.leading_queries)==null?void 0:$e.length)&&((Tt=Mt.leading_queries)==null?void 0:Tt.length)>0},{type:"cartSummary",condition:(E==null?void 0:E.itemCount)&&(E==null?void 0:E.itemCount)>0},{type:"bulkItems",condition:(be==null?void 0:be.length)>0}].filter(ri=>ri.condition);if(es.length===0){_e(!1);return}es.forEach(({type:ri},ko)=>{setTimeout(()=>{if(K(Ao=>({...Ao,[ri]:!0})),Se&&D.current){const Ao=D.current;Ao.scrollHeight-Ao.scrollTop<=Ao.clientHeight&&jp(D)}ko===es.length-1&&_e(!1)},nl),nl+=vn})}else Eo&&K(vn=>({...vn,cartSummary:!0}))}},[c,d,s,E==null?void 0:E.itemCount,be==null?void 0:be.length,Se,e]),W.useEffect(()=>{if(!i&&c.length>0){const X=D.current;X&&Se&&X.scrollHeight-X.scrollTop<=X.clientHeight+100&&setTimeout(()=>jp(D),100)}},[c.length,i,Se]),W.useEffect(()=>{const X=document.querySelector('meta[name="viewport"]'),qe=X==null?void 0:X.content;if(G){let ot=X;const ut=window.matchMedia("(max-width: 768px)").matches;ot?ot.content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no":(ot=document.createElement("meta"),ot.name="viewport",ot.content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no",document.head.appendChild(ot)),ut&&(t==null?void 0:t.mobileDisplayMode)==="full-screen"&&(document.body.style.overflow="hidden");const $e=ot;return()=>{qe&&$e&&($e.content=qe),ut&&(t==null?void 0:t.mobileDisplayMode)==="full-screen"&&(document.body.style.overflow="")}}return()=>{window.matchMedia("(max-width: 768px)").matches&&(t==null?void 0:t.mobileDisplayMode)==="full-screen"&&(document.body.style.overflow="")}},[G,t==null?void 0:t.mobileDisplayMode]),W.useEffect(()=>{if(G&&window.matchMedia("(max-width: 768px)").matches&&(t==null?void 0:t.mobileDisplayMode)==="full-screen"){const X=qe=>{let ot=qe.target,ut=!1;const $e=D.current;if($e){for(;ot&&ot!==document.body;){if(ot===$e){ut=!0;break}if(ot.parentNode)ot=ot.parentNode;else break}if(!ut)qe.preventDefault();else{const Tt=$e.scrollTop<=0,Mt=$e.scrollTop+$e.clientHeight>=$e.scrollHeight-5;if(Tt&&qe.touches[0].clientY>0||Mt&&qe.touches[0].clientY<0)return}}};return document.addEventListener("touchmove",X,{passive:!1}),()=>{document.removeEventListener("touchmove",X)}}return()=>{}},[G,t==null?void 0:t.mobileDisplayMode,D]),W.useEffect(()=>{const X=setTimeout(()=>{Fe(!0)},1e3);return()=>clearTimeout(X)},[]),W.useEffect(()=>{i||setTimeout(()=>jp(D),100)},[c.length,i]),W.useEffect(()=>{E!=null&&E.itemCount&&E.itemCount===0&&!i&&setTimeout(()=>jp(D),100)},[E==null?void 0:E.itemCount,i]),W.useEffect(()=>{s&&sessionStorage.setItem(yi(e,pi.LAST_SHOWN_MESSAGE_ID),s)},[s,e]);const Q=W.useRef(Date.now()),he=W.useRef(0),ze=W.useRef(window.location.pathname),je=W.useRef(x),nt=W.useRef(!1),jt=$S("acquisition_agent");W.useEffect(()=>{je.current=x},[x]);const on=W.useCallback(async()=>{const X=Date.now();if(X-Q.current>=6e3&&X-he.current>=6e4&&!nt.current)try{nt.current=!0,console.log("fetching acquisition data");const ut=await fetch(`${fo}/api/wordpress/acquisition`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({timeZone:Intl.DateTimeFormat().resolvedOptions().timeZone,timestamp:new Date().toISOString(),page_information:window.location.href.split("?")[0],botid:e})});if(ut.ok){const $e=await ut.json(),Mt=[...je.current.filter(Nn=>Nn.path!==ze.current),{question:$e.greetings,answer:"",path:ze.current,nameSpace:e,type:"dynamic"}];b(Mt)}he.current=X}catch(ut){console.error("Error fetching acquisition data:",ut)}finally{nt.current=!1}},[e]);W.useEffect(()=>{if(!jt||(t==null?void 0:t.show_bot)===!1)return;const X=()=>{Q.current=Date.now()};document.addEventListener("mousemove",X),document.addEventListener("mousedown",X),document.addEventListener("keypress",X),document.addEventListener("scroll",X),document.addEventListener("touchstart",X),document.addEventListener("touchmove",X);const qe=setInterval(on,1e3),ot=()=>{const $e=window.location.pathname.split("?")[0],Tt=ze.current.split("?")[0];(()=>{const Nn=Tt.split("/").filter(Boolean),Ri=$e.split("/").filter(Boolean);return Nn.length!==Ri.length?!0:Nn.length===0&&Ri.length===0?!1:$e!==Tt})()&&(ze.current=$e,Q.current=Date.now())};return window.addEventListener("popstate",ot),()=>{document.removeEventListener("mousemove",X),document.removeEventListener("mousedown",X),document.removeEventListener("keypress",X),document.removeEventListener("scroll",X),document.removeEventListener("touchstart",X),document.removeEventListener("touchmove",X),window.removeEventListener("popstate",ot),clearInterval(qe)}},[jt,on,t==null?void 0:t.show_bot]);const[Ft,cn]=W.useState(!1),[it,St]=W.useState(!1),[Ge,_t]=W.useState(null),Wi=async X=>{const qe=ur();if(H(!1),X&&c.length>1)try{(await fetch(`${fo}/api/wordpress/userRating`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sessionId:qe,userRating:X,nameSpace:e})})).ok||console.error("Error submitting rating")}catch(ot){console.error("Error submitting rating:",ot)}setTimeout(()=>{St(!1),Ne(!1,"close_button_clicked")},1e3)},bo=X=>{p(!0),be.forEach(ot=>{R(ot.id,ot.quantity)}),window.DebalesChat.track(un.ADD_BULK_ITEM,{products:be,message:X});const qe=[...c,{text:"🎉 Bulk items added to cart successfully.",leading_queries:["Get GST Invoice for the order","Explore more products"],conversationId:X,isBot:!0}];h(qe),m(qe),u(X),Ke([]),p(!1)},Ai=()=>{var X;switch(e){case"minature":case"bodytales":case"imemyselfcare-com":if(window.triggerGokwikCustomCheckout)return window.triggerGokwikCustomCheckout(),!0;break;case"athflex":if((X=window.shiprocketCheckoutEvents)!=null&&X.buyCart)return window.shiprocketCheckoutEvents.buyCart(),!0;break;case"www":if(window.openRzpCheckout)return window.openRzpCheckout(),!0;break;default:return window.location.href=O((t==null?void 0:t.shopifyShopDomain)??""),!1}return window.location.href=O((t==null?void 0:t.shopifyShopDomain)??""),!1},Vr=async X=>{X.preventDefault(),window.DebalesChat.track(un.CHECKOUT_CLICKED,{chatId:ur()+e,cartValue:Number(E==null?void 0:E.total),cart:E}),T({dbls_method:"checkout_clicked"}),Ai()&&Ne(!1,"checkout_clicked")},[So,Ja]=W.useState([]);W.useEffect(()=>{const X=dZ(sZ(x));Ja(X)},[x]);const Zr=W.useMemo(()=>So.map(X=>{if(Array.isArray(X)){const qe=X.filter(ut=>!Re.has(ut.question));if(qe.length===0)return null;const ot={isHighlighted:X[0].isHighlighted,enable:X[0].enable,type:X[0].type};return qe.map(ut=>({...ut,...ot}))}else return Re.has(X.question)?null:X}).filter(Boolean),[So,Re]);W.useEffect(()=>{const X=ut=>{const $e=ut.detail.formId;switch(ut.detail.type){case"open":case"embedOpen":setTimeout(()=>{const Mt=qe($e);Mt&&we(Mt)},800);break;case"close":fe&&(t==null?void 0:t.KlaviyoFormIntegration)===!0&&setTimeout(()=>{Ne(!0,"klaviyo_form_closed"),ne($e),r(fe,void 0,void 0,!0)},1e4);break}},qe=ut=>{const $e=document.querySelector(`[data-testid="klaviyo-form-${ut}"]`);if(console.log(`formElement text ${ut} =>`,$e==null?void 0:$e.innerText,$e==null?void 0:$e.textContent),$e instanceof HTMLElement){const Tt=$e.innerText||$e.textContent;if(Tt)return console.log("Found form text:",Tt),`=> Klaviyo form content:
|
|
2323
|
+
`,Oee=({botId:e})=>{var Xn,Ki;const{uiData:t,storeMetaData:n,onSendMessage:r,isKlaviyoMessage:i,isLoading:o,lastedBotmessageId:s,setLastedBotmessageId:u,messages:c,isMessageLoading:d,setIsMessageLoading:p,setMessages:h,saveConversation:m,changeDisplayModel:v,loadConversation:_,suggestedQuestions:x,setSuggestedQuestions:b,showUserInfoModel:w,setShowUserInfoModel:C}=HW(),{cart:E,addToCart:R,generateCartUrl:O,addCartAttributes:T}=uT(),L=DW("use-chatbot-icon-size"),B=Zf.detect(),z=t==null?void 0:t.isLeft,P=jW(),V=t==null?void 0:t.heightOption,[J,le]=W.useState(!1);W.useEffect(()=>{const X=()=>{le(window.matchMedia("(max-width: 768px)").matches)};return X(),window.addEventListener("resize",X),()=>window.removeEventListener("resize",X)},[]);const[G,Z]=W.useState(!1),[q,H]=W.useState(!1),[fe,we]=W.useState(""),[k,ne]=W.useState(""),[,de]=W.useState(0);W.useEffect(()=>{e&&PW(e)},[e]),W.useEffect(()=>{lZ(e)},[e]),W.useEffect(()=>{let X=ho();if(!X&&window.Thinkific){const qe=window.Thinkific.current_user;qe&&(X={name:qe.full_name,email:qe.email},qp(X))}Us.init({projectName:e,debug:!1,testing:aT}),X&&X.email&&(window.DebalesChat.identify(X.email,{name:X.name,phone:X.phone,email:X.email}),t!=null&&t.KlaviyoIntegration&&window.klaviyo&&window.klaviyo.identify({email:X.email,first_name:X.name,phone:X.phone,from:"Debales-Chatbot"}))},[e,t==null?void 0:t.KlaviyoIntegration]);const D=W.useRef(null),ue=yi(e,pi.CLICKED_QUESTIONS),[Re,ie]=W.useState(()=>{try{const X=sessionStorage.getItem(ue);return X?new Set(JSON.parse(X)):new Set}catch{return new Set}});W.useEffect(()=>{try{sessionStorage.setItem(ue,JSON.stringify(Array.from(Re)))}catch(X){console.error("Failed to save to sessionStorage:",X)}},[Re]);const Ne=W.useCallback((X,qe)=>{X?(window.dispatchEvent(new CustomEvent(Ci.OPEN_STATE_CHANGE,{detail:{isOpen:X,source:qe,projectId:e}})),setTimeout(()=>{H(!0)},50)):(H(!1),window.dispatchEvent(new CustomEvent(Ci.OPEN_STATE_CHANGE,{detail:{isOpen:X,source:qe,projectId:e}})))},[]);W.useEffect(()=>{const X=qe=>{Z(qe.detail.isOpen),qe.detail.isOpen&&setTimeout(()=>H(!0),50),window.DebalesChat.isOpen=qe.detail.isOpen,window.DebalesChat.track(un.OPEN_STATE_CHANGE,{isOpen:qe.detail.isOpen,source:qe.detail.source})};return window.addEventListener(Ci.OPEN_STATE_CHANGE,X),()=>{window.removeEventListener(Ci.OPEN_STATE_CHANGE,X)}},[]),W.useEffect(()=>{const X=qe=>{Z(qe.detail.isOpen),window.DebalesChat.isOpen=qe.detail.isOpen,window.DebalesChat.track(un.OPEN_STATE_CHANGE,{isOpen:qe.detail.isOpen})};return window.addEventListener(Ci.OPEN_STATE_CHANGE,X),()=>{window.removeEventListener(Ci.OPEN_STATE_CHANGE,X)}},[]);const[De,Fe]=W.useState(!1),[We,Pe]=W.useState(null),[be,Ke]=W.useState(()=>{const X=yi(e,pi.PENDING_BULK_ITEMS),qe=sessionStorage.getItem(X);return qe?JSON.parse(qe):[]});W.useEffect(()=>{const X=yi(e,pi.PENDING_BULK_ITEMS);sessionStorage.setItem(X,JSON.stringify(be))},[be,e]);const[Je,dt]=W.useState(!1),[tt,lt]=W.useState({name:"",email:"",message:""}),N=$S("exit_model"),[F,K]=W.useState({text:!0,leadingQueries:!0,collections:!0,products:!0,variants:!0,cartSummary:!0,bulkItems:!0}),[me,_e]=W.useState(!1),[Se,Ye]=W.useState(!0),Xe=W.useCallback(X=>{const qe=X.target,ot=qe.scrollHeight-qe.scrollTop<=qe.clientHeight+0;Ye(ot)},[]);W.useEffect(()=>{var X,qe,ot,ut,$e,Tt;if(c.length>0&&!d){const Mt=c[c.length-1],Nn=sessionStorage.getItem(yi(e,pi.LAST_SHOWN_MESSAGE_ID)),Ri=Mt.isBot&&Mt.conversationId===s&&Mt.conversationId!==Nn,Eo=(E==null?void 0:E.itemCount)&&(E==null?void 0:E.itemCount)>0&&Mt.conversationId===s;if(Ri){_e(!0),sessionStorage.setItem(yi(e,pi.LAST_SHOWN_MESSAGE_ID),Mt.conversationId||""),K({text:!0,leadingQueries:!1,collections:!1,products:!1,variants:!1,cartSummary:!1,bulkItems:!1});const vn=1600;let nl=vn;const es=[{type:"collections",condition:((X=Mt.collections)==null?void 0:X.length)&&((qe=Mt.collections)==null?void 0:qe.length)>0},{type:"products",condition:((ot=Mt.products)==null?void 0:ot.length)&&((ut=Mt.products)==null?void 0:ut.length)>0},{type:"leadingQueries",condition:(($e=Mt.leading_queries)==null?void 0:$e.length)&&((Tt=Mt.leading_queries)==null?void 0:Tt.length)>0},{type:"cartSummary",condition:(E==null?void 0:E.itemCount)&&(E==null?void 0:E.itemCount)>0},{type:"bulkItems",condition:(be==null?void 0:be.length)>0}].filter(ri=>ri.condition);if(es.length===0){_e(!1);return}es.forEach(({type:ri},ko)=>{setTimeout(()=>{if(K(Ao=>({...Ao,[ri]:!0})),Se&&D.current){const Ao=D.current;Ao.scrollHeight-Ao.scrollTop<=Ao.clientHeight&&jp(D)}ko===es.length-1&&_e(!1)},nl),nl+=vn})}else Eo&&K(vn=>({...vn,cartSummary:!0}))}},[c,d,s,E==null?void 0:E.itemCount,be==null?void 0:be.length,Se,e]),W.useEffect(()=>{if(!i&&c.length>0){const X=D.current;X&&Se&&X.scrollHeight-X.scrollTop<=X.clientHeight+100&&setTimeout(()=>jp(D),100)}},[c.length,i,Se]),W.useEffect(()=>{const X=document.querySelector('meta[name="viewport"]'),qe=X==null?void 0:X.content;if(G){let ot=X;const ut=window.matchMedia("(max-width: 768px)").matches;ot?ot.content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no":(ot=document.createElement("meta"),ot.name="viewport",ot.content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no",document.head.appendChild(ot)),ut&&(t==null?void 0:t.mobileDisplayMode)==="full-screen"&&(document.body.style.overflow="hidden");const $e=ot;return()=>{qe&&$e&&($e.content=qe),ut&&(t==null?void 0:t.mobileDisplayMode)==="full-screen"&&(document.body.style.overflow="")}}return()=>{window.matchMedia("(max-width: 768px)").matches&&(t==null?void 0:t.mobileDisplayMode)==="full-screen"&&(document.body.style.overflow="")}},[G,t==null?void 0:t.mobileDisplayMode]),W.useEffect(()=>{if(G&&window.matchMedia("(max-width: 768px)").matches&&(t==null?void 0:t.mobileDisplayMode)==="full-screen"){const X=qe=>{let ot=qe.target,ut=!1;const $e=D.current;if($e){for(;ot&&ot!==document.body;){if(ot===$e){ut=!0;break}if(ot.parentNode)ot=ot.parentNode;else break}if(!ut)qe.preventDefault();else{const Tt=$e.scrollTop<=0,Mt=$e.scrollTop+$e.clientHeight>=$e.scrollHeight-5;if(Tt&&qe.touches[0].clientY>0||Mt&&qe.touches[0].clientY<0)return}}};return document.addEventListener("touchmove",X,{passive:!1}),()=>{document.removeEventListener("touchmove",X)}}return()=>{}},[G,t==null?void 0:t.mobileDisplayMode,D]),W.useEffect(()=>{const X=setTimeout(()=>{Fe(!0)},1e3);return()=>clearTimeout(X)},[]),W.useEffect(()=>{i||setTimeout(()=>jp(D),100)},[c.length,i]),W.useEffect(()=>{E!=null&&E.itemCount&&E.itemCount===0&&!i&&setTimeout(()=>jp(D),100)},[E==null?void 0:E.itemCount,i]),W.useEffect(()=>{s&&sessionStorage.setItem(yi(e,pi.LAST_SHOWN_MESSAGE_ID),s)},[s,e]);const Q=W.useRef(Date.now()),he=W.useRef(0),ze=W.useRef(window.location.pathname),je=W.useRef(x),nt=W.useRef(!1),jt=$S("acquisition_agent");W.useEffect(()=>{je.current=x},[x]);const on=W.useCallback(async()=>{const X=Date.now();if(X-Q.current>=6e3&&X-he.current>=6e4&&!nt.current)try{nt.current=!0,console.log("fetching acquisition data");const ut=await fetch(`${fo}/api/wordpress/acquisition`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({timeZone:Intl.DateTimeFormat().resolvedOptions().timeZone,timestamp:new Date().toISOString(),page_information:window.location.href.split("?")[0],botid:e})});if(ut.ok){const $e=await ut.json(),Mt=[...je.current.filter(Nn=>Nn.path!==ze.current),{question:$e.greetings,answer:"",path:ze.current,nameSpace:e,type:"dynamic"}];b(Mt)}he.current=X}catch(ut){console.error("Error fetching acquisition data:",ut)}finally{nt.current=!1}},[e]);W.useEffect(()=>{if(!jt||(t==null?void 0:t.show_bot)===!1)return;const X=()=>{Q.current=Date.now()};document.addEventListener("mousemove",X),document.addEventListener("mousedown",X),document.addEventListener("keypress",X),document.addEventListener("scroll",X),document.addEventListener("touchstart",X),document.addEventListener("touchmove",X);const qe=setInterval(on,1e3),ot=()=>{const $e=window.location.pathname.split("?")[0],Tt=ze.current.split("?")[0];(()=>{const Nn=Tt.split("/").filter(Boolean),Ri=$e.split("/").filter(Boolean);return Nn.length!==Ri.length?!0:Nn.length===0&&Ri.length===0?!1:$e!==Tt})()&&(ze.current=$e,Q.current=Date.now())};return window.addEventListener("popstate",ot),()=>{document.removeEventListener("mousemove",X),document.removeEventListener("mousedown",X),document.removeEventListener("keypress",X),document.removeEventListener("scroll",X),document.removeEventListener("touchstart",X),document.removeEventListener("touchmove",X),window.removeEventListener("popstate",ot),clearInterval(qe)}},[jt,on,t==null?void 0:t.show_bot]);const[Ft,cn]=W.useState(!1),[it,St]=W.useState(!1),[Ge,_t]=W.useState(null),Wi=async X=>{const qe=ur();if(H(!1),X&&c.length>1)try{(await fetch(`${fo}/api/wordpress/userRating`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sessionId:qe,userRating:X,nameSpace:e})})).ok||console.error("Error submitting rating")}catch(ot){console.error("Error submitting rating:",ot)}setTimeout(()=>{St(!1),Ne(!1,"close_button_clicked")},1e3)},bo=X=>{p(!0),be.forEach(ot=>{R(ot.id,ot.quantity)}),window.DebalesChat.track(un.ADD_BULK_ITEM,{products:be,message:X});const qe=[...c,{text:"🎉 Bulk items added to cart successfully.",leading_queries:["Get GST Invoice for the order","Explore more products"],conversationId:X,isBot:!0}];h(qe),m(qe),u(X),Ke([]),p(!1)},Ai=()=>{var X;switch(e){case"minature":case"bodytales":case"imemyselfcare-com":if(window.triggerGokwikCustomCheckout)return window.triggerGokwikCustomCheckout(),!0;break;case"athflex":if((X=window.shiprocketCheckoutEvents)!=null&&X.buyCart)return window.shiprocketCheckoutEvents.buyCart(),!0;break;case"www":if(window.openRzpCheckout)return window.openRzpCheckout(),!0;break;default:return window.location.href=O((t==null?void 0:t.shopifyShopDomain)??""),!1}return window.location.href=O((t==null?void 0:t.shopifyShopDomain)??""),!1},Vr=async X=>{X.preventDefault(),window.DebalesChat.track(un.CHECKOUT_CLICKED,{chatId:ur()+e,cartValue:Number(E==null?void 0:E.total),cart:E}),T({dbls_method:"checkout_clicked"}),Ai()&&Ne(!1,"checkout_clicked")},[So,Ja]=W.useState([]);W.useEffect(()=>{const X=dZ(sZ(x));Ja(X)},[x]);const Zr=W.useMemo(()=>So.map(X=>{if(Array.isArray(X)){const qe=X.filter(ut=>!Re.has(ut.question));if(qe.length===0)return null;const ot={isHighlighted:X[0].isHighlighted,enable:X[0].enable,type:X[0].type};return qe.map(ut=>({...ut,...ot}))}else return Re.has(X.question)?null:X}).filter(Boolean),[So,Re]);W.useEffect(()=>{const X=ut=>{const $e=ut.detail.formId;switch(ut.detail.type){case"open":case"embedOpen":setTimeout(()=>{const Mt=qe($e);Mt&&we(Mt)},800);break;case"close":fe&&(t==null?void 0:t.KlaviyoFormIntegration)===!0&&setTimeout(()=>{Ne(!0,"klaviyo_form_closed"),ne($e),r(fe,void 0,void 0,!0)},1e4);break}},qe=ut=>{const $e=document.querySelector(`[data-testid="klaviyo-form-${ut}"]`);if(console.log(`formElement text ${ut} =>`,$e==null?void 0:$e.innerText,$e==null?void 0:$e.textContent),$e instanceof HTMLElement){const Tt=$e.innerText||$e.textContent;if(Tt)return console.log("Found form text:",Tt),`=> Klaviyo form content:
|
|
2324
2324
|
|
|
2325
2325
|
`+Tt+`
|
|
2326
2326
|
|
|
2327
|
-
=> User Action: Klaviyo form closed`}return""},ot=ut=>{ut instanceof CustomEvent&&X(ut)};return window.addEventListener("klaviyoForms",ot),()=>{window.removeEventListener("klaviyoForms",ot)}},[fe,t,r]),W.useEffect(()=>{const X=D.current;return X?(X.addEventListener("scroll",Xe),()=>X.removeEventListener("scroll",Xe)):()=>{}},[Xe]);const[wo,xo]=W.useState(!1),Co=V==="Highest"?"120px":V==="Higher"?"60px":"15px",id=async()=>{try{const X=await fetch(`${fo}/api/wordpress/support`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({chatid:ur()+e,nameSpace:e,userName:tt.name,userEmail:tt.email,userMessage:tt.message,tag:"support"})});if(X.ok)h(qe=>[...qe,{text:"Thanks for reaching out! Our support team has received your request and will get back to you within 24 hours.<br>In the meantime, feel free to continue chatting with me - I'll do my best to help!",isBot:!0}]),console.log("Connected to support with existing user info:",ho());else{const qe=await X.json();console.error("Failed to connect to support:",qe),h(ot=>[...ot,{text:"Sorry, we couldn't connect you to support at the moment.<br>Please try again later.",isBot:!0}])}}catch{h(qe=>[...qe,{text:"Sorry, we couldn't connect you to support at the moment.<br>Please try again later.",isBot:!0}])}},Ii=()=>{const X=ho();X&&X.name&&X.email&<({name:X==null?void 0:X.name,email:X==null?void 0:X.email,message:""}),h(qe=>[...qe,{text:"Please provide your name, email and message to connect with support.",isBot:!0}]),dt(!0)},Vn=async X=>{X.preventDefault(),qp({name:tt.name,email:tt.email}),dt(!1),await id()};return!t||t.show_bot===!1||o?null:$.jsxs(Az,{theme:iZ(t),children:[$.jsx("link",{rel:"preconnect",href:"https://fonts.googleapis.com"}),$.jsx("link",{rel:"preconnect",href:"https://fonts.gstatic.com",crossOrigin:"anonymous"}),$.jsx("link",{href:"https://fonts.googleapis.com/css2?family=Inter:ital,opsz,wght@0,14..32,100..900;1,14..32,100..900&display=swap",rel:"stylesheet"}),$.jsx(wee,{}),!G&&(Zr==null?void 0:Zr.length)!==0&&$.jsx(See,{className:De?"visible":"",$botId:e,$iconSize:L,$removeLogoBackground:t.removeLogoBackground,topOffset:Co,style:{right:z?"auto":"24px",left:z?"24px":"auto",display:"flex",flexDirection:"column",alignItems:z?"flex-start":"flex-end"},children:Zr.map((X,qe)=>{if(Array.isArray(X)){const ot=X.map(ut=>({question:ut.question,isHighlighted:ut.isHighlighted??!1})).filter(ut=>!Re.has(ut.question));return $.jsx(t$,{$index:qe,$totalCount:Zr.length,children:$.jsx(XK,{messages:ot,botId:e,uiData:t,onClick:ut=>{const $e=X.find(Tt=>Tt.question===ut);Ne(!0,"suggested_question_clicked"),ie(Tt=>{const Mt=new Set(Tt);return Mt.add(ut),Mt}),window.DebalesChat.track(un.SUGGESTED_QUESTION_CLICKED,{suggested_question:$e}),!w&&$e?r($e==null?void 0:$e.question,$e==null?void 0:$e.answer,$e==null?void 0:$e.products,!1,$e==null?void 0:$e.leading_queries):Pe($e)}})},qe)}else return $.jsx(t$,{$index:qe,$totalCount:Zr.length,children:$.jsx(KK,{value:`${X.question}`,index:qe,botId:e,uiData:t,onClose:()=>{ie(ot=>{const ut=new Set(ot);return ut.add(X.question),ut})},onClick:()=>{Ne(!0,"suggested_question_clicked"),ie(ot=>{const ut=new Set(ot);return ut.add(X.question),ut}),window.DebalesChat.track(un.SUGGESTED_QUESTION_CLICKED,{suggested_question:X}),w?Pe(X):r(X.question,X.answer,X.products,!1,X.leading_queries)},isHighlighted:X.isHighlighted??!1})},qe)})}),$.jsxs(nee,{$topOffset:Co,$removeLogoBackground:t.removeLogoBackground,style:{display:G?"none":"inline-flex",right:z?"auto":"24px",left:z?"24px":"auto"},children:[$.jsx(ree,{$showAnimation:t.enableChatButtonBackgroundAnimation??!1,$animationType:"Ping",$animationColor:t.chatButtonBackgroundAnimationColor||"#f48722",$backgroundColor:t.backgroundColor||"#fff",$removeLogoBackground:t.removeLogoBackground,$topOffset:Co,$iconSize:L}),$.jsx(iee,{$backgroundColor:t.removeLogoBackground?"transparent":t.backgroundColor||"#fff",$botId:e,$iconSize:L,$removeLogoBackground:t.removeLogoBackground,topOffset:Co,$showAnimation:t.enableChatButtonBackgroundAnimation,$animationType:"Ping",$animationColor:t.chatButtonBackgroundAnimationColor||"#f48722",id:"debales-chat-button",onClick:()=>{if(window.DebalesChat.track(un.CHAT_BUTTON_CLICKED),Ne(!G,"chat_button_clicked"),!G){const X=_();X.length>0&&h(X)}},"aria-label":"Chat",style:{display:G?"none":"inline-flex",right:z?"auto":"24px",left:z?"24px":"auto"},children:$.jsx(oee,{$botId:e,$removeLogoBackground:t.removeLogoBackground,"aria-hidden":"true",src:t.bot_logo,alt:"Chat Bot Icon"})})]}),G&&f5.createPortal($.jsx($.Fragment,{children:$.jsxs(fee,{$backgroundColor:t.backgroundColor||"#fff",$fullScreenOnMobile:t.fullScreenOnMobile,$headerFontColor:t.headerFontColor||"#1C1C1C",$isLeft:z,$topOffset:Co,$mobileDisplayMode:t.mobileDisplayMode,$isVisible:q,children:[$.jsxs(dee,{$backgroundColor:t.backgroundColor||"#fff",style:{color:t.headerFontColor},children:[$.jsxs("div",{style:{display:"flex",columnGap:"10px",flex:"1 1 0%",alignItems:"center"},children:[$.jsx(aee,{"aria-hidden":"true",src:t.bot_logo,alt:"Chat Bot Icon"}),$.jsxs(see,{$botNameColor:t.headerFontColor,children:[$.jsxs("div",{style:{fontWeight:"700",wordBreak:"break-word"},children:[t.chatbotName,e==="catch-org-ai"&&$.jsx(uee,{$backgroundColor:t.callToActionBackgroundColor,$fontColor:t.callToActionFontColor,children:"Beta"})]}),$.jsx(lee,{children:$.jsx(AK,{})})]})]}),$.jsxs("div",{style:{display:"flex",alignItems:"center"},children:[$.jsxs(xee,{children:[$.jsxs(Cee,{onClick:Ii,children:[$.jsx(RK,{color:t.headerFontColor}),$.jsx(Eee,{children:"Support"})]}),$.jsx(n$,{children:"Need more help? I'll connect you with a support agent."})]}),(t.mobileDisplayMode==="half-screen"||t.mobileDisplayMode==="full-screen")&&J&&$.jsx("button",{onClick:()=>{const X=t.mobileDisplayMode==="full-screen"?"half-screen":"full-screen";v(X)},style:{background:"none",border:"none",cursor:"pointer",padding:"0",marginRight:"10px",display:"flex",alignItems:"center"},"aria-label":t.mobileDisplayMode==="full-screen"?"Switch to half screen":"Switch to full screen",children:t.mobileDisplayMode==="full-screen"?$.jsx("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:$.jsx("path",{d:"M4.5 15.75V13.5H2.25V12H6V15.75H4.5ZM12 15.75V12H15.75V13.5H13.5V15.75H12ZM2.25 6V4.5H4.5V2.25H6V6H2.25ZM12 6V2.25H13.5V4.5H15.75V6H12Z",fill:"black"})}):$.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:$.jsx("path",{d:"M10 3.75H16.25V10H14.5833V6.595L6.595 14.5833H10V16.25H3.75V10H5.41667V13.405L13.405 5.41667H10V3.75Z",fill:"black"})})}),$.jsx(cee,{onClick:()=>{N?St(!0):Ne(!1,"close_button_clicked")},id:"debales-minimize-button","aria-label":"Minimize",children:$.jsx(qS,{botNameColor:t.headerFontColor})})]})]}),$.jsxs(pee,{$backgroundColor:t.botBackgroundColor||"#fff",$mobileDisplayMode:t.mobileDisplayMode,children:[wo&&((Ki=(Xn=t.pluginConfig)==null?void 0:Xn.collectedUserInfo)==null?void 0:Ki.discount)&&$.jsx(WK,{discount:t.pluginConfig.collectedUserInfo.discount,uiData:t,onClose:()=>{xo(!1),window.DebalesChat.track(un.DISCOUNT_VIEWED,{discount:t.pluginConfig.collectedUserInfo.discount})}}),$.jsx(YJ,{uidata:t,product:Ge,showModel:Ft,setShowModel:cn,onVariantSelect:X=>{R(X.id,1),window.DebalesChat.track(un.ADD_TO_CART_CLICKED,{product:X.title,price:Number(X.price),link:`https://${t.shopifyShopDomain}/variants/${X.id}`,message:s,chatId:ur()+e})}}),it&&$.jsx(dQ,{setShowExitModal:St,handleCloseChatbot:Wi,chatId:ur()+e}),$.jsxs(hee,{id:"debales-conversation-group",$botBackgroundColor:t.botBackgroundColor||"#fff",ref:D,$mobileDisplayMode:t.mobileDisplayMode,children:[c.map((X,qe)=>{const ot=X.isBot,ut=fZ(X.text);return $.jsxs(W.Fragment,{children:[ot&&$.jsxs(X4,{$fontColor:t.botFontColor||"#000",$botMessageColor:t.botBackgroundColor||"#fff",children:[$.jsx("img",{src:ot?t.bot_logo:t.userMessage_logo,alt:"Chat User Icon"}),$.jsxs(e$,{children:[ut.map($e=>$.jsx("div",{children:$.jsx(td,{$botMessageColor:ot?t.botMessageColor||"#fff":t.userMessageColor||"#fff",style:{color:t.botFontColor},children:$.jsx(YE,{remarkPlugins:[CU,NW],children:$e})})})),X.collections&&s===X.conversationId&&F.collections&&$.jsx(UK,{message:X,botId:e,uidata:t,onSendMessage:r,loading:d}),X.products&&s===X.conversationId&&F.products&&$.jsx(TQ,{message:X,botId:e,uidata:t,onSendMessage:r,loading:d,storeMetaData:n,platform:B,setShowVariantModel:cn,setSelectedProduct:_t,setCartVersion:de}),i&&$.jsx(YS,{children:$.jsx(J3,{onClick:()=>{window._klOnsite&&(window._klOnsite.push(["openForm",k]),Ne(!1,"klaviyo_grab_deal_button"))},children:"🚀 Grab Deal Now!"})}),c.length==1&&qe==0&&$.jsx(YS,{children:So.map($e=>Array.isArray($e)?$e[0]:$e).map(($e,Tt)=>$.jsx(J4,{style:{backgroundColor:t.callToActionBackgroundColor,color:t.callToActionFontColor},onClick:()=>{r($e.question,$e.answer,$e.products),ie(Mt=>{const Nn=new Set(Mt);return Nn.add($e.question),Nn}),window.DebalesChat.track(un.INITIAL_LEADING_QUERY_SUGGESTED_QUESTION_CLICKED,{question:$e.question})},disabled:d,$disabled:d,children:$e.question},Tt))}),X.leading_queries&&X.leading_queries.length>0&&s===X.conversationId&&F.leadingQueries&&!i&&$.jsx(YS,{children:X.leading_queries.map(($e,Tt)=>$.jsx(J4,{style:{backgroundColor:t.callToActionBackgroundColor,color:t.callToActionFontColor},onClick:()=>{r($e),window.DebalesChat.track(un.LEADING_QUERY_CLICKED,{query:$e})},disabled:d,$disabled:d,children:$e},Tt))}),E&&E.itemCount>0&&s===X.conversationId&&F.cartSummary&&$.jsxs(yee,{children:[$.jsx(td,{$botMessageColor:t.botMessageColor,style:{width:"max-content",color:t.botFontColor},dangerouslySetInnerHTML:{__html:`<span style="display: flex; align-items: center; justify-content: center;">Total Price: ${qW((E==null?void 0:E.total)??0,(E==null?void 0:E.currency)??"USD")} </span>`}}),$.jsxs(FW,{href:O(t.shopifyShopDomain??""),onClick:Vr,children:[$.jsx("span",{children:"Checkout"}),$.jsx(EK,{style:{width:"20px",fill:t.callToActionFontColor}})]})]}),be&&be.length>0&&s===X.conversationId&&F.bulkItems&&$.jsx(BW,{onClick:()=>bo(X.conversationId),children:"Add Bulk Items to Cart"}),w&&c.indexOf(X)===c.length-1&&$.jsx($.Fragment,{children:$.jsx(LJ,{uidata:t,botName:t.chatbotName,botId:e,showModel:w,setShowModel:$e=>{var Mt,Nn;const Tt=typeof $e=="function"?$e(w):$e;C(Tt),!Tt&&((Nn=(Mt=t.pluginConfig)==null?void 0:Mt.collectedUserInfo)!=null&&Nn.discount)&&xo(!0)},selectedSuggestedQuestionAnswer:We,sendMessage:r,botNameColor:t.headerFontColor,inChat:!0,showFormInstructions:!1})}),Je&&c.indexOf(X)===c.length-1&&$.jsxs(kee,{onSubmit:Vn,children:[$.jsxs(WS,{children:[$.jsxs(KS,{children:["Name",$.jsx("span",{children:"*"})]}),$.jsx(r$,{type:"text",required:!0,value:tt.name,onChange:$e=>lt(Tt=>({...Tt,name:$e.target.value})),placeholder:"John"})]}),$.jsxs(WS,{children:[$.jsxs(KS,{children:["Email",$.jsx("span",{children:"*"})]}),$.jsx(r$,{type:"email",required:!0,value:tt.email,onChange:$e=>lt(Tt=>({...Tt,email:$e.target.value})),placeholder:"olivia@untitledui.com"})]}),$.jsxs(WS,{children:[$.jsxs(KS,{children:["Message",$.jsx("span",{children:"*"})]}),$.jsx(Aee,{required:!0,value:tt.message,onChange:$e=>lt(Tt=>({...Tt,message:$e.target.value})),placeholder:"I need help with..."})]}),$.jsx(Ree,{children:$.jsx(Iee,{type:"submit",children:"Submit"})})]}),me&&!d&&s===X.conversationId&&$.jsx(td,{$botMessageColor:t.botMessageColor,style:{color:t.botFontColor},children:$.jsx(mD,{loading:me,loadingPhrases:["🎨 Loading","✨ Almost","🚀 Ready"]})})]})]}),!ot&&$.jsx(_ee,{$fontColor:t.userFontColor||"#000",$botMessageColor:t.botBackgroundColor||"#fff",children:$.jsx(td,{$botMessageColor:ot?t.botMessageColor||"#fff":t.userMessageColor||"#fff",children:$.jsx(YE,{children:X.text})})})]},qe)}),d&&$.jsxs(X4,{$fontColor:t.botFontColor||"#000",$botMessageColor:t.botBackgroundColor||"#fff",children:[$.jsx("img",{src:t.bot_logo,alt:"Chat User Icon"}),$.jsx(e$,{children:$.jsx(td,{$botMessageColor:t.botMessageColor||"#fff",style:{backgroundColor:"transparent",padding:"0px"},children:$.jsx("div",{style:{display:"flex",alignItems:"center",gap:"4px",animation:"fadeIn 0.3s ease-in-out"},children:$.jsx(mD,{loading:d})})})})]})]}),$.jsxs("div",{className:"debales-footer-container",style:{width:"calc(100%-24px)",backgroundColor:t.footerBackgroundColor||"#fff",color:t.fontColor||"#000"},children:[e==="catch-org-ai"&&$.jsx(vee,{children:$.jsx("span",{children:'"Catch org AI" can make mistakes.'})}),$.jsx("div",{children:$.jsx(JJ,{uiData:t,onSendMessage:r,disabled:d,inputState:!1})}),(t.debales_branding??!0)&&$.jsxs(gee,{href:"https://debales.ai/?open=true",target:"_blank",title:"debales-link",style:{color:t.fontColor?t.fontColor:"fff",marginTop:e==="catch-org-ai"?"0":"9px"},children:[$.jsx("p",{children:"Powered by"}),$.jsxs(mee,{children:[$.jsx("img",{src:`${fo}/images/debales_logo_d.png`,alt:"Debales logo"}),$.jsx("p",{children:"DEBALES"})]})]})]})]})]})}),P.shadowRoot)]})},i$="debales-ai-assistant",o$="debales-chatbot-container",Tee=W.forwardRef(({children:e,globalStyles:t="",containerStyles:n={},onReady:r},i)=>{const o=W.useRef(null),[s,u]=W.useState(null),c=W.useRef(null),d=W.useRef(null),p=W.useRef({get shadowRoot(){return c.current},get container(){return s},querySelector:h=>{var m;return((m=c.current)==null?void 0:m.querySelector(h))||null},querySelectorAll:h=>{var m;return((m=c.current)==null?void 0:m.querySelectorAll(h))||null}});return W.useImperativeHandle(i,()=>p.current,[]),W.useEffect(()=>{const h=document.getElementById(i$);if(h?o.current=h:o.current&&(o.current.id=i$),o.current&&(o.current.style.cssText="position: absolute; top: 0; left: 0; width: 0; height: 0;"),o.current){if(o.current.shadowRoot){c.current=o.current.shadowRoot;const _=c.current.querySelector(`#${o$}`);_&&u(_);return}const m=o.current.attachShadow({mode:"open"});if(c.current=m,t){const _=document.createElement("style");_.textContent=t,m.appendChild(_)}const v=document.createElement("div");v.id=o$,v.style.cssText="position: absolute; top: 0; left: 0; width: 0; height: 0;",m.appendChild(v),u(v),r&&r(m,v)}},[t,r]),W.useEffect(()=>(s&&!d.current&&(d.current=AC.createRoot(s)),d.current&&s&&d.current.render($.jsx(wz,{target:s,children:$.jsx(tD,{value:p.current,children:e})})),()=>{d.current&&d.current.unmount()}),[s,e]),$.jsx("div",{ref:o,style:n})});class QS{isSupported(){return Zf.detect()===this.platform}createSuccessResult(t,n){return{success:!0,data:t,message:n}}createErrorResult(t){return{success:!1,error:t}}}class Mee extends QS{constructor(){super(...arguments);tr(this,"platform",hr.DEFAULT)}async fetchCart(){return console.log("DefaultCartAdapter: fetchCart called"),this.createSuccessResult({items:[],total:0,itemCount:0,currency:"USD",token:"default-token"},"Default cart fetched")}async addToCart(n,r=1,i){return console.log("DefaultCartAdapter: addToCart called",{variantId:n,quantity:r,properties:i}),this.createSuccessResult(void 0,"Item added to cart (mock)")}async removeFromCart(n){return console.log("DefaultCartAdapter: removeFromCart called",{itemId:n}),this.createSuccessResult(void 0,"Item removed from cart (mock)")}async updateQuantity(n){return console.log("DefaultCartAdapter: updateQuantity called",{cartItem:n}),this.createSuccessResult(void 0,"Item quantity updated (mock)")}async clearCart(){return console.log("DefaultCartAdapter: clearCart called"),this.createSuccessResult(void 0,"Cart cleared (mock)")}generateCartUrl(n){const r=n.replace(/^https?:\/\//,"");return console.log("DefaultCartAdapter: generateCartUrl called",{domain:n,sanitizedDomain:r}),`https://${r}/cart`}generateProductUrl(n,r){if(r.handle){const i=new URL(`https://${n}/products/${r.handle}`);return i.searchParams.append("variant",r.product_id),Js(i.toString())}else return Js(r.link)}async addCartAttributes(n={}){return console.log("MethodNotImplemented: addCartAttributes called",{attributes:n}),this.createSuccessResult(void 0,"Cart attributes added (mock)")}}class Dee extends QS{constructor(){var n,r;super();tr(this,"platform",hr.SHOPIFY);tr(this,"cartEndpoint");tr(this,"localCartKey","debales_track_cart");this.cartEndpoint=((r=(n=window.Shopify)==null?void 0:n.routes)==null?void 0:r.root)||"/"}normalizeCartData(n){return{items:n.items.map(r=>({id:r.id,variant_id:r.variant_id,quantity:r.quantity,title:r.title,price:r.price,properties:r.properties})),total:n.total_price/100,itemCount:n.item_count,currency:n.currency,token:n.token.split("?")[0]}}generateProductUrl(n,r){const i=xv(n);if(!i.isValid)return"";if(r.handle){const o=new URL(`/products/${r.handle}`,i.url);return o.searchParams.append("variant",r.product_id),Js(o.toString())}else return Js(r.link)}updateTrackCart({cartToken:n,sessionId:r=ur()}){localStorage.setItem(this.localCartKey,JSON.stringify({sessionId:r,cartToken:n}))}async fetchCart(){try{const n=await fetch(`${this.cartEndpoint}cart.js`),r=await n.json();if(!n.ok){const o=r;return this.createErrorResult(o.description||`Failed to fetch cart: ${n.status}`)}const i=r;return this.createSuccessResult(this.normalizeCartData(i),"Cart fetched successfully")}catch(n){return this.createErrorResult(n instanceof Error?`Error fetching cart: ${n.message}`:"Unknown error occurred while fetching cart")}}async addToCart(n,r=1,i){try{const o=await fetch(`${this.cartEndpoint}cart/add.js`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({items:[{id:n,quantity:r,properties:i}],attributes:{dbls_order_source:"direct_recommendation",dbls_session_id:ur(),dbls_method:"add_to_cart"}})}),s=await o.json();if(!o.ok){const u=s;return this.createErrorResult(u.description||`Failed to add item to cart: ${o.status}`)}return this.fetchCart().then(u=>{u.success&&this.updateTrackCart({cartToken:u==null?void 0:u.data.token})}),this.createSuccessResult(void 0,`Successfully added ${r} item(s) to cart`)}catch(o){return this.createErrorResult(o instanceof Error?`Error adding to cart: ${o.message}`:"Unknown error occurred while adding to cart")}}async removeFromCart(n){return this.updateQuantity({id:n,quantity:0})}async updateQuantity(n){try{const r=await fetch(`${this.cartEndpoint}cart/change.js`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:n.id,quantity:n.quantity})}),i=await r.json();if(!r.ok){const o=i;return this.createErrorResult(o.description||`Failed to update item quantity: ${r.status}`)}return this.fetchCart().then(o=>{o.success&&this.updateTrackCart({cartToken:o==null?void 0:o.data.token})}),this.createSuccessResult(void 0,n.quantity===0?"Item removed from cart":`Quantity updated to ${n.quantity}`)}catch(r){return this.createErrorResult(r instanceof Error?`Error updating quantity: ${r.message}`:"Unknown error occurred while updating quantity")}}async clearCart(){try{const n=await fetch(`${this.cartEndpoint}cart/clear.js`,{method:"POST"});if(!n.ok){const r=await n.json();return this.createErrorResult(r.description||`Failed to clear cart: ${n.status}`)}return this.createSuccessResult(void 0,"Cart cleared successfully")}catch(n){return this.createErrorResult(n instanceof Error?`Error clearing cart: ${n.message}`:"Unknown error occurred while clearing cart")}}async addCartAttributes(n={}){try{const r=await fetch(`${this.cartEndpoint}cart/update.js`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({attributes:{dbls_order_source:"direct_recommendation",dbls_session_id:ur(),...n}})});if(!r.ok){const i=await r.json();return this.createErrorResult(i.description||`Failed to update cart attributes: ${r.status}`)}return this.createSuccessResult(void 0,"Cart attributes updated successfully")}catch(r){return this.createErrorResult(r instanceof Error?`Error updating cart attributes: ${r.message}`:"Unknown error occurred while updating cart attributes")}}generateCartUrl(n){const r=xv(n);if(!r.isValid)return"";const i=new URL("/cart",r.url);return i.searchParams.append("ref",`debales-ai-${new Date().toISOString()}`),i.searchParams.append("attributes[from]","debales-ai-chatbot"),i.searchParams.append("attributes[through]","add-to-cart"),i.searchParams.append("attributes[dbls_session_id]",ur()),i.searchParams.append("timestamp",Date.now().toString()),Js(i.toString())}}class $ee extends QS{constructor(){var n,r;super();tr(this,"platform",hr.MAGENTO);tr(this,"checkoutEndpoint");tr(this,"baseUrl");this.checkoutEndpoint=((n=window.checkout)==null?void 0:n.checkoutUrl)||"/",this.baseUrl=((r=window.checkout)==null?void 0:r.baseUrl)||"/"}normalizeCartData(n){return{items:n.items.map(r=>({id:parseInt(r.item_id),variant_id:parseInt(r.product_id),quantity:r.qty,title:r.product_name,price:r.product_price_value,properties:{name:r.product_name}})),total:parseFloat(n.subtotalAmount),itemCount:n.summary_count,currency:"USD",token:n.data_id.toString()}}async fetchCart(){try{const n=await fetch(`${this.baseUrl}customer/section/load/?sections=cart&update_section_id=false`),r=await n.json();if(!n.ok)return this.createErrorResult(`Failed to fetch cart: ${n.status}`);const i=r.cart;return this.createSuccessResult(this.normalizeCartData(i),"Cart fetched successfully")}catch(n){return this.createErrorResult(n instanceof Error?`Error fetching cart: ${n.message}`:"Unknown error occurred while fetching cart")}}async addToCart(n,r=1){var i;try{const o=(i=document.querySelector('input[name="form_key"]'))==null?void 0:i.value;if(!o)return this.createErrorResult("Form key not found");const s=await fetch(`${this.checkoutEndpoint}cart/add`,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded","X-Requested-With":"XMLHttpRequest"},body:new URLSearchParams({product:n,qty:r.toString(),form_key:o})});if(!s.ok)return this.createErrorResult(`Failed to add item to cart: ${s.status}`);try{window.require(["Magento_Customer/js/customer-data"],u=>u.reload(["cart"],!0))}catch(u){console.warn("Failed to reload cart data:",u)}return this.createSuccessResult(void 0,`Successfully added ${r} item(s) to cart`)}catch(o){return this.createErrorResult(o instanceof Error?`Error adding to cart: ${o.message}`:"Unknown error occurred while adding to cart")}}async removeFromCart(n){return console.log("MethodNotImplemented: removeFromCart called",{itemId:n}),this.createSuccessResult(void 0,"Item removed from cart (mock)")}async updateQuantity(n){return console.log("MethodNotImplemented: updateQuantity called",{cartItem:n}),this.createSuccessResult(void 0,"Item quantity updated (mock)")}async clearCart(){return console.log("MethodNotImplemented: clearCart called"),this.createSuccessResult(void 0,"Cart cleared (mock)")}generateCartUrl(n){const r=new URL(`https://${n}/checkout/cart?ref=debales-ai-${new Date().toISOString()}&attributes[from]=debales-ai-chatbot&attributes[through]=add-to-cart`);return r.searchParams.append("timestamp",Date.now().toString()),r.toString()}generateProductUrl(n,r){const i=xv(n);if(!i.isValid)return"";if(r.handle){const o=new URL(`/${r.handle}.html`,i.url);return Js(o.toString())}else return Js(r.link)}async addCartAttributes(n={}){return console.log("MethodNotImplemented: addCartAttributes called",{attributes:n}),this.createSuccessResult(void 0,"Cart attributes added (mock)")}}const el=class el{constructor(){tr(this,"adapterCache");this.adapterCache=new Map}static getInstance(){return el.instance||(el.instance=new el),el.instance}getAdapter(t){const n=t||Zf.detect(),r=this.adapterCache.get(n);if(r)return r;let i;switch(n){case hr.SHOPIFY:i=new Dee;break;case hr.MAGENTO:i=new $ee;break;default:console.warn(`No specific adapter found for platform ${n}, using default adapter`),i=new Mee}return this.adapterCache.set(n,i),i}clearCache(){this.adapterCache.clear()}};tr(el,"instance");let XS=el;const Lee=({adapter:e,children:t,autoFetch:n=!0})=>{const[r,i]=W.useState(!1),[o,s]=W.useState(null),[u,c]=W.useState(null),d=W.useCallback(async()=>{try{i(!0),s(null);const C=await e.fetchCart();C.success?c(C.data):s(C.error)}catch(C){s(C instanceof Error?C.message:"Failed to fetch cart")}finally{i(!1)}},[e]),p=async(C,E,R)=>{try{s(null);const O=await e.addToCart(C,E,R);return O.success&&await d(),O}catch(O){return{success:!1,error:O instanceof Error?O.message:"Failed to add item to cart"}}},h=async C=>{try{s(null);const E=await e.removeFromCart(C);return E.success&&await d(),E}catch(E){return{success:!1,error:E instanceof Error?E.message:"Failed to remove item from cart"}}},m=async C=>{try{s(null);const E=await e.updateQuantity(C);return E.success&&await d(),E}catch(E){return{success:!1,error:E instanceof Error?E.message:"Failed to update quantity"}}},v=async()=>{try{s(null);const C=await e.clearCart();return C.success&&await d(),C}catch(C){return{success:!1,error:C instanceof Error?C.message:"Failed to clear cart"}}},_=C=>e.generateCartUrl(C),x=(C,E)=>e.generateProductUrl(C,E),b=async C=>e.addCartAttributes(C);W.useEffect(()=>{n&&d()},[n,d]);const w={isLoading:r,error:o,cart:u,fetchCart:d,addToCart:p,removeFromCart:h,updateQuantity:m,clearCart:v,generateCartUrl:_,generateProductUrl:x,addCartAttributes:b};return $.jsx(lT.Provider,{value:w,children:t})},vo=Object.create(null);vo.open="0",vo.close="1",vo.ping="2",vo.pong="3",vo.message="4",vo.upgrade="5",vo.noop="6";const Cv=Object.create(null);Object.keys(vo).forEach(e=>{Cv[vo[e]]=e});const JS={type:"error",data:"parser error"},a$=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",s$=typeof ArrayBuffer=="function",l$=e=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(e):e&&e.buffer instanceof ArrayBuffer,ew=({type:e,data:t},n,r)=>a$&&t instanceof Blob?n?r(t):u$(t,r):s$&&(t instanceof ArrayBuffer||l$(t))?n?r(t):u$(new Blob([t]),r):r(vo[e]+(t||"")),u$=(e,t)=>{const n=new FileReader;return n.onload=function(){const r=n.result.split(",")[1];t("b"+(r||""))},n.readAsDataURL(e)};function c$(e){return e instanceof Uint8Array?e:e instanceof ArrayBuffer?new Uint8Array(e):new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}let tw;function Nee(e,t){if(a$&&e.data instanceof Blob)return e.data.arrayBuffer().then(c$).then(t);if(s$&&(e.data instanceof ArrayBuffer||l$(e.data)))return t(c$(e.data));ew(e,!1,n=>{tw||(tw=new TextEncoder),t(tw.encode(n))})}const f$="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",nd=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let e=0;e<f$.length;e++)nd[f$.charCodeAt(e)]=e;const Pee=e=>{let t=e.length*.75,n=e.length,r,i=0,o,s,u,c;e[e.length-1]==="="&&(t--,e[e.length-2]==="="&&t--);const d=new ArrayBuffer(t),p=new Uint8Array(d);for(r=0;r<n;r+=4)o=nd[e.charCodeAt(r)],s=nd[e.charCodeAt(r+1)],u=nd[e.charCodeAt(r+2)],c=nd[e.charCodeAt(r+3)],p[i++]=o<<2|s>>4,p[i++]=(s&15)<<4|u>>2,p[i++]=(u&3)<<6|c&63;return d},Bee=typeof ArrayBuffer=="function",nw=(e,t)=>{if(typeof e!="string")return{type:"message",data:d$(e,t)};const n=e.charAt(0);return n==="b"?{type:"message",data:Fee(e.substring(1),t)}:Cv[n]?e.length>1?{type:Cv[n],data:e.substring(1)}:{type:Cv[n]}:JS},Fee=(e,t)=>{if(Bee){const n=Pee(e);return d$(n,t)}else return{base64:!0,data:e}},d$=(e,t)=>{switch(t){case"blob":return e instanceof Blob?e:new Blob([e]);case"arraybuffer":default:return e instanceof ArrayBuffer?e:e.buffer}},h$="",Uee=(e,t)=>{const n=e.length,r=new Array(n);let i=0;e.forEach((o,s)=>{ew(o,!1,u=>{r[s]=u,++i===n&&t(r.join(h$))})})},zee=(e,t)=>{const n=e.split(h$),r=[];for(let i=0;i<n.length;i++){const o=nw(n[i],t);if(r.push(o),o.type==="error")break}return r};function qee(){return new TransformStream({transform(e,t){Nee(e,n=>{const r=n.length;let i;if(r<126)i=new Uint8Array(1),new DataView(i.buffer).setUint8(0,r);else if(r<65536){i=new Uint8Array(3);const o=new DataView(i.buffer);o.setUint8(0,126),o.setUint16(1,r)}else{i=new Uint8Array(9);const o=new DataView(i.buffer);o.setUint8(0,127),o.setBigUint64(1,BigInt(r))}e.data&&typeof e.data!="string"&&(i[0]|=128),t.enqueue(i),t.enqueue(n)})}})}let rw;function Ev(e){return e.reduce((t,n)=>t+n.length,0)}function kv(e,t){if(e[0].length===t)return e.shift();const n=new Uint8Array(t);let r=0;for(let i=0;i<t;i++)n[i]=e[0][r++],r===e[0].length&&(e.shift(),r=0);return e.length&&r<e[0].length&&(e[0]=e[0].slice(r)),n}function jee(e,t){rw||(rw=new TextDecoder);const n=[];let r=0,i=-1,o=!1;return new TransformStream({transform(s,u){for(n.push(s);;){if(r===0){if(Ev(n)<1)break;const c=kv(n,1);o=(c[0]&128)===128,i=c[0]&127,i<126?r=3:i===126?r=1:r=2}else if(r===1){if(Ev(n)<2)break;const c=kv(n,2);i=new DataView(c.buffer,c.byteOffset,c.length).getUint16(0),r=3}else if(r===2){if(Ev(n)<8)break;const c=kv(n,8),d=new DataView(c.buffer,c.byteOffset,c.length),p=d.getUint32(0);if(p>Math.pow(2,21)-1){u.enqueue(JS);break}i=p*Math.pow(2,32)+d.getUint32(4),r=3}else{if(Ev(n)<i)break;const c=kv(n,i);u.enqueue(nw(o?c:rw.decode(c),t)),r=0}if(i===0||i>e){u.enqueue(JS);break}}}})}const p$=4;function Gn(e){if(e)return Hee(e)}function Hee(e){for(var t in Gn.prototype)e[t]=Gn.prototype[t];return e}Gn.prototype.on=Gn.prototype.addEventListener=function(e,t){return this._callbacks=this._callbacks||{},(this._callbacks["$"+e]=this._callbacks["$"+e]||[]).push(t),this},Gn.prototype.once=function(e,t){function n(){this.off(e,n),t.apply(this,arguments)}return n.fn=t,this.on(e,n),this},Gn.prototype.off=Gn.prototype.removeListener=Gn.prototype.removeAllListeners=Gn.prototype.removeEventListener=function(e,t){if(this._callbacks=this._callbacks||{},arguments.length==0)return this._callbacks={},this;var n=this._callbacks["$"+e];if(!n)return this;if(arguments.length==1)return delete this._callbacks["$"+e],this;for(var r,i=0;i<n.length;i++)if(r=n[i],r===t||r.fn===t){n.splice(i,1);break}return n.length===0&&delete this._callbacks["$"+e],this},Gn.prototype.emit=function(e){this._callbacks=this._callbacks||{};for(var t=new Array(arguments.length-1),n=this._callbacks["$"+e],r=1;r<arguments.length;r++)t[r-1]=arguments[r];if(n){n=n.slice(0);for(var r=0,i=n.length;r<i;++r)n[r].apply(this,t)}return this},Gn.prototype.emitReserved=Gn.prototype.emit,Gn.prototype.listeners=function(e){return this._callbacks=this._callbacks||{},this._callbacks["$"+e]||[]},Gn.prototype.hasListeners=function(e){return!!this.listeners(e).length};const Av=typeof Promise=="function"&&typeof Promise.resolve=="function"?t=>Promise.resolve().then(t):(t,n)=>n(t,0),Ei=typeof self<"u"?self:typeof window<"u"?window:Function("return this")(),Gee="arraybuffer";function eie(){}function g$(e,...t){return t.reduce((n,r)=>(e.hasOwnProperty(r)&&(n[r]=e[r]),n),{})}const Vee=Ei.setTimeout,Zee=Ei.clearTimeout;function Iv(e,t){t.useNativeTimers?(e.setTimeoutFn=Vee.bind(Ei),e.clearTimeoutFn=Zee.bind(Ei)):(e.setTimeoutFn=Ei.setTimeout.bind(Ei),e.clearTimeoutFn=Ei.clearTimeout.bind(Ei))}const Yee=1.33;function Wee(e){return typeof e=="string"?Kee(e):Math.ceil((e.byteLength||e.size)*Yee)}function Kee(e){let t=0,n=0;for(let r=0,i=e.length;r<i;r++)t=e.charCodeAt(r),t<128?n+=1:t<2048?n+=2:t<55296||t>=57344?n+=3:(r++,n+=4);return n}function m$(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}function Qee(e){let t="";for(let n in e)e.hasOwnProperty(n)&&(t.length&&(t+="&"),t+=encodeURIComponent(n)+"="+encodeURIComponent(e[n]));return t}function Xee(e){let t={},n=e.split("&");for(let r=0,i=n.length;r<i;r++){let o=n[r].split("=");t[decodeURIComponent(o[0])]=decodeURIComponent(o[1])}return t}class Jee extends Error{constructor(t,n,r){super(t),this.description=n,this.context=r,this.type="TransportError"}}class iw extends Gn{constructor(t){super(),this.writable=!1,Iv(this,t),this.opts=t,this.query=t.query,this.socket=t.socket,this.supportsBinary=!t.forceBase64}onError(t,n,r){return super.emitReserved("error",new Jee(t,n,r)),this}open(){return this.readyState="opening",this.doOpen(),this}close(){return(this.readyState==="opening"||this.readyState==="open")&&(this.doClose(),this.onClose()),this}send(t){this.readyState==="open"&&this.write(t)}onOpen(){this.readyState="open",this.writable=!0,super.emitReserved("open")}onData(t){const n=nw(t,this.socket.binaryType);this.onPacket(n)}onPacket(t){super.emitReserved("packet",t)}onClose(t){this.readyState="closed",super.emitReserved("close",t)}pause(t){}createUri(t,n={}){return t+"://"+this._hostname()+this._port()+this.opts.path+this._query(n)}_hostname(){const t=this.opts.hostname;return t.indexOf(":")===-1?t:"["+t+"]"}_port(){return this.opts.port&&(this.opts.secure&&+(this.opts.port!==443)||!this.opts.secure&&Number(this.opts.port)!==80)?":"+this.opts.port:""}_query(t){const n=Qee(t);return n.length?"?"+n:""}}class ete extends iw{constructor(){super(...arguments),this._polling=!1}get name(){return"polling"}doOpen(){this._poll()}pause(t){this.readyState="pausing";const n=()=>{this.readyState="paused",t()};if(this._polling||!this.writable){let r=0;this._polling&&(r++,this.once("pollComplete",function(){--r||n()})),this.writable||(r++,this.once("drain",function(){--r||n()}))}else n()}_poll(){this._polling=!0,this.doPoll(),this.emitReserved("poll")}onData(t){const n=r=>{if(this.readyState==="opening"&&r.type==="open"&&this.onOpen(),r.type==="close")return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(r)};zee(t,this.socket.binaryType).forEach(n),this.readyState!=="closed"&&(this._polling=!1,this.emitReserved("pollComplete"),this.readyState==="open"&&this._poll())}doClose(){const t=()=>{this.write([{type:"close"}])};this.readyState==="open"?t():this.once("open",t)}write(t){this.writable=!1,Uee(t,n=>{this.doWrite(n,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){const t=this.opts.secure?"https":"http",n=this.query||{};return this.opts.timestampRequests!==!1&&(n[this.opts.timestampParam]=m$()),!this.supportsBinary&&!n.sid&&(n.b64=1),this.createUri(t,n)}}let v$=!1;try{v$=typeof XMLHttpRequest<"u"&&"withCredentials"in new XMLHttpRequest}catch{}const tte=v$;function nte(){}class rte extends ete{constructor(t){if(super(t),typeof location<"u"){const n=location.protocol==="https:";let r=location.port;r||(r=n?"443":"80"),this.xd=typeof location<"u"&&t.hostname!==location.hostname||r!==t.port}}doWrite(t,n){const r=this.request({method:"POST",data:t});r.on("success",n),r.on("error",(i,o)=>{this.onError("xhr post error",i,o)})}doPoll(){const t=this.request();t.on("data",this.onData.bind(this)),t.on("error",(n,r)=>{this.onError("xhr poll error",n,r)}),this.pollXhr=t}}class yo extends Gn{constructor(t,n,r){super(),this.createRequest=t,Iv(this,r),this._opts=r,this._method=r.method||"GET",this._uri=n,this._data=r.data!==void 0?r.data:null,this._create()}_create(){var t;const n=g$(this._opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");n.xdomain=!!this._opts.xd;const r=this._xhr=this.createRequest(n);try{r.open(this._method,this._uri,!0);try{if(this._opts.extraHeaders){r.setDisableHeaderCheck&&r.setDisableHeaderCheck(!0);for(let i in this._opts.extraHeaders)this._opts.extraHeaders.hasOwnProperty(i)&&r.setRequestHeader(i,this._opts.extraHeaders[i])}}catch{}if(this._method==="POST")try{r.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch{}try{r.setRequestHeader("Accept","*/*")}catch{}(t=this._opts.cookieJar)===null||t===void 0||t.addCookies(r),"withCredentials"in r&&(r.withCredentials=this._opts.withCredentials),this._opts.requestTimeout&&(r.timeout=this._opts.requestTimeout),r.onreadystatechange=()=>{var i;r.readyState===3&&((i=this._opts.cookieJar)===null||i===void 0||i.parseCookies(r.getResponseHeader("set-cookie"))),r.readyState===4&&(r.status===200||r.status===1223?this._onLoad():this.setTimeoutFn(()=>{this._onError(typeof r.status=="number"?r.status:0)},0))},r.send(this._data)}catch(i){this.setTimeoutFn(()=>{this._onError(i)},0);return}typeof document<"u"&&(this._index=yo.requestsCount++,yo.requests[this._index]=this)}_onError(t){this.emitReserved("error",t,this._xhr),this._cleanup(!0)}_cleanup(t){if(!(typeof this._xhr>"u"||this._xhr===null)){if(this._xhr.onreadystatechange=nte,t)try{this._xhr.abort()}catch{}typeof document<"u"&&delete yo.requests[this._index],this._xhr=null}}_onLoad(){const t=this._xhr.responseText;t!==null&&(this.emitReserved("data",t),this.emitReserved("success"),this._cleanup())}abort(){this._cleanup()}}if(yo.requestsCount=0,yo.requests={},typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",y$);else if(typeof addEventListener=="function"){const e="onpagehide"in Ei?"pagehide":"unload";addEventListener(e,y$,!1)}}function y$(){for(let e in yo.requests)yo.requests.hasOwnProperty(e)&&yo.requests[e].abort()}const ite=function(){const e=_$({xdomain:!1});return e&&e.responseType!==null}();class ote extends rte{constructor(t){super(t);const n=t&&t.forceBase64;this.supportsBinary=ite&&!n}request(t={}){return Object.assign(t,{xd:this.xd},this.opts),new yo(_$,this.uri(),t)}}function _$(e){const t=e.xdomain;try{if(typeof XMLHttpRequest<"u"&&(!t||tte))return new XMLHttpRequest}catch{}if(!t)try{return new Ei[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch{}}const b$=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative";class ate extends iw{get name(){return"websocket"}doOpen(){const t=this.uri(),n=this.opts.protocols,r=b$?{}:g$(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(r.headers=this.opts.extraHeaders);try{this.ws=this.createSocket(t,n,r)}catch(i){return this.emitReserved("error",i)}this.ws.binaryType=this.socket.binaryType,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=t=>this.onClose({description:"websocket connection closed",context:t}),this.ws.onmessage=t=>this.onData(t.data),this.ws.onerror=t=>this.onError("websocket error",t)}write(t){this.writable=!1;for(let n=0;n<t.length;n++){const r=t[n],i=n===t.length-1;ew(r,this.supportsBinary,o=>{try{this.doWrite(r,o)}catch{}i&&Av(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){typeof this.ws<"u"&&(this.ws.onerror=()=>{},this.ws.close(),this.ws=null)}uri(){const t=this.opts.secure?"wss":"ws",n=this.query||{};return this.opts.timestampRequests&&(n[this.opts.timestampParam]=m$()),this.supportsBinary||(n.b64=1),this.createUri(t,n)}}const ow=Ei.WebSocket||Ei.MozWebSocket;class ste extends ate{createSocket(t,n,r){return b$?new ow(t,n,r):n?new ow(t,n):new ow(t)}doWrite(t,n){this.ws.send(n)}}class lte extends iw{get name(){return"webtransport"}doOpen(){try{this._transport=new WebTransport(this.createUri("https"),this.opts.transportOptions[this.name])}catch(t){return this.emitReserved("error",t)}this._transport.closed.then(()=>{this.onClose()}).catch(t=>{this.onError("webtransport error",t)}),this._transport.ready.then(()=>{this._transport.createBidirectionalStream().then(t=>{const n=jee(Number.MAX_SAFE_INTEGER,this.socket.binaryType),r=t.readable.pipeThrough(n).getReader(),i=qee();i.readable.pipeTo(t.writable),this._writer=i.writable.getWriter();const o=()=>{r.read().then(({done:u,value:c})=>{u||(this.onPacket(c),o())}).catch(u=>{})};o();const s={type:"open"};this.query.sid&&(s.data=`{"sid":"${this.query.sid}"}`),this._writer.write(s).then(()=>this.onOpen())})})}write(t){this.writable=!1;for(let n=0;n<t.length;n++){const r=t[n],i=n===t.length-1;this._writer.write(r).then(()=>{i&&Av(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var t;(t=this._transport)===null||t===void 0||t.close()}}const ute={websocket:ste,webtransport:lte,polling:ote},cte=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,fte=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function aw(e){if(e.length>8e3)throw"URI too long";const t=e,n=e.indexOf("["),r=e.indexOf("]");n!=-1&&r!=-1&&(e=e.substring(0,n)+e.substring(n,r).replace(/:/g,";")+e.substring(r,e.length));let i=cte.exec(e||""),o={},s=14;for(;s--;)o[fte[s]]=i[s]||"";return n!=-1&&r!=-1&&(o.source=t,o.host=o.host.substring(1,o.host.length-1).replace(/;/g,":"),o.authority=o.authority.replace("[","").replace("]","").replace(/;/g,":"),o.ipv6uri=!0),o.pathNames=dte(o,o.path),o.queryKey=hte(o,o.query),o}function dte(e,t){const n=/\/{2,9}/g,r=t.replace(n,"/").split("/");return(t.slice(0,1)=="/"||t.length===0)&&r.splice(0,1),t.slice(-1)=="/"&&r.splice(r.length-1,1),r}function hte(e,t){const n={};return t.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(r,i,o){i&&(n[i]=o)}),n}const sw=typeof addEventListener=="function"&&typeof removeEventListener=="function",Rv=[];sw&&addEventListener("offline",()=>{Rv.forEach(e=>e())},!1);class Xa extends Gn{constructor(t,n){if(super(),this.binaryType=Gee,this.writeBuffer=[],this._prevBufferLen=0,this._pingInterval=-1,this._pingTimeout=-1,this._maxPayload=-1,this._pingTimeoutTime=1/0,t&&typeof t=="object"&&(n=t,t=null),t){const r=aw(t);n.hostname=r.host,n.secure=r.protocol==="https"||r.protocol==="wss",n.port=r.port,r.query&&(n.query=r.query)}else n.host&&(n.hostname=aw(n.host).host);Iv(this,n),this.secure=n.secure!=null?n.secure:typeof location<"u"&&location.protocol==="https:",n.hostname&&!n.port&&(n.port=this.secure?"443":"80"),this.hostname=n.hostname||(typeof location<"u"?location.hostname:"localhost"),this.port=n.port||(typeof location<"u"&&location.port?location.port:this.secure?"443":"80"),this.transports=[],this._transportsByName={},n.transports.forEach(r=>{const i=r.prototype.name;this.transports.push(i),this._transportsByName[i]=r}),this.opts=Object.assign({path:"/engine.io",agent:!1,withCredentials:!1,upgrade:!0,timestampParam:"t",rememberUpgrade:!1,addTrailingSlash:!0,rejectUnauthorized:!0,perMessageDeflate:{threshold:1024},transportOptions:{},closeOnBeforeunload:!1},n),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),typeof this.opts.query=="string"&&(this.opts.query=Xee(this.opts.query)),sw&&(this.opts.closeOnBeforeunload&&(this._beforeunloadEventListener=()=>{this.transport&&(this.transport.removeAllListeners(),this.transport.close())},addEventListener("beforeunload",this._beforeunloadEventListener,!1)),this.hostname!=="localhost"&&(this._offlineEventListener=()=>{this._onClose("transport close",{description:"network connection lost"})},Rv.push(this._offlineEventListener))),this.opts.withCredentials&&(this._cookieJar=void 0),this._open()}createTransport(t){const n=Object.assign({},this.opts.query);n.EIO=p$,n.transport=t,this.id&&(n.sid=this.id);const r=Object.assign({},this.opts,{query:n,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[t]);return new this._transportsByName[t](r)}_open(){if(this.transports.length===0){this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);return}const t=this.opts.rememberUpgrade&&Xa.priorWebsocketSuccess&&this.transports.indexOf("websocket")!==-1?"websocket":this.transports[0];this.readyState="opening";const n=this.createTransport(t);n.open(),this.setTransport(n)}setTransport(t){this.transport&&this.transport.removeAllListeners(),this.transport=t,t.on("drain",this._onDrain.bind(this)).on("packet",this._onPacket.bind(this)).on("error",this._onError.bind(this)).on("close",n=>this._onClose("transport close",n))}onOpen(){this.readyState="open",Xa.priorWebsocketSuccess=this.transport.name==="websocket",this.emitReserved("open"),this.flush()}_onPacket(t){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")switch(this.emitReserved("packet",t),this.emitReserved("heartbeat"),t.type){case"open":this.onHandshake(JSON.parse(t.data));break;case"ping":this._sendPacket("pong"),this.emitReserved("ping"),this.emitReserved("pong"),this._resetPingTimeout();break;case"error":const n=new Error("server error");n.code=t.data,this._onError(n);break;case"message":this.emitReserved("data",t.data),this.emitReserved("message",t.data);break}}onHandshake(t){this.emitReserved("handshake",t),this.id=t.sid,this.transport.query.sid=t.sid,this._pingInterval=t.pingInterval,this._pingTimeout=t.pingTimeout,this._maxPayload=t.maxPayload,this.onOpen(),this.readyState!=="closed"&&this._resetPingTimeout()}_resetPingTimeout(){this.clearTimeoutFn(this._pingTimeoutTimer);const t=this._pingInterval+this._pingTimeout;this._pingTimeoutTime=Date.now()+t,this._pingTimeoutTimer=this.setTimeoutFn(()=>{this._onClose("ping timeout")},t),this.opts.autoUnref&&this._pingTimeoutTimer.unref()}_onDrain(){this.writeBuffer.splice(0,this._prevBufferLen),this._prevBufferLen=0,this.writeBuffer.length===0?this.emitReserved("drain"):this.flush()}flush(){if(this.readyState!=="closed"&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){const t=this._getWritablePackets();this.transport.send(t),this._prevBufferLen=t.length,this.emitReserved("flush")}}_getWritablePackets(){if(!(this._maxPayload&&this.transport.name==="polling"&&this.writeBuffer.length>1))return this.writeBuffer;let n=1;for(let r=0;r<this.writeBuffer.length;r++){const i=this.writeBuffer[r].data;if(i&&(n+=Wee(i)),r>0&&n>this._maxPayload)return this.writeBuffer.slice(0,r);n+=2}return this.writeBuffer}_hasPingExpired(){if(!this._pingTimeoutTime)return!0;const t=Date.now()>this._pingTimeoutTime;return t&&(this._pingTimeoutTime=0,Av(()=>{this._onClose("ping timeout")},this.setTimeoutFn)),t}write(t,n,r){return this._sendPacket("message",t,n,r),this}send(t,n,r){return this._sendPacket("message",t,n,r),this}_sendPacket(t,n,r,i){if(typeof n=="function"&&(i=n,n=void 0),typeof r=="function"&&(i=r,r=null),this.readyState==="closing"||this.readyState==="closed")return;r=r||{},r.compress=r.compress!==!1;const o={type:t,data:n,options:r};this.emitReserved("packetCreate",o),this.writeBuffer.push(o),i&&this.once("flush",i),this.flush()}close(){const t=()=>{this._onClose("forced close"),this.transport.close()},n=()=>{this.off("upgrade",n),this.off("upgradeError",n),t()},r=()=>{this.once("upgrade",n),this.once("upgradeError",n)};return(this.readyState==="opening"||this.readyState==="open")&&(this.readyState="closing",this.writeBuffer.length?this.once("drain",()=>{this.upgrading?r():t()}):this.upgrading?r():t()),this}_onError(t){if(Xa.priorWebsocketSuccess=!1,this.opts.tryAllTransports&&this.transports.length>1&&this.readyState==="opening")return this.transports.shift(),this._open();this.emitReserved("error",t),this._onClose("transport error",t)}_onClose(t,n){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing"){if(this.clearTimeoutFn(this._pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),sw&&(this._beforeunloadEventListener&&removeEventListener("beforeunload",this._beforeunloadEventListener,!1),this._offlineEventListener)){const r=Rv.indexOf(this._offlineEventListener);r!==-1&&Rv.splice(r,1)}this.readyState="closed",this.id=null,this.emitReserved("close",t,n),this.writeBuffer=[],this._prevBufferLen=0}}}Xa.protocol=p$;class pte extends Xa{constructor(){super(...arguments),this._upgrades=[]}onOpen(){if(super.onOpen(),this.readyState==="open"&&this.opts.upgrade)for(let t=0;t<this._upgrades.length;t++)this._probe(this._upgrades[t])}_probe(t){let n=this.createTransport(t),r=!1;Xa.priorWebsocketSuccess=!1;const i=()=>{r||(n.send([{type:"ping",data:"probe"}]),n.once("packet",h=>{if(!r)if(h.type==="pong"&&h.data==="probe"){if(this.upgrading=!0,this.emitReserved("upgrading",n),!n)return;Xa.priorWebsocketSuccess=n.name==="websocket",this.transport.pause(()=>{r||this.readyState!=="closed"&&(p(),this.setTransport(n),n.send([{type:"upgrade"}]),this.emitReserved("upgrade",n),n=null,this.upgrading=!1,this.flush())})}else{const m=new Error("probe error");m.transport=n.name,this.emitReserved("upgradeError",m)}}))};function o(){r||(r=!0,p(),n.close(),n=null)}const s=h=>{const m=new Error("probe error: "+h);m.transport=n.name,o(),this.emitReserved("upgradeError",m)};function u(){s("transport closed")}function c(){s("socket closed")}function d(h){n&&h.name!==n.name&&o()}const p=()=>{n.removeListener("open",i),n.removeListener("error",s),n.removeListener("close",u),this.off("close",c),this.off("upgrading",d)};n.once("open",i),n.once("error",s),n.once("close",u),this.once("close",c),this.once("upgrading",d),this._upgrades.indexOf("webtransport")!==-1&&t!=="webtransport"?this.setTimeoutFn(()=>{r||n.open()},200):n.open()}onHandshake(t){this._upgrades=this._filterUpgrades(t.upgrades),super.onHandshake(t)}_filterUpgrades(t){const n=[];for(let r=0;r<t.length;r++)~this.transports.indexOf(t[r])&&n.push(t[r]);return n}}let gte=class extends pte{constructor(t,n={}){const r=typeof t=="object"?t:n;(!r.transports||r.transports&&typeof r.transports[0]=="string")&&(r.transports=(r.transports||["polling","websocket","webtransport"]).map(i=>ute[i]).filter(i=>!!i)),super(t,r)}};function mte(e,t="",n){let r=e;n=n||typeof location<"u"&&location,e==null&&(e=n.protocol+"//"+n.host),typeof e=="string"&&(e.charAt(0)==="/"&&(e.charAt(1)==="/"?e=n.protocol+e:e=n.host+e),/^(https?|wss?):\/\//.test(e)||(typeof n<"u"?e=n.protocol+"//"+e:e="https://"+e),r=aw(e)),r.port||(/^(http|ws)$/.test(r.protocol)?r.port="80":/^(http|ws)s$/.test(r.protocol)&&(r.port="443")),r.path=r.path||"/";const o=r.host.indexOf(":")!==-1?"["+r.host+"]":r.host;return r.id=r.protocol+"://"+o+":"+r.port+t,r.href=r.protocol+"://"+o+(n&&n.port===r.port?"":":"+r.port),r}const vte=typeof ArrayBuffer=="function",yte=e=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(e):e.buffer instanceof ArrayBuffer,S$=Object.prototype.toString,_te=typeof Blob=="function"||typeof Blob<"u"&&S$.call(Blob)==="[object BlobConstructor]",bte=typeof File=="function"||typeof File<"u"&&S$.call(File)==="[object FileConstructor]";function lw(e){return vte&&(e instanceof ArrayBuffer||yte(e))||_te&&e instanceof Blob||bte&&e instanceof File}function Ov(e,t){if(!e||typeof e!="object")return!1;if(Array.isArray(e)){for(let n=0,r=e.length;n<r;n++)if(Ov(e[n]))return!0;return!1}if(lw(e))return!0;if(e.toJSON&&typeof e.toJSON=="function"&&arguments.length===1)return Ov(e.toJSON(),!0);for(const n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&Ov(e[n]))return!0;return!1}function Ste(e){const t=[],n=e.data,r=e;return r.data=uw(n,t),r.attachments=t.length,{packet:r,buffers:t}}function uw(e,t){if(!e)return e;if(lw(e)){const n={_placeholder:!0,num:t.length};return t.push(e),n}else if(Array.isArray(e)){const n=new Array(e.length);for(let r=0;r<e.length;r++)n[r]=uw(e[r],t);return n}else if(typeof e=="object"&&!(e instanceof Date)){const n={};for(const r in e)Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=uw(e[r],t));return n}return e}function wte(e,t){return e.data=cw(e.data,t),delete e.attachments,e}function cw(e,t){if(!e)return e;if(e&&e._placeholder===!0){if(typeof e.num=="number"&&e.num>=0&&e.num<t.length)return t[e.num];throw new Error("illegal attachments")}else if(Array.isArray(e))for(let n=0;n<e.length;n++)e[n]=cw(e[n],t);else if(typeof e=="object")for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&(e[n]=cw(e[n],t));return e}const xte=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"],Cte=5;var $t;(function(e){e[e.CONNECT=0]="CONNECT",e[e.DISCONNECT=1]="DISCONNECT",e[e.EVENT=2]="EVENT",e[e.ACK=3]="ACK",e[e.CONNECT_ERROR=4]="CONNECT_ERROR",e[e.BINARY_EVENT=5]="BINARY_EVENT",e[e.BINARY_ACK=6]="BINARY_ACK"})($t||($t={}));class Ete{constructor(t){this.replacer=t}encode(t){return(t.type===$t.EVENT||t.type===$t.ACK)&&Ov(t)?this.encodeAsBinary({type:t.type===$t.EVENT?$t.BINARY_EVENT:$t.BINARY_ACK,nsp:t.nsp,data:t.data,id:t.id}):[this.encodeAsString(t)]}encodeAsString(t){let n=""+t.type;return(t.type===$t.BINARY_EVENT||t.type===$t.BINARY_ACK)&&(n+=t.attachments+"-"),t.nsp&&t.nsp!=="/"&&(n+=t.nsp+","),t.id!=null&&(n+=t.id),t.data!=null&&(n+=JSON.stringify(t.data,this.replacer)),n}encodeAsBinary(t){const n=Ste(t),r=this.encodeAsString(n.packet),i=n.buffers;return i.unshift(r),i}}function w$(e){return Object.prototype.toString.call(e)==="[object Object]"}class fw extends Gn{constructor(t){super(),this.reviver=t}add(t){let n;if(typeof t=="string"){if(this.reconstructor)throw new Error("got plaintext data when reconstructing a packet");n=this.decodeString(t);const r=n.type===$t.BINARY_EVENT;r||n.type===$t.BINARY_ACK?(n.type=r?$t.EVENT:$t.ACK,this.reconstructor=new kte(n),n.attachments===0&&super.emitReserved("decoded",n)):super.emitReserved("decoded",n)}else if(lw(t)||t.base64)if(this.reconstructor)n=this.reconstructor.takeBinaryData(t),n&&(this.reconstructor=null,super.emitReserved("decoded",n));else throw new Error("got binary data when not reconstructing a packet");else throw new Error("Unknown type: "+t)}decodeString(t){let n=0;const r={type:Number(t.charAt(0))};if($t[r.type]===void 0)throw new Error("unknown packet type "+r.type);if(r.type===$t.BINARY_EVENT||r.type===$t.BINARY_ACK){const o=n+1;for(;t.charAt(++n)!=="-"&&n!=t.length;);const s=t.substring(o,n);if(s!=Number(s)||t.charAt(n)!=="-")throw new Error("Illegal attachments");r.attachments=Number(s)}if(t.charAt(n+1)==="/"){const o=n+1;for(;++n&&!(t.charAt(n)===","||n===t.length););r.nsp=t.substring(o,n)}else r.nsp="/";const i=t.charAt(n+1);if(i!==""&&Number(i)==i){const o=n+1;for(;++n;){const s=t.charAt(n);if(s==null||Number(s)!=s){--n;break}if(n===t.length)break}r.id=Number(t.substring(o,n+1))}if(t.charAt(++n)){const o=this.tryParse(t.substr(n));if(fw.isPayloadValid(r.type,o))r.data=o;else throw new Error("invalid payload")}return r}tryParse(t){try{return JSON.parse(t,this.reviver)}catch{return!1}}static isPayloadValid(t,n){switch(t){case $t.CONNECT:return w$(n);case $t.DISCONNECT:return n===void 0;case $t.CONNECT_ERROR:return typeof n=="string"||w$(n);case $t.EVENT:case $t.BINARY_EVENT:return Array.isArray(n)&&(typeof n[0]=="number"||typeof n[0]=="string"&&xte.indexOf(n[0])===-1);case $t.ACK:case $t.BINARY_ACK:return Array.isArray(n)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}}class kte{constructor(t){this.packet=t,this.buffers=[],this.reconPack=t}takeBinaryData(t){if(this.buffers.push(t),this.buffers.length===this.reconPack.attachments){const n=wte(this.reconPack,this.buffers);return this.finishedReconstruction(),n}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}const Ate=Object.freeze(Object.defineProperty({__proto__:null,Decoder:fw,Encoder:Ete,get PacketType(){return $t},protocol:Cte},Symbol.toStringTag,{value:"Module"}));function Yi(e,t,n){return e.on(t,n),function(){e.off(t,n)}}const Ite=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class x$ extends Gn{constructor(t,n,r){super(),this.connected=!1,this.recovered=!1,this.receiveBuffer=[],this.sendBuffer=[],this._queue=[],this._queueSeq=0,this.ids=0,this.acks={},this.flags={},this.io=t,this.nsp=n,r&&r.auth&&(this.auth=r.auth),this._opts=Object.assign({},r),this.io._autoConnect&&this.open()}get disconnected(){return!this.connected}subEvents(){if(this.subs)return;const t=this.io;this.subs=[Yi(t,"open",this.onopen.bind(this)),Yi(t,"packet",this.onpacket.bind(this)),Yi(t,"error",this.onerror.bind(this)),Yi(t,"close",this.onclose.bind(this))]}get active(){return!!this.subs}connect(){return this.connected?this:(this.subEvents(),this.io._reconnecting||this.io.open(),this.io._readyState==="open"&&this.onopen(),this)}open(){return this.connect()}send(...t){return t.unshift("message"),this.emit.apply(this,t),this}emit(t,...n){var r,i,o;if(Ite.hasOwnProperty(t))throw new Error('"'+t.toString()+'" is a reserved event name');if(n.unshift(t),this._opts.retries&&!this.flags.fromQueue&&!this.flags.volatile)return this._addToQueue(n),this;const s={type:$t.EVENT,data:n};if(s.options={},s.options.compress=this.flags.compress!==!1,typeof n[n.length-1]=="function"){const p=this.ids++,h=n.pop();this._registerAckCallback(p,h),s.id=p}const u=(i=(r=this.io.engine)===null||r===void 0?void 0:r.transport)===null||i===void 0?void 0:i.writable,c=this.connected&&!(!((o=this.io.engine)===null||o===void 0)&&o._hasPingExpired());return this.flags.volatile&&!u||(c?(this.notifyOutgoingListeners(s),this.packet(s)):this.sendBuffer.push(s)),this.flags={},this}_registerAckCallback(t,n){var r;const i=(r=this.flags.timeout)!==null&&r!==void 0?r:this._opts.ackTimeout;if(i===void 0){this.acks[t]=n;return}const o=this.io.setTimeoutFn(()=>{delete this.acks[t];for(let u=0;u<this.sendBuffer.length;u++)this.sendBuffer[u].id===t&&this.sendBuffer.splice(u,1);n.call(this,new Error("operation has timed out"))},i),s=(...u)=>{this.io.clearTimeoutFn(o),n.apply(this,u)};s.withError=!0,this.acks[t]=s}emitWithAck(t,...n){return new Promise((r,i)=>{const o=(s,u)=>s?i(s):r(u);o.withError=!0,n.push(o),this.emit(t,...n)})}_addToQueue(t){let n;typeof t[t.length-1]=="function"&&(n=t.pop());const r={id:this._queueSeq++,tryCount:0,pending:!1,args:t,flags:Object.assign({fromQueue:!0},this.flags)};t.push((i,...o)=>r!==this._queue[0]?void 0:(i!==null?r.tryCount>this._opts.retries&&(this._queue.shift(),n&&n(i)):(this._queue.shift(),n&&n(null,...o)),r.pending=!1,this._drainQueue())),this._queue.push(r),this._drainQueue()}_drainQueue(t=!1){if(!this.connected||this._queue.length===0)return;const n=this._queue[0];n.pending&&!t||(n.pending=!0,n.tryCount++,this.flags=n.flags,this.emit.apply(this,n.args))}packet(t){t.nsp=this.nsp,this.io._packet(t)}onopen(){typeof this.auth=="function"?this.auth(t=>{this._sendConnectPacket(t)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(t){this.packet({type:$t.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},t):t})}onerror(t){this.connected||this.emitReserved("connect_error",t)}onclose(t,n){this.connected=!1,delete this.id,this.emitReserved("disconnect",t,n),this._clearAcks()}_clearAcks(){Object.keys(this.acks).forEach(t=>{if(!this.sendBuffer.some(r=>String(r.id)===t)){const r=this.acks[t];delete this.acks[t],r.withError&&r.call(this,new Error("socket has been disconnected"))}})}onpacket(t){if(t.nsp===this.nsp)switch(t.type){case $t.CONNECT:t.data&&t.data.sid?this.onconnect(t.data.sid,t.data.pid):this.emitReserved("connect_error",new Error("It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)"));break;case $t.EVENT:case $t.BINARY_EVENT:this.onevent(t);break;case $t.ACK:case $t.BINARY_ACK:this.onack(t);break;case $t.DISCONNECT:this.ondisconnect();break;case $t.CONNECT_ERROR:this.destroy();const r=new Error(t.data.message);r.data=t.data.data,this.emitReserved("connect_error",r);break}}onevent(t){const n=t.data||[];t.id!=null&&n.push(this.ack(t.id)),this.connected?this.emitEvent(n):this.receiveBuffer.push(Object.freeze(n))}emitEvent(t){if(this._anyListeners&&this._anyListeners.length){const n=this._anyListeners.slice();for(const r of n)r.apply(this,t)}super.emit.apply(this,t),this._pid&&t.length&&typeof t[t.length-1]=="string"&&(this._lastOffset=t[t.length-1])}ack(t){const n=this;let r=!1;return function(...i){r||(r=!0,n.packet({type:$t.ACK,id:t,data:i}))}}onack(t){const n=this.acks[t.id];typeof n=="function"&&(delete this.acks[t.id],n.withError&&t.data.unshift(null),n.apply(this,t.data))}onconnect(t,n){this.id=t,this.recovered=n&&this._pid===n,this._pid=n,this.connected=!0,this.emitBuffered(),this.emitReserved("connect"),this._drainQueue(!0)}emitBuffered(){this.receiveBuffer.forEach(t=>this.emitEvent(t)),this.receiveBuffer=[],this.sendBuffer.forEach(t=>{this.notifyOutgoingListeners(t),this.packet(t)}),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach(t=>t()),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:$t.DISCONNECT}),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(t){return this.flags.compress=t,this}get volatile(){return this.flags.volatile=!0,this}timeout(t){return this.flags.timeout=t,this}onAny(t){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(t),this}prependAny(t){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(t),this}offAny(t){if(!this._anyListeners)return this;if(t){const n=this._anyListeners;for(let r=0;r<n.length;r++)if(t===n[r])return n.splice(r,1),this}else this._anyListeners=[];return this}listenersAny(){return this._anyListeners||[]}onAnyOutgoing(t){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.push(t),this}prependAnyOutgoing(t){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.unshift(t),this}offAnyOutgoing(t){if(!this._anyOutgoingListeners)return this;if(t){const n=this._anyOutgoingListeners;for(let r=0;r<n.length;r++)if(t===n[r])return n.splice(r,1),this}else this._anyOutgoingListeners=[];return this}listenersAnyOutgoing(){return this._anyOutgoingListeners||[]}notifyOutgoingListeners(t){if(this._anyOutgoingListeners&&this._anyOutgoingListeners.length){const n=this._anyOutgoingListeners.slice();for(const r of n)r.apply(this,t.data)}}}function Pu(e){e=e||{},this.ms=e.min||100,this.max=e.max||1e4,this.factor=e.factor||2,this.jitter=e.jitter>0&&e.jitter<=1?e.jitter:0,this.attempts=0}Pu.prototype.duration=function(){var e=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var t=Math.random(),n=Math.floor(t*this.jitter*e);e=(Math.floor(t*10)&1)==0?e-n:e+n}return Math.min(e,this.max)|0},Pu.prototype.reset=function(){this.attempts=0},Pu.prototype.setMin=function(e){this.ms=e},Pu.prototype.setMax=function(e){this.max=e},Pu.prototype.setJitter=function(e){this.jitter=e};class dw extends Gn{constructor(t,n){var r;super(),this.nsps={},this.subs=[],t&&typeof t=="object"&&(n=t,t=void 0),n=n||{},n.path=n.path||"/socket.io",this.opts=n,Iv(this,n),this.reconnection(n.reconnection!==!1),this.reconnectionAttempts(n.reconnectionAttempts||1/0),this.reconnectionDelay(n.reconnectionDelay||1e3),this.reconnectionDelayMax(n.reconnectionDelayMax||5e3),this.randomizationFactor((r=n.randomizationFactor)!==null&&r!==void 0?r:.5),this.backoff=new Pu({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(n.timeout==null?2e4:n.timeout),this._readyState="closed",this.uri=t;const i=n.parser||Ate;this.encoder=new i.Encoder,this.decoder=new i.Decoder,this._autoConnect=n.autoConnect!==!1,this._autoConnect&&this.open()}reconnection(t){return arguments.length?(this._reconnection=!!t,t||(this.skipReconnect=!0),this):this._reconnection}reconnectionAttempts(t){return t===void 0?this._reconnectionAttempts:(this._reconnectionAttempts=t,this)}reconnectionDelay(t){var n;return t===void 0?this._reconnectionDelay:(this._reconnectionDelay=t,(n=this.backoff)===null||n===void 0||n.setMin(t),this)}randomizationFactor(t){var n;return t===void 0?this._randomizationFactor:(this._randomizationFactor=t,(n=this.backoff)===null||n===void 0||n.setJitter(t),this)}reconnectionDelayMax(t){var n;return t===void 0?this._reconnectionDelayMax:(this._reconnectionDelayMax=t,(n=this.backoff)===null||n===void 0||n.setMax(t),this)}timeout(t){return arguments.length?(this._timeout=t,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&this.backoff.attempts===0&&this.reconnect()}open(t){if(~this._readyState.indexOf("open"))return this;this.engine=new gte(this.uri,this.opts);const n=this.engine,r=this;this._readyState="opening",this.skipReconnect=!1;const i=Yi(n,"open",function(){r.onopen(),t&&t()}),o=u=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",u),t?t(u):this.maybeReconnectOnOpen()},s=Yi(n,"error",o);if(this._timeout!==!1){const u=this._timeout,c=this.setTimeoutFn(()=>{i(),o(new Error("timeout")),n.close()},u);this.opts.autoUnref&&c.unref(),this.subs.push(()=>{this.clearTimeoutFn(c)})}return this.subs.push(i),this.subs.push(s),this}connect(t){return this.open(t)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");const t=this.engine;this.subs.push(Yi(t,"ping",this.onping.bind(this)),Yi(t,"data",this.ondata.bind(this)),Yi(t,"error",this.onerror.bind(this)),Yi(t,"close",this.onclose.bind(this)),Yi(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(t){try{this.decoder.add(t)}catch(n){this.onclose("parse error",n)}}ondecoded(t){Av(()=>{this.emitReserved("packet",t)},this.setTimeoutFn)}onerror(t){this.emitReserved("error",t)}socket(t,n){let r=this.nsps[t];return r?this._autoConnect&&!r.active&&r.connect():(r=new x$(this,t,n),this.nsps[t]=r),r}_destroy(t){const n=Object.keys(this.nsps);for(const r of n)if(this.nsps[r].active)return;this._close()}_packet(t){const n=this.encoder.encode(t);for(let r=0;r<n.length;r++)this.engine.write(n[r],t.options)}cleanup(){this.subs.forEach(t=>t()),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close")}disconnect(){return this._close()}onclose(t,n){var r;this.cleanup(),(r=this.engine)===null||r===void 0||r.close(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",t,n),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;const t=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{const n=this.backoff.duration();this._reconnecting=!0;const r=this.setTimeoutFn(()=>{t.skipReconnect||(this.emitReserved("reconnect_attempt",t.backoff.attempts),!t.skipReconnect&&t.open(i=>{i?(t._reconnecting=!1,t.reconnect(),this.emitReserved("reconnect_error",i)):t.onreconnect()}))},n);this.opts.autoUnref&&r.unref(),this.subs.push(()=>{this.clearTimeoutFn(r)})}}onreconnect(){const t=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",t)}}const rd={};function Tv(e,t){typeof e=="object"&&(t=e,e=void 0),t=t||{};const n=mte(e,t.path||"/socket.io"),r=n.source,i=n.id,o=n.path,s=rd[i]&&o in rd[i].nsps,u=t.forceNew||t["force new connection"]||t.multiplex===!1||s;let c;return u?c=new dw(r,t):(rd[i]||(rd[i]=new dw(r,t)),c=rd[i]),n.query&&!t.query&&(t.query=n.queryKey),c.socket(n.path,t)}Object.assign(Tv,{Manager:dw,Socket:x$,io:Tv,connect:Tv});const tl=class tl{constructor(){tr(this,"socket",null);tr(this,"isConnected",!1);tr(this,"eventListeners",new Map)}static getInstance(){return tl.instance||(tl.instance=new tl),tl.instance}connect(t){return this.socket?this.socket:(this.socket=Tv(`${nZ}${t}`,{transports:["websocket"]}),this.socket.on("connect",()=>{this.isConnected=!0,this.emitEvent("connect")}),this.socket.on("disconnect",()=>{this.isConnected=!1,this.emitEvent("disconnect")}),this.socket)}disconnect(){this.socket&&(this.socket.disconnect(),this.socket=null,this.isConnected=!1,this.eventListeners.clear())}getSocket(){return this.socket}getIsConnected(){return this.isConnected}on(t,n){var r,i;this.eventListeners.has(t)||this.eventListeners.set(t,[]),(r=this.eventListeners.get(t))==null||r.push(n),(i=this.socket)==null||i.on(t,n)}off(t,n){var i;const r=this.eventListeners.get(t);if(r){const o=r.indexOf(n);o>-1&&r.splice(o,1),(i=this.socket)==null||i.off(t,n)}}emit(t,...n){var r;(r=this.socket)==null||r.emit(t,...n)}emitEvent(t,...n){const r=this.eventListeners.get(t);r&&r.forEach(i=>i(...n))}};tr(tl,"instance");let hw=tl;const _o=hw.getInstance();var Rte={MESSAGE:"MESSAGE"},Ote={USER:"USER"};const Tte=({children:e,nameSpace:t})=>{const[n,r]=W.useState([]),[i,o]=W.useState(!1),[s,u]=W.useState(!1),[c,d]=W.useState([]),[p,h]=W.useState(!1),[m,v]=W.useState(!1),[_,x]=W.useState([]),b=$S("web-socket"),[w,C]=Tn.useState([]),[E,R]=W.useState(null),[O,T]=W.useState(!1),[L,B]=W.useState(null),z=cZ(),P=ur(),[V,J]=W.useState(!1),[le,G]=Tn.useState(null),[Z,q]=W.useState(null);console.debug("isWebsocketEnabled",b),W.useEffect(()=>{if(b){const ue=_o.connect("/api/v1/chat");R(ue);const Re=()=>{console.debug("connected to websocket"),T(!0)},ie=()=>{console.debug("disconnected from websocket"),T(!1)},Ne=Fe=>{console.debug("response from websocket",Fe);const We=Fe.conversationId??crypto.randomUUID();B(We),Fe.Variants_quantity&&x(be=>[...be,...Fe.Variants_quantity]);const Pe=[...n,{text:Fe.response,products:Fe.products,conversationId:We,rating:"neutral",leading_queries:Fe.leading_queries,collections:Fe.collections,variants:Fe.variants,shop:Fe.shop,Variants_quantity:Fe.Variants_quantity,monthlyChatLimitReached:Fe.monthlyChatLimitReached,isBot:!0}];r(Pe),H(Pe),d(be=>[...be,[n[n.length-1].text,Fe.response]]),u(!1)},De=Fe=>{if(Fe.event==="error"){const We={text:"I am facing some network issues. Can you please check your network and try again?",isBot:!0},Pe=[...n,We];r(Pe),H(Pe),u(!1)}};return _o.on("connect",Re),_o.on("disconnect",ie),_o.on("response",Ne),_o.on("system",De),()=>{_o.off("connect",Re),_o.off("disconnect",ie),_o.off("response",Ne),_o.off("system",De)}}},[b,n]);const H=ue=>{sessionStorage.setItem(yi(window.DebalesChat.projectId,pi.CHAT_HISTORY),JSON.stringify(ue))},fe=()=>{const ue=sessionStorage.getItem(yi(window.DebalesChat.projectId,pi.CHAT_HISTORY));return ue?JSON.parse(ue):[]},we=W.useCallback(async()=>{var ue;if(t)try{o(!0);const Re=await fetch(`${fo}/api/wordpress/UiData?value=${t}`),ie=await Re.json();if(!Re.ok)throw new Error("failed to fetch data"+ie.error);const Ne=document.getElementById("debales-ai-assistant");Ne&&(Ne.style.zIndex=String(ie.zIndex??2031483602)),q(ie),ie!=null&&ie.shopifyShopDomain&&zW(ie.shopifyShopDomain).then(We=>{G(We)}),C(ie.suggestedQuestions);const De=fe(),Fe=((ue=ie.pluginConfig)==null?void 0:ue.collectedUserInfo)&&(ie.pluginConfig.collectedUserInfo.name||ie.pluginConfig.collectedUserInfo.email||ie.pluginConfig.collectedUserInfo.phone);if(v(Fe),De.length>0)r(De);else{const We={text:ie.initialMessage||"Hi, I am an AI Assistant. How can I help you?",isBot:!0};r([We])}}catch(Re){console.error(Re)}finally{o(!1)}},[t]);W.useEffect(()=>{we()},[we]);const k=W.useCallback(async(ue,Re,ie,Ne,De)=>{var Ke,Je;if(!ue||ue.trim()===""||s&&!ie)return;const Fe=ho(),We=Fe===null&&!V&&((Ke=Z==null?void 0:Z.pluginConfig)==null?void 0:Ke.collectedUserInfo)&&(Z.pluginConfig.collectedUserInfo.name||Z.pluginConfig.collectedUserInfo.email||Z.pluginConfig.collectedUserInfo.phone);let Pe=[...n];if(Ne?Ne&&n.length<=2?(h(!0),Pe=[]):h(!1):(Pe.push({text:ue,isBot:!1}),h(!1)),We&&((Je=Z==null?void 0:Z.pluginConfig)==null?void 0:Je.collectedUserInfo.isOptional)===!1){Pe.push({text:"I need some information from you before we can continue our conversation. Please fill out your details in the form below. This helps us provide you with better assistance and stay in touch if needed.",isBot:!0}),r(Pe),v(!0);return}const be=ur();u(!0);try{r(Pe),H(Pe);const dt=await fetch(`${fo}/api/wordpress/ChatWithBot`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sessionId:be,userMessage:ue,nameSpace:t,chat_history:c,leading_queries:De,answer:Re,products:ie,userInfo:JSON.stringify(Fe),anonymousUserId:z,distinctId:Us.getDistinctId(),timestamp:new Date().toISOString(),timeZone:Intl.DateTimeFormat().resolvedOptions().timeZone})});if(!dt.ok)throw new Error("Network response was not ok");const tt=await dt.json(),lt=tt.conversationId??crypto.randomUUID();B(lt),tt.Variants_quantity&&x(F=>[...F,...tt.Variants_quantity]);const N=[...Pe,{text:tt.response,products:tt.products,conversationId:lt,rating:"neutral",leading_queries:tt.leading_queries,collections:tt.collections,variants:tt.variants,shop:tt.shop,Variants_quantity:tt.Variants_quantity,monthlyChatLimitReached:tt.monthlyChatLimitReached,isBot:!0}];r(N),H(N),d(F=>[...F,[ue,tt.response]])}catch(dt){console.error(dt);const tt={text:"I am facing some network issues. Can you please check your network and try again?",isBot:!0},lt=[...Pe,tt];Ne||(r(lt),H(lt))}finally{u(!1)}},[n,s,c,t,z,Z,V]),ne=W.useCallback(ue=>{Z&&q(Re=>Re?{...Re,mobileDisplayMode:ue}:null)},[Z]),de=W.useCallback(async(ue,Re,ie,Ne,De)=>{var be,Ke;if(console.debug("onSendMessageWebSocket"),!ue||ue.trim()===""||s&&!ie)return;const Fe=ho(),We=Fe===null&&!V&&((be=Z==null?void 0:Z.pluginConfig)==null?void 0:be.collectedUserInfo)&&(Z.pluginConfig.collectedUserInfo.name||Z.pluginConfig.collectedUserInfo.email||Z.pluginConfig.collectedUserInfo.phone);let Pe=[...n];if(Ne?Ne&&n.length<=2?(h(!0),Pe=[]):h(!1):(Pe.push({text:ue,isBot:!1}),h(!1)),We&&((Ke=Z==null?void 0:Z.pluginConfig)==null?void 0:Ke.collectedUserInfo.isOptional)===!1){Pe.push({text:"I need some information from you before we can continue our conversation. Please fill out your details in the form below. This helps us provide you with better assistance and stay in touch if needed.",isBot:!0}),r(Pe),v(!0);return}if(u(!0),r(Pe),H(Pe),console.debug("socket",E),console.debug("isSocketConnected",O),E&&O){const Je={type:Rte.MESSAGE,role:Ote.USER,query:ue,nameSpace:t,leadingQueries:De,answer:Re,products:ie,userInfo:Fe,timeZone:Intl.DateTimeFormat().resolvedOptions().timeZone,timestamp:new Date().toISOString(),sessionId:P,anonymousUserId:z,distinctId:Us.getDistinctId()};_o.emit("chat",Je)}else k(ue,Re,ie,Ne,De)},[n,s,t,z,Z,V,E,O,P,k]),D={sessionId:P,messages:n,isLoading:i,isMessageLoading:s,isKlaviyoMessage:p,showUserInfoModel:m,pendingBulkItems:_,lastedBotmessageId:L,isFormClosedByUser:V,uiData:Z,storeMetaData:le,suggestedQuestions:w,onSendMessage:b?de:k,setMessages:r,setIsLoading:o,setIsMessageLoading:u,setIsKlaviyoMessage:h,setShowUserInfoModel:v,setPendingBulkItems:x,setLastedBotmessageId:B,setIsFormClosedByUser:J,fetchUiInfo:we,changeDisplayModel:ne,saveConversation:H,loadConversation:fe,setSuggestedQuestions:C};return $.jsx(nD.Provider,{value:D,children:e})};function Mte(e){const t=XS.getInstance().getAdapter();return $.jsx(Tte,{nameSpace:e.botId,children:$.jsx(MW,{apiKey:rZ,options:{capture_pageview:e.botId!=="burgerbaeclothing",capture_pageleave:e.botId!=="burgerbaeclothing",api_host:fo+"/ingest",ui_host:"https://us.posthog.com",loaded:n=>{n.register({platform:Zf.detect(),project:e.botId,sessionId:ur()}),n.group("project",e.botId,{platform:Zf.detect()});const r=ho();r&&r.email&&!n._isIdentified()&&n.identify(r.email,{name:r.name,phone:r.phone,email:r.email,project:e.botId})},debug:!0},children:$.jsx(Lee,{adapter:t,children:e.children})})})}function Dte(e){return $.jsx(Tee,{children:$.jsx(Mte,{botId:e.botId,children:$.jsx(Oee,{...e})})})}const ra=new Map;function Mv(e){const{botId:t}=e;if(ra.has(t))return console.warn(`Chatbot with botId "${t}" is already initialized. Skipping duplicate initialization.`),ra.get(t);const n=e.containerId||`debales-chatbot-${t}`;let r=document.getElementById(n);r||(r=document.createElement("div"),r.id=n,document.body.appendChild(r));const i=AC.createRoot(r);i.render(Tn.createElement(Dte,{botId:e.botId}));const o={container:r,unmount:()=>{i.unmount(),ra.delete(t),r.parentNode&&r.parentNode.removeChild(r)}};return ra.set(t,o),o}typeof window<"u"&&(window.DebalesChatbotBrowser={init:Mv,destroy:e=>{const t=ra.get(e);return t?(t.unmount(),!0):!1},isInitialized:e=>ra.has(e),getInitializedBots:()=>Array.from(ra.keys())});function C$(){document.querySelectorAll('[id="debales-ai-assistant"][data-bot-id]').forEach(n=>{const r=n.getAttribute("data-bot-id");r&&!ra.has(r)&&Mv({botId:r,containerId:n.id})}),document.querySelectorAll('script[src*="ai-assistant.min.js"][data-bot-id]').forEach(n=>{const r=n.getAttribute("data-bot-id");r&&!ra.has(r)&&Mv({botId:r})})}return typeof document<"u"&&(document.readyState==="loading"?document.addEventListener("DOMContentLoaded",C$):C$()),Lo.initDebalesChatbot=Mv,Object.defineProperty(Lo,Symbol.toStringTag,{value:"Module"}),Lo}({});
|
|
2327
|
+
=> User Action: Klaviyo form closed`}return""},ot=ut=>{ut instanceof CustomEvent&&X(ut)};return window.addEventListener("klaviyoForms",ot),()=>{window.removeEventListener("klaviyoForms",ot)}},[fe,t,r]),W.useEffect(()=>{const X=D.current;return X?(X.addEventListener("scroll",Xe),()=>X.removeEventListener("scroll",Xe)):()=>{}},[Xe]);const[wo,xo]=W.useState(!1),Co=V==="Highest"?"120px":V==="Higher"?"60px":"15px",id=async()=>{try{const X=await fetch(`${fo}/api/wordpress/support`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({chatid:ur()+e,nameSpace:e,userName:tt.name,userEmail:tt.email,userMessage:tt.message,tag:"support"})});if(X.ok)h(qe=>[...qe,{text:"Thanks for reaching out! Our support team has received your request and will get back to you within 24 hours.<br>In the meantime, feel free to continue chatting with me - I'll do my best to help!",isBot:!0}]),console.log("Connected to support with existing user info:",ho());else{const qe=await X.json();console.error("Failed to connect to support:",qe),h(ot=>[...ot,{text:"Sorry, we couldn't connect you to support at the moment.<br>Please try again later.",isBot:!0}])}}catch{h(qe=>[...qe,{text:"Sorry, we couldn't connect you to support at the moment.<br>Please try again later.",isBot:!0}])}},Ii=()=>{const X=ho();X&&X.name&&X.email&<({name:X==null?void 0:X.name,email:X==null?void 0:X.email,message:""}),h(qe=>[...qe,{text:"Please provide your name, email and message to connect with support.",isBot:!0}]),dt(!0)},Vn=async X=>{X.preventDefault(),qp({name:tt.name,email:tt.email}),dt(!1),await id()};return!t||t.show_bot===!1||o?null:$.jsxs(Az,{theme:iZ(t),children:[$.jsx("link",{rel:"preconnect",href:"https://fonts.googleapis.com"}),$.jsx("link",{rel:"preconnect",href:"https://fonts.gstatic.com",crossOrigin:"anonymous"}),$.jsx("link",{href:"https://fonts.googleapis.com/css2?family=Inter:ital,opsz,wght@0,14..32,100..900;1,14..32,100..900&display=swap",rel:"stylesheet"}),$.jsx(wee,{}),!G&&(Zr==null?void 0:Zr.length)!==0&&$.jsx(See,{className:De?"visible":"",$botId:e,$iconSize:L,$removeLogoBackground:t.removeLogoBackground,topOffset:Co,style:{right:z?"auto":"24px",left:z?"24px":"auto",display:"flex",flexDirection:"column",alignItems:z?"flex-start":"flex-end"},children:Zr.map((X,qe)=>{if(Array.isArray(X)){const ot=X.map(ut=>({question:ut.question,isHighlighted:ut.isHighlighted??!1})).filter(ut=>!Re.has(ut.question));return $.jsx(t$,{$index:qe,$totalCount:Zr.length,children:$.jsx(XK,{messages:ot,botId:e,uiData:t,onClick:ut=>{const $e=X.find(Tt=>Tt.question===ut);Ne(!0,"suggested_question_clicked"),ie(Tt=>{const Mt=new Set(Tt);return Mt.add(ut),Mt}),window.DebalesChat.track(un.SUGGESTED_QUESTION_CLICKED,{suggested_question:$e}),!w&&$e?r($e==null?void 0:$e.question,$e==null?void 0:$e.answer,$e==null?void 0:$e.products,!1,$e==null?void 0:$e.leading_queries):Pe($e)}})},qe)}else return $.jsx(t$,{$index:qe,$totalCount:Zr.length,children:$.jsx(KK,{value:`${X.question}`,index:qe,botId:e,uiData:t,onClose:()=>{ie(ot=>{const ut=new Set(ot);return ut.add(X.question),ut})},onClick:()=>{Ne(!0,"suggested_question_clicked"),ie(ot=>{const ut=new Set(ot);return ut.add(X.question),ut}),window.DebalesChat.track(un.SUGGESTED_QUESTION_CLICKED,{suggested_question:X}),w?Pe(X):r(X.question,X.answer,X.products,!1,X.leading_queries)},isHighlighted:X.isHighlighted??!1})},qe)})}),$.jsxs(nee,{$topOffset:Co,$removeLogoBackground:t.removeLogoBackground,style:{display:G?"none":"inline-flex",right:z?"auto":"24px",left:z?"24px":"auto"},children:[$.jsx(ree,{$showAnimation:t.enableChatButtonBackgroundAnimation??!1,$animationType:"Ping",$animationColor:t.chatButtonBackgroundAnimationColor||"#f48722",$backgroundColor:t.backgroundColor||"#fff",$removeLogoBackground:t.removeLogoBackground,$topOffset:Co,$iconSize:L}),$.jsx(iee,{$backgroundColor:t.removeLogoBackground?"transparent":t.backgroundColor||"#fff",$botId:e,$iconSize:L,$removeLogoBackground:t.removeLogoBackground,topOffset:Co,$showAnimation:t.enableChatButtonBackgroundAnimation,$animationType:"Ping",$animationColor:t.chatButtonBackgroundAnimationColor||"#f48722",id:"debales-chat-button",onClick:()=>{if(window.DebalesChat.track(un.CHAT_BUTTON_CLICKED),Ne(!G,"chat_button_clicked"),!G){const X=_();X.length>0&&h(X)}},"aria-label":"Chat",style:{display:G?"none":"inline-flex",right:z?"auto":"24px",left:z?"24px":"auto"},children:$.jsx(oee,{$botId:e,$removeLogoBackground:t.removeLogoBackground,"aria-hidden":"true",src:t.bot_logo,alt:"Chat Bot Icon"})})]}),G&&f5.createPortal($.jsx($.Fragment,{children:$.jsxs(fee,{$backgroundColor:t.backgroundColor||"#fff",$fullScreenOnMobile:t.fullScreenOnMobile,$headerFontColor:t.headerFontColor||"#1C1C1C",$isLeft:z,$topOffset:Co,$mobileDisplayMode:t.mobileDisplayMode,$isVisible:q,children:[$.jsxs(dee,{$backgroundColor:t.backgroundColor||"#fff",style:{color:t.headerFontColor},children:[$.jsxs("div",{style:{display:"flex",columnGap:"10px",flex:"1 1 0%",alignItems:"center"},children:[$.jsx(aee,{"aria-hidden":"true",src:t.bot_logo,alt:"Chat Bot Icon"}),$.jsxs(see,{$botNameColor:t.headerFontColor,children:[$.jsxs("div",{style:{fontWeight:"700",wordBreak:"break-word"},children:[t.chatbotName,e==="catch-org-ai"&&$.jsx(uee,{$backgroundColor:t.callToActionBackgroundColor,$fontColor:t.callToActionFontColor,children:"Beta"})]}),$.jsx(lee,{children:$.jsx(AK,{})})]})]}),$.jsxs("div",{style:{display:"flex",alignItems:"center"},children:[$.jsxs(xee,{children:[$.jsxs(Cee,{onClick:Ii,children:[$.jsx(RK,{color:t.headerFontColor}),$.jsx(Eee,{children:"Support"})]}),$.jsx(n$,{children:"Need more help? I'll connect you with a support agent."})]}),(t.mobileDisplayMode==="half-screen"||t.mobileDisplayMode==="full-screen")&&J&&$.jsx("button",{onClick:()=>{const X=t.mobileDisplayMode==="full-screen"?"half-screen":"full-screen";v(X)},style:{background:"none",border:"none",cursor:"pointer",padding:"0",marginRight:"10px",display:"flex",alignItems:"center"},"aria-label":t.mobileDisplayMode==="full-screen"?"Switch to half screen":"Switch to full screen",children:t.mobileDisplayMode==="full-screen"?$.jsx("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:$.jsx("path",{d:"M4.5 15.75V13.5H2.25V12H6V15.75H4.5ZM12 15.75V12H15.75V13.5H13.5V15.75H12ZM2.25 6V4.5H4.5V2.25H6V6H2.25ZM12 6V2.25H13.5V4.5H15.75V6H12Z",fill:"black"})}):$.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:$.jsx("path",{d:"M10 3.75H16.25V10H14.5833V6.595L6.595 14.5833H10V16.25H3.75V10H5.41667V13.405L13.405 5.41667H10V3.75Z",fill:"black"})})}),$.jsx(cee,{onClick:()=>{N?St(!0):Ne(!1,"close_button_clicked")},id:"debales-minimize-button","aria-label":"Minimize",children:$.jsx(qS,{botNameColor:t.headerFontColor})})]})]}),$.jsxs(pee,{$backgroundColor:t.botBackgroundColor||"#fff",$mobileDisplayMode:t.mobileDisplayMode,children:[wo&&((Ki=(Xn=t.pluginConfig)==null?void 0:Xn.collectedUserInfo)==null?void 0:Ki.discount)&&$.jsx(WK,{discount:t.pluginConfig.collectedUserInfo.discount,uiData:t,onClose:()=>{xo(!1),window.DebalesChat.track(un.DISCOUNT_VIEWED,{discount:t.pluginConfig.collectedUserInfo.discount})}}),$.jsx(YJ,{uidata:t,product:Ge,showModel:Ft,setShowModel:cn,onVariantSelect:X=>{R(X.id,1),window.DebalesChat.track(un.ADD_TO_CART_CLICKED,{product:X.title,price:Number(X.price),link:`https://${t.shopifyShopDomain}/variants/${X.id}`,message:s,chatId:ur()+e})}}),it&&$.jsx(dQ,{setShowExitModal:St,handleCloseChatbot:Wi,chatId:ur()+e}),$.jsxs(hee,{id:"debales-conversation-group",$botBackgroundColor:t.botBackgroundColor||"#fff",ref:D,$mobileDisplayMode:t.mobileDisplayMode,children:[c.map((X,qe)=>{const ot=X.isBot,ut=fZ(X.text);return $.jsxs(W.Fragment,{children:[ot&&$.jsxs(X4,{$fontColor:t.botFontColor||"#000",$botMessageColor:t.botBackgroundColor||"#fff",children:[$.jsx("img",{src:ot?t.bot_logo:t.userMessage_logo,alt:"Chat User Icon"}),$.jsxs(e$,{children:[ut.map($e=>$.jsx("div",{children:$.jsx(td,{$botMessageColor:ot?t.botMessageColor||"#fff":t.userMessageColor||"#fff",style:{color:t.botFontColor},children:$.jsx(YE,{remarkPlugins:[CU,NW],children:$e})})})),X.collections&&s===X.conversationId&&F.collections&&$.jsx(UK,{message:X,botId:e,uidata:t,onSendMessage:r,loading:d}),X.products&&s===X.conversationId&&F.products&&$.jsx(TQ,{message:X,botId:e,uidata:t,onSendMessage:r,loading:d,storeMetaData:n,platform:B,setShowVariantModel:cn,setSelectedProduct:_t,setCartVersion:de}),i&&$.jsx(YS,{children:$.jsx(J3,{onClick:()=>{window._klOnsite&&(window._klOnsite.push(["openForm",k]),Ne(!1,"klaviyo_grab_deal_button"))},children:"🚀 Grab Deal Now!"})}),c.length==1&&qe==0&&$.jsx(YS,{children:So.map($e=>Array.isArray($e)?$e[0]:$e).map(($e,Tt)=>$.jsx(J4,{style:{backgroundColor:t.callToActionBackgroundColor,color:t.callToActionFontColor},onClick:()=>{r($e.question,$e.answer,$e.products),ie(Mt=>{const Nn=new Set(Mt);return Nn.add($e.question),Nn}),window.DebalesChat.track(un.INITIAL_LEADING_QUERY_SUGGESTED_QUESTION_CLICKED,{question:$e.question})},disabled:d,$disabled:d,children:$e.question},Tt))}),X.leading_queries&&X.leading_queries.length>0&&s===X.conversationId&&F.leadingQueries&&!i&&$.jsx(YS,{children:X.leading_queries.map(($e,Tt)=>$.jsx(J4,{style:{backgroundColor:t.callToActionBackgroundColor,color:t.callToActionFontColor},onClick:()=>{r($e),window.DebalesChat.track(un.LEADING_QUERY_CLICKED,{query:$e})},disabled:d,$disabled:d,children:$e},Tt))}),E&&E.itemCount>0&&s===X.conversationId&&F.cartSummary&&$.jsxs(yee,{children:[$.jsx(td,{$botMessageColor:t.botMessageColor,style:{width:"max-content",color:t.botFontColor},dangerouslySetInnerHTML:{__html:`<span style="display: flex; align-items: center; justify-content: center;">Total Price: ${qW((E==null?void 0:E.total)??0,(E==null?void 0:E.currency)??"USD")} </span>`}}),$.jsxs(FW,{href:O(t.shopifyShopDomain??""),onClick:Vr,children:[$.jsx("span",{children:"Checkout"}),$.jsx(EK,{style:{width:"20px",fill:t.callToActionFontColor}})]})]}),be&&be.length>0&&s===X.conversationId&&F.bulkItems&&$.jsx(BW,{onClick:()=>bo(X.conversationId),children:"Add Bulk Items to Cart"}),w&&c.indexOf(X)===c.length-1&&$.jsx($.Fragment,{children:$.jsx(LJ,{uidata:t,botName:t.chatbotName,botId:e,showModel:w,setShowModel:$e=>{var Mt,Nn;const Tt=typeof $e=="function"?$e(w):$e;C(Tt),!Tt&&((Nn=(Mt=t.pluginConfig)==null?void 0:Mt.collectedUserInfo)!=null&&Nn.discount)&&xo(!0)},selectedSuggestedQuestionAnswer:We,sendMessage:r,botNameColor:t.headerFontColor,inChat:!0,showFormInstructions:!1})}),Je&&c.indexOf(X)===c.length-1&&$.jsxs(kee,{onSubmit:Vn,children:[$.jsxs(WS,{children:[$.jsxs(KS,{children:["Name",$.jsx("span",{children:"*"})]}),$.jsx(r$,{type:"text",required:!0,value:tt.name,onChange:$e=>lt(Tt=>({...Tt,name:$e.target.value})),placeholder:"John"})]}),$.jsxs(WS,{children:[$.jsxs(KS,{children:["Email",$.jsx("span",{children:"*"})]}),$.jsx(r$,{type:"email",required:!0,value:tt.email,onChange:$e=>lt(Tt=>({...Tt,email:$e.target.value})),placeholder:"olivia@untitledui.com"})]}),$.jsxs(WS,{children:[$.jsxs(KS,{children:["Message",$.jsx("span",{children:"*"})]}),$.jsx(Aee,{required:!0,value:tt.message,onChange:$e=>lt(Tt=>({...Tt,message:$e.target.value})),placeholder:"I need help with..."})]}),$.jsx(Ree,{children:$.jsx(Iee,{type:"submit",children:"Submit"})})]}),me&&!d&&s===X.conversationId&&$.jsx(td,{$botMessageColor:t.botMessageColor,style:{color:t.botFontColor},children:$.jsx(mD,{loading:me,loadingPhrases:["🎨 Loading","✨ Almost","🚀 Ready"]})})]})]}),!ot&&$.jsx(_ee,{$fontColor:t.userFontColor||"#000",$botMessageColor:t.botBackgroundColor||"#fff",children:$.jsx(td,{$botMessageColor:ot?t.botMessageColor||"#fff":t.userMessageColor||"#fff",children:$.jsx(YE,{children:X.text})})})]},qe)}),d&&$.jsxs(X4,{$fontColor:t.botFontColor||"#000",$botMessageColor:t.botBackgroundColor||"#fff",children:[$.jsx("img",{src:t.bot_logo,alt:"Chat User Icon"}),$.jsx(e$,{children:$.jsx(td,{$botMessageColor:t.botMessageColor||"#fff",style:{backgroundColor:"transparent",padding:"0px"},children:$.jsx("div",{style:{display:"flex",alignItems:"center",gap:"4px",animation:"fadeIn 0.3s ease-in-out"},children:$.jsx(mD,{loading:d})})})})]})]}),$.jsxs("div",{className:"debales-footer-container",style:{width:"calc(100%-24px)",backgroundColor:t.footerBackgroundColor||"#fff",color:t.fontColor||"#000"},children:[e==="catch-org-ai"&&$.jsx(vee,{children:$.jsx("span",{children:'"Catch org AI" can make mistakes.'})}),$.jsx("div",{children:$.jsx(JJ,{uiData:t,onSendMessage:r,disabled:d,inputState:!1})}),(t.debales_branding??!0)&&$.jsxs(gee,{href:"https://debales.ai/?open=true",target:"_blank",title:"debales-link",style:{color:t.fontColor?t.fontColor:"fff",marginTop:e==="catch-org-ai"?"0":"9px"},children:[$.jsx("p",{children:"Powered by"}),$.jsxs(mee,{children:[$.jsx("img",{src:`${fo}/images/debales_logo_d.png`,alt:"Debales logo"}),$.jsx("p",{children:"DEBALES"})]})]})]})]})]})}),P.shadowRoot)]})},i$="debales-ai-assistant",o$="debales-chatbot-container",Tee=W.forwardRef(({children:e,globalStyles:t="",containerStyles:n={},onReady:r},i)=>{const o=W.useRef(null),[s,u]=W.useState(null),c=W.useRef(null),d=W.useRef(null),p=W.useRef({get shadowRoot(){return c.current},get container(){return s},querySelector:h=>{var m;return((m=c.current)==null?void 0:m.querySelector(h))||null},querySelectorAll:h=>{var m;return((m=c.current)==null?void 0:m.querySelectorAll(h))||null}});return W.useImperativeHandle(i,()=>p.current,[]),W.useEffect(()=>{const h=document.getElementById(i$);if(h?o.current=h:o.current&&(o.current.id=i$),o.current&&(o.current.style.cssText="position: absolute; top: 0; left: 0; width: 0; height: 0;"),o.current){if(o.current.shadowRoot){c.current=o.current.shadowRoot;const _=c.current.querySelector(`#${o$}`);_&&u(_);return}const m=o.current.attachShadow({mode:"open"});if(c.current=m,t){const _=document.createElement("style");_.textContent=t,m.appendChild(_)}const v=document.createElement("div");v.id=o$,v.style.cssText="position: absolute; top: 0; left: 0; width: 0; height: 0;",m.appendChild(v),u(v),r&&r(m,v)}},[t,r]),W.useEffect(()=>(s&&!d.current&&(d.current=AC.createRoot(s)),d.current&&s&&d.current.render($.jsx(wz,{target:s,children:$.jsx(tD,{value:p.current,children:e})})),()=>{d.current&&d.current.unmount()}),[s,e]),$.jsx("div",{ref:o,style:n})});class QS{isSupported(){return Zf.detect()===this.platform}createSuccessResult(t,n){return{success:!0,data:t,message:n}}createErrorResult(t){return{success:!1,error:t}}}class Mee extends QS{constructor(){super(...arguments);tr(this,"platform",hr.DEFAULT)}async fetchCart(){return console.log("DefaultCartAdapter: fetchCart called"),this.createSuccessResult({items:[],total:0,itemCount:0,currency:"USD",token:"default-token"},"Default cart fetched")}async addToCart(n,r=1,i){return console.log("DefaultCartAdapter: addToCart called",{variantId:n,quantity:r,properties:i}),this.createSuccessResult(void 0,"Item added to cart (mock)")}async removeFromCart(n){return console.log("DefaultCartAdapter: removeFromCart called",{itemId:n}),this.createSuccessResult(void 0,"Item removed from cart (mock)")}async updateQuantity(n){return console.log("DefaultCartAdapter: updateQuantity called",{cartItem:n}),this.createSuccessResult(void 0,"Item quantity updated (mock)")}async clearCart(){return console.log("DefaultCartAdapter: clearCart called"),this.createSuccessResult(void 0,"Cart cleared (mock)")}generateCartUrl(n){const r=n.replace(/^https?:\/\//,"");return console.log("DefaultCartAdapter: generateCartUrl called",{domain:n,sanitizedDomain:r}),`https://${r}/cart`}generateProductUrl(n,r){if(r.handle){const i=new URL(`https://${n}/products/${r.handle}`);return i.searchParams.append("variant",r.product_id),Js(i.toString())}else return Js(r.link)}async addCartAttributes(n={}){return console.log("MethodNotImplemented: addCartAttributes called",{attributes:n}),this.createSuccessResult(void 0,"Cart attributes added (mock)")}}class Dee extends QS{constructor(){var n,r;super();tr(this,"platform",hr.SHOPIFY);tr(this,"cartEndpoint");tr(this,"localCartKey","debales_track_cart");this.cartEndpoint=((r=(n=window.Shopify)==null?void 0:n.routes)==null?void 0:r.root)||"/"}normalizeCartData(n){return{items:n.items.map(r=>({id:r.id,variant_id:r.variant_id,quantity:r.quantity,title:r.title,price:r.price,properties:r.properties})),total:n.total_price/100,itemCount:n.item_count,currency:n.currency,token:n.token.split("?")[0]}}generateProductUrl(n,r){const i=xv(n);if(!i.isValid)return"";if(r.handle){const o=new URL(`/products/${r.handle}`,i.url);return o.searchParams.append("variant",r.product_id),Js(o.toString())}else return Js(r.link)}updateTrackCart({cartToken:n,sessionId:r=ur()}){localStorage.setItem(this.localCartKey,JSON.stringify({sessionId:r,cartToken:n}))}async fetchCart(){try{const n=await fetch(`${this.cartEndpoint}cart.js`),r=await n.json();if(!n.ok){const o=r;return this.createErrorResult(o.description||`Failed to fetch cart: ${n.status}`)}const i=r;return this.createSuccessResult(this.normalizeCartData(i),"Cart fetched successfully")}catch(n){return this.createErrorResult(n instanceof Error?`Error fetching cart: ${n.message}`:"Unknown error occurred while fetching cart")}}async addToCart(n,r=1,i){try{const o=await fetch(`${this.cartEndpoint}cart/add.js`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({items:[{id:n,quantity:r,properties:i}],attributes:{dbls_order_source:"direct_recommendation",dbls_session_id:ur(),dbls_method:"add_to_cart"}})}),s=await o.json();if(!o.ok){const u=s;return this.createErrorResult(u.description||`Failed to add item to cart: ${o.status}`)}return this.fetchCart().then(u=>{u.success&&this.updateTrackCart({cartToken:u==null?void 0:u.data.token})}),this.createSuccessResult(void 0,`Successfully added ${r} item(s) to cart`)}catch(o){return this.createErrorResult(o instanceof Error?`Error adding to cart: ${o.message}`:"Unknown error occurred while adding to cart")}}async removeFromCart(n){return this.updateQuantity({id:n,quantity:0})}async updateQuantity(n){try{const r=await fetch(`${this.cartEndpoint}cart/change.js`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:n.id,quantity:n.quantity})}),i=await r.json();if(!r.ok){const o=i;return this.createErrorResult(o.description||`Failed to update item quantity: ${r.status}`)}return this.fetchCart().then(o=>{o.success&&this.updateTrackCart({cartToken:o==null?void 0:o.data.token})}),this.createSuccessResult(void 0,n.quantity===0?"Item removed from cart":`Quantity updated to ${n.quantity}`)}catch(r){return this.createErrorResult(r instanceof Error?`Error updating quantity: ${r.message}`:"Unknown error occurred while updating quantity")}}async clearCart(){try{const n=await fetch(`${this.cartEndpoint}cart/clear.js`,{method:"POST"});if(!n.ok){const r=await n.json();return this.createErrorResult(r.description||`Failed to clear cart: ${n.status}`)}return this.createSuccessResult(void 0,"Cart cleared successfully")}catch(n){return this.createErrorResult(n instanceof Error?`Error clearing cart: ${n.message}`:"Unknown error occurred while clearing cart")}}async addCartAttributes(n={}){try{const r=await fetch(`${this.cartEndpoint}cart/update.js`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({attributes:{dbls_order_source:"direct_recommendation",dbls_session_id:ur(),...n}})});if(!r.ok){const i=await r.json();return this.createErrorResult(i.description||`Failed to update cart attributes: ${r.status}`)}return this.createSuccessResult(void 0,"Cart attributes updated successfully")}catch(r){return this.createErrorResult(r instanceof Error?`Error updating cart attributes: ${r.message}`:"Unknown error occurred while updating cart attributes")}}generateCartUrl(n){const r=xv(n);if(!r.isValid)return"";const i=new URL("/cart",r.url);return i.searchParams.append("ref",`debales-ai-${new Date().toISOString()}`),i.searchParams.append("attributes[from]","debales-ai-chatbot"),i.searchParams.append("attributes[through]","add-to-cart"),i.searchParams.append("attributes[dbls_session_id]",ur()),i.searchParams.append("timestamp",Date.now().toString()),Js(i.toString())}}class $ee extends QS{constructor(){var n,r;super();tr(this,"platform",hr.MAGENTO);tr(this,"checkoutEndpoint");tr(this,"baseUrl");this.checkoutEndpoint=((n=window.checkout)==null?void 0:n.checkoutUrl)||"/",this.baseUrl=((r=window.checkout)==null?void 0:r.baseUrl)||"/"}normalizeCartData(n){return{items:n.items.map(r=>({id:parseInt(r.item_id),variant_id:parseInt(r.product_id),quantity:r.qty,title:r.product_name,price:r.product_price_value,properties:{name:r.product_name}})),total:parseFloat(n.subtotalAmount),itemCount:n.summary_count,currency:"USD",token:n.data_id.toString()}}async fetchCart(){try{const n=await fetch(`${this.baseUrl}customer/section/load/?sections=cart&update_section_id=false`),r=await n.json();if(!n.ok)return this.createErrorResult(`Failed to fetch cart: ${n.status}`);const i=r.cart;return this.createSuccessResult(this.normalizeCartData(i),"Cart fetched successfully")}catch(n){return this.createErrorResult(n instanceof Error?`Error fetching cart: ${n.message}`:"Unknown error occurred while fetching cart")}}async addToCart(n,r=1){var i;try{const o=(i=document.querySelector('input[name="form_key"]'))==null?void 0:i.value;if(!o)return this.createErrorResult("Form key not found");const s=await fetch(`${this.checkoutEndpoint}cart/add`,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded","X-Requested-With":"XMLHttpRequest"},body:new URLSearchParams({product:n,qty:r.toString(),form_key:o})});if(!s.ok)return this.createErrorResult(`Failed to add item to cart: ${s.status}`);try{window.require(["Magento_Customer/js/customer-data"],u=>u.reload(["cart"],!0))}catch(u){console.warn("Failed to reload cart data:",u)}return this.createSuccessResult(void 0,`Successfully added ${r} item(s) to cart`)}catch(o){return this.createErrorResult(o instanceof Error?`Error adding to cart: ${o.message}`:"Unknown error occurred while adding to cart")}}async removeFromCart(n){return console.log("MethodNotImplemented: removeFromCart called",{itemId:n}),this.createSuccessResult(void 0,"Item removed from cart (mock)")}async updateQuantity(n){return console.log("MethodNotImplemented: updateQuantity called",{cartItem:n}),this.createSuccessResult(void 0,"Item quantity updated (mock)")}async clearCart(){return console.log("MethodNotImplemented: clearCart called"),this.createSuccessResult(void 0,"Cart cleared (mock)")}generateCartUrl(n){const r=new URL(`https://${n}/checkout/cart?ref=debales-ai-${new Date().toISOString()}&attributes[from]=debales-ai-chatbot&attributes[through]=add-to-cart`);return r.searchParams.append("timestamp",Date.now().toString()),r.toString()}generateProductUrl(n,r){const i=xv(n);if(!i.isValid)return"";if(r.handle){const o=new URL(`/${r.handle}.html`,i.url);return Js(o.toString())}else return Js(r.link)}async addCartAttributes(n={}){return console.log("MethodNotImplemented: addCartAttributes called",{attributes:n}),this.createSuccessResult(void 0,"Cart attributes added (mock)")}}const el=class el{constructor(){tr(this,"adapterCache");this.adapterCache=new Map}static getInstance(){return el.instance||(el.instance=new el),el.instance}getAdapter(t){const n=t||Zf.detect(),r=this.adapterCache.get(n);if(r)return r;let i;switch(n){case hr.SHOPIFY:i=new Dee;break;case hr.MAGENTO:i=new $ee;break;default:console.warn(`No specific adapter found for platform ${n}, using default adapter`),i=new Mee}return this.adapterCache.set(n,i),i}clearCache(){this.adapterCache.clear()}};tr(el,"instance");let XS=el;const Lee=({adapter:e,children:t,autoFetch:n=!0})=>{const[r,i]=W.useState(!1),[o,s]=W.useState(null),[u,c]=W.useState(null),d=W.useCallback(async()=>{try{i(!0),s(null);const C=await e.fetchCart();C.success?c(C.data):s(C.error)}catch(C){s(C instanceof Error?C.message:"Failed to fetch cart")}finally{i(!1)}},[e]),p=async(C,E,R)=>{try{s(null);const O=await e.addToCart(C,E,R);return O.success&&await d(),O}catch(O){return{success:!1,error:O instanceof Error?O.message:"Failed to add item to cart"}}},h=async C=>{try{s(null);const E=await e.removeFromCart(C);return E.success&&await d(),E}catch(E){return{success:!1,error:E instanceof Error?E.message:"Failed to remove item from cart"}}},m=async C=>{try{s(null);const E=await e.updateQuantity(C);return E.success&&await d(),E}catch(E){return{success:!1,error:E instanceof Error?E.message:"Failed to update quantity"}}},v=async()=>{try{s(null);const C=await e.clearCart();return C.success&&await d(),C}catch(C){return{success:!1,error:C instanceof Error?C.message:"Failed to clear cart"}}},_=C=>e.generateCartUrl(C),x=(C,E)=>e.generateProductUrl(C,E),b=async C=>e.addCartAttributes(C);W.useEffect(()=>{n&&d()},[n,d]);const w={isLoading:r,error:o,cart:u,fetchCart:d,addToCart:p,removeFromCart:h,updateQuantity:m,clearCart:v,generateCartUrl:_,generateProductUrl:x,addCartAttributes:b};return $.jsx(lT.Provider,{value:w,children:t})},vo=Object.create(null);vo.open="0",vo.close="1",vo.ping="2",vo.pong="3",vo.message="4",vo.upgrade="5",vo.noop="6";const Cv=Object.create(null);Object.keys(vo).forEach(e=>{Cv[vo[e]]=e});const JS={type:"error",data:"parser error"},a$=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",s$=typeof ArrayBuffer=="function",l$=e=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(e):e&&e.buffer instanceof ArrayBuffer,ew=({type:e,data:t},n,r)=>a$&&t instanceof Blob?n?r(t):u$(t,r):s$&&(t instanceof ArrayBuffer||l$(t))?n?r(t):u$(new Blob([t]),r):r(vo[e]+(t||"")),u$=(e,t)=>{const n=new FileReader;return n.onload=function(){const r=n.result.split(",")[1];t("b"+(r||""))},n.readAsDataURL(e)};function c$(e){return e instanceof Uint8Array?e:e instanceof ArrayBuffer?new Uint8Array(e):new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}let tw;function Nee(e,t){if(a$&&e.data instanceof Blob)return e.data.arrayBuffer().then(c$).then(t);if(s$&&(e.data instanceof ArrayBuffer||l$(e.data)))return t(c$(e.data));ew(e,!1,n=>{tw||(tw=new TextEncoder),t(tw.encode(n))})}const f$="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",nd=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let e=0;e<f$.length;e++)nd[f$.charCodeAt(e)]=e;const Pee=e=>{let t=e.length*.75,n=e.length,r,i=0,o,s,u,c;e[e.length-1]==="="&&(t--,e[e.length-2]==="="&&t--);const d=new ArrayBuffer(t),p=new Uint8Array(d);for(r=0;r<n;r+=4)o=nd[e.charCodeAt(r)],s=nd[e.charCodeAt(r+1)],u=nd[e.charCodeAt(r+2)],c=nd[e.charCodeAt(r+3)],p[i++]=o<<2|s>>4,p[i++]=(s&15)<<4|u>>2,p[i++]=(u&3)<<6|c&63;return d},Bee=typeof ArrayBuffer=="function",nw=(e,t)=>{if(typeof e!="string")return{type:"message",data:d$(e,t)};const n=e.charAt(0);return n==="b"?{type:"message",data:Fee(e.substring(1),t)}:Cv[n]?e.length>1?{type:Cv[n],data:e.substring(1)}:{type:Cv[n]}:JS},Fee=(e,t)=>{if(Bee){const n=Pee(e);return d$(n,t)}else return{base64:!0,data:e}},d$=(e,t)=>{switch(t){case"blob":return e instanceof Blob?e:new Blob([e]);case"arraybuffer":default:return e instanceof ArrayBuffer?e:e.buffer}},h$="",Uee=(e,t)=>{const n=e.length,r=new Array(n);let i=0;e.forEach((o,s)=>{ew(o,!1,u=>{r[s]=u,++i===n&&t(r.join(h$))})})},zee=(e,t)=>{const n=e.split(h$),r=[];for(let i=0;i<n.length;i++){const o=nw(n[i],t);if(r.push(o),o.type==="error")break}return r};function qee(){return new TransformStream({transform(e,t){Nee(e,n=>{const r=n.length;let i;if(r<126)i=new Uint8Array(1),new DataView(i.buffer).setUint8(0,r);else if(r<65536){i=new Uint8Array(3);const o=new DataView(i.buffer);o.setUint8(0,126),o.setUint16(1,r)}else{i=new Uint8Array(9);const o=new DataView(i.buffer);o.setUint8(0,127),o.setBigUint64(1,BigInt(r))}e.data&&typeof e.data!="string"&&(i[0]|=128),t.enqueue(i),t.enqueue(n)})}})}let rw;function Ev(e){return e.reduce((t,n)=>t+n.length,0)}function kv(e,t){if(e[0].length===t)return e.shift();const n=new Uint8Array(t);let r=0;for(let i=0;i<t;i++)n[i]=e[0][r++],r===e[0].length&&(e.shift(),r=0);return e.length&&r<e[0].length&&(e[0]=e[0].slice(r)),n}function jee(e,t){rw||(rw=new TextDecoder);const n=[];let r=0,i=-1,o=!1;return new TransformStream({transform(s,u){for(n.push(s);;){if(r===0){if(Ev(n)<1)break;const c=kv(n,1);o=(c[0]&128)===128,i=c[0]&127,i<126?r=3:i===126?r=1:r=2}else if(r===1){if(Ev(n)<2)break;const c=kv(n,2);i=new DataView(c.buffer,c.byteOffset,c.length).getUint16(0),r=3}else if(r===2){if(Ev(n)<8)break;const c=kv(n,8),d=new DataView(c.buffer,c.byteOffset,c.length),p=d.getUint32(0);if(p>Math.pow(2,21)-1){u.enqueue(JS);break}i=p*Math.pow(2,32)+d.getUint32(4),r=3}else{if(Ev(n)<i)break;const c=kv(n,i);u.enqueue(nw(o?c:rw.decode(c),t)),r=0}if(i===0||i>e){u.enqueue(JS);break}}}})}const p$=4;function Gn(e){if(e)return Hee(e)}function Hee(e){for(var t in Gn.prototype)e[t]=Gn.prototype[t];return e}Gn.prototype.on=Gn.prototype.addEventListener=function(e,t){return this._callbacks=this._callbacks||{},(this._callbacks["$"+e]=this._callbacks["$"+e]||[]).push(t),this},Gn.prototype.once=function(e,t){function n(){this.off(e,n),t.apply(this,arguments)}return n.fn=t,this.on(e,n),this},Gn.prototype.off=Gn.prototype.removeListener=Gn.prototype.removeAllListeners=Gn.prototype.removeEventListener=function(e,t){if(this._callbacks=this._callbacks||{},arguments.length==0)return this._callbacks={},this;var n=this._callbacks["$"+e];if(!n)return this;if(arguments.length==1)return delete this._callbacks["$"+e],this;for(var r,i=0;i<n.length;i++)if(r=n[i],r===t||r.fn===t){n.splice(i,1);break}return n.length===0&&delete this._callbacks["$"+e],this},Gn.prototype.emit=function(e){this._callbacks=this._callbacks||{};for(var t=new Array(arguments.length-1),n=this._callbacks["$"+e],r=1;r<arguments.length;r++)t[r-1]=arguments[r];if(n){n=n.slice(0);for(var r=0,i=n.length;r<i;++r)n[r].apply(this,t)}return this},Gn.prototype.emitReserved=Gn.prototype.emit,Gn.prototype.listeners=function(e){return this._callbacks=this._callbacks||{},this._callbacks["$"+e]||[]},Gn.prototype.hasListeners=function(e){return!!this.listeners(e).length};const Av=typeof Promise=="function"&&typeof Promise.resolve=="function"?t=>Promise.resolve().then(t):(t,n)=>n(t,0),Ei=typeof self<"u"?self:typeof window<"u"?window:Function("return this")(),Gee="arraybuffer";function eie(){}function g$(e,...t){return t.reduce((n,r)=>(e.hasOwnProperty(r)&&(n[r]=e[r]),n),{})}const Vee=Ei.setTimeout,Zee=Ei.clearTimeout;function Iv(e,t){t.useNativeTimers?(e.setTimeoutFn=Vee.bind(Ei),e.clearTimeoutFn=Zee.bind(Ei)):(e.setTimeoutFn=Ei.setTimeout.bind(Ei),e.clearTimeoutFn=Ei.clearTimeout.bind(Ei))}const Yee=1.33;function Wee(e){return typeof e=="string"?Kee(e):Math.ceil((e.byteLength||e.size)*Yee)}function Kee(e){let t=0,n=0;for(let r=0,i=e.length;r<i;r++)t=e.charCodeAt(r),t<128?n+=1:t<2048?n+=2:t<55296||t>=57344?n+=3:(r++,n+=4);return n}function m$(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}function Qee(e){let t="";for(let n in e)e.hasOwnProperty(n)&&(t.length&&(t+="&"),t+=encodeURIComponent(n)+"="+encodeURIComponent(e[n]));return t}function Xee(e){let t={},n=e.split("&");for(let r=0,i=n.length;r<i;r++){let o=n[r].split("=");t[decodeURIComponent(o[0])]=decodeURIComponent(o[1])}return t}class Jee extends Error{constructor(t,n,r){super(t),this.description=n,this.context=r,this.type="TransportError"}}class iw extends Gn{constructor(t){super(),this.writable=!1,Iv(this,t),this.opts=t,this.query=t.query,this.socket=t.socket,this.supportsBinary=!t.forceBase64}onError(t,n,r){return super.emitReserved("error",new Jee(t,n,r)),this}open(){return this.readyState="opening",this.doOpen(),this}close(){return(this.readyState==="opening"||this.readyState==="open")&&(this.doClose(),this.onClose()),this}send(t){this.readyState==="open"&&this.write(t)}onOpen(){this.readyState="open",this.writable=!0,super.emitReserved("open")}onData(t){const n=nw(t,this.socket.binaryType);this.onPacket(n)}onPacket(t){super.emitReserved("packet",t)}onClose(t){this.readyState="closed",super.emitReserved("close",t)}pause(t){}createUri(t,n={}){return t+"://"+this._hostname()+this._port()+this.opts.path+this._query(n)}_hostname(){const t=this.opts.hostname;return t.indexOf(":")===-1?t:"["+t+"]"}_port(){return this.opts.port&&(this.opts.secure&&+(this.opts.port!==443)||!this.opts.secure&&Number(this.opts.port)!==80)?":"+this.opts.port:""}_query(t){const n=Qee(t);return n.length?"?"+n:""}}class ete extends iw{constructor(){super(...arguments),this._polling=!1}get name(){return"polling"}doOpen(){this._poll()}pause(t){this.readyState="pausing";const n=()=>{this.readyState="paused",t()};if(this._polling||!this.writable){let r=0;this._polling&&(r++,this.once("pollComplete",function(){--r||n()})),this.writable||(r++,this.once("drain",function(){--r||n()}))}else n()}_poll(){this._polling=!0,this.doPoll(),this.emitReserved("poll")}onData(t){const n=r=>{if(this.readyState==="opening"&&r.type==="open"&&this.onOpen(),r.type==="close")return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(r)};zee(t,this.socket.binaryType).forEach(n),this.readyState!=="closed"&&(this._polling=!1,this.emitReserved("pollComplete"),this.readyState==="open"&&this._poll())}doClose(){const t=()=>{this.write([{type:"close"}])};this.readyState==="open"?t():this.once("open",t)}write(t){this.writable=!1,Uee(t,n=>{this.doWrite(n,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){const t=this.opts.secure?"https":"http",n=this.query||{};return this.opts.timestampRequests!==!1&&(n[this.opts.timestampParam]=m$()),!this.supportsBinary&&!n.sid&&(n.b64=1),this.createUri(t,n)}}let v$=!1;try{v$=typeof XMLHttpRequest<"u"&&"withCredentials"in new XMLHttpRequest}catch{}const tte=v$;function nte(){}class rte extends ete{constructor(t){if(super(t),typeof location<"u"){const n=location.protocol==="https:";let r=location.port;r||(r=n?"443":"80"),this.xd=typeof location<"u"&&t.hostname!==location.hostname||r!==t.port}}doWrite(t,n){const r=this.request({method:"POST",data:t});r.on("success",n),r.on("error",(i,o)=>{this.onError("xhr post error",i,o)})}doPoll(){const t=this.request();t.on("data",this.onData.bind(this)),t.on("error",(n,r)=>{this.onError("xhr poll error",n,r)}),this.pollXhr=t}}class yo extends Gn{constructor(t,n,r){super(),this.createRequest=t,Iv(this,r),this._opts=r,this._method=r.method||"GET",this._uri=n,this._data=r.data!==void 0?r.data:null,this._create()}_create(){var t;const n=g$(this._opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");n.xdomain=!!this._opts.xd;const r=this._xhr=this.createRequest(n);try{r.open(this._method,this._uri,!0);try{if(this._opts.extraHeaders){r.setDisableHeaderCheck&&r.setDisableHeaderCheck(!0);for(let i in this._opts.extraHeaders)this._opts.extraHeaders.hasOwnProperty(i)&&r.setRequestHeader(i,this._opts.extraHeaders[i])}}catch{}if(this._method==="POST")try{r.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch{}try{r.setRequestHeader("Accept","*/*")}catch{}(t=this._opts.cookieJar)===null||t===void 0||t.addCookies(r),"withCredentials"in r&&(r.withCredentials=this._opts.withCredentials),this._opts.requestTimeout&&(r.timeout=this._opts.requestTimeout),r.onreadystatechange=()=>{var i;r.readyState===3&&((i=this._opts.cookieJar)===null||i===void 0||i.parseCookies(r.getResponseHeader("set-cookie"))),r.readyState===4&&(r.status===200||r.status===1223?this._onLoad():this.setTimeoutFn(()=>{this._onError(typeof r.status=="number"?r.status:0)},0))},r.send(this._data)}catch(i){this.setTimeoutFn(()=>{this._onError(i)},0);return}typeof document<"u"&&(this._index=yo.requestsCount++,yo.requests[this._index]=this)}_onError(t){this.emitReserved("error",t,this._xhr),this._cleanup(!0)}_cleanup(t){if(!(typeof this._xhr>"u"||this._xhr===null)){if(this._xhr.onreadystatechange=nte,t)try{this._xhr.abort()}catch{}typeof document<"u"&&delete yo.requests[this._index],this._xhr=null}}_onLoad(){const t=this._xhr.responseText;t!==null&&(this.emitReserved("data",t),this.emitReserved("success"),this._cleanup())}abort(){this._cleanup()}}if(yo.requestsCount=0,yo.requests={},typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",y$);else if(typeof addEventListener=="function"){const e="onpagehide"in Ei?"pagehide":"unload";addEventListener(e,y$,!1)}}function y$(){for(let e in yo.requests)yo.requests.hasOwnProperty(e)&&yo.requests[e].abort()}const ite=function(){const e=_$({xdomain:!1});return e&&e.responseType!==null}();class ote extends rte{constructor(t){super(t);const n=t&&t.forceBase64;this.supportsBinary=ite&&!n}request(t={}){return Object.assign(t,{xd:this.xd},this.opts),new yo(_$,this.uri(),t)}}function _$(e){const t=e.xdomain;try{if(typeof XMLHttpRequest<"u"&&(!t||tte))return new XMLHttpRequest}catch{}if(!t)try{return new Ei[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch{}}const b$=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative";class ate extends iw{get name(){return"websocket"}doOpen(){const t=this.uri(),n=this.opts.protocols,r=b$?{}:g$(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(r.headers=this.opts.extraHeaders);try{this.ws=this.createSocket(t,n,r)}catch(i){return this.emitReserved("error",i)}this.ws.binaryType=this.socket.binaryType,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=t=>this.onClose({description:"websocket connection closed",context:t}),this.ws.onmessage=t=>this.onData(t.data),this.ws.onerror=t=>this.onError("websocket error",t)}write(t){this.writable=!1;for(let n=0;n<t.length;n++){const r=t[n],i=n===t.length-1;ew(r,this.supportsBinary,o=>{try{this.doWrite(r,o)}catch{}i&&Av(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){typeof this.ws<"u"&&(this.ws.onerror=()=>{},this.ws.close(),this.ws=null)}uri(){const t=this.opts.secure?"wss":"ws",n=this.query||{};return this.opts.timestampRequests&&(n[this.opts.timestampParam]=m$()),this.supportsBinary||(n.b64=1),this.createUri(t,n)}}const ow=Ei.WebSocket||Ei.MozWebSocket;class ste extends ate{createSocket(t,n,r){return b$?new ow(t,n,r):n?new ow(t,n):new ow(t)}doWrite(t,n){this.ws.send(n)}}class lte extends iw{get name(){return"webtransport"}doOpen(){try{this._transport=new WebTransport(this.createUri("https"),this.opts.transportOptions[this.name])}catch(t){return this.emitReserved("error",t)}this._transport.closed.then(()=>{this.onClose()}).catch(t=>{this.onError("webtransport error",t)}),this._transport.ready.then(()=>{this._transport.createBidirectionalStream().then(t=>{const n=jee(Number.MAX_SAFE_INTEGER,this.socket.binaryType),r=t.readable.pipeThrough(n).getReader(),i=qee();i.readable.pipeTo(t.writable),this._writer=i.writable.getWriter();const o=()=>{r.read().then(({done:u,value:c})=>{u||(this.onPacket(c),o())}).catch(u=>{})};o();const s={type:"open"};this.query.sid&&(s.data=`{"sid":"${this.query.sid}"}`),this._writer.write(s).then(()=>this.onOpen())})})}write(t){this.writable=!1;for(let n=0;n<t.length;n++){const r=t[n],i=n===t.length-1;this._writer.write(r).then(()=>{i&&Av(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var t;(t=this._transport)===null||t===void 0||t.close()}}const ute={websocket:ste,webtransport:lte,polling:ote},cte=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,fte=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function aw(e){if(e.length>8e3)throw"URI too long";const t=e,n=e.indexOf("["),r=e.indexOf("]");n!=-1&&r!=-1&&(e=e.substring(0,n)+e.substring(n,r).replace(/:/g,";")+e.substring(r,e.length));let i=cte.exec(e||""),o={},s=14;for(;s--;)o[fte[s]]=i[s]||"";return n!=-1&&r!=-1&&(o.source=t,o.host=o.host.substring(1,o.host.length-1).replace(/;/g,":"),o.authority=o.authority.replace("[","").replace("]","").replace(/;/g,":"),o.ipv6uri=!0),o.pathNames=dte(o,o.path),o.queryKey=hte(o,o.query),o}function dte(e,t){const n=/\/{2,9}/g,r=t.replace(n,"/").split("/");return(t.slice(0,1)=="/"||t.length===0)&&r.splice(0,1),t.slice(-1)=="/"&&r.splice(r.length-1,1),r}function hte(e,t){const n={};return t.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(r,i,o){i&&(n[i]=o)}),n}const sw=typeof addEventListener=="function"&&typeof removeEventListener=="function",Rv=[];sw&&addEventListener("offline",()=>{Rv.forEach(e=>e())},!1);class Xa extends Gn{constructor(t,n){if(super(),this.binaryType=Gee,this.writeBuffer=[],this._prevBufferLen=0,this._pingInterval=-1,this._pingTimeout=-1,this._maxPayload=-1,this._pingTimeoutTime=1/0,t&&typeof t=="object"&&(n=t,t=null),t){const r=aw(t);n.hostname=r.host,n.secure=r.protocol==="https"||r.protocol==="wss",n.port=r.port,r.query&&(n.query=r.query)}else n.host&&(n.hostname=aw(n.host).host);Iv(this,n),this.secure=n.secure!=null?n.secure:typeof location<"u"&&location.protocol==="https:",n.hostname&&!n.port&&(n.port=this.secure?"443":"80"),this.hostname=n.hostname||(typeof location<"u"?location.hostname:"localhost"),this.port=n.port||(typeof location<"u"&&location.port?location.port:this.secure?"443":"80"),this.transports=[],this._transportsByName={},n.transports.forEach(r=>{const i=r.prototype.name;this.transports.push(i),this._transportsByName[i]=r}),this.opts=Object.assign({path:"/engine.io",agent:!1,withCredentials:!1,upgrade:!0,timestampParam:"t",rememberUpgrade:!1,addTrailingSlash:!0,rejectUnauthorized:!0,perMessageDeflate:{threshold:1024},transportOptions:{},closeOnBeforeunload:!1},n),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),typeof this.opts.query=="string"&&(this.opts.query=Xee(this.opts.query)),sw&&(this.opts.closeOnBeforeunload&&(this._beforeunloadEventListener=()=>{this.transport&&(this.transport.removeAllListeners(),this.transport.close())},addEventListener("beforeunload",this._beforeunloadEventListener,!1)),this.hostname!=="localhost"&&(this._offlineEventListener=()=>{this._onClose("transport close",{description:"network connection lost"})},Rv.push(this._offlineEventListener))),this.opts.withCredentials&&(this._cookieJar=void 0),this._open()}createTransport(t){const n=Object.assign({},this.opts.query);n.EIO=p$,n.transport=t,this.id&&(n.sid=this.id);const r=Object.assign({},this.opts,{query:n,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[t]);return new this._transportsByName[t](r)}_open(){if(this.transports.length===0){this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);return}const t=this.opts.rememberUpgrade&&Xa.priorWebsocketSuccess&&this.transports.indexOf("websocket")!==-1?"websocket":this.transports[0];this.readyState="opening";const n=this.createTransport(t);n.open(),this.setTransport(n)}setTransport(t){this.transport&&this.transport.removeAllListeners(),this.transport=t,t.on("drain",this._onDrain.bind(this)).on("packet",this._onPacket.bind(this)).on("error",this._onError.bind(this)).on("close",n=>this._onClose("transport close",n))}onOpen(){this.readyState="open",Xa.priorWebsocketSuccess=this.transport.name==="websocket",this.emitReserved("open"),this.flush()}_onPacket(t){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")switch(this.emitReserved("packet",t),this.emitReserved("heartbeat"),t.type){case"open":this.onHandshake(JSON.parse(t.data));break;case"ping":this._sendPacket("pong"),this.emitReserved("ping"),this.emitReserved("pong"),this._resetPingTimeout();break;case"error":const n=new Error("server error");n.code=t.data,this._onError(n);break;case"message":this.emitReserved("data",t.data),this.emitReserved("message",t.data);break}}onHandshake(t){this.emitReserved("handshake",t),this.id=t.sid,this.transport.query.sid=t.sid,this._pingInterval=t.pingInterval,this._pingTimeout=t.pingTimeout,this._maxPayload=t.maxPayload,this.onOpen(),this.readyState!=="closed"&&this._resetPingTimeout()}_resetPingTimeout(){this.clearTimeoutFn(this._pingTimeoutTimer);const t=this._pingInterval+this._pingTimeout;this._pingTimeoutTime=Date.now()+t,this._pingTimeoutTimer=this.setTimeoutFn(()=>{this._onClose("ping timeout")},t),this.opts.autoUnref&&this._pingTimeoutTimer.unref()}_onDrain(){this.writeBuffer.splice(0,this._prevBufferLen),this._prevBufferLen=0,this.writeBuffer.length===0?this.emitReserved("drain"):this.flush()}flush(){if(this.readyState!=="closed"&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){const t=this._getWritablePackets();this.transport.send(t),this._prevBufferLen=t.length,this.emitReserved("flush")}}_getWritablePackets(){if(!(this._maxPayload&&this.transport.name==="polling"&&this.writeBuffer.length>1))return this.writeBuffer;let n=1;for(let r=0;r<this.writeBuffer.length;r++){const i=this.writeBuffer[r].data;if(i&&(n+=Wee(i)),r>0&&n>this._maxPayload)return this.writeBuffer.slice(0,r);n+=2}return this.writeBuffer}_hasPingExpired(){if(!this._pingTimeoutTime)return!0;const t=Date.now()>this._pingTimeoutTime;return t&&(this._pingTimeoutTime=0,Av(()=>{this._onClose("ping timeout")},this.setTimeoutFn)),t}write(t,n,r){return this._sendPacket("message",t,n,r),this}send(t,n,r){return this._sendPacket("message",t,n,r),this}_sendPacket(t,n,r,i){if(typeof n=="function"&&(i=n,n=void 0),typeof r=="function"&&(i=r,r=null),this.readyState==="closing"||this.readyState==="closed")return;r=r||{},r.compress=r.compress!==!1;const o={type:t,data:n,options:r};this.emitReserved("packetCreate",o),this.writeBuffer.push(o),i&&this.once("flush",i),this.flush()}close(){const t=()=>{this._onClose("forced close"),this.transport.close()},n=()=>{this.off("upgrade",n),this.off("upgradeError",n),t()},r=()=>{this.once("upgrade",n),this.once("upgradeError",n)};return(this.readyState==="opening"||this.readyState==="open")&&(this.readyState="closing",this.writeBuffer.length?this.once("drain",()=>{this.upgrading?r():t()}):this.upgrading?r():t()),this}_onError(t){if(Xa.priorWebsocketSuccess=!1,this.opts.tryAllTransports&&this.transports.length>1&&this.readyState==="opening")return this.transports.shift(),this._open();this.emitReserved("error",t),this._onClose("transport error",t)}_onClose(t,n){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing"){if(this.clearTimeoutFn(this._pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),sw&&(this._beforeunloadEventListener&&removeEventListener("beforeunload",this._beforeunloadEventListener,!1),this._offlineEventListener)){const r=Rv.indexOf(this._offlineEventListener);r!==-1&&Rv.splice(r,1)}this.readyState="closed",this.id=null,this.emitReserved("close",t,n),this.writeBuffer=[],this._prevBufferLen=0}}}Xa.protocol=p$;class pte extends Xa{constructor(){super(...arguments),this._upgrades=[]}onOpen(){if(super.onOpen(),this.readyState==="open"&&this.opts.upgrade)for(let t=0;t<this._upgrades.length;t++)this._probe(this._upgrades[t])}_probe(t){let n=this.createTransport(t),r=!1;Xa.priorWebsocketSuccess=!1;const i=()=>{r||(n.send([{type:"ping",data:"probe"}]),n.once("packet",h=>{if(!r)if(h.type==="pong"&&h.data==="probe"){if(this.upgrading=!0,this.emitReserved("upgrading",n),!n)return;Xa.priorWebsocketSuccess=n.name==="websocket",this.transport.pause(()=>{r||this.readyState!=="closed"&&(p(),this.setTransport(n),n.send([{type:"upgrade"}]),this.emitReserved("upgrade",n),n=null,this.upgrading=!1,this.flush())})}else{const m=new Error("probe error");m.transport=n.name,this.emitReserved("upgradeError",m)}}))};function o(){r||(r=!0,p(),n.close(),n=null)}const s=h=>{const m=new Error("probe error: "+h);m.transport=n.name,o(),this.emitReserved("upgradeError",m)};function u(){s("transport closed")}function c(){s("socket closed")}function d(h){n&&h.name!==n.name&&o()}const p=()=>{n.removeListener("open",i),n.removeListener("error",s),n.removeListener("close",u),this.off("close",c),this.off("upgrading",d)};n.once("open",i),n.once("error",s),n.once("close",u),this.once("close",c),this.once("upgrading",d),this._upgrades.indexOf("webtransport")!==-1&&t!=="webtransport"?this.setTimeoutFn(()=>{r||n.open()},200):n.open()}onHandshake(t){this._upgrades=this._filterUpgrades(t.upgrades),super.onHandshake(t)}_filterUpgrades(t){const n=[];for(let r=0;r<t.length;r++)~this.transports.indexOf(t[r])&&n.push(t[r]);return n}}let gte=class extends pte{constructor(t,n={}){const r=typeof t=="object"?t:n;(!r.transports||r.transports&&typeof r.transports[0]=="string")&&(r.transports=(r.transports||["polling","websocket","webtransport"]).map(i=>ute[i]).filter(i=>!!i)),super(t,r)}};function mte(e,t="",n){let r=e;n=n||typeof location<"u"&&location,e==null&&(e=n.protocol+"//"+n.host),typeof e=="string"&&(e.charAt(0)==="/"&&(e.charAt(1)==="/"?e=n.protocol+e:e=n.host+e),/^(https?|wss?):\/\//.test(e)||(typeof n<"u"?e=n.protocol+"//"+e:e="https://"+e),r=aw(e)),r.port||(/^(http|ws)$/.test(r.protocol)?r.port="80":/^(http|ws)s$/.test(r.protocol)&&(r.port="443")),r.path=r.path||"/";const o=r.host.indexOf(":")!==-1?"["+r.host+"]":r.host;return r.id=r.protocol+"://"+o+":"+r.port+t,r.href=r.protocol+"://"+o+(n&&n.port===r.port?"":":"+r.port),r}const vte=typeof ArrayBuffer=="function",yte=e=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(e):e.buffer instanceof ArrayBuffer,S$=Object.prototype.toString,_te=typeof Blob=="function"||typeof Blob<"u"&&S$.call(Blob)==="[object BlobConstructor]",bte=typeof File=="function"||typeof File<"u"&&S$.call(File)==="[object FileConstructor]";function lw(e){return vte&&(e instanceof ArrayBuffer||yte(e))||_te&&e instanceof Blob||bte&&e instanceof File}function Ov(e,t){if(!e||typeof e!="object")return!1;if(Array.isArray(e)){for(let n=0,r=e.length;n<r;n++)if(Ov(e[n]))return!0;return!1}if(lw(e))return!0;if(e.toJSON&&typeof e.toJSON=="function"&&arguments.length===1)return Ov(e.toJSON(),!0);for(const n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&Ov(e[n]))return!0;return!1}function Ste(e){const t=[],n=e.data,r=e;return r.data=uw(n,t),r.attachments=t.length,{packet:r,buffers:t}}function uw(e,t){if(!e)return e;if(lw(e)){const n={_placeholder:!0,num:t.length};return t.push(e),n}else if(Array.isArray(e)){const n=new Array(e.length);for(let r=0;r<e.length;r++)n[r]=uw(e[r],t);return n}else if(typeof e=="object"&&!(e instanceof Date)){const n={};for(const r in e)Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=uw(e[r],t));return n}return e}function wte(e,t){return e.data=cw(e.data,t),delete e.attachments,e}function cw(e,t){if(!e)return e;if(e&&e._placeholder===!0){if(typeof e.num=="number"&&e.num>=0&&e.num<t.length)return t[e.num];throw new Error("illegal attachments")}else if(Array.isArray(e))for(let n=0;n<e.length;n++)e[n]=cw(e[n],t);else if(typeof e=="object")for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&(e[n]=cw(e[n],t));return e}const xte=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"],Cte=5;var $t;(function(e){e[e.CONNECT=0]="CONNECT",e[e.DISCONNECT=1]="DISCONNECT",e[e.EVENT=2]="EVENT",e[e.ACK=3]="ACK",e[e.CONNECT_ERROR=4]="CONNECT_ERROR",e[e.BINARY_EVENT=5]="BINARY_EVENT",e[e.BINARY_ACK=6]="BINARY_ACK"})($t||($t={}));class Ete{constructor(t){this.replacer=t}encode(t){return(t.type===$t.EVENT||t.type===$t.ACK)&&Ov(t)?this.encodeAsBinary({type:t.type===$t.EVENT?$t.BINARY_EVENT:$t.BINARY_ACK,nsp:t.nsp,data:t.data,id:t.id}):[this.encodeAsString(t)]}encodeAsString(t){let n=""+t.type;return(t.type===$t.BINARY_EVENT||t.type===$t.BINARY_ACK)&&(n+=t.attachments+"-"),t.nsp&&t.nsp!=="/"&&(n+=t.nsp+","),t.id!=null&&(n+=t.id),t.data!=null&&(n+=JSON.stringify(t.data,this.replacer)),n}encodeAsBinary(t){const n=Ste(t),r=this.encodeAsString(n.packet),i=n.buffers;return i.unshift(r),i}}function w$(e){return Object.prototype.toString.call(e)==="[object Object]"}class fw extends Gn{constructor(t){super(),this.reviver=t}add(t){let n;if(typeof t=="string"){if(this.reconstructor)throw new Error("got plaintext data when reconstructing a packet");n=this.decodeString(t);const r=n.type===$t.BINARY_EVENT;r||n.type===$t.BINARY_ACK?(n.type=r?$t.EVENT:$t.ACK,this.reconstructor=new kte(n),n.attachments===0&&super.emitReserved("decoded",n)):super.emitReserved("decoded",n)}else if(lw(t)||t.base64)if(this.reconstructor)n=this.reconstructor.takeBinaryData(t),n&&(this.reconstructor=null,super.emitReserved("decoded",n));else throw new Error("got binary data when not reconstructing a packet");else throw new Error("Unknown type: "+t)}decodeString(t){let n=0;const r={type:Number(t.charAt(0))};if($t[r.type]===void 0)throw new Error("unknown packet type "+r.type);if(r.type===$t.BINARY_EVENT||r.type===$t.BINARY_ACK){const o=n+1;for(;t.charAt(++n)!=="-"&&n!=t.length;);const s=t.substring(o,n);if(s!=Number(s)||t.charAt(n)!=="-")throw new Error("Illegal attachments");r.attachments=Number(s)}if(t.charAt(n+1)==="/"){const o=n+1;for(;++n&&!(t.charAt(n)===","||n===t.length););r.nsp=t.substring(o,n)}else r.nsp="/";const i=t.charAt(n+1);if(i!==""&&Number(i)==i){const o=n+1;for(;++n;){const s=t.charAt(n);if(s==null||Number(s)!=s){--n;break}if(n===t.length)break}r.id=Number(t.substring(o,n+1))}if(t.charAt(++n)){const o=this.tryParse(t.substr(n));if(fw.isPayloadValid(r.type,o))r.data=o;else throw new Error("invalid payload")}return r}tryParse(t){try{return JSON.parse(t,this.reviver)}catch{return!1}}static isPayloadValid(t,n){switch(t){case $t.CONNECT:return w$(n);case $t.DISCONNECT:return n===void 0;case $t.CONNECT_ERROR:return typeof n=="string"||w$(n);case $t.EVENT:case $t.BINARY_EVENT:return Array.isArray(n)&&(typeof n[0]=="number"||typeof n[0]=="string"&&xte.indexOf(n[0])===-1);case $t.ACK:case $t.BINARY_ACK:return Array.isArray(n)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}}class kte{constructor(t){this.packet=t,this.buffers=[],this.reconPack=t}takeBinaryData(t){if(this.buffers.push(t),this.buffers.length===this.reconPack.attachments){const n=wte(this.reconPack,this.buffers);return this.finishedReconstruction(),n}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}const Ate=Object.freeze(Object.defineProperty({__proto__:null,Decoder:fw,Encoder:Ete,get PacketType(){return $t},protocol:Cte},Symbol.toStringTag,{value:"Module"}));function Yi(e,t,n){return e.on(t,n),function(){e.off(t,n)}}const Ite=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class x$ extends Gn{constructor(t,n,r){super(),this.connected=!1,this.recovered=!1,this.receiveBuffer=[],this.sendBuffer=[],this._queue=[],this._queueSeq=0,this.ids=0,this.acks={},this.flags={},this.io=t,this.nsp=n,r&&r.auth&&(this.auth=r.auth),this._opts=Object.assign({},r),this.io._autoConnect&&this.open()}get disconnected(){return!this.connected}subEvents(){if(this.subs)return;const t=this.io;this.subs=[Yi(t,"open",this.onopen.bind(this)),Yi(t,"packet",this.onpacket.bind(this)),Yi(t,"error",this.onerror.bind(this)),Yi(t,"close",this.onclose.bind(this))]}get active(){return!!this.subs}connect(){return this.connected?this:(this.subEvents(),this.io._reconnecting||this.io.open(),this.io._readyState==="open"&&this.onopen(),this)}open(){return this.connect()}send(...t){return t.unshift("message"),this.emit.apply(this,t),this}emit(t,...n){var r,i,o;if(Ite.hasOwnProperty(t))throw new Error('"'+t.toString()+'" is a reserved event name');if(n.unshift(t),this._opts.retries&&!this.flags.fromQueue&&!this.flags.volatile)return this._addToQueue(n),this;const s={type:$t.EVENT,data:n};if(s.options={},s.options.compress=this.flags.compress!==!1,typeof n[n.length-1]=="function"){const p=this.ids++,h=n.pop();this._registerAckCallback(p,h),s.id=p}const u=(i=(r=this.io.engine)===null||r===void 0?void 0:r.transport)===null||i===void 0?void 0:i.writable,c=this.connected&&!(!((o=this.io.engine)===null||o===void 0)&&o._hasPingExpired());return this.flags.volatile&&!u||(c?(this.notifyOutgoingListeners(s),this.packet(s)):this.sendBuffer.push(s)),this.flags={},this}_registerAckCallback(t,n){var r;const i=(r=this.flags.timeout)!==null&&r!==void 0?r:this._opts.ackTimeout;if(i===void 0){this.acks[t]=n;return}const o=this.io.setTimeoutFn(()=>{delete this.acks[t];for(let u=0;u<this.sendBuffer.length;u++)this.sendBuffer[u].id===t&&this.sendBuffer.splice(u,1);n.call(this,new Error("operation has timed out"))},i),s=(...u)=>{this.io.clearTimeoutFn(o),n.apply(this,u)};s.withError=!0,this.acks[t]=s}emitWithAck(t,...n){return new Promise((r,i)=>{const o=(s,u)=>s?i(s):r(u);o.withError=!0,n.push(o),this.emit(t,...n)})}_addToQueue(t){let n;typeof t[t.length-1]=="function"&&(n=t.pop());const r={id:this._queueSeq++,tryCount:0,pending:!1,args:t,flags:Object.assign({fromQueue:!0},this.flags)};t.push((i,...o)=>r!==this._queue[0]?void 0:(i!==null?r.tryCount>this._opts.retries&&(this._queue.shift(),n&&n(i)):(this._queue.shift(),n&&n(null,...o)),r.pending=!1,this._drainQueue())),this._queue.push(r),this._drainQueue()}_drainQueue(t=!1){if(!this.connected||this._queue.length===0)return;const n=this._queue[0];n.pending&&!t||(n.pending=!0,n.tryCount++,this.flags=n.flags,this.emit.apply(this,n.args))}packet(t){t.nsp=this.nsp,this.io._packet(t)}onopen(){typeof this.auth=="function"?this.auth(t=>{this._sendConnectPacket(t)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(t){this.packet({type:$t.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},t):t})}onerror(t){this.connected||this.emitReserved("connect_error",t)}onclose(t,n){this.connected=!1,delete this.id,this.emitReserved("disconnect",t,n),this._clearAcks()}_clearAcks(){Object.keys(this.acks).forEach(t=>{if(!this.sendBuffer.some(r=>String(r.id)===t)){const r=this.acks[t];delete this.acks[t],r.withError&&r.call(this,new Error("socket has been disconnected"))}})}onpacket(t){if(t.nsp===this.nsp)switch(t.type){case $t.CONNECT:t.data&&t.data.sid?this.onconnect(t.data.sid,t.data.pid):this.emitReserved("connect_error",new Error("It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)"));break;case $t.EVENT:case $t.BINARY_EVENT:this.onevent(t);break;case $t.ACK:case $t.BINARY_ACK:this.onack(t);break;case $t.DISCONNECT:this.ondisconnect();break;case $t.CONNECT_ERROR:this.destroy();const r=new Error(t.data.message);r.data=t.data.data,this.emitReserved("connect_error",r);break}}onevent(t){const n=t.data||[];t.id!=null&&n.push(this.ack(t.id)),this.connected?this.emitEvent(n):this.receiveBuffer.push(Object.freeze(n))}emitEvent(t){if(this._anyListeners&&this._anyListeners.length){const n=this._anyListeners.slice();for(const r of n)r.apply(this,t)}super.emit.apply(this,t),this._pid&&t.length&&typeof t[t.length-1]=="string"&&(this._lastOffset=t[t.length-1])}ack(t){const n=this;let r=!1;return function(...i){r||(r=!0,n.packet({type:$t.ACK,id:t,data:i}))}}onack(t){const n=this.acks[t.id];typeof n=="function"&&(delete this.acks[t.id],n.withError&&t.data.unshift(null),n.apply(this,t.data))}onconnect(t,n){this.id=t,this.recovered=n&&this._pid===n,this._pid=n,this.connected=!0,this.emitBuffered(),this.emitReserved("connect"),this._drainQueue(!0)}emitBuffered(){this.receiveBuffer.forEach(t=>this.emitEvent(t)),this.receiveBuffer=[],this.sendBuffer.forEach(t=>{this.notifyOutgoingListeners(t),this.packet(t)}),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach(t=>t()),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:$t.DISCONNECT}),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(t){return this.flags.compress=t,this}get volatile(){return this.flags.volatile=!0,this}timeout(t){return this.flags.timeout=t,this}onAny(t){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(t),this}prependAny(t){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(t),this}offAny(t){if(!this._anyListeners)return this;if(t){const n=this._anyListeners;for(let r=0;r<n.length;r++)if(t===n[r])return n.splice(r,1),this}else this._anyListeners=[];return this}listenersAny(){return this._anyListeners||[]}onAnyOutgoing(t){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.push(t),this}prependAnyOutgoing(t){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.unshift(t),this}offAnyOutgoing(t){if(!this._anyOutgoingListeners)return this;if(t){const n=this._anyOutgoingListeners;for(let r=0;r<n.length;r++)if(t===n[r])return n.splice(r,1),this}else this._anyOutgoingListeners=[];return this}listenersAnyOutgoing(){return this._anyOutgoingListeners||[]}notifyOutgoingListeners(t){if(this._anyOutgoingListeners&&this._anyOutgoingListeners.length){const n=this._anyOutgoingListeners.slice();for(const r of n)r.apply(this,t.data)}}}function Pu(e){e=e||{},this.ms=e.min||100,this.max=e.max||1e4,this.factor=e.factor||2,this.jitter=e.jitter>0&&e.jitter<=1?e.jitter:0,this.attempts=0}Pu.prototype.duration=function(){var e=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var t=Math.random(),n=Math.floor(t*this.jitter*e);e=(Math.floor(t*10)&1)==0?e-n:e+n}return Math.min(e,this.max)|0},Pu.prototype.reset=function(){this.attempts=0},Pu.prototype.setMin=function(e){this.ms=e},Pu.prototype.setMax=function(e){this.max=e},Pu.prototype.setJitter=function(e){this.jitter=e};class dw extends Gn{constructor(t,n){var r;super(),this.nsps={},this.subs=[],t&&typeof t=="object"&&(n=t,t=void 0),n=n||{},n.path=n.path||"/socket.io",this.opts=n,Iv(this,n),this.reconnection(n.reconnection!==!1),this.reconnectionAttempts(n.reconnectionAttempts||1/0),this.reconnectionDelay(n.reconnectionDelay||1e3),this.reconnectionDelayMax(n.reconnectionDelayMax||5e3),this.randomizationFactor((r=n.randomizationFactor)!==null&&r!==void 0?r:.5),this.backoff=new Pu({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(n.timeout==null?2e4:n.timeout),this._readyState="closed",this.uri=t;const i=n.parser||Ate;this.encoder=new i.Encoder,this.decoder=new i.Decoder,this._autoConnect=n.autoConnect!==!1,this._autoConnect&&this.open()}reconnection(t){return arguments.length?(this._reconnection=!!t,t||(this.skipReconnect=!0),this):this._reconnection}reconnectionAttempts(t){return t===void 0?this._reconnectionAttempts:(this._reconnectionAttempts=t,this)}reconnectionDelay(t){var n;return t===void 0?this._reconnectionDelay:(this._reconnectionDelay=t,(n=this.backoff)===null||n===void 0||n.setMin(t),this)}randomizationFactor(t){var n;return t===void 0?this._randomizationFactor:(this._randomizationFactor=t,(n=this.backoff)===null||n===void 0||n.setJitter(t),this)}reconnectionDelayMax(t){var n;return t===void 0?this._reconnectionDelayMax:(this._reconnectionDelayMax=t,(n=this.backoff)===null||n===void 0||n.setMax(t),this)}timeout(t){return arguments.length?(this._timeout=t,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&this.backoff.attempts===0&&this.reconnect()}open(t){if(~this._readyState.indexOf("open"))return this;this.engine=new gte(this.uri,this.opts);const n=this.engine,r=this;this._readyState="opening",this.skipReconnect=!1;const i=Yi(n,"open",function(){r.onopen(),t&&t()}),o=u=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",u),t?t(u):this.maybeReconnectOnOpen()},s=Yi(n,"error",o);if(this._timeout!==!1){const u=this._timeout,c=this.setTimeoutFn(()=>{i(),o(new Error("timeout")),n.close()},u);this.opts.autoUnref&&c.unref(),this.subs.push(()=>{this.clearTimeoutFn(c)})}return this.subs.push(i),this.subs.push(s),this}connect(t){return this.open(t)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");const t=this.engine;this.subs.push(Yi(t,"ping",this.onping.bind(this)),Yi(t,"data",this.ondata.bind(this)),Yi(t,"error",this.onerror.bind(this)),Yi(t,"close",this.onclose.bind(this)),Yi(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(t){try{this.decoder.add(t)}catch(n){this.onclose("parse error",n)}}ondecoded(t){Av(()=>{this.emitReserved("packet",t)},this.setTimeoutFn)}onerror(t){this.emitReserved("error",t)}socket(t,n){let r=this.nsps[t];return r?this._autoConnect&&!r.active&&r.connect():(r=new x$(this,t,n),this.nsps[t]=r),r}_destroy(t){const n=Object.keys(this.nsps);for(const r of n)if(this.nsps[r].active)return;this._close()}_packet(t){const n=this.encoder.encode(t);for(let r=0;r<n.length;r++)this.engine.write(n[r],t.options)}cleanup(){this.subs.forEach(t=>t()),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close")}disconnect(){return this._close()}onclose(t,n){var r;this.cleanup(),(r=this.engine)===null||r===void 0||r.close(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",t,n),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;const t=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{const n=this.backoff.duration();this._reconnecting=!0;const r=this.setTimeoutFn(()=>{t.skipReconnect||(this.emitReserved("reconnect_attempt",t.backoff.attempts),!t.skipReconnect&&t.open(i=>{i?(t._reconnecting=!1,t.reconnect(),this.emitReserved("reconnect_error",i)):t.onreconnect()}))},n);this.opts.autoUnref&&r.unref(),this.subs.push(()=>{this.clearTimeoutFn(r)})}}onreconnect(){const t=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",t)}}const rd={};function Tv(e,t){typeof e=="object"&&(t=e,e=void 0),t=t||{};const n=mte(e,t.path||"/socket.io"),r=n.source,i=n.id,o=n.path,s=rd[i]&&o in rd[i].nsps,u=t.forceNew||t["force new connection"]||t.multiplex===!1||s;let c;return u?c=new dw(r,t):(rd[i]||(rd[i]=new dw(r,t)),c=rd[i]),n.query&&!t.query&&(t.query=n.queryKey),c.socket(n.path,t)}Object.assign(Tv,{Manager:dw,Socket:x$,io:Tv,connect:Tv});const tl=class tl{constructor(){tr(this,"socket",null);tr(this,"isConnected",!1);tr(this,"eventListeners",new Map)}static getInstance(){return tl.instance||(tl.instance=new tl),tl.instance}connect(t){return this.socket?this.socket:(this.socket=Tv(`${nZ}${t}`,{transports:["websocket"]}),this.socket.on("connect",()=>{this.isConnected=!0,this.emitEvent("connect")}),this.socket.on("disconnect",()=>{this.isConnected=!1,this.emitEvent("disconnect")}),this.socket)}disconnect(){this.socket&&(this.socket.disconnect(),this.socket=null,this.isConnected=!1,this.eventListeners.clear())}getSocket(){return this.socket}getIsConnected(){return this.isConnected}on(t,n){var r,i;this.eventListeners.has(t)||this.eventListeners.set(t,[]),(r=this.eventListeners.get(t))==null||r.push(n),(i=this.socket)==null||i.on(t,n)}off(t,n){var i;const r=this.eventListeners.get(t);if(r){const o=r.indexOf(n);o>-1&&r.splice(o,1),(i=this.socket)==null||i.off(t,n)}}emit(t,...n){var r;(r=this.socket)==null||r.emit(t,...n)}emitEvent(t,...n){const r=this.eventListeners.get(t);r&&r.forEach(i=>i(...n))}};tr(tl,"instance");let hw=tl;const _o=hw.getInstance();var Rte={MESSAGE:"MESSAGE"},Ote={USER:"USER"};const Tte=({children:e,nameSpace:t})=>{const[n,r]=W.useState([]),[i,o]=W.useState(!1),[s,u]=W.useState(!1),[c,d]=W.useState([]),[p,h]=W.useState(!1),[m,v]=W.useState(!1),[_,x]=W.useState([]),b=$S("web-socket"),[w,C]=Tn.useState([]),[E,R]=W.useState(null),[O,T]=W.useState(!1),[L,B]=W.useState(null),z=cZ(),P=ur(),[V,J]=W.useState(!1),[le,G]=Tn.useState(null),[Z,q]=W.useState(null);console.debug("isWebsocketEnabled",b),W.useEffect(()=>{if(b){const ue=_o.connect("/api/v1/chat");R(ue);const Re=()=>{console.debug("connected to websocket"),T(!0)},ie=()=>{console.debug("disconnected from websocket"),T(!1)},Ne=Fe=>{console.debug("response from websocket",Fe);const We=Fe.conversationId??crypto.randomUUID();B(We),Fe.Variants_quantity&&x(be=>[...be,...Fe.Variants_quantity]);const Pe=[...n,{text:Fe.response,products:Fe.products,conversationId:We,rating:"neutral",leading_queries:Fe.leading_queries,collections:Fe.collections,variants:Fe.variants,shop:Fe.shop,Variants_quantity:Fe.Variants_quantity,monthlyChatLimitReached:Fe.monthlyChatLimitReached,isBot:!0}];r(Pe),H(Pe),d(be=>[...be,[n[n.length-1].text,Fe.response]]),u(!1)},De=Fe=>{if(Fe.event==="error"){const We={text:"I am facing some network issues. Can you please check your network and try again?",isBot:!0},Pe=[...n,We];r(Pe),H(Pe),u(!1)}};return _o.on("connect",Re),_o.on("disconnect",ie),_o.on("response",Ne),_o.on("system",De),()=>{_o.off("connect",Re),_o.off("disconnect",ie),_o.off("response",Ne),_o.off("system",De)}}},[b,n]);const H=ue=>{sessionStorage.setItem(yi(window.DebalesChat.projectId,pi.CHAT_HISTORY),JSON.stringify(ue))},fe=()=>{const ue=sessionStorage.getItem(yi(window.DebalesChat.projectId,pi.CHAT_HISTORY));return ue?JSON.parse(ue):[]},we=W.useCallback(async()=>{var ue;if(t)try{o(!0);const Re=await fetch(`${fo}/api/wordpress/UiData?value=${t}`),ie=await Re.json();if(!Re.ok)throw new Error("failed to fetch data"+ie.error);const Ne=document.getElementById("debales-ai-assistant");Ne&&(Ne.style.zIndex=String(ie.zIndex??2031483602)),q(ie),ie!=null&&ie.shopifyShopDomain&&zW(ie.shopifyShopDomain).then(We=>{G(We)}),C(ie.suggestedQuestions);const De=fe(),Fe=((ue=ie.pluginConfig)==null?void 0:ue.collectedUserInfo)&&(ie.pluginConfig.collectedUserInfo.name||ie.pluginConfig.collectedUserInfo.email||ie.pluginConfig.collectedUserInfo.phone);if(v(Fe),De.length>0)r(De);else{const We={text:ie.initialMessage||"Hi, I am an AI Assistant. How can I help you?",isBot:!0};r([We])}}catch(Re){console.error(Re)}finally{o(!1)}},[t]);W.useEffect(()=>{we()},[we]);const k=W.useCallback(async(ue,Re,ie,Ne,De)=>{var Ke,Je;if(!ue||ue.trim()===""||s&&!ie)return;const Fe=ho(),We=Fe===null&&!V&&((Ke=Z==null?void 0:Z.pluginConfig)==null?void 0:Ke.collectedUserInfo)&&(Z.pluginConfig.collectedUserInfo.name||Z.pluginConfig.collectedUserInfo.email||Z.pluginConfig.collectedUserInfo.phone);let Pe=[...n];if(Ne?Ne&&n.length<=2?(h(!0),Pe=[]):h(!1):(Pe.push({text:ue,isBot:!1}),h(!1)),We&&((Je=Z==null?void 0:Z.pluginConfig)==null?void 0:Je.collectedUserInfo.isOptional)===!1){Pe.push({text:"I need some information from you before we can continue our conversation. Please fill out your details in the form below. This helps us provide you with better assistance and stay in touch if needed.",isBot:!0}),r(Pe),v(!0);return}const be=ur();u(!0);try{r(Pe),H(Pe);const dt=await fetch(`${fo}/api/wordpress/ChatWithBot`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sessionId:be,userMessage:ue,nameSpace:t,chat_history:c,leading_queries:De,answer:Re,products:ie,userInfo:JSON.stringify(Fe),anonymousUserId:z,distinctId:Us.getDistinctId(),timestamp:new Date().toISOString(),timeZone:Intl.DateTimeFormat().resolvedOptions().timeZone})});if(!dt.ok)throw new Error("Network response was not ok");const tt=await dt.json(),lt=tt.conversationId??crypto.randomUUID();B(lt),tt.Variants_quantity&&x(F=>[...F,...tt.Variants_quantity]);const N=[...Pe,{text:tt.response,products:tt.products,conversationId:lt,rating:"neutral",leading_queries:tt.leading_queries,collections:tt.collections,variants:tt.variants,shop:tt.shop,Variants_quantity:tt.Variants_quantity,monthlyChatLimitReached:tt.monthlyChatLimitReached,isBot:!0}];r(N),H(N),d(F=>[...F,[ue,tt.response]])}catch(dt){console.error(dt);const tt={text:"I am facing some network issues. Can you please check your network and try again?",isBot:!0},lt=[...Pe,tt];Ne||(r(lt),H(lt))}finally{u(!1)}},[n,s,c,t,z,Z,V]),ne=W.useCallback(ue=>{Z&&q(Re=>Re?{...Re,mobileDisplayMode:ue}:null)},[Z]),de=W.useCallback(async(ue,Re,ie,Ne,De)=>{var be,Ke;if(console.debug("onSendMessageWebSocket"),!ue||ue.trim()===""||s&&!ie)return;const Fe=ho(),We=Fe===null&&!V&&((be=Z==null?void 0:Z.pluginConfig)==null?void 0:be.collectedUserInfo)&&(Z.pluginConfig.collectedUserInfo.name||Z.pluginConfig.collectedUserInfo.email||Z.pluginConfig.collectedUserInfo.phone);let Pe=[...n];if(Ne?Ne&&n.length<=2?(h(!0),Pe=[]):h(!1):(Pe.push({text:ue,isBot:!1}),h(!1)),We&&((Ke=Z==null?void 0:Z.pluginConfig)==null?void 0:Ke.collectedUserInfo.isOptional)===!1){Pe.push({text:"I need some information from you before we can continue our conversation. Please fill out your details in the form below. This helps us provide you with better assistance and stay in touch if needed.",isBot:!0}),r(Pe),v(!0);return}if(u(!0),r(Pe),H(Pe),console.debug("socket",E),console.debug("isSocketConnected",O),E&&O){const Je={type:Rte.MESSAGE,role:Ote.USER,query:ue,nameSpace:t,leadingQueries:De,answer:Re,products:ie,userInfo:Fe,timeZone:Intl.DateTimeFormat().resolvedOptions().timeZone,timestamp:new Date().toISOString(),sessionId:P,anonymousUserId:z,distinctId:Us.getDistinctId()};_o.emit("chat",Je)}else k(ue,Re,ie,Ne,De)},[n,s,t,z,Z,V,E,O,P,k]),D={sessionId:P,messages:n,isLoading:i,isMessageLoading:s,isKlaviyoMessage:p,showUserInfoModel:m,pendingBulkItems:_,lastedBotmessageId:L,isFormClosedByUser:V,uiData:Z,storeMetaData:le,suggestedQuestions:w,onSendMessage:b?de:k,setMessages:r,setIsLoading:o,setIsMessageLoading:u,setIsKlaviyoMessage:h,setShowUserInfoModel:v,setPendingBulkItems:x,setLastedBotmessageId:B,setIsFormClosedByUser:J,fetchUiInfo:we,changeDisplayModel:ne,saveConversation:H,loadConversation:fe,setSuggestedQuestions:C};return $.jsx(nD.Provider,{value:D,children:e})};function Mte(e){const t=XS.getInstance().getAdapter();return $.jsx(Tte,{nameSpace:e.botId,children:$.jsx(MW,{apiKey:rZ,options:{capture_pageview:e.botId!=="burgerbaeclothing",capture_pageleave:e.botId!=="burgerbaeclothing",api_host:fo+"/ingest",ui_host:"https://us.posthog.com",loaded:n=>{n.register({platform:Zf.detect(),project:e.botId,sessionId:ur()}),n.group("project",e.botId,{platform:Zf.detect()});const r=ho();r&&r.email&&!n._isIdentified()&&n.identify(r.email,{name:r.name,phone:r.phone,email:r.email,project:e.botId})},debug:!1},children:$.jsx(Lee,{adapter:t,children:e.children})})})}function Dte(e){return $.jsx(Tee,{children:$.jsx(Mte,{botId:e.botId,children:$.jsx(Oee,{...e})})})}const ra=new Map;function Mv(e){const{botId:t}=e;if(ra.has(t))return console.warn(`Chatbot with botId "${t}" is already initialized. Skipping duplicate initialization.`),ra.get(t);const n=e.containerId||`debales-chatbot-${t}`;let r=document.getElementById(n);r||(r=document.createElement("div"),r.id=n,document.body.appendChild(r));const i=AC.createRoot(r);i.render(Tn.createElement(Dte,{botId:e.botId}));const o={container:r,unmount:()=>{i.unmount(),ra.delete(t),r.parentNode&&r.parentNode.removeChild(r)}};return ra.set(t,o),o}typeof window<"u"&&(window.DebalesChatbotBrowser={init:Mv,destroy:e=>{const t=ra.get(e);return t?(t.unmount(),!0):!1},isInitialized:e=>ra.has(e),getInitializedBots:()=>Array.from(ra.keys())});function C$(){document.querySelectorAll('[id="debales-ai-assistant"][data-bot-id]').forEach(n=>{const r=n.getAttribute("data-bot-id");r&&!ra.has(r)&&Mv({botId:r,containerId:n.id})}),document.querySelectorAll('script[src*="ai-assistant.min.js"][data-bot-id]').forEach(n=>{const r=n.getAttribute("data-bot-id");r&&!ra.has(r)&&Mv({botId:r})})}return typeof document<"u"&&(document.readyState==="loading"?document.addEventListener("DOMContentLoaded",C$):C$()),Lo.initDebalesChatbot=Mv,Object.defineProperty(Lo,Symbol.toStringTag,{value:"Module"}),Lo}({});
|