@debales/ai 1.1.11-canary.0 → 1.1.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser/ai-browser.js +7 -7
- package/dist/module/ai.js +8 -8
- package/dist/module/ai.umd.js +6 -6
- package/package.json +3 -3
|
@@ -78,7 +78,7 @@ Error generating stack: `+f.message+`
|
|
|
78
78
|
`,...o.current()});return/^[\t ]/.test(d)&&(d=vf(d.charCodeAt(0))+d.slice(1)),d=d?a+" "+d:a,n.options.closeAtx&&(d+=" "+a),c(),u(),d}AT.peek=Ij;function AT(e){return e.value||""}function Ij(){return"<"}IT.peek=Tj;function IT(e,t,n,r){const i=$b(n),o=i==='"'?"Quote":"Apostrophe",a=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(")"),a(),d}function Tj(){return"!"}TT.peek=Mj;function TT(e,t,n,r){const i=e.referenceType,o=n.enter("imageReference");let a=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+"]["),a();const p=n.stack;n.stack=[],a=n.enter("reference");const h=n.safe(n.associationId(e),{before:c,after:"]",...u.current()});return a(),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 Mj(){return"!"}MT.peek=Oj;function MT(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 a=n.unsafe[o],u=n.compilePattern(a);let c;if(a.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 Oj(){return"`"}function OT(e,t){const n=ob(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))}RT.peek=Rj;function RT(e,t,n,r){const i=$b(n),o=i==='"'?"Quote":"Apostrophe",a=n.createTracker(r);let u,c;if(OT(e,n)){const p=n.stack;n.stack=[],u=n.enter("autolink");let h=a.move("<");return h+=a.move(n.containerPhrasing(e,{before:h,after:">",...a.current()})),h+=a.move(">"),u(),n.stack=p,h}u=n.enter("link"),c=n.enter("label");let d=a.move("[");return d+=a.move(n.containerPhrasing(e,{before:d,after:"](",...a.current()})),d+=a.move("]("),c(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(c=n.enter("destinationLiteral"),d+=a.move("<"),d+=a.move(n.safe(e.url,{before:d,after:">",...a.current()})),d+=a.move(">")):(c=n.enter("destinationRaw"),d+=a.move(n.safe(e.url,{before:d,after:e.title?" ":")",...a.current()}))),c(),e.title&&(c=n.enter(`title${o}`),d+=a.move(" "+i),d+=a.move(n.safe(e.title,{before:d,after:i,...a.current()})),d+=a.move(i),c()),d+=a.move(")"),u(),d}function Rj(e,t,n){return OT(e,n)?"<":"["}$T.peek=$j;function $T(e,t,n,r){const i=e.referenceType,o=n.enter("linkReference");let a=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+"]["),a();const p=n.stack;n.stack=[],a=n.enter("reference");const h=n.safe(n.associationId(e),{before:c,after:"]",...u.current()});return a(),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 $j(){return"["}function Db(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 Dj(e){const t=Db(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 Lj(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 DT(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 Nj(e,t,n,r){const i=n.enter("list"),o=n.bulletCurrent;let a=e.ordered?Lj(n):Db(n);const u=e.ordered?a==="."?")":".":Dj(n);let c=t&&n.bulletLastUsed?a===n.bulletLastUsed:!1;if(!e.ordered){const p=e.children?e.children[0]:void 0;if((a==="*"||a==="-")&&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),DT(n)===a&&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&&(a=u),n.bulletCurrent=a;const d=n.containerFlow(e,r);return n.bulletLastUsed=a,n.bulletCurrent=o,i(),d}function Bj(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 Pj(e,t,n,r){const i=Bj(n);let o=n.bulletCurrent||Db(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 a=o.length+1;(i==="tab"||i==="mixed"&&(t&&t.type==="list"&&t.spread||e.spread))&&(a=Math.ceil(a/4)*4);const u=n.createTracker(r);u.move(o+" ".repeat(a-o.length)),u.shift(a);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(a))+h:(v?o:o+" ".repeat(a-o.length))+h}}function Fj(e,t,n,r){const i=n.enter("paragraph"),o=n.enter("phrasing"),a=n.containerPhrasing(e,r);return o(),i(),a}const zj=ap(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function Uj(e,t,n,r){return(e.children.some(function(a){return zj(a)})?n.containerPhrasing:n.containerFlow).call(n,e,r)}function jj(e){const t=e.options.strong||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}LT.peek=qj;function LT(e,t,n,r){const i=jj(n),o=n.enter("strong"),a=n.createTracker(r),u=a.move(i+i);let c=a.move(n.containerPhrasing(e,{after:i,before:u,...a.current()}));const d=c.charCodeAt(0),p=up(r.before.charCodeAt(r.before.length-1),d,i);p.inside&&(c=vf(d)+c.slice(1));const h=c.charCodeAt(c.length-1),m=up(r.after.charCodeAt(0),h,i);m.inside&&(c=c.slice(0,-1)+vf(h));const v=a.move(i+i);return o(),n.attentionEncodeSurroundingInfo={after:m.outside,before:p.outside},u+c+v}function qj(e,t,n){return n.options.strong||"*"}function Hj(e,t,n,r){return n.safe(e.value,r)}function Gj(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 Vj(e,t,n){const r=(DT(n)+(n.options.ruleSpaces?" ":"")).repeat(Gj(n));return n.options.ruleSpaces?r.slice(0,-1):r}const NT={blockquote:gj,break:kT,code:xj,definition:Sj,emphasis:ET,hardBreak:kT,heading:Aj,html:AT,image:IT,imageReference:TT,inlineCode:MT,link:RT,linkReference:$T,list:Nj,listItem:Pj,paragraph:Fj,root:Uj,strong:LT,text:Hj,thematicBreak:Vj};function Zj(){return{enter:{table:Yj,tableData:BT,tableHeader:BT,tableRow:Kj},exit:{codeText:Qj,table:Wj,tableData:Lb,tableHeader:Lb,tableRow:Lb}}}function Yj(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 Wj(e){this.exit(e),this.data.inTable=void 0}function Kj(e){this.enter({type:"tableRow",children:[]},e)}function Lb(e){this.exit(e)}function BT(e){this.enter({type:"tableCell",children:[]},e)}function Qj(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,Xj));const n=this.stack[this.stack.length-1];n.type,n.value=t,this.exit(e)}function Xj(e,t){return t==="|"?t:e}function Jj(e){const t=e||{},n=t.tableCellPadding,r=t.tablePipeAlign,i=t.stringLength,o=n?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:`
|
|
79
79
|
`,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:m,table:a,tableCell:c,tableRow:u}};function a(v,_,S,x){return d(p(v,S,x),v.align)}function u(v,_,S,x){const b=h(v,S,x),k=d([b]);return k.slice(0,k.indexOf(`
|
|
80
80
|
`))}function c(v,_,S,x){const b=S.enter("tableCell"),k=S.enter("phrasing"),E=S.containerPhrasing(v,{...x,before:o,after:o});return k(),b(),E}function d(v,_){return hj(v,{align:_,alignDelimiters:r,padding:n,stringLength:i})}function p(v,_,S){const x=v.children;let b=-1;const k=[],E=_.enter("table");for(;++b<x.length;)k[b]=h(x[b],_,S);return E(),k}function h(v,_,S){const x=v.children;let b=-1;const k=[],E=_.enter("tableRow");for(;++b<x.length;)k[b]=c(x[b],v,_,S);return E(),k}function m(v,_,S){let x=NT.inlineCode(v,_,S);return S.stack.includes("tableCell")&&(x=x.replace(/\|/g,"\\$&")),x}}function e7(){return{exit:{taskListCheckValueChecked:PT,taskListCheckValueUnchecked:PT,paragraph:n7}}}function t7(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:r7}}}function PT(e){const t=this.stack[this.stack.length-2];t.type,t.checked=e.type==="taskListCheckValueChecked"}function n7(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,a;for(;++o<i.length;){const u=i[o];if(u.type==="paragraph"){a=u;break}}a===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 r7(e,t,n,r){const i=e.children[0],o=typeof e.checked=="boolean"&&i&&i.type==="paragraph",a="["+(e.checked?"x":" ")+"] ",u=n.createTracker(r);o&&u.move(a);let c=NT.listItem(e,t,n,{...r,...u.current()});return o&&(c=c.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,d)),c;function d(p){return p+a}}function i7(){return[NU(),rj(),sj(),Zj(),e7()]}function o7(e){return{extensions:[BU(),ij(e),lj(),Jj(e),t7()]}}const a7={tokenize:d7,partial:!0},FT={tokenize:h7,partial:!0},zT={tokenize:p7,partial:!0},UT={tokenize:g7,partial:!0},s7={tokenize:m7,partial:!0},jT={name:"wwwAutolink",tokenize:c7,previous:HT},qT={name:"protocolAutolink",tokenize:f7,previous:GT},ea={name:"emailAutolink",tokenize:u7,previous:VT},To={};function l7(){return{text:To}}let Qs=48;for(;Qs<123;)To[Qs]=ea,Qs++,Qs===58?Qs=65:Qs===91&&(Qs=97);To[43]=ea,To[45]=ea,To[46]=ea,To[95]=ea,To[72]=[ea,qT],To[104]=[ea,qT],To[87]=[ea,jT],To[119]=[ea,jT];function u7(e,t,n){const r=this;let i,o;return a;function a(h){return!Nb(h)||!VT.call(r,r.previous)||Bb(r.events)?n(h):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),u(h))}function u(h){return Nb(h)?(e.consume(h),u):h===64?(e.consume(h),c):n(h)}function c(h){return h===46?e.check(s7,p,d)(h):h===45||h===95||Qr(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&&ci(r.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),t(h)):n(h)}}function c7(e,t,n){const r=this;return i;function i(a){return a!==87&&a!==119||!HT.call(r,r.previous)||Bb(r.events)?n(a):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(a7,e.attempt(FT,e.attempt(zT,o),n),n)(a))}function o(a){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),t(a)}}function f7(e,t,n){const r=this;let i="",o=!1;return a;function a(h){return(h===72||h===104)&>.call(r,r.previous)&&!Bb(r.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),i+=String.fromCodePoint(h),e.consume(h),u):n(h)}function u(h){if(ci(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||Qh(h)||Sn(h)||Ks(h)||Xh(h)?n(h):e.attempt(FT,e.attempt(zT,p),n)(h)}function p(h){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),t(h)}}function d7(e,t,n){let r=0;return i;function i(a){return(a===87||a===119)&&r<3?(r++,e.consume(a),i):a===46&&r===3?(e.consume(a),o):n(a)}function o(a){return a===null?n(a):t(a)}}function h7(e,t,n){let r,i,o;return a;function a(d){return d===46||d===95?e.check(UT,c,u)(d):d===null||Sn(d)||Ks(d)||d!==45&&Xh(d)?c(d):(o=!0,e.consume(d),a)}function u(d){return d===95?r=!0:(i=r,r=void 0),e.consume(d),a}function c(d){return i||r||!o?n(d):t(d)}}function p7(e,t){let n=0,r=0;return i;function i(a){return a===40?(n++,e.consume(a),i):a===41&&r<n?o(a):a===33||a===34||a===38||a===39||a===41||a===42||a===44||a===46||a===58||a===59||a===60||a===63||a===93||a===95||a===126?e.check(UT,t,o)(a):a===null||Sn(a)||Ks(a)?t(a):(e.consume(a),i)}function o(a){return a===41&&r++,e.consume(a),i}}function g7(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||Sn(u)||Ks(u)?t(u):n(u)}function i(u){return u===null||u===40||u===91||Sn(u)||Ks(u)?t(u):r(u)}function o(u){return ci(u)?a(u):n(u)}function a(u){return u===59?(e.consume(u),r):ci(u)?(e.consume(u),a):n(u)}}function m7(e,t,n){return r;function r(o){return e.consume(o),i}function i(o){return Qr(o)?n(o):t(o)}}function HT(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||Sn(e)}function GT(e){return!ci(e)}function VT(e){return!(e===47||Nb(e))}function Nb(e){return e===43||e===45||e===46||e===95||Qr(e)}function Bb(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 v7={tokenize:k7,partial:!0};function y7(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:w7,continuation:{tokenize:S7},exit:C7}},text:{91:{name:"gfmFootnoteCall",tokenize:x7},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:_7,resolveTo:b7}}}}function _7(e,t,n){const r=this;let i=r.events.length;const o=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let a;for(;i--;){const c=r.events[i][1];if(c.type==="labelImage"){a=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(!a||!a._balanced)return n(c);const d=mo(r.sliceSerialize({start:a.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 b7(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)},a={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",a,t],["exit",a,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 x7(e,t,n){const r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let o=0,a;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&&!a||h===null||h===91||Sn(h))return n(h);if(h===93){e.exit("chunkString");const m=e.exit("gfmFootnoteCallString");return i.includes(mo(r.sliceSerialize(m)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(h),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):n(h)}return Sn(h)||(a=!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 w7(e,t,n){const r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let o,a=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(a>999||_===93&&!u||_===null||_===91||Sn(_))return n(_);if(_===93){e.exit("chunkString");const S=e.exit("gfmFootnoteDefinitionLabelString");return o=mo(r.sliceSerialize(S)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(_),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),m}return Sn(_)||(u=!0),a++,e.consume(_),_===92?h:p}function h(_){return _===91||_===92||_===93?(e.consume(_),a++,p):p(_)}function m(_){return _===58?(e.enter("definitionMarker"),e.consume(_),e.exit("definitionMarker"),i.includes(o)||i.push(o),Qt(e,v,"gfmFootnoteDefinitionWhitespace")):n(_)}function v(_){return t(_)}}function S7(e,t,n){return e.check(ff,t,e.attempt(v7,t,n))}function C7(e){e.exit("gfmFootnoteDefinition")}function k7(e,t,n){const r=this;return Qt(e,i,"gfmFootnoteDefinitionIndent",5);function i(o){const a=r.events[r.events.length-1];return a&&a[1].type==="gfmFootnoteDefinitionIndent"&&a[2].sliceSerialize(a[1],!0).length===4?t(o):n(o)}}function E7(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(a,u){let c=-1;for(;++c<a.length;)if(a[c][0]==="enter"&&a[c][1].type==="strikethroughSequenceTemporary"&&a[c][1]._close){let d=c;for(;d--;)if(a[d][0]==="exit"&&a[d][1].type==="strikethroughSequenceTemporary"&&a[d][1]._open&&a[c][1].end.offset-a[c][1].start.offset===a[d][1].end.offset-a[d][1].start.offset){a[c][1].type="strikethroughSequence",a[d][1].type="strikethroughSequence";const p={type:"strikethrough",start:Object.assign({},a[d][1].start),end:Object.assign({},a[c][1].end)},h={type:"strikethroughText",start:Object.assign({},a[d][1].end),end:Object.assign({},a[c][1].start)},m=[["enter",p,u],["enter",a[d][1],u],["exit",a[d][1],u],["enter",h,u]],v=u.parser.constructs.insideSpan.null;v&&$i(m,m.length,0,Jh(v,a.slice(d+1,c),u)),$i(m,m.length,0,[["exit",h,u],["enter",a[c][1],u],["exit",a[c][1],u],["exit",p,u]]),$i(a,d-1,c-d+3,m),c=d+m.length-2;break}}for(c=-1;++c<a.length;)a[c][1].type==="strikethroughSequenceTemporary"&&(a[c][1].type="data");return a}function o(a,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(_):(a.enter("strikethroughSequenceTemporary"),v(_))}function v(_){const S=Kl(d);if(_===126)return h>1?c(_):(a.consume(_),h++,v);if(h<2&&!n)return c(_);const x=a.exit("strikethroughSequenceTemporary"),b=Kl(_);return x._open=!b||b===2&&!!S,x._close=!S||S===2&&!!b,u(_)}}}class A7{constructor(){this.map=[]}add(t,n,r){I7(this,t,n,r)}consume(t){if(this.map.sort(function(o,a){return o[0]-a[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 I7(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 T7(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 M7(){return{flow:{null:{name:"table",tokenize:O7,resolveAll:R7}}}}function O7(e,t,n){const r=this;let i=0,o=0,a;return u;function u(P){let K=r.events.length-1;for(;K>-1;){const Z=r.events[K][1].type;if(Z==="lineEnding"||Z==="linePrefix")K--;else break}const re=K>-1?r.events[K][1].type:null,ue=re==="tableHead"||re==="tableRow"?$:c;return ue===$&&r.parser.lazy[r.now().line]?n(P):ue(P)}function c(P){return e.enter("tableHead"),e.enter("tableRow"),d(P)}function d(P){return P===124||(a=!0,o+=1),p(P)}function p(P){return P===null?n(P):_t(P)?o>1?(o=0,r.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(P),e.exit("lineEnding"),v):n(P):Ut(P)?Qt(e,p,"whitespace")(P):(o+=1,a&&(a=!1,i+=1),P===124?(e.enter("tableCellDivider"),e.consume(P),e.exit("tableCellDivider"),a=!0,p):(e.enter("data"),h(P)))}function h(P){return P===null||P===124||Sn(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"),a=!1,Ut(P)?Qt(e,_,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(P):_(P))}function _(P){return P===45||P===58?x(P):P===124?(a=!0,e.enter("tableCellDivider"),e.consume(P),e.exit("tableCellDivider"),S):I(P)}function S(P){return Ut(P)?Qt(e,x,"whitespace")(P):x(P)}function x(P){return P===58?(o+=1,a=!0,e.enter("tableDelimiterMarker"),e.consume(P),e.exit("tableDelimiterMarker"),b):P===45?(o+=1,b(P)):P===null||_t(P)?A(P):I(P)}function b(P){return P===45?(e.enter("tableDelimiterFiller"),k(P)):I(P)}function k(P){return P===45?(e.consume(P),k):P===58?(a=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(P),e.exit("tableDelimiterMarker"),E):(e.exit("tableDelimiterFiller"),E(P))}function E(P){return Ut(P)?Qt(e,A,"whitespace")(P):A(P)}function A(P){return P===124?_(P):P===null||_t(P)?!a||i!==o?I(P):(e.exit("tableDelimiterRow"),e.exit("tableHead"),t(P)):I(P)}function I(P){return n(P)}function $(P){return e.enter("tableRow"),B(P)}function B(P){return P===124?(e.enter("tableCellDivider"),e.consume(P),e.exit("tableCellDivider"),B):P===null||_t(P)?(e.exit("tableRow"),t(P)):Ut(P)?Qt(e,B,"whitespace")(P):(e.enter("data"),U(P))}function U(P){return P===null||P===124||Sn(P)?(e.exit("data"),B(P)):(e.consume(P),P===92?G:U)}function G(P){return P===92||P===124?(e.consume(P),U):U(P)}}function R7(e,t){let n=-1,r=!0,i=0,o=[0,0,0,0],a=[0,0,0,0],u=!1,c=0,d,p,h;const m=new A7;for(;++n<e.length;){const v=e[n],_=v[1];v[0]==="enter"?_.type==="tableHead"?(u=!1,c!==0&&(ZT(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],a=[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,a[2]===0&&(o[1]!==0&&(a[0]=a[1],h=cp(m,t,o,i,void 0,h),o=[0,0,0,0]),a[2]=n)):_.type==="tableCellDivider"&&(r?r=!1:(o[1]!==0&&(a[0]=a[1],h=cp(m,t,o,i,void 0,h)),o=a,a=[o[1],n,0,0])):_.type==="tableHead"?(u=!0,c=n):_.type==="tableRow"||_.type==="tableDelimiterRow"?(c=n,o[1]!==0?(a[0]=a[1],h=cp(m,t,o,i,n,h)):a[1]!==0&&(h=cp(m,t,a,i,n,h)),i=0):i&&(_.type==="data"||_.type==="tableDelimiterMarker"||_.type==="tableDelimiterFiller")&&(a[3]=n)}for(c!==0&&ZT(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=T7(t.events,n))}return e}function cp(e,t,n,r,i,o){const a=r===1?"tableHeader":r===2?"tableDelimiter":"tableData",u="tableContent";n[0]!==0&&(o.end=Object.assign({},Xl(t.events,n[0])),e.add(n[0],0,[["exit",o,t]]));const c=Xl(t.events,n[1]);if(o={type:a,start:Object.assign({},c),end:Object.assign({},c)},e.add(n[1],0,[["enter",o,t]]),n[2]!==0){const d=Xl(t.events,n[2]),p=Xl(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,S=n[3]-n[2]-1;e.add(_,S,[])}}e.add(n[3]+1,0,[["exit",h,t]])}return i!==void 0&&(o.end=Object.assign({},Xl(t.events,i)),e.add(i,0,[["exit",o,t]]),o=void 0),o}function ZT(e,t,n,r,i){const o=[],a=Xl(t.events,n);i&&(i.end=Object.assign({},a),o.push(["exit",i,t])),r.end=Object.assign({},a),o.push(["exit",r,t]),e.add(n+1,0,o)}function Xl(e,t){const n=e[t],r=n[0]==="enter"?"start":"end";return n[1][r]}const $7={name:"tasklistCheck",tokenize:L7};function D7(){return{text:{91:$7}}}function L7(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 Sn(c)?(e.enter("taskListCheckValueUnchecked"),e.consume(c),e.exit("taskListCheckValueUnchecked"),a):c===88||c===120?(e.enter("taskListCheckValueChecked"),e.consume(c),e.exit("taskListCheckValueChecked"),a):n(c)}function a(c){return c===93?(e.enter("taskListCheckMarker"),e.consume(c),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),u):n(c)}function u(c){return _t(c)?t(c):Ut(c)?e.check({tokenize:N7},t,n)(c):n(c)}}function N7(e,t,n){return Qt(e,r,"whitespace");function r(i){return i===null?n(i):t(i)}}function B7(e){return AI([l7(),y7(),E7(e),M7(),D7()])}const P7={};function fp(e){const t=this,n=e||P7,r=t.data(),i=r.micromarkExtensions||(r.micromarkExtensions=[]),o=r.fromMarkdownExtensions||(r.fromMarkdownExtensions=[]),a=r.toMarkdownExtensions||(r.toMarkdownExtensions=[]);i.push(B7(n)),o.push(i7()),a.push(o7(n))}var kr=function(){return kr=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},kr.apply(this,arguments)};function Jl(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 Pb,YT;function F7(){return YT||(YT=1,Pb=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 a=Object.keys(t),u=Object.keys(n);if(a.length!==u.length)return!1;for(var c=Object.prototype.hasOwnProperty.bind(n),d=0;d<a.length;d++){var p=a[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}),Pb}var z7=F7();const U7=Hi(z7);var Mn="-ms-",yf="-moz-",cn="-webkit-",WT="comm",dp="rule",Fb="decl",j7="@import",KT="@keyframes",q7="@layer",QT=Math.abs,zb=String.fromCharCode,Ub=Object.assign;function H7(e,t){return Er(e,0)^45?(((t<<2^Er(e,0))<<2^Er(e,1))<<2^Er(e,2))<<2^Er(e,3):0}function XT(e){return e.trim()}function ta(e,t){return(e=t.exec(e))?e[0]:e}function Dt(e,t,n){return e.replace(t,n)}function hp(e,t,n){return e.indexOf(t,n)}function Er(e,t){return e.charCodeAt(t)|0}function eu(e,t,n){return e.slice(t,n)}function Mo(e){return e.length}function JT(e){return e.length}function _f(e,t){return t.push(e),e}function G7(e,t){return e.map(t).join("")}function eM(e,t){return e.filter(function(n){return!ta(n,t)})}var pp=1,tu=1,tM=0,Ki=0,fr=0,nu="";function gp(e,t,n,r,i,o,a,u){return{value:e,root:t,parent:n,type:r,props:i,children:o,line:pp,column:tu,length:a,return:"",siblings:u}}function Va(e,t){return Ub(gp("",null,null,"",null,null,0,e.siblings),e,{length:-e.length},t)}function ru(e){for(;e.root;)e=Va(e.root,{children:[e]});_f(e,e.siblings)}function V7(){return fr}function Z7(){return fr=Ki>0?Er(nu,--Ki):0,tu--,fr===10&&(tu=1,pp--),fr}function vo(){return fr=Ki<tM?Er(nu,Ki++):0,tu++,fr===10&&(tu=1,pp++),fr}function Xs(){return Er(nu,Ki)}function mp(){return Ki}function vp(e,t){return eu(nu,e,t)}function jb(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 Y7(e){return pp=tu=1,tM=Mo(nu=e),Ki=0,[]}function W7(e){return nu="",e}function qb(e){return XT(vp(Ki-1,Hb(e===91?e+2:e===40?e+1:e)))}function K7(e){for(;(fr=Xs())&&fr<33;)vo();return jb(e)>2||jb(fr)>3?"":" "}function Q7(e,t){for(;--t&&vo()&&!(fr<48||fr>102||fr>57&&fr<65||fr>70&&fr<97););return vp(e,mp()+(t<6&&Xs()==32&&vo()==32))}function Hb(e){for(;vo();)switch(fr){case e:return Ki;case 34:case 39:e!==34&&e!==39&&Hb(fr);break;case 40:e===41&&Hb(e);break;case 92:vo();break}return Ki}function X7(e,t){for(;vo()&&e+fr!==57;)if(e+fr===84&&Xs()===47)break;return"/*"+vp(t,Ki-1)+"*"+zb(e===47?e:vo())}function J7(e){for(;!jb(Xs());)vo();return vp(e,Ki)}function eq(e){return W7(yp("",null,null,null,[""],e=Y7(e),0,[0],e))}function yp(e,t,n,r,i,o,a,u,c){for(var d=0,p=0,h=a,m=0,v=0,_=0,S=1,x=1,b=1,k=0,E="",A=i,I=o,$=r,B=E;x;)switch(_=k,k=vo()){case 40:if(_!=108&&Er(B,h-1)==58){hp(B+=Dt(qb(k),"&","&\f"),"&\f",QT(d?u[d-1]:0))!=-1&&(b=-1);break}case 34:case 39:case 91:B+=qb(k);break;case 9:case 10:case 13:case 32:B+=K7(_);break;case 92:B+=Q7(mp()-1,7);continue;case 47:switch(Xs()){case 42:case 47:_f(tq(X7(vo(),mp()),t,n,c),c);break;default:B+="/"}break;case 123*S:u[d++]=Mo(B)*b;case 125*S:case 59:case 0:switch(k){case 0:case 125:x=0;case 59+p:b==-1&&(B=Dt(B,/\f/g,"")),v>0&&Mo(B)-h&&_f(v>32?rM(B+";",r,n,h-1,c):rM(Dt(B," ","")+";",r,n,h-2,c),c);break;case 59:B+=";";default:if(_f($=nM(B,t,n,d,p,i,u,E,A=[],I=[],h,o),o),k===123)if(p===0)yp(B,t,$,$,A,o,h,u,I);else switch(m===99&&Er(B,3)===110?100:m){case 100:case 108:case 109:case 115:yp(e,$,$,r&&_f(nM(e,$,$,0,0,i,u,E,i,A=[],h,I),I),i,I,h,u,r?A:I);break;default:yp(B,$,$,$,[""],I,0,u,I)}}d=p=v=0,S=b=1,E=B="",h=a;break;case 58:h=1+Mo(B),v=_;default:if(S<1){if(k==123)--S;else if(k==125&&S++==0&&Z7()==125)continue}switch(B+=zb(k),k*S){case 38:b=p>0?1:(B+="\f",-1);break;case 44:u[d++]=(Mo(B)-1)*b,b=1;break;case 64:Xs()===45&&(B+=qb(vo())),m=Xs(),p=h=Mo(E=B+=J7(mp())),k++;break;case 45:_===45&&Mo(B)==2&&(S=0)}}return o}function nM(e,t,n,r,i,o,a,u,c,d,p,h){for(var m=i-1,v=i===0?o:[""],_=JT(v),S=0,x=0,b=0;S<r;++S)for(var k=0,E=eu(e,m+1,m=QT(x=a[S])),A=e;k<_;++k)(A=XT(x>0?v[k]+" "+E:Dt(E,/&\f/g,v[k])))&&(c[b++]=A);return gp(e,t,n,i===0?dp:u,c,d,p,h)}function tq(e,t,n,r){return gp(e,t,n,WT,zb(V7()),eu(e,2,-2),0,r)}function rM(e,t,n,r,i){return gp(e,t,n,Fb,eu(e,0,r),eu(e,r+1,-1),r,i)}function iM(e,t,n){switch(H7(e,t)){case 5103:return cn+"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 cn+e+e;case 4789:return yf+e+e;case 5349:case 4246:case 4810:case 6968:case 2756:return cn+e+yf+e+Mn+e+e;case 5936:switch(Er(e,t+11)){case 114:return cn+e+Mn+Dt(e,/[svh]\w+-[tblr]{2}/,"tb")+e;case 108:return cn+e+Mn+Dt(e,/[svh]\w+-[tblr]{2}/,"tb-rl")+e;case 45:return cn+e+Mn+Dt(e,/[svh]\w+-[tblr]{2}/,"lr")+e}case 6828:case 4268:case 2903:return cn+e+Mn+e+e;case 6165:return cn+e+Mn+"flex-"+e+e;case 5187:return cn+e+Dt(e,/(\w+).+(:[^]+)/,cn+"box-$1$2"+Mn+"flex-$1$2")+e;case 5443:return cn+e+Mn+"flex-item-"+Dt(e,/flex-|-self/g,"")+(ta(e,/flex-|baseline/)?"":Mn+"grid-row-"+Dt(e,/flex-|-self/g,""))+e;case 4675:return cn+e+Mn+"flex-line-pack"+Dt(e,/align-content|flex-|-self/g,"")+e;case 5548:return cn+e+Mn+Dt(e,"shrink","negative")+e;case 5292:return cn+e+Mn+Dt(e,"basis","preferred-size")+e;case 6060:return cn+"box-"+Dt(e,"-grow","")+cn+e+Mn+Dt(e,"grow","positive")+e;case 4554:return cn+Dt(e,/([^-])(transform)/g,"$1"+cn+"$2")+e;case 6187:return Dt(Dt(Dt(e,/(zoom-|grab)/,cn+"$1"),/(image-set)/,cn+"$1"),e,"")+e;case 5495:case 3959:return Dt(e,/(image-set\([^]*)/,cn+"$1$`$1");case 4968:return Dt(Dt(e,/(.+:)(flex-)?(.*)/,cn+"box-pack:$3"+Mn+"flex-pack:$3"),/s.+-b[^;]+/,"justify")+cn+e+e;case 4200:if(!ta(e,/flex-|baseline/))return Mn+"grid-column-align"+eu(e,t)+e;break;case 2592:case 3360:return Mn+Dt(e,"template-","")+e;case 4384:case 3616:return n&&n.some(function(r,i){return t=i,ta(r.props,/grid-\w+-end/)})?~hp(e+(n=n[t].value),"span",0)?e:Mn+Dt(e,"-start","")+e+Mn+"grid-row-span:"+(~hp(n,"span",0)?ta(n,/\d+/):+ta(n,/\d+/)-+ta(e,/\d+/))+";":Mn+Dt(e,"-start","")+e;case 4896:case 4128:return n&&n.some(function(r){return ta(r.props,/grid-\w+-start/)})?e:Mn+Dt(Dt(e,"-end","-span"),"span ","")+e;case 4095:case 3583:case 4068:case 2532:return Dt(e,/(.+)-inline(.+)/,cn+"$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(Mo(e)-1-t>6)switch(Er(e,t+1)){case 109:if(Er(e,t+4)!==45)break;case 102:return Dt(e,/(.+:)(.+)-([^]+)/,"$1"+cn+"$2-$3$1"+yf+(Er(e,t+3)==108?"$3":"$2-$3"))+e;case 115:return~hp(e,"stretch",0)?iM(Dt(e,"stretch","fill-available"),t,n)+e:e}break;case 5152:case 5920:return Dt(e,/(.+?):(\d+)(\s*\/\s*(span)?\s*(\d+))?(.*)/,function(r,i,o,a,u,c,d){return Mn+i+":"+o+d+(a?Mn+i+"-span:"+(u?c:+c-+o)+d:"")+e});case 4949:if(Er(e,t+6)===121)return Dt(e,":",":"+cn)+e;break;case 6444:switch(Er(e,Er(e,14)===45?18:11)){case 120:return Dt(e,/(.+:)([^;\s!]+)(;|(\s+)?!.+)?/,"$1"+cn+(Er(e,14)===45?"inline-":"")+"box$3$1"+cn+"$2$3$1"+Mn+"$2box$3")+e;case 100:return Dt(e,":",":"+Mn)+e}break;case 5719:case 2647:case 2135:case 3927:case 2391:return Dt(e,"scroll-","scroll-snap-")+e}return e}function _p(e,t){for(var n="",r=0;r<e.length;r++)n+=t(e[r],r,e,t)||"";return n}function nq(e,t,n,r){switch(e.type){case q7:if(e.children.length)break;case j7:case Fb:return e.return=e.return||e.value;case WT:return"";case KT:return e.return=e.value+"{"+_p(e.children,r)+"}";case dp:if(!Mo(e.value=e.props.join(",")))return""}return Mo(n=_p(e.children,r))?e.return=e.value+"{"+n+"}":""}function rq(e){var t=JT(e);return function(n,r,i,o){for(var a="",u=0;u<t;u++)a+=e[u](n,r,i,o)||"";return a}}function iq(e){return function(t){t.root||(t=t.return)&&e(t)}}function oq(e,t,n,r){if(e.length>-1&&!e.return)switch(e.type){case Fb:e.return=iM(e.value,e.length,n);return;case KT:return _p([Va(e,{value:Dt(e.value,"@","@"+cn)})],r);case dp:if(e.length)return G7(n=e.props,function(i){switch(ta(i,r=/(::plac\w+|:read-\w+)/)){case":read-only":case":read-write":ru(Va(e,{props:[Dt(i,/:(read-\w+)/,":"+yf+"$1")]})),ru(Va(e,{props:[i]})),Ub(e,{props:eM(n,r)});break;case"::placeholder":ru(Va(e,{props:[Dt(i,/:(plac\w+)/,":"+cn+"input-$1")]})),ru(Va(e,{props:[Dt(i,/:(plac\w+)/,":"+yf+"$1")]})),ru(Va(e,{props:[Dt(i,/:(plac\w+)/,Mn+"input-$1")]})),ru(Va(e,{props:[i]})),Ub(e,{props:eM(n,r)});break}return""})}}var aq={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},Xr={NODE_ENV:"production"},iu=typeof process<"u"&&Xr!==void 0&&(Xr.REACT_APP_SC_ATTR||Xr.SC_ATTR)||"data-styled",oM="active",aM="data-styled-version",bp="6.1.17",Gb=`/*!sc*/
|
|
81
|
-
`,xp=typeof window<"u"&&"HTMLElement"in window,sq=!!(typeof SC_DISABLE_SPEEDY=="boolean"?SC_DISABLE_SPEEDY:typeof process<"u"&&Xr!==void 0&&Xr.REACT_APP_SC_DISABLE_SPEEDY!==void 0&&Xr.REACT_APP_SC_DISABLE_SPEEDY!==""?Xr.REACT_APP_SC_DISABLE_SPEEDY!=="false"&&Xr.REACT_APP_SC_DISABLE_SPEEDY:typeof process<"u"&&Xr!==void 0&&Xr.SC_DISABLE_SPEEDY!==void 0&&Xr.SC_DISABLE_SPEEDY!==""?Xr.SC_DISABLE_SPEEDY!=="false"&&Xr.SC_DISABLE_SPEEDY:Xr.NODE_ENV!=="production"),lq={},wp=Object.freeze([]),ou=Object.freeze({});function sM(e,t,n){return n===void 0&&(n=ou),e.theme!==n.theme&&e.theme||t||n.theme}var lM=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"]),uq=/[!"#$%&'()*+,./:;<=>?@[\\\]^`{|}~-]+/g,cq=/(^-|-$)/g;function uM(e){return e.replace(uq,"-").replace(cq,"")}var fq=/(a)(d)/gi,Sp=52,cM=function(e){return String.fromCharCode(e+(e>25?39:97))};function Vb(e){var t,n="";for(t=Math.abs(e);t>Sp;t=t/Sp|0)n=cM(t%Sp)+n;return(cM(t%Sp)+n).replace(fq,"$1-$2")}var Zb,fM=5381,au=function(e,t){for(var n=t.length;n;)e=33*e^t.charCodeAt(--n);return e},dM=function(e){return au(fM,e)};function Yb(e){return Vb(dM(e)>>>0)}function dq(e){return e.displayName||e.name||"Component"}function Wb(e){return typeof e=="string"&&Xr.NODE_ENV==="production"}var hM=typeof Symbol=="function"&&Symbol.for,pM=hM?Symbol.for("react.memo"):60115,hq=hM?Symbol.for("react.forward_ref"):60112,pq={childContextTypes:!0,contextType:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,getDerivedStateFromError:!0,getDerivedStateFromProps:!0,mixins:!0,propTypes:!0,type:!0},gq={name:!0,length:!0,prototype:!0,caller:!0,callee:!0,arguments:!0,arity:!0},gM={$$typeof:!0,compare:!0,defaultProps:!0,displayName:!0,propTypes:!0,type:!0},mq=((Zb={})[hq]={$$typeof:!0,render:!0,defaultProps:!0,displayName:!0,propTypes:!0},Zb[pM]=gM,Zb);function mM(e){return("type"in(t=e)&&t.type.$$typeof)===pM?gM:"$$typeof"in e?mq[e.$$typeof]:pq;var t}var vq=Object.defineProperty,yq=Object.getOwnPropertyNames,vM=Object.getOwnPropertySymbols,_q=Object.getOwnPropertyDescriptor,bq=Object.getPrototypeOf,yM=Object.prototype;function _M(e,t,n){if(typeof t!="string"){if(yM){var r=bq(t);r&&r!==yM&&_M(e,r,n)}var i=yq(t);vM&&(i=i.concat(vM(t)));for(var o=mM(e),a=mM(t),u=0;u<i.length;++u){var c=i[u];if(!(c in gq||n&&n[c]||a&&c in a||o&&c in o)){var d=_q(t,c);try{vq(e,c,d)}catch{}}}}return e}function Js(e){return typeof e=="function"}function Kb(e){return typeof e=="object"&&"styledComponentId"in e}function el(e,t){return e&&t?"".concat(e," ").concat(t):e||t||""}function Cp(e,t){if(e.length===0)return"";for(var n=e[0],r=1;r<e.length;r++)n+=e[r];return n}function bf(e){return e!==null&&typeof e=="object"&&e.constructor.name===Object.name&&!("props"in e&&e.$$typeof)}function Qb(e,t,n){if(n===void 0&&(n=!1),!n&&!bf(e)&&!Array.isArray(e))return t;if(Array.isArray(t))for(var r=0;r<t.length;r++)e[r]=Qb(e[r],t[r]);else if(bf(t))for(var r in t)e[r]=Qb(e[r],t[r]);return e}function Xb(e,t){Object.defineProperty(e,"toString",{value:t})}function tl(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 xq=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 tl(16,"".concat(t));this.groupSizes=new Uint32Array(o),this.groupSizes.set(r),this.length=o;for(var a=i;a<o;a++)this.groupSizes[a]=0}for(var u=this.indexOfGroup(t+1),c=(a=0,n.length);a<c;a++)this.tag.insertRule(u,n[a])&&(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,a=i;a<o;a++)n+="".concat(this.tag.getRule(a)).concat(Gb);return n},e}(),kp=new Map,Ep=new Map,Ap=1,Ip=function(e){if(kp.has(e))return kp.get(e);for(;Ep.has(Ap);)Ap++;var t=Ap++;return kp.set(e,t),Ep.set(t,e),t},wq=function(e,t){Ap=t+1,kp.set(e,t),Ep.set(t,e)},Sq="style[".concat(iu,"][").concat(aM,'="').concat(bp,'"]'),Cq=new RegExp("^".concat(iu,'\\.g(\\d+)\\[id="([\\w\\d-]+)"\\].*?"([^"]*)')),kq=function(e,t,n){for(var r,i=n.split(","),o=0,a=i.length;o<a;o++)(r=i[o])&&e.registerName(t,r)},Eq=function(e,t){for(var n,r=((n=t.textContent)!==null&&n!==void 0?n:"").split(Gb),i=[],o=0,a=r.length;o<a;o++){var u=r[o].trim();if(u){var c=u.match(Cq);if(c){var d=0|parseInt(c[1],10),p=c[2];d!==0&&(wq(p,d),kq(e,p,c[3]),e.getTag().insertRules(d,i)),i.length=0}else i.push(u)}}},bM=function(e){for(var t=document.querySelectorAll(Sq),n=0,r=t.length;n<r;n++){var i=t[n];i&&i.getAttribute(iu)!==oM&&(Eq(e,i),i.parentNode&&i.parentNode.removeChild(i))}};function Aq(){return typeof __webpack_nonce__<"u"?__webpack_nonce__:null}var xM=function(e){var t=document.head,n=e||t,r=document.createElement("style"),i=function(u){var c=Array.from(u.querySelectorAll("style[".concat(iu,"]")));return c[c.length-1]}(n),o=i!==void 0?i.nextSibling:null;r.setAttribute(iu,oM),r.setAttribute(aM,bp);var a=Aq();return a&&r.setAttribute("nonce",a),n.insertBefore(r,o),r},Iq=function(){function e(t){this.element=xM(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 a=r[i];if(a.ownerNode===n)return a}throw tl(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}(),Tq=function(){function e(t){this.element=xM(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}(),Mq=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}(),wM=xp,Oq={isServer:!xp,useCSSOMInjection:!sq},Tp=function(){function e(t,n,r){t===void 0&&(t=ou),n===void 0&&(n={});var i=this;this.options=kr(kr({},Oq),t),this.gs=n,this.names=new Map(r),this.server=!!t.isServer,!this.server&&xp&&wM&&(wM=!1,bM(this)),Xb(this,function(){return function(o){for(var a=o.getTag(),u=a.length,c="",d=function(h){var m=function(b){return Ep.get(b)}(h);if(m===void 0)return"continue";var v=o.names.get(m),_=a.getGroup(h);if(v===void 0||!v.size||_.length===0)return"continue";var S="".concat(iu,".g").concat(h,'[id="').concat(m,'"]'),x="";v!==void 0&&v.forEach(function(b){b.length>0&&(x+="".concat(b,","))}),c+="".concat(_).concat(S,'{content:"').concat(x,'"}').concat(Gb)},p=0;p<u;p++)d(p);return c}(i)})}return e.registerId=function(t){return Ip(t)},e.prototype.rehydrate=function(){!this.server&&xp&&bM(this)},e.prototype.reconstructWithOptions=function(t,n){return n===void 0&&(n=!0),new e(kr(kr({},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 Mq(i):r?new Iq(i):new Tq(i)}(this.options),new xq(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(Ip(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(Ip(t),r)},e.prototype.clearNames=function(t){this.names.has(t)&&this.names.get(t).clear()},e.prototype.clearRules=function(t){this.getTag().clearGroup(Ip(t)),this.clearNames(t)},e.prototype.clearTag=function(){this.tag=void 0},e}(),Rq=/&/g,$q=/^\s*\/\/.*$/gm;function SM(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=SM(n.children,t)),n})}function CM(e){var t,n,r,i=e===void 0?ou:e,o=i.options,a=o===void 0?ou:o,u=i.plugins,c=u===void 0?wp: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===dp&&m.value.includes("&")&&(m.props[0]=m.props[0].replace(Rq,n).replace(r,d))}),a.prefix&&p.push(oq),p.push(nq);var h=function(m,v,_,S){v===void 0&&(v=""),_===void 0&&(_=""),S===void 0&&(S="&"),t=S,n=v,r=new RegExp("\\".concat(n,"\\b"),"g");var x=m.replace($q,""),b=eq(_||v?"".concat(_," ").concat(v," { ").concat(x," }"):x);a.namespace&&(b=SM(b,a.namespace));var k=[];return _p(b,rq(p.concat(iq(function(E){return k.push(E)})))),k};return h.hash=c.length?c.reduce(function(m,v){return v.name||tl(15),au(m,v.name)},fM).toString():"",h}var Dq=new Tp,Jb=CM(),e1=er.createContext({shouldForwardProp:void 0,styleSheet:Dq,stylis:Jb});e1.Consumer;var Lq=er.createContext(void 0);function Mp(){return R.useContext(e1)}function Nq(e){var t=R.useState(e.stylisPlugins),n=t[0],r=t[1],i=Mp().styleSheet,o=R.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]),a=R.useMemo(function(){return CM({options:{namespace:e.namespace,prefix:e.enableVendorPrefixes},plugins:n})},[e.enableVendorPrefixes,e.namespace,n]);R.useEffect(function(){U7(n,e.stylisPlugins)||r(e.stylisPlugins)},[e.stylisPlugins]);var u=R.useMemo(function(){return{shouldForwardProp:e.shouldForwardProp,styleSheet:o,stylis:a}},[e.shouldForwardProp,o,a]);return er.createElement(e1.Provider,{value:u},er.createElement(Lq.Provider,{value:a},e.children))}var kM=function(){function e(t,n){var r=this;this.inject=function(i,o){o===void 0&&(o=Jb);var a=r.name+o.hash;i.hasNameForId(r.id,a)||i.insertRules(r.id,a,o(r.rules,a,"@keyframes"))},this.name=t,this.id="sc-keyframes-".concat(t),this.rules=n,Xb(this,function(){throw tl(12,String(r.name))})}return e.prototype.getName=function(t){return t===void 0&&(t=Jb),this.name+t.hash},e}(),Bq=function(e){return e>="A"&&e<="Z"};function EM(e){for(var t="",n=0;n<e.length;n++){var r=e[n];if(n===1&&r==="-"&&e[0]==="-")return e;Bq(r)?t+="-"+r.toLowerCase():t+=r}return t.startsWith("ms-")?"-"+t:t}var AM=function(e){return e==null||e===!1||e===""},IM=function(e){var t,n,r=[];for(var i in e){var o=e[i];e.hasOwnProperty(i)&&!AM(o)&&(Array.isArray(o)&&o.isCss||Js(o)?r.push("".concat(EM(i),":"),o,";"):bf(o)?r.push.apply(r,Jl(Jl(["".concat(i," {")],IM(o),!1),["}"],!1)):r.push("".concat(EM(i),": ").concat((t=i,(n=o)==null||typeof n=="boolean"||n===""?"":typeof n!="number"||n===0||t in aq||t.startsWith("--")?String(n).trim():"".concat(n,"px")),";")))}return r};function Za(e,t,n,r){if(AM(e))return[];if(Kb(e))return[".".concat(e.styledComponentId)];if(Js(e)){if(!Js(o=e)||o.prototype&&o.prototype.isReactComponent||!t)return[e];var i=e(t);return Za(i,t,n,r)}var o;return e instanceof kM?n?(e.inject(n,r),[e.getName(r)]):[e]:bf(e)?IM(e):Array.isArray(e)?Array.prototype.concat.apply(wp,e.map(function(a){return Za(a,t,n,r)})):[e.toString()]}function TM(e){for(var t=0;t<e.length;t+=1){var n=e[t];if(Js(n)&&!Kb(n))return!1}return!0}var Pq=dM(bp),Fq=function(){function e(t,n,r){this.rules=t,this.staticRulesId="",this.isStatic=(r===void 0||r.isStatic)&&TM(t),this.componentId=n,this.baseHash=au(Pq,n),this.baseStyle=r,Tp.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=el(i,this.staticRulesId);else{var o=Cp(Za(this.rules,t,n,r)),a=Vb(au(this.baseHash,o)>>>0);if(!n.hasNameForId(this.componentId,a)){var u=r(o,".".concat(a),void 0,this.componentId);n.insertRules(this.componentId,a,u)}i=el(i,a),this.staticRulesId=a}else{for(var c=au(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=Cp(Za(h,t,n,r));c=au(c,m+p),d+=m}}if(d){var v=Vb(c>>>0);n.hasNameForId(this.componentId,v)||n.insertRules(this.componentId,v,r(d,".".concat(v),void 0,this.componentId)),i=el(i,v)}}return i},e}(),xf=er.createContext(void 0);xf.Consumer;function Op(e){var t=er.useContext(xf),n=R.useMemo(function(){return function(r,i){if(!r)throw tl(14);if(Js(r)){var o=r(i);return o}if(Array.isArray(r)||typeof r!="object")throw tl(8);return i?kr(kr({},i),r):r}(e.theme,t)},[e.theme,t]);return e.children?er.createElement(xf.Provider,{value:n},e.children):null}var t1={};function zq(e,t,n){var r=Kb(e),i=e,o=!Wb(e),a=t.attrs,u=a===void 0?wp:a,c=t.componentId,d=c===void 0?function(A,I){var $=typeof A!="string"?"sc":uM(A);t1[$]=(t1[$]||0)+1;var B="".concat($,"-").concat(Yb(bp+$+t1[$]));return I?"".concat(I,"-").concat(B):B}(t.displayName,t.parentComponentId):c,p=t.displayName,h=p===void 0?function(A){return Wb(A)?"styled.".concat(A):"Styled(".concat(dq(A),")")}(e):p,m=t.displayName&&t.componentId?"".concat(uM(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 S=i.shouldForwardProp;if(t.shouldForwardProp){var x=t.shouldForwardProp;_=function(A,I){return S(A,I)&&x(A,I)}}else _=S}var b=new Fq(n,m,r?i.componentStyle:void 0);function k(A,I){return function($,B,U){var G=$.attrs,P=$.componentStyle,K=$.defaultProps,re=$.foldedComponentIds,ue=$.styledComponentId,Z=$.target,ie=er.useContext(xf),V=Mp(),Q=$.shouldForwardProp||V.shouldForwardProp,ve=sM(B,ie,K)||ou,Te=function(Ue,de,tt){for(var Ze,lt=kr(kr({},de),{className:void 0,theme:tt}),gt=0;gt<Ue.length;gt+=1){var je=Js(Ze=Ue[gt])?Ze(lt):Ze;for(var Se in je)lt[Se]=Se==="className"?el(lt[Se],je[Se]):Se==="style"?kr(kr({},lt[Se]),je[Se]):je[Se]}return de.className&&(lt.className=el(lt.className,de.className)),lt}(G,B,ve),T=Te.as||Z,X={};for(var me in Te)Te[me]===void 0||me[0]==="$"||me==="as"||me==="theme"&&Te.theme===ve||(me==="forwardedAs"?X.as=Te.forwardedAs:Q&&!Q(me,T)||(X[me]=Te[me],Q||Xr.NODE_ENV));var L=function(Ue,de){var tt=Mp(),Ze=Ue.generateAndInjectStyles(de,tt.styleSheet,tt.stylis);return Ze}(P,Te),we=el(re,ue);return L&&(we+=" "+L),Te.className&&(we+=" "+Te.className),X[Wb(T)&&!lM.has(T)?"class":"className"]=we,U&&(X.ref=U),R.createElement(T,X)}(E,A,I)}k.displayName=h;var E=er.forwardRef(k);return E.attrs=v,E.componentStyle=b,E.displayName=h,E.shouldForwardProp=_,E.foldedComponentIds=r?el(i.foldedComponentIds,i.styledComponentId):"",E.styledComponentId=m,E.target=r?i.target:e,Object.defineProperty(E,"defaultProps",{get:function(){return this._foldedDefaultProps},set:function(A){this._foldedDefaultProps=r?function(I){for(var $=[],B=1;B<arguments.length;B++)$[B-1]=arguments[B];for(var U=0,G=$;U<G.length;U++)Qb(I,G[U],!0);return I}({},i.defaultProps,A):A}}),Xb(E,function(){return".".concat(E.styledComponentId)}),o&&_M(E,e,{attrs:!0,componentStyle:!0,displayName:!0,foldedComponentIds:!0,shouldForwardProp:!0,styledComponentId:!0,target:!0}),E}function MM(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 OM=function(e){return Object.assign(e,{isCss:!0})};function fn(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];if(Js(e)||bf(e))return OM(Za(MM(wp,Jl([e],t,!0))));var r=e;return t.length===0&&r.length===1&&typeof r[0]=="string"?Za(r):OM(Za(MM(r,t)))}function n1(e,t,n){if(n===void 0&&(n=ou),!t)throw tl(1,t);var r=function(i){for(var o=[],a=1;a<arguments.length;a++)o[a-1]=arguments[a];return e(t,n,fn.apply(void 0,Jl([i],o,!1)))};return r.attrs=function(i){return n1(e,t,kr(kr({},n),{attrs:Array.prototype.concat(n.attrs,i).filter(Boolean)}))},r.withConfig=function(i){return n1(e,t,kr(kr({},n),i))},r}var RM=function(e){return n1(zq,e)},z=RM;lM.forEach(function(e){z[e]=RM(e)});var Uq=function(){function e(t,n){this.rules=t,this.componentId=n,this.isStatic=TM(t),Tp.registerId(this.componentId+1)}return e.prototype.createStyles=function(t,n,r,i){var o=i(Cp(Za(this.rules,n,r,i)),""),a=this.componentId+t;r.insertRules(a,a,o)},e.prototype.removeStyles=function(t,n){n.clearRules(this.componentId+t)},e.prototype.renderStyles=function(t,n,r,i){t>2&&Tp.registerId(this.componentId+t),this.removeStyles(t,r),this.createStyles(t,n,r,i)},e}();function Rp(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];var r=fn.apply(void 0,Jl([e],t,!1)),i="sc-global-".concat(Yb(JSON.stringify(r))),o=new Uq(r,i),a=function(c){var d=Mp(),p=er.useContext(xf),h=er.useRef(d.styleSheet.allocateGSInstance(i)).current;return d.styleSheet.server&&u(h,c,d.styleSheet,p,d.stylis),er.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,lq,p,m);else{var v=kr(kr({},d),{theme:sM(d,h,a.defaultProps)});o.renderStyles(c,v,p,m)}}return er.memo(a)}function $M(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];var r=Cp(fn.apply(void 0,Jl([e],t,!1))),i=Yb(r);return new kM(i,r)}const jt={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",USER_INFO:"user_info",IS_FORM_CLOSED_BY_USER:"is_form_closed_by_user"};var $p={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",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:"839766",WAYLAND_DISPLAY:"wayland-0",LOGNAME:"anurag",PULSE_SERVER:"unix:/mnt/wslg/PulseServer",WSL_INTEROP:"/run/WSL/405_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:"a0623060-60a9-4845-abe8-ec6f6135df73",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.11-canary.0",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",GVM_ROOT:"/home/anurag/.gvm",_P9K_TTY:"/dev/pts/0",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"},it;if(typeof window>"u"){var DM={hostname:""};it={crypto:{randomUUID:function(){throw Error("unsupported")}},navigator:{userAgent:"",onLine:!0},document:{createElement:function(){return{}},location:DM,referrer:""},screen:{width:0,height:0},location:DM,addEventListener:function(){},removeEventListener:function(){}}}else it=window;function LM(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 NM(e,t,n,r,i,o,a){try{var u=e[o](a),c=u.value}catch(d){n(d);return}u.done?t(c):Promise.resolve(c).then(r,i)}function r1(e){return function(){var t=this,n=arguments;return new Promise(function(r,i){var o=e.apply(t,n);function a(c){NM(o,r,i,a,u,"next",c)}function u(c){NM(o,r,i,a,u,"throw",c)}a(void 0)})}}function Dp(e,t,n){return BM()?Dp=Reflect.construct:Dp=function(i,o,a){var u=[null];u.push.apply(u,o);var c=Function.bind.apply(i,u),d=new c;return a&&Sf(d,a.prototype),d},Dp.apply(null,arguments)}function jq(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 Dr(e,t,n){return t&&jq(e.prototype,t),e}function rn(){return rn=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},rn.apply(this,arguments)}function i1(e){return i1=Object.setPrototypeOf?Object.getPrototypeOf:function(n){return n.__proto__||Object.getPrototypeOf(n)},i1(e)}function Jr(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&&Sf(e,t)}function Rt(e,t){return t!=null&&typeof Symbol<"u"&&t[Symbol.hasInstance]?!!t[Symbol.hasInstance](e):e instanceof t}function qq(e){return Function.toString.call(e).indexOf("[native code]")!==-1}function wf(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 Sf(e,t){return Sf=Object.setPrototypeOf||function(r,i){return r.__proto__=i,r},Sf(e,t)}function Vt(e){"@swc/helpers - typeof";return e&&typeof Symbol<"u"&&e.constructor===Symbol?"symbol":typeof e}function Hq(e,t){if(e){if(typeof e=="string")return LM(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 LM(e,t)}}function Lp(e){var t=typeof Map=="function"?new Map:void 0;return Lp=function(r){if(r===null||!qq(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 Dp(r,arguments,i1(this).constructor)}return i.prototype=Object.create(r.prototype,{constructor:{value:i,enumerable:!1,writable:!0,configurable:!0}}),Sf(i,r)},Lp(e)}function BM(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(BM=function(){return!!e})()}function dt(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=Hq(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 Cf(e,t){var n,r,i,o,a={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(;a;)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 a.label++,{value:d[1],done:!1};case 5:a.label++,r=d[1],d=[0];continue;case 7:d=a.ops.pop(),a.trys.pop();continue;default:if(i=a.trys,!(i=i.length>0&&i[i.length-1])&&(d[0]===6||d[0]===2)){a=0;continue}if(d[0]===3&&(!i||d[1]>i[0]&&d[1]<i[3])){a.label=d[1];break}if(d[0]===6&&a.label<i[1]){a.label=i[1],i=d;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(d);break}i[2]&&a.ops.pop(),a.trys.pop();continue}d=t.call(e,a)}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 PM(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 Gq=Object.defineProperty,Vq=function(e,t,n){return t in e?Gq(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n},Ke=function(e,t,n){return Vq(e,(typeof t>"u"?"undefined":Vt(t))!=="symbol"?t+"":t,n)},FM,Zq=Object.defineProperty,Yq=function(e,t,n){return t in e?Zq(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n},zM=function(e,t,n){return Yq(e,(typeof t>"u"?"undefined":Vt(t))!=="symbol"?t+"":t,n)},br=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}(br||{}),UM={Node:["childNodes","parentNode","parentElement","textContent"],ShadowRoot:["host","styleSheets"],Element:["shadowRoot","querySelector","querySelectorAll"],MutationObserver:[]},jM={Node:["contains","getRootNode"],ShadowRoot:["getSelection"],Element:[],MutationObserver:["constructor"]},Np={},Wq=function(){return!!globalThis.Zone};function o1(e){if(Np[e])return Np[e];var t=globalThis[e],n=t.prototype,r=e in UM?UM[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 jM?jM[e]:void 0,a=!!(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&&a&&!Wq())return Np[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?Np[e]=d:n}catch{return n}}var a1={};function Ya(e,t,n){var r,i=e+"."+String(n);if(a1[i])return a1[i].call(t);var o=o1(e),a=(r=Object.getOwnPropertyDescriptor(o,n))==null?void 0:r.get;return a?(a1[i]=a,a.call(t)):t[n]}var s1={};function qM(e,t,n){var r=e+"."+String(n);if(s1[r])return s1[r].bind(t);var i=o1(e),o=i[n];return typeof o!="function"?t[n]:(s1[r]=o,o.bind(t))}function Kq(e){return Ya("Node",e,"childNodes")}function Qq(e){return Ya("Node",e,"parentNode")}function Xq(e){return Ya("Node",e,"parentElement")}function Jq(e){return Ya("Node",e,"textContent")}function eH(e,t){return qM("Node",e,"contains")(t)}function tH(e){return qM("Node",e,"getRootNode")()}function nH(e){return!e||!("host"in e)?null:Ya("ShadowRoot",e,"host")}function rH(e){return e.styleSheets}function iH(e){return!e||!("shadowRoot"in e)?null:Ya("Element",e,"shadowRoot")}function oH(e,t){return Ya("Element",e,"querySelector")(t)}function aH(e,t){return Ya("Element",e,"querySelectorAll")(t)}function sH(){return o1("MutationObserver").constructor}var ei={childNodes:Kq,parentNode:Qq,parentElement:Xq,textContent:Jq,contains:eH,getRootNode:tH,host:nH,styleSheets:rH,shadowRoot:iH,querySelector:oH,querySelectorAll:aH,mutationObserver:sH};function HM(e){return e.nodeType===e.ELEMENT_NODE}function kf(e){var t=e&&"host"in e&&"mode"in e&&ei.host(e)||null;return!!(t&&"shadowRoot"in t&&ei.shadowRoot(t)===e)}function Ef(e){return Object.prototype.toString.call(e)==="[object ShadowRoot]"}function lH(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 uH(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 l1(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 GM(i,n)}).join("");return lH(r)}catch{return null}}function GM(e,t){if(fH(e)){var n;try{n=l1(e.styleSheet)||uH(e)}catch{n=e.cssText}return e.styleSheet.href?Bp(n,e.styleSheet.href):n}else{var r=e.cssText;return dH(e)&&e.selectorText.includes(":")&&(r=cH(r)),t?Bp(r,t):r}}function cH(e){var t=/(\[(?:[\w-]+)[^\\])(:(?:[\w-]+)\])/gm;return e.replace(t,"$1\\$2")}function fH(e){return"styleSheet"in e}function dH(e){return"selectorText"in e}var VM=function(){function e(){zM(this,"idNodeMap",new Map),zM(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(a){return i.removeNodeFromMap(a)})},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 a=this.nodeMetaMap.get(o);a&&this.nodeMetaMap.set(i,a)}this.idNodeMap.set(r,i)},t.reset=function(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap},e}();function hH(){return new VM}function u1(e){var t=e.element,n=e.maskInputOptions,r=e.tagName,i=e.type,o=e.value,a=e.maskInputFn,u=o||"",c=i&&nl(i);return(n[r.toLowerCase()]||c&&n[c])&&(a?u=a(u,t):u="*".repeat(u.length)),u}function nl(e){return e.toLowerCase()}var ZM="__rrweb_original__";function pH(e){var t=e.getContext("2d");if(!t)return!0;for(var n=50,r=0;r<e.width;r+=n)for(var i=0;i<e.height;i+=n){var o=t.getImageData,a=ZM in o?o[ZM]:o,u=new Uint32Array(a.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 c1(e){var t=e.type;return e.hasAttribute("data-rr-is-password")?"password":t?nl(t):null}function YM(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 gH(e){var t="";return e.indexOf("//")>-1?t=e.split("/").slice(0,3).join("/"):t=e.split("/")[0],t=t.split("?")[0],t}var mH=/url\((?:(')([^']*)'|(")(.*?)"|([^)]*))\)/gm,vH=/^(?:[a-z+]+:)?\/\//i,yH=/^www\..*/i,_H=/^(data:)([^,]*),(.*)/i;function Bp(e,t){return(e||"").replace(mH,function(n,r,i,o,a,u){var c=i||a||u,d=r||o||"";if(!c)return n;if(vH.test(c)||yH.test(c)||_H.test(c))return"url("+d+c+d+")";if(c[0]==="/")return"url("+d+(gH(t)+c)+d+")";var p=t.split("/"),h=c.split("/");p.pop();for(var m=dt(h),v;!(v=m()).done;){var _=v.value;_!=="."&&(_===".."?p.pop():p.push(_))}return"url("+d+p.join("/")+d+")"})}function f1(e){return e.replace(/(\/\*[^*]*\*\/)|[\s;]/g,"")}function bH(e,t){var n=Array.from(t.childNodes),r=[];if(n.length>1&&e&&typeof e=="string"){for(var i=f1(e),o=1;o<n.length;o++)if(n[o].textContent&&typeof n[o].textContent=="string")for(var a=f1(n[o].textContent),u=3;u<a.length;u++){var c=a.substring(0,u);if(i.split(c).length===2){for(var d=i.indexOf(c),p=d;p<e.length;p++)if(f1(e.substring(0,p)).length===d){r.push(e.substring(0,p)),e=e.substring(p);break}break}}}return r.push(e),r}function xH(e,t){return bH(e,t).join("/* rr_split */")}var wH=1,SH=new RegExp("[^a-z0-9-_:]"),Af=-2;function WM(){return wH++}function CH(e){if(Rt(e,HTMLFormElement))return"form";var t=nl(e.tagName);return SH.test(t)?"div":t}var su,KM,kH=/^[^ \t\n\r\u000c]+/,EH=/^[, \t\n\r\u000c]+/;function AH(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(EH),!(n>=t.length);){var o=r(kH);if(o.slice(-1)===",")o=lu(e,o.substring(0,o.length-1)),i.push(o);else{var a="";o=lu(e,o);for(var u=!1;;){var c=t.charAt(n);if(c===""){i.push((o+a).trim());break}else if(u)c===")"&&(u=!1);else if(c===","){n+=1,i.push((o+a).trim());break}else c==="("&&(u=!0);a+=c,n+=1}}}return i.join(", ")}var QM=new WeakMap;function lu(e,t){return!t||t.trim()===""?t:d1(e,t)}function IH(e){return!!(e.tagName==="svg"||e.ownerSVGElement)}function d1(e,t){var n=QM.get(e);if(n||(n=e.createElement("a"),QM.set(e,n)),!t)t="";else if(t.startsWith("blob:")||t.startsWith("data:"))return t;return n.setAttribute("href",t),n.href}function XM(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")?lu(e,r):n==="srcset"?AH(e,r):n==="style"?Bp(r,d1(e)):t==="object"&&n==="data"?lu(e,r):r)}function JM(e,t,n){return(e==="video"||e==="audio")&&t==="autoplay"}function TH(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 Pp(e,t,n){if(!e)return!1;if(e.nodeType!==e.ELEMENT_NODE)return n?Pp(ei.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?Pp(ei.parentNode(e),t,n):!1}function eO(e,t,n,r){var i;if(HM(e)){if(i=e,!ei.childNodes(i).length)return!1}else{if(ei.parentElement(e)===null)return!1;i=ei.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(Pp(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 MH(e,t,n){var r=e.contentWindow;if(r){var i=!1,o;try{o=r.document.readyState}catch{return}if(o!=="complete"){var a=setTimeout(function(){i||(t(),i=!0)},n);e.addEventListener("load",function(){clearTimeout(a),i=!0,t()});return}var 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 OH(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 RH(e,t){var n=t.doc,r=t.mirror,i=t.blockClass,o=t.blockSelector,a=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,S=t.recordCanvas,x=t.keepIframeSrcFn,b=t.newlyAddedElement,k=b===void 0?!1:b,E=t.cssCaptured,A=E===void 0?!1:E,I=$H(n,r);switch(e.nodeType){case e.DOCUMENT_NODE:return e.compatMode!=="CSS1Compat"?{type:br.Document,childNodes:[],compatMode:e.compatMode}:{type:br.Document,childNodes:[]};case e.DOCUMENT_TYPE_NODE:return{type:br.DocumentType,name:e.name,publicId:e.publicId,systemId:e.systemId,rootId:I};case e.ELEMENT_NODE:return LH(e,{doc:n,blockClass:i,blockSelector:o,inlineStylesheet:u,maskInputOptions:d,maskInputFn:h,dataURLOptions:v,inlineImages:_,recordCanvas:S,keepIframeSrcFn:x,newlyAddedElement:k,rootId:I});case e.TEXT_NODE:return DH(e,{doc:n,needsMask:a,maskTextFn:p,rootId:I,cssCaptured:A});case e.CDATA_SECTION_NODE:return{type:br.CDATA,textContent:"",rootId:I};case e.COMMENT_NODE:return{type:br.Comment,textContent:ei.textContent(e)||"",rootId:I};default:return!1}}function $H(e,t){if(t.hasNode(e)){var n=t.getId(e);return n===1?void 0:n}}function DH(e,t){var n=t.needsMask,r=t.maskTextFn,i=t.rootId,o=t.cssCaptured,a=ei.parentNode(e),u=a&&a.tagName,c="",d=u==="STYLE"?!0:void 0,p=u==="SCRIPT"?!0:void 0;return p?c="SCRIPT_PLACEHOLDER":o||(c=ei.textContent(e),d&&c&&(c=Bp(c,d1(t.doc)))),!d&&!p&&c&&n&&(c=r?r(c,ei.parentElement(e)):c.replace(/[\S]/g,"*")),{type:br.Text,textContent:c||"",rootId:i}}function LH(e,t){for(var n=t.doc,r=t.blockClass,i=t.blockSelector,o=t.inlineStylesheet,a=t.maskInputOptions,u=a===void 0?{}:a,c=t.maskInputFn,d=t.dataURLOptions,p=d===void 0?{}:d,h=t.inlineImages,m=t.recordCanvas,v=t.keepIframeSrcFn,_=t.newlyAddedElement,S=_===void 0?!1:_,x=t.rootId,b=TH(e,r,i),k=CH(e),E={},A=e.attributes.length,I=0;I<A;I++){var $=e.attributes[I];JM(k,$.name,$.value)||(E[$.name]=XM(n,k,nl($.name),$.value))}if(k==="link"&&o){var B=Array.from(n.styleSheets).find(function(we){return we.href===e.href}),U=null;B&&(U=l1(B)),U&&(delete E.rel,delete E.href,E._cssText=U)}if(k==="style"&&e.sheet){var G=l1(e.sheet);G&&(e.childNodes.length>1&&(G=xH(G,e)),E._cssText=G)}if(k==="input"||k==="textarea"||k==="select"){var P=e.value,K=e.checked;E.type!=="radio"&&E.type!=="checkbox"&&E.type!=="submit"&&E.type!=="button"&&P?E.value=u1({element:e,type:c1(e),tagName:k,value:P,maskInputOptions:u,maskInputFn:c}):K&&(E.checked=K)}if(k==="option"&&(e.selected&&!u.select?E.selected=!0:delete E.selected),k==="dialog"&&e.open&&(E.rr_open_mode=e.matches("dialog:modal")?"modal":"non-modal"),k==="canvas"&&m){if(e.__context==="2d")pH(e)||(E.rr_dataURL=e.toDataURL(p.type,p.quality));else if(!("__context"in e)){var re=e.toDataURL(p.type,p.quality),ue=n.createElement("canvas");ue.width=e.width,ue.height=e.height;var Z=ue.toDataURL(p.type,p.quality);re!==Z&&(E.rr_dataURL=re)}}if(k==="img"&&h){su||(su=n.createElement("canvas"),KM=su.getContext("2d"));var ie=e,V=ie.currentSrc||ie.getAttribute("src")||"<unknown-src>",Q=ie.crossOrigin,ve=function(){ie.removeEventListener("load",ve);try{su.width=ie.naturalWidth,su.height=ie.naturalHeight,KM.drawImage(ie,0,0),E.rr_dataURL=su.toDataURL(p.type,p.quality)}catch(we){if(ie.crossOrigin!=="anonymous"){ie.crossOrigin="anonymous",ie.complete&&ie.naturalWidth!==0?ve():ie.addEventListener("load",ve);return}else console.warn("Cannot inline img src="+V+"! Error: "+we)}ie.crossOrigin==="anonymous"&&(Q?E.crossOrigin=Q:ie.removeAttribute("crossorigin"))};ie.complete&&ie.naturalWidth!==0?ve():ie.addEventListener("load",ve)}if(k==="audio"||k==="video"){var Te=E;Te.rr_mediaState=e.paused?"paused":"played",Te.rr_mediaCurrentTime=e.currentTime,Te.rr_mediaPlaybackRate=e.playbackRate,Te.rr_mediaMuted=e.muted,Te.rr_mediaLoop=e.loop,Te.rr_mediaVolume=e.volume}if(S||(e.scrollLeft&&(E.rr_scrollLeft=e.scrollLeft),e.scrollTop&&(E.rr_scrollTop=e.scrollTop)),b){var T=e.getBoundingClientRect(),X=T.width,me=T.height;E={class:E.class,rr_width:""+X+"px",rr_height:""+me+"px"}}k==="iframe"&&!v(E.src)&&(e.contentDocument||(E.rr_src=E.src),delete E.src);var L;try{customElements.get(k)&&(L=!0)}catch{}return{type:br.Element,tagName:k,attributes:E,childNodes:[],isSVG:IH(e)||void 0,needBlock:b,rootId:x,isCustom:L}}function An(e){return e==null?"":e.toLowerCase()}function NH(e,t){if(t.comment&&e.type===br.Comment)return!0;if(e.type===br.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"&&YM(e.attributes.href)==="js"))return!0;if(t.headFavicon&&(e.tagName==="link"&&e.attributes.rel==="shortcut icon"||e.tagName==="meta"&&(An(e.attributes.name).match(/^msapplication-tile(image|color)$/)||An(e.attributes.name)==="application-name"||An(e.attributes.rel)==="icon"||An(e.attributes.rel)==="apple-touch-icon"||An(e.attributes.rel)==="shortcut icon")))return!0;if(e.tagName==="meta"){if(t.headMetaDescKeywords&&An(e.attributes.name).match(/^description|keywords$/))return!0;if(t.headMetaSocial&&(An(e.attributes.property).match(/^(og|twitter|fb):/)||An(e.attributes.name).match(/^(og|twitter):/)||An(e.attributes.name)==="pinterest"))return!0;if(t.headMetaRobots&&(An(e.attributes.name)==="robots"||An(e.attributes.name)==="googlebot"||An(e.attributes.name)==="bingbot"))return!0;if(t.headMetaHttpEquiv&&e.attributes["http-equiv"]!==void 0)return!0;if(t.headMetaAuthorship&&(An(e.attributes.name)==="author"||An(e.attributes.name)==="generator"||An(e.attributes.name)==="framework"||An(e.attributes.name)==="publisher"||An(e.attributes.name)==="progid"||An(e.attributes.property).match(/^article:/)||An(e.attributes.property).match(/^product:/)))return!0;if(t.headMetaVerification&&(An(e.attributes.name)==="google-site-verification"||An(e.attributes.name)==="yandex-verification"||An(e.attributes.name)==="csrf-token"||An(e.attributes.name)==="p:domain_verify"||An(e.attributes.name)==="verify-v1"||An(e.attributes.name)==="verification"||An(e.attributes.name)==="shopify-checkout-api-token"))return!0}}return!1}function uu(e,t){var n=t.doc,r=t.mirror,i=t.blockClass,o=t.blockSelector,a=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,S=t.maskInputFn,x=t.slimDOMOptions,b=t.dataURLOptions,k=b===void 0?{}:b,E=t.inlineImages,A=E===void 0?!1:E,I=t.recordCanvas,$=I===void 0?!1:I,B=t.onSerialize,U=t.onIframeLoad,G=t.iframeLoadTimeout,P=G===void 0?5e3:G,K=t.onStylesheetLoad,re=t.stylesheetLoadTimeout,ue=re===void 0?5e3:re,Z=t.keepIframeSrcFn,ie=Z===void 0?function(){return!1}:Z,V=t.newlyAddedElement,Q=V===void 0?!1:V,ve=t.cssCaptured,Te=ve===void 0?!1:ve,T=t.needsMask,X=t.preserveWhiteSpace,me=X===void 0?!0:X;if(!T){var L=T===void 0;T=eO(e,a,u,L)}var we=RH(e,{doc:n,mirror:r,blockClass:i,blockSelector:o,needsMask:T,inlineStylesheet:h,maskInputOptions:v,maskTextFn:_,maskInputFn:S,dataURLOptions:k,inlineImages:A,recordCanvas:$,keepIframeSrcFn:ie,newlyAddedElement:Q,cssCaptured:Te});if(!we)return console.warn(e,"not serialized"),null;var Ue;r.hasNode(e)?Ue=r.getId(e):NH(we,x)||!me&&we.type===br.Text&&!we.textContent.replace(/^\s+|\s+$/gm,"").length?Ue=Af:Ue=WM();var de=Object.assign(we,{id:Ue});if(r.add(e,de),Ue===Af)return null;B&&B(e);var tt=!d;if(de.type===br.Element){tt=tt&&!de.needBlock,delete de.needBlock;var Ze=ei.shadowRoot(e);Ze&&Ef(Ze)&&(de.isShadowHost=!0)}if((de.type===br.Document||de.type===br.Element)&&tt){x.headWhitespace&&de.type===br.Element&&de.tagName==="head"&&(me=!1);var lt={doc:n,mirror:r,blockClass:i,blockSelector:o,needsMask:T,maskTextClass:a,maskTextSelector:u,skipChild:d,inlineStylesheet:h,maskInputOptions:v,maskTextFn:_,maskInputFn:S,slimDOMOptions:x,dataURLOptions:k,inlineImages:A,recordCanvas:$,preserveWhiteSpace:me,onSerialize:B,onIframeLoad:U,iframeLoadTimeout:P,onStylesheetLoad:K,stylesheetLoadTimeout:ue,keepIframeSrcFn:ie,cssCaptured:!1};if(!(de.type===br.Element&&de.tagName==="textarea"&&de.attributes.value!==void 0)){de.type===br.Element&&de.attributes._cssText!==void 0&&typeof de.attributes._cssText=="string"&&(lt.cssCaptured=!0);for(var gt=dt(Array.from(ei.childNodes(e))),je;!(je=gt()).done;){var Se=je.value,Ye=uu(Se,lt);Ye&&de.childNodes.push(Ye)}}var Qe=null;if(HM(e)&&(Qe=ei.shadowRoot(e)))for(var ot=dt(Array.from(ei.childNodes(Qe))),et;!(et=ot()).done;){var He=et.value,N=uu(He,lt);N&&(Ef(Qe)&&(N.isShadow=!0),de.childNodes.push(N))}}var F=ei.parentNode(e);return F&&kf(F)&&Ef(F)&&(de.isShadow=!0),de.type===br.Element&&de.tagName==="iframe"&&MH(e,function(){var Y=e.contentDocument;if(Y&&U){var ye=uu(Y,{doc:Y,mirror:r,blockClass:i,blockSelector:o,needsMask:T,maskTextClass:a,maskTextSelector:u,skipChild:!1,inlineStylesheet:h,maskInputOptions:v,maskTextFn:_,maskInputFn:S,slimDOMOptions:x,dataURLOptions:k,inlineImages:A,recordCanvas:$,preserveWhiteSpace:me,onSerialize:B,onIframeLoad:U,iframeLoadTimeout:P,onStylesheetLoad:K,stylesheetLoadTimeout:ue,keepIframeSrcFn:ie});ye&&U(e,ye)}},P),de.type===br.Element&&de.tagName==="link"&&typeof de.attributes.rel=="string"&&(de.attributes.rel==="stylesheet"||de.attributes.rel==="preload"&&typeof de.attributes.href=="string"&&YM(de.attributes.href)==="css")&&OH(e,function(){if(K){var Y=uu(e,{doc:n,mirror:r,blockClass:i,blockSelector:o,needsMask:T,maskTextClass:a,maskTextSelector:u,skipChild:!1,inlineStylesheet:h,maskInputOptions:v,maskTextFn:_,maskInputFn:S,slimDOMOptions:x,dataURLOptions:k,inlineImages:A,recordCanvas:$,preserveWhiteSpace:me,onSerialize:B,onIframeLoad:U,iframeLoadTimeout:P,onStylesheetLoad:K,stylesheetLoadTimeout:ue,keepIframeSrcFn:ie});Y&&K(e,Y)}},ue),de}function BH(e,t){var n=t||{},r=n.mirror,i=r===void 0?new VM:r,o=n.blockClass,a=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,S=n.inlineImages,x=S===void 0?!1:S,b=n.recordCanvas,k=b===void 0?!1:b,E=n.maskAllInputs,A=E===void 0?!1:E,I=n.maskTextFn,$=n.maskInputFn,B=n.slimDOM,U=B===void 0?!1:B,G=n.dataURLOptions,P=n.preserveWhiteSpace,K=n.onSerialize,re=n.onIframeLoad,ue=n.iframeLoadTimeout,Z=n.onStylesheetLoad,ie=n.stylesheetLoadTimeout,V=n.keepIframeSrcFn,Q=V===void 0?function(){return!1}:V,ve=A===!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}:A===!1?{password:!0}:A,Te=U===!0||U==="all"?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaDescKeywords:U==="all",headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaAuthorship:!0,headMetaVerification:!0}:U===!1?{}:U;return uu(e,{doc:e,mirror:i,blockClass:a,blockSelector:c,maskTextClass:p,maskTextSelector:m,skipChild:!1,inlineStylesheet:_,maskInputOptions:ve,maskTextFn:I,maskInputFn:$,slimDOMOptions:Te,dataURLOptions:G,inlineImages:x,recordCanvas:k,preserveWhiteSpace:P,onSerialize:K,onIframeLoad:re,iframeLoadTimeout:ue,onStylesheetLoad:Z,stylesheetLoadTimeout:ie,keepIframeSrcFn:Q,newlyAddedElement:!1})}function PH(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function FH(e){if(e.__esModule)return e;var t=e.default;if(typeof t=="function"){var n=function r(){return Rt(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 h1={exports:{}},On=String,tO=function(){return{isColorSupported:!1,reset:On,bold:On,dim:On,italic:On,underline:On,inverse:On,hidden:On,strikethrough:On,black:On,red:On,green:On,yellow:On,blue:On,magenta:On,cyan:On,white:On,gray:On,bgBlack:On,bgRed:On,bgGreen:On,bgYellow:On,bgBlue:On,bgMagenta:On,bgCyan:On,bgWhite:On}};h1.exports=tO(),h1.exports.createColors=tO;var zH=h1.exports,UH={},jH=Object.freeze(Object.defineProperty({__proto__:null,default:UH},Symbol.toStringTag,{value:"Module"})),nr=FH(jH),nO=zH,rO=nr,p1=function(e){Jr(t,e);function t(r,i,o,a,u,c){var d;return d=e.call(this,r)||this,d.name="CssSyntaxError",d.reason=r,u&&(d.file=u),a&&(d.source=a),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 a=this.source;i==null&&(i=nO.isColorSupported),rO&&i&&(a=rO(a));var u=a.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=nO.createColors(!0),_=v.bold,S=v.gray,x=v.red;h=function(b){return _(x(b))},m=function(b){return S(b)}}else h=m=function(b){return b};return u.slice(c,d).map(function(b,k){var E=c+1+k,A=" "+(" "+E).slice(-p)+" | ";if(E===o.line){var I=m(A.replace(/\d/g," "))+b.slice(0,o.column-1).replace(/[^\t]/g," ");return h(">")+m(A)+b+`
|
|
81
|
+
`,xp=typeof window<"u"&&"HTMLElement"in window,sq=!!(typeof SC_DISABLE_SPEEDY=="boolean"?SC_DISABLE_SPEEDY:typeof process<"u"&&Xr!==void 0&&Xr.REACT_APP_SC_DISABLE_SPEEDY!==void 0&&Xr.REACT_APP_SC_DISABLE_SPEEDY!==""?Xr.REACT_APP_SC_DISABLE_SPEEDY!=="false"&&Xr.REACT_APP_SC_DISABLE_SPEEDY:typeof process<"u"&&Xr!==void 0&&Xr.SC_DISABLE_SPEEDY!==void 0&&Xr.SC_DISABLE_SPEEDY!==""?Xr.SC_DISABLE_SPEEDY!=="false"&&Xr.SC_DISABLE_SPEEDY:Xr.NODE_ENV!=="production"),lq={},wp=Object.freeze([]),ou=Object.freeze({});function sM(e,t,n){return n===void 0&&(n=ou),e.theme!==n.theme&&e.theme||t||n.theme}var lM=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"]),uq=/[!"#$%&'()*+,./:;<=>?@[\\\]^`{|}~-]+/g,cq=/(^-|-$)/g;function uM(e){return e.replace(uq,"-").replace(cq,"")}var fq=/(a)(d)/gi,Sp=52,cM=function(e){return String.fromCharCode(e+(e>25?39:97))};function Vb(e){var t,n="";for(t=Math.abs(e);t>Sp;t=t/Sp|0)n=cM(t%Sp)+n;return(cM(t%Sp)+n).replace(fq,"$1-$2")}var Zb,fM=5381,au=function(e,t){for(var n=t.length;n;)e=33*e^t.charCodeAt(--n);return e},dM=function(e){return au(fM,e)};function Yb(e){return Vb(dM(e)>>>0)}function dq(e){return e.displayName||e.name||"Component"}function Wb(e){return typeof e=="string"&&Xr.NODE_ENV==="production"}var hM=typeof Symbol=="function"&&Symbol.for,pM=hM?Symbol.for("react.memo"):60115,hq=hM?Symbol.for("react.forward_ref"):60112,pq={childContextTypes:!0,contextType:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,getDerivedStateFromError:!0,getDerivedStateFromProps:!0,mixins:!0,propTypes:!0,type:!0},gq={name:!0,length:!0,prototype:!0,caller:!0,callee:!0,arguments:!0,arity:!0},gM={$$typeof:!0,compare:!0,defaultProps:!0,displayName:!0,propTypes:!0,type:!0},mq=((Zb={})[hq]={$$typeof:!0,render:!0,defaultProps:!0,displayName:!0,propTypes:!0},Zb[pM]=gM,Zb);function mM(e){return("type"in(t=e)&&t.type.$$typeof)===pM?gM:"$$typeof"in e?mq[e.$$typeof]:pq;var t}var vq=Object.defineProperty,yq=Object.getOwnPropertyNames,vM=Object.getOwnPropertySymbols,_q=Object.getOwnPropertyDescriptor,bq=Object.getPrototypeOf,yM=Object.prototype;function _M(e,t,n){if(typeof t!="string"){if(yM){var r=bq(t);r&&r!==yM&&_M(e,r,n)}var i=yq(t);vM&&(i=i.concat(vM(t)));for(var o=mM(e),a=mM(t),u=0;u<i.length;++u){var c=i[u];if(!(c in gq||n&&n[c]||a&&c in a||o&&c in o)){var d=_q(t,c);try{vq(e,c,d)}catch{}}}}return e}function Js(e){return typeof e=="function"}function Kb(e){return typeof e=="object"&&"styledComponentId"in e}function el(e,t){return e&&t?"".concat(e," ").concat(t):e||t||""}function Cp(e,t){if(e.length===0)return"";for(var n=e[0],r=1;r<e.length;r++)n+=e[r];return n}function bf(e){return e!==null&&typeof e=="object"&&e.constructor.name===Object.name&&!("props"in e&&e.$$typeof)}function Qb(e,t,n){if(n===void 0&&(n=!1),!n&&!bf(e)&&!Array.isArray(e))return t;if(Array.isArray(t))for(var r=0;r<t.length;r++)e[r]=Qb(e[r],t[r]);else if(bf(t))for(var r in t)e[r]=Qb(e[r],t[r]);return e}function Xb(e,t){Object.defineProperty(e,"toString",{value:t})}function tl(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 xq=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 tl(16,"".concat(t));this.groupSizes=new Uint32Array(o),this.groupSizes.set(r),this.length=o;for(var a=i;a<o;a++)this.groupSizes[a]=0}for(var u=this.indexOfGroup(t+1),c=(a=0,n.length);a<c;a++)this.tag.insertRule(u,n[a])&&(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,a=i;a<o;a++)n+="".concat(this.tag.getRule(a)).concat(Gb);return n},e}(),kp=new Map,Ep=new Map,Ap=1,Ip=function(e){if(kp.has(e))return kp.get(e);for(;Ep.has(Ap);)Ap++;var t=Ap++;return kp.set(e,t),Ep.set(t,e),t},wq=function(e,t){Ap=t+1,kp.set(e,t),Ep.set(t,e)},Sq="style[".concat(iu,"][").concat(aM,'="').concat(bp,'"]'),Cq=new RegExp("^".concat(iu,'\\.g(\\d+)\\[id="([\\w\\d-]+)"\\].*?"([^"]*)')),kq=function(e,t,n){for(var r,i=n.split(","),o=0,a=i.length;o<a;o++)(r=i[o])&&e.registerName(t,r)},Eq=function(e,t){for(var n,r=((n=t.textContent)!==null&&n!==void 0?n:"").split(Gb),i=[],o=0,a=r.length;o<a;o++){var u=r[o].trim();if(u){var c=u.match(Cq);if(c){var d=0|parseInt(c[1],10),p=c[2];d!==0&&(wq(p,d),kq(e,p,c[3]),e.getTag().insertRules(d,i)),i.length=0}else i.push(u)}}},bM=function(e){for(var t=document.querySelectorAll(Sq),n=0,r=t.length;n<r;n++){var i=t[n];i&&i.getAttribute(iu)!==oM&&(Eq(e,i),i.parentNode&&i.parentNode.removeChild(i))}};function Aq(){return typeof __webpack_nonce__<"u"?__webpack_nonce__:null}var xM=function(e){var t=document.head,n=e||t,r=document.createElement("style"),i=function(u){var c=Array.from(u.querySelectorAll("style[".concat(iu,"]")));return c[c.length-1]}(n),o=i!==void 0?i.nextSibling:null;r.setAttribute(iu,oM),r.setAttribute(aM,bp);var a=Aq();return a&&r.setAttribute("nonce",a),n.insertBefore(r,o),r},Iq=function(){function e(t){this.element=xM(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 a=r[i];if(a.ownerNode===n)return a}throw tl(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}(),Tq=function(){function e(t){this.element=xM(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}(),Mq=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}(),wM=xp,Oq={isServer:!xp,useCSSOMInjection:!sq},Tp=function(){function e(t,n,r){t===void 0&&(t=ou),n===void 0&&(n={});var i=this;this.options=kr(kr({},Oq),t),this.gs=n,this.names=new Map(r),this.server=!!t.isServer,!this.server&&xp&&wM&&(wM=!1,bM(this)),Xb(this,function(){return function(o){for(var a=o.getTag(),u=a.length,c="",d=function(h){var m=function(b){return Ep.get(b)}(h);if(m===void 0)return"continue";var v=o.names.get(m),_=a.getGroup(h);if(v===void 0||!v.size||_.length===0)return"continue";var S="".concat(iu,".g").concat(h,'[id="').concat(m,'"]'),x="";v!==void 0&&v.forEach(function(b){b.length>0&&(x+="".concat(b,","))}),c+="".concat(_).concat(S,'{content:"').concat(x,'"}').concat(Gb)},p=0;p<u;p++)d(p);return c}(i)})}return e.registerId=function(t){return Ip(t)},e.prototype.rehydrate=function(){!this.server&&xp&&bM(this)},e.prototype.reconstructWithOptions=function(t,n){return n===void 0&&(n=!0),new e(kr(kr({},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 Mq(i):r?new Iq(i):new Tq(i)}(this.options),new xq(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(Ip(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(Ip(t),r)},e.prototype.clearNames=function(t){this.names.has(t)&&this.names.get(t).clear()},e.prototype.clearRules=function(t){this.getTag().clearGroup(Ip(t)),this.clearNames(t)},e.prototype.clearTag=function(){this.tag=void 0},e}(),Rq=/&/g,$q=/^\s*\/\/.*$/gm;function SM(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=SM(n.children,t)),n})}function CM(e){var t,n,r,i=e===void 0?ou:e,o=i.options,a=o===void 0?ou:o,u=i.plugins,c=u===void 0?wp: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===dp&&m.value.includes("&")&&(m.props[0]=m.props[0].replace(Rq,n).replace(r,d))}),a.prefix&&p.push(oq),p.push(nq);var h=function(m,v,_,S){v===void 0&&(v=""),_===void 0&&(_=""),S===void 0&&(S="&"),t=S,n=v,r=new RegExp("\\".concat(n,"\\b"),"g");var x=m.replace($q,""),b=eq(_||v?"".concat(_," ").concat(v," { ").concat(x," }"):x);a.namespace&&(b=SM(b,a.namespace));var k=[];return _p(b,rq(p.concat(iq(function(E){return k.push(E)})))),k};return h.hash=c.length?c.reduce(function(m,v){return v.name||tl(15),au(m,v.name)},fM).toString():"",h}var Dq=new Tp,Jb=CM(),e1=er.createContext({shouldForwardProp:void 0,styleSheet:Dq,stylis:Jb});e1.Consumer;var Lq=er.createContext(void 0);function Mp(){return R.useContext(e1)}function Nq(e){var t=R.useState(e.stylisPlugins),n=t[0],r=t[1],i=Mp().styleSheet,o=R.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]),a=R.useMemo(function(){return CM({options:{namespace:e.namespace,prefix:e.enableVendorPrefixes},plugins:n})},[e.enableVendorPrefixes,e.namespace,n]);R.useEffect(function(){U7(n,e.stylisPlugins)||r(e.stylisPlugins)},[e.stylisPlugins]);var u=R.useMemo(function(){return{shouldForwardProp:e.shouldForwardProp,styleSheet:o,stylis:a}},[e.shouldForwardProp,o,a]);return er.createElement(e1.Provider,{value:u},er.createElement(Lq.Provider,{value:a},e.children))}var kM=function(){function e(t,n){var r=this;this.inject=function(i,o){o===void 0&&(o=Jb);var a=r.name+o.hash;i.hasNameForId(r.id,a)||i.insertRules(r.id,a,o(r.rules,a,"@keyframes"))},this.name=t,this.id="sc-keyframes-".concat(t),this.rules=n,Xb(this,function(){throw tl(12,String(r.name))})}return e.prototype.getName=function(t){return t===void 0&&(t=Jb),this.name+t.hash},e}(),Bq=function(e){return e>="A"&&e<="Z"};function EM(e){for(var t="",n=0;n<e.length;n++){var r=e[n];if(n===1&&r==="-"&&e[0]==="-")return e;Bq(r)?t+="-"+r.toLowerCase():t+=r}return t.startsWith("ms-")?"-"+t:t}var AM=function(e){return e==null||e===!1||e===""},IM=function(e){var t,n,r=[];for(var i in e){var o=e[i];e.hasOwnProperty(i)&&!AM(o)&&(Array.isArray(o)&&o.isCss||Js(o)?r.push("".concat(EM(i),":"),o,";"):bf(o)?r.push.apply(r,Jl(Jl(["".concat(i," {")],IM(o),!1),["}"],!1)):r.push("".concat(EM(i),": ").concat((t=i,(n=o)==null||typeof n=="boolean"||n===""?"":typeof n!="number"||n===0||t in aq||t.startsWith("--")?String(n).trim():"".concat(n,"px")),";")))}return r};function Za(e,t,n,r){if(AM(e))return[];if(Kb(e))return[".".concat(e.styledComponentId)];if(Js(e)){if(!Js(o=e)||o.prototype&&o.prototype.isReactComponent||!t)return[e];var i=e(t);return Za(i,t,n,r)}var o;return e instanceof kM?n?(e.inject(n,r),[e.getName(r)]):[e]:bf(e)?IM(e):Array.isArray(e)?Array.prototype.concat.apply(wp,e.map(function(a){return Za(a,t,n,r)})):[e.toString()]}function TM(e){for(var t=0;t<e.length;t+=1){var n=e[t];if(Js(n)&&!Kb(n))return!1}return!0}var Pq=dM(bp),Fq=function(){function e(t,n,r){this.rules=t,this.staticRulesId="",this.isStatic=(r===void 0||r.isStatic)&&TM(t),this.componentId=n,this.baseHash=au(Pq,n),this.baseStyle=r,Tp.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=el(i,this.staticRulesId);else{var o=Cp(Za(this.rules,t,n,r)),a=Vb(au(this.baseHash,o)>>>0);if(!n.hasNameForId(this.componentId,a)){var u=r(o,".".concat(a),void 0,this.componentId);n.insertRules(this.componentId,a,u)}i=el(i,a),this.staticRulesId=a}else{for(var c=au(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=Cp(Za(h,t,n,r));c=au(c,m+p),d+=m}}if(d){var v=Vb(c>>>0);n.hasNameForId(this.componentId,v)||n.insertRules(this.componentId,v,r(d,".".concat(v),void 0,this.componentId)),i=el(i,v)}}return i},e}(),xf=er.createContext(void 0);xf.Consumer;function Op(e){var t=er.useContext(xf),n=R.useMemo(function(){return function(r,i){if(!r)throw tl(14);if(Js(r)){var o=r(i);return o}if(Array.isArray(r)||typeof r!="object")throw tl(8);return i?kr(kr({},i),r):r}(e.theme,t)},[e.theme,t]);return e.children?er.createElement(xf.Provider,{value:n},e.children):null}var t1={};function zq(e,t,n){var r=Kb(e),i=e,o=!Wb(e),a=t.attrs,u=a===void 0?wp:a,c=t.componentId,d=c===void 0?function(A,I){var $=typeof A!="string"?"sc":uM(A);t1[$]=(t1[$]||0)+1;var B="".concat($,"-").concat(Yb(bp+$+t1[$]));return I?"".concat(I,"-").concat(B):B}(t.displayName,t.parentComponentId):c,p=t.displayName,h=p===void 0?function(A){return Wb(A)?"styled.".concat(A):"Styled(".concat(dq(A),")")}(e):p,m=t.displayName&&t.componentId?"".concat(uM(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 S=i.shouldForwardProp;if(t.shouldForwardProp){var x=t.shouldForwardProp;_=function(A,I){return S(A,I)&&x(A,I)}}else _=S}var b=new Fq(n,m,r?i.componentStyle:void 0);function k(A,I){return function($,B,U){var G=$.attrs,P=$.componentStyle,K=$.defaultProps,re=$.foldedComponentIds,ue=$.styledComponentId,Z=$.target,ie=er.useContext(xf),V=Mp(),Q=$.shouldForwardProp||V.shouldForwardProp,ve=sM(B,ie,K)||ou,Te=function(Ue,de,tt){for(var Ze,lt=kr(kr({},de),{className:void 0,theme:tt}),gt=0;gt<Ue.length;gt+=1){var je=Js(Ze=Ue[gt])?Ze(lt):Ze;for(var Se in je)lt[Se]=Se==="className"?el(lt[Se],je[Se]):Se==="style"?kr(kr({},lt[Se]),je[Se]):je[Se]}return de.className&&(lt.className=el(lt.className,de.className)),lt}(G,B,ve),T=Te.as||Z,X={};for(var me in Te)Te[me]===void 0||me[0]==="$"||me==="as"||me==="theme"&&Te.theme===ve||(me==="forwardedAs"?X.as=Te.forwardedAs:Q&&!Q(me,T)||(X[me]=Te[me],Q||Xr.NODE_ENV));var L=function(Ue,de){var tt=Mp(),Ze=Ue.generateAndInjectStyles(de,tt.styleSheet,tt.stylis);return Ze}(P,Te),we=el(re,ue);return L&&(we+=" "+L),Te.className&&(we+=" "+Te.className),X[Wb(T)&&!lM.has(T)?"class":"className"]=we,U&&(X.ref=U),R.createElement(T,X)}(E,A,I)}k.displayName=h;var E=er.forwardRef(k);return E.attrs=v,E.componentStyle=b,E.displayName=h,E.shouldForwardProp=_,E.foldedComponentIds=r?el(i.foldedComponentIds,i.styledComponentId):"",E.styledComponentId=m,E.target=r?i.target:e,Object.defineProperty(E,"defaultProps",{get:function(){return this._foldedDefaultProps},set:function(A){this._foldedDefaultProps=r?function(I){for(var $=[],B=1;B<arguments.length;B++)$[B-1]=arguments[B];for(var U=0,G=$;U<G.length;U++)Qb(I,G[U],!0);return I}({},i.defaultProps,A):A}}),Xb(E,function(){return".".concat(E.styledComponentId)}),o&&_M(E,e,{attrs:!0,componentStyle:!0,displayName:!0,foldedComponentIds:!0,shouldForwardProp:!0,styledComponentId:!0,target:!0}),E}function MM(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 OM=function(e){return Object.assign(e,{isCss:!0})};function fn(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];if(Js(e)||bf(e))return OM(Za(MM(wp,Jl([e],t,!0))));var r=e;return t.length===0&&r.length===1&&typeof r[0]=="string"?Za(r):OM(Za(MM(r,t)))}function n1(e,t,n){if(n===void 0&&(n=ou),!t)throw tl(1,t);var r=function(i){for(var o=[],a=1;a<arguments.length;a++)o[a-1]=arguments[a];return e(t,n,fn.apply(void 0,Jl([i],o,!1)))};return r.attrs=function(i){return n1(e,t,kr(kr({},n),{attrs:Array.prototype.concat(n.attrs,i).filter(Boolean)}))},r.withConfig=function(i){return n1(e,t,kr(kr({},n),i))},r}var RM=function(e){return n1(zq,e)},z=RM;lM.forEach(function(e){z[e]=RM(e)});var Uq=function(){function e(t,n){this.rules=t,this.componentId=n,this.isStatic=TM(t),Tp.registerId(this.componentId+1)}return e.prototype.createStyles=function(t,n,r,i){var o=i(Cp(Za(this.rules,n,r,i)),""),a=this.componentId+t;r.insertRules(a,a,o)},e.prototype.removeStyles=function(t,n){n.clearRules(this.componentId+t)},e.prototype.renderStyles=function(t,n,r,i){t>2&&Tp.registerId(this.componentId+t),this.removeStyles(t,r),this.createStyles(t,n,r,i)},e}();function Rp(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];var r=fn.apply(void 0,Jl([e],t,!1)),i="sc-global-".concat(Yb(JSON.stringify(r))),o=new Uq(r,i),a=function(c){var d=Mp(),p=er.useContext(xf),h=er.useRef(d.styleSheet.allocateGSInstance(i)).current;return d.styleSheet.server&&u(h,c,d.styleSheet,p,d.stylis),er.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,lq,p,m);else{var v=kr(kr({},d),{theme:sM(d,h,a.defaultProps)});o.renderStyles(c,v,p,m)}}return er.memo(a)}function $M(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];var r=Cp(fn.apply(void 0,Jl([e],t,!1))),i=Yb(r);return new kM(i,r)}const jt={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",USER_INFO:"user_info",IS_FORM_CLOSED_BY_USER:"is_form_closed_by_user"};var $p={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",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:"091577",WAYLAND_DISPLAY:"wayland-0",LOGNAME:"anurag",PULSE_SERVER:"unix:/mnt/wslg/PulseServer",WSL_INTEROP:"/run/WSL/405_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:"a0623060-60a9-4845-abe8-ec6f6135df73",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.11",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",GVM_ROOT:"/home/anurag/.gvm",_P9K_TTY:"/dev/pts/0",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"},it;if(typeof window>"u"){var DM={hostname:""};it={crypto:{randomUUID:function(){throw Error("unsupported")}},navigator:{userAgent:"",onLine:!0},document:{createElement:function(){return{}},location:DM,referrer:""},screen:{width:0,height:0},location:DM,addEventListener:function(){},removeEventListener:function(){}}}else it=window;function LM(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 NM(e,t,n,r,i,o,a){try{var u=e[o](a),c=u.value}catch(d){n(d);return}u.done?t(c):Promise.resolve(c).then(r,i)}function r1(e){return function(){var t=this,n=arguments;return new Promise(function(r,i){var o=e.apply(t,n);function a(c){NM(o,r,i,a,u,"next",c)}function u(c){NM(o,r,i,a,u,"throw",c)}a(void 0)})}}function Dp(e,t,n){return BM()?Dp=Reflect.construct:Dp=function(i,o,a){var u=[null];u.push.apply(u,o);var c=Function.bind.apply(i,u),d=new c;return a&&Sf(d,a.prototype),d},Dp.apply(null,arguments)}function jq(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 Dr(e,t,n){return t&&jq(e.prototype,t),e}function rn(){return rn=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},rn.apply(this,arguments)}function i1(e){return i1=Object.setPrototypeOf?Object.getPrototypeOf:function(n){return n.__proto__||Object.getPrototypeOf(n)},i1(e)}function Jr(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&&Sf(e,t)}function Rt(e,t){return t!=null&&typeof Symbol<"u"&&t[Symbol.hasInstance]?!!t[Symbol.hasInstance](e):e instanceof t}function qq(e){return Function.toString.call(e).indexOf("[native code]")!==-1}function wf(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 Sf(e,t){return Sf=Object.setPrototypeOf||function(r,i){return r.__proto__=i,r},Sf(e,t)}function Vt(e){"@swc/helpers - typeof";return e&&typeof Symbol<"u"&&e.constructor===Symbol?"symbol":typeof e}function Hq(e,t){if(e){if(typeof e=="string")return LM(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 LM(e,t)}}function Lp(e){var t=typeof Map=="function"?new Map:void 0;return Lp=function(r){if(r===null||!qq(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 Dp(r,arguments,i1(this).constructor)}return i.prototype=Object.create(r.prototype,{constructor:{value:i,enumerable:!1,writable:!0,configurable:!0}}),Sf(i,r)},Lp(e)}function BM(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(BM=function(){return!!e})()}function dt(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=Hq(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 Cf(e,t){var n,r,i,o,a={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(;a;)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 a.label++,{value:d[1],done:!1};case 5:a.label++,r=d[1],d=[0];continue;case 7:d=a.ops.pop(),a.trys.pop();continue;default:if(i=a.trys,!(i=i.length>0&&i[i.length-1])&&(d[0]===6||d[0]===2)){a=0;continue}if(d[0]===3&&(!i||d[1]>i[0]&&d[1]<i[3])){a.label=d[1];break}if(d[0]===6&&a.label<i[1]){a.label=i[1],i=d;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(d);break}i[2]&&a.ops.pop(),a.trys.pop();continue}d=t.call(e,a)}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 PM(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 Gq=Object.defineProperty,Vq=function(e,t,n){return t in e?Gq(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n},Ke=function(e,t,n){return Vq(e,(typeof t>"u"?"undefined":Vt(t))!=="symbol"?t+"":t,n)},FM,Zq=Object.defineProperty,Yq=function(e,t,n){return t in e?Zq(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n},zM=function(e,t,n){return Yq(e,(typeof t>"u"?"undefined":Vt(t))!=="symbol"?t+"":t,n)},br=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}(br||{}),UM={Node:["childNodes","parentNode","parentElement","textContent"],ShadowRoot:["host","styleSheets"],Element:["shadowRoot","querySelector","querySelectorAll"],MutationObserver:[]},jM={Node:["contains","getRootNode"],ShadowRoot:["getSelection"],Element:[],MutationObserver:["constructor"]},Np={},Wq=function(){return!!globalThis.Zone};function o1(e){if(Np[e])return Np[e];var t=globalThis[e],n=t.prototype,r=e in UM?UM[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 jM?jM[e]:void 0,a=!!(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&&a&&!Wq())return Np[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?Np[e]=d:n}catch{return n}}var a1={};function Ya(e,t,n){var r,i=e+"."+String(n);if(a1[i])return a1[i].call(t);var o=o1(e),a=(r=Object.getOwnPropertyDescriptor(o,n))==null?void 0:r.get;return a?(a1[i]=a,a.call(t)):t[n]}var s1={};function qM(e,t,n){var r=e+"."+String(n);if(s1[r])return s1[r].bind(t);var i=o1(e),o=i[n];return typeof o!="function"?t[n]:(s1[r]=o,o.bind(t))}function Kq(e){return Ya("Node",e,"childNodes")}function Qq(e){return Ya("Node",e,"parentNode")}function Xq(e){return Ya("Node",e,"parentElement")}function Jq(e){return Ya("Node",e,"textContent")}function eH(e,t){return qM("Node",e,"contains")(t)}function tH(e){return qM("Node",e,"getRootNode")()}function nH(e){return!e||!("host"in e)?null:Ya("ShadowRoot",e,"host")}function rH(e){return e.styleSheets}function iH(e){return!e||!("shadowRoot"in e)?null:Ya("Element",e,"shadowRoot")}function oH(e,t){return Ya("Element",e,"querySelector")(t)}function aH(e,t){return Ya("Element",e,"querySelectorAll")(t)}function sH(){return o1("MutationObserver").constructor}var ei={childNodes:Kq,parentNode:Qq,parentElement:Xq,textContent:Jq,contains:eH,getRootNode:tH,host:nH,styleSheets:rH,shadowRoot:iH,querySelector:oH,querySelectorAll:aH,mutationObserver:sH};function HM(e){return e.nodeType===e.ELEMENT_NODE}function kf(e){var t=e&&"host"in e&&"mode"in e&&ei.host(e)||null;return!!(t&&"shadowRoot"in t&&ei.shadowRoot(t)===e)}function Ef(e){return Object.prototype.toString.call(e)==="[object ShadowRoot]"}function lH(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 uH(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 l1(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 GM(i,n)}).join("");return lH(r)}catch{return null}}function GM(e,t){if(fH(e)){var n;try{n=l1(e.styleSheet)||uH(e)}catch{n=e.cssText}return e.styleSheet.href?Bp(n,e.styleSheet.href):n}else{var r=e.cssText;return dH(e)&&e.selectorText.includes(":")&&(r=cH(r)),t?Bp(r,t):r}}function cH(e){var t=/(\[(?:[\w-]+)[^\\])(:(?:[\w-]+)\])/gm;return e.replace(t,"$1\\$2")}function fH(e){return"styleSheet"in e}function dH(e){return"selectorText"in e}var VM=function(){function e(){zM(this,"idNodeMap",new Map),zM(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(a){return i.removeNodeFromMap(a)})},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 a=this.nodeMetaMap.get(o);a&&this.nodeMetaMap.set(i,a)}this.idNodeMap.set(r,i)},t.reset=function(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap},e}();function hH(){return new VM}function u1(e){var t=e.element,n=e.maskInputOptions,r=e.tagName,i=e.type,o=e.value,a=e.maskInputFn,u=o||"",c=i&&nl(i);return(n[r.toLowerCase()]||c&&n[c])&&(a?u=a(u,t):u="*".repeat(u.length)),u}function nl(e){return e.toLowerCase()}var ZM="__rrweb_original__";function pH(e){var t=e.getContext("2d");if(!t)return!0;for(var n=50,r=0;r<e.width;r+=n)for(var i=0;i<e.height;i+=n){var o=t.getImageData,a=ZM in o?o[ZM]:o,u=new Uint32Array(a.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 c1(e){var t=e.type;return e.hasAttribute("data-rr-is-password")?"password":t?nl(t):null}function YM(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 gH(e){var t="";return e.indexOf("//")>-1?t=e.split("/").slice(0,3).join("/"):t=e.split("/")[0],t=t.split("?")[0],t}var mH=/url\((?:(')([^']*)'|(")(.*?)"|([^)]*))\)/gm,vH=/^(?:[a-z+]+:)?\/\//i,yH=/^www\..*/i,_H=/^(data:)([^,]*),(.*)/i;function Bp(e,t){return(e||"").replace(mH,function(n,r,i,o,a,u){var c=i||a||u,d=r||o||"";if(!c)return n;if(vH.test(c)||yH.test(c)||_H.test(c))return"url("+d+c+d+")";if(c[0]==="/")return"url("+d+(gH(t)+c)+d+")";var p=t.split("/"),h=c.split("/");p.pop();for(var m=dt(h),v;!(v=m()).done;){var _=v.value;_!=="."&&(_===".."?p.pop():p.push(_))}return"url("+d+p.join("/")+d+")"})}function f1(e){return e.replace(/(\/\*[^*]*\*\/)|[\s;]/g,"")}function bH(e,t){var n=Array.from(t.childNodes),r=[];if(n.length>1&&e&&typeof e=="string"){for(var i=f1(e),o=1;o<n.length;o++)if(n[o].textContent&&typeof n[o].textContent=="string")for(var a=f1(n[o].textContent),u=3;u<a.length;u++){var c=a.substring(0,u);if(i.split(c).length===2){for(var d=i.indexOf(c),p=d;p<e.length;p++)if(f1(e.substring(0,p)).length===d){r.push(e.substring(0,p)),e=e.substring(p);break}break}}}return r.push(e),r}function xH(e,t){return bH(e,t).join("/* rr_split */")}var wH=1,SH=new RegExp("[^a-z0-9-_:]"),Af=-2;function WM(){return wH++}function CH(e){if(Rt(e,HTMLFormElement))return"form";var t=nl(e.tagName);return SH.test(t)?"div":t}var su,KM,kH=/^[^ \t\n\r\u000c]+/,EH=/^[, \t\n\r\u000c]+/;function AH(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(EH),!(n>=t.length);){var o=r(kH);if(o.slice(-1)===",")o=lu(e,o.substring(0,o.length-1)),i.push(o);else{var a="";o=lu(e,o);for(var u=!1;;){var c=t.charAt(n);if(c===""){i.push((o+a).trim());break}else if(u)c===")"&&(u=!1);else if(c===","){n+=1,i.push((o+a).trim());break}else c==="("&&(u=!0);a+=c,n+=1}}}return i.join(", ")}var QM=new WeakMap;function lu(e,t){return!t||t.trim()===""?t:d1(e,t)}function IH(e){return!!(e.tagName==="svg"||e.ownerSVGElement)}function d1(e,t){var n=QM.get(e);if(n||(n=e.createElement("a"),QM.set(e,n)),!t)t="";else if(t.startsWith("blob:")||t.startsWith("data:"))return t;return n.setAttribute("href",t),n.href}function XM(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")?lu(e,r):n==="srcset"?AH(e,r):n==="style"?Bp(r,d1(e)):t==="object"&&n==="data"?lu(e,r):r)}function JM(e,t,n){return(e==="video"||e==="audio")&&t==="autoplay"}function TH(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 Pp(e,t,n){if(!e)return!1;if(e.nodeType!==e.ELEMENT_NODE)return n?Pp(ei.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?Pp(ei.parentNode(e),t,n):!1}function eO(e,t,n,r){var i;if(HM(e)){if(i=e,!ei.childNodes(i).length)return!1}else{if(ei.parentElement(e)===null)return!1;i=ei.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(Pp(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 MH(e,t,n){var r=e.contentWindow;if(r){var i=!1,o;try{o=r.document.readyState}catch{return}if(o!=="complete"){var a=setTimeout(function(){i||(t(),i=!0)},n);e.addEventListener("load",function(){clearTimeout(a),i=!0,t()});return}var 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 OH(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 RH(e,t){var n=t.doc,r=t.mirror,i=t.blockClass,o=t.blockSelector,a=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,S=t.recordCanvas,x=t.keepIframeSrcFn,b=t.newlyAddedElement,k=b===void 0?!1:b,E=t.cssCaptured,A=E===void 0?!1:E,I=$H(n,r);switch(e.nodeType){case e.DOCUMENT_NODE:return e.compatMode!=="CSS1Compat"?{type:br.Document,childNodes:[],compatMode:e.compatMode}:{type:br.Document,childNodes:[]};case e.DOCUMENT_TYPE_NODE:return{type:br.DocumentType,name:e.name,publicId:e.publicId,systemId:e.systemId,rootId:I};case e.ELEMENT_NODE:return LH(e,{doc:n,blockClass:i,blockSelector:o,inlineStylesheet:u,maskInputOptions:d,maskInputFn:h,dataURLOptions:v,inlineImages:_,recordCanvas:S,keepIframeSrcFn:x,newlyAddedElement:k,rootId:I});case e.TEXT_NODE:return DH(e,{doc:n,needsMask:a,maskTextFn:p,rootId:I,cssCaptured:A});case e.CDATA_SECTION_NODE:return{type:br.CDATA,textContent:"",rootId:I};case e.COMMENT_NODE:return{type:br.Comment,textContent:ei.textContent(e)||"",rootId:I};default:return!1}}function $H(e,t){if(t.hasNode(e)){var n=t.getId(e);return n===1?void 0:n}}function DH(e,t){var n=t.needsMask,r=t.maskTextFn,i=t.rootId,o=t.cssCaptured,a=ei.parentNode(e),u=a&&a.tagName,c="",d=u==="STYLE"?!0:void 0,p=u==="SCRIPT"?!0:void 0;return p?c="SCRIPT_PLACEHOLDER":o||(c=ei.textContent(e),d&&c&&(c=Bp(c,d1(t.doc)))),!d&&!p&&c&&n&&(c=r?r(c,ei.parentElement(e)):c.replace(/[\S]/g,"*")),{type:br.Text,textContent:c||"",rootId:i}}function LH(e,t){for(var n=t.doc,r=t.blockClass,i=t.blockSelector,o=t.inlineStylesheet,a=t.maskInputOptions,u=a===void 0?{}:a,c=t.maskInputFn,d=t.dataURLOptions,p=d===void 0?{}:d,h=t.inlineImages,m=t.recordCanvas,v=t.keepIframeSrcFn,_=t.newlyAddedElement,S=_===void 0?!1:_,x=t.rootId,b=TH(e,r,i),k=CH(e),E={},A=e.attributes.length,I=0;I<A;I++){var $=e.attributes[I];JM(k,$.name,$.value)||(E[$.name]=XM(n,k,nl($.name),$.value))}if(k==="link"&&o){var B=Array.from(n.styleSheets).find(function(we){return we.href===e.href}),U=null;B&&(U=l1(B)),U&&(delete E.rel,delete E.href,E._cssText=U)}if(k==="style"&&e.sheet){var G=l1(e.sheet);G&&(e.childNodes.length>1&&(G=xH(G,e)),E._cssText=G)}if(k==="input"||k==="textarea"||k==="select"){var P=e.value,K=e.checked;E.type!=="radio"&&E.type!=="checkbox"&&E.type!=="submit"&&E.type!=="button"&&P?E.value=u1({element:e,type:c1(e),tagName:k,value:P,maskInputOptions:u,maskInputFn:c}):K&&(E.checked=K)}if(k==="option"&&(e.selected&&!u.select?E.selected=!0:delete E.selected),k==="dialog"&&e.open&&(E.rr_open_mode=e.matches("dialog:modal")?"modal":"non-modal"),k==="canvas"&&m){if(e.__context==="2d")pH(e)||(E.rr_dataURL=e.toDataURL(p.type,p.quality));else if(!("__context"in e)){var re=e.toDataURL(p.type,p.quality),ue=n.createElement("canvas");ue.width=e.width,ue.height=e.height;var Z=ue.toDataURL(p.type,p.quality);re!==Z&&(E.rr_dataURL=re)}}if(k==="img"&&h){su||(su=n.createElement("canvas"),KM=su.getContext("2d"));var ie=e,V=ie.currentSrc||ie.getAttribute("src")||"<unknown-src>",Q=ie.crossOrigin,ve=function(){ie.removeEventListener("load",ve);try{su.width=ie.naturalWidth,su.height=ie.naturalHeight,KM.drawImage(ie,0,0),E.rr_dataURL=su.toDataURL(p.type,p.quality)}catch(we){if(ie.crossOrigin!=="anonymous"){ie.crossOrigin="anonymous",ie.complete&&ie.naturalWidth!==0?ve():ie.addEventListener("load",ve);return}else console.warn("Cannot inline img src="+V+"! Error: "+we)}ie.crossOrigin==="anonymous"&&(Q?E.crossOrigin=Q:ie.removeAttribute("crossorigin"))};ie.complete&&ie.naturalWidth!==0?ve():ie.addEventListener("load",ve)}if(k==="audio"||k==="video"){var Te=E;Te.rr_mediaState=e.paused?"paused":"played",Te.rr_mediaCurrentTime=e.currentTime,Te.rr_mediaPlaybackRate=e.playbackRate,Te.rr_mediaMuted=e.muted,Te.rr_mediaLoop=e.loop,Te.rr_mediaVolume=e.volume}if(S||(e.scrollLeft&&(E.rr_scrollLeft=e.scrollLeft),e.scrollTop&&(E.rr_scrollTop=e.scrollTop)),b){var T=e.getBoundingClientRect(),X=T.width,me=T.height;E={class:E.class,rr_width:""+X+"px",rr_height:""+me+"px"}}k==="iframe"&&!v(E.src)&&(e.contentDocument||(E.rr_src=E.src),delete E.src);var L;try{customElements.get(k)&&(L=!0)}catch{}return{type:br.Element,tagName:k,attributes:E,childNodes:[],isSVG:IH(e)||void 0,needBlock:b,rootId:x,isCustom:L}}function An(e){return e==null?"":e.toLowerCase()}function NH(e,t){if(t.comment&&e.type===br.Comment)return!0;if(e.type===br.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"&&YM(e.attributes.href)==="js"))return!0;if(t.headFavicon&&(e.tagName==="link"&&e.attributes.rel==="shortcut icon"||e.tagName==="meta"&&(An(e.attributes.name).match(/^msapplication-tile(image|color)$/)||An(e.attributes.name)==="application-name"||An(e.attributes.rel)==="icon"||An(e.attributes.rel)==="apple-touch-icon"||An(e.attributes.rel)==="shortcut icon")))return!0;if(e.tagName==="meta"){if(t.headMetaDescKeywords&&An(e.attributes.name).match(/^description|keywords$/))return!0;if(t.headMetaSocial&&(An(e.attributes.property).match(/^(og|twitter|fb):/)||An(e.attributes.name).match(/^(og|twitter):/)||An(e.attributes.name)==="pinterest"))return!0;if(t.headMetaRobots&&(An(e.attributes.name)==="robots"||An(e.attributes.name)==="googlebot"||An(e.attributes.name)==="bingbot"))return!0;if(t.headMetaHttpEquiv&&e.attributes["http-equiv"]!==void 0)return!0;if(t.headMetaAuthorship&&(An(e.attributes.name)==="author"||An(e.attributes.name)==="generator"||An(e.attributes.name)==="framework"||An(e.attributes.name)==="publisher"||An(e.attributes.name)==="progid"||An(e.attributes.property).match(/^article:/)||An(e.attributes.property).match(/^product:/)))return!0;if(t.headMetaVerification&&(An(e.attributes.name)==="google-site-verification"||An(e.attributes.name)==="yandex-verification"||An(e.attributes.name)==="csrf-token"||An(e.attributes.name)==="p:domain_verify"||An(e.attributes.name)==="verify-v1"||An(e.attributes.name)==="verification"||An(e.attributes.name)==="shopify-checkout-api-token"))return!0}}return!1}function uu(e,t){var n=t.doc,r=t.mirror,i=t.blockClass,o=t.blockSelector,a=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,S=t.maskInputFn,x=t.slimDOMOptions,b=t.dataURLOptions,k=b===void 0?{}:b,E=t.inlineImages,A=E===void 0?!1:E,I=t.recordCanvas,$=I===void 0?!1:I,B=t.onSerialize,U=t.onIframeLoad,G=t.iframeLoadTimeout,P=G===void 0?5e3:G,K=t.onStylesheetLoad,re=t.stylesheetLoadTimeout,ue=re===void 0?5e3:re,Z=t.keepIframeSrcFn,ie=Z===void 0?function(){return!1}:Z,V=t.newlyAddedElement,Q=V===void 0?!1:V,ve=t.cssCaptured,Te=ve===void 0?!1:ve,T=t.needsMask,X=t.preserveWhiteSpace,me=X===void 0?!0:X;if(!T){var L=T===void 0;T=eO(e,a,u,L)}var we=RH(e,{doc:n,mirror:r,blockClass:i,blockSelector:o,needsMask:T,inlineStylesheet:h,maskInputOptions:v,maskTextFn:_,maskInputFn:S,dataURLOptions:k,inlineImages:A,recordCanvas:$,keepIframeSrcFn:ie,newlyAddedElement:Q,cssCaptured:Te});if(!we)return console.warn(e,"not serialized"),null;var Ue;r.hasNode(e)?Ue=r.getId(e):NH(we,x)||!me&&we.type===br.Text&&!we.textContent.replace(/^\s+|\s+$/gm,"").length?Ue=Af:Ue=WM();var de=Object.assign(we,{id:Ue});if(r.add(e,de),Ue===Af)return null;B&&B(e);var tt=!d;if(de.type===br.Element){tt=tt&&!de.needBlock,delete de.needBlock;var Ze=ei.shadowRoot(e);Ze&&Ef(Ze)&&(de.isShadowHost=!0)}if((de.type===br.Document||de.type===br.Element)&&tt){x.headWhitespace&&de.type===br.Element&&de.tagName==="head"&&(me=!1);var lt={doc:n,mirror:r,blockClass:i,blockSelector:o,needsMask:T,maskTextClass:a,maskTextSelector:u,skipChild:d,inlineStylesheet:h,maskInputOptions:v,maskTextFn:_,maskInputFn:S,slimDOMOptions:x,dataURLOptions:k,inlineImages:A,recordCanvas:$,preserveWhiteSpace:me,onSerialize:B,onIframeLoad:U,iframeLoadTimeout:P,onStylesheetLoad:K,stylesheetLoadTimeout:ue,keepIframeSrcFn:ie,cssCaptured:!1};if(!(de.type===br.Element&&de.tagName==="textarea"&&de.attributes.value!==void 0)){de.type===br.Element&&de.attributes._cssText!==void 0&&typeof de.attributes._cssText=="string"&&(lt.cssCaptured=!0);for(var gt=dt(Array.from(ei.childNodes(e))),je;!(je=gt()).done;){var Se=je.value,Ye=uu(Se,lt);Ye&&de.childNodes.push(Ye)}}var Qe=null;if(HM(e)&&(Qe=ei.shadowRoot(e)))for(var ot=dt(Array.from(ei.childNodes(Qe))),et;!(et=ot()).done;){var He=et.value,N=uu(He,lt);N&&(Ef(Qe)&&(N.isShadow=!0),de.childNodes.push(N))}}var F=ei.parentNode(e);return F&&kf(F)&&Ef(F)&&(de.isShadow=!0),de.type===br.Element&&de.tagName==="iframe"&&MH(e,function(){var Y=e.contentDocument;if(Y&&U){var ye=uu(Y,{doc:Y,mirror:r,blockClass:i,blockSelector:o,needsMask:T,maskTextClass:a,maskTextSelector:u,skipChild:!1,inlineStylesheet:h,maskInputOptions:v,maskTextFn:_,maskInputFn:S,slimDOMOptions:x,dataURLOptions:k,inlineImages:A,recordCanvas:$,preserveWhiteSpace:me,onSerialize:B,onIframeLoad:U,iframeLoadTimeout:P,onStylesheetLoad:K,stylesheetLoadTimeout:ue,keepIframeSrcFn:ie});ye&&U(e,ye)}},P),de.type===br.Element&&de.tagName==="link"&&typeof de.attributes.rel=="string"&&(de.attributes.rel==="stylesheet"||de.attributes.rel==="preload"&&typeof de.attributes.href=="string"&&YM(de.attributes.href)==="css")&&OH(e,function(){if(K){var Y=uu(e,{doc:n,mirror:r,blockClass:i,blockSelector:o,needsMask:T,maskTextClass:a,maskTextSelector:u,skipChild:!1,inlineStylesheet:h,maskInputOptions:v,maskTextFn:_,maskInputFn:S,slimDOMOptions:x,dataURLOptions:k,inlineImages:A,recordCanvas:$,preserveWhiteSpace:me,onSerialize:B,onIframeLoad:U,iframeLoadTimeout:P,onStylesheetLoad:K,stylesheetLoadTimeout:ue,keepIframeSrcFn:ie});Y&&K(e,Y)}},ue),de}function BH(e,t){var n=t||{},r=n.mirror,i=r===void 0?new VM:r,o=n.blockClass,a=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,S=n.inlineImages,x=S===void 0?!1:S,b=n.recordCanvas,k=b===void 0?!1:b,E=n.maskAllInputs,A=E===void 0?!1:E,I=n.maskTextFn,$=n.maskInputFn,B=n.slimDOM,U=B===void 0?!1:B,G=n.dataURLOptions,P=n.preserveWhiteSpace,K=n.onSerialize,re=n.onIframeLoad,ue=n.iframeLoadTimeout,Z=n.onStylesheetLoad,ie=n.stylesheetLoadTimeout,V=n.keepIframeSrcFn,Q=V===void 0?function(){return!1}:V,ve=A===!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}:A===!1?{password:!0}:A,Te=U===!0||U==="all"?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaDescKeywords:U==="all",headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaAuthorship:!0,headMetaVerification:!0}:U===!1?{}:U;return uu(e,{doc:e,mirror:i,blockClass:a,blockSelector:c,maskTextClass:p,maskTextSelector:m,skipChild:!1,inlineStylesheet:_,maskInputOptions:ve,maskTextFn:I,maskInputFn:$,slimDOMOptions:Te,dataURLOptions:G,inlineImages:x,recordCanvas:k,preserveWhiteSpace:P,onSerialize:K,onIframeLoad:re,iframeLoadTimeout:ue,onStylesheetLoad:Z,stylesheetLoadTimeout:ie,keepIframeSrcFn:Q,newlyAddedElement:!1})}function PH(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function FH(e){if(e.__esModule)return e;var t=e.default;if(typeof t=="function"){var n=function r(){return Rt(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 h1={exports:{}},On=String,tO=function(){return{isColorSupported:!1,reset:On,bold:On,dim:On,italic:On,underline:On,inverse:On,hidden:On,strikethrough:On,black:On,red:On,green:On,yellow:On,blue:On,magenta:On,cyan:On,white:On,gray:On,bgBlack:On,bgRed:On,bgGreen:On,bgYellow:On,bgBlue:On,bgMagenta:On,bgCyan:On,bgWhite:On}};h1.exports=tO(),h1.exports.createColors=tO;var zH=h1.exports,UH={},jH=Object.freeze(Object.defineProperty({__proto__:null,default:UH},Symbol.toStringTag,{value:"Module"})),nr=FH(jH),nO=zH,rO=nr,p1=function(e){Jr(t,e);function t(r,i,o,a,u,c){var d;return d=e.call(this,r)||this,d.name="CssSyntaxError",d.reason=r,u&&(d.file=u),a&&(d.source=a),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 a=this.source;i==null&&(i=nO.isColorSupported),rO&&i&&(a=rO(a));var u=a.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=nO.createColors(!0),_=v.bold,S=v.gray,x=v.red;h=function(b){return _(x(b))},m=function(b){return S(b)}}else h=m=function(b){return b};return u.slice(c,d).map(function(b,k){var E=c+1+k,A=" "+(" "+E).slice(-p)+" | ";if(E===o.line){var I=m(A.replace(/\d/g," "))+b.slice(0,o.column-1).replace(/[^\t]/g," ");return h(">")+m(A)+b+`
|
|
82
82
|
`+I+h("^")}return" "+m(A)+b}).join(`
|
|
83
83
|
`)},n.toString=function(){var i=this.showSourceCode();return i&&(i=`
|
|
84
84
|
|
|
@@ -136,7 +136,7 @@ or you can use record.mirror to access the mirror instance during recording.`,WR
|
|
|
136
136
|
`+m+"]":"["+v.join(",")+"]",a=m,p}for(d in _)Bg.call(_,d)&&(p=r(d,_),p&&v.push(n(d)+(a?": ":":")+p));return p=v.length===0?"{}":a?"{"+v.join(",")+m+"}":"{"+v.join(",")+"}",a=m,p}};return r("",{"":t})}}(),O.JSONDecode=function(){var e,t,n={'"':'"',"\\":"\\","/":"/",b:"\b",f:"\f",n:`
|
|
137
137
|
`,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},a=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,_,S="",x;if(t==='"')for(;o();){if(t==='"')return o(),S;if(t==="\\")if(o(),t==="u"){for(x=0,_=0;_<4&&(v=parseInt(o(),16),!!isFinite(v));_+=1)x=x*16+v;S+=String.fromCharCode(x)}else if(typeof n[t]=="string")S+=n[t];else break;else S+=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 a();default:return t>="0"&&t<="9"?a():d()}},function(v){var _;return r=v,e=0,t=" ",_=p(),c(),t&&i("Syntax error"),_}}(),O.base64Encode=function(e){var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",n,r,i,o,a,u,c,d,p=0,h=0,m="",v=[];if(!e)return e;e=O.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,a=d>>12&63,u=d>>6&63,c=d&63,v[h++]=t.charAt(o)+t.charAt(a)+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},O.utf8Encode=function(e){e=(e+"").replace(/\r\n/g,`
|
|
138
138
|
`).replace(/\r/g,`
|
|
139
|
-
`);var t="",n,r,i=0,o;for(n=r=0,i=e.length,o=0;o<i;o++){var a=e.charCodeAt(o),u=null;a<128?r++:a>127&&a<2048?u=String.fromCharCode(a>>6|192,a&63|128):u=String.fromCharCode(a>>12|224,a>>6&63|128,a&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},O.UUID=function(){try{return it.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]="-",O.map(e,function(r){return r.toString(16)}).join("")}};var B$=["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"];O.isBlockedUA=function(e){var t;for(e=e.toLowerCase(),t=0;t<B$.length;t++)if(e.indexOf(B$[t])!==-1)return!0;return!1},O.HTTPBuildQuery=function(e,t){var n,r,i=[];return O.isUndefined(t)&&(t="&"),O.each(e,function(o,a){n=encodeURIComponent(o.toString()),r=encodeURIComponent(a),i[i.length]=r+"="+n}),i.join(t)},O.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{on.error("Skipping decoding for malformed query param: "+o)}return o.replace(/\+/g," ")},O.cookie={get:function(e){for(var t=e+"=",n=dn.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=O.JSONDecode(O.cookie.get(e))||{}}catch{}return t},set_seconds:function(e,t,n,r,i,o,a){var u="",c="",d="";if(a)u="; domain="+a;else if(r){var p=z$(dn.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"),dn.cookie=e+"="+encodeURIComponent(t)+c+"; path=/"+u+d},set:function(e,t,n,r,i,o,a){var u="",c="",d="";if(a)u="; domain="+a;else if(r){var p=z$(dn.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 dn.cookie=m,m},remove:function(e,t,n){O.cookie.set(e,"",-1,t,!1,!1,n)}};var P$=function(e){var t=!0;try{var n="__mplss_"+Nx(8),r="xyz";e.setItem(n,r),e.getItem(n)!==r&&(t=!1),e.removeItem(n)}catch{t=!1}return t},Dx=null,Yf=function(e,t){return Dx!==null&&!t?Dx:Dx=P$(e||it.localStorage)},Lx=null,yW=function(e,t){return Lx!==null&&!t?Lx:Lx=P$(e||it.sessionStorage)};function F$(e,t,n){var r=function(i){on.error(t+" error: "+i)};return{is_supported:function(i){var o=n(e,i);return o||on.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 O.JSONDecode(e.getItem(i))||{}}catch{}return null},set:function(i,o){try{e.setItem(i,o)}catch(a){r(a)}},remove:function(i){try{e.removeItem(i)}catch(o){r(o)}}}}O.localStorage=F$(it.localStorage,"localStorage",Yf),O.sessionStorage=F$(it.sessionStorage,"sessionStorage",yW),O.register_event=function(){var e=function(r,i,o,a,u){if(!r){on.error("No valid element provided to register_event");return}if(r.addEventListener&&!a)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 a=function(u){if(u=u||n(it.event),!!u){var c=!0,d,p;return O.isFunction(o)&&(d=o(u)),p=i.call(r,u),(d===!1||p===!1)&&(c=!1),c}};return a}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 _W=new RegExp('^(\\w*)\\[(\\w+)([=~\\|\\^\\$\\*]?)=?"?([^\\]"]*)"?\\]$');O.dom_query=function(){function e(i){return i.all?i.all:i.getElementsByTagName("*")}var t=/[\t\r\n]/g;function n(i,o){var a=" "+o+" ";return(" "+i.className+" ").replace(t," ").indexOf(a)>=0}function r(i){if(!dn.getElementsByTagName)return[];var o=i.split(" "),a,u,c,d,p,h,m,v,_,S,x=[dn];for(h=0;h<o.length;h++){if(a=o[h].replace(/^\s+/,"").replace(/\s+$/,""),a.indexOf("#")>-1){u=a.split("#"),c=u[0];var b=u[1],k=dn.getElementById(b);if(!k||c&&k.nodeName.toLowerCase()!=c)return[];x=[k];continue}if(a.indexOf(".")>-1){u=a.split("."),c=u[0];var E=u[1];for(c||(c="*"),d=[],p=0,m=0;m<x.length;m++)for(c=="*"?_=e(x[m]):_=x[m].getElementsByTagName(c),v=0;v<_.length;v++)d[p++]=_[v];for(x=[],S=0,m=0;m<d.length;m++)d[m].className&&O.isString(d[m].className)&&n(d[m],E)&&(x[S++]=d[m]);continue}var A=a.match(_W);if(A){c=A[1];var I=A[2],$=A[3],B=A[4];for(c||(c="*"),d=[],p=0,m=0;m<x.length;m++)for(c=="*"?_=e(x[m]):_=x[m].getElementsByTagName(c),v=0;v<_.length;v++)d[p++]=_[v];x=[],S=0;var U;switch($){case"=":U=function(G){return G.getAttribute(I)==B};break;case"~":U=function(G){return G.getAttribute(I).match(new RegExp("\\b"+B+"\\b"))};break;case"|":U=function(G){return G.getAttribute(I).match(new RegExp("^"+B+"-?"))};break;case"^":U=function(G){return G.getAttribute(I).indexOf(B)===0};break;case"$":U=function(G){return G.getAttribute(I).lastIndexOf(B)==G.getAttribute(I).length-B.length};break;case"*":U=function(G){return G.getAttribute(I).indexOf(B)>-1};break;default:U=function(G){return G.getAttribute(I)}}for(x=[],S=0,m=0;m<d.length;m++)U(d[m])&&(x[S++]=d[m]);continue}for(c=a,d=[],p=0,m=0;m<x.length;m++)for(_=x[m].getElementsByTagName(c),v=0;v<_.length;v++)d[p++]=_[v];x=d}return x}return function(i){return O.isElement(i)?[i]:O.isObject(i)&&!O.isUndefined(i.length)?i:r.call(this,i)}}();var bW=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","utm_id","utm_source_platform","utm_campaign_id","utm_creative_format","utm_marketing_tactic"],xW=["dclid","fbclid","gclid","ko_click_id","li_fat_id","msclkid","sccid","ttclid","twclid","wbraid"];O.info={campaignParams:function(e){var t="",n={};return O.each(bW,function(r){t=O.getQueryParam(dn.URL,r),t.length?n[r]=t:e!==void 0&&(n[r]=e)}),n},clickParams:function(){var e="",t={};return O.each(xW,function(n){e=O.getQueryParam(dn.URL,n),e.length&&(t[n]=e)}),t},marketingParams:function(){return O.extend(O.info.campaignParams(),O.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=O.info.searchEngine(e),n=t!="yahoo"?"q":"p",r={};if(t!==null){r.$search_engine=t;var i=O.getQueryParam(e,n);i.length&&(r.mp_keyword=i)}return r},browser:function(e,t,n){return t=t||"",n||O.includes(e," OPR/")?O.includes(e,"Mini")?"Opera Mini":"Opera":/(BlackBerry|PlayBook|BB10)/i.test(e)?"BlackBerry":O.includes(e,"IEMobile")||O.includes(e,"WPDesktop")?"Internet Explorer Mobile":O.includes(e,"SamsungBrowser/")?"Samsung Internet":O.includes(e,"Edge")||O.includes(e,"Edg/")?"Microsoft Edge":O.includes(e,"FBIOS")?"Facebook Mobile":O.includes(e,"Chrome")?"Chrome":O.includes(e,"CriOS")?"Chrome iOS":O.includes(e,"UCWEB")||O.includes(e,"UCBrowser")?"UC Browser":O.includes(e,"FxiOS")?"Firefox iOS":O.includes(t,"Apple")?O.includes(e,"Mobile")?"Mobile Safari":"Safari":O.includes(e,"Android")?"Android Mobile":O.includes(e,"Konqueror")?"Konqueror":O.includes(e,"Firefox")?"Firefox":O.includes(e,"MSIE")||O.includes(e,"Trident/")?"Internet Explorer":O.includes(e,"Gecko")?"Mozilla":""},browserVersion:function(e,t,n){var r=O.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 a=e.match(o);return a?parseFloat(a[a.length-2]):null},os:function(){var e=oa;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 it.location.href},properties:function(e){return typeof e!="object"&&(e={}),O.extend(O.strip_empty_properties({$os:O.info.os(),$browser:O.info.browser(oa,rs.vendor,Pg),$referrer:dn.referrer,$referring_domain:O.info.referringDomain(dn.referrer),$device:O.info.device(oa)}),{$current_url:O.info.currentUrl(),$browser_version:O.info.browserVersion(oa,rs.vendor,Pg),$screen_height:$$.height,$screen_width:$$.width,mp_lib:"web",$lib_version:_o.LIB_VERSION,$insert_id:Nx(),time:O.timestamp()/1e3},O.strip_empty_properties(e))},people_properties:function(){return O.extend(O.strip_empty_properties({$os:O.info.os(),$browser:O.info.browser(oa,rs.vendor,Pg)}),{$browser_version:O.info.browserVersion(oa,rs.vendor,Pg)})},mpPageViewProperties:function(){return O.strip_empty_properties({current_page_title:dn.title,current_domain:it.location.hostname,current_url_path:it.location.pathname,current_url_protocol:it.location.protocol,current_url_search:it.location.search})}};var wW=function(e,t){var n=null,r=[];return function(i){var o=this;return r.push(i),n||(n=new ln(function(a){setTimeout(function(){var u=e.apply(o,[r]);n=null,r=[],a(u)},t)})),n}},Nx=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},SW=/[a-z0-9][a-z0-9-]*\.[a-z]+$/i,CW=/[a-z0-9][a-z0-9-]+\.[a-z.]{2,6}$/i,z$=function(e){var t=CW,n=e.split("."),r=n[n.length-1];(r.length>4||r==="com"||r==="org")&&(t=SW);var i=e.match(t);return i?i[0]:""},kW=function(){var e=it.navigator.onLine;return O.isUndefined(e)||e},is=function(){},wu=null,Fg=null;typeof JSON<"u"&&(wu=JSON.stringify,Fg=JSON.parse),wu=wu||O.JSONEncode,Fg=Fg||O.JSONDecode,O.info=O.info,O.info.browser=O.info.browser,O.info.browserVersion=O.info.browserVersion,O.info.device=O.info.device,O.info.properties=O.info.properties,O.isBlockedUA=O.isBlockedUA,O.isEmptyObject=O.isEmptyObject,O.isObject=O.isObject,O.JSONDecode=O.JSONDecode,O.JSONEncode=O.JSONEncode,O.toArray=O.toArray,O.NPO=ts;var EW="mixpanelBrowserDb",U$="mixpanelRecordingEvents",Bx="mixpanelRecordingRegistry",AW=1,IW=[U$,Bx],$o=function(e){this.dbPromise=null,this.storeName=e};$o.prototype._openDb=function(){return new ln(function(e,t){var n=it.indexedDB.open(EW,AW);n.onerror=function(){t(n.error)},n.onsuccess=function(){e(n.result)},n.onupgradeneeded=function(r){var i=r.target.result;IW.forEach(function(o){i.createObjectStore(o)})}})},$o.prototype.init=function(){return it.indexedDB?(this.dbPromise||(this.dbPromise=this._openDb()),this.dbPromise.then(function(e){return e instanceof it.IDBDatabase?ln.resolve():ln.reject(e)})):ln.reject("indexedDB is not supported in this browser")},$o.prototype.makeTransaction=function(e,t){var n=this.storeName,r=function(i){return new ln(function(o,a){var u=i.transaction(n,e);u.oncomplete=function(){o(u)},u.onabort=u.onerror=function(){a(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)):ln.reject(i)}).bind(this))},$o.prototype.setItem=function(e,t){return this.makeTransaction("readwrite",function(n){n.put(t,e)})},$o.prototype.getItem=function(e){var t;return this.makeTransaction("readonly",function(n){t=n.get(e)}).then(function(){return t.result})},$o.prototype.removeItem=function(e){return this.makeTransaction("readwrite",function(t){t.delete(e)})},$o.prototype.getAll=function(){var e;return this.makeTransaction("readonly",function(t){e=t.getAll()}).then(function(){return e.result})};var TW="__mp_opt_in_out_";function MW(e,t){H$(!0,e,t)}function OW(e,t){H$(!1,e,t)}function RW(e,t){return q$(e,t)==="1"}function j$(e,t){if(DW(t))return on.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=q$(e,t)==="0";return n&&on.warn("You are opted out of Mixpanel tracking. This will prevent the Mixpanel SDK from sending any data."),n}function os(e){return zx(e,function(t){return this.get_config(t)})}function as(e){return zx(e,function(t){return this._get_config(t)})}function Su(e){return zx(e,function(t){return this._get_config(t)})}function $W(e,t){t=t||{},Px(t).remove(Fx(e,t),!!t.crossSubdomainCookie,t.cookieDomain)}function Px(e){return e=e||{},e.persistenceType==="localStorage"?O.localStorage:O.cookie}function Fx(e,t){return t=t||{},(t.persistencePrefix||TW)+e}function q$(e,t){return Px(t).get(Fx(e,t))}function DW(e){if(e&&e.ignoreDnt)return!1;var t=e&&e.window||it,n=t.navigator||{},r=!1;return O.each([n.doNotTrack,n.msDoNotTrack,t.doNotTrack],function(i){O.includes([!0,1,"1","yes"],i)&&(r=!0)}),r}function H$(e,t,n){if(!O.isString(t)||!t.length){on.error("gdpr."+(e?"optIn":"optOut")+" called with an invalid token");return}n=n||{},Px(n).set(Fx(t,n),e?1:0,O.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 zx(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"),a=t.call(this,"opt_out_tracking_cookie_prefix"),u=t.call(this,"window");r&&(n=j$(r,{ignoreDnt:i,persistenceType:o,persistencePrefix:a,window:u}))}catch(d){on.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 LW=xu("lock"),G$=function(e,t){t=t||{},this.storageKey=e,this.storage=t.storage||it.localStorage,this.pollIntervalMS=t.pollIntervalMS||100,this.timeoutMS=t.timeoutMS||2e3,this.promiseImpl=t.promiseImpl||ln};G$.prototype.withLock=function(e,t){var n=this.promiseImpl;return new n(O.bind(function(r,i){var o=t||new Date().getTime()+"|"+Math.random(),a=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()-a>d){LW.error("Timeout waiting for mutex on "+u+"; clearing lock. ["+o+"]"),p.removeItem(v),p.removeItem(m),b();return}setTimeout(function(){try{E()}catch(A){i(A)}},c*(Math.random()+.1))},S=function(E,A){E()?A():_(function(){S(E,A)})},x=function(){var E=p.getItem(m);return E&&E!==o?!1:(p.setItem(m,o),p.getItem(m)===o?!0:(Yf(p,!0)||i(new Error("localStorage support dropped while acquiring lock")),!1))},b=function(){p.setItem(h,o),S(x,function(){if(p.getItem(h)===o){k();return}_(function(){if(p.getItem(m)!==o){b();return}S(function(){return!p.getItem(v)},k)})})},k=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(A){E(),r(A)}).catch(function(A){E(),i(A)})};try{if(Yf(p,!0))b();else throw new Error("localStorage support check failed")}catch(E){i(E)}},this))};var Wf=function(e){this.storage=e||it.localStorage};Wf.prototype.init=function(){return ln.resolve()},Wf.prototype.setItem=function(e,t){return new ln(O.bind(function(n,r){try{this.storage.setItem(e,wu(t))}catch(i){r(i)}n()},this))},Wf.prototype.getItem=function(e){return new ln(O.bind(function(t,n){var r;try{r=Fg(this.storage.getItem(e))}catch(i){n(i)}t(r)},this))},Wf.prototype.removeItem=function(e){return new ln(O.bind(function(t,n){try{this.storage.removeItem(e)}catch(r){n(r)}t()},this))};var V$=xu("batch"),Do=function(e,t){t=t||{},this.storageKey=e,this.usePersistence=t.usePersistence,this.usePersistence&&(this.queueStorage=t.queueStorage||new Wf,this.lock=new G$(e,{storage:t.sharedLockStorage||it.localStorage,timeoutMS:t.sharedLockTimeoutMS})),this.reportError=t.errorReporter||O.bind(V$.error,V$),this.pid=t.pid||null,this.memQueue=[],this.initialized=!1,t.enqueueThrottleMs?this.enqueuePersisted=wW(O.bind(this._enqueuePersisted,this),t.enqueueThrottleMs):this.enqueuePersisted=O.bind(function(n){return this._enqueuePersisted([n])},this)};Do.prototype.ensureInit=function(){return this.initialized?ln.resolve():this.queueStorage.init().then(O.bind(function(){this.initialized=!0},this)).catch(O.bind(function(e){this.reportError("Error initializing queue persistence. Disabling persistence",e),this.initialized=!0,this.usePersistence=!1},this))},Do.prototype.enqueue=function(e,t){var n={id:Nx(),flushAfter:new Date().getTime()+t*2,payload:e};return this.usePersistence?this.enqueuePersisted(n):(this.memQueue.push(n),ln.resolve(!0))},Do.prototype._enqueuePersisted=function(e){var t=O.bind(function(){return this.ensureInit().then(O.bind(function(){return this.readFromStorage()},this)).then(O.bind(function(n){return this.saveToStorage(n.concat(e))},this)).then(O.bind(function(n){return n&&(this.memQueue=this.memQueue.concat(e)),n},this)).catch(O.bind(function(n){return this.reportError("Error enqueueing items",n,e),!1},this))},this);return this.lock.withLock(t,this.pid).catch(O.bind(function(n){return this.reportError("Error acquiring storage lock",n),!1},this))},Do.prototype.fillBatch=function(e){var t=this.memQueue.slice(0,e);return this.usePersistence&&t.length<e?this.ensureInit().then(O.bind(function(){return this.readFromStorage()},this)).then(O.bind(function(n){if(n.length){var r={};O.each(t,function(a){r[a.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)):ln.resolve(t)};var Z$=function(e,t){var n=[];return O.each(e,function(r){r.id&&!t[r.id]&&n.push(r)}),n};Do.prototype.removeItemsByID=function(e){var t={};if(O.each(e,function(r){t[r]=!0}),this.memQueue=Z$(this.memQueue,t),this.usePersistence){var n=O.bind(function(){return this.ensureInit().then(O.bind(function(){return this.readFromStorage()},this)).then(O.bind(function(r){return r=Z$(r,t),this.saveToStorage(r)},this)).then(O.bind(function(){return this.readFromStorage()},this)).then(O.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(O.bind(function(r){return this.reportError("Error removing items",r,e),!1},this))},this);return this.lock.withLock(n,this.pid).catch(O.bind(function(r){return this.reportError("Error acquiring storage lock",r),Yf(this.lock.storage,!0)?!1:n().then(O.bind(function(i){return i||this.queueStorage.removeItem(this.storageKey).then(function(){return i})},this)).catch(O.bind(function(i){return this.reportError("Error clearing queue",i),!1},this))},this))}else return ln.resolve(!0)};var Y$=function(e,t){var n=[];return O.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};Do.prototype.updatePayloads=function(e){return this.memQueue=Y$(this.memQueue,e),this.usePersistence?this.lock.withLock(O.bind(function(){return this.ensureInit().then(O.bind(function(){return this.readFromStorage()},this)).then(O.bind(function(n){return n=Y$(n,e),this.saveToStorage(n)},this)).catch(O.bind(function(n){return this.reportError("Error updating items",e,n),!1},this))},this),this.pid).catch(O.bind(function(t){return this.reportError("Error acquiring storage lock",t),!1},this)):ln.resolve(!0)},Do.prototype.readFromStorage=function(){return this.ensureInit().then(O.bind(function(){return this.queueStorage.getItem(this.storageKey)},this)).then(O.bind(function(e){return e&&(O.isArray(e)||(this.reportError("Invalid storage entry:",e),e=null)),e||[]},this)).catch(O.bind(function(e){return this.reportError("Error retrieving queue",e),[]},this))},Do.prototype.saveToStorage=function(e){return this.ensureInit().then(O.bind(function(){return this.queueStorage.setItem(this.storageKey,e)},this)).then(function(){return!0}).catch(O.bind(function(t){return this.reportError("Error saving queue",t),!1},this))},Do.prototype.clear=function(){return this.memQueue=[],this.usePersistence?this.ensureInit().then(O.bind(function(){return this.queueStorage.removeItem(this.storageKey)},this)):ln.resolve()};var NW=10*60*1e3,Kf=xu("batch"),Xi=function(e,t){this.errorReporter=t.errorReporter,this.queue=new Do(e,{errorReporter:O.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};Xi.prototype.enqueue=function(e){return this.queue.enqueue(e,this.flushInterval)},Xi.prototype.start=function(){return this.stopped=!1,this.consecutiveRemovalFailures=0,this.flush()},Xi.prototype.stop=function(){this.stopped=!0,this.timeoutID&&(clearTimeout(this.timeoutID),this.timeoutID=null)},Xi.prototype.clear=function(){return this.queue.clear()},Xi.prototype.resetBatchSize=function(){this.batchSize=this.libConfig.batch_size},Xi.prototype.resetFlush=function(){this.scheduleFlush(this.libConfig.batch_flush_interval_ms)},Xi.prototype.scheduleFlush=function(e){this.flushInterval=e,this.stopped||(this.timeoutID=setTimeout(O.bind(function(){this.stopped||(this._flushPromise=this.flush())},this),this.flushInterval))},Xi.prototype.sendRequestPromise=function(e,t){return new ln(O.bind(function(n){this.sendRequest(e,t,n)},this))},Xi.prototype.flush=function(e){if(this.requestInProgress)return Kf.log("Flush: Request already in progress"),ln.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(O.bind(function(i){var o=i.length===r,a=[],u={};if(O.each(i,function(h){var m=h.payload;if(this.beforeSendHook&&!h.orphaned&&(m=this.beforeSendHook(m)),m){m.event&&m.properties&&(m.properties=O.extend({},m.properties,{mp_sent_by_lib_version:_o.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&&a.push(m)}u[h.id]=m},this),a.length<1)return this.requestInProgress=!1,this.resetFlush(),ln.resolve();var c=O.bind(function(){return this.queue.removeItemsByID(O.map(i,function(h){return h.id})).then(O.bind(function(h){return O.each(i,O.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(),ln.resolve()):this.flush()):(++this.consecutiveRemovalFailures>5?(this.reportError("Too many queue failures; disabling batching system."),this.stopAllBatching()):this.resetFlush(),ln.resolve())},this))},this),d=O.bind(function(h){this.requestInProgress=!1;try{if(e.unloading)return this.queue.updatePayloads(u);if(O.isObject(h)&&h.error==="timeout"&&new Date().getTime()-n>=t)return this.reportError("Network timeout; retrying"),this.flush();if(O.isObject(h)&&(h.httpStatusCode>=500||h.httpStatusCode===429||h.httpStatusCode<=0&&!kW()||h.error==="timeout")){var m=this.flushInterval*2;return h.retryAfter&&(m=parseInt(h.retryAfter,10)*1e3||m),m=Math.min(NW,m),this.reportError("Error; retry in "+m+" ms"),this.scheduleFlush(m),ln.resolve()}else if(O.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(),ln.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"),Kf.log("MIXPANEL REQUEST:",a),this.sendRequestPromise(a,p).then(d)},this)).catch(O.bind(function(i){this.reportError("Error flushing request queue",i),this.resetFlush()},this))},Xi.prototype.reportError=function(e,t){if(Kf.error.apply(Kf.error,arguments),this.errorReporter)try{t instanceof Error||(t=new Error(e)),this.errorReporter(e,t)}catch(n){Kf.error(n)}};var Ux=function(e){var t=Date.now();return!e||t>e.maxExpires||t>e.idleExpires},BW=250,Cu=xu("recorder"),W$=it.CompressionStream,PW={batch_size:1e3,batch_flush_interval_ms:10*1e3,batch_request_timeout_ms:90*1e3,batch_autostart:!0},FW=new Set([At.MouseMove,At.MouseInteraction,At.Scroll,At.ViewportResize,At.Input,At.TouchMove,At.MediaInteraction,At.Drag,At.Selection]);function zW(e){return e.type===Wt.IncrementalSnapshot&&FW.has(e.data.source)}var ti=function(e){this._mixpanel=e.mixpanelInstance,this._onIdleTimeout=e.onIdleTimeout||is,this._onMaxLengthReached=e.onMaxLengthReached||is,this._onBatchSent=e.onBatchSent||is,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=Vf,this.recordMinMs=0;var t=Yf(e.sharedLockStorage,!0);this.batcherKey="__mprec_"+this.getConfig("name")+"_"+this.getConfig("token")+"_"+this.replayId,this.queueStorage=new $o(U$),this.batcher=new Xi(this.batcherKey,{errorReporter:this.reportError.bind(this),flushOnlyOnInterval:!0,libConfig:PW,sendRequestFunc:this.flushEventsWithOptOut.bind(this),queueStorage:this.queueStorage,sharedLockStorage:e.sharedLockStorage,usePersistence:t,stopAllBatchingFunc:this.stopRecording.bind(this),enqueueThrottleMs:BW,sharedLockTimeoutMS:10*1e3})};ti.prototype.unloadPersistedData=function(){return this.batcher.stop(),this.batcher.flush().then((function(){return this.queueStorage.removeItem(this.batcherKey)}).bind(this))},ti.prototype.getConfig=function(e){return this._mixpanel.get_config(e)},ti.prototype.get_config=function(e){return this.getConfig(e)},ti.prototype.startRecording=function(e){if(this._rrwebRecord===null){this.reportError("rrweb record function not provided. ");return}if(this._stopRecording!==null){Cu.log("Recording already in progress, skipping startRecording.");return}this.recordMaxMs=this.getConfig("record_max_ms"),this.recordMaxMs>Vf&&(this.recordMaxMs=Vf,Cu.critical("record_max_ms cannot be greater than "+Vf+"ms. Capping value.")),this.maxExpires||(this.maxExpires=new Date().getTime()+this.recordMaxMs),this.recordMinMs=this.getConfig("record_min_ms"),this.recordMinMs>Tx&&(this.recordMinMs=Tx,Cu.critical("record_min_ms cannot be greater than "+Tx+"ms. Capping value.")),this.replayStartTime||(this.replayStartTime=new Date().getTime(),this.batchStartUrl=O.info.currentUrl(),this.replayStartUrl=O.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}zW(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)},ti.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},ti.prototype.isRrwebStopped=function(){return this._stopRecording===null},ti.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)},ti.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}},ti.deserialize=function(e,t){var n=new ti(O.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},ti.prototype._sendRequest=function(e,t,n,r){var i=(function(o,a){o.status===200&&this.replayId===e&&(this.seqNo++,this.batchStartUrl=O.info.currentUrl()),this._onBatchSent(),r({status:0,httpStatusCode:o.status,responseBody:a,retryAfter:o.headers.get("Retry-After")})}).bind(this);it.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(a){i(o,a)}).catch(function(a){r({error:a})})}).catch(function(o){r({error:o,httpStatusCode:0})})},ti.prototype._flushEvents=os(function(e,t,n){var r=e.length;if(r>0){for(var i=this.replayId,o=1/0,a=-1/0,u=!1,c=0;c<r;c++)o=Math.min(o,e[c].timestamp),a=Math.max(a,e[c].timestamp),e[c].type===Wt.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=a-this.replayStartTime,p={$current_url:this.batchStartUrl,$lib_version:_o.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),W$){var _=new Blob([h],{type:"application/json"}).stream(),S=_.pipeThrough(new W$("gzip"));new Response(S).blob().then((function(x){p.format="gzip",this._sendRequest(i,p,x,n)}).bind(this))}else p.format="body",this._sendRequest(i,p,h,n)}}),ti.prototype.reportError=function(e,t){Cu.error.apply(Cu.error,arguments);try{!t&&!(e instanceof Error)&&(e=new Error(e)),this.getConfig("error_reporter")(e,t)}catch(n){Cu.error(n)}};var ku=function(e){this.idb=new $o(Bx),this.errorReporter=e.errorReporter,this.mixpanelInstance=e.mixpanelInstance,this.sharedLockStorage=e.sharedLockStorage};ku.prototype.handleError=function(e){this.errorReporter("IndexedDB error: ",e)},ku.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."),ln.resolve())},ku.prototype.getActiveRecording=function(){return this.idb.init().then((function(){return this.idb.getItem(this.mixpanelInstance.get_tab_id())}).bind(this)).then((function(e){return Ux(e)?null:e}).bind(this)).catch(this.handleError.bind(this))},ku.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))},ku.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 Ux(n)}).map((function(n){var r=ti.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 ln.all(t)}).bind(this)).catch(this.handleError.bind(this))};var Qf=xu("recorder"),aa=function(e,t,n){this.mixpanelInstance=e,this.rrwebRecord=t||Ja,this.sharedLockStorage=n,this.recordingRegistry=new ku({mixpanelInstance:this.mixpanelInstance,errorReporter:Qf.error,sharedLockStorage:n}),this._flushInactivePromise=this.recordingRegistry.flushInactiveRecordings(),this.activeRecording=null};aa.prototype.startRecording=function(e){if(e=e||{},this.activeRecording&&!this.activeRecording.isRrwebStopped()){Qf.log("Recording already in progress, skipping startRecording.");return}var t=(function(){Qf.log("Idle timeout reached, restarting recording."),this.resetRecording()}).bind(this),n=(function(){Qf.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:O.UUID(),rrwebRecord:this.rrwebRecord,sharedLockStorage:this.sharedLockStorage};return e.activeSerializedRecording?this.activeRecording=ti.deserialize(e.activeSerializedRecording,i):this.activeRecording=new ti(i),this.activeRecording.startRecording(e.shouldStopBatcher),this.recordingRegistry.setActiveRecording(this.activeRecording.serialize())},aa.prototype.stopRecording=function(){var e=this._stopCurrentRecording(!1);return this.recordingRegistry.clearActiveRecording(),this.activeRecording=null,e},aa.prototype.pauseRecording=function(){return this._stopCurrentRecording(!1)},aa.prototype._stopCurrentRecording=function(e){return this.activeRecording?this.activeRecording.stopRecording(e):ln.resolve()},aa.prototype.resumeRecording=function(e){return this.activeRecording&&this.activeRecording.isRrwebStopped()?(this.activeRecording.startRecording(!1),ln.resolve(null)):this.recordingRegistry.getActiveRecording().then((function(t){return t?this.startRecording({activeSerializedRecording:t}):e?this.startRecording({shouldStopBatcher:!1}):(Qf.log("No resumable recording found."),null)}).bind(this))},aa.prototype.resetRecording=function(){this.stopRecording(),this.startRecording({shouldStopBatcher:!0})},aa.prototype.getActiveReplayId=function(){return this.activeRecording&&!this.activeRecording.isRrwebStopped()?this.activeRecording.replayId:null},Object.defineProperty(aa.prototype,"replayId",{get:function(){return this.getActiveReplayId()}}),it.__mp_recorder=aa;var zg="change",Xf="click",K$="hashchange",Eu="mp_locationchange",Q$="popstate",X$="scrollend",jx="submit",UW=["clientX","clientY","offsetX","offsetY","pageX","pageY","screenX","screenY","x","y"],J$=["mp-include"],qx=["mp-no-track"],e3=qx.concat(["mp-sensitive"]),jW=["aria-label","aria-labelledby","aria-describedby","href","name","role","title","type"],Ci=xu("autocapture");function Hx(e){for(var t={},n=t3(e).split(" "),r=0;r<n.length;r++){var i=n[r];i&&(t[i]=!0)}return t}function t3(e){switch(typeof e.className){case"string":return e.className;case"object":return e.className.baseVal||e.getAttribute("class")||"";default:return""}}function qW(e){if(e.previousElementSibling)return e.previousElementSibling;do e=e.previousSibling;while(e&&!i3(e));return e}function n3(e,t,n,r,i,o){var a={$classes:t3(e).split(" "),$tag_name:e.tagName.toLowerCase()},u=e.id;u&&(a.$id=u),Zx(e,t,i,o)&&O.each(jW.concat(r),function(h){if(e.hasAttribute(h)&&!n[h]){var m=e.getAttribute(h);Ug(m)&&(a["$attr-"+h]=m)}});for(var c=1,d=1,p=e;p=qW(p);)c++,p.tagName===e.tagName&&d++;return a.$nth_child=c,a.$nth_of_type=d,a}function HW(e,t){var n=t.allowElementCallback,r=t.allowSelectors||[],i=t.blockAttrs||[],o=t.blockElementCallback,a=t.blockSelectors||[],u=t.captureTextContent||!1,c=t.captureExtraAttrs||[],d={};O.each(i,function(A){d[A]=!0});var p=null,h=typeof e.target>"u"?e.srcElement:e.target;if(o3(h)&&(h=h.parentNode),ZW(h,e)&&Gx(h,e,n,r)&&!Vx(h,e,o,a)){for(var m=[h],v=h;v.parentNode&&!Lo(v,"body");)m.push(v.parentNode),v=v.parentNode;var _=[],S,x=!1;if(O.each(m,function(A){var I=Zx(A,e,n,r);!d.href&&A.tagName.toLowerCase()==="a"&&(S=A.getAttribute("href"),S=I&&Ug(S)&&S),Vx(A,e,o,a)&&(x=!0),_.push(n3(A,e,d,c,n,r))},this),!x){var b=dn.documentElement;if(p={$event_type:e.type,$host:it.location.host,$pathname:it.location.pathname,$elements:_,$el_attr__href:S,$viewportHeight:Math.max(b.clientHeight,it.innerHeight||0),$viewportWidth:Math.max(b.clientWidth,it.innerWidth||0)},O.each(c,function(A){if(!d[A]&&h.hasAttribute(A)){var I=h.getAttribute(A);Ug(I)&&(p["$el_attr__"+A]=I)}}),u&&(k=r3(h,e,n,r),k&&k.length&&(p.$el_text=k)),e.type===Xf&&(O.each(UW,function(A){A in e&&(p["$"+A]=e[A])}),h=GW(e)),u){var k=r3(h,e,n,r);k&&k.length&&(p.$el_text=k)}if(h){if(!Gx(h,e,n,r)||Vx(h,e,o,a))return null;var E=n3(h,e,d,c,n,r);p.$target=E,p.$el_classes=E.$classes,O.extend(p,O.strip_empty_properties({$el_id:E.$id,$el_tag_name:E.$tag_name}))}}}return p}function r3(e,t,n,r){var i="";return Zx(e,t,n,r)&&e.childNodes&&e.childNodes.length&&O.each(e.childNodes,function(o){o3(o)&&o.textContent&&(i+=O.trim(o.textContent).split(/(\s+)/).filter(Ug).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255))}),O.trim(i)}function GW(e){for(var t=e.target,n=e.composedPath(),r=0;r<n.length;r++){var i=n[r];if(Lo(i,"a")||Lo(i,"button")||Lo(i,"input")||Lo(i,"select")||i.getAttribute&&i.getAttribute("role")==="button"){t=i;break}if(i===t)break}return t}function Gx(e,t,n,r){if(n)try{if(!n(e,t))return!1}catch(a){return Ci.critical("Error while checking element in allowElementCallback",a),!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(a){Ci.critical("Error while checking selector: "+o,a)}}return!1}function Vx(e,t,n,r){var i;if(n)try{if(n(e,t))return!0}catch(u){return Ci.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){Ci.critical("Error while checking selector: "+o,u)}}var a=Hx(e);for(i=0;i<qx.length;i++)if(a[qx[i]])return!0;return!1}function i3(e){return e&&e.nodeType===1}function Lo(e,t){return e&&e.tagName&&e.tagName.toLowerCase()===t.toLowerCase()}function o3(e){return e&&e.nodeType===3}function VW(){try{var e=dn.createElement("div");return!!e.matches}catch{return!1}}function ZW(e,t){if(!e||Lo(e,"html")||!i3(e))return!1;var n=e.tagName.toLowerCase();switch(n){case"form":return t.type===jx;case"input":return["button","submit"].indexOf(e.getAttribute("type"))===-1?t.type===zg:t.type===Xf;case"select":case"textarea":return t.type===zg;default:return t.type===Xf}}function Zx(e,t,n,r){var i;if(!Gx(e,t,n,r))return!1;for(var o=e;o.parentNode&&!Lo(o,"body");o=o.parentNode){var a=Hx(o);for(i=0;i<e3.length;i++)if(a[e3[i]])return!1}var u=Hx(e);for(i=0;i<J$.length;i++)if(u[J$[i]])return!0;if(Lo(e,"input")||Lo(e,"select")||Lo(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 Ug(e){if(e===null||O.isUndefined(e))return!1;if(typeof e=="string"){e=O.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 a3="autocapture",YW="track_pageview",s3="full-url",WW="url-with-path-and-query-string",KW="url-with-path",QW="allow_element_callback",l3="allow_selectors",u3="allow_url_regexes",c3="block_attrs",f3="block_element_callback",d3="block_selectors",h3="block_url_regexes",p3="capture_extra_attrs",g3="capture_text_content",m3="scroll_capture_all",v3="scroll_depth_percent_checkpoints",Yx="click",Wx="input",y3="pageview",Kx="scroll",Qx="submit",Lr={};Lr[l3]=[],Lr[u3]=[],Lr[c3]=[],Lr[f3]=null,Lr[d3]=[],Lr[h3]=[],Lr[p3]=[],Lr[g3]=!1,Lr[m3]=!1,Lr[v3]=[25,50,75,100],Lr[Yx]=!0,Lr[Wx]=!0,Lr[y3]=s3,Lr[Kx]=!0,Lr[Qx]=!0;var jg={$mp_autocapture:!0},XW="$mp_click",JW="$mp_input_change",eK="$mp_scroll",tK="$mp_submit",Di=function(e){this.mp=e};Di.prototype.init=function(){if(!VW()){Ci.critical("Autocapture unavailable: missing required DOM APIs");return}this.initPageviewTracking(),this.initClickTracking(),this.initInputTracking(),this.initScrollTracking(),this.initSubmitTracking()},Di.prototype.getFullConfig=function(){var e=this.mp.get_config(a3);return e?O.isObject(e)?O.extend({},Lr,e):Lr:{}},Di.prototype.getConfig=function(e){return this.getFullConfig()[e]},Di.prototype.currentUrlBlocked=function(){var e,t=O.info.currentUrl(),n=this.getConfig(u3)||[];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(a){return Ci.critical("Error while checking block URL regex: "+i,a),!0}}if(!r)return!0}var o=this.getConfig(h3)||[];if(!o||!o.length)return!1;for(e=0;e<o.length;e++)try{if(t.match(o[e]))return!0}catch(a){return Ci.critical("Error while checking block URL regex: "+o[e],a),!0}return!1},Di.prototype.pageviewTrackingConfig=function(){return this.mp.get_config(a3)?this.getConfig(y3):this.mp.get_config(YW)},Di.prototype.trackDomEvent=function(e,t){if(!this.currentUrlBlocked()){var n=HW(e,{allowElementCallback:this.getConfig(QW),allowSelectors:this.getConfig(l3),blockAttrs:this.getConfig(c3),blockElementCallback:this.getConfig(f3),blockSelectors:this.getConfig(d3),captureExtraAttrs:this.getConfig(p3),captureTextContent:this.getConfig(g3)});n&&(O.extend(n,jg),this.mp.track(t,n))}},Di.prototype.initClickTracking=function(){it.removeEventListener(Xf,this.listenerClick),this.getConfig(Yx)&&(Ci.log("Initializing click tracking"),this.listenerClick=it.addEventListener(Xf,(function(e){this.getConfig(Yx)&&this.trackDomEvent(e,XW)}).bind(this)))},Di.prototype.initInputTracking=function(){it.removeEventListener(zg,this.listenerChange),this.getConfig(Wx)&&(Ci.log("Initializing input tracking"),this.listenerChange=it.addEventListener(zg,(function(e){this.getConfig(Wx)&&this.trackDomEvent(e,JW)}).bind(this)))},Di.prototype.initPageviewTracking=function(){if(it.removeEventListener(Q$,this.listenerPopstate),it.removeEventListener(K$,this.listenerHashchange),it.removeEventListener(Eu,this.listenerLocationchange),!!this.pageviewTrackingConfig()){Ci.log("Initializing pageview tracking");var e="",t=!1;this.currentUrlBlocked()||(t=this.mp.track_pageview(jg)),t&&(e=O.info.currentUrl()),this.listenerPopstate=it.addEventListener(Q$,function(){it.dispatchEvent(new Event(Eu))}),this.listenerHashchange=it.addEventListener(K$,function(){it.dispatchEvent(new Event(Eu))});var n=it.history.pushState;typeof n=="function"&&(it.history.pushState=function(i,o,a){n.call(it.history,i,o,a),it.dispatchEvent(new Event(Eu))});var r=it.history.replaceState;typeof r=="function"&&(it.history.replaceState=function(i,o,a){r.call(it.history,i,o,a),it.dispatchEvent(new Event(Eu))}),this.listenerLocationchange=it.addEventListener(Eu,$x((function(){if(!this.currentUrlBlocked()){var i=O.info.currentUrl(),o=!1,a=i.split("#")[0].split("?")[0]!==e.split("#")[0].split("?")[0],u=this.pageviewTrackingConfig();if(u===s3?o=i!==e:u===WW?o=i.split("#")[0]!==e.split("#")[0]:u===KW&&(o=a),o){var c=this.mp.track_pageview(jg);c&&(e=i),a&&(this.lastScrollCheckpoint=0,Ci.log("Path change: re-initializing scroll depth checkpoints"))}}}).bind(this)))}},Di.prototype.initScrollTracking=function(){it.removeEventListener(X$,this.listenerScroll),this.getConfig(Kx)&&(Ci.log("Initializing scroll tracking"),this.lastScrollCheckpoint=0,this.listenerScroll=it.addEventListener(X$,$x((function(){if(this.getConfig(Kx)&&!this.currentUrlBlocked()){var e=this.getConfig(m3),t=(this.getConfig(v3)||[]).slice().sort(function(c,d){return c-d}),n=it.scrollY,r=O.extend({$scroll_top:n},jg);try{var i=dn.body.scrollHeight,o=Math.round(n/(i-it.innerHeight)*100);if(r.$scroll_height=i,r.$scroll_percentage=o,o>this.lastScrollCheckpoint)for(var a=0;a<t.length;a++){var u=t[a];o>=u&&this.lastScrollCheckpoint<u&&(r.$scroll_checkpoint=u,this.lastScrollCheckpoint=u,e=!0)}}catch(c){Ci.critical("Error while calculating scroll percentage",c)}e&&this.mp.track(eK,r)}}).bind(this))))},Di.prototype.initSubmitTracking=function(){it.removeEventListener(jx,this.listenerSubmit),this.getConfig(Qx)&&(Ci.log("Initializing submit tracking"),this.listenerSubmit=it.addEventListener(jx,(function(e){this.getConfig(Qx)&&this.trackDomEvent(e,tK)}).bind(this)))},vW(Di);var sa=function(){};sa.prototype.create_properties=function(){},sa.prototype.event_handler=function(){},sa.prototype.after_track_handler=function(){},sa.prototype.init=function(e){return this.mp=e,this},sa.prototype.track=function(e,t,n,r){var i=this,o=O.dom_query(e);if(o.length===0){on.error("The DOM query ("+e+") returned 0 elements");return}return O.each(o,function(a){O.register_event(a,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},sa.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))}},sa.prototype.create_properties=function(e,t){var n;return typeof e=="function"?n=e(t):n=O.extend({},e),n};var Au=function(){this.override_event="click"};O.inherit(Au,sa),Au.prototype.create_properties=function(e,t){var n=Au.superclass.create_properties.apply(this,arguments);return t.href&&(n.url=t.href),n},Au.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()},Au.prototype.after_track_handler=function(e,t){t.new_tab||setTimeout(function(){window.location=t.href},0)};var qg=function(){this.override_event="submit"};O.inherit(qg,sa),qg.prototype.event_handler=function(e,t,n){n.element=t,e.preventDefault()},qg.prototype.after_track_handler=function(e,t){setTimeout(function(){t.element.submit()},0)};var ss="$set",Iu="$set_once",bo="$unset",al="$add",No="$append",sl="$union",la="$remove",nK="$delete",_3={set_action:function(e,t){var n={},r={};return O.isObject(e)?O.each(e,function(i,o){this._is_reserved_property(o)||(r[o]=i)},this):r[e]=t,n[ss]=r,n},unset_action:function(e){var t={},n=[];return O.isArray(e)||(e=[e]),O.each(e,function(r){this._is_reserved_property(r)||n.push(r)},this),t[bo]=n,t},set_once_action:function(e,t){var n={},r={};return O.isObject(e)?O.each(e,function(i,o){this._is_reserved_property(o)||(r[o]=i)},this):r[e]=t,n[Iu]=r,n},union_action:function(e,t){var n={},r={};return O.isObject(e)?O.each(e,function(i,o){this._is_reserved_property(o)||(r[o]=O.isArray(i)?i:[i])},this):r[e]=O.isArray(t)?t:[t],n[sl]=r,n},append_action:function(e,t){var n={},r={};return O.isObject(e)?O.each(e,function(i,o){this._is_reserved_property(o)||(r[o]=i)},this):r[e]=t,n[No]=r,n},remove_action:function(e,t){var n={},r={};return O.isObject(e)?O.each(e,function(i,o){this._is_reserved_property(o)||(r[o]=i)},this):r[e]=t,n[la]=r,n},delete_action:function(){var e={};return e[nK]="",e}},$n=function(){};O.extend($n.prototype,_3),$n.prototype._init=function(e,t,n){this._mixpanel=e,this._group_key=t,this._group_id=n},$n.prototype.set=Su(function(e,t,n){var r=this.set_action(e,t);return O.isObject(e)&&(n=t),this._send_request(r,n)}),$n.prototype.set_once=Su(function(e,t,n){var r=this.set_once_action(e,t);return O.isObject(e)&&(n=t),this._send_request(r,n)}),$n.prototype.unset=Su(function(e,t){var n=this.unset_action(e);return this._send_request(n,t)}),$n.prototype.union=Su(function(e,t,n){O.isObject(e)&&(n=t);var r=this.union_action(e,t);return this._send_request(r,n)}),$n.prototype.delete=Su(function(e){var t=this.delete_action();return this._send_request(t,e)}),$n.prototype.remove=Su(function(e,t,n){var r=this.remove_action(e,t);return this._send_request(r,n)}),$n.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=O.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)},$n.prototype._is_reserved_property=function(e){return e==="$group_key"||e==="$group_id"},$n.prototype._get_config=function(e){return this._mixpanel.get_config(e)},$n.prototype.toString=function(){return this._mixpanel.toString()+".group."+this._group_key+"."+this._group_id},$n.prototype.remove=$n.prototype.remove,$n.prototype.set=$n.prototype.set,$n.prototype.set_once=$n.prototype.set_once,$n.prototype.union=$n.prototype.union,$n.prototype.unset=$n.prototype.unset,$n.prototype.toString=$n.prototype.toString;var Tt=function(){};O.extend(Tt.prototype,_3),Tt.prototype._init=function(e){this._mixpanel=e},Tt.prototype.set=as(function(e,t,n){var r=this.set_action(e,t);return O.isObject(e)&&(n=t),this._get_config("save_referrer")&&this._mixpanel.persistence.update_referrer_info(document.referrer),r[ss]=O.extend({},O.info.people_properties(),r[ss]),this._send_request(r,n)}),Tt.prototype.set_once=as(function(e,t,n){var r=this.set_once_action(e,t);return O.isObject(e)&&(n=t),this._send_request(r,n)}),Tt.prototype.unset=as(function(e,t){var n=this.unset_action(e);return this._send_request(n,t)}),Tt.prototype.increment=as(function(e,t,n){var r={},i={};return O.isObject(e)?(O.each(e,function(o,a){if(!this._is_reserved_property(a))if(isNaN(parseFloat(o))){on.error("Invalid increment value passed to mixpanel.people.increment - must be a number");return}else i[a]=o},this),n=t):(O.isUndefined(t)&&(t=1),i[e]=t),r[al]=i,this._send_request(r,n)}),Tt.prototype.append=as(function(e,t,n){O.isObject(e)&&(n=t);var r=this.append_action(e,t);return this._send_request(r,n)}),Tt.prototype.remove=as(function(e,t,n){O.isObject(e)&&(n=t);var r=this.remove_action(e,t);return this._send_request(r,n)}),Tt.prototype.union=as(function(e,t,n){O.isObject(e)&&(n=t);var r=this.union_action(e,t);return this._send_request(r,n)}),Tt.prototype.track_charge=as(function(e,t,n){if(!O.isNumber(e)&&(e=parseFloat(e),isNaN(e))){on.error("Invalid value passed to mixpanel.people.track_charge - must be a number");return}return this.append("$transactions",O.extend({$amount:e},t),n)}),Tt.prototype.clear_charges=function(e){return this.set("$transactions",[],e)},Tt.prototype.delete_user=function(){if(!this._identify_called()){on.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)},Tt.prototype.toString=function(){return this._mixpanel.toString()+".people"},Tt.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=O.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),O.isUndefined(t)||(this._get_config("verbose")?t({status:-1,error:null}):t(-1)),O.truncate(o,255))},Tt.prototype._get_config=function(e){return this._mixpanel.get_config(e)},Tt.prototype._identify_called=function(){return this._mixpanel._flags.identify_called===!0},Tt.prototype._enqueue=function(e){ss in e?this._mixpanel.persistence._add_to_people_queue(ss,e):Iu in e?this._mixpanel.persistence._add_to_people_queue(Iu,e):bo in e?this._mixpanel.persistence._add_to_people_queue(bo,e):al in e?this._mixpanel.persistence._add_to_people_queue(al,e):No in e?this._mixpanel.persistence._add_to_people_queue(No,e):la in e?this._mixpanel.persistence._add_to_people_queue(la,e):sl in e?this._mixpanel.persistence._add_to_people_queue(sl,e):on.error("Invalid call to _enqueue():",e)},Tt.prototype._flush_one_queue=function(e,t,n,r){var i=this,o=O.extend({},this._mixpanel.persistence.load_queue(e)),a=o;!O.isUndefined(o)&&O.isObject(o)&&!O.isEmptyObject(o)&&(i._mixpanel.persistence._pop_from_people_queue(e,o),i._mixpanel.persistence.save(),r&&(a=r(o)),t.call(i,a,function(u,c){u===0&&i._mixpanel.persistence._add_to_people_queue(e,o),O.isUndefined(n)||n(u,c)}))},Tt.prototype._flush=function(e,t,n,r,i,o,a){var u=this;this._flush_one_queue(ss,this.set,e),this._flush_one_queue(Iu,this.set_once,r),this._flush_one_queue(bo,this.unset,o,function(x){return O.keys(x)}),this._flush_one_queue(al,this.increment,t),this._flush_one_queue(sl,this.union,i);var c=this._mixpanel.persistence.load_queue(No);if(!O.isUndefined(c)&&O.isArray(c)&&c.length)for(var d,p=function(x,b){x===0&&u._mixpanel.persistence._add_to_people_queue(No,d),O.isUndefined(n)||n(x,b)},h=c.length-1;h>=0;h--)c=this._mixpanel.persistence.load_queue(No),d=c.pop(),u._mixpanel.persistence.save(),O.isEmptyObject(d)||u.append(d,p);var m=this._mixpanel.persistence.load_queue(la);if(!O.isUndefined(m)&&O.isArray(m)&&m.length)for(var v,_=function(x,b){x===0&&u._mixpanel.persistence._add_to_people_queue(la,v),O.isUndefined(a)||a(x,b)},S=m.length-1;S>=0;S--)m=this._mixpanel.persistence.load_queue(la),v=m.pop(),u._mixpanel.persistence.save(),O.isEmptyObject(v)||u.remove(v,_)},Tt.prototype._is_reserved_property=function(e){return e==="$distinct_id"||e==="$token"||e==="$device_id"||e==="$user_id"||e==="$had_persisted_distinct_id"},Tt.prototype.set=Tt.prototype.set,Tt.prototype.set_once=Tt.prototype.set_once,Tt.prototype.unset=Tt.prototype.unset,Tt.prototype.increment=Tt.prototype.increment,Tt.prototype.append=Tt.prototype.append,Tt.prototype.remove=Tt.prototype.remove,Tt.prototype.union=Tt.prototype.union,Tt.prototype.track_charge=Tt.prototype.track_charge,Tt.prototype.clear_charges=Tt.prototype.clear_charges,Tt.prototype.delete_user=Tt.prototype.delete_user,Tt.prototype.toString=Tt.prototype.toString;var Xx="__mps",Jx="__mpso",ew="__mpus",tw="__mpa",nw="__mpap",rw="__mpr",iw="__mpu",b3="$people_distinct_id",Hg="__alias",Jf="__timers",rK=[Xx,Jx,ew,tw,nw,rw,iw,b3,Hg,Jf],Nt=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"&&(on.critical("Unknown persistence type "+t+"; falling back to cookie"),t=e.persistence="cookie"),t==="localStorage"&&O.localStorage.is_supported()?this.storage=O.localStorage:this.storage=O.cookie,this.load(),this.update_config(e),this.upgrade(),this.save()};Nt.prototype.properties=function(){var e={};return this.load(),O.each(this.props,function(t,n){O.include(rK,n)||(e[n]=t)}),e},Nt.prototype.load=function(){if(!this.disabled){var e=this.storage.parse(this.name);e&&(this.props=O.extend({},e))}},Nt.prototype.upgrade=function(){var e,t;this.storage===O.localStorage?(e=O.cookie.parse(this.name),O.cookie.remove(this.name),O.cookie.remove(this.name,!0),e&&this.register_once(e)):this.storage===O.cookie&&(t=O.localStorage.parse(this.name),O.localStorage.remove(this.name),t&&this.register_once(t))},Nt.prototype.save=function(){this.disabled||this.storage.set(this.name,wu(this.props),this.expire_days,this.cross_subdomain,this.secure,this.cross_site,this.cookie_domain)},Nt.prototype.load_prop=function(e){return this.load(),this.props[e]},Nt.prototype.remove=function(){this.storage.remove(this.name,!1,this.cookie_domain),this.storage.remove(this.name,!0,this.cookie_domain)},Nt.prototype.clear=function(){this.remove(),this.props={}},Nt.prototype.register_once=function(e,t,n){return O.isObject(e)?(typeof t>"u"&&(t="None"),this.expire_days=typeof n>"u"?this.default_expiry:n,this.load(),O.each(e,function(r,i){(!this.props.hasOwnProperty(i)||this.props[i]===t)&&(this.props[i]=r)},this),this.save(),!0):!1},Nt.prototype.register=function(e,t){return O.isObject(e)?(this.expire_days=typeof t>"u"?this.default_expiry:t,this.load(),O.extend(this.props,e),this.save(),!0):!1},Nt.prototype.unregister=function(e){this.load(),e in this.props&&(delete this.props[e],this.save())},Nt.prototype.update_search_keyword=function(e){this.register(O.info.searchInfo(e))},Nt.prototype.update_referrer_info=function(e){this.register_once({$initial_referrer:e||"$direct",$initial_referring_domain:O.info.referringDomain(e)||"$direct"},"")},Nt.prototype.get_referrer_info=function(){return O.strip_empty_properties({$initial_referrer:this.props.$initial_referrer,$initial_referring_domain:this.props.$initial_referring_domain})},Nt.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)},Nt.prototype.set_disabled=function(e){this.disabled=e,this.disabled?this.remove():this.save()},Nt.prototype.set_cookie_domain=function(e){e!==this.cookie_domain&&(this.remove(),this.cookie_domain=e,this.save())},Nt.prototype.set_cross_site=function(e){e!==this.cross_site&&(this.cross_site=e,this.remove(),this.save())},Nt.prototype.set_cross_subdomain=function(e){e!==this.cross_subdomain&&(this.cross_subdomain=e,this.remove(),this.save())},Nt.prototype.get_cross_subdomain=function(){return this.cross_subdomain},Nt.prototype.set_secure=function(e){e!==this.secure&&(this.secure=!!e,this.remove(),this.save())},Nt.prototype._add_to_people_queue=function(e,t){var n=this._get_queue_key(e),r=t[e],i=this._get_or_create_queue(ss),o=this._get_or_create_queue(Iu),a=this._get_or_create_queue(bo),u=this._get_or_create_queue(al),c=this._get_or_create_queue(sl),d=this._get_or_create_queue(la,[]),p=this._get_or_create_queue(No,[]);n===Xx?(O.extend(i,r),this._pop_from_people_queue(al,r),this._pop_from_people_queue(sl,r),this._pop_from_people_queue(bo,r)):n===Jx?(O.each(r,function(h,m){m in o||(o[m]=h)}),this._pop_from_people_queue(bo,r)):n===ew?O.each(r,function(h){O.each([i,o,u,c],function(m){h in m&&delete m[h]}),O.each(p,function(m){h in m&&delete m[h]}),a[h]=!0}):n===tw?(O.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(bo,r)):n===iw?(O.each(r,function(h,m){O.isArray(h)&&(m in c||(c[m]=[]),O.each(h,function(v){O.include(c[m],v)||c[m].push(v)}))}),this._pop_from_people_queue(bo,r)):n===rw?(d.push(r),this._pop_from_people_queue(No,r)):n===nw&&(p.push(r),this._pop_from_people_queue(bo,r)),on.log("MIXPANEL PEOPLE REQUEST (QUEUED, PENDING IDENTIFY):"),on.log(t),this.save()},Nt.prototype._pop_from_people_queue=function(e,t){var n=this.props[this._get_queue_key(e)];O.isUndefined(n)||O.each(t,function(r,i){e===No||e===la?O.each(n,function(o){o[i]===r&&delete o[i]}):delete n[i]},this)},Nt.prototype.load_queue=function(e){return this.load_prop(this._get_queue_key(e))},Nt.prototype._get_queue_key=function(e){if(e===ss)return Xx;if(e===Iu)return Jx;if(e===bo)return ew;if(e===al)return tw;if(e===No)return nw;if(e===la)return rw;if(e===sl)return iw;on.error("Invalid queue:",e)},Nt.prototype._get_or_create_queue=function(e,t){var n=this._get_queue_key(e);return t=O.isUndefined(t)?{}:t,this.props[n]||(this.props[n]=t)},Nt.prototype.set_event_timer=function(e,t){var n=this.load_prop(Jf)||{};n[e]=t,this.props[Jf]=n,this.save()},Nt.prototype.remove_event_timer=function(e){var t=this.load_prop(Jf)||{},n=t[e];return O.isUndefined(n)||(delete this.props[Jf][e],this.save()),n};var ow,x3=function(e,t){throw new Error(e+" not available in this build.")},ni,w3=0,iK=1,oK=function(e){return e},Ji="mixpanel",S3="base64",aK="json",aw="$device:",Tu=it.XMLHttpRequest&&"withCredentials"in new XMLHttpRequest,C3=!Tu&&oa.indexOf("MSIE")===-1&&oa.indexOf("Mozilla")===-1,Gg=null;rs.sendBeacon&&(Gg=function(){return rs.sendBeacon.apply(rs,arguments)});var k3={track:"track/",engage:"engage/",groups:"groups/",record:"record/"},E3={api_host:"https://api-js.mixpanel.com",api_routes:k3,api_method:"POST",api_transport:"XHR",api_payload_format:S3,app_host:"https://mixpanel.com",autocapture:!1,cdn:"https://cdn.mxpnl.com",cross_site_cookie:!1,cross_subdomain_cookie:!0,error_reporter:is,persistence:"cookie",persistence_name:"",cookie_domain:"",cookie_name:"",loaded:is,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:Vf,record_min_ms:0,record_sessions_percent:0,recorder_src:"https://cdn.mxpnl.com/libs/mixpanel-recorder.min.js"},A3=!1,fe=function(){},sw=function(e,t,n){var r,i=n===Ji?ni:ni[n];if(i&&ow===w3)r=i;else{if(i&&!O.isArray(i)){on.error("You have already initialized "+n);return}r=new fe}if(r._cached_groups={},r._init(e,t,n),r.people=new Tt,r.people._init(r),!r.get_config("skip_first_touch_marketing")){var o=O.info.campaignParams(null),a={},u=!1;O.each(o,function(c,d){a["initial_"+d]=c,c&&(u=!0)}),u&&r.people.set_once(a)}return _o.DEBUG=_o.DEBUG||r.get_config("debug"),!O.isUndefined(i)&&O.isArray(i)&&(r._execute_array.call(r.people,i.people),r._execute_array(i)),r};fe.prototype.init=function(e,t,n){if(O.isUndefined(n)){this.report_error("You must name your new library: init(token, config, name)");return}if(n===Ji){this.report_error("You must initialize the main mixpanel object right after you include the Mixpanel js snippet");return}var r=sw(e,t,n);return ni[n]=r,r._loaded(),r},fe.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||E3.api_host;i.match(/\.mixpanel\.com/)&&(r.api_payload_format=aK)}if(this.set_config(O.extend({},E3,r,t,{name:n,token:e,callback_fn:(n===Ji?n:Ji+"."+n)+"._jsc"})),this._jsc=is,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(!O.localStorage.is_supported(!0)||!Tu)this._batch_requests=!1,on.log("Turning off Mixpanel request-queueing; needs XHR and localStorage support"),O.each(this.get_batcher_configs(),function(u){on.log("Clearing batch queue "+u.queue_key),O.localStorage.remove(u.queue_key)});else if(this.init_batchers(),Gg&&it.addEventListener){var o=O.bind(function(){this.request_batchers.events.stopped||this.request_batchers.events.flush({unloading:!0})},this);it.addEventListener("pagehide",function(u){u.persisted&&o()}),it.addEventListener("visibilitychange",function(){dn.visibilityState==="hidden"&&o()})}}this.persistence=this.cookie=new Nt(this.config),this.unpersisted_superprops={},this._gdpr_init();var a=O.UUID();this.get_distinct_id()||this.register_once({distinct_id:aw+a,$device_id:a},""),this.autocapture=new Di(this),this.autocapture.init(),this._init_tab_id(),this._check_and_start_session_recording()},fe.prototype._init_tab_id=function(){if(O.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;(O.sessionStorage.get(n)||!O.sessionStorage.get(t))&&O.sessionStorage.set(t,"$tab-"+O.UUID()),O.sessionStorage.set(n,"1"),this.tab_id=O.sessionStorage.get(t),it.addEventListener("beforeunload",function(){O.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.")},fe.prototype.get_tab_id=function(){return this.tab_id||null},fe.prototype._should_load_recorder=function(){var e=new $o(Bx),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(Ux(n[r])||n[r].tabId===t)return!0;return!1}).catch(O.bind(function(n){this.report_error("Error checking recording registry",n)},this))},fe.prototype._check_and_start_session_recording=os(function(e){if(!it.MutationObserver){on.critical("Browser does not support MutationObserver; skipping session recording");return}var t=O.bind(function(r){var i=O.bind(function(){this._recorder=this._recorder||new it.__mp_recorder(this),this._recorder.resumeRecording(r)},this);O.isUndefined(it.__mp_recorder)?x3(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)})}),fe.prototype.start_session_recording=function(){this._check_and_start_session_recording(!0)},fe.prototype.stop_session_recording=function(){this._recorder&&this._recorder.stopRecording()},fe.prototype.pause_session_recording=function(){this._recorder&&this._recorder.pauseRecording()},fe.prototype.resume_session_recording=function(){this._recorder&&this._recorder.resumeRecording()},fe.prototype.get_session_recording_properties=function(){var e={},t=this._get_session_replay_id();return t&&(e.$mp_replay_id=t),e},fe.prototype.get_session_replay_url=function(){var e=null,t=this._get_session_replay_id();if(t){var n=O.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},fe.prototype._get_session_replay_id=function(){var e=null;return this._recorder&&(e=this._recorder.replayId),e||null},fe.prototype.__get_recorder=function(){return this._recorder},fe.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=O.info.campaignParams(null);O.each(e,(function(t,n){this.unregister(n)}).bind(this))}},fe.prototype._set_default_superprops=function(){this.persistence.update_search_keyword(dn.referrer),this.get_config("store_google")&&!this.get_config("stop_utm_persistence")&&this.register(O.info.campaignParams()),this.get_config("save_referrer")&&this.persistence.update_referrer_info(dn.referrer)},fe.prototype._dom_loaded=function(){O.each(this.__dom_loaded_queue,function(e){this._track_dom.apply(this,e)},this),this.has_opted_out_tracking()||O.each(this.__request_queue,function(e){this._send_request.apply(this,e)},this),delete this.__dom_loaded_queue,delete this.__request_queue},fe.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(!A3)return this.__dom_loaded_queue.push([e,t]),!1;var n=new e().init(this);return n.track.apply(n,t)},fe.prototype._prepare_callback=function(e,t){if(O.isUndefined(e))return null;if(Tu){var n=function(a){e(a,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(a){delete r[i],e(a,t)},o}},fe.prototype._send_request=function(e,t,n,r){var i=!0;if(C3)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")},a=null;!r&&(O.isFunction(n)||typeof n=="string")&&(r=n,n=null),n=O.extend(o,n||{}),Tu||(n.method="GET");var u=n.method==="POST",c=Gg&&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&&(a="data="+encodeURIComponent(t.data),delete t.data),e+="?"+O.HTTPBuildQuery(t);var p=this;if("img"in t){var h=dn.createElement("img");h.src=e,dn.body.appendChild(h)}else if(c){try{i=Gg(e,a)}catch(b){p.report_error(b),i=!1}try{r&&r(i?1:0)}catch(b){p.report_error(b)}}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"),O.each(v,function(b,k){m.setRequestHeader(k,b)}),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 b;try{b=O.JSONDecode(m.responseText)}catch(A){if(p.report_error(A),n.ignore_json_errors)b=m.responseText;else return}r(b)}else r(Number(m.responseText))}else{var k;if(m.timeout&&!m.status&&new Date().getTime()-_>=m.timeout?k="timeout":k="Bad HTTP status: "+m.status+" "+m.statusText,p.report_error(k),r)if(d){var E=m.responseHeaders||{};r({status:0,httpStatusCode:m.status,error:k,retryAfter:E["Retry-After"]})}else r(0)}},m.send(a)}catch(b){p.report_error(b),i=!1}else{var S=dn.createElement("script");S.type="text/javascript",S.async=!0,S.defer=!0,S.src=e;var x=dn.getElementsByTagName("script")[0];x.parentNode.insertBefore(S,x)}return i},fe.prototype._execute_array=function(e){var t,n=[],r=[],i=[];O.each(e,function(a){a&&(t=a[0],O.isArray(t)?i.push(a):typeof a=="function"?a.call(this):O.isArray(a)&&t==="alias"?n.push(a):O.isArray(a)&&t.indexOf("track")!==-1&&typeof this[t]=="function"?i.push(a):r.push(a))},this);var o=function(a,u){O.each(a,function(c){if(O.isArray(c[0])){var d=u;O.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)},fe.prototype.are_batchers_initialized=function(){return!!this.request_batchers.events},fe.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},fe.prototype.init_batchers=function(){if(!this.are_batchers_initialized()){var e=O.bind(function(n){return new Xi(n.queue_key,{libConfig:this.config,errorReporter:this.get_config("error_reporter"),sendRequestFunc:O.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:O.bind(function(r){return this._run_hook("before_send_"+n.type,r)},this),stopAllBatchingFunc:O.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()},fe.prototype.start_batch_senders=function(){this._batchers_were_started=!0,this.are_batchers_initialized()&&(this._batch_requests=!0,O.each(this.request_batchers,function(e){e.start()}))},fe.prototype.stop_batch_senders=function(){this._batch_requests=!1,O.each(this.request_batchers,function(e){e.stop(),e.clear()})},fe.prototype.push=function(e){this._execute_array([e])},fe.prototype.disable=function(e){typeof e>"u"?this._flags.disable_all_events=!0:this.__disabled_events=this.__disabled_events.concat(e)},fe.prototype._encode_data_for_request=function(e){var t=wu(e);return this.get_config("api_payload_format")===S3&&(t=O.base64Encode(t)),{data:t}},fe.prototype._track_or_batch=function(e,t){var n=O.truncate(e.data,255),r=e.endpoint,i=e.batcher,o=e.should_send_immediately,a=e.send_request_options||{};t=t||is;var u=!0,c=O.bind(function(){return a.skip_hooks||(n=this._run_hook("before_send_"+e.type,n)),n?(on.log("MIXPANEL REQUEST:"),on.log(n),this._send_request(r,this._encode_data_for_request(n),a,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},fe.prototype.track=os(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=is),O.isUndefined(e)){this.report_error("No event name provided to mixpanel.track");return}if(this._event_is_disabled(e)){r(0);return}t=O.extend({},t),t.token=this.get_config("token");var a=this.persistence.remove_event_timer(e);if(!O.isUndefined(a)){var u=new Date().getTime()-a;t.$duration=parseFloat((u/1e3).toFixed(3))}this._set_default_superprops();var c=this.get_config("track_marketing")?O.info.marketingParams():{};t=O.extend({},O.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");O.isArray(d)?O.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}),fe.prototype.set_group=os(function(e,t,n){O.isArray(t)||(t=[t]);var r={};return r[e]=t,this.register(r),this.people.set(e,t,n)}),fe.prototype.add_group=os(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)}),fe.prototype.remove_group=os(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)}),fe.prototype.track_with_groups=os(function(e,t,n,r){var i=O.extend({},t||{});return O.each(n,function(o,a){o!=null&&(i[a]=o)}),this.track(e,i,r)}),fe.prototype._create_map_key=function(e,t){return e+"_"+JSON.stringify(t)},fe.prototype._remove_group_from_cache=function(e,t){delete this._cached_groups[this._create_map_key(e,t)]},fe.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 $n,r._init(this,e,t),this._cached_groups[n]=r),r},fe.prototype.track_pageview=os(function(e,t){typeof e!="object"&&(e={}),t=t||{};var n=t.event_name||"$mp_web_page_view",r=O.extend(O.info.mpPageViewProperties(),O.info.campaignParams(),O.info.clickParams()),i=O.extend({},r,e);return this.track(n,i)}),fe.prototype.track_links=function(){return this._track_dom.call(this,Au,arguments)},fe.prototype.track_forms=function(){return this._track_dom.call(this,qg,arguments)},fe.prototype.time_event=function(e){if(O.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 sK={persistent:!0},lw=function(e){var t;return O.isObject(e)?t=e:O.isUndefined(e)?t={}:t={days:e},O.extend({},sK,t)};fe.prototype.register=function(e,t){var n=lw(t);n.persistent?this.persistence.register(e,n.days):O.extend(this.unpersisted_superprops,e)},fe.prototype.register_once=function(e,t,n){var r=lw(n);r.persistent?this.persistence.register_once(e,t,r.days):(typeof t>"u"&&(t="None"),O.each(e,function(i,o){(!this.unpersisted_superprops.hasOwnProperty(o)||this.unpersisted_superprops[o]===t)&&(this.unpersisted_superprops[o]=i)},this))},fe.prototype.unregister=function(e,t){t=lw(t),t.persistent?this.persistence.unregister(e):delete this.unpersisted_superprops[e]},fe.prototype._register_single=function(e,t){var n={};n[e]=t,this.register(n)},fe.prototype.identify=function(e,t,n,r,i,o,a,u){var c=this.get_distinct_id();if(e&&c!==e){if(typeof e=="string"&&e.indexOf(aw)===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(Hg)&&(this.unregister(Hg),this.register({distinct_id:e})),this._flags.identify_called=!0,this.people._flush(t,n,r,i,o,a,u),e!==c&&this.track("$identify",{distinct_id:e,$anon_distinct_id:c},{skip_hooks:!0})},fe.prototype.reset=function(){this.persistence.clear(),this._flags.identify_called=!1;var e=O.UUID();this.register_once({distinct_id:aw+e,$device_id:e},"")},fe.prototype.get_distinct_id=function(){return this.get_property("distinct_id")},fe.prototype.alias=function(e,t){if(e===this.get_property(b3))return this.report_error("Attempting to create alias for existing People user - aborting."),-2;var n=this;return O.isUndefined(t)&&(t=this.get_distinct_id()),e!==t?(this._register_single(Hg,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)},fe.prototype.name_tag=function(e){this._register_single("mp_name_tag",e)},fe.prototype.set_config=function(e){if(O.isObject(e)){O.extend(this.config,e);var t=e.batch_size;t&&O.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),_o.DEBUG=_o.DEBUG||this.get_config("debug"),"autocapture"in e&&this.autocapture&&this.autocapture.init()}},fe.prototype.get_config=function(e){return this.config[e]},fe.prototype._run_hook=function(e){var t=(this.config.hooks[e]||oK).apply(this,ns.call(arguments,1));return typeof t>"u"&&(this.report_error(e+" hook did not return a value"),t=null),t},fe.prototype.get_property=function(e){return this.persistence.load_prop([e])},fe.prototype.toString=function(){var e=this.get_config("name");return e!==Ji&&(e=Ji+"."+e),e},fe.prototype._event_is_disabled=function(e){return O.isBlockedUA(oa)||this._flags.disable_all_events||O.include(this.__disabled_events,e)},fe.prototype._gdpr_init=function(){var e=this.get_config("opt_out_tracking_persistence_type")==="localStorage";e&&O.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")||O.cookie.get("mp_optout"))&&(O.cookie.remove("mp_optout"),this.opt_out_tracking({clear_persistence:this.get_config("opt_out_persistence_by_default")}))},fe.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()},fe.prototype._gdpr_call_func=function(e,t){return t=O.extend({track:O.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),O.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})},fe.prototype.opt_in_tracking=function(e){e=O.extend({enable_persistence:!0},e),this._gdpr_call_func(MW,e),this._gdpr_update_persistence(e)},fe.prototype.opt_out_tracking=function(e){e=O.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(OW,e),this._gdpr_update_persistence(e)},fe.prototype.has_opted_in_tracking=function(e){return this._gdpr_call_func(RW,e)},fe.prototype.has_opted_out_tracking=function(e){return this._gdpr_call_func(j$,e)},fe.prototype.clear_opt_in_out_tracking=function(e){e=O.extend({enable_persistence:!0},e),this._gdpr_call_func($W,e),this._gdpr_update_persistence(e)},fe.prototype.report_error=function(e,t){on.error.apply(on.error,arguments);try{!t&&!(e instanceof Error)&&(e=new Error(e)),this.get_config("error_reporter")(e,t)}catch(n){on.error(n)}},fe.prototype.init=fe.prototype.init,fe.prototype.reset=fe.prototype.reset,fe.prototype.disable=fe.prototype.disable,fe.prototype.time_event=fe.prototype.time_event,fe.prototype.track=fe.prototype.track,fe.prototype.track_links=fe.prototype.track_links,fe.prototype.track_forms=fe.prototype.track_forms,fe.prototype.track_pageview=fe.prototype.track_pageview,fe.prototype.register=fe.prototype.register,fe.prototype.register_once=fe.prototype.register_once,fe.prototype.unregister=fe.prototype.unregister,fe.prototype.identify=fe.prototype.identify,fe.prototype.alias=fe.prototype.alias,fe.prototype.name_tag=fe.prototype.name_tag,fe.prototype.set_config=fe.prototype.set_config,fe.prototype.get_config=fe.prototype.get_config,fe.prototype.get_property=fe.prototype.get_property,fe.prototype.get_distinct_id=fe.prototype.get_distinct_id,fe.prototype.toString=fe.prototype.toString,fe.prototype.opt_out_tracking=fe.prototype.opt_out_tracking,fe.prototype.opt_in_tracking=fe.prototype.opt_in_tracking,fe.prototype.has_opted_out_tracking=fe.prototype.has_opted_out_tracking,fe.prototype.has_opted_in_tracking=fe.prototype.has_opted_in_tracking,fe.prototype.clear_opt_in_out_tracking=fe.prototype.clear_opt_in_out_tracking,fe.prototype.get_group=fe.prototype.get_group,fe.prototype.set_group=fe.prototype.set_group,fe.prototype.add_group=fe.prototype.add_group,fe.prototype.remove_group=fe.prototype.remove_group,fe.prototype.track_with_groups=fe.prototype.track_with_groups,fe.prototype.start_batch_senders=fe.prototype.start_batch_senders,fe.prototype.stop_batch_senders=fe.prototype.stop_batch_senders,fe.prototype.start_session_recording=fe.prototype.start_session_recording,fe.prototype.stop_session_recording=fe.prototype.stop_session_recording,fe.prototype.pause_session_recording=fe.prototype.pause_session_recording,fe.prototype.resume_session_recording=fe.prototype.resume_session_recording,fe.prototype.get_session_recording_properties=fe.prototype.get_session_recording_properties,fe.prototype.get_session_replay_url=fe.prototype.get_session_replay_url,fe.prototype.get_tab_id=fe.prototype.get_tab_id,fe.prototype.DEFAULT_API_ROUTES=k3,fe.prototype.__get_recorder=fe.prototype.__get_recorder,Nt.prototype.properties=Nt.prototype.properties,Nt.prototype.update_search_keyword=Nt.prototype.update_search_keyword,Nt.prototype.update_referrer_info=Nt.prototype.update_referrer_info,Nt.prototype.get_cross_subdomain=Nt.prototype.get_cross_subdomain,Nt.prototype.clear=Nt.prototype.clear;var Mu={},lK=function(){O.each(Mu,function(e,t){t!==Ji&&(ni[t]=e)}),ni._=O},uK=function(){ni.init=function(e,t,n){if(n)return ni[n]||(ni[n]=Mu[n]=sw(e,t,n),ni[n]._loaded()),ni[n];var r=ni;Mu[Ji]?r=Mu[Ji]:e&&(r=sw(e,t,Ji),r._loaded(),Mu[Ji]=r),ni=r,ow===iK&&(it[Ji]=ni),lK()}},cK=function(){function e(){e.done||(e.done=!0,A3=!0,C3=!1,O.each(Mu,function(r){r._dom_loaded()}))}function t(){try{dn.documentElement.doScroll("left")}catch{setTimeout(t,1);return}e()}if(dn.addEventListener)dn.readyState==="complete"?e():dn.addEventListener("DOMContentLoaded",e,!1);else if(dn.attachEvent){dn.attachEvent("onreadystatechange",e);var n=!1;try{n=it.frameElement===null}catch{}dn.documentElement.doScroll&&n&&t()}O.register_event(it,"load",e,!0)};function fK(e){return x3=e,ow=w3,ni=new fe,uK(),ni.init(),cK(),ni}function dK(e,t){t()}var ls=fK(dK);const Zn="https://saas.brainlox.com",hK="https://debales-web-app-server.azurewebsites.net",I3={"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"},pK="phc_nzwftWluHb06OLHwbfhb2xmhk88Ffc9OjjR8Jz5Q327",Vg=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 an(){const e=sessionStorage.getItem("debalesSessionID");if(e)return e;const t=crypto.randomUUID();return sessionStorage.setItem("debalesSessionID",t),t}function gK(){return sessionStorage.getItem(qt(jt.LAST_SHOWN_MESSAGE_ID,{botId:window.DebalesChat.projectId}))}function Nr(){const e=localStorage.getItem(qt(jt.USER_INFO));return e?JSON.parse(e):null}function ua(e){localStorage.setItem(qt(jt.USER_INFO),JSON.stringify(e))}function ri(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,a=performance.now(),u=c=>{const d=c-a,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 mK(){return window.location.pathname}function ed(){const e=/test|demo|example|debales/i,t=Nr()??"";return!!(t&&e.test(t.email))}function Zg(e){const t=mK(),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,a)=>(o.sortOrder??0)-(a.sortOrder??0))}const T3=new Set,Yg=e=>{const t=I3[e];if(!t)return console.warn("No Mixpanel token found"),null;if(T3.has(e))return ls;ls.init(t,{debug:!0,track_pageview:!0,persistence:"localStorage"}),console.log("Mixpanel initialized");const n=Nr();return n&&n.email&&ls.identify(n.email),T3.add(e),ls},vK=async(e,t)=>{if(ed())return;const n=window.DebalesChat.projectId??t.projectId;if(!I3[n]){console.warn("No Mixpanel token found");return}ls.track(e,t)},yK=()=>{const e=localStorage.getItem("anonymousUserId");if(e)return e;const t=crypto.randomUUID();return localStorage.setItem("anonymousUserId",t),t};function ll(e){return e?e.split("<br>").filter(n=>n.trim().length>0).map(n=>n.trim()):[""]}const Br=e=>e.toLowerCase().includes("gaiabay")||e.toLowerCase().includes("debales-testing"),_K=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 qt(e,t){return t!=null&&t.botId?`debales_${t.botId}_${e}`:`debales_${e}`}const M3=R.createContext(null),td=()=>{const e=R.useContext(M3);if(!e)throw new Error("useCart must be used within a CartProvider");return e};var bK="2.0.0",Ou="",O3="?",Wg="function",us="undefined",Ru="object",uw="string",nd="major",Fe="model",Le="name",$e="type",Ge="vendor",Pe="version",ki="architecture",$u="console",$t="mobile",Bn="tablet",ii="smarttv",rd="wearable",cw="xr",fw="embedded",id="inapp",R3="user-agent",dw=500,hw="brands",ul="formFactors",pw="fullVersionList",Du="platform",gw="platformVersion",Kg="bitness",cs="sec-ch-ua",xK=cs+"-full-version-list",wK=cs+"-arch",SK=cs+"-"+Kg,CK=cs+"-form-factors",kK=cs+"-"+$t,EK=cs+"-"+Fe,$3=cs+"-"+Du,AK=$3+"-version",D3=[hw,pw,$t,Fe,Du,gw,ki,ul,Kg],Li="browser",ca="cpu",Bo="device",fa="engine",eo="os",Lu="result",Qg="Amazon",od="Apple",L3="ASUS",N3="BlackBerry",cl="Google",B3="Huawei",P3="Lenovo",IK="Honor",mw="LG",Xg="Microsoft",F3="Motorola",ad="Samsung",z3="Sharp",Jg="Sony",vw="Xiaomi",yw="Zebra",Nu="Mobile ",sd=" Browser",U3="Chrome",fs="Chromecast",TK="Edge",ld="Firefox",ud="Opera",j3="Facebook",q3="Sogou",_w="Windows",MK=typeof window!==us,Ei=MK&&window.navigator?window.navigator:void 0,ds=Ei&&Ei.userAgentData?Ei.userAgentData:void 0,OK=function(e,t){var n={},r=t;if(!tm(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 a in e)n[a]=r[a]&&r[a].length%2===0?r[a].concat(e[a]):e[a];return n},em=function(e){for(var t={},n=0;n<e.length;n++)t[e[n].toUpperCase()]=e[n];return t},bw=function(e,t){if(typeof e===Ru&&e.length>0){for(var n in e)if(da(e[n])==da(t))return!0;return!1}return Bu(e)?da(t).indexOf(da(e))!==-1:!1},tm=function(e,t){for(var n in e)return/^(browser|cpu|device|engine|os)$/.test(n)||(t?tm(e[n]):!1)},Bu=function(e){return typeof e===uw},xw=function(e){if(e){for(var t=[],n=fl(/\\?\"/g,e).split(","),r=0;r<n.length;r++)if(n[r].indexOf(";")>-1){var i=fd(n[r]).split(";v=");t[r]={brand:i[0],version:i[1]}}else t[r]=fd(n[r]);return t}},da=function(e){return Bu(e)?e.toLowerCase():e},ww=function(e){return Bu(e)?fl(/[^\d\.]/g,e).split(".")[0]:void 0},ha=function(e){for(var t in e){var n=e[t];typeof n==Ru&&n.length==2?this[n[0]]=n[1]:this[n]=void 0}return this},fl=function(e,t){return Bu(t)?t.replace(e,Ou):t},cd=function(e){return fl(/\\?\"/g,e)},fd=function(e,t){if(Bu(e))return e=fl(/^\s\s*/,e),typeof t===us?e:e.substring(0,dw)},H3=function(e,t){if(!(!e||!t))for(var n=0,r,i,o,a,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],a=p[o],typeof a===Ru&&a.length>0?a.length===2?typeof a[1]==Wg?this[a[0]]=a[1].call(this,c):this[a[0]]=a[1]:a.length===3?typeof a[1]===Wg&&!(a[1].exec&&a[1].test)?this[a[0]]=c?a[1].call(this,c,a[2]):void 0:this[a[0]]=c?c.replace(a[1],a[2]):void 0:a.length===4&&(this[a[0]]=c?a[3].call(this,c.replace(a[1],a[2])):void 0):this[a]=c||void 0;n+=2}},dd=function(e,t){for(var n in t)if(typeof t[n]===Ru&&t[n].length>0){for(var r=0;r<t[n].length;r++)if(bw(t[n][r],e))return n===O3?void 0:n}else if(bw(t[n],e))return n===O3?void 0:n;return t.hasOwnProperty("*")?t["*"]:e},G3={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"},V3={embedded:"Automotive",mobile:"Mobile",tablet:["Tablet","EInk"],smarttv:"TV",wearable:"Watch",xr:["VR","XR"],"?":["Desktop","Unknown"],"*":void 0},Z3={browser:[[/\b(?:crmo|crios)\/([\w\.]+)/i],[Pe,[Le,Nu+"Chrome"]],[/edg(?:e|ios|a)?\/([\w\.]+)/i],[Pe,[Le,"Edge"]],[/(opera mini)\/([-\w\.]+)/i,/(opera [mobiletab]{3,6})\b.+version\/([-\w\.]+)/i,/(opera)(?:.+version\/|[\/ ]+)([\w\.]+)/i],[Le,Pe],[/opios[\/ ]+([\w\.]+)/i],[Pe,[Le,ud+" Mini"]],[/\bop(?:rg)?x\/([\w\.]+)/i],[Pe,[Le,ud+" GX"]],[/\bopr\/([\w\.]+)/i],[Pe,[Le,ud]],[/\bb[ai]*d(?:uhd|[ub]*[aekoprswx]{5,6})[\/ ]?([\w\.]+)/i],[Pe,[Le,"Baidu"]],[/\b(?:mxbrowser|mxios|myie2)\/?([-\w\.]*)\b/i],[Pe,[Le,"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],[Le,Pe],[/quark(?:pc)?\/([-\w\.]+)/i],[Pe,[Le,"Quark"]],[/\bddg\/([\w\.]+)/i],[Pe,[Le,"DuckDuckGo"]],[/(?:\buc? ?browser|(?:juc.+)ucweb)[\/ ]?([\w\.]+)/i],[Pe,[Le,"UCBrowser"]],[/microm.+\bqbcore\/([\w\.]+)/i,/\bqbcore\/([\w\.]+).+microm/i,/micromessenger\/([\w\.]+)/i],[Pe,[Le,"WeChat"]],[/konqueror\/([\w\.]+)/i],[Pe,[Le,"Konqueror"]],[/trident.+rv[: ]([\w\.]{1,9})\b.+like gecko/i],[Pe,[Le,"IE"]],[/ya(?:search)?browser\/([\w\.]+)/i],[Pe,[Le,"Yandex"]],[/slbrowser\/([\w\.]+)/i],[Pe,[Le,"Smart "+P3+sd]],[/(avast|avg)\/([\w\.]+)/i],[[Le,/(.+)/,"$1 Secure"+sd],Pe],[/\bfocus\/([\w\.]+)/i],[Pe,[Le,ld+" Focus"]],[/\bopt\/([\w\.]+)/i],[Pe,[Le,ud+" Touch"]],[/coc_coc\w+\/([\w\.]+)/i],[Pe,[Le,"Coc Coc"]],[/dolfin\/([\w\.]+)/i],[Pe,[Le,"Dolphin"]],[/coast\/([\w\.]+)/i],[Pe,[Le,ud+" Coast"]],[/miuibrowser\/([\w\.]+)/i],[Pe,[Le,"MIUI"+sd]],[/fxios\/([\w\.-]+)/i],[Pe,[Le,Nu+ld]],[/\bqihoobrowser\/?([\w\.]*)/i],[Pe,[Le,"360"]],[/\b(qq)\/([\w\.]+)/i],[[Le,/(.+)/,"$1Browser"],Pe],[/(oculus|sailfish|huawei|vivo|pico)browser\/([\w\.]+)/i],[[Le,/(.+)/,"$1"+sd],Pe],[/samsungbrowser\/([\w\.]+)/i],[Pe,[Le,ad+" Internet"]],[/metasr[\/ ]?([\d\.]+)/i],[Pe,[Le,q3+" Explorer"]],[/(sogou)mo\w+\/([\d\.]+)/i],[[Le,q3+" Mobile"],Pe],[/(electron)\/([\w\.]+) safari/i,/(tesla)(?: qtcarbrowser|\/(20\d\d\.[-\w\.]+))/i,/m?(qqbrowser|2345(?=browser|chrome|explorer))\w*[\/ ]?v?([\w\.]+)/i],[Le,Pe],[/(lbbrowser|rekonq)/i],[Le],[/ome\/([\w\.]+) \w* ?(iron) saf/i,/ome\/([\w\.]+).+qihu (360)[es]e/i],[Pe,Le],[/((?:fban\/fbios|fb_iab\/fb4a)(?!.+fbav)|;fbav\/([\w\.]+);)/i],[[Le,j3],Pe,[$e,id]],[/(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],[Le,Pe,[$e,id]],[/\bgsa\/([\w\.]+) .*safari\//i],[Pe,[Le,"GSA"],[$e,id]],[/musical_ly(?:.+app_?version\/|_)([\w\.]+)/i],[Pe,[Le,"TikTok"],[$e,id]],[/\[(linkedin)app\]/i],[Le,[$e,id]],[/(chromium)[\/ ]([-\w\.]+)/i],[Le,Pe],[/headlesschrome(?:\/([\w\.]+)| )/i],[Pe,[Le,U3+" Headless"]],[/ wv\).+(chrome)\/([\w\.]+)/i],[[Le,U3+" WebView"],Pe],[/droid.+ version\/([\w\.]+)\b.+(?:mobile safari|safari)/i],[Pe,[Le,"Android"+sd]],[/chrome\/([\w\.]+) mobile/i],[Pe,[Le,Nu+"Chrome"]],[/(chrome|omniweb|arora|[tizenoka]{5} ?browser)\/v?([\w\.]+)/i],[Le,Pe],[/version\/([\w\.\,]+) .*mobile(?:\/\w+ | ?)safari/i],[Pe,[Le,Nu+"Safari"]],[/iphone .*mobile(?:\/\w+ | ?)safari/i],[[Le,Nu+"Safari"]],[/version\/([\w\.\,]+) .*(safari)/i],[Pe,Le],[/webkit.+?(mobile ?safari|safari)(\/[\w\.]+)/i],[Le,[Pe,"1"]],[/(webkit|khtml)\/([\w\.]+)/i],[Le,Pe],[/(?:mobile|tablet);.*(firefox)\/([\w\.-]+)/i],[[Le,Nu+ld],Pe],[/(navigator|netscape\d?)\/([-\w\.]+)/i],[[Le,"Netscape"],Pe],[/(wolvic|librewolf)\/([\w\.]+)/i],[Le,Pe],[/mobile vr; rv:([\w\.]+)\).+firefox/i],[Pe,[Le,ld+" 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],[Le,[Pe,/_/g,"."]],[/(cobalt)\/([\w\.]+)/i],[Le,[Pe,/[^\d\.]+./,Ou]]],cpu:[[/\b(?:(amd|x|x86[-_]?|wow|win)64)\b/i],[[ki,"amd64"]],[/(ia32(?=;))/i,/((?:i[346]|x)86)[;\)]/i],[[ki,"ia32"]],[/\b(aarch64|arm(v?8e?l?|_?64))\b/i],[[ki,"arm64"]],[/\b(arm(?:v[67])?ht?n?[fl]p?)\b/i],[[ki,"armhf"]],[/windows (ce|mobile); ppc;/i],[[ki,"arm"]],[/((?:ppc|powerpc)(?:64)?)(?: mac|;|\))/i],[[ki,/ower/,Ou,da]],[/(sun4\w)[;\)]/i],[[ki,"sparc"]],[/((?:avr32|ia64(?=;))|68k(?=\))|\barm(?=v(?:[1-7]|[5-7]1)l?|;|eabi)|(?=atmel )avr|(?:irix|mips|sparc)(?:64)?\b|pa-risc)/i],[[ki,da]]],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],[Fe,[Ge,ad],[$e,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],[Fe,[Ge,ad],[$e,$t]],[/(?:\/|\()(ip(?:hone|od)[\w, ]*)(?:\/|;)/i],[Fe,[Ge,od],[$e,$t]],[/\((ipad);[-\w\),; ]+apple/i,/applecoremedia\/[\w\.]+ \((ipad)/i,/\b(ipad)\d\d?,\d\d?[;\]].+ios/i],[Fe,[Ge,od],[$e,Bn]],[/(macintosh);/i],[Fe,[Ge,od]],[/\b(sh-?[altvz]?\d\d[a-ekm]?)/i],[Fe,[Ge,z3],[$e,$t]],[/(?:honor)([-\w ]+)[;\)]/i],[Fe,[Ge,IK],[$e,$t]],[/\b((?:ag[rs][23]?|bah2?|sht?|btv)-a?[lw]\d{2})\b(?!.+d\/s)/i],[Fe,[Ge,B3],[$e,Bn]],[/(?:huawei)([-\w ]+)[;\)]/i,/\b(nexus 6p|\w{2,4}e?-[atu]?[ln][\dx][012359c][adn]?)\b(?!.+d\/s)/i],[Fe,[Ge,B3],[$e,$t]],[/\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],[[Fe,/_/g," "],[Ge,vw],[$e,$t]],[/oid[^\)]+; (2\d{4}(283|rpbf)[cgl])( bui|\))/i,/\b(mi[-_ ]?(?:pad)(?:[\w_ ]+))(?: bui|\))/i],[[Fe,/_/g," "],[Ge,vw],[$e,Bn]],[/; (\w+) bui.+ oppo/i,/\b(cph[12]\d{3}|p(?:af|c[al]|d\w|e[ar])[mt]\d0|x9007|a101op)\b/i],[Fe,[Ge,"OPPO"],[$e,$t]],[/\b(opd2\d{3}a?) bui/i],[Fe,[Ge,"OPPO"],[$e,Bn]],[/vivo (\w+)(?: bui|\))/i,/\b(v[12]\d{3}\w?[at])(?: bui|;)/i],[Fe,[Ge,"Vivo"],[$e,$t]],[/\b(rmx[1-3]\d{3})(?: bui|;|\))/i],[Fe,[Ge,"Realme"],[$e,$t]],[/\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],[Fe,[Ge,F3],[$e,$t]],[/\b(mz60\d|xoom[2 ]{0,2}) build\//i],[Fe,[Ge,F3],[$e,Bn]],[/((?=lg)?[vl]k\-?\d{3}) bui| 3\.[-\w; ]{10}lg?-([06cv9]{3,4})/i],[Fe,[Ge,mw],[$e,Bn]],[/(lm(?:-?f100[nv]?|-[\w\.]+)(?= bui|\))|nexus [45])/i,/\blg[-e;\/ ]+((?!browser|netcast|android tv)\w+)/i,/\blg-?([\d\w]+) bui/i],[Fe,[Ge,mw],[$e,$t]],[/(ideatab[-\w ]+)/i,/lenovo ?(s[56]000[-\w]+|tab(?:[\w ]+)|yt[-\d\w]{6}|tb[-\d\w]{6})/i],[Fe,[Ge,P3],[$e,Bn]],[/(?:maemo|nokia).*(n900|lumia \d+)/i,/nokia[-_ ]?([-\w\.]*)/i],[[Fe,/_/g," "],[Ge,"Nokia"],[$e,$t]],[/(pixel c)\b/i],[Fe,[Ge,cl],[$e,Bn]],[/droid.+; (pixel[\daxl ]{0,6})(?: bui|\))/i],[Fe,[Ge,cl],[$e,$t]],[/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],[Fe,[Ge,Jg],[$e,$t]],[/sony tablet [ps]/i,/\b(?:sony)?sgp\w+(?: bui|\))/i],[[Fe,"Xperia Tablet"],[Ge,Jg],[$e,Bn]],[/ (kb2005|in20[12]5|be20[12][59])\b/i,/(?:one)?(?:plus)? (a\d0\d\d)(?: b|\))/i],[Fe,[Ge,"OnePlus"],[$e,$t]],[/(alexa)webm/i,/(kf[a-z]{2}wi|aeo(?!bc)\w\w)( bui|\))/i,/(kf[a-z]+)( bui|\)).+silk\//i],[Fe,[Ge,Qg],[$e,Bn]],[/((?:sd|kf)[0349hijorstuw]+)( bui|\)).+silk\//i],[[Fe,/(.+)/g,"Fire Phone $1"],[Ge,Qg],[$e,$t]],[/(playbook);[-\w\),; ]+(rim)/i],[Fe,Ge,[$e,Bn]],[/\b((?:bb[a-f]|st[hv])100-\d)/i,/\(bb10; (\w+)/i],[Fe,[Ge,N3],[$e,$t]],[/(?:\b|asus_)(transfo[prime ]{4,10} \w+|eeepc|slider \w+|nexus 7|padfone|p00[cj])/i],[Fe,[Ge,L3],[$e,Bn]],[/ (z[bes]6[027][012][km][ls]|zenfone \d\w?)\b/i],[Fe,[Ge,L3],[$e,$t]],[/(nexus 9)/i],[Fe,[Ge,"HTC"],[$e,Bn]],[/(htc)[-;_ ]{1,2}([\w ]+(?=\)| bui)|\w+)/i,/(zte)[- ]([\w ]+?)(?: bui|\/|\))/i,/(alcatel|geeksphone|nexian|panasonic(?!(?:;|\.))|sony(?!-bra))[-_ ]?([-\w]*)/i],[Ge,[Fe,/_/g," "],[$e,$t]],[/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],[Fe,[Ge,"TCL"],[$e,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],[Fe,[Ge,"TCL"],[$e,$t]],[/(itel) ((\w+))/i],[[Ge,da],Fe,[$e,dd,{tablet:["p10001l","w7001"],"*":"mobile"}]],[/droid.+; ([ab][1-7]-?[0178a]\d\d?)/i],[Fe,[Ge,"Acer"],[$e,Bn]],[/droid.+; (m[1-5] note) bui/i,/\bmz-([-\w]{2,})/i],[Fe,[Ge,"Meizu"],[$e,$t]],[/; ((?:power )?armor(?:[\w ]{0,8}))(?: bui|\))/i],[Fe,[Ge,"Ulefone"],[$e,$t]],[/; (energy ?\w+)(?: bui|\))/i,/; energizer ([\w ]+)(?: bui|\))/i],[Fe,[Ge,"Energizer"],[$e,$t]],[/; cat (b35);/i,/; (b15q?|s22 flip|s48c|s62 pro)(?: bui|\))/i],[Fe,[Ge,"Cat"],[$e,$t]],[/((?:new )?andromax[\w- ]+)(?: bui|\))/i],[Fe,[Ge,"Smartfren"],[$e,$t]],[/droid.+; (a(?:015|06[35]|142p?))/i],[Fe,[Ge,"Nothing"],[$e,$t]],[/(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],[Ge,Fe,[$e,$t]],[/(imo) (tab \w+)/i,/(kobo)\s(ereader|touch)/i,/(archos) (gamepad2?)/i,/(hp).+(touchpad(?!.+tablet)|tablet)/i,/(kindle)\/([\w\.]+)/i],[Ge,Fe,[$e,Bn]],[/(surface duo)/i],[Fe,[Ge,Xg],[$e,Bn]],[/droid [\d\.]+; (fp\du?)(?: b|\))/i],[Fe,[Ge,"Fairphone"],[$e,$t]],[/(shield[\w ]+) b/i],[Fe,[Ge,"Nvidia"],[$e,Bn]],[/(sprint) (\w+)/i],[Ge,Fe,[$e,$t]],[/(kin\.[onetw]{3})/i],[[Fe,/\./g," "],[Ge,Xg],[$e,$t]],[/droid.+; ([c6]+|et5[16]|mc[239][23]x?|vc8[03]x?)\)/i],[Fe,[Ge,yw],[$e,Bn]],[/droid.+; (ec30|ps20|tc[2-8]\d[kx])\)/i],[Fe,[Ge,yw],[$e,$t]],[/smart-tv.+(samsung)/i],[Ge,[$e,ii]],[/hbbtv.+maple;(\d+)/i],[[Fe,/^/,"SmartTV"],[Ge,ad],[$e,ii]],[/(nux; netcast.+smarttv|lg (netcast\.tv-201\d|android tv))/i],[[Ge,mw],[$e,ii]],[/(apple) ?tv/i],[Ge,[Fe,od+" TV"],[$e,ii]],[/crkey.*devicetype\/chromecast/i],[[Fe,fs+" Third Generation"],[Ge,cl],[$e,ii]],[/crkey.*devicetype\/([^/]*)/i],[[Fe,/^/,"Chromecast "],[Ge,cl],[$e,ii]],[/fuchsia.*crkey/i],[[Fe,fs+" Nest Hub"],[Ge,cl],[$e,ii]],[/crkey/i],[[Fe,fs],[Ge,cl],[$e,ii]],[/droid.+aft(\w+)( bui|\))/i],[Fe,[Ge,Qg],[$e,ii]],[/\(dtv[\);].+(aquos)/i,/(aquos-tv[\w ]+)\)/i],[Fe,[Ge,z3],[$e,ii]],[/(bravia[\w ]+)( bui|\))/i],[Fe,[Ge,Jg],[$e,ii]],[/(mitv-\w{5}) bui/i],[Fe,[Ge,vw],[$e,ii]],[/Hbbtv.*(technisat) (.*);/i],[Ge,Fe,[$e,ii]],[/\b(roku)[\dx]*[\)\/]((?:dvp-)?[\d\.]*)/i,/hbbtv\/\d+\.\d+\.\d+ +\([\w\+ ]*; *([\w\d][^;]*);([^;]*)/i],[[Ge,fd],[Fe,fd],[$e,ii]],[/\b(android tv|smart[- ]?tv|opera tv|tv; rv:)\b/i],[[$e,ii]],[/(ouya)/i,/(nintendo) (\w+)/i],[Ge,Fe,[$e,$u]],[/droid.+; (shield) bui/i],[Fe,[Ge,"Nvidia"],[$e,$u]],[/(playstation \w+)/i],[Fe,[Ge,Jg],[$e,$u]],[/\b(xbox(?: one)?(?!; xbox))[\); ]/i],[Fe,[Ge,Xg],[$e,$u]],[/\b(sm-[lr]\d\d[05][fnuw]?s?)\b/i],[Fe,[Ge,ad],[$e,rd]],[/((pebble))app/i],[Ge,Fe,[$e,rd]],[/(watch)(?: ?os[,\/]|\d,\d\/)[\d\.]+/i],[Fe,[Ge,od],[$e,rd]],[/droid.+; (wt63?0{2,3})\)/i],[Fe,[Ge,yw],[$e,rd]],[/droid.+; (glass) \d/i],[Fe,[Ge,cl],[$e,cw]],[/(pico) (4|neo3(?: link|pro)?)/i],[Ge,Fe,[$e,cw]],[/; (quest( \d| pro)?)/i],[Fe,[Ge,j3],[$e,cw]],[/(tesla)(?: qtcarbrowser|\/[-\w\.]+)/i],[Ge,[$e,fw]],[/(aeobc)\b/i],[Fe,[Ge,Qg],[$e,fw]],[/droid .+?; ([^;]+?)(?: bui|; wv\)|\) applew).+? mobile safari/i],[Fe,[$e,$t]],[/droid .+?; ([^;]+?)(?: bui|\) applew).+?(?! mobile) safari/i],[Fe,[$e,Bn]],[/\b((tablet|tab)[;\/]|focus\/\d(?!.+mobile))/i],[[$e,Bn]],[/(phone|mobile(?:[;\/]| [ \w\/\.]*safari)|pda(?=.+windows ce))/i],[[$e,$t]],[/(android[-\w\. ]{0,9});.+buil/i],[Fe,[Ge,"Generic"]]],engine:[[/windows.+ edge\/([\w\.]+)/i],[Pe,[Le,TK+"HTML"]],[/(arkweb)\/([\w\.]+)/i],[Le,Pe],[/webkit\/537\.36.+chrome\/(?!27)([\w\.]+)/i],[Pe,[Le,"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],[Le,Pe],[/rv\:([\w\.]{1,9})\b.+(gecko)/i],[Pe,Le]],os:[[/microsoft (windows) (vista|xp)/i],[Le,Pe],[/(windows (?:phone(?: os)?|mobile))[\/ ]?([\d\.\w ]*)/i],[Le,[Pe,dd,G3]],[/windows nt 6\.2; (arm)/i,/windows[\/ ]?([ntce\d\. ]+\w)(?!.+xbox)/i,/(?:win(?=3|9|n)|win 9x )([nt\d\.]+)/i],[[Pe,dd,G3],[Le,_w]],[/ip[honead]{2,4}\b(?:.*os ([\w]+) like mac|; opera)/i,/(?:ios;fbsv\/|iphone.+ios[\/ ])([\d\.]+)/i,/cfnetwork\/.+darwin/i],[[Pe,/_/g,"."],[Le,"iOS"]],[/(mac os x) ?([\w\. ]*)/i,/(macintosh|mac_powerpc\b)(?!.+haiku)/i],[[Le,"macOS"],[Pe,/_/g,"."]],[/android ([\d\.]+).*crkey/i],[Pe,[Le,fs+" Android"]],[/fuchsia.*crkey\/([\d\.]+)/i],[Pe,[Le,fs+" Fuchsia"]],[/crkey\/([\d\.]+).*devicetype\/smartspeaker/i],[Pe,[Le,fs+" SmartSpeaker"]],[/linux.*crkey\/([\d\.]+)/i],[Pe,[Le,fs+" Linux"]],[/crkey\/([\d\.]+)/i],[Pe,[Le,fs]],[/droid ([\w\.]+)\b.+(android[- ]x86|harmonyos)/i],[Pe,Le],[/(android|webos|qnx|bada|rim tablet os|maemo|meego|sailfish|openharmony)[-\/ ]?([\w\.]*)/i,/(blackberry)\w*\/([\w\.]*)/i,/(tizen|kaios)[\/ ]([\w\.]+)/i,/\((series40);/i],[Le,Pe],[/\(bb(10);/i],[Pe,[Le,N3]],[/(?:symbian ?os|symbos|s60(?=;)|series60)[-\/ ]?([\w\.]*)/i],[Pe,[Le,"Symbian"]],[/mozilla\/[\d\.]+ \((?:mobile|tablet|tv|mobile; [\w ]+); rv:.+ gecko\/([\w\.]+)/i],[Pe,[Le,ld+" OS"]],[/web0s;.+rt(tv)/i,/\b(?:hp)?wos(?:browser)?\/([\w\.]+)/i],[Pe,[Le,"webOS"]],[/watch(?: ?os[,\/]|\d,\d\/)([\d\.]+)/i],[Pe,[Le,"watchOS"]],[/(cros) [\w]+(?:\)| ([\w\.]+)\b)/i],[[Le,"Chrome OS"],Pe],[/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],[Le,Pe],[/(sunos) ?([\w\.\d]*)/i],[[Le,"Solaris"],Pe],[/((?:open)?solaris)[-\/ ]?([\w\.]*)/i,/(aix) ((\d)(?=\.|\)| )[\w\.])*/i,/\b(beos|os\/2|amigaos|morphos|openvms|fuchsia|hp-ux|serenityos)/i,/(unix) ?([\w\.]*)/i],[Le,Pe]]},nm=function(){var e={init:{},isIgnore:{},isIgnoreRgx:{},toString:{}};return ha.call(e.init,[[Li,[Le,Pe,nd,$e]],[ca,[ki]],[Bo,[$e,Fe,Ge]],[fa,[Le,Pe]],[eo,[Le,Pe]]]),ha.call(e.isIgnore,[[Li,[Pe,nd]],[fa,[Pe]],[eo,[Pe]]]),ha.call(e.isIgnoreRgx,[[Li,/ ?browser$/i],[eo,/ ?os$/i]]),ha.call(e.toString,[[Li,[Le,Pe]],[ca,[ki]],[Bo,[Ge,Fe]],[fa,[Le,Pe]],[eo,[Le,Pe]]]),e}(),RK=function(e,t){var n=nm.init[t],r=nm.isIgnore[t]||0,i=nm.isIgnoreRgx[t]||0,o=nm.toString[t]||0;function a(){ha.call(this,n)}return a.prototype.getItem=function(){return e},a.prototype.withClientHints=function(){return ds?ds.getHighEntropyValues(D3).then(function(u){return e.setCH(new Y3(u,!1)).parseCH().get()}):e.parseCH().get()},a.prototype.withFeatureCheck=function(){return e.detectFeature().get()},t!=Lu&&(a.prototype.is=function(u){var c=!1;for(var d in this)if(this.hasOwnProperty(d)&&!bw(r,d)&&da(i?fl(i,this[d]):this[d])==da(i?fl(i,u):u)){if(c=!0,u!=us)break}else if(u==us&&c){c=!c;break}return c},a.prototype.toString=function(){var u=Ou;for(var c in o)typeof this[o[c]]!==us&&(u+=(u?" ":Ou)+this[o[c]]);return u||us}),ds||(a.prototype.then=function(u){var c=this,d=function(){for(var h in c)c.hasOwnProperty(h)&&(this[h]=c[h])};d.prototype={is:a.prototype.is,toString:a.prototype.toString};var p=new d;return u(p),p}),new a};function Y3(e,t){if(e=e||{},ha.call(this,D3),t)ha.call(this,[[hw,xw(e[cs])],[pw,xw(e[xK])],[$t,/\?1/.test(e[kK])],[Fe,cd(e[EK])],[Du,cd(e[$3])],[gw,cd(e[AK])],[ki,cd(e[wK])],[ul,xw(e[CK])],[Kg,cd(e[SK])]]);else for(var n in e)this.hasOwnProperty(n)&&typeof e[n]!==us&&(this[n]=e[n])}function W3(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(Ei&&Ei.userAgent==this.ua)switch(this.itemType){case Li:Ei.brave&&typeof Ei.brave.isBrave==Wg&&this.set(Le,"Brave");break;case Bo:!this.get($e)&&ds&&ds[$t]&&this.set($e,$t),this.get(Fe)=="Macintosh"&&Ei&&typeof Ei.standalone!==us&&Ei.maxTouchPoints&&Ei.maxTouchPoints>2&&this.set(Fe,"iPad").set($e,Bn);break;case eo:!this.get(Le)&&ds&&ds[Du]&&this.set(Le,ds[Du]);break;case Lu:var i=this.data,o=function(a){return i[a].getItem().detectFeature().get()};this.set(Li,o(Li)).set(ca,o(ca)).set(Bo,o(Bo)).set(fa,o(fa)).set(eo,o(eo))}return this},this.parseUA=function(){return this.itemType!=Lu&&H3.call(this.data,this.ua,this.rgxMap),this.itemType==Li&&this.set(nd,ww(this.get(Pe))),this},this.parseCH=function(){var i=this.uaCH,o=this.rgxMap;switch(this.itemType){case Li:var a=i[pw]||i[hw],u;if(a)for(var c in a){var d=fl(/(Google|Microsoft) /,a[c].brand||a[c]),p=a[c].version;!/not.a.brand/i.test(d)&&(!u||/chrom/i.test(u)&&!/chromi/i.test(d))&&(this.set(Le,d).set(Pe,p).set(nd,ww(p)),u=d)}break;case ca:var h=i[ki];h&&(h&&i[Kg]=="64"&&(h+="64"),H3.call(this.data,h+";",o));break;case Bo:if(i[$t]&&this.set($e,$t),i[Fe]&&this.set(Fe,i[Fe]),i[Fe]=="Xbox"&&this.set($e,$u).set(Ge,Xg),i[ul]){var m;if(typeof i[ul]!="string")for(var v=0;!m&&v<i[ul].length;)m=dd(i[ul][v++],V3);else m=dd(i[ul],V3);this.set($e,m)}break;case eo:var _=i[Du];if(_){var S=i[gw];_==_w&&(S=parseInt(ww(S),10)>=13?"11":"10"),this.set(Le,_).set(Pe,S)}this.get(Le)==_w&&i[Fe]=="Xbox"&&this.set(Le,"Xbox").set(Pe,void 0);break;case Lu:var x=this.data,b=function(k){return x[k].getItem().setCH(i).parseCH().get()};this.set(Li,b(Li)).set(ca,b(ca)).set(Bo,b(Bo)).set(fa,b(fa)).set(eo,b(eo))}return this},ha.call(this,[["itemType",e],["ua",t],["uaCH",r],["rgxMap",n],["data",RK(this,e)]]),this}function pa(e,t,n){if(typeof e===Ru?(tm(e,!0)?(typeof t===Ru&&(n=t),t=e):(n=e,t=void 0),e=void 0):typeof e===uw&&!tm(t,!0)&&(n=t,t=void 0),n&&typeof n.append===Wg){var r={};n.forEach(function(c,d){r[d]=c}),n=r}if(!(this instanceof pa))return new pa(e,t,n).getResult();var i=typeof e===uw?e:n&&n[R3]?n[R3]:Ei&&Ei.userAgent?Ei.userAgent:Ou,o=new Y3(n,!0),a=t?OK(Z3,t):Z3,u=function(c){return c==Lu?function(){return new W3(c,i,a,o).set("ua",i).set(Li,this.getBrowser()).set(ca,this.getCPU()).set(Bo,this.getDevice()).set(fa,this.getEngine()).set(eo,this.getOS()).get()}:function(){return new W3(c,i,a[c],o).parseUA().get()}};return ha.call(this,[["getBrowser",u(Li)],["getCPU",u(ca)],["getDevice",u(Bo)],["getEngine",u(fa)],["getOS",u(eo)],["getResult",u(Lu)],["getUA",function(){return i}],["setUA",function(c){return Bu(c)&&(i=c.length>dw?fd(c,dw):c),this}]]).setUA(i),this}pa.VERSION=bK,pa.BROWSER=em([Le,Pe,nd,$e]),pa.CPU=em([ki]),pa.DEVICE=em([Fe,Ge,$e,$u,$t,ii,Bn,rd,fw]),pa.ENGINE=pa.OS=em([Le,Pe]);const no=class no{constructor(t){Cr(this,"config");Cr(this,"storedData");Cr(this,"deviceInfo");Cr(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){no.instance||(no.instance=new no(t))}static getInstance(){if(!no.instance)throw new Error("DebalesAnalytics is not initialized. Call init() first.");return no.instance}static async identify(t,n){return no.getInstance().identifyInternal(t,n)}static track(t,n){no.getInstance().trackInternal(t,n)}static getDistinctId(){return no.getInstance().storedData.distinctId}static getAnonId(){return no.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 a={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",a);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:",a)}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:an()+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(`${Zn}${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 pa().getResult();return{browser:n.browser.name,os:n.os.name,browserVersion:n.browser.version,osVersion:n.os.version}}};Cr(no,"instance",null);let Sw=no;const Po=Sw;function $K(e){yT(e,[/\r?\n|\r/g,DK])}function DK(){return{type:"break"}}function rm(){return function(e){$K(e)}}const mt={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",SHOPIFY_LINK_CLICKED:"shopify_link_clicked"},hn={OPEN_STATE_CHANGE:"open_state_change"},im=e=>{window.DebalesChat||(window.DebalesChat={isOpen:!1,projectId:e,getSessionId:()=>an(),getChatId:()=>an()+"_"+e,getAnonId:()=>Po.getAnonId(),isIdentified:()=>{if(Yi._isIdentified())return!0;const t=Nr();return!!(t&&t.email)},getIdentifiedUser:()=>Nr(),getDistinctId:()=>Yi.get_distinct_id(),getOldDistinctId:()=>Po.getDistinctId(),debug:!1,identify:(t,n)=>{Yi._isIdentified()||Yi.identify(t,{...n,project:e}),Po.identify(t,n),ua({email:t,name:n==null?void 0:n.name,phone:n==null?void 0:n.phone})},track:(t,n)=>{Po.track(t,{...n,sessionId:window.DebalesChat.getSessionId()}),Yi.capture(t,{...n}),vK(t,{...n,sessionId:an(),projectId:e})},onOpenChange:t=>{const n=r=>{t(r.detail.isOpen)};return window.addEventListener(hn.OPEN_STATE_CHANGE,n),()=>window.removeEventListener(hn.OPEN_STATE_CHANGE,n)},removeOpenChangeListener:t=>{const n=r=>{t(r.detail.isOpen)};window.removeEventListener(hn.OPEN_STATE_CHANGE,n)},open:()=>{window.DebalesChat.isOpen||window.dispatchEvent(new CustomEvent(hn.OPEN_STATE_CHANGE,{detail:{isOpen:!0,projectId:e}}))},close:()=>{window.DebalesChat.isOpen&&window.dispatchEvent(new CustomEvent(hn.OPEN_STATE_CHANGE,{detail:{isOpen:!1,projectId:e}}))},toggle:()=>{window.dispatchEvent(new CustomEvent(hn.OPEN_STATE_CHANGE,{detail:{isOpen:!window.DebalesChat.isOpen,projectId:e}}))}})};var Pr=(e=>(e.DEFAULT="DEFAULT",e.SHOPIFY="SHOPIFY",e.WOOCOMMERCE="WOOCOMMERCE",e.MAGENTO="MAGENTO",e.UNKNOWN="UNKNOWN",e))(Pr||{});class hs{static detect(){var t,n,r,i,o,a;if(typeof window<"u"&&window.Shopify!==void 0&&window.Shopify.routes!==void 0)return Pr.SHOPIFY;if(typeof window<"u"&&document.body.classList.contains("woocommerce"))return Pr.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 Pr.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 Pr.MAGENTO;if(document.cookie.split(";").some(h=>h.trim().startsWith("mage-")||h.trim().startsWith("form_key")))return Pr.MAGENTO;const p=document.getElementsByTagName("meta");for(const h of Array.from(p))if((o=h.getAttribute("content"))!=null&&o.includes("Magento")||(a=h.getAttribute("name"))!=null&&a.includes("magento"))return Pr.MAGENTO}return Pr.UNKNOWN}}const om=z.button`
|
|
139
|
+
`);var t="",n,r,i=0,o;for(n=r=0,i=e.length,o=0;o<i;o++){var a=e.charCodeAt(o),u=null;a<128?r++:a>127&&a<2048?u=String.fromCharCode(a>>6|192,a&63|128):u=String.fromCharCode(a>>12|224,a>>6&63|128,a&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},O.UUID=function(){try{return it.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]="-",O.map(e,function(r){return r.toString(16)}).join("")}};var B$=["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"];O.isBlockedUA=function(e){var t;for(e=e.toLowerCase(),t=0;t<B$.length;t++)if(e.indexOf(B$[t])!==-1)return!0;return!1},O.HTTPBuildQuery=function(e,t){var n,r,i=[];return O.isUndefined(t)&&(t="&"),O.each(e,function(o,a){n=encodeURIComponent(o.toString()),r=encodeURIComponent(a),i[i.length]=r+"="+n}),i.join(t)},O.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{on.error("Skipping decoding for malformed query param: "+o)}return o.replace(/\+/g," ")},O.cookie={get:function(e){for(var t=e+"=",n=dn.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=O.JSONDecode(O.cookie.get(e))||{}}catch{}return t},set_seconds:function(e,t,n,r,i,o,a){var u="",c="",d="";if(a)u="; domain="+a;else if(r){var p=z$(dn.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"),dn.cookie=e+"="+encodeURIComponent(t)+c+"; path=/"+u+d},set:function(e,t,n,r,i,o,a){var u="",c="",d="";if(a)u="; domain="+a;else if(r){var p=z$(dn.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 dn.cookie=m,m},remove:function(e,t,n){O.cookie.set(e,"",-1,t,!1,!1,n)}};var P$=function(e){var t=!0;try{var n="__mplss_"+Nx(8),r="xyz";e.setItem(n,r),e.getItem(n)!==r&&(t=!1),e.removeItem(n)}catch{t=!1}return t},Dx=null,Yf=function(e,t){return Dx!==null&&!t?Dx:Dx=P$(e||it.localStorage)},Lx=null,yW=function(e,t){return Lx!==null&&!t?Lx:Lx=P$(e||it.sessionStorage)};function F$(e,t,n){var r=function(i){on.error(t+" error: "+i)};return{is_supported:function(i){var o=n(e,i);return o||on.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 O.JSONDecode(e.getItem(i))||{}}catch{}return null},set:function(i,o){try{e.setItem(i,o)}catch(a){r(a)}},remove:function(i){try{e.removeItem(i)}catch(o){r(o)}}}}O.localStorage=F$(it.localStorage,"localStorage",Yf),O.sessionStorage=F$(it.sessionStorage,"sessionStorage",yW),O.register_event=function(){var e=function(r,i,o,a,u){if(!r){on.error("No valid element provided to register_event");return}if(r.addEventListener&&!a)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 a=function(u){if(u=u||n(it.event),!!u){var c=!0,d,p;return O.isFunction(o)&&(d=o(u)),p=i.call(r,u),(d===!1||p===!1)&&(c=!1),c}};return a}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 _W=new RegExp('^(\\w*)\\[(\\w+)([=~\\|\\^\\$\\*]?)=?"?([^\\]"]*)"?\\]$');O.dom_query=function(){function e(i){return i.all?i.all:i.getElementsByTagName("*")}var t=/[\t\r\n]/g;function n(i,o){var a=" "+o+" ";return(" "+i.className+" ").replace(t," ").indexOf(a)>=0}function r(i){if(!dn.getElementsByTagName)return[];var o=i.split(" "),a,u,c,d,p,h,m,v,_,S,x=[dn];for(h=0;h<o.length;h++){if(a=o[h].replace(/^\s+/,"").replace(/\s+$/,""),a.indexOf("#")>-1){u=a.split("#"),c=u[0];var b=u[1],k=dn.getElementById(b);if(!k||c&&k.nodeName.toLowerCase()!=c)return[];x=[k];continue}if(a.indexOf(".")>-1){u=a.split("."),c=u[0];var E=u[1];for(c||(c="*"),d=[],p=0,m=0;m<x.length;m++)for(c=="*"?_=e(x[m]):_=x[m].getElementsByTagName(c),v=0;v<_.length;v++)d[p++]=_[v];for(x=[],S=0,m=0;m<d.length;m++)d[m].className&&O.isString(d[m].className)&&n(d[m],E)&&(x[S++]=d[m]);continue}var A=a.match(_W);if(A){c=A[1];var I=A[2],$=A[3],B=A[4];for(c||(c="*"),d=[],p=0,m=0;m<x.length;m++)for(c=="*"?_=e(x[m]):_=x[m].getElementsByTagName(c),v=0;v<_.length;v++)d[p++]=_[v];x=[],S=0;var U;switch($){case"=":U=function(G){return G.getAttribute(I)==B};break;case"~":U=function(G){return G.getAttribute(I).match(new RegExp("\\b"+B+"\\b"))};break;case"|":U=function(G){return G.getAttribute(I).match(new RegExp("^"+B+"-?"))};break;case"^":U=function(G){return G.getAttribute(I).indexOf(B)===0};break;case"$":U=function(G){return G.getAttribute(I).lastIndexOf(B)==G.getAttribute(I).length-B.length};break;case"*":U=function(G){return G.getAttribute(I).indexOf(B)>-1};break;default:U=function(G){return G.getAttribute(I)}}for(x=[],S=0,m=0;m<d.length;m++)U(d[m])&&(x[S++]=d[m]);continue}for(c=a,d=[],p=0,m=0;m<x.length;m++)for(_=x[m].getElementsByTagName(c),v=0;v<_.length;v++)d[p++]=_[v];x=d}return x}return function(i){return O.isElement(i)?[i]:O.isObject(i)&&!O.isUndefined(i.length)?i:r.call(this,i)}}();var bW=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","utm_id","utm_source_platform","utm_campaign_id","utm_creative_format","utm_marketing_tactic"],xW=["dclid","fbclid","gclid","ko_click_id","li_fat_id","msclkid","sccid","ttclid","twclid","wbraid"];O.info={campaignParams:function(e){var t="",n={};return O.each(bW,function(r){t=O.getQueryParam(dn.URL,r),t.length?n[r]=t:e!==void 0&&(n[r]=e)}),n},clickParams:function(){var e="",t={};return O.each(xW,function(n){e=O.getQueryParam(dn.URL,n),e.length&&(t[n]=e)}),t},marketingParams:function(){return O.extend(O.info.campaignParams(),O.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=O.info.searchEngine(e),n=t!="yahoo"?"q":"p",r={};if(t!==null){r.$search_engine=t;var i=O.getQueryParam(e,n);i.length&&(r.mp_keyword=i)}return r},browser:function(e,t,n){return t=t||"",n||O.includes(e," OPR/")?O.includes(e,"Mini")?"Opera Mini":"Opera":/(BlackBerry|PlayBook|BB10)/i.test(e)?"BlackBerry":O.includes(e,"IEMobile")||O.includes(e,"WPDesktop")?"Internet Explorer Mobile":O.includes(e,"SamsungBrowser/")?"Samsung Internet":O.includes(e,"Edge")||O.includes(e,"Edg/")?"Microsoft Edge":O.includes(e,"FBIOS")?"Facebook Mobile":O.includes(e,"Chrome")?"Chrome":O.includes(e,"CriOS")?"Chrome iOS":O.includes(e,"UCWEB")||O.includes(e,"UCBrowser")?"UC Browser":O.includes(e,"FxiOS")?"Firefox iOS":O.includes(t,"Apple")?O.includes(e,"Mobile")?"Mobile Safari":"Safari":O.includes(e,"Android")?"Android Mobile":O.includes(e,"Konqueror")?"Konqueror":O.includes(e,"Firefox")?"Firefox":O.includes(e,"MSIE")||O.includes(e,"Trident/")?"Internet Explorer":O.includes(e,"Gecko")?"Mozilla":""},browserVersion:function(e,t,n){var r=O.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 a=e.match(o);return a?parseFloat(a[a.length-2]):null},os:function(){var e=oa;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 it.location.href},properties:function(e){return typeof e!="object"&&(e={}),O.extend(O.strip_empty_properties({$os:O.info.os(),$browser:O.info.browser(oa,rs.vendor,Pg),$referrer:dn.referrer,$referring_domain:O.info.referringDomain(dn.referrer),$device:O.info.device(oa)}),{$current_url:O.info.currentUrl(),$browser_version:O.info.browserVersion(oa,rs.vendor,Pg),$screen_height:$$.height,$screen_width:$$.width,mp_lib:"web",$lib_version:_o.LIB_VERSION,$insert_id:Nx(),time:O.timestamp()/1e3},O.strip_empty_properties(e))},people_properties:function(){return O.extend(O.strip_empty_properties({$os:O.info.os(),$browser:O.info.browser(oa,rs.vendor,Pg)}),{$browser_version:O.info.browserVersion(oa,rs.vendor,Pg)})},mpPageViewProperties:function(){return O.strip_empty_properties({current_page_title:dn.title,current_domain:it.location.hostname,current_url_path:it.location.pathname,current_url_protocol:it.location.protocol,current_url_search:it.location.search})}};var wW=function(e,t){var n=null,r=[];return function(i){var o=this;return r.push(i),n||(n=new ln(function(a){setTimeout(function(){var u=e.apply(o,[r]);n=null,r=[],a(u)},t)})),n}},Nx=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},SW=/[a-z0-9][a-z0-9-]*\.[a-z]+$/i,CW=/[a-z0-9][a-z0-9-]+\.[a-z.]{2,6}$/i,z$=function(e){var t=CW,n=e.split("."),r=n[n.length-1];(r.length>4||r==="com"||r==="org")&&(t=SW);var i=e.match(t);return i?i[0]:""},kW=function(){var e=it.navigator.onLine;return O.isUndefined(e)||e},is=function(){},wu=null,Fg=null;typeof JSON<"u"&&(wu=JSON.stringify,Fg=JSON.parse),wu=wu||O.JSONEncode,Fg=Fg||O.JSONDecode,O.info=O.info,O.info.browser=O.info.browser,O.info.browserVersion=O.info.browserVersion,O.info.device=O.info.device,O.info.properties=O.info.properties,O.isBlockedUA=O.isBlockedUA,O.isEmptyObject=O.isEmptyObject,O.isObject=O.isObject,O.JSONDecode=O.JSONDecode,O.JSONEncode=O.JSONEncode,O.toArray=O.toArray,O.NPO=ts;var EW="mixpanelBrowserDb",U$="mixpanelRecordingEvents",Bx="mixpanelRecordingRegistry",AW=1,IW=[U$,Bx],$o=function(e){this.dbPromise=null,this.storeName=e};$o.prototype._openDb=function(){return new ln(function(e,t){var n=it.indexedDB.open(EW,AW);n.onerror=function(){t(n.error)},n.onsuccess=function(){e(n.result)},n.onupgradeneeded=function(r){var i=r.target.result;IW.forEach(function(o){i.createObjectStore(o)})}})},$o.prototype.init=function(){return it.indexedDB?(this.dbPromise||(this.dbPromise=this._openDb()),this.dbPromise.then(function(e){return e instanceof it.IDBDatabase?ln.resolve():ln.reject(e)})):ln.reject("indexedDB is not supported in this browser")},$o.prototype.makeTransaction=function(e,t){var n=this.storeName,r=function(i){return new ln(function(o,a){var u=i.transaction(n,e);u.oncomplete=function(){o(u)},u.onabort=u.onerror=function(){a(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)):ln.reject(i)}).bind(this))},$o.prototype.setItem=function(e,t){return this.makeTransaction("readwrite",function(n){n.put(t,e)})},$o.prototype.getItem=function(e){var t;return this.makeTransaction("readonly",function(n){t=n.get(e)}).then(function(){return t.result})},$o.prototype.removeItem=function(e){return this.makeTransaction("readwrite",function(t){t.delete(e)})},$o.prototype.getAll=function(){var e;return this.makeTransaction("readonly",function(t){e=t.getAll()}).then(function(){return e.result})};var TW="__mp_opt_in_out_";function MW(e,t){H$(!0,e,t)}function OW(e,t){H$(!1,e,t)}function RW(e,t){return q$(e,t)==="1"}function j$(e,t){if(DW(t))return on.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=q$(e,t)==="0";return n&&on.warn("You are opted out of Mixpanel tracking. This will prevent the Mixpanel SDK from sending any data."),n}function os(e){return zx(e,function(t){return this.get_config(t)})}function as(e){return zx(e,function(t){return this._get_config(t)})}function Su(e){return zx(e,function(t){return this._get_config(t)})}function $W(e,t){t=t||{},Px(t).remove(Fx(e,t),!!t.crossSubdomainCookie,t.cookieDomain)}function Px(e){return e=e||{},e.persistenceType==="localStorage"?O.localStorage:O.cookie}function Fx(e,t){return t=t||{},(t.persistencePrefix||TW)+e}function q$(e,t){return Px(t).get(Fx(e,t))}function DW(e){if(e&&e.ignoreDnt)return!1;var t=e&&e.window||it,n=t.navigator||{},r=!1;return O.each([n.doNotTrack,n.msDoNotTrack,t.doNotTrack],function(i){O.includes([!0,1,"1","yes"],i)&&(r=!0)}),r}function H$(e,t,n){if(!O.isString(t)||!t.length){on.error("gdpr."+(e?"optIn":"optOut")+" called with an invalid token");return}n=n||{},Px(n).set(Fx(t,n),e?1:0,O.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 zx(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"),a=t.call(this,"opt_out_tracking_cookie_prefix"),u=t.call(this,"window");r&&(n=j$(r,{ignoreDnt:i,persistenceType:o,persistencePrefix:a,window:u}))}catch(d){on.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 LW=xu("lock"),G$=function(e,t){t=t||{},this.storageKey=e,this.storage=t.storage||it.localStorage,this.pollIntervalMS=t.pollIntervalMS||100,this.timeoutMS=t.timeoutMS||2e3,this.promiseImpl=t.promiseImpl||ln};G$.prototype.withLock=function(e,t){var n=this.promiseImpl;return new n(O.bind(function(r,i){var o=t||new Date().getTime()+"|"+Math.random(),a=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()-a>d){LW.error("Timeout waiting for mutex on "+u+"; clearing lock. ["+o+"]"),p.removeItem(v),p.removeItem(m),b();return}setTimeout(function(){try{E()}catch(A){i(A)}},c*(Math.random()+.1))},S=function(E,A){E()?A():_(function(){S(E,A)})},x=function(){var E=p.getItem(m);return E&&E!==o?!1:(p.setItem(m,o),p.getItem(m)===o?!0:(Yf(p,!0)||i(new Error("localStorage support dropped while acquiring lock")),!1))},b=function(){p.setItem(h,o),S(x,function(){if(p.getItem(h)===o){k();return}_(function(){if(p.getItem(m)!==o){b();return}S(function(){return!p.getItem(v)},k)})})},k=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(A){E(),r(A)}).catch(function(A){E(),i(A)})};try{if(Yf(p,!0))b();else throw new Error("localStorage support check failed")}catch(E){i(E)}},this))};var Wf=function(e){this.storage=e||it.localStorage};Wf.prototype.init=function(){return ln.resolve()},Wf.prototype.setItem=function(e,t){return new ln(O.bind(function(n,r){try{this.storage.setItem(e,wu(t))}catch(i){r(i)}n()},this))},Wf.prototype.getItem=function(e){return new ln(O.bind(function(t,n){var r;try{r=Fg(this.storage.getItem(e))}catch(i){n(i)}t(r)},this))},Wf.prototype.removeItem=function(e){return new ln(O.bind(function(t,n){try{this.storage.removeItem(e)}catch(r){n(r)}t()},this))};var V$=xu("batch"),Do=function(e,t){t=t||{},this.storageKey=e,this.usePersistence=t.usePersistence,this.usePersistence&&(this.queueStorage=t.queueStorage||new Wf,this.lock=new G$(e,{storage:t.sharedLockStorage||it.localStorage,timeoutMS:t.sharedLockTimeoutMS})),this.reportError=t.errorReporter||O.bind(V$.error,V$),this.pid=t.pid||null,this.memQueue=[],this.initialized=!1,t.enqueueThrottleMs?this.enqueuePersisted=wW(O.bind(this._enqueuePersisted,this),t.enqueueThrottleMs):this.enqueuePersisted=O.bind(function(n){return this._enqueuePersisted([n])},this)};Do.prototype.ensureInit=function(){return this.initialized?ln.resolve():this.queueStorage.init().then(O.bind(function(){this.initialized=!0},this)).catch(O.bind(function(e){this.reportError("Error initializing queue persistence. Disabling persistence",e),this.initialized=!0,this.usePersistence=!1},this))},Do.prototype.enqueue=function(e,t){var n={id:Nx(),flushAfter:new Date().getTime()+t*2,payload:e};return this.usePersistence?this.enqueuePersisted(n):(this.memQueue.push(n),ln.resolve(!0))},Do.prototype._enqueuePersisted=function(e){var t=O.bind(function(){return this.ensureInit().then(O.bind(function(){return this.readFromStorage()},this)).then(O.bind(function(n){return this.saveToStorage(n.concat(e))},this)).then(O.bind(function(n){return n&&(this.memQueue=this.memQueue.concat(e)),n},this)).catch(O.bind(function(n){return this.reportError("Error enqueueing items",n,e),!1},this))},this);return this.lock.withLock(t,this.pid).catch(O.bind(function(n){return this.reportError("Error acquiring storage lock",n),!1},this))},Do.prototype.fillBatch=function(e){var t=this.memQueue.slice(0,e);return this.usePersistence&&t.length<e?this.ensureInit().then(O.bind(function(){return this.readFromStorage()},this)).then(O.bind(function(n){if(n.length){var r={};O.each(t,function(a){r[a.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)):ln.resolve(t)};var Z$=function(e,t){var n=[];return O.each(e,function(r){r.id&&!t[r.id]&&n.push(r)}),n};Do.prototype.removeItemsByID=function(e){var t={};if(O.each(e,function(r){t[r]=!0}),this.memQueue=Z$(this.memQueue,t),this.usePersistence){var n=O.bind(function(){return this.ensureInit().then(O.bind(function(){return this.readFromStorage()},this)).then(O.bind(function(r){return r=Z$(r,t),this.saveToStorage(r)},this)).then(O.bind(function(){return this.readFromStorage()},this)).then(O.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(O.bind(function(r){return this.reportError("Error removing items",r,e),!1},this))},this);return this.lock.withLock(n,this.pid).catch(O.bind(function(r){return this.reportError("Error acquiring storage lock",r),Yf(this.lock.storage,!0)?!1:n().then(O.bind(function(i){return i||this.queueStorage.removeItem(this.storageKey).then(function(){return i})},this)).catch(O.bind(function(i){return this.reportError("Error clearing queue",i),!1},this))},this))}else return ln.resolve(!0)};var Y$=function(e,t){var n=[];return O.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};Do.prototype.updatePayloads=function(e){return this.memQueue=Y$(this.memQueue,e),this.usePersistence?this.lock.withLock(O.bind(function(){return this.ensureInit().then(O.bind(function(){return this.readFromStorage()},this)).then(O.bind(function(n){return n=Y$(n,e),this.saveToStorage(n)},this)).catch(O.bind(function(n){return this.reportError("Error updating items",e,n),!1},this))},this),this.pid).catch(O.bind(function(t){return this.reportError("Error acquiring storage lock",t),!1},this)):ln.resolve(!0)},Do.prototype.readFromStorage=function(){return this.ensureInit().then(O.bind(function(){return this.queueStorage.getItem(this.storageKey)},this)).then(O.bind(function(e){return e&&(O.isArray(e)||(this.reportError("Invalid storage entry:",e),e=null)),e||[]},this)).catch(O.bind(function(e){return this.reportError("Error retrieving queue",e),[]},this))},Do.prototype.saveToStorage=function(e){return this.ensureInit().then(O.bind(function(){return this.queueStorage.setItem(this.storageKey,e)},this)).then(function(){return!0}).catch(O.bind(function(t){return this.reportError("Error saving queue",t),!1},this))},Do.prototype.clear=function(){return this.memQueue=[],this.usePersistence?this.ensureInit().then(O.bind(function(){return this.queueStorage.removeItem(this.storageKey)},this)):ln.resolve()};var NW=10*60*1e3,Kf=xu("batch"),Xi=function(e,t){this.errorReporter=t.errorReporter,this.queue=new Do(e,{errorReporter:O.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};Xi.prototype.enqueue=function(e){return this.queue.enqueue(e,this.flushInterval)},Xi.prototype.start=function(){return this.stopped=!1,this.consecutiveRemovalFailures=0,this.flush()},Xi.prototype.stop=function(){this.stopped=!0,this.timeoutID&&(clearTimeout(this.timeoutID),this.timeoutID=null)},Xi.prototype.clear=function(){return this.queue.clear()},Xi.prototype.resetBatchSize=function(){this.batchSize=this.libConfig.batch_size},Xi.prototype.resetFlush=function(){this.scheduleFlush(this.libConfig.batch_flush_interval_ms)},Xi.prototype.scheduleFlush=function(e){this.flushInterval=e,this.stopped||(this.timeoutID=setTimeout(O.bind(function(){this.stopped||(this._flushPromise=this.flush())},this),this.flushInterval))},Xi.prototype.sendRequestPromise=function(e,t){return new ln(O.bind(function(n){this.sendRequest(e,t,n)},this))},Xi.prototype.flush=function(e){if(this.requestInProgress)return Kf.log("Flush: Request already in progress"),ln.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(O.bind(function(i){var o=i.length===r,a=[],u={};if(O.each(i,function(h){var m=h.payload;if(this.beforeSendHook&&!h.orphaned&&(m=this.beforeSendHook(m)),m){m.event&&m.properties&&(m.properties=O.extend({},m.properties,{mp_sent_by_lib_version:_o.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&&a.push(m)}u[h.id]=m},this),a.length<1)return this.requestInProgress=!1,this.resetFlush(),ln.resolve();var c=O.bind(function(){return this.queue.removeItemsByID(O.map(i,function(h){return h.id})).then(O.bind(function(h){return O.each(i,O.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(),ln.resolve()):this.flush()):(++this.consecutiveRemovalFailures>5?(this.reportError("Too many queue failures; disabling batching system."),this.stopAllBatching()):this.resetFlush(),ln.resolve())},this))},this),d=O.bind(function(h){this.requestInProgress=!1;try{if(e.unloading)return this.queue.updatePayloads(u);if(O.isObject(h)&&h.error==="timeout"&&new Date().getTime()-n>=t)return this.reportError("Network timeout; retrying"),this.flush();if(O.isObject(h)&&(h.httpStatusCode>=500||h.httpStatusCode===429||h.httpStatusCode<=0&&!kW()||h.error==="timeout")){var m=this.flushInterval*2;return h.retryAfter&&(m=parseInt(h.retryAfter,10)*1e3||m),m=Math.min(NW,m),this.reportError("Error; retry in "+m+" ms"),this.scheduleFlush(m),ln.resolve()}else if(O.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(),ln.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"),Kf.log("MIXPANEL REQUEST:",a),this.sendRequestPromise(a,p).then(d)},this)).catch(O.bind(function(i){this.reportError("Error flushing request queue",i),this.resetFlush()},this))},Xi.prototype.reportError=function(e,t){if(Kf.error.apply(Kf.error,arguments),this.errorReporter)try{t instanceof Error||(t=new Error(e)),this.errorReporter(e,t)}catch(n){Kf.error(n)}};var Ux=function(e){var t=Date.now();return!e||t>e.maxExpires||t>e.idleExpires},BW=250,Cu=xu("recorder"),W$=it.CompressionStream,PW={batch_size:1e3,batch_flush_interval_ms:10*1e3,batch_request_timeout_ms:90*1e3,batch_autostart:!0},FW=new Set([At.MouseMove,At.MouseInteraction,At.Scroll,At.ViewportResize,At.Input,At.TouchMove,At.MediaInteraction,At.Drag,At.Selection]);function zW(e){return e.type===Wt.IncrementalSnapshot&&FW.has(e.data.source)}var ti=function(e){this._mixpanel=e.mixpanelInstance,this._onIdleTimeout=e.onIdleTimeout||is,this._onMaxLengthReached=e.onMaxLengthReached||is,this._onBatchSent=e.onBatchSent||is,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=Vf,this.recordMinMs=0;var t=Yf(e.sharedLockStorage,!0);this.batcherKey="__mprec_"+this.getConfig("name")+"_"+this.getConfig("token")+"_"+this.replayId,this.queueStorage=new $o(U$),this.batcher=new Xi(this.batcherKey,{errorReporter:this.reportError.bind(this),flushOnlyOnInterval:!0,libConfig:PW,sendRequestFunc:this.flushEventsWithOptOut.bind(this),queueStorage:this.queueStorage,sharedLockStorage:e.sharedLockStorage,usePersistence:t,stopAllBatchingFunc:this.stopRecording.bind(this),enqueueThrottleMs:BW,sharedLockTimeoutMS:10*1e3})};ti.prototype.unloadPersistedData=function(){return this.batcher.stop(),this.batcher.flush().then((function(){return this.queueStorage.removeItem(this.batcherKey)}).bind(this))},ti.prototype.getConfig=function(e){return this._mixpanel.get_config(e)},ti.prototype.get_config=function(e){return this.getConfig(e)},ti.prototype.startRecording=function(e){if(this._rrwebRecord===null){this.reportError("rrweb record function not provided. ");return}if(this._stopRecording!==null){Cu.log("Recording already in progress, skipping startRecording.");return}this.recordMaxMs=this.getConfig("record_max_ms"),this.recordMaxMs>Vf&&(this.recordMaxMs=Vf,Cu.critical("record_max_ms cannot be greater than "+Vf+"ms. Capping value.")),this.maxExpires||(this.maxExpires=new Date().getTime()+this.recordMaxMs),this.recordMinMs=this.getConfig("record_min_ms"),this.recordMinMs>Tx&&(this.recordMinMs=Tx,Cu.critical("record_min_ms cannot be greater than "+Tx+"ms. Capping value.")),this.replayStartTime||(this.replayStartTime=new Date().getTime(),this.batchStartUrl=O.info.currentUrl(),this.replayStartUrl=O.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}zW(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)},ti.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},ti.prototype.isRrwebStopped=function(){return this._stopRecording===null},ti.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)},ti.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}},ti.deserialize=function(e,t){var n=new ti(O.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},ti.prototype._sendRequest=function(e,t,n,r){var i=(function(o,a){o.status===200&&this.replayId===e&&(this.seqNo++,this.batchStartUrl=O.info.currentUrl()),this._onBatchSent(),r({status:0,httpStatusCode:o.status,responseBody:a,retryAfter:o.headers.get("Retry-After")})}).bind(this);it.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(a){i(o,a)}).catch(function(a){r({error:a})})}).catch(function(o){r({error:o,httpStatusCode:0})})},ti.prototype._flushEvents=os(function(e,t,n){var r=e.length;if(r>0){for(var i=this.replayId,o=1/0,a=-1/0,u=!1,c=0;c<r;c++)o=Math.min(o,e[c].timestamp),a=Math.max(a,e[c].timestamp),e[c].type===Wt.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=a-this.replayStartTime,p={$current_url:this.batchStartUrl,$lib_version:_o.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),W$){var _=new Blob([h],{type:"application/json"}).stream(),S=_.pipeThrough(new W$("gzip"));new Response(S).blob().then((function(x){p.format="gzip",this._sendRequest(i,p,x,n)}).bind(this))}else p.format="body",this._sendRequest(i,p,h,n)}}),ti.prototype.reportError=function(e,t){Cu.error.apply(Cu.error,arguments);try{!t&&!(e instanceof Error)&&(e=new Error(e)),this.getConfig("error_reporter")(e,t)}catch(n){Cu.error(n)}};var ku=function(e){this.idb=new $o(Bx),this.errorReporter=e.errorReporter,this.mixpanelInstance=e.mixpanelInstance,this.sharedLockStorage=e.sharedLockStorage};ku.prototype.handleError=function(e){this.errorReporter("IndexedDB error: ",e)},ku.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."),ln.resolve())},ku.prototype.getActiveRecording=function(){return this.idb.init().then((function(){return this.idb.getItem(this.mixpanelInstance.get_tab_id())}).bind(this)).then((function(e){return Ux(e)?null:e}).bind(this)).catch(this.handleError.bind(this))},ku.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))},ku.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 Ux(n)}).map((function(n){var r=ti.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 ln.all(t)}).bind(this)).catch(this.handleError.bind(this))};var Qf=xu("recorder"),aa=function(e,t,n){this.mixpanelInstance=e,this.rrwebRecord=t||Ja,this.sharedLockStorage=n,this.recordingRegistry=new ku({mixpanelInstance:this.mixpanelInstance,errorReporter:Qf.error,sharedLockStorage:n}),this._flushInactivePromise=this.recordingRegistry.flushInactiveRecordings(),this.activeRecording=null};aa.prototype.startRecording=function(e){if(e=e||{},this.activeRecording&&!this.activeRecording.isRrwebStopped()){Qf.log("Recording already in progress, skipping startRecording.");return}var t=(function(){Qf.log("Idle timeout reached, restarting recording."),this.resetRecording()}).bind(this),n=(function(){Qf.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:O.UUID(),rrwebRecord:this.rrwebRecord,sharedLockStorage:this.sharedLockStorage};return e.activeSerializedRecording?this.activeRecording=ti.deserialize(e.activeSerializedRecording,i):this.activeRecording=new ti(i),this.activeRecording.startRecording(e.shouldStopBatcher),this.recordingRegistry.setActiveRecording(this.activeRecording.serialize())},aa.prototype.stopRecording=function(){var e=this._stopCurrentRecording(!1);return this.recordingRegistry.clearActiveRecording(),this.activeRecording=null,e},aa.prototype.pauseRecording=function(){return this._stopCurrentRecording(!1)},aa.prototype._stopCurrentRecording=function(e){return this.activeRecording?this.activeRecording.stopRecording(e):ln.resolve()},aa.prototype.resumeRecording=function(e){return this.activeRecording&&this.activeRecording.isRrwebStopped()?(this.activeRecording.startRecording(!1),ln.resolve(null)):this.recordingRegistry.getActiveRecording().then((function(t){return t?this.startRecording({activeSerializedRecording:t}):e?this.startRecording({shouldStopBatcher:!1}):(Qf.log("No resumable recording found."),null)}).bind(this))},aa.prototype.resetRecording=function(){this.stopRecording(),this.startRecording({shouldStopBatcher:!0})},aa.prototype.getActiveReplayId=function(){return this.activeRecording&&!this.activeRecording.isRrwebStopped()?this.activeRecording.replayId:null},Object.defineProperty(aa.prototype,"replayId",{get:function(){return this.getActiveReplayId()}}),it.__mp_recorder=aa;var zg="change",Xf="click",K$="hashchange",Eu="mp_locationchange",Q$="popstate",X$="scrollend",jx="submit",UW=["clientX","clientY","offsetX","offsetY","pageX","pageY","screenX","screenY","x","y"],J$=["mp-include"],qx=["mp-no-track"],e3=qx.concat(["mp-sensitive"]),jW=["aria-label","aria-labelledby","aria-describedby","href","name","role","title","type"],Ci=xu("autocapture");function Hx(e){for(var t={},n=t3(e).split(" "),r=0;r<n.length;r++){var i=n[r];i&&(t[i]=!0)}return t}function t3(e){switch(typeof e.className){case"string":return e.className;case"object":return e.className.baseVal||e.getAttribute("class")||"";default:return""}}function qW(e){if(e.previousElementSibling)return e.previousElementSibling;do e=e.previousSibling;while(e&&!i3(e));return e}function n3(e,t,n,r,i,o){var a={$classes:t3(e).split(" "),$tag_name:e.tagName.toLowerCase()},u=e.id;u&&(a.$id=u),Zx(e,t,i,o)&&O.each(jW.concat(r),function(h){if(e.hasAttribute(h)&&!n[h]){var m=e.getAttribute(h);Ug(m)&&(a["$attr-"+h]=m)}});for(var c=1,d=1,p=e;p=qW(p);)c++,p.tagName===e.tagName&&d++;return a.$nth_child=c,a.$nth_of_type=d,a}function HW(e,t){var n=t.allowElementCallback,r=t.allowSelectors||[],i=t.blockAttrs||[],o=t.blockElementCallback,a=t.blockSelectors||[],u=t.captureTextContent||!1,c=t.captureExtraAttrs||[],d={};O.each(i,function(A){d[A]=!0});var p=null,h=typeof e.target>"u"?e.srcElement:e.target;if(o3(h)&&(h=h.parentNode),ZW(h,e)&&Gx(h,e,n,r)&&!Vx(h,e,o,a)){for(var m=[h],v=h;v.parentNode&&!Lo(v,"body");)m.push(v.parentNode),v=v.parentNode;var _=[],S,x=!1;if(O.each(m,function(A){var I=Zx(A,e,n,r);!d.href&&A.tagName.toLowerCase()==="a"&&(S=A.getAttribute("href"),S=I&&Ug(S)&&S),Vx(A,e,o,a)&&(x=!0),_.push(n3(A,e,d,c,n,r))},this),!x){var b=dn.documentElement;if(p={$event_type:e.type,$host:it.location.host,$pathname:it.location.pathname,$elements:_,$el_attr__href:S,$viewportHeight:Math.max(b.clientHeight,it.innerHeight||0),$viewportWidth:Math.max(b.clientWidth,it.innerWidth||0)},O.each(c,function(A){if(!d[A]&&h.hasAttribute(A)){var I=h.getAttribute(A);Ug(I)&&(p["$el_attr__"+A]=I)}}),u&&(k=r3(h,e,n,r),k&&k.length&&(p.$el_text=k)),e.type===Xf&&(O.each(UW,function(A){A in e&&(p["$"+A]=e[A])}),h=GW(e)),u){var k=r3(h,e,n,r);k&&k.length&&(p.$el_text=k)}if(h){if(!Gx(h,e,n,r)||Vx(h,e,o,a))return null;var E=n3(h,e,d,c,n,r);p.$target=E,p.$el_classes=E.$classes,O.extend(p,O.strip_empty_properties({$el_id:E.$id,$el_tag_name:E.$tag_name}))}}}return p}function r3(e,t,n,r){var i="";return Zx(e,t,n,r)&&e.childNodes&&e.childNodes.length&&O.each(e.childNodes,function(o){o3(o)&&o.textContent&&(i+=O.trim(o.textContent).split(/(\s+)/).filter(Ug).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255))}),O.trim(i)}function GW(e){for(var t=e.target,n=e.composedPath(),r=0;r<n.length;r++){var i=n[r];if(Lo(i,"a")||Lo(i,"button")||Lo(i,"input")||Lo(i,"select")||i.getAttribute&&i.getAttribute("role")==="button"){t=i;break}if(i===t)break}return t}function Gx(e,t,n,r){if(n)try{if(!n(e,t))return!1}catch(a){return Ci.critical("Error while checking element in allowElementCallback",a),!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(a){Ci.critical("Error while checking selector: "+o,a)}}return!1}function Vx(e,t,n,r){var i;if(n)try{if(n(e,t))return!0}catch(u){return Ci.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){Ci.critical("Error while checking selector: "+o,u)}}var a=Hx(e);for(i=0;i<qx.length;i++)if(a[qx[i]])return!0;return!1}function i3(e){return e&&e.nodeType===1}function Lo(e,t){return e&&e.tagName&&e.tagName.toLowerCase()===t.toLowerCase()}function o3(e){return e&&e.nodeType===3}function VW(){try{var e=dn.createElement("div");return!!e.matches}catch{return!1}}function ZW(e,t){if(!e||Lo(e,"html")||!i3(e))return!1;var n=e.tagName.toLowerCase();switch(n){case"form":return t.type===jx;case"input":return["button","submit"].indexOf(e.getAttribute("type"))===-1?t.type===zg:t.type===Xf;case"select":case"textarea":return t.type===zg;default:return t.type===Xf}}function Zx(e,t,n,r){var i;if(!Gx(e,t,n,r))return!1;for(var o=e;o.parentNode&&!Lo(o,"body");o=o.parentNode){var a=Hx(o);for(i=0;i<e3.length;i++)if(a[e3[i]])return!1}var u=Hx(e);for(i=0;i<J$.length;i++)if(u[J$[i]])return!0;if(Lo(e,"input")||Lo(e,"select")||Lo(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 Ug(e){if(e===null||O.isUndefined(e))return!1;if(typeof e=="string"){e=O.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 a3="autocapture",YW="track_pageview",s3="full-url",WW="url-with-path-and-query-string",KW="url-with-path",QW="allow_element_callback",l3="allow_selectors",u3="allow_url_regexes",c3="block_attrs",f3="block_element_callback",d3="block_selectors",h3="block_url_regexes",p3="capture_extra_attrs",g3="capture_text_content",m3="scroll_capture_all",v3="scroll_depth_percent_checkpoints",Yx="click",Wx="input",y3="pageview",Kx="scroll",Qx="submit",Lr={};Lr[l3]=[],Lr[u3]=[],Lr[c3]=[],Lr[f3]=null,Lr[d3]=[],Lr[h3]=[],Lr[p3]=[],Lr[g3]=!1,Lr[m3]=!1,Lr[v3]=[25,50,75,100],Lr[Yx]=!0,Lr[Wx]=!0,Lr[y3]=s3,Lr[Kx]=!0,Lr[Qx]=!0;var jg={$mp_autocapture:!0},XW="$mp_click",JW="$mp_input_change",eK="$mp_scroll",tK="$mp_submit",Di=function(e){this.mp=e};Di.prototype.init=function(){if(!VW()){Ci.critical("Autocapture unavailable: missing required DOM APIs");return}this.initPageviewTracking(),this.initClickTracking(),this.initInputTracking(),this.initScrollTracking(),this.initSubmitTracking()},Di.prototype.getFullConfig=function(){var e=this.mp.get_config(a3);return e?O.isObject(e)?O.extend({},Lr,e):Lr:{}},Di.prototype.getConfig=function(e){return this.getFullConfig()[e]},Di.prototype.currentUrlBlocked=function(){var e,t=O.info.currentUrl(),n=this.getConfig(u3)||[];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(a){return Ci.critical("Error while checking block URL regex: "+i,a),!0}}if(!r)return!0}var o=this.getConfig(h3)||[];if(!o||!o.length)return!1;for(e=0;e<o.length;e++)try{if(t.match(o[e]))return!0}catch(a){return Ci.critical("Error while checking block URL regex: "+o[e],a),!0}return!1},Di.prototype.pageviewTrackingConfig=function(){return this.mp.get_config(a3)?this.getConfig(y3):this.mp.get_config(YW)},Di.prototype.trackDomEvent=function(e,t){if(!this.currentUrlBlocked()){var n=HW(e,{allowElementCallback:this.getConfig(QW),allowSelectors:this.getConfig(l3),blockAttrs:this.getConfig(c3),blockElementCallback:this.getConfig(f3),blockSelectors:this.getConfig(d3),captureExtraAttrs:this.getConfig(p3),captureTextContent:this.getConfig(g3)});n&&(O.extend(n,jg),this.mp.track(t,n))}},Di.prototype.initClickTracking=function(){it.removeEventListener(Xf,this.listenerClick),this.getConfig(Yx)&&(Ci.log("Initializing click tracking"),this.listenerClick=it.addEventListener(Xf,(function(e){this.getConfig(Yx)&&this.trackDomEvent(e,XW)}).bind(this)))},Di.prototype.initInputTracking=function(){it.removeEventListener(zg,this.listenerChange),this.getConfig(Wx)&&(Ci.log("Initializing input tracking"),this.listenerChange=it.addEventListener(zg,(function(e){this.getConfig(Wx)&&this.trackDomEvent(e,JW)}).bind(this)))},Di.prototype.initPageviewTracking=function(){if(it.removeEventListener(Q$,this.listenerPopstate),it.removeEventListener(K$,this.listenerHashchange),it.removeEventListener(Eu,this.listenerLocationchange),!!this.pageviewTrackingConfig()){Ci.log("Initializing pageview tracking");var e="",t=!1;this.currentUrlBlocked()||(t=this.mp.track_pageview(jg)),t&&(e=O.info.currentUrl()),this.listenerPopstate=it.addEventListener(Q$,function(){it.dispatchEvent(new Event(Eu))}),this.listenerHashchange=it.addEventListener(K$,function(){it.dispatchEvent(new Event(Eu))});var n=it.history.pushState;typeof n=="function"&&(it.history.pushState=function(i,o,a){n.call(it.history,i,o,a),it.dispatchEvent(new Event(Eu))});var r=it.history.replaceState;typeof r=="function"&&(it.history.replaceState=function(i,o,a){r.call(it.history,i,o,a),it.dispatchEvent(new Event(Eu))}),this.listenerLocationchange=it.addEventListener(Eu,$x((function(){if(!this.currentUrlBlocked()){var i=O.info.currentUrl(),o=!1,a=i.split("#")[0].split("?")[0]!==e.split("#")[0].split("?")[0],u=this.pageviewTrackingConfig();if(u===s3?o=i!==e:u===WW?o=i.split("#")[0]!==e.split("#")[0]:u===KW&&(o=a),o){var c=this.mp.track_pageview(jg);c&&(e=i),a&&(this.lastScrollCheckpoint=0,Ci.log("Path change: re-initializing scroll depth checkpoints"))}}}).bind(this)))}},Di.prototype.initScrollTracking=function(){it.removeEventListener(X$,this.listenerScroll),this.getConfig(Kx)&&(Ci.log("Initializing scroll tracking"),this.lastScrollCheckpoint=0,this.listenerScroll=it.addEventListener(X$,$x((function(){if(this.getConfig(Kx)&&!this.currentUrlBlocked()){var e=this.getConfig(m3),t=(this.getConfig(v3)||[]).slice().sort(function(c,d){return c-d}),n=it.scrollY,r=O.extend({$scroll_top:n},jg);try{var i=dn.body.scrollHeight,o=Math.round(n/(i-it.innerHeight)*100);if(r.$scroll_height=i,r.$scroll_percentage=o,o>this.lastScrollCheckpoint)for(var a=0;a<t.length;a++){var u=t[a];o>=u&&this.lastScrollCheckpoint<u&&(r.$scroll_checkpoint=u,this.lastScrollCheckpoint=u,e=!0)}}catch(c){Ci.critical("Error while calculating scroll percentage",c)}e&&this.mp.track(eK,r)}}).bind(this))))},Di.prototype.initSubmitTracking=function(){it.removeEventListener(jx,this.listenerSubmit),this.getConfig(Qx)&&(Ci.log("Initializing submit tracking"),this.listenerSubmit=it.addEventListener(jx,(function(e){this.getConfig(Qx)&&this.trackDomEvent(e,tK)}).bind(this)))},vW(Di);var sa=function(){};sa.prototype.create_properties=function(){},sa.prototype.event_handler=function(){},sa.prototype.after_track_handler=function(){},sa.prototype.init=function(e){return this.mp=e,this},sa.prototype.track=function(e,t,n,r){var i=this,o=O.dom_query(e);if(o.length===0){on.error("The DOM query ("+e+") returned 0 elements");return}return O.each(o,function(a){O.register_event(a,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},sa.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))}},sa.prototype.create_properties=function(e,t){var n;return typeof e=="function"?n=e(t):n=O.extend({},e),n};var Au=function(){this.override_event="click"};O.inherit(Au,sa),Au.prototype.create_properties=function(e,t){var n=Au.superclass.create_properties.apply(this,arguments);return t.href&&(n.url=t.href),n},Au.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()},Au.prototype.after_track_handler=function(e,t){t.new_tab||setTimeout(function(){window.location=t.href},0)};var qg=function(){this.override_event="submit"};O.inherit(qg,sa),qg.prototype.event_handler=function(e,t,n){n.element=t,e.preventDefault()},qg.prototype.after_track_handler=function(e,t){setTimeout(function(){t.element.submit()},0)};var ss="$set",Iu="$set_once",bo="$unset",al="$add",No="$append",sl="$union",la="$remove",nK="$delete",_3={set_action:function(e,t){var n={},r={};return O.isObject(e)?O.each(e,function(i,o){this._is_reserved_property(o)||(r[o]=i)},this):r[e]=t,n[ss]=r,n},unset_action:function(e){var t={},n=[];return O.isArray(e)||(e=[e]),O.each(e,function(r){this._is_reserved_property(r)||n.push(r)},this),t[bo]=n,t},set_once_action:function(e,t){var n={},r={};return O.isObject(e)?O.each(e,function(i,o){this._is_reserved_property(o)||(r[o]=i)},this):r[e]=t,n[Iu]=r,n},union_action:function(e,t){var n={},r={};return O.isObject(e)?O.each(e,function(i,o){this._is_reserved_property(o)||(r[o]=O.isArray(i)?i:[i])},this):r[e]=O.isArray(t)?t:[t],n[sl]=r,n},append_action:function(e,t){var n={},r={};return O.isObject(e)?O.each(e,function(i,o){this._is_reserved_property(o)||(r[o]=i)},this):r[e]=t,n[No]=r,n},remove_action:function(e,t){var n={},r={};return O.isObject(e)?O.each(e,function(i,o){this._is_reserved_property(o)||(r[o]=i)},this):r[e]=t,n[la]=r,n},delete_action:function(){var e={};return e[nK]="",e}},$n=function(){};O.extend($n.prototype,_3),$n.prototype._init=function(e,t,n){this._mixpanel=e,this._group_key=t,this._group_id=n},$n.prototype.set=Su(function(e,t,n){var r=this.set_action(e,t);return O.isObject(e)&&(n=t),this._send_request(r,n)}),$n.prototype.set_once=Su(function(e,t,n){var r=this.set_once_action(e,t);return O.isObject(e)&&(n=t),this._send_request(r,n)}),$n.prototype.unset=Su(function(e,t){var n=this.unset_action(e);return this._send_request(n,t)}),$n.prototype.union=Su(function(e,t,n){O.isObject(e)&&(n=t);var r=this.union_action(e,t);return this._send_request(r,n)}),$n.prototype.delete=Su(function(e){var t=this.delete_action();return this._send_request(t,e)}),$n.prototype.remove=Su(function(e,t,n){var r=this.remove_action(e,t);return this._send_request(r,n)}),$n.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=O.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)},$n.prototype._is_reserved_property=function(e){return e==="$group_key"||e==="$group_id"},$n.prototype._get_config=function(e){return this._mixpanel.get_config(e)},$n.prototype.toString=function(){return this._mixpanel.toString()+".group."+this._group_key+"."+this._group_id},$n.prototype.remove=$n.prototype.remove,$n.prototype.set=$n.prototype.set,$n.prototype.set_once=$n.prototype.set_once,$n.prototype.union=$n.prototype.union,$n.prototype.unset=$n.prototype.unset,$n.prototype.toString=$n.prototype.toString;var Tt=function(){};O.extend(Tt.prototype,_3),Tt.prototype._init=function(e){this._mixpanel=e},Tt.prototype.set=as(function(e,t,n){var r=this.set_action(e,t);return O.isObject(e)&&(n=t),this._get_config("save_referrer")&&this._mixpanel.persistence.update_referrer_info(document.referrer),r[ss]=O.extend({},O.info.people_properties(),r[ss]),this._send_request(r,n)}),Tt.prototype.set_once=as(function(e,t,n){var r=this.set_once_action(e,t);return O.isObject(e)&&(n=t),this._send_request(r,n)}),Tt.prototype.unset=as(function(e,t){var n=this.unset_action(e);return this._send_request(n,t)}),Tt.prototype.increment=as(function(e,t,n){var r={},i={};return O.isObject(e)?(O.each(e,function(o,a){if(!this._is_reserved_property(a))if(isNaN(parseFloat(o))){on.error("Invalid increment value passed to mixpanel.people.increment - must be a number");return}else i[a]=o},this),n=t):(O.isUndefined(t)&&(t=1),i[e]=t),r[al]=i,this._send_request(r,n)}),Tt.prototype.append=as(function(e,t,n){O.isObject(e)&&(n=t);var r=this.append_action(e,t);return this._send_request(r,n)}),Tt.prototype.remove=as(function(e,t,n){O.isObject(e)&&(n=t);var r=this.remove_action(e,t);return this._send_request(r,n)}),Tt.prototype.union=as(function(e,t,n){O.isObject(e)&&(n=t);var r=this.union_action(e,t);return this._send_request(r,n)}),Tt.prototype.track_charge=as(function(e,t,n){if(!O.isNumber(e)&&(e=parseFloat(e),isNaN(e))){on.error("Invalid value passed to mixpanel.people.track_charge - must be a number");return}return this.append("$transactions",O.extend({$amount:e},t),n)}),Tt.prototype.clear_charges=function(e){return this.set("$transactions",[],e)},Tt.prototype.delete_user=function(){if(!this._identify_called()){on.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)},Tt.prototype.toString=function(){return this._mixpanel.toString()+".people"},Tt.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=O.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),O.isUndefined(t)||(this._get_config("verbose")?t({status:-1,error:null}):t(-1)),O.truncate(o,255))},Tt.prototype._get_config=function(e){return this._mixpanel.get_config(e)},Tt.prototype._identify_called=function(){return this._mixpanel._flags.identify_called===!0},Tt.prototype._enqueue=function(e){ss in e?this._mixpanel.persistence._add_to_people_queue(ss,e):Iu in e?this._mixpanel.persistence._add_to_people_queue(Iu,e):bo in e?this._mixpanel.persistence._add_to_people_queue(bo,e):al in e?this._mixpanel.persistence._add_to_people_queue(al,e):No in e?this._mixpanel.persistence._add_to_people_queue(No,e):la in e?this._mixpanel.persistence._add_to_people_queue(la,e):sl in e?this._mixpanel.persistence._add_to_people_queue(sl,e):on.error("Invalid call to _enqueue():",e)},Tt.prototype._flush_one_queue=function(e,t,n,r){var i=this,o=O.extend({},this._mixpanel.persistence.load_queue(e)),a=o;!O.isUndefined(o)&&O.isObject(o)&&!O.isEmptyObject(o)&&(i._mixpanel.persistence._pop_from_people_queue(e,o),i._mixpanel.persistence.save(),r&&(a=r(o)),t.call(i,a,function(u,c){u===0&&i._mixpanel.persistence._add_to_people_queue(e,o),O.isUndefined(n)||n(u,c)}))},Tt.prototype._flush=function(e,t,n,r,i,o,a){var u=this;this._flush_one_queue(ss,this.set,e),this._flush_one_queue(Iu,this.set_once,r),this._flush_one_queue(bo,this.unset,o,function(x){return O.keys(x)}),this._flush_one_queue(al,this.increment,t),this._flush_one_queue(sl,this.union,i);var c=this._mixpanel.persistence.load_queue(No);if(!O.isUndefined(c)&&O.isArray(c)&&c.length)for(var d,p=function(x,b){x===0&&u._mixpanel.persistence._add_to_people_queue(No,d),O.isUndefined(n)||n(x,b)},h=c.length-1;h>=0;h--)c=this._mixpanel.persistence.load_queue(No),d=c.pop(),u._mixpanel.persistence.save(),O.isEmptyObject(d)||u.append(d,p);var m=this._mixpanel.persistence.load_queue(la);if(!O.isUndefined(m)&&O.isArray(m)&&m.length)for(var v,_=function(x,b){x===0&&u._mixpanel.persistence._add_to_people_queue(la,v),O.isUndefined(a)||a(x,b)},S=m.length-1;S>=0;S--)m=this._mixpanel.persistence.load_queue(la),v=m.pop(),u._mixpanel.persistence.save(),O.isEmptyObject(v)||u.remove(v,_)},Tt.prototype._is_reserved_property=function(e){return e==="$distinct_id"||e==="$token"||e==="$device_id"||e==="$user_id"||e==="$had_persisted_distinct_id"},Tt.prototype.set=Tt.prototype.set,Tt.prototype.set_once=Tt.prototype.set_once,Tt.prototype.unset=Tt.prototype.unset,Tt.prototype.increment=Tt.prototype.increment,Tt.prototype.append=Tt.prototype.append,Tt.prototype.remove=Tt.prototype.remove,Tt.prototype.union=Tt.prototype.union,Tt.prototype.track_charge=Tt.prototype.track_charge,Tt.prototype.clear_charges=Tt.prototype.clear_charges,Tt.prototype.delete_user=Tt.prototype.delete_user,Tt.prototype.toString=Tt.prototype.toString;var Xx="__mps",Jx="__mpso",ew="__mpus",tw="__mpa",nw="__mpap",rw="__mpr",iw="__mpu",b3="$people_distinct_id",Hg="__alias",Jf="__timers",rK=[Xx,Jx,ew,tw,nw,rw,iw,b3,Hg,Jf],Nt=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"&&(on.critical("Unknown persistence type "+t+"; falling back to cookie"),t=e.persistence="cookie"),t==="localStorage"&&O.localStorage.is_supported()?this.storage=O.localStorage:this.storage=O.cookie,this.load(),this.update_config(e),this.upgrade(),this.save()};Nt.prototype.properties=function(){var e={};return this.load(),O.each(this.props,function(t,n){O.include(rK,n)||(e[n]=t)}),e},Nt.prototype.load=function(){if(!this.disabled){var e=this.storage.parse(this.name);e&&(this.props=O.extend({},e))}},Nt.prototype.upgrade=function(){var e,t;this.storage===O.localStorage?(e=O.cookie.parse(this.name),O.cookie.remove(this.name),O.cookie.remove(this.name,!0),e&&this.register_once(e)):this.storage===O.cookie&&(t=O.localStorage.parse(this.name),O.localStorage.remove(this.name),t&&this.register_once(t))},Nt.prototype.save=function(){this.disabled||this.storage.set(this.name,wu(this.props),this.expire_days,this.cross_subdomain,this.secure,this.cross_site,this.cookie_domain)},Nt.prototype.load_prop=function(e){return this.load(),this.props[e]},Nt.prototype.remove=function(){this.storage.remove(this.name,!1,this.cookie_domain),this.storage.remove(this.name,!0,this.cookie_domain)},Nt.prototype.clear=function(){this.remove(),this.props={}},Nt.prototype.register_once=function(e,t,n){return O.isObject(e)?(typeof t>"u"&&(t="None"),this.expire_days=typeof n>"u"?this.default_expiry:n,this.load(),O.each(e,function(r,i){(!this.props.hasOwnProperty(i)||this.props[i]===t)&&(this.props[i]=r)},this),this.save(),!0):!1},Nt.prototype.register=function(e,t){return O.isObject(e)?(this.expire_days=typeof t>"u"?this.default_expiry:t,this.load(),O.extend(this.props,e),this.save(),!0):!1},Nt.prototype.unregister=function(e){this.load(),e in this.props&&(delete this.props[e],this.save())},Nt.prototype.update_search_keyword=function(e){this.register(O.info.searchInfo(e))},Nt.prototype.update_referrer_info=function(e){this.register_once({$initial_referrer:e||"$direct",$initial_referring_domain:O.info.referringDomain(e)||"$direct"},"")},Nt.prototype.get_referrer_info=function(){return O.strip_empty_properties({$initial_referrer:this.props.$initial_referrer,$initial_referring_domain:this.props.$initial_referring_domain})},Nt.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)},Nt.prototype.set_disabled=function(e){this.disabled=e,this.disabled?this.remove():this.save()},Nt.prototype.set_cookie_domain=function(e){e!==this.cookie_domain&&(this.remove(),this.cookie_domain=e,this.save())},Nt.prototype.set_cross_site=function(e){e!==this.cross_site&&(this.cross_site=e,this.remove(),this.save())},Nt.prototype.set_cross_subdomain=function(e){e!==this.cross_subdomain&&(this.cross_subdomain=e,this.remove(),this.save())},Nt.prototype.get_cross_subdomain=function(){return this.cross_subdomain},Nt.prototype.set_secure=function(e){e!==this.secure&&(this.secure=!!e,this.remove(),this.save())},Nt.prototype._add_to_people_queue=function(e,t){var n=this._get_queue_key(e),r=t[e],i=this._get_or_create_queue(ss),o=this._get_or_create_queue(Iu),a=this._get_or_create_queue(bo),u=this._get_or_create_queue(al),c=this._get_or_create_queue(sl),d=this._get_or_create_queue(la,[]),p=this._get_or_create_queue(No,[]);n===Xx?(O.extend(i,r),this._pop_from_people_queue(al,r),this._pop_from_people_queue(sl,r),this._pop_from_people_queue(bo,r)):n===Jx?(O.each(r,function(h,m){m in o||(o[m]=h)}),this._pop_from_people_queue(bo,r)):n===ew?O.each(r,function(h){O.each([i,o,u,c],function(m){h in m&&delete m[h]}),O.each(p,function(m){h in m&&delete m[h]}),a[h]=!0}):n===tw?(O.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(bo,r)):n===iw?(O.each(r,function(h,m){O.isArray(h)&&(m in c||(c[m]=[]),O.each(h,function(v){O.include(c[m],v)||c[m].push(v)}))}),this._pop_from_people_queue(bo,r)):n===rw?(d.push(r),this._pop_from_people_queue(No,r)):n===nw&&(p.push(r),this._pop_from_people_queue(bo,r)),on.log("MIXPANEL PEOPLE REQUEST (QUEUED, PENDING IDENTIFY):"),on.log(t),this.save()},Nt.prototype._pop_from_people_queue=function(e,t){var n=this.props[this._get_queue_key(e)];O.isUndefined(n)||O.each(t,function(r,i){e===No||e===la?O.each(n,function(o){o[i]===r&&delete o[i]}):delete n[i]},this)},Nt.prototype.load_queue=function(e){return this.load_prop(this._get_queue_key(e))},Nt.prototype._get_queue_key=function(e){if(e===ss)return Xx;if(e===Iu)return Jx;if(e===bo)return ew;if(e===al)return tw;if(e===No)return nw;if(e===la)return rw;if(e===sl)return iw;on.error("Invalid queue:",e)},Nt.prototype._get_or_create_queue=function(e,t){var n=this._get_queue_key(e);return t=O.isUndefined(t)?{}:t,this.props[n]||(this.props[n]=t)},Nt.prototype.set_event_timer=function(e,t){var n=this.load_prop(Jf)||{};n[e]=t,this.props[Jf]=n,this.save()},Nt.prototype.remove_event_timer=function(e){var t=this.load_prop(Jf)||{},n=t[e];return O.isUndefined(n)||(delete this.props[Jf][e],this.save()),n};var ow,x3=function(e,t){throw new Error(e+" not available in this build.")},ni,w3=0,iK=1,oK=function(e){return e},Ji="mixpanel",S3="base64",aK="json",aw="$device:",Tu=it.XMLHttpRequest&&"withCredentials"in new XMLHttpRequest,C3=!Tu&&oa.indexOf("MSIE")===-1&&oa.indexOf("Mozilla")===-1,Gg=null;rs.sendBeacon&&(Gg=function(){return rs.sendBeacon.apply(rs,arguments)});var k3={track:"track/",engage:"engage/",groups:"groups/",record:"record/"},E3={api_host:"https://api-js.mixpanel.com",api_routes:k3,api_method:"POST",api_transport:"XHR",api_payload_format:S3,app_host:"https://mixpanel.com",autocapture:!1,cdn:"https://cdn.mxpnl.com",cross_site_cookie:!1,cross_subdomain_cookie:!0,error_reporter:is,persistence:"cookie",persistence_name:"",cookie_domain:"",cookie_name:"",loaded:is,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:Vf,record_min_ms:0,record_sessions_percent:0,recorder_src:"https://cdn.mxpnl.com/libs/mixpanel-recorder.min.js"},A3=!1,fe=function(){},sw=function(e,t,n){var r,i=n===Ji?ni:ni[n];if(i&&ow===w3)r=i;else{if(i&&!O.isArray(i)){on.error("You have already initialized "+n);return}r=new fe}if(r._cached_groups={},r._init(e,t,n),r.people=new Tt,r.people._init(r),!r.get_config("skip_first_touch_marketing")){var o=O.info.campaignParams(null),a={},u=!1;O.each(o,function(c,d){a["initial_"+d]=c,c&&(u=!0)}),u&&r.people.set_once(a)}return _o.DEBUG=_o.DEBUG||r.get_config("debug"),!O.isUndefined(i)&&O.isArray(i)&&(r._execute_array.call(r.people,i.people),r._execute_array(i)),r};fe.prototype.init=function(e,t,n){if(O.isUndefined(n)){this.report_error("You must name your new library: init(token, config, name)");return}if(n===Ji){this.report_error("You must initialize the main mixpanel object right after you include the Mixpanel js snippet");return}var r=sw(e,t,n);return ni[n]=r,r._loaded(),r},fe.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||E3.api_host;i.match(/\.mixpanel\.com/)&&(r.api_payload_format=aK)}if(this.set_config(O.extend({},E3,r,t,{name:n,token:e,callback_fn:(n===Ji?n:Ji+"."+n)+"._jsc"})),this._jsc=is,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(!O.localStorage.is_supported(!0)||!Tu)this._batch_requests=!1,on.log("Turning off Mixpanel request-queueing; needs XHR and localStorage support"),O.each(this.get_batcher_configs(),function(u){on.log("Clearing batch queue "+u.queue_key),O.localStorage.remove(u.queue_key)});else if(this.init_batchers(),Gg&&it.addEventListener){var o=O.bind(function(){this.request_batchers.events.stopped||this.request_batchers.events.flush({unloading:!0})},this);it.addEventListener("pagehide",function(u){u.persisted&&o()}),it.addEventListener("visibilitychange",function(){dn.visibilityState==="hidden"&&o()})}}this.persistence=this.cookie=new Nt(this.config),this.unpersisted_superprops={},this._gdpr_init();var a=O.UUID();this.get_distinct_id()||this.register_once({distinct_id:aw+a,$device_id:a},""),this.autocapture=new Di(this),this.autocapture.init(),this._init_tab_id(),this._check_and_start_session_recording()},fe.prototype._init_tab_id=function(){if(O.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;(O.sessionStorage.get(n)||!O.sessionStorage.get(t))&&O.sessionStorage.set(t,"$tab-"+O.UUID()),O.sessionStorage.set(n,"1"),this.tab_id=O.sessionStorage.get(t),it.addEventListener("beforeunload",function(){O.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.")},fe.prototype.get_tab_id=function(){return this.tab_id||null},fe.prototype._should_load_recorder=function(){var e=new $o(Bx),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(Ux(n[r])||n[r].tabId===t)return!0;return!1}).catch(O.bind(function(n){this.report_error("Error checking recording registry",n)},this))},fe.prototype._check_and_start_session_recording=os(function(e){if(!it.MutationObserver){on.critical("Browser does not support MutationObserver; skipping session recording");return}var t=O.bind(function(r){var i=O.bind(function(){this._recorder=this._recorder||new it.__mp_recorder(this),this._recorder.resumeRecording(r)},this);O.isUndefined(it.__mp_recorder)?x3(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)})}),fe.prototype.start_session_recording=function(){this._check_and_start_session_recording(!0)},fe.prototype.stop_session_recording=function(){this._recorder&&this._recorder.stopRecording()},fe.prototype.pause_session_recording=function(){this._recorder&&this._recorder.pauseRecording()},fe.prototype.resume_session_recording=function(){this._recorder&&this._recorder.resumeRecording()},fe.prototype.get_session_recording_properties=function(){var e={},t=this._get_session_replay_id();return t&&(e.$mp_replay_id=t),e},fe.prototype.get_session_replay_url=function(){var e=null,t=this._get_session_replay_id();if(t){var n=O.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},fe.prototype._get_session_replay_id=function(){var e=null;return this._recorder&&(e=this._recorder.replayId),e||null},fe.prototype.__get_recorder=function(){return this._recorder},fe.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=O.info.campaignParams(null);O.each(e,(function(t,n){this.unregister(n)}).bind(this))}},fe.prototype._set_default_superprops=function(){this.persistence.update_search_keyword(dn.referrer),this.get_config("store_google")&&!this.get_config("stop_utm_persistence")&&this.register(O.info.campaignParams()),this.get_config("save_referrer")&&this.persistence.update_referrer_info(dn.referrer)},fe.prototype._dom_loaded=function(){O.each(this.__dom_loaded_queue,function(e){this._track_dom.apply(this,e)},this),this.has_opted_out_tracking()||O.each(this.__request_queue,function(e){this._send_request.apply(this,e)},this),delete this.__dom_loaded_queue,delete this.__request_queue},fe.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(!A3)return this.__dom_loaded_queue.push([e,t]),!1;var n=new e().init(this);return n.track.apply(n,t)},fe.prototype._prepare_callback=function(e,t){if(O.isUndefined(e))return null;if(Tu){var n=function(a){e(a,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(a){delete r[i],e(a,t)},o}},fe.prototype._send_request=function(e,t,n,r){var i=!0;if(C3)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")},a=null;!r&&(O.isFunction(n)||typeof n=="string")&&(r=n,n=null),n=O.extend(o,n||{}),Tu||(n.method="GET");var u=n.method==="POST",c=Gg&&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&&(a="data="+encodeURIComponent(t.data),delete t.data),e+="?"+O.HTTPBuildQuery(t);var p=this;if("img"in t){var h=dn.createElement("img");h.src=e,dn.body.appendChild(h)}else if(c){try{i=Gg(e,a)}catch(b){p.report_error(b),i=!1}try{r&&r(i?1:0)}catch(b){p.report_error(b)}}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"),O.each(v,function(b,k){m.setRequestHeader(k,b)}),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 b;try{b=O.JSONDecode(m.responseText)}catch(A){if(p.report_error(A),n.ignore_json_errors)b=m.responseText;else return}r(b)}else r(Number(m.responseText))}else{var k;if(m.timeout&&!m.status&&new Date().getTime()-_>=m.timeout?k="timeout":k="Bad HTTP status: "+m.status+" "+m.statusText,p.report_error(k),r)if(d){var E=m.responseHeaders||{};r({status:0,httpStatusCode:m.status,error:k,retryAfter:E["Retry-After"]})}else r(0)}},m.send(a)}catch(b){p.report_error(b),i=!1}else{var S=dn.createElement("script");S.type="text/javascript",S.async=!0,S.defer=!0,S.src=e;var x=dn.getElementsByTagName("script")[0];x.parentNode.insertBefore(S,x)}return i},fe.prototype._execute_array=function(e){var t,n=[],r=[],i=[];O.each(e,function(a){a&&(t=a[0],O.isArray(t)?i.push(a):typeof a=="function"?a.call(this):O.isArray(a)&&t==="alias"?n.push(a):O.isArray(a)&&t.indexOf("track")!==-1&&typeof this[t]=="function"?i.push(a):r.push(a))},this);var o=function(a,u){O.each(a,function(c){if(O.isArray(c[0])){var d=u;O.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)},fe.prototype.are_batchers_initialized=function(){return!!this.request_batchers.events},fe.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},fe.prototype.init_batchers=function(){if(!this.are_batchers_initialized()){var e=O.bind(function(n){return new Xi(n.queue_key,{libConfig:this.config,errorReporter:this.get_config("error_reporter"),sendRequestFunc:O.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:O.bind(function(r){return this._run_hook("before_send_"+n.type,r)},this),stopAllBatchingFunc:O.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()},fe.prototype.start_batch_senders=function(){this._batchers_were_started=!0,this.are_batchers_initialized()&&(this._batch_requests=!0,O.each(this.request_batchers,function(e){e.start()}))},fe.prototype.stop_batch_senders=function(){this._batch_requests=!1,O.each(this.request_batchers,function(e){e.stop(),e.clear()})},fe.prototype.push=function(e){this._execute_array([e])},fe.prototype.disable=function(e){typeof e>"u"?this._flags.disable_all_events=!0:this.__disabled_events=this.__disabled_events.concat(e)},fe.prototype._encode_data_for_request=function(e){var t=wu(e);return this.get_config("api_payload_format")===S3&&(t=O.base64Encode(t)),{data:t}},fe.prototype._track_or_batch=function(e,t){var n=O.truncate(e.data,255),r=e.endpoint,i=e.batcher,o=e.should_send_immediately,a=e.send_request_options||{};t=t||is;var u=!0,c=O.bind(function(){return a.skip_hooks||(n=this._run_hook("before_send_"+e.type,n)),n?(on.log("MIXPANEL REQUEST:"),on.log(n),this._send_request(r,this._encode_data_for_request(n),a,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},fe.prototype.track=os(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=is),O.isUndefined(e)){this.report_error("No event name provided to mixpanel.track");return}if(this._event_is_disabled(e)){r(0);return}t=O.extend({},t),t.token=this.get_config("token");var a=this.persistence.remove_event_timer(e);if(!O.isUndefined(a)){var u=new Date().getTime()-a;t.$duration=parseFloat((u/1e3).toFixed(3))}this._set_default_superprops();var c=this.get_config("track_marketing")?O.info.marketingParams():{};t=O.extend({},O.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");O.isArray(d)?O.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}),fe.prototype.set_group=os(function(e,t,n){O.isArray(t)||(t=[t]);var r={};return r[e]=t,this.register(r),this.people.set(e,t,n)}),fe.prototype.add_group=os(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)}),fe.prototype.remove_group=os(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)}),fe.prototype.track_with_groups=os(function(e,t,n,r){var i=O.extend({},t||{});return O.each(n,function(o,a){o!=null&&(i[a]=o)}),this.track(e,i,r)}),fe.prototype._create_map_key=function(e,t){return e+"_"+JSON.stringify(t)},fe.prototype._remove_group_from_cache=function(e,t){delete this._cached_groups[this._create_map_key(e,t)]},fe.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 $n,r._init(this,e,t),this._cached_groups[n]=r),r},fe.prototype.track_pageview=os(function(e,t){typeof e!="object"&&(e={}),t=t||{};var n=t.event_name||"$mp_web_page_view",r=O.extend(O.info.mpPageViewProperties(),O.info.campaignParams(),O.info.clickParams()),i=O.extend({},r,e);return this.track(n,i)}),fe.prototype.track_links=function(){return this._track_dom.call(this,Au,arguments)},fe.prototype.track_forms=function(){return this._track_dom.call(this,qg,arguments)},fe.prototype.time_event=function(e){if(O.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 sK={persistent:!0},lw=function(e){var t;return O.isObject(e)?t=e:O.isUndefined(e)?t={}:t={days:e},O.extend({},sK,t)};fe.prototype.register=function(e,t){var n=lw(t);n.persistent?this.persistence.register(e,n.days):O.extend(this.unpersisted_superprops,e)},fe.prototype.register_once=function(e,t,n){var r=lw(n);r.persistent?this.persistence.register_once(e,t,r.days):(typeof t>"u"&&(t="None"),O.each(e,function(i,o){(!this.unpersisted_superprops.hasOwnProperty(o)||this.unpersisted_superprops[o]===t)&&(this.unpersisted_superprops[o]=i)},this))},fe.prototype.unregister=function(e,t){t=lw(t),t.persistent?this.persistence.unregister(e):delete this.unpersisted_superprops[e]},fe.prototype._register_single=function(e,t){var n={};n[e]=t,this.register(n)},fe.prototype.identify=function(e,t,n,r,i,o,a,u){var c=this.get_distinct_id();if(e&&c!==e){if(typeof e=="string"&&e.indexOf(aw)===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(Hg)&&(this.unregister(Hg),this.register({distinct_id:e})),this._flags.identify_called=!0,this.people._flush(t,n,r,i,o,a,u),e!==c&&this.track("$identify",{distinct_id:e,$anon_distinct_id:c},{skip_hooks:!0})},fe.prototype.reset=function(){this.persistence.clear(),this._flags.identify_called=!1;var e=O.UUID();this.register_once({distinct_id:aw+e,$device_id:e},"")},fe.prototype.get_distinct_id=function(){return this.get_property("distinct_id")},fe.prototype.alias=function(e,t){if(e===this.get_property(b3))return this.report_error("Attempting to create alias for existing People user - aborting."),-2;var n=this;return O.isUndefined(t)&&(t=this.get_distinct_id()),e!==t?(this._register_single(Hg,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)},fe.prototype.name_tag=function(e){this._register_single("mp_name_tag",e)},fe.prototype.set_config=function(e){if(O.isObject(e)){O.extend(this.config,e);var t=e.batch_size;t&&O.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),_o.DEBUG=_o.DEBUG||this.get_config("debug"),"autocapture"in e&&this.autocapture&&this.autocapture.init()}},fe.prototype.get_config=function(e){return this.config[e]},fe.prototype._run_hook=function(e){var t=(this.config.hooks[e]||oK).apply(this,ns.call(arguments,1));return typeof t>"u"&&(this.report_error(e+" hook did not return a value"),t=null),t},fe.prototype.get_property=function(e){return this.persistence.load_prop([e])},fe.prototype.toString=function(){var e=this.get_config("name");return e!==Ji&&(e=Ji+"."+e),e},fe.prototype._event_is_disabled=function(e){return O.isBlockedUA(oa)||this._flags.disable_all_events||O.include(this.__disabled_events,e)},fe.prototype._gdpr_init=function(){var e=this.get_config("opt_out_tracking_persistence_type")==="localStorage";e&&O.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")||O.cookie.get("mp_optout"))&&(O.cookie.remove("mp_optout"),this.opt_out_tracking({clear_persistence:this.get_config("opt_out_persistence_by_default")}))},fe.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()},fe.prototype._gdpr_call_func=function(e,t){return t=O.extend({track:O.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),O.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})},fe.prototype.opt_in_tracking=function(e){e=O.extend({enable_persistence:!0},e),this._gdpr_call_func(MW,e),this._gdpr_update_persistence(e)},fe.prototype.opt_out_tracking=function(e){e=O.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(OW,e),this._gdpr_update_persistence(e)},fe.prototype.has_opted_in_tracking=function(e){return this._gdpr_call_func(RW,e)},fe.prototype.has_opted_out_tracking=function(e){return this._gdpr_call_func(j$,e)},fe.prototype.clear_opt_in_out_tracking=function(e){e=O.extend({enable_persistence:!0},e),this._gdpr_call_func($W,e),this._gdpr_update_persistence(e)},fe.prototype.report_error=function(e,t){on.error.apply(on.error,arguments);try{!t&&!(e instanceof Error)&&(e=new Error(e)),this.get_config("error_reporter")(e,t)}catch(n){on.error(n)}},fe.prototype.init=fe.prototype.init,fe.prototype.reset=fe.prototype.reset,fe.prototype.disable=fe.prototype.disable,fe.prototype.time_event=fe.prototype.time_event,fe.prototype.track=fe.prototype.track,fe.prototype.track_links=fe.prototype.track_links,fe.prototype.track_forms=fe.prototype.track_forms,fe.prototype.track_pageview=fe.prototype.track_pageview,fe.prototype.register=fe.prototype.register,fe.prototype.register_once=fe.prototype.register_once,fe.prototype.unregister=fe.prototype.unregister,fe.prototype.identify=fe.prototype.identify,fe.prototype.alias=fe.prototype.alias,fe.prototype.name_tag=fe.prototype.name_tag,fe.prototype.set_config=fe.prototype.set_config,fe.prototype.get_config=fe.prototype.get_config,fe.prototype.get_property=fe.prototype.get_property,fe.prototype.get_distinct_id=fe.prototype.get_distinct_id,fe.prototype.toString=fe.prototype.toString,fe.prototype.opt_out_tracking=fe.prototype.opt_out_tracking,fe.prototype.opt_in_tracking=fe.prototype.opt_in_tracking,fe.prototype.has_opted_out_tracking=fe.prototype.has_opted_out_tracking,fe.prototype.has_opted_in_tracking=fe.prototype.has_opted_in_tracking,fe.prototype.clear_opt_in_out_tracking=fe.prototype.clear_opt_in_out_tracking,fe.prototype.get_group=fe.prototype.get_group,fe.prototype.set_group=fe.prototype.set_group,fe.prototype.add_group=fe.prototype.add_group,fe.prototype.remove_group=fe.prototype.remove_group,fe.prototype.track_with_groups=fe.prototype.track_with_groups,fe.prototype.start_batch_senders=fe.prototype.start_batch_senders,fe.prototype.stop_batch_senders=fe.prototype.stop_batch_senders,fe.prototype.start_session_recording=fe.prototype.start_session_recording,fe.prototype.stop_session_recording=fe.prototype.stop_session_recording,fe.prototype.pause_session_recording=fe.prototype.pause_session_recording,fe.prototype.resume_session_recording=fe.prototype.resume_session_recording,fe.prototype.get_session_recording_properties=fe.prototype.get_session_recording_properties,fe.prototype.get_session_replay_url=fe.prototype.get_session_replay_url,fe.prototype.get_tab_id=fe.prototype.get_tab_id,fe.prototype.DEFAULT_API_ROUTES=k3,fe.prototype.__get_recorder=fe.prototype.__get_recorder,Nt.prototype.properties=Nt.prototype.properties,Nt.prototype.update_search_keyword=Nt.prototype.update_search_keyword,Nt.prototype.update_referrer_info=Nt.prototype.update_referrer_info,Nt.prototype.get_cross_subdomain=Nt.prototype.get_cross_subdomain,Nt.prototype.clear=Nt.prototype.clear;var Mu={},lK=function(){O.each(Mu,function(e,t){t!==Ji&&(ni[t]=e)}),ni._=O},uK=function(){ni.init=function(e,t,n){if(n)return ni[n]||(ni[n]=Mu[n]=sw(e,t,n),ni[n]._loaded()),ni[n];var r=ni;Mu[Ji]?r=Mu[Ji]:e&&(r=sw(e,t,Ji),r._loaded(),Mu[Ji]=r),ni=r,ow===iK&&(it[Ji]=ni),lK()}},cK=function(){function e(){e.done||(e.done=!0,A3=!0,C3=!1,O.each(Mu,function(r){r._dom_loaded()}))}function t(){try{dn.documentElement.doScroll("left")}catch{setTimeout(t,1);return}e()}if(dn.addEventListener)dn.readyState==="complete"?e():dn.addEventListener("DOMContentLoaded",e,!1);else if(dn.attachEvent){dn.attachEvent("onreadystatechange",e);var n=!1;try{n=it.frameElement===null}catch{}dn.documentElement.doScroll&&n&&t()}O.register_event(it,"load",e,!0)};function fK(e){return x3=e,ow=w3,ni=new fe,uK(),ni.init(),cK(),ni}function dK(e,t){t()}var ls=fK(dK);const Zn="https://debales.ai",hK="https://debales-web-app-server-prod.azurewebsites.net",I3={"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"},pK="phc_OKaClHZDmbEpVscrwceWJB5lsMYbMaV586L7pai6ZKD",Vg=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 an(){const e=sessionStorage.getItem("debalesSessionID");if(e)return e;const t=crypto.randomUUID();return sessionStorage.setItem("debalesSessionID",t),t}function gK(){return sessionStorage.getItem(qt(jt.LAST_SHOWN_MESSAGE_ID,{botId:window.DebalesChat.projectId}))}function Nr(){const e=localStorage.getItem(qt(jt.USER_INFO));return e?JSON.parse(e):null}function ua(e){localStorage.setItem(qt(jt.USER_INFO),JSON.stringify(e))}function ri(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,a=performance.now(),u=c=>{const d=c-a,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 mK(){return window.location.pathname}function ed(){const e=/test|demo|example|debales/i,t=Nr()??"";return!!(t&&e.test(t.email))}function Zg(e){const t=mK(),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,a)=>(o.sortOrder??0)-(a.sortOrder??0))}const T3=new Set,Yg=e=>{const t=I3[e];if(!t)return console.warn("No Mixpanel token found"),null;if(T3.has(e))return ls;ls.init(t,{debug:!1,track_pageview:!0,persistence:"localStorage"}),console.log("Mixpanel initialized");const n=Nr();return n&&n.email&&ls.identify(n.email),T3.add(e),ls},vK=async(e,t)=>{if(ed())return;const n=window.DebalesChat.projectId??t.projectId;if(!I3[n]){console.warn("No Mixpanel token found");return}ls.track(e,t)},yK=()=>{const e=localStorage.getItem("anonymousUserId");if(e)return e;const t=crypto.randomUUID();return localStorage.setItem("anonymousUserId",t),t};function ll(e){return e?e.split("<br>").filter(n=>n.trim().length>0).map(n=>n.trim()):[""]}const Br=e=>e.toLowerCase().includes("gaiabay")||e.toLowerCase().includes("debales-testing"),_K=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 qt(e,t){return t!=null&&t.botId?`debales_${t.botId}_${e}`:`debales_${e}`}const M3=R.createContext(null),td=()=>{const e=R.useContext(M3);if(!e)throw new Error("useCart must be used within a CartProvider");return e};var bK="2.0.0",Ou="",O3="?",Wg="function",us="undefined",Ru="object",uw="string",nd="major",Fe="model",Le="name",$e="type",Ge="vendor",Pe="version",ki="architecture",$u="console",$t="mobile",Bn="tablet",ii="smarttv",rd="wearable",cw="xr",fw="embedded",id="inapp",R3="user-agent",dw=500,hw="brands",ul="formFactors",pw="fullVersionList",Du="platform",gw="platformVersion",Kg="bitness",cs="sec-ch-ua",xK=cs+"-full-version-list",wK=cs+"-arch",SK=cs+"-"+Kg,CK=cs+"-form-factors",kK=cs+"-"+$t,EK=cs+"-"+Fe,$3=cs+"-"+Du,AK=$3+"-version",D3=[hw,pw,$t,Fe,Du,gw,ki,ul,Kg],Li="browser",ca="cpu",Bo="device",fa="engine",eo="os",Lu="result",Qg="Amazon",od="Apple",L3="ASUS",N3="BlackBerry",cl="Google",B3="Huawei",P3="Lenovo",IK="Honor",mw="LG",Xg="Microsoft",F3="Motorola",ad="Samsung",z3="Sharp",Jg="Sony",vw="Xiaomi",yw="Zebra",Nu="Mobile ",sd=" Browser",U3="Chrome",fs="Chromecast",TK="Edge",ld="Firefox",ud="Opera",j3="Facebook",q3="Sogou",_w="Windows",MK=typeof window!==us,Ei=MK&&window.navigator?window.navigator:void 0,ds=Ei&&Ei.userAgentData?Ei.userAgentData:void 0,OK=function(e,t){var n={},r=t;if(!tm(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 a in e)n[a]=r[a]&&r[a].length%2===0?r[a].concat(e[a]):e[a];return n},em=function(e){for(var t={},n=0;n<e.length;n++)t[e[n].toUpperCase()]=e[n];return t},bw=function(e,t){if(typeof e===Ru&&e.length>0){for(var n in e)if(da(e[n])==da(t))return!0;return!1}return Bu(e)?da(t).indexOf(da(e))!==-1:!1},tm=function(e,t){for(var n in e)return/^(browser|cpu|device|engine|os)$/.test(n)||(t?tm(e[n]):!1)},Bu=function(e){return typeof e===uw},xw=function(e){if(e){for(var t=[],n=fl(/\\?\"/g,e).split(","),r=0;r<n.length;r++)if(n[r].indexOf(";")>-1){var i=fd(n[r]).split(";v=");t[r]={brand:i[0],version:i[1]}}else t[r]=fd(n[r]);return t}},da=function(e){return Bu(e)?e.toLowerCase():e},ww=function(e){return Bu(e)?fl(/[^\d\.]/g,e).split(".")[0]:void 0},ha=function(e){for(var t in e){var n=e[t];typeof n==Ru&&n.length==2?this[n[0]]=n[1]:this[n]=void 0}return this},fl=function(e,t){return Bu(t)?t.replace(e,Ou):t},cd=function(e){return fl(/\\?\"/g,e)},fd=function(e,t){if(Bu(e))return e=fl(/^\s\s*/,e),typeof t===us?e:e.substring(0,dw)},H3=function(e,t){if(!(!e||!t))for(var n=0,r,i,o,a,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],a=p[o],typeof a===Ru&&a.length>0?a.length===2?typeof a[1]==Wg?this[a[0]]=a[1].call(this,c):this[a[0]]=a[1]:a.length===3?typeof a[1]===Wg&&!(a[1].exec&&a[1].test)?this[a[0]]=c?a[1].call(this,c,a[2]):void 0:this[a[0]]=c?c.replace(a[1],a[2]):void 0:a.length===4&&(this[a[0]]=c?a[3].call(this,c.replace(a[1],a[2])):void 0):this[a]=c||void 0;n+=2}},dd=function(e,t){for(var n in t)if(typeof t[n]===Ru&&t[n].length>0){for(var r=0;r<t[n].length;r++)if(bw(t[n][r],e))return n===O3?void 0:n}else if(bw(t[n],e))return n===O3?void 0:n;return t.hasOwnProperty("*")?t["*"]:e},G3={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"},V3={embedded:"Automotive",mobile:"Mobile",tablet:["Tablet","EInk"],smarttv:"TV",wearable:"Watch",xr:["VR","XR"],"?":["Desktop","Unknown"],"*":void 0},Z3={browser:[[/\b(?:crmo|crios)\/([\w\.]+)/i],[Pe,[Le,Nu+"Chrome"]],[/edg(?:e|ios|a)?\/([\w\.]+)/i],[Pe,[Le,"Edge"]],[/(opera mini)\/([-\w\.]+)/i,/(opera [mobiletab]{3,6})\b.+version\/([-\w\.]+)/i,/(opera)(?:.+version\/|[\/ ]+)([\w\.]+)/i],[Le,Pe],[/opios[\/ ]+([\w\.]+)/i],[Pe,[Le,ud+" Mini"]],[/\bop(?:rg)?x\/([\w\.]+)/i],[Pe,[Le,ud+" GX"]],[/\bopr\/([\w\.]+)/i],[Pe,[Le,ud]],[/\bb[ai]*d(?:uhd|[ub]*[aekoprswx]{5,6})[\/ ]?([\w\.]+)/i],[Pe,[Le,"Baidu"]],[/\b(?:mxbrowser|mxios|myie2)\/?([-\w\.]*)\b/i],[Pe,[Le,"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],[Le,Pe],[/quark(?:pc)?\/([-\w\.]+)/i],[Pe,[Le,"Quark"]],[/\bddg\/([\w\.]+)/i],[Pe,[Le,"DuckDuckGo"]],[/(?:\buc? ?browser|(?:juc.+)ucweb)[\/ ]?([\w\.]+)/i],[Pe,[Le,"UCBrowser"]],[/microm.+\bqbcore\/([\w\.]+)/i,/\bqbcore\/([\w\.]+).+microm/i,/micromessenger\/([\w\.]+)/i],[Pe,[Le,"WeChat"]],[/konqueror\/([\w\.]+)/i],[Pe,[Le,"Konqueror"]],[/trident.+rv[: ]([\w\.]{1,9})\b.+like gecko/i],[Pe,[Le,"IE"]],[/ya(?:search)?browser\/([\w\.]+)/i],[Pe,[Le,"Yandex"]],[/slbrowser\/([\w\.]+)/i],[Pe,[Le,"Smart "+P3+sd]],[/(avast|avg)\/([\w\.]+)/i],[[Le,/(.+)/,"$1 Secure"+sd],Pe],[/\bfocus\/([\w\.]+)/i],[Pe,[Le,ld+" Focus"]],[/\bopt\/([\w\.]+)/i],[Pe,[Le,ud+" Touch"]],[/coc_coc\w+\/([\w\.]+)/i],[Pe,[Le,"Coc Coc"]],[/dolfin\/([\w\.]+)/i],[Pe,[Le,"Dolphin"]],[/coast\/([\w\.]+)/i],[Pe,[Le,ud+" Coast"]],[/miuibrowser\/([\w\.]+)/i],[Pe,[Le,"MIUI"+sd]],[/fxios\/([\w\.-]+)/i],[Pe,[Le,Nu+ld]],[/\bqihoobrowser\/?([\w\.]*)/i],[Pe,[Le,"360"]],[/\b(qq)\/([\w\.]+)/i],[[Le,/(.+)/,"$1Browser"],Pe],[/(oculus|sailfish|huawei|vivo|pico)browser\/([\w\.]+)/i],[[Le,/(.+)/,"$1"+sd],Pe],[/samsungbrowser\/([\w\.]+)/i],[Pe,[Le,ad+" Internet"]],[/metasr[\/ ]?([\d\.]+)/i],[Pe,[Le,q3+" Explorer"]],[/(sogou)mo\w+\/([\d\.]+)/i],[[Le,q3+" Mobile"],Pe],[/(electron)\/([\w\.]+) safari/i,/(tesla)(?: qtcarbrowser|\/(20\d\d\.[-\w\.]+))/i,/m?(qqbrowser|2345(?=browser|chrome|explorer))\w*[\/ ]?v?([\w\.]+)/i],[Le,Pe],[/(lbbrowser|rekonq)/i],[Le],[/ome\/([\w\.]+) \w* ?(iron) saf/i,/ome\/([\w\.]+).+qihu (360)[es]e/i],[Pe,Le],[/((?:fban\/fbios|fb_iab\/fb4a)(?!.+fbav)|;fbav\/([\w\.]+);)/i],[[Le,j3],Pe,[$e,id]],[/(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],[Le,Pe,[$e,id]],[/\bgsa\/([\w\.]+) .*safari\//i],[Pe,[Le,"GSA"],[$e,id]],[/musical_ly(?:.+app_?version\/|_)([\w\.]+)/i],[Pe,[Le,"TikTok"],[$e,id]],[/\[(linkedin)app\]/i],[Le,[$e,id]],[/(chromium)[\/ ]([-\w\.]+)/i],[Le,Pe],[/headlesschrome(?:\/([\w\.]+)| )/i],[Pe,[Le,U3+" Headless"]],[/ wv\).+(chrome)\/([\w\.]+)/i],[[Le,U3+" WebView"],Pe],[/droid.+ version\/([\w\.]+)\b.+(?:mobile safari|safari)/i],[Pe,[Le,"Android"+sd]],[/chrome\/([\w\.]+) mobile/i],[Pe,[Le,Nu+"Chrome"]],[/(chrome|omniweb|arora|[tizenoka]{5} ?browser)\/v?([\w\.]+)/i],[Le,Pe],[/version\/([\w\.\,]+) .*mobile(?:\/\w+ | ?)safari/i],[Pe,[Le,Nu+"Safari"]],[/iphone .*mobile(?:\/\w+ | ?)safari/i],[[Le,Nu+"Safari"]],[/version\/([\w\.\,]+) .*(safari)/i],[Pe,Le],[/webkit.+?(mobile ?safari|safari)(\/[\w\.]+)/i],[Le,[Pe,"1"]],[/(webkit|khtml)\/([\w\.]+)/i],[Le,Pe],[/(?:mobile|tablet);.*(firefox)\/([\w\.-]+)/i],[[Le,Nu+ld],Pe],[/(navigator|netscape\d?)\/([-\w\.]+)/i],[[Le,"Netscape"],Pe],[/(wolvic|librewolf)\/([\w\.]+)/i],[Le,Pe],[/mobile vr; rv:([\w\.]+)\).+firefox/i],[Pe,[Le,ld+" 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],[Le,[Pe,/_/g,"."]],[/(cobalt)\/([\w\.]+)/i],[Le,[Pe,/[^\d\.]+./,Ou]]],cpu:[[/\b(?:(amd|x|x86[-_]?|wow|win)64)\b/i],[[ki,"amd64"]],[/(ia32(?=;))/i,/((?:i[346]|x)86)[;\)]/i],[[ki,"ia32"]],[/\b(aarch64|arm(v?8e?l?|_?64))\b/i],[[ki,"arm64"]],[/\b(arm(?:v[67])?ht?n?[fl]p?)\b/i],[[ki,"armhf"]],[/windows (ce|mobile); ppc;/i],[[ki,"arm"]],[/((?:ppc|powerpc)(?:64)?)(?: mac|;|\))/i],[[ki,/ower/,Ou,da]],[/(sun4\w)[;\)]/i],[[ki,"sparc"]],[/((?:avr32|ia64(?=;))|68k(?=\))|\barm(?=v(?:[1-7]|[5-7]1)l?|;|eabi)|(?=atmel )avr|(?:irix|mips|sparc)(?:64)?\b|pa-risc)/i],[[ki,da]]],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],[Fe,[Ge,ad],[$e,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],[Fe,[Ge,ad],[$e,$t]],[/(?:\/|\()(ip(?:hone|od)[\w, ]*)(?:\/|;)/i],[Fe,[Ge,od],[$e,$t]],[/\((ipad);[-\w\),; ]+apple/i,/applecoremedia\/[\w\.]+ \((ipad)/i,/\b(ipad)\d\d?,\d\d?[;\]].+ios/i],[Fe,[Ge,od],[$e,Bn]],[/(macintosh);/i],[Fe,[Ge,od]],[/\b(sh-?[altvz]?\d\d[a-ekm]?)/i],[Fe,[Ge,z3],[$e,$t]],[/(?:honor)([-\w ]+)[;\)]/i],[Fe,[Ge,IK],[$e,$t]],[/\b((?:ag[rs][23]?|bah2?|sht?|btv)-a?[lw]\d{2})\b(?!.+d\/s)/i],[Fe,[Ge,B3],[$e,Bn]],[/(?:huawei)([-\w ]+)[;\)]/i,/\b(nexus 6p|\w{2,4}e?-[atu]?[ln][\dx][012359c][adn]?)\b(?!.+d\/s)/i],[Fe,[Ge,B3],[$e,$t]],[/\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],[[Fe,/_/g," "],[Ge,vw],[$e,$t]],[/oid[^\)]+; (2\d{4}(283|rpbf)[cgl])( bui|\))/i,/\b(mi[-_ ]?(?:pad)(?:[\w_ ]+))(?: bui|\))/i],[[Fe,/_/g," "],[Ge,vw],[$e,Bn]],[/; (\w+) bui.+ oppo/i,/\b(cph[12]\d{3}|p(?:af|c[al]|d\w|e[ar])[mt]\d0|x9007|a101op)\b/i],[Fe,[Ge,"OPPO"],[$e,$t]],[/\b(opd2\d{3}a?) bui/i],[Fe,[Ge,"OPPO"],[$e,Bn]],[/vivo (\w+)(?: bui|\))/i,/\b(v[12]\d{3}\w?[at])(?: bui|;)/i],[Fe,[Ge,"Vivo"],[$e,$t]],[/\b(rmx[1-3]\d{3})(?: bui|;|\))/i],[Fe,[Ge,"Realme"],[$e,$t]],[/\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],[Fe,[Ge,F3],[$e,$t]],[/\b(mz60\d|xoom[2 ]{0,2}) build\//i],[Fe,[Ge,F3],[$e,Bn]],[/((?=lg)?[vl]k\-?\d{3}) bui| 3\.[-\w; ]{10}lg?-([06cv9]{3,4})/i],[Fe,[Ge,mw],[$e,Bn]],[/(lm(?:-?f100[nv]?|-[\w\.]+)(?= bui|\))|nexus [45])/i,/\blg[-e;\/ ]+((?!browser|netcast|android tv)\w+)/i,/\blg-?([\d\w]+) bui/i],[Fe,[Ge,mw],[$e,$t]],[/(ideatab[-\w ]+)/i,/lenovo ?(s[56]000[-\w]+|tab(?:[\w ]+)|yt[-\d\w]{6}|tb[-\d\w]{6})/i],[Fe,[Ge,P3],[$e,Bn]],[/(?:maemo|nokia).*(n900|lumia \d+)/i,/nokia[-_ ]?([-\w\.]*)/i],[[Fe,/_/g," "],[Ge,"Nokia"],[$e,$t]],[/(pixel c)\b/i],[Fe,[Ge,cl],[$e,Bn]],[/droid.+; (pixel[\daxl ]{0,6})(?: bui|\))/i],[Fe,[Ge,cl],[$e,$t]],[/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],[Fe,[Ge,Jg],[$e,$t]],[/sony tablet [ps]/i,/\b(?:sony)?sgp\w+(?: bui|\))/i],[[Fe,"Xperia Tablet"],[Ge,Jg],[$e,Bn]],[/ (kb2005|in20[12]5|be20[12][59])\b/i,/(?:one)?(?:plus)? (a\d0\d\d)(?: b|\))/i],[Fe,[Ge,"OnePlus"],[$e,$t]],[/(alexa)webm/i,/(kf[a-z]{2}wi|aeo(?!bc)\w\w)( bui|\))/i,/(kf[a-z]+)( bui|\)).+silk\//i],[Fe,[Ge,Qg],[$e,Bn]],[/((?:sd|kf)[0349hijorstuw]+)( bui|\)).+silk\//i],[[Fe,/(.+)/g,"Fire Phone $1"],[Ge,Qg],[$e,$t]],[/(playbook);[-\w\),; ]+(rim)/i],[Fe,Ge,[$e,Bn]],[/\b((?:bb[a-f]|st[hv])100-\d)/i,/\(bb10; (\w+)/i],[Fe,[Ge,N3],[$e,$t]],[/(?:\b|asus_)(transfo[prime ]{4,10} \w+|eeepc|slider \w+|nexus 7|padfone|p00[cj])/i],[Fe,[Ge,L3],[$e,Bn]],[/ (z[bes]6[027][012][km][ls]|zenfone \d\w?)\b/i],[Fe,[Ge,L3],[$e,$t]],[/(nexus 9)/i],[Fe,[Ge,"HTC"],[$e,Bn]],[/(htc)[-;_ ]{1,2}([\w ]+(?=\)| bui)|\w+)/i,/(zte)[- ]([\w ]+?)(?: bui|\/|\))/i,/(alcatel|geeksphone|nexian|panasonic(?!(?:;|\.))|sony(?!-bra))[-_ ]?([-\w]*)/i],[Ge,[Fe,/_/g," "],[$e,$t]],[/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],[Fe,[Ge,"TCL"],[$e,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],[Fe,[Ge,"TCL"],[$e,$t]],[/(itel) ((\w+))/i],[[Ge,da],Fe,[$e,dd,{tablet:["p10001l","w7001"],"*":"mobile"}]],[/droid.+; ([ab][1-7]-?[0178a]\d\d?)/i],[Fe,[Ge,"Acer"],[$e,Bn]],[/droid.+; (m[1-5] note) bui/i,/\bmz-([-\w]{2,})/i],[Fe,[Ge,"Meizu"],[$e,$t]],[/; ((?:power )?armor(?:[\w ]{0,8}))(?: bui|\))/i],[Fe,[Ge,"Ulefone"],[$e,$t]],[/; (energy ?\w+)(?: bui|\))/i,/; energizer ([\w ]+)(?: bui|\))/i],[Fe,[Ge,"Energizer"],[$e,$t]],[/; cat (b35);/i,/; (b15q?|s22 flip|s48c|s62 pro)(?: bui|\))/i],[Fe,[Ge,"Cat"],[$e,$t]],[/((?:new )?andromax[\w- ]+)(?: bui|\))/i],[Fe,[Ge,"Smartfren"],[$e,$t]],[/droid.+; (a(?:015|06[35]|142p?))/i],[Fe,[Ge,"Nothing"],[$e,$t]],[/(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],[Ge,Fe,[$e,$t]],[/(imo) (tab \w+)/i,/(kobo)\s(ereader|touch)/i,/(archos) (gamepad2?)/i,/(hp).+(touchpad(?!.+tablet)|tablet)/i,/(kindle)\/([\w\.]+)/i],[Ge,Fe,[$e,Bn]],[/(surface duo)/i],[Fe,[Ge,Xg],[$e,Bn]],[/droid [\d\.]+; (fp\du?)(?: b|\))/i],[Fe,[Ge,"Fairphone"],[$e,$t]],[/(shield[\w ]+) b/i],[Fe,[Ge,"Nvidia"],[$e,Bn]],[/(sprint) (\w+)/i],[Ge,Fe,[$e,$t]],[/(kin\.[onetw]{3})/i],[[Fe,/\./g," "],[Ge,Xg],[$e,$t]],[/droid.+; ([c6]+|et5[16]|mc[239][23]x?|vc8[03]x?)\)/i],[Fe,[Ge,yw],[$e,Bn]],[/droid.+; (ec30|ps20|tc[2-8]\d[kx])\)/i],[Fe,[Ge,yw],[$e,$t]],[/smart-tv.+(samsung)/i],[Ge,[$e,ii]],[/hbbtv.+maple;(\d+)/i],[[Fe,/^/,"SmartTV"],[Ge,ad],[$e,ii]],[/(nux; netcast.+smarttv|lg (netcast\.tv-201\d|android tv))/i],[[Ge,mw],[$e,ii]],[/(apple) ?tv/i],[Ge,[Fe,od+" TV"],[$e,ii]],[/crkey.*devicetype\/chromecast/i],[[Fe,fs+" Third Generation"],[Ge,cl],[$e,ii]],[/crkey.*devicetype\/([^/]*)/i],[[Fe,/^/,"Chromecast "],[Ge,cl],[$e,ii]],[/fuchsia.*crkey/i],[[Fe,fs+" Nest Hub"],[Ge,cl],[$e,ii]],[/crkey/i],[[Fe,fs],[Ge,cl],[$e,ii]],[/droid.+aft(\w+)( bui|\))/i],[Fe,[Ge,Qg],[$e,ii]],[/\(dtv[\);].+(aquos)/i,/(aquos-tv[\w ]+)\)/i],[Fe,[Ge,z3],[$e,ii]],[/(bravia[\w ]+)( bui|\))/i],[Fe,[Ge,Jg],[$e,ii]],[/(mitv-\w{5}) bui/i],[Fe,[Ge,vw],[$e,ii]],[/Hbbtv.*(technisat) (.*);/i],[Ge,Fe,[$e,ii]],[/\b(roku)[\dx]*[\)\/]((?:dvp-)?[\d\.]*)/i,/hbbtv\/\d+\.\d+\.\d+ +\([\w\+ ]*; *([\w\d][^;]*);([^;]*)/i],[[Ge,fd],[Fe,fd],[$e,ii]],[/\b(android tv|smart[- ]?tv|opera tv|tv; rv:)\b/i],[[$e,ii]],[/(ouya)/i,/(nintendo) (\w+)/i],[Ge,Fe,[$e,$u]],[/droid.+; (shield) bui/i],[Fe,[Ge,"Nvidia"],[$e,$u]],[/(playstation \w+)/i],[Fe,[Ge,Jg],[$e,$u]],[/\b(xbox(?: one)?(?!; xbox))[\); ]/i],[Fe,[Ge,Xg],[$e,$u]],[/\b(sm-[lr]\d\d[05][fnuw]?s?)\b/i],[Fe,[Ge,ad],[$e,rd]],[/((pebble))app/i],[Ge,Fe,[$e,rd]],[/(watch)(?: ?os[,\/]|\d,\d\/)[\d\.]+/i],[Fe,[Ge,od],[$e,rd]],[/droid.+; (wt63?0{2,3})\)/i],[Fe,[Ge,yw],[$e,rd]],[/droid.+; (glass) \d/i],[Fe,[Ge,cl],[$e,cw]],[/(pico) (4|neo3(?: link|pro)?)/i],[Ge,Fe,[$e,cw]],[/; (quest( \d| pro)?)/i],[Fe,[Ge,j3],[$e,cw]],[/(tesla)(?: qtcarbrowser|\/[-\w\.]+)/i],[Ge,[$e,fw]],[/(aeobc)\b/i],[Fe,[Ge,Qg],[$e,fw]],[/droid .+?; ([^;]+?)(?: bui|; wv\)|\) applew).+? mobile safari/i],[Fe,[$e,$t]],[/droid .+?; ([^;]+?)(?: bui|\) applew).+?(?! mobile) safari/i],[Fe,[$e,Bn]],[/\b((tablet|tab)[;\/]|focus\/\d(?!.+mobile))/i],[[$e,Bn]],[/(phone|mobile(?:[;\/]| [ \w\/\.]*safari)|pda(?=.+windows ce))/i],[[$e,$t]],[/(android[-\w\. ]{0,9});.+buil/i],[Fe,[Ge,"Generic"]]],engine:[[/windows.+ edge\/([\w\.]+)/i],[Pe,[Le,TK+"HTML"]],[/(arkweb)\/([\w\.]+)/i],[Le,Pe],[/webkit\/537\.36.+chrome\/(?!27)([\w\.]+)/i],[Pe,[Le,"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],[Le,Pe],[/rv\:([\w\.]{1,9})\b.+(gecko)/i],[Pe,Le]],os:[[/microsoft (windows) (vista|xp)/i],[Le,Pe],[/(windows (?:phone(?: os)?|mobile))[\/ ]?([\d\.\w ]*)/i],[Le,[Pe,dd,G3]],[/windows nt 6\.2; (arm)/i,/windows[\/ ]?([ntce\d\. ]+\w)(?!.+xbox)/i,/(?:win(?=3|9|n)|win 9x )([nt\d\.]+)/i],[[Pe,dd,G3],[Le,_w]],[/ip[honead]{2,4}\b(?:.*os ([\w]+) like mac|; opera)/i,/(?:ios;fbsv\/|iphone.+ios[\/ ])([\d\.]+)/i,/cfnetwork\/.+darwin/i],[[Pe,/_/g,"."],[Le,"iOS"]],[/(mac os x) ?([\w\. ]*)/i,/(macintosh|mac_powerpc\b)(?!.+haiku)/i],[[Le,"macOS"],[Pe,/_/g,"."]],[/android ([\d\.]+).*crkey/i],[Pe,[Le,fs+" Android"]],[/fuchsia.*crkey\/([\d\.]+)/i],[Pe,[Le,fs+" Fuchsia"]],[/crkey\/([\d\.]+).*devicetype\/smartspeaker/i],[Pe,[Le,fs+" SmartSpeaker"]],[/linux.*crkey\/([\d\.]+)/i],[Pe,[Le,fs+" Linux"]],[/crkey\/([\d\.]+)/i],[Pe,[Le,fs]],[/droid ([\w\.]+)\b.+(android[- ]x86|harmonyos)/i],[Pe,Le],[/(android|webos|qnx|bada|rim tablet os|maemo|meego|sailfish|openharmony)[-\/ ]?([\w\.]*)/i,/(blackberry)\w*\/([\w\.]*)/i,/(tizen|kaios)[\/ ]([\w\.]+)/i,/\((series40);/i],[Le,Pe],[/\(bb(10);/i],[Pe,[Le,N3]],[/(?:symbian ?os|symbos|s60(?=;)|series60)[-\/ ]?([\w\.]*)/i],[Pe,[Le,"Symbian"]],[/mozilla\/[\d\.]+ \((?:mobile|tablet|tv|mobile; [\w ]+); rv:.+ gecko\/([\w\.]+)/i],[Pe,[Le,ld+" OS"]],[/web0s;.+rt(tv)/i,/\b(?:hp)?wos(?:browser)?\/([\w\.]+)/i],[Pe,[Le,"webOS"]],[/watch(?: ?os[,\/]|\d,\d\/)([\d\.]+)/i],[Pe,[Le,"watchOS"]],[/(cros) [\w]+(?:\)| ([\w\.]+)\b)/i],[[Le,"Chrome OS"],Pe],[/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],[Le,Pe],[/(sunos) ?([\w\.\d]*)/i],[[Le,"Solaris"],Pe],[/((?:open)?solaris)[-\/ ]?([\w\.]*)/i,/(aix) ((\d)(?=\.|\)| )[\w\.])*/i,/\b(beos|os\/2|amigaos|morphos|openvms|fuchsia|hp-ux|serenityos)/i,/(unix) ?([\w\.]*)/i],[Le,Pe]]},nm=function(){var e={init:{},isIgnore:{},isIgnoreRgx:{},toString:{}};return ha.call(e.init,[[Li,[Le,Pe,nd,$e]],[ca,[ki]],[Bo,[$e,Fe,Ge]],[fa,[Le,Pe]],[eo,[Le,Pe]]]),ha.call(e.isIgnore,[[Li,[Pe,nd]],[fa,[Pe]],[eo,[Pe]]]),ha.call(e.isIgnoreRgx,[[Li,/ ?browser$/i],[eo,/ ?os$/i]]),ha.call(e.toString,[[Li,[Le,Pe]],[ca,[ki]],[Bo,[Ge,Fe]],[fa,[Le,Pe]],[eo,[Le,Pe]]]),e}(),RK=function(e,t){var n=nm.init[t],r=nm.isIgnore[t]||0,i=nm.isIgnoreRgx[t]||0,o=nm.toString[t]||0;function a(){ha.call(this,n)}return a.prototype.getItem=function(){return e},a.prototype.withClientHints=function(){return ds?ds.getHighEntropyValues(D3).then(function(u){return e.setCH(new Y3(u,!1)).parseCH().get()}):e.parseCH().get()},a.prototype.withFeatureCheck=function(){return e.detectFeature().get()},t!=Lu&&(a.prototype.is=function(u){var c=!1;for(var d in this)if(this.hasOwnProperty(d)&&!bw(r,d)&&da(i?fl(i,this[d]):this[d])==da(i?fl(i,u):u)){if(c=!0,u!=us)break}else if(u==us&&c){c=!c;break}return c},a.prototype.toString=function(){var u=Ou;for(var c in o)typeof this[o[c]]!==us&&(u+=(u?" ":Ou)+this[o[c]]);return u||us}),ds||(a.prototype.then=function(u){var c=this,d=function(){for(var h in c)c.hasOwnProperty(h)&&(this[h]=c[h])};d.prototype={is:a.prototype.is,toString:a.prototype.toString};var p=new d;return u(p),p}),new a};function Y3(e,t){if(e=e||{},ha.call(this,D3),t)ha.call(this,[[hw,xw(e[cs])],[pw,xw(e[xK])],[$t,/\?1/.test(e[kK])],[Fe,cd(e[EK])],[Du,cd(e[$3])],[gw,cd(e[AK])],[ki,cd(e[wK])],[ul,xw(e[CK])],[Kg,cd(e[SK])]]);else for(var n in e)this.hasOwnProperty(n)&&typeof e[n]!==us&&(this[n]=e[n])}function W3(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(Ei&&Ei.userAgent==this.ua)switch(this.itemType){case Li:Ei.brave&&typeof Ei.brave.isBrave==Wg&&this.set(Le,"Brave");break;case Bo:!this.get($e)&&ds&&ds[$t]&&this.set($e,$t),this.get(Fe)=="Macintosh"&&Ei&&typeof Ei.standalone!==us&&Ei.maxTouchPoints&&Ei.maxTouchPoints>2&&this.set(Fe,"iPad").set($e,Bn);break;case eo:!this.get(Le)&&ds&&ds[Du]&&this.set(Le,ds[Du]);break;case Lu:var i=this.data,o=function(a){return i[a].getItem().detectFeature().get()};this.set(Li,o(Li)).set(ca,o(ca)).set(Bo,o(Bo)).set(fa,o(fa)).set(eo,o(eo))}return this},this.parseUA=function(){return this.itemType!=Lu&&H3.call(this.data,this.ua,this.rgxMap),this.itemType==Li&&this.set(nd,ww(this.get(Pe))),this},this.parseCH=function(){var i=this.uaCH,o=this.rgxMap;switch(this.itemType){case Li:var a=i[pw]||i[hw],u;if(a)for(var c in a){var d=fl(/(Google|Microsoft) /,a[c].brand||a[c]),p=a[c].version;!/not.a.brand/i.test(d)&&(!u||/chrom/i.test(u)&&!/chromi/i.test(d))&&(this.set(Le,d).set(Pe,p).set(nd,ww(p)),u=d)}break;case ca:var h=i[ki];h&&(h&&i[Kg]=="64"&&(h+="64"),H3.call(this.data,h+";",o));break;case Bo:if(i[$t]&&this.set($e,$t),i[Fe]&&this.set(Fe,i[Fe]),i[Fe]=="Xbox"&&this.set($e,$u).set(Ge,Xg),i[ul]){var m;if(typeof i[ul]!="string")for(var v=0;!m&&v<i[ul].length;)m=dd(i[ul][v++],V3);else m=dd(i[ul],V3);this.set($e,m)}break;case eo:var _=i[Du];if(_){var S=i[gw];_==_w&&(S=parseInt(ww(S),10)>=13?"11":"10"),this.set(Le,_).set(Pe,S)}this.get(Le)==_w&&i[Fe]=="Xbox"&&this.set(Le,"Xbox").set(Pe,void 0);break;case Lu:var x=this.data,b=function(k){return x[k].getItem().setCH(i).parseCH().get()};this.set(Li,b(Li)).set(ca,b(ca)).set(Bo,b(Bo)).set(fa,b(fa)).set(eo,b(eo))}return this},ha.call(this,[["itemType",e],["ua",t],["uaCH",r],["rgxMap",n],["data",RK(this,e)]]),this}function pa(e,t,n){if(typeof e===Ru?(tm(e,!0)?(typeof t===Ru&&(n=t),t=e):(n=e,t=void 0),e=void 0):typeof e===uw&&!tm(t,!0)&&(n=t,t=void 0),n&&typeof n.append===Wg){var r={};n.forEach(function(c,d){r[d]=c}),n=r}if(!(this instanceof pa))return new pa(e,t,n).getResult();var i=typeof e===uw?e:n&&n[R3]?n[R3]:Ei&&Ei.userAgent?Ei.userAgent:Ou,o=new Y3(n,!0),a=t?OK(Z3,t):Z3,u=function(c){return c==Lu?function(){return new W3(c,i,a,o).set("ua",i).set(Li,this.getBrowser()).set(ca,this.getCPU()).set(Bo,this.getDevice()).set(fa,this.getEngine()).set(eo,this.getOS()).get()}:function(){return new W3(c,i,a[c],o).parseUA().get()}};return ha.call(this,[["getBrowser",u(Li)],["getCPU",u(ca)],["getDevice",u(Bo)],["getEngine",u(fa)],["getOS",u(eo)],["getResult",u(Lu)],["getUA",function(){return i}],["setUA",function(c){return Bu(c)&&(i=c.length>dw?fd(c,dw):c),this}]]).setUA(i),this}pa.VERSION=bK,pa.BROWSER=em([Le,Pe,nd,$e]),pa.CPU=em([ki]),pa.DEVICE=em([Fe,Ge,$e,$u,$t,ii,Bn,rd,fw]),pa.ENGINE=pa.OS=em([Le,Pe]);const no=class no{constructor(t){Cr(this,"config");Cr(this,"storedData");Cr(this,"deviceInfo");Cr(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){no.instance||(no.instance=new no(t))}static getInstance(){if(!no.instance)throw new Error("DebalesAnalytics is not initialized. Call init() first.");return no.instance}static async identify(t,n){return no.getInstance().identifyInternal(t,n)}static track(t,n){no.getInstance().trackInternal(t,n)}static getDistinctId(){return no.getInstance().storedData.distinctId}static getAnonId(){return no.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 a={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",a);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:",a)}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:an()+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(`${Zn}${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 pa().getResult();return{browser:n.browser.name,os:n.os.name,browserVersion:n.browser.version,osVersion:n.os.version}}};Cr(no,"instance",null);let Sw=no;const Po=Sw;function $K(e){yT(e,[/\r?\n|\r/g,DK])}function DK(){return{type:"break"}}function rm(){return function(e){$K(e)}}const mt={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",SHOPIFY_LINK_CLICKED:"shopify_link_clicked"},hn={OPEN_STATE_CHANGE:"open_state_change"},im=e=>{window.DebalesChat||(window.DebalesChat={isOpen:!1,projectId:e,getSessionId:()=>an(),getChatId:()=>an()+"_"+e,getAnonId:()=>Po.getAnonId(),isIdentified:()=>{if(Yi._isIdentified())return!0;const t=Nr();return!!(t&&t.email)},getIdentifiedUser:()=>Nr(),getDistinctId:()=>Yi.get_distinct_id(),getOldDistinctId:()=>Po.getDistinctId(),debug:!1,identify:(t,n)=>{Yi._isIdentified()||Yi.identify(t,{...n,project:e}),Po.identify(t,n),ua({email:t,name:n==null?void 0:n.name,phone:n==null?void 0:n.phone})},track:(t,n)=>{Po.track(t,{...n,sessionId:window.DebalesChat.getSessionId()}),Yi.capture(t,{...n}),vK(t,{...n,sessionId:an(),projectId:e})},onOpenChange:t=>{const n=r=>{t(r.detail.isOpen)};return window.addEventListener(hn.OPEN_STATE_CHANGE,n),()=>window.removeEventListener(hn.OPEN_STATE_CHANGE,n)},removeOpenChangeListener:t=>{const n=r=>{t(r.detail.isOpen)};window.removeEventListener(hn.OPEN_STATE_CHANGE,n)},open:()=>{window.DebalesChat.isOpen||window.dispatchEvent(new CustomEvent(hn.OPEN_STATE_CHANGE,{detail:{isOpen:!0,projectId:e}}))},close:()=>{window.DebalesChat.isOpen&&window.dispatchEvent(new CustomEvent(hn.OPEN_STATE_CHANGE,{detail:{isOpen:!1,projectId:e}}))},toggle:()=>{window.dispatchEvent(new CustomEvent(hn.OPEN_STATE_CHANGE,{detail:{isOpen:!window.DebalesChat.isOpen,projectId:e}}))}})};var Pr=(e=>(e.DEFAULT="DEFAULT",e.SHOPIFY="SHOPIFY",e.WOOCOMMERCE="WOOCOMMERCE",e.MAGENTO="MAGENTO",e.UNKNOWN="UNKNOWN",e))(Pr||{});class hs{static detect(){var t,n,r,i,o,a;if(typeof window<"u"&&window.Shopify!==void 0&&window.Shopify.routes!==void 0)return Pr.SHOPIFY;if(typeof window<"u"&&document.body.classList.contains("woocommerce"))return Pr.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 Pr.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 Pr.MAGENTO;if(document.cookie.split(";").some(h=>h.trim().startsWith("mage-")||h.trim().startsWith("form_key")))return Pr.MAGENTO;const p=document.getElementsByTagName("meta");for(const h of Array.from(p))if((o=h.getAttribute("content"))!=null&&o.includes("Magento")||(a=h.getAttribute("name"))!=null&&a.includes("magento"))return Pr.MAGENTO}return Pr.UNKNOWN}}const om=z.button`
|
|
140
140
|
width: max-content;
|
|
141
141
|
cursor: pointer;
|
|
142
142
|
border-radius: 50px !important;
|
|
@@ -2328,7 +2328,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
2328
2328
|
margin-top: 16px;
|
|
2329
2329
|
display: flex;
|
|
2330
2330
|
justify-content: flex-end;
|
|
2331
|
-
`,W4=({botId:e})=>{var xr,ae;const{uiData:t,storeMetaData:n,onSendMessage:r,isKlaviyoMessage:i,isLoading:o,lastedBotmessageId:a,setLastedBotmessageId:u,messages:c,isMessageLoading:d,setIsMessageLoading:p,setMessages:h,saveConversation:m,changeDisplayModel:v,loadConversation:_,suggestedQuestions:S,setSuggestedQuestions:x,showUserInfoModel:b,setShowUserInfoModel:k,isUserInfoNeeded:E,setPendingQuestion:A}=Pu(),{cart:I,addToCart:$,generateCartUrl:B,addCartAttributes:U}=td(),G=Ys("use-chatbot-icon-size"),P=hs.detect(),K=t==null?void 0:t.isLeft,re=lm(),ue=t==null?void 0:t.heightOption,[Z,ie]=R.useState(!1);R.useEffect(()=>{const j=()=>{ie(window.matchMedia("(max-width: 768px)").matches)};return j(),window.addEventListener("resize",j),()=>window.removeEventListener("resize",j)},[]);const[V,Q]=R.useState(!1),[ve,Te]=R.useState(!1),[T,X]=R.useState(""),[me,L]=R.useState(""),[,we]=R.useState(0);R.useEffect(()=>{e&&im(e)},[e]),R.useEffect(()=>{Yg(e)},[e]),R.useEffect(()=>{let j=Nr();if(!j&&window.Thinkific){const xe=window.Thinkific.current_user;xe&&(j={name:xe.full_name,email:xe.email},ua(j))}Po.init({projectName:e,debug:!0,testing:ed}),j&&j.email&&(window.DebalesChat.identify(j.email,{name:j.name,phone:j.phone,email:j.email}),t!=null&&t.KlaviyoIntegration&&window.klaviyo&&window.klaviyo.identify({email:j.email,first_name:j.name,phone:j.phone,from:"Debales-Chatbot"}))},[e,t==null?void 0:t.KlaviyoIntegration]);const Ue=R.useRef(null),de=qt(jt.CLICKED_QUESTIONS,{botId:e}),[tt,Ze]=R.useState(()=>{try{const j=sessionStorage.getItem(de);return j?new Set(JSON.parse(j)):new Set}catch{return new Set}});R.useEffect(()=>{try{sessionStorage.setItem(de,JSON.stringify(Array.from(tt)))}catch(j){console.error("Failed to save to sessionStorage:",j)}},[tt]);const lt=R.useCallback((j,xe)=>{j?(window.dispatchEvent(new CustomEvent(hn.OPEN_STATE_CHANGE,{detail:{isOpen:j,source:xe,projectId:e}})),setTimeout(()=>{Te(!0)},50)):(Te(!1),window.dispatchEvent(new CustomEvent(hn.OPEN_STATE_CHANGE,{detail:{isOpen:j,source:xe,projectId:e}})))},[]);R.useEffect(()=>{const j=xe=>{Q(xe.detail.isOpen),xe.detail.isOpen&&setTimeout(()=>Te(!0),50),window.DebalesChat.isOpen=xe.detail.isOpen,window.DebalesChat.track(mt.OPEN_STATE_CHANGE,{isOpen:xe.detail.isOpen,source:xe.detail.source})};return window.addEventListener(hn.OPEN_STATE_CHANGE,j),()=>{window.removeEventListener(hn.OPEN_STATE_CHANGE,j)}},[]),R.useEffect(()=>{const j=xe=>{Q(xe.detail.isOpen),window.DebalesChat.isOpen=xe.detail.isOpen,window.DebalesChat.track(mt.OPEN_STATE_CHANGE,{isOpen:xe.detail.isOpen})};return window.addEventListener(hn.OPEN_STATE_CHANGE,j),()=>{window.removeEventListener(hn.OPEN_STATE_CHANGE,j)}},[]);const[gt,je]=R.useState(!1),[Se,Ye]=R.useState(()=>{const j=qt(jt.PENDING_BULK_ITEMS,{botId:e}),xe=sessionStorage.getItem(j);return xe?JSON.parse(xe):[]});R.useEffect(()=>{const j=qt(jt.PENDING_BULK_ITEMS,{botId:e});sessionStorage.setItem(j,JSON.stringify(Se))},[Se,e]);const[Qe,ot]=R.useState(!1),[et,He]=R.useState({name:"",email:"",message:""}),N=ja("exit_model"),[F,Y]=R.useState({text:!0,leadingQueries:!0,collections:!0,products:!0,variants:!0,cartSummary:!0,bulkItems:!0}),[ye,_e]=R.useState({suggestions:!1,products:!1,collections:!1,leadingQueries:!1,initialMessage:!1,cartSummary:!1,bulkItems:!1}),[Ie,We]=R.useState(!1),[nt,ne]=R.useState(!0),[he,qe]=R.useState(!1),[Xe,at]=R.useState(!1),Et=2e3,Bt=R.useCallback(j=>{const xe=j.target,Ne=xe.scrollHeight-xe.scrollTop<=xe.clientHeight+0;ne(Ne)},[]);R.useEffect(()=>{var j,xe,Ne,pe,Ce,ut;if(c.length>0&&!d){const bt=c[c.length-1],ee=sessionStorage.getItem(qt(jt.LAST_SHOWN_MESSAGE_ID,{botId:e})),q=bt.isBot&&bt.conversationId===a&&bt.conversationId!==ee,ge=(I==null?void 0:I.itemCount)&&(I==null?void 0:I.itemCount)>0&&bt.conversationId===a;if(q){We(!0),_e(De=>({...De,initialMessage:!0})),sessionStorage.setItem(qt(jt.LAST_SHOWN_MESSAGE_ID,{botId:e}),bt.conversationId||""),Y({text:!0,leadingQueries:!1,collections:!1,products:!1,variants:!1,cartSummary:!1,bulkItems:!1});const J=1600;let Re=J;const Oe=[{type:"collections",condition:((j=bt.collections)==null?void 0:j.length)&&((xe=bt.collections)==null?void 0:xe.length)>0},{type:"products",condition:((Ne=bt.products)==null?void 0:Ne.length)&&((pe=bt.products)==null?void 0:pe.length)>0},{type:"leadingQueries",condition:c.length>=1&&((Ce=bt.leading_queries)==null?void 0:Ce.length)&&((ut=bt.leading_queries)==null?void 0:ut.length)>0},{type:"cartSummary",condition:(I==null?void 0:I.itemCount)&&(I==null?void 0:I.itemCount)>0},{type:"bulkItems",condition:(Se==null?void 0:Se.length)>0}].filter(De=>De.condition);if(Oe.length===0){We(!1),_e(De=>({...De,initialMessage:!1,leadingQueries:!1}));return}Oe.forEach(({type:De},ct)=>{setTimeout(()=>{if(_e(Pt=>({...Pt,[De]:!0})),Y(Pt=>({...Pt,[De]:!0})),nt&&Ue.current){const Pt=Ue.current;Pt.scrollHeight-Pt.scrollTop<=Pt.clientHeight&&ri(Ue)}ct===Oe.length-1&&We(!1)},Re),Re+=J})}else ge&&Y(J=>({...J,cartSummary:!0}))}},[c,d,a,I==null?void 0:I.itemCount,Se==null?void 0:Se.length,nt,e,F]),R.useEffect(()=>{if(!i&&c.length>0){const j=Ue.current;j&&nt&&j.scrollHeight-j.scrollTop<=j.clientHeight+100&&setTimeout(()=>ri(Ue),100)}},[c.length,i,nt]),R.useEffect(()=>{const j=document.querySelector('meta[name="viewport"]'),xe=j==null?void 0:j.content;if(V){let Ne=j;const pe=window.matchMedia("(max-width: 768px)").matches;Ne?Ne.content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no":(Ne=document.createElement("meta"),Ne.name="viewport",Ne.content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no",document.head.appendChild(Ne)),pe&&(t==null?void 0:t.mobileDisplayMode)==="full-screen"&&(document.body.style.overflow="hidden");const Ce=Ne;return()=>{xe&&Ce&&(Ce.content=xe),pe&&(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="")}},[V,t==null?void 0:t.mobileDisplayMode]),R.useEffect(()=>{const j=setTimeout(()=>{je(!0)},1e3);return()=>clearTimeout(j)},[]),R.useEffect(()=>{i||setTimeout(()=>ri(Ue),100)},[c.length,i]),R.useEffect(()=>{I!=null&&I.itemCount&&I.itemCount===0&&!i&&setTimeout(()=>ri(Ue),100)},[I==null?void 0:I.itemCount,i]),R.useEffect(()=>{a&&sessionStorage.setItem(qt(jt.LAST_SHOWN_MESSAGE_ID,{botId:e}),a)},[a,e]);const kt=R.useRef(Date.now()),Yt=R.useRef(0),ft=R.useRef(window.location.pathname),wt=R.useRef(S),Je=R.useRef(!1),yt=ja("acquisition_agent");R.useEffect(()=>{wt.current=S},[S]);const Yn=R.useCallback(async()=>{const j=Date.now();if(j-kt.current>=6e3&&j-Yt.current>=6e4&&!Je.current)try{Je.current=!0,console.log("fetching acquisition data");const pe=await fetch(`${Zn}/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(pe.ok){const Ce=await pe.json(),bt=[...wt.current.filter(ee=>ee.path!==ft.current),{question:Ce.Popup_Message,answer:"",path:ft.current,nameSpace:e,type:"dynamic",Follow_up_Question:Ce.Follow_up_Question}];x(bt)}Yt.current=j}catch(pe){console.error("Error fetching acquisition data:",pe)}finally{Je.current=!1}},[e]);R.useEffect(()=>{if(!yt||(t==null?void 0:t.show_bot)===!1)return;const j=()=>{kt.current=Date.now()};document.addEventListener("mousemove",j),document.addEventListener("mousedown",j),document.addEventListener("keypress",j),document.addEventListener("scroll",j),document.addEventListener("touchstart",j),document.addEventListener("touchmove",j);const xe=setInterval(Yn,1e3),Ne=()=>{const Ce=window.location.pathname.split("?")[0],ut=ft.current.split("?")[0];(()=>{const ee=ut.split("/").filter(Boolean),q=Ce.split("/").filter(Boolean);return ee.length!==q.length?!0:ee.length===0&&q.length===0?!1:Ce!==ut})()&&(ft.current=Ce,kt.current=Date.now())};return window.addEventListener("popstate",Ne),()=>{document.removeEventListener("mousemove",j),document.removeEventListener("mousedown",j),document.removeEventListener("keypress",j),document.removeEventListener("scroll",j),document.removeEventListener("touchstart",j),document.removeEventListener("touchmove",j),window.removeEventListener("popstate",Ne),clearInterval(xe)}},[yt,Yn,t==null?void 0:t.show_bot]);const[pr,Wn]=R.useState(!1),[Pn,Fr]=R.useState(!1),[pi,oi]=R.useState(null),Ar=async j=>{const xe=an();if(Te(!1),j&&c.length>1)try{(await fetch(`${Zn}/api/wordpress/userRating`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sessionId:xe,userRating:j,nameSpace:e})})).ok||console.error("Error submitting rating")}catch(Ne){console.error("Error submitting rating:",Ne)}setTimeout(()=>{Fr(!1),lt(!1,"close_button_clicked")},1e3)},zr=j=>{p(!0),Se.forEach(Ne=>{$(Ne.id,Ne.quantity)}),window.DebalesChat.track(mt.ADD_BULK_ITEM,{products:Se,message:j});const xe=[...c,{text:"🎉 Bulk items added to cart successfully.",leading_queries:["Get GST Invoice for the order","Explore more products"],conversationId:j,isBot:!0}];h(xe),m(xe),u(j),Ye([]),p(!1)},ro=()=>{var j;switch(e){case"minature":case"bodytales":case"imemyselfcare-com":if(window.triggerGokwikCustomCheckout)return window.triggerGokwikCustomCheckout(),!0;break;case"athflex":if((j=window.shiprocketCheckoutEvents)!=null&&j.buyCart)return window.shiprocketCheckoutEvents.buyCart(),!0;break;case"www":if(window.openRzpCheckout)return window.openRzpCheckout(),!0;break;default:return window.location.href=B((t==null?void 0:t.shopifyShopDomain)??""),!1}return window.location.href=B((t==null?void 0:t.shopifyShopDomain)??""),!1},ai=async j=>{j.preventDefault(),window.DebalesChat.track(mt.CHECKOUT_CLICKED,{chatId:an()+e,cartValue:Number(I==null?void 0:I.total),cart:I}),U({dbls_method:"checkout_clicked"}),ro()&<(!1,"checkout_clicked")},[gr,Cn]=R.useState([]);R.useEffect(()=>{const j=_K(Zg(S));Cn(j)},[S]);const Jt=R.useMemo(()=>gr.map(j=>{if(Array.isArray(j)){const xe=j.filter(pe=>!tt.has(pe.question));if(xe.length===0)return null;const Ne={isHighlighted:j[0].isHighlighted,enable:j[0].enable,type:j[0].type};return xe.map(pe=>({...pe,...Ne}))}else return tt.has(j.question)?null:j}).filter(Boolean),[gr,tt]);R.useEffect(()=>{const j=pe=>{const Ce=pe.detail.formId;switch(pe.detail.type){case"open":case"embedOpen":setTimeout(()=>{const bt=xe(Ce);bt&&X(bt)},800);break;case"close":T&&(t==null?void 0:t.KlaviyoFormIntegration)===!0&&setTimeout(()=>{lt(!0,"klaviyo_form_closed"),L(Ce),r(T,void 0,void 0,!0,void 0,void 0)},1e4);break}},xe=pe=>{const Ce=document.querySelector(`[data-testid="klaviyo-form-${pe}"]`);if(console.log(`formElement text ${pe} =>`,Ce==null?void 0:Ce.innerText,Ce==null?void 0:Ce.textContent),Ce instanceof HTMLElement){const ut=Ce.innerText||Ce.textContent;if(ut)return console.log("Found form text:",ut),`=> Klaviyo form content:
|
|
2331
|
+
`,W4=({botId:e})=>{var xr,ae;const{uiData:t,storeMetaData:n,onSendMessage:r,isKlaviyoMessage:i,isLoading:o,lastedBotmessageId:a,setLastedBotmessageId:u,messages:c,isMessageLoading:d,setIsMessageLoading:p,setMessages:h,saveConversation:m,changeDisplayModel:v,loadConversation:_,suggestedQuestions:S,setSuggestedQuestions:x,showUserInfoModel:b,setShowUserInfoModel:k,isUserInfoNeeded:E,setPendingQuestion:A}=Pu(),{cart:I,addToCart:$,generateCartUrl:B,addCartAttributes:U}=td(),G=Ys("use-chatbot-icon-size"),P=hs.detect(),K=t==null?void 0:t.isLeft,re=lm(),ue=t==null?void 0:t.heightOption,[Z,ie]=R.useState(!1);R.useEffect(()=>{const j=()=>{ie(window.matchMedia("(max-width: 768px)").matches)};return j(),window.addEventListener("resize",j),()=>window.removeEventListener("resize",j)},[]);const[V,Q]=R.useState(!1),[ve,Te]=R.useState(!1),[T,X]=R.useState(""),[me,L]=R.useState(""),[,we]=R.useState(0);R.useEffect(()=>{e&&im(e)},[e]),R.useEffect(()=>{Yg(e)},[e]),R.useEffect(()=>{let j=Nr();if(!j&&window.Thinkific){const xe=window.Thinkific.current_user;xe&&(j={name:xe.full_name,email:xe.email},ua(j))}Po.init({projectName:e,debug:!1,testing:ed}),j&&j.email&&(window.DebalesChat.identify(j.email,{name:j.name,phone:j.phone,email:j.email}),t!=null&&t.KlaviyoIntegration&&window.klaviyo&&window.klaviyo.identify({email:j.email,first_name:j.name,phone:j.phone,from:"Debales-Chatbot"}))},[e,t==null?void 0:t.KlaviyoIntegration]);const Ue=R.useRef(null),de=qt(jt.CLICKED_QUESTIONS,{botId:e}),[tt,Ze]=R.useState(()=>{try{const j=sessionStorage.getItem(de);return j?new Set(JSON.parse(j)):new Set}catch{return new Set}});R.useEffect(()=>{try{sessionStorage.setItem(de,JSON.stringify(Array.from(tt)))}catch(j){console.error("Failed to save to sessionStorage:",j)}},[tt]);const lt=R.useCallback((j,xe)=>{j?(window.dispatchEvent(new CustomEvent(hn.OPEN_STATE_CHANGE,{detail:{isOpen:j,source:xe,projectId:e}})),setTimeout(()=>{Te(!0)},50)):(Te(!1),window.dispatchEvent(new CustomEvent(hn.OPEN_STATE_CHANGE,{detail:{isOpen:j,source:xe,projectId:e}})))},[]);R.useEffect(()=>{const j=xe=>{Q(xe.detail.isOpen),xe.detail.isOpen&&setTimeout(()=>Te(!0),50),window.DebalesChat.isOpen=xe.detail.isOpen,window.DebalesChat.track(mt.OPEN_STATE_CHANGE,{isOpen:xe.detail.isOpen,source:xe.detail.source})};return window.addEventListener(hn.OPEN_STATE_CHANGE,j),()=>{window.removeEventListener(hn.OPEN_STATE_CHANGE,j)}},[]),R.useEffect(()=>{const j=xe=>{Q(xe.detail.isOpen),window.DebalesChat.isOpen=xe.detail.isOpen,window.DebalesChat.track(mt.OPEN_STATE_CHANGE,{isOpen:xe.detail.isOpen})};return window.addEventListener(hn.OPEN_STATE_CHANGE,j),()=>{window.removeEventListener(hn.OPEN_STATE_CHANGE,j)}},[]);const[gt,je]=R.useState(!1),[Se,Ye]=R.useState(()=>{const j=qt(jt.PENDING_BULK_ITEMS,{botId:e}),xe=sessionStorage.getItem(j);return xe?JSON.parse(xe):[]});R.useEffect(()=>{const j=qt(jt.PENDING_BULK_ITEMS,{botId:e});sessionStorage.setItem(j,JSON.stringify(Se))},[Se,e]);const[Qe,ot]=R.useState(!1),[et,He]=R.useState({name:"",email:"",message:""}),N=ja("exit_model"),[F,Y]=R.useState({text:!0,leadingQueries:!0,collections:!0,products:!0,variants:!0,cartSummary:!0,bulkItems:!0}),[ye,_e]=R.useState({suggestions:!1,products:!1,collections:!1,leadingQueries:!1,initialMessage:!1,cartSummary:!1,bulkItems:!1}),[Ie,We]=R.useState(!1),[nt,ne]=R.useState(!0),[he,qe]=R.useState(!1),[Xe,at]=R.useState(!1),Et=2e3,Bt=R.useCallback(j=>{const xe=j.target,Ne=xe.scrollHeight-xe.scrollTop<=xe.clientHeight+0;ne(Ne)},[]);R.useEffect(()=>{var j,xe,Ne,pe,Ce,ut;if(c.length>0&&!d){const bt=c[c.length-1],ee=sessionStorage.getItem(qt(jt.LAST_SHOWN_MESSAGE_ID,{botId:e})),q=bt.isBot&&bt.conversationId===a&&bt.conversationId!==ee,ge=(I==null?void 0:I.itemCount)&&(I==null?void 0:I.itemCount)>0&&bt.conversationId===a;if(q){We(!0),_e(De=>({...De,initialMessage:!0})),sessionStorage.setItem(qt(jt.LAST_SHOWN_MESSAGE_ID,{botId:e}),bt.conversationId||""),Y({text:!0,leadingQueries:!1,collections:!1,products:!1,variants:!1,cartSummary:!1,bulkItems:!1});const J=1600;let Re=J;const Oe=[{type:"collections",condition:((j=bt.collections)==null?void 0:j.length)&&((xe=bt.collections)==null?void 0:xe.length)>0},{type:"products",condition:((Ne=bt.products)==null?void 0:Ne.length)&&((pe=bt.products)==null?void 0:pe.length)>0},{type:"leadingQueries",condition:c.length>=1&&((Ce=bt.leading_queries)==null?void 0:Ce.length)&&((ut=bt.leading_queries)==null?void 0:ut.length)>0},{type:"cartSummary",condition:(I==null?void 0:I.itemCount)&&(I==null?void 0:I.itemCount)>0},{type:"bulkItems",condition:(Se==null?void 0:Se.length)>0}].filter(De=>De.condition);if(Oe.length===0){We(!1),_e(De=>({...De,initialMessage:!1,leadingQueries:!1}));return}Oe.forEach(({type:De},ct)=>{setTimeout(()=>{if(_e(Pt=>({...Pt,[De]:!0})),Y(Pt=>({...Pt,[De]:!0})),nt&&Ue.current){const Pt=Ue.current;Pt.scrollHeight-Pt.scrollTop<=Pt.clientHeight&&ri(Ue)}ct===Oe.length-1&&We(!1)},Re),Re+=J})}else ge&&Y(J=>({...J,cartSummary:!0}))}},[c,d,a,I==null?void 0:I.itemCount,Se==null?void 0:Se.length,nt,e,F]),R.useEffect(()=>{if(!i&&c.length>0){const j=Ue.current;j&&nt&&j.scrollHeight-j.scrollTop<=j.clientHeight+100&&setTimeout(()=>ri(Ue),100)}},[c.length,i,nt]),R.useEffect(()=>{const j=document.querySelector('meta[name="viewport"]'),xe=j==null?void 0:j.content;if(V){let Ne=j;const pe=window.matchMedia("(max-width: 768px)").matches;Ne?Ne.content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no":(Ne=document.createElement("meta"),Ne.name="viewport",Ne.content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no",document.head.appendChild(Ne)),pe&&(t==null?void 0:t.mobileDisplayMode)==="full-screen"&&(document.body.style.overflow="hidden");const Ce=Ne;return()=>{xe&&Ce&&(Ce.content=xe),pe&&(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="")}},[V,t==null?void 0:t.mobileDisplayMode]),R.useEffect(()=>{const j=setTimeout(()=>{je(!0)},1e3);return()=>clearTimeout(j)},[]),R.useEffect(()=>{i||setTimeout(()=>ri(Ue),100)},[c.length,i]),R.useEffect(()=>{I!=null&&I.itemCount&&I.itemCount===0&&!i&&setTimeout(()=>ri(Ue),100)},[I==null?void 0:I.itemCount,i]),R.useEffect(()=>{a&&sessionStorage.setItem(qt(jt.LAST_SHOWN_MESSAGE_ID,{botId:e}),a)},[a,e]);const kt=R.useRef(Date.now()),Yt=R.useRef(0),ft=R.useRef(window.location.pathname),wt=R.useRef(S),Je=R.useRef(!1),yt=ja("acquisition_agent");R.useEffect(()=>{wt.current=S},[S]);const Yn=R.useCallback(async()=>{const j=Date.now();if(j-kt.current>=6e3&&j-Yt.current>=6e4&&!Je.current)try{Je.current=!0,console.log("fetching acquisition data");const pe=await fetch(`${Zn}/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(pe.ok){const Ce=await pe.json(),bt=[...wt.current.filter(ee=>ee.path!==ft.current),{question:Ce.Popup_Message,answer:"",path:ft.current,nameSpace:e,type:"dynamic",Follow_up_Question:Ce.Follow_up_Question}];x(bt)}Yt.current=j}catch(pe){console.error("Error fetching acquisition data:",pe)}finally{Je.current=!1}},[e]);R.useEffect(()=>{if(!yt||(t==null?void 0:t.show_bot)===!1)return;const j=()=>{kt.current=Date.now()};document.addEventListener("mousemove",j),document.addEventListener("mousedown",j),document.addEventListener("keypress",j),document.addEventListener("scroll",j),document.addEventListener("touchstart",j),document.addEventListener("touchmove",j);const xe=setInterval(Yn,1e3),Ne=()=>{const Ce=window.location.pathname.split("?")[0],ut=ft.current.split("?")[0];(()=>{const ee=ut.split("/").filter(Boolean),q=Ce.split("/").filter(Boolean);return ee.length!==q.length?!0:ee.length===0&&q.length===0?!1:Ce!==ut})()&&(ft.current=Ce,kt.current=Date.now())};return window.addEventListener("popstate",Ne),()=>{document.removeEventListener("mousemove",j),document.removeEventListener("mousedown",j),document.removeEventListener("keypress",j),document.removeEventListener("scroll",j),document.removeEventListener("touchstart",j),document.removeEventListener("touchmove",j),window.removeEventListener("popstate",Ne),clearInterval(xe)}},[yt,Yn,t==null?void 0:t.show_bot]);const[pr,Wn]=R.useState(!1),[Pn,Fr]=R.useState(!1),[pi,oi]=R.useState(null),Ar=async j=>{const xe=an();if(Te(!1),j&&c.length>1)try{(await fetch(`${Zn}/api/wordpress/userRating`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sessionId:xe,userRating:j,nameSpace:e})})).ok||console.error("Error submitting rating")}catch(Ne){console.error("Error submitting rating:",Ne)}setTimeout(()=>{Fr(!1),lt(!1,"close_button_clicked")},1e3)},zr=j=>{p(!0),Se.forEach(Ne=>{$(Ne.id,Ne.quantity)}),window.DebalesChat.track(mt.ADD_BULK_ITEM,{products:Se,message:j});const xe=[...c,{text:"🎉 Bulk items added to cart successfully.",leading_queries:["Get GST Invoice for the order","Explore more products"],conversationId:j,isBot:!0}];h(xe),m(xe),u(j),Ye([]),p(!1)},ro=()=>{var j;switch(e){case"minature":case"bodytales":case"imemyselfcare-com":if(window.triggerGokwikCustomCheckout)return window.triggerGokwikCustomCheckout(),!0;break;case"athflex":if((j=window.shiprocketCheckoutEvents)!=null&&j.buyCart)return window.shiprocketCheckoutEvents.buyCart(),!0;break;case"www":if(window.openRzpCheckout)return window.openRzpCheckout(),!0;break;default:return window.location.href=B((t==null?void 0:t.shopifyShopDomain)??""),!1}return window.location.href=B((t==null?void 0:t.shopifyShopDomain)??""),!1},ai=async j=>{j.preventDefault(),window.DebalesChat.track(mt.CHECKOUT_CLICKED,{chatId:an()+e,cartValue:Number(I==null?void 0:I.total),cart:I}),U({dbls_method:"checkout_clicked"}),ro()&<(!1,"checkout_clicked")},[gr,Cn]=R.useState([]);R.useEffect(()=>{const j=_K(Zg(S));Cn(j)},[S]);const Jt=R.useMemo(()=>gr.map(j=>{if(Array.isArray(j)){const xe=j.filter(pe=>!tt.has(pe.question));if(xe.length===0)return null;const Ne={isHighlighted:j[0].isHighlighted,enable:j[0].enable,type:j[0].type};return xe.map(pe=>({...pe,...Ne}))}else return tt.has(j.question)?null:j}).filter(Boolean),[gr,tt]);R.useEffect(()=>{const j=pe=>{const Ce=pe.detail.formId;switch(pe.detail.type){case"open":case"embedOpen":setTimeout(()=>{const bt=xe(Ce);bt&&X(bt)},800);break;case"close":T&&(t==null?void 0:t.KlaviyoFormIntegration)===!0&&setTimeout(()=>{lt(!0,"klaviyo_form_closed"),L(Ce),r(T,void 0,void 0,!0,void 0,void 0)},1e4);break}},xe=pe=>{const Ce=document.querySelector(`[data-testid="klaviyo-form-${pe}"]`);if(console.log(`formElement text ${pe} =>`,Ce==null?void 0:Ce.innerText,Ce==null?void 0:Ce.textContent),Ce instanceof HTMLElement){const ut=Ce.innerText||Ce.textContent;if(ut)return console.log("Found form text:",ut),`=> Klaviyo form content:
|
|
2332
2332
|
|
|
2333
2333
|
`+ut+`
|
|
2334
2334
|
|
|
@@ -3174,7 +3174,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
3174
3174
|
margin-top: 16px;
|
|
3175
3175
|
display: flex;
|
|
3176
3176
|
justify-content: flex-end;
|
|
3177
|
-
`,Xte=({botId:e})=>{var Qn,xr;const{uiData:t,storeMetaData:n,onSendMessage:r,isKlaviyoMessage:i,isLoading:o,lastedBotmessageId:a,setLastedBotmessageId:u,messages:c,isMessageLoading:d,setIsMessageLoading:p,setMessages:h,saveConversation:m,changeDisplayModel:v,loadConversation:_,suggestedQuestions:S,showUserInfoModel:x,setShowUserInfoModel:b,isUserInfoNeeded:k,setPendingQuestion:E}=Pu(),{cart:A,addToCart:I,generateCartUrl:$,addCartAttributes:B}=td(),U=Ys("use-chatbot-icon-size"),G=hs.detect(),P=t==null?void 0:t.isLeft,K=lm(),re=t==null?void 0:t.heightOption,Z=Ys("new-suggested-question-design"),[ie,V]=R.useState(!1),[Q,ve]=R.useState(!1),[Te,T]=R.useState(!1),[X,me]=R.useState([]),L=R.useCallback(async()=>{try{const ae=await fetch(`${Zn}/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(ae.ok){const j=await ae.json(),xe=window.location.pathname,Ne=3,pe=[...X],Ce={question:j.Popup_Message,answer:"",path:xe,nameSpace:e,type:"dynamic",Follow_up_Question:j.Follow_up_Question};pe.length>=Ne&&pe.shift(),pe.push(Ce),me(pe),console.log("updated quesitons",pe)}else console.error("Failed to fetch new acquisition question")}catch(ae){console.error("Error fetching new acquisition question:",ae)}},[e,X]);R.useEffect(()=>{if(!Z)return;let ae,j,xe,Ne;const pe=()=>{ae=setTimeout(()=>{V(!0),j=setTimeout(()=>{T(!0),ve(!0),xe=setTimeout(async()=>{T(!1),ve(!1),await L(),Ne=setTimeout(()=>{T(!0),V(!0),ve(!0),pe()},Z.hide_timing||4e3)},Z.show_for||44324)},Z.showing_delay||2e3)},Z.showing_delay||2e3)};return pe(),()=>{console.log("[Debug] Cleaning up timers"),clearTimeout(ae),clearTimeout(j),clearTimeout(xe),clearTimeout(Ne)}},[Z,L]);const[we,Ue]=R.useState(!1);R.useEffect(()=>{const ae=()=>{Ue(window.matchMedia("(max-width: 768px)").matches)};return ae(),window.addEventListener("resize",ae),()=>window.removeEventListener("resize",ae)},[]);const[de,tt]=R.useState(!1),[Ze,lt]=R.useState(!1),[gt,je]=R.useState(""),[Se,Ye]=R.useState(""),[,Qe]=R.useState(0);R.useEffect(()=>{e&&im(e)},[e]),R.useEffect(()=>{Yg(e)},[e]),R.useEffect(()=>{let ae=Nr();if(!ae&&window.Thinkific){const j=window.Thinkific.current_user;j&&(ae={name:j.full_name,email:j.email},ua(ae))}Po.init({projectName:e,debug:!
|
|
3177
|
+
`,Xte=({botId:e})=>{var Qn,xr;const{uiData:t,storeMetaData:n,onSendMessage:r,isKlaviyoMessage:i,isLoading:o,lastedBotmessageId:a,setLastedBotmessageId:u,messages:c,isMessageLoading:d,setIsMessageLoading:p,setMessages:h,saveConversation:m,changeDisplayModel:v,loadConversation:_,suggestedQuestions:S,showUserInfoModel:x,setShowUserInfoModel:b,isUserInfoNeeded:k,setPendingQuestion:E}=Pu(),{cart:A,addToCart:I,generateCartUrl:$,addCartAttributes:B}=td(),U=Ys("use-chatbot-icon-size"),G=hs.detect(),P=t==null?void 0:t.isLeft,K=lm(),re=t==null?void 0:t.heightOption,Z=Ys("new-suggested-question-design"),[ie,V]=R.useState(!1),[Q,ve]=R.useState(!1),[Te,T]=R.useState(!1),[X,me]=R.useState([]),L=R.useCallback(async()=>{try{const ae=await fetch(`${Zn}/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(ae.ok){const j=await ae.json(),xe=window.location.pathname,Ne=3,pe=[...X],Ce={question:j.Popup_Message,answer:"",path:xe,nameSpace:e,type:"dynamic",Follow_up_Question:j.Follow_up_Question};pe.length>=Ne&&pe.shift(),pe.push(Ce),me(pe),console.log("updated quesitons",pe)}else console.error("Failed to fetch new acquisition question")}catch(ae){console.error("Error fetching new acquisition question:",ae)}},[e,X]);R.useEffect(()=>{if(!Z)return;let ae,j,xe,Ne;const pe=()=>{ae=setTimeout(()=>{V(!0),j=setTimeout(()=>{T(!0),ve(!0),xe=setTimeout(async()=>{T(!1),ve(!1),await L(),Ne=setTimeout(()=>{T(!0),V(!0),ve(!0),pe()},Z.hide_timing||4e3)},Z.show_for||44324)},Z.showing_delay||2e3)},Z.showing_delay||2e3)};return pe(),()=>{console.log("[Debug] Cleaning up timers"),clearTimeout(ae),clearTimeout(j),clearTimeout(xe),clearTimeout(Ne)}},[Z,L]);const[we,Ue]=R.useState(!1);R.useEffect(()=>{const ae=()=>{Ue(window.matchMedia("(max-width: 768px)").matches)};return ae(),window.addEventListener("resize",ae),()=>window.removeEventListener("resize",ae)},[]);const[de,tt]=R.useState(!1),[Ze,lt]=R.useState(!1),[gt,je]=R.useState(""),[Se,Ye]=R.useState(""),[,Qe]=R.useState(0);R.useEffect(()=>{e&&im(e)},[e]),R.useEffect(()=>{Yg(e)},[e]),R.useEffect(()=>{let ae=Nr();if(!ae&&window.Thinkific){const j=window.Thinkific.current_user;j&&(ae={name:j.full_name,email:j.email},ua(ae))}Po.init({projectName:e,debug:!1,testing:ed}),ae&&ae.email&&(window.DebalesChat.identify(ae.email,{name:ae.name,phone:ae.phone,email:ae.email}),t!=null&&t.KlaviyoIntegration&&window.klaviyo&&window.klaviyo.identify({email:ae.email,first_name:ae.name,phone:ae.phone,from:"Debales-Chatbot"}))},[e,t==null?void 0:t.KlaviyoIntegration]);const ot=R.useRef(null),et=qt(jt.CLICKED_QUESTIONS,{botId:e}),[He,N]=R.useState(()=>{try{const ae=sessionStorage.getItem(et);return ae?new Set(JSON.parse(ae)):new Set}catch{return new Set}});R.useEffect(()=>{try{sessionStorage.setItem(et,JSON.stringify(Array.from(He)))}catch(ae){console.error("Failed to save to sessionStorage:",ae)}},[He]);const F=R.useCallback((ae,j)=>{ae?(window.dispatchEvent(new CustomEvent(hn.OPEN_STATE_CHANGE,{detail:{isOpen:ae,source:j,projectId:e}})),setTimeout(()=>{lt(!0)},50)):(lt(!1),window.dispatchEvent(new CustomEvent(hn.OPEN_STATE_CHANGE,{detail:{isOpen:ae,source:j,projectId:e}})))},[]);R.useEffect(()=>{const ae=j=>{tt(j.detail.isOpen),j.detail.isOpen&&setTimeout(()=>lt(!0),50),window.DebalesChat.isOpen=j.detail.isOpen,window.DebalesChat.track(mt.OPEN_STATE_CHANGE,{isOpen:j.detail.isOpen,source:j.detail.source})};return window.addEventListener(hn.OPEN_STATE_CHANGE,ae),()=>{window.removeEventListener(hn.OPEN_STATE_CHANGE,ae)}},[]),R.useEffect(()=>{const ae=j=>{tt(j.detail.isOpen),window.DebalesChat.isOpen=j.detail.isOpen,window.DebalesChat.track(mt.OPEN_STATE_CHANGE,{isOpen:j.detail.isOpen})};return window.addEventListener(hn.OPEN_STATE_CHANGE,ae),()=>{window.removeEventListener(hn.OPEN_STATE_CHANGE,ae)}},[]);const[Y,ye]=R.useState(()=>{const ae=qt(jt.PENDING_BULK_ITEMS,{botId:e}),j=sessionStorage.getItem(ae);return j?JSON.parse(j):[]});R.useEffect(()=>{const ae=qt(jt.PENDING_BULK_ITEMS,{botId:e});sessionStorage.setItem(ae,JSON.stringify(Y))},[Y,e]);const[_e,Ie]=R.useState(!1),[We,nt]=R.useState({name:"",email:"",message:""}),ne=ja("exit_model"),[he,qe]=R.useState({text:!0,leadingQueries:!0,collections:!0,products:!0,variants:!0,cartSummary:!0,bulkItems:!0}),[Xe,at]=R.useState(!1),[Et,Bt]=R.useState(!0),[kt,Yt]=R.useState(!1),[ft,wt]=R.useState(!1),Je=500,yt=R.useCallback(ae=>{const j=ae.target,xe=j.scrollHeight-j.scrollTop<=j.clientHeight+0;Bt(xe)},[]);R.useEffect(()=>{var ae,j,xe,Ne,pe,Ce;if(c.length>0&&!d){const ut=c[c.length-1],bt=sessionStorage.getItem(qt(jt.LAST_SHOWN_MESSAGE_ID,{botId:e})),ee=ut.isBot&&ut.conversationId===a&&ut.conversationId!==bt,q=(A==null?void 0:A.itemCount)&&(A==null?void 0:A.itemCount)>0&&ut.conversationId===a;if(ee){at(!0),sessionStorage.setItem(qt(jt.LAST_SHOWN_MESSAGE_ID,{botId:e}),ut.conversationId||""),qe({text:!0,leadingQueries:!1,collections:!1,products:!1,variants:!1,cartSummary:!1,bulkItems:!1});const ge=1600;let J=ge;const Re=[{type:"collections",condition:((ae=ut.collections)==null?void 0:ae.length)&&((j=ut.collections)==null?void 0:j.length)>0},{type:"products",condition:((xe=ut.products)==null?void 0:xe.length)&&((Ne=ut.products)==null?void 0:Ne.length)>0},{type:"leadingQueries",condition:((pe=ut.leading_queries)==null?void 0:pe.length)&&((Ce=ut.leading_queries)==null?void 0:Ce.length)>0},{type:"cartSummary",condition:(A==null?void 0:A.itemCount)&&(A==null?void 0:A.itemCount)>0},{type:"bulkItems",condition:(Y==null?void 0:Y.length)>0}].filter(Oe=>Oe.condition);if(Re.length===0){at(!1);return}Re.forEach(({type:Oe},De)=>{setTimeout(()=>{if(qe(ct=>({...ct,[Oe]:!0})),Et&&ot.current){const ct=ot.current;ct.scrollHeight-ct.scrollTop<=ct.clientHeight&&ri(ot)}De===Re.length-1&&at(!1)},J),J+=ge})}else q&&qe(ge=>({...ge,cartSummary:!0}))}},[c,d,a,A==null?void 0:A.itemCount,Y==null?void 0:Y.length,Et,e]),R.useEffect(()=>{if(!i&&c.length>0){const ae=ot.current;ae&&Et&&ae.scrollHeight-ae.scrollTop<=ae.clientHeight+100&&setTimeout(()=>ri(ot),100)}},[c.length,i,Et]),R.useEffect(()=>{const ae=document.querySelector('meta[name="viewport"]'),j=ae==null?void 0:ae.content;if(de){let xe=ae;const Ne=window.matchMedia("(max-width: 768px)").matches;xe?xe.content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no":(xe=document.createElement("meta"),xe.name="viewport",xe.content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no",document.head.appendChild(xe)),Ne&&(t==null?void 0:t.mobileDisplayMode)==="full-screen"&&(document.body.style.overflow="hidden");const pe=xe;return()=>{j&&pe&&(pe.content=j),Ne&&(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="")}},[de,t==null?void 0:t.mobileDisplayMode]),R.useEffect(()=>{i||setTimeout(()=>ri(ot),100)},[c.length,i]),R.useEffect(()=>{A!=null&&A.itemCount&&A.itemCount===0&&!i&&setTimeout(()=>ri(ot),100)},[A==null?void 0:A.itemCount,i]),R.useEffect(()=>{a&&sessionStorage.setItem(qt(jt.LAST_SHOWN_MESSAGE_ID,{botId:e}),a)},[a,e]);const[Yn,pr]=R.useState(!1),[Wn,Pn]=R.useState(!1),[Fr,pi]=R.useState(null),oi=async ae=>{const j=an();if(lt(!1),ae&&c.length>1)try{(await fetch(`${Zn}/api/wordpress/userRating`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sessionId:j,userRating:ae,nameSpace:e})})).ok||console.error("Error submitting rating")}catch(xe){console.error("Error submitting rating:",xe)}setTimeout(()=>{Pn(!1),F(!1,"close_button_clicked")},1e3)},Ar=ae=>{p(!0),Y.forEach(xe=>{I(xe.id,xe.quantity)}),window.DebalesChat.track(mt.ADD_BULK_ITEM,{products:Y,message:ae});const j=[...c,{text:"🎉 Bulk items added to cart successfully.",leading_queries:["Get GST Invoice for the order","Explore more products"],conversationId:ae,isBot:!0}];h(j),m(j),u(ae),ye([]),p(!1)},zr=()=>{var ae;switch(e){case"minature":case"bodytales":case"imemyselfcare-com":if(window.triggerGokwikCustomCheckout)return window.triggerGokwikCustomCheckout(),!0;break;case"athflex":if((ae=window.shiprocketCheckoutEvents)!=null&&ae.buyCart)return window.shiprocketCheckoutEvents.buyCart(),!0;break;case"www":if(window.openRzpCheckout)return window.openRzpCheckout(),!0;break;default:return window.location.href=$((t==null?void 0:t.shopifyShopDomain)??""),!1}return window.location.href=$((t==null?void 0:t.shopifyShopDomain)??""),!1},ro=async ae=>{ae.preventDefault(),window.DebalesChat.track(mt.CHECKOUT_CLICKED,{chatId:an()+e,cartValue:Number(A==null?void 0:A.total),cart:A}),B({dbls_method:"checkout_clicked"}),zr()&&F(!1,"checkout_clicked")};R.useEffect(()=>{const ae=Zg(S);me(j=>[...ae.filter(Ne=>!j.some(pe=>pe.question===Ne.question))])},[S]);const ai=R.useMemo(()=>X.map(ae=>({...ae,isClicked:He.has(ae.question)})),[X,He]);R.useEffect(()=>{const ae=Ne=>{const pe=Ne.detail.formId;switch(Ne.detail.type){case"open":case"embedOpen":setTimeout(()=>{const ut=j(pe);ut&&je(ut)},800);break;case"close":gt&&(t==null?void 0:t.KlaviyoFormIntegration)===!0&&setTimeout(()=>{F(!0,"klaviyo_form_closed"),Ye(pe),r(gt,void 0,void 0,!0)},1e4);break}},j=Ne=>{const pe=document.querySelector(`[data-testid="klaviyo-form-${Ne}"]`);if(console.log(`formElement text ${Ne} =>`,pe==null?void 0:pe.innerText,pe==null?void 0:pe.textContent),pe instanceof HTMLElement){const Ce=pe.innerText||pe.textContent;if(Ce)return console.log("Found form text:",Ce),`=> Klaviyo form content:
|
|
3178
3178
|
|
|
3179
3179
|
`+Ce+`
|
|
3180
3180
|
|
|
@@ -4000,7 +4000,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
4000
4000
|
margin-top: 16px;
|
|
4001
4001
|
display: flex;
|
|
4002
4002
|
justify-content: flex-end;
|
|
4003
|
-
`,$ne=({botId:e})=>{var bt,ee;const{uiData:t,storeMetaData:n,onSendMessage:r,isKlaviyoMessage:i,isLoading:o,lastedBotmessageId:a,setLastedBotmessageId:u,messages:c,isMessageLoading:d,setIsMessageLoading:p,setMessages:h,saveConversation:m,changeDisplayModel:v,loadConversation:_,suggestedQuestions:S,setSuggestedQuestions:x,showUserInfoModel:b,setShowUserInfoModel:k,isUserInfoNeeded:E,setPendingQuestion:A}=Pu(),{cart:I,addToCart:$,generateCartUrl:B,addCartAttributes:U}=td(),G=Ys("use-chatbot-icon-size"),P=hs.detect(),K=t==null?void 0:t.isLeft,re=lm(),ue=t==null?void 0:t.heightOption,ie=Ys("new-suggested-question-design"),[V,Q]=R.useState(!1),[ve,Te]=R.useState(!1),[T,X]=R.useState(!1);R.useEffect(()=>{if(!ie)return;const q=setTimeout(()=>{Q(!0);const ge=setTimeout(()=>{X(!0),Te(!0);const J=setTimeout(()=>{X(!1),Q(!1),Te(!1);const Re=setTimeout(()=>{X(!0),Q(!0),Te(!0)},ie.hide_timing||4e3);return()=>clearTimeout(Re)},ie.show_for||44324);return()=>clearTimeout(J)},ie.showing_delay||2e3);return()=>clearTimeout(ge)},ie.showing_delay||2e3);return()=>clearTimeout(q)},[ie]);const[me,L]=R.useState(!1);R.useEffect(()=>{const q=()=>{L(window.matchMedia("(max-width: 768px)").matches)};return q(),window.addEventListener("resize",q),()=>window.removeEventListener("resize",q)},[]);const[we,Ue]=R.useState(!1),[de,tt]=R.useState(!1),[Ze,lt]=R.useState(""),[gt,je]=R.useState(""),[,Se]=R.useState(0);R.useEffect(()=>{e&&im(e)},[e]),R.useEffect(()=>{Yg(e)},[e]),R.useEffect(()=>{let q=Nr();if(!q&&window.Thinkific){const ge=window.Thinkific.current_user;ge&&(q={name:ge.full_name,email:ge.email},ua(q))}Po.init({projectName:e,debug:!0,testing:ed}),q&&q.email&&(window.DebalesChat.identify(q.email,{name:q.name,phone:q.phone,email:q.email}),t!=null&&t.KlaviyoIntegration&&window.klaviyo&&window.klaviyo.identify({email:q.email,first_name:q.name,phone:q.phone,from:"Debales-Chatbot"}))},[e,t==null?void 0:t.KlaviyoIntegration]);const Ye=R.useRef(null),Qe=qt(jt.CLICKED_QUESTIONS,{botId:e}),[ot,et]=R.useState(()=>{try{const q=sessionStorage.getItem(Qe);return q?new Set(JSON.parse(q)):new Set}catch{return new Set}});R.useEffect(()=>{try{sessionStorage.setItem(Qe,JSON.stringify(Array.from(ot)))}catch(q){console.error("Failed to save to sessionStorage:",q)}},[ot]);const He=R.useCallback((q,ge)=>{q?(window.dispatchEvent(new CustomEvent(hn.OPEN_STATE_CHANGE,{detail:{isOpen:q,source:ge,projectId:e}})),setTimeout(()=>{tt(!0)},50)):(tt(!1),window.dispatchEvent(new CustomEvent(hn.OPEN_STATE_CHANGE,{detail:{isOpen:q,source:ge,projectId:e}})))},[]);R.useEffect(()=>{const q=ge=>{Ue(ge.detail.isOpen),ge.detail.isOpen&&setTimeout(()=>tt(!0),50),window.DebalesChat.isOpen=ge.detail.isOpen,window.DebalesChat.track(mt.OPEN_STATE_CHANGE,{isOpen:ge.detail.isOpen,source:ge.detail.source})};return window.addEventListener(hn.OPEN_STATE_CHANGE,q),()=>{window.removeEventListener(hn.OPEN_STATE_CHANGE,q)}},[]),R.useEffect(()=>{const q=ge=>{Ue(ge.detail.isOpen),window.DebalesChat.isOpen=ge.detail.isOpen,window.DebalesChat.track(mt.OPEN_STATE_CHANGE,{isOpen:ge.detail.isOpen})};return window.addEventListener(hn.OPEN_STATE_CHANGE,q),()=>{window.removeEventListener(hn.OPEN_STATE_CHANGE,q)}},[]);const[N,F]=R.useState(()=>{const q=qt(jt.PENDING_BULK_ITEMS,{botId:e}),ge=sessionStorage.getItem(q);return ge?JSON.parse(ge):[]});R.useEffect(()=>{const q=qt(jt.PENDING_BULK_ITEMS,{botId:e});sessionStorage.setItem(q,JSON.stringify(N))},[N,e]);const[Y,ye]=R.useState(!1),[_e,Ie]=R.useState({name:"",email:"",message:""}),We=ja("exit_model"),[nt,ne]=R.useState({text:!0,leadingQueries:!0,collections:!0,products:!0,variants:!0,cartSummary:!0,bulkItems:!0}),[he,qe]=R.useState(!1),[Xe,at]=R.useState(!0),[Et,Bt]=R.useState(!1),[kt,Yt]=R.useState(!1),ft=500,wt=R.useCallback(q=>{const ge=q.target,J=ge.scrollHeight-ge.scrollTop<=ge.clientHeight+0;at(J)},[]);R.useEffect(()=>{var q,ge,J,Re,Oe,De;if(c.length>0&&!d){const ct=c[c.length-1],Pt=sessionStorage.getItem(qt(jt.LAST_SHOWN_MESSAGE_ID,{botId:e})),Ur=ct.isBot&&ct.conversationId===a&&ct.conversationId!==Pt,jr=(I==null?void 0:I.itemCount)&&(I==null?void 0:I.itemCount)>0&&ct.conversationId===a;if(Ur){qe(!0),sessionStorage.setItem(qt(jt.LAST_SHOWN_MESSAGE_ID,{botId:e}),ct.conversationId||""),ne({text:!0,leadingQueries:!1,collections:!1,products:!1,variants:!1,cartSummary:!1,bulkItems:!1});const Ir=1600;let mi=Ir;const ma=[{type:"collections",condition:((q=ct.collections)==null?void 0:q.length)&&((ge=ct.collections)==null?void 0:ge.length)>0},{type:"products",condition:((J=ct.products)==null?void 0:J.length)&&((Re=ct.products)==null?void 0:Re.length)>0},{type:"leadingQueries",condition:((Oe=ct.leading_queries)==null?void 0:Oe.length)&&((De=ct.leading_queries)==null?void 0:De.length)>0},{type:"cartSummary",condition:(I==null?void 0:I.itemCount)&&(I==null?void 0:I.itemCount)>0},{type:"bulkItems",condition:(N==null?void 0:N.length)>0}].filter(gs=>gs.condition);if(ma.length===0){qe(!1);return}ma.forEach(({type:gs},mr)=>{setTimeout(()=>{if(ne(va=>({...va,[gs]:!0})),Xe&&Ye.current){const va=Ye.current;va.scrollHeight-va.scrollTop<=va.clientHeight&&ri(Ye)}mr===ma.length-1&&qe(!1)},mi),mi+=Ir})}else jr&&ne(Ir=>({...Ir,cartSummary:!0}))}},[c,d,a,I==null?void 0:I.itemCount,N==null?void 0:N.length,Xe,e]),R.useEffect(()=>{if(!i&&c.length>0){const q=Ye.current;q&&Xe&&q.scrollHeight-q.scrollTop<=q.clientHeight+100&&setTimeout(()=>ri(Ye),100)}},[c.length,i,Xe]),R.useEffect(()=>{const q=document.querySelector('meta[name="viewport"]'),ge=q==null?void 0:q.content;if(we){let J=q;const Re=window.matchMedia("(max-width: 768px)").matches;J?J.content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no":(J=document.createElement("meta"),J.name="viewport",J.content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no",document.head.appendChild(J)),Re&&(t==null?void 0:t.mobileDisplayMode)==="full-screen"&&(document.body.style.overflow="hidden");const Oe=J;return()=>{ge&&Oe&&(Oe.content=ge),Re&&(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="")}},[we,t==null?void 0:t.mobileDisplayMode]),R.useEffect(()=>{i||setTimeout(()=>ri(Ye),100)},[c.length,i]),R.useEffect(()=>{I!=null&&I.itemCount&&I.itemCount===0&&!i&&setTimeout(()=>ri(Ye),100)},[I==null?void 0:I.itemCount,i]),R.useEffect(()=>{a&&sessionStorage.setItem(qt(jt.LAST_SHOWN_MESSAGE_ID,{botId:e}),a)},[a,e]);const Je=R.useRef(Date.now()),yt=R.useRef(0),Yn=R.useRef(window.location.pathname),pr=R.useRef(S),Wn=R.useRef(!1),Pn=ja("acquisition_agent");R.useEffect(()=>{pr.current=S},[S]);const Fr=R.useCallback(async()=>{const q=Date.now();if(q-Je.current>=6e3&&q-yt.current>=6e4&&!Wn.current)try{Wn.current=!0,console.log("fetching acquisition data");const Re=await fetch(`${Zn}/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(Re.ok){const Oe=await Re.json(),ct=[...pr.current.filter(Pt=>Pt.path!==Yn.current),{question:Oe.Popup_Message,answer:"",path:Yn.current,nameSpace:e,type:"dynamic",Follow_up_Question:Oe.Follow_up_Question}];x(ct)}yt.current=q}catch(Re){console.error("Error fetching acquisition data:",Re)}finally{Wn.current=!1}},[e]);R.useEffect(()=>{if(!Pn||(t==null?void 0:t.show_bot)===!1)return;const q=()=>{Je.current=Date.now()};document.addEventListener("mousemove",q),document.addEventListener("mousedown",q),document.addEventListener("keypress",q),document.addEventListener("scroll",q),document.addEventListener("touchstart",q),document.addEventListener("touchmove",q);const ge=setInterval(Fr,1e3),J=()=>{const Oe=window.location.pathname.split("?")[0],De=Yn.current.split("?")[0];(()=>{const Pt=De.split("/").filter(Boolean),Ur=Oe.split("/").filter(Boolean);return Pt.length!==Ur.length?!0:Pt.length===0&&Ur.length===0?!1:Oe!==De})()&&(Yn.current=Oe,Je.current=Date.now())};return window.addEventListener("popstate",J),()=>{document.removeEventListener("mousemove",q),document.removeEventListener("mousedown",q),document.removeEventListener("keypress",q),document.removeEventListener("scroll",q),document.removeEventListener("touchstart",q),document.removeEventListener("touchmove",q),window.removeEventListener("popstate",J),clearInterval(ge)}},[Pn,Fr,t==null?void 0:t.show_bot]);const[pi,oi]=R.useState(!1),[Ar,zr]=R.useState(!1),[ro,ai]=R.useState(null),gr=async q=>{const ge=an();if(tt(!1),q&&c.length>1)try{(await fetch(`${Zn}/api/wordpress/userRating`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sessionId:ge,userRating:q,nameSpace:e})})).ok||console.error("Error submitting rating")}catch(J){console.error("Error submitting rating:",J)}setTimeout(()=>{zr(!1),He(!1,"close_button_clicked")},1e3)},Cn=q=>{p(!0),N.forEach(J=>{$(J.id,J.quantity)}),window.DebalesChat.track(mt.ADD_BULK_ITEM,{products:N,message:q});const ge=[...c,{text:"🎉 Bulk items added to cart successfully.",leading_queries:["Get GST Invoice for the order","Explore more products"],conversationId:q,isBot:!0}];h(ge),m(ge),u(q),F([]),p(!1)},Jt=()=>{var q;switch(e){case"minature":case"bodytales":case"imemyselfcare-com":if(window.triggerGokwikCustomCheckout)return window.triggerGokwikCustomCheckout(),!0;break;case"athflex":if((q=window.shiprocketCheckoutEvents)!=null&&q.buyCart)return window.shiprocketCheckoutEvents.buyCart(),!0;break;case"www":if(window.openRzpCheckout)return window.openRzpCheckout(),!0;break;default:return window.location.href=B((t==null?void 0:t.shopifyShopDomain)??""),!1}return window.location.href=B((t==null?void 0:t.shopifyShopDomain)??""),!1},Un=async q=>{q.preventDefault(),window.DebalesChat.track(mt.CHECKOUT_CLICKED,{chatId:an()+e,cartValue:Number(I==null?void 0:I.total),cart:I}),U({dbls_method:"checkout_clicked"}),Jt()&&He(!1,"checkout_clicked")},[Kn,en]=R.useState([]);R.useEffect(()=>{const q=Zg(S);en(ge=>{const J=q.filter(Re=>!ge.some(Oe=>Oe.question===Re.question));return[...ge,...J]})},[S]);const tn=R.useMemo(()=>Kn.map(q=>({...q,isClicked:ot.has(q.question)})),[Kn,ot]);console.log(Kn),R.useEffect(()=>{const q=Re=>{const Oe=Re.detail.formId;switch(Re.detail.type){case"open":case"embedOpen":setTimeout(()=>{const ct=ge(Oe);ct&<(ct)},800);break;case"close":Ze&&(t==null?void 0:t.KlaviyoFormIntegration)===!0&&setTimeout(()=>{He(!0,"klaviyo_form_closed"),je(Oe),r(Ze,void 0,void 0,!0)},1e4);break}},ge=Re=>{const Oe=document.querySelector(`[data-testid="klaviyo-form-${Re}"]`);if(console.log(`formElement text ${Re} =>`,Oe==null?void 0:Oe.innerText,Oe==null?void 0:Oe.textContent),Oe instanceof HTMLElement){const De=Oe.innerText||Oe.textContent;if(De)return console.log("Found form text:",De),`=> Klaviyo form content:
|
|
4003
|
+
`,$ne=({botId:e})=>{var bt,ee;const{uiData:t,storeMetaData:n,onSendMessage:r,isKlaviyoMessage:i,isLoading:o,lastedBotmessageId:a,setLastedBotmessageId:u,messages:c,isMessageLoading:d,setIsMessageLoading:p,setMessages:h,saveConversation:m,changeDisplayModel:v,loadConversation:_,suggestedQuestions:S,setSuggestedQuestions:x,showUserInfoModel:b,setShowUserInfoModel:k,isUserInfoNeeded:E,setPendingQuestion:A}=Pu(),{cart:I,addToCart:$,generateCartUrl:B,addCartAttributes:U}=td(),G=Ys("use-chatbot-icon-size"),P=hs.detect(),K=t==null?void 0:t.isLeft,re=lm(),ue=t==null?void 0:t.heightOption,ie=Ys("new-suggested-question-design"),[V,Q]=R.useState(!1),[ve,Te]=R.useState(!1),[T,X]=R.useState(!1);R.useEffect(()=>{if(!ie)return;const q=setTimeout(()=>{Q(!0);const ge=setTimeout(()=>{X(!0),Te(!0);const J=setTimeout(()=>{X(!1),Q(!1),Te(!1);const Re=setTimeout(()=>{X(!0),Q(!0),Te(!0)},ie.hide_timing||4e3);return()=>clearTimeout(Re)},ie.show_for||44324);return()=>clearTimeout(J)},ie.showing_delay||2e3);return()=>clearTimeout(ge)},ie.showing_delay||2e3);return()=>clearTimeout(q)},[ie]);const[me,L]=R.useState(!1);R.useEffect(()=>{const q=()=>{L(window.matchMedia("(max-width: 768px)").matches)};return q(),window.addEventListener("resize",q),()=>window.removeEventListener("resize",q)},[]);const[we,Ue]=R.useState(!1),[de,tt]=R.useState(!1),[Ze,lt]=R.useState(""),[gt,je]=R.useState(""),[,Se]=R.useState(0);R.useEffect(()=>{e&&im(e)},[e]),R.useEffect(()=>{Yg(e)},[e]),R.useEffect(()=>{let q=Nr();if(!q&&window.Thinkific){const ge=window.Thinkific.current_user;ge&&(q={name:ge.full_name,email:ge.email},ua(q))}Po.init({projectName:e,debug:!1,testing:ed}),q&&q.email&&(window.DebalesChat.identify(q.email,{name:q.name,phone:q.phone,email:q.email}),t!=null&&t.KlaviyoIntegration&&window.klaviyo&&window.klaviyo.identify({email:q.email,first_name:q.name,phone:q.phone,from:"Debales-Chatbot"}))},[e,t==null?void 0:t.KlaviyoIntegration]);const Ye=R.useRef(null),Qe=qt(jt.CLICKED_QUESTIONS,{botId:e}),[ot,et]=R.useState(()=>{try{const q=sessionStorage.getItem(Qe);return q?new Set(JSON.parse(q)):new Set}catch{return new Set}});R.useEffect(()=>{try{sessionStorage.setItem(Qe,JSON.stringify(Array.from(ot)))}catch(q){console.error("Failed to save to sessionStorage:",q)}},[ot]);const He=R.useCallback((q,ge)=>{q?(window.dispatchEvent(new CustomEvent(hn.OPEN_STATE_CHANGE,{detail:{isOpen:q,source:ge,projectId:e}})),setTimeout(()=>{tt(!0)},50)):(tt(!1),window.dispatchEvent(new CustomEvent(hn.OPEN_STATE_CHANGE,{detail:{isOpen:q,source:ge,projectId:e}})))},[]);R.useEffect(()=>{const q=ge=>{Ue(ge.detail.isOpen),ge.detail.isOpen&&setTimeout(()=>tt(!0),50),window.DebalesChat.isOpen=ge.detail.isOpen,window.DebalesChat.track(mt.OPEN_STATE_CHANGE,{isOpen:ge.detail.isOpen,source:ge.detail.source})};return window.addEventListener(hn.OPEN_STATE_CHANGE,q),()=>{window.removeEventListener(hn.OPEN_STATE_CHANGE,q)}},[]),R.useEffect(()=>{const q=ge=>{Ue(ge.detail.isOpen),window.DebalesChat.isOpen=ge.detail.isOpen,window.DebalesChat.track(mt.OPEN_STATE_CHANGE,{isOpen:ge.detail.isOpen})};return window.addEventListener(hn.OPEN_STATE_CHANGE,q),()=>{window.removeEventListener(hn.OPEN_STATE_CHANGE,q)}},[]);const[N,F]=R.useState(()=>{const q=qt(jt.PENDING_BULK_ITEMS,{botId:e}),ge=sessionStorage.getItem(q);return ge?JSON.parse(ge):[]});R.useEffect(()=>{const q=qt(jt.PENDING_BULK_ITEMS,{botId:e});sessionStorage.setItem(q,JSON.stringify(N))},[N,e]);const[Y,ye]=R.useState(!1),[_e,Ie]=R.useState({name:"",email:"",message:""}),We=ja("exit_model"),[nt,ne]=R.useState({text:!0,leadingQueries:!0,collections:!0,products:!0,variants:!0,cartSummary:!0,bulkItems:!0}),[he,qe]=R.useState(!1),[Xe,at]=R.useState(!0),[Et,Bt]=R.useState(!1),[kt,Yt]=R.useState(!1),ft=500,wt=R.useCallback(q=>{const ge=q.target,J=ge.scrollHeight-ge.scrollTop<=ge.clientHeight+0;at(J)},[]);R.useEffect(()=>{var q,ge,J,Re,Oe,De;if(c.length>0&&!d){const ct=c[c.length-1],Pt=sessionStorage.getItem(qt(jt.LAST_SHOWN_MESSAGE_ID,{botId:e})),Ur=ct.isBot&&ct.conversationId===a&&ct.conversationId!==Pt,jr=(I==null?void 0:I.itemCount)&&(I==null?void 0:I.itemCount)>0&&ct.conversationId===a;if(Ur){qe(!0),sessionStorage.setItem(qt(jt.LAST_SHOWN_MESSAGE_ID,{botId:e}),ct.conversationId||""),ne({text:!0,leadingQueries:!1,collections:!1,products:!1,variants:!1,cartSummary:!1,bulkItems:!1});const Ir=1600;let mi=Ir;const ma=[{type:"collections",condition:((q=ct.collections)==null?void 0:q.length)&&((ge=ct.collections)==null?void 0:ge.length)>0},{type:"products",condition:((J=ct.products)==null?void 0:J.length)&&((Re=ct.products)==null?void 0:Re.length)>0},{type:"leadingQueries",condition:((Oe=ct.leading_queries)==null?void 0:Oe.length)&&((De=ct.leading_queries)==null?void 0:De.length)>0},{type:"cartSummary",condition:(I==null?void 0:I.itemCount)&&(I==null?void 0:I.itemCount)>0},{type:"bulkItems",condition:(N==null?void 0:N.length)>0}].filter(gs=>gs.condition);if(ma.length===0){qe(!1);return}ma.forEach(({type:gs},mr)=>{setTimeout(()=>{if(ne(va=>({...va,[gs]:!0})),Xe&&Ye.current){const va=Ye.current;va.scrollHeight-va.scrollTop<=va.clientHeight&&ri(Ye)}mr===ma.length-1&&qe(!1)},mi),mi+=Ir})}else jr&&ne(Ir=>({...Ir,cartSummary:!0}))}},[c,d,a,I==null?void 0:I.itemCount,N==null?void 0:N.length,Xe,e]),R.useEffect(()=>{if(!i&&c.length>0){const q=Ye.current;q&&Xe&&q.scrollHeight-q.scrollTop<=q.clientHeight+100&&setTimeout(()=>ri(Ye),100)}},[c.length,i,Xe]),R.useEffect(()=>{const q=document.querySelector('meta[name="viewport"]'),ge=q==null?void 0:q.content;if(we){let J=q;const Re=window.matchMedia("(max-width: 768px)").matches;J?J.content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no":(J=document.createElement("meta"),J.name="viewport",J.content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no",document.head.appendChild(J)),Re&&(t==null?void 0:t.mobileDisplayMode)==="full-screen"&&(document.body.style.overflow="hidden");const Oe=J;return()=>{ge&&Oe&&(Oe.content=ge),Re&&(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="")}},[we,t==null?void 0:t.mobileDisplayMode]),R.useEffect(()=>{i||setTimeout(()=>ri(Ye),100)},[c.length,i]),R.useEffect(()=>{I!=null&&I.itemCount&&I.itemCount===0&&!i&&setTimeout(()=>ri(Ye),100)},[I==null?void 0:I.itemCount,i]),R.useEffect(()=>{a&&sessionStorage.setItem(qt(jt.LAST_SHOWN_MESSAGE_ID,{botId:e}),a)},[a,e]);const Je=R.useRef(Date.now()),yt=R.useRef(0),Yn=R.useRef(window.location.pathname),pr=R.useRef(S),Wn=R.useRef(!1),Pn=ja("acquisition_agent");R.useEffect(()=>{pr.current=S},[S]);const Fr=R.useCallback(async()=>{const q=Date.now();if(q-Je.current>=6e3&&q-yt.current>=6e4&&!Wn.current)try{Wn.current=!0,console.log("fetching acquisition data");const Re=await fetch(`${Zn}/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(Re.ok){const Oe=await Re.json(),ct=[...pr.current.filter(Pt=>Pt.path!==Yn.current),{question:Oe.Popup_Message,answer:"",path:Yn.current,nameSpace:e,type:"dynamic",Follow_up_Question:Oe.Follow_up_Question}];x(ct)}yt.current=q}catch(Re){console.error("Error fetching acquisition data:",Re)}finally{Wn.current=!1}},[e]);R.useEffect(()=>{if(!Pn||(t==null?void 0:t.show_bot)===!1)return;const q=()=>{Je.current=Date.now()};document.addEventListener("mousemove",q),document.addEventListener("mousedown",q),document.addEventListener("keypress",q),document.addEventListener("scroll",q),document.addEventListener("touchstart",q),document.addEventListener("touchmove",q);const ge=setInterval(Fr,1e3),J=()=>{const Oe=window.location.pathname.split("?")[0],De=Yn.current.split("?")[0];(()=>{const Pt=De.split("/").filter(Boolean),Ur=Oe.split("/").filter(Boolean);return Pt.length!==Ur.length?!0:Pt.length===0&&Ur.length===0?!1:Oe!==De})()&&(Yn.current=Oe,Je.current=Date.now())};return window.addEventListener("popstate",J),()=>{document.removeEventListener("mousemove",q),document.removeEventListener("mousedown",q),document.removeEventListener("keypress",q),document.removeEventListener("scroll",q),document.removeEventListener("touchstart",q),document.removeEventListener("touchmove",q),window.removeEventListener("popstate",J),clearInterval(ge)}},[Pn,Fr,t==null?void 0:t.show_bot]);const[pi,oi]=R.useState(!1),[Ar,zr]=R.useState(!1),[ro,ai]=R.useState(null),gr=async q=>{const ge=an();if(tt(!1),q&&c.length>1)try{(await fetch(`${Zn}/api/wordpress/userRating`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sessionId:ge,userRating:q,nameSpace:e})})).ok||console.error("Error submitting rating")}catch(J){console.error("Error submitting rating:",J)}setTimeout(()=>{zr(!1),He(!1,"close_button_clicked")},1e3)},Cn=q=>{p(!0),N.forEach(J=>{$(J.id,J.quantity)}),window.DebalesChat.track(mt.ADD_BULK_ITEM,{products:N,message:q});const ge=[...c,{text:"🎉 Bulk items added to cart successfully.",leading_queries:["Get GST Invoice for the order","Explore more products"],conversationId:q,isBot:!0}];h(ge),m(ge),u(q),F([]),p(!1)},Jt=()=>{var q;switch(e){case"minature":case"bodytales":case"imemyselfcare-com":if(window.triggerGokwikCustomCheckout)return window.triggerGokwikCustomCheckout(),!0;break;case"athflex":if((q=window.shiprocketCheckoutEvents)!=null&&q.buyCart)return window.shiprocketCheckoutEvents.buyCart(),!0;break;case"www":if(window.openRzpCheckout)return window.openRzpCheckout(),!0;break;default:return window.location.href=B((t==null?void 0:t.shopifyShopDomain)??""),!1}return window.location.href=B((t==null?void 0:t.shopifyShopDomain)??""),!1},Un=async q=>{q.preventDefault(),window.DebalesChat.track(mt.CHECKOUT_CLICKED,{chatId:an()+e,cartValue:Number(I==null?void 0:I.total),cart:I}),U({dbls_method:"checkout_clicked"}),Jt()&&He(!1,"checkout_clicked")},[Kn,en]=R.useState([]);R.useEffect(()=>{const q=Zg(S);en(ge=>{const J=q.filter(Re=>!ge.some(Oe=>Oe.question===Re.question));return[...ge,...J]})},[S]);const tn=R.useMemo(()=>Kn.map(q=>({...q,isClicked:ot.has(q.question)})),[Kn,ot]);console.log(Kn),R.useEffect(()=>{const q=Re=>{const Oe=Re.detail.formId;switch(Re.detail.type){case"open":case"embedOpen":setTimeout(()=>{const ct=ge(Oe);ct&<(ct)},800);break;case"close":Ze&&(t==null?void 0:t.KlaviyoFormIntegration)===!0&&setTimeout(()=>{He(!0,"klaviyo_form_closed"),je(Oe),r(Ze,void 0,void 0,!0)},1e4);break}},ge=Re=>{const Oe=document.querySelector(`[data-testid="klaviyo-form-${Re}"]`);if(console.log(`formElement text ${Re} =>`,Oe==null?void 0:Oe.innerText,Oe==null?void 0:Oe.textContent),Oe instanceof HTMLElement){const De=Oe.innerText||Oe.textContent;if(De)return console.log("Found form text:",De),`=> Klaviyo form content:
|
|
4004
4004
|
|
|
4005
4005
|
`+De+`
|
|
4006
4006
|
|
|
@@ -4850,8 +4850,8 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
4850
4850
|
margin-top: 16px;
|
|
4851
4851
|
display: flex;
|
|
4852
4852
|
justify-content: flex-end;
|
|
4853
|
-
`,gre=({botId:e})=>{var ut,bt;const{uiData:t,storeMetaData:n,onSendMessage:r,isKlaviyoMessage:i,isLoading:o,lastedBotmessageId:a,setLastedBotmessageId:u,messages:c,isMessageLoading:d,setIsMessageLoading:p,setMessages:h,saveConversation:m,changeDisplayModel:v,loadConversation:_,suggestedQuestions:S,setSuggestedQuestions:x,showUserInfoModel:b,setShowUserInfoModel:k,isUserInfoNeeded:E,setPendingQuestion:A}=Pu(),{cart:I,addToCart:$,generateCartUrl:B,addCartAttributes:U}=td(),G=Ys("use-chatbot-icon-size"),P=hs.detect(),K=lm(),re=t==null?void 0:t.heightOption,Z=Ys("new-suggested-question-design"),[ie,V]=R.useState(!1),[Q,ve]=R.useState(!1),[Te,T]=R.useState(!1);R.useEffect(()=>{if(!Z)return;const ee=setTimeout(()=>{V(!0);const q=setTimeout(()=>{T(!0),ve(!0);const ge=setTimeout(()=>{T(!1),V(!1),ve(!1);const J=setTimeout(()=>{T(!0),V(!0),ve(!0)},Z.hide_timing||4e3);return()=>clearTimeout(J)},Z.show_for||44324);return()=>clearTimeout(ge)},Z.showing_delay||2e3);return()=>clearTimeout(q)},Z.showing_delay||2e3);return()=>clearTimeout(ee)},[Z]);const[X,me]=R.useState(!1);R.useEffect(()=>{const ee=()=>{me(window.matchMedia("(max-width: 768px)").matches)};return ee(),window.addEventListener("resize",ee),()=>window.removeEventListener("resize",ee)},[]);const[L,we]=R.useState(!1),[Ue,de]=R.useState(!1),[tt,Ze]=R.useState(""),[lt,gt]=R.useState(""),[,je]=R.useState(0);R.useEffect(()=>{e&&im(e)},[e]),R.useEffect(()=>{Yg(e)},[e]),R.useEffect(()=>{let ee=Nr();if(!ee&&window.Thinkific){const q=window.Thinkific.current_user;q&&(ee={name:q.full_name,email:q.email},ua(ee))}Po.init({projectName:e,debug:!0,testing:ed}),ee&&ee.email&&(window.DebalesChat.identify(ee.email,{name:ee.name,phone:ee.phone,email:ee.email}),t!=null&&t.KlaviyoIntegration&&window.klaviyo&&window.klaviyo.identify({email:ee.email,first_name:ee.name,phone:ee.phone,from:"Debales-Chatbot"}))},[e,t==null?void 0:t.KlaviyoIntegration]);const Se=R.useRef(null),Ye=qt(jt.CLICKED_QUESTIONS,{botId:e}),[Qe,ot]=R.useState(()=>{try{const ee=sessionStorage.getItem(Ye);return ee?new Set(JSON.parse(ee)):new Set}catch{return new Set}});R.useEffect(()=>{try{sessionStorage.setItem(Ye,JSON.stringify(Array.from(Qe)))}catch(ee){console.error("Failed to save to sessionStorage:",ee)}},[Qe]);const et=R.useCallback((ee,q)=>{ee?(window.dispatchEvent(new CustomEvent(hn.OPEN_STATE_CHANGE,{detail:{isOpen:ee,source:q,projectId:e}})),setTimeout(()=>{de(!0)},50)):(de(!1),window.dispatchEvent(new CustomEvent(hn.OPEN_STATE_CHANGE,{detail:{isOpen:ee,source:q,projectId:e}})))},[]);R.useEffect(()=>{const ee=q=>{we(q.detail.isOpen),q.detail.isOpen&&setTimeout(()=>de(!0),50),window.DebalesChat.isOpen=q.detail.isOpen,window.DebalesChat.track(mt.OPEN_STATE_CHANGE,{isOpen:q.detail.isOpen,source:q.detail.source})};return window.addEventListener(hn.OPEN_STATE_CHANGE,ee),()=>{window.removeEventListener(hn.OPEN_STATE_CHANGE,ee)}},[]),R.useEffect(()=>{const ee=q=>{we(q.detail.isOpen),window.DebalesChat.isOpen=q.detail.isOpen,window.DebalesChat.track(mt.OPEN_STATE_CHANGE,{isOpen:q.detail.isOpen})};return window.addEventListener(hn.OPEN_STATE_CHANGE,ee),()=>{window.removeEventListener(hn.OPEN_STATE_CHANGE,ee)}},[]);const[He,N]=R.useState(()=>{const ee=qt(jt.PENDING_BULK_ITEMS,{botId:e}),q=sessionStorage.getItem(ee);return q?JSON.parse(q):[]});R.useEffect(()=>{const ee=qt(jt.PENDING_BULK_ITEMS,{botId:e});sessionStorage.setItem(ee,JSON.stringify(He))},[He,e]);const[F,Y]=R.useState(!1),[ye,_e]=R.useState({name:"",email:"",message:""}),Ie=ja("exit_model"),[We,nt]=R.useState({text:!0,leadingQueries:!0,collections:!0,products:!0,variants:!0,cartSummary:!0,bulkItems:!0}),[ne,he]=R.useState(!1),[qe,Xe]=R.useState(!0),[at,Et]=R.useState(!1),[Bt,kt]=R.useState(!1),Yt=500,ft=R.useCallback(ee=>{const q=ee.target,ge=q.scrollHeight-q.scrollTop<=q.clientHeight+0;Xe(ge)},[]);R.useEffect(()=>{var ee,q,ge,J,Re,Oe;if(c.length>0&&!d){const De=c[c.length-1],ct=sessionStorage.getItem(qt(jt.LAST_SHOWN_MESSAGE_ID,{botId:e})),Pt=De.isBot&&De.conversationId===a&&De.conversationId!==ct,Ur=(I==null?void 0:I.itemCount)&&(I==null?void 0:I.itemCount)>0&&De.conversationId===a;if(Pt){he(!0),sessionStorage.setItem(qt(jt.LAST_SHOWN_MESSAGE_ID,{botId:e}),De.conversationId||""),nt({text:!0,leadingQueries:!1,collections:!1,products:!1,variants:!1,cartSummary:!1,bulkItems:!1});const jr=1600;let Ir=jr;const mi=[{type:"collections",condition:((ee=De.collections)==null?void 0:ee.length)&&((q=De.collections)==null?void 0:q.length)>0},{type:"products",condition:((ge=De.products)==null?void 0:ge.length)&&((J=De.products)==null?void 0:J.length)>0},{type:"leadingQueries",condition:((Re=De.leading_queries)==null?void 0:Re.length)&&((Oe=De.leading_queries)==null?void 0:Oe.length)>0},{type:"cartSummary",condition:(I==null?void 0:I.itemCount)&&(I==null?void 0:I.itemCount)>0},{type:"bulkItems",condition:(He==null?void 0:He.length)>0}].filter(ma=>ma.condition);if(mi.length===0){he(!1);return}mi.forEach(({type:ma},gs)=>{setTimeout(()=>{if(nt(mr=>({...mr,[ma]:!0})),qe&&Se.current){const mr=Se.current;mr.scrollHeight-mr.scrollTop<=mr.clientHeight&&ri(Se)}gs===mi.length-1&&he(!1)},Ir),Ir+=jr})}else Ur&&nt(jr=>({...jr,cartSummary:!0}))}},[c,d,a,I==null?void 0:I.itemCount,He==null?void 0:He.length,qe,e]),R.useEffect(()=>{if(!i&&c.length>0){const ee=Se.current;ee&&qe&&ee.scrollHeight-ee.scrollTop<=ee.clientHeight+100&&setTimeout(()=>ri(Se),100)}},[c.length,i,qe]),R.useEffect(()=>{const ee=document.querySelector('meta[name="viewport"]'),q=ee==null?void 0:ee.content;if(L){let ge=ee;const J=window.matchMedia("(max-width: 768px)").matches;ge?ge.content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no":(ge=document.createElement("meta"),ge.name="viewport",ge.content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no",document.head.appendChild(ge)),J&&(t==null?void 0:t.mobileDisplayMode)==="full-screen"&&(document.body.style.overflow="hidden");const Re=ge;return()=>{q&&Re&&(Re.content=q),J&&(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="")}},[L,t==null?void 0:t.mobileDisplayMode]),R.useEffect(()=>{i||setTimeout(()=>ri(Se),100)},[c.length,i]),R.useEffect(()=>{I!=null&&I.itemCount&&I.itemCount===0&&!i&&setTimeout(()=>ri(Se),100)},[I==null?void 0:I.itemCount,i]),R.useEffect(()=>{a&&sessionStorage.setItem(qt(jt.LAST_SHOWN_MESSAGE_ID,{botId:e}),a)},[a,e]);const wt=R.useRef(Date.now()),Je=R.useRef(0),yt=R.useRef(window.location.pathname),Yn=R.useRef(S),pr=R.useRef(!1),Wn=ja("acquisition_agent");R.useEffect(()=>{Yn.current=S},[S]);const Pn=R.useCallback(async()=>{const ee=Date.now();if(ee-wt.current>=6e3&&ee-Je.current>=6e4&&!pr.current)try{pr.current=!0,console.log("fetching acquisition data");const J=await fetch(`${Zn}/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(J.ok){const Re=await J.json(),De=[...Yn.current.filter(ct=>ct.path!==yt.current),{question:Re.Popup_Message,answer:"",path:yt.current,nameSpace:e,type:"dynamic",Follow_up_Question:Re.Follow_up_Question}];x(De)}Je.current=ee}catch(J){console.error("Error fetching acquisition data:",J)}finally{pr.current=!1}},[e]);R.useEffect(()=>{if(!Wn||(t==null?void 0:t.show_bot)===!1)return;const ee=()=>{wt.current=Date.now()};document.addEventListener("mousemove",ee),document.addEventListener("mousedown",ee),document.addEventListener("keypress",ee),document.addEventListener("scroll",ee),document.addEventListener("touchstart",ee),document.addEventListener("touchmove",ee);const q=setInterval(Pn,1e3),ge=()=>{const Re=window.location.pathname.split("?")[0],Oe=yt.current.split("?")[0];(()=>{const ct=Oe.split("/").filter(Boolean),Pt=Re.split("/").filter(Boolean);return ct.length!==Pt.length?!0:ct.length===0&&Pt.length===0?!1:Re!==Oe})()&&(yt.current=Re,wt.current=Date.now())};return window.addEventListener("popstate",ge),()=>{document.removeEventListener("mousemove",ee),document.removeEventListener("mousedown",ee),document.removeEventListener("keypress",ee),document.removeEventListener("scroll",ee),document.removeEventListener("touchstart",ee),document.removeEventListener("touchmove",ee),window.removeEventListener("popstate",ge),clearInterval(q)}},[Wn,Pn,t==null?void 0:t.show_bot]);const[Fr,pi]=R.useState(!1),[oi,Ar]=R.useState(!1),[zr,ro]=R.useState(null),ai=async ee=>{const q=an();if(de(!1),ee&&c.length>1)try{(await fetch(`${Zn}/api/wordpress/userRating`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sessionId:q,userRating:ee,nameSpace:e})})).ok||console.error("Error submitting rating")}catch(ge){console.error("Error submitting rating:",ge)}setTimeout(()=>{Ar(!1),et(!1,"close_button_clicked")},1e3)},gr=ee=>{p(!0),He.forEach(ge=>{$(ge.id,ge.quantity)}),window.DebalesChat.track(mt.ADD_BULK_ITEM,{products:He,message:ee});const q=[...c,{text:"🎉 Bulk items added to cart successfully.",leading_queries:["Get GST Invoice for the order","Explore more products"],conversationId:ee,isBot:!0}];h(q),m(q),u(ee),N([]),p(!1)},Cn=()=>{var ee;switch(e){case"minature":case"bodytales":case"imemyselfcare-com":if(window.triggerGokwikCustomCheckout)return window.triggerGokwikCustomCheckout(),!0;break;case"athflex":if((ee=window.shiprocketCheckoutEvents)!=null&&ee.buyCart)return window.shiprocketCheckoutEvents.buyCart(),!0;break;case"www":if(window.openRzpCheckout)return window.openRzpCheckout(),!0;break;default:return window.location.href=B((t==null?void 0:t.shopifyShopDomain)??""),!1}return window.location.href=B((t==null?void 0:t.shopifyShopDomain)??""),!1},Jt=async ee=>{ee.preventDefault(),window.DebalesChat.track(mt.CHECKOUT_CLICKED,{chatId:an()+e,cartValue:Number(I==null?void 0:I.total),cart:I}),U({dbls_method:"checkout_clicked"}),Cn()&&et(!1,"checkout_clicked")},[Un,Kn]=R.useState([]);R.useEffect(()=>{const ee=Zg(S);Kn(q=>{const ge=ee.filter(J=>!q.some(Re=>Re.question===J.question));return[...q,...ge]})},[S]);const en=R.useMemo(()=>Un.map(ee=>({...ee,isClicked:Qe.has(ee.question)})),[Un,Qe]);console.log(Un),R.useEffect(()=>{const ee=J=>{const Re=J.detail.formId;switch(J.detail.type){case"open":case"embedOpen":setTimeout(()=>{const De=q(Re);De&&Ze(De)},800);break;case"close":tt&&(t==null?void 0:t.KlaviyoFormIntegration)===!0&&setTimeout(()=>{et(!0,"klaviyo_form_closed"),gt(Re),r(tt,void 0,void 0,!0)},1e4);break}},q=J=>{const Re=document.querySelector(`[data-testid="klaviyo-form-${J}"]`);if(console.log(`formElement text ${J} =>`,Re==null?void 0:Re.innerText,Re==null?void 0:Re.textContent),Re instanceof HTMLElement){const Oe=Re.innerText||Re.textContent;if(Oe)return console.log("Found form text:",Oe),`=> Klaviyo form content:
|
|
4853
|
+
`,gre=({botId:e})=>{var ut,bt;const{uiData:t,storeMetaData:n,onSendMessage:r,isKlaviyoMessage:i,isLoading:o,lastedBotmessageId:a,setLastedBotmessageId:u,messages:c,isMessageLoading:d,setIsMessageLoading:p,setMessages:h,saveConversation:m,changeDisplayModel:v,loadConversation:_,suggestedQuestions:S,setSuggestedQuestions:x,showUserInfoModel:b,setShowUserInfoModel:k,isUserInfoNeeded:E,setPendingQuestion:A}=Pu(),{cart:I,addToCart:$,generateCartUrl:B,addCartAttributes:U}=td(),G=Ys("use-chatbot-icon-size"),P=hs.detect(),K=lm(),re=t==null?void 0:t.heightOption,Z=Ys("new-suggested-question-design"),[ie,V]=R.useState(!1),[Q,ve]=R.useState(!1),[Te,T]=R.useState(!1);R.useEffect(()=>{if(!Z)return;const ee=setTimeout(()=>{V(!0);const q=setTimeout(()=>{T(!0),ve(!0);const ge=setTimeout(()=>{T(!1),V(!1),ve(!1);const J=setTimeout(()=>{T(!0),V(!0),ve(!0)},Z.hide_timing||4e3);return()=>clearTimeout(J)},Z.show_for||44324);return()=>clearTimeout(ge)},Z.showing_delay||2e3);return()=>clearTimeout(q)},Z.showing_delay||2e3);return()=>clearTimeout(ee)},[Z]);const[X,me]=R.useState(!1);R.useEffect(()=>{const ee=()=>{me(window.matchMedia("(max-width: 768px)").matches)};return ee(),window.addEventListener("resize",ee),()=>window.removeEventListener("resize",ee)},[]);const[L,we]=R.useState(!1),[Ue,de]=R.useState(!1),[tt,Ze]=R.useState(""),[lt,gt]=R.useState(""),[,je]=R.useState(0);R.useEffect(()=>{e&&im(e)},[e]),R.useEffect(()=>{Yg(e)},[e]),R.useEffect(()=>{let ee=Nr();if(!ee&&window.Thinkific){const q=window.Thinkific.current_user;q&&(ee={name:q.full_name,email:q.email},ua(ee))}Po.init({projectName:e,debug:!1,testing:ed}),ee&&ee.email&&(window.DebalesChat.identify(ee.email,{name:ee.name,phone:ee.phone,email:ee.email}),t!=null&&t.KlaviyoIntegration&&window.klaviyo&&window.klaviyo.identify({email:ee.email,first_name:ee.name,phone:ee.phone,from:"Debales-Chatbot"}))},[e,t==null?void 0:t.KlaviyoIntegration]);const Se=R.useRef(null),Ye=qt(jt.CLICKED_QUESTIONS,{botId:e}),[Qe,ot]=R.useState(()=>{try{const ee=sessionStorage.getItem(Ye);return ee?new Set(JSON.parse(ee)):new Set}catch{return new Set}});R.useEffect(()=>{try{sessionStorage.setItem(Ye,JSON.stringify(Array.from(Qe)))}catch(ee){console.error("Failed to save to sessionStorage:",ee)}},[Qe]);const et=R.useCallback((ee,q)=>{ee?(window.dispatchEvent(new CustomEvent(hn.OPEN_STATE_CHANGE,{detail:{isOpen:ee,source:q,projectId:e}})),setTimeout(()=>{de(!0)},50)):(de(!1),window.dispatchEvent(new CustomEvent(hn.OPEN_STATE_CHANGE,{detail:{isOpen:ee,source:q,projectId:e}})))},[]);R.useEffect(()=>{const ee=q=>{we(q.detail.isOpen),q.detail.isOpen&&setTimeout(()=>de(!0),50),window.DebalesChat.isOpen=q.detail.isOpen,window.DebalesChat.track(mt.OPEN_STATE_CHANGE,{isOpen:q.detail.isOpen,source:q.detail.source})};return window.addEventListener(hn.OPEN_STATE_CHANGE,ee),()=>{window.removeEventListener(hn.OPEN_STATE_CHANGE,ee)}},[]),R.useEffect(()=>{const ee=q=>{we(q.detail.isOpen),window.DebalesChat.isOpen=q.detail.isOpen,window.DebalesChat.track(mt.OPEN_STATE_CHANGE,{isOpen:q.detail.isOpen})};return window.addEventListener(hn.OPEN_STATE_CHANGE,ee),()=>{window.removeEventListener(hn.OPEN_STATE_CHANGE,ee)}},[]);const[He,N]=R.useState(()=>{const ee=qt(jt.PENDING_BULK_ITEMS,{botId:e}),q=sessionStorage.getItem(ee);return q?JSON.parse(q):[]});R.useEffect(()=>{const ee=qt(jt.PENDING_BULK_ITEMS,{botId:e});sessionStorage.setItem(ee,JSON.stringify(He))},[He,e]);const[F,Y]=R.useState(!1),[ye,_e]=R.useState({name:"",email:"",message:""}),Ie=ja("exit_model"),[We,nt]=R.useState({text:!0,leadingQueries:!0,collections:!0,products:!0,variants:!0,cartSummary:!0,bulkItems:!0}),[ne,he]=R.useState(!1),[qe,Xe]=R.useState(!0),[at,Et]=R.useState(!1),[Bt,kt]=R.useState(!1),Yt=500,ft=R.useCallback(ee=>{const q=ee.target,ge=q.scrollHeight-q.scrollTop<=q.clientHeight+0;Xe(ge)},[]);R.useEffect(()=>{var ee,q,ge,J,Re,Oe;if(c.length>0&&!d){const De=c[c.length-1],ct=sessionStorage.getItem(qt(jt.LAST_SHOWN_MESSAGE_ID,{botId:e})),Pt=De.isBot&&De.conversationId===a&&De.conversationId!==ct,Ur=(I==null?void 0:I.itemCount)&&(I==null?void 0:I.itemCount)>0&&De.conversationId===a;if(Pt){he(!0),sessionStorage.setItem(qt(jt.LAST_SHOWN_MESSAGE_ID,{botId:e}),De.conversationId||""),nt({text:!0,leadingQueries:!1,collections:!1,products:!1,variants:!1,cartSummary:!1,bulkItems:!1});const jr=1600;let Ir=jr;const mi=[{type:"collections",condition:((ee=De.collections)==null?void 0:ee.length)&&((q=De.collections)==null?void 0:q.length)>0},{type:"products",condition:((ge=De.products)==null?void 0:ge.length)&&((J=De.products)==null?void 0:J.length)>0},{type:"leadingQueries",condition:((Re=De.leading_queries)==null?void 0:Re.length)&&((Oe=De.leading_queries)==null?void 0:Oe.length)>0},{type:"cartSummary",condition:(I==null?void 0:I.itemCount)&&(I==null?void 0:I.itemCount)>0},{type:"bulkItems",condition:(He==null?void 0:He.length)>0}].filter(ma=>ma.condition);if(mi.length===0){he(!1);return}mi.forEach(({type:ma},gs)=>{setTimeout(()=>{if(nt(mr=>({...mr,[ma]:!0})),qe&&Se.current){const mr=Se.current;mr.scrollHeight-mr.scrollTop<=mr.clientHeight&&ri(Se)}gs===mi.length-1&&he(!1)},Ir),Ir+=jr})}else Ur&&nt(jr=>({...jr,cartSummary:!0}))}},[c,d,a,I==null?void 0:I.itemCount,He==null?void 0:He.length,qe,e]),R.useEffect(()=>{if(!i&&c.length>0){const ee=Se.current;ee&&qe&&ee.scrollHeight-ee.scrollTop<=ee.clientHeight+100&&setTimeout(()=>ri(Se),100)}},[c.length,i,qe]),R.useEffect(()=>{const ee=document.querySelector('meta[name="viewport"]'),q=ee==null?void 0:ee.content;if(L){let ge=ee;const J=window.matchMedia("(max-width: 768px)").matches;ge?ge.content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no":(ge=document.createElement("meta"),ge.name="viewport",ge.content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no",document.head.appendChild(ge)),J&&(t==null?void 0:t.mobileDisplayMode)==="full-screen"&&(document.body.style.overflow="hidden");const Re=ge;return()=>{q&&Re&&(Re.content=q),J&&(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="")}},[L,t==null?void 0:t.mobileDisplayMode]),R.useEffect(()=>{i||setTimeout(()=>ri(Se),100)},[c.length,i]),R.useEffect(()=>{I!=null&&I.itemCount&&I.itemCount===0&&!i&&setTimeout(()=>ri(Se),100)},[I==null?void 0:I.itemCount,i]),R.useEffect(()=>{a&&sessionStorage.setItem(qt(jt.LAST_SHOWN_MESSAGE_ID,{botId:e}),a)},[a,e]);const wt=R.useRef(Date.now()),Je=R.useRef(0),yt=R.useRef(window.location.pathname),Yn=R.useRef(S),pr=R.useRef(!1),Wn=ja("acquisition_agent");R.useEffect(()=>{Yn.current=S},[S]);const Pn=R.useCallback(async()=>{const ee=Date.now();if(ee-wt.current>=6e3&&ee-Je.current>=6e4&&!pr.current)try{pr.current=!0,console.log("fetching acquisition data");const J=await fetch(`${Zn}/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(J.ok){const Re=await J.json(),De=[...Yn.current.filter(ct=>ct.path!==yt.current),{question:Re.Popup_Message,answer:"",path:yt.current,nameSpace:e,type:"dynamic",Follow_up_Question:Re.Follow_up_Question}];x(De)}Je.current=ee}catch(J){console.error("Error fetching acquisition data:",J)}finally{pr.current=!1}},[e]);R.useEffect(()=>{if(!Wn||(t==null?void 0:t.show_bot)===!1)return;const ee=()=>{wt.current=Date.now()};document.addEventListener("mousemove",ee),document.addEventListener("mousedown",ee),document.addEventListener("keypress",ee),document.addEventListener("scroll",ee),document.addEventListener("touchstart",ee),document.addEventListener("touchmove",ee);const q=setInterval(Pn,1e3),ge=()=>{const Re=window.location.pathname.split("?")[0],Oe=yt.current.split("?")[0];(()=>{const ct=Oe.split("/").filter(Boolean),Pt=Re.split("/").filter(Boolean);return ct.length!==Pt.length?!0:ct.length===0&&Pt.length===0?!1:Re!==Oe})()&&(yt.current=Re,wt.current=Date.now())};return window.addEventListener("popstate",ge),()=>{document.removeEventListener("mousemove",ee),document.removeEventListener("mousedown",ee),document.removeEventListener("keypress",ee),document.removeEventListener("scroll",ee),document.removeEventListener("touchstart",ee),document.removeEventListener("touchmove",ee),window.removeEventListener("popstate",ge),clearInterval(q)}},[Wn,Pn,t==null?void 0:t.show_bot]);const[Fr,pi]=R.useState(!1),[oi,Ar]=R.useState(!1),[zr,ro]=R.useState(null),ai=async ee=>{const q=an();if(de(!1),ee&&c.length>1)try{(await fetch(`${Zn}/api/wordpress/userRating`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sessionId:q,userRating:ee,nameSpace:e})})).ok||console.error("Error submitting rating")}catch(ge){console.error("Error submitting rating:",ge)}setTimeout(()=>{Ar(!1),et(!1,"close_button_clicked")},1e3)},gr=ee=>{p(!0),He.forEach(ge=>{$(ge.id,ge.quantity)}),window.DebalesChat.track(mt.ADD_BULK_ITEM,{products:He,message:ee});const q=[...c,{text:"🎉 Bulk items added to cart successfully.",leading_queries:["Get GST Invoice for the order","Explore more products"],conversationId:ee,isBot:!0}];h(q),m(q),u(ee),N([]),p(!1)},Cn=()=>{var ee;switch(e){case"minature":case"bodytales":case"imemyselfcare-com":if(window.triggerGokwikCustomCheckout)return window.triggerGokwikCustomCheckout(),!0;break;case"athflex":if((ee=window.shiprocketCheckoutEvents)!=null&&ee.buyCart)return window.shiprocketCheckoutEvents.buyCart(),!0;break;case"www":if(window.openRzpCheckout)return window.openRzpCheckout(),!0;break;default:return window.location.href=B((t==null?void 0:t.shopifyShopDomain)??""),!1}return window.location.href=B((t==null?void 0:t.shopifyShopDomain)??""),!1},Jt=async ee=>{ee.preventDefault(),window.DebalesChat.track(mt.CHECKOUT_CLICKED,{chatId:an()+e,cartValue:Number(I==null?void 0:I.total),cart:I}),U({dbls_method:"checkout_clicked"}),Cn()&&et(!1,"checkout_clicked")},[Un,Kn]=R.useState([]);R.useEffect(()=>{const ee=Zg(S);Kn(q=>{const ge=ee.filter(J=>!q.some(Re=>Re.question===J.question));return[...q,...ge]})},[S]);const en=R.useMemo(()=>Un.map(ee=>({...ee,isClicked:Qe.has(ee.question)})),[Un,Qe]);console.log(Un),R.useEffect(()=>{const ee=J=>{const Re=J.detail.formId;switch(J.detail.type){case"open":case"embedOpen":setTimeout(()=>{const De=q(Re);De&&Ze(De)},800);break;case"close":tt&&(t==null?void 0:t.KlaviyoFormIntegration)===!0&&setTimeout(()=>{et(!0,"klaviyo_form_closed"),gt(Re),r(tt,void 0,void 0,!0)},1e4);break}},q=J=>{const Re=document.querySelector(`[data-testid="klaviyo-form-${J}"]`);if(console.log(`formElement text ${J} =>`,Re==null?void 0:Re.innerText,Re==null?void 0:Re.textContent),Re instanceof HTMLElement){const Oe=Re.innerText||Re.textContent;if(Oe)return console.log("Found form text:",Oe),`=> Klaviyo form content:
|
|
4854
4854
|
|
|
4855
4855
|
`+Oe+`
|
|
4856
4856
|
|
|
4857
|
-
=> User Action: Klaviyo form closed`}return""},ge=J=>{J instanceof CustomEvent&&ee(J)};return window.addEventListener("klaviyoForms",ge),()=>{window.removeEventListener("klaviyoForms",ge)}},[tt,t,r]),R.useEffect(()=>{const ee=Se.current;return ee?(ee.addEventListener("scroll",ft),()=>ee.removeEventListener("scroll",ft)):()=>{}},[ft]);const[tn,gi]=R.useState(!1),Qn=re==="Highest"?"120px":re==="Higher"?"60px":"15px",xr=async()=>{try{const ee=await fetch(`${Zn}/api/wordpress/support`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({chatid:an()+e,nameSpace:e,userName:ye.name,userEmail:ye.email,userMessage:ye.message,tag:"support"})});if(ee.ok)h(q=>[...q,{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:",Nr());else{const q=await ee.json();console.error("Failed to connect to support:",q),h(ge=>[...ge,{text:"Sorry, we couldn't connect you to support at the moment.<br>Please try again later.",isBot:!0}])}}catch{h(q=>[...q,{text:"Sorry, we couldn't connect you to support at the moment.<br>Please try again later.",isBot:!0}])}},ae=()=>{const ee=Nr();ee&&ee.name&&ee.email&&_e({name:ee==null?void 0:ee.name,email:ee==null?void 0:ee.email,message:""}),h(q=>[...q,{text:"Please provide your name, email and message to connect with support.",isBot:!0}]),Y(!0)},j=async ee=>{ee.preventDefault(),ua({name:ye.name,email:ye.email}),Y(!1),h(q=>q.slice(0,-1)),await xr()},[xe,Ne]=R.useState({});R.useEffect(()=>{Bt&&(c.forEach((ee,q)=>{if(!ee.isBot)return;const ge=ll(ee.text);if(!(q in xe)||xe[q]<ge.length){let J;const Re=Oe=>{Oe<ge.length&&(J=setTimeout(()=>{Ne(De=>({...De,[q]:Oe+1})),Re(Oe+1)},Yt))};return q in xe?Re(xe[q]):(Ne(Oe=>({...Oe,[q]:1})),Re(1)),()=>clearTimeout(J)}}),Ne(ee=>{const q={};return c.forEach((ge,J)=>{ee[J]!==void 0&&(q[J]=ee[J])}),q}))},[c,Bt]);const[pe,Ce]=R.useState(0);return R.useEffect(()=>{if(en.length===0)return;const ee=setInterval(()=>{Ce(q=>(q+1)%en.length)},7e3);return()=>clearInterval(ee)},[en.length]),R.useEffect(()=>{Ce(0)},[en.length]),!t||t.show_bot===!1||o?null:C.jsxs(Op,{theme:Vg(t),children:[C.jsx("link",{rel:"preconnect",href:"https://fonts.googleapis.com"}),C.jsx("link",{rel:"preconnect",href:"https://fonts.gstatic.com",crossOrigin:"anonymous"}),C.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"}),C.jsx(sre,{}),C.jsxs(Fne,{$topOffset:Qn,children:[!L&&!Q&&C.jsxs(zne,{$topOffset:Qn,$removeLogoBackground:t.removeLogoBackground,children:[C.jsx(Une,{$showAnimation:t.enableChatButtonBackgroundAnimation??!1,$animationType:"Ping",$animationColor:t.chatButtonBackgroundAnimationColor||"#f48722",$backgroundColor:t.backgroundColor||"#fff",$removeLogoBackground:t.removeLogoBackground,$topOffset:Qn,$iconSize:G}),C.jsxs(jne,{$backgroundColor:t.removeLogoBackground?"transparent":t.backgroundColor||"#fff",$botId:e,$iconSize:G,$removeLogoBackground:t.removeLogoBackground,topOffset:Qn,$showAnimation:t.enableChatButtonBackgroundAnimation,$animationType:"Ping",$animationColor:t.chatButtonBackgroundAnimationColor||"#f48722",id:"debales-chat-button",onClick:()=>{if(window.DebalesChat.track(mt.CHAT_BUTTON_CLICKED),et(!L,"chat_button_clicked"),!L){const ee=_();ee.length>0?(h(ee),Et(!1),kt(!0)):(Et(!0),kt(!1),setTimeout(()=>{Et(!1),kt(!0);const q={text:(t==null?void 0:t.initialMessage)||"Hi, I am an AI chatbot, how can I help you today?",isBot:!0};h([q])},(Z==null?void 0:Z.showing_delay)||2e3))}},"aria-label":"Chat",children:[C.jsx(qne,{$botId:e,$removeLogoBackground:t.removeLogoBackground,"aria-hidden":"true",src:t.bot_logo,alt:"Chat Bot Icon"}),(Un==null?void 0:Un.length)>0&&!L&&ie&&C.jsx("div",{style:{position:"absolute",top:"0",left:"100%",transform:"translate(-50%, -50%)",backgroundColor:"#f44336",color:"white",borderRadius:"50%",width:"20px",height:"20px",display:"flex",justifyContent:"center",alignItems:"center",fontSize:"12px",fontWeight:"bold",zIndex:2,opacity:ie?1:0,transition:"opacity 0.3s ease-in-out"},children:Un.length})]})]}),!L&&(en==null?void 0:en.length)!==0&&Q&&C.jsx(ore,{className:Te?"visible":"",$botId:e,$iconSize:G,$removeLogoBackground:t.removeLogoBackground,topOffset:Qn,style:{display:"flex",flexDirection:"column",alignItems:"center",marginLeft:X?"60px":"85px",marginRight:X?"60px":"85px",opacity:Te?1:0,transition:"opacity 0.3s ease-in-out"},children:en.length>0&&C.jsx(are,{$index:pe,$totalCount:en.length,children:C.jsx(Nne,{messages:[{question:en[pe].question,isHighlighted:en[pe].isHighlighted??!1}],botId:e,uiData:t,onClose:()=>{ot(ee=>{const q=new Set(ee);return q.add(en[pe].question),q})},onClick:()=>{et(!0,"suggested_question_clicked"),ot(ee=>{const q=new Set(ee);return q.add(en[pe].question),q}),window.DebalesChat.track(mt.SUGGESTED_QUESTION_CLICKED,{suggested_question:en[pe]}),E?(k(!0),A(en[pe])):r(en[pe].Follow_up_Question??en[pe].question,en[pe].answer,en[pe].products,!1,en[pe].leading_queries)}})},pe)})]}),L&&Kh.createPortal(C.jsx(C.Fragment,{children:C.jsxs(Wne,{$backgroundColor:t.backgroundColor||"#fff",$fullScreenOnMobile:t.fullScreenOnMobile,$headerFontColor:t.headerFontColor||"#1C1C1C",$topOffset:Qn,$mobileDisplayMode:t.mobileDisplayMode,$isVisible:Ue,children:[C.jsxs(Kne,{$backgroundColor:t.backgroundColor||"#fff",style:{color:t.headerFontColor},children:[C.jsxs("div",{style:{display:"flex",columnGap:"10px",flex:"1 1 0%",alignItems:"center"},children:[C.jsx(Hne,{"aria-hidden":"true",src:t.bot_logo,alt:"Chat Bot Icon"}),C.jsxs(Gne,{$botNameColor:t.headerFontColor,children:[C.jsxs("div",{style:{fontWeight:"700",wordBreak:"break-word"},children:[t.chatbotName,e==="catch-org-ai"&&C.jsx(Zne,{$backgroundColor:t.callToActionBackgroundColor,$fontColor:t.callToActionFontColor,children:"Beta"})]}),C.jsx(Vne,{children:C.jsx(hm,{})})]})]}),C.jsxs("div",{style:{display:"flex",alignItems:"center"},children:[C.jsxs(lre,{children:[C.jsxs(ure,{onClick:ae,children:[C.jsx(pm,{color:t.headerFontColor}),C.jsx(cre,{children:"Support"})]}),C.jsx(s6,{children:"Need more help? I'll connect you with a support agent."})]}),(t.mobileDisplayMode==="half-screen"||t.mobileDisplayMode==="full-screen")&&X&&C.jsx("button",{onClick:()=>{const ee=t.mobileDisplayMode==="full-screen"?"half-screen":"full-screen";v(ee)},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"?C.jsx("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:C.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"})}):C.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:C.jsx("path",{d:"M10 3.75H16.25V10H14.5833V6.595L6.595 14.5833H10V16.25H3.75V10H5.41667V13.405L13.405 5.41667H10V3.75Z",fill:"black"})})}),C.jsx(Yne,{onClick:()=>{Ie?Ar(!0):et(!1,"close_button_clicked")},id:"debales-minimize-button","aria-label":"Minimize",children:C.jsx(Fu,{botNameColor:t.headerFontColor})})]})]}),C.jsxs(Xne,{$backgroundColor:t.botBackgroundColor||"#fff",$mobileDisplayMode:t.mobileDisplayMode,children:[at&&C.jsxs(Zw,{$fontColor:t.botFontColor||"#000",$botMessageColor:t.botBackgroundColor||"#fff",children:[C.jsx("img",{src:t.bot_logo,alt:"Chat Bot Icon"}),C.jsx(Ww,{children:C.jsx(nc,{$botMessageColor:t.botMessageColor||"#fff",style:{backgroundColor:"transparent",padding:"0px"},children:C.jsx("div",{style:{display:"flex",color:t.botFontColor,alignItems:"center"},children:C.jsx(Ni,{loading:at,loadingPhrases:["🎨 Loading","✨ Almost","🚀 Ready"]})})})})]}),tn&&((bt=(ut=t.pluginConfig)==null?void 0:ut.collectedUserInfo)==null?void 0:bt.discount)&&C.jsx(mm,{discount:t.pluginConfig.collectedUserInfo.discount,uiData:t,onClose:()=>{gi(!1),window.DebalesChat.track(mt.DISCOUNT_VIEWED,{discount:t.pluginConfig.collectedUserInfo.discount})}}),C.jsx(f0,{uidata:t,product:zr,showModel:Fr,setShowModel:pi,onVariantSelect:ee=>{$(ee.id,1),window.DebalesChat.track(mt.ADD_TO_CART_CLICKED,{product:ee.title,price:Number(ee.price),link:`https://${t.shopifyShopDomain}/variants/${ee.id}`,message:a,chatId:an()+e})}}),oi&&C.jsx(ym,{setShowExitModal:Ar,handleCloseChatbot:ai,chatId:an()+e}),C.jsxs(Qne,{id:"debales-conversation-group",$botBackgroundColor:t.botBackgroundColor||"#fff",ref:Se,$mobileDisplayMode:t.mobileDisplayMode,children:[Bt&&c.map((ee,q)=>{const ge=ee.isBot,J=ll(ee.text);return ee.hideConfirmation?null:C.jsxs(R.Fragment,{children:[ge&&C.jsxs(Zw,{$fontColor:t.botFontColor||"#000",$botMessageColor:t.botBackgroundColor||"#fff",children:[C.jsx("img",{src:ge?t.bot_logo:t.userMessage_logo,alt:"Chat User Icon"}),C.jsxs(Ww,{children:[J.slice(0,xe[q]||0).map((Re,Oe)=>C.jsx("div",{children:C.jsx(nc,{$botMessageColor:ge?t.botMessageColor||"#fff":t.userMessageColor||"#fff",style:{color:t.botFontColor},children:C.jsx(Ga,{remarkPlugins:[fp,rm],children:Re})})},Oe)),ee.collections&&a===ee.conversationId&&We.collections&&C.jsx(gm,{message:ee,botId:e,uidata:t,onSendMessage:r,loading:d}),ee.products&&a===ee.conversationId&&We.products&&C.jsx(_m,{message:ee,botId:e,uidata:t,onSendMessage:r,loading:d,storeMetaData:n,platform:P,setShowVariantModel:pi,setSelectedProduct:ro,setCartVersion:je}),i&&C.jsx(Yw,{children:C.jsx(hd,{onClick:()=>{window._klOnsite&&(window._klOnsite.push(["openForm",lt]),et(!1,"klaviyo_grab_deal_button"))},children:"🚀 Grab Deal Now!"})}),c.length==1&&q==0&&!b&&C.jsx(Yw,{children:Un.map((Re,Oe)=>C.jsx(a6,{style:{backgroundColor:t.callToActionBackgroundColor,color:t.callToActionFontColor,opacity:Qe.has(Re.question)?.5:1},onClick:()=>{E?(k(!0),A({question:Re.question,answer:Re.answer,products:Re.products,path:"/",nameSpace:window.DebalesChat.projectId})):r(Re.question,Re.answer,Re.products),ot(De=>{const ct=new Set(De);return ct.add(Re.question),ct}),window.DebalesChat.track(mt.INITIAL_LEADING_QUERY_SUGGESTED_QUESTION_CLICKED,{question:Re.question})},disabled:d,$disabled:d,children:Re.question},Oe))}),ee.leading_queries&&ee.leading_queries.length>0&&a===ee.conversationId&&We.leadingQueries&&!i&&!b&&C.jsx(Yw,{children:ee.leading_queries.map((Re,Oe)=>C.jsx(a6,{style:{backgroundColor:t.callToActionBackgroundColor,color:t.callToActionFontColor},onClick:()=>{E?(k(!0),A({question:Re,path:"/",nameSpace:window.DebalesChat.projectId})):r(Re),window.DebalesChat.track(mt.LEADING_QUERY_CLICKED,{query:Re})},disabled:d,$disabled:d,children:Re},Oe))}),I&&I.itemCount>0&&a===ee.conversationId&&We.cartSummary&&C.jsxs(nre,{children:[C.jsx(nc,{$botMessageColor:t.botMessageColor,style:{width:"max-content",color:t.botFontColor},dangerouslySetInnerHTML:{__html:`<span style="display: flex; align-items: center; justify-content: center;">Total Price: ${sm((I==null?void 0:I.total)??0,(I==null?void 0:I.currency)??"USD")} </span>`}}),C.jsxs(am,{href:B(t.shopifyShopDomain??""),onClick:Jt,children:[C.jsx("span",{children:"Checkout"}),C.jsx(dm,{style:{width:"20px",fill:t.callToActionFontColor}})]})]}),He&&He.length>0&&a===ee.conversationId&&We.bulkItems&&C.jsx(om,{onClick:()=>gr(ee.conversationId),children:"Add Bulk Items to Cart"}),b&&c.indexOf(ee)===c.length-1&&C.jsx(C.Fragment,{children:C.jsx(u0,{setShowModel:Re=>{var De,ct;const Oe=typeof Re=="function"?Re(b):Re;k(Oe),!Oe&&((ct=(De=t.pluginConfig)==null?void 0:De.collectedUserInfo)!=null&&ct.discount)&&gi(!0)},inChat:!0,showFormInstructions:!1})}),F&&c.indexOf(ee)===c.length-1&&C.jsxs(fre,{onSubmit:j,children:[C.jsxs(Kw,{children:[C.jsxs(Qw,{children:["Name",C.jsx("span",{children:"*"})]}),C.jsx(l6,{type:"text",required:!0,value:ye.name,onChange:Re=>_e(Oe=>({...Oe,name:Re.target.value})),placeholder:"John"})]}),C.jsxs(Kw,{children:[C.jsxs(Qw,{children:["Email",C.jsx("span",{children:"*"})]}),C.jsx(l6,{type:"email",required:!0,value:ye.email,onChange:Re=>_e(Oe=>({...Oe,email:Re.target.value})),placeholder:"olivia@untitledui.com"})]}),C.jsxs(Kw,{children:[C.jsxs(Qw,{children:["Message",C.jsx("span",{children:"*"})]}),C.jsx(dre,{required:!0,value:ye.message,onChange:Re=>_e(Oe=>({...Oe,message:Re.target.value})),placeholder:"I need help with..."})]}),C.jsx(pre,{children:C.jsx(hre,{type:"submit",children:"Submit"})})]}),ne&&!d&&a===ee.conversationId&&C.jsx(nc,{$botMessageColor:t.botMessageColor,style:{color:t.botFontColor},children:C.jsx(Ni,{loading:ne,loadingPhrases:["🎨 Loading","✨ Almost","🚀 Ready"]})})]})]}),!ge&&C.jsx(rre,{$fontColor:t.userFontColor||"#000",$botMessageColor:t.botBackgroundColor||"#fff",children:C.jsx(nc,{$botMessageColor:ge?t.botMessageColor||"#fff":t.userMessageColor||"#fff",children:C.jsx(Ga,{children:ee.text})})})]},q)}),(d||at)&&C.jsxs(Zw,{$fontColor:t.botFontColor||"#000",$botMessageColor:t.botBackgroundColor||"#fff",children:[C.jsx("img",{src:t.bot_logo,alt:"Chat User Icon"}),C.jsx(Ww,{children:C.jsx(nc,{$botMessageColor:t.botMessageColor||"#fff",style:{backgroundColor:"transparent",padding:"0px"},children:C.jsx("div",{style:{display:"flex",alignItems:"center",gap:"4px",animation:"fadeIn 0.3s ease-in-out"},children:C.jsx(Ni,{loading:d||at})})})})]})]}),C.jsxs("div",{className:"debales-footer-container",style:{width:"calc(100%-24px)",backgroundColor:t.footerBackgroundColor||"#fff",color:t.fontColor||"#000"},children:[e==="catch-org-ai"&&C.jsx(tre,{children:C.jsx("span",{children:'"Catch org AI" can make mistakes.'})}),C.jsx("div",{children:C.jsx(d0,{disabled:d,inputState:!1})}),(t.debales_branding??!0)&&C.jsxs(Jne,{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:[C.jsx("p",{children:"Powered by"}),C.jsxs(ere,{children:[C.jsx("img",{src:`${Zn}/images/debales_logo_d.png`,alt:"Debales logo"}),C.jsx("p",{children:"DEBALES"})]})]})]})]})]})}),K.shadowRoot)]})},mre=({botId:e})=>{const t=E8("new-suggested-question-design");console.log(t);let n;return t==="variant-1"?n=Xte:t==="variant-2"?n=$ne:t==="variant-3"?n=gre:n=W4,C.jsx(n,{botId:e})},u6="debales-ai-assistant",c6="debales-chatbot-container",vre=R.forwardRef(({children:e,globalStyles:t="",containerStyles:n={},onReady:r},i)=>{const o=R.useRef(null),[a,u]=R.useState(null),c=R.useRef(null),d=R.useRef(null),p=R.useRef({get shadowRoot(){return c.current},get container(){return a},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 R.useImperativeHandle(i,()=>p.current,[]),R.useEffect(()=>{const h=document.getElementById(u6);if(h?o.current=h:o.current&&(o.current.id=u6),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(`#${c6}`);_&&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=c6,v.style.cssText="position: absolute; top: 0; left: 0; width: 0; height: 0;",m.appendChild(v),u(v),r&&r(m,v)}},[t,r]),R.useEffect(()=>(a&&!d.current&&(d.current=Ak.createRoot(a)),d.current&&a&&d.current.render(C.jsx(Nq,{target:a,children:C.jsx(Q3,{value:p.current,children:e})})),()=>{d.current&&d.current.unmount()}),[a,e]),C.jsx("div",{ref:o,style:n})});class Xw{isSupported(){return hs.detect()===this.platform}createSuccessResult(t,n){return{success:!0,data:t,message:n}}createErrorResult(t){return{success:!1,error:t}}}class yre extends Xw{constructor(){super(...arguments);Cr(this,"platform",Pr.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),pl(i.toString())}else return pl(r.link)}async addCartAttributes(n={}){return console.log("MethodNotImplemented: addCartAttributes called",{attributes:n}),this.createSuccessResult(void 0,"Cart attributes added (mock)")}}class _re extends Xw{constructor(){var n,r;super();Cr(this,"platform",Pr.SHOPIFY);Cr(this,"cartEndpoint");Cr(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=c0(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),pl(o.toString())}else return pl(r.link)}updateTrackCart({cartToken:n,sessionId:r=an()}){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:an(),dbls_method:"add_to_cart"}})}),a=await o.json();if(!o.ok){const u=a;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:an(),...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=c0(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]",an()),i.searchParams.append("timestamp",Date.now().toString()),pl(i.toString())}}class bre extends Xw{constructor(){var n,r;super();Cr(this,"platform",Pr.MAGENTO);Cr(this,"checkoutEndpoint");Cr(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 a=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(!a.ok)return this.createErrorResult(`Failed to add item to cart: ${a.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=c0(n);if(!i.isValid)return"";if(r.handle){const o=new URL(`/${r.handle}.html`,i.url);return pl(o.toString())}else return pl(r.link)}async addCartAttributes(n={}){return console.log("MethodNotImplemented: addCartAttributes called",{attributes:n}),this.createSuccessResult(void 0,"Cart attributes added (mock)")}}const gl=class gl{constructor(){Cr(this,"adapterCache");this.adapterCache=new Map}static getInstance(){return gl.instance||(gl.instance=new gl),gl.instance}getAdapter(t){const n=t||hs.detect(),r=this.adapterCache.get(n);if(r)return r;let i;switch(n){case Pr.SHOPIFY:i=new _re;break;case Pr.MAGENTO:i=new bre;break;default:console.warn(`No specific adapter found for platform ${n}, using default adapter`),i=new yre}return this.adapterCache.set(n,i),i}clearCache(){this.adapterCache.clear()}};Cr(gl,"instance");let Jw=gl;const xre=({adapter:e,children:t,autoFetch:n=!0})=>{const[r,i]=R.useState(!1),[o,a]=R.useState(null),[u,c]=R.useState(null),d=R.useCallback(async()=>{try{i(!0),a(null);const k=await e.fetchCart();k.success?c(k.data):a(k.error)}catch(k){a(k instanceof Error?k.message:"Failed to fetch cart")}finally{i(!1)}},[e]),p=async(k,E,A)=>{try{a(null);const I=await e.addToCart(k,E,A);return I.success&&await d(),I}catch(I){return{success:!1,error:I instanceof Error?I.message:"Failed to add item to cart"}}},h=async k=>{try{a(null);const E=await e.removeFromCart(k);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 k=>{try{a(null);const E=await e.updateQuantity(k);return E.success&&await d(),E}catch(E){return{success:!1,error:E instanceof Error?E.message:"Failed to update quantity"}}},v=async()=>{try{a(null);const k=await e.clearCart();return k.success&&await d(),k}catch(k){return{success:!1,error:k instanceof Error?k.message:"Failed to clear cart"}}},_=k=>e.generateCartUrl(k),S=(k,E)=>e.generateProductUrl(k,E),x=async k=>e.addCartAttributes(k);R.useEffect(()=>{n&&d()},[n,d]);const b={isLoading:r,error:o,cart:u,fetchCart:d,addToCart:p,removeFromCart:h,updateQuantity:m,clearCart:v,generateCartUrl:_,generateProductUrl:S,addCartAttributes:x};return C.jsx(M3.Provider,{value:b,children:t})},Fo=Object.create(null);Fo.open="0",Fo.close="1",Fo.ping="2",Fo.pong="3",Fo.message="4",Fo.upgrade="5",Fo.noop="6";const h0=Object.create(null);Object.keys(Fo).forEach(e=>{h0[Fo[e]]=e});const eS={type:"error",data:"parser error"},f6=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",d6=typeof ArrayBuffer=="function",h6=e=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(e):e&&e.buffer instanceof ArrayBuffer,tS=({type:e,data:t},n,r)=>f6&&t instanceof Blob?n?r(t):p6(t,r):d6&&(t instanceof ArrayBuffer||h6(t))?n?r(t):p6(new Blob([t]),r):r(Fo[e]+(t||"")),p6=(e,t)=>{const n=new FileReader;return n.onload=function(){const r=n.result.split(",")[1];t("b"+(r||""))},n.readAsDataURL(e)};function g6(e){return e instanceof Uint8Array?e:e instanceof ArrayBuffer?new Uint8Array(e):new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}let nS;function wre(e,t){if(f6&&e.data instanceof Blob)return e.data.arrayBuffer().then(g6).then(t);if(d6&&(e.data instanceof ArrayBuffer||h6(e.data)))return t(g6(e.data));tS(e,!1,n=>{nS||(nS=new TextEncoder),t(nS.encode(n))})}const m6="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Sd=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let e=0;e<m6.length;e++)Sd[m6.charCodeAt(e)]=e;const Sre=e=>{let t=e.length*.75,n=e.length,r,i=0,o,a,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=Sd[e.charCodeAt(r)],a=Sd[e.charCodeAt(r+1)],u=Sd[e.charCodeAt(r+2)],c=Sd[e.charCodeAt(r+3)],p[i++]=o<<2|a>>4,p[i++]=(a&15)<<4|u>>2,p[i++]=(u&3)<<6|c&63;return d},Cre=typeof ArrayBuffer=="function",rS=(e,t)=>{if(typeof e!="string")return{type:"message",data:v6(e,t)};const n=e.charAt(0);return n==="b"?{type:"message",data:kre(e.substring(1),t)}:h0[n]?e.length>1?{type:h0[n],data:e.substring(1)}:{type:h0[n]}:eS},kre=(e,t)=>{if(Cre){const n=Sre(e);return v6(n,t)}else return{base64:!0,data:e}},v6=(e,t)=>{switch(t){case"blob":return e instanceof Blob?e:new Blob([e]);case"arraybuffer":default:return e instanceof ArrayBuffer?e:e.buffer}},y6="",Ere=(e,t)=>{const n=e.length,r=new Array(n);let i=0;e.forEach((o,a)=>{tS(o,!1,u=>{r[a]=u,++i===n&&t(r.join(y6))})})},Are=(e,t)=>{const n=e.split(y6),r=[];for(let i=0;i<n.length;i++){const o=rS(n[i],t);if(r.push(o),o.type==="error")break}return r};function Ire(){return new TransformStream({transform(e,t){wre(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 iS;function p0(e){return e.reduce((t,n)=>t+n.length,0)}function g0(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 Tre(e,t){iS||(iS=new TextDecoder);const n=[];let r=0,i=-1,o=!1;return new TransformStream({transform(a,u){for(n.push(a);;){if(r===0){if(p0(n)<1)break;const c=g0(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(p0(n)<2)break;const c=g0(n,2);i=new DataView(c.buffer,c.byteOffset,c.length).getUint16(0),r=3}else if(r===2){if(p0(n)<8)break;const c=g0(n,8),d=new DataView(c.buffer,c.byteOffset,c.length),p=d.getUint32(0);if(p>Math.pow(2,21)-1){u.enqueue(eS);break}i=p*Math.pow(2,32)+d.getUint32(4),r=3}else{if(p0(n)<i)break;const c=g0(n,i);u.enqueue(rS(o?c:iS.decode(c),t)),r=0}if(i===0||i>e){u.enqueue(eS);break}}}})}const _6=4;function hr(e){if(e)return Mre(e)}function Mre(e){for(var t in hr.prototype)e[t]=hr.prototype[t];return e}hr.prototype.on=hr.prototype.addEventListener=function(e,t){return this._callbacks=this._callbacks||{},(this._callbacks["$"+e]=this._callbacks["$"+e]||[]).push(t),this},hr.prototype.once=function(e,t){function n(){this.off(e,n),t.apply(this,arguments)}return n.fn=t,this.on(e,n),this},hr.prototype.off=hr.prototype.removeListener=hr.prototype.removeAllListeners=hr.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},hr.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},hr.prototype.emitReserved=hr.prototype.emit,hr.prototype.listeners=function(e){return this._callbacks=this._callbacks||{},this._callbacks["$"+e]||[]},hr.prototype.hasListeners=function(e){return!!this.listeners(e).length};const m0=typeof Promise=="function"&&typeof Promise.resolve=="function"?t=>Promise.resolve().then(t):(t,n)=>n(t,0),to=typeof self<"u"?self:typeof window<"u"?window:Function("return this")(),Ore="arraybuffer";function Vae(){}function b6(e,...t){return t.reduce((n,r)=>(e.hasOwnProperty(r)&&(n[r]=e[r]),n),{})}const Rre=to.setTimeout,$re=to.clearTimeout;function v0(e,t){t.useNativeTimers?(e.setTimeoutFn=Rre.bind(to),e.clearTimeoutFn=$re.bind(to)):(e.setTimeoutFn=to.setTimeout.bind(to),e.clearTimeoutFn=to.clearTimeout.bind(to))}const Dre=1.33;function Lre(e){return typeof e=="string"?Nre(e):Math.ceil((e.byteLength||e.size)*Dre)}function Nre(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 x6(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}function Bre(e){let t="";for(let n in e)e.hasOwnProperty(n)&&(t.length&&(t+="&"),t+=encodeURIComponent(n)+"="+encodeURIComponent(e[n]));return t}function Pre(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 Fre extends Error{constructor(t,n,r){super(t),this.description=n,this.context=r,this.type="TransportError"}}class oS extends hr{constructor(t){super(),this.writable=!1,v0(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 Fre(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=rS(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=Bre(t);return n.length?"?"+n:""}}class zre extends oS{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)};Are(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,Ere(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]=x6()),!this.supportsBinary&&!n.sid&&(n.b64=1),this.createUri(t,n)}}let w6=!1;try{w6=typeof XMLHttpRequest<"u"&&"withCredentials"in new XMLHttpRequest}catch{}const Ure=w6;function jre(){}class qre extends zre{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 zo extends hr{constructor(t,n,r){super(),this.createRequest=t,v0(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=b6(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=zo.requestsCount++,zo.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=jre,t)try{this._xhr.abort()}catch{}typeof document<"u"&&delete zo.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(zo.requestsCount=0,zo.requests={},typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",S6);else if(typeof addEventListener=="function"){const e="onpagehide"in to?"pagehide":"unload";addEventListener(e,S6,!1)}}function S6(){for(let e in zo.requests)zo.requests.hasOwnProperty(e)&&zo.requests[e].abort()}const Hre=function(){const e=C6({xdomain:!1});return e&&e.responseType!==null}();class Gre extends qre{constructor(t){super(t);const n=t&&t.forceBase64;this.supportsBinary=Hre&&!n}request(t={}){return Object.assign(t,{xd:this.xd},this.opts),new zo(C6,this.uri(),t)}}function C6(e){const t=e.xdomain;try{if(typeof XMLHttpRequest<"u"&&(!t||Ure))return new XMLHttpRequest}catch{}if(!t)try{return new to[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch{}}const k6=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative";class Vre extends oS{get name(){return"websocket"}doOpen(){const t=this.uri(),n=this.opts.protocols,r=k6?{}:b6(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;tS(r,this.supportsBinary,o=>{try{this.doWrite(r,o)}catch{}i&&m0(()=>{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]=x6()),this.supportsBinary||(n.b64=1),this.createUri(t,n)}}const aS=to.WebSocket||to.MozWebSocket;class Zre extends Vre{createSocket(t,n,r){return k6?new aS(t,n,r):n?new aS(t,n):new aS(t)}doWrite(t,n){this.ws.send(n)}}class Yre extends oS{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=Tre(Number.MAX_SAFE_INTEGER,this.socket.binaryType),r=t.readable.pipeThrough(n).getReader(),i=Ire();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 a={type:"open"};this.query.sid&&(a.data=`{"sid":"${this.query.sid}"}`),this._writer.write(a).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&&m0(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var t;(t=this._transport)===null||t===void 0||t.close()}}const Wre={websocket:Zre,webtransport:Yre,polling:Gre},Kre=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,Qre=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function sS(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=Kre.exec(e||""),o={},a=14;for(;a--;)o[Qre[a]]=i[a]||"";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=Xre(o,o.path),o.queryKey=Jre(o,o.query),o}function Xre(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 Jre(e,t){const n={};return t.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(r,i,o){i&&(n[i]=o)}),n}const lS=typeof addEventListener=="function"&&typeof removeEventListener=="function",y0=[];lS&&addEventListener("offline",()=>{y0.forEach(e=>e())},!1);class ps extends hr{constructor(t,n){if(super(),this.binaryType=Ore,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=sS(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=sS(n.host).host);v0(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=Pre(this.opts.query)),lS&&(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"})},y0.push(this._offlineEventListener))),this.opts.withCredentials&&(this._cookieJar=void 0),this._open()}createTransport(t){const n=Object.assign({},this.opts.query);n.EIO=_6,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&&ps.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",ps.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+=Lre(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,m0(()=>{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(ps.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(),lS&&(this._beforeunloadEventListener&&removeEventListener("beforeunload",this._beforeunloadEventListener,!1),this._offlineEventListener)){const r=y0.indexOf(this._offlineEventListener);r!==-1&&y0.splice(r,1)}this.readyState="closed",this.id=null,this.emitReserved("close",t,n),this.writeBuffer=[],this._prevBufferLen=0}}}ps.protocol=_6;class eie extends ps{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;ps.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;ps.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 a=h=>{const m=new Error("probe error: "+h);m.transport=n.name,o(),this.emitReserved("upgradeError",m)};function u(){a("transport closed")}function c(){a("socket closed")}function d(h){n&&h.name!==n.name&&o()}const p=()=>{n.removeListener("open",i),n.removeListener("error",a),n.removeListener("close",u),this.off("close",c),this.off("upgrading",d)};n.once("open",i),n.once("error",a),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 tie=class extends eie{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=>Wre[i]).filter(i=>!!i)),super(t,r)}};function nie(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=sS(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 rie=typeof ArrayBuffer=="function",iie=e=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(e):e.buffer instanceof ArrayBuffer,E6=Object.prototype.toString,oie=typeof Blob=="function"||typeof Blob<"u"&&E6.call(Blob)==="[object BlobConstructor]",aie=typeof File=="function"||typeof File<"u"&&E6.call(File)==="[object FileConstructor]";function uS(e){return rie&&(e instanceof ArrayBuffer||iie(e))||oie&&e instanceof Blob||aie&&e instanceof File}function _0(e,t){if(!e||typeof e!="object")return!1;if(Array.isArray(e)){for(let n=0,r=e.length;n<r;n++)if(_0(e[n]))return!0;return!1}if(uS(e))return!0;if(e.toJSON&&typeof e.toJSON=="function"&&arguments.length===1)return _0(e.toJSON(),!0);for(const n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&_0(e[n]))return!0;return!1}function sie(e){const t=[],n=e.data,r=e;return r.data=cS(n,t),r.attachments=t.length,{packet:r,buffers:t}}function cS(e,t){if(!e)return e;if(uS(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]=cS(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]=cS(e[r],t));return n}return e}function lie(e,t){return e.data=fS(e.data,t),delete e.attachments,e}function fS(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]=fS(e[n],t);else if(typeof e=="object")for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&(e[n]=fS(e[n],t));return e}const uie=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"],cie=5;var Kt;(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"})(Kt||(Kt={}));class fie{constructor(t){this.replacer=t}encode(t){return(t.type===Kt.EVENT||t.type===Kt.ACK)&&_0(t)?this.encodeAsBinary({type:t.type===Kt.EVENT?Kt.BINARY_EVENT:Kt.BINARY_ACK,nsp:t.nsp,data:t.data,id:t.id}):[this.encodeAsString(t)]}encodeAsString(t){let n=""+t.type;return(t.type===Kt.BINARY_EVENT||t.type===Kt.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=sie(t),r=this.encodeAsString(n.packet),i=n.buffers;return i.unshift(r),i}}function A6(e){return Object.prototype.toString.call(e)==="[object Object]"}class dS extends hr{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===Kt.BINARY_EVENT;r||n.type===Kt.BINARY_ACK?(n.type=r?Kt.EVENT:Kt.ACK,this.reconstructor=new die(n),n.attachments===0&&super.emitReserved("decoded",n)):super.emitReserved("decoded",n)}else if(uS(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(Kt[r.type]===void 0)throw new Error("unknown packet type "+r.type);if(r.type===Kt.BINARY_EVENT||r.type===Kt.BINARY_ACK){const o=n+1;for(;t.charAt(++n)!=="-"&&n!=t.length;);const a=t.substring(o,n);if(a!=Number(a)||t.charAt(n)!=="-")throw new Error("Illegal attachments");r.attachments=Number(a)}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 a=t.charAt(n);if(a==null||Number(a)!=a){--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(dS.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 Kt.CONNECT:return A6(n);case Kt.DISCONNECT:return n===void 0;case Kt.CONNECT_ERROR:return typeof n=="string"||A6(n);case Kt.EVENT:case Kt.BINARY_EVENT:return Array.isArray(n)&&(typeof n[0]=="number"||typeof n[0]=="string"&&uie.indexOf(n[0])===-1);case Kt.ACK:case Kt.BINARY_ACK:return Array.isArray(n)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}}class die{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=lie(this.reconPack,this.buffers);return this.finishedReconstruction(),n}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}const hie=Object.freeze(Object.defineProperty({__proto__:null,Decoder:dS,Encoder:fie,get PacketType(){return Kt},protocol:cie},Symbol.toStringTag,{value:"Module"}));function wo(e,t,n){return e.on(t,n),function(){e.off(t,n)}}const pie=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class I6 extends hr{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=[wo(t,"open",this.onopen.bind(this)),wo(t,"packet",this.onpacket.bind(this)),wo(t,"error",this.onerror.bind(this)),wo(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(pie.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 a={type:Kt.EVENT,data:n};if(a.options={},a.options.compress=this.flags.compress!==!1,typeof n[n.length-1]=="function"){const p=this.ids++,h=n.pop();this._registerAckCallback(p,h),a.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(a),this.packet(a)):this.sendBuffer.push(a)),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),a=(...u)=>{this.io.clearTimeoutFn(o),n.apply(this,u)};a.withError=!0,this.acks[t]=a}emitWithAck(t,...n){return new Promise((r,i)=>{const o=(a,u)=>a?i(a):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:Kt.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 Kt.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 Kt.EVENT:case Kt.BINARY_EVENT:this.onevent(t);break;case Kt.ACK:case Kt.BINARY_ACK:this.onack(t);break;case Kt.DISCONNECT:this.ondisconnect();break;case Kt.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:Kt.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:Kt.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 rc(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}rc.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},rc.prototype.reset=function(){this.attempts=0},rc.prototype.setMin=function(e){this.ms=e},rc.prototype.setMax=function(e){this.max=e},rc.prototype.setJitter=function(e){this.jitter=e};class hS extends hr{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,v0(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 rc({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||hie;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 tie(this.uri,this.opts);const n=this.engine,r=this;this._readyState="opening",this.skipReconnect=!1;const i=wo(n,"open",function(){r.onopen(),t&&t()}),o=u=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",u),t?t(u):this.maybeReconnectOnOpen()},a=wo(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(a),this}connect(t){return this.open(t)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");const t=this.engine;this.subs.push(wo(t,"ping",this.onping.bind(this)),wo(t,"data",this.ondata.bind(this)),wo(t,"error",this.onerror.bind(this)),wo(t,"close",this.onclose.bind(this)),wo(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){m0(()=>{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 I6(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 Cd={};function b0(e,t){typeof e=="object"&&(t=e,e=void 0),t=t||{};const n=nie(e,t.path||"/socket.io"),r=n.source,i=n.id,o=n.path,a=Cd[i]&&o in Cd[i].nsps,u=t.forceNew||t["force new connection"]||t.multiplex===!1||a;let c;return u?c=new hS(r,t):(Cd[i]||(Cd[i]=new hS(r,t)),c=Cd[i]),n.query&&!t.query&&(t.query=n.queryKey),c.socket(n.path,t)}Object.assign(b0,{Manager:hS,Socket:I6,io:b0,connect:b0});const ml=class ml{constructor(){Cr(this,"socket",null);Cr(this,"isConnected",!1);Cr(this,"eventListeners",new Map)}static getInstance(){return ml.instance||(ml.instance=new ml),ml.instance}connect(t){return this.socket?this.socket:(this.socket=b0(`${hK}${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))}};Cr(ml,"instance");let pS=ml;const Uo=pS.getInstance();var gie={MESSAGE:"MESSAGE"},mie={USER:"USER"};function x0(e,t){window.dispatchEvent(new StorageEvent("storage",{key:e,newValue:t}))}const T6=(e,t)=>{const n=JSON.stringify(t);window.localStorage.setItem(e,n),x0(e,n)},vie=e=>{window.localStorage.removeItem(e),x0(e,null)},M6=e=>window.localStorage.getItem(e),yie=e=>(window.addEventListener("storage",e),()=>window.removeEventListener("storage",e)),_ie=()=>{throw Error("useLocalStorage is a client-only hook")};function bie(e,t){const n=()=>M6(e),r=R.useSyncExternalStore(yie,n,_ie),i=R.useCallback(o=>{try{const a=typeof o=="function"?o(JSON.parse(r)):o;a==null?vie(e):T6(e,a)}catch(a){console.warn(a)}},[e,r]);return R.useEffect(()=>{M6(e)===null&&T6(e,t)},[e,t]),[r?JSON.parse(r):t,i]}const O6=(e,t)=>{const n=JSON.stringify(t);window.sessionStorage.setItem(e,n),x0(e,n)},xie=e=>{window.sessionStorage.removeItem(e),x0(e,null)},R6=e=>window.sessionStorage.getItem(e),wie=e=>(window.addEventListener("storage",e),()=>window.removeEventListener("storage",e)),Sie=()=>{throw Error("useSessionStorage is a client-only hook")};function Cie(e,t){const n=()=>R6(e),r=R.useSyncExternalStore(wie,n,Sie),i=R.useCallback(o=>{try{const a=typeof o=="function"?o(JSON.parse(r)):o;a==null?xie(e):O6(e,a)}catch(a){console.warn(a)}},[e,r]);return R.useEffect(()=>{R6(e)===null&&O6(e,t)},[e,t]),[r?JSON.parse(r):t,i]}const kie=({children:e,nameSpace:t})=>{const[n,r]=R.useState(""),[i,o]=R.useState([]),[a,u]=R.useState(!1),[c,d]=R.useState(!1),[p,h]=R.useState([]),[m,v]=R.useState(!1),[_,S]=R.useState(!1),[x,b]=R.useState([]),[k,E]=bie(qt(jt.USER_INFO),null),[A,I]=Cie(qt(jt.IS_FORM_CLOSED_BY_USER),!1),[$,B]=er.useState(null),U=ja("web-socket"),[G,P]=er.useState([]),[K,re]=R.useState(null),[ue,Z]=R.useState(!1),[ie,V]=R.useState(sessionStorage.getItem(qt(jt.LAST_SHOWN_MESSAGE_ID,{botId:t}))),Q=yK(),ve=an(),[Te,T]=er.useState(null),[X,me]=R.useState(null);R.useEffect(()=>{if(U){const je=Uo.connect("/api/v1/chat");re(je);const Se=()=>{console.debug("connected to websocket"),Z(!0)},Ye=()=>{console.debug("disconnected from websocket"),Z(!1)},Qe=et=>{console.debug("response from websocket",et);const He=et.conversationId??crypto.randomUUID().toString();V(He),et.Variants_quantity&&b(F=>[...F,...et.Variants_quantity]);const N=[...i,{text:et.response,products:et.products,conversationId:He,rating:"neutral",leading_queries:et.leading_queries,collections:et.collections,variants:et.variants,shop:et.shop,Variants_quantity:et.Variants_quantity,monthlyChatLimitReached:et.monthlyChatLimitReached,isBot:!0}];o(N),L(N),h(F=>[...F,[i[i.length-1].text,et.response]]),d(!1)},ot=et=>{if(et.event==="error"){const He={text:"I am facing some network issues. Can you please check your network and try again?",isBot:!0},N=[...i,He];o(N),L(N),d(!1)}};return Uo.on("connect",Se),Uo.on("disconnect",Ye),Uo.on("response",Qe),Uo.on("system",ot),()=>{Uo.off("connect",Se),Uo.off("disconnect",Ye),Uo.off("response",Qe),Uo.off("system",ot)}}},[U,i]);const L=je=>{sessionStorage.setItem(qt(jt.CHAT_HISTORY,{botId:window.DebalesChat.projectId}),JSON.stringify(je))},we=()=>{const je=sessionStorage.getItem(qt(jt.CHAT_HISTORY,{botId:window.DebalesChat.projectId}));return je?JSON.parse(je):[]},Ue=R.useCallback(async()=>{if(t)try{u(!0);const je=await fetch(`${Zn}/api/wordpress/UiData?value=${t}`),Se=await je.json();if(!je.ok)throw new Error("failed to fetch data"+Se.error);const Ye=document.getElementById("debales-ai-assistant");Ye&&(Ye.style.zIndex=String(Se.zIndex??2031483602)),me(Se),Se!=null&&Se.shopifyShopDomain&&NK(Se.shopifyShopDomain).then(ot=>{T(ot)}),P(Se.suggestedQuestions);const Qe=we();if(Qe.length>0)o(Qe);else{const ot={text:Se.initialMessage||"Hi, I am an AI Assistant. How can I help you?",isBot:!0};o([ot])}}catch(je){console.error(je)}finally{u(!1)}},[t]);R.useEffect(()=>{Ue()},[Ue]);const de=R.useMemo(()=>{var je;return!!(!A&&((je=X==null?void 0:X.pluginConfig)!=null&&je.collectedUserInfo)&&(X.pluginConfig.collectedUserInfo.name||X.pluginConfig.collectedUserInfo.email||X.pluginConfig.collectedUserInfo.phone)&&!k)},[X,k,A]),tt=R.useCallback(async(je,Se,Ye,Qe,ot,et)=>{if(!je||je.trim()===""||c&&!Ye)return;let He=[...i];Qe?Qe&&i.length<=2?(v(!0),He=[]):v(!1):(He.push({text:je,isBot:!1}),v(!1));const N=an();d(!0);try{o(He),L(He);const F=await fetch(`${Zn}/api/wordpress/ChatWithBot`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sessionId:N,userMessage:je,nameSpace:t,chat_history:p,leading_queries:ot,answer:Se,products:Ye,userInfo:JSON.stringify(k),anonymousUserId:Q,distinctId:Po.getDistinctId(),timestamp:new Date().toISOString(),timeZone:Intl.DateTimeFormat().resolvedOptions().timeZone,followUpQuestion:et})});if(!F.ok)throw new Error("Network response was not ok");const Y=await F.json(),ye=Y.conversationId??crypto.randomUUID().toString();V(ye),Y.Variants_quantity&&b(Ie=>[...Ie,...Y.Variants_quantity]);const _e=[...He,{text:Y.response,products:Y.products,conversationId:ye,rating:"neutral",leading_queries:Y.leading_queries,collections:Y.collections,variants:Y.variants,shop:Y.shop,Variants_quantity:Y.Variants_quantity,monthlyChatLimitReached:Y.monthlyChatLimitReached,isBot:!0}];o(_e),L(_e),h(Ie=>[...Ie,[je,Y.response]])}catch(F){console.error(F);const Y={text:"I am facing some network issues. Can you please check your network and try again?",isBot:!0},ye=[...He,Y];Qe||(o(ye),L(ye))}finally{d(!1)}},[i,c,p,t,Q,k]),Ze=R.useCallback(je=>{X&&me(Se=>Se?{...Se,mobileDisplayMode:je}:null)},[X]),lt=R.useCallback(async(je,Se,Ye,Qe,ot,et)=>{if(!je||je.trim()===""||c&&!Ye)return;let He=[...i];if(Qe?Qe&&i.length<=2?(v(!0),He=[]):v(!1):(He.push({text:je,isBot:!1}),v(!1)),d(!0),o(He),L(He),K&&ue){const N={type:gie.MESSAGE,role:mie.USER,query:je,nameSpace:t,leadingQueries:ot,answer:Se,products:Ye,userInfo:k,timeZone:Intl.DateTimeFormat().resolvedOptions().timeZone,timestamp:new Date().toISOString(),sessionId:ve,anonymousUserId:Q,distinctId:Po.getDistinctId(),followUpQuestion:et};Uo.emit("chat",N)}else tt(je,Se,Ye,Qe,ot,et)},[i,c,t,Q,K,ue,ve,tt,k]),gt={sessionId:ve,messages:i,isLoading:a,isMessageLoading:c,isKlaviyoMessage:m,showUserInfoModel:_,pendingBulkItems:x,lastedBotmessageId:ie,uiData:X,storeMetaData:Te,suggestedQuestions:G,isUserInfoNeeded:de,input:n,pendingQuestion:$,userInfo:k,isFormClosedByUser:A,onSendMessage:U?lt:tt,setMessages:o,setIsLoading:u,setIsMessageLoading:d,setIsKlaviyoMessage:v,setShowUserInfoModel:S,setPendingBulkItems:b,setLastedBotmessageId:V,fetchUiInfo:Ue,changeDisplayModel:Ze,saveConversation:L,loadConversation:we,setSuggestedQuestions:P,setUserInfo:E,setInput:r,setPendingQuestion:B,setIsFormClosedByUser:I};return C.jsx(X3.Provider,{value:gt,children:e})};function Eie(e){const t=Jw.getInstance().getAdapter();return C.jsx(kie,{nameSpace:e.botId,children:C.jsx(k8,{apiKey:pK,options:{capture_pageview:e.botId!=="burgerbaeclothing",capture_pageleave:e.botId!=="burgerbaeclothing",api_host:Zn+"/ingest",ui_host:"https://us.posthog.com",loaded:n=>{n.register({platform:hs.detect(),project:e.botId,sessionId:an()}),n.group("project",e.botId,{platform:hs.detect()});const r=Nr();r&&r.email&&!n._isIdentified()&&n.identify(r.email,{name:r.name,phone:r.phone,email:r.email,project:e.botId})},debug:!0},children:C.jsx(xre,{adapter:t,children:e.children})})})}function Aie(e){return C.jsx(vre,{children:C.jsx(Eie,{botId:e.botId,children:C.jsx(mre,{...e})})})}const ga=new Map;function w0(e){const{botId:t}=e;if(ga.has(t))return console.warn(`Chatbot with botId "${t}" is already initialized. Skipping duplicate initialization.`),ga.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=Ak.createRoot(r);i.render(er.createElement(Aie,{botId:e.botId}));const o={container:r,unmount:()=>{if(i.unmount(),ga.delete(t),r&&r.parentNode&&document.body.contains(r))try{r.parentNode.removeChild(r)}catch(a){console.warn("Error removing chatbot container:",a)}}};return ga.set(t,o),o}typeof window<"u"&&(window.DebalesChatbotBrowser={init:w0,destroy:e=>{const t=ga.get(e);return t?(t.unmount(),!0):!1},isInitialized:e=>ga.has(e),getInitializedBots:()=>Array.from(ga.keys())});function $6(){document.querySelectorAll('[id="debales-ai-assistant"][data-bot-id]').forEach(n=>{const r=n.getAttribute("data-bot-id");r&&!ga.has(r)&&w0({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&&!ga.has(r)&&w0({botId:r})})}return typeof document<"u"&&(document.readyState==="loading"?document.addEventListener("DOMContentLoaded",$6):$6()),Zo.initDebalesChatbot=w0,Object.defineProperty(Zo,Symbol.toStringTag,{value:"Module"}),Zo}({});
|
|
4857
|
+
=> User Action: Klaviyo form closed`}return""},ge=J=>{J instanceof CustomEvent&&ee(J)};return window.addEventListener("klaviyoForms",ge),()=>{window.removeEventListener("klaviyoForms",ge)}},[tt,t,r]),R.useEffect(()=>{const ee=Se.current;return ee?(ee.addEventListener("scroll",ft),()=>ee.removeEventListener("scroll",ft)):()=>{}},[ft]);const[tn,gi]=R.useState(!1),Qn=re==="Highest"?"120px":re==="Higher"?"60px":"15px",xr=async()=>{try{const ee=await fetch(`${Zn}/api/wordpress/support`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({chatid:an()+e,nameSpace:e,userName:ye.name,userEmail:ye.email,userMessage:ye.message,tag:"support"})});if(ee.ok)h(q=>[...q,{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:",Nr());else{const q=await ee.json();console.error("Failed to connect to support:",q),h(ge=>[...ge,{text:"Sorry, we couldn't connect you to support at the moment.<br>Please try again later.",isBot:!0}])}}catch{h(q=>[...q,{text:"Sorry, we couldn't connect you to support at the moment.<br>Please try again later.",isBot:!0}])}},ae=()=>{const ee=Nr();ee&&ee.name&&ee.email&&_e({name:ee==null?void 0:ee.name,email:ee==null?void 0:ee.email,message:""}),h(q=>[...q,{text:"Please provide your name, email and message to connect with support.",isBot:!0}]),Y(!0)},j=async ee=>{ee.preventDefault(),ua({name:ye.name,email:ye.email}),Y(!1),h(q=>q.slice(0,-1)),await xr()},[xe,Ne]=R.useState({});R.useEffect(()=>{Bt&&(c.forEach((ee,q)=>{if(!ee.isBot)return;const ge=ll(ee.text);if(!(q in xe)||xe[q]<ge.length){let J;const Re=Oe=>{Oe<ge.length&&(J=setTimeout(()=>{Ne(De=>({...De,[q]:Oe+1})),Re(Oe+1)},Yt))};return q in xe?Re(xe[q]):(Ne(Oe=>({...Oe,[q]:1})),Re(1)),()=>clearTimeout(J)}}),Ne(ee=>{const q={};return c.forEach((ge,J)=>{ee[J]!==void 0&&(q[J]=ee[J])}),q}))},[c,Bt]);const[pe,Ce]=R.useState(0);return R.useEffect(()=>{if(en.length===0)return;const ee=setInterval(()=>{Ce(q=>(q+1)%en.length)},7e3);return()=>clearInterval(ee)},[en.length]),R.useEffect(()=>{Ce(0)},[en.length]),!t||t.show_bot===!1||o?null:C.jsxs(Op,{theme:Vg(t),children:[C.jsx("link",{rel:"preconnect",href:"https://fonts.googleapis.com"}),C.jsx("link",{rel:"preconnect",href:"https://fonts.gstatic.com",crossOrigin:"anonymous"}),C.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"}),C.jsx(sre,{}),C.jsxs(Fne,{$topOffset:Qn,children:[!L&&!Q&&C.jsxs(zne,{$topOffset:Qn,$removeLogoBackground:t.removeLogoBackground,children:[C.jsx(Une,{$showAnimation:t.enableChatButtonBackgroundAnimation??!1,$animationType:"Ping",$animationColor:t.chatButtonBackgroundAnimationColor||"#f48722",$backgroundColor:t.backgroundColor||"#fff",$removeLogoBackground:t.removeLogoBackground,$topOffset:Qn,$iconSize:G}),C.jsxs(jne,{$backgroundColor:t.removeLogoBackground?"transparent":t.backgroundColor||"#fff",$botId:e,$iconSize:G,$removeLogoBackground:t.removeLogoBackground,topOffset:Qn,$showAnimation:t.enableChatButtonBackgroundAnimation,$animationType:"Ping",$animationColor:t.chatButtonBackgroundAnimationColor||"#f48722",id:"debales-chat-button",onClick:()=>{if(window.DebalesChat.track(mt.CHAT_BUTTON_CLICKED),et(!L,"chat_button_clicked"),!L){const ee=_();ee.length>0?(h(ee),Et(!1),kt(!0)):(Et(!0),kt(!1),setTimeout(()=>{Et(!1),kt(!0);const q={text:(t==null?void 0:t.initialMessage)||"Hi, I am an AI chatbot, how can I help you today?",isBot:!0};h([q])},(Z==null?void 0:Z.showing_delay)||2e3))}},"aria-label":"Chat",children:[C.jsx(qne,{$botId:e,$removeLogoBackground:t.removeLogoBackground,"aria-hidden":"true",src:t.bot_logo,alt:"Chat Bot Icon"}),(Un==null?void 0:Un.length)>0&&!L&&ie&&C.jsx("div",{style:{position:"absolute",top:"0",left:"100%",transform:"translate(-50%, -50%)",backgroundColor:"#f44336",color:"white",borderRadius:"50%",width:"20px",height:"20px",display:"flex",justifyContent:"center",alignItems:"center",fontSize:"12px",fontWeight:"bold",zIndex:2,opacity:ie?1:0,transition:"opacity 0.3s ease-in-out"},children:Un.length})]})]}),!L&&(en==null?void 0:en.length)!==0&&Q&&C.jsx(ore,{className:Te?"visible":"",$botId:e,$iconSize:G,$removeLogoBackground:t.removeLogoBackground,topOffset:Qn,style:{display:"flex",flexDirection:"column",alignItems:"center",marginLeft:X?"60px":"85px",marginRight:X?"60px":"85px",opacity:Te?1:0,transition:"opacity 0.3s ease-in-out"},children:en.length>0&&C.jsx(are,{$index:pe,$totalCount:en.length,children:C.jsx(Nne,{messages:[{question:en[pe].question,isHighlighted:en[pe].isHighlighted??!1}],botId:e,uiData:t,onClose:()=>{ot(ee=>{const q=new Set(ee);return q.add(en[pe].question),q})},onClick:()=>{et(!0,"suggested_question_clicked"),ot(ee=>{const q=new Set(ee);return q.add(en[pe].question),q}),window.DebalesChat.track(mt.SUGGESTED_QUESTION_CLICKED,{suggested_question:en[pe]}),E?(k(!0),A(en[pe])):r(en[pe].Follow_up_Question??en[pe].question,en[pe].answer,en[pe].products,!1,en[pe].leading_queries)}})},pe)})]}),L&&Kh.createPortal(C.jsx(C.Fragment,{children:C.jsxs(Wne,{$backgroundColor:t.backgroundColor||"#fff",$fullScreenOnMobile:t.fullScreenOnMobile,$headerFontColor:t.headerFontColor||"#1C1C1C",$topOffset:Qn,$mobileDisplayMode:t.mobileDisplayMode,$isVisible:Ue,children:[C.jsxs(Kne,{$backgroundColor:t.backgroundColor||"#fff",style:{color:t.headerFontColor},children:[C.jsxs("div",{style:{display:"flex",columnGap:"10px",flex:"1 1 0%",alignItems:"center"},children:[C.jsx(Hne,{"aria-hidden":"true",src:t.bot_logo,alt:"Chat Bot Icon"}),C.jsxs(Gne,{$botNameColor:t.headerFontColor,children:[C.jsxs("div",{style:{fontWeight:"700",wordBreak:"break-word"},children:[t.chatbotName,e==="catch-org-ai"&&C.jsx(Zne,{$backgroundColor:t.callToActionBackgroundColor,$fontColor:t.callToActionFontColor,children:"Beta"})]}),C.jsx(Vne,{children:C.jsx(hm,{})})]})]}),C.jsxs("div",{style:{display:"flex",alignItems:"center"},children:[C.jsxs(lre,{children:[C.jsxs(ure,{onClick:ae,children:[C.jsx(pm,{color:t.headerFontColor}),C.jsx(cre,{children:"Support"})]}),C.jsx(s6,{children:"Need more help? I'll connect you with a support agent."})]}),(t.mobileDisplayMode==="half-screen"||t.mobileDisplayMode==="full-screen")&&X&&C.jsx("button",{onClick:()=>{const ee=t.mobileDisplayMode==="full-screen"?"half-screen":"full-screen";v(ee)},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"?C.jsx("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:C.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"})}):C.jsx("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:C.jsx("path",{d:"M10 3.75H16.25V10H14.5833V6.595L6.595 14.5833H10V16.25H3.75V10H5.41667V13.405L13.405 5.41667H10V3.75Z",fill:"black"})})}),C.jsx(Yne,{onClick:()=>{Ie?Ar(!0):et(!1,"close_button_clicked")},id:"debales-minimize-button","aria-label":"Minimize",children:C.jsx(Fu,{botNameColor:t.headerFontColor})})]})]}),C.jsxs(Xne,{$backgroundColor:t.botBackgroundColor||"#fff",$mobileDisplayMode:t.mobileDisplayMode,children:[at&&C.jsxs(Zw,{$fontColor:t.botFontColor||"#000",$botMessageColor:t.botBackgroundColor||"#fff",children:[C.jsx("img",{src:t.bot_logo,alt:"Chat Bot Icon"}),C.jsx(Ww,{children:C.jsx(nc,{$botMessageColor:t.botMessageColor||"#fff",style:{backgroundColor:"transparent",padding:"0px"},children:C.jsx("div",{style:{display:"flex",color:t.botFontColor,alignItems:"center"},children:C.jsx(Ni,{loading:at,loadingPhrases:["🎨 Loading","✨ Almost","🚀 Ready"]})})})})]}),tn&&((bt=(ut=t.pluginConfig)==null?void 0:ut.collectedUserInfo)==null?void 0:bt.discount)&&C.jsx(mm,{discount:t.pluginConfig.collectedUserInfo.discount,uiData:t,onClose:()=>{gi(!1),window.DebalesChat.track(mt.DISCOUNT_VIEWED,{discount:t.pluginConfig.collectedUserInfo.discount})}}),C.jsx(f0,{uidata:t,product:zr,showModel:Fr,setShowModel:pi,onVariantSelect:ee=>{$(ee.id,1),window.DebalesChat.track(mt.ADD_TO_CART_CLICKED,{product:ee.title,price:Number(ee.price),link:`https://${t.shopifyShopDomain}/variants/${ee.id}`,message:a,chatId:an()+e})}}),oi&&C.jsx(ym,{setShowExitModal:Ar,handleCloseChatbot:ai,chatId:an()+e}),C.jsxs(Qne,{id:"debales-conversation-group",$botBackgroundColor:t.botBackgroundColor||"#fff",ref:Se,$mobileDisplayMode:t.mobileDisplayMode,children:[Bt&&c.map((ee,q)=>{const ge=ee.isBot,J=ll(ee.text);return ee.hideConfirmation?null:C.jsxs(R.Fragment,{children:[ge&&C.jsxs(Zw,{$fontColor:t.botFontColor||"#000",$botMessageColor:t.botBackgroundColor||"#fff",children:[C.jsx("img",{src:ge?t.bot_logo:t.userMessage_logo,alt:"Chat User Icon"}),C.jsxs(Ww,{children:[J.slice(0,xe[q]||0).map((Re,Oe)=>C.jsx("div",{children:C.jsx(nc,{$botMessageColor:ge?t.botMessageColor||"#fff":t.userMessageColor||"#fff",style:{color:t.botFontColor},children:C.jsx(Ga,{remarkPlugins:[fp,rm],children:Re})})},Oe)),ee.collections&&a===ee.conversationId&&We.collections&&C.jsx(gm,{message:ee,botId:e,uidata:t,onSendMessage:r,loading:d}),ee.products&&a===ee.conversationId&&We.products&&C.jsx(_m,{message:ee,botId:e,uidata:t,onSendMessage:r,loading:d,storeMetaData:n,platform:P,setShowVariantModel:pi,setSelectedProduct:ro,setCartVersion:je}),i&&C.jsx(Yw,{children:C.jsx(hd,{onClick:()=>{window._klOnsite&&(window._klOnsite.push(["openForm",lt]),et(!1,"klaviyo_grab_deal_button"))},children:"🚀 Grab Deal Now!"})}),c.length==1&&q==0&&!b&&C.jsx(Yw,{children:Un.map((Re,Oe)=>C.jsx(a6,{style:{backgroundColor:t.callToActionBackgroundColor,color:t.callToActionFontColor,opacity:Qe.has(Re.question)?.5:1},onClick:()=>{E?(k(!0),A({question:Re.question,answer:Re.answer,products:Re.products,path:"/",nameSpace:window.DebalesChat.projectId})):r(Re.question,Re.answer,Re.products),ot(De=>{const ct=new Set(De);return ct.add(Re.question),ct}),window.DebalesChat.track(mt.INITIAL_LEADING_QUERY_SUGGESTED_QUESTION_CLICKED,{question:Re.question})},disabled:d,$disabled:d,children:Re.question},Oe))}),ee.leading_queries&&ee.leading_queries.length>0&&a===ee.conversationId&&We.leadingQueries&&!i&&!b&&C.jsx(Yw,{children:ee.leading_queries.map((Re,Oe)=>C.jsx(a6,{style:{backgroundColor:t.callToActionBackgroundColor,color:t.callToActionFontColor},onClick:()=>{E?(k(!0),A({question:Re,path:"/",nameSpace:window.DebalesChat.projectId})):r(Re),window.DebalesChat.track(mt.LEADING_QUERY_CLICKED,{query:Re})},disabled:d,$disabled:d,children:Re},Oe))}),I&&I.itemCount>0&&a===ee.conversationId&&We.cartSummary&&C.jsxs(nre,{children:[C.jsx(nc,{$botMessageColor:t.botMessageColor,style:{width:"max-content",color:t.botFontColor},dangerouslySetInnerHTML:{__html:`<span style="display: flex; align-items: center; justify-content: center;">Total Price: ${sm((I==null?void 0:I.total)??0,(I==null?void 0:I.currency)??"USD")} </span>`}}),C.jsxs(am,{href:B(t.shopifyShopDomain??""),onClick:Jt,children:[C.jsx("span",{children:"Checkout"}),C.jsx(dm,{style:{width:"20px",fill:t.callToActionFontColor}})]})]}),He&&He.length>0&&a===ee.conversationId&&We.bulkItems&&C.jsx(om,{onClick:()=>gr(ee.conversationId),children:"Add Bulk Items to Cart"}),b&&c.indexOf(ee)===c.length-1&&C.jsx(C.Fragment,{children:C.jsx(u0,{setShowModel:Re=>{var De,ct;const Oe=typeof Re=="function"?Re(b):Re;k(Oe),!Oe&&((ct=(De=t.pluginConfig)==null?void 0:De.collectedUserInfo)!=null&&ct.discount)&&gi(!0)},inChat:!0,showFormInstructions:!1})}),F&&c.indexOf(ee)===c.length-1&&C.jsxs(fre,{onSubmit:j,children:[C.jsxs(Kw,{children:[C.jsxs(Qw,{children:["Name",C.jsx("span",{children:"*"})]}),C.jsx(l6,{type:"text",required:!0,value:ye.name,onChange:Re=>_e(Oe=>({...Oe,name:Re.target.value})),placeholder:"John"})]}),C.jsxs(Kw,{children:[C.jsxs(Qw,{children:["Email",C.jsx("span",{children:"*"})]}),C.jsx(l6,{type:"email",required:!0,value:ye.email,onChange:Re=>_e(Oe=>({...Oe,email:Re.target.value})),placeholder:"olivia@untitledui.com"})]}),C.jsxs(Kw,{children:[C.jsxs(Qw,{children:["Message",C.jsx("span",{children:"*"})]}),C.jsx(dre,{required:!0,value:ye.message,onChange:Re=>_e(Oe=>({...Oe,message:Re.target.value})),placeholder:"I need help with..."})]}),C.jsx(pre,{children:C.jsx(hre,{type:"submit",children:"Submit"})})]}),ne&&!d&&a===ee.conversationId&&C.jsx(nc,{$botMessageColor:t.botMessageColor,style:{color:t.botFontColor},children:C.jsx(Ni,{loading:ne,loadingPhrases:["🎨 Loading","✨ Almost","🚀 Ready"]})})]})]}),!ge&&C.jsx(rre,{$fontColor:t.userFontColor||"#000",$botMessageColor:t.botBackgroundColor||"#fff",children:C.jsx(nc,{$botMessageColor:ge?t.botMessageColor||"#fff":t.userMessageColor||"#fff",children:C.jsx(Ga,{children:ee.text})})})]},q)}),(d||at)&&C.jsxs(Zw,{$fontColor:t.botFontColor||"#000",$botMessageColor:t.botBackgroundColor||"#fff",children:[C.jsx("img",{src:t.bot_logo,alt:"Chat User Icon"}),C.jsx(Ww,{children:C.jsx(nc,{$botMessageColor:t.botMessageColor||"#fff",style:{backgroundColor:"transparent",padding:"0px"},children:C.jsx("div",{style:{display:"flex",alignItems:"center",gap:"4px",animation:"fadeIn 0.3s ease-in-out"},children:C.jsx(Ni,{loading:d||at})})})})]})]}),C.jsxs("div",{className:"debales-footer-container",style:{width:"calc(100%-24px)",backgroundColor:t.footerBackgroundColor||"#fff",color:t.fontColor||"#000"},children:[e==="catch-org-ai"&&C.jsx(tre,{children:C.jsx("span",{children:'"Catch org AI" can make mistakes.'})}),C.jsx("div",{children:C.jsx(d0,{disabled:d,inputState:!1})}),(t.debales_branding??!0)&&C.jsxs(Jne,{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:[C.jsx("p",{children:"Powered by"}),C.jsxs(ere,{children:[C.jsx("img",{src:`${Zn}/images/debales_logo_d.png`,alt:"Debales logo"}),C.jsx("p",{children:"DEBALES"})]})]})]})]})]})}),K.shadowRoot)]})},mre=({botId:e})=>{const t=E8("new-suggested-question-design");console.log(t);let n;return t==="variant-1"?n=Xte:t==="variant-2"?n=$ne:t==="variant-3"?n=gre:n=W4,C.jsx(n,{botId:e})},u6="debales-ai-assistant",c6="debales-chatbot-container",vre=R.forwardRef(({children:e,globalStyles:t="",containerStyles:n={},onReady:r},i)=>{const o=R.useRef(null),[a,u]=R.useState(null),c=R.useRef(null),d=R.useRef(null),p=R.useRef({get shadowRoot(){return c.current},get container(){return a},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 R.useImperativeHandle(i,()=>p.current,[]),R.useEffect(()=>{const h=document.getElementById(u6);if(h?o.current=h:o.current&&(o.current.id=u6),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(`#${c6}`);_&&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=c6,v.style.cssText="position: absolute; top: 0; left: 0; width: 0; height: 0;",m.appendChild(v),u(v),r&&r(m,v)}},[t,r]),R.useEffect(()=>(a&&!d.current&&(d.current=Ak.createRoot(a)),d.current&&a&&d.current.render(C.jsx(Nq,{target:a,children:C.jsx(Q3,{value:p.current,children:e})})),()=>{d.current&&d.current.unmount()}),[a,e]),C.jsx("div",{ref:o,style:n})});class Xw{isSupported(){return hs.detect()===this.platform}createSuccessResult(t,n){return{success:!0,data:t,message:n}}createErrorResult(t){return{success:!1,error:t}}}class yre extends Xw{constructor(){super(...arguments);Cr(this,"platform",Pr.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),pl(i.toString())}else return pl(r.link)}async addCartAttributes(n={}){return console.log("MethodNotImplemented: addCartAttributes called",{attributes:n}),this.createSuccessResult(void 0,"Cart attributes added (mock)")}}class _re extends Xw{constructor(){var n,r;super();Cr(this,"platform",Pr.SHOPIFY);Cr(this,"cartEndpoint");Cr(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=c0(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),pl(o.toString())}else return pl(r.link)}updateTrackCart({cartToken:n,sessionId:r=an()}){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:an(),dbls_method:"add_to_cart"}})}),a=await o.json();if(!o.ok){const u=a;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:an(),...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=c0(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]",an()),i.searchParams.append("timestamp",Date.now().toString()),pl(i.toString())}}class bre extends Xw{constructor(){var n,r;super();Cr(this,"platform",Pr.MAGENTO);Cr(this,"checkoutEndpoint");Cr(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 a=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(!a.ok)return this.createErrorResult(`Failed to add item to cart: ${a.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=c0(n);if(!i.isValid)return"";if(r.handle){const o=new URL(`/${r.handle}.html`,i.url);return pl(o.toString())}else return pl(r.link)}async addCartAttributes(n={}){return console.log("MethodNotImplemented: addCartAttributes called",{attributes:n}),this.createSuccessResult(void 0,"Cart attributes added (mock)")}}const gl=class gl{constructor(){Cr(this,"adapterCache");this.adapterCache=new Map}static getInstance(){return gl.instance||(gl.instance=new gl),gl.instance}getAdapter(t){const n=t||hs.detect(),r=this.adapterCache.get(n);if(r)return r;let i;switch(n){case Pr.SHOPIFY:i=new _re;break;case Pr.MAGENTO:i=new bre;break;default:console.warn(`No specific adapter found for platform ${n}, using default adapter`),i=new yre}return this.adapterCache.set(n,i),i}clearCache(){this.adapterCache.clear()}};Cr(gl,"instance");let Jw=gl;const xre=({adapter:e,children:t,autoFetch:n=!0})=>{const[r,i]=R.useState(!1),[o,a]=R.useState(null),[u,c]=R.useState(null),d=R.useCallback(async()=>{try{i(!0),a(null);const k=await e.fetchCart();k.success?c(k.data):a(k.error)}catch(k){a(k instanceof Error?k.message:"Failed to fetch cart")}finally{i(!1)}},[e]),p=async(k,E,A)=>{try{a(null);const I=await e.addToCart(k,E,A);return I.success&&await d(),I}catch(I){return{success:!1,error:I instanceof Error?I.message:"Failed to add item to cart"}}},h=async k=>{try{a(null);const E=await e.removeFromCart(k);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 k=>{try{a(null);const E=await e.updateQuantity(k);return E.success&&await d(),E}catch(E){return{success:!1,error:E instanceof Error?E.message:"Failed to update quantity"}}},v=async()=>{try{a(null);const k=await e.clearCart();return k.success&&await d(),k}catch(k){return{success:!1,error:k instanceof Error?k.message:"Failed to clear cart"}}},_=k=>e.generateCartUrl(k),S=(k,E)=>e.generateProductUrl(k,E),x=async k=>e.addCartAttributes(k);R.useEffect(()=>{n&&d()},[n,d]);const b={isLoading:r,error:o,cart:u,fetchCart:d,addToCart:p,removeFromCart:h,updateQuantity:m,clearCart:v,generateCartUrl:_,generateProductUrl:S,addCartAttributes:x};return C.jsx(M3.Provider,{value:b,children:t})},Fo=Object.create(null);Fo.open="0",Fo.close="1",Fo.ping="2",Fo.pong="3",Fo.message="4",Fo.upgrade="5",Fo.noop="6";const h0=Object.create(null);Object.keys(Fo).forEach(e=>{h0[Fo[e]]=e});const eS={type:"error",data:"parser error"},f6=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",d6=typeof ArrayBuffer=="function",h6=e=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(e):e&&e.buffer instanceof ArrayBuffer,tS=({type:e,data:t},n,r)=>f6&&t instanceof Blob?n?r(t):p6(t,r):d6&&(t instanceof ArrayBuffer||h6(t))?n?r(t):p6(new Blob([t]),r):r(Fo[e]+(t||"")),p6=(e,t)=>{const n=new FileReader;return n.onload=function(){const r=n.result.split(",")[1];t("b"+(r||""))},n.readAsDataURL(e)};function g6(e){return e instanceof Uint8Array?e:e instanceof ArrayBuffer?new Uint8Array(e):new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}let nS;function wre(e,t){if(f6&&e.data instanceof Blob)return e.data.arrayBuffer().then(g6).then(t);if(d6&&(e.data instanceof ArrayBuffer||h6(e.data)))return t(g6(e.data));tS(e,!1,n=>{nS||(nS=new TextEncoder),t(nS.encode(n))})}const m6="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Sd=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let e=0;e<m6.length;e++)Sd[m6.charCodeAt(e)]=e;const Sre=e=>{let t=e.length*.75,n=e.length,r,i=0,o,a,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=Sd[e.charCodeAt(r)],a=Sd[e.charCodeAt(r+1)],u=Sd[e.charCodeAt(r+2)],c=Sd[e.charCodeAt(r+3)],p[i++]=o<<2|a>>4,p[i++]=(a&15)<<4|u>>2,p[i++]=(u&3)<<6|c&63;return d},Cre=typeof ArrayBuffer=="function",rS=(e,t)=>{if(typeof e!="string")return{type:"message",data:v6(e,t)};const n=e.charAt(0);return n==="b"?{type:"message",data:kre(e.substring(1),t)}:h0[n]?e.length>1?{type:h0[n],data:e.substring(1)}:{type:h0[n]}:eS},kre=(e,t)=>{if(Cre){const n=Sre(e);return v6(n,t)}else return{base64:!0,data:e}},v6=(e,t)=>{switch(t){case"blob":return e instanceof Blob?e:new Blob([e]);case"arraybuffer":default:return e instanceof ArrayBuffer?e:e.buffer}},y6="",Ere=(e,t)=>{const n=e.length,r=new Array(n);let i=0;e.forEach((o,a)=>{tS(o,!1,u=>{r[a]=u,++i===n&&t(r.join(y6))})})},Are=(e,t)=>{const n=e.split(y6),r=[];for(let i=0;i<n.length;i++){const o=rS(n[i],t);if(r.push(o),o.type==="error")break}return r};function Ire(){return new TransformStream({transform(e,t){wre(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 iS;function p0(e){return e.reduce((t,n)=>t+n.length,0)}function g0(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 Tre(e,t){iS||(iS=new TextDecoder);const n=[];let r=0,i=-1,o=!1;return new TransformStream({transform(a,u){for(n.push(a);;){if(r===0){if(p0(n)<1)break;const c=g0(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(p0(n)<2)break;const c=g0(n,2);i=new DataView(c.buffer,c.byteOffset,c.length).getUint16(0),r=3}else if(r===2){if(p0(n)<8)break;const c=g0(n,8),d=new DataView(c.buffer,c.byteOffset,c.length),p=d.getUint32(0);if(p>Math.pow(2,21)-1){u.enqueue(eS);break}i=p*Math.pow(2,32)+d.getUint32(4),r=3}else{if(p0(n)<i)break;const c=g0(n,i);u.enqueue(rS(o?c:iS.decode(c),t)),r=0}if(i===0||i>e){u.enqueue(eS);break}}}})}const _6=4;function hr(e){if(e)return Mre(e)}function Mre(e){for(var t in hr.prototype)e[t]=hr.prototype[t];return e}hr.prototype.on=hr.prototype.addEventListener=function(e,t){return this._callbacks=this._callbacks||{},(this._callbacks["$"+e]=this._callbacks["$"+e]||[]).push(t),this},hr.prototype.once=function(e,t){function n(){this.off(e,n),t.apply(this,arguments)}return n.fn=t,this.on(e,n),this},hr.prototype.off=hr.prototype.removeListener=hr.prototype.removeAllListeners=hr.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},hr.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},hr.prototype.emitReserved=hr.prototype.emit,hr.prototype.listeners=function(e){return this._callbacks=this._callbacks||{},this._callbacks["$"+e]||[]},hr.prototype.hasListeners=function(e){return!!this.listeners(e).length};const m0=typeof Promise=="function"&&typeof Promise.resolve=="function"?t=>Promise.resolve().then(t):(t,n)=>n(t,0),to=typeof self<"u"?self:typeof window<"u"?window:Function("return this")(),Ore="arraybuffer";function Vae(){}function b6(e,...t){return t.reduce((n,r)=>(e.hasOwnProperty(r)&&(n[r]=e[r]),n),{})}const Rre=to.setTimeout,$re=to.clearTimeout;function v0(e,t){t.useNativeTimers?(e.setTimeoutFn=Rre.bind(to),e.clearTimeoutFn=$re.bind(to)):(e.setTimeoutFn=to.setTimeout.bind(to),e.clearTimeoutFn=to.clearTimeout.bind(to))}const Dre=1.33;function Lre(e){return typeof e=="string"?Nre(e):Math.ceil((e.byteLength||e.size)*Dre)}function Nre(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 x6(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}function Bre(e){let t="";for(let n in e)e.hasOwnProperty(n)&&(t.length&&(t+="&"),t+=encodeURIComponent(n)+"="+encodeURIComponent(e[n]));return t}function Pre(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 Fre extends Error{constructor(t,n,r){super(t),this.description=n,this.context=r,this.type="TransportError"}}class oS extends hr{constructor(t){super(),this.writable=!1,v0(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 Fre(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=rS(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=Bre(t);return n.length?"?"+n:""}}class zre extends oS{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)};Are(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,Ere(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]=x6()),!this.supportsBinary&&!n.sid&&(n.b64=1),this.createUri(t,n)}}let w6=!1;try{w6=typeof XMLHttpRequest<"u"&&"withCredentials"in new XMLHttpRequest}catch{}const Ure=w6;function jre(){}class qre extends zre{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 zo extends hr{constructor(t,n,r){super(),this.createRequest=t,v0(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=b6(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=zo.requestsCount++,zo.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=jre,t)try{this._xhr.abort()}catch{}typeof document<"u"&&delete zo.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(zo.requestsCount=0,zo.requests={},typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",S6);else if(typeof addEventListener=="function"){const e="onpagehide"in to?"pagehide":"unload";addEventListener(e,S6,!1)}}function S6(){for(let e in zo.requests)zo.requests.hasOwnProperty(e)&&zo.requests[e].abort()}const Hre=function(){const e=C6({xdomain:!1});return e&&e.responseType!==null}();class Gre extends qre{constructor(t){super(t);const n=t&&t.forceBase64;this.supportsBinary=Hre&&!n}request(t={}){return Object.assign(t,{xd:this.xd},this.opts),new zo(C6,this.uri(),t)}}function C6(e){const t=e.xdomain;try{if(typeof XMLHttpRequest<"u"&&(!t||Ure))return new XMLHttpRequest}catch{}if(!t)try{return new to[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch{}}const k6=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative";class Vre extends oS{get name(){return"websocket"}doOpen(){const t=this.uri(),n=this.opts.protocols,r=k6?{}:b6(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;tS(r,this.supportsBinary,o=>{try{this.doWrite(r,o)}catch{}i&&m0(()=>{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]=x6()),this.supportsBinary||(n.b64=1),this.createUri(t,n)}}const aS=to.WebSocket||to.MozWebSocket;class Zre extends Vre{createSocket(t,n,r){return k6?new aS(t,n,r):n?new aS(t,n):new aS(t)}doWrite(t,n){this.ws.send(n)}}class Yre extends oS{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=Tre(Number.MAX_SAFE_INTEGER,this.socket.binaryType),r=t.readable.pipeThrough(n).getReader(),i=Ire();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 a={type:"open"};this.query.sid&&(a.data=`{"sid":"${this.query.sid}"}`),this._writer.write(a).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&&m0(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var t;(t=this._transport)===null||t===void 0||t.close()}}const Wre={websocket:Zre,webtransport:Yre,polling:Gre},Kre=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,Qre=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function sS(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=Kre.exec(e||""),o={},a=14;for(;a--;)o[Qre[a]]=i[a]||"";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=Xre(o,o.path),o.queryKey=Jre(o,o.query),o}function Xre(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 Jre(e,t){const n={};return t.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(r,i,o){i&&(n[i]=o)}),n}const lS=typeof addEventListener=="function"&&typeof removeEventListener=="function",y0=[];lS&&addEventListener("offline",()=>{y0.forEach(e=>e())},!1);class ps extends hr{constructor(t,n){if(super(),this.binaryType=Ore,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=sS(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=sS(n.host).host);v0(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=Pre(this.opts.query)),lS&&(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"})},y0.push(this._offlineEventListener))),this.opts.withCredentials&&(this._cookieJar=void 0),this._open()}createTransport(t){const n=Object.assign({},this.opts.query);n.EIO=_6,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&&ps.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",ps.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+=Lre(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,m0(()=>{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(ps.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(),lS&&(this._beforeunloadEventListener&&removeEventListener("beforeunload",this._beforeunloadEventListener,!1),this._offlineEventListener)){const r=y0.indexOf(this._offlineEventListener);r!==-1&&y0.splice(r,1)}this.readyState="closed",this.id=null,this.emitReserved("close",t,n),this.writeBuffer=[],this._prevBufferLen=0}}}ps.protocol=_6;class eie extends ps{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;ps.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;ps.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 a=h=>{const m=new Error("probe error: "+h);m.transport=n.name,o(),this.emitReserved("upgradeError",m)};function u(){a("transport closed")}function c(){a("socket closed")}function d(h){n&&h.name!==n.name&&o()}const p=()=>{n.removeListener("open",i),n.removeListener("error",a),n.removeListener("close",u),this.off("close",c),this.off("upgrading",d)};n.once("open",i),n.once("error",a),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 tie=class extends eie{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=>Wre[i]).filter(i=>!!i)),super(t,r)}};function nie(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=sS(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 rie=typeof ArrayBuffer=="function",iie=e=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(e):e.buffer instanceof ArrayBuffer,E6=Object.prototype.toString,oie=typeof Blob=="function"||typeof Blob<"u"&&E6.call(Blob)==="[object BlobConstructor]",aie=typeof File=="function"||typeof File<"u"&&E6.call(File)==="[object FileConstructor]";function uS(e){return rie&&(e instanceof ArrayBuffer||iie(e))||oie&&e instanceof Blob||aie&&e instanceof File}function _0(e,t){if(!e||typeof e!="object")return!1;if(Array.isArray(e)){for(let n=0,r=e.length;n<r;n++)if(_0(e[n]))return!0;return!1}if(uS(e))return!0;if(e.toJSON&&typeof e.toJSON=="function"&&arguments.length===1)return _0(e.toJSON(),!0);for(const n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&_0(e[n]))return!0;return!1}function sie(e){const t=[],n=e.data,r=e;return r.data=cS(n,t),r.attachments=t.length,{packet:r,buffers:t}}function cS(e,t){if(!e)return e;if(uS(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]=cS(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]=cS(e[r],t));return n}return e}function lie(e,t){return e.data=fS(e.data,t),delete e.attachments,e}function fS(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]=fS(e[n],t);else if(typeof e=="object")for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&(e[n]=fS(e[n],t));return e}const uie=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"],cie=5;var Kt;(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"})(Kt||(Kt={}));class fie{constructor(t){this.replacer=t}encode(t){return(t.type===Kt.EVENT||t.type===Kt.ACK)&&_0(t)?this.encodeAsBinary({type:t.type===Kt.EVENT?Kt.BINARY_EVENT:Kt.BINARY_ACK,nsp:t.nsp,data:t.data,id:t.id}):[this.encodeAsString(t)]}encodeAsString(t){let n=""+t.type;return(t.type===Kt.BINARY_EVENT||t.type===Kt.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=sie(t),r=this.encodeAsString(n.packet),i=n.buffers;return i.unshift(r),i}}function A6(e){return Object.prototype.toString.call(e)==="[object Object]"}class dS extends hr{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===Kt.BINARY_EVENT;r||n.type===Kt.BINARY_ACK?(n.type=r?Kt.EVENT:Kt.ACK,this.reconstructor=new die(n),n.attachments===0&&super.emitReserved("decoded",n)):super.emitReserved("decoded",n)}else if(uS(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(Kt[r.type]===void 0)throw new Error("unknown packet type "+r.type);if(r.type===Kt.BINARY_EVENT||r.type===Kt.BINARY_ACK){const o=n+1;for(;t.charAt(++n)!=="-"&&n!=t.length;);const a=t.substring(o,n);if(a!=Number(a)||t.charAt(n)!=="-")throw new Error("Illegal attachments");r.attachments=Number(a)}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 a=t.charAt(n);if(a==null||Number(a)!=a){--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(dS.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 Kt.CONNECT:return A6(n);case Kt.DISCONNECT:return n===void 0;case Kt.CONNECT_ERROR:return typeof n=="string"||A6(n);case Kt.EVENT:case Kt.BINARY_EVENT:return Array.isArray(n)&&(typeof n[0]=="number"||typeof n[0]=="string"&&uie.indexOf(n[0])===-1);case Kt.ACK:case Kt.BINARY_ACK:return Array.isArray(n)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}}class die{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=lie(this.reconPack,this.buffers);return this.finishedReconstruction(),n}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}const hie=Object.freeze(Object.defineProperty({__proto__:null,Decoder:dS,Encoder:fie,get PacketType(){return Kt},protocol:cie},Symbol.toStringTag,{value:"Module"}));function wo(e,t,n){return e.on(t,n),function(){e.off(t,n)}}const pie=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class I6 extends hr{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=[wo(t,"open",this.onopen.bind(this)),wo(t,"packet",this.onpacket.bind(this)),wo(t,"error",this.onerror.bind(this)),wo(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(pie.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 a={type:Kt.EVENT,data:n};if(a.options={},a.options.compress=this.flags.compress!==!1,typeof n[n.length-1]=="function"){const p=this.ids++,h=n.pop();this._registerAckCallback(p,h),a.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(a),this.packet(a)):this.sendBuffer.push(a)),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),a=(...u)=>{this.io.clearTimeoutFn(o),n.apply(this,u)};a.withError=!0,this.acks[t]=a}emitWithAck(t,...n){return new Promise((r,i)=>{const o=(a,u)=>a?i(a):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:Kt.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 Kt.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 Kt.EVENT:case Kt.BINARY_EVENT:this.onevent(t);break;case Kt.ACK:case Kt.BINARY_ACK:this.onack(t);break;case Kt.DISCONNECT:this.ondisconnect();break;case Kt.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:Kt.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:Kt.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 rc(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}rc.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},rc.prototype.reset=function(){this.attempts=0},rc.prototype.setMin=function(e){this.ms=e},rc.prototype.setMax=function(e){this.max=e},rc.prototype.setJitter=function(e){this.jitter=e};class hS extends hr{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,v0(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 rc({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||hie;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 tie(this.uri,this.opts);const n=this.engine,r=this;this._readyState="opening",this.skipReconnect=!1;const i=wo(n,"open",function(){r.onopen(),t&&t()}),o=u=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",u),t?t(u):this.maybeReconnectOnOpen()},a=wo(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(a),this}connect(t){return this.open(t)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");const t=this.engine;this.subs.push(wo(t,"ping",this.onping.bind(this)),wo(t,"data",this.ondata.bind(this)),wo(t,"error",this.onerror.bind(this)),wo(t,"close",this.onclose.bind(this)),wo(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){m0(()=>{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 I6(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 Cd={};function b0(e,t){typeof e=="object"&&(t=e,e=void 0),t=t||{};const n=nie(e,t.path||"/socket.io"),r=n.source,i=n.id,o=n.path,a=Cd[i]&&o in Cd[i].nsps,u=t.forceNew||t["force new connection"]||t.multiplex===!1||a;let c;return u?c=new hS(r,t):(Cd[i]||(Cd[i]=new hS(r,t)),c=Cd[i]),n.query&&!t.query&&(t.query=n.queryKey),c.socket(n.path,t)}Object.assign(b0,{Manager:hS,Socket:I6,io:b0,connect:b0});const ml=class ml{constructor(){Cr(this,"socket",null);Cr(this,"isConnected",!1);Cr(this,"eventListeners",new Map)}static getInstance(){return ml.instance||(ml.instance=new ml),ml.instance}connect(t){return this.socket?this.socket:(this.socket=b0(`${hK}${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))}};Cr(ml,"instance");let pS=ml;const Uo=pS.getInstance();var gie={MESSAGE:"MESSAGE"},mie={USER:"USER"};function x0(e,t){window.dispatchEvent(new StorageEvent("storage",{key:e,newValue:t}))}const T6=(e,t)=>{const n=JSON.stringify(t);window.localStorage.setItem(e,n),x0(e,n)},vie=e=>{window.localStorage.removeItem(e),x0(e,null)},M6=e=>window.localStorage.getItem(e),yie=e=>(window.addEventListener("storage",e),()=>window.removeEventListener("storage",e)),_ie=()=>{throw Error("useLocalStorage is a client-only hook")};function bie(e,t){const n=()=>M6(e),r=R.useSyncExternalStore(yie,n,_ie),i=R.useCallback(o=>{try{const a=typeof o=="function"?o(JSON.parse(r)):o;a==null?vie(e):T6(e,a)}catch(a){console.warn(a)}},[e,r]);return R.useEffect(()=>{M6(e)===null&&T6(e,t)},[e,t]),[r?JSON.parse(r):t,i]}const O6=(e,t)=>{const n=JSON.stringify(t);window.sessionStorage.setItem(e,n),x0(e,n)},xie=e=>{window.sessionStorage.removeItem(e),x0(e,null)},R6=e=>window.sessionStorage.getItem(e),wie=e=>(window.addEventListener("storage",e),()=>window.removeEventListener("storage",e)),Sie=()=>{throw Error("useSessionStorage is a client-only hook")};function Cie(e,t){const n=()=>R6(e),r=R.useSyncExternalStore(wie,n,Sie),i=R.useCallback(o=>{try{const a=typeof o=="function"?o(JSON.parse(r)):o;a==null?xie(e):O6(e,a)}catch(a){console.warn(a)}},[e,r]);return R.useEffect(()=>{R6(e)===null&&O6(e,t)},[e,t]),[r?JSON.parse(r):t,i]}const kie=({children:e,nameSpace:t})=>{const[n,r]=R.useState(""),[i,o]=R.useState([]),[a,u]=R.useState(!1),[c,d]=R.useState(!1),[p,h]=R.useState([]),[m,v]=R.useState(!1),[_,S]=R.useState(!1),[x,b]=R.useState([]),[k,E]=bie(qt(jt.USER_INFO),null),[A,I]=Cie(qt(jt.IS_FORM_CLOSED_BY_USER),!1),[$,B]=er.useState(null),U=ja("web-socket"),[G,P]=er.useState([]),[K,re]=R.useState(null),[ue,Z]=R.useState(!1),[ie,V]=R.useState(sessionStorage.getItem(qt(jt.LAST_SHOWN_MESSAGE_ID,{botId:t}))),Q=yK(),ve=an(),[Te,T]=er.useState(null),[X,me]=R.useState(null);R.useEffect(()=>{if(U){const je=Uo.connect("/api/v1/chat");re(je);const Se=()=>{console.debug("connected to websocket"),Z(!0)},Ye=()=>{console.debug("disconnected from websocket"),Z(!1)},Qe=et=>{console.debug("response from websocket",et);const He=et.conversationId??crypto.randomUUID().toString();V(He),et.Variants_quantity&&b(F=>[...F,...et.Variants_quantity]);const N=[...i,{text:et.response,products:et.products,conversationId:He,rating:"neutral",leading_queries:et.leading_queries,collections:et.collections,variants:et.variants,shop:et.shop,Variants_quantity:et.Variants_quantity,monthlyChatLimitReached:et.monthlyChatLimitReached,isBot:!0}];o(N),L(N),h(F=>[...F,[i[i.length-1].text,et.response]]),d(!1)},ot=et=>{if(et.event==="error"){const He={text:"I am facing some network issues. Can you please check your network and try again?",isBot:!0},N=[...i,He];o(N),L(N),d(!1)}};return Uo.on("connect",Se),Uo.on("disconnect",Ye),Uo.on("response",Qe),Uo.on("system",ot),()=>{Uo.off("connect",Se),Uo.off("disconnect",Ye),Uo.off("response",Qe),Uo.off("system",ot)}}},[U,i]);const L=je=>{sessionStorage.setItem(qt(jt.CHAT_HISTORY,{botId:window.DebalesChat.projectId}),JSON.stringify(je))},we=()=>{const je=sessionStorage.getItem(qt(jt.CHAT_HISTORY,{botId:window.DebalesChat.projectId}));return je?JSON.parse(je):[]},Ue=R.useCallback(async()=>{if(t)try{u(!0);const je=await fetch(`${Zn}/api/wordpress/UiData?value=${t}`),Se=await je.json();if(!je.ok)throw new Error("failed to fetch data"+Se.error);const Ye=document.getElementById("debales-ai-assistant");Ye&&(Ye.style.zIndex=String(Se.zIndex??2031483602)),me(Se),Se!=null&&Se.shopifyShopDomain&&NK(Se.shopifyShopDomain).then(ot=>{T(ot)}),P(Se.suggestedQuestions);const Qe=we();if(Qe.length>0)o(Qe);else{const ot={text:Se.initialMessage||"Hi, I am an AI Assistant. How can I help you?",isBot:!0};o([ot])}}catch(je){console.error(je)}finally{u(!1)}},[t]);R.useEffect(()=>{Ue()},[Ue]);const de=R.useMemo(()=>{var je;return!!(!A&&((je=X==null?void 0:X.pluginConfig)!=null&&je.collectedUserInfo)&&(X.pluginConfig.collectedUserInfo.name||X.pluginConfig.collectedUserInfo.email||X.pluginConfig.collectedUserInfo.phone)&&!k)},[X,k,A]),tt=R.useCallback(async(je,Se,Ye,Qe,ot,et)=>{if(!je||je.trim()===""||c&&!Ye)return;let He=[...i];Qe?Qe&&i.length<=2?(v(!0),He=[]):v(!1):(He.push({text:je,isBot:!1}),v(!1));const N=an();d(!0);try{o(He),L(He);const F=await fetch(`${Zn}/api/wordpress/ChatWithBot`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({sessionId:N,userMessage:je,nameSpace:t,chat_history:p,leading_queries:ot,answer:Se,products:Ye,userInfo:JSON.stringify(k),anonymousUserId:Q,distinctId:Po.getDistinctId(),timestamp:new Date().toISOString(),timeZone:Intl.DateTimeFormat().resolvedOptions().timeZone,followUpQuestion:et})});if(!F.ok)throw new Error("Network response was not ok");const Y=await F.json(),ye=Y.conversationId??crypto.randomUUID().toString();V(ye),Y.Variants_quantity&&b(Ie=>[...Ie,...Y.Variants_quantity]);const _e=[...He,{text:Y.response,products:Y.products,conversationId:ye,rating:"neutral",leading_queries:Y.leading_queries,collections:Y.collections,variants:Y.variants,shop:Y.shop,Variants_quantity:Y.Variants_quantity,monthlyChatLimitReached:Y.monthlyChatLimitReached,isBot:!0}];o(_e),L(_e),h(Ie=>[...Ie,[je,Y.response]])}catch(F){console.error(F);const Y={text:"I am facing some network issues. Can you please check your network and try again?",isBot:!0},ye=[...He,Y];Qe||(o(ye),L(ye))}finally{d(!1)}},[i,c,p,t,Q,k]),Ze=R.useCallback(je=>{X&&me(Se=>Se?{...Se,mobileDisplayMode:je}:null)},[X]),lt=R.useCallback(async(je,Se,Ye,Qe,ot,et)=>{if(!je||je.trim()===""||c&&!Ye)return;let He=[...i];if(Qe?Qe&&i.length<=2?(v(!0),He=[]):v(!1):(He.push({text:je,isBot:!1}),v(!1)),d(!0),o(He),L(He),K&&ue){const N={type:gie.MESSAGE,role:mie.USER,query:je,nameSpace:t,leadingQueries:ot,answer:Se,products:Ye,userInfo:k,timeZone:Intl.DateTimeFormat().resolvedOptions().timeZone,timestamp:new Date().toISOString(),sessionId:ve,anonymousUserId:Q,distinctId:Po.getDistinctId(),followUpQuestion:et};Uo.emit("chat",N)}else tt(je,Se,Ye,Qe,ot,et)},[i,c,t,Q,K,ue,ve,tt,k]),gt={sessionId:ve,messages:i,isLoading:a,isMessageLoading:c,isKlaviyoMessage:m,showUserInfoModel:_,pendingBulkItems:x,lastedBotmessageId:ie,uiData:X,storeMetaData:Te,suggestedQuestions:G,isUserInfoNeeded:de,input:n,pendingQuestion:$,userInfo:k,isFormClosedByUser:A,onSendMessage:U?lt:tt,setMessages:o,setIsLoading:u,setIsMessageLoading:d,setIsKlaviyoMessage:v,setShowUserInfoModel:S,setPendingBulkItems:b,setLastedBotmessageId:V,fetchUiInfo:Ue,changeDisplayModel:Ze,saveConversation:L,loadConversation:we,setSuggestedQuestions:P,setUserInfo:E,setInput:r,setPendingQuestion:B,setIsFormClosedByUser:I};return C.jsx(X3.Provider,{value:gt,children:e})};function Eie(e){const t=Jw.getInstance().getAdapter();return C.jsx(kie,{nameSpace:e.botId,children:C.jsx(k8,{apiKey:pK,options:{capture_pageview:e.botId!=="burgerbaeclothing",capture_pageleave:e.botId!=="burgerbaeclothing",api_host:Zn+"/ingest",ui_host:"https://us.posthog.com",loaded:n=>{n.register({platform:hs.detect(),project:e.botId,sessionId:an()}),n.group("project",e.botId,{platform:hs.detect()});const r=Nr();r&&r.email&&!n._isIdentified()&&n.identify(r.email,{name:r.name,phone:r.phone,email:r.email,project:e.botId})},debug:!1},children:C.jsx(xre,{adapter:t,children:e.children})})})}function Aie(e){return C.jsx(vre,{children:C.jsx(Eie,{botId:e.botId,children:C.jsx(mre,{...e})})})}const ga=new Map;function w0(e){const{botId:t}=e;if(ga.has(t))return console.warn(`Chatbot with botId "${t}" is already initialized. Skipping duplicate initialization.`),ga.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=Ak.createRoot(r);i.render(er.createElement(Aie,{botId:e.botId}));const o={container:r,unmount:()=>{if(i.unmount(),ga.delete(t),r&&r.parentNode&&document.body.contains(r))try{r.parentNode.removeChild(r)}catch(a){console.warn("Error removing chatbot container:",a)}}};return ga.set(t,o),o}typeof window<"u"&&(window.DebalesChatbotBrowser={init:w0,destroy:e=>{const t=ga.get(e);return t?(t.unmount(),!0):!1},isInitialized:e=>ga.has(e),getInitializedBots:()=>Array.from(ga.keys())});function $6(){document.querySelectorAll('[id="debales-ai-assistant"][data-bot-id]').forEach(n=>{const r=n.getAttribute("data-bot-id");r&&!ga.has(r)&&w0({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&&!ga.has(r)&&w0({botId:r})})}return typeof document<"u"&&(document.readyState==="loading"?document.addEventListener("DOMContentLoaded",$6):$6()),Zo.initDebalesChatbot=w0,Object.defineProperty(Zo,Symbol.toStringTag,{value:"Module"}),Zo}({});
|