wineater-bot 4.0.0-beta.6 → 4.0.0
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/wineater-chatbot.mjs +2038 -1935
- package/dist/wineater-chatbot.umd.js +68 -13
- package/index.html +2 -4
- package/package.json +5 -30
- package/vite.config.js +10 -16
- package/dist/wineater-chatbot.css +0 -1
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
(function(Q,$){typeof exports=="object"&&typeof module<"u"?module.exports=$():typeof define=="function"&&define.amd?define($):(Q=typeof globalThis<"u"?globalThis:Q||self,Q.WineaterChatbot=$())})(this,function(){"use strict";var xd=Object.defineProperty;var ja=Q=>{throw TypeError(Q)};var Nd=(Q,$,de)=>$ in Q?xd(Q,$,{enumerable:!0,configurable:!0,writable:!0,value:de}):Q[$]=de;var Ot=(Q,$,de)=>Nd(Q,typeof $!="symbol"?$+"":$,de),ar=(Q,$,de)=>$.has(Q)||ja("Cannot "+de);var b=(Q,$,de)=>(ar(Q,$,"read from private field"),de?de.call(Q):$.get(Q)),K=(Q,$,de)=>$.has(Q)?ja("Cannot add the same private member more than once"):$ instanceof WeakSet?$.add(Q):$.set(Q,de),B=(Q,$,de,Js)=>(ar(Q,$,"write to private field"),Js?Js.call(Q,de):$.set(Q,de),de),ae=(Q,$,de)=>(ar(Q,$,"access private method"),de);var Pa,Ss,_s,ks,Kt,Gs,Ts,Es,ye,lr,es,cr,za,ze,Ue,ir,rt,Xt,ot,We,Oe,at,vt,Ct,Jt,xt,Yt,Nt,zn,Un,ve,Dd,Rd,ur,Hn,qn,hr,bt,lt,Xe,Ks,Xs,Is,Qt,La;const Q="5";typeof window<"u"&&((Pa=window.__svelte??(window.__svelte={})).v??(Pa.v=new Set)).add(Q);const $=1,de=2,Js=16,Ua=1,Wa=2,Ha=4,qa=8,Va=16,Ga=1,Ka=2,we=Symbol(),Xa="http://www.w3.org/1999/xhtml",fr=!1;var Ys=Array.isArray,Ja=Array.prototype.indexOf,Vn=Array.from,Gn=Object.defineProperty,ts=Object.getOwnPropertyDescriptor,Ya=Object.getOwnPropertyDescriptors,Qa=Object.prototype,Za=Array.prototype,dr=Object.getPrototypeOf,pr=Object.isExtensible;function $a(t){for(var e=0;e<t.length;e++)t[e]()}function gr(){var t,e,s=new Promise((n,i)=>{t=n,e=i});return{promise:s,resolve:t,reject:e}}const Se=2,Kn=4,Xn=8,ct=16,ut=32,Mt=64,Qs=128,Te=1024,xe=2048,St=4096,Me=8192,ht=16384,Jn=32768,ss=65536,mr=1<<17,el=1<<18,ns=1<<19,tl=1<<20,Le=256,Zs=512,$s=32768,Yn=1<<21,Qn=1<<22,At=1<<23,Pt=Symbol("$state"),sl=Symbol("legacy props"),nl=Symbol(""),is=new class extends Error{constructor(){super(...arguments);Ot(this,"name","StaleReactionError");Ot(this,"message","The reaction that called `getAbortSignal()` was re-run or destroyed")}};function il(t){throw new Error("https://svelte.dev/e/lifecycle_outside_component")}function rl(){throw new Error("https://svelte.dev/e/async_derived_orphan")}function ol(t){throw new Error("https://svelte.dev/e/effect_in_teardown")}function al(){throw new Error("https://svelte.dev/e/effect_in_unowned_derived")}function ll(t){throw new Error("https://svelte.dev/e/effect_orphan")}function cl(){throw new Error("https://svelte.dev/e/effect_update_depth_exceeded")}function ul(t){throw new Error("https://svelte.dev/e/props_invalid_value")}function hl(){throw new Error("https://svelte.dev/e/state_descriptors_fixed")}function fl(){throw new Error("https://svelte.dev/e/state_prototype_fixed")}function dl(){throw new Error("https://svelte.dev/e/state_unsafe_mutation")}function pl(){throw new Error("https://svelte.dev/e/svelte_boundary_reset_onerror")}function gl(){console.warn("https://svelte.dev/e/select_multiple_invalid_value")}function ml(){console.warn("https://svelte.dev/e/svelte_boundary_reset_noop")}let vl=!1;function vr(t){return t===this.v}function bl(t,e){return t!=t?e==e:t!==e||t!==null&&typeof t=="object"||typeof t=="function"}function br(t){return!bl(t,this.v)}let rs=!1,yl=!1;function wl(){rs=!0}let ue=null;function os(t){ue=t}function Lt(t,e=!1,s){ue={p:ue,c:null,e:null,s:t,x:null,l:rs&&!e?{s:null,u:null,$:[]}:null}}function Bt(t){var e=ue,s=e.e;if(s!==null){e.e=null;for(var n of s)Br(n)}return t!==void 0&&(e.x=t),ue=e.p,t??{}}function Ns(){return!rs||ue!==null&&ue.l===null}let Ft=[];function yr(){var t=Ft;Ft=[],$a(t)}function Ds(t){if(Ft.length===0&&!Rs){var e=Ft;queueMicrotask(()=>{e===Ft&&yr()})}Ft.push(t)}function Sl(){for(;Ft.length>0;)yr()}const _l=new WeakMap;function wr(t){var e=H;if(e===null)return U.f|=At,t;if(e.f&Jn)as(t,e);else{if(!(e.f&Qs))throw!e.parent&&t instanceof Error&&Sr(t),t;e.b.error(t)}}function as(t,e){for(;e!==null;){if(e.f&Qs)try{e.b.error(t);return}catch(s){t=s}e=e.parent}throw t instanceof Error&&Sr(t),t}function Sr(t){const e=_l.get(t);e&&(Gn(t,"message",{value:e.message}),Gn(t,"stack",{value:e.stack}))}const en=new Set;let ee=null,tn=null,be=null,Zn=new Set,Ye=[],sn=null,$n=!1,Rs=!1;const jn=class jn{constructor(){K(this,ye);Ot(this,"committed",!1);Ot(this,"current",new Map);K(this,Ss,new Map);K(this,_s,new Set);K(this,ks,0);K(this,Kt,0);K(this,Gs,null);K(this,Ts,[]);K(this,Es,[]);Ot(this,"skipped_effects",new Set)}process(e){Ye=[],tn=null,this.apply();var s={parent:null,effect:null,effects:[],render_effects:[],block_effects:[]};for(const n of e)ae(this,ye,lr).call(this,n,s);ae(this,ye,cr).call(this),b(this,Kt)>0?(ae(this,ye,es).call(this,s.effects),ae(this,ye,es).call(this,s.render_effects),ae(this,ye,es).call(this,s.block_effects)):(tn=this,ee=null,kr(s.render_effects),kr(s.effects),tn=null),be=null}capture(e,s){b(this,Ss).has(e)||b(this,Ss).set(e,s),this.current.set(e,e.v),be==null||be.set(e,e.v)}activate(){ee=this}deactivate(){ee=null,be=null}flush(){if(Ye.length>0){if(this.activate(),_r(),ee!==null&&ee!==this)return}else ae(this,ye,cr).call(this);this.deactivate();for(const e of Zn)if(Zn.delete(e),e(),ee!==null)break}increment(e){B(this,ks,b(this,ks)+1),e&&B(this,Kt,b(this,Kt)+1)}decrement(e){B(this,ks,b(this,ks)-1),e&&B(this,Kt,b(this,Kt)-1);for(const s of b(this,Ts))Ce(s,xe),jt(s);for(const s of b(this,Es))Ce(s,St),jt(s);B(this,Ts,[]),B(this,Es,[]),this.flush()}add_callback(e){b(this,_s).add(e)}settled(){return(b(this,Gs)??B(this,Gs,gr())).promise}static ensure(){if(ee===null){const e=ee=new jn;en.add(ee),Rs||jn.enqueue(()=>{ee===e&&e.flush()})}return ee}static enqueue(e){Ds(e)}apply(){}};Ss=new WeakMap,_s=new WeakMap,ks=new WeakMap,Kt=new WeakMap,Gs=new WeakMap,Ts=new WeakMap,Es=new WeakMap,ye=new WeakSet,lr=function(e,s){var l;e.f^=Te;for(var n=e.first;n!==null;){var i=n.f,r=(i&(ut|Mt))!==0,o=r&&(i&Te)!==0,a=o||(i&Me)!==0||this.skipped_effects.has(n);if(n.f&Qs&&((l=n.b)!=null&&l.is_pending())&&(s={parent:s,effect:n,effects:[],render_effects:[],block_effects:[]}),!a&&n.fn!==null){r?n.f^=Te:i&Kn?s.effects.push(n):ln(n)&&(n.f&ct&&s.block_effects.push(n),un(n));var c=n.first;if(c!==null){n=c;continue}}var u=n.parent;for(n=n.next;n===null&&u!==null;)u===s.effect&&(ae(this,ye,es).call(this,s.effects),ae(this,ye,es).call(this,s.render_effects),ae(this,ye,es).call(this,s.block_effects),s=s.parent),n=u.next,u=u.parent}},es=function(e){for(const s of e)(s.f&xe?b(this,Ts):b(this,Es)).push(s),Ce(s,Te)},cr=function(){if(b(this,Kt)===0){for(const e of b(this,_s))e();b(this,_s).clear()}b(this,ks)===0&&ae(this,ye,za).call(this)},za=function(){var i,r;if(en.size>1){b(this,Ss).clear();var e=be,s=!0,n={parent:null,effect:null,effects:[],render_effects:[],block_effects:[]};for(const o of en){if(o===this){s=!1;continue}const a=[];for(const[u,l]of this.current){if(o.current.has(u))if(s&&l!==o.current.get(u))o.current.set(u,l);else continue;a.push(u)}if(a.length===0)continue;const c=[...o.current.keys()].filter(u=>!this.current.has(u));if(c.length>0){const u=new Set,l=new Map;for(const h of a)Tr(h,c,u,l);if(Ye.length>0){ee=o,o.apply();for(const h of Ye)ae(i=o,ye,lr).call(i,h,n);Ye=[],o.deactivate()}}}ee=null,be=e}this.committed=!0,en.delete(this),(r=b(this,Gs))==null||r.resolve()};let ft=jn;function kl(t){var e=Rs;Rs=!0;try{for(var s;;){if(Sl(),Ye.length===0&&(ee==null||ee.flush(),Ye.length===0))return sn=null,s;_r()}}finally{Rs=e}}function _r(){var t=us;$n=!0;try{var e=0;for(qr(!0);Ye.length>0;){var s=ft.ensure();if(e++>1e3){var n,i;Tl()}s.process(Ye),_t.clear()}}finally{$n=!1,qr(t),sn=null}}function Tl(){try{cl()}catch(t){as(t,sn)}}let qe=null;function kr(t){var e=t.length;if(e!==0){for(var s=0;s<e;){var n=t[s++];if(!(n.f&(ht|Me))&&ln(n)&&(qe=new Set,un(n),n.deps===null&&n.first===null&&n.nodes_start===null&&(n.teardown===null&&n.ac===null?zr(n):n.fn=null),(qe==null?void 0:qe.size)>0)){_t.clear();for(const i of qe){if(i.f&(ht|Me))continue;const r=[i];let o=i.parent;for(;o!==null;)qe.has(o)&&(qe.delete(o),r.push(o)),o=o.parent;for(let a=r.length-1;a>=0;a--){const c=r[a];c.f&(ht|Me)||un(c)}}qe.clear()}}qe=null}}function Tr(t,e,s,n){if(!s.has(t)&&(s.add(t),t.reactions!==null))for(const i of t.reactions){const r=i.f;r&Se?Tr(i,e,s,n):r&(Qn|ct)&&!(r&xe)&&Er(i,e,n)&&(Ce(i,xe),jt(i))}}function Er(t,e,s){const n=s.get(t);if(n!==void 0)return n;if(t.deps!==null)for(const i of t.deps){if(e.includes(i))return!0;if(i.f&Se&&Er(i,e,s))return s.set(i,!0),!0}return s.set(t,!1),!1}function jt(t){for(var e=sn=t;e.parent!==null;){e=e.parent;var s=e.f;if($n&&e===H&&s&ct)return;if(s&(Mt|ut)){if(!(s&Te))return;e.f^=Te}}Ye.push(e)}function El(t){let e=0,s=zt(0),n;return()=>{Ul()&&(w(s),ii(()=>(e===0&&(n=Ls(()=>t(()=>Ms(s)))),e+=1,()=>{Ds(()=>{e-=1,e===0&&(n==null||n(),n=void 0,Ms(s))})})))}}var Il=ss|ns|Qs;function Cl(t,e,s){new xl(t,e,s)}class xl{constructor(e,s,n){K(this,ve);Ot(this,"parent");K(this,ze,!1);K(this,Ue);K(this,ir,null);K(this,rt);K(this,Xt);K(this,ot);K(this,We,null);K(this,Oe,null);K(this,at,null);K(this,vt,null);K(this,Ct,null);K(this,Jt,0);K(this,xt,0);K(this,Yt,!1);K(this,Nt,null);K(this,zn,()=>{b(this,Nt)&&Os(b(this,Nt),b(this,Jt))});K(this,Un,El(()=>(B(this,Nt,zt(b(this,Jt))),()=>{B(this,Nt,null)})));B(this,Ue,e),B(this,rt,s),B(this,Xt,n),this.parent=H.b,B(this,ze,!!b(this,rt).pending),B(this,ot,ri(()=>{H.b=this;{var i=ae(this,ve,ur).call(this);try{B(this,We,Ve(()=>n(i)))}catch(r){this.error(r)}b(this,xt)>0?ae(this,ve,qn).call(this):B(this,ze,!1)}return()=>{var r;(r=b(this,Ct))==null||r.remove()}},Il))}is_pending(){return b(this,ze)||!!this.parent&&this.parent.is_pending()}has_pending_snippet(){return!!b(this,rt).pending}update_pending_count(e){ae(this,ve,hr).call(this,e),B(this,Jt,b(this,Jt)+e),Zn.add(b(this,zn))}get_effect_pending(){return b(this,Un).call(this),w(b(this,Nt))}error(e){var s=b(this,rt).onerror;let n=b(this,rt).failed;if(b(this,Yt)||!s&&!n)throw e;b(this,We)&&(Ne(b(this,We)),B(this,We,null)),b(this,Oe)&&(Ne(b(this,Oe)),B(this,Oe,null)),b(this,at)&&(Ne(b(this,at)),B(this,at,null));var i=!1,r=!1;const o=()=>{if(i){ml();return}i=!0,r&&pl(),ft.ensure(),B(this,Jt,0),b(this,at)!==null&&cs(b(this,at),()=>{B(this,at,null)}),B(this,ze,this.has_pending_snippet()),B(this,We,ae(this,ve,Hn).call(this,()=>(B(this,Yt,!1),Ve(()=>b(this,Xt).call(this,b(this,Ue)))))),b(this,xt)>0?ae(this,ve,qn).call(this):B(this,ze,!1)};var a=U;try{De(null),r=!0,s==null||s(e,o),r=!1}catch(c){as(c,b(this,ot)&&b(this,ot).parent)}finally{De(a)}n&&Ds(()=>{B(this,at,ae(this,ve,Hn).call(this,()=>{ft.ensure(),B(this,Yt,!0);try{return Ve(()=>{n(b(this,Ue),()=>e,()=>o)})}catch(c){return as(c,b(this,ot).parent),null}finally{B(this,Yt,!1)}}))})}}ze=new WeakMap,Ue=new WeakMap,ir=new WeakMap,rt=new WeakMap,Xt=new WeakMap,ot=new WeakMap,We=new WeakMap,Oe=new WeakMap,at=new WeakMap,vt=new WeakMap,Ct=new WeakMap,Jt=new WeakMap,xt=new WeakMap,Yt=new WeakMap,Nt=new WeakMap,zn=new WeakMap,Un=new WeakMap,ve=new WeakSet,Dd=function(){try{B(this,We,Ve(()=>b(this,Xt).call(this,b(this,Ue))))}catch(e){this.error(e)}B(this,ze,!1)},Rd=function(){const e=b(this,rt).pending;e&&(B(this,Oe,Ve(()=>e(b(this,Ue)))),ft.enqueue(()=>{var s=ae(this,ve,ur).call(this);B(this,We,ae(this,ve,Hn).call(this,()=>(ft.ensure(),Ve(()=>b(this,Xt).call(this,s))))),b(this,xt)>0?ae(this,ve,qn).call(this):(cs(b(this,Oe),()=>{B(this,Oe,null)}),B(this,ze,!1))}))},ur=function(){var e=b(this,Ue);return b(this,ze)&&(B(this,Ct,Ut()),b(this,Ue).before(b(this,Ct)),e=b(this,Ct)),e},Hn=function(e){var s=H,n=U,i=ue;Qe(b(this,ot)),De(b(this,ot)),os(b(this,ot).ctx);try{return e()}catch(r){return wr(r),null}finally{Qe(s),De(n),os(i)}},qn=function(){const e=b(this,rt).pending;b(this,We)!==null&&(B(this,vt,document.createDocumentFragment()),b(this,vt).append(b(this,Ct)),Hr(b(this,We),b(this,vt))),b(this,Oe)===null&&B(this,Oe,Ve(()=>e(b(this,Ue))))},hr=function(e){var s;if(!this.has_pending_snippet()){this.parent&&ae(s=this.parent,ve,hr).call(s,e);return}B(this,xt,b(this,xt)+e),b(this,xt)===0&&(B(this,ze,!1),b(this,Oe)&&cs(b(this,Oe),()=>{B(this,Oe,null)}),b(this,vt)&&(b(this,Ue).before(b(this,vt)),B(this,vt,null)))};function Nl(t,e,s){const n=Ns()?nn:ti;if(e.length===0){s(t.map(n));return}var i=ee,r=H,o=Dl();Promise.all(e.map(a=>Rl(a))).then(a=>{o();try{s([...t.map(n),...a])}catch(c){r.f&ht||as(c,r)}i==null||i.deactivate(),ei()}).catch(a=>{as(a,r)})}function Dl(){var t=H,e=U,s=ue,n=ee;return function(){Qe(t),De(e),os(s),n==null||n.activate()}}function ei(){Qe(null),De(null),os(null)}function nn(t){var e=Se|xe,s=U!==null&&U.f&Se?U:null;return H===null||s!==null&&s.f&Le?e|=Le:H.f|=ns,{ctx:ue,deps:null,effects:null,equals:vr,f:e,fn:t,reactions:null,rv:0,v:we,wv:0,parent:s??H,ac:null}}function Rl(t,e){let s=H;s===null&&rl();var n=s.b,i=void 0,r=zt(we),o=!U,a=new Map;return ql(()=>{var f;var c=gr();i=c.promise;try{Promise.resolve(t()).then(c.resolve,c.reject).then(()=>{u===ee&&u.committed&&u.deactivate(),ei()})}catch(d){c.reject(d),ei()}var u=ee;if(o){var l=!n.is_pending();n.update_pending_count(1),u.increment(l),(f=a.get(u))==null||f.reject(is),a.delete(u),a.set(u,c)}const h=(d,p=void 0)=>{if(u.activate(),p)p!==is&&(r.f|=At,Os(r,p));else{r.f&At&&(r.f^=At),Os(r,d);for(const[m,_]of a){if(a.delete(m),m===u)break;_.reject(is)}}o&&(n.update_pending_count(-1),u.decrement(l))};c.promise.then(h,d=>h(null,d||"unknown"))}),ni(()=>{for(const c of a.values())c.reject(is)}),new Promise(c=>{function u(l){function h(){l===i?c(r):u(i)}l.then(h,h)}u(i)})}function pe(t){const e=nn(t);return Gr(e),e}function ti(t){const e=nn(t);return e.equals=br,e}function Ir(t){var e=t.effects;if(e!==null){t.effects=null;for(var s=0;s<e.length;s+=1)Ne(e[s])}}function Ol(t){for(var e=t.parent;e!==null;){if(!(e.f&Se))return e;e=e.parent}return null}function si(t){var e,s=H;Qe(Ol(t));try{t.f&=~$s,Ir(t),e=Qr(t)}finally{Qe(s)}return e}function Cr(t){var e=si(t);if(t.equals(e)||(t.v=e,t.wv=Jr()),!Wt)if(be!==null)be.set(t,t.v);else{var s=(kt||t.f&Le)&&t.deps!==null?St:Te;Ce(t,s)}}const _t=new Map;function zt(t,e){var s={f:0,v:t,reactions:null,equals:vr,rv:0,wv:0};return s}function oe(t,e){const s=zt(t);return Gr(s),s}function Ml(t,e=!1,s=!0){var i;const n=zt(t);return e||(n.equals=br),rs&&s&&ue!==null&&ue.l!==null&&((i=ue.l).s??(i.s=[])).push(n),n}function M(t,e,s=!1){U!==null&&(!Ge||U.f&mr)&&Ns()&&U.f&(Se|ct|Qn|mr)&&!(Ee!=null&&Ee.includes(t))&&dl();let n=s?dt(e):e;return Os(t,n)}function Os(t,e){if(!t.equals(e)){var s=t.v;Wt?_t.set(t,e):_t.set(t,s),t.v=e;var n=ft.ensure();n.capture(t,s),t.f&Se&&(t.f&xe&&si(t),Ce(t,t.f&Le?St:Te)),t.wv=Jr(),Nr(t,xe),Ns()&&H!==null&&H.f&Te&&!(H.f&(ut|Mt))&&(Be===null?Kl([t]):Be.push(t))}return e}function xr(t,e=1){var s=w(t),n=e===1?s++:s--;return M(t,s),n}function Ms(t){M(t,t.v+1)}function Nr(t,e){var s=t.reactions;if(s!==null)for(var n=Ns(),i=s.length,r=0;r<i;r++){var o=s[r],a=o.f;if(!(!n&&o===H)){var c=(a&xe)===0;c&&Ce(o,e),a&Se?a&$s||(o.f|=$s,Nr(o,St)):c&&(a&ct&&qe!==null&&qe.add(o),jt(o))}}}function dt(t){if(typeof t!="object"||t===null||Pt in t)return t;const e=dr(t);if(e!==Qa&&e!==Za)return t;var s=new Map,n=Ys(t),i=oe(0),r=Ht,o=a=>{if(Ht===r)return a();var c=U,u=Ht;De(null),Xr(r);var l=a();return De(c),Xr(u),l};return n&&s.set("length",oe(t.length)),new Proxy(t,{defineProperty(a,c,u){(!("value"in u)||u.configurable===!1||u.enumerable===!1||u.writable===!1)&&hl();var l=s.get(c);return l===void 0?l=o(()=>{var h=oe(u.value);return s.set(c,h),h}):M(l,u.value,!0),!0},deleteProperty(a,c){var u=s.get(c);if(u===void 0){if(c in a){const l=o(()=>oe(we));s.set(c,l),Ms(i)}}else M(u,we),Ms(i);return!0},get(a,c,u){var d;if(c===Pt)return t;var l=s.get(c),h=c in a;if(l===void 0&&(!h||(d=ts(a,c))!=null&&d.writable)&&(l=o(()=>{var p=dt(h?a[c]:we),m=oe(p);return m}),s.set(c,l)),l!==void 0){var f=w(l);return f===we?void 0:f}return Reflect.get(a,c,u)},getOwnPropertyDescriptor(a,c){var u=Reflect.getOwnPropertyDescriptor(a,c);if(u&&"value"in u){var l=s.get(c);l&&(u.value=w(l))}else if(u===void 0){var h=s.get(c),f=h==null?void 0:h.v;if(h!==void 0&&f!==we)return{enumerable:!0,configurable:!0,value:f,writable:!0}}return u},has(a,c){var f;if(c===Pt)return!0;var u=s.get(c),l=u!==void 0&&u.v!==we||Reflect.has(a,c);if(u!==void 0||H!==null&&(!l||(f=ts(a,c))!=null&&f.writable)){u===void 0&&(u=o(()=>{var d=l?dt(a[c]):we,p=oe(d);return p}),s.set(c,u));var h=w(u);if(h===we)return!1}return l},set(a,c,u,l){var y;var h=s.get(c),f=c in a;if(n&&c==="length")for(var d=u;d<h.v;d+=1){var p=s.get(d+"");p!==void 0?M(p,we):d in a&&(p=o(()=>oe(we)),s.set(d+"",p))}if(h===void 0)(!f||(y=ts(a,c))!=null&&y.writable)&&(h=o(()=>oe(void 0)),M(h,dt(u)),s.set(c,h));else{f=h.v!==we;var m=o(()=>dt(u));M(h,m)}var _=Reflect.getOwnPropertyDescriptor(a,c);if(_!=null&&_.set&&_.set.call(l,u),!f){if(n&&typeof c=="string"){var C=s.get("length"),T=Number(c);Number.isInteger(T)&&T>=C.v&&M(C,T+1)}Ms(i)}return!0},ownKeys(a){w(i);var c=Reflect.ownKeys(a).filter(h=>{var f=s.get(h);return f===void 0||f.v!==we});for(var[u,l]of s)l.v!==we&&!(u in a)&&c.push(u);return c},setPrototypeOf(){fl()}})}function Dr(t){try{if(t!==null&&typeof t=="object"&&Pt in t)return t[Pt]}catch{}return t}function Al(t,e){return Object.is(Dr(t),Dr(e))}var Rr,Or,Mr,Ar;function Pl(){if(Rr===void 0){Rr=window,Or=/Firefox/.test(navigator.userAgent);var t=Element.prototype,e=Node.prototype,s=Text.prototype;Mr=ts(e,"firstChild").get,Ar=ts(e,"nextSibling").get,pr(t)&&(t.__click=void 0,t.__className=void 0,t.__attributes=null,t.__style=void 0,t.__e=void 0),pr(s)&&(s.__t=void 0)}}function Ut(t=""){return document.createTextNode(t)}function rn(t){return Mr.call(t)}function As(t){return Ar.call(t)}function L(t,e){return rn(t)}function ls(t,e=!1){{var s=rn(t);return s instanceof Comment&&s.data===""?As(s):s}}function Y(t,e=1,s=!1){let n=t;for(;e--;)n=As(n);return n}function Ll(t){t.textContent=""}function Pr(){return!1}let Lr=!1;function Bl(){Lr||(Lr=!0,document.addEventListener("reset",t=>{Promise.resolve().then(()=>{var e;if(!t.defaultPrevented)for(const s of t.target.elements)(e=s.__on_r)==null||e.call(s)})},{capture:!0}))}function on(t){var e=U,s=H;De(null),Qe(null);try{return t()}finally{De(e),Qe(s)}}function Fl(t,e,s,n=s){t.addEventListener(e,()=>on(s));const i=t.__on_r;i?t.__on_r=()=>{i(),n(!0)}:t.__on_r=()=>n(!0),Bl()}function jl(t){H===null&&U===null&&ll(),U!==null&&U.f&Le&&H===null&&al(),Wt&&ol()}function zl(t,e){var s=e.last;s===null?e.last=e.first=t:(s.next=t,t.prev=s,e.last=t)}function pt(t,e,s,n=!0){var i=H;i!==null&&i.f&Me&&(t|=Me);var r={ctx:ue,deps:null,nodes_start:null,nodes_end:null,f:t|xe,first:null,fn:e,last:null,next:null,parent:i,b:i&&i.b,prev:null,teardown:null,transitions:null,wv:0,ac:null};if(s)try{un(r),r.f|=Jn}catch(c){throw Ne(r),c}else e!==null&&jt(r);if(n){var o=r;if(s&&o.deps===null&&o.teardown===null&&o.nodes_start===null&&o.first===o.last&&!(o.f&ns)&&(o=o.first,t&ct&&t&ss&&o!==null&&(o.f|=ss)),o!==null&&(o.parent=i,i!==null&&zl(o,i),U!==null&&U.f&Se&&!(t&Mt))){var a=U;(a.effects??(a.effects=[])).push(o)}}return r}function Ul(){return U!==null&&!Ge}function ni(t){const e=pt(Xn,null,!1);return Ce(e,Te),e.teardown=t,e}function an(t){jl();var e=H.f,s=!U&&(e&ut)!==0&&(e&Jn)===0;if(s){var n=ue;(n.e??(n.e=[])).push(t)}else return Br(t)}function Br(t){return pt(Kn|tl,t,!1)}function Wl(t){ft.ensure();const e=pt(Mt|ns,t,!0);return(s={})=>new Promise(n=>{s.outro?cs(e,()=>{Ne(e),n(void 0)}):(Ne(e),n(void 0))})}function Hl(t){return pt(Kn,t,!1)}function ql(t){return pt(Qn|ns,t,!0)}function ii(t,e=0){return pt(Xn|e,t,!0)}function te(t,e=[],s=[]){Nl(e,s,n=>{pt(Xn,()=>t(...n.map(w)),!0)})}function ri(t,e=0){var s=pt(ct|e,t,!0);return s}function Ve(t,e=!0){return pt(ut|ns,t,!0,e)}function Fr(t){var e=t.teardown;if(e!==null){const s=Wt,n=U;Vr(!0),De(null);try{e.call(null)}finally{Vr(s),De(n)}}}function jr(t,e=!1){var s=t.first;for(t.first=t.last=null;s!==null;){const i=s.ac;i!==null&&on(()=>{i.abort(is)});var n=s.next;s.f&Mt?s.parent=null:Ne(s,e),s=n}}function Vl(t){for(var e=t.first;e!==null;){var s=e.next;e.f&ut||Ne(e),e=s}}function Ne(t,e=!0){var s=!1;(e||t.f&el)&&t.nodes_start!==null&&t.nodes_end!==null&&(Gl(t.nodes_start,t.nodes_end),s=!0),jr(t,e&&!s),cn(t,0),Ce(t,ht);var n=t.transitions;if(n!==null)for(const r of n)r.stop();Fr(t);var i=t.parent;i!==null&&i.first!==null&&zr(t),t.next=t.prev=t.teardown=t.ctx=t.deps=t.fn=t.nodes_start=t.nodes_end=t.ac=null}function Gl(t,e){for(;t!==null;){var s=t===e?null:As(t);t.remove(),t=s}}function zr(t){var e=t.parent,s=t.prev,n=t.next;s!==null&&(s.next=n),n!==null&&(n.prev=s),e!==null&&(e.first===t&&(e.first=n),e.last===t&&(e.last=s))}function cs(t,e,s=!0){var n=[];oi(t,n,!0),Ur(n,()=>{s&&Ne(t),e&&e()})}function Ur(t,e){var s=t.length;if(s>0){var n=()=>--s||e();for(var i of t)i.out(n)}else e()}function oi(t,e,s){if(!(t.f&Me)){if(t.f^=Me,t.transitions!==null)for(const o of t.transitions)(o.is_global||s)&&e.push(o);for(var n=t.first;n!==null;){var i=n.next,r=(n.f&ss)!==0||(n.f&ut)!==0&&(t.f&ct)!==0;oi(n,e,r?s:!1),n=i}}}function ai(t){Wr(t,!0)}function Wr(t,e){if(t.f&Me){t.f^=Me,t.f&Te||(Ce(t,xe),jt(t));for(var s=t.first;s!==null;){var n=s.next,i=(s.f&ss)!==0||(s.f&ut)!==0;Wr(s,i?e:!1),s=n}if(t.transitions!==null)for(const r of t.transitions)(r.is_global||e)&&r.in()}}function Hr(t,e){for(var s=t.nodes_start,n=t.nodes_end;s!==null;){var i=s===n?null:As(s);e.append(s),s=i}}let us=!1;function qr(t){us=t}let Wt=!1;function Vr(t){Wt=t}let U=null,Ge=!1;function De(t){U=t}let H=null;function Qe(t){H=t}let Ee=null;function Gr(t){U!==null&&(Ee===null?Ee=[t]:Ee.push(t))}let Ie=null,Ae=0,Be=null;function Kl(t){Be=t}let Kr=1,Ps=0,Ht=Ps;function Xr(t){Ht=t}let kt=!1;function Jr(){return++Kr}function ln(t){var h;var e=t.f;if(e&xe)return!0;if(e&St){var s=t.deps,n=(e&Le)!==0;if(e&Se&&(t.f&=~$s),s!==null){var i,r,o=(e&Zs)!==0,a=n&&H!==null&&!kt,c=s.length;if((o||a)&&(H===null||!(H.f&ht))){var u=t,l=u.parent;for(i=0;i<c;i++)r=s[i],(o||!((h=r==null?void 0:r.reactions)!=null&&h.includes(u)))&&(r.reactions??(r.reactions=[])).push(u);o&&(u.f^=Zs),a&&l!==null&&!(l.f&Le)&&(u.f^=Le)}for(i=0;i<c;i++)if(r=s[i],ln(r)&&Cr(r),r.wv>t.wv)return!0}(!n||H!==null&&!kt)&&Ce(t,Te)}return!1}function Yr(t,e,s=!0){var n=t.reactions;if(n!==null&&!(Ee!=null&&Ee.includes(t)))for(var i=0;i<n.length;i++){var r=n[i];r.f&Se?Yr(r,e,!1):e===r&&(s?Ce(r,xe):r.f&Te&&Ce(r,St),jt(r))}}function Qr(t){var m;var e=Ie,s=Ae,n=Be,i=U,r=kt,o=Ee,a=ue,c=Ge,u=Ht,l=t.f;Ie=null,Ae=0,Be=null,kt=(l&Le)!==0&&(Ge||!us||U===null),U=l&(ut|Mt)?null:t,Ee=null,os(t.ctx),Ge=!1,Ht=++Ps,t.ac!==null&&(on(()=>{t.ac.abort(is)}),t.ac=null);try{t.f|=Yn;var h=t.fn,f=h(),d=t.deps;if(Ie!==null){var p;if(cn(t,Ae),d!==null&&Ae>0)for(d.length=Ae+Ie.length,p=0;p<Ie.length;p++)d[Ae+p]=Ie[p];else t.deps=d=Ie;if(!kt||l&Se&&t.reactions!==null)for(p=Ae;p<d.length;p++)((m=d[p]).reactions??(m.reactions=[])).push(t)}else d!==null&&Ae<d.length&&(cn(t,Ae),d.length=Ae);if(Ns()&&Be!==null&&!Ge&&d!==null&&!(t.f&(Se|St|xe)))for(p=0;p<Be.length;p++)Yr(Be[p],t);return i!==null&&i!==t&&(Ps++,Be!==null&&(n===null?n=Be:n.push(...Be))),t.f&At&&(t.f^=At),f}catch(_){return wr(_)}finally{t.f^=Yn,Ie=e,Ae=s,Be=n,U=i,kt=r,Ee=o,os(a),Ge=c,Ht=u}}function Xl(t,e){let s=e.reactions;if(s!==null){var n=Ja.call(s,t);if(n!==-1){var i=s.length-1;i===0?s=e.reactions=null:(s[n]=s[i],s.pop())}}s===null&&e.f&Se&&(Ie===null||!Ie.includes(e))&&(Ce(e,St),e.f&(Le|Zs)||(e.f^=Zs),Ir(e),cn(e,0))}function cn(t,e){var s=t.deps;if(s!==null)for(var n=e;n<s.length;n++)Xl(t,s[n])}function un(t){var e=t.f;if(!(e&ht)){Ce(t,Te);var s=H,n=us;H=t,us=!0;try{e&ct?Vl(t):jr(t),Fr(t);var i=Qr(t);t.teardown=typeof i=="function"?i:null,t.wv=Kr;var r;fr&&yl&&t.f&xe&&t.deps}finally{us=n,H=s}}}async function Jl(){await Promise.resolve(),kl()}function w(t){var e=t.f,s=(e&Se)!==0;if(U!==null&&!Ge){var n=H!==null&&(H.f&ht)!==0;if(!n&&!(Ee!=null&&Ee.includes(t))){var i=U.deps;if(U.f&Yn)t.rv<Ps&&(t.rv=Ps,Ie===null&&i!==null&&i[Ae]===t?Ae++:Ie===null?Ie=[t]:(!kt||!Ie.includes(t))&&Ie.push(t));else{(U.deps??(U.deps=[])).push(t);var r=t.reactions;r===null?t.reactions=[U]:r.includes(U)||r.push(U)}}}else if(s&&t.deps===null&&t.effects===null){var o=t,a=o.parent;a!==null&&!(a.f&Le)&&(o.f^=Le)}if(Wt){if(_t.has(t))return _t.get(t);if(s){o=t;var c=o.v;return(!(o.f&Te)&&o.reactions!==null||Zr(o))&&(c=si(o)),_t.set(o,c),c}}else if(s){if(o=t,be!=null&&be.has(o))return be.get(o);ln(o)&&Cr(o)}if(be!=null&&be.has(t))return be.get(t);if(t.f&At)throw t.v;return t.v}function Zr(t){if(t.v===we)return!0;if(t.deps===null)return!1;for(const e of t.deps)if(_t.has(e)||e.f&Se&&Zr(e))return!0;return!1}function Ls(t){var e=Ge;try{return Ge=!0,t()}finally{Ge=e}}const Yl=-7169;function Ce(t,e){t.f=t.f&Yl|e}const $r=new Set,li=new Set;function Ql(t,e,s,n={}){function i(r){if(n.capture||Fs.call(e,r),!r.cancelBubble)return on(()=>s==null?void 0:s.call(this,r))}return t.startsWith("pointer")||t.startsWith("touch")||t==="wheel"?Ds(()=>{e.addEventListener(t,i,n)}):e.addEventListener(t,i,n),i}function Bs(t,e,s,n,i){var r={capture:n,passive:i},o=Ql(t,e,s,r);(e===document.body||e===window||e===document||e instanceof HTMLMediaElement)&&ni(()=>{e.removeEventListener(t,o,r)})}function ci(t){for(var e=0;e<t.length;e++)$r.add(t[e]);for(var s of li)s(t)}let eo=null;function Fs(t){var T;var e=this,s=e.ownerDocument,n=t.type,i=((T=t.composedPath)==null?void 0:T.call(t))||[],r=i[0]||t.target;eo=t;var o=0,a=eo===t&&t.__root;if(a){var c=i.indexOf(a);if(c!==-1&&(e===document||e===window)){t.__root=e;return}var u=i.indexOf(e);if(u===-1)return;c<=u&&(o=c)}if(r=i[o]||t.target,r!==e){Gn(t,"currentTarget",{configurable:!0,get(){return r||s}});var l=U,h=H;De(null),Qe(null);try{for(var f,d=[];r!==null;){var p=r.assignedSlot||r.parentNode||r.host||null;try{var m=r["__"+n];if(m!=null&&(!r.disabled||t.target===r))if(Ys(m)){var[_,...C]=m;_.apply(r,[t,...C])}else m.call(r,t)}catch(y){f?d.push(y):f=y}if(t.cancelBubble||p===e||p===null)break;r=p}if(f){for(let y of d)queueMicrotask(()=>{throw y});throw f}}finally{t.__root=e,delete t.currentTarget,De(l),Qe(h)}}}function Zl(t){var e=document.createElement("template");return e.innerHTML=t.replaceAll("<!>","<!---->"),e.content}function ui(t,e){var s=H;s.nodes_start===null&&(s.nodes_start=t,s.nodes_end=e)}function X(t,e){var s=(e&Ga)!==0,n=(e&Ka)!==0,i,r=!t.startsWith("<!>");return()=>{i===void 0&&(i=Zl(r?t:"<!>"+t),s||(i=rn(i)));var o=n||Or?document.importNode(i,!0):i.cloneNode(!0);if(s){var a=rn(o),c=o.lastChild;ui(a,c)}else ui(o,o);return o}}function js(){var t=document.createDocumentFragment(),e=document.createComment(""),s=Ut();return t.append(e,s),ui(e,s),t}function W(t,e){t!==null&&t.before(e)}const $l=["touchstart","touchmove"];function ec(t){return $l.includes(t)}function Z(t,e){var s=e==null?"":typeof e=="object"?e+"":e;s!==(t.__t??(t.__t=t.nodeValue))&&(t.__t=s,t.nodeValue=s+"")}function tc(t,e){return sc(t,e)}const hs=new Map;function sc(t,{target:e,anchor:s,props:n={},events:i,context:r,intro:o=!0}){Pl();var a=new Set,c=h=>{for(var f=0;f<h.length;f++){var d=h[f];if(!a.has(d)){a.add(d);var p=ec(d);e.addEventListener(d,Fs,{passive:p});var m=hs.get(d);m===void 0?(document.addEventListener(d,Fs,{passive:p}),hs.set(d,1)):hs.set(d,m+1)}}};c(Vn($r)),li.add(c);var u=void 0,l=Wl(()=>{var h=s??e.appendChild(Ut());return Cl(h,{pending:()=>{}},f=>{if(r){Lt({});var d=ue;d.c=r}i&&(n.$$events=i),u=t(f,n)||{},r&&Bt()}),()=>{var p;for(var f of a){e.removeEventListener(f,Fs);var d=hs.get(f);--d===0?(document.removeEventListener(f,Fs),hs.delete(f)):hs.set(f,d)}li.delete(c),h!==s&&((p=h.parentNode)==null||p.removeChild(h))}});return nc.set(u,l),u}let nc=new WeakMap;class ic{constructor(e,s=!0){Ot(this,"anchor");K(this,bt,new Map);K(this,lt,new Map);K(this,Xe,new Map);K(this,Ks,!0);K(this,Xs,()=>{var e=ee;if(b(this,bt).has(e)){var s=b(this,bt).get(e),n=b(this,lt).get(s);if(n)ai(n);else{var i=b(this,Xe).get(s);i&&(b(this,lt).set(s,i.effect),b(this,Xe).delete(s),i.fragment.lastChild.remove(),this.anchor.before(i.fragment),n=i.effect)}for(const[r,o]of b(this,bt)){if(b(this,bt).delete(r),r===e)break;const a=b(this,Xe).get(o);a&&(Ne(a.effect),b(this,Xe).delete(o))}for(const[r,o]of b(this,lt)){if(r===s)continue;const a=()=>{if(Array.from(b(this,bt).values()).includes(r)){var u=document.createDocumentFragment();Hr(o,u),u.append(Ut()),b(this,Xe).set(r,{effect:o,fragment:u})}else Ne(o);b(this,lt).delete(r)};b(this,Ks)||!n?cs(o,a,!1):a()}}});this.anchor=e,B(this,Ks,s)}ensure(e,s){var n=ee,i=Pr();if(s&&!b(this,lt).has(e)&&!b(this,Xe).has(e))if(i){var r=document.createDocumentFragment(),o=Ut();r.append(o),b(this,Xe).set(e,{effect:Ve(()=>s(o)),fragment:r})}else b(this,lt).set(e,Ve(()=>s(this.anchor)));if(b(this,bt).set(n,e),i){for(const[a,c]of b(this,lt))a===e?n.skipped_effects.delete(c):n.skipped_effects.add(c);for(const[a,c]of b(this,Xe))a===e?n.skipped_effects.delete(c.effect):n.skipped_effects.add(c.effect);n.add_callback(b(this,Xs))}else b(this,Xs).call(this)}}bt=new WeakMap,lt=new WeakMap,Xe=new WeakMap,Ks=new WeakMap,Xs=new WeakMap;function hi(t){ue===null&&il(),rs&&ue.l!==null?rc(ue).m.push(t):an(()=>{const e=Ls(t);if(typeof e=="function")return e})}function rc(t){var e=t.l;return e.u??(e.u={a:[],b:[],m:[]})}function ie(t,e,s=!1){var n=new ic(t),i=s?ss:0;function r(o,a){n.ensure(o,a)}ri(()=>{var o=!1;e((a,c=!0)=>{o=!0,r(c,a)}),o||r(!1,null)},i)}function zs(t,e){return e}function oc(t,e,s){for(var n=t.items,i=[],r=e.length,o=0;o<r;o++)oi(e[o].e,i,!0);var a=r>0&&i.length===0&&s!==null;if(a){var c=s.parentNode;Ll(c),c.append(s),n.clear(),Ze(t,e[0].prev,e[r-1].next)}Ur(i,()=>{for(var u=0;u<r;u++){var l=e[u];a||(n.delete(l.k),Ze(t,l.prev,l.next)),Ne(l.e,!a)}})}function Us(t,e,s,n,i,r=null){var o=t,a={flags:e,items:new Map,first:null};{var c=t;o=c.appendChild(Ut())}var u=null,l=!1,h=new Map,f=ti(()=>{var _=s();return Ys(_)?_:_==null?[]:Vn(_)}),d,p;function m(){ac(p,d,a,h,o,i,e,n,s),r!==null&&(d.length===0?u?ai(u):u=Ve(()=>r(o)):u!==null&&cs(u,()=>{u=null}))}ri(()=>{p??(p=H),d=w(f);var _=d.length;if(!(l&&_===0)){l=_===0;var C,T,y,g;if(Pr()){var v=new Set,I=ee;for(T=0;T<_;T+=1){y=d[T],g=n(y,T);var x=a.items.get(g)??h.get(g);x?to(x,y,T):(C=so(null,a,null,null,y,g,T,i,e,s,!0),h.set(g,C)),v.add(g)}for(const[S,k]of a.items)v.has(S)||I.skipped_effects.add(k.e);I.add_callback(m)}else m();w(f)}})}function ac(t,e,s,n,i,r,o,a,c){var u=e.length,l=s.items,h=s.first,f=h,d,p=null,m=[],_=[],C,T,y,g;for(g=0;g<u;g+=1){if(C=e[g],T=a(C,g),y=l.get(T),y===void 0){var v=n.get(T);if(v!==void 0){n.delete(T),l.set(T,v);var I=p?p.next:f;Ze(s,p,v),Ze(s,v,I),fi(v,I,i),p=v}else{var x=f?f.e.nodes_start:i;p=so(x,s,p,p===null?s.first:p.next,C,T,g,r,o,c)}l.set(T,p),m=[],_=[],f=p.next;continue}if(to(y,C,g),y.e.f&Me&&ai(y.e),y!==f){if(d!==void 0&&d.has(y)){if(m.length<_.length){var S=_[0],k;p=S.prev;var A=m[0],j=m[m.length-1];for(k=0;k<m.length;k+=1)fi(m[k],S,i);for(k=0;k<_.length;k+=1)d.delete(_[k]);Ze(s,A.prev,j.next),Ze(s,p,A),Ze(s,j,S),f=S,p=j,g-=1,m=[],_=[]}else d.delete(y),fi(y,f,i),Ze(s,y.prev,y.next),Ze(s,y,p===null?s.first:p.next),Ze(s,p,y),p=y;continue}for(m=[],_=[];f!==null&&f.k!==T;)f.e.f&Me||(d??(d=new Set)).add(f),_.push(f),f=f.next;if(f===null)continue;y=f}m.push(y),p=y,f=y.next}if(f!==null||d!==void 0){for(var F=d===void 0?[]:Vn(d);f!==null;)f.e.f&Me||F.push(f),f=f.next;var G=F.length;if(G>0){var z=u===0?i:null;oc(s,F,z)}}t.first=s.first&&s.first.e,t.last=p&&p.e;for(var E of n.values())Ne(E.e);n.clear()}function to(t,e,s,n){Os(t.v,e),t.i=s}function so(t,e,s,n,i,r,o,a,c,u,l){var h=(c&$)!==0,f=(c&Js)===0,d=h?f?Ml(i,!1,!1):zt(i):i,p=c&de?zt(o):o,m={i:p,v:d,k:r,a:null,e:null,prev:s,next:n};try{if(t===null){var _=document.createDocumentFragment();_.append(t=Ut())}return m.e=Ve(()=>a(t,d,p,u),vl),m.e.prev=s&&s.e,m.e.next=n&&n.e,s===null?l||(e.first=m):(s.next=m,s.e.next=m.e),n!==null&&(n.prev=m,n.e.prev=m.e),m}finally{}}function fi(t,e,s){for(var n=t.next?t.next.e.nodes_start:s,i=e?e.e.nodes_start:s,r=t.e.nodes_start;r!==null&&r!==n;){var o=As(r);i.before(r),r=o}}function Ze(t,e,s){e===null?t.first=s:(e.next=s,e.e.next=s&&s.e),s!==null&&(s.prev=e,s.e.prev=e&&e.e)}function lc(t,e,s){var n=t==null?"":""+t;return n=n?n+" "+e:e,n===""?null:n}function no(t,e,s,n,i,r){var o=t.__className;if(o!==s||o===void 0){var a=lc(s,n);a==null?t.removeAttribute("class"):t.className=a,t.__className=s}return r}function io(t,e,s=!1){if(t.multiple){if(e==null)return;if(!Ys(e))return gl();for(var n of t.options)n.selected=e.includes(ro(n));return}for(n of t.options){var i=ro(n);if(Al(i,e)){n.selected=!0;return}}(!s||e!==void 0)&&(t.selectedIndex=-1)}function cc(t){var e=new MutationObserver(()=>{io(t,t.__value)});e.observe(t,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["value"]}),ni(()=>{e.disconnect()})}function ro(t){return"__value"in t?t.__value:t.value}const uc=Symbol("is custom element"),hc=Symbol("is html");function fc(t,e){e?t.hasAttribute("selected")||t.setAttribute("selected",""):t.removeAttribute("selected")}function hn(t,e,s,n){var i=dc(t);i[e]!==(i[e]=s)&&(e==="loading"&&(t[nl]=s),s==null?t.removeAttribute(e):typeof s!="string"&&pc(t).includes(e)?t[e]=s:t.setAttribute(e,s))}function dc(t){return t.__attributes??(t.__attributes={[uc]:t.nodeName.includes("-"),[hc]:t.namespaceURI===Xa})}var oo=new Map;function pc(t){var e=t.getAttribute("is")||t.nodeName,s=oo.get(e);if(s)return s;oo.set(e,s=[]);for(var n,i=t,r=Element.prototype;r!==i;){n=Ya(i);for(var o in n)n[o].set&&s.push(o);i=dr(i)}return s}function gc(t,e,s=e){var n=new WeakSet;Fl(t,"input",async i=>{var r=i?t.defaultValue:t.value;if(r=di(t)?pi(r):r,s(r),ee!==null&&n.add(ee),await Jl(),r!==(r=e())){var o=t.selectionStart,a=t.selectionEnd,c=t.value.length;if(t.value=r??"",a!==null){var u=t.value.length;o===a&&a===c&&u>c?(t.selectionStart=u,t.selectionEnd=u):(t.selectionStart=o,t.selectionEnd=Math.min(a,u))}}}),Ls(e)==null&&t.value&&(s(di(t)?pi(t.value):t.value),ee!==null&&n.add(ee)),ii(()=>{var i=e();if(t===document.activeElement){var r=tn??ee;if(n.has(r))return}di(t)&&i===pi(t.value)||t.type==="date"&&!i&&!t.value||i!==t.value&&(t.value=i??"")})}function di(t){var e=t.type;return e==="number"||e==="range"}function pi(t){return t===""?null:+t}function ao(t,e){return t===e||(t==null?void 0:t[Pt])===e}function mc(t={},e,s,n){return Hl(()=>{var i,r;return ii(()=>{i=r,r=[],Ls(()=>{t!==s(...r)&&(e(t,...r),i&&ao(s(...i),t)&&e(null,...i))})}),()=>{Ds(()=>{r&&ao(s(...r),t)&&e(null,...r)})}}),t}let fn=!1;function vc(t){var e=fn;try{return fn=!1,[t(),fn]}finally{fn=e}}function lo(t,e,s,n){var y;var i=!rs||(s&Wa)!==0,r=(s&qa)!==0,o=(s&Va)!==0,a=n,c=!0,u=()=>(c&&(c=!1,a=o?Ls(n):n),a),l;if(r){var h=Pt in t||sl in t;l=((y=ts(t,e))==null?void 0:y.set)??(h&&e in t?g=>t[e]=g:void 0)}var f,d=!1;r?[f,d]=vc(()=>t[e]):f=t[e],f===void 0&&n!==void 0&&(f=u(),l&&(i&&ul(),l(f)));var p;if(i?p=()=>{var g=t[e];return g===void 0?u():(c=!0,g)}:p=()=>{var g=t[e];return g!==void 0&&(a=void 0),g===void 0?a:g},i&&!(s&Ha))return p;if(l){var m=t.$$legacy;return function(g,v){return arguments.length>0?((!i||!v||m||d)&&l(v?p():g),g):p()}}var _=!1,C=(s&Ua?nn:ti)(()=>(_=!1,p()));r&&w(C);var T=H;return function(g,v){if(arguments.length>0){const I=v?w(C):i&&r?dt(g):g;return M(C,I),_=!0,a!==void 0&&(a=I),g}return Wt&&_||T.f&ht?C.v:w(C)}}function co(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(t){const e=Math.random()*16|0;return(t==="x"?e:e&3|8).toString(16)})}function gi(t,e,s){let n="";if(s){const i=new Date;i.setTime(i.getTime()+s*24*60*60*1e3),n="; expires="+i.toUTCString()}document.cookie=t+"="+(e||"")+n+"; path=/; secure; samesite=strict"}function mi(t){const e=t+"=",s=document.cookie.split(";");for(let n=0;n<s.length;n++){let i=s[n];for(;i.charAt(0)===" ";)i=i.substring(1,i.length);if(i.indexOf(e)===0)return i.substring(e.length,i.length)}return null}function uo(){const t="uniqueUserID";let e=mi(t);return e||(e=co(),gi(t,e,365)),e}function $e(t,e,s={},n={}){const i="https://admin-api.wineater.com/api/widget-events";let r=mi("uniqueUserID");r||(r=uo());const o={user_agent:navigator.userAgent,screen_width:window.screen.width,screen_height:window.screen.height,language:navigator.language,platform:navigator.platform},a=new Date().toISOString();let c=mi("sessionID");c||(c=co(),gi("sessionID",c,1));const u={event_type:t,store_id:e,session_id:c,event_time:a,data:s,meta:{...n,user_id:r},device_info:o,region:navigator.language.split("-")[1]||null,language:navigator.language.split("-")[0]||"en"};return fetch(i,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(u)}).then(l=>l.ok?l.json():l.json().then(h=>{throw new Error(h.message||"Failed to track widget event")})).catch(l=>{throw console.error("Widget event tracking error:",l),l})}var ho={},bc=function(t,e,s,n,i){var r=new Worker(ho[e]||(ho[e]=URL.createObjectURL(new Blob([t+';addEventListener("error",function(e){e=e.error;postMessage({$e$:[e.message,e.code,e.stack]})})'],{type:"text/javascript"}))));return r.onmessage=function(o){var a=o.data,c=a.$e$;if(c){var u=new Error(c[0]);u.code=c[1],u.stack=c[2],i(u,null)}else i(null,a)},r.postMessage(s,n),r},Fe=Uint8Array,Re=Uint16Array,dn=Int32Array,pn=new Fe([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),gn=new Fe([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),vi=new Fe([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),fo=function(t,e){for(var s=new Re(31),n=0;n<31;++n)s[n]=e+=1<<t[n-1];for(var i=new dn(s[30]),n=1;n<30;++n)for(var r=s[n];r<s[n+1];++r)i[r]=r-s[n]<<5|n;return{b:s,r:i}},po=fo(pn,2),yc=po.b,mn=po.r;yc[28]=258,mn[258]=28;for(var wc=fo(gn,0),bi=wc.r,vn=new Re(32768),ne=0;ne<32768;++ne){var Tt=(ne&43690)>>1|(ne&21845)<<1;Tt=(Tt&52428)>>2|(Tt&13107)<<2,Tt=(Tt&61680)>>4|(Tt&3855)<<4,vn[ne]=((Tt&65280)>>8|(Tt&255)<<8)>>1}for(var fs=function(t,e,s){for(var n=t.length,i=0,r=new Re(e);i<n;++i)t[i]&&++r[t[i]-1];var o=new Re(e);for(i=1;i<e;++i)o[i]=o[i-1]+r[i-1]<<1;var a;if(s){a=new Re(1<<e);var c=15-e;for(i=0;i<n;++i)if(t[i])for(var u=i<<4|t[i],l=e-t[i],h=o[t[i]-1]++<<l,f=h|(1<<l)-1;h<=f;++h)a[vn[h]>>c]=u}else for(a=new Re(n),i=0;i<n;++i)t[i]&&(a[i]=vn[o[t[i]-1]++]>>15-t[i]);return a},Et=new Fe(288),ne=0;ne<144;++ne)Et[ne]=8;for(var ne=144;ne<256;++ne)Et[ne]=9;for(var ne=256;ne<280;++ne)Et[ne]=7;for(var ne=280;ne<288;++ne)Et[ne]=8;for(var Ws=new Fe(32),ne=0;ne<32;++ne)Ws[ne]=5;var go=fs(Et,9,0),mo=fs(Ws,5,0),yi=function(t){return(t+7)/8|0},vo=function(t,e,s){return(e==null||e<0)&&(e=0),(s==null||s>t.length)&&(s=t.length),new Fe(t.subarray(e,s))},Sc=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],bo=function(t,e,s){var n=new Error(e||Sc[t]);if(n.code=t,Error.captureStackTrace&&Error.captureStackTrace(n,bo),!s)throw n;return n},et=function(t,e,s){s<<=e&7;var n=e/8|0;t[n]|=s,t[n+1]|=s>>8},ds=function(t,e,s){s<<=e&7;var n=e/8|0;t[n]|=s,t[n+1]|=s>>8,t[n+2]|=s>>16},bn=function(t,e){for(var s=[],n=0;n<t.length;++n)t[n]&&s.push({s:n,f:t[n]});var i=s.length,r=s.slice();if(!i)return{t:ki,l:0};if(i==1){var o=new Fe(s[0].s+1);return o[s[0].s]=1,{t:o,l:1}}s.sort(function(v,I){return v.f-I.f}),s.push({s:-1,f:25001});var a=s[0],c=s[1],u=0,l=1,h=2;for(s[0]={s:-1,f:a.f+c.f,l:a,r:c};l!=i-1;)a=s[s[u].f<s[h].f?u++:h++],c=s[u!=l&&s[u].f<s[h].f?u++:h++],s[l++]={s:-1,f:a.f+c.f,l:a,r:c};for(var f=r[0].s,n=1;n<i;++n)r[n].s>f&&(f=r[n].s);var d=new Re(f+1),p=yn(s[l-1],d,0);if(p>e){var n=0,m=0,_=p-e,C=1<<_;for(r.sort(function(I,x){return d[x.s]-d[I.s]||I.f-x.f});n<i;++n){var T=r[n].s;if(d[T]>e)m+=C-(1<<p-d[T]),d[T]=e;else break}for(m>>=_;m>0;){var y=r[n].s;d[y]<e?m-=1<<e-d[y]++-1:++n}for(;n>=0&&m;--n){var g=r[n].s;d[g]==e&&(--d[g],++m)}p=e}return{t:new Fe(d),l:p}},yn=function(t,e,s){return t.s==-1?Math.max(yn(t.l,e,s+1),yn(t.r,e,s+1)):e[t.s]=s},wi=function(t){for(var e=t.length;e&&!t[--e];);for(var s=new Re(++e),n=0,i=t[0],r=1,o=function(c){s[n++]=c},a=1;a<=e;++a)if(t[a]==i&&a!=e)++r;else{if(!i&&r>2){for(;r>138;r-=138)o(32754);r>2&&(o(r>10?r-11<<5|28690:r-3<<5|12305),r=0)}else if(r>3){for(o(i),--r;r>6;r-=6)o(8304);r>2&&(o(r-3<<5|8208),r=0)}for(;r--;)o(i);r=1,i=t[a]}return{c:s.subarray(0,n),n:e}},ps=function(t,e){for(var s=0,n=0;n<e.length;++n)s+=t[n]*e[n];return s},Si=function(t,e,s){var n=s.length,i=yi(e+2);t[i]=n&255,t[i+1]=n>>8,t[i+2]=t[i]^255,t[i+3]=t[i+1]^255;for(var r=0;r<n;++r)t[i+r+4]=s[r];return(i+4+n)*8},_i=function(t,e,s,n,i,r,o,a,c,u,l){et(e,l++,s),++i[256];for(var h=bn(i,15),f=h.t,d=h.l,p=bn(r,15),m=p.t,_=p.l,C=wi(f),T=C.c,y=C.n,g=wi(m),v=g.c,I=g.n,x=new Re(19),S=0;S<T.length;++S)++x[T[S]&31];for(var S=0;S<v.length;++S)++x[v[S]&31];for(var k=bn(x,7),A=k.t,j=k.l,F=19;F>4&&!A[vi[F-1]];--F);var G=u+5<<3,z=ps(i,Et)+ps(r,Ws)+o,E=ps(i,f)+ps(r,m)+o+14+3*F+ps(x,A)+2*x[16]+3*x[17]+7*x[18];if(c>=0&&G<=z&&G<=E)return Si(e,l,t.subarray(c,c+u));var D,O,N,V;if(et(e,l,1+(E<z)),l+=2,E<z){D=fs(f,d,0),O=f,N=fs(m,_,0),V=m;var J=fs(A,j,0);et(e,l,y-257),et(e,l+5,I-1),et(e,l+10,F-4),l+=14;for(var S=0;S<F;++S)et(e,l+3*S,A[vi[S]]);l+=3*F;for(var se=[T,v],fe=0;fe<2;++fe)for(var me=se[fe],S=0;S<me.length;++S){var R=me[S]&31;et(e,l,J[R]),l+=A[R],R>15&&(et(e,l,me[S]>>5&127),l+=me[S]>>12)}}else D=go,O=Et,N=mo,V=Ws;for(var S=0;S<a;++S){var P=n[S];if(P>255){var R=P>>18&31;ds(e,l,D[R+257]),l+=O[R+257],R>7&&(et(e,l,P>>23&31),l+=pn[R]);var re=P&31;ds(e,l,N[re]),l+=V[re],re>3&&(ds(e,l,P>>5&8191),l+=gn[re])}else ds(e,l,D[P]),l+=O[P]}return ds(e,l,D[256]),l+O[256]},yo=new dn([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),ki=new Fe(0),wo=function(t,e,s,n,i,r){var o=r.z||t.length,a=new Fe(n+o+5*(1+Math.ceil(o/7e3))+i),c=a.subarray(n,a.length-i),u=r.l,l=(r.r||0)&7;if(e){l&&(c[0]=r.r>>3);for(var h=yo[e-1],f=h>>13,d=h&8191,p=(1<<s)-1,m=r.p||new Re(32768),_=r.h||new Re(p+1),C=Math.ceil(s/3),T=2*C,y=function(Dt){return(t[Dt]^t[Dt+1]<<C^t[Dt+2]<<T)&p},g=new dn(25e3),v=new Re(288),I=new Re(32),x=0,S=0,k=r.i||0,A=0,j=r.w||0,F=0;k+2<o;++k){var G=y(k),z=k&32767,E=_[G];if(m[z]=E,_[G]=z,j<=k){var D=o-k;if((x>7e3||A>24576)&&(D>423||!u)){l=_i(t,c,0,g,v,I,S,A,F,k-F,l),A=x=S=0,F=k;for(var O=0;O<286;++O)v[O]=0;for(var O=0;O<30;++O)I[O]=0}var N=2,V=0,J=d,se=z-E&32767;if(D>2&&G==y(k-se))for(var fe=Math.min(f,D)-1,me=Math.min(32767,k),R=Math.min(258,D);se<=me&&--J&&z!=E;){if(t[k+N]==t[k+N-se]){for(var P=0;P<R&&t[k+P]==t[k+P-se];++P);if(P>N){if(N=P,V=se,P>fe)break;for(var re=Math.min(se,P-2),yt=0,O=0;O<re;++O){var wt=k-se+O&32767,Zt=m[wt],Je=wt-Zt&32767;Je>yt&&(yt=Je,E=wt)}}}z=E,E=m[z],se+=z-E&32767}if(V){g[A++]=268435456|mn[N]<<18|bi[V];var Cs=mn[N]&31,xs=bi[V]&31;S+=pn[Cs]+gn[xs],++v[257+Cs],++I[xs],j=k+N,++x}else g[A++]=t[k],++v[t[k]]}}for(k=Math.max(k,j);k<o;++k)g[A++]=t[k],++v[t[k]];l=_i(t,c,u,g,v,I,S,A,F,k-F,l),u||(r.r=l&7|c[l/8|0]<<3,l-=7,r.h=_,r.p=m,r.i=k,r.w=j)}else{for(var k=r.w||0;k<o+u;k+=65535){var $t=k+65535;$t>=o&&(c[l/8|0]=u,$t=o),l=Si(c,l+1,t.subarray(k,$t))}r.i=o}return vo(a,0,n+yi(l)+i)},So=function(){for(var t=new Int32Array(256),e=0;e<256;++e){for(var s=e,n=9;--n;)s=(s&1&&-306674912)^s>>>1;t[e]=s}return t}(),_o=function(){var t=-1;return{p:function(e){for(var s=t,n=0;n<e.length;++n)s=So[s&255^e[n]]^s>>>8;t=s},d:function(){return~t}}},Ti=function(t,e,s,n,i){if(!i&&(i={l:1},e.dictionary)){var r=e.dictionary.subarray(-32768),o=new Fe(r.length+t.length);o.set(r),o.set(t,r.length),t=o,i.w=r.length}return wo(t,e.level==null?6:e.level,e.mem==null?i.l?Math.ceil(Math.max(8,Math.min(13,Math.log(t.length)))*1.5):20:12+e.mem,s,n,i)},_c=function(t,e){var s={};for(var n in t)s[n]=t[n];for(var n in e)s[n]=e[n];return s},ko=function(t,e,s){for(var n=t(),i=t.toString(),r=i.slice(i.indexOf("[")+1,i.lastIndexOf("]")).replace(/\s+/g,"").split(","),o=0;o<n.length;++o){var a=n[o],c=r[o];if(typeof a=="function"){e+=";"+c+"=";var u=a.toString();if(a.prototype)if(u.indexOf("[native code]")!=-1){var l=u.indexOf(" ",8)+1;e+=u.slice(l,u.indexOf("(",l))}else{e+=u;for(var h in a.prototype)e+=";"+c+".prototype."+h+"="+a.prototype[h].toString()}else e+=u}else s[c]=a}return e},wn=[],kc=function(t){var e=[];for(var s in t)t[s].buffer&&e.push((t[s]=new t[s].constructor(t[s])).buffer);return e},Tc=function(t,e,s,n){if(!wn[s]){for(var i="",r={},o=t.length-1,a=0;a<o;++a)i=ko(t[a],i,r);wn[s]={c:ko(t[o],i,r),e:r}}var c=_c({},wn[s].e);return bc(wn[s].c+";onmessage=function(e){for(var k in e.data)self[k]=e.data[k];onmessage="+e.toString()+"}",s,c,kc(c),n)},Ec=function(){return[Fe,Re,dn,pn,gn,vi,mn,bi,go,Et,mo,Ws,vn,yo,ki,fs,et,ds,bn,yn,wi,ps,Si,_i,yi,vo,wo,Ti,xc,To]},Ic=function(){return[Eo,Io,Sn,_o,So]},To=function(t){return postMessage(t,[t.buffer])},Cc=function(t,e,s,n,i,r){var o=Tc(s,n,i,function(a,c){o.terminate(),r(a,c)});return o.postMessage([t,e],e.consume?[t.buffer]:[]),function(){o.terminate()}},Sn=function(t,e,s){for(;s;++e)t[e]=s,s>>>=8},Eo=function(t,e){var s=e.filename;if(t[0]=31,t[1]=139,t[2]=8,t[8]=e.level<2?4:e.level==9?2:0,t[9]=3,e.mtime!=0&&Sn(t,4,Math.floor(new Date(e.mtime||Date.now())/1e3)),s){t[3]=8;for(var n=0;n<=s.length;++n)t[n+10]=s.charCodeAt(n)}},Io=function(t){return 10+(t.filename?t.filename.length+1:0)};function xc(t,e){return Ti(t,e||{},0,0)}function Nc(t,e,s){return s||(s=e,e={}),typeof s!="function"&&bo(7),Cc(t,e,[Ec,Ic,function(){return[Co]}],function(n){return To(Co(n.data[0],n.data[1]))},2,s)}function Co(t,e){e||(e={});var s=_o(),n=t.length;s.p(t);var i=Ti(t,e,Io(e),8),r=i.length;return Eo(i,e),Sn(i,r-8,s.d()),Sn(i,r-4,n),i}var Dc=typeof TextDecoder<"u"&&new TextDecoder,Rc=0;try{Dc.decode(ki,{stream:!0}),Rc=1}catch{}class xo{constructor(){this.idx=1,this.backDict={}}getKey(e){let s=!1;return this.backDict[e]||(s=!0,this.backDict[e]=this.idx++),[this.backDict[e],s]}}class Oc{constructor(e){this.dict=new xo,this.app=e.app,this.isDictDisabled=e.isDictDisabled}sendSetAttribute(e,s,n){if(this.isDictDisabled){const i=[12,e,s,n];return this.app.send(i)}else{const i=[51,e,this.applyDict(s),this.applyDict(n)];return this.app.send(i)}}applyDict(e){const[s,n]=this.dict.getKey(e);return n&&this.app.send([50,s,e]),s}clear(){this.dict=new xo}}class Mc{constructor(e,s){this.app=e,this.startParams=s,this.conditions=[],this.hasStarted=!1,this.createConditionFromFilter=n=>{if(n.value.length){const i=Ac(n);if(i.type)return i}},this.durationInt=null}setConditions(e){this.conditions=e}async fetchConditions(e,s){try{const n=await fetch(`${this.app.options.ingestPoint}/v1/web/conditions/${e}`,{method:"GET",headers:{Authorization:`Bearer ${s}`}}),{conditions:i}=await n.json(),r=[];i.forEach(o=>{o.filters.forEach(c=>{let u;c.type==="fetch"?(u={type:"network_request",subConditions:[],name:o.name},c.filters.forEach(l=>{const h=this.createConditionFromFilter(l);h&&u.subConditions.push(h)})):u=this.createConditionFromFilter(c),u&&(u.type==="session_duration"&&this.processDuration(u.value[0],o.name),r.push({...u,name:o.name}))})}),this.conditions=r}catch{this.app.debug.error("Critical: cannot fetch start conditions")}}trigger(e){if(!this.hasStarted)try{this.hasStarted=!0,this.app.start(this.startParams,void 0,e)}catch(s){this.app.debug.error(s)}}processMessage(e){if(!this.hasStarted)switch(e[0]){case 78:this.jsExceptionEvent(e);break;case 27:this.customEvent(e);break;case 68:this.clickEvent(e);break;case 122:this.pageLocationEvent(e);break;case 83:this.networkRequest(e);break}}processFlags(e){const s=this.conditions.filter(n=>n.type==="feature_flag");s.length&&s.forEach(n=>{const i=gs[n.operator];i&&e.find(r=>i(r.key,n.value))&&this.trigger(n.name)})}processDuration(e,s){this.durationInt=setInterval(()=>{performance.now()>e&&this.trigger(s)},1e3),this.app.attachStopCallback(()=>{this.durationInt&&clearInterval(this.durationInt)})}networkRequest(e){const s=this.conditions.filter(n=>n.type==="network_request");s.length&&s.forEach(n=>{const i=n.subConditions.filter(r=>r.operator!=="isAny");i.length?i.every(o=>{let a;switch(o.key){case"url":a=e[3];break;case"status":a=e[6];break;case"method":a=e[2];break;case"duration":a=e[8];break}const c=gs[o.operator];if(c&&c(a,o.value))return!0})&&this.trigger(n.name):i.length===0&&n.subConditions.length&&this.trigger(n.name)})}customEvent(e){const s=this.conditions.filter(n=>n.type==="custom_event");s.length&&s.forEach(n=>{const i=gs[n.operator];i&&(i(e[1],n.value)||i(e[2],n.value))&&this.trigger(n.name)})}clickEvent(e){const s=this.conditions.filter(n=>n.type==="click");s.length&&s.forEach(n=>{const i=gs[n.operator];i&&(i(e[3],n.value)||i(e[4],n.value))&&this.trigger(n.name)})}pageLocationEvent(e){const s=this.conditions.filter(n=>n.type==="visited_url");s&&s.forEach(n=>{const i=gs[n.operator];i&&i(e[1],n.value)&&this.trigger(n.name)})}jsExceptionEvent(e){const s=[e[1],e[2],e[3]],n=this.conditions.filter(i=>i.type==="exception");n&&n.forEach(i=>{const r=gs[i.operator];r&&s.some(o=>r(o,i.value))&&this.trigger(i.name)})}}const gs={is:(t,e)=>e.some(s=>t.includes(s)),isAny:()=>!0,isNot:(t,e)=>!e.some(s=>t.includes(s)),contains:(t,e)=>e.some(s=>t.includes(s)),notContains:(t,e)=>!e.some(s=>t.includes(s)),startsWith:(t,e)=>e.some(s=>t.startsWith(s)),endsWith:(t,e)=>e.some(s=>t.endsWith(s)),greaterThan:(t,e)=>t>e,greaterOrEqual:(t,e)=>t>=e,lessOrEqual:(t,e)=>t<=e,lessThan:(t,e)=>t<e},Ac=t=>{const e={on:"is",notOn:"isNot",">":"greaterThan","<":"lessThan","=":"is","<=":"lessOrEqual",">=":"greaterOrEqual"},s=i=>{if(Object.keys(e).includes(i))return e[i]};let n={type:"",operator:"",value:t.value,key:""};switch(t.type){case"click":n={type:"click",operator:s(t.operator),value:t.value,key:""};break;case"location":n={type:"visited_url",operator:t.operator,value:t.value,key:""};break;case"custom":n={type:"custom_event",operator:t.operator,value:t.value,key:""};break;case"metadata":n={type:t.source==="featureFlag"?"feature_flag":t.type,operator:t.operator,value:t.value,key:""};break;case"error":n={type:"exception",operator:t.operator,value:t.value,key:""};break;case"duration":n={type:"session_duration",value:t.value[0],key:""};break;case"fetchUrl":n={type:"network_request",key:"url",operator:t.operator,value:t.value};break;case"fetchStatusCode":n={type:"network_request",key:"status",operator:s(t.operator),value:t.value};break;case"fetchMethod":n={type:"network_request",key:"method",operator:s(t.operator),value:t.value};break;case"fetchDuration":n={type:"network_request",key:"duration",operator:s(t.operator),value:t.value};break}return n};class Pc{constructor(e){this.app=e,this.flags=[],this.storageKey="__openreplay_flags";const s=this.app.sessionStorage.getItem(this.storageKey);if(s){const n=s.split(";").filter(Boolean);this.flags=n.map(i=>JSON.parse(i))}}getFeatureFlag(e){return this.flags.find(s=>s.key===e)}isFlagEnabled(e){return this.flags.findIndex(s=>s.key===e)!==-1}onFlagsLoad(e){this.onFlagsCb=e}async reloadFlags(e){const s=this.app.sessionStorage.getItem(this.storageKey),n={};s&&s.split(";").filter(Boolean).forEach(l=>{const h=JSON.parse(l);n[h.key]={key:h.key,value:h.value}});const i=this.app.session.getInfo(),r=this.app.session.userInfo,o={projectID:i.projectID,userID:i.userID,metadata:i.metadata,referrer:document.referrer,os:r.userOS,device:r.userDevice,country:r.userCountry,state:r.userState,city:r.userCity,browser:r.userBrowser,persistFlags:n},a=e??this.app.session.getSessionToken(),c=await fetch(this.app.options.ingestPoint+"/v1/web/feature-flags",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${a}`},body:JSON.stringify(o)});if(c.status===200){const u=await c.json();return this.handleFlags(u.flags)}}handleFlags(e){var r;const s=[];e.forEach(o=>{o.is_persist&&s.push(o)});let n="";return this.diffPersist(s).forEach(o=>{n+=`${JSON.stringify(o)};`}),this.app.sessionStorage.setItem(this.storageKey,n),this.flags=e,(r=this.onFlagsCb)==null?void 0:r.call(this,e)}clearPersistFlags(){this.app.sessionStorage.removeItem(this.storageKey)}diffPersist(e){const s=this.app.sessionStorage.getItem(this.storageKey);if(!s)return e;const i=s.split(";").filter(Boolean).map(r=>JSON.parse(r));return e.filter(r=>i.findIndex(o=>o.key===r.key)===-1)}}const No={htmlmasked:"hidden",masked:"obscured"},tt=!(typeof window>"u"),Lc=tt&&navigator.userAgent.match(/firefox|fxios/i),Bc=1e5;let Ei=tt?Date.now()-performance.now():0;function Ii(){Ei=Date.now()-performance.now()}function ms(){return Ei}const Ke=tt&&performance.now?()=>Math.round(performance.now()+Ei):()=>Date.now(),Ci="repeat"in String.prototype?t=>"*".repeat(t.length):t=>t.replace(/./g,"*");function Do(t){return t.trim().replace(/\s+/g," ")}function Ro(t){return t.startsWith("https://")||t.startsWith("http://")}const _n="https://docs.openreplay.com",Oo={};function It(t,e,s="/"){Oo[t]||(console.warn(`OpenReplay: ${t} is deprecated. ${e?`Please, use ${e} instead.`:""} Visit ${_n}${s} for more information.`),Oo[t]=!0)}function xi(t){let e=t.getAttribute("data-openreplay-label");return e!==null||(e=t.getAttribute("data-asayer-label"),e!==null&&It('"data-asayer-label" attribute','"data-openreplay-label" attribute',"/")),e}function qt(t,e){const s=`data-openreplay-${e}`;return t.hasAttribute(s)?(No[e]&&It(`"${s}" attribute`,`"${No[e]}" attribute`,"/installation/sanitize-data"),!0):!1}function Fc(t){try{return!!t.contentDocument}catch{return!1}}function Mo(t){try{return t instanceof HTMLIFrameElement?t.contentDocument:t instanceof Window?t.document:t instanceof Document?t.defaultView:"nodeType"in t?t.nodeType:"addEventListener"in t&&t.addEventListener,!0}catch(e){if(e instanceof DOMException&&e.name==="SecurityError")return!1}return!0}function Ao(t){return t.toString(16).padStart(2,"0")}function jc(t){const e=new Uint8Array(t/2),s=window.crypto||window.msCrypto;return s?(s.getRandomValues(e),Array.from(e,Ao).join("")):Array.from({length:t},()=>Ao(Math.floor(Math.random()*16))).join("")}function Po(){try{return window.self&&window.top&&window.self!==window.top}catch{return!0}}function Ni(t){return window.Zone&&"__symbol__"in window.Zone?window.Zone.__symbol__(t):t}function Lo(t,e){if(e)return new MutationObserver(t);{const s=Ni("MutationObserver");return new window[s](t)}}function Bo(t,e,s,n,i){if(!Mo(t))return;let r="addEventListener";i||(r=Ni("addEventListener"));try{t[r]?t[r](e,s,n):t.addEventListener(e,s,n)}catch(o){const a=o.message;console.error(`Openreplay: ${a}; if this error is caused by an IframeObserver, ignore it`,e,t)}}function Fo(t,e,s,n,i){if(!Mo(t))return;let r="removeEventListener";i||(r=Ni("removeEventListener"));try{t[r]?t[r](e,s,n):t.removeEventListener(e,s,n)}catch(o){const a=o.message;console.error(`Openreplay: ${a}; if this error is caused by an IframeObserver, ignore it`,e,t)}}class zc{constructor(){this.taskQueue=[],this.isRunning=!1}addTask(e){this.taskQueue.push(e),this.runTasks()}runTasks(){if(this.isRunning||this.taskQueue.length===0)return;this.isRunning=!0;const e=()=>{if(this.taskQueue.length===0){this.isRunning=!1;return}const s=this.taskQueue.shift();Promise.resolve(s()).then(()=>{requestAnimationFrame(()=>e())})};e()}}const Uc=new zc;function Wc(t){Uc.addTask(t)}function jo(t,e){const s={...t};for(const n in e)if(e.hasOwnProperty(n)){const i=e[n],r=t[n];typeof i=="object"&&!Array.isArray(i)&&i!==null?s[n]=jo(r||{},i):s[n]=i}return s}function Vt(t){return[0,t]}function Hc(t,e){return[5,t,e]}function qc(t,e){return[6,t,e]}function Vc(){return[7]}function Gc(t,e,s,n,i){return[8,t,e,s,n,i]}function Kc(t,e,s){return[9,t,e,s]}function Xc(t,e,s){return[10,t,e,s]}function Jc(t){return[11,t]}function zo(t,e){return[13,t,e]}function Yc(t,e){return[14,t,e]}function Qc(t,e,s){return[16,t,e,s]}function Zc(t,e,s){return[18,t,e,s]}function $c(t,e){return[19,t,e]}function eu(t,e){return[20,t,e]}function tu(t,e){return[22,t,e]}function su(t,e,s,n,i,r,o,a,c){return[23,t,e,s,n,i,r,o,a,c]}function nu(t,e,s){return[24,t,e,s]}function iu(t,e){return[27,t,e]}function ru(t){return[28,t]}function ou(t){return[29,t]}function Uo(t,e){return[30,t,e]}function au(t,e,s,n){return[49,t,e,s,n]}function lu(t,e){return[54,t,e]}function cu(t){return[55,t]}function Wo(t,e,s,n){return[57,t,e,s,n]}function Ho(t){return[58,t]}function Di(t,e,s,n){return[60,t,e,s,n]}function uu(t,e,s){return[61,t,e,s]}function hu(t,e){return[63,t,e]}function fu(t,e){return[64,t,e]}function du(t,e,s,n,i,r){return[68,t,e,s,n,i,r]}function Ri(t,e){return[70,t,e]}function qo(t,e,s){return[71,t,e,s]}function Oi(t,e,s,n){return[73,t,e,s,n]}function Vo(t,e){return[75,t,e]}function Go(t,e){return[76,t,e]}function pu(t,e){return[77,t,e]}function Mi(t,e,s,n){return[78,t,e,s,n]}function kn(t,e,s,n,i,r,o,a,c){return[83,t,e,s,n,i,r,o,a,c]}function gu(t,e,s,n,i,r){return[84,t,e,s,n,i,r]}function mu(t,e,s,n,i,r){return[112,t,e,s,n,i,r]}function Ko(t,e,s){return[113,t,e,s]}function vu(t){return[114,t]}function Xo(t){return[115,t]}function Jo(t,e,s,n,i,r,o,a,c,u){return[116,t,e,s,n,i,r,o,a,c,u]}function Tn(t){return[117,t]}function Gt(t){return[118,t]}function bu(t,e){return[119,t,e]}function yu(t){return[120,t]}function wu(t,e,s,n){return[122,t,e,s,n]}const Ai=tt&&"performance"in window&&"memory"in performance?performance:{memory:{}},Pi=tt?(navigator.deviceMemory||0)*1024:0,Li=Ai.memory.jsHeapSizeLimit||0;function Su(t,e){if(!Object.assign({capturePerformance:!0},e).capturePerformance)return;let n,i;const r=()=>{n===void 0||n===-1||(n++,requestAnimationFrame(r))};t.ticker.attach(()=>{i===void 0||i===-1||i++},0,!1);const o=()=>{n===void 0||i===void 0||(t.send(au(n,i,Ai.memory.totalJSHeapSize||0,Ai.memory.usedJSHeapSize||0)),i=n=document.hidden?-1:0)};t.attachStartCallback(()=>{i=n=-1,o(),r()}),t.attachStopCallback(()=>{i=n=void 0}),t.ticker.attach(o,40,!1),document.hidden!==void 0&&t.attachEventListener(document,"visibilitychange",o,!1,!1)}const Yo="__or__watched_tags__";class _u{constructor(e){this.intervals={},this.tags=[],this.sessionStorage=e.sessionStorage,this.errLog=e.errLog,this.onTag=e.onTag;const s=JSON.parse(e.sessionStorage.getItem(Yo)??"[]");this.setTags(s),this.observer=new IntersectionObserver(n=>{n.forEach(i=>{if(i.isIntersecting&&i.target){const r=i.target.__or_watcher_tagname;r&&this.onTagRendered(r),this.observer.unobserve(i.target)}})})}async fetchTags(e,s){return fetch(`${e}/v1/web/tags`,{method:"GET",headers:{Authorization:`Bearer ${s}`}}).then(n=>n.json()).then(({tags:n})=>{if(n&&n.length){this.setTags(n);const i=JSON.stringify(n);this.sessionStorage.setItem(Yo,i||"")}}).catch(n=>this.errLog(n))}setTags(e){this.tags=e,this.intervals={},e.forEach(s=>{this.intervals[s.id]=setInterval(()=>{const n=document.querySelectorAll(s.selector);if(n.length>0){const i=n[0];i.__or_watcher_tagname=s.id,this.observer.observe(i)}},500)})}onTagRendered(e){this.intervals[e]&&clearInterval(this.intervals[e]),this.onTag(e)}clear(){this.tags.forEach(e=>{clearInterval(this.intervals[e.id])}),this.tags=[],this.intervals={},this.observer.disconnect()}}const ku={position:"fixed",top:0,left:0,width:"100vw",height:"100vh",background:"rgba(0, 0, 0, 0.40)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:999999,fontFamily:'-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"'},Tu={display:"flex",flexDirection:"column",gap:"2rem",alignItems:"center",padding:"1.5rem",borderRadius:"2px",border:"1px solid #D9D9D9",background:"#FFF",width:"22rem"},En={display:"flex","flex-direction":"column",gap:"unset","align-items":"center",padding:"unset",fontFamily:'-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"',"border-radius":"2px",border:"1px solid #D9D9D9",background:"rgba(255, 255, 255, 0.75)",width:"22rem"},Eu={fontFamily:"Verdana, sans-serif",fontSize:"1.25rem",fontStyle:"normal",fontWeight:"500",lineHeight:"1.75rem",color:"rgba(0, 0, 0, 0.85)"},Iu={borderTop:"1px solid rgba(0, 0, 0, 0.06)",borderBottom:"1px solid rgba(0, 0, 0, 0.06)",padding:"1.25rem 0rem",color:"rgba(0, 0, 0, 0.85)",fontFamily:"Verdana, sans-serif",fontSize:"13px",fontStyle:"normal",fontWeight:"400",lineHeight:"auto",whiteSpace:"pre-wrap"},Cu={display:"flex",padding:"0.4rem 0.9375rem",justifyContent:"center",alignItems:"center",gap:"0.625rem",borderRadius:"0.25rem",border:"1px solid #394EFF",background:"#394EFF",boxShadow:"0px 2px 0px 0px rgba(0, 0, 0, 0.04)",color:"#FFF",textAlign:"center",fontFamily:"Verdana, sans-serif",fontSize:"1rem",fontStyle:"normal",fontWeight:"500",lineHeight:"1.5rem",cursor:"pointer"},Qo={fontFamily:"Verdana, sans-serif",fontSize:"13px",fontWeight:"500",lineHeight:"auto",display:"flex",justifyContent:"space-between",width:"100%",cursor:"pointer"},vs={display:"flex",flexDirection:"column",alignItems:"flex-start",gap:"0.625rem",fontSize:"13px",lineHeight:"auto"},xu={padding:"0.5rem",gap:"0.5rem",fontFamily:"Verdana, sans-serif",fontSize:"16px",fontStyle:"normal",fontWeight:"500",lineHeight:"auto",color:"white",display:"flex",alignItems:"center",width:"100%",borderRadius:"2px",background:"rgba(0, 0, 0, 0.75)",boxSizing:"border-box"},bs={boxSizing:"border-box",display:"block",width:"100%",borderBottom:"1px solid #D9D9D9",background:"#FFF",padding:"0.65rem",alignSelf:"stretch",color:"#000",fontFamily:"Verdana, sans-serif",fontStyle:"normal",fontWeight:"400"},Nu={...bs,display:"flex",flexDirection:"column",alignItems:"center",gap:"0.625rem"},Zo={fontSize:"1.25rem",fontWeight:"500",cursor:"pointer",color:"#394EFF"},$o={display:"flex",padding:"0.4rem 0.9375rem",justifyContent:"center",alignItems:"center",gap:"0.625rem",borderRadius:"0.25rem",border:"1px solid #394EFF",background:"#394EFF",boxShadow:"0px 2px 0px 0px rgba(0, 0, 0, 0.04)",color:"#FFF",textAlign:"center",fontFamily:"Verdana, sans-serif",fontSize:"1rem",fontStyle:"normal",fontWeight:"500",lineHeight:"1.5rem",width:"100%",boxSizing:"border-box",cursor:"pointer"},ea={marginTop:"1rem",marginBottom:"1rem",cursor:"pointer",display:"block",fontWeight:"500",fontSize:"13px!important",lineHeight:"auto"},Du={display:"flex",justifyContent:"space-between",alignItems:"center",gap:"1rem",padding:"0.5rem",width:"100%",boxSizing:"border-box"},ta={display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",borderRadius:"6.25em",outline:"1px solid #394EFF",fontSize:"13px",height:"24px",width:"24px"},Ru={display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",borderRadius:"6.25em",outline:"1px solid #D2DFFF",boxShadow:"0px 2px 0px 0px rgba(0, 0, 0, 0.04)",background:"#D2DFFF",fontSize:"13px",height:"24px",width:"24px"},sa={borderRadius:"0.375rem",border:"1px solid rgba(0, 0, 0, 0.06)",background:"#F5F7FF",boxShadow:"0px 2px 0px 0px rgba(0, 0, 0, 0.04)",display:"flex",flexDirection:"column",padding:"0.625rem 0.9375rem",gap:"0.5rem",alignSelf:"stretch"},na={fontWeight:"bold"},Ou={fontSize:"13px",lineHeight:"auto"},ia={marginRight:"0.5rem",cursor:"pointer",color:"#394EFF",textAlign:"center",fontFamily:"Verdana, sans-serif",fontSize:"13px",fontStyle:"normal",fontWeight:"500",lineHeight:"auto"},Mu={...ia,display:"flex",padding:"0.25rem 0.9375rem",justifyContent:"center",alignItems:"center",gap:"0.5rem",borderRadius:"0.25rem",border:"1px solid #394EFF"},Au={display:"flex",justifyContent:"space-between",alignItems:"center",width:"100%",boxSizing:"border-box"},Pu={border:"4px solid rgba(255, 255, 255, 0.4)",width:"16px",height:"16px",borderRadius:"50%",borderLeftColor:"#fff",animation:"spin 0.5s linear infinite"},ra={Standard:{width:1280,height:720}};class Lu{constructor(e){this.app=e,this.mediaRecorder=null,this.recordedChunks=[],this.stream=null,this.recStartTs=null}async startRecording(e,s,n,i){this.recStartTs=this.app.timestamp();const r=s;try{this.stream=await navigator.mediaDevices.getUserMedia({video:i?{...r,frameRate:{ideal:e}}:!1,audio:n}),this.mediaRecorder=new MediaRecorder(this.stream,{mimeType:"video/webm;codecs=vp9"}),this.recordedChunks=[],this.mediaRecorder.ondataavailable=o=>{o.data.size>0&&this.recordedChunks.push(o.data)},this.mediaRecorder.start()}catch(o){console.error(o)}}async stopRecording(){return new Promise(e=>{this.mediaRecorder&&(this.mediaRecorder.onstop=()=>{const s=new Blob(this.recordedChunks,{type:"video/webm"});e(s)},this.mediaRecorder.stop())})}async sendToAPI(){const e=await this.stopRecording();return fetch(`${this.app.options.ingestPoint}/v1/web/uxt/upload-url`,{headers:{Authorization:`Bearer ${this.app.session.getSessionToken()}`}}).then(s=>{if(s.ok)return s.json();throw new Error("Failed to get upload url")}).then(({url:s})=>fetch(s,{method:"PUT",headers:{"Content-Type":"video/webm"},body:e})).catch(console.error).finally(()=>{this.discard()})}async saveToFile(e="recorded-video.webm"){const s=await this.stopRecording(),n=URL.createObjectURL(s),i=document.createElement("a");i.style.display="none",i.href=n,i.download=e,document.body.appendChild(i),i.click(),window.URL.revokeObjectURL(n),document.body.removeChild(i)}discard(){var e,s;(e=this.mediaRecorder)==null||e.stop(),(s=this.stream)==null||s.getTracks().forEach(n=>n.stop())}}function Bu(t,e){e.onmousedown=function(s){const n=t.getBoundingClientRect(),i=s.clientX-n.left,r=s.clientY-n.top;t.style.position="fixed",t.style.zIndex=99999999999999,o(s.pageX,s.pageY);function o(u,l){let h=u-i,f=l-r;h<=5&&(h=5),f<=5&&(f=5),h>=window.innerWidth-n.width&&(h=window.innerWidth-n.width),f>=window.innerHeight-n.height&&(f=window.innerHeight-n.height),t.style.left=`${h}px`,t.style.top=`${f}px`}function a(u){o(u.pageX,u.pageY)}document.addEventListener("mousemove",a);const c=()=>{document.removeEventListener("mousemove",a),document.removeEventListener("mouseup",c)};document.addEventListener("mouseup",c)},e.ondragstart=function(){return!1}}function Fu(){const t=document.createElement("div");t.className="grid";for(let e=0;e<16;e++){const s=document.createElement("div");Object.assign(s.style,{width:"2px",height:"2px",borderRadius:"10px",background:"white"}),s.className="cell",t.appendChild(s)}return Object.assign(t.style,{display:"grid",gridTemplateColumns:"repeat(4, 1fr)",gridTemplateRows:"repeat(4, 1fr)",gap:"2px",cursor:"grab"}),t}function ju(){const t=document.createElement("div");Object.assign(t.style,{width:"0",height:"0",borderLeft:"7px solid transparent",borderRight:"7px solid transparent",borderBottom:"7px solid white"});const e=document.createElement("div");return e.appendChild(t),Object.assign(e.style,{display:"flex",alignItems:"center",justifyContent:"center",width:"16px",height:"16px",cursor:"pointer",marginLeft:"auto",transform:"rotate(180deg)"}),e}function zu(){const t=document.createElement("style");t.type="text/css",t.innerText=`@keyframes spin {
|
|
1
|
+
(function(Q,$){typeof exports=="object"&&typeof module<"u"?module.exports=$():typeof define=="function"&&define.amd?define($):(Q=typeof globalThis<"u"?globalThis:Q||self,Q.WineaterChatbot=$())})(this,function(){"use strict";var Lf=Object.defineProperty;var Ua=Q=>{throw TypeError(Q)};var Bf=(Q,$,fe)=>$ in Q?Lf(Q,$,{enumerable:!0,configurable:!0,writable:!0,value:fe}):Q[$]=fe;var Ot=(Q,$,fe)=>Bf(Q,typeof $!="symbol"?$+"":$,fe),lr=(Q,$,fe)=>$.has(Q)||Ua("Cannot "+fe);var b=(Q,$,fe)=>(lr(Q,$,"read from private field"),fe?fe.call(Q):$.get(Q)),K=(Q,$,fe)=>$.has(Q)?Ua("Cannot add the same private member more than once"):$ instanceof WeakSet?$.add(Q):$.set(Q,fe),B=(Q,$,fe,Js)=>(lr(Q,$,"write to private field"),Js?Js.call(Q,fe):$.set(Q,fe),fe),ae=(Q,$,fe)=>(lr(Q,$,"access private method"),fe);var Ba,_s,ks,Ts,Xt,Ks,xs,Es,ye,cr,ts,ur,qa,je,Ue,rr,rt,Yt,ot,qe,Oe,at,vt,It,Jt,Ct,Qt,Nt,Un,qn,ve,Ff,zf,hr,Hn,Vn,dr,bt,lt,Xe,Xs,Ys,Is,Zt,Fa;const Q="5";typeof window<"u"&&((Ba=window.__svelte??(window.__svelte={})).v??(Ba.v=new Set)).add(Q);const $=1,fe=2,Js=16,Wa=1,Ha=2,Va=4,Ga=8,Ka=16,Xa=1,Ya=2,we=Symbol(),Ja="http://www.w3.org/1999/xhtml",fr=!1;var Qs=Array.isArray,Qa=Array.prototype.indexOf,Gn=Array.from,Kn=Object.defineProperty,ss=Object.getOwnPropertyDescriptor,Za=Object.getOwnPropertyDescriptors,$a=Object.prototype,el=Array.prototype,pr=Object.getPrototypeOf,gr=Object.isExtensible;function tl(t){for(var e=0;e<t.length;e++)t[e]()}function mr(){var t,e,s=new Promise((n,i)=>{t=n,e=i});return{promise:s,resolve:t,reject:e}}const Se=2,Xn=4,Yn=8,ct=16,ut=32,Mt=64,Zs=128,Te=1024,Ce=2048,St=4096,Me=8192,ht=16384,Jn=32768,ns=65536,vr=1<<17,sl=1<<18,is=1<<19,nl=1<<20,Le=256,$s=512,en=32768,Qn=1<<21,Zn=1<<22,At=1<<23,Pt=Symbol("$state"),il=Symbol("legacy props"),rl=Symbol(""),rs=new class extends Error{constructor(){super(...arguments);Ot(this,"name","StaleReactionError");Ot(this,"message","The reaction that called `getAbortSignal()` was re-run or destroyed")}};function ol(t){throw new Error("https://svelte.dev/e/lifecycle_outside_component")}function al(){throw new Error("https://svelte.dev/e/async_derived_orphan")}function ll(t){throw new Error("https://svelte.dev/e/effect_in_teardown")}function cl(){throw new Error("https://svelte.dev/e/effect_in_unowned_derived")}function ul(t){throw new Error("https://svelte.dev/e/effect_orphan")}function hl(){throw new Error("https://svelte.dev/e/effect_update_depth_exceeded")}function dl(t){throw new Error("https://svelte.dev/e/props_invalid_value")}function fl(){throw new Error("https://svelte.dev/e/state_descriptors_fixed")}function pl(){throw new Error("https://svelte.dev/e/state_prototype_fixed")}function gl(){throw new Error("https://svelte.dev/e/state_unsafe_mutation")}function ml(){throw new Error("https://svelte.dev/e/svelte_boundary_reset_onerror")}function vl(){console.warn("https://svelte.dev/e/select_multiple_invalid_value")}function bl(){console.warn("https://svelte.dev/e/svelte_boundary_reset_noop")}let yl=!1;function br(t){return t===this.v}function wl(t,e){return t!=t?e==e:t!==e||t!==null&&typeof t=="object"||typeof t=="function"}function yr(t){return!wl(t,this.v)}let os=!1,Sl=!1;function _l(){os=!0}let ue=null;function as(t){ue=t}function Lt(t,e=!1,s){ue={p:ue,c:null,e:null,s:t,x:null,l:os&&!e?{s:null,u:null,$:[]}:null}}function Bt(t){var e=ue,s=e.e;if(s!==null){e.e=null;for(var n of s)Fr(n)}return t!==void 0&&(e.x=t),ue=e.p,t??{}}function Ds(){return!os||ue!==null&&ue.l===null}let Ft=[];function wr(){var t=Ft;Ft=[],tl(t)}function Rs(t){if(Ft.length===0&&!Os){var e=Ft;queueMicrotask(()=>{e===Ft&&wr()})}Ft.push(t)}function kl(){for(;Ft.length>0;)wr()}const Tl=new WeakMap;function Sr(t){var e=W;if(e===null)return U.f|=At,t;if(e.f&Jn)ls(t,e);else{if(!(e.f&Zs))throw!e.parent&&t instanceof Error&&_r(t),t;e.b.error(t)}}function ls(t,e){for(;e!==null;){if(e.f&Zs)try{e.b.error(t);return}catch(s){t=s}e=e.parent}throw t instanceof Error&&_r(t),t}function _r(t){const e=Tl.get(t);e&&(Kn(t,"message",{value:e.message}),Kn(t,"stack",{value:e.stack}))}const tn=new Set;let ee=null,sn=null,be=null,$n=new Set,Je=[],nn=null,ei=!1,Os=!1;const jn=class jn{constructor(){K(this,ye);Ot(this,"committed",!1);Ot(this,"current",new Map);K(this,_s,new Map);K(this,ks,new Set);K(this,Ts,0);K(this,Xt,0);K(this,Ks,null);K(this,xs,[]);K(this,Es,[]);Ot(this,"skipped_effects",new Set)}process(e){Je=[],sn=null,this.apply();var s={parent:null,effect:null,effects:[],render_effects:[],block_effects:[]};for(const n of e)ae(this,ye,cr).call(this,n,s);ae(this,ye,ur).call(this),b(this,Xt)>0?(ae(this,ye,ts).call(this,s.effects),ae(this,ye,ts).call(this,s.render_effects),ae(this,ye,ts).call(this,s.block_effects)):(sn=this,ee=null,Tr(s.render_effects),Tr(s.effects),sn=null),be=null}capture(e,s){b(this,_s).has(e)||b(this,_s).set(e,s),this.current.set(e,e.v),be==null||be.set(e,e.v)}activate(){ee=this}deactivate(){ee=null,be=null}flush(){if(Je.length>0){if(this.activate(),kr(),ee!==null&&ee!==this)return}else ae(this,ye,ur).call(this);this.deactivate();for(const e of $n)if($n.delete(e),e(),ee!==null)break}increment(e){B(this,Ts,b(this,Ts)+1),e&&B(this,Xt,b(this,Xt)+1)}decrement(e){B(this,Ts,b(this,Ts)-1),e&&B(this,Xt,b(this,Xt)-1);for(const s of b(this,xs))Ie(s,Ce),zt(s);for(const s of b(this,Es))Ie(s,St),zt(s);B(this,xs,[]),B(this,Es,[]),this.flush()}add_callback(e){b(this,ks).add(e)}settled(){return(b(this,Ks)??B(this,Ks,mr())).promise}static ensure(){if(ee===null){const e=ee=new jn;tn.add(ee),Os||jn.enqueue(()=>{ee===e&&e.flush()})}return ee}static enqueue(e){Rs(e)}apply(){}};_s=new WeakMap,ks=new WeakMap,Ts=new WeakMap,Xt=new WeakMap,Ks=new WeakMap,xs=new WeakMap,Es=new WeakMap,ye=new WeakSet,cr=function(e,s){var l;e.f^=Te;for(var n=e.first;n!==null;){var i=n.f,r=(i&(ut|Mt))!==0,o=r&&(i&Te)!==0,a=o||(i&Me)!==0||this.skipped_effects.has(n);if(n.f&Zs&&((l=n.b)!=null&&l.is_pending())&&(s={parent:s,effect:n,effects:[],render_effects:[],block_effects:[]}),!a&&n.fn!==null){r?n.f^=Te:i&Xn?s.effects.push(n):cn(n)&&(n.f&ct&&s.block_effects.push(n),hn(n));var c=n.first;if(c!==null){n=c;continue}}var u=n.parent;for(n=n.next;n===null&&u!==null;)u===s.effect&&(ae(this,ye,ts).call(this,s.effects),ae(this,ye,ts).call(this,s.render_effects),ae(this,ye,ts).call(this,s.block_effects),s=s.parent),n=u.next,u=u.parent}},ts=function(e){for(const s of e)(s.f&Ce?b(this,xs):b(this,Es)).push(s),Ie(s,Te)},ur=function(){if(b(this,Xt)===0){for(const e of b(this,ks))e();b(this,ks).clear()}b(this,Ts)===0&&ae(this,ye,qa).call(this)},qa=function(){var i,r;if(tn.size>1){b(this,_s).clear();var e=be,s=!0,n={parent:null,effect:null,effects:[],render_effects:[],block_effects:[]};for(const o of tn){if(o===this){s=!1;continue}const a=[];for(const[u,l]of this.current){if(o.current.has(u))if(s&&l!==o.current.get(u))o.current.set(u,l);else continue;a.push(u)}if(a.length===0)continue;const c=[...o.current.keys()].filter(u=>!this.current.has(u));if(c.length>0){const u=new Set,l=new Map;for(const h of a)xr(h,c,u,l);if(Je.length>0){ee=o,o.apply();for(const h of Je)ae(i=o,ye,cr).call(i,h,n);Je=[],o.deactivate()}}}ee=null,be=e}this.committed=!0,tn.delete(this),(r=b(this,Ks))==null||r.resolve()};let dt=jn;function xl(t){var e=Os;Os=!0;try{for(var s;;){if(kl(),Je.length===0&&(ee==null||ee.flush(),Je.length===0))return nn=null,s;kr()}}finally{Os=e}}function kr(){var t=hs;ei=!0;try{var e=0;for(Gr(!0);Je.length>0;){var s=dt.ensure();if(e++>1e3){var n,i;El()}s.process(Je),_t.clear()}}finally{ei=!1,Gr(t),nn=null}}function El(){try{hl()}catch(t){ls(t,nn)}}let He=null;function Tr(t){var e=t.length;if(e!==0){for(var s=0;s<e;){var n=t[s++];if(!(n.f&(ht|Me))&&cn(n)&&(He=new Set,hn(n),n.deps===null&&n.first===null&&n.nodes_start===null&&(n.teardown===null&&n.ac===null?qr(n):n.fn=null),(He==null?void 0:He.size)>0)){_t.clear();for(const i of He){if(i.f&(ht|Me))continue;const r=[i];let o=i.parent;for(;o!==null;)He.has(o)&&(He.delete(o),r.push(o)),o=o.parent;for(let a=r.length-1;a>=0;a--){const c=r[a];c.f&(ht|Me)||hn(c)}}He.clear()}}He=null}}function xr(t,e,s,n){if(!s.has(t)&&(s.add(t),t.reactions!==null))for(const i of t.reactions){const r=i.f;r&Se?xr(i,e,s,n):r&(Zn|ct)&&!(r&Ce)&&Er(i,e,n)&&(Ie(i,Ce),zt(i))}}function Er(t,e,s){const n=s.get(t);if(n!==void 0)return n;if(t.deps!==null)for(const i of t.deps){if(e.includes(i))return!0;if(i.f&Se&&Er(i,e,s))return s.set(i,!0),!0}return s.set(t,!1),!1}function zt(t){for(var e=nn=t;e.parent!==null;){e=e.parent;var s=e.f;if(ei&&e===W&&s&ct)return;if(s&(Mt|ut)){if(!(s&Te))return;e.f^=Te}}Je.push(e)}function Il(t){let e=0,s=jt(0),n;return()=>{Wl()&&(w(s),ri(()=>(e===0&&(n=Bs(()=>t(()=>As(s)))),e+=1,()=>{Rs(()=>{e-=1,e===0&&(n==null||n(),n=void 0,As(s))})})))}}var Cl=ns|is|Zs;function Nl(t,e,s){new Dl(t,e,s)}class Dl{constructor(e,s,n){K(this,ve);Ot(this,"parent");K(this,je,!1);K(this,Ue);K(this,rr,null);K(this,rt);K(this,Yt);K(this,ot);K(this,qe,null);K(this,Oe,null);K(this,at,null);K(this,vt,null);K(this,It,null);K(this,Jt,0);K(this,Ct,0);K(this,Qt,!1);K(this,Nt,null);K(this,Un,()=>{b(this,Nt)&&Ms(b(this,Nt),b(this,Jt))});K(this,qn,Il(()=>(B(this,Nt,jt(b(this,Jt))),()=>{B(this,Nt,null)})));B(this,Ue,e),B(this,rt,s),B(this,Yt,n),this.parent=W.b,B(this,je,!!b(this,rt).pending),B(this,ot,oi(()=>{W.b=this;{var i=ae(this,ve,hr).call(this);try{B(this,qe,Ve(()=>n(i)))}catch(r){this.error(r)}b(this,Ct)>0?ae(this,ve,Vn).call(this):B(this,je,!1)}return()=>{var r;(r=b(this,It))==null||r.remove()}},Cl))}is_pending(){return b(this,je)||!!this.parent&&this.parent.is_pending()}has_pending_snippet(){return!!b(this,rt).pending}update_pending_count(e){ae(this,ve,dr).call(this,e),B(this,Jt,b(this,Jt)+e),$n.add(b(this,Un))}get_effect_pending(){return b(this,qn).call(this),w(b(this,Nt))}error(e){var s=b(this,rt).onerror;let n=b(this,rt).failed;if(b(this,Qt)||!s&&!n)throw e;b(this,qe)&&(Ne(b(this,qe)),B(this,qe,null)),b(this,Oe)&&(Ne(b(this,Oe)),B(this,Oe,null)),b(this,at)&&(Ne(b(this,at)),B(this,at,null));var i=!1,r=!1;const o=()=>{if(i){bl();return}i=!0,r&&ml(),dt.ensure(),B(this,Jt,0),b(this,at)!==null&&us(b(this,at),()=>{B(this,at,null)}),B(this,je,this.has_pending_snippet()),B(this,qe,ae(this,ve,Hn).call(this,()=>(B(this,Qt,!1),Ve(()=>b(this,Yt).call(this,b(this,Ue)))))),b(this,Ct)>0?ae(this,ve,Vn).call(this):B(this,je,!1)};var a=U;try{De(null),r=!0,s==null||s(e,o),r=!1}catch(c){ls(c,b(this,ot)&&b(this,ot).parent)}finally{De(a)}n&&Rs(()=>{B(this,at,ae(this,ve,Hn).call(this,()=>{dt.ensure(),B(this,Qt,!0);try{return Ve(()=>{n(b(this,Ue),()=>e,()=>o)})}catch(c){return ls(c,b(this,ot).parent),null}finally{B(this,Qt,!1)}}))})}}je=new WeakMap,Ue=new WeakMap,rr=new WeakMap,rt=new WeakMap,Yt=new WeakMap,ot=new WeakMap,qe=new WeakMap,Oe=new WeakMap,at=new WeakMap,vt=new WeakMap,It=new WeakMap,Jt=new WeakMap,Ct=new WeakMap,Qt=new WeakMap,Nt=new WeakMap,Un=new WeakMap,qn=new WeakMap,ve=new WeakSet,Ff=function(){try{B(this,qe,Ve(()=>b(this,Yt).call(this,b(this,Ue))))}catch(e){this.error(e)}B(this,je,!1)},zf=function(){const e=b(this,rt).pending;e&&(B(this,Oe,Ve(()=>e(b(this,Ue)))),dt.enqueue(()=>{var s=ae(this,ve,hr).call(this);B(this,qe,ae(this,ve,Hn).call(this,()=>(dt.ensure(),Ve(()=>b(this,Yt).call(this,s))))),b(this,Ct)>0?ae(this,ve,Vn).call(this):(us(b(this,Oe),()=>{B(this,Oe,null)}),B(this,je,!1))}))},hr=function(){var e=b(this,Ue);return b(this,je)&&(B(this,It,Ut()),b(this,Ue).before(b(this,It)),e=b(this,It)),e},Hn=function(e){var s=W,n=U,i=ue;Qe(b(this,ot)),De(b(this,ot)),as(b(this,ot).ctx);try{return e()}catch(r){return Sr(r),null}finally{Qe(s),De(n),as(i)}},Vn=function(){const e=b(this,rt).pending;b(this,qe)!==null&&(B(this,vt,document.createDocumentFragment()),b(this,vt).append(b(this,It)),Vr(b(this,qe),b(this,vt))),b(this,Oe)===null&&B(this,Oe,Ve(()=>e(b(this,Ue))))},dr=function(e){var s;if(!this.has_pending_snippet()){this.parent&&ae(s=this.parent,ve,dr).call(s,e);return}B(this,Ct,b(this,Ct)+e),b(this,Ct)===0&&(B(this,je,!1),b(this,Oe)&&us(b(this,Oe),()=>{B(this,Oe,null)}),b(this,vt)&&(b(this,Ue).before(b(this,vt)),B(this,vt,null)))};function Rl(t,e,s){const n=Ds()?rn:si;if(e.length===0){s(t.map(n));return}var i=ee,r=W,o=Ol();Promise.all(e.map(a=>Ml(a))).then(a=>{o();try{s([...t.map(n),...a])}catch(c){r.f&ht||ls(c,r)}i==null||i.deactivate(),ti()}).catch(a=>{ls(a,r)})}function Ol(){var t=W,e=U,s=ue,n=ee;return function(){Qe(t),De(e),as(s),n==null||n.activate()}}function ti(){Qe(null),De(null),as(null)}function rn(t){var e=Se|Ce,s=U!==null&&U.f&Se?U:null;return W===null||s!==null&&s.f&Le?e|=Le:W.f|=is,{ctx:ue,deps:null,effects:null,equals:br,f:e,fn:t,reactions:null,rv:0,v:we,wv:0,parent:s??W,ac:null}}function Ml(t,e){let s=W;s===null&&al();var n=s.b,i=void 0,r=jt(we),o=!U,a=new Map;return Vl(()=>{var d;var c=mr();i=c.promise;try{Promise.resolve(t()).then(c.resolve,c.reject).then(()=>{u===ee&&u.committed&&u.deactivate(),ti()})}catch(f){c.reject(f),ti()}var u=ee;if(o){var l=!n.is_pending();n.update_pending_count(1),u.increment(l),(d=a.get(u))==null||d.reject(rs),a.delete(u),a.set(u,c)}const h=(f,p=void 0)=>{if(u.activate(),p)p!==rs&&(r.f|=At,Ms(r,p));else{r.f&At&&(r.f^=At),Ms(r,f);for(const[m,_]of a){if(a.delete(m),m===u)break;_.reject(rs)}}o&&(n.update_pending_count(-1),u.decrement(l))};c.promise.then(h,f=>h(null,f||"unknown"))}),ii(()=>{for(const c of a.values())c.reject(rs)}),new Promise(c=>{function u(l){function h(){l===i?c(r):u(i)}l.then(h,h)}u(i)})}function pe(t){const e=rn(t);return Xr(e),e}function si(t){const e=rn(t);return e.equals=yr,e}function Ir(t){var e=t.effects;if(e!==null){t.effects=null;for(var s=0;s<e.length;s+=1)Ne(e[s])}}function Al(t){for(var e=t.parent;e!==null;){if(!(e.f&Se))return e;e=e.parent}return null}function ni(t){var e,s=W;Qe(Al(t));try{t.f&=~en,Ir(t),e=$r(t)}finally{Qe(s)}return e}function Cr(t){var e=ni(t);if(t.equals(e)||(t.v=e,t.wv=Qr()),!qt)if(be!==null)be.set(t,t.v);else{var s=(kt||t.f&Le)&&t.deps!==null?St:Te;Ie(t,s)}}const _t=new Map;function jt(t,e){var s={f:0,v:t,reactions:null,equals:br,rv:0,wv:0};return s}function oe(t,e){const s=jt(t);return Xr(s),s}function Pl(t,e=!1,s=!0){var i;const n=jt(t);return e||(n.equals=yr),os&&s&&ue!==null&&ue.l!==null&&((i=ue.l).s??(i.s=[])).push(n),n}function M(t,e,s=!1){U!==null&&(!Ge||U.f&vr)&&Ds()&&U.f&(Se|ct|Zn|vr)&&!(xe!=null&&xe.includes(t))&&gl();let n=s?ft(e):e;return Ms(t,n)}function Ms(t,e){if(!t.equals(e)){var s=t.v;qt?_t.set(t,e):_t.set(t,s),t.v=e;var n=dt.ensure();n.capture(t,s),t.f&Se&&(t.f&Ce&&ni(t),Ie(t,t.f&Le?St:Te)),t.wv=Qr(),Dr(t,Ce),Ds()&&W!==null&&W.f&Te&&!(W.f&(ut|Mt))&&(Be===null?Xl([t]):Be.push(t))}return e}function Nr(t,e=1){var s=w(t),n=e===1?s++:s--;return M(t,s),n}function As(t){M(t,t.v+1)}function Dr(t,e){var s=t.reactions;if(s!==null)for(var n=Ds(),i=s.length,r=0;r<i;r++){var o=s[r],a=o.f;if(!(!n&&o===W)){var c=(a&Ce)===0;c&&Ie(o,e),a&Se?a&en||(o.f|=en,Dr(o,St)):c&&(a&ct&&He!==null&&He.add(o),zt(o))}}}function ft(t){if(typeof t!="object"||t===null||Pt in t)return t;const e=pr(t);if(e!==$a&&e!==el)return t;var s=new Map,n=Qs(t),i=oe(0),r=Wt,o=a=>{if(Wt===r)return a();var c=U,u=Wt;De(null),Jr(r);var l=a();return De(c),Jr(u),l};return n&&s.set("length",oe(t.length)),new Proxy(t,{defineProperty(a,c,u){(!("value"in u)||u.configurable===!1||u.enumerable===!1||u.writable===!1)&&fl();var l=s.get(c);return l===void 0?l=o(()=>{var h=oe(u.value);return s.set(c,h),h}):M(l,u.value,!0),!0},deleteProperty(a,c){var u=s.get(c);if(u===void 0){if(c in a){const l=o(()=>oe(we));s.set(c,l),As(i)}}else M(u,we),As(i);return!0},get(a,c,u){var f;if(c===Pt)return t;var l=s.get(c),h=c in a;if(l===void 0&&(!h||(f=ss(a,c))!=null&&f.writable)&&(l=o(()=>{var p=ft(h?a[c]:we),m=oe(p);return m}),s.set(c,l)),l!==void 0){var d=w(l);return d===we?void 0:d}return Reflect.get(a,c,u)},getOwnPropertyDescriptor(a,c){var u=Reflect.getOwnPropertyDescriptor(a,c);if(u&&"value"in u){var l=s.get(c);l&&(u.value=w(l))}else if(u===void 0){var h=s.get(c),d=h==null?void 0:h.v;if(h!==void 0&&d!==we)return{enumerable:!0,configurable:!0,value:d,writable:!0}}return u},has(a,c){var d;if(c===Pt)return!0;var u=s.get(c),l=u!==void 0&&u.v!==we||Reflect.has(a,c);if(u!==void 0||W!==null&&(!l||(d=ss(a,c))!=null&&d.writable)){u===void 0&&(u=o(()=>{var f=l?ft(a[c]):we,p=oe(f);return p}),s.set(c,u));var h=w(u);if(h===we)return!1}return l},set(a,c,u,l){var y;var h=s.get(c),d=c in a;if(n&&c==="length")for(var f=u;f<h.v;f+=1){var p=s.get(f+"");p!==void 0?M(p,we):f in a&&(p=o(()=>oe(we)),s.set(f+"",p))}if(h===void 0)(!d||(y=ss(a,c))!=null&&y.writable)&&(h=o(()=>oe(void 0)),M(h,ft(u)),s.set(c,h));else{d=h.v!==we;var m=o(()=>ft(u));M(h,m)}var _=Reflect.getOwnPropertyDescriptor(a,c);if(_!=null&&_.set&&_.set.call(l,u),!d){if(n&&typeof c=="string"){var I=s.get("length"),T=Number(c);Number.isInteger(T)&&T>=I.v&&M(I,T+1)}As(i)}return!0},ownKeys(a){w(i);var c=Reflect.ownKeys(a).filter(h=>{var d=s.get(h);return d===void 0||d.v!==we});for(var[u,l]of s)l.v!==we&&!(u in a)&&c.push(u);return c},setPrototypeOf(){pl()}})}function Rr(t){try{if(t!==null&&typeof t=="object"&&Pt in t)return t[Pt]}catch{}return t}function Ll(t,e){return Object.is(Rr(t),Rr(e))}var Or,Mr,Ar,Pr;function Bl(){if(Or===void 0){Or=window,Mr=/Firefox/.test(navigator.userAgent);var t=Element.prototype,e=Node.prototype,s=Text.prototype;Ar=ss(e,"firstChild").get,Pr=ss(e,"nextSibling").get,gr(t)&&(t.__click=void 0,t.__className=void 0,t.__attributes=null,t.__style=void 0,t.__e=void 0),gr(s)&&(s.__t=void 0)}}function Ut(t=""){return document.createTextNode(t)}function on(t){return Ar.call(t)}function Ps(t){return Pr.call(t)}function L(t,e){return on(t)}function cs(t,e=!1){{var s=on(t);return s instanceof Comment&&s.data===""?Ps(s):s}}function J(t,e=1,s=!1){let n=t;for(;e--;)n=Ps(n);return n}function Fl(t){t.textContent=""}function Lr(){return!1}let Br=!1;function zl(){Br||(Br=!0,document.addEventListener("reset",t=>{Promise.resolve().then(()=>{var e;if(!t.defaultPrevented)for(const s of t.target.elements)(e=s.__on_r)==null||e.call(s)})},{capture:!0}))}function an(t){var e=U,s=W;De(null),Qe(null);try{return t()}finally{De(e),Qe(s)}}function jl(t,e,s,n=s){t.addEventListener(e,()=>an(s));const i=t.__on_r;i?t.__on_r=()=>{i(),n(!0)}:t.__on_r=()=>n(!0),zl()}function Ul(t){W===null&&U===null&&ul(),U!==null&&U.f&Le&&W===null&&cl(),qt&&ll()}function ql(t,e){var s=e.last;s===null?e.last=e.first=t:(s.next=t,t.prev=s,e.last=t)}function pt(t,e,s,n=!0){var i=W;i!==null&&i.f&Me&&(t|=Me);var r={ctx:ue,deps:null,nodes_start:null,nodes_end:null,f:t|Ce,first:null,fn:e,last:null,next:null,parent:i,b:i&&i.b,prev:null,teardown:null,transitions:null,wv:0,ac:null};if(s)try{hn(r),r.f|=Jn}catch(c){throw Ne(r),c}else e!==null&&zt(r);if(n){var o=r;if(s&&o.deps===null&&o.teardown===null&&o.nodes_start===null&&o.first===o.last&&!(o.f&is)&&(o=o.first,t&ct&&t&ns&&o!==null&&(o.f|=ns)),o!==null&&(o.parent=i,i!==null&&ql(o,i),U!==null&&U.f&Se&&!(t&Mt))){var a=U;(a.effects??(a.effects=[])).push(o)}}return r}function Wl(){return U!==null&&!Ge}function ii(t){const e=pt(Yn,null,!1);return Ie(e,Te),e.teardown=t,e}function ln(t){Ul();var e=W.f,s=!U&&(e&ut)!==0&&(e&Jn)===0;if(s){var n=ue;(n.e??(n.e=[])).push(t)}else return Fr(t)}function Fr(t){return pt(Xn|nl,t,!1)}function Hl(t){dt.ensure();const e=pt(Mt|is,t,!0);return(s={})=>new Promise(n=>{s.outro?us(e,()=>{Ne(e),n(void 0)}):(Ne(e),n(void 0))})}function zr(t){return pt(Xn,t,!1)}function Vl(t){return pt(Zn|is,t,!0)}function ri(t,e=0){return pt(Yn|e,t,!0)}function te(t,e=[],s=[]){Rl(e,s,n=>{pt(Yn,()=>t(...n.map(w)),!0)})}function oi(t,e=0){var s=pt(ct|e,t,!0);return s}function Ve(t,e=!0){return pt(ut|is,t,!0,e)}function jr(t){var e=t.teardown;if(e!==null){const s=qt,n=U;Kr(!0),De(null);try{e.call(null)}finally{Kr(s),De(n)}}}function Ur(t,e=!1){var s=t.first;for(t.first=t.last=null;s!==null;){const i=s.ac;i!==null&&an(()=>{i.abort(rs)});var n=s.next;s.f&Mt?s.parent=null:Ne(s,e),s=n}}function Gl(t){for(var e=t.first;e!==null;){var s=e.next;e.f&ut||Ne(e),e=s}}function Ne(t,e=!0){var s=!1;(e||t.f&sl)&&t.nodes_start!==null&&t.nodes_end!==null&&(Kl(t.nodes_start,t.nodes_end),s=!0),Ur(t,e&&!s),un(t,0),Ie(t,ht);var n=t.transitions;if(n!==null)for(const r of n)r.stop();jr(t);var i=t.parent;i!==null&&i.first!==null&&qr(t),t.next=t.prev=t.teardown=t.ctx=t.deps=t.fn=t.nodes_start=t.nodes_end=t.ac=null}function Kl(t,e){for(;t!==null;){var s=t===e?null:Ps(t);t.remove(),t=s}}function qr(t){var e=t.parent,s=t.prev,n=t.next;s!==null&&(s.next=n),n!==null&&(n.prev=s),e!==null&&(e.first===t&&(e.first=n),e.last===t&&(e.last=s))}function us(t,e,s=!0){var n=[];ai(t,n,!0),Wr(n,()=>{s&&Ne(t),e&&e()})}function Wr(t,e){var s=t.length;if(s>0){var n=()=>--s||e();for(var i of t)i.out(n)}else e()}function ai(t,e,s){if(!(t.f&Me)){if(t.f^=Me,t.transitions!==null)for(const o of t.transitions)(o.is_global||s)&&e.push(o);for(var n=t.first;n!==null;){var i=n.next,r=(n.f&ns)!==0||(n.f&ut)!==0&&(t.f&ct)!==0;ai(n,e,r?s:!1),n=i}}}function li(t){Hr(t,!0)}function Hr(t,e){if(t.f&Me){t.f^=Me,t.f&Te||(Ie(t,Ce),zt(t));for(var s=t.first;s!==null;){var n=s.next,i=(s.f&ns)!==0||(s.f&ut)!==0;Hr(s,i?e:!1),s=n}if(t.transitions!==null)for(const r of t.transitions)(r.is_global||e)&&r.in()}}function Vr(t,e){for(var s=t.nodes_start,n=t.nodes_end;s!==null;){var i=s===n?null:Ps(s);e.append(s),s=i}}let hs=!1;function Gr(t){hs=t}let qt=!1;function Kr(t){qt=t}let U=null,Ge=!1;function De(t){U=t}let W=null;function Qe(t){W=t}let xe=null;function Xr(t){U!==null&&(xe===null?xe=[t]:xe.push(t))}let Ee=null,Ae=0,Be=null;function Xl(t){Be=t}let Yr=1,Ls=0,Wt=Ls;function Jr(t){Wt=t}let kt=!1;function Qr(){return++Yr}function cn(t){var h;var e=t.f;if(e&Ce)return!0;if(e&St){var s=t.deps,n=(e&Le)!==0;if(e&Se&&(t.f&=~en),s!==null){var i,r,o=(e&$s)!==0,a=n&&W!==null&&!kt,c=s.length;if((o||a)&&(W===null||!(W.f&ht))){var u=t,l=u.parent;for(i=0;i<c;i++)r=s[i],(o||!((h=r==null?void 0:r.reactions)!=null&&h.includes(u)))&&(r.reactions??(r.reactions=[])).push(u);o&&(u.f^=$s),a&&l!==null&&!(l.f&Le)&&(u.f^=Le)}for(i=0;i<c;i++)if(r=s[i],cn(r)&&Cr(r),r.wv>t.wv)return!0}(!n||W!==null&&!kt)&&Ie(t,Te)}return!1}function Zr(t,e,s=!0){var n=t.reactions;if(n!==null&&!(xe!=null&&xe.includes(t)))for(var i=0;i<n.length;i++){var r=n[i];r.f&Se?Zr(r,e,!1):e===r&&(s?Ie(r,Ce):r.f&Te&&Ie(r,St),zt(r))}}function $r(t){var m;var e=Ee,s=Ae,n=Be,i=U,r=kt,o=xe,a=ue,c=Ge,u=Wt,l=t.f;Ee=null,Ae=0,Be=null,kt=(l&Le)!==0&&(Ge||!hs||U===null),U=l&(ut|Mt)?null:t,xe=null,as(t.ctx),Ge=!1,Wt=++Ls,t.ac!==null&&(an(()=>{t.ac.abort(rs)}),t.ac=null);try{t.f|=Qn;var h=t.fn,d=h(),f=t.deps;if(Ee!==null){var p;if(un(t,Ae),f!==null&&Ae>0)for(f.length=Ae+Ee.length,p=0;p<Ee.length;p++)f[Ae+p]=Ee[p];else t.deps=f=Ee;if(!kt||l&Se&&t.reactions!==null)for(p=Ae;p<f.length;p++)((m=f[p]).reactions??(m.reactions=[])).push(t)}else f!==null&&Ae<f.length&&(un(t,Ae),f.length=Ae);if(Ds()&&Be!==null&&!Ge&&f!==null&&!(t.f&(Se|St|Ce)))for(p=0;p<Be.length;p++)Zr(Be[p],t);return i!==null&&i!==t&&(Ls++,Be!==null&&(n===null?n=Be:n.push(...Be))),t.f&At&&(t.f^=At),d}catch(_){return Sr(_)}finally{t.f^=Qn,Ee=e,Ae=s,Be=n,U=i,kt=r,xe=o,as(a),Ge=c,Wt=u}}function Yl(t,e){let s=e.reactions;if(s!==null){var n=Qa.call(s,t);if(n!==-1){var i=s.length-1;i===0?s=e.reactions=null:(s[n]=s[i],s.pop())}}s===null&&e.f&Se&&(Ee===null||!Ee.includes(e))&&(Ie(e,St),e.f&(Le|$s)||(e.f^=$s),Ir(e),un(e,0))}function un(t,e){var s=t.deps;if(s!==null)for(var n=e;n<s.length;n++)Yl(t,s[n])}function hn(t){var e=t.f;if(!(e&ht)){Ie(t,Te);var s=W,n=hs;W=t,hs=!0;try{e&ct?Gl(t):Ur(t),jr(t);var i=$r(t);t.teardown=typeof i=="function"?i:null,t.wv=Yr;var r;fr&&Sl&&t.f&Ce&&t.deps}finally{hs=n,W=s}}}async function Jl(){await Promise.resolve(),xl()}function w(t){var e=t.f,s=(e&Se)!==0;if(U!==null&&!Ge){var n=W!==null&&(W.f&ht)!==0;if(!n&&!(xe!=null&&xe.includes(t))){var i=U.deps;if(U.f&Qn)t.rv<Ls&&(t.rv=Ls,Ee===null&&i!==null&&i[Ae]===t?Ae++:Ee===null?Ee=[t]:(!kt||!Ee.includes(t))&&Ee.push(t));else{(U.deps??(U.deps=[])).push(t);var r=t.reactions;r===null?t.reactions=[U]:r.includes(U)||r.push(U)}}}else if(s&&t.deps===null&&t.effects===null){var o=t,a=o.parent;a!==null&&!(a.f&Le)&&(o.f^=Le)}if(qt){if(_t.has(t))return _t.get(t);if(s){o=t;var c=o.v;return(!(o.f&Te)&&o.reactions!==null||eo(o))&&(c=ni(o)),_t.set(o,c),c}}else if(s){if(o=t,be!=null&&be.has(o))return be.get(o);cn(o)&&Cr(o)}if(be!=null&&be.has(t))return be.get(t);if(t.f&At)throw t.v;return t.v}function eo(t){if(t.v===we)return!0;if(t.deps===null)return!1;for(const e of t.deps)if(_t.has(e)||e.f&Se&&eo(e))return!0;return!1}function Bs(t){var e=Ge;try{return Ge=!0,t()}finally{Ge=e}}const Ql=-7169;function Ie(t,e){t.f=t.f&Ql|e}const to=new Set,ci=new Set;function Zl(t,e,s,n={}){function i(r){if(n.capture||zs.call(e,r),!r.cancelBubble)return an(()=>s==null?void 0:s.call(this,r))}return t.startsWith("pointer")||t.startsWith("touch")||t==="wheel"?Rs(()=>{e.addEventListener(t,i,n)}):e.addEventListener(t,i,n),i}function Fs(t,e,s,n,i){var r={capture:n,passive:i},o=Zl(t,e,s,r);(e===document.body||e===window||e===document||e instanceof HTMLMediaElement)&&ii(()=>{e.removeEventListener(t,o,r)})}function ui(t){for(var e=0;e<t.length;e++)to.add(t[e]);for(var s of ci)s(t)}let so=null;function zs(t){var T;var e=this,s=e.ownerDocument,n=t.type,i=((T=t.composedPath)==null?void 0:T.call(t))||[],r=i[0]||t.target;so=t;var o=0,a=so===t&&t.__root;if(a){var c=i.indexOf(a);if(c!==-1&&(e===document||e===window)){t.__root=e;return}var u=i.indexOf(e);if(u===-1)return;c<=u&&(o=c)}if(r=i[o]||t.target,r!==e){Kn(t,"currentTarget",{configurable:!0,get(){return r||s}});var l=U,h=W;De(null),Qe(null);try{for(var d,f=[];r!==null;){var p=r.assignedSlot||r.parentNode||r.host||null;try{var m=r["__"+n];if(m!=null&&(!r.disabled||t.target===r))if(Qs(m)){var[_,...I]=m;_.apply(r,[t,...I])}else m.call(r,t)}catch(y){d?f.push(y):d=y}if(t.cancelBubble||p===e||p===null)break;r=p}if(d){for(let y of f)queueMicrotask(()=>{throw y});throw d}}finally{t.__root=e,delete t.currentTarget,De(l),Qe(h)}}}function $l(t){var e=document.createElement("template");return e.innerHTML=t.replaceAll("<!>","<!---->"),e.content}function hi(t,e){var s=W;s.nodes_start===null&&(s.nodes_start=t,s.nodes_end=e)}function X(t,e){var s=(e&Xa)!==0,n=(e&Ya)!==0,i,r=!t.startsWith("<!>");return()=>{i===void 0&&(i=$l(r?t:"<!>"+t),s||(i=on(i)));var o=n||Mr?document.importNode(i,!0):i.cloneNode(!0);if(s){var a=on(o),c=o.lastChild;hi(a,c)}else hi(o,o);return o}}function js(){var t=document.createDocumentFragment(),e=document.createComment(""),s=Ut();return t.append(e,s),hi(e,s),t}function q(t,e){t!==null&&t.before(e)}const ec=["touchstart","touchmove"];function tc(t){return ec.includes(t)}function Z(t,e){var s=e==null?"":typeof e=="object"?e+"":e;s!==(t.__t??(t.__t=t.nodeValue))&&(t.__t=s,t.nodeValue=s+"")}function sc(t,e){return nc(t,e)}const ds=new Map;function nc(t,{target:e,anchor:s,props:n={},events:i,context:r,intro:o=!0}){Bl();var a=new Set,c=h=>{for(var d=0;d<h.length;d++){var f=h[d];if(!a.has(f)){a.add(f);var p=tc(f);e.addEventListener(f,zs,{passive:p});var m=ds.get(f);m===void 0?(document.addEventListener(f,zs,{passive:p}),ds.set(f,1)):ds.set(f,m+1)}}};c(Gn(to)),ci.add(c);var u=void 0,l=Hl(()=>{var h=s??e.appendChild(Ut());return Nl(h,{pending:()=>{}},d=>{if(r){Lt({});var f=ue;f.c=r}i&&(n.$$events=i),u=t(d,n)||{},r&&Bt()}),()=>{var p;for(var d of a){e.removeEventListener(d,zs);var f=ds.get(d);--f===0?(document.removeEventListener(d,zs),ds.delete(d)):ds.set(d,f)}ci.delete(c),h!==s&&((p=h.parentNode)==null||p.removeChild(h))}});return ic.set(u,l),u}let ic=new WeakMap;class rc{constructor(e,s=!0){Ot(this,"anchor");K(this,bt,new Map);K(this,lt,new Map);K(this,Xe,new Map);K(this,Xs,!0);K(this,Ys,()=>{var e=ee;if(b(this,bt).has(e)){var s=b(this,bt).get(e),n=b(this,lt).get(s);if(n)li(n);else{var i=b(this,Xe).get(s);i&&(b(this,lt).set(s,i.effect),b(this,Xe).delete(s),i.fragment.lastChild.remove(),this.anchor.before(i.fragment),n=i.effect)}for(const[r,o]of b(this,bt)){if(b(this,bt).delete(r),r===e)break;const a=b(this,Xe).get(o);a&&(Ne(a.effect),b(this,Xe).delete(o))}for(const[r,o]of b(this,lt)){if(r===s)continue;const a=()=>{if(Array.from(b(this,bt).values()).includes(r)){var u=document.createDocumentFragment();Vr(o,u),u.append(Ut()),b(this,Xe).set(r,{effect:o,fragment:u})}else Ne(o);b(this,lt).delete(r)};b(this,Xs)||!n?us(o,a,!1):a()}}});this.anchor=e,B(this,Xs,s)}ensure(e,s){var n=ee,i=Lr();if(s&&!b(this,lt).has(e)&&!b(this,Xe).has(e))if(i){var r=document.createDocumentFragment(),o=Ut();r.append(o),b(this,Xe).set(e,{effect:Ve(()=>s(o)),fragment:r})}else b(this,lt).set(e,Ve(()=>s(this.anchor)));if(b(this,bt).set(n,e),i){for(const[a,c]of b(this,lt))a===e?n.skipped_effects.delete(c):n.skipped_effects.add(c);for(const[a,c]of b(this,Xe))a===e?n.skipped_effects.delete(c.effect):n.skipped_effects.add(c.effect);n.add_callback(b(this,Ys))}else b(this,Ys).call(this)}}bt=new WeakMap,lt=new WeakMap,Xe=new WeakMap,Xs=new WeakMap,Ys=new WeakMap;function di(t){ue===null&&ol(),os&&ue.l!==null?oc(ue).m.push(t):ln(()=>{const e=Bs(t);if(typeof e=="function")return e})}function oc(t){var e=t.l;return e.u??(e.u={a:[],b:[],m:[]})}function ie(t,e,s=!1){var n=new rc(t),i=s?ns:0;function r(o,a){n.ensure(o,a)}oi(()=>{var o=!1;e((a,c=!0)=>{o=!0,r(c,a)}),o||r(!1,null)},i)}function Us(t,e){return e}function ac(t,e,s){for(var n=t.items,i=[],r=e.length,o=0;o<r;o++)ai(e[o].e,i,!0);var a=r>0&&i.length===0&&s!==null;if(a){var c=s.parentNode;Fl(c),c.append(s),n.clear(),Ze(t,e[0].prev,e[r-1].next)}Wr(i,()=>{for(var u=0;u<r;u++){var l=e[u];a||(n.delete(l.k),Ze(t,l.prev,l.next)),Ne(l.e,!a)}})}function qs(t,e,s,n,i,r=null){var o=t,a={flags:e,items:new Map,first:null};{var c=t;o=c.appendChild(Ut())}var u=null,l=!1,h=new Map,d=si(()=>{var _=s();return Qs(_)?_:_==null?[]:Gn(_)}),f,p;function m(){lc(p,f,a,h,o,i,e,n,s),r!==null&&(f.length===0?u?li(u):u=Ve(()=>r(o)):u!==null&&us(u,()=>{u=null}))}oi(()=>{p??(p=W),f=w(d);var _=f.length;if(!(l&&_===0)){l=_===0;var I,T,y,g;if(Lr()){var v=new Set,E=ee;for(T=0;T<_;T+=1){y=f[T],g=n(y,T);var C=a.items.get(g)??h.get(g);C?no(C,y,T):(I=io(null,a,null,null,y,g,T,i,e,s,!0),h.set(g,I)),v.add(g)}for(const[S,k]of a.items)v.has(S)||E.skipped_effects.add(k.e);E.add_callback(m)}else m();w(d)}})}function lc(t,e,s,n,i,r,o,a,c){var u=e.length,l=s.items,h=s.first,d=h,f,p=null,m=[],_=[],I,T,y,g;for(g=0;g<u;g+=1){if(I=e[g],T=a(I,g),y=l.get(T),y===void 0){var v=n.get(T);if(v!==void 0){n.delete(T),l.set(T,v);var E=p?p.next:d;Ze(s,p,v),Ze(s,v,E),fi(v,E,i),p=v}else{var C=d?d.e.nodes_start:i;p=io(C,s,p,p===null?s.first:p.next,I,T,g,r,o,c)}l.set(T,p),m=[],_=[],d=p.next;continue}if(no(y,I,g),y.e.f&Me&&li(y.e),y!==d){if(f!==void 0&&f.has(y)){if(m.length<_.length){var S=_[0],k;p=S.prev;var A=m[0],z=m[m.length-1];for(k=0;k<m.length;k+=1)fi(m[k],S,i);for(k=0;k<_.length;k+=1)f.delete(_[k]);Ze(s,A.prev,z.next),Ze(s,p,A),Ze(s,z,S),d=S,p=z,g-=1,m=[],_=[]}else f.delete(y),fi(y,d,i),Ze(s,y.prev,y.next),Ze(s,y,p===null?s.first:p.next),Ze(s,p,y),p=y;continue}for(m=[],_=[];d!==null&&d.k!==T;)d.e.f&Me||(f??(f=new Set)).add(d),_.push(d),d=d.next;if(d===null)continue;y=d}m.push(y),p=y,d=y.next}if(d!==null||f!==void 0){for(var F=f===void 0?[]:Gn(f);d!==null;)d.e.f&Me||F.push(d),d=d.next;var G=F.length;if(G>0){var j=u===0?i:null;ac(s,F,j)}}t.first=s.first&&s.first.e,t.last=p&&p.e;for(var x of n.values())Ne(x.e);n.clear()}function no(t,e,s,n){Ms(t.v,e),t.i=s}function io(t,e,s,n,i,r,o,a,c,u,l){var h=(c&$)!==0,d=(c&Js)===0,f=h?d?Pl(i,!1,!1):jt(i):i,p=c&fe?jt(o):o,m={i:p,v:f,k:r,a:null,e:null,prev:s,next:n};try{if(t===null){var _=document.createDocumentFragment();_.append(t=Ut())}return m.e=Ve(()=>a(t,f,p,u),yl),m.e.prev=s&&s.e,m.e.next=n&&n.e,s===null?l||(e.first=m):(s.next=m,s.e.next=m.e),n!==null&&(n.prev=m,n.e.prev=m.e),m}finally{}}function fi(t,e,s){for(var n=t.next?t.next.e.nodes_start:s,i=e?e.e.nodes_start:s,r=t.e.nodes_start;r!==null&&r!==n;){var o=Ps(r);i.before(r),r=o}}function Ze(t,e,s){e===null?t.first=s:(e.next=s,e.e.next=s&&s.e),s!==null&&(s.prev=e,s.e.prev=e&&e.e)}function Ht(t,e){zr(()=>{var s=t.getRootNode(),n=s.host?s:s.head??s.ownerDocument.head;if(!n.querySelector("#"+e.hash)){const i=document.createElement("style");i.id=e.hash,i.textContent=e.code,n.appendChild(i)}})}function cc(t,e,s){var n=t==null?"":""+t;return n=n?n+" "+e:e,n===""?null:n}function ro(t,e,s,n,i,r){var o=t.__className;if(o!==s||o===void 0){var a=cc(s,n);a==null?t.removeAttribute("class"):t.className=a,t.__className=s}return r}function oo(t,e,s=!1){if(t.multiple){if(e==null)return;if(!Qs(e))return vl();for(var n of t.options)n.selected=e.includes(ao(n));return}for(n of t.options){var i=ao(n);if(Ll(i,e)){n.selected=!0;return}}(!s||e!==void 0)&&(t.selectedIndex=-1)}function uc(t){var e=new MutationObserver(()=>{oo(t,t.__value)});e.observe(t,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["value"]}),ii(()=>{e.disconnect()})}function ao(t){return"__value"in t?t.__value:t.value}const hc=Symbol("is custom element"),dc=Symbol("is html");function fc(t,e){e?t.hasAttribute("selected")||t.setAttribute("selected",""):t.removeAttribute("selected")}function dn(t,e,s,n){var i=pc(t);i[e]!==(i[e]=s)&&(e==="loading"&&(t[rl]=s),s==null?t.removeAttribute(e):typeof s!="string"&&gc(t).includes(e)?t[e]=s:t.setAttribute(e,s))}function pc(t){return t.__attributes??(t.__attributes={[hc]:t.nodeName.includes("-"),[dc]:t.namespaceURI===Ja})}var lo=new Map;function gc(t){var e=t.getAttribute("is")||t.nodeName,s=lo.get(e);if(s)return s;lo.set(e,s=[]);for(var n,i=t,r=Element.prototype;r!==i;){n=Za(i);for(var o in n)n[o].set&&s.push(o);i=pr(i)}return s}function mc(t,e,s=e){var n=new WeakSet;jl(t,"input",async i=>{var r=i?t.defaultValue:t.value;if(r=pi(t)?gi(r):r,s(r),ee!==null&&n.add(ee),await Jl(),r!==(r=e())){var o=t.selectionStart,a=t.selectionEnd,c=t.value.length;if(t.value=r??"",a!==null){var u=t.value.length;o===a&&a===c&&u>c?(t.selectionStart=u,t.selectionEnd=u):(t.selectionStart=o,t.selectionEnd=Math.min(a,u))}}}),Bs(e)==null&&t.value&&(s(pi(t)?gi(t.value):t.value),ee!==null&&n.add(ee)),ri(()=>{var i=e();if(t===document.activeElement){var r=sn??ee;if(n.has(r))return}pi(t)&&i===gi(t.value)||t.type==="date"&&!i&&!t.value||i!==t.value&&(t.value=i??"")})}function pi(t){var e=t.type;return e==="number"||e==="range"}function gi(t){return t===""?null:+t}function co(t,e){return t===e||(t==null?void 0:t[Pt])===e}function vc(t={},e,s,n){return zr(()=>{var i,r;return ri(()=>{i=r,r=[],Bs(()=>{t!==s(...r)&&(e(t,...r),i&&co(s(...i),t)&&e(null,...i))})}),()=>{Rs(()=>{r&&co(s(...r),t)&&e(null,...r)})}}),t}let fn=!1;function bc(t){var e=fn;try{return fn=!1,[t(),fn]}finally{fn=e}}function uo(t,e,s,n){var y;var i=!os||(s&Ha)!==0,r=(s&Ga)!==0,o=(s&Ka)!==0,a=n,c=!0,u=()=>(c&&(c=!1,a=o?Bs(n):n),a),l;if(r){var h=Pt in t||il in t;l=((y=ss(t,e))==null?void 0:y.set)??(h&&e in t?g=>t[e]=g:void 0)}var d,f=!1;r?[d,f]=bc(()=>t[e]):d=t[e],d===void 0&&n!==void 0&&(d=u(),l&&(i&&dl(),l(d)));var p;if(i?p=()=>{var g=t[e];return g===void 0?u():(c=!0,g)}:p=()=>{var g=t[e];return g!==void 0&&(a=void 0),g===void 0?a:g},i&&!(s&Va))return p;if(l){var m=t.$$legacy;return function(g,v){return arguments.length>0?((!i||!v||m||f)&&l(v?p():g),g):p()}}var _=!1,I=(s&Wa?rn:si)(()=>(_=!1,p()));r&&w(I);var T=W;return function(g,v){if(arguments.length>0){const E=v?w(I):i&&r?ft(g):g;return M(I,E),_=!0,a!==void 0&&(a=E),g}return qt&&_||T.f&ht?I.v:w(I)}}function ho(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(t){const e=Math.random()*16|0;return(t==="x"?e:e&3|8).toString(16)})}function mi(t,e,s){let n="";if(s){const i=new Date;i.setTime(i.getTime()+s*24*60*60*1e3),n="; expires="+i.toUTCString()}document.cookie=t+"="+(e||"")+n+"; path=/; secure; samesite=strict"}function vi(t){const e=t+"=",s=document.cookie.split(";");for(let n=0;n<s.length;n++){let i=s[n];for(;i.charAt(0)===" ";)i=i.substring(1,i.length);if(i.indexOf(e)===0)return i.substring(e.length,i.length)}return null}function fo(){const t="uniqueUserID";let e=vi(t);return e||(e=ho(),mi(t,e,365)),e}function $e(t,e,s={},n={}){const i="https://admin-api.wineater.com/api/widget-events";let r=vi("uniqueUserID");r||(r=fo());const o={user_agent:navigator.userAgent,screen_width:window.screen.width,screen_height:window.screen.height,language:navigator.language,platform:navigator.platform},a=new Date().toISOString();let c=vi("sessionID");c||(c=ho(),mi("sessionID",c,1));const u={event_type:t,store_id:e,session_id:c,event_time:a,data:s,meta:{...n,user_id:r},device_info:o,region:navigator.language.split("-")[1]||null,language:navigator.language.split("-")[0]||"en"};return fetch(i,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(u)}).then(l=>l.ok?l.json():l.json().then(h=>{throw new Error(h.message||"Failed to track widget event")})).catch(l=>{throw console.error("Widget event tracking error:",l),l})}var po={},yc=function(t,e,s,n,i){var r=new Worker(po[e]||(po[e]=URL.createObjectURL(new Blob([t+';addEventListener("error",function(e){e=e.error;postMessage({$e$:[e.message,e.code,e.stack]})})'],{type:"text/javascript"}))));return r.onmessage=function(o){var a=o.data,c=a.$e$;if(c){var u=new Error(c[0]);u.code=c[1],u.stack=c[2],i(u,null)}else i(null,a)},r.postMessage(s,n),r},Fe=Uint8Array,Re=Uint16Array,pn=Int32Array,gn=new Fe([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),mn=new Fe([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),bi=new Fe([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),go=function(t,e){for(var s=new Re(31),n=0;n<31;++n)s[n]=e+=1<<t[n-1];for(var i=new pn(s[30]),n=1;n<30;++n)for(var r=s[n];r<s[n+1];++r)i[r]=r-s[n]<<5|n;return{b:s,r:i}},mo=go(gn,2),wc=mo.b,vn=mo.r;wc[28]=258,vn[258]=28;for(var Sc=go(mn,0),yi=Sc.r,bn=new Re(32768),ne=0;ne<32768;++ne){var Tt=(ne&43690)>>1|(ne&21845)<<1;Tt=(Tt&52428)>>2|(Tt&13107)<<2,Tt=(Tt&61680)>>4|(Tt&3855)<<4,bn[ne]=((Tt&65280)>>8|(Tt&255)<<8)>>1}for(var fs=function(t,e,s){for(var n=t.length,i=0,r=new Re(e);i<n;++i)t[i]&&++r[t[i]-1];var o=new Re(e);for(i=1;i<e;++i)o[i]=o[i-1]+r[i-1]<<1;var a;if(s){a=new Re(1<<e);var c=15-e;for(i=0;i<n;++i)if(t[i])for(var u=i<<4|t[i],l=e-t[i],h=o[t[i]-1]++<<l,d=h|(1<<l)-1;h<=d;++h)a[bn[h]>>c]=u}else for(a=new Re(n),i=0;i<n;++i)t[i]&&(a[i]=bn[o[t[i]-1]++]>>15-t[i]);return a},xt=new Fe(288),ne=0;ne<144;++ne)xt[ne]=8;for(var ne=144;ne<256;++ne)xt[ne]=9;for(var ne=256;ne<280;++ne)xt[ne]=7;for(var ne=280;ne<288;++ne)xt[ne]=8;for(var Ws=new Fe(32),ne=0;ne<32;++ne)Ws[ne]=5;var vo=fs(xt,9,0),bo=fs(Ws,5,0),wi=function(t){return(t+7)/8|0},yo=function(t,e,s){return(e==null||e<0)&&(e=0),(s==null||s>t.length)&&(s=t.length),new Fe(t.subarray(e,s))},_c=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],wo=function(t,e,s){var n=new Error(e||_c[t]);if(n.code=t,Error.captureStackTrace&&Error.captureStackTrace(n,wo),!s)throw n;return n},et=function(t,e,s){s<<=e&7;var n=e/8|0;t[n]|=s,t[n+1]|=s>>8},ps=function(t,e,s){s<<=e&7;var n=e/8|0;t[n]|=s,t[n+1]|=s>>8,t[n+2]|=s>>16},yn=function(t,e){for(var s=[],n=0;n<t.length;++n)t[n]&&s.push({s:n,f:t[n]});var i=s.length,r=s.slice();if(!i)return{t:Ti,l:0};if(i==1){var o=new Fe(s[0].s+1);return o[s[0].s]=1,{t:o,l:1}}s.sort(function(v,E){return v.f-E.f}),s.push({s:-1,f:25001});var a=s[0],c=s[1],u=0,l=1,h=2;for(s[0]={s:-1,f:a.f+c.f,l:a,r:c};l!=i-1;)a=s[s[u].f<s[h].f?u++:h++],c=s[u!=l&&s[u].f<s[h].f?u++:h++],s[l++]={s:-1,f:a.f+c.f,l:a,r:c};for(var d=r[0].s,n=1;n<i;++n)r[n].s>d&&(d=r[n].s);var f=new Re(d+1),p=wn(s[l-1],f,0);if(p>e){var n=0,m=0,_=p-e,I=1<<_;for(r.sort(function(E,C){return f[C.s]-f[E.s]||E.f-C.f});n<i;++n){var T=r[n].s;if(f[T]>e)m+=I-(1<<p-f[T]),f[T]=e;else break}for(m>>=_;m>0;){var y=r[n].s;f[y]<e?m-=1<<e-f[y]++-1:++n}for(;n>=0&&m;--n){var g=r[n].s;f[g]==e&&(--f[g],++m)}p=e}return{t:new Fe(f),l:p}},wn=function(t,e,s){return t.s==-1?Math.max(wn(t.l,e,s+1),wn(t.r,e,s+1)):e[t.s]=s},Si=function(t){for(var e=t.length;e&&!t[--e];);for(var s=new Re(++e),n=0,i=t[0],r=1,o=function(c){s[n++]=c},a=1;a<=e;++a)if(t[a]==i&&a!=e)++r;else{if(!i&&r>2){for(;r>138;r-=138)o(32754);r>2&&(o(r>10?r-11<<5|28690:r-3<<5|12305),r=0)}else if(r>3){for(o(i),--r;r>6;r-=6)o(8304);r>2&&(o(r-3<<5|8208),r=0)}for(;r--;)o(i);r=1,i=t[a]}return{c:s.subarray(0,n),n:e}},gs=function(t,e){for(var s=0,n=0;n<e.length;++n)s+=t[n]*e[n];return s},_i=function(t,e,s){var n=s.length,i=wi(e+2);t[i]=n&255,t[i+1]=n>>8,t[i+2]=t[i]^255,t[i+3]=t[i+1]^255;for(var r=0;r<n;++r)t[i+r+4]=s[r];return(i+4+n)*8},ki=function(t,e,s,n,i,r,o,a,c,u,l){et(e,l++,s),++i[256];for(var h=yn(i,15),d=h.t,f=h.l,p=yn(r,15),m=p.t,_=p.l,I=Si(d),T=I.c,y=I.n,g=Si(m),v=g.c,E=g.n,C=new Re(19),S=0;S<T.length;++S)++C[T[S]&31];for(var S=0;S<v.length;++S)++C[v[S]&31];for(var k=yn(C,7),A=k.t,z=k.l,F=19;F>4&&!A[bi[F-1]];--F);var G=u+5<<3,j=gs(i,xt)+gs(r,Ws)+o,x=gs(i,d)+gs(r,m)+o+14+3*F+gs(C,A)+2*C[16]+3*C[17]+7*C[18];if(c>=0&&G<=j&&G<=x)return _i(e,l,t.subarray(c,c+u));var D,O,N,V;if(et(e,l,1+(x<j)),l+=2,x<j){D=fs(d,f,0),O=d,N=fs(m,_,0),V=m;var Y=fs(A,z,0);et(e,l,y-257),et(e,l+5,E-1),et(e,l+10,F-4),l+=14;for(var S=0;S<F;++S)et(e,l+3*S,A[bi[S]]);l+=3*F;for(var se=[T,v],de=0;de<2;++de)for(var me=se[de],S=0;S<me.length;++S){var R=me[S]&31;et(e,l,Y[R]),l+=A[R],R>15&&(et(e,l,me[S]>>5&127),l+=me[S]>>12)}}else D=vo,O=xt,N=bo,V=Ws;for(var S=0;S<a;++S){var P=n[S];if(P>255){var R=P>>18&31;ps(e,l,D[R+257]),l+=O[R+257],R>7&&(et(e,l,P>>23&31),l+=gn[R]);var re=P&31;ps(e,l,N[re]),l+=V[re],re>3&&(ps(e,l,P>>5&8191),l+=mn[re])}else ps(e,l,D[P]),l+=O[P]}return ps(e,l,D[256]),l+O[256]},So=new pn([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),Ti=new Fe(0),_o=function(t,e,s,n,i,r){var o=r.z||t.length,a=new Fe(n+o+5*(1+Math.ceil(o/7e3))+i),c=a.subarray(n,a.length-i),u=r.l,l=(r.r||0)&7;if(e){l&&(c[0]=r.r>>3);for(var h=So[e-1],d=h>>13,f=h&8191,p=(1<<s)-1,m=r.p||new Re(32768),_=r.h||new Re(p+1),I=Math.ceil(s/3),T=2*I,y=function(Dt){return(t[Dt]^t[Dt+1]<<I^t[Dt+2]<<T)&p},g=new pn(25e3),v=new Re(288),E=new Re(32),C=0,S=0,k=r.i||0,A=0,z=r.w||0,F=0;k+2<o;++k){var G=y(k),j=k&32767,x=_[G];if(m[j]=x,_[G]=j,z<=k){var D=o-k;if((C>7e3||A>24576)&&(D>423||!u)){l=ki(t,c,0,g,v,E,S,A,F,k-F,l),A=C=S=0,F=k;for(var O=0;O<286;++O)v[O]=0;for(var O=0;O<30;++O)E[O]=0}var N=2,V=0,Y=f,se=j-x&32767;if(D>2&&G==y(k-se))for(var de=Math.min(d,D)-1,me=Math.min(32767,k),R=Math.min(258,D);se<=me&&--Y&&j!=x;){if(t[k+N]==t[k+N-se]){for(var P=0;P<R&&t[k+P]==t[k+P-se];++P);if(P>N){if(N=P,V=se,P>de)break;for(var re=Math.min(se,P-2),yt=0,O=0;O<re;++O){var wt=k-se+O&32767,$t=m[wt],Ye=wt-$t&32767;Ye>yt&&(yt=Ye,x=wt)}}}j=x,x=m[j],se+=j-x&32767}if(V){g[A++]=268435456|vn[N]<<18|yi[V];var Cs=vn[N]&31,Ns=yi[V]&31;S+=gn[Cs]+mn[Ns],++v[257+Cs],++E[Ns],z=k+N,++C}else g[A++]=t[k],++v[t[k]]}}for(k=Math.max(k,z);k<o;++k)g[A++]=t[k],++v[t[k]];l=ki(t,c,u,g,v,E,S,A,F,k-F,l),u||(r.r=l&7|c[l/8|0]<<3,l-=7,r.h=_,r.p=m,r.i=k,r.w=z)}else{for(var k=r.w||0;k<o+u;k+=65535){var es=k+65535;es>=o&&(c[l/8|0]=u,es=o),l=_i(c,l+1,t.subarray(k,es))}r.i=o}return yo(a,0,n+wi(l)+i)},ko=function(){for(var t=new Int32Array(256),e=0;e<256;++e){for(var s=e,n=9;--n;)s=(s&1&&-306674912)^s>>>1;t[e]=s}return t}(),To=function(){var t=-1;return{p:function(e){for(var s=t,n=0;n<e.length;++n)s=ko[s&255^e[n]]^s>>>8;t=s},d:function(){return~t}}},xi=function(t,e,s,n,i){if(!i&&(i={l:1},e.dictionary)){var r=e.dictionary.subarray(-32768),o=new Fe(r.length+t.length);o.set(r),o.set(t,r.length),t=o,i.w=r.length}return _o(t,e.level==null?6:e.level,e.mem==null?i.l?Math.ceil(Math.max(8,Math.min(13,Math.log(t.length)))*1.5):20:12+e.mem,s,n,i)},kc=function(t,e){var s={};for(var n in t)s[n]=t[n];for(var n in e)s[n]=e[n];return s},xo=function(t,e,s){for(var n=t(),i=t.toString(),r=i.slice(i.indexOf("[")+1,i.lastIndexOf("]")).replace(/\s+/g,"").split(","),o=0;o<n.length;++o){var a=n[o],c=r[o];if(typeof a=="function"){e+=";"+c+"=";var u=a.toString();if(a.prototype)if(u.indexOf("[native code]")!=-1){var l=u.indexOf(" ",8)+1;e+=u.slice(l,u.indexOf("(",l))}else{e+=u;for(var h in a.prototype)e+=";"+c+".prototype."+h+"="+a.prototype[h].toString()}else e+=u}else s[c]=a}return e},Sn=[],Tc=function(t){var e=[];for(var s in t)t[s].buffer&&e.push((t[s]=new t[s].constructor(t[s])).buffer);return e},xc=function(t,e,s,n){if(!Sn[s]){for(var i="",r={},o=t.length-1,a=0;a<o;++a)i=xo(t[a],i,r);Sn[s]={c:xo(t[o],i,r),e:r}}var c=kc({},Sn[s].e);return yc(Sn[s].c+";onmessage=function(e){for(var k in e.data)self[k]=e.data[k];onmessage="+e.toString()+"}",s,c,Tc(c),n)},Ec=function(){return[Fe,Re,pn,gn,mn,bi,vn,yi,vo,xt,bo,Ws,bn,So,Ti,fs,et,ps,yn,wn,Si,gs,_i,ki,wi,yo,_o,xi,Nc,Eo]},Ic=function(){return[Io,Co,_n,To,ko]},Eo=function(t){return postMessage(t,[t.buffer])},Cc=function(t,e,s,n,i,r){var o=xc(s,n,i,function(a,c){o.terminate(),r(a,c)});return o.postMessage([t,e],e.consume?[t.buffer]:[]),function(){o.terminate()}},_n=function(t,e,s){for(;s;++e)t[e]=s,s>>>=8},Io=function(t,e){var s=e.filename;if(t[0]=31,t[1]=139,t[2]=8,t[8]=e.level<2?4:e.level==9?2:0,t[9]=3,e.mtime!=0&&_n(t,4,Math.floor(new Date(e.mtime||Date.now())/1e3)),s){t[3]=8;for(var n=0;n<=s.length;++n)t[n+10]=s.charCodeAt(n)}},Co=function(t){return 10+(t.filename?t.filename.length+1:0)};function Nc(t,e){return xi(t,e||{},0,0)}function Dc(t,e,s){return s||(s=e,e={}),typeof s!="function"&&wo(7),Cc(t,e,[Ec,Ic,function(){return[No]}],function(n){return Eo(No(n.data[0],n.data[1]))},2,s)}function No(t,e){e||(e={});var s=To(),n=t.length;s.p(t);var i=xi(t,e,Co(e),8),r=i.length;return Io(i,e),_n(i,r-8,s.d()),_n(i,r-4,n),i}var Rc=typeof TextDecoder<"u"&&new TextDecoder,Oc=0;try{Rc.decode(Ti,{stream:!0}),Oc=1}catch{}class Do{constructor(){this.idx=1,this.backDict={}}getKey(e){let s=!1;return this.backDict[e]||(s=!0,this.backDict[e]=this.idx++),[this.backDict[e],s]}}class Mc{constructor(e){this.dict=new Do,this.app=e.app,this.isDictDisabled=e.isDictDisabled}sendSetAttribute(e,s,n){if(this.isDictDisabled){const i=[12,e,s,n];return this.app.send(i)}else{const i=[51,e,this.applyDict(s),this.applyDict(n)];return this.app.send(i)}}applyDict(e){const[s,n]=this.dict.getKey(e);return n&&this.app.send([50,s,e]),s}clear(){this.dict=new Do}}class Ac{constructor(e,s){this.app=e,this.startParams=s,this.conditions=[],this.hasStarted=!1,this.createConditionFromFilter=n=>{if(n.value.length){const i=Pc(n);if(i.type)return i}},this.durationInt=null}setConditions(e){this.conditions=e}async fetchConditions(e,s){try{const n=await fetch(`${this.app.options.ingestPoint}/v1/web/conditions/${e}`,{method:"GET",headers:{Authorization:`Bearer ${s}`}}),{conditions:i}=await n.json(),r=[];i.forEach(o=>{o.filters.forEach(c=>{let u;c.type==="fetch"?(u={type:"network_request",subConditions:[],name:o.name},c.filters.forEach(l=>{const h=this.createConditionFromFilter(l);h&&u.subConditions.push(h)})):u=this.createConditionFromFilter(c),u&&(u.type==="session_duration"&&this.processDuration(u.value[0],o.name),r.push({...u,name:o.name}))})}),this.conditions=r}catch{this.app.debug.error("Critical: cannot fetch start conditions")}}trigger(e){if(!this.hasStarted)try{this.hasStarted=!0,this.app.start(this.startParams,void 0,e)}catch(s){this.app.debug.error(s)}}processMessage(e){if(!this.hasStarted)switch(e[0]){case 78:this.jsExceptionEvent(e);break;case 27:this.customEvent(e);break;case 68:this.clickEvent(e);break;case 122:this.pageLocationEvent(e);break;case 83:this.networkRequest(e);break}}processFlags(e){const s=this.conditions.filter(n=>n.type==="feature_flag");s.length&&s.forEach(n=>{const i=ms[n.operator];i&&e.find(r=>i(r.key,n.value))&&this.trigger(n.name)})}processDuration(e,s){this.durationInt=setInterval(()=>{performance.now()>e&&this.trigger(s)},1e3),this.app.attachStopCallback(()=>{this.durationInt&&clearInterval(this.durationInt)})}networkRequest(e){const s=this.conditions.filter(n=>n.type==="network_request");s.length&&s.forEach(n=>{const i=n.subConditions.filter(r=>r.operator!=="isAny");i.length?i.every(o=>{let a;switch(o.key){case"url":a=e[3];break;case"status":a=e[6];break;case"method":a=e[2];break;case"duration":a=e[8];break}const c=ms[o.operator];if(c&&c(a,o.value))return!0})&&this.trigger(n.name):i.length===0&&n.subConditions.length&&this.trigger(n.name)})}customEvent(e){const s=this.conditions.filter(n=>n.type==="custom_event");s.length&&s.forEach(n=>{const i=ms[n.operator];i&&(i(e[1],n.value)||i(e[2],n.value))&&this.trigger(n.name)})}clickEvent(e){const s=this.conditions.filter(n=>n.type==="click");s.length&&s.forEach(n=>{const i=ms[n.operator];i&&(i(e[3],n.value)||i(e[4],n.value))&&this.trigger(n.name)})}pageLocationEvent(e){const s=this.conditions.filter(n=>n.type==="visited_url");s&&s.forEach(n=>{const i=ms[n.operator];i&&i(e[1],n.value)&&this.trigger(n.name)})}jsExceptionEvent(e){const s=[e[1],e[2],e[3]],n=this.conditions.filter(i=>i.type==="exception");n&&n.forEach(i=>{const r=ms[i.operator];r&&s.some(o=>r(o,i.value))&&this.trigger(i.name)})}}const ms={is:(t,e)=>e.some(s=>t.includes(s)),isAny:()=>!0,isNot:(t,e)=>!e.some(s=>t.includes(s)),contains:(t,e)=>e.some(s=>t.includes(s)),notContains:(t,e)=>!e.some(s=>t.includes(s)),startsWith:(t,e)=>e.some(s=>t.startsWith(s)),endsWith:(t,e)=>e.some(s=>t.endsWith(s)),greaterThan:(t,e)=>t>e,greaterOrEqual:(t,e)=>t>=e,lessOrEqual:(t,e)=>t<=e,lessThan:(t,e)=>t<e},Pc=t=>{const e={on:"is",notOn:"isNot",">":"greaterThan","<":"lessThan","=":"is","<=":"lessOrEqual",">=":"greaterOrEqual"},s=i=>{if(Object.keys(e).includes(i))return e[i]};let n={type:"",operator:"",value:t.value,key:""};switch(t.type){case"click":n={type:"click",operator:s(t.operator),value:t.value,key:""};break;case"location":n={type:"visited_url",operator:t.operator,value:t.value,key:""};break;case"custom":n={type:"custom_event",operator:t.operator,value:t.value,key:""};break;case"metadata":n={type:t.source==="featureFlag"?"feature_flag":t.type,operator:t.operator,value:t.value,key:""};break;case"error":n={type:"exception",operator:t.operator,value:t.value,key:""};break;case"duration":n={type:"session_duration",value:t.value[0],key:""};break;case"fetchUrl":n={type:"network_request",key:"url",operator:t.operator,value:t.value};break;case"fetchStatusCode":n={type:"network_request",key:"status",operator:s(t.operator),value:t.value};break;case"fetchMethod":n={type:"network_request",key:"method",operator:s(t.operator),value:t.value};break;case"fetchDuration":n={type:"network_request",key:"duration",operator:s(t.operator),value:t.value};break}return n};class Lc{constructor(e){this.app=e,this.flags=[],this.storageKey="__openreplay_flags";const s=this.app.sessionStorage.getItem(this.storageKey);if(s){const n=s.split(";").filter(Boolean);this.flags=n.map(i=>JSON.parse(i))}}getFeatureFlag(e){return this.flags.find(s=>s.key===e)}isFlagEnabled(e){return this.flags.findIndex(s=>s.key===e)!==-1}onFlagsLoad(e){this.onFlagsCb=e}async reloadFlags(e){const s=this.app.sessionStorage.getItem(this.storageKey),n={};s&&s.split(";").filter(Boolean).forEach(l=>{const h=JSON.parse(l);n[h.key]={key:h.key,value:h.value}});const i=this.app.session.getInfo(),r=this.app.session.userInfo,o={projectID:i.projectID,userID:i.userID,metadata:i.metadata,referrer:document.referrer,os:r.userOS,device:r.userDevice,country:r.userCountry,state:r.userState,city:r.userCity,browser:r.userBrowser,persistFlags:n},a=e??this.app.session.getSessionToken(),c=await fetch(this.app.options.ingestPoint+"/v1/web/feature-flags",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${a}`},body:JSON.stringify(o)});if(c.status===200){const u=await c.json();return this.handleFlags(u.flags)}}handleFlags(e){var r;const s=[];e.forEach(o=>{o.is_persist&&s.push(o)});let n="";return this.diffPersist(s).forEach(o=>{n+=`${JSON.stringify(o)};`}),this.app.sessionStorage.setItem(this.storageKey,n),this.flags=e,(r=this.onFlagsCb)==null?void 0:r.call(this,e)}clearPersistFlags(){this.app.sessionStorage.removeItem(this.storageKey)}diffPersist(e){const s=this.app.sessionStorage.getItem(this.storageKey);if(!s)return e;const i=s.split(";").filter(Boolean).map(r=>JSON.parse(r));return e.filter(r=>i.findIndex(o=>o.key===r.key)===-1)}}const Ro={htmlmasked:"hidden",masked:"obscured"},tt=!(typeof window>"u"),Bc=tt&&navigator.userAgent.match(/firefox|fxios/i),Fc=1e5;let Ei=tt?Date.now()-performance.now():0;function Ii(){Ei=Date.now()-performance.now()}function vs(){return Ei}const Ke=tt&&performance.now?()=>Math.round(performance.now()+Ei):()=>Date.now(),Ci="repeat"in String.prototype?t=>"*".repeat(t.length):t=>t.replace(/./g,"*");function Oo(t){return t.trim().replace(/\s+/g," ")}function Mo(t){return t.startsWith("https://")||t.startsWith("http://")}const kn="https://docs.openreplay.com",Ao={};function Et(t,e,s="/"){Ao[t]||(console.warn(`OpenReplay: ${t} is deprecated. ${e?`Please, use ${e} instead.`:""} Visit ${kn}${s} for more information.`),Ao[t]=!0)}function Ni(t){let e=t.getAttribute("data-openreplay-label");return e!==null||(e=t.getAttribute("data-asayer-label"),e!==null&&Et('"data-asayer-label" attribute','"data-openreplay-label" attribute',"/")),e}function Vt(t,e){const s=`data-openreplay-${e}`;return t.hasAttribute(s)?(Ro[e]&&Et(`"${s}" attribute`,`"${Ro[e]}" attribute`,"/installation/sanitize-data"),!0):!1}function zc(t){try{return!!t.contentDocument}catch{return!1}}function Po(t){try{return t instanceof HTMLIFrameElement?t.contentDocument:t instanceof Window?t.document:t instanceof Document?t.defaultView:"nodeType"in t?t.nodeType:"addEventListener"in t&&t.addEventListener,!0}catch(e){if(e instanceof DOMException&&e.name==="SecurityError")return!1}return!0}function Lo(t){return t.toString(16).padStart(2,"0")}function jc(t){const e=new Uint8Array(t/2),s=window.crypto||window.msCrypto;return s?(s.getRandomValues(e),Array.from(e,Lo).join("")):Array.from({length:t},()=>Lo(Math.floor(Math.random()*16))).join("")}function Bo(){try{return window.self&&window.top&&window.self!==window.top}catch{return!0}}function Di(t){return window.Zone&&"__symbol__"in window.Zone?window.Zone.__symbol__(t):t}function Fo(t,e){if(e)return new MutationObserver(t);{const s=Di("MutationObserver");return new window[s](t)}}function zo(t,e,s,n,i){if(!Po(t))return;let r="addEventListener";i||(r=Di("addEventListener"));try{t[r]?t[r](e,s,n):t.addEventListener(e,s,n)}catch(o){const a=o.message;console.error(`Openreplay: ${a}; if this error is caused by an IframeObserver, ignore it`,e,t)}}function jo(t,e,s,n,i){if(!Po(t))return;let r="removeEventListener";i||(r=Di("removeEventListener"));try{t[r]?t[r](e,s,n):t.removeEventListener(e,s,n)}catch(o){const a=o.message;console.error(`Openreplay: ${a}; if this error is caused by an IframeObserver, ignore it`,e,t)}}class Uc{constructor(){this.taskQueue=[],this.isRunning=!1}addTask(e){this.taskQueue.push(e),this.runTasks()}runTasks(){if(this.isRunning||this.taskQueue.length===0)return;this.isRunning=!0;const e=()=>{if(this.taskQueue.length===0){this.isRunning=!1;return}const s=this.taskQueue.shift();Promise.resolve(s()).then(()=>{requestAnimationFrame(()=>e())})};e()}}const qc=new Uc;function Wc(t){qc.addTask(t)}function Uo(t,e){const s={...t};for(const n in e)if(e.hasOwnProperty(n)){const i=e[n],r=t[n];typeof i=="object"&&!Array.isArray(i)&&i!==null?s[n]=Uo(r||{},i):s[n]=i}return s}function Gt(t){return[0,t]}function Hc(t,e){return[5,t,e]}function Vc(t,e){return[6,t,e]}function Gc(){return[7]}function Kc(t,e,s,n,i){return[8,t,e,s,n,i]}function Xc(t,e,s){return[9,t,e,s]}function Yc(t,e,s){return[10,t,e,s]}function Jc(t){return[11,t]}function qo(t,e){return[13,t,e]}function Qc(t,e){return[14,t,e]}function Zc(t,e,s){return[16,t,e,s]}function $c(t,e,s){return[18,t,e,s]}function eu(t,e){return[19,t,e]}function tu(t,e){return[20,t,e]}function su(t,e){return[22,t,e]}function nu(t,e,s,n,i,r,o,a,c){return[23,t,e,s,n,i,r,o,a,c]}function iu(t,e,s){return[24,t,e,s]}function ru(t,e){return[27,t,e]}function ou(t){return[28,t]}function au(t){return[29,t]}function Wo(t,e){return[30,t,e]}function lu(t,e,s,n){return[49,t,e,s,n]}function cu(t,e){return[54,t,e]}function uu(t){return[55,t]}function Ho(t,e,s,n){return[57,t,e,s,n]}function Vo(t){return[58,t]}function Ri(t,e,s,n){return[60,t,e,s,n]}function hu(t,e,s){return[61,t,e,s]}function du(t,e){return[63,t,e]}function fu(t,e){return[64,t,e]}function pu(t,e,s,n,i,r){return[68,t,e,s,n,i,r]}function Oi(t,e){return[70,t,e]}function Go(t,e,s){return[71,t,e,s]}function Mi(t,e,s,n){return[73,t,e,s,n]}function Ko(t,e){return[75,t,e]}function Xo(t,e){return[76,t,e]}function gu(t,e){return[77,t,e]}function Ai(t,e,s,n){return[78,t,e,s,n]}function Tn(t,e,s,n,i,r,o,a,c){return[83,t,e,s,n,i,r,o,a,c]}function mu(t,e,s,n,i,r){return[84,t,e,s,n,i,r]}function vu(t,e,s,n,i,r){return[112,t,e,s,n,i,r]}function Yo(t,e,s){return[113,t,e,s]}function bu(t){return[114,t]}function Jo(t){return[115,t]}function Qo(t,e,s,n,i,r,o,a,c,u){return[116,t,e,s,n,i,r,o,a,c,u]}function xn(t){return[117,t]}function Kt(t){return[118,t]}function yu(t,e){return[119,t,e]}function wu(t){return[120,t]}function Su(t,e,s,n){return[122,t,e,s,n]}const Pi=tt&&"performance"in window&&"memory"in performance?performance:{memory:{}},Li=tt?(navigator.deviceMemory||0)*1024:0,Bi=Pi.memory.jsHeapSizeLimit||0;function _u(t,e){if(!Object.assign({capturePerformance:!0},e).capturePerformance)return;let n,i;const r=()=>{n===void 0||n===-1||(n++,requestAnimationFrame(r))};t.ticker.attach(()=>{i===void 0||i===-1||i++},0,!1);const o=()=>{n===void 0||i===void 0||(t.send(lu(n,i,Pi.memory.totalJSHeapSize||0,Pi.memory.usedJSHeapSize||0)),i=n=document.hidden?-1:0)};t.attachStartCallback(()=>{i=n=-1,o(),r()}),t.attachStopCallback(()=>{i=n=void 0}),t.ticker.attach(o,40,!1),document.hidden!==void 0&&t.attachEventListener(document,"visibilitychange",o,!1,!1)}const Zo="__or__watched_tags__";class ku{constructor(e){this.intervals={},this.tags=[],this.sessionStorage=e.sessionStorage,this.errLog=e.errLog,this.onTag=e.onTag;const s=JSON.parse(e.sessionStorage.getItem(Zo)??"[]");this.setTags(s),this.observer=new IntersectionObserver(n=>{n.forEach(i=>{if(i.isIntersecting&&i.target){const r=i.target.__or_watcher_tagname;r&&this.onTagRendered(r),this.observer.unobserve(i.target)}})})}async fetchTags(e,s){return fetch(`${e}/v1/web/tags`,{method:"GET",headers:{Authorization:`Bearer ${s}`}}).then(n=>n.json()).then(({tags:n})=>{if(n&&n.length){this.setTags(n);const i=JSON.stringify(n);this.sessionStorage.setItem(Zo,i||"")}}).catch(n=>this.errLog(n))}setTags(e){this.tags=e,this.intervals={},e.forEach(s=>{this.intervals[s.id]=setInterval(()=>{const n=document.querySelectorAll(s.selector);if(n.length>0){const i=n[0];i.__or_watcher_tagname=s.id,this.observer.observe(i)}},500)})}onTagRendered(e){this.intervals[e]&&clearInterval(this.intervals[e]),this.onTag(e)}clear(){this.tags.forEach(e=>{clearInterval(this.intervals[e.id])}),this.tags=[],this.intervals={},this.observer.disconnect()}}const Tu={position:"fixed",top:0,left:0,width:"100vw",height:"100vh",background:"rgba(0, 0, 0, 0.40)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:999999,fontFamily:'-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"'},xu={display:"flex",flexDirection:"column",gap:"2rem",alignItems:"center",padding:"1.5rem",borderRadius:"2px",border:"1px solid #D9D9D9",background:"#FFF",width:"22rem"},En={display:"flex","flex-direction":"column",gap:"unset","align-items":"center",padding:"unset",fontFamily:'-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"',"border-radius":"2px",border:"1px solid #D9D9D9",background:"rgba(255, 255, 255, 0.75)",width:"22rem"},Eu={fontFamily:"Verdana, sans-serif",fontSize:"1.25rem",fontStyle:"normal",fontWeight:"500",lineHeight:"1.75rem",color:"rgba(0, 0, 0, 0.85)"},Iu={borderTop:"1px solid rgba(0, 0, 0, 0.06)",borderBottom:"1px solid rgba(0, 0, 0, 0.06)",padding:"1.25rem 0rem",color:"rgba(0, 0, 0, 0.85)",fontFamily:"Verdana, sans-serif",fontSize:"13px",fontStyle:"normal",fontWeight:"400",lineHeight:"auto",whiteSpace:"pre-wrap"},Cu={display:"flex",padding:"0.4rem 0.9375rem",justifyContent:"center",alignItems:"center",gap:"0.625rem",borderRadius:"0.25rem",border:"1px solid #394EFF",background:"#394EFF",boxShadow:"0px 2px 0px 0px rgba(0, 0, 0, 0.04)",color:"#FFF",textAlign:"center",fontFamily:"Verdana, sans-serif",fontSize:"1rem",fontStyle:"normal",fontWeight:"500",lineHeight:"1.5rem",cursor:"pointer"},$o={fontFamily:"Verdana, sans-serif",fontSize:"13px",fontWeight:"500",lineHeight:"auto",display:"flex",justifyContent:"space-between",width:"100%",cursor:"pointer"},bs={display:"flex",flexDirection:"column",alignItems:"flex-start",gap:"0.625rem",fontSize:"13px",lineHeight:"auto"},Nu={padding:"0.5rem",gap:"0.5rem",fontFamily:"Verdana, sans-serif",fontSize:"16px",fontStyle:"normal",fontWeight:"500",lineHeight:"auto",color:"white",display:"flex",alignItems:"center",width:"100%",borderRadius:"2px",background:"rgba(0, 0, 0, 0.75)",boxSizing:"border-box"},ys={boxSizing:"border-box",display:"block",width:"100%",borderBottom:"1px solid #D9D9D9",background:"#FFF",padding:"0.65rem",alignSelf:"stretch",color:"#000",fontFamily:"Verdana, sans-serif",fontStyle:"normal",fontWeight:"400"},Du={...ys,display:"flex",flexDirection:"column",alignItems:"center",gap:"0.625rem"},ea={fontSize:"1.25rem",fontWeight:"500",cursor:"pointer",color:"#394EFF"},ta={display:"flex",padding:"0.4rem 0.9375rem",justifyContent:"center",alignItems:"center",gap:"0.625rem",borderRadius:"0.25rem",border:"1px solid #394EFF",background:"#394EFF",boxShadow:"0px 2px 0px 0px rgba(0, 0, 0, 0.04)",color:"#FFF",textAlign:"center",fontFamily:"Verdana, sans-serif",fontSize:"1rem",fontStyle:"normal",fontWeight:"500",lineHeight:"1.5rem",width:"100%",boxSizing:"border-box",cursor:"pointer"},sa={marginTop:"1rem",marginBottom:"1rem",cursor:"pointer",display:"block",fontWeight:"500",fontSize:"13px!important",lineHeight:"auto"},Ru={display:"flex",justifyContent:"space-between",alignItems:"center",gap:"1rem",padding:"0.5rem",width:"100%",boxSizing:"border-box"},na={display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",borderRadius:"6.25em",outline:"1px solid #394EFF",fontSize:"13px",height:"24px",width:"24px"},Ou={display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",borderRadius:"6.25em",outline:"1px solid #D2DFFF",boxShadow:"0px 2px 0px 0px rgba(0, 0, 0, 0.04)",background:"#D2DFFF",fontSize:"13px",height:"24px",width:"24px"},ia={borderRadius:"0.375rem",border:"1px solid rgba(0, 0, 0, 0.06)",background:"#F5F7FF",boxShadow:"0px 2px 0px 0px rgba(0, 0, 0, 0.04)",display:"flex",flexDirection:"column",padding:"0.625rem 0.9375rem",gap:"0.5rem",alignSelf:"stretch"},ra={fontWeight:"bold"},Mu={fontSize:"13px",lineHeight:"auto"},oa={marginRight:"0.5rem",cursor:"pointer",color:"#394EFF",textAlign:"center",fontFamily:"Verdana, sans-serif",fontSize:"13px",fontStyle:"normal",fontWeight:"500",lineHeight:"auto"},Au={...oa,display:"flex",padding:"0.25rem 0.9375rem",justifyContent:"center",alignItems:"center",gap:"0.5rem",borderRadius:"0.25rem",border:"1px solid #394EFF"},Pu={display:"flex",justifyContent:"space-between",alignItems:"center",width:"100%",boxSizing:"border-box"},Lu={border:"4px solid rgba(255, 255, 255, 0.4)",width:"16px",height:"16px",borderRadius:"50%",borderLeftColor:"#fff",animation:"spin 0.5s linear infinite"},aa={Standard:{width:1280,height:720}};class Bu{constructor(e){this.app=e,this.mediaRecorder=null,this.recordedChunks=[],this.stream=null,this.recStartTs=null}async startRecording(e,s,n,i){this.recStartTs=this.app.timestamp();const r=s;try{this.stream=await navigator.mediaDevices.getUserMedia({video:i?{...r,frameRate:{ideal:e}}:!1,audio:n}),this.mediaRecorder=new MediaRecorder(this.stream,{mimeType:"video/webm;codecs=vp9"}),this.recordedChunks=[],this.mediaRecorder.ondataavailable=o=>{o.data.size>0&&this.recordedChunks.push(o.data)},this.mediaRecorder.start()}catch(o){console.error(o)}}async stopRecording(){return new Promise(e=>{this.mediaRecorder&&(this.mediaRecorder.onstop=()=>{const s=new Blob(this.recordedChunks,{type:"video/webm"});e(s)},this.mediaRecorder.stop())})}async sendToAPI(){const e=await this.stopRecording();return fetch(`${this.app.options.ingestPoint}/v1/web/uxt/upload-url`,{headers:{Authorization:`Bearer ${this.app.session.getSessionToken()}`}}).then(s=>{if(s.ok)return s.json();throw new Error("Failed to get upload url")}).then(({url:s})=>fetch(s,{method:"PUT",headers:{"Content-Type":"video/webm"},body:e})).catch(console.error).finally(()=>{this.discard()})}async saveToFile(e="recorded-video.webm"){const s=await this.stopRecording(),n=URL.createObjectURL(s),i=document.createElement("a");i.style.display="none",i.href=n,i.download=e,document.body.appendChild(i),i.click(),window.URL.revokeObjectURL(n),document.body.removeChild(i)}discard(){var e,s;(e=this.mediaRecorder)==null||e.stop(),(s=this.stream)==null||s.getTracks().forEach(n=>n.stop())}}function Fu(t,e){e.onmousedown=function(s){const n=t.getBoundingClientRect(),i=s.clientX-n.left,r=s.clientY-n.top;t.style.position="fixed",t.style.zIndex=99999999999999,o(s.pageX,s.pageY);function o(u,l){let h=u-i,d=l-r;h<=5&&(h=5),d<=5&&(d=5),h>=window.innerWidth-n.width&&(h=window.innerWidth-n.width),d>=window.innerHeight-n.height&&(d=window.innerHeight-n.height),t.style.left=`${h}px`,t.style.top=`${d}px`}function a(u){o(u.pageX,u.pageY)}document.addEventListener("mousemove",a);const c=()=>{document.removeEventListener("mousemove",a),document.removeEventListener("mouseup",c)};document.addEventListener("mouseup",c)},e.ondragstart=function(){return!1}}function zu(){const t=document.createElement("div");t.className="grid";for(let e=0;e<16;e++){const s=document.createElement("div");Object.assign(s.style,{width:"2px",height:"2px",borderRadius:"10px",background:"white"}),s.className="cell",t.appendChild(s)}return Object.assign(t.style,{display:"grid",gridTemplateColumns:"repeat(4, 1fr)",gridTemplateRows:"repeat(4, 1fr)",gap:"2px",cursor:"grab"}),t}function ju(){const t=document.createElement("div");Object.assign(t.style,{width:"0",height:"0",borderLeft:"7px solid transparent",borderRight:"7px solid transparent",borderBottom:"7px solid white"});const e=document.createElement("div");return e.appendChild(t),Object.assign(e.style,{display:"flex",alignItems:"center",justifyContent:"center",width:"16px",height:"16px",cursor:"pointer",marginLeft:"auto",transform:"rotate(180deg)"}),e}function Uu(){const t=document.createElement("style");t.type="text/css",t.innerText=`@keyframes spin {
|
|
2
2
|
0% { transform: rotate(0deg); }
|
|
3
3
|
100% { transform: rotate(360deg); }
|
|
4
|
-
}`,document.head.appendChild(t)}function
|
|
4
|
+
}`,document.head.appendChild(t)}function qu(){Uu();const t=document.createElement("div");return t.classList.add("spinner"),Object.assign(t.style,Lu),t}function H(t,e,s,n,i){const r=document.createElement(t);return r.className=e,Object.assign(r.style,s),n&&(r.textContent=n),i&&(r.id=i),r}const In="or_uxt_test_start",Fi="or_uxt_task_index",zi="or_uxt_session_id",Wu="or_uxt_test_id";class Hu{constructor(e,s,n,i,r,o,a,c,u){this.ingestPoint=e,this.getTimestamp=s,this.token=n,this.testId=i,this.storageKey=r,this.setStorageKey=o,this.removeStorageKey=a,this.getStorageKey=c,this.getSessionId=u,this.durations={testStart:0,tasks:[]},this.getDurations=()=>this.durations,this.setDurations=h=>{this.durations.testStart=h.testStart,this.durations.tasks=h.tasks},this.signalTask=(h,d,f)=>{if(!h)return console.error("User Testing: No Task ID Given");const p=this.durations.tasks.find(I=>I.taskId===h),m=this.getTimestamp(),_=p?m-p.started:0;return fetch(`${this.ingestPoint}/v1/web/uxt/signals/task`,{method:"POST",headers:{Authorization:`Bearer ${this.token}`},body:JSON.stringify({testId:this.testId,taskId:h,status:d,duration:_,timestamp:m,taskAnswer:f})})},this.signalTest=h=>{const d=this.getTimestamp();if(h==="begin"&&this.testId){const m=this.getSessionId();this.setStorageKey(zi,m),this.setStorageKey(this.storageKey,this.testId.toString()),this.setStorageKey(In,d.toString())}else this.removeStorageKey(this.storageKey),this.removeStorageKey(Fi),this.removeStorageKey(In);const f=this.durations.testStart||d,p=d-f;return fetch(`${this.ingestPoint}/v1/web/uxt/signals/test`,{method:"POST",headers:{Authorization:`Bearer ${this.token}`},body:JSON.stringify({testId:this.testId,status:h,duration:p,timestamp:d})})};const l=this.getStorageKey(In);l&&(this.durations.testStart=parseInt(l,10))}}class Vu{constructor(e,s){this.app=e,this.storageKey=s,this.bg=H("div","bg",Tu,void 0,"__or_ut_bg"),this.container=H("div","container",xu,void 0,"__or_ut_ct"),this.widgetGuidelinesVisible=!0,this.widgetTasksVisible=!1,this.widgetVisible=!0,this.isActive=!1,this.descriptionSection=null,this.taskSection=null,this.endSection=null,this.stopButton=null,this.stopButtonContainer=null,this.test=null,this.testId=null,this.signalManager=null,this.getTest=(o,a,c)=>{this.testId=o;const u=this.app.options.ingestPoint;return fetch(`${u}/v1/web/uxt/test/${o}`,{headers:{Authorization:`Bearer ${a}`}}).then(l=>l.json()).then(({test:l})=>{this.isActive=!0,this.test=l,this.signalManager=new Hu(this.app.options.ingestPoint,()=>this.app.timestamp(),a,o,this.storageKey,(h,d)=>this.app.localStorage.setItem(h,d),h=>this.app.localStorage.removeItem(h),h=>this.app.localStorage.getItem(h),()=>this.app.getSessionID()),this.createGreeting(l.title,l.reqMic,l.reqCamera),c&&((l.reqMic||l.reqCamera)&&this.userRecorder.startRecording(30,aa.Standard,l.reqMic,l.reqCamera),this.showWidget(l.description,l.tasks,!0),this.showTaskSection())}).then(()=>o).catch(l=>{console.log("OR: Error fetching test",l)})},this.hideTaskSection=()=>!1,this.showTaskSection=()=>!0,this.collapseWidget=()=>!1,this.removeGreeting=()=>!1,this.toggleDescriptionVisibility=()=>{},this.currentTaskIndex=0,this.userRecorder=new Bu(e);const n=this.app.getSessionID(),i=this.app.localStorage.getItem(zi);n!==i&&(this.app.localStorage.removeItem(this.storageKey),this.app.localStorage.removeItem(zi),this.app.localStorage.removeItem(Wu),this.app.localStorage.removeItem(Fi),this.app.localStorage.removeItem(In));const r=this.app.localStorage.getItem(Fi);r&&(this.currentTaskIndex=parseInt(r,10))}getTestId(){return this.testId}createGreeting(e,s,n){const i=H("div","title",Eu,e),r=H("div","description",Iu,`Welcome, you're here to help us improve, not to be judged. Your insights matter!
|
|
5
5
|
|
|
6
6
|
📹 We're recording this browser tab to learn from your experience.
|
|
7
|
-
🎤 Please enable mic and camera if asked, to give us a complete picture.`),o=
|
|
7
|
+
🎤 Please enable mic and camera if asked, to give us a complete picture.`),o=H("div","button",Cu,"Read guidelines to begin");this.removeGreeting=()=>((s||n)&&this.userRecorder.startRecording(30,aa.Standard,s,n),this.container.removeChild(o),this.container.removeChild(r),this.container.removeChild(i),!1),o.onclick=()=>{var c,u,l,h;this.removeGreeting();const a=(c=this.signalManager)==null?void 0:c.getDurations();a&&this.signalManager&&(a.testStart=this.app.timestamp(),this.signalManager.setDurations(a)),(u=this.signalManager)==null||u.signalTest("begin"),this.container.style.fontFamily='-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"',Object.assign(this.container.style,En),this.showWidget(((l=this.test)==null?void 0:l.guidelines)||"",((h=this.test)==null?void 0:h.tasks)||[])},this.container.append(i,r,o),this.bg.appendChild(this.container),document.body.appendChild(this.bg)}showWidget(e,s,n){this.container.innerHTML="",Object.assign(this.bg.style,{position:"fixed",zIndex:99999999999999,right:"8px",left:"unset",width:"fit-content",top:"8px",height:"fit-content",background:"unset",display:"unset",alignItems:"unset",justifyContent:"unset"});const i=this.createTitleSection();this.container.style.fontFamily='-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"',Object.assign(this.container.style,En);const r=this.createDescriptionSection(e),o=this.createTasksSection(s),a=H("div","stop_bn_or",sa,"Abort Session"),c=H("div","stop_ct_or",{fontSize:"13px!important"});c.style.fontSize="13px",c.append(a),this.container.append(i,r,o,c),this.taskSection=o,this.descriptionSection=r,this.stopButton=a,this.stopButtonContainer=c,a.onclick=()=>{var u;this.userRecorder.discard(),(u=this.signalManager)==null||u.signalTest("skipped"),document.body.removeChild(this.bg),window.close()},n?this.toggleDescriptionVisibility():this.hideTaskSection()}createTitleSection(){var a;const e=H("div","title",Nu),s=zu(),n=H("div","title_text",{maxWidth:"19rem",overflow:"hidden",textOverflow:"ellipsis",width:"100%",fontSize:16,lineHeight:"auto",cursor:"pointer"},(a=this.test)==null?void 0:a.title),i=ju();e.append(s,n,i);const r=c=>(this.widgetVisible=c,this.container.style.fontFamily='-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"',Object.assign(this.container.style,this.widgetVisible?En:{border:"none",background:"none",padding:0}),this.taskSection&&Object.assign(this.taskSection.style,this.widgetVisible?ys:{display:"none"}),this.descriptionSection&&Object.assign(this.descriptionSection.style,this.widgetVisible?ys:{display:"none"}),this.endSection&&Object.assign(this.endSection.style,this.widgetVisible?ys:{display:"none"}),this.stopButton&&Object.assign(this.stopButton.style,this.widgetVisible?sa:{display:"none"}),c),o=()=>{Object.assign(i.style,{transform:this.widgetVisible?"rotate(0deg)":"rotate(180deg)"}),r(!this.widgetVisible)};return n.onclick=o,i.onclick=o,Fu(this.bg,s),this.collapseWidget=()=>r(!1),e}createDescriptionSection(e){const s=H("div","description_section_or",ys),n=H("div","description_s_title_or",$o),i=H("div","title",{fontSize:13,fontWeight:500,lineHeight:"auto"},"Introduction & Guidelines"),r=H("div","icon",ea,"-"),o=H("div","content",bs),a=H("div","text_description",{maxHeight:"250px",overflowY:"auto",whiteSpace:"pre-wrap",fontSize:13,color:"#454545",lineHeight:"auto"});a.innerHTML=e;const c=H("div","button_begin_or",ta,"Begin Test");n.append(i,r),o.append(a,c),s.append(n,o);const u=()=>{this.widgetGuidelinesVisible=!this.widgetGuidelinesVisible,r.textContent=this.widgetGuidelinesVisible?"-":"+",Object.assign(o.style,this.widgetGuidelinesVisible?bs:{display:"none"})};return n.onclick=u,this.toggleDescriptionVisibility=()=>{this.widgetGuidelinesVisible=!1,r.textContent=this.widgetGuidelinesVisible?"-":"+",Object.assign(o.style,this.widgetGuidelinesVisible?bs:{display:"none"}),o.removeChild(c)},c.onclick=()=>{var l,h,d;if(u(),this.test){const f=(l=this.signalManager)==null?void 0:l.getDurations(),p=f?f.tasks.findIndex(m=>this.test&&m.taskId===this.test.tasks[0].task_id):null;f&&p===-1&&(f.tasks.push({taskId:this.test.tasks[0].task_id,started:this.app.timestamp()}),(h=this.signalManager)==null||h.setDurations(f)),(d=this.signalManager)==null||d.signalTask(this.test.tasks[0].task_id,"begin")}this.showTaskSection(),o.removeChild(c)},s}createTasksSection(e){this.container.style.fontFamily='-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"',Object.assign(this.container.style,En);const s=H("div","task_section_or",ys),n=H("div","description_t_title_or",$o),i=H("div","title",{fontSize:"13px",fontWeight:"500",lineHeight:"auto"},"Tasks"),r=H("div","icon",ea,"-"),o=H("div","content",bs),a=H("div","pagination",Ru),c=H("div","taskCard",ia),u=H("div","taskText",ra),l=H("div","taskDescription",Mu),h=H("div","taskButtons",Pu),d=H("div","taskText",ra);d.textContent="Your answer";const f=H("textarea","taskDescription",{resize:"vertical"}),p=H("div","inputArea",ia);p.append(d,f);const m=H("div","closePanelButton",oa,"Collapse Panel"),_=H("div","nextButton",Au,"Done, Next");n.append(i,r),c.append(u,l),h.append(m,_),o.append(a,c,p,h),s.append(n,o);const I=()=>{const g=e[this.currentTaskIndex];u.textContent=g.title,l.textContent=g.description,g.allow_typing?p.style.display="flex":p.style.display="none"};e.forEach((g,v)=>{const E=H("span",`or_task_${v}`,{outline:"1px solid #efefef",fontSize:"13px",height:"24px",width:"24px",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",borderRadius:"6.25em"},(v+1).toString());E.id=`or_task_${v}`,a.append(E)});const T=()=>{this.widgetTasksVisible=!this.widgetTasksVisible,r.textContent=this.widgetTasksVisible?"-":"+",Object.assign(o.style,this.widgetTasksVisible?bs:{display:"none"})};this.hideTaskSection=()=>(r.textContent="+",Object.assign(o.style,{display:"none"}),this.widgetTasksVisible=!1,!1),this.showTaskSection=()=>(r.textContent="-",Object.assign(o.style,bs),this.widgetTasksVisible=!0,!0);const y=()=>{const g=document.getElementById(`or_task_${this.currentTaskIndex}`);g&&Object.assign(g.style,na);for(let v=0;v<this.currentTaskIndex;v++){const E=document.getElementById(`or_task_${v}`);E&&Object.assign(E.style,Ou)}};return n.onclick=T,m.onclick=this.collapseWidget,_.onclick=()=>{var v,E,C,S;const g=e[this.currentTaskIndex].allow_typing?f.value:void 0;if(f.value="",(v=this.signalManager)==null||v.signalTask(e[this.currentTaskIndex].task_id,"done",g),this.currentTaskIndex<e.length-1){this.currentTaskIndex++,I();const k=(E=this.signalManager)==null?void 0:E.getDurations();k&&k.tasks.findIndex(A=>A.taskId===e[this.currentTaskIndex].task_id)===-1&&(k.tasks.push({taskId:e[this.currentTaskIndex].task_id,started:this.app.timestamp()}),(C=this.signalManager)==null||C.setDurations(k)),(S=this.signalManager)==null||S.signalTask(e[this.currentTaskIndex].task_id,"begin"),y()}else this.showEndSection();this.app.localStorage.setItem("or_uxt_task_index",this.currentTaskIndex.toString())},setTimeout(()=>{const g=document.getElementById("or_task_0");g&&Object.assign(g.style,na),I(),y()},1),s}showEndSection(){var a,c,u,l;let e=!0;(a=this.signalManager)==null||a.signalTest("done");const s=H("div","end_section_or",Du),n=H("div","end_title_or",{fontSize:"1.25rem",fontWeight:"500"},"Thank you! 👍"),i=H("div","end_description_or",{},((c=this.test)==null?void 0:c.conclusion)??`Thank you for participating in our usability test. Your feedback has been captured and will be used to enhance our website.
|
|
8
8
|
|
|
9
|
-
We appreciate your time and valuable input.`),r=q("div","end_button_or",$o,"Submitting Feedback"),o=Uu();r.appendChild(o),(u=this.test)!=null&&u.reqMic||(l=this.test)!=null&&l.reqCamera?this.userRecorder.sendToAPI().then(()=>{r.removeChild(o),r.textContent="End Session",e=!1}).catch(h=>{console.error(h),r.removeChild(o),r.textContent="End Session",e=!1}):(r.removeChild(o),r.textContent="End Session",e=!1),this.taskSection&&this.container.removeChild(this.taskSection),this.descriptionSection&&this.container.removeChild(this.descriptionSection),this.stopButton&&this.stopButtonContainer&&this.container.removeChild(this.stopButtonContainer),r.onclick=()=>{e||(window.close(),document.body.removeChild(this.bg))},s.append(n,i,r),this.endSection=s,this.container.append(s)}}function oa(t){return!!t&&t.nodeType!=null}function ji(t){return t.namespaceURI==="http://www.w3.org/2000/svg"}function gt(t){return t.nodeType===Node.ELEMENT_NODE}function Vu(t){return t.nodeType===Node.COMMENT_NODE}function zi(t){return t.nodeType===Node.TEXT_NODE}function Cn(t){return t.nodeType===Node.DOCUMENT_NODE}function xn(t){return t.nodeType===Node.DOCUMENT_NODE||t.nodeType===Node.DOCUMENT_FRAGMENT_NODE}function he(t,e){return t.localName===e}class Gu{constructor(e,s){this.app=e,this.options=s,this.snapshots={},this.intervals=[],this.restartTracking=()=>{this.clear(),this.app.nodes.scanTree(this.captureCanvas)},this.captureCanvas=n=>{const i=this.app.nodes.getID(n);if(!i||!he(n,"canvas")||this.app.sanitizer.isObscured(i)||this.app.sanitizer.isHidden(i)||!he(n,"canvas")||this.snapshots[i])return;new IntersectionObserver(a=>{a.forEach(c=>{c.isIntersecting&&(c.target?this.snapshots[i]&&this.snapshots[i].createdAt?this.snapshots[i].paused=!1:this.recordCanvas(c.target,i):this.snapshots[i]&&(this.snapshots[i].paused=!0))})}).observe(n)},this.recordCanvas=(n,i)=>{const r=this.app.timestamp();this.snapshots[i]={images:[],createdAt:r,paused:!1,dummy:document.createElement("canvas")};const o=bu(i.toString(),r);this.app.send(o);const a=u=>{Ku(u,this.options.quality,this.snapshots[i].dummy,this.options.fixedScaling,this.fileExt,l=>{if(l){if(!this.snapshots[i])return this.app.debug.warn("Canvas not present in snapshots after capture:",this.snapshots,i);this.snapshots[i].images.push({id:this.app.timestamp(),data:l}),this.snapshots[i].images.length>9&&(this.sendSnaps(this.snapshots[i].images,i,this.snapshots[i].createdAt),this.snapshots[i].images=[])}})},c=setInterval(()=>{const u=this.app.nodes.getID(n),l=u?this.app.nodes.getNode(u):void 0;if(!this.snapshots[i]){this.app.debug.log("Canvas is not present in {snapshots}"),clearInterval(c);return}if(!l||!he(l,"canvas")||l!==n){this.app.debug.log("Canvas element not in sync",l,n),clearInterval(c);return}else this.snapshots[i].paused||(this.options.useAnimationFrame?requestAnimationFrame(()=>{a(l)}):a(l))},this.interval);this.intervals.push(c)},this.fileExt=s.fileExt??"webp",this.interval=1e3/s.fps}startTracking(){setTimeout(()=>{this.app.nodes.scanTree(this.captureCanvas),this.app.nodes.attachNodeCallback(this.captureCanvas)},250)}sendSnaps(e,s,n){if(Object.keys(this.snapshots).length===0)return;const i=new FormData;e.forEach(o=>{const a=o.data;a&&(i.append("snapshot",a,`${n}_${s}_${o.id}.${this.fileExt}`),this.options.isDebug&&Xu(a,`${n}_${s}_${o.id}.${this.fileExt}`))});const r=()=>{this.app.debug.log("Restarting tracker; token expired"),this.app.stop(!1),setTimeout(()=>{this.app.start({},!0)},250)};fetch(this.app.options.ingestPoint+"/v1/web/images",{method:"POST",headers:{Authorization:`Bearer ${this.app.session.getSessionToken()??""}`},body:i}).then(o=>o.status===401?r():!0).catch(o=>{this.app.debug.error("error saving canvas",o)})}clear(){this.intervals.forEach(e=>clearInterval(e)),this.snapshots={}}}const aa={low:.35,medium:.55,high:.8};function Ku(t,e="medium",s,n=!1,i,r){const o=`image/${i}`;if(n){const a=window.devicePixelRatio||1;s.width=t.width/a,s.height=t.height/a;const c=s.getContext("2d");if(!c)return"";c.clearRect(0,0,s.width,s.height),c.drawImage(t,0,0,s.width,s.height),s.toBlob(r,o,aa[e])}else t.toBlob(r,o,aa[e])}function Xu(t,e){const s=URL.createObjectURL(t),n=document.createElement("a");n.href=s,n.download=e,n.style.display="none",document.body.appendChild(n),n.click(),document.body.removeChild(n)}const ys={Verbose:5,Log:4,Warnings:3,Errors:2,Silent:0};class Ju{constructor(e=ys.Silent){this.shouldLog=s=>this.level>=s,this.info=(...s)=>{this.shouldLog(ys.Verbose)&&console.info(...s)},this.log=(...s)=>{this.shouldLog(ys.Log)&&console.log(...s)},this.warn=(...s)=>{this.shouldLog(ys.Warnings)&&console.warn(...s)},this.error=(...s)=>{this.shouldLog(ys.Errors)&&console.error(...s)},this.level=e}}const Yu=1e3;function Qu(t,e,s){const n=t.entries();function i(){const r=[];let o=n.next();for(;!o.done&&r.length<e;)r.push(o.value),o=n.next();r.length>0&&(r.forEach(([a,c])=>{c&&s(c)}),setTimeout(i,50))}i()}function Zu(t){var e;try{if(!t.isConnected)return[!1,"not connected"];const s=t.nodeType===Node.DOCUMENT_NODE,n=s?t.defaultView:(e=t.ownerDocument)==null?void 0:e.defaultView,i=s?t:t.ownerDocument;return n?n.closed?[!1,"window closed"]:i!=null&&i.documentElement.isConnected?[!0,"ok"]:[!1,"documentElement not connected"]:[!1,"no window"]}catch(s){return[!1,s]}}const $u={interval:Yu*30,batchSize:2500,enabled:!0};class eh{constructor(e,s,n){this.nodes=e,this.unregisterNode=s,this.start=()=>{this.options.enabled&&(this.stop(),this.interval=setInterval(()=>{Qu(this.nodes,this.options.batchSize,i=>{Zu(i)[0]||this.unregisterNode(i)})},this.options.interval))},this.stop=()=>{this.interval&&clearInterval(this.interval)},this.options={...$u,...n}}}class th{constructor(e){this.nodes=new Map,this.totalNodeAmount=0,this.nodeCallbacks=[],this.elementListeners=new Map,this.nextNodeId=0,this.scanTree=s=>{this.nodes.forEach(n=>n?s(n):void 0)},this.attachNodeListener=(s,n,i,r=!0)=>{const o=this.getID(s);if(o===void 0)return;Bo(s,n,i,r,this.forceNgOff);let a=this.elementListeners.get(o);a===void 0&&(a=[],this.elementListeners.set(o,a)),a.push([n,i,r])},this.unregisterNode=s=>{const n=s[this.node_id];if(n!==void 0){s[this.node_id]=void 0,delete s[this.node_id],this.nodes.delete(n);const i=this.elementListeners.get(n);i!==void 0&&(this.elementListeners.delete(n),i.forEach(r=>Fo(s,r[0],r[1],r[2],this.forceNgOff))),this.totalNodeAmount--}return n},this.node_id=e.node_id,this.forceNgOff=e.forceNgOff,this.maintainer=new eh(this.nodes,this.unregisterNode,e.maintainer),this.maintainer.start()}syntheticMode(e){const s=Number.MAX_SAFE_INTEGER,i=99999999*e;if(i>s)throw new Error("Placeholder id overflow");this.nextNodeId=i}attachNodeCallback(e){return this.nodeCallbacks.push(e)}registerNode(e){let s=e[this.node_id];const n=s===void 0;return n&&(s=this.nextNodeId,this.totalNodeAmount++,this.nextNodeId++,this.nodes.set(s,e),e[this.node_id]=s),[s,n]}cleanTree(){for(const[e,s]of this.nodes)s&&!document.contains(s)&&this.unregisterNode(s)}callNodeCallbacks(e,s){this.nodeCallbacks.forEach(n=>n(e,s))}getID(e){if(e)return e[this.node_id]}getNode(e){return this.nodes.get(e)}getNodeCount(){return this.totalNodeAmount}clear(){for(const[e,s]of this.nodes)s&&this.unregisterNode(s);this.nextNodeId=0,this.nodes.clear()}}function Nn(t){if(Vu(t))return!0;if(zi(t))return!1;if(!gt(t))return!0;const e=t.tagName.toUpperCase();if(e==="LINK"){const s=t.getAttribute("rel"),n=t.getAttribute("as");return!(s!=null&&s.includes("stylesheet")||n==="style"||n==="font")}return e==="SCRIPT"||e==="NOSCRIPT"||e==="META"||e==="TITLE"||e==="BASE"}function Ui(t){return xn(t)?!0:!Nn(t)}var st;(function(t){t[t.New=0]="New",t[t.Removed=1]="Removed",t[t.Changed=2]="Changed"})(st||(st={}));class Wi{constructor(e,s=!1){this.app=e,this.isTopContext=s,this.commited=[],this.recents=new Map,this.indexes=[],this.attributesMap=new Map,this.textSet=new Set,this.observer=Lo(this.app.safe(n=>{for(const i of n){const r=i.target,o=i.type;if(!Ui(r))continue;if(o==="childList"){for(let c=0;c<i.removedNodes.length;c++)Ui(i.removedNodes[c])&&this.bindNode(i.removedNodes[c]);for(let c=0;c<i.addedNodes.length;c++)this.bindTree(i.addedNodes[c]);continue}const a=this.app.nodes.getID(r);if(a!==void 0){if(this.recents.has(a)||this.recents.set(a,st.Changed),o==="attributes"){const c=i.attributeName;if(c===null)continue;let u=this.attributesMap.get(a);u===void 0&&this.attributesMap.set(a,u=new Set),u.add(c);continue}o==="characterData"&&this.textSet.add(a)}}this.commitNodes()}),this.app.options.forceNgOff)}clear(){this.commited.length=0,this.recents.clear(),this.indexes.length=1,this.attributesMap.clear(),this.textSet.clear()}handleIframeSrcChange(e){const s=e.contentDocument;if(s&&this.app.nodes.getID(s)!==void 0){const i=document.createTreeWalker(s,NodeFilter.SHOW_ELEMENT+NodeFilter.SHOW_TEXT,{acceptNode:c=>Nn(c)||this.app.nodes.getID(c)===void 0?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_ACCEPT},!1);let r=0;const o=this.app.nodes.getNodeCount();for(;i.nextNode();)e.contentDocument.contains(i.currentNode)||(r+=1,this.app.nodes.unregisterNode(i.currentNode));const a=Math.floor(r/o*100);a>30&&this.app.send(Xo(a))}}sendNodeAttribute(e,s,n,i){if(ji(s)){n.substring(0,6)==="xlink:"&&(n=n.substring(6)),i===null?this.app.send(zo(e,n)):n==="href"?(i.length>1e5&&(i=""),this.app.send(Di(e,n,i,this.app.getBaseHref()))):this.app.attributeSender.sendSetAttribute(e,n,i);return}if(!(n==="src"||n==="srcset"||n==="integrity"||n==="crossorigin"||n==="autocomplete"||n.substring(0,2)==="on")&&!(n==="value"&&he(s,"input")&&s.type!=="button"&&s.type!=="reset"&&s.type!=="submit")){if(i===null){this.app.send(zo(e,n));return}if(n==="style"||n==="href"&&he(s,"link")){this.app.send(Di(e,n,i,this.app.getBaseHref()));return}(n==="href"||i.length>1e5)&&(i=""),this.app.attributeSender.sendSetAttribute(e,n,i)}}sendNodeData(e,s,n){if(he(s,"style")){this.app.send(uu(e,n,this.app.getBaseHref()));return}n=this.app.sanitizer.sanitize(e,n),this.app.send(Yc(e,n))}bindNode(e){const[s,n]=this.app.nodes.registerNode(e);n?this.recents.set(s,st.New):this.recents.get(s)!==st.New&&this.recents.set(s,st.Removed)}bindTree(e){if(!Ui(e))return;this.bindNode(e);const s=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT+NodeFilter.SHOW_TEXT,{acceptNode:n=>(this.app.nodes.getID(n)!==void 0&&this.app.debug.error("! Node is already bound",n),Nn(n)||this.app.nodes.getID(n)!==void 0?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_ACCEPT)},!1);for(;s.nextNode();)this.bindNode(s.currentNode)}unbindTree(e){const s=this.app.nodes.unregisterNode(e);if(s!==void 0&&this.recents.get(s)===st.Removed){this.app.send(Jc(s));const n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT+NodeFilter.SHOW_TEXT,{acceptNode:a=>Nn(a)||this.app.nodes.getID(a)===void 0?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_ACCEPT},!1);let i=0;const r=this.app.nodes.getNodeCount();for(;n.nextNode();)i+=1,this.app.nodes.unregisterNode(n.currentNode);const o=Math.floor(i/r*100);o>30&&this.app.send(Xo(o))}}_commitNode(e,s){if(xn(s))return!0;const n=s.parentNode;let i;if(!he(s,"html")||!this.isTopContext){if(n===null)return this.unbindTree(s),!1;if(i=this.app.nodes.getID(n),i===void 0)return this.unbindTree(s),!1;if(!this.commitNode(i))return this.unbindTree(s),!1;if(this.app.sanitizer.handleNode(e,i,s),this.app.sanitizer.isHidden(i))return!1}let r=s.previousSibling;for(;r!==null;){const l=this.app.nodes.getID(r);if(l!==void 0){this.commitNode(l),this.indexes[e]=this.indexes[l]+1;break}r=r.previousSibling}r===null&&(this.indexes[e]=0);const o=this.recents.get(e),a=o===st.New,c=this.indexes[e];if(c===void 0)throw"commitNode: missing node index";if(a){if(gt(s)){let l=s;if(i!==void 0){if(this.app.sanitizer.isHidden(e)){const h=l.clientWidth,f=l.clientHeight;l=s.cloneNode(),l.style.width=`${h}px`,l.style.height=`${f}px`}this.app.send(Gc(e,i,c,l.tagName,ji(s)))}for(let h=0;h<l.attributes.length;h++){const f=l.attributes[h];this.sendNodeAttribute(e,l,f.nodeName,f.value)}}else zi(s)&&(this.app.send(Kc(e,i,c)),this.sendNodeData(e,n,s.data));return!0}o===st.Removed&&i!==void 0&&this.app.send(Xc(e,i,c));const u=this.attributesMap.get(e);if(u!==void 0){if(!gt(s))throw"commitNode: node is not an element";for(const l of u)this.sendNodeAttribute(e,s,l,s.getAttribute(l))}if(this.textSet.has(e)){if(!zi(s))throw"commitNode: node is not a text";this.sendNodeData(e,n,s.data)}return!0}commitNode(e){const s=this.app.nodes.getNode(e);if(s===void 0)return!1;const n=this.commited[e];return n!==void 0?n:this.commited[e]=this._commitNode(e,s)}commitNodes(e=!1){let s;this.recents.forEach((n,i)=>{this.commitNode(i),n===st.New&&(s=this.app.nodes.getNode(i))&&this.app.nodes.callNodeCallbacks(s,e)}),this.clear()}observeRoot(e,s,n=e){this.observer.observe(e,{childList:!0,attributes:!0,characterData:!0,subtree:!0,attributeOldValue:!1,characterDataOldValue:!1}),this.bindTree(n),s(this.app.nodes.getID(e)),this.commitNodes(!0)}disconnect(){this.observer.disconnect(),this.clear()}}class la extends Wi{observe(e){const s=e.contentDocument,n=this.app.nodes.getID(e);!s||n===void 0||this.observeRoot(s,i=>{if(i===void 0){this.app.debug.log("OpenReplay: Iframe document not bound");return}this.docId=i,this.app.send(Ri(n,i))})}syntheticObserve(e,s){this.observeRoot(s,n=>{if(n===void 0){this.app.debug.log("OpenReplay: Iframe document not bound");return}this.app.send(Ri(e,n))})}}class sh extends Wi{observe(e){const s=e.shadowRoot,n=this.app.nodes.getID(e);!s||n===void 0||this.observeRoot(s,i=>{if(i===void 0){this.app.debug.error("OpenReplay: Shadow Root was not bound");return}this.app.send(Ri(n,i))})}}class nh{constructor(){this.states=new WeakMap}calcOffset(e){let s=0,n=0;if(e.parent&&([s,n]=this.calcOffset(e.parent)),!e.offset){const{left:o,top:a}=e.iFrame.getBoundingClientRect();e.offset=[o,a]}const[i,r]=e.offset;return[s+i,n+r]}getDocumentOffset(e){const s=this.states.get(e);return s?this.calcOffset(s):[0,0]}observe(e){var a;const s=e.contentDocument;if(!s)return;const n=e.ownerDocument,i=this.states.get(n),r={offset:null,iFrame:e,parent:i||null,clear:()=>{var c;n.removeEventListener("scroll",o),(c=n.defaultView)==null||c.removeEventListener("resize",o)}},o=()=>{r.offset=null};n.addEventListener("scroll",o),(a=n.defaultView)==null||a.addEventListener("resize",o),this.states.set(s,r)}clear(){this.states=new WeakMap}}const Hi=tt?Element.prototype.attachShadow:()=>new ShadowRoot;class ih extends Wi{constructor(e){super(e.app,!0),this.iframeOffsets=new nh,this.contextCallbacks=[],this.contextsSet=new WeakSet,this.iframeObserversArr=[],this.iframeObservers=new WeakMap,this.docObservers=new WeakMap,this.shadowRootObservers=new WeakMap,this.app=e.app,this.options=Object.assign({captureIFrames:!0},e.options),this.app.nodes.attachNodeCallback(s=>{he(s,"iframe")&&(this.options.captureIFrames&&!qt(s,"obscured")||qt(s,"capture"))&&this.handleIframe(s)}),this.app.nodes.attachNodeCallback(s=>{gt(s)&&s.shadowRoot!==null&&this.handleShadowRoot(s.shadowRoot)})}attachContextCallback(e){this.contextCallbacks.push(e)}getDocumentOffset(e){return this.iframeOffsets.getDocumentOffset(e)}handleIframe(e){const s=this.app.safe(()=>setTimeout(()=>{const n=this.app.nodes.getID(e);if(n===void 0||!Fc(e))return;const i=e.contentWindow,r=e.contentDocument;if(!r){this.app.debug.warn("no doc for iframe found",e);return}if(r&&this.docObservers.has(r)){this.app.debug.info("doc already observed for",n);return}const o=new la(this.app);this.iframeObservers.set(e,o),this.docObservers.set(r,o),this.iframeObserversArr.push(o),o.observe(e),this.iframeOffsets.observe(e),i&&i===i.window&&!this.contextsSet.has(i)&&(this.contextsSet.add(i),this.contextCallbacks.forEach(a=>a(i)))},250));e.addEventListener("load",s),s()}handleShadowRoot(e){const s=new sh(this.app);this.shadowRootObservers.set(e,s),s.observe(e.host)}observe(){const e=this;Element.prototype.attachShadow=function(){const s=Hi.apply(this,arguments);return e.handleShadowRoot(s),s},this.app.nodes.clear(),this.observeRoot(window.document,()=>{this.app.send(Vc()),this.app.nodes.callNodeCallbacks(document,!0)},window.document.documentElement)}crossdomainObserve(e,s){const n=this;Element.prototype.attachShadow=function(){const r=Hi.apply(this,arguments);return n.handleShadowRoot(r),r},this.app.nodes.clear(),this.app.nodes.syntheticMode(s);const i=new la(this.app);this.iframeObservers.set(window.document,i),i.syntheticObserve(e,window.document)}disconnect(){this.iframeOffsets.clear(),Element.prototype.attachShadow=Hi,this.iframeObserversArr.forEach(e=>e.disconnect()),this.iframeObserversArr=[],this.iframeObservers=new WeakMap,this.shadowRootObservers=new WeakMap,this.docObservers=new WeakMap,super.disconnect()}}var Dn;(function(t){t[t.Plain=0]="Plain",t[t.Obscured=1]="Obscured",t[t.Hidden=2]="Hidden"})(Dn||(Dn={}));const rh=t=>t.trim().replace(/[^\f\n\r\t\v\u00a0\u1680\u2000-\u200a\u2028\u2029\u202f\u205f\u3000\ufeff]/g,"█");class oh{constructor(e){this.obscured=new Set,this.hidden=new Set,this.app=e.app,this.options=Object.assign({obscureTextEmails:!0,obscureTextNumbers:!1},e.options)}handleNode(e,s,n){if((this.obscured.has(s)||gt(n)&&(qt(n,"masked")||qt(n,"obscured")))&&this.obscured.add(e),(this.hidden.has(s)||gt(n)&&(qt(n,"htmlmasked")||qt(n,"hidden")))&&this.hidden.add(e),this.options.domSanitizer!==void 0&>(n)){const i=this.options.domSanitizer(n);i===Dn.Obscured&&this.obscured.add(e),i===Dn.Hidden&&this.hidden.add(e)}}sanitize(e,s){return this.obscured.has(e)?rh(s):(this.options.obscureTextNumbers&&(s=s.replace(/\d/g,"0")),this.options.obscureTextEmails&&(s=s.replace(/^\w+([+.-]\w+)*@\w+([.-]\w+)*\.\w{2,3}$/g,n=>{const[i,r]=n.split("@"),[o,a]=r.split(".");return`${Ci(i)}@${Ci(o)}.${Ci(a)}`})),s)}isObscured(e){return this.obscured.has(e)}isHidden(e){return this.hidden.has(e)}getInnerTextSecure(e){const s=this.app.nodes.getID(e);return s?this.sanitize(s,e.innerText):""}clear(){this.obscured.clear(),this.hidden.clear()}}class ah{constructor(e){this.metadata={},this.userID=null,this.callbacks=[],this.timestamp=0,this.app=e.app,this.options=e.options,this.createTabId()}attachUpdateCallback(e){this.callbacks.push(e)}handleUpdate(e){e.userID==null&&delete e.userID,e.sessionID==null&&delete e.sessionID,this.callbacks.forEach(s=>s(e))}assign(e){e.userID!==void 0&&(this.userID=e.userID),e.metadata!==void 0&&Object.entries(e.metadata).forEach(([s,n])=>this.metadata[s]=n),e.sessionID!==void 0&&(this.sessionID=e.sessionID),e.timestamp!==void 0&&(this.timestamp=e.timestamp),e.projectID!==void 0&&(this.projectID=e.projectID),this.handleUpdate(e)}setMetadata(e,s){this.metadata[e]=s,this.handleUpdate({metadata:{[e]:s}})}setUserID(e){this.userID=e,this.handleUpdate({userID:e})}setUserInfo(e){this.userInfo=e}getPageNumber(){const e=this.app.sessionStorage.getItem(this.options.session_pageno_key);if(e!=null)return parseInt(e)}incPageNo(){let e=this.getPageNumber();return e===void 0?e=0:e++,this.app.sessionStorage.setItem(this.options.session_pageno_key,e.toString()),e}getSessionToken(){return this.token||this.app.sessionStorage.getItem(this.options.session_token_key)||void 0}setSessionToken(e){this.token=e,this.app.sessionStorage.setItem(this.options.session_token_key,e)}applySessionHash(e){const s=decodeURI(e).split("&");let n=e,i="100500";s.length==2&&([i,n]=s),!(!i||!n)&&(this.app.sessionStorage.setItem(this.options.session_token_key,n),this.app.sessionStorage.setItem(this.options.session_pageno_key,i))}getSessionHash(){const e=this.getPageNumber(),s=this.getSessionToken();if(!(e===void 0||s===void 0))return encodeURI(String(e)+"&"+s)}getTabId(){return this.tabId||this.createTabId(),this.tabId}regenerateTabId(){const e=jc(12);this.app.sessionStorage.setItem(this.options.session_tabid_key,e),this.tabId=e}createTabId(){const e=this.app.sessionStorage.getItem(this.options.session_tabid_key);e?this.tabId=e:this.regenerateTabId()}getInfo(){return{sessionID:this.sessionID,metadata:this.metadata,userID:this.userID,timestamp:this.timestamp,projectID:this.projectID}}reset(){this.app.sessionStorage.removeItem(this.options.session_token_key),this.metadata={},this.userID=null,this.sessionID=void 0,this.timestamp=0}}function lh(t,e){let s=0;return()=>{s++>=e&&(s=0,t())}}class ch{constructor(e){this.app=e,this.timer=null,this.callbacks=[]}attach(e,s=0,n=!0,i){i&&(e=e.bind(i)),n&&(e=this.app.safe(e)),this.callbacks.unshift(s?lh(e,s):e)-1}start(){this.timer===null&&(this.timer=setInterval(()=>this.callbacks.forEach(e=>{e&&e()}),30))}stop(){this.timer!==null&&(clearInterval(this.timer),this.timer=null)}}const uh='!function(){"use strict";class t{constructor(t,s,i,e=10,n=250,h,r){this.onUnauthorised=s,this.onFailure=i,this.MAX_ATTEMPTS_COUNT=e,this.ATTEMPT_TIMEOUT=n,this.onCompress=h,this.pageNo=r,this.attemptsCount=0,this.busy=!1,this.queue=[],this.token=null,this.lastBatchNum=0,this.ingestURL=t+"/v1/web/i",this.isCompressing=void 0!==h}getQueueStatus(){return 0===this.queue.length&&!this.busy}authorise(t){this.token=t,this.busy||this.sendNext()}push(t){if(this.busy||!this.token)this.queue.push(t);else if(this.busy=!0,this.isCompressing&&this.onCompress)this.onCompress(t);else{const s=++this.lastBatchNum;this.sendBatch(t,!1,s)}}sendNext(){const t=this.queue.shift();if(t)if(this.busy=!0,this.isCompressing&&this.onCompress)this.onCompress(t);else{const s=++this.lastBatchNum;this.sendBatch(t,!1,s)}else this.busy=!1}retry(t,s,i){this.attemptsCount>=this.MAX_ATTEMPTS_COUNT?this.onFailure(`Failed to send batch after ${this.attemptsCount} attempts.`):(this.attemptsCount++,setTimeout((()=>this.sendBatch(t,s,i)),this.ATTEMPT_TIMEOUT*this.attemptsCount))}sendBatch(t,s,i){var e;const n=null==i?void 0:i.toString().replace(/^([^_]+)_([^_]+).*/,"$1_$2_$3");this.busy=!0;const h={Authorization:`Bearer ${this.token}`};s&&(h["Content-Encoding"]="gzip"),null!==this.token?fetch(`${this.ingestURL}?batch=${null!==(e=this.pageNo)&&void 0!==e?e:"noPageNum"}_${null!=n?n:"noBatchNum"}`,{body:t,method:"POST",headers:h,keepalive:t.length<65536}).then((e=>{if(401===e.status)return this.busy=!1,void this.onUnauthorised();e.status>=400?this.retry(t,s,`${null!=i?i:"noBatchNum"}_network:${e.status}`):(this.attemptsCount=0,this.sendNext())})).catch((e=>{console.warn("OpenReplay:",e),this.retry(t,s,`${null!=i?i:"noBatchNum"}_reject:${e.message}`)})):setTimeout((()=>{this.sendBatch(t,s,`${null!=i?i:"noBatchNum"}_newToken`)}),500)}sendCompressed(t){const s=++this.lastBatchNum;this.sendBatch(t,!0,s)}sendUncompressed(t){const s=++this.lastBatchNum;this.sendBatch(t,!1,s)}clean(){this.sendNext(),setTimeout((()=>{this.token=null,this.queue.length=0}),10)}}const s="function"==typeof TextEncoder?new TextEncoder:{encode(t){const s=t.length,i=new Uint8Array(3*s);let e=-1;for(let n=0,h=0,r=0;r!==s;){if(n=t.charCodeAt(r),r+=1,n>=55296&&n<=56319){if(r===s){i[e+=1]=239,i[e+=1]=191,i[e+=1]=189;break}if(h=t.charCodeAt(r),!(h>=56320&&h<=57343)){i[e+=1]=239,i[e+=1]=191,i[e+=1]=189;continue}if(n=1024*(n-55296)+h-56320+65536,r+=1,n>65535){i[e+=1]=240|n>>>18,i[e+=1]=128|n>>>12&63,i[e+=1]=128|n>>>6&63,i[e+=1]=128|63&n;continue}}n<=127?i[e+=1]=0|n:n<=2047?(i[e+=1]=192|n>>>6,i[e+=1]=128|63&n):(i[e+=1]=224|n>>>12,i[e+=1]=128|n>>>6&63,i[e+=1]=128|63&n)}return i.subarray(0,e+1)}};class i{constructor(t){this.size=t,this.offset=0,this.checkpointOffset=0,this.data=new Uint8Array(t)}getCurrentOffset(){return this.offset}checkpoint(){this.checkpointOffset=this.offset}get isEmpty(){return 0===this.offset}skip(t){return this.offset+=t,this.offset<=this.size}set(t,s){this.data.set(t,s)}boolean(t){return this.data[this.offset++]=+t,this.offset<=this.size}uint(t){for((t<0||t>Number.MAX_SAFE_INTEGER)&&(t=0);t>=128;)this.data[this.offset++]=t%256|128,t=Math.floor(t/128);return this.data[this.offset++]=t,this.offset<=this.size}int(t){return t=Math.round(t),this.uint(t>=0?2*t:-2*t-1)}string(t){const i=s.encode(t),e=i.byteLength;return!(!this.uint(e)||this.offset+e>this.size)&&(this.data.set(i,this.offset),this.offset+=e,!0)}reset(){this.offset=0,this.checkpointOffset=0}flush(){const t=this.data.slice(0,this.checkpointOffset);return this.reset(),t}}class e extends i{encode(t){switch(t[0]){case 0:case 11:case 114:case 115:return this.uint(t[1]);case 4:case 44:case 47:return this.string(t[1])&&this.string(t[2])&&this.uint(t[3]);case 5:case 20:case 38:case 70:case 75:case 76:case 77:case 82:return this.uint(t[1])&&this.uint(t[2]);case 6:return this.int(t[1])&&this.int(t[2]);case 7:return!0;case 8:return this.uint(t[1])&&this.uint(t[2])&&this.uint(t[3])&&this.string(t[4])&&this.boolean(t[5]);case 9:case 10:case 24:case 51:return this.uint(t[1])&&this.uint(t[2])&&this.uint(t[3]);case 12:case 61:case 71:return this.uint(t[1])&&this.string(t[2])&&this.string(t[3]);case 13:case 14:case 17:case 50:case 54:return this.uint(t[1])&&this.string(t[2]);case 16:return this.uint(t[1])&&this.int(t[2])&&this.int(t[3]);case 18:return this.uint(t[1])&&this.string(t[2])&&this.int(t[3]);case 19:return this.uint(t[1])&&this.boolean(t[2]);case 21:return this.string(t[1])&&this.string(t[2])&&this.string(t[3])&&this.string(t[4])&&this.string(t[5])&&this.uint(t[6])&&this.uint(t[7])&&this.uint(t[8]);case 22:case 27:case 30:case 41:case 45:case 46:case 63:case 64:case 79:return this.string(t[1])&&this.string(t[2]);case 23:return this.uint(t[1])&&this.uint(t[2])&&this.uint(t[3])&&this.uint(t[4])&&this.uint(t[5])&&this.uint(t[6])&&this.uint(t[7])&&this.uint(t[8])&&this.uint(t[9]);case 28:case 29:case 42:case 117:case 118:return this.string(t[1]);case 37:return this.uint(t[1])&&this.string(t[2])&&this.uint(t[3]);case 39:return this.string(t[1])&&this.string(t[2])&&this.string(t[3])&&this.string(t[4])&&this.uint(t[5])&&this.uint(t[6])&&this.uint(t[7]);case 40:return this.string(t[1])&&this.uint(t[2])&&this.string(t[3])&&this.string(t[4]);case 48:return this.string(t[1])&&this.string(t[2])&&this.string(t[3])&&this.string(t[4])&&this.int(t[5]);case 49:return this.int(t[1])&&this.int(t[2])&&this.uint(t[3])&&this.uint(t[4]);case 53:return this.uint(t[1])&&this.uint(t[2])&&this.uint(t[3])&&this.uint(t[4])&&this.uint(t[5])&&this.uint(t[6])&&this.string(t[7])&&this.string(t[8]);case 55:return this.boolean(t[1]);case 57:case 60:return this.uint(t[1])&&this.string(t[2])&&this.string(t[3])&&this.string(t[4]);case 58:case 120:return this.int(t[1]);case 59:return this.uint(t[1])&&this.uint(t[2])&&this.uint(t[3])&&this.uint(t[4])&&this.string(t[5])&&this.string(t[6])&&this.string(t[7]);case 67:case 73:return this.uint(t[1])&&this.string(t[2])&&this.uint(t[3])&&this.string(t[4]);case 68:return this.uint(t[1])&&this.uint(t[2])&&this.string(t[3])&&this.string(t[4])&&this.uint(t[5])&&this.uint(t[6]);case 69:return this.uint(t[1])&&this.uint(t[2])&&this.string(t[3])&&this.string(t[4]);case 78:return this.string(t[1])&&this.string(t[2])&&this.string(t[3])&&this.string(t[4]);case 81:return this.uint(t[1])&&this.uint(t[2])&&this.uint(t[3])&&this.int(t[4])&&this.string(t[5]);case 83:return this.string(t[1])&&this.string(t[2])&&this.string(t[3])&&this.string(t[4])&&this.string(t[5])&&this.uint(t[6])&&this.uint(t[7])&&this.uint(t[8])&&this.uint(t[9]);case 84:return this.string(t[1])&&this.string(t[2])&&this.string(t[3])&&this.uint(t[4])&&this.string(t[5])&&this.string(t[6]);case 112:return this.uint(t[1])&&this.string(t[2])&&this.boolean(t[3])&&this.string(t[4])&&this.int(t[5])&&this.int(t[6]);case 113:return this.uint(t[1])&&this.uint(t[2])&&this.string(t[3]);case 116:return this.uint(t[1])&&this.uint(t[2])&&this.uint(t[3])&&this.uint(t[4])&&this.uint(t[5])&&this.uint(t[6])&&this.string(t[7])&&this.string(t[8])&&this.uint(t[9])&&this.boolean(t[10]);case 119:return this.string(t[1])&&this.uint(t[2]);case 121:return this.string(t[1])&&this.string(t[2])&&this.uint(t[3])&&this.uint(t[4]);case 122:return this.string(t[1])&&this.string(t[2])&&this.uint(t[3])&&this.string(t[4]);case 123:return this.string(t[1])&&this.string(t[2])&&this.string(t[3])&&this.string(t[4])&&this.uint(t[5])}}}class n{constructor(t,s,i,n,h,r){this.pageNo=t,this.timestamp=s,this.url=i,this.onBatch=n,this.tabId=h,this.onOfflineEnd=r,this.nextIndex=0,this.beaconSize=2e5,this.encoder=new e(this.beaconSize),this.sizeBuffer=new Uint8Array(3),this.isEmpty=!0,this.beaconSizeLimit=1e6,this.prepare()}writeType(t){return this.encoder.uint(t[0])}writeFields(t){return this.encoder.encode(t)}writeSizeAt(t,s){for(let s=0;s<3;s++)this.sizeBuffer[s]=t>>8*s;this.encoder.set(this.sizeBuffer,s)}prepare(){if(!this.encoder.isEmpty)return;const t=[81,1,this.pageNo,this.nextIndex,this.timestamp,this.url],s=[118,this.tabId];this.writeType(t),this.writeFields(t),this.writeWithSize(s),this.isEmpty=!0}writeWithSize(t){const s=this.encoder;if(!this.writeType(t)||!s.skip(3))return!1;const i=s.getCurrentOffset(),e=this.writeFields(t);if(e){const e=s.getCurrentOffset()-i;if(e>16777215)return console.warn("OpenReplay: max message size overflow."),!1;this.writeSizeAt(e,i-3),s.checkpoint(),this.isEmpty=this.isEmpty&&0===t[0],this.nextIndex++}return e}setBeaconSizeLimit(t){this.beaconSizeLimit=t}writeMessage(t){if("q_end"===t[0])return this.finaliseBatch(),this.onOfflineEnd();0===t[0]&&(this.timestamp=t[1]),122===t[0]&&(this.url=t[1]),this.writeWithSize(t)||(this.finaliseBatch(),this.writeWithSize(t)||(this.encoder=new e(this.beaconSizeLimit),this.prepare(),this.writeWithSize(t)?this.finaliseBatch():console.warn("OpenReplay: beacon size overflow. Skipping large message.",t,this),this.encoder=new e(this.beaconSize),this.prepare()))}finaliseBatch(){if(this.isEmpty)return;const t=this.encoder.flush();this.onBatch(t),this.prepare()}clean(){this.encoder.reset()}}var h;!function(t){t[t.NotActive=0]="NotActive",t[t.Starting=1]="Starting",t[t.Stopping=2]="Stopping",t[t.Active=3]="Active",t[t.Stopped=4]="Stopped"}(h||(h={}));let r=null,u=null,a=h.NotActive;function o(){u&&u.finaliseBatch()}function c(){return new Promise((t=>{a=h.Stopping,null!==p&&(clearInterval(p),p=null),u&&(u.clean(),u=null),r&&(r.clean(),setTimeout((()=>{r=null}),20)),setTimeout((()=>{a=h.NotActive,t(null)}),100)}))}function g(){[h.Stopped,h.Stopping].includes(a)||(postMessage("a_stop"),c().then((()=>{postMessage("a_start")})))}let l,p=null;self.onmessage=({data:s})=>{if(null!=s){if("stop"===s)return o(),void c().then((()=>{a=h.Stopped}));if("forceFlushBatch"!==s){if(!Array.isArray(s)){if("compressed"===s.type){if(!r)return console.debug("OR WebWorker: sender not initialised. Compressed batch."),void g();s.batch&&r.sendCompressed(s.batch)}if("uncompressed"===s.type){if(!r)return console.debug("OR WebWorker: sender not initialised. Uncompressed batch."),void g();s.batch&&r.sendUncompressed(s.batch)}return"start"===s.type?(a=h.Starting,r=new t(s.ingestPoint,(()=>{g()}),(t=>{!function(t){postMessage({type:"failure",reason:t}),c()}(t)}),s.connAttemptCount,s.connAttemptGap,(t=>{postMessage({type:"compress",batch:t},[t.buffer])}),s.pageNo),u=new n(s.pageNo,s.timestamp,s.url,(t=>{r&&r.push(t)}),s.tabId,(()=>postMessage({type:"queue_empty"}))),null===p&&(p=setInterval(o,1e4)),a=h.Active):"auth"===s.type?r?u?(r.authorise(s.token),void(s.beaconSizeLimit&&u.setBeaconSizeLimit(s.beaconSizeLimit))):(console.debug("OR WebWorker: writer not initialised. Received auth."),void g()):(console.debug("OR WebWorker: sender not initialised. Received auth."),void g()):void 0}if(u){const t=u;s.forEach((s=>{55===s[0]&&(s[1]?l=setTimeout((()=>g()),18e5):clearTimeout(l)),t.writeMessage(s)}))}else postMessage("not_init"),g()}else o()}else o()}}();\n',Hs="canceled",ca="or_uxt_active",qi="or_buffer_1",mt=t=>({reason:t,success:!1}),ua=t=>({...t,success:!0});var le;(function(t){t[t.NotActive=0]="NotActive",t[t.Starting=1]="Starting",t[t.Active=2]="Active",t[t.ColdStart=3]="ColdStart"})(le||(le={}));const ha="https://api.openreplay.com/ingest";function Vi(){const t=new Date().getTimezoneOffset()*-1,e=t>=0?"+":"-",s=Math.floor(Math.abs(t)/60),n=Math.abs(t)%60;return`UTC${e}${String(s).padStart(2,"0")}:${String(n).padStart(2,"0")}`}const hh=t=>new Promise(e=>setTimeout(e,t)),ce={ask:"never-gonna-give-you-up",resp:"never-gonna-let-you-down",reg:"never-gonna-run-around-and-desert-you",iframeSignal:"tracker inside a child iframe",iframeId:"getting node id for child iframe",iframeBatch:"batch of messages from an iframe window",parentAlive:"signal that parent is live",killIframe:"stop tracker inside frame",startIframe:"start tracker inside frame",polling:"hello-how-are-you-im-under-the-water-please-help-me"};let fh=class{constructor(e,s,n,i,r){var c,u;this.signalError=i,this.insideIframe=r,this.messages=[],this.bufferedMessages1=[],this.bufferedMessages2=[],this.startCallbacks=[],this.stopCallbacks=[],this.commitCallbacks=[],this.activityState=le.NotActive,this.version="14.0.14",this.socketMode=!1,this.compressionThreshold=24*1e3,this.bc=null,this.canvasRecorder=null,this.conditionsManager=null,this.canStart=!1,this.rootId=null,this.pageFrames=[],this.frameOderNumber=0,this.features={"feature-flags":!0,"usability-test":!0},this.parentActive=!1,this.checkStatus=()=>this.parentActive,this.parentCrossDomainFrameListener=l=>{const{data:h}=l;if(!(!h||l.source===window)){if(h.line===ce.startIframe){if(this.active())return;try{this.allowAppStart(),this.start()}catch(f){console.error("children frame restart failed:",f)}}h.line===ce.parentAlive&&(this.parentActive=!0),h.line===ce.iframeId&&(this.parentActive=!0,this.rootId=h.id,this.session.setSessionToken(h.token),this.frameOderNumber=h.frameOrderNumber,this.debug.log("starting iframe tracking",h),this.allowAppStart()),h.line===ce.killIframe&&this.active()&&this.stop()}},this.trackedFrames=[],this.crossDomainIframeListener=l=>{var f,d;if(!this.active()||l.source===window)return;const{data:h}=l;if(h){if(h.line===ce.iframeSignal&&((f=l.source)==null||f.postMessage({ping:!0,line:ce.parentAlive},"*"),(async()=>{var _;if(l.source===null)return console.error("Couldnt connect to event.source for child iframe tracking");const m=await this.checkNodeId(l.source);if(!m){this.debug.log("Couldnt get node id for iframe",l.source);return}try{this.trackedFrames.includes(h.context)?this.debug.log("Trying to observe already added iframe; ignore if its a restart"):this.trackedFrames.push(h.context),await this.waitStarted();const C=this.session.getSessionToken(),T=this.trackedFrames.findIndex(g=>g===h.context)+1;T===0&&this.debug.error("Couldnt get order number for iframe",h.context,this.trackedFrames);const y={line:ce.iframeId,id:m,token:C,frameOrderNumber:T};this.debug.log("Got child frame signal; nodeId",m,l.source,y),(_=l.source)==null||_.postMessage(y,"*")}catch(C){console.error(C)}})()),h.line===ce.iframeBatch){const m=h.messages.map(_=>{if(_[0]===20){let C=_;return this.pageFrames.forEach(T=>{if(T.contentWindow===l.source){const[y,g,v]=_,{left:I,top:x}=T.getBoundingClientRect();C=[y,g+I,v+x]}}),C}if(_[0]===68){let C=_;return this.pageFrames.forEach(T=>{if(T.contentWindow===l.source){const[y,g,v,I,x,S,k]=_,{left:A,top:j,width:F,height:G}=T.getBoundingClientRect(),z=document.documentElement.scrollWidth,E=document.documentElement.scrollHeight,D=S/100*F+A,O=k/100*G+j,N=D/z,V=O/E;C=[y,g,v,I,x,Math.round(N*1e3)/10,Math.round(V*1e3)/10]}}),C}return _});this.messages.push(...m)}if(h.line===ce.polling){if(!this.pollingQueue.order.length)return;const p=this.pollingQueue.order[0];if(p&&this.pollingQueue[p].length===0){this.pollingQueue.order=this.pollingQueue.order.filter(m=>m!==p);return}this.pollingQueue[p].includes(h.context)&&(this.pollingQueue[p]=this.pollingQueue[p].filter(m=>m!==h.context),(d=l.source)==null||d.postMessage({line:p},"*"),this.pollingQueue[p].length===0&&this.pollingQueue.order.shift())}}},this.pollingQueue={order:[]},this.addCommand=l=>{this.pollingQueue.order.push(l),this.pollingQueue[l]=[...this.trackedFrames]},this.bootChildrenFrames=async()=>{await this.waitStarted(),this.addCommand(ce.startIframe)},this.killChildrenFrames=()=>{this.addCommand(ce.killIframe)},this.signalIframeTracker=()=>{var C;const l=this.session.getTabId();window.parent.postMessage({line:ce.iframeSignal,source:l,context:this.contextId},((C=this.options.crossdomain)==null?void 0:C.parentDomain)??"*");const h=10;let f=0,d=250,p=0,m=!1;const _=()=>{var T;if(m||this.checkStatus()){m=!0;return}window.parent.postMessage({line:ce.iframeSignal,source:l,context:this.contextId},((T=this.options.crossdomain)==null?void 0:T.parentDomain)??"*"),this.debug.info("Trying to signal to parent, attempt:",f+1),f++};for(let T=0;T<h;T++){if(this.checkStatus()){m=!0;break}p+=d,setTimeout(()=>{_()},p),d*=1.5}},this.startTimeout=null,this.coldStartCommitN=0,this.delay=0,this.attachStartCallback=(l,h=!1)=>{h&&(l=this.safe(l)),this.startCallbacks.push(l)},this.attachStopCallback=(l,h=!1)=>{h&&(l=this.safe(l)),this.stopCallbacks.push(l)},this.attachEventListener=(l,h,f,d=!0,p=!0)=>{d&&(f=this.safe(f));const m=()=>l?Bo(l,h,f,p,this.options.forceNgOff):null,_=()=>l?Fo(l,h,f,p,this.options.forceNgOff):null;this.attachStartCallback(m,d),this.attachStopCallback(_,d)},this.coldInterval=null,this.orderNumber=0,this.coldStartTs=0,this.singleBuffer=!1,this.onSessionSent=()=>{},this.prevOpts={},this.restartCanvasTracking=()=>{var l;(l=this.canvasRecorder)==null||l.restartTracking()},this.flushBuffer=async l=>new Promise(h=>{let f=!1;const d=[l.shift()];for(;!f;){const p=l[0];!p||p[0]===0?f=!0:d.push(l.shift())}this.postToWorker(d),h(null)}),this.onUxtCb=[],this.contextId=Math.random().toString(36).slice(2),this.projectKey=e,Object.keys(n).findIndex(l=>["fixedCanvasScaling","disableCanvas"].includes(l))!==-1&&(console.warn('Openreplay: canvas options are moving to separate key "canvas" in next update. Please update your configuration.'),n={...n,canvas:{__save_canvas_locally:n.__save_canvas_locally,fixedCanvasScaling:n.fixedCanvasScaling,disableCanvas:n.disableCanvas}}),this.networkOptions=n.network;const o={revID:"",node_id:"__openreplay_id",session_token_key:"__openreplay_token",session_pageno_key:"__openreplay_pageno",session_reset_key:"__openreplay_reset",session_tabid_key:"__openreplay_tabid",local_uuid_key:"__openreplay_uuid",ingestPoint:ha,resourceBaseHref:null,__is_snippet:!1,__debug_report_edp:null,__debug__:ys.Silent,__save_canvas_locally:!1,localStorage:null,sessionStorage:null,disableStringDict:!1,forceSingleTab:!1,assistSocketHost:"",fixedCanvasScaling:!1,disableCanvas:!1,captureIFrames:!0,obscureTextEmails:!0,obscureTextNumbers:!1,crossdomain:{parentDomain:"*"},canvas:{disableCanvas:!1,fixedCanvasScaling:!1,__save_canvas_locally:!1,useAnimationFrame:!1},forceNgOff:!1};if(this.options=jo(o,n),!this.insideIframe&&!this.options.forceSingleTab&&globalThis&&"BroadcastChannel"in globalThis){const l=location.hostname.split(".").slice(-2).join("_");this.bc=new BroadcastChannel(`rick_${l}`)}this.revID=this.options.revID,this.localStorage=this.options.localStorage??window.localStorage,this.sessionStorage=this.options.sessionStorage??window.sessionStorage,this.sanitizer=new oh({app:this,options:n}),this.nodes=new th({node_id:this.options.node_id,forceNgOff:!!n.forceNgOff,maintainer:(c=this.options.nodes)==null?void 0:c.maintainer}),this.observer=new ih({app:this,options:n}),this.ticker=new ch(this),this.ticker.attach(()=>this.commit()),this.debug=new Ju(this.options.__debug__),this.session=new ah({app:this,options:this.options}),this.attributeSender=new Oc({app:this,isDictDisabled:!!(this.options.disableStringDict||(u=this.options.crossdomain)!=null&&u.enabled)}),this.featureFlags=new Pc(this),this.tagWatcher=new _u({sessionStorage:this.sessionStorage,errLog:this.debug.error,onTag:l=>this.send(yu(l))}),this.session.attachUpdateCallback(({userID:l,metadata:h})=>{l!=null&&this.send(ru(l)),h!=null&&Object.entries(h).forEach(([f,d])=>this.send(Uo(f,d)))}),s!=null&&this.session.applySessionHash(s);const a=this.session.getTabId();this.insideIframe?(window.addEventListener("message",this.parentCrossDomainFrameListener),setInterval(()=>{var l;document.hidden||window.parent.postMessage({line:ce.polling,context:this.contextId},((l=n.crossdomain)==null?void 0:l.parentDomain)??"*")},250)):(this.initWorker(),window.addEventListener("message",this.crossDomainIframeListener)),this.bc!==null&&(this.bc.postMessage({line:ce.ask,source:a,context:this.contextId}),this.startTimeout=setTimeout(()=>{this.allowAppStart()},250),this.bc.onmessage=l=>{if(l.data.context!==this.contextId){if(l.data.line===ce.resp){const h=l.data.token;this.session.setSessionToken(h),this.allowAppStart()}if(l.data.line===ce.reg){const h=l.data.token;this.session.regenerateTabId(),this.session.setSessionToken(h),this.allowAppStart()}if(l.data.line===ce.ask){const h=this.session.getSessionToken();h&&this.bc&&this.bc.postMessage({line:l.data.source===a?ce.reg:ce.resp,token:h,source:a,context:this.contextId})}}})}allowAppStart(){this.canStart=!0,this.startTimeout&&(clearTimeout(this.startTimeout),this.startTimeout=null)}async checkNodeId(e){let s;if(this.pageFrames.length>0&&(s=this.pageFrames.find(i=>i.contentWindow===e)),!s||!this.pageFrames.length){const i=Array.from(document.querySelectorAll("iframe"));this.pageFrames=i,s=i.find(r=>r.contentWindow===e)}if(!s)return null;let n=0;for(;n<100;){const i=s[this.options.node_id];if(i!==void 0)return n=100,i;n++,await hh(100)}return null}initWorker(){try{this.worker=new Worker(URL.createObjectURL(new Blob([uh],{type:"text/javascript"}))),this.worker.onerror=s=>{this._debug("webworker_error",s)},this.worker.onmessage=({data:s})=>{this.handleWorkerMsg(s)};const e=()=>{this.worker&&this.worker.postMessage(null)};this.attachEventListener(window,"beforeunload",e,!1),this.attachEventListener(document.body,"mouseleave",e,!1,!1),this.attachEventListener(document,"visibilitychange",e,!1)}catch(e){this._debug("worker_start",e)}}handleWorkerMsg(e){var s;if(e==="a_stop")this.stop(!1);else if(e==="a_start")this.waitStatus(le.NotActive).then(()=>{this.allowAppStart(),this.start(this.prevOpts,!0).then(n=>{this.debug.info("Worker restarted, session was too long",n)}).catch(n=>{this.debug.error("Worker restart failed",n)})});else if(e==="not_init")this.debug.warn("OR WebWorker: writer not initialised. Restarting tracker");else if(e.type==="failure")this.stop(!1),this.debug.error("worker_failed",e.reason),this._debug("worker_failed",e.reason);else if(e.type==="compress"){const n=e.batch;n.byteLength>this.compressionThreshold?Nc(e.batch,{mtime:0},(r,o)=>{var a,c;r?(this.debug.error("Openreplay compression error:",r),(a=this.worker)==null||a.postMessage({type:"uncompressed",batch:n})):(c=this.worker)==null||c.postMessage({type:"compressed",batch:o})}):(s=this.worker)==null||s.postMessage({type:"uncompressed",batch:n})}else e.type==="queue_empty"&&this.onSessionSent()}_debug(e,s){this.options.__debug_report_edp!==null&&fetch(this.options.__debug_report_edp,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({context:e,error:`${s}`})}),this.debug.error("OpenReplay error: ",e,s)}send(e,s=!1){var n;this.activityState!==le.NotActive&&(this.activityState===le.ColdStart?(this.bufferedMessages1.push(e),this.singleBuffer||this.bufferedMessages2.push(e),(n=this.conditionsManager)==null||n.processMessage(e)):this.messages.push(e),this.activityState===le.Active&&s&&this.commit())}_nCommit(){var e;if(this.socketMode){this.messages.unshift(Gt(this.session.getTabId())),this.messages.unshift(Vt(this.timestamp())),this.commitCallbacks.forEach(s=>s(this.messages)),this.messages.length=0;return}if(this.insideIframe){window.parent.postMessage({line:ce.iframeBatch,messages:this.messages},((e=this.options.crossdomain)==null?void 0:e.parentDomain)??"*"),this.commitCallbacks.forEach(s=>s(this.messages)),this.messages.length=0;return}if(!(this.worker===void 0||!this.messages.length))try{Wc(()=>{var s;this.messages.unshift(Gt(this.session.getTabId())),this.messages.unshift(Vt(this.timestamp())),(s=this.worker)==null||s.postMessage(this.messages),this.commitCallbacks.forEach(n=>n(this.messages)),this.messages.length=0})}catch(s){this._debug("worker_commit",s),this.stop(!0),setTimeout(()=>{this.start()},500)}}_cStartCommit(){this.coldStartCommitN+=1,this.coldStartCommitN===2&&(this.bufferedMessages1.push(Vt(this.timestamp())),this.bufferedMessages1.push(Gt(this.session.getTabId())),this.bufferedMessages2.push(Vt(this.timestamp())),this.bufferedMessages2.push(Gt(this.session.getTabId())),this.coldStartCommitN=0)}commit(){this.activityState===le.ColdStart?this._cStartCommit():this._nCommit()}postToWorker(e){var s;(s=this.worker)==null||s.postMessage(e),this.commitCallbacks.forEach(n=>n(e)),e.length=0}timestamp(){return Ke()+this.delay}safe(e){const s=this;return function(...n){try{e.apply(this,n)}catch(i){s._debug("safe_fn_call",i)}}}attachCommitCallback(e){this.commitCallbacks.push(e)}checkRequiredVersion(e){const s=e.split(/[.-]/),n=this.version.split(/[.-]/);for(let i=0;i<3;i++){if(isNaN(Number(n[i]))||isNaN(Number(s[i])))return!1;if(Number(n[i])>Number(s[i]))return!0;if(Number(n[i])<Number(s[i]))return!1}return!0}getTrackerInfo(){return{userUUID:this.localStorage.getItem(this.options.local_uuid_key),projectKey:this.projectKey,revID:this.revID,trackerVersion:this.version,isSnippet:this.options.__is_snippet}}getSessionInfo(){return{...this.session.getInfo(),...this.getTrackerInfo()}}getSessionToken(){return this.session.getSessionToken()}getSessionID(){return this.session.getInfo().sessionID||void 0}getSessionURL(e){const{projectID:s,sessionID:n,timestamp:i}=this.session.getInfo();if(!s||!n){this.debug.error("OpenReplay error: Unable to build session URL");return}const r=this.options.ingestPoint,c=(/api\.openreplay\.com/.test(r)?"https://app.openreplay.com/ingest":r).replace(/ingest$/,`${s}/session/${n}`);if(e!=null&&e.withCurrentTime){const u=Ke()-i;return`${c}?jumpto=${u}`}return c}getHost(){return new URL(this.options.ingestPoint).host}getProjectKey(){return this.projectKey}getBaseHref(){var e,s;return typeof this.options.resourceBaseHref=="string"?this.options.resourceBaseHref:(this.options.resourceBaseHref,document.baseURI?document.baseURI:((s=(e=document.head)==null?void 0:e.getElementsByTagName("base")[0])==null?void 0:s.getAttribute("href"))||location.origin+location.pathname)}resolveResourceURL(e){const s=new URL(this.getBaseHref());return s.pathname+="/"+new URL(e).pathname,s.pathname.replace(/\/+/g,"/"),s.toString()}isServiceURL(e){return e.startsWith(this.options.ingestPoint)}active(){return this.activityState===le.Active}resetNextPageSession(e){e?this.sessionStorage.setItem(this.options.session_reset_key,"t"):this.sessionStorage.removeItem(this.options.session_reset_key)}checkSessionToken(e){const s=this.sessionStorage.getItem(this.options.session_reset_key)!==null,n=e||s,i=this.session.getSessionToken();return n||!i}async coldStart(e={},s){this.singleBuffer=!1;const n=1e3,i=this.checkSessionToken(e.forceNew);s&&await this.setupConditionalStart(e);const r=()=>{this.orderNumber+=1,Ii(),this.coldStartTs=Ke(),this.orderNumber%2===0?(this.bufferedMessages1.length=0,this.bufferedMessages1.push(Vt(this.timestamp())),this.bufferedMessages1.push(Gt(this.session.getTabId()))):(this.bufferedMessages2.length=0,this.bufferedMessages2.push(Vt(this.timestamp())),this.bufferedMessages2.push(Gt(this.session.getTabId()))),this.stop(!1),this.activityState=le.ColdStart,e.sessionHash&&this.session.applySessionHash(e.sessionHash),e.forceNew&&this.session.reset(),this.session.assign({userID:e.userID,metadata:e.metadata}),i||(this.debug.log("continuing session on new tab",this.session.getTabId()),this.send(Tn(this.session.getTabId()))),this.observer.observe(),this.ticker.start()};this.coldInterval=setInterval(()=>{r()},30*n),r()}async setupConditionalStart(e){var d,p;this.conditionsManager=new Mc(this,e);const s=await fetch(this.options.ingestPoint+"/v1/web/start",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...this.getTrackerInfo(),timestamp:Ke(),doNotRecord:!0,bufferDiff:0,userID:this.session.getInfo().userID,token:void 0,deviceMemory:Pi,jsHeapSizeLimit:Li,timezone:Vi(),width:window.screen.width,height:window.screen.height})}),{token:n,userBrowser:i,userCity:r,userCountry:o,userDevice:a,userOS:c,userState:u,projectID:l,features:h}=await s.json();this.features=h||this.features,this.session.assign({projectID:l}),this.session.setUserInfo({userBrowser:i,userCity:r,userCountry:o,userDevice:a,userOS:c,userState:u});const f={sessionToken:n,userUUID:"",sessionID:""};this.startCallbacks.forEach(m=>m(f)),await((d=this.conditionsManager)==null?void 0:d.fetchConditions(l,n)),this.features["feature-flags"]&&(await this.featureFlags.reloadFlags(n),(p=this.conditionsManager)==null||p.processFlags(this.featureFlags.flags)),await this.tagWatcher.fetchTags(this.options.ingestPoint,n)}offlineRecording(e={},s){this.onSessionSent=s,this.singleBuffer=!0;const n=this.checkSessionToken(e.forceNew);Ii(),this.coldStartTs=Ke();const i=this.localStorage.getItem(qi);if(i){const o=JSON.parse(i);this.bufferedMessages1=Array.isArray(o)?o:this.bufferedMessages1,this.localStorage.removeItem(qi)}this.bufferedMessages1.push(Vt(this.timestamp())),this.bufferedMessages1.push(Gt(this.session.getTabId())),this.activityState=le.ColdStart,e.sessionHash&&this.session.applySessionHash(e.sessionHash),e.forceNew&&this.session.reset(),this.session.assign({userID:e.userID,metadata:e.metadata});const r={sessionToken:"",userUUID:"",sessionID:""};return this.startCallbacks.forEach(o=>o(r)),n||this.send(Tn(this.session.getTabId())),this.observer.observe(),this.ticker.start(),{saveBuffer:this.saveBuffer,getBuffer:this.getBuffer,setBuffer:this.setBuffer}}saveBuffer(){this.localStorage.setItem(qi,JSON.stringify(this.bufferedMessages1))}getBuffer(){return this.bufferedMessages1}setBuffer(e){this.bufferedMessages1=e}async uploadOfflineRecording(){var f,d;this.stop(!1);const e=Ke();(f=this.worker)==null||f.postMessage({type:"start",pageNo:this.session.incPageNo(),ingestPoint:this.options.ingestPoint,timestamp:this.coldStartTs,url:document.URL,connAttemptCount:this.options.connAttemptCount,connAttemptGap:this.options.connAttemptGap,tabId:this.session.getTabId()});const s=await fetch(this.options.ingestPoint+"/v1/web/start",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...this.getTrackerInfo(),timestamp:e,doNotRecord:!1,bufferDiff:e-this.coldStartTs,userID:this.session.getInfo().userID,token:void 0,deviceMemory:Pi,jsHeapSizeLimit:Li,timezone:Vi()})}),{token:n,userBrowser:i,userCity:r,userCountry:o,userDevice:a,userOS:c,userState:u,beaconSizeLimit:l,projectID:h}=await s.json();for((d=this.worker)==null||d.postMessage({type:"auth",token:n,beaconSizeLimit:l}),this.session.assign({projectID:h}),this.session.setUserInfo({userBrowser:i,userCity:r,userCountry:o,userDevice:a,userOS:c,userState:u});this.bufferedMessages1.length>0;)await this.flushBuffer(this.bufferedMessages1);this.postToWorker([["q_end"]]),this.clearBuffers()}async _start(e={},s=!1,n){var c,u,l,h,f;Object.keys(e).length!==0&&(this.prevOpts=e);const i=this.activityState===le.ColdStart;if(i&&this.coldInterval&&clearInterval(this.coldInterval),!this.worker&&!this.insideIframe){const d="No worker found: perhaps, CSP is not set.";return this.signalError(d,[]),Promise.resolve(mt(d))}if(this.activityState===le.Active||this.activityState===le.Starting)return Promise.resolve(mt("OpenReplay: trying to call `start()` on the instance that has been started already."));this.activityState=le.Starting,i||Ii(),e.sessionHash&&this.session.applySessionHash(e.sessionHash),e.forceNew&&this.session.reset(),this.session.assign({userID:e.userID,metadata:e.metadata});const r=Ke();(c=this.worker)==null||c.postMessage({type:"start",pageNo:this.session.incPageNo(),ingestPoint:this.options.ingestPoint,timestamp:i?this.coldStartTs:r,url:document.URL,connAttemptCount:this.options.connAttemptCount,connAttemptGap:this.options.connAttemptGap,tabId:this.session.getTabId()});const o=this.session.getSessionToken(),a=this.checkSessionToken(e.forceNew);this.sessionStorage.removeItem(this.options.session_reset_key),this.debug.log("OpenReplay: starting session; need new session id?",a,"session token: ",o);try{const d=await window.fetch(this.options.ingestPoint+"/v1/web/start",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...this.getTrackerInfo(),timestamp:r,doNotRecord:!1,bufferDiff:r-this.coldStartTs,userID:this.session.getInfo().userID,token:a?void 0:o,deviceMemory:Pi,jsHeapSizeLimit:Li,timezone:Vi(),condition:n,assistOnly:e.assistOnly??this.socketMode,width:window.screen.width,height:window.screen.height})});if(d.status!==200){const N=await d.text(),V=N===Hs?Hs:`Server error: ${d.status}. ${N}`;return mt(V)}if(!this.worker&&!this.insideIframe){const N="no worker found after start request (this should not happen in real world)";return this.signalError(N,[]),mt(N)}const{token:p,userUUID:m,projectID:_,beaconSizeLimit:C,compressionThreshold:T,delay:y,sessionID:g,startTimestamp:v,userBrowser:I,userCity:x,userCountry:S,userDevice:k,userOS:A,userState:j,canvasEnabled:F,canvasQuality:G,canvasFPS:z,assistOnly:E,features:D}=await d.json();if(this.features=D||this.features,typeof p!="string"||typeof m!="string"||typeof v!="number"&&typeof v<"u"||typeof g!="string"||typeof y!="number"||typeof C!="number"&&typeof C<"u"){const N=`Incorrect server response: ${JSON.stringify(d)}`;return this.signalError(N,[]),mt(N)}this.delay=y,this.session.setSessionToken(p),this.session.setUserInfo({userBrowser:I,userCity:x,userCountry:S,userDevice:k,userOS:A,userState:j}),this.session.assign({sessionID:g,timestamp:v||r,projectID:_}),E?(this.socketMode=!0,(u=this.worker)==null||u.postMessage("stop")):(l=this.worker)==null||l.postMessage({type:"auth",token:p,beaconSizeLimit:C}),!a&&p===o&&(this.debug.log("continuing session on new tab",this.session.getTabId()),this.send(Tn(this.session.getTabId()))),Object.entries(this.session.getInfo().metadata).forEach(([N,V])=>this.send(Uo(N,V))),this.localStorage.setItem(this.options.local_uuid_key,m),this.compressionThreshold=T;const O={sessionToken:p,userUUID:m,sessionID:g};if(this.startCallbacks.forEach(N=>N(O)),e.startCallback&&e.startCallback(ua(O)),this.features["feature-flags"]&&this.featureFlags.reloadFlags(),await this.tagWatcher.fetchTags(this.options.ingestPoint,p),this.activityState=le.Active,(h=this.options.crossdomain)!=null&&h.enabled&&!this.insideIframe&&this.bootChildrenFrames(),F&&!this.options.canvas.disableCanvas&&(this.canvasRecorder=this.canvasRecorder??new Gu(this,{fps:z,quality:G,isDebug:this.options.canvas.__save_canvas_locally,fixedScaling:this.options.canvas.fixedCanvasScaling,useAnimationFrame:this.options.canvas.useAnimationFrame})),i){const N=this.bufferedMessages1.length>this.bufferedMessages2.length?this.bufferedMessages1:this.bufferedMessages2;for(;N.length>0;)await this.flushBuffer(N);this.clearBuffers(),this.commit()}else this.insideIframe&&this.rootId?this.observer.crossdomainObserve(this.rootId,this.frameOderNumber):this.observer.observe(),this.ticker.start();if((f=this.canvasRecorder)==null||f.startTracking(),this.features["usability-test"]&&!this.insideIframe){this.uxtManager=this.uxtManager?this.uxtManager:new qu(this,ca);let N;const V=this.localStorage.getItem(ca);if(V&&(N=parseInt(V,10)),location!=null&&location.search){const J=new URLSearchParams(location.search);if(J.has("oruxt")){const se=J.get("oruxt");N=se?parseInt(se,10):void 0}}N&&(this.uxtManager.isActive?this.onUxtCb.forEach(J=>J(N)):this.uxtManager.getTest(N,p,!!V).then(J=>{J&&this.onUxtCb.forEach(se=>se(J))}))}return ua(O)}catch(d){if(this.stop(),this.session.reset(),!d)return console.error("Unknown error during start"),this.signalError("Unknown error",[]),mt("Unknown error");if(d===Hs)return this.signalError(Hs,[]),mt(Hs);this._debug("session_start",d);const p=d instanceof Error?d.message:d.toString();return this.signalError(p,[]),mt(p)}}addOnUxtCb(e){this.onUxtCb.push(e)}getUxtId(){var e;return(e=this.uxtManager)==null?void 0:e.getTestId()}async waitStart(){return new Promise(e=>{const s=setInterval(()=>{this.canStart&&(clearInterval(s),e(!0))},100)})}async waitStarted(){return this.waitStatus(le.Active)}async waitStatus(e){return new Promise(s=>{const n=()=>{this.activityState===e?s(!0):setTimeout(n,25)};n()})}async start(...e){return this.activityState===le.Active||this.activityState===le.Starting?Promise.resolve(mt("OpenReplay: trying to call `start()` on the instance that has been started already.")):(this.insideIframe&&this.signalIframeTracker(),document.hidden?new Promise(s=>{const n=async()=>{document.hidden||(await this.waitStart(),document.removeEventListener("visibilitychange",n),s(this._start(...e)))};document.addEventListener("visibilitychange",n)}):(await this.waitStart(),this._start(...e)))}forceFlushBatch(){var e;(e=this.worker)==null||e.postMessage("forceFlushBatch")}getTabId(){return this.session.getTabId()}clearBuffers(){this.bufferedMessages1.length=0,this.bufferedMessages2.length=0}trackWs(e){const s=e;return(n,i,r="down")=>{typeof n!="string"||typeof i!="string"||i.length>5*1024*1024||n.length>255||this.send(gu("websocket",s,i,this.timestamp(),r,n))}}stop(e=!0){var s,n;if(this.activityState!==le.NotActive)try{!this.insideIframe&&((s=this.options.crossdomain)!=null&&s.enabled)&&this.killChildrenFrames(),this.attributeSender.clear(),this.sanitizer.clear(),this.observer.disconnect(),this.nodes.clear(),this.ticker.stop(),this.stopCallbacks.forEach(i=>i()),this.tagWatcher.clear(),this.worker&&e&&this.worker.postMessage("stop"),(n=this.canvasRecorder)==null||n.clear(),this.messages.length=0,this.parentActive=!1}finally{this.activityState=le.NotActive,this.debug.log("OpenReplay tracking stopped.")}}};function dh(t){const e=navigator.connection||navigator.mozConnection||navigator.webkitConnection;if(e===void 0)return;const s=()=>t.send(lu(Math.round(e.downlink*1e3),e.type||"unknown"));s(),e.addEventListener("change",s)}const fa=tt&&"InstallTrigger"in window?t=>t.message+`
|
|
10
|
-
`+t.stack:t=>t.stack||t.message;function
|
|
11
|
-
`).filter(n=>!!n.match(
|
|
12
|
-
`).filter(n=>!n.match(
|
|
9
|
+
We appreciate your time and valuable input.`),r=H("div","end_button_or",ta,"Submitting Feedback"),o=qu();r.appendChild(o),(u=this.test)!=null&&u.reqMic||(l=this.test)!=null&&l.reqCamera?this.userRecorder.sendToAPI().then(()=>{r.removeChild(o),r.textContent="End Session",e=!1}).catch(h=>{console.error(h),r.removeChild(o),r.textContent="End Session",e=!1}):(r.removeChild(o),r.textContent="End Session",e=!1),this.taskSection&&this.container.removeChild(this.taskSection),this.descriptionSection&&this.container.removeChild(this.descriptionSection),this.stopButton&&this.stopButtonContainer&&this.container.removeChild(this.stopButtonContainer),r.onclick=()=>{e||(window.close(),document.body.removeChild(this.bg))},s.append(n,i,r),this.endSection=s,this.container.append(s)}}function la(t){return!!t&&t.nodeType!=null}function ji(t){return t.namespaceURI==="http://www.w3.org/2000/svg"}function gt(t){return t.nodeType===Node.ELEMENT_NODE}function Gu(t){return t.nodeType===Node.COMMENT_NODE}function Ui(t){return t.nodeType===Node.TEXT_NODE}function Cn(t){return t.nodeType===Node.DOCUMENT_NODE}function Nn(t){return t.nodeType===Node.DOCUMENT_NODE||t.nodeType===Node.DOCUMENT_FRAGMENT_NODE}function he(t,e){return t.localName===e}class Ku{constructor(e,s){this.app=e,this.options=s,this.snapshots={},this.intervals=[],this.restartTracking=()=>{this.clear(),this.app.nodes.scanTree(this.captureCanvas)},this.captureCanvas=n=>{const i=this.app.nodes.getID(n);if(!i||!he(n,"canvas")||this.app.sanitizer.isObscured(i)||this.app.sanitizer.isHidden(i)||!he(n,"canvas")||this.snapshots[i])return;new IntersectionObserver(a=>{a.forEach(c=>{c.isIntersecting&&(c.target?this.snapshots[i]&&this.snapshots[i].createdAt?this.snapshots[i].paused=!1:this.recordCanvas(c.target,i):this.snapshots[i]&&(this.snapshots[i].paused=!0))})}).observe(n)},this.recordCanvas=(n,i)=>{const r=this.app.timestamp();this.snapshots[i]={images:[],createdAt:r,paused:!1,dummy:document.createElement("canvas")};const o=yu(i.toString(),r);this.app.send(o);const a=u=>{Xu(u,this.options.quality,this.snapshots[i].dummy,this.options.fixedScaling,this.fileExt,l=>{if(l){if(!this.snapshots[i])return this.app.debug.warn("Canvas not present in snapshots after capture:",this.snapshots,i);this.snapshots[i].images.push({id:this.app.timestamp(),data:l}),this.snapshots[i].images.length>9&&(this.sendSnaps(this.snapshots[i].images,i,this.snapshots[i].createdAt),this.snapshots[i].images=[])}})},c=setInterval(()=>{const u=this.app.nodes.getID(n),l=u?this.app.nodes.getNode(u):void 0;if(!this.snapshots[i]){this.app.debug.log("Canvas is not present in {snapshots}"),clearInterval(c);return}if(!l||!he(l,"canvas")||l!==n){this.app.debug.log("Canvas element not in sync",l,n),clearInterval(c);return}else this.snapshots[i].paused||(this.options.useAnimationFrame?requestAnimationFrame(()=>{a(l)}):a(l))},this.interval);this.intervals.push(c)},this.fileExt=s.fileExt??"webp",this.interval=1e3/s.fps}startTracking(){setTimeout(()=>{this.app.nodes.scanTree(this.captureCanvas),this.app.nodes.attachNodeCallback(this.captureCanvas)},250)}sendSnaps(e,s,n){if(Object.keys(this.snapshots).length===0)return;const i=new FormData;e.forEach(o=>{const a=o.data;a&&(i.append("snapshot",a,`${n}_${s}_${o.id}.${this.fileExt}`),this.options.isDebug&&Yu(a,`${n}_${s}_${o.id}.${this.fileExt}`))});const r=()=>{this.app.debug.log("Restarting tracker; token expired"),this.app.stop(!1),setTimeout(()=>{this.app.start({},!0)},250)};fetch(this.app.options.ingestPoint+"/v1/web/images",{method:"POST",headers:{Authorization:`Bearer ${this.app.session.getSessionToken()??""}`},body:i}).then(o=>o.status===401?r():!0).catch(o=>{this.app.debug.error("error saving canvas",o)})}clear(){this.intervals.forEach(e=>clearInterval(e)),this.snapshots={}}}const ca={low:.35,medium:.55,high:.8};function Xu(t,e="medium",s,n=!1,i,r){const o=`image/${i}`;if(n){const a=window.devicePixelRatio||1;s.width=t.width/a,s.height=t.height/a;const c=s.getContext("2d");if(!c)return"";c.clearRect(0,0,s.width,s.height),c.drawImage(t,0,0,s.width,s.height),s.toBlob(r,o,ca[e])}else t.toBlob(r,o,ca[e])}function Yu(t,e){const s=URL.createObjectURL(t),n=document.createElement("a");n.href=s,n.download=e,n.style.display="none",document.body.appendChild(n),n.click(),document.body.removeChild(n)}const ws={Verbose:5,Log:4,Warnings:3,Errors:2,Silent:0};class Ju{constructor(e=ws.Silent){this.shouldLog=s=>this.level>=s,this.info=(...s)=>{this.shouldLog(ws.Verbose)&&console.info(...s)},this.log=(...s)=>{this.shouldLog(ws.Log)&&console.log(...s)},this.warn=(...s)=>{this.shouldLog(ws.Warnings)&&console.warn(...s)},this.error=(...s)=>{this.shouldLog(ws.Errors)&&console.error(...s)},this.level=e}}const Qu=1e3;function Zu(t,e,s){const n=t.entries();function i(){const r=[];let o=n.next();for(;!o.done&&r.length<e;)r.push(o.value),o=n.next();r.length>0&&(r.forEach(([a,c])=>{c&&s(c)}),setTimeout(i,50))}i()}function $u(t){var e;try{if(!t.isConnected)return[!1,"not connected"];const s=t.nodeType===Node.DOCUMENT_NODE,n=s?t.defaultView:(e=t.ownerDocument)==null?void 0:e.defaultView,i=s?t:t.ownerDocument;return n?n.closed?[!1,"window closed"]:i!=null&&i.documentElement.isConnected?[!0,"ok"]:[!1,"documentElement not connected"]:[!1,"no window"]}catch(s){return[!1,s]}}const eh={interval:Qu*30,batchSize:2500,enabled:!0};class th{constructor(e,s,n){this.nodes=e,this.unregisterNode=s,this.start=()=>{this.options.enabled&&(this.stop(),this.interval=setInterval(()=>{Zu(this.nodes,this.options.batchSize,i=>{$u(i)[0]||this.unregisterNode(i)})},this.options.interval))},this.stop=()=>{this.interval&&clearInterval(this.interval)},this.options={...eh,...n}}}class sh{constructor(e){this.nodes=new Map,this.totalNodeAmount=0,this.nodeCallbacks=[],this.elementListeners=new Map,this.nextNodeId=0,this.scanTree=s=>{this.nodes.forEach(n=>n?s(n):void 0)},this.attachNodeListener=(s,n,i,r=!0)=>{const o=this.getID(s);if(o===void 0)return;zo(s,n,i,r,this.forceNgOff);let a=this.elementListeners.get(o);a===void 0&&(a=[],this.elementListeners.set(o,a)),a.push([n,i,r])},this.unregisterNode=s=>{const n=s[this.node_id];if(n!==void 0){s[this.node_id]=void 0,delete s[this.node_id],this.nodes.delete(n);const i=this.elementListeners.get(n);i!==void 0&&(this.elementListeners.delete(n),i.forEach(r=>jo(s,r[0],r[1],r[2],this.forceNgOff))),this.totalNodeAmount--}return n},this.node_id=e.node_id,this.forceNgOff=e.forceNgOff,this.maintainer=new th(this.nodes,this.unregisterNode,e.maintainer),this.maintainer.start()}syntheticMode(e){const s=Number.MAX_SAFE_INTEGER,i=99999999*e;if(i>s)throw new Error("Placeholder id overflow");this.nextNodeId=i}attachNodeCallback(e){return this.nodeCallbacks.push(e)}registerNode(e){let s=e[this.node_id];const n=s===void 0;return n&&(s=this.nextNodeId,this.totalNodeAmount++,this.nextNodeId++,this.nodes.set(s,e),e[this.node_id]=s),[s,n]}cleanTree(){for(const[e,s]of this.nodes)s&&!document.contains(s)&&this.unregisterNode(s)}callNodeCallbacks(e,s){this.nodeCallbacks.forEach(n=>n(e,s))}getID(e){if(e)return e[this.node_id]}getNode(e){return this.nodes.get(e)}getNodeCount(){return this.totalNodeAmount}clear(){for(const[e,s]of this.nodes)s&&this.unregisterNode(s);this.nextNodeId=0,this.nodes.clear()}}function Dn(t){if(Gu(t))return!0;if(Ui(t))return!1;if(!gt(t))return!0;const e=t.tagName.toUpperCase();if(e==="LINK"){const s=t.getAttribute("rel"),n=t.getAttribute("as");return!(s!=null&&s.includes("stylesheet")||n==="style"||n==="font")}return e==="SCRIPT"||e==="NOSCRIPT"||e==="META"||e==="TITLE"||e==="BASE"}function qi(t){return Nn(t)?!0:!Dn(t)}var st;(function(t){t[t.New=0]="New",t[t.Removed=1]="Removed",t[t.Changed=2]="Changed"})(st||(st={}));class Wi{constructor(e,s=!1){this.app=e,this.isTopContext=s,this.commited=[],this.recents=new Map,this.indexes=[],this.attributesMap=new Map,this.textSet=new Set,this.observer=Fo(this.app.safe(n=>{for(const i of n){const r=i.target,o=i.type;if(!qi(r))continue;if(o==="childList"){for(let c=0;c<i.removedNodes.length;c++)qi(i.removedNodes[c])&&this.bindNode(i.removedNodes[c]);for(let c=0;c<i.addedNodes.length;c++)this.bindTree(i.addedNodes[c]);continue}const a=this.app.nodes.getID(r);if(a!==void 0){if(this.recents.has(a)||this.recents.set(a,st.Changed),o==="attributes"){const c=i.attributeName;if(c===null)continue;let u=this.attributesMap.get(a);u===void 0&&this.attributesMap.set(a,u=new Set),u.add(c);continue}o==="characterData"&&this.textSet.add(a)}}this.commitNodes()}),this.app.options.forceNgOff)}clear(){this.commited.length=0,this.recents.clear(),this.indexes.length=1,this.attributesMap.clear(),this.textSet.clear()}handleIframeSrcChange(e){const s=e.contentDocument;if(s&&this.app.nodes.getID(s)!==void 0){const i=document.createTreeWalker(s,NodeFilter.SHOW_ELEMENT+NodeFilter.SHOW_TEXT,{acceptNode:c=>Dn(c)||this.app.nodes.getID(c)===void 0?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_ACCEPT},!1);let r=0;const o=this.app.nodes.getNodeCount();for(;i.nextNode();)e.contentDocument.contains(i.currentNode)||(r+=1,this.app.nodes.unregisterNode(i.currentNode));const a=Math.floor(r/o*100);a>30&&this.app.send(Jo(a))}}sendNodeAttribute(e,s,n,i){if(ji(s)){n.substring(0,6)==="xlink:"&&(n=n.substring(6)),i===null?this.app.send(qo(e,n)):n==="href"?(i.length>1e5&&(i=""),this.app.send(Ri(e,n,i,this.app.getBaseHref()))):this.app.attributeSender.sendSetAttribute(e,n,i);return}if(!(n==="src"||n==="srcset"||n==="integrity"||n==="crossorigin"||n==="autocomplete"||n.substring(0,2)==="on")&&!(n==="value"&&he(s,"input")&&s.type!=="button"&&s.type!=="reset"&&s.type!=="submit")){if(i===null){this.app.send(qo(e,n));return}if(n==="style"||n==="href"&&he(s,"link")){this.app.send(Ri(e,n,i,this.app.getBaseHref()));return}(n==="href"||i.length>1e5)&&(i=""),this.app.attributeSender.sendSetAttribute(e,n,i)}}sendNodeData(e,s,n){if(he(s,"style")){this.app.send(hu(e,n,this.app.getBaseHref()));return}n=this.app.sanitizer.sanitize(e,n),this.app.send(Qc(e,n))}bindNode(e){const[s,n]=this.app.nodes.registerNode(e);n?this.recents.set(s,st.New):this.recents.get(s)!==st.New&&this.recents.set(s,st.Removed)}bindTree(e){if(!qi(e))return;this.bindNode(e);const s=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT+NodeFilter.SHOW_TEXT,{acceptNode:n=>(this.app.nodes.getID(n)!==void 0&&this.app.debug.error("! Node is already bound",n),Dn(n)||this.app.nodes.getID(n)!==void 0?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_ACCEPT)},!1);for(;s.nextNode();)this.bindNode(s.currentNode)}unbindTree(e){const s=this.app.nodes.unregisterNode(e);if(s!==void 0&&this.recents.get(s)===st.Removed){this.app.send(Jc(s));const n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT+NodeFilter.SHOW_TEXT,{acceptNode:a=>Dn(a)||this.app.nodes.getID(a)===void 0?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_ACCEPT},!1);let i=0;const r=this.app.nodes.getNodeCount();for(;n.nextNode();)i+=1,this.app.nodes.unregisterNode(n.currentNode);const o=Math.floor(i/r*100);o>30&&this.app.send(Jo(o))}}_commitNode(e,s){if(Nn(s))return!0;const n=s.parentNode;let i;if(!he(s,"html")||!this.isTopContext){if(n===null)return this.unbindTree(s),!1;if(i=this.app.nodes.getID(n),i===void 0)return this.unbindTree(s),!1;if(!this.commitNode(i))return this.unbindTree(s),!1;if(this.app.sanitizer.handleNode(e,i,s),this.app.sanitizer.isHidden(i))return!1}let r=s.previousSibling;for(;r!==null;){const l=this.app.nodes.getID(r);if(l!==void 0){this.commitNode(l),this.indexes[e]=this.indexes[l]+1;break}r=r.previousSibling}r===null&&(this.indexes[e]=0);const o=this.recents.get(e),a=o===st.New,c=this.indexes[e];if(c===void 0)throw"commitNode: missing node index";if(a){if(gt(s)){let l=s;if(i!==void 0){if(this.app.sanitizer.isHidden(e)){const h=l.clientWidth,d=l.clientHeight;l=s.cloneNode(),l.style.width=`${h}px`,l.style.height=`${d}px`}this.app.send(Kc(e,i,c,l.tagName,ji(s)))}for(let h=0;h<l.attributes.length;h++){const d=l.attributes[h];this.sendNodeAttribute(e,l,d.nodeName,d.value)}}else Ui(s)&&(this.app.send(Xc(e,i,c)),this.sendNodeData(e,n,s.data));return!0}o===st.Removed&&i!==void 0&&this.app.send(Yc(e,i,c));const u=this.attributesMap.get(e);if(u!==void 0){if(!gt(s))throw"commitNode: node is not an element";for(const l of u)this.sendNodeAttribute(e,s,l,s.getAttribute(l))}if(this.textSet.has(e)){if(!Ui(s))throw"commitNode: node is not a text";this.sendNodeData(e,n,s.data)}return!0}commitNode(e){const s=this.app.nodes.getNode(e);if(s===void 0)return!1;const n=this.commited[e];return n!==void 0?n:this.commited[e]=this._commitNode(e,s)}commitNodes(e=!1){let s;this.recents.forEach((n,i)=>{this.commitNode(i),n===st.New&&(s=this.app.nodes.getNode(i))&&this.app.nodes.callNodeCallbacks(s,e)}),this.clear()}observeRoot(e,s,n=e){this.observer.observe(e,{childList:!0,attributes:!0,characterData:!0,subtree:!0,attributeOldValue:!1,characterDataOldValue:!1}),this.bindTree(n),s(this.app.nodes.getID(e)),this.commitNodes(!0)}disconnect(){this.observer.disconnect(),this.clear()}}class ua extends Wi{observe(e){const s=e.contentDocument,n=this.app.nodes.getID(e);!s||n===void 0||this.observeRoot(s,i=>{if(i===void 0){this.app.debug.log("OpenReplay: Iframe document not bound");return}this.docId=i,this.app.send(Oi(n,i))})}syntheticObserve(e,s){this.observeRoot(s,n=>{if(n===void 0){this.app.debug.log("OpenReplay: Iframe document not bound");return}this.app.send(Oi(e,n))})}}class nh extends Wi{observe(e){const s=e.shadowRoot,n=this.app.nodes.getID(e);!s||n===void 0||this.observeRoot(s,i=>{if(i===void 0){this.app.debug.error("OpenReplay: Shadow Root was not bound");return}this.app.send(Oi(n,i))})}}class ih{constructor(){this.states=new WeakMap}calcOffset(e){let s=0,n=0;if(e.parent&&([s,n]=this.calcOffset(e.parent)),!e.offset){const{left:o,top:a}=e.iFrame.getBoundingClientRect();e.offset=[o,a]}const[i,r]=e.offset;return[s+i,n+r]}getDocumentOffset(e){const s=this.states.get(e);return s?this.calcOffset(s):[0,0]}observe(e){var a;const s=e.contentDocument;if(!s)return;const n=e.ownerDocument,i=this.states.get(n),r={offset:null,iFrame:e,parent:i||null,clear:()=>{var c;n.removeEventListener("scroll",o),(c=n.defaultView)==null||c.removeEventListener("resize",o)}},o=()=>{r.offset=null};n.addEventListener("scroll",o),(a=n.defaultView)==null||a.addEventListener("resize",o),this.states.set(s,r)}clear(){this.states=new WeakMap}}const Hi=tt?Element.prototype.attachShadow:()=>new ShadowRoot;class rh extends Wi{constructor(e){super(e.app,!0),this.iframeOffsets=new ih,this.contextCallbacks=[],this.contextsSet=new WeakSet,this.iframeObserversArr=[],this.iframeObservers=new WeakMap,this.docObservers=new WeakMap,this.shadowRootObservers=new WeakMap,this.app=e.app,this.options=Object.assign({captureIFrames:!0},e.options),this.app.nodes.attachNodeCallback(s=>{he(s,"iframe")&&(this.options.captureIFrames&&!Vt(s,"obscured")||Vt(s,"capture"))&&this.handleIframe(s)}),this.app.nodes.attachNodeCallback(s=>{gt(s)&&s.shadowRoot!==null&&this.handleShadowRoot(s.shadowRoot)})}attachContextCallback(e){this.contextCallbacks.push(e)}getDocumentOffset(e){return this.iframeOffsets.getDocumentOffset(e)}handleIframe(e){const s=this.app.safe(()=>setTimeout(()=>{const n=this.app.nodes.getID(e);if(n===void 0||!zc(e))return;const i=e.contentWindow,r=e.contentDocument;if(!r){this.app.debug.warn("no doc for iframe found",e);return}if(r&&this.docObservers.has(r)){this.app.debug.info("doc already observed for",n);return}const o=new ua(this.app);this.iframeObservers.set(e,o),this.docObservers.set(r,o),this.iframeObserversArr.push(o),o.observe(e),this.iframeOffsets.observe(e),i&&i===i.window&&!this.contextsSet.has(i)&&(this.contextsSet.add(i),this.contextCallbacks.forEach(a=>a(i)))},250));e.addEventListener("load",s),s()}handleShadowRoot(e){const s=new nh(this.app);this.shadowRootObservers.set(e,s),s.observe(e.host)}observe(){const e=this;Element.prototype.attachShadow=function(){const s=Hi.apply(this,arguments);return e.handleShadowRoot(s),s},this.app.nodes.clear(),this.observeRoot(window.document,()=>{this.app.send(Gc()),this.app.nodes.callNodeCallbacks(document,!0)},window.document.documentElement)}crossdomainObserve(e,s){const n=this;Element.prototype.attachShadow=function(){const r=Hi.apply(this,arguments);return n.handleShadowRoot(r),r},this.app.nodes.clear(),this.app.nodes.syntheticMode(s);const i=new ua(this.app);this.iframeObservers.set(window.document,i),i.syntheticObserve(e,window.document)}disconnect(){this.iframeOffsets.clear(),Element.prototype.attachShadow=Hi,this.iframeObserversArr.forEach(e=>e.disconnect()),this.iframeObserversArr=[],this.iframeObservers=new WeakMap,this.shadowRootObservers=new WeakMap,this.docObservers=new WeakMap,super.disconnect()}}var Rn;(function(t){t[t.Plain=0]="Plain",t[t.Obscured=1]="Obscured",t[t.Hidden=2]="Hidden"})(Rn||(Rn={}));const oh=t=>t.trim().replace(/[^\f\n\r\t\v\u00a0\u1680\u2000-\u200a\u2028\u2029\u202f\u205f\u3000\ufeff]/g,"█");class ah{constructor(e){this.obscured=new Set,this.hidden=new Set,this.app=e.app,this.options=Object.assign({obscureTextEmails:!0,obscureTextNumbers:!1},e.options)}handleNode(e,s,n){if((this.obscured.has(s)||gt(n)&&(Vt(n,"masked")||Vt(n,"obscured")))&&this.obscured.add(e),(this.hidden.has(s)||gt(n)&&(Vt(n,"htmlmasked")||Vt(n,"hidden")))&&this.hidden.add(e),this.options.domSanitizer!==void 0&>(n)){const i=this.options.domSanitizer(n);i===Rn.Obscured&&this.obscured.add(e),i===Rn.Hidden&&this.hidden.add(e)}}sanitize(e,s){return this.obscured.has(e)?oh(s):(this.options.obscureTextNumbers&&(s=s.replace(/\d/g,"0")),this.options.obscureTextEmails&&(s=s.replace(/^\w+([+.-]\w+)*@\w+([.-]\w+)*\.\w{2,3}$/g,n=>{const[i,r]=n.split("@"),[o,a]=r.split(".");return`${Ci(i)}@${Ci(o)}.${Ci(a)}`})),s)}isObscured(e){return this.obscured.has(e)}isHidden(e){return this.hidden.has(e)}getInnerTextSecure(e){const s=this.app.nodes.getID(e);return s?this.sanitize(s,e.innerText):""}clear(){this.obscured.clear(),this.hidden.clear()}}class lh{constructor(e){this.metadata={},this.userID=null,this.callbacks=[],this.timestamp=0,this.app=e.app,this.options=e.options,this.createTabId()}attachUpdateCallback(e){this.callbacks.push(e)}handleUpdate(e){e.userID==null&&delete e.userID,e.sessionID==null&&delete e.sessionID,this.callbacks.forEach(s=>s(e))}assign(e){e.userID!==void 0&&(this.userID=e.userID),e.metadata!==void 0&&Object.entries(e.metadata).forEach(([s,n])=>this.metadata[s]=n),e.sessionID!==void 0&&(this.sessionID=e.sessionID),e.timestamp!==void 0&&(this.timestamp=e.timestamp),e.projectID!==void 0&&(this.projectID=e.projectID),this.handleUpdate(e)}setMetadata(e,s){this.metadata[e]=s,this.handleUpdate({metadata:{[e]:s}})}setUserID(e){this.userID=e,this.handleUpdate({userID:e})}setUserInfo(e){this.userInfo=e}getPageNumber(){const e=this.app.sessionStorage.getItem(this.options.session_pageno_key);if(e!=null)return parseInt(e)}incPageNo(){let e=this.getPageNumber();return e===void 0?e=0:e++,this.app.sessionStorage.setItem(this.options.session_pageno_key,e.toString()),e}getSessionToken(){return this.token||this.app.sessionStorage.getItem(this.options.session_token_key)||void 0}setSessionToken(e){this.token=e,this.app.sessionStorage.setItem(this.options.session_token_key,e)}applySessionHash(e){const s=decodeURI(e).split("&");let n=e,i="100500";s.length==2&&([i,n]=s),!(!i||!n)&&(this.app.sessionStorage.setItem(this.options.session_token_key,n),this.app.sessionStorage.setItem(this.options.session_pageno_key,i))}getSessionHash(){const e=this.getPageNumber(),s=this.getSessionToken();if(!(e===void 0||s===void 0))return encodeURI(String(e)+"&"+s)}getTabId(){return this.tabId||this.createTabId(),this.tabId}regenerateTabId(){const e=jc(12);this.app.sessionStorage.setItem(this.options.session_tabid_key,e),this.tabId=e}createTabId(){const e=this.app.sessionStorage.getItem(this.options.session_tabid_key);e?this.tabId=e:this.regenerateTabId()}getInfo(){return{sessionID:this.sessionID,metadata:this.metadata,userID:this.userID,timestamp:this.timestamp,projectID:this.projectID}}reset(){this.app.sessionStorage.removeItem(this.options.session_token_key),this.metadata={},this.userID=null,this.sessionID=void 0,this.timestamp=0}}function ch(t,e){let s=0;return()=>{s++>=e&&(s=0,t())}}class uh{constructor(e){this.app=e,this.timer=null,this.callbacks=[]}attach(e,s=0,n=!0,i){i&&(e=e.bind(i)),n&&(e=this.app.safe(e)),this.callbacks.unshift(s?ch(e,s):e)-1}start(){this.timer===null&&(this.timer=setInterval(()=>this.callbacks.forEach(e=>{e&&e()}),30))}stop(){this.timer!==null&&(clearInterval(this.timer),this.timer=null)}}const hh='!function(){"use strict";class t{constructor(t,s,i,e=10,n=250,h,r){this.onUnauthorised=s,this.onFailure=i,this.MAX_ATTEMPTS_COUNT=e,this.ATTEMPT_TIMEOUT=n,this.onCompress=h,this.pageNo=r,this.attemptsCount=0,this.busy=!1,this.queue=[],this.token=null,this.lastBatchNum=0,this.ingestURL=t+"/v1/web/i",this.isCompressing=void 0!==h}getQueueStatus(){return 0===this.queue.length&&!this.busy}authorise(t){this.token=t,this.busy||this.sendNext()}push(t){if(this.busy||!this.token)this.queue.push(t);else if(this.busy=!0,this.isCompressing&&this.onCompress)this.onCompress(t);else{const s=++this.lastBatchNum;this.sendBatch(t,!1,s)}}sendNext(){const t=this.queue.shift();if(t)if(this.busy=!0,this.isCompressing&&this.onCompress)this.onCompress(t);else{const s=++this.lastBatchNum;this.sendBatch(t,!1,s)}else this.busy=!1}retry(t,s,i){this.attemptsCount>=this.MAX_ATTEMPTS_COUNT?this.onFailure(`Failed to send batch after ${this.attemptsCount} attempts.`):(this.attemptsCount++,setTimeout((()=>this.sendBatch(t,s,i)),this.ATTEMPT_TIMEOUT*this.attemptsCount))}sendBatch(t,s,i){var e;const n=null==i?void 0:i.toString().replace(/^([^_]+)_([^_]+).*/,"$1_$2_$3");this.busy=!0;const h={Authorization:`Bearer ${this.token}`};s&&(h["Content-Encoding"]="gzip"),null!==this.token?fetch(`${this.ingestURL}?batch=${null!==(e=this.pageNo)&&void 0!==e?e:"noPageNum"}_${null!=n?n:"noBatchNum"}`,{body:t,method:"POST",headers:h,keepalive:t.length<65536}).then((e=>{if(401===e.status)return this.busy=!1,void this.onUnauthorised();e.status>=400?this.retry(t,s,`${null!=i?i:"noBatchNum"}_network:${e.status}`):(this.attemptsCount=0,this.sendNext())})).catch((e=>{console.warn("OpenReplay:",e),this.retry(t,s,`${null!=i?i:"noBatchNum"}_reject:${e.message}`)})):setTimeout((()=>{this.sendBatch(t,s,`${null!=i?i:"noBatchNum"}_newToken`)}),500)}sendCompressed(t){const s=++this.lastBatchNum;this.sendBatch(t,!0,s)}sendUncompressed(t){const s=++this.lastBatchNum;this.sendBatch(t,!1,s)}clean(){this.sendNext(),setTimeout((()=>{this.token=null,this.queue.length=0}),10)}}const s="function"==typeof TextEncoder?new TextEncoder:{encode(t){const s=t.length,i=new Uint8Array(3*s);let e=-1;for(let n=0,h=0,r=0;r!==s;){if(n=t.charCodeAt(r),r+=1,n>=55296&&n<=56319){if(r===s){i[e+=1]=239,i[e+=1]=191,i[e+=1]=189;break}if(h=t.charCodeAt(r),!(h>=56320&&h<=57343)){i[e+=1]=239,i[e+=1]=191,i[e+=1]=189;continue}if(n=1024*(n-55296)+h-56320+65536,r+=1,n>65535){i[e+=1]=240|n>>>18,i[e+=1]=128|n>>>12&63,i[e+=1]=128|n>>>6&63,i[e+=1]=128|63&n;continue}}n<=127?i[e+=1]=0|n:n<=2047?(i[e+=1]=192|n>>>6,i[e+=1]=128|63&n):(i[e+=1]=224|n>>>12,i[e+=1]=128|n>>>6&63,i[e+=1]=128|63&n)}return i.subarray(0,e+1)}};class i{constructor(t){this.size=t,this.offset=0,this.checkpointOffset=0,this.data=new Uint8Array(t)}getCurrentOffset(){return this.offset}checkpoint(){this.checkpointOffset=this.offset}get isEmpty(){return 0===this.offset}skip(t){return this.offset+=t,this.offset<=this.size}set(t,s){this.data.set(t,s)}boolean(t){return this.data[this.offset++]=+t,this.offset<=this.size}uint(t){for((t<0||t>Number.MAX_SAFE_INTEGER)&&(t=0);t>=128;)this.data[this.offset++]=t%256|128,t=Math.floor(t/128);return this.data[this.offset++]=t,this.offset<=this.size}int(t){return t=Math.round(t),this.uint(t>=0?2*t:-2*t-1)}string(t){const i=s.encode(t),e=i.byteLength;return!(!this.uint(e)||this.offset+e>this.size)&&(this.data.set(i,this.offset),this.offset+=e,!0)}reset(){this.offset=0,this.checkpointOffset=0}flush(){const t=this.data.slice(0,this.checkpointOffset);return this.reset(),t}}class e extends i{encode(t){switch(t[0]){case 0:case 11:case 114:case 115:return this.uint(t[1]);case 4:case 44:case 47:return this.string(t[1])&&this.string(t[2])&&this.uint(t[3]);case 5:case 20:case 38:case 70:case 75:case 76:case 77:case 82:return this.uint(t[1])&&this.uint(t[2]);case 6:return this.int(t[1])&&this.int(t[2]);case 7:return!0;case 8:return this.uint(t[1])&&this.uint(t[2])&&this.uint(t[3])&&this.string(t[4])&&this.boolean(t[5]);case 9:case 10:case 24:case 51:return this.uint(t[1])&&this.uint(t[2])&&this.uint(t[3]);case 12:case 61:case 71:return this.uint(t[1])&&this.string(t[2])&&this.string(t[3]);case 13:case 14:case 17:case 50:case 54:return this.uint(t[1])&&this.string(t[2]);case 16:return this.uint(t[1])&&this.int(t[2])&&this.int(t[3]);case 18:return this.uint(t[1])&&this.string(t[2])&&this.int(t[3]);case 19:return this.uint(t[1])&&this.boolean(t[2]);case 21:return this.string(t[1])&&this.string(t[2])&&this.string(t[3])&&this.string(t[4])&&this.string(t[5])&&this.uint(t[6])&&this.uint(t[7])&&this.uint(t[8]);case 22:case 27:case 30:case 41:case 45:case 46:case 63:case 64:case 79:return this.string(t[1])&&this.string(t[2]);case 23:return this.uint(t[1])&&this.uint(t[2])&&this.uint(t[3])&&this.uint(t[4])&&this.uint(t[5])&&this.uint(t[6])&&this.uint(t[7])&&this.uint(t[8])&&this.uint(t[9]);case 28:case 29:case 42:case 117:case 118:return this.string(t[1]);case 37:return this.uint(t[1])&&this.string(t[2])&&this.uint(t[3]);case 39:return this.string(t[1])&&this.string(t[2])&&this.string(t[3])&&this.string(t[4])&&this.uint(t[5])&&this.uint(t[6])&&this.uint(t[7]);case 40:return this.string(t[1])&&this.uint(t[2])&&this.string(t[3])&&this.string(t[4]);case 48:return this.string(t[1])&&this.string(t[2])&&this.string(t[3])&&this.string(t[4])&&this.int(t[5]);case 49:return this.int(t[1])&&this.int(t[2])&&this.uint(t[3])&&this.uint(t[4]);case 53:return this.uint(t[1])&&this.uint(t[2])&&this.uint(t[3])&&this.uint(t[4])&&this.uint(t[5])&&this.uint(t[6])&&this.string(t[7])&&this.string(t[8]);case 55:return this.boolean(t[1]);case 57:case 60:return this.uint(t[1])&&this.string(t[2])&&this.string(t[3])&&this.string(t[4]);case 58:case 120:return this.int(t[1]);case 59:return this.uint(t[1])&&this.uint(t[2])&&this.uint(t[3])&&this.uint(t[4])&&this.string(t[5])&&this.string(t[6])&&this.string(t[7]);case 67:case 73:return this.uint(t[1])&&this.string(t[2])&&this.uint(t[3])&&this.string(t[4]);case 68:return this.uint(t[1])&&this.uint(t[2])&&this.string(t[3])&&this.string(t[4])&&this.uint(t[5])&&this.uint(t[6]);case 69:return this.uint(t[1])&&this.uint(t[2])&&this.string(t[3])&&this.string(t[4]);case 78:return this.string(t[1])&&this.string(t[2])&&this.string(t[3])&&this.string(t[4]);case 81:return this.uint(t[1])&&this.uint(t[2])&&this.uint(t[3])&&this.int(t[4])&&this.string(t[5]);case 83:return this.string(t[1])&&this.string(t[2])&&this.string(t[3])&&this.string(t[4])&&this.string(t[5])&&this.uint(t[6])&&this.uint(t[7])&&this.uint(t[8])&&this.uint(t[9]);case 84:return this.string(t[1])&&this.string(t[2])&&this.string(t[3])&&this.uint(t[4])&&this.string(t[5])&&this.string(t[6]);case 112:return this.uint(t[1])&&this.string(t[2])&&this.boolean(t[3])&&this.string(t[4])&&this.int(t[5])&&this.int(t[6]);case 113:return this.uint(t[1])&&this.uint(t[2])&&this.string(t[3]);case 116:return this.uint(t[1])&&this.uint(t[2])&&this.uint(t[3])&&this.uint(t[4])&&this.uint(t[5])&&this.uint(t[6])&&this.string(t[7])&&this.string(t[8])&&this.uint(t[9])&&this.boolean(t[10]);case 119:return this.string(t[1])&&this.uint(t[2]);case 121:return this.string(t[1])&&this.string(t[2])&&this.uint(t[3])&&this.uint(t[4]);case 122:return this.string(t[1])&&this.string(t[2])&&this.uint(t[3])&&this.string(t[4]);case 123:return this.string(t[1])&&this.string(t[2])&&this.string(t[3])&&this.string(t[4])&&this.uint(t[5])}}}class n{constructor(t,s,i,n,h,r){this.pageNo=t,this.timestamp=s,this.url=i,this.onBatch=n,this.tabId=h,this.onOfflineEnd=r,this.nextIndex=0,this.beaconSize=2e5,this.encoder=new e(this.beaconSize),this.sizeBuffer=new Uint8Array(3),this.isEmpty=!0,this.beaconSizeLimit=1e6,this.prepare()}writeType(t){return this.encoder.uint(t[0])}writeFields(t){return this.encoder.encode(t)}writeSizeAt(t,s){for(let s=0;s<3;s++)this.sizeBuffer[s]=t>>8*s;this.encoder.set(this.sizeBuffer,s)}prepare(){if(!this.encoder.isEmpty)return;const t=[81,1,this.pageNo,this.nextIndex,this.timestamp,this.url],s=[118,this.tabId];this.writeType(t),this.writeFields(t),this.writeWithSize(s),this.isEmpty=!0}writeWithSize(t){const s=this.encoder;if(!this.writeType(t)||!s.skip(3))return!1;const i=s.getCurrentOffset(),e=this.writeFields(t);if(e){const e=s.getCurrentOffset()-i;if(e>16777215)return console.warn("OpenReplay: max message size overflow."),!1;this.writeSizeAt(e,i-3),s.checkpoint(),this.isEmpty=this.isEmpty&&0===t[0],this.nextIndex++}return e}setBeaconSizeLimit(t){this.beaconSizeLimit=t}writeMessage(t){if("q_end"===t[0])return this.finaliseBatch(),this.onOfflineEnd();0===t[0]&&(this.timestamp=t[1]),122===t[0]&&(this.url=t[1]),this.writeWithSize(t)||(this.finaliseBatch(),this.writeWithSize(t)||(this.encoder=new e(this.beaconSizeLimit),this.prepare(),this.writeWithSize(t)?this.finaliseBatch():console.warn("OpenReplay: beacon size overflow. Skipping large message.",t,this),this.encoder=new e(this.beaconSize),this.prepare()))}finaliseBatch(){if(this.isEmpty)return;const t=this.encoder.flush();this.onBatch(t),this.prepare()}clean(){this.encoder.reset()}}var h;!function(t){t[t.NotActive=0]="NotActive",t[t.Starting=1]="Starting",t[t.Stopping=2]="Stopping",t[t.Active=3]="Active",t[t.Stopped=4]="Stopped"}(h||(h={}));let r=null,u=null,a=h.NotActive;function o(){u&&u.finaliseBatch()}function c(){return new Promise((t=>{a=h.Stopping,null!==p&&(clearInterval(p),p=null),u&&(u.clean(),u=null),r&&(r.clean(),setTimeout((()=>{r=null}),20)),setTimeout((()=>{a=h.NotActive,t(null)}),100)}))}function g(){[h.Stopped,h.Stopping].includes(a)||(postMessage("a_stop"),c().then((()=>{postMessage("a_start")})))}let l,p=null;self.onmessage=({data:s})=>{if(null!=s){if("stop"===s)return o(),void c().then((()=>{a=h.Stopped}));if("forceFlushBatch"!==s){if(!Array.isArray(s)){if("compressed"===s.type){if(!r)return console.debug("OR WebWorker: sender not initialised. Compressed batch."),void g();s.batch&&r.sendCompressed(s.batch)}if("uncompressed"===s.type){if(!r)return console.debug("OR WebWorker: sender not initialised. Uncompressed batch."),void g();s.batch&&r.sendUncompressed(s.batch)}return"start"===s.type?(a=h.Starting,r=new t(s.ingestPoint,(()=>{g()}),(t=>{!function(t){postMessage({type:"failure",reason:t}),c()}(t)}),s.connAttemptCount,s.connAttemptGap,(t=>{postMessage({type:"compress",batch:t},[t.buffer])}),s.pageNo),u=new n(s.pageNo,s.timestamp,s.url,(t=>{r&&r.push(t)}),s.tabId,(()=>postMessage({type:"queue_empty"}))),null===p&&(p=setInterval(o,1e4)),a=h.Active):"auth"===s.type?r?u?(r.authorise(s.token),void(s.beaconSizeLimit&&u.setBeaconSizeLimit(s.beaconSizeLimit))):(console.debug("OR WebWorker: writer not initialised. Received auth."),void g()):(console.debug("OR WebWorker: sender not initialised. Received auth."),void g()):void 0}if(u){const t=u;s.forEach((s=>{55===s[0]&&(s[1]?l=setTimeout((()=>g()),18e5):clearTimeout(l)),t.writeMessage(s)}))}else postMessage("not_init"),g()}else o()}else o()}}();\n',Hs="canceled",ha="or_uxt_active",Vi="or_buffer_1",mt=t=>({reason:t,success:!1}),da=t=>({...t,success:!0});var le;(function(t){t[t.NotActive=0]="NotActive",t[t.Starting=1]="Starting",t[t.Active=2]="Active",t[t.ColdStart=3]="ColdStart"})(le||(le={}));const fa="https://api.openreplay.com/ingest";function Gi(){const t=new Date().getTimezoneOffset()*-1,e=t>=0?"+":"-",s=Math.floor(Math.abs(t)/60),n=Math.abs(t)%60;return`UTC${e}${String(s).padStart(2,"0")}:${String(n).padStart(2,"0")}`}const dh=t=>new Promise(e=>setTimeout(e,t)),ce={ask:"never-gonna-give-you-up",resp:"never-gonna-let-you-down",reg:"never-gonna-run-around-and-desert-you",iframeSignal:"tracker inside a child iframe",iframeId:"getting node id for child iframe",iframeBatch:"batch of messages from an iframe window",parentAlive:"signal that parent is live",killIframe:"stop tracker inside frame",startIframe:"start tracker inside frame",polling:"hello-how-are-you-im-under-the-water-please-help-me"};let fh=class{constructor(e,s,n,i,r){var c,u;this.signalError=i,this.insideIframe=r,this.messages=[],this.bufferedMessages1=[],this.bufferedMessages2=[],this.startCallbacks=[],this.stopCallbacks=[],this.commitCallbacks=[],this.activityState=le.NotActive,this.version="14.0.14",this.socketMode=!1,this.compressionThreshold=24*1e3,this.bc=null,this.canvasRecorder=null,this.conditionsManager=null,this.canStart=!1,this.rootId=null,this.pageFrames=[],this.frameOderNumber=0,this.features={"feature-flags":!0,"usability-test":!0},this.parentActive=!1,this.checkStatus=()=>this.parentActive,this.parentCrossDomainFrameListener=l=>{const{data:h}=l;if(!(!h||l.source===window)){if(h.line===ce.startIframe){if(this.active())return;try{this.allowAppStart(),this.start()}catch(d){console.error("children frame restart failed:",d)}}h.line===ce.parentAlive&&(this.parentActive=!0),h.line===ce.iframeId&&(this.parentActive=!0,this.rootId=h.id,this.session.setSessionToken(h.token),this.frameOderNumber=h.frameOrderNumber,this.debug.log("starting iframe tracking",h),this.allowAppStart()),h.line===ce.killIframe&&this.active()&&this.stop()}},this.trackedFrames=[],this.crossDomainIframeListener=l=>{var d,f;if(!this.active()||l.source===window)return;const{data:h}=l;if(h){if(h.line===ce.iframeSignal&&((d=l.source)==null||d.postMessage({ping:!0,line:ce.parentAlive},"*"),(async()=>{var _;if(l.source===null)return console.error("Couldnt connect to event.source for child iframe tracking");const m=await this.checkNodeId(l.source);if(!m){this.debug.log("Couldnt get node id for iframe",l.source);return}try{this.trackedFrames.includes(h.context)?this.debug.log("Trying to observe already added iframe; ignore if its a restart"):this.trackedFrames.push(h.context),await this.waitStarted();const I=this.session.getSessionToken(),T=this.trackedFrames.findIndex(g=>g===h.context)+1;T===0&&this.debug.error("Couldnt get order number for iframe",h.context,this.trackedFrames);const y={line:ce.iframeId,id:m,token:I,frameOrderNumber:T};this.debug.log("Got child frame signal; nodeId",m,l.source,y),(_=l.source)==null||_.postMessage(y,"*")}catch(I){console.error(I)}})()),h.line===ce.iframeBatch){const m=h.messages.map(_=>{if(_[0]===20){let I=_;return this.pageFrames.forEach(T=>{if(T.contentWindow===l.source){const[y,g,v]=_,{left:E,top:C}=T.getBoundingClientRect();I=[y,g+E,v+C]}}),I}if(_[0]===68){let I=_;return this.pageFrames.forEach(T=>{if(T.contentWindow===l.source){const[y,g,v,E,C,S,k]=_,{left:A,top:z,width:F,height:G}=T.getBoundingClientRect(),j=document.documentElement.scrollWidth,x=document.documentElement.scrollHeight,D=S/100*F+A,O=k/100*G+z,N=D/j,V=O/x;I=[y,g,v,E,C,Math.round(N*1e3)/10,Math.round(V*1e3)/10]}}),I}return _});this.messages.push(...m)}if(h.line===ce.polling){if(!this.pollingQueue.order.length)return;const p=this.pollingQueue.order[0];if(p&&this.pollingQueue[p].length===0){this.pollingQueue.order=this.pollingQueue.order.filter(m=>m!==p);return}this.pollingQueue[p].includes(h.context)&&(this.pollingQueue[p]=this.pollingQueue[p].filter(m=>m!==h.context),(f=l.source)==null||f.postMessage({line:p},"*"),this.pollingQueue[p].length===0&&this.pollingQueue.order.shift())}}},this.pollingQueue={order:[]},this.addCommand=l=>{this.pollingQueue.order.push(l),this.pollingQueue[l]=[...this.trackedFrames]},this.bootChildrenFrames=async()=>{await this.waitStarted(),this.addCommand(ce.startIframe)},this.killChildrenFrames=()=>{this.addCommand(ce.killIframe)},this.signalIframeTracker=()=>{var I;const l=this.session.getTabId();window.parent.postMessage({line:ce.iframeSignal,source:l,context:this.contextId},((I=this.options.crossdomain)==null?void 0:I.parentDomain)??"*");const h=10;let d=0,f=250,p=0,m=!1;const _=()=>{var T;if(m||this.checkStatus()){m=!0;return}window.parent.postMessage({line:ce.iframeSignal,source:l,context:this.contextId},((T=this.options.crossdomain)==null?void 0:T.parentDomain)??"*"),this.debug.info("Trying to signal to parent, attempt:",d+1),d++};for(let T=0;T<h;T++){if(this.checkStatus()){m=!0;break}p+=f,setTimeout(()=>{_()},p),f*=1.5}},this.startTimeout=null,this.coldStartCommitN=0,this.delay=0,this.attachStartCallback=(l,h=!1)=>{h&&(l=this.safe(l)),this.startCallbacks.push(l)},this.attachStopCallback=(l,h=!1)=>{h&&(l=this.safe(l)),this.stopCallbacks.push(l)},this.attachEventListener=(l,h,d,f=!0,p=!0)=>{f&&(d=this.safe(d));const m=()=>l?zo(l,h,d,p,this.options.forceNgOff):null,_=()=>l?jo(l,h,d,p,this.options.forceNgOff):null;this.attachStartCallback(m,f),this.attachStopCallback(_,f)},this.coldInterval=null,this.orderNumber=0,this.coldStartTs=0,this.singleBuffer=!1,this.onSessionSent=()=>{},this.prevOpts={},this.restartCanvasTracking=()=>{var l;(l=this.canvasRecorder)==null||l.restartTracking()},this.flushBuffer=async l=>new Promise(h=>{let d=!1;const f=[l.shift()];for(;!d;){const p=l[0];!p||p[0]===0?d=!0:f.push(l.shift())}this.postToWorker(f),h(null)}),this.onUxtCb=[],this.contextId=Math.random().toString(36).slice(2),this.projectKey=e,Object.keys(n).findIndex(l=>["fixedCanvasScaling","disableCanvas"].includes(l))!==-1&&(console.warn('Openreplay: canvas options are moving to separate key "canvas" in next update. Please update your configuration.'),n={...n,canvas:{__save_canvas_locally:n.__save_canvas_locally,fixedCanvasScaling:n.fixedCanvasScaling,disableCanvas:n.disableCanvas}}),this.networkOptions=n.network;const o={revID:"",node_id:"__openreplay_id",session_token_key:"__openreplay_token",session_pageno_key:"__openreplay_pageno",session_reset_key:"__openreplay_reset",session_tabid_key:"__openreplay_tabid",local_uuid_key:"__openreplay_uuid",ingestPoint:fa,resourceBaseHref:null,__is_snippet:!1,__debug_report_edp:null,__debug__:ws.Silent,__save_canvas_locally:!1,localStorage:null,sessionStorage:null,disableStringDict:!1,forceSingleTab:!1,assistSocketHost:"",fixedCanvasScaling:!1,disableCanvas:!1,captureIFrames:!0,obscureTextEmails:!0,obscureTextNumbers:!1,crossdomain:{parentDomain:"*"},canvas:{disableCanvas:!1,fixedCanvasScaling:!1,__save_canvas_locally:!1,useAnimationFrame:!1},forceNgOff:!1};if(this.options=Uo(o,n),!this.insideIframe&&!this.options.forceSingleTab&&globalThis&&"BroadcastChannel"in globalThis){const l=location.hostname.split(".").slice(-2).join("_");this.bc=new BroadcastChannel(`rick_${l}`)}this.revID=this.options.revID,this.localStorage=this.options.localStorage??window.localStorage,this.sessionStorage=this.options.sessionStorage??window.sessionStorage,this.sanitizer=new ah({app:this,options:n}),this.nodes=new sh({node_id:this.options.node_id,forceNgOff:!!n.forceNgOff,maintainer:(c=this.options.nodes)==null?void 0:c.maintainer}),this.observer=new rh({app:this,options:n}),this.ticker=new uh(this),this.ticker.attach(()=>this.commit()),this.debug=new Ju(this.options.__debug__),this.session=new lh({app:this,options:this.options}),this.attributeSender=new Mc({app:this,isDictDisabled:!!(this.options.disableStringDict||(u=this.options.crossdomain)!=null&&u.enabled)}),this.featureFlags=new Lc(this),this.tagWatcher=new ku({sessionStorage:this.sessionStorage,errLog:this.debug.error,onTag:l=>this.send(wu(l))}),this.session.attachUpdateCallback(({userID:l,metadata:h})=>{l!=null&&this.send(ou(l)),h!=null&&Object.entries(h).forEach(([d,f])=>this.send(Wo(d,f)))}),s!=null&&this.session.applySessionHash(s);const a=this.session.getTabId();this.insideIframe?(window.addEventListener("message",this.parentCrossDomainFrameListener),setInterval(()=>{var l;document.hidden||window.parent.postMessage({line:ce.polling,context:this.contextId},((l=n.crossdomain)==null?void 0:l.parentDomain)??"*")},250)):(this.initWorker(),window.addEventListener("message",this.crossDomainIframeListener)),this.bc!==null&&(this.bc.postMessage({line:ce.ask,source:a,context:this.contextId}),this.startTimeout=setTimeout(()=>{this.allowAppStart()},250),this.bc.onmessage=l=>{if(l.data.context!==this.contextId){if(l.data.line===ce.resp){const h=l.data.token;this.session.setSessionToken(h),this.allowAppStart()}if(l.data.line===ce.reg){const h=l.data.token;this.session.regenerateTabId(),this.session.setSessionToken(h),this.allowAppStart()}if(l.data.line===ce.ask){const h=this.session.getSessionToken();h&&this.bc&&this.bc.postMessage({line:l.data.source===a?ce.reg:ce.resp,token:h,source:a,context:this.contextId})}}})}allowAppStart(){this.canStart=!0,this.startTimeout&&(clearTimeout(this.startTimeout),this.startTimeout=null)}async checkNodeId(e){let s;if(this.pageFrames.length>0&&(s=this.pageFrames.find(i=>i.contentWindow===e)),!s||!this.pageFrames.length){const i=Array.from(document.querySelectorAll("iframe"));this.pageFrames=i,s=i.find(r=>r.contentWindow===e)}if(!s)return null;let n=0;for(;n<100;){const i=s[this.options.node_id];if(i!==void 0)return n=100,i;n++,await dh(100)}return null}initWorker(){try{this.worker=new Worker(URL.createObjectURL(new Blob([hh],{type:"text/javascript"}))),this.worker.onerror=s=>{this._debug("webworker_error",s)},this.worker.onmessage=({data:s})=>{this.handleWorkerMsg(s)};const e=()=>{this.worker&&this.worker.postMessage(null)};this.attachEventListener(window,"beforeunload",e,!1),this.attachEventListener(document.body,"mouseleave",e,!1,!1),this.attachEventListener(document,"visibilitychange",e,!1)}catch(e){this._debug("worker_start",e)}}handleWorkerMsg(e){var s;if(e==="a_stop")this.stop(!1);else if(e==="a_start")this.waitStatus(le.NotActive).then(()=>{this.allowAppStart(),this.start(this.prevOpts,!0).then(n=>{this.debug.info("Worker restarted, session was too long",n)}).catch(n=>{this.debug.error("Worker restart failed",n)})});else if(e==="not_init")this.debug.warn("OR WebWorker: writer not initialised. Restarting tracker");else if(e.type==="failure")this.stop(!1),this.debug.error("worker_failed",e.reason),this._debug("worker_failed",e.reason);else if(e.type==="compress"){const n=e.batch;n.byteLength>this.compressionThreshold?Dc(e.batch,{mtime:0},(r,o)=>{var a,c;r?(this.debug.error("Openreplay compression error:",r),(a=this.worker)==null||a.postMessage({type:"uncompressed",batch:n})):(c=this.worker)==null||c.postMessage({type:"compressed",batch:o})}):(s=this.worker)==null||s.postMessage({type:"uncompressed",batch:n})}else e.type==="queue_empty"&&this.onSessionSent()}_debug(e,s){this.options.__debug_report_edp!==null&&fetch(this.options.__debug_report_edp,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({context:e,error:`${s}`})}),this.debug.error("OpenReplay error: ",e,s)}send(e,s=!1){var n;this.activityState!==le.NotActive&&(this.activityState===le.ColdStart?(this.bufferedMessages1.push(e),this.singleBuffer||this.bufferedMessages2.push(e),(n=this.conditionsManager)==null||n.processMessage(e)):this.messages.push(e),this.activityState===le.Active&&s&&this.commit())}_nCommit(){var e;if(this.socketMode){this.messages.unshift(Kt(this.session.getTabId())),this.messages.unshift(Gt(this.timestamp())),this.commitCallbacks.forEach(s=>s(this.messages)),this.messages.length=0;return}if(this.insideIframe){window.parent.postMessage({line:ce.iframeBatch,messages:this.messages},((e=this.options.crossdomain)==null?void 0:e.parentDomain)??"*"),this.commitCallbacks.forEach(s=>s(this.messages)),this.messages.length=0;return}if(!(this.worker===void 0||!this.messages.length))try{Wc(()=>{var s;this.messages.unshift(Kt(this.session.getTabId())),this.messages.unshift(Gt(this.timestamp())),(s=this.worker)==null||s.postMessage(this.messages),this.commitCallbacks.forEach(n=>n(this.messages)),this.messages.length=0})}catch(s){this._debug("worker_commit",s),this.stop(!0),setTimeout(()=>{this.start()},500)}}_cStartCommit(){this.coldStartCommitN+=1,this.coldStartCommitN===2&&(this.bufferedMessages1.push(Gt(this.timestamp())),this.bufferedMessages1.push(Kt(this.session.getTabId())),this.bufferedMessages2.push(Gt(this.timestamp())),this.bufferedMessages2.push(Kt(this.session.getTabId())),this.coldStartCommitN=0)}commit(){this.activityState===le.ColdStart?this._cStartCommit():this._nCommit()}postToWorker(e){var s;(s=this.worker)==null||s.postMessage(e),this.commitCallbacks.forEach(n=>n(e)),e.length=0}timestamp(){return Ke()+this.delay}safe(e){const s=this;return function(...n){try{e.apply(this,n)}catch(i){s._debug("safe_fn_call",i)}}}attachCommitCallback(e){this.commitCallbacks.push(e)}checkRequiredVersion(e){const s=e.split(/[.-]/),n=this.version.split(/[.-]/);for(let i=0;i<3;i++){if(isNaN(Number(n[i]))||isNaN(Number(s[i])))return!1;if(Number(n[i])>Number(s[i]))return!0;if(Number(n[i])<Number(s[i]))return!1}return!0}getTrackerInfo(){return{userUUID:this.localStorage.getItem(this.options.local_uuid_key),projectKey:this.projectKey,revID:this.revID,trackerVersion:this.version,isSnippet:this.options.__is_snippet}}getSessionInfo(){return{...this.session.getInfo(),...this.getTrackerInfo()}}getSessionToken(){return this.session.getSessionToken()}getSessionID(){return this.session.getInfo().sessionID||void 0}getSessionURL(e){const{projectID:s,sessionID:n,timestamp:i}=this.session.getInfo();if(!s||!n){this.debug.error("OpenReplay error: Unable to build session URL");return}const r=this.options.ingestPoint,c=(/api\.openreplay\.com/.test(r)?"https://app.openreplay.com/ingest":r).replace(/ingest$/,`${s}/session/${n}`);if(e!=null&&e.withCurrentTime){const u=Ke()-i;return`${c}?jumpto=${u}`}return c}getHost(){return new URL(this.options.ingestPoint).host}getProjectKey(){return this.projectKey}getBaseHref(){var e,s;return typeof this.options.resourceBaseHref=="string"?this.options.resourceBaseHref:(this.options.resourceBaseHref,document.baseURI?document.baseURI:((s=(e=document.head)==null?void 0:e.getElementsByTagName("base")[0])==null?void 0:s.getAttribute("href"))||location.origin+location.pathname)}resolveResourceURL(e){const s=new URL(this.getBaseHref());return s.pathname+="/"+new URL(e).pathname,s.pathname.replace(/\/+/g,"/"),s.toString()}isServiceURL(e){return e.startsWith(this.options.ingestPoint)}active(){return this.activityState===le.Active}resetNextPageSession(e){e?this.sessionStorage.setItem(this.options.session_reset_key,"t"):this.sessionStorage.removeItem(this.options.session_reset_key)}checkSessionToken(e){const s=this.sessionStorage.getItem(this.options.session_reset_key)!==null,n=e||s,i=this.session.getSessionToken();return n||!i}async coldStart(e={},s){this.singleBuffer=!1;const n=1e3,i=this.checkSessionToken(e.forceNew);s&&await this.setupConditionalStart(e);const r=()=>{this.orderNumber+=1,Ii(),this.coldStartTs=Ke(),this.orderNumber%2===0?(this.bufferedMessages1.length=0,this.bufferedMessages1.push(Gt(this.timestamp())),this.bufferedMessages1.push(Kt(this.session.getTabId()))):(this.bufferedMessages2.length=0,this.bufferedMessages2.push(Gt(this.timestamp())),this.bufferedMessages2.push(Kt(this.session.getTabId()))),this.stop(!1),this.activityState=le.ColdStart,e.sessionHash&&this.session.applySessionHash(e.sessionHash),e.forceNew&&this.session.reset(),this.session.assign({userID:e.userID,metadata:e.metadata}),i||(this.debug.log("continuing session on new tab",this.session.getTabId()),this.send(xn(this.session.getTabId()))),this.observer.observe(),this.ticker.start()};this.coldInterval=setInterval(()=>{r()},30*n),r()}async setupConditionalStart(e){var f,p;this.conditionsManager=new Ac(this,e);const s=await fetch(this.options.ingestPoint+"/v1/web/start",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...this.getTrackerInfo(),timestamp:Ke(),doNotRecord:!0,bufferDiff:0,userID:this.session.getInfo().userID,token:void 0,deviceMemory:Li,jsHeapSizeLimit:Bi,timezone:Gi(),width:window.screen.width,height:window.screen.height})}),{token:n,userBrowser:i,userCity:r,userCountry:o,userDevice:a,userOS:c,userState:u,projectID:l,features:h}=await s.json();this.features=h||this.features,this.session.assign({projectID:l}),this.session.setUserInfo({userBrowser:i,userCity:r,userCountry:o,userDevice:a,userOS:c,userState:u});const d={sessionToken:n,userUUID:"",sessionID:""};this.startCallbacks.forEach(m=>m(d)),await((f=this.conditionsManager)==null?void 0:f.fetchConditions(l,n)),this.features["feature-flags"]&&(await this.featureFlags.reloadFlags(n),(p=this.conditionsManager)==null||p.processFlags(this.featureFlags.flags)),await this.tagWatcher.fetchTags(this.options.ingestPoint,n)}offlineRecording(e={},s){this.onSessionSent=s,this.singleBuffer=!0;const n=this.checkSessionToken(e.forceNew);Ii(),this.coldStartTs=Ke();const i=this.localStorage.getItem(Vi);if(i){const o=JSON.parse(i);this.bufferedMessages1=Array.isArray(o)?o:this.bufferedMessages1,this.localStorage.removeItem(Vi)}this.bufferedMessages1.push(Gt(this.timestamp())),this.bufferedMessages1.push(Kt(this.session.getTabId())),this.activityState=le.ColdStart,e.sessionHash&&this.session.applySessionHash(e.sessionHash),e.forceNew&&this.session.reset(),this.session.assign({userID:e.userID,metadata:e.metadata});const r={sessionToken:"",userUUID:"",sessionID:""};return this.startCallbacks.forEach(o=>o(r)),n||this.send(xn(this.session.getTabId())),this.observer.observe(),this.ticker.start(),{saveBuffer:this.saveBuffer,getBuffer:this.getBuffer,setBuffer:this.setBuffer}}saveBuffer(){this.localStorage.setItem(Vi,JSON.stringify(this.bufferedMessages1))}getBuffer(){return this.bufferedMessages1}setBuffer(e){this.bufferedMessages1=e}async uploadOfflineRecording(){var d,f;this.stop(!1);const e=Ke();(d=this.worker)==null||d.postMessage({type:"start",pageNo:this.session.incPageNo(),ingestPoint:this.options.ingestPoint,timestamp:this.coldStartTs,url:document.URL,connAttemptCount:this.options.connAttemptCount,connAttemptGap:this.options.connAttemptGap,tabId:this.session.getTabId()});const s=await fetch(this.options.ingestPoint+"/v1/web/start",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...this.getTrackerInfo(),timestamp:e,doNotRecord:!1,bufferDiff:e-this.coldStartTs,userID:this.session.getInfo().userID,token:void 0,deviceMemory:Li,jsHeapSizeLimit:Bi,timezone:Gi()})}),{token:n,userBrowser:i,userCity:r,userCountry:o,userDevice:a,userOS:c,userState:u,beaconSizeLimit:l,projectID:h}=await s.json();for((f=this.worker)==null||f.postMessage({type:"auth",token:n,beaconSizeLimit:l}),this.session.assign({projectID:h}),this.session.setUserInfo({userBrowser:i,userCity:r,userCountry:o,userDevice:a,userOS:c,userState:u});this.bufferedMessages1.length>0;)await this.flushBuffer(this.bufferedMessages1);this.postToWorker([["q_end"]]),this.clearBuffers()}async _start(e={},s=!1,n){var c,u,l,h,d;Object.keys(e).length!==0&&(this.prevOpts=e);const i=this.activityState===le.ColdStart;if(i&&this.coldInterval&&clearInterval(this.coldInterval),!this.worker&&!this.insideIframe){const f="No worker found: perhaps, CSP is not set.";return this.signalError(f,[]),Promise.resolve(mt(f))}if(this.activityState===le.Active||this.activityState===le.Starting)return Promise.resolve(mt("OpenReplay: trying to call `start()` on the instance that has been started already."));this.activityState=le.Starting,i||Ii(),e.sessionHash&&this.session.applySessionHash(e.sessionHash),e.forceNew&&this.session.reset(),this.session.assign({userID:e.userID,metadata:e.metadata});const r=Ke();(c=this.worker)==null||c.postMessage({type:"start",pageNo:this.session.incPageNo(),ingestPoint:this.options.ingestPoint,timestamp:i?this.coldStartTs:r,url:document.URL,connAttemptCount:this.options.connAttemptCount,connAttemptGap:this.options.connAttemptGap,tabId:this.session.getTabId()});const o=this.session.getSessionToken(),a=this.checkSessionToken(e.forceNew);this.sessionStorage.removeItem(this.options.session_reset_key),this.debug.log("OpenReplay: starting session; need new session id?",a,"session token: ",o);try{const f=await window.fetch(this.options.ingestPoint+"/v1/web/start",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({...this.getTrackerInfo(),timestamp:r,doNotRecord:!1,bufferDiff:r-this.coldStartTs,userID:this.session.getInfo().userID,token:a?void 0:o,deviceMemory:Li,jsHeapSizeLimit:Bi,timezone:Gi(),condition:n,assistOnly:e.assistOnly??this.socketMode,width:window.screen.width,height:window.screen.height})});if(f.status!==200){const N=await f.text(),V=N===Hs?Hs:`Server error: ${f.status}. ${N}`;return mt(V)}if(!this.worker&&!this.insideIframe){const N="no worker found after start request (this should not happen in real world)";return this.signalError(N,[]),mt(N)}const{token:p,userUUID:m,projectID:_,beaconSizeLimit:I,compressionThreshold:T,delay:y,sessionID:g,startTimestamp:v,userBrowser:E,userCity:C,userCountry:S,userDevice:k,userOS:A,userState:z,canvasEnabled:F,canvasQuality:G,canvasFPS:j,assistOnly:x,features:D}=await f.json();if(this.features=D||this.features,typeof p!="string"||typeof m!="string"||typeof v!="number"&&typeof v<"u"||typeof g!="string"||typeof y!="number"||typeof I!="number"&&typeof I<"u"){const N=`Incorrect server response: ${JSON.stringify(f)}`;return this.signalError(N,[]),mt(N)}this.delay=y,this.session.setSessionToken(p),this.session.setUserInfo({userBrowser:E,userCity:C,userCountry:S,userDevice:k,userOS:A,userState:z}),this.session.assign({sessionID:g,timestamp:v||r,projectID:_}),x?(this.socketMode=!0,(u=this.worker)==null||u.postMessage("stop")):(l=this.worker)==null||l.postMessage({type:"auth",token:p,beaconSizeLimit:I}),!a&&p===o&&(this.debug.log("continuing session on new tab",this.session.getTabId()),this.send(xn(this.session.getTabId()))),Object.entries(this.session.getInfo().metadata).forEach(([N,V])=>this.send(Wo(N,V))),this.localStorage.setItem(this.options.local_uuid_key,m),this.compressionThreshold=T;const O={sessionToken:p,userUUID:m,sessionID:g};if(this.startCallbacks.forEach(N=>N(O)),e.startCallback&&e.startCallback(da(O)),this.features["feature-flags"]&&this.featureFlags.reloadFlags(),await this.tagWatcher.fetchTags(this.options.ingestPoint,p),this.activityState=le.Active,(h=this.options.crossdomain)!=null&&h.enabled&&!this.insideIframe&&this.bootChildrenFrames(),F&&!this.options.canvas.disableCanvas&&(this.canvasRecorder=this.canvasRecorder??new Ku(this,{fps:j,quality:G,isDebug:this.options.canvas.__save_canvas_locally,fixedScaling:this.options.canvas.fixedCanvasScaling,useAnimationFrame:this.options.canvas.useAnimationFrame})),i){const N=this.bufferedMessages1.length>this.bufferedMessages2.length?this.bufferedMessages1:this.bufferedMessages2;for(;N.length>0;)await this.flushBuffer(N);this.clearBuffers(),this.commit()}else this.insideIframe&&this.rootId?this.observer.crossdomainObserve(this.rootId,this.frameOderNumber):this.observer.observe(),this.ticker.start();if((d=this.canvasRecorder)==null||d.startTracking(),this.features["usability-test"]&&!this.insideIframe){this.uxtManager=this.uxtManager?this.uxtManager:new Vu(this,ha);let N;const V=this.localStorage.getItem(ha);if(V&&(N=parseInt(V,10)),location!=null&&location.search){const Y=new URLSearchParams(location.search);if(Y.has("oruxt")){const se=Y.get("oruxt");N=se?parseInt(se,10):void 0}}N&&(this.uxtManager.isActive?this.onUxtCb.forEach(Y=>Y(N)):this.uxtManager.getTest(N,p,!!V).then(Y=>{Y&&this.onUxtCb.forEach(se=>se(Y))}))}return da(O)}catch(f){if(this.stop(),this.session.reset(),!f)return console.error("Unknown error during start"),this.signalError("Unknown error",[]),mt("Unknown error");if(f===Hs)return this.signalError(Hs,[]),mt(Hs);this._debug("session_start",f);const p=f instanceof Error?f.message:f.toString();return this.signalError(p,[]),mt(p)}}addOnUxtCb(e){this.onUxtCb.push(e)}getUxtId(){var e;return(e=this.uxtManager)==null?void 0:e.getTestId()}async waitStart(){return new Promise(e=>{const s=setInterval(()=>{this.canStart&&(clearInterval(s),e(!0))},100)})}async waitStarted(){return this.waitStatus(le.Active)}async waitStatus(e){return new Promise(s=>{const n=()=>{this.activityState===e?s(!0):setTimeout(n,25)};n()})}async start(...e){return this.activityState===le.Active||this.activityState===le.Starting?Promise.resolve(mt("OpenReplay: trying to call `start()` on the instance that has been started already.")):(this.insideIframe&&this.signalIframeTracker(),document.hidden?new Promise(s=>{const n=async()=>{document.hidden||(await this.waitStart(),document.removeEventListener("visibilitychange",n),s(this._start(...e)))};document.addEventListener("visibilitychange",n)}):(await this.waitStart(),this._start(...e)))}forceFlushBatch(){var e;(e=this.worker)==null||e.postMessage("forceFlushBatch")}getTabId(){return this.session.getTabId()}clearBuffers(){this.bufferedMessages1.length=0,this.bufferedMessages2.length=0}trackWs(e){const s=e;return(n,i,r="down")=>{typeof n!="string"||typeof i!="string"||i.length>5*1024*1024||n.length>255||this.send(mu("websocket",s,i,this.timestamp(),r,n))}}stop(e=!0){var s,n;if(this.activityState!==le.NotActive)try{!this.insideIframe&&((s=this.options.crossdomain)!=null&&s.enabled)&&this.killChildrenFrames(),this.attributeSender.clear(),this.sanitizer.clear(),this.observer.disconnect(),this.nodes.clear(),this.ticker.stop(),this.stopCallbacks.forEach(i=>i()),this.tagWatcher.clear(),this.worker&&e&&this.worker.postMessage("stop"),(n=this.canvasRecorder)==null||n.clear(),this.messages.length=0,this.parentActive=!1}finally{this.activityState=le.NotActive,this.debug.log("OpenReplay tracking stopped.")}}};function ph(t){const e=navigator.connection||navigator.mozConnection||navigator.webkitConnection;if(e===void 0)return;const s=()=>t.send(cu(Math.round(e.downlink*1e3),e.type||"unknown"));s(),e.addEventListener("change",s)}const pa=tt&&"InstallTrigger"in window?t=>t.message+`
|
|
10
|
+
`+t.stack:t=>t.stack||t.message;function Ki(t){return t===void 0?"undefined":t===null?"null":t instanceof Error?pa(t):Array.isArray(t)?`Array(${t.length})`:String(t)}function gh(t){return typeof t!="number"?"NaN":t.toString()}function mh(t){return typeof t!="number"?"NaN":Math.floor(t).toString()}function ga(t){if(t===void 0)return"undefined";if(t===null)return"null";if(t instanceof Error)return pa(t);if(Array.isArray(t)){const e=t.length,s=t.slice(0,10).map(Ki).join(", ");return`Array(${e})[${s}]`}if(typeof t=="object"){const e=[];let s=0;for(const n in t){if(++s===10)break;const i=t[n];e.push(n+": "+Ki(i))}return"{"+e.join(", ")+"}"}return t.toString()}function vh(t){return typeof t[0]=="string"&&t.unshift(t.shift().replace(/%(o|s|f|d|i)/g,(e,s)=>{const n=t.shift();if(n===void 0)return e;switch(s){case"o":return ga(n);case"s":return Ki(n);case"f":return gh(n);case"d":case"i":return mh(n);default:return e}})),t.map(ga).join(" ")}const ma=["log","info","warn","error","debug","assert"];function bh(t,e){const s=Object.assign({consoleMethods:ma,consoleThrottling:30},e);if(!Array.isArray(s.consoleMethods)||s.consoleMethods.length===0)return;const n=t.safe((c,u)=>t.send(su(c,vh(u))));let i=0;const r=()=>{i=0};t.attachStartCallback(r),t.ticker.attach(r,33,!1);const o=(c,u)=>{const l={apply:function(h,d,f){Reflect.apply(h,u,f),i=i+1,!(i>s.consoleThrottling)&&n(h.name,f)}};s.consoleMethods.forEach(h=>{if(ma.indexOf(h)===-1){t.debug.error(`OpenReplay: unsupported console method "${h}"`);return}const d=u.console[h];c[h]=new Proxy(d,l)})},a=t.safe(c=>o(c.console,c));a(window),t.observer.attachContextCallback(a)}const yh=/(^|@)\S+:\d+/,va=/^\s*at .*(\S+:\d+|\(native\))/m,wh=/^(eval@)?(\[native code\])?$/;function Sh(t,e){if(typeof t.stacktrace<"u"||typeof t["opera#sourceloc"]<"u")return Eh(t);if(t.stack&&t.stack.match(va))return _h(t);if(t.stack)return Th(t);throw new Error("Cannot parse given Error object")}function Xi(t){if(!t.includes(":"))return[t,void 0,void 0];const s=/(.+?)(?::(\d+))?(?::(\d+))?$/.exec(t.replace(/[()]/g,""));return[s[1],s[2]||void 0,s[3]||void 0]}function Vs(t,e){return t}function _h(t,e){return kh(t.stack)}function kh(t,e){return Vs(t.split(`
|
|
11
|
+
`).filter(n=>!!n.match(va))).map(n=>{n.includes("(eval ")&&(n=n.replace(/eval code/g,"eval").replace(/(\(eval at [^()]*)|(,.*$)/g,""));let i=n.replace(/^\s+/,"").replace(/\(eval code/g,"(").replace(/^.*?\s+/,"");const r=i.match(/ (\(.+\)$)/);i=r?i.replace(r[0],""):i;const o=Xi(r?r[1]:i),a=r&&i||void 0,c=["eval","<anonymous>"].includes(o[0])?void 0:o[0];return{function:a,file:c,line:o[1]?+o[1]:void 0,col:o[2]?+o[2]:void 0,raw:n}})}function Th(t,e){return xh(t.stack)}function xh(t,e){return Vs(t.split(`
|
|
12
|
+
`).filter(n=>!n.match(wh))).map(n=>{if(n.includes(" > eval")&&(n=n.replace(/ line (\d+)(?: > eval line \d+)* > eval:\d+:\d+/g,":$1")),!n.includes("@")&&!n.includes(":"))return{function:n};{const i=/(([^\n\r"\u2028\u2029]*".[^\n\r"\u2028\u2029]*"[^\n\r@\u2028\u2029]*(?:@[^\n\r"\u2028\u2029]*"[^\n\r@\u2028\u2029]*)*(?:[\n\r\u2028\u2029][^@]*)?)?[^@]*)@/,r=n.match(i),o=r&&r[1]?r[1]:void 0,a=Xi(n.replace(i,""));return{function:o,file:a[0],line:a[1]?+a[1]:void 0,col:a[2]?+a[2]:void 0,raw:n}}})}function Eh(t,e){return!t.stacktrace||t.message.includes(`
|
|
13
13
|
`)&&t.message.split(`
|
|
14
14
|
`).length>t.stacktrace.split(`
|
|
15
|
-
`).length?Ih(t):t.stack?
|
|
16
|
-
`),i=[];for(let r=2,o=n.length;r<o;r+=2){const a=s.exec(n[r]);a&&i.push({file:a[2],line:+a[1],raw:n[r]})}return
|
|
17
|
-
`),i=[];for(let r=0,o=n.length;r<o;r+=2){const a=s.exec(n[r]);a&&i.push({function:a[3]||void 0,file:a[2],line:a[1]?+a[1]:void 0,raw:n[r]})}return
|
|
18
|
-
`).filter(n=>!!n.match(bh)&&!n.match(/^Error created at/))).map(n=>{const i=n.split("@"),r=Ki(i.pop()),o=i.shift()||"",a=o.replace(/<anonymous function(: (\w+))?>/,"$2").replace(/\([^)]*\)/g,"")||void 0;let c;o.match(/\(([^)]*)\)/)&&(c=o.replace(/^[^(]+\(([^)]*)\)$/,"$1"));const u=c===void 0||c==="[arguments not available]"?void 0:c.split(",");return{function:a,args:u,file:r[0],line:r[1]?+r[1]:void 0,col:r[2]?+r[2]:void 0,raw:n}})}function Nh(t){return t.map(e=>({functionName:e.function,args:e.args,fileName:e.file,lineNumber:e.line,columnNumber:e.col,source:e.raw}))}function Dh(t,e){return Nh(wh(t))}function ma(t){return[{columnNumber:t.colno,lineNumber:t.lineno,fileName:t.filename,functionName:"",source:""}]}function Rn(t,e,s={}){let n=e;try{n=Dh(t)}catch{}return Mi(t.name,t.message,JSON.stringify(n),JSON.stringify(s))}function va(t,e=window,s={}){if(t instanceof ErrorEvent){if(t.error instanceof Error)return Rn(t.error,ma(t),s);{let[n,i]=t.message.split(":");return i||(n="Error",i=t.message),Mi(n,i,JSON.stringify(ma(t)),JSON.stringify(s))}}else if("PromiseRejectionEvent"in e&&t instanceof e.PromiseRejectionEvent){if(t.reason instanceof Error)return Rn(t.reason,[],s);{let n;try{n=JSON.stringify(t.reason)}catch{n=String(t.reason)}return Mi("Unhandled Promise Rejection",n,"[]",JSON.stringify(s))}}return null}function Rh(t,e){const s=Object.assign({captureExceptions:!0},e);function n(i){function r(o){const a=va(o,i);a!=null&&t.send(a)}try{t.attachEventListener(i,"unhandledrejection",r),t.attachEventListener(i,"error",r)}catch(o){console.error("Error while attaching to error proto contexts",o)}}s.captureExceptions&&(t.observer.attachContextCallback(n),n(window))}function ba(t,e=document.location){return t=t.trim(),t.startsWith("//")||t.startsWith("http://")||t.startsWith("https://")||t.startsWith("data:")?t:t.startsWith("/")?e.origin+t:e.origin+e.pathname+t}function Oh(t){return Lc&&(t.startsWith("data:image/svg+xml")||t.match(/.svg$|/i))}const Mh="https://static.openreplay.com/tracker/placeholder.jpeg";function Ah(t){function e(a,c){t.attributeSender.sendSetAttribute(a,"src",Mh);const{width:u,height:l}=c.getBoundingClientRect();c.hasAttribute("width")||t.attributeSender.sendSetAttribute(a,"width",String(u)),c.hasAttribute("height")||t.attributeSender.sendSetAttribute(a,"height",String(l))}const s=function(a,c){const{srcset:u}=c;if(!u)return;const l=u.split(u.match(/,\s+/)?/,\s+/:",").map(h=>ba(h)).join(", ");t.attributeSender.sendSetAttribute(a,"srcset",l)},n=function(a,c){c.src.length>Bc&&e(a,c),t.send(Di(a,"src",c.src,t.getBaseHref()))},i=t.safe(function(a){const c=ba(a.src||"");Ro(c)&&t.send(Jo(t.timestamp(),0,0,0,0,0,c,"img",0,!1))}),r=t.safe(function(a){const c=t.nodes.getID(a);c!==void 0&&a.complete&&(a.naturalHeight===0&&a.naturalWidth===0&&!Oh(a.src)?i(a):t.sanitizer.isHidden(c)||t.sanitizer.isObscured(c)?e(c,a):(n(c,a),s(c,a)))}),o=Lo(t.safe(a=>{for(const c of a)if(c.type==="attributes"){const u=c.target,l=t.nodes.getID(u);if(l===void 0)return;c.attributeName==="src"&&n(l,u),c.attributeName==="srcset"&&s(l,u)}}),t.options.forceNgOff);t.attachStopCallback(()=>{o.disconnect()}),t.nodes.attachNodeCallback(a=>{he(a,"img")&&(t.nodes.attachNodeListener(a,"error",()=>i(a)),t.nodes.attachNodeListener(a,"load",()=>r(a)),r(a),o.observe(a,{attributes:!0,attributeFilter:["src","srcset"]}))})}const Ph=["text","password","email","search","number","range","date","tel","time"];function Lh(t){return he(t,"textarea")?!0:he(t,"input")?Ph.includes(t.type):!1}function Bh(t){if(!he(t,"input"))return!1;const e=t.type;return e==="checkbox"||e==="radio"}const Fh=tt&&"labels"in HTMLInputElement.prototype?t=>{let e=t;for(;(e=e.parentNode)!==null;)if(he(e,"label"))return e;const s=t.labels;if(s!==null&&s.length===1)return s[0]}:t=>{let e=t;for(;(e=e.parentNode)!==null;)if(he(e,"label"))return e;const s=t.id;if(s){const n=t.ownerDocument.querySelectorAll('label[for="'+s+'"]');if(n!==null&&n.length===1)return n[0]}};function ya(t){let e=xi(t);if(e===null){const s=Fh(t);e=s&&s.innerText||t.placeholder||t.name||t.id||t.className||t.type}return Do(e).slice(0,100)}const ws={Plain:0,Obscured:1,Hidden:2};function jh(t,e){const s=Object.assign({obscureInputNumbers:!0,obscureInputEmails:!0,defaultInputMode:ws.Obscured,obscureInputDates:!1},e);function n(l,h){let f=h.value,d=s.defaultInputMode;h.type==="password"||t.sanitizer.isHidden(l)?d=ws.Hidden:(t.sanitizer.isObscured(l)||d===ws.Plain&&(s.obscureInputNumbers&&h.type!=="date"&&/\d\d\d\d/.test(f)||s.obscureInputDates&&h.type==="date"||s.obscureInputEmails&&(h.type==="email"||~f.indexOf("@"))))&&(d=ws.Obscured);let p=0;switch(d){case ws.Hidden:p=-1,f="";break;case ws.Obscured:p=f.length,f="";break}return{value:f,mask:p}}function i(l,h){const{value:f,mask:d}=n(l,h);t.send(Zc(l,f,d))}const r=new Map,o=new Map;t.attachStopCallback(()=>{r.clear(),o.clear()});function a(l,h){r.get(l)!==h.value&&(r.set(l,h.value),i(l,h))}function c(l,h){o.get(l)!==h&&(o.set(l,h),t.send($c(l,h)))}t.ticker.attach(()=>{r.forEach((l,h)=>{const f=t.nodes.getNode(h);if(!f)return r.delete(h);a(h,f)}),o.forEach((l,h)=>{const f=t.nodes.getNode(h);if(!f)return o.delete(h);c(h,f.checked)})},3);function u(l,h,f,d){const{value:p,mask:m}=n(l,h),_=ya(h);t.send(mu(l,p,m!==0,_,f,d))}t.nodes.attachNodeCallback(t.safe(l=>{const h=t.nodes.getID(l);if(h!==void 0){if(he(l,"select")&&(i(h,l),t.nodes.attachNodeListener(l,"change",()=>i(h,l))),Lh(l)){a(h,l);let f=0,d=0,p=0;const m=()=>{f=Ke()},_=()=>{d===0&&f!==0&&(d=Ke()-f)},C=()=>{f!==0&&(p=Ke()-f),u(h,l,d,p),d=0,p=0,f=0};t.nodes.attachNodeListener(l,"focus",m),t.nodes.attachNodeListener(l,"input",_),t.nodes.attachNodeListener(l,"change",C);return}if(Bh(l)){c(h,l.checked),t.nodes.attachNodeListener(l,"change",()=>c(h,l.checked));return}}}))}let je,Xi,wa;function zh(t,e){if(wa=new Date,t.nodeType!==Node.ELEMENT_NODE)throw new Error("Can't generate CSS selector for non-element node type.");if(t.tagName.toLowerCase()==="html")return"html";const s={root:document.body,idName:i=>!0,className:i=>!0,tagName:i=>!0,attr:(i,r)=>!1,seedMinLength:1,optimizedMinLength:2,threshold:1e3,maxNumberOfTries:1e4,timeoutMs:void 0};je={...s,...e},Xi=Uh(je.root,s);let n=On(t,"all",()=>On(t,"two",()=>On(t,"one",()=>On(t,"none"))));if(n){const i=Ia(Ca(n,t));return i.length>0&&(n=i[0]),Mn(n)}else throw new Error("Selector was not found.")}function Uh(t,e){return t.nodeType===Node.DOCUMENT_NODE?t:t===e.root?t.ownerDocument:t}function On(t,e,s){let n=null,i=[],r=t,o=0;for(;r;){const a=new Date().getTime()-wa.getTime();if(je.timeoutMs!==void 0&&a>je.timeoutMs)throw new Error(`Timeout: Can't find a unique selector after ${a}ms`);let c=Pn(Wh(r))||Pn(...Hh(r))||Pn(...qh(r))||Pn(Vh(r))||[Ta()];const u=Gh(r);if(e=="all")u&&(c=c.concat(c.filter(Ji).map(l=>An(l,u))));else if(e=="two")c=c.slice(0,1),u&&(c=c.concat(c.filter(Ji).map(l=>An(l,u))));else if(e=="one"){const[l]=c=c.slice(0,1);u&&Ji(l)&&(c=[An(l,u)])}else e=="none"&&(c=[Ta()],u&&(c=[An(c[0],u)]));for(let l of c)l.level=o;if(i.push(c),i.length>=je.seedMinLength&&(n=Sa(i,s),n))break;r=r.parentElement,o++}return n||(n=Sa(i,s)),!n&&s?s():n}function Sa(t,e){const s=Ia(Ea(t));if(s.length>je.threshold)return e?e():null;for(let n of s)if(ka(n))return n;return null}function Mn(t){let e=t[0],s=e.name;for(let n=1;n<t.length;n++){const i=t[n].level||0;e.level===i-1?s=`${t[n].name} > ${s}`:s=`${t[n].name} ${s}`,e=t[n]}return s}function _a(t){return t.map(e=>e.penalty).reduce((e,s)=>e+s,0)}function ka(t){const e=Mn(t);switch(Xi.querySelectorAll(e).length){case 0:throw new Error(`Can't select any node with this selector: ${e}`);case 1:return!0;default:return!1}}function Wh(t){const e=t.getAttribute("id");return e&&je.idName(e)?{name:"#"+CSS.escape(e),penalty:0}:null}function Hh(t){return Array.from(t.attributes).filter(s=>je.attr(s.name,s.value)).map(s=>({name:`[${CSS.escape(s.name)}="${CSS.escape(s.value)}"]`,penalty:.5}))}function qh(t){return Array.from(t.classList).filter(je.className).map(s=>({name:"."+CSS.escape(s),penalty:1}))}function Vh(t){const e=t.tagName.toLowerCase();return je.tagName(e)?{name:e,penalty:2}:null}function Ta(){return{name:"*",penalty:3}}function Gh(t){const e=t.parentNode;if(!e)return null;let s=e.firstChild;if(!s)return null;let n=0;for(;s&&(s.nodeType===Node.ELEMENT_NODE&&n++,s!==t);)s=s.nextSibling;return n}function An(t,e){return{name:t.name+`:nth-child(${e})`,penalty:t.penalty+1}}function Ji(t){return t.name!=="html"&&!t.name.startsWith("#")}function Pn(...t){const e=t.filter(Kh);return e.length>0?e:null}function Kh(t){return t!=null}function*Ea(t,e=[]){if(t.length>0)for(let s of t[0])yield*Ea(t.slice(1,t.length),e.concat(s));else yield e}function Ia(t){return[...t].sort((e,s)=>_a(e)-_a(s))}function*Ca(t,e,s={counter:0,visited:new Map}){if(t.length>2&&t.length>je.optimizedMinLength)for(let n=1;n<t.length-1;n++){if(s.counter>je.maxNumberOfTries)return;s.counter+=1;const i=[...t];i.splice(n,1);const r=Mn(i);if(s.visited.has(r))return;ka(i)&&Xh(i,e)&&(yield i,s.visited.set(r,!0),yield*Ca(i,e,s))}}function Xh(t,e){return Xi.querySelector(Mn(t))===e}function Jh(t,e,s){return zh(t,{root:e.body,seedMinLength:3,optimizedMinLength:(s==null?void 0:s.minSelectorDepth)||2,threshold:(s==null?void 0:s.nthThreshold)||1e3,maxNumberOfTries:(s==null?void 0:s.maxOptimiseTries)||1e4})}function Yi(t){const e=t.tagName.toUpperCase();return e==="BUTTON"||e==="A"||e==="LI"||e==="SELECT"||e==="TR"||e==="TH"||t.onclick!=null||t.getAttribute("role")==="button"}function xa(t,e){return t instanceof Element?Yh(t,e):null}function Yh(t,e){let s=t;for(;s!==null&&s!==e.documentElement;){if(qt(s,"masked"))return null;s=s.parentElement}if(ji(t)){let n=t.ownerSVGElement;for(;n!==null;)t=n,n=n.ownerSVGElement}for(s=t;s!==null&&s!==e.documentElement;){const n=s.tagName.toUpperCase();if(n==="LABEL")return null;if(n==="INPUT"||Yi(s)||xi(s)!==null)return s;s=s.parentElement}return t===e.documentElement?null:t}function Qh(t,e){const{disableClickmaps:s=!1}=e||{};function n(g){const v=xi(g);if(v!==null)return v;if(he(g,"input"))return ya(g);if(Yi(g)){let I="";return g instanceof HTMLElement&&(I=t.sanitizer.getInnerTextSecure(g)),I=I||g.id||g.className,Do(I).slice(0,100)}return""}let i=-1,r=-1,o=!1,a=null,c=0,u={},l=0,h=0,f=0,d=0,p;const m=.008,_=225;function C(){const g=d/_;if(!l){l=g;return}const v=(g-l)/_;f>4&&v>m&&t.send(vu(Ke())),d=0,f=0,l=g}t.attachStartCallback(()=>{p=setInterval(()=>C(),_)}),t.attachStopCallback(()=>{i=-1,r=-1,o=!1,a=null,u={},p&&clearInterval(p)});const T=()=>{o&&(t.send(eu(i,r)),o=!1)},y=(g,v=!1)=>{function I(S,k,A){return u[S]=u[S]||Jh(k,g,A)}const x=v?t.attachEventListener.bind(t):t.nodes.attachNodeListener.bind(t.nodes);x(g.documentElement,"mouseover",S=>{const k=xa(S.target,g);k!==a&&(a=k,c=performance.now())}),x(g,"mousemove",S=>{const[k,A]=t.observer.getDocumentOffset(g);i=S.clientX+k,r=S.clientY+A,o=!0;const j=Math.sign(S.movementX);d+=Math.abs(S.movementX)+Math.abs(S.movementY),j!==h&&(h=j,f++)},!1),x(g,"click",S=>{const k=xa(S.target,g);if(!S.clientX&&!S.clientY||k===null)return;const A=t.nodes.getID(k);if(A!==void 0){const j=S.pageX,F=S.pageY,G=g.documentElement.scrollWidth,z=g.documentElement.scrollHeight,E=Na(j/G),D=Na(F/z);T(),t.send(du(A,a===k?Math.round(performance.now()-c):0,n(k),Yi(k)&&!s?I(A,k,e):"",E,D),!0)}a=null})};t.nodes.attachNodeCallback(g=>{Cn(g)&&y(g)}),y(document,!0),t.ticker.attach(T,(e==null?void 0:e.trackingOffset)||7)}function Na(t){return Math.round(t*1e4)}function Zh(t){const e=[],s=document.getElementsByTagName("*"),n=/url\(("[^"]*"|'[^']*'|[^)]*)\)/i;for(let i=0;i<s.length;i++){const r=s[i];let o="";if(he(r,"img")&&(o=r.currentSrc||r.src),!o){const p=getComputedStyle(r).getPropertyValue("background-image");if(p){const m=n.exec(p);m!==null&&(o=m[1],(o.startsWith('"')||o.startsWith("'"))&&(o=o.substr(1,o.length-2)))}}if(!o)continue;const a=o.substr(0,10)==="data:image"?0:t[o];if(a===void 0)continue;const c=r.getBoundingClientRect(),u=Math.max(c.top,0),l=Math.max(c.left,0),h=Math.min(c.bottom,window.innerHeight||document.documentElement&&document.documentElement.clientHeight||0),f=Math.min(c.right,window.innerWidth||document.documentElement&&document.documentElement.clientWidth||0);if(h<=u||f<=l)continue;const d=(h-u)*(f-l);e.push({time:a,area:d})}return e}function $h(t,e){let s=Math.max(document.documentElement&&document.documentElement.clientWidth||0,window.innerWidth||0)*Math.max(document.documentElement&&document.documentElement.clientHeight||0,window.innerHeight||0)/10,n=s*t;for(let i=0;i<e.length;i++){const{time:r,area:o}=e[i];s+=o,n+=o*(r>t?r:t)}return s===0?0:n/s}function ef(t,e){const s=Object.assign({captureResourceTimings:!0,capturePageLoadTimings:!0,capturePageRenderTimings:!0,excludedResourceUrls:[]},e);if("PerformanceObserver"in window||(s.captureResourceTimings=!1),!s.captureResourceTimings)return;let n={};function i(u){var h;if(u.duration<0||!Ro(u.name)||t.isServiceURL(u.name))return;n!==null&&(n[u.name]=u.startTime+u.duration);let l=!1;(h=s.excludedResourceUrls)==null||h.forEach(f=>{if(u.name.startsWith(f)){l=!0;return}}),!l&&t.send(Jo(u.startTime+ms(),u.duration,u.responseStart&&u.startTime?u.responseStart-u.startTime:0,u.transferSize>u.encodedBodySize?u.transferSize-u.encodedBodySize:0,u.encodedBodySize||0,u.decodedBodySize||0,u.name,u.initiatorType,u.transferSize,u.responseStatus&&u.responseStatus===304||u.transferSize===0))}const r=new PerformanceObserver(u=>u.getEntries().forEach(i));let o;t.attachStartCallback(function({sessionID:u}){u!==o&&(performance.getEntriesByType("resource").forEach(i),o=u),r.observe({entryTypes:["resource"]})}),t.attachStopCallback(function(){r.disconnect()});let a=0,c=0;if(s.capturePageLoadTimings){let u=!1;t.ticker.attach(()=>{if(!u&&((a===0||c===0)&&performance.getEntriesByType("paint").forEach(l=>{const{name:h,startTime:f}=l;switch(h){case"first-paint":a=f;break;case"first-contentful-paint":c=f;break}}),performance.timing.loadEventEnd||performance.now()>3e4)){u=!0;const{navigationStart:l,requestStart:h,responseStart:f,responseEnd:d,domContentLoadedEventStart:p,domContentLoadedEventEnd:m,loadEventStart:_,loadEventEnd:C}=performance.timing;t.send(su(h-l||0,f-l||0,d-l||0,p-l||0,m-l||0,_-l||0,C-l||0,a,c))}},30)}if(s.capturePageRenderTimings){let u=0,l=0,h=0,f=null,d=!1;t.ticker.attach(()=>{if(d)return;const p=performance.now();if(n!==null&&(u=Math.max.apply(null,Object.keys(n).map(m=>n[m])),p-u>1e3&&(f=Zh(n),n=null)),h!==null&&(p-h>50&&(l=p),h=p-l>5e3?null:p),f!==null&&h===null||p>3e4){d=!0,n=null;const m=f===null?0:$h(c||a,f),{domContentLoadedEventEnd:_,navigationStart:C}=performance.timing,T=h===null?Math.max(l,c,_-C||0):0;t.send(nu(m,c>u?c:u,T))}})}}function Qi(t){const e=t.defaultView;return[e&&e.scrollX||t.documentElement&&t.documentElement.scrollLeft||t.body&&t.body.scrollLeft||0,e&&e.scrollY||t.documentElement&&t.documentElement.scrollTop||t.body&&t.body.scrollTop||0]}function tf(t,e){let s=!1;const n=new Map;function i(a){oa(a)&&(gt(a)&&n.set(a,[a.scrollLeft,a.scrollTop]),Cn(a)&&n.set(a,Qi(a)))}const r=t.safe(()=>{e||t.send(qc(...Qi(document)))}),o=t.safe((a,c)=>{const u=t.nodes.getID(c);u!==void 0&&t.send(Qc(u,a[0],a[1]))});t.attachStartCallback(r),t.attachStopCallback(()=>{s=!1,n.clear()}),t.nodes.attachNodeCallback((a,c)=>{c&&(gt(a)&&a.scrollLeft+a.scrollTop>0?n.set(a,[a.scrollLeft,a.scrollTop]):Cn(a)&&n.set(a,Qi(a))),xn(a)&&t.nodes.attachNodeListener(a,"scroll",u=>{i(u.target)})}),t.attachEventListener(document,"scroll",a=>{const c=a.target;if(c===document){s=!0;return}i(c)}),t.ticker.attach(()=>{s&&(r(),s=!1),n.forEach(o),n.clear()},5,!1)}function sf(t){let e,s,n,i,r=document.referrer;const o=t.safe(()=>{const{URL:u}=document;u!==e&&(e=u,t.send(wu(e,r,i,document.title)),i=0,r=e)}),a=t.safe(()=>{const{innerWidth:u,innerHeight:l}=window;(u!==s||l!==n)&&(s=u,n=l,t.send(Hc(s,n)))}),c=document.hidden===void 0?Function.prototype:t.safe(()=>t.send(cu(document.hidden)));t.attachStartCallback(()=>{e=null,i=ms(),s=n=-1,o(),a(),c()}),document.hidden!==void 0&&t.attachEventListener(document,"visibilitychange",c,!1,!1),t.ticker.attach(o,1,!1),t.ticker.attach(a,5,!1)}function Da(t){return xn(t)&&!!t.adoptedStyleSheets}let nf=15;function Ra(){return nf++}const Ln=new Map;function rf(t){if(t===null||!Da(document))return;const e=new Map,s=new Map,n=o=>setTimeout(()=>{let a=t.nodes.getID(o);if(o===document&&(a=0),a===void 0)return;let c=s.get(a);c||(c=[]);const u=[],l=o.adoptedStyleSheets;if(l&&Symbol.iterator in l)for(const h of l){let f=e.get(h);const d=!f;if(f||(f=Ra(),e.set(h,f)),c.includes(f)||t.send(Go(f,a)),d){const p=h.cssRules;for(let m=0;m<p.length;m++)t.send(Oi(f,p[m].cssText,m,t.getBaseHref()))}u.push(f)}if(Symbol.iterator in c)for(const h of c)u.includes(h)||t.send(pu(h,a));s.set(a,u)},20);function i(o){const a=Object.getOwnPropertyDescriptor(o,"adoptedStyleSheets");a&&Object.defineProperty(o,"adoptedStyleSheets",{...a,set:function(c){const u=a.set.call(this,c);return n(this),u}})}const r=o=>{if(o.__openreplay_adpss_patched__)return;o.__openreplay_adpss_patched__=!0,i(o.Document.prototype),i(o.ShadowRoot.prototype);const{replace:a,replaceSync:c}=o.CSSStyleSheet.prototype;o.CSSStyleSheet.prototype.replace=function(u){return a.call(this,u).then(l=>{const h=e.get(this);return h&&t.send(qo(h,u,t.getBaseHref())),l})},o.CSSStyleSheet.prototype.replaceSync=function(u){const l=e.get(this);return l&&t.send(qo(l,u,t.getBaseHref())),c.call(this,u)}};r(window),t.observer.attachContextCallback(t.safe(r)),t.attachStopCallback(()=>{e.clear(),s.clear()}),t.attachStartCallback(()=>{n(document)}),t.nodes.attachNodeCallback(o=>{Da(o)&&n(o)})}function of(t){if(t===null)return;if(!window.CSSStyleSheet){t.send(hu("no_stylesheet_prototype_in_window",""));return}const e=t.safe((i,r,o)=>{const a=Ln.get(i);a&&(typeof o=="string"?t.send(Oi(a,o,r,t.getBaseHref())):t.send(Vo(a,r)))}),s=t.safe(i=>{let r=i;for(;r.parentRule;)r=r.parentRule;const o=r.parentStyleSheet;if(!o){t.debug.warn("No parent StyleSheet found for",r,i);return}const a=Ln.get(o);if(!a){t.debug.warn("No sheedID found for",o,Ln);return}const c=r.cssText,u=o.cssRules,l=Array.from(u).indexOf(r);l>=0?(t.send(Oi(a,c,l,t.getBaseHref())),t.send(Vo(a,l+1))):t.debug.warn("Rule index not found in",o,r)}),n=t.safe(i=>{const{insertRule:r,deleteRule:o}=i.CSSStyleSheet.prototype,{insertRule:a,deleteRule:c}=i.CSSGroupingRule.prototype;i.CSSStyleSheet.prototype.insertRule=function(u,l=0){return e(this,l,u),r.call(this,u,l)},i.CSSStyleSheet.prototype.deleteRule=function(u){return e(this,u),o.call(this,u)},i.CSSGroupingRule.prototype.insertRule=function(u,l=0){const h=a.call(this,u,l);return s(this),h},i.CSSGroupingRule.prototype.deleteRule=function(u=0){const l=c.call(this,u);return s(this),l}});n(window),t.observer.attachContextCallback(n),t.nodes.attachNodeCallback(i=>{if(!he(i,"style")||!i.sheet||i.textContent!==null&&i.textContent.trim().length>0)return;const r=t.nodes.getID(i);if(!r)return;const o=i.sheet,a=Ra();Ln.set(o,a),t.send(Go(a,r));const c=o.cssRules;for(let u=0;u<c.length;u++)e(o,u,c[u].cssText)})}function af(t){function e(n){const i=t.nodes.getID(n);i!==void 0&&t.send(Ho(i))}let s=!1;t.nodes.attachNodeCallback(n=>{he(n,"body")&&(t.nodes.attachNodeListener(n,"focus",i=>{oa(i.target)&&(e(i.target),s=!1)}),t.nodes.attachNodeListener(n,"blur",i=>{i.relatedTarget===null&&(s=!0,setTimeout(()=>{s&&t.send(Ho(-1))},0))}))}),t.attachStartCallback(()=>{let n=document.activeElement;for(;n&&he(n,"iframe")&&n.contentDocument;)n=n.contentDocument.activeElement;n&&n!==n.ownerDocument.body&&e(n)},!0)}function lf(t){if(!window.FontFace)return;const e=new Map,s=n=>{class i extends n.FontFace{constructor(...o){if(typeof o[1]=="string"){let a="";o[2]&&t.safe(()=>{a=JSON.stringify(o[2])});const c=[o[0],o[1],a],u=e.get(n.document)||[];u.push(c),e.set(n.document,u);const l=n===window?0:t.nodes.getID(n.document);if(l===void 0)return;t.active()&&t.send(Wo(l,...c))}super(...o)}}n.FontFace=i};t.observer.attachContextCallback(s),s(window),t.nodes.attachNodeCallback(t.safe(n=>{if(!Cn(n))return;const i=e.get(n);if(!i)return;const r=n.defaultView===window?0:t.nodes.getID(n);r!==void 0&&i.forEach(o=>{t.send(Wo(r,...o))})}))}function cf(t,e,s,n,i){t.debug.log("Openreplay: attaching axios spy to instance",e);function r(f){t.debug.log("Openreplay: capturing axios response data",f);const{headers:d,data:p,method:m,url:_,baseURL:C}=f.config,{data:T,headers:y,status:g,response:v}=f,{data:I,headers:x,status:S}=v||{},k=s.ignoreHeaders,A=Array.isArray(k)?N=>k.includes(N):()=>k;function j(N,V){A(V[0])||(N[V[0]]=V[1])}let F={},G={};d.toJSON?F=d.toJSON():d instanceof Headers?d.forEach((N,V)=>j(F,[V,N])):Array.isArray(d)?d.forEach(N=>j(F,N)):typeof d=="object"&&Object.entries(d).forEach(N=>j(F,N));const z=x||y;z.toJSON?G=z.toJSON():z instanceof Headers?z.forEach((N,V)=>j(G,[V,N])):Array.isArray(z)?z.forEach(N=>j(G,N)):typeof z=="object"&&Object.entries(z).forEach(([N,V])=>{A(N)||(G[N]=V)});const E=n({url:_,method:m||"",status:g||S||0,request:{headers:F,body:p},response:{headers:G,body:I||T}});if(!E){t.debug.log("Openreplay: empty request/response info, skipping");return}const D=f.config.__openreplay_timing,O=performance.now()-D;t.debug.log("Openreplay: final req object",E),t.send(kn("xhr",String(m),String(E.url),i(E.request),i(E.response),E.status,D+ms(),O,0))}function o(f){if(t.debug.log("Openreplay: capturing API request",f),f.__openreplay_timing=performance.now(),s.sessionTokenHeader){const d=typeof s.sessionTokenHeader=="string"?s.sessionTokenHeader:"X-OpenReplay-Session-Token",p=t.getSessionToken();p&&f.headers.set(d,p)}return f}function a(f){return s.failuresOnly||r(f),f}function c(f){return t.debug.log("Openreplay: capturing API request error",f),uf(f)&&f.response?r(f.response):f instanceof Error&&t.send(Rn(f,[])),Promise.reject(f)}function u(f){t.debug.log("Openreplay: failed API request, skipping",f)}const l=e.interceptors.request.use(o,u,{synchronous:!0}),h=e.interceptors.response.use(a,c,{synchronous:!0});t.attachStopCallback(()=>{var f,d,p,m;(d=(f=e.interceptors.request).eject)==null||d.call(f,l),(m=(p=e.interceptors.response).eject)==null||m.call(p,h)})}function uf(t){return hf(t)&&t.isAxiosError===!0}function hf(t){return t!==null&&typeof t=="object"}class Zi{constructor(e=[],s,n){this.ignoredHeaders=e,this.setSessionTokenHeader=s,this.sanitize=n,this.id="",this.name="",this.method="",this.url="",this.status=0,this.statusText="",this.cancelState=0,this.readyState=0,this.header={},this.responseType="",this.requestType="xhr",this.requestHeader={},this.responseSize=0,this.responseSizeText="",this.startTime=0,this.endTime=0,this.duration=0,this.getData={},this.requestData=null}getMessage(){const{reqHs:e,resHs:s}=this.writeHeaders(),n={headers:e,body:this.method==="GET"?JSON.stringify(this.getData):this.requestData},i={headers:s,body:this.response},r=this.sanitize({url:this.url,method:this.method,status:this.status,request:n,response:i});if(!r)return null;if(r.url.includes("/graphql")&&r.response.body&&typeof r.response.body=="string"){const a=r.response.body.includes("errors");r.status=a?400:200,this.requestType="graphql"}return{requestType:this.requestType,method:r.method,url:r.url,request:JSON.stringify(r.request),response:JSON.stringify(r.response),status:r.status,startTime:this.startTime,duration:this.duration,responseSize:this.responseSize}}writeHeaders(){const e={};Object.entries(this.requestHeader).forEach(([n,i])=>{this.isHeaderIgnored(n)||(e[n]=i)}),this.setSessionTokenHeader((n,i)=>{e[n]=i});const s={};return Object.entries(this.header).forEach(([n,i])=>{this.isHeaderIgnored(n)||(s[n]=i)}),{reqHs:e,resHs:s}}isHeaderIgnored(e){return Array.isArray(this.ignoredHeaders)?this.ignoredHeaders.map(s=>s.toLowerCase()).includes(e.toLowerCase()):this.ignoredHeaders}}const Vs=(t,e)=>{let s="";switch(t){case"":case"text":case"json":typeof e=="string"?s=e:er(e)||Array.isArray(e)?s=JSON.stringify(e):typeof e<"u"&&(s=Object.prototype.toString.call(e));break;case"blob":case"document":case"arraybuffer":default:typeof e<"u"&&(s=Object.prototype.toString.call(e));break}return s},$i=t=>{if(!t)return null;let e;if(typeof t=="string"){(t[0]==="{"||t[0]==="[")&&(e=t);const s=t.split("&");s.length===1?e=t:e=s.join(",")}else if(df(t)){const s=[];for(const[n,i]of t)s.push(`${n}=${typeof i=="string"?i:"[object Object]"}`);e=s.join(",")}else t instanceof Blob||t instanceof ReadableStream||t instanceof ArrayBuffer?e="byte data":er(t)?e=t:e=`can't parse body ${typeof t}`;return e},ff=(t,e={})=>{er(e)||(e={});let s=t?t.split("?"):[];if(s.shift(),s.length>0){s=s.join("?").split("&");for(const n of s){const i=n.split("=");try{e[i[0]]=decodeURIComponent(i[1])}catch{e[i[0]]=i[1]}}}return e};function er(t){return t!==null&&typeof t=="object"}function df(t){return t==null||ArrayBuffer.isView(t)?!1:typeof Symbol<"u"&&typeof t[Symbol.iterator]=="function"}function Bn(t){return t<=0?"":t>=1e3*1e3?(t/1e3/1e3).toFixed(1)+" MB":t>=1e3?(t/1e3).toFixed(1)+" KB":`${t}B`}const tr=t=>(t.startsWith("//")&&(t=`${new URL(window.location.href).protocol}${t}`),t.startsWith("http")?new URL(t):new URL(t,window.location.href)),pf=t=>t instanceof Blob?t.type:t instanceof FormData?"multipart/form-data":t instanceof URLSearchParams?"application/x-www-form-urlencoded;charset=UTF-8":"text/plain;charset=UTF-8";class gf{constructor(e,s,n,i,r){this.ignoredHeaders=e,this.setSessionTokenHeader=s,this.sanitize=n,this.sendMessage=i,this.isServiceUrl=r}apply(e,s,n){const i=n[0],r=n[1],o=new Zi(this.ignoredHeaders,this.setSessionTokenHeader,this.sanitize);if(this.isServiceUrl(i))return e.apply(s,n);const a=tr(i);if(o.method="POST",o.url=i,o.name=(a.pathname.split("/").pop()||"")+a.search,o.requestType="beacon",o.requestHeader={"Content-Type":pf(r)},o.status=0,o.statusText="Pending",a.search&&a.searchParams){o.getData={};for(const[l,h]of a.searchParams)o.getData[l]=h}o.requestData=$i(r),o.startTime||(o.startTime=performance.now());const c=e.apply(s,n);c?(o.endTime=performance.now(),o.duration=o.endTime-(o.startTime||o.endTime),o.status=0,o.statusText="Sent",o.readyState=4):(o.status=500,o.statusText="Unknown");const u=o.getMessage();return u&&this.sendMessage(u),c}}class mf{static create(e,s,n,i,r,o){if(e)return new Proxy(e,new gf(s,n,i,r,o))}}var nt;(function(t){t[t.UNSENT=0]="UNSENT",t[t.OPENED=1]="OPENED",t[t.HEADERS_RECEIVED=2]="HEADERS_RECEIVED",t[t.LOADING=3]="LOADING",t[t.DONE=4]="DONE"})(nt||(nt={}));class vf{constructor(e,s){this.resp=e,this.item=s,this.mockReader()}set(e,s,n){return Reflect.set(e,s,n)}get(e,s){const n=Reflect.get(e,s);switch(s){case"arrayBuffer":case"blob":case"formData":case"json":case"text":return()=>(this.item.responseType=s.toLowerCase(),n.apply(e).then(i=>(this.item.response=Vs(this.item.responseType,i),i)))}return typeof n=="function"?n.bind(e):n}mockReader(){let e;if(!this.resp.body||typeof this.resp.body.getReader!="function")return;const s=this.resp.body.getReader;this.resp.body.getReader=()=>{const n=s.apply(this.resp.body);if(this.item.readyState===nt.DONE)return n;const i=n.read,r=n.cancel;return this.item.responseType="arraybuffer",n.read=()=>i.apply(n).then(o=>{if(!e)e=new Uint8Array(o.value);else{const a=new Uint8Array(e.length+o.value.length);a.set(e),a.set(o.value,e.length),e=a}return this.item.endTime=performance.now(),this.item.duration=this.item.endTime-(this.item.startTime||this.item.endTime),this.item.readyState=o.done?4:3,this.item.statusText=o.done?String(this.item.status):"Loading",this.item.responseSize=e.length,this.item.responseSizeText=Bn(this.item.responseSize),o.done&&(this.item.response=Vs(this.item.responseType,e)),o}),n.cancel=(...o)=>(this.item.cancelState=2,this.item.statusText="Cancel",this.item.endTime=performance.now(),this.item.duration=this.item.endTime-(this.item.startTime||this.item.endTime),this.item.response=Vs(this.item.responseType,e),r.apply(n,o)),n}}}class bf{constructor(e,s,n,i,r,o){this.ignoredHeaders=e,this.setSessionTokenHeader=s,this.sanitize=n,this.sendMessage=i,this.isServiceUrl=r,this.tokenUrlMatcher=o}apply(e,s,n){const i=n[0],r=n[1];if(!i||typeof i!="string"&&!(i!=null&&i.url)||(i instanceof URL||typeof i=="string"?this.isServiceUrl(String(i)):this.isServiceUrl(String(i.url))))return e.apply(window,n);const a=new Zi(this.ignoredHeaders,this.setSessionTokenHeader,this.sanitize);return this.beforeFetch(a,i,r),this.setSessionTokenHeader((c,u)=>{if(!(this.tokenUrlMatcher!==void 0&&!this.tokenUrlMatcher(a.url))){if(n[1]===void 0&&n[0]instanceof Request)return n[0].headers.append(c,u);n[1]||(n[1]={}),n[1].headers===void 0&&(n[1]=Object.assign(Object.assign({},n[1]),{headers:{}})),n[1].headers instanceof Headers?n[1].headers.append(c,u):Array.isArray(n[1].headers)?n[1].headers.push([c,u]):n[1].headers[c]=u}}),e.apply(window,n).then(this.afterFetch(a)).catch(c=>{throw a.endTime=performance.now(),a.duration=a.endTime-(a.startTime||a.endTime),c})}beforeFetch(e,s,n){let i,r="GET",o={};if(typeof s=="string"?(r=(n==null?void 0:n.method)||"GET",i=tr(s),o=(n==null?void 0:n.headers)||{}):(r=s.method||"GET",i=tr(s.url),o=s.headers),e.method=r,e.requestType="fetch",e.requestHeader=o,e.url=i.toString(),e.name=(i.pathname.split("/").pop()||"")+i.search,e.status=0,e.statusText="Pending",e.readyState=1,e.startTime||(e.startTime=performance.now()),Object.prototype.toString.call(o)==="[object Headers]"){e.requestHeader={};for(const[a,c]of o)e.requestHeader[a]=c}else e.requestHeader=o;if(i.search&&i.searchParams){e.getData={};for(const[a,c]of i.searchParams)e.getData[a]=c}n!=null&&n.body&&(e.requestData=$i(n.body))}afterFetch(e){return s=>{e.endTime=performance.now(),e.duration=e.endTime-(e.startTime||e.endTime),e.status=s.status,e.statusText=String(s.status);let n=!1;e.header={};for(const[i,r]of s.headers)e.header[i]=r,n=r.toLowerCase().indexOf("chunked")>-1?!0:n;return n?e.readyState=3:(e.readyState=4,this.handleResponseBody(s.clone(),e).then(i=>{e.responseSize=typeof i=="string"?i.length:i.byteLength,e.responseSizeText=Bn(e.responseSize),e.response=Vs(e.responseType,i);const r=e.getMessage();r&&this.sendMessage(r)}).catch(i=>{if(i.name!=="AbortError")throw i})),new Proxy(s,new vf(s,e))}}handleResponseBody(e,s){const n=e.headers.get("content-type");return n&&n.includes("application/json")?(s.responseType="json",e.text()):n&&(n.includes("text/html")||n.includes("text/plain"))?(s.responseType="text",e.text()):(s.responseType="arraybuffer",e.arrayBuffer())}}class yf{static create(e,s,n,i,r,o){return new Proxy(fetch,new bf(e,s,n,i,r,o))}}class wf{constructor(e,s,n,i,r,o,a){this.ignoredHeaders=s,this.setSessionTokenHeader=n,this.sanitize=i,this.sendMessage=r,this.isServiceUrl=o,this.tokenUrlMatcher=a,this.XMLReq=e,this.XMLReq.onreadystatechange=()=>{this.onReadyStateChange()},this.XMLReq.onabort=()=>{this.onAbort()},this.XMLReq.ontimeout=()=>{this.onTimeout()},this.item=new Zi(s,n,i),this.item.requestType="xhr"}get(e,s){switch(s){case"open":return this.getOpen(e);case"send":return this.setSessionTokenHeader((i,r)=>{this.tokenUrlMatcher!==void 0&&!this.tokenUrlMatcher(this.item.url)||e.setRequestHeader(i,r)}),this.getSend(e);case"setRequestHeader":return this.getSetRequestHeader(e);default:const n=Reflect.get(e,s);return typeof n=="function"?n.bind(e):n}}set(e,s,n){switch(s){case"onreadystatechange":return this.setOnReadyStateChange(e,s,n);case"onabort":return this.setOnAbort(e,s,n);case"ontimeout":return this.setOnTimeout(e,s,n)}return Reflect.set(e,s,n)}onReadyStateChange(){if(!(this.item.url&&this.isServiceUrl(this.item.url))&&(this.item.readyState=this.XMLReq.readyState,this.item.responseType=this.XMLReq.responseType,this.item.endTime=performance.now(),this.item.duration=this.item.endTime-this.item.startTime,this.updateItemByReadyState(),setTimeout(()=>{this.item.response=Vs(this.item.responseType,this.item.response)},0),this.XMLReq.readyState===nt.DONE)){const e=this.item.getMessage();e&&this.sendMessage(e)}}onAbort(){this.item.cancelState=1,this.item.statusText="Abort";const e=this.item.getMessage();e&&this.sendMessage(e)}onTimeout(){this.item.cancelState=3,this.item.statusText="Timeout";const e=this.item.getMessage();e&&this.sendMessage(e)}getOpen(e){const s=Reflect.get(e,"open");return(...n)=>{var i,r,o;const a=n[0],c=n[1];return this.item.method=a?a.toUpperCase():"GET",this.item.url=((i=c.toString)===null||i===void 0?void 0:i.call(c))||"",this.item.name=(o=(r=this.item.url)===null||r===void 0?void 0:r.replace(new RegExp("/*$"),"").split("/").pop())!==null&&o!==void 0?o:"",this.item.getData=ff(this.item.url,{}),s.apply(e,n)}}getSend(e){const s=Reflect.get(e,"send");return(...n)=>{const i=n[0];return this.item.requestData=$i(i),s.apply(e,n)}}getSetRequestHeader(e){const s=Reflect.get(e,"setRequestHeader");return(...n)=>(this.item.requestHeader||(this.item.requestHeader={}),this.item.requestHeader[n[0]]=n[1],s.apply(e,n))}setOnReadyStateChange(e,s,n){return Reflect.set(e,s,(...i)=>{this.onReadyStateChange(),n==null||n.apply(e,i)})}setOnAbort(e,s,n){return Reflect.set(e,s,(...i)=>{this.onAbort(),n.apply(e,i)})}setOnTimeout(e,s,n){return Reflect.set(e,s,(...i)=>{this.onTimeout(),n.apply(e,i)})}updateItemByReadyState(){switch(this.XMLReq.readyState){case nt.UNSENT:case nt.OPENED:this.item.status=nt.UNSENT,this.item.statusText="Pending",this.item.startTime||(this.item.startTime=performance.now());break;case nt.HEADERS_RECEIVED:this.item.status=this.XMLReq.status,this.item.statusText="Loading",this.item.header={};const e=this.XMLReq.getAllResponseHeaders()||"",s=e.split(`
|
|
19
|
-
`);for(let n=0;n<s.length;n++){const i=s[n];if(!i)continue;const r=i.split(": "),o=r[0];this.item.header[o]=r.slice(1).join(": ")}break;case nt.LOADING:this.item.status=this.XMLReq.status,this.item.statusText="Loading",this.XMLReq.response&&this.XMLReq.response.length&&(this.item.responseSize=this.XMLReq.response.length,this.item.responseSizeText=Bn(this.item.responseSize));break;case nt.DONE:this.item.status=this.XMLReq.status||this.item.status||0,this.item.statusText=String(this.item.status),this.item.endTime=performance.now(),this.item.duration=this.item.endTime-(this.item.startTime||this.item.endTime),this.item.response=this.XMLReq.response,this.XMLReq.response&&this.XMLReq.response.length&&(this.item.responseSize=this.XMLReq.response.length,this.item.responseSizeText=Bn(this.item.responseSize));break;default:this.item.status=this.XMLReq.status,this.item.statusText="Unknown";break}}}class Sf{static create(e,s,n,i,r,o){return new Proxy(XMLHttpRequest,{construct(a){const c=new a;return new Proxy(c,new wf(c,e,s,n,i,r,o))}})}}const Oa=t=>{const e=`Openreplay: Can't find ${t} in global context.`;console.warn(e)};function _f(t,e,s,n,i,r,o={xhr:!0,fetch:!0,beacon:!0},a){var c;if(t&&(o.xhr&&(t.XMLHttpRequest?t.XMLHttpRequest=Sf.create(e,s,n,i,r,a):Oa("XMLHttpRequest")),o.fetch&&(t.fetch?t.fetch=yf.create(e,s,n,i,r,a):Oa("fetch")),o.beacon&&!((c=t.navigator)===null||c===void 0)&&c.sendBeacon)){const u=t.navigator.sendBeacon;t.navigator.sendBeacon=mf.create(u,e,s,n,i,r)}}function sr(t){return t.__or_req_data__||(t.__or_req_data__={body:void 0,headers:{}}),t.__or_req_data__}function Ma(t){return typeof t=="string"?t.toUpperCase():"GET"}function kf(t,e={}){const s=Object.assign({failuresOnly:!1,ignoreHeaders:["cookie","set-cookie","authorization"],capturePayload:!1,sessionTokenHeader:!1,captureInIframes:!0,axiosInstances:void 0,useProxy:!0},e);s.useProxy===!1&&t.debug.warn("Network module is migrating to proxy api, to gradually migrate and test it set useProxy to true");const n=s.ignoreHeaders,i=Array.isArray(n)?l=>n.includes(l):()=>n,r=s.sessionTokenHeader===!0?"X-OpenReplay-SessionToken":s.sessionTokenHeader;function o(l){if(r){const h=t.getSessionToken();h&&t.safe(l)(r,h)}}function a(l){if(s.capturePayload||(delete l.request.body,delete l.response.body),s.sanitizer){const h=l.response.body;if(typeof h=="string")try{l.response.body=JSON.parse(h)}catch{}return s.sanitizer(l)}return l}function c(l){if(l&&typeof l.body!="string")try{l.body=JSON.stringify(l.body)}catch{l.body="<unable to stringify>",t.notify.warn("Openreplay fetch couldn't stringify body:",l.body)}return JSON.stringify(l)}const u=l=>{if(s.useProxy)return _f(l,s.ignoreHeaders,o,a,y=>{t.send(kn(y.requestType,y.method,y.url,y.request,y.response,y.status,y.startTime+ms(),y.duration,y.responseSize))},y=>t.isServiceURL(y),{xhr:!0,fetch:!0,beacon:!0},s.tokenUrlMatcher);const h=l.fetch.bind(l),f=(y,g={})=>{if(!(typeof y=="string"||y instanceof URL)||t.isServiceURL(String(y)))return h(y,g);o(function(I,x){g.headers===void 0&&(g.headers={}),g.headers instanceof Headers?g.headers.append(I,x):Array.isArray(g.headers)?g.headers.push([I,x]):g.headers[I]=x});const v=performance.now();return h(y,g).then(I=>{const x=performance.now()-v;if(s.failuresOnly&&I.status<400)return I;const S=I.clone();return S.text().then(k=>{const A={},j={};if(n!==!0){const z=([E,D])=>{i(E)||(A[E]=D)};g.headers instanceof Headers?g.headers.forEach((E,D)=>z([D,E])):Array.isArray(g.headers)?g.headers.forEach(z):typeof g.headers=="object"&&Object.entries(g.headers).forEach(z),S.headers.forEach((E,D)=>{i(D)||(j[D]=E)})}const F=Ma(g.method),G=a({url:String(y),method:F,status:S.status,request:{headers:A,body:g.body||null},response:{headers:j,body:k}});G&&t.send(kn("fetch",F,String(G.url),c(G.request),c(G.response),S.status,v+ms(),x,0))}).catch(k=>t.debug.error("Could not process Fetch response:",k)),I})};l.fetch=f;const d=l.XMLHttpRequest.prototype.open,p=l.XMLHttpRequest.prototype.setRequestHeader,m=l.XMLHttpRequest.prototype.send;function _(y,g){const v=this;o((x,S)=>v.setRequestHeader(x,S));let I=0;return v.addEventListener("loadstart",x=>{I=x.timeStamp}),v.addEventListener("load",t.safe(x=>{const{headers:S,body:k}=sr(v),A=I>0?x.timeStamp-I:0,F=(v.getAllResponseHeaders()||"").trim().split(/[\r\n]+/),G={};F.forEach(function(D){const O=D.split(": "),N=O.shift();i(N)||(G[N]=O.join(": "))});const z=Ma(y),E=a({url:String(g),method:z,status:v.status,request:{headers:S,body:k||null},response:{headers:G,body:v.response}});E&&t.send(kn("xhr",z,String(E.url),c(E.request),c(E.response),v.status,I+ms(),A,0))})),d.apply(this,arguments)}function C(y){const g=sr(this);return g.body=y,m.apply(this,arguments)}function T(y,g){if(!i(y)){const v=sr(this);v.headers[y]=g}return p.apply(this,arguments)}s.axiosInstances||(l.XMLHttpRequest.prototype.open=_,l.XMLHttpRequest.prototype.send=C,l.XMLHttpRequest.prototype.setRequestHeader=T)};u(window),s.axiosInstances&&s.axiosInstances.forEach(l=>{cf(t,l,s,a,c)}),s.captureInIframes&&t.observer.attachContextCallback(t.safe(u))}function Tf(t){t.attachEventListener(document,"selectionchange",()=>{const e=document.getSelection();if(e!==null&&!e.isCollapsed){const s=t.nodes.getID(e.anchorNode),n=t.nodes.getID(e.focusNode),i=e.toString().replace(/\s+/g," ");s&&n&&t.send(Ko(s,n,i))}else t.send(Ko(-1,-1,""))})}function Ef(t){function e(){document.hidden||(t.debug.log("Openreplay: tab change to"+t.session.getTabId()),t.send(Tn(t.session.getTabId())))}t.attachEventListener(window,"focus",e,!1,!1)}const Fn="/installation/javascript-sdk";function If(t){if(t==null)return console.error(`OpenReplay: invalid options argument type. Please, check documentation on ${_n}${Fn}`),!1;if(typeof t.projectKey!="string")if(typeof t.projectKey!="number"){if(typeof t.projectID!="number")return console.error(`OpenReplay: projectKey is missing or wrong type (string is expected). Please, check ${_n}${Fn} for more information.`),!1;t.projectKey=t.projectID.toString(),It("`projectID` option","`projectKey` option",Fn)}else console.warn("OpenReplay: projectKey is expected to have a string type."),t.projectKey=t.projectKey.toString();return t.sessionToken!=null&&It("`sessionToken` option","`sessionHash` start() option","/"),!0}const Cf=()=>{try{return!!window.top}catch{return!1}};class xf{constructor(e){var a,c;if(this.options=e,this.app=null,this.crossdomainMode=!1,this.checkDoNotTrack=()=>this.options.respectDoNotTrack&&(navigator.doNotTrack=="1"||window.doNotTrack=="1"),this.signalStartIssue=(u,l)=>{const h=this.checkDoNotTrack(),f=new XMLHttpRequest,d=this.options.ingestPoint||ha;f.open("POST",d+"/v1/web/not-started"),f.send(JSON.stringify({trackerVersion:"14.0.14",projectKey:this.options.projectKey,doNotTrack:h,reason:l.length?`missing api: ${l.join(",")}`:u}))},this.restartCanvasTracking=()=>{this.app!==null&&this.app.restartCanvasTracking()},this.handleError=(u,l={})=>{if(this.app!==null){if(u instanceof Error){const h=Rn(u,[],l);this.app.send(h)}else if(u instanceof ErrorEvent||"PromiseRejectionEvent"in window&&u instanceof PromiseRejectionEvent){const h=va(u,void 0,l);h!=null&&this.app.send(h)}}},this.crossdomainMode=!!(Po()&&((a=e.crossdomain)!=null&&a.enabled)),!tt||!If(e)){console.error("OpenReplay: tracker called in a non-browser environment or with invalid options");return}if(window.__OPENREPLAY__||!this.crossdomainMode&&Po()&&Cf()&&((c=window.top)!=null&&c.__OPENREPLAY__)){console.error("OpenReplay: one tracker instance has been initialised already");return}if(!e.__DISABLE_SECURE_MODE&&location.protocol!=="https:"){console.error("OpenReplay: Your website must be publicly accessible and running on SSL in order for OpenReplay to properly capture and replay the user session. You can disable this check by setting `__DISABLE_SECURE_MODE` option to `true` if you are testing in localhost. Keep in mind, that asset files on a local machine are not available to the outside world. This might affect tracking if you use css files.");return}const s=this.checkDoNotTrack(),n=[],i=["Map","Set","MutationObserver","performance","timing","startsWith","Blob","Worker"];if(s)n.push("doNotTrack");else for(const u of i)if(u==="timing"){if("performance"in window&&!(u in performance)){n.push(u);break}}else if(u==="startsWith"){if(!(u in String.prototype)){n.push(u);break}}else if(!(u in window)){n.push(u);break}if(n.length>0){const u=n.join(",");console.error(`OpenReplay: browser doesn't support API required for tracking or doNotTrack is set to 1. Reason: ${u}`),this.signalStartIssue("missing_api",n);return}const r=new fh(e.projectKey,e.sessionToken,e,this.signalStartIssue,this.crossdomainMode);this.app=r,this.crossdomainMode||(sf(r),dh(r),Su(r,e),Ef(r)),Qh(r,e.mouse),tf(r,this.crossdomainMode),of(r),rf(r),vh(r,e),Rh(r,e),Ah(r),jh(r,e),ef(r,e),af(r),lf(r),kf(r,e.network),Tf(r),window.__OPENREPLAY__=this,e.flags&&e.flags.onFlagsLoad&&this.onFlagsLoad(e.flags.onFlagsLoad);const o=window.open;(e.autoResetOnWindowOpen||e.resetTabOnWindowOpen)&&(r.attachStartCallback(()=>{const u=r.getTabId(),l=r.sessionStorage??window.sessionStorage;window.open=function(...h){return e.autoResetOnWindowOpen&&r.resetNextPageSession(!0),e.resetTabOnWindowOpen&&l.removeItem(e.session_tabid_key||"__openreplay_tabid"),r.resetNextPageSession(!1),l.setItem(e.session_tabid_key||"__openreplay_tabid",u),o.call(window,...h)}}),r.attachStopCallback(()=>{window.open=o}))}isFlagEnabled(e){return this.featureFlags.isFlagEnabled(e)}onFlagsLoad(e){var s;(s=this.app)==null||s.featureFlags.onFlagsLoad(e)}clearPersistFlags(){var e;(e=this.app)==null||e.featureFlags.clearPersistFlags()}reloadFlags(){var e;return(e=this.app)==null?void 0:e.featureFlags.reloadFlags()}getFeatureFlag(e){var s;return(s=this.app)==null?void 0:s.featureFlags.getFeatureFlag(e)}getAllFeatureFlags(){var e;return(e=this.app)==null?void 0:e.featureFlags.flags}use(e){return e(this.app,this.options)}isActive(){return this.app===null?!1:this.app.active()}trackWs(e){if(this.app!==null)return this.app.trackWs(e)}start(e){return this.browserEnvCheck()?this.app===null?Promise.reject("Browser doesn't support required api, or doNotTrack is active."):this.app.start(e):Promise.reject("Trying to start not in browser.")}browserEnvCheck(){return tt?!0:(console.error(`OpenReplay: you are trying to start Tracker on a node.js environment. If you want to use OpenReplay with SSR, please, use componentDidMount or useEffect API for placing the \`tracker.start()\` line. Check documentation on ${_n}${Fn}`),!1)}coldStart(e,s){if(this.browserEnvCheck()){if(this.app===null)return Promise.reject("Tracker not initialized");this.app.coldStart(e,s)}else return Promise.reject("Trying to start not in browser.")}startOfflineRecording(e,s){return this.browserEnvCheck()?this.app===null?Promise.reject("Tracker not initialized"):this.app.offlineRecording(e,s):Promise.reject("Trying to start not in browser.")}uploadOfflineRecording(){if(this.app!==null)return this.app.uploadOfflineRecording()}stop(){if(this.app!==null)return this.app.stop(),this.app.session.getSessionHash()}forceFlushBatch(){this.app!==null&&this.app.forceFlushBatch()}getSessionToken(){return this.app===null?null:this.app.getSessionToken()}getSessionInfo(){return this.app===null?null:this.app.session.getInfo()}getSessionID(){return this.app===null?null:this.app.getSessionID()}getTabId(){return this.app===null?null:this.app.getTabId()}getUxId(){return this.app===null?null:this.app.getUxtId()}sessionID(){return It("'sessionID' method","'getSessionID' method","/"),this.getSessionID()}getSessionURL(e){if(this.app!==null)return this.app.getSessionURL(e)}setUserID(e){typeof e=="string"&&this.app!==null&&this.app.session.setUserID(e)}userID(e){It("'userID' method","'setUserID' method","/"),this.setUserID(e)}setUserAnonymousID(e){typeof e=="string"&&this.app!==null&&this.app.send(ou(e))}userAnonymousID(e){It("'userAnonymousID' method","'setUserAnonymousID' method","/"),this.setUserAnonymousID(e)}setMetadata(e,s){typeof e=="string"&&typeof s=="string"&&this.app!==null&&this.app.session.setMetadata(e,s)}metadata(e,s){It("'metadata' method","'setMetadata' method","/"),this.setMetadata(e,s)}event(e,s=null,n=!1){if(typeof e=="string"&&this.app!==null){if(n)return this.issue(e,s);try{s=JSON.stringify(s)}catch{return}this.app.send(iu(e,s))}}issue(e,s=null){if(typeof e=="string"&&this.app!==null){try{s=JSON.stringify(s)}catch{return}this.app.send(fu(e,s))}}}function Nf(t){return{id:String(t.ID),appellation:t.Appellation||null,country:t.Country||null,grape:t.Grape,image:t.Image,price:Number(t.Price),producer:t.Producer||null,region:t.Region,score:t.Score?Number(t.Score):null,shortDescription:t["Short Description"]||null,store:t.Store,storeId:t.Store_id||null,tags:Array.isArray(t.Tags)?t.Tags.map(String):[],title:t.Title,type:t.Type,url:t.Url||null,vintage:t.Vintage?Number(t.Vintage):null,pairingRecommendation:t.pairing_recommendation||null,total:t.Total?Number(t.Total):null,itemId:t.item_id||null,isPromote:t.is_promote?!!t.is_promote:null,stock:t.stock?Number(t.stock):null}}function Df(t){return{id:String(t.id),title:String(t.title),description:String(t.description),region:String(t.region),price:Number(t.price),grape:String(t.grape),appellation:t.appellation?String(t.appellation):null,url:t.url?String(t.url):null,store:String(t.store),storeId:t.storeId?String(t.storeId):null,image:String(t.image),country:t.country?String(t.country):null,vintage:t.vintage?Number(t.vintage):null,tags:Array.isArray(t.tags)?t.tags.map(String):[],score:t.score?Number(t.score):null,total:t.total?Number(t.total):null,isPromote:t.is_promote?!!t.is_promote:null,stock:t.stock?Number(t.stock):null,distance:Number(t.distance),reason:String(t.reason),type:String(t.type)}}class Rf{constructor(e){K(this,Is,"https://wineater-backend.vercel.app/");K(this,Qt);B(this,Qt,e)}async getInstantRecommendations(){try{const e=await fetch(`${b(this,Is)}dish/recommendations/instant`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${b(this,Qt)}`}}),s=await e.json();if(!e.ok)throw new Error(`API call failed with status ${e.status}: ${s.message||"No additional error information"}`);return s.map(Nf)}catch(e){throw new Error(`Error in getInstantRecommendations: ${e.message}`)}}async getWineRecommendationsSearch(e){try{const s=await fetch(`${b(this,Is)}dish/recommendations/search`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${b(this,Qt)}`},body:JSON.stringify({text:e})}),n=await s.json();if(!s.ok)throw new Error(`API call failed with status ${s.status}: ${n.message||"No additional error information"}`);return n.map(Df)}catch(s){throw new Error(`Error in getWineRecommendations: ${s.message}`)}}async getStoreConfig(){try{const e=await fetch(`${b(this,Is)}stores/store`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${b(this,Qt)}`}});if(!e.ok)throw new Error(`HTTP error! Status: ${e.status}`);return await e.json()}catch(e){throw console.error("Error fetching store configuration:",e),e}}}Is=new WeakMap,Qt=new WeakMap;const Of=((La=window==null?void 0:window.wineaterData)==null?void 0:La.CLIENT_TOKEN)||"HeUw6IXuhvz6tRuXdPEGEbj3SGQ3Q2YtEc1Z8jd41Kg9LtyPb4Epu0to31SYIadG",nr=new Rf(Of),it={WIDGET_INITIALIZED:"widget_initialized",WIDGET_LOADED:"widget_loaded",SEARCH_PERFORMED:"search_performed",SEARCH_RESULTS_DISPLAYED:"search_results_displayed",NO_RESULTS_FOUND:"no_results_found",WINE_CARD_HOVER:"wine_card_hover",WINE_CARD_CLICK:"wine_card_click",WINE_DETAILS_VIEWED:"wine_details_viewed",WINE_DETAILS_CLOSED:"wine_details_closed",BUY_BUTTON_CLICKED:"buy_button_clicked",FILTER_APPLIED:"filter_applied",LANGUAGE_CHANGED:"language_changed",ERROR_OCCURRED:"error_occurred",MOBILE_VIEW_ACTIVATED:"mobile_view_activated"},Mf={fr:{lang:"fr",welcomeMessage:"Quel plat allez-vous déguster ? Décrivez-le-moi et je vous proposerai le vin qui l'accompagnera parfaitement.",noResultsFound:"Aucun résultat trouvé.",somethingWentWrong:"Désolé, quelque chose a mal tourné.",chatButton1:"Trouvez l'accord parfait",chatButton2:"Associez le vin",chatButton3:"Obtenez des conseils",chatTitle:"Accord Mets & Vins 🍷",chatSubtitle:"Décrivez votre plat et obtenez une recommandation en 30 secondes",inputPlaceholder:"ex., Salade de thon",sendButton:"Accorder",poweredBy:"Propulsé par",price:"Prix",region:"Région",type:"Type",reason:"Suggestion",moreInfo:"Plus d'infos",winePairingIntro:"Pour ce vin, voici quelques suggestions de plats :",askForDinner:"Que voulez-vous manger ce soir?",clearChatButton:"Effacer le chat",widgetTitle:"TROUVEZ VOTRE VIN PARFAIT",widgetSubtitle:"Partagez tout ce que vous avez en tête—votre repas, humeur, budget ou occasion—et notre sommelier IA vous recommandera le vin parfait en quelques secondes",searchPlaceholder:"Entrez un mot-clé ou une description","wineDetails.reason":"Raison","wineDetails.price":"Prix","wineDetails.region":"Région","wineDetails.type":"Type","wineDetails.moreInfo":"Plus d'infos","wineDetails.code":"Code","wineDetails.buy":"Acheter",searchButton:"Rechercher",priceRange:"Gamme de prix",wineColor:"Couleur du vin",intensity:"Intensité",red:"Rouge",white:"Blanc",rose:"Rosé",light:"Léger",medium:"Moyen",full:"Puissant",barTitle:"Sélection du bar",barSubtitle:"Choisissez vos plats ci-dessous et cliquez sur «Envoyer»",barSendButton:"Envoyer",barResetButton:"Réinitialiser",barName:"Nom du bar",barNotesPlaceholder:"Entrez vos souhaits ici...",placeholderSuggestions:["Vin pour les pâtes","Parfait avec du poisson","Recommandé pour une soirée"],headerLine1:"Partagez tout ce qui vous passe par la tête —",headerLine2:"— et obtenez des recommandations de vin parfait en quelques secondes",headerMeal:"repas",headerMood:"humeur",headerBudget:"budget",headerOccasion:"occasion",headerOr:"ou",errorMessage:"Une erreur est survenue. Veuillez réessayer plus tard.",noResultsMessage:"Aucun résultat trouvé pour votre recherche. Veuillez essayer une autre requête.",ai_sommelier:"AI sommelier"},es:{lang:"es",welcomeMessage:"¿Qué vas a comer? Cuéntame tu plato y te recomendaré el maridaje perfecto.",noResultsFound:"No se encontraron resultados.",somethingWentWrong:"Lo sentimos, algo salió mal.",chatButton1:"Encuentra tu maridaje",chatButton2:"Combina vino ya",chatButton3:"Recibe asesoría ahora",chatTitle:"Maridaje de Vinos 🍷",chatSubtitle:"Describe tu comida y obtén una recomendación en 30 segundos",inputPlaceholder:"ej., Ensalada de atún",sendButton:"Combinar",poweredBy:"Desarrollado por",price:"Precio",region:"Región",type:"Tipo",reason:"Sugerencia",moreInfo:"Más info",winePairingIntro:"Para este vino, aquí tienes algunas sugerencias de platos:",askForDinner:"¿Qué te gustaría cenar?",clearChatButton:"Limpiar el chat",widgetTitle:"ENCUENTRA TU VINO PERFECTO",widgetSubtitle:"Comparte cualquier cosa que tengas en mente—tu comida, estado de ánimo, presupuesto o evento—y nuestro sommelier de IA te recomendará el vino perfecto en segundos",searchPlaceholder:"Escribe una palabra clave o descripción","wineDetails.reason":"Razón","wineDetails.price":"Precio","wineDetails.region":"Región","wineDetails.type":"Tipo","wineDetails.code":"Código","wineDetails.moreInfo":"Más información","wineDetails.buy":"Comprar",searchButton:"Buscar",priceRange:"Rango de precios",wineColor:"Color del vino",intensity:"Intensidad",red:"Tinto",white:"Blanco",rose:"Rosado",light:"Ligero",medium:"Medio",full:"Intenso",barTitle:"Platos de Bar",barSubtitle:"Selecciona de la lista y presiona «Enviar»",barSendButton:"Enviar",barResetButton:"Reiniciar",barName:"Nombre del bar",barNotesPlaceholder:"Agrega tus comentarios aquí...",placeholderSuggestions:["Vino para pasta","Perfecto con pescado","Recomendado para una fiesta"],headerLine1:"Comparte cualquier cosa que tengas en mente —",headerLine2:"— y obtén recomendaciones del vino perfecto en cuestión de segundos",headerMeal:"comida",headerMood:"estado de ánimo",headerBudget:"presupuesto",headerOccasion:"ocasión",headerOr:"o",errorMessage:"Algo salió mal. Por favor, inténtalo de nuevo más tarde.",noResultsMessage:"No se encontraron resultados para tu búsqueda. Por favor, intenta con otra consulta.",ai_sommelier:"AI sommelier"},en:{lang:"en",welcomeMessage:"What are you planning to eat? Share your dish and I'll recommend the perfect wine pairing for your meal.",noResultsFound:"No results found.",somethingWentWrong:"Sorry, something went wrong.",chatButton1:"Find Your Pairing",chatButton2:"Pair Wine Now",chatButton3:"Get Wine Advice",chatTitle:"Wine Pairing Assistant 🍷",chatSubtitle:"Describe your meal and get a recommendation in 30 seconds",inputPlaceholder:"e.g., Tuna salad",sendButton:"Match",poweredBy:"Powered by",price:"Price",region:"Region",type:"Type",reason:"Suggestion",moreInfo:"More info",winePairingIntro:"For this wine, here are some suggested dishes:",askForDinner:"What would you like to have for dinner?",clearChatButton:"Clear Chat",widgetTitle:"FIND YOUR PERFECT WINE",widgetSubtitle:"Share anything on your mind—your meal, mood, budget, or occasion—and our AI sommelier will recommend the perfect wine in seconds",searchPlaceholder:"Enter a keyword or description","wineDetails.price":"Price","wineDetails.region":"Region","wineDetails.type":"Type","wineDetails.moreInfo":"More info","wineDetails.reason":"Reason","wineDetails.code":"Code","wineDetails.buy":"Buy",searchButton:"Search",priceRange:"Price Range",wineColor:"Wine Color",intensity:"Intensity",red:"Red",white:"White",rose:"Rosé",light:"Light",medium:"Medium",full:"Full",barTitle:"Bar Dishes",barSubtitle:"Select dishes below and click 'Send'",barSendButton:"Send",barResetButton:"Reset",barName:"Bar Name",barNotesPlaceholder:"Add your wishes here...",placeholderSuggestions:["Wine for pasta","Perfect with fish","Recommended for a party"],headerLine1:"Share anything on your mind —",headerLine2:"— and get recommendations of the perfect wine in seconds",headerMeal:"meal",headerMood:"mood",headerBudget:"budget",headerOccasion:"occasion",headerOr:"or",errorMessage:"Something went wrong. Please try again later.",noResultsMessage:"No results found for your search. Please try a different query.",ai_sommelier:"AI sommelier"},sr:{lang:"sr",welcomeMessage:"Šta planirate da jedete? Podelite svoje jelo i preporučiću vam savršeno vino uz obrok.",noResultsFound:"Nema rezultata.",somethingWentWrong:"Izvinite, nešto je pošlo po zlu.",chatButton1:"Pronađi vino",chatButton2:"Upari vino sada",chatButton3:"Zatraži preporuku",chatTitle:"Asistent za uparivanje vina 🍷",chatSubtitle:"Opišite svoj obrok i dobijte preporuku za 30 sekundi",inputPlaceholder:"npr. Tuna salata",sendButton:"Upari",poweredBy:"Pokreće",price:"Cena",region:"Regija",type:"Tip",reason:"Preporuka",moreInfo:"Više informacija",winePairingIntro:"Za ovo vino, preporučuju se sledeća jela:",askForDinner:"Šta biste želeli za večeru?",clearChatButton:"Obriši razgovor",widgetTitle:"PRONAĐITE SAVRŠENO VINO",widgetSubtitle:"Podelite bilo šta — obrok, raspoloženje, budžet ili priliku — i naš AI somelijer će vam za par sekundi preporučiti vino",searchPlaceholder:"Unesite ključnu reč ili opis","wineDetails.price":"Cena","wineDetails.region":"Regija","wineDetails.type":"Tip","wineDetails.moreInfo":"Više informacija","wineDetails.reason":"Razlog","wineDetails.code":"Šifra","wineDetails.buy":"Kupi",searchButton:"Pretraga",priceRange:"Cenovni raspon",wineColor:"Boja vina",intensity:"Intenzitet",red:"Crveno",white:"Belo",rose:"Roze",light:"Lako",medium:"Srednje",full:"Puno",barTitle:"Jela iz bara",barSubtitle:"Izaberite jela ispod i kliknite 'Pošalji'",barSendButton:"Pošalji",barResetButton:"Resetuj",barName:"Naziv bara",barNotesPlaceholder:"Dodajte svoje želje ovde...",placeholderSuggestions:["Vino uz pastu","Savršeno uz ribu","Preporuka za žurku"],headerLine1:"Podelite bilo šta što vam je na umu —",headerLine2:"— i dobijte preporuke za savršeno vino za par sekundi",headerMeal:"obrok",headerMood:"raspoloženje",headerBudget:"budžet",headerOccasion:"prilika",headerOr:"ili",errorMessage:"Nešto je pošlo po zlu. Molimo pokušajte ponovo kasnije.",noResultsMessage:"Nema rezultata za vašu pretragu. Molimo pokušajte sa drugačijim upitom.",ai_sommelier:"AI sommelier"},de:{lang:"de",welcomeMessage:"Was möchten Sie essen? Beschreiben Sie Ihr Gericht und ich empfehle Ihnen den perfekten Wein dazu.",noResultsFound:"Keine Ergebnisse gefunden.",somethingWentWrong:"Entschuldigung, etwas ist schief gelaufen.",chatButton1:"Finde Dein Pairing",chatButton2:"Wein jetzt wählen",chatButton3:"Erhalte Weinberatung",chatTitle:"Wein & Speisen 🍷",chatSubtitle:"Beschreiben Sie Ihr Gericht und erhalten Sie in 30 Sekunden eine Empfehlung",inputPlaceholder:"z.B., Thunfischsalat",sendButton:"Kombinieren",poweredBy:"Unterstützt von",price:"Preis",region:"Region",type:"Typ",reason:"Anregung",moreInfo:"Mehr Info",winePairingIntro:"Für diesen Wein gibt es folgende Essensvorschläge:",askForDinner:"Was möchten Sie zum Abendessen essen?",clearChatButton:"Chat löschen",widgetTitle:"FINDEN SIE IHREN PERFEKTEN WEIN",widgetSubtitle:"Teilen Sie alles, was Ihnen in den Sinn kommt—Ihre Mahlzeit, Stimmung, Ihr Budget oder Anlass—und unser KI-Sommelier empfiehlt Ihnen in Sekunden den perfekten Wein",placeholderSuggestions:["Wein für Pasta","Perfekt zu Fisch","Empfohlen für eine Party"],searchPlaceholder:"Geben Sie ein Stichwort oder eine Beschreibung ein","wineDetails.price":"Preis","wineDetails.region":"Region","wineDetails.type":"Typ","wineDetails.moreInfo":"Mehr Info","wineDetails.reason":"Grund","wineDetails.code":"Code","wineDetails.buy":"Kaufen",searchButton:"Suche",priceRange:"Preisspanne",wineColor:"Weinfarbe",intensity:"Intensität",red:"Rot",white:"Weiß",rose:"Rosé",light:"Leicht",medium:"Mittel",full:"Voll",barTitle:"Bar-Auswahl",barSubtitle:"Wählen Sie Ihre Gerichte und klicken Sie auf 'Senden'",barSendButton:"Senden",barResetButton:"Zurücksetzen",barName:"Name der Bar",headerLine1:"Teilen Sie alles, was Ihnen durch den Kopf geht —",headerLine2:"— und erhalten Sie in Sekundenschnelle Empfehlungen für den perfekten Wein",headerMeal:"Mahlzeit",headerMood:"Stimmung",headerBudget:"Budget",headerOccasion:"Anlass",headerOr:"oder",errorMessage:"Etwas ist schief gelaufen. Bitte versuchen Sie es später erneut.",noResultsMessage:"Keine Ergebnisse für Ihre Suche gefunden. Bitte versuchen Sie es mit einer anderen Anfrage.",ai_sommelier:"AI sommelier"},ukr:{lang:"ukr",welcomeMessage:"Що ви збираєтесь їсти? Опишіть свою страву, і я порекомендую вам ідеальне вино.",noResultsFound:"Результатів не знайдено.",somethingWentWrong:"Вибачте, щось пішло не так.",chatButton1:"Знайти ідеальне поєднання",chatButton2:"Підібрати вино",chatButton3:"Отримати пораду",chatTitle:"Сомельє-помічник 🍷",chatSubtitle:"Опишіть свою страву і отримайте рекомендацію за 30 секунд",inputPlaceholder:"наприклад, Тунець із салатом",sendButton:"Підібрати",poweredBy:"Розроблено на основі",price:"Ціна",region:"Регіон",type:"Тип",reason:"Рекомендація",moreInfo:"Докладніше",winePairingIntro:"До цього вина підходять такі страви:",askForDinner:"Що ви хочете на вечерю?",clearChatButton:"Очистити чат",widgetTitle:"ЗНАЙДІТЬ ІДЕАЛЬНЕ ВИНО",widgetSubtitle:"Поділіться тим, що у вас на думці—їжа, настрій, бюджет чи подія—і наш AI-сомельє порекомендує вам ідеальне вино за секунди",searchPlaceholder:"Введіть ключове слово або опис","wineDetails.reason":"Причина","wineDetails.price":"Ціна","wineDetails.region":"Регіон","wineDetails.type":"Тип","wineDetails.moreInfo":"Докладніше","wineDetails.code":"Код","wineDetails.buy":"Купити",searchButton:"Пошук",priceRange:"Діапазон цін",wineColor:"Колір вина",intensity:"Інтенсивність",red:"Червоне",white:"Біле",rose:"Рожеве",light:"Легке",medium:"Середнє",full:"Повне",barTitle:"Закуски до вина",barSubtitle:"Виберіть страви нижче та натисніть «Надіслати»",barSendButton:"Надіслати",barResetButton:"Скинути",barName:"Назва бару",barNotesPlaceholder:"Додайте ваші побажання тут...",placeholderSuggestions:["Вино до пасти","Ідеально до риби","Рекомендуємо для вечірки"],headerLine1:"Поділіться будь-якими вашими думками —",headerLine2:"— і отримайте рекомендації щодо ідеального вина за секунди",headerMeal:"страва",headerMood:"настрій",headerBudget:"бюджет",headerOccasion:"подія",headerOr:"або",errorMessage:"Щось пішло не так. Будь ласка, спробуйте пізніше.",noResultsMessage:"За вашим запитом не знайдено результатів. Спробуйте інший запит.",ai_sommelier:"AI sommelier"},ru:{lang:"ru",welcomeMessage:"Что вы планируете поесть? Напишите ваше блюдо, и я подберу идеальное вино к нему.",noResultsFound:"Результаты не найдены.",somethingWentWrong:"Извините, что-то пошло не так.",chatButton1:"Найти сочетание",chatButton2:"Подобрать вино",chatButton3:"Получить совет",chatTitle:"Ассистент по подбору вина 🍷",chatSubtitle:"Опишите ваше блюдо и получите рекомендацию за 30 секунд",inputPlaceholder:"например, Тунец с салатом",sendButton:"Подобрать",poweredBy:"Powered by",price:"Цена",region:"Регион",type:"Тип",reason:"Рекомендация",moreInfo:"Подробнее",winePairingIntro:"К этому вину подходят следующие блюда:",askForDinner:"Что бы вы хотели на ужин?",clearChatButton:"Очистить чат",widgetTitle:"НАЙДИТЬ ИДЕАЛЬНОЕ ВИНО",widgetSubtitle:"Поделитесь вашими предпочтениями — блюдом, настроением, бюджетом или случаем — и наш AI-сомелье подберёт идеальное вино за секунды",searchPlaceholder:"Введите ключевое слово или описание","wineDetails.price":"Цена","wineDetails.region":"Регион","wineDetails.type":"Тип","wineDetails.moreInfo":"Подробнее","wineDetails.reason":"Причина","wineDetails.code":"Код","wineDetails.buy":"Купить",searchButton:"Поиск",priceRange:"Диапазон цен",wineColor:"Цвет вина",intensity:"Интенсивность",red:"Красное",white:"Белое",rose:"Розовое",light:"Лёгкое",medium:"Среднее",full:"Полное",barTitle:"Закуски к вину",barSubtitle:"Выберите блюда ниже и нажмите 'Отправить'",barSendButton:"Отправить",barResetButton:"Сбросить",barName:"Название бара",barNotesPlaceholder:"Добавьте ваши пожелания здесь...",placeholderSuggestions:["Вино для пасты","Идеально к рыбе","Рекомендуем для вечеринки"],headerLine1:"Поделитесь любыми вашими мыслями —",headerLine2:"— и получите рекомендации по идеальному вину за считанные секунды",headerMeal:"блюдо",headerMood:"настроение",headerBudget:"бюджет",headerOccasion:"случай",headerOr:"или",errorMessage:"Что-то пошло не так. Пожалуйста, попробуйте позже.",noResultsMessage:"По вашему запросу не найдено результатов. Попробуйте другой запрос.",ai_sommelier:"AI sommelier"},kk:{lang:"kk",welcomeMessage:"Сіз не жегіңіз келеді? Тағамыңызды сипаттаңыз, мен оған керемет шарап ұсынамын.",noResultsFound:"Нәтижелер табылмады.",somethingWentWrong:"Кешіріңіз, бірдеңе дұрыс болмады.",chatButton1:"Сәйкестік табу",chatButton2:"Шарап таңдау",chatButton3:"Кеңес алу",chatTitle:"Шарап таңдаушы көмекші 🍷",chatSubtitle:"Тағамыңызды сипаттаңыз — 30 секундта ұсыныс алыңыз",inputPlaceholder:"мысалы, тунец салатымен",sendButton:"Таңдау",poweredBy:"Powered by",price:"Бағасы",region:"Өңір",type:"Түрі",reason:"Ұсыныс",moreInfo:"Толығырақ",winePairingIntro:"Бұл шарапқа келесі тағамдар сәйкес келеді:",askForDinner:"Кешкі асқа не қалайсыз?",clearChatButton:"Чатты тазалау",widgetTitle:"КЕРЕМЕТ ШАРАПТЫ ТАБЫҢЫЗ",widgetSubtitle:"Таңдауларыңызды бөлісіңіз — тағам, көңіл-күй, бюджет немесе жағдай — және біздің AI-сомелье сізге бірнеше секундта шарап ұсынады",searchPlaceholder:"Кілт сөзді немесе сипаттаманы енгізіңіз","wineDetails.price":"Бағасы","wineDetails.region":"Өңір","wineDetails.type":"Түрі","wineDetails.moreInfo":"Толығырақ","wineDetails.reason":"Себебі","wineDetails.code":"Код","wineDetails.buy":"Сатып алу",searchButton:"Іздеу",priceRange:"Баға диапазоны",wineColor:"Шарап түсі",intensity:"Қанықтылық",red:"Қызыл",white:"Ақ",rose:"Розалық",light:"Жеңіл",medium:"Орташа",full:"Толық",barTitle:"Шарапқа арналған тіскебасарлар",barSubtitle:"Төмендегі тағамдарды таңдаңыз және 'Жіберу' батырмасын басыңыз",barSendButton:"Жіберу",barResetButton:"Қалпына келтіру",barName:"Бар атауы",barNotesPlaceholder:"Мұнда өз тілектеріңізді жазыңыз...",placeholderSuggestions:["Пастаға арналған шарап","Балыққа тамаша үйлеседі","Кешке ұсынуға болады"],headerLine1:"Ойларыңызбен бөлісіңіз —",headerLine2:"— және бірнеше секундта мінсіз шарап ұсынысын алыңыз",headerMeal:"тағам",headerMood:"көңіл-күй",headerBudget:"бюджет",headerOccasion:"жағдай",headerOr:"немесе",errorMessage:"Бірдеңе дұрыс болмады. Кейінірек қайта көріңіз.",noResultsMessage:"Іздеуіңізге сәйкес нәтиже табылмады. Басқа сұрау қолданып көріңіз.",ai_sommelier:"AI sommelier"}},Af={en:"en-US",de:"de-DE",fr:"fr-FR",es:"es-ES",it:"it-IT",ja:"ja-JP",zh:"zh-CN",ru:"ru-RU",kk:"kk-KZ",pt:"pt-PT"};function Pf(t,e,s="en"){try{return new Intl.NumberFormat(Af[s]||"en-US",{style:"currency",currency:e,currencyDisplay:"narrowSymbol"}).format(t)}catch{return t.toString()}}function _e({key:t,lang:e}){const s=Mf;if(s[e]&&s[e][t])return s[e][t];throw new Error(`Translation for key "${t}" not found in language "${e}".`)}async function Lf({sourceLang:t,targetLang:e,texts:s,apiKey:n}){var u,l,h,f;if(!n||!t||!e||t===e)return s;const i="https://api.openai.com/v1/chat/completions",r={"Content-Type":"application/json",Authorization:`Bearer ${n}`},o=Object.entries(s).map(([d,p])=>({key:d,text:p})),a=`
|
|
15
|
+
`).length?Ih(t):t.stack?Nh(t):Ch(t)}function Ih(t,e){const s=/Line (\d+).*script (?:in )?(\S+)/i,n=t.message.split(`
|
|
16
|
+
`),i=[];for(let r=2,o=n.length;r<o;r+=2){const a=s.exec(n[r]);a&&i.push({file:a[2],line:+a[1],raw:n[r]})}return Vs(i)}function Ch(t,e){const s=/Line (\d+).*script (?:in )?(\S+)(?:: In function (\S+))?$/i,n=t.stacktrace.split(`
|
|
17
|
+
`),i=[];for(let r=0,o=n.length;r<o;r+=2){const a=s.exec(n[r]);a&&i.push({function:a[3]||void 0,file:a[2],line:a[1]?+a[1]:void 0,raw:n[r]})}return Vs(i)}function Nh(t,e){return Vs(t.stack.split(`
|
|
18
|
+
`).filter(n=>!!n.match(yh)&&!n.match(/^Error created at/))).map(n=>{const i=n.split("@"),r=Xi(i.pop()),o=i.shift()||"",a=o.replace(/<anonymous function(: (\w+))?>/,"$2").replace(/\([^)]*\)/g,"")||void 0;let c;o.match(/\(([^)]*)\)/)&&(c=o.replace(/^[^(]+\(([^)]*)\)$/,"$1"));const u=c===void 0||c==="[arguments not available]"?void 0:c.split(",");return{function:a,args:u,file:r[0],line:r[1]?+r[1]:void 0,col:r[2]?+r[2]:void 0,raw:n}})}function Dh(t){return t.map(e=>({functionName:e.function,args:e.args,fileName:e.file,lineNumber:e.line,columnNumber:e.col,source:e.raw}))}function Rh(t,e){return Dh(Sh(t))}function ba(t){return[{columnNumber:t.colno,lineNumber:t.lineno,fileName:t.filename,functionName:"",source:""}]}function On(t,e,s={}){let n=e;try{n=Rh(t)}catch{}return Ai(t.name,t.message,JSON.stringify(n),JSON.stringify(s))}function ya(t,e=window,s={}){if(t instanceof ErrorEvent){if(t.error instanceof Error)return On(t.error,ba(t),s);{let[n,i]=t.message.split(":");return i||(n="Error",i=t.message),Ai(n,i,JSON.stringify(ba(t)),JSON.stringify(s))}}else if("PromiseRejectionEvent"in e&&t instanceof e.PromiseRejectionEvent){if(t.reason instanceof Error)return On(t.reason,[],s);{let n;try{n=JSON.stringify(t.reason)}catch{n=String(t.reason)}return Ai("Unhandled Promise Rejection",n,"[]",JSON.stringify(s))}}return null}function Oh(t,e){const s=Object.assign({captureExceptions:!0},e);function n(i){function r(o){const a=ya(o,i);a!=null&&t.send(a)}try{t.attachEventListener(i,"unhandledrejection",r),t.attachEventListener(i,"error",r)}catch(o){console.error("Error while attaching to error proto contexts",o)}}s.captureExceptions&&(t.observer.attachContextCallback(n),n(window))}function wa(t,e=document.location){return t=t.trim(),t.startsWith("//")||t.startsWith("http://")||t.startsWith("https://")||t.startsWith("data:")?t:t.startsWith("/")?e.origin+t:e.origin+e.pathname+t}function Mh(t){return Bc&&(t.startsWith("data:image/svg+xml")||t.match(/.svg$|/i))}const Ah="https://static.openreplay.com/tracker/placeholder.jpeg";function Ph(t){function e(a,c){t.attributeSender.sendSetAttribute(a,"src",Ah);const{width:u,height:l}=c.getBoundingClientRect();c.hasAttribute("width")||t.attributeSender.sendSetAttribute(a,"width",String(u)),c.hasAttribute("height")||t.attributeSender.sendSetAttribute(a,"height",String(l))}const s=function(a,c){const{srcset:u}=c;if(!u)return;const l=u.split(u.match(/,\s+/)?/,\s+/:",").map(h=>wa(h)).join(", ");t.attributeSender.sendSetAttribute(a,"srcset",l)},n=function(a,c){c.src.length>Fc&&e(a,c),t.send(Ri(a,"src",c.src,t.getBaseHref()))},i=t.safe(function(a){const c=wa(a.src||"");Mo(c)&&t.send(Qo(t.timestamp(),0,0,0,0,0,c,"img",0,!1))}),r=t.safe(function(a){const c=t.nodes.getID(a);c!==void 0&&a.complete&&(a.naturalHeight===0&&a.naturalWidth===0&&!Mh(a.src)?i(a):t.sanitizer.isHidden(c)||t.sanitizer.isObscured(c)?e(c,a):(n(c,a),s(c,a)))}),o=Fo(t.safe(a=>{for(const c of a)if(c.type==="attributes"){const u=c.target,l=t.nodes.getID(u);if(l===void 0)return;c.attributeName==="src"&&n(l,u),c.attributeName==="srcset"&&s(l,u)}}),t.options.forceNgOff);t.attachStopCallback(()=>{o.disconnect()}),t.nodes.attachNodeCallback(a=>{he(a,"img")&&(t.nodes.attachNodeListener(a,"error",()=>i(a)),t.nodes.attachNodeListener(a,"load",()=>r(a)),r(a),o.observe(a,{attributes:!0,attributeFilter:["src","srcset"]}))})}const Lh=["text","password","email","search","number","range","date","tel","time"];function Bh(t){return he(t,"textarea")?!0:he(t,"input")?Lh.includes(t.type):!1}function Fh(t){if(!he(t,"input"))return!1;const e=t.type;return e==="checkbox"||e==="radio"}const zh=tt&&"labels"in HTMLInputElement.prototype?t=>{let e=t;for(;(e=e.parentNode)!==null;)if(he(e,"label"))return e;const s=t.labels;if(s!==null&&s.length===1)return s[0]}:t=>{let e=t;for(;(e=e.parentNode)!==null;)if(he(e,"label"))return e;const s=t.id;if(s){const n=t.ownerDocument.querySelectorAll('label[for="'+s+'"]');if(n!==null&&n.length===1)return n[0]}};function Sa(t){let e=Ni(t);if(e===null){const s=zh(t);e=s&&s.innerText||t.placeholder||t.name||t.id||t.className||t.type}return Oo(e).slice(0,100)}const Ss={Plain:0,Obscured:1,Hidden:2};function jh(t,e){const s=Object.assign({obscureInputNumbers:!0,obscureInputEmails:!0,defaultInputMode:Ss.Obscured,obscureInputDates:!1},e);function n(l,h){let d=h.value,f=s.defaultInputMode;h.type==="password"||t.sanitizer.isHidden(l)?f=Ss.Hidden:(t.sanitizer.isObscured(l)||f===Ss.Plain&&(s.obscureInputNumbers&&h.type!=="date"&&/\d\d\d\d/.test(d)||s.obscureInputDates&&h.type==="date"||s.obscureInputEmails&&(h.type==="email"||~d.indexOf("@"))))&&(f=Ss.Obscured);let p=0;switch(f){case Ss.Hidden:p=-1,d="";break;case Ss.Obscured:p=d.length,d="";break}return{value:d,mask:p}}function i(l,h){const{value:d,mask:f}=n(l,h);t.send($c(l,d,f))}const r=new Map,o=new Map;t.attachStopCallback(()=>{r.clear(),o.clear()});function a(l,h){r.get(l)!==h.value&&(r.set(l,h.value),i(l,h))}function c(l,h){o.get(l)!==h&&(o.set(l,h),t.send(eu(l,h)))}t.ticker.attach(()=>{r.forEach((l,h)=>{const d=t.nodes.getNode(h);if(!d)return r.delete(h);a(h,d)}),o.forEach((l,h)=>{const d=t.nodes.getNode(h);if(!d)return o.delete(h);c(h,d.checked)})},3);function u(l,h,d,f){const{value:p,mask:m}=n(l,h),_=Sa(h);t.send(vu(l,p,m!==0,_,d,f))}t.nodes.attachNodeCallback(t.safe(l=>{const h=t.nodes.getID(l);if(h!==void 0){if(he(l,"select")&&(i(h,l),t.nodes.attachNodeListener(l,"change",()=>i(h,l))),Bh(l)){a(h,l);let d=0,f=0,p=0;const m=()=>{d=Ke()},_=()=>{f===0&&d!==0&&(f=Ke()-d)},I=()=>{d!==0&&(p=Ke()-d),u(h,l,f,p),f=0,p=0,d=0};t.nodes.attachNodeListener(l,"focus",m),t.nodes.attachNodeListener(l,"input",_),t.nodes.attachNodeListener(l,"change",I);return}if(Fh(l)){c(h,l.checked),t.nodes.attachNodeListener(l,"change",()=>c(h,l.checked));return}}}))}let ze,Yi,_a;function Uh(t,e){if(_a=new Date,t.nodeType!==Node.ELEMENT_NODE)throw new Error("Can't generate CSS selector for non-element node type.");if(t.tagName.toLowerCase()==="html")return"html";const s={root:document.body,idName:i=>!0,className:i=>!0,tagName:i=>!0,attr:(i,r)=>!1,seedMinLength:1,optimizedMinLength:2,threshold:1e3,maxNumberOfTries:1e4,timeoutMs:void 0};ze={...s,...e},Yi=qh(ze.root,s);let n=Mn(t,"all",()=>Mn(t,"two",()=>Mn(t,"one",()=>Mn(t,"none"))));if(n){const i=Ca(Na(n,t));return i.length>0&&(n=i[0]),An(n)}else throw new Error("Selector was not found.")}function qh(t,e){return t.nodeType===Node.DOCUMENT_NODE?t:t===e.root?t.ownerDocument:t}function Mn(t,e,s){let n=null,i=[],r=t,o=0;for(;r;){const a=new Date().getTime()-_a.getTime();if(ze.timeoutMs!==void 0&&a>ze.timeoutMs)throw new Error(`Timeout: Can't find a unique selector after ${a}ms`);let c=Ln(Wh(r))||Ln(...Hh(r))||Ln(...Vh(r))||Ln(Gh(r))||[Ea()];const u=Kh(r);if(e=="all")u&&(c=c.concat(c.filter(Ji).map(l=>Pn(l,u))));else if(e=="two")c=c.slice(0,1),u&&(c=c.concat(c.filter(Ji).map(l=>Pn(l,u))));else if(e=="one"){const[l]=c=c.slice(0,1);u&&Ji(l)&&(c=[Pn(l,u)])}else e=="none"&&(c=[Ea()],u&&(c=[Pn(c[0],u)]));for(let l of c)l.level=o;if(i.push(c),i.length>=ze.seedMinLength&&(n=ka(i,s),n))break;r=r.parentElement,o++}return n||(n=ka(i,s)),!n&&s?s():n}function ka(t,e){const s=Ca(Ia(t));if(s.length>ze.threshold)return e?e():null;for(let n of s)if(xa(n))return n;return null}function An(t){let e=t[0],s=e.name;for(let n=1;n<t.length;n++){const i=t[n].level||0;e.level===i-1?s=`${t[n].name} > ${s}`:s=`${t[n].name} ${s}`,e=t[n]}return s}function Ta(t){return t.map(e=>e.penalty).reduce((e,s)=>e+s,0)}function xa(t){const e=An(t);switch(Yi.querySelectorAll(e).length){case 0:throw new Error(`Can't select any node with this selector: ${e}`);case 1:return!0;default:return!1}}function Wh(t){const e=t.getAttribute("id");return e&&ze.idName(e)?{name:"#"+CSS.escape(e),penalty:0}:null}function Hh(t){return Array.from(t.attributes).filter(s=>ze.attr(s.name,s.value)).map(s=>({name:`[${CSS.escape(s.name)}="${CSS.escape(s.value)}"]`,penalty:.5}))}function Vh(t){return Array.from(t.classList).filter(ze.className).map(s=>({name:"."+CSS.escape(s),penalty:1}))}function Gh(t){const e=t.tagName.toLowerCase();return ze.tagName(e)?{name:e,penalty:2}:null}function Ea(){return{name:"*",penalty:3}}function Kh(t){const e=t.parentNode;if(!e)return null;let s=e.firstChild;if(!s)return null;let n=0;for(;s&&(s.nodeType===Node.ELEMENT_NODE&&n++,s!==t);)s=s.nextSibling;return n}function Pn(t,e){return{name:t.name+`:nth-child(${e})`,penalty:t.penalty+1}}function Ji(t){return t.name!=="html"&&!t.name.startsWith("#")}function Ln(...t){const e=t.filter(Xh);return e.length>0?e:null}function Xh(t){return t!=null}function*Ia(t,e=[]){if(t.length>0)for(let s of t[0])yield*Ia(t.slice(1,t.length),e.concat(s));else yield e}function Ca(t){return[...t].sort((e,s)=>Ta(e)-Ta(s))}function*Na(t,e,s={counter:0,visited:new Map}){if(t.length>2&&t.length>ze.optimizedMinLength)for(let n=1;n<t.length-1;n++){if(s.counter>ze.maxNumberOfTries)return;s.counter+=1;const i=[...t];i.splice(n,1);const r=An(i);if(s.visited.has(r))return;xa(i)&&Yh(i,e)&&(yield i,s.visited.set(r,!0),yield*Na(i,e,s))}}function Yh(t,e){return Yi.querySelector(An(t))===e}function Jh(t,e,s){return Uh(t,{root:e.body,seedMinLength:3,optimizedMinLength:(s==null?void 0:s.minSelectorDepth)||2,threshold:(s==null?void 0:s.nthThreshold)||1e3,maxNumberOfTries:(s==null?void 0:s.maxOptimiseTries)||1e4})}function Qi(t){const e=t.tagName.toUpperCase();return e==="BUTTON"||e==="A"||e==="LI"||e==="SELECT"||e==="TR"||e==="TH"||t.onclick!=null||t.getAttribute("role")==="button"}function Da(t,e){return t instanceof Element?Qh(t,e):null}function Qh(t,e){let s=t;for(;s!==null&&s!==e.documentElement;){if(Vt(s,"masked"))return null;s=s.parentElement}if(ji(t)){let n=t.ownerSVGElement;for(;n!==null;)t=n,n=n.ownerSVGElement}for(s=t;s!==null&&s!==e.documentElement;){const n=s.tagName.toUpperCase();if(n==="LABEL")return null;if(n==="INPUT"||Qi(s)||Ni(s)!==null)return s;s=s.parentElement}return t===e.documentElement?null:t}function Zh(t,e){const{disableClickmaps:s=!1}=e||{};function n(g){const v=Ni(g);if(v!==null)return v;if(he(g,"input"))return Sa(g);if(Qi(g)){let E="";return g instanceof HTMLElement&&(E=t.sanitizer.getInnerTextSecure(g)),E=E||g.id||g.className,Oo(E).slice(0,100)}return""}let i=-1,r=-1,o=!1,a=null,c=0,u={},l=0,h=0,d=0,f=0,p;const m=.008,_=225;function I(){const g=f/_;if(!l){l=g;return}const v=(g-l)/_;d>4&&v>m&&t.send(bu(Ke())),f=0,d=0,l=g}t.attachStartCallback(()=>{p=setInterval(()=>I(),_)}),t.attachStopCallback(()=>{i=-1,r=-1,o=!1,a=null,u={},p&&clearInterval(p)});const T=()=>{o&&(t.send(tu(i,r)),o=!1)},y=(g,v=!1)=>{function E(S,k,A){return u[S]=u[S]||Jh(k,g,A)}const C=v?t.attachEventListener.bind(t):t.nodes.attachNodeListener.bind(t.nodes);C(g.documentElement,"mouseover",S=>{const k=Da(S.target,g);k!==a&&(a=k,c=performance.now())}),C(g,"mousemove",S=>{const[k,A]=t.observer.getDocumentOffset(g);i=S.clientX+k,r=S.clientY+A,o=!0;const z=Math.sign(S.movementX);f+=Math.abs(S.movementX)+Math.abs(S.movementY),z!==h&&(h=z,d++)},!1),C(g,"click",S=>{const k=Da(S.target,g);if(!S.clientX&&!S.clientY||k===null)return;const A=t.nodes.getID(k);if(A!==void 0){const z=S.pageX,F=S.pageY,G=g.documentElement.scrollWidth,j=g.documentElement.scrollHeight,x=Ra(z/G),D=Ra(F/j);T(),t.send(pu(A,a===k?Math.round(performance.now()-c):0,n(k),Qi(k)&&!s?E(A,k,e):"",x,D),!0)}a=null})};t.nodes.attachNodeCallback(g=>{Cn(g)&&y(g)}),y(document,!0),t.ticker.attach(T,(e==null?void 0:e.trackingOffset)||7)}function Ra(t){return Math.round(t*1e4)}function $h(t){const e=[],s=document.getElementsByTagName("*"),n=/url\(("[^"]*"|'[^']*'|[^)]*)\)/i;for(let i=0;i<s.length;i++){const r=s[i];let o="";if(he(r,"img")&&(o=r.currentSrc||r.src),!o){const p=getComputedStyle(r).getPropertyValue("background-image");if(p){const m=n.exec(p);m!==null&&(o=m[1],(o.startsWith('"')||o.startsWith("'"))&&(o=o.substr(1,o.length-2)))}}if(!o)continue;const a=o.substr(0,10)==="data:image"?0:t[o];if(a===void 0)continue;const c=r.getBoundingClientRect(),u=Math.max(c.top,0),l=Math.max(c.left,0),h=Math.min(c.bottom,window.innerHeight||document.documentElement&&document.documentElement.clientHeight||0),d=Math.min(c.right,window.innerWidth||document.documentElement&&document.documentElement.clientWidth||0);if(h<=u||d<=l)continue;const f=(h-u)*(d-l);e.push({time:a,area:f})}return e}function ed(t,e){let s=Math.max(document.documentElement&&document.documentElement.clientWidth||0,window.innerWidth||0)*Math.max(document.documentElement&&document.documentElement.clientHeight||0,window.innerHeight||0)/10,n=s*t;for(let i=0;i<e.length;i++){const{time:r,area:o}=e[i];s+=o,n+=o*(r>t?r:t)}return s===0?0:n/s}function td(t,e){const s=Object.assign({captureResourceTimings:!0,capturePageLoadTimings:!0,capturePageRenderTimings:!0,excludedResourceUrls:[]},e);if("PerformanceObserver"in window||(s.captureResourceTimings=!1),!s.captureResourceTimings)return;let n={};function i(u){var h;if(u.duration<0||!Mo(u.name)||t.isServiceURL(u.name))return;n!==null&&(n[u.name]=u.startTime+u.duration);let l=!1;(h=s.excludedResourceUrls)==null||h.forEach(d=>{if(u.name.startsWith(d)){l=!0;return}}),!l&&t.send(Qo(u.startTime+vs(),u.duration,u.responseStart&&u.startTime?u.responseStart-u.startTime:0,u.transferSize>u.encodedBodySize?u.transferSize-u.encodedBodySize:0,u.encodedBodySize||0,u.decodedBodySize||0,u.name,u.initiatorType,u.transferSize,u.responseStatus&&u.responseStatus===304||u.transferSize===0))}const r=new PerformanceObserver(u=>u.getEntries().forEach(i));let o;t.attachStartCallback(function({sessionID:u}){u!==o&&(performance.getEntriesByType("resource").forEach(i),o=u),r.observe({entryTypes:["resource"]})}),t.attachStopCallback(function(){r.disconnect()});let a=0,c=0;if(s.capturePageLoadTimings){let u=!1;t.ticker.attach(()=>{if(!u&&((a===0||c===0)&&performance.getEntriesByType("paint").forEach(l=>{const{name:h,startTime:d}=l;switch(h){case"first-paint":a=d;break;case"first-contentful-paint":c=d;break}}),performance.timing.loadEventEnd||performance.now()>3e4)){u=!0;const{navigationStart:l,requestStart:h,responseStart:d,responseEnd:f,domContentLoadedEventStart:p,domContentLoadedEventEnd:m,loadEventStart:_,loadEventEnd:I}=performance.timing;t.send(nu(h-l||0,d-l||0,f-l||0,p-l||0,m-l||0,_-l||0,I-l||0,a,c))}},30)}if(s.capturePageRenderTimings){let u=0,l=0,h=0,d=null,f=!1;t.ticker.attach(()=>{if(f)return;const p=performance.now();if(n!==null&&(u=Math.max.apply(null,Object.keys(n).map(m=>n[m])),p-u>1e3&&(d=$h(n),n=null)),h!==null&&(p-h>50&&(l=p),h=p-l>5e3?null:p),d!==null&&h===null||p>3e4){f=!0,n=null;const m=d===null?0:ed(c||a,d),{domContentLoadedEventEnd:_,navigationStart:I}=performance.timing,T=h===null?Math.max(l,c,_-I||0):0;t.send(iu(m,c>u?c:u,T))}})}}function Zi(t){const e=t.defaultView;return[e&&e.scrollX||t.documentElement&&t.documentElement.scrollLeft||t.body&&t.body.scrollLeft||0,e&&e.scrollY||t.documentElement&&t.documentElement.scrollTop||t.body&&t.body.scrollTop||0]}function sd(t,e){let s=!1;const n=new Map;function i(a){la(a)&&(gt(a)&&n.set(a,[a.scrollLeft,a.scrollTop]),Cn(a)&&n.set(a,Zi(a)))}const r=t.safe(()=>{e||t.send(Vc(...Zi(document)))}),o=t.safe((a,c)=>{const u=t.nodes.getID(c);u!==void 0&&t.send(Zc(u,a[0],a[1]))});t.attachStartCallback(r),t.attachStopCallback(()=>{s=!1,n.clear()}),t.nodes.attachNodeCallback((a,c)=>{c&&(gt(a)&&a.scrollLeft+a.scrollTop>0?n.set(a,[a.scrollLeft,a.scrollTop]):Cn(a)&&n.set(a,Zi(a))),Nn(a)&&t.nodes.attachNodeListener(a,"scroll",u=>{i(u.target)})}),t.attachEventListener(document,"scroll",a=>{const c=a.target;if(c===document){s=!0;return}i(c)}),t.ticker.attach(()=>{s&&(r(),s=!1),n.forEach(o),n.clear()},5,!1)}function nd(t){let e,s,n,i,r=document.referrer;const o=t.safe(()=>{const{URL:u}=document;u!==e&&(e=u,t.send(Su(e,r,i,document.title)),i=0,r=e)}),a=t.safe(()=>{const{innerWidth:u,innerHeight:l}=window;(u!==s||l!==n)&&(s=u,n=l,t.send(Hc(s,n)))}),c=document.hidden===void 0?Function.prototype:t.safe(()=>t.send(uu(document.hidden)));t.attachStartCallback(()=>{e=null,i=vs(),s=n=-1,o(),a(),c()}),document.hidden!==void 0&&t.attachEventListener(document,"visibilitychange",c,!1,!1),t.ticker.attach(o,1,!1),t.ticker.attach(a,5,!1)}function Oa(t){return Nn(t)&&!!t.adoptedStyleSheets}let id=15;function Ma(){return id++}const Bn=new Map;function rd(t){if(t===null||!Oa(document))return;const e=new Map,s=new Map,n=o=>setTimeout(()=>{let a=t.nodes.getID(o);if(o===document&&(a=0),a===void 0)return;let c=s.get(a);c||(c=[]);const u=[],l=o.adoptedStyleSheets;if(l&&Symbol.iterator in l)for(const h of l){let d=e.get(h);const f=!d;if(d||(d=Ma(),e.set(h,d)),c.includes(d)||t.send(Xo(d,a)),f){const p=h.cssRules;for(let m=0;m<p.length;m++)t.send(Mi(d,p[m].cssText,m,t.getBaseHref()))}u.push(d)}if(Symbol.iterator in c)for(const h of c)u.includes(h)||t.send(gu(h,a));s.set(a,u)},20);function i(o){const a=Object.getOwnPropertyDescriptor(o,"adoptedStyleSheets");a&&Object.defineProperty(o,"adoptedStyleSheets",{...a,set:function(c){const u=a.set.call(this,c);return n(this),u}})}const r=o=>{if(o.__openreplay_adpss_patched__)return;o.__openreplay_adpss_patched__=!0,i(o.Document.prototype),i(o.ShadowRoot.prototype);const{replace:a,replaceSync:c}=o.CSSStyleSheet.prototype;o.CSSStyleSheet.prototype.replace=function(u){return a.call(this,u).then(l=>{const h=e.get(this);return h&&t.send(Go(h,u,t.getBaseHref())),l})},o.CSSStyleSheet.prototype.replaceSync=function(u){const l=e.get(this);return l&&t.send(Go(l,u,t.getBaseHref())),c.call(this,u)}};r(window),t.observer.attachContextCallback(t.safe(r)),t.attachStopCallback(()=>{e.clear(),s.clear()}),t.attachStartCallback(()=>{n(document)}),t.nodes.attachNodeCallback(o=>{Oa(o)&&n(o)})}function od(t){if(t===null)return;if(!window.CSSStyleSheet){t.send(du("no_stylesheet_prototype_in_window",""));return}const e=t.safe((i,r,o)=>{const a=Bn.get(i);a&&(typeof o=="string"?t.send(Mi(a,o,r,t.getBaseHref())):t.send(Ko(a,r)))}),s=t.safe(i=>{let r=i;for(;r.parentRule;)r=r.parentRule;const o=r.parentStyleSheet;if(!o){t.debug.warn("No parent StyleSheet found for",r,i);return}const a=Bn.get(o);if(!a){t.debug.warn("No sheedID found for",o,Bn);return}const c=r.cssText,u=o.cssRules,l=Array.from(u).indexOf(r);l>=0?(t.send(Mi(a,c,l,t.getBaseHref())),t.send(Ko(a,l+1))):t.debug.warn("Rule index not found in",o,r)}),n=t.safe(i=>{const{insertRule:r,deleteRule:o}=i.CSSStyleSheet.prototype,{insertRule:a,deleteRule:c}=i.CSSGroupingRule.prototype;i.CSSStyleSheet.prototype.insertRule=function(u,l=0){return e(this,l,u),r.call(this,u,l)},i.CSSStyleSheet.prototype.deleteRule=function(u){return e(this,u),o.call(this,u)},i.CSSGroupingRule.prototype.insertRule=function(u,l=0){const h=a.call(this,u,l);return s(this),h},i.CSSGroupingRule.prototype.deleteRule=function(u=0){const l=c.call(this,u);return s(this),l}});n(window),t.observer.attachContextCallback(n),t.nodes.attachNodeCallback(i=>{if(!he(i,"style")||!i.sheet||i.textContent!==null&&i.textContent.trim().length>0)return;const r=t.nodes.getID(i);if(!r)return;const o=i.sheet,a=Ma();Bn.set(o,a),t.send(Xo(a,r));const c=o.cssRules;for(let u=0;u<c.length;u++)e(o,u,c[u].cssText)})}function ad(t){function e(n){const i=t.nodes.getID(n);i!==void 0&&t.send(Vo(i))}let s=!1;t.nodes.attachNodeCallback(n=>{he(n,"body")&&(t.nodes.attachNodeListener(n,"focus",i=>{la(i.target)&&(e(i.target),s=!1)}),t.nodes.attachNodeListener(n,"blur",i=>{i.relatedTarget===null&&(s=!0,setTimeout(()=>{s&&t.send(Vo(-1))},0))}))}),t.attachStartCallback(()=>{let n=document.activeElement;for(;n&&he(n,"iframe")&&n.contentDocument;)n=n.contentDocument.activeElement;n&&n!==n.ownerDocument.body&&e(n)},!0)}function ld(t){if(!window.FontFace)return;const e=new Map,s=n=>{class i extends n.FontFace{constructor(...o){if(typeof o[1]=="string"){let a="";o[2]&&t.safe(()=>{a=JSON.stringify(o[2])});const c=[o[0],o[1],a],u=e.get(n.document)||[];u.push(c),e.set(n.document,u);const l=n===window?0:t.nodes.getID(n.document);if(l===void 0)return;t.active()&&t.send(Ho(l,...c))}super(...o)}}n.FontFace=i};t.observer.attachContextCallback(s),s(window),t.nodes.attachNodeCallback(t.safe(n=>{if(!Cn(n))return;const i=e.get(n);if(!i)return;const r=n.defaultView===window?0:t.nodes.getID(n);r!==void 0&&i.forEach(o=>{t.send(Ho(r,...o))})}))}function cd(t,e,s,n,i){t.debug.log("Openreplay: attaching axios spy to instance",e);function r(d){t.debug.log("Openreplay: capturing axios response data",d);const{headers:f,data:p,method:m,url:_,baseURL:I}=d.config,{data:T,headers:y,status:g,response:v}=d,{data:E,headers:C,status:S}=v||{},k=s.ignoreHeaders,A=Array.isArray(k)?N=>k.includes(N):()=>k;function z(N,V){A(V[0])||(N[V[0]]=V[1])}let F={},G={};f.toJSON?F=f.toJSON():f instanceof Headers?f.forEach((N,V)=>z(F,[V,N])):Array.isArray(f)?f.forEach(N=>z(F,N)):typeof f=="object"&&Object.entries(f).forEach(N=>z(F,N));const j=C||y;j.toJSON?G=j.toJSON():j instanceof Headers?j.forEach((N,V)=>z(G,[V,N])):Array.isArray(j)?j.forEach(N=>z(G,N)):typeof j=="object"&&Object.entries(j).forEach(([N,V])=>{A(N)||(G[N]=V)});const x=n({url:_,method:m||"",status:g||S||0,request:{headers:F,body:p},response:{headers:G,body:E||T}});if(!x){t.debug.log("Openreplay: empty request/response info, skipping");return}const D=d.config.__openreplay_timing,O=performance.now()-D;t.debug.log("Openreplay: final req object",x),t.send(Tn("xhr",String(m),String(x.url),i(x.request),i(x.response),x.status,D+vs(),O,0))}function o(d){if(t.debug.log("Openreplay: capturing API request",d),d.__openreplay_timing=performance.now(),s.sessionTokenHeader){const f=typeof s.sessionTokenHeader=="string"?s.sessionTokenHeader:"X-OpenReplay-Session-Token",p=t.getSessionToken();p&&d.headers.set(f,p)}return d}function a(d){return s.failuresOnly||r(d),d}function c(d){return t.debug.log("Openreplay: capturing API request error",d),ud(d)&&d.response?r(d.response):d instanceof Error&&t.send(On(d,[])),Promise.reject(d)}function u(d){t.debug.log("Openreplay: failed API request, skipping",d)}const l=e.interceptors.request.use(o,u,{synchronous:!0}),h=e.interceptors.response.use(a,c,{synchronous:!0});t.attachStopCallback(()=>{var d,f,p,m;(f=(d=e.interceptors.request).eject)==null||f.call(d,l),(m=(p=e.interceptors.response).eject)==null||m.call(p,h)})}function ud(t){return hd(t)&&t.isAxiosError===!0}function hd(t){return t!==null&&typeof t=="object"}class $i{constructor(e=[],s,n){this.ignoredHeaders=e,this.setSessionTokenHeader=s,this.sanitize=n,this.id="",this.name="",this.method="",this.url="",this.status=0,this.statusText="",this.cancelState=0,this.readyState=0,this.header={},this.responseType="",this.requestType="xhr",this.requestHeader={},this.responseSize=0,this.responseSizeText="",this.startTime=0,this.endTime=0,this.duration=0,this.getData={},this.requestData=null}getMessage(){const{reqHs:e,resHs:s}=this.writeHeaders(),n={headers:e,body:this.method==="GET"?JSON.stringify(this.getData):this.requestData},i={headers:s,body:this.response},r=this.sanitize({url:this.url,method:this.method,status:this.status,request:n,response:i});if(!r)return null;if(r.url.includes("/graphql")&&r.response.body&&typeof r.response.body=="string"){const a=r.response.body.includes("errors");r.status=a?400:200,this.requestType="graphql"}return{requestType:this.requestType,method:r.method,url:r.url,request:JSON.stringify(r.request),response:JSON.stringify(r.response),status:r.status,startTime:this.startTime,duration:this.duration,responseSize:this.responseSize}}writeHeaders(){const e={};Object.entries(this.requestHeader).forEach(([n,i])=>{this.isHeaderIgnored(n)||(e[n]=i)}),this.setSessionTokenHeader((n,i)=>{e[n]=i});const s={};return Object.entries(this.header).forEach(([n,i])=>{this.isHeaderIgnored(n)||(s[n]=i)}),{reqHs:e,resHs:s}}isHeaderIgnored(e){return Array.isArray(this.ignoredHeaders)?this.ignoredHeaders.map(s=>s.toLowerCase()).includes(e.toLowerCase()):this.ignoredHeaders}}const Gs=(t,e)=>{let s="";switch(t){case"":case"text":case"json":typeof e=="string"?s=e:tr(e)||Array.isArray(e)?s=JSON.stringify(e):typeof e<"u"&&(s=Object.prototype.toString.call(e));break;case"blob":case"document":case"arraybuffer":default:typeof e<"u"&&(s=Object.prototype.toString.call(e));break}return s},er=t=>{if(!t)return null;let e;if(typeof t=="string"){(t[0]==="{"||t[0]==="[")&&(e=t);const s=t.split("&");s.length===1?e=t:e=s.join(",")}else if(fd(t)){const s=[];for(const[n,i]of t)s.push(`${n}=${typeof i=="string"?i:"[object Object]"}`);e=s.join(",")}else t instanceof Blob||t instanceof ReadableStream||t instanceof ArrayBuffer?e="byte data":tr(t)?e=t:e=`can't parse body ${typeof t}`;return e},dd=(t,e={})=>{tr(e)||(e={});let s=t?t.split("?"):[];if(s.shift(),s.length>0){s=s.join("?").split("&");for(const n of s){const i=n.split("=");try{e[i[0]]=decodeURIComponent(i[1])}catch{e[i[0]]=i[1]}}}return e};function tr(t){return t!==null&&typeof t=="object"}function fd(t){return t==null||ArrayBuffer.isView(t)?!1:typeof Symbol<"u"&&typeof t[Symbol.iterator]=="function"}function Fn(t){return t<=0?"":t>=1e3*1e3?(t/1e3/1e3).toFixed(1)+" MB":t>=1e3?(t/1e3).toFixed(1)+" KB":`${t}B`}const sr=t=>(t.startsWith("//")&&(t=`${new URL(window.location.href).protocol}${t}`),t.startsWith("http")?new URL(t):new URL(t,window.location.href)),pd=t=>t instanceof Blob?t.type:t instanceof FormData?"multipart/form-data":t instanceof URLSearchParams?"application/x-www-form-urlencoded;charset=UTF-8":"text/plain;charset=UTF-8";class gd{constructor(e,s,n,i,r){this.ignoredHeaders=e,this.setSessionTokenHeader=s,this.sanitize=n,this.sendMessage=i,this.isServiceUrl=r}apply(e,s,n){const i=n[0],r=n[1],o=new $i(this.ignoredHeaders,this.setSessionTokenHeader,this.sanitize);if(this.isServiceUrl(i))return e.apply(s,n);const a=sr(i);if(o.method="POST",o.url=i,o.name=(a.pathname.split("/").pop()||"")+a.search,o.requestType="beacon",o.requestHeader={"Content-Type":pd(r)},o.status=0,o.statusText="Pending",a.search&&a.searchParams){o.getData={};for(const[l,h]of a.searchParams)o.getData[l]=h}o.requestData=er(r),o.startTime||(o.startTime=performance.now());const c=e.apply(s,n);c?(o.endTime=performance.now(),o.duration=o.endTime-(o.startTime||o.endTime),o.status=0,o.statusText="Sent",o.readyState=4):(o.status=500,o.statusText="Unknown");const u=o.getMessage();return u&&this.sendMessage(u),c}}class md{static create(e,s,n,i,r,o){if(e)return new Proxy(e,new gd(s,n,i,r,o))}}var nt;(function(t){t[t.UNSENT=0]="UNSENT",t[t.OPENED=1]="OPENED",t[t.HEADERS_RECEIVED=2]="HEADERS_RECEIVED",t[t.LOADING=3]="LOADING",t[t.DONE=4]="DONE"})(nt||(nt={}));class vd{constructor(e,s){this.resp=e,this.item=s,this.mockReader()}set(e,s,n){return Reflect.set(e,s,n)}get(e,s){const n=Reflect.get(e,s);switch(s){case"arrayBuffer":case"blob":case"formData":case"json":case"text":return()=>(this.item.responseType=s.toLowerCase(),n.apply(e).then(i=>(this.item.response=Gs(this.item.responseType,i),i)))}return typeof n=="function"?n.bind(e):n}mockReader(){let e;if(!this.resp.body||typeof this.resp.body.getReader!="function")return;const s=this.resp.body.getReader;this.resp.body.getReader=()=>{const n=s.apply(this.resp.body);if(this.item.readyState===nt.DONE)return n;const i=n.read,r=n.cancel;return this.item.responseType="arraybuffer",n.read=()=>i.apply(n).then(o=>{if(!e)e=new Uint8Array(o.value);else{const a=new Uint8Array(e.length+o.value.length);a.set(e),a.set(o.value,e.length),e=a}return this.item.endTime=performance.now(),this.item.duration=this.item.endTime-(this.item.startTime||this.item.endTime),this.item.readyState=o.done?4:3,this.item.statusText=o.done?String(this.item.status):"Loading",this.item.responseSize=e.length,this.item.responseSizeText=Fn(this.item.responseSize),o.done&&(this.item.response=Gs(this.item.responseType,e)),o}),n.cancel=(...o)=>(this.item.cancelState=2,this.item.statusText="Cancel",this.item.endTime=performance.now(),this.item.duration=this.item.endTime-(this.item.startTime||this.item.endTime),this.item.response=Gs(this.item.responseType,e),r.apply(n,o)),n}}}class bd{constructor(e,s,n,i,r,o){this.ignoredHeaders=e,this.setSessionTokenHeader=s,this.sanitize=n,this.sendMessage=i,this.isServiceUrl=r,this.tokenUrlMatcher=o}apply(e,s,n){const i=n[0],r=n[1];if(!i||typeof i!="string"&&!(i!=null&&i.url)||(i instanceof URL||typeof i=="string"?this.isServiceUrl(String(i)):this.isServiceUrl(String(i.url))))return e.apply(window,n);const a=new $i(this.ignoredHeaders,this.setSessionTokenHeader,this.sanitize);return this.beforeFetch(a,i,r),this.setSessionTokenHeader((c,u)=>{if(!(this.tokenUrlMatcher!==void 0&&!this.tokenUrlMatcher(a.url))){if(n[1]===void 0&&n[0]instanceof Request)return n[0].headers.append(c,u);n[1]||(n[1]={}),n[1].headers===void 0&&(n[1]=Object.assign(Object.assign({},n[1]),{headers:{}})),n[1].headers instanceof Headers?n[1].headers.append(c,u):Array.isArray(n[1].headers)?n[1].headers.push([c,u]):n[1].headers[c]=u}}),e.apply(window,n).then(this.afterFetch(a)).catch(c=>{throw a.endTime=performance.now(),a.duration=a.endTime-(a.startTime||a.endTime),c})}beforeFetch(e,s,n){let i,r="GET",o={};if(typeof s=="string"?(r=(n==null?void 0:n.method)||"GET",i=sr(s),o=(n==null?void 0:n.headers)||{}):(r=s.method||"GET",i=sr(s.url),o=s.headers),e.method=r,e.requestType="fetch",e.requestHeader=o,e.url=i.toString(),e.name=(i.pathname.split("/").pop()||"")+i.search,e.status=0,e.statusText="Pending",e.readyState=1,e.startTime||(e.startTime=performance.now()),Object.prototype.toString.call(o)==="[object Headers]"){e.requestHeader={};for(const[a,c]of o)e.requestHeader[a]=c}else e.requestHeader=o;if(i.search&&i.searchParams){e.getData={};for(const[a,c]of i.searchParams)e.getData[a]=c}n!=null&&n.body&&(e.requestData=er(n.body))}afterFetch(e){return s=>{e.endTime=performance.now(),e.duration=e.endTime-(e.startTime||e.endTime),e.status=s.status,e.statusText=String(s.status);let n=!1;e.header={};for(const[i,r]of s.headers)e.header[i]=r,n=r.toLowerCase().indexOf("chunked")>-1?!0:n;return n?e.readyState=3:(e.readyState=4,this.handleResponseBody(s.clone(),e).then(i=>{e.responseSize=typeof i=="string"?i.length:i.byteLength,e.responseSizeText=Fn(e.responseSize),e.response=Gs(e.responseType,i);const r=e.getMessage();r&&this.sendMessage(r)}).catch(i=>{if(i.name!=="AbortError")throw i})),new Proxy(s,new vd(s,e))}}handleResponseBody(e,s){const n=e.headers.get("content-type");return n&&n.includes("application/json")?(s.responseType="json",e.text()):n&&(n.includes("text/html")||n.includes("text/plain"))?(s.responseType="text",e.text()):(s.responseType="arraybuffer",e.arrayBuffer())}}class yd{static create(e,s,n,i,r,o){return new Proxy(fetch,new bd(e,s,n,i,r,o))}}class wd{constructor(e,s,n,i,r,o,a){this.ignoredHeaders=s,this.setSessionTokenHeader=n,this.sanitize=i,this.sendMessage=r,this.isServiceUrl=o,this.tokenUrlMatcher=a,this.XMLReq=e,this.XMLReq.onreadystatechange=()=>{this.onReadyStateChange()},this.XMLReq.onabort=()=>{this.onAbort()},this.XMLReq.ontimeout=()=>{this.onTimeout()},this.item=new $i(s,n,i),this.item.requestType="xhr"}get(e,s){switch(s){case"open":return this.getOpen(e);case"send":return this.setSessionTokenHeader((i,r)=>{this.tokenUrlMatcher!==void 0&&!this.tokenUrlMatcher(this.item.url)||e.setRequestHeader(i,r)}),this.getSend(e);case"setRequestHeader":return this.getSetRequestHeader(e);default:const n=Reflect.get(e,s);return typeof n=="function"?n.bind(e):n}}set(e,s,n){switch(s){case"onreadystatechange":return this.setOnReadyStateChange(e,s,n);case"onabort":return this.setOnAbort(e,s,n);case"ontimeout":return this.setOnTimeout(e,s,n)}return Reflect.set(e,s,n)}onReadyStateChange(){if(!(this.item.url&&this.isServiceUrl(this.item.url))&&(this.item.readyState=this.XMLReq.readyState,this.item.responseType=this.XMLReq.responseType,this.item.endTime=performance.now(),this.item.duration=this.item.endTime-this.item.startTime,this.updateItemByReadyState(),setTimeout(()=>{this.item.response=Gs(this.item.responseType,this.item.response)},0),this.XMLReq.readyState===nt.DONE)){const e=this.item.getMessage();e&&this.sendMessage(e)}}onAbort(){this.item.cancelState=1,this.item.statusText="Abort";const e=this.item.getMessage();e&&this.sendMessage(e)}onTimeout(){this.item.cancelState=3,this.item.statusText="Timeout";const e=this.item.getMessage();e&&this.sendMessage(e)}getOpen(e){const s=Reflect.get(e,"open");return(...n)=>{var i,r,o;const a=n[0],c=n[1];return this.item.method=a?a.toUpperCase():"GET",this.item.url=((i=c.toString)===null||i===void 0?void 0:i.call(c))||"",this.item.name=(o=(r=this.item.url)===null||r===void 0?void 0:r.replace(new RegExp("/*$"),"").split("/").pop())!==null&&o!==void 0?o:"",this.item.getData=dd(this.item.url,{}),s.apply(e,n)}}getSend(e){const s=Reflect.get(e,"send");return(...n)=>{const i=n[0];return this.item.requestData=er(i),s.apply(e,n)}}getSetRequestHeader(e){const s=Reflect.get(e,"setRequestHeader");return(...n)=>(this.item.requestHeader||(this.item.requestHeader={}),this.item.requestHeader[n[0]]=n[1],s.apply(e,n))}setOnReadyStateChange(e,s,n){return Reflect.set(e,s,(...i)=>{this.onReadyStateChange(),n==null||n.apply(e,i)})}setOnAbort(e,s,n){return Reflect.set(e,s,(...i)=>{this.onAbort(),n.apply(e,i)})}setOnTimeout(e,s,n){return Reflect.set(e,s,(...i)=>{this.onTimeout(),n.apply(e,i)})}updateItemByReadyState(){switch(this.XMLReq.readyState){case nt.UNSENT:case nt.OPENED:this.item.status=nt.UNSENT,this.item.statusText="Pending",this.item.startTime||(this.item.startTime=performance.now());break;case nt.HEADERS_RECEIVED:this.item.status=this.XMLReq.status,this.item.statusText="Loading",this.item.header={};const e=this.XMLReq.getAllResponseHeaders()||"",s=e.split(`
|
|
19
|
+
`);for(let n=0;n<s.length;n++){const i=s[n];if(!i)continue;const r=i.split(": "),o=r[0];this.item.header[o]=r.slice(1).join(": ")}break;case nt.LOADING:this.item.status=this.XMLReq.status,this.item.statusText="Loading",this.XMLReq.response&&this.XMLReq.response.length&&(this.item.responseSize=this.XMLReq.response.length,this.item.responseSizeText=Fn(this.item.responseSize));break;case nt.DONE:this.item.status=this.XMLReq.status||this.item.status||0,this.item.statusText=String(this.item.status),this.item.endTime=performance.now(),this.item.duration=this.item.endTime-(this.item.startTime||this.item.endTime),this.item.response=this.XMLReq.response,this.XMLReq.response&&this.XMLReq.response.length&&(this.item.responseSize=this.XMLReq.response.length,this.item.responseSizeText=Fn(this.item.responseSize));break;default:this.item.status=this.XMLReq.status,this.item.statusText="Unknown";break}}}class Sd{static create(e,s,n,i,r,o){return new Proxy(XMLHttpRequest,{construct(a){const c=new a;return new Proxy(c,new wd(c,e,s,n,i,r,o))}})}}const Aa=t=>{const e=`Openreplay: Can't find ${t} in global context.`;console.warn(e)};function _d(t,e,s,n,i,r,o={xhr:!0,fetch:!0,beacon:!0},a){var c;if(t&&(o.xhr&&(t.XMLHttpRequest?t.XMLHttpRequest=Sd.create(e,s,n,i,r,a):Aa("XMLHttpRequest")),o.fetch&&(t.fetch?t.fetch=yd.create(e,s,n,i,r,a):Aa("fetch")),o.beacon&&!((c=t.navigator)===null||c===void 0)&&c.sendBeacon)){const u=t.navigator.sendBeacon;t.navigator.sendBeacon=md.create(u,e,s,n,i,r)}}function nr(t){return t.__or_req_data__||(t.__or_req_data__={body:void 0,headers:{}}),t.__or_req_data__}function Pa(t){return typeof t=="string"?t.toUpperCase():"GET"}function kd(t,e={}){const s=Object.assign({failuresOnly:!1,ignoreHeaders:["cookie","set-cookie","authorization"],capturePayload:!1,sessionTokenHeader:!1,captureInIframes:!0,axiosInstances:void 0,useProxy:!0},e);s.useProxy===!1&&t.debug.warn("Network module is migrating to proxy api, to gradually migrate and test it set useProxy to true");const n=s.ignoreHeaders,i=Array.isArray(n)?l=>n.includes(l):()=>n,r=s.sessionTokenHeader===!0?"X-OpenReplay-SessionToken":s.sessionTokenHeader;function o(l){if(r){const h=t.getSessionToken();h&&t.safe(l)(r,h)}}function a(l){if(s.capturePayload||(delete l.request.body,delete l.response.body),s.sanitizer){const h=l.response.body;if(typeof h=="string")try{l.response.body=JSON.parse(h)}catch{}return s.sanitizer(l)}return l}function c(l){if(l&&typeof l.body!="string")try{l.body=JSON.stringify(l.body)}catch{l.body="<unable to stringify>",t.notify.warn("Openreplay fetch couldn't stringify body:",l.body)}return JSON.stringify(l)}const u=l=>{if(s.useProxy)return _d(l,s.ignoreHeaders,o,a,y=>{t.send(Tn(y.requestType,y.method,y.url,y.request,y.response,y.status,y.startTime+vs(),y.duration,y.responseSize))},y=>t.isServiceURL(y),{xhr:!0,fetch:!0,beacon:!0},s.tokenUrlMatcher);const h=l.fetch.bind(l),d=(y,g={})=>{if(!(typeof y=="string"||y instanceof URL)||t.isServiceURL(String(y)))return h(y,g);o(function(E,C){g.headers===void 0&&(g.headers={}),g.headers instanceof Headers?g.headers.append(E,C):Array.isArray(g.headers)?g.headers.push([E,C]):g.headers[E]=C});const v=performance.now();return h(y,g).then(E=>{const C=performance.now()-v;if(s.failuresOnly&&E.status<400)return E;const S=E.clone();return S.text().then(k=>{const A={},z={};if(n!==!0){const j=([x,D])=>{i(x)||(A[x]=D)};g.headers instanceof Headers?g.headers.forEach((x,D)=>j([D,x])):Array.isArray(g.headers)?g.headers.forEach(j):typeof g.headers=="object"&&Object.entries(g.headers).forEach(j),S.headers.forEach((x,D)=>{i(D)||(z[D]=x)})}const F=Pa(g.method),G=a({url:String(y),method:F,status:S.status,request:{headers:A,body:g.body||null},response:{headers:z,body:k}});G&&t.send(Tn("fetch",F,String(G.url),c(G.request),c(G.response),S.status,v+vs(),C,0))}).catch(k=>t.debug.error("Could not process Fetch response:",k)),E})};l.fetch=d;const f=l.XMLHttpRequest.prototype.open,p=l.XMLHttpRequest.prototype.setRequestHeader,m=l.XMLHttpRequest.prototype.send;function _(y,g){const v=this;o((C,S)=>v.setRequestHeader(C,S));let E=0;return v.addEventListener("loadstart",C=>{E=C.timeStamp}),v.addEventListener("load",t.safe(C=>{const{headers:S,body:k}=nr(v),A=E>0?C.timeStamp-E:0,F=(v.getAllResponseHeaders()||"").trim().split(/[\r\n]+/),G={};F.forEach(function(D){const O=D.split(": "),N=O.shift();i(N)||(G[N]=O.join(": "))});const j=Pa(y),x=a({url:String(g),method:j,status:v.status,request:{headers:S,body:k||null},response:{headers:G,body:v.response}});x&&t.send(Tn("xhr",j,String(x.url),c(x.request),c(x.response),v.status,E+vs(),A,0))})),f.apply(this,arguments)}function I(y){const g=nr(this);return g.body=y,m.apply(this,arguments)}function T(y,g){if(!i(y)){const v=nr(this);v.headers[y]=g}return p.apply(this,arguments)}s.axiosInstances||(l.XMLHttpRequest.prototype.open=_,l.XMLHttpRequest.prototype.send=I,l.XMLHttpRequest.prototype.setRequestHeader=T)};u(window),s.axiosInstances&&s.axiosInstances.forEach(l=>{cd(t,l,s,a,c)}),s.captureInIframes&&t.observer.attachContextCallback(t.safe(u))}function Td(t){t.attachEventListener(document,"selectionchange",()=>{const e=document.getSelection();if(e!==null&&!e.isCollapsed){const s=t.nodes.getID(e.anchorNode),n=t.nodes.getID(e.focusNode),i=e.toString().replace(/\s+/g," ");s&&n&&t.send(Yo(s,n,i))}else t.send(Yo(-1,-1,""))})}function xd(t){function e(){document.hidden||(t.debug.log("Openreplay: tab change to"+t.session.getTabId()),t.send(xn(t.session.getTabId())))}t.attachEventListener(window,"focus",e,!1,!1)}const zn="/installation/javascript-sdk";function Ed(t){if(t==null)return console.error(`OpenReplay: invalid options argument type. Please, check documentation on ${kn}${zn}`),!1;if(typeof t.projectKey!="string")if(typeof t.projectKey!="number"){if(typeof t.projectID!="number")return console.error(`OpenReplay: projectKey is missing or wrong type (string is expected). Please, check ${kn}${zn} for more information.`),!1;t.projectKey=t.projectID.toString(),Et("`projectID` option","`projectKey` option",zn)}else console.warn("OpenReplay: projectKey is expected to have a string type."),t.projectKey=t.projectKey.toString();return t.sessionToken!=null&&Et("`sessionToken` option","`sessionHash` start() option","/"),!0}const Id=()=>{try{return!!window.top}catch{return!1}};class Cd{constructor(e){var a,c;if(this.options=e,this.app=null,this.crossdomainMode=!1,this.checkDoNotTrack=()=>this.options.respectDoNotTrack&&(navigator.doNotTrack=="1"||window.doNotTrack=="1"),this.signalStartIssue=(u,l)=>{const h=this.checkDoNotTrack(),d=new XMLHttpRequest,f=this.options.ingestPoint||fa;d.open("POST",f+"/v1/web/not-started"),d.send(JSON.stringify({trackerVersion:"14.0.14",projectKey:this.options.projectKey,doNotTrack:h,reason:l.length?`missing api: ${l.join(",")}`:u}))},this.restartCanvasTracking=()=>{this.app!==null&&this.app.restartCanvasTracking()},this.handleError=(u,l={})=>{if(this.app!==null){if(u instanceof Error){const h=On(u,[],l);this.app.send(h)}else if(u instanceof ErrorEvent||"PromiseRejectionEvent"in window&&u instanceof PromiseRejectionEvent){const h=ya(u,void 0,l);h!=null&&this.app.send(h)}}},this.crossdomainMode=!!(Bo()&&((a=e.crossdomain)!=null&&a.enabled)),!tt||!Ed(e)){console.error("OpenReplay: tracker called in a non-browser environment or with invalid options");return}if(window.__OPENREPLAY__||!this.crossdomainMode&&Bo()&&Id()&&((c=window.top)!=null&&c.__OPENREPLAY__)){console.error("OpenReplay: one tracker instance has been initialised already");return}if(!e.__DISABLE_SECURE_MODE&&location.protocol!=="https:"){console.error("OpenReplay: Your website must be publicly accessible and running on SSL in order for OpenReplay to properly capture and replay the user session. You can disable this check by setting `__DISABLE_SECURE_MODE` option to `true` if you are testing in localhost. Keep in mind, that asset files on a local machine are not available to the outside world. This might affect tracking if you use css files.");return}const s=this.checkDoNotTrack(),n=[],i=["Map","Set","MutationObserver","performance","timing","startsWith","Blob","Worker"];if(s)n.push("doNotTrack");else for(const u of i)if(u==="timing"){if("performance"in window&&!(u in performance)){n.push(u);break}}else if(u==="startsWith"){if(!(u in String.prototype)){n.push(u);break}}else if(!(u in window)){n.push(u);break}if(n.length>0){const u=n.join(",");console.error(`OpenReplay: browser doesn't support API required for tracking or doNotTrack is set to 1. Reason: ${u}`),this.signalStartIssue("missing_api",n);return}const r=new fh(e.projectKey,e.sessionToken,e,this.signalStartIssue,this.crossdomainMode);this.app=r,this.crossdomainMode||(nd(r),ph(r),_u(r,e),xd(r)),Zh(r,e.mouse),sd(r,this.crossdomainMode),od(r),rd(r),bh(r,e),Oh(r,e),Ph(r),jh(r,e),td(r,e),ad(r),ld(r),kd(r,e.network),Td(r),window.__OPENREPLAY__=this,e.flags&&e.flags.onFlagsLoad&&this.onFlagsLoad(e.flags.onFlagsLoad);const o=window.open;(e.autoResetOnWindowOpen||e.resetTabOnWindowOpen)&&(r.attachStartCallback(()=>{const u=r.getTabId(),l=r.sessionStorage??window.sessionStorage;window.open=function(...h){return e.autoResetOnWindowOpen&&r.resetNextPageSession(!0),e.resetTabOnWindowOpen&&l.removeItem(e.session_tabid_key||"__openreplay_tabid"),r.resetNextPageSession(!1),l.setItem(e.session_tabid_key||"__openreplay_tabid",u),o.call(window,...h)}}),r.attachStopCallback(()=>{window.open=o}))}isFlagEnabled(e){return this.featureFlags.isFlagEnabled(e)}onFlagsLoad(e){var s;(s=this.app)==null||s.featureFlags.onFlagsLoad(e)}clearPersistFlags(){var e;(e=this.app)==null||e.featureFlags.clearPersistFlags()}reloadFlags(){var e;return(e=this.app)==null?void 0:e.featureFlags.reloadFlags()}getFeatureFlag(e){var s;return(s=this.app)==null?void 0:s.featureFlags.getFeatureFlag(e)}getAllFeatureFlags(){var e;return(e=this.app)==null?void 0:e.featureFlags.flags}use(e){return e(this.app,this.options)}isActive(){return this.app===null?!1:this.app.active()}trackWs(e){if(this.app!==null)return this.app.trackWs(e)}start(e){return this.browserEnvCheck()?this.app===null?Promise.reject("Browser doesn't support required api, or doNotTrack is active."):this.app.start(e):Promise.reject("Trying to start not in browser.")}browserEnvCheck(){return tt?!0:(console.error(`OpenReplay: you are trying to start Tracker on a node.js environment. If you want to use OpenReplay with SSR, please, use componentDidMount or useEffect API for placing the \`tracker.start()\` line. Check documentation on ${kn}${zn}`),!1)}coldStart(e,s){if(this.browserEnvCheck()){if(this.app===null)return Promise.reject("Tracker not initialized");this.app.coldStart(e,s)}else return Promise.reject("Trying to start not in browser.")}startOfflineRecording(e,s){return this.browserEnvCheck()?this.app===null?Promise.reject("Tracker not initialized"):this.app.offlineRecording(e,s):Promise.reject("Trying to start not in browser.")}uploadOfflineRecording(){if(this.app!==null)return this.app.uploadOfflineRecording()}stop(){if(this.app!==null)return this.app.stop(),this.app.session.getSessionHash()}forceFlushBatch(){this.app!==null&&this.app.forceFlushBatch()}getSessionToken(){return this.app===null?null:this.app.getSessionToken()}getSessionInfo(){return this.app===null?null:this.app.session.getInfo()}getSessionID(){return this.app===null?null:this.app.getSessionID()}getTabId(){return this.app===null?null:this.app.getTabId()}getUxId(){return this.app===null?null:this.app.getUxtId()}sessionID(){return Et("'sessionID' method","'getSessionID' method","/"),this.getSessionID()}getSessionURL(e){if(this.app!==null)return this.app.getSessionURL(e)}setUserID(e){typeof e=="string"&&this.app!==null&&this.app.session.setUserID(e)}userID(e){Et("'userID' method","'setUserID' method","/"),this.setUserID(e)}setUserAnonymousID(e){typeof e=="string"&&this.app!==null&&this.app.send(au(e))}userAnonymousID(e){Et("'userAnonymousID' method","'setUserAnonymousID' method","/"),this.setUserAnonymousID(e)}setMetadata(e,s){typeof e=="string"&&typeof s=="string"&&this.app!==null&&this.app.session.setMetadata(e,s)}metadata(e,s){Et("'metadata' method","'setMetadata' method","/"),this.setMetadata(e,s)}event(e,s=null,n=!1){if(typeof e=="string"&&this.app!==null){if(n)return this.issue(e,s);try{s=JSON.stringify(s)}catch{return}this.app.send(ru(e,s))}}issue(e,s=null){if(typeof e=="string"&&this.app!==null){try{s=JSON.stringify(s)}catch{return}this.app.send(fu(e,s))}}}function Nd(t){return{id:String(t.ID),appellation:t.Appellation||null,country:t.Country||null,grape:t.Grape,image:t.Image,price:Number(t.Price),producer:t.Producer||null,region:t.Region,score:t.Score?Number(t.Score):null,shortDescription:t["Short Description"]||null,store:t.Store,storeId:t.Store_id||null,tags:Array.isArray(t.Tags)?t.Tags.map(String):[],title:t.Title,type:t.Type,url:t.Url||null,vintage:t.Vintage?Number(t.Vintage):null,pairingRecommendation:t.pairing_recommendation||null,total:t.Total?Number(t.Total):null,itemId:t.item_id||null,isPromote:t.is_promote?!!t.is_promote:null,stock:t.stock?Number(t.stock):null}}function Dd(t){return{id:String(t.id),title:String(t.title),description:String(t.description),region:String(t.region),price:Number(t.price),grape:String(t.grape),appellation:t.appellation?String(t.appellation):null,url:t.url?String(t.url):null,store:String(t.store),storeId:t.storeId?String(t.storeId):null,image:String(t.image),country:t.country?String(t.country):null,vintage:t.vintage?Number(t.vintage):null,tags:Array.isArray(t.tags)?t.tags.map(String):[],score:t.score?Number(t.score):null,total:t.total?Number(t.total):null,isPromote:t.is_promote?!!t.is_promote:null,stock:t.stock?Number(t.stock):null,distance:Number(t.distance),reason:String(t.reason),type:String(t.type)}}class Rd{constructor(e){K(this,Is,"https://wineater-backend.vercel.app/");K(this,Zt);B(this,Zt,e)}async getInstantRecommendations(){try{const e=await fetch(`${b(this,Is)}dish/recommendations/instant`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${b(this,Zt)}`}}),s=await e.json();if(!e.ok)throw new Error(`API call failed with status ${e.status}: ${s.message||"No additional error information"}`);return s.map(Nd)}catch(e){throw new Error(`Error in getInstantRecommendations: ${e.message}`)}}async getWineRecommendationsSearch(e){try{const s=await fetch(`${b(this,Is)}dish/recommendations/search`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${b(this,Zt)}`},body:JSON.stringify({text:e})}),n=await s.json();if(!s.ok)throw new Error(`API call failed with status ${s.status}: ${n.message||"No additional error information"}`);return n.map(Dd)}catch(s){throw new Error(`Error in getWineRecommendations: ${s.message}`)}}async getStoreConfig(){try{const e=await fetch(`${b(this,Is)}stores/store`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${b(this,Zt)}`}});if(!e.ok)throw new Error(`HTTP error! Status: ${e.status}`);return await e.json()}catch(e){throw console.error("Error fetching store configuration:",e),e}}}Is=new WeakMap,Zt=new WeakMap;const Od=((Fa=window==null?void 0:window.wineaterData)==null?void 0:Fa.CLIENT_TOKEN)||"HeUw6IXuhvz6tRuXdPEGEbj3SGQ3Q2YtEc1Z8jd41Kg9LtyPb4Epu0to31SYIadG",ir=new Rd(Od),it={WIDGET_INITIALIZED:"widget_initialized",WIDGET_LOADED:"widget_loaded",SEARCH_PERFORMED:"search_performed",SEARCH_RESULTS_DISPLAYED:"search_results_displayed",NO_RESULTS_FOUND:"no_results_found",WINE_CARD_HOVER:"wine_card_hover",WINE_CARD_CLICK:"wine_card_click",WINE_DETAILS_VIEWED:"wine_details_viewed",WINE_DETAILS_CLOSED:"wine_details_closed",BUY_BUTTON_CLICKED:"buy_button_clicked",FILTER_APPLIED:"filter_applied",LANGUAGE_CHANGED:"language_changed",ERROR_OCCURRED:"error_occurred",MOBILE_VIEW_ACTIVATED:"mobile_view_activated"},Md={fr:{lang:"fr",welcomeMessage:"Quel plat allez-vous déguster ? Décrivez-le-moi et je vous proposerai le vin qui l'accompagnera parfaitement.",noResultsFound:"Aucun résultat trouvé.",somethingWentWrong:"Désolé, quelque chose a mal tourné.",chatButton1:"Trouvez l'accord parfait",chatButton2:"Associez le vin",chatButton3:"Obtenez des conseils",chatTitle:"Accord Mets & Vins 🍷",chatSubtitle:"Décrivez votre plat et obtenez une recommandation en 30 secondes",inputPlaceholder:"ex., Salade de thon",sendButton:"Accorder",poweredBy:"Propulsé par",price:"Prix",region:"Région",type:"Type",reason:"Suggestion",moreInfo:"Plus d'infos",winePairingIntro:"Pour ce vin, voici quelques suggestions de plats :",askForDinner:"Que voulez-vous manger ce soir?",clearChatButton:"Effacer le chat",widgetTitle:"TROUVEZ VOTRE VIN PARFAIT",widgetSubtitle:"Partagez tout ce que vous avez en tête—votre repas, humeur, budget ou occasion—et notre sommelier IA vous recommandera le vin parfait en quelques secondes",searchPlaceholder:"Entrez un mot-clé ou une description","wineDetails.reason":"Raison","wineDetails.price":"Prix","wineDetails.region":"Région","wineDetails.type":"Type","wineDetails.moreInfo":"Plus d'infos","wineDetails.code":"Code","wineDetails.buy":"Acheter",searchButton:"Rechercher",priceRange:"Gamme de prix",wineColor:"Couleur du vin",intensity:"Intensité",red:"Rouge",white:"Blanc",rose:"Rosé",light:"Léger",medium:"Moyen",full:"Puissant",barTitle:"Sélection du bar",barSubtitle:"Choisissez vos plats ci-dessous et cliquez sur «Envoyer»",barSendButton:"Envoyer",barResetButton:"Réinitialiser",barName:"Nom du bar",barNotesPlaceholder:"Entrez vos souhaits ici...",placeholderSuggestions:["Vin pour les pâtes","Parfait avec du poisson","Recommandé pour une soirée"],headerLine1:"Partagez tout ce qui vous passe par la tête —",headerLine2:"— et obtenez des recommandations de vin parfait en quelques secondes",headerMeal:"repas",headerMood:"humeur",headerBudget:"budget",headerOccasion:"occasion",headerOr:"ou",errorMessage:"Une erreur est survenue. Veuillez réessayer plus tard.",noResultsMessage:"Aucun résultat trouvé pour votre recherche. Veuillez essayer une autre requête.",ai_sommelier:"AI sommelier"},es:{lang:"es",welcomeMessage:"¿Qué vas a comer? Cuéntame tu plato y te recomendaré el maridaje perfecto.",noResultsFound:"No se encontraron resultados.",somethingWentWrong:"Lo sentimos, algo salió mal.",chatButton1:"Encuentra tu maridaje",chatButton2:"Combina vino ya",chatButton3:"Recibe asesoría ahora",chatTitle:"Maridaje de Vinos 🍷",chatSubtitle:"Describe tu comida y obtén una recomendación en 30 segundos",inputPlaceholder:"ej., Ensalada de atún",sendButton:"Combinar",poweredBy:"Desarrollado por",price:"Precio",region:"Región",type:"Tipo",reason:"Sugerencia",moreInfo:"Más info",winePairingIntro:"Para este vino, aquí tienes algunas sugerencias de platos:",askForDinner:"¿Qué te gustaría cenar?",clearChatButton:"Limpiar el chat",widgetTitle:"ENCUENTRA TU VINO PERFECTO",widgetSubtitle:"Comparte cualquier cosa que tengas en mente—tu comida, estado de ánimo, presupuesto o evento—y nuestro sommelier de IA te recomendará el vino perfecto en segundos",searchPlaceholder:"Escribe una palabra clave o descripción","wineDetails.reason":"Razón","wineDetails.price":"Precio","wineDetails.region":"Región","wineDetails.type":"Tipo","wineDetails.code":"Código","wineDetails.moreInfo":"Más información","wineDetails.buy":"Comprar",searchButton:"Buscar",priceRange:"Rango de precios",wineColor:"Color del vino",intensity:"Intensidad",red:"Tinto",white:"Blanco",rose:"Rosado",light:"Ligero",medium:"Medio",full:"Intenso",barTitle:"Platos de Bar",barSubtitle:"Selecciona de la lista y presiona «Enviar»",barSendButton:"Enviar",barResetButton:"Reiniciar",barName:"Nombre del bar",barNotesPlaceholder:"Agrega tus comentarios aquí...",placeholderSuggestions:["Vino para pasta","Perfecto con pescado","Recomendado para una fiesta"],headerLine1:"Comparte cualquier cosa que tengas en mente —",headerLine2:"— y obtén recomendaciones del vino perfecto en cuestión de segundos",headerMeal:"comida",headerMood:"estado de ánimo",headerBudget:"presupuesto",headerOccasion:"ocasión",headerOr:"o",errorMessage:"Algo salió mal. Por favor, inténtalo de nuevo más tarde.",noResultsMessage:"No se encontraron resultados para tu búsqueda. Por favor, intenta con otra consulta.",ai_sommelier:"AI sommelier"},en:{lang:"en",welcomeMessage:"What are you planning to eat? Share your dish and I'll recommend the perfect wine pairing for your meal.",noResultsFound:"No results found.",somethingWentWrong:"Sorry, something went wrong.",chatButton1:"Find Your Pairing",chatButton2:"Pair Wine Now",chatButton3:"Get Wine Advice",chatTitle:"Wine Pairing Assistant 🍷",chatSubtitle:"Describe your meal and get a recommendation in 30 seconds",inputPlaceholder:"e.g., Tuna salad",sendButton:"Match",poweredBy:"Powered by",price:"Price",region:"Region",type:"Type",reason:"Suggestion",moreInfo:"More info",winePairingIntro:"For this wine, here are some suggested dishes:",askForDinner:"What would you like to have for dinner?",clearChatButton:"Clear Chat",widgetTitle:"FIND YOUR PERFECT WINE",widgetSubtitle:"Share anything on your mind—your meal, mood, budget, or occasion—and our AI sommelier will recommend the perfect wine in seconds",searchPlaceholder:"Enter a keyword or description","wineDetails.price":"Price","wineDetails.region":"Region","wineDetails.type":"Type","wineDetails.moreInfo":"More info","wineDetails.reason":"Reason","wineDetails.code":"Code","wineDetails.buy":"Buy",searchButton:"Search",priceRange:"Price Range",wineColor:"Wine Color",intensity:"Intensity",red:"Red",white:"White",rose:"Rosé",light:"Light",medium:"Medium",full:"Full",barTitle:"Bar Dishes",barSubtitle:"Select dishes below and click 'Send'",barSendButton:"Send",barResetButton:"Reset",barName:"Bar Name",barNotesPlaceholder:"Add your wishes here...",placeholderSuggestions:["Wine for pasta","Perfect with fish","Recommended for a party"],headerLine1:"Share anything on your mind —",headerLine2:"— and get recommendations of the perfect wine in seconds",headerMeal:"meal",headerMood:"mood",headerBudget:"budget",headerOccasion:"occasion",headerOr:"or",errorMessage:"Something went wrong. Please try again later.",noResultsMessage:"No results found for your search. Please try a different query.",ai_sommelier:"AI sommelier"},sr:{lang:"sr",welcomeMessage:"Šta planirate da jedete? Podelite svoje jelo i preporučiću vam savršeno vino uz obrok.",noResultsFound:"Nema rezultata.",somethingWentWrong:"Izvinite, nešto je pošlo po zlu.",chatButton1:"Pronađi vino",chatButton2:"Upari vino sada",chatButton3:"Zatraži preporuku",chatTitle:"Asistent za uparivanje vina 🍷",chatSubtitle:"Opišite svoj obrok i dobijte preporuku za 30 sekundi",inputPlaceholder:"npr. Tuna salata",sendButton:"Upari",poweredBy:"Pokreće",price:"Cena",region:"Regija",type:"Tip",reason:"Preporuka",moreInfo:"Više informacija",winePairingIntro:"Za ovo vino, preporučuju se sledeća jela:",askForDinner:"Šta biste želeli za večeru?",clearChatButton:"Obriši razgovor",widgetTitle:"PRONAĐITE SAVRŠENO VINO",widgetSubtitle:"Podelite bilo šta — obrok, raspoloženje, budžet ili priliku — i naš AI somelijer će vam za par sekundi preporučiti vino",searchPlaceholder:"Unesite ključnu reč ili opis","wineDetails.price":"Cena","wineDetails.region":"Regija","wineDetails.type":"Tip","wineDetails.moreInfo":"Više informacija","wineDetails.reason":"Razlog","wineDetails.code":"Šifra","wineDetails.buy":"Kupi",searchButton:"Pretraga",priceRange:"Cenovni raspon",wineColor:"Boja vina",intensity:"Intenzitet",red:"Crveno",white:"Belo",rose:"Roze",light:"Lako",medium:"Srednje",full:"Puno",barTitle:"Jela iz bara",barSubtitle:"Izaberite jela ispod i kliknite 'Pošalji'",barSendButton:"Pošalji",barResetButton:"Resetuj",barName:"Naziv bara",barNotesPlaceholder:"Dodajte svoje želje ovde...",placeholderSuggestions:["Vino uz pastu","Savršeno uz ribu","Preporuka za žurku"],headerLine1:"Podelite bilo šta što vam je na umu —",headerLine2:"— i dobijte preporuke za savršeno vino za par sekundi",headerMeal:"obrok",headerMood:"raspoloženje",headerBudget:"budžet",headerOccasion:"prilika",headerOr:"ili",errorMessage:"Nešto je pošlo po zlu. Molimo pokušajte ponovo kasnije.",noResultsMessage:"Nema rezultata za vašu pretragu. Molimo pokušajte sa drugačijim upitom.",ai_sommelier:"AI sommelier"},de:{lang:"de",welcomeMessage:"Was möchten Sie essen? Beschreiben Sie Ihr Gericht und ich empfehle Ihnen den perfekten Wein dazu.",noResultsFound:"Keine Ergebnisse gefunden.",somethingWentWrong:"Entschuldigung, etwas ist schief gelaufen.",chatButton1:"Finde Dein Pairing",chatButton2:"Wein jetzt wählen",chatButton3:"Erhalte Weinberatung",chatTitle:"Wein & Speisen 🍷",chatSubtitle:"Beschreiben Sie Ihr Gericht und erhalten Sie in 30 Sekunden eine Empfehlung",inputPlaceholder:"z.B., Thunfischsalat",sendButton:"Kombinieren",poweredBy:"Unterstützt von",price:"Preis",region:"Region",type:"Typ",reason:"Anregung",moreInfo:"Mehr Info",winePairingIntro:"Für diesen Wein gibt es folgende Essensvorschläge:",askForDinner:"Was möchten Sie zum Abendessen essen?",clearChatButton:"Chat löschen",widgetTitle:"FINDEN SIE IHREN PERFEKTEN WEIN",widgetSubtitle:"Teilen Sie alles, was Ihnen in den Sinn kommt—Ihre Mahlzeit, Stimmung, Ihr Budget oder Anlass—und unser KI-Sommelier empfiehlt Ihnen in Sekunden den perfekten Wein",placeholderSuggestions:["Wein für Pasta","Perfekt zu Fisch","Empfohlen für eine Party"],searchPlaceholder:"Geben Sie ein Stichwort oder eine Beschreibung ein","wineDetails.price":"Preis","wineDetails.region":"Region","wineDetails.type":"Typ","wineDetails.moreInfo":"Mehr Info","wineDetails.reason":"Grund","wineDetails.code":"Code","wineDetails.buy":"Kaufen",searchButton:"Suche",priceRange:"Preisspanne",wineColor:"Weinfarbe",intensity:"Intensität",red:"Rot",white:"Weiß",rose:"Rosé",light:"Leicht",medium:"Mittel",full:"Voll",barTitle:"Bar-Auswahl",barSubtitle:"Wählen Sie Ihre Gerichte und klicken Sie auf 'Senden'",barSendButton:"Senden",barResetButton:"Zurücksetzen",barName:"Name der Bar",headerLine1:"Teilen Sie alles, was Ihnen durch den Kopf geht —",headerLine2:"— und erhalten Sie in Sekundenschnelle Empfehlungen für den perfekten Wein",headerMeal:"Mahlzeit",headerMood:"Stimmung",headerBudget:"Budget",headerOccasion:"Anlass",headerOr:"oder",errorMessage:"Etwas ist schief gelaufen. Bitte versuchen Sie es später erneut.",noResultsMessage:"Keine Ergebnisse für Ihre Suche gefunden. Bitte versuchen Sie es mit einer anderen Anfrage.",ai_sommelier:"AI sommelier"},ukr:{lang:"ukr",welcomeMessage:"Що ви збираєтесь їсти? Опишіть свою страву, і я порекомендую вам ідеальне вино.",noResultsFound:"Результатів не знайдено.",somethingWentWrong:"Вибачте, щось пішло не так.",chatButton1:"Знайти ідеальне поєднання",chatButton2:"Підібрати вино",chatButton3:"Отримати пораду",chatTitle:"Сомельє-помічник 🍷",chatSubtitle:"Опишіть свою страву і отримайте рекомендацію за 30 секунд",inputPlaceholder:"наприклад, Тунець із салатом",sendButton:"Підібрати",poweredBy:"Розроблено на основі",price:"Ціна",region:"Регіон",type:"Тип",reason:"Рекомендація",moreInfo:"Докладніше",winePairingIntro:"До цього вина підходять такі страви:",askForDinner:"Що ви хочете на вечерю?",clearChatButton:"Очистити чат",widgetTitle:"ЗНАЙДІТЬ ІДЕАЛЬНЕ ВИНО",widgetSubtitle:"Поділіться тим, що у вас на думці—їжа, настрій, бюджет чи подія—і наш AI-сомельє порекомендує вам ідеальне вино за секунди",searchPlaceholder:"Введіть ключове слово або опис","wineDetails.reason":"Причина","wineDetails.price":"Ціна","wineDetails.region":"Регіон","wineDetails.type":"Тип","wineDetails.moreInfo":"Докладніше","wineDetails.code":"Код","wineDetails.buy":"Купити",searchButton:"Пошук",priceRange:"Діапазон цін",wineColor:"Колір вина",intensity:"Інтенсивність",red:"Червоне",white:"Біле",rose:"Рожеве",light:"Легке",medium:"Середнє",full:"Повне",barTitle:"Закуски до вина",barSubtitle:"Виберіть страви нижче та натисніть «Надіслати»",barSendButton:"Надіслати",barResetButton:"Скинути",barName:"Назва бару",barNotesPlaceholder:"Додайте ваші побажання тут...",placeholderSuggestions:["Вино до пасти","Ідеально до риби","Рекомендуємо для вечірки"],headerLine1:"Поділіться будь-якими вашими думками —",headerLine2:"— і отримайте рекомендації щодо ідеального вина за секунди",headerMeal:"страва",headerMood:"настрій",headerBudget:"бюджет",headerOccasion:"подія",headerOr:"або",errorMessage:"Щось пішло не так. Будь ласка, спробуйте пізніше.",noResultsMessage:"За вашим запитом не знайдено результатів. Спробуйте інший запит.",ai_sommelier:"AI sommelier"},ru:{lang:"ru",welcomeMessage:"Что вы планируете поесть? Напишите ваше блюдо, и я подберу идеальное вино к нему.",noResultsFound:"Результаты не найдены.",somethingWentWrong:"Извините, что-то пошло не так.",chatButton1:"Найти сочетание",chatButton2:"Подобрать вино",chatButton3:"Получить совет",chatTitle:"Ассистент по подбору вина 🍷",chatSubtitle:"Опишите ваше блюдо и получите рекомендацию за 30 секунд",inputPlaceholder:"например, Тунец с салатом",sendButton:"Подобрать",poweredBy:"Powered by",price:"Цена",region:"Регион",type:"Тип",reason:"Рекомендация",moreInfo:"Подробнее",winePairingIntro:"К этому вину подходят следующие блюда:",askForDinner:"Что бы вы хотели на ужин?",clearChatButton:"Очистить чат",widgetTitle:"НАЙДИТЬ ИДЕАЛЬНОЕ ВИНО",widgetSubtitle:"Поделитесь вашими предпочтениями — блюдом, настроением, бюджетом или случаем — и наш AI-сомелье подберёт идеальное вино за секунды",searchPlaceholder:"Введите ключевое слово или описание","wineDetails.price":"Цена","wineDetails.region":"Регион","wineDetails.type":"Тип","wineDetails.moreInfo":"Подробнее","wineDetails.reason":"Причина","wineDetails.code":"Код","wineDetails.buy":"Купить",searchButton:"Поиск",priceRange:"Диапазон цен",wineColor:"Цвет вина",intensity:"Интенсивность",red:"Красное",white:"Белое",rose:"Розовое",light:"Лёгкое",medium:"Среднее",full:"Полное",barTitle:"Закуски к вину",barSubtitle:"Выберите блюда ниже и нажмите 'Отправить'",barSendButton:"Отправить",barResetButton:"Сбросить",barName:"Название бара",barNotesPlaceholder:"Добавьте ваши пожелания здесь...",placeholderSuggestions:["Вино для пасты","Идеально к рыбе","Рекомендуем для вечеринки"],headerLine1:"Поделитесь любыми вашими мыслями —",headerLine2:"— и получите рекомендации по идеальному вину за считанные секунды",headerMeal:"блюдо",headerMood:"настроение",headerBudget:"бюджет",headerOccasion:"случай",headerOr:"или",errorMessage:"Что-то пошло не так. Пожалуйста, попробуйте позже.",noResultsMessage:"По вашему запросу не найдено результатов. Попробуйте другой запрос.",ai_sommelier:"AI sommelier"},kk:{lang:"kk",welcomeMessage:"Сіз не жегіңіз келеді? Тағамыңызды сипаттаңыз, мен оған керемет шарап ұсынамын.",noResultsFound:"Нәтижелер табылмады.",somethingWentWrong:"Кешіріңіз, бірдеңе дұрыс болмады.",chatButton1:"Сәйкестік табу",chatButton2:"Шарап таңдау",chatButton3:"Кеңес алу",chatTitle:"Шарап таңдаушы көмекші 🍷",chatSubtitle:"Тағамыңызды сипаттаңыз — 30 секундта ұсыныс алыңыз",inputPlaceholder:"мысалы, тунец салатымен",sendButton:"Таңдау",poweredBy:"Powered by",price:"Бағасы",region:"Өңір",type:"Түрі",reason:"Ұсыныс",moreInfo:"Толығырақ",winePairingIntro:"Бұл шарапқа келесі тағамдар сәйкес келеді:",askForDinner:"Кешкі асқа не қалайсыз?",clearChatButton:"Чатты тазалау",widgetTitle:"КЕРЕМЕТ ШАРАПТЫ ТАБЫҢЫЗ",widgetSubtitle:"Таңдауларыңызды бөлісіңіз — тағам, көңіл-күй, бюджет немесе жағдай — және біздің AI-сомелье сізге бірнеше секундта шарап ұсынады",searchPlaceholder:"Кілт сөзді немесе сипаттаманы енгізіңіз","wineDetails.price":"Бағасы","wineDetails.region":"Өңір","wineDetails.type":"Түрі","wineDetails.moreInfo":"Толығырақ","wineDetails.reason":"Себебі","wineDetails.code":"Код","wineDetails.buy":"Сатып алу",searchButton:"Іздеу",priceRange:"Баға диапазоны",wineColor:"Шарап түсі",intensity:"Қанықтылық",red:"Қызыл",white:"Ақ",rose:"Розалық",light:"Жеңіл",medium:"Орташа",full:"Толық",barTitle:"Шарапқа арналған тіскебасарлар",barSubtitle:"Төмендегі тағамдарды таңдаңыз және 'Жіберу' батырмасын басыңыз",barSendButton:"Жіберу",barResetButton:"Қалпына келтіру",barName:"Бар атауы",barNotesPlaceholder:"Мұнда өз тілектеріңізді жазыңыз...",placeholderSuggestions:["Пастаға арналған шарап","Балыққа тамаша үйлеседі","Кешке ұсынуға болады"],headerLine1:"Ойларыңызбен бөлісіңіз —",headerLine2:"— және бірнеше секундта мінсіз шарап ұсынысын алыңыз",headerMeal:"тағам",headerMood:"көңіл-күй",headerBudget:"бюджет",headerOccasion:"жағдай",headerOr:"немесе",errorMessage:"Бірдеңе дұрыс болмады. Кейінірек қайта көріңіз.",noResultsMessage:"Іздеуіңізге сәйкес нәтиже табылмады. Басқа сұрау қолданып көріңіз.",ai_sommelier:"AI sommelier"}},Ad={en:"en-US",de:"de-DE",fr:"fr-FR",es:"es-ES",it:"it-IT",ja:"ja-JP",zh:"zh-CN",ru:"ru-RU",kk:"kk-KZ",pt:"pt-PT"};function Pd(t,e,s="en"){try{return new Intl.NumberFormat(Ad[s]||"en-US",{style:"currency",currency:e,currencyDisplay:"narrowSymbol"}).format(t)}catch{return t.toString()}}function _e({key:t,lang:e}){const s=Md;if(s[e]&&s[e][t])return s[e][t];throw new Error(`Translation for key "${t}" not found in language "${e}".`)}async function Ld({sourceLang:t,targetLang:e,texts:s,apiKey:n}){var u,l,h,d;if(!n||!t||!e||t===e)return s;const i="https://api.openai.com/v1/chat/completions",r={"Content-Type":"application/json",Authorization:`Bearer ${n}`},o=Object.entries(s).map(([f,p])=>({key:f,text:p})),a=`
|
|
20
20
|
You are a professional translator.
|
|
21
21
|
|
|
22
22
|
The input texts are written in language with code "${t}". Your task is to translate them strictly to the target language with code "${e}".
|
|
@@ -41,4 +41,59 @@ Output:
|
|
|
41
41
|
|
|
42
42
|
Now translate the following input:
|
|
43
43
|
${JSON.stringify(o,null,2)}
|
|
44
|
-
`,c=JSON.stringify({model:"gpt-3.5-turbo",messages:[{role:"system",content:"You are a professional translator."},{role:"user",content:a}],temperature:.2,max_tokens:1e3});try{const p=await(await fetch(i,{method:"POST",headers:r,body:c})).json(),m=(f=(h=(l=(u=p==null?void 0:p.choices)==null?void 0:u[0])==null?void 0:l.message)==null?void 0:h.content)==null?void 0:f.trim();if(!m)throw new Error("No response from OpenAI");const _=JSON.parse(m),C={};return _.forEach(T=>{T.key&&T.text!==void 0&&(C[T.key]=T.text)}),{...s,...C}}catch(d){return console.error("Error translating texts:",d),s}}function Bf(t){return{id:String(t.id),lang:t.lang,available_languages:t.available_languages?t.available_languages:[t.lang],open_ai_key:t.open_ai_key??null,currency:t.currency,title:t.title}}let ge=dt({storeConfig:null,currentLanguage:"en",isConfigLoaded:!1});const ke={getLanguageFromURL(){return new URLSearchParams(window.location.search).get("lang")},getAppLanguage(){return(ge==null?void 0:ge.currentLanguage)??"en"},getStoreLanguage(){var t;return((t=ge.storeConfig)==null?void 0:t.lang)??null},getApiKey(){var t;return((t=ge.storeConfig)==null?void 0:t.open_ai_key)??null},getStoreId(){var t;return((t=ge.storeConfig)==null?void 0:t.id)??null},setStoreLanguage(t){if(ge.storeConfig&&ge.storeConfig.available_languages.includes(t)){ge.currentLanguage=t;const e=new URLSearchParams(window.location.search);e.set("lang",t);const s=`${window.location.pathname}?${e.toString()}`;window.history.replaceState({},"",s)}else throw new Error(`Language ${t} is not available in store configuration.`)},getSupportedLanguages(){var t;return((t=ge.storeConfig)==null?void 0:t.available_languages)??["en"]},getCurrency(){var t;return((t=ge.storeConfig)==null?void 0:t.currency)??"USD"},async initializeStore(){try{const t=await nr.getStoreConfig();ge.storeConfig=Bf(t),ge.currentLanguage=ge.storeConfig.lang;const e=this.getLanguageFromURL();e&&ge.storeConfig.available_languages.includes(e)?this.setStoreLanguage(e):this.setStoreLanguage(ge.storeConfig.lang),ge.isConfigLoaded=!0}catch(t){console.error("Failed to initialize store:",t),ge.isConfigLoaded=!1}},isInitialized(){return ge.isConfigLoaded}};var Ff=X('<h1 class="wine-widget-big-title svelte-oiwvqb"> </h1>'),jf=X('<h1 class="wine-widget-big-title svelte-oiwvqb"> <span class="icon icon-meal svelte-oiwvqb"></span> <span class="icon-label svelte-oiwvqb"> </span>, <span class="icon icon-mood svelte-oiwvqb"></span> <span class="icon-label svelte-oiwvqb"> </span> <br/> <span class="icon icon-occasion svelte-oiwvqb"></span> <span class="icon-label svelte-oiwvqb"> </span> </h1>'),zf=X('<div id="wine-widget-header" class="svelte-oiwvqb"><!></div>');function Uf(t,e){var c;Lt(e,!0);let s=pe(()=>ke.getAppLanguage());const n=((c=window==null?void 0:window.wineaterData)==null?void 0:c.TITLE_TEXT)||null;var i=zf(),r=L(i);{var o=u=>{var l=Ff(),h=L(l);te(()=>Z(h,n)),W(u,l)},a=u=>{var l=jf(),h=L(l),f=Y(h,3),d=L(f),p=Y(f,4),m=L(p),_=Y(p,3),C=Y(_,3),T=L(C),y=Y(C);te((g,v,I,x,S,k)=>{Z(h,`${g??""} `),Z(d,v),Z(m,I),Z(_,` ${x??""} `),Z(T,S),Z(y,` ${k??""}`)},[()=>_e({key:"headerLine1",lang:w(s)}),()=>_e({key:"headerMeal",lang:w(s)}),()=>_e({key:"headerMood",lang:w(s)}),()=>_e({key:"headerOr",lang:w(s)}),()=>_e({key:"headerOccasion",lang:w(s)}),()=>_e({key:"headerLine2",lang:w(s)})]),W(u,l)};ie(r,u=>{n?u(o):u(a,!1)})}W(t,i),Bt()}function Wf(t,e,s){const i=t.target.value;$e(it.LANGUAGE_CHANGED,w(e),{from_language:w(s),to_language:i}),ke.setStoreLanguage(i)}var Hf=X("<option> </option>"),qf=X('<select id="language-dropdown" class="language-dropdown svelte-1sr6y3t"></select>'),Vf=X('<div id="powered-by-widget" class="svelte-1sr6y3t"><div class="powered-by-center svelte-1sr6y3t"><a href="https://wineater.com" target="_blank" class="svelte-1sr6y3t"><span> </span> <img alt="Wineater Logo" class="svelte-1sr6y3t"/> <span class="powered-by-sommelier svelte-1sr6y3t"> </span></a></div> <div class="powered-by-lang svelte-1sr6y3t"><!></div></div>');function Gf(t,e){Lt(e,!0);let s=lo(e,"countryCode",3,null),n=pe(()=>ke.getAppLanguage()),i=pe(()=>ke.getSupportedLanguages()),r=pe(()=>ke.getStoreId());var o=Vf(),a=L(o),c=L(a),u=L(c),l=L(u),h=Y(u,2),f=Y(h,2),d=L(f),p=Y(a,2),m=L(p);{var _=C=>{var T=qf();T.__change=[Wf,r,n],Us(T,21,()=>w(i),zs,(g,v)=>{var I=Hf(),x=L(I),S={};te(k=>{fc(I,w(v)===w(n)),Z(x,k),S!==(S=w(v))&&(I.value=(I.__value=w(v))??"")},[()=>w(v).toUpperCase()]),W(g,I)});var y;cc(T),te(()=>{y!==(y=w(n))&&(T.value=(T.__value=w(n))??"",io(T,w(n)))}),W(C,T)};ie(m,C=>{w(i).length>1&&C(_)})}te((C,T)=>{Z(l,C),hn(h,"src",s()==="ru"?"https://czvgkhagwvmknscoerfy.supabase.co/storage/v1/object/public/static-media/divino_logo.svg?x=5":"https://czvgkhagwvmknscoerfy.supabase.co/storage/v1/object/public/static-media/logo_medium_gray.svg"),Z(d,T)},[()=>_e({key:"poweredBy",lang:w(n)}),()=>_e({key:"ai_sommelier",lang:w(n)})]),W(t,o),Bt()}ci(["change"]);var Kf=X('<form id="wine-widget-search" class="svelte-1wah7ro"><span class="search-icon svelte-1wah7ro"></span> <input id="wine-search-input" type="text" class="svelte-1wah7ro"/> <button id="wine-search-button" type="submit" class="svelte-1wah7ro"> </button></form>');function Xf(t,e){Lt(e,!0);let s=lo(e,"searchQuery",15),n,i=oe(!1),r=oe(0),o=oe(0),a=oe(!0),c=oe(!1),u=pe(()=>ke.getAppLanguage()),l=0;function h(){return n}function f(){const v=++l,I=_e({key:"placeholderSuggestions",lang:w(u)});if(!n||!I.length)return;M(c,!0);const x=()=>{if(v!==l||!n||!w(c)||w(i)||s().length)return;const S=I[w(r)];if(w(a)){if(n.placeholder=S.substring(0,xr(o)),w(o)>S.length){M(a,!1),setTimeout(x,1600);return}setTimeout(x,90)}else{if(n.placeholder=S.substring(0,xr(o,-1)),w(o)<0){M(a,!0),M(r,(w(r)+1)%I.length),setTimeout(x,450);return}setTimeout(x,45)}};x()}function d(){M(c,!1)}function p(){M(i,!0),d(),n&&(n.placeholder="")}function m(){M(i,!1),M(o,0),M(a,!0),M(c,!1)}an(()=>{if(!n||s().length>0)return;l++,M(c,!1),M(r,0),M(o,0),M(a,!0);const v=_e({key:"placeholderSuggestions",lang:w(u)});v&&v.length?n.placeholder=v[0]:n.placeholder=_e({key:"searchPlaceholder",lang:w(u)})}),an(()=>{n&&e.initialized&&!w(i)&&!s().length&&!w(c)&&f(),s().length>0&&w(c)&&(M(c,!1),l++)}),hi(()=>{});var _={getSearchElement:h},C=Kf(),T=Y(L(C),2);mc(T,v=>n=v,()=>n);var y=Y(T,2),g=L(y);return te(v=>Z(g,v),[()=>_e({key:"searchButton",lang:w(u)})]),Bs("submit",C,function(...v){var I;(I=e.onSubmit)==null||I.apply(this,v)}),Bs("focus",T,p),Bs("blur",T,m),gc(T,s),W(t,C),Bt(_)}wl();var Jf=X('<div id="loading-indicator" class="svelte-li6gfl"><div id="typing-indicator" class="typing-indicator svelte-li6gfl"><span class="svelte-li6gfl"></span> <span class="svelte-li6gfl"></span> <span class="svelte-li6gfl"></span></div></div>');function Yf(t){var e=Jf();W(t,e)}var Qf=X('<p class="popup-short-desc svelte-17gehox"> </p>'),Zf=X('<div class="popup-reason svelte-17gehox"> </div>'),$f=X('<p class="popup-pairing svelte-17gehox"> </p>'),ed=X('<span class="popup-tag svelte-17gehox"> </span>'),td=X('<div class="popup-tags svelte-17gehox"></div>'),sd=X('<div class="mobile-fullscreen-wrapper svelte-17gehox"><div class="mobile-fullscreen-overlay svelte-17gehox"></div> <div class="mobile-fullscreen-popup svelte-17gehox"><div class="card-popup svelte-17gehox"><div class="card-popup-header svelte-17gehox"><h2 class="svelte-17gehox"> </h2> <button class="card-popup-close svelte-17gehox">×</button></div> <!> <!> <!></div></div></div>'),nd=X('<p class="popup-short-desc svelte-17gehox"> </p>'),id=X('<div class="popup-reason svelte-17gehox"> </div>'),rd=X('<p class="popup-pairing svelte-17gehox"> </p>'),od=X('<span class="popup-tag svelte-17gehox"> </span>'),ad=X('<div class="popup-tags svelte-17gehox"></div>'),ld=X('<div class="card-popup svelte-17gehox"><div class="card-popup-header svelte-17gehox"><h2 class="svelte-17gehox"> </h2> <button class="card-popup-close svelte-17gehox">×</button></div> <!> <!> <!></div>');function Aa(t,e){Lt(e,!0);const s=!!e.isMobile;var n=js(),i=ls(n);{var r=a=>{var c=sd(),u=L(c);u.__click=function(...x){var S;(S=e.onClose)==null||S.apply(this,x)};var l=Y(u,2),h=L(l),f=L(h),d=L(f),p=L(d),m=Y(d,2);m.__click=function(...x){var S;(S=e.onClose)==null||S.apply(this,x)};var _=Y(f,2);{var C=x=>{var S=Qf(),k=L(S);te(()=>Z(k,e.shortDescription)),W(x,S)};ie(_,x=>{e.shortDescription&&x(C)})}var T=Y(_,2);{var y=x=>{var S=Zf(),k=L(S);te(()=>Z(k,e.reason)),W(x,S)},g=x=>{var S=js(),k=ls(S);{var A=j=>{var F=$f(),G=L(F);te(()=>Z(G,e.pairing)),W(j,F)};ie(k,j=>{e.pairing&&j(A)},!0)}W(x,S)};ie(T,x=>{e.reason?x(y):x(g,!1)})}var v=Y(T,2);{var I=x=>{var S=td();Us(S,21,()=>e.tags,zs,(k,A)=>{var j=ed(),F=L(j);te(()=>Z(F,w(A))),W(k,j)}),W(x,S)};ie(v,x=>{e.tags&&e.tags.length&&x(I)})}te(()=>Z(p,e.title)),W(a,c)},o=a=>{var c=ld(),u=L(c),l=L(u),h=L(l),f=Y(l,2);f.__click=function(...g){var v;(v=e.onClose)==null||v.apply(this,g)};var d=Y(u,2);{var p=g=>{var v=nd(),I=L(v);te(()=>Z(I,e.shortDescription)),W(g,v)};ie(d,g=>{e.shortDescription&&g(p)})}var m=Y(d,2);{var _=g=>{var v=id(),I=L(v);te(()=>Z(I,e.reason)),W(g,v)},C=g=>{var v=js(),I=ls(v);{var x=S=>{var k=rd(),A=L(k);te(()=>Z(A,e.pairing)),W(S,k)};ie(I,S=>{e.pairing&&S(x)},!0)}W(g,v)};ie(m,g=>{e.reason?g(_):g(C,!1)})}var T=Y(m,2);{var y=g=>{var v=ad();Us(v,21,()=>e.tags,zs,(I,x)=>{var S=od(),k=L(S);te(()=>Z(k,w(x))),W(I,S)}),W(g,v)};ie(T,g=>{e.tags&&e.tags.length&&g(y)})}te(()=>Z(h,e.title)),W(a,c)};ie(i,a=>{s?a(r):a(o,!1)})}W(t,n),Bt()}ci(["click"]);var cd=(t,e)=>e.onTileClick(t,e.wine),ud=X('<img class="wine-image svelte-yk3emv"/>'),hd=X('<div class="wine-price svelte-yk3emv"> </div>'),fd=X('<div class="wine-params svelte-yk3emv"> </div>'),dd=X('<a class="buy-btn svelte-yk3emv" target="_blank"> </a>'),pd=(t,e)=>e.onBuyClick(e.wine,e.index),gd=X('<button class="buy-btn svelte-yk3emv" type="button"> </button>'),md=X('<div class="popup-reason svelte-yk3emv"> </div>'),vd=X('<span class="popup-tag svelte-yk3emv"> </span>'),bd=X('<div class="popup-tags svelte-yk3emv"></div>'),yd=X("<div><!> <!></div>"),wd=X('<div><div class="tile-top svelte-yk3emv"><!> <!> <h3 class="wine-title svelte-yk3emv"> </h3></div> <!> <div class="bottom-row svelte-yk3emv"><!></div> <!> <!></div> <!>',1);function Sd(t,e){Lt(e,!0);let s=pe(()=>ke.getAppLanguage());const n=(E,D)=>E[D]||E[D.charAt(0).toUpperCase()+D.slice(1)],i=(E,D)=>D.map(O=>n(E,O)).filter(Boolean).join(" • ");function r(E){var D;return Pf(E,((D=ke.getCurrency)==null?void 0:D.call(ke))||"USD",w(s))}function o(E){return e.selectedWineId===E}function a(E){return!!(E.reason||E.shortDescription||E.tags)}function c(E,D){let O=(E==null?void 0:E.tags)||D.tags;return O?(Array.isArray(O)&&(O=O.join(",")),typeof O!="string"?[]:O.split(",").map(N=>N.trim()).filter(Boolean)):[]}let u=oe(!1);hi(()=>{const E=()=>{M(u,window.innerWidth<=768)};return E(),window.addEventListener("resize",E),()=>{window.removeEventListener("resize",E)}});var l=wd(),h=ls(l);h.__click=[cd,e];var f=L(h),d=L(f);{var p=E=>{var D=ud();te(()=>{hn(D,"src",e.wine.image),hn(D,"alt",e.wine.title)}),W(E,D)};ie(d,E=>{e.wine.image&&E(p)})}var m=Y(d,2);{var _=E=>{var D=hd(),O=L(D);te(N=>Z(O,N),[()=>r(e.wine.total)]),W(E,D)};ie(m,E=>{e.wine.total&&E(_)})}var C=Y(m,2),T=L(C),y=Y(f,2);{var g=E=>{var D=fd(),O=L(D);te(N=>Z(O,N),[()=>i(e.wine,["type","country","region","grape"])]),W(E,D)};ie(y,E=>{i(e.wine,["type","country","region","grape"])&&E(g)})}var v=Y(y,2),I=L(v);{var x=E=>{var D=dd(),O=L(D);te(N=>{hn(D,"href",e.wine.url),Z(O,N)},[()=>_e({key:"wineDetails.buy",lang:w(s)})]),W(E,D)},S=E=>{var D=gd();D.__click=[pd,e];var O=L(D);te(N=>Z(O,N),[()=>_e({key:"moreInfo",lang:w(s)})]),W(E,D)};ie(I,E=>{e.wine.url?E(x):E(S,!1)})}var k=Y(v,2);{var A=E=>{{let D=pe(()=>{var J;return((J=e.translatedPopup)==null?void 0:J.shortDescription)||e.wine.shortDescription}),O=pe(()=>{var J;return((J=e.translatedPopup)==null?void 0:J.reason)||e.wine.reason}),N=pe(()=>{var J;return((J=e.translatedPopup)==null?void 0:J.pairingRecommendation)||e.wine.pairingRecommendation}),V=pe(()=>c(e.translatedPopup,e.wine));Aa(E,{get title(){return e.wine.title},get shortDescription(){return w(D)},get reason(){return w(O)},get pairing(){return w(N)},get tags(){return w(V)},get onClose(){return e.onPopupClose},isMobile:!1})}};ie(k,E=>{o(e.wine.id)&&!w(u)&&E(A)})}var j=Y(k,2);{var F=E=>{var D=yd(),O=L(D);{var N=se=>{var fe=md(),me=L(fe);te(()=>{var R,P;return Z(me,((R=e.translatedPopup)==null?void 0:R.reason)||((P=e.translatedPopup)==null?void 0:P.shortDescription)||e.wine.reason||e.wine.shortDescription)}),W(se,fe)};ie(O,se=>{var fe,me;((fe=e.translatedPopup)!=null&&fe.reason||(me=e.translatedPopup)!=null&&me.shortDescription||e.wine.reason||e.wine.shortDescription)&&se(N)})}var V=Y(O,2);{var J=se=>{var fe=bd();Us(fe,21,()=>c(e.translatedPopup,e.wine),zs,(me,R)=>{var P=vd(),re=L(P);te(()=>Z(re,w(R))),W(me,P)}),W(se,fe)};ie(V,se=>{var fe,me;((fe=e.translatedPopup)!=null&&fe.tags||(me=e.translatedPopup)!=null&&me.Tags||e.wine.tags)&&se(J)})}te(()=>no(D,1,`wine-hover-popup ${e.hoveredWineId===e.wine.id?"slide-in visible":""}`,"svelte-yk3emv")),W(E,D)};ie(j,E=>{a(e.wine)&&E(F)})}var G=Y(h,2);{var z=E=>{{let D=pe(()=>{var J;return((J=e.translatedPopup)==null?void 0:J.shortDescription)||e.wine.shortDescription}),O=pe(()=>{var J;return((J=e.translatedPopup)==null?void 0:J.reason)||e.wine.reason}),N=pe(()=>{var J;return((J=e.translatedPopup)==null?void 0:J.pairingRecommendation)||e.wine.pairingRecommendation}),V=pe(()=>c(e.translatedPopup,e.wine));Aa(E,{get title(){return e.wine.title},get shortDescription(){return w(D)},get reason(){return w(O)},get pairing(){return w(N)},get tags(){return w(V)},get onClose(){return e.onPopupClose},isMobile:!0})}};ie(G,E=>{o(e.wine.id)&&w(u)&&E(z)})}te(()=>{no(h,1,`wine-recommendation-tile ${e.isAnimating?"ww-slide-up":""}`,"svelte-yk3emv"),Z(T,e.wine.title)}),Bs("mouseenter",h,()=>e.onTileEnter(e.wine)),Bs("mouseleave",h,()=>e.onTileLeave(e.wine)),W(t,l),Bt()}ci(["click"]);var _d=X('<div class="error-message svelte-1n46o8q"><p> </p></div>'),kd=X('<div id="wine-placeholder" class="svelte-1n46o8q"></div>'),Td=X('<div id="wine-widget-container" class="svelte-wineater-widget-container svelte-1n46o8q"><div class="wine-widget-wrapper svelte-1n46o8q"><!> <!> <!> <div id="wine-widget-right" class="svelte-1n46o8q"><!></div> <!></div></div>');function Ed(t,e){var se,fe,me;Lt(e,!0);function s(){var R;gi("chatbotToken",((R=window.wineaterData)==null?void 0:R.CLIENT_TOKEN)||n,365),uo()}const n="HeUw6IXuhvz6tRuXdPEGEbj3SGQ3Q2YtEc1Z8jd41Kg9LtyPb4Epu0to31SYIadG";new xf({projectKey:"PA8j9fAi49i6g2QnvpNs",__DISABLE_SECURE_MODE:!0}).start(),s();const r=((se=window==null?void 0:window.wineaterData)==null?void 0:se.WIDGET_TYPE)||"store",o=((fe=window==null?void 0:window.wineaterData)==null?void 0:fe.COUNTRY_CODE)||null;(me=window==null?void 0:window.wineaterData)!=null&&me.WIDGET_WRAPPER;let a=oe(!1),c=oe(!1),u=oe(dt([])),l=oe(null),h=oe(""),f=oe(null),d=oe(!1),p=oe(null),m=oe(dt([])),_=pe(()=>ke.getAppLanguage()),C=pe(()=>ke.getStoreLanguage()),T=pe(()=>ke.getApiKey()),y=pe(()=>ke.getStoreId()),g=pe(()=>ke.isInitialized());function v(){M(f,_e({key:"errorMessage",lang:w(_)}),!0)}const I=()=>M(f,null);async function x(R){if(w(_)===w(C)||r!=="bar")return R.map(()=>({}));const P=["shortDescription","reason","pairingRecommendation","tags"],re=R[0];if(!re)return R.map(()=>({}));const yt=P.filter(Je=>Je in re),wt=4,Zt=[];for(let Je=0;Je<R.length;Je+=wt){const xs=R.slice(Je,Je+wt).map(async Dt=>{const Wn=yt.map(He=>{const Rt=Dt[He]||Dt[He.toLowerCase()];return Rt?{key:He,text:Array.isArray(Rt)?Rt.join(", "):Rt}:null}).filter(Boolean);return Wn.length===0?{}:await Lf({sourceLang:w(C),targetLang:w(_),texts:Object.fromEntries(Wn.map(He=>[He.key,He.text])),apiKey:w(T)})}),$t=await Promise.all(xs);Zt.push(...$t)}return Zt}async function S(){M(c,!0);try{M(u,await nr.getInstantRecommendations(),!0)}catch{v()}finally{M(c,!1)}}function k(R=220){return!w(u)||w(u).length===0?Promise.resolve():(M(d,!0),new Promise(P=>{setTimeout(()=>{P()},R)}))}async function A(R){R.preventDefault();let P="";try{M(c,!0),I(),await k(220),M(u,[],!0),M(d,!1),P=w(h).trim()+";";try{$e(it.SEARCH_PERFORMED,w(y),{query:P})}catch(yt){console.error("Error tracking search event:",yt)}const re=await nr.getWineRecommendationsSearch(P);!re||re.length===0?(M(u,[],!0),M(m,[],!0),M(f,_e({key:"noResultsMessage",lang:w(_)}),!0),$e(it.NO_RESULTS_FOUND,w(y),{query:P})):(M(u,re,!0),$e(it.SEARCH_RESULTS_DISPLAYED,w(y),{results_count:re.length,results:re,query:P}))}catch(re){M(u,[],!0),$e(it.ERROR_OCCURRED,w(y),{error_message:re==null?void 0:re.message,query:P}),v()}finally{M(c,!1)}}an(async()=>{if(!w(u)||w(u).length===0){M(m,[],!0);return}try{const R=await x(w(u));w(u)&&w(u).length>0&&M(m,R,!0)}catch(R){console.error("translatePopupContent failed",R)}});function j(R,P){w(l)&&w(l)!==R.id&&M(l,null),M(l,R.id,!0),$e(it.WINE_DETAILS_VIEWED,w(y),{wine_id:R.id,wine_title:R.title,is_mobile:window.innerWidth<=768})}function F(){const R=w(u).find(P=>P.id===w(l));$e(it.WINE_DETAILS_CLOSED,w(y),{wine_id:w(l),wine_title:R.title}),M(l,null)}function G(R){return!!(R.reason||R.shortDescription||R.tags)}function z(R){r==="store"&&G(R)&&(M(p,R.id,!0),$e(it.WINE_CARD_HOVER,w(y),{wine_id:R.id,wine_title:R.title}))}function E(R){r==="store"&&w(p)===R.id&&M(p,null)}function D(R,P){R.target.closest(".buy-btn")||R.target.closest(".card-popup-close")||$e(it.WINE_CARD_CLICK,w(y),{wine_id:P.id,wine_title:P.title})}function O(R){const P=R.target;P.closest(".card-popup")||P.closest(".buy-btn")||M(l,null)}hi(async()=>{var P;if(await ke.initializeStore(),!w(g))return;const R=((P=window==null?void 0:window.wineaterData)==null?void 0:P.COLOR)||"#7B2BEB";return document.documentElement.style.setProperty("--wineater-color",R),await S(),$e(it.WIDGET_INITIALIZED,w(y)),M(a,!0),document.addEventListener("click",O),()=>{document.removeEventListener("click",O)}});var N=js(),V=ls(N);{var J=R=>{var P=Td(),re=L(P),yt=L(re);Uf(yt,{});var wt=Y(yt,2);Xf(wt,{onSubmit:A,get initialized(){return w(a)},get searchQuery(){return w(h)},set searchQuery(Pe){M(h,Pe,!0)}});var Zt=Y(wt,2);{var Je=Pe=>{Yf(Pe)};ie(Zt,Pe=>{w(c)&&Pe(Je)})}var Cs=Y(Zt,2),xs=L(Cs);{var $t=Pe=>{var He=_d(),Rt=L(He),rr=L(Rt);te(()=>Z(rr,w(f))),W(Pe,He)},Dt=Pe=>{var He=js(),Rt=ls(He);{var rr=or=>{var Ba=kd();Us(Ba,21,()=>w(u),zs,(Id,Cd,Fa)=>{Sd(Id,{get wine(){return w(Cd)},index:Fa,get hoveredWineId(){return w(p)},get selectedWineId(){return w(l)},get isAnimating(){return w(d)},get translatedPopup(){return w(m)[Fa]},onBuyClick:j,onPopupClose:F,onTileEnter:z,onTileLeave:E,onTileClick:D})}),W(or,Ba)};ie(Rt,or=>{w(u)&&w(u).length>0&&or(rr)},!0)}W(Pe,He)};ie(xs,Pe=>{w(f)?Pe($t):Pe(Dt,!1)})}var Wn=Y(Cs,2);Gf(Wn,{get countryCode(){return o}}),W(R,P)};ie(V,R=>{w(g)&&R(J)})}W(t,N),Bt()}return tc(Ed,{target:document.getElementById("wineater-widget-conteiner")})});
|
|
44
|
+
`,c=JSON.stringify({model:"gpt-3.5-turbo",messages:[{role:"system",content:"You are a professional translator."},{role:"user",content:a}],temperature:.2,max_tokens:1e3});try{const p=await(await fetch(i,{method:"POST",headers:r,body:c})).json(),m=(d=(h=(l=(u=p==null?void 0:p.choices)==null?void 0:u[0])==null?void 0:l.message)==null?void 0:h.content)==null?void 0:d.trim();if(!m)throw new Error("No response from OpenAI");const _=JSON.parse(m),I={};return _.forEach(T=>{T.key&&T.text!==void 0&&(I[T.key]=T.text)}),{...s,...I}}catch(f){return console.error("Error translating texts:",f),s}}function Bd(t){return{id:String(t.id),lang:t.lang,available_languages:t.available_languages?t.available_languages:[t.lang],open_ai_key:t.open_ai_key??null,currency:t.currency,title:t.title}}let ge=ft({storeConfig:null,currentLanguage:"en",isConfigLoaded:!1});const ke={getLanguageFromURL(){return new URLSearchParams(window.location.search).get("lang")},getAppLanguage(){return(ge==null?void 0:ge.currentLanguage)??"en"},getStoreLanguage(){var t;return((t=ge.storeConfig)==null?void 0:t.lang)??null},getApiKey(){var t;return((t=ge.storeConfig)==null?void 0:t.open_ai_key)??null},getStoreId(){var t;return((t=ge.storeConfig)==null?void 0:t.id)??null},setStoreLanguage(t){if(ge.storeConfig&&ge.storeConfig.available_languages.includes(t)){ge.currentLanguage=t;const e=new URLSearchParams(window.location.search);e.set("lang",t);const s=`${window.location.pathname}?${e.toString()}`;window.history.replaceState({},"",s)}else throw new Error(`Language ${t} is not available in store configuration.`)},getSupportedLanguages(){var t;return((t=ge.storeConfig)==null?void 0:t.available_languages)??["en"]},getCurrency(){var t;return((t=ge.storeConfig)==null?void 0:t.currency)??"USD"},async initializeStore(){try{const t=await ir.getStoreConfig();ge.storeConfig=Bd(t),ge.currentLanguage=ge.storeConfig.lang;const e=this.getLanguageFromURL();e&&ge.storeConfig.available_languages.includes(e)?this.setStoreLanguage(e):this.setStoreLanguage(ge.storeConfig.lang),ge.isConfigLoaded=!0}catch(t){console.error("Failed to initialize store:",t),ge.isConfigLoaded=!1}},isInitialized(){return ge.isConfigLoaded}};var Fd=X('<h1 class="wine-widget-big-title svelte-oiwvqb"> </h1>'),zd=X('<h1 class="wine-widget-big-title svelte-oiwvqb"> <span class="icon icon-meal svelte-oiwvqb"></span> <span class="icon-label svelte-oiwvqb"> </span>, <span class="icon icon-mood svelte-oiwvqb"></span> <span class="icon-label svelte-oiwvqb"> </span> <br/> <span class="icon icon-occasion svelte-oiwvqb"></span> <span class="icon-label svelte-oiwvqb"> </span> </h1>'),jd=X('<div id="wine-widget-header" class="svelte-oiwvqb"><!></div>');const Ud={hash:"svelte-oiwvqb",code:`#wine-widget-header.svelte-oiwvqb h1:where(.svelte-oiwvqb) {font-family:'Bricolage Grotesque', serif;font-weight:600;font-size:24px;margin:0 auto;line-height:1.3;color:#333;text-align:center;}.icon.svelte-oiwvqb {display:inline-block;width:1.2em;height:1.2em;vertical-align:middle;margin:0 4px 0 2px;background-repeat:no-repeat;background-size:contain;}.icon-meal.svelte-oiwvqb {background-image:url('https://czvgkhagwvmknscoerfy.supabase.co/storage/v1/object/public/static-media//meal1.svg');}.icon-meal.svelte-oiwvqb:hover {background-image:url('https://czvgkhagwvmknscoerfy.supabase.co/storage/v1/object/public/static-media//meal3.svg');}.icon-mood.svelte-oiwvqb {background-image:url('https://czvgkhagwvmknscoerfy.supabase.co/storage/v1/object/public/static-media//mood.svg');}.icon-occasion.svelte-oiwvqb {background-image:url('https://czvgkhagwvmknscoerfy.supabase.co/storage/v1/object/public/static-media//ocasion.svg');}.icon-label.svelte-oiwvqb {color:var(--wineater-color);font-weight:500;}
|
|
45
|
+
|
|
46
|
+
@media screen and (max-width: 768px) {#wine-widget-header.svelte-oiwvqb h1:where(.svelte-oiwvqb) {display:none;}
|
|
47
|
+
}`};function qd(t,e){var c;Lt(e,!0),Ht(t,Ud);let s=pe(()=>ke.getAppLanguage());const n=((c=window==null?void 0:window.wineaterData)==null?void 0:c.TITLE_TEXT)||null;var i=jd(),r=L(i);{var o=u=>{var l=Fd(),h=L(l);te(()=>Z(h,n)),q(u,l)},a=u=>{var l=zd(),h=L(l),d=J(h,3),f=L(d),p=J(d,4),m=L(p),_=J(p,3),I=J(_,3),T=L(I),y=J(I);te((g,v,E,C,S,k)=>{Z(h,`${g??""} `),Z(f,v),Z(m,E),Z(_,` ${C??""} `),Z(T,S),Z(y,` ${k??""}`)},[()=>_e({key:"headerLine1",lang:w(s)}),()=>_e({key:"headerMeal",lang:w(s)}),()=>_e({key:"headerMood",lang:w(s)}),()=>_e({key:"headerOr",lang:w(s)}),()=>_e({key:"headerOccasion",lang:w(s)}),()=>_e({key:"headerLine2",lang:w(s)})]),q(u,l)};ie(r,u=>{n?u(o):u(a,!1)})}q(t,i),Bt()}function Wd(t,e,s){const i=t.target.value;$e(it.LANGUAGE_CHANGED,w(e),{from_language:w(s),to_language:i}),ke.setStoreLanguage(i)}var Hd=X("<option> </option>"),Vd=X('<select id="language-dropdown" class="language-dropdown svelte-1sr6y3t"></select>'),Gd=X('<div id="powered-by-widget" class="svelte-1sr6y3t"><div class="powered-by-center svelte-1sr6y3t"><a href="https://wineater.com" target="_blank" class="svelte-1sr6y3t"><span> </span> <img alt="Wineater Logo" class="svelte-1sr6y3t"/> <span class="powered-by-sommelier svelte-1sr6y3t"> </span></a></div> <div class="powered-by-lang svelte-1sr6y3t"><!></div></div>');const Kd={hash:"svelte-1sr6y3t",code:`#powered-by-widget.svelte-1sr6y3t {position:relative;border-top:2px solid #f6f7fd;font-family:'Bricolage Grotesque', sans-serif;font-weight:200;padding:12px 24px;min-height:40px;}#powered-by-widget.svelte-1sr6y3t .powered-by-center:where(.svelte-1sr6y3t) {position:absolute;left:50%;transform:translateX(-50%);text-align:center;}#powered-by-widget.svelte-1sr6y3t .powered-by-lang:where(.svelte-1sr6y3t) {position:absolute;right:0px;top:50%;transform:translateY(-50%);}.language-dropdown.svelte-1sr6y3t {padding:4px;border-radius:6px;border:2px solid var(--wineater-color);background-color:white;color:var(--wineater-color);font-weight:500;font-family:'Bricolage Grotesque', sans-serif;font-size:12px;cursor:pointer;transition:all 0.2s ease;}.language-dropdown.svelte-1sr6y3t:hover {box-shadow:0 4px 8px rgba(123, 43, 235, 0.2);}#powered-by-widget.svelte-1sr6y3t a:where(.svelte-1sr6y3t) {text-decoration:none;display:flex;align-items:center;white-space:nowrap;gap:8px;color:#a8a8a8;font-size:12px;line-height:16px;transition:opacity 0.2s ease;}#powered-by-widget.svelte-1sr6y3t a:where(.svelte-1sr6y3t):hover {opacity:0.8;}#powered-by-widget.svelte-1sr6y3t img:where(.svelte-1sr6y3t) {height:16px;width:auto;color:#a8a8a8;}
|
|
48
|
+
|
|
49
|
+
@media screen and (max-width: 768px) {.powered-by-sommelier.svelte-1sr6y3t {display:none;}
|
|
50
|
+
}`};function Xd(t,e){Lt(e,!0),Ht(t,Kd);let s=uo(e,"countryCode",3,null),n=pe(()=>ke.getAppLanguage()),i=pe(()=>ke.getSupportedLanguages()),r=pe(()=>ke.getStoreId());var o=Gd(),a=L(o),c=L(a),u=L(c),l=L(u),h=J(u,2),d=J(h,2),f=L(d),p=J(a,2),m=L(p);{var _=I=>{var T=Vd();T.__change=[Wd,r,n],qs(T,21,()=>w(i),Us,(g,v)=>{var E=Hd(),C=L(E),S={};te(k=>{fc(E,w(v)===w(n)),Z(C,k),S!==(S=w(v))&&(E.value=(E.__value=w(v))??"")},[()=>w(v).toUpperCase()]),q(g,E)});var y;uc(T),te(()=>{y!==(y=w(n))&&(T.value=(T.__value=w(n))??"",oo(T,w(n)))}),q(I,T)};ie(m,I=>{w(i).length>1&&I(_)})}te((I,T)=>{Z(l,I),dn(h,"src",s()==="ru"?"https://czvgkhagwvmknscoerfy.supabase.co/storage/v1/object/public/static-media/divino_logo.svg?x=5":"https://czvgkhagwvmknscoerfy.supabase.co/storage/v1/object/public/static-media/logo_medium_gray.svg"),Z(f,T)},[()=>_e({key:"poweredBy",lang:w(n)}),()=>_e({key:"ai_sommelier",lang:w(n)})]),q(t,o),Bt()}ui(["change"]);var Yd=X('<form id="wine-widget-search" class="svelte-1wah7ro"><span class="search-icon svelte-1wah7ro"></span> <input id="wine-search-input" type="text" class="svelte-1wah7ro"/> <button id="wine-search-button" type="submit" class="svelte-1wah7ro"> </button></form>');const Jd={hash:"svelte-1wah7ro",code:`#wine-widget-search.svelte-1wah7ro {position:relative;margin:12px auto;padding:0 6px;display:flex;align-items:center;border:2px solid #d5d9ee;border-radius:10px;}.search-icon.svelte-1wah7ro {left:12px;width:24px;height:24px;flex:0 0 auto;background-image:url('https://czvgkhagwvmknscoerfy.supabase.co/storage/v1/object/public/static-media//search.svg?x=1');background-repeat:no-repeat;background-size:contain;z-index:2;}#wine-search-input.svelte-1wah7ro {flex:1 1 0%;min-width:0;padding:12px;font-size:16px;border:none;border-radius:10px;outline:none;transition:border 0.2s ease;}#wine-search-input.svelte-1wah7ro::placeholder {color:var(--wineater-color);opacity:1;transition:color 0.3s ease,
|
|
51
|
+
opacity 0.3s ease-in-out;}#wine-search-input.svelte-1wah7ro:focus {border-color:var(--wineater-color);}#wine-search-input.svelte-1wah7ro:focus::placeholder {opacity:0.5;}#wine-search-button.svelte-1wah7ro {flex:0 0 auto;background-color:var(--wineater-color);color:#fff;border:none;border-radius:6px;padding:8px 16px;font-size:16px;cursor:pointer;transition:opacity 0.2s ease;}#wine-search-button.svelte-1wah7ro:hover {opacity:0.8;}`};function Qd(t,e){Lt(e,!0),Ht(t,Jd);let s=uo(e,"searchQuery",15),n,i=oe(!1),r=oe(0),o=oe(0),a=oe(!0),c=oe(!1),u=pe(()=>ke.getAppLanguage()),l=0;function h(){return n}function d(){const v=++l,E=_e({key:"placeholderSuggestions",lang:w(u)});if(!n||!E.length)return;M(c,!0);const C=()=>{if(v!==l||!n||!w(c)||w(i)||s().length)return;const S=E[w(r)];if(w(a)){if(n.placeholder=S.substring(0,Nr(o)),w(o)>S.length){M(a,!1),setTimeout(C,1600);return}setTimeout(C,90)}else{if(n.placeholder=S.substring(0,Nr(o,-1)),w(o)<0){M(a,!0),M(r,(w(r)+1)%E.length),setTimeout(C,450);return}setTimeout(C,45)}};C()}function f(){M(c,!1)}function p(){M(i,!0),f(),n&&(n.placeholder="")}function m(){M(i,!1),M(o,0),M(a,!0),M(c,!1)}ln(()=>{if(!n||s().length>0)return;l++,M(c,!1),M(r,0),M(o,0),M(a,!0);const v=_e({key:"placeholderSuggestions",lang:w(u)});v&&v.length?n.placeholder=v[0]:n.placeholder=_e({key:"searchPlaceholder",lang:w(u)})}),ln(()=>{n&&e.initialized&&!w(i)&&!s().length&&!w(c)&&d(),s().length>0&&w(c)&&(M(c,!1),l++)}),di(()=>{});var _={getSearchElement:h},I=Yd(),T=J(L(I),2);vc(T,v=>n=v,()=>n);var y=J(T,2),g=L(y);return te(v=>Z(g,v),[()=>_e({key:"searchButton",lang:w(u)})]),Fs("submit",I,function(...v){var E;(E=e.onSubmit)==null||E.apply(this,v)}),Fs("focus",T,p),Fs("blur",T,m),mc(T,s),q(t,I),Bt(_)}_l();var Zd=X('<div id="loading-indicator" class="svelte-li6gfl"><div id="typing-indicator" class="typing-indicator svelte-li6gfl"><span class="svelte-li6gfl"></span> <span class="svelte-li6gfl"></span> <span class="svelte-li6gfl"></span></div></div>');const $d={hash:"svelte-li6gfl",code:`#loading-indicator.svelte-li6gfl {position:absolute;top:50%;left:50%;transform:translate(-50%, -50%);z-index:10000;text-align:center;}.typing-indicator.svelte-li6gfl {display:flex;justify-content:center;align-items:center;height:40px;visibility:visible;background-color:white;}.typing-indicator.svelte-li6gfl span:where(.svelte-li6gfl) {display:block;width:8px;height:8px;margin:0 3px;border-radius:50%;background:linear-gradient(90deg, var(--wineater-color), var(--wineater-corp-color));opacity:0.7;
|
|
52
|
+
animation: svelte-li6gfl-typing 1s infinite;}
|
|
53
|
+
|
|
54
|
+
@keyframes svelte-li6gfl-typing {
|
|
55
|
+
0%,
|
|
56
|
+
100% {
|
|
57
|
+
transform: translateY(0);
|
|
58
|
+
opacity: 0.7;
|
|
59
|
+
}
|
|
60
|
+
50% {
|
|
61
|
+
transform: translateY(-8px);
|
|
62
|
+
opacity: 1;
|
|
63
|
+
}
|
|
64
|
+
}.typing-indicator.svelte-li6gfl span:where(.svelte-li6gfl):nth-child(1) {animation-delay:0s;}.typing-indicator.svelte-li6gfl span:where(.svelte-li6gfl):nth-child(2) {animation-delay:0.15s;}.typing-indicator.svelte-li6gfl span:where(.svelte-li6gfl):nth-child(3) {animation-delay:0.3s;}`};function ef(t){Ht(t,$d);var e=Zd();q(t,e)}var tf=X('<p class="popup-short-desc svelte-17gehox"> </p>'),sf=X('<div class="popup-reason svelte-17gehox"> </div>'),nf=X('<p class="popup-pairing svelte-17gehox"> </p>'),rf=X('<span class="popup-tag svelte-17gehox"> </span>'),of=X('<div class="popup-tags svelte-17gehox"></div>'),af=X('<div class="mobile-fullscreen-wrapper svelte-17gehox"><div class="mobile-fullscreen-overlay svelte-17gehox"></div> <div class="mobile-fullscreen-popup svelte-17gehox"><div class="card-popup svelte-17gehox"><div class="card-popup-header svelte-17gehox"><h2 class="svelte-17gehox"> </h2> <button class="card-popup-close svelte-17gehox">×</button></div> <!> <!> <!></div></div></div>'),lf=X('<p class="popup-short-desc svelte-17gehox"> </p>'),cf=X('<div class="popup-reason svelte-17gehox"> </div>'),uf=X('<p class="popup-pairing svelte-17gehox"> </p>'),hf=X('<span class="popup-tag svelte-17gehox"> </span>'),df=X('<div class="popup-tags svelte-17gehox"></div>'),ff=X('<div class="card-popup svelte-17gehox"><div class="card-popup-header svelte-17gehox"><h2 class="svelte-17gehox"> </h2> <button class="card-popup-close svelte-17gehox">×</button></div> <!> <!> <!></div>');const pf={hash:"svelte-17gehox",code:".card-popup.svelte-17gehox {position:absolute;width:100%;background-color:white;padding:16px;border-radius:16px;box-shadow:0 6px 30px rgba(0, 0, 0, 0.2);text-align:left;font-size:14px;box-sizing:border-box;display:flex;flex-direction:column;}.card-popup.svelte-17gehox p:where(.svelte-17gehox) {margin:5px 0;}.card-popup-header.svelte-17gehox {display:flex;justify-content:space-between;align-items:flex-start;gap:12px;}.card-popup-header.svelte-17gehox h2:where(.svelte-17gehox) {font-size:16px;font-weight:600;margin:0;flex:1;line-height:1.3;}.card-popup-close.svelte-17gehox {font-size:20px;font-weight:bold;cursor:pointer;color:#999;border:none;background:transparent;line-height:1;}.card-popup-close.svelte-17gehox:hover {color:#000;}.popup-short-desc.svelte-17gehox {margin-top:8px;}.popup-reason.svelte-17gehox {font-size:14px;font-weight:400;color:#333;margin-top:8px;}.popup-pairing.svelte-17gehox {margin-top:8px;}.popup-tags.svelte-17gehox {display:flex;flex-wrap:wrap;gap:8px;margin-top:8px;justify-content:center;}.popup-tag.svelte-17gehox {display:inline-block;padding:4px 8px;border-radius:12px;background-color:#f5f0ff;border:1px solid #ddd;font-size:13px;color:#333;text-transform:capitalize;}.mobile-fullscreen-wrapper.svelte-17gehox {position:fixed;top:0;left:0;width:100%;height:100%;z-index:10000;}.mobile-fullscreen-overlay.svelte-17gehox {position:absolute;top:0;left:0;width:100%;height:100%;background:rgba(0, 0, 0, 0.5);}.mobile-fullscreen-popup.svelte-17gehox {position:absolute;width:100%;height:100%;top:50%;left:50%;transform:translate(-50%, -50%);max-width:90%;max-height:80%;overflow-y:auto;background:transparent;}"};function La(t,e){Lt(e,!0),Ht(t,pf);const s=!!e.isMobile;var n=js(),i=cs(n);{var r=a=>{var c=af(),u=L(c);u.__click=function(...C){var S;(S=e.onClose)==null||S.apply(this,C)};var l=J(u,2),h=L(l),d=L(h),f=L(d),p=L(f),m=J(f,2);m.__click=function(...C){var S;(S=e.onClose)==null||S.apply(this,C)};var _=J(d,2);{var I=C=>{var S=tf(),k=L(S);te(()=>Z(k,e.shortDescription)),q(C,S)};ie(_,C=>{e.shortDescription&&C(I)})}var T=J(_,2);{var y=C=>{var S=sf(),k=L(S);te(()=>Z(k,e.reason)),q(C,S)},g=C=>{var S=js(),k=cs(S);{var A=z=>{var F=nf(),G=L(F);te(()=>Z(G,e.pairing)),q(z,F)};ie(k,z=>{e.pairing&&z(A)},!0)}q(C,S)};ie(T,C=>{e.reason?C(y):C(g,!1)})}var v=J(T,2);{var E=C=>{var S=of();qs(S,21,()=>e.tags,Us,(k,A)=>{var z=rf(),F=L(z);te(()=>Z(F,w(A))),q(k,z)}),q(C,S)};ie(v,C=>{e.tags&&e.tags.length&&C(E)})}te(()=>Z(p,e.title)),q(a,c)},o=a=>{var c=ff(),u=L(c),l=L(u),h=L(l),d=J(l,2);d.__click=function(...g){var v;(v=e.onClose)==null||v.apply(this,g)};var f=J(u,2);{var p=g=>{var v=lf(),E=L(v);te(()=>Z(E,e.shortDescription)),q(g,v)};ie(f,g=>{e.shortDescription&&g(p)})}var m=J(f,2);{var _=g=>{var v=cf(),E=L(v);te(()=>Z(E,e.reason)),q(g,v)},I=g=>{var v=js(),E=cs(v);{var C=S=>{var k=uf(),A=L(k);te(()=>Z(A,e.pairing)),q(S,k)};ie(E,S=>{e.pairing&&S(C)},!0)}q(g,v)};ie(m,g=>{e.reason?g(_):g(I,!1)})}var T=J(m,2);{var y=g=>{var v=df();qs(v,21,()=>e.tags,Us,(E,C)=>{var S=hf(),k=L(S);te(()=>Z(k,w(C))),q(E,S)}),q(g,v)};ie(T,g=>{e.tags&&e.tags.length&&g(y)})}te(()=>Z(h,e.title)),q(a,c)};ie(i,a=>{s?a(r):a(o,!1)})}q(t,n),Bt()}ui(["click"]);var gf=(t,e)=>e.onTileClick(t,e.wine),mf=X('<img class="wine-image svelte-yk3emv"/>'),vf=X('<div class="wine-price svelte-yk3emv"> </div>'),bf=X('<div class="wine-params svelte-yk3emv"> </div>'),yf=X('<a class="buy-btn svelte-yk3emv" target="_blank"> </a>'),wf=(t,e)=>e.onBuyClick(e.wine,e.index),Sf=X('<button class="buy-btn svelte-yk3emv" type="button"> </button>'),_f=X('<div class="popup-reason svelte-yk3emv"> </div>'),kf=X('<span class="popup-tag svelte-yk3emv"> </span>'),Tf=X('<div class="popup-tags svelte-yk3emv"></div>'),xf=X("<div><!> <!></div>"),Ef=X('<div><div class="tile-top svelte-yk3emv"><!> <!> <h3 class="wine-title svelte-yk3emv"> </h3></div> <!> <div class="bottom-row svelte-yk3emv"><!></div> <!> <!></div> <!>',1);const If={hash:"svelte-yk3emv",code:`.wine-recommendation-tile.svelte-yk3emv {display:flex;flex-direction:column;align-items:center;text-align:center;box-sizing:border-box;padding:16px 8px;border-right:2px solid #f6f7fd;position:relative;transform:translateY(0);opacity:1;transition:transform 180ms cubic-bezier(0.22, 0.61, 0.36, 1),
|
|
65
|
+
opacity 180ms cubic-bezier(0.22, 0.61, 0.36, 1);will-change:transform, opacity;}.wine-recommendation-tile.svelte-yk3emv:last-child {border-right:none;}.wine-recommendation-tile.ww-slide-up.svelte-yk3emv {transform:translateY(-28px);opacity:0;}.tile-top.svelte-yk3emv {display:flex;flex-direction:column;align-items:center;justify-content:flex-start;}.wine-image.svelte-yk3emv {height:200px;object-fit:contain;margin:0 auto 16px;display:block;}.wine-title.svelte-yk3emv {font-size:15px;font-weight:500;margin:0 0 8px;min-height:3rem;line-height:1.2;text-align:center;color:#000;}.wine-params.svelte-yk3emv {font-size:14px;color:#666;white-space:normal;text-align:center;}.bottom-row.svelte-yk3emv {margin-top:auto;display:flex;align-items:center;gap:12px;justify-content:center;}.wine-price.svelte-yk3emv {font-size:16px;font-weight:400;margin-bottom:8px;color:#333;}.buy-btn.svelte-yk3emv {margin:16px auto 0;background-color:transparent;color:var(--wineater-color);border:2px solid var(--wineater-color);border-radius:6px;padding:8px 16px;font-size:14px;font-weight:500;cursor:pointer;display:block;text-decoration:none;transition:background-color 0.2s,
|
|
66
|
+
color 0.2s,
|
|
67
|
+
box-shadow 0.2s;}.buy-btn.svelte-yk3emv:hover {box-shadow:0 4px 8px rgba(123, 43, 235, 0.25);background-color:var(--wineater-color);color:#fff;}
|
|
68
|
+
|
|
69
|
+
/* Hover popup inside tile */.wine-hover-popup.svelte-yk3emv {display:none;position:absolute;top:0;left:0;width:100%;padding:12px;background-color:#fff;border:1px solid #ddd;border-radius:8px;box-shadow:0 4px 16px rgba(0, 0, 0, 0.1);transition:transform 0.3s ease;z-index:999;}.wine-hover-popup.visible.svelte-yk3emv {display:block;}.wine-hover-popup.slide-in.svelte-yk3emv {
|
|
70
|
+
animation: svelte-yk3emv-whPopup 0.25s ease;}.popup-reason.svelte-yk3emv {font-size:14px;font-weight:400;color:#333;margin-bottom:8px;}.popup-tags.svelte-yk3emv {display:flex;flex-wrap:wrap;gap:8px;margin-top:8px;justify-content:center;}.popup-tag.svelte-yk3emv {display:inline-block;padding:4px 8px;border-radius:12px;background-color:#f5f0ff;border:1px solid #ddd;font-size:13px;color:#333;text-transform:capitalize;}
|
|
71
|
+
|
|
72
|
+
@keyframes svelte-yk3emv-whPopup {
|
|
73
|
+
from {
|
|
74
|
+
opacity: 0;
|
|
75
|
+
transform: translateY(6px);
|
|
76
|
+
}
|
|
77
|
+
to {
|
|
78
|
+
opacity: 1;
|
|
79
|
+
transform: translateY(0);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
@media screen and (max-width: 768px) {.wine-recommendation-tile.svelte-yk3emv {flex:0 0 auto;scroll-snap-align:center;width:240px;text-align:center;}
|
|
84
|
+
}`};function Cf(t,e){Lt(e,!0),Ht(t,If);let s=pe(()=>ke.getAppLanguage());const n=(x,D)=>x[D]||x[D.charAt(0).toUpperCase()+D.slice(1)],i=(x,D)=>D.map(O=>n(x,O)).filter(Boolean).join(" • ");function r(x){var D;return Pd(x,((D=ke.getCurrency)==null?void 0:D.call(ke))||"USD",w(s))}function o(x){return e.selectedWineId===x}function a(x){return!!(x.reason||x.shortDescription||x.tags)}function c(x,D){let O=(x==null?void 0:x.tags)||D.tags;return O?(Array.isArray(O)&&(O=O.join(",")),typeof O!="string"?[]:O.split(",").map(N=>N.trim()).filter(Boolean)):[]}let u=oe(!1);di(()=>{const x=()=>{M(u,window.innerWidth<=768)};return x(),window.addEventListener("resize",x),()=>{window.removeEventListener("resize",x)}});var l=Ef(),h=cs(l);h.__click=[gf,e];var d=L(h),f=L(d);{var p=x=>{var D=mf();te(()=>{dn(D,"src",e.wine.image),dn(D,"alt",e.wine.title)}),q(x,D)};ie(f,x=>{e.wine.image&&x(p)})}var m=J(f,2);{var _=x=>{var D=vf(),O=L(D);te(N=>Z(O,N),[()=>r(e.wine.total)]),q(x,D)};ie(m,x=>{e.wine.total&&x(_)})}var I=J(m,2),T=L(I),y=J(d,2);{var g=x=>{var D=bf(),O=L(D);te(N=>Z(O,N),[()=>i(e.wine,["type","country","region","grape"])]),q(x,D)};ie(y,x=>{i(e.wine,["type","country","region","grape"])&&x(g)})}var v=J(y,2),E=L(v);{var C=x=>{var D=yf(),O=L(D);te(N=>{dn(D,"href",e.wine.url),Z(O,N)},[()=>_e({key:"wineDetails.buy",lang:w(s)})]),q(x,D)},S=x=>{var D=Sf();D.__click=[wf,e];var O=L(D);te(N=>Z(O,N),[()=>_e({key:"moreInfo",lang:w(s)})]),q(x,D)};ie(E,x=>{e.wine.url?x(C):x(S,!1)})}var k=J(v,2);{var A=x=>{{let D=pe(()=>{var Y;return((Y=e.translatedPopup)==null?void 0:Y.shortDescription)||e.wine.shortDescription}),O=pe(()=>{var Y;return((Y=e.translatedPopup)==null?void 0:Y.reason)||e.wine.reason}),N=pe(()=>{var Y;return((Y=e.translatedPopup)==null?void 0:Y.pairingRecommendation)||e.wine.pairingRecommendation}),V=pe(()=>c(e.translatedPopup,e.wine));La(x,{get title(){return e.wine.title},get shortDescription(){return w(D)},get reason(){return w(O)},get pairing(){return w(N)},get tags(){return w(V)},get onClose(){return e.onPopupClose},isMobile:!1})}};ie(k,x=>{o(e.wine.id)&&!w(u)&&x(A)})}var z=J(k,2);{var F=x=>{var D=xf(),O=L(D);{var N=se=>{var de=_f(),me=L(de);te(()=>{var R,P;return Z(me,((R=e.translatedPopup)==null?void 0:R.reason)||((P=e.translatedPopup)==null?void 0:P.shortDescription)||e.wine.reason||e.wine.shortDescription)}),q(se,de)};ie(O,se=>{var de,me;((de=e.translatedPopup)!=null&&de.reason||(me=e.translatedPopup)!=null&&me.shortDescription||e.wine.reason||e.wine.shortDescription)&&se(N)})}var V=J(O,2);{var Y=se=>{var de=Tf();qs(de,21,()=>c(e.translatedPopup,e.wine),Us,(me,R)=>{var P=kf(),re=L(P);te(()=>Z(re,w(R))),q(me,P)}),q(se,de)};ie(V,se=>{var de,me;((de=e.translatedPopup)!=null&&de.tags||(me=e.translatedPopup)!=null&&me.Tags||e.wine.tags)&&se(Y)})}te(()=>ro(D,1,`wine-hover-popup ${e.hoveredWineId===e.wine.id?"slide-in visible":""}`,"svelte-yk3emv")),q(x,D)};ie(z,x=>{a(e.wine)&&x(F)})}var G=J(h,2);{var j=x=>{{let D=pe(()=>{var Y;return((Y=e.translatedPopup)==null?void 0:Y.shortDescription)||e.wine.shortDescription}),O=pe(()=>{var Y;return((Y=e.translatedPopup)==null?void 0:Y.reason)||e.wine.reason}),N=pe(()=>{var Y;return((Y=e.translatedPopup)==null?void 0:Y.pairingRecommendation)||e.wine.pairingRecommendation}),V=pe(()=>c(e.translatedPopup,e.wine));La(x,{get title(){return e.wine.title},get shortDescription(){return w(D)},get reason(){return w(O)},get pairing(){return w(N)},get tags(){return w(V)},get onClose(){return e.onPopupClose},isMobile:!0})}};ie(G,x=>{o(e.wine.id)&&w(u)&&x(j)})}te(()=>{ro(h,1,`wine-recommendation-tile ${e.isAnimating?"ww-slide-up":""}`,"svelte-yk3emv"),Z(T,e.wine.title)}),Fs("mouseenter",h,()=>e.onTileEnter(e.wine)),Fs("mouseleave",h,()=>e.onTileLeave(e.wine)),q(t,l),Bt()}ui(["click"]);var Nf=X('<div class="error-message svelte-1n46o8q"><p> </p></div>'),Df=X('<div id="wine-placeholder" class="svelte-1n46o8q"></div>'),Rf=X('<div id="wine-widget-container" class="svelte-wineater-widget-container svelte-1n46o8q"><div class="wine-widget-wrapper svelte-1n46o8q"><!> <!> <!> <div id="wine-widget-right" class="svelte-1n46o8q"><!></div> <!></div></div>');const Of={hash:"svelte-1n46o8q",code:`
|
|
85
|
+
/* ===================== 0) Font Import ===================== */
|
|
86
|
+
@import url('https://fonts.googleapis.com/css2?family=Bricolage+Grotesque:opsz,wght@12..96,200..800&display=swap');
|
|
87
|
+
|
|
88
|
+
/* ===================== 1) CSS Variables ===================== */:root {--wineater-corp-color: #0044ff;--wineater-color: #7b2beb;}
|
|
89
|
+
|
|
90
|
+
/* ===================== 2) Global Styles ===================== */* {box-sizing:border-box;}.hidden {display:none;}
|
|
91
|
+
|
|
92
|
+
/* ===================== 3) Widget Container ===================== */#wine-widget-container.svelte-1n46o8q {display:flex;gap:24px;font-family:'Bricolage Grotesque', sans-serif;padding:12px 12px 0px;border-radius:16px;background-color:#fff;box-shadow:0 4px 16px rgba(0, 0, 0, 0.1);max-width:1024px;min-width:1024px;min-height:500px;margin:40px auto;position:relative;box-sizing:border-box;}#wine-widget-container.svelte-1n46o8q [class^='icon-'],
|
|
93
|
+
#wine-widget-container.svelte-1n46o8q [class*=' icon-'] {font-family:'Bricolage Grotesque', sans-serif !important;}.wine-widget-wrapper.svelte-1n46o8q {width:100%;}#wine-widget-right.svelte-1n46o8q {position:relative;min-height:300px;}#wine-placeholder.svelte-1n46o8q {display:grid;grid-template-columns:repeat(4, 1fr);gap:0;align-items:stretch;margin-bottom:0;}
|
|
94
|
+
|
|
95
|
+
/* ===================== 12) Error Message ===================== */.error-message.svelte-1n46o8q {text-align:center;padding:24px;color:#666;}
|
|
96
|
+
|
|
97
|
+
/* ===================== 13) Mobile Styles ===================== */
|
|
98
|
+
@media screen and (max-width: 768px) {#wine-widget-container.svelte-1n46o8q {flex-direction:column;padding:0px 16px;min-width:100vw;}#wine-placeholder.svelte-1n46o8q {display:flex;gap:8px;overflow-x:auto;scroll-snap-type:x mandatory;padding:8px 0;width:calc(100vw - 32px);min-width:calc(100vw - 32px);}
|
|
99
|
+
}`};function Mf(t,e){var se,de,me;Lt(e,!0),Ht(t,Of);function s(){var R;mi("chatbotToken",((R=window.wineaterData)==null?void 0:R.CLIENT_TOKEN)||n,365),fo()}const n="HeUw6IXuhvz6tRuXdPEGEbj3SGQ3Q2YtEc1Z8jd41Kg9LtyPb4Epu0to31SYIadG";new Cd({projectKey:"PA8j9fAi49i6g2QnvpNs",__DISABLE_SECURE_MODE:!0}).start(),s();const r=((se=window==null?void 0:window.wineaterData)==null?void 0:se.WIDGET_TYPE)||"store",o=((de=window==null?void 0:window.wineaterData)==null?void 0:de.COUNTRY_CODE)||null;(me=window==null?void 0:window.wineaterData)!=null&&me.WIDGET_WRAPPER;let a=oe(!1),c=oe(!1),u=oe(ft([])),l=oe(null),h=oe(""),d=oe(null),f=oe(!1),p=oe(null),m=oe(ft([])),_=pe(()=>ke.getAppLanguage()),I=pe(()=>ke.getStoreLanguage()),T=pe(()=>ke.getApiKey()),y=pe(()=>ke.getStoreId()),g=pe(()=>ke.isInitialized());function v(){M(d,_e({key:"errorMessage",lang:w(_)}),!0)}const E=()=>M(d,null);async function C(R){if(w(_)===w(I)||r!=="bar")return R.map(()=>({}));const P=["shortDescription","reason","pairingRecommendation","tags"],re=R[0];if(!re)return R.map(()=>({}));const yt=P.filter(Ye=>Ye in re),wt=4,$t=[];for(let Ye=0;Ye<R.length;Ye+=wt){const Ns=R.slice(Ye,Ye+wt).map(async Dt=>{const Wn=yt.map(We=>{const Rt=Dt[We]||Dt[We.toLowerCase()];return Rt?{key:We,text:Array.isArray(Rt)?Rt.join(", "):Rt}:null}).filter(Boolean);return Wn.length===0?{}:await Ld({sourceLang:w(I),targetLang:w(_),texts:Object.fromEntries(Wn.map(We=>[We.key,We.text])),apiKey:w(T)})}),es=await Promise.all(Ns);$t.push(...es)}return $t}async function S(){M(c,!0);try{M(u,await ir.getInstantRecommendations(),!0)}catch{v()}finally{M(c,!1)}}function k(R=220){return!w(u)||w(u).length===0?Promise.resolve():(M(f,!0),new Promise(P=>{setTimeout(()=>{P()},R)}))}async function A(R){R.preventDefault();let P="";try{M(c,!0),E(),await k(220),M(u,[],!0),M(f,!1),P=w(h).trim()+";";try{$e(it.SEARCH_PERFORMED,w(y),{query:P})}catch(yt){console.error("Error tracking search event:",yt)}const re=await ir.getWineRecommendationsSearch(P);!re||re.length===0?(M(u,[],!0),M(m,[],!0),M(d,_e({key:"noResultsMessage",lang:w(_)}),!0),$e(it.NO_RESULTS_FOUND,w(y),{query:P})):(M(u,re,!0),$e(it.SEARCH_RESULTS_DISPLAYED,w(y),{results_count:re.length,results:re,query:P}))}catch(re){M(u,[],!0),$e(it.ERROR_OCCURRED,w(y),{error_message:re==null?void 0:re.message,query:P}),v()}finally{M(c,!1)}}ln(async()=>{if(!w(u)||w(u).length===0){M(m,[],!0);return}try{const R=await C(w(u));w(u)&&w(u).length>0&&M(m,R,!0)}catch(R){console.error("translatePopupContent failed",R)}});function z(R,P){w(l)&&w(l)!==R.id&&M(l,null),M(l,R.id,!0),$e(it.WINE_DETAILS_VIEWED,w(y),{wine_id:R.id,wine_title:R.title,is_mobile:window.innerWidth<=768})}function F(){const R=w(u).find(P=>P.id===w(l));$e(it.WINE_DETAILS_CLOSED,w(y),{wine_id:w(l),wine_title:R.title}),M(l,null)}function G(R){return!!(R.reason||R.shortDescription||R.tags)}function j(R){r==="store"&&G(R)&&(M(p,R.id,!0),$e(it.WINE_CARD_HOVER,w(y),{wine_id:R.id,wine_title:R.title}))}function x(R){r==="store"&&w(p)===R.id&&M(p,null)}function D(R,P){R.target.closest(".buy-btn")||R.target.closest(".card-popup-close")||$e(it.WINE_CARD_CLICK,w(y),{wine_id:P.id,wine_title:P.title})}function O(R){const P=R.target;P.closest(".card-popup")||P.closest(".buy-btn")||M(l,null)}di(async()=>{var P;if(await ke.initializeStore(),!w(g))return;const R=((P=window==null?void 0:window.wineaterData)==null?void 0:P.COLOR)||"#7B2BEB";return document.documentElement.style.setProperty("--wineater-color",R),await S(),$e(it.WIDGET_INITIALIZED,w(y)),M(a,!0),document.addEventListener("click",O),()=>{document.removeEventListener("click",O)}});var N=js(),V=cs(N);{var Y=R=>{var P=Rf(),re=L(P),yt=L(re);qd(yt,{});var wt=J(yt,2);Qd(wt,{onSubmit:A,get initialized(){return w(a)},get searchQuery(){return w(h)},set searchQuery(Pe){M(h,Pe,!0)}});var $t=J(wt,2);{var Ye=Pe=>{ef(Pe)};ie($t,Pe=>{w(c)&&Pe(Ye)})}var Cs=J($t,2),Ns=L(Cs);{var es=Pe=>{var We=Nf(),Rt=L(We),or=L(Rt);te(()=>Z(or,w(d))),q(Pe,We)},Dt=Pe=>{var We=js(),Rt=cs(We);{var or=ar=>{var za=Df();qs(za,21,()=>w(u),Us,(Af,Pf,ja)=>{Cf(Af,{get wine(){return w(Pf)},index:ja,get hoveredWineId(){return w(p)},get selectedWineId(){return w(l)},get isAnimating(){return w(f)},get translatedPopup(){return w(m)[ja]},onBuyClick:z,onPopupClose:F,onTileEnter:j,onTileLeave:x,onTileClick:D})}),q(ar,za)};ie(Rt,ar=>{w(u)&&w(u).length>0&&ar(or)},!0)}q(Pe,We)};ie(Ns,Pe=>{w(d)?Pe(es):Pe(Dt,!1)})}var Wn=J(Cs,2);Xd(Wn,{get countryCode(){return o}}),q(R,P)};ie(V,R=>{w(g)&&R(Y)})}q(t,N),Bt()}return sc(Mf,{target:document.getElementById("wineater-widget-conteiner")})});
|