@claudeye/linux-arm64 1.0.4 → 1.0.5-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/assets/dist/action-registry.d.ts +2 -2
- package/assets/dist/action-registry.js +1 -1
- package/assets/dist/action-runner.d.ts +2 -2
- package/assets/dist/action-runner.js +1 -1
- package/assets/dist/action-types.d.ts +19 -0
- package/assets/dist/app.d.ts +2 -1
- package/assets/dist/app.js +1 -1
- package/assets/dist/index.d.ts +1 -1
- package/assets/standalone/.next/BUILD_ID +1 -1
- package/assets/standalone/.next/app-path-routes-manifest.json +1 -0
- package/assets/standalone/.next/build-manifest.json +2 -2
- package/assets/standalone/.next/prerender-manifest.json +3 -3
- package/assets/standalone/.next/routes-manifest.json +6 -0
- package/assets/standalone/.next/server/app/_global-error/page.js +1 -1
- package/assets/standalone/.next/server/app/_global-error.html +2 -2
- package/assets/standalone/.next/server/app/_global-error.rsc +1 -1
- package/assets/standalone/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
- package/assets/standalone/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
- package/assets/standalone/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
- package/assets/standalone/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
- package/assets/standalone/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/assets/standalone/.next/server/app/_not-found/page/server-reference-manifest.json +1 -1
- package/assets/standalone/.next/server/app/_not-found/page.js +1 -1
- package/assets/standalone/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/assets/standalone/.next/server/app/_not-found.html +2 -2
- package/assets/standalone/.next/server/app/_not-found.rsc +7 -7
- package/assets/standalone/.next/server/app/_not-found.segments/_full.segment.rsc +7 -7
- package/assets/standalone/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
- package/assets/standalone/.next/server/app/_not-found.segments/_index.segment.rsc +7 -7
- package/assets/standalone/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
- package/assets/standalone/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
- package/assets/standalone/.next/server/app/_not-found.segments/_tree.segment.rsc +2 -2
- package/assets/standalone/.next/server/app/api/completed-history/route.js +1 -1
- package/assets/standalone/.next/server/app/api/queue-item/route.js +1 -1
- package/assets/standalone/.next/server/app/api/queue-status/route.js +1 -1
- package/assets/standalone/.next/server/app/dashboard/[viewName]/page/server-reference-manifest.json +4 -4
- package/assets/standalone/.next/server/app/dashboard/[viewName]/page.js +3 -3
- package/assets/standalone/.next/server/app/dashboard/[viewName]/page_client-reference-manifest.js +1 -1
- package/assets/standalone/.next/server/app/dashboard/page/server-reference-manifest.json +4 -4
- package/assets/standalone/.next/server/app/dashboard/page.js +3 -3
- package/assets/standalone/.next/server/app/dashboard/page_client-reference-manifest.js +1 -1
- package/assets/standalone/.next/server/app/hooks/page/app-paths-manifest.json +3 -0
- package/assets/standalone/.next/server/app/hooks/page/build-manifest.json +18 -0
- package/assets/standalone/.next/server/app/hooks/page/next-font-manifest.json +6 -0
- package/assets/standalone/.next/server/app/hooks/page/react-loadable-manifest.json +1 -0
- package/assets/standalone/.next/server/app/hooks/page/server-reference-manifest.json +50 -0
- package/assets/standalone/.next/server/app/hooks/page.js +21 -0
- package/assets/standalone/.next/server/app/hooks/page_client-reference-manifest.js +2 -0
- package/assets/standalone/.next/server/app/login/page/server-reference-manifest.json +2 -2
- package/assets/standalone/.next/server/app/login/page.js +1 -1
- package/assets/standalone/.next/server/app/login/page_client-reference-manifest.js +1 -1
- package/assets/standalone/.next/server/app/login.html +2 -2
- package/assets/standalone/.next/server/app/login.rsc +8 -8
- package/assets/standalone/.next/server/app/login.segments/_full.segment.rsc +8 -8
- package/assets/standalone/.next/server/app/login.segments/_head.segment.rsc +1 -1
- package/assets/standalone/.next/server/app/login.segments/_index.segment.rsc +7 -7
- package/assets/standalone/.next/server/app/login.segments/_tree.segment.rsc +2 -2
- package/assets/standalone/.next/server/app/login.segments/login/__PAGE__.segment.rsc +2 -2
- package/assets/standalone/.next/server/app/login.segments/login.segment.rsc +1 -1
- package/assets/standalone/.next/server/app/page/server-reference-manifest.json +1 -1
- package/assets/standalone/.next/server/app/page.js +1 -1
- package/assets/standalone/.next/server/app/page_client-reference-manifest.js +1 -1
- package/assets/standalone/.next/server/app/project/[name]/page/server-reference-manifest.json +1 -1
- package/assets/standalone/.next/server/app/project/[name]/page.js +1 -1
- package/assets/standalone/.next/server/app/project/[name]/page_client-reference-manifest.js +1 -1
- package/assets/standalone/.next/server/app/project/[name]/session/[sessionId]/page/react-loadable-manifest.json +1 -1
- package/assets/standalone/.next/server/app/project/[name]/session/[sessionId]/page/server-reference-manifest.json +8 -8
- package/assets/standalone/.next/server/app/project/[name]/session/[sessionId]/page.js +4 -4
- package/assets/standalone/.next/server/app/project/[name]/session/[sessionId]/page_client-reference-manifest.js +1 -1
- package/assets/standalone/.next/server/app/queue/page/server-reference-manifest.json +3 -3
- package/assets/standalone/.next/server/app/queue/page.js +5 -5
- package/assets/standalone/.next/server/app/queue/page_client-reference-manifest.js +1 -1
- package/assets/standalone/.next/server/app-paths-manifest.json +1 -0
- package/assets/standalone/.next/server/chunks/[root-of-the-server]__067f11b8._.js +1 -1
- package/assets/standalone/.next/server/chunks/{[root-of-the-server]__bd194a73._.js → [root-of-the-server]__45be46fb._.js} +2 -2
- package/assets/standalone/.next/server/chunks/{[root-of-the-server]__f26a70d1._.js → [root-of-the-server]__55e122b6._.js} +2 -2
- package/assets/standalone/.next/server/chunks/{[root-of-the-server]__939bf5b3._.js → [root-of-the-server]__d287c360._.js} +2 -2
- package/assets/standalone/.next/server/chunks/{[root-of-the-server]__22ffcb4e._.js → [root-of-the-server]__dd003091._.js} +2 -2
- package/assets/standalone/.next/server/chunks/{[root-of-the-server]__ca12b24d._.js → [root-of-the-server]__e512b1cc._.js} +2 -2
- package/assets/standalone/.next/server/chunks/{[root-of-the-server]__e3e9ab09._.js → [root-of-the-server]__eb7e2ddd._.js} +3 -3
- package/assets/standalone/.next/server/chunks/_3f3c09bf._.js +2 -2
- package/assets/standalone/.next/server/chunks/_7e07bbd9._.js +1 -1
- package/assets/standalone/.next/server/chunks/_8f856fad._.js +1 -1
- package/assets/standalone/.next/server/chunks/_b8adaa37._.js +1 -1
- package/assets/standalone/.next/server/chunks/node_modules_next_dist_esm_build_templates_app-route_7a66d362.js +1 -1
- package/assets/standalone/.next/server/chunks/node_modules_posthog-node_dist_entrypoints_index_node_mjs_05ab10df._.js +1 -1
- package/assets/standalone/.next/server/chunks/node_modules_posthog-node_dist_entrypoints_index_node_mjs_20debb74._.js +1 -1
- package/assets/standalone/.next/server/chunks/package_json_4b1b4d6f._.js +1 -1
- package/assets/standalone/.next/server/chunks/ssr/[root-of-the-server]__16565f83._.js +4 -0
- package/assets/standalone/.next/server/chunks/ssr/[root-of-the-server]__67e8f9e0._.js +3 -0
- package/assets/standalone/.next/server/chunks/ssr/[root-of-the-server]__6c8fbc11._.js +3 -0
- package/assets/standalone/.next/server/chunks/ssr/[root-of-the-server]__6fe243c8._.js +3 -0
- package/assets/standalone/.next/server/chunks/ssr/[root-of-the-server]__735857b9._.js +3 -0
- package/assets/standalone/.next/server/chunks/ssr/[root-of-the-server]__75df9303._.js +7 -0
- package/assets/standalone/.next/server/chunks/ssr/[root-of-the-server]__9d56992c._.js +4 -0
- package/assets/standalone/.next/server/chunks/ssr/[root-of-the-server]__f62102cd._.js +4 -0
- package/assets/standalone/.next/server/chunks/ssr/{_1e78350c._.js → _081372b3._.js} +2 -2
- package/assets/standalone/.next/server/chunks/ssr/_14858238._.js +1 -1
- package/assets/standalone/.next/server/chunks/ssr/_19a3e694._.js +2 -2
- package/assets/standalone/.next/server/chunks/ssr/_1d335924._.js +1 -1
- package/assets/standalone/.next/server/chunks/ssr/_2e175d6c._.js +4 -0
- package/assets/standalone/.next/server/chunks/ssr/_3dacef09._.js +1 -1
- package/assets/standalone/.next/server/chunks/ssr/_60aa3e52._.js +4 -0
- package/assets/standalone/.next/server/chunks/ssr/_76ab933f._.js +1 -1
- package/assets/standalone/.next/server/chunks/ssr/_7ae321cd._.js +2 -2
- package/assets/standalone/.next/server/chunks/ssr/_81677e08._.js +3 -0
- package/assets/standalone/.next/server/chunks/ssr/_87e025a1._.js +1 -1
- package/assets/standalone/.next/server/chunks/ssr/_c26c26e0._.js +4 -0
- package/assets/standalone/.next/server/chunks/ssr/_c9400c33._.js +2 -2
- package/assets/standalone/.next/server/chunks/ssr/_d7159840._.js +1 -1
- package/assets/standalone/.next/server/chunks/ssr/_fa9c2bed._.js +2 -2
- package/assets/standalone/.next/server/chunks/ssr/app_actions_compute-dashboard_ts_fc151dbb._.js +1 -1
- package/assets/standalone/.next/server/chunks/ssr/app_login_page_tsx_ccc0019b._.js +1 -1
- package/assets/standalone/.next/server/chunks/ssr/app_queue_queue-client_tsx_45f040f7._.js +1 -1
- package/assets/standalone/.next/server/chunks/ssr/node_modules_next_dist_274ac3eb._.js +1 -1
- package/assets/standalone/.next/server/chunks/ssr/node_modules_posthog-node_dist_entrypoints_index_node_mjs_8222e100._.js +1 -1
- package/assets/standalone/.next/server/pages/404.html +2 -2
- package/assets/standalone/.next/server/pages/500.html +2 -2
- package/assets/standalone/.next/server/server-reference-manifest.js +1 -1
- package/assets/standalone/.next/server/server-reference-manifest.json +52 -15
- package/assets/standalone/.next/static/chunks/461a5b1875d4fb34.js +1 -0
- package/assets/standalone/.next/static/chunks/4bb576fa705315da.js +1 -0
- package/assets/standalone/.next/static/chunks/{6f48312d9fefe6e7.js → 523c48f15e09b682.js} +1 -1
- package/assets/standalone/.next/static/chunks/82ee271cf50da0c0.js +3 -0
- package/assets/standalone/.next/static/chunks/93a502b6f3250e67.js +4 -0
- package/assets/standalone/.next/static/chunks/{ef5e745c131e6572.js → 982905bfb104847e.js} +1 -1
- package/assets/standalone/.next/static/chunks/{11f25fc2615691ff.js → b31e60be9aaa65b3.js} +1 -1
- package/assets/standalone/.next/static/chunks/d98be8b1a727cee7.css +1 -0
- package/assets/standalone/README.md +94 -1
- package/assets/standalone/package.json +3 -3
- package/bin/claudeye +0 -0
- package/package.json +1 -1
- package/assets/standalone/.next/server/chunks/ssr/[root-of-the-server]__35a929f8._.js +0 -3
- package/assets/standalone/.next/server/chunks/ssr/[root-of-the-server]__6b650af8._.js +0 -3
- package/assets/standalone/.next/server/chunks/ssr/[root-of-the-server]__95fd3969._.js +0 -3
- package/assets/standalone/.next/server/chunks/ssr/[root-of-the-server]__acea31a9._.js +0 -8
- package/assets/standalone/.next/server/chunks/ssr/[root-of-the-server]__c3591792._.js +0 -8
- package/assets/standalone/.next/server/chunks/ssr/[root-of-the-server]__f758248a._.js +0 -3
- package/assets/standalone/.next/server/chunks/ssr/_617143fc._.js +0 -8
- package/assets/standalone/.next/server/chunks/ssr/_986c0cdb._.js +0 -8
- package/assets/standalone/.next/static/chunks/14b2a22c2d5f76c5.css +0 -1
- package/assets/standalone/.next/static/chunks/8da8518dc46b9734.js +0 -1
- package/assets/standalone/.next/static/chunks/91129b8c2a80b1b2.js +0 -4
- package/assets/standalone/.next/static/chunks/96e6f5987bb7f381.js +0 -3
- /package/assets/standalone/.next/static/{ooDwT_B4qzYMdxRb-wV62 → LJaHJeoJHe8BdlVAI_I3w}/_buildManifest.js +0 -0
- /package/assets/standalone/.next/static/{ooDwT_B4qzYMdxRb-wV62 → LJaHJeoJHe8BdlVAI_I3w}/_clientMiddlewareManifest.json +0 -0
- /package/assets/standalone/.next/static/{ooDwT_B4qzYMdxRb-wV62 → LJaHJeoJHe8BdlVAI_I3w}/_ssgManifest.js +0 -0
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
module.exports=[28864,e=>{"use strict";let t,r,i,s,n;var a,o=e.i(14747);function l(e){return e.replace(/^[A-Z]:/,"").replace(/\\/g,"/")}let u=e=>void 0===e?void 0:e.variant??e.enabled,c=e=>{if("string"!=typeof e)return e;try{return JSON.parse(e)}catch{return e}},h="0123456789abcdef";class d{constructor(e){this.bytes=e}static ofInner(e){if(16===e.length)return new d(e);throw TypeError("not 128-bit length")}static fromFieldsV7(e,t,r,i){if(!Number.isInteger(e)||!Number.isInteger(t)||!Number.isInteger(r)||!Number.isInteger(i)||e<0||t<0||r<0||i<0||e>0xffffffffffff||t>4095||r>0x3fffffff||i>0xffffffff)throw RangeError("invalid field value");let s=new Uint8Array(16);return s[0]=e/0x10000000000,s[1]=e/0x100000000,s[2]=e/0x1000000,s[3]=e/65536,s[4]=e/256,s[5]=e,s[6]=112|t>>>8,s[7]=t,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 d(s)}static parse(e){let t;switch(e.length){case 32:t=/^[0-9a-f]{32}$/i.exec(e)?.[0];break;case 36:t=/^([0-9a-f]{8})-([0-9a-f]{4})-([0-9a-f]{4})-([0-9a-f]{4})-([0-9a-f]{12})$/i.exec(e)?.slice(1,6).join("");break;case 38:t=/^\{([0-9a-f]{8})-([0-9a-f]{4})-([0-9a-f]{4})-([0-9a-f]{4})-([0-9a-f]{12})\}$/i.exec(e)?.slice(1,6).join("");break;case 45:t=/^urn:uuid:([0-9a-f]{8})-([0-9a-f]{4})-([0-9a-f]{4})-([0-9a-f]{4})-([0-9a-f]{12})$/i.exec(e)?.slice(1,6).join("")}if(t){let e=new Uint8Array(16);for(let r=0;r<16;r+=4){let i=parseInt(t.substring(2*r,2*r+8),16);e[r+0]=i>>>24,e[r+1]=i>>>16,e[r+2]=i>>>8,e[r+3]=i}return new d(e)}throw SyntaxError("could not parse UUID string")}toString(){let e="";for(let t=0;t<this.bytes.length;t++)e+=h.charAt(this.bytes[t]>>>4),e+=h.charAt(15&this.bytes[t]),(3===t||5===t||7===t||9===t)&&(e+="-");return e}toHex(){let e="";for(let t=0;t<this.bytes.length;t++)e+=h.charAt(this.bytes[t]>>>4),e+=h.charAt(15&this.bytes[t]);return e}toJSON(){return this.toString()}getVariant(){let e=this.bytes[8]>>>4;if(e<0)throw Error("unreachable");if(e<=7)return this.bytes.every(e=>0===e)?"NIL":"VAR_0";if(e<=11)return"VAR_10";if(e<=13)return"VAR_110";if(e<=15)return this.bytes.every(e=>255===e)?"MAX":"VAR_RESERVED";throw Error("unreachable")}getVersion(){return"VAR_10"===this.getVariant()?this.bytes[6]>>>4:void 0}clone(){return new d(this.bytes.slice(0))}equals(e){return 0===this.compareTo(e)}compareTo(e){for(let t=0;t<16;t++){let r=this.bytes[t]-e.bytes[t];if(0!==r)return Math.sign(r)}return 0}}class g{constructor(e){this.timestamp=0,this.counter=0,this.random=e??p()}generate(){return this.generateOrResetCore(Date.now(),1e4)}generateOrAbort(){return this.generateOrAbortCore(Date.now(),1e4)}generateOrResetCore(e,t){let r=this.generateOrAbortCore(e,t);return void 0===r&&(this.timestamp=0,r=this.generateOrAbortCore(e,t)),r}generateOrAbortCore(e,t){if(!Number.isInteger(e)||e<1||e>0xffffffffffff)throw RangeError("`unixTsMs` must be a 48-bit positive integer");if(t<0||t>0xffffffffffff)throw RangeError("`rollbackAllowance` out of reasonable range");if(e>this.timestamp)this.timestamp=e,this.resetCounter();else{if(!(e+t>=this.timestamp))return;this.counter++,this.counter>0x3ffffffffff&&(this.timestamp++,this.resetCounter())}return d.fromFieldsV7(this.timestamp,Math.trunc(this.counter/0x40000000),this.counter&0x40000000-1,this.random.nextUint32())}resetCounter(){this.counter=1024*this.random.nextUint32()+(1023&this.random.nextUint32())}generateV4(){let e=new Uint8Array(Uint32Array.of(this.random.nextUint32(),this.random.nextUint32(),this.random.nextUint32(),this.random.nextUint32()).buffer);return e[6]=64|e[6]>>>4,e[8]=128|e[8]>>>2,d.ofInner(e)}}let p=()=>({nextUint32:()=>65536*Math.trunc(65536*Math.random())+Math.trunc(65536*Math.random())}),f=()=>(t||(t=new g)).generate();var y=((a={}).AnonymousId="anonymous_id",a.DistinctId="distinct_id",a.Props="props",a.EnablePersonProcessing="enable_person_processing",a.PersonMode="person_mode",a.FeatureFlagDetails="feature_flag_details",a.FeatureFlags="feature_flags",a.FeatureFlagPayloads="feature_flag_payloads",a.BootstrapFeatureFlagDetails="bootstrap_feature_flag_details",a.BootstrapFeatureFlags="bootstrap_feature_flags",a.BootstrapFeatureFlagPayloads="bootstrap_feature_flag_payloads",a.OverrideFeatureFlags="override_feature_flags",a.Queue="queue",a.OptedOut="opted_out",a.SessionId="session_id",a.SessionStartTimestamp="session_start_timestamp",a.SessionLastTimestamp="session_timestamp",a.PersonProperties="person_properties",a.GroupProperties="group_properties",a.InstalledAppBuild="installed_app_build",a.InstalledAppVersion="installed_app_version",a.SessionReplay="session_replay",a.SurveyLastSeenDate="survey_last_seen_date",a.SurveysSeen="surveys_seen",a.Surveys="surveys",a.RemoteConfig="remote_config",a.FlagsEndpointWasHit="flags_endpoint_was_hit",a);let m={ERRORS_WHILE_COMPUTING:"errors_while_computing_flags",FLAG_MISSING:"flag_missing",QUOTA_LIMITED:"quota_limited",TIMEOUT:"timeout",CONNECTION_ERROR:"connection_error",UNKNOWN_ERROR:"unknown_error",apiError:e=>`api_error_${e}`},v=["$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"],b=["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"],_=function(e,t=[]){if(!e)return!1;let r=e.toLowerCase();return b.concat(t).some(e=>{let t=e.toLowerCase();return -1!==r.indexOf(t)})};function w(e,t){return -1!==e.indexOf(t)}e.s(["DEFAULT_BLOCKED_UA_STRS",()=>b,"isBlockedUA",()=>_],74770);let E=function(e){return e.trim()},P=function(e){return e.replace(/^\$/,"")};function F(e){return["distinct_id","distinctid"].includes(e.toLowerCase())}function x(e){return null===e||"object"!=typeof e?e:Array.isArray(e)?e.map(x):Object.keys(e).sort().reduce((t,r)=>(t[r]=x(e[r]),t),{})}function S(e,t,r){return JSON.stringify({distinct_id:e,userPropertiesToSet:t?x(t):void 0,userPropertiesToSetOnce:r?x(r):void 0})}e.s(["getPersonPropertiesHash",()=>S,"includes",()=>w,"isDistinctIdStringLike",()=>F,"stripLeadingDollar",()=>P,"trim",()=>E],58750);let k=Array.isArray,C=Object.prototype,I=C.hasOwnProperty,$=C.toString,O=k||function(e){return"[object Array]"===$.call(e)},A=e=>"function"==typeof e,T=e=>A(e)&&-1!==e.toString().indexOf("[native code]"),R=e=>e===Object(e)&&!O(e),L=e=>{if(R(e)){for(let t in e)if(I.call(e,t))return!1;return!0}return!1},M=e=>void 0===e,j=e=>"[object String]"==$.call(e),D=e=>j(e)&&0===e.trim().length,U=e=>null===e,B=e=>M(e)||U(e),N=e=>"[object Number]"==$.call(e)&&e==e,q=e=>N(e)&&e>0,H=e=>"[object Boolean]"===$.call(e),G=e=>e instanceof FormData,z=e=>e instanceof File,W=e=>e instanceof Error,K=e=>w(v,e);function V(e){return null===e||"object"!=typeof e}function Q(e,t){return Object.prototype.toString.call(e)===`[object ${t}]`}function J(e){switch(Object.prototype.toString.call(e)){case"[object Error]":case"[object Exception]":case"[object DOMException]":case"[object DOMError]":case"[object WebAssembly.Exception]":return!0;default:return ee(e,Error)}}function Y(e){return Q(e,"ErrorEvent")}function X(e){return!M(Event)&&ee(e,Event)}function Z(e){return Q(e,"Object")}function ee(e,t){try{return e instanceof t}catch{return!1}}let et=[!0,"true",1,"1","yes"],er=e=>w(et,e),ei=[!1,"false",0,"0","no"],es=e=>w(ei,e);function en(e,t,r,i,s){if(t>r&&(i.warn("min cannot be greater than max."),t=r),N(e))if(e>r)return i.warn(" cannot be greater than max: "+r+". Using max value instead."),r;else return e<t?(i.warn(" cannot be less than min: "+t+". Using min value instead."),t):e;return i.warn(" must be a number. using max or fallback. max: "+r+", fallback: "+s),en(s||r,t,r,i)}function ea(e,t,r=!0){if(null==e)return r;if("boolean"==typeof e)return e;if("object"==typeof e){let i=e[t];return"boolean"==typeof i?i:r}return r}function eo(e,t){if(null==e||"object"!=typeof e)return;let r=e[t];if("number"==typeof r&&Number.isFinite(r))return r;if("string"==typeof r){let e=r.trim();if(""===e)return;let t=Number(e);return Number.isFinite(t)?t:void 0}}function el(e){return"number"==typeof e&&Number.isFinite(e)&&e>=0&&e<=1}e.s(["hasOwnProperty",()=>I,"isArray",()=>O,"isBoolean",()=>H,"isBuiltin",()=>Q,"isEmptyObject",()=>L,"isEmptyString",()=>D,"isError",()=>J,"isErrorEvent",()=>Y,"isEvent",()=>X,"isFile",()=>z,"isFormData",()=>G,"isFunction",()=>A,"isKnownUnsafeEditableEvent",()=>K,"isNativeFunction",()=>T,"isNoLike",()=>es,"isNull",()=>U,"isNullish",()=>B,"isNumber",()=>N,"isObject",()=>R,"isPlainError",()=>W,"isPlainObject",()=>Z,"isPositiveNumber",()=>q,"isPrimitive",()=>V,"isString",()=>j,"isUndefined",()=>M,"isYesLike",()=>er,"noLikeValues",()=>ei,"yesLikeValues",()=>et],36418),e.s(["clampToRange",()=>en,"getRemoteConfigBool",()=>ea,"getRemoteConfigNumber",()=>eo,"isValidSampleRate",()=>el],73362);class eu{constructor(e){this._buckets={},this._onBucketRateLimited=e._onBucketRateLimited,this._bucketSize=en(e.bucketSize,0,100,e._logger),this._refillRate=en(e.refillRate,0,this._bucketSize,e._logger),this._refillInterval=en(e.refillInterval,0,864e5,e._logger)}_applyRefill(e,t){let r=Math.floor((t-e.lastAccess)/this._refillInterval);if(r>0){let t=r*this._refillRate;e.tokens=Math.min(e.tokens+t,this._bucketSize),e.lastAccess=e.lastAccess+r*this._refillInterval}}consumeRateLimit(e){let t=Date.now(),r=String(e),i=this._buckets[r];return i?this._applyRefill(i,t):(i={tokens:this._bucketSize,lastAccess:t},this._buckets[r]=i),0===i.tokens||(i.tokens--,0===i.tokens&&this._onBucketRateLimited?.(e),0===i.tokens)}stop(){this._buckets={}}}e.s(["BucketedRateLimiter",()=>eu],34223);class ec{add(e){let t=f().toString();return this.promiseByIds[t]=e,e.catch(()=>{}).finally(()=>{delete this.promiseByIds[t]}),e}async join(){let e=Object.values(this.promiseByIds),t=e.length;for(;t>0;)await Promise.all(e),t=(e=Object.values(this.promiseByIds)).length}get length(){return Object.keys(this.promiseByIds).length}constructor(){this.promiseByIds={}}}e.s(["PromiseQueue",()=>ec],14901);let eh=(e,t,r)=>{function i(s,...n){t(()=>{(0,r[s])(e,...n)})}return{info:(...e)=>{i("log",...e)},warn:(...e)=>{i("warn",...e)},error:(...e)=>{i("error",...e)},critical:(...t)=>{r.error(e,...t)},createLogger:i=>eh(`${e} ${i}`,t,r)}},ed=e=>e();function eg(e,t=ed){return eh(e,t,function(e=console){return{log:e.log.bind(e),warn:e.warn.bind(e),error:e.error.bind(e),debug:e.debug.bind(e)}}())}e.s(["_createLogger",()=>eh,"createLogger",()=>eg],1346);let ep="Mobile",ef="Android",ey="Tablet",em=ef+" "+ey,ev="iPad",eb="Apple",e_=eb+" Watch",ew="Safari",eE="BlackBerry",eP="Samsung",eF=eP+"Browser",ex=eP+" Internet",eS="Chrome",ek=eS+" OS",eC=eS+" iOS",eI="Internet Explorer",e$=eI+" "+ep,eO="Opera",eA=eO+" Mini",eT="Edge",eR="Microsoft "+eT,eL="Firefox",eM=eL+" iOS",ej="Nintendo",eD="PlayStation",eU="Xbox",eB=ef+" "+ep,eN=ep+" "+ew,eq="Windows",eH=eq+" Phone",eG="Nokia",ez="Ouya",eW="Generic",eK=eW+" "+ep.toLowerCase(),eV=eW+" "+ey.toLowerCase(),eQ="Konqueror",eJ="(\\d+(\\.\\d+)?)",eY=RegExp("Version/"+eJ),eX=RegExp(eU,"i"),eZ=RegExp(eD+" \\w+","i"),e0=RegExp(ej+" \\w+","i"),e1=RegExp(eE+"|PlayBook|BB10","i"),e4={"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"},e2=function(e,t){var r;if(t=t||"",w(e," OPR/")&&w(e,"Mini"))return eA;if(w(e," OPR/"))return eO;if(e1.test(e))return eE;if(w(e,"IE"+ep)||w(e,"WPDesktop"))return e$;if(w(e,eF))return ex;if(w(e,eT)||w(e,"Edg/"))return eR;if(w(e,"FBIOS"))return"Facebook "+ep;if(w(e,"UCWEB")||w(e,"UCBrowser"))return"UC Browser";if(w(e,"CriOS"))return eC;if(w(e,"CrMo")||w(e,eS))return eS;if(w(e,ef)&&w(e,ew))return eB;if(w(e,"FxiOS"))return eM;if(w(e.toLowerCase(),eQ.toLowerCase()))return eQ;if((r=t)&&w(r,eb)||w(e,ew)&&!w(e,eS)&&!w(e,ef))return w(e,ep)?eN:ew;if(w(e,eL))return eL;else if(w(e,"MSIE")||w(e,"Trident/"))return eI;else if(w(e,"Gecko"))return eL;return""},e3={[e$]:[RegExp("rv:"+eJ)],[eR]:[RegExp(eT+"?\\/"+eJ)],[eS]:[RegExp("("+eS+"|CrMo)\\/"+eJ)],[eC]:[RegExp("CriOS\\/"+eJ)],"UC Browser":[RegExp("(UCBrowser|UCWEB)\\/"+eJ)],[ew]:[eY],[eN]:[eY],[eO]:[RegExp("("+eO+"|OPR)\\/"+eJ)],[eL]:[RegExp(eL+"\\/"+eJ)],[eM]:[RegExp("FxiOS\\/"+eJ)],[eQ]:[RegExp("Konqueror[:/]?"+eJ,"i")],[eE]:[RegExp(eE+" "+eJ),eY],[eB]:[RegExp("android\\s"+eJ,"i")],[ex]:[RegExp(eF+"\\/"+eJ)],[eI]:[RegExp("(rv:|MSIE )"+eJ)],Mozilla:[RegExp("rv:"+eJ)]},e5=function(e,t){let r=e3[e2(e,t)];if(M(r))return null;for(let t=0;t<r.length;t++){let i=r[t],s=e.match(i);if(s)return parseFloat(s[s.length-2])}return null},e6=[[RegExp(eU+"; "+eU+" (.*?)[);]","i"),e=>[eU,e&&e[1]||""]],[RegExp(ej,"i"),[ej,""]],[RegExp(eD,"i"),[eD,""]],[e1,[eE,""]],[RegExp(eq,"i"),(e,t)=>{if(/Phone/.test(t)||/WPDesktop/.test(t))return[eH,""];if(new RegExp(ep).test(t)&&!/IEMobile\b/.test(t))return[eq+" "+ep,""];let r=/Windows NT ([0-9.]+)/i.exec(t);if(r&&r[1]){let e=e4[r[1]]||"";return/arm/i.test(t)&&(e="RT"),[eq,e]}return[eq,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,e=>e&&e[3]?["iOS",[e[3],e[4],e[5]||"0"].join(".")]:["iOS",""]],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,e=>{let t="";return e&&e.length>=3&&(t=M(e[2])?e[3]:e[2]),["watchOS",t]}],[RegExp("("+ef+" (\\d+)\\.(\\d+)\\.?(\\d+)?|"+ef+")","i"),e=>e&&e[2]?[ef,[e[2],e[3],e[4]||"0"].join(".")]:[ef,""]],[/Mac OS X (\d+)[_.](\d+)[_.]?(\d+)?/i,e=>{let t=["Mac OS X",""];if(e&&e[1]){let r=[e[1],e[2],e[3]||"0"];t[1]=r.join(".")}return t}],[/Mac/i,["Mac OS X",""]],[/CrOS/,[ek,""]],[/Linux|debian/i,["Linux",""]]],e9=function(e){for(let t=0;t<e6.length;t++){let[r,i]=e6[t],s=r.exec(e),n=s&&(A(i)?i(s,e):i);if(n)return n}return["",""]},e8=function(e){if(e0.test(e))return ej;if(eZ.test(e))return eD;if(eX.test(e))return eU;if(RegExp(ez,"i").test(e))return ez;if(RegExp("("+eH+"|WPDesktop)","i").test(e))return eH;if(/iPad/.test(e))return ev;if(/iPod/.test(e))return"iPod Touch";if(/iPhone/.test(e))return"iPhone";if(/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(e))return e_;else if(e1.test(e))return eE;else if(/(kobo)\s(ereader|touch)/i.test(e))return"Kobo";else if(RegExp(eG,"i").test(e))return eG;else if(/(kf[a-z]{2}wi|aeo[c-r]{2})( bui|\))/i.test(e)||/(kf[a-z]+)( bui|\)).+silk\//i.test(e))return"Kindle Fire";else if(/(Android|ZTE)/i.test(e))if(!(!new RegExp(ep).test(e)||/(9138B|TB782B|Nexus [97]|pixel c|HUAWEISHT|BTV|noble nook|smart ultra 6)/i.test(e)))return ef;else return/pixel[\daxl ]{1,6}/i.test(e)&&!/pixel c/i.test(e)||/(huaweimed-al00|tah-|APA|SM-G92|i980|zte|U304AA)/i.test(e)||/lmy47v/i.test(e)&&!/QTAQZ3/i.test(e)?ef:em;else if(RegExp("(pda|"+ep+")","i").test(e))return eK;else if(RegExp(ey,"i").test(e)&&!RegExp(ey+" pc","i").test(e))return eV;else return""},e7=function(e){let t=e8(e);return t===ev||t===em||"Kobo"===t||"Kindle Fire"===t||t===eV?ey:t===ej||t===eU||t===eD||t===ez?"Console":t===e_?"Wearable":t?ep:"Desktop"};e.s(["detectBrowser",()=>e2,"detectBrowserVersion",()=>e5,"detectDevice",()=>e8,"detectDeviceType",()=>e7,"detectOS",()=>e9],49726);let te="utf8";function tt(e,t){if(!e||"string"!=typeof e||0===e.trim().length)throw Error(t)}function tr(e){return e?.replace(/\/+$/,"")}async function ti(e,t){let r=null;for(let i=0;i<t.retryCount+1;i++){i>0&&await new Promise(e=>setTimeout(e,t.retryDelay));try{return await e()}catch(e){if(r=e,!t.retryCheck(e))throw e}}throw r}function ts(){return new Date().getTime()}function tn(){return new Date().toISOString()}function ta(e,t){let r=setTimeout(e,t);return r?.unref&&r?.unref(),r}let to=e=>e&&"function"==typeof e.then,tl=e=>e instanceof Error;function tu(){return"u">typeof fetch?fetch:void 0!==globalThis.fetch?globalThis.fetch:void 0}function tc(e){return Promise.all(e.map(e=>(e??Promise.resolve()).then(e=>({status:"fulfilled",value:e}),e=>({status:"rejected",reason:e}))))}e.s(["STRING_FORMAT",()=>te,"allSettled",()=>tc,"assert",()=>tt,"currentISOTime",()=>tn,"currentTimestamp",()=>ts,"getFetch",()=>tu,"isError",()=>tl,"isPromise",()=>to,"removeTrailingSlash",()=>tr,"retriable",()=>ti,"safeSetTimeout",()=>ta],95757);class th{constructor(){this.events={},this.events={}}on(e,t){return this.events[e]||(this.events[e]=[]),this.events[e].push(t),()=>{this.events[e]=this.events[e].filter(e=>e!==t)}}emit(e,t){for(let r of this.events[e]||[])r(t);for(let r of this.events["*"]||[])r(e,t)}}async function td(e,t=!0){try{let t=new Blob([e],{type:"text/plain"}).stream().pipeThrough(new CompressionStream("gzip"));return await new Response(t).blob()}catch(e){return t&&console.error("Failed to gzip compress data",e),null}}class tg extends Error{constructor(e,t){super("HTTP error while fetching PostHog: status="+e.status+", reqByteLength="+t),this.response=e,this.reqByteLength=t,this.name="PostHogFetchHttpError"}get status(){return this.response.status}get text(){return this.response.text()}get json(){return this.response.json()}}class tp extends Error{constructor(e){super("Network error while fetching PostHog",e instanceof Error?{cause:e}:{}),this.error=e,this.name="PostHogFetchNetworkError"}}async function tf(e){if(e instanceof tg){let t="";try{t=await e.text}catch{}console.error(`Error while flushing PostHog: message=${e.message}, response body=${t}`,e)}else console.error("Error while flushing PostHog",e);return Promise.resolve()}function ty(e){return"object"==typeof e&&(e instanceof tg||e instanceof tp)}function tm(e){return"object"==typeof e&&e instanceof tg&&413===e.status}class tv{constructor(e,t={}){this.flushPromise=null,this.shutdownPromise=null,this.promiseQueue=new ec,this._events=new th,this._isInitialized=!1,tt(e,"You must pass your PostHog project's api key."),this.apiKey=e,this.host=tr(t.host||"https://us.i.posthog.com"),this.flushAt=t.flushAt?Math.max(t.flushAt,1):20,this.maxBatchSize=Math.max(this.flushAt,t.maxBatchSize??100),this.maxQueueSize=Math.max(this.flushAt,t.maxQueueSize??1e3),this.flushInterval=t.flushInterval??1e4,this.preloadFeatureFlags=t.preloadFeatureFlags??!0,this.defaultOptIn=t.defaultOptIn??!0,this.disableSurveys=t.disableSurveys??!1,this._retryOptions={retryCount:t.fetchRetryCount??3,retryDelay:t.fetchRetryDelay??3e3,retryCheck:ty},this.requestTimeout=t.requestTimeout??1e4,this.featureFlagsRequestTimeoutMs=t.featureFlagsRequestTimeoutMs??3e3,this.remoteConfigRequestTimeoutMs=t.remoteConfigRequestTimeoutMs??3e3,this.disableGeoip=t.disableGeoip??!0,this.disabled=t.disabled??!1,this.historicalMigration=t?.historicalMigration??!1,this._initPromise=Promise.resolve(),this._isInitialized=!0,this._logger=eg("[PostHog]",this.logMsgIfDebug.bind(this)),this.evaluationContexts=t?.evaluationContexts??t?.evaluationEnvironments,t?.evaluationEnvironments&&!t?.evaluationContexts&&this._logger.warn("evaluationEnvironments is deprecated. Use evaluationContexts instead. This property will be removed in a future version."),this.disableCompression=!("CompressionStream"in globalThis)||(t?.disableCompression??!1)}logMsgIfDebug(e){this.isDebug&&e()}wrap(e){return this.disabled?void this._logger.warn("The client is disabled"):this._isInitialized?e():void this._initPromise.then(()=>e())}getCommonEventProperties(){return{$lib:this.getLibraryId(),$lib_version:this.getLibraryVersion()}}get optedOut(){return this.getPersistedProperty(y.OptedOut)??!this.defaultOptIn}async optIn(){this.wrap(()=>{this.setPersistedProperty(y.OptedOut,!1)})}async optOut(){this.wrap(()=>{this.setPersistedProperty(y.OptedOut,!0)})}on(e,t){return this._events.on(e,t)}debug(e=!0){if(this.removeDebugCallback?.(),e){let e=this.on("*",(e,t)=>this._logger.info(e,t));this.removeDebugCallback=()=>{e(),this.removeDebugCallback=void 0}}}get isDebug(){return!!this.removeDebugCallback}get isDisabled(){return this.disabled}buildPayload(e){return{distinct_id:e.distinct_id,event:e.event,properties:{...e.properties||{},...this.getCommonEventProperties()}}}addPendingPromise(e){return this.promiseQueue.add(e)}identifyStateless(e,t,r){this.wrap(()=>{let i={...this.buildPayload({distinct_id:e,event:"$identify",properties:t})};this.enqueue("identify",i,r)})}async identifyStatelessImmediate(e,t,r){let i={...this.buildPayload({distinct_id:e,event:"$identify",properties:t})};await this.sendImmediate("identify",i,r)}captureStateless(e,t,r,i){this.wrap(()=>{let s=this.buildPayload({distinct_id:e,event:t,properties:r});this.enqueue("capture",s,i)})}async captureStatelessImmediate(e,t,r,i){let s=this.buildPayload({distinct_id:e,event:t,properties:r});await this.sendImmediate("capture",s,i)}aliasStateless(e,t,r,i){this.wrap(()=>{let s=this.buildPayload({event:"$create_alias",distinct_id:t,properties:{...r||{},distinct_id:t,alias:e}});this.enqueue("alias",s,i)})}async aliasStatelessImmediate(e,t,r,i){let s=this.buildPayload({event:"$create_alias",distinct_id:t,properties:{...r||{},distinct_id:t,alias:e}});await this.sendImmediate("alias",s,i)}groupIdentifyStateless(e,t,r,i,s,n){this.wrap(()=>{let a=this.buildPayload({distinct_id:s||`$${e}_${t}`,event:"$groupidentify",properties:{$group_type:e,$group_key:t,$group_set:r||{},...n||{}}});this.enqueue("capture",a,i)})}async getRemoteConfig(){await this._initPromise;let e=this.host;"https://us.i.posthog.com"===e?e="https://us-assets.i.posthog.com":"https://eu.i.posthog.com"===e&&(e="https://eu-assets.i.posthog.com");let t=`${e}/array/${this.apiKey}/config`,r={method:"GET",headers:{...this.getCustomHeaders(),"Content-Type":"application/json"}};return this.fetchWithRetry(t,r,{retryCount:0},this.remoteConfigRequestTimeoutMs).then(e=>e.json()).catch(e=>{this._logger.error("Remote config could not be loaded",e),this._events.emit("error",e)})}async getFlags(e,t={},r={},i={},s={},n=!0){await this._initPromise;let a=`${this.host}/flags/?v=2${n?"&config=true":""}`,o={token:this.apiKey,distinct_id:e,groups:t,person_properties:r,group_properties:i,...s};this.evaluationContexts&&this.evaluationContexts.length>0&&(o.evaluation_contexts=this.evaluationContexts);let l={method:"POST",headers:{...this.getCustomHeaders(),"Content-Type":"application/json"},body:JSON.stringify(o)};return this._logger.info("Flags URL",a),this.fetchWithRetry(a,l,{retryCount:0},this.featureFlagsRequestTimeoutMs).then(e=>e.json()).then(e=>({success:!0,response:(e=>{if("flags"in e){let t,r=Object.fromEntries(Object.entries(e.flags??{}).map(([e,t])=>[e,u(t)]).filter(([,e])=>void 0!==e)),i=Object.fromEntries(Object.keys(t=e.flags??{}).filter(e=>{let r=t[e];return r.enabled&&r.metadata&&void 0!==r.metadata.payload}).map(e=>{let r=t[e].metadata?.payload;return[e,r?c(r):void 0]}));return{...e,featureFlags:r,featureFlagPayloads:i}}{let t=e.featureFlags??{},r=Object.fromEntries(Object.entries(e.featureFlagPayloads||{}).map(([e,t])=>[e,c(t)])),i=Object.fromEntries(Object.entries(t).map(([e,t])=>{var i,s;return[e,{key:e,enabled:"string"==typeof(i=t)||i,variant:"string"==typeof i?i:void 0,reason:void 0,metadata:{id:void 0,version:void 0,payload:(s=r[e])?JSON.stringify(s):void 0,description:void 0}}]}));return{...e,featureFlags:t,featureFlagPayloads:r,flags:i}}})(e)})).catch(e=>(this._events.emit("error",e),{success:!1,error:this.categorizeRequestError(e)}))}categorizeRequestError(e){if(e instanceof tg)return{type:"api_error",statusCode:e.status};if(e instanceof tp){let t=e.error;return t instanceof Error&&("AbortError"===t.name||"TimeoutError"===t.name)?{type:"timeout"}:{type:"connection_error"}}return{type:"unknown_error"}}async getFeatureFlagStateless(e,t,r={},i={},s={},n){await this._initPromise;let a=await this.getFeatureFlagDetailStateless(e,t,r,i,s,n);if(void 0===a)return{response:void 0,requestId:void 0};let o=u(a.response);return void 0===o&&(o=!1),{response:o,requestId:a.requestId}}async getFeatureFlagDetailStateless(e,t,r={},i={},s={},n){await this._initPromise;let a=await this.getFeatureFlagDetailsStateless(t,r,i,s,n,[e]);if(void 0!==a)return{response:a.flags[e],requestId:a.requestId,evaluatedAt:a.evaluatedAt}}async getFeatureFlagPayloadStateless(e,t,r={},i={},s={},n){await this._initPromise;let a=await this.getFeatureFlagPayloadsStateless(t,r,i,s,n,[e]);if(!a)return;let o=a[e];return void 0===o?null:o}async getFeatureFlagPayloadsStateless(e,t={},r={},i={},s,n){return await this._initPromise,(await this.getFeatureFlagsAndPayloadsStateless(e,t,r,i,s,n)).payloads}async getFeatureFlagsStateless(e,t={},r={},i={},s,n){return await this._initPromise,await this.getFeatureFlagsAndPayloadsStateless(e,t,r,i,s,n)}async getFeatureFlagsAndPayloadsStateless(e,t={},r={},i={},s,n){await this._initPromise;let a=await this.getFeatureFlagDetailsStateless(e,t,r,i,s,n);return a?{flags:a.featureFlags,payloads:a.featureFlagPayloads,requestId:a.requestId}:{flags:void 0,payloads:void 0,requestId:void 0}}async getFeatureFlagDetailsStateless(e,t={},r={},i={},s,n){await this._initPromise;let a={};(s??this.disableGeoip)&&(a.geoip_disable=!0),n&&(a.flag_keys_to_evaluate=n);let o=await this.getFlags(e,t,r,i,a);if(!o.success)return;let l=o.response;return(l.errorsWhileComputingFlags&&console.error("[FEATURE FLAGS] Error while computing feature flags, some flags may be missing or incorrect. Learn more at https://posthog.com/docs/feature-flags/best-practices"),l.quotaLimited?.includes("feature_flags"))?(console.warn("[FEATURE FLAGS] Feature flags quota limit exceeded - feature flags unavailable. Learn more about billing limits at https://posthog.com/docs/billing/limits-alerts"),{flags:{},featureFlags:{},featureFlagPayloads:{},requestId:l?.requestId,quotaLimited:l.quotaLimited}):l}async getSurveysStateless(){if(await this._initPromise,!0===this.disableSurveys)return this._logger.info("Loading surveys is disabled."),[];let e=`${this.host}/api/surveys/?token=${this.apiKey}`,t={method:"GET",headers:{...this.getCustomHeaders(),"Content-Type":"application/json"}},r=await this.fetchWithRetry(e,t).then(e=>{if(200!==e.status||!e.json){let t=`Surveys API could not be loaded: ${e.status}`,r=Error(t);this._logger.error(r),this._events.emit("error",Error(t));return}return e.json()}).catch(e=>{this._logger.error("Surveys API could not be loaded",e),this._events.emit("error",e)}),i=r?.surveys;return i&&this._logger.info("Surveys fetched from API: ",JSON.stringify(i)),i??[]}get props(){return this._props||(this._props=this.getPersistedProperty(y.Props)),this._props||{}}set props(e){this._props=e}async register(e){this.wrap(()=>{this.props={...this.props,...e},this.setPersistedProperty(y.Props,this.props)})}async unregister(e){this.wrap(()=>{delete this.props[e],this.setPersistedProperty(y.Props,this.props)})}processBeforeEnqueue(e){return e}async flushStorage(){}enqueue(e,t,r){this.wrap(()=>{if(this.optedOut)return void this._events.emit(e,"Library is disabled. Not sending event. To re-enable, call posthog.optIn()");let i=this.prepareMessage(e,t,r);if(null===(i=this.processBeforeEnqueue(i)))return;let s=this.getPersistedProperty(y.Queue)||[];s.length>=this.maxQueueSize&&(s.shift(),this._logger.info("Queue is full, the oldest event is dropped.")),s.push({message:i}),this.setPersistedProperty(y.Queue,s),this._events.emit(e,i),s.length>=this.flushAt&&this.flushBackground(),this.flushInterval&&!this._flushTimer&&(this._flushTimer=ta(()=>this.flushBackground(),this.flushInterval))})}async sendImmediate(e,t,r){if(this.disabled)return void this._logger.warn("The client is disabled");if(this._isInitialized||await this._initPromise,this.optedOut)return void this._events.emit(e,"Library is disabled. Not sending event. To re-enable, call posthog.optIn()");let i=this.prepareMessage(e,t,r);if(null===(i=this.processBeforeEnqueue(i)))return;let s={api_key:this.apiKey,batch:[i],sent_at:tn()};this.historicalMigration&&(s.historical_migration=!0);let n=JSON.stringify(s),a=`${this.host}/batch/`,o=this.disableCompression?null:await td(n,this.isDebug),l={method:"POST",headers:{...this.getCustomHeaders(),"Content-Type":"application/json",...null!==o&&{"Content-Encoding":"gzip"}},body:o||n};try{await this.fetchWithRetry(a,l)}catch(e){this._events.emit("error",e)}}prepareMessage(e,t,r){let i={...t,type:e,library:this.getLibraryId(),library_version:this.getLibraryVersion(),timestamp:r?.timestamp?r?.timestamp:tn(),uuid:r?.uuid?r.uuid:f().toString()};return(r?.disableGeoip??this.disableGeoip)&&(i.properties||(i.properties={}),i.properties.$geoip_disable=!0),i.distinctId&&(i.distinct_id=i.distinctId,delete i.distinctId),i}clearFlushTimer(){this._flushTimer&&(clearTimeout(this._flushTimer),this._flushTimer=void 0)}flushBackground(){this.flush().catch(async e=>{await tf(e)})}async flush(){let e=tc([this.flushPromise]).then(()=>this._flush());return this.flushPromise=e,this.addPendingPromise(e),tc([e]).then(()=>{this.flushPromise===e&&(this.flushPromise=null)}),e}getCustomHeaders(){let e=this.getCustomUserAgent(),t={};return e&&""!==e&&(t["User-Agent"]=e),t}async _flush(){this.clearFlushTimer(),await this._initPromise;let e=this.getPersistedProperty(y.Queue)||[];if(!e.length)return;let t=[],r=e.length;for(;e.length>0&&t.length<r;){let r=e.slice(0,this.maxBatchSize),i=r.map(e=>e.message),s=async()=>{let t=(this.getPersistedProperty(y.Queue)||[]).slice(r.length);this.setPersistedProperty(y.Queue,t),e=t,await this.flushStorage()},n={api_key:this.apiKey,batch:i,sent_at:tn()};this.historicalMigration&&(n.historical_migration=!0);let a=JSON.stringify(n),o=`${this.host}/batch/`,l=this.disableCompression?null:await td(a,this.isDebug),u={method:"POST",headers:{...this.getCustomHeaders(),"Content-Type":"application/json",...null!==l&&{"Content-Encoding":"gzip"}},body:l||a},c={retryCheck:e=>!tm(e)&&ty(e)};try{await this.fetchWithRetry(o,u,c)}catch(e){if(tm(e)&&i.length>1){this.maxBatchSize=Math.max(1,Math.floor(i.length/2)),this._logger.warn(`Received 413 when sending batch of size ${i.length}, reducing batch size to ${this.maxBatchSize}`);continue}throw e instanceof tp||await s(),this._events.emit("error",e),e}await s(),t.push(...i)}this._events.emit("flush",t)}async fetchWithRetry(e,t,r,i){AbortSignal.timeout??=function(e){let t=new AbortController;return setTimeout(()=>t.abort(),e),t.signal};let s=t.body?t.body:"",n=-1;try{n=s instanceof Blob?s.size:Buffer.byteLength(s,te)}catch{n=s instanceof Blob?s.size:new TextEncoder().encode(s).length}return await ti(async()=>{let r=null;try{r=await this.fetch(e,{signal:AbortSignal.timeout(i??this.requestTimeout),...t})}catch(e){throw new tp(e)}if("no-cors"!==t.mode&&(r.status<200||r.status>=400))throw new tg(r,n);return r},{...this._retryOptions,...r})}async _shutdown(e=3e4){await this._initPromise;let t=!1;this.clearFlushTimer();let r=async()=>{try{for(await this.promiseQueue.join();;){let e=this.getPersistedProperty(y.Queue)||[];if(0===e.length||(await this.flush(),t))break}}catch(e){if(!ty(e))throw e;await tf(e)}};return Promise.race([new Promise((r,i)=>{ta(()=>{this._logger.error("Timed out while shutting down PostHog"),t=!0,i("Timeout while shutting down PostHog. Some events may not have been sent.")},e)}),r()])}async shutdown(e=3e4){return this.shutdownPromise?this._logger.warn("shutdown() called while already shutting down. shutdown() is meant to be called once before process exit - use flush() for per-request cleanup"):this.shutdownPromise=this._shutdown(e).finally(()=>{this.shutdownPromise=null}),this.shutdownPromise}}class tb{constructor(e,t,r=[]){this.coercers=e,this.stackParser=t,this.modifiers=r}buildFromUnknown(e,t={}){let r=t&&t.mechanism||{handled:!0,type:"generic"},i=this.buildCoercingContext(r,t,0).apply(e),s=this.buildParsingContext(t),n=this.parseStacktrace(i,s);return{$exception_list:this.convertToExceptionList(n,r),$exception_level:"error"}}async modifyFrames(e){for(let t of e)t.stacktrace&&t.stacktrace.frames&&O(t.stacktrace.frames)&&(t.stacktrace.frames=await this.applyModifiers(t.stacktrace.frames));return e}coerceFallback(e){return{type:"Error",value:"Unknown error",stack:e.syntheticException?.stack,synthetic:!0}}parseStacktrace(e,t){let r,i;return null!=e.cause&&(r=this.parseStacktrace(e.cause,t)),""!=e.stack&&null!=e.stack&&(i=this.applyChunkIds(this.stackParser(e.stack,e.synthetic?t.skipFirstLines:0),t.chunkIdMap)),{...e,cause:r,stack:i}}applyChunkIds(e,t){return e.map(e=>(e.filename&&t&&(e.chunk_id=t[e.filename]),e))}applyCoercers(e,t){for(let r of this.coercers)if(r.match(e))return r.coerce(e,t);return this.coerceFallback(t)}async applyModifiers(e){let t=e;for(let e of this.modifiers)t=await e(t);return t}convertToExceptionList(e,t){let r={type:e.type,value:e.value,mechanism:{type:t.type??"generic",handled:t.handled??!0,synthetic:e.synthetic??!1}};e.stack&&(r.stacktrace={type:"raw",frames:e.stack});let i=[r];return null!=e.cause&&i.push(...this.convertToExceptionList(e.cause,{...t,handled:!0})),i}buildParsingContext(e){return{chunkIdMap:function(e){let t=globalThis._posthogChunkIds;if(!t)return;let n=Object.keys(t);return s&&n.length===i?s:(i=n.length,s=n.reduce((i,s)=>{r||(r={});let n=r[s];if(n)i[n[0]]=n[1];else{let n=e(s);for(let e=n.length-1;e>=0;e--){let a=n[e],o=a?.filename,l=t[s];if(o&&l){i[o]=l,r[s]=[o,l];break}}}return i},{}))}(this.stackParser),skipFirstLines:e.skipFirstLines??1}}buildCoercingContext(e,t,r=0){let i=(r,i)=>{if(i<=4){let s=this.buildCoercingContext(e,t,i);return this.applyCoercers(r,s)}};return{...t,syntheticException:0==r?t.syntheticException:void 0,mechanism:e,apply:e=>i(e,r),next:e=>i(e,r+1)}}}function t_(e,t,r,i,s){let n={platform:e,filename:t,function:"<anonymous>"===r?"?":r,in_app:!0};return M(i)||(n.lineno=i),M(s)||(n.colno=s),n}e.s(["ErrorPropertiesBuilder",()=>tb],80446);let tw=(e,t)=>{let r=-1!==e.indexOf("safari-extension"),i=-1!==e.indexOf("safari-web-extension");return r||i?[-1!==e.indexOf("@")?e.split("@")[0]:"?",r?`safari-extension:${t}`:`safari-web-extension:${t}`]:[e,t]},tE=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,tP=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,tF=/\((\S*)(?::(\d+))(?::(\d+))\)/,tx=(e,t)=>{let r=tE.exec(e);if(r){let[,e,i,s]=r;return t_(t,e,"?",+i,+s)}let i=tP.exec(e);if(i){if(i[2]&&0===i[2].indexOf("eval")){let e=tF.exec(i[2]);e&&(i[2]=e[1],i[3]=e[2],i[4]=e[3])}let[e,r]=tw(i[1]||"?",i[2]);return t_(t,r,e,i[3]?+i[3]:void 0,i[4]?+i[4]:void 0)}},tS=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,tk=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,tC=(e,t)=>{let r=tS.exec(e);if(r){if(r[3]&&r[3].indexOf(" > eval")>-1){let e=tk.exec(r[3]);e&&(r[1]=r[1]||"eval",r[3]=e[1],r[4]=e[2],r[5]="")}let e=r[3],i=r[1]||"?";return[i,e]=tw(i,e),t_(t,e,i,r[4]?+r[4]:void 0,r[5]?+r[5]:void 0)}},tI=/^\s*at (?:((?:\[object object\])?.+) )?\(?((?:[-a-z]+):.*?):(\d+)(?::(\d+))?\)?\s*$/i,t$=(e,t)=>{let r=tI.exec(e);return r?t_(t,r[2],r[1]||"?",+r[3],r[4]?+r[4]:void 0):void 0},tO=/ line (\d+).*script (?:in )?(\S+)(?:: in function (\S+))?$/i,tA=(e,t)=>{let r=tO.exec(e);return r?t_(t,r[2],r[3]||"?",+r[1]):void 0},tT=/ line (\d+), column (\d+)\s*(?:in (?:<anonymous function: ([^>]+)>|([^)]+))\(.*\))? in (.*):\s*$/i,tR=(e,t)=>{let r=tT.exec(e);return r?t_(t,r[5],r[3]||r[4]||"?",+r[1],+r[2]):void 0},tL=/^\s*[-]{4,}$/,tM=/at (?:async )?(?:(.+?)\s+\()?(?:(.+):(\d+):(\d+)?|([^)]+))\)?/,tj=(e,t)=>{let r=e.match(tM);if(r){let e,i,s,n,a;if(r[1]){let t=(s=r[1]).lastIndexOf(".");if("."===s[t-1]&&t--,t>0){e=s.slice(0,t),i=s.slice(t+1);let r=e.indexOf(".Module");r>0&&(s=s.slice(r+1),e=e.slice(0,r))}n=void 0}i&&(n=e,a=i),"<anonymous>"===i&&(a=void 0,s=void 0),void 0===s&&(a=a||"?",s=n?`${n}.${a}`:a);let o=r[2]?.startsWith("file://")?r[2].slice(7):r[2],l="native"===r[5];return o?.match(/\/[A-Z]:/)&&(o=o.slice(1)),o||!r[5]||l||(o=r[5]),{filename:o?decodeURI(o):void 0,module:void 0,function:s,lineno:tD(r[3]),colno:tD(r[4]),in_app:function(e,t=!1){return!(t||e&&!e.startsWith("/")&&!e.match(/^[A-Z]:/)&&!e.startsWith(".")&&!e.match(/^[a-zA-Z]([a-zA-Z0-9.\-+])*:\/\//))&&void 0!==e&&!e.includes("node_modules/")}(o||"",l),platform:t}}if(e.match(tL))return{filename:e,platform:t}};function tD(e){return parseInt(e||"",10)||void 0}let tU=/\(error: (.*)\)/;function tB(e){if(!e.length)return[];let t=Array.from(e);return t.reverse(),t.slice(0,50).map(e=>{var r;return{...e,filename:e.filename||((r=t)[r.length-1]||{}).filename,function:e.function||"?"}})}function tN(){return tq("web:javascript",tx,tC)}function tq(e,...t){return(r,i=0)=>{let s=[],n=r.split("\n");for(let r=i;r<n.length;r++){let i=n[r];if(i.length>1024)continue;let a=tU.test(i)?i.replace(tU,"$1"):i;if(!a.match(/\S*Error: /)){for(let r of t){let t=r(a,e);if(t){s.push(t);break}}if(s.length>=50)break}}return tB(s)}}e.s(["createDefaultStackParser",()=>tN,"createStackParser",()=>tq,"reverseAndStripFrames",()=>tB],34246);class tH{match(e){return this.isDOMException(e)||this.isDOMError(e)}coerce(e,t){let r=j(e.stack);return{type:this.getType(e),value:this.getValue(e),stack:r?e.stack:void 0,cause:e.cause?t.next(e.cause):void 0,synthetic:!1}}getType(e){return this.isDOMError(e)?"DOMError":"DOMException"}getValue(e){let t=e.name||(this.isDOMError(e)?"DOMError":"DOMException");return e.message?`${t}: ${e.message}`:t}isDOMException(e){return Q(e,"DOMException")}isDOMError(e){return Q(e,"DOMError")}}e.s(["DOMExceptionCoercer",()=>tH],29569);class tG{match(e){return W(e)}coerce(e,t){return{type:this.getType(e),value:this.getMessage(e,t),stack:this.getStack(e),cause:e.cause?t.next(e.cause):void 0,synthetic:!1}}getType(e){return e.name||e.constructor.name}getMessage(e,t){let r=e.message;return r.error&&"string"==typeof r.error.message?String(r.error.message):String(r)}getStack(e){return e.stacktrace||e.stack||void 0}}e.s(["ErrorCoercer",()=>tG],11475);class tz{match(e){return Y(e)&&void 0!=e.error}coerce(e,t){let r=t.apply(e.error);return r||{type:"ErrorEvent",value:e.message,stack:t.syntheticException?.stack,synthetic:!0}}}e.s(["ErrorEventCoercer",()=>tz],43179);let tW=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;class tK{match(e){return"string"==typeof e}coerce(e,t){let[r,i]=this.getInfos(e);return{type:r??"Error",value:i??e,stack:t.syntheticException?.stack,synthetic:!0}}getInfos(e){let t="Error",r=e,i=e.match(tW);return i&&(t=i[1],r=i[2]),[t,r]}}e.s(["StringCoercer",()=>tK],45098);let tV=["fatal","error","warning","log","info","debug"];function tQ(e,t=40){let r=Object.keys(e);if(r.sort(),!r.length)return"[object has no keys]";for(let e=r.length;e>0;e--){let i=r.slice(0,e).join(", ");if(!(i.length>t)){if(e===r.length)return i;return i.length<=t?i:`${i.slice(0,t)}...`}}return""}class tJ{match(e){return"object"==typeof e&&null!==e}coerce(e,t){let r=this.getErrorPropertyFromObject(e);return r?t.apply(r):{type:this.getType(e),value:this.getValue(e),stack:t.syntheticException?.stack,level:this.isSeverityLevel(e.level)?e.level:"error",synthetic:!0}}getType(e){return X(e)?e.constructor.name:"Error"}getValue(e){if("name"in e&&"string"==typeof e.name){let t=`'${e.name}' captured as exception`;return"message"in e&&"string"==typeof e.message&&(t+=` with message: '${e.message}'`),t}if("message"in e&&"string"==typeof e.message)return e.message;let t=this.getObjectClassName(e),r=tQ(e);return`${t&&"Object"!==t?`'${t}'`:"Object"} captured as exception with keys: ${r}`}isSeverityLevel(e){return j(e)&&!D(e)&&tV.indexOf(e)>=0}getErrorPropertyFromObject(e){for(let t in e)if(Object.prototype.hasOwnProperty.call(e,t)){let r=e[t];if(tl(r))return r}}getObjectClassName(e){try{let t=Object.getPrototypeOf(e);return t?t.constructor.name:void 0}catch(e){return}}}e.s(["ObjectCoercer",()=>tJ],6881);class tY{match(e){return X(e)}coerce(e,t){let r=e.constructor.name;return{type:r,value:`${r} captured as exception with keys: ${tQ(e)}`,stack:t.syntheticException?.stack,synthetic:!0}}}e.s(["EventCoercer",()=>tY],80322);class tX{match(e){return V(e)}coerce(e,t){return{type:"Error",value:`Primitive value captured as exception: ${String(e)}`,stack:t.syntheticException?.stack,synthetic:!0}}}e.s(["PrimitiveCoercer",()=>tX],80049);class tZ{match(e){return Q(e,"PromiseRejectionEvent")}coerce(e,t){let r=this.getUnhandledRejectionReason(e);return V(r)?{type:"UnhandledRejection",value:`Non-Error promise rejection captured with value: ${String(r)}`,stack:t.syntheticException?.stack,synthetic:!0}:t.apply(r)}getUnhandledRejectionReason(e){if(V(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}}e.s(["PromiseRejectionEventCoercer",()=>tZ],98689),e.s([],99573);class t0{constructor(e){this._maxSize=e,this._cache=new Map}get(e){let t=this._cache.get(e);if(void 0!==t)return this._cache.delete(e),this._cache.set(e,t),t}set(e,t){this._cache.set(e,t)}reduce(){for(;this._cache.size>=this._maxSize;){let e=this._cache.keys().next().value;e&&this._cache.delete(e)}}}e.s(["ReduceableCache",()=>t0],46986),e.s([],47114),e.i(47114),e.i(80446),e.i(34246),e.s(["chromeStackLineParser",()=>tx,"createDefaultStackParser",()=>tN,"createStackParser",()=>tq,"geckoStackLineParser",()=>tC,"nodeStackLineParser",()=>tj,"opera10StackLineParser",()=>tA,"opera11StackLineParser",()=>tR,"reverseAndStripFrames",()=>tB,"winjsStackLineParser",()=>t$],70736),e.i(70736),e.i(99573),e.i(29569),e.i(11475),e.i(43179),e.i(45098),e.i(6881),e.i(80322),e.i(80049),e.i(98689),e.s(["DOMExceptionCoercer",()=>tH,"ErrorCoercer",()=>tG,"ErrorEventCoercer",()=>tz,"EventCoercer",()=>tY,"ObjectCoercer",()=>tJ,"PrimitiveCoercer",()=>tX,"PromiseRejectionEventCoercer",()=>tZ,"StringCoercer",()=>tK],21854),e.i(21854),e.i(46986),e.s(["DOMExceptionCoercer",()=>tH,"ErrorCoercer",()=>tG,"ErrorEventCoercer",()=>tz,"ErrorPropertiesBuilder",()=>tb,"EventCoercer",()=>tY,"ObjectCoercer",()=>tJ,"PrimitiveCoercer",()=>tX,"PromiseRejectionEventCoercer",()=>tZ,"ReduceableCache",()=>t0,"StringCoercer",()=>tK,"chromeStackLineParser",()=>tx,"createDefaultStackParser",()=>tN,"createStackParser",()=>tq,"geckoStackLineParser",()=>tC,"nodeStackLineParser",()=>tj,"opera10StackLineParser",()=>tA,"opera11StackLineParser",()=>tR,"reverseAndStripFrames",()=>tB,"winjsStackLineParser",()=>t$],96117);var t1=e.i(96117),t4=t1,t2=e.i(2157),t3=e.i(1457);let t5=new t4.ReduceableCache(25),t6=new t4.ReduceableCache(20);async function t9(e){let t={};for(let s=e.length-1;s>=0;s--){var r,i;let n=e[s],a=n?.filename;!(!n||"string"!=typeof a||"number"!=typeof n.lineno||(r=a).startsWith("node:")||r.endsWith(".min.js")||r.endsWith(".min.cjs")||r.endsWith(".min.mjs")||r.startsWith("data:")||void 0!==(i=n).lineno&&i.lineno>1e4||void 0!==i.colno&&i.colno>1e3)&&(t[a]||(t[a]=[]),t[a].push(n.lineno))}let s=Object.keys(t);if(0==s.length)return e;let n=[];for(let e of s){if(t6.get(e))continue;let r=t[e];if(!r)continue;r.sort((e,t)=>e-t);let i=function(e){if(!e.length)return[];let t=0,r=e[0];if("number"!=typeof r)return[];let i=t7(r),s=[];for(;;){if(t===e.length-1){s.push(i);break}let r=e[t+1];if("number"!=typeof r)break;r<=i[1]?i[1]=r+7:(s.push(i),i=t7(r)),t++}return s}(r);if(i.every(t=>(function(e,t){let r=t5.get(e);if(void 0===r)return!1;for(let e=t[0];e<=t[1];e++)if(void 0===r[e])return!1;return!0})(e,t)))continue;let s=function(e,t,r){let i=e.get(t);return void 0===i?(e.set(t,r),r):i}(t5,e,{});n.push(function(e,t,r){return new Promise(i=>{let s=(0,t2.createReadStream)(e),n=(0,t3.createInterface)({input:s});function a(){s.destroy(),i()}let o=0,l=0,u=t[0];if(void 0===u)return void a();let c=u[0],h=u[1];function d(){t6.set(e,1),n.close(),n.removeAllListeners(),a()}s.on("error",d),n.on("error",d),n.on("close",a),n.on("line",e=>{if(!(++o<c)&&(r[o]=function(e,t){let r=e,i=r.length;if(i<=150)return r;t>i&&(t=i);let s=Math.max(t-60,0);s<5&&(s=0);let n=Math.min(s+140,i);return n>i-5&&(n=i),n===i&&(s=Math.max(n-140,0)),r=r.slice(s,n),s>0&&(r=`...${r}`),n<i&&(r+="..."),r}(e,0),o>=h)){if(l===t.length-1){n.close(),n.removeAllListeners();return}let e=t[++l];if(void 0===e){n.close(),n.removeAllListeners();return}c=e[0],h=e[1]}})})}(e,i,s))}return await Promise.all(n).catch(()=>{}),e&&e.length>0&&function(e,t){for(let r of e)if(r.filename&&void 0===r.context_line&&"number"==typeof r.lineno){let e=t.get(r.filename);if(void 0===e)continue;!function(e,t,r){if(void 0===t.lineno||void 0===r)return;t.pre_context=[];for(let i=re(e);i<e;i++){let e=r[i];if(void 0===e)return void t8(t);t.pre_context.push(e)}if(void 0===r[e])return t8(t);t.context_line=r[e];let i=function(e){return e+7}(e);t.post_context=[];for(let s=e+1;s<=i;s++){let e=r[s];if(void 0===e)break;t.post_context.push(e)}}(r.lineno,r,e)}}(e,t5),t5.reduce(),e}function t8(e){delete e.pre_context,delete e.context_line,delete e.post_context}function t7(e){return[re(e),e+7]}function re(e){return Math.max(1,e-7)}class rt{constructor(e,t,r){this.client=e,this._exceptionAutocaptureEnabled=t.enableExceptionAutocapture||!1,this._logger=r,this._rateLimiter=new eu({refillRate:1,bucketSize:10,refillInterval:1e4,_logger:this._logger}),this.startAutocaptureIfEnabled()}static isPreviouslyCapturedError(e){return R(e)&&"__posthog_previously_captured_error"in e&&!0===e.__posthog_previously_captured_error}static async buildEventMessage(e,t,r,i){let s={...i};r||(s.$process_person_profile=!1);let n=this.errorPropertiesBuilder.buildFromUnknown(e,t);return n.$exception_list=await this.errorPropertiesBuilder.modifyFrames(n.$exception_list),{event:"$exception",distinctId:r||f().toString(),properties:{...n,...s},_originatedFromCaptureException:!0}}startAutocaptureIfEnabled(){if(this.isEnabled()){var t,r,i;let s;t=this.onException.bind(this),r=this.onFatalError.bind(this),globalThis.process?.on("uncaughtException",(s=!1,Object.assign(i=>{let n=e.g.process.listeners("uncaughtException").filter(e=>"domainUncaughtExceptionClear"!==e.name&&!0!==e._posthogErrorHandler).length;t(i,{mechanism:{type:"onuncaughtexception",handled:!1}}),s||0!==n||(s=!0,r(i))},{_posthogErrorHandler:!0}))),i=this.onException.bind(this),globalThis.process?.on("unhandledRejection",e=>i(e,{mechanism:{type:"onunhandledrejection",handled:!1}}))}}onException(e,t){this.client.addPendingPromise((async()=>{if(!rt.isPreviouslyCapturedError(e)){let r=await rt.buildEventMessage(e,t),i=r.properties,s=i?.$exception_list[0]?.type??"Exception";return this._rateLimiter.consumeRateLimit(s)?void this._logger.info("Skipping exception capture because of client rate limiting.",{exception:s}):this.client.capture(r)}})())}async onFatalError(e){console.error(e),await this.client.shutdown(2e3),process.exit(1)}isEnabled(){return!this.client.isDisabled&&this._exceptionAutocaptureEnabled}shutdown(){this._rateLimiter.stop()}}e.i(95757),e.i(74770),e.i(34223),e.i(73362),e.i(58750),e.i(36418),e.i(14901),e.i(1346),e.i(49726);let rr={ERRORS_WHILE_COMPUTING:"errors_while_computing_flags",FLAG_MISSING:"flag_missing",QUOTA_LIMITED:"quota_limited",UNKNOWN_ERROR:"unknown_error"};async function ri(e){let t=globalThis.crypto?.subtle;if(!t)throw Error("SubtleCrypto API not available");return Array.from(new Uint8Array(await t.digest("SHA-1",new TextEncoder().encode(e)))).map(e=>e.toString(16).padStart(2,"0")).join("")}e.s(["FeatureFlagError",()=>rr],58325);let rs=["is_not"];class rn extends Error{constructor(e){super(),Error.captureStackTrace(this,this.constructor),this.name="ClientError",this.message=e,Object.setPrototypeOf(this,rn.prototype)}}class ra extends Error{constructor(e){super(e),this.name=this.constructor.name,Error.captureStackTrace(this,this.constructor),Object.setPrototypeOf(this,ra.prototype)}}class ro extends Error{constructor(e){super(e),this.name=this.constructor.name,Error.captureStackTrace(this,this.constructor),Object.setPrototypeOf(this,ro.prototype)}}class rl{constructor({pollingInterval:e,personalApiKey:t,projectApiKey:r,timeout:i,host:s,customHeaders:n,...a}){this.debugMode=!1,this.shouldBeginExponentialBackoff=!1,this.backOffCount=0,this.pollingInterval=e,this.personalApiKey=t,this.featureFlags=[],this.featureFlagsByKey={},this.groupTypeMapping={},this.cohorts={},this.loadedSuccessfullyOnce=!1,this.timeout=i,this.projectApiKey=r,this.host=s,this.poller=void 0,this.fetch=a.fetch||fetch,this.onError=a.onError,this.customHeaders=n,this.onLoad=a.onLoad,this.cacheProvider=a.cacheProvider,this.strictLocalEvaluation=a.strictLocalEvaluation??!1,this.loadFeatureFlags()}debug(e=!0){this.debugMode=e}logMsgIfDebug(e){this.debugMode&&e()}createEvaluationContext(e,t={},r={},i={},s={}){return{distinctId:e,groups:t,personProperties:r,groupProperties:i,evaluationCache:s}}async getFeatureFlag(e,t,r={},i={},s={}){let n,a;if(await this.loadFeatureFlags(),!this.loadedSuccessfullyOnce)return n;if(void 0!==(a=this.featureFlagsByKey[e])){let o=this.createEvaluationContext(t,r,i,s);try{n=(await this.computeFlagAndPayloadLocally(a,o)).value,this.logMsgIfDebug(()=>console.debug(`Successfully computed flag locally: ${e} -> ${n}`))}catch(t){t instanceof ro||t instanceof ra?this.logMsgIfDebug(()=>console.debug(`${t.name} when computing flag locally: ${e}: ${t.message}`)):t instanceof Error&&this.onError?.(Error(`Error computing flag locally: ${e}: ${t}`))}}return n}async getAllFlagsAndPayloads(e,t){await this.loadFeatureFlags();let r={},i={},s=0==this.featureFlags.length,n=t?t.map(e=>this.featureFlagsByKey[e]).filter(Boolean):this.featureFlags,a={...e,evaluationCache:e.evaluationCache??{}};return await Promise.all(n.map(async e=>{try{let{value:t,payload:s}=await this.computeFlagAndPayloadLocally(e,a);r[e.key]=t,s&&(i[e.key]=s)}catch(t){t instanceof ro||t instanceof ra?this.logMsgIfDebug(()=>console.debug(`${t.name} when computing flag locally: ${e.key}: ${t.message}`)):t instanceof Error&&this.onError?.(Error(`Error computing flag locally: ${e.key}: ${t}`)),s=!0}})),{response:r,payloads:i,fallbackToFlags:s}}async computeFlagAndPayloadLocally(e,t,r={}){let i,{matchValue:s,skipLoadCheck:n=!1}=r;if(n||await this.loadFeatureFlags(),!this.loadedSuccessfullyOnce)return{value:!1,payload:null};i=void 0!==s?s:await this.computeFlagValueLocally(e,t);let a=this.getFeatureFlagPayload(e.key,i);return{value:i,payload:a}}async computeFlagValueLocally(e,t){let{distinctId:r,groups:i,personProperties:s,groupProperties:n}=t;if(e.ensure_experience_continuity)throw new ra("Flag has experience continuity enabled");if(!e.active)return!1;let a=(e.filters||{}).aggregation_group_type_index;if(void 0!=a){let r=this.groupTypeMapping[String(a)];if(!r)throw this.logMsgIfDebug(()=>console.warn(`[FEATURE FLAGS] Unknown group type index ${a} for feature flag ${e.key}`)),new ra("Flag has unknown group type index");if(!(r in i))return this.logMsgIfDebug(()=>console.warn(`[FEATURE FLAGS] Can't compute group feature flag: ${e.key} without group names passed in`)),!1;"device_id"===e.bucketing_identifier&&(s?.$device_id===void 0||s?.$device_id===null||s?.$device_id==="")&&this.logMsgIfDebug(()=>console.warn(`[FEATURE FLAGS] Ignoring bucketing_identifier for group flag: ${e.key}`));let o=n[r];return await this.matchFeatureFlagProperties(e,i[r],o,t)}{let i=this.getBucketingValueForFlag(e,r,s);if(void 0===i)throw this.logMsgIfDebug(()=>console.warn(`[FEATURE FLAGS] Can't compute feature flag: ${e.key} without $device_id, falling back to server evaluation`)),new ra(`Can't compute feature flag: ${e.key} without $device_id`);return await this.matchFeatureFlagProperties(e,i,s,t)}}getBucketingValueForFlag(e,t,r){if(e.filters?.aggregation_group_type_index!=void 0)return t;if("device_id"===e.bucketing_identifier){let e=r?.$device_id;if(null==e||""===e)return;return e}return t}getFeatureFlagPayload(e,t){let r=null;if(!1!==t&&null!=t&&("boolean"==typeof t?r=this.featureFlagsByKey?.[e]?.filters?.payloads?.[t.toString()]||null:"string"==typeof t&&(r=this.featureFlagsByKey?.[e]?.filters?.payloads?.[t]||null),null!=r)){if("object"==typeof r)return r;if("string"==typeof r)try{return JSON.parse(r)}catch{}return r}return null}async evaluateFlagDependency(e,t,r){let{evaluationCache:i}=r,s=e.key;if(!this.featureFlagsByKey)throw new ra("Feature flags not available for dependency evaluation");if(!("dependency_chain"in e))throw new ra(`Flag dependency property for '${s}' is missing required 'dependency_chain' field`);let n=e.dependency_chain;if(!Array.isArray(n))throw new ra(`Flag dependency property for '${s}' has an invalid 'dependency_chain' (expected array, got ${typeof n})`);if(0===n.length)throw new ra(`Circular dependency detected for flag '${s}' (empty dependency chain)`);for(let e of n){if(!(e in i)){let t=this.featureFlagsByKey[e];if(t)if(t.active)try{let s=await this.computeFlagValueLocally(t,r);i[e]=s}catch(t){throw new ra(`Error evaluating flag dependency '${e}' for flag '${s}': ${t}`)}else i[e]=!1;else throw new ra(`Missing flag dependency '${e}' for flag '${s}'`)}if(null==i[e])throw new ra(`Dependency '${e}' could not be evaluated`)}let a=i[s];return this.flagEvaluatesToExpectedValue(e.value,a)}flagEvaluatesToExpectedValue(e,t){return"boolean"==typeof e?e===t||"string"==typeof t&&""!==t&&!0===e:"string"==typeof e&&t===e}async matchFeatureFlagProperties(e,t,r,i){let s,n=e.filters||{},a=n.groups||[],o=!1;for(let l of a)try{if(await this.isConditionMatch(e,t,l,r,i)){let r=l.variant,i=n.multivariate?.variants||[];s=r&&i.some(e=>e.key===r)?r:await this.getMatchingVariant(e,t)||!0;break}}catch(e){if(e instanceof ro)throw e;if(e instanceof ra)o=!0;else throw e}if(void 0!==s)return s;if(o)throw new ra("Can't determine if feature flag is enabled or not with given properties");return!1}async isConditionMatch(e,t,r,i,s){let n=r.rollout_percentage,a=e=>{this.logMsgIfDebug(()=>console.warn(e))};if((r.properties||[]).length>0){for(let e of r.properties){let t=e.type;if(!("cohort"===t?function e(t,r,i,s=!1){let n=String(t.value);if(!(n in i))throw new ro(`cohort ${n} not found in local cohorts - likely a static cohort that requires server evaluation`);return function t(r,i,s,n=!1){if(!r)return!0;let a=r.type,o=r.values;if(!o||0===o.length)return!0;let l=!1;if("values"in o[0]){for(let e of o)try{let r=t(e,i,s,n);if("AND"===a){if(!r)return!1}else if(r)return!0}catch(t){if(t instanceof ro)throw t;if(t instanceof ra)n&&console.debug(`Failed to compute property ${e} locally: ${t}`),l=!0;else throw t}if(l)throw new ra("Can't match cohort without a given cohort property value");return"AND"===a}for(let t of o)try{let r;if("cohort"===t.type)r=e(t,i,s,n);else if("flag"===t.type){n&&console.warn(`[FEATURE FLAGS] Flag dependency filters are not supported in local evaluation. Skipping condition with dependency on flag '${t.key||"unknown"}'`);continue}else r=rc(t,i);let o=t.negation||!1;if("AND"===a){if(!r&&!o||r&&o)return!1}else if(r&&!o||!r&&o)return!0}catch(e){if(e instanceof ro)throw e;if(e instanceof ra)n&&console.debug(`Failed to compute property ${t} locally: ${e}`),l=!0;else throw e}if(l)throw new ra("can't match cohort without a given cohort property value");return"AND"===a}(i[n],r,i,s)}(e,i,this.cohorts,this.debugMode):"flag"===t?await this.evaluateFlagDependency(e,i,s):rc(e,i,a)))return!1}if(void 0==n)return!0}return!(void 0!=n&&await ru(e.key,t)>n/100)}async getMatchingVariant(e,t){let r=await ru(e.key,t,"variant"),i=this.variantLookupTable(e).find(e=>r>=e.valueMin&&r<e.valueMax);if(i)return i.key}variantLookupTable(e){let t=[],r=0,i=0,s=e.filters||{};return(s.multivariate?.variants||[]).forEach(e=>{i=r+e.rollout_percentage/100,t.push({valueMin:r,valueMax:i,key:e.key}),r=i}),t}updateFlagState(e){this.featureFlags=e.flags,this.featureFlagsByKey=e.flags.reduce((e,t)=>(e[t.key]=t,e),{}),this.groupTypeMapping=e.groupTypeMapping,this.cohorts=e.cohorts,this.loadedSuccessfullyOnce=!0}warnAboutExperienceContinuityFlags(e){if(this.strictLocalEvaluation)return;let t=e.filter(e=>e.ensure_experience_continuity);t.length>0&&console.warn(`[PostHog] You are using local evaluation but ${t.length} flag(s) have experience continuity enabled: ${t.map(e=>e.key).join(", ")}. Experience continuity is incompatible with local evaluation and will cause a server request on every flag evaluation, negating local evaluation cost savings. To avoid server requests and unexpected costs, either disable experience continuity on these flags in PostHog, use strictLocalEvaluation: true in client init, or pass onlyEvaluateLocally: true per flag call (flags that cannot be evaluated locally will return undefined).`)}async loadFromCache(e){if(!this.cacheProvider)return!1;try{let t=await this.cacheProvider.getFlagDefinitions();if(t)return this.updateFlagState(t),this.logMsgIfDebug(()=>console.debug(`[FEATURE FLAGS] ${e} (${t.flags.length} flags)`)),this.onLoad?.(this.featureFlags.length),this.warnAboutExperienceContinuityFlags(t.flags),!0;return!1}catch(e){return this.onError?.(Error(`Failed to load from cache: ${e}`)),!1}}async loadFeatureFlags(e=!1){if(!this.loadedSuccessfullyOnce||e)return!e&&this.nextFetchAllowedAt&&Date.now()<this.nextFetchAllowedAt?void this.logMsgIfDebug(()=>console.debug("[FEATURE FLAGS] Skipping fetch, in backoff period")):(this.loadingPromise||(this.loadingPromise=this._loadFeatureFlags().catch(e=>this.logMsgIfDebug(()=>console.debug(`[FEATURE FLAGS] Failed to load feature flags: ${e}`))).finally(()=>{this.loadingPromise=void 0})),this.loadingPromise)}isLocalEvaluationReady(){return(this.loadedSuccessfullyOnce??!1)&&(this.featureFlags?.length??0)>0}getFlagDefinitionsLoadedAt(){return this.flagDefinitionsLoadedAt}getPollingInterval(){return this.shouldBeginExponentialBackoff?Math.min(6e4,this.pollingInterval*2**this.backOffCount):this.pollingInterval}beginBackoff(){this.shouldBeginExponentialBackoff=!0,this.backOffCount+=1,this.nextFetchAllowedAt=Date.now()+this.getPollingInterval()}clearBackoff(){this.shouldBeginExponentialBackoff=!1,this.backOffCount=0,this.nextFetchAllowedAt=void 0}async _loadFeatureFlags(){this.poller&&(clearTimeout(this.poller),this.poller=void 0),this.poller=setTimeout(()=>this.loadFeatureFlags(!0),this.getPollingInterval());try{let e=!0;if(this.cacheProvider)try{e=await this.cacheProvider.shouldFetchFlagDefinitions()}catch(e){this.onError?.(Error(`Error in shouldFetchFlagDefinitions: ${e}`))}if(!e&&(await this.loadFromCache("Loaded flags from cache (skipped fetch)")||this.loadedSuccessfullyOnce))return;let t=await this._requestFeatureFlagDefinitions();if(!t)return;switch(t.status){case 304:this.logMsgIfDebug(()=>console.debug("[FEATURE FLAGS] Flags not modified (304), using cached data")),this.flagsEtag=t.headers?.get("ETag")??this.flagsEtag,this.loadedSuccessfullyOnce=!0,this.clearBackoff();return;case 401:throw this.beginBackoff(),new rn(`Your project key or personal API key is invalid. Setting next polling interval to ${this.getPollingInterval()}ms. More information: https://posthog.com/docs/api#rate-limiting`);case 402:console.warn("[FEATURE FLAGS] Feature flags quota limit exceeded - unsetting all local flags. Learn more about billing limits at https://posthog.com/docs/billing/limits-alerts"),this.featureFlags=[],this.featureFlagsByKey={},this.groupTypeMapping={},this.cohorts={};return;case 403:throw this.beginBackoff(),new rn(`Your personal API key does not have permission to fetch feature flag definitions for local evaluation. Setting next polling interval to ${this.getPollingInterval()}ms. Are you sure you're using the correct personal and Project API key pair? More information: https://posthog.com/docs/api/overview`);case 429:throw this.beginBackoff(),new rn(`You are being rate limited. Setting next polling interval to ${this.getPollingInterval()}ms. More information: https://posthog.com/docs/api#rate-limiting`);case 200:{let r=await t.json()??{};if(!("flags"in r))return void this.onError?.(Error(`Invalid response when getting feature flags: ${JSON.stringify(r)}`));this.flagsEtag=t.headers?.get("ETag")??void 0;let i={flags:r.flags??[],groupTypeMapping:r.group_type_mapping||{},cohorts:r.cohorts||{}};if(this.updateFlagState(i),this.flagDefinitionsLoadedAt=Date.now(),this.clearBackoff(),this.cacheProvider&&e)try{await this.cacheProvider.onFlagDefinitionsReceived(i)}catch(e){this.onError?.(Error(`Failed to store in cache: ${e}`))}this.onLoad?.(this.featureFlags.length),this.warnAboutExperienceContinuityFlags(i.flags);break}default:return}}catch(e){e instanceof rn&&this.onError?.(e)}}getPersonalApiKeyRequestOptions(e="GET",t){let r={...this.customHeaders,"Content-Type":"application/json",Authorization:`Bearer ${this.personalApiKey}`};return t&&(r["If-None-Match"]=t),{method:e,headers:r}}_requestFeatureFlagDefinitions(){let e=`${this.host}/api/feature_flag/local_evaluation?token=${this.projectApiKey}&send_cohorts`,t=this.getPersonalApiKeyRequestOptions("GET",this.flagsEtag),r=null;if(this.timeout&&"number"==typeof this.timeout){let e=new AbortController;r=ta(()=>{e.abort()},this.timeout),t.signal=e.signal}try{return(0,this.fetch)(e,t)}finally{clearTimeout(r)}}async stopPoller(e=3e4){if(clearTimeout(this.poller),this.cacheProvider)try{let t=this.cacheProvider.shutdown();t instanceof Promise&&await Promise.race([t,new Promise((t,r)=>setTimeout(()=>r(Error(`Cache shutdown timeout after ${e}ms`)),e))])}catch(e){this.onError?.(Error(`Error during cache shutdown: ${e}`))}}}async function ru(e,t,r=""){return parseInt((await ri(`${e}.${t}${r}`)).slice(0,15),16)/0x1000000000000000}function rc(e,t,r){let i=e.key,s=e.value,n=e.operator||"exact";if(i in t){if("is_not_set"===n)throw new ra("Operator is_not_set is not supported")}else throw new ra(`Property ${i} not found in propertyValues`);let a=t[i];if(null==a&&!rs.includes(n))return r&&r(`Property ${i} cannot have a value of null/undefined with the ${n} operator`),!1;function o(e,t){return Array.isArray(e)?e.map(e=>String(e).toLowerCase()).includes(String(t).toLowerCase()):String(e).toLowerCase()===String(t).toLowerCase()}function l(e,t,r){if("gt"===r)return e>t;if("gte"===r)return e>=t;if("lt"===r)return e<t;if("lte"===r)return e<=t;throw Error(`Invalid operator: ${r}`)}switch(n){case"exact":return o(s,a);case"is_not":return!o(s,a);case"is_set":return i in t;case"icontains":return String(a).toLowerCase().includes(String(s).toLowerCase());case"not_icontains":return!String(a).toLowerCase().includes(String(s).toLowerCase());case"regex":return rh(String(s))&&null!==String(a).match(String(s));case"not_regex":return rh(String(s))&&null===String(a).match(String(s));case"gt":case"gte":case"lt":case"lte":{let e="number"==typeof s?s:null;if("string"==typeof s)try{e=parseFloat(s)}catch(e){}if(null==e||null==a)return l(String(a),String(s),n);if("string"==typeof a)return l(a,String(s),n);return l(a,e,n)}case"is_date_after":case"is_date_before":{if("boolean"==typeof s)throw new ra("Date operations cannot be performed on boolean values");let e=function(e){let t=e.match(/^-?(?<number>[0-9]+)(?<interval>[a-z])$/),r=new Date(new Date().toISOString());if(!t)return null;{if(!t.groups)return null;let e=parseInt(t.groups.number);if(e>=1e4)return null;let i=t.groups.interval;if("h"==i)r.setUTCHours(r.getUTCHours()-e);else if("d"==i)r.setUTCDate(r.getUTCDate()-e);else if("w"==i)r.setUTCDate(r.getUTCDate()-7*e);else if("m"==i)r.setUTCMonth(r.getUTCMonth()-e);else{if("y"!=i)return null;r.setUTCFullYear(r.getUTCFullYear()-e)}return r}}(String(s));if(null==e&&(e=rp(s)),null==e)throw new ra(`Invalid date: ${s}`);let t=rp(a);if(["is_date_before"].includes(n))return t<e;return t>e}case"semver_eq":return 0===rg(rd(String(a)),rd(String(s)));case"semver_neq":return 0!==rg(rd(String(a)),rd(String(s)));case"semver_gt":return rg(rd(String(a)),rd(String(s)))>0;case"semver_gte":return rg(rd(String(a)),rd(String(s)))>=0;case"semver_lt":return 0>rg(rd(String(a)),rd(String(s)));case"semver_lte":return 0>=rg(rd(String(a)),rd(String(s)));case"semver_tilde":{let e,t=rd(String(a)),{lower:r,upper:i}={lower:[(e=rd(String(s)))[0],e[1],e[2]],upper:[e[0],e[1]+1,0]};return rg(t,r)>=0&&0>rg(t,i)}case"semver_caret":{let e=rd(String(a)),{lower:t,upper:r}=function(e){let[t,r,i]=rd(e);return{lower:[t,r,i],upper:t>0?[t+1,0,0]:r>0?[0,r+1,0]:[0,0,i+1]}}(String(s));return rg(e,t)>=0&&0>rg(e,r)}case"semver_wildcard":{let e=rd(String(a)),{lower:t,upper:r}=function(e){let t,r,i=String(e).trim().replace(/^[vV]/,"").replace(/\.\*$/,"").replace(/\*$/,"");if(!i)throw new ra(`Invalid wildcard semver: ${e}`);let s=i.split("."),n=parseInt(s[0],10);if(isNaN(n))throw new ra(`Invalid wildcard semver: ${e}`);if(1===s.length)t=[n,0,0],r=[n+1,0,0];else{let i=parseInt(s[1],10);if(isNaN(i))throw new ra(`Invalid wildcard semver: ${e}`);t=[n,i,0],r=[n,i+1,0]}return{lower:t,upper:r}}(String(s));return rg(e,t)>=0&&0>rg(e,r)}default:throw new ra(`Unknown operator: ${n}`)}}function rh(e){try{return new RegExp(e),!0}catch(e){return!1}}function rd(e){let t=String(e).trim().replace(/^[vV]/,"").split("-")[0].split("+")[0];if(!t||t.startsWith("."))throw new ra(`Invalid semver: ${e}`);let r=t.split("."),i=t=>{if(void 0===t||""===t)return 0;if(!/^\d+$/.test(t))throw new ra(`Invalid semver: ${e}`);return parseInt(t,10)};return[i(r[0]),i(r[1]),i(r[2])]}function rg(e,t){for(let r=0;r<3;r++){if(e[r]<t[r])return -1;if(e[r]>t[r])return 1}return 0}function rp(e){if(e instanceof Date)return e;if("string"==typeof e||"number"==typeof e){let t=new Date(e);if(!isNaN(t.valueOf()))return t;throw new ra(`${e} is in an invalid date format`)}throw new ra(`The date provided ${e} must be a string, number, or date object`)}class rf{getProperty(e){return this._memoryStorage[e]}setProperty(e,t){this._memoryStorage[e]=null!==t?t:void 0}constructor(){this._memoryStorage={}}}class ry extends tv{constructor(e,t={}){if(super(e,t),this._memoryStorage=new rf,this.options=t,this.context=this.initializeContext(),this.options.featureFlagsPollingInterval="number"==typeof t.featureFlagsPollingInterval?Math.max(t.featureFlagsPollingInterval,100):3e4,"number"==typeof t.waitUntilDebounceMs&&(this.options.waitUntilDebounceMs=Math.max(t.waitUntilDebounceMs,0)),"number"==typeof t.waitUntilMaxWaitMs&&(this.options.waitUntilMaxWaitMs=Math.max(t.waitUntilMaxWaitMs,0)),t.personalApiKey){if(t.personalApiKey.includes("phc_"))throw Error('Your Personal API key is invalid. These keys are prefixed with "phx_" and can be created in PostHog project settings.');!1!==t.enableLocalEvaluation&&(this.featureFlagsPoller=new rl({pollingInterval:this.options.featureFlagsPollingInterval,personalApiKey:t.personalApiKey,projectApiKey:e,timeout:t.requestTimeout??1e4,host:this.host,fetch:t.fetch,onError:e=>{this._events.emit("error",e)},onLoad:e=>{this._events.emit("localEvaluationFlagsLoaded",e)},customHeaders:this.getCustomHeaders(),cacheProvider:t.flagDefinitionCacheProvider,strictLocalEvaluation:t.strictLocalEvaluation}))}this.errorTracking=new rt(this,t,this._logger),this.distinctIdHasSentFlagCalls={},this.maxCacheSize=t.maxCacheSize||5e4}enqueue(e,t,r){super.enqueue(e,t,r),this.scheduleDebouncedFlush()}async flush(){let e=super.flush(),t=this.options.waitUntil;if(t&&!this._waitUntilCycle)try{t(e.catch(()=>{}))}catch{}return e}scheduleDebouncedFlush(){let e=this.options.waitUntil;if(!e||this.disabled||this.optedOut)return;if(!this._waitUntilCycle){let t,r=new Promise(e=>{t=e});try{e(r)}catch{return}this._waitUntilCycle={resolve:t,startedAt:Date.now(),timer:void 0}}let t=Date.now()-this._waitUntilCycle.startedAt,r=this.options.waitUntilMaxWaitMs??500;if(void 0!==this._waitUntilCycle.timer&&clearTimeout(this._waitUntilCycle.timer),t>=r)return void this.resolveWaitUntilFlush();let i=this.options.waitUntilDebounceMs??50;this._waitUntilCycle.timer=ta(()=>{this.resolveWaitUntilFlush()},i)}_consumeWaitUntilCycle(){let e=this._waitUntilCycle;return e&&(clearTimeout(e.timer),this._waitUntilCycle=void 0),e?.resolve}async resolveWaitUntilFlush(){let e=this._consumeWaitUntilCycle();try{await super.flush()}catch{}finally{e?.()}}getPersistedProperty(e){return this._memoryStorage.getProperty(e)}setPersistedProperty(e,t){return this._memoryStorage.setProperty(e,t)}fetch(e,t){return this.options.fetch?this.options.fetch(e,t):fetch(e,t)}getLibraryVersion(){return"5.28.0"}getCustomUserAgent(){return`${this.getLibraryId()}/${this.getLibraryVersion()}`}enable(){return super.optIn()}disable(){return super.optOut()}debug(e=!0){super.debug(e),this.featureFlagsPoller?.debug(e)}capture(e){"string"==typeof e&&this._logger.warn("Called capture() with a string as the first argument when an object was expected."),"$exception"!==e.event||e._originatedFromCaptureException||this._logger.warn("Using `posthog.capture('$exception')` is unreliable because it does not attach required metadata. Use `posthog.captureException(error)` instead, which attaches required metadata automatically."),this.addPendingPromise(this.prepareEventMessage(e).then(({distinctId:e,event:t,properties:r,options:i})=>super.captureStateless(e,t,r,{timestamp:i.timestamp,disableGeoip:i.disableGeoip,uuid:i.uuid})).catch(e=>{e&&console.error(e)}))}async captureImmediate(e){return"string"==typeof e&&this._logger.warn("Called captureImmediate() with a string as the first argument when an object was expected."),"$exception"!==e.event||e._originatedFromCaptureException||this._logger.warn("Capturing a `$exception` event via `posthog.captureImmediate('$exception')` is unreliable because it does not attach required metadata. Use `posthog.captureExceptionImmediate(error)` instead, which attaches this metadata by default."),this.addPendingPromise(this.prepareEventMessage(e).then(({distinctId:e,event:t,properties:r,options:i})=>super.captureStatelessImmediate(e,t,r,{timestamp:i.timestamp,disableGeoip:i.disableGeoip,uuid:i.uuid})).catch(e=>{e&&console.error(e)}))}identify({distinctId:e,properties:t={},disableGeoip:r}){let{$set:i,$set_once:s,$anon_distinct_id:n,...a}=t;super.identifyStateless(e,{$set:i||a,$set_once:s||{},$anon_distinct_id:n??void 0},{disableGeoip:r})}async identifyImmediate({distinctId:e,properties:t={},disableGeoip:r}){let{$set:i,$set_once:s,$anon_distinct_id:n,...a}=t;super.identifyStatelessImmediate(e,{$set:i||a,$set_once:s||{},$anon_distinct_id:n??void 0},{disableGeoip:r})}alias(e){super.aliasStateless(e.alias,e.distinctId,void 0,{disableGeoip:e.disableGeoip})}async aliasImmediate(e){await super.aliasStatelessImmediate(e.alias,e.distinctId,void 0,{disableGeoip:e.disableGeoip})}isLocalEvaluationReady(){return this.featureFlagsPoller?.isLocalEvaluationReady()??!1}async waitForLocalEvaluationReady(e=3e4){return!!this.isLocalEvaluationReady()||void 0!==this.featureFlagsPoller&&new Promise(t=>{let r=setTimeout(()=>{i(),t(!1)},e),i=this._events.on("localEvaluationFlagsLoaded",e=>{clearTimeout(r),i(),t(e>0)})})}_resolveDistinctId(e,t){return"string"==typeof e?{distinctId:e,options:t}:{distinctId:this.context?.get()?.distinctId,options:e}}async _getFeatureFlagResult(e,t,r={},i){let s,n,a,o,l,u,c,h=r.sendFeatureFlagEvents??!0;if(void 0!==this._flagOverrides&&e in this._flagOverrides){let t=this._flagOverrides[e];if(void 0===t)return;let r=this._payloadOverrides?.[e];return{key:e,enabled:!1!==t,variant:"string"==typeof t?t:void 0,payload:r}}let{groups:d,disableGeoip:g}=r,{onlyEvaluateLocally:p,personProperties:f,groupProperties:y}=r,m=this.addLocalPersonAndGroupProperties(t,d,f,y);f=m.allPersonProperties,y=m.allGroupProperties;let v=this.createFeatureFlagEvaluationContext(t,d,f,y);void 0==p&&(p=this.options.strictLocalEvaluation??!1);let b=!1;if(void 0!==this.featureFlagsPoller){await this.featureFlagsPoller?.loadFeatureFlags();let t=this.featureFlagsPoller?.featureFlagsByKey[e];if(t)try{let r=await this.featureFlagsPoller?.computeFlagAndPayloadLocally(t,v,{matchValue:i});if(r){b=!0;let i=r.value;l=t.id,c="Evaluated locally",s={key:e,enabled:!1!==i,variant:"string"==typeof i?i:void 0,payload:r.payload??void 0}}}catch(t){if(t instanceof ro||t instanceof ra)this._logger?.info(`${t.name} when computing flag locally: ${e}: ${t.message}`);else throw t}}if(!b&&!p){let t=await super.getFeatureFlagDetailsStateless(v.distinctId,v.groups,v.personProperties,v.groupProperties,g,[e]);if(void 0===t)o=rr.UNKNOWN_ERROR;else{n=t.requestId,a=t.evaluatedAt;let r=[];t.errorsWhileComputingFlags&&r.push(rr.ERRORS_WHILE_COMPUTING),t.quotaLimited?.includes("feature_flags")&&r.push(rr.QUOTA_LIMITED);let i=t.flags[e];if(void 0===i)r.push(rr.FLAG_MISSING);else{let t;if(l=i.metadata?.id,u=i.metadata?.version,c=i.reason?.description??i.reason?.code,i.metadata?.payload!==void 0)try{t=JSON.parse(i.metadata.payload)}catch{t=i.metadata.payload}s={key:e,enabled:i.enabled,variant:i.variant,payload:t}}r.length>0&&(o=r.join(","))}}if(h){let r=void 0===s?void 0:!1!==s.enabled&&(s.variant??!0),i=`${e}_${r}`;if(!(t in this.distinctIdHasSentFlagCalls)||!this.distinctIdHasSentFlagCalls[t].includes(i)){Object.keys(this.distinctIdHasSentFlagCalls).length>=this.maxCacheSize&&(this.distinctIdHasSentFlagCalls={}),Array.isArray(this.distinctIdHasSentFlagCalls[t])?this.distinctIdHasSentFlagCalls[t].push(i):this.distinctIdHasSentFlagCalls[t]=[i];let s={$feature_flag:e,$feature_flag_response:r,$feature_flag_id:l,$feature_flag_version:u,$feature_flag_reason:c,locally_evaluated:b,[`$feature/${e}`]:r,$feature_flag_request_id:n,$feature_flag_evaluated_at:b?Date.now():a};if(b&&this.featureFlagsPoller){let e=this.featureFlagsPoller.getFlagDefinitionsLoadedAt();void 0!==e&&(s.$feature_flag_definitions_loaded_at=e)}o&&(s.$feature_flag_error=o),this.capture({distinctId:t,event:"$feature_flag_called",properties:s,groups:d,disableGeoip:g})}}return void 0!==s&&void 0!==this._payloadOverrides&&e in this._payloadOverrides&&(s={...s,payload:this._payloadOverrides[e]}),s}async getFeatureFlag(e,t,r){let i=await this._getFeatureFlagResult(e,t,{...r,sendFeatureFlagEvents:r?.sendFeatureFlagEvents??this.options.sendFeatureFlagEvent??!0});if(void 0!==i)return!1!==i.enabled&&(i.variant??!0)}async getFeatureFlagPayload(e,t,r,i){if(void 0!==this._payloadOverrides&&e in this._payloadOverrides)return this._payloadOverrides[e];let s=await this._getFeatureFlagResult(e,t,{...i,sendFeatureFlagEvents:!1},r);if(void 0!==s)return s.payload??null}async getFeatureFlagResult(e,t,r){let{distinctId:i,options:s}=this._resolveDistinctId(t,r);return i?this._getFeatureFlagResult(e,i,{...s,sendFeatureFlagEvents:s?.sendFeatureFlagEvents??this.options.sendFeatureFlagEvent??!0}):void this._logger.warn("[PostHog] distinctId is required — pass it explicitly or use withContext()")}async getRemoteConfigPayload(e){if(!this.options.personalApiKey)throw Error("Personal API key is required for remote config payload decryption");let t=await this._requestRemoteConfigPayload(e);if(!t)return;let r=await t.json();if("string"==typeof r)try{return JSON.parse(r)}catch(e){}return r}async isFeatureEnabled(e,t,r){let i=await this.getFeatureFlag(e,t,r);if(void 0!==i)return!!i}async getAllFlags(e,t){let{distinctId:r,options:i}=this._resolveDistinctId(e,t);return r?(await this.getAllFlagsAndPayloads(r,i)).featureFlags||{}:(this._logger.warn("[PostHog] distinctId is required to get feature flags — pass it explicitly or use withContext()"),{})}async getAllFlagsAndPayloads(e,t){let{distinctId:r,options:i}=this._resolveDistinctId(e,t);if(!r)return this._logger.warn("[PostHog] distinctId is required to get feature flags and payloads — pass it explicitly or use withContext()"),{featureFlags:{},featureFlagPayloads:{}};let{groups:s,disableGeoip:n,flagKeys:a}=i||{},{onlyEvaluateLocally:o,personProperties:l,groupProperties:u}=i||{},c=this.addLocalPersonAndGroupProperties(r,s,l,u);l=c.allPersonProperties,u=c.allGroupProperties;let h=this.createFeatureFlagEvaluationContext(r,s,l,u);void 0==o&&(o=this.options.strictLocalEvaluation??!1);let d=await this.featureFlagsPoller?.getAllFlagsAndPayloads(h,a),g={},p={},f=!0;if(d&&(g=d.response,p=d.payloads,f=d.fallbackToFlags),f&&!o){let e=await super.getFeatureFlagsAndPayloadsStateless(h.distinctId,h.groups,h.personProperties,h.groupProperties,n,a);g={...g,...e.flags||{}},p={...p,...e.payloads||{}}}return void 0!==this._flagOverrides&&(g={...g,...this._flagOverrides}),void 0!==this._payloadOverrides&&(p={...p,...this._payloadOverrides}),{featureFlags:g,featureFlagPayloads:p}}groupIdentify({groupType:e,groupKey:t,properties:r,distinctId:i,disableGeoip:s}){super.groupIdentifyStateless(e,t,r,{disableGeoip:s},i)}async reloadFeatureFlags(){await this.featureFlagsPoller?.loadFeatureFlags(!0)}overrideFeatureFlags(e){let t=e=>Object.fromEntries(e.map(e=>[e,!0]));if(!1===e){this._flagOverrides=void 0,this._payloadOverrides=void 0;return}if(Array.isArray(e)){this._flagOverrides=t(e);return}if(this._isFeatureFlagOverrideOptions(e)){"flags"in e&&(!1===e.flags?this._flagOverrides=void 0:Array.isArray(e.flags)?this._flagOverrides=t(e.flags):void 0!==e.flags&&(this._flagOverrides={...e.flags})),"payloads"in e&&(!1===e.payloads?this._payloadOverrides=void 0:void 0!==e.payloads&&(this._payloadOverrides={...e.payloads}));return}this._flagOverrides={...e}}_isFeatureFlagOverrideOptions(e){if("object"!=typeof e||null===e||Array.isArray(e))return!1;if("flags"in e){let t=e.flags;if(!1===t||Array.isArray(t)||"object"==typeof t&&null!==t)return!0}if("payloads"in e){let t=e.payloads;if(!1===t||"object"==typeof t&&null!==t)return!0}return!1}withContext(e,t,r){return this.context?this.context.run(e,t,r):t()}getContext(){return this.context?.get()}enterContext(e,t){this.context?.enter(e,t)}async _shutdown(e){let t=this._consumeWaitUntilCycle();this.featureFlagsPoller?.stopPoller(e),this.errorTracking.shutdown();try{return await super._shutdown(e)}finally{t?.()}}async _requestRemoteConfigPayload(e){if(!this.options.personalApiKey)return;let t=`${this.host}/api/projects/@current/feature_flags/${e}/remote_config?token=${encodeURIComponent(this.apiKey)}`,r={method:"GET",headers:{...this.getCustomHeaders(),"Content-Type":"application/json",Authorization:`Bearer ${this.options.personalApiKey}`}},i=null;if(this.options.requestTimeout&&"number"==typeof this.options.requestTimeout){let e=new AbortController;i=ta(()=>{e.abort()},this.options.requestTimeout),r.signal=e.signal}try{return await this.fetch(t,r)}catch(e){this._events.emit("error",e);return}finally{i&&clearTimeout(i)}}extractPropertiesFromEvent(e,t){if(!e)return{personProperties:{},groupProperties:{}};let r={},i={};for(let[s,n]of Object.entries(e))if(Z(n)&&t&&s in t){let e={};for(let[t,r]of Object.entries(n))e[String(t)]=String(r);i[String(s)]=e}else r[String(s)]=String(n);return{personProperties:r,groupProperties:i}}async getFeatureFlagsForEvent(e,t,r,i){let s=i?.personProperties||{},n=i?.groupProperties||{},a=i?.flagKeys;if(i?.onlyEvaluateLocally??this.options.strictLocalEvaluation)if(!((this.featureFlagsPoller?.featureFlags?.length||0)>0))return{};else{let i={};for(let[e,r]of Object.entries(t||{}))i[e]=String(r);return await this.getAllFlags(e,{groups:i,personProperties:s,groupProperties:n,disableGeoip:r,onlyEvaluateLocally:!0,flagKeys:a})}if((this.featureFlagsPoller?.featureFlags?.length||0)>0){let i={};for(let[e,r]of Object.entries(t||{}))i[e]=String(r);return await this.getAllFlags(e,{groups:i,personProperties:s,groupProperties:n,disableGeoip:r,onlyEvaluateLocally:!0,flagKeys:a})}return(await super.getFeatureFlagsStateless(e,t,s,n,r)).flags}addLocalPersonAndGroupProperties(e,t,r,i){let s={distinct_id:e,...r||{}},n={};if(t)for(let e of Object.keys(t))n[e]={$group_key:t[e],...i?.[e]||{}};return{allPersonProperties:s,allGroupProperties:n}}createFeatureFlagEvaluationContext(e,t,r,i){return{distinctId:e,groups:t||{},personProperties:r||{},groupProperties:i||{},evaluationCache:{}}}captureException(e,t,r,i){if(!rt.isPreviouslyCapturedError(e)){let s=Error("PostHog syntheticException");this.addPendingPromise(rt.buildEventMessage(e,{syntheticException:s},t,r).then(e=>this.capture({...e,uuid:i})))}}async captureExceptionImmediate(e,t,r){if(!rt.isPreviouslyCapturedError(e)){let i=Error("PostHog syntheticException");this.addPendingPromise(rt.buildEventMessage(e,{syntheticException:i},t,r).then(e=>this.captureImmediate(e)))}}async prepareEventMessage(e){let{distinctId:t,event:r,properties:i,groups:s,sendFeatureFlags:n,timestamp:a,disableGeoip:o,uuid:l}=e,u=this.context?.get(),c=t||u?.distinctId,h={...this.props,...u?.properties||{},...i||{}};c||(c=f().toString(),h.$process_person_profile=!1),u?.sessionId&&!h.$session_id&&(h.$session_id=u.sessionId);let d=this._runBeforeSend({distinctId:c,event:r,properties:h,groups:s,sendFeatureFlags:n,timestamp:a,disableGeoip:o,uuid:l});if(!d)return Promise.reject(null);let g=await Promise.resolve().then(async()=>n?await this.getFeatureFlagsForEvent(d.distinctId,s,o,"object"==typeof n?n:void 0):(d.event,{})).then(e=>{let t={};if(e)for(let[r,i]of Object.entries(e))t[`$feature/${r}`]=i;let r=Object.keys(e||{}).filter(t=>e?.[t]!==!1).sort();return r.length>0&&(t.$active_feature_flags=r),t}).catch(()=>({})).then(e=>({...e,...d.properties||{},$groups:d.groups||s}));return"$pageview"===d.event&&this.options.__preview_capture_bot_pageviews&&"string"==typeof g.$raw_user_agent&&_(g.$raw_user_agent,this.options.custom_blocked_useragents||[])&&(d.event="$bot_pageview",g.$browser_type="bot"),{distinctId:d.distinctId,event:d.event,properties:g,options:{timestamp:d.timestamp,disableGeoip:d.disableGeoip,uuid:d.uuid}}}_runBeforeSend(e){let t=this.options.before_send;if(!t)return e;let r=Array.isArray(t)?t:[t],i=e;for(let t of r){if(!(i=t(i)))return this._logger.info(`Event '${e.event}' was rejected in beforeSend function`),null;if(!i.properties||0===Object.keys(i.properties).length){let e=`Event '${i.event}' has no properties after beforeSend function, this is likely an error.`;this._logger.warn(e)}}return i}}var t4=t1,rm=e.i(78500);class rv{constructor(){this.storage=new rm.AsyncLocalStorage}get(){return this.storage.getStore()}run(e,t,r){return this.storage.run(this.resolve(e,r),t)}enter(e,t){this.storage.enterWith(this.resolve(e,t))}resolve(e,t){if(t?.fresh===!0)return e;let r=this.get()||{};return{distinctId:e.distinctId??r.distinctId,sessionId:e.sessionId??r.sessionId,properties:{...r.properties||{},...e.properties||{}}}}}let rb="posthog-node";function r_(e,{organization:t,projectId:r,prefix:i,severityAllowList:s=["error"],sendExceptionsToPostHog:n=!0}={}){return a=>{if(!("*"===s||s.includes(a.level)))return a;a.tags||(a.tags={});let o=a.tags[rE.POSTHOG_ID_TAG];if(void 0===o)return a;let l=e.options.host??"https://us.i.posthog.com",u=new URL(`/project/${e.apiKey}/person/${o}`,l).toString();a.tags["PostHog Person URL"]=u;let c=a.exception?.values||[],h=c.map(e=>({...e,stacktrace:e.stacktrace?{...e.stacktrace,type:"raw",frames:(e.stacktrace.frames||[]).map(e=>({...e,platform:"node:javascript"}))}:void 0})),d={$exception_message:c[0]?.value||a.message,$exception_type:c[0]?.type,$exception_level:a.level,$exception_list:h,$sentry_event_id:a.event_id,$sentry_exception:a.exception,$sentry_exception_message:c[0]?.value||a.message,$sentry_exception_type:c[0]?.type,$sentry_tags:a.tags};return t&&r&&(d.$sentry_url=(i||"https://sentry.io/organizations/")+t+"/issues/?project="+r+"&query="+a.event_id),n&&e.capture({event:"$exception",distinctId:o,properties:d}),a}}function rw(e,t){let r=r_(e,t);return{name:rb,processEvent:e=>r(e)}}class rE{static #e=this.POSTHOG_ID_TAG="posthog_distinct_id";constructor(e,t,r,i,s){this.name=rb,this.name=rb,this.setupOnce=function(n,a){n(r_(e,{organization:t,projectId:a()?.getClient()?.getDsn()?.projectId,prefix:r,severityAllowList:i,sendExceptionsToPostHog:s??!0}))}}}function rP(e,t){var r;t.use((r=e,(e,t,i,s)=>{if(rt.isPreviouslyCapturedError(e))return void s(e);let n=t.headers["x-posthog-session-id"],a=t.headers["x-posthog-distinct-id"],o=Error("Synthetic exception");r.addPendingPromise(rt.buildEventMessage(e,{mechanism:{type:"middleware",handled:!1},syntheticException:o},a,{$session_id:n,$current_url:t.url,$request_method:t.method,$request_path:t.path,$user_agent:t.headers["user-agent"],$response_status_code:i.statusCode,$ip:t.headers["x-forwarded-for"]||t?.socket?.remoteAddress}).then(e=>{r.capture(e)})),s(e)}))}e.s(["PostHogSentryIntegration",()=>rE,"createEventProcessor",()=>r_,"sentryIntegration",()=>rw],91573),e.s(["setupExpressErrorHandler",()=>rP],93546),e.s([],92998),rt.errorPropertiesBuilder=new t4.ErrorPropertiesBuilder([new t4.EventCoercer,new t4.ErrorCoercer,new t4.ObjectCoercer,new t4.StringCoercer,new t4.PrimitiveCoercer],t4.createStackParser("node:javascript",t4.nodeStackLineParser),[(n=function(e=process.argv[1]?(0,o.dirname)(process.argv[1]):process.cwd(),t="\\"===o.sep){let r=t?l(e):e;return e=>{if(!e)return;let i=t?l(e):e,{dir:s,base:n,ext:a}=o.posix.parse(i);(".js"===a||".mjs"===a||".cjs"===a)&&(n=n.slice(0,-1*a.length));let u=decodeURIComponent(n);s||(s=".");let c=s.lastIndexOf("/node_modules");if(c>-1)return`${s.slice(c+14).replace(/\//g,".")}:${u}`;if(s.startsWith(r)){let e=s.slice(r.length+1).replace(/\//g,".");return e?`${e}:${u}`:u}return u}}(),async e=>{for(let t of e)t.module=n(t.filename);return e}),t9]);class rF extends ry{getLibraryId(){return"posthog-node"}initializeContext(){return new rv}}e.s(["PostHog",()=>rF],47839),e.i(47839),e.i(92998),e.i(91573),e.i(93546),e.i(58325),e.s(["FeatureFlagError",()=>m,"PostHogSentryIntegration",()=>rE,"createEventProcessor",()=>r_,"sentryIntegration",()=>rw,"setupExpressErrorHandler",()=>rP],57564),e.i(57564),e.s(["FeatureFlagError",()=>m,"PostHog",()=>rF,"PostHogSentryIntegration",()=>rE,"createEventProcessor",()=>r_,"sentryIntegration",()=>rw,"setupExpressErrorHandler",()=>rP],28864)}];
|
|
1
|
+
module.exports=[28864,e=>{"use strict";let t,r,i,s,a;var n,o=e.i(14747);function l(e){return e.replace(/^[A-Z]:/,"").replace(/\\/g,"/")}let u=e=>void 0===e?void 0:e.variant??e.enabled,c=e=>{if("string"!=typeof e)return e;try{return JSON.parse(e)}catch{return e}},h="0123456789abcdef";class d{constructor(e){this.bytes=e}static ofInner(e){if(16===e.length)return new d(e);throw TypeError("not 128-bit length")}static fromFieldsV7(e,t,r,i){if(!Number.isInteger(e)||!Number.isInteger(t)||!Number.isInteger(r)||!Number.isInteger(i)||e<0||t<0||r<0||i<0||e>0xffffffffffff||t>4095||r>0x3fffffff||i>0xffffffff)throw RangeError("invalid field value");let s=new Uint8Array(16);return s[0]=e/0x10000000000,s[1]=e/0x100000000,s[2]=e/0x1000000,s[3]=e/65536,s[4]=e/256,s[5]=e,s[6]=112|t>>>8,s[7]=t,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 d(s)}static parse(e){let t;switch(e.length){case 32:t=/^[0-9a-f]{32}$/i.exec(e)?.[0];break;case 36:t=/^([0-9a-f]{8})-([0-9a-f]{4})-([0-9a-f]{4})-([0-9a-f]{4})-([0-9a-f]{12})$/i.exec(e)?.slice(1,6).join("");break;case 38:t=/^\{([0-9a-f]{8})-([0-9a-f]{4})-([0-9a-f]{4})-([0-9a-f]{4})-([0-9a-f]{12})\}$/i.exec(e)?.slice(1,6).join("");break;case 45:t=/^urn:uuid:([0-9a-f]{8})-([0-9a-f]{4})-([0-9a-f]{4})-([0-9a-f]{4})-([0-9a-f]{12})$/i.exec(e)?.slice(1,6).join("")}if(t){let e=new Uint8Array(16);for(let r=0;r<16;r+=4){let i=parseInt(t.substring(2*r,2*r+8),16);e[r+0]=i>>>24,e[r+1]=i>>>16,e[r+2]=i>>>8,e[r+3]=i}return new d(e)}throw SyntaxError("could not parse UUID string")}toString(){let e="";for(let t=0;t<this.bytes.length;t++)e+=h.charAt(this.bytes[t]>>>4),e+=h.charAt(15&this.bytes[t]),(3===t||5===t||7===t||9===t)&&(e+="-");return e}toHex(){let e="";for(let t=0;t<this.bytes.length;t++)e+=h.charAt(this.bytes[t]>>>4),e+=h.charAt(15&this.bytes[t]);return e}toJSON(){return this.toString()}getVariant(){let e=this.bytes[8]>>>4;if(e<0)throw Error("unreachable");if(e<=7)return this.bytes.every(e=>0===e)?"NIL":"VAR_0";if(e<=11)return"VAR_10";if(e<=13)return"VAR_110";if(e<=15)return this.bytes.every(e=>255===e)?"MAX":"VAR_RESERVED";throw Error("unreachable")}getVersion(){return"VAR_10"===this.getVariant()?this.bytes[6]>>>4:void 0}clone(){return new d(this.bytes.slice(0))}equals(e){return 0===this.compareTo(e)}compareTo(e){for(let t=0;t<16;t++){let r=this.bytes[t]-e.bytes[t];if(0!==r)return Math.sign(r)}return 0}}class g{constructor(e){this.timestamp=0,this.counter=0,this.random=e??p()}generate(){return this.generateOrResetCore(Date.now(),1e4)}generateOrAbort(){return this.generateOrAbortCore(Date.now(),1e4)}generateOrResetCore(e,t){let r=this.generateOrAbortCore(e,t);return void 0===r&&(this.timestamp=0,r=this.generateOrAbortCore(e,t)),r}generateOrAbortCore(e,t){if(!Number.isInteger(e)||e<1||e>0xffffffffffff)throw RangeError("`unixTsMs` must be a 48-bit positive integer");if(t<0||t>0xffffffffffff)throw RangeError("`rollbackAllowance` out of reasonable range");if(e>this.timestamp)this.timestamp=e,this.resetCounter();else{if(!(e+t>=this.timestamp))return;this.counter++,this.counter>0x3ffffffffff&&(this.timestamp++,this.resetCounter())}return d.fromFieldsV7(this.timestamp,Math.trunc(this.counter/0x40000000),this.counter&0x40000000-1,this.random.nextUint32())}resetCounter(){this.counter=1024*this.random.nextUint32()+(1023&this.random.nextUint32())}generateV4(){let e=new Uint8Array(Uint32Array.of(this.random.nextUint32(),this.random.nextUint32(),this.random.nextUint32(),this.random.nextUint32()).buffer);return e[6]=64|e[6]>>>4,e[8]=128|e[8]>>>2,d.ofInner(e)}}let p=()=>({nextUint32:()=>65536*Math.trunc(65536*Math.random())+Math.trunc(65536*Math.random())}),f=()=>(t||(t=new g)).generate();var y=((n={}).AnonymousId="anonymous_id",n.DistinctId="distinct_id",n.Props="props",n.EnablePersonProcessing="enable_person_processing",n.PersonMode="person_mode",n.FeatureFlagDetails="feature_flag_details",n.FeatureFlags="feature_flags",n.FeatureFlagPayloads="feature_flag_payloads",n.BootstrapFeatureFlagDetails="bootstrap_feature_flag_details",n.BootstrapFeatureFlags="bootstrap_feature_flags",n.BootstrapFeatureFlagPayloads="bootstrap_feature_flag_payloads",n.OverrideFeatureFlags="override_feature_flags",n.Queue="queue",n.OptedOut="opted_out",n.SessionId="session_id",n.SessionStartTimestamp="session_start_timestamp",n.SessionLastTimestamp="session_timestamp",n.PersonProperties="person_properties",n.GroupProperties="group_properties",n.InstalledAppBuild="installed_app_build",n.InstalledAppVersion="installed_app_version",n.SessionReplay="session_replay",n.SurveyLastSeenDate="survey_last_seen_date",n.SurveysSeen="surveys_seen",n.Surveys="surveys",n.RemoteConfig="remote_config",n.FlagsEndpointWasHit="flags_endpoint_was_hit",n);let m={ERRORS_WHILE_COMPUTING:"errors_while_computing_flags",FLAG_MISSING:"flag_missing",QUOTA_LIMITED:"quota_limited",TIMEOUT:"timeout",CONNECTION_ERROR:"connection_error",UNKNOWN_ERROR:"unknown_error",apiError:e=>`api_error_${e}`},v=["$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"],b=["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"],_=function(e,t=[]){if(!e)return!1;let r=e.toLowerCase();return b.concat(t).some(e=>{let t=e.toLowerCase();return -1!==r.indexOf(t)})};function w(e,t){return -1!==e.indexOf(t)}e.s(["DEFAULT_BLOCKED_UA_STRS",()=>b,"isBlockedUA",()=>_],74770);let E=function(e){return e.trim()},P=function(e){return e.replace(/^\$/,"")};function F(e){return["distinct_id","distinctid"].includes(e.toLowerCase())}function x(e){return null===e||"object"!=typeof e?e:Array.isArray(e)?e.map(x):Object.keys(e).sort().reduce((t,r)=>(t[r]=x(e[r]),t),{})}function S(e,t,r){return JSON.stringify({distinct_id:e,userPropertiesToSet:t?x(t):void 0,userPropertiesToSetOnce:r?x(r):void 0})}e.s(["getPersonPropertiesHash",()=>S,"includes",()=>w,"isDistinctIdStringLike",()=>F,"stripLeadingDollar",()=>P,"trim",()=>E],58750);let k=Array.isArray,C=Object.prototype,I=C.hasOwnProperty,$=C.toString,O=k||function(e){return"[object Array]"===$.call(e)},A=e=>"function"==typeof e,T=e=>A(e)&&-1!==e.toString().indexOf("[native code]"),R=e=>e===Object(e)&&!O(e),L=e=>{if(R(e)){for(let t in e)if(I.call(e,t))return!1;return!0}return!1},M=e=>void 0===e,j=e=>"[object String]"==$.call(e),D=e=>j(e)&&0===e.trim().length,U=e=>null===e,B=e=>M(e)||U(e),N=e=>"[object Number]"==$.call(e)&&e==e,q=e=>N(e)&&e>0,H=e=>"[object Boolean]"===$.call(e),G=e=>e instanceof FormData,z=e=>e instanceof File,W=e=>e instanceof Error,K=e=>w(v,e);function V(e){return null===e||"object"!=typeof e}function Q(e,t){return Object.prototype.toString.call(e)===`[object ${t}]`}function J(e){switch(Object.prototype.toString.call(e)){case"[object Error]":case"[object Exception]":case"[object DOMException]":case"[object DOMError]":case"[object WebAssembly.Exception]":return!0;default:return ee(e,Error)}}function Y(e){return Q(e,"ErrorEvent")}function X(e){return!M(Event)&&ee(e,Event)}function Z(e){return Q(e,"Object")}function ee(e,t){try{return e instanceof t}catch{return!1}}let et=[!0,"true",1,"1","yes"],er=e=>w(et,e),ei=[!1,"false",0,"0","no"],es=e=>w(ei,e);function ea(e,t,r,i,s){if(t>r&&(i.warn("min cannot be greater than max."),t=r),N(e))if(e>r)return i.warn(" cannot be greater than max: "+r+". Using max value instead."),r;else return e<t?(i.warn(" cannot be less than min: "+t+". Using min value instead."),t):e;return i.warn(" must be a number. using max or fallback. max: "+r+", fallback: "+s),ea(s||r,t,r,i)}function en(e,t,r=!0){if(null==e)return r;if("boolean"==typeof e)return e;if("object"==typeof e){let i=e[t];return"boolean"==typeof i?i:r}return r}function eo(e,t){if(null==e||"object"!=typeof e)return;let r=e[t];if("number"==typeof r&&Number.isFinite(r))return r;if("string"==typeof r){let e=r.trim();if(""===e)return;let t=Number(e);return Number.isFinite(t)?t:void 0}}function el(e){return"number"==typeof e&&Number.isFinite(e)&&e>=0&&e<=1}e.s(["hasOwnProperty",()=>I,"isArray",()=>O,"isBoolean",()=>H,"isBuiltin",()=>Q,"isEmptyObject",()=>L,"isEmptyString",()=>D,"isError",()=>J,"isErrorEvent",()=>Y,"isEvent",()=>X,"isFile",()=>z,"isFormData",()=>G,"isFunction",()=>A,"isKnownUnsafeEditableEvent",()=>K,"isNativeFunction",()=>T,"isNoLike",()=>es,"isNull",()=>U,"isNullish",()=>B,"isNumber",()=>N,"isObject",()=>R,"isPlainError",()=>W,"isPlainObject",()=>Z,"isPositiveNumber",()=>q,"isPrimitive",()=>V,"isString",()=>j,"isUndefined",()=>M,"isYesLike",()=>er,"noLikeValues",()=>ei,"yesLikeValues",()=>et],36418),e.s(["clampToRange",()=>ea,"getRemoteConfigBool",()=>en,"getRemoteConfigNumber",()=>eo,"isValidSampleRate",()=>el],73362);class eu{constructor(e){this._buckets={},this._onBucketRateLimited=e._onBucketRateLimited,this._bucketSize=ea(e.bucketSize,0,100,e._logger),this._refillRate=ea(e.refillRate,0,this._bucketSize,e._logger),this._refillInterval=ea(e.refillInterval,0,864e5,e._logger)}_applyRefill(e,t){let r=Math.floor((t-e.lastAccess)/this._refillInterval);if(r>0){let t=r*this._refillRate;e.tokens=Math.min(e.tokens+t,this._bucketSize),e.lastAccess=e.lastAccess+r*this._refillInterval}}consumeRateLimit(e){let t=Date.now(),r=String(e),i=this._buckets[r];return i?this._applyRefill(i,t):(i={tokens:this._bucketSize,lastAccess:t},this._buckets[r]=i),0===i.tokens||(i.tokens--,0===i.tokens&&this._onBucketRateLimited?.(e),0===i.tokens)}stop(){this._buckets={}}}e.s(["BucketedRateLimiter",()=>eu],34223);class ec{add(e){let t=f().toString();return this.promiseByIds[t]=e,e.catch(()=>{}).finally(()=>{delete this.promiseByIds[t]}),e}async join(){let e=Object.values(this.promiseByIds),t=e.length;for(;t>0;)await Promise.all(e),t=(e=Object.values(this.promiseByIds)).length}get length(){return Object.keys(this.promiseByIds).length}constructor(){this.promiseByIds={}}}e.s(["PromiseQueue",()=>ec],14901);let eh=(e,t,r)=>{function i(s,...a){t(()=>{(0,r[s])(e,...a)})}return{info:(...e)=>{i("log",...e)},warn:(...e)=>{i("warn",...e)},error:(...e)=>{i("error",...e)},critical:(...t)=>{r.error(e,...t)},createLogger:i=>eh(`${e} ${i}`,t,r)}},ed=e=>e();function eg(e,t=ed){return eh(e,t,function(e=console){return{log:e.log.bind(e),warn:e.warn.bind(e),error:e.error.bind(e),debug:e.debug.bind(e)}}())}e.s(["_createLogger",()=>eh,"createLogger",()=>eg],1346);let ep="Mobile",ef="Android",ey="Tablet",em=ef+" "+ey,ev="iPad",eb="Apple",e_=eb+" Watch",ew="Safari",eE="BlackBerry",eP="Samsung",eF=eP+"Browser",ex=eP+" Internet",eS="Chrome",ek=eS+" OS",eC=eS+" iOS",eI="Internet Explorer",e$=eI+" "+ep,eO="Opera",eA=eO+" Mini",eT="Edge",eR="Microsoft "+eT,eL="Firefox",eM=eL+" iOS",ej="Nintendo",eD="PlayStation",eU="Xbox",eB=ef+" "+ep,eN=ep+" "+ew,eq="Windows",eH=eq+" Phone",eG="Nokia",ez="Ouya",eW="Generic",eK=eW+" "+ep.toLowerCase(),eV=eW+" "+ey.toLowerCase(),eQ="Konqueror",eJ="(\\d+(\\.\\d+)?)",eY=RegExp("Version/"+eJ),eX=RegExp(eU,"i"),eZ=RegExp(eD+" \\w+","i"),e0=RegExp(ej+" \\w+","i"),e1=RegExp(eE+"|PlayBook|BB10","i"),e4={"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"},e2=function(e,t){var r;if(t=t||"",w(e," OPR/")&&w(e,"Mini"))return eA;if(w(e," OPR/"))return eO;if(e1.test(e))return eE;if(w(e,"IE"+ep)||w(e,"WPDesktop"))return e$;if(w(e,eF))return ex;if(w(e,eT)||w(e,"Edg/"))return eR;if(w(e,"FBIOS"))return"Facebook "+ep;if(w(e,"UCWEB")||w(e,"UCBrowser"))return"UC Browser";if(w(e,"CriOS"))return eC;if(w(e,"CrMo")||w(e,eS))return eS;if(w(e,ef)&&w(e,ew))return eB;if(w(e,"FxiOS"))return eM;if(w(e.toLowerCase(),eQ.toLowerCase()))return eQ;if((r=t)&&w(r,eb)||w(e,ew)&&!w(e,eS)&&!w(e,ef))return w(e,ep)?eN:ew;if(w(e,eL))return eL;else if(w(e,"MSIE")||w(e,"Trident/"))return eI;else if(w(e,"Gecko"))return eL;return""},e3={[e$]:[RegExp("rv:"+eJ)],[eR]:[RegExp(eT+"?\\/"+eJ)],[eS]:[RegExp("("+eS+"|CrMo)\\/"+eJ)],[eC]:[RegExp("CriOS\\/"+eJ)],"UC Browser":[RegExp("(UCBrowser|UCWEB)\\/"+eJ)],[ew]:[eY],[eN]:[eY],[eO]:[RegExp("("+eO+"|OPR)\\/"+eJ)],[eL]:[RegExp(eL+"\\/"+eJ)],[eM]:[RegExp("FxiOS\\/"+eJ)],[eQ]:[RegExp("Konqueror[:/]?"+eJ,"i")],[eE]:[RegExp(eE+" "+eJ),eY],[eB]:[RegExp("android\\s"+eJ,"i")],[ex]:[RegExp(eF+"\\/"+eJ)],[eI]:[RegExp("(rv:|MSIE )"+eJ)],Mozilla:[RegExp("rv:"+eJ)]},e5=function(e,t){let r=e3[e2(e,t)];if(M(r))return null;for(let t=0;t<r.length;t++){let i=r[t],s=e.match(i);if(s)return parseFloat(s[s.length-2])}return null},e6=[[RegExp(eU+"; "+eU+" (.*?)[);]","i"),e=>[eU,e&&e[1]||""]],[RegExp(ej,"i"),[ej,""]],[RegExp(eD,"i"),[eD,""]],[e1,[eE,""]],[RegExp(eq,"i"),(e,t)=>{if(/Phone/.test(t)||/WPDesktop/.test(t))return[eH,""];if(new RegExp(ep).test(t)&&!/IEMobile\b/.test(t))return[eq+" "+ep,""];let r=/Windows NT ([0-9.]+)/i.exec(t);if(r&&r[1]){let e=e4[r[1]]||"";return/arm/i.test(t)&&(e="RT"),[eq,e]}return[eq,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,e=>e&&e[3]?["iOS",[e[3],e[4],e[5]||"0"].join(".")]:["iOS",""]],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,e=>{let t="";return e&&e.length>=3&&(t=M(e[2])?e[3]:e[2]),["watchOS",t]}],[RegExp("("+ef+" (\\d+)\\.(\\d+)\\.?(\\d+)?|"+ef+")","i"),e=>e&&e[2]?[ef,[e[2],e[3],e[4]||"0"].join(".")]:[ef,""]],[/Mac OS X (\d+)[_.](\d+)[_.]?(\d+)?/i,e=>{let t=["Mac OS X",""];if(e&&e[1]){let r=[e[1],e[2],e[3]||"0"];t[1]=r.join(".")}return t}],[/Mac/i,["Mac OS X",""]],[/CrOS/,[ek,""]],[/Linux|debian/i,["Linux",""]]],e9=function(e){for(let t=0;t<e6.length;t++){let[r,i]=e6[t],s=r.exec(e),a=s&&(A(i)?i(s,e):i);if(a)return a}return["",""]},e8=function(e){if(e0.test(e))return ej;if(eZ.test(e))return eD;if(eX.test(e))return eU;if(RegExp(ez,"i").test(e))return ez;if(RegExp("("+eH+"|WPDesktop)","i").test(e))return eH;if(/iPad/.test(e))return ev;if(/iPod/.test(e))return"iPod Touch";if(/iPhone/.test(e))return"iPhone";if(/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(e))return e_;else if(e1.test(e))return eE;else if(/(kobo)\s(ereader|touch)/i.test(e))return"Kobo";else if(RegExp(eG,"i").test(e))return eG;else if(/(kf[a-z]{2}wi|aeo[c-r]{2})( bui|\))/i.test(e)||/(kf[a-z]+)( bui|\)).+silk\//i.test(e))return"Kindle Fire";else if(/(Android|ZTE)/i.test(e))if(!(!new RegExp(ep).test(e)||/(9138B|TB782B|Nexus [97]|pixel c|HUAWEISHT|BTV|noble nook|smart ultra 6)/i.test(e)))return ef;else return/pixel[\daxl ]{1,6}/i.test(e)&&!/pixel c/i.test(e)||/(huaweimed-al00|tah-|APA|SM-G92|i980|zte|U304AA)/i.test(e)||/lmy47v/i.test(e)&&!/QTAQZ3/i.test(e)?ef:em;else if(RegExp("(pda|"+ep+")","i").test(e))return eK;else if(RegExp(ey,"i").test(e)&&!RegExp(ey+" pc","i").test(e))return eV;else return""},e7=function(e,t){let r=e8(e);return r===ev||r===em||"Kobo"===r||"Kindle Fire"===r||r===eV?ey:r===ej||r===eU||r===eD||r===ez?"Console":r===e_?"Wearable":r?ep:t?.userAgentDataPlatform==="Android"&&(t?.maxTouchPoints??0)>0?Math.min(t?.screenWidth??0,t?.screenHeight??0)/(t?.devicePixelRatio??1)>=600?ey:ep:"Desktop"};e.s(["detectBrowser",()=>e2,"detectBrowserVersion",()=>e5,"detectDevice",()=>e8,"detectDeviceType",()=>e7,"detectOS",()=>e9],49726);let te="utf8";function tt(e,t){if(!e||"string"!=typeof e||0===e.trim().length)throw Error(t)}function tr(e){return e?.replace(/\/+$/,"")}async function ti(e,t){let r=null;for(let i=0;i<t.retryCount+1;i++){i>0&&await new Promise(e=>setTimeout(e,t.retryDelay));try{return await e()}catch(e){if(r=e,!t.retryCheck(e))throw e}}throw r}function ts(){return new Date().getTime()}function ta(){return new Date().toISOString()}function tn(e,t){let r=setTimeout(e,t);return r?.unref&&r?.unref(),r}let to=e=>e&&"function"==typeof e.then,tl=e=>e instanceof Error;function tu(){return"u">typeof fetch?fetch:void 0!==globalThis.fetch?globalThis.fetch:void 0}function tc(e){return Promise.all(e.map(e=>(e??Promise.resolve()).then(e=>({status:"fulfilled",value:e}),e=>({status:"rejected",reason:e}))))}e.s(["STRING_FORMAT",()=>te,"allSettled",()=>tc,"assert",()=>tt,"currentISOTime",()=>ta,"currentTimestamp",()=>ts,"getFetch",()=>tu,"isError",()=>tl,"isPromise",()=>to,"removeTrailingSlash",()=>tr,"retriable",()=>ti,"safeSetTimeout",()=>tn],95757);class th{constructor(){this.events={},this.events={}}on(e,t){return this.events[e]||(this.events[e]=[]),this.events[e].push(t),()=>{this.events[e]=this.events[e].filter(e=>e!==t)}}emit(e,t){for(let r of this.events[e]||[])r(t);for(let r of this.events["*"]||[])r(e,t)}}async function td(e,t=!0){try{let t=new Blob([e],{type:"text/plain"}).stream().pipeThrough(new CompressionStream("gzip"));return await new Response(t).blob()}catch(e){return t&&console.error("Failed to gzip compress data",e),null}}class tg extends Error{constructor(e,t){super("HTTP error while fetching PostHog: status="+e.status+", reqByteLength="+t),this.response=e,this.reqByteLength=t,this.name="PostHogFetchHttpError"}get status(){return this.response.status}get text(){return this.response.text()}get json(){return this.response.json()}}class tp extends Error{constructor(e){super("Network error while fetching PostHog",e instanceof Error?{cause:e}:{}),this.error=e,this.name="PostHogFetchNetworkError"}}async function tf(e){if(e instanceof tg){let t="";try{t=await e.text}catch{}console.error(`Error while flushing PostHog: message=${e.message}, response body=${t}`,e)}else console.error("Error while flushing PostHog",e);return Promise.resolve()}function ty(e){return"object"==typeof e&&(e instanceof tg||e instanceof tp)}function tm(e){return"object"==typeof e&&e instanceof tg&&413===e.status}class tv{constructor(e,t={}){this.flushPromise=null,this.shutdownPromise=null,this.promiseQueue=new ec,this._events=new th,this._isInitialized=!1,tt(e,"You must pass your PostHog project's api key."),this.apiKey=e,this.host=tr(t.host||"https://us.i.posthog.com"),this.flushAt=t.flushAt?Math.max(t.flushAt,1):20,this.maxBatchSize=Math.max(this.flushAt,t.maxBatchSize??100),this.maxQueueSize=Math.max(this.flushAt,t.maxQueueSize??1e3),this.flushInterval=t.flushInterval??1e4,this.preloadFeatureFlags=t.preloadFeatureFlags??!0,this.defaultOptIn=t.defaultOptIn??!0,this.disableSurveys=t.disableSurveys??!1,this._retryOptions={retryCount:t.fetchRetryCount??3,retryDelay:t.fetchRetryDelay??3e3,retryCheck:ty},this.requestTimeout=t.requestTimeout??1e4,this.featureFlagsRequestTimeoutMs=t.featureFlagsRequestTimeoutMs??3e3,this.remoteConfigRequestTimeoutMs=t.remoteConfigRequestTimeoutMs??3e3,this.disableGeoip=t.disableGeoip??!0,this.disabled=t.disabled??!1,this.historicalMigration=t?.historicalMigration??!1,this._initPromise=Promise.resolve(),this._isInitialized=!0,this._logger=eg("[PostHog]",this.logMsgIfDebug.bind(this)),this.evaluationContexts=t?.evaluationContexts??t?.evaluationEnvironments,t?.evaluationEnvironments&&!t?.evaluationContexts&&this._logger.warn("evaluationEnvironments is deprecated. Use evaluationContexts instead. This property will be removed in a future version."),this.disableCompression=!("CompressionStream"in globalThis)||(t?.disableCompression??!1)}logMsgIfDebug(e){this.isDebug&&e()}wrap(e){return this.disabled?void this._logger.warn("The client is disabled"):this._isInitialized?e():void this._initPromise.then(()=>e())}getCommonEventProperties(){return{$lib:this.getLibraryId(),$lib_version:this.getLibraryVersion()}}get optedOut(){return this.getPersistedProperty(y.OptedOut)??!this.defaultOptIn}async optIn(){this.wrap(()=>{this.setPersistedProperty(y.OptedOut,!1)})}async optOut(){this.wrap(()=>{this.setPersistedProperty(y.OptedOut,!0)})}on(e,t){return this._events.on(e,t)}debug(e=!0){if(this.removeDebugCallback?.(),e){let e=this.on("*",(e,t)=>this._logger.info(e,t));this.removeDebugCallback=()=>{e(),this.removeDebugCallback=void 0}}}get isDebug(){return!!this.removeDebugCallback}get isDisabled(){return this.disabled}buildPayload(e){return{distinct_id:e.distinct_id,event:e.event,properties:{...e.properties||{},...this.getCommonEventProperties()}}}addPendingPromise(e){return this.promiseQueue.add(e)}identifyStateless(e,t,r){this.wrap(()=>{let i={...this.buildPayload({distinct_id:e,event:"$identify",properties:t})};this.enqueue("identify",i,r)})}async identifyStatelessImmediate(e,t,r){let i={...this.buildPayload({distinct_id:e,event:"$identify",properties:t})};await this.sendImmediate("identify",i,r)}captureStateless(e,t,r,i){this.wrap(()=>{let s=this.buildPayload({distinct_id:e,event:t,properties:r});this.enqueue("capture",s,i)})}async captureStatelessImmediate(e,t,r,i){let s=this.buildPayload({distinct_id:e,event:t,properties:r});await this.sendImmediate("capture",s,i)}aliasStateless(e,t,r,i){this.wrap(()=>{let s=this.buildPayload({event:"$create_alias",distinct_id:t,properties:{...r||{},distinct_id:t,alias:e}});this.enqueue("alias",s,i)})}async aliasStatelessImmediate(e,t,r,i){let s=this.buildPayload({event:"$create_alias",distinct_id:t,properties:{...r||{},distinct_id:t,alias:e}});await this.sendImmediate("alias",s,i)}groupIdentifyStateless(e,t,r,i,s,a){this.wrap(()=>{let n=this.buildPayload({distinct_id:s||`$${e}_${t}`,event:"$groupidentify",properties:{$group_type:e,$group_key:t,$group_set:r||{},...a||{}}});this.enqueue("capture",n,i)})}async getRemoteConfig(){await this._initPromise;let e=this.host;"https://us.i.posthog.com"===e?e="https://us-assets.i.posthog.com":"https://eu.i.posthog.com"===e&&(e="https://eu-assets.i.posthog.com");let t=`${e}/array/${this.apiKey}/config`,r={method:"GET",headers:{...this.getCustomHeaders(),"Content-Type":"application/json"}};return this.fetchWithRetry(t,r,{retryCount:0},this.remoteConfigRequestTimeoutMs).then(e=>e.json()).catch(e=>{this._logger.error("Remote config could not be loaded",e),this._events.emit("error",e)})}async getFlags(e,t={},r={},i={},s={},a=!1){await this._initPromise;let n=`${this.host}/flags/?v=2${a?"&config=true":""}`,o={token:this.apiKey,distinct_id:e,groups:t,person_properties:r,group_properties:i,...s};this.evaluationContexts&&this.evaluationContexts.length>0&&(o.evaluation_contexts=this.evaluationContexts);let l={method:"POST",headers:{...this.getCustomHeaders(),"Content-Type":"application/json"},body:JSON.stringify(o)};return this._logger.info("Flags URL",n),this.fetchWithRetry(n,l,{retryCount:0},this.featureFlagsRequestTimeoutMs).then(e=>e.json()).then(e=>({success:!0,response:(e=>{if("flags"in e){let t,r=Object.fromEntries(Object.entries(e.flags??{}).map(([e,t])=>[e,u(t)]).filter(([,e])=>void 0!==e)),i=Object.fromEntries(Object.keys(t=e.flags??{}).filter(e=>{let r=t[e];return r.enabled&&r.metadata&&void 0!==r.metadata.payload}).map(e=>{let r=t[e].metadata?.payload;return[e,r?c(r):void 0]}));return{...e,featureFlags:r,featureFlagPayloads:i}}{let t=e.featureFlags??{},r=Object.fromEntries(Object.entries(e.featureFlagPayloads||{}).map(([e,t])=>[e,c(t)])),i=Object.fromEntries(Object.entries(t).map(([e,t])=>{var i,s;return[e,{key:e,enabled:"string"==typeof(i=t)||i,variant:"string"==typeof i?i:void 0,reason:void 0,metadata:{id:void 0,version:void 0,payload:(s=r[e])?JSON.stringify(s):void 0,description:void 0}}]}));return{...e,featureFlags:t,featureFlagPayloads:r,flags:i}}})(e)})).catch(e=>(this._events.emit("error",e),{success:!1,error:this.categorizeRequestError(e)}))}categorizeRequestError(e){if(e instanceof tg)return{type:"api_error",statusCode:e.status};if(e instanceof tp){let t=e.error;return t instanceof Error&&("AbortError"===t.name||"TimeoutError"===t.name)?{type:"timeout"}:{type:"connection_error"}}return{type:"unknown_error"}}async getFeatureFlagStateless(e,t,r={},i={},s={},a){await this._initPromise;let n=await this.getFeatureFlagDetailStateless(e,t,r,i,s,a);if(void 0===n)return{response:void 0,requestId:void 0};let o=u(n.response);return void 0===o&&(o=!1),{response:o,requestId:n.requestId}}async getFeatureFlagDetailStateless(e,t,r={},i={},s={},a){await this._initPromise;let n=await this.getFeatureFlagDetailsStateless(t,r,i,s,a,[e]);if(void 0!==n)return{response:n.flags[e],requestId:n.requestId,evaluatedAt:n.evaluatedAt}}async getFeatureFlagPayloadStateless(e,t,r={},i={},s={},a){await this._initPromise;let n=await this.getFeatureFlagPayloadsStateless(t,r,i,s,a,[e]);if(!n)return;let o=n[e];return void 0===o?null:o}async getFeatureFlagPayloadsStateless(e,t={},r={},i={},s,a){return await this._initPromise,(await this.getFeatureFlagsAndPayloadsStateless(e,t,r,i,s,a)).payloads}async getFeatureFlagsStateless(e,t={},r={},i={},s,a){return await this._initPromise,await this.getFeatureFlagsAndPayloadsStateless(e,t,r,i,s,a)}async getFeatureFlagsAndPayloadsStateless(e,t={},r={},i={},s,a){await this._initPromise;let n=await this.getFeatureFlagDetailsStateless(e,t,r,i,s,a);return n?{flags:n.featureFlags,payloads:n.featureFlagPayloads,requestId:n.requestId}:{flags:void 0,payloads:void 0,requestId:void 0}}async getFeatureFlagDetailsStateless(e,t={},r={},i={},s,a){await this._initPromise;let n={};(s??this.disableGeoip)&&(n.geoip_disable=!0),a&&(n.flag_keys_to_evaluate=a);let o=await this.getFlags(e,t,r,i,n);if(!o.success)return;let l=o.response;return(l.errorsWhileComputingFlags&&console.error("[FEATURE FLAGS] Error while computing feature flags, some flags may be missing or incorrect. Learn more at https://posthog.com/docs/feature-flags/best-practices"),l.quotaLimited?.includes("feature_flags"))?(console.warn("[FEATURE FLAGS] Feature flags quota limit exceeded - feature flags unavailable. Learn more about billing limits at https://posthog.com/docs/billing/limits-alerts"),{flags:{},featureFlags:{},featureFlagPayloads:{},requestId:l?.requestId,quotaLimited:l.quotaLimited}):l}async getSurveysStateless(){if(await this._initPromise,!0===this.disableSurveys)return this._logger.info("Loading surveys is disabled."),[];let e=`${this.host}/api/surveys/?token=${this.apiKey}`,t={method:"GET",headers:{...this.getCustomHeaders(),"Content-Type":"application/json"}},r=await this.fetchWithRetry(e,t).then(e=>{if(200!==e.status||!e.json){let t=`Surveys API could not be loaded: ${e.status}`,r=Error(t);this._logger.error(r),this._events.emit("error",Error(t));return}return e.json()}).catch(e=>{this._logger.error("Surveys API could not be loaded",e),this._events.emit("error",e)}),i=r?.surveys;return i&&this._logger.info("Surveys fetched from API: ",JSON.stringify(i)),i??[]}get props(){return this._props||(this._props=this.getPersistedProperty(y.Props)),this._props||{}}set props(e){this._props=e}async register(e){this.wrap(()=>{this.props={...this.props,...e},this.setPersistedProperty(y.Props,this.props)})}async unregister(e){this.wrap(()=>{delete this.props[e],this.setPersistedProperty(y.Props,this.props)})}processBeforeEnqueue(e){return e}async flushStorage(){}enqueue(e,t,r){this.wrap(()=>{if(this.optedOut)return void this._events.emit(e,"Library is disabled. Not sending event. To re-enable, call posthog.optIn()");let i=this.prepareMessage(e,t,r);if(null===(i=this.processBeforeEnqueue(i)))return;let s=this.getPersistedProperty(y.Queue)||[];s.length>=this.maxQueueSize&&(s.shift(),this._logger.info("Queue is full, the oldest event is dropped.")),s.push({message:i}),this.setPersistedProperty(y.Queue,s),this._events.emit(e,i),s.length>=this.flushAt&&this.flushBackground(),this.flushInterval&&!this._flushTimer&&(this._flushTimer=tn(()=>this.flushBackground(),this.flushInterval))})}async sendImmediate(e,t,r){if(this.disabled)return void this._logger.warn("The client is disabled");if(this._isInitialized||await this._initPromise,this.optedOut)return void this._events.emit(e,"Library is disabled. Not sending event. To re-enable, call posthog.optIn()");let i=this.prepareMessage(e,t,r);if(null===(i=this.processBeforeEnqueue(i)))return;let s={api_key:this.apiKey,batch:[i],sent_at:ta()};this.historicalMigration&&(s.historical_migration=!0);let a=JSON.stringify(s),n=`${this.host}/batch/`,o=this.disableCompression?null:await td(a,this.isDebug),l={method:"POST",headers:{...this.getCustomHeaders(),"Content-Type":"application/json",...null!==o&&{"Content-Encoding":"gzip"}},body:o||a};try{await this.fetchWithRetry(n,l)}catch(e){this._events.emit("error",e)}}prepareMessage(e,t,r){let i={...t,type:e,library:this.getLibraryId(),library_version:this.getLibraryVersion(),timestamp:r?.timestamp?r?.timestamp:ta(),uuid:r?.uuid?r.uuid:f().toString()};return(r?.disableGeoip??this.disableGeoip)&&(i.properties||(i.properties={}),i.properties.$geoip_disable=!0),i.distinctId&&(i.distinct_id=i.distinctId,delete i.distinctId),i}clearFlushTimer(){this._flushTimer&&(clearTimeout(this._flushTimer),this._flushTimer=void 0)}flushBackground(){this.flush().catch(async e=>{await tf(e)})}async flush(){let e=tc([this.flushPromise]).then(()=>this._flush());return this.flushPromise=e,this.addPendingPromise(e),tc([e]).then(()=>{this.flushPromise===e&&(this.flushPromise=null)}),e}getCustomHeaders(){let e=this.getCustomUserAgent(),t={};return e&&""!==e&&(t["User-Agent"]=e),t}async _flush(){this.clearFlushTimer(),await this._initPromise;let e=this.getPersistedProperty(y.Queue)||[];if(!e.length)return;let t=[],r=e.length;for(;e.length>0&&t.length<r;){let r=e.slice(0,this.maxBatchSize),i=r.map(e=>e.message),s=async()=>{let t=(this.getPersistedProperty(y.Queue)||[]).slice(r.length);this.setPersistedProperty(y.Queue,t),e=t,await this.flushStorage()},a={api_key:this.apiKey,batch:i,sent_at:ta()};this.historicalMigration&&(a.historical_migration=!0);let n=JSON.stringify(a),o=`${this.host}/batch/`,l=this.disableCompression?null:await td(n,this.isDebug),u={method:"POST",headers:{...this.getCustomHeaders(),"Content-Type":"application/json",...null!==l&&{"Content-Encoding":"gzip"}},body:l||n},c={retryCheck:e=>!tm(e)&&ty(e)};try{await this.fetchWithRetry(o,u,c)}catch(e){if(tm(e)&&i.length>1){this.maxBatchSize=Math.max(1,Math.floor(i.length/2)),this._logger.warn(`Received 413 when sending batch of size ${i.length}, reducing batch size to ${this.maxBatchSize}`);continue}throw e instanceof tp||await s(),this._events.emit("error",e),e}await s(),t.push(...i)}this._events.emit("flush",t)}async fetchWithRetry(e,t,r,i){let s=t.body?t.body:"",a=-1;try{a=s instanceof Blob?s.size:Buffer.byteLength(s,te)}catch{a=s instanceof Blob?s.size:new TextEncoder().encode(s).length}return await ti(async()=>{let r=new AbortController,s=tn(()=>r.abort(),i??this.requestTimeout),n=null;try{n=await this.fetch(e,{signal:r.signal,...t})}catch(e){throw new tp(e)}finally{clearTimeout(s)}if("no-cors"!==t.mode&&(n.status<200||n.status>=400))throw new tg(n,a);return n},{...this._retryOptions,...r})}async _shutdown(e=3e4){let t;await this._initPromise;let r=!1;this.clearFlushTimer();let i=async()=>{try{for(await this.promiseQueue.join();;){let e=this.getPersistedProperty(y.Queue)||[];if(0===e.length||(await this.flush(),r))break}}catch(e){if(!ty(e))throw e;await tf(e)}};try{return await Promise.race([new Promise((i,s)=>{t=tn(()=>{this._logger.error("Timed out while shutting down PostHog"),r=!0,s("Timeout while shutting down PostHog. Some events may not have been sent.")},e)}),i()])}finally{clearTimeout(t)}}async shutdown(e=3e4){return this.shutdownPromise?this._logger.warn("shutdown() called while already shutting down. shutdown() is meant to be called once before process exit - use flush() for per-request cleanup"):this.shutdownPromise=this._shutdown(e).finally(()=>{this.shutdownPromise=null}),this.shutdownPromise}}class tb{constructor(e,t,r=[]){this.coercers=e,this.stackParser=t,this.modifiers=r}buildFromUnknown(e,t={}){let r=t&&t.mechanism||{handled:!0,type:"generic"},i=this.buildCoercingContext(r,t,0).apply(e),s=this.buildParsingContext(t),a=this.parseStacktrace(i,s);return{$exception_list:this.convertToExceptionList(a,r),$exception_level:"error"}}async modifyFrames(e){for(let t of e)t.stacktrace&&t.stacktrace.frames&&O(t.stacktrace.frames)&&(t.stacktrace.frames=await this.applyModifiers(t.stacktrace.frames));return e}coerceFallback(e){return{type:"Error",value:"Unknown error",stack:e.syntheticException?.stack,synthetic:!0}}parseStacktrace(e,t){let r,i;return null!=e.cause&&(r=this.parseStacktrace(e.cause,t)),""!=e.stack&&null!=e.stack&&(i=this.applyChunkIds(this.stackParser(e.stack,e.synthetic?t.skipFirstLines:0),t.chunkIdMap)),{...e,cause:r,stack:i}}applyChunkIds(e,t){return e.map(e=>(e.filename&&t&&(e.chunk_id=t[e.filename]),e))}applyCoercers(e,t){for(let r of this.coercers)if(r.match(e))return r.coerce(e,t);return this.coerceFallback(t)}async applyModifiers(e){let t=e;for(let e of this.modifiers)t=await e(t);return t}convertToExceptionList(e,t){let r={type:e.type,value:e.value,mechanism:{type:t.type??"generic",handled:t.handled??!0,synthetic:e.synthetic??!1}};e.stack&&(r.stacktrace={type:"raw",frames:e.stack});let i=[r];return null!=e.cause&&i.push(...this.convertToExceptionList(e.cause,{...t,handled:!0})),i}buildParsingContext(e){return{chunkIdMap:function(e){let t=globalThis._posthogChunkIds;if(!t)return;let a=Object.keys(t);return s&&a.length===i?s:(i=a.length,s=a.reduce((i,s)=>{r||(r={});let a=r[s];if(a)i[a[0]]=a[1];else{let a=e(s);for(let e=a.length-1;e>=0;e--){let n=a[e],o=n?.filename,l=t[s];if(o&&l){i[o]=l,r[s]=[o,l];break}}}return i},{}))}(this.stackParser),skipFirstLines:e.skipFirstLines??1}}buildCoercingContext(e,t,r=0){let i=(r,i)=>{if(i<=4){let s=this.buildCoercingContext(e,t,i);return this.applyCoercers(r,s)}};return{...t,syntheticException:0==r?t.syntheticException:void 0,mechanism:e,apply:e=>i(e,r),next:e=>i(e,r+1)}}}function t_(e,t,r,i,s){let a={platform:e,filename:t,function:"<anonymous>"===r?"?":r,in_app:!0};return M(i)||(a.lineno=i),M(s)||(a.colno=s),a}e.s(["ErrorPropertiesBuilder",()=>tb],80446);let tw=(e,t)=>{let r=-1!==e.indexOf("safari-extension"),i=-1!==e.indexOf("safari-web-extension");return r||i?[-1!==e.indexOf("@")?e.split("@")[0]:"?",r?`safari-extension:${t}`:`safari-web-extension:${t}`]:[e,t]},tE=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,tP=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,tF=/\((\S*)(?::(\d+))(?::(\d+))\)/,tx=(e,t)=>{let r=tE.exec(e);if(r){let[,e,i,s]=r;return t_(t,e,"?",+i,+s)}let i=tP.exec(e);if(i){if(i[2]&&0===i[2].indexOf("eval")){let e=tF.exec(i[2]);e&&(i[2]=e[1],i[3]=e[2],i[4]=e[3])}let[e,r]=tw(i[1]||"?",i[2]);return t_(t,r,e,i[3]?+i[3]:void 0,i[4]?+i[4]:void 0)}},tS=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,tk=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,tC=(e,t)=>{let r=tS.exec(e);if(r){if(r[3]&&r[3].indexOf(" > eval")>-1){let e=tk.exec(r[3]);e&&(r[1]=r[1]||"eval",r[3]=e[1],r[4]=e[2],r[5]="")}let e=r[3],i=r[1]||"?";return[i,e]=tw(i,e),t_(t,e,i,r[4]?+r[4]:void 0,r[5]?+r[5]:void 0)}},tI=/^\s*at (?:((?:\[object object\])?.+) )?\(?((?:[-a-z]+):.*?):(\d+)(?::(\d+))?\)?\s*$/i,t$=(e,t)=>{let r=tI.exec(e);return r?t_(t,r[2],r[1]||"?",+r[3],r[4]?+r[4]:void 0):void 0},tO=/ line (\d+).*script (?:in )?(\S+)(?:: in function (\S+))?$/i,tA=(e,t)=>{let r=tO.exec(e);return r?t_(t,r[2],r[3]||"?",+r[1]):void 0},tT=/ line (\d+), column (\d+)\s*(?:in (?:<anonymous function: ([^>]+)>|([^)]+))\(.*\))? in (.*):\s*$/i,tR=(e,t)=>{let r=tT.exec(e);return r?t_(t,r[5],r[3]||r[4]||"?",+r[1],+r[2]):void 0},tL=/^\s*[-]{4,}$/,tM=/at (?:async )?(?:(.+?)\s+\()?(?:(.+):(\d+):(\d+)?|([^)]+))\)?/,tj=(e,t)=>{let r=e.match(tM);if(r){let e,i,s,a,n;if(r[1]){let t=(s=r[1]).lastIndexOf(".");if("."===s[t-1]&&t--,t>0){e=s.slice(0,t),i=s.slice(t+1);let r=e.indexOf(".Module");r>0&&(s=s.slice(r+1),e=e.slice(0,r))}a=void 0}i&&(a=e,n=i),"<anonymous>"===i&&(n=void 0,s=void 0),void 0===s&&(n=n||"?",s=a?`${a}.${n}`:n);let o=r[2]?.startsWith("file://")?r[2].slice(7):r[2],l="native"===r[5];return o?.match(/\/[A-Z]:/)&&(o=o.slice(1)),o||!r[5]||l||(o=r[5]),{filename:o?decodeURI(o):void 0,module:void 0,function:s,lineno:tD(r[3]),colno:tD(r[4]),in_app:function(e,t=!1){return!(t||e&&!e.startsWith("/")&&!e.match(/^[A-Z]:/)&&!e.startsWith(".")&&!e.match(/^[a-zA-Z]([a-zA-Z0-9.\-+])*:\/\//))&&void 0!==e&&!e.includes("node_modules/")}(o||"",l),platform:t}}if(e.match(tL))return{filename:e,platform:t}};function tD(e){return parseInt(e||"",10)||void 0}let tU=/\(error: (.*)\)/;function tB(e){if(!e.length)return[];let t=Array.from(e);return t.reverse(),t.slice(0,50).map(e=>{var r;return{...e,filename:e.filename||((r=t)[r.length-1]||{}).filename,function:e.function||"?"}})}function tN(){return tq("web:javascript",tx,tC)}function tq(e,...t){return(r,i=0)=>{let s=[],a=r.split("\n");for(let r=i;r<a.length;r++){let i=a[r];if(i.length>1024)continue;let n=tU.test(i)?i.replace(tU,"$1"):i;if(!n.match(/\S*Error: /)){for(let r of t){let t=r(n,e);if(t){s.push(t);break}}if(s.length>=50)break}}return tB(s)}}e.s(["createDefaultStackParser",()=>tN,"createStackParser",()=>tq,"reverseAndStripFrames",()=>tB],34246);class tH{match(e){return this.isDOMException(e)||this.isDOMError(e)}coerce(e,t){let r=j(e.stack);return{type:this.getType(e),value:this.getValue(e),stack:r?e.stack:void 0,cause:e.cause?t.next(e.cause):void 0,synthetic:!1}}getType(e){return this.isDOMError(e)?"DOMError":"DOMException"}getValue(e){let t=e.name||(this.isDOMError(e)?"DOMError":"DOMException");return e.message?`${t}: ${e.message}`:t}isDOMException(e){return Q(e,"DOMException")}isDOMError(e){return Q(e,"DOMError")}}e.s(["DOMExceptionCoercer",()=>tH],29569);class tG{match(e){return W(e)}coerce(e,t){return{type:this.getType(e),value:this.getMessage(e,t),stack:this.getStack(e),cause:e.cause?t.next(e.cause):void 0,synthetic:!1}}getType(e){return e.name||e.constructor.name}getMessage(e,t){let r=e.message;return r.error&&"string"==typeof r.error.message?String(r.error.message):String(r)}getStack(e){return e.stacktrace||e.stack||void 0}}e.s(["ErrorCoercer",()=>tG],11475);class tz{match(e){return Y(e)&&void 0!=e.error}coerce(e,t){let r=t.apply(e.error);return r||{type:"ErrorEvent",value:e.message,stack:t.syntheticException?.stack,synthetic:!0}}}e.s(["ErrorEventCoercer",()=>tz],43179);let tW=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;class tK{match(e){return"string"==typeof e}coerce(e,t){let[r,i]=this.getInfos(e);return{type:r??"Error",value:i??e,stack:t.syntheticException?.stack,synthetic:!0}}getInfos(e){let t="Error",r=e,i=e.match(tW);return i&&(t=i[1],r=i[2]),[t,r]}}e.s(["StringCoercer",()=>tK],45098);let tV=["fatal","error","warning","log","info","debug"];function tQ(e,t=40){let r=Object.keys(e);if(r.sort(),!r.length)return"[object has no keys]";for(let e=r.length;e>0;e--){let i=r.slice(0,e).join(", ");if(!(i.length>t)){if(e===r.length)return i;return i.length<=t?i:`${i.slice(0,t)}...`}}return""}class tJ{match(e){return"object"==typeof e&&null!==e}coerce(e,t){let r=this.getErrorPropertyFromObject(e);return r?t.apply(r):{type:this.getType(e),value:this.getValue(e),stack:t.syntheticException?.stack,level:this.isSeverityLevel(e.level)?e.level:"error",synthetic:!0}}getType(e){return X(e)?e.constructor.name:"Error"}getValue(e){if("name"in e&&"string"==typeof e.name){let t=`'${e.name}' captured as exception`;return"message"in e&&"string"==typeof e.message&&(t+=` with message: '${e.message}'`),t}if("message"in e&&"string"==typeof e.message)return e.message;let t=this.getObjectClassName(e),r=tQ(e);return`${t&&"Object"!==t?`'${t}'`:"Object"} captured as exception with keys: ${r}`}isSeverityLevel(e){return j(e)&&!D(e)&&tV.indexOf(e)>=0}getErrorPropertyFromObject(e){for(let t in e)if(Object.prototype.hasOwnProperty.call(e,t)){let r=e[t];if(tl(r))return r}}getObjectClassName(e){try{let t=Object.getPrototypeOf(e);return t?t.constructor.name:void 0}catch(e){return}}}e.s(["ObjectCoercer",()=>tJ],6881);class tY{match(e){return X(e)}coerce(e,t){let r=e.constructor.name;return{type:r,value:`${r} captured as exception with keys: ${tQ(e)}`,stack:t.syntheticException?.stack,synthetic:!0}}}e.s(["EventCoercer",()=>tY],80322);class tX{match(e){return V(e)}coerce(e,t){return{type:"Error",value:`Primitive value captured as exception: ${String(e)}`,stack:t.syntheticException?.stack,synthetic:!0}}}e.s(["PrimitiveCoercer",()=>tX],80049);class tZ{match(e){return Q(e,"PromiseRejectionEvent")||this.isCustomEventWrappingRejection(e)}isCustomEventWrappingRejection(e){if(!X(e))return!1;try{let t=e.detail;return null!=t&&"object"==typeof t&&"reason"in t}catch{return!1}}coerce(e,t){let r=this.getUnhandledRejectionReason(e);return V(r)?{type:"UnhandledRejection",value:`Non-Error promise rejection captured with value: ${String(r)}`,stack:t.syntheticException?.stack,synthetic:!0}:t.apply(r)}getUnhandledRejectionReason(e){try{if("reason"in e)return e.reason;if("detail"in e&&null!=e.detail&&"object"==typeof e.detail&&"reason"in e.detail)return e.detail.reason}catch{}return e}}e.s(["PromiseRejectionEventCoercer",()=>tZ],98689),e.s([],99573);class t0{constructor(e){this._maxSize=e,this._cache=new Map}get(e){let t=this._cache.get(e);if(void 0!==t)return this._cache.delete(e),this._cache.set(e,t),t}set(e,t){this._cache.set(e,t)}reduce(){for(;this._cache.size>=this._maxSize;){let e=this._cache.keys().next().value;e&&this._cache.delete(e)}}}e.s(["ReduceableCache",()=>t0],46986),e.s([],47114),e.i(47114),e.i(80446),e.i(34246),e.s(["chromeStackLineParser",()=>tx,"createDefaultStackParser",()=>tN,"createStackParser",()=>tq,"geckoStackLineParser",()=>tC,"nodeStackLineParser",()=>tj,"opera10StackLineParser",()=>tA,"opera11StackLineParser",()=>tR,"reverseAndStripFrames",()=>tB,"winjsStackLineParser",()=>t$],70736),e.i(70736),e.i(99573),e.i(29569),e.i(11475),e.i(43179),e.i(45098),e.i(6881),e.i(80322),e.i(80049),e.i(98689),e.s(["DOMExceptionCoercer",()=>tH,"ErrorCoercer",()=>tG,"ErrorEventCoercer",()=>tz,"EventCoercer",()=>tY,"ObjectCoercer",()=>tJ,"PrimitiveCoercer",()=>tX,"PromiseRejectionEventCoercer",()=>tZ,"StringCoercer",()=>tK],21854),e.i(21854),e.i(46986),e.s(["DOMExceptionCoercer",()=>tH,"ErrorCoercer",()=>tG,"ErrorEventCoercer",()=>tz,"ErrorPropertiesBuilder",()=>tb,"EventCoercer",()=>tY,"ObjectCoercer",()=>tJ,"PrimitiveCoercer",()=>tX,"PromiseRejectionEventCoercer",()=>tZ,"ReduceableCache",()=>t0,"StringCoercer",()=>tK,"chromeStackLineParser",()=>tx,"createDefaultStackParser",()=>tN,"createStackParser",()=>tq,"geckoStackLineParser",()=>tC,"nodeStackLineParser",()=>tj,"opera10StackLineParser",()=>tA,"opera11StackLineParser",()=>tR,"reverseAndStripFrames",()=>tB,"winjsStackLineParser",()=>t$],96117);var t1=e.i(96117),t4=t1,t2=e.i(2157),t3=e.i(1457);let t5=new t4.ReduceableCache(25),t6=new t4.ReduceableCache(20);async function t9(e){let t={};for(let s=e.length-1;s>=0;s--){var r,i;let a=e[s],n=a?.filename;!(!a||"string"!=typeof n||"number"!=typeof a.lineno||(r=n).startsWith("node:")||r.endsWith(".min.js")||r.endsWith(".min.cjs")||r.endsWith(".min.mjs")||r.startsWith("data:")||void 0!==(i=a).lineno&&i.lineno>1e4||void 0!==i.colno&&i.colno>1e3)&&(t[n]||(t[n]=[]),t[n].push(a.lineno))}let s=Object.keys(t);if(0==s.length)return e;let a=[];for(let e of s){if(t6.get(e))continue;let r=t[e];if(!r)continue;r.sort((e,t)=>e-t);let i=function(e){if(!e.length)return[];let t=0,r=e[0];if("number"!=typeof r)return[];let i=t7(r),s=[];for(;;){if(t===e.length-1){s.push(i);break}let r=e[t+1];if("number"!=typeof r)break;r<=i[1]?i[1]=r+7:(s.push(i),i=t7(r)),t++}return s}(r);if(i.every(t=>(function(e,t){let r=t5.get(e);if(void 0===r)return!1;for(let e=t[0];e<=t[1];e++)if(void 0===r[e])return!1;return!0})(e,t)))continue;let s=function(e,t,r){let i=e.get(t);return void 0===i?(e.set(t,r),r):i}(t5,e,{});a.push(function(e,t,r){return new Promise(i=>{let s=(0,t2.createReadStream)(e),a=(0,t3.createInterface)({input:s});function n(){s.destroy(),i()}let o=0,l=0,u=t[0];if(void 0===u)return void n();let c=u[0],h=u[1];function d(){t6.set(e,1),a.close(),a.removeAllListeners(),n()}s.on("error",d),a.on("error",d),a.on("close",n),a.on("line",e=>{if(!(++o<c)&&(r[o]=function(e,t){let r=e,i=r.length;if(i<=150)return r;t>i&&(t=i);let s=Math.max(t-60,0);s<5&&(s=0);let a=Math.min(s+140,i);return a>i-5&&(a=i),a===i&&(s=Math.max(a-140,0)),r=r.slice(s,a),s>0&&(r=`...${r}`),a<i&&(r+="..."),r}(e,0),o>=h)){if(l===t.length-1){a.close(),a.removeAllListeners();return}let e=t[++l];if(void 0===e){a.close(),a.removeAllListeners();return}c=e[0],h=e[1]}})})}(e,i,s))}return await Promise.all(a).catch(()=>{}),e&&e.length>0&&function(e,t){for(let r of e)if(r.filename&&void 0===r.context_line&&"number"==typeof r.lineno){let e=t.get(r.filename);if(void 0===e)continue;!function(e,t,r){if(void 0===t.lineno||void 0===r)return;t.pre_context=[];for(let i=re(e);i<e;i++){let e=r[i];if(void 0===e)return void t8(t);t.pre_context.push(e)}if(void 0===r[e])return t8(t);t.context_line=r[e];let i=function(e){return e+7}(e);t.post_context=[];for(let s=e+1;s<=i;s++){let e=r[s];if(void 0===e)break;t.post_context.push(e)}}(r.lineno,r,e)}}(e,t5),t5.reduce(),e}function t8(e){delete e.pre_context,delete e.context_line,delete e.post_context}function t7(e){return[re(e),e+7]}function re(e){return Math.max(1,e-7)}class rt{constructor(e,t,r){this.client=e,this._exceptionAutocaptureEnabled=t.enableExceptionAutocapture||!1,this._logger=r,this._rateLimiter=new eu({refillRate:1,bucketSize:10,refillInterval:1e4,_logger:this._logger}),this.startAutocaptureIfEnabled()}static isPreviouslyCapturedError(e){return R(e)&&"__posthog_previously_captured_error"in e&&!0===e.__posthog_previously_captured_error}static async buildEventMessage(e,t,r,i){let s={...i};r||(s.$process_person_profile=!1);let a=this.errorPropertiesBuilder.buildFromUnknown(e,t);return a.$exception_list=await this.errorPropertiesBuilder.modifyFrames(a.$exception_list),{event:"$exception",distinctId:r||f().toString(),properties:{...a,...s},_originatedFromCaptureException:!0}}startAutocaptureIfEnabled(){if(this.isEnabled()){var t,r,i;let s;t=this.onException.bind(this),r=this.onFatalError.bind(this),globalThis.process?.on("uncaughtException",(s=!1,Object.assign(i=>{let a=e.g.process.listeners("uncaughtException").filter(e=>"domainUncaughtExceptionClear"!==e.name&&!0!==e._posthogErrorHandler).length;t(i,{mechanism:{type:"onuncaughtexception",handled:!1}}),s||0!==a||(s=!0,r(i))},{_posthogErrorHandler:!0}))),i=this.onException.bind(this),globalThis.process?.on("unhandledRejection",e=>i(e,{mechanism:{type:"onunhandledrejection",handled:!1}}))}}onException(e,t){this.client.addPendingPromise((async()=>{if(!rt.isPreviouslyCapturedError(e)){let r=await rt.buildEventMessage(e,t),i=r.properties,s=i?.$exception_list[0]?.type??"Exception";return this._rateLimiter.consumeRateLimit(s)?void this._logger.info("Skipping exception capture because of client rate limiting.",{exception:s}):this.client.capture(r)}})())}async onFatalError(e){console.error(e),await this.client.shutdown(2e3),process.exit(1)}isEnabled(){return!this.client.isDisabled&&this._exceptionAutocaptureEnabled}shutdown(){this._rateLimiter.stop()}}e.i(95757),e.i(74770),e.i(34223),e.i(73362),e.i(58750),e.i(36418),e.i(14901),e.i(1346),e.i(49726);let rr={ERRORS_WHILE_COMPUTING:"errors_while_computing_flags",FLAG_MISSING:"flag_missing",QUOTA_LIMITED:"quota_limited",UNKNOWN_ERROR:"unknown_error"};async function ri(e){let t=globalThis.crypto?.subtle;if(!t)throw Error("SubtleCrypto API not available");return Array.from(new Uint8Array(await t.digest("SHA-1",new TextEncoder().encode(e)))).map(e=>e.toString(16).padStart(2,"0")).join("")}e.s(["FeatureFlagError",()=>rr],58325);let rs=["is_not"];class ra extends Error{constructor(e){super(),Error.captureStackTrace(this,this.constructor),this.name="ClientError",this.message=e,Object.setPrototypeOf(this,ra.prototype)}}class rn extends Error{constructor(e){super(e),this.name=this.constructor.name,Error.captureStackTrace(this,this.constructor),Object.setPrototypeOf(this,rn.prototype)}}class ro extends Error{constructor(e){super(e),this.name=this.constructor.name,Error.captureStackTrace(this,this.constructor),Object.setPrototypeOf(this,ro.prototype)}}class rl{constructor({pollingInterval:e,personalApiKey:t,projectApiKey:r,timeout:i,host:s,customHeaders:a,...n}){this.debugMode=!1,this.shouldBeginExponentialBackoff=!1,this.backOffCount=0,this.pollingInterval=e,this.personalApiKey=t,this.featureFlags=[],this.featureFlagsByKey={},this.groupTypeMapping={},this.cohorts={},this.loadedSuccessfullyOnce=!1,this.timeout=i,this.projectApiKey=r,this.host=s,this.poller=void 0,this.fetch=n.fetch||fetch,this.onError=n.onError,this.customHeaders=a,this.onLoad=n.onLoad,this.cacheProvider=n.cacheProvider,this.strictLocalEvaluation=n.strictLocalEvaluation??!1,this.loadFeatureFlags()}debug(e=!0){this.debugMode=e}logMsgIfDebug(e){this.debugMode&&e()}createEvaluationContext(e,t={},r={},i={},s={}){return{distinctId:e,groups:t,personProperties:r,groupProperties:i,evaluationCache:s}}async getFeatureFlag(e,t,r={},i={},s={}){let a,n;if(await this.loadFeatureFlags(),!this.loadedSuccessfullyOnce)return a;if(void 0!==(n=this.featureFlagsByKey[e])){let o=this.createEvaluationContext(t,r,i,s);try{a=(await this.computeFlagAndPayloadLocally(n,o)).value,this.logMsgIfDebug(()=>console.debug(`Successfully computed flag locally: ${e} -> ${a}`))}catch(t){t instanceof ro||t instanceof rn?this.logMsgIfDebug(()=>console.debug(`${t.name} when computing flag locally: ${e}: ${t.message}`)):t instanceof Error&&this.onError?.(Error(`Error computing flag locally: ${e}: ${t}`))}}return a}async getAllFlagsAndPayloads(e,t){await this.loadFeatureFlags();let r={},i={},s=0==this.featureFlags.length,a=t?t.map(e=>this.featureFlagsByKey[e]).filter(Boolean):this.featureFlags,n={...e,evaluationCache:e.evaluationCache??{}};return await Promise.all(a.map(async e=>{try{let{value:t,payload:s}=await this.computeFlagAndPayloadLocally(e,n);r[e.key]=t,s&&(i[e.key]=s)}catch(t){t instanceof ro||t instanceof rn?this.logMsgIfDebug(()=>console.debug(`${t.name} when computing flag locally: ${e.key}: ${t.message}`)):t instanceof Error&&this.onError?.(Error(`Error computing flag locally: ${e.key}: ${t}`)),s=!0}})),{response:r,payloads:i,fallbackToFlags:s}}async computeFlagAndPayloadLocally(e,t,r={}){let i,{matchValue:s,skipLoadCheck:a=!1}=r;if(a||await this.loadFeatureFlags(),!this.loadedSuccessfullyOnce)return{value:!1,payload:null};i=void 0!==s?s:await this.computeFlagValueLocally(e,t);let n=this.getFeatureFlagPayload(e.key,i);return{value:i,payload:n}}async computeFlagValueLocally(e,t){let{distinctId:r,groups:i,personProperties:s,groupProperties:a}=t;if(e.ensure_experience_continuity)throw new rn("Flag has experience continuity enabled");if(!e.active)return!1;let n=(e.filters||{}).aggregation_group_type_index;if(void 0!=n){let r=this.groupTypeMapping[String(n)];if(!r)throw this.logMsgIfDebug(()=>console.warn(`[FEATURE FLAGS] Unknown group type index ${n} for feature flag ${e.key}`)),new rn("Flag has unknown group type index");if(!(r in i))return this.logMsgIfDebug(()=>console.warn(`[FEATURE FLAGS] Can't compute group feature flag: ${e.key} without group names passed in`)),!1;"device_id"===e.bucketing_identifier&&(s?.$device_id===void 0||s?.$device_id===null||s?.$device_id==="")&&this.logMsgIfDebug(()=>console.warn(`[FEATURE FLAGS] Ignoring bucketing_identifier for group flag: ${e.key}`));let o=a[r];return await this.matchFeatureFlagProperties(e,i[r],o,t)}{let i=this.getBucketingValueForFlag(e,r,s);if(void 0===i)throw this.logMsgIfDebug(()=>console.warn(`[FEATURE FLAGS] Can't compute feature flag: ${e.key} without $device_id, falling back to server evaluation`)),new rn(`Can't compute feature flag: ${e.key} without $device_id`);return await this.matchFeatureFlagProperties(e,i,s,t)}}getBucketingValueForFlag(e,t,r){if(e.filters?.aggregation_group_type_index!=void 0)return t;if("device_id"===e.bucketing_identifier){let e=r?.$device_id;if(null==e||""===e)return;return e}return t}getFeatureFlagPayload(e,t){let r=null;if(!1!==t&&null!=t&&("boolean"==typeof t?r=this.featureFlagsByKey?.[e]?.filters?.payloads?.[t.toString()]||null:"string"==typeof t&&(r=this.featureFlagsByKey?.[e]?.filters?.payloads?.[t]||null),null!=r)){if("object"==typeof r)return r;if("string"==typeof r)try{return JSON.parse(r)}catch{}return r}return null}async evaluateFlagDependency(e,t,r){let{evaluationCache:i}=r,s=e.key;if(!this.featureFlagsByKey)throw new rn("Feature flags not available for dependency evaluation");if(!("dependency_chain"in e))throw new rn(`Flag dependency property for '${s}' is missing required 'dependency_chain' field`);let a=e.dependency_chain;if(!Array.isArray(a))throw new rn(`Flag dependency property for '${s}' has an invalid 'dependency_chain' (expected array, got ${typeof a})`);if(0===a.length)throw new rn(`Circular dependency detected for flag '${s}' (empty dependency chain)`);for(let e of a){if(!(e in i)){let t=this.featureFlagsByKey[e];if(t)if(t.active)try{let s=await this.computeFlagValueLocally(t,r);i[e]=s}catch(t){throw new rn(`Error evaluating flag dependency '${e}' for flag '${s}': ${t}`)}else i[e]=!1;else throw new rn(`Missing flag dependency '${e}' for flag '${s}'`)}if(null==i[e])throw new rn(`Dependency '${e}' could not be evaluated`)}let n=i[s];return this.flagEvaluatesToExpectedValue(e.value,n)}flagEvaluatesToExpectedValue(e,t){return"boolean"==typeof e?e===t||"string"==typeof t&&""!==t&&!0===e:"string"==typeof e&&t===e}async matchFeatureFlagProperties(e,t,r,i){let s,a=e.filters||{},n=a.groups||[],o=!1;for(let l of n)try{if(await this.isConditionMatch(e,t,l,r,i)){let r=l.variant,i=a.multivariate?.variants||[];s=r&&i.some(e=>e.key===r)?r:await this.getMatchingVariant(e,t)||!0;break}}catch(e){if(e instanceof ro)throw e;if(e instanceof rn)o=!0;else throw e}if(void 0!==s)return s;if(o)throw new rn("Can't determine if feature flag is enabled or not with given properties");return!1}async isConditionMatch(e,t,r,i,s){let a=r.rollout_percentage,n=e=>{this.logMsgIfDebug(()=>console.warn(e))};if((r.properties||[]).length>0){for(let e of r.properties){let t=e.type;if(!("cohort"===t?function e(t,r,i,s=!1){let a=String(t.value);if(!(a in i))throw new ro(`cohort ${a} not found in local cohorts - likely a static cohort that requires server evaluation`);return function t(r,i,s,a=!1){if(!r)return!0;let n=r.type,o=r.values;if(!o||0===o.length)return!0;let l=!1;if("values"in o[0]){for(let e of o)try{let r=t(e,i,s,a);if("AND"===n){if(!r)return!1}else if(r)return!0}catch(t){if(t instanceof ro)throw t;if(t instanceof rn)a&&console.debug(`Failed to compute property ${e} locally: ${t}`),l=!0;else throw t}if(l)throw new rn("Can't match cohort without a given cohort property value");return"AND"===n}for(let t of o)try{let r;if("cohort"===t.type)r=e(t,i,s,a);else if("flag"===t.type){a&&console.warn(`[FEATURE FLAGS] Flag dependency filters are not supported in local evaluation. Skipping condition with dependency on flag '${t.key||"unknown"}'`);continue}else r=rc(t,i);let o=t.negation||!1;if("AND"===n){if(!r&&!o||r&&o)return!1}else if(r&&!o||!r&&o)return!0}catch(e){if(e instanceof ro)throw e;if(e instanceof rn)a&&console.debug(`Failed to compute property ${t} locally: ${e}`),l=!0;else throw e}if(l)throw new rn("can't match cohort without a given cohort property value");return"AND"===n}(i[a],r,i,s)}(e,i,this.cohorts,this.debugMode):"flag"===t?await this.evaluateFlagDependency(e,i,s):rc(e,i,n)))return!1}if(void 0==a)return!0}return!(void 0!=a&&await ru(e.key,t)>a/100)}async getMatchingVariant(e,t){let r=await ru(e.key,t,"variant"),i=this.variantLookupTable(e).find(e=>r>=e.valueMin&&r<e.valueMax);if(i)return i.key}variantLookupTable(e){let t=[],r=0,i=0,s=e.filters||{};return(s.multivariate?.variants||[]).forEach(e=>{i=r+e.rollout_percentage/100,t.push({valueMin:r,valueMax:i,key:e.key}),r=i}),t}updateFlagState(e){this.featureFlags=e.flags,this.featureFlagsByKey=e.flags.reduce((e,t)=>(e[t.key]=t,e),{}),this.groupTypeMapping=e.groupTypeMapping,this.cohorts=e.cohorts,this.loadedSuccessfullyOnce=!0}warnAboutExperienceContinuityFlags(e){if(this.strictLocalEvaluation)return;let t=e.filter(e=>e.ensure_experience_continuity);t.length>0&&console.warn(`[PostHog] You are using local evaluation but ${t.length} flag(s) have experience continuity enabled: ${t.map(e=>e.key).join(", ")}. Experience continuity is incompatible with local evaluation and will cause a server request on every flag evaluation, negating local evaluation cost savings. To avoid server requests and unexpected costs, either disable experience continuity on these flags in PostHog, use strictLocalEvaluation: true in client init, or pass onlyEvaluateLocally: true per flag call (flags that cannot be evaluated locally will return undefined).`)}async loadFromCache(e){if(!this.cacheProvider)return!1;try{let t=await this.cacheProvider.getFlagDefinitions();if(t)return this.updateFlagState(t),this.logMsgIfDebug(()=>console.debug(`[FEATURE FLAGS] ${e} (${t.flags.length} flags)`)),this.onLoad?.(this.featureFlags.length),this.warnAboutExperienceContinuityFlags(t.flags),!0;return!1}catch(e){return this.onError?.(Error(`Failed to load from cache: ${e}`)),!1}}async loadFeatureFlags(e=!1){if(!this.loadedSuccessfullyOnce||e)return!e&&this.nextFetchAllowedAt&&Date.now()<this.nextFetchAllowedAt?void this.logMsgIfDebug(()=>console.debug("[FEATURE FLAGS] Skipping fetch, in backoff period")):(this.loadingPromise||(this.loadingPromise=this._loadFeatureFlags().catch(e=>this.logMsgIfDebug(()=>console.debug(`[FEATURE FLAGS] Failed to load feature flags: ${e}`))).finally(()=>{this.loadingPromise=void 0})),this.loadingPromise)}isLocalEvaluationReady(){return(this.loadedSuccessfullyOnce??!1)&&(this.featureFlags?.length??0)>0}getFlagDefinitionsLoadedAt(){return this.flagDefinitionsLoadedAt}getPollingInterval(){return this.shouldBeginExponentialBackoff?Math.min(6e4,this.pollingInterval*2**this.backOffCount):this.pollingInterval}beginBackoff(){this.shouldBeginExponentialBackoff=!0,this.backOffCount+=1,this.nextFetchAllowedAt=Date.now()+this.getPollingInterval()}clearBackoff(){this.shouldBeginExponentialBackoff=!1,this.backOffCount=0,this.nextFetchAllowedAt=void 0}async _loadFeatureFlags(){this.poller&&(clearTimeout(this.poller),this.poller=void 0),this.poller=setTimeout(()=>this.loadFeatureFlags(!0),this.getPollingInterval());try{let e=!0;if(this.cacheProvider)try{e=await this.cacheProvider.shouldFetchFlagDefinitions()}catch(e){this.onError?.(Error(`Error in shouldFetchFlagDefinitions: ${e}`))}if(!e&&(await this.loadFromCache("Loaded flags from cache (skipped fetch)")||this.loadedSuccessfullyOnce))return;let t=await this._requestFeatureFlagDefinitions();if(!t)return;switch(t.status){case 304:this.logMsgIfDebug(()=>console.debug("[FEATURE FLAGS] Flags not modified (304), using cached data")),this.flagsEtag=t.headers?.get("ETag")??this.flagsEtag,this.loadedSuccessfullyOnce=!0,this.clearBackoff();return;case 401:throw this.beginBackoff(),new ra(`Your project key or personal API key is invalid. Setting next polling interval to ${this.getPollingInterval()}ms. More information: https://posthog.com/docs/api#rate-limiting`);case 402:console.warn("[FEATURE FLAGS] Feature flags quota limit exceeded - unsetting all local flags. Learn more about billing limits at https://posthog.com/docs/billing/limits-alerts"),this.featureFlags=[],this.featureFlagsByKey={},this.groupTypeMapping={},this.cohorts={};return;case 403:throw this.beginBackoff(),new ra(`Your personal API key does not have permission to fetch feature flag definitions for local evaluation. Setting next polling interval to ${this.getPollingInterval()}ms. Are you sure you're using the correct personal and Project API key pair? More information: https://posthog.com/docs/api/overview`);case 429:throw this.beginBackoff(),new ra(`You are being rate limited. Setting next polling interval to ${this.getPollingInterval()}ms. More information: https://posthog.com/docs/api#rate-limiting`);case 200:{let r=await t.json()??{};if(!("flags"in r))return void this.onError?.(Error(`Invalid response when getting feature flags: ${JSON.stringify(r)}`));this.flagsEtag=t.headers?.get("ETag")??void 0;let i={flags:r.flags??[],groupTypeMapping:r.group_type_mapping||{},cohorts:r.cohorts||{}};if(this.updateFlagState(i),this.flagDefinitionsLoadedAt=Date.now(),this.clearBackoff(),this.cacheProvider&&e)try{await this.cacheProvider.onFlagDefinitionsReceived(i)}catch(e){this.onError?.(Error(`Failed to store in cache: ${e}`))}this.onLoad?.(this.featureFlags.length),this.warnAboutExperienceContinuityFlags(i.flags);break}default:return}}catch(e){e instanceof ra&&this.onError?.(e)}}getPersonalApiKeyRequestOptions(e="GET",t){let r={...this.customHeaders,"Content-Type":"application/json",Authorization:`Bearer ${this.personalApiKey}`};return t&&(r["If-None-Match"]=t),{method:e,headers:r}}_requestFeatureFlagDefinitions(){let e=`${this.host}/api/feature_flag/local_evaluation?token=${this.projectApiKey}&send_cohorts`,t=this.getPersonalApiKeyRequestOptions("GET",this.flagsEtag),r=null;if(this.timeout&&"number"==typeof this.timeout){let e=new AbortController;r=tn(()=>{e.abort()},this.timeout),t.signal=e.signal}try{return(0,this.fetch)(e,t)}finally{clearTimeout(r)}}async stopPoller(e=3e4){if(clearTimeout(this.poller),this.cacheProvider)try{let t=this.cacheProvider.shutdown();t instanceof Promise&&await Promise.race([t,new Promise((t,r)=>setTimeout(()=>r(Error(`Cache shutdown timeout after ${e}ms`)),e))])}catch(e){this.onError?.(Error(`Error during cache shutdown: ${e}`))}}}async function ru(e,t,r=""){return parseInt((await ri(`${e}.${t}${r}`)).slice(0,15),16)/0x1000000000000000}function rc(e,t,r){let i=e.key,s=e.value,a=e.operator||"exact";if(i in t){if("is_not_set"===a)throw new rn("Operator is_not_set is not supported")}else throw new rn(`Property ${i} not found in propertyValues`);let n=t[i];if(null==n&&!rs.includes(a))return r&&r(`Property ${i} cannot have a value of null/undefined with the ${a} operator`),!1;function o(e,t){return Array.isArray(e)?e.map(e=>String(e).toLowerCase()).includes(String(t).toLowerCase()):String(e).toLowerCase()===String(t).toLowerCase()}function l(e,t,r){if("gt"===r)return e>t;if("gte"===r)return e>=t;if("lt"===r)return e<t;if("lte"===r)return e<=t;throw Error(`Invalid operator: ${r}`)}switch(a){case"exact":return o(s,n);case"is_not":return!o(s,n);case"is_set":return i in t;case"icontains":return String(n).toLowerCase().includes(String(s).toLowerCase());case"not_icontains":return!String(n).toLowerCase().includes(String(s).toLowerCase());case"regex":return rh(String(s))&&null!==String(n).match(String(s));case"not_regex":return rh(String(s))&&null===String(n).match(String(s));case"gt":case"gte":case"lt":case"lte":{let e="number"==typeof s?s:null;if("string"==typeof s)try{e=parseFloat(s)}catch(e){}if(null==e||null==n)return l(String(n),String(s),a);if("string"==typeof n)return l(n,String(s),a);return l(n,e,a)}case"is_date_after":case"is_date_before":{if("boolean"==typeof s)throw new rn("Date operations cannot be performed on boolean values");let e=function(e){let t=e.match(/^-?(?<number>[0-9]+)(?<interval>[a-z])$/),r=new Date(new Date().toISOString());if(!t)return null;{if(!t.groups)return null;let e=parseInt(t.groups.number);if(e>=1e4)return null;let i=t.groups.interval;if("h"==i)r.setUTCHours(r.getUTCHours()-e);else if("d"==i)r.setUTCDate(r.getUTCDate()-e);else if("w"==i)r.setUTCDate(r.getUTCDate()-7*e);else if("m"==i)r.setUTCMonth(r.getUTCMonth()-e);else{if("y"!=i)return null;r.setUTCFullYear(r.getUTCFullYear()-e)}return r}}(String(s));if(null==e&&(e=rp(s)),null==e)throw new rn(`Invalid date: ${s}`);let t=rp(n);if(["is_date_before"].includes(a))return t<e;return t>e}case"semver_eq":return 0===rg(rd(String(n)),rd(String(s)));case"semver_neq":return 0!==rg(rd(String(n)),rd(String(s)));case"semver_gt":return rg(rd(String(n)),rd(String(s)))>0;case"semver_gte":return rg(rd(String(n)),rd(String(s)))>=0;case"semver_lt":return 0>rg(rd(String(n)),rd(String(s)));case"semver_lte":return 0>=rg(rd(String(n)),rd(String(s)));case"semver_tilde":{let e,t=rd(String(n)),{lower:r,upper:i}={lower:[(e=rd(String(s)))[0],e[1],e[2]],upper:[e[0],e[1]+1,0]};return rg(t,r)>=0&&0>rg(t,i)}case"semver_caret":{let e=rd(String(n)),{lower:t,upper:r}=function(e){let[t,r,i]=rd(e);return{lower:[t,r,i],upper:t>0?[t+1,0,0]:r>0?[0,r+1,0]:[0,0,i+1]}}(String(s));return rg(e,t)>=0&&0>rg(e,r)}case"semver_wildcard":{let e=rd(String(n)),{lower:t,upper:r}=function(e){let t,r,i=String(e).trim().replace(/^[vV]/,"").replace(/\.\*$/,"").replace(/\*$/,"");if(!i)throw new rn(`Invalid wildcard semver: ${e}`);let s=i.split("."),a=parseInt(s[0],10);if(isNaN(a))throw new rn(`Invalid wildcard semver: ${e}`);if(1===s.length)t=[a,0,0],r=[a+1,0,0];else{let i=parseInt(s[1],10);if(isNaN(i))throw new rn(`Invalid wildcard semver: ${e}`);t=[a,i,0],r=[a,i+1,0]}return{lower:t,upper:r}}(String(s));return rg(e,t)>=0&&0>rg(e,r)}default:throw new rn(`Unknown operator: ${a}`)}}function rh(e){try{return new RegExp(e),!0}catch(e){return!1}}function rd(e){let t=String(e).trim().replace(/^[vV]/,"").split("-")[0].split("+")[0];if(!t||t.startsWith("."))throw new rn(`Invalid semver: ${e}`);let r=t.split("."),i=t=>{if(void 0===t||""===t)return 0;if(!/^\d+$/.test(t))throw new rn(`Invalid semver: ${e}`);return parseInt(t,10)};return[i(r[0]),i(r[1]),i(r[2])]}function rg(e,t){for(let r=0;r<3;r++){if(e[r]<t[r])return -1;if(e[r]>t[r])return 1}return 0}function rp(e){if(e instanceof Date)return e;if("string"==typeof e||"number"==typeof e){let t=new Date(e);if(!isNaN(t.valueOf()))return t;throw new rn(`${e} is in an invalid date format`)}throw new rn(`The date provided ${e} must be a string, number, or date object`)}class rf{getProperty(e){return this._memoryStorage[e]}setProperty(e,t){this._memoryStorage[e]=null!==t?t:void 0}constructor(){this._memoryStorage={}}}class ry extends tv{constructor(e,t={}){if(super(e,t),this._memoryStorage=new rf,this.options=t,this.context=this.initializeContext(),this.options.featureFlagsPollingInterval="number"==typeof t.featureFlagsPollingInterval?Math.max(t.featureFlagsPollingInterval,100):3e4,"number"==typeof t.waitUntilDebounceMs&&(this.options.waitUntilDebounceMs=Math.max(t.waitUntilDebounceMs,0)),"number"==typeof t.waitUntilMaxWaitMs&&(this.options.waitUntilMaxWaitMs=Math.max(t.waitUntilMaxWaitMs,0)),t.personalApiKey){if(t.personalApiKey.includes("phc_"))throw Error('Your Personal API key is invalid. These keys are prefixed with "phx_" and can be created in PostHog project settings.');!1!==t.enableLocalEvaluation&&(this.featureFlagsPoller=new rl({pollingInterval:this.options.featureFlagsPollingInterval,personalApiKey:t.personalApiKey,projectApiKey:e,timeout:t.requestTimeout??1e4,host:this.host,fetch:t.fetch,onError:e=>{this._events.emit("error",e)},onLoad:e=>{this._events.emit("localEvaluationFlagsLoaded",e)},customHeaders:this.getCustomHeaders(),cacheProvider:t.flagDefinitionCacheProvider,strictLocalEvaluation:t.strictLocalEvaluation}))}this.errorTracking=new rt(this,t,this._logger),this.distinctIdHasSentFlagCalls={},this.maxCacheSize=t.maxCacheSize||5e4}enqueue(e,t,r){super.enqueue(e,t,r),this.scheduleDebouncedFlush()}async flush(){let e=super.flush(),t=this.options.waitUntil;if(t&&!this._waitUntilCycle)try{t(e.catch(()=>{}))}catch{}return e}scheduleDebouncedFlush(){let e=this.options.waitUntil;if(!e||this.disabled||this.optedOut)return;if(!this._waitUntilCycle){let t,r=new Promise(e=>{t=e});try{e(r)}catch{return}this._waitUntilCycle={resolve:t,startedAt:Date.now(),timer:void 0}}let t=Date.now()-this._waitUntilCycle.startedAt,r=this.options.waitUntilMaxWaitMs??500;if(void 0!==this._waitUntilCycle.timer&&clearTimeout(this._waitUntilCycle.timer),t>=r)return void this.resolveWaitUntilFlush();let i=this.options.waitUntilDebounceMs??50;this._waitUntilCycle.timer=tn(()=>{this.resolveWaitUntilFlush()},i)}_consumeWaitUntilCycle(){let e=this._waitUntilCycle;return e&&(clearTimeout(e.timer),this._waitUntilCycle=void 0),e?.resolve}async resolveWaitUntilFlush(){let e=this._consumeWaitUntilCycle();try{await super.flush()}catch{}finally{e?.()}}getPersistedProperty(e){return this._memoryStorage.getProperty(e)}setPersistedProperty(e,t){return this._memoryStorage.setProperty(e,t)}fetch(e,t){return this.options.fetch?this.options.fetch(e,t):fetch(e,t)}getLibraryVersion(){return"5.28.2"}getCustomUserAgent(){return`${this.getLibraryId()}/${this.getLibraryVersion()}`}enable(){return super.optIn()}disable(){return super.optOut()}debug(e=!0){super.debug(e),this.featureFlagsPoller?.debug(e)}capture(e){"string"==typeof e&&this._logger.warn("Called capture() with a string as the first argument when an object was expected."),"$exception"!==e.event||e._originatedFromCaptureException||this._logger.warn("Using `posthog.capture('$exception')` is unreliable because it does not attach required metadata. Use `posthog.captureException(error)` instead, which attaches required metadata automatically."),this.addPendingPromise(this.prepareEventMessage(e).then(({distinctId:e,event:t,properties:r,options:i})=>super.captureStateless(e,t,r,{timestamp:i.timestamp,disableGeoip:i.disableGeoip,uuid:i.uuid})).catch(e=>{e&&console.error(e)}))}async captureImmediate(e){return"string"==typeof e&&this._logger.warn("Called captureImmediate() with a string as the first argument when an object was expected."),"$exception"!==e.event||e._originatedFromCaptureException||this._logger.warn("Capturing a `$exception` event via `posthog.captureImmediate('$exception')` is unreliable because it does not attach required metadata. Use `posthog.captureExceptionImmediate(error)` instead, which attaches this metadata by default."),this.addPendingPromise(this.prepareEventMessage(e).then(({distinctId:e,event:t,properties:r,options:i})=>super.captureStatelessImmediate(e,t,r,{timestamp:i.timestamp,disableGeoip:i.disableGeoip,uuid:i.uuid})).catch(e=>{e&&console.error(e)}))}identify({distinctId:e,properties:t={},disableGeoip:r}){let{$set:i,$set_once:s,$anon_distinct_id:a,...n}=t;super.identifyStateless(e,{$set:i||n,$set_once:s||{},$anon_distinct_id:a??void 0},{disableGeoip:r})}async identifyImmediate({distinctId:e,properties:t={},disableGeoip:r}){let{$set:i,$set_once:s,$anon_distinct_id:a,...n}=t;super.identifyStatelessImmediate(e,{$set:i||n,$set_once:s||{},$anon_distinct_id:a??void 0},{disableGeoip:r})}alias(e){super.aliasStateless(e.alias,e.distinctId,void 0,{disableGeoip:e.disableGeoip})}async aliasImmediate(e){await super.aliasStatelessImmediate(e.alias,e.distinctId,void 0,{disableGeoip:e.disableGeoip})}isLocalEvaluationReady(){return this.featureFlagsPoller?.isLocalEvaluationReady()??!1}async waitForLocalEvaluationReady(e=3e4){return!!this.isLocalEvaluationReady()||void 0!==this.featureFlagsPoller&&new Promise(t=>{let r=setTimeout(()=>{i(),t(!1)},e),i=this._events.on("localEvaluationFlagsLoaded",e=>{clearTimeout(r),i(),t(e>0)})})}_resolveDistinctId(e,t){return"string"==typeof e?{distinctId:e,options:t}:{distinctId:this.context?.get()?.distinctId,options:e}}async _getFeatureFlagResult(e,t,r={},i){let s,a,n,o,l,u,c,h=r.sendFeatureFlagEvents??!0;if(void 0!==this._flagOverrides&&e in this._flagOverrides){let t=this._flagOverrides[e];if(void 0===t)return;let r=this._payloadOverrides?.[e];return{key:e,enabled:!1!==t,variant:"string"==typeof t?t:void 0,payload:r}}let{groups:d,disableGeoip:g}=r,{onlyEvaluateLocally:p,personProperties:f,groupProperties:y}=r,m=this.addLocalPersonAndGroupProperties(t,d,f,y);f=m.allPersonProperties,y=m.allGroupProperties;let v=this.createFeatureFlagEvaluationContext(t,d,f,y);void 0==p&&(p=this.options.strictLocalEvaluation??!1);let b=!1;if(void 0!==this.featureFlagsPoller){await this.featureFlagsPoller?.loadFeatureFlags();let t=this.featureFlagsPoller?.featureFlagsByKey[e];if(t)try{let r=await this.featureFlagsPoller?.computeFlagAndPayloadLocally(t,v,{matchValue:i});if(r){b=!0;let i=r.value;l=t.id,c="Evaluated locally",s={key:e,enabled:!1!==i,variant:"string"==typeof i?i:void 0,payload:r.payload??void 0}}}catch(t){if(t instanceof ro||t instanceof rn)this._logger?.info(`${t.name} when computing flag locally: ${e}: ${t.message}`);else throw t}}if(!b&&!p){let t=await super.getFeatureFlagDetailsStateless(v.distinctId,v.groups,v.personProperties,v.groupProperties,g,[e]);if(void 0===t)o=rr.UNKNOWN_ERROR;else{a=t.requestId,n=t.evaluatedAt;let r=[];t.errorsWhileComputingFlags&&r.push(rr.ERRORS_WHILE_COMPUTING),t.quotaLimited?.includes("feature_flags")&&r.push(rr.QUOTA_LIMITED);let i=t.flags[e];if(void 0===i)r.push(rr.FLAG_MISSING);else{let t;if(l=i.metadata?.id,u=i.metadata?.version,c=i.reason?.description??i.reason?.code,i.metadata?.payload!==void 0)try{t=JSON.parse(i.metadata.payload)}catch{t=i.metadata.payload}s={key:e,enabled:i.enabled,variant:i.variant,payload:t}}r.length>0&&(o=r.join(","))}}if(h){let r=void 0===s?void 0:!1!==s.enabled&&(s.variant??!0),i=`${e}_${r}`;if(!(t in this.distinctIdHasSentFlagCalls)||!this.distinctIdHasSentFlagCalls[t].includes(i)){Object.keys(this.distinctIdHasSentFlagCalls).length>=this.maxCacheSize&&(this.distinctIdHasSentFlagCalls={}),Array.isArray(this.distinctIdHasSentFlagCalls[t])?this.distinctIdHasSentFlagCalls[t].push(i):this.distinctIdHasSentFlagCalls[t]=[i];let s={$feature_flag:e,$feature_flag_response:r,$feature_flag_id:l,$feature_flag_version:u,$feature_flag_reason:c,locally_evaluated:b,[`$feature/${e}`]:r,$feature_flag_request_id:a,$feature_flag_evaluated_at:b?Date.now():n};if(b&&this.featureFlagsPoller){let e=this.featureFlagsPoller.getFlagDefinitionsLoadedAt();void 0!==e&&(s.$feature_flag_definitions_loaded_at=e)}o&&(s.$feature_flag_error=o),this.capture({distinctId:t,event:"$feature_flag_called",properties:s,groups:d,disableGeoip:g})}}return void 0!==s&&void 0!==this._payloadOverrides&&e in this._payloadOverrides&&(s={...s,payload:this._payloadOverrides[e]}),s}async getFeatureFlag(e,t,r){let i=await this._getFeatureFlagResult(e,t,{...r,sendFeatureFlagEvents:r?.sendFeatureFlagEvents??this.options.sendFeatureFlagEvent??!0});if(void 0!==i)return!1!==i.enabled&&(i.variant??!0)}async getFeatureFlagPayload(e,t,r,i){if(void 0!==this._payloadOverrides&&e in this._payloadOverrides)return this._payloadOverrides[e];let s=await this._getFeatureFlagResult(e,t,{...i,sendFeatureFlagEvents:!1},r);if(void 0!==s)return s.payload??null}async getFeatureFlagResult(e,t,r){let{distinctId:i,options:s}=this._resolveDistinctId(t,r);return i?this._getFeatureFlagResult(e,i,{...s,sendFeatureFlagEvents:s?.sendFeatureFlagEvents??this.options.sendFeatureFlagEvent??!0}):void this._logger.warn("[PostHog] distinctId is required — pass it explicitly or use withContext()")}async getRemoteConfigPayload(e){if(!this.options.personalApiKey)throw Error("Personal API key is required for remote config payload decryption");let t=await this._requestRemoteConfigPayload(e);if(!t)return;let r=await t.json();if("string"==typeof r)try{return JSON.parse(r)}catch(e){}return r}async isFeatureEnabled(e,t,r){let i=await this.getFeatureFlag(e,t,r);if(void 0!==i)return!!i}async getAllFlags(e,t){let{distinctId:r,options:i}=this._resolveDistinctId(e,t);return r?(await this.getAllFlagsAndPayloads(r,i)).featureFlags||{}:(this._logger.warn("[PostHog] distinctId is required to get feature flags — pass it explicitly or use withContext()"),{})}async getAllFlagsAndPayloads(e,t){let{distinctId:r,options:i}=this._resolveDistinctId(e,t);if(!r)return this._logger.warn("[PostHog] distinctId is required to get feature flags and payloads — pass it explicitly or use withContext()"),{featureFlags:{},featureFlagPayloads:{}};let{groups:s,disableGeoip:a,flagKeys:n}=i||{},{onlyEvaluateLocally:o,personProperties:l,groupProperties:u}=i||{},c=this.addLocalPersonAndGroupProperties(r,s,l,u);l=c.allPersonProperties,u=c.allGroupProperties;let h=this.createFeatureFlagEvaluationContext(r,s,l,u);void 0==o&&(o=this.options.strictLocalEvaluation??!1);let d=await this.featureFlagsPoller?.getAllFlagsAndPayloads(h,n),g={},p={},f=!0;if(d&&(g=d.response,p=d.payloads,f=d.fallbackToFlags),f&&!o){let e=await super.getFeatureFlagsAndPayloadsStateless(h.distinctId,h.groups,h.personProperties,h.groupProperties,a,n);g={...g,...e.flags||{}},p={...p,...e.payloads||{}}}return void 0!==this._flagOverrides&&(g={...g,...this._flagOverrides}),void 0!==this._payloadOverrides&&(p={...p,...this._payloadOverrides}),{featureFlags:g,featureFlagPayloads:p}}groupIdentify({groupType:e,groupKey:t,properties:r,distinctId:i,disableGeoip:s}){super.groupIdentifyStateless(e,t,r,{disableGeoip:s},i)}async reloadFeatureFlags(){await this.featureFlagsPoller?.loadFeatureFlags(!0)}overrideFeatureFlags(e){let t=e=>Object.fromEntries(e.map(e=>[e,!0]));if(!1===e){this._flagOverrides=void 0,this._payloadOverrides=void 0;return}if(Array.isArray(e)){this._flagOverrides=t(e);return}if(this._isFeatureFlagOverrideOptions(e)){"flags"in e&&(!1===e.flags?this._flagOverrides=void 0:Array.isArray(e.flags)?this._flagOverrides=t(e.flags):void 0!==e.flags&&(this._flagOverrides={...e.flags})),"payloads"in e&&(!1===e.payloads?this._payloadOverrides=void 0:void 0!==e.payloads&&(this._payloadOverrides={...e.payloads}));return}this._flagOverrides={...e}}_isFeatureFlagOverrideOptions(e){if("object"!=typeof e||null===e||Array.isArray(e))return!1;if("flags"in e){let t=e.flags;if(!1===t||Array.isArray(t)||"object"==typeof t&&null!==t)return!0}if("payloads"in e){let t=e.payloads;if(!1===t||"object"==typeof t&&null!==t)return!0}return!1}withContext(e,t,r){return this.context?this.context.run(e,t,r):t()}getContext(){return this.context?.get()}enterContext(e,t){this.context?.enter(e,t)}async _shutdown(e){let t=this._consumeWaitUntilCycle();await this.featureFlagsPoller?.stopPoller(e),this.errorTracking.shutdown();try{return await super._shutdown(e)}finally{t?.()}}async _requestRemoteConfigPayload(e){if(!this.options.personalApiKey)return;let t=`${this.host}/api/projects/@current/feature_flags/${e}/remote_config?token=${encodeURIComponent(this.apiKey)}`,r={method:"GET",headers:{...this.getCustomHeaders(),"Content-Type":"application/json",Authorization:`Bearer ${this.options.personalApiKey}`}},i=null;if(this.options.requestTimeout&&"number"==typeof this.options.requestTimeout){let e=new AbortController;i=tn(()=>{e.abort()},this.options.requestTimeout),r.signal=e.signal}try{return await this.fetch(t,r)}catch(e){this._events.emit("error",e);return}finally{i&&clearTimeout(i)}}extractPropertiesFromEvent(e,t){if(!e)return{personProperties:{},groupProperties:{}};let r={},i={};for(let[s,a]of Object.entries(e))if(Z(a)&&t&&s in t){let e={};for(let[t,r]of Object.entries(a))e[String(t)]=String(r);i[String(s)]=e}else r[String(s)]=String(a);return{personProperties:r,groupProperties:i}}async getFeatureFlagsForEvent(e,t,r,i){let s=i?.personProperties||{},a=i?.groupProperties||{},n=i?.flagKeys;if(i?.onlyEvaluateLocally??this.options.strictLocalEvaluation)if(!((this.featureFlagsPoller?.featureFlags?.length||0)>0))return{};else{let i={};for(let[e,r]of Object.entries(t||{}))i[e]=String(r);return await this.getAllFlags(e,{groups:i,personProperties:s,groupProperties:a,disableGeoip:r,onlyEvaluateLocally:!0,flagKeys:n})}if((this.featureFlagsPoller?.featureFlags?.length||0)>0){let i={};for(let[e,r]of Object.entries(t||{}))i[e]=String(r);return await this.getAllFlags(e,{groups:i,personProperties:s,groupProperties:a,disableGeoip:r,onlyEvaluateLocally:!0,flagKeys:n})}return(await super.getFeatureFlagsStateless(e,t,s,a,r)).flags}addLocalPersonAndGroupProperties(e,t,r,i){let s={distinct_id:e,...r||{}},a={};if(t)for(let e of Object.keys(t))a[e]={$group_key:t[e],...i?.[e]||{}};return{allPersonProperties:s,allGroupProperties:a}}createFeatureFlagEvaluationContext(e,t,r,i){return{distinctId:e,groups:t||{},personProperties:r||{},groupProperties:i||{},evaluationCache:{}}}captureException(e,t,r,i){if(!rt.isPreviouslyCapturedError(e)){let s=Error("PostHog syntheticException");this.addPendingPromise(rt.buildEventMessage(e,{syntheticException:s},t,r).then(e=>this.capture({...e,uuid:i})))}}async captureExceptionImmediate(e,t,r){if(!rt.isPreviouslyCapturedError(e)){let i=Error("PostHog syntheticException");this.addPendingPromise(rt.buildEventMessage(e,{syntheticException:i},t,r).then(e=>this.captureImmediate(e)))}}async prepareEventMessage(e){let{distinctId:t,event:r,properties:i,groups:s,sendFeatureFlags:a,timestamp:n,disableGeoip:o,uuid:l}=e,u=this.context?.get(),c=t||u?.distinctId,h={...this.props,...u?.properties||{},...i||{}};c||(c=f().toString(),h.$process_person_profile=!1),u?.sessionId&&!h.$session_id&&(h.$session_id=u.sessionId);let d=this._runBeforeSend({distinctId:c,event:r,properties:h,groups:s,sendFeatureFlags:a,timestamp:n,disableGeoip:o,uuid:l});if(!d)return Promise.reject(null);let g=await Promise.resolve().then(async()=>a?await this.getFeatureFlagsForEvent(d.distinctId,s,o,"object"==typeof a?a:void 0):(d.event,{})).then(e=>{let t={};if(e)for(let[r,i]of Object.entries(e))t[`$feature/${r}`]=i;let r=Object.keys(e||{}).filter(t=>e?.[t]!==!1).sort();return r.length>0&&(t.$active_feature_flags=r),t}).catch(()=>({})).then(e=>({...e,...d.properties||{},$groups:d.groups||s}));return"$pageview"===d.event&&this.options.__preview_capture_bot_pageviews&&"string"==typeof g.$raw_user_agent&&_(g.$raw_user_agent,this.options.custom_blocked_useragents||[])&&(d.event="$bot_pageview",g.$browser_type="bot"),{distinctId:d.distinctId,event:d.event,properties:g,options:{timestamp:d.timestamp,disableGeoip:d.disableGeoip,uuid:d.uuid}}}_runBeforeSend(e){let t=this.options.before_send;if(!t)return e;let r=Array.isArray(t)?t:[t],i=e;for(let t of r){if(!(i=t(i)))return this._logger.info(`Event '${e.event}' was rejected in beforeSend function`),null;if(!i.properties||0===Object.keys(i.properties).length){let e=`Event '${i.event}' has no properties after beforeSend function, this is likely an error.`;this._logger.warn(e)}}return i}}var t4=t1,rm=e.i(78500);class rv{constructor(){this.storage=new rm.AsyncLocalStorage}get(){return this.storage.getStore()}run(e,t,r){return this.storage.run(this.resolve(e,r),t)}enter(e,t){this.storage.enterWith(this.resolve(e,t))}resolve(e,t){if(t?.fresh===!0)return e;let r=this.get()||{};return{distinctId:e.distinctId??r.distinctId,sessionId:e.sessionId??r.sessionId,properties:{...r.properties||{},...e.properties||{}}}}}let rb="posthog-node";function r_(e,{organization:t,projectId:r,prefix:i,severityAllowList:s=["error"],sendExceptionsToPostHog:a=!0}={}){return n=>{if(!("*"===s||s.includes(n.level)))return n;n.tags||(n.tags={});let o=n.tags[rE.POSTHOG_ID_TAG];if(void 0===o)return n;let l=e.options.host??"https://us.i.posthog.com",u=new URL(`/project/${e.apiKey}/person/${o}`,l).toString();n.tags["PostHog Person URL"]=u;let c=n.exception?.values||[],h=c.map(e=>({...e,stacktrace:e.stacktrace?{...e.stacktrace,type:"raw",frames:(e.stacktrace.frames||[]).map(e=>({...e,platform:"node:javascript"}))}:void 0})),d={$exception_message:c[0]?.value||n.message,$exception_type:c[0]?.type,$exception_level:n.level,$exception_list:h,$sentry_event_id:n.event_id,$sentry_exception:n.exception,$sentry_exception_message:c[0]?.value||n.message,$sentry_exception_type:c[0]?.type,$sentry_tags:n.tags};return t&&r&&(d.$sentry_url=(i||"https://sentry.io/organizations/")+t+"/issues/?project="+r+"&query="+n.event_id),a&&e.capture({event:"$exception",distinctId:o,properties:d}),n}}function rw(e,t){let r=r_(e,t);return{name:rb,processEvent:e=>r(e)}}class rE{static #e=this.POSTHOG_ID_TAG="posthog_distinct_id";constructor(e,t,r,i,s){this.name=rb,this.name=rb,this.setupOnce=function(a,n){a(r_(e,{organization:t,projectId:n()?.getClient()?.getDsn()?.projectId,prefix:r,severityAllowList:i,sendExceptionsToPostHog:s??!0}))}}}function rP(e,t){var r;t.use((r=e,(e,t,i,s)=>{if(rt.isPreviouslyCapturedError(e))return void s(e);let a=t.headers["x-posthog-session-id"],n=t.headers["x-posthog-distinct-id"],o=Error("Synthetic exception");r.addPendingPromise(rt.buildEventMessage(e,{mechanism:{type:"middleware",handled:!1},syntheticException:o},n,{$session_id:a,$current_url:t.url,$request_method:t.method,$request_path:t.path,$user_agent:t.headers["user-agent"],$response_status_code:i.statusCode,$ip:t.headers["x-forwarded-for"]||t?.socket?.remoteAddress}).then(e=>{r.capture(e)})),s(e)}))}e.s(["PostHogSentryIntegration",()=>rE,"createEventProcessor",()=>r_,"sentryIntegration",()=>rw],91573),e.s(["setupExpressErrorHandler",()=>rP],93546),e.s([],92998),rt.errorPropertiesBuilder=new t4.ErrorPropertiesBuilder([new t4.EventCoercer,new t4.ErrorCoercer,new t4.ObjectCoercer,new t4.StringCoercer,new t4.PrimitiveCoercer],t4.createStackParser("node:javascript",t4.nodeStackLineParser),[(a=function(e=process.argv[1]?(0,o.dirname)(process.argv[1]):process.cwd(),t="\\"===o.sep){let r=t?l(e):e;return e=>{if(!e)return;let i=t?l(e):e,{dir:s,base:a,ext:n}=o.posix.parse(i);(".js"===n||".mjs"===n||".cjs"===n)&&(a=a.slice(0,-1*n.length));let u=decodeURIComponent(a);s||(s=".");let c=s.lastIndexOf("/node_modules");if(c>-1)return`${s.slice(c+14).replace(/\//g,".")}:${u}`;if(s.startsWith(r)){let e=s.slice(r.length+1).replace(/\//g,".");return e?`${e}:${u}`:u}return u}}(),async e=>{for(let t of e)t.module=a(t.filename);return e}),t9]);class rF extends ry{getLibraryId(){return"posthog-node"}initializeContext(){return new rv}}e.s(["PostHog",()=>rF],47839),e.i(47839),e.i(92998),e.i(91573),e.i(93546),e.i(58325),e.s(["FeatureFlagError",()=>m,"PostHogSentryIntegration",()=>rE,"createEventProcessor",()=>r_,"sentryIntegration",()=>rw,"setupExpressErrorHandler",()=>rP],57564),e.i(57564),e.s(["FeatureFlagError",()=>m,"PostHog",()=>rF,"PostHogSentryIntegration",()=>rE,"createEventProcessor",()=>r_,"sentryIntegration",()=>rw,"setupExpressErrorHandler",()=>rP],28864)}];
|
|
2
2
|
|
|
3
3
|
//# sourceMappingURL=node_modules_posthog-node_dist_entrypoints_index_node_mjs_20debb74._.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
module.exports=[4730,e=>{e.v({name:"claudeye",version:"1.0.
|
|
1
|
+
module.exports=[4730,e=>{e.v({name:"claudeye",version:"1.0.5-beta.1",description:"Watchtower for Claude Code & Agents SDK — replay sessions, run custom evals, debug agent traces locally",bin:{claudeye:"./bin/claudeye.mjs"},main:"./dist/index.js",types:"./dist/index.d.ts",exports:{".":{import:"./dist/index.js",types:"./dist/index.d.ts"}},files:["bin/","dist/",".next/standalone/","README.md"],engines:{node:">=20.9.0",bun:">=1.3.0"},scripts:{dev:"bun scripts/dev.ts --port 8020",build:"bun --bun next build","build:evals":"tsc -p tsconfig.evals.json && bun scripts/minify-dist.mjs","build:binary":"bun build --compile src/binary-entry.ts --outfile claudeye-local",start:"bun scripts/start.ts",test:"vitest","test:run":"vitest run",lint:"eslint . --config eslint.config.mjs",prepublishOnly:"bun run build:evals && bun run build && bun scripts/prepare-package.mjs","set-versions":"bun scripts/set-versions.mjs","test:binary":"bash scripts/test-local.sh","test:binary:quick":"bash scripts/test-local.sh --skip-build","test:npx":"bash scripts/test-npx.sh"},keywords:["claude","claude-code","claude-agents-sdk","anthropic","ai-agent","llm-observability","agent-observability","log-viewer","session-replay","eval-framework","developer-tools","devtools","cli","dashboard","local-first","monitoring","debugging","tracing"],author:"ExosphereHost Inc. <claudeye@exosphere.host>",license:"SEE LICENSE IN LICENSE",homepage:"https://claudeye.exosphere.host",repository:{type:"git",url:"https://github.com/exospherehost/claudeye.git"},bugs:{url:"https://github.com/exospherehost/claudeye/issues"},publishConfig:{access:"restricted"},devDependencies:{"@tailwindcss/postcss":"^4.1.18","@tanstack/react-virtual":"^3.13.18","@testing-library/jest-dom":"^6.9.1","@testing-library/react":"^16.3.2","@testing-library/user-event":"^14.6.1","@types/node":"^25.2.0","@types/react":"^19.2.13","@types/react-dom":"^19.2.3","@vitejs/plugin-react":"^6.0.1",autoprefixer:"^10.4.24","class-variance-authority":"^0.7.1",clsx:"^2.1.1",eslint:"^10.0.3","eslint-config-next":"^16.1.6","happy-dom":"^20.7.0","lucide-react":"^0.577.0",next:"^16.1.6",postcss:"^8.5.6",react:"^19.2.4","react-dom":"^19.2.4","tailwind-merge":"^3.4.0",tailwindcss:"^4.1.18","tw-animate-css":"^1.4.0",typescript:"^5.9.3",vite:"^8.0.0",vitest:"^4.0.18"},dependencies:{"posthog-node":"^5.28.0"}})}];
|
|
2
2
|
|
|
3
3
|
//# sourceMappingURL=package_json_4b1b4d6f._.js.map
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
module.exports=[50227,(a,b,c)=>{b.exports=a.x("node:path",()=>require("node:path"))},2157,(a,b,c)=>{b.exports=a.x("node:fs",()=>require("node:fs"))},60526,(a,b,c)=>{b.exports=a.x("node:os",()=>require("node:os"))},66680,(a,b,c)=>{b.exports=a.x("node:crypto",()=>require("node:crypto"))},74533,(a,b,c)=>{b.exports=a.x("node:child_process",()=>require("node:child_process"))},77728,a=>{"use strict";var b=a.i(37936),c=a.i(5246),d=a.i(76668),e=a.i(9223);async function f(a){let b=a.get("username"),f=a.get("password"),g=a.get("redirectTo")||"/";if(!b||!f)return{error:"Username and password are required"};let i=process.env.CLAUDEYE_AUTH_USERS??"",j=(0,e.parseAuthUsers)(i),k=!1;for(let a of j){let c=h(a.username,b),d=h(a.password,f);c&&d&&(k=!0)}if(!k)return(0,d.logActivity)(b,"login-failed"),{error:"Invalid username or password"};let l=process.env.CLAUDEYE_AUTH_SECRET??"",m=await (0,e.createSessionCookie)(b,l),n=await (0,c.cookies)();return n.set("claudeye_session",m,{httpOnly:!0,sameSite:"lax",path:"/",maxAge:86400}),n.set("claudeye_auth","1",{sameSite:"lax",path:"/",maxAge:86400}),(0,d.logActivity)(b,"login"),{redirectTo:g}}async function g(){let{getRequestUsername:b}=await a.A(47538),e=await b();(0,d.logActivity)(e,"logout");let f=await (0,c.cookies)();return f.delete("claudeye_session"),f.delete("claudeye_auth"),{redirectTo:"/login"}}function h(a,b){if(a.length!==b.length){let c=Math.max(a.length,b.length);for(let d=0;d<c;d++)a.charCodeAt(d%a.length),b.charCodeAt(d%b.length);return!1}let c=0;for(let d=0;d<a.length;d++)c|=a.charCodeAt(d)^b.charCodeAt(d);return 0===c}(0,a.i(13095).ensureServerEntryExports)([f,g]),(0,b.registerServerReference)(f,"40303729eb6b7aa7b26282f118581e6abfca4b0d9a",null),(0,b.registerServerReference)(g,"00c18bb87e5a5e05b0a8d8532d6cc5f00bed8d5f4c",null),a.s(["login",()=>f,"logout",()=>g])},76668,a=>{"use strict";let b={info:0,warn:1,error:2},c="warn";function d(){let a=(process.env.CLAUDEYE_LOG_LEVEL??"").toLowerCase();c="info"===a||"warn"===a||"error"===a?a:"warn"}function e(){return c}function f(a){return b[a]>=b[c]}function g(a){return`[claudeye ${new Date().toISOString()}] ${a}`}function h(a,b){f("info")&&(void 0!==b?console.log(g("INFO"),a,b):console.log(g("INFO"),a))}function i(a,b){f("warn")&&(void 0!==b?console.warn(g("WARN"),a,b):console.warn(g("WARN"),a))}function j(a,b){void 0!==b?console.error(g("ERROR"),a,b):console.error(g("ERROR"),a)}function k(a,b,c){if(!f("info"))return;let d=[`user=${a}`,`action=${b}`];c&&d.push(c),console.log(g("ACTIVITY"),d.join(" "))}async function l(){try{let{cookies:b}=await a.A(23804),c=await b(),d=c.get("claudeye_session")?.value;if(!d)return"anonymous";let e=process.env.CLAUDEYE_AUTH_SECRET??"",{verifySessionCookie:f}=await a.A(76958);return await f(d,e)??"anonymous"}catch{return"anonymous"}}a.s(["getLogLevel",()=>e,"getRequestUsername",()=>l,"initLogger",()=>d,"logActivity",()=>k,"logError",()=>j,"logInfo",()=>h,"logWarn",()=>i])},37936,(a,b,c)=>{"use strict";Object.defineProperty(c,"__esModule",{value:!0}),Object.defineProperty(c,"registerServerReference",{enumerable:!0,get:function(){return d.registerServerReference}});let d=a.r(11857)},13095,(a,b,c)=>{"use strict";function d(a){for(let b=0;b<a.length;b++){let c=a[b];if("function"!=typeof c)throw Object.defineProperty(Error(`A "use server" file can only export async functions, found ${typeof c}.
|
|
2
|
+
Read more: https://nextjs.org/docs/messages/invalid-use-server-value`),"__NEXT_ERROR_CODE",{value:"E352",enumerable:!1,configurable:!0})}}Object.defineProperty(c,"__esModule",{value:!0}),Object.defineProperty(c,"ensureServerEntryExports",{enumerable:!0,get:function(){return d}})},9223,a=>{"use strict";function b(a){let b=new Uint8Array(a),c="";for(let a of b)c+=String.fromCharCode(a);return btoa(c).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}function c(a){let b=a.replace(/-/g,"+").replace(/_/g,"/"),c=atob(b+"=".repeat((4-b.length%4)%4)),d=new Uint8Array(c.length);for(let a=0;a<c.length;a++)d[a]=c.charCodeAt(a);return d}async function d(a){let b=new TextEncoder;return crypto.subtle.importKey("raw",b.encode(a),{name:"HMAC",hash:"SHA-256"},!1,["sign","verify"])}async function e(a,c){let e=JSON.stringify({u:a,e:Date.now()+864e5}),f=new TextEncoder().encode(e),g=await d(c),h=await crypto.subtle.sign("HMAC",g,f);return`${b(f.buffer)}.${b(h)}`}async function f(a,b){let e=a.indexOf(".");if(e<0)return null;try{let f=a.slice(0,e),g=a.slice(e+1),h=c(f),i=c(g),j=await d(b);if(!await crypto.subtle.verify("HMAC",j,i.buffer,h.buffer))return null;let{u:k,e:l}=JSON.parse(new TextDecoder().decode(h));if("number"!=typeof l||Date.now()>l)return null;return"string"==typeof k?k:null}catch{return null}}function g(a){return a.trim()?a.split(",").reduce((a,b)=>{let c=b.indexOf(":");return c>0&&a.push({username:b.slice(0,c),password:b.slice(c+1)}),a},[]):[]}a.s(["createSessionCookie",()=>e,"parseAuthUsers",()=>g,"verifySessionCookie",()=>f])},46325,a=>{"use strict";let b=(0,a.i(61972).createScopedRegistry)("__CLAUDEYE_ENRICHER_REGISTRY__");function c(a,d,e,f="session",g){let h={name:a,fn:d,scope:f};e&&(h.condition=e),g&&(h.subagentType=g),b.register(h)}let d=b.getAll,e=b.getSessionScoped,f=b.getSubagentScoped,g=b.hasSubagent,h=b.has,i=b.clear;a.s(["clearEnrichers",0,i,"getRegisteredEnrichers",0,d,"getSessionScopedEnrichers",0,e,"getSubagentScopedEnrichers",0,f,"hasEnrichers",0,h,"hasSubagentEnrichers",0,g,"registerEnricher",()=>c])},70467,a=>{"use strict";let b=(0,a.i(61972).createScopedRegistry)("__CLAUDEYE_EVAL_REGISTRY__");function c(a,d,e,f="session",g){let h={name:a,fn:d,scope:f};e&&(h.condition=e),g&&(h.subagentType=g),b.register(h)}let d=b.getAll,e=b.getSessionScoped,f=b.getSubagentScoped,g=b.hasSubagent,h=b.has,i=b.clear;a.s(["clearEvals",0,i,"getRegisteredEvals",0,d,"getSessionScopedEvals",0,e,"getSubagentScopedEvals",0,f,"hasEvals",0,h,"hasSubagentEvals",0,g,"registerEval",()=>c])},69191,a=>{"use strict";var b=a.i(24868),c=a.i(14747),d=a.i(90798),e=a.i(34900),f=a.i(76668),g=a.i(82248);async function h(a,c){try{return(await (0,b.stat)(a)).mtime}catch(a){return(0,f.logWarn)(`Failed to stat ${c}:`,a),new Date(0)}}async function i(a){try{if(!(await (0,b.stat)(a)).isDirectory())return null;return await (0,b.readdir)(a,{withFileTypes:!0})}catch{return null}}async function j(){try{let a=(0,d.getClaudeProjectsPath)(),b=await i(a);if(!b)return[];let e=await Promise.all(b.filter(a=>a.isDirectory()).map(async b=>{let d=(0,c.join)(a,b.name),e=await h(d,b.name);return{name:b.name,path:d,isDirectory:!0,lastModified:e,lastModifiedFormatted:(0,g.formatDate)(e)}}));return e.sort((a,b)=>b.lastModified.getTime()-a.lastModified.getTime()),e}catch(a){return(0,f.logError)("Error reading project folders:",a),[]}}function k(a){let b=(0,d.getClaudeProjectsPath)();return(0,c.join)(b,a)}function l(a){let b=a.match(/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/i);return b?b[0]:void 0}async function m(a){try{let b=await i(a);if(!b)return[];let d=b.filter(a=>a.isFile()&&a.name.endsWith(".jsonl")&&l(a.name)),e=await Promise.all(d.map(async b=>{let d=(0,c.join)(a,b.name),e=await h(d,b.name);return{name:b.name,path:d,lastModified:e,lastModifiedFormatted:(0,g.formatDate)(e),sessionId:l(b.name)}}));return e.sort((a,b)=>b.lastModified.getTime()-a.lastModified.getTime()),e}catch(a){return(0,f.logError)("Error reading session files:",a),[]}}let n=(0,e.runtimeCache)(j,30),o=(0,e.runtimeCache)(a=>m(a),30);a.s(["getCachedProjectFolders",0,n,"getCachedSessionFiles",0,o,"getProjectPath",()=>k])},80807,a=>{"use strict";function b(a){let b=a.indexOf("/");return -1===b?a:a.slice(0,b)}a.s(["baseSessionId",()=>b])},79839,a=>{"use strict";var b=a.i(77728),c=a.i(37936),d=a.i(62733),e=a.i(70467);a.i(651);var f=a.i(46721),g=a.i(70427),h=a.i(13095);async function i(a,b,c,h){try{await (0,d.ensureEvalsLoaded)();let i=c?(0,e.getSubagentScopedEvals)(h):(0,e.getSessionScopedEvals)();if(0===i.length)return{ok:!0,hasEvals:!1};let j=i.map(a=>a.name),k=c?`${b}/agent-${c}`:b,l=c?await (0,f.hashSubagentFile)(a,b,c):await (0,f.hashSessionFile)(a,b);if(!l)return{ok:!0,hasEvals:!0,names:j,cachedResults:[],uncachedNames:j};let m=[],n=[];return await Promise.all(i.map(async b=>{let c=(0,f.hashItemCode)(b.fn),d=await (0,g.getPerItemCacheWithHook)("evals",a,k,b.name,c,l);d?m.push(d.value):n.push(b.name)})),{ok:!0,hasEvals:!0,names:j,cachedResults:m,uncachedNames:n}}catch(a){return{ok:!1,error:a instanceof Error?a.message:String(a)}}}(0,h.ensureServerEntryExports)([i]),(0,c.registerServerReference)(i,"788b939a3811123739b4c261713a561b7be6b88bdb",null);var j=a.i(76668);async function k(b,c){let d=await (0,j.getRequestUsername)();(0,j.logActivity)(d,"clear-alert-marker",`project=${b} session=${c}`);let{clearAlertFiredMarker:e}=await a.A(65975);await e(b,c)}async function l(b,c,d,e,f){let g=await (0,j.getRequestUsername)();(0,j.logActivity)(g,"invalidate-cache",`kind=${b} item=${e} project=${c} session=${d}`);let{invalidatePerItemCache:h}=await a.A(71282),i=f?`${d}/agent-${f}`:d;await h(b,c,i,e)}async function m(b,c,d,e){let f=await (0,j.getRequestUsername)();(0,j.logActivity)(f,"invalidate-cache",`kind=${b} project=${c} session=${d}`);let{invalidatePerItemCaches:g}=await a.A(71282),h=e?`${d}/agent-${e}`:d;await g(b,c,h)}(0,h.ensureServerEntryExports)([k]),(0,c.registerServerReference)(k,"60fd533e3ca825f036a559930d5ae1c8137e051f22",null),(0,h.ensureServerEntryExports)([l,m]),(0,c.registerServerReference)(l,"7ce8d23e52e5028cb57842e0dc5c67fa3cd0e07ce6",null),(0,c.registerServerReference)(m,"78c948948dd0cd025d2b6317b7edecdb14a773def2",null);var n=a.i(46325);async function o(a,b,c,e){try{await (0,d.ensureEvalsLoaded)();let h=c?(0,n.getSubagentScopedEnrichers)(e):(0,n.getSessionScopedEnrichers)();if(0===h.length)return{ok:!0,hasEnrichers:!1};let i=h.map(a=>a.name),j=c?`${b}/agent-${c}`:b,k=c?await (0,f.hashSubagentFile)(a,b,c):await (0,f.hashSessionFile)(a,b);if(!k)return{ok:!0,hasEnrichers:!0,names:i,cachedResults:[],uncachedNames:i};let l=[],m=[];return await Promise.all(h.map(async b=>{let c=(0,f.hashItemCode)(b.fn),d=await (0,g.getPerItemCacheWithHook)("enrichments",a,j,b.name,c,k);d?l.push(d.value):m.push(b.name)})),{ok:!0,hasEnrichers:!0,names:i,cachedResults:l,uncachedNames:m}}catch(a){return{ok:!1,error:a instanceof Error?a.message:String(a)}}}(0,h.ensureServerEntryExports)([o]),(0,c.registerServerReference)(o,"78932912ba611b04439f2504b4533f699d924d302c",null);let p=(0,a.i(61972).createScopedRegistry)("__CLAUDEYE_ACTION_REGISTRY__");p.getAll;let q=p.getSessionScoped,r=p.getSubagentScoped;async function s(a,b,c,e){try{await (0,d.ensureEvalsLoaded)();let h=c?r(e):q();if(0===h.length)return{ok:!0,hasActions:!1};let i=h.map(a=>a.name),j={};for(let a of h)a.inputs&&a.inputs.length>0&&(j[a.name]=a.inputs);let k=c?`${b}/agent-${c}`:b,l=c?await (0,f.hashSubagentFile)(a,b,c):await (0,f.hashSessionFile)(a,b);if(!l)return{ok:!0,hasActions:!0,names:i,cachedResults:[],uncachedNames:i,inputDefinitions:j};let m=await Promise.all(h.map(async b=>{if(!b.cache)return{name:b.name,cached:null};let c=(0,f.hashItemCode)(b.fn),d=await (0,g.getPerItemCacheWithHook)("actions",a,k,b.name,c,l);return{name:b.name,cached:d?d.value:null}})),n=[],o=[];for(let a of m)a.cached?n.push(a.cached):o.push(a.name);return{ok:!0,hasActions:!0,names:i,cachedResults:n,uncachedNames:o,inputDefinitions:j}}catch(a){return{ok:!1,error:a instanceof Error?a.message:String(a)}}}p.hasSubagent,p.has,p.clear,(0,h.ensureServerEntryExports)([s]),(0,c.registerServerReference)(s,"7842c4c6c03f04e2cb4aa69b4d9a80e407ea2cd8cf",null);var t=a.i(83590);async function u(){return(0,t.getQueueStatus)()}(0,h.ensureServerEntryExports)([u]),(0,c.registerServerReference)(u,"00265a8f33957a84db8f978b7deaae127276e56faa",null),a.s([],22144),a.i(22144),a.s(["00265a8f33957a84db8f978b7deaae127276e56faa",()=>u,"00c18bb87e5a5e05b0a8d8532d6cc5f00bed8d5f4c",()=>b.logout,"60fd533e3ca825f036a559930d5ae1c8137e051f22",()=>k,"7842c4c6c03f04e2cb4aa69b4d9a80e407ea2cd8cf",()=>s,"788b939a3811123739b4c261713a561b7be6b88bdb",()=>i,"78932912ba611b04439f2504b4533f699d924d302c",()=>o,"78c948948dd0cd025d2b6317b7edecdb14a773def2",()=>m,"7ce8d23e52e5028cb57842e0dc5c67fa3cd0e07ce6",()=>l],79839)},23804,a=>{a.v(a=>Promise.resolve().then(()=>a(5246)))},76958,a=>{a.v(a=>Promise.resolve().then(()=>a(9223)))},47538,a=>{a.v(a=>Promise.resolve().then(()=>a(76668)))},65726,a=>{a.v(b=>Promise.all(["server/chunks/ssr/lib_evals_cache-invalidation-registry_ts_2ee53a56._.js"].map(b=>a.l(b))).then(()=>b(16991)))},45397,a=>{a.v(a=>Promise.resolve().then(()=>a(70467)))},79288,a=>{a.v(a=>Promise.resolve().then(()=>a(46325)))},65975,a=>{a.v(a=>Promise.resolve().then(()=>a(83590)))},71282,a=>{a.v(b=>Promise.all(["server/chunks/ssr/lib_cache_index_ts_35dfbe77._.js"].map(b=>a.l(b))).then(()=>b(74220)))},2726,a=>{a.v(b=>Promise.all(["server/chunks/ssr/[externals]__10373a08._.js","server/chunks/ssr/node_modules_posthog-node_dist_entrypoints_index_node_mjs_8222e100._.js"].map(b=>a.l(b))).then(()=>b(74493)))},978,a=>{a.v(b=>Promise.all(["server/chunks/ssr/_1d335924._.js"].map(b=>a.l(b))).then(()=>b(99938)))},74398,a=>{a.v(b=>Promise.all(["server/chunks/ssr/_87e025a1._.js"].map(b=>a.l(b))).then(()=>b(86736)))},64297,a=>{a.v(b=>Promise.all(["server/chunks/ssr/_d7159840._.js"].map(b=>a.l(b))).then(()=>b(77333)))},44971,a=>{a.v(b=>Promise.all(["server/chunks/ssr/_14858238._.js"].map(b=>a.l(b))).then(()=>b(14775)))}];
|
|
3
|
+
|
|
4
|
+
//# sourceMappingURL=%5Broot-of-the-server%5D__16565f83._.js.map
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
module.exports=[14747,(a,b,c)=>{b.exports=a.x("path",()=>require("path"))},43285,(a,b,c)=>{b.exports=a.x("next/dist/server/app-render/dynamic-access-async-storage.external.js",()=>require("next/dist/server/app-render/dynamic-access-async-storage.external.js"))},18622,(a,b,c)=>{b.exports=a.x("next/dist/compiled/next-server/app-page-turbo.runtime.prod.js",()=>require("next/dist/compiled/next-server/app-page-turbo.runtime.prod.js"))},56704,(a,b,c)=>{b.exports=a.x("next/dist/server/app-render/work-async-storage.external.js",()=>require("next/dist/server/app-render/work-async-storage.external.js"))},32319,(a,b,c)=>{b.exports=a.x("next/dist/server/app-render/work-unit-async-storage.external.js",()=>require("next/dist/server/app-render/work-unit-async-storage.external.js"))},24725,(a,b,c)=>{b.exports=a.x("next/dist/server/app-render/after-task-async-storage.external.js",()=>require("next/dist/server/app-render/after-task-async-storage.external.js"))},20635,(a,b,c)=>{b.exports=a.x("next/dist/server/app-render/action-async-storage.external.js",()=>require("next/dist/server/app-render/action-async-storage.external.js"))},36226,(a,b,c)=>{"use strict";var d=Object.defineProperty,e=Object.getOwnPropertyDescriptor,f=Object.getOwnPropertyNames,g=Object.prototype.hasOwnProperty,h={},i={RequestCookies:()=>p,ResponseCookies:()=>q,parseCookie:()=>l,parseSetCookie:()=>m,stringifyCookie:()=>k};for(var j in i)d(h,j,{get:i[j],enumerable:!0});function k(a){var b;let c=["path"in a&&a.path&&`Path=${a.path}`,"expires"in a&&(a.expires||0===a.expires)&&`Expires=${("number"==typeof a.expires?new Date(a.expires):a.expires).toUTCString()}`,"maxAge"in a&&"number"==typeof a.maxAge&&`Max-Age=${a.maxAge}`,"domain"in a&&a.domain&&`Domain=${a.domain}`,"secure"in a&&a.secure&&"Secure","httpOnly"in a&&a.httpOnly&&"HttpOnly","sameSite"in a&&a.sameSite&&`SameSite=${a.sameSite}`,"partitioned"in a&&a.partitioned&&"Partitioned","priority"in a&&a.priority&&`Priority=${a.priority}`].filter(Boolean),d=`${a.name}=${encodeURIComponent(null!=(b=a.value)?b:"")}`;return 0===c.length?d:`${d}; ${c.join("; ")}`}function l(a){let b=new Map;for(let c of a.split(/; */)){if(!c)continue;let a=c.indexOf("=");if(-1===a){b.set(c,"true");continue}let[d,e]=[c.slice(0,a),c.slice(a+1)];try{b.set(d,decodeURIComponent(null!=e?e:"true"))}catch{}}return b}function m(a){if(!a)return;let[[b,c],...d]=l(a),{domain:e,expires:f,httponly:g,maxage:h,path:i,samesite:j,secure:k,partitioned:m,priority:p}=Object.fromEntries(d.map(([a,b])=>[a.toLowerCase().replace(/-/g,""),b]));{var q,r,s={name:b,value:decodeURIComponent(c),domain:e,...f&&{expires:new Date(f)},...g&&{httpOnly:!0},..."string"==typeof h&&{maxAge:Number(h)},path:i,...j&&{sameSite:n.includes(q=(q=j).toLowerCase())?q:void 0},...k&&{secure:!0},...p&&{priority:o.includes(r=(r=p).toLowerCase())?r:void 0},...m&&{partitioned:!0}};let a={};for(let b in s)s[b]&&(a[b]=s[b]);return a}}b.exports=((a,b,c,h)=>{if(b&&"object"==typeof b||"function"==typeof b)for(let c of f(b))g.call(a,c)||void 0===c||d(a,c,{get:()=>b[c],enumerable:!(h=e(b,c))||h.enumerable});return a})(d({},"__esModule",{value:!0}),h);var n=["strict","lax","none"],o=["low","medium","high"],p=class{constructor(a){this._parsed=new Map,this._headers=a;const b=a.get("cookie");if(b)for(const[a,c]of l(b))this._parsed.set(a,{name:a,value:c})}[Symbol.iterator](){return this._parsed[Symbol.iterator]()}get size(){return this._parsed.size}get(...a){let b="string"==typeof a[0]?a[0]:a[0].name;return this._parsed.get(b)}getAll(...a){var b;let c=Array.from(this._parsed);if(!a.length)return c.map(([a,b])=>b);let d="string"==typeof a[0]?a[0]:null==(b=a[0])?void 0:b.name;return c.filter(([a])=>a===d).map(([a,b])=>b)}has(a){return this._parsed.has(a)}set(...a){let[b,c]=1===a.length?[a[0].name,a[0].value]:a,d=this._parsed;return d.set(b,{name:b,value:c}),this._headers.set("cookie",Array.from(d).map(([a,b])=>k(b)).join("; ")),this}delete(a){let b=this._parsed,c=Array.isArray(a)?a.map(a=>b.delete(a)):b.delete(a);return this._headers.set("cookie",Array.from(b).map(([a,b])=>k(b)).join("; ")),c}clear(){return this.delete(Array.from(this._parsed.keys())),this}[Symbol.for("edge-runtime.inspect.custom")](){return`RequestCookies ${JSON.stringify(Object.fromEntries(this._parsed))}`}toString(){return[...this._parsed.values()].map(a=>`${a.name}=${encodeURIComponent(a.value)}`).join("; ")}},q=class{constructor(a){var b,c,d;this._parsed=new Map,this._headers=a;const e=null!=(d=null!=(c=null==(b=a.getSetCookie)?void 0:b.call(a))?c:a.get("set-cookie"))?d:[];for(const a of Array.isArray(e)?e:function(a){if(!a)return[];var b,c,d,e,f,g=[],h=0;function i(){for(;h<a.length&&/\s/.test(a.charAt(h));)h+=1;return h<a.length}for(;h<a.length;){for(b=h,f=!1;i();)if(","===(c=a.charAt(h))){for(d=h,h+=1,i(),e=h;h<a.length&&"="!==(c=a.charAt(h))&&";"!==c&&","!==c;)h+=1;h<a.length&&"="===a.charAt(h)?(f=!0,h=e,g.push(a.substring(b,d)),b=h):h=d+1}else h+=1;(!f||h>=a.length)&&g.push(a.substring(b,a.length))}return g}(e)){const b=m(a);b&&this._parsed.set(b.name,b)}}get(...a){let b="string"==typeof a[0]?a[0]:a[0].name;return this._parsed.get(b)}getAll(...a){var b;let c=Array.from(this._parsed.values());if(!a.length)return c;let d="string"==typeof a[0]?a[0]:null==(b=a[0])?void 0:b.name;return c.filter(a=>a.name===d)}has(a){return this._parsed.has(a)}set(...a){let[b,c,d]=1===a.length?[a[0].name,a[0].value,a[0]]:a,e=this._parsed;return e.set(b,function(a={name:"",value:""}){return"number"==typeof a.expires&&(a.expires=new Date(a.expires)),a.maxAge&&(a.expires=new Date(Date.now()+1e3*a.maxAge)),(null===a.path||void 0===a.path)&&(a.path="/"),a}({name:b,value:c,...d})),function(a,b){for(let[,c]of(b.delete("set-cookie"),a)){let a=k(c);b.append("set-cookie",a)}}(e,this._headers),this}delete(...a){let[b,c]="string"==typeof a[0]?[a[0]]:[a[0].name,a[0]];return this.set({...c,name:b,value:"",expires:new Date(0)})}[Symbol.for("edge-runtime.inspect.custom")](){return`ResponseCookies ${JSON.stringify(Object.fromEntries(this._parsed))}`}toString(){return[...this._parsed.values()].map(k).join("; ")}}},70406,(a,b,c)=>{b.exports=a.x("next/dist/compiled/@opentelemetry/api",()=>require("next/dist/compiled/@opentelemetry/api"))},7997,(a,b,c)=>{"use strict";b.exports=a.r(24951).vendored["react-rsc"].ReactJsxRuntime},24951,(a,b,c)=>{"use strict";b.exports=a.r(18622)},11857,(a,b,c)=>{"use strict";b.exports=a.r(24951).vendored["react-rsc"].ReactServerDOMTurbopackServer},717,(a,b,c)=>{"use strict";b.exports=a.r(24951).vendored["react-rsc"].React},4276,(a,b,c)=>{let{createClientModuleProxy:d}=a.r(11857);a.n(d("[project]/node_modules/next/dist/client/components/builtin/global-error.js <module evaluation>"))},82509,(a,b,c)=>{let{createClientModuleProxy:d}=a.r(11857);a.n(d("[project]/node_modules/next/dist/client/components/builtin/global-error.js"))},66114,a=>{"use strict";a.i(4276);var b=a.i(82509);a.n(b)}];
|
|
2
|
+
|
|
3
|
+
//# sourceMappingURL=%5Broot-of-the-server%5D__67e8f9e0._.js.map
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
module.exports=[14747,(a,b,c)=>{b.exports=a.x("path",()=>require("path"))},43285,(a,b,c)=>{b.exports=a.x("next/dist/server/app-render/dynamic-access-async-storage.external.js",()=>require("next/dist/server/app-render/dynamic-access-async-storage.external.js"))},18622,(a,b,c)=>{b.exports=a.x("next/dist/compiled/next-server/app-page-turbo.runtime.prod.js",()=>require("next/dist/compiled/next-server/app-page-turbo.runtime.prod.js"))},56704,(a,b,c)=>{b.exports=a.x("next/dist/server/app-render/work-async-storage.external.js",()=>require("next/dist/server/app-render/work-async-storage.external.js"))},32319,(a,b,c)=>{b.exports=a.x("next/dist/server/app-render/work-unit-async-storage.external.js",()=>require("next/dist/server/app-render/work-unit-async-storage.external.js"))},24725,(a,b,c)=>{b.exports=a.x("next/dist/server/app-render/after-task-async-storage.external.js",()=>require("next/dist/server/app-render/after-task-async-storage.external.js"))},20635,(a,b,c)=>{b.exports=a.x("next/dist/server/app-render/action-async-storage.external.js",()=>require("next/dist/server/app-render/action-async-storage.external.js"))},36226,(a,b,c)=>{"use strict";var d=Object.defineProperty,e=Object.getOwnPropertyDescriptor,f=Object.getOwnPropertyNames,g=Object.prototype.hasOwnProperty,h={},i={RequestCookies:()=>p,ResponseCookies:()=>q,parseCookie:()=>l,parseSetCookie:()=>m,stringifyCookie:()=>k};for(var j in i)d(h,j,{get:i[j],enumerable:!0});function k(a){var b;let c=["path"in a&&a.path&&`Path=${a.path}`,"expires"in a&&(a.expires||0===a.expires)&&`Expires=${("number"==typeof a.expires?new Date(a.expires):a.expires).toUTCString()}`,"maxAge"in a&&"number"==typeof a.maxAge&&`Max-Age=${a.maxAge}`,"domain"in a&&a.domain&&`Domain=${a.domain}`,"secure"in a&&a.secure&&"Secure","httpOnly"in a&&a.httpOnly&&"HttpOnly","sameSite"in a&&a.sameSite&&`SameSite=${a.sameSite}`,"partitioned"in a&&a.partitioned&&"Partitioned","priority"in a&&a.priority&&`Priority=${a.priority}`].filter(Boolean),d=`${a.name}=${encodeURIComponent(null!=(b=a.value)?b:"")}`;return 0===c.length?d:`${d}; ${c.join("; ")}`}function l(a){let b=new Map;for(let c of a.split(/; */)){if(!c)continue;let a=c.indexOf("=");if(-1===a){b.set(c,"true");continue}let[d,e]=[c.slice(0,a),c.slice(a+1)];try{b.set(d,decodeURIComponent(null!=e?e:"true"))}catch{}}return b}function m(a){if(!a)return;let[[b,c],...d]=l(a),{domain:e,expires:f,httponly:g,maxage:h,path:i,samesite:j,secure:k,partitioned:m,priority:p}=Object.fromEntries(d.map(([a,b])=>[a.toLowerCase().replace(/-/g,""),b]));{var q,r,s={name:b,value:decodeURIComponent(c),domain:e,...f&&{expires:new Date(f)},...g&&{httpOnly:!0},..."string"==typeof h&&{maxAge:Number(h)},path:i,...j&&{sameSite:n.includes(q=(q=j).toLowerCase())?q:void 0},...k&&{secure:!0},...p&&{priority:o.includes(r=(r=p).toLowerCase())?r:void 0},...m&&{partitioned:!0}};let a={};for(let b in s)s[b]&&(a[b]=s[b]);return a}}b.exports=((a,b,c,h)=>{if(b&&"object"==typeof b||"function"==typeof b)for(let c of f(b))g.call(a,c)||void 0===c||d(a,c,{get:()=>b[c],enumerable:!(h=e(b,c))||h.enumerable});return a})(d({},"__esModule",{value:!0}),h);var n=["strict","lax","none"],o=["low","medium","high"],p=class{constructor(a){this._parsed=new Map,this._headers=a;const b=a.get("cookie");if(b)for(const[a,c]of l(b))this._parsed.set(a,{name:a,value:c})}[Symbol.iterator](){return this._parsed[Symbol.iterator]()}get size(){return this._parsed.size}get(...a){let b="string"==typeof a[0]?a[0]:a[0].name;return this._parsed.get(b)}getAll(...a){var b;let c=Array.from(this._parsed);if(!a.length)return c.map(([a,b])=>b);let d="string"==typeof a[0]?a[0]:null==(b=a[0])?void 0:b.name;return c.filter(([a])=>a===d).map(([a,b])=>b)}has(a){return this._parsed.has(a)}set(...a){let[b,c]=1===a.length?[a[0].name,a[0].value]:a,d=this._parsed;return d.set(b,{name:b,value:c}),this._headers.set("cookie",Array.from(d).map(([a,b])=>k(b)).join("; ")),this}delete(a){let b=this._parsed,c=Array.isArray(a)?a.map(a=>b.delete(a)):b.delete(a);return this._headers.set("cookie",Array.from(b).map(([a,b])=>k(b)).join("; ")),c}clear(){return this.delete(Array.from(this._parsed.keys())),this}[Symbol.for("edge-runtime.inspect.custom")](){return`RequestCookies ${JSON.stringify(Object.fromEntries(this._parsed))}`}toString(){return[...this._parsed.values()].map(a=>`${a.name}=${encodeURIComponent(a.value)}`).join("; ")}},q=class{constructor(a){var b,c,d;this._parsed=new Map,this._headers=a;const e=null!=(d=null!=(c=null==(b=a.getSetCookie)?void 0:b.call(a))?c:a.get("set-cookie"))?d:[];for(const a of Array.isArray(e)?e:function(a){if(!a)return[];var b,c,d,e,f,g=[],h=0;function i(){for(;h<a.length&&/\s/.test(a.charAt(h));)h+=1;return h<a.length}for(;h<a.length;){for(b=h,f=!1;i();)if(","===(c=a.charAt(h))){for(d=h,h+=1,i(),e=h;h<a.length&&"="!==(c=a.charAt(h))&&";"!==c&&","!==c;)h+=1;h<a.length&&"="===a.charAt(h)?(f=!0,h=e,g.push(a.substring(b,d)),b=h):h=d+1}else h+=1;(!f||h>=a.length)&&g.push(a.substring(b,a.length))}return g}(e)){const b=m(a);b&&this._parsed.set(b.name,b)}}get(...a){let b="string"==typeof a[0]?a[0]:a[0].name;return this._parsed.get(b)}getAll(...a){var b;let c=Array.from(this._parsed.values());if(!a.length)return c;let d="string"==typeof a[0]?a[0]:null==(b=a[0])?void 0:b.name;return c.filter(a=>a.name===d)}has(a){return this._parsed.has(a)}set(...a){let[b,c,d]=1===a.length?[a[0].name,a[0].value,a[0]]:a,e=this._parsed;return e.set(b,function(a={name:"",value:""}){return"number"==typeof a.expires&&(a.expires=new Date(a.expires)),a.maxAge&&(a.expires=new Date(Date.now()+1e3*a.maxAge)),(null===a.path||void 0===a.path)&&(a.path="/"),a}({name:b,value:c,...d})),function(a,b){for(let[,c]of(b.delete("set-cookie"),a)){let a=k(c);b.append("set-cookie",a)}}(e,this._headers),this}delete(...a){let[b,c]="string"==typeof a[0]?[a[0]]:[a[0].name,a[0]];return this.set({...c,name:b,value:"",expires:new Date(0)})}[Symbol.for("edge-runtime.inspect.custom")](){return`ResponseCookies ${JSON.stringify(Object.fromEntries(this._parsed))}`}toString(){return[...this._parsed.values()].map(k).join("; ")}}},70406,(a,b,c)=>{b.exports=a.x("next/dist/compiled/@opentelemetry/api",()=>require("next/dist/compiled/@opentelemetry/api"))},20460,(a,b,c)=>{(()=>{"use strict";"u">typeof __nccwpck_require__&&(__nccwpck_require__.ab="/ROOT/node_modules/next/dist/compiled/cookie/");var a,c,d,e,f={};f.parse=function(b,c){if("string"!=typeof b)throw TypeError("argument str must be a string");for(var e={},f=b.split(d),g=(c||{}).decode||a,h=0;h<f.length;h++){var i=f[h],j=i.indexOf("=");if(!(j<0)){var k=i.substr(0,j).trim(),l=i.substr(++j,i.length).trim();'"'==l[0]&&(l=l.slice(1,-1)),void 0==e[k]&&(e[k]=function(a,b){try{return b(a)}catch(b){return a}}(l,g))}}return e},f.serialize=function(a,b,d){var f=d||{},g=f.encode||c;if("function"!=typeof g)throw TypeError("option encode is invalid");if(!e.test(a))throw TypeError("argument name is invalid");var h=g(b);if(h&&!e.test(h))throw TypeError("argument val is invalid");var i=a+"="+h;if(null!=f.maxAge){var j=f.maxAge-0;if(isNaN(j)||!isFinite(j))throw TypeError("option maxAge is invalid");i+="; Max-Age="+Math.floor(j)}if(f.domain){if(!e.test(f.domain))throw TypeError("option domain is invalid");i+="; Domain="+f.domain}if(f.path){if(!e.test(f.path))throw TypeError("option path is invalid");i+="; Path="+f.path}if(f.expires){if("function"!=typeof f.expires.toUTCString)throw TypeError("option expires is invalid");i+="; Expires="+f.expires.toUTCString()}if(f.httpOnly&&(i+="; HttpOnly"),f.secure&&(i+="; Secure"),f.sameSite)switch("string"==typeof f.sameSite?f.sameSite.toLowerCase():f.sameSite){case!0:case"strict":i+="; SameSite=Strict";break;case"lax":i+="; SameSite=Lax";break;case"none":i+="; SameSite=None";break;default:throw TypeError("option sameSite is invalid")}return i},a=decodeURIComponent,c=encodeURIComponent,d=/; */,e=/^[\u0009\u0020-\u007e\u0080-\u00ff]+$/,b.exports=f})()},24951,(a,b,c)=>{"use strict";b.exports=a.r(18622)},11857,(a,b,c)=>{"use strict";b.exports=a.r(24951).vendored["react-rsc"].ReactServerDOMTurbopackServer},717,(a,b,c)=>{"use strict";b.exports=a.r(24951).vendored["react-rsc"].React},50640,(a,b,c)=>{"use strict";Object.defineProperty(c,"__esModule",{value:!0}),Object.defineProperty(c,"InvariantError",{enumerable:!0,get:function(){return d}});class d extends Error{constructor(a,b){super(`Invariant: ${a.endsWith(".")?a:a+"."} This is a bug in Next.js.`,b),this.name="InvariantError"}}},7997,(a,b,c)=>{"use strict";b.exports=a.r(24951).vendored["react-rsc"].ReactJsxRuntime},64240,(a,b,c)=>{"use strict";function d(a){if("function"!=typeof WeakMap)return null;var b=new WeakMap,c=new WeakMap;return(d=function(a){return a?c:b})(a)}c._=function(a,b){if(!b&&a&&a.__esModule)return a;if(null===a||"object"!=typeof a&&"function"!=typeof a)return{default:a};var c=d(b);if(c&&c.has(a))return c.get(a);var e={__proto__:null},f=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var g in a)if("default"!==g&&Object.prototype.hasOwnProperty.call(a,g)){var h=f?Object.getOwnPropertyDescriptor(a,g):null;h&&(h.get||h.set)?Object.defineProperty(e,g,h):e[g]=a[g]}return e.default=a,c&&c.set(a,e),e}},4276,(a,b,c)=>{let{createClientModuleProxy:d}=a.r(11857);a.n(d("[project]/node_modules/next/dist/client/components/builtin/global-error.js <module evaluation>"))},82509,(a,b,c)=>{let{createClientModuleProxy:d}=a.r(11857);a.n(d("[project]/node_modules/next/dist/client/components/builtin/global-error.js"))},66114,a=>{"use strict";a.i(4276);var b=a.i(82509);a.n(b)}];
|
|
2
|
+
|
|
3
|
+
//# sourceMappingURL=%5Broot-of-the-server%5D__6c8fbc11._.js.map
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
module.exports=[93695,(a,b,c)=>{b.exports=a.x("next/dist/shared/lib/no-fallback-error.external.js",()=>require("next/dist/shared/lib/no-fallback-error.external.js"))},95044,a=>{a.n(a.i(52425))},84951,a=>{a.n(a.i(1022))},70864,a=>{a.n(a.i(33290))},65897,a=>{a.n(a.i(96647))},45538,a=>{a.n(a.i(63588))},43619,a=>{a.n(a.i(79962))},13718,a=>{a.n(a.i(85523))},18198,a=>{a.n(a.i(45518))},62212,a=>{a.n(a.i(66114))},30711,a=>{"use strict";a.s(["default",()=>b]);let b=(0,a.i(11857).registerClientReference)(function(){throw Error("Attempted to call the default export of [project]/app/hooks/hooks-client.tsx <module evaluation> from the server, but it's on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"[project]/app/hooks/hooks-client.tsx <module evaluation>","default")},55836,a=>{"use strict";a.s(["default",()=>b]);let b=(0,a.i(11857).registerClientReference)(function(){throw Error("Attempted to call the default export of [project]/app/hooks/hooks-client.tsx from the server, but it's on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"[project]/app/hooks/hooks-client.tsx","default")},17870,a=>{"use strict";a.i(30711);var b=a.i(55836);a.n(b)},96544,a=>{"use strict";var b=a.i(7997),c=a.i(717),d=a.i(17870);function e(){return(0,b.jsx)(c.Suspense,{children:(0,b.jsx)(d.default,{})})}a.s(["default",()=>e,"dynamic",0,"force-dynamic"])}];
|
|
2
|
+
|
|
3
|
+
//# sourceMappingURL=%5Broot-of-the-server%5D__6fe243c8._.js.map
|