@molin.ai/shop-ai 0.4.45 → 0.4.46

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.
@@ -1012,7 +1012,7 @@ CHAT`).split(" ");return di`
1012
1012
  <mw-powered-by class="sm:hidden"></mw-powered-by>
1013
1013
  </slot>
1014
1014
  </div>
1015
- `}render(){switch(this.designMode){case!0:return this.renderPopup(this.designMode,!1);default:return this.renderPopup(fe(this,Ga),!0)}}updated(i){let r=i.has("dialogShown"),s=this.dialogShown;r&&s===!0&&fe(this,Ga)&&(ci(this,Ga,!1),this.requestUpdate())}firstUpdated(){this.designMode||ri(this,kf,jv).call(this)}};xf=new WeakMap,Ga=new WeakMap,dp=new WeakMap,mp=new WeakMap,Sf=new WeakSet,Nv=function(){new Audio("https://molin.ai/sounds/widget/popup.aac").play().then(()=>{console.log("Audio played successfully.")}).catch(r=>{console.error("Error playing audio:",r)}),ci(this,Ga,!0),this.requestUpdate()},wf=new WeakSet,Gv=function(i){i.preventDefault(),i.stopPropagation(),ci(this,Ga,!1),sessionStorage.setItem("_molin_popup","user_dismissed"),this.requestUpdate()},Pf=new WeakSet,$v=function(){ci(this,Ga,!1),this.dispatchEvent(new CustomEvent("popup-chat-open",{})),this.requestUpdate()},kf=new WeakSet,jv=function(){window.addEventListener("click",this._handleInteraction,{signal:fe(this,mp).signal}),window.addEventListener("keydown",this._handleInteraction,{signal:fe(this,mp).signal})},Cf=new WeakSet,qv=function(){ci(this,xf,new _f(this,this.popupDelayMs,()=>{let i=!this.dialogShown,r=sessionStorage.getItem("_molin_popup")!=="user_dismissed";i&&r&&ri(this,Sf,Nv).call(this)}))},le(up,"properties",{position:{type:Object},aiName:{type:String,attribute:"ai-name"},aiColor:{type:String,attribute:"ai-color"},dialogShown:{type:Boolean,attribute:"dialog-shown"},popupDelayMs:{type:Number,attribute:"popup-delay-ms"},popupText:{type:String,attribute:"popup-text"},designMode:{type:Boolean,attribute:"design-mode"},mobileMode:{type:Boolean,attribute:"mobile-mode"}});var Af,Hv,gp=class extends br(zi){constructor(){super();Le(this,Af);this.color="sky-500",this.animated=!1,this.position="top-right"}render(){return di`
1015
+ `}render(){switch(this.designMode){case!0:return this.renderPopup(this.designMode,!1);default:return this.renderPopup(fe(this,Ga),!0)}}updated(i){let r=i.has("dialogShown"),s=this.dialogShown;r&&s===!0&&fe(this,Ga)&&(ci(this,Ga,!1),this.requestUpdate())}firstUpdated(){this.designMode||ri(this,kf,jv).call(this)}};xf=new WeakMap,Ga=new WeakMap,dp=new WeakMap,mp=new WeakMap,Sf=new WeakSet,Nv=function(){new Audio("https://molin.ai/sounds/widget/popup.aac").play().then(()=>{}).catch(r=>{console.error("Error playing audio:",r)}),ci(this,Ga,!0),this.requestUpdate()},wf=new WeakSet,Gv=function(i){i.preventDefault(),i.stopPropagation(),ci(this,Ga,!1),sessionStorage.setItem("_molin_popup","user_dismissed"),this.requestUpdate()},Pf=new WeakSet,$v=function(){ci(this,Ga,!1),this.dispatchEvent(new CustomEvent("popup-chat-open",{})),this.requestUpdate()},kf=new WeakSet,jv=function(){window.addEventListener("click",this._handleInteraction,{signal:fe(this,mp).signal}),window.addEventListener("keydown",this._handleInteraction,{signal:fe(this,mp).signal})},Cf=new WeakSet,qv=function(){ci(this,xf,new _f(this,this.popupDelayMs,()=>{let i=!this.dialogShown,r=sessionStorage.getItem("_molin_popup")!=="user_dismissed";i&&r&&ri(this,Sf,Nv).call(this)}))},le(up,"properties",{position:{type:Object},aiName:{type:String,attribute:"ai-name"},aiColor:{type:String,attribute:"ai-color"},dialogShown:{type:Boolean,attribute:"dialog-shown"},popupDelayMs:{type:Number,attribute:"popup-delay-ms"},popupText:{type:String,attribute:"popup-text"},designMode:{type:Boolean,attribute:"design-mode"},mobileMode:{type:Boolean,attribute:"mobile-mode"}});var Af,Hv,gp=class extends br(zi){constructor(){super();Le(this,Af);this.color="sky-500",this.animated=!1,this.position="top-right"}render(){return di`
1016
1016
  <span class="relative inline-flex">
1017
1017
  <slot></slot>
1018
1018
  <span class="${fe(this,Af,Hv)} pointer-events-none absolute flex h-3 w-3">
@@ -1032,7 +1032,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
1032
1032
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}()}function t0(t,e){if(t){if(typeof t=="string")return Om(t,e);var i=Object.prototype.toString.call(t).slice(8,-1);return i==="Object"&&t.constructor&&(i=t.constructor.name),i==="Map"||i==="Set"?Array.from(t):i==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?Om(t,e):void 0}}function Om(t,e){(e==null||e>t.length)&&(e=t.length);for(var i=0,r=new Array(e);i<e;i++)r[i]=t[i];return r}function wo(t,e){var i=typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(!i){if(Array.isArray(t)||(i=t0(t))||e&&t&&typeof t.length=="number"){i&&(t=i);var r=0,s=function(){};return{s,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(o){throw o},f:s}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
1033
1033
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var n,a=!0,h=!1;return{s:function(){i=i.call(t)},n:function(){var o=i.next();return a=o.done,o},e:function(o){h=!0,n=o},f:function(){try{a||i.return==null||i.return()}finally{if(h)throw n}}}}var yh={DEBUG:!1,LIB_VERSION:"1.104.4"},cE=Array.isArray,Ob=Object.prototype,Bb=Ob.hasOwnProperty,Fp=Ob.toString,Hr=cE||function(t){return Fp.call(t)==="[object Array]"},ib=function(t){return Fp.call(t)==="[object Uint8Array]"},Vn=function(t){return typeof t=="function"},So=function(t){return t===Object(t)&&!Hr(t)},Si=function(t){return t===void 0},yn=function(t){return Fp.call(t)=="[object String]"},Ts=function(t){return t===null},ba=function(t){return Fp.call(t)=="[object Number]"},Bm=function(t){return Fp.call(t)==="[object Boolean]"},oe=typeof window<"u"?window:void 0,xa=typeof globalThis<"u"?globalThis:oe,zb=Array.prototype,rb=zb.forEach,sb=zb.indexOf,nb=xa?.navigator,Ue=xa?.document,bo=xa?.location,zm=xa?.fetch,ab=xa?.XMLHttpRequest,Tr=nb?.userAgent,Ms=oe??{},hb="[PostHog.js]",Te={_log:function(t){if(oe&&(yh.DEBUG||Ms.POSTHOG_DEBUG)&&!Si(oe.console)&&oe.console){for(var e=("__rrweb_original__"in oe.console[t])?oe.console[t].__rrweb_original__:oe.console[t],i=arguments.length,r=new Array(i>1?i-1:0),s=1;s<i;s++)r[s-1]=arguments[s];e.apply(void 0,[hb].concat(r))}},info:function(){for(var t=arguments.length,e=new Array(t),i=0;i<t;i++)e[i]=arguments[i];Te._log.apply(Te,["log"].concat(e))},warn:function(){for(var t=arguments.length,e=new Array(t),i=0;i<t;i++)e[i]=arguments[i];Te._log.apply(Te,["warn"].concat(e))},error:function(){for(var t=arguments.length,e=new Array(t),i=0;i<t;i++)e[i]=arguments[i];Te._log.apply(Te,["error"].concat(e))},critical:function(){for(var t,e=arguments.length,i=new Array(e),r=0;r<e;r++)i[r]=arguments[r];(t=console).error.apply(t,[hb].concat(i))},uninitializedWarning:function(t){Te.error("You must initialize PostHog before calling ".concat(t))}},e0={},Yf=function(t){return t.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"")};function ll(t,e,i){if(Hr(t)){if(rb&&t.forEach===rb)t.forEach(e,i);else if("length"in t&&t.length===+t.length){for(var r=0,s=t.length;r<s;r++)if(r in t&&e.call(i,t[r],r)===e0)return}}}function tr(t,e,i){if(!Ts(t)&&!Si(t)){if(Hr(t))return ll(t,e,i);for(var r in t)if(Bb.call(t,r)&&e.call(i,t[r],r)===e0)return}}var ms=function(t){for(var e=arguments.length,i=new Array(e>1?e-1:0),r=1;r<e;r++)i[r-1]=arguments[r];return ll(i,function(s){for(var n in s)s[n]!==void 0&&(t[n]=s[n])}),t};function $i(t,e){return t.indexOf(e)!==-1}function Gf(t){for(var e=Object.keys(t),i=e.length,r=new Array(i);i--;)r[i]=[e[i],t[e[i]]];return r}var Nb=function(){return Date.now=Date.now||function(){return+new Date},Date.now()},lb=function(t){try{return t()}catch{return}},Gb=function(t){return function(){try{for(var e=arguments.length,i=new Array(e),r=0;r<e;r++)i[r]=arguments[r];return t.apply(this,i)}catch(s){Te.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),Te.critical(s)}}},Nm=function(t){var e={};return tr(t,function(i,r){yn(i)&&i.length>0&&(e[r]=i)}),e},fE=["$performance_raw"];function uE(t,e){return i=t,r=function(n,a){return a&&fE.indexOf(a)>-1?n:yn(n)&&!Ts(e)?n.slice(0,e):n},s=new Set,function n(a,h){return a!==Object(a)?r?r(a,h):a:s.has(a)?void 0:(s.add(a),Hr(a)?(o=[],ll(a,function(c){o.push(n(c))})):(o={},tr(a,function(c,g){s.has(c)||(o[g]=n(c,g))})),o);var o}(i);var i,r,s}function i0(t){var e,i,r,s,n,a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",h=0,o=0,c="",g=[];if(!t)return t;t=dE(t);do e=(n=t.charCodeAt(h++)<<16|t.charCodeAt(h++)<<8|t.charCodeAt(h++))>>18&63,i=n>>12&63,r=n>>6&63,s=63&n,g[o++]=a.charAt(e)+a.charAt(i)+a.charAt(r)+a.charAt(s);while(h<t.length);switch(c=g.join(""),t.length%3){case 1:c=c.slice(0,-2)+"==";break;case 2:c=c.slice(0,-1)+"="}return c}var dE=function(t){var e,i,r,s,n="";for(e=i=0,r=(t=(t+"").replace(/\r\n/g,`
1034
1034
  `).replace(/\r/g,`
1035
- `)).length,s=0;s<r;s++){var a=t.charCodeAt(s),h=null;a<128?i++:h=a>127&&a<2048?String.fromCharCode(a>>6|192,63&a|128):String.fromCharCode(a>>12|224,a>>6&63|128,63&a|128),Ts(h)||(i>e&&(n+=t.substring(e,i)),n+=h,e=i=s+1)}return i>e&&(n+=t.substring(e,t.length)),n},Tp=function(){function t(e){return e&&(e.preventDefault=t.preventDefault,e.stopPropagation=t.stopPropagation),e}return t.preventDefault=function(){this.returnValue=!1},t.stopPropagation=function(){this.cancelBubble=!0},function(e,i,r,s,n){if(e)if(e.addEventListener&&!s)e.addEventListener(i,r,!!n);else{var a="on"+i,h=e[a];e[a]=function(o,c,g){return function(l){if(l=l||t(oe?.event)){var p,v=!0;Vn(g)&&(p=g(l));var u=c.call(o,l);return p!==!1&&u!==!1||(v=!1),v}}}(e,r,h)}else Te.error("No valid element provided to register_event")}}();function Mp(t,e){var i=function(){if(!Ue)return e("document not found");var r=Ue.createElement("script");r.type="text/javascript",r.src=t,r.onload=function(a){return e(void 0,a)},r.onerror=function(a){return e(a)};var s,n=Ue.querySelectorAll("body > script");n.length>0?(s=n[0].parentNode)===null||s===void 0||s.insertBefore(r,n[0]):Ue.body.appendChild(r)};Ue!=null&&Ue.body?i():Ue?.addEventListener("DOMContentLoaded",i)}function r0(t){return t?Yf(t).split(/\s+/):[]}function Jf(t){var e="";switch(Rm(t.className)){case"string":e=t.className;break;case"object":e=("baseVal"in t.className?t.className.baseVal:null)||t.getAttribute("class")||"";break;default:e=""}return r0(e)}function Xf(t){var e="";return $f(t)&&!jb(t)&&t.childNodes&&t.childNodes.length&&tr(t.childNodes,function(i){$b(i)&&i.textContent&&(e+=Yf(i.textContent).split(/(\s+)/).filter(al).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255))}),Yf(e)}function pb(t){return!!t&&t.nodeType===1}function gh(t,e){return!!t&&!!t.tagName&&t.tagName.toLowerCase()===e.toLowerCase()}function $b(t){return!!t&&t.nodeType===3}function cb(t){return!!t&&t.nodeType===11}var Mm=["a","button","form","input","select","textarea","label"];function $f(t){for(var e=t;e.parentNode&&!gh(e,"body");e=e.parentNode){var i=Jf(e);if($i(i,"ph-sensitive")||$i(i,"ph-no-capture"))return!1}if($i(Jf(t),"ph-include"))return!0;var r=t.type||"";if(yn(r))switch(r.toLowerCase()){case"hidden":case"password":return!1}var s=t.name||t.id||"";return!(yn(s)&&/^cc|cardnum|ccnum|creditcard|csc|cvc|cvv|exp|pass|pwd|routing|seccode|securitycode|securitynum|socialsec|socsec|ssn/i.test(s.replace(/[^a-zA-Z0-9]/g,"")))}function jb(t){return!!(gh(t,"input")&&!["button","checkbox","submit","reset"].includes(t.type)||gh(t,"select")||gh(t,"textarea")||t.getAttribute("contenteditable")==="true")}function al(t){return!(Ts(t)||Si(t)||yn(t)&&(t=Yf(t),/^(?:(4[0-9]{12}(?:[0-9]{3})?)|(5[1-5][0-9]{14})|(6(?:011|5[0-9]{2})[0-9]{12})|(3[47][0-9]{13})|(3(?:0[0-5]|[68][0-9])[0-9]{11})|((?:2131|1800|35[0-9]{3})[0-9]{11}))$/.test((t||"").replace(/[- ]/g,""))||/(^\d{3}-?\d{2}-?\d{4}$)/.test(t)))}function fb(t){var e=Xf(t);return al(e="".concat(e," ").concat(qb(t)).trim())?e:""}function qb(t){var e="";return t&&t.childNodes&&t.childNodes.length&&tr(t.childNodes,function(i){var r;if(i&&((r=i.tagName)===null||r===void 0?void 0:r.toLowerCase())==="span")try{var s=Xf(i);e="".concat(e," ").concat(s).trim(),i.childNodes&&i.childNodes.length&&(e="".concat(e," ").concat(qb(i)).trim())}catch(n){Te.error(n)}}),e}function mE(t){return function(e){var i=e.map(function(r){var s,n,a="";if(r.tag_name&&(a+=r.tag_name),r.attr_class){r.attr_class.sort();var h,o=wo(r.attr_class);try{for(o.s();!(h=o.n()).done;){var c=h.value;a+=".".concat(c.replace(/"/g,""))}}catch(p){o.e(p)}finally{o.f()}}var g=ti(ti(ti(ti({},r.text?{text:r.text}:{}),{},{"nth-child":(s=r.nth_child)!==null&&s!==void 0?s:0,"nth-of-type":(n=r.nth_of_type)!==null&&n!==void 0?n:0},r.href?{href:r.href}:{}),r.attr_id?{attr_id:r.attr_id}:{}),r.attributes),l={};return Gf(g).sort(function(p,v){var u=ea(p,1)[0],m=ea(v,1)[0];return u.localeCompare(m)}).forEach(function(p){var v=ea(p,2),u=v[0],m=v[1];return l[ub(u.toString())]=ub(m.toString())}),a+=":",a+=Gf(g).map(function(p){var v=ea(p,2),u=v[0],m=v[1];return"".concat(u,'="').concat(m,'"')}).join("")});return i.join(";")}(function(e){return e.map(function(i){var r,s,n={text:(r=i.$el_text)===null||r===void 0?void 0:r.slice(0,400),tag_name:i.tag_name,href:(s=i.attr__href)===null||s===void 0?void 0:s.slice(0,2048),attr_class:gE(i),attr_id:i.attr__id,nth_child:i.nth_child,nth_of_type:i.nth_of_type,attributes:{}};return Gf(i).filter(function(a){return ea(a,1)[0].indexOf("attr__")===0}).forEach(function(a){var h=ea(a,2),o=h[0],c=h[1];return n.attributes[o]=c}),n})}(t))}function ub(t){return t.replace(/"|\\"/g,'\\"')}function gE(t){var e=t.attr__class;return e?Hr(e)?e:r0(e):void 0}var yE=function(){function t(e){Mr(this,t),this.clicks=[],this.enabled=e}return Dr(t,[{key:"isRageClick",value:function(e,i,r){if(!this.enabled)return!1;var s=this.clicks[this.clicks.length-1];if(s&&Math.abs(e-s.x)+Math.abs(i-s.y)<30&&r-s.timestamp<1e3){if(this.clicks.push({x:e,y:i,timestamp:r}),this.clicks.length===3)return!0}else this.clicks=[{x:e,y:i,timestamp:r}];return!1}}]),t}(),Hb="$people_distinct_id",jf="__alias",Ap="__timers",db="$autocapture_disabled_server_side",Gm="$session_recording_enabled_server_side",mb="$console_log_recording_enabled_server_side",gb="$session_recording_recorder_version_server_side",yb="$session_recording_network_payload_capture",Kf="$sesid",qf="$session_is_sampled",ol="$enabled_feature_flags",$m="$early_access_features",hl="$stored_person_properties",_o="$stored_group_properties",jm="$surveys",Qf="$flag_call_reported",qm="$user_state",Hm="$posthog_quota_limited",Wm="$client_session_props",vE=[Hb,jf,"__cmpns",Ap,Gm,Kf,ol,qm,Hm,$m,_o,hl,jm,Qf,Wm];function Dm(t,e){return e.length>t?e.slice(0,t)+"...":e}var xo={_initializedTokens:[],_isDisabledServerSide:null,_isAutocaptureEnabled:!1,_setIsAutocaptureEnabled:function(t){var e,i=Ts(this._isDisabledServerSide)?!((e=t.persistence)===null||e===void 0||!e.props[db]):this._isDisabledServerSide,r=!!t.config.autocapture;this._isAutocaptureEnabled=r&&!i},_previousElementSibling:function(t){if(t.previousElementSibling)return t.previousElementSibling;var e=t;do e=e.previousSibling;while(e&&!pb(e));return e},_getAugmentPropertiesFromElement:function(t){if(!$f(t))return{};var e={};return tr(t.attributes,function(i){if(i.name.indexOf("data-ph-capture-attribute")===0){var r=i.name.replace("data-ph-capture-attribute-",""),s=i.value;r&&s&&al(s)&&(e[r]=s)}}),e},_getPropertiesFromElement:function(t,e,i){var r,s=t.tagName.toLowerCase(),n={tag_name:s};Mm.indexOf(s)>-1&&!i&&(s.toLowerCase()==="a"||s.toLowerCase()==="button"?n.$el_text=Dm(1024,fb(t)):n.$el_text=Dm(1024,Xf(t)));var a=Jf(t);a.length>0&&(n.classes=a.filter(function(l){return l!==""}));var h=(r=this.config)===null||r===void 0?void 0:r.element_attribute_ignorelist;tr(t.attributes,function(l){var p;if((!jb(t)||["name","id","class"].indexOf(l.name)!==-1)&&(h==null||!h.includes(l.name))&&!e&&al(l.value)&&(p=l.name,!yn(p)||p.substring(0,10)!=="_ngcontent"&&p.substring(0,7)!=="_nghost")){var v=l.value;l.name==="class"&&(v=r0(v).join(" ")),n["attr__"+l.name]=Dm(1024,v)}});for(var o=1,c=1,g=t;g=this._previousElementSibling(g);)o++,g.tagName===t.tagName&&c++;return n.nth_child=o,n.nth_of_type=c,n},_getDefaultProperties:function(t){return{$event_type:t,$ce_version:1}},_extractCustomPropertyValue:function(t){var e=[];return tr(Ue?.querySelectorAll(t.css_selector),function(i){var r;["input","select"].indexOf(i.tagName.toLowerCase())>-1?r=i.value:i.textContent&&(r=i.textContent),al(r)&&e.push(r)}),e.join(", ")},_getCustomProperties:function(t){var e=this,i={};return tr(this._customProperties,function(r){tr(r.event_selectors,function(s){tr(Ue?.querySelectorAll(s),function(n){$i(t,n)&&$f(n)&&(i[r.name]=e._extractCustomPropertyValue(r))})})}),i},_getEventTarget:function(t){return Si(t.target)?t.srcElement||null:(e=t.target)!==null&&e!==void 0&&e.shadowRoot?t.composedPath()[0]||null:t.target||null;var e},_captureEvent:function(t,e){var i,r=this,s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"$autocapture",n=this._getEventTarget(t);if($b(n)&&(n=n.parentNode||null),s==="$autocapture"&&t.type==="click"&&t instanceof MouseEvent&&(i=this.rageclicks)!==null&&i!==void 0&&i.isRageClick(t.clientX,t.clientY,new Date().getTime())&&this._captureEvent(t,e,"$rageclick"),n&&function(m,k){var y=arguments.length>2&&arguments[2]!==void 0?arguments[2]:void 0;if(!oe||!m||gh(m,"html")||!pb(m))return!1;if(y!=null&&y.url_allowlist){var d=oe.location.href,b=y.url_allowlist;if(b&&!b.some(function(K){return d.match(K)}))return!1}if(y!=null&&y.dom_event_allowlist){var S=y.dom_event_allowlist;if(S&&!S.some(function(K){return k.type===K}))return!1}if(y!=null&&y.element_allowlist){var E=y.element_allowlist;if(E&&!E.some(function(K){return m.tagName.toLowerCase()===K}))return!1}if(y!=null&&y.css_selector_allowlist){var I=y.css_selector_allowlist;if(I&&!I.some(function(K){return m.matches(K)}))return!1}for(var B=!1,G=[m],it=!0,lt=m;lt.parentNode&&!gh(lt,"body");)if(cb(lt.parentNode))G.push(lt.parentNode.host),lt=lt.parentNode.host;else{if(!(it=lt.parentNode||!1))break;if(Mm.indexOf(it.tagName.toLowerCase())>-1)B=!0;else{var ft=oe.getComputedStyle(it);ft&&ft.getPropertyValue("cursor")==="pointer"&&(B=!0)}G.push(it),lt=it}var ct=oe.getComputedStyle(m);if(ct&&ct.getPropertyValue("cursor")==="pointer"&&k.type==="click")return!0;var St=m.tagName.toLowerCase();switch(St){case"html":return!1;case"form":return k.type==="submit";case"input":case"select":case"textarea":return k.type==="change"||k.type==="click";default:return B?k.type==="click":k.type==="click"&&(Mm.indexOf(St)>-1||m.getAttribute("contenteditable")==="true")}}(n,t,this.config)){for(var a,h,o=[n],c=n;c.parentNode&&!gh(c,"body");)cb(c.parentNode)?(o.push(c.parentNode.host),c=c.parentNode.host):(o.push(c.parentNode),c=c.parentNode);var g,l=[],p={},v=!1;if(tr(o,function(m){var k=$f(m);m.tagName.toLowerCase()==="a"&&(g=m.getAttribute("href"),g=k&&al(g)&&g),$i(Jf(m),"ph-no-capture")&&(v=!0),l.push(r._getPropertiesFromElement(m,e.config.mask_all_element_attributes,e.config.mask_all_text));var y=r._getAugmentPropertiesFromElement(m);ms(p,y)}),e.config.mask_all_text||(n.tagName.toLowerCase()==="a"||n.tagName.toLowerCase()==="button"?l[0].$el_text=fb(n):l[0].$el_text=Xf(n)),g&&(l[0].attr__href=g),v)return!1;var u=ms(this._getDefaultProperties(t.type),e.elementsChainAsString?{$elements_chain:mE(l)}:{$elements:l},(a=l[0])!==null&&a!==void 0&&a.$el_text?{$el_text:(h=l[0])===null||h===void 0?void 0:h.$el_text}:{},this._getCustomProperties(o),p);return e.capture(s,u),!0}},_navigate:function(t){oe&&(oe.location.href=t)},_addDomEventHandlers:function(t){var e=this;if(oe&&Ue){var i=function(r){r=r||oe?.event,e._captureEvent(r,t)};Tp(Ue,"submit",i,!1,!0),Tp(Ue,"change",i,!1,!0),Tp(Ue,"click",i,!1,!0)}},_customProperties:[],rageclicks:null,config:void 0,init:function(t){var e;Bm(t.__autocapture)||(this.config=t.__autocapture),(e=this.config)!==null&&e!==void 0&&e.url_allowlist&&(this.config.url_allowlist=this.config.url_allowlist.map(function(i){return new RegExp(i)})),this.rageclicks=new yE(t.config.rageclick)},afterDecideResponse:function(t,e){var i=e.config.token;this._initializedTokens.indexOf(i)>-1?Te.info('autocapture already initialized for token "'+i+'"'):(e.persistence&&e.persistence.register(Be({},db,!!t.autocapture_opt_out)),this._isDisabledServerSide=!!t.autocapture_opt_out,this._setIsAutocaptureEnabled(e),this._initializedTokens.push(i),t&&t.config&&t.config.enable_collect_everything&&this._isAutocaptureEnabled?(t.custom_properties&&(this._customProperties=t.custom_properties),this._addDomEventHandlers(e)):e.__autocapture=!1)},enabledForProject:function(t,e,i){if(!t)return!0;e=Si(e)?10:e,i=Si(i)?10:i;for(var r=0,s=0;s<t.length;s++)r+=t.charCodeAt(s);return r%e<i},isBrowserSupported:function(){return Vn(Ue?.querySelectorAll)}};(function(t){for(var e in t)Vn(t[e])&&(t[e]=t[e].bind(t))})(xo),function(t){for(var e in t)Vn(t[e])&&(t[e]=Gb(t[e]))}(xo);var Im="$active_feature_flags",Vf="$override_feature_flags",vb="$feature_flag_payloads",bb=function(t){var e,i={},r=wo(Gf(t||{}));try{for(r.s();!(e=r.n()).done;){var s=ea(e.value,2),n=s[0],a=s[1];a&&(i[n]=a)}}catch(h){r.e(h)}finally{r.f()}return i},bE=function(){function t(e){Mr(this,t),this.instance=e,this._override_warning=!1,this.featureFlagEventHandlers=[],this.reloadFeatureFlagsQueued=!1,this.reloadFeatureFlagsInAction=!1}return Dr(t,[{key:"getFlags",value:function(){return Object.keys(this.getFlagVariants())}},{key:"getFlagVariants",value:function(){var e=this.instance.get_property(ol),i=this.instance.get_property(Vf);if(!i)return e||{};for(var r=ms({},e),s=Object.keys(i),n=0;n<s.length;n++)i[s[n]]===!1?delete r[s[n]]:r[s[n]]=i[s[n]];return this._override_warning||(Te.warn(" Overriding feature flags!",{enabledFlags:e,overriddenFlags:i,finalFlags:r}),this._override_warning=!0),r}},{key:"getFlagPayloads",value:function(){return this.instance.get_property(vb)||{}}},{key:"reloadFeatureFlags",value:function(){this.reloadFeatureFlagsQueued||(this.reloadFeatureFlagsQueued=!0,this._startReloadTimer())}},{key:"setAnonymousDistinctId",value:function(e){this.$anon_distinct_id=e}},{key:"setReloadingPaused",value:function(e){this.reloadFeatureFlagsInAction=e}},{key:"resetRequestQueue",value:function(){this.reloadFeatureFlagsQueued=!1}},{key:"_startReloadTimer",value:function(){var e=this;this.reloadFeatureFlagsQueued&&!this.reloadFeatureFlagsInAction&&setTimeout(function(){!e.reloadFeatureFlagsInAction&&e.reloadFeatureFlagsQueued&&(e.reloadFeatureFlagsQueued=!1,e._reloadFeatureFlagsRequest())},5)}},{key:"_reloadFeatureFlagsRequest",value:function(){var e=this;if(!this.instance.config.advanced_disable_feature_flags){this.setReloadingPaused(!0);var i=this.instance.config.token,r=this.instance.get_property(hl),s=this.instance.get_property(_o),n=i0(JSON.stringify({token:i,distinct_id:this.instance.get_distinct_id(),groups:this.instance.getGroups(),$anon_distinct_id:this.$anon_distinct_id,person_properties:r,group_properties:s,disable_flags:this.instance.config.advanced_disable_feature_flags||void 0}));this.instance._send_request(this.instance.config.api_host+"/decide/?v=3",{data:n},{method:"POST"},this.instance._prepare_callback(function(a){e.$anon_distinct_id=void 0,e.receivedFeatureFlags(a),e.setReloadingPaused(!1),e._startReloadTimer()}))}}},{key:"getFeatureFlag",value:function(e){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(this.instance.decideEndpointWasHit||this.getFlags()&&this.getFlags().length>0){var r,s=this.getFlagVariants()[e],n="".concat(s),a=this.instance.get_property(Qf)||{};return(i.send_event||!("send_event"in i))&&(!(e in a)||!a[e].includes(n))&&(Hr(a[e])?a[e].push(n):a[e]=[n],(r=this.instance.persistence)===null||r===void 0||r.register(Be({},Qf,a)),this.instance.capture("$feature_flag_called",{$feature_flag:e,$feature_flag_response:s})),s}Te.warn('getFeatureFlag for key "'+e+`" failed. Feature flags didn't load in time.`)}},{key:"getFeatureFlagPayload",value:function(e){return this.getFlagPayloads()[e]}},{key:"isFeatureEnabled",value:function(e){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(this.instance.decideEndpointWasHit||this.getFlags()&&this.getFlags().length>0)return!!this.getFeatureFlag(e,i);Te.warn('isFeatureEnabled for key "'+e+`" failed. Feature flags didn't load in time.`)}},{key:"addFeatureFlagsHandler",value:function(e){this.featureFlagEventHandlers.push(e)}},{key:"removeFeatureFlagsHandler",value:function(e){this.featureFlagEventHandlers=this.featureFlagEventHandlers.filter(function(i){return i!==e})}},{key:"receivedFeatureFlags",value:function(e){if(this.instance.persistence){this.instance.decideEndpointWasHit=!0;var i=this.getFlagVariants(),r=this.getFlagPayloads();(function(s,n){var a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},h=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{},o=s.featureFlags,c=s.featureFlagPayloads;if(o)if(Hr(o)){var g,l={};if(o)for(var p=0;p<o.length;p++)l[o[p]]=!0;n&&n.register((Be(g={},Im,o),Be(g,ol,l),g))}else{var v,u=o,m=c;s.errorsWhileComputingFlags&&(u=ti(ti({},a),u),m=ti(ti({},h),m)),n&&n.register((Be(v={},Im,Object.keys(bb(u))),Be(v,ol,u||{}),Be(v,vb,m||{}),v))}})(e,this.instance.persistence,i,r),this._fireFeatureFlagsCallbacks()}}},{key:"override",value:function(e){if(!this.instance.__loaded||!this.instance.persistence)return Te.uninitializedWarning("posthog.feature_flags.override");if(this._override_warning=!1,e===!1)this.instance.persistence.unregister(Vf);else if(Hr(e)){for(var i={},r=0;r<e.length;r++)i[e[r]]=!0;this.instance.persistence.register(Be({},Vf,i))}else this.instance.persistence.register(Be({},Vf,e))}},{key:"onFeatureFlags",value:function(e){var i=this;if(this.addFeatureFlagsHandler(e),this.instance.decideEndpointWasHit){var r=this._prepareFeatureFlagsForCallbacks(),s=r.flags,n=r.flagVariants;e(s,n)}return function(){return i.removeFeatureFlagsHandler(e)}}},{key:"updateEarlyAccessFeatureEnrollment",value:function(e,i){var r,s,n=Be({},"$feature_enrollment/".concat(e),i);this.instance.capture("$feature_enrollment_update",{$feature_flag:e,$feature_enrollment:i,$set:n}),this.setPersonPropertiesForFlags(n,!1);var a=ti(ti({},this.getFlagVariants()),{},Be({},e,i));(r=this.instance.persistence)===null||r===void 0||r.register((Be(s={},Im,Object.keys(bb(a))),Be(s,ol,a),s)),this._fireFeatureFlagsCallbacks()}},{key:"getEarlyAccessFeatures",value:function(e){var i=this,r=arguments.length>1&&arguments[1]!==void 0&&arguments[1],s=this.instance.get_property($m);if(s&&!r)return e(s);this.instance._send_request("".concat(this.instance.config.api_host,"/api/early_access_features/?token=").concat(this.instance.config.token),{},{method:"GET"},function(n){var a,h=n.earlyAccessFeatures;return(a=i.instance.persistence)===null||a===void 0||a.register(Be({},$m,h)),e(h)})}},{key:"_prepareFeatureFlagsForCallbacks",value:function(){var e=this.getFlags(),i=this.getFlagVariants();return{flags:e.filter(function(r){return i[r]}),flagVariants:Object.keys(i).filter(function(r){return i[r]}).reduce(function(r,s){return r[s]=i[s],r},{})}}},{key:"_fireFeatureFlagsCallbacks",value:function(){var e=this._prepareFeatureFlagsForCallbacks(),i=e.flags,r=e.flagVariants;this.featureFlagEventHandlers.forEach(function(s){return s(i,r)})}},{key:"setPersonPropertiesForFlags",value:function(e){var i=!(arguments.length>1&&arguments[1]!==void 0)||arguments[1],r=this.instance.get_property(hl)||{};this.instance.register(Be({},hl,ti(ti({},r),e))),i&&this.instance.reloadFeatureFlags()}},{key:"resetPersonPropertiesForFlags",value:function(){this.instance.unregister(hl)}},{key:"setGroupPropertiesForFlags",value:function(e){var i=!(arguments.length>1&&arguments[1]!==void 0)||arguments[1],r=this.instance.get_property(_o)||{};Object.keys(r).length!==0&&Object.keys(r).forEach(function(s){r[s]=ti(ti({},r[s]),e[s]),delete e[s]}),this.instance.register(Be({},_o,ti(ti({},r),e))),i&&this.instance.reloadFeatureFlags()}},{key:"resetGroupPropertiesForFlags",value:function(e){if(e){var i=this.instance.get_property(_o)||{};this.instance.register(Be({},_o,ti(ti({},i),{},Be({},e,{}))))}else this.instance.unregister(_o)}}]),t}();Math.trunc||(Math.trunc=function(t){return t<0?Math.ceil(t):Math.floor(t)}),Number.isInteger||(Number.isInteger=function(t){return ba(t)&&isFinite(t)&&Math.floor(t)===t});var _b="0123456789abcdef",_E=function(){function t(e){if(Mr(this,t),this.bytes=e,e.length!==16)throw new TypeError("not 128-bit length")}return Dr(t,[{key:"toString",value:function(){for(var e="",i=0;i<this.bytes.length;i++)e=e+_b.charAt(this.bytes[i]>>>4)+_b.charAt(15&this.bytes[i]),i!==3&&i!==5&&i!==7&&i!==9||(e+="-");if(e.length!==36)throw new Error("Invalid UUIDv7 was generated");return e}},{key:"clone",value:function(){return new t(this.bytes.slice(0))}},{key:"equals",value:function(e){return this.compareTo(e)===0}},{key:"compareTo",value:function(e){for(var i=0;i<16;i++){var r=this.bytes[i]-e.bytes[i];if(r!==0)return Math.sign(r)}return 0}}],[{key:"fromFieldsV7",value:function(e,i,r,s){if(!Number.isInteger(e)||!Number.isInteger(i)||!Number.isInteger(r)||!Number.isInteger(s)||e<0||i<0||r<0||s<0||e>0xffffffffffff||i>4095||r>1073741823||s>4294967295)throw new RangeError("invalid field value");var n=new Uint8Array(16);return n[0]=e/Math.pow(2,40),n[1]=e/Math.pow(2,32),n[2]=e/Math.pow(2,24),n[3]=e/Math.pow(2,16),n[4]=e/Math.pow(2,8),n[5]=e,n[6]=112|i>>>8,n[7]=i,n[8]=128|r>>>24,n[9]=r>>>16,n[10]=r>>>8,n[11]=r,n[12]=s>>>24,n[13]=s>>>16,n[14]=s>>>8,n[15]=s,new t(n)}}]),t}(),xE=function(){function t(){Mr(this,t),Be(this,"timestamp",0),Be(this,"counter",0),Be(this,"random",new SE)}return Dr(t,[{key:"generate",value:function(){var e=this.generateOrAbort();if(Si(e)){this.timestamp=0;var i=this.generateOrAbort();if(Si(i))throw new Error("Could not generate UUID after timestamp reset");return i}return e}},{key:"generateOrAbort",value:function(){var e=Date.now();if(e>this.timestamp)this.timestamp=e,this.resetCounter();else{if(!(e+1e4>this.timestamp))return;this.counter++,this.counter>4398046511103&&(this.timestamp++,this.resetCounter())}return _E.fromFieldsV7(this.timestamp,Math.trunc(this.counter/Math.pow(2,30)),this.counter&Math.pow(2,30)-1,this.random.nextUint32())}},{key:"resetCounter",value:function(){this.counter=1024*this.random.nextUint32()+(1023&this.random.nextUint32())}}]),t}(),Wb=function(t){if(typeof UUIDV7_DENY_WEAK_RNG<"u"&&UUIDV7_DENY_WEAK_RNG)throw new Error("no cryptographically strong RNG available");for(var e=0;e<t.length;e++)t[e]=65536*Math.trunc(65536*Math.random())+Math.trunc(65536*Math.random());return t};oe&&!Si(oe.crypto)&&crypto.getRandomValues&&(Wb=function(t){return crypto.getRandomValues(t)});var xb,SE=function(){function t(){Mr(this,t),Be(this,"buffer",new Uint32Array(8)),Be(this,"cursor",1/0)}return Dr(t,[{key:"nextUint32",value:function(){return this.cursor>=this.buffer.length&&(Wb(this.buffer),this.cursor=0),this.buffer[this.cursor++]}}]),t}(),mh=function(){return wE().toString()},wE=function(){return(xb||(xb=new xE)).generate()},PE="Thu, 01 Jan 1970 00:00:00 GMT",Pp="",kE=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i;function CE(t,e){if(e){var i=function(s){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Ue;if(Pp)return Pp;if(!n||["localhost","127.0.0.1"].includes(s))return"";for(var a=s.split("."),h=Math.min(a.length,8),o="dmn_chk_"+mh(),c=new RegExp("(^|;)\\s*"+o+"=1");!Pp&&h--;){var g=a.slice(h).join("."),l=o+"=1;domain=."+g;n.cookie=l,c.test(n.cookie)&&(n.cookie=l+";expires="+PE,Pp=g)}return Pp}(t);if(!i){var r=function(s){var n=s.match(kE);return n?n[0]:""}(t);r!==i&&Te.info("Warning: cookie subdomain discovery mismatch",r,i),i=r}return i?"; domain=."+i:""}return""}var _a={is_supported:function(){return!!Ue},error:function(t){Te.error("cookieStore error: "+t)},get:function(t){if(Ue){try{for(var e=t+"=",i=Ue.cookie.split(";").filter(function(n){return n.length}),r=0;r<i.length;r++){for(var s=i[r];s.charAt(0)==" ";)s=s.substring(1,s.length);if(s.indexOf(e)===0)return decodeURIComponent(s.substring(e.length,s.length))}}catch{}return null}},parse:function(t){var e;try{e=JSON.parse(_a.get(t))||{}}catch{}return e},set:function(t,e,i,r,s){if(Ue)try{var n="",a="",h=CE(Ue.location.hostname,r);if(i){var o=new Date;o.setTime(o.getTime()+24*i*60*60*1e3),n="; expires="+o.toUTCString()}s&&(a="; secure");var c=t+"="+encodeURIComponent(JSON.stringify(e))+n+"; SameSite=Lax; path=/"+h+a;return c.length>3686.4&&Te.warn("cookieStore warning: large cookie, len="+c.length),Ue.cookie=c,c}catch{return}},remove:function(t,e){try{_a.set(t,"",-1,e)}catch{return}}},Fm=null,Lr={is_supported:function(){if(!Ts(Fm))return Fm;var t=!0;if(Si(oe))t=!1;else try{var e="__mplssupport__";Lr.set(e,"xyz"),Lr.get(e)!=='"xyz"'&&(t=!1),Lr.remove(e)}catch{t=!1}return t||Te.error("localStorage unsupported; falling back to cookie store"),Fm=t,t},error:function(t){Te.error("localStorage error: "+t)},get:function(t){try{return oe?.localStorage.getItem(t)}catch(e){Lr.error(e)}return null},parse:function(t){try{return JSON.parse(Lr.get(t))||{}}catch{}return null},set:function(t,e){try{oe?.localStorage.setItem(t,JSON.stringify(e))}catch(i){Lr.error(i)}},remove:function(t){try{oe?.localStorage.removeItem(t)}catch(e){Lr.error(e)}}},AE=["distinct_id",Kf,qf],Ep=ti(ti({},Lr),{},{parse:function(t){try{var e={};try{e=_a.parse(t)||{}}catch{}var i=ms(e,JSON.parse(Lr.get(t)||"{}"));return Lr.set(t,i),i}catch{}return null},set:function(t,e,i,r,s){try{Lr.set(t,e);var n={};AE.forEach(function(a){e[a]&&(n[a]=e[a])}),Object.keys(n).length&&_a.set(t,n,i,r,s)}catch(a){Lr.error(a)}},remove:function(t,e){try{oe?.localStorage.removeItem(t),_a.remove(t,e)}catch(i){Lr.error(i)}}}),Of={},EE={is_supported:function(){return!0},error:function(t){Te.error("memoryStorage error: "+t)},get:function(t){return Of[t]||null},parse:function(t){return Of[t]||null},set:function(t,e){Of[t]=e},remove:function(t){delete Of[t]}},uh=null,ys={is_supported:function(){if(!Ts(uh))return uh;if(uh=!0,Si(oe))uh=!1;else try{var t="__support__";ys.set(t,"xyz"),ys.get(t)!=='"xyz"'&&(uh=!1),ys.remove(t)}catch{uh=!1}return uh},error:function(t){Te.error("sessionStorage error: ",t)},get:function(t){try{return oe?.sessionStorage.getItem(t)}catch(e){ys.error(e)}return null},parse:function(t){try{return JSON.parse(ys.get(t))||null}catch{}return null},set:function(t,e){try{oe?.sessionStorage.setItem(t,JSON.stringify(e))}catch(i){ys.error(i)}},remove:function(t){try{oe?.sessionStorage.removeItem(t)}catch(e){ys.error(e)}}},TE=["localhost","127.0.0.1"],Hf=!(!ab||!("withCredentials"in new ab))||!!zm,Ub=function(t){var e=Ue?.createElement("a");return Si(e)?null:(e.href=t,e)},ME=function(t,e){return!!function(i){try{new RegExp(i)}catch{return!1}return!0}(e)&&new RegExp(e).test(t)},Sb=function(t,e){for(var i,r=((t.split("#")[0]||"").split("?")[1]||"").split("&"),s=0;s<r.length;s++){var n=r[s].split("=");if(n[0]===e){i=n;break}}if(!Hr(i)||i.length<2)return"";var a=i[1];try{a=decodeURIComponent(a)}catch{Te.error("Skipping decoding for malformed query param: "+a)}return a.replace(/\+/g," ")},tu=function(t,e){var i=t.match(new RegExp(e+"=([^&]*)"));return i?i[1]:null},qr={campaignParams:function(t){var e=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gclid","gad_source","gbraid","wbraid","fbclid","msclkid"].concat(t||[]),i={};return tr(e,function(r){var s=Ue?Sb(Ue.URL,r):"";s.length&&(i[r]=s)}),i},searchEngine:function(){var t=Ue?.referrer;return t?t.search("https?://(.*)google.([^/?]*)")===0?"google":t.search("https?://(.*)bing.com")===0?"bing":t.search("https?://(.*)yahoo.com")===0?"yahoo":t.search("https?://(.*)duckduckgo.com")===0?"duckduckgo":null:null},searchInfo:function(){var t=qr.searchEngine(),e=t!="yahoo"?"q":"p",i={};if(!Ts(t)){i.$search_engine=t;var r=Ue?Sb(Ue.referrer,e):"";r.length&&(i.ph_keyword=r)}return i},browser:function(t,e,i){return e=e||"",i||$i(t," OPR/")?$i(t,"Mini")?"Opera Mini":"Opera":/(BlackBerry|PlayBook|BB10)/i.test(t)?"BlackBerry":$i(t,"IEMobile")||$i(t,"WPDesktop")?"Internet Explorer Mobile":$i(t,"SamsungBrowser/")?"Samsung Internet":$i(t,"Edge")||$i(t,"Edg/")?"Microsoft Edge":$i(t,"FBIOS")?"Facebook Mobile":$i(t,"Chrome")?"Chrome":$i(t,"CriOS")?"Chrome iOS":$i(t,"UCWEB")||$i(t,"UCBrowser")?"UC Browser":$i(t,"FxiOS")?"Firefox iOS":$i(e,"Apple")||function(r){return $i(r,"Safari")&&!$i(r,"Chrome")&&!$i(r,"Android")}(t)?$i(t,"Mobile")?"Mobile Safari":"Safari":$i(t,"Android")?"Android Mobile":$i(t,"Konqueror")||$i(t,"konqueror")?"Konqueror":$i(t,"Firefox")?"Firefox":$i(t,"MSIE")||$i(t,"Trident/")?"Internet Explorer":$i(t,"Gecko")?"Mozilla":""},browserVersion:function(t,e,i){var r={"Internet Explorer Mobile":[/rv:(\d+(\.\d+)?)/],"Microsoft Edge":[/Edge?\/(\d+(\.\d+)?)/],Chrome:[/Chrome\/(\d+(\.\d+)?)/],"Chrome iOS":[/CriOS\/(\d+(\.\d+)?)/],"UC Browser":[/(UCBrowser|UCWEB)\/(\d+(\.\d+)?)/],Safari:[/Version\/(\d+(\.\d+)?)/],"Mobile Safari":[/Version\/(\d+(\.\d+)?)/],Opera:[/(Opera|OPR)\/(\d+(\.\d+)?)/],Firefox:[/Firefox\/(\d+(\.\d+)?)/],"Firefox iOS":[/FxiOS\/(\d+(\.\d+)?)/],Konqueror:[/Konqueror[:/]?(\d+(\.\d+)?)/i],BlackBerry:[/BlackBerry (\d+(\.\d+)?)/,/Version\/(\d+(\.\d+)?)/],"Android Mobile":[/android\s(\d+(\.\d+)?)/],"Samsung Internet":[/SamsungBrowser\/(\d+(\.\d+)?)/],"Internet Explorer":[/(rv:|MSIE )(\d+(\.\d+)?)/],Mozilla:[/rv:(\d+(\.\d+)?)/]}[qr.browser(t,e,i)];if(Si(r))return null;for(var s=0;s<r.length;s++){var n=r[s],a=t.match(n);if(a)return parseFloat(a[a.length-2])}return null},browserLanguage:function(){return navigator.language||navigator.userLanguage},os:function(t){if(/Windows/i.test(t)){if(/Phone/.test(t)||/WPDesktop/.test(t))return{os_name:"Windows Phone",os_version:""};var e=/Windows NT ([0-9.]+)/i.exec(t);return e&&e[1]?{os_name:"Windows",os_version:e[1]}:{os_name:"Windows",os_version:""}}if(/(iPhone|iPad|iPod)/.test(t)){var i=/OS (\d+)_(\d+)_?(\d+)?/i.exec(t);return i&&i[1]?{os_name:"iOS",os_version:[i[1],i[2],i[3]||"0"].join(".")}:{os_name:"iOS",os_version:""}}if(/Android/.test(t)){var r=/Android (\d+)\.(\d+)\.?(\d+)?/i.exec(t);return r&&r[1]?{os_name:"Android",os_version:[r[1],r[2],r[3]||"0"].join(".")}:{os_name:"Android",os_version:""}}if(/(BlackBerry|PlayBook|BB10)/i.test(t))return{os_name:"BlackBerry",os_version:""};if(/Mac/i.test(t)){var s=/Mac OS X (\d+)[_.](\d+)[_.]?(\d+)?/i.exec(t);return s&&s[1]?{os_name:"Mac OS X",os_version:[s[1],s[2],s[3]||"0"].join(".")}:{os_name:"Mac OS X",os_version:""}}return/Linux/.test(t)?{os_name:"Linux",os_version:""}:/CrOS/.test(t)?{os_name:"Chrome OS",os_version:""}:{os_name:"",os_version:""}},device:function(t){return/Windows Phone/i.test(t)||/WPDesktop/.test(t)?"Windows Phone":/iPad/.test(t)?"iPad":/iPod/.test(t)?"iPod Touch":/iPhone/.test(t)?"iPhone":/(BlackBerry|PlayBook|BB10)/i.test(t)?"BlackBerry":/Android/.test(t)&&!/Mobile/.test(t)?"Android Tablet":/Android/.test(t)?"Android":""},deviceType:function(t){var e=this.device(t);return e==="iPad"||e==="Android Tablet"?"Tablet":e?"Mobile":"Desktop"},referrer:function(){return Ue?.referrer||"$direct"},referringDomain:function(){var t;return Ue!=null&&Ue.referrer&&((t=Ub(Ue.referrer))===null||t===void 0?void 0:t.host)||"$direct"},properties:function(){if(!Tr)return{};var t=qr.os(Tr),e=t.os_name,i=t.os_version;return ms(Nm({$os:e,$os_version:i,$browser:qr.browser(Tr,navigator.vendor,Ms.opera),$device:qr.device(Tr),$device_type:qr.deviceType(Tr)}),{$current_url:bo?.href,$host:bo?.host,$pathname:bo?.pathname,$raw_user_agent:Tr.length>1e3?Tr.substring(0,997)+"...":Tr,$browser_version:qr.browserVersion(Tr,navigator.vendor,Ms.opera),$browser_language:qr.browserLanguage(),$screen_height:oe?.screen.height,$screen_width:oe?.screen.width,$viewport_height:oe?.innerHeight,$viewport_width:oe?.innerWidth,$lib:"web",$lib_version:yh.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Nb()/1e3})},people_properties:function(){if(!Tr)return{};var t=qr.os(Tr),e=t.os_name,i=t.os_version;return ms(Nm({$os:e,$os_version:i,$browser:qr.browser(Tr,navigator.vendor,Ms.opera)}),{$browser_version:qr.browserVersion(Tr,navigator.vendor,Ms.opera)})}},DE=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"],wb=function(){function t(e){Mr(this,t);var i="";e.token&&(i=e.token.replace(/\+/g,"PL").replace(/\//g,"SL").replace(/=/g,"EQ")),this.props={},this.campaign_params_saved=!1,this.custom_campaign_params=e.custom_campaign_params||[],e.persistence_name?this.name="ph_"+e.persistence_name:this.name="ph_"+i+"_posthog",DE.indexOf(e.persistence.toLowerCase())===-1&&(Te.critical("Unknown persistence type "+e.persistence+"; falling back to localStorage+cookie"),e.persistence="localStorage+cookie");var r=e.persistence.toLowerCase();r==="localstorage"&&Lr.is_supported()?this.storage=Lr:r==="localstorage+cookie"&&Ep.is_supported()?this.storage=Ep:r==="sessionstorage"&&ys.is_supported()?this.storage=ys:r==="memory"?this.storage=EE:r==="cookie"?this.storage=_a:Ep.is_supported()?this.storage=Ep:this.storage=_a,this.load(),this.update_config(e),this.save()}return Dr(t,[{key:"properties",value:function(){var e={};return tr(this.props,function(i,r){if(r===ol&&So(i))for(var s=Object.keys(i),n=0;n<s.length;n++)e["$feature/".concat(s[n])]=i[s[n]];else h=r,o=!1,(Ts(a=vE)?o:sb&&a.indexOf===sb?a.indexOf(h)!=-1:(tr(a,function(c){if(o||(o=c===h))return e0}),o))||(e[r]=i);var a,h,o}),e}},{key:"load",value:function(){if(!this.disabled){var e=this.storage.parse(this.name);e&&(this.props=ms({},e))}}},{key:"save",value:function(){this.disabled||this.storage.set(this.name,this.props,this.expire_days,this.cross_subdomain,this.secure)}},{key:"remove",value:function(){this.storage.remove(this.name,!1),this.storage.remove(this.name,!0)}},{key:"clear",value:function(){this.remove(),this.props={}}},{key:"register_once",value:function(e,i,r){var s=this;if(So(e)){Si(i)&&(i="None"),this.expire_days=Si(r)?this.default_expiry:r;var n=!1;if(tr(e,function(a,h){s.props.hasOwnProperty(h)&&s.props[h]!==i||(s.props[h]=a,n=!0)}),n)return this.save(),!0}return!1}},{key:"register",value:function(e,i){var r=this;if(So(e)){this.expire_days=Si(i)?this.default_expiry:i;var s=!1;if(tr(e,function(n,a){e.hasOwnProperty(a)&&r.props[a]!==n&&(r.props[a]=n,s=!0)}),s)return this.save(),!0}return!1}},{key:"unregister",value:function(e){e in this.props&&(delete this.props[e],this.save())}},{key:"update_campaign_params",value:function(){this.campaign_params_saved||(this.register(qr.campaignParams(this.custom_campaign_params)),this.campaign_params_saved=!0)}},{key:"update_search_keyword",value:function(){this.register(qr.searchInfo())}},{key:"update_referrer_info",value:function(){this.register({$referrer:this.props.$referrer||qr.referrer(),$referring_domain:this.props.$referring_domain||qr.referringDomain()})}},{key:"get_referrer_info",value:function(){return Nm({$referrer:this.props.$referrer,$referring_domain:this.props.$referring_domain})}},{key:"safe_merge",value:function(e){return tr(this.props,function(i,r){r in e||(e[r]=i)}),e}},{key:"update_config",value:function(e){this.default_expiry=this.expire_days=e.cookie_expiration,this.set_disabled(e.disable_persistence),this.set_cross_subdomain(e.cross_subdomain_cookie),this.set_secure(e.secure_cookie)}},{key:"set_disabled",value:function(e){this.disabled=e,this.disabled?this.remove():this.save()}},{key:"set_cross_subdomain",value:function(e){e!==this.cross_subdomain&&(this.cross_subdomain=e,this.remove(),this.save())}},{key:"get_cross_subdomain",value:function(){return!!this.cross_subdomain}},{key:"set_secure",value:function(e){e!==this.secure&&(this.secure=e,this.remove(),this.save())}},{key:"set_event_timer",value:function(e,i){var r=this.props[Ap]||{};r[e]=i,this.props[Ap]=r,this.save()}},{key:"remove_event_timer",value:function(e){var i=(this.props[Ap]||{})[e];return Si(i)||(delete this.props[Ap][e],this.save()),i}},{key:"get_user_state",value:function(){return this.props[qm]||"anonymous"}},{key:"set_user_state",value:function(e){this.props[qm]=e,this.save()}},{key:"get_quota_limits",value:function(){return this.props[Hm]||{}}},{key:"set_quota_limits",value:function(e){this.props[Hm]=e,this.save()}}]),t}(),Pb=2,IE=4,FE=Dr(function t(e){var i,r,s=this,n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};Mr(this,t),Be(this,"bucketSize",100),Be(this,"refillRate",10),Be(this,"mutationBuckets",{}),Be(this,"loggedTracker",{}),Be(this,"refillBuckets",function(){Object.keys(s.mutationBuckets).forEach(function(a){s.mutationBuckets[a]=s.mutationBuckets[a]+s.refillRate,s.mutationBuckets[a]>=s.bucketSize&&delete s.mutationBuckets[a]})}),Be(this,"getNodeOrRelevantParent",function(a){var h=s.rrweb.mirror.getNode(a);if(h?.nodeName!=="svg"&&h instanceof Element){var o=h.closest("svg");if(o)return[s.rrweb.mirror.getId(o),o]}return[a,h]}),Be(this,"numberOfChanges",function(a){var h,o,c,g,l,p,v,u;return((h=(o=a.removes)===null||o===void 0?void 0:o.length)!==null&&h!==void 0?h:0)+((c=(g=a.attributes)===null||g===void 0?void 0:g.length)!==null&&c!==void 0?c:0)+((l=(p=a.texts)===null||p===void 0?void 0:p.length)!==null&&l!==void 0?l:0)+((v=(u=a.adds)===null||u===void 0?void 0:u.length)!==null&&v!==void 0?v:0)}),Be(this,"throttleMutations",function(a){if(a.type!==3||a.data.source!==0)return a;var h=a.data,o=s.numberOfChanges(h);h.attributes&&(h.attributes=h.attributes.filter(function(g){var l,p,v,u=ea(s.getNodeOrRelevantParent(g.id),2),m=u[0],k=u[1];return s.mutationBuckets[m]===0?!1:(s.mutationBuckets[m]=(l=s.mutationBuckets[m])!==null&&l!==void 0?l:s.bucketSize,s.mutationBuckets[m]=Math.max(s.mutationBuckets[m]-1,0),s.mutationBuckets[m]===0&&(s.loggedTracker[m]||(s.loggedTracker[m]=!0,(p=(v=s.options).onBlockedNode)===null||p===void 0||p.call(v,m,k))),g)}));var c=s.numberOfChanges(h);return c!==0||o===c?a:void 0}),this.rrweb=e,this.options=n,this.refillRate=(i=this.options.refillRate)!==null&&i!==void 0?i:this.refillRate,this.bucketSize=(r=this.options.bucketSize)!==null&&r!==void 0?r:this.bucketSize,setInterval(function(){s.refillBuckets()},1e3)}),Um=function(t){return t[t.DomContentLoaded=0]="DomContentLoaded",t[t.Load=1]="Load",t[t.FullSnapshot=2]="FullSnapshot",t[t.IncrementalSnapshot=3]="IncrementalSnapshot",t[t.Meta=4]="Meta",t[t.Custom=5]="Custom",t[t.Plugin=6]="Plugin",t}(Um||{}),LE={initiatorTypes:["audio","beacon","body","css","early-hint","embed","fetch","frame","iframe","icon","image","img","input","link","navigation","object","ping","script","track","video","xmlhttprequest"],maskRequestFn:function(t){return t},recordHeaders:!1,recordBody:!1,recordInitialRequests:!1,recordPerformance:!1,performanceEntryTypeToObserve:["first-input","navigation","paint","resource"],payloadSizeLimitBytes:1e6},RE=["authorization","x-forwarded-for","authorization","cookie","set-cookie","x-api-key","x-real-ip","remote-addr","forwarded","proxy-authorization","x-csrf-token","x-csrftoken","x-xsrf-token"],VE=["/s/","/e/","/i/vo/e/"];function kb(t,e,i,r){var s=e?.["content-length"];return Si(s)?"[SessionReplay] no content-length header for ".concat(r,", cannot determine payload size"):s&&parseInt(s)>i?"[SessionReplay] ".concat(r," body too large to record"):t}var OE=function(t,e){var i,r,s,n=t.session_recording,a=n.recordHeaders!==!1&&e.recordHeaders,h=n.recordBody!==!1&&e.recordBody,o=n.recordPerformance!==!1&&e.recordPerformance,c=(i=n,s=Math.min(1e6,(r=i.payloadSizeLimitBytes)!==null&&r!==void 0?r:1e6),function(p){return p!=null&&p.requestBody&&(p.requestBody=kb(p.requestBody,p.requestHeaders,s,"Request")),p!=null&&p.responseBody&&(p.responseBody=kb(p.responseBody,p.responseHeaders,s,"Response")),p}),g=function(p){return c(function(m){var k=Ub(m.name);if(!(k&&k.pathname&&VE.includes(k.pathname)))return m}((v=p,Object.keys((u=v.requestHeaders)!==null&&u!==void 0?u:{}).forEach(function(m){var k;RE.includes(m.toLowerCase())&&((k=v.requestHeaders)===null||k===void 0||delete k[m])}),v)));var v,u},l=Vn(t.session_recording.maskNetworkRequestFn);return l&&Vn(t.session_recording.maskCapturedNetworkRequestFn)&&Te.warn("Both `maskNetworkRequestFn` and `maskCapturedNetworkRequestFn` are defined. `maskNetworkRequestFn` will be ignored."),l&&(t.session_recording.maskCapturedNetworkRequestFn=function(p){var v=t.session_recording.maskNetworkRequestFn({url:p.name});return ti(ti({},p),{},{name:v?.url})}),n.maskRequestFn=Vn(t.session_recording.maskCapturedNetworkRequestFn)?function(p){var v,u,m,k=g(p);return k&&(v=(u=(m=t.session_recording).maskCapturedNetworkRequestFn)===null||u===void 0?void 0:u.call(m,k))!==null&&v!==void 0?v:void 0}:void 0,n.maskRequestFn||(n.maskRequestFn=g),ti(ti(ti({},LE),n),{},{recordHeaders:a,recordBody:h,recordPerformance:o,recordInitialRequests:o})},BE="__ph_opt_in_out_";function zE(t,e){Jb(!0,t,e)}function NE(t,e){Jb(!1,t,e)}function GE(t,e){return Yb(t,e)==="1"}function Zb(t,e){return!!function(i){if(i&&i.respectDnt){var r=i&&i.window||oe,s=r?.navigator,n=!1;return tr([s?.doNotTrack,s.msDoNotTrack,r.doNotTrack],function(a){$i([!0,1,"1","yes"],a)&&(n=!0)}),n}return!1}(e)||Yb(t,e)==="0"}function $E(t,e){s0(e=e||{}).remove(n0(t,e),!!e.crossSubdomainCookie)}function s0(t){return(t=t||{}).persistenceType==="localStorage"?Lr:t.persistenceType==="localStorage+cookie"?Ep:_a}function n0(t,e){return((e=e||{}).persistencePrefix||BE)+t}function Yb(t,e){return s0(e).get(n0(t,e))}function Jb(t,e,i){yn(e)&&e.length?(s0(i=i||{}).set(n0(e,i),t?1:0,ba(i.cookieExpiration)?i.cookieExpiration:null,i.crossSubdomainCookie,i.secureCookie),i.capture&&t&&i.capture(i.captureEventName||"$opt_in",i.captureProperties||{},{send_instantly:!0})):Te.error("gdpr."+(t?"optIn":"optOut")+" called with an invalid token")}function Zm(t){var e=!1;try{var i=t.config.token,r=t.config.respect_dnt,s=t.config.opt_out_capturing_persistence_type,n=t.config.opt_out_capturing_cookie_prefix||void 0,a=t.config.window;i&&(e=Zb(i,{respectDnt:r,persistenceType:s,persistencePrefix:n,window:a}))}catch(h){Te.error("Unexpected error when checking capturing opt-out status: "+h)}return e}var va,Xb=3e5,Cb=Xb;(function(t){t[t.Mutation=0]="Mutation",t[t.MouseMove=1]="MouseMove",t[t.MouseInteraction=2]="MouseInteraction",t[t.Scroll=3]="Scroll",t[t.ViewportResize=4]="ViewportResize",t[t.Input=5]="Input",t[t.TouchMove=6]="TouchMove",t[t.MediaInteraction=7]="MediaInteraction",t[t.StyleSheetRule=8]="StyleSheetRule",t[t.CanvasMutation=9]="CanvasMutation",t[t.Font=10]="Font",t[t.Log=11]="Log",t[t.Drag=12]="Drag",t[t.StyleDeclaration=13]="StyleDeclaration",t[t.Selection=14]="Selection",t[t.AdoptedStyleSheet=15]="AdoptedStyleSheet"})(va||(va={}));var jE=[va.MouseMove,va.MouseInteraction,va.Scroll,va.ViewportResize,va.Input,va.TouchMove,va.MediaInteraction,va.Drag],Ab=function(t){return{rrwebMethod:t,enqueuedAt:Date.now(),attempt:1}},qE=function(){function t(e){var i=this;if(Mr(this,t),Be(this,"queuedRRWebEvents",[]),Be(this,"isIdle",!1),Be(this,"_linkedFlagSeen",!1),Be(this,"_lastActivityTimestamp",Date.now()),Be(this,"windowId",null),Be(this,"sessionId",null),Be(this,"_linkedFlag",null),Be(this,"_sampleRate",null),Be(this,"_minimumDuration",null),Be(this,"_recordCanvas",!1),Be(this,"_canvasFps",null),Be(this,"_canvasQuality",null),Be(this,"_forceAllowLocalhostNetworkCapture",!1),this.instance=e,this._captureStarted=!1,this._endpoint="/s/",this.stopRrweb=void 0,this.receivedDecide=!1,oe?.addEventListener("beforeunload",function(){i._flushBuffer()}),oe?.addEventListener("offline",function(){i._tryAddCustomEvent("browser offline",{})}),oe?.addEventListener("online",function(){i._tryAddCustomEvent("browser online",{})}),!this.instance.sessionManager)throw Te.error("Session recording started without valid sessionManager"),new Error("Session recording started without valid sessionManager. This is a bug.");this.buffer=this.clearBuffer()}return Dr(t,[{key:"started",get:function(){return this._captureStarted}},{key:"sessionManager",get:function(){if(!this.instance.sessionManager)throw Te.error("Session recording started without valid sessionManager"),new Error("Session recording started without valid sessionManager. This is a bug.");return this.instance.sessionManager}},{key:"isSampled",get:function(){return ba(this._sampleRate)?this.instance.get_property(qf):null}},{key:"sessionDuration",get:function(){var e,i,r=(e=this.buffer)===null||e===void 0?void 0:e.data[((i=this.buffer)===null||i===void 0?void 0:i.data.length)-1],s=this.sessionManager.checkAndGetSessionAndWindowId(!0).sessionStartTimestamp;return r?r.timestamp-s:null}},{key:"isRecordingEnabled",get:function(){var e=!!this.instance.get_property(Gm),i=!this.instance.config.disable_session_recording;return oe&&e&&i}},{key:"isConsoleLogCaptureEnabled",get:function(){var e=!!this.instance.get_property(mb),i=this.instance.config.enable_recording_console_log;return i??e}},{key:"recordingVersion",get:function(){var e,i=this.instance.get_property(gb);return((e=this.instance.config.session_recording)===null||e===void 0?void 0:e.recorderVersion)||i||"v1"}},{key:"networkPayloadCapture",get:function(){var e,i,r=this.instance.get_property(yb),s={recordHeaders:(e=this.instance.config.session_recording)===null||e===void 0?void 0:e.recordHeaders,recordBody:(i=this.instance.config.session_recording)===null||i===void 0?void 0:i.recordBody},n=s?.recordHeaders||r?.recordHeaders,a=s?.recordBody||r?.recordBody,h=this.instance.config.capture_performance||r?.capturePerformance;return n||a||h?{recordHeaders:n,recordBody:a,recordPerformance:h}:void 0}},{key:"status",get:function(){return this.receivedDecide?this.isRecordingEnabled?yn(this._linkedFlag)&&!this._linkedFlagSeen?"buffering":Bm(this.isSampled)?this.isSampled?"sampled":"disabled":"active":"disabled":"buffering"}},{key:"startRecordingIfEnabled",value:function(){this.isRecordingEnabled?(this.startCaptureAndTrySendingQueuedSnapshots(),Te.info("[SessionRecording] started")):(this.stopRecording(),this.clearBuffer())}},{key:"stopRecording",value:function(){this._captureStarted&&this.stopRrweb&&(this.stopRrweb(),this.stopRrweb=void 0,this._captureStarted=!1,Te.info("[SessionRecording] stopped"))}},{key:"makeSamplingDecision",value:function(e){var i,r=this.sessionId!==e;if(ba(this._sampleRate)){var s,n=this.isSampled;r||!Bm(n)?s=Math.random()<this._sampleRate:s=n,s||Te.warn("[SessionSampling] Sample rate (".concat(this._sampleRate,") has determined that this sessionId (").concat(e,") will not be sent to the server.")),(i=this.instance.persistence)===null||i===void 0||i.register(Be({},qf,s))}else{var a;(a=this.instance.persistence)===null||a===void 0||a.register(Be({},qf,null))}}},{key:"afterDecideResponse",value:function(e){var i,r,s,n,a,h,o,c,g,l,p,v=this;this.instance.persistence&&this.instance.persistence.register((Be(p={},Gm,!!e.sessionRecording),Be(p,mb,(c=e.sessionRecording)===null||c===void 0?void 0:c.consoleLogRecordingEnabled),Be(p,gb,(g=e.sessionRecording)===null||g===void 0?void 0:g.recorderVersion),Be(p,yb,ti({capturePerformance:e.capturePerformance},(l=e.sessionRecording)===null||l===void 0?void 0:l.networkPayloadCapture)),p));var u=(i=e.sessionRecording)===null||i===void 0?void 0:i.sampleRate;this._sampleRate=Si(u)||Ts(u)?null:parseFloat(u);var m=(r=e.sessionRecording)===null||r===void 0?void 0:r.minimumDurationMilliseconds;this._minimumDuration=Si(m)?null:m;var k=(s=e.sessionRecording)===null||s===void 0?void 0:s.recordCanvas;this._recordCanvas=!Si(k)&&!Ts(k)&&k;var y=(n=e.sessionRecording)===null||n===void 0?void 0:n.canvasFps;this._canvasFps=Si(y)?null:y;var d,b=(a=e.sessionRecording)===null||a===void 0?void 0:a.canvasQuality;if(this._canvasQuality=Si(b)||Ts(b)?null:parseFloat(b),this._linkedFlag=((h=e.sessionRecording)===null||h===void 0?void 0:h.linkedFlag)||null,(o=e.sessionRecording)!==null&&o!==void 0&&o.endpoint&&(this._endpoint=(d=e.sessionRecording)===null||d===void 0?void 0:d.endpoint),ba(this._sampleRate)&&this.sessionManager.onSessionId(function(E){v.makeSamplingDecision(E)}),yn(this._linkedFlag)){var S=this._linkedFlag;this.instance.onFeatureFlags(function(E){v._linkedFlagSeen=E.includes(S)})}this.receivedDecide=!0,this.startRecordingIfEnabled()}},{key:"log",value:function(e){var i,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"log";(i=this.instance.sessionRecording)===null||i===void 0||i.onRRwebEmit({type:6,data:{plugin:"rrweb/console@1",payload:{level:r,trace:[],payload:[JSON.stringify(e)]}},timestamp:Nb()})}},{key:"startCaptureAndTrySendingQueuedSnapshots",value:function(){this._startCapture()}},{key:"_startCapture",value:function(){var e=this;if(!Si(Object.assign)&&!(this._captureStarted||this.instance.config.disable_session_recording||Zm(this.instance))){this._captureStarted=!0,this.sessionManager.checkAndGetSessionAndWindowId();var i=this.recordingVersion==="v2"?"recorder-v2.js":"recorder.js";this.instance.__loaded_recorder_version!==this.recordingVersion?Mp(this.instance.config.api_host+"/static/".concat(i,"?v=").concat(yh.LIB_VERSION),function(r){if(r)return Te.error("Could not load ".concat(i),r);e._onScriptLoaded()}):this._onScriptLoaded()}}},{key:"_isInteractiveEvent",value:function(e){var i;return e.type===3&&jE.indexOf((i=e.data)===null||i===void 0?void 0:i.source)!==-1}},{key:"_updateWindowAndSessionIds",value:function(e){var i=this._isInteractiveEvent(e);i||this.isIdle||e.timestamp-this._lastActivityTimestamp>Cb&&(this.isIdle=!0,this._tryAddCustomEvent("sessionIdle",{reason:"user inactivity",timeSinceLastActive:e.timestamp-this._lastActivityTimestamp,threshold:Cb}));var r=!1;if(i&&(this._lastActivityTimestamp=e.timestamp,this.isIdle&&(this.isIdle=!1,this._tryAddCustomEvent("sessionNoLongerIdle",{reason:"user activity",type:e.type}),r=!0)),!this.isIdle){var s=this.sessionManager.checkAndGetSessionAndWindowId(!i,e.timestamp),n=s.windowId,a=s.sessionId,h=this.sessionId!==a,o=this.windowId!==n;this.windowId=n,this.sessionId=a,(r||[Pb,IE].indexOf(e.type)===-1&&(o||h))&&this._tryTakeFullSnapshot()}}},{key:"_tryRRWebMethod",value:function(e){try{return e.rrwebMethod(),!0}catch(i){return Te.warn("[Session-Recording] could not emit queued rrweb event.",i),this.queuedRRWebEvents.length<10&&this.queuedRRWebEvents.push({enqueuedAt:e.enqueuedAt||Date.now(),attempt:e.attempt++,rrwebMethod:e.rrwebMethod}),!1}}},{key:"_tryAddCustomEvent",value:function(e,i){var r=this;return this._tryRRWebMethod(Ab(function(){return r.rrwebRecord.addCustomEvent(e,i)}))}},{key:"_tryTakeFullSnapshot",value:function(){var e=this;return this._tryRRWebMethod(Ab(function(){return e.rrwebRecord.takeFullSnapshot()}))}},{key:"_onScriptLoaded",value:function(){var e,i=this,r={blockClass:"ph-no-capture",blockSelector:void 0,ignoreClass:"ph-ignore-input",maskTextClass:"ph-mask",maskTextSelector:void 0,maskTextFn:void 0,maskAllInputs:!0,maskInputOptions:{},maskInputFn:void 0,slimDOMOptions:{},collectFonts:!1,inlineStylesheet:!0,recordCrossOriginIframes:!1};this.rrwebRecord=oe.rrweb?oe.rrweb.record:oe.rrwebRecord;for(var s=this.instance.config.session_recording,n=0,a=Object.entries(s||{});n<a.length;n++){var h=ea(a[n],2),o=h[0],c=h[1];o in r&&(r[o]=c)}if(!this._recordCanvas||Ts(this._canvasFps)||Ts(this._canvasQuality)||(r.recordCanvas=!0,r.sampling={canvas:this._canvasFps},r.dataURLOptions={type:"image/webp",quality:this._canvasQuality}),this.rrwebRecord){this.mutationRateLimiter=(e=this.mutationRateLimiter)!==null&&e!==void 0?e:new FE(this.rrwebRecord,{onBlockedNode:function(l,p){var v="Too many mutations on node '".concat(l,"'. Rate limiting. This could be due to SVG animations or something similar");Te.info(v,{node:p}),i.log("[PostHog Recorder] "+v,"warn")}}),this._scheduleFullSnapshot();var g=this._gatherRRWebPlugins();this.stopRrweb=this.rrwebRecord(ti({emit:function(l){i.onRRwebEmit(l)},plugins:g},r)),this.instance._addCaptureHook(function(l){try{if(l==="$pageview"){var p=oe?i._maskUrl(oe.location.href):"";if(!p)return;i._tryAddCustomEvent("$pageview",{href:p})}}catch(v){Te.error("Could not add $pageview to rrweb session",v)}}),this._lastActivityTimestamp=Date.now(),this.isIdle=!1,this._tryAddCustomEvent("$session_options",{sessionRecordingOptions:r,activePlugins:g.map(function(l){return l?.name})})}else Te.error("onScriptLoaded was called but rrwebRecord is not available. This indicates something has gone wrong.")}},{key:"_scheduleFullSnapshot",value:function(){var e=this;this._fullSnapshotTimer&&clearInterval(this._fullSnapshotTimer),this._fullSnapshotTimer=setInterval(function(){e._tryTakeFullSnapshot()},Xb)}},{key:"_gatherRRWebPlugins",value:function(){var e=[];return Ms.rrwebConsoleRecord&&this.isConsoleLogCaptureEnabled&&e.push(Ms.rrwebConsoleRecord.getRecordConsolePlugin()),this.networkPayloadCapture&&Vn(Ms.getRecordNetworkPlugin)&&(!TE.includes(location.hostname)||this._forceAllowLocalhostNetworkCapture?e.push(Ms.getRecordNetworkPlugin(OE(this.instance.config,this.networkPayloadCapture))):Te.info("[SessionReplay-NetworkCapture] not started because we are on localhost.")),e}},{key:"onRRwebEmit",value:function(e){if(this._processQueuedEvents(),e&&So(e)){if(e.type===Um.Meta){var i=this._maskUrl(e.data.href);if(!i)return;e.data.href=i}e.type===Um.FullSnapshot&&this._scheduleFullSnapshot();var r=this.mutationRateLimiter?this.mutationRateLimiter.throttleMutations(e):e;if(r){var s=function(h){var o=h;if(o&&So(o)&&o.type===6&&So(o.data)&&o.data.plugin==="rrweb/console@1"){o.data.payload.payload.length>10&&(o.data.payload.payload=o.data.payload.payload.slice(0,10),o.data.payload.payload.push("...[truncated]"));for(var c=[],g=0;g<o.data.payload.payload.length;g++)o.data.payload.payload[g]&&o.data.payload.payload[g].length>2e3?c.push(o.data.payload.payload[g].slice(0,2e3)+"...[truncated]"):c.push(o.data.payload.payload[g]);return o.data.payload.payload=c,h}return h}(r),n=JSON.stringify(s).length;if(this._updateWindowAndSessionIds(s),!this.isIdle){var a={$snapshot_bytes:n,$snapshot_data:s,$session_id:this.sessionId,$window_id:this.windowId};this.status!=="disabled"?this._captureSnapshotBuffered(a):this.clearBuffer()}}}}},{key:"_processQueuedEvents",value:function(){var e=this;if(this.queuedRRWebEvents.length){var i=Zf(this.queuedRRWebEvents);this.queuedRRWebEvents=[],i.forEach(function(r){Date.now()-r.enqueuedAt>2e3?e._tryAddCustomEvent("rrwebQueueTimeout",{enqueuedAt:r.enqueuedAt,attempt:r.attempt,queueLength:i.length}):e._tryRRWebMethod(r)&&e._tryAddCustomEvent("rrwebQueueSuccess",{enqueuedAt:r.enqueuedAt,attempt:r.attempt,queueLength:i.length})})}}},{key:"_maskUrl",value:function(e){var i=this.instance.config.session_recording;if(i.maskNetworkRequestFn){var r,s={url:e};return(r=s=i.maskNetworkRequestFn(s))===null||r===void 0?void 0:r.url}return e}},{key:"clearBuffer",value:function(){return this.buffer=void 0,{size:0,data:[],sessionId:this.sessionId,windowId:this.windowId}}},{key:"_flushBuffer",value:function(){var e=this;this.flushBufferTimer&&(clearTimeout(this.flushBufferTimer),this.flushBufferTimer=void 0);var i=this._minimumDuration,r=this.sessionDuration,s=ba(r)&&r>=0,n=ba(i)&&s&&r<i;return this.status==="buffering"||n?(this.flushBufferTimer=setTimeout(function(){e._flushBuffer()},2e3),this.buffer||this.clearBuffer()):this.buffer&&this.buffer.data.length!==0?(this._captureSnapshot({$snapshot_bytes:this.buffer.size,$snapshot_data:this.buffer.data,$session_id:this.buffer.sessionId,$window_id:this.buffer.windowId}),this.clearBuffer()):this.buffer||this.clearBuffer()}},{key:"_captureSnapshotBuffered",value:function(e){var i,r=this,s=2+(((i=this.buffer)===null||i===void 0?void 0:i.data.length)||0);(!this.buffer||this.buffer.size+e.$snapshot_bytes+s>943718.4||this.buffer.sessionId&&this.buffer.sessionId!==this.sessionId)&&(this.buffer=this._flushBuffer()),Ts(this.buffer.sessionId)&&!Ts(this.sessionId)&&(this.buffer.sessionId=this.sessionId,this.buffer.windowId=this.windowId),this.buffer.size+=e.$snapshot_bytes,this.buffer.data.push(e.$snapshot_data),this.flushBufferTimer||(this.flushBufferTimer=setTimeout(function(){r._flushBuffer()},2e3))}},{key:"_captureSnapshot",value:function(e){this.instance.capture("$snapshot",e,{method:"POST",endpoint:this._endpoint,_noTruncate:!0,_batchKey:"recordings",_metrics:{rrweb_full_snapshot:e.$snapshot_data.type===Pb}})}}]),t}(),HE=function(){function t(e){Mr(this,t),this.instance=e,this.instance.decideEndpointWasHit=this.instance._hasBootstrappedFeatureFlags()}return Dr(t,[{key:"call",value:function(){var e=this,i=i0(JSON.stringify({token:this.instance.config.token,distinct_id:this.instance.get_distinct_id(),groups:this.instance.getGroups(),person_properties:this.instance.get_property(hl),group_properties:this.instance.get_property(_o),disable_flags:this.instance.config.advanced_disable_feature_flags||this.instance.config.advanced_disable_feature_flags_on_first_load||void 0}));this.instance._send_request("".concat(this.instance.config.api_host,"/decide/?v=3"),{data:i,verbose:!0},{method:"POST"},function(r){return e.parseDecideResponse(r)})}},{key:"parseDecideResponse",value:function(e){var i,r=this;if(this.instance.featureFlags.setReloadingPaused(!1),this.instance.featureFlags._startReloadTimer(),e?.status!==0){if(!Ue||!Ue.body)return Te.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout(function(){r.parseDecideResponse(e)},500);this.instance.toolbar.afterDecideResponse(e),(i=this.instance.sessionRecording)===null||i===void 0||i.afterDecideResponse(e),xo.afterDecideResponse(e,this.instance),this.instance._afterDecideResponse(e),this.instance.config.advanced_disable_feature_flags_on_first_load||this.instance.config.advanced_disable_feature_flags||this.instance.featureFlags.receivedFeatureFlags(e);var s=oe?.extendPostHogWithSurveys;e.surveys&&!s&&Mp(this.instance.config.api_host+"/static/surveys.js",function(g){if(g)return Te.error("Could not load surveys script",g);oe.extendPostHogWithSurveys(r.instance)});var n=oe?.extendPostHogWithExceptionAutoCapture;if(e.autocaptureExceptions&&e.autocaptureExceptions&&Si(n)&&Mp(this.instance.config.api_host+"/static/exception-autocapture.js",function(g){if(g)return Te.error("Could not load exception autocapture script",g);oe.extendPostHogWithExceptionAutocapture(r.instance,e)}),e.siteApps)if(this.instance.config.opt_in_site_apps){var a,h=this.instance.config.api_host,o=wo(e.siteApps);try{var c=function(){var g=a.value,l=g.id,p=g.url,v=[h,h[h.length-1]==="/"&&p[0]==="/"?p.substring(1):p].join("");Ms["__$$ph_site_app_".concat(l)]=r.instance,Mp(v,function(u){u&&Te.error("Error while initializing PostHog app with config id ".concat(l),u)})};for(o.s();!(a=o.n()).done;)c()}catch(g){o.e(g)}finally{o.f()}}else e.siteApps.length>0&&Te.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}else Te.error("Failed to fetch feature flags from PostHog.")}}]),t}(),WE=["https://app.posthog.com","https://eu.posthog.com"],UE=["source"],ZE=oe!=null&&oe.location?tu(oe.location.hash,"__posthog")||tu(location.hash,"state"):null,YE=function(){function t(e){Mr(this,t),this.instance=e}return Dr(t,[{key:"afterDecideResponse",value:function(e){var i=e.toolbarParams||e.editorParams||(e.toolbarVersion?{toolbarVersion:e.toolbarVersion}:{});e.isAuthenticated&&i.toolbarVersion&&i.toolbarVersion.indexOf("toolbar")===0&&this.loadToolbar(ti({},i))}},{key:"maybeLoadToolbar",value:function(){var e,i,r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:void 0,s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:void 0,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:void 0;if(!oe||!Ue)return!1;r=(e=r)!==null&&e!==void 0?e:oe.location,n=(i=n)!==null&&i!==void 0?i:oe.history;try{if(!s){try{oe.localStorage.setItem("test","test"),oe.localStorage.removeItem("test")}catch{return!1}s=oe?.localStorage}var a,h=ZE||tu(r.hash,"__posthog")||tu(r.hash,"state"),o=h?lb(function(){return JSON.parse(atob(decodeURIComponent(h)))})||lb(function(){return JSON.parse(decodeURIComponent(h))}):null;return o&&o.action==="ph_authorize"?((a=o).source="url",a&&Object.keys(a).length>0&&(o.desiredHash?r.hash=o.desiredHash:n?n.replaceState("",Ue.title,r.pathname+r.search):r.hash="")):((a=JSON.parse(s.getItem("_postHogToolbarParams")||"{}")).source="localstorage",delete a.userIntent),!(!a.token||this.instance.config.token!==a.token)&&(this.loadToolbar(a),!0)}catch{return!1}}},{key:"loadToolbar",value:function(e){var i=this;if(!oe||Ms._postHogToolbarLoaded)return!1;Ms._postHogToolbarLoaded=!0;var r=this.instance.config.api_host,s=3e5,n=Math.floor(Date.now()/s)*s,a="".concat(r).concat(r.endsWith("/")?"":"/","static/toolbar.js?t=").concat(n),h=!WE.includes(this.instance.config.api_host)&&this.instance.config.advanced_disable_toolbar_metrics,o=ti(ti({token:this.instance.config.token},e),{},{apiURL:r},h?{instrument:!1}:{});o.source;var c=lE(o,UE);return oe.localStorage.setItem("_postHogToolbarParams",JSON.stringify(c)),Mp(a,function(g){g?Te.error("Failed to load toolbar",g):(Ms.ph_load_toolbar||Ms.ph_load_editor)(o,i.instance)}),Tp(oe,"turbolinks:load",function(){Ms._postHogToolbarLoaded=!1,i.loadToolbar(o)}),!0}},{key:"_loadEditor",value:function(e){return this.loadToolbar(e)}},{key:"maybeLoadEditor",value:function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:void 0,i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:void 0,r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:void 0;return this.maybeLoadToolbar(e,i,r)}}]),t}(),Kb=function(){function t(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:3e3;Mr(this,t),this.isPolling=!0,this._event_queue=[],this._empty_queue_count=0,this._poller=void 0,this._pollInterval=e}return Dr(t,[{key:"setPollInterval",value:function(e){this._pollInterval=e,this.isPolling&&this.poll()}},{key:"poll",value:function(){}},{key:"unload",value:function(){}},{key:"getTime",value:function(){return new Date().getTime()}}]),t}(),JE=function(t){Rb(i,Kb);var e=Vb(i);function i(r){var s,n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:3e3;return Mr(this,i),(s=e.call(this,n)).handlePollRequest=r,s}return Dr(i,[{key:"enqueue",value:function(r,s,n){this._event_queue.push({url:r,data:s,options:n}),this.isPolling||(this.isPolling=!0,this.poll())}},{key:"poll",value:function(){var r=this;clearTimeout(this._poller),this._poller=setTimeout(function(){if(r._event_queue.length>0){var s=r.formatQueue(),n=function(h){var o=s[h],c=o.url,g=o.data,l=o.options;tr(g,function(p,v){g[v].offset=Math.abs(g[v].timestamp-r.getTime()),delete g[v].timestamp}),r.handlePollRequest(c,g,l)};for(var a in s)n(a);r._event_queue.length=0,r._empty_queue_count=0}else r._empty_queue_count++;r._empty_queue_count>4&&(r.isPolling=!1,r._empty_queue_count=0),r.isPolling&&r.poll()},this._pollInterval)}},{key:"unload",value:function(){var r=this;clearTimeout(this._poller);var s=this._event_queue.length>0?this.formatQueue():{};this._event_queue.length=0;var n=Object.values(s);[].concat(Zf(n.filter(function(a){return a.url.indexOf("/e")===0})),Zf(n.filter(function(a){return a.url.indexOf("/e")!==0}))).map(function(a){var h=a.url,o=a.data,c=a.options;r.handlePollRequest(h,o,ti(ti({},c),{},{transport:"sendBeacon"}))})}},{key:"formatQueue",value:function(){var r={};return tr(this._event_queue,function(s){var n=s.url,a=s.data,h=s.options,o=(h?h._batchKey:null)||n;Si(r[o])&&(r[o]={data:[],url:n,options:h}),h&&r[o].options&&r[o].options._metrics&&!r[o].options._metrics.rrweb_full_snapshot&&(r[o].options._metrics.rrweb_full_snapshot=h._metrics.rrweb_full_snapshot),r[o].data.push(a)}),r}}]),i}(),vn=Uint8Array,zs=Uint16Array,pl=Uint32Array,a0=new vn([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]),o0=new vn([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]),Eb=new vn([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Qb=function(t,e){for(var i=new zs(31),r=0;r<31;++r)i[r]=e+=1<<t[r-1];var s=new pl(i[30]);for(r=1;r<30;++r)for(var n=i[r];n<i[r+1];++n)s[n]=n-i[r]<<5|r;return[i,s]},t_=Qb(a0,2),XE=t_[0],Ym=t_[1];XE[28]=258,Ym[258]=28;for(Jm=Qb(o0,0)[1],eu=new zs(32768),nr=0;nr<32768;++nr)yo=(43690&nr)>>>1|(21845&nr)<<1,yo=(61680&(yo=(52428&yo)>>>2|(13107&yo)<<2))>>>4|(3855&yo)<<4,eu[nr]=((65280&yo)>>>8|(255&yo)<<8)>>>1;var yo,Jm,eu,nr,Dp=function(t,e,i){for(var r=t.length,s=0,n=new zs(e);s<r;++s)++n[t[s]-1];var a,h=new zs(e);for(s=0;s<e;++s)h[s]=h[s-1]+n[s-1]<<1;if(i){a=new zs(1<<e);var o=15-e;for(s=0;s<r;++s)if(t[s])for(var c=s<<4|t[s],g=e-t[s],l=h[t[s]-1]++<<g,p=l|(1<<g)-1;l<=p;++l)a[eu[l]>>>o]=c}else for(a=new zs(r),s=0;s<r;++s)a[s]=eu[h[t[s]-1]++]>>>15-t[s];return a},vh=new vn(288);for(nr=0;nr<144;++nr)vh[nr]=8;for(nr=144;nr<256;++nr)vh[nr]=9;for(nr=256;nr<280;++nr)vh[nr]=7;for(nr=280;nr<288;++nr)vh[nr]=8;var iu=new vn(32);for(nr=0;nr<32;++nr)iu[nr]=5;var dh,KE=Dp(vh,9,0),QE=Dp(iu,5,0),e_=function(t){return(t/8>>0)+(7&t&&1)},i_=function(t,e,i){(e==null||e<0)&&(e=0),(i==null||i>t.length)&&(i=t.length);var r=new(t instanceof zs?zs:t instanceof pl?pl:vn)(i-e);return r.set(t.subarray(e,i)),r},$a=function(t,e,i){i<<=7&e;var r=e/8>>0;t[r]|=i,t[r+1]|=i>>>8},kp=function(t,e,i){i<<=7&e;var r=e/8>>0;t[r]|=i,t[r+1]|=i>>>8,t[r+2]|=i>>>16},Lm=function(t,e){for(var i=[],r=0;r<t.length;++r)t[r]&&i.push({s:r,f:t[r]});var s=i.length,n=i.slice();if(!s)return[new vn(0),0];if(s==1){var a=new vn(i[0].s+1);return a[i[0].s]=1,[a,1]}i.sort(function(E,I){return E.f-I.f}),i.push({s:-1,f:25001});var h=i[0],o=i[1],c=0,g=1,l=2;for(i[0]={s:-1,f:h.f+o.f,l:h,r:o};g!=s-1;)h=i[i[c].f<i[l].f?c++:l++],o=i[c!=g&&i[c].f<i[l].f?c++:l++],i[g++]={s:-1,f:h.f+o.f,l:h,r:o};var p=n[0].s;for(r=1;r<s;++r)n[r].s>p&&(p=n[r].s);var v=new zs(p+1),u=t2(i[g-1],v,0);if(u>e){r=0;var m=0,k=u-e,y=1<<k;for(n.sort(function(E,I){return v[I.s]-v[E.s]||E.f-I.f});r<s;++r){var d=n[r].s;if(!(v[d]>e))break;m+=y-(1<<u-v[d]),v[d]=e}for(m>>>=k;m>0;){var b=n[r].s;v[b]<e?m-=1<<e-v[b]++-1:++r}for(;r>=0&&m;--r){var S=n[r].s;v[S]==e&&(--v[S],++m)}u=e}return[new vn(v),u]},t2=function t(e,i,r){return e.s==-1?Math.max(t(e.l,i,r+1),t(e.r,i,r+1)):i[e.s]=r},Tb=function(t){for(var e=t.length;e&&!t[--e];);for(var i=new zs(++e),r=0,s=t[0],n=1,a=function(o){i[r++]=o},h=1;h<=e;++h)if(t[h]==s&&h!=e)++n;else{if(!s&&n>2){for(;n>138;n-=138)a(32754);n>2&&(a(n>10?n-11<<5|28690:n-3<<5|12305),n=0)}else if(n>3){for(a(s),--n;n>6;n-=6)a(8304);n>2&&(a(n-3<<5|8208),n=0)}for(;n--;)a(s);n=1,s=t[h]}return[i.subarray(0,r),e]},Cp=function(t,e){for(var i=0,r=0;r<e.length;++r)i+=t[r]*e[r];return i},Wf=function(t,e,i){var r=i.length,s=e_(e+2);t[s]=255&r,t[s+1]=r>>>8,t[s+2]=255^t[s],t[s+3]=255^t[s+1];for(var n=0;n<r;++n)t[s+n+4]=i[n];return 8*(s+4+r)},Mb=function(t,e,i,r,s,n,a,h,o,c,g){$a(e,g++,i),++s[256];for(var l=Lm(s,15),p=l[0],v=l[1],u=Lm(n,15),m=u[0],k=u[1],y=Tb(p),d=y[0],b=y[1],S=Tb(m),E=S[0],I=S[1],B=new zs(19),G=0;G<d.length;++G)B[31&d[G]]++;for(G=0;G<E.length;++G)B[31&E[G]]++;for(var it=Lm(B,7),lt=it[0],ft=it[1],ct=19;ct>4&&!lt[Eb[ct-1]];--ct);var St,K,bt,D,O=c+5<<3,w=Cp(s,vh)+Cp(n,iu)+a,L=Cp(s,p)+Cp(n,m)+a+14+3*ct+Cp(B,lt)+(2*B[16]+3*B[17]+7*B[18]);if(O<=w&&O<=L)return Wf(e,g,t.subarray(o,o+c));if($a(e,g,1+(L<w)),g+=2,L<w){St=Dp(p,v,0),K=p,bt=Dp(m,k,0),D=m;var X=Dp(lt,ft,0);for($a(e,g,b-257),$a(e,g+5,I-1),$a(e,g+10,ct-4),g+=14,G=0;G<ct;++G)$a(e,g+3*G,lt[Eb[G]]);g+=3*ct;for(var U=[d,E],zt=0;zt<2;++zt){var Dt=U[zt];for(G=0;G<Dt.length;++G){var Nt=31&Dt[G];$a(e,g,X[Nt]),g+=lt[Nt],Nt>15&&($a(e,g,Dt[G]>>>5&127),g+=Dt[G]>>>12)}}}else St=KE,K=vh,bt=QE,D=iu;for(G=0;G<h;++G)if(r[G]>255){Nt=r[G]>>>18&31,kp(e,g,St[Nt+257]),g+=K[Nt+257],Nt>7&&($a(e,g,r[G]>>>23&31),g+=a0[Nt]);var Ot=31&r[G];kp(e,g,bt[Ot]),g+=D[Ot],Ot>3&&(kp(e,g,r[G]>>>5&8191),g+=o0[Ot])}else kp(e,g,St[r[G]]),g+=K[r[G]];return kp(e,g,St[256]),g+K[256]},e2=new pl([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),i2=new vn(0),r2=function(){for(var t=new pl(256),e=0;e<256;++e){for(var i=e,r=9;--r;)i=(1&i&&3988292384)^i>>>1;t[e]=i}return t}(),s2=function(){var t=4294967295;return{p:function(e){for(var i=t,r=0;r<e.length;++r)i=r2[255&i^e[r]]^i>>>8;t=i},d:function(){return 4294967295^t}}},n2=function(t,e,i,r,s){return function(n,a,h,o,c,g){var l=n.length,p=new vn(o+l+5*(1+Math.floor(l/7e3))+c),v=p.subarray(o,p.length-c),u=0;if(!a||l<8)for(var m=0;m<=l;m+=65535){var k=m+65535;k<l?u=Wf(v,u,n.subarray(m,k)):(v[m]=g,u=Wf(v,u,n.subarray(m,l)))}else{for(var y=e2[a-1],d=y>>>13,b=8191&y,S=(1<<h)-1,E=new zs(32768),I=new zs(S+1),B=Math.ceil(h/3),G=2*B,it=function(Ze){return(n[Ze]^n[Ze+1]<<B^n[Ze+2]<<G)&S},lt=new pl(25e3),ft=new zs(288),ct=new zs(32),St=0,K=0,bt=(m=0,0),D=0,O=0;m<l;++m){var w=it(m),L=32767&m,X=I[w];if(E[L]=X,I[w]=L,D<=m){var U=l-m;if((St>7e3||bt>24576)&&U>423){u=Mb(n,v,0,lt,ft,ct,K,bt,O,m-O,u),bt=St=K=0,O=m;for(var zt=0;zt<286;++zt)ft[zt]=0;for(zt=0;zt<30;++zt)ct[zt]=0}var Dt=2,Nt=0,Ot=b,Qt=L-X&32767;if(U>2&&w==it(m-Qt))for(var ne=Math.min(d,U)-1,pe=Math.min(32767,m),be=Math.min(258,U);Qt<=pe&&--Ot&&L!=X;){if(n[m+Dt]==n[m+Dt-Qt]){for(var de=0;de<be&&n[m+de]==n[m+de-Qt];++de);if(de>Dt){if(Dt=de,Nt=Qt,de>ne)break;var Zt=Math.min(Qt,de-2),ue=0;for(zt=0;zt<Zt;++zt){var Wt=m-Qt+zt+32768&32767,Bt=Wt-E[Wt]+32768&32767;Bt>ue&&(ue=Bt,X=Wt)}}}Qt+=(L=X)-(X=E[L])+32768&32767}if(Nt){lt[bt++]=268435456|Ym[Dt]<<18|Jm[Nt];var Ge=31&Ym[Dt],si=31&Jm[Nt];K+=a0[Ge]+o0[si],++ft[257+Ge],++ct[si],D=m+Dt,++St}else lt[bt++]=n[m],++ft[n[m]]}}u=Mb(n,v,g,lt,ft,ct,K,bt,O,m-O,u),g||(u=Wf(v,u,i2))}return i_(p,0,o+e_(u)+c)}(t,e.level==null?6:e.level,e.mem==null?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(t.length)))):12+e.mem,i,r,!s)},Xm=function(t,e,i){for(;i;++e)t[e]=i,i>>>=8},a2=function(t,e){var i=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&&Xm(t,4,Math.floor(new Date(e.mtime||Date.now())/1e3)),i){t[3]=8;for(var r=0;r<=i.length;++r)t[r+10]=i.charCodeAt(r)}},o2=function(t){return 10+(t.filename&&t.filename.length+1||0)};function h2(t,e){e===void 0&&(e={});var i=s2(),r=t.length;i.p(t);var s=n2(t,e,o2(e),8),n=s.length;return a2(s,e),Xm(s,n-8,i.d()),Xm(s,n-4,r),s}function l2(t,e){var i=t.length;if(!e&&typeof TextEncoder<"u")return new TextEncoder().encode(t);for(var r=new vn(t.length+(t.length>>>1)),s=0,n=function(c){r[s++]=c},a=0;a<i;++a){if(s+5>r.length){var h=new vn(s+8+(i-a<<1));h.set(r),r=h}var o=t.charCodeAt(a);o<128||e?n(o):o<2048?(n(192|o>>>6),n(128|63&o)):o>55295&&o<57344?(n(240|(o=65536+(1047552&o)|1023&t.charCodeAt(++a))>>>18),n(128|o>>>12&63),n(128|o>>>6&63),n(128|63&o)):(n(224|o>>>12),n(128|o>>>6&63),n(128|63&o))}return i_(r,0,s)}(function(t){t.GZipJS="gzip-js",t.Base64="base64"})(dh||(dh={}));var h0=function(t,e,i){var r=e||{};r.ip=i.ip?1:0,r._=new Date().getTime().toString(),r.ver=yh.LIB_VERSION;var s=t.split("?");if(s.length>1){var n,a=wo(s[1].split("&"));try{for(a.s();!(n=a.n()).done;){var h=n.value.split("=")[0];Si(r[h])||delete r[h]}}catch(c){a.e(c)}finally{a.f()}}var o=t.indexOf("?")>-1?"&":"?";return t+o+function(c){var g,l,p=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"&",v=[];return tr(c,function(u,m){Si(u)||Si(m)||m==="undefined"||(g=encodeURIComponent(u.toString()),l=encodeURIComponent(m),v[v.length]=l+"="+g)}),v.join(p)}(r)},ru=function t(e,i){if(i.blob&&e.buffer)return new Blob([ib(e)?e:e.buffer],{type:"text/plain"});if(i.sendBeacon||i.blob){var r=t(e,{method:"POST"});return new Blob([r],{type:"application/x-www-form-urlencoded"})}return i.method!=="POST"?null:(s=Hr(e)||ib(e)?"data="+encodeURIComponent(e):"data="+encodeURIComponent(e.data),"compression"in e&&e.compression&&(s+="&compression="+e.compression),s);var s},r_=function(t){if(zm&&t.options.transport==="fetch"){var e,i=ru(t.data,t.options),r=new Headers;tr(r,function(n,a){r.append(a,n)}),t.options.method!=="POST"||t.options.blob||r.append("Content-Type","application/x-www-form-urlencoded");var s=t.url;return ba(t.retriesPerformedSoFar)&&t.retriesPerformedSoFar>0&&(s=h0(s,{retry_count:t.retriesPerformedSoFar},{})),void zm(s,{method:((e=t.options)===null||e===void 0?void 0:e.method)||"GET",headers:r,keepalive:t.options.method==="POST",body:i}).then(function(n){var a=n.status;return n.text().then(function(h){var o,c;if((o=t.onResponse)===null||o===void 0||o.call(t,{statusCode:a,responseText:h}),a!==200)Vn(t.onError)&&t.onError({statusCode:a,responseText:h}),(a<400||a>500)&&t.retryQueue.enqueue(ti(ti({},t),{},{headers:r,retriesPerformedSoFar:(t.retriesPerformedSoFar||0)+1})),(c=t.callback)===null||c===void 0||c.call(t,{status:0});else try{var g;(g=t.callback)===null||g===void 0||g.call(t,JSON.parse(h))}catch(l){Te.error(l)}})}).catch(function(n){var a;Te.error(n),(a=t.callback)===null||a===void 0||a.call(t,{status:0})})}return p2(t)},p2=function(t){var e=t.url,i=t.data,r=t.headers,s=t.options,n=t.callback,a=t.retriesPerformedSoFar,h=t.retryQueue,o=t.onError,c=t.timeout,g=c===void 0?6e4:c,l=t.onResponse;ba(a)&&a>0&&(e=h0(e,{retry_count:a},{}));var p=new XMLHttpRequest;p.open(s.method||"GET",e,!0);var v=ru(i,s);tr(r,function(u,m){p.setRequestHeader(m,u)}),s.method!=="POST"||s.blob||p.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),p.timeout=g,p.withCredentials=!0,p.onreadystatechange=function(){if(p.readyState===4){var u={statusCode:p.status,responseText:p.responseText};if(l?.(u),p.status===200){if(n){var m;try{m=JSON.parse(p.responseText)}catch(k){return void Te.error(k)}n(m)}}else Vn(o)&&o(u),(p.status<400||p.status>500)&&h.enqueue({url:e,data:i,options:s,headers:r,retriesPerformedSoFar:(a||0)+1,callback:n}),n?.({status:0})}},p.send(v)},c2=function(t){Rb(i,Kb);var e=Vb(i);function i(r,s){var n;return Mr(this,i),(n=e.call(this)).isPolling=!1,n.queue=[],n.areWeOnline=!0,n.onRequestError=r,n.rateLimiter=s,!Si(oe)&&"onLine"in oe.navigator&&(n.areWeOnline=oe.navigator.onLine,oe.addEventListener("online",function(){n._handleWeAreNowOnline()}),oe.addEventListener("offline",function(){n.areWeOnline=!1})),n}return Dr(i,[{key:"enqueue",value:function(r){var s=r.retriesPerformedSoFar||0;if(!(s>=10)){var n=function(o){var c=3e3*Math.pow(2,o),g=c/2,l=Math.min(18e5,c),p=(Math.random()-.5)*(l-g);return Math.ceil(l+p)}(s),a=new Date(Date.now()+n);this.queue.push({retryAt:a,requestData:r});var h="Enqueued failed request for retry in ".concat(n);navigator.onLine||(h+=" (Browser is offline)"),Te.warn(h),this.isPolling||(this.isPolling=!0,this.poll())}}},{key:"poll",value:function(){var r=this;this._poller&&clearTimeout(this._poller),this._poller=setTimeout(function(){r.areWeOnline&&r.queue.length>0&&r.flush(),r.poll()},this._pollInterval)}},{key:"flush",value:function(){var r=new Date(Date.now()),s=this.queue.filter(function(o){return o.retryAt<r});if(s.length>0){this.queue=this.queue.filter(function(o){return o.retryAt>=r});var n,a=wo(s);try{for(a.s();!(n=a.n()).done;){var h=n.value.requestData;this._executeXhrRequest(h)}}catch(o){a.e(o)}finally{a.f()}}}},{key:"unload",value:function(){this._poller&&(clearTimeout(this._poller),this._poller=void 0);var r,s=wo(this.queue);try{for(s.s();!(r=s.n()).done;){var n=r.value.requestData,a=n.url,h=n.data,o=n.options;if(this.rateLimiter.isRateLimited(o._batchKey))Te.warn("[RetryQueue] is quota limited. Dropping request.");else try{oe?.navigator.sendBeacon(a,ru(h,ti(ti({},o),{},{sendBeacon:!0})))}catch(c){Te.error(c)}}}catch(c){s.e(c)}finally{s.f()}this.queue=[]}},{key:"_executeXhrRequest",value:function(r){var s=r.url,n=r.data,a=r.options,h=r.headers,o=r.callback,c=r.retriesPerformedSoFar;this.rateLimiter.isRateLimited(a._batchKey)||r_({url:s,data:n||{},options:a||{},headers:h||{},retriesPerformedSoFar:c||0,callback:o,retryQueue:this,onError:this.onRequestError,onResponse:this.rateLimiter.checkForLimiting})}},{key:"_handleWeAreNowOnline",value:function(){this.areWeOnline=!0,this.flush()}}]),i}(),Bf=1800,f2=function(){function t(e,i,r,s){Mr(this,t),Be(this,"_sessionIdChangedHandlers",[]),this.config=e,this.persistence=i,this._windowId=void 0,this._sessionId=void 0,this._sessionStartTimestamp=null,this._sessionActivityTimestamp=null,this._sessionIdGenerator=r||mh,this._windowIdGenerator=s||mh;var n=e.persistence_name||e.token,a=e.session_idle_timeout_seconds||Bf;if(ba(a)?a>Bf?Te.warn("session_idle_timeout_seconds cannot be greater than 30 minutes. Using 30 minutes instead."):a<60&&Te.warn("session_idle_timeout_seconds cannot be less than 60 seconds. Using 60 seconds instead."):(Te.warn("session_idle_timeout_seconds must be a number. Defaulting to 30 minutes."),a=Bf),this._sessionTimeoutMs=1e3*Math.min(Math.max(a,60),Bf),this._window_id_storage_key="ph_"+n+"_window_id",this._primary_window_exists_storage_key="ph_"+n+"_primary_window_exists",this._canUseSessionStorage()){var h=ys.parse(this._window_id_storage_key),o=ys.parse(this._primary_window_exists_storage_key);h&&!o?this._windowId=h:ys.remove(this._window_id_storage_key),ys.set(this._primary_window_exists_storage_key,!0)}this._listenToReloadWindow()}return Dr(t,[{key:"onSessionId",value:function(e){var i=this;return Si(this._sessionIdChangedHandlers)&&(this._sessionIdChangedHandlers=[]),this._sessionIdChangedHandlers.push(e),this._sessionId&&e(this._sessionId,this._windowId),function(){i._sessionIdChangedHandlers=i._sessionIdChangedHandlers.filter(function(r){return r!==e})}}},{key:"_canUseSessionStorage",value:function(){return this.config.persistence!=="memory"&&!this.persistence.disabled&&ys.is_supported()}},{key:"_setWindowId",value:function(e){e!==this._windowId&&(this._windowId=e,this._canUseSessionStorage()&&ys.set(this._window_id_storage_key,e))}},{key:"_getWindowId",value:function(){return this._windowId?this._windowId:this._canUseSessionStorage()?ys.parse(this._window_id_storage_key):null}},{key:"_setSessionId",value:function(e,i,r){e===this._sessionId&&i===this._sessionActivityTimestamp&&r===this._sessionStartTimestamp||(this._sessionStartTimestamp=r,this._sessionActivityTimestamp=i,this._sessionId=e,this.persistence.register(Be({},Kf,[i,e,r])))}},{key:"_getSessionId",value:function(){if(this._sessionId&&this._sessionActivityTimestamp&&this._sessionStartTimestamp)return[this._sessionActivityTimestamp,this._sessionId,this._sessionStartTimestamp];var e=this.persistence.props[Kf];return Hr(e)&&e.length===2&&e.push(e[0]),e||[0,null,0]}},{key:"resetSessionId",value:function(){this._setSessionId(null,null,null)}},{key:"_listenToReloadWindow",value:function(){var e=this;oe?.addEventListener("beforeunload",function(){e._canUseSessionStorage()&&ys.remove(e._primary_window_exists_storage_key)})}},{key:"checkAndGetSessionAndWindowId",value:function(){var e=arguments.length>0&&arguments[0]!==void 0&&arguments[0],i=(arguments.length>1&&arguments[1]!==void 0?arguments[1]:null)||new Date().getTime(),r=ea(this._getSessionId(),3),s=r[0],n=r[1],a=r[2],h=this._getWindowId(),o=a&&a>0&&Math.abs(i-a)>864e5,c=!1,g=!n,l=!e&&Math.abs(i-s)>this._sessionTimeoutMs;g||l||o?(n=this._sessionIdGenerator(),h=this._windowIdGenerator(),Te.info("[SessionId] new session ID generated",{sessionId:n,windowId:h,changeReason:{noSessionId:g,activityTimeout:l,sessionPastMaximumLength:o}}),a=i,c=!0):h||(h=this._windowIdGenerator(),c=!0);var p=s===0||!e||o?i:s,v=a===0?new Date().getTime():a;return this._setWindowId(h),this._setSessionId(n,p,v),c&&this._sessionIdChangedHandlers.forEach(function(u){return u(n,h)}),{sessionId:n,windowId:h,sessionStartTimestamp:v}}}]),t}(),u2=Dr(function t(e,i,r,s){Mr(this,t),this.name="posthog-js",this.setupOnce=function(n){n(function(a){var h,o,c,g,l;if(a.level!=="error"||!e.__loaded)return a;a.tags||(a.tags={});var p=e.config.ui_host||e.config.api_host;a.tags["PostHog Person URL"]=p+"/person/"+e.get_distinct_id(),e.sessionRecordingStarted()&&(a.tags["PostHog Recording URL"]=e.get_session_replay_url({withTimestamp:!0}));var v=((h=a.exception)===null||h===void 0?void 0:h.values)||[],u={$exception_message:(o=v[0])===null||o===void 0?void 0:o.value,$exception_type:(c=v[0])===null||c===void 0?void 0:c.type,$exception_personURL:p+"/person/"+e.get_distinct_id(),$sentry_event_id:a.event_id,$sentry_exception:a.exception,$sentry_exception_message:(g=v[0])===null||g===void 0?void 0:g.value,$sentry_exception_type:(l=v[0])===null||l===void 0?void 0:l.type,$sentry_tags:a.tags};return i&&r&&(u.$sentry_url=(s||"https://sentry.io/organizations/")+i+"/issues/?project="+r+"&query="+a.event_id),e.capture("$exception",u),a})}}),d2=function(){function t(e){var i=this;Mr(this,t),Be(this,"_hasSeenPageView",!1),Be(this,"_updateScrollData",function(){var r,s,n,a;i._pageViewData||(i._pageViewData=i._createPageViewData());var h=i._pageViewData,o=i._scrollY(),c=i._scrollHeight(),g=i._contentY(),l=i._contentHeight();h.lastScrollY=o,h.maxScrollY=Math.max(o,(r=h.maxScrollY)!==null&&r!==void 0?r:0),h.maxScrollHeight=Math.max(c,(s=h.maxScrollHeight)!==null&&s!==void 0?s:0),h.lastContentY=g,h.maxContentY=Math.max(g,(n=h.maxContentY)!==null&&n!==void 0?n:0),h.maxContentHeight=Math.max(l,(a=h.maxContentHeight)!==null&&a!==void 0?a:0)}),this._instance=e}return Dr(t,[{key:"_createPageViewData",value:function(){var e;return{pathname:(e=oe?.location.pathname)!==null&&e!==void 0?e:""}}},{key:"doPageView",value:function(){var e,i;return this._hasSeenPageView?(i=this._pageViewData,this._pageViewData=this._createPageViewData()):(this._hasSeenPageView=!0,i=void 0,this._pageViewData||(this._pageViewData=this._createPageViewData())),setTimeout(this._updateScrollData,0),ti({$prev_pageview_pathname:(e=i)===null||e===void 0?void 0:e.pathname},this._calculatePrevPageScrollProperties(i))}},{key:"doPageLeave",value:function(){var e=this._pageViewData;return ti({$prev_pageview_pathname:e?.pathname},this._calculatePrevPageScrollProperties(e))}},{key:"_calculatePrevPageScrollProperties",value:function(e){if(!e||e.maxScrollHeight==null||e.lastScrollY==null||e.maxScrollY==null||e.maxContentHeight==null||e.lastContentY==null||e.maxContentY==null)return{};var i=e.maxScrollHeight,r=e.lastScrollY,s=e.maxScrollY,n=e.maxContentHeight,a=e.lastContentY,h=e.maxContentY;return i=Math.ceil(i),r=Math.ceil(r),s=Math.ceil(s),n=Math.ceil(n),a=Math.ceil(a),h=Math.ceil(h),{$prev_pageview_last_scroll:r,$prev_pageview_last_scroll_percentage:i<=1?1:zf(r/i,0,1),$prev_pageview_max_scroll:s,$prev_pageview_max_scroll_percentage:i<=1?1:zf(s/i,0,1),$prev_pageview_last_content:a,$prev_pageview_last_content_percentage:n<=1?1:zf(a/n,0,1),$prev_pageview_max_content:h,$prev_pageview_max_content_percentage:n<=1?1:zf(h/n,0,1)}}},{key:"startMeasuringScrollPosition",value:function(){oe?.addEventListener("scroll",this._updateScrollData,!0),oe?.addEventListener("scrollend",this._updateScrollData,!0),oe?.addEventListener("resize",this._updateScrollData)}},{key:"stopMeasuringScrollPosition",value:function(){oe?.removeEventListener("scroll",this._updateScrollData),oe?.removeEventListener("scrollend",this._updateScrollData),oe?.removeEventListener("resize",this._updateScrollData)}},{key:"_scrollElement",value:function(){if(!this._instance.config.scroll_root_selector)return oe?.document.documentElement;var e,i=wo(Hr(this._instance.config.scroll_root_selector)?this._instance.config.scroll_root_selector:[this._instance.config.scroll_root_selector]);try{for(i.s();!(e=i.n()).done;){var r=e.value,s=oe?.document.querySelector(r);if(s)return s}}catch(n){i.e(n)}finally{i.f()}}},{key:"_scrollHeight",value:function(){var e=this._scrollElement();return e?Math.max(0,e.scrollHeight-e.clientHeight):0}},{key:"_scrollY",value:function(){if(this._instance.config.scroll_root_selector){var e=this._scrollElement();return e&&e.scrollTop||0}return oe&&(oe.scrollY||oe.pageYOffset||oe.document.documentElement.scrollTop)||0}},{key:"_contentHeight",value:function(){var e=this._scrollElement();return e?.scrollHeight||0}},{key:"_contentY",value:function(){var e=this._scrollElement(),i=e?.clientHeight||0;return this._scrollY()+i}}]),t}();function zf(t,e,i){return Math.max(e,Math.min(t,i))}var Ip,l0,gs,m2={icontains:function(t){return!!oe&&oe.location.href.toLowerCase().indexOf(t.toLowerCase())>-1},regex:function(t){return!!oe&&ME(oe.location.href,t)},exact:function(t){return oe?.location.href===t}},g2=function(){function t(e){Mr(this,t),this.instance=e}return Dr(t,[{key:"getSurveys",value:function(e){var i=this,r=arguments.length>1&&arguments[1]!==void 0&&arguments[1],s=this.instance.get_property(jm);if(s&&!r)return e(s);this.instance._send_request("".concat(this.instance.config.api_host,"/api/surveys/?token=").concat(this.instance.config.token),{},{method:"GET"},function(n){var a,h=n.surveys||[];return(a=i.instance.persistence)===null||a===void 0||a.register(Be({},jm,h)),e(h)})}},{key:"getActiveMatchingSurveys",value:function(e){var i=this,r=arguments.length>1&&arguments[1]!==void 0&&arguments[1];this.getSurveys(function(s){var n=s.filter(function(a){return!(!a.start_date||a.end_date)}).filter(function(a){var h,o,c,g;if(!a.conditions)return!0;var l=(h=a.conditions)===null||h===void 0||!h.url||m2[(o=(c=a.conditions)===null||c===void 0?void 0:c.urlMatchType)!==null&&o!==void 0?o:"icontains"](a.conditions.url),p=(g=a.conditions)===null||g===void 0||!g.selector||Ue?.querySelector(a.conditions.selector);return l&&p}).filter(function(a){if(!a.linked_flag_key&&!a.targeting_flag_key)return!0;var h=!a.linked_flag_key||i.instance.featureFlags.isFeatureEnabled(a.linked_flag_key),o=!a.targeting_flag_key||i.instance.featureFlags.isFeatureEnabled(a.targeting_flag_key);return h&&o});return e(n)},r)}}]),t}(),y2=function(){function t(){var e=this;Mr(this,t),Be(this,"limits",{}),Be(this,"checkForLimiting",function(i){var r=i.responseText;if(r&&r.length)try{(JSON.parse(r).quota_limited||[]).forEach(function(s){Te.info("[RateLimiter] ".concat(s||"events"," is quota limited.")),e.limits[s]=new Date().getTime()+6e4})}catch(s){return void Te.warn('[RateLimiter] could not rate limit - continuing. Error: "'.concat(s?.message,'"'),{text:r})}})}return Dr(t,[{key:"isRateLimited",value:function(e){var i=this.limits[e||"events"]||!1;return i!==!1&&new Date().getTime()<i}}]),t}(),v2=function(){return ti({initialPathName:bo?.pathname||"",referringDomain:qr.referringDomain()},qr.campaignParams())},b2=function(){function t(e,i,r){var s=this;Mr(this,t),Be(this,"_onSessionIdCallback",function(n){var a=s._getStoredProps();if(!a||a.sessionId!==n){var h={sessionId:n,props:s._sessionSourceParamGenerator()};s._persistence.register(Be({},Wm,h))}}),this._sessionIdManager=e,this._persistence=i,this._sessionSourceParamGenerator=r||v2,this._sessionIdManager.onSessionId(this._onSessionIdCallback)}return Dr(t,[{key:"_getStoredProps",value:function(){return this._persistence.props[Wm]}},{key:"getSessionProps",value:function(){var e,i=(e=this._getStoredProps())===null||e===void 0?void 0:e.props;return i?{$client_session_initial_referring_host:i.referringDomain,$client_session_initial_pathname:i.initialPathName,$client_session_initial_utm_source:i.utm_source,$client_session_initial_utm_campaign:i.utm_campaign,$client_session_initial_utm_medium:i.utm_medium,$client_session_initial_utm_content:i.utm_content,$client_session_initial_utm_term:i.utm_term}:{}}}]),t}(),_2=["ahrefsbot","ahrefssiteaudit","applebot","baiduspider","bingbot","bingpreview","bot.htm","bot.php","crawler","duckduckbot","facebookexternal","facebookcatalog","gptbot","http://yandex.com/bots","hubspot","ia_archiver","linkedinbot","mj12bot","msnbot","nessus","petalbot","pinterest","prerender","rogerbot","screaming frog","semrushbot","sitebulb","slurp","turnitin","twitterbot","vercelbot","yahoo! slurp","yandexbot","adsbot-google","apis-google","duplexweb-google","feedfetcher-google","google favicon","google web preview","google-read-aloud","googlebot","googleweblight","mediapartners-google","storebot-google"],Db=function(t,e){if(!t)return!1;var i=t.toLowerCase();return _2.concat(e||[]).some(function(r){var s=r.toLowerCase();return i.includes?i.includes(s):i.indexOf(s)!==-1})};(function(t){t[t.INIT_MODULE=0]="INIT_MODULE",t[t.INIT_SNIPPET=1]="INIT_SNIPPET"})(Ip||(Ip={}));var Km=function(){},Nf={},Qs="posthog",s_=!Hf&&Tr?.indexOf("MSIE")===-1&&Tr?.indexOf("Mozilla")===-1,Ib=function(){var t,e,i;return{api_host:"https://app.posthog.com",api_method:"POST",api_transport:"XHR",ui_host:null,token:"",autocapture:!0,rageclick:!0,cross_subdomain_cookie:(e=Ue?.location,i=e?.hostname,!!yn(i)&&i.split(".").slice(-2).join(".")!=="herokuapp.com"),persistence:"localStorage+cookie",persistence_name:"",cookie_name:"",loaded:Km,store_google:!0,custom_campaign_params:[],custom_blocked_useragents:[],save_referrer:!0,capture_pageview:!0,capture_pageleave:!0,debug:!1,verbose:!1,cookie_expiration:365,upgrade:!1,disable_session_recording:!1,disable_persistence:!1,disable_cookie:!1,enable_recording_console_log:void 0,secure_cookie:(oe==null||(t=oe.location)===null||t===void 0?void 0:t.protocol)==="https:",ip:!0,opt_out_capturing_by_default:!1,opt_out_persistence_by_default:!1,opt_out_useragent_filter:!1,opt_out_capturing_persistence_type:"localStorage",opt_out_capturing_cookie_prefix:null,opt_in_site_apps:!1,property_blacklist:[],respect_dnt:!1,sanitize_properties:null,request_headers:{},inapp_protocol:"//",inapp_link_new_window:!1,request_batching:!0,properties_string_max_length:65535,session_recording:{},mask_all_element_attributes:!1,mask_all_text:!1,advanced_disable_decide:!1,advanced_disable_feature_flags:!1,advanced_disable_feature_flags_on_first_load:!1,advanced_disable_toolbar_metrics:!1,on_request_error:function(r){var s="Bad HTTP status: "+r.statusCode+" "+r.responseText;Te.error(s)},get_device_id:function(r){return r},_onCapture:Km,capture_performance:void 0,name:"posthog",callback_fn:"posthog._jsc",bootstrap:{},disable_compression:!1,session_idle_timeout_seconds:1800}},Qm=function(t,e,i,r){var s,n=i!==Qs&&gs?i?gs[i]:void 0:gs,a={initComplete:!1,syncCode:!1},h=function(o){return function(c){a[o]||(a[o]=!0,a.initComplete&&a.syncCode&&r?.(c))}};if(n&&l0===Ip.INIT_MODULE)s=n;else{if(n&&!Hr(n))return void Te.error("You have already initialized "+i);s=new p0}return s._init(t,e,i,h("initComplete")),s.toolbar.maybeLoadToolbar(),s.sessionRecording=new qE(s),s.sessionRecording.startRecordingIfEnabled(),s.config.disable_scroll_properties||s.pageViewManager.startMeasuringScrollPosition(),s.__autocapture=s.config.autocapture,xo._setIsAutocaptureEnabled(s),xo._isAutocaptureEnabled&&(s.__autocapture=s.config.autocapture,xo.enabledForProject(s.config.token,100,100)?xo.isBrowserSupported()?xo.init(s):(s.__autocapture=!1,Te.info("Disabling Automatic Event Collection because this browser is not supported")):(s.__autocapture=!1,Te.info("Not in active bucket: disabling Automatic Event Collection."))),yh.DEBUG=yh.DEBUG||s.config.debug,!Si(n)&&Hr(n)&&(s._execute_array.call(s.people,n.people),s._execute_array(n)),h("syncCode")(s),s},x2=function(){function t(){Mr(this,t),Be(this,"__forceAllowLocalhost",!1)}return Dr(t,[{key:"_forceAllowLocalhost",get:function(){return this.__forceAllowLocalhost},set:function(e){Te.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=e}}]),t}(),p0=function(){function t(){var e=this;Mr(this,t),Be(this,"webPerformance",new x2),this.config=Ib(),this.compression={},this.decideEndpointWasHit=!1,this.SentryIntegration=u2,this.segmentIntegration=function(){return function(i){Promise&&Promise.resolve||Te.warn("This browser does not have Promise support, and can not use the segment integration");var r=function(s,n){s.event.userId||s.event.anonymousId===i.get_distinct_id()||i.reset(),s.event.userId&&s.event.userId!==i.get_distinct_id()&&(i.register({distinct_id:s.event.userId}),i.reloadFeatureFlags());var a=i._calculate_event_properties(n,s.event.properties);return s.event.properties=Object.assign({},a,s.event.properties),s};return{name:"PostHog JS",type:"enrichment",version:"1.0.0",isLoaded:function(){return!0},load:function(){return Promise.resolve()},track:function(s){return r(s,s.event.event)},page:function(s){return r(s,"$pageview")},identify:function(s){return r(s,"$identify")},screen:function(s){return r(s,"$screen")}}}(e)},this.__captureHooks=[],this.__request_queue=[],this.__loaded=!1,this.__loaded_recorder_version=void 0,this.__autocapture=void 0,this._jsc=function(){},this.analyticsDefaultEndpoint="/e/",this.elementsChainAsString=!1,this.featureFlags=new bE(this),this.toolbar=new YE(this),this.pageViewManager=new d2(this),this.surveys=new g2(this),this.rateLimiter=new y2,this.people={set:function(i,r,s){var n=yn(i)?Be({},i,r):i;e.setPersonProperties(n),s?.({})},set_once:function(i,r,s){var n=yn(i)?Be({},i,r):i;e.setPersonProperties(void 0,n),s?.({})}}}return Dr(t,[{key:"init",value:function(e,i,r){if(Si(r))Te.critical("You must name your new library: init(token, config, name)");else{if(r!==Qs){var s=Qm(e,i,r,function(n){gs[r]=n,n._loaded()});return gs[r]=s,s}Te.critical("You must initialize the main posthog object right after you include the PostHog js snippet")}}},{key:"_init",value:function(e){var i,r,s,n=this,a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},h=arguments.length>2?arguments[2]:void 0,o=arguments.length>3?arguments[3]:void 0;this.__loaded=!0,this.config={},this._triggered_notifs=[];var c,g={segmentRegister:!1,syncCode:!1},l=function(E){return function(){g[E]||(g[E]=!0,g.segmentRegister&&g.syncCode&&o?.(n))}};if(a.request_headers=a.request_headers||a.xhr_headers,this.set_config(ms({},Ib(),a,{name:h,token:e,callback_fn:(h===Qs?h:Qs+"."+h)+"._jsc"})),this._jsc=function(){},(oe!=null&&(i=oe.rrweb)!==null&&i!==void 0&&i.record||oe!=null&&oe.rrwebRecord)&&(this.__loaded_recorder_version=oe==null||(c=oe.rrweb)===null||c===void 0?void 0:c.version),this.persistence=new wb(this.config),this._requestQueue=new JE(this._handle_queued_event.bind(this)),this._retryQueue=new c2(this.config.on_request_error,this.rateLimiter),this.__captureHooks=[],this.__request_queue=[],this.sessionManager=new f2(this.config,this.persistence),this.sessionPropsManager=new b2(this.sessionManager,this.persistence),this.sessionPersistence=this.config.persistence==="sessionStorage"?this.persistence:new wb(ti(ti({},this.config),{},{persistence:"sessionStorage"})),this._gdpr_init(),a.segment?(this.config.get_device_id=function(){return a.segment.user().anonymousId()},a.segment.user().id()&&(this.register({distinct_id:a.segment.user().id()}),this.persistence.set_user_state("identified")),a.segment.register(this.segmentIntegration()).then(l("segmentRegister"))):l("segmentRegister")(),((r=a.bootstrap)===null||r===void 0?void 0:r.distinctID)!==void 0){var p,v,u=this.config.get_device_id(mh()),m=(p=a.bootstrap)!==null&&p!==void 0&&p.isIdentifiedID?u:a.bootstrap.distinctID;this.persistence.set_user_state((v=a.bootstrap)!==null&&v!==void 0&&v.isIdentifiedID?"identified":"anonymous"),this.register({distinct_id:a.bootstrap.distinctID,$device_id:m})}if(this._hasBootstrappedFeatureFlags()){var k,y,d=Object.keys(((k=a.bootstrap)===null||k===void 0?void 0:k.featureFlags)||{}).filter(function(E){var I,B;return!((I=a.bootstrap)===null||I===void 0||(B=I.featureFlags)===null||B===void 0||!B[E])}).reduce(function(E,I){var B,G;return E[I]=((B=a.bootstrap)===null||B===void 0||(G=B.featureFlags)===null||G===void 0?void 0:G[I])||!1,E},{}),b=Object.keys(((y=a.bootstrap)===null||y===void 0?void 0:y.featureFlagPayloads)||{}).filter(function(E){return d[E]}).reduce(function(E,I){var B,G,it,lt;return(B=a.bootstrap)!==null&&B!==void 0&&(G=B.featureFlagPayloads)!==null&&G!==void 0&&G[I]&&(E[I]=(it=a.bootstrap)===null||it===void 0||(lt=it.featureFlagPayloads)===null||lt===void 0?void 0:lt[I]),E},{});this.featureFlags.receivedFeatureFlags({featureFlags:d,featureFlagPayloads:b})}if(!this.get_distinct_id()){var S=this.config.get_device_id(mh());this.register_once({distinct_id:S,$device_id:S},""),this.persistence.set_user_state("anonymous")}oe==null||(s=oe.addEventListener)===null||s===void 0||s.call(oe,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this)),l("syncCode")()}},{key:"_afterDecideResponse",value:function(e){var i;if(this.compression={},e.supportedCompression&&!this.config.disable_compression){var r,s={},n=wo(e.supportedCompression);try{for(n.s();!(r=n.n()).done;)s[r.value]=!0}catch(a){n.e(a)}finally{n.f()}this.compression=s}(i=e.analytics)!==null&&i!==void 0&&i.endpoint&&(this.analyticsDefaultEndpoint=e.analytics.endpoint),e.elementsChainAsString&&(this.elementsChainAsString=e.elementsChainAsString)}},{key:"_loaded",value:function(){var e=this.config.advanced_disable_decide;e||this.featureFlags.setReloadingPaused(!0);try{this.config.loaded(this)}catch(i){Te.critical("`loaded` function failed",i)}this._start_queue_if_opted_in(),this.config.capture_pageview&&Ue&&this.capture("$pageview",{title:Ue.title},{send_instantly:!0}),e||(new HE(this).call(),this.featureFlags.resetRequestQueue())}},{key:"_start_queue_if_opted_in",value:function(){var e;this.has_opted_out_capturing()||this.config.request_batching&&((e=this._requestQueue)===null||e===void 0||e.poll())}},{key:"_dom_loaded",value:function(){var e=this;this.has_opted_out_capturing()||ll(this.__request_queue,function(i){e._send_request.apply(e,Zf(i))}),this.__request_queue=[],this._start_queue_if_opted_in()}},{key:"_prepare_callback",value:function(e,i){if(Si(e))return null;if(Hf)return function(a){e(a,i)};var r=this._jsc,s=""+Math.floor(1e8*Math.random()),n=this.config.callback_fn+"["+s+"]";return r[s]=function(a){delete r[s],e(a,i)},n}},{key:"_handle_unload",value:function(){var e,i;this.config.request_batching?(this.config.capture_pageview&&this.config.capture_pageleave&&this.capture("$pageleave"),(e=this._requestQueue)===null||e===void 0||e.unload(),(i=this._retryQueue)===null||i===void 0||i.unload()):this.config.capture_pageview&&this.config.capture_pageleave&&this.capture("$pageleave",null,{transport:"sendBeacon"})}},{key:"_handle_queued_event",value:function(e,i,r){var s=JSON.stringify(i);this.__compress_and_send_json_request(e,s,r||Nf,Km)}},{key:"__compress_and_send_json_request",value:function(e,i,r,s){var n=function(c,g,l){return c===dh.GZipJS?[h2(l2(g),{mtime:0}),ti(ti({},l),{},{blob:!0,urlQueryArgs:{compression:dh.GZipJS}})]:[{data:i0(g)},l]}(this.compression[dh.GZipJS]?dh.GZipJS:dh.Base64,i,r),a=ea(n,2),h=a[0],o=a[1];this._send_request(e,h,o,s)}},{key:"_send_request",value:function(e,i,r,s){if(this.__loaded&&this._retryQueue&&!this.rateLimiter.isRateLimited(r._batchKey))if(s_)this.__request_queue.push([e,i,r,s]);else{var n={method:this.config.api_method,transport:this.config.api_transport,verbose:this.config.verbose};r=ms(n,r||{}),Hf||(r.method="GET");var a=oe&&"sendBeacon"in oe.navigator&&r.transport==="sendBeacon";if(e=h0(e,r.urlQueryArgs||{},{ip:this.config.ip}),a)try{oe?.navigator.sendBeacon(e,ru(i,ti(ti({},r),{},{sendBeacon:!0})))}catch{}else if(Hf||!Ue)try{r_({url:e,data:i,headers:this.config.request_headers,options:r,callback:s,retriesPerformedSoFar:0,retryQueue:this._retryQueue,onError:this.config.on_request_error,onResponse:this.rateLimiter.checkForLimiting})}catch(g){Te.error(g)}else{var h,o=Ue.createElement("script");o.type="text/javascript",o.async=!0,o.defer=!0,o.src=e;var c=Ue.getElementsByTagName("script")[0];(h=c.parentNode)===null||h===void 0||h.insertBefore(o,c)}}}},{key:"_execute_array",value:function(e){var i,r=this,s=[],n=[],a=[];ll(e,function(o){o&&(i=o[0],Hr(i)?a.push(o):Vn(o)?o.call(r):Hr(o)&&i==="alias"?s.push(o):Hr(o)&&i.indexOf("capture")!==-1&&Vn(r[i])?a.push(o):n.push(o))});var h=function(o,c){ll(o,function(g){if(Hr(g[0])){var l=c;tr(g,function(p){l=l[p[0]].apply(l,p.slice(1))})}else this[g[0]].apply(this,g.slice(1))},c)};h(s,this),h(n,this),h(a,this)}},{key:"_hasBootstrappedFeatureFlags",value:function(){var e,i;return((e=this.config.bootstrap)===null||e===void 0?void 0:e.featureFlags)&&Object.keys((i=this.config.bootstrap)===null||i===void 0?void 0:i.featureFlags).length>0||!1}},{key:"push",value:function(e){this._execute_array([e])}},{key:"capture",value:function(e,i){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Nf;if(!this.__loaded||!this.sessionPersistence||!this._requestQueue)return Te.uninitializedWarning("posthog.capture");if(!Zm(this)){var s=(r=r||Nf).transport;if(s&&(r.transport=s),!Si(e)&&yn(e)){if(!Tr||this.config.opt_out_useragent_filter||!Db(Tr,this.config.custom_blocked_useragents)){this.sessionPersistence.update_search_keyword(),this.config.store_google&&this.sessionPersistence.update_campaign_params(),this.config.save_referrer&&this.sessionPersistence.update_referrer_info();var n={uuid:mh(),event:e,properties:this._calculate_event_properties(e,i||{})};e==="$identify"&&(n.$set=r.$set,n.$set_once=r.$set_once),(n=uE(n,r._noTruncate?null:this.config.properties_string_max_length)).timestamp=r.timestamp||new Date;var a=ti(ti({},n.properties.$set),n.$set);(function(g){if(So(g)){for(var l in g)if(Bb.call(g,l))return!1;return!0}return!1})(a)||this.setPersonPropertiesForFlags(a),Te.info("send",n);var h=JSON.stringify(n),o=this.config.api_host+(r.endpoint||this.analyticsDefaultEndpoint),c=r!==Nf;return!this.config.request_batching||c&&!r._batchKey||r.send_instantly?this.__compress_and_send_json_request(o,h,r):this._requestQueue.enqueue(o,n,r),this._invokeCaptureHooks(e,n),n}}else Te.error("No event name provided to posthog.capture")}}},{key:"_addCaptureHook",value:function(e){this.__captureHooks.push(e)}},{key:"_invokeCaptureHooks",value:function(e,i){this.config._onCapture(e,i),tr(this.__captureHooks,function(r){return r(e)})}},{key:"_calculate_event_properties",value:function(e,i){if(!this.persistence||!this.sessionPersistence)return i;var r=this.persistence.remove_event_timer(e),s=ti({},i);if(s.token=this.config.token,e==="$snapshot"){var n=ti(ti({},this.persistence.properties()),this.sessionPersistence.properties());return s.distinct_id=n.distinct_id,s}var a=qr.properties();if(this.sessionManager){var h=this.sessionManager.checkAndGetSessionAndWindowId(),o=h.sessionId,c=h.windowId;s.$session_id=o,s.$window_id=c}if(this.sessionPropsManager&&this.config.__preview_send_client_session_params&&(e==="$pageview"||e==="$pageleave"||e==="$autocapture")){var g=this.sessionPropsManager.getSessionProps();s=ms(s,g)}if(!this.config.disable_scroll_properties){var l={};e==="$pageview"?l=this.pageViewManager.doPageView():e==="$pageleave"&&(l=this.pageViewManager.doPageLeave()),s=ms(s,l)}if(e==="$pageview"&&Ue&&(s.title=Ue.title),e==="$performance_event"){var p=this.persistence.properties();return s.distinct_id=p.distinct_id,s.$current_url=a.$current_url,s}if(!Si(r)){var v=new Date().getTime()-r;s.$duration=parseFloat((v/1e3).toFixed(3))}Tr&&this.config.opt_out_useragent_filter&&(s.$browser_type=Db(Tr,this.config.custom_blocked_useragents)?"bot":"browser"),s=ms({},qr.properties(),this.persistence.properties(),this.sessionPersistence.properties(),s);var u=this.config.property_blacklist;Hr(u)?tr(u,function(k){delete s[k]}):Te.error("Invalid value for property_blacklist config: "+u);var m=this.config.sanitize_properties;return m&&(s=m(s,e)),s}},{key:"register",value:function(e,i){var r;(r=this.persistence)===null||r===void 0||r.register(e,i)}},{key:"register_once",value:function(e,i,r){var s;(s=this.persistence)===null||s===void 0||s.register_once(e,i,r)}},{key:"register_for_session",value:function(e){var i;(i=this.sessionPersistence)===null||i===void 0||i.register(e)}},{key:"unregister",value:function(e){var i;(i=this.persistence)===null||i===void 0||i.unregister(e)}},{key:"unregister_for_session",value:function(e){var i;(i=this.sessionPersistence)===null||i===void 0||i.unregister(e)}},{key:"_register_single",value:function(e,i){this.register(Be({},e,i))}},{key:"getFeatureFlag",value:function(e,i){return this.featureFlags.getFeatureFlag(e,i)}},{key:"getFeatureFlagPayload",value:function(e){var i=this.featureFlags.getFeatureFlagPayload(e);try{return JSON.parse(i)}catch{return i}}},{key:"isFeatureEnabled",value:function(e,i){return this.featureFlags.isFeatureEnabled(e,i)}},{key:"reloadFeatureFlags",value:function(){this.featureFlags.reloadFeatureFlags()}},{key:"updateEarlyAccessFeatureEnrollment",value:function(e,i){this.featureFlags.updateEarlyAccessFeatureEnrollment(e,i)}},{key:"getEarlyAccessFeatures",value:function(e){var i=arguments.length>1&&arguments[1]!==void 0&&arguments[1];return this.featureFlags.getEarlyAccessFeatures(e,i)}},{key:"onFeatureFlags",value:function(e){return this.featureFlags.onFeatureFlags(e)}},{key:"onSessionId",value:function(e){var i,r;return(i=(r=this.sessionManager)===null||r===void 0?void 0:r.onSessionId(e))!==null&&i!==void 0?i:function(){}}},{key:"getSurveys",value:function(e){var i=arguments.length>1&&arguments[1]!==void 0&&arguments[1];this.surveys.getSurveys(e,i)}},{key:"getActiveMatchingSurveys",value:function(e){var i=arguments.length>1&&arguments[1]!==void 0&&arguments[1];this.surveys.getActiveMatchingSurveys(e,i)}},{key:"identify",value:function(e,i,r){if(!this.__loaded||!this.persistence)return Te.uninitializedWarning("posthog.identify");if(e)if(["distinct_id","distinctid"].includes(e.toLowerCase()))Te.critical('The string "'.concat(e,'" was set in posthog.identify which indicates an error. This ID should be unique to the user and not a hardcoded string.'));else{var s=this.get_distinct_id();if(this.register({$user_id:e}),!this.get_property("$device_id")){var n=s;this.register_once({$had_persisted_distinct_id:!0,$device_id:n},"")}e!==s&&e!==this.get_property(jf)&&(this.unregister(jf),this.register({distinct_id:e}));var a=this.persistence.get_user_state()==="anonymous";e!==s&&a?(this.persistence.set_user_state("identified"),this.setPersonPropertiesForFlags(i||{},!1),this.capture("$identify",{distinct_id:e,$anon_distinct_id:s},{$set:i||{},$set_once:r||{}}),this.featureFlags.setAnonymousDistinctId(s)):(i||r)&&this.setPersonProperties(i,r),e!==s&&(this.reloadFeatureFlags(),this.unregister(Qf))}else Te.error("Unique user id has not been set in posthog.identify")}},{key:"setPersonProperties",value:function(e,i){(e||i)&&(this.setPersonPropertiesForFlags(e||{}),this.capture("$set",{$set:e||{},$set_once:i||{}}))}},{key:"group",value:function(e,i,r){if(e&&i){var s=this.getGroups();s[e]!==i&&this.resetGroupPropertiesForFlags(e),this.register({$groups:ti(ti({},s),{},Be({},e,i))}),r&&(this.capture("$groupidentify",{$group_type:e,$group_key:i,$group_set:r}),this.setGroupPropertiesForFlags(Be({},e,r))),s[e]===i||r||this.reloadFeatureFlags()}else Te.error("posthog.group requires a group type and group key")}},{key:"resetGroups",value:function(){this.register({$groups:{}}),this.resetGroupPropertiesForFlags(),this.reloadFeatureFlags()}},{key:"setPersonPropertiesForFlags",value:function(e){var i=!(arguments.length>1&&arguments[1]!==void 0)||arguments[1];this.featureFlags.setPersonPropertiesForFlags(e,i)}},{key:"resetPersonPropertiesForFlags",value:function(){this.featureFlags.resetPersonPropertiesForFlags()}},{key:"setGroupPropertiesForFlags",value:function(e){var i=!(arguments.length>1&&arguments[1]!==void 0)||arguments[1];this.featureFlags.setGroupPropertiesForFlags(e,i)}},{key:"resetGroupPropertiesForFlags",value:function(e){this.featureFlags.resetGroupPropertiesForFlags(e)}},{key:"reset",value:function(e){var i,r,s,n;if(!this.__loaded)return Te.uninitializedWarning("posthog.reset");var a=this.get_property("$device_id");(i=this.persistence)===null||i===void 0||i.clear(),(r=this.sessionPersistence)===null||r===void 0||r.clear(),(s=this.persistence)===null||s===void 0||s.set_user_state("anonymous"),(n=this.sessionManager)===null||n===void 0||n.resetSessionId();var h=this.config.get_device_id(mh());this.register_once({distinct_id:h,$device_id:e?h:a},"")}},{key:"get_distinct_id",value:function(){return this.get_property("distinct_id")}},{key:"getGroups",value:function(){return this.get_property("$groups")||{}}},{key:"get_session_id",value:function(){var e,i;return(e=(i=this.sessionManager)===null||i===void 0?void 0:i.checkAndGetSessionAndWindowId(!0).sessionId)!==null&&e!==void 0?e:""}},{key:"get_session_replay_url",value:function(e){if(!this.sessionManager)return"";var i=this.config.ui_host||this.config.api_host,r=this.sessionManager.checkAndGetSessionAndWindowId(!0),s=r.sessionId,n=r.sessionStartTimestamp,a=i+"/replay/"+s;if(e!=null&&e.withTimestamp&&n){var h,o=(h=e.timestampLookBack)!==null&&h!==void 0?h:10;if(!n)return a;var c=Math.max(Math.floor((new Date().getTime()-n)/1e3)-o,0);a+="?t=".concat(c)}return a}},{key:"alias",value:function(e,i){return e===this.get_property(Hb)?(Te.critical("Attempting to create alias for existing People user - aborting."),-2):(Si(i)&&(i=this.get_distinct_id()),e!==i?(this._register_single(jf,e),this.capture("$create_alias",{alias:e,distinct_id:i})):(Te.warn("alias matches current distinct_id - skipping api call."),this.identify(e),-1))}},{key:"set_config",value:function(e){var i,r,s=ti({},this.config);if(So(e)&&(ms(this.config,e),this.config.persistence_name||(this.config.persistence_name=this.config.cookie_name),this.config.disable_persistence||(this.config.disable_persistence=this.config.disable_cookie),this.config.api_host=this.config.api_host.replace(/\/$/,""),this.config.api_host==="https://us.posthog.com"&&(this.config.api_host="https://app.posthog.com"),(i=this.persistence)===null||i===void 0||i.update_config(this.config),(r=this.sessionPersistence)===null||r===void 0||r.update_config(this.config),Lr.is_supported()&&Lr.get("ph_debug")==="true"&&(this.config.debug=!0),this.config.debug&&(yh.DEBUG=!0),this.sessionRecording&&!Si(e.disable_session_recording))){var n=s.disable_session_recording!==e.disable_session_recording,a=!Zm(this)&&!e.disable_session_recording&&!this.sessionRecording.started;(n||a)&&(e.disable_session_recording?this.sessionRecording.stopRecording():this.sessionRecording.startRecordingIfEnabled())}}},{key:"startSessionRecording",value:function(){this.set_config({disable_session_recording:!1})}},{key:"stopSessionRecording",value:function(){this.set_config({disable_session_recording:!0})}},{key:"sessionRecordingStarted",value:function(){var e;return!((e=this.sessionRecording)===null||e===void 0||!e.started)}},{key:"loadToolbar",value:function(e){return this.toolbar.loadToolbar(e)}},{key:"get_property",value:function(e){var i;return(i=this.persistence)===null||i===void 0?void 0:i.props[e]}},{key:"getSessionProperty",value:function(e){var i;return(i=this.sessionPersistence)===null||i===void 0?void 0:i.props[e]}},{key:"toString",value:function(){var e,i=(e=this.config.name)!==null&&e!==void 0?e:Qs;return i!==Qs&&(i=Qs+"."+i),i}},{key:"_gdpr_init",value:function(){this.config.opt_out_capturing_persistence_type==="localStorage"&&Lr.is_supported()&&(!this.has_opted_in_capturing()&&this.has_opted_in_capturing({persistence_type:"cookie"})&&this.opt_in_capturing({enable_persistence:!1}),!this.has_opted_out_capturing()&&this.has_opted_out_capturing({persistence_type:"cookie"})&&this.opt_out_capturing({clear_persistence:!1}),this.clear_opt_in_out_capturing({persistence_type:"cookie",enable_persistence:!1})),this.has_opted_out_capturing()?this._gdpr_update_persistence({clear_persistence:!0}):this.has_opted_in_capturing()||!this.config.opt_out_capturing_by_default&&!_a.get("ph_optout")||(_a.remove("ph_optout"),this.opt_out_capturing({clear_persistence:this.config.opt_out_persistence_by_default}))}},{key:"_gdpr_update_persistence",value:function(e){var i,r,s,n,a;if(e&&e.clear_persistence)s=!0;else{if(!e||!e.enable_persistence)return;s=!1}this.config.disable_persistence||((i=this.persistence)===null||i===void 0?void 0:i.disabled)===s||(n=this.persistence)===null||n===void 0||n.set_disabled(s),this.config.disable_persistence||((r=this.sessionPersistence)===null||r===void 0?void 0:r.disabled)===s||(a=this.sessionPersistence)===null||a===void 0||a.set_disabled(s)}},{key:"_gdpr_call_func",value:function(e,i){return i=ms({capture:this.capture.bind(this),persistence_type:this.config.opt_out_capturing_persistence_type,cookie_prefix:this.config.opt_out_capturing_cookie_prefix,cookie_expiration:this.config.cookie_expiration,cross_subdomain_cookie:this.config.cross_subdomain_cookie,secure_cookie:this.config.secure_cookie},i||{}),Lr.is_supported()||i.persistence_type!=="localStorage"||(i.persistence_type="cookie"),e(this.config.token,{capture:i.capture,captureEventName:i.capture_event_name,captureProperties:i.capture_properties,persistenceType:i.persistence_type,persistencePrefix:i.cookie_prefix,cookieExpiration:i.cookie_expiration,crossSubdomainCookie:i.cross_subdomain_cookie,secureCookie:i.secure_cookie})}},{key:"opt_in_capturing",value:function(e){e=ms({enable_persistence:!0},e||{}),this._gdpr_call_func(zE,e),this._gdpr_update_persistence(e)}},{key:"opt_out_capturing",value:function(e){var i=ms({clear_persistence:!0},e||{});this._gdpr_call_func(NE,i),this._gdpr_update_persistence(i)}},{key:"has_opted_in_capturing",value:function(e){return this._gdpr_call_func(GE,e)}},{key:"has_opted_out_capturing",value:function(e){return this._gdpr_call_func(Zb,e)}},{key:"clear_opt_in_out_capturing",value:function(e){var i=ms({enable_persistence:!0},e??{});this._gdpr_call_func($E,i),this._gdpr_update_persistence(i)}},{key:"debug",value:function(e){e===!1?(oe?.console.log("You've disabled debug mode."),localStorage&&localStorage.removeItem("ph_debug"),this.set_config({debug:!1})):(oe?.console.log("You're now in debug mode. All calls to PostHog will be logged in your console.\nYou can disable this with `posthog.debug(false)`."),localStorage&&localStorage.setItem("ph_debug","true"),this.set_config({debug:!0}))}}]),t}();(function(t,e){for(var i=0;i<e.length;i++)t.prototype[e[i]]=Gb(t.prototype[e[i]])})(p0,["identify"]);var Fb,Lb,vo={},S2=function(){gs.init=function(t,e,i){if(i)return gs[i]||(gs[i]=vo[i]=Qm(t||"",e||{},i,function(s){gs[i]=vo[i]=s,s._loaded()})),gs[i];var r=gs;return vo[Qs]?r=vo[Qs]:t&&(r=Qm(t,e||{},Qs,function(s){vo[Qs]=s,s._loaded()}),vo[Qs]=r),gs=r,l0===Ip.INIT_SNIPPET&&(Ms[Qs]=gs),tr(vo,function(s,n){n!==Qs&&(gs[n]=s)}),r}};(function(t){t.Popover="popover",t.API="api",t.Widget="widget"})(Fb||(Fb={})),function(t){t.Open="open",t.MultipleChoice="multiple_choice",t.SingleChoice="single_choice",t.Rating="rating",t.Link="link"}(Lb||(Lb={}));var n_=(l0=Ip.INIT_MODULE,gs=new p0,S2(),gs.init(),function(){function t(){t.done||(t.done=!0,s_=!1,tr(vo,function(e){e._dom_loaded()}))}Ue!=null&&Ue.addEventListener&&(Ue.readyState==="complete"?t():Ue.addEventListener("DOMContentLoaded",t,!1)),oe&&Tp(oe,"load",t,!0)}(),gs);var a_=n_.init("phc_OTZ3wJ6VemgVupCRKS5Sbqb9Ks0JYe0hMYZPtLwl0nu",{api_host:"https://pheu.molin.ai",ui_host:"https://eu.posthog.com",secure_cookie:document.location.protocol==="https:",persistence:"cookie",autocapture:!1,rageclick:!1,capture_pageview:!1,capture_pageleave:!1,disable_session_recording:!0},"MolinShopAI");function bn(t,e){if(!a_)throw new Error("Failed to initialize PostHog");a_.capture(t,e)}var bh,Lp,au,o_,Wr,yr,ia,ou,h_,hu,l_,lu,p_,pu,c_,cu,f_,fu,u_,uu,d_,du,m_,mu,g_,cl,nu,su=class extends br(zi){constructor(){super();Le(this,bh);Le(this,au);Le(this,ou);Le(this,hu);Le(this,lu);Le(this,pu);Le(this,cu);Le(this,fu);Le(this,uu);Le(this,du);Le(this,mu);Le(this,cl);Le(this,Wr,new If(this,{url:(i,{resume:r}={})=>{let s=new URL(this.config.wsApiUrl);return s.searchParams.set("widgetId",this.widgetId),s.searchParams.set("resume",r?"1":""),s.searchParams.set("conversationId",i),s.searchParams.set("pageUrl",window.location.href),s},onReconnect:()=>{},onError:i=>{console.error("ws error",i)},onClose:()=>{},onNewMessage:i=>{i.role==="assistant"&&bn("ShopAssistant: user received bot message (streaming started)",{widgetId:this.widgetId,message:i})},onUpdateMessage:i=>{},onMessageDone:i=>{let r={...fe(this,Wr)?.messages.find(s=>s.id===i.message?.id)};Object.assign(r,i.message),r.role==="assistant"&&bn("ShopAssistant: user received bot message (streaming ended)",{widgetId:this.widgetId,text:r.content??"",message:r,usage_TOKENS_COMPLETION:i.message.usage.TOKENS_COMPLETION})},onMessageError:i=>{console.error("ws message error",i),i.message&&fe(this,yr)&&(alert(i.message),bn("ShopAssistant: error",{widgetId:this.widgetId,error:"websocket ERROR message type: "+i.message}))},persistConversationState:(i,r)=>{let s={conversationId:i,messages:r};localStorage.setItem(fe(this,bh,Lp),JSON.stringify(s))},restoreConversationState:()=>{try{let i=JSON.parse(localStorage.getItem(fe(this,bh,Lp))||"{}"),r=S0.parse(i);return{conversationId:r.conversationId||Tm(),messages:r.messages||[]}}catch(i){console.error(i)}},onReset:()=>{localStorage.removeItem(fe(this,bh,Lp))},onConnect:i=>{localStorage.setItem(fe(this,bh,Lp),JSON.stringify({conversationId:i}))}}));Le(this,yr,!1);Le(this,ia,void 0);this.widgetId="",this.config}render(){console.assert(this.widgetId,"widget id is required"),console.assert(this.config,"config is required");let i=Object.entries(this.config.bubble.position).filter(([o,c])=>c).map(([o,c])=>`${o}-[${c}]`).reduce((o,c)=>(o[c]=!0,o),{}),r=Object.entries(this.config.bubble.position).filter(([o,c])=>c).map(([o,c])=>`${o}-[${c}]`).reduce((o,c)=>(o[c]=!0,o),{}),s={bottom:"72px"},n=Object.entries(this.config.bubble.position).filter(([o,c])=>c).map(([o,c])=>`sm:${o}-[calc(${[s[o],c].filter(g=>!!g).join("+")})]`).reduce((o,c)=>(o[c]=!0,o),{}),a=n;if(this.config.hidden&&!fe(this,au,o_))return Ki;let h=Jv(fe(this,Wr).messages,o=>new Date(new Date(o.timestamp).setSeconds(0,0)).getTime().toString());return di`
1035
+ `)).length,s=0;s<r;s++){var a=t.charCodeAt(s),h=null;a<128?i++:h=a>127&&a<2048?String.fromCharCode(a>>6|192,63&a|128):String.fromCharCode(a>>12|224,a>>6&63|128,63&a|128),Ts(h)||(i>e&&(n+=t.substring(e,i)),n+=h,e=i=s+1)}return i>e&&(n+=t.substring(e,t.length)),n},Tp=function(){function t(e){return e&&(e.preventDefault=t.preventDefault,e.stopPropagation=t.stopPropagation),e}return t.preventDefault=function(){this.returnValue=!1},t.stopPropagation=function(){this.cancelBubble=!0},function(e,i,r,s,n){if(e)if(e.addEventListener&&!s)e.addEventListener(i,r,!!n);else{var a="on"+i,h=e[a];e[a]=function(o,c,g){return function(l){if(l=l||t(oe?.event)){var p,v=!0;Vn(g)&&(p=g(l));var u=c.call(o,l);return p!==!1&&u!==!1||(v=!1),v}}}(e,r,h)}else Te.error("No valid element provided to register_event")}}();function Mp(t,e){var i=function(){if(!Ue)return e("document not found");var r=Ue.createElement("script");r.type="text/javascript",r.src=t,r.onload=function(a){return e(void 0,a)},r.onerror=function(a){return e(a)};var s,n=Ue.querySelectorAll("body > script");n.length>0?(s=n[0].parentNode)===null||s===void 0||s.insertBefore(r,n[0]):Ue.body.appendChild(r)};Ue!=null&&Ue.body?i():Ue?.addEventListener("DOMContentLoaded",i)}function r0(t){return t?Yf(t).split(/\s+/):[]}function Jf(t){var e="";switch(Rm(t.className)){case"string":e=t.className;break;case"object":e=("baseVal"in t.className?t.className.baseVal:null)||t.getAttribute("class")||"";break;default:e=""}return r0(e)}function Xf(t){var e="";return $f(t)&&!jb(t)&&t.childNodes&&t.childNodes.length&&tr(t.childNodes,function(i){$b(i)&&i.textContent&&(e+=Yf(i.textContent).split(/(\s+)/).filter(al).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255))}),Yf(e)}function pb(t){return!!t&&t.nodeType===1}function gh(t,e){return!!t&&!!t.tagName&&t.tagName.toLowerCase()===e.toLowerCase()}function $b(t){return!!t&&t.nodeType===3}function cb(t){return!!t&&t.nodeType===11}var Mm=["a","button","form","input","select","textarea","label"];function $f(t){for(var e=t;e.parentNode&&!gh(e,"body");e=e.parentNode){var i=Jf(e);if($i(i,"ph-sensitive")||$i(i,"ph-no-capture"))return!1}if($i(Jf(t),"ph-include"))return!0;var r=t.type||"";if(yn(r))switch(r.toLowerCase()){case"hidden":case"password":return!1}var s=t.name||t.id||"";return!(yn(s)&&/^cc|cardnum|ccnum|creditcard|csc|cvc|cvv|exp|pass|pwd|routing|seccode|securitycode|securitynum|socialsec|socsec|ssn/i.test(s.replace(/[^a-zA-Z0-9]/g,"")))}function jb(t){return!!(gh(t,"input")&&!["button","checkbox","submit","reset"].includes(t.type)||gh(t,"select")||gh(t,"textarea")||t.getAttribute("contenteditable")==="true")}function al(t){return!(Ts(t)||Si(t)||yn(t)&&(t=Yf(t),/^(?:(4[0-9]{12}(?:[0-9]{3})?)|(5[1-5][0-9]{14})|(6(?:011|5[0-9]{2})[0-9]{12})|(3[47][0-9]{13})|(3(?:0[0-5]|[68][0-9])[0-9]{11})|((?:2131|1800|35[0-9]{3})[0-9]{11}))$/.test((t||"").replace(/[- ]/g,""))||/(^\d{3}-?\d{2}-?\d{4}$)/.test(t)))}function fb(t){var e=Xf(t);return al(e="".concat(e," ").concat(qb(t)).trim())?e:""}function qb(t){var e="";return t&&t.childNodes&&t.childNodes.length&&tr(t.childNodes,function(i){var r;if(i&&((r=i.tagName)===null||r===void 0?void 0:r.toLowerCase())==="span")try{var s=Xf(i);e="".concat(e," ").concat(s).trim(),i.childNodes&&i.childNodes.length&&(e="".concat(e," ").concat(qb(i)).trim())}catch(n){Te.error(n)}}),e}function mE(t){return function(e){var i=e.map(function(r){var s,n,a="";if(r.tag_name&&(a+=r.tag_name),r.attr_class){r.attr_class.sort();var h,o=wo(r.attr_class);try{for(o.s();!(h=o.n()).done;){var c=h.value;a+=".".concat(c.replace(/"/g,""))}}catch(p){o.e(p)}finally{o.f()}}var g=ti(ti(ti(ti({},r.text?{text:r.text}:{}),{},{"nth-child":(s=r.nth_child)!==null&&s!==void 0?s:0,"nth-of-type":(n=r.nth_of_type)!==null&&n!==void 0?n:0},r.href?{href:r.href}:{}),r.attr_id?{attr_id:r.attr_id}:{}),r.attributes),l={};return Gf(g).sort(function(p,v){var u=ea(p,1)[0],m=ea(v,1)[0];return u.localeCompare(m)}).forEach(function(p){var v=ea(p,2),u=v[0],m=v[1];return l[ub(u.toString())]=ub(m.toString())}),a+=":",a+=Gf(g).map(function(p){var v=ea(p,2),u=v[0],m=v[1];return"".concat(u,'="').concat(m,'"')}).join("")});return i.join(";")}(function(e){return e.map(function(i){var r,s,n={text:(r=i.$el_text)===null||r===void 0?void 0:r.slice(0,400),tag_name:i.tag_name,href:(s=i.attr__href)===null||s===void 0?void 0:s.slice(0,2048),attr_class:gE(i),attr_id:i.attr__id,nth_child:i.nth_child,nth_of_type:i.nth_of_type,attributes:{}};return Gf(i).filter(function(a){return ea(a,1)[0].indexOf("attr__")===0}).forEach(function(a){var h=ea(a,2),o=h[0],c=h[1];return n.attributes[o]=c}),n})}(t))}function ub(t){return t.replace(/"|\\"/g,'\\"')}function gE(t){var e=t.attr__class;return e?Hr(e)?e:r0(e):void 0}var yE=function(){function t(e){Mr(this,t),this.clicks=[],this.enabled=e}return Dr(t,[{key:"isRageClick",value:function(e,i,r){if(!this.enabled)return!1;var s=this.clicks[this.clicks.length-1];if(s&&Math.abs(e-s.x)+Math.abs(i-s.y)<30&&r-s.timestamp<1e3){if(this.clicks.push({x:e,y:i,timestamp:r}),this.clicks.length===3)return!0}else this.clicks=[{x:e,y:i,timestamp:r}];return!1}}]),t}(),Hb="$people_distinct_id",jf="__alias",Ap="__timers",db="$autocapture_disabled_server_side",Gm="$session_recording_enabled_server_side",mb="$console_log_recording_enabled_server_side",gb="$session_recording_recorder_version_server_side",yb="$session_recording_network_payload_capture",Kf="$sesid",qf="$session_is_sampled",ol="$enabled_feature_flags",$m="$early_access_features",hl="$stored_person_properties",_o="$stored_group_properties",jm="$surveys",Qf="$flag_call_reported",qm="$user_state",Hm="$posthog_quota_limited",Wm="$client_session_props",vE=[Hb,jf,"__cmpns",Ap,Gm,Kf,ol,qm,Hm,$m,_o,hl,jm,Qf,Wm];function Dm(t,e){return e.length>t?e.slice(0,t)+"...":e}var xo={_initializedTokens:[],_isDisabledServerSide:null,_isAutocaptureEnabled:!1,_setIsAutocaptureEnabled:function(t){var e,i=Ts(this._isDisabledServerSide)?!((e=t.persistence)===null||e===void 0||!e.props[db]):this._isDisabledServerSide,r=!!t.config.autocapture;this._isAutocaptureEnabled=r&&!i},_previousElementSibling:function(t){if(t.previousElementSibling)return t.previousElementSibling;var e=t;do e=e.previousSibling;while(e&&!pb(e));return e},_getAugmentPropertiesFromElement:function(t){if(!$f(t))return{};var e={};return tr(t.attributes,function(i){if(i.name.indexOf("data-ph-capture-attribute")===0){var r=i.name.replace("data-ph-capture-attribute-",""),s=i.value;r&&s&&al(s)&&(e[r]=s)}}),e},_getPropertiesFromElement:function(t,e,i){var r,s=t.tagName.toLowerCase(),n={tag_name:s};Mm.indexOf(s)>-1&&!i&&(s.toLowerCase()==="a"||s.toLowerCase()==="button"?n.$el_text=Dm(1024,fb(t)):n.$el_text=Dm(1024,Xf(t)));var a=Jf(t);a.length>0&&(n.classes=a.filter(function(l){return l!==""}));var h=(r=this.config)===null||r===void 0?void 0:r.element_attribute_ignorelist;tr(t.attributes,function(l){var p;if((!jb(t)||["name","id","class"].indexOf(l.name)!==-1)&&(h==null||!h.includes(l.name))&&!e&&al(l.value)&&(p=l.name,!yn(p)||p.substring(0,10)!=="_ngcontent"&&p.substring(0,7)!=="_nghost")){var v=l.value;l.name==="class"&&(v=r0(v).join(" ")),n["attr__"+l.name]=Dm(1024,v)}});for(var o=1,c=1,g=t;g=this._previousElementSibling(g);)o++,g.tagName===t.tagName&&c++;return n.nth_child=o,n.nth_of_type=c,n},_getDefaultProperties:function(t){return{$event_type:t,$ce_version:1}},_extractCustomPropertyValue:function(t){var e=[];return tr(Ue?.querySelectorAll(t.css_selector),function(i){var r;["input","select"].indexOf(i.tagName.toLowerCase())>-1?r=i.value:i.textContent&&(r=i.textContent),al(r)&&e.push(r)}),e.join(", ")},_getCustomProperties:function(t){var e=this,i={};return tr(this._customProperties,function(r){tr(r.event_selectors,function(s){tr(Ue?.querySelectorAll(s),function(n){$i(t,n)&&$f(n)&&(i[r.name]=e._extractCustomPropertyValue(r))})})}),i},_getEventTarget:function(t){return Si(t.target)?t.srcElement||null:(e=t.target)!==null&&e!==void 0&&e.shadowRoot?t.composedPath()[0]||null:t.target||null;var e},_captureEvent:function(t,e){var i,r=this,s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"$autocapture",n=this._getEventTarget(t);if($b(n)&&(n=n.parentNode||null),s==="$autocapture"&&t.type==="click"&&t instanceof MouseEvent&&(i=this.rageclicks)!==null&&i!==void 0&&i.isRageClick(t.clientX,t.clientY,new Date().getTime())&&this._captureEvent(t,e,"$rageclick"),n&&function(m,k){var y=arguments.length>2&&arguments[2]!==void 0?arguments[2]:void 0;if(!oe||!m||gh(m,"html")||!pb(m))return!1;if(y!=null&&y.url_allowlist){var d=oe.location.href,b=y.url_allowlist;if(b&&!b.some(function(K){return d.match(K)}))return!1}if(y!=null&&y.dom_event_allowlist){var S=y.dom_event_allowlist;if(S&&!S.some(function(K){return k.type===K}))return!1}if(y!=null&&y.element_allowlist){var E=y.element_allowlist;if(E&&!E.some(function(K){return m.tagName.toLowerCase()===K}))return!1}if(y!=null&&y.css_selector_allowlist){var I=y.css_selector_allowlist;if(I&&!I.some(function(K){return m.matches(K)}))return!1}for(var B=!1,G=[m],it=!0,lt=m;lt.parentNode&&!gh(lt,"body");)if(cb(lt.parentNode))G.push(lt.parentNode.host),lt=lt.parentNode.host;else{if(!(it=lt.parentNode||!1))break;if(Mm.indexOf(it.tagName.toLowerCase())>-1)B=!0;else{var ft=oe.getComputedStyle(it);ft&&ft.getPropertyValue("cursor")==="pointer"&&(B=!0)}G.push(it),lt=it}var ct=oe.getComputedStyle(m);if(ct&&ct.getPropertyValue("cursor")==="pointer"&&k.type==="click")return!0;var St=m.tagName.toLowerCase();switch(St){case"html":return!1;case"form":return k.type==="submit";case"input":case"select":case"textarea":return k.type==="change"||k.type==="click";default:return B?k.type==="click":k.type==="click"&&(Mm.indexOf(St)>-1||m.getAttribute("contenteditable")==="true")}}(n,t,this.config)){for(var a,h,o=[n],c=n;c.parentNode&&!gh(c,"body");)cb(c.parentNode)?(o.push(c.parentNode.host),c=c.parentNode.host):(o.push(c.parentNode),c=c.parentNode);var g,l=[],p={},v=!1;if(tr(o,function(m){var k=$f(m);m.tagName.toLowerCase()==="a"&&(g=m.getAttribute("href"),g=k&&al(g)&&g),$i(Jf(m),"ph-no-capture")&&(v=!0),l.push(r._getPropertiesFromElement(m,e.config.mask_all_element_attributes,e.config.mask_all_text));var y=r._getAugmentPropertiesFromElement(m);ms(p,y)}),e.config.mask_all_text||(n.tagName.toLowerCase()==="a"||n.tagName.toLowerCase()==="button"?l[0].$el_text=fb(n):l[0].$el_text=Xf(n)),g&&(l[0].attr__href=g),v)return!1;var u=ms(this._getDefaultProperties(t.type),e.elementsChainAsString?{$elements_chain:mE(l)}:{$elements:l},(a=l[0])!==null&&a!==void 0&&a.$el_text?{$el_text:(h=l[0])===null||h===void 0?void 0:h.$el_text}:{},this._getCustomProperties(o),p);return e.capture(s,u),!0}},_navigate:function(t){oe&&(oe.location.href=t)},_addDomEventHandlers:function(t){var e=this;if(oe&&Ue){var i=function(r){r=r||oe?.event,e._captureEvent(r,t)};Tp(Ue,"submit",i,!1,!0),Tp(Ue,"change",i,!1,!0),Tp(Ue,"click",i,!1,!0)}},_customProperties:[],rageclicks:null,config:void 0,init:function(t){var e;Bm(t.__autocapture)||(this.config=t.__autocapture),(e=this.config)!==null&&e!==void 0&&e.url_allowlist&&(this.config.url_allowlist=this.config.url_allowlist.map(function(i){return new RegExp(i)})),this.rageclicks=new yE(t.config.rageclick)},afterDecideResponse:function(t,e){var i=e.config.token;this._initializedTokens.indexOf(i)>-1?Te.info('autocapture already initialized for token "'+i+'"'):(e.persistence&&e.persistence.register(Be({},db,!!t.autocapture_opt_out)),this._isDisabledServerSide=!!t.autocapture_opt_out,this._setIsAutocaptureEnabled(e),this._initializedTokens.push(i),t&&t.config&&t.config.enable_collect_everything&&this._isAutocaptureEnabled?(t.custom_properties&&(this._customProperties=t.custom_properties),this._addDomEventHandlers(e)):e.__autocapture=!1)},enabledForProject:function(t,e,i){if(!t)return!0;e=Si(e)?10:e,i=Si(i)?10:i;for(var r=0,s=0;s<t.length;s++)r+=t.charCodeAt(s);return r%e<i},isBrowserSupported:function(){return Vn(Ue?.querySelectorAll)}};(function(t){for(var e in t)Vn(t[e])&&(t[e]=t[e].bind(t))})(xo),function(t){for(var e in t)Vn(t[e])&&(t[e]=Gb(t[e]))}(xo);var Im="$active_feature_flags",Vf="$override_feature_flags",vb="$feature_flag_payloads",bb=function(t){var e,i={},r=wo(Gf(t||{}));try{for(r.s();!(e=r.n()).done;){var s=ea(e.value,2),n=s[0],a=s[1];a&&(i[n]=a)}}catch(h){r.e(h)}finally{r.f()}return i},bE=function(){function t(e){Mr(this,t),this.instance=e,this._override_warning=!1,this.featureFlagEventHandlers=[],this.reloadFeatureFlagsQueued=!1,this.reloadFeatureFlagsInAction=!1}return Dr(t,[{key:"getFlags",value:function(){return Object.keys(this.getFlagVariants())}},{key:"getFlagVariants",value:function(){var e=this.instance.get_property(ol),i=this.instance.get_property(Vf);if(!i)return e||{};for(var r=ms({},e),s=Object.keys(i),n=0;n<s.length;n++)i[s[n]]===!1?delete r[s[n]]:r[s[n]]=i[s[n]];return this._override_warning||(Te.warn(" Overriding feature flags!",{enabledFlags:e,overriddenFlags:i,finalFlags:r}),this._override_warning=!0),r}},{key:"getFlagPayloads",value:function(){return this.instance.get_property(vb)||{}}},{key:"reloadFeatureFlags",value:function(){this.reloadFeatureFlagsQueued||(this.reloadFeatureFlagsQueued=!0,this._startReloadTimer())}},{key:"setAnonymousDistinctId",value:function(e){this.$anon_distinct_id=e}},{key:"setReloadingPaused",value:function(e){this.reloadFeatureFlagsInAction=e}},{key:"resetRequestQueue",value:function(){this.reloadFeatureFlagsQueued=!1}},{key:"_startReloadTimer",value:function(){var e=this;this.reloadFeatureFlagsQueued&&!this.reloadFeatureFlagsInAction&&setTimeout(function(){!e.reloadFeatureFlagsInAction&&e.reloadFeatureFlagsQueued&&(e.reloadFeatureFlagsQueued=!1,e._reloadFeatureFlagsRequest())},5)}},{key:"_reloadFeatureFlagsRequest",value:function(){var e=this;if(!this.instance.config.advanced_disable_feature_flags){this.setReloadingPaused(!0);var i=this.instance.config.token,r=this.instance.get_property(hl),s=this.instance.get_property(_o),n=i0(JSON.stringify({token:i,distinct_id:this.instance.get_distinct_id(),groups:this.instance.getGroups(),$anon_distinct_id:this.$anon_distinct_id,person_properties:r,group_properties:s,disable_flags:this.instance.config.advanced_disable_feature_flags||void 0}));this.instance._send_request(this.instance.config.api_host+"/decide/?v=3",{data:n},{method:"POST"},this.instance._prepare_callback(function(a){e.$anon_distinct_id=void 0,e.receivedFeatureFlags(a),e.setReloadingPaused(!1),e._startReloadTimer()}))}}},{key:"getFeatureFlag",value:function(e){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(this.instance.decideEndpointWasHit||this.getFlags()&&this.getFlags().length>0){var r,s=this.getFlagVariants()[e],n="".concat(s),a=this.instance.get_property(Qf)||{};return(i.send_event||!("send_event"in i))&&(!(e in a)||!a[e].includes(n))&&(Hr(a[e])?a[e].push(n):a[e]=[n],(r=this.instance.persistence)===null||r===void 0||r.register(Be({},Qf,a)),this.instance.capture("$feature_flag_called",{$feature_flag:e,$feature_flag_response:s})),s}Te.warn('getFeatureFlag for key "'+e+`" failed. Feature flags didn't load in time.`)}},{key:"getFeatureFlagPayload",value:function(e){return this.getFlagPayloads()[e]}},{key:"isFeatureEnabled",value:function(e){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(this.instance.decideEndpointWasHit||this.getFlags()&&this.getFlags().length>0)return!!this.getFeatureFlag(e,i);Te.warn('isFeatureEnabled for key "'+e+`" failed. Feature flags didn't load in time.`)}},{key:"addFeatureFlagsHandler",value:function(e){this.featureFlagEventHandlers.push(e)}},{key:"removeFeatureFlagsHandler",value:function(e){this.featureFlagEventHandlers=this.featureFlagEventHandlers.filter(function(i){return i!==e})}},{key:"receivedFeatureFlags",value:function(e){if(this.instance.persistence){this.instance.decideEndpointWasHit=!0;var i=this.getFlagVariants(),r=this.getFlagPayloads();(function(s,n){var a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},h=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{},o=s.featureFlags,c=s.featureFlagPayloads;if(o)if(Hr(o)){var g,l={};if(o)for(var p=0;p<o.length;p++)l[o[p]]=!0;n&&n.register((Be(g={},Im,o),Be(g,ol,l),g))}else{var v,u=o,m=c;s.errorsWhileComputingFlags&&(u=ti(ti({},a),u),m=ti(ti({},h),m)),n&&n.register((Be(v={},Im,Object.keys(bb(u))),Be(v,ol,u||{}),Be(v,vb,m||{}),v))}})(e,this.instance.persistence,i,r),this._fireFeatureFlagsCallbacks()}}},{key:"override",value:function(e){if(!this.instance.__loaded||!this.instance.persistence)return Te.uninitializedWarning("posthog.feature_flags.override");if(this._override_warning=!1,e===!1)this.instance.persistence.unregister(Vf);else if(Hr(e)){for(var i={},r=0;r<e.length;r++)i[e[r]]=!0;this.instance.persistence.register(Be({},Vf,i))}else this.instance.persistence.register(Be({},Vf,e))}},{key:"onFeatureFlags",value:function(e){var i=this;if(this.addFeatureFlagsHandler(e),this.instance.decideEndpointWasHit){var r=this._prepareFeatureFlagsForCallbacks(),s=r.flags,n=r.flagVariants;e(s,n)}return function(){return i.removeFeatureFlagsHandler(e)}}},{key:"updateEarlyAccessFeatureEnrollment",value:function(e,i){var r,s,n=Be({},"$feature_enrollment/".concat(e),i);this.instance.capture("$feature_enrollment_update",{$feature_flag:e,$feature_enrollment:i,$set:n}),this.setPersonPropertiesForFlags(n,!1);var a=ti(ti({},this.getFlagVariants()),{},Be({},e,i));(r=this.instance.persistence)===null||r===void 0||r.register((Be(s={},Im,Object.keys(bb(a))),Be(s,ol,a),s)),this._fireFeatureFlagsCallbacks()}},{key:"getEarlyAccessFeatures",value:function(e){var i=this,r=arguments.length>1&&arguments[1]!==void 0&&arguments[1],s=this.instance.get_property($m);if(s&&!r)return e(s);this.instance._send_request("".concat(this.instance.config.api_host,"/api/early_access_features/?token=").concat(this.instance.config.token),{},{method:"GET"},function(n){var a,h=n.earlyAccessFeatures;return(a=i.instance.persistence)===null||a===void 0||a.register(Be({},$m,h)),e(h)})}},{key:"_prepareFeatureFlagsForCallbacks",value:function(){var e=this.getFlags(),i=this.getFlagVariants();return{flags:e.filter(function(r){return i[r]}),flagVariants:Object.keys(i).filter(function(r){return i[r]}).reduce(function(r,s){return r[s]=i[s],r},{})}}},{key:"_fireFeatureFlagsCallbacks",value:function(){var e=this._prepareFeatureFlagsForCallbacks(),i=e.flags,r=e.flagVariants;this.featureFlagEventHandlers.forEach(function(s){return s(i,r)})}},{key:"setPersonPropertiesForFlags",value:function(e){var i=!(arguments.length>1&&arguments[1]!==void 0)||arguments[1],r=this.instance.get_property(hl)||{};this.instance.register(Be({},hl,ti(ti({},r),e))),i&&this.instance.reloadFeatureFlags()}},{key:"resetPersonPropertiesForFlags",value:function(){this.instance.unregister(hl)}},{key:"setGroupPropertiesForFlags",value:function(e){var i=!(arguments.length>1&&arguments[1]!==void 0)||arguments[1],r=this.instance.get_property(_o)||{};Object.keys(r).length!==0&&Object.keys(r).forEach(function(s){r[s]=ti(ti({},r[s]),e[s]),delete e[s]}),this.instance.register(Be({},_o,ti(ti({},r),e))),i&&this.instance.reloadFeatureFlags()}},{key:"resetGroupPropertiesForFlags",value:function(e){if(e){var i=this.instance.get_property(_o)||{};this.instance.register(Be({},_o,ti(ti({},i),{},Be({},e,{}))))}else this.instance.unregister(_o)}}]),t}();Math.trunc||(Math.trunc=function(t){return t<0?Math.ceil(t):Math.floor(t)}),Number.isInteger||(Number.isInteger=function(t){return ba(t)&&isFinite(t)&&Math.floor(t)===t});var _b="0123456789abcdef",_E=function(){function t(e){if(Mr(this,t),this.bytes=e,e.length!==16)throw new TypeError("not 128-bit length")}return Dr(t,[{key:"toString",value:function(){for(var e="",i=0;i<this.bytes.length;i++)e=e+_b.charAt(this.bytes[i]>>>4)+_b.charAt(15&this.bytes[i]),i!==3&&i!==5&&i!==7&&i!==9||(e+="-");if(e.length!==36)throw new Error("Invalid UUIDv7 was generated");return e}},{key:"clone",value:function(){return new t(this.bytes.slice(0))}},{key:"equals",value:function(e){return this.compareTo(e)===0}},{key:"compareTo",value:function(e){for(var i=0;i<16;i++){var r=this.bytes[i]-e.bytes[i];if(r!==0)return Math.sign(r)}return 0}}],[{key:"fromFieldsV7",value:function(e,i,r,s){if(!Number.isInteger(e)||!Number.isInteger(i)||!Number.isInteger(r)||!Number.isInteger(s)||e<0||i<0||r<0||s<0||e>0xffffffffffff||i>4095||r>1073741823||s>4294967295)throw new RangeError("invalid field value");var n=new Uint8Array(16);return n[0]=e/Math.pow(2,40),n[1]=e/Math.pow(2,32),n[2]=e/Math.pow(2,24),n[3]=e/Math.pow(2,16),n[4]=e/Math.pow(2,8),n[5]=e,n[6]=112|i>>>8,n[7]=i,n[8]=128|r>>>24,n[9]=r>>>16,n[10]=r>>>8,n[11]=r,n[12]=s>>>24,n[13]=s>>>16,n[14]=s>>>8,n[15]=s,new t(n)}}]),t}(),xE=function(){function t(){Mr(this,t),Be(this,"timestamp",0),Be(this,"counter",0),Be(this,"random",new SE)}return Dr(t,[{key:"generate",value:function(){var e=this.generateOrAbort();if(Si(e)){this.timestamp=0;var i=this.generateOrAbort();if(Si(i))throw new Error("Could not generate UUID after timestamp reset");return i}return e}},{key:"generateOrAbort",value:function(){var e=Date.now();if(e>this.timestamp)this.timestamp=e,this.resetCounter();else{if(!(e+1e4>this.timestamp))return;this.counter++,this.counter>4398046511103&&(this.timestamp++,this.resetCounter())}return _E.fromFieldsV7(this.timestamp,Math.trunc(this.counter/Math.pow(2,30)),this.counter&Math.pow(2,30)-1,this.random.nextUint32())}},{key:"resetCounter",value:function(){this.counter=1024*this.random.nextUint32()+(1023&this.random.nextUint32())}}]),t}(),Wb=function(t){if(typeof UUIDV7_DENY_WEAK_RNG<"u"&&UUIDV7_DENY_WEAK_RNG)throw new Error("no cryptographically strong RNG available");for(var e=0;e<t.length;e++)t[e]=65536*Math.trunc(65536*Math.random())+Math.trunc(65536*Math.random());return t};oe&&!Si(oe.crypto)&&crypto.getRandomValues&&(Wb=function(t){return crypto.getRandomValues(t)});var xb,SE=function(){function t(){Mr(this,t),Be(this,"buffer",new Uint32Array(8)),Be(this,"cursor",1/0)}return Dr(t,[{key:"nextUint32",value:function(){return this.cursor>=this.buffer.length&&(Wb(this.buffer),this.cursor=0),this.buffer[this.cursor++]}}]),t}(),mh=function(){return wE().toString()},wE=function(){return(xb||(xb=new xE)).generate()},PE="Thu, 01 Jan 1970 00:00:00 GMT",Pp="",kE=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i;function CE(t,e){if(e){var i=function(s){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Ue;if(Pp)return Pp;if(!n||["localhost","127.0.0.1"].includes(s))return"";for(var a=s.split("."),h=Math.min(a.length,8),o="dmn_chk_"+mh(),c=new RegExp("(^|;)\\s*"+o+"=1");!Pp&&h--;){var g=a.slice(h).join("."),l=o+"=1;domain=."+g;n.cookie=l,c.test(n.cookie)&&(n.cookie=l+";expires="+PE,Pp=g)}return Pp}(t);if(!i){var r=function(s){var n=s.match(kE);return n?n[0]:""}(t);r!==i&&Te.info("Warning: cookie subdomain discovery mismatch",r,i),i=r}return i?"; domain=."+i:""}return""}var _a={is_supported:function(){return!!Ue},error:function(t){Te.error("cookieStore error: "+t)},get:function(t){if(Ue){try{for(var e=t+"=",i=Ue.cookie.split(";").filter(function(n){return n.length}),r=0;r<i.length;r++){for(var s=i[r];s.charAt(0)==" ";)s=s.substring(1,s.length);if(s.indexOf(e)===0)return decodeURIComponent(s.substring(e.length,s.length))}}catch{}return null}},parse:function(t){var e;try{e=JSON.parse(_a.get(t))||{}}catch{}return e},set:function(t,e,i,r,s){if(Ue)try{var n="",a="",h=CE(Ue.location.hostname,r);if(i){var o=new Date;o.setTime(o.getTime()+24*i*60*60*1e3),n="; expires="+o.toUTCString()}s&&(a="; secure");var c=t+"="+encodeURIComponent(JSON.stringify(e))+n+"; SameSite=Lax; path=/"+h+a;return c.length>3686.4&&Te.warn("cookieStore warning: large cookie, len="+c.length),Ue.cookie=c,c}catch{return}},remove:function(t,e){try{_a.set(t,"",-1,e)}catch{return}}},Fm=null,Lr={is_supported:function(){if(!Ts(Fm))return Fm;var t=!0;if(Si(oe))t=!1;else try{var e="__mplssupport__";Lr.set(e,"xyz"),Lr.get(e)!=='"xyz"'&&(t=!1),Lr.remove(e)}catch{t=!1}return t||Te.error("localStorage unsupported; falling back to cookie store"),Fm=t,t},error:function(t){Te.error("localStorage error: "+t)},get:function(t){try{return oe?.localStorage.getItem(t)}catch(e){Lr.error(e)}return null},parse:function(t){try{return JSON.parse(Lr.get(t))||{}}catch{}return null},set:function(t,e){try{oe?.localStorage.setItem(t,JSON.stringify(e))}catch(i){Lr.error(i)}},remove:function(t){try{oe?.localStorage.removeItem(t)}catch(e){Lr.error(e)}}},AE=["distinct_id",Kf,qf],Ep=ti(ti({},Lr),{},{parse:function(t){try{var e={};try{e=_a.parse(t)||{}}catch{}var i=ms(e,JSON.parse(Lr.get(t)||"{}"));return Lr.set(t,i),i}catch{}return null},set:function(t,e,i,r,s){try{Lr.set(t,e);var n={};AE.forEach(function(a){e[a]&&(n[a]=e[a])}),Object.keys(n).length&&_a.set(t,n,i,r,s)}catch(a){Lr.error(a)}},remove:function(t,e){try{oe?.localStorage.removeItem(t),_a.remove(t,e)}catch(i){Lr.error(i)}}}),Of={},EE={is_supported:function(){return!0},error:function(t){Te.error("memoryStorage error: "+t)},get:function(t){return Of[t]||null},parse:function(t){return Of[t]||null},set:function(t,e){Of[t]=e},remove:function(t){delete Of[t]}},uh=null,ys={is_supported:function(){if(!Ts(uh))return uh;if(uh=!0,Si(oe))uh=!1;else try{var t="__support__";ys.set(t,"xyz"),ys.get(t)!=='"xyz"'&&(uh=!1),ys.remove(t)}catch{uh=!1}return uh},error:function(t){Te.error("sessionStorage error: ",t)},get:function(t){try{return oe?.sessionStorage.getItem(t)}catch(e){ys.error(e)}return null},parse:function(t){try{return JSON.parse(ys.get(t))||null}catch{}return null},set:function(t,e){try{oe?.sessionStorage.setItem(t,JSON.stringify(e))}catch(i){ys.error(i)}},remove:function(t){try{oe?.sessionStorage.removeItem(t)}catch(e){ys.error(e)}}},TE=["localhost","127.0.0.1"],Hf=!(!ab||!("withCredentials"in new ab))||!!zm,Ub=function(t){var e=Ue?.createElement("a");return Si(e)?null:(e.href=t,e)},ME=function(t,e){return!!function(i){try{new RegExp(i)}catch{return!1}return!0}(e)&&new RegExp(e).test(t)},Sb=function(t,e){for(var i,r=((t.split("#")[0]||"").split("?")[1]||"").split("&"),s=0;s<r.length;s++){var n=r[s].split("=");if(n[0]===e){i=n;break}}if(!Hr(i)||i.length<2)return"";var a=i[1];try{a=decodeURIComponent(a)}catch{Te.error("Skipping decoding for malformed query param: "+a)}return a.replace(/\+/g," ")},tu=function(t,e){var i=t.match(new RegExp(e+"=([^&]*)"));return i?i[1]:null},qr={campaignParams:function(t){var e=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gclid","gad_source","gbraid","wbraid","fbclid","msclkid"].concat(t||[]),i={};return tr(e,function(r){var s=Ue?Sb(Ue.URL,r):"";s.length&&(i[r]=s)}),i},searchEngine:function(){var t=Ue?.referrer;return t?t.search("https?://(.*)google.([^/?]*)")===0?"google":t.search("https?://(.*)bing.com")===0?"bing":t.search("https?://(.*)yahoo.com")===0?"yahoo":t.search("https?://(.*)duckduckgo.com")===0?"duckduckgo":null:null},searchInfo:function(){var t=qr.searchEngine(),e=t!="yahoo"?"q":"p",i={};if(!Ts(t)){i.$search_engine=t;var r=Ue?Sb(Ue.referrer,e):"";r.length&&(i.ph_keyword=r)}return i},browser:function(t,e,i){return e=e||"",i||$i(t," OPR/")?$i(t,"Mini")?"Opera Mini":"Opera":/(BlackBerry|PlayBook|BB10)/i.test(t)?"BlackBerry":$i(t,"IEMobile")||$i(t,"WPDesktop")?"Internet Explorer Mobile":$i(t,"SamsungBrowser/")?"Samsung Internet":$i(t,"Edge")||$i(t,"Edg/")?"Microsoft Edge":$i(t,"FBIOS")?"Facebook Mobile":$i(t,"Chrome")?"Chrome":$i(t,"CriOS")?"Chrome iOS":$i(t,"UCWEB")||$i(t,"UCBrowser")?"UC Browser":$i(t,"FxiOS")?"Firefox iOS":$i(e,"Apple")||function(r){return $i(r,"Safari")&&!$i(r,"Chrome")&&!$i(r,"Android")}(t)?$i(t,"Mobile")?"Mobile Safari":"Safari":$i(t,"Android")?"Android Mobile":$i(t,"Konqueror")||$i(t,"konqueror")?"Konqueror":$i(t,"Firefox")?"Firefox":$i(t,"MSIE")||$i(t,"Trident/")?"Internet Explorer":$i(t,"Gecko")?"Mozilla":""},browserVersion:function(t,e,i){var r={"Internet Explorer Mobile":[/rv:(\d+(\.\d+)?)/],"Microsoft Edge":[/Edge?\/(\d+(\.\d+)?)/],Chrome:[/Chrome\/(\d+(\.\d+)?)/],"Chrome iOS":[/CriOS\/(\d+(\.\d+)?)/],"UC Browser":[/(UCBrowser|UCWEB)\/(\d+(\.\d+)?)/],Safari:[/Version\/(\d+(\.\d+)?)/],"Mobile Safari":[/Version\/(\d+(\.\d+)?)/],Opera:[/(Opera|OPR)\/(\d+(\.\d+)?)/],Firefox:[/Firefox\/(\d+(\.\d+)?)/],"Firefox iOS":[/FxiOS\/(\d+(\.\d+)?)/],Konqueror:[/Konqueror[:/]?(\d+(\.\d+)?)/i],BlackBerry:[/BlackBerry (\d+(\.\d+)?)/,/Version\/(\d+(\.\d+)?)/],"Android Mobile":[/android\s(\d+(\.\d+)?)/],"Samsung Internet":[/SamsungBrowser\/(\d+(\.\d+)?)/],"Internet Explorer":[/(rv:|MSIE )(\d+(\.\d+)?)/],Mozilla:[/rv:(\d+(\.\d+)?)/]}[qr.browser(t,e,i)];if(Si(r))return null;for(var s=0;s<r.length;s++){var n=r[s],a=t.match(n);if(a)return parseFloat(a[a.length-2])}return null},browserLanguage:function(){return navigator.language||navigator.userLanguage},os:function(t){if(/Windows/i.test(t)){if(/Phone/.test(t)||/WPDesktop/.test(t))return{os_name:"Windows Phone",os_version:""};var e=/Windows NT ([0-9.]+)/i.exec(t);return e&&e[1]?{os_name:"Windows",os_version:e[1]}:{os_name:"Windows",os_version:""}}if(/(iPhone|iPad|iPod)/.test(t)){var i=/OS (\d+)_(\d+)_?(\d+)?/i.exec(t);return i&&i[1]?{os_name:"iOS",os_version:[i[1],i[2],i[3]||"0"].join(".")}:{os_name:"iOS",os_version:""}}if(/Android/.test(t)){var r=/Android (\d+)\.(\d+)\.?(\d+)?/i.exec(t);return r&&r[1]?{os_name:"Android",os_version:[r[1],r[2],r[3]||"0"].join(".")}:{os_name:"Android",os_version:""}}if(/(BlackBerry|PlayBook|BB10)/i.test(t))return{os_name:"BlackBerry",os_version:""};if(/Mac/i.test(t)){var s=/Mac OS X (\d+)[_.](\d+)[_.]?(\d+)?/i.exec(t);return s&&s[1]?{os_name:"Mac OS X",os_version:[s[1],s[2],s[3]||"0"].join(".")}:{os_name:"Mac OS X",os_version:""}}return/Linux/.test(t)?{os_name:"Linux",os_version:""}:/CrOS/.test(t)?{os_name:"Chrome OS",os_version:""}:{os_name:"",os_version:""}},device:function(t){return/Windows Phone/i.test(t)||/WPDesktop/.test(t)?"Windows Phone":/iPad/.test(t)?"iPad":/iPod/.test(t)?"iPod Touch":/iPhone/.test(t)?"iPhone":/(BlackBerry|PlayBook|BB10)/i.test(t)?"BlackBerry":/Android/.test(t)&&!/Mobile/.test(t)?"Android Tablet":/Android/.test(t)?"Android":""},deviceType:function(t){var e=this.device(t);return e==="iPad"||e==="Android Tablet"?"Tablet":e?"Mobile":"Desktop"},referrer:function(){return Ue?.referrer||"$direct"},referringDomain:function(){var t;return Ue!=null&&Ue.referrer&&((t=Ub(Ue.referrer))===null||t===void 0?void 0:t.host)||"$direct"},properties:function(){if(!Tr)return{};var t=qr.os(Tr),e=t.os_name,i=t.os_version;return ms(Nm({$os:e,$os_version:i,$browser:qr.browser(Tr,navigator.vendor,Ms.opera),$device:qr.device(Tr),$device_type:qr.deviceType(Tr)}),{$current_url:bo?.href,$host:bo?.host,$pathname:bo?.pathname,$raw_user_agent:Tr.length>1e3?Tr.substring(0,997)+"...":Tr,$browser_version:qr.browserVersion(Tr,navigator.vendor,Ms.opera),$browser_language:qr.browserLanguage(),$screen_height:oe?.screen.height,$screen_width:oe?.screen.width,$viewport_height:oe?.innerHeight,$viewport_width:oe?.innerWidth,$lib:"web",$lib_version:yh.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Nb()/1e3})},people_properties:function(){if(!Tr)return{};var t=qr.os(Tr),e=t.os_name,i=t.os_version;return ms(Nm({$os:e,$os_version:i,$browser:qr.browser(Tr,navigator.vendor,Ms.opera)}),{$browser_version:qr.browserVersion(Tr,navigator.vendor,Ms.opera)})}},DE=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"],wb=function(){function t(e){Mr(this,t);var i="";e.token&&(i=e.token.replace(/\+/g,"PL").replace(/\//g,"SL").replace(/=/g,"EQ")),this.props={},this.campaign_params_saved=!1,this.custom_campaign_params=e.custom_campaign_params||[],e.persistence_name?this.name="ph_"+e.persistence_name:this.name="ph_"+i+"_posthog",DE.indexOf(e.persistence.toLowerCase())===-1&&(Te.critical("Unknown persistence type "+e.persistence+"; falling back to localStorage+cookie"),e.persistence="localStorage+cookie");var r=e.persistence.toLowerCase();r==="localstorage"&&Lr.is_supported()?this.storage=Lr:r==="localstorage+cookie"&&Ep.is_supported()?this.storage=Ep:r==="sessionstorage"&&ys.is_supported()?this.storage=ys:r==="memory"?this.storage=EE:r==="cookie"?this.storage=_a:Ep.is_supported()?this.storage=Ep:this.storage=_a,this.load(),this.update_config(e),this.save()}return Dr(t,[{key:"properties",value:function(){var e={};return tr(this.props,function(i,r){if(r===ol&&So(i))for(var s=Object.keys(i),n=0;n<s.length;n++)e["$feature/".concat(s[n])]=i[s[n]];else h=r,o=!1,(Ts(a=vE)?o:sb&&a.indexOf===sb?a.indexOf(h)!=-1:(tr(a,function(c){if(o||(o=c===h))return e0}),o))||(e[r]=i);var a,h,o}),e}},{key:"load",value:function(){if(!this.disabled){var e=this.storage.parse(this.name);e&&(this.props=ms({},e))}}},{key:"save",value:function(){this.disabled||this.storage.set(this.name,this.props,this.expire_days,this.cross_subdomain,this.secure)}},{key:"remove",value:function(){this.storage.remove(this.name,!1),this.storage.remove(this.name,!0)}},{key:"clear",value:function(){this.remove(),this.props={}}},{key:"register_once",value:function(e,i,r){var s=this;if(So(e)){Si(i)&&(i="None"),this.expire_days=Si(r)?this.default_expiry:r;var n=!1;if(tr(e,function(a,h){s.props.hasOwnProperty(h)&&s.props[h]!==i||(s.props[h]=a,n=!0)}),n)return this.save(),!0}return!1}},{key:"register",value:function(e,i){var r=this;if(So(e)){this.expire_days=Si(i)?this.default_expiry:i;var s=!1;if(tr(e,function(n,a){e.hasOwnProperty(a)&&r.props[a]!==n&&(r.props[a]=n,s=!0)}),s)return this.save(),!0}return!1}},{key:"unregister",value:function(e){e in this.props&&(delete this.props[e],this.save())}},{key:"update_campaign_params",value:function(){this.campaign_params_saved||(this.register(qr.campaignParams(this.custom_campaign_params)),this.campaign_params_saved=!0)}},{key:"update_search_keyword",value:function(){this.register(qr.searchInfo())}},{key:"update_referrer_info",value:function(){this.register({$referrer:this.props.$referrer||qr.referrer(),$referring_domain:this.props.$referring_domain||qr.referringDomain()})}},{key:"get_referrer_info",value:function(){return Nm({$referrer:this.props.$referrer,$referring_domain:this.props.$referring_domain})}},{key:"safe_merge",value:function(e){return tr(this.props,function(i,r){r in e||(e[r]=i)}),e}},{key:"update_config",value:function(e){this.default_expiry=this.expire_days=e.cookie_expiration,this.set_disabled(e.disable_persistence),this.set_cross_subdomain(e.cross_subdomain_cookie),this.set_secure(e.secure_cookie)}},{key:"set_disabled",value:function(e){this.disabled=e,this.disabled?this.remove():this.save()}},{key:"set_cross_subdomain",value:function(e){e!==this.cross_subdomain&&(this.cross_subdomain=e,this.remove(),this.save())}},{key:"get_cross_subdomain",value:function(){return!!this.cross_subdomain}},{key:"set_secure",value:function(e){e!==this.secure&&(this.secure=e,this.remove(),this.save())}},{key:"set_event_timer",value:function(e,i){var r=this.props[Ap]||{};r[e]=i,this.props[Ap]=r,this.save()}},{key:"remove_event_timer",value:function(e){var i=(this.props[Ap]||{})[e];return Si(i)||(delete this.props[Ap][e],this.save()),i}},{key:"get_user_state",value:function(){return this.props[qm]||"anonymous"}},{key:"set_user_state",value:function(e){this.props[qm]=e,this.save()}},{key:"get_quota_limits",value:function(){return this.props[Hm]||{}}},{key:"set_quota_limits",value:function(e){this.props[Hm]=e,this.save()}}]),t}(),Pb=2,IE=4,FE=Dr(function t(e){var i,r,s=this,n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};Mr(this,t),Be(this,"bucketSize",100),Be(this,"refillRate",10),Be(this,"mutationBuckets",{}),Be(this,"loggedTracker",{}),Be(this,"refillBuckets",function(){Object.keys(s.mutationBuckets).forEach(function(a){s.mutationBuckets[a]=s.mutationBuckets[a]+s.refillRate,s.mutationBuckets[a]>=s.bucketSize&&delete s.mutationBuckets[a]})}),Be(this,"getNodeOrRelevantParent",function(a){var h=s.rrweb.mirror.getNode(a);if(h?.nodeName!=="svg"&&h instanceof Element){var o=h.closest("svg");if(o)return[s.rrweb.mirror.getId(o),o]}return[a,h]}),Be(this,"numberOfChanges",function(a){var h,o,c,g,l,p,v,u;return((h=(o=a.removes)===null||o===void 0?void 0:o.length)!==null&&h!==void 0?h:0)+((c=(g=a.attributes)===null||g===void 0?void 0:g.length)!==null&&c!==void 0?c:0)+((l=(p=a.texts)===null||p===void 0?void 0:p.length)!==null&&l!==void 0?l:0)+((v=(u=a.adds)===null||u===void 0?void 0:u.length)!==null&&v!==void 0?v:0)}),Be(this,"throttleMutations",function(a){if(a.type!==3||a.data.source!==0)return a;var h=a.data,o=s.numberOfChanges(h);h.attributes&&(h.attributes=h.attributes.filter(function(g){var l,p,v,u=ea(s.getNodeOrRelevantParent(g.id),2),m=u[0],k=u[1];return s.mutationBuckets[m]===0?!1:(s.mutationBuckets[m]=(l=s.mutationBuckets[m])!==null&&l!==void 0?l:s.bucketSize,s.mutationBuckets[m]=Math.max(s.mutationBuckets[m]-1,0),s.mutationBuckets[m]===0&&(s.loggedTracker[m]||(s.loggedTracker[m]=!0,(p=(v=s.options).onBlockedNode)===null||p===void 0||p.call(v,m,k))),g)}));var c=s.numberOfChanges(h);return c!==0||o===c?a:void 0}),this.rrweb=e,this.options=n,this.refillRate=(i=this.options.refillRate)!==null&&i!==void 0?i:this.refillRate,this.bucketSize=(r=this.options.bucketSize)!==null&&r!==void 0?r:this.bucketSize,setInterval(function(){s.refillBuckets()},1e3)}),Um=function(t){return t[t.DomContentLoaded=0]="DomContentLoaded",t[t.Load=1]="Load",t[t.FullSnapshot=2]="FullSnapshot",t[t.IncrementalSnapshot=3]="IncrementalSnapshot",t[t.Meta=4]="Meta",t[t.Custom=5]="Custom",t[t.Plugin=6]="Plugin",t}(Um||{}),LE={initiatorTypes:["audio","beacon","body","css","early-hint","embed","fetch","frame","iframe","icon","image","img","input","link","navigation","object","ping","script","track","video","xmlhttprequest"],maskRequestFn:function(t){return t},recordHeaders:!1,recordBody:!1,recordInitialRequests:!1,recordPerformance:!1,performanceEntryTypeToObserve:["first-input","navigation","paint","resource"],payloadSizeLimitBytes:1e6},RE=["authorization","x-forwarded-for","authorization","cookie","set-cookie","x-api-key","x-real-ip","remote-addr","forwarded","proxy-authorization","x-csrf-token","x-csrftoken","x-xsrf-token"],VE=["/s/","/e/","/i/vo/e/"];function kb(t,e,i,r){var s=e?.["content-length"];return Si(s)?"[SessionReplay] no content-length header for ".concat(r,", cannot determine payload size"):s&&parseInt(s)>i?"[SessionReplay] ".concat(r," body too large to record"):t}var OE=function(t,e){var i,r,s,n=t.session_recording,a=n.recordHeaders!==!1&&e.recordHeaders,h=n.recordBody!==!1&&e.recordBody,o=n.recordPerformance!==!1&&e.recordPerformance,c=(i=n,s=Math.min(1e6,(r=i.payloadSizeLimitBytes)!==null&&r!==void 0?r:1e6),function(p){return p!=null&&p.requestBody&&(p.requestBody=kb(p.requestBody,p.requestHeaders,s,"Request")),p!=null&&p.responseBody&&(p.responseBody=kb(p.responseBody,p.responseHeaders,s,"Response")),p}),g=function(p){return c(function(m){var k=Ub(m.name);if(!(k&&k.pathname&&VE.includes(k.pathname)))return m}((v=p,Object.keys((u=v.requestHeaders)!==null&&u!==void 0?u:{}).forEach(function(m){var k;RE.includes(m.toLowerCase())&&((k=v.requestHeaders)===null||k===void 0||delete k[m])}),v)));var v,u},l=Vn(t.session_recording.maskNetworkRequestFn);return l&&Vn(t.session_recording.maskCapturedNetworkRequestFn)&&Te.warn("Both `maskNetworkRequestFn` and `maskCapturedNetworkRequestFn` are defined. `maskNetworkRequestFn` will be ignored."),l&&(t.session_recording.maskCapturedNetworkRequestFn=function(p){var v=t.session_recording.maskNetworkRequestFn({url:p.name});return ti(ti({},p),{},{name:v?.url})}),n.maskRequestFn=Vn(t.session_recording.maskCapturedNetworkRequestFn)?function(p){var v,u,m,k=g(p);return k&&(v=(u=(m=t.session_recording).maskCapturedNetworkRequestFn)===null||u===void 0?void 0:u.call(m,k))!==null&&v!==void 0?v:void 0}:void 0,n.maskRequestFn||(n.maskRequestFn=g),ti(ti(ti({},LE),n),{},{recordHeaders:a,recordBody:h,recordPerformance:o,recordInitialRequests:o})},BE="__ph_opt_in_out_";function zE(t,e){Jb(!0,t,e)}function NE(t,e){Jb(!1,t,e)}function GE(t,e){return Yb(t,e)==="1"}function Zb(t,e){return!!function(i){if(i&&i.respectDnt){var r=i&&i.window||oe,s=r?.navigator,n=!1;return tr([s?.doNotTrack,s.msDoNotTrack,r.doNotTrack],function(a){$i([!0,1,"1","yes"],a)&&(n=!0)}),n}return!1}(e)||Yb(t,e)==="0"}function $E(t,e){s0(e=e||{}).remove(n0(t,e),!!e.crossSubdomainCookie)}function s0(t){return(t=t||{}).persistenceType==="localStorage"?Lr:t.persistenceType==="localStorage+cookie"?Ep:_a}function n0(t,e){return((e=e||{}).persistencePrefix||BE)+t}function Yb(t,e){return s0(e).get(n0(t,e))}function Jb(t,e,i){yn(e)&&e.length?(s0(i=i||{}).set(n0(e,i),t?1:0,ba(i.cookieExpiration)?i.cookieExpiration:null,i.crossSubdomainCookie,i.secureCookie),i.capture&&t&&i.capture(i.captureEventName||"$opt_in",i.captureProperties||{},{send_instantly:!0})):Te.error("gdpr."+(t?"optIn":"optOut")+" called with an invalid token")}function Zm(t){var e=!1;try{var i=t.config.token,r=t.config.respect_dnt,s=t.config.opt_out_capturing_persistence_type,n=t.config.opt_out_capturing_cookie_prefix||void 0,a=t.config.window;i&&(e=Zb(i,{respectDnt:r,persistenceType:s,persistencePrefix:n,window:a}))}catch(h){Te.error("Unexpected error when checking capturing opt-out status: "+h)}return e}var va,Xb=3e5,Cb=Xb;(function(t){t[t.Mutation=0]="Mutation",t[t.MouseMove=1]="MouseMove",t[t.MouseInteraction=2]="MouseInteraction",t[t.Scroll=3]="Scroll",t[t.ViewportResize=4]="ViewportResize",t[t.Input=5]="Input",t[t.TouchMove=6]="TouchMove",t[t.MediaInteraction=7]="MediaInteraction",t[t.StyleSheetRule=8]="StyleSheetRule",t[t.CanvasMutation=9]="CanvasMutation",t[t.Font=10]="Font",t[t.Log=11]="Log",t[t.Drag=12]="Drag",t[t.StyleDeclaration=13]="StyleDeclaration",t[t.Selection=14]="Selection",t[t.AdoptedStyleSheet=15]="AdoptedStyleSheet"})(va||(va={}));var jE=[va.MouseMove,va.MouseInteraction,va.Scroll,va.ViewportResize,va.Input,va.TouchMove,va.MediaInteraction,va.Drag],Ab=function(t){return{rrwebMethod:t,enqueuedAt:Date.now(),attempt:1}},qE=function(){function t(e){var i=this;if(Mr(this,t),Be(this,"queuedRRWebEvents",[]),Be(this,"isIdle",!1),Be(this,"_linkedFlagSeen",!1),Be(this,"_lastActivityTimestamp",Date.now()),Be(this,"windowId",null),Be(this,"sessionId",null),Be(this,"_linkedFlag",null),Be(this,"_sampleRate",null),Be(this,"_minimumDuration",null),Be(this,"_recordCanvas",!1),Be(this,"_canvasFps",null),Be(this,"_canvasQuality",null),Be(this,"_forceAllowLocalhostNetworkCapture",!1),this.instance=e,this._captureStarted=!1,this._endpoint="/s/",this.stopRrweb=void 0,this.receivedDecide=!1,oe?.addEventListener("beforeunload",function(){i._flushBuffer()}),oe?.addEventListener("offline",function(){i._tryAddCustomEvent("browser offline",{})}),oe?.addEventListener("online",function(){i._tryAddCustomEvent("browser online",{})}),!this.instance.sessionManager)throw Te.error("Session recording started without valid sessionManager"),new Error("Session recording started without valid sessionManager. This is a bug.");this.buffer=this.clearBuffer()}return Dr(t,[{key:"started",get:function(){return this._captureStarted}},{key:"sessionManager",get:function(){if(!this.instance.sessionManager)throw Te.error("Session recording started without valid sessionManager"),new Error("Session recording started without valid sessionManager. This is a bug.");return this.instance.sessionManager}},{key:"isSampled",get:function(){return ba(this._sampleRate)?this.instance.get_property(qf):null}},{key:"sessionDuration",get:function(){var e,i,r=(e=this.buffer)===null||e===void 0?void 0:e.data[((i=this.buffer)===null||i===void 0?void 0:i.data.length)-1],s=this.sessionManager.checkAndGetSessionAndWindowId(!0).sessionStartTimestamp;return r?r.timestamp-s:null}},{key:"isRecordingEnabled",get:function(){var e=!!this.instance.get_property(Gm),i=!this.instance.config.disable_session_recording;return oe&&e&&i}},{key:"isConsoleLogCaptureEnabled",get:function(){var e=!!this.instance.get_property(mb),i=this.instance.config.enable_recording_console_log;return i??e}},{key:"recordingVersion",get:function(){var e,i=this.instance.get_property(gb);return((e=this.instance.config.session_recording)===null||e===void 0?void 0:e.recorderVersion)||i||"v1"}},{key:"networkPayloadCapture",get:function(){var e,i,r=this.instance.get_property(yb),s={recordHeaders:(e=this.instance.config.session_recording)===null||e===void 0?void 0:e.recordHeaders,recordBody:(i=this.instance.config.session_recording)===null||i===void 0?void 0:i.recordBody},n=s?.recordHeaders||r?.recordHeaders,a=s?.recordBody||r?.recordBody,h=this.instance.config.capture_performance||r?.capturePerformance;return n||a||h?{recordHeaders:n,recordBody:a,recordPerformance:h}:void 0}},{key:"status",get:function(){return this.receivedDecide?this.isRecordingEnabled?yn(this._linkedFlag)&&!this._linkedFlagSeen?"buffering":Bm(this.isSampled)?this.isSampled?"sampled":"disabled":"active":"disabled":"buffering"}},{key:"startRecordingIfEnabled",value:function(){this.isRecordingEnabled?(this.startCaptureAndTrySendingQueuedSnapshots(),Te.info("[SessionRecording] started")):(this.stopRecording(),this.clearBuffer())}},{key:"stopRecording",value:function(){this._captureStarted&&this.stopRrweb&&(this.stopRrweb(),this.stopRrweb=void 0,this._captureStarted=!1,Te.info("[SessionRecording] stopped"))}},{key:"makeSamplingDecision",value:function(e){var i,r=this.sessionId!==e;if(ba(this._sampleRate)){var s,n=this.isSampled;r||!Bm(n)?s=Math.random()<this._sampleRate:s=n,s||Te.warn("[SessionSampling] Sample rate (".concat(this._sampleRate,") has determined that this sessionId (").concat(e,") will not be sent to the server.")),(i=this.instance.persistence)===null||i===void 0||i.register(Be({},qf,s))}else{var a;(a=this.instance.persistence)===null||a===void 0||a.register(Be({},qf,null))}}},{key:"afterDecideResponse",value:function(e){var i,r,s,n,a,h,o,c,g,l,p,v=this;this.instance.persistence&&this.instance.persistence.register((Be(p={},Gm,!!e.sessionRecording),Be(p,mb,(c=e.sessionRecording)===null||c===void 0?void 0:c.consoleLogRecordingEnabled),Be(p,gb,(g=e.sessionRecording)===null||g===void 0?void 0:g.recorderVersion),Be(p,yb,ti({capturePerformance:e.capturePerformance},(l=e.sessionRecording)===null||l===void 0?void 0:l.networkPayloadCapture)),p));var u=(i=e.sessionRecording)===null||i===void 0?void 0:i.sampleRate;this._sampleRate=Si(u)||Ts(u)?null:parseFloat(u);var m=(r=e.sessionRecording)===null||r===void 0?void 0:r.minimumDurationMilliseconds;this._minimumDuration=Si(m)?null:m;var k=(s=e.sessionRecording)===null||s===void 0?void 0:s.recordCanvas;this._recordCanvas=!Si(k)&&!Ts(k)&&k;var y=(n=e.sessionRecording)===null||n===void 0?void 0:n.canvasFps;this._canvasFps=Si(y)?null:y;var d,b=(a=e.sessionRecording)===null||a===void 0?void 0:a.canvasQuality;if(this._canvasQuality=Si(b)||Ts(b)?null:parseFloat(b),this._linkedFlag=((h=e.sessionRecording)===null||h===void 0?void 0:h.linkedFlag)||null,(o=e.sessionRecording)!==null&&o!==void 0&&o.endpoint&&(this._endpoint=(d=e.sessionRecording)===null||d===void 0?void 0:d.endpoint),ba(this._sampleRate)&&this.sessionManager.onSessionId(function(E){v.makeSamplingDecision(E)}),yn(this._linkedFlag)){var S=this._linkedFlag;this.instance.onFeatureFlags(function(E){v._linkedFlagSeen=E.includes(S)})}this.receivedDecide=!0,this.startRecordingIfEnabled()}},{key:"log",value:function(e){var i,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"log";(i=this.instance.sessionRecording)===null||i===void 0||i.onRRwebEmit({type:6,data:{plugin:"rrweb/console@1",payload:{level:r,trace:[],payload:[JSON.stringify(e)]}},timestamp:Nb()})}},{key:"startCaptureAndTrySendingQueuedSnapshots",value:function(){this._startCapture()}},{key:"_startCapture",value:function(){var e=this;if(!Si(Object.assign)&&!(this._captureStarted||this.instance.config.disable_session_recording||Zm(this.instance))){this._captureStarted=!0,this.sessionManager.checkAndGetSessionAndWindowId();var i=this.recordingVersion==="v2"?"recorder-v2.js":"recorder.js";this.instance.__loaded_recorder_version!==this.recordingVersion?Mp(this.instance.config.api_host+"/static/".concat(i,"?v=").concat(yh.LIB_VERSION),function(r){if(r)return Te.error("Could not load ".concat(i),r);e._onScriptLoaded()}):this._onScriptLoaded()}}},{key:"_isInteractiveEvent",value:function(e){var i;return e.type===3&&jE.indexOf((i=e.data)===null||i===void 0?void 0:i.source)!==-1}},{key:"_updateWindowAndSessionIds",value:function(e){var i=this._isInteractiveEvent(e);i||this.isIdle||e.timestamp-this._lastActivityTimestamp>Cb&&(this.isIdle=!0,this._tryAddCustomEvent("sessionIdle",{reason:"user inactivity",timeSinceLastActive:e.timestamp-this._lastActivityTimestamp,threshold:Cb}));var r=!1;if(i&&(this._lastActivityTimestamp=e.timestamp,this.isIdle&&(this.isIdle=!1,this._tryAddCustomEvent("sessionNoLongerIdle",{reason:"user activity",type:e.type}),r=!0)),!this.isIdle){var s=this.sessionManager.checkAndGetSessionAndWindowId(!i,e.timestamp),n=s.windowId,a=s.sessionId,h=this.sessionId!==a,o=this.windowId!==n;this.windowId=n,this.sessionId=a,(r||[Pb,IE].indexOf(e.type)===-1&&(o||h))&&this._tryTakeFullSnapshot()}}},{key:"_tryRRWebMethod",value:function(e){try{return e.rrwebMethod(),!0}catch(i){return Te.warn("[Session-Recording] could not emit queued rrweb event.",i),this.queuedRRWebEvents.length<10&&this.queuedRRWebEvents.push({enqueuedAt:e.enqueuedAt||Date.now(),attempt:e.attempt++,rrwebMethod:e.rrwebMethod}),!1}}},{key:"_tryAddCustomEvent",value:function(e,i){var r=this;return this._tryRRWebMethod(Ab(function(){return r.rrwebRecord.addCustomEvent(e,i)}))}},{key:"_tryTakeFullSnapshot",value:function(){var e=this;return this._tryRRWebMethod(Ab(function(){return e.rrwebRecord.takeFullSnapshot()}))}},{key:"_onScriptLoaded",value:function(){var e,i=this,r={blockClass:"ph-no-capture",blockSelector:void 0,ignoreClass:"ph-ignore-input",maskTextClass:"ph-mask",maskTextSelector:void 0,maskTextFn:void 0,maskAllInputs:!0,maskInputOptions:{},maskInputFn:void 0,slimDOMOptions:{},collectFonts:!1,inlineStylesheet:!0,recordCrossOriginIframes:!1};this.rrwebRecord=oe.rrweb?oe.rrweb.record:oe.rrwebRecord;for(var s=this.instance.config.session_recording,n=0,a=Object.entries(s||{});n<a.length;n++){var h=ea(a[n],2),o=h[0],c=h[1];o in r&&(r[o]=c)}if(!this._recordCanvas||Ts(this._canvasFps)||Ts(this._canvasQuality)||(r.recordCanvas=!0,r.sampling={canvas:this._canvasFps},r.dataURLOptions={type:"image/webp",quality:this._canvasQuality}),this.rrwebRecord){this.mutationRateLimiter=(e=this.mutationRateLimiter)!==null&&e!==void 0?e:new FE(this.rrwebRecord,{onBlockedNode:function(l,p){var v="Too many mutations on node '".concat(l,"'. Rate limiting. This could be due to SVG animations or something similar");Te.info(v,{node:p}),i.log("[PostHog Recorder] "+v,"warn")}}),this._scheduleFullSnapshot();var g=this._gatherRRWebPlugins();this.stopRrweb=this.rrwebRecord(ti({emit:function(l){i.onRRwebEmit(l)},plugins:g},r)),this.instance._addCaptureHook(function(l){try{if(l==="$pageview"){var p=oe?i._maskUrl(oe.location.href):"";if(!p)return;i._tryAddCustomEvent("$pageview",{href:p})}}catch(v){Te.error("Could not add $pageview to rrweb session",v)}}),this._lastActivityTimestamp=Date.now(),this.isIdle=!1,this._tryAddCustomEvent("$session_options",{sessionRecordingOptions:r,activePlugins:g.map(function(l){return l?.name})})}else Te.error("onScriptLoaded was called but rrwebRecord is not available. This indicates something has gone wrong.")}},{key:"_scheduleFullSnapshot",value:function(){var e=this;this._fullSnapshotTimer&&clearInterval(this._fullSnapshotTimer),this._fullSnapshotTimer=setInterval(function(){e._tryTakeFullSnapshot()},Xb)}},{key:"_gatherRRWebPlugins",value:function(){var e=[];return Ms.rrwebConsoleRecord&&this.isConsoleLogCaptureEnabled&&e.push(Ms.rrwebConsoleRecord.getRecordConsolePlugin()),this.networkPayloadCapture&&Vn(Ms.getRecordNetworkPlugin)&&(!TE.includes(location.hostname)||this._forceAllowLocalhostNetworkCapture?e.push(Ms.getRecordNetworkPlugin(OE(this.instance.config,this.networkPayloadCapture))):Te.info("[SessionReplay-NetworkCapture] not started because we are on localhost.")),e}},{key:"onRRwebEmit",value:function(e){if(this._processQueuedEvents(),e&&So(e)){if(e.type===Um.Meta){var i=this._maskUrl(e.data.href);if(!i)return;e.data.href=i}e.type===Um.FullSnapshot&&this._scheduleFullSnapshot();var r=this.mutationRateLimiter?this.mutationRateLimiter.throttleMutations(e):e;if(r){var s=function(h){var o=h;if(o&&So(o)&&o.type===6&&So(o.data)&&o.data.plugin==="rrweb/console@1"){o.data.payload.payload.length>10&&(o.data.payload.payload=o.data.payload.payload.slice(0,10),o.data.payload.payload.push("...[truncated]"));for(var c=[],g=0;g<o.data.payload.payload.length;g++)o.data.payload.payload[g]&&o.data.payload.payload[g].length>2e3?c.push(o.data.payload.payload[g].slice(0,2e3)+"...[truncated]"):c.push(o.data.payload.payload[g]);return o.data.payload.payload=c,h}return h}(r),n=JSON.stringify(s).length;if(this._updateWindowAndSessionIds(s),!this.isIdle){var a={$snapshot_bytes:n,$snapshot_data:s,$session_id:this.sessionId,$window_id:this.windowId};this.status!=="disabled"?this._captureSnapshotBuffered(a):this.clearBuffer()}}}}},{key:"_processQueuedEvents",value:function(){var e=this;if(this.queuedRRWebEvents.length){var i=Zf(this.queuedRRWebEvents);this.queuedRRWebEvents=[],i.forEach(function(r){Date.now()-r.enqueuedAt>2e3?e._tryAddCustomEvent("rrwebQueueTimeout",{enqueuedAt:r.enqueuedAt,attempt:r.attempt,queueLength:i.length}):e._tryRRWebMethod(r)&&e._tryAddCustomEvent("rrwebQueueSuccess",{enqueuedAt:r.enqueuedAt,attempt:r.attempt,queueLength:i.length})})}}},{key:"_maskUrl",value:function(e){var i=this.instance.config.session_recording;if(i.maskNetworkRequestFn){var r,s={url:e};return(r=s=i.maskNetworkRequestFn(s))===null||r===void 0?void 0:r.url}return e}},{key:"clearBuffer",value:function(){return this.buffer=void 0,{size:0,data:[],sessionId:this.sessionId,windowId:this.windowId}}},{key:"_flushBuffer",value:function(){var e=this;this.flushBufferTimer&&(clearTimeout(this.flushBufferTimer),this.flushBufferTimer=void 0);var i=this._minimumDuration,r=this.sessionDuration,s=ba(r)&&r>=0,n=ba(i)&&s&&r<i;return this.status==="buffering"||n?(this.flushBufferTimer=setTimeout(function(){e._flushBuffer()},2e3),this.buffer||this.clearBuffer()):this.buffer&&this.buffer.data.length!==0?(this._captureSnapshot({$snapshot_bytes:this.buffer.size,$snapshot_data:this.buffer.data,$session_id:this.buffer.sessionId,$window_id:this.buffer.windowId}),this.clearBuffer()):this.buffer||this.clearBuffer()}},{key:"_captureSnapshotBuffered",value:function(e){var i,r=this,s=2+(((i=this.buffer)===null||i===void 0?void 0:i.data.length)||0);(!this.buffer||this.buffer.size+e.$snapshot_bytes+s>943718.4||this.buffer.sessionId&&this.buffer.sessionId!==this.sessionId)&&(this.buffer=this._flushBuffer()),Ts(this.buffer.sessionId)&&!Ts(this.sessionId)&&(this.buffer.sessionId=this.sessionId,this.buffer.windowId=this.windowId),this.buffer.size+=e.$snapshot_bytes,this.buffer.data.push(e.$snapshot_data),this.flushBufferTimer||(this.flushBufferTimer=setTimeout(function(){r._flushBuffer()},2e3))}},{key:"_captureSnapshot",value:function(e){this.instance.capture("$snapshot",e,{method:"POST",endpoint:this._endpoint,_noTruncate:!0,_batchKey:"recordings",_metrics:{rrweb_full_snapshot:e.$snapshot_data.type===Pb}})}}]),t}(),HE=function(){function t(e){Mr(this,t),this.instance=e,this.instance.decideEndpointWasHit=this.instance._hasBootstrappedFeatureFlags()}return Dr(t,[{key:"call",value:function(){var e=this,i=i0(JSON.stringify({token:this.instance.config.token,distinct_id:this.instance.get_distinct_id(),groups:this.instance.getGroups(),person_properties:this.instance.get_property(hl),group_properties:this.instance.get_property(_o),disable_flags:this.instance.config.advanced_disable_feature_flags||this.instance.config.advanced_disable_feature_flags_on_first_load||void 0}));this.instance._send_request("".concat(this.instance.config.api_host,"/decide/?v=3"),{data:i,verbose:!0},{method:"POST"},function(r){return e.parseDecideResponse(r)})}},{key:"parseDecideResponse",value:function(e){var i,r=this;if(this.instance.featureFlags.setReloadingPaused(!1),this.instance.featureFlags._startReloadTimer(),e?.status!==0){if(!Ue||!Ue.body)return Te.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout(function(){r.parseDecideResponse(e)},500);this.instance.toolbar.afterDecideResponse(e),(i=this.instance.sessionRecording)===null||i===void 0||i.afterDecideResponse(e),xo.afterDecideResponse(e,this.instance),this.instance._afterDecideResponse(e),this.instance.config.advanced_disable_feature_flags_on_first_load||this.instance.config.advanced_disable_feature_flags||this.instance.featureFlags.receivedFeatureFlags(e);var s=oe?.extendPostHogWithSurveys;e.surveys&&!s&&Mp(this.instance.config.api_host+"/static/surveys.js",function(g){if(g)return Te.error("Could not load surveys script",g);oe.extendPostHogWithSurveys(r.instance)});var n=oe?.extendPostHogWithExceptionAutoCapture;if(e.autocaptureExceptions&&e.autocaptureExceptions&&Si(n)&&Mp(this.instance.config.api_host+"/static/exception-autocapture.js",function(g){if(g)return Te.error("Could not load exception autocapture script",g);oe.extendPostHogWithExceptionAutocapture(r.instance,e)}),e.siteApps)if(this.instance.config.opt_in_site_apps){var a,h=this.instance.config.api_host,o=wo(e.siteApps);try{var c=function(){var g=a.value,l=g.id,p=g.url,v=[h,h[h.length-1]==="/"&&p[0]==="/"?p.substring(1):p].join("");Ms["__$$ph_site_app_".concat(l)]=r.instance,Mp(v,function(u){u&&Te.error("Error while initializing PostHog app with config id ".concat(l),u)})};for(o.s();!(a=o.n()).done;)c()}catch(g){o.e(g)}finally{o.f()}}else e.siteApps.length>0&&Te.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}else Te.error("Failed to fetch feature flags from PostHog.")}}]),t}(),WE=["https://app.posthog.com","https://eu.posthog.com"],UE=["source"],ZE=oe!=null&&oe.location?tu(oe.location.hash,"__posthog")||tu(location.hash,"state"):null,YE=function(){function t(e){Mr(this,t),this.instance=e}return Dr(t,[{key:"afterDecideResponse",value:function(e){var i=e.toolbarParams||e.editorParams||(e.toolbarVersion?{toolbarVersion:e.toolbarVersion}:{});e.isAuthenticated&&i.toolbarVersion&&i.toolbarVersion.indexOf("toolbar")===0&&this.loadToolbar(ti({},i))}},{key:"maybeLoadToolbar",value:function(){var e,i,r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:void 0,s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:void 0,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:void 0;if(!oe||!Ue)return!1;r=(e=r)!==null&&e!==void 0?e:oe.location,n=(i=n)!==null&&i!==void 0?i:oe.history;try{if(!s){try{oe.localStorage.setItem("test","test"),oe.localStorage.removeItem("test")}catch{return!1}s=oe?.localStorage}var a,h=ZE||tu(r.hash,"__posthog")||tu(r.hash,"state"),o=h?lb(function(){return JSON.parse(atob(decodeURIComponent(h)))})||lb(function(){return JSON.parse(decodeURIComponent(h))}):null;return o&&o.action==="ph_authorize"?((a=o).source="url",a&&Object.keys(a).length>0&&(o.desiredHash?r.hash=o.desiredHash:n?n.replaceState("",Ue.title,r.pathname+r.search):r.hash="")):((a=JSON.parse(s.getItem("_postHogToolbarParams")||"{}")).source="localstorage",delete a.userIntent),!(!a.token||this.instance.config.token!==a.token)&&(this.loadToolbar(a),!0)}catch{return!1}}},{key:"loadToolbar",value:function(e){var i=this;if(!oe||Ms._postHogToolbarLoaded)return!1;Ms._postHogToolbarLoaded=!0;var r=this.instance.config.api_host,s=3e5,n=Math.floor(Date.now()/s)*s,a="".concat(r).concat(r.endsWith("/")?"":"/","static/toolbar.js?t=").concat(n),h=!WE.includes(this.instance.config.api_host)&&this.instance.config.advanced_disable_toolbar_metrics,o=ti(ti({token:this.instance.config.token},e),{},{apiURL:r},h?{instrument:!1}:{});o.source;var c=lE(o,UE);return oe.localStorage.setItem("_postHogToolbarParams",JSON.stringify(c)),Mp(a,function(g){g?Te.error("Failed to load toolbar",g):(Ms.ph_load_toolbar||Ms.ph_load_editor)(o,i.instance)}),Tp(oe,"turbolinks:load",function(){Ms._postHogToolbarLoaded=!1,i.loadToolbar(o)}),!0}},{key:"_loadEditor",value:function(e){return this.loadToolbar(e)}},{key:"maybeLoadEditor",value:function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:void 0,i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:void 0,r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:void 0;return this.maybeLoadToolbar(e,i,r)}}]),t}(),Kb=function(){function t(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:3e3;Mr(this,t),this.isPolling=!0,this._event_queue=[],this._empty_queue_count=0,this._poller=void 0,this._pollInterval=e}return Dr(t,[{key:"setPollInterval",value:function(e){this._pollInterval=e,this.isPolling&&this.poll()}},{key:"poll",value:function(){}},{key:"unload",value:function(){}},{key:"getTime",value:function(){return new Date().getTime()}}]),t}(),JE=function(t){Rb(i,Kb);var e=Vb(i);function i(r){var s,n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:3e3;return Mr(this,i),(s=e.call(this,n)).handlePollRequest=r,s}return Dr(i,[{key:"enqueue",value:function(r,s,n){this._event_queue.push({url:r,data:s,options:n}),this.isPolling||(this.isPolling=!0,this.poll())}},{key:"poll",value:function(){var r=this;clearTimeout(this._poller),this._poller=setTimeout(function(){if(r._event_queue.length>0){var s=r.formatQueue(),n=function(h){var o=s[h],c=o.url,g=o.data,l=o.options;tr(g,function(p,v){g[v].offset=Math.abs(g[v].timestamp-r.getTime()),delete g[v].timestamp}),r.handlePollRequest(c,g,l)};for(var a in s)n(a);r._event_queue.length=0,r._empty_queue_count=0}else r._empty_queue_count++;r._empty_queue_count>4&&(r.isPolling=!1,r._empty_queue_count=0),r.isPolling&&r.poll()},this._pollInterval)}},{key:"unload",value:function(){var r=this;clearTimeout(this._poller);var s=this._event_queue.length>0?this.formatQueue():{};this._event_queue.length=0;var n=Object.values(s);[].concat(Zf(n.filter(function(a){return a.url.indexOf("/e")===0})),Zf(n.filter(function(a){return a.url.indexOf("/e")!==0}))).map(function(a){var h=a.url,o=a.data,c=a.options;r.handlePollRequest(h,o,ti(ti({},c),{},{transport:"sendBeacon"}))})}},{key:"formatQueue",value:function(){var r={};return tr(this._event_queue,function(s){var n=s.url,a=s.data,h=s.options,o=(h?h._batchKey:null)||n;Si(r[o])&&(r[o]={data:[],url:n,options:h}),h&&r[o].options&&r[o].options._metrics&&!r[o].options._metrics.rrweb_full_snapshot&&(r[o].options._metrics.rrweb_full_snapshot=h._metrics.rrweb_full_snapshot),r[o].data.push(a)}),r}}]),i}(),vn=Uint8Array,zs=Uint16Array,pl=Uint32Array,a0=new vn([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]),o0=new vn([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]),Eb=new vn([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Qb=function(t,e){for(var i=new zs(31),r=0;r<31;++r)i[r]=e+=1<<t[r-1];var s=new pl(i[30]);for(r=1;r<30;++r)for(var n=i[r];n<i[r+1];++n)s[n]=n-i[r]<<5|r;return[i,s]},t_=Qb(a0,2),XE=t_[0],Ym=t_[1];XE[28]=258,Ym[258]=28;for(Jm=Qb(o0,0)[1],eu=new zs(32768),nr=0;nr<32768;++nr)yo=(43690&nr)>>>1|(21845&nr)<<1,yo=(61680&(yo=(52428&yo)>>>2|(13107&yo)<<2))>>>4|(3855&yo)<<4,eu[nr]=((65280&yo)>>>8|(255&yo)<<8)>>>1;var yo,Jm,eu,nr,Dp=function(t,e,i){for(var r=t.length,s=0,n=new zs(e);s<r;++s)++n[t[s]-1];var a,h=new zs(e);for(s=0;s<e;++s)h[s]=h[s-1]+n[s-1]<<1;if(i){a=new zs(1<<e);var o=15-e;for(s=0;s<r;++s)if(t[s])for(var c=s<<4|t[s],g=e-t[s],l=h[t[s]-1]++<<g,p=l|(1<<g)-1;l<=p;++l)a[eu[l]>>>o]=c}else for(a=new zs(r),s=0;s<r;++s)a[s]=eu[h[t[s]-1]++]>>>15-t[s];return a},vh=new vn(288);for(nr=0;nr<144;++nr)vh[nr]=8;for(nr=144;nr<256;++nr)vh[nr]=9;for(nr=256;nr<280;++nr)vh[nr]=7;for(nr=280;nr<288;++nr)vh[nr]=8;var iu=new vn(32);for(nr=0;nr<32;++nr)iu[nr]=5;var dh,KE=Dp(vh,9,0),QE=Dp(iu,5,0),e_=function(t){return(t/8>>0)+(7&t&&1)},i_=function(t,e,i){(e==null||e<0)&&(e=0),(i==null||i>t.length)&&(i=t.length);var r=new(t instanceof zs?zs:t instanceof pl?pl:vn)(i-e);return r.set(t.subarray(e,i)),r},$a=function(t,e,i){i<<=7&e;var r=e/8>>0;t[r]|=i,t[r+1]|=i>>>8},kp=function(t,e,i){i<<=7&e;var r=e/8>>0;t[r]|=i,t[r+1]|=i>>>8,t[r+2]|=i>>>16},Lm=function(t,e){for(var i=[],r=0;r<t.length;++r)t[r]&&i.push({s:r,f:t[r]});var s=i.length,n=i.slice();if(!s)return[new vn(0),0];if(s==1){var a=new vn(i[0].s+1);return a[i[0].s]=1,[a,1]}i.sort(function(E,I){return E.f-I.f}),i.push({s:-1,f:25001});var h=i[0],o=i[1],c=0,g=1,l=2;for(i[0]={s:-1,f:h.f+o.f,l:h,r:o};g!=s-1;)h=i[i[c].f<i[l].f?c++:l++],o=i[c!=g&&i[c].f<i[l].f?c++:l++],i[g++]={s:-1,f:h.f+o.f,l:h,r:o};var p=n[0].s;for(r=1;r<s;++r)n[r].s>p&&(p=n[r].s);var v=new zs(p+1),u=t2(i[g-1],v,0);if(u>e){r=0;var m=0,k=u-e,y=1<<k;for(n.sort(function(E,I){return v[I.s]-v[E.s]||E.f-I.f});r<s;++r){var d=n[r].s;if(!(v[d]>e))break;m+=y-(1<<u-v[d]),v[d]=e}for(m>>>=k;m>0;){var b=n[r].s;v[b]<e?m-=1<<e-v[b]++-1:++r}for(;r>=0&&m;--r){var S=n[r].s;v[S]==e&&(--v[S],++m)}u=e}return[new vn(v),u]},t2=function t(e,i,r){return e.s==-1?Math.max(t(e.l,i,r+1),t(e.r,i,r+1)):i[e.s]=r},Tb=function(t){for(var e=t.length;e&&!t[--e];);for(var i=new zs(++e),r=0,s=t[0],n=1,a=function(o){i[r++]=o},h=1;h<=e;++h)if(t[h]==s&&h!=e)++n;else{if(!s&&n>2){for(;n>138;n-=138)a(32754);n>2&&(a(n>10?n-11<<5|28690:n-3<<5|12305),n=0)}else if(n>3){for(a(s),--n;n>6;n-=6)a(8304);n>2&&(a(n-3<<5|8208),n=0)}for(;n--;)a(s);n=1,s=t[h]}return[i.subarray(0,r),e]},Cp=function(t,e){for(var i=0,r=0;r<e.length;++r)i+=t[r]*e[r];return i},Wf=function(t,e,i){var r=i.length,s=e_(e+2);t[s]=255&r,t[s+1]=r>>>8,t[s+2]=255^t[s],t[s+3]=255^t[s+1];for(var n=0;n<r;++n)t[s+n+4]=i[n];return 8*(s+4+r)},Mb=function(t,e,i,r,s,n,a,h,o,c,g){$a(e,g++,i),++s[256];for(var l=Lm(s,15),p=l[0],v=l[1],u=Lm(n,15),m=u[0],k=u[1],y=Tb(p),d=y[0],b=y[1],S=Tb(m),E=S[0],I=S[1],B=new zs(19),G=0;G<d.length;++G)B[31&d[G]]++;for(G=0;G<E.length;++G)B[31&E[G]]++;for(var it=Lm(B,7),lt=it[0],ft=it[1],ct=19;ct>4&&!lt[Eb[ct-1]];--ct);var St,K,bt,D,O=c+5<<3,w=Cp(s,vh)+Cp(n,iu)+a,L=Cp(s,p)+Cp(n,m)+a+14+3*ct+Cp(B,lt)+(2*B[16]+3*B[17]+7*B[18]);if(O<=w&&O<=L)return Wf(e,g,t.subarray(o,o+c));if($a(e,g,1+(L<w)),g+=2,L<w){St=Dp(p,v,0),K=p,bt=Dp(m,k,0),D=m;var X=Dp(lt,ft,0);for($a(e,g,b-257),$a(e,g+5,I-1),$a(e,g+10,ct-4),g+=14,G=0;G<ct;++G)$a(e,g+3*G,lt[Eb[G]]);g+=3*ct;for(var U=[d,E],zt=0;zt<2;++zt){var Dt=U[zt];for(G=0;G<Dt.length;++G){var Nt=31&Dt[G];$a(e,g,X[Nt]),g+=lt[Nt],Nt>15&&($a(e,g,Dt[G]>>>5&127),g+=Dt[G]>>>12)}}}else St=KE,K=vh,bt=QE,D=iu;for(G=0;G<h;++G)if(r[G]>255){Nt=r[G]>>>18&31,kp(e,g,St[Nt+257]),g+=K[Nt+257],Nt>7&&($a(e,g,r[G]>>>23&31),g+=a0[Nt]);var Ot=31&r[G];kp(e,g,bt[Ot]),g+=D[Ot],Ot>3&&(kp(e,g,r[G]>>>5&8191),g+=o0[Ot])}else kp(e,g,St[r[G]]),g+=K[r[G]];return kp(e,g,St[256]),g+K[256]},e2=new pl([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),i2=new vn(0),r2=function(){for(var t=new pl(256),e=0;e<256;++e){for(var i=e,r=9;--r;)i=(1&i&&3988292384)^i>>>1;t[e]=i}return t}(),s2=function(){var t=4294967295;return{p:function(e){for(var i=t,r=0;r<e.length;++r)i=r2[255&i^e[r]]^i>>>8;t=i},d:function(){return 4294967295^t}}},n2=function(t,e,i,r,s){return function(n,a,h,o,c,g){var l=n.length,p=new vn(o+l+5*(1+Math.floor(l/7e3))+c),v=p.subarray(o,p.length-c),u=0;if(!a||l<8)for(var m=0;m<=l;m+=65535){var k=m+65535;k<l?u=Wf(v,u,n.subarray(m,k)):(v[m]=g,u=Wf(v,u,n.subarray(m,l)))}else{for(var y=e2[a-1],d=y>>>13,b=8191&y,S=(1<<h)-1,E=new zs(32768),I=new zs(S+1),B=Math.ceil(h/3),G=2*B,it=function(Ze){return(n[Ze]^n[Ze+1]<<B^n[Ze+2]<<G)&S},lt=new pl(25e3),ft=new zs(288),ct=new zs(32),St=0,K=0,bt=(m=0,0),D=0,O=0;m<l;++m){var w=it(m),L=32767&m,X=I[w];if(E[L]=X,I[w]=L,D<=m){var U=l-m;if((St>7e3||bt>24576)&&U>423){u=Mb(n,v,0,lt,ft,ct,K,bt,O,m-O,u),bt=St=K=0,O=m;for(var zt=0;zt<286;++zt)ft[zt]=0;for(zt=0;zt<30;++zt)ct[zt]=0}var Dt=2,Nt=0,Ot=b,Qt=L-X&32767;if(U>2&&w==it(m-Qt))for(var ne=Math.min(d,U)-1,pe=Math.min(32767,m),be=Math.min(258,U);Qt<=pe&&--Ot&&L!=X;){if(n[m+Dt]==n[m+Dt-Qt]){for(var de=0;de<be&&n[m+de]==n[m+de-Qt];++de);if(de>Dt){if(Dt=de,Nt=Qt,de>ne)break;var Zt=Math.min(Qt,de-2),ue=0;for(zt=0;zt<Zt;++zt){var Wt=m-Qt+zt+32768&32767,Bt=Wt-E[Wt]+32768&32767;Bt>ue&&(ue=Bt,X=Wt)}}}Qt+=(L=X)-(X=E[L])+32768&32767}if(Nt){lt[bt++]=268435456|Ym[Dt]<<18|Jm[Nt];var Ge=31&Ym[Dt],si=31&Jm[Nt];K+=a0[Ge]+o0[si],++ft[257+Ge],++ct[si],D=m+Dt,++St}else lt[bt++]=n[m],++ft[n[m]]}}u=Mb(n,v,g,lt,ft,ct,K,bt,O,m-O,u),g||(u=Wf(v,u,i2))}return i_(p,0,o+e_(u)+c)}(t,e.level==null?6:e.level,e.mem==null?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(t.length)))):12+e.mem,i,r,!s)},Xm=function(t,e,i){for(;i;++e)t[e]=i,i>>>=8},a2=function(t,e){var i=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&&Xm(t,4,Math.floor(new Date(e.mtime||Date.now())/1e3)),i){t[3]=8;for(var r=0;r<=i.length;++r)t[r+10]=i.charCodeAt(r)}},o2=function(t){return 10+(t.filename&&t.filename.length+1||0)};function h2(t,e){e===void 0&&(e={});var i=s2(),r=t.length;i.p(t);var s=n2(t,e,o2(e),8),n=s.length;return a2(s,e),Xm(s,n-8,i.d()),Xm(s,n-4,r),s}function l2(t,e){var i=t.length;if(!e&&typeof TextEncoder<"u")return new TextEncoder().encode(t);for(var r=new vn(t.length+(t.length>>>1)),s=0,n=function(c){r[s++]=c},a=0;a<i;++a){if(s+5>r.length){var h=new vn(s+8+(i-a<<1));h.set(r),r=h}var o=t.charCodeAt(a);o<128||e?n(o):o<2048?(n(192|o>>>6),n(128|63&o)):o>55295&&o<57344?(n(240|(o=65536+(1047552&o)|1023&t.charCodeAt(++a))>>>18),n(128|o>>>12&63),n(128|o>>>6&63),n(128|63&o)):(n(224|o>>>12),n(128|o>>>6&63),n(128|63&o))}return i_(r,0,s)}(function(t){t.GZipJS="gzip-js",t.Base64="base64"})(dh||(dh={}));var h0=function(t,e,i){var r=e||{};r.ip=i.ip?1:0,r._=new Date().getTime().toString(),r.ver=yh.LIB_VERSION;var s=t.split("?");if(s.length>1){var n,a=wo(s[1].split("&"));try{for(a.s();!(n=a.n()).done;){var h=n.value.split("=")[0];Si(r[h])||delete r[h]}}catch(c){a.e(c)}finally{a.f()}}var o=t.indexOf("?")>-1?"&":"?";return t+o+function(c){var g,l,p=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"&",v=[];return tr(c,function(u,m){Si(u)||Si(m)||m==="undefined"||(g=encodeURIComponent(u.toString()),l=encodeURIComponent(m),v[v.length]=l+"="+g)}),v.join(p)}(r)},ru=function t(e,i){if(i.blob&&e.buffer)return new Blob([ib(e)?e:e.buffer],{type:"text/plain"});if(i.sendBeacon||i.blob){var r=t(e,{method:"POST"});return new Blob([r],{type:"application/x-www-form-urlencoded"})}return i.method!=="POST"?null:(s=Hr(e)||ib(e)?"data="+encodeURIComponent(e):"data="+encodeURIComponent(e.data),"compression"in e&&e.compression&&(s+="&compression="+e.compression),s);var s},r_=function(t){if(zm&&t.options.transport==="fetch"){var e,i=ru(t.data,t.options),r=new Headers;tr(r,function(n,a){r.append(a,n)}),t.options.method!=="POST"||t.options.blob||r.append("Content-Type","application/x-www-form-urlencoded");var s=t.url;return ba(t.retriesPerformedSoFar)&&t.retriesPerformedSoFar>0&&(s=h0(s,{retry_count:t.retriesPerformedSoFar},{})),void zm(s,{method:((e=t.options)===null||e===void 0?void 0:e.method)||"GET",headers:r,keepalive:t.options.method==="POST",body:i}).then(function(n){var a=n.status;return n.text().then(function(h){var o,c;if((o=t.onResponse)===null||o===void 0||o.call(t,{statusCode:a,responseText:h}),a!==200)Vn(t.onError)&&t.onError({statusCode:a,responseText:h}),(a<400||a>500)&&t.retryQueue.enqueue(ti(ti({},t),{},{headers:r,retriesPerformedSoFar:(t.retriesPerformedSoFar||0)+1})),(c=t.callback)===null||c===void 0||c.call(t,{status:0});else try{var g;(g=t.callback)===null||g===void 0||g.call(t,JSON.parse(h))}catch(l){Te.error(l)}})}).catch(function(n){var a;Te.error(n),(a=t.callback)===null||a===void 0||a.call(t,{status:0})})}return p2(t)},p2=function(t){var e=t.url,i=t.data,r=t.headers,s=t.options,n=t.callback,a=t.retriesPerformedSoFar,h=t.retryQueue,o=t.onError,c=t.timeout,g=c===void 0?6e4:c,l=t.onResponse;ba(a)&&a>0&&(e=h0(e,{retry_count:a},{}));var p=new XMLHttpRequest;p.open(s.method||"GET",e,!0);var v=ru(i,s);tr(r,function(u,m){p.setRequestHeader(m,u)}),s.method!=="POST"||s.blob||p.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),p.timeout=g,p.withCredentials=!0,p.onreadystatechange=function(){if(p.readyState===4){var u={statusCode:p.status,responseText:p.responseText};if(l?.(u),p.status===200){if(n){var m;try{m=JSON.parse(p.responseText)}catch(k){return void Te.error(k)}n(m)}}else Vn(o)&&o(u),(p.status<400||p.status>500)&&h.enqueue({url:e,data:i,options:s,headers:r,retriesPerformedSoFar:(a||0)+1,callback:n}),n?.({status:0})}},p.send(v)},c2=function(t){Rb(i,Kb);var e=Vb(i);function i(r,s){var n;return Mr(this,i),(n=e.call(this)).isPolling=!1,n.queue=[],n.areWeOnline=!0,n.onRequestError=r,n.rateLimiter=s,!Si(oe)&&"onLine"in oe.navigator&&(n.areWeOnline=oe.navigator.onLine,oe.addEventListener("online",function(){n._handleWeAreNowOnline()}),oe.addEventListener("offline",function(){n.areWeOnline=!1})),n}return Dr(i,[{key:"enqueue",value:function(r){var s=r.retriesPerformedSoFar||0;if(!(s>=10)){var n=function(o){var c=3e3*Math.pow(2,o),g=c/2,l=Math.min(18e5,c),p=(Math.random()-.5)*(l-g);return Math.ceil(l+p)}(s),a=new Date(Date.now()+n);this.queue.push({retryAt:a,requestData:r});var h="Enqueued failed request for retry in ".concat(n);navigator.onLine||(h+=" (Browser is offline)"),Te.warn(h),this.isPolling||(this.isPolling=!0,this.poll())}}},{key:"poll",value:function(){var r=this;this._poller&&clearTimeout(this._poller),this._poller=setTimeout(function(){r.areWeOnline&&r.queue.length>0&&r.flush(),r.poll()},this._pollInterval)}},{key:"flush",value:function(){var r=new Date(Date.now()),s=this.queue.filter(function(o){return o.retryAt<r});if(s.length>0){this.queue=this.queue.filter(function(o){return o.retryAt>=r});var n,a=wo(s);try{for(a.s();!(n=a.n()).done;){var h=n.value.requestData;this._executeXhrRequest(h)}}catch(o){a.e(o)}finally{a.f()}}}},{key:"unload",value:function(){this._poller&&(clearTimeout(this._poller),this._poller=void 0);var r,s=wo(this.queue);try{for(s.s();!(r=s.n()).done;){var n=r.value.requestData,a=n.url,h=n.data,o=n.options;if(this.rateLimiter.isRateLimited(o._batchKey))Te.warn("[RetryQueue] is quota limited. Dropping request.");else try{oe?.navigator.sendBeacon(a,ru(h,ti(ti({},o),{},{sendBeacon:!0})))}catch(c){Te.error(c)}}}catch(c){s.e(c)}finally{s.f()}this.queue=[]}},{key:"_executeXhrRequest",value:function(r){var s=r.url,n=r.data,a=r.options,h=r.headers,o=r.callback,c=r.retriesPerformedSoFar;this.rateLimiter.isRateLimited(a._batchKey)||r_({url:s,data:n||{},options:a||{},headers:h||{},retriesPerformedSoFar:c||0,callback:o,retryQueue:this,onError:this.onRequestError,onResponse:this.rateLimiter.checkForLimiting})}},{key:"_handleWeAreNowOnline",value:function(){this.areWeOnline=!0,this.flush()}}]),i}(),Bf=1800,f2=function(){function t(e,i,r,s){Mr(this,t),Be(this,"_sessionIdChangedHandlers",[]),this.config=e,this.persistence=i,this._windowId=void 0,this._sessionId=void 0,this._sessionStartTimestamp=null,this._sessionActivityTimestamp=null,this._sessionIdGenerator=r||mh,this._windowIdGenerator=s||mh;var n=e.persistence_name||e.token,a=e.session_idle_timeout_seconds||Bf;if(ba(a)?a>Bf?Te.warn("session_idle_timeout_seconds cannot be greater than 30 minutes. Using 30 minutes instead."):a<60&&Te.warn("session_idle_timeout_seconds cannot be less than 60 seconds. Using 60 seconds instead."):(Te.warn("session_idle_timeout_seconds must be a number. Defaulting to 30 minutes."),a=Bf),this._sessionTimeoutMs=1e3*Math.min(Math.max(a,60),Bf),this._window_id_storage_key="ph_"+n+"_window_id",this._primary_window_exists_storage_key="ph_"+n+"_primary_window_exists",this._canUseSessionStorage()){var h=ys.parse(this._window_id_storage_key),o=ys.parse(this._primary_window_exists_storage_key);h&&!o?this._windowId=h:ys.remove(this._window_id_storage_key),ys.set(this._primary_window_exists_storage_key,!0)}this._listenToReloadWindow()}return Dr(t,[{key:"onSessionId",value:function(e){var i=this;return Si(this._sessionIdChangedHandlers)&&(this._sessionIdChangedHandlers=[]),this._sessionIdChangedHandlers.push(e),this._sessionId&&e(this._sessionId,this._windowId),function(){i._sessionIdChangedHandlers=i._sessionIdChangedHandlers.filter(function(r){return r!==e})}}},{key:"_canUseSessionStorage",value:function(){return this.config.persistence!=="memory"&&!this.persistence.disabled&&ys.is_supported()}},{key:"_setWindowId",value:function(e){e!==this._windowId&&(this._windowId=e,this._canUseSessionStorage()&&ys.set(this._window_id_storage_key,e))}},{key:"_getWindowId",value:function(){return this._windowId?this._windowId:this._canUseSessionStorage()?ys.parse(this._window_id_storage_key):null}},{key:"_setSessionId",value:function(e,i,r){e===this._sessionId&&i===this._sessionActivityTimestamp&&r===this._sessionStartTimestamp||(this._sessionStartTimestamp=r,this._sessionActivityTimestamp=i,this._sessionId=e,this.persistence.register(Be({},Kf,[i,e,r])))}},{key:"_getSessionId",value:function(){if(this._sessionId&&this._sessionActivityTimestamp&&this._sessionStartTimestamp)return[this._sessionActivityTimestamp,this._sessionId,this._sessionStartTimestamp];var e=this.persistence.props[Kf];return Hr(e)&&e.length===2&&e.push(e[0]),e||[0,null,0]}},{key:"resetSessionId",value:function(){this._setSessionId(null,null,null)}},{key:"_listenToReloadWindow",value:function(){var e=this;oe?.addEventListener("beforeunload",function(){e._canUseSessionStorage()&&ys.remove(e._primary_window_exists_storage_key)})}},{key:"checkAndGetSessionAndWindowId",value:function(){var e=arguments.length>0&&arguments[0]!==void 0&&arguments[0],i=(arguments.length>1&&arguments[1]!==void 0?arguments[1]:null)||new Date().getTime(),r=ea(this._getSessionId(),3),s=r[0],n=r[1],a=r[2],h=this._getWindowId(),o=a&&a>0&&Math.abs(i-a)>864e5,c=!1,g=!n,l=!e&&Math.abs(i-s)>this._sessionTimeoutMs;g||l||o?(n=this._sessionIdGenerator(),h=this._windowIdGenerator(),Te.info("[SessionId] new session ID generated",{sessionId:n,windowId:h,changeReason:{noSessionId:g,activityTimeout:l,sessionPastMaximumLength:o}}),a=i,c=!0):h||(h=this._windowIdGenerator(),c=!0);var p=s===0||!e||o?i:s,v=a===0?new Date().getTime():a;return this._setWindowId(h),this._setSessionId(n,p,v),c&&this._sessionIdChangedHandlers.forEach(function(u){return u(n,h)}),{sessionId:n,windowId:h,sessionStartTimestamp:v}}}]),t}(),u2=Dr(function t(e,i,r,s){Mr(this,t),this.name="posthog-js",this.setupOnce=function(n){n(function(a){var h,o,c,g,l;if(a.level!=="error"||!e.__loaded)return a;a.tags||(a.tags={});var p=e.config.ui_host||e.config.api_host;a.tags["PostHog Person URL"]=p+"/person/"+e.get_distinct_id(),e.sessionRecordingStarted()&&(a.tags["PostHog Recording URL"]=e.get_session_replay_url({withTimestamp:!0}));var v=((h=a.exception)===null||h===void 0?void 0:h.values)||[],u={$exception_message:(o=v[0])===null||o===void 0?void 0:o.value,$exception_type:(c=v[0])===null||c===void 0?void 0:c.type,$exception_personURL:p+"/person/"+e.get_distinct_id(),$sentry_event_id:a.event_id,$sentry_exception:a.exception,$sentry_exception_message:(g=v[0])===null||g===void 0?void 0:g.value,$sentry_exception_type:(l=v[0])===null||l===void 0?void 0:l.type,$sentry_tags:a.tags};return i&&r&&(u.$sentry_url=(s||"https://sentry.io/organizations/")+i+"/issues/?project="+r+"&query="+a.event_id),e.capture("$exception",u),a})}}),d2=function(){function t(e){var i=this;Mr(this,t),Be(this,"_hasSeenPageView",!1),Be(this,"_updateScrollData",function(){var r,s,n,a;i._pageViewData||(i._pageViewData=i._createPageViewData());var h=i._pageViewData,o=i._scrollY(),c=i._scrollHeight(),g=i._contentY(),l=i._contentHeight();h.lastScrollY=o,h.maxScrollY=Math.max(o,(r=h.maxScrollY)!==null&&r!==void 0?r:0),h.maxScrollHeight=Math.max(c,(s=h.maxScrollHeight)!==null&&s!==void 0?s:0),h.lastContentY=g,h.maxContentY=Math.max(g,(n=h.maxContentY)!==null&&n!==void 0?n:0),h.maxContentHeight=Math.max(l,(a=h.maxContentHeight)!==null&&a!==void 0?a:0)}),this._instance=e}return Dr(t,[{key:"_createPageViewData",value:function(){var e;return{pathname:(e=oe?.location.pathname)!==null&&e!==void 0?e:""}}},{key:"doPageView",value:function(){var e,i;return this._hasSeenPageView?(i=this._pageViewData,this._pageViewData=this._createPageViewData()):(this._hasSeenPageView=!0,i=void 0,this._pageViewData||(this._pageViewData=this._createPageViewData())),setTimeout(this._updateScrollData,0),ti({$prev_pageview_pathname:(e=i)===null||e===void 0?void 0:e.pathname},this._calculatePrevPageScrollProperties(i))}},{key:"doPageLeave",value:function(){var e=this._pageViewData;return ti({$prev_pageview_pathname:e?.pathname},this._calculatePrevPageScrollProperties(e))}},{key:"_calculatePrevPageScrollProperties",value:function(e){if(!e||e.maxScrollHeight==null||e.lastScrollY==null||e.maxScrollY==null||e.maxContentHeight==null||e.lastContentY==null||e.maxContentY==null)return{};var i=e.maxScrollHeight,r=e.lastScrollY,s=e.maxScrollY,n=e.maxContentHeight,a=e.lastContentY,h=e.maxContentY;return i=Math.ceil(i),r=Math.ceil(r),s=Math.ceil(s),n=Math.ceil(n),a=Math.ceil(a),h=Math.ceil(h),{$prev_pageview_last_scroll:r,$prev_pageview_last_scroll_percentage:i<=1?1:zf(r/i,0,1),$prev_pageview_max_scroll:s,$prev_pageview_max_scroll_percentage:i<=1?1:zf(s/i,0,1),$prev_pageview_last_content:a,$prev_pageview_last_content_percentage:n<=1?1:zf(a/n,0,1),$prev_pageview_max_content:h,$prev_pageview_max_content_percentage:n<=1?1:zf(h/n,0,1)}}},{key:"startMeasuringScrollPosition",value:function(){oe?.addEventListener("scroll",this._updateScrollData,!0),oe?.addEventListener("scrollend",this._updateScrollData,!0),oe?.addEventListener("resize",this._updateScrollData)}},{key:"stopMeasuringScrollPosition",value:function(){oe?.removeEventListener("scroll",this._updateScrollData),oe?.removeEventListener("scrollend",this._updateScrollData),oe?.removeEventListener("resize",this._updateScrollData)}},{key:"_scrollElement",value:function(){if(!this._instance.config.scroll_root_selector)return oe?.document.documentElement;var e,i=wo(Hr(this._instance.config.scroll_root_selector)?this._instance.config.scroll_root_selector:[this._instance.config.scroll_root_selector]);try{for(i.s();!(e=i.n()).done;){var r=e.value,s=oe?.document.querySelector(r);if(s)return s}}catch(n){i.e(n)}finally{i.f()}}},{key:"_scrollHeight",value:function(){var e=this._scrollElement();return e?Math.max(0,e.scrollHeight-e.clientHeight):0}},{key:"_scrollY",value:function(){if(this._instance.config.scroll_root_selector){var e=this._scrollElement();return e&&e.scrollTop||0}return oe&&(oe.scrollY||oe.pageYOffset||oe.document.documentElement.scrollTop)||0}},{key:"_contentHeight",value:function(){var e=this._scrollElement();return e?.scrollHeight||0}},{key:"_contentY",value:function(){var e=this._scrollElement(),i=e?.clientHeight||0;return this._scrollY()+i}}]),t}();function zf(t,e,i){return Math.max(e,Math.min(t,i))}var Ip,l0,gs,m2={icontains:function(t){return!!oe&&oe.location.href.toLowerCase().indexOf(t.toLowerCase())>-1},regex:function(t){return!!oe&&ME(oe.location.href,t)},exact:function(t){return oe?.location.href===t}},g2=function(){function t(e){Mr(this,t),this.instance=e}return Dr(t,[{key:"getSurveys",value:function(e){var i=this,r=arguments.length>1&&arguments[1]!==void 0&&arguments[1],s=this.instance.get_property(jm);if(s&&!r)return e(s);this.instance._send_request("".concat(this.instance.config.api_host,"/api/surveys/?token=").concat(this.instance.config.token),{},{method:"GET"},function(n){var a,h=n.surveys||[];return(a=i.instance.persistence)===null||a===void 0||a.register(Be({},jm,h)),e(h)})}},{key:"getActiveMatchingSurveys",value:function(e){var i=this,r=arguments.length>1&&arguments[1]!==void 0&&arguments[1];this.getSurveys(function(s){var n=s.filter(function(a){return!(!a.start_date||a.end_date)}).filter(function(a){var h,o,c,g;if(!a.conditions)return!0;var l=(h=a.conditions)===null||h===void 0||!h.url||m2[(o=(c=a.conditions)===null||c===void 0?void 0:c.urlMatchType)!==null&&o!==void 0?o:"icontains"](a.conditions.url),p=(g=a.conditions)===null||g===void 0||!g.selector||Ue?.querySelector(a.conditions.selector);return l&&p}).filter(function(a){if(!a.linked_flag_key&&!a.targeting_flag_key)return!0;var h=!a.linked_flag_key||i.instance.featureFlags.isFeatureEnabled(a.linked_flag_key),o=!a.targeting_flag_key||i.instance.featureFlags.isFeatureEnabled(a.targeting_flag_key);return h&&o});return e(n)},r)}}]),t}(),y2=function(){function t(){var e=this;Mr(this,t),Be(this,"limits",{}),Be(this,"checkForLimiting",function(i){var r=i.responseText;if(r&&r.length)try{(JSON.parse(r).quota_limited||[]).forEach(function(s){Te.info("[RateLimiter] ".concat(s||"events"," is quota limited.")),e.limits[s]=new Date().getTime()+6e4})}catch(s){return void Te.warn('[RateLimiter] could not rate limit - continuing. Error: "'.concat(s?.message,'"'),{text:r})}})}return Dr(t,[{key:"isRateLimited",value:function(e){var i=this.limits[e||"events"]||!1;return i!==!1&&new Date().getTime()<i}}]),t}(),v2=function(){return ti({initialPathName:bo?.pathname||"",referringDomain:qr.referringDomain()},qr.campaignParams())},b2=function(){function t(e,i,r){var s=this;Mr(this,t),Be(this,"_onSessionIdCallback",function(n){var a=s._getStoredProps();if(!a||a.sessionId!==n){var h={sessionId:n,props:s._sessionSourceParamGenerator()};s._persistence.register(Be({},Wm,h))}}),this._sessionIdManager=e,this._persistence=i,this._sessionSourceParamGenerator=r||v2,this._sessionIdManager.onSessionId(this._onSessionIdCallback)}return Dr(t,[{key:"_getStoredProps",value:function(){return this._persistence.props[Wm]}},{key:"getSessionProps",value:function(){var e,i=(e=this._getStoredProps())===null||e===void 0?void 0:e.props;return i?{$client_session_initial_referring_host:i.referringDomain,$client_session_initial_pathname:i.initialPathName,$client_session_initial_utm_source:i.utm_source,$client_session_initial_utm_campaign:i.utm_campaign,$client_session_initial_utm_medium:i.utm_medium,$client_session_initial_utm_content:i.utm_content,$client_session_initial_utm_term:i.utm_term}:{}}}]),t}(),_2=["ahrefsbot","ahrefssiteaudit","applebot","baiduspider","bingbot","bingpreview","bot.htm","bot.php","crawler","duckduckbot","facebookexternal","facebookcatalog","gptbot","http://yandex.com/bots","hubspot","ia_archiver","linkedinbot","mj12bot","msnbot","nessus","petalbot","pinterest","prerender","rogerbot","screaming frog","semrushbot","sitebulb","slurp","turnitin","twitterbot","vercelbot","yahoo! slurp","yandexbot","adsbot-google","apis-google","duplexweb-google","feedfetcher-google","google favicon","google web preview","google-read-aloud","googlebot","googleweblight","mediapartners-google","storebot-google"],Db=function(t,e){if(!t)return!1;var i=t.toLowerCase();return _2.concat(e||[]).some(function(r){var s=r.toLowerCase();return i.includes?i.includes(s):i.indexOf(s)!==-1})};(function(t){t[t.INIT_MODULE=0]="INIT_MODULE",t[t.INIT_SNIPPET=1]="INIT_SNIPPET"})(Ip||(Ip={}));var Km=function(){},Nf={},Qs="posthog",s_=!Hf&&Tr?.indexOf("MSIE")===-1&&Tr?.indexOf("Mozilla")===-1,Ib=function(){var t,e,i;return{api_host:"https://app.posthog.com",api_method:"POST",api_transport:"XHR",ui_host:null,token:"",autocapture:!0,rageclick:!0,cross_subdomain_cookie:(e=Ue?.location,i=e?.hostname,!!yn(i)&&i.split(".").slice(-2).join(".")!=="herokuapp.com"),persistence:"localStorage+cookie",persistence_name:"",cookie_name:"",loaded:Km,store_google:!0,custom_campaign_params:[],custom_blocked_useragents:[],save_referrer:!0,capture_pageview:!0,capture_pageleave:!0,debug:!1,verbose:!1,cookie_expiration:365,upgrade:!1,disable_session_recording:!1,disable_persistence:!1,disable_cookie:!1,enable_recording_console_log:void 0,secure_cookie:(oe==null||(t=oe.location)===null||t===void 0?void 0:t.protocol)==="https:",ip:!0,opt_out_capturing_by_default:!1,opt_out_persistence_by_default:!1,opt_out_useragent_filter:!1,opt_out_capturing_persistence_type:"localStorage",opt_out_capturing_cookie_prefix:null,opt_in_site_apps:!1,property_blacklist:[],respect_dnt:!1,sanitize_properties:null,request_headers:{},inapp_protocol:"//",inapp_link_new_window:!1,request_batching:!0,properties_string_max_length:65535,session_recording:{},mask_all_element_attributes:!1,mask_all_text:!1,advanced_disable_decide:!1,advanced_disable_feature_flags:!1,advanced_disable_feature_flags_on_first_load:!1,advanced_disable_toolbar_metrics:!1,on_request_error:function(r){var s="Bad HTTP status: "+r.statusCode+" "+r.responseText;Te.error(s)},get_device_id:function(r){return r},_onCapture:Km,capture_performance:void 0,name:"posthog",callback_fn:"posthog._jsc",bootstrap:{},disable_compression:!1,session_idle_timeout_seconds:1800}},Qm=function(t,e,i,r){var s,n=i!==Qs&&gs?i?gs[i]:void 0:gs,a={initComplete:!1,syncCode:!1},h=function(o){return function(c){a[o]||(a[o]=!0,a.initComplete&&a.syncCode&&r?.(c))}};if(n&&l0===Ip.INIT_MODULE)s=n;else{if(n&&!Hr(n))return void Te.error("You have already initialized "+i);s=new p0}return s._init(t,e,i,h("initComplete")),s.toolbar.maybeLoadToolbar(),s.sessionRecording=new qE(s),s.sessionRecording.startRecordingIfEnabled(),s.config.disable_scroll_properties||s.pageViewManager.startMeasuringScrollPosition(),s.__autocapture=s.config.autocapture,xo._setIsAutocaptureEnabled(s),xo._isAutocaptureEnabled&&(s.__autocapture=s.config.autocapture,xo.enabledForProject(s.config.token,100,100)?xo.isBrowserSupported()?xo.init(s):(s.__autocapture=!1,Te.info("Disabling Automatic Event Collection because this browser is not supported")):(s.__autocapture=!1,Te.info("Not in active bucket: disabling Automatic Event Collection."))),yh.DEBUG=yh.DEBUG||s.config.debug,!Si(n)&&Hr(n)&&(s._execute_array.call(s.people,n.people),s._execute_array(n)),h("syncCode")(s),s},x2=function(){function t(){Mr(this,t),Be(this,"__forceAllowLocalhost",!1)}return Dr(t,[{key:"_forceAllowLocalhost",get:function(){return this.__forceAllowLocalhost},set:function(e){Te.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=e}}]),t}(),p0=function(){function t(){var e=this;Mr(this,t),Be(this,"webPerformance",new x2),this.config=Ib(),this.compression={},this.decideEndpointWasHit=!1,this.SentryIntegration=u2,this.segmentIntegration=function(){return function(i){Promise&&Promise.resolve||Te.warn("This browser does not have Promise support, and can not use the segment integration");var r=function(s,n){s.event.userId||s.event.anonymousId===i.get_distinct_id()||i.reset(),s.event.userId&&s.event.userId!==i.get_distinct_id()&&(i.register({distinct_id:s.event.userId}),i.reloadFeatureFlags());var a=i._calculate_event_properties(n,s.event.properties);return s.event.properties=Object.assign({},a,s.event.properties),s};return{name:"PostHog JS",type:"enrichment",version:"1.0.0",isLoaded:function(){return!0},load:function(){return Promise.resolve()},track:function(s){return r(s,s.event.event)},page:function(s){return r(s,"$pageview")},identify:function(s){return r(s,"$identify")},screen:function(s){return r(s,"$screen")}}}(e)},this.__captureHooks=[],this.__request_queue=[],this.__loaded=!1,this.__loaded_recorder_version=void 0,this.__autocapture=void 0,this._jsc=function(){},this.analyticsDefaultEndpoint="/e/",this.elementsChainAsString=!1,this.featureFlags=new bE(this),this.toolbar=new YE(this),this.pageViewManager=new d2(this),this.surveys=new g2(this),this.rateLimiter=new y2,this.people={set:function(i,r,s){var n=yn(i)?Be({},i,r):i;e.setPersonProperties(n),s?.({})},set_once:function(i,r,s){var n=yn(i)?Be({},i,r):i;e.setPersonProperties(void 0,n),s?.({})}}}return Dr(t,[{key:"init",value:function(e,i,r){if(Si(r))Te.critical("You must name your new library: init(token, config, name)");else{if(r!==Qs){var s=Qm(e,i,r,function(n){gs[r]=n,n._loaded()});return gs[r]=s,s}Te.critical("You must initialize the main posthog object right after you include the PostHog js snippet")}}},{key:"_init",value:function(e){var i,r,s,n=this,a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},h=arguments.length>2?arguments[2]:void 0,o=arguments.length>3?arguments[3]:void 0;this.__loaded=!0,this.config={},this._triggered_notifs=[];var c,g={segmentRegister:!1,syncCode:!1},l=function(E){return function(){g[E]||(g[E]=!0,g.segmentRegister&&g.syncCode&&o?.(n))}};if(a.request_headers=a.request_headers||a.xhr_headers,this.set_config(ms({},Ib(),a,{name:h,token:e,callback_fn:(h===Qs?h:Qs+"."+h)+"._jsc"})),this._jsc=function(){},(oe!=null&&(i=oe.rrweb)!==null&&i!==void 0&&i.record||oe!=null&&oe.rrwebRecord)&&(this.__loaded_recorder_version=oe==null||(c=oe.rrweb)===null||c===void 0?void 0:c.version),this.persistence=new wb(this.config),this._requestQueue=new JE(this._handle_queued_event.bind(this)),this._retryQueue=new c2(this.config.on_request_error,this.rateLimiter),this.__captureHooks=[],this.__request_queue=[],this.sessionManager=new f2(this.config,this.persistence),this.sessionPropsManager=new b2(this.sessionManager,this.persistence),this.sessionPersistence=this.config.persistence==="sessionStorage"?this.persistence:new wb(ti(ti({},this.config),{},{persistence:"sessionStorage"})),this._gdpr_init(),a.segment?(this.config.get_device_id=function(){return a.segment.user().anonymousId()},a.segment.user().id()&&(this.register({distinct_id:a.segment.user().id()}),this.persistence.set_user_state("identified")),a.segment.register(this.segmentIntegration()).then(l("segmentRegister"))):l("segmentRegister")(),((r=a.bootstrap)===null||r===void 0?void 0:r.distinctID)!==void 0){var p,v,u=this.config.get_device_id(mh()),m=(p=a.bootstrap)!==null&&p!==void 0&&p.isIdentifiedID?u:a.bootstrap.distinctID;this.persistence.set_user_state((v=a.bootstrap)!==null&&v!==void 0&&v.isIdentifiedID?"identified":"anonymous"),this.register({distinct_id:a.bootstrap.distinctID,$device_id:m})}if(this._hasBootstrappedFeatureFlags()){var k,y,d=Object.keys(((k=a.bootstrap)===null||k===void 0?void 0:k.featureFlags)||{}).filter(function(E){var I,B;return!((I=a.bootstrap)===null||I===void 0||(B=I.featureFlags)===null||B===void 0||!B[E])}).reduce(function(E,I){var B,G;return E[I]=((B=a.bootstrap)===null||B===void 0||(G=B.featureFlags)===null||G===void 0?void 0:G[I])||!1,E},{}),b=Object.keys(((y=a.bootstrap)===null||y===void 0?void 0:y.featureFlagPayloads)||{}).filter(function(E){return d[E]}).reduce(function(E,I){var B,G,it,lt;return(B=a.bootstrap)!==null&&B!==void 0&&(G=B.featureFlagPayloads)!==null&&G!==void 0&&G[I]&&(E[I]=(it=a.bootstrap)===null||it===void 0||(lt=it.featureFlagPayloads)===null||lt===void 0?void 0:lt[I]),E},{});this.featureFlags.receivedFeatureFlags({featureFlags:d,featureFlagPayloads:b})}if(!this.get_distinct_id()){var S=this.config.get_device_id(mh());this.register_once({distinct_id:S,$device_id:S},""),this.persistence.set_user_state("anonymous")}oe==null||(s=oe.addEventListener)===null||s===void 0||s.call(oe,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this)),l("syncCode")()}},{key:"_afterDecideResponse",value:function(e){var i;if(this.compression={},e.supportedCompression&&!this.config.disable_compression){var r,s={},n=wo(e.supportedCompression);try{for(n.s();!(r=n.n()).done;)s[r.value]=!0}catch(a){n.e(a)}finally{n.f()}this.compression=s}(i=e.analytics)!==null&&i!==void 0&&i.endpoint&&(this.analyticsDefaultEndpoint=e.analytics.endpoint),e.elementsChainAsString&&(this.elementsChainAsString=e.elementsChainAsString)}},{key:"_loaded",value:function(){var e=this.config.advanced_disable_decide;e||this.featureFlags.setReloadingPaused(!0);try{this.config.loaded(this)}catch(i){Te.critical("`loaded` function failed",i)}this._start_queue_if_opted_in(),this.config.capture_pageview&&Ue&&this.capture("$pageview",{title:Ue.title},{send_instantly:!0}),e||(new HE(this).call(),this.featureFlags.resetRequestQueue())}},{key:"_start_queue_if_opted_in",value:function(){var e;this.has_opted_out_capturing()||this.config.request_batching&&((e=this._requestQueue)===null||e===void 0||e.poll())}},{key:"_dom_loaded",value:function(){var e=this;this.has_opted_out_capturing()||ll(this.__request_queue,function(i){e._send_request.apply(e,Zf(i))}),this.__request_queue=[],this._start_queue_if_opted_in()}},{key:"_prepare_callback",value:function(e,i){if(Si(e))return null;if(Hf)return function(a){e(a,i)};var r=this._jsc,s=""+Math.floor(1e8*Math.random()),n=this.config.callback_fn+"["+s+"]";return r[s]=function(a){delete r[s],e(a,i)},n}},{key:"_handle_unload",value:function(){var e,i;this.config.request_batching?(this.config.capture_pageview&&this.config.capture_pageleave&&this.capture("$pageleave"),(e=this._requestQueue)===null||e===void 0||e.unload(),(i=this._retryQueue)===null||i===void 0||i.unload()):this.config.capture_pageview&&this.config.capture_pageleave&&this.capture("$pageleave",null,{transport:"sendBeacon"})}},{key:"_handle_queued_event",value:function(e,i,r){var s=JSON.stringify(i);this.__compress_and_send_json_request(e,s,r||Nf,Km)}},{key:"__compress_and_send_json_request",value:function(e,i,r,s){var n=function(c,g,l){return c===dh.GZipJS?[h2(l2(g),{mtime:0}),ti(ti({},l),{},{blob:!0,urlQueryArgs:{compression:dh.GZipJS}})]:[{data:i0(g)},l]}(this.compression[dh.GZipJS]?dh.GZipJS:dh.Base64,i,r),a=ea(n,2),h=a[0],o=a[1];this._send_request(e,h,o,s)}},{key:"_send_request",value:function(e,i,r,s){if(this.__loaded&&this._retryQueue&&!this.rateLimiter.isRateLimited(r._batchKey))if(s_)this.__request_queue.push([e,i,r,s]);else{var n={method:this.config.api_method,transport:this.config.api_transport,verbose:this.config.verbose};r=ms(n,r||{}),Hf||(r.method="GET");var a=oe&&"sendBeacon"in oe.navigator&&r.transport==="sendBeacon";if(e=h0(e,r.urlQueryArgs||{},{ip:this.config.ip}),a)try{oe?.navigator.sendBeacon(e,ru(i,ti(ti({},r),{},{sendBeacon:!0})))}catch{}else if(Hf||!Ue)try{r_({url:e,data:i,headers:this.config.request_headers,options:r,callback:s,retriesPerformedSoFar:0,retryQueue:this._retryQueue,onError:this.config.on_request_error,onResponse:this.rateLimiter.checkForLimiting})}catch(g){Te.error(g)}else{var h,o=Ue.createElement("script");o.type="text/javascript",o.async=!0,o.defer=!0,o.src=e;var c=Ue.getElementsByTagName("script")[0];(h=c.parentNode)===null||h===void 0||h.insertBefore(o,c)}}}},{key:"_execute_array",value:function(e){var i,r=this,s=[],n=[],a=[];ll(e,function(o){o&&(i=o[0],Hr(i)?a.push(o):Vn(o)?o.call(r):Hr(o)&&i==="alias"?s.push(o):Hr(o)&&i.indexOf("capture")!==-1&&Vn(r[i])?a.push(o):n.push(o))});var h=function(o,c){ll(o,function(g){if(Hr(g[0])){var l=c;tr(g,function(p){l=l[p[0]].apply(l,p.slice(1))})}else this[g[0]].apply(this,g.slice(1))},c)};h(s,this),h(n,this),h(a,this)}},{key:"_hasBootstrappedFeatureFlags",value:function(){var e,i;return((e=this.config.bootstrap)===null||e===void 0?void 0:e.featureFlags)&&Object.keys((i=this.config.bootstrap)===null||i===void 0?void 0:i.featureFlags).length>0||!1}},{key:"push",value:function(e){this._execute_array([e])}},{key:"capture",value:function(e,i){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Nf;if(!this.__loaded||!this.sessionPersistence||!this._requestQueue)return Te.uninitializedWarning("posthog.capture");if(!Zm(this)){var s=(r=r||Nf).transport;if(s&&(r.transport=s),!Si(e)&&yn(e)){if(!Tr||this.config.opt_out_useragent_filter||!Db(Tr,this.config.custom_blocked_useragents)){this.sessionPersistence.update_search_keyword(),this.config.store_google&&this.sessionPersistence.update_campaign_params(),this.config.save_referrer&&this.sessionPersistence.update_referrer_info();var n={uuid:mh(),event:e,properties:this._calculate_event_properties(e,i||{})};e==="$identify"&&(n.$set=r.$set,n.$set_once=r.$set_once),(n=uE(n,r._noTruncate?null:this.config.properties_string_max_length)).timestamp=r.timestamp||new Date;var a=ti(ti({},n.properties.$set),n.$set);(function(g){if(So(g)){for(var l in g)if(Bb.call(g,l))return!1;return!0}return!1})(a)||this.setPersonPropertiesForFlags(a),Te.info("send",n);var h=JSON.stringify(n),o=this.config.api_host+(r.endpoint||this.analyticsDefaultEndpoint),c=r!==Nf;return!this.config.request_batching||c&&!r._batchKey||r.send_instantly?this.__compress_and_send_json_request(o,h,r):this._requestQueue.enqueue(o,n,r),this._invokeCaptureHooks(e,n),n}}else Te.error("No event name provided to posthog.capture")}}},{key:"_addCaptureHook",value:function(e){this.__captureHooks.push(e)}},{key:"_invokeCaptureHooks",value:function(e,i){this.config._onCapture(e,i),tr(this.__captureHooks,function(r){return r(e)})}},{key:"_calculate_event_properties",value:function(e,i){if(!this.persistence||!this.sessionPersistence)return i;var r=this.persistence.remove_event_timer(e),s=ti({},i);if(s.token=this.config.token,e==="$snapshot"){var n=ti(ti({},this.persistence.properties()),this.sessionPersistence.properties());return s.distinct_id=n.distinct_id,s}var a=qr.properties();if(this.sessionManager){var h=this.sessionManager.checkAndGetSessionAndWindowId(),o=h.sessionId,c=h.windowId;s.$session_id=o,s.$window_id=c}if(this.sessionPropsManager&&this.config.__preview_send_client_session_params&&(e==="$pageview"||e==="$pageleave"||e==="$autocapture")){var g=this.sessionPropsManager.getSessionProps();s=ms(s,g)}if(!this.config.disable_scroll_properties){var l={};e==="$pageview"?l=this.pageViewManager.doPageView():e==="$pageleave"&&(l=this.pageViewManager.doPageLeave()),s=ms(s,l)}if(e==="$pageview"&&Ue&&(s.title=Ue.title),e==="$performance_event"){var p=this.persistence.properties();return s.distinct_id=p.distinct_id,s.$current_url=a.$current_url,s}if(!Si(r)){var v=new Date().getTime()-r;s.$duration=parseFloat((v/1e3).toFixed(3))}Tr&&this.config.opt_out_useragent_filter&&(s.$browser_type=Db(Tr,this.config.custom_blocked_useragents)?"bot":"browser"),s=ms({},qr.properties(),this.persistence.properties(),this.sessionPersistence.properties(),s);var u=this.config.property_blacklist;Hr(u)?tr(u,function(k){delete s[k]}):Te.error("Invalid value for property_blacklist config: "+u);var m=this.config.sanitize_properties;return m&&(s=m(s,e)),s}},{key:"register",value:function(e,i){var r;(r=this.persistence)===null||r===void 0||r.register(e,i)}},{key:"register_once",value:function(e,i,r){var s;(s=this.persistence)===null||s===void 0||s.register_once(e,i,r)}},{key:"register_for_session",value:function(e){var i;(i=this.sessionPersistence)===null||i===void 0||i.register(e)}},{key:"unregister",value:function(e){var i;(i=this.persistence)===null||i===void 0||i.unregister(e)}},{key:"unregister_for_session",value:function(e){var i;(i=this.sessionPersistence)===null||i===void 0||i.unregister(e)}},{key:"_register_single",value:function(e,i){this.register(Be({},e,i))}},{key:"getFeatureFlag",value:function(e,i){return this.featureFlags.getFeatureFlag(e,i)}},{key:"getFeatureFlagPayload",value:function(e){var i=this.featureFlags.getFeatureFlagPayload(e);try{return JSON.parse(i)}catch{return i}}},{key:"isFeatureEnabled",value:function(e,i){return this.featureFlags.isFeatureEnabled(e,i)}},{key:"reloadFeatureFlags",value:function(){this.featureFlags.reloadFeatureFlags()}},{key:"updateEarlyAccessFeatureEnrollment",value:function(e,i){this.featureFlags.updateEarlyAccessFeatureEnrollment(e,i)}},{key:"getEarlyAccessFeatures",value:function(e){var i=arguments.length>1&&arguments[1]!==void 0&&arguments[1];return this.featureFlags.getEarlyAccessFeatures(e,i)}},{key:"onFeatureFlags",value:function(e){return this.featureFlags.onFeatureFlags(e)}},{key:"onSessionId",value:function(e){var i,r;return(i=(r=this.sessionManager)===null||r===void 0?void 0:r.onSessionId(e))!==null&&i!==void 0?i:function(){}}},{key:"getSurveys",value:function(e){var i=arguments.length>1&&arguments[1]!==void 0&&arguments[1];this.surveys.getSurveys(e,i)}},{key:"getActiveMatchingSurveys",value:function(e){var i=arguments.length>1&&arguments[1]!==void 0&&arguments[1];this.surveys.getActiveMatchingSurveys(e,i)}},{key:"identify",value:function(e,i,r){if(!this.__loaded||!this.persistence)return Te.uninitializedWarning("posthog.identify");if(e)if(["distinct_id","distinctid"].includes(e.toLowerCase()))Te.critical('The string "'.concat(e,'" was set in posthog.identify which indicates an error. This ID should be unique to the user and not a hardcoded string.'));else{var s=this.get_distinct_id();if(this.register({$user_id:e}),!this.get_property("$device_id")){var n=s;this.register_once({$had_persisted_distinct_id:!0,$device_id:n},"")}e!==s&&e!==this.get_property(jf)&&(this.unregister(jf),this.register({distinct_id:e}));var a=this.persistence.get_user_state()==="anonymous";e!==s&&a?(this.persistence.set_user_state("identified"),this.setPersonPropertiesForFlags(i||{},!1),this.capture("$identify",{distinct_id:e,$anon_distinct_id:s},{$set:i||{},$set_once:r||{}}),this.featureFlags.setAnonymousDistinctId(s)):(i||r)&&this.setPersonProperties(i,r),e!==s&&(this.reloadFeatureFlags(),this.unregister(Qf))}else Te.error("Unique user id has not been set in posthog.identify")}},{key:"setPersonProperties",value:function(e,i){(e||i)&&(this.setPersonPropertiesForFlags(e||{}),this.capture("$set",{$set:e||{},$set_once:i||{}}))}},{key:"group",value:function(e,i,r){if(e&&i){var s=this.getGroups();s[e]!==i&&this.resetGroupPropertiesForFlags(e),this.register({$groups:ti(ti({},s),{},Be({},e,i))}),r&&(this.capture("$groupidentify",{$group_type:e,$group_key:i,$group_set:r}),this.setGroupPropertiesForFlags(Be({},e,r))),s[e]===i||r||this.reloadFeatureFlags()}else Te.error("posthog.group requires a group type and group key")}},{key:"resetGroups",value:function(){this.register({$groups:{}}),this.resetGroupPropertiesForFlags(),this.reloadFeatureFlags()}},{key:"setPersonPropertiesForFlags",value:function(e){var i=!(arguments.length>1&&arguments[1]!==void 0)||arguments[1];this.featureFlags.setPersonPropertiesForFlags(e,i)}},{key:"resetPersonPropertiesForFlags",value:function(){this.featureFlags.resetPersonPropertiesForFlags()}},{key:"setGroupPropertiesForFlags",value:function(e){var i=!(arguments.length>1&&arguments[1]!==void 0)||arguments[1];this.featureFlags.setGroupPropertiesForFlags(e,i)}},{key:"resetGroupPropertiesForFlags",value:function(e){this.featureFlags.resetGroupPropertiesForFlags(e)}},{key:"reset",value:function(e){var i,r,s,n;if(!this.__loaded)return Te.uninitializedWarning("posthog.reset");var a=this.get_property("$device_id");(i=this.persistence)===null||i===void 0||i.clear(),(r=this.sessionPersistence)===null||r===void 0||r.clear(),(s=this.persistence)===null||s===void 0||s.set_user_state("anonymous"),(n=this.sessionManager)===null||n===void 0||n.resetSessionId();var h=this.config.get_device_id(mh());this.register_once({distinct_id:h,$device_id:e?h:a},"")}},{key:"get_distinct_id",value:function(){return this.get_property("distinct_id")}},{key:"getGroups",value:function(){return this.get_property("$groups")||{}}},{key:"get_session_id",value:function(){var e,i;return(e=(i=this.sessionManager)===null||i===void 0?void 0:i.checkAndGetSessionAndWindowId(!0).sessionId)!==null&&e!==void 0?e:""}},{key:"get_session_replay_url",value:function(e){if(!this.sessionManager)return"";var i=this.config.ui_host||this.config.api_host,r=this.sessionManager.checkAndGetSessionAndWindowId(!0),s=r.sessionId,n=r.sessionStartTimestamp,a=i+"/replay/"+s;if(e!=null&&e.withTimestamp&&n){var h,o=(h=e.timestampLookBack)!==null&&h!==void 0?h:10;if(!n)return a;var c=Math.max(Math.floor((new Date().getTime()-n)/1e3)-o,0);a+="?t=".concat(c)}return a}},{key:"alias",value:function(e,i){return e===this.get_property(Hb)?(Te.critical("Attempting to create alias for existing People user - aborting."),-2):(Si(i)&&(i=this.get_distinct_id()),e!==i?(this._register_single(jf,e),this.capture("$create_alias",{alias:e,distinct_id:i})):(Te.warn("alias matches current distinct_id - skipping api call."),this.identify(e),-1))}},{key:"set_config",value:function(e){var i,r,s=ti({},this.config);if(So(e)&&(ms(this.config,e),this.config.persistence_name||(this.config.persistence_name=this.config.cookie_name),this.config.disable_persistence||(this.config.disable_persistence=this.config.disable_cookie),this.config.api_host=this.config.api_host.replace(/\/$/,""),this.config.api_host==="https://us.posthog.com"&&(this.config.api_host="https://app.posthog.com"),(i=this.persistence)===null||i===void 0||i.update_config(this.config),(r=this.sessionPersistence)===null||r===void 0||r.update_config(this.config),Lr.is_supported()&&Lr.get("ph_debug")==="true"&&(this.config.debug=!0),this.config.debug&&(yh.DEBUG=!0),this.sessionRecording&&!Si(e.disable_session_recording))){var n=s.disable_session_recording!==e.disable_session_recording,a=!Zm(this)&&!e.disable_session_recording&&!this.sessionRecording.started;(n||a)&&(e.disable_session_recording?this.sessionRecording.stopRecording():this.sessionRecording.startRecordingIfEnabled())}}},{key:"startSessionRecording",value:function(){this.set_config({disable_session_recording:!1})}},{key:"stopSessionRecording",value:function(){this.set_config({disable_session_recording:!0})}},{key:"sessionRecordingStarted",value:function(){var e;return!((e=this.sessionRecording)===null||e===void 0||!e.started)}},{key:"loadToolbar",value:function(e){return this.toolbar.loadToolbar(e)}},{key:"get_property",value:function(e){var i;return(i=this.persistence)===null||i===void 0?void 0:i.props[e]}},{key:"getSessionProperty",value:function(e){var i;return(i=this.sessionPersistence)===null||i===void 0?void 0:i.props[e]}},{key:"toString",value:function(){var e,i=(e=this.config.name)!==null&&e!==void 0?e:Qs;return i!==Qs&&(i=Qs+"."+i),i}},{key:"_gdpr_init",value:function(){this.config.opt_out_capturing_persistence_type==="localStorage"&&Lr.is_supported()&&(!this.has_opted_in_capturing()&&this.has_opted_in_capturing({persistence_type:"cookie"})&&this.opt_in_capturing({enable_persistence:!1}),!this.has_opted_out_capturing()&&this.has_opted_out_capturing({persistence_type:"cookie"})&&this.opt_out_capturing({clear_persistence:!1}),this.clear_opt_in_out_capturing({persistence_type:"cookie",enable_persistence:!1})),this.has_opted_out_capturing()?this._gdpr_update_persistence({clear_persistence:!0}):this.has_opted_in_capturing()||!this.config.opt_out_capturing_by_default&&!_a.get("ph_optout")||(_a.remove("ph_optout"),this.opt_out_capturing({clear_persistence:this.config.opt_out_persistence_by_default}))}},{key:"_gdpr_update_persistence",value:function(e){var i,r,s,n,a;if(e&&e.clear_persistence)s=!0;else{if(!e||!e.enable_persistence)return;s=!1}this.config.disable_persistence||((i=this.persistence)===null||i===void 0?void 0:i.disabled)===s||(n=this.persistence)===null||n===void 0||n.set_disabled(s),this.config.disable_persistence||((r=this.sessionPersistence)===null||r===void 0?void 0:r.disabled)===s||(a=this.sessionPersistence)===null||a===void 0||a.set_disabled(s)}},{key:"_gdpr_call_func",value:function(e,i){return i=ms({capture:this.capture.bind(this),persistence_type:this.config.opt_out_capturing_persistence_type,cookie_prefix:this.config.opt_out_capturing_cookie_prefix,cookie_expiration:this.config.cookie_expiration,cross_subdomain_cookie:this.config.cross_subdomain_cookie,secure_cookie:this.config.secure_cookie},i||{}),Lr.is_supported()||i.persistence_type!=="localStorage"||(i.persistence_type="cookie"),e(this.config.token,{capture:i.capture,captureEventName:i.capture_event_name,captureProperties:i.capture_properties,persistenceType:i.persistence_type,persistencePrefix:i.cookie_prefix,cookieExpiration:i.cookie_expiration,crossSubdomainCookie:i.cross_subdomain_cookie,secureCookie:i.secure_cookie})}},{key:"opt_in_capturing",value:function(e){e=ms({enable_persistence:!0},e||{}),this._gdpr_call_func(zE,e),this._gdpr_update_persistence(e)}},{key:"opt_out_capturing",value:function(e){var i=ms({clear_persistence:!0},e||{});this._gdpr_call_func(NE,i),this._gdpr_update_persistence(i)}},{key:"has_opted_in_capturing",value:function(e){return this._gdpr_call_func(GE,e)}},{key:"has_opted_out_capturing",value:function(e){return this._gdpr_call_func(Zb,e)}},{key:"clear_opt_in_out_capturing",value:function(e){var i=ms({enable_persistence:!0},e??{});this._gdpr_call_func($E,i),this._gdpr_update_persistence(i)}},{key:"debug",value:function(e){e===!1?(oe?.console.log("You've disabled debug mode."),localStorage&&localStorage.removeItem("ph_debug"),this.set_config({debug:!1})):(oe?.console.log("You're now in debug mode. All calls to PostHog will be logged in your console.\nYou can disable this with `posthog.debug(false)`."),localStorage&&localStorage.setItem("ph_debug","true"),this.set_config({debug:!0}))}}]),t}();(function(t,e){for(var i=0;i<e.length;i++)t.prototype[e[i]]=Gb(t.prototype[e[i]])})(p0,["identify"]);var Fb,Lb,vo={},S2=function(){gs.init=function(t,e,i){if(i)return gs[i]||(gs[i]=vo[i]=Qm(t||"",e||{},i,function(s){gs[i]=vo[i]=s,s._loaded()})),gs[i];var r=gs;return vo[Qs]?r=vo[Qs]:t&&(r=Qm(t,e||{},Qs,function(s){vo[Qs]=s,s._loaded()}),vo[Qs]=r),gs=r,l0===Ip.INIT_SNIPPET&&(Ms[Qs]=gs),tr(vo,function(s,n){n!==Qs&&(gs[n]=s)}),r}};(function(t){t.Popover="popover",t.API="api",t.Widget="widget"})(Fb||(Fb={})),function(t){t.Open="open",t.MultipleChoice="multiple_choice",t.SingleChoice="single_choice",t.Rating="rating",t.Link="link"}(Lb||(Lb={}));var n_=(l0=Ip.INIT_MODULE,gs=new p0,S2(),gs.init(),function(){function t(){t.done||(t.done=!0,s_=!1,tr(vo,function(e){e._dom_loaded()}))}Ue!=null&&Ue.addEventListener&&(Ue.readyState==="complete"?t():Ue.addEventListener("DOMContentLoaded",t,!1)),oe&&Tp(oe,"load",t,!0)}(),gs);var a_=n_.init("phc_OTZ3wJ6VemgVupCRKS5Sbqb9Ks0JYe0hMYZPtLwl0nu",{api_host:"https://pheu.molin.ai",ui_host:"https://eu.posthog.com",secure_cookie:document.location.protocol==="https:",persistence:"cookie",autocapture:!1,rageclick:!1,capture_pageview:!1,capture_pageleave:!1,disable_session_recording:!0,advanced_disable_decide:!0},"MolinShopAI");function bn(t,e){if(!a_)throw new Error("Failed to initialize PostHog");a_.capture(t,e)}var bh,Lp,au,o_,Wr,yr,ia,ou,h_,hu,l_,lu,p_,pu,c_,cu,f_,fu,u_,uu,d_,du,m_,mu,g_,cl,nu,su=class extends br(zi){constructor(){super();Le(this,bh);Le(this,au);Le(this,ou);Le(this,hu);Le(this,lu);Le(this,pu);Le(this,cu);Le(this,fu);Le(this,uu);Le(this,du);Le(this,mu);Le(this,cl);Le(this,Wr,new If(this,{url:(i,{resume:r}={})=>{let s=new URL(this.config.wsApiUrl);return s.searchParams.set("widgetId",this.widgetId),s.searchParams.set("resume",r?"1":""),s.searchParams.set("conversationId",i),s.searchParams.set("pageUrl",window.location.href),s},onReconnect:()=>{},onError:i=>{console.error("ws error",i)},onClose:()=>{},onNewMessage:i=>{i.role==="assistant"&&bn("ShopAssistant: user received bot message (streaming started)",{widgetId:this.widgetId,message:i})},onUpdateMessage:i=>{},onMessageDone:i=>{let r={...fe(this,Wr)?.messages.find(s=>s.id===i.message?.id)};Object.assign(r,i.message),r.role==="assistant"&&bn("ShopAssistant: user received bot message (streaming ended)",{widgetId:this.widgetId,text:r.content??"",message:r,usage_TOKENS_COMPLETION:i.message.usage.TOKENS_COMPLETION})},onMessageError:i=>{console.error("ws message error",i),i.message&&fe(this,yr)&&(alert(i.message),bn("ShopAssistant: error",{widgetId:this.widgetId,error:"websocket ERROR message type: "+i.message}))},persistConversationState:(i,r)=>{let s={conversationId:i,messages:r};localStorage.setItem(fe(this,bh,Lp),JSON.stringify(s))},restoreConversationState:()=>{try{let i=JSON.parse(localStorage.getItem(fe(this,bh,Lp))||"{}"),r=S0.parse(i);return{conversationId:r.conversationId||Tm(),messages:r.messages||[]}}catch(i){console.error(i)}},onReset:()=>{localStorage.removeItem(fe(this,bh,Lp))},onConnect:i=>{localStorage.setItem(fe(this,bh,Lp),JSON.stringify({conversationId:i}))}}));Le(this,yr,!1);Le(this,ia,void 0);this.widgetId="",this.config}render(){console.assert(this.widgetId,"widget id is required"),console.assert(this.config,"config is required");let i=Object.entries(this.config.bubble.position).filter(([o,c])=>c).map(([o,c])=>`${o}-[${c}]`).reduce((o,c)=>(o[c]=!0,o),{}),r=Object.entries(this.config.bubble.position).filter(([o,c])=>c).map(([o,c])=>`${o}-[${c}]`).reduce((o,c)=>(o[c]=!0,o),{}),s={bottom:"72px"},n=Object.entries(this.config.bubble.position).filter(([o,c])=>c).map(([o,c])=>`sm:${o}-[calc(${[s[o],c].filter(g=>!!g).join("+")})]`).reduce((o,c)=>(o[c]=!0,o),{}),a=n;if(this.config.hidden&&!fe(this,au,o_))return Ki;let h=Jv(fe(this,Wr).messages,o=>new Date(new Date(o.timestamp).setSeconds(0,0)).getTime().toString());return di`
1036
1036
  ${this.config.kioskMode?Ki:di`
1037
1037
  <mw-bubble class="${Wv(i)} fixed z-[2147483647]" widget="${this.widgetId}" @click=${ri(this,pu,c_)} ?dialog-shown="${fe(this,yr)}" bubble-image-url="${this.config.bubble?.imageUrl||""}"></mw-bubble>
1038
1038
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@molin.ai/shop-ai",
3
- "version": "0.4.45",
3
+ "version": "0.4.46",
4
4
  "description": "Molin Shop AI",
5
5
  "keywords": [
6
6
  "molin",