@cartbot/vehicle-search-beta 3.0.42 → 3.0.43

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.
@@ -328,7 +328,7 @@ function oe({
328
328
  )
329
329
  ] });
330
330
  }
331
- const Ht = "3.0.42";
331
+ const Ht = "3.0.43";
332
332
  console.info(
333
333
  `Vehicle Search v${Ht} powered by Partbot https://mmyvs.partbot.io`
334
334
  );
@@ -429,7 +429,9 @@ function Kt({
429
429
  t
430
430
  )
431
431
  ), Qe.__loaded || Qe.init("phc_mLZkVvweXDfwCPYS7kSCxoAxgQUkw8fgyDiplKnleGw", {
432
- api_host: "https://app.posthog.com",
432
+ api_host: "https://t.partbot.io",
433
+ ui_host: "https://us.posthog.com",
434
+ defaults: "2026-01-30",
433
435
  autocapture: !1,
434
436
  capture_pageview: !1,
435
437
  capture_pageleave: !1,
@@ -58,4 +58,4 @@ Hint: It might not be working because maybe you're not up to date with the Meili
58
58
  ${i.stack}.`,Promise.reject(i)}}function Fy(t){return Buffer.from(JSON.stringify(t)).toString("base64")}async function iC(t,e,n){const{createHmac:r}=await Promise.resolve().then(()=>uP);return r("sha256",t).update(`${e}.${n}`).digest("base64").replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function sC(){return Fy({alg:"HS256",typ:"JWT"}).replace(/=/g,"")}function oC(t){const{searchRules:e,uid:n,apiKey:r,expiresAt:i}=t;if(i)if(i instanceof Date){if(i.getTime()<Date.now())throw new gt("Meilisearch: The expiresAt field must be a date in the future.")}else throw new gt("Meilisearch: The expiredAt field must be an instance of Date.");if(e&&!(typeof e=="object"||Array.isArray(e)))throw new gt("Meilisearch: The search rules added in the token generation must be of type array or object.");if(!r||typeof r!="string")throw new gt("Meilisearch: The API key used for the token generation must exist and be of type string.");if(!n||typeof n!="string")throw new gt("Meilisearch: The uid of the api key used for the token generation must exist, be of type string and comply to the uuid4 format.");if(!Z2(n))throw new gt("Meilisearch: The uid of your key is not a valid uuid4. To find out the uid of your key use getKey().")}function aC(t){const{searchRules:e,uid:n,expiresAt:r}=t,i={searchRules:e,apiKeyUid:n,exp:r?Math.floor(r.getTime()/1e3):void 0};return Fy(i).replace(/=/g,"")}class lC{constructor(e){se(this,"config");this.config=e}async generateTenantToken(e,n,r){const i=(r==null?void 0:r.apiKey)||this.config.apiKey||"",s=e||"",o=r==null?void 0:r.expiresAt;oC({apiKey:i,uid:s,expiresAt:o,searchRules:n});const a=sC(),l=aC({searchRules:n,uid:s,expiresAt:o}),u=await iC(i,a,l);return`${a}.${l}.${u}`}}class Ly extends rC{constructor(n){super(n);se(this,"tokens");this.tokens=new lC(n)}async generateTenantToken(n,r,i){return typeof window>"u"?await this.tokens.generateTenantToken(n,r,i):await super.generateTenantToken(n,r,i)}}function uC(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}var Dy=uC,cC=typeof On=="object"&&On&&On.Object===Object&&On,dC=cC,fC=dC,hC=typeof self=="object"&&self&&self.Object===Object&&self,pC=fC||hC||Function("return this")(),Ny=pC,vC=Ny,gC=function(){return vC.Date.now()},mC=gC,yC=/\s/;function _C(t){for(var e=t.length;e--&&yC.test(t.charAt(e)););return e}var wC=_C,bC=wC,xC=/^\s+/;function kC(t){return t&&t.slice(0,bC(t)+1).replace(xC,"")}var SC=kC,EC=Ny,$C=EC.Symbol,jy=$C,zy=jy,Hy=Object.prototype,CC=Hy.hasOwnProperty,RC=Hy.toString,Ko=zy?zy.toStringTag:void 0;function TC(t){var e=CC.call(t,Ko),n=t[Ko];try{t[Ko]=void 0;var r=!0}catch{}var i=RC.call(t);return r&&(e?t[Ko]=n:delete t[Ko]),i}var PC=TC,MC=Object.prototype,OC=MC.toString;function AC(t){return OC.call(t)}var IC=AC,Uy=jy,FC=PC,LC=IC,DC="[object Null]",NC="[object Undefined]",By=Uy?Uy.toStringTag:void 0;function jC(t){return t==null?t===void 0?NC:DC:By&&By in Object(t)?FC(t):LC(t)}var zC=jC;function HC(t){return t!=null&&typeof t=="object"}var UC=HC,BC=zC,qC=UC,VC="[object Symbol]";function WC(t){return typeof t=="symbol"||qC(t)&&BC(t)==VC}var GC=WC,KC=SC,qy=Dy,YC=GC,Vy=NaN,QC=/^[-+]0x[0-9a-f]+$/i,XC=/^0b[01]+$/i,ZC=/^0o[0-7]+$/i,JC=parseInt;function e3(t){if(typeof t=="number")return t;if(YC(t))return Vy;if(qy(t)){var e=typeof t.valueOf=="function"?t.valueOf():t;t=qy(e)?e+"":e}if(typeof t!="string")return t===0?t:+t;t=KC(t);var n=XC.test(t);return n||ZC.test(t)?JC(t.slice(2),n?2:8):QC.test(t)?Vy:+t}var t3=e3,n3=Dy,Vf=mC,Wy=t3,r3="Expected a function",i3=Math.max,s3=Math.min;function o3(t,e,n){var r,i,s,o,a,l,u=0,c=!1,f=!1,d=!0;if(typeof t!="function")throw new TypeError(r3);e=Wy(e)||0,n3(n)&&(c=!!n.leading,f="maxWait"in n,s=f?i3(Wy(n.maxWait)||0,e):s,d="trailing"in n?!!n.trailing:d);function h(k){var $=r,C=i;return r=i=void 0,u=k,o=t.apply(C,$),o}function p(k){return u=k,a=setTimeout(m,e),c?h(k):o}function v(k){var $=k-l,C=k-u,q=e-$;return f?s3(q,s-C):q}function w(k){var $=k-l,C=k-u;return l===void 0||$>=e||$<0||f&&C>=s}function m(){var k=Vf();if(w(k))return g(k);a=setTimeout(m,v(k))}function g(k){return a=void 0,d&&r?h(k):(r=i=void 0,o)}function y(){a!==void 0&&clearTimeout(a),u=0,r=l=i=a=void 0}function b(){return a===void 0?o:g(Vf())}function x(){var k=Vf(),$=w(k);if(r=arguments,i=this,l=k,$){if(a===void 0)return p(l);if(f)return clearTimeout(a),a=setTimeout(m,e),h(l)}return a===void 0&&(a=setTimeout(m,e)),o}return x.cancel=y,x.flush=b,x}var a3=o3;const l3=js(a3);function ru(t){"@babel/helpers - typeof";return ru=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},ru(t)}var u3=/^\s+/,c3=/\s+$/;function X(t,e){if(t=t||"",e=e||{},t instanceof X)return t;if(!(this instanceof X))return new X(t,e);var n=d3(t);this._originalInput=t,this._r=n.r,this._g=n.g,this._b=n.b,this._a=n.a,this._roundA=Math.round(100*this._a)/100,this._format=e.format||n.format,this._gradientType=e.gradientType,this._r<1&&(this._r=Math.round(this._r)),this._g<1&&(this._g=Math.round(this._g)),this._b<1&&(this._b=Math.round(this._b)),this._ok=n.ok}X.prototype={isDark:function(){return this.getBrightness()<128},isLight:function(){return!this.isDark()},isValid:function(){return this._ok},getOriginalInput:function(){return this._originalInput},getFormat:function(){return this._format},getAlpha:function(){return this._a},getBrightness:function(){var e=this.toRgb();return(e.r*299+e.g*587+e.b*114)/1e3},getLuminance:function(){var e=this.toRgb(),n,r,i,s,o,a;return n=e.r/255,r=e.g/255,i=e.b/255,n<=.03928?s=n/12.92:s=Math.pow((n+.055)/1.055,2.4),r<=.03928?o=r/12.92:o=Math.pow((r+.055)/1.055,2.4),i<=.03928?a=i/12.92:a=Math.pow((i+.055)/1.055,2.4),.2126*s+.7152*o+.0722*a},setAlpha:function(e){return this._a=Zy(e),this._roundA=Math.round(100*this._a)/100,this},toHsv:function(){var e=Ky(this._r,this._g,this._b);return{h:e.h*360,s:e.s,v:e.v,a:this._a}},toHsvString:function(){var e=Ky(this._r,this._g,this._b),n=Math.round(e.h*360),r=Math.round(e.s*100),i=Math.round(e.v*100);return this._a==1?"hsv("+n+", "+r+"%, "+i+"%)":"hsva("+n+", "+r+"%, "+i+"%, "+this._roundA+")"},toHsl:function(){var e=Gy(this._r,this._g,this._b);return{h:e.h*360,s:e.s,l:e.l,a:this._a}},toHslString:function(){var e=Gy(this._r,this._g,this._b),n=Math.round(e.h*360),r=Math.round(e.s*100),i=Math.round(e.l*100);return this._a==1?"hsl("+n+", "+r+"%, "+i+"%)":"hsla("+n+", "+r+"%, "+i+"%, "+this._roundA+")"},toHex:function(e){return Yy(this._r,this._g,this._b,e)},toHexString:function(e){return"#"+this.toHex(e)},toHex8:function(e){return v3(this._r,this._g,this._b,this._a,e)},toHex8String:function(e){return"#"+this.toHex8(e)},toRgb:function(){return{r:Math.round(this._r),g:Math.round(this._g),b:Math.round(this._b),a:this._a}},toRgbString:function(){return this._a==1?"rgb("+Math.round(this._r)+", "+Math.round(this._g)+", "+Math.round(this._b)+")":"rgba("+Math.round(this._r)+", "+Math.round(this._g)+", "+Math.round(this._b)+", "+this._roundA+")"},toPercentageRgb:function(){return{r:Math.round(Ie(this._r,255)*100)+"%",g:Math.round(Ie(this._g,255)*100)+"%",b:Math.round(Ie(this._b,255)*100)+"%",a:this._a}},toPercentageRgbString:function(){return this._a==1?"rgb("+Math.round(Ie(this._r,255)*100)+"%, "+Math.round(Ie(this._g,255)*100)+"%, "+Math.round(Ie(this._b,255)*100)+"%)":"rgba("+Math.round(Ie(this._r,255)*100)+"%, "+Math.round(Ie(this._g,255)*100)+"%, "+Math.round(Ie(this._b,255)*100)+"%, "+this._roundA+")"},toName:function(){return this._a===0?"transparent":this._a<1?!1:C3[Yy(this._r,this._g,this._b,!0)]||!1},toFilter:function(e){var n="#"+Qy(this._r,this._g,this._b,this._a),r=n,i=this._gradientType?"GradientType = 1, ":"";if(e){var s=X(e);r="#"+Qy(s._r,s._g,s._b,s._a)}return"progid:DXImageTransform.Microsoft.gradient("+i+"startColorstr="+n+",endColorstr="+r+")"},toString:function(e){var n=!!e;e=e||this._format;var r=!1,i=this._a<1&&this._a>=0,s=!n&&i&&(e==="hex"||e==="hex6"||e==="hex3"||e==="hex4"||e==="hex8"||e==="name");return s?e==="name"&&this._a===0?this.toName():this.toRgbString():(e==="rgb"&&(r=this.toRgbString()),e==="prgb"&&(r=this.toPercentageRgbString()),(e==="hex"||e==="hex6")&&(r=this.toHexString()),e==="hex3"&&(r=this.toHexString(!0)),e==="hex4"&&(r=this.toHex8String(!0)),e==="hex8"&&(r=this.toHex8String()),e==="name"&&(r=this.toName()),e==="hsl"&&(r=this.toHslString()),e==="hsv"&&(r=this.toHsvString()),r||this.toHexString())},clone:function(){return X(this.toString())},_applyModification:function(e,n){var r=e.apply(null,[this].concat([].slice.call(n)));return this._r=r._r,this._g=r._g,this._b=r._b,this.setAlpha(r._a),this},lighten:function(){return this._applyModification(_3,arguments)},brighten:function(){return this._applyModification(w3,arguments)},darken:function(){return this._applyModification(b3,arguments)},desaturate:function(){return this._applyModification(g3,arguments)},saturate:function(){return this._applyModification(m3,arguments)},greyscale:function(){return this._applyModification(y3,arguments)},spin:function(){return this._applyModification(x3,arguments)},_applyCombination:function(e,n){return e.apply(null,[this].concat([].slice.call(n)))},analogous:function(){return this._applyCombination(E3,arguments)},complement:function(){return this._applyCombination(k3,arguments)},monochromatic:function(){return this._applyCombination($3,arguments)},splitcomplement:function(){return this._applyCombination(S3,arguments)},triad:function(){return this._applyCombination(Xy,[3])},tetrad:function(){return this._applyCombination(Xy,[4])}},X.fromRatio=function(t,e){if(ru(t)=="object"){var n={};for(var r in t)t.hasOwnProperty(r)&&(r==="a"?n[r]=t[r]:n[r]=Yo(t[r]));t=n}return X(t,e)};function d3(t){var e={r:0,g:0,b:0},n=1,r=null,i=null,s=null,o=!1,a=!1;return typeof t=="string"&&(t=M3(t)),ru(t)=="object"&&(ur(t.r)&&ur(t.g)&&ur(t.b)?(e=f3(t.r,t.g,t.b),o=!0,a=String(t.r).substr(-1)==="%"?"prgb":"rgb"):ur(t.h)&&ur(t.s)&&ur(t.v)?(r=Yo(t.s),i=Yo(t.v),e=p3(t.h,r,i),o=!0,a="hsv"):ur(t.h)&&ur(t.s)&&ur(t.l)&&(r=Yo(t.s),s=Yo(t.l),e=h3(t.h,r,s),o=!0,a="hsl"),t.hasOwnProperty("a")&&(n=t.a)),n=Zy(n),{ok:o,format:t.format||a,r:Math.min(255,Math.max(e.r,0)),g:Math.min(255,Math.max(e.g,0)),b:Math.min(255,Math.max(e.b,0)),a:n}}function f3(t,e,n){return{r:Ie(t,255)*255,g:Ie(e,255)*255,b:Ie(n,255)*255}}function Gy(t,e,n){t=Ie(t,255),e=Ie(e,255),n=Ie(n,255);var r=Math.max(t,e,n),i=Math.min(t,e,n),s,o,a=(r+i)/2;if(r==i)s=o=0;else{var l=r-i;switch(o=a>.5?l/(2-r-i):l/(r+i),r){case t:s=(e-n)/l+(e<n?6:0);break;case e:s=(n-t)/l+2;break;case n:s=(t-e)/l+4;break}s/=6}return{h:s,s:o,l:a}}function h3(t,e,n){var r,i,s;t=Ie(t,360),e=Ie(e,100),n=Ie(n,100);function o(u,c,f){return f<0&&(f+=1),f>1&&(f-=1),f<1/6?u+(c-u)*6*f:f<1/2?c:f<2/3?u+(c-u)*(2/3-f)*6:u}if(e===0)r=i=s=n;else{var a=n<.5?n*(1+e):n+e-n*e,l=2*n-a;r=o(l,a,t+1/3),i=o(l,a,t),s=o(l,a,t-1/3)}return{r:r*255,g:i*255,b:s*255}}function Ky(t,e,n){t=Ie(t,255),e=Ie(e,255),n=Ie(n,255);var r=Math.max(t,e,n),i=Math.min(t,e,n),s,o,a=r,l=r-i;if(o=r===0?0:l/r,r==i)s=0;else{switch(r){case t:s=(e-n)/l+(e<n?6:0);break;case e:s=(n-t)/l+2;break;case n:s=(t-e)/l+4;break}s/=6}return{h:s,s:o,v:a}}function p3(t,e,n){t=Ie(t,360)*6,e=Ie(e,100),n=Ie(n,100);var r=Math.floor(t),i=t-r,s=n*(1-e),o=n*(1-i*e),a=n*(1-(1-i)*e),l=r%6,u=[n,o,s,s,a,n][l],c=[a,n,n,o,s,s][l],f=[s,s,a,n,n,o][l];return{r:u*255,g:c*255,b:f*255}}function Yy(t,e,n,r){var i=[$n(Math.round(t).toString(16)),$n(Math.round(e).toString(16)),$n(Math.round(n).toString(16))];return r&&i[0].charAt(0)==i[0].charAt(1)&&i[1].charAt(0)==i[1].charAt(1)&&i[2].charAt(0)==i[2].charAt(1)?i[0].charAt(0)+i[1].charAt(0)+i[2].charAt(0):i.join("")}function v3(t,e,n,r,i){var s=[$n(Math.round(t).toString(16)),$n(Math.round(e).toString(16)),$n(Math.round(n).toString(16)),$n(Jy(r))];return i&&s[0].charAt(0)==s[0].charAt(1)&&s[1].charAt(0)==s[1].charAt(1)&&s[2].charAt(0)==s[2].charAt(1)&&s[3].charAt(0)==s[3].charAt(1)?s[0].charAt(0)+s[1].charAt(0)+s[2].charAt(0)+s[3].charAt(0):s.join("")}function Qy(t,e,n,r){var i=[$n(Jy(r)),$n(Math.round(t).toString(16)),$n(Math.round(e).toString(16)),$n(Math.round(n).toString(16))];return i.join("")}X.equals=function(t,e){return!t||!e?!1:X(t).toRgbString()==X(e).toRgbString()},X.random=function(){return X.fromRatio({r:Math.random(),g:Math.random(),b:Math.random()})};function g3(t,e){e=e===0?0:e||10;var n=X(t).toHsl();return n.s-=e/100,n.s=iu(n.s),X(n)}function m3(t,e){e=e===0?0:e||10;var n=X(t).toHsl();return n.s+=e/100,n.s=iu(n.s),X(n)}function y3(t){return X(t).desaturate(100)}function _3(t,e){e=e===0?0:e||10;var n=X(t).toHsl();return n.l+=e/100,n.l=iu(n.l),X(n)}function w3(t,e){e=e===0?0:e||10;var n=X(t).toRgb();return n.r=Math.max(0,Math.min(255,n.r-Math.round(255*-(e/100)))),n.g=Math.max(0,Math.min(255,n.g-Math.round(255*-(e/100)))),n.b=Math.max(0,Math.min(255,n.b-Math.round(255*-(e/100)))),X(n)}function b3(t,e){e=e===0?0:e||10;var n=X(t).toHsl();return n.l-=e/100,n.l=iu(n.l),X(n)}function x3(t,e){var n=X(t).toHsl(),r=(n.h+e)%360;return n.h=r<0?360+r:r,X(n)}function k3(t){var e=X(t).toHsl();return e.h=(e.h+180)%360,X(e)}function Xy(t,e){if(isNaN(e)||e<=0)throw new Error("Argument to polyad must be a positive number");for(var n=X(t).toHsl(),r=[X(t)],i=360/e,s=1;s<e;s++)r.push(X({h:(n.h+s*i)%360,s:n.s,l:n.l}));return r}function S3(t){var e=X(t).toHsl(),n=e.h;return[X(t),X({h:(n+72)%360,s:e.s,l:e.l}),X({h:(n+216)%360,s:e.s,l:e.l})]}function E3(t,e,n){e=e||6,n=n||30;var r=X(t).toHsl(),i=360/n,s=[X(t)];for(r.h=(r.h-(i*e>>1)+720)%360;--e;)r.h=(r.h+i)%360,s.push(X(r));return s}function $3(t,e){e=e||6;for(var n=X(t).toHsv(),r=n.h,i=n.s,s=n.v,o=[],a=1/e;e--;)o.push(X({h:r,s:i,v:s})),s=(s+a)%1;return o}X.mix=function(t,e,n){n=n===0?0:n||50;var r=X(t).toRgb(),i=X(e).toRgb(),s=n/100,o={r:(i.r-r.r)*s+r.r,g:(i.g-r.g)*s+r.g,b:(i.b-r.b)*s+r.b,a:(i.a-r.a)*s+r.a};return X(o)},X.readability=function(t,e){var n=X(t),r=X(e);return(Math.max(n.getLuminance(),r.getLuminance())+.05)/(Math.min(n.getLuminance(),r.getLuminance())+.05)},X.isReadable=function(t,e,n){var r=X.readability(t,e),i,s;switch(s=!1,i=O3(n),i.level+i.size){case"AAsmall":case"AAAlarge":s=r>=4.5;break;case"AAlarge":s=r>=3;break;case"AAAsmall":s=r>=7;break}return s},X.mostReadable=function(t,e,n){var r=null,i=0,s,o,a,l;n=n||{},o=n.includeFallbackColors,a=n.level,l=n.size;for(var u=0;u<e.length;u++)s=X.readability(t,e[u]),s>i&&(i=s,r=X(e[u]));return X.isReadable(t,r,{level:a,size:l})||!o?r:(n.includeFallbackColors=!1,X.mostReadable(t,["#fff","#000"],n))};var Wf=X.names={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"0ff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000",blanchedalmond:"ffebcd",blue:"00f",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",burntsienna:"ea7e5d",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"0ff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkgrey:"a9a9a9",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkslategrey:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dimgrey:"696969",dodgerblue:"1e90ff",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"f0f",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",grey:"808080",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgray:"d3d3d3",lightgreen:"90ee90",lightgrey:"d3d3d3",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslategray:"789",lightslategrey:"789",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"0f0",limegreen:"32cd32",linen:"faf0e6",magenta:"f0f",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370db",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"db7093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",rebeccapurple:"663399",red:"f00",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",slategrey:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",wheat:"f5deb3",white:"fff",whitesmoke:"f5f5f5",yellow:"ff0",yellowgreen:"9acd32"},C3=X.hexNames=R3(Wf);function R3(t){var e={};for(var n in t)t.hasOwnProperty(n)&&(e[t[n]]=n);return e}function Zy(t){return t=parseFloat(t),(isNaN(t)||t<0||t>1)&&(t=1),t}function Ie(t,e){T3(t)&&(t="100%");var n=P3(t);return t=Math.min(e,Math.max(0,parseFloat(t))),n&&(t=parseInt(t*e,10)/100),Math.abs(t-e)<1e-6?1:t%e/parseFloat(e)}function iu(t){return Math.min(1,Math.max(0,t))}function Qt(t){return parseInt(t,16)}function T3(t){return typeof t=="string"&&t.indexOf(".")!=-1&&parseFloat(t)===1}function P3(t){return typeof t=="string"&&t.indexOf("%")!=-1}function $n(t){return t.length==1?"0"+t:""+t}function Yo(t){return t<=1&&(t=t*100+"%"),t}function Jy(t){return Math.round(parseFloat(t)*255).toString(16)}function e_(t){return Qt(t)/255}var Cn=function(){var t="[-\\+]?\\d+%?",e="[-\\+]?\\d*\\.\\d+%?",n="(?:"+e+")|(?:"+t+")",r="[\\s|\\(]+("+n+")[,|\\s]+("+n+")[,|\\s]+("+n+")\\s*\\)?",i="[\\s|\\(]+("+n+")[,|\\s]+("+n+")[,|\\s]+("+n+")[,|\\s]+("+n+")\\s*\\)?";return{CSS_UNIT:new RegExp(n),rgb:new RegExp("rgb"+r),rgba:new RegExp("rgba"+i),hsl:new RegExp("hsl"+r),hsla:new RegExp("hsla"+i),hsv:new RegExp("hsv"+r),hsva:new RegExp("hsva"+i),hex3:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex6:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,hex4:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex8:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/}}();function ur(t){return!!Cn.CSS_UNIT.exec(t)}function M3(t){t=t.replace(u3,"").replace(c3,"").toLowerCase();var e=!1;if(Wf[t])t=Wf[t],e=!0;else if(t=="transparent")return{r:0,g:0,b:0,a:0,format:"name"};var n;return(n=Cn.rgb.exec(t))?{r:n[1],g:n[2],b:n[3]}:(n=Cn.rgba.exec(t))?{r:n[1],g:n[2],b:n[3],a:n[4]}:(n=Cn.hsl.exec(t))?{h:n[1],s:n[2],l:n[3]}:(n=Cn.hsla.exec(t))?{h:n[1],s:n[2],l:n[3],a:n[4]}:(n=Cn.hsv.exec(t))?{h:n[1],s:n[2],v:n[3]}:(n=Cn.hsva.exec(t))?{h:n[1],s:n[2],v:n[3],a:n[4]}:(n=Cn.hex8.exec(t))?{r:Qt(n[1]),g:Qt(n[2]),b:Qt(n[3]),a:e_(n[4]),format:e?"name":"hex8"}:(n=Cn.hex6.exec(t))?{r:Qt(n[1]),g:Qt(n[2]),b:Qt(n[3]),format:e?"name":"hex"}:(n=Cn.hex4.exec(t))?{r:Qt(n[1]+""+n[1]),g:Qt(n[2]+""+n[2]),b:Qt(n[3]+""+n[3]),a:e_(n[4]+""+n[4]),format:e?"name":"hex8"}:(n=Cn.hex3.exec(t))?{r:Qt(n[1]+""+n[1]),g:Qt(n[2]+""+n[2]),b:Qt(n[3]+""+n[3]),format:e?"name":"hex"}:!1}function O3(t){var e,n;return t=t||{level:"AA",size:"small"},e=(t.level||"AA").toUpperCase(),n=(t.size||"small").toLowerCase(),e!=="AA"&&e!=="AAA"&&(e="AA"),n!=="small"&&n!=="large"&&(n="small"),{level:e,size:n}}var E=typeof window<"u"?window:void 0,Lt=typeof globalThis<"u"?globalThis:E,t_=Array.prototype,n_=t_.forEach,r_=t_.indexOf,Xt=Lt==null?void 0:Lt.navigator,B=Lt==null?void 0:Lt.document,Dt=Lt==null?void 0:Lt.location,Gf=Lt==null?void 0:Lt.fetch,Kf=Lt!=null&&Lt.XMLHttpRequest&&"withCredentials"in new Lt.XMLHttpRequest?Lt.XMLHttpRequest:void 0,i_=Lt==null?void 0:Lt.AbortController,Nt=Xt==null?void 0:Xt.userAgent,Z=E??{},cr={DEBUG:!1,LIB_VERSION:"1.270.1"};function s_(t,e,n,r,i,s,o){try{var a=t[s](o),l=a.value}catch(u){return void n(u)}a.done?e(l):Promise.resolve(l).then(r,i)}function o_(t){return function(){var e=this,n=arguments;return new Promise(function(r,i){var s=t.apply(e,n);function o(l){s_(s,r,i,o,a,"next",l)}function a(l){s_(s,r,i,o,a,"throw",l)}o(void 0)})}}function j(){return j=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)({}).hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},j.apply(null,arguments)}function a_(t,e){if(t==null)return{};var n={};for(var r in t)if({}.hasOwnProperty.call(t,r)){if(e.indexOf(r)!==-1)continue;n[r]=t[r]}return n}var A3=["$snapshot","$pageview","$pageleave","$set","survey dismissed","survey sent","survey shown","$identify","$groupidentify","$create_alias","$$client_ingestion_warning","$web_experiment_applied","$feature_enrollment_update","$feature_flag_called"];function ue(t,e){return t.indexOf(e)!==-1}var su=function(t){return t.trim()},Yf=function(t){return t.replace(/^\$/,"")},I3=Array.isArray,l_=Object.prototype,u_=l_.hasOwnProperty,ou=l_.toString,Ce=I3||function(t){return ou.call(t)==="[object Array]"},cn=t=>typeof t=="function",He=t=>t===Object(t)&&!Ce(t),Ss=t=>{if(He(t)){for(var e in t)if(u_.call(t,e))return!1;return!0}return!1},D=t=>t===void 0,Ue=t=>ou.call(t)=="[object String]",Qf=t=>Ue(t)&&t.trim().length===0,dr=t=>t===null,me=t=>D(t)||dr(t),mt=t=>ou.call(t)=="[object Number]",Rn=t=>ou.call(t)==="[object Boolean]",F3=t=>t instanceof FormData,L3=t=>ue(A3,t);function Xf(t){return t===null||typeof t!="object"}function au(t,e){return Object.prototype.toString.call(t)==="[object "+e+"]"}function c_(t){return!D(Event)&&function(e,n){try{return e instanceof n}catch{return!1}}(t,Event)}var D3=[!0,"true",1,"1","yes"],Zf=t=>ue(D3,t),N3=[!1,"false",0,"0","no"];function Zt(t,e,n,r,i){return e>n&&(r.warn("min cannot be greater than max."),e=n),mt(t)?t>n?(r.warn(" cannot be greater than max: "+n+". Using max value instead."),n):t<e?(r.warn(" cannot be less than min: "+e+". Using min value instead."),e):t:(r.warn(" must be a number. using max or fallback. max: "+n+", fallback: "+i),Zt(i||n,e,n,r))}class d_{constructor(e){this.t=e,this.i={},this.o=()=>{Object.keys(this.i).forEach(n=>{var r=this.h(n)+this.m;r>=this.S?delete this.i[n]:this.k(n,r)})},this.h=n=>this.i[String(n)],this.k=(n,r)=>{this.i[String(n)]=r},this.consumeRateLimit=n=>{var r,i,s=(r=this.h(n))!==null&&r!==void 0?r:this.S;if((s=Math.max(s-1,0))===0)return!0;this.k(n,s);var o=s===0;return o&&((i=this.$)==null||i.call(this,n)),o},this.$=this.t.$,this.S=Zt(this.t.bucketSize,0,100,this.t.R),this.m=Zt(this.t.refillRate,0,this.S,this.t.R),this.I=Zt(this.t.refillInterval,0,864e5,this.t.R),this.P=setInterval(()=>{this.o()},this.I)}stop(){this.P&&(clearInterval(this.P),this.P=void 0)}}var lu,f_,Jf,j3=t=>t instanceof Error;function z3(t){var e=globalThis._posthogChunkIds;if(e){var n=Object.keys(e);return Jf&&n.length===f_||(f_=n.length,Jf=n.reduce((r,i)=>{lu||(lu={});var s=lu[i];if(s)r[s[0]]=s[1];else for(var o=t(i),a=o.length-1;a>=0;a--){var l=o[a],u=l==null?void 0:l.filename,c=e[i];if(u&&c){r[u]=c,lu[i]=[u,c];break}}return r},{})),Jf}}var Es="?";function eh(t,e,n,r){var i={platform:"web:javascript",filename:t,function:e==="<anonymous>"?Es:e,in_app:!0};return D(n)||(i.lineno=n),D(r)||(i.colno=r),i}var h_=(t,e)=>{var n=t.indexOf("safari-extension")!==-1,r=t.indexOf("safari-web-extension")!==-1;return n||r?[t.indexOf("@")!==-1?t.split("@")[0]:Es,n?"safari-extension:"+e:"safari-web-extension:"+e]:[t,e]},H3=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,U3=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,B3=/\((\S*)(?::(\d+))(?::(\d+))\)/,q3=t=>{var e=H3.exec(t);if(e){var[,n,r,i]=e;return eh(n,Es,+r,+i)}var s=U3.exec(t);if(s){if(s[2]&&s[2].indexOf("eval")===0){var o=B3.exec(s[2]);o&&(s[2]=o[1],s[3]=o[2],s[4]=o[3])}var[a,l]=h_(s[1]||Es,s[2]);return eh(l,a,s[3]?+s[3]:void 0,s[4]?+s[4]:void 0)}},V3=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,W3=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,G3=t=>{var e=V3.exec(t);if(e){if(e[3]&&e[3].indexOf(" > eval")>-1){var n=W3.exec(e[3]);n&&(e[1]=e[1]||"eval",e[3]=n[1],e[4]=n[2],e[5]="")}var r=e[3],i=e[1]||Es;return[i,r]=h_(i,r),eh(r,i,e[4]?+e[4]:void 0,e[5]?+e[5]:void 0)}},p_=/\(error: (.*)\)/,v_=50;function K3(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return function(r,i){i===void 0&&(i=0);for(var s=[],o=r.split(`
59
59
  `),a=i;a<o.length;a++){var l=o[a];if(!(l.length>1024)){var u=p_.test(l)?l.replace(p_,"$1"):l;if(!u.match(/\S*Error: /)){for(var c of e){var f=c(u);if(f){s.push(f);break}}if(s.length>=v_)break}}}return function(d){if(!d.length)return[];var h=Array.from(d);return h.reverse(),h.slice(0,v_).map(p=>{return j({},p,{filename:p.filename||(v=h,v[v.length-1]||{}).filename,function:p.function||Es});var v})}(s)}}class Y3{constructor(e,n,r){e===void 0&&(e=[]),n===void 0&&(n=[]),r===void 0&&(r=[]),this.coercers=e,this.modifiers=r,this.stackParser=K3(...n)}buildFromUnknown(e,n){n===void 0&&(n={});var r=n&&n.mechanism||{handled:!0,type:"generic"},i=this.buildCoercingContext(r,n,0).apply(e),s=this.buildParsingContext(),o=this.parseStacktrace(i,s);return{$exception_list:this.convertToExceptionList(o,r),$exception_level:"error"}}modifyFrames(e){var n=this;return o_(function*(){for(var r of e)r.stacktrace&&r.stacktrace.frames&&Ce(r.stacktrace.frames)&&(r.stacktrace.frames=yield n.applyModifiers(r.stacktrace.frames));return e})()}coerceFallback(e){var n;return{type:"Error",value:"Unknown error",stack:(n=e.syntheticException)==null?void 0:n.stack,synthetic:!0}}parseStacktrace(e,n){var r,i;return e.cause!=null&&(r=this.parseStacktrace(e.cause,n)),e.stack!=""&&e.stack!=null&&(i=this.applyChunkIds(this.stackParser(e.stack,e.synthetic?1:0),n.chunkIdMap)),j({},e,{cause:r,stack:i})}applyChunkIds(e,n){return e.map(r=>(r.filename&&n&&(r.chunk_id=n[r.filename]),r))}applyCoercers(e,n){for(var r of this.coercers)if(r.match(e))return r.coerce(e,n);return this.coerceFallback(n)}applyModifiers(e){var n=this;return o_(function*(){var r=e;for(var i of n.modifiers)r=yield i(r);return r})()}convertToExceptionList(e,n){var r,i,s,o={type:e.type,value:e.value,mechanism:{type:(r=n.type)!==null&&r!==void 0?r:"generic",handled:(i=n.handled)===null||i===void 0||i,synthetic:(s=e.synthetic)!==null&&s!==void 0&&s}};e.stack&&(o.stacktrace={type:"raw",frames:e.stack});var a=[o];return e.cause!=null&&a.push(...this.convertToExceptionList(e.cause,j({},n,{handled:!0}))),a}buildParsingContext(){return{chunkIdMap:z3(this.stackParser)}}buildCoercingContext(e,n,r){r===void 0&&(r=0);var i=(s,o)=>{if(o<=4){var a=this.buildCoercingContext(e,n,o);return this.applyCoercers(s,a)}};return j({},n,{syntheticException:r==0?n.syntheticException:void 0,mechanism:e,apply:s=>i(s,r),next:s=>i(s,r+1)})}}class Q3{match(e){return this.isDOMException(e)||this.isDOMError(e)}coerce(e,n){var r=Ue(e.stack);return{type:this.getType(e),value:this.getValue(e),stack:r?e.stack:void 0,cause:e.cause?n.next(e.cause):void 0,synthetic:!1}}getType(e){return this.isDOMError(e)?"DOMError":"DOMException"}getValue(e){var n=e.name||(this.isDOMError(e)?"DOMError":"DOMException");return e.message?n+": "+e.message:n}isDOMException(e){return au(e,"DOMException")}isDOMError(e){return au(e,"DOMError")}}class X3{match(e){return(n=>n instanceof Error)(e)}coerce(e,n){return{type:this.getType(e),value:this.getMessage(e,n),stack:this.getStack(e),cause:e.cause?n.next(e.cause):void 0,synthetic:!1}}getType(e){return e.name||e.constructor.name}getMessage(e,n){var r=e.message;return r.error&&typeof r.error.message=="string"?String(r.error.message):String(r)}getStack(e){return e.stacktrace||e.stack||void 0}}class Z3{constructor(){}match(e){return au(e,"ErrorEvent")&&e.error!=null}coerce(e,n){var r,i=n.apply(e.error);return i||{type:"ErrorEvent",value:e.message,stack:(r=n.syntheticException)==null?void 0:r.stack,synthetic:!0}}}var J3=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;class eR{match(e){return typeof e=="string"}coerce(e,n){var r,[i,s]=this.getInfos(e);return{type:i??"Error",value:s??e,stack:(r=n.syntheticException)==null?void 0:r.stack,synthetic:!0}}getInfos(e){var n="Error",r=e,i=e.match(J3);return i&&(n=i[1],r=i[2]),[n,r]}}var tR=["fatal","error","warning","log","info","debug"];function g_(t,e){e===void 0&&(e=40);var n=Object.keys(t);if(n.sort(),!n.length)return"[object has no keys]";for(var r=n.length;r>0;r--){var i=n.slice(0,r).join(", ");if(!(i.length>e))return r===n.length||i.length<=e?i:i.slice(0,e)+"..."}return""}class nR{match(e){return typeof e=="object"&&e!==null}coerce(e,n){var r,i=this.getErrorPropertyFromObject(e);return i?n.apply(i):{type:this.getType(e),value:this.getValue(e),stack:(r=n.syntheticException)==null?void 0:r.stack,level:this.isSeverityLevel(e.level)?e.level:"error",synthetic:!0}}getType(e){return c_(e)?e.constructor.name:"Error"}getValue(e){if("name"in e&&typeof e.name=="string"){var n="'"+e.name+"' captured as exception";return"message"in e&&typeof e.message=="string"&&(n+=" with message: '"+e.message+"'"),n}if("message"in e&&typeof e.message=="string")return e.message;var r=this.getObjectClassName(e);return(r&&r!=="Object"?"'"+r+"'":"Object")+" captured as exception with keys: "+g_(e)}isSeverityLevel(e){return Ue(e)&&!Qf(e)&&tR.indexOf(e)>=0}getErrorPropertyFromObject(e){for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){var r=e[n];if(j3(r))return r}}getObjectClassName(e){try{var n=Object.getPrototypeOf(e);return n?n.constructor.name:void 0}catch{return}}}class rR{match(e){return c_(e)}coerce(e,n){var r,i=e.constructor.name;return{type:i,value:i+" captured as exception with keys: "+g_(e),stack:(r=n.syntheticException)==null?void 0:r.stack,synthetic:!0}}}class iR{match(e){return Xf(e)}coerce(e,n){var r;return{type:"Error",value:"Primitive value captured as exception: "+String(e),stack:(r=n.syntheticException)==null?void 0:r.stack,synthetic:!0}}}class sR{match(e){return au(e,"PromiseRejectionEvent")}coerce(e,n){var r,i=this.getUnhandledRejectionReason(e);return Xf(i)?{type:"UnhandledRejection",value:"Non-Error promise rejection captured with value: "+String(i),stack:(r=n.syntheticException)==null?void 0:r.stack,synthetic:!0}:n.apply(i)}getUnhandledRejectionReason(e){if(Xf(e))return e;try{if("reason"in e)return e.reason;if("detail"in e&&"reason"in e.detail)return e.detail.reason}catch{}return e}}var m_=t=>{var e={T:function(n){if(E&&(cr.DEBUG||Z.POSTHOG_DEBUG)&&!D(E.console)&&E.console){for(var r=("__rrweb_original__"in E.console[n])?E.console[n].__rrweb_original__:E.console[n],i=arguments.length,s=new Array(i>1?i-1:0),o=1;o<i;o++)s[o-1]=arguments[o];r(t,...s)}},info:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];e.T("log",...r)},warn:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];e.T("warn",...r)},error:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];e.T("error",...r)},critical:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];console.error(t,...r)},uninitializedWarning:n=>{e.error("You must initialize PostHog before calling "+n)},createLogger:n=>m_(t+" "+n)};return e},U=m_("[PostHog.js]"),Je=U.createLogger,oR=Je("[ExternalScriptsLoader]"),y_=(t,e,n)=>{if(t.config.disable_external_dependency_loading)return oR.warn(e+" was requested but loading of external scripts is disabled."),n("Loading of external scripts is disabled");var r=B==null?void 0:B.querySelectorAll("script");if(r){for(var i,s=function(){if(r[o].src===e){var l=r[o];return l.__posthog_loading_callback_fired?{v:n()}:(l.addEventListener("load",u=>{l.__posthog_loading_callback_fired=!0,n(void 0,u)}),l.onerror=u=>n(u),{v:void 0})}},o=0;o<r.length;o++)if(i=s())return i.v}var a=()=>{if(!B)return n("document not found");var l=B.createElement("script");if(l.type="text/javascript",l.crossOrigin="anonymous",l.src=e,l.onload=f=>{l.__posthog_loading_callback_fired=!0,n(void 0,f)},l.onerror=f=>n(f),t.config.prepare_external_dependency_script&&(l=t.config.prepare_external_dependency_script(l)),!l)return n("prepare_external_dependency_script returned null");var u,c=B.querySelectorAll("body > script");c.length>0?(u=c[0].parentNode)==null||u.insertBefore(l,c[0]):B.body.appendChild(l)};B!=null&&B.body?a():B==null||B.addEventListener("DOMContentLoaded",a)};Z.__PosthogExtensions__=Z.__PosthogExtensions__||{},Z.__PosthogExtensions__.loadExternalDependency=(t,e,n)=>{var r="/static/"+e+".js?v="+t.version;if(e==="remote-config"&&(r="/array/"+t.config.token+"/config.js"),e==="toolbar"){var i=3e5;r=r+"&t="+Math.floor(Date.now()/i)*i}var s=t.requestRouter.endpointFor("assets",r);y_(t,s,n)},Z.__PosthogExtensions__.loadSiteApp=(t,e,n)=>{var r=t.requestRouter.endpointFor("api",e);y_(t,r,n)};var uu={};function Vr(t,e,n){if(Ce(t)){if(n_&&t.forEach===n_)t.forEach(e,n);else if("length"in t&&t.length===+t.length){for(var r=0,i=t.length;r<i;r++)if(r in t&&e.call(n,t[r],r)===uu)return}}}function Se(t,e,n){if(!me(t)){if(Ce(t))return Vr(t,e,n);if(F3(t)){for(var r of t.entries())if(e.call(n,r[1],r[0])===uu)return}else for(var i in t)if(u_.call(t,i)&&e.call(n,t[i],i)===uu)return}}var Ve=function(t){for(var e=arguments.length,n=new Array(e>1?e-1:0),r=1;r<e;r++)n[r-1]=arguments[r];return Vr(n,function(i){for(var s in i)i[s]!==void 0&&(t[s]=i[s])}),t},cu=function(t){for(var e=arguments.length,n=new Array(e>1?e-1:0),r=1;r<e;r++)n[r-1]=arguments[r];return Vr(n,function(i){Vr(i,function(s){t.push(s)})}),t};function du(t){for(var e=Object.keys(t),n=e.length,r=new Array(n);n--;)r[n]=[e[n],t[e[n]]];return r}var __=function(t){try{return t()}catch{return}},aR=function(t){return function(){try{for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];return t.apply(this,n)}catch(i){U.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),U.critical(i)}}},th=function(t){var e={};return Se(t,function(n,r){(Ue(n)&&n.length>0||mt(n))&&(e[r]=n)}),e};function lR(t,e){return n=t,r=s=>Ue(s)&&!dr(e)?s.slice(0,e):s,i=new Set,function s(o,a){return o!==Object(o)?r?r(o,a):o:i.has(o)?void 0:(i.add(o),Ce(o)?(l=[],Vr(o,u=>{l.push(s(u))})):(l={},Se(o,(u,c)=>{i.has(u)||(l[c]=s(u,c))})),l);var l}(n);var n,r,i}var uR=["herokuapp.com","vercel.app","netlify.app"];function cR(t){var e=t==null?void 0:t.hostname;if(!Ue(e))return!1;var n=e.split(".").slice(-2).join(".");for(var r of uR)if(n===r)return!1;return!0}function w_(t,e){for(var n=0;n<t.length;n++)if(e(t[n]))return t[n]}function Ne(t,e,n,r){var{capture:i=!1,passive:s=!0}=r??{};t==null||t.addEventListener(e,n,{capture:i,passive:s})}var b_="$people_distinct_id",Qo="__alias",Xo="__timers",x_="$autocapture_disabled_server_side",nh="$heatmaps_enabled_server_side",k_="$exception_capture_enabled_server_side",rh="$error_tracking_suppression_rules",S_="$error_tracking_capture_extension_exceptions",E_="$web_vitals_enabled_server_side",$_="$dead_clicks_enabled_server_side",C_="$web_vitals_allowed_metrics",ih="$session_recording_remote_config",sh="$session_recording_enabled_server_side",R_="$console_log_recording_enabled_server_side",T_="$session_recording_network_payload_capture",P_="$session_recording_masking",M_="$session_recording_canvas_recording",O_="$replay_sample_rate",A_="$replay_minimum_duration",I_="$replay_script_config",fu="$sesid",$s="$session_is_sampled",oh="$session_recording_url_trigger_activated_session",ah="$session_recording_event_trigger_activated_session",Cs="$enabled_feature_flags",Zo="$early_access_features",lh="$feature_flag_details",Jo="$stored_person_properties",Ri="$stored_group_properties",uh="$surveys",hu="$surveys_activated",pu="$flag_call_reported",fr="$user_state",ch="$client_session_props",dh="$capture_rate_limit",fh="$initial_campaign_params",hh="$initial_referrer_info",vu="$initial_person_info",gu="$epp",F_="__POSTHOG_TOOLBAR__",ea="$posthog_cookieless",dR=[b_,Qo,"__cmpns",Xo,sh,nh,fu,Cs,rh,fr,Zo,lh,Ri,Jo,uh,pu,ch,dh,fh,hh,gu,vu];function L_(t){return t instanceof Element&&(t.id===F_||!(t.closest==null||!t.closest(".toolbar-global-fade-container")))}function mu(t){return!!t&&t.nodeType===1}function Wr(t,e){return!!t&&!!t.tagName&&t.tagName.toLowerCase()===e.toLowerCase()}function D_(t){return!!t&&t.nodeType===3}function N_(t){return!!t&&t.nodeType===11}function ph(t){return t?su(t).split(/\s+/):[]}function j_(t){var e=E==null?void 0:E.location.href;return!!(e&&t&&t.some(n=>e.match(n)))}function yu(t){var e="";switch(typeof t.className){case"string":e=t.className;break;case"object":e=(t.className&&"baseVal"in t.className?t.className.baseVal:null)||t.getAttribute("class")||"";break;default:e=""}return ph(e)}function z_(t){return me(t)?null:su(t).split(/(\s+)/).filter(e=>Rs(e)).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function _u(t){var e="";return mh(t)&&!W_(t)&&t.childNodes&&t.childNodes.length&&Se(t.childNodes,function(n){var r;D_(n)&&n.textContent&&(e+=(r=z_(n.textContent))!==null&&r!==void 0?r:"")}),su(e)}function H_(t){return D(t.target)?t.srcElement||null:(e=t.target)!=null&&e.shadowRoot?t.composedPath()[0]||null:t.target||null;var e}var vh=["a","button","form","input","select","textarea","label"];function U_(t,e){if(D(e))return!0;var n,r=function(s){if(e.some(o=>s.matches(o)))return{v:!0}};for(var i of t)if(n=r(i))return n.v;return!1}function B_(t){var e=t.parentNode;return!(!e||!mu(e))&&e}var q_=[".ph-no-rageclick",".ph-no-capture"],gh=t=>!t||Wr(t,"html")||!mu(t),V_=(t,e)=>{if(!E||gh(t))return{parentIsUsefulElement:!1,targetElementList:[]};for(var n=!1,r=[t],i=t;i.parentNode&&!Wr(i,"body");)if(N_(i.parentNode))r.push(i.parentNode.host),i=i.parentNode.host;else{var s=B_(i);if(!s)break;if(e||vh.indexOf(s.tagName.toLowerCase())>-1)n=!0;else{var o=E.getComputedStyle(s);o&&o.getPropertyValue("cursor")==="pointer"&&(n=!0)}r.push(s),i=s}return{parentIsUsefulElement:n,targetElementList:r}};function fR(t,e,n,r,i){var s,o,a,l;if(n===void 0&&(n=void 0),!E||gh(t)||(s=n)!=null&&s.url_allowlist&&!j_(n.url_allowlist)||(o=n)!=null&&o.url_ignorelist&&j_(n.url_ignorelist))return!1;if((a=n)!=null&&a.dom_event_allowlist){var u=n.dom_event_allowlist;if(u&&!u.some(p=>e.type===p))return!1}var{parentIsUsefulElement:c,targetElementList:f}=V_(t,r);if(!function(p,v){var w=v==null?void 0:v.element_allowlist;if(D(w))return!0;var m,g=function(b){if(w.some(x=>b.tagName.toLowerCase()===x))return{v:!0}};for(var y of p)if(m=g(y))return m.v;return!1}(f,n)||!U_(f,(l=n)==null?void 0:l.css_selector_allowlist))return!1;var d=E.getComputedStyle(t);if(d&&d.getPropertyValue("cursor")==="pointer"&&e.type==="click")return!0;var h=t.tagName.toLowerCase();switch(h){case"html":return!1;case"form":return(i||["submit"]).indexOf(e.type)>=0;case"input":case"select":case"textarea":return(i||["change","click"]).indexOf(e.type)>=0;default:return c?(i||["click"]).indexOf(e.type)>=0:(i||["click"]).indexOf(e.type)>=0&&(vh.indexOf(h)>-1||t.getAttribute("contenteditable")==="true")}}function mh(t){for(var e=t;e.parentNode&&!Wr(e,"body");e=e.parentNode){var n=yu(e);if(ue(n,"ph-sensitive")||ue(n,"ph-no-capture"))return!1}if(ue(yu(t),"ph-include"))return!0;var r=t.type||"";if(Ue(r))switch(r.toLowerCase()){case"hidden":case"password":return!1}var i=t.name||t.id||"";return!(Ue(i)&&/^cc|cardnum|ccnum|creditcard|csc|cvc|cvv|exp|pass|pwd|routing|seccode|securitycode|securitynum|socialsec|socsec|ssn/i.test(i.replace(/[^a-zA-Z0-9]/g,"")))}function W_(t){return!!(Wr(t,"input")&&!["button","checkbox","submit","reset"].includes(t.type)||Wr(t,"select")||Wr(t,"textarea")||t.getAttribute("contenteditable")==="true")}var G_="(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})",hR=new RegExp("^(?:"+G_+")$"),pR=new RegExp(G_),K_="\\d{3}-?\\d{2}-?\\d{4}",vR=new RegExp("^("+K_+")$"),gR=new RegExp("("+K_+")");function Rs(t,e){return e===void 0&&(e=!0),!(me(t)||Ue(t)&&(t=su(t),(e?hR:pR).test((t||"").replace(/[- ]/g,""))||(e?vR:gR).test(t)))}function Y_(t){var e=_u(t);return Rs(e=(e+" "+Q_(t)).trim())?e:""}function Q_(t){var e="";return t&&t.childNodes&&t.childNodes.length&&Se(t.childNodes,function(n){var r;if(n&&((r=n.tagName)==null?void 0:r.toLowerCase())==="span")try{var i=_u(n);e=(e+" "+i).trim(),n.childNodes&&n.childNodes.length&&(e=(e+" "+Q_(n)).trim())}catch(s){U.error("[AutoCapture]",s)}}),e}function mR(t){return function(e){var n=e.map(r=>{var i,s,o="";if(r.tag_name&&(o+=r.tag_name),r.attr_class)for(var a of(r.attr_class.sort(),r.attr_class))o+="."+a.replace(/"/g,"");var l=j({},r.text?{text:r.text}:{},{"nth-child":(i=r.nth_child)!==null&&i!==void 0?i:0,"nth-of-type":(s=r.nth_of_type)!==null&&s!==void 0?s:0},r.href?{href:r.href}:{},r.attr_id?{attr_id:r.attr_id}:{},r.attributes),u={};return du(l).sort((c,f)=>{var[d]=c,[h]=f;return d.localeCompare(h)}).forEach(c=>{var[f,d]=c;return u[X_(f.toString())]=X_(d.toString())}),o+=":",o+=du(u).map(c=>{var[f,d]=c;return f+'="'+d+'"'}).join("")});return n.join(";")}(function(e){return e.map(n=>{var r,i,s={text:(r=n.$el_text)==null?void 0:r.slice(0,400),tag_name:n.tag_name,href:(i=n.attr__href)==null?void 0:i.slice(0,2048),attr_class:yR(n),attr_id:n.attr__id,nth_child:n.nth_child,nth_of_type:n.nth_of_type,attributes:{}};return du(n).filter(o=>{var[a]=o;return a.indexOf("attr__")===0}).forEach(o=>{var[a,l]=o;return s.attributes[a]=l}),s})}(t))}function X_(t){return t.replace(/"|\\"/g,'\\"')}function yR(t){var e=t.attr__class;return e?Ce(e)?e:ph(e):void 0}class Z_{constructor(){this.clicks=[]}isRageClick(e,n,r){var i=this.clicks[this.clicks.length-1];if(i&&Math.abs(e-i.x)+Math.abs(n-i.y)<30&&r-i.timestamp<1e3){if(this.clicks.push({x:e,y:n,timestamp:r}),this.clicks.length===3)return!0}else this.clicks=[{x:e,y:n,timestamp:r}];return!1}}var yh="$copy_autocapture",hr=function(t){return t.GZipJS="gzip-js",t.Base64="base64",t}({}),_R=["localhost","127.0.0.1"],Ts=t=>{var e=B==null?void 0:B.createElement("a");return D(e)?null:(e.href=t,e)},wR=function(t,e){var n,r;e===void 0&&(e="&");var i=[];return Se(t,function(s,o){D(s)||D(o)||o==="undefined"||(n=encodeURIComponent((a=>a instanceof File)(s)?s.name:s.toString()),r=encodeURIComponent(o),i[i.length]=r+"="+n)}),i.join(e)},wu=function(t,e){for(var n,r=((t.split("#")[0]||"").split(/\?(.*)/)[1]||"").replace(/^\?+/g,"").split("&"),i=0;i<r.length;i++){var s=r[i].split("=");if(s[0]===e){n=s;break}}if(!Ce(n)||n.length<2)return"";var o=n[1];try{o=decodeURIComponent(o)}catch{U.error("Skipping decoding for malformed query param: "+o)}return o.replace(/\+/g," ")},_h=function(t,e,n){if(!t||!e||!e.length)return t;for(var r=t.split("#"),i=r[0]||"",s=r[1],o=i.split("?"),a=o[1],l=o[0],u=(a||"").split("&"),c=[],f=0;f<u.length;f++){var d=u[f].split("=");Ce(d)&&(e.includes(d[0])?c.push(d[0]+"="+n):c.push(u[f]))}var h=l;return a!=null&&(h+="?"+c.join("&")),s!=null&&(h+="#"+s),h},bu=function(t,e){var n=t.match(new RegExp(e+"=([^&]*)"));return n?n[1]:null},J_=Je("[AutoCapture]");function wh(t,e){return e.length>t?e.slice(0,t)+"...":e}function bR(t){if(t.previousElementSibling)return t.previousElementSibling;var e=t;do e=e.previousSibling;while(e&&!mu(e));return e}function xR(t,e,n,r){var i=t.tagName.toLowerCase(),s={tag_name:i};vh.indexOf(i)>-1&&!n&&(i.toLowerCase()==="a"||i.toLowerCase()==="button"?s.$el_text=wh(1024,Y_(t)):s.$el_text=wh(1024,_u(t)));var o=yu(t);o.length>0&&(s.classes=o.filter(function(c){return c!==""})),Se(t.attributes,function(c){var f;if((!W_(t)||["name","id","class","aria-label"].indexOf(c.name)!==-1)&&(r==null||!r.includes(c.name))&&!e&&Rs(c.value)&&(f=c.name,!Ue(f)||f.substring(0,10)!=="_ngcontent"&&f.substring(0,7)!=="_nghost")){var d=c.value;c.name==="class"&&(d=ph(d).join(" ")),s["attr__"+c.name]=wh(1024,d)}});for(var a=1,l=1,u=t;u=bR(u);)a++,u.tagName===t.tagName&&l++;return s.nth_child=a,s.nth_of_type=l,s}function kR(t,e){for(var n,r,{e:i,maskAllElementAttributes:s,maskAllText:o,elementAttributeIgnoreList:a,elementsChainAsString:l}=e,u=[t],c=t;c.parentNode&&!Wr(c,"body");)N_(c.parentNode)?(u.push(c.parentNode.host),c=c.parentNode.host):(u.push(c.parentNode),c=c.parentNode);var f,d=[],h={},p=!1,v=!1;if(Se(u,b=>{var x=mh(b);b.tagName.toLowerCase()==="a"&&(p=b.getAttribute("href"),p=x&&p&&Rs(p)&&p),ue(yu(b),"ph-no-capture")&&(v=!0),d.push(xR(b,s,o,a));var k=function($){if(!mh($))return{};var C={};return Se($.attributes,function(q){if(q.name&&q.name.indexOf("data-ph-capture-attribute")===0){var I=q.name.replace("data-ph-capture-attribute-",""),F=q.value;I&&F&&Rs(F)&&(C[I]=F)}}),C}(b);Ve(h,k)}),v)return{props:{},explicitNoCapture:v};if(o||(t.tagName.toLowerCase()==="a"||t.tagName.toLowerCase()==="button"?d[0].$el_text=Y_(t):d[0].$el_text=_u(t)),p){var w,m;d[0].attr__href=p;var g=(w=Ts(p))==null?void 0:w.host,y=E==null||(m=E.location)==null?void 0:m.host;g&&y&&g!==y&&(f=p)}return{props:Ve({$event_type:i.type,$ce_version:1},l?{}:{$elements:d},{$elements_chain:mR(d)},(n=d[0])!=null&&n.$el_text?{$el_text:(r=d[0])==null?void 0:r.$el_text}:{},f&&i.type==="click"?{$external_click_url:f}:{},h)}}class SR{constructor(e){this.C=!1,this.M=null,this.rageclicks=new Z_,this.O=!1,this.instance=e,this.F=null}get A(){var e,n,r=He(this.instance.config.autocapture)?this.instance.config.autocapture:{};return r.url_allowlist=(e=r.url_allowlist)==null?void 0:e.map(i=>new RegExp(i)),r.url_ignorelist=(n=r.url_ignorelist)==null?void 0:n.map(i=>new RegExp(i)),r}D(){if(this.isBrowserSupported()){if(E&&B){var e=r=>{r=r||(E==null?void 0:E.event);try{this.j(r)}catch(i){J_.error("Failed to capture event",i)}};if(Ne(B,"submit",e,{capture:!0}),Ne(B,"change",e,{capture:!0}),Ne(B,"click",e,{capture:!0}),this.A.capture_copied_text){var n=r=>{r=r||(E==null?void 0:E.event),this.j(r,yh)};Ne(B,"copy",n,{capture:!0}),Ne(B,"cut",n,{capture:!0})}}}else J_.info("Disabling Automatic Event Collection because this browser is not supported")}startIfEnabled(){this.isEnabled&&!this.C&&(this.D(),this.C=!0)}onRemoteConfig(e){e.elementsChainAsString&&(this.O=e.elementsChainAsString),this.instance.persistence&&this.instance.persistence.register({[x_]:!!e.autocapture_opt_out}),this.M=!!e.autocapture_opt_out,this.startIfEnabled()}setElementSelectors(e){this.F=e}getElementSelectors(e){var n,r=[];return(n=this.F)==null||n.forEach(i=>{var s=B==null?void 0:B.querySelectorAll(i);s==null||s.forEach(o=>{e===o&&r.push(i)})}),r}get isEnabled(){var e,n,r=(e=this.instance.persistence)==null?void 0:e.props[x_],i=this.M;if(dr(i)&&!Rn(r)&&!this.instance.L())return!1;var s=(n=this.M)!==null&&n!==void 0?n:!!r;return!!this.instance.config.autocapture&&!s}j(e,n){if(n===void 0&&(n="$autocapture"),this.isEnabled){var r,i=H_(e);D_(i)&&(i=i.parentNode||null),n==="$autocapture"&&e.type==="click"&&e instanceof MouseEvent&&this.instance.config.rageclick&&(r=this.rageclicks)!=null&&r.isRageClick(e.clientX,e.clientY,new Date().getTime())&&function(d,h){if(!E||gh(d))return!1;var p,v;if((p=Rn(h)?!!h&&q_:(v=h==null?void 0:h.css_selector_ignorelist)!==null&&v!==void 0?v:q_)===!1)return!1;var{targetElementList:w}=V_(d,!1);return!U_(w,p)}(i,this.instance.config.rageclick)&&this.j(e,"$rageclick");var s=n===yh;if(i&&fR(i,e,this.A,s,s?["copy","cut"]:void 0)){var{props:o,explicitNoCapture:a}=kR(i,{e,maskAllElementAttributes:this.instance.config.mask_all_element_attributes,maskAllText:this.instance.config.mask_all_text,elementAttributeIgnoreList:this.A.element_attribute_ignorelist,elementsChainAsString:this.O});if(a)return!1;var l=this.getElementSelectors(i);if(l&&l.length>0&&(o.$element_selectors=l),n===yh){var u,c=z_(E==null||(u=E.getSelection())==null?void 0:u.toString()),f=e.type||"clipboard";if(!c)return!1;o.$selected_content=c,o.$copy_type=f}return this.instance.capture(n,o),!0}}}isBrowserSupported(){return cn(B==null?void 0:B.querySelectorAll)}}Math.trunc||(Math.trunc=function(t){return t<0?Math.ceil(t):Math.floor(t)}),Number.isInteger||(Number.isInteger=function(t){return mt(t)&&isFinite(t)&&Math.floor(t)===t});var ew="0123456789abcdef";class xu{constructor(e){if(this.bytes=e,e.length!==16)throw new TypeError("not 128-bit length")}static fromFieldsV7(e,n,r,i){if(!Number.isInteger(e)||!Number.isInteger(n)||!Number.isInteger(r)||!Number.isInteger(i)||e<0||n<0||r<0||i<0||e>0xffffffffffff||n>4095||r>1073741823||i>4294967295)throw new RangeError("invalid field value");var s=new Uint8Array(16);return s[0]=e/Math.pow(2,40),s[1]=e/Math.pow(2,32),s[2]=e/Math.pow(2,24),s[3]=e/Math.pow(2,16),s[4]=e/Math.pow(2,8),s[5]=e,s[6]=112|n>>>8,s[7]=n,s[8]=128|r>>>24,s[9]=r>>>16,s[10]=r>>>8,s[11]=r,s[12]=i>>>24,s[13]=i>>>16,s[14]=i>>>8,s[15]=i,new xu(s)}toString(){for(var e="",n=0;n<this.bytes.length;n++)e=e+ew.charAt(this.bytes[n]>>>4)+ew.charAt(15&this.bytes[n]),n!==3&&n!==5&&n!==7&&n!==9||(e+="-");if(e.length!==36)throw new Error("Invalid UUIDv7 was generated");return e}clone(){return new xu(this.bytes.slice(0))}equals(e){return this.compareTo(e)===0}compareTo(e){for(var n=0;n<16;n++){var r=this.bytes[n]-e.bytes[n];if(r!==0)return Math.sign(r)}return 0}}class ER{constructor(){this.N=0,this.U=0,this.B=new $R}generate(){var e=this.generateOrAbort();if(D(e)){this.N=0;var n=this.generateOrAbort();if(D(n))throw new Error("Could not generate UUID after timestamp reset");return n}return e}generateOrAbort(){var e=Date.now();if(e>this.N)this.N=e,this.q();else{if(!(e+1e4>this.N))return;this.U++,this.U>4398046511103&&(this.N++,this.q())}return xu.fromFieldsV7(this.N,Math.trunc(this.U/Math.pow(2,30)),this.U&Math.pow(2,30)-1,this.B.nextUint32())}q(){this.U=1024*this.B.nextUint32()+(1023&this.B.nextUint32())}}var tw,nw=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};E&&!D(E.crypto)&&crypto.getRandomValues&&(nw=t=>crypto.getRandomValues(t));class $R{constructor(){this.H=new Uint32Array(8),this.W=1/0}nextUint32(){return this.W>=this.H.length&&(nw(this.H),this.W=0),this.H[this.W++]}}var Gr=()=>CR().toString(),CR=()=>(tw||(tw=new ER)).generate(),ta="",RR=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i;function TR(t,e){if(e){var n=function(i,s){if(s===void 0&&(s=B),ta)return ta;if(!s||["localhost","127.0.0.1"].includes(i))return"";for(var o=i.split("."),a=Math.min(o.length,8),l="dmn_chk_"+Gr();!ta&&a--;){var u=o.slice(a).join("."),c=l+"=1;domain=."+u+";path=/";s.cookie=c+";max-age=3",s.cookie.includes(l)&&(s.cookie=c+";max-age=0",ta=u)}return ta}(t);if(!n){var r=(i=>{var s=i.match(RR);return s?s[0]:""})(t);r!==n&&U.info("Warning: cookie subdomain discovery mismatch",r,n),n=r}return n?"; domain=."+n:""}return""}var qn={G:()=>!!B,V:function(t){U.error("cookieStore error: "+t)},J:function(t){if(B){try{for(var e=t+"=",n=B.cookie.split(";").filter(s=>s.length),r=0;r<n.length;r++){for(var i=n[r];i.charAt(0)==" ";)i=i.substring(1,i.length);if(i.indexOf(e)===0)return decodeURIComponent(i.substring(e.length,i.length))}}catch{}return null}},K:function(t){var e;try{e=JSON.parse(qn.J(t))||{}}catch{}return e},Y:function(t,e,n,r,i){if(B)try{var s="",o="",a=TR(B.location.hostname,r);if(n){var l=new Date;l.setTime(l.getTime()+24*n*60*60*1e3),s="; expires="+l.toUTCString()}i&&(o="; secure");var u=t+"="+encodeURIComponent(JSON.stringify(e))+s+"; SameSite=Lax; path=/"+a+o;return u.length>3686.4&&U.warn("cookieStore warning: large cookie, len="+u.length),B.cookie=u,u}catch{return}},X:function(t,e){if(B!=null&&B.cookie)try{qn.Y(t,"",-1,e)}catch{return}}},bh=null,et={G:function(){if(!dr(bh))return bh;var t=!0;if(D(E))t=!1;else try{var e="__mplssupport__";et.Y(e,"xyz"),et.J(e)!=='"xyz"'&&(t=!1),et.X(e)}catch{t=!1}return t||U.error("localStorage unsupported; falling back to cookie store"),bh=t,t},V:function(t){U.error("localStorage error: "+t)},J:function(t){try{return E==null?void 0:E.localStorage.getItem(t)}catch(e){et.V(e)}return null},K:function(t){try{return JSON.parse(et.J(t))||{}}catch{}return null},Y:function(t,e){try{E==null||E.localStorage.setItem(t,JSON.stringify(e))}catch(n){et.V(n)}},X:function(t){try{E==null||E.localStorage.removeItem(t)}catch(e){et.V(e)}}},PR=["distinct_id",fu,$s,gu,vu],ku=j({},et,{K:function(t){try{var e={};try{e=qn.K(t)||{}}catch{}var n=Ve(e,JSON.parse(et.J(t)||"{}"));return et.Y(t,n),n}catch{}return null},Y:function(t,e,n,r,i,s){try{et.Y(t,e,void 0,void 0,s);var o={};PR.forEach(a=>{e[a]&&(o[a]=e[a])}),Object.keys(o).length&&qn.Y(t,o,n,r,i,s)}catch(a){et.V(a)}},X:function(t,e){try{E==null||E.localStorage.removeItem(t),qn.X(t,e)}catch(n){et.V(n)}}}),Su={},MR={G:function(){return!0},V:function(t){U.error("memoryStorage error: "+t)},J:function(t){return Su[t]||null},K:function(t){return Su[t]||null},Y:function(t,e){Su[t]=e},X:function(t){delete Su[t]}},Ti=null,ut={G:function(){if(!dr(Ti))return Ti;if(Ti=!0,D(E))Ti=!1;else try{var t="__support__";ut.Y(t,"xyz"),ut.J(t)!=='"xyz"'&&(Ti=!1),ut.X(t)}catch{Ti=!1}return Ti},V:function(t){U.error("sessionStorage error: ",t)},J:function(t){try{return E==null?void 0:E.sessionStorage.getItem(t)}catch(e){ut.V(e)}return null},K:function(t){try{return JSON.parse(ut.J(t))||null}catch{}return null},Y:function(t,e){try{E==null||E.sessionStorage.setItem(t,JSON.stringify(e))}catch(n){ut.V(n)}},X:function(t){try{E==null||E.sessionStorage.removeItem(t)}catch(e){ut.V(e)}}},pr=function(t){return t[t.PENDING=-1]="PENDING",t[t.DENIED=0]="DENIED",t[t.GRANTED=1]="GRANTED",t}({});class OR{constructor(e){this._instance=e}get A(){return this._instance.config}get consent(){return this.Z()?pr.DENIED:this.tt}isOptedOut(){return this.A.cookieless_mode==="always"||this.consent===pr.DENIED||this.consent===pr.PENDING&&(this.A.opt_out_capturing_by_default||this.A.cookieless_mode==="on_reject")}isOptedIn(){return!this.isOptedOut()}isExplicitlyOptedOut(){return this.consent===pr.DENIED}optInOut(e){this.it.Y(this.et,e?1:0,this.A.cookie_expiration,this.A.cross_subdomain_cookie,this.A.secure_cookie)}reset(){this.it.X(this.et,this.A.cross_subdomain_cookie)}get et(){var{token:e,opt_out_capturing_cookie_prefix:n,consent_persistence_name:r}=this._instance.config;return r||(n?n+e:"__ph_opt_in_out_"+e)}get tt(){var e=this.it.J(this.et);return Zf(e)?pr.GRANTED:ue(N3,e)?pr.DENIED:pr.PENDING}get it(){if(!this.rt){var e=this.A.opt_out_capturing_persistence_type;this.rt=e==="localStorage"?et:qn;var n=e==="localStorage"?qn:et;n.J(this.et)&&(this.rt.J(this.et)||this.optInOut(Zf(n.J(this.et))),n.X(this.et,this.A.cross_subdomain_cookie))}return this.rt}Z(){return!!this.A.respect_dnt&&!!w_([Xt==null?void 0:Xt.doNotTrack,Xt==null?void 0:Xt.msDoNotTrack,Z.doNotTrack],e=>Zf(e))}}var Eu=Je("[Dead Clicks]"),AR=()=>!0,IR=t=>{var e,n=!((e=t.instance.persistence)==null||!e.get_property($_)),r=t.instance.config.capture_dead_clicks;return Rn(r)?r:n};class rw{get lazyLoadedDeadClicksAutocapture(){return this.st}constructor(e,n,r){this.instance=e,this.isEnabled=n,this.onCapture=r,this.startIfEnabled()}onRemoteConfig(e){this.instance.persistence&&this.instance.persistence.register({[$_]:e==null?void 0:e.captureDeadClicks}),this.startIfEnabled()}startIfEnabled(){this.isEnabled(this)&&this.nt(()=>{this.ot()})}nt(e){var n,r;(n=Z.__PosthogExtensions__)!=null&&n.initDeadClicksAutocapture&&e(),(r=Z.__PosthogExtensions__)==null||r.loadExternalDependency==null||r.loadExternalDependency(this.instance,"dead-clicks-autocapture",i=>{i?Eu.error("failed to load script",i):e()})}ot(){var e;if(B){if(!this.st&&(e=Z.__PosthogExtensions__)!=null&&e.initDeadClicksAutocapture){var n=He(this.instance.config.capture_dead_clicks)?this.instance.config.capture_dead_clicks:{};n.__onCapture=this.onCapture,this.st=Z.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,n),this.st.start(B),Eu.info("starting...")}}else Eu.error("`document` not found. Cannot start.")}stop(){this.st&&(this.st.stop(),this.st=void 0,Eu.info("stopping..."))}}var na=Je("[ExceptionAutocapture]");class FR{constructor(e){var n,r,i;this.lt=()=>{var s;if(E&&this.isEnabled&&(s=Z.__PosthogExtensions__)!=null&&s.errorWrappingFunctions){var o=Z.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,a=Z.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,l=Z.__PosthogExtensions__.errorWrappingFunctions.wrapConsoleError;try{!this.ut&&this.A.capture_unhandled_errors&&(this.ut=o(this.captureException.bind(this))),!this.ht&&this.A.capture_unhandled_rejections&&(this.ht=a(this.captureException.bind(this))),!this.dt&&this.A.capture_console_errors&&(this.dt=l(this.captureException.bind(this)))}catch(u){na.error("failed to start",u),this.vt()}}},this._instance=e,this.ct=!((n=this._instance.persistence)==null||!n.props[k_]),this.A=this.ft(),this.gt=new d_({refillRate:(r=this._instance.config.error_tracking.__exceptionRateLimiterRefillRate)!==null&&r!==void 0?r:1,bucketSize:(i=this._instance.config.error_tracking.__exceptionRateLimiterBucketSize)!==null&&i!==void 0?i:10,refillInterval:1e4,R:na}),this.startIfEnabled()}ft(){var e=this._instance.config.capture_exceptions,n={capture_unhandled_errors:!1,capture_unhandled_rejections:!1,capture_console_errors:!1};return He(e)?n=j({},n,e):(D(e)?this.ct:e)&&(n=j({},n,{capture_unhandled_errors:!0,capture_unhandled_rejections:!0})),n}get isEnabled(){return this.A.capture_console_errors||this.A.capture_unhandled_errors||this.A.capture_unhandled_rejections}startIfEnabled(){this.isEnabled&&(na.info("enabled"),this.nt(this.lt))}nt(e){var n,r;(n=Z.__PosthogExtensions__)!=null&&n.errorWrappingFunctions&&e(),(r=Z.__PosthogExtensions__)==null||r.loadExternalDependency==null||r.loadExternalDependency(this._instance,"exception-autocapture",i=>{if(i)return na.error("failed to load script",i);e()})}vt(){var e,n,r;(e=this.ut)==null||e.call(this),this.ut=void 0,(n=this.ht)==null||n.call(this),this.ht=void 0,(r=this.dt)==null||r.call(this),this.dt=void 0}onRemoteConfig(e){var n=e.autocaptureExceptions;this.ct=!!n||!1,this.A=this.ft(),this._instance.persistence&&this._instance.persistence.register({[k_]:this.ct}),this.startIfEnabled()}captureException(e){var n,r,i=(n=e==null||(r=e.$exception_list)==null||(r=r[0])==null?void 0:r.type)!==null&&n!==void 0?n:"Exception";this.gt.consumeRateLimit(i)?na.info("Skipping exception capture because of client rate limiting.",{exception:i}):this._instance.exceptions.sendExceptionEvent(e)}}function iw(t,e,n){try{if(!(e in t))return()=>{};var r=t[e],i=n(r);return cn(i)&&(i.prototype=i.prototype||{},Object.defineProperties(i,{__posthog_wrapped__:{enumerable:!1,value:!0}})),t[e]=i,()=>{t[e]=r}}catch{return()=>{}}}class LR{constructor(e){var n;this._instance=e,this._t=(E==null||(n=E.location)==null?void 0:n.pathname)||""}get isEnabled(){return this._instance.config.capture_pageview==="history_change"}startIfEnabled(){this.isEnabled&&(U.info("History API monitoring enabled, starting..."),this.monitorHistoryChanges())}stop(){this.yt&&this.yt(),this.yt=void 0,U.info("History API monitoring stopped")}monitorHistoryChanges(){var e,n;if(E&&E.history){var r=this;(e=E.history.pushState)!=null&&e.__posthog_wrapped__||iw(E.history,"pushState",i=>function(s,o,a){i.call(this,s,o,a),r.bt("pushState")}),(n=E.history.replaceState)!=null&&n.__posthog_wrapped__||iw(E.history,"replaceState",i=>function(s,o,a){i.call(this,s,o,a),r.bt("replaceState")}),this.wt()}}bt(e){try{var n,r=E==null||(n=E.location)==null?void 0:n.pathname;if(!r)return;r!==this._t&&this.isEnabled&&this._instance.capture("$pageview",{navigation_type:e}),this._t=r}catch(i){U.error("Error capturing "+e+" pageview",i)}}wt(){if(!this.yt){var e=()=>{this.bt("popstate")};Ne(E,"popstate",e),this.yt=()=>{E&&E.removeEventListener("popstate",e)}}}}function $u(t){var e,n;return((e=JSON.stringify(t,(n=[],function(r,i){if(He(i)){for(;n.length>0&&n[n.length-1]!==this;)n.pop();return n.includes(i)?"[Circular]":(n.push(i),i)}return i})))==null?void 0:e.length)||0}function xh(t,e){if(e===void 0&&(e=66060288e-1),t.size>=e&&t.data.length>1){var n=Math.floor(t.data.length/2),r=t.data.slice(0,n),i=t.data.slice(n);return[xh({size:$u(r),data:r,sessionId:t.sessionId,windowId:t.windowId}),xh({size:$u(i),data:i,sessionId:t.sessionId,windowId:t.windowId})].flatMap(s=>s)}return[t]}var Vn=(t=>(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))(Vn||{}),Tn=(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",t[t.CustomElement=16]="CustomElement",t))(Tn||{}),kh="[SessionRecording]",Sh="redacted",Cu={initiatorTypes:["audio","beacon","body","css","early-hint","embed","fetch","frame","iframe","icon","image","img","input","link","navigation","object","ping","script","track","video","xmlhttprequest"],maskRequestFn:t=>t,recordHeaders:!1,recordBody:!1,recordInitialRequests:!1,recordPerformance:!1,performanceEntryTypeToObserve:["first-input","navigation","paint","resource"],payloadSizeLimitBytes:1e6,payloadHostDenyList:[".lr-ingest.io",".ingest.sentry.io",".clarity.ms","analytics.google.com","bam.nr-data.net"]},DR=["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"],NR=["password","secret","passwd","api_key","apikey","auth","credentials","mysql_pwd","privatekey","private_key","token"],jR=["/s/","/e/","/i/"];function sw(t,e,n,r){if(me(t))return t;var i=(e==null?void 0:e["content-length"])||function(s){return new Blob([s]).size}(t);return Ue(i)&&(i=parseInt(i)),i>n?kh+" "+r+" body too large to record ("+i+" bytes)":t}function ow(t,e){if(me(t))return t;var n=t;return Rs(n,!1)||(n=kh+" "+e+" body "+Sh),Se(NR,r=>{var i,s;(i=n)!=null&&i.length&&((s=n)==null?void 0:s.indexOf(r))!==-1&&(n=kh+" "+e+" body "+Sh+" as might contain: "+r)}),n}var zR=(t,e)=>{var n,r,i,s={payloadSizeLimitBytes:Cu.payloadSizeLimitBytes,performanceEntryTypeToObserve:[...Cu.performanceEntryTypeToObserve],payloadHostDenyList:[...e.payloadHostDenyList||[],...Cu.payloadHostDenyList]},o=t.session_recording.recordHeaders!==!1&&e.recordHeaders,a=t.session_recording.recordBody!==!1&&e.recordBody,l=t.capture_performance!==!1&&e.recordPerformance,u=(n=s,i=Math.min(1e6,(r=n.payloadSizeLimitBytes)!==null&&r!==void 0?r:1e6),d=>(d!=null&&d.requestBody&&(d.requestBody=sw(d.requestBody,d.requestHeaders,i,"Request")),d!=null&&d.responseBody&&(d.responseBody=sw(d.responseBody,d.responseHeaders,i,"Response")),d)),c=d=>{return u(((v,w)=>{var m,g=Ts(v.name),y=w.indexOf("http")===0?(m=Ts(w))==null?void 0:m.pathname:w;y==="/"&&(y="");var b=g==null?void 0:g.pathname.replace(y||"","");if(!(g&&b&&jR.some(x=>b.indexOf(x)===0)))return v})((p=(h=d).requestHeaders,me(p)||Se(Object.keys(p??{}),v=>{DR.includes(v.toLowerCase())&&(p[v]=Sh)}),h),t.api_host));var h,p},f=cn(t.session_recording.maskNetworkRequestFn);return f&&cn(t.session_recording.maskCapturedNetworkRequestFn)&&U.warn("Both `maskNetworkRequestFn` and `maskCapturedNetworkRequestFn` are defined. `maskNetworkRequestFn` will be ignored."),f&&(t.session_recording.maskCapturedNetworkRequestFn=d=>{var h=t.session_recording.maskNetworkRequestFn({url:d.name});return j({},d,{name:h==null?void 0:h.url})}),s.maskRequestFn=cn(t.session_recording.maskCapturedNetworkRequestFn)?d=>{var h,p=c(d);return p&&(h=t.session_recording.maskCapturedNetworkRequestFn==null?void 0:t.session_recording.maskCapturedNetworkRequestFn(p))!==null&&h!==void 0?h:void 0}:d=>function(h){if(!D(h))return h.requestBody=ow(h.requestBody,"Request"),h.responseBody=ow(h.responseBody,"Response"),h}(c(d)),j({},Cu,s,{recordHeaders:o,recordBody:a,recordPerformance:l,recordInitialRequests:l})};class HR{constructor(e,n){var r,i;n===void 0&&(n={}),this.St={},this.kt=s=>{if(!this.St[s]){var o,a;this.St[s]=!0;var l=this.$t(s);(o=(a=this.t).onBlockedNode)==null||o.call(a,s,l)}},this.xt=s=>{var o=this.$t(s);if((o==null?void 0:o.nodeName)!=="svg"&&o instanceof Element){var a=o.closest("svg");if(a)return[this._rrweb.mirror.getId(a),a]}return[s,o]},this.$t=s=>this._rrweb.mirror.getNode(s),this.Et=s=>{var o,a,l,u,c,f,d,h;return((o=(a=s.removes)==null?void 0:a.length)!==null&&o!==void 0?o:0)+((l=(u=s.attributes)==null?void 0:u.length)!==null&&l!==void 0?l:0)+((c=(f=s.texts)==null?void 0:f.length)!==null&&c!==void 0?c:0)+((d=(h=s.adds)==null?void 0:h.length)!==null&&d!==void 0?d:0)},this.throttleMutations=s=>{if(s.type!==3||s.data.source!==0)return s;var o=s.data,a=this.Et(o);o.attributes&&(o.attributes=o.attributes.filter(u=>{var[c]=this.xt(u.id);return!this.gt.consumeRateLimit(c)&&u}));var l=this.Et(o);return l!==0||a===l?s:void 0},this._rrweb=e,this.t=n,this.gt=new d_({bucketSize:(r=this.t.bucketSize)!==null&&r!==void 0?r:100,refillRate:(i=this.t.refillRate)!==null&&i!==void 0?i:10,refillInterval:1e3,$:this.kt,R:U})}}var dn=Uint8Array,jt=Uint16Array,Ps=Uint32Array,Eh=new dn([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]),$h=new dn([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]),aw=new dn([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),lw=function(t,e){for(var n=new jt(31),r=0;r<31;++r)n[r]=e+=1<<t[r-1];var i=new Ps(n[30]);for(r=1;r<30;++r)for(var s=n[r];s<n[r+1];++s)i[s]=s-n[r]<<5|r;return[n,i]},uw=lw(Eh,2),UR=uw[0],Ch=uw[1];UR[28]=258,Ch[258]=28;for(var cw=lw($h,0)[1],dw=new jt(32768),Pe=0;Pe<32768;++Pe){var Pi=(43690&Pe)>>>1|(21845&Pe)<<1;Pi=(61680&(Pi=(52428&Pi)>>>2|(13107&Pi)<<2))>>>4|(3855&Pi)<<4,dw[Pe]=((65280&Pi)>>>8|(255&Pi)<<8)>>>1}var ra=function(t,e,n){for(var r=t.length,i=0,s=new jt(e);i<r;++i)++s[t[i]-1];var o,a=new jt(e);for(i=0;i<e;++i)a[i]=a[i-1]+s[i-1]<<1;for(o=new jt(r),i=0;i<r;++i)o[i]=dw[a[t[i]-1]++]>>>15-t[i];return o},Mi=new dn(288);for(Pe=0;Pe<144;++Pe)Mi[Pe]=8;for(Pe=144;Pe<256;++Pe)Mi[Pe]=9;for(Pe=256;Pe<280;++Pe)Mi[Pe]=7;for(Pe=280;Pe<288;++Pe)Mi[Pe]=8;var Ru=new dn(32);for(Pe=0;Pe<32;++Pe)Ru[Pe]=5;var BR=ra(Mi,9),qR=ra(Ru,5),fw=function(t){return(t/8>>0)+(7&t&&1)},hw=function(t,e,n){(n==null||n>t.length)&&(n=t.length);var r=new(t instanceof jt?jt:t instanceof Ps?Ps:dn)(n-e);return r.set(t.subarray(e,n)),r},vr=function(t,e,n){n<<=7&e;var r=e/8>>0;t[r]|=n,t[r+1]|=n>>>8},ia=function(t,e,n){n<<=7&e;var r=e/8>>0;t[r]|=n,t[r+1]|=n>>>8,t[r+2]|=n>>>16},Rh=function(t,e){for(var n=[],r=0;r<t.length;++r)t[r]&&n.push({s:r,f:t[r]});var i=n.length,s=n.slice();if(!i)return[new dn(0),0];if(i==1){var o=new dn(n[0].s+1);return o[n[0].s]=1,[o,1]}n.sort(function(x,k){return x.f-k.f}),n.push({s:-1,f:25001});var a=n[0],l=n[1],u=0,c=1,f=2;for(n[0]={s:-1,f:a.f+l.f,l:a,r:l};c!=i-1;)a=n[n[u].f<n[f].f?u++:f++],l=n[u!=c&&n[u].f<n[f].f?u++:f++],n[c++]={s:-1,f:a.f+l.f,l:a,r:l};var d=s[0].s;for(r=1;r<i;++r)s[r].s>d&&(d=s[r].s);var h=new jt(d+1),p=Th(n[c-1],h,0);if(p>e){r=0;var v=0,w=p-e,m=1<<w;for(s.sort(function(x,k){return h[k.s]-h[x.s]||x.f-k.f});r<i;++r){var g=s[r].s;if(!(h[g]>e))break;v+=m-(1<<p-h[g]),h[g]=e}for(v>>>=w;v>0;){var y=s[r].s;h[y]<e?v-=1<<e-h[y]++-1:++r}for(;r>=0&&v;--r){var b=s[r].s;h[b]==e&&(--h[b],++v)}p=e}return[new dn(h),p]},Th=function(t,e,n){return t.s==-1?Math.max(Th(t.l,e,n+1),Th(t.r,e,n+1)):e[t.s]=n},pw=function(t){for(var e=t.length;e&&!t[--e];);for(var n=new jt(++e),r=0,i=t[0],s=1,o=function(l){n[r++]=l},a=1;a<=e;++a)if(t[a]==i&&a!=e)++s;else{if(!i&&s>2){for(;s>138;s-=138)o(32754);s>2&&(o(s>10?s-11<<5|28690:s-3<<5|12305),s=0)}else if(s>3){for(o(i),--s;s>6;s-=6)o(8304);s>2&&(o(s-3<<5|8208),s=0)}for(;s--;)o(i);s=1,i=t[a]}return[n.subarray(0,r),e]},sa=function(t,e){for(var n=0,r=0;r<e.length;++r)n+=t[r]*e[r];return n},Ph=function(t,e,n){var r=n.length,i=fw(e+2);t[i]=255&r,t[i+1]=r>>>8,t[i+2]=255^t[i],t[i+3]=255^t[i+1];for(var s=0;s<r;++s)t[i+s+4]=n[s];return 8*(i+4+r)},vw=function(t,e,n,r,i,s,o,a,l,u,c){vr(e,c++,n),++i[256];for(var f=Rh(i,15),d=f[0],h=f[1],p=Rh(s,15),v=p[0],w=p[1],m=pw(d),g=m[0],y=m[1],b=pw(v),x=b[0],k=b[1],$=new jt(19),C=0;C<g.length;++C)$[31&g[C]]++;for(C=0;C<x.length;++C)$[31&x[C]]++;for(var q=Rh($,7),I=q[0],F=q[1],N=19;N>4&&!I[aw[N-1]];--N);var G,Y,H,te,ee=u+5<<3,R=sa(i,Mi)+sa(s,Ru)+o,L=sa(i,d)+sa(s,v)+o+14+3*N+sa($,I)+(2*$[16]+3*$[17]+7*$[18]);if(ee<=R&&ee<=L)return Ph(e,c,t.subarray(l,l+u));if(vr(e,c,1+(L<R)),c+=2,L<R){G=ra(d,h),Y=d,H=ra(v,w),te=v;var z=ra(I,F);for(vr(e,c,y-257),vr(e,c+5,k-1),vr(e,c+10,N-4),c+=14,C=0;C<N;++C)vr(e,c+3*C,I[aw[C]]);c+=3*N;for(var oe=[g,x],P=0;P<2;++P){var ae=oe[P];for(C=0;C<ae.length;++C){var J=31&ae[C];vr(e,c,z[J]),c+=I[J],J>15&&(vr(e,c,ae[C]>>>5&127),c+=ae[C]>>>12)}}}else G=BR,Y=Mi,H=qR,te=Ru;for(C=0;C<a;++C)if(r[C]>255){J=r[C]>>>18&31,ia(e,c,G[J+257]),c+=Y[J+257],J>7&&(vr(e,c,r[C]>>>23&31),c+=Eh[J]);var be=31&r[C];ia(e,c,H[be]),c+=te[be],be>3&&(ia(e,c,r[C]>>>5&8191),c+=$h[be])}else ia(e,c,G[r[C]]),c+=Y[r[C]];return ia(e,c,G[256]),c+Y[256]},VR=new Ps([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),WR=function(){for(var t=new Ps(256),e=0;e<256;++e){for(var n=e,r=9;--r;)n=(1&n&&3988292384)^n>>>1;t[e]=n}return t}(),GR=function(){var t=4294967295;return{p:function(e){for(var n=t,r=0;r<e.length;++r)n=WR[255&n^e[r]]^n>>>8;t=n},d:function(){return 4294967295^t}}},KR=function(t,e,n,r,i){return function(s,o,a,l,u,c){var f=s.length,d=new dn(l+f+5*(1+Math.floor(f/7e3))+u),h=d.subarray(l,d.length-u),p=0;if(!o||f<8)for(var v=0;v<=f;v+=65535){var w=v+65535;w<f?p=Ph(h,p,s.subarray(v,w)):(h[v]=c,p=Ph(h,p,s.subarray(v,f)))}else{for(var m=VR[o-1],g=m>>>13,y=8191&m,b=(1<<a)-1,x=new jt(32768),k=new jt(b+1),$=Math.ceil(a/3),C=2*$,q=function(gr){return(s[gr]^s[gr+1]<<$^s[gr+2]<<C)&b},I=new Ps(25e3),F=new jt(288),N=new jt(32),G=0,Y=0,H=(v=0,0),te=0,ee=0;v<f;++v){var R=q(v),L=32767&v,z=k[R];if(x[L]=z,k[R]=L,te<=v){var oe=f-v;if((G>7e3||H>24576)&&oe>423){p=vw(s,h,0,I,F,N,Y,H,ee,v-ee,p),H=G=Y=0,ee=v;for(var P=0;P<286;++P)F[P]=0;for(P=0;P<30;++P)N[P]=0}var ae=2,J=0,be=y,ie=L-z&32767;if(oe>2&&R==q(v-ie))for(var Me=Math.min(g,oe)-1,_e=Math.min(32767,v),hn=Math.min(258,oe);ie<=_e&&--be&&L!=z;){if(s[v+ae]==s[v+ae-ie]){for(var Tt=0;Tt<hn&&s[v+Tt]==s[v+Tt-ie];++Tt);if(Tt>ae){if(ae=Tt,J=ie,Tt>Me)break;var Be=Math.min(ie,Tt-2),Di=0;for(P=0;P<Be;++P){var Ns=v-ie+P+32768&32767,Ni=Ns-x[Ns]+32768&32767;Ni>Di&&(Di=Ni,z=Ns)}}}ie+=(L=z)-(z=x[L])+32768&32767}if(J){I[H++]=268435456|Ch[ae]<<18|cw[J];var Hu=31&Ch[ae],Yn=31&cw[J];Y+=Eh[Hu]+$h[Yn],++F[257+Hu],++N[Yn],te=v+ae,++G}else I[H++]=s[v],++F[s[v]]}}p=vw(s,h,c,I,F,N,Y,H,ee,v-ee,p)}return hw(d,0,l+fw(p)+u)}(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,n,r,!0)},Mh=function(t,e,n){for(;n;++e)t[e]=n,n>>>=8},YR=function(t,e){var n=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&&Mh(t,4,Math.floor(new Date(e.mtime||Date.now())/1e3)),n){t[3]=8;for(var r=0;r<=n.length;++r)t[r+10]=n.charCodeAt(r)}},QR=function(t){return 10+(t.filename&&t.filename.length+1||0)};function gw(t,e){e===void 0&&(e={});var n=GR(),r=t.length;n.p(t);var i=KR(t,e,QR(e),8),s=i.length;return YR(i,e),Mh(i,s-8,n.d()),Mh(i,s-4,r),i}function mw(t,e){var n=t.length;if(typeof TextEncoder<"u")return new TextEncoder().encode(t);for(var r=new dn(t.length+(t.length>>>1)),i=0,s=function(u){r[i++]=u},o=0;o<n;++o){if(i+5>r.length){var a=new dn(i+8+(n-o<<1));a.set(r),r=a}var l=t.charCodeAt(o);l<128||e?s(l):l<2048?(s(192|l>>>6),s(128|63&l)):l>55295&&l<57344?(s(240|(l=65536+(1047552&l)|1023&t.charCodeAt(++o))>>>18),s(128|l>>>12&63),s(128|l>>>6&63),s(128|63&l)):(s(224|l>>>12),s(128|l>>>6&63),s(128|63&l))}return hw(r,0,i)}function XR(t,e){return function(n){for(var r=0,i=0;i<n.length;i++)r=(r<<5)-r+n.charCodeAt(i),r|=0;return Math.abs(r)}(t)%100<Zt(100*e,0,100,U)}var Kr="disabled",Oh="sampled",Tu="active",Oi="buffering",Ah="paused",Ih="trigger",Wn=Ih+"_activated",yt=Ih+"_pending",Gn=Ih+"_"+Kr;function yw(t,e){return e.some(n=>n.matching==="regex"&&new RegExp(n.url).test(t))}class _w{constructor(e){this.Rt=e}triggerStatus(e){var n=this.Rt.map(r=>r.triggerStatus(e));return n.includes(Wn)?Wn:n.includes(yt)?yt:Gn}stop(){this.Rt.forEach(e=>e.stop())}}class ww{constructor(e){this.Rt=e}triggerStatus(e){var n=new Set;for(var r of this.Rt)n.add(r.triggerStatus(e));switch(n.delete(Gn),n.size){case 0:return Gn;case 1:return Array.from(n)[0];default:return yt}}stop(){this.Rt.forEach(e=>e.stop())}}class ZR{triggerStatus(){return yt}stop(){}}var Pu=t=>"sessionRecording"in t;class JR{constructor(e){this.It=[],this.Pt=[],this.urlBlocked=!1,this._instance=e}onConfig(e){var n,r;this.It=(Pu(e)?(n=e.sessionRecording)==null?void 0:n.urlTriggers:e==null?void 0:e.urlTriggers)||[],this.Pt=(Pu(e)?(r=e.sessionRecording)==null?void 0:r.urlBlocklist:e==null?void 0:e.urlBlocklist)||[]}onRemoteConfig(e){this.onConfig(e)}Tt(e){var n;return this.It.length===0?Gn:((n=this._instance)==null?void 0:n.get_property(oh))===e?Wn:yt}triggerStatus(e){var n=this.Tt(e),r=n===Wn?Wn:n===yt?yt:Gn;return this._instance.register_for_session({$sdk_debug_replay_url_trigger_status:r}),r}checkUrlTriggerConditions(e,n,r){if(E!==void 0&&E.location.href){var i=E.location.href,s=this.urlBlocked,o=yw(i,this.Pt);s&&o||(o&&!s?e():!o&&s&&n(),yw(i,this.It)&&r("url"))}}stop(){}}class eT{constructor(e){this.linkedFlag=null,this.linkedFlagSeen=!1,this.Ct=()=>{},this._instance=e}triggerStatus(){var e=yt;return me(this.linkedFlag)&&(e=Gn),this.linkedFlagSeen&&(e=Wn),this._instance.register_for_session({$sdk_debug_replay_linked_flag_trigger_status:e}),e}onConfig(e,n){var r;if(this.linkedFlag=(Pu(e)?(r=e.sessionRecording)==null?void 0:r.linkedFlag:e==null?void 0:e.linkedFlag)||null,!me(this.linkedFlag)&&!this.linkedFlagSeen){var i=Ue(this.linkedFlag)?this.linkedFlag:this.linkedFlag.flag,s=Ue(this.linkedFlag)?null:this.linkedFlag.variant;this.Ct=this._instance.onFeatureFlags((o,a)=>{var l=!1;if(He(a)&&i in a){var u=a[i];l=Rn(u)?u===!0:s?u===s:!!u}this.linkedFlagSeen=l,l&&n(i,s)})}}onRemoteConfig(e,n){this.onConfig(e,n)}stop(){this.Ct()}}class tT{constructor(e){this.Mt=[],this._instance=e}onConfig(e){var n;this.Mt=(Pu(e)?(n=e.sessionRecording)==null?void 0:n.eventTriggers:e==null?void 0:e.eventTriggers)||[]}onRemoteConfig(e){this.onConfig(e)}Ot(e){var n;return this.Mt.length===0?Gn:((n=this._instance)==null?void 0:n.get_property(ah))===e?Wn:yt}triggerStatus(e){var n=this.Ot(e),r=n===Wn?Wn:n===yt?yt:Gn;return this._instance.register_for_session({$sdk_debug_replay_event_trigger_status:r}),r}stop(){}}function nT(t){return t.isRecordingEnabled?Oi:Kr}function rT(t){if(!t.receivedFlags)return Oi;if(!t.isRecordingEnabled)return Kr;if(t.urlTriggerMatching.urlBlocked)return Ah;var e=t.isSampled===!0,n=new _w([t.eventTriggerMatching,t.urlTriggerMatching,t.linkedFlagMatching]).triggerStatus(t.sessionId);return e?Oh:n===Wn?Tu:n===yt?Oi:t.isSampled===!1?Kr:Tu}function iT(t){if(!t.receivedFlags)return Oi;if(!t.isRecordingEnabled)return Kr;if(t.urlTriggerMatching.urlBlocked)return Ah;var e=new ww([t.eventTriggerMatching,t.urlTriggerMatching,t.linkedFlagMatching]).triggerStatus(t.sessionId),n=e!==Gn,r=Rn(t.isSampled);return n&&e===yt?Oi:n&&e===Gn||r&&!t.isSampled?Kr:t.isSampled===!0?Oh:Tu}var oa="[SessionRecording]",st=Je(oa);function Mu(){var t;return Z==null||(t=Z.__PosthogExtensions__)==null||(t=t.rrweb)==null?void 0:t.record}var sT=3e5,oT=[Tn.MouseMove,Tn.MouseInteraction,Tn.Scroll,Tn.ViewportResize,Tn.Input,Tn.TouchMove,Tn.MediaInteraction,Tn.Drag],bw=t=>({rrwebMethod:t,enqueuedAt:Date.now(),attempt:1});function Ai(t){return function(e,n){for(var r="",i=0;i<e.length;){var s=e[i++];r+=String.fromCharCode(s)}return r}(gw(mw(JSON.stringify(t))))}function xw(t){return t.type===Vn.Custom&&t.data.tag==="sessionIdle"}class kw{get sessionId(){return this.Ft}get At(){return this._instance.config.session_recording.session_idle_threshold_ms||3e5}get started(){return this.Dt}get jt(){if(!this._instance.sessionManager)throw new Error(oa+" must be started with a valid sessionManager.");return this._instance.sessionManager}get Lt(){var e,n;return this.Nt.triggerStatus(this.sessionId)===yt?6e4:(e=(n=this._instance.config.session_recording)==null?void 0:n.full_snapshot_interval_millis)!==null&&e!==void 0?e:sT}get Ut(){var e=this._instance.get_property($s);return Rn(e)?e:null}get zt(){var e,n,r=(e=this.H)==null?void 0:e.data[((n=this.H)==null?void 0:n.data.length)-1],{sessionStartTimestamp:i}=this.jt.checkAndGetSessionAndWindowId(!0);return r?r.timestamp-i:null}get Bt(){var e=!!this._instance.get_property(sh),n=!this._instance.config.disable_session_recording;return E&&e&&n}get qt(){var e=!!this._instance.get_property(R_),n=this._instance.config.enable_recording_console_log;return n??e}get Ht(){var e,n,r,i,s,o,a=this._instance.config.session_recording.captureCanvas,l=this._instance.get_property(M_),u=(e=(n=a==null?void 0:a.recordCanvas)!==null&&n!==void 0?n:l==null?void 0:l.enabled)!==null&&e!==void 0&&e,c=(r=(i=a==null?void 0:a.canvasFps)!==null&&i!==void 0?i:l==null?void 0:l.fps)!==null&&r!==void 0?r:4,f=(s=(o=a==null?void 0:a.canvasQuality)!==null&&o!==void 0?o:l==null?void 0:l.quality)!==null&&s!==void 0?s:.4;if(typeof f=="string"){var d=parseFloat(f);f=isNaN(d)?.4:d}return{enabled:u,fps:Zt(c,0,12,st.createLogger("canvas recording fps"),4),quality:Zt(f,0,1,st.createLogger("canvas recording quality"),.4)}}get Wt(){var e,n,r=this._instance.get_property(T_),i={recordHeaders:(e=this._instance.config.session_recording)==null?void 0:e.recordHeaders,recordBody:(n=this._instance.config.session_recording)==null?void 0:n.recordBody},s=(i==null?void 0:i.recordHeaders)||(r==null?void 0:r.recordHeaders),o=(i==null?void 0:i.recordBody)||(r==null?void 0:r.recordBody),a=He(this._instance.config.capture_performance)?this._instance.config.capture_performance.network_timing:this._instance.config.capture_performance,l=!!(Rn(a)?a:r!=null&&r.capturePerformance);return s||o||l?{recordHeaders:s,recordBody:o,recordPerformance:l}:void 0}get Gt(){var e,n,r,i,s,o,a=this._instance.get_property(P_),l={maskAllInputs:(e=this._instance.config.session_recording)==null?void 0:e.maskAllInputs,maskTextSelector:(n=this._instance.config.session_recording)==null?void 0:n.maskTextSelector,blockSelector:(r=this._instance.config.session_recording)==null?void 0:r.blockSelector},u=(i=l==null?void 0:l.maskAllInputs)!==null&&i!==void 0?i:a==null?void 0:a.maskAllInputs,c=(s=l==null?void 0:l.maskTextSelector)!==null&&s!==void 0?s:a==null?void 0:a.maskTextSelector,f=(o=l==null?void 0:l.blockSelector)!==null&&o!==void 0?o:a==null?void 0:a.blockSelector;return D(u)&&D(c)&&D(f)?void 0:{maskAllInputs:u==null||u,maskTextSelector:c,blockSelector:f}}get Vt(){var e=this._instance.get_property(O_);return mt(e)?e:null}get Jt(){var e=this._instance.get_property(A_);return mt(e)?e:null}get status(){return this.Kt?this.Yt({receivedFlags:this.Kt,isRecordingEnabled:this.Bt,isSampled:this.Ut,urlTriggerMatching:this.Xt,eventTriggerMatching:this.Qt,linkedFlagMatching:this.Zt,sessionId:this.sessionId}):Oi}constructor(e){if(this.Yt=nT,this.Kt=!1,this.ti=[],this.ii="unknown",this.ei=Date.now(),this.Nt=new ZR,this.ri=void 0,this.si=void 0,this.ni=void 0,this.oi=void 0,this.ai=void 0,this._forceAllowLocalhostNetworkCapture=!1,this.li=()=>{this.ui()},this.hi=()=>{this.tryAddCustomEvent("browser offline",{})},this.di=()=>{this.tryAddCustomEvent("browser online",{})},this.vi=()=>{if(B!=null&&B.visibilityState){var i="window "+B.visibilityState;this.tryAddCustomEvent(i,{})}},this._instance=e,this.Dt=!1,this.ci="/s/",this.fi=void 0,this.Kt=!1,!this._instance.sessionManager)throw st.error("started without valid sessionManager"),new Error(oa+" started without valid sessionManager. This is a bug.");if(this._instance.config.cookieless_mode==="always")throw new Error(oa+' cannot be used with cookieless_mode="always"');this.Zt=new eT(this._instance),this.Xt=new JR(this._instance),this.Qt=new tT(this._instance);var{sessionId:n,windowId:r}=this.jt.checkAndGetSessionAndWindowId();this.Ft=n,this.pi=r,this.H=this.gi(),this.At>=this.jt.sessionTimeoutMs&&st.warn("session_idle_threshold_ms ("+this.At+") is greater than the session timeout ("+this.jt.sessionTimeoutMs+"). Session will never be detected as idle")}startIfEnabledOrStop(e){this.Bt?(this.mi(e),Ne(E,"beforeunload",this.li),Ne(E,"offline",this.hi),Ne(E,"online",this.di),Ne(E,"visibilitychange",this.vi),this.yi(),this.bi(),me(this.ri)&&(this.ri=this._instance.on("eventCaptured",n=>{try{if(n.event==="$pageview"){var r=n!=null&&n.properties.$current_url?this.wi(n==null?void 0:n.properties.$current_url):"";if(!r)return;this.tryAddCustomEvent("$pageview",{href:r})}}catch(i){st.error("Could not add $pageview to rrweb session",i)}})),this.si||(this.si=this.jt.onSessionId((n,r,i)=>{var s,o;i&&(this.tryAddCustomEvent("$session_id_change",{sessionId:n,windowId:r,changeReason:i}),(s=this._instance)==null||(s=s.persistence)==null||s.unregister(ah),(o=this._instance)==null||(o=o.persistence)==null||o.unregister(oh))}))):this.stopRecording()}stopRecording(){var e,n,r,i;this.Dt&&this.fi&&(this.fi(),this.fi=void 0,this.Dt=!1,E==null||E.removeEventListener("beforeunload",this.li),E==null||E.removeEventListener("offline",this.hi),E==null||E.removeEventListener("online",this.di),E==null||E.removeEventListener("visibilitychange",this.vi),this.gi(),clearInterval(this.Si),(e=this.ri)==null||e.call(this),this.ri=void 0,(n=this.ai)==null||n.call(this),this.ai=void 0,(r=this.si)==null||r.call(this),this.si=void 0,(i=this.oi)==null||i.call(this),this.oi=void 0,this.Qt.stop(),this.Xt.stop(),this.Zt.stop(),st.info("stopped"))}ki(){var e;(e=this._instance.persistence)==null||e.unregister($s)}$i(e){var n,r=this.Ft!==e,i=this.Vt;if(mt(i)){var s=this.Ut,o=r||!Rn(s),a=o?XR(e,i):s;o&&(a?this.xi(Oh):st.warn("Sample rate ("+i+") has determined that this sessionId ("+e+") will not be sent to the server."),this.tryAddCustomEvent("samplingDecisionMade",{sampleRate:i,isSampled:a})),(n=this._instance.persistence)==null||n.register({[$s]:a})}else this.ki()}onRemoteConfig(e){var n,r,i,s;this.tryAddCustomEvent("$remote_config_received",e),this.Ei(e),(n=e.sessionRecording)!=null&&n.endpoint&&(this.ci=(s=e.sessionRecording)==null?void 0:s.endpoint),this.yi(),((r=e.sessionRecording)==null?void 0:r.triggerMatchType)==="any"?(this.Yt=rT,this.Nt=new _w([this.Qt,this.Xt])):(this.Yt=iT,this.Nt=new ww([this.Qt,this.Xt])),this._instance.register_for_session({$sdk_debug_replay_remote_trigger_matching_config:(i=e.sessionRecording)==null?void 0:i.triggerMatchType}),this.Xt.onConfig(e),this.Qt.onConfig(e),this.Zt.onConfig(e,(o,a)=>{this.xi("linked_flag_matched",{flag:o,variant:a})}),this.Kt=!0,this.startIfEnabledOrStop()}yi(){mt(this.Vt)&&me(this.oi)&&(this.oi=this.jt.onSessionId(e=>{this.$i(e)}))}Ei(e){if(this._instance.persistence){var n,r=this._instance.persistence,i=()=>{var s,o,a,l,u,c,f,d,h,p=(s=e.sessionRecording)==null?void 0:s.sampleRate,v=me(p)?null:parseFloat(p);me(v)&&this.ki();var w=(o=e.sessionRecording)==null?void 0:o.minimumDurationMilliseconds;r.register({[sh]:!!e.sessionRecording,[R_]:(a=e.sessionRecording)==null?void 0:a.consoleLogRecordingEnabled,[T_]:j({capturePerformance:e.capturePerformance},(l=e.sessionRecording)==null?void 0:l.networkPayloadCapture),[P_]:(u=e.sessionRecording)==null?void 0:u.masking,[M_]:{enabled:(c=e.sessionRecording)==null?void 0:c.recordCanvas,fps:(f=e.sessionRecording)==null?void 0:f.canvasFps,quality:(d=e.sessionRecording)==null?void 0:d.canvasQuality},[O_]:v,[A_]:D(w)?null:w,[I_]:(h=e.sessionRecording)==null?void 0:h.scriptConfig})};i(),(n=this.ni)==null||n.call(this),this.ni=this.jt.onSessionId(i)}}log(e,n){var r;n===void 0&&(n="log"),(r=this._instance.sessionRecording)==null||r.onRRwebEmit({type:6,data:{plugin:"rrweb/console@1",payload:{level:n,trace:[],payload:[JSON.stringify(e)]}},timestamp:Date.now()})}mi(e){if(!D(Object.assign)&&!D(Array.from)&&!(this.Dt||this._instance.config.disable_session_recording||this._instance.consent.isOptedOut())){var n;this.Dt=!0,this.jt.checkAndGetSessionAndWindowId(),Mu()?this.Ri():(n=Z.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this._instance,this.Ii,r=>{if(r)return st.error("could not load recorder",r);this.Ri()}),st.info("starting"),this.status===Tu&&this.xi(e||"recording_initialized")}}get Ii(){var e;return((e=this._instance)==null||(e=e.persistence)==null||(e=e.get_property(I_))==null?void 0:e.script)||"recorder"}Pi(e){var n;return e.type===3&&oT.indexOf((n=e.data)==null?void 0:n.source)!==-1}Ti(e){var n=this.Pi(e);n||this.ii||e.timestamp-this.ei>this.At&&(this.ii=!0,clearInterval(this.Si),this.tryAddCustomEvent("sessionIdle",{eventTimestamp:e.timestamp,lastActivityTimestamp:this.ei,threshold:this.At,bufferLength:this.H.data.length,bufferSize:this.H.size}),this.ui());var r=!1;if(n&&(this.ei=e.timestamp,this.ii)){var i=this.ii==="unknown";this.ii=!1,i||(this.tryAddCustomEvent("sessionNoLongerIdle",{reason:"user activity",type:e.type}),r=!0)}if(!this.ii){var{windowId:s,sessionId:o}=this.jt.checkAndGetSessionAndWindowId(!n,e.timestamp),a=this.Ft!==o,l=this.pi!==s;this.pi=s,this.Ft=o,a||l?(this.stopRecording(),this.startIfEnabledOrStop("session_id_changed")):r&&this.Ci()}}Mi(e){try{return e.rrwebMethod(),!0}catch(n){return this.ti.length<10?this.ti.push({enqueuedAt:e.enqueuedAt||Date.now(),attempt:e.attempt++,rrwebMethod:e.rrwebMethod}):st.warn("could not emit queued rrweb event.",n,e),!1}}tryAddCustomEvent(e,n){return this.Mi(bw(()=>Mu().addCustomEvent(e,n)))}Oi(){return this.Mi(bw(()=>Mu().takeFullSnapshot()))}Ri(){var e,n,r,i,s={blockClass:"ph-no-capture",blockSelector:void 0,ignoreClass:"ph-ignore-input",maskTextClass:"ph-mask",maskTextSelector:void 0,maskTextFn:void 0,maskAllInputs:!0,maskInputOptions:{password:!0},maskInputFn:void 0,slimDOMOptions:{},collectFonts:!1,inlineStylesheet:!0,recordCrossOriginIframes:!1},o=this._instance.config.session_recording;for(var[a,l]of Object.entries(o||{}))a in s&&(a==="maskInputOptions"?s.maskInputOptions=j({password:!0},l):s[a]=l);this.Ht&&this.Ht.enabled&&(s.recordCanvas=!0,s.sampling={canvas:this.Ht.fps},s.dataURLOptions={type:"image/webp",quality:this.Ht.quality}),this.Gt&&(s.maskAllInputs=(n=this.Gt.maskAllInputs)===null||n===void 0||n,s.maskTextSelector=(r=this.Gt.maskTextSelector)!==null&&r!==void 0?r:void 0,s.blockSelector=(i=this.Gt.blockSelector)!==null&&i!==void 0?i:void 0);var u=Mu();if(u){this.Fi=(e=this.Fi)!==null&&e!==void 0?e:new HR(u,{refillRate:this._instance.config.session_recording.__mutationThrottlerRefillRate,bucketSize:this._instance.config.session_recording.__mutationThrottlerBucketSize,onBlockedNode:(f,d)=>{var h="Too many mutations on node '"+f+"'. Rate limiting. This could be due to SVG animations or something similar";st.info(h,{node:d}),this.log(oa+" "+h,"warn")}});var c=this.Ai();this.fi=u(j({emit:f=>{this.onRRwebEmit(f)},plugins:c},s)),this.ei=Date.now(),this.ii=Rn(this.ii)?this.ii:"unknown",this.tryAddCustomEvent("$session_options",{sessionRecordingOptions:s,activePlugins:c.map(f=>f==null?void 0:f.name)}),this.tryAddCustomEvent("$posthog_config",{config:this._instance.config})}else st.error("onScriptLoaded was called but rrwebRecord is not available. This indicates something has gone wrong.")}Ci(){if(this.Si&&clearInterval(this.Si),this.ii!==!0){var e=this.Lt;e&&(this.Si=setInterval(()=>{this.Oi()},e))}}Ai(){var e,n,r=[],i=(e=Z.__PosthogExtensions__)==null||(e=e.rrwebPlugins)==null?void 0:e.getRecordConsolePlugin;i&&this.qt&&r.push(i());var s=(n=Z.__PosthogExtensions__)==null||(n=n.rrwebPlugins)==null?void 0:n.getRecordNetworkPlugin;return this.Wt&&cn(s)&&(!_R.includes(location.hostname)||this._forceAllowLocalhostNetworkCapture?r.push(s(zR(this._instance.config,this.Wt))):st.info("NetworkCapture not started because we are on localhost.")),r}onRRwebEmit(e){var n;if(this.Di(),e&&He(e)){if(e.type===Vn.Meta){var r=this.wi(e.data.href);if(this.ji=r,!r)return;e.data.href=r}else this.Li();if(this.Xt.checkUrlTriggerConditions(()=>this.Ni(),()=>this.Ui(),d=>this.zi(d)),!this.Xt.urlBlocked||(i=e).type===Vn.Custom&&i.data.tag==="recording paused"){var i;e.type===Vn.FullSnapshot&&this.Ci(),e.type===Vn.FullSnapshot&&this.Kt&&this.Nt.triggerStatus(this.sessionId)===yt&&this.Bi();var s=this.Fi?this.Fi.throttleMutations(e):e;if(s){var o=function(d){var h=d;if(h&&He(h)&&h.type===6&&He(h.data)&&h.data.plugin==="rrweb/console@1"){h.data.payload.payload.length>10&&(h.data.payload.payload=h.data.payload.payload.slice(0,10),h.data.payload.payload.push("...[truncated]"));for(var p=[],v=0;v<h.data.payload.payload.length;v++)h.data.payload.payload[v]&&h.data.payload.payload[v].length>2e3?p.push(h.data.payload.payload[v].slice(0,2e3)+"...[truncated]"):p.push(h.data.payload.payload[v]);return h.data.payload.payload=p,d}return d}(s);if(this.Ti(o),this.ii!==!0||xw(o)){if(xw(o)){var a=o.data.payload;if(a){var l=a.lastActivityTimestamp,u=a.threshold;o.timestamp=l+u}}var c=(n=this._instance.config.session_recording.compress_events)===null||n===void 0||n?function(d){try{if(d.type===Vn.FullSnapshot)return j({},d,{data:Ai(d.data),cv:"2024-10"});if(d.type===Vn.IncrementalSnapshot&&d.data.source===Tn.Mutation)return j({},d,{cv:"2024-10",data:j({},d.data,{texts:Ai(d.data.texts),attributes:Ai(d.data.attributes),removes:Ai(d.data.removes),adds:Ai(d.data.adds)})});if(d.type===Vn.IncrementalSnapshot&&d.data.source===Tn.StyleSheetRule)return j({},d,{cv:"2024-10",data:j({},d.data,{adds:d.data.adds?Ai(d.data.adds):void 0,removes:d.data.removes?Ai(d.data.removes):void 0})})}catch(h){st.error("could not compress event - will use uncompressed event",h)}return d}(o):o,f={$snapshot_bytes:$u(c),$snapshot_data:c,$session_id:this.Ft,$window_id:this.pi};this.status!==Kr?this.qi(f):this.gi()}}}}}Li(){if(!this._instance.config.capture_pageview&&E){var e=this.wi(E.location.href);this.ji!==e&&(this.tryAddCustomEvent("$url_changed",{href:e}),this.ji=e)}}Di(){if(this.ti.length){var e=[...this.ti];this.ti=[],e.forEach(n=>{Date.now()-n.enqueuedAt<=2e3&&this.Mi(n)})}}wi(e){var n=this._instance.config.session_recording;if(n.maskNetworkRequestFn){var r,i={url:e};return(r=i=n.maskNetworkRequestFn(i))==null?void 0:r.url}return e}Bi(){if(!this.H||this.H.data.length===0)return this.gi();for(var e=-1,n=this.H.data.length-1;n>=0;n--)if(this.H.data[n].type===Vn.Meta){e=n;break}return e>=0?(this.H.data=this.H.data.slice(e),this.H.size=this.H.data.reduce((r,i)=>r+$u(i),0),this.H):this.gi()}gi(){return this.H={size:0,data:[],sessionId:this.Ft,windowId:this.pi},this.H}ui(){this.Hi&&(clearTimeout(this.Hi),this.Hi=void 0);var e=this.Jt,n=this.zt,r=mt(n)&&n>=0,i=mt(e)&&r&&n<e;return this.status===Oi||this.status===Ah||this.status===Kr||i?(this.Hi=setTimeout(()=>{this.ui()},2e3),this.H):(this.H.data.length>0&&xh(this.H).forEach(s=>{this.Wi({$snapshot_bytes:s.size,$snapshot_data:s.data,$session_id:s.sessionId,$window_id:s.windowId,$lib:"web",$lib_version:cr.LIB_VERSION})}),this.gi())}qi(e){var n,r=2+(((n=this.H)==null?void 0:n.data.length)||0);!this.ii&&(this.H.size+e.$snapshot_bytes+r>943718.4||this.H.sessionId!==this.Ft)&&(this.H=this.ui()),this.H.size+=e.$snapshot_bytes,this.H.data.push(e.$snapshot_data),this.Hi||this.ii||(this.Hi=setTimeout(()=>{this.ui()},2e3))}Wi(e){this._instance.capture("$snapshot",e,{_url:this._instance.requestRouter.endpointFor("api",this.ci),_noTruncate:!0,_batchKey:"recordings",skip_client_rate_limiting:!0})}zi(e){var n;this.Nt.triggerStatus(this.sessionId)===yt&&((n=this._instance)==null||(n=n.persistence)==null||n.register({[e==="url"?oh:ah]:this.Ft}),this.ui(),this.xi(e+"_trigger_matched"))}Ni(){this.Xt.urlBlocked||(this.Xt.urlBlocked=!0,clearInterval(this.Si),st.info("recording paused due to URL blocker"),this.tryAddCustomEvent("recording paused",{reason:"url blocker"}))}Ui(){this.Xt.urlBlocked&&(this.Xt.urlBlocked=!1,this.Oi(),this.Ci(),this.tryAddCustomEvent("recording resumed",{reason:"left blocked url"}),st.info("recording resumed"))}bi(){this.Qt.Mt.length!==0&&me(this.ai)&&(this.ai=this._instance.on("eventCaptured",e=>{try{this.Qt.Mt.includes(e.event)&&this.zi("event")}catch(n){st.error("Could not activate event trigger",n)}}))}overrideLinkedFlag(){this.Zt.linkedFlagSeen=!0,this.Oi(),this.xi("linked_flag_overridden")}overrideSampling(){var e;(e=this._instance.persistence)==null||e.register({[$s]:!0}),this.Oi(),this.xi("sampling_overridden")}overrideTrigger(e){this.zi(e)}xi(e,n){this._instance.register_for_session({$session_recording_start_reason:e}),st.info(e.replace("_"," "),n),ue(["recording_initialized","session_id_changed"],e)||this.tryAddCustomEvent(e,n)}get sdkDebugProperties(){var{sessionStartTimestamp:e}=this.jt.checkAndGetSessionAndWindowId(!0);return{$recording_status:this.status,$sdk_debug_replay_internal_buffer_length:this.H.data.length,$sdk_debug_replay_internal_buffer_size:this.H.size,$sdk_debug_current_session_duration:this.zt,$sdk_debug_session_start:e}}}var Fh=Je("[SegmentIntegration]");function aT(t,e){var n=t.config.segment;if(!n)return e();(function(r,i){var s=r.config.segment;if(!s)return i();var o=l=>{var u=()=>l.anonymousId()||Gr();r.config.get_device_id=u,l.id()&&(r.register({distinct_id:l.id(),$device_id:u()}),r.persistence.set_property(fr,"identified")),i()},a=s.user();"then"in a&&cn(a.then)?a.then(l=>o(l)):o(a)})(t,()=>{n.register((r=>{Promise&&Promise.resolve||Fh.warn("This browser does not have Promise support, and can not use the segment integration");var i=(s,o)=>{if(!o)return s;s.event.userId||s.event.anonymousId===r.get_distinct_id()||(Fh.info("No userId set, resetting PostHog"),r.reset()),s.event.userId&&s.event.userId!==r.get_distinct_id()&&(Fh.info("UserId set, identifying with PostHog"),r.identify(s.event.userId));var a=r.calculateEventProperties(o,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:()=>!0,load:()=>Promise.resolve(),track:s=>i(s,s.event.event),page:s=>i(s,"$pageview"),identify:s=>i(s,"$identify"),screen:s=>i(s,"$screen")}})(t)).then(()=>{e()})})}var Sw="posthog-js";function Ew(t,e){var{organization:n,projectId:r,prefix:i,severityAllowList:s=["error"],sendExceptionsToPostHog:o=!0}=e===void 0?{}:e;return a=>{var l,u,c,f,d;if(!(s==="*"||s.includes(a.level))||!t.__loaded)return a;a.tags||(a.tags={});var h=t.requestRouter.endpointFor("ui","/project/"+t.config.token+"/person/"+t.get_distinct_id());a.tags["PostHog Person URL"]=h,t.sessionRecordingStarted()&&(a.tags["PostHog Recording URL"]=t.get_session_replay_url({withTimestamp:!0}));var p=((l=a.exception)==null?void 0:l.values)||[],v=p.map(m=>j({},m,{stacktrace:m.stacktrace?j({},m.stacktrace,{type:"raw",frames:(m.stacktrace.frames||[]).map(g=>j({},g,{platform:"web:javascript"}))}):void 0})),w={$exception_message:((u=p[0])==null?void 0:u.value)||a.message,$exception_type:(c=p[0])==null?void 0:c.type,$exception_personURL:h,$exception_level:a.level,$exception_list:v,$sentry_event_id:a.event_id,$sentry_exception:a.exception,$sentry_exception_message:((f=p[0])==null?void 0:f.value)||a.message,$sentry_exception_type:(d=p[0])==null?void 0:d.type,$sentry_tags:a.tags};return n&&r&&(w.$sentry_url=(i||"https://sentry.io/organizations/")+n+"/issues/?project="+r+"&query="+a.event_id),o&&t.exceptions.sendExceptionEvent(w),a}}class lT{constructor(e,n,r,i,s,o){this.name=Sw,this.setupOnce=function(a){a(Ew(e,{organization:n,projectId:r,prefix:i,severityAllowList:s,sendExceptionsToPostHog:o==null||o}))}}}var uT=E!=null&&E.location?bu(E.location.hash,"__posthog")||bu(location.hash,"state"):null,$w="_postHogToolbarParams",Cw=Je("[Toolbar]"),Yr=function(t){return t[t.UNINITIALIZED=0]="UNINITIALIZED",t[t.LOADING=1]="LOADING",t[t.LOADED=2]="LOADED",t}(Yr||{});class cT{constructor(e){this.instance=e}Gi(e){Z.ph_toolbar_state=e}Vi(){var e;return(e=Z.ph_toolbar_state)!==null&&e!==void 0?e:Yr.UNINITIALIZED}maybeLoadToolbar(e,n,r){if(e===void 0&&(e=void 0),n===void 0&&(n=void 0),r===void 0&&(r=void 0),!E||!B)return!1;e=e??E.location,r=r??E.history;try{if(!n){try{E.localStorage.setItem("test","test"),E.localStorage.removeItem("test")}catch{return!1}n=E==null?void 0:E.localStorage}var i,s=uT||bu(e.hash,"__posthog")||bu(e.hash,"state"),o=s?__(()=>JSON.parse(atob(decodeURIComponent(s))))||__(()=>JSON.parse(decodeURIComponent(s))):null;return o&&o.action==="ph_authorize"?((i=o).source="url",i&&Object.keys(i).length>0&&(o.desiredHash?e.hash=o.desiredHash:r?r.replaceState(r.state,"",e.pathname+e.search):e.hash="")):((i=JSON.parse(n.getItem($w)||"{}")).source="localstorage",delete i.userIntent),!(!i.token||this.instance.config.token!==i.token)&&(this.loadToolbar(i),!0)}catch{return!1}}Ji(e){var n=Z.ph_load_toolbar||Z.ph_load_editor;!me(n)&&cn(n)?n(e,this.instance):Cw.warn("No toolbar load function found")}loadToolbar(e){var n=!(B==null||!B.getElementById(F_));if(!E||n)return!1;var r=this.instance.requestRouter.region==="custom"&&this.instance.config.advanced_disable_toolbar_metrics,i=j({token:this.instance.config.token},e,{apiURL:this.instance.requestRouter.endpointFor("ui")},r?{instrument:!1}:{});if(E.localStorage.setItem($w,JSON.stringify(j({},i,{source:void 0}))),this.Vi()===Yr.LOADED)this.Ji(i);else if(this.Vi()===Yr.UNINITIALIZED){var s;this.Gi(Yr.LOADING),(s=Z.__PosthogExtensions__)==null||s.loadExternalDependency==null||s.loadExternalDependency(this.instance,"toolbar",o=>{if(o)return Cw.error("[Toolbar] Failed to load",o),void this.Gi(Yr.UNINITIALIZED);this.Gi(Yr.LOADED),this.Ji(i)}),Ne(E,"turbolinks:load",()=>{this.Gi(Yr.UNINITIALIZED),this.loadToolbar(i)})}return!0}Ki(e){return this.loadToolbar(e)}maybeLoadEditor(e,n,r){return e===void 0&&(e=void 0),n===void 0&&(n=void 0),r===void 0&&(r=void 0),this.maybeLoadToolbar(e,n,r)}}var dT=Je("[TracingHeaders]");class fT{constructor(e){this.Yi=void 0,this.Xi=void 0,this.lt=()=>{var n,r;D(this.Yi)&&((n=Z.__PosthogExtensions__)==null||(n=n.tracingHeadersPatchFns)==null||n._patchXHR(this._instance.config.__add_tracing_headers||[],this._instance.get_distinct_id(),this._instance.sessionManager)),D(this.Xi)&&((r=Z.__PosthogExtensions__)==null||(r=r.tracingHeadersPatchFns)==null||r._patchFetch(this._instance.config.__add_tracing_headers||[],this._instance.get_distinct_id(),this._instance.sessionManager))},this._instance=e}nt(e){var n,r;(n=Z.__PosthogExtensions__)!=null&&n.tracingHeadersPatchFns&&e(),(r=Z.__PosthogExtensions__)==null||r.loadExternalDependency==null||r.loadExternalDependency(this._instance,"tracing-headers",i=>{if(i)return dT.error("failed to load script",i);e()})}startIfEnabledOrStop(){var e,n;this._instance.config.__add_tracing_headers?this.nt(this.lt):((e=this.Yi)==null||e.call(this),(n=this.Xi)==null||n.call(this),this.Yi=void 0,this.Xi=void 0)}}var Qr=Je("[Web Vitals]"),Rw=9e5;class hT{constructor(e){var n;this.Qi=!1,this.C=!1,this.H={url:void 0,metrics:[],firstMetricTimestamp:void 0},this.Zi=()=>{clearTimeout(this.te),this.H.metrics.length!==0&&(this._instance.capture("$web_vitals",this.H.metrics.reduce((r,i)=>j({},r,{["$web_vitals_"+i.name+"_event"]:j({},i),["$web_vitals_"+i.name+"_value"]:i.value}),{})),this.H={url:void 0,metrics:[],firstMetricTimestamp:void 0})},this.ie=r=>{var i,s=(i=this._instance.sessionManager)==null?void 0:i.checkAndGetSessionAndWindowId(!0);if(D(s))Qr.error("Could not read session ID. Dropping metrics!");else{this.H=this.H||{url:void 0,metrics:[],firstMetricTimestamp:void 0};var o=this.ee();D(o)||(me(r==null?void 0:r.name)||me(r==null?void 0:r.value)?Qr.error("Invalid metric received",r):this.re&&r.value>=this.re?Qr.error("Ignoring metric with value >= "+this.re,r):(this.H.url!==o&&(this.Zi(),this.te=setTimeout(this.Zi,this.flushToCaptureTimeoutMs)),D(this.H.url)&&(this.H.url=o),this.H.firstMetricTimestamp=D(this.H.firstMetricTimestamp)?Date.now():this.H.firstMetricTimestamp,r.attribution&&r.attribution.interactionTargetElement&&(r.attribution.interactionTargetElement=void 0),this.H.metrics.push(j({},r,{$current_url:o,$session_id:s.sessionId,$window_id:s.windowId,timestamp:Date.now()})),this.H.metrics.length===this.allowedMetrics.length&&this.Zi()))}},this.lt=()=>{var r,i,s,o,a=Z.__PosthogExtensions__;D(a)||D(a.postHogWebVitalsCallbacks)||({onLCP:r,onCLS:i,onFCP:s,onINP:o}=a.postHogWebVitalsCallbacks),r&&i&&s&&o?(this.allowedMetrics.indexOf("LCP")>-1&&r(this.ie.bind(this)),this.allowedMetrics.indexOf("CLS")>-1&&i(this.ie.bind(this)),this.allowedMetrics.indexOf("FCP")>-1&&s(this.ie.bind(this)),this.allowedMetrics.indexOf("INP")>-1&&o(this.ie.bind(this)),this.C=!0):Qr.error("web vitals callbacks not loaded - not starting")},this._instance=e,this.Qi=!((n=this._instance.persistence)==null||!n.props[E_]),this.startIfEnabled()}get allowedMetrics(){var e,n,r=He(this._instance.config.capture_performance)?(e=this._instance.config.capture_performance)==null?void 0:e.web_vitals_allowed_metrics:void 0;return D(r)?((n=this._instance.persistence)==null?void 0:n.props[C_])||["CLS","FCP","INP","LCP"]:r}get flushToCaptureTimeoutMs(){return(He(this._instance.config.capture_performance)?this._instance.config.capture_performance.web_vitals_delayed_flush_ms:void 0)||5e3}get re(){var e=He(this._instance.config.capture_performance)&&mt(this._instance.config.capture_performance.__web_vitals_max_value)?this._instance.config.capture_performance.__web_vitals_max_value:Rw;return 0<e&&e<=6e4?Rw:e}get isEnabled(){var e=Dt==null?void 0:Dt.protocol;if(e!=="http:"&&e!=="https:")return Qr.info("Web Vitals are disabled on non-http/https protocols"),!1;var n=He(this._instance.config.capture_performance)?this._instance.config.capture_performance.web_vitals:Rn(this._instance.config.capture_performance)?this._instance.config.capture_performance:void 0;return Rn(n)?n:this.Qi}startIfEnabled(){this.isEnabled&&!this.C&&(Qr.info("enabled, starting..."),this.nt(this.lt))}onRemoteConfig(e){var n=He(e.capturePerformance)&&!!e.capturePerformance.web_vitals,r=He(e.capturePerformance)?e.capturePerformance.web_vitals_allowed_metrics:void 0;this._instance.persistence&&(this._instance.persistence.register({[E_]:n}),this._instance.persistence.register({[C_]:r})),this.Qi=n,this.startIfEnabled()}nt(e){var n,r;(n=Z.__PosthogExtensions__)!=null&&n.postHogWebVitalsCallbacks&&e(),(r=Z.__PosthogExtensions__)==null||r.loadExternalDependency==null||r.loadExternalDependency(this._instance,"web-vitals",i=>{i?Qr.error("failed to load script",i):e()})}ee(){var e=E?E.location.href:void 0;return e||Qr.error("Could not determine current URL"),e}}var pT=Je("[Heatmaps]");function Tw(t){return He(t)&&"clientX"in t&&"clientY"in t&&mt(t.clientX)&&mt(t.clientY)}class vT{constructor(e){var n;this.rageclicks=new Z_,this.Qi=!1,this.C=!1,this.se=null,this.instance=e,this.Qi=!((n=this.instance.persistence)==null||!n.props[nh])}get flushIntervalMilliseconds(){var e=5e3;return He(this.instance.config.capture_heatmaps)&&this.instance.config.capture_heatmaps.flush_interval_milliseconds&&(e=this.instance.config.capture_heatmaps.flush_interval_milliseconds),e}get isEnabled(){return D(this.instance.config.capture_heatmaps)?D(this.instance.config.enable_heatmaps)?this.Qi:this.instance.config.enable_heatmaps:this.instance.config.capture_heatmaps!==!1}startIfEnabled(){if(this.isEnabled){if(this.C)return;pT.info("starting..."),this.ne(),this.se=setInterval(this.oe.bind(this),this.flushIntervalMilliseconds)}else{var e,n;clearInterval((e=this.se)!==null&&e!==void 0?e:void 0),(n=this.ae)==null||n.stop(),this.getAndClearBuffer()}}onRemoteConfig(e){var n=!!e.heatmaps;this.instance.persistence&&this.instance.persistence.register({[nh]:n}),this.Qi=n,this.startIfEnabled()}getAndClearBuffer(){var e=this.H;return this.H=void 0,e}le(e){this.ue(e.originalEvent,"deadclick")}ne(){E&&B&&(Ne(E,"beforeunload",this.oe.bind(this)),Ne(B,"click",e=>this.ue(e||(E==null?void 0:E.event)),{capture:!0}),Ne(B,"mousemove",e=>this.he(e||(E==null?void 0:E.event)),{capture:!0}),this.ae=new rw(this.instance,AR,this.le.bind(this)),this.ae.startIfEnabled(),this.C=!0)}de(e,n){var r=this.instance.scrollManager.scrollY(),i=this.instance.scrollManager.scrollX(),s=this.instance.scrollManager.scrollElement(),o=function(a,l,u){for(var c=a;c&&mu(c)&&!Wr(c,"body");){if(c===u)return!1;if(ue(l,E==null?void 0:E.getComputedStyle(c).position))return!0;c=B_(c)}return!1}(H_(e),["fixed","sticky"],s);return{x:e.clientX+(o?0:i),y:e.clientY+(o?0:r),target_fixed:o,type:n}}ue(e,n){var r;if(n===void 0&&(n="click"),!L_(e.target)&&Tw(e)){var i=this.de(e,n);(r=this.rageclicks)!=null&&r.isRageClick(e.clientX,e.clientY,new Date().getTime())&&this.ve(j({},i,{type:"rageclick"})),this.ve(i)}}he(e){!L_(e.target)&&Tw(e)&&(clearTimeout(this.ce),this.ce=setTimeout(()=>{this.ve(this.de(e,"mousemove"))},500))}ve(e){if(E){var n=E.location.href;this.H=this.H||{},this.H[n]||(this.H[n]=[]),this.H[n].push(e)}}oe(){this.H&&!Ss(this.H)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}}class gT{constructor(e){this._instance=e}doPageView(e,n){var r,i=this.fe(e,n);return this.pe={pathname:(r=E==null?void 0:E.location.pathname)!==null&&r!==void 0?r:"",pageViewId:n,timestamp:e},this._instance.scrollManager.resetContext(),i}doPageLeave(e){var n;return this.fe(e,(n=this.pe)==null?void 0:n.pageViewId)}doEvent(){var e;return{$pageview_id:(e=this.pe)==null?void 0:e.pageViewId}}fe(e,n){var r=this.pe;if(!r)return{$pageview_id:n};var i={$pageview_id:n,$prev_pageview_id:r.pageViewId},s=this._instance.scrollManager.getContext();if(s&&!this._instance.config.disable_scroll_properties){var{maxScrollHeight:o,lastScrollY:a,maxScrollY:l,maxContentHeight:u,lastContentY:c,maxContentY:f}=s;if(!(D(o)||D(a)||D(l)||D(u)||D(c)||D(f))){o=Math.ceil(o),a=Math.ceil(a),l=Math.ceil(l),u=Math.ceil(u),c=Math.ceil(c),f=Math.ceil(f);var d=o<=1?1:Zt(a/o,0,1,U),h=o<=1?1:Zt(l/o,0,1,U),p=u<=1?1:Zt(c/u,0,1,U),v=u<=1?1:Zt(f/u,0,1,U);i=Ve(i,{$prev_pageview_last_scroll:a,$prev_pageview_last_scroll_percentage:d,$prev_pageview_max_scroll:l,$prev_pageview_max_scroll_percentage:h,$prev_pageview_last_content:c,$prev_pageview_last_content_percentage:p,$prev_pageview_max_content:f,$prev_pageview_max_content_percentage:v})}}return r.pathname&&(i.$prev_pageview_pathname=r.pathname),r.timestamp&&(i.$prev_pageview_duration=(e.getTime()-r.timestamp.getTime())/1e3),i}}var mT=function(t){var e,n,r,i,s="";for(e=n=0,r=(t=(t+"").replace(/\r\n/g,`
60
60
  `).replace(/\r/g,`
61
- `)).length,i=0;i<r;i++){var o=t.charCodeAt(i),a=null;o<128?n++:a=o>127&&o<2048?String.fromCharCode(o>>6|192,63&o|128):String.fromCharCode(o>>12|224,o>>6&63|128,63&o|128),dr(a)||(n>e&&(s+=t.substring(e,n)),s+=a,e=n=i+1)}return n>e&&(s+=t.substring(e,t.length)),s},yT=!!Kf||!!Gf,Pw="text/plain",Ou=(t,e)=>{var[n,r]=t.split("?"),i=j({},e);r==null||r.split("&").forEach(o=>{var[a]=o.split("=");delete i[a]});var s=wR(i);return n+"?"+(s=s?(r?r+"&":"")+s:r)},aa=(t,e)=>JSON.stringify(t,(n,r)=>typeof r=="bigint"?r.toString():r,e),Lh=t=>{var{data:e,compression:n}=t;if(e){if(n===hr.GZipJS){var r=gw(mw(aa(e)),{mtime:0}),i=new Blob([r],{type:Pw});return{contentType:Pw,body:i,estimatedSize:i.size}}if(n===hr.Base64){var s=function(l){var u,c,f,d,h,p="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",v=0,w=0,m="",g=[];if(!l)return l;l=mT(l);do u=(h=l.charCodeAt(v++)<<16|l.charCodeAt(v++)<<8|l.charCodeAt(v++))>>18&63,c=h>>12&63,f=h>>6&63,d=63&h,g[w++]=p.charAt(u)+p.charAt(c)+p.charAt(f)+p.charAt(d);while(v<l.length);switch(m=g.join(""),l.length%3){case 1:m=m.slice(0,-2)+"==";break;case 2:m=m.slice(0,-1)+"="}return m}(aa(e)),o=(l=>"data="+encodeURIComponent(typeof l=="string"?l:aa(l)))(s);return{contentType:"application/x-www-form-urlencoded",body:o,estimatedSize:new Blob([o]).size}}var a=aa(e);return{contentType:"application/json",body:a,estimatedSize:new Blob([a]).size}}},Au=[];Gf&&Au.push({transport:"fetch",method:t=>{var e,n,{contentType:r,body:i,estimatedSize:s}=(e=Lh(t))!==null&&e!==void 0?e:{},o=new Headers;Se(t.headers,function(c,f){o.append(f,c)}),r&&o.append("Content-Type",r);var a=t.url,l=null;if(i_){var u=new i_;l={signal:u.signal,timeout:setTimeout(()=>u.abort(),t.timeout)}}Gf(a,j({method:(t==null?void 0:t.method)||"GET",headers:o,keepalive:t.method==="POST"&&(s||0)<52428.8,body:i,signal:(n=l)==null?void 0:n.signal},t.fetchOptions)).then(c=>c.text().then(f=>{var d={statusCode:c.status,text:f};if(c.status===200)try{d.json=JSON.parse(f)}catch(h){U.error(h)}t.callback==null||t.callback(d)})).catch(c=>{U.error(c),t.callback==null||t.callback({statusCode:0,text:c})}).finally(()=>l?clearTimeout(l.timeout):null)}}),Kf&&Au.push({transport:"XHR",method:t=>{var e,n=new Kf;n.open(t.method||"GET",t.url,!0);var{contentType:r,body:i}=(e=Lh(t))!==null&&e!==void 0?e:{};Se(t.headers,function(s,o){n.setRequestHeader(o,s)}),r&&n.setRequestHeader("Content-Type",r),t.timeout&&(n.timeout=t.timeout),t.disableXHRCredentials||(n.withCredentials=!0),n.onreadystatechange=()=>{if(n.readyState===4){var s={statusCode:n.status,text:n.responseText};if(n.status===200)try{s.json=JSON.parse(n.responseText)}catch{}t.callback==null||t.callback(s)}},n.send(i)}}),Xt!=null&&Xt.sendBeacon&&Au.push({transport:"sendBeacon",method:t=>{var e=Ou(t.url,{beacon:"1"});try{var n,{contentType:r,body:i}=(n=Lh(t))!==null&&n!==void 0?n:{},s=typeof i=="string"?new Blob([i],{type:r}):i;Xt.sendBeacon(e,s)}catch{}}});var Ms=function(t,e){if(!function(n){try{new RegExp(n)}catch{return!1}return!0}(e))return!1;try{return new RegExp(e).test(t)}catch{return!1}};function Mw(t,e,n){return aa({distinct_id:t,userPropertiesToSet:e,userPropertiesToSetOnce:n})}var Ow={exact:(t,e)=>e.some(n=>t.some(r=>n===r)),is_not:(t,e)=>e.every(n=>t.every(r=>n!==r)),regex:(t,e)=>e.some(n=>t.some(r=>Ms(n,r))),not_regex:(t,e)=>e.every(n=>t.every(r=>!Ms(n,r))),icontains:(t,e)=>e.map(Iu).some(n=>t.map(Iu).some(r=>n.includes(r))),not_icontains:(t,e)=>e.map(Iu).every(n=>t.map(Iu).every(r=>!n.includes(r)))},Iu=t=>t.toLowerCase(),Aw=Je("[Error tracking]");class _T{constructor(e){var n,r;this.ge=[],this._e=new Y3([new Q3,new sR,new Z3,new X3,new rR,new nR,new eR,new iR],[q3,G3]),this._instance=e,this.ge=(n=(r=this._instance.persistence)==null?void 0:r.get_property(rh))!==null&&n!==void 0?n:[]}onRemoteConfig(e){var n,r,i,s=(n=(r=e.errorTracking)==null?void 0:r.suppressionRules)!==null&&n!==void 0?n:[],o=(i=e.errorTracking)==null?void 0:i.captureExtensionExceptions;this.ge=s,this._instance.persistence&&this._instance.persistence.register({[rh]:this.ge,[S_]:o})}get me(){var e,n=!!this._instance.get_property(S_),r=this._instance.config.error_tracking.captureExtensionExceptions;return(e=r??n)!==null&&e!==void 0&&e}buildProperties(e,n){return this._e.buildFromUnknown(e,{syntheticException:n==null?void 0:n.syntheticException,mechanism:{handled:n==null?void 0:n.handled}})}sendExceptionEvent(e){if(this.ye(e))Aw.info("Skipping exception capture because a suppression rule matched");else{if(this.me||!this.be(e))return this._instance.capture("$exception",e,{_noTruncate:!0,_batchKey:"exceptionEvent"});Aw.info("Skipping exception capture because it was thrown by an extension")}}ye(e){var n=e.$exception_list;if(!n||!Ce(n)||n.length===0)return!1;var r=n.reduce((i,s)=>{var{type:o,value:a}=s;return Ue(o)&&o.length>0&&i.$exception_types.push(o),Ue(a)&&a.length>0&&i.$exception_values.push(a),i},{$exception_types:[],$exception_values:[]});return this.ge.some(i=>{var s=i.values.map(o=>{var a,l=Ow[o.operator],u=Ce(o.value)?o.value:[o.value],c=(a=r[o.key])!==null&&a!==void 0?a:[];return u.length>0&&l(u,c)});return i.type==="OR"?s.some(Boolean):s.every(Boolean)})}be(e){var n=e.$exception_list;return!(!n||!Ce(n))&&n.flatMap(r=>{var i,s;return(i=(s=r.stacktrace)==null?void 0:s.frames)!==null&&i!==void 0?i:[]}).some(r=>r.filename&&r.filename.startsWith("chrome-extension://"))}}var fn="Mobile",Fu="iOS",Kn="Android",la="Tablet",Iw=Kn+" "+la,Fw="iPad",Lw="Apple",Dw=Lw+" Watch",ua="Safari",Os="BlackBerry",Nw="Samsung",jw=Nw+"Browser",zw=Nw+" Internet",Ii="Chrome",wT=Ii+" OS",Hw=Ii+" "+Fu,Dh="Internet Explorer",Uw=Dh+" "+fn,Nh="Opera",bT=Nh+" Mini",jh="Edge",Bw="Microsoft "+jh,As="Firefox",qw=As+" "+Fu,ca="Nintendo",da="PlayStation",Is="Xbox",Vw=Kn+" "+fn,Ww=fn+" "+ua,fa="Windows",zh=fa+" Phone",Gw="Nokia",Hh="Ouya",Kw="Generic",xT=Kw+" "+fn.toLowerCase(),Yw=Kw+" "+la.toLowerCase(),Uh="Konqueror",Rt="(\\d+(\\.\\d+)?)",Bh=new RegExp("Version/"+Rt),kT=new RegExp(Is,"i"),ST=new RegExp(da+" \\w+","i"),ET=new RegExp(ca+" \\w+","i"),qh=new RegExp(Os+"|PlayBook|BB10","i"),$T={"NT3.51":"NT 3.11","NT4.0":"NT 4.0","5.0":"2000",5.1:"XP",5.2:"XP","6.0":"Vista",6.1:"7",6.2:"8",6.3:"8.1",6.4:"10","10.0":"10"},CT=(t,e)=>e&&ue(e,Lw)||function(n){return ue(n,ua)&&!ue(n,Ii)&&!ue(n,Kn)}(t),Qw=function(t,e){return e=e||"",ue(t," OPR/")&&ue(t,"Mini")?bT:ue(t," OPR/")?Nh:qh.test(t)?Os:ue(t,"IE"+fn)||ue(t,"WPDesktop")?Uw:ue(t,jw)?zw:ue(t,jh)||ue(t,"Edg/")?Bw:ue(t,"FBIOS")?"Facebook "+fn:ue(t,"UCWEB")||ue(t,"UCBrowser")?"UC Browser":ue(t,"CriOS")?Hw:ue(t,"CrMo")||ue(t,Ii)?Ii:ue(t,Kn)&&ue(t,ua)?Vw:ue(t,"FxiOS")?qw:ue(t.toLowerCase(),Uh.toLowerCase())?Uh:CT(t,e)?ue(t,fn)?Ww:ua:ue(t,As)?As:ue(t,"MSIE")||ue(t,"Trident/")?Dh:ue(t,"Gecko")?As:""},RT={[Uw]:[new RegExp("rv:"+Rt)],[Bw]:[new RegExp(jh+"?\\/"+Rt)],[Ii]:[new RegExp("("+Ii+"|CrMo)\\/"+Rt)],[Hw]:[new RegExp("CriOS\\/"+Rt)],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/"+Rt)],[ua]:[Bh],[Ww]:[Bh],[Nh]:[new RegExp("(Opera|OPR)\\/"+Rt)],[As]:[new RegExp(As+"\\/"+Rt)],[qw]:[new RegExp("FxiOS\\/"+Rt)],[Uh]:[new RegExp("Konqueror[:/]?"+Rt,"i")],[Os]:[new RegExp(Os+" "+Rt),Bh],[Vw]:[new RegExp("android\\s"+Rt,"i")],[zw]:[new RegExp(jw+"\\/"+Rt)],[Dh]:[new RegExp("(rv:|MSIE )"+Rt)],Mozilla:[new RegExp("rv:"+Rt)]},TT=function(t,e){var n=Qw(t,e),r=RT[n];if(D(r))return null;for(var i=0;i<r.length;i++){var s=r[i],o=t.match(s);if(o)return parseFloat(o[o.length-2])}return null},Xw=[[new RegExp(Is+"; "+Is+" (.*?)[);]","i"),t=>[Is,t&&t[1]||""]],[new RegExp(ca,"i"),[ca,""]],[new RegExp(da,"i"),[da,""]],[qh,[Os,""]],[new RegExp(fa,"i"),(t,e)=>{if(/Phone/.test(e)||/WPDesktop/.test(e))return[zh,""];if(new RegExp(fn).test(e)&&!/IEMobile\b/.test(e))return[fa+" "+fn,""];var n=/Windows NT ([0-9.]+)/i.exec(e);if(n&&n[1]){var r=n[1],i=$T[r]||"";return/arm/i.test(e)&&(i="RT"),[fa,i]}return[fa,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,t=>{if(t&&t[3]){var e=[t[3],t[4],t[5]||"0"];return[Fu,e.join(".")]}return[Fu,""]}],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,t=>{var e="";return t&&t.length>=3&&(e=D(t[2])?t[3]:t[2]),["watchOS",e]}],[new RegExp("("+Kn+" (\\d+)\\.(\\d+)\\.?(\\d+)?|"+Kn+")","i"),t=>{if(t&&t[2]){var e=[t[2],t[3],t[4]||"0"];return[Kn,e.join(".")]}return[Kn,""]}],[/Mac OS X (\d+)[_.](\d+)[_.]?(\d+)?/i,t=>{var e=["Mac OS X",""];if(t&&t[1]){var n=[t[1],t[2],t[3]||"0"];e[1]=n.join(".")}return e}],[/Mac/i,["Mac OS X",""]],[/CrOS/,[wT,""]],[/Linux|debian/i,["Linux",""]]],Zw=function(t){return ET.test(t)?ca:ST.test(t)?da:kT.test(t)?Is:new RegExp(Hh,"i").test(t)?Hh:new RegExp("("+zh+"|WPDesktop)","i").test(t)?zh:/iPad/.test(t)?Fw:/iPod/.test(t)?"iPod Touch":/iPhone/.test(t)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(t)?Dw:qh.test(t)?Os:/(kobo)\s(ereader|touch)/i.test(t)?"Kobo":new RegExp(Gw,"i").test(t)?Gw:/(kf[a-z]{2}wi|aeo[c-r]{2})( bui|\))/i.test(t)||/(kf[a-z]+)( bui|\)).+silk\//i.test(t)?"Kindle Fire":/(Android|ZTE)/i.test(t)?!new RegExp(fn).test(t)||/(9138B|TB782B|Nexus [97]|pixel c|HUAWEISHT|BTV|noble nook|smart ultra 6)/i.test(t)?/pixel[\daxl ]{1,6}/i.test(t)&&!/pixel c/i.test(t)||/(huaweimed-al00|tah-|APA|SM-G92|i980|zte|U304AA)/i.test(t)||/lmy47v/i.test(t)&&!/QTAQZ3/i.test(t)?Kn:Iw:Kn:new RegExp("(pda|"+fn+")","i").test(t)?xT:new RegExp(la,"i").test(t)&&!new RegExp(la+" pc","i").test(t)?Yw:""},Lu="https?://(.*)",Du=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],PT=cu(["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid"],Du),Vh="<masked>",MT=["li_fat_id"];function Jw(t,e,n){if(!B)return{};var r,i=e?cu([],Du,n||[]):[],s=e1(_h(B.URL,i,Vh),t),o=(r={},Se(MT,function(a){var l=qn.J(a);r[a]=l||null}),r);return Ve(o,s)}function e1(t,e){var n=PT.concat(e||[]),r={};return Se(n,function(i){var s=wu(t,i);r[i]=s||null}),r}function t1(t){var e=function(s){return s?s.search(Lu+"google.([^/?]*)")===0?"google":s.search(Lu+"bing.com")===0?"bing":s.search(Lu+"yahoo.com")===0?"yahoo":s.search(Lu+"duckduckgo.com")===0?"duckduckgo":null:null}(t),n=e!="yahoo"?"q":"p",r={};if(!dr(e)){r.$search_engine=e;var i=B?wu(B.referrer,n):"";i.length&&(r.ph_keyword=i)}return r}function n1(){return navigator.language||navigator.userLanguage}function r1(){return(B==null?void 0:B.referrer)||"$direct"}function i1(t,e){var n=t?cu([],Du,e||[]):[],r=Dt==null?void 0:Dt.href.substring(0,1e3);return{r:r1().substring(0,1e3),u:r?_h(r,n,Vh):void 0}}function s1(t){var e,{r:n,u:r}=t,i={$referrer:n,$referring_domain:n==null?void 0:n=="$direct"?"$direct":(e=Ts(n))==null?void 0:e.host};if(r){i.$current_url=r;var s=Ts(r);i.$host=s==null?void 0:s.host,i.$pathname=s==null?void 0:s.pathname;var o=e1(r);Ve(i,o)}if(n){var a=t1(n);Ve(i,a)}return i}function o1(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch{return}}function OT(){try{return new Date().getTimezoneOffset()}catch{return}}function AT(t,e){if(!Nt)return{};var n,r,i,s=t?cu([],Du,e||[]):[],[o,a]=function(l){for(var u=0;u<Xw.length;u++){var[c,f]=Xw[u],d=c.exec(l),h=d&&(cn(f)?f(d,l):f);if(h)return h}return["",""]}(Nt);return Ve(th({$os:o,$os_version:a,$browser:Qw(Nt,navigator.vendor),$device:Zw(Nt),$device_type:(r=Nt,i=Zw(r),i===Fw||i===Iw||i==="Kobo"||i==="Kindle Fire"||i===Yw?la:i===ca||i===Is||i===da||i===Hh?"Console":i===Dw?"Wearable":i?fn:"Desktop"),$timezone:o1(),$timezone_offset:OT()}),{$current_url:_h(Dt==null?void 0:Dt.href,s,Vh),$host:Dt==null?void 0:Dt.host,$pathname:Dt==null?void 0:Dt.pathname,$raw_user_agent:Nt.length>1e3?Nt.substring(0,997)+"...":Nt,$browser_version:TT(Nt,navigator.vendor),$browser_language:n1(),$browser_language_prefix:(n=n1(),typeof n=="string"?n.split("-")[0]:void 0),$screen_height:E==null?void 0:E.screen.height,$screen_width:E==null?void 0:E.screen.width,$viewport_height:E==null?void 0:E.innerHeight,$viewport_width:E==null?void 0:E.innerWidth,$lib:"web",$lib_version:cr.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3})}var Pn=Je("[FeatureFlags]"),Wh="$active_feature_flags",Fs="$override_feature_flags",a1="$feature_flag_payloads",ha="$override_feature_flag_payloads",l1="$feature_flag_request_id",u1=t=>{var e={};for(var[n,r]of du(t||{}))r&&(e[n]=r);return e},IT=t=>{var e=t.flags;return e?(t.featureFlags=Object.fromEntries(Object.keys(e).map(n=>{var r;return[n,(r=e[n].variant)!==null&&r!==void 0?r:e[n].enabled]})),t.featureFlagPayloads=Object.fromEntries(Object.keys(e).filter(n=>e[n].enabled).filter(n=>{var r;return(r=e[n].metadata)==null?void 0:r.payload}).map(n=>{var r;return[n,(r=e[n].metadata)==null?void 0:r.payload]}))):Pn.warn("Using an older version of the feature flags endpoint. Please upgrade your PostHog server to the latest version"),t},FT=function(t){return t.FeatureFlags="feature_flags",t.Recordings="recordings",t}({});class LT{constructor(e){this.we=!1,this.Se=!1,this.ke=!1,this.$e=!1,this.xe=!1,this.Ee=!1,this.Re=!1,this._instance=e,this.featureFlagEventHandlers=[]}Ie(){var e=this._instance.config.evaluation_environments;return e!=null&&e.length?e.filter(n=>{var r=n&&typeof n=="string"&&n.trim().length>0;return r||Pn.error("Invalid evaluation environment found:",n,"Expected non-empty string"),r}):[]}Pe(){return this.Ie().length>0}flags(){if(this._instance.config.__preview_remote_config)this.Ee=!0;else{var e=!this.Te&&(this._instance.config.advanced_disable_feature_flags||this._instance.config.advanced_disable_feature_flags_on_first_load);this.Ce({disableFlags:e})}}get hasLoadedFlags(){return this.Se}getFlags(){return Object.keys(this.getFlagVariants())}getFlagsWithDetails(){var e=this._instance.get_property(lh),n=this._instance.get_property(Fs),r=this._instance.get_property(ha);if(!r&&!n)return e||{};var i=Ve({},e||{}),s=[...new Set([...Object.keys(r||{}),...Object.keys(n||{})])];for(var o of s){var a,l,u=i[o],c=n==null?void 0:n[o],f=D(c)?(a=u==null?void 0:u.enabled)!==null&&a!==void 0&&a:!!c,d=D(c)?u.variant:typeof c=="string"?c:void 0,h=r==null?void 0:r[o],p=j({},u,{enabled:f,variant:f?d??(u==null?void 0:u.variant):void 0});f!==(u==null?void 0:u.enabled)&&(p.original_enabled=u==null?void 0:u.enabled),d!==(u==null?void 0:u.variant)&&(p.original_variant=u==null?void 0:u.variant),h&&(p.metadata=j({},u==null?void 0:u.metadata,{payload:h,original_payload:u==null||(l=u.metadata)==null?void 0:l.payload})),i[o]=p}return this.we||(Pn.warn(" Overriding feature flag details!",{flagDetails:e,overriddenPayloads:r,finalDetails:i}),this.we=!0),i}getFlagVariants(){var e=this._instance.get_property(Cs),n=this._instance.get_property(Fs);if(!n)return e||{};for(var r=Ve({},e),i=Object.keys(n),s=0;s<i.length;s++)r[i[s]]=n[i[s]];return this.we||(Pn.warn(" Overriding feature flags!",{enabledFlags:e,overriddenFlags:n,finalFlags:r}),this.we=!0),r}getFlagPayloads(){var e=this._instance.get_property(a1),n=this._instance.get_property(ha);if(!n)return e||{};for(var r=Ve({},e||{}),i=Object.keys(n),s=0;s<i.length;s++)r[i[s]]=n[i[s]];return this.we||(Pn.warn(" Overriding feature flag payloads!",{flagPayloads:e,overriddenPayloads:n,finalPayloads:r}),this.we=!0),r}reloadFeatureFlags(){this.$e||this._instance.config.advanced_disable_feature_flags||this.Te||(this.Te=setTimeout(()=>{this.Ce()},5))}Me(){clearTimeout(this.Te),this.Te=void 0}ensureFlagsLoaded(){this.Se||this.ke||this.Te||this.reloadFeatureFlags()}setAnonymousDistinctId(e){this.$anon_distinct_id=e}setReloadingPaused(e){this.$e=e}Ce(e){var n;if(this.Me(),!this._instance.L())if(this.ke)this.xe=!0;else{var r={token:this._instance.config.token,distinct_id:this._instance.get_distinct_id(),groups:this._instance.getGroups(),$anon_distinct_id:this.$anon_distinct_id,person_properties:j({},((n=this._instance.persistence)==null?void 0:n.get_initial_props())||{},this._instance.get_property(Jo)||{}),group_properties:this._instance.get_property(Ri)};(e!=null&&e.disableFlags||this._instance.config.advanced_disable_feature_flags)&&(r.disable_flags=!0),this.Pe()&&(r.evaluation_environments=this.Ie());var i=this._instance.config.__preview_remote_config,s=i?"/flags/?v=2":"/flags/?v=2&config=true",o=this._instance.config.advanced_only_evaluate_survey_feature_flags?"&only_evaluate_survey_feature_flags=true":"",a=this._instance.requestRouter.endpointFor("api",s+o);i&&(r.timezone=o1()),this.ke=!0,this._instance.Oe({method:"POST",url:a,data:r,compression:this._instance.config.disable_compression?void 0:hr.Base64,timeout:this._instance.config.feature_flag_request_timeout_ms,callback:l=>{var u,c,f=!0;if(l.statusCode===200&&(this.xe||(this.$anon_distinct_id=void 0),f=!1),this.ke=!1,this.Ee||(this.Ee=!0,this._instance.Fe((c=l.json)!==null&&c!==void 0?c:{})),!r.disable_flags||this.xe)if(this.Re=!f,l.json&&(u=l.json.quotaLimited)!=null&&u.includes(FT.FeatureFlags))Pn.warn("You have hit your feature flags quota limit, and will not be able to load feature flags until the quota is reset. Please visit https://posthog.com/docs/billing/limits-alerts to learn more.");else{var d;r.disable_flags||this.receivedFeatureFlags((d=l.json)!==null&&d!==void 0?d:{},f),this.xe&&(this.xe=!1,this.Ce())}}})}}getFeatureFlag(e,n){if(n===void 0&&(n={}),this.Se||this.getFlags()&&this.getFlags().length>0){var r=this.getFlagVariants()[e],i=""+r,s=this._instance.get_property(l1)||void 0,o=this._instance.get_property(pu)||{};if((n.send_event||!("send_event"in n))&&(!(e in o)||!o[e].includes(i))){var a,l,u,c,f,d,h,p,v;Ce(o[e])?o[e].push(i):o[e]=[i],(a=this._instance.persistence)==null||a.register({[pu]:o});var w=this.getFeatureFlagDetails(e),m={$feature_flag:e,$feature_flag_response:r,$feature_flag_payload:this.getFeatureFlagPayload(e)||null,$feature_flag_request_id:s,$feature_flag_bootstrapped_response:((l=this._instance.config.bootstrap)==null||(l=l.featureFlags)==null?void 0:l[e])||null,$feature_flag_bootstrapped_payload:((u=this._instance.config.bootstrap)==null||(u=u.featureFlagPayloads)==null?void 0:u[e])||null,$used_bootstrap_value:!this.Re};D(w==null||(c=w.metadata)==null?void 0:c.version)||(m.$feature_flag_version=w.metadata.version);var g,y=(f=w==null||(d=w.reason)==null?void 0:d.description)!==null&&f!==void 0?f:w==null||(h=w.reason)==null?void 0:h.code;y&&(m.$feature_flag_reason=y),w!=null&&(p=w.metadata)!=null&&p.id&&(m.$feature_flag_id=w.metadata.id),D(w==null?void 0:w.original_variant)&&D(w==null?void 0:w.original_enabled)||(m.$feature_flag_original_response=D(w.original_variant)?w.original_enabled:w.original_variant),w!=null&&(v=w.metadata)!=null&&v.original_payload&&(m.$feature_flag_original_payload=w==null||(g=w.metadata)==null?void 0:g.original_payload),this._instance.capture("$feature_flag_called",m)}return r}Pn.warn('getFeatureFlag for key "'+e+`" failed. Feature flags didn't load in time.`)}getFeatureFlagDetails(e){return this.getFlagsWithDetails()[e]}getFeatureFlagPayload(e){return this.getFlagPayloads()[e]}getRemoteConfigPayload(e,n){var r=this._instance.config.token,i={distinct_id:this._instance.get_distinct_id(),token:r};this.Pe()&&(i.evaluation_environments=this.Ie()),this._instance.Oe({method:"POST",url:this._instance.requestRouter.endpointFor("api","/flags/?v=2&config=true"),data:i,compression:this._instance.config.disable_compression?void 0:hr.Base64,timeout:this._instance.config.feature_flag_request_timeout_ms,callback:s=>{var o,a=(o=s.json)==null?void 0:o.featureFlagPayloads;n((a==null?void 0:a[e])||void 0)}})}isFeatureEnabled(e,n){if(n===void 0&&(n={}),this.Se||this.getFlags()&&this.getFlags().length>0){var r=this.getFeatureFlag(e,n);return D(r)?void 0:!!r}Pn.warn('isFeatureEnabled for key "'+e+`" failed. Feature flags didn't load in time.`)}addFeatureFlagsHandler(e){this.featureFlagEventHandlers.push(e)}removeFeatureFlagsHandler(e){this.featureFlagEventHandlers=this.featureFlagEventHandlers.filter(n=>n!==e)}receivedFeatureFlags(e,n){if(this._instance.persistence){this.Se=!0;var r=this.getFlagVariants(),i=this.getFlagPayloads(),s=this.getFlagsWithDetails();(function(o,a,l,u,c){l===void 0&&(l={}),u===void 0&&(u={}),c===void 0&&(c={});var f=IT(o),d=f.flags,h=f.featureFlags,p=f.featureFlagPayloads;if(h){var v=o.requestId;if(Ce(h)){Pn.warn("v1 of the feature flags endpoint is deprecated. Please use the latest version.");var w={};if(h)for(var m=0;m<h.length;m++)w[h[m]]=!0;a&&a.register({[Wh]:h,[Cs]:w})}else{var g=h,y=p,b=d;o.errorsWhileComputingFlags&&(g=j({},l,g),y=j({},u,y),b=j({},c,b)),a&&a.register(j({[Wh]:Object.keys(u1(g)),[Cs]:g||{},[a1]:y||{},[lh]:b||{}},v?{[l1]:v}:{}))}}})(e,this._instance.persistence,r,i,s),this.Ae(n)}}override(e,n){n===void 0&&(n=!1),Pn.warn("override is deprecated. Please use overrideFeatureFlags instead."),this.overrideFeatureFlags({flags:e,suppressWarning:n})}overrideFeatureFlags(e){if(!this._instance.__loaded||!this._instance.persistence)return Pn.uninitializedWarning("posthog.featureFlags.overrideFeatureFlags");if(e===!1)return this._instance.persistence.unregister(Fs),this._instance.persistence.unregister(ha),void this.Ae();if(e&&typeof e=="object"&&("flags"in e||"payloads"in e)){var n,r=e;if(this.we=!!((n=r.suppressWarning)!==null&&n!==void 0&&n),"flags"in r){if(r.flags===!1)this._instance.persistence.unregister(Fs);else if(r.flags)if(Ce(r.flags)){for(var i={},s=0;s<r.flags.length;s++)i[r.flags[s]]=!0;this._instance.persistence.register({[Fs]:i})}else this._instance.persistence.register({[Fs]:r.flags})}return"payloads"in r&&(r.payloads===!1?this._instance.persistence.unregister(ha):r.payloads&&this._instance.persistence.register({[ha]:r.payloads})),void this.Ae()}this.Ae()}onFeatureFlags(e){if(this.addFeatureFlagsHandler(e),this.Se){var{flags:n,flagVariants:r}=this.De();e(n,r)}return()=>this.removeFeatureFlagsHandler(e)}updateEarlyAccessFeatureEnrollment(e,n,r){var i,s=(this._instance.get_property(Zo)||[]).find(u=>u.flagKey===e),o={["$feature_enrollment/"+e]:n},a={$feature_flag:e,$feature_enrollment:n,$set:o};s&&(a.$early_access_feature_name=s.name),r&&(a.$feature_enrollment_stage=r),this._instance.capture("$feature_enrollment_update",a),this.setPersonPropertiesForFlags(o,!1);var l=j({},this.getFlagVariants(),{[e]:n});(i=this._instance.persistence)==null||i.register({[Wh]:Object.keys(u1(l)),[Cs]:l}),this.Ae()}getEarlyAccessFeatures(e,n,r){n===void 0&&(n=!1);var i=this._instance.get_property(Zo),s=r?"&"+r.map(o=>"stage="+o).join("&"):"";if(i&&!n)return e(i);this._instance.Oe({url:this._instance.requestRouter.endpointFor("api","/api/early_access_features/?token="+this._instance.config.token+s),method:"GET",callback:o=>{var a,l;if(o.json){var u=o.json.earlyAccessFeatures;return(a=this._instance.persistence)==null||a.unregister(Zo),(l=this._instance.persistence)==null||l.register({[Zo]:u}),e(u)}}})}De(){var e=this.getFlags(),n=this.getFlagVariants();return{flags:e.filter(r=>n[r]),flagVariants:Object.keys(n).filter(r=>n[r]).reduce((r,i)=>(r[i]=n[i],r),{})}}Ae(e){var{flags:n,flagVariants:r}=this.De();this.featureFlagEventHandlers.forEach(i=>i(n,r,{errorsLoading:e}))}setPersonPropertiesForFlags(e,n){n===void 0&&(n=!0);var r=this._instance.get_property(Jo)||{};this._instance.register({[Jo]:j({},r,e)}),n&&this._instance.reloadFeatureFlags()}resetPersonPropertiesForFlags(){this._instance.unregister(Jo)}setGroupPropertiesForFlags(e,n){n===void 0&&(n=!0);var r=this._instance.get_property(Ri)||{};Object.keys(r).length!==0&&Object.keys(r).forEach(i=>{r[i]=j({},r[i],e[i]),delete e[i]}),this._instance.register({[Ri]:j({},r,e)}),n&&this._instance.reloadFeatureFlags()}resetGroupPropertiesForFlags(e){if(e){var n=this._instance.get_property(Ri)||{};this._instance.register({[Ri]:j({},n,{[e]:{}})})}else this._instance.unregister(Ri)}reset(){this.Se=!1,this.ke=!1,this.$e=!1,this.xe=!1,this.Ee=!1,this.Re=!1,this.$anon_distinct_id=void 0,this.Me(),this.we=!1}}var DT=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"];class Gh{constructor(e,n){this.A=e,this.props={},this.je=!1,this.Le=(r=>{var i="";return r.token&&(i=r.token.replace(/\+/g,"PL").replace(/\//g,"SL").replace(/=/g,"EQ")),r.persistence_name?"ph_"+r.persistence_name:"ph_"+i+"_posthog"})(e),this.it=this.Ne(e),this.load(),e.debug&&U.info("Persistence loaded",e.persistence,j({},this.props)),this.update_config(e,e,n),this.save()}isDisabled(){return!!this.Ue}Ne(e){DT.indexOf(e.persistence.toLowerCase())===-1&&(U.critical("Unknown persistence type "+e.persistence+"; falling back to localStorage+cookie"),e.persistence="localStorage+cookie");var n=e.persistence.toLowerCase();return n==="localstorage"&&et.G()?et:n==="localstorage+cookie"&&ku.G()?ku:n==="sessionstorage"&&ut.G()?ut:n==="memory"?MR:n==="cookie"?qn:ku.G()?ku:qn}properties(){var e={};return Se(this.props,function(n,r){if(r===Cs&&He(n))for(var i=Object.keys(n),s=0;s<i.length;s++)e["$feature/"+i[s]]=n[i[s]];else a=r,l=!1,(dr(o=dR)?l:r_&&o.indexOf===r_?o.indexOf(a)!=-1:(Se(o,function(u){if(l||(l=u===a))return uu}),l))||(e[r]=n);var o,a,l}),e}load(){if(!this.Ue){var e=this.it.K(this.Le);e&&(this.props=Ve({},e))}}save(){this.Ue||this.it.Y(this.Le,this.props,this.ze,this.Be,this.qe,this.A.debug)}remove(){this.it.X(this.Le,!1),this.it.X(this.Le,!0)}clear(){this.remove(),this.props={}}register_once(e,n,r){if(He(e)){D(n)&&(n="None"),this.ze=D(r)?this.He:r;var i=!1;if(Se(e,(s,o)=>{this.props.hasOwnProperty(o)&&this.props[o]!==n||(this.props[o]=s,i=!0)}),i)return this.save(),!0}return!1}register(e,n){if(He(e)){this.ze=D(n)?this.He:n;var r=!1;if(Se(e,(i,s)=>{e.hasOwnProperty(s)&&this.props[s]!==i&&(this.props[s]=i,r=!0)}),r)return this.save(),!0}return!1}unregister(e){e in this.props&&(delete this.props[e],this.save())}update_campaign_params(){if(!this.je){var e=Jw(this.A.custom_campaign_params,this.A.mask_personal_data_properties,this.A.custom_personal_data_properties);Ss(th(e))||this.register(e),this.je=!0}}update_search_keyword(){var e;this.register((e=B==null?void 0:B.referrer)?t1(e):{})}update_referrer_info(){var e;this.register_once({$referrer:r1(),$referring_domain:B!=null&&B.referrer&&((e=Ts(B.referrer))==null?void 0:e.host)||"$direct"},void 0)}set_initial_person_info(){this.props[fh]||this.props[hh]||this.register_once({[vu]:i1(this.A.mask_personal_data_properties,this.A.custom_personal_data_properties)},void 0)}get_initial_props(){var e={};Se([hh,fh],o=>{var a=this.props[o];a&&Se(a,function(l,u){e["$initial_"+Yf(u)]=l})});var n,r,i=this.props[vu];if(i){var s=(n=s1(i),r={},Se(n,function(o,a){r["$initial_"+Yf(a)]=o}),r);Ve(e,s)}return e}safe_merge(e){return Se(this.props,function(n,r){r in e||(e[r]=n)}),e}update_config(e,n,r){if(this.He=this.ze=e.cookie_expiration,this.set_disabled(e.disable_persistence||!!r),this.set_cross_subdomain(e.cross_subdomain_cookie),this.set_secure(e.secure_cookie),e.persistence!==n.persistence){var i=this.Ne(e),s=this.props;this.clear(),this.it=i,this.props=s,this.save()}}set_disabled(e){this.Ue=e,this.Ue?this.remove():this.save()}set_cross_subdomain(e){e!==this.Be&&(this.Be=e,this.remove(),this.save())}set_secure(e){e!==this.qe&&(this.qe=e,this.remove(),this.save())}set_event_timer(e,n){var r=this.props[Xo]||{};r[e]=n,this.props[Xo]=r,this.save()}remove_event_timer(e){var n=(this.props[Xo]||{})[e];return D(n)||(delete this.props[Xo][e],this.save()),n}get_property(e){return this.props[e]}set_property(e,n){this.props[e]=n,this.save()}}(function(t){return t.Button="button",t.Tab="tab",t.Selector="selector",t})({}),function(t){return t.TopLeft="top_left",t.TopRight="top_right",t.TopCenter="top_center",t.MiddleLeft="middle_left",t.MiddleRight="middle_right",t.MiddleCenter="middle_center",t.Left="left",t.Center="center",t.Right="right",t.NextToTrigger="next_to_trigger",t}({});var Kh=function(t){return t.Popover="popover",t.API="api",t.Widget="widget",t.ExternalSurvey="external_survey",t}({});(function(t){return t.Open="open",t.MultipleChoice="multiple_choice",t.SingleChoice="single_choice",t.Rating="rating",t.Link="link",t})({}),function(t){return t.NextQuestion="next_question",t.End="end",t.ResponseBased="response_based",t.SpecificQuestion="specific_question",t}({}),function(t){return t.Once="once",t.Recurring="recurring",t.Always="always",t}({});var Nu=function(t){return t.SHOWN="survey shown",t.DISMISSED="survey dismissed",t.SENT="survey sent",t}({}),c1=function(t){return t.SURVEY_ID="$survey_id",t.SURVEY_NAME="$survey_name",t.SURVEY_RESPONSE="$survey_response",t.SURVEY_ITERATION="$survey_iteration",t.SURVEY_ITERATION_START_DATE="$survey_iteration_start_date",t.SURVEY_PARTIALLY_COMPLETED="$survey_partially_completed",t.SURVEY_SUBMISSION_ID="$survey_submission_id",t.SURVEY_QUESTIONS="$survey_questions",t.SURVEY_COMPLETED="$survey_completed",t}({}),d1=function(t){return t.Popover="popover",t.Inline="inline",t}({});class Yh{constructor(){this.We={},this.We={}}on(e,n){return this.We[e]||(this.We[e]=[]),this.We[e].push(n),()=>{this.We[e]=this.We[e].filter(r=>r!==n)}}emit(e,n){for(var r of this.We[e]||[])r(n);for(var i of this.We["*"]||[])i(e,n)}}class Fi{constructor(e){this.Ge=new Yh,this.Ve=(n,r)=>this.Je(n,r)&&this.Ke(n,r)&&this.Ye(n,r),this.Je=(n,r)=>r==null||!r.event||(n==null?void 0:n.event)===(r==null?void 0:r.event),this._instance=e,this.Xe=new Set,this.Qe=new Set}init(){var e;if(!D((e=this._instance)==null?void 0:e.Ze)){var n;(n=this._instance)==null||n.Ze((r,i)=>{this.on(r,i)})}}register(e){var n,r;if(!D((n=this._instance)==null?void 0:n.Ze)&&(e.forEach(o=>{var a,l;(a=this.Qe)==null||a.add(o),(l=o.steps)==null||l.forEach(u=>{var c;(c=this.Xe)==null||c.add((u==null?void 0:u.event)||"")})}),(r=this._instance)!=null&&r.autocapture)){var i,s=new Set;e.forEach(o=>{var a;(a=o.steps)==null||a.forEach(l=>{l!=null&&l.selector&&s.add(l==null?void 0:l.selector)})}),(i=this._instance)==null||i.autocapture.setElementSelectors(s)}}on(e,n){var r;n!=null&&e.length!=0&&(this.Xe.has(e)||this.Xe.has(n==null?void 0:n.event))&&this.Qe&&((r=this.Qe)==null?void 0:r.size)>0&&this.Qe.forEach(i=>{this.tr(n,i)&&this.Ge.emit("actionCaptured",i.name)})}ir(e){this.onAction("actionCaptured",n=>e(n))}tr(e,n){if((n==null?void 0:n.steps)==null)return!1;for(var r of n.steps)if(this.Ve(e,r))return!0;return!1}onAction(e,n){return this.Ge.on(e,n)}Ke(e,n){if(n!=null&&n.url){var r,i=e==null||(r=e.properties)==null?void 0:r.$current_url;if(!i||typeof i!="string"||!Fi.er(i,n==null?void 0:n.url,(n==null?void 0:n.url_matching)||"contains"))return!1}return!0}static er(e,n,r){switch(r){case"regex":return!!E&&Ms(e,n);case"exact":return n===e;case"contains":var i=Fi.rr(n).replace(/_/g,".").replace(/%/g,".*");return Ms(e,i);default:return!1}}static rr(e){return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}Ye(e,n){if((n!=null&&n.href||n!=null&&n.tag_name||n!=null&&n.text)&&!this.sr(e).some(s=>!(n!=null&&n.href&&!Fi.er(s.href||"",n==null?void 0:n.href,(n==null?void 0:n.href_matching)||"exact"))&&(n==null||!n.tag_name||s.tag_name===(n==null?void 0:n.tag_name))&&!(n!=null&&n.text&&!Fi.er(s.text||"",n==null?void 0:n.text,(n==null?void 0:n.text_matching)||"exact")&&!Fi.er(s.$el_text||"",n==null?void 0:n.text,(n==null?void 0:n.text_matching)||"exact"))))return!1;if(n!=null&&n.selector){var r,i=e==null||(r=e.properties)==null?void 0:r.$element_selectors;if(!i||!i.includes(n==null?void 0:n.selector))return!1}return!0}sr(e){return(e==null?void 0:e.properties.$elements)==null?[]:e==null?void 0:e.properties.$elements}}var Ee=Je("[Surveys]"),Qh="seenSurvey_",NT=(t,e)=>{var n="$survey_"+e+"/"+t.id;return t.current_iteration&&t.current_iteration>0&&(n="$survey_"+e+"/"+t.id+"/"+t.current_iteration),n},f1=t=>{var e=""+Qh+t.id;return t.current_iteration&&t.current_iteration>0&&(e=""+Qh+t.id+"_"+t.current_iteration),e},jT=[Kh.Popover,Kh.Widget,Kh.API],zT={ignoreConditions:!1,ignoreDelay:!1,displayType:d1.Popover};class HT{constructor(e){this._instance=e,this.nr=new Map,this.ar=new Map}register(e){var n;D((n=this._instance)==null?void 0:n.Ze)||(this.lr(e),this.ur(e))}ur(e){var n=e.filter(r=>{var i,s;return((i=r.conditions)==null?void 0:i.actions)&&((s=r.conditions)==null||(s=s.actions)==null||(s=s.values)==null?void 0:s.length)>0});n.length!==0&&(this.hr==null&&(this.hr=new Fi(this._instance),this.hr.init(),this.hr.ir(r=>{this.onAction(r)})),n.forEach(r=>{var i,s,o,a,l;r.conditions&&(i=r.conditions)!=null&&i.actions&&(s=r.conditions)!=null&&(s=s.actions)!=null&&s.values&&((o=r.conditions)==null||(o=o.actions)==null||(o=o.values)==null?void 0:o.length)>0&&((a=this.hr)==null||a.register(r.conditions.actions.values),(l=r.conditions)==null||(l=l.actions)==null||(l=l.values)==null||l.forEach(u=>{if(u&&u.name){var c=this.ar.get(u.name);c&&c.push(r.id),this.ar.set(u.name,c||[r.id])}}))}))}lr(e){var n;e.filter(r=>{var i,s;return((i=r.conditions)==null?void 0:i.events)&&((s=r.conditions)==null||(s=s.events)==null||(s=s.values)==null?void 0:s.length)>0}).length!==0&&((n=this._instance)==null||n.Ze((r,i)=>{this.onEvent(r,i)}),e.forEach(r=>{var i;(i=r.conditions)==null||(i=i.events)==null||(i=i.values)==null||i.forEach(s=>{if(s&&s.name){var o=this.nr.get(s.name);o&&o.push(r.id),this.nr.set(s.name,o||[r.id])}})}))}onEvent(e,n){var r,i,s=((r=this._instance)==null||(r=r.persistence)==null?void 0:r.props[hu])||[];if(Nu.SHOWN===e&&n&&s.length>0){var o;Ee.info("survey event matched, removing survey from activated surveys",{event:e,eventPayload:n,existingActivatedSurveys:s});var a=n==null||(o=n.properties)==null?void 0:o.$survey_id;if(a){var l=s.indexOf(a);l>=0&&(s.splice(l,1),this.dr(s))}}else if(this.nr.has(e)){Ee.info("survey event name matched",{event:e,eventPayload:n,surveys:this.nr.get(e)});var u=[];(i=this._instance)==null||i.getSurveys(f=>{u=f.filter(d=>{var h;return(h=this.nr.get(e))==null?void 0:h.includes(d.id)})});var c=u.filter(f=>{var d,h=(d=f.conditions)==null||(d=d.events)==null||(d=d.values)==null?void 0:d.find(p=>p.name===e);return!!h&&(!h.propertyFilters||Object.entries(h.propertyFilters).every(p=>{var v,[w,m]=p,g=n==null||(v=n.properties)==null?void 0:v[w];if(D(g)||dr(g))return!1;var y=[String(g)],b=Ow[m.operator];return b?b(m.values,y):(Ee.warn("Unknown property comparison operator: "+m.operator),!1)}))});this.dr(s.concat(c.map(f=>f.id)||[]))}}onAction(e){var n,r=((n=this._instance)==null||(n=n.persistence)==null?void 0:n.props[hu])||[];this.ar.has(e)&&this.dr(r.concat(this.ar.get(e)||[]))}dr(e){var n;Ee.info("updating activated surveys",{activatedSurveys:e}),(n=this._instance)==null||(n=n.persistence)==null||n.register({[hu]:[...new Set(e)]})}getSurveys(){var e,n=(e=this._instance)==null||(e=e.persistence)==null?void 0:e.props[hu];return n||[]}getEventToSurveys(){return this.nr}vr(){return this.hr}}class UT{constructor(e){this.cr=void 0,this._surveyManager=null,this.pr=!1,this.gr=!1,this._r=[],this._instance=e,this._surveyEventReceiver=null}onRemoteConfig(e){if(!this._instance.config.disable_surveys){var n=e.surveys;if(me(n))return Ee.warn("Flags not loaded yet. Not loading surveys.");var r=Ce(n);this.cr=r?n.length>0:n,Ee.info("flags response received, isSurveysEnabled: "+this.cr),this.loadIfEnabled()}}reset(){localStorage.removeItem("lastSeenSurveyDate");for(var e=[],n=0;n<localStorage.length;n++){var r=localStorage.key(n);(r!=null&&r.startsWith(Qh)||r!=null&&r.startsWith("inProgressSurvey_"))&&e.push(r)}e.forEach(i=>localStorage.removeItem(i))}loadIfEnabled(){if(!this._surveyManager)if(this.gr)Ee.info("Already initializing surveys, skipping...");else if(this._instance.config.disable_surveys)Ee.info("Disabled. Not loading surveys.");else if(this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())Ee.info("Not loading surveys in cookieless mode without consent.");else{var e=Z==null?void 0:Z.__PosthogExtensions__;if(e){if(!D(this.cr)||this._instance.config.advanced_enable_surveys){var n=this.cr||this._instance.config.advanced_enable_surveys;this.gr=!0;try{var r=e.generateSurveys;if(r)return void this.mr(r,n);var i=e.loadExternalDependency;if(!i)return void this.yr("PostHog loadExternalDependency extension not found.");i(this._instance,"surveys",s=>{s||!e.generateSurveys?this.yr("Could not load surveys script",s):this.mr(e.generateSurveys,n)})}catch(s){throw this.yr("Error initializing surveys",s),s}finally{this.gr=!1}}}else Ee.error("PostHog Extensions not found.")}}mr(e,n){this._surveyManager=e(this._instance,n),this._surveyEventReceiver=new HT(this._instance),Ee.info("Surveys loaded successfully"),this.br({isLoaded:!0})}yr(e,n){Ee.error(e,n),this.br({isLoaded:!1,error:e})}onSurveysLoaded(e){return this._r.push(e),this._surveyManager&&this.br({isLoaded:!0}),()=>{this._r=this._r.filter(n=>n!==e)}}getSurveys(e,n){if(n===void 0&&(n=!1),this._instance.config.disable_surveys)return Ee.info("Disabled. Not loading surveys."),e([]);var r=this._instance.get_property(uh);if(r&&!n)return e(r,{isLoaded:!0});if(this.pr)return e([],{isLoaded:!1,error:"Surveys are already being loaded"});try{this.pr=!0,this._instance.Oe({url:this._instance.requestRouter.endpointFor("api","/api/surveys/?token="+this._instance.config.token),method:"GET",timeout:this._instance.config.surveys_request_timeout_ms,callback:i=>{var s;this.pr=!1;var o=i.statusCode;if(o!==200||!i.json){var a="Surveys API could not be loaded, status: "+o;return Ee.error(a),e([],{isLoaded:!1,error:a})}var l,u=i.json.surveys||[],c=u.filter(f=>function(d){return!(!d.start_date||d.end_date)}(f)&&(function(d){var h;return!((h=d.conditions)==null||(h=h.events)==null||(h=h.values)==null||!h.length)}(f)||function(d){var h;return!((h=d.conditions)==null||(h=h.actions)==null||(h=h.values)==null||!h.length)}(f)));return c.length>0&&((l=this._surveyEventReceiver)==null||l.register(c)),(s=this._instance.persistence)==null||s.register({[uh]:u}),e(u,{isLoaded:!0})}})}catch(i){throw this.pr=!1,i}}br(e){for(var n of this._r)try{if(!e.isLoaded)return n([],e);this.getSurveys(n)}catch(r){Ee.error("Error in survey callback",r)}}getActiveMatchingSurveys(e,n){if(n===void 0&&(n=!1),!me(this._surveyManager))return this._surveyManager.getActiveMatchingSurveys(e,n);Ee.warn("init was not called")}wr(e){var n=null;return this.getSurveys(r=>{var i;n=(i=r.find(s=>s.id===e))!==null&&i!==void 0?i:null}),n}Sr(e){if(me(this._surveyManager))return{eligible:!1,reason:"SDK is not enabled or survey functionality is not yet loaded"};var n=typeof e=="string"?this.wr(e):e;return n?this._surveyManager.checkSurveyEligibility(n):{eligible:!1,reason:"Survey not found"}}canRenderSurvey(e){if(me(this._surveyManager))return Ee.warn("init was not called"),{visible:!1,disabledReason:"SDK is not enabled or survey functionality is not yet loaded"};var n=this.Sr(e);return{visible:n.eligible,disabledReason:n.reason}}canRenderSurveyAsync(e,n){return me(this._surveyManager)?(Ee.warn("init was not called"),Promise.resolve({visible:!1,disabledReason:"SDK is not enabled or survey functionality is not yet loaded"})):new Promise(r=>{this.getSurveys(i=>{var s,o=(s=i.find(l=>l.id===e))!==null&&s!==void 0?s:null;if(o){var a=this.Sr(o);r({visible:a.eligible,disabledReason:a.reason})}else r({visible:!1,disabledReason:"Survey not found"})},n)})}renderSurvey(e,n){var r;if(me(this._surveyManager))Ee.warn("init was not called");else{var i=typeof e=="string"?this.wr(e):e;if(i!=null&&i.id)if(jT.includes(i.type)){var s=B==null?void 0:B.querySelector(n);if(s)return(r=i.appearance)!=null&&r.surveyPopupDelaySeconds?(Ee.info("Rendering survey "+i.id+" with delay of "+i.appearance.surveyPopupDelaySeconds+" seconds"),void setTimeout(()=>{var o,a;Ee.info("Rendering survey "+i.id+" with delay of "+((o=i.appearance)==null?void 0:o.surveyPopupDelaySeconds)+" seconds"),(a=this._surveyManager)==null||a.renderSurvey(i,s),Ee.info("Survey "+i.id+" rendered")},1e3*i.appearance.surveyPopupDelaySeconds)):void this._surveyManager.renderSurvey(i,s);Ee.warn("Survey element not found")}else Ee.warn("Surveys of type "+i.type+" cannot be rendered in the app");else Ee.warn("Survey not found")}}displaySurvey(e,n){var r;if(me(this._surveyManager))Ee.warn("init was not called");else{var i=this.wr(e);if(i){var s=i;if((r=i.appearance)!=null&&r.surveyPopupDelaySeconds&&n.ignoreDelay&&(s=j({},i,{appearance:j({},i.appearance,{surveyPopupDelaySeconds:0})})),n.ignoreConditions===!1){var o=this.canRenderSurvey(i);if(!o.visible)return void Ee.warn("Survey is not eligible to be displayed: ",o.disabledReason)}n.displayType!==d1.Inline?this._surveyManager.handlePopoverSurvey(s):this.renderSurvey(s,n.selector)}else Ee.warn("Survey not found")}}}var h1=Je("[RateLimiter]");class BT{constructor(e){var n,r;this.serverLimits={},this.lastEventRateLimited=!1,this.checkForLimiting=i=>{var s=i.text;if(s&&s.length)try{(JSON.parse(s).quota_limited||[]).forEach(o=>{h1.info((o||"events")+" is quota limited."),this.serverLimits[o]=new Date().getTime()+6e4})}catch(o){return void h1.warn('could not rate limit - continuing. Error: "'+(o==null?void 0:o.message)+'"',{text:s})}},this.instance=e,this.captureEventsPerSecond=((n=e.config.rate_limiting)==null?void 0:n.events_per_second)||10,this.captureEventsBurstLimit=Math.max(((r=e.config.rate_limiting)==null?void 0:r.events_burst_limit)||10*this.captureEventsPerSecond,this.captureEventsPerSecond),this.lastEventRateLimited=this.clientRateLimitContext(!0).isRateLimited}clientRateLimitContext(e){var n,r,i;e===void 0&&(e=!1);var s=new Date().getTime(),o=(n=(r=this.instance.persistence)==null?void 0:r.get_property(dh))!==null&&n!==void 0?n:{tokens:this.captureEventsBurstLimit,last:s};o.tokens+=(s-o.last)/1e3*this.captureEventsPerSecond,o.last=s,o.tokens>this.captureEventsBurstLimit&&(o.tokens=this.captureEventsBurstLimit);var a=o.tokens<1;return a||e||(o.tokens=Math.max(0,o.tokens-1)),!a||this.lastEventRateLimited||e||this.instance.capture("$$client_ingestion_warning",{$$client_ingestion_warning_message:"posthog-js client rate limited. Config is set to "+this.captureEventsPerSecond+" events per second and "+this.captureEventsBurstLimit+" events burst limit."},{skip_client_rate_limiting:!0}),this.lastEventRateLimited=a,(i=this.instance.persistence)==null||i.set_property(dh,o),{isRateLimited:a,remainingTokens:o.tokens}}isServerRateLimited(e){var n=this.serverLimits[e||"events"]||!1;return n!==!1&&new Date().getTime()<n}}var Li=Je("[RemoteConfig]");class qT{constructor(e){this._instance=e}get remoteConfig(){var e;return(e=Z._POSTHOG_REMOTE_CONFIG)==null||(e=e[this._instance.config.token])==null?void 0:e.config}kr(e){var n,r;(n=Z.__PosthogExtensions__)!=null&&n.loadExternalDependency?(r=Z.__PosthogExtensions__)==null||r.loadExternalDependency==null||r.loadExternalDependency(this._instance,"remote-config",()=>e(this.remoteConfig)):(Li.error("PostHog Extensions not found. Cannot load remote config."),e())}$r(e){this._instance.Oe({method:"GET",url:this._instance.requestRouter.endpointFor("assets","/array/"+this._instance.config.token+"/config"),callback:n=>{e(n.json)}})}load(){try{if(this.remoteConfig)return Li.info("Using preloaded remote config",this.remoteConfig),void this.Fe(this.remoteConfig);if(this._instance.L())return void Li.warn("Remote config is disabled. Falling back to local config.");this.kr(e=>{if(!e)return Li.info("No config found after loading remote JS config. Falling back to JSON."),void this.$r(n=>{this.Fe(n)});this.Fe(e)})}catch(e){Li.error("Error loading remote config",e)}}Fe(e){e?this._instance.config.__preview_remote_config?(this._instance.Fe(e),e.hasFeatureFlags!==!1&&this._instance.featureFlags.ensureFlagsLoaded()):Li.info("__preview_remote_config is disabled. Logging config instead",e):Li.error("Failed to fetch remote config from PostHog.")}}var Xh=3e3;class VT{constructor(e,n){this.Er=!0,this.Rr=[],this.Ir=Zt((n==null?void 0:n.flush_interval_ms)||Xh,250,5e3,U.createLogger("flush interval"),Xh),this.Pr=e}enqueue(e){this.Rr.push(e),this.Tr||this.Cr()}unload(){this.Mr();var e=this.Rr.length>0?this.Or():{},n=Object.values(e);[...n.filter(r=>r.url.indexOf("/e")===0),...n.filter(r=>r.url.indexOf("/e")!==0)].map(r=>{this.Pr(j({},r,{transport:"sendBeacon"}))})}enable(){this.Er=!1,this.Cr()}Cr(){var e=this;this.Er||(this.Tr=setTimeout(()=>{if(this.Mr(),this.Rr.length>0){var n=this.Or(),r=function(){var s=n[i],o=new Date().getTime();s.data&&Ce(s.data)&&Se(s.data,a=>{a.offset=Math.abs(a.timestamp-o),delete a.timestamp}),e.Pr(s)};for(var i in n)r()}},this.Ir))}Mr(){clearTimeout(this.Tr),this.Tr=void 0}Or(){var e={};return Se(this.Rr,n=>{var r,i=n,s=(i?i.batchKey:null)||i.url;D(e[s])&&(e[s]=j({},i,{data:[]})),(r=e[s].data)==null||r.push(i.data)}),this.Rr=[],e}}var WT=["retriesPerformedSoFar"];class GT{constructor(e){this.Fr=!1,this.Ar=3e3,this.Rr=[],this._instance=e,this.Rr=[],this.Dr=!0,!D(E)&&"onLine"in E.navigator&&(this.Dr=E.navigator.onLine,Ne(E,"online",()=>{this.Dr=!0,this.oe()}),Ne(E,"offline",()=>{this.Dr=!1}))}get length(){return this.Rr.length}retriableRequest(e){var{retriesPerformedSoFar:n}=e,r=a_(e,WT);mt(n)&&n>0&&(r.url=Ou(r.url,{retry_count:n})),this._instance.Oe(j({},r,{callback:i=>{i.statusCode!==200&&(i.statusCode<400||i.statusCode>=500)&&(n??0)<10?this.jr(j({retriesPerformedSoFar:n},r)):r.callback==null||r.callback(i)}}))}jr(e){var n=e.retriesPerformedSoFar||0;e.retriesPerformedSoFar=n+1;var r=function(o){var a=3e3*Math.pow(2,o),l=a/2,u=Math.min(18e5,a),c=(Math.random()-.5)*(u-l);return Math.ceil(u+c)}(n),i=Date.now()+r;this.Rr.push({retryAt:i,requestOptions:e});var s="Enqueued failed request for retry in "+r;navigator.onLine||(s+=" (Browser is offline)"),U.warn(s),this.Fr||(this.Fr=!0,this.Lr())}Lr(){this.Nr&&clearTimeout(this.Nr),this.Nr=setTimeout(()=>{this.Dr&&this.Rr.length>0&&this.oe(),this.Lr()},this.Ar)}oe(){var e=Date.now(),n=[],r=this.Rr.filter(s=>s.retryAt<e||(n.push(s),!1));if(this.Rr=n,r.length>0)for(var{requestOptions:i}of r)this.retriableRequest(i)}unload(){for(var{requestOptions:e}of(this.Nr&&(clearTimeout(this.Nr),this.Nr=void 0),this.Rr))try{this._instance.Oe(j({},e,{transport:"sendBeacon"}))}catch(n){U.error(n)}this.Rr=[]}}class KT{constructor(e){this.Ur=()=>{var n,r,i,s;this.zr||(this.zr={});var o=this.scrollElement(),a=this.scrollY(),l=o?Math.max(0,o.scrollHeight-o.clientHeight):0,u=a+((o==null?void 0:o.clientHeight)||0),c=(o==null?void 0:o.scrollHeight)||0;this.zr.lastScrollY=Math.ceil(a),this.zr.maxScrollY=Math.max(a,(n=this.zr.maxScrollY)!==null&&n!==void 0?n:0),this.zr.maxScrollHeight=Math.max(l,(r=this.zr.maxScrollHeight)!==null&&r!==void 0?r:0),this.zr.lastContentY=u,this.zr.maxContentY=Math.max(u,(i=this.zr.maxContentY)!==null&&i!==void 0?i:0),this.zr.maxContentHeight=Math.max(c,(s=this.zr.maxContentHeight)!==null&&s!==void 0?s:0)},this._instance=e}getContext(){return this.zr}resetContext(){var e=this.zr;return setTimeout(this.Ur,0),e}startMeasuringScrollPosition(){Ne(E,"scroll",this.Ur,{capture:!0}),Ne(E,"scrollend",this.Ur,{capture:!0}),Ne(E,"resize",this.Ur)}scrollElement(){if(!this._instance.config.scroll_root_selector)return E==null?void 0:E.document.documentElement;var e=Ce(this._instance.config.scroll_root_selector)?this._instance.config.scroll_root_selector:[this._instance.config.scroll_root_selector];for(var n of e){var r=E==null?void 0:E.document.querySelector(n);if(r)return r}}scrollY(){if(this._instance.config.scroll_root_selector){var e=this.scrollElement();return e&&e.scrollTop||0}return E&&(E.scrollY||E.pageYOffset||E.document.documentElement.scrollTop)||0}scrollX(){if(this._instance.config.scroll_root_selector){var e=this.scrollElement();return e&&e.scrollLeft||0}return E&&(E.scrollX||E.pageXOffset||E.document.documentElement.scrollLeft)||0}}var YT=t=>i1(t==null?void 0:t.config.mask_personal_data_properties,t==null?void 0:t.config.custom_personal_data_properties);class p1{constructor(e,n,r,i){this.Br=s=>{var o=this.qr();if(!o||o.sessionId!==s){var a={sessionId:s,props:this.Hr(this._instance)};this.Wr.register({[ch]:a})}},this._instance=e,this.Gr=n,this.Wr=r,this.Hr=i||YT,this.Gr.onSessionId(this.Br)}qr(){return this.Wr.props[ch]}getSetOnceProps(){var e,n=(e=this.qr())==null?void 0:e.props;return n?"r"in n?s1(n):{$referring_domain:n.referringDomain,$pathname:n.initialPathName,utm_source:n.utm_source,utm_campaign:n.utm_campaign,utm_medium:n.utm_medium,utm_content:n.utm_content,utm_term:n.utm_term}:{}}getSessionProps(){var e={};return Se(th(this.getSetOnceProps()),(n,r)=>{r==="$current_url"&&(r="url"),e["$session_entry_"+Yf(r)]=n}),e}}var Zh=Je("[SessionId]");class v1{on(e,n){return this.Vr.on(e,n)}constructor(e,n,r){var i;if(this.Jr=[],this.Vr=new Yh,this.Kr=(c,f)=>Math.abs(c-f)>this.sessionTimeoutMs,!e.persistence)throw new Error("SessionIdManager requires a PostHogPersistence instance");if(e.config.cookieless_mode==="always")throw new Error('SessionIdManager cannot be used with cookieless_mode="always"');this.A=e.config,this.Wr=e.persistence,this.pi=void 0,this.Ft=void 0,this._sessionStartTimestamp=null,this._sessionActivityTimestamp=null,this.Yr=n||Gr,this.Xr=r||Gr;var s=this.A.persistence_name||this.A.token,o=this.A.session_idle_timeout_seconds||1800;if(this._sessionTimeoutMs=1e3*Zt(o,60,36e3,Zh.createLogger("session_idle_timeout_seconds"),1800),e.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this.Qr(),this.Zr="ph_"+s+"_window_id",this.ts="ph_"+s+"_primary_window_exists",this.es()){var a=ut.K(this.Zr),l=ut.K(this.ts);a&&!l?this.pi=a:ut.X(this.Zr),ut.Y(this.ts,!0)}if((i=this.A.bootstrap)!=null&&i.sessionID)try{var u=(c=>{var f=c.replace(/-/g,"");if(f.length!==32)throw new Error("Not a valid UUID");if(f[12]!=="7")throw new Error("Not a UUIDv7");return parseInt(f.substring(0,12),16)})(this.A.bootstrap.sessionID);this.rs(this.A.bootstrap.sessionID,new Date().getTime(),u)}catch(c){Zh.error("Invalid sessionID in bootstrap",c)}this.ss()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(e){return D(this.Jr)&&(this.Jr=[]),this.Jr.push(e),this.Ft&&e(this.Ft,this.pi),()=>{this.Jr=this.Jr.filter(n=>n!==e)}}es(){return this.A.persistence!=="memory"&&!this.Wr.Ue&&ut.G()}ns(e){e!==this.pi&&(this.pi=e,this.es()&&ut.Y(this.Zr,e))}os(){return this.pi?this.pi:this.es()?ut.K(this.Zr):null}rs(e,n,r){e===this.Ft&&n===this._sessionActivityTimestamp&&r===this._sessionStartTimestamp||(this._sessionStartTimestamp=r,this._sessionActivityTimestamp=n,this.Ft=e,this.Wr.register({[fu]:[n,e,r]}))}ls(){if(this.Ft&&this._sessionActivityTimestamp&&this._sessionStartTimestamp)return[this._sessionActivityTimestamp,this.Ft,this._sessionStartTimestamp];var e=this.Wr.props[fu];return Ce(e)&&e.length===2&&e.push(e[0]),e||[0,null,0]}resetSessionId(){this.rs(null,null,null)}ss(){Ne(E,"beforeunload",()=>{this.es()&&ut.X(this.ts)},{capture:!1})}checkAndGetSessionAndWindowId(e,n){if(e===void 0&&(e=!1),n===void 0&&(n=null),this.A.cookieless_mode==="always")throw new Error('checkAndGetSessionAndWindowId should not be called with cookieless_mode="always"');var r=n||new Date().getTime(),[i,s,o]=this.ls(),a=this.os(),l=mt(o)&&o>0&&Math.abs(r-o)>864e5,u=!1,c=!s,f=!e&&this.Kr(r,i);c||f||l?(s=this.Yr(),a=this.Xr(),Zh.info("new session ID generated",{sessionId:s,windowId:a,changeReason:{noSessionId:c,activityTimeout:f,sessionPastMaximumLength:l}}),o=r,u=!0):a||(a=this.Xr(),u=!0);var d=i===0||!e||l?r:i,h=o===0?new Date().getTime():o;return this.ns(a),this.rs(s,d,h),e||this.Qr(),u&&this.Jr.forEach(p=>p(s,a,u?{noSessionId:c,activityTimeout:f,sessionPastMaximumLength:l}:void 0)),{sessionId:s,windowId:a,sessionStartTimestamp:h,changeReason:u?{noSessionId:c,activityTimeout:f,sessionPastMaximumLength:l}:void 0,lastActivityTimestamp:i}}Qr(){clearTimeout(this.us),this.us=setTimeout(()=>{var[e]=this.ls();if(this.Kr(new Date().getTime(),e)){var n=this.Ft;this.resetSessionId(),this.Vr.emit("forcedIdleReset",{idleSessionId:n})}},1.1*this.sessionTimeoutMs)}}var QT=["$set_once","$set"],Xr=Je("[SiteApps]");class XT{constructor(e){this._instance=e,this.hs=[],this.apps={}}get isEnabled(){return!!this._instance.config.opt_in_site_apps}ds(e,n){if(n){var r=this.globalsForEvent(n);this.hs.push(r),this.hs.length>1e3&&(this.hs=this.hs.slice(10))}}get siteAppLoaders(){var e;return(e=Z._POSTHOG_REMOTE_CONFIG)==null||(e=e[this._instance.config.token])==null?void 0:e.siteApps}init(){if(this.isEnabled){var e=this._instance.Ze(this.ds.bind(this));this.vs=()=>{e(),this.hs=[],this.vs=void 0}}}globalsForEvent(e){var n,r,i,s,o,a,l;if(!e)throw new Error("Event payload is required");var u={},c=this._instance.get_property("$groups")||[],f=this._instance.get_property("$stored_group_properties")||{};for(var[d,h]of Object.entries(f))u[d]={id:c[d],type:d,properties:h};var{$set_once:p,$set:v}=e;return{event:j({},a_(e,QT),{properties:j({},e.properties,v?{$set:j({},(n=(r=e.properties)==null?void 0:r.$set)!==null&&n!==void 0?n:{},v)}:{},p?{$set_once:j({},(i=(s=e.properties)==null?void 0:s.$set_once)!==null&&i!==void 0?i:{},p)}:{}),elements_chain:(o=(a=e.properties)==null?void 0:a.$elements_chain)!==null&&o!==void 0?o:"",distinct_id:(l=e.properties)==null?void 0:l.distinct_id}),person:{properties:this._instance.get_property("$stored_person_properties")},groups:u}}setupSiteApp(e){var n=this.apps[e.id],r=()=>{var a;!n.errored&&this.hs.length&&(Xr.info("Processing "+this.hs.length+" events for site app with id "+e.id),this.hs.forEach(l=>n.processEvent==null?void 0:n.processEvent(l)),n.processedBuffer=!0),Object.values(this.apps).every(l=>l.processedBuffer||l.errored)&&((a=this.vs)==null||a.call(this))},i=!1,s=a=>{n.errored=!a,n.loaded=!0,Xr.info("Site app with id "+e.id+" "+(a?"loaded":"errored")),i&&r()};try{var{processEvent:o}=e.init({posthog:this._instance,callback:a=>{s(a)}});o&&(n.processEvent=o),i=!0}catch(a){Xr.error("Error while initializing PostHog app with config id "+e.id,a),s(!1)}if(i&&n.loaded)try{r()}catch(a){Xr.error("Error while processing buffered events PostHog app with config id "+e.id,a),n.errored=!0}}cs(){var e=this.siteAppLoaders||[];for(var n of e)this.apps[n.id]={id:n.id,loaded:!1,errored:!1,processedBuffer:!1};for(var r of e)this.setupSiteApp(r)}fs(e){if(Object.keys(this.apps).length!==0){var n=this.globalsForEvent(e);for(var r of Object.values(this.apps))try{r.processEvent==null||r.processEvent(n)}catch(i){Xr.error("Error while processing event "+e.event+" for site app "+r.id,i)}}}onRemoteConfig(e){var n,r,i,s=this;if((n=this.siteAppLoaders)!=null&&n.length)return this.isEnabled?(this.cs(),void this._instance.on("eventCaptured",u=>this.fs(u))):void Xr.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.');if((r=this.vs)==null||r.call(this),(i=e.siteApps)!=null&&i.length)if(this.isEnabled){var o=function(u){var c;Z["__$$ph_site_app_"+u]=s._instance,(c=Z.__PosthogExtensions__)==null||c.loadSiteApp==null||c.loadSiteApp(s._instance,l,f=>{if(f)return Xr.error("Error while initializing PostHog app with config id "+u,f)})};for(var{id:a,url:l}of e.siteApps)o(a)}else Xr.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}}var ZT=["amazonbot","amazonproductbot","app.hypefactors.com","applebot","archive.org_bot","awariobot","backlinksextendedbot","baiduspider","bingbot","bingpreview","chrome-lighthouse","dataforseobot","deepscan","duckduckbot","facebookexternal","facebookcatalog","http://yandex.com/bots","hubspot","ia_archiver","leikibot","linkedinbot","meta-externalagent","mj12bot","msnbot","nessus","petalbot","pinterest","prerender","rogerbot","screaming frog","sebot-wa","sitebulb","slackbot","slurp","trendictionbot","turnitin","twitterbot","vercel-screenshot","vercelbot","yahoo! slurp","yandexbot","zoombot","bot.htm","bot.php","(bot;","bot/","crawler","ahrefsbot","ahrefssiteaudit","semrushbot","siteauditbot","splitsignalbot","gptbot","oai-searchbot","chatgpt-user","perplexitybot","better uptime bot","sentryuptimebot","uptimerobot","headlesschrome","cypress","google-hoteladsverifier","adsbot-google","apis-google","duplexweb-google","feedfetcher-google","google favicon","google web preview","google-read-aloud","googlebot","googleother","google-cloudvertexbot","googleweblight","mediapartners-google","storebot-google","google-inspectiontool","bytespider"],g1=function(t,e){if(!t)return!1;var n=t.toLowerCase();return ZT.concat(e||[]).some(r=>{var i=r.toLowerCase();return n.indexOf(i)!==-1})},m1=function(t,e){if(!t)return!1;var n=t.userAgent;if(n&&g1(n,e))return!0;try{var r=t==null?void 0:t.userAgentData;if(r!=null&&r.brands&&r.brands.some(i=>g1(i==null?void 0:i.brand,e)))return!0}catch{}return!!t.webdriver},pa=function(t){return t.US="us",t.EU="eu",t.CUSTOM="custom",t}({}),y1="i.posthog.com";class JT{constructor(e){this.ps={},this.instance=e}get apiHost(){var e=this.instance.config.api_host.trim().replace(/\/$/,"");return e==="https://app.posthog.com"?"https://us.i.posthog.com":e}get uiHost(){var e,n=(e=this.instance.config.ui_host)==null?void 0:e.replace(/\/$/,"");return n||(n=this.apiHost.replace("."+y1,".posthog.com")),n==="https://app.posthog.com"?"https://us.posthog.com":n}get region(){return this.ps[this.apiHost]||(/https:\/\/(app|us|us-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?this.ps[this.apiHost]=pa.US:/https:\/\/(eu|eu-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?this.ps[this.apiHost]=pa.EU:this.ps[this.apiHost]=pa.CUSTOM),this.ps[this.apiHost]}endpointFor(e,n){if(n===void 0&&(n=""),n&&(n=n[0]==="/"?n:"/"+n),e==="ui")return this.uiHost+n;if(this.region===pa.CUSTOM)return this.apiHost+n;var r=y1+n;switch(e){case"assets":return"https://"+this.region+"-assets."+r;case"api":return"https://"+this.region+"."+r}}}var eP={icontains:(t,e)=>!!E&&e.href.toLowerCase().indexOf(t.toLowerCase())>-1,not_icontains:(t,e)=>!!E&&e.href.toLowerCase().indexOf(t.toLowerCase())===-1,regex:(t,e)=>!!E&&Ms(e.href,t),not_regex:(t,e)=>!!E&&!Ms(e.href,t),exact:(t,e)=>e.href===t,is_not:(t,e)=>e.href!==t};class _t{constructor(e){var n=this;this.getWebExperimentsAndEvaluateDisplayLogic=function(r){r===void 0&&(r=!1),n.getWebExperiments(i=>{_t.gs("retrieved web experiments from the server"),n._s=new Map,i.forEach(s=>{if(s.feature_flag_key){var o;n._s&&(_t.gs("setting flag key ",s.feature_flag_key," to web experiment ",s),(o=n._s)==null||o.set(s.feature_flag_key,s));var a=n._instance.getFeatureFlag(s.feature_flag_key);Ue(a)&&s.variants[a]&&n.ys(s.name,a,s.variants[a].transforms)}else if(s.variants)for(var l in s.variants){var u=s.variants[l];_t.bs(u)&&n.ys(s.name,l,u.transforms)}})},r)},this._instance=e,this._instance.onFeatureFlags(r=>{this.onFeatureFlags(r)})}onFeatureFlags(e){if(this._is_bot())_t.gs("Refusing to render web experiment since the viewer is a likely bot");else if(!this._instance.config.disable_web_experiments){if(me(this._s))return this._s=new Map,this.loadIfEnabled(),void this.previewWebExperiment();_t.gs("applying feature flags",e),e.forEach(n=>{var r;if(this._s&&(r=this._s)!=null&&r.has(n)){var i,s=this._instance.getFeatureFlag(n),o=(i=this._s)==null?void 0:i.get(n);s&&o!=null&&o.variants[s]&&this.ys(o.name,s,o.variants[s].transforms)}})}}previewWebExperiment(){var e=_t.getWindowLocation();if(e!=null&&e.search){var n=wu(e==null?void 0:e.search,"__experiment_id"),r=wu(e==null?void 0:e.search,"__experiment_variant");n&&r&&(_t.gs("previewing web experiments "+n+" && "+r),this.getWebExperiments(i=>{this.ws(parseInt(n),r,i)},!1,!0))}}loadIfEnabled(){this._instance.config.disable_web_experiments||this.getWebExperimentsAndEvaluateDisplayLogic()}getWebExperiments(e,n,r){if(this._instance.config.disable_web_experiments&&!r)return e([]);var i=this._instance.get_property("$web_experiments");if(i&&!n)return e(i);this._instance.Oe({url:this._instance.requestRouter.endpointFor("api","/api/web_experiments/?token="+this._instance.config.token),method:"GET",callback:s=>{if(s.statusCode!==200||!s.json)return e([]);var o=s.json.experiments||[];return e(o)}})}ws(e,n,r){var i=r.filter(s=>s.id===e);i&&i.length>0&&(_t.gs("Previewing web experiment ["+i[0].name+"] with variant ["+n+"]"),this.ys(i[0].name,n,i[0].variants[n].transforms))}static bs(e){return!me(e.conditions)&&_t.Ss(e)&&_t.ks(e)}static Ss(e){var n;if(me(e.conditions)||me((n=e.conditions)==null?void 0:n.url))return!0;var r,i,s,o=_t.getWindowLocation();return!!o&&((r=e.conditions)==null||!r.url||eP[(i=(s=e.conditions)==null?void 0:s.urlMatchType)!==null&&i!==void 0?i:"icontains"](e.conditions.url,o))}static getWindowLocation(){return E==null?void 0:E.location}static ks(e){var n;if(me(e.conditions)||me((n=e.conditions)==null?void 0:n.utm))return!0;var r=Jw();if(r.utm_source){var i,s,o,a,l,u,c,f,d=(i=e.conditions)==null||(i=i.utm)==null||!i.utm_campaign||((s=e.conditions)==null||(s=s.utm)==null?void 0:s.utm_campaign)==r.utm_campaign,h=(o=e.conditions)==null||(o=o.utm)==null||!o.utm_source||((a=e.conditions)==null||(a=a.utm)==null?void 0:a.utm_source)==r.utm_source,p=(l=e.conditions)==null||(l=l.utm)==null||!l.utm_medium||((u=e.conditions)==null||(u=u.utm)==null?void 0:u.utm_medium)==r.utm_medium,v=(c=e.conditions)==null||(c=c.utm)==null||!c.utm_term||((f=e.conditions)==null||(f=f.utm)==null?void 0:f.utm_term)==r.utm_term;return d&&p&&v&&h}return!1}static gs(e){for(var n=arguments.length,r=new Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];U.info("[WebExperiments] "+e,r)}ys(e,n,r){this._is_bot()?_t.gs("Refusing to render web experiment since the viewer is a likely bot"):n!=="control"?r.forEach(i=>{if(i.selector){var s;_t.gs("applying transform of variant "+n+" for experiment "+e+" ",i);var o=(s=document)==null?void 0:s.querySelectorAll(i.selector);o==null||o.forEach(a=>{var l=a;i.html&&(l.innerHTML=i.html),i.css&&l.setAttribute("style",i.css)})}}):_t.gs("Control variants leave the page unmodified.")}_is_bot(){return Xt&&this._instance?m1(Xt,this._instance.config.custom_blocked_useragents):void 0}}var tP=Je("[PostHog ExternalIntegrations]"),nP={intercom:"intercom-integration",crispChat:"crisp-chat-integration"};class rP{constructor(e){this._instance=e}nt(e,n){var r;(r=Z.__PosthogExtensions__)==null||r.loadExternalDependency==null||r.loadExternalDependency(this._instance,e,i=>{if(i)return tP.error("failed to load script",i);n()})}startIfEnabledOrStop(){var e=this,n=function(o){var a,l,u;!i||(a=Z.__PosthogExtensions__)!=null&&(a=a.integrations)!=null&&a[o]||e.nt(nP[o],()=>{var c;(c=Z.__PosthogExtensions__)==null||(c=c.integrations)==null||(c=c[o])==null||c.start(e._instance)}),!i&&(l=Z.__PosthogExtensions__)!=null&&(l=l.integrations)!=null&&l[o]&&((u=Z.__PosthogExtensions__)==null||(u=u.integrations)==null||(u=u[o])==null||u.stop())};for(var[r,i]of Object.entries((s=this._instance.config.integrations)!==null&&s!==void 0?s:{})){var s;n(r)}}}var Jh="[SessionRecording]",va=Je(Jh);class iP{get started(){var e;return!((e=this.$s)==null||!e.isStarted)}get status(){var e;return((e=this.$s)==null?void 0:e.status)||"lazy_loading"}constructor(e){if(this._forceAllowLocalhostNetworkCapture=!1,this.ni=void 0,this._instance=e,!this._instance.sessionManager)throw va.error("started without valid sessionManager"),new Error(Jh+" started without valid sessionManager. This is a bug.");if(this._instance.config.cookieless_mode==="always")throw new Error(Jh+' cannot be used with cookieless_mode="always"')}get Bt(){var e,n=!((e=this._instance.get_property(ih))==null||!e.enabled),r=!this._instance.config.disable_session_recording,i=this._instance.config.disable_session_recording||this._instance.consent.isOptedOut();return E&&n&&r&&!i}startIfEnabledOrStop(e){var n;if(!this.Bt||(n=this.$s)==null||!n.isStarted){var r=!D(Object.assign)&&!D(Array.from);this.Bt&&r?(this.xs(e),va.info("starting")):this.stopRecording()}}xs(e){var n,r,i;this.Bt&&(Z!=null&&(n=Z.__PosthogExtensions__)!=null&&(n=n.rrweb)!=null&&n.record&&(r=Z.__PosthogExtensions__)!=null&&r.initSessionRecording?this.Ri(e):(i=Z.__PosthogExtensions__)==null||i.loadExternalDependency==null||i.loadExternalDependency(this._instance,this.Ii,s=>{if(s)return va.error("could not load recorder",s);this.Ri(e)}))}stopRecording(){var e;(e=this.$s)==null||e.stop()}ki(){var e;(e=this._instance.persistence)==null||e.unregister($s)}Ei(e){if(this._instance.persistence){var n,r,i=this._instance.persistence,s=()=>{var o=e.sessionRecording,a=o==null?void 0:o.sampleRate,l=me(a)?null:parseFloat(a);me(l)&&this.ki();var u=o==null?void 0:o.minimumDurationMilliseconds;i.register({[ih]:j({enabled:!!o},o,{networkPayloadCapture:j({capturePerformance:e.capturePerformance},o==null?void 0:o.networkPayloadCapture),canvasRecording:{enabled:o==null?void 0:o.recordCanvas,fps:o==null?void 0:o.canvasFps,quality:o==null?void 0:o.canvasQuality},sampleRate:l,minimumDurationMilliseconds:D(u)?null:u,endpoint:o==null?void 0:o.endpoint,triggerMatchType:o==null?void 0:o.triggerMatchType,masking:o==null?void 0:o.masking,urlTriggers:o==null?void 0:o.urlTriggers})})};s(),(n=this.ni)==null||n.call(this),this.ni=(r=this._instance.sessionManager)==null?void 0:r.onSessionId(s)}}onRemoteConfig(e){"sessionRecording"in e?(this.Ei(e),this.startIfEnabledOrStop()):va.info("skipping remote config with no sessionRecording",e)}log(e,n){var r;n===void 0&&(n="log"),(r=this.$s)!=null&&r.log?this.$s.log(e,n):va.warn("log called before recorder was ready")}get Ii(){var e,n,r=(e=this._instance)==null||(e=e.persistence)==null?void 0:e.get_property(ih);return(r==null||(n=r.scriptConfig)==null?void 0:n.script)||"lazy-recorder"}Ri(e){var n,r;if((n=Z.__PosthogExtensions__)==null||!n.initSessionRecording)throw Error("Called on script loaded before session recording is available");this.$s||(this.$s=(r=Z.__PosthogExtensions__)==null?void 0:r.initSessionRecording(this._instance),this.$s._forceAllowLocalhostNetworkCapture=this._forceAllowLocalhostNetworkCapture),this.$s.start(e)}onRRwebEmit(e){var n;(n=this.$s)==null||n.onRRwebEmit==null||n.onRRwebEmit(e)}overrideLinkedFlag(){var e;(e=this.$s)==null||e.overrideLinkedFlag()}overrideSampling(){var e;(e=this.$s)==null||e.overrideSampling()}overrideTrigger(e){var n;(n=this.$s)==null||n.overrideTrigger(e)}get sdkDebugProperties(){var e;return((e=this.$s)==null?void 0:e.sdkDebugProperties)||{$recording_status:this.status}}tryAddCustomEvent(e,n){var r;return!((r=this.$s)==null||!r.tryAddCustomEvent(e,n))}}var ga={},ep=()=>{},Ls="posthog",_1=!yT&&(Nt==null?void 0:Nt.indexOf("MSIE"))===-1&&(Nt==null?void 0:Nt.indexOf("Mozilla"))===-1,w1=t=>{var e;return{api_host:"https://us.i.posthog.com",ui_host:null,token:"",autocapture:!0,rageclick:!0,cross_subdomain_cookie:cR(B==null?void 0:B.location),persistence:"localStorage+cookie",persistence_name:"",loaded:ep,save_campaign_params:!0,custom_campaign_params:[],custom_blocked_useragents:[],save_referrer:!0,capture_pageview:t!=="2025-05-24"||"history_change",capture_pageleave:"if_capture_pageview",defaults:t??"unset",debug:Dt&&Ue(Dt==null?void 0:Dt.search)&&Dt.search.indexOf("__posthog_debug=true")!==-1||!1,cookie_expiration:365,upgrade:!1,disable_session_recording:!1,disable_persistence:!1,disable_web_experiments:!0,disable_surveys:!1,disable_surveys_automatic_display:!1,disable_external_dependency_loading:!1,enable_recording_console_log:void 0,secure_cookie:(E==null||(e=E.location)==null?void 0:e.protocol)==="https:",ip:!1,opt_out_capturing_by_default:!1,opt_out_persistence_by_default:!1,opt_out_useragent_filter:!1,opt_out_capturing_persistence_type:"localStorage",consent_persistence_name:null,opt_out_capturing_cookie_prefix:null,opt_in_site_apps:!1,property_denylist:[],respect_dnt:!1,sanitize_properties:null,request_headers:{},request_batching:!0,properties_string_max_length:65535,session_recording:{},mask_all_element_attributes:!1,mask_all_text:!1,mask_personal_data_properties:!1,custom_personal_data_properties:[],advanced_disable_flags:!1,advanced_disable_decide:!1,advanced_disable_feature_flags:!1,advanced_disable_feature_flags_on_first_load:!1,advanced_only_evaluate_survey_feature_flags:!1,advanced_enable_surveys:!1,advanced_disable_toolbar_metrics:!1,feature_flag_request_timeout_ms:3e3,surveys_request_timeout_ms:1e4,on_request_error:n=>{var r="Bad HTTP status: "+n.statusCode+" "+n.text;U.error(r)},get_device_id:n=>n,capture_performance:void 0,name:"posthog",bootstrap:{},disable_compression:!1,session_idle_timeout_seconds:1800,person_profiles:"identified_only",before_send:void 0,request_queue_config:{flush_interval_ms:Xh},error_tracking:{},_onCapture:ep,__preview_eager_load_replay:!0}},b1=t=>{var e={};D(t.process_person)||(e.person_profiles=t.process_person),D(t.xhr_headers)||(e.request_headers=t.xhr_headers),D(t.cookie_name)||(e.persistence_name=t.cookie_name),D(t.disable_cookie)||(e.disable_persistence=t.disable_cookie),D(t.store_google)||(e.save_campaign_params=t.store_google),D(t.verbose)||(e.debug=t.verbose);var n=Ve({},e,t);return Ce(t.property_blacklist)&&(D(t.property_denylist)?n.property_denylist=t.property_blacklist:Ce(t.property_denylist)?n.property_denylist=[...t.property_blacklist,...t.property_denylist]:U.error("Invalid value for property_denylist config: "+t.property_denylist)),n};class sP{constructor(){this.__forceAllowLocalhost=!1}get Es(){return this.__forceAllowLocalhost}set Es(e){U.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=e}}class ju{get decideEndpointWasHit(){var e,n;return(e=(n=this.featureFlags)==null?void 0:n.hasLoadedFlags)!==null&&e!==void 0&&e}get flagsEndpointWasHit(){var e,n;return(e=(n=this.featureFlags)==null?void 0:n.hasLoadedFlags)!==null&&e!==void 0&&e}constructor(){this.webPerformance=new sP,this.Rs=!1,this.version=cr.LIB_VERSION,this.Is=new Yh,this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=w1(),this.SentryIntegration=lT,this.sentryIntegration=e=>function(n,r){var i=Ew(n,r);return{name:Sw,processEvent:s=>i(s)}}(this,e),this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this.Ps=!1,this.Ts=null,this.Cs=null,this.Ms=null,this.featureFlags=new LT(this),this.toolbar=new cT(this),this.scrollManager=new KT(this),this.pageViewManager=new gT(this),this.surveys=new UT(this),this.experiments=new _t(this),this.exceptions=new _T(this),this.rateLimiter=new BT(this),this.requestRouter=new JT(this),this.consent=new OR(this),this.externalIntegrations=new rP(this),this.people={set:(e,n,r)=>{var i=Ue(e)?{[e]:n}:e;this.setPersonProperties(i),r==null||r({})},set_once:(e,n,r)=>{var i=Ue(e)?{[e]:n}:e;this.setPersonProperties(void 0,i),r==null||r({})}},this.on("eventCaptured",e=>U.info('send "'+(e==null?void 0:e.event)+'"',e))}init(e,n,r){if(r&&r!==Ls){var i,s=(i=ga[r])!==null&&i!==void 0?i:new ju;return s._init(e,n,r),ga[r]=s,ga[Ls][r]=s,s}return this._init(e,n,r)}_init(e,n,r){var i,s;if(n===void 0&&(n={}),D(e)||Qf(e))return U.critical("PostHog was initialized without a token. This likely indicates a misconfiguration. Please check the first argument passed to posthog.init()"),this;if(this.__loaded)return U.warn("You have already initialized PostHog! Re-initializing is a no-op"),this;this.__loaded=!0,this.config={},this.Os=n,this.Fs=[],n.person_profiles&&(this.Cs=n.person_profiles),this.set_config(Ve({},w1(n.defaults),b1(n),{name:r,token:e})),this.config.on_xhr_error&&U.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=n.disable_compression?void 0:hr.GZipJS;var o=this.As();this.persistence=new Gh(this.config,o),this.sessionPersistence=this.config.persistence==="sessionStorage"||this.config.persistence==="memory"?this.persistence:new Gh(j({},this.config,{persistence:"sessionStorage"}),o);var a=j({},this.persistence.props),l=j({},this.sessionPersistence.props);this.register({$initialization_time:new Date().toISOString()}),this.Ds=new VT(y=>this.js(y),this.config.request_queue_config),this.Ls=new GT(this),this.__request_queue=[];var u=this.config.cookieless_mode==="always"||this.config.cookieless_mode==="on_reject"&&this.consent.isExplicitlyOptedOut();if(u||(this.sessionManager=new v1(this),this.sessionPropsManager=new p1(this,this.sessionManager,this.persistence)),new fT(this).startIfEnabledOrStop(),this.siteApps=new XT(this),(i=this.siteApps)==null||i.init(),u||(this.config.__preview_eager_load_replay?this.sessionRecording=new kw(this):this.sessionRecording=new iP(this),this.sessionRecording.startIfEnabledOrStop()),this.config.disable_scroll_properties||this.scrollManager.startMeasuringScrollPosition(),this.autocapture=new SR(this),this.autocapture.startIfEnabled(),this.surveys.loadIfEnabled(),this.heatmaps=new vT(this),this.heatmaps.startIfEnabled(),this.webVitalsAutocapture=new hT(this),this.exceptionObserver=new FR(this),this.exceptionObserver.startIfEnabled(),this.deadClicksAutocapture=new rw(this,IR),this.deadClicksAutocapture.startIfEnabled(),this.historyAutocapture=new LR(this),this.historyAutocapture.startIfEnabled(),cr.DEBUG=cr.DEBUG||this.config.debug,cr.DEBUG&&U.info("Starting in debug mode",{this:this,config:n,thisC:j({},this.config),p:a,s:l}),((s=n.bootstrap)==null?void 0:s.distinctID)!==void 0){var c,f,d=this.config.get_device_id(Gr()),h=(c=n.bootstrap)!=null&&c.isIdentifiedID?d:n.bootstrap.distinctID;this.persistence.set_property(fr,(f=n.bootstrap)!=null&&f.isIdentifiedID?"identified":"anonymous"),this.register({distinct_id:n.bootstrap.distinctID,$device_id:h})}if(this.Ns()){var p,v,w=Object.keys(((p=n.bootstrap)==null?void 0:p.featureFlags)||{}).filter(y=>{var b;return!((b=n.bootstrap)==null||(b=b.featureFlags)==null||!b[y])}).reduce((y,b)=>{var x;return y[b]=((x=n.bootstrap)==null||(x=x.featureFlags)==null?void 0:x[b])||!1,y},{}),m=Object.keys(((v=n.bootstrap)==null?void 0:v.featureFlagPayloads)||{}).filter(y=>w[y]).reduce((y,b)=>{var x,k;return(x=n.bootstrap)!=null&&(x=x.featureFlagPayloads)!=null&&x[b]&&(y[b]=(k=n.bootstrap)==null||(k=k.featureFlagPayloads)==null?void 0:k[b]),y},{});this.featureFlags.receivedFeatureFlags({featureFlags:w,featureFlagPayloads:m})}if(u)this.register_once({distinct_id:ea,$device_id:null},"");else if(!this.get_distinct_id()){var g=this.config.get_device_id(Gr());this.register_once({distinct_id:g,$device_id:g},""),this.persistence.set_property(fr,"anonymous")}return Ne(E,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),this.toolbar.maybeLoadToolbar(),n.segment?aT(this,()=>this.Us()):this.Us(),cn(this.config._onCapture)&&this.config._onCapture!==ep&&(U.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",y=>this.config._onCapture(y.event,y))),this.config.ip&&U.warn('The `ip` config option has NO EFFECT AT ALL and has been deprecated. Use a custom transformation or "Discard IP data" project setting instead. See https://posthog.com/tutorials/web-redact-properties#hiding-customer-ip-address for more information.'),this}Fe(e){var n,r,i,s,o,a,l,u;if(!B||!B.body)return U.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout(()=>{this.Fe(e)},500);this.compression=void 0,e.supportedCompression&&!this.config.disable_compression&&(this.compression=ue(e.supportedCompression,hr.GZipJS)?hr.GZipJS:ue(e.supportedCompression,hr.Base64)?hr.Base64:void 0),(n=e.analytics)!=null&&n.endpoint&&(this.analyticsDefaultEndpoint=e.analytics.endpoint),this.set_config({person_profiles:this.Cs?this.Cs:"identified_only"}),(r=this.siteApps)==null||r.onRemoteConfig(e),(i=this.sessionRecording)==null||i.onRemoteConfig(e),(s=this.autocapture)==null||s.onRemoteConfig(e),(o=this.heatmaps)==null||o.onRemoteConfig(e),this.surveys.onRemoteConfig(e),(a=this.webVitalsAutocapture)==null||a.onRemoteConfig(e),(l=this.exceptionObserver)==null||l.onRemoteConfig(e),this.exceptions.onRemoteConfig(e),(u=this.deadClicksAutocapture)==null||u.onRemoteConfig(e)}Us(){try{this.config.loaded(this)}catch(e){U.critical("`loaded` function failed",e)}this.zs(),this.config.capture_pageview&&setTimeout(()=>{(this.consent.isOptedIn()||this.config.cookieless_mode==="always")&&this.Bs()},1),new qT(this).load(),this.featureFlags.flags()}zs(){var e;this.is_capturing()&&this.config.request_batching&&((e=this.Ds)==null||e.enable())}_dom_loaded(){this.is_capturing()&&Vr(this.__request_queue,e=>this.js(e)),this.__request_queue=[],this.zs()}_handle_unload(){var e,n;this.config.request_batching?(this.qs()&&this.capture("$pageleave"),(e=this.Ds)==null||e.unload(),(n=this.Ls)==null||n.unload()):this.qs()&&this.capture("$pageleave",null,{transport:"sendBeacon"})}Oe(e){this.__loaded&&(_1?this.__request_queue.push(e):this.rateLimiter.isServerRateLimited(e.batchKey)||(e.transport=e.transport||this.config.api_transport,e.url=Ou(e.url,{ip:this.config.ip?1:0}),e.headers=j({},this.config.request_headers),e.compression=e.compression==="best-available"?this.compression:e.compression,e.disableXHRCredentials=this.config.__preview_disable_xhr_credentials,this.config.__preview_disable_beacon&&(e.disableTransport=["sendBeacon"]),e.fetchOptions=e.fetchOptions||this.config.fetch_options,(n=>{var r,i,s,o=j({},n);o.timeout=o.timeout||6e4,o.url=Ou(o.url,{_:new Date().getTime().toString(),ver:cr.LIB_VERSION,compression:o.compression});var a=(r=o.transport)!==null&&r!==void 0?r:"fetch",l=Au.filter(c=>!o.disableTransport||!c.transport||!o.disableTransport.includes(c.transport)),u=(i=(s=w_(l,c=>c.transport===a))==null?void 0:s.method)!==null&&i!==void 0?i:l[0].method;if(!u)throw new Error("No available transport method");u(o)})(j({},e,{callback:n=>{var r,i;this.rateLimiter.checkForLimiting(n),n.statusCode>=400&&((r=(i=this.config).on_request_error)==null||r.call(i,n)),e.callback==null||e.callback(n)}}))))}js(e){this.Ls?this.Ls.retriableRequest(e):this.Oe(e)}_execute_array(e){var n,r=[],i=[],s=[];Vr(e,a=>{a&&(n=a[0],Ce(n)?s.push(a):cn(a)?a.call(this):Ce(a)&&n==="alias"?r.push(a):Ce(a)&&n.indexOf("capture")!==-1&&cn(this[n])?s.push(a):i.push(a))});var o=function(a,l){Vr(a,function(u){if(Ce(u[0])){var c=l;Se(u,function(f){c=c[f[0]].apply(c,f.slice(1))})}else this[u[0]].apply(this,u.slice(1))},l)};o(r,this),o(i,this),o(s,this)}Ns(){var e,n;return((e=this.config.bootstrap)==null?void 0:e.featureFlags)&&Object.keys((n=this.config.bootstrap)==null?void 0:n.featureFlags).length>0||!1}push(e){this._execute_array([e])}capture(e,n,r){var i;if(this.__loaded&&this.persistence&&this.sessionPersistence&&this.Ds){if(this.is_capturing())if(!D(e)&&Ue(e)){if(this.config.opt_out_useragent_filter||!this._is_bot()){var s=r!=null&&r.skip_client_rate_limiting?void 0:this.rateLimiter.clientRateLimitContext();if(s==null||!s.isRateLimited){n!=null&&n.$current_url&&!Ue(n==null?void 0:n.$current_url)&&(U.error("Invalid `$current_url` property provided to `posthog.capture`. Input must be a string. Ignoring provided value."),n==null||delete n.$current_url),this.sessionPersistence.update_search_keyword(),this.config.save_campaign_params&&this.sessionPersistence.update_campaign_params(),this.config.save_referrer&&this.sessionPersistence.update_referrer_info(),(this.config.save_campaign_params||this.config.save_referrer)&&this.persistence.set_initial_person_info();var o=new Date,a=(r==null?void 0:r.timestamp)||o,l=Gr(),u={uuid:l,event:e,properties:this.calculateEventProperties(e,n||{},a,l)};s&&(u.properties.$lib_rate_limit_remaining_tokens=s.remainingTokens),r!=null&&r.$set&&(u.$set=r==null?void 0:r.$set);var c,f=this.Hs(r==null?void 0:r.$set_once);if(f&&(u.$set_once=f),(u=lR(u,r!=null&&r._noTruncate?null:this.config.properties_string_max_length)).timestamp=a,D(r==null?void 0:r.timestamp)||(u.properties.$event_time_override_provided=!0,u.properties.$event_time_override_system_time=o),e===Nu.DISMISSED||e===Nu.SENT){var d=n==null?void 0:n[c1.SURVEY_ID],h=n==null?void 0:n[c1.SURVEY_ITERATION];c={id:d,current_iteration:h},localStorage.getItem(f1(c))||localStorage.setItem(f1(c),"true"),u.$set=j({},u.$set,{[NT({id:d,current_iteration:h},e===Nu.SENT?"responded":"dismissed")]:!0})}var p=j({},u.properties.$set,u.$set);if(Ss(p)||this.setPersonPropertiesForFlags(p),!me(this.config.before_send)){var v=this.Ws(u);if(!v)return;u=v}this.Is.emit("eventCaptured",u);var w={method:"POST",url:(i=r==null?void 0:r._url)!==null&&i!==void 0?i:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),data:u,compression:"best-available",batchKey:r==null?void 0:r._batchKey};return!this.config.request_batching||r&&(r==null||!r._batchKey)||r!=null&&r.send_instantly?this.js(w):this.Ds.enqueue(w),u}U.critical("This capture call is ignored due to client rate limiting.")}}else U.error("No event name provided to posthog.capture")}else U.uninitializedWarning("posthog.capture")}Ze(e){return this.on("eventCaptured",n=>e(n.event,n))}calculateEventProperties(e,n,r,i,s){if(r=r||new Date,!this.persistence||!this.sessionPersistence)return n;var o=s?void 0:this.persistence.remove_event_timer(e),a=j({},n);if(a.token=this.config.token,a.$config_defaults=this.config.defaults,(this.config.cookieless_mode=="always"||this.config.cookieless_mode=="on_reject"&&this.consent.isExplicitlyOptedOut())&&(a.$cookieless_mode=!0),e==="$snapshot"){var l=j({},this.persistence.properties(),this.sessionPersistence.properties());return a.distinct_id=l.distinct_id,(!Ue(a.distinct_id)&&!mt(a.distinct_id)||Qf(a.distinct_id))&&U.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),a}var u,c=AT(this.config.mask_personal_data_properties,this.config.custom_personal_data_properties);if(this.sessionManager){var{sessionId:f,windowId:d}=this.sessionManager.checkAndGetSessionAndWindowId(s,r.getTime());a.$session_id=f,a.$window_id=d}this.sessionPropsManager&&Ve(a,this.sessionPropsManager.getSessionProps());try{var h;this.sessionRecording&&Ve(a,this.sessionRecording.sdkDebugProperties),a.$sdk_debug_retry_queue_size=(h=this.Ls)==null?void 0:h.length}catch(m){a.$sdk_debug_error_capturing_properties=String(m)}if(this.requestRouter.region===pa.CUSTOM&&(a.$lib_custom_api_host=this.config.api_host),u=e!=="$pageview"||s?e!=="$pageleave"||s?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(r):this.pageViewManager.doPageView(r,i),a=Ve(a,u),e==="$pageview"&&B&&(a.title=B.title),!D(o)){var p=r.getTime()-o;a.$duration=parseFloat((p/1e3).toFixed(3))}Nt&&this.config.opt_out_useragent_filter&&(a.$browser_type=this._is_bot()?"bot":"browser"),(a=Ve({},c,this.persistence.properties(),this.sessionPersistence.properties(),a)).$is_identified=this._isIdentified(),Ce(this.config.property_denylist)?Se(this.config.property_denylist,function(m){delete a[m]}):U.error("Invalid value for property_denylist config: "+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);var v=this.config.sanitize_properties;v&&(U.error("sanitize_properties is deprecated. Use before_send instead"),a=v(a,e));var w=this.Gs();return a.$process_person_profile=w,w&&!s&&this.Vs("_calculate_event_properties"),a}Hs(e){var n;if(!this.persistence||!this.Gs()||this.Rs)return e;var r=this.persistence.get_initial_props(),i=(n=this.sessionPropsManager)==null?void 0:n.getSetOnceProps(),s=Ve({},r,i||{},e||{}),o=this.config.sanitize_properties;return o&&(U.error("sanitize_properties is deprecated. Use before_send instead"),s=o(s,"$set_once")),this.Rs=!0,Ss(s)?void 0:s}register(e,n){var r;(r=this.persistence)==null||r.register(e,n)}register_once(e,n,r){var i;(i=this.persistence)==null||i.register_once(e,n,r)}register_for_session(e){var n;(n=this.sessionPersistence)==null||n.register(e)}unregister(e){var n;(n=this.persistence)==null||n.unregister(e)}unregister_for_session(e){var n;(n=this.sessionPersistence)==null||n.unregister(e)}Js(e,n){this.register({[e]:n})}getFeatureFlag(e,n){return this.featureFlags.getFeatureFlag(e,n)}getFeatureFlagPayload(e){var n=this.featureFlags.getFeatureFlagPayload(e);try{return JSON.parse(n)}catch{return n}}isFeatureEnabled(e,n){return this.featureFlags.isFeatureEnabled(e,n)}reloadFeatureFlags(){this.featureFlags.reloadFeatureFlags()}updateEarlyAccessFeatureEnrollment(e,n,r){this.featureFlags.updateEarlyAccessFeatureEnrollment(e,n,r)}getEarlyAccessFeatures(e,n,r){return n===void 0&&(n=!1),this.featureFlags.getEarlyAccessFeatures(e,n,r)}on(e,n){return this.Is.on(e,n)}onFeatureFlags(e){return this.featureFlags.onFeatureFlags(e)}onSurveysLoaded(e){return this.surveys.onSurveysLoaded(e)}onSessionId(e){var n,r;return(n=(r=this.sessionManager)==null?void 0:r.onSessionId(e))!==null&&n!==void 0?n:()=>{}}getSurveys(e,n){n===void 0&&(n=!1),this.surveys.getSurveys(e,n)}getActiveMatchingSurveys(e,n){n===void 0&&(n=!1),this.surveys.getActiveMatchingSurveys(e,n)}renderSurvey(e,n){this.surveys.renderSurvey(e,n)}displaySurvey(e,n){n===void 0&&(n=zT),this.surveys.displaySurvey(e,n)}canRenderSurvey(e){return this.surveys.canRenderSurvey(e)}canRenderSurveyAsync(e,n){return n===void 0&&(n=!1),this.surveys.canRenderSurveyAsync(e,n)}identify(e,n,r){if(!this.__loaded||!this.persistence)return U.uninitializedWarning("posthog.identify");if(mt(e)&&(e=e.toString(),U.warn("The first argument to posthog.identify was a number, but it should be a string. It has been converted to a string.")),e)if(["distinct_id","distinctid"].includes(e.toLowerCase()))U.critical('The string "'+e+'" was set in posthog.identify which indicates an error. This ID should be unique to the user and not a hardcoded string.');else if(e!==ea){if(this.Vs("posthog.identify")){var i=this.get_distinct_id();if(this.register({$user_id:e}),!this.get_property("$device_id")){var s=i;this.register_once({$had_persisted_distinct_id:!0,$device_id:s},"")}e!==i&&e!==this.get_property(Qo)&&(this.unregister(Qo),this.register({distinct_id:e}));var o=(this.persistence.get_property(fr)||"anonymous")==="anonymous";e!==i&&o?(this.persistence.set_property(fr,"identified"),this.setPersonPropertiesForFlags(j({},r||{},n||{}),!1),this.capture("$identify",{distinct_id:e,$anon_distinct_id:i},{$set:n||{},$set_once:r||{}}),this.Ms=Mw(e,n,r),this.featureFlags.setAnonymousDistinctId(i)):(n||r)&&this.setPersonProperties(n,r),e!==i&&(this.reloadFeatureFlags(),this.unregister(pu))}}else U.critical('The string "'+ea+'" was set in posthog.identify which indicates an error. This ID is only used as a sentinel value.');else U.error("Unique user id has not been set in posthog.identify")}setPersonProperties(e,n){if((e||n)&&this.Vs("posthog.setPersonProperties")){var r=Mw(this.get_distinct_id(),e,n);this.Ms!==r?(this.setPersonPropertiesForFlags(j({},n||{},e||{})),this.capture("$set",{$set:e||{},$set_once:n||{}}),this.Ms=r):U.info("A duplicate setPersonProperties call was made with the same properties. It has been ignored.")}}group(e,n,r){if(e&&n){if(this.Vs("posthog.group")){var i=this.getGroups();i[e]!==n&&this.resetGroupPropertiesForFlags(e),this.register({$groups:j({},i,{[e]:n})}),r&&(this.capture("$groupidentify",{$group_type:e,$group_key:n,$group_set:r}),this.setGroupPropertiesForFlags({[e]:r})),i[e]===n||r||this.reloadFeatureFlags()}}else U.error("posthog.group requires a group type and group key")}resetGroups(){this.register({$groups:{}}),this.resetGroupPropertiesForFlags(),this.reloadFeatureFlags()}setPersonPropertiesForFlags(e,n){n===void 0&&(n=!0),this.featureFlags.setPersonPropertiesForFlags(e,n)}resetPersonPropertiesForFlags(){this.featureFlags.resetPersonPropertiesForFlags()}setGroupPropertiesForFlags(e,n){n===void 0&&(n=!0),this.Vs("posthog.setGroupPropertiesForFlags")&&this.featureFlags.setGroupPropertiesForFlags(e,n)}resetGroupPropertiesForFlags(e){this.featureFlags.resetGroupPropertiesForFlags(e)}reset(e){var n,r,i,s;if(U.info("reset"),!this.__loaded)return U.uninitializedWarning("posthog.reset");var o=this.get_property("$device_id");if(this.consent.reset(),(n=this.persistence)==null||n.clear(),(r=this.sessionPersistence)==null||r.clear(),this.surveys.reset(),this.featureFlags.reset(),(i=this.persistence)==null||i.set_property(fr,"anonymous"),(s=this.sessionManager)==null||s.resetSessionId(),this.Ms=null,this.config.cookieless_mode==="always")this.register_once({distinct_id:ea,$device_id:null},"");else{var a=this.config.get_device_id(Gr());this.register_once({distinct_id:a,$device_id:e?a:o},"")}this.register({$last_posthog_reset:new Date().toISOString()},1)}get_distinct_id(){return this.get_property("distinct_id")}getGroups(){return this.get_property("$groups")||{}}get_session_id(){var e,n;return(e=(n=this.sessionManager)==null?void 0:n.checkAndGetSessionAndWindowId(!0).sessionId)!==null&&e!==void 0?e:""}get_session_replay_url(e){if(!this.sessionManager)return"";var{sessionId:n,sessionStartTimestamp:r}=this.sessionManager.checkAndGetSessionAndWindowId(!0),i=this.requestRouter.endpointFor("ui","/project/"+this.config.token+"/replay/"+n);if(e!=null&&e.withTimestamp&&r){var s,o=(s=e.timestampLookBack)!==null&&s!==void 0?s:10;if(!r)return i;i+="?t="+Math.max(Math.floor((new Date().getTime()-r)/1e3)-o,0)}return i}alias(e,n){return e===this.get_property(b_)?(U.critical("Attempting to create alias for existing People user - aborting."),-2):this.Vs("posthog.alias")?(D(n)&&(n=this.get_distinct_id()),e!==n?(this.Js(Qo,e),this.capture("$create_alias",{alias:e,distinct_id:n})):(U.warn("alias matches current distinct_id - skipping api call."),this.identify(e),-1)):void 0}set_config(e){var n=j({},this.config);if(He(e)){var r,i,s,o,a;Ve(this.config,b1(e));var l=this.As();(r=this.persistence)==null||r.update_config(this.config,n,l),this.sessionPersistence=this.config.persistence==="sessionStorage"||this.config.persistence==="memory"?this.persistence:new Gh(j({},this.config,{persistence:"sessionStorage"}),l),et.G()&&et.J("ph_debug")==="true"&&(this.config.debug=!0),this.config.debug&&(cr.DEBUG=!0,U.info("set_config",{config:e,oldConfig:n,newConfig:j({},this.config)})),(i=this.sessionRecording)==null||i.startIfEnabledOrStop(),(s=this.autocapture)==null||s.startIfEnabled(),(o=this.heatmaps)==null||o.startIfEnabled(),this.surveys.loadIfEnabled(),this.Ks(),(a=this.externalIntegrations)==null||a.startIfEnabledOrStop()}}startSessionRecording(e){var n=e===!0,r={sampling:n||!(e==null||!e.sampling),linked_flag:n||!(e==null||!e.linked_flag),url_trigger:n||!(e==null||!e.url_trigger),event_trigger:n||!(e==null||!e.event_trigger)};if(Object.values(r).some(Boolean)){var i,s,o,a,l;(i=this.sessionManager)==null||i.checkAndGetSessionAndWindowId(),r.sampling&&((s=this.sessionRecording)==null||s.overrideSampling()),r.linked_flag&&((o=this.sessionRecording)==null||o.overrideLinkedFlag()),r.url_trigger&&((a=this.sessionRecording)==null||a.overrideTrigger("url")),r.event_trigger&&((l=this.sessionRecording)==null||l.overrideTrigger("event"))}this.set_config({disable_session_recording:!1})}stopSessionRecording(){this.set_config({disable_session_recording:!0})}sessionRecordingStarted(){var e;return!((e=this.sessionRecording)==null||!e.started)}captureException(e,n){var r=new Error("PostHog syntheticException"),i=this.exceptions.buildProperties(e,{handled:!0,syntheticException:r});return this.exceptions.sendExceptionEvent(j({},i,n))}loadToolbar(e){return this.toolbar.loadToolbar(e)}get_property(e){var n;return(n=this.persistence)==null?void 0:n.props[e]}getSessionProperty(e){var n;return(n=this.sessionPersistence)==null?void 0:n.props[e]}toString(){var e,n=(e=this.config.name)!==null&&e!==void 0?e:Ls;return n!==Ls&&(n=Ls+"."+n),n}_isIdentified(){var e,n;return((e=this.persistence)==null?void 0:e.get_property(fr))==="identified"||((n=this.sessionPersistence)==null?void 0:n.get_property(fr))==="identified"}Gs(){var e,n;return!(this.config.person_profiles==="never"||this.config.person_profiles==="identified_only"&&!this._isIdentified()&&Ss(this.getGroups())&&((e=this.persistence)==null||(e=e.props)==null||!e[Qo])&&((n=this.persistence)==null||(n=n.props)==null||!n[gu]))}qs(){return this.config.capture_pageleave===!0||this.config.capture_pageleave==="if_capture_pageview"&&(this.config.capture_pageview===!0||this.config.capture_pageview==="history_change")}createPersonProfile(){this.Gs()||this.Vs("posthog.createPersonProfile")&&this.setPersonProperties({},{})}Vs(e){return this.config.person_profiles==="never"?(U.error(e+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this.Js(gu,!0),!0)}As(){if(this.config.cookieless_mode==="always")return!0;var e=this.consent.isOptedOut(),n=this.config.opt_out_persistence_by_default||this.config.cookieless_mode==="on_reject";return this.config.disable_persistence||e&&!!n}Ks(){var e,n,r,i,s=this.As();return((e=this.persistence)==null?void 0:e.Ue)!==s&&((r=this.persistence)==null||r.set_disabled(s)),((n=this.sessionPersistence)==null?void 0:n.Ue)!==s&&((i=this.sessionPersistence)==null||i.set_disabled(s)),s}opt_in_capturing(e){if(this.config.cookieless_mode!=="always"){var n;this.config.cookieless_mode==="on_reject"&&this.consent.isExplicitlyOptedOut()&&(this.reset(!0),this.sessionManager=new v1(this),this.persistence&&(this.sessionPropsManager=new p1(this,this.sessionManager,this.persistence)),this.sessionRecording=new kw(this),this.sessionRecording.startIfEnabledOrStop()),this.consent.optInOut(!0),this.Ks(),this.config.cookieless_mode=="on_reject"&&this.surveys.loadIfEnabled(),(D(e==null?void 0:e.captureEventName)||e!=null&&e.captureEventName)&&this.capture((n=e==null?void 0:e.captureEventName)!==null&&n!==void 0?n:"$opt_in",e==null?void 0:e.captureProperties,{send_instantly:!0}),this.config.capture_pageview&&this.Bs()}else U.warn('Consent opt in/out is not valid with cookieless_mode="always" and will be ignored')}opt_out_capturing(){var e;this.config.cookieless_mode!=="always"?(this.config.cookieless_mode==="on_reject"&&this.consent.isOptedIn()&&this.reset(!0),this.consent.optInOut(!1),this.Ks(),this.config.cookieless_mode==="on_reject"&&(this.register({distinct_id:ea,$device_id:null}),this.sessionManager=void 0,this.sessionPropsManager=void 0,(e=this.sessionRecording)==null||e.stopRecording(),this.sessionRecording=void 0,this.Bs())):U.warn('Consent opt in/out is not valid with cookieless_mode="always" and will be ignored')}has_opted_in_capturing(){return this.consent.isOptedIn()}has_opted_out_capturing(){return this.consent.isOptedOut()}get_explicit_consent_status(){var e=this.consent.consent;return e===pr.GRANTED?"granted":e===pr.DENIED?"denied":"pending"}is_capturing(){return this.config.cookieless_mode==="always"||(this.config.cookieless_mode==="on_reject"?this.consent.isExplicitlyOptedOut()||this.consent.isOptedIn():!this.has_opted_out_capturing())}clear_opt_in_out_capturing(){this.consent.reset(),this.Ks()}_is_bot(){return Xt?m1(Xt,this.config.custom_blocked_useragents):void 0}Bs(){B&&(B.visibilityState==="visible"?this.Ps||(this.Ps=!0,this.capture("$pageview",{title:B.title},{send_instantly:!0}),this.Ts&&(B.removeEventListener("visibilitychange",this.Ts),this.Ts=null)):this.Ts||(this.Ts=this.Bs.bind(this),Ne(B,"visibilitychange",this.Ts)))}debug(e){e===!1?(E==null||E.console.log("You've disabled debug mode."),localStorage&&localStorage.removeItem("ph_debug"),this.set_config({debug:!1})):(E==null||E.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}))}L(){var e,n,r,i,s,o,a,l=this.Os||{};return"advanced_disable_flags"in l?!!l.advanced_disable_flags:this.config.advanced_disable_flags!==!1?!!this.config.advanced_disable_flags:this.config.advanced_disable_decide===!0?(U.warn("Config field 'advanced_disable_decide' is deprecated. Please use 'advanced_disable_flags' instead. The old field will be removed in a future major version."),!0):(r="advanced_disable_decide",i=!1,s=U,o=(n="advanced_disable_flags")in(e=l)&&!D(e[n]),a=r in e&&!D(e[r]),o?e[n]:a?(s&&s.warn("Config field '"+r+"' is deprecated. Please use '"+n+"' instead. The old field will be removed in a future major version."),e[r]):i)}Ws(e){if(me(this.config.before_send))return e;var n=Ce(this.config.before_send)?this.config.before_send:[this.config.before_send],r=e;for(var i of n){if(r=i(r),me(r)){var s="Event '"+e.event+"' was rejected in beforeSend function";return L3(e.event)?U.warn(s+". This can cause unexpected behavior."):U.info(s),null}r.properties&&!Ss(r.properties)||U.warn("Event '"+e.event+"' has no properties after beforeSend function, this is likely an error.")}return r}getPageViewId(){var e;return(e=this.pageViewManager.pe)==null?void 0:e.pageViewId}captureTraceFeedback(e,n){this.capture("$ai_feedback",{$ai_trace_id:String(e),$ai_feedback_text:n})}captureTraceMetric(e,n,r){this.capture("$ai_metric",{$ai_trace_id:String(e),$ai_metric_name:n,$ai_metric_value:String(r)})}}(function(t,e){for(var n=0;n<e.length;n++)t.prototype[e[n]]=aR(t.prototype[e[n]])})(ju,["identify"]);var x1,tp=(x1=ga[Ls]=new ju,function(){function t(){t.done||(t.done=!0,_1=!1,Se(ga,function(e){e._dom_loaded()}))}B!=null&&B.addEventListener?B.readyState==="complete"?t():Ne(B,"DOMContentLoaded",t,{capture:!1}):E&&U.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")}(),x1);console.info("Vehicle Search v3.0.42 powered by Partbot https://mmyvs.partbot.io");function zu(t=[],e=[]){const n=[];return t.forEach(r=>{const[i,...s]=r.split(":"),o=s.join(":");if(o.includes(" > ")){const a=o.split(" > "),l=a[a.length-1].trim();if(i!=="make"&&a.length>=2){const u=a[0].trim();n.push(`make = "${u}"`)}n.push(`${i} = "${l}"`)}else n.push(`${i} = "${o}"`)}),e.forEach(r=>{n.push(r)}),n.length>0?n.join(" AND "):null}function ct(t){return String(t||"").normalize("NFKD").replace(/[\u0300-\u036f]/g,"").toUpperCase().trim().replace(/\s+/g," ")}function Ds(t){return String(t||"").split(">").pop().trim()}function np(t,e,n){return!n||n.size===0||!Array.isArray(t)||!t.some(i=>n.has(ct(e(i))))?t:t.filter(i=>n.has(ct(e(i))))}function rp({apiKey:t,makes:e="",models:n="",vehicleScopeTokens:r="",yearTokens:i="",callbackUrl:s="",layout:o="row",fields:a,fieldPrefix:l="",showBranding:u=!0,showLabels:c=!1,mobileFullWidthButton:f=!0,mobileDrawer:d=!0,modifyQueryString:h=!0,onChange:p,buttonLabel:v="Search",showButton:w=!0,onSubmit:m,store:g,useStoreVehicles:y=!0,fieldOrder:b="MMY",enableFeatureFlags:x=!0,yearOptional:k=!1,mobileButtonLabel:$="Select Vehicle"}){const C=_.useRef(null),q=_.useRef(null),I=_.useRef(null),F=_.useRef(null),N=_.useRef(null),G=_.useRef(null),Y=_.useRef(null),H=_.useRef(null),te=_.useRef(null),ee=_.useRef(!1),R=b==="YMM",[L,z]=_.useState([]),[oe,P]=_.useState([]),[ae,J]=_.useState([]),[be,ie]=_.useState([]),[Me,_e]=_.useState([]),[hn,Tt]=_.useState([]),[Be,Di]=_.useState([]),[Ns,Ni]=_.useState([]),Hu=_.useRef([]),[Yn,gr]=_.useState([]),[S,Jt]=_.useState({make:null,model:null,year:null,body:null,series:null,variant:null,engine:null,engine_capacity:null}),[cP,ip]=_.useState(!1),S1=_.useRef(["body","series","variant","engine","engine_capacity"]),Uu=_.useRef(a&&a.length&&S1.current?a.split(",").filter(T=>{var O;return(O=S1.current)==null?void 0:O.includes(T)}):null),[E1,ya]=_.useState({}),Qn=_.useMemo(()=>!e||typeof e!="string"?new Set:new Set(e.trim().split(",").map(T=>ct(T)).filter(Boolean)),[e]),mr=_.useMemo(()=>new Set(Object.keys(E1||{}).map(T=>ct(T))),[E1]),[Mn,dP]=_.useState(!1);_.useEffect(()=>{const T=navigator.userAgent;dP(/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(T)),tp.__loaded||tp.init("phc_mLZkVvweXDfwCPYS7kSCxoAxgQUkw8fgyDiplKnleGw",{api_host:"https://app.posthog.com",autocapture:!1,capture_pageview:!1,capture_pageleave:!1,disable_session_recording:!1})},[]);const[Zr,fP]=_.useState({}),[MP,hP]=_.useState(""),$1=_.useCallback(async()=>{if(!t)return;const O=`${x?"https://api.cartbot.io":"https://api.partbot.io"}/v1/vehicles/auth`;try{const K=await fetch(O,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${t}`},body:JSON.stringify((()=>{const ve={use_store_vehicles:y};return g&&(ve.store=g),ve})())});if(!K.ok)throw new Error(`Error: ${K.status} ${K.statusText}`);const{merchant:W,vehicle_makes:le,vehicle_models:Q,meilisearch_search_key:pe,meilisearch_index_name:ne,algolia_search_key:re,algolia_index_name:Ke,store_index_name:Ye,store_popular_makes:fe,store_popular_models:ke}=await K.json(),je=le||[],Qe=Q;q.current=W,I.current=je.map(ve=>({...ve,refinement:ve.value})),y&&Qe?typeof Qe=="object"&&!Array.isArray(Qe)?(F.current=Qe,ya(Qe)):Array.isArray(Qe)?(F.current=Qe.map(ve=>ve&&ve.value?String(ve.value).trim():"").filter(Boolean),ya({})):(F.current=[],ya({})):(F.current=[],ya({})),N.current=Array.isArray(fe)?fe.map(ve=>String(ve).trim().toUpperCase()):null,G.current=ke||null,fP({searchKey:"eeace38b64f52bf56ebb4fe8bd5837b3cd6c0ff9d7e272f76449d94b80cba86b",indexName:"otto_v1_vehicles_production"})}catch(K){console.error("[VehicleSearch] Auth failed:",K),hP(K),ya({})}},[t,g,y,x]);_.useEffect(()=>{$1()},[$1]),_.useEffect(()=>{if(Zr.searchKey){try{Y.current=new Ly({host:"https://search.partbot.io",apiKey:Zr.searchKey}),H.current=Y.current.index(Zr.indexName);const T=new Ly({host:"https://partbot-meilisearch-cache.partbot.workers.dev",apiKey:Zr.searchKey});te.current=T.index("otto_v1_vehicle_mmy")}catch(T){console.error("[VehicleSearch] Failed to initialize Meilisearch:",T)}return()=>{Y.current=null}}},[Zr.searchKey,t]);const[pn,pP]=_.useState(!1),C1=_.useCallback(()=>{function T(Q){if(!Q)return"rgba(0,0,0,1)";var pe=O(),ne=window.getComputedStyle(Q).backgroundColor;return ne!==pe?ne:Q.parentElement?T(Q.parentElement):"rgba(255,255,255,1)"}function O(){var Q=document.createElement("div");document.head.appendChild(Q);var pe=window.getComputedStyle(Q).backgroundColor;return document.head.removeChild(Q),pe}const K=document.querySelector("vehicle-search");let W;K?W=T(K):W=T(C.current);const le=X(W).isDark();pP(le)},[]);_.useEffect(()=>{async function T(){if(!S.make||!H.current)return;let O=[],K=[];S.make&&O.push(`make:${S.make.refinement}`),S.model&&O.push(`model:${S.make.refinement} > ${S.model.refinement}`),S.year&&(K=[`year_from <= ${S.year.value}`,`year_to >= ${S.year.value}`]),S.body&&O.push(`body:${S.make.refinement} > ${S.model.refinement} > ${S.body.refinement}`),S.series&&O.push(`series:${S.series.refinement}`),S.engine&&O.push(`engine:${S.engine.refinement}`),S.engine_capacity&&O.push(`engine_capacity:${S.engine_capacity.refinement}`);let le=(await H.current.search("",{filter:zu(O,K),attributesToRetrieve:["otto_id"],limit:500})).hits.map(ne=>ne.otto_id);gr(le);let pe={...Object.fromEntries(Object.entries(S||{}).map(([ne,re])=>[ne,re&&re.value||null]).filter(([ne,re])=>re!==null)),merchant:q.current};tp.capture("vehicle select",pe)}T()},[S,H,k]);const sp=T=>l?`${l}${T}`:T,vP=T=>l?T.replace(new RegExp(`^${l}`),""):T,R1=_.useCallback(()=>{const T=new URL(window.location.href).searchParams,O=["make","model","year","body","series","engine","engine_capacity"],K=O.map(sp),W={},le=/^filter\.p\.m\.app--\d+--partbot\.vehicle_(\w+)$/;for(const[ne,re]of T.entries()){const Ke=ne.match(le);if(Ke){const Ye=Ke[1];if(Ye==="year_tokens"&&re){const ke=re.split("|");if(ke.length>=3){const je=ke[2].trim();/^\d{4}$/.test(je)&&(W.year=je)}continue}let fe=Ye.replace(/s$/,"");fe==="engine_capacitie"&&(fe="engine_capacity"),fe==="bodie"&&(fe="body"),fe==="serie"&&(fe="series"),O.includes(fe)&&(W[fe]=re)}}const Q=Object.fromEntries([...T.entries()].filter(([ne])=>K.includes(ne)).map(([ne,re])=>{const Ke=vP(ne);if(Ke==="year"&&re&&/^\d{4}$/.test(re)){const Ye=parseInt(re,10);return[Ke,{value:Ye,refinement:Ye}]}return[Ke,{value:re,refinement:re}]}));for(const[ne,re]of Object.entries(W))if(re&&re!=="[object Object]"&&!Q[ne])if(ne==="year"&&/^\d{4}$/.test(re)){const Ke=parseInt(re,10);Q[ne]={value:Ke,refinement:Ke}}else Q[ne]={value:re,refinement:re};if(!(Object.keys(Q).length>0))try{const ne=localStorage.getItem("partbot_selected_vehicle");if(ne){const re=JSON.parse(ne);if(re!=null&&re.vehicle){const Ke=re.vehicle;for(const Ye of O){const fe=Ke[Ye];if(fe&&typeof fe=="string"&&fe.trim())if(Ye==="year"&&/^\d{4}$/.test(fe)){const ke=parseInt(fe,10);Q[Ye]={value:ke,refinement:ke}}else Q[Ye]={value:fe,refinement:fe};else if(fe!=null&&fe.value&&typeof fe.value=="string")if(Ye==="year"&&/^\d{4}$/.test(fe.value)){const ke=parseInt(fe.value,10);Q[Ye]={value:ke,refinement:ke}}else Q[Ye]={value:fe.value,refinement:fe.value}}}}}catch{}Jt(Q)},[]),wt=_.useCallback(({query:T,value:O,remove:K})=>{if(h&&"URLSearchParams"in window){let W=new URLSearchParams(window.location.search);T=sp(T),T&&O&&W.set(T,O),T&&!O&&W.delete(T),K&&K.forEach(Q=>{Q=sp(Q),W.delete(Q)});const le=window.location.pathname+"?"+W.toString();window.history.pushState(null,"",le)}},[]),gP=_.useCallback(()=>{var K;const T={vehicle_ids:Yn,vehicle:(K=S==null?void 0:S.make)!=null&&K.value?S:{}};m&&m(T);const O=new CustomEvent("vehicle-search-submit",{detail:T});window.dispatchEvent(O),document.dispatchEvent(O),setTimeout(()=>{ip(!1)},900)},[Yn,m]),T1=_.useCallback(()=>{var K,W,le,Q,pe,ne,re,Ke,Ye;const T={vehicle_ids:Yn,vehicle:(K=S==null?void 0:S.make)!=null&&K.value?S:{},userSelected:ee.current};p&&p(T);const O=new CustomEvent("vehicle-search-change",{detail:T});if(ee.current===!0){localStorage.removeItem("partbot_plate_details");const fe=JSON.stringify({description:`${((W=S.make)==null?void 0:W.value)||""} ${((le=S.model)==null?void 0:le.value)||""} ${((Q=S.year)==null?void 0:Q.value)||""} ${((pe=S.body)==null?void 0:pe.value)||""} ${((ne=S.series)==null?void 0:ne.value)||""} ${((re=S.variant)==null?void 0:re.value)||""} ${((Ke=S.engine)==null?void 0:Ke.value)||""} ${((Ye=S.engine_capacity)==null?void 0:Ye.value)||""}`.trim(),vehicle_ids:Yn,vehicle:S?Object.entries(S).reduce((ke,[je,Qe])=>(ke[je]=Qe!=null&&Qe.value?Qe.value:{},ke),{}):{}});localStorage.setItem("partbot_selected_vehicle",fe),hk.set("partbot_selected_vehicle",fe,{secure:!0})}window.dispatchEvent(O),ee.current&&document.dispatchEvent(O),Hu.current=Yn,setTimeout(()=>{ip(!1)},900)},[Yn,p]),Jr=_.useMemo(()=>l3(T1,100),[T1]);_.useEffect(()=>{Jr()},[Yn,Jr]),_.useEffect(()=>()=>{Jr.cancel()},[Jr]),_.useEffect(()=>{const T=()=>{ee.current=!1,Jr.cancel(),Jt({make:null,model:null,year:null,body:null,series:null,variant:null,engine:null,engine_capacity:null}),gr([])};return window.addEventListener("plate-search-change",T),()=>{window.removeEventListener("plate-search-change",T)}},[Jr]),_.useEffect(()=>{const T=()=>{ee.current=!1,Jr.cancel(),Jt({make:null,model:null,year:null,body:null,series:null,variant:null,engine:null,engine_capacity:null}),gr([])};return document.addEventListener("partbot-clear-vehicle",T),()=>{document.removeEventListener("partbot-clear-vehicle",T)}},[Jr]),_.useEffect(()=>{Zr.searchKey&&(R||xP(),R1())},[Zr.searchKey,R,R1]),_.useEffect(()=>{R&&H.current&&ae.length===0&&!S.year&&H.current.search("",{attributesToRetrieve:["year_from","year_to"],limit:1e4}).then(({hits:T})=>{const O=T.map(pe=>pe.year_from).filter(Boolean),K=T.map(pe=>pe.year_to).filter(Boolean),W=Math.min(...O),le=Math.max(...K),Q=Array.from({length:le-W+1},(pe,ne)=>({value:W+ne,refinement:W+ne})).reverse();J(Q)}).catch(T=>{console.error("[VehicleSearch] Error loading year range:",T)})},[R,Zr.searchKey,ae.length,S.year]),_.useEffect(()=>{typeof document>"u"||C1()},[C1]);const P1=_.useCallback(T=>{ee.current=!0,P([]),!R&&!k&&J([]),ie([]),_e([]),Tt([]),Ni([]),Di([]),Jt(O=>({make:T,year:R||k?O.year:null})),wt({query:"make",value:(T==null?void 0:T.value)??"",remove:R?["model","body","series","engine","variant","engine_capacity"]:k?["model","body","series","engine","variant","engine_capacity"]:["model","year","body","series","engine","variant","engine_capacity"]}),T||gr([])},[wt,R,k]),M1=_.useCallback(T=>{ee.current=!0,Jt(O=>({...O,model:T!==""?T:null,year:R||k?O.year:null,body:null,series:null,variant:null,engine:null,engine_capacity:null})),!R&&!k&&J([]),ie([]),_e([]),Tt([]),Ni([]),Di([]),wt({query:"model",value:(T==null?void 0:T.value)??"",remove:R?["body","series","engine","variant","engine_capacity"]:k?["body","series","engine","variant","engine_capacity"]:["year","body","series","engine","variant","engine_capacity"]})},[wt,R,k]),O1=_.useCallback(T=>{ee.current=!0,R?(z([]),P([]),Jt({year:T!==""?T:null}),(!T||T==="")&&J([])):Jt(k?O=>({...O,year:T!==""?T:null}):O=>({...O,year:T!==""?T:null,body:null,series:null,variant:null,engine:null,engine_capacity:null})),k||(ie([]),_e([]),Tt([]),Ni([]),Di([])),wt({query:"year",value:(T==null?void 0:T.value)??"",remove:R?["make","model","body","series","variant","engine","engine_capacity"]:k?[]:["body","series","variant","engine","engine_capacity"]}),!k&&(!T||T==="")&&gr([])},[wt,R,k]),mP=_.useCallback(T=>{ee.current=!0,Jt(O=>({...O,body:T!==""?T:null})),wt({query:"body",value:(T==null?void 0:T.value)??""})},[wt]),yP=_.useCallback(T=>{ee.current=!0,Jt(O=>({...O,series:T!==""?T:null})),wt({query:"series",value:(T==null?void 0:T.value)??""})},[wt]),_P=_.useCallback(T=>{ee.current=!0,Jt(O=>({...O,variant:T!==""?T:null})),wt({query:"variant",value:(T==null?void 0:T.value)??""})},[wt]),wP=_.useCallback(T=>{ee.current=!0,Jt(O=>({...O,engine:T!==""?T:null})),wt({query:"engine",value:(T==null?void 0:T.value)??""})},[wt]),bP=_.useCallback(T=>{ee.current=!0,Jt(O=>({...O,engine_capacity:T!==""?T:null})),wt({query:"engine_capacity",value:(T==null?void 0:T.value)??""})},[wt]);_.useEffect(()=>{R&&S.year&&H.current&&(async()=>{try{const O=await H.current.search("",{filter:`year_from <= ${S.year.value} AND year_to >= ${S.year.value}`,attributesToRetrieve:["make","make_popularity"],limit:1e4}),K=new Map;O.hits.forEach(Q=>{Q.make&&!K.has(Q.make)&&K.set(Q.make,{value:Q.make.toUpperCase(),refinement:Q.make.toUpperCase(),popularity:Q.make_popularity||0})});let W=Array.from(K.values());Qn.size>0?W=W.filter(Q=>Qn.has(ct(Q.value))):mr.size>0&&(W=W.filter(Q=>mr.has(ct(Q.value))));const le=new Set(N.current||[]);le.size>0?W.sort((Q,pe)=>{const ne=le.has(Q.value),re=le.has(pe.value);return ne&&!re?-1:!ne&&re?1:ne&&re?N.current.indexOf(Q.value)-N.current.indexOf(pe.value):Q.value.localeCompare(pe.value)}):W.sort((Q,pe)=>pe.popularity===Q.popularity?Q.value.localeCompare(pe.value):pe.popularity-Q.popularity),z(W)}catch(O){console.error("[VehicleSearch] Error loading makes for year:",O)}})()},[R,S.year,Qn,mr]);const xP=_.useCallback(()=>{(async()=>{let O=[];if(I.current&&I.current.length)O=I.current;else if(H.current)try{const K=await H.current.search("",{attributesToRetrieve:["make","make_popularity"],limit:1e3}),W=new Map;K.hits.forEach(le=>{le.make&&!W.has(le.make)&&W.set(le.make,{value:le.make.toUpperCase(),refinement:le.make.toUpperCase(),popularity:le.make_popularity||0})}),O=Array.from(W.values())}catch(K){console.error("[VehicleSearch] Error loading makes:",K)}if(Qn.size>0&&O.length&&(O=O.filter(K=>Qn.has(ct(K.value)))),Qn.size===0&&mr.size>0&&(O=O.filter(K=>mr.has(ct(K.value)))),N.current&&N.current.length>0){const K=new Set(N.current);O.sort((W,le)=>{const Q=K.has(W.value),pe=K.has(le.value);return Q&&!pe?-1:!Q&&pe?1:Q&&pe?N.current.indexOf(W.value)-N.current.indexOf(le.value):W.value.localeCompare(le.value)})}else O.sort((K,W)=>K.popularity===W.popularity?K.value.localeCompare(W.value):W.popularity-K.popularity);z(O)})()},[Qn,mr]);_.useEffect(()=>{var T;if(S.make&&S.make.refinement){const O=S.make.refinement,K=ct(O),W=Qn.size>0,le=mr.size>0;if(W&&!Qn.has(K)){P([]);return}if(!W&&le&&!mr.has(K)){P([]);return}const Q=n?n.trim().split(",").map(ke=>ke.trim()).filter(Boolean):[],pe=new Set(Q.map(ke=>ct(ke))),ne=typeof F.current=="object"&&!Array.isArray(F.current)&&F.current!==null?F.current:null;let re=[];if(ne&&(re=ne[O]||[],Array.isArray(re)||(re=[]),re.length===0)){const ke=Object.keys(ne).find(je=>ct(je)===K);if(ke){const je=ne[ke];re=Array.isArray(je)?je:[]}}const Ke=new Set(re.map(ke=>ct(ke))),Ye=Ke.size>0?Ke:null;let fe=pe;if(pe.size>0&&Ke.size>0&&(fe=new Set(Array.from(pe).filter(ke=>Ke.has(ke)))),pe.size>0&&fe.size===0){P([]);return}if(y&&re.length>0){let je=re.map(ve=>({value:ve,refinement:ve,popularity:0}));je=np(je,ve=>ve.value,fe),je=np(je,ve=>ve.value,Ye);const Qe=(T=G.current)==null?void 0:T[O];if(Qe&&Array.isArray(Qe)){const ve=new Map(Qe.map((en,yr)=>[en.toUpperCase(),Qe.length-yr]));je.sort((en,yr)=>{const qu=ve.get(en.value.toUpperCase())||0,ei=ve.get(yr.value.toUpperCase())||0;return qu!==ei?ei-qu:en.value.localeCompare(yr.value)})}else je.sort((ve,en)=>ve.value.localeCompare(en.value));P(je);return}if(!te.current||!t)return;te.current.search("",{filter:`make = "${S.make.refinement}"`,limit:1}).then(ke=>{var A1,I1;const{hits:je}=ke;let Qe=[];je.length>0&&je[0].models&&(Qe=je[0].models);let ve=Qe.map(Oe=>({model:`${S.make.refinement} > ${Oe.name}`,model_popularity:Oe.popularity||0})),en=[];Array.isArray(F.current)?en=F.current:typeof F.current=="object"&&F.current!==null?en=re:typeof F.current=="string"&&F.current.length&&(en=F.current.split(",").map(Oe=>Oe.trim()).filter(Boolean));let yr=en;if(fe.size>0&&(yr=en.length?en.filter(Oe=>fe.has(ct(Oe))):Q,ve=ve.filter(Oe=>fe.has(ct(Ds(Oe.model))))),yr&&yr.length>0){const Oe=new Set(yr.map(_r=>ct(_r)));ve.some(_r=>Oe.has(ct(Ds(_r.model))))&&(ve=ve.filter(_r=>Oe.has(ct(Ds(_r.model)))))}ve=np(ve,Oe=>Ds(Oe.model),Ye),ve=ve.filter(Oe=>Ds(Oe.model)!=="").map(Oe=>{const zt=Ds(Oe.model);return{value:zt,refinement:zt,popularity:Oe.model_popularity}});const qu=(A1=S.make)==null?void 0:A1.refinement,ei=(I1=G.current)==null?void 0:I1[qu];if(ei&&Array.isArray(ei)&&ei.length>0){const Oe=new Set(ei.map(zt=>String(zt).trim().toUpperCase()));ve.sort((zt,_r)=>{const ap=Oe.has(zt.value),lp=Oe.has(_r.value);if(ap&&!lp)return-1;if(!ap&&lp)return 1;if(ap&&lp){const F1=ei.map(SP=>String(SP).trim().toUpperCase());return F1.indexOf(zt.value)-F1.indexOf(_r.value)}return zt.value.localeCompare(_r.value)})}else ve.sort((Oe,zt)=>Oe.popularity===zt.popularity?Oe.value.localeCompare(zt.value):zt.popularity-Oe.popularity);P(ve)}).catch(ke=>{console.error("[VehicleSearch] Error loading models:",ke),P([])})}else P([])},[S.make,n,t,R,S.year,y,Qn,mr]),_.useEffect(()=>{if(H.current&&S.make&&S.model){let T=[`model:${S.make.refinement} > ${S.model.refinement}`];k&&(S.body&&T.push(`body:${S.make.refinement} > ${S.model.refinement} > ${S.body.refinement}`),S.series&&T.push(`series:${S.series.refinement}`),S.engine&&T.push(`engine:${S.engine.refinement}`),S.engine_capacity&&T.push(`engine_capacity:${S.engine_capacity.refinement}`)),H.current.search("",{filter:zu(T,[]),attributesToRetrieve:["year_from","year_to","otto_id"],limit:200}).then(({hits:O})=>{const K=O.map(ne=>ne.year_from),W=Math.min(...K),le=O.map(ne=>ne.year_to),Q=Math.max(...le);let pe=Array.apply(null,{length:Q+1-W}).map(function(ne,re){return re+W});pe=pe.reverse().map(ne=>({value:ne,refinement:ne})),J(pe)}).catch(O=>{console.error("[VehicleSearch] Error fetching years:",O)})}},[S.model,S.make,R,k,S.body,S.series,S.engine,S.engine_capacity]),_.useEffect(()=>{const T=k?S.make&&S.model:S.year&&S.make&&S.model;if(H.current&&T){const O=S.year?[`year_from <= ${S.year.value}`,`year_to >= ${S.year.value}`]:[];H.current.search("",{filter:zu([`model:${S.make.refinement} > ${S.model.refinement}`],O),attributesToRetrieve:["body","otto_id"],limit:1e3}).then(({hits:K})=>{K=[...new Map(K.map(W=>[W.body,W])).values()].map(W=>({value:W.body.match(/[^>]*$/)[0].trim(),refinement:W.body.match(/[^>]*$/)[0].trim()})).filter(W=>W.value),ie(K)})}},[S.year,S.make,S.model,k]);const _a=_.useCallback(({hits:T,attribute:O,stateCallback:K})=>{let W=[...new Map(T.map(le=>[le[O],le])).values()].map(le=>({value:le[O].match(/[^|]*$/)[0].trim(),refinement:le[O].match(/[^|]*$/)[0].trim()})).filter(le=>le.refinement);K(W)},[]),kP=_.useCallback(()=>{const T=Uu.current?Uu.current.length+3:3,O=w?T+1:T;return`vs:lg:grid-cols-${O>8?8:O}`},[w]);_.useEffect(()=>{const T=k?S.make&&S.model:S.make&&S.model&&S.year;if(H.current&&T){let O=[`make:${S.make.refinement}`,`model:${S.make.refinement} > ${S.model.refinement}`,S.body?`body:${S.make.refinement} > ${S.model.refinement} > ${S.body.refinement}`:"",S.series?`series:${S.series.refinement}`:"",S.variant?`variant:${S.variant.refinement}`:"",S.engine?`engine:${S.engine.refinement}`:"",S.engine_capacity?`engine_capacity:${S.engine_capacity.refinement}`:""].filter(W=>W);const K=S.year?[`year_from <= ${S.year.value}`,`year_to >= ${S.year.value}`]:[];H.current.search("",{filter:zu(O,K),attributesToRetrieve:["series","engine_capacity","engine","cylinders","variant","otto_id"],limit:1e3}).then(({hits:W})=>{_a({hits:W,attribute:"series",stateCallback:_e}),_a({hits:W,attribute:"variant",stateCallback:Tt}),_a({hits:W,attribute:"engine",stateCallback:Di}),_a({hits:W,attribute:"engine_capacity",stateCallback:Ni})})}},[S.body,S.series,S.variant,S.engine,S.engine_capacity,_a,S.make,S.model,S.year,k]);const[Bu,op]=_.useState(!1);return _.useEffect(()=>{if(d)return Bu?document.body.style.overflow="hidden":document.body.style.overflow="",()=>{document.body.style.overflow=""}},[Bu,d]),A.jsxs(A.Fragment,{children:[d&&A.jsx("button",{onClick:()=>op(!0),type:"button",className:Hr("vehicle-search-btn vs:md:hidden!",f?"vs:w-full! vs:flex! vs:shrink-0!":"vs:w-auto! vs:inline-flex! vs:shrink!"),children:A.jsx("span",{children:$})}),d&&A.jsx("div",{onClick:()=>op(!1),className:Hr("vs:z-10 vs:fixed vs:inset-0 vs:bg-stone-900 vs:transition-all vs:duration-300",Bu?"vs:opacity-75":"vs:pointer-events-none vs:opacity-0")}),A.jsxs("div",{className:Hr("partbot-mmyvs-container",d&&Bu&&"active","w-full"),children:[d&&A.jsxs("div",{className:"vs:flex vs:justify-between vs:items-center vs:pb-4 vs:font-bold vs:text-white vs:md:hidden",children:[A.jsx("span",{children:"Select Vehicle"}),A.jsxs("button",{onClick:()=>op(!1),type:"button",className:"vs:appearance-none vs:bg-transparent vs:border-none vs:ring-none vs:outline-none vs:hover:border-none vs:hover:ring-none vs:hover:outline-none",children:[A.jsx("span",{className:"vs:sr-only",children:"Close vehicle selection"}),A.jsx("span",{className:"vs:h-5 vs:w-5 vs:text-white",children:A.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"currentColor",viewBox:"0 0 256 256",className:"vs:h-5 vs:w-5",children:A.jsx("path",{d:"M208.49,191.51a12,12,0,0,1-17,17L128,145,64.49,208.49a12,12,0,0,1-17-17L111,128,47.51,64.49a12,12,0,0,1,17-17L128,111l63.51-63.52a12,12,0,0,1,17,17L145,128Z"})})})]})]}),A.jsxs("div",{ref:C,className:Hr("vs:grid vs:gap-3",o==="row"?`${kP()} vs:grid-cols-1 vs:md:grid-cols-3`:"vs:grid-cols-1 vs:md:max-w-[400px] vs:md:gap-5","vs:w-full vs:transition vs:lg:mx-auto"),children:[R?A.jsxs(A.Fragment,{children:[A.jsx(En,{label:"Year",items:ae,refine:O1,selected:S.year,bgDark:pn,showLabel:c,isMobile:Mn,sortOptions:!1,loading:ae.length===0,shouldBeActive:!0}),A.jsx(En,{label:"Make",items:L,refine:P1,selected:S.make,showPopular:!0,bgDark:pn,showLabel:c,isMobile:Mn,sortOptions:!1,loading:S.year&&L.length===0,shouldBeActive:!!S.year}),A.jsx(En,{label:"Model",items:oe,refine:M1,selected:S.model,showPopular:!0,bgDark:pn,showLabel:c,isMobile:Mn,sortOptions:!1,loading:S.make&&oe.length===0,shouldBeActive:!!S.make})]}):A.jsxs(A.Fragment,{children:[A.jsx(En,{label:"Make",items:L,refine:P1,selected:S.make,showPopular:!0,bgDark:pn,showLabel:c,isMobile:Mn,sortOptions:!1,loading:L.length===0,shouldBeActive:!0}),A.jsx(En,{label:"Model",items:oe,refine:M1,selected:S.model,showPopular:!0,bgDark:pn,showLabel:c,isMobile:Mn,sortOptions:!1,loading:S.make&&oe.length===0,shouldBeActive:!!S.make}),A.jsx(En,{label:"Year",items:ae,refine:O1,selected:S.year,bgDark:pn,showLabel:c,isMobile:Mn,sortOptions:!1,loading:S.model&&ae.length===0,shouldBeActive:!!S.model})]}),Uu.current&&Uu.current.map(T=>{let O=null;switch(T){case"body":O=A.jsx(En,{label:"Body",items:be,refine:mP,selected:S.body,bgDark:pn,showLabel:c,isMobile:Mn,loading:!!(S.make&&S.model&&S.year)&&be.length===0,shouldBeActive:!!(S.make&&S.model&&S.year)},"body");break;case"series":O=A.jsx(En,{label:"Series",items:Me,refine:yP,selected:S.series,bgDark:pn,showLabel:c,isMobile:Mn,loading:!!(S.make&&S.model&&S.year)&&Me.length===0,shouldBeActive:!!(S.make&&S.model&&S.year)},"series");break;case"variant":O=A.jsx(En,{label:"Variant",items:hn,refine:_P,selected:S.variant,bgDark:pn,showLabel:c,isMobile:Mn,loading:!!(S.make&&S.model&&S.year)&&hn.length===0,shouldBeActive:!!(S.make&&S.model&&S.year)},"variant");break;case"engine_capacity":O=A.jsx(En,{label:"Engine Capacity",items:Ns,refine:bP,selected:S.engine_capacity,bgDark:pn,showLabel:c,isMobile:Mn,loading:!!(S.make&&S.model&&S.year)&&Ns.length===0,shouldBeActive:!!(S.make&&S.model&&S.year)},"engine_capacity");break;case"engine":O=A.jsx(En,{label:"Engine",items:Be,refine:wP,selected:S.engine,bgDark:pn,showLabel:c,isMobile:Mn,loading:!!(S.make&&S.model&&S.year)&&Be.length===0,shouldBeActive:!!(S.make&&S.model&&S.year)},"engine");break}return O}),w&&A.jsx("div",{className:"vs:flex vs:h-full vs:flex-col vs:justify-end vs:md:col-span-3 vs:lg:col-span-1",children:A.jsxs("button",{className:"vehicle-search-btn",onClick:()=>{ip(!0),s&&!m?window.location.href=s+window.location.search:gP()},children:[A.jsx("span",{children:v}),cP&&A.jsx(Bf,{className:"vs:w-[calc(var(--partbot-font-size)*0.9)]! vs:h-[calc(var(--partbot-font-size)*0.9)]! vs:animate-spin"})]})})]}),u&&A.jsx("div",{className:Hr("vs:flex vs:w-full vs:justify-center vs:items-center",o==="row"?"vs:md:items-end vs:md:justify-end":"vs:md:justify-center","vs:mt-4 vs:md:mt-3 vs:md:pr-1.5"),children:A.jsxs("a",{href:`https://use.partbot.io/?ref=${typeof window<"u"?window.location.href.split("/")[2]:"unknown"}&utm_source=vehicle-select&utm_medium=referral&utm_campaign=powered-by`,target:"_blank",rel:"noreferrer",className:`${pn?"vs:text-white":"vs:text-black"} vs:flex vs:items-center vs:space-x-1.5 vs:px-1.5 vs:text-center vs:leading-normal vs:text-[10px] vs:opacity-75 vs:transition vs:hover:opacity-100 vs:font-sans vs:no-underline vs:m-0 pb-1.5`,children:[A.jsx("span",{children:"Powered by"}),A.jsx(pk,{className:"vs:inline-flex vs:h-[13px]"})]})})]})]})}let k1=!1,ma=!1;function oP(t){var c,f;const e=t.shadowRoot;if(!e){console.error("[ShadowDOMPatch] No shadow root found");return}const n=e.children[1];if(!n){console.error("[ShadowDOMPatch] No mount point found in shadow root");return}if(new MutationObserver(d=>{d.forEach(h=>{h.addedNodes.forEach(p=>{p.nodeType===1&&p.id==="headlessui-portal-root"&&(n.appendChild(p),ma=!0)})}),d.forEach(h=>{h.removedNodes.forEach(p=>{p.nodeType===1&&p.id==="headlessui-portal-root"&&(n.querySelector("#headlessui-portal-root")||(ma=!1))})})}).observe(document.body,{childList:!0}),new MutationObserver(d=>{d.forEach(h=>{h.removedNodes.forEach(p=>{p.nodeType===1&&p.id==="headlessui-portal-root"&&(ma=!1)})})}).observe(n,{childList:!0,subtree:!0}),k1)return;const s=(c=Object.getOwnPropertyDescriptor(Document.prototype,"activeElement"))==null?void 0:c.get;Object.defineProperty(Document.prototype,"activeElement",{get:function(){const d=s==null?void 0:s.call(this);return d===t?e.activeElement:d}});const o=(f=Object.getOwnPropertyDescriptor(Event.prototype,"target"))==null?void 0:f.get;Object.defineProperty(Event.prototype,"target",{get:function(){const d=o==null?void 0:o.call(this);return d===t?this.composedPath()[0]:d}});const a=d=>{try{return document.body&&d===document.body.style}catch{return!1}},l=CSSStyleDeclaration.prototype.setProperty;CSSStyleDeclaration.prototype.setProperty=function(d,h,p){if(!(a(this)&&d==="overflow"&&h==="hidden"&&ma))return l.call(this,d,h,p)};const u=Object.getOwnPropertyDescriptor(CSSStyleDeclaration.prototype,"overflow");u&&Object.defineProperty(CSSStyleDeclaration.prototype,"overflow",{get:function(){return u.get.call(this)},set:function(d){if(!(a(this)&&d==="hidden"&&ma))return u.set.call(this,d)}}),k1=!0}const aP="/css/vehicle-search.css";class lP extends HTMLElement{connectedCallback(){if(!document.getElementById("vehicle-search-inter-font")){const F=document.createElement("link");F.id="vehicle-search-inter-font",F.rel="stylesheet",F.href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;700&display=swap",document.head.appendChild(F)}let e=document.createElement("style");e.textContent=dk;const n=document.createElement("div"),r=this.attachShadow({mode:"open"}),i=(F,N,G)=>{let Y;if(this.hasAttribute(N)){const H=this.getAttribute(N);if(/^#[0-9A-F]{6}$/i.test(H)){const te=parseInt(H.slice(1,3),16),ee=parseInt(H.slice(3,5),16),R=parseInt(H.slice(5,7),16);Y=`${te} ${ee} ${R}`}}return Y=Y||G,`:host { --${F}: ${Y}; } .partbot-mmyvs-container { --${F}: ${Y}; }`};let s=i("partbot-theme","data-button-color","0 0 0"),o=i("partbot-button-color","data-button-color","0 0 0"),a=i("partbot-button-hover-color","data-button-hover-color","0 0 0"),l=i("partbot-button-label-color","data-button-label-color","255 255 255"),u=i("partbot-button-hover-label-color","data-button-hover-label-color","255 255 255"),c=i("partbot-mobile-background-color","data-mobile-background-color","0 0 0"),f=`:host { --partbot-button-border-radius: ${this.getAttribute("data-button-border-radius")||"0.375rem"}; } .partbot-mmyvs-container { --partbot-button-border-radius: ${this.getAttribute("data-button-border-radius")||"0.375rem"}; }`,d=`:host { --partbot-font-size: ${this.getAttribute("data-font-size")||"0.875rem"}; } .partbot-mmyvs-container { --partbot-font-size: ${this.getAttribute("data-font-size")||"0.875rem"}; }`,h=`:host { --partbot-font-family: ${(this.getAttribute("data-font-family")||this.getAttribute("data-font"))&&(this.getAttribute("data-font-family")||this.getAttribute("data-font")).trim()!==""?this.getAttribute("data-font-family")||this.getAttribute("data-font"):'"Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif'}; } .partbot-mmyvs-container { --partbot-font-family: ${(this.getAttribute("data-font-family")||this.getAttribute("data-font"))&&(this.getAttribute("data-font-family")||this.getAttribute("data-font")).trim()!==""?this.getAttribute("data-font-family")||this.getAttribute("data-font"):'"Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif'}; }`,p=`:host { --partbot-padding: ${this.getAttribute("data-padding")||"0.5rem"}; } .partbot-mmyvs-container { --partbot-padding: ${this.getAttribute("data-padding")||"0.5rem"}; }`;const v=this.getAttribute("data-input-shadow"),w=v==="none"?"none":v||"0 1px 2px 0 rgb(0 0 0 / 0.05)";let m=`:host { --partbot-input-shadow: ${w}; } .partbot-mmyvs-container { --partbot-input-shadow: ${w}; }`;const g=this.getAttribute("data-input-border-color");let y="229 231 235";if(g)if(/^#[0-9A-F]{6}$/i.test(g)){const F=parseInt(g.slice(1,3),16),N=parseInt(g.slice(3,5),16),G=parseInt(g.slice(5,7),16);y=`${F} ${N} ${G}`}else/^\d+\s+\d+\s+\d+$/.test(g)&&(y=g);let b=`:host { --partbot-input-border-color: ${y}; } .partbot-mmyvs-container { --partbot-input-border-color: ${y}; }`;const x=this.getAttribute("data-input-border-width")||"1px";let k=`:host { --partbot-input-border-width: ${x}; } .partbot-mmyvs-container { --partbot-input-border-width: ${x}; }`;e.textContent+=s,e.textContent+=o,e.textContent+=a,e.textContent+=l,e.textContent+=u,e.textContent+=c,e.textContent+=f,e.textContent+=d,e.textContent+=h,e.textContent+=p,e.textContent+=m,e.textContent+=b,e.textContent+=k,r.appendChild(e),r.appendChild(n);const $=this.getAttribute("data-api-key");if(!$){console.warn("Missing attributes: "+($?"":"data-api-key "));return}const C=this.attributes,q={};for(let F=0;F<C.length;F++){const{name:N,value:G}=C[F];if(N.startsWith("data-")){const Y=N.slice(5).replace(/-([a-z])/g,H=>H[1].toUpperCase());q[Y]=G==="true"?!0:G==="false"?!1:G}}oP(this);const I=A.jsx(rp,{...q});ck.render(I,n)}}customElements.define("vehicle-search",lP);const uP=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"}));Pt.VehicleSearch=rp,Pt.default=rp,Pt.vehicleSearchCssUrl=aP,Object.defineProperties(Pt,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
61
+ `)).length,i=0;i<r;i++){var o=t.charCodeAt(i),a=null;o<128?n++:a=o>127&&o<2048?String.fromCharCode(o>>6|192,63&o|128):String.fromCharCode(o>>12|224,o>>6&63|128,63&o|128),dr(a)||(n>e&&(s+=t.substring(e,n)),s+=a,e=n=i+1)}return n>e&&(s+=t.substring(e,t.length)),s},yT=!!Kf||!!Gf,Pw="text/plain",Ou=(t,e)=>{var[n,r]=t.split("?"),i=j({},e);r==null||r.split("&").forEach(o=>{var[a]=o.split("=");delete i[a]});var s=wR(i);return n+"?"+(s=s?(r?r+"&":"")+s:r)},aa=(t,e)=>JSON.stringify(t,(n,r)=>typeof r=="bigint"?r.toString():r,e),Lh=t=>{var{data:e,compression:n}=t;if(e){if(n===hr.GZipJS){var r=gw(mw(aa(e)),{mtime:0}),i=new Blob([r],{type:Pw});return{contentType:Pw,body:i,estimatedSize:i.size}}if(n===hr.Base64){var s=function(l){var u,c,f,d,h,p="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",v=0,w=0,m="",g=[];if(!l)return l;l=mT(l);do u=(h=l.charCodeAt(v++)<<16|l.charCodeAt(v++)<<8|l.charCodeAt(v++))>>18&63,c=h>>12&63,f=h>>6&63,d=63&h,g[w++]=p.charAt(u)+p.charAt(c)+p.charAt(f)+p.charAt(d);while(v<l.length);switch(m=g.join(""),l.length%3){case 1:m=m.slice(0,-2)+"==";break;case 2:m=m.slice(0,-1)+"="}return m}(aa(e)),o=(l=>"data="+encodeURIComponent(typeof l=="string"?l:aa(l)))(s);return{contentType:"application/x-www-form-urlencoded",body:o,estimatedSize:new Blob([o]).size}}var a=aa(e);return{contentType:"application/json",body:a,estimatedSize:new Blob([a]).size}}},Au=[];Gf&&Au.push({transport:"fetch",method:t=>{var e,n,{contentType:r,body:i,estimatedSize:s}=(e=Lh(t))!==null&&e!==void 0?e:{},o=new Headers;Se(t.headers,function(c,f){o.append(f,c)}),r&&o.append("Content-Type",r);var a=t.url,l=null;if(i_){var u=new i_;l={signal:u.signal,timeout:setTimeout(()=>u.abort(),t.timeout)}}Gf(a,j({method:(t==null?void 0:t.method)||"GET",headers:o,keepalive:t.method==="POST"&&(s||0)<52428.8,body:i,signal:(n=l)==null?void 0:n.signal},t.fetchOptions)).then(c=>c.text().then(f=>{var d={statusCode:c.status,text:f};if(c.status===200)try{d.json=JSON.parse(f)}catch(h){U.error(h)}t.callback==null||t.callback(d)})).catch(c=>{U.error(c),t.callback==null||t.callback({statusCode:0,text:c})}).finally(()=>l?clearTimeout(l.timeout):null)}}),Kf&&Au.push({transport:"XHR",method:t=>{var e,n=new Kf;n.open(t.method||"GET",t.url,!0);var{contentType:r,body:i}=(e=Lh(t))!==null&&e!==void 0?e:{};Se(t.headers,function(s,o){n.setRequestHeader(o,s)}),r&&n.setRequestHeader("Content-Type",r),t.timeout&&(n.timeout=t.timeout),t.disableXHRCredentials||(n.withCredentials=!0),n.onreadystatechange=()=>{if(n.readyState===4){var s={statusCode:n.status,text:n.responseText};if(n.status===200)try{s.json=JSON.parse(n.responseText)}catch{}t.callback==null||t.callback(s)}},n.send(i)}}),Xt!=null&&Xt.sendBeacon&&Au.push({transport:"sendBeacon",method:t=>{var e=Ou(t.url,{beacon:"1"});try{var n,{contentType:r,body:i}=(n=Lh(t))!==null&&n!==void 0?n:{},s=typeof i=="string"?new Blob([i],{type:r}):i;Xt.sendBeacon(e,s)}catch{}}});var Ms=function(t,e){if(!function(n){try{new RegExp(n)}catch{return!1}return!0}(e))return!1;try{return new RegExp(e).test(t)}catch{return!1}};function Mw(t,e,n){return aa({distinct_id:t,userPropertiesToSet:e,userPropertiesToSetOnce:n})}var Ow={exact:(t,e)=>e.some(n=>t.some(r=>n===r)),is_not:(t,e)=>e.every(n=>t.every(r=>n!==r)),regex:(t,e)=>e.some(n=>t.some(r=>Ms(n,r))),not_regex:(t,e)=>e.every(n=>t.every(r=>!Ms(n,r))),icontains:(t,e)=>e.map(Iu).some(n=>t.map(Iu).some(r=>n.includes(r))),not_icontains:(t,e)=>e.map(Iu).every(n=>t.map(Iu).every(r=>!n.includes(r)))},Iu=t=>t.toLowerCase(),Aw=Je("[Error tracking]");class _T{constructor(e){var n,r;this.ge=[],this._e=new Y3([new Q3,new sR,new Z3,new X3,new rR,new nR,new eR,new iR],[q3,G3]),this._instance=e,this.ge=(n=(r=this._instance.persistence)==null?void 0:r.get_property(rh))!==null&&n!==void 0?n:[]}onRemoteConfig(e){var n,r,i,s=(n=(r=e.errorTracking)==null?void 0:r.suppressionRules)!==null&&n!==void 0?n:[],o=(i=e.errorTracking)==null?void 0:i.captureExtensionExceptions;this.ge=s,this._instance.persistence&&this._instance.persistence.register({[rh]:this.ge,[S_]:o})}get me(){var e,n=!!this._instance.get_property(S_),r=this._instance.config.error_tracking.captureExtensionExceptions;return(e=r??n)!==null&&e!==void 0&&e}buildProperties(e,n){return this._e.buildFromUnknown(e,{syntheticException:n==null?void 0:n.syntheticException,mechanism:{handled:n==null?void 0:n.handled}})}sendExceptionEvent(e){if(this.ye(e))Aw.info("Skipping exception capture because a suppression rule matched");else{if(this.me||!this.be(e))return this._instance.capture("$exception",e,{_noTruncate:!0,_batchKey:"exceptionEvent"});Aw.info("Skipping exception capture because it was thrown by an extension")}}ye(e){var n=e.$exception_list;if(!n||!Ce(n)||n.length===0)return!1;var r=n.reduce((i,s)=>{var{type:o,value:a}=s;return Ue(o)&&o.length>0&&i.$exception_types.push(o),Ue(a)&&a.length>0&&i.$exception_values.push(a),i},{$exception_types:[],$exception_values:[]});return this.ge.some(i=>{var s=i.values.map(o=>{var a,l=Ow[o.operator],u=Ce(o.value)?o.value:[o.value],c=(a=r[o.key])!==null&&a!==void 0?a:[];return u.length>0&&l(u,c)});return i.type==="OR"?s.some(Boolean):s.every(Boolean)})}be(e){var n=e.$exception_list;return!(!n||!Ce(n))&&n.flatMap(r=>{var i,s;return(i=(s=r.stacktrace)==null?void 0:s.frames)!==null&&i!==void 0?i:[]}).some(r=>r.filename&&r.filename.startsWith("chrome-extension://"))}}var fn="Mobile",Fu="iOS",Kn="Android",la="Tablet",Iw=Kn+" "+la,Fw="iPad",Lw="Apple",Dw=Lw+" Watch",ua="Safari",Os="BlackBerry",Nw="Samsung",jw=Nw+"Browser",zw=Nw+" Internet",Ii="Chrome",wT=Ii+" OS",Hw=Ii+" "+Fu,Dh="Internet Explorer",Uw=Dh+" "+fn,Nh="Opera",bT=Nh+" Mini",jh="Edge",Bw="Microsoft "+jh,As="Firefox",qw=As+" "+Fu,ca="Nintendo",da="PlayStation",Is="Xbox",Vw=Kn+" "+fn,Ww=fn+" "+ua,fa="Windows",zh=fa+" Phone",Gw="Nokia",Hh="Ouya",Kw="Generic",xT=Kw+" "+fn.toLowerCase(),Yw=Kw+" "+la.toLowerCase(),Uh="Konqueror",Rt="(\\d+(\\.\\d+)?)",Bh=new RegExp("Version/"+Rt),kT=new RegExp(Is,"i"),ST=new RegExp(da+" \\w+","i"),ET=new RegExp(ca+" \\w+","i"),qh=new RegExp(Os+"|PlayBook|BB10","i"),$T={"NT3.51":"NT 3.11","NT4.0":"NT 4.0","5.0":"2000",5.1:"XP",5.2:"XP","6.0":"Vista",6.1:"7",6.2:"8",6.3:"8.1",6.4:"10","10.0":"10"},CT=(t,e)=>e&&ue(e,Lw)||function(n){return ue(n,ua)&&!ue(n,Ii)&&!ue(n,Kn)}(t),Qw=function(t,e){return e=e||"",ue(t," OPR/")&&ue(t,"Mini")?bT:ue(t," OPR/")?Nh:qh.test(t)?Os:ue(t,"IE"+fn)||ue(t,"WPDesktop")?Uw:ue(t,jw)?zw:ue(t,jh)||ue(t,"Edg/")?Bw:ue(t,"FBIOS")?"Facebook "+fn:ue(t,"UCWEB")||ue(t,"UCBrowser")?"UC Browser":ue(t,"CriOS")?Hw:ue(t,"CrMo")||ue(t,Ii)?Ii:ue(t,Kn)&&ue(t,ua)?Vw:ue(t,"FxiOS")?qw:ue(t.toLowerCase(),Uh.toLowerCase())?Uh:CT(t,e)?ue(t,fn)?Ww:ua:ue(t,As)?As:ue(t,"MSIE")||ue(t,"Trident/")?Dh:ue(t,"Gecko")?As:""},RT={[Uw]:[new RegExp("rv:"+Rt)],[Bw]:[new RegExp(jh+"?\\/"+Rt)],[Ii]:[new RegExp("("+Ii+"|CrMo)\\/"+Rt)],[Hw]:[new RegExp("CriOS\\/"+Rt)],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/"+Rt)],[ua]:[Bh],[Ww]:[Bh],[Nh]:[new RegExp("(Opera|OPR)\\/"+Rt)],[As]:[new RegExp(As+"\\/"+Rt)],[qw]:[new RegExp("FxiOS\\/"+Rt)],[Uh]:[new RegExp("Konqueror[:/]?"+Rt,"i")],[Os]:[new RegExp(Os+" "+Rt),Bh],[Vw]:[new RegExp("android\\s"+Rt,"i")],[zw]:[new RegExp(jw+"\\/"+Rt)],[Dh]:[new RegExp("(rv:|MSIE )"+Rt)],Mozilla:[new RegExp("rv:"+Rt)]},TT=function(t,e){var n=Qw(t,e),r=RT[n];if(D(r))return null;for(var i=0;i<r.length;i++){var s=r[i],o=t.match(s);if(o)return parseFloat(o[o.length-2])}return null},Xw=[[new RegExp(Is+"; "+Is+" (.*?)[);]","i"),t=>[Is,t&&t[1]||""]],[new RegExp(ca,"i"),[ca,""]],[new RegExp(da,"i"),[da,""]],[qh,[Os,""]],[new RegExp(fa,"i"),(t,e)=>{if(/Phone/.test(e)||/WPDesktop/.test(e))return[zh,""];if(new RegExp(fn).test(e)&&!/IEMobile\b/.test(e))return[fa+" "+fn,""];var n=/Windows NT ([0-9.]+)/i.exec(e);if(n&&n[1]){var r=n[1],i=$T[r]||"";return/arm/i.test(e)&&(i="RT"),[fa,i]}return[fa,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,t=>{if(t&&t[3]){var e=[t[3],t[4],t[5]||"0"];return[Fu,e.join(".")]}return[Fu,""]}],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,t=>{var e="";return t&&t.length>=3&&(e=D(t[2])?t[3]:t[2]),["watchOS",e]}],[new RegExp("("+Kn+" (\\d+)\\.(\\d+)\\.?(\\d+)?|"+Kn+")","i"),t=>{if(t&&t[2]){var e=[t[2],t[3],t[4]||"0"];return[Kn,e.join(".")]}return[Kn,""]}],[/Mac OS X (\d+)[_.](\d+)[_.]?(\d+)?/i,t=>{var e=["Mac OS X",""];if(t&&t[1]){var n=[t[1],t[2],t[3]||"0"];e[1]=n.join(".")}return e}],[/Mac/i,["Mac OS X",""]],[/CrOS/,[wT,""]],[/Linux|debian/i,["Linux",""]]],Zw=function(t){return ET.test(t)?ca:ST.test(t)?da:kT.test(t)?Is:new RegExp(Hh,"i").test(t)?Hh:new RegExp("("+zh+"|WPDesktop)","i").test(t)?zh:/iPad/.test(t)?Fw:/iPod/.test(t)?"iPod Touch":/iPhone/.test(t)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(t)?Dw:qh.test(t)?Os:/(kobo)\s(ereader|touch)/i.test(t)?"Kobo":new RegExp(Gw,"i").test(t)?Gw:/(kf[a-z]{2}wi|aeo[c-r]{2})( bui|\))/i.test(t)||/(kf[a-z]+)( bui|\)).+silk\//i.test(t)?"Kindle Fire":/(Android|ZTE)/i.test(t)?!new RegExp(fn).test(t)||/(9138B|TB782B|Nexus [97]|pixel c|HUAWEISHT|BTV|noble nook|smart ultra 6)/i.test(t)?/pixel[\daxl ]{1,6}/i.test(t)&&!/pixel c/i.test(t)||/(huaweimed-al00|tah-|APA|SM-G92|i980|zte|U304AA)/i.test(t)||/lmy47v/i.test(t)&&!/QTAQZ3/i.test(t)?Kn:Iw:Kn:new RegExp("(pda|"+fn+")","i").test(t)?xT:new RegExp(la,"i").test(t)&&!new RegExp(la+" pc","i").test(t)?Yw:""},Lu="https?://(.*)",Du=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],PT=cu(["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid"],Du),Vh="<masked>",MT=["li_fat_id"];function Jw(t,e,n){if(!B)return{};var r,i=e?cu([],Du,n||[]):[],s=e1(_h(B.URL,i,Vh),t),o=(r={},Se(MT,function(a){var l=qn.J(a);r[a]=l||null}),r);return Ve(o,s)}function e1(t,e){var n=PT.concat(e||[]),r={};return Se(n,function(i){var s=wu(t,i);r[i]=s||null}),r}function t1(t){var e=function(s){return s?s.search(Lu+"google.([^/?]*)")===0?"google":s.search(Lu+"bing.com")===0?"bing":s.search(Lu+"yahoo.com")===0?"yahoo":s.search(Lu+"duckduckgo.com")===0?"duckduckgo":null:null}(t),n=e!="yahoo"?"q":"p",r={};if(!dr(e)){r.$search_engine=e;var i=B?wu(B.referrer,n):"";i.length&&(r.ph_keyword=i)}return r}function n1(){return navigator.language||navigator.userLanguage}function r1(){return(B==null?void 0:B.referrer)||"$direct"}function i1(t,e){var n=t?cu([],Du,e||[]):[],r=Dt==null?void 0:Dt.href.substring(0,1e3);return{r:r1().substring(0,1e3),u:r?_h(r,n,Vh):void 0}}function s1(t){var e,{r:n,u:r}=t,i={$referrer:n,$referring_domain:n==null?void 0:n=="$direct"?"$direct":(e=Ts(n))==null?void 0:e.host};if(r){i.$current_url=r;var s=Ts(r);i.$host=s==null?void 0:s.host,i.$pathname=s==null?void 0:s.pathname;var o=e1(r);Ve(i,o)}if(n){var a=t1(n);Ve(i,a)}return i}function o1(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch{return}}function OT(){try{return new Date().getTimezoneOffset()}catch{return}}function AT(t,e){if(!Nt)return{};var n,r,i,s=t?cu([],Du,e||[]):[],[o,a]=function(l){for(var u=0;u<Xw.length;u++){var[c,f]=Xw[u],d=c.exec(l),h=d&&(cn(f)?f(d,l):f);if(h)return h}return["",""]}(Nt);return Ve(th({$os:o,$os_version:a,$browser:Qw(Nt,navigator.vendor),$device:Zw(Nt),$device_type:(r=Nt,i=Zw(r),i===Fw||i===Iw||i==="Kobo"||i==="Kindle Fire"||i===Yw?la:i===ca||i===Is||i===da||i===Hh?"Console":i===Dw?"Wearable":i?fn:"Desktop"),$timezone:o1(),$timezone_offset:OT()}),{$current_url:_h(Dt==null?void 0:Dt.href,s,Vh),$host:Dt==null?void 0:Dt.host,$pathname:Dt==null?void 0:Dt.pathname,$raw_user_agent:Nt.length>1e3?Nt.substring(0,997)+"...":Nt,$browser_version:TT(Nt,navigator.vendor),$browser_language:n1(),$browser_language_prefix:(n=n1(),typeof n=="string"?n.split("-")[0]:void 0),$screen_height:E==null?void 0:E.screen.height,$screen_width:E==null?void 0:E.screen.width,$viewport_height:E==null?void 0:E.innerHeight,$viewport_width:E==null?void 0:E.innerWidth,$lib:"web",$lib_version:cr.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3})}var Pn=Je("[FeatureFlags]"),Wh="$active_feature_flags",Fs="$override_feature_flags",a1="$feature_flag_payloads",ha="$override_feature_flag_payloads",l1="$feature_flag_request_id",u1=t=>{var e={};for(var[n,r]of du(t||{}))r&&(e[n]=r);return e},IT=t=>{var e=t.flags;return e?(t.featureFlags=Object.fromEntries(Object.keys(e).map(n=>{var r;return[n,(r=e[n].variant)!==null&&r!==void 0?r:e[n].enabled]})),t.featureFlagPayloads=Object.fromEntries(Object.keys(e).filter(n=>e[n].enabled).filter(n=>{var r;return(r=e[n].metadata)==null?void 0:r.payload}).map(n=>{var r;return[n,(r=e[n].metadata)==null?void 0:r.payload]}))):Pn.warn("Using an older version of the feature flags endpoint. Please upgrade your PostHog server to the latest version"),t},FT=function(t){return t.FeatureFlags="feature_flags",t.Recordings="recordings",t}({});class LT{constructor(e){this.we=!1,this.Se=!1,this.ke=!1,this.$e=!1,this.xe=!1,this.Ee=!1,this.Re=!1,this._instance=e,this.featureFlagEventHandlers=[]}Ie(){var e=this._instance.config.evaluation_environments;return e!=null&&e.length?e.filter(n=>{var r=n&&typeof n=="string"&&n.trim().length>0;return r||Pn.error("Invalid evaluation environment found:",n,"Expected non-empty string"),r}):[]}Pe(){return this.Ie().length>0}flags(){if(this._instance.config.__preview_remote_config)this.Ee=!0;else{var e=!this.Te&&(this._instance.config.advanced_disable_feature_flags||this._instance.config.advanced_disable_feature_flags_on_first_load);this.Ce({disableFlags:e})}}get hasLoadedFlags(){return this.Se}getFlags(){return Object.keys(this.getFlagVariants())}getFlagsWithDetails(){var e=this._instance.get_property(lh),n=this._instance.get_property(Fs),r=this._instance.get_property(ha);if(!r&&!n)return e||{};var i=Ve({},e||{}),s=[...new Set([...Object.keys(r||{}),...Object.keys(n||{})])];for(var o of s){var a,l,u=i[o],c=n==null?void 0:n[o],f=D(c)?(a=u==null?void 0:u.enabled)!==null&&a!==void 0&&a:!!c,d=D(c)?u.variant:typeof c=="string"?c:void 0,h=r==null?void 0:r[o],p=j({},u,{enabled:f,variant:f?d??(u==null?void 0:u.variant):void 0});f!==(u==null?void 0:u.enabled)&&(p.original_enabled=u==null?void 0:u.enabled),d!==(u==null?void 0:u.variant)&&(p.original_variant=u==null?void 0:u.variant),h&&(p.metadata=j({},u==null?void 0:u.metadata,{payload:h,original_payload:u==null||(l=u.metadata)==null?void 0:l.payload})),i[o]=p}return this.we||(Pn.warn(" Overriding feature flag details!",{flagDetails:e,overriddenPayloads:r,finalDetails:i}),this.we=!0),i}getFlagVariants(){var e=this._instance.get_property(Cs),n=this._instance.get_property(Fs);if(!n)return e||{};for(var r=Ve({},e),i=Object.keys(n),s=0;s<i.length;s++)r[i[s]]=n[i[s]];return this.we||(Pn.warn(" Overriding feature flags!",{enabledFlags:e,overriddenFlags:n,finalFlags:r}),this.we=!0),r}getFlagPayloads(){var e=this._instance.get_property(a1),n=this._instance.get_property(ha);if(!n)return e||{};for(var r=Ve({},e||{}),i=Object.keys(n),s=0;s<i.length;s++)r[i[s]]=n[i[s]];return this.we||(Pn.warn(" Overriding feature flag payloads!",{flagPayloads:e,overriddenPayloads:n,finalPayloads:r}),this.we=!0),r}reloadFeatureFlags(){this.$e||this._instance.config.advanced_disable_feature_flags||this.Te||(this.Te=setTimeout(()=>{this.Ce()},5))}Me(){clearTimeout(this.Te),this.Te=void 0}ensureFlagsLoaded(){this.Se||this.ke||this.Te||this.reloadFeatureFlags()}setAnonymousDistinctId(e){this.$anon_distinct_id=e}setReloadingPaused(e){this.$e=e}Ce(e){var n;if(this.Me(),!this._instance.L())if(this.ke)this.xe=!0;else{var r={token:this._instance.config.token,distinct_id:this._instance.get_distinct_id(),groups:this._instance.getGroups(),$anon_distinct_id:this.$anon_distinct_id,person_properties:j({},((n=this._instance.persistence)==null?void 0:n.get_initial_props())||{},this._instance.get_property(Jo)||{}),group_properties:this._instance.get_property(Ri)};(e!=null&&e.disableFlags||this._instance.config.advanced_disable_feature_flags)&&(r.disable_flags=!0),this.Pe()&&(r.evaluation_environments=this.Ie());var i=this._instance.config.__preview_remote_config,s=i?"/flags/?v=2":"/flags/?v=2&config=true",o=this._instance.config.advanced_only_evaluate_survey_feature_flags?"&only_evaluate_survey_feature_flags=true":"",a=this._instance.requestRouter.endpointFor("api",s+o);i&&(r.timezone=o1()),this.ke=!0,this._instance.Oe({method:"POST",url:a,data:r,compression:this._instance.config.disable_compression?void 0:hr.Base64,timeout:this._instance.config.feature_flag_request_timeout_ms,callback:l=>{var u,c,f=!0;if(l.statusCode===200&&(this.xe||(this.$anon_distinct_id=void 0),f=!1),this.ke=!1,this.Ee||(this.Ee=!0,this._instance.Fe((c=l.json)!==null&&c!==void 0?c:{})),!r.disable_flags||this.xe)if(this.Re=!f,l.json&&(u=l.json.quotaLimited)!=null&&u.includes(FT.FeatureFlags))Pn.warn("You have hit your feature flags quota limit, and will not be able to load feature flags until the quota is reset. Please visit https://posthog.com/docs/billing/limits-alerts to learn more.");else{var d;r.disable_flags||this.receivedFeatureFlags((d=l.json)!==null&&d!==void 0?d:{},f),this.xe&&(this.xe=!1,this.Ce())}}})}}getFeatureFlag(e,n){if(n===void 0&&(n={}),this.Se||this.getFlags()&&this.getFlags().length>0){var r=this.getFlagVariants()[e],i=""+r,s=this._instance.get_property(l1)||void 0,o=this._instance.get_property(pu)||{};if((n.send_event||!("send_event"in n))&&(!(e in o)||!o[e].includes(i))){var a,l,u,c,f,d,h,p,v;Ce(o[e])?o[e].push(i):o[e]=[i],(a=this._instance.persistence)==null||a.register({[pu]:o});var w=this.getFeatureFlagDetails(e),m={$feature_flag:e,$feature_flag_response:r,$feature_flag_payload:this.getFeatureFlagPayload(e)||null,$feature_flag_request_id:s,$feature_flag_bootstrapped_response:((l=this._instance.config.bootstrap)==null||(l=l.featureFlags)==null?void 0:l[e])||null,$feature_flag_bootstrapped_payload:((u=this._instance.config.bootstrap)==null||(u=u.featureFlagPayloads)==null?void 0:u[e])||null,$used_bootstrap_value:!this.Re};D(w==null||(c=w.metadata)==null?void 0:c.version)||(m.$feature_flag_version=w.metadata.version);var g,y=(f=w==null||(d=w.reason)==null?void 0:d.description)!==null&&f!==void 0?f:w==null||(h=w.reason)==null?void 0:h.code;y&&(m.$feature_flag_reason=y),w!=null&&(p=w.metadata)!=null&&p.id&&(m.$feature_flag_id=w.metadata.id),D(w==null?void 0:w.original_variant)&&D(w==null?void 0:w.original_enabled)||(m.$feature_flag_original_response=D(w.original_variant)?w.original_enabled:w.original_variant),w!=null&&(v=w.metadata)!=null&&v.original_payload&&(m.$feature_flag_original_payload=w==null||(g=w.metadata)==null?void 0:g.original_payload),this._instance.capture("$feature_flag_called",m)}return r}Pn.warn('getFeatureFlag for key "'+e+`" failed. Feature flags didn't load in time.`)}getFeatureFlagDetails(e){return this.getFlagsWithDetails()[e]}getFeatureFlagPayload(e){return this.getFlagPayloads()[e]}getRemoteConfigPayload(e,n){var r=this._instance.config.token,i={distinct_id:this._instance.get_distinct_id(),token:r};this.Pe()&&(i.evaluation_environments=this.Ie()),this._instance.Oe({method:"POST",url:this._instance.requestRouter.endpointFor("api","/flags/?v=2&config=true"),data:i,compression:this._instance.config.disable_compression?void 0:hr.Base64,timeout:this._instance.config.feature_flag_request_timeout_ms,callback:s=>{var o,a=(o=s.json)==null?void 0:o.featureFlagPayloads;n((a==null?void 0:a[e])||void 0)}})}isFeatureEnabled(e,n){if(n===void 0&&(n={}),this.Se||this.getFlags()&&this.getFlags().length>0){var r=this.getFeatureFlag(e,n);return D(r)?void 0:!!r}Pn.warn('isFeatureEnabled for key "'+e+`" failed. Feature flags didn't load in time.`)}addFeatureFlagsHandler(e){this.featureFlagEventHandlers.push(e)}removeFeatureFlagsHandler(e){this.featureFlagEventHandlers=this.featureFlagEventHandlers.filter(n=>n!==e)}receivedFeatureFlags(e,n){if(this._instance.persistence){this.Se=!0;var r=this.getFlagVariants(),i=this.getFlagPayloads(),s=this.getFlagsWithDetails();(function(o,a,l,u,c){l===void 0&&(l={}),u===void 0&&(u={}),c===void 0&&(c={});var f=IT(o),d=f.flags,h=f.featureFlags,p=f.featureFlagPayloads;if(h){var v=o.requestId;if(Ce(h)){Pn.warn("v1 of the feature flags endpoint is deprecated. Please use the latest version.");var w={};if(h)for(var m=0;m<h.length;m++)w[h[m]]=!0;a&&a.register({[Wh]:h,[Cs]:w})}else{var g=h,y=p,b=d;o.errorsWhileComputingFlags&&(g=j({},l,g),y=j({},u,y),b=j({},c,b)),a&&a.register(j({[Wh]:Object.keys(u1(g)),[Cs]:g||{},[a1]:y||{},[lh]:b||{}},v?{[l1]:v}:{}))}}})(e,this._instance.persistence,r,i,s),this.Ae(n)}}override(e,n){n===void 0&&(n=!1),Pn.warn("override is deprecated. Please use overrideFeatureFlags instead."),this.overrideFeatureFlags({flags:e,suppressWarning:n})}overrideFeatureFlags(e){if(!this._instance.__loaded||!this._instance.persistence)return Pn.uninitializedWarning("posthog.featureFlags.overrideFeatureFlags");if(e===!1)return this._instance.persistence.unregister(Fs),this._instance.persistence.unregister(ha),void this.Ae();if(e&&typeof e=="object"&&("flags"in e||"payloads"in e)){var n,r=e;if(this.we=!!((n=r.suppressWarning)!==null&&n!==void 0&&n),"flags"in r){if(r.flags===!1)this._instance.persistence.unregister(Fs);else if(r.flags)if(Ce(r.flags)){for(var i={},s=0;s<r.flags.length;s++)i[r.flags[s]]=!0;this._instance.persistence.register({[Fs]:i})}else this._instance.persistence.register({[Fs]:r.flags})}return"payloads"in r&&(r.payloads===!1?this._instance.persistence.unregister(ha):r.payloads&&this._instance.persistence.register({[ha]:r.payloads})),void this.Ae()}this.Ae()}onFeatureFlags(e){if(this.addFeatureFlagsHandler(e),this.Se){var{flags:n,flagVariants:r}=this.De();e(n,r)}return()=>this.removeFeatureFlagsHandler(e)}updateEarlyAccessFeatureEnrollment(e,n,r){var i,s=(this._instance.get_property(Zo)||[]).find(u=>u.flagKey===e),o={["$feature_enrollment/"+e]:n},a={$feature_flag:e,$feature_enrollment:n,$set:o};s&&(a.$early_access_feature_name=s.name),r&&(a.$feature_enrollment_stage=r),this._instance.capture("$feature_enrollment_update",a),this.setPersonPropertiesForFlags(o,!1);var l=j({},this.getFlagVariants(),{[e]:n});(i=this._instance.persistence)==null||i.register({[Wh]:Object.keys(u1(l)),[Cs]:l}),this.Ae()}getEarlyAccessFeatures(e,n,r){n===void 0&&(n=!1);var i=this._instance.get_property(Zo),s=r?"&"+r.map(o=>"stage="+o).join("&"):"";if(i&&!n)return e(i);this._instance.Oe({url:this._instance.requestRouter.endpointFor("api","/api/early_access_features/?token="+this._instance.config.token+s),method:"GET",callback:o=>{var a,l;if(o.json){var u=o.json.earlyAccessFeatures;return(a=this._instance.persistence)==null||a.unregister(Zo),(l=this._instance.persistence)==null||l.register({[Zo]:u}),e(u)}}})}De(){var e=this.getFlags(),n=this.getFlagVariants();return{flags:e.filter(r=>n[r]),flagVariants:Object.keys(n).filter(r=>n[r]).reduce((r,i)=>(r[i]=n[i],r),{})}}Ae(e){var{flags:n,flagVariants:r}=this.De();this.featureFlagEventHandlers.forEach(i=>i(n,r,{errorsLoading:e}))}setPersonPropertiesForFlags(e,n){n===void 0&&(n=!0);var r=this._instance.get_property(Jo)||{};this._instance.register({[Jo]:j({},r,e)}),n&&this._instance.reloadFeatureFlags()}resetPersonPropertiesForFlags(){this._instance.unregister(Jo)}setGroupPropertiesForFlags(e,n){n===void 0&&(n=!0);var r=this._instance.get_property(Ri)||{};Object.keys(r).length!==0&&Object.keys(r).forEach(i=>{r[i]=j({},r[i],e[i]),delete e[i]}),this._instance.register({[Ri]:j({},r,e)}),n&&this._instance.reloadFeatureFlags()}resetGroupPropertiesForFlags(e){if(e){var n=this._instance.get_property(Ri)||{};this._instance.register({[Ri]:j({},n,{[e]:{}})})}else this._instance.unregister(Ri)}reset(){this.Se=!1,this.ke=!1,this.$e=!1,this.xe=!1,this.Ee=!1,this.Re=!1,this.$anon_distinct_id=void 0,this.Me(),this.we=!1}}var DT=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"];class Gh{constructor(e,n){this.A=e,this.props={},this.je=!1,this.Le=(r=>{var i="";return r.token&&(i=r.token.replace(/\+/g,"PL").replace(/\//g,"SL").replace(/=/g,"EQ")),r.persistence_name?"ph_"+r.persistence_name:"ph_"+i+"_posthog"})(e),this.it=this.Ne(e),this.load(),e.debug&&U.info("Persistence loaded",e.persistence,j({},this.props)),this.update_config(e,e,n),this.save()}isDisabled(){return!!this.Ue}Ne(e){DT.indexOf(e.persistence.toLowerCase())===-1&&(U.critical("Unknown persistence type "+e.persistence+"; falling back to localStorage+cookie"),e.persistence="localStorage+cookie");var n=e.persistence.toLowerCase();return n==="localstorage"&&et.G()?et:n==="localstorage+cookie"&&ku.G()?ku:n==="sessionstorage"&&ut.G()?ut:n==="memory"?MR:n==="cookie"?qn:ku.G()?ku:qn}properties(){var e={};return Se(this.props,function(n,r){if(r===Cs&&He(n))for(var i=Object.keys(n),s=0;s<i.length;s++)e["$feature/"+i[s]]=n[i[s]];else a=r,l=!1,(dr(o=dR)?l:r_&&o.indexOf===r_?o.indexOf(a)!=-1:(Se(o,function(u){if(l||(l=u===a))return uu}),l))||(e[r]=n);var o,a,l}),e}load(){if(!this.Ue){var e=this.it.K(this.Le);e&&(this.props=Ve({},e))}}save(){this.Ue||this.it.Y(this.Le,this.props,this.ze,this.Be,this.qe,this.A.debug)}remove(){this.it.X(this.Le,!1),this.it.X(this.Le,!0)}clear(){this.remove(),this.props={}}register_once(e,n,r){if(He(e)){D(n)&&(n="None"),this.ze=D(r)?this.He:r;var i=!1;if(Se(e,(s,o)=>{this.props.hasOwnProperty(o)&&this.props[o]!==n||(this.props[o]=s,i=!0)}),i)return this.save(),!0}return!1}register(e,n){if(He(e)){this.ze=D(n)?this.He:n;var r=!1;if(Se(e,(i,s)=>{e.hasOwnProperty(s)&&this.props[s]!==i&&(this.props[s]=i,r=!0)}),r)return this.save(),!0}return!1}unregister(e){e in this.props&&(delete this.props[e],this.save())}update_campaign_params(){if(!this.je){var e=Jw(this.A.custom_campaign_params,this.A.mask_personal_data_properties,this.A.custom_personal_data_properties);Ss(th(e))||this.register(e),this.je=!0}}update_search_keyword(){var e;this.register((e=B==null?void 0:B.referrer)?t1(e):{})}update_referrer_info(){var e;this.register_once({$referrer:r1(),$referring_domain:B!=null&&B.referrer&&((e=Ts(B.referrer))==null?void 0:e.host)||"$direct"},void 0)}set_initial_person_info(){this.props[fh]||this.props[hh]||this.register_once({[vu]:i1(this.A.mask_personal_data_properties,this.A.custom_personal_data_properties)},void 0)}get_initial_props(){var e={};Se([hh,fh],o=>{var a=this.props[o];a&&Se(a,function(l,u){e["$initial_"+Yf(u)]=l})});var n,r,i=this.props[vu];if(i){var s=(n=s1(i),r={},Se(n,function(o,a){r["$initial_"+Yf(a)]=o}),r);Ve(e,s)}return e}safe_merge(e){return Se(this.props,function(n,r){r in e||(e[r]=n)}),e}update_config(e,n,r){if(this.He=this.ze=e.cookie_expiration,this.set_disabled(e.disable_persistence||!!r),this.set_cross_subdomain(e.cross_subdomain_cookie),this.set_secure(e.secure_cookie),e.persistence!==n.persistence){var i=this.Ne(e),s=this.props;this.clear(),this.it=i,this.props=s,this.save()}}set_disabled(e){this.Ue=e,this.Ue?this.remove():this.save()}set_cross_subdomain(e){e!==this.Be&&(this.Be=e,this.remove(),this.save())}set_secure(e){e!==this.qe&&(this.qe=e,this.remove(),this.save())}set_event_timer(e,n){var r=this.props[Xo]||{};r[e]=n,this.props[Xo]=r,this.save()}remove_event_timer(e){var n=(this.props[Xo]||{})[e];return D(n)||(delete this.props[Xo][e],this.save()),n}get_property(e){return this.props[e]}set_property(e,n){this.props[e]=n,this.save()}}(function(t){return t.Button="button",t.Tab="tab",t.Selector="selector",t})({}),function(t){return t.TopLeft="top_left",t.TopRight="top_right",t.TopCenter="top_center",t.MiddleLeft="middle_left",t.MiddleRight="middle_right",t.MiddleCenter="middle_center",t.Left="left",t.Center="center",t.Right="right",t.NextToTrigger="next_to_trigger",t}({});var Kh=function(t){return t.Popover="popover",t.API="api",t.Widget="widget",t.ExternalSurvey="external_survey",t}({});(function(t){return t.Open="open",t.MultipleChoice="multiple_choice",t.SingleChoice="single_choice",t.Rating="rating",t.Link="link",t})({}),function(t){return t.NextQuestion="next_question",t.End="end",t.ResponseBased="response_based",t.SpecificQuestion="specific_question",t}({}),function(t){return t.Once="once",t.Recurring="recurring",t.Always="always",t}({});var Nu=function(t){return t.SHOWN="survey shown",t.DISMISSED="survey dismissed",t.SENT="survey sent",t}({}),c1=function(t){return t.SURVEY_ID="$survey_id",t.SURVEY_NAME="$survey_name",t.SURVEY_RESPONSE="$survey_response",t.SURVEY_ITERATION="$survey_iteration",t.SURVEY_ITERATION_START_DATE="$survey_iteration_start_date",t.SURVEY_PARTIALLY_COMPLETED="$survey_partially_completed",t.SURVEY_SUBMISSION_ID="$survey_submission_id",t.SURVEY_QUESTIONS="$survey_questions",t.SURVEY_COMPLETED="$survey_completed",t}({}),d1=function(t){return t.Popover="popover",t.Inline="inline",t}({});class Yh{constructor(){this.We={},this.We={}}on(e,n){return this.We[e]||(this.We[e]=[]),this.We[e].push(n),()=>{this.We[e]=this.We[e].filter(r=>r!==n)}}emit(e,n){for(var r of this.We[e]||[])r(n);for(var i of this.We["*"]||[])i(e,n)}}class Fi{constructor(e){this.Ge=new Yh,this.Ve=(n,r)=>this.Je(n,r)&&this.Ke(n,r)&&this.Ye(n,r),this.Je=(n,r)=>r==null||!r.event||(n==null?void 0:n.event)===(r==null?void 0:r.event),this._instance=e,this.Xe=new Set,this.Qe=new Set}init(){var e;if(!D((e=this._instance)==null?void 0:e.Ze)){var n;(n=this._instance)==null||n.Ze((r,i)=>{this.on(r,i)})}}register(e){var n,r;if(!D((n=this._instance)==null?void 0:n.Ze)&&(e.forEach(o=>{var a,l;(a=this.Qe)==null||a.add(o),(l=o.steps)==null||l.forEach(u=>{var c;(c=this.Xe)==null||c.add((u==null?void 0:u.event)||"")})}),(r=this._instance)!=null&&r.autocapture)){var i,s=new Set;e.forEach(o=>{var a;(a=o.steps)==null||a.forEach(l=>{l!=null&&l.selector&&s.add(l==null?void 0:l.selector)})}),(i=this._instance)==null||i.autocapture.setElementSelectors(s)}}on(e,n){var r;n!=null&&e.length!=0&&(this.Xe.has(e)||this.Xe.has(n==null?void 0:n.event))&&this.Qe&&((r=this.Qe)==null?void 0:r.size)>0&&this.Qe.forEach(i=>{this.tr(n,i)&&this.Ge.emit("actionCaptured",i.name)})}ir(e){this.onAction("actionCaptured",n=>e(n))}tr(e,n){if((n==null?void 0:n.steps)==null)return!1;for(var r of n.steps)if(this.Ve(e,r))return!0;return!1}onAction(e,n){return this.Ge.on(e,n)}Ke(e,n){if(n!=null&&n.url){var r,i=e==null||(r=e.properties)==null?void 0:r.$current_url;if(!i||typeof i!="string"||!Fi.er(i,n==null?void 0:n.url,(n==null?void 0:n.url_matching)||"contains"))return!1}return!0}static er(e,n,r){switch(r){case"regex":return!!E&&Ms(e,n);case"exact":return n===e;case"contains":var i=Fi.rr(n).replace(/_/g,".").replace(/%/g,".*");return Ms(e,i);default:return!1}}static rr(e){return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}Ye(e,n){if((n!=null&&n.href||n!=null&&n.tag_name||n!=null&&n.text)&&!this.sr(e).some(s=>!(n!=null&&n.href&&!Fi.er(s.href||"",n==null?void 0:n.href,(n==null?void 0:n.href_matching)||"exact"))&&(n==null||!n.tag_name||s.tag_name===(n==null?void 0:n.tag_name))&&!(n!=null&&n.text&&!Fi.er(s.text||"",n==null?void 0:n.text,(n==null?void 0:n.text_matching)||"exact")&&!Fi.er(s.$el_text||"",n==null?void 0:n.text,(n==null?void 0:n.text_matching)||"exact"))))return!1;if(n!=null&&n.selector){var r,i=e==null||(r=e.properties)==null?void 0:r.$element_selectors;if(!i||!i.includes(n==null?void 0:n.selector))return!1}return!0}sr(e){return(e==null?void 0:e.properties.$elements)==null?[]:e==null?void 0:e.properties.$elements}}var Ee=Je("[Surveys]"),Qh="seenSurvey_",NT=(t,e)=>{var n="$survey_"+e+"/"+t.id;return t.current_iteration&&t.current_iteration>0&&(n="$survey_"+e+"/"+t.id+"/"+t.current_iteration),n},f1=t=>{var e=""+Qh+t.id;return t.current_iteration&&t.current_iteration>0&&(e=""+Qh+t.id+"_"+t.current_iteration),e},jT=[Kh.Popover,Kh.Widget,Kh.API],zT={ignoreConditions:!1,ignoreDelay:!1,displayType:d1.Popover};class HT{constructor(e){this._instance=e,this.nr=new Map,this.ar=new Map}register(e){var n;D((n=this._instance)==null?void 0:n.Ze)||(this.lr(e),this.ur(e))}ur(e){var n=e.filter(r=>{var i,s;return((i=r.conditions)==null?void 0:i.actions)&&((s=r.conditions)==null||(s=s.actions)==null||(s=s.values)==null?void 0:s.length)>0});n.length!==0&&(this.hr==null&&(this.hr=new Fi(this._instance),this.hr.init(),this.hr.ir(r=>{this.onAction(r)})),n.forEach(r=>{var i,s,o,a,l;r.conditions&&(i=r.conditions)!=null&&i.actions&&(s=r.conditions)!=null&&(s=s.actions)!=null&&s.values&&((o=r.conditions)==null||(o=o.actions)==null||(o=o.values)==null?void 0:o.length)>0&&((a=this.hr)==null||a.register(r.conditions.actions.values),(l=r.conditions)==null||(l=l.actions)==null||(l=l.values)==null||l.forEach(u=>{if(u&&u.name){var c=this.ar.get(u.name);c&&c.push(r.id),this.ar.set(u.name,c||[r.id])}}))}))}lr(e){var n;e.filter(r=>{var i,s;return((i=r.conditions)==null?void 0:i.events)&&((s=r.conditions)==null||(s=s.events)==null||(s=s.values)==null?void 0:s.length)>0}).length!==0&&((n=this._instance)==null||n.Ze((r,i)=>{this.onEvent(r,i)}),e.forEach(r=>{var i;(i=r.conditions)==null||(i=i.events)==null||(i=i.values)==null||i.forEach(s=>{if(s&&s.name){var o=this.nr.get(s.name);o&&o.push(r.id),this.nr.set(s.name,o||[r.id])}})}))}onEvent(e,n){var r,i,s=((r=this._instance)==null||(r=r.persistence)==null?void 0:r.props[hu])||[];if(Nu.SHOWN===e&&n&&s.length>0){var o;Ee.info("survey event matched, removing survey from activated surveys",{event:e,eventPayload:n,existingActivatedSurveys:s});var a=n==null||(o=n.properties)==null?void 0:o.$survey_id;if(a){var l=s.indexOf(a);l>=0&&(s.splice(l,1),this.dr(s))}}else if(this.nr.has(e)){Ee.info("survey event name matched",{event:e,eventPayload:n,surveys:this.nr.get(e)});var u=[];(i=this._instance)==null||i.getSurveys(f=>{u=f.filter(d=>{var h;return(h=this.nr.get(e))==null?void 0:h.includes(d.id)})});var c=u.filter(f=>{var d,h=(d=f.conditions)==null||(d=d.events)==null||(d=d.values)==null?void 0:d.find(p=>p.name===e);return!!h&&(!h.propertyFilters||Object.entries(h.propertyFilters).every(p=>{var v,[w,m]=p,g=n==null||(v=n.properties)==null?void 0:v[w];if(D(g)||dr(g))return!1;var y=[String(g)],b=Ow[m.operator];return b?b(m.values,y):(Ee.warn("Unknown property comparison operator: "+m.operator),!1)}))});this.dr(s.concat(c.map(f=>f.id)||[]))}}onAction(e){var n,r=((n=this._instance)==null||(n=n.persistence)==null?void 0:n.props[hu])||[];this.ar.has(e)&&this.dr(r.concat(this.ar.get(e)||[]))}dr(e){var n;Ee.info("updating activated surveys",{activatedSurveys:e}),(n=this._instance)==null||(n=n.persistence)==null||n.register({[hu]:[...new Set(e)]})}getSurveys(){var e,n=(e=this._instance)==null||(e=e.persistence)==null?void 0:e.props[hu];return n||[]}getEventToSurveys(){return this.nr}vr(){return this.hr}}class UT{constructor(e){this.cr=void 0,this._surveyManager=null,this.pr=!1,this.gr=!1,this._r=[],this._instance=e,this._surveyEventReceiver=null}onRemoteConfig(e){if(!this._instance.config.disable_surveys){var n=e.surveys;if(me(n))return Ee.warn("Flags not loaded yet. Not loading surveys.");var r=Ce(n);this.cr=r?n.length>0:n,Ee.info("flags response received, isSurveysEnabled: "+this.cr),this.loadIfEnabled()}}reset(){localStorage.removeItem("lastSeenSurveyDate");for(var e=[],n=0;n<localStorage.length;n++){var r=localStorage.key(n);(r!=null&&r.startsWith(Qh)||r!=null&&r.startsWith("inProgressSurvey_"))&&e.push(r)}e.forEach(i=>localStorage.removeItem(i))}loadIfEnabled(){if(!this._surveyManager)if(this.gr)Ee.info("Already initializing surveys, skipping...");else if(this._instance.config.disable_surveys)Ee.info("Disabled. Not loading surveys.");else if(this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())Ee.info("Not loading surveys in cookieless mode without consent.");else{var e=Z==null?void 0:Z.__PosthogExtensions__;if(e){if(!D(this.cr)||this._instance.config.advanced_enable_surveys){var n=this.cr||this._instance.config.advanced_enable_surveys;this.gr=!0;try{var r=e.generateSurveys;if(r)return void this.mr(r,n);var i=e.loadExternalDependency;if(!i)return void this.yr("PostHog loadExternalDependency extension not found.");i(this._instance,"surveys",s=>{s||!e.generateSurveys?this.yr("Could not load surveys script",s):this.mr(e.generateSurveys,n)})}catch(s){throw this.yr("Error initializing surveys",s),s}finally{this.gr=!1}}}else Ee.error("PostHog Extensions not found.")}}mr(e,n){this._surveyManager=e(this._instance,n),this._surveyEventReceiver=new HT(this._instance),Ee.info("Surveys loaded successfully"),this.br({isLoaded:!0})}yr(e,n){Ee.error(e,n),this.br({isLoaded:!1,error:e})}onSurveysLoaded(e){return this._r.push(e),this._surveyManager&&this.br({isLoaded:!0}),()=>{this._r=this._r.filter(n=>n!==e)}}getSurveys(e,n){if(n===void 0&&(n=!1),this._instance.config.disable_surveys)return Ee.info("Disabled. Not loading surveys."),e([]);var r=this._instance.get_property(uh);if(r&&!n)return e(r,{isLoaded:!0});if(this.pr)return e([],{isLoaded:!1,error:"Surveys are already being loaded"});try{this.pr=!0,this._instance.Oe({url:this._instance.requestRouter.endpointFor("api","/api/surveys/?token="+this._instance.config.token),method:"GET",timeout:this._instance.config.surveys_request_timeout_ms,callback:i=>{var s;this.pr=!1;var o=i.statusCode;if(o!==200||!i.json){var a="Surveys API could not be loaded, status: "+o;return Ee.error(a),e([],{isLoaded:!1,error:a})}var l,u=i.json.surveys||[],c=u.filter(f=>function(d){return!(!d.start_date||d.end_date)}(f)&&(function(d){var h;return!((h=d.conditions)==null||(h=h.events)==null||(h=h.values)==null||!h.length)}(f)||function(d){var h;return!((h=d.conditions)==null||(h=h.actions)==null||(h=h.values)==null||!h.length)}(f)));return c.length>0&&((l=this._surveyEventReceiver)==null||l.register(c)),(s=this._instance.persistence)==null||s.register({[uh]:u}),e(u,{isLoaded:!0})}})}catch(i){throw this.pr=!1,i}}br(e){for(var n of this._r)try{if(!e.isLoaded)return n([],e);this.getSurveys(n)}catch(r){Ee.error("Error in survey callback",r)}}getActiveMatchingSurveys(e,n){if(n===void 0&&(n=!1),!me(this._surveyManager))return this._surveyManager.getActiveMatchingSurveys(e,n);Ee.warn("init was not called")}wr(e){var n=null;return this.getSurveys(r=>{var i;n=(i=r.find(s=>s.id===e))!==null&&i!==void 0?i:null}),n}Sr(e){if(me(this._surveyManager))return{eligible:!1,reason:"SDK is not enabled or survey functionality is not yet loaded"};var n=typeof e=="string"?this.wr(e):e;return n?this._surveyManager.checkSurveyEligibility(n):{eligible:!1,reason:"Survey not found"}}canRenderSurvey(e){if(me(this._surveyManager))return Ee.warn("init was not called"),{visible:!1,disabledReason:"SDK is not enabled or survey functionality is not yet loaded"};var n=this.Sr(e);return{visible:n.eligible,disabledReason:n.reason}}canRenderSurveyAsync(e,n){return me(this._surveyManager)?(Ee.warn("init was not called"),Promise.resolve({visible:!1,disabledReason:"SDK is not enabled or survey functionality is not yet loaded"})):new Promise(r=>{this.getSurveys(i=>{var s,o=(s=i.find(l=>l.id===e))!==null&&s!==void 0?s:null;if(o){var a=this.Sr(o);r({visible:a.eligible,disabledReason:a.reason})}else r({visible:!1,disabledReason:"Survey not found"})},n)})}renderSurvey(e,n){var r;if(me(this._surveyManager))Ee.warn("init was not called");else{var i=typeof e=="string"?this.wr(e):e;if(i!=null&&i.id)if(jT.includes(i.type)){var s=B==null?void 0:B.querySelector(n);if(s)return(r=i.appearance)!=null&&r.surveyPopupDelaySeconds?(Ee.info("Rendering survey "+i.id+" with delay of "+i.appearance.surveyPopupDelaySeconds+" seconds"),void setTimeout(()=>{var o,a;Ee.info("Rendering survey "+i.id+" with delay of "+((o=i.appearance)==null?void 0:o.surveyPopupDelaySeconds)+" seconds"),(a=this._surveyManager)==null||a.renderSurvey(i,s),Ee.info("Survey "+i.id+" rendered")},1e3*i.appearance.surveyPopupDelaySeconds)):void this._surveyManager.renderSurvey(i,s);Ee.warn("Survey element not found")}else Ee.warn("Surveys of type "+i.type+" cannot be rendered in the app");else Ee.warn("Survey not found")}}displaySurvey(e,n){var r;if(me(this._surveyManager))Ee.warn("init was not called");else{var i=this.wr(e);if(i){var s=i;if((r=i.appearance)!=null&&r.surveyPopupDelaySeconds&&n.ignoreDelay&&(s=j({},i,{appearance:j({},i.appearance,{surveyPopupDelaySeconds:0})})),n.ignoreConditions===!1){var o=this.canRenderSurvey(i);if(!o.visible)return void Ee.warn("Survey is not eligible to be displayed: ",o.disabledReason)}n.displayType!==d1.Inline?this._surveyManager.handlePopoverSurvey(s):this.renderSurvey(s,n.selector)}else Ee.warn("Survey not found")}}}var h1=Je("[RateLimiter]");class BT{constructor(e){var n,r;this.serverLimits={},this.lastEventRateLimited=!1,this.checkForLimiting=i=>{var s=i.text;if(s&&s.length)try{(JSON.parse(s).quota_limited||[]).forEach(o=>{h1.info((o||"events")+" is quota limited."),this.serverLimits[o]=new Date().getTime()+6e4})}catch(o){return void h1.warn('could not rate limit - continuing. Error: "'+(o==null?void 0:o.message)+'"',{text:s})}},this.instance=e,this.captureEventsPerSecond=((n=e.config.rate_limiting)==null?void 0:n.events_per_second)||10,this.captureEventsBurstLimit=Math.max(((r=e.config.rate_limiting)==null?void 0:r.events_burst_limit)||10*this.captureEventsPerSecond,this.captureEventsPerSecond),this.lastEventRateLimited=this.clientRateLimitContext(!0).isRateLimited}clientRateLimitContext(e){var n,r,i;e===void 0&&(e=!1);var s=new Date().getTime(),o=(n=(r=this.instance.persistence)==null?void 0:r.get_property(dh))!==null&&n!==void 0?n:{tokens:this.captureEventsBurstLimit,last:s};o.tokens+=(s-o.last)/1e3*this.captureEventsPerSecond,o.last=s,o.tokens>this.captureEventsBurstLimit&&(o.tokens=this.captureEventsBurstLimit);var a=o.tokens<1;return a||e||(o.tokens=Math.max(0,o.tokens-1)),!a||this.lastEventRateLimited||e||this.instance.capture("$$client_ingestion_warning",{$$client_ingestion_warning_message:"posthog-js client rate limited. Config is set to "+this.captureEventsPerSecond+" events per second and "+this.captureEventsBurstLimit+" events burst limit."},{skip_client_rate_limiting:!0}),this.lastEventRateLimited=a,(i=this.instance.persistence)==null||i.set_property(dh,o),{isRateLimited:a,remainingTokens:o.tokens}}isServerRateLimited(e){var n=this.serverLimits[e||"events"]||!1;return n!==!1&&new Date().getTime()<n}}var Li=Je("[RemoteConfig]");class qT{constructor(e){this._instance=e}get remoteConfig(){var e;return(e=Z._POSTHOG_REMOTE_CONFIG)==null||(e=e[this._instance.config.token])==null?void 0:e.config}kr(e){var n,r;(n=Z.__PosthogExtensions__)!=null&&n.loadExternalDependency?(r=Z.__PosthogExtensions__)==null||r.loadExternalDependency==null||r.loadExternalDependency(this._instance,"remote-config",()=>e(this.remoteConfig)):(Li.error("PostHog Extensions not found. Cannot load remote config."),e())}$r(e){this._instance.Oe({method:"GET",url:this._instance.requestRouter.endpointFor("assets","/array/"+this._instance.config.token+"/config"),callback:n=>{e(n.json)}})}load(){try{if(this.remoteConfig)return Li.info("Using preloaded remote config",this.remoteConfig),void this.Fe(this.remoteConfig);if(this._instance.L())return void Li.warn("Remote config is disabled. Falling back to local config.");this.kr(e=>{if(!e)return Li.info("No config found after loading remote JS config. Falling back to JSON."),void this.$r(n=>{this.Fe(n)});this.Fe(e)})}catch(e){Li.error("Error loading remote config",e)}}Fe(e){e?this._instance.config.__preview_remote_config?(this._instance.Fe(e),e.hasFeatureFlags!==!1&&this._instance.featureFlags.ensureFlagsLoaded()):Li.info("__preview_remote_config is disabled. Logging config instead",e):Li.error("Failed to fetch remote config from PostHog.")}}var Xh=3e3;class VT{constructor(e,n){this.Er=!0,this.Rr=[],this.Ir=Zt((n==null?void 0:n.flush_interval_ms)||Xh,250,5e3,U.createLogger("flush interval"),Xh),this.Pr=e}enqueue(e){this.Rr.push(e),this.Tr||this.Cr()}unload(){this.Mr();var e=this.Rr.length>0?this.Or():{},n=Object.values(e);[...n.filter(r=>r.url.indexOf("/e")===0),...n.filter(r=>r.url.indexOf("/e")!==0)].map(r=>{this.Pr(j({},r,{transport:"sendBeacon"}))})}enable(){this.Er=!1,this.Cr()}Cr(){var e=this;this.Er||(this.Tr=setTimeout(()=>{if(this.Mr(),this.Rr.length>0){var n=this.Or(),r=function(){var s=n[i],o=new Date().getTime();s.data&&Ce(s.data)&&Se(s.data,a=>{a.offset=Math.abs(a.timestamp-o),delete a.timestamp}),e.Pr(s)};for(var i in n)r()}},this.Ir))}Mr(){clearTimeout(this.Tr),this.Tr=void 0}Or(){var e={};return Se(this.Rr,n=>{var r,i=n,s=(i?i.batchKey:null)||i.url;D(e[s])&&(e[s]=j({},i,{data:[]})),(r=e[s].data)==null||r.push(i.data)}),this.Rr=[],e}}var WT=["retriesPerformedSoFar"];class GT{constructor(e){this.Fr=!1,this.Ar=3e3,this.Rr=[],this._instance=e,this.Rr=[],this.Dr=!0,!D(E)&&"onLine"in E.navigator&&(this.Dr=E.navigator.onLine,Ne(E,"online",()=>{this.Dr=!0,this.oe()}),Ne(E,"offline",()=>{this.Dr=!1}))}get length(){return this.Rr.length}retriableRequest(e){var{retriesPerformedSoFar:n}=e,r=a_(e,WT);mt(n)&&n>0&&(r.url=Ou(r.url,{retry_count:n})),this._instance.Oe(j({},r,{callback:i=>{i.statusCode!==200&&(i.statusCode<400||i.statusCode>=500)&&(n??0)<10?this.jr(j({retriesPerformedSoFar:n},r)):r.callback==null||r.callback(i)}}))}jr(e){var n=e.retriesPerformedSoFar||0;e.retriesPerformedSoFar=n+1;var r=function(o){var a=3e3*Math.pow(2,o),l=a/2,u=Math.min(18e5,a),c=(Math.random()-.5)*(u-l);return Math.ceil(u+c)}(n),i=Date.now()+r;this.Rr.push({retryAt:i,requestOptions:e});var s="Enqueued failed request for retry in "+r;navigator.onLine||(s+=" (Browser is offline)"),U.warn(s),this.Fr||(this.Fr=!0,this.Lr())}Lr(){this.Nr&&clearTimeout(this.Nr),this.Nr=setTimeout(()=>{this.Dr&&this.Rr.length>0&&this.oe(),this.Lr()},this.Ar)}oe(){var e=Date.now(),n=[],r=this.Rr.filter(s=>s.retryAt<e||(n.push(s),!1));if(this.Rr=n,r.length>0)for(var{requestOptions:i}of r)this.retriableRequest(i)}unload(){for(var{requestOptions:e}of(this.Nr&&(clearTimeout(this.Nr),this.Nr=void 0),this.Rr))try{this._instance.Oe(j({},e,{transport:"sendBeacon"}))}catch(n){U.error(n)}this.Rr=[]}}class KT{constructor(e){this.Ur=()=>{var n,r,i,s;this.zr||(this.zr={});var o=this.scrollElement(),a=this.scrollY(),l=o?Math.max(0,o.scrollHeight-o.clientHeight):0,u=a+((o==null?void 0:o.clientHeight)||0),c=(o==null?void 0:o.scrollHeight)||0;this.zr.lastScrollY=Math.ceil(a),this.zr.maxScrollY=Math.max(a,(n=this.zr.maxScrollY)!==null&&n!==void 0?n:0),this.zr.maxScrollHeight=Math.max(l,(r=this.zr.maxScrollHeight)!==null&&r!==void 0?r:0),this.zr.lastContentY=u,this.zr.maxContentY=Math.max(u,(i=this.zr.maxContentY)!==null&&i!==void 0?i:0),this.zr.maxContentHeight=Math.max(c,(s=this.zr.maxContentHeight)!==null&&s!==void 0?s:0)},this._instance=e}getContext(){return this.zr}resetContext(){var e=this.zr;return setTimeout(this.Ur,0),e}startMeasuringScrollPosition(){Ne(E,"scroll",this.Ur,{capture:!0}),Ne(E,"scrollend",this.Ur,{capture:!0}),Ne(E,"resize",this.Ur)}scrollElement(){if(!this._instance.config.scroll_root_selector)return E==null?void 0:E.document.documentElement;var e=Ce(this._instance.config.scroll_root_selector)?this._instance.config.scroll_root_selector:[this._instance.config.scroll_root_selector];for(var n of e){var r=E==null?void 0:E.document.querySelector(n);if(r)return r}}scrollY(){if(this._instance.config.scroll_root_selector){var e=this.scrollElement();return e&&e.scrollTop||0}return E&&(E.scrollY||E.pageYOffset||E.document.documentElement.scrollTop)||0}scrollX(){if(this._instance.config.scroll_root_selector){var e=this.scrollElement();return e&&e.scrollLeft||0}return E&&(E.scrollX||E.pageXOffset||E.document.documentElement.scrollLeft)||0}}var YT=t=>i1(t==null?void 0:t.config.mask_personal_data_properties,t==null?void 0:t.config.custom_personal_data_properties);class p1{constructor(e,n,r,i){this.Br=s=>{var o=this.qr();if(!o||o.sessionId!==s){var a={sessionId:s,props:this.Hr(this._instance)};this.Wr.register({[ch]:a})}},this._instance=e,this.Gr=n,this.Wr=r,this.Hr=i||YT,this.Gr.onSessionId(this.Br)}qr(){return this.Wr.props[ch]}getSetOnceProps(){var e,n=(e=this.qr())==null?void 0:e.props;return n?"r"in n?s1(n):{$referring_domain:n.referringDomain,$pathname:n.initialPathName,utm_source:n.utm_source,utm_campaign:n.utm_campaign,utm_medium:n.utm_medium,utm_content:n.utm_content,utm_term:n.utm_term}:{}}getSessionProps(){var e={};return Se(th(this.getSetOnceProps()),(n,r)=>{r==="$current_url"&&(r="url"),e["$session_entry_"+Yf(r)]=n}),e}}var Zh=Je("[SessionId]");class v1{on(e,n){return this.Vr.on(e,n)}constructor(e,n,r){var i;if(this.Jr=[],this.Vr=new Yh,this.Kr=(c,f)=>Math.abs(c-f)>this.sessionTimeoutMs,!e.persistence)throw new Error("SessionIdManager requires a PostHogPersistence instance");if(e.config.cookieless_mode==="always")throw new Error('SessionIdManager cannot be used with cookieless_mode="always"');this.A=e.config,this.Wr=e.persistence,this.pi=void 0,this.Ft=void 0,this._sessionStartTimestamp=null,this._sessionActivityTimestamp=null,this.Yr=n||Gr,this.Xr=r||Gr;var s=this.A.persistence_name||this.A.token,o=this.A.session_idle_timeout_seconds||1800;if(this._sessionTimeoutMs=1e3*Zt(o,60,36e3,Zh.createLogger("session_idle_timeout_seconds"),1800),e.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this.Qr(),this.Zr="ph_"+s+"_window_id",this.ts="ph_"+s+"_primary_window_exists",this.es()){var a=ut.K(this.Zr),l=ut.K(this.ts);a&&!l?this.pi=a:ut.X(this.Zr),ut.Y(this.ts,!0)}if((i=this.A.bootstrap)!=null&&i.sessionID)try{var u=(c=>{var f=c.replace(/-/g,"");if(f.length!==32)throw new Error("Not a valid UUID");if(f[12]!=="7")throw new Error("Not a UUIDv7");return parseInt(f.substring(0,12),16)})(this.A.bootstrap.sessionID);this.rs(this.A.bootstrap.sessionID,new Date().getTime(),u)}catch(c){Zh.error("Invalid sessionID in bootstrap",c)}this.ss()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(e){return D(this.Jr)&&(this.Jr=[]),this.Jr.push(e),this.Ft&&e(this.Ft,this.pi),()=>{this.Jr=this.Jr.filter(n=>n!==e)}}es(){return this.A.persistence!=="memory"&&!this.Wr.Ue&&ut.G()}ns(e){e!==this.pi&&(this.pi=e,this.es()&&ut.Y(this.Zr,e))}os(){return this.pi?this.pi:this.es()?ut.K(this.Zr):null}rs(e,n,r){e===this.Ft&&n===this._sessionActivityTimestamp&&r===this._sessionStartTimestamp||(this._sessionStartTimestamp=r,this._sessionActivityTimestamp=n,this.Ft=e,this.Wr.register({[fu]:[n,e,r]}))}ls(){if(this.Ft&&this._sessionActivityTimestamp&&this._sessionStartTimestamp)return[this._sessionActivityTimestamp,this.Ft,this._sessionStartTimestamp];var e=this.Wr.props[fu];return Ce(e)&&e.length===2&&e.push(e[0]),e||[0,null,0]}resetSessionId(){this.rs(null,null,null)}ss(){Ne(E,"beforeunload",()=>{this.es()&&ut.X(this.ts)},{capture:!1})}checkAndGetSessionAndWindowId(e,n){if(e===void 0&&(e=!1),n===void 0&&(n=null),this.A.cookieless_mode==="always")throw new Error('checkAndGetSessionAndWindowId should not be called with cookieless_mode="always"');var r=n||new Date().getTime(),[i,s,o]=this.ls(),a=this.os(),l=mt(o)&&o>0&&Math.abs(r-o)>864e5,u=!1,c=!s,f=!e&&this.Kr(r,i);c||f||l?(s=this.Yr(),a=this.Xr(),Zh.info("new session ID generated",{sessionId:s,windowId:a,changeReason:{noSessionId:c,activityTimeout:f,sessionPastMaximumLength:l}}),o=r,u=!0):a||(a=this.Xr(),u=!0);var d=i===0||!e||l?r:i,h=o===0?new Date().getTime():o;return this.ns(a),this.rs(s,d,h),e||this.Qr(),u&&this.Jr.forEach(p=>p(s,a,u?{noSessionId:c,activityTimeout:f,sessionPastMaximumLength:l}:void 0)),{sessionId:s,windowId:a,sessionStartTimestamp:h,changeReason:u?{noSessionId:c,activityTimeout:f,sessionPastMaximumLength:l}:void 0,lastActivityTimestamp:i}}Qr(){clearTimeout(this.us),this.us=setTimeout(()=>{var[e]=this.ls();if(this.Kr(new Date().getTime(),e)){var n=this.Ft;this.resetSessionId(),this.Vr.emit("forcedIdleReset",{idleSessionId:n})}},1.1*this.sessionTimeoutMs)}}var QT=["$set_once","$set"],Xr=Je("[SiteApps]");class XT{constructor(e){this._instance=e,this.hs=[],this.apps={}}get isEnabled(){return!!this._instance.config.opt_in_site_apps}ds(e,n){if(n){var r=this.globalsForEvent(n);this.hs.push(r),this.hs.length>1e3&&(this.hs=this.hs.slice(10))}}get siteAppLoaders(){var e;return(e=Z._POSTHOG_REMOTE_CONFIG)==null||(e=e[this._instance.config.token])==null?void 0:e.siteApps}init(){if(this.isEnabled){var e=this._instance.Ze(this.ds.bind(this));this.vs=()=>{e(),this.hs=[],this.vs=void 0}}}globalsForEvent(e){var n,r,i,s,o,a,l;if(!e)throw new Error("Event payload is required");var u={},c=this._instance.get_property("$groups")||[],f=this._instance.get_property("$stored_group_properties")||{};for(var[d,h]of Object.entries(f))u[d]={id:c[d],type:d,properties:h};var{$set_once:p,$set:v}=e;return{event:j({},a_(e,QT),{properties:j({},e.properties,v?{$set:j({},(n=(r=e.properties)==null?void 0:r.$set)!==null&&n!==void 0?n:{},v)}:{},p?{$set_once:j({},(i=(s=e.properties)==null?void 0:s.$set_once)!==null&&i!==void 0?i:{},p)}:{}),elements_chain:(o=(a=e.properties)==null?void 0:a.$elements_chain)!==null&&o!==void 0?o:"",distinct_id:(l=e.properties)==null?void 0:l.distinct_id}),person:{properties:this._instance.get_property("$stored_person_properties")},groups:u}}setupSiteApp(e){var n=this.apps[e.id],r=()=>{var a;!n.errored&&this.hs.length&&(Xr.info("Processing "+this.hs.length+" events for site app with id "+e.id),this.hs.forEach(l=>n.processEvent==null?void 0:n.processEvent(l)),n.processedBuffer=!0),Object.values(this.apps).every(l=>l.processedBuffer||l.errored)&&((a=this.vs)==null||a.call(this))},i=!1,s=a=>{n.errored=!a,n.loaded=!0,Xr.info("Site app with id "+e.id+" "+(a?"loaded":"errored")),i&&r()};try{var{processEvent:o}=e.init({posthog:this._instance,callback:a=>{s(a)}});o&&(n.processEvent=o),i=!0}catch(a){Xr.error("Error while initializing PostHog app with config id "+e.id,a),s(!1)}if(i&&n.loaded)try{r()}catch(a){Xr.error("Error while processing buffered events PostHog app with config id "+e.id,a),n.errored=!0}}cs(){var e=this.siteAppLoaders||[];for(var n of e)this.apps[n.id]={id:n.id,loaded:!1,errored:!1,processedBuffer:!1};for(var r of e)this.setupSiteApp(r)}fs(e){if(Object.keys(this.apps).length!==0){var n=this.globalsForEvent(e);for(var r of Object.values(this.apps))try{r.processEvent==null||r.processEvent(n)}catch(i){Xr.error("Error while processing event "+e.event+" for site app "+r.id,i)}}}onRemoteConfig(e){var n,r,i,s=this;if((n=this.siteAppLoaders)!=null&&n.length)return this.isEnabled?(this.cs(),void this._instance.on("eventCaptured",u=>this.fs(u))):void Xr.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.');if((r=this.vs)==null||r.call(this),(i=e.siteApps)!=null&&i.length)if(this.isEnabled){var o=function(u){var c;Z["__$$ph_site_app_"+u]=s._instance,(c=Z.__PosthogExtensions__)==null||c.loadSiteApp==null||c.loadSiteApp(s._instance,l,f=>{if(f)return Xr.error("Error while initializing PostHog app with config id "+u,f)})};for(var{id:a,url:l}of e.siteApps)o(a)}else Xr.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}}var ZT=["amazonbot","amazonproductbot","app.hypefactors.com","applebot","archive.org_bot","awariobot","backlinksextendedbot","baiduspider","bingbot","bingpreview","chrome-lighthouse","dataforseobot","deepscan","duckduckbot","facebookexternal","facebookcatalog","http://yandex.com/bots","hubspot","ia_archiver","leikibot","linkedinbot","meta-externalagent","mj12bot","msnbot","nessus","petalbot","pinterest","prerender","rogerbot","screaming frog","sebot-wa","sitebulb","slackbot","slurp","trendictionbot","turnitin","twitterbot","vercel-screenshot","vercelbot","yahoo! slurp","yandexbot","zoombot","bot.htm","bot.php","(bot;","bot/","crawler","ahrefsbot","ahrefssiteaudit","semrushbot","siteauditbot","splitsignalbot","gptbot","oai-searchbot","chatgpt-user","perplexitybot","better uptime bot","sentryuptimebot","uptimerobot","headlesschrome","cypress","google-hoteladsverifier","adsbot-google","apis-google","duplexweb-google","feedfetcher-google","google favicon","google web preview","google-read-aloud","googlebot","googleother","google-cloudvertexbot","googleweblight","mediapartners-google","storebot-google","google-inspectiontool","bytespider"],g1=function(t,e){if(!t)return!1;var n=t.toLowerCase();return ZT.concat(e||[]).some(r=>{var i=r.toLowerCase();return n.indexOf(i)!==-1})},m1=function(t,e){if(!t)return!1;var n=t.userAgent;if(n&&g1(n,e))return!0;try{var r=t==null?void 0:t.userAgentData;if(r!=null&&r.brands&&r.brands.some(i=>g1(i==null?void 0:i.brand,e)))return!0}catch{}return!!t.webdriver},pa=function(t){return t.US="us",t.EU="eu",t.CUSTOM="custom",t}({}),y1="i.posthog.com";class JT{constructor(e){this.ps={},this.instance=e}get apiHost(){var e=this.instance.config.api_host.trim().replace(/\/$/,"");return e==="https://app.posthog.com"?"https://us.i.posthog.com":e}get uiHost(){var e,n=(e=this.instance.config.ui_host)==null?void 0:e.replace(/\/$/,"");return n||(n=this.apiHost.replace("."+y1,".posthog.com")),n==="https://app.posthog.com"?"https://us.posthog.com":n}get region(){return this.ps[this.apiHost]||(/https:\/\/(app|us|us-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?this.ps[this.apiHost]=pa.US:/https:\/\/(eu|eu-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?this.ps[this.apiHost]=pa.EU:this.ps[this.apiHost]=pa.CUSTOM),this.ps[this.apiHost]}endpointFor(e,n){if(n===void 0&&(n=""),n&&(n=n[0]==="/"?n:"/"+n),e==="ui")return this.uiHost+n;if(this.region===pa.CUSTOM)return this.apiHost+n;var r=y1+n;switch(e){case"assets":return"https://"+this.region+"-assets."+r;case"api":return"https://"+this.region+"."+r}}}var eP={icontains:(t,e)=>!!E&&e.href.toLowerCase().indexOf(t.toLowerCase())>-1,not_icontains:(t,e)=>!!E&&e.href.toLowerCase().indexOf(t.toLowerCase())===-1,regex:(t,e)=>!!E&&Ms(e.href,t),not_regex:(t,e)=>!!E&&!Ms(e.href,t),exact:(t,e)=>e.href===t,is_not:(t,e)=>e.href!==t};class _t{constructor(e){var n=this;this.getWebExperimentsAndEvaluateDisplayLogic=function(r){r===void 0&&(r=!1),n.getWebExperiments(i=>{_t.gs("retrieved web experiments from the server"),n._s=new Map,i.forEach(s=>{if(s.feature_flag_key){var o;n._s&&(_t.gs("setting flag key ",s.feature_flag_key," to web experiment ",s),(o=n._s)==null||o.set(s.feature_flag_key,s));var a=n._instance.getFeatureFlag(s.feature_flag_key);Ue(a)&&s.variants[a]&&n.ys(s.name,a,s.variants[a].transforms)}else if(s.variants)for(var l in s.variants){var u=s.variants[l];_t.bs(u)&&n.ys(s.name,l,u.transforms)}})},r)},this._instance=e,this._instance.onFeatureFlags(r=>{this.onFeatureFlags(r)})}onFeatureFlags(e){if(this._is_bot())_t.gs("Refusing to render web experiment since the viewer is a likely bot");else if(!this._instance.config.disable_web_experiments){if(me(this._s))return this._s=new Map,this.loadIfEnabled(),void this.previewWebExperiment();_t.gs("applying feature flags",e),e.forEach(n=>{var r;if(this._s&&(r=this._s)!=null&&r.has(n)){var i,s=this._instance.getFeatureFlag(n),o=(i=this._s)==null?void 0:i.get(n);s&&o!=null&&o.variants[s]&&this.ys(o.name,s,o.variants[s].transforms)}})}}previewWebExperiment(){var e=_t.getWindowLocation();if(e!=null&&e.search){var n=wu(e==null?void 0:e.search,"__experiment_id"),r=wu(e==null?void 0:e.search,"__experiment_variant");n&&r&&(_t.gs("previewing web experiments "+n+" && "+r),this.getWebExperiments(i=>{this.ws(parseInt(n),r,i)},!1,!0))}}loadIfEnabled(){this._instance.config.disable_web_experiments||this.getWebExperimentsAndEvaluateDisplayLogic()}getWebExperiments(e,n,r){if(this._instance.config.disable_web_experiments&&!r)return e([]);var i=this._instance.get_property("$web_experiments");if(i&&!n)return e(i);this._instance.Oe({url:this._instance.requestRouter.endpointFor("api","/api/web_experiments/?token="+this._instance.config.token),method:"GET",callback:s=>{if(s.statusCode!==200||!s.json)return e([]);var o=s.json.experiments||[];return e(o)}})}ws(e,n,r){var i=r.filter(s=>s.id===e);i&&i.length>0&&(_t.gs("Previewing web experiment ["+i[0].name+"] with variant ["+n+"]"),this.ys(i[0].name,n,i[0].variants[n].transforms))}static bs(e){return!me(e.conditions)&&_t.Ss(e)&&_t.ks(e)}static Ss(e){var n;if(me(e.conditions)||me((n=e.conditions)==null?void 0:n.url))return!0;var r,i,s,o=_t.getWindowLocation();return!!o&&((r=e.conditions)==null||!r.url||eP[(i=(s=e.conditions)==null?void 0:s.urlMatchType)!==null&&i!==void 0?i:"icontains"](e.conditions.url,o))}static getWindowLocation(){return E==null?void 0:E.location}static ks(e){var n;if(me(e.conditions)||me((n=e.conditions)==null?void 0:n.utm))return!0;var r=Jw();if(r.utm_source){var i,s,o,a,l,u,c,f,d=(i=e.conditions)==null||(i=i.utm)==null||!i.utm_campaign||((s=e.conditions)==null||(s=s.utm)==null?void 0:s.utm_campaign)==r.utm_campaign,h=(o=e.conditions)==null||(o=o.utm)==null||!o.utm_source||((a=e.conditions)==null||(a=a.utm)==null?void 0:a.utm_source)==r.utm_source,p=(l=e.conditions)==null||(l=l.utm)==null||!l.utm_medium||((u=e.conditions)==null||(u=u.utm)==null?void 0:u.utm_medium)==r.utm_medium,v=(c=e.conditions)==null||(c=c.utm)==null||!c.utm_term||((f=e.conditions)==null||(f=f.utm)==null?void 0:f.utm_term)==r.utm_term;return d&&p&&v&&h}return!1}static gs(e){for(var n=arguments.length,r=new Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];U.info("[WebExperiments] "+e,r)}ys(e,n,r){this._is_bot()?_t.gs("Refusing to render web experiment since the viewer is a likely bot"):n!=="control"?r.forEach(i=>{if(i.selector){var s;_t.gs("applying transform of variant "+n+" for experiment "+e+" ",i);var o=(s=document)==null?void 0:s.querySelectorAll(i.selector);o==null||o.forEach(a=>{var l=a;i.html&&(l.innerHTML=i.html),i.css&&l.setAttribute("style",i.css)})}}):_t.gs("Control variants leave the page unmodified.")}_is_bot(){return Xt&&this._instance?m1(Xt,this._instance.config.custom_blocked_useragents):void 0}}var tP=Je("[PostHog ExternalIntegrations]"),nP={intercom:"intercom-integration",crispChat:"crisp-chat-integration"};class rP{constructor(e){this._instance=e}nt(e,n){var r;(r=Z.__PosthogExtensions__)==null||r.loadExternalDependency==null||r.loadExternalDependency(this._instance,e,i=>{if(i)return tP.error("failed to load script",i);n()})}startIfEnabledOrStop(){var e=this,n=function(o){var a,l,u;!i||(a=Z.__PosthogExtensions__)!=null&&(a=a.integrations)!=null&&a[o]||e.nt(nP[o],()=>{var c;(c=Z.__PosthogExtensions__)==null||(c=c.integrations)==null||(c=c[o])==null||c.start(e._instance)}),!i&&(l=Z.__PosthogExtensions__)!=null&&(l=l.integrations)!=null&&l[o]&&((u=Z.__PosthogExtensions__)==null||(u=u.integrations)==null||(u=u[o])==null||u.stop())};for(var[r,i]of Object.entries((s=this._instance.config.integrations)!==null&&s!==void 0?s:{})){var s;n(r)}}}var Jh="[SessionRecording]",va=Je(Jh);class iP{get started(){var e;return!((e=this.$s)==null||!e.isStarted)}get status(){var e;return((e=this.$s)==null?void 0:e.status)||"lazy_loading"}constructor(e){if(this._forceAllowLocalhostNetworkCapture=!1,this.ni=void 0,this._instance=e,!this._instance.sessionManager)throw va.error("started without valid sessionManager"),new Error(Jh+" started without valid sessionManager. This is a bug.");if(this._instance.config.cookieless_mode==="always")throw new Error(Jh+' cannot be used with cookieless_mode="always"')}get Bt(){var e,n=!((e=this._instance.get_property(ih))==null||!e.enabled),r=!this._instance.config.disable_session_recording,i=this._instance.config.disable_session_recording||this._instance.consent.isOptedOut();return E&&n&&r&&!i}startIfEnabledOrStop(e){var n;if(!this.Bt||(n=this.$s)==null||!n.isStarted){var r=!D(Object.assign)&&!D(Array.from);this.Bt&&r?(this.xs(e),va.info("starting")):this.stopRecording()}}xs(e){var n,r,i;this.Bt&&(Z!=null&&(n=Z.__PosthogExtensions__)!=null&&(n=n.rrweb)!=null&&n.record&&(r=Z.__PosthogExtensions__)!=null&&r.initSessionRecording?this.Ri(e):(i=Z.__PosthogExtensions__)==null||i.loadExternalDependency==null||i.loadExternalDependency(this._instance,this.Ii,s=>{if(s)return va.error("could not load recorder",s);this.Ri(e)}))}stopRecording(){var e;(e=this.$s)==null||e.stop()}ki(){var e;(e=this._instance.persistence)==null||e.unregister($s)}Ei(e){if(this._instance.persistence){var n,r,i=this._instance.persistence,s=()=>{var o=e.sessionRecording,a=o==null?void 0:o.sampleRate,l=me(a)?null:parseFloat(a);me(l)&&this.ki();var u=o==null?void 0:o.minimumDurationMilliseconds;i.register({[ih]:j({enabled:!!o},o,{networkPayloadCapture:j({capturePerformance:e.capturePerformance},o==null?void 0:o.networkPayloadCapture),canvasRecording:{enabled:o==null?void 0:o.recordCanvas,fps:o==null?void 0:o.canvasFps,quality:o==null?void 0:o.canvasQuality},sampleRate:l,minimumDurationMilliseconds:D(u)?null:u,endpoint:o==null?void 0:o.endpoint,triggerMatchType:o==null?void 0:o.triggerMatchType,masking:o==null?void 0:o.masking,urlTriggers:o==null?void 0:o.urlTriggers})})};s(),(n=this.ni)==null||n.call(this),this.ni=(r=this._instance.sessionManager)==null?void 0:r.onSessionId(s)}}onRemoteConfig(e){"sessionRecording"in e?(this.Ei(e),this.startIfEnabledOrStop()):va.info("skipping remote config with no sessionRecording",e)}log(e,n){var r;n===void 0&&(n="log"),(r=this.$s)!=null&&r.log?this.$s.log(e,n):va.warn("log called before recorder was ready")}get Ii(){var e,n,r=(e=this._instance)==null||(e=e.persistence)==null?void 0:e.get_property(ih);return(r==null||(n=r.scriptConfig)==null?void 0:n.script)||"lazy-recorder"}Ri(e){var n,r;if((n=Z.__PosthogExtensions__)==null||!n.initSessionRecording)throw Error("Called on script loaded before session recording is available");this.$s||(this.$s=(r=Z.__PosthogExtensions__)==null?void 0:r.initSessionRecording(this._instance),this.$s._forceAllowLocalhostNetworkCapture=this._forceAllowLocalhostNetworkCapture),this.$s.start(e)}onRRwebEmit(e){var n;(n=this.$s)==null||n.onRRwebEmit==null||n.onRRwebEmit(e)}overrideLinkedFlag(){var e;(e=this.$s)==null||e.overrideLinkedFlag()}overrideSampling(){var e;(e=this.$s)==null||e.overrideSampling()}overrideTrigger(e){var n;(n=this.$s)==null||n.overrideTrigger(e)}get sdkDebugProperties(){var e;return((e=this.$s)==null?void 0:e.sdkDebugProperties)||{$recording_status:this.status}}tryAddCustomEvent(e,n){var r;return!((r=this.$s)==null||!r.tryAddCustomEvent(e,n))}}var ga={},ep=()=>{},Ls="posthog",_1=!yT&&(Nt==null?void 0:Nt.indexOf("MSIE"))===-1&&(Nt==null?void 0:Nt.indexOf("Mozilla"))===-1,w1=t=>{var e;return{api_host:"https://us.i.posthog.com",ui_host:null,token:"",autocapture:!0,rageclick:!0,cross_subdomain_cookie:cR(B==null?void 0:B.location),persistence:"localStorage+cookie",persistence_name:"",loaded:ep,save_campaign_params:!0,custom_campaign_params:[],custom_blocked_useragents:[],save_referrer:!0,capture_pageview:t!=="2025-05-24"||"history_change",capture_pageleave:"if_capture_pageview",defaults:t??"unset",debug:Dt&&Ue(Dt==null?void 0:Dt.search)&&Dt.search.indexOf("__posthog_debug=true")!==-1||!1,cookie_expiration:365,upgrade:!1,disable_session_recording:!1,disable_persistence:!1,disable_web_experiments:!0,disable_surveys:!1,disable_surveys_automatic_display:!1,disable_external_dependency_loading:!1,enable_recording_console_log:void 0,secure_cookie:(E==null||(e=E.location)==null?void 0:e.protocol)==="https:",ip:!1,opt_out_capturing_by_default:!1,opt_out_persistence_by_default:!1,opt_out_useragent_filter:!1,opt_out_capturing_persistence_type:"localStorage",consent_persistence_name:null,opt_out_capturing_cookie_prefix:null,opt_in_site_apps:!1,property_denylist:[],respect_dnt:!1,sanitize_properties:null,request_headers:{},request_batching:!0,properties_string_max_length:65535,session_recording:{},mask_all_element_attributes:!1,mask_all_text:!1,mask_personal_data_properties:!1,custom_personal_data_properties:[],advanced_disable_flags:!1,advanced_disable_decide:!1,advanced_disable_feature_flags:!1,advanced_disable_feature_flags_on_first_load:!1,advanced_only_evaluate_survey_feature_flags:!1,advanced_enable_surveys:!1,advanced_disable_toolbar_metrics:!1,feature_flag_request_timeout_ms:3e3,surveys_request_timeout_ms:1e4,on_request_error:n=>{var r="Bad HTTP status: "+n.statusCode+" "+n.text;U.error(r)},get_device_id:n=>n,capture_performance:void 0,name:"posthog",bootstrap:{},disable_compression:!1,session_idle_timeout_seconds:1800,person_profiles:"identified_only",before_send:void 0,request_queue_config:{flush_interval_ms:Xh},error_tracking:{},_onCapture:ep,__preview_eager_load_replay:!0}},b1=t=>{var e={};D(t.process_person)||(e.person_profiles=t.process_person),D(t.xhr_headers)||(e.request_headers=t.xhr_headers),D(t.cookie_name)||(e.persistence_name=t.cookie_name),D(t.disable_cookie)||(e.disable_persistence=t.disable_cookie),D(t.store_google)||(e.save_campaign_params=t.store_google),D(t.verbose)||(e.debug=t.verbose);var n=Ve({},e,t);return Ce(t.property_blacklist)&&(D(t.property_denylist)?n.property_denylist=t.property_blacklist:Ce(t.property_denylist)?n.property_denylist=[...t.property_blacklist,...t.property_denylist]:U.error("Invalid value for property_denylist config: "+t.property_denylist)),n};class sP{constructor(){this.__forceAllowLocalhost=!1}get Es(){return this.__forceAllowLocalhost}set Es(e){U.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=e}}class ju{get decideEndpointWasHit(){var e,n;return(e=(n=this.featureFlags)==null?void 0:n.hasLoadedFlags)!==null&&e!==void 0&&e}get flagsEndpointWasHit(){var e,n;return(e=(n=this.featureFlags)==null?void 0:n.hasLoadedFlags)!==null&&e!==void 0&&e}constructor(){this.webPerformance=new sP,this.Rs=!1,this.version=cr.LIB_VERSION,this.Is=new Yh,this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=w1(),this.SentryIntegration=lT,this.sentryIntegration=e=>function(n,r){var i=Ew(n,r);return{name:Sw,processEvent:s=>i(s)}}(this,e),this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this.Ps=!1,this.Ts=null,this.Cs=null,this.Ms=null,this.featureFlags=new LT(this),this.toolbar=new cT(this),this.scrollManager=new KT(this),this.pageViewManager=new gT(this),this.surveys=new UT(this),this.experiments=new _t(this),this.exceptions=new _T(this),this.rateLimiter=new BT(this),this.requestRouter=new JT(this),this.consent=new OR(this),this.externalIntegrations=new rP(this),this.people={set:(e,n,r)=>{var i=Ue(e)?{[e]:n}:e;this.setPersonProperties(i),r==null||r({})},set_once:(e,n,r)=>{var i=Ue(e)?{[e]:n}:e;this.setPersonProperties(void 0,i),r==null||r({})}},this.on("eventCaptured",e=>U.info('send "'+(e==null?void 0:e.event)+'"',e))}init(e,n,r){if(r&&r!==Ls){var i,s=(i=ga[r])!==null&&i!==void 0?i:new ju;return s._init(e,n,r),ga[r]=s,ga[Ls][r]=s,s}return this._init(e,n,r)}_init(e,n,r){var i,s;if(n===void 0&&(n={}),D(e)||Qf(e))return U.critical("PostHog was initialized without a token. This likely indicates a misconfiguration. Please check the first argument passed to posthog.init()"),this;if(this.__loaded)return U.warn("You have already initialized PostHog! Re-initializing is a no-op"),this;this.__loaded=!0,this.config={},this.Os=n,this.Fs=[],n.person_profiles&&(this.Cs=n.person_profiles),this.set_config(Ve({},w1(n.defaults),b1(n),{name:r,token:e})),this.config.on_xhr_error&&U.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=n.disable_compression?void 0:hr.GZipJS;var o=this.As();this.persistence=new Gh(this.config,o),this.sessionPersistence=this.config.persistence==="sessionStorage"||this.config.persistence==="memory"?this.persistence:new Gh(j({},this.config,{persistence:"sessionStorage"}),o);var a=j({},this.persistence.props),l=j({},this.sessionPersistence.props);this.register({$initialization_time:new Date().toISOString()}),this.Ds=new VT(y=>this.js(y),this.config.request_queue_config),this.Ls=new GT(this),this.__request_queue=[];var u=this.config.cookieless_mode==="always"||this.config.cookieless_mode==="on_reject"&&this.consent.isExplicitlyOptedOut();if(u||(this.sessionManager=new v1(this),this.sessionPropsManager=new p1(this,this.sessionManager,this.persistence)),new fT(this).startIfEnabledOrStop(),this.siteApps=new XT(this),(i=this.siteApps)==null||i.init(),u||(this.config.__preview_eager_load_replay?this.sessionRecording=new kw(this):this.sessionRecording=new iP(this),this.sessionRecording.startIfEnabledOrStop()),this.config.disable_scroll_properties||this.scrollManager.startMeasuringScrollPosition(),this.autocapture=new SR(this),this.autocapture.startIfEnabled(),this.surveys.loadIfEnabled(),this.heatmaps=new vT(this),this.heatmaps.startIfEnabled(),this.webVitalsAutocapture=new hT(this),this.exceptionObserver=new FR(this),this.exceptionObserver.startIfEnabled(),this.deadClicksAutocapture=new rw(this,IR),this.deadClicksAutocapture.startIfEnabled(),this.historyAutocapture=new LR(this),this.historyAutocapture.startIfEnabled(),cr.DEBUG=cr.DEBUG||this.config.debug,cr.DEBUG&&U.info("Starting in debug mode",{this:this,config:n,thisC:j({},this.config),p:a,s:l}),((s=n.bootstrap)==null?void 0:s.distinctID)!==void 0){var c,f,d=this.config.get_device_id(Gr()),h=(c=n.bootstrap)!=null&&c.isIdentifiedID?d:n.bootstrap.distinctID;this.persistence.set_property(fr,(f=n.bootstrap)!=null&&f.isIdentifiedID?"identified":"anonymous"),this.register({distinct_id:n.bootstrap.distinctID,$device_id:h})}if(this.Ns()){var p,v,w=Object.keys(((p=n.bootstrap)==null?void 0:p.featureFlags)||{}).filter(y=>{var b;return!((b=n.bootstrap)==null||(b=b.featureFlags)==null||!b[y])}).reduce((y,b)=>{var x;return y[b]=((x=n.bootstrap)==null||(x=x.featureFlags)==null?void 0:x[b])||!1,y},{}),m=Object.keys(((v=n.bootstrap)==null?void 0:v.featureFlagPayloads)||{}).filter(y=>w[y]).reduce((y,b)=>{var x,k;return(x=n.bootstrap)!=null&&(x=x.featureFlagPayloads)!=null&&x[b]&&(y[b]=(k=n.bootstrap)==null||(k=k.featureFlagPayloads)==null?void 0:k[b]),y},{});this.featureFlags.receivedFeatureFlags({featureFlags:w,featureFlagPayloads:m})}if(u)this.register_once({distinct_id:ea,$device_id:null},"");else if(!this.get_distinct_id()){var g=this.config.get_device_id(Gr());this.register_once({distinct_id:g,$device_id:g},""),this.persistence.set_property(fr,"anonymous")}return Ne(E,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),this.toolbar.maybeLoadToolbar(),n.segment?aT(this,()=>this.Us()):this.Us(),cn(this.config._onCapture)&&this.config._onCapture!==ep&&(U.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",y=>this.config._onCapture(y.event,y))),this.config.ip&&U.warn('The `ip` config option has NO EFFECT AT ALL and has been deprecated. Use a custom transformation or "Discard IP data" project setting instead. See https://posthog.com/tutorials/web-redact-properties#hiding-customer-ip-address for more information.'),this}Fe(e){var n,r,i,s,o,a,l,u;if(!B||!B.body)return U.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout(()=>{this.Fe(e)},500);this.compression=void 0,e.supportedCompression&&!this.config.disable_compression&&(this.compression=ue(e.supportedCompression,hr.GZipJS)?hr.GZipJS:ue(e.supportedCompression,hr.Base64)?hr.Base64:void 0),(n=e.analytics)!=null&&n.endpoint&&(this.analyticsDefaultEndpoint=e.analytics.endpoint),this.set_config({person_profiles:this.Cs?this.Cs:"identified_only"}),(r=this.siteApps)==null||r.onRemoteConfig(e),(i=this.sessionRecording)==null||i.onRemoteConfig(e),(s=this.autocapture)==null||s.onRemoteConfig(e),(o=this.heatmaps)==null||o.onRemoteConfig(e),this.surveys.onRemoteConfig(e),(a=this.webVitalsAutocapture)==null||a.onRemoteConfig(e),(l=this.exceptionObserver)==null||l.onRemoteConfig(e),this.exceptions.onRemoteConfig(e),(u=this.deadClicksAutocapture)==null||u.onRemoteConfig(e)}Us(){try{this.config.loaded(this)}catch(e){U.critical("`loaded` function failed",e)}this.zs(),this.config.capture_pageview&&setTimeout(()=>{(this.consent.isOptedIn()||this.config.cookieless_mode==="always")&&this.Bs()},1),new qT(this).load(),this.featureFlags.flags()}zs(){var e;this.is_capturing()&&this.config.request_batching&&((e=this.Ds)==null||e.enable())}_dom_loaded(){this.is_capturing()&&Vr(this.__request_queue,e=>this.js(e)),this.__request_queue=[],this.zs()}_handle_unload(){var e,n;this.config.request_batching?(this.qs()&&this.capture("$pageleave"),(e=this.Ds)==null||e.unload(),(n=this.Ls)==null||n.unload()):this.qs()&&this.capture("$pageleave",null,{transport:"sendBeacon"})}Oe(e){this.__loaded&&(_1?this.__request_queue.push(e):this.rateLimiter.isServerRateLimited(e.batchKey)||(e.transport=e.transport||this.config.api_transport,e.url=Ou(e.url,{ip:this.config.ip?1:0}),e.headers=j({},this.config.request_headers),e.compression=e.compression==="best-available"?this.compression:e.compression,e.disableXHRCredentials=this.config.__preview_disable_xhr_credentials,this.config.__preview_disable_beacon&&(e.disableTransport=["sendBeacon"]),e.fetchOptions=e.fetchOptions||this.config.fetch_options,(n=>{var r,i,s,o=j({},n);o.timeout=o.timeout||6e4,o.url=Ou(o.url,{_:new Date().getTime().toString(),ver:cr.LIB_VERSION,compression:o.compression});var a=(r=o.transport)!==null&&r!==void 0?r:"fetch",l=Au.filter(c=>!o.disableTransport||!c.transport||!o.disableTransport.includes(c.transport)),u=(i=(s=w_(l,c=>c.transport===a))==null?void 0:s.method)!==null&&i!==void 0?i:l[0].method;if(!u)throw new Error("No available transport method");u(o)})(j({},e,{callback:n=>{var r,i;this.rateLimiter.checkForLimiting(n),n.statusCode>=400&&((r=(i=this.config).on_request_error)==null||r.call(i,n)),e.callback==null||e.callback(n)}}))))}js(e){this.Ls?this.Ls.retriableRequest(e):this.Oe(e)}_execute_array(e){var n,r=[],i=[],s=[];Vr(e,a=>{a&&(n=a[0],Ce(n)?s.push(a):cn(a)?a.call(this):Ce(a)&&n==="alias"?r.push(a):Ce(a)&&n.indexOf("capture")!==-1&&cn(this[n])?s.push(a):i.push(a))});var o=function(a,l){Vr(a,function(u){if(Ce(u[0])){var c=l;Se(u,function(f){c=c[f[0]].apply(c,f.slice(1))})}else this[u[0]].apply(this,u.slice(1))},l)};o(r,this),o(i,this),o(s,this)}Ns(){var e,n;return((e=this.config.bootstrap)==null?void 0:e.featureFlags)&&Object.keys((n=this.config.bootstrap)==null?void 0:n.featureFlags).length>0||!1}push(e){this._execute_array([e])}capture(e,n,r){var i;if(this.__loaded&&this.persistence&&this.sessionPersistence&&this.Ds){if(this.is_capturing())if(!D(e)&&Ue(e)){if(this.config.opt_out_useragent_filter||!this._is_bot()){var s=r!=null&&r.skip_client_rate_limiting?void 0:this.rateLimiter.clientRateLimitContext();if(s==null||!s.isRateLimited){n!=null&&n.$current_url&&!Ue(n==null?void 0:n.$current_url)&&(U.error("Invalid `$current_url` property provided to `posthog.capture`. Input must be a string. Ignoring provided value."),n==null||delete n.$current_url),this.sessionPersistence.update_search_keyword(),this.config.save_campaign_params&&this.sessionPersistence.update_campaign_params(),this.config.save_referrer&&this.sessionPersistence.update_referrer_info(),(this.config.save_campaign_params||this.config.save_referrer)&&this.persistence.set_initial_person_info();var o=new Date,a=(r==null?void 0:r.timestamp)||o,l=Gr(),u={uuid:l,event:e,properties:this.calculateEventProperties(e,n||{},a,l)};s&&(u.properties.$lib_rate_limit_remaining_tokens=s.remainingTokens),r!=null&&r.$set&&(u.$set=r==null?void 0:r.$set);var c,f=this.Hs(r==null?void 0:r.$set_once);if(f&&(u.$set_once=f),(u=lR(u,r!=null&&r._noTruncate?null:this.config.properties_string_max_length)).timestamp=a,D(r==null?void 0:r.timestamp)||(u.properties.$event_time_override_provided=!0,u.properties.$event_time_override_system_time=o),e===Nu.DISMISSED||e===Nu.SENT){var d=n==null?void 0:n[c1.SURVEY_ID],h=n==null?void 0:n[c1.SURVEY_ITERATION];c={id:d,current_iteration:h},localStorage.getItem(f1(c))||localStorage.setItem(f1(c),"true"),u.$set=j({},u.$set,{[NT({id:d,current_iteration:h},e===Nu.SENT?"responded":"dismissed")]:!0})}var p=j({},u.properties.$set,u.$set);if(Ss(p)||this.setPersonPropertiesForFlags(p),!me(this.config.before_send)){var v=this.Ws(u);if(!v)return;u=v}this.Is.emit("eventCaptured",u);var w={method:"POST",url:(i=r==null?void 0:r._url)!==null&&i!==void 0?i:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),data:u,compression:"best-available",batchKey:r==null?void 0:r._batchKey};return!this.config.request_batching||r&&(r==null||!r._batchKey)||r!=null&&r.send_instantly?this.js(w):this.Ds.enqueue(w),u}U.critical("This capture call is ignored due to client rate limiting.")}}else U.error("No event name provided to posthog.capture")}else U.uninitializedWarning("posthog.capture")}Ze(e){return this.on("eventCaptured",n=>e(n.event,n))}calculateEventProperties(e,n,r,i,s){if(r=r||new Date,!this.persistence||!this.sessionPersistence)return n;var o=s?void 0:this.persistence.remove_event_timer(e),a=j({},n);if(a.token=this.config.token,a.$config_defaults=this.config.defaults,(this.config.cookieless_mode=="always"||this.config.cookieless_mode=="on_reject"&&this.consent.isExplicitlyOptedOut())&&(a.$cookieless_mode=!0),e==="$snapshot"){var l=j({},this.persistence.properties(),this.sessionPersistence.properties());return a.distinct_id=l.distinct_id,(!Ue(a.distinct_id)&&!mt(a.distinct_id)||Qf(a.distinct_id))&&U.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),a}var u,c=AT(this.config.mask_personal_data_properties,this.config.custom_personal_data_properties);if(this.sessionManager){var{sessionId:f,windowId:d}=this.sessionManager.checkAndGetSessionAndWindowId(s,r.getTime());a.$session_id=f,a.$window_id=d}this.sessionPropsManager&&Ve(a,this.sessionPropsManager.getSessionProps());try{var h;this.sessionRecording&&Ve(a,this.sessionRecording.sdkDebugProperties),a.$sdk_debug_retry_queue_size=(h=this.Ls)==null?void 0:h.length}catch(m){a.$sdk_debug_error_capturing_properties=String(m)}if(this.requestRouter.region===pa.CUSTOM&&(a.$lib_custom_api_host=this.config.api_host),u=e!=="$pageview"||s?e!=="$pageleave"||s?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(r):this.pageViewManager.doPageView(r,i),a=Ve(a,u),e==="$pageview"&&B&&(a.title=B.title),!D(o)){var p=r.getTime()-o;a.$duration=parseFloat((p/1e3).toFixed(3))}Nt&&this.config.opt_out_useragent_filter&&(a.$browser_type=this._is_bot()?"bot":"browser"),(a=Ve({},c,this.persistence.properties(),this.sessionPersistence.properties(),a)).$is_identified=this._isIdentified(),Ce(this.config.property_denylist)?Se(this.config.property_denylist,function(m){delete a[m]}):U.error("Invalid value for property_denylist config: "+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);var v=this.config.sanitize_properties;v&&(U.error("sanitize_properties is deprecated. Use before_send instead"),a=v(a,e));var w=this.Gs();return a.$process_person_profile=w,w&&!s&&this.Vs("_calculate_event_properties"),a}Hs(e){var n;if(!this.persistence||!this.Gs()||this.Rs)return e;var r=this.persistence.get_initial_props(),i=(n=this.sessionPropsManager)==null?void 0:n.getSetOnceProps(),s=Ve({},r,i||{},e||{}),o=this.config.sanitize_properties;return o&&(U.error("sanitize_properties is deprecated. Use before_send instead"),s=o(s,"$set_once")),this.Rs=!0,Ss(s)?void 0:s}register(e,n){var r;(r=this.persistence)==null||r.register(e,n)}register_once(e,n,r){var i;(i=this.persistence)==null||i.register_once(e,n,r)}register_for_session(e){var n;(n=this.sessionPersistence)==null||n.register(e)}unregister(e){var n;(n=this.persistence)==null||n.unregister(e)}unregister_for_session(e){var n;(n=this.sessionPersistence)==null||n.unregister(e)}Js(e,n){this.register({[e]:n})}getFeatureFlag(e,n){return this.featureFlags.getFeatureFlag(e,n)}getFeatureFlagPayload(e){var n=this.featureFlags.getFeatureFlagPayload(e);try{return JSON.parse(n)}catch{return n}}isFeatureEnabled(e,n){return this.featureFlags.isFeatureEnabled(e,n)}reloadFeatureFlags(){this.featureFlags.reloadFeatureFlags()}updateEarlyAccessFeatureEnrollment(e,n,r){this.featureFlags.updateEarlyAccessFeatureEnrollment(e,n,r)}getEarlyAccessFeatures(e,n,r){return n===void 0&&(n=!1),this.featureFlags.getEarlyAccessFeatures(e,n,r)}on(e,n){return this.Is.on(e,n)}onFeatureFlags(e){return this.featureFlags.onFeatureFlags(e)}onSurveysLoaded(e){return this.surveys.onSurveysLoaded(e)}onSessionId(e){var n,r;return(n=(r=this.sessionManager)==null?void 0:r.onSessionId(e))!==null&&n!==void 0?n:()=>{}}getSurveys(e,n){n===void 0&&(n=!1),this.surveys.getSurveys(e,n)}getActiveMatchingSurveys(e,n){n===void 0&&(n=!1),this.surveys.getActiveMatchingSurveys(e,n)}renderSurvey(e,n){this.surveys.renderSurvey(e,n)}displaySurvey(e,n){n===void 0&&(n=zT),this.surveys.displaySurvey(e,n)}canRenderSurvey(e){return this.surveys.canRenderSurvey(e)}canRenderSurveyAsync(e,n){return n===void 0&&(n=!1),this.surveys.canRenderSurveyAsync(e,n)}identify(e,n,r){if(!this.__loaded||!this.persistence)return U.uninitializedWarning("posthog.identify");if(mt(e)&&(e=e.toString(),U.warn("The first argument to posthog.identify was a number, but it should be a string. It has been converted to a string.")),e)if(["distinct_id","distinctid"].includes(e.toLowerCase()))U.critical('The string "'+e+'" was set in posthog.identify which indicates an error. This ID should be unique to the user and not a hardcoded string.');else if(e!==ea){if(this.Vs("posthog.identify")){var i=this.get_distinct_id();if(this.register({$user_id:e}),!this.get_property("$device_id")){var s=i;this.register_once({$had_persisted_distinct_id:!0,$device_id:s},"")}e!==i&&e!==this.get_property(Qo)&&(this.unregister(Qo),this.register({distinct_id:e}));var o=(this.persistence.get_property(fr)||"anonymous")==="anonymous";e!==i&&o?(this.persistence.set_property(fr,"identified"),this.setPersonPropertiesForFlags(j({},r||{},n||{}),!1),this.capture("$identify",{distinct_id:e,$anon_distinct_id:i},{$set:n||{},$set_once:r||{}}),this.Ms=Mw(e,n,r),this.featureFlags.setAnonymousDistinctId(i)):(n||r)&&this.setPersonProperties(n,r),e!==i&&(this.reloadFeatureFlags(),this.unregister(pu))}}else U.critical('The string "'+ea+'" was set in posthog.identify which indicates an error. This ID is only used as a sentinel value.');else U.error("Unique user id has not been set in posthog.identify")}setPersonProperties(e,n){if((e||n)&&this.Vs("posthog.setPersonProperties")){var r=Mw(this.get_distinct_id(),e,n);this.Ms!==r?(this.setPersonPropertiesForFlags(j({},n||{},e||{})),this.capture("$set",{$set:e||{},$set_once:n||{}}),this.Ms=r):U.info("A duplicate setPersonProperties call was made with the same properties. It has been ignored.")}}group(e,n,r){if(e&&n){if(this.Vs("posthog.group")){var i=this.getGroups();i[e]!==n&&this.resetGroupPropertiesForFlags(e),this.register({$groups:j({},i,{[e]:n})}),r&&(this.capture("$groupidentify",{$group_type:e,$group_key:n,$group_set:r}),this.setGroupPropertiesForFlags({[e]:r})),i[e]===n||r||this.reloadFeatureFlags()}}else U.error("posthog.group requires a group type and group key")}resetGroups(){this.register({$groups:{}}),this.resetGroupPropertiesForFlags(),this.reloadFeatureFlags()}setPersonPropertiesForFlags(e,n){n===void 0&&(n=!0),this.featureFlags.setPersonPropertiesForFlags(e,n)}resetPersonPropertiesForFlags(){this.featureFlags.resetPersonPropertiesForFlags()}setGroupPropertiesForFlags(e,n){n===void 0&&(n=!0),this.Vs("posthog.setGroupPropertiesForFlags")&&this.featureFlags.setGroupPropertiesForFlags(e,n)}resetGroupPropertiesForFlags(e){this.featureFlags.resetGroupPropertiesForFlags(e)}reset(e){var n,r,i,s;if(U.info("reset"),!this.__loaded)return U.uninitializedWarning("posthog.reset");var o=this.get_property("$device_id");if(this.consent.reset(),(n=this.persistence)==null||n.clear(),(r=this.sessionPersistence)==null||r.clear(),this.surveys.reset(),this.featureFlags.reset(),(i=this.persistence)==null||i.set_property(fr,"anonymous"),(s=this.sessionManager)==null||s.resetSessionId(),this.Ms=null,this.config.cookieless_mode==="always")this.register_once({distinct_id:ea,$device_id:null},"");else{var a=this.config.get_device_id(Gr());this.register_once({distinct_id:a,$device_id:e?a:o},"")}this.register({$last_posthog_reset:new Date().toISOString()},1)}get_distinct_id(){return this.get_property("distinct_id")}getGroups(){return this.get_property("$groups")||{}}get_session_id(){var e,n;return(e=(n=this.sessionManager)==null?void 0:n.checkAndGetSessionAndWindowId(!0).sessionId)!==null&&e!==void 0?e:""}get_session_replay_url(e){if(!this.sessionManager)return"";var{sessionId:n,sessionStartTimestamp:r}=this.sessionManager.checkAndGetSessionAndWindowId(!0),i=this.requestRouter.endpointFor("ui","/project/"+this.config.token+"/replay/"+n);if(e!=null&&e.withTimestamp&&r){var s,o=(s=e.timestampLookBack)!==null&&s!==void 0?s:10;if(!r)return i;i+="?t="+Math.max(Math.floor((new Date().getTime()-r)/1e3)-o,0)}return i}alias(e,n){return e===this.get_property(b_)?(U.critical("Attempting to create alias for existing People user - aborting."),-2):this.Vs("posthog.alias")?(D(n)&&(n=this.get_distinct_id()),e!==n?(this.Js(Qo,e),this.capture("$create_alias",{alias:e,distinct_id:n})):(U.warn("alias matches current distinct_id - skipping api call."),this.identify(e),-1)):void 0}set_config(e){var n=j({},this.config);if(He(e)){var r,i,s,o,a;Ve(this.config,b1(e));var l=this.As();(r=this.persistence)==null||r.update_config(this.config,n,l),this.sessionPersistence=this.config.persistence==="sessionStorage"||this.config.persistence==="memory"?this.persistence:new Gh(j({},this.config,{persistence:"sessionStorage"}),l),et.G()&&et.J("ph_debug")==="true"&&(this.config.debug=!0),this.config.debug&&(cr.DEBUG=!0,U.info("set_config",{config:e,oldConfig:n,newConfig:j({},this.config)})),(i=this.sessionRecording)==null||i.startIfEnabledOrStop(),(s=this.autocapture)==null||s.startIfEnabled(),(o=this.heatmaps)==null||o.startIfEnabled(),this.surveys.loadIfEnabled(),this.Ks(),(a=this.externalIntegrations)==null||a.startIfEnabledOrStop()}}startSessionRecording(e){var n=e===!0,r={sampling:n||!(e==null||!e.sampling),linked_flag:n||!(e==null||!e.linked_flag),url_trigger:n||!(e==null||!e.url_trigger),event_trigger:n||!(e==null||!e.event_trigger)};if(Object.values(r).some(Boolean)){var i,s,o,a,l;(i=this.sessionManager)==null||i.checkAndGetSessionAndWindowId(),r.sampling&&((s=this.sessionRecording)==null||s.overrideSampling()),r.linked_flag&&((o=this.sessionRecording)==null||o.overrideLinkedFlag()),r.url_trigger&&((a=this.sessionRecording)==null||a.overrideTrigger("url")),r.event_trigger&&((l=this.sessionRecording)==null||l.overrideTrigger("event"))}this.set_config({disable_session_recording:!1})}stopSessionRecording(){this.set_config({disable_session_recording:!0})}sessionRecordingStarted(){var e;return!((e=this.sessionRecording)==null||!e.started)}captureException(e,n){var r=new Error("PostHog syntheticException"),i=this.exceptions.buildProperties(e,{handled:!0,syntheticException:r});return this.exceptions.sendExceptionEvent(j({},i,n))}loadToolbar(e){return this.toolbar.loadToolbar(e)}get_property(e){var n;return(n=this.persistence)==null?void 0:n.props[e]}getSessionProperty(e){var n;return(n=this.sessionPersistence)==null?void 0:n.props[e]}toString(){var e,n=(e=this.config.name)!==null&&e!==void 0?e:Ls;return n!==Ls&&(n=Ls+"."+n),n}_isIdentified(){var e,n;return((e=this.persistence)==null?void 0:e.get_property(fr))==="identified"||((n=this.sessionPersistence)==null?void 0:n.get_property(fr))==="identified"}Gs(){var e,n;return!(this.config.person_profiles==="never"||this.config.person_profiles==="identified_only"&&!this._isIdentified()&&Ss(this.getGroups())&&((e=this.persistence)==null||(e=e.props)==null||!e[Qo])&&((n=this.persistence)==null||(n=n.props)==null||!n[gu]))}qs(){return this.config.capture_pageleave===!0||this.config.capture_pageleave==="if_capture_pageview"&&(this.config.capture_pageview===!0||this.config.capture_pageview==="history_change")}createPersonProfile(){this.Gs()||this.Vs("posthog.createPersonProfile")&&this.setPersonProperties({},{})}Vs(e){return this.config.person_profiles==="never"?(U.error(e+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this.Js(gu,!0),!0)}As(){if(this.config.cookieless_mode==="always")return!0;var e=this.consent.isOptedOut(),n=this.config.opt_out_persistence_by_default||this.config.cookieless_mode==="on_reject";return this.config.disable_persistence||e&&!!n}Ks(){var e,n,r,i,s=this.As();return((e=this.persistence)==null?void 0:e.Ue)!==s&&((r=this.persistence)==null||r.set_disabled(s)),((n=this.sessionPersistence)==null?void 0:n.Ue)!==s&&((i=this.sessionPersistence)==null||i.set_disabled(s)),s}opt_in_capturing(e){if(this.config.cookieless_mode!=="always"){var n;this.config.cookieless_mode==="on_reject"&&this.consent.isExplicitlyOptedOut()&&(this.reset(!0),this.sessionManager=new v1(this),this.persistence&&(this.sessionPropsManager=new p1(this,this.sessionManager,this.persistence)),this.sessionRecording=new kw(this),this.sessionRecording.startIfEnabledOrStop()),this.consent.optInOut(!0),this.Ks(),this.config.cookieless_mode=="on_reject"&&this.surveys.loadIfEnabled(),(D(e==null?void 0:e.captureEventName)||e!=null&&e.captureEventName)&&this.capture((n=e==null?void 0:e.captureEventName)!==null&&n!==void 0?n:"$opt_in",e==null?void 0:e.captureProperties,{send_instantly:!0}),this.config.capture_pageview&&this.Bs()}else U.warn('Consent opt in/out is not valid with cookieless_mode="always" and will be ignored')}opt_out_capturing(){var e;this.config.cookieless_mode!=="always"?(this.config.cookieless_mode==="on_reject"&&this.consent.isOptedIn()&&this.reset(!0),this.consent.optInOut(!1),this.Ks(),this.config.cookieless_mode==="on_reject"&&(this.register({distinct_id:ea,$device_id:null}),this.sessionManager=void 0,this.sessionPropsManager=void 0,(e=this.sessionRecording)==null||e.stopRecording(),this.sessionRecording=void 0,this.Bs())):U.warn('Consent opt in/out is not valid with cookieless_mode="always" and will be ignored')}has_opted_in_capturing(){return this.consent.isOptedIn()}has_opted_out_capturing(){return this.consent.isOptedOut()}get_explicit_consent_status(){var e=this.consent.consent;return e===pr.GRANTED?"granted":e===pr.DENIED?"denied":"pending"}is_capturing(){return this.config.cookieless_mode==="always"||(this.config.cookieless_mode==="on_reject"?this.consent.isExplicitlyOptedOut()||this.consent.isOptedIn():!this.has_opted_out_capturing())}clear_opt_in_out_capturing(){this.consent.reset(),this.Ks()}_is_bot(){return Xt?m1(Xt,this.config.custom_blocked_useragents):void 0}Bs(){B&&(B.visibilityState==="visible"?this.Ps||(this.Ps=!0,this.capture("$pageview",{title:B.title},{send_instantly:!0}),this.Ts&&(B.removeEventListener("visibilitychange",this.Ts),this.Ts=null)):this.Ts||(this.Ts=this.Bs.bind(this),Ne(B,"visibilitychange",this.Ts)))}debug(e){e===!1?(E==null||E.console.log("You've disabled debug mode."),localStorage&&localStorage.removeItem("ph_debug"),this.set_config({debug:!1})):(E==null||E.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}))}L(){var e,n,r,i,s,o,a,l=this.Os||{};return"advanced_disable_flags"in l?!!l.advanced_disable_flags:this.config.advanced_disable_flags!==!1?!!this.config.advanced_disable_flags:this.config.advanced_disable_decide===!0?(U.warn("Config field 'advanced_disable_decide' is deprecated. Please use 'advanced_disable_flags' instead. The old field will be removed in a future major version."),!0):(r="advanced_disable_decide",i=!1,s=U,o=(n="advanced_disable_flags")in(e=l)&&!D(e[n]),a=r in e&&!D(e[r]),o?e[n]:a?(s&&s.warn("Config field '"+r+"' is deprecated. Please use '"+n+"' instead. The old field will be removed in a future major version."),e[r]):i)}Ws(e){if(me(this.config.before_send))return e;var n=Ce(this.config.before_send)?this.config.before_send:[this.config.before_send],r=e;for(var i of n){if(r=i(r),me(r)){var s="Event '"+e.event+"' was rejected in beforeSend function";return L3(e.event)?U.warn(s+". This can cause unexpected behavior."):U.info(s),null}r.properties&&!Ss(r.properties)||U.warn("Event '"+e.event+"' has no properties after beforeSend function, this is likely an error.")}return r}getPageViewId(){var e;return(e=this.pageViewManager.pe)==null?void 0:e.pageViewId}captureTraceFeedback(e,n){this.capture("$ai_feedback",{$ai_trace_id:String(e),$ai_feedback_text:n})}captureTraceMetric(e,n,r){this.capture("$ai_metric",{$ai_trace_id:String(e),$ai_metric_name:n,$ai_metric_value:String(r)})}}(function(t,e){for(var n=0;n<e.length;n++)t.prototype[e[n]]=aR(t.prototype[e[n]])})(ju,["identify"]);var x1,tp=(x1=ga[Ls]=new ju,function(){function t(){t.done||(t.done=!0,_1=!1,Se(ga,function(e){e._dom_loaded()}))}B!=null&&B.addEventListener?B.readyState==="complete"?t():Ne(B,"DOMContentLoaded",t,{capture:!1}):E&&U.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")}(),x1);console.info("Vehicle Search v3.0.43 powered by Partbot https://mmyvs.partbot.io");function zu(t=[],e=[]){const n=[];return t.forEach(r=>{const[i,...s]=r.split(":"),o=s.join(":");if(o.includes(" > ")){const a=o.split(" > "),l=a[a.length-1].trim();if(i!=="make"&&a.length>=2){const u=a[0].trim();n.push(`make = "${u}"`)}n.push(`${i} = "${l}"`)}else n.push(`${i} = "${o}"`)}),e.forEach(r=>{n.push(r)}),n.length>0?n.join(" AND "):null}function ct(t){return String(t||"").normalize("NFKD").replace(/[\u0300-\u036f]/g,"").toUpperCase().trim().replace(/\s+/g," ")}function Ds(t){return String(t||"").split(">").pop().trim()}function np(t,e,n){return!n||n.size===0||!Array.isArray(t)||!t.some(i=>n.has(ct(e(i))))?t:t.filter(i=>n.has(ct(e(i))))}function rp({apiKey:t,makes:e="",models:n="",vehicleScopeTokens:r="",yearTokens:i="",callbackUrl:s="",layout:o="row",fields:a,fieldPrefix:l="",showBranding:u=!0,showLabels:c=!1,mobileFullWidthButton:f=!0,mobileDrawer:d=!0,modifyQueryString:h=!0,onChange:p,buttonLabel:v="Search",showButton:w=!0,onSubmit:m,store:g,useStoreVehicles:y=!0,fieldOrder:b="MMY",enableFeatureFlags:x=!0,yearOptional:k=!1,mobileButtonLabel:$="Select Vehicle"}){const C=_.useRef(null),q=_.useRef(null),I=_.useRef(null),F=_.useRef(null),N=_.useRef(null),G=_.useRef(null),Y=_.useRef(null),H=_.useRef(null),te=_.useRef(null),ee=_.useRef(!1),R=b==="YMM",[L,z]=_.useState([]),[oe,P]=_.useState([]),[ae,J]=_.useState([]),[be,ie]=_.useState([]),[Me,_e]=_.useState([]),[hn,Tt]=_.useState([]),[Be,Di]=_.useState([]),[Ns,Ni]=_.useState([]),Hu=_.useRef([]),[Yn,gr]=_.useState([]),[S,Jt]=_.useState({make:null,model:null,year:null,body:null,series:null,variant:null,engine:null,engine_capacity:null}),[cP,ip]=_.useState(!1),S1=_.useRef(["body","series","variant","engine","engine_capacity"]),Uu=_.useRef(a&&a.length&&S1.current?a.split(",").filter(T=>{var O;return(O=S1.current)==null?void 0:O.includes(T)}):null),[E1,ya]=_.useState({}),Qn=_.useMemo(()=>!e||typeof e!="string"?new Set:new Set(e.trim().split(",").map(T=>ct(T)).filter(Boolean)),[e]),mr=_.useMemo(()=>new Set(Object.keys(E1||{}).map(T=>ct(T))),[E1]),[Mn,dP]=_.useState(!1);_.useEffect(()=>{const T=navigator.userAgent;dP(/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(T)),tp.__loaded||tp.init("phc_mLZkVvweXDfwCPYS7kSCxoAxgQUkw8fgyDiplKnleGw",{api_host:"https://t.partbot.io",ui_host:"https://us.posthog.com",defaults:"2026-01-30",autocapture:!1,capture_pageview:!1,capture_pageleave:!1,disable_session_recording:!1})},[]);const[Zr,fP]=_.useState({}),[MP,hP]=_.useState(""),$1=_.useCallback(async()=>{if(!t)return;const O=`${x?"https://api.cartbot.io":"https://api.partbot.io"}/v1/vehicles/auth`;try{const K=await fetch(O,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${t}`},body:JSON.stringify((()=>{const ve={use_store_vehicles:y};return g&&(ve.store=g),ve})())});if(!K.ok)throw new Error(`Error: ${K.status} ${K.statusText}`);const{merchant:W,vehicle_makes:le,vehicle_models:Q,meilisearch_search_key:pe,meilisearch_index_name:ne,algolia_search_key:re,algolia_index_name:Ke,store_index_name:Ye,store_popular_makes:fe,store_popular_models:ke}=await K.json(),je=le||[],Qe=Q;q.current=W,I.current=je.map(ve=>({...ve,refinement:ve.value})),y&&Qe?typeof Qe=="object"&&!Array.isArray(Qe)?(F.current=Qe,ya(Qe)):Array.isArray(Qe)?(F.current=Qe.map(ve=>ve&&ve.value?String(ve.value).trim():"").filter(Boolean),ya({})):(F.current=[],ya({})):(F.current=[],ya({})),N.current=Array.isArray(fe)?fe.map(ve=>String(ve).trim().toUpperCase()):null,G.current=ke||null,fP({searchKey:"eeace38b64f52bf56ebb4fe8bd5837b3cd6c0ff9d7e272f76449d94b80cba86b",indexName:"otto_v1_vehicles_production"})}catch(K){console.error("[VehicleSearch] Auth failed:",K),hP(K),ya({})}},[t,g,y,x]);_.useEffect(()=>{$1()},[$1]),_.useEffect(()=>{if(Zr.searchKey){try{Y.current=new Ly({host:"https://search.partbot.io",apiKey:Zr.searchKey}),H.current=Y.current.index(Zr.indexName);const T=new Ly({host:"https://partbot-meilisearch-cache.partbot.workers.dev",apiKey:Zr.searchKey});te.current=T.index("otto_v1_vehicle_mmy")}catch(T){console.error("[VehicleSearch] Failed to initialize Meilisearch:",T)}return()=>{Y.current=null}}},[Zr.searchKey,t]);const[pn,pP]=_.useState(!1),C1=_.useCallback(()=>{function T(Q){if(!Q)return"rgba(0,0,0,1)";var pe=O(),ne=window.getComputedStyle(Q).backgroundColor;return ne!==pe?ne:Q.parentElement?T(Q.parentElement):"rgba(255,255,255,1)"}function O(){var Q=document.createElement("div");document.head.appendChild(Q);var pe=window.getComputedStyle(Q).backgroundColor;return document.head.removeChild(Q),pe}const K=document.querySelector("vehicle-search");let W;K?W=T(K):W=T(C.current);const le=X(W).isDark();pP(le)},[]);_.useEffect(()=>{async function T(){if(!S.make||!H.current)return;let O=[],K=[];S.make&&O.push(`make:${S.make.refinement}`),S.model&&O.push(`model:${S.make.refinement} > ${S.model.refinement}`),S.year&&(K=[`year_from <= ${S.year.value}`,`year_to >= ${S.year.value}`]),S.body&&O.push(`body:${S.make.refinement} > ${S.model.refinement} > ${S.body.refinement}`),S.series&&O.push(`series:${S.series.refinement}`),S.engine&&O.push(`engine:${S.engine.refinement}`),S.engine_capacity&&O.push(`engine_capacity:${S.engine_capacity.refinement}`);let le=(await H.current.search("",{filter:zu(O,K),attributesToRetrieve:["otto_id"],limit:500})).hits.map(ne=>ne.otto_id);gr(le);let pe={...Object.fromEntries(Object.entries(S||{}).map(([ne,re])=>[ne,re&&re.value||null]).filter(([ne,re])=>re!==null)),merchant:q.current};tp.capture("vehicle select",pe)}T()},[S,H,k]);const sp=T=>l?`${l}${T}`:T,vP=T=>l?T.replace(new RegExp(`^${l}`),""):T,R1=_.useCallback(()=>{const T=new URL(window.location.href).searchParams,O=["make","model","year","body","series","engine","engine_capacity"],K=O.map(sp),W={},le=/^filter\.p\.m\.app--\d+--partbot\.vehicle_(\w+)$/;for(const[ne,re]of T.entries()){const Ke=ne.match(le);if(Ke){const Ye=Ke[1];if(Ye==="year_tokens"&&re){const ke=re.split("|");if(ke.length>=3){const je=ke[2].trim();/^\d{4}$/.test(je)&&(W.year=je)}continue}let fe=Ye.replace(/s$/,"");fe==="engine_capacitie"&&(fe="engine_capacity"),fe==="bodie"&&(fe="body"),fe==="serie"&&(fe="series"),O.includes(fe)&&(W[fe]=re)}}const Q=Object.fromEntries([...T.entries()].filter(([ne])=>K.includes(ne)).map(([ne,re])=>{const Ke=vP(ne);if(Ke==="year"&&re&&/^\d{4}$/.test(re)){const Ye=parseInt(re,10);return[Ke,{value:Ye,refinement:Ye}]}return[Ke,{value:re,refinement:re}]}));for(const[ne,re]of Object.entries(W))if(re&&re!=="[object Object]"&&!Q[ne])if(ne==="year"&&/^\d{4}$/.test(re)){const Ke=parseInt(re,10);Q[ne]={value:Ke,refinement:Ke}}else Q[ne]={value:re,refinement:re};if(!(Object.keys(Q).length>0))try{const ne=localStorage.getItem("partbot_selected_vehicle");if(ne){const re=JSON.parse(ne);if(re!=null&&re.vehicle){const Ke=re.vehicle;for(const Ye of O){const fe=Ke[Ye];if(fe&&typeof fe=="string"&&fe.trim())if(Ye==="year"&&/^\d{4}$/.test(fe)){const ke=parseInt(fe,10);Q[Ye]={value:ke,refinement:ke}}else Q[Ye]={value:fe,refinement:fe};else if(fe!=null&&fe.value&&typeof fe.value=="string")if(Ye==="year"&&/^\d{4}$/.test(fe.value)){const ke=parseInt(fe.value,10);Q[Ye]={value:ke,refinement:ke}}else Q[Ye]={value:fe.value,refinement:fe.value}}}}}catch{}Jt(Q)},[]),wt=_.useCallback(({query:T,value:O,remove:K})=>{if(h&&"URLSearchParams"in window){let W=new URLSearchParams(window.location.search);T=sp(T),T&&O&&W.set(T,O),T&&!O&&W.delete(T),K&&K.forEach(Q=>{Q=sp(Q),W.delete(Q)});const le=window.location.pathname+"?"+W.toString();window.history.pushState(null,"",le)}},[]),gP=_.useCallback(()=>{var K;const T={vehicle_ids:Yn,vehicle:(K=S==null?void 0:S.make)!=null&&K.value?S:{}};m&&m(T);const O=new CustomEvent("vehicle-search-submit",{detail:T});window.dispatchEvent(O),document.dispatchEvent(O),setTimeout(()=>{ip(!1)},900)},[Yn,m]),T1=_.useCallback(()=>{var K,W,le,Q,pe,ne,re,Ke,Ye;const T={vehicle_ids:Yn,vehicle:(K=S==null?void 0:S.make)!=null&&K.value?S:{},userSelected:ee.current};p&&p(T);const O=new CustomEvent("vehicle-search-change",{detail:T});if(ee.current===!0){localStorage.removeItem("partbot_plate_details");const fe=JSON.stringify({description:`${((W=S.make)==null?void 0:W.value)||""} ${((le=S.model)==null?void 0:le.value)||""} ${((Q=S.year)==null?void 0:Q.value)||""} ${((pe=S.body)==null?void 0:pe.value)||""} ${((ne=S.series)==null?void 0:ne.value)||""} ${((re=S.variant)==null?void 0:re.value)||""} ${((Ke=S.engine)==null?void 0:Ke.value)||""} ${((Ye=S.engine_capacity)==null?void 0:Ye.value)||""}`.trim(),vehicle_ids:Yn,vehicle:S?Object.entries(S).reduce((ke,[je,Qe])=>(ke[je]=Qe!=null&&Qe.value?Qe.value:{},ke),{}):{}});localStorage.setItem("partbot_selected_vehicle",fe),hk.set("partbot_selected_vehicle",fe,{secure:!0})}window.dispatchEvent(O),ee.current&&document.dispatchEvent(O),Hu.current=Yn,setTimeout(()=>{ip(!1)},900)},[Yn,p]),Jr=_.useMemo(()=>l3(T1,100),[T1]);_.useEffect(()=>{Jr()},[Yn,Jr]),_.useEffect(()=>()=>{Jr.cancel()},[Jr]),_.useEffect(()=>{const T=()=>{ee.current=!1,Jr.cancel(),Jt({make:null,model:null,year:null,body:null,series:null,variant:null,engine:null,engine_capacity:null}),gr([])};return window.addEventListener("plate-search-change",T),()=>{window.removeEventListener("plate-search-change",T)}},[Jr]),_.useEffect(()=>{const T=()=>{ee.current=!1,Jr.cancel(),Jt({make:null,model:null,year:null,body:null,series:null,variant:null,engine:null,engine_capacity:null}),gr([])};return document.addEventListener("partbot-clear-vehicle",T),()=>{document.removeEventListener("partbot-clear-vehicle",T)}},[Jr]),_.useEffect(()=>{Zr.searchKey&&(R||xP(),R1())},[Zr.searchKey,R,R1]),_.useEffect(()=>{R&&H.current&&ae.length===0&&!S.year&&H.current.search("",{attributesToRetrieve:["year_from","year_to"],limit:1e4}).then(({hits:T})=>{const O=T.map(pe=>pe.year_from).filter(Boolean),K=T.map(pe=>pe.year_to).filter(Boolean),W=Math.min(...O),le=Math.max(...K),Q=Array.from({length:le-W+1},(pe,ne)=>({value:W+ne,refinement:W+ne})).reverse();J(Q)}).catch(T=>{console.error("[VehicleSearch] Error loading year range:",T)})},[R,Zr.searchKey,ae.length,S.year]),_.useEffect(()=>{typeof document>"u"||C1()},[C1]);const P1=_.useCallback(T=>{ee.current=!0,P([]),!R&&!k&&J([]),ie([]),_e([]),Tt([]),Ni([]),Di([]),Jt(O=>({make:T,year:R||k?O.year:null})),wt({query:"make",value:(T==null?void 0:T.value)??"",remove:R?["model","body","series","engine","variant","engine_capacity"]:k?["model","body","series","engine","variant","engine_capacity"]:["model","year","body","series","engine","variant","engine_capacity"]}),T||gr([])},[wt,R,k]),M1=_.useCallback(T=>{ee.current=!0,Jt(O=>({...O,model:T!==""?T:null,year:R||k?O.year:null,body:null,series:null,variant:null,engine:null,engine_capacity:null})),!R&&!k&&J([]),ie([]),_e([]),Tt([]),Ni([]),Di([]),wt({query:"model",value:(T==null?void 0:T.value)??"",remove:R?["body","series","engine","variant","engine_capacity"]:k?["body","series","engine","variant","engine_capacity"]:["year","body","series","engine","variant","engine_capacity"]})},[wt,R,k]),O1=_.useCallback(T=>{ee.current=!0,R?(z([]),P([]),Jt({year:T!==""?T:null}),(!T||T==="")&&J([])):Jt(k?O=>({...O,year:T!==""?T:null}):O=>({...O,year:T!==""?T:null,body:null,series:null,variant:null,engine:null,engine_capacity:null})),k||(ie([]),_e([]),Tt([]),Ni([]),Di([])),wt({query:"year",value:(T==null?void 0:T.value)??"",remove:R?["make","model","body","series","variant","engine","engine_capacity"]:k?[]:["body","series","variant","engine","engine_capacity"]}),!k&&(!T||T==="")&&gr([])},[wt,R,k]),mP=_.useCallback(T=>{ee.current=!0,Jt(O=>({...O,body:T!==""?T:null})),wt({query:"body",value:(T==null?void 0:T.value)??""})},[wt]),yP=_.useCallback(T=>{ee.current=!0,Jt(O=>({...O,series:T!==""?T:null})),wt({query:"series",value:(T==null?void 0:T.value)??""})},[wt]),_P=_.useCallback(T=>{ee.current=!0,Jt(O=>({...O,variant:T!==""?T:null})),wt({query:"variant",value:(T==null?void 0:T.value)??""})},[wt]),wP=_.useCallback(T=>{ee.current=!0,Jt(O=>({...O,engine:T!==""?T:null})),wt({query:"engine",value:(T==null?void 0:T.value)??""})},[wt]),bP=_.useCallback(T=>{ee.current=!0,Jt(O=>({...O,engine_capacity:T!==""?T:null})),wt({query:"engine_capacity",value:(T==null?void 0:T.value)??""})},[wt]);_.useEffect(()=>{R&&S.year&&H.current&&(async()=>{try{const O=await H.current.search("",{filter:`year_from <= ${S.year.value} AND year_to >= ${S.year.value}`,attributesToRetrieve:["make","make_popularity"],limit:1e4}),K=new Map;O.hits.forEach(Q=>{Q.make&&!K.has(Q.make)&&K.set(Q.make,{value:Q.make.toUpperCase(),refinement:Q.make.toUpperCase(),popularity:Q.make_popularity||0})});let W=Array.from(K.values());Qn.size>0?W=W.filter(Q=>Qn.has(ct(Q.value))):mr.size>0&&(W=W.filter(Q=>mr.has(ct(Q.value))));const le=new Set(N.current||[]);le.size>0?W.sort((Q,pe)=>{const ne=le.has(Q.value),re=le.has(pe.value);return ne&&!re?-1:!ne&&re?1:ne&&re?N.current.indexOf(Q.value)-N.current.indexOf(pe.value):Q.value.localeCompare(pe.value)}):W.sort((Q,pe)=>pe.popularity===Q.popularity?Q.value.localeCompare(pe.value):pe.popularity-Q.popularity),z(W)}catch(O){console.error("[VehicleSearch] Error loading makes for year:",O)}})()},[R,S.year,Qn,mr]);const xP=_.useCallback(()=>{(async()=>{let O=[];if(I.current&&I.current.length)O=I.current;else if(H.current)try{const K=await H.current.search("",{attributesToRetrieve:["make","make_popularity"],limit:1e3}),W=new Map;K.hits.forEach(le=>{le.make&&!W.has(le.make)&&W.set(le.make,{value:le.make.toUpperCase(),refinement:le.make.toUpperCase(),popularity:le.make_popularity||0})}),O=Array.from(W.values())}catch(K){console.error("[VehicleSearch] Error loading makes:",K)}if(Qn.size>0&&O.length&&(O=O.filter(K=>Qn.has(ct(K.value)))),Qn.size===0&&mr.size>0&&(O=O.filter(K=>mr.has(ct(K.value)))),N.current&&N.current.length>0){const K=new Set(N.current);O.sort((W,le)=>{const Q=K.has(W.value),pe=K.has(le.value);return Q&&!pe?-1:!Q&&pe?1:Q&&pe?N.current.indexOf(W.value)-N.current.indexOf(le.value):W.value.localeCompare(le.value)})}else O.sort((K,W)=>K.popularity===W.popularity?K.value.localeCompare(W.value):W.popularity-K.popularity);z(O)})()},[Qn,mr]);_.useEffect(()=>{var T;if(S.make&&S.make.refinement){const O=S.make.refinement,K=ct(O),W=Qn.size>0,le=mr.size>0;if(W&&!Qn.has(K)){P([]);return}if(!W&&le&&!mr.has(K)){P([]);return}const Q=n?n.trim().split(",").map(ke=>ke.trim()).filter(Boolean):[],pe=new Set(Q.map(ke=>ct(ke))),ne=typeof F.current=="object"&&!Array.isArray(F.current)&&F.current!==null?F.current:null;let re=[];if(ne&&(re=ne[O]||[],Array.isArray(re)||(re=[]),re.length===0)){const ke=Object.keys(ne).find(je=>ct(je)===K);if(ke){const je=ne[ke];re=Array.isArray(je)?je:[]}}const Ke=new Set(re.map(ke=>ct(ke))),Ye=Ke.size>0?Ke:null;let fe=pe;if(pe.size>0&&Ke.size>0&&(fe=new Set(Array.from(pe).filter(ke=>Ke.has(ke)))),pe.size>0&&fe.size===0){P([]);return}if(y&&re.length>0){let je=re.map(ve=>({value:ve,refinement:ve,popularity:0}));je=np(je,ve=>ve.value,fe),je=np(je,ve=>ve.value,Ye);const Qe=(T=G.current)==null?void 0:T[O];if(Qe&&Array.isArray(Qe)){const ve=new Map(Qe.map((en,yr)=>[en.toUpperCase(),Qe.length-yr]));je.sort((en,yr)=>{const qu=ve.get(en.value.toUpperCase())||0,ei=ve.get(yr.value.toUpperCase())||0;return qu!==ei?ei-qu:en.value.localeCompare(yr.value)})}else je.sort((ve,en)=>ve.value.localeCompare(en.value));P(je);return}if(!te.current||!t)return;te.current.search("",{filter:`make = "${S.make.refinement}"`,limit:1}).then(ke=>{var A1,I1;const{hits:je}=ke;let Qe=[];je.length>0&&je[0].models&&(Qe=je[0].models);let ve=Qe.map(Oe=>({model:`${S.make.refinement} > ${Oe.name}`,model_popularity:Oe.popularity||0})),en=[];Array.isArray(F.current)?en=F.current:typeof F.current=="object"&&F.current!==null?en=re:typeof F.current=="string"&&F.current.length&&(en=F.current.split(",").map(Oe=>Oe.trim()).filter(Boolean));let yr=en;if(fe.size>0&&(yr=en.length?en.filter(Oe=>fe.has(ct(Oe))):Q,ve=ve.filter(Oe=>fe.has(ct(Ds(Oe.model))))),yr&&yr.length>0){const Oe=new Set(yr.map(_r=>ct(_r)));ve.some(_r=>Oe.has(ct(Ds(_r.model))))&&(ve=ve.filter(_r=>Oe.has(ct(Ds(_r.model)))))}ve=np(ve,Oe=>Ds(Oe.model),Ye),ve=ve.filter(Oe=>Ds(Oe.model)!=="").map(Oe=>{const zt=Ds(Oe.model);return{value:zt,refinement:zt,popularity:Oe.model_popularity}});const qu=(A1=S.make)==null?void 0:A1.refinement,ei=(I1=G.current)==null?void 0:I1[qu];if(ei&&Array.isArray(ei)&&ei.length>0){const Oe=new Set(ei.map(zt=>String(zt).trim().toUpperCase()));ve.sort((zt,_r)=>{const ap=Oe.has(zt.value),lp=Oe.has(_r.value);if(ap&&!lp)return-1;if(!ap&&lp)return 1;if(ap&&lp){const F1=ei.map(SP=>String(SP).trim().toUpperCase());return F1.indexOf(zt.value)-F1.indexOf(_r.value)}return zt.value.localeCompare(_r.value)})}else ve.sort((Oe,zt)=>Oe.popularity===zt.popularity?Oe.value.localeCompare(zt.value):zt.popularity-Oe.popularity);P(ve)}).catch(ke=>{console.error("[VehicleSearch] Error loading models:",ke),P([])})}else P([])},[S.make,n,t,R,S.year,y,Qn,mr]),_.useEffect(()=>{if(H.current&&S.make&&S.model){let T=[`model:${S.make.refinement} > ${S.model.refinement}`];k&&(S.body&&T.push(`body:${S.make.refinement} > ${S.model.refinement} > ${S.body.refinement}`),S.series&&T.push(`series:${S.series.refinement}`),S.engine&&T.push(`engine:${S.engine.refinement}`),S.engine_capacity&&T.push(`engine_capacity:${S.engine_capacity.refinement}`)),H.current.search("",{filter:zu(T,[]),attributesToRetrieve:["year_from","year_to","otto_id"],limit:200}).then(({hits:O})=>{const K=O.map(ne=>ne.year_from),W=Math.min(...K),le=O.map(ne=>ne.year_to),Q=Math.max(...le);let pe=Array.apply(null,{length:Q+1-W}).map(function(ne,re){return re+W});pe=pe.reverse().map(ne=>({value:ne,refinement:ne})),J(pe)}).catch(O=>{console.error("[VehicleSearch] Error fetching years:",O)})}},[S.model,S.make,R,k,S.body,S.series,S.engine,S.engine_capacity]),_.useEffect(()=>{const T=k?S.make&&S.model:S.year&&S.make&&S.model;if(H.current&&T){const O=S.year?[`year_from <= ${S.year.value}`,`year_to >= ${S.year.value}`]:[];H.current.search("",{filter:zu([`model:${S.make.refinement} > ${S.model.refinement}`],O),attributesToRetrieve:["body","otto_id"],limit:1e3}).then(({hits:K})=>{K=[...new Map(K.map(W=>[W.body,W])).values()].map(W=>({value:W.body.match(/[^>]*$/)[0].trim(),refinement:W.body.match(/[^>]*$/)[0].trim()})).filter(W=>W.value),ie(K)})}},[S.year,S.make,S.model,k]);const _a=_.useCallback(({hits:T,attribute:O,stateCallback:K})=>{let W=[...new Map(T.map(le=>[le[O],le])).values()].map(le=>({value:le[O].match(/[^|]*$/)[0].trim(),refinement:le[O].match(/[^|]*$/)[0].trim()})).filter(le=>le.refinement);K(W)},[]),kP=_.useCallback(()=>{const T=Uu.current?Uu.current.length+3:3,O=w?T+1:T;return`vs:lg:grid-cols-${O>8?8:O}`},[w]);_.useEffect(()=>{const T=k?S.make&&S.model:S.make&&S.model&&S.year;if(H.current&&T){let O=[`make:${S.make.refinement}`,`model:${S.make.refinement} > ${S.model.refinement}`,S.body?`body:${S.make.refinement} > ${S.model.refinement} > ${S.body.refinement}`:"",S.series?`series:${S.series.refinement}`:"",S.variant?`variant:${S.variant.refinement}`:"",S.engine?`engine:${S.engine.refinement}`:"",S.engine_capacity?`engine_capacity:${S.engine_capacity.refinement}`:""].filter(W=>W);const K=S.year?[`year_from <= ${S.year.value}`,`year_to >= ${S.year.value}`]:[];H.current.search("",{filter:zu(O,K),attributesToRetrieve:["series","engine_capacity","engine","cylinders","variant","otto_id"],limit:1e3}).then(({hits:W})=>{_a({hits:W,attribute:"series",stateCallback:_e}),_a({hits:W,attribute:"variant",stateCallback:Tt}),_a({hits:W,attribute:"engine",stateCallback:Di}),_a({hits:W,attribute:"engine_capacity",stateCallback:Ni})})}},[S.body,S.series,S.variant,S.engine,S.engine_capacity,_a,S.make,S.model,S.year,k]);const[Bu,op]=_.useState(!1);return _.useEffect(()=>{if(d)return Bu?document.body.style.overflow="hidden":document.body.style.overflow="",()=>{document.body.style.overflow=""}},[Bu,d]),A.jsxs(A.Fragment,{children:[d&&A.jsx("button",{onClick:()=>op(!0),type:"button",className:Hr("vehicle-search-btn vs:md:hidden!",f?"vs:w-full! vs:flex! vs:shrink-0!":"vs:w-auto! vs:inline-flex! vs:shrink!"),children:A.jsx("span",{children:$})}),d&&A.jsx("div",{onClick:()=>op(!1),className:Hr("vs:z-10 vs:fixed vs:inset-0 vs:bg-stone-900 vs:transition-all vs:duration-300",Bu?"vs:opacity-75":"vs:pointer-events-none vs:opacity-0")}),A.jsxs("div",{className:Hr("partbot-mmyvs-container",d&&Bu&&"active","w-full"),children:[d&&A.jsxs("div",{className:"vs:flex vs:justify-between vs:items-center vs:pb-4 vs:font-bold vs:text-white vs:md:hidden",children:[A.jsx("span",{children:"Select Vehicle"}),A.jsxs("button",{onClick:()=>op(!1),type:"button",className:"vs:appearance-none vs:bg-transparent vs:border-none vs:ring-none vs:outline-none vs:hover:border-none vs:hover:ring-none vs:hover:outline-none",children:[A.jsx("span",{className:"vs:sr-only",children:"Close vehicle selection"}),A.jsx("span",{className:"vs:h-5 vs:w-5 vs:text-white",children:A.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"currentColor",viewBox:"0 0 256 256",className:"vs:h-5 vs:w-5",children:A.jsx("path",{d:"M208.49,191.51a12,12,0,0,1-17,17L128,145,64.49,208.49a12,12,0,0,1-17-17L111,128,47.51,64.49a12,12,0,0,1,17-17L128,111l63.51-63.52a12,12,0,0,1,17,17L145,128Z"})})})]})]}),A.jsxs("div",{ref:C,className:Hr("vs:grid vs:gap-3",o==="row"?`${kP()} vs:grid-cols-1 vs:md:grid-cols-3`:"vs:grid-cols-1 vs:md:max-w-[400px] vs:md:gap-5","vs:w-full vs:transition vs:lg:mx-auto"),children:[R?A.jsxs(A.Fragment,{children:[A.jsx(En,{label:"Year",items:ae,refine:O1,selected:S.year,bgDark:pn,showLabel:c,isMobile:Mn,sortOptions:!1,loading:ae.length===0,shouldBeActive:!0}),A.jsx(En,{label:"Make",items:L,refine:P1,selected:S.make,showPopular:!0,bgDark:pn,showLabel:c,isMobile:Mn,sortOptions:!1,loading:S.year&&L.length===0,shouldBeActive:!!S.year}),A.jsx(En,{label:"Model",items:oe,refine:M1,selected:S.model,showPopular:!0,bgDark:pn,showLabel:c,isMobile:Mn,sortOptions:!1,loading:S.make&&oe.length===0,shouldBeActive:!!S.make})]}):A.jsxs(A.Fragment,{children:[A.jsx(En,{label:"Make",items:L,refine:P1,selected:S.make,showPopular:!0,bgDark:pn,showLabel:c,isMobile:Mn,sortOptions:!1,loading:L.length===0,shouldBeActive:!0}),A.jsx(En,{label:"Model",items:oe,refine:M1,selected:S.model,showPopular:!0,bgDark:pn,showLabel:c,isMobile:Mn,sortOptions:!1,loading:S.make&&oe.length===0,shouldBeActive:!!S.make}),A.jsx(En,{label:"Year",items:ae,refine:O1,selected:S.year,bgDark:pn,showLabel:c,isMobile:Mn,sortOptions:!1,loading:S.model&&ae.length===0,shouldBeActive:!!S.model})]}),Uu.current&&Uu.current.map(T=>{let O=null;switch(T){case"body":O=A.jsx(En,{label:"Body",items:be,refine:mP,selected:S.body,bgDark:pn,showLabel:c,isMobile:Mn,loading:!!(S.make&&S.model&&S.year)&&be.length===0,shouldBeActive:!!(S.make&&S.model&&S.year)},"body");break;case"series":O=A.jsx(En,{label:"Series",items:Me,refine:yP,selected:S.series,bgDark:pn,showLabel:c,isMobile:Mn,loading:!!(S.make&&S.model&&S.year)&&Me.length===0,shouldBeActive:!!(S.make&&S.model&&S.year)},"series");break;case"variant":O=A.jsx(En,{label:"Variant",items:hn,refine:_P,selected:S.variant,bgDark:pn,showLabel:c,isMobile:Mn,loading:!!(S.make&&S.model&&S.year)&&hn.length===0,shouldBeActive:!!(S.make&&S.model&&S.year)},"variant");break;case"engine_capacity":O=A.jsx(En,{label:"Engine Capacity",items:Ns,refine:bP,selected:S.engine_capacity,bgDark:pn,showLabel:c,isMobile:Mn,loading:!!(S.make&&S.model&&S.year)&&Ns.length===0,shouldBeActive:!!(S.make&&S.model&&S.year)},"engine_capacity");break;case"engine":O=A.jsx(En,{label:"Engine",items:Be,refine:wP,selected:S.engine,bgDark:pn,showLabel:c,isMobile:Mn,loading:!!(S.make&&S.model&&S.year)&&Be.length===0,shouldBeActive:!!(S.make&&S.model&&S.year)},"engine");break}return O}),w&&A.jsx("div",{className:"vs:flex vs:h-full vs:flex-col vs:justify-end vs:md:col-span-3 vs:lg:col-span-1",children:A.jsxs("button",{className:"vehicle-search-btn",onClick:()=>{ip(!0),s&&!m?window.location.href=s+window.location.search:gP()},children:[A.jsx("span",{children:v}),cP&&A.jsx(Bf,{className:"vs:w-[calc(var(--partbot-font-size)*0.9)]! vs:h-[calc(var(--partbot-font-size)*0.9)]! vs:animate-spin"})]})})]}),u&&A.jsx("div",{className:Hr("vs:flex vs:w-full vs:justify-center vs:items-center",o==="row"?"vs:md:items-end vs:md:justify-end":"vs:md:justify-center","vs:mt-4 vs:md:mt-3 vs:md:pr-1.5"),children:A.jsxs("a",{href:`https://use.partbot.io/?ref=${typeof window<"u"?window.location.href.split("/")[2]:"unknown"}&utm_source=vehicle-select&utm_medium=referral&utm_campaign=powered-by`,target:"_blank",rel:"noreferrer",className:`${pn?"vs:text-white":"vs:text-black"} vs:flex vs:items-center vs:space-x-1.5 vs:px-1.5 vs:text-center vs:leading-normal vs:text-[10px] vs:opacity-75 vs:transition vs:hover:opacity-100 vs:font-sans vs:no-underline vs:m-0 pb-1.5`,children:[A.jsx("span",{children:"Powered by"}),A.jsx(pk,{className:"vs:inline-flex vs:h-[13px]"})]})})]})]})}let k1=!1,ma=!1;function oP(t){var c,f;const e=t.shadowRoot;if(!e){console.error("[ShadowDOMPatch] No shadow root found");return}const n=e.children[1];if(!n){console.error("[ShadowDOMPatch] No mount point found in shadow root");return}if(new MutationObserver(d=>{d.forEach(h=>{h.addedNodes.forEach(p=>{p.nodeType===1&&p.id==="headlessui-portal-root"&&(n.appendChild(p),ma=!0)})}),d.forEach(h=>{h.removedNodes.forEach(p=>{p.nodeType===1&&p.id==="headlessui-portal-root"&&(n.querySelector("#headlessui-portal-root")||(ma=!1))})})}).observe(document.body,{childList:!0}),new MutationObserver(d=>{d.forEach(h=>{h.removedNodes.forEach(p=>{p.nodeType===1&&p.id==="headlessui-portal-root"&&(ma=!1)})})}).observe(n,{childList:!0,subtree:!0}),k1)return;const s=(c=Object.getOwnPropertyDescriptor(Document.prototype,"activeElement"))==null?void 0:c.get;Object.defineProperty(Document.prototype,"activeElement",{get:function(){const d=s==null?void 0:s.call(this);return d===t?e.activeElement:d}});const o=(f=Object.getOwnPropertyDescriptor(Event.prototype,"target"))==null?void 0:f.get;Object.defineProperty(Event.prototype,"target",{get:function(){const d=o==null?void 0:o.call(this);return d===t?this.composedPath()[0]:d}});const a=d=>{try{return document.body&&d===document.body.style}catch{return!1}},l=CSSStyleDeclaration.prototype.setProperty;CSSStyleDeclaration.prototype.setProperty=function(d,h,p){if(!(a(this)&&d==="overflow"&&h==="hidden"&&ma))return l.call(this,d,h,p)};const u=Object.getOwnPropertyDescriptor(CSSStyleDeclaration.prototype,"overflow");u&&Object.defineProperty(CSSStyleDeclaration.prototype,"overflow",{get:function(){return u.get.call(this)},set:function(d){if(!(a(this)&&d==="hidden"&&ma))return u.set.call(this,d)}}),k1=!0}const aP="/css/vehicle-search.css";class lP extends HTMLElement{connectedCallback(){if(!document.getElementById("vehicle-search-inter-font")){const F=document.createElement("link");F.id="vehicle-search-inter-font",F.rel="stylesheet",F.href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;700&display=swap",document.head.appendChild(F)}let e=document.createElement("style");e.textContent=dk;const n=document.createElement("div"),r=this.attachShadow({mode:"open"}),i=(F,N,G)=>{let Y;if(this.hasAttribute(N)){const H=this.getAttribute(N);if(/^#[0-9A-F]{6}$/i.test(H)){const te=parseInt(H.slice(1,3),16),ee=parseInt(H.slice(3,5),16),R=parseInt(H.slice(5,7),16);Y=`${te} ${ee} ${R}`}}return Y=Y||G,`:host { --${F}: ${Y}; } .partbot-mmyvs-container { --${F}: ${Y}; }`};let s=i("partbot-theme","data-button-color","0 0 0"),o=i("partbot-button-color","data-button-color","0 0 0"),a=i("partbot-button-hover-color","data-button-hover-color","0 0 0"),l=i("partbot-button-label-color","data-button-label-color","255 255 255"),u=i("partbot-button-hover-label-color","data-button-hover-label-color","255 255 255"),c=i("partbot-mobile-background-color","data-mobile-background-color","0 0 0"),f=`:host { --partbot-button-border-radius: ${this.getAttribute("data-button-border-radius")||"0.375rem"}; } .partbot-mmyvs-container { --partbot-button-border-radius: ${this.getAttribute("data-button-border-radius")||"0.375rem"}; }`,d=`:host { --partbot-font-size: ${this.getAttribute("data-font-size")||"0.875rem"}; } .partbot-mmyvs-container { --partbot-font-size: ${this.getAttribute("data-font-size")||"0.875rem"}; }`,h=`:host { --partbot-font-family: ${(this.getAttribute("data-font-family")||this.getAttribute("data-font"))&&(this.getAttribute("data-font-family")||this.getAttribute("data-font")).trim()!==""?this.getAttribute("data-font-family")||this.getAttribute("data-font"):'"Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif'}; } .partbot-mmyvs-container { --partbot-font-family: ${(this.getAttribute("data-font-family")||this.getAttribute("data-font"))&&(this.getAttribute("data-font-family")||this.getAttribute("data-font")).trim()!==""?this.getAttribute("data-font-family")||this.getAttribute("data-font"):'"Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif'}; }`,p=`:host { --partbot-padding: ${this.getAttribute("data-padding")||"0.5rem"}; } .partbot-mmyvs-container { --partbot-padding: ${this.getAttribute("data-padding")||"0.5rem"}; }`;const v=this.getAttribute("data-input-shadow"),w=v==="none"?"none":v||"0 1px 2px 0 rgb(0 0 0 / 0.05)";let m=`:host { --partbot-input-shadow: ${w}; } .partbot-mmyvs-container { --partbot-input-shadow: ${w}; }`;const g=this.getAttribute("data-input-border-color");let y="229 231 235";if(g)if(/^#[0-9A-F]{6}$/i.test(g)){const F=parseInt(g.slice(1,3),16),N=parseInt(g.slice(3,5),16),G=parseInt(g.slice(5,7),16);y=`${F} ${N} ${G}`}else/^\d+\s+\d+\s+\d+$/.test(g)&&(y=g);let b=`:host { --partbot-input-border-color: ${y}; } .partbot-mmyvs-container { --partbot-input-border-color: ${y}; }`;const x=this.getAttribute("data-input-border-width")||"1px";let k=`:host { --partbot-input-border-width: ${x}; } .partbot-mmyvs-container { --partbot-input-border-width: ${x}; }`;e.textContent+=s,e.textContent+=o,e.textContent+=a,e.textContent+=l,e.textContent+=u,e.textContent+=c,e.textContent+=f,e.textContent+=d,e.textContent+=h,e.textContent+=p,e.textContent+=m,e.textContent+=b,e.textContent+=k,r.appendChild(e),r.appendChild(n);const $=this.getAttribute("data-api-key");if(!$){console.warn("Missing attributes: "+($?"":"data-api-key "));return}const C=this.attributes,q={};for(let F=0;F<C.length;F++){const{name:N,value:G}=C[F];if(N.startsWith("data-")){const Y=N.slice(5).replace(/-([a-z])/g,H=>H[1].toUpperCase());q[Y]=G==="true"?!0:G==="false"?!1:G}}oP(this);const I=A.jsx(rp,{...q});ck.render(I,n)}}customElements.define("vehicle-search",lP);const uP=Object.freeze(Object.defineProperty({__proto__:null},Symbol.toStringTag,{value:"Module"}));Pt.VehicleSearch=rp,Pt.default=rp,Pt.vehicleSearchCssUrl=aP,Object.defineProperties(Pt,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cartbot/vehicle-search-beta",
3
- "version": "3.0.42",
3
+ "version": "3.0.43",
4
4
  "type": "module",
5
5
  "author": "Partbot",
6
6
  "url": "https://mmyvs.partbot.io",