@mcpjam/inspector 3.12.7 → 3.12.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/client/assets/{OAuthDesktopReturnNotice-DUuacpVO.js → OAuthDesktopReturnNotice-DABzFg0y.js} +2 -2
- package/dist/client/assets/{app-bootstrap-DiOYsEwh.js → app-bootstrap-C2vVITe1.js} +11 -11
- package/dist/client/assets/{button-F4pHUjYC.js → button-CR0c6NYb.js} +2 -2
- package/dist/client/assets/{chunk-YOKDWASO-B2XCf4h4.js → chunk-YOKDWASO-C2OuyPZY.js} +5 -5
- package/dist/client/assets/{dead-clicks-autocapture-BAMovRYs.js → dead-clicks-autocapture-DuT1rKSM.js} +2 -2
- package/dist/client/assets/{error-reporting-BrfSwhO1.js → error-reporting-CpBaShLK.js} +3 -3
- package/dist/client/assets/{error-reporting-CWlEVH2b.js → error-reporting-DGKAyE3H.js} +1 -1
- package/dist/client/assets/{exception-autocapture-D5Eikj0K.js → exception-autocapture-DDYbbF4x.js} +2 -2
- package/dist/client/assets/{failed-request-tracker-CYWaDq0H.js → failed-request-tracker-DTcEBfel.js} +2 -2
- package/dist/client/assets/{highlighted-body-KPVGNVTW-BjkaxPPc.js → highlighted-body-KPVGNVTW-BTjtAEXQ.js} +2 -2
- package/dist/client/assets/{index-B-8CVYYi.js → index-Cp_KMvUf.js} +3 -3
- package/dist/client/assets/{jszip.min-BtiG5GuL.js → jszip.min-CUbyF_hU.js} +2 -2
- package/dist/client/assets/{mermaid-HWGCJPDP-CYPKMbVd.js → mermaid-HWGCJPDP-CmCtP4Dv.js} +1 -1
- package/dist/client/assets/{posthog-recorder-D-Nq98cg.js → posthog-recorder-D05rTwSB.js} +2 -2
- package/dist/client/assets/{preload-helper-CC679xXH.js → preload-helper-Bbq9_x_H.js} +2 -2
- package/dist/client/assets/{rolldown-runtime-1PqeXL0B.js → rolldown-runtime-DFaaNfet.js} +1 -1
- package/dist/client/assets/{surveys-olC_pHGU.js → surveys-C6jQxZ__.js} +2 -2
- package/dist/client/assets/{trace-timeline-D2FsrVpF.js → trace-timeline-B4-o8QjE.js} +1 -1
- package/dist/client/assets/{trace-timeline-fl51h9sN.js → trace-timeline-DuWo46vf.js} +2 -2
- package/dist/client/assets/{web-vitals-CIP57d68.js → web-vitals-DGvwJdv7.js} +2 -2
- package/dist/client/index.html +6 -6
- package/dist/server/{chunk-FQTRKEDA.js → chunk-ER75CVTG.js} +2 -2
- package/dist/server/{chunk-76PAQUEP.js → chunk-HHMYIKER.js} +2 -2
- package/dist/server/harness-install-cli.js +1 -1
- package/dist/server/index.js +110 -49
- package/dist/server/{local-turn-3DH4OF7C.js → local-turn-SXHFOZVA.js} +3 -3
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{t as ty}from"./failed-request-tracker-CYWaDq0H.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{};e.SENTRY_RELEASE={id:"3.12.7"};var t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="c113744f-23b8-45ef-97c0-f13709e81261",e._sentryDebugIdIdentifier="sentry-dbid-c113744f-23b8-45ef-97c0-f13709e81261")}catch{}})();var Kx=null,Yx="write",Ju=null,ry=String(101376);function Xx(){return Ju?`https://discord.com/oauth2/authorize?${new URLSearchParams({client_id:Ju,scope:"bot applications.commands",permissions:ry}).toString()}`:null}var ny=["timeout","network","upstream_status","bad_json","bad_payload","provisioning"],iy=/^[A-Z][A-Z0-9_]{1,63}$/;function sy(e){return typeof e=="string"&&ny.includes(e)}function oy(e){if(!e||typeof e!="object")return;const{reason:t,upstreamStatus:r,networkCode:n}=e;if(!sy(t))return;const i={reason:t};return typeof r=="number"&&Number.isInteger(r)&&r>=100&&r<=599&&(i.upstreamStatus=r),typeof n=="string"&&iy.test(n)&&(i.networkCode=n),i}var Jp="mcpjam_guest_session_v1",bc="mcpjam_guest_activated",zo=3e5,bt=null,gr=null,mr=null,Kr=null,Kp=!1,Rr=0,wc=new Set,ay=6e5,In=null,di=null;function Yp(){for(const e of wc)e()}function Xp(e){di!==null&&(clearTimeout(di),di=null),In=e,e&&(di=setTimeout(()=>{di=null,In===e&&Xp(null)},Math.max(0,e.until-Date.now()))),Yp()}function cy(){return In&&In.until<=Date.now()&&(In=null),In}function Uo(e){const t=bt?.guestId??null;bt=e,t!==(bt?.guestId??null)&&Yp()}function Qx(e){return wc.add(e),()=>{wc.delete(e)}}function eM(e){if(e)try{localStorage.getItem(bc)!==e&&localStorage.setItem(bc,e)}catch{}}function tM(e){if(!e)return!1;try{return localStorage.getItem(bc)===e}catch{return!1}}function ly(){if(typeof window>"u")return;const e=window.__MCP_GUEST_BOOTSTRAP__;try{delete window.__MCP_GUEST_BOOTSTRAP__}catch{window.__MCP_GUEST_BOOTSTRAP__=void 0}e&&(typeof e.token!="string"||e.token.length===0||typeof e.expiresAt!="number"||typeof e.guestId!="string"||e.guestId.length===0||e.expiresAt-zo<=Date.now()||(bt={guestId:e.guestId,token:e.token,expiresAt:e.expiresAt}))}ly();function Ll(){if(Kp)return null;try{const e=localStorage.getItem(Jp);if(!e)return null;const t=JSON.parse(e);return typeof t.token=="string"&&t.token.length>0?t.token:null}catch{return null}}function Ku(){try{localStorage.removeItem(Jp)}catch{}Kp=!0}var Ri=class extends Error{status;upstreamFailure;constructor(e,t,r){super(e),this.name="GuestSessionRequestError",this.status=t,this.upstreamFailure=r}},Qp=class extends Ri{retryAfterMs;constructor(e){super("guest-session creation refused (429)"),this.name="GuestSessionRefusedError",this.retryAfterMs=e}},uy=1e3;async function dy(e){if(typeof e.json!="function")return;let t;try{const r=await Promise.race([e.json(),new Promise(n=>{t=setTimeout(()=>n(void 0),uy)})]);return oy(r?.details)}catch{return}finally{t!==void 0&&clearTimeout(t)}}function hy(e){if(!e)return"";const t=e.networkCode??(e.upstreamStatus!==void 0?String(e.upstreamStatus):void 0);return` (${e.reason}${t?` ${t}`:""})`}function py(e){const t=e?Number.parseInt(e,10):NaN;return Number.isFinite(t)&&t>0?t*1e3:ay}async function Dl(e,t){const r={mode:e};t&&(r.legacyToken=t);let n;try{n=await fetch("/api/web/guest-session",{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify(r)})}catch(s){throw new Ri(s instanceof Error?s.message:"network error")}if(n.status===204)return t&&Ku(),null;if(n.status===429)throw new Qp(py(n.headers?.get?.("retry-after")));if(!n.ok){const s=await dy(n);throw new Ri(`guest-session request failed: ${n.status} ${n.statusText}${hy(s)}`,n.status,s)}let i;try{i=await n.json()}catch(s){throw new Ri(`guest-session response was not valid JSON: ${s instanceof Error?s.message:String(s)}`)}if(typeof i?.token!="string"||typeof i?.expiresAt!="number")throw new Ri("guest-session response missing token or expiresAt");return t&&Ku(),i}async function fy(){if(bt&&bt.expiresAt-zo>Date.now())return bt;if(cy())return null;if(gr)return gr;const e=Ll(),t=Rr;let r=Promise.resolve(null);return r=(async()=>{try{const n=await Dl("lookup_or_create",e);return n&&t===Rr&&Uo(n),n}catch(n){if(n instanceof Qp)return Xp({until:Date.now()+n.retryAfterMs}),null;throw console.error("Failed to create guest session:",n),n}finally{gr===r&&(gr=null)}})(),gr=r,r.catch(()=>{}),gr}async function vy(){try{return await fy()}catch{return null}}async function rM(){return(await vy())?.token??null}function Sc(){return bt&&bt.expiresAt-zo>Date.now()?bt:null}async function gy(){if(bt&&bt.expiresAt-zo>Date.now())return bt.token;if(mr)return(await mr)?.token??null;const e=Ll(),t=Rr;let r=Promise.resolve(null);return r=(async()=>{try{const n=await Dl("lookup_only",e);return n&&t===Rr&&Uo(n),n}finally{mr===r&&(mr=null)}})(),mr=r,(await mr)?.token??null}async function nM(){const e=Sc();if(e?.guestId)return e.guestId;try{await gy()}catch{return null}return Sc()?.guestId??null}function my(){Rr+=1,Uo(null),gr=null,mr=null,Kr=null}async function iM(){let e=!1;try{const t=await fetch("/api/web/guest-session/revoke",{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"}});if(t.ok)try{e=(await t.json())?.revoked===!0}catch{e=!1}}catch(t){console.error("Failed to revoke guest session:",t)}finally{my()}return e}async function sM(){try{const e=await fetch("/api/web/guest-session/promotion-proof",{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"}});if(e.status===204||!e.ok)return null;const t=await e.json();return typeof t.token=="string"&&t.token.length>0?t.token:null}catch(e){return console.error("Failed to fetch guest promotion proof:",e),null}}async function _y(){if(Kr)return(await Kr)?.token??null;Rr+=1;const e=Rr;bt=null,gr=null,mr=null,Kr=(async()=>{try{const t=await Dl("lookup_or_create",Ll());return t&&e===Rr&&Uo(t),t}catch(t){throw console.error("Failed to refresh guest session:",t),t}})(),Kr.catch(()=>{});try{return(await Kr)?.token??null}finally{Kr=null}}async function oM(){try{return await _y()}catch{return null}}var aM=Object.freeze({maxObservations:24,maxSummaryChars:400,maxEvidenceRefs:8,maxEvidenceRefChars:200,maxModelIdChars:128,maxVersionChars:64}),cM=Object.freeze({status:"not-requested",reason:"not_requested",detail:"this run did not request model-backed observations, so nothing was charged"});function ef(e){return e.status==="skipped"&&e.skipReason==="could-not-run"}function yy(e){return e.status==="skipped"&&e.skipReason!=="could-not-run"}function by(e){if(e.some(n=>n.status==="failed"))return{outcome:"failed"};const t=e.filter(ef);if(t.length===0)return e.length===0?{outcome:"incomplete",incompleteReason:"no checks were selected, so this run establishes nothing"}:{outcome:"passed"};const r=Array.from(new Set(t.map(n=>n.error?.message??"reason unavailable")));return{outcome:"incomplete",incompleteReason:`${t.length} of ${e.length} selected check(s) could not run, so this run does not establish conformance (${t.map(n=>n.id).join(", ")}): ${r.join(" ")}`}}var wy="2026-08-19",Sy="https://docs.claude.com/en/docs/mcp",Ey=["directory","verification","submission","review-criteria","authentication","lazy-authentication","enterprise-managed-auth","troubleshooting","mcp-apps/cross-compatibility","mcp-apps/external-links","mcp-apps/troubleshooting","mcp-apps/design-guidelines"],ky={},Ry=Ey.map(e=>({page:e,url:`${Sy}/${e}`,revision:ky[e]??null,snapshotDate:wy})),Ay=Object.freeze(Object.fromEntries(Ry.map(e=>[e.page,e])));function hr(e,t){const r=Ay[e];return{page:r.page,section:t,url:r.url,revision:r.revision,snapshotDate:r.snapshotDate}}function tf(e){return e.class==="required"||e.class==="runtime-blocker"}var lM=["runtime-compatibility","directory-policy","optional-features","submission-artifacts","experience-insights"];function Iy(e){return tf(e)}var Ty=["experience"];var Cy=["claude.experience.tool-descriptions-uninformative","claude.experience.tool-overlap","claude.experience.connector-purpose-unclear","claude.experience.consent-scope-unclear","claude.experience.listing-copy-placeholder","claude.experience.destructive-tool-underexplained","claude.experience.app-copy-mismatched"],uM=Object.freeze({readinessKind:"claude-directory-readiness",observationKinds:Ty,knownIds:Cy,schemaVersion:"1"}),$y=[{id:"claude.experience.tool-descriptions-uninformative",title:"Tool descriptions may not tell Claude when to use the tool",lane:"experience-insights",class:"heuristic",source:hr("review-criteria","§Tool quality"),remediation:"Describe when a tool should be reached for, not only what it does; Claude picks tools from these sentences."},{id:"claude.experience.tool-overlap",title:"Two or more tools may cover the same job",lane:"experience-insights",class:"heuristic",source:hr("review-criteria","§Tool quality"),remediation:"Overlapping tools make selection ambiguous; consider merging them or sharpening what separates them."},{id:"claude.experience.connector-purpose-unclear",title:"What this connector is for may not be clear from its surface",lane:"experience-insights",class:"manual-review",source:hr("review-criteria","§Usefulness"),remediation:"A reviewer should be able to say what the connector is for from the listing and the tool names alone."},{id:"claude.experience.consent-scope-unclear",title:"It may not be clear to a user what they are authorizing",lane:"experience-insights",class:"manual-review",source:hr("authentication","§Consent"),remediation:"State which account is connected and what scope it grants, in the copy the user sees at consent time."},{id:"claude.experience.listing-copy-placeholder",title:"Listing copy may still contain placeholder text",lane:"experience-insights",class:"manual-review",source:hr("submission","§Listing"),remediation:"Review the listing fields for template text before submitting; reviewers reject placeholder copy."},{id:"claude.experience.destructive-tool-underexplained",title:"A destructive tool may not explain its consequences",lane:"experience-insights",class:"manual-review",source:hr("review-criteria","§Safety"),remediation:"Say plainly in the description what a destructive tool changes and whether it can be undone."},{id:"claude.experience.app-copy-mismatched",title:"An app's rendered copy may not match what its tool returns",lane:"experience-insights",class:"heuristic",source:hr("mcp-apps/design-guidelines","§Content"),remediation:"A widget that says something different from the tool's text response leaves the model and the user disagreeing."}],dM=Object.freeze({experienceLane:"experience-insights",engineVersion:"1",mappings:$y}),Yu="2026-08-19",eo="https://developers.openai.com/plugins",hM=`${eo}/llms.txt`,pM=`${eo}/changelog`,rf=["quickstart","app-guidelines","reference","changelog","plan/use-case","plan/tools","concepts/plugins","concepts/skills","concepts/ui-guidelines","build/plugins","build/skills","build/mcp-server","build/chatgpt-ui","build/auth","build/monetization","build/examples","deploy/connect-chatgpt","deploy/submission","deploy/submission-errors","deploy/troubleshooting","guides/optimize-metadata","guides/submit-claude-plugin","guides/product-checkout-conversion-spec"],nf=[{page:"help/plugins-in-chatgpt-and-codex",url:"https://help.openai.com/en/articles/20001256-plugins-in-chatgpt-and-codex"},{page:"help/submitting-apps-to-the-chatgpt-app-directory",url:"https://help.openai.com/en/articles/20001040-submitting-apps-to-the-chatgpt-app-directory"}],fM=[...rf,...nf.map(e=>e.page)],Xu={},Py=[...rf.map(e=>({page:e,url:`${eo}/${e}`,revisionUrl:`${eo}/${e}.md`,format:"markdown",revision:Xu[e]??null,snapshotDate:Yu})),...nf.map(e=>({page:e.page,url:e.url,revisionUrl:e.url,format:"html",revision:Xu[e.page]??null,snapshotDate:Yu}))],Oy=Object.freeze(Object.fromEntries(Py.map(e=>[e.page,e])));function jt(e,t){const r=Oy[e];return{page:r.page,section:t,url:r.url,revision:r.revision,snapshotDate:r.snapshotDate}}var vM=["runtime-compatibility","directory-policy","plugin-package","release-contract","optional-features","submission-artifacts","experience-insights"],_n={serverUrl:"serverUrl",pluginBundle:"pluginBundle",submissionProfile:"submissionProfile",draftSnapshot:"draftSnapshot",publishedSnapshot:"publishedSnapshot",toolListing:"toolListing",importedSkills:"importedSkills"},gM=Object.freeze({"skills-only":{hasMcpServer:!1,hasUploadedPackage:!0,hasImportedSkills:!1,requiredInputs:[_n.pluginBundle],summary:"a skills package with no MCP server"},"mcp-only":{hasMcpServer:!0,hasUploadedPackage:!1,hasImportedSkills:!1,requiredInputs:[_n.serverUrl],summary:"an MCP endpoint with no uploaded package"},"mcp-imported-skills":{hasMcpServer:!0,hasUploadedPackage:!1,hasImportedSkills:!0,requiredInputs:[_n.serverUrl,_n.importedSkills],summary:"an MCP endpoint whose skills are imported at scan time"},"mcp-uploaded-skills":{hasMcpServer:!0,hasUploadedPackage:!0,hasImportedSkills:!1,requiredInputs:[_n.serverUrl,_n.pluginBundle],summary:"an MCP endpoint plus an uploaded skills package"}}),mM=Object.freeze({"technical-preflight":["runtime-compatibility","directory-policy","plugin-package"],"submission-ready":["runtime-compatibility","directory-policy","plugin-package","submission-artifacts","release-contract"]});function xy(e){return typeof e=="object"&&e!==null&&e.readinessKind==="openai-directory-readiness"}var My=["experience"];var Ly=["openai.experience.tool-descriptions-uninformative","openai.experience.tool-overlap","openai.experience.naming-inconsistent","openai.experience.listing-copy-placeholder","openai.experience.listing-copy-overpromises","openai.experience.skill-overlap","openai.experience.destructive-tool-underexplained","openai.experience.auth-story-unclear"],_M=Object.freeze({readinessKind:"openai-directory-readiness",observationKinds:My,knownIds:Ly,schemaVersion:"1"}),Dy=[{id:"openai.experience.tool-descriptions-uninformative",title:"Tool descriptions may not tell the model when to use the tool",lane:"experience-insights",class:"heuristic",source:jt("guides/optimize-metadata","§Tool descriptions"),remediation:"Describe when a tool should be reached for, not only what it does; the model picks tools from these sentences."},{id:"openai.experience.tool-overlap",title:"Two or more tools may cover the same job",lane:"experience-insights",class:"heuristic",source:jt("plan/tools","§Naming"),remediation:"Overlapping tools make selection ambiguous; consider merging them or sharpening the descriptions that separate them."},{id:"openai.experience.naming-inconsistent",title:"Tool names may not follow one convention",lane:"experience-insights",class:"heuristic",source:jt("plan/tools","§Naming"),remediation:"Pick one naming convention across the whole surface; mixed conventions read as two servers merged."},{id:"openai.experience.listing-copy-placeholder",title:"Listing copy may still contain placeholder text",lane:"experience-insights",class:"manual-review",source:jt("app-guidelines","§Listing quality"),remediation:"Review the listing fields for template text before submitting; reviewers reject placeholder copy."},{id:"openai.experience.listing-copy-overpromises",title:"Listing copy may claim capabilities the tools do not implement",lane:"experience-insights",class:"manual-review",source:jt("app-guidelines","§Listing quality"),remediation:"Check that every capability the listing advertises is reachable through a tool this server actually exposes."},{id:"openai.experience.skill-overlap",title:"Two or more skills may describe the same task",lane:"experience-insights",class:"heuristic",source:jt("app-guidelines","§Listing quality"),remediation:"Skills that overlap compete for the same trigger; separate their scopes or fold them together."},{id:"openai.experience.destructive-tool-underexplained",title:"A destructive tool may not explain its consequences",lane:"experience-insights",class:"manual-review",source:jt("app-guidelines","§Predictable side effects"),remediation:"Say plainly in the description what a destructive tool changes and whether it can be undone."},{id:"openai.experience.auth-story-unclear",title:"It may not be clear to a user what they are authorizing",lane:"experience-insights",class:"manual-review",source:jt("build/auth","§Consent"),remediation:"State which account is connected and what scope it grants, in the copy the user sees at consent time."}],yM=Object.freeze({experienceLane:"experience-insights",engineVersion:"2",mappings:Dy}),Ny=["https://claude.ai/api/mcp/auth_callback","https://claude.com/api/mcp/auth_callback"];var zy=".claudemcpcontent.com";var Uy="text/html;profile=mcp-app",Fy={toolListingMs:5e3,handshakeMs:3e3,widgetFirstPaintMs:3e3},qy={minViewportWidthPx:320,minTouchTargetPx:44},pr={nameMaxLength:100,taglineMaxLength:55,descriptionMaxLength:2e3,categoriesMin:1,categoriesMax:5,screenshotsMin:3,screenshotsMax:5,screenshotMinWidthPx:1e3,toolNameMaxLength:64},bM={callbackUrls:Ny,loopbackRedirectIgnoresPort:!0,appContentDomainSuffix:zy,appContentDomainHashLength:32,appHtmlMime:Uy,latencyBudgets:Fy,appDesignBudgets:qy,submissionLimits:pr,source:hr("directory","Host profile constants")},wM=Object.freeze({status:"aborted"});function x(e,t,r){function n(a,c){if(a._zod||Object.defineProperty(a,"_zod",{value:{def:c,constr:o,traits:new Set},enumerable:!1}),a._zod.traits.has(e))return;a._zod.traits.add(e),t(a,c);const l=o.prototype,u=Object.keys(l);for(let h=0;h<u.length;h++){const d=u[h];d in a||(a[d]=l[d].bind(a))}}const i=r?.Parent??Object;class s extends i{}Object.defineProperty(s,"name",{value:e});function o(a){var c;const l=r?.Parent?new s:this;n(l,a),(c=l._zod).deferred??(c.deferred=[]);for(const u of l._zod.deferred)u();return l}return Object.defineProperty(o,"init",{value:n}),Object.defineProperty(o,Symbol.hasInstance,{value:a=>r?.Parent&&a instanceof r.Parent?!0:a?._zod?.traits?.has(e)}),Object.defineProperty(o,"name",{value:e}),o}var zn=class extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}},sf=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name="ZodEncodeError"}},Ec={};function Pr(e){return e&&Object.assign(Ec,e),Ec}function of(e){const t=Object.values(e).filter(r=>typeof r=="number");return Object.entries(e).filter(([r,n])=>t.indexOf(+r)===-1).map(([r,n])=>n)}function kc(e,t){return typeof t=="bigint"?t.toString():t}function Fo(e){return{get value(){{const t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function Nl(e){return e==null}function zl(e){const t=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}function jy(e,t){const r=(e.toString().split(".")[1]||"").length,n=t.toString();let i=(n.split(".")[1]||"").length;if(i===0&&/\d?e-\d?/.test(n)){const o=n.match(/\d?e-(\d?)/);o?.[1]&&(i=Number.parseInt(o[1]))}const s=r>i?r:i;return Number.parseInt(e.toFixed(s).replace(".",""))%Number.parseInt(t.toFixed(s).replace(".",""))/10**s}var Qu=Symbol("evaluating");function Ae(e,t,r){let n;Object.defineProperty(e,t,{get(){if(n!==Qu)return n===void 0&&(n=Qu,n=r()),n},set(i){Object.defineProperty(e,t,{value:i})},configurable:!0})}function gn(e,t,r){Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}function jr(...e){const t={};for(const r of e){const n=Object.getOwnPropertyDescriptors(r);Object.assign(t,n)}return Object.defineProperties({},t)}function ed(e){return JSON.stringify(e)}function Hy(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}var af="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function Gi(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}var Vy=Fo(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return new Function(""),!0}catch{return!1}});function Bn(e){if(Gi(e)===!1)return!1;const t=e.constructor;if(t===void 0||typeof t!="function")return!0;const r=t.prototype;return!(Gi(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}function cf(e){return Bn(e)?{...e}:Array.isArray(e)?[...e]:e}var By=new Set(["string","number","symbol"]);function Gn(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function lr(e,t,r){const n=new e._zod.constr(t??e._zod.def);return(!t||r?.parent)&&(n._zod.parent=e),n}function re(e){const t=e;if(!t)return{};if(typeof t=="string")return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error=="string"?{...t,error:()=>t.error}:t}function Gy(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}var Wy={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function Zy(e,t){const r=e._zod.def,n=r.checks;if(n&&n.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");return lr(e,jr(e._zod.def,{get shape(){const i={};for(const s in t){if(!(s in r.shape))throw new Error(`Unrecognized key: "${s}"`);t[s]&&(i[s]=r.shape[s])}return gn(this,"shape",i),i},checks:[]}))}function Jy(e,t){const r=e._zod.def,n=r.checks;if(n&&n.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");return lr(e,jr(e._zod.def,{get shape(){const i={...e._zod.def.shape};for(const s in t){if(!(s in r.shape))throw new Error(`Unrecognized key: "${s}"`);t[s]&&delete i[s]}return gn(this,"shape",i),i},checks:[]}))}function Ky(e,t){if(!Bn(t))throw new Error("Invalid input to extend: expected a plain object");const r=e._zod.def.checks;if(r&&r.length>0){const n=e._zod.def.shape;for(const i in t)if(Object.getOwnPropertyDescriptor(n,i)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return lr(e,jr(e._zod.def,{get shape(){const n={...e._zod.def.shape,...t};return gn(this,"shape",n),n}}))}function Yy(e,t){if(!Bn(t))throw new Error("Invalid input to safeExtend: expected a plain object");return lr(e,jr(e._zod.def,{get shape(){const r={...e._zod.def.shape,...t};return gn(this,"shape",r),r}}))}function Xy(e,t){return lr(e,jr(e._zod.def,{get shape(){const r={...e._zod.def.shape,...t._zod.def.shape};return gn(this,"shape",r),r},get catchall(){return t._zod.def.catchall},checks:[]}))}function Qy(e,t,r){const n=t._zod.def.checks;if(n&&n.length>0)throw new Error(".partial() cannot be used on object schemas containing refinements");return lr(t,jr(t._zod.def,{get shape(){const i=t._zod.def.shape,s={...i};if(r)for(const o in r){if(!(o in i))throw new Error(`Unrecognized key: "${o}"`);r[o]&&(s[o]=e?new e({type:"optional",innerType:i[o]}):i[o])}else for(const o in i)s[o]=e?new e({type:"optional",innerType:i[o]}):i[o];return gn(this,"shape",s),s},checks:[]}))}function e0(e,t,r){return lr(t,jr(t._zod.def,{get shape(){const n=t._zod.def.shape,i={...n};if(r)for(const s in r){if(!(s in i))throw new Error(`Unrecognized key: "${s}"`);r[s]&&(i[s]=new e({type:"nonoptional",innerType:n[s]}))}else for(const s in n)i[s]=new e({type:"nonoptional",innerType:n[s]});return gn(this,"shape",i),i}}))}function Tn(e,t=0){if(e.aborted===!0)return!0;for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue!==!0)return!0;return!1}function nn(e,t){return t.map(r=>{var n;return(n=r).path??(n.path=[]),r.path.unshift(e),r})}function vs(e){return typeof e=="string"?e:e?.message}function Or(e,t,r){const n={...e,path:e.path??[]};return e.message||(n.message=vs(e.inst?._zod.def?.error?.(e))??vs(t?.error?.(e))??vs(r.customError?.(e))??vs(r.localeError?.(e))??"Invalid input"),delete n.inst,delete n.continue,t?.reportInput||delete n.input,n}function Ul(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function Wi(...e){const[t,r,n]=e;return typeof t=="string"?{message:t,code:"custom",input:r,inst:n}:{...t}}var lf=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,kc,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},uf=x("$ZodError",lf),df=x("$ZodError",lf,{Parent:Error});function t0(e,t=r=>r.message){const r={},n=[];for(const i of e.issues)i.path.length>0?(r[i.path[0]]=r[i.path[0]]||[],r[i.path[0]].push(t(i))):n.push(t(i));return{formErrors:n,fieldErrors:r}}function r0(e,t=r=>r.message){const r={_errors:[]},n=i=>{for(const s of i.issues)if(s.code==="invalid_union"&&s.errors.length)s.errors.map(o=>n({issues:o}));else if(s.code==="invalid_key")n({issues:s.issues});else if(s.code==="invalid_element")n({issues:s.issues});else if(s.path.length===0)r._errors.push(t(s));else{let o=r,a=0;for(;a<s.path.length;){const c=s.path[a];a!==s.path.length-1?o[c]=o[c]||{_errors:[]}:(o[c]=o[c]||{_errors:[]},o[c]._errors.push(t(s))),o=o[c],a++}}};return n(e),r}var Fl=e=>(t,r,n,i)=>{const s=n?Object.assign(n,{async:!1}):{async:!1},o=t._zod.run({value:r,issues:[]},s);if(o instanceof Promise)throw new zn;if(o.issues.length){const a=new(i?.Err??e)(o.issues.map(c=>Or(c,s,Pr())));throw af(a,i?.callee),a}return o.value},ql=e=>async(t,r,n,i)=>{const s=n?Object.assign(n,{async:!0}):{async:!0};let o=t._zod.run({value:r,issues:[]},s);if(o instanceof Promise&&(o=await o),o.issues.length){const a=new(i?.Err??e)(o.issues.map(c=>Or(c,s,Pr())));throw af(a,i?.callee),a}return o.value},qo=e=>(t,r,n)=>{const i=n?{...n,async:!1}:{async:!1},s=t._zod.run({value:r,issues:[]},i);if(s instanceof Promise)throw new zn;return s.issues.length?{success:!1,error:new(e??uf)(s.issues.map(o=>Or(o,i,Pr())))}:{success:!0,data:s.value}},n0=qo(df),jo=e=>async(t,r,n)=>{const i=n?Object.assign(n,{async:!0}):{async:!0};let s=t._zod.run({value:r,issues:[]},i);return s instanceof Promise&&(s=await s),s.issues.length?{success:!1,error:new e(s.issues.map(o=>Or(o,i,Pr())))}:{success:!0,data:s.value}},i0=jo(df),s0=e=>(t,r,n)=>{const i=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return Fl(e)(t,r,i)},o0=e=>(t,r,n)=>Fl(e)(t,r,n),a0=e=>async(t,r,n)=>{const i=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return ql(e)(t,r,i)},c0=e=>async(t,r,n)=>ql(e)(t,r,n),l0=e=>(t,r,n)=>{const i=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return qo(e)(t,r,i)},u0=e=>(t,r,n)=>qo(e)(t,r,n),d0=e=>async(t,r,n)=>{const i=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return jo(e)(t,r,i)},h0=e=>async(t,r,n)=>jo(e)(t,r,n),p0=/^[cC][^\s-]{8,}$/,f0=/^[0-9a-z]+$/,v0=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,g0=/^[0-9a-vA-V]{20}$/,m0=/^[A-Za-z0-9]{27}$/,_0=/^[a-zA-Z0-9_-]{21}$/,y0=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,b0=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,td=e=>e?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,w0=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,S0="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function E0(){return new RegExp(S0,"u")}var k0=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,R0=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,A0=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,I0=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,T0=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,hf=/^[A-Za-z0-9_-]*$/,C0=/^\+[1-9]\d{6,14}$/,pf="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))",$0=new RegExp(`^${pf}$`);function ff(e){const t="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof e.precision=="number"?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function P0(e){return new RegExp(`^${ff(e)}$`)}function O0(e){const t=ff({precision:e.precision}),r=["Z"];e.local&&r.push(""),e.offset&&r.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");const n=`${t}(?:${r.join("|")})`;return new RegExp(`^${pf}T(?:${n})$`)}var x0=e=>{const t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},M0=/^-?\d+$/,vf=/^-?\d+(?:\.\d+)?$/,L0=/^(?:true|false)$/i,D0=/^null$/i,N0=/^undefined$/i,z0=/^[^A-Z]*$/,U0=/^[^a-z]*$/,wt=x("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])}),gf={number:"number",bigint:"bigint",object:"date"},mf=x("$ZodCheckLessThan",(e,t)=>{wt.init(e,t);const r=gf[typeof t.value];e._zod.onattach.push(n=>{const i=n._zod.bag,s=(t.inclusive?i.maximum:i.exclusiveMaximum)??Number.POSITIVE_INFINITY;t.value<s&&(t.inclusive?i.maximum=t.value:i.exclusiveMaximum=t.value)}),e._zod.check=n=>{(t.inclusive?n.value<=t.value:n.value<t.value)||n.issues.push({origin:r,code:"too_big",maximum:typeof t.value=="object"?t.value.getTime():t.value,input:n.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),_f=x("$ZodCheckGreaterThan",(e,t)=>{wt.init(e,t);const r=gf[typeof t.value];e._zod.onattach.push(n=>{const i=n._zod.bag,s=(t.inclusive?i.minimum:i.exclusiveMinimum)??Number.NEGATIVE_INFINITY;t.value>s&&(t.inclusive?i.minimum=t.value:i.exclusiveMinimum=t.value)}),e._zod.check=n=>{(t.inclusive?n.value>=t.value:n.value>t.value)||n.issues.push({origin:r,code:"too_small",minimum:typeof t.value=="object"?t.value.getTime():t.value,input:n.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),F0=x("$ZodCheckMultipleOf",(e,t)=>{wt.init(e,t),e._zod.onattach.push(r=>{var n;(n=r._zod.bag).multipleOf??(n.multipleOf=t.value)}),e._zod.check=r=>{if(typeof r.value!=typeof t.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof r.value=="bigint"?r.value%t.value===BigInt(0):jy(r.value,t.value)===0)||r.issues.push({origin:typeof r.value,code:"not_multiple_of",divisor:t.value,input:r.value,inst:e,continue:!t.abort})}}),q0=x("$ZodCheckNumberFormat",(e,t)=>{wt.init(e,t),t.format=t.format||"float64";const r=t.format?.includes("int"),n=r?"int":"number",[i,s]=Wy[t.format];e._zod.onattach.push(o=>{const a=o._zod.bag;a.format=t.format,a.minimum=i,a.maximum=s,r&&(a.pattern=M0)}),e._zod.check=o=>{const a=o.value;if(r){if(!Number.isInteger(a)){o.issues.push({expected:n,format:t.format,code:"invalid_type",continue:!1,input:a,inst:e});return}if(!Number.isSafeInteger(a)){a>0?o.issues.push({input:a,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:n,inclusive:!0,continue:!t.abort}):o.issues.push({input:a,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:n,inclusive:!0,continue:!t.abort});return}}a<i&&o.issues.push({origin:"number",input:a,code:"too_small",minimum:i,inclusive:!0,inst:e,continue:!t.abort}),a>s&&o.issues.push({origin:"number",input:a,code:"too_big",maximum:s,inclusive:!0,inst:e,continue:!t.abort})}}),j0=x("$ZodCheckMaxLength",(e,t)=>{var r;wt.init(e,t),(r=e._zod.def).when??(r.when=n=>{const i=n.value;return!Nl(i)&&i.length!==void 0}),e._zod.onattach.push(n=>{const i=n._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<i&&(n._zod.bag.maximum=t.maximum)}),e._zod.check=n=>{const i=n.value;if(i.length<=t.maximum)return;const s=Ul(i);n.issues.push({origin:s,code:"too_big",maximum:t.maximum,inclusive:!0,input:i,inst:e,continue:!t.abort})}}),H0=x("$ZodCheckMinLength",(e,t)=>{var r;wt.init(e,t),(r=e._zod.def).when??(r.when=n=>{const i=n.value;return!Nl(i)&&i.length!==void 0}),e._zod.onattach.push(n=>{const i=n._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>i&&(n._zod.bag.minimum=t.minimum)}),e._zod.check=n=>{const i=n.value;if(i.length>=t.minimum)return;const s=Ul(i);n.issues.push({origin:s,code:"too_small",minimum:t.minimum,inclusive:!0,input:i,inst:e,continue:!t.abort})}}),V0=x("$ZodCheckLengthEquals",(e,t)=>{var r;wt.init(e,t),(r=e._zod.def).when??(r.when=n=>{const i=n.value;return!Nl(i)&&i.length!==void 0}),e._zod.onattach.push(n=>{const i=n._zod.bag;i.minimum=t.length,i.maximum=t.length,i.length=t.length}),e._zod.check=n=>{const i=n.value,s=i.length;if(s===t.length)return;const o=Ul(i),a=s>t.length;n.issues.push({origin:o,...a?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),Ho=x("$ZodCheckStringFormat",(e,t)=>{var r,n;wt.init(e,t),e._zod.onattach.push(i=>{const s=i._zod.bag;s.format=t.format,t.pattern&&(s.patterns??(s.patterns=new Set),s.patterns.add(t.pattern))}),t.pattern?(r=e._zod).check??(r.check=i=>{t.pattern.lastIndex=0,!t.pattern.test(i.value)&&i.issues.push({origin:"string",code:"invalid_format",format:t.format,input:i.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(n=e._zod).check??(n.check=()=>{})}),B0=x("$ZodCheckRegex",(e,t)=>{Ho.init(e,t),e._zod.check=r=>{t.pattern.lastIndex=0,!t.pattern.test(r.value)&&r.issues.push({origin:"string",code:"invalid_format",format:"regex",input:r.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),G0=x("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=z0),Ho.init(e,t)}),W0=x("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=U0),Ho.init(e,t)}),Z0=x("$ZodCheckIncludes",(e,t)=>{wt.init(e,t);const r=Gn(t.includes),n=new RegExp(typeof t.position=="number"?`^.{${t.position}}${r}`:r);t.pattern=n,e._zod.onattach.push(i=>{const s=i._zod.bag;s.patterns??(s.patterns=new Set),s.patterns.add(n)}),e._zod.check=i=>{i.value.includes(t.includes,t.position)||i.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:i.value,inst:e,continue:!t.abort})}}),J0=x("$ZodCheckStartsWith",(e,t)=>{wt.init(e,t);const r=new RegExp(`^${Gn(t.prefix)}.*`);t.pattern??(t.pattern=r),e._zod.onattach.push(n=>{const i=n._zod.bag;i.patterns??(i.patterns=new Set),i.patterns.add(r)}),e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),K0=x("$ZodCheckEndsWith",(e,t)=>{wt.init(e,t);const r=new RegExp(`.*${Gn(t.suffix)}$`);t.pattern??(t.pattern=r),e._zod.onattach.push(n=>{const i=n._zod.bag;i.patterns??(i.patterns=new Set),i.patterns.add(r)}),e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}}),Y0=x("$ZodCheckOverwrite",(e,t)=>{wt.init(e,t),e._zod.check=r=>{r.value=t.tx(r.value)}}),X0=class{constructor(e=[]){this.content=[],this.indent=0,this&&(this.args=e)}indented(e){this.indent+=1,e(this),this.indent-=1}write(e){if(typeof e=="function"){e(this,{execution:"sync"}),e(this,{execution:"async"});return}const t=e.split(`
|
|
1
|
+
import{t as ty}from"./failed-request-tracker-DTcEBfel.js";(function(){try{var e=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{};e.SENTRY_RELEASE={id:"3.12.8"};var t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="aac458df-6627-41ad-a0ce-0c260116a2e2",e._sentryDebugIdIdentifier="sentry-dbid-aac458df-6627-41ad-a0ce-0c260116a2e2")}catch{}})();var Kx=null,Yx="write",Ju=null,ry=String(101376);function Xx(){return Ju?`https://discord.com/oauth2/authorize?${new URLSearchParams({client_id:Ju,scope:"bot applications.commands",permissions:ry}).toString()}`:null}var ny=["timeout","network","upstream_status","bad_json","bad_payload","provisioning"],iy=/^[A-Z][A-Z0-9_]{1,63}$/;function sy(e){return typeof e=="string"&&ny.includes(e)}function oy(e){if(!e||typeof e!="object")return;const{reason:t,upstreamStatus:r,networkCode:n}=e;if(!sy(t))return;const i={reason:t};return typeof r=="number"&&Number.isInteger(r)&&r>=100&&r<=599&&(i.upstreamStatus=r),typeof n=="string"&&iy.test(n)&&(i.networkCode=n),i}var Jp="mcpjam_guest_session_v1",bc="mcpjam_guest_activated",zo=3e5,bt=null,gr=null,mr=null,Kr=null,Kp=!1,Rr=0,wc=new Set,ay=6e5,In=null,di=null;function Yp(){for(const e of wc)e()}function Xp(e){di!==null&&(clearTimeout(di),di=null),In=e,e&&(di=setTimeout(()=>{di=null,In===e&&Xp(null)},Math.max(0,e.until-Date.now()))),Yp()}function cy(){return In&&In.until<=Date.now()&&(In=null),In}function Uo(e){const t=bt?.guestId??null;bt=e,t!==(bt?.guestId??null)&&Yp()}function Qx(e){return wc.add(e),()=>{wc.delete(e)}}function eM(e){if(e)try{localStorage.getItem(bc)!==e&&localStorage.setItem(bc,e)}catch{}}function tM(e){if(!e)return!1;try{return localStorage.getItem(bc)===e}catch{return!1}}function ly(){if(typeof window>"u")return;const e=window.__MCP_GUEST_BOOTSTRAP__;try{delete window.__MCP_GUEST_BOOTSTRAP__}catch{window.__MCP_GUEST_BOOTSTRAP__=void 0}e&&(typeof e.token!="string"||e.token.length===0||typeof e.expiresAt!="number"||typeof e.guestId!="string"||e.guestId.length===0||e.expiresAt-zo<=Date.now()||(bt={guestId:e.guestId,token:e.token,expiresAt:e.expiresAt}))}ly();function Ll(){if(Kp)return null;try{const e=localStorage.getItem(Jp);if(!e)return null;const t=JSON.parse(e);return typeof t.token=="string"&&t.token.length>0?t.token:null}catch{return null}}function Ku(){try{localStorage.removeItem(Jp)}catch{}Kp=!0}var Ri=class extends Error{status;upstreamFailure;constructor(e,t,r){super(e),this.name="GuestSessionRequestError",this.status=t,this.upstreamFailure=r}},Qp=class extends Ri{retryAfterMs;constructor(e){super("guest-session creation refused (429)"),this.name="GuestSessionRefusedError",this.retryAfterMs=e}},uy=1e3;async function dy(e){if(typeof e.json!="function")return;let t;try{const r=await Promise.race([e.json(),new Promise(n=>{t=setTimeout(()=>n(void 0),uy)})]);return oy(r?.details)}catch{return}finally{t!==void 0&&clearTimeout(t)}}function hy(e){if(!e)return"";const t=e.networkCode??(e.upstreamStatus!==void 0?String(e.upstreamStatus):void 0);return` (${e.reason}${t?` ${t}`:""})`}function py(e){const t=e?Number.parseInt(e,10):NaN;return Number.isFinite(t)&&t>0?t*1e3:ay}async function Dl(e,t){const r={mode:e};t&&(r.legacyToken=t);let n;try{n=await fetch("/api/web/guest-session",{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"},body:JSON.stringify(r)})}catch(s){throw new Ri(s instanceof Error?s.message:"network error")}if(n.status===204)return t&&Ku(),null;if(n.status===429)throw new Qp(py(n.headers?.get?.("retry-after")));if(!n.ok){const s=await dy(n);throw new Ri(`guest-session request failed: ${n.status} ${n.statusText}${hy(s)}`,n.status,s)}let i;try{i=await n.json()}catch(s){throw new Ri(`guest-session response was not valid JSON: ${s instanceof Error?s.message:String(s)}`)}if(typeof i?.token!="string"||typeof i?.expiresAt!="number")throw new Ri("guest-session response missing token or expiresAt");return t&&Ku(),i}async function fy(){if(bt&&bt.expiresAt-zo>Date.now())return bt;if(cy())return null;if(gr)return gr;const e=Ll(),t=Rr;let r=Promise.resolve(null);return r=(async()=>{try{const n=await Dl("lookup_or_create",e);return n&&t===Rr&&Uo(n),n}catch(n){if(n instanceof Qp)return Xp({until:Date.now()+n.retryAfterMs}),null;throw console.error("Failed to create guest session:",n),n}finally{gr===r&&(gr=null)}})(),gr=r,r.catch(()=>{}),gr}async function vy(){try{return await fy()}catch{return null}}async function rM(){return(await vy())?.token??null}function Sc(){return bt&&bt.expiresAt-zo>Date.now()?bt:null}async function gy(){if(bt&&bt.expiresAt-zo>Date.now())return bt.token;if(mr)return(await mr)?.token??null;const e=Ll(),t=Rr;let r=Promise.resolve(null);return r=(async()=>{try{const n=await Dl("lookup_only",e);return n&&t===Rr&&Uo(n),n}finally{mr===r&&(mr=null)}})(),mr=r,(await mr)?.token??null}async function nM(){const e=Sc();if(e?.guestId)return e.guestId;try{await gy()}catch{return null}return Sc()?.guestId??null}function my(){Rr+=1,Uo(null),gr=null,mr=null,Kr=null}async function iM(){let e=!1;try{const t=await fetch("/api/web/guest-session/revoke",{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"}});if(t.ok)try{e=(await t.json())?.revoked===!0}catch{e=!1}}catch(t){console.error("Failed to revoke guest session:",t)}finally{my()}return e}async function sM(){try{const e=await fetch("/api/web/guest-session/promotion-proof",{method:"POST",credentials:"include",headers:{"Content-Type":"application/json"}});if(e.status===204||!e.ok)return null;const t=await e.json();return typeof t.token=="string"&&t.token.length>0?t.token:null}catch(e){return console.error("Failed to fetch guest promotion proof:",e),null}}async function _y(){if(Kr)return(await Kr)?.token??null;Rr+=1;const e=Rr;bt=null,gr=null,mr=null,Kr=(async()=>{try{const t=await Dl("lookup_or_create",Ll());return t&&e===Rr&&Uo(t),t}catch(t){throw console.error("Failed to refresh guest session:",t),t}})(),Kr.catch(()=>{});try{return(await Kr)?.token??null}finally{Kr=null}}async function oM(){try{return await _y()}catch{return null}}var aM=Object.freeze({maxObservations:24,maxSummaryChars:400,maxEvidenceRefs:8,maxEvidenceRefChars:200,maxModelIdChars:128,maxVersionChars:64}),cM=Object.freeze({status:"not-requested",reason:"not_requested",detail:"this run did not request model-backed observations, so nothing was charged"});function ef(e){return e.status==="skipped"&&e.skipReason==="could-not-run"}function yy(e){return e.status==="skipped"&&e.skipReason!=="could-not-run"}function by(e){if(e.some(n=>n.status==="failed"))return{outcome:"failed"};const t=e.filter(ef);if(t.length===0)return e.length===0?{outcome:"incomplete",incompleteReason:"no checks were selected, so this run establishes nothing"}:{outcome:"passed"};const r=Array.from(new Set(t.map(n=>n.error?.message??"reason unavailable")));return{outcome:"incomplete",incompleteReason:`${t.length} of ${e.length} selected check(s) could not run, so this run does not establish conformance (${t.map(n=>n.id).join(", ")}): ${r.join(" ")}`}}var wy="2026-08-19",Sy="https://docs.claude.com/en/docs/mcp",Ey=["directory","verification","submission","review-criteria","authentication","lazy-authentication","enterprise-managed-auth","troubleshooting","mcp-apps/cross-compatibility","mcp-apps/external-links","mcp-apps/troubleshooting","mcp-apps/design-guidelines"],ky={},Ry=Ey.map(e=>({page:e,url:`${Sy}/${e}`,revision:ky[e]??null,snapshotDate:wy})),Ay=Object.freeze(Object.fromEntries(Ry.map(e=>[e.page,e])));function hr(e,t){const r=Ay[e];return{page:r.page,section:t,url:r.url,revision:r.revision,snapshotDate:r.snapshotDate}}function tf(e){return e.class==="required"||e.class==="runtime-blocker"}var lM=["runtime-compatibility","directory-policy","optional-features","submission-artifacts","experience-insights"];function Iy(e){return tf(e)}var Ty=["experience"];var Cy=["claude.experience.tool-descriptions-uninformative","claude.experience.tool-overlap","claude.experience.connector-purpose-unclear","claude.experience.consent-scope-unclear","claude.experience.listing-copy-placeholder","claude.experience.destructive-tool-underexplained","claude.experience.app-copy-mismatched"],uM=Object.freeze({readinessKind:"claude-directory-readiness",observationKinds:Ty,knownIds:Cy,schemaVersion:"1"}),$y=[{id:"claude.experience.tool-descriptions-uninformative",title:"Tool descriptions may not tell Claude when to use the tool",lane:"experience-insights",class:"heuristic",source:hr("review-criteria","§Tool quality"),remediation:"Describe when a tool should be reached for, not only what it does; Claude picks tools from these sentences."},{id:"claude.experience.tool-overlap",title:"Two or more tools may cover the same job",lane:"experience-insights",class:"heuristic",source:hr("review-criteria","§Tool quality"),remediation:"Overlapping tools make selection ambiguous; consider merging them or sharpening what separates them."},{id:"claude.experience.connector-purpose-unclear",title:"What this connector is for may not be clear from its surface",lane:"experience-insights",class:"manual-review",source:hr("review-criteria","§Usefulness"),remediation:"A reviewer should be able to say what the connector is for from the listing and the tool names alone."},{id:"claude.experience.consent-scope-unclear",title:"It may not be clear to a user what they are authorizing",lane:"experience-insights",class:"manual-review",source:hr("authentication","§Consent"),remediation:"State which account is connected and what scope it grants, in the copy the user sees at consent time."},{id:"claude.experience.listing-copy-placeholder",title:"Listing copy may still contain placeholder text",lane:"experience-insights",class:"manual-review",source:hr("submission","§Listing"),remediation:"Review the listing fields for template text before submitting; reviewers reject placeholder copy."},{id:"claude.experience.destructive-tool-underexplained",title:"A destructive tool may not explain its consequences",lane:"experience-insights",class:"manual-review",source:hr("review-criteria","§Safety"),remediation:"Say plainly in the description what a destructive tool changes and whether it can be undone."},{id:"claude.experience.app-copy-mismatched",title:"An app's rendered copy may not match what its tool returns",lane:"experience-insights",class:"heuristic",source:hr("mcp-apps/design-guidelines","§Content"),remediation:"A widget that says something different from the tool's text response leaves the model and the user disagreeing."}],dM=Object.freeze({experienceLane:"experience-insights",engineVersion:"1",mappings:$y}),Yu="2026-08-19",eo="https://developers.openai.com/plugins",hM=`${eo}/llms.txt`,pM=`${eo}/changelog`,rf=["quickstart","app-guidelines","reference","changelog","plan/use-case","plan/tools","concepts/plugins","concepts/skills","concepts/ui-guidelines","build/plugins","build/skills","build/mcp-server","build/chatgpt-ui","build/auth","build/monetization","build/examples","deploy/connect-chatgpt","deploy/submission","deploy/submission-errors","deploy/troubleshooting","guides/optimize-metadata","guides/submit-claude-plugin","guides/product-checkout-conversion-spec"],nf=[{page:"help/plugins-in-chatgpt-and-codex",url:"https://help.openai.com/en/articles/20001256-plugins-in-chatgpt-and-codex"},{page:"help/submitting-apps-to-the-chatgpt-app-directory",url:"https://help.openai.com/en/articles/20001040-submitting-apps-to-the-chatgpt-app-directory"}],fM=[...rf,...nf.map(e=>e.page)],Xu={},Py=[...rf.map(e=>({page:e,url:`${eo}/${e}`,revisionUrl:`${eo}/${e}.md`,format:"markdown",revision:Xu[e]??null,snapshotDate:Yu})),...nf.map(e=>({page:e.page,url:e.url,revisionUrl:e.url,format:"html",revision:Xu[e.page]??null,snapshotDate:Yu}))],Oy=Object.freeze(Object.fromEntries(Py.map(e=>[e.page,e])));function jt(e,t){const r=Oy[e];return{page:r.page,section:t,url:r.url,revision:r.revision,snapshotDate:r.snapshotDate}}var vM=["runtime-compatibility","directory-policy","plugin-package","release-contract","optional-features","submission-artifacts","experience-insights"],_n={serverUrl:"serverUrl",pluginBundle:"pluginBundle",submissionProfile:"submissionProfile",draftSnapshot:"draftSnapshot",publishedSnapshot:"publishedSnapshot",toolListing:"toolListing",importedSkills:"importedSkills"},gM=Object.freeze({"skills-only":{hasMcpServer:!1,hasUploadedPackage:!0,hasImportedSkills:!1,requiredInputs:[_n.pluginBundle],summary:"a skills package with no MCP server"},"mcp-only":{hasMcpServer:!0,hasUploadedPackage:!1,hasImportedSkills:!1,requiredInputs:[_n.serverUrl],summary:"an MCP endpoint with no uploaded package"},"mcp-imported-skills":{hasMcpServer:!0,hasUploadedPackage:!1,hasImportedSkills:!0,requiredInputs:[_n.serverUrl,_n.importedSkills],summary:"an MCP endpoint whose skills are imported at scan time"},"mcp-uploaded-skills":{hasMcpServer:!0,hasUploadedPackage:!0,hasImportedSkills:!1,requiredInputs:[_n.serverUrl,_n.pluginBundle],summary:"an MCP endpoint plus an uploaded skills package"}}),mM=Object.freeze({"technical-preflight":["runtime-compatibility","directory-policy","plugin-package"],"submission-ready":["runtime-compatibility","directory-policy","plugin-package","submission-artifacts","release-contract"]});function xy(e){return typeof e=="object"&&e!==null&&e.readinessKind==="openai-directory-readiness"}var My=["experience"];var Ly=["openai.experience.tool-descriptions-uninformative","openai.experience.tool-overlap","openai.experience.naming-inconsistent","openai.experience.listing-copy-placeholder","openai.experience.listing-copy-overpromises","openai.experience.skill-overlap","openai.experience.destructive-tool-underexplained","openai.experience.auth-story-unclear"],_M=Object.freeze({readinessKind:"openai-directory-readiness",observationKinds:My,knownIds:Ly,schemaVersion:"1"}),Dy=[{id:"openai.experience.tool-descriptions-uninformative",title:"Tool descriptions may not tell the model when to use the tool",lane:"experience-insights",class:"heuristic",source:jt("guides/optimize-metadata","§Tool descriptions"),remediation:"Describe when a tool should be reached for, not only what it does; the model picks tools from these sentences."},{id:"openai.experience.tool-overlap",title:"Two or more tools may cover the same job",lane:"experience-insights",class:"heuristic",source:jt("plan/tools","§Naming"),remediation:"Overlapping tools make selection ambiguous; consider merging them or sharpening the descriptions that separate them."},{id:"openai.experience.naming-inconsistent",title:"Tool names may not follow one convention",lane:"experience-insights",class:"heuristic",source:jt("plan/tools","§Naming"),remediation:"Pick one naming convention across the whole surface; mixed conventions read as two servers merged."},{id:"openai.experience.listing-copy-placeholder",title:"Listing copy may still contain placeholder text",lane:"experience-insights",class:"manual-review",source:jt("app-guidelines","§Listing quality"),remediation:"Review the listing fields for template text before submitting; reviewers reject placeholder copy."},{id:"openai.experience.listing-copy-overpromises",title:"Listing copy may claim capabilities the tools do not implement",lane:"experience-insights",class:"manual-review",source:jt("app-guidelines","§Listing quality"),remediation:"Check that every capability the listing advertises is reachable through a tool this server actually exposes."},{id:"openai.experience.skill-overlap",title:"Two or more skills may describe the same task",lane:"experience-insights",class:"heuristic",source:jt("app-guidelines","§Listing quality"),remediation:"Skills that overlap compete for the same trigger; separate their scopes or fold them together."},{id:"openai.experience.destructive-tool-underexplained",title:"A destructive tool may not explain its consequences",lane:"experience-insights",class:"manual-review",source:jt("app-guidelines","§Predictable side effects"),remediation:"Say plainly in the description what a destructive tool changes and whether it can be undone."},{id:"openai.experience.auth-story-unclear",title:"It may not be clear to a user what they are authorizing",lane:"experience-insights",class:"manual-review",source:jt("build/auth","§Consent"),remediation:"State which account is connected and what scope it grants, in the copy the user sees at consent time."}],yM=Object.freeze({experienceLane:"experience-insights",engineVersion:"2",mappings:Dy}),Ny=["https://claude.ai/api/mcp/auth_callback","https://claude.com/api/mcp/auth_callback"];var zy=".claudemcpcontent.com";var Uy="text/html;profile=mcp-app",Fy={toolListingMs:5e3,handshakeMs:3e3,widgetFirstPaintMs:3e3},qy={minViewportWidthPx:320,minTouchTargetPx:44},pr={nameMaxLength:100,taglineMaxLength:55,descriptionMaxLength:2e3,categoriesMin:1,categoriesMax:5,screenshotsMin:3,screenshotsMax:5,screenshotMinWidthPx:1e3,toolNameMaxLength:64},bM={callbackUrls:Ny,loopbackRedirectIgnoresPort:!0,appContentDomainSuffix:zy,appContentDomainHashLength:32,appHtmlMime:Uy,latencyBudgets:Fy,appDesignBudgets:qy,submissionLimits:pr,source:hr("directory","Host profile constants")},wM=Object.freeze({status:"aborted"});function x(e,t,r){function n(a,c){if(a._zod||Object.defineProperty(a,"_zod",{value:{def:c,constr:o,traits:new Set},enumerable:!1}),a._zod.traits.has(e))return;a._zod.traits.add(e),t(a,c);const l=o.prototype,u=Object.keys(l);for(let h=0;h<u.length;h++){const d=u[h];d in a||(a[d]=l[d].bind(a))}}const i=r?.Parent??Object;class s extends i{}Object.defineProperty(s,"name",{value:e});function o(a){var c;const l=r?.Parent?new s:this;n(l,a),(c=l._zod).deferred??(c.deferred=[]);for(const u of l._zod.deferred)u();return l}return Object.defineProperty(o,"init",{value:n}),Object.defineProperty(o,Symbol.hasInstance,{value:a=>r?.Parent&&a instanceof r.Parent?!0:a?._zod?.traits?.has(e)}),Object.defineProperty(o,"name",{value:e}),o}var zn=class extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}},sf=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name="ZodEncodeError"}},Ec={};function Pr(e){return e&&Object.assign(Ec,e),Ec}function of(e){const t=Object.values(e).filter(r=>typeof r=="number");return Object.entries(e).filter(([r,n])=>t.indexOf(+r)===-1).map(([r,n])=>n)}function kc(e,t){return typeof t=="bigint"?t.toString():t}function Fo(e){return{get value(){{const t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function Nl(e){return e==null}function zl(e){const t=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}function jy(e,t){const r=(e.toString().split(".")[1]||"").length,n=t.toString();let i=(n.split(".")[1]||"").length;if(i===0&&/\d?e-\d?/.test(n)){const o=n.match(/\d?e-(\d?)/);o?.[1]&&(i=Number.parseInt(o[1]))}const s=r>i?r:i;return Number.parseInt(e.toFixed(s).replace(".",""))%Number.parseInt(t.toFixed(s).replace(".",""))/10**s}var Qu=Symbol("evaluating");function Ae(e,t,r){let n;Object.defineProperty(e,t,{get(){if(n!==Qu)return n===void 0&&(n=Qu,n=r()),n},set(i){Object.defineProperty(e,t,{value:i})},configurable:!0})}function gn(e,t,r){Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}function jr(...e){const t={};for(const r of e){const n=Object.getOwnPropertyDescriptors(r);Object.assign(t,n)}return Object.defineProperties({},t)}function ed(e){return JSON.stringify(e)}function Hy(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}var af="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function Gi(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}var Vy=Fo(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return new Function(""),!0}catch{return!1}});function Bn(e){if(Gi(e)===!1)return!1;const t=e.constructor;if(t===void 0||typeof t!="function")return!0;const r=t.prototype;return!(Gi(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}function cf(e){return Bn(e)?{...e}:Array.isArray(e)?[...e]:e}var By=new Set(["string","number","symbol"]);function Gn(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function lr(e,t,r){const n=new e._zod.constr(t??e._zod.def);return(!t||r?.parent)&&(n._zod.parent=e),n}function re(e){const t=e;if(!t)return{};if(typeof t=="string")return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error=="string"?{...t,error:()=>t.error}:t}function Gy(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}var Wy={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function Zy(e,t){const r=e._zod.def,n=r.checks;if(n&&n.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");return lr(e,jr(e._zod.def,{get shape(){const i={};for(const s in t){if(!(s in r.shape))throw new Error(`Unrecognized key: "${s}"`);t[s]&&(i[s]=r.shape[s])}return gn(this,"shape",i),i},checks:[]}))}function Jy(e,t){const r=e._zod.def,n=r.checks;if(n&&n.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");return lr(e,jr(e._zod.def,{get shape(){const i={...e._zod.def.shape};for(const s in t){if(!(s in r.shape))throw new Error(`Unrecognized key: "${s}"`);t[s]&&delete i[s]}return gn(this,"shape",i),i},checks:[]}))}function Ky(e,t){if(!Bn(t))throw new Error("Invalid input to extend: expected a plain object");const r=e._zod.def.checks;if(r&&r.length>0){const n=e._zod.def.shape;for(const i in t)if(Object.getOwnPropertyDescriptor(n,i)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return lr(e,jr(e._zod.def,{get shape(){const n={...e._zod.def.shape,...t};return gn(this,"shape",n),n}}))}function Yy(e,t){if(!Bn(t))throw new Error("Invalid input to safeExtend: expected a plain object");return lr(e,jr(e._zod.def,{get shape(){const r={...e._zod.def.shape,...t};return gn(this,"shape",r),r}}))}function Xy(e,t){return lr(e,jr(e._zod.def,{get shape(){const r={...e._zod.def.shape,...t._zod.def.shape};return gn(this,"shape",r),r},get catchall(){return t._zod.def.catchall},checks:[]}))}function Qy(e,t,r){const n=t._zod.def.checks;if(n&&n.length>0)throw new Error(".partial() cannot be used on object schemas containing refinements");return lr(t,jr(t._zod.def,{get shape(){const i=t._zod.def.shape,s={...i};if(r)for(const o in r){if(!(o in i))throw new Error(`Unrecognized key: "${o}"`);r[o]&&(s[o]=e?new e({type:"optional",innerType:i[o]}):i[o])}else for(const o in i)s[o]=e?new e({type:"optional",innerType:i[o]}):i[o];return gn(this,"shape",s),s},checks:[]}))}function e0(e,t,r){return lr(t,jr(t._zod.def,{get shape(){const n=t._zod.def.shape,i={...n};if(r)for(const s in r){if(!(s in i))throw new Error(`Unrecognized key: "${s}"`);r[s]&&(i[s]=new e({type:"nonoptional",innerType:n[s]}))}else for(const s in n)i[s]=new e({type:"nonoptional",innerType:n[s]});return gn(this,"shape",i),i}}))}function Tn(e,t=0){if(e.aborted===!0)return!0;for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue!==!0)return!0;return!1}function nn(e,t){return t.map(r=>{var n;return(n=r).path??(n.path=[]),r.path.unshift(e),r})}function vs(e){return typeof e=="string"?e:e?.message}function Or(e,t,r){const n={...e,path:e.path??[]};return e.message||(n.message=vs(e.inst?._zod.def?.error?.(e))??vs(t?.error?.(e))??vs(r.customError?.(e))??vs(r.localeError?.(e))??"Invalid input"),delete n.inst,delete n.continue,t?.reportInput||delete n.input,n}function Ul(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function Wi(...e){const[t,r,n]=e;return typeof t=="string"?{message:t,code:"custom",input:r,inst:n}:{...t}}var lf=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,kc,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},uf=x("$ZodError",lf),df=x("$ZodError",lf,{Parent:Error});function t0(e,t=r=>r.message){const r={},n=[];for(const i of e.issues)i.path.length>0?(r[i.path[0]]=r[i.path[0]]||[],r[i.path[0]].push(t(i))):n.push(t(i));return{formErrors:n,fieldErrors:r}}function r0(e,t=r=>r.message){const r={_errors:[]},n=i=>{for(const s of i.issues)if(s.code==="invalid_union"&&s.errors.length)s.errors.map(o=>n({issues:o}));else if(s.code==="invalid_key")n({issues:s.issues});else if(s.code==="invalid_element")n({issues:s.issues});else if(s.path.length===0)r._errors.push(t(s));else{let o=r,a=0;for(;a<s.path.length;){const c=s.path[a];a!==s.path.length-1?o[c]=o[c]||{_errors:[]}:(o[c]=o[c]||{_errors:[]},o[c]._errors.push(t(s))),o=o[c],a++}}};return n(e),r}var Fl=e=>(t,r,n,i)=>{const s=n?Object.assign(n,{async:!1}):{async:!1},o=t._zod.run({value:r,issues:[]},s);if(o instanceof Promise)throw new zn;if(o.issues.length){const a=new(i?.Err??e)(o.issues.map(c=>Or(c,s,Pr())));throw af(a,i?.callee),a}return o.value},ql=e=>async(t,r,n,i)=>{const s=n?Object.assign(n,{async:!0}):{async:!0};let o=t._zod.run({value:r,issues:[]},s);if(o instanceof Promise&&(o=await o),o.issues.length){const a=new(i?.Err??e)(o.issues.map(c=>Or(c,s,Pr())));throw af(a,i?.callee),a}return o.value},qo=e=>(t,r,n)=>{const i=n?{...n,async:!1}:{async:!1},s=t._zod.run({value:r,issues:[]},i);if(s instanceof Promise)throw new zn;return s.issues.length?{success:!1,error:new(e??uf)(s.issues.map(o=>Or(o,i,Pr())))}:{success:!0,data:s.value}},n0=qo(df),jo=e=>async(t,r,n)=>{const i=n?Object.assign(n,{async:!0}):{async:!0};let s=t._zod.run({value:r,issues:[]},i);return s instanceof Promise&&(s=await s),s.issues.length?{success:!1,error:new e(s.issues.map(o=>Or(o,i,Pr())))}:{success:!0,data:s.value}},i0=jo(df),s0=e=>(t,r,n)=>{const i=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return Fl(e)(t,r,i)},o0=e=>(t,r,n)=>Fl(e)(t,r,n),a0=e=>async(t,r,n)=>{const i=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return ql(e)(t,r,i)},c0=e=>async(t,r,n)=>ql(e)(t,r,n),l0=e=>(t,r,n)=>{const i=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return qo(e)(t,r,i)},u0=e=>(t,r,n)=>qo(e)(t,r,n),d0=e=>async(t,r,n)=>{const i=n?Object.assign(n,{direction:"backward"}):{direction:"backward"};return jo(e)(t,r,i)},h0=e=>async(t,r,n)=>jo(e)(t,r,n),p0=/^[cC][^\s-]{8,}$/,f0=/^[0-9a-z]+$/,v0=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,g0=/^[0-9a-vA-V]{20}$/,m0=/^[A-Za-z0-9]{27}$/,_0=/^[a-zA-Z0-9_-]{21}$/,y0=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,b0=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,td=e=>e?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,w0=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,S0="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function E0(){return new RegExp(S0,"u")}var k0=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,R0=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,A0=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,I0=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,T0=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,hf=/^[A-Za-z0-9_-]*$/,C0=/^\+[1-9]\d{6,14}$/,pf="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))",$0=new RegExp(`^${pf}$`);function ff(e){const t="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof e.precision=="number"?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function P0(e){return new RegExp(`^${ff(e)}$`)}function O0(e){const t=ff({precision:e.precision}),r=["Z"];e.local&&r.push(""),e.offset&&r.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");const n=`${t}(?:${r.join("|")})`;return new RegExp(`^${pf}T(?:${n})$`)}var x0=e=>{const t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},M0=/^-?\d+$/,vf=/^-?\d+(?:\.\d+)?$/,L0=/^(?:true|false)$/i,D0=/^null$/i,N0=/^undefined$/i,z0=/^[^A-Z]*$/,U0=/^[^a-z]*$/,wt=x("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])}),gf={number:"number",bigint:"bigint",object:"date"},mf=x("$ZodCheckLessThan",(e,t)=>{wt.init(e,t);const r=gf[typeof t.value];e._zod.onattach.push(n=>{const i=n._zod.bag,s=(t.inclusive?i.maximum:i.exclusiveMaximum)??Number.POSITIVE_INFINITY;t.value<s&&(t.inclusive?i.maximum=t.value:i.exclusiveMaximum=t.value)}),e._zod.check=n=>{(t.inclusive?n.value<=t.value:n.value<t.value)||n.issues.push({origin:r,code:"too_big",maximum:typeof t.value=="object"?t.value.getTime():t.value,input:n.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),_f=x("$ZodCheckGreaterThan",(e,t)=>{wt.init(e,t);const r=gf[typeof t.value];e._zod.onattach.push(n=>{const i=n._zod.bag,s=(t.inclusive?i.minimum:i.exclusiveMinimum)??Number.NEGATIVE_INFINITY;t.value>s&&(t.inclusive?i.minimum=t.value:i.exclusiveMinimum=t.value)}),e._zod.check=n=>{(t.inclusive?n.value>=t.value:n.value>t.value)||n.issues.push({origin:r,code:"too_small",minimum:typeof t.value=="object"?t.value.getTime():t.value,input:n.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),F0=x("$ZodCheckMultipleOf",(e,t)=>{wt.init(e,t),e._zod.onattach.push(r=>{var n;(n=r._zod.bag).multipleOf??(n.multipleOf=t.value)}),e._zod.check=r=>{if(typeof r.value!=typeof t.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof r.value=="bigint"?r.value%t.value===BigInt(0):jy(r.value,t.value)===0)||r.issues.push({origin:typeof r.value,code:"not_multiple_of",divisor:t.value,input:r.value,inst:e,continue:!t.abort})}}),q0=x("$ZodCheckNumberFormat",(e,t)=>{wt.init(e,t),t.format=t.format||"float64";const r=t.format?.includes("int"),n=r?"int":"number",[i,s]=Wy[t.format];e._zod.onattach.push(o=>{const a=o._zod.bag;a.format=t.format,a.minimum=i,a.maximum=s,r&&(a.pattern=M0)}),e._zod.check=o=>{const a=o.value;if(r){if(!Number.isInteger(a)){o.issues.push({expected:n,format:t.format,code:"invalid_type",continue:!1,input:a,inst:e});return}if(!Number.isSafeInteger(a)){a>0?o.issues.push({input:a,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:n,inclusive:!0,continue:!t.abort}):o.issues.push({input:a,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:n,inclusive:!0,continue:!t.abort});return}}a<i&&o.issues.push({origin:"number",input:a,code:"too_small",minimum:i,inclusive:!0,inst:e,continue:!t.abort}),a>s&&o.issues.push({origin:"number",input:a,code:"too_big",maximum:s,inclusive:!0,inst:e,continue:!t.abort})}}),j0=x("$ZodCheckMaxLength",(e,t)=>{var r;wt.init(e,t),(r=e._zod.def).when??(r.when=n=>{const i=n.value;return!Nl(i)&&i.length!==void 0}),e._zod.onattach.push(n=>{const i=n._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<i&&(n._zod.bag.maximum=t.maximum)}),e._zod.check=n=>{const i=n.value;if(i.length<=t.maximum)return;const s=Ul(i);n.issues.push({origin:s,code:"too_big",maximum:t.maximum,inclusive:!0,input:i,inst:e,continue:!t.abort})}}),H0=x("$ZodCheckMinLength",(e,t)=>{var r;wt.init(e,t),(r=e._zod.def).when??(r.when=n=>{const i=n.value;return!Nl(i)&&i.length!==void 0}),e._zod.onattach.push(n=>{const i=n._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>i&&(n._zod.bag.minimum=t.minimum)}),e._zod.check=n=>{const i=n.value;if(i.length>=t.minimum)return;const s=Ul(i);n.issues.push({origin:s,code:"too_small",minimum:t.minimum,inclusive:!0,input:i,inst:e,continue:!t.abort})}}),V0=x("$ZodCheckLengthEquals",(e,t)=>{var r;wt.init(e,t),(r=e._zod.def).when??(r.when=n=>{const i=n.value;return!Nl(i)&&i.length!==void 0}),e._zod.onattach.push(n=>{const i=n._zod.bag;i.minimum=t.length,i.maximum=t.length,i.length=t.length}),e._zod.check=n=>{const i=n.value,s=i.length;if(s===t.length)return;const o=Ul(i),a=s>t.length;n.issues.push({origin:o,...a?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),Ho=x("$ZodCheckStringFormat",(e,t)=>{var r,n;wt.init(e,t),e._zod.onattach.push(i=>{const s=i._zod.bag;s.format=t.format,t.pattern&&(s.patterns??(s.patterns=new Set),s.patterns.add(t.pattern))}),t.pattern?(r=e._zod).check??(r.check=i=>{t.pattern.lastIndex=0,!t.pattern.test(i.value)&&i.issues.push({origin:"string",code:"invalid_format",format:t.format,input:i.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(n=e._zod).check??(n.check=()=>{})}),B0=x("$ZodCheckRegex",(e,t)=>{Ho.init(e,t),e._zod.check=r=>{t.pattern.lastIndex=0,!t.pattern.test(r.value)&&r.issues.push({origin:"string",code:"invalid_format",format:"regex",input:r.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),G0=x("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=z0),Ho.init(e,t)}),W0=x("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=U0),Ho.init(e,t)}),Z0=x("$ZodCheckIncludes",(e,t)=>{wt.init(e,t);const r=Gn(t.includes),n=new RegExp(typeof t.position=="number"?`^.{${t.position}}${r}`:r);t.pattern=n,e._zod.onattach.push(i=>{const s=i._zod.bag;s.patterns??(s.patterns=new Set),s.patterns.add(n)}),e._zod.check=i=>{i.value.includes(t.includes,t.position)||i.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:i.value,inst:e,continue:!t.abort})}}),J0=x("$ZodCheckStartsWith",(e,t)=>{wt.init(e,t);const r=new RegExp(`^${Gn(t.prefix)}.*`);t.pattern??(t.pattern=r),e._zod.onattach.push(n=>{const i=n._zod.bag;i.patterns??(i.patterns=new Set),i.patterns.add(r)}),e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),K0=x("$ZodCheckEndsWith",(e,t)=>{wt.init(e,t);const r=new RegExp(`.*${Gn(t.suffix)}$`);t.pattern??(t.pattern=r),e._zod.onattach.push(n=>{const i=n._zod.bag;i.patterns??(i.patterns=new Set),i.patterns.add(r)}),e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}}),Y0=x("$ZodCheckOverwrite",(e,t)=>{wt.init(e,t),e._zod.check=r=>{r.value=t.tx(r.value)}}),X0=class{constructor(e=[]){this.content=[],this.indent=0,this&&(this.args=e)}indented(e){this.indent+=1,e(this),this.indent-=1}write(e){if(typeof e=="function"){e(this,{execution:"sync"}),e(this,{execution:"async"});return}const t=e.split(`
|
|
2
2
|
`).filter(i=>i),r=Math.min(...t.map(i=>i.length-i.trimStart().length)),n=t.map(i=>i.slice(r)).map(i=>" ".repeat(this.indent*2)+i);for(const i of n)this.content.push(i)}compile(){const e=Function,t=this?.args,r=[...(this?.content??[""]).map(n=>` ${n}`)];return new e(...t,r.join(`
|
|
3
3
|
`))}},Q0={major:4,minor:3,patch:6},Me=x("$ZodType",(e,t)=>{var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Q0;const n=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&n.unshift(e);for(const i of n)for(const s of i._zod.onattach)s(e);if(n.length===0)(r=e._zod).deferred??(r.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{const i=(o,a,c)=>{let l=Tn(o),u;for(const h of a){if(h._zod.def.when){if(!h._zod.def.when(o))continue}else if(l)continue;const d=o.issues.length,p=h._zod.check(o);if(p instanceof Promise&&c?.async===!1)throw new zn;if(u||p instanceof Promise)u=(u??Promise.resolve()).then(async()=>{await p,o.issues.length!==d&&(l||(l=Tn(o,d)))});else{if(o.issues.length===d)continue;l||(l=Tn(o,d))}}return u?u.then(()=>o):o},s=(o,a,c)=>{if(Tn(o))return o.aborted=!0,o;const l=i(a,n,c);if(l instanceof Promise){if(c.async===!1)throw new zn;return l.then(u=>e._zod.parse(u,c))}return e._zod.parse(l,c)};e._zod.run=(o,a)=>{if(a.skipChecks)return e._zod.parse(o,a);if(a.direction==="backward"){const l=e._zod.parse({value:o.value,issues:[]},{...a,skipChecks:!0});return l instanceof Promise?l.then(u=>s(u,o,a)):s(l,o,a)}const c=e._zod.parse(o,a);if(c instanceof Promise){if(a.async===!1)throw new zn;return c.then(l=>i(l,n,a))}return i(c,n,a)}}Ae(e,"~standard",()=>({validate:i=>{try{const s=n0(e,i);return s.success?{value:s.data}:{issues:s.error?.issues}}catch{return i0(e,i).then(o=>o.success?{value:o.data}:{issues:o.error?.issues})}},vendor:"zod",version:1}))}),jl=x("$ZodString",(e,t)=>{Me.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??x0(e._zod.bag),e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=String(r.value)}catch{}return typeof r.value=="string"||r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:e}),r}}),Ze=x("$ZodStringFormat",(e,t)=>{Ho.init(e,t),jl.init(e,t)}),eb=x("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=b0),Ze.init(e,t)}),tb=x("$ZodUUID",(e,t)=>{if(t.version){const r={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(r===void 0)throw new Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=td(r))}else t.pattern??(t.pattern=td());Ze.init(e,t)}),rb=x("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=w0),Ze.init(e,t)}),nb=x("$ZodURL",(e,t)=>{Ze.init(e,t),e._zod.check=r=>{try{const n=r.value.trim(),i=new URL(n);t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(i.hostname)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:r.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(i.protocol.endsWith(":")?i.protocol.slice(0,-1):i.protocol)||r.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:r.value,inst:e,continue:!t.abort})),t.normalize?r.value=i.href:r.value=n;return}catch{r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort})}}}),ib=x("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=E0()),Ze.init(e,t)}),sb=x("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=_0),Ze.init(e,t)}),ob=x("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=p0),Ze.init(e,t)}),ab=x("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=f0),Ze.init(e,t)}),cb=x("$ZodULID",(e,t)=>{t.pattern??(t.pattern=v0),Ze.init(e,t)}),lb=x("$ZodXID",(e,t)=>{t.pattern??(t.pattern=g0),Ze.init(e,t)}),ub=x("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=m0),Ze.init(e,t)}),db=x("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=O0(t)),Ze.init(e,t)}),hb=x("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=$0),Ze.init(e,t)}),pb=x("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=P0(t)),Ze.init(e,t)}),fb=x("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=y0),Ze.init(e,t)}),vb=x("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=k0),Ze.init(e,t),e._zod.bag.format="ipv4"}),gb=x("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=R0),Ze.init(e,t),e._zod.bag.format="ipv6",e._zod.check=r=>{try{new URL(`http://[${r.value}]`)}catch{r.issues.push({code:"invalid_format",format:"ipv6",input:r.value,inst:e,continue:!t.abort})}}}),mb=x("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=A0),Ze.init(e,t)}),_b=x("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=I0),Ze.init(e,t),e._zod.check=r=>{const n=r.value.split("/");try{if(n.length!==2)throw new Error;const[i,s]=n;if(!s)throw new Error;const o=Number(s);if(`${o}`!==s)throw new Error;if(o<0||o>128)throw new Error;new URL(`http://[${i}]`)}catch{r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:e,continue:!t.abort})}}});function yf(e){if(e==="")return!0;if(e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}var yb=x("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=T0),Ze.init(e,t),e._zod.bag.contentEncoding="base64",e._zod.check=r=>{yf(r.value)||r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:e,continue:!t.abort})}});function bb(e){if(!hf.test(e))return!1;const t=e.replace(/[-_]/g,r=>r==="-"?"+":"/");return yf(t.padEnd(Math.ceil(t.length/4)*4,"="))}var wb=x("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=hf),Ze.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=r=>{bb(r.value)||r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:e,continue:!t.abort})}}),Sb=x("$ZodE164",(e,t)=>{t.pattern??(t.pattern=C0),Ze.init(e,t)});function Eb(e,t=null){try{const r=e.split(".");if(r.length!==3)return!1;const[n]=r;if(!n)return!1;const i=JSON.parse(atob(n));return!("typ"in i&&i?.typ!=="JWT"||!i.alg||t&&(!("alg"in i)||i.alg!==t))}catch{return!1}}var kb=x("$ZodJWT",(e,t)=>{Ze.init(e,t),e._zod.check=r=>{Eb(r.value,t.alg)||r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:e,continue:!t.abort})}}),bf=x("$ZodNumber",(e,t)=>{Me.init(e,t),e._zod.pattern=e._zod.bag.pattern??vf,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=Number(r.value)}catch{}const i=r.value;if(typeof i=="number"&&!Number.isNaN(i)&&Number.isFinite(i))return r;const s=typeof i=="number"?Number.isNaN(i)?"NaN":Number.isFinite(i)?void 0:"Infinity":void 0;return r.issues.push({expected:"number",code:"invalid_type",input:i,inst:e,...s?{received:s}:{}}),r}}),Rb=x("$ZodNumberFormat",(e,t)=>{q0.init(e,t),bf.init(e,t)}),Ab=x("$ZodBoolean",(e,t)=>{Me.init(e,t),e._zod.pattern=L0,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=!!r.value}catch{}const i=r.value;return typeof i=="boolean"||r.issues.push({expected:"boolean",code:"invalid_type",input:i,inst:e}),r}}),Ib=x("$ZodUndefined",(e,t)=>{Me.init(e,t),e._zod.pattern=N0,e._zod.values=new Set([void 0]),e._zod.optin="optional",e._zod.optout="optional",e._zod.parse=(r,n)=>{const i=r.value;return typeof i>"u"||r.issues.push({expected:"undefined",code:"invalid_type",input:i,inst:e}),r}}),Tb=x("$ZodNull",(e,t)=>{Me.init(e,t),e._zod.pattern=D0,e._zod.values=new Set([null]),e._zod.parse=(r,n)=>{const i=r.value;return i===null||r.issues.push({expected:"null",code:"invalid_type",input:i,inst:e}),r}}),Cb=x("$ZodAny",(e,t)=>{Me.init(e,t),e._zod.parse=r=>r}),$b=x("$ZodUnknown",(e,t)=>{Me.init(e,t),e._zod.parse=r=>r}),Pb=x("$ZodNever",(e,t)=>{Me.init(e,t),e._zod.parse=(r,n)=>(r.issues.push({expected:"never",code:"invalid_type",input:r.value,inst:e}),r)});function rd(e,t,r){e.issues.length&&t.issues.push(...nn(r,e.issues)),t.value[r]=e.value}var Ob=x("$ZodArray",(e,t)=>{Me.init(e,t),e._zod.parse=(r,n)=>{const i=r.value;if(!Array.isArray(i))return r.issues.push({expected:"array",code:"invalid_type",input:i,inst:e}),r;r.value=Array(i.length);const s=[];for(let o=0;o<i.length;o++){const a=i[o],c=t.element._zod.run({value:a,issues:[]},n);c instanceof Promise?s.push(c.then(l=>rd(l,r,o))):rd(c,r,o)}return s.length?Promise.all(s).then(()=>r):r}});function to(e,t,r,n,i){if(e.issues.length){if(i&&!(r in n))return;t.issues.push(...nn(r,e.issues))}e.value===void 0?r in n&&(t.value[r]=void 0):t.value[r]=e.value}function wf(e){const t=Object.keys(e.shape);for(const n of t)if(!e.shape?.[n]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${n}": expected a Zod schema`);const r=Gy(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(r)}}function Sf(e,t,r,n,i,s){const o=[],a=i.keySet,c=i.catchall._zod,l=c.def.type,u=c.optout==="optional";for(const h in t){if(a.has(h))continue;if(l==="never"){o.push(h);continue}const d=c.run({value:t[h],issues:[]},n);d instanceof Promise?e.push(d.then(p=>to(p,r,h,t,u))):to(d,r,h,t,u)}return o.length&&r.issues.push({code:"unrecognized_keys",keys:o,input:t,inst:s}),e.length?Promise.all(e).then(()=>r):r}var xb=x("$ZodObject",(e,t)=>{if(Me.init(e,t),!Object.getOwnPropertyDescriptor(t,"shape")?.get){const o=t.shape;Object.defineProperty(t,"shape",{get:()=>{const a={...o};return Object.defineProperty(t,"shape",{value:a}),a}})}const r=Fo(()=>wf(t));Ae(e._zod,"propValues",()=>{const o=t.shape,a={};for(const c in o){const l=o[c]._zod;if(l.values){a[c]??(a[c]=new Set);for(const u of l.values)a[c].add(u)}}return a});const n=Gi,i=t.catchall;let s;e._zod.parse=(o,a)=>{s??(s=r.value);const c=o.value;if(!n(c))return o.issues.push({expected:"object",code:"invalid_type",input:c,inst:e}),o;o.value={};const l=[],u=s.shape;for(const h of s.keys){const d=u[h],p=d._zod.optout==="optional",f=d._zod.run({value:c[h],issues:[]},a);f instanceof Promise?l.push(f.then(v=>to(v,o,h,c,p))):to(f,o,h,c,p)}return i?Sf(l,c,o,a,r.value,e):l.length?Promise.all(l).then(()=>o):o}}),Mb=x("$ZodObjectJIT",(e,t)=>{xb.init(e,t);const r=e._zod.parse,n=Fo(()=>wf(t)),i=d=>{const p=new X0(["shape","payload","ctx"]),f=n.value,v=S=>{const T=ed(S);return`shape[${T}]._zod.run({ value: input[${T}], issues: [] }, ctx)`};p.write("const input = payload.value;");const m=Object.create(null);let _=0;for(const S of f.keys)m[S]=`key_${_++}`;p.write("const newResult = {};");for(const S of f.keys){const T=m[S],C=ed(S),$=d[S]?._zod?.optout==="optional";p.write(`const ${T} = ${v(S)};`),$?p.write(`
|
|
4
4
|
if (${T}.issues.length) {
|
|
@@ -93,10 +93,10 @@ Include resource parameter`,description:"Client generates code verifier and chal
|
|
|
93
93
|
Include resource parameter`,description:"Client generates code verifier and challenge (REQUIRED), includes resource parameter"},resourceValue:eI,dcrNotes:[{label:"Deprecated",value:"DCR is deprecated in 2026-07-28 (PR #2858). Prefer CIMD or a pre-registered client; DCR remains a compatibility fallback for authorization servers without CIMD support."}],clientCredentialsExtras:rI,authorizationRequestExtras:tI})}function Ud(e){const t=new URL(e),r=[];if(t.pathname==="/"||t.pathname==="")r.push(new URL("/.well-known/oauth-authorization-server",t.origin).toString()),r.push(new URL("/.well-known/openid-configuration",t.origin).toString());else{const n=t.pathname.endsWith("/")?t.pathname.slice(0,-1):t.pathname;r.push(new URL(`/.well-known/oauth-authorization-server${n}`,t.origin).toString()),r.push(new URL(`/.well-known/openid-configuration${n}`,t.origin).toString()),r.push(new URL(`${n}/.well-known/openid-configuration`,t.origin).toString())}return r}function Fd(e){const t=e.replace(/[\u0000-\u001f\u007f\u0085\u2028\u2029]+/g," ").trim();return`\`${t.length>256?`${t.slice(0,256)}…`:t}\``}function iI(e,t){let r,n;try{r=new URL(e),n=new URL(t)}catch{return!1}if(r.origin!==n.origin||r.search||r.hash||n.search||n.hash)return!1;const i=a=>a.endsWith("/")?a.slice(0,-1):a,s=i(r.pathname),o=i(n.pathname);return s===o?!1:s===""||s==="/"?o.length>0:o.startsWith(`${s}/`)}function sI(e,t){try{return new URL(e).origin===new URL(t).origin}catch{return!1}}function qd(e,t){return e==null?!1:typeof e!="string"?!0:!sI(e,t)}function jd(e){return typeof e=="string"?`"${e}"`:"a non-string value"}function oI(e){const{advertisedIssuer:t,discoveryUrl:r,tokenEndpoint:n,registrationEndpoint:i,allowPathScopedIssuer:s}=e,o=iI(t,r),a=s&&o,c=a&&qd(n,t),l=a&&qd(i,t);return a&&!c&&!l?{accepted:!0,hint:""}:{accepted:!1,hint:c?` The path-scoped authorization server's token endpoint (${jd(n)}) is not on the same origin as its issuer ("${t}"); refusing to send credentials off-origin.`:l?` The path-scoped authorization server's registration endpoint (${jd(i)}) is not on the same origin as its issuer ("${t}"); refusing dynamic registration off-origin.`:o?` The advertised issuer is the same-origin root of the discovery URL — a multi-tenant, path-scoped authorization server. Enable "Path-scoped authorization server" in the server's OAuth configuration (Advanced settings) to allow this.`:""}}function aI(e){const{recordedIssuer:t,returnedIss:r,issParameterSupported:n,enforcePresentIssMismatch:i=!0}=e;if(r!=null&&r!==""){if(t!==void 0&&r!==t){const s=`Authorization response \`iss\` does not match the issuer this flow started with. Recorded from authorization-server metadata: ${Fd(t)}; returned on the callback: ${Fd(r)}.`;return i?{ok:!1,reason:`${s} Refusing to exchange the authorization code; not displaying any server-supplied error parameters (RFC 9207).`}:{ok:!0,warning:`${s} This protocol version does not require RFC 9207 issuer validation, so the flow continues; on 2026-07-28 this stops the flow before the authorization code is redeemed.`}}return{ok:!0}}return n===!0?{ok:!1,reason:"Authorization server advertised `authorization_response_iss_parameter_supported: true` but the callback did not include an `iss` parameter (RFC 9207 requires it)."}:{ok:!0}}var cI=e=>{const{state:t,getState:r,updateState:n,serverUrl:i,serverName:s,redirectUrl:o,requestExecutor:a,scheduleAutoAdvance:c,loadPreregisteredCredentials:l,dynamicRegistration:u,clientIdMetadataUrl:h,customScopes:d,customHeaders:p,resourceMetadataUrl:f,authMode:v,hasClientSecret:m=!1,strictConformance:_=!1,allowPathScopedIssuer:w=!1,resourceIndicatorEnforcement:S="warn",requiredMetadataEnforcement:T="reject",registrationStrategy:C="cimd",emulation:$}=e,M=o,L=fn($,"2026-07-28"),q=la($),X=ua(u??{},$);let ee=h??"";if(C==="dcr"&&!X.client_name)throw new Error("Dynamic registration metadata must include client_name");if(C==="cimd"&&!ee)throw new Error("Client ID metadata URL is required for CIMD registration");C==="cimd"&&(ee=rg(ee));const k=()=>r?r():t,ie=()=>ai(k(),i),H=(y,V={})=>a({url:y,method:V.method||"GET",headers:Tr(V.headers),body:V.body}),oe=y=>{const V=Ko({authorizationServerMetadata:k().authorizationServerMetadata,hasClientSecret:!!(y||m)});if(!V.ok)throw new Error(V.message);return V.method},I=async y=>{const{clientId:V,clientSecret:K}=await l?.({serverName:s,serverUrl:i})??{};if(!V)return;const le=oe(K),de={"Client ID":V,"Client Secret":K||m?"Configured":"Not provided (public client)","Token Auth Method":le,Note:y};return{clientId:V,clientSecret:K||void 0,tokenEndpointAuthMethod:le,infoLogs:ne(k(),"received_client_credentials","preregistered-fallback","Pre-registered Client",de)}},Q={state:t,updateState:n,proceedToNextStep:async()=>{const y=k();n({isInitiatingAuth:!0});const V=K=>{c?.(()=>{Q.proceedToNextStep()},K)};try{switch(y.currentStep){case"idle":{const g=lt(p,{"Content-Type":"application/json",Accept:"application/json, text/event-stream","MCP-Protocol-Version":L,"Mcp-Method":"tools/list"}),R=ks({protocolVersion:L,authMode:v,clientName:"MCPJam Inspector",clientVersion:"1.0.0",id:1}),E={method:"POST",url:i,headers:g,body:R};n({currentStep:"request_without_token",serverUrl:i,lastRequest:E,lastResponse:void 0,httpHistory:[...y.httpHistory||[],{step:"request_without_token",timestamp:Date.now(),request:E}],isInitiatingAuth:!1}),V(50);return}case"request_without_token":if(!y.serverUrl)throw new Error("No server URL available");try{const g=await H(y.serverUrl,{method:"POST",headers:lt(p,{"Content-Type":"application/json",Accept:"application/json, text/event-stream","MCP-Protocol-Version":L,"Mcp-Method":"tools/list"}),body:JSON.stringify(ks({protocolVersion:L,authMode:v,clientName:"MCPJam Inspector",clientVersion:"1.0.0",id:1}))}),R={status:g.status,statusText:g.statusText,headers:g.headers,body:g.body},E=[...y.httpHistory||[]];if(E.length>0){const F=E[E.length-1];F.response=R,F.duration=Date.now()-(F.timestamp||Date.now())}const P=ls({status:g.status,statusText:g.statusText,wwwAuthenticateHeader:g.headers["www-authenticate"],serverMessage:g.body?.error?.message});if(P.kind==="challenged"){const F=g.headers["www-authenticate"],B=cr(F),D=ou(B.scope);let G=F?ne(y,"received_401_unauthorized","www-authenticate","WWW-Authenticate Header",{header:F,...D&&D.length>0?{scope:D.join(" ")}:{},"Received from":y.serverUrl||"Unknown"}):y.infoLogs;P.specCompliant||(G=ra(y,G,"received_401_unauthorized",R)),n({currentStep:"received_401_unauthorized",wwwAuthenticateHeader:F||void 0,challengedScopes:D,lastResponse:R,httpHistory:E,infoLogs:G,isInitiatingAuth:!1})}else if(P.kind==="anonymous_allowed"){const F=ne(y,"received_401_unauthorized","optional-auth","Optional Authentication Detected",{message:"Server allows anonymous access",note:"Proceeding with OAuth discovery for authenticated features"});n({currentStep:"received_401_unauthorized",wwwAuthenticateHeader:void 0,lastResponse:R,httpHistory:E,infoLogs:F,isInitiatingAuth:!1})}else throw n({lastResponse:R,httpHistory:E}),new xr(P.message,g.status)}catch(g){throw g instanceof xr?g:new Error(`Failed to request MCP server: ${g instanceof Error?g.message:String(g)}`)}break;case"received_401_unauthorized":{const g=cr(y.wwwAuthenticateHeader);let R=f||g.resource_metadata;if(!R&&y.serverUrl&&(R=du(y.serverUrl)),!R)throw new Error("Could not determine resource metadata URL");const E={method:"GET",url:R,headers:lt(p,{})};n({currentStep:"request_resource_metadata",resourceMetadataUrl:R,lastRequest:E,lastResponse:void 0,httpHistory:[...y.httpHistory||[],{step:"request_resource_metadata",timestamp:Date.now(),request:E}],isInitiatingAuth:!1}),V(50);return}case"request_resource_metadata":if(!y.serverUrl)throw new Error("No server URL available");const K=[...y.httpHistory||[]];let le=K.length>0&&K[K.length-1]?.step==="request_resource_metadata"&&!K[K.length-1]?.response?K.pop():void 0;const de=[],$e=async(g,R={})=>{const E=typeof g=="string"?g:g.toString(),P=cu(i,E,p,Tr(R.headers)),F=le?{...le,timestamp:Date.now(),request:{method:R.method||"GET",url:E,headers:P,body:R.body}}:{step:"request_resource_metadata",timestamp:Date.now(),request:{method:R.method||"GET",url:E,headers:P,body:R.body}};le=void 0,de.push(F);try{const B=await H(E,{method:R.method||"GET",headers:P,body:R.body});F.response={status:B.status,statusText:B.statusText,headers:B.headers,body:B.body},F.duration=Date.now()-F.timestamp;const D={status:B.status,statusText:B.statusText,headers:B.headers},G=typeof B.body=="string"?B.body:JSON.stringify(B.body??{});return new Response(G,D)}catch(B){throw F.error=It(B),F.duration=Date.now()-F.timestamp,B}};try{const g=(f||cr(y.wwwAuthenticateHeader).resource_metadata)&&y.resourceMetadataUrl?{resourceMetadataUrl:y.resourceMetadataUrl}:void 0,R=await Jo(y.serverUrl,g,$e),E=[...K,...de],P=de[de.length-1],F=lu({authorizationServers:R.authorization_servers,fallbackServerUrl:i,protocolVersion:"2026-07-28"}),B=F.authorizationServerUrl;if(F.error&&T!=="observe"){n({resourceMetadata:R,resourceMetadataUrl:P?.request?.url||y.resourceMetadataUrl,lastRequest:P?.request,lastResponse:P?.response,httpHistory:E,error:F.error,isInitiatingAuth:!1});return}let D=y.infoLogs??[];F.error&&(D=ne({...k(),infoLogs:D},"received_resource_metadata","authorization-server-substituted","Derived: Authorization Server (not advertised)",{Finding:F.error,"Using instead":B}));const G=pu({state:y,fallbackServerUrl:i,prmResource:R.resource,enforcement:S,infoLogs:D}),J=G.resourceIndicator;D=G.infoLogs,n({currentStep:"received_resource_metadata",resourceMetadata:R,resourceIndicator:J,resourceMetadataUrl:P?.request?.url||y.resourceMetadataUrl,authorizationServerUrl:B,lastRequest:P?.request,lastResponse:P?.response,httpHistory:E,infoLogs:D,isInitiatingAuth:!1})}catch(g){const R=pn([...K,...de],It(g));throw n({lastResponse:de[de.length-1]?.response,httpHistory:R}),new Error(Zo(g))}break;case"received_resource_metadata":if(!y.authorizationServerUrl)throw new Error("No authorization server URL available");const Re={method:"GET",url:Ud(y.authorizationServerUrl)[0],headers:at(p,{})};n({currentStep:"request_authorization_server_metadata",lastRequest:Re,lastResponse:void 0,httpHistory:[...y.httpHistory||[],{step:"request_authorization_server_metadata",timestamp:Date.now(),request:Re}],isInitiatingAuth:!1}),V(50);return;case"request_authorization_server_metadata":if(!y.authorizationServerUrl)throw new Error("No authorization server URL available");const _e=Ud(y.authorizationServerUrl);let ve=null;const Je=[];let Xe={},Pe=null;for(const g of _e)try{const R=at(p,{}),E=[...y.httpHistory||[]];E.length>0&&(E[E.length-1].request={method:"GET",url:g,headers:R}),n({lastRequest:{method:"GET",url:g,headers:R},httpHistory:E});const P=await H(g,{method:"GET",headers:at(p,{})});if(P.ok){ve=P.body,Xe=P.headers,Pe=P,ve||Je.push({url:g,status:P.status});break}Je.push({url:g,status:P.status})}catch(R){Je.push({url:g,error:R});continue}if(!ve||!Pe)throw new Error(hu(Je));if(!ve.issuer)throw new Error(ia);if(ve.issuer!==y.authorizationServerUrl){const g=oI({advertisedIssuer:ve.issuer,discoveryUrl:y.authorizationServerUrl,tokenEndpoint:ve.token_endpoint,registrationEndpoint:ve.registration_endpoint,allowPathScopedIssuer:w});if(!g.accepted)throw new Error(`Authorization server metadata \`issuer\` does not match the authorization server URL it was discovered from (expected "${y.authorizationServerUrl}", got "${ve.issuer}"). RFC 8414 §3.3 requires an exact match; refusing to continue.`+g.hint)}if(!ve.authorization_endpoint)throw new Error("Authorization server metadata missing 'authorization_endpoint'");if(!ve.token_endpoint)throw new Error("Authorization server metadata missing 'token_endpoint'");if(!ve.response_types_supported?.includes("code"))throw new Error("Authorization server does not support 'code' response type");const z={status:Pe.status,statusText:Pe.statusText,headers:Xe,body:ve},se=[...y.httpHistory||[]];if(se.length>0){const g=se[se.length-1];g.response=z,g.duration=Date.now()-(g.timestamp||Date.now())}const ae=ve.code_challenge_methods_supported||[],he=eg(ae,"2026-07-28"),Oe=typeof ve.client_id_metadata_document_supported=="boolean"?ve.client_id_metadata_document_supported:"false (not advertised, defaults to false per spec)";let we=ne(k(),"received_authorization_server_metadata","cimd-support","Derived: CIMD Support",{"CIMD Supported":Oe});if(ve.issuer!==y.authorizationServerUrl&&(we=ne({...k(),infoLogs:we},"received_authorization_server_metadata","path-scoped-issuer","Path-scoped authorization server",{"Discovery URL":y.authorizationServerUrl,"Advertised issuer":ve.issuer,Note:'The advertised issuer is the same-origin root of the discovery URL. Accepted because "Path-scoped authorization server" is enabled for this server; strict RFC 8414 §3.3 conformance requires an exact issuer match, and strict MCP clients may refuse to connect.'},{level:"warning"})),he){if(_||T!=="observe"){n({lastResponse:z,httpHistory:se,infoLogs:we,error:he,isInitiatingAuth:!1});return}console.warn("Authorization server may not support S256 PKCE method. Supported methods:",ae),n({currentStep:"received_authorization_server_metadata",authorizationServerMetadata:ve,lastResponse:z,httpHistory:se,infoLogs:we,error:"Warning: Authorization server may not support S256 PKCE method",isInitiatingAuth:!1})}else n({currentStep:"received_authorization_server_metadata",authorizationServerMetadata:ve,lastResponse:z,httpHistory:se,infoLogs:we,isInitiatingAuth:!1});break;case"received_authorization_server_metadata":if(!y.authorizationServerMetadata)throw new Error("No authorization server metadata available");if(C==="cimd"){if(y.authorizationServerMetadata.client_id_metadata_document_supported!==!0){n({error:"The authorization server does not support Client ID Metadata Documents (client_id_metadata_document_supported is not advertised in AS metadata). Try using 'dcr' or 'preregistered' registration strategy instead.",isInitiatingAuth:!1});return}n({currentStep:"cimd_prepare",clientId:ee,isInitiatingAuth:!1}),V(800);return}else if(C==="preregistered"){const{clientId:g,clientSecret:R}=await l?.({serverName:s,serverUrl:i})??{};if(!g){n({error:"Pre-registered client ID is required. Please configure OAuth credentials in the server settings.",isInitiatingAuth:!1});return}const E=oe(R),P={"Client ID":g,"Client Secret":R||m?"Configured":"Not provided (public client)","Token Auth Method":E,Note:"Using pre-registered client credentials from server config (skipped DCR)"},F=ne(k(),"received_client_credentials","dcr","Pre-registered Client",P);n({currentStep:"received_client_credentials",clientId:g,clientSecret:R||void 0,tokenEndpointAuthMethod:E,infoLogs:F,isInitiatingAuth:!1})}else if(y.authorizationServerMetadata.registration_endpoint){const g=y.resourceMetadata?.scopes_supported||y.authorizationServerMetadata.scopes_supported,R=Nr($,{customScopes:d,challengedScopes:y.challengedScopes,supportedScopes:g}),E=aa({registrationEndpoint:y.authorizationServerMetadata.registration_endpoint,redirectUri:M,dynamicRegistrationDefaults:{...X,application_type:X.application_type??qA(X.redirect_uris??[M])},scope:R,customHeaders:p}),P=ne(k(),"request_client_registration","dcr-deprecated","DCR is deprecated in 2026-07-28",{Note:"Dynamic Client Registration (RFC 7591) is deprecated as a registration mechanism in 2026-07-28 (PR #2858). It remains a compatibility fallback; prefer CIMD or a pre-registered client where the authorization server supports it."},{level:"warning"});n({currentStep:"request_client_registration",lastRequest:E,lastResponse:void 0,infoLogs:P,httpHistory:[...y.httpHistory||[],{step:"request_client_registration",timestamp:Date.now(),request:E}],isInitiatingAuth:!1}),V(50);return}else{if(_){n({error:oa,isInitiatingAuth:!1});return}const g=await I("Authorization server did not advertise registration_endpoint; using pre-registered client credentials.");if(!g){n({error:sa,isInitiatingAuth:!1});return}n({currentStep:"received_client_credentials",clientId:g.clientId,clientSecret:g.clientSecret,tokenEndpointAuthMethod:g.tokenEndpointAuthMethod,infoLogs:g.infoLogs,error:void 0,isInitiatingAuth:!1})}break;case"request_client_registration":if(!y.authorizationServerMetadata?.registration_endpoint)throw new Error("No registration endpoint available");if(!y.lastRequest?.body)throw new Error("No client metadata in request");{const g=await ca({request:y.lastRequest,requestExecutor:a,httpHistory:y.httpHistory});if(g.status!=="registered"){if(n({lastResponse:g.response,httpHistory:g.httpHistory,error:g.error,isInitiatingAuth:!1}),_)return;const E=await I(g.fallbackNote);if(!E){n({error:g.errorWithFallbackHint,isInitiatingAuth:!1});return}n({currentStep:"received_client_credentials",clientId:E.clientId,clientSecret:E.clientSecret,tokenEndpointAuthMethod:E.tokenEndpointAuthMethod,infoLogs:E.infoLogs,error:void 0,isInitiatingAuth:!1});break}if(g.missingClientId){n({lastResponse:g.response,httpHistory:g.httpHistory,error:"Dynamic Client Registration response is missing a client_id.",isInitiatingAuth:!1});return}const R=ne(k(),"received_client_credentials","dcr","Dynamic Client Registration",g.infoLogData);n({currentStep:"received_client_credentials",clientId:g.credentials.clientId,clientSecret:g.credentials.clientSecret,tokenEndpointAuthMethod:Yo(g.clientInfo),lastResponse:g.response,httpHistory:g.httpHistory,infoLogs:R,error:void 0,isInitiatingAuth:!1})}break;case"cimd_prepare":n({currentStep:"cimd_fetch_request",isInitiatingAuth:!1}),V(800);return;case"cimd_fetch_request":try{const g={method:"GET",url:ee,headers:Tr(void 0)},R=Date.now(),E=await H(ee,{method:"GET"});if(!E.ok)throw new Error(`CIMD endpoint returned HTTP ${E.status}`);const P={status:E.status,statusText:E.statusText,headers:E.headers,body:E.body};n({currentStep:"cimd_metadata_response",lastRequest:g,lastResponse:P,httpHistory:[...y.httpHistory||[],{step:"cimd_fetch_request",timestamp:R,duration:Date.now()-R,request:g,response:P}],isInitiatingAuth:!1}),V(800);return}catch(g){n({error:`CIMD metadata fetch failed: ${g instanceof Error?g.message:String(g)}. Try using 'dcr' or 'preregistered' registration strategy instead.`,isInitiatingAuth:!1});return}case"cimd_metadata_response":try{const g=y.lastResponse?.body;if(!g||typeof g!="object")throw new Error("CIMD metadata document was not available");if(g.client_id!==ee)throw new Error("CIMD client_id mismatch");const R=y.authorizationServerMetadata?.client_id_metadata_document_supported,E={"Client ID":ee,"Registration Method":"Client ID Metadata Document (CIMD)","Client Name":g.client_name||"MCPJam","Redirect URIs":g.redirect_uris||[],"Token Auth Method":g.token_endpoint_auth_method||"none",Validation:"✓ Metadata fetched and validated",Note:"Server fetched and validated client metadata from URL"};R?E["Server Support"]="✓ Advertised in metadata (client_id_metadata_document_supported: true)":E["Server Support"]="⚠ Not advertised (attempting anyway)";const P=ne(k(),"received_client_credentials","cimd","Client ID Metadata Document",E);n({currentStep:"received_client_credentials",clientId:ee,clientSecret:void 0,tokenEndpointAuthMethod:"none",infoLogs:P,isInitiatingAuth:!1})}catch(g){n({error:`CIMD validation failed: ${g instanceof Error?g.message:String(g)}. Try using 'dcr' or 'preregistered' registration strategy instead.`,isInitiatingAuth:!1});return}break;case"received_client_credentials":const Se=Dr(43),pe=await na(Se),me=ne(k(),"generate_pkce_parameters","pkce-generation","Generate PKCE Parameters",{code_challenge:pe,method:"S256",...q?{resource:ie()}:{resource:"(omitted — emulated client does not send RFC 8707 resource)"}});n({currentStep:"generate_pkce_parameters",codeVerifier:Se,codeChallenge:pe,codeChallengeMethod:"S256",...q?{}:{resourceIndicatorSuppressed:!0},state:Dr(16),recordedIssuer:k().authorizationServerMetadata?.issuer,infoLogs:me,isInitiatingAuth:!1});break;case"generate_pkce_parameters":if(!y.authorizationServerMetadata?.authorization_endpoint||!y.clientId)throw new Error("Missing authorization endpoint or client ID");const Ee=new URL(y.authorizationServerMetadata.authorization_endpoint);Ee.searchParams.set("response_type","code"),Ee.searchParams.set("client_id",y.clientId),Ee.searchParams.set("redirect_uri",M),Ee.searchParams.set("code_challenge",y.codeChallenge||""),Ee.searchParams.set("code_challenge_method","S256"),Ee.searchParams.set("state",y.state||""),q&&Ee.searchParams.set("resource",ie());const Ge=Nr($,{customScopes:d,challengedScopes:y.challengedScopes,supportedScopes:y.resourceMetadata?.scopes_supported||y.authorizationServerMetadata.scopes_supported});Ge&&Ee.searchParams.set("scope",Ge);const U=ne(k(),"authorization_request","auth-url","Authorization URL",{url:Ee.toString()});n({currentStep:"authorization_request",authorizationUrl:Ee.toString(),authorizationCode:void 0,accessToken:void 0,refreshToken:void 0,tokenType:void 0,expiresIn:void 0,requestedScopes:Ge?Ge.split(/\s+/).filter(Boolean):void 0,infoLogs:U,isInitiatingAuth:!1});break;case"authorization_request":n({currentStep:"received_authorization_code",isInitiatingAuth:!1});break;case"received_authorization_code":{if(!y.authorizationCode||y.authorizationCode.trim()===""){n({error:"Authorization code is required. Please paste the code you received from the authorization server.",isInitiatingAuth:!1});return}if(!y.authorizationServerMetadata?.token_endpoint)throw new Error("Missing token endpoint");const g=aI({recordedIssuer:y.recordedIssuer,returnedIss:y.authorizationResponseIss,issParameterSupported:void 0,enforcePresentIssMismatch:!0});if(!g.ok){n({error:g.reason,isInitiatingAuth:!1});return}const R=Mr({clientId:y.clientId,clientSecret:y.clientSecret,tokenEndpointAuthMethod:zr($,y.tokenEndpointAuthMethod)}),E={grant_type:"authorization_code",code:y.authorizationCode,redirect_uri:M,...R.bodyParams};y.codeVerifier&&(E.code_verifier=y.codeVerifier),q&&(E.resource=ie());const P={method:"POST",url:y.authorizationServerMetadata.token_endpoint,headers:{"Content-Type":"application/x-www-form-urlencoded",...R.headers},body:E};n({currentStep:"token_request",lastRequest:P,lastResponse:void 0,...q?{}:{resourceIndicatorSuppressed:!0},accessToken:void 0,refreshToken:void 0,httpHistory:[...y.httpHistory||[],{step:"token_request",timestamp:Date.now(),request:P}],isInitiatingAuth:!1}),V(50);return}case"token_request":if(!y.authorizationServerMetadata?.token_endpoint)throw new Error("Missing token endpoint");if(!y.authorizationCode)throw new Error("Missing authorization code");if(!y.codeVerifier)throw new Error("PKCE code_verifier is missing - cannot exchange token");try{const g=Mr({clientId:y.clientId,clientSecret:y.clientSecret,tokenEndpointAuthMethod:zr($,y.tokenEndpointAuthMethod)}),R=new URLSearchParams({grant_type:"authorization_code",code:y.authorizationCode,redirect_uri:M,code_verifier:y.codeVerifier||"",...g.bodyParams});q&&R.set("resource",ie());const E=await H(y.authorizationServerMetadata.token_endpoint,{method:"POST",headers:{...at(p,{"Content-Type":"application/x-www-form-urlencoded"}),...g.headers},body:R.toString()}),P={status:E.status,statusText:E.statusText,headers:E.headers,body:E.body},F=[...y.httpHistory||[]];if(F.length>0){const G=F[F.length-1];G.response=P,G.duration=Date.now()-(G.timestamp||Date.now())}if(!E.ok){n({lastResponse:P,httpHistory:F,authorizationCode:void 0,error:Qo(E),isInitiatingAuth:!1});return}const B=E.body;let D=(k().infoLogs||[]).filter(G=>G.id!=="auth-code"&&G.id!=="oauth-tokens"&&G.id!=="token");if(y.authorizationCode&&(D=[...D,{id:"auth-code",level:"info",step:"authorization_request",label:"Authorization Code",data:{code:y.authorizationCode},timestamp:Date.now()}]),B.access_token){const G={access_token:B.access_token};B.refresh_token&&(G.refresh_token=B.refresh_token),D=[...D,{id:"oauth-tokens",level:"info",step:"token_request",label:"OAuth Tokens",data:G,timestamp:Date.now()}]}if(B.access_token){const G=Lr(B.access_token);if(G){const J={...G};J.exp&&(J.exp=`${J.exp} (${De(J.exp)})`),J.iat&&(J.iat=`${J.iat} (${De(J.iat)})`),J.nbf&&(J.nbf=`${J.nbf} (${De(J.nbf)})`);const Ut={...J};if(J.aud){const Vr=y.serverUrl,ui=(Array.isArray(J.aud)?J.aud:[J.aud]).some(Ra=>Ra===Vr);Ut._validation={expected_audience:Vr,audience_matches:ui,note:ui?"✓ Token audience matches MCP server":"⚠ Token audience does not match MCP server (security risk)"}}else Ut._validation={note:"⚠ No audience claim found - server should validate token binding"};D=[...D,{id:"token",level:"info",step:"token_request",label:"Access Token (Decoded JWT)",data:Ut,timestamp:Date.now()}]}}if(B.id_token){const G=Lr(B.id_token);if(G){const J={...G};J.exp&&(J.exp=`${J.exp} (${De(J.exp)})`),J.iat&&(J.iat=`${J.iat} (${De(J.iat)})`),J.nbf&&(J.nbf=`${J.nbf} (${De(J.nbf)})`),J.auth_time&&(J.auth_time=`${J.auth_time} (${De(J.auth_time)})`),J._note="OIDC ID Token - Used for user identity verification",D=[...D,{id:"id-token",level:"info",step:"token_request",label:"ID Token (OIDC - Decoded JWT)",data:J,timestamp:Date.now()}]}}n({currentStep:"received_access_token",accessToken:B.access_token,refreshToken:B.refresh_token,tokenType:B.token_type||"Bearer",expiresIn:B.expires_in,lastResponse:P,httpHistory:F,infoLogs:D,error:void 0,isInitiatingAuth:!1})}catch(g){const R={status:0,statusText:"Network Error",headers:{},body:{error:g instanceof Error?g.message:String(g)}},E=[...y.httpHistory||[]];if(E.length>0){const P=E[E.length-1];P.response=R,P.duration=Date.now()-(P.timestamp||Date.now())}n({lastResponse:R,httpHistory:E,error:`Token exchange failed: ${g instanceof Error?g.message:String(g)}`,isInitiatingAuth:!1})}break;case"received_access_token":if(!y.serverUrl||!y.accessToken)throw new Error("Missing server URL or access token");const W={method:"POST",url:y.serverUrl,headers:{Authorization:`Bearer ${y.accessToken}`,"Content-Type":"application/json",Accept:"application/json, text/event-stream","MCP-Protocol-Version":L,"Mcp-Method":"tools/list"},body:ks({protocolVersion:L,authMode:v,clientName:"MCPJam Inspector",clientVersion:"1.0.0",id:2})},Y=ne(k(),"authenticated_mcp_request","authenticated-verify","Authenticated MCP Verify Request (tools/list)",{Request:"Stateless tools/list with OAuth bearer token","Protocol Version":"2026-07-28",Client:"MCPJam Inspector v1.0.0",Endpoint:y.serverUrl});n({currentStep:"authenticated_mcp_request",lastRequest:W,lastResponse:void 0,httpHistory:[...y.httpHistory||[],{step:"authenticated_mcp_request",timestamp:Date.now(),request:W}],infoLogs:Y,isInitiatingAuth:!1}),V(50);return;case"authenticated_mcp_request":if(!y.serverUrl||!y.accessToken)throw new Error("Missing server URL or access token");try{const g=await H(y.serverUrl,{method:"POST",headers:lt(p,{Authorization:`Bearer ${y.accessToken}`,"Content-Type":"application/json",Accept:"application/json, text/event-stream","MCP-Protocol-Version":L,"Mcp-Method":"tools/list"}),body:JSON.stringify(ks({protocolVersion:L,authMode:v,clientName:"MCPJam Inspector",clientVersion:"1.0.0",id:2}))}),R={status:g.status,statusText:g.statusText,headers:g.headers,body:g.body},E=[...y.httpHistory||[]];if(E.length>0){const G=E[E.length-1];G.response=R,G.duration=Date.now()-(G.timestamp||Date.now())}if(!g.ok){n({lastResponse:R,httpHistory:E,error:Xo(g),isInitiatingAuth:!1});return}let P=k().infoLogs||[];const F=g.headers["content-type"]||"",B=F.includes("text/event-stream");let D=null;if(B&&g.body?.transport==="sse"?D=g.body.mcpResponse:D=g.body,B&&D?.result?.protocolVersion){const G={Transport:"Streamable HTTP","Response Format":"Server-Sent Events (streaming)","Protocol Version":D.result.protocolVersion};D.result.serverInfo&&(G["Server Name"]=D.result.serverInfo.name,G["Server Version"]=D.result.serverInfo.version),D.result.capabilities&&(G.Capabilities=D.result.capabilities),P=ne(k(),"authenticated_mcp_request","mcp-protocol","MCP Server Information",G)}else if(B)P=ne(k(),"authenticated_mcp_request","mcp-transport","MCP Transport Detected",{Transport:"Streamable HTTP","Response Format":"Server-Sent Events (streaming)","Content-Type":F,Note:"Server returned streaming response. tools/list verify response delivered via SSE stream.",Events:g.body?.events?`${g.body.events.length} events parsed`:"No events parsed"});else if(D?.result?.protocolVersion){const G={Transport:"Streamable HTTP","Response Format":"JSON","Protocol Version":D.result.protocolVersion};D.result.serverInfo&&(G["Server Name"]=D.result.serverInfo.name,G["Server Version"]=D.result.serverInfo.version),D.result.capabilities&&(G.Capabilities=D.result.capabilities),P=ne(k(),"authenticated_mcp_request","mcp-protocol","MCP Server Information",G)}else if(D?.result){const G=Array.isArray(D.result.tools)?D.result.tools.length:void 0;P=ne(k(),"authenticated_mcp_request","mcp-token-verified","Access token verified (tools/list)",{Transport:"Streamable HTTP","Response Format":"JSON",Result:"Bearer token accepted; tools/list succeeded",...G!==void 0?{"Tools listed":G}:{}})}n({currentStep:"complete",lastResponse:R,httpHistory:E,infoLogs:P,error:void 0,isInitiatingAuth:!1})}catch(g){const R={status:0,statusText:"Network Error",headers:{},body:{error:g instanceof Error?g.message:String(g)}},E=[...y.httpHistory||[]];if(E.length>0){const P=E[E.length-1];P.response=R,P.duration=Date.now()-(P.timestamp||Date.now())}n({lastResponse:R,httpHistory:E,error:`Authenticated MCP request failed: ${g instanceof Error?g.message:String(g)}`,isInitiatingAuth:!1})}break;case"complete":n({isInitiatingAuth:!1});break;default:n({isInitiatingAuth:!1})}}catch(K){const le=k(),de=It(K),$e=ne(le,le.currentStep,`error-${le.currentStep}-${Date.now()}`,"Step failed",{step:le.currentStep,request:le.lastRequest,response:le.lastResponse,error:de},{level:"error",error:de}),Re=pn(le.httpHistory,de),_e={error:de.message,infoLogs:$e,isInitiatingAuth:!1};Re&&(_e.httpHistory=Re),n(_e)}},startGuidedFlow:async()=>{n({currentStep:"idle",isInitiatingAuth:!1})},resetFlow:()=>{n(ea())}};return Q};function SL({protocolVersion:e,registrationStrategy:t,flowState:r}){switch(e){case"2025-03-26":return VA(r,t==="cimd"?"dcr":t);case"2025-06-18":return JA(r,t==="cimd"?"dcr":t);case"2025-11-25":return XA(r,t);case"2026-07-28":return nI(r,t);default:throw new Error(`Unknown protocol version: ${e}`)}}function ha(e){return e.replace(/^\[|\]$/g,"").trim().toLowerCase().replace(/\.+$/,"")}function ng(e){const t=e.split(".").map(s=>parseInt(s,10));if(t.length!==4||t.some(s=>!Number.isInteger(s)||s<0||s>255))return!0;const[r,n,i]=t;return r===0||r===10||r===100&&n>=64&&n<=127||r===127||r===169&&n===254||r===172&&n>=16&&n<=31||r===192&&n===0&&i===0||r===192&&n===0&&i===2||r===192&&n===88&&i===99||r===192&&n===168||r===198&&(n===18||n===19)||r===198&&n===51&&i===100||r===203&&n===0&&i===113||r>=224&&r<=239||r>=240}function ig(e){let t=e.trim().toLowerCase().split("%")[0];t.startsWith("[")&&t.endsWith("]")&&(t=t.slice(1,-1));const r=t.match(/^(.*:)(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/);if(r){const o=[r[2],r[3],r[4],r[5]].map(a=>parseInt(a,10));if(o.some(a=>a<0||a>255))return null;t=`${r[1]}${(o[0]<<8|o[1]).toString(16)}:${(o[2]<<8|o[3]).toString(16)}`}const n=o=>{if(o==="")return[];const a=[];for(const c of o.split(":")){if(!/^[0-9a-f]{1,4}$/.test(c))return null;a.push(parseInt(c,16))}return a},i=t.split("::");if(i.length>2)return null;if(i.length===2){const o=n(i[0]),a=n(i[1]);if(!o||!a)return null;const c=8-o.length-a.length;return c<1?null:[...o,...Array(c).fill(0),...a]}const s=n(t);return s&&s.length===8?s:null}function Hd(e,t){return ng(`${e>>8}.${e&255}.${t>>8}.${t&255}`)}function lI(e){const t=ig(e);if(!t||t.slice(0,6).every(n=>n===0)&&t[6]===0&&(t[7]===0||t[7]===1))return!0;const r=t[0]>>8;return(r&254)===252||t[0]>=65152&&t[0]<=65215||r===255||t[0]===8193&&t[1]===3512||t[0]===256&&t[1]===0&&t[2]===0&&t[3]===0?!0:t[0]===100&&t[1]===65435?t[2]===1?!0:Hd(t[6],t[7]):t[0]===0&&t[1]===0&&t[2]===0&&t[3]===0&&t[4]===0&&(t[5]===65535||t[5]===0)?Hd(t[6],t[7]):!1}function uI(e){const t=ha(e);return/^\d+\.\d+\.\d+\.\d+$/.test(t)?ng(t):t.includes(":")?lI(t):!1}function dI(e){const t=ha(e);return t==="localhost"||t.endsWith(".localhost")?!0:uI(t)}function hI(e){const t=ha(e);return/^\d+\.\d+\.\d+\.\d+$/.test(t)?sg(t):t.includes(":")?pI(t):!1}function sg(e){const t=e.split(".").map(o=>parseInt(o,10));if(t.length!==4||t.some(o=>!Number.isInteger(o)||o<0||o>255))return!0;const[r,n,i,s]=t;return r===0||r===169&&n===254||r===100&&n===100&&i===100&&s===200||r>=224&&r<=239||r>=240}function Vd(e,t){return sg(`${e>>8}.${e&255}.${t>>8}.${t&255}`)}function pI(e){const t=ig(e);return t?t.slice(0,6).every(r=>r===0)&&t[6]===0&&(t[7]===0||t[7]===1)?t[7]===0:t[0]>=65152&&t[0]<=65215||t[0]>>8===255||t[0]===256&&t[1]===0&&t[2]===0&&t[3]===0||t[0]===64768&&t[1]===3778&&t[2]===0&&t[3]===0&&t[4]===0&&t[5]===0&&t[6]===0&&t[7]===596?!0:t[0]===100&&t[1]===65435||t[0]===0&&t[1]===0&&t[2]===0&&t[3]===0&&t[4]===0&&(t[5]===65535||t[5]===0)?Vd(t[6],t[7]):!1:!0}var fI=new Set(["metadata.google.internal","metadata.goog"]);function vI(e){const t=ha(e);return fI.has(t)?!0:hI(t)}function og(e){const t=e.replace(/^\[|\]$/g,"").toLowerCase(),r=t.match(/^::(?:ffff:)?(\d{1,3})\.\d{1,3}\.\d{1,3}\.\d{1,3}$/);if(r)return parseInt(r[1],10)===127;const n=t.match(/^::(?:ffff:)?([0-9a-f]{1,4}):[0-9a-f]{1,4}$/);return n?parseInt(n[1],16)>>8===127:!1}function EL(e){if(!e)return!1;try{const t=new URL(e).hostname;return da(t)||og(t)}catch{return!1}}var pi=class extends Error{url;reason;constructor(e,t,r){super(r),this.name="OAuthOutboundUrlBlockedError",this.url=e,this.reason=t}};function gI(e,t={}){let r;try{r=new URL(e)}catch{throw new pi(e,"invalid-url","Outbound OAuth fetch URL is not a valid absolute URL")}if(r.protocol!=="https:"&&r.protocol!=="http:")throw new pi(e,"invalid-scheme",`Outbound OAuth fetch must be http(s); got "${r.protocol}"`);const n=r.hostname;if(vI(n))throw new pi(e,"private-host",`Refusing outbound OAuth fetch to link-local or cloud-metadata host "${n}"`);if(t.allowPrivateNetwork===!0)return r;if(da(n)||og(n)){if(t.allowLoopback===!0)return r;throw new pi(e,"private-host",`Refusing outbound OAuth fetch to loopback host "${n}" (no loopback opt-in)`)}if(dI(n))throw new pi(e,"private-host",`Refusing outbound OAuth fetch to private/reserved host "${n}"`);return r}var mI=class extends Error{field;constructor(e,t){super(`OAuth response from ${t} carried a redacted \`${e}\`. Trace redaction was applied to data the OAuth flow consumes; a redaction sentinel is a non-empty string, so it would be sent upstream as a credential and rejected as invalid. Redaction belongs to the trace projection layer only.`),this.name="OAuthRedactedCredentialError",this.field=e}},_I=["access_token","refresh_token","id_token","client_secret"],yI=[/^\[redacted\]$/,/^[\s\S]{4}\.\.\.\[redacted\]\.\.\.[\s\S]{2}$/];function bI(e){try{const t=new URL(e.url);return`${t.origin}${t.pathname}`}catch{return"the authorization server"}}function wI(e,t){const r=e?.body;if(!r||typeof r!="object"||Array.isArray(r))return e;const n=r;for(const i of _I){const s=n[i];if(typeof s=="string"&&yI.some(o=>o.test(s)))throw new mI(i,bI(t))}return e}function SI(e){const{protocolVersion:t,allowLoopbackMetadataFetch:r,allowPrivateMetadataFetch:n,...i}=e,s=r??!1,o=n??!1,c={...i,requestExecutor:async l=>(gI(l.url,{allowLoopback:s,allowPrivateNetwork:o}),wI(await i.requestExecutor(l),l)),customHeaders:HA(i.customHeaders,i.emulation)};switch(t){case"2025-03-26":if(e.registrationStrategy==="cimd")throw new Error("CIMD registration is not supported in 2025-03-26 protocol. Use 'dcr' or 'preregistered' instead.");return GA(c);case"2025-06-18":if(e.registrationStrategy==="cimd")throw new Error("CIMD registration is not supported in 2025-06-18 protocol. Use 'dcr' or 'preregistered' instead.");return KA(c);case"2025-11-25":return QA(c);case"2026-07-28":return cI(c);default:throw new Error(`Unknown protocol version: ${t}`)}}function kL(e){switch(e){case"2025-03-26":return"dcr";case"2025-06-18":return"dcr";case"2025-11-25":return"cimd";case"2026-07-28":return"cimd";default:return"dcr"}}function RL(e){switch(e){case"2025-03-26":return["dcr","preregistered"];case"2025-06-18":return["dcr","preregistered"];case"2025-11-25":return["cimd","dcr","preregistered"];case"2026-07-28":return["cimd","dcr","preregistered"];default:return["dcr","preregistered"]}}var AL={"2025-03-26":{label:Es("2025-03-26"),description:"Original MCP OAuth specification with direct discovery",features:["Dynamic Client Registration (DCR) SHOULD be supported","Direct RFC8414 discovery from MCP server base URL","Fallback to default endpoints (/authorize, /token, /register)","PKCE is REQUIRED for all clients","No Protected Resource Metadata (RFC9728)"]},"2025-06-18":{label:Es("2025-06-18"),description:"MCP OAuth specification with resource metadata",features:["Dynamic Client Registration (DCR) SHOULD be supported","Protected Resource Metadata (RFC9728) required","RFC8414 discovery ONLY (no OIDC) with root fallback","PKCE recommended but not strictly enforced"]},"2025-11-25":{label:Es("2025-11-25"),description:"MCP OAuth specification with CIMD support",features:["Client ID Metadata Documents (CIMD) SHOULD be supported","Protected Resource Metadata (RFC9728) required","RFC8414 OR OIDC discovery without root fallback","PKCE strictly required and enforced","Enhanced security with URL-based client IDs"]},"2026-07-28":{label:Es("2026-07-28"),description:"Newest MCP OAuth specification: 2025-11-25 discovery plus OIDC application_type",features:["Client ID Metadata Documents (CIMD) SHOULD be supported","Protected Resource Metadata (RFC9728) required","RFC8414 OR OIDC discovery without root fallback","PKCE strictly required and enforced","SEP-837: OIDC application_type sent on Dynamic Client Registration"]}},EI=["idle","request_without_token","received_401_unauthorized","discovery_start","request_resource_metadata","received_resource_metadata","request_authorization_server_metadata","received_authorization_server_metadata","cimd_prepare","cimd_fetch_request","cimd_metadata_response","request_client_registration","received_client_credentials","generate_pkce_parameters","authorization_request","received_authorization_code","token_request","received_access_token","authenticated_mcp_request","complete","verify_list_tools","verify_call_tool"],kI={idle:{title:"Idle",summary:"The OAuth flow is ready to start.",teachableMoments:["Review your server selection and OAuth configuration before starting."]},request_without_token:{title:"Initial MCP Request",summary:"The client sends an unauthenticated initialize request to discover whether OAuth is required.",teachableMoments:["OAuth flows usually begin with a protected resource request that deliberately lacks credentials.","The response determines which discovery path the client must follow."]},received_401_unauthorized:{title:"401 Unauthorized Received",summary:"The MCP server indicates OAuth is required and often provides discovery hints in WWW-Authenticate.",teachableMoments:["Look for the resource metadata URL or realm in the header to understand where discovery begins."],tips:["If you get 200 instead, the server may allow optional OAuth or anonymous access."]},discovery_start:{title:"Start Discovery",summary:"The client derives authorization server endpoints from the MCP server URL.",teachableMoments:["Legacy servers rely on RFC8414 discovery directly from the MCP base URL.","Understanding how fallback URLs are constructed helps debug missing metadata issues."]},request_resource_metadata:{title:"Request Resource Metadata",summary:"The client requests RFC9728 resource metadata to learn which authorization server to use.",teachableMoments:["Protected resource metadata links the resource to one or more authorization servers.","If this step fails, check the MCP server's well-known configuration and headers."]},received_resource_metadata:{title:"Resource Metadata Received",summary:"The response describes supported authorization servers, scopes, and bearer method details.",teachableMoments:["Validate that the authorization server URL looks correct for the environment you're targeting."]},request_authorization_server_metadata:{title:"Request Authorization Server Metadata",summary:"The client requests the authorization server's well-known metadata endpoint (RFC8414 or OIDC).",teachableMoments:["Different protocol versions prioritize different discovery strategies (path insertion, appending, etc.).","Failure here often points to misconfigured issuer URLs or CORS/proxy issues."]},received_authorization_server_metadata:{title:"Authorization Server Metadata Received",summary:"Inspector validates the authorization, token, and optional registration endpoints.",teachableMoments:["Confirm PKCE methods include S256 for modern flows.","Check the available scopes and grant types to ensure the server supports what you need."]},cimd_prepare:{title:"Prepare CIMD",summary:"Draft protocol: the client prepares to use a Client ID Metadata Document (CIMD).",teachableMoments:["CIMD replaces static client IDs with an HTTPS URL that hosts client metadata."]},cimd_fetch_request:{title:"Authorization Server Fetches CIMD",summary:"The authorization server fetches the client's metadata document over HTTPS.",teachableMoments:["Monitor this step to diagnose TLS or hosting issues with your metadata document."]},cimd_metadata_response:{title:"CIMD Validated",summary:"The client confirms the authorization server successfully read the client metadata document.",teachableMoments:["Ensure redirect URIs declared in the document match the environment you're testing."]},request_client_registration:{title:"Request Dynamic Client Registration",summary:"The client submits metadata to register a public client with the authorization server.",teachableMoments:["Dynamic registration is optional in draft flows but required in earlier specs unless you pre-register.","Watch for HTTP 4xx responses that indicate validation failures."]},received_client_credentials:{title:"Client Credentials Received",summary:"The client stores client_id (and optionally client_secret) for the remainder of the flow.",teachableMoments:["Keep an eye on whether the server returned a secret; public clients should use PKCE instead."]},generate_pkce_parameters:{title:"Generate PKCE Parameters",summary:"The client creates a code verifier and challenge to protect the authorization code exchange.",teachableMoments:["PKCE S256 is required in draft specs and strongly recommended everywhere else."]},authorization_request:{title:"Authorization Request Ready",summary:"The client composes the authorization URL and waits for the user to approve access.",teachableMoments:["Inspect the URL to ensure scopes and redirect URI are what you expect."]},received_authorization_code:{title:"Authorization Code Received",summary:"The user completed consent and the client captured the returned authorization code.",teachableMoments:["State mismatches here usually indicate multiple concurrent authorizations or stale popups."]},token_request:{title:"Request Tokens with Authorization Code",summary:"The client calls the token endpoint with the authorization code and PKCE verifier.",teachableMoments:["Token endpoint errors often reveal scope or client configuration problems."]},received_access_token:{title:"Tokens Received",summary:"The client stores access and refresh tokens for subsequent authenticated MCP requests.",teachableMoments:["Check the token type and expiry to confirm the server honored offline access or refresh tokens."]},authenticated_mcp_request:{title:"Authenticated MCP Request",summary:"The client retries the MCP initialize call with the freshly issued access token.",teachableMoments:["Use this step to validate that MCP servers accept OAuth tokens and return capabilities."]},complete:{title:"Flow Complete",summary:"The client verified the server with OAuth credentials and recorded the final response.",teachableMoments:["Continue exploring with authenticated requests or reset to run the flow again."]},verify_list_tools:{title:"Verify: List Tools",summary:"Connect to the MCP server with the obtained token and list available tools.",teachableMoments:["This step confirms the OAuth token is actually usable for MCP operations."]},verify_call_tool:{title:"Verify: Call Tool",summary:"Execute a tool on the MCP server to confirm end-to-end functionality.",teachableMoments:["Calling a tool validates not just authentication but also authorization scopes."]}};function Bd(e){return kI[e]??{title:e,summary:"No additional information available for this step."}}function _r(e){const t=EI.indexOf(e);return t===-1?Number.MAX_SAFE_INTEGER:t}function RI(e){return JSON.parse(JSON.stringify(e))}function AI(e){return{...e,request:{...e.request,url:ru(e.request.url),headers:Rd(e.request.headers),body:Wt(e.request.body)},...e.response?{response:{...e.response,headers:Rd(e.response.headers),body:Wt(e.response.body)}}:{},...e.error?{error:{...e.error,...e.error.message?{message:Ir(e.error.message)}:{},details:Wt(e.error.details)}}:{}}}function II(...e){const t=e.filter(r=>r!=null);if(t.length!==0)return Math.max(...t)}function TI(){return{syntheticStepTimestamps:{},lastSyntheticTimestamp:0}}function CI(e,t,r){if(!e)return r;const n=e.syntheticStepTimestamps[t];return typeof n=="number"?n:r}function Gd(e,t,r,n){const i=CI(t,r,n),s=e.get(r);if(s)return s.startedAt=Math.min(s.startedAt,i),s.completedAt=Math.max(s.completedAt??i,n),s;const o={step:r,startedAt:i,completedAt:n};return e.set(r,o),o}function Br(e,t,r,n,i,s){if(!n||e.has(r))return;let o=Date.now();t&&(o=Math.max(o,t.lastSyntheticTimestamp+1),t.syntheticStepTimestamps[r]=o,t.lastSyntheticTimestamp=o);const a=i==null?void 0:s?Wt(i):JSON.parse(JSON.stringify(i));e.set(r,{step:r,startedAt:o,completedAt:o,details:a})}function $I(e,t){if(e!==t.currentStep)return!1;switch(e){case"authorization_request":return!!t.authorizationUrl;case"received_authorization_code":return!!t.authorizationCode;case"received_access_token":return!!t.accessToken;case"complete":return t.currentStep==="complete";default:return!1}}function PI(e){if(!(!e||e.status<400))return Xv(e.body)??`HTTP ${e.status} ${e.statusText}`}function OI(e){if(e.error?.message)return e.error.message;if(e.step==="request_client_registration")return PI(e.response)}function Wd(e){return!e.error||!e.clientId||_r(e.currentStep)<=_r("request_client_registration")?!1:e.error.startsWith("Dynamic Client Registration failed")||e.error.startsWith("Client registration failed:")}function xI(e){const{state:t,context:r,sanitize:n=!0}=e,i=t.error?n?Ir(t.error):t.error:void 0,s={version:1,currentStep:t.currentStep,steps:[],httpHistory:(t.httpHistory??[]).map(u=>n?AI(u):RI(u)),...i?{error:i}:{}},o=_r(t.currentStep),a=new Map;for(const u of t.httpHistory??[]){const h=Gd(a,r,u.step,u.timestamp);h.details||(h.details={request:n?Wt(u.request):u.request,...u.response?{response:n?Wt(u.response):u.response}:{}});const d=OI(u);d&&(h.error=Vc(n?Ir(d):d.slice(0,500)))}for(const u of t.infoLogs??[]){const h=Gd(a,r,u.step,u.timestamp);h.message=u.label;const d=n?Wt(u.data):u.data;d&&typeof d=="object"&&d!==null&&!Array.isArray(d)&&(h.details=d),u.error?.message&&(h.error=n?Ir(u.error.message):u.error.message)}const c=Math.max(Date.now(),...(t.httpHistory??[]).map(u=>u.timestamp),...(t.infoLogs??[]).map(u=>u.timestamp),r?.lastSyntheticTimestamp??0);r&&(r.lastSyntheticTimestamp=Math.max(r.lastSyntheticTimestamp,c)),Br(a,r,"received_client_credentials",!!t.clientId,{clientId:t.clientId},n),Br(a,r,"generate_pkce_parameters",!!t.codeVerifier,{codeVerifier:t.codeVerifier},n),Br(a,r,"authorization_request",!!t.authorizationUrl,{authorizationUrl:t.authorizationUrl},n),Br(a,r,"received_authorization_code",!!t.authorizationCode,t.authorizationCode?{code:t.authorizationCode}:void 0,n),Br(a,r,"received_access_token",!!t.accessToken,{tokenType:t.tokenType,expiresIn:t.expiresIn},n),Br(a,r,"complete",t.currentStep==="complete",void 0,n);const l=a.get("request_client_registration");if(l?.error&&_r(t.currentStep)>_r("request_client_registration")&&t.clientId&&(l.recovered=!0,l.recoveredAt=II(l.recoveredAt,l.completedAt,a.get("received_client_credentials")?.startedAt),l.recoveryMessage="Using pre-registered client credentials after registration failed."),t.error&&!Wd(t)&&!a.has(t.currentStep)){Br(a,r,t.currentStep,!0,void 0,n);const u=a.get(t.currentStep);u&&(u.error=i)}return s.steps=Array.from(a.values()).sort((u,h)=>u.startedAt-h.startedAt||_r(u.step)-_r(h.step)).map(u=>{const h=_r(u.step),d=u.step===t.currentStep&&!!t.error&&!Wd(t),p=u.error??(d?i:void 0),f=u.recovered?"success":p?"error":h<o||t.currentStep==="complete"||$I(u.step,t)?"success":u.step===t.currentStep?"pending":"success";return{step:u.step,title:Bd(u.step).title,status:f,message:u.message??Bd(u.step).summary,...p?{error:p}:{},...u.details?{details:u.details}:{},...u.recovered?{recovered:!0}:{},...u.recoveredAt?{recoveredAt:u.recoveredAt}:{},...u.recoveryMessage?{recoveryMessage:u.recoveryMessage}:{},startedAt:u.startedAt,completedAt:f==="pending"?void 0:u.completedAt}}),s}function Rs(e){return{message:e instanceof Error?e.message:String(e)}}async function IL(e){const{maxSteps:t=40,onAuthorizationRequest:r,onTraceUpdate:n,getState:i,sanitizeTrace:s=!0,...o}=e;let a=e.state;const c=TI(),l=i??(()=>a),u=(v,m=l(),_=c)=>{n?.({trace:xI({state:m,context:_,sanitize:s}),state:m,reason:v})},h=v=>{a={...a,...v},e.updateState(v),u("state_update",a)},d=SI({...o,getState:l,updateState:h});let p=0;for(;l().currentStep!=="complete"&&p<t;){p+=1;const v=l();if(v.currentStep==="authorization_request"){if(!v.authorizationUrl)return h({error:"Authorization URL was not generated."}),{completed:!1,redirected:!1,state:l(),error:{message:"Authorization URL was not generated."}};if(!r)return h({error:"Authorization request requires an authorization handler."}),{completed:!1,redirected:!1,authorizationUrl:v.authorizationUrl,state:l(),error:{message:"Authorization request requires an authorization handler."}};try{const w=await r({authorizationUrl:v.authorizationUrl,state:v});if(w.type==="redirect")return u("redirect"),{completed:!1,redirected:!0,authorizationUrl:v.authorizationUrl,state:l()};h({currentStep:"received_authorization_code",authorizationCode:w.authorizationCode,error:void 0});continue}catch(w){return h({error:Rs(w).message}),{completed:!1,redirected:!1,authorizationUrl:v.authorizationUrl,state:l(),error:Rs(w)}}}const m=v.currentStep;try{await d.proceedToNextStep()}catch(w){return l().error?u("error"):h({error:Rs(w).message}),{completed:!1,redirected:!1,state:l(),error:Rs(w)}}const _=l();if(_.currentStep===m)return _.error?u("error",_):h({error:`Step ${m} did not advance.`}),{completed:!1,redirected:!1,state:l(),error:{message:l().error||`Step ${m} did not advance.`}}}const f=l();return p>=t&&f.currentStep!=="complete"?(h({error:"OAuth login exceeded its step guard."}),{completed:!1,redirected:!1,state:l(),error:{message:"OAuth login exceeded its step guard."}}):(u(f.currentStep==="complete"?"complete":"state_update"),{completed:f.currentStep==="complete",redirected:!1,authorizationUrl:f.authorizationUrl,state:f,...f.error?{error:{message:f.error}}:{}})}function TL(e){const t=NI(e.endsWith(" Configure a pre-registered client or enable DCR on the authorization server.")?e.slice(0,-(Vs.length+1)):e).slice(0,LI);return kA(t)??qI(t)}var MI=160,LI=4e3,DI=46;function NI(e){let t=e.length;for(;t>0&&e.charCodeAt(t-1)===DI;)t-=1;return t===e.length?e:e.slice(0,t)}var zI=[[/(\bCould not resolve (?:[a-z-]{1,63} ){0,8}?)[^\s"'();]{1,253}(?=[)"',]*(?:;|$))/g,"$1<host>"],[/[^\s"'()]{1,253}(?= resolves to a private or reserved address\b)/g,"<host>"],[/(\bhost \()[^\s)]{1,253}(\))/g,"$1<host>$2"],[/(\bconnection to ")[^\s"]{1,253}(")/g,"$1<host>$2"]],UI=/(?<![\w:.])(?:[0-9a-f]{0,4}:){2,7}[0-9a-f]{0,4}(?![\w:])/gi,FI=/\b(?:\d{1,3}\.){3}\d{1,3}\b/g;function qI(e){return zI.reduce((t,[r,n])=>t.replace(r,n),e.replace(/\bhttps?:\/\/[^\s"'<>)]+/g,"<url>")).replace(UI,"<ip>").replace(FI,"<ip>").replace(/\b[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\b/gi,"<id>").replace(/\b[A-Za-z0-9_-]{16,}\b/g,t=>/\d/.test(t)?"<id>":t).replace(/\s+/g," ").trim().slice(0,MI)}var CL=["server-initialize","ping","logging-set-level","completion-complete","capabilities-consistent","tools-list","tools-input-schemas-valid","tools-x-mcp-header-declarations-valid","prompts-list","resources-list","protocol-invalid-method-error","localhost-host-rebinding-rejected","localhost-host-valid-accepted","server-sse-polling-session","server-accepts-multiple-post-streams","server-sse-streams-functional","notification-post-accepted","get-stream-or-405","session-id-visible-ascii","post-response-content-type","modern-client-handshake","modern-server-discover","modern-result-type-present","modern-cacheable-result-hints","modern-cache-hint-coverage","modern-cache-hint-values-valid","modern-cache-scope-stable-across-pages","modern-protocol-version-header-mismatch","modern-method-header-mismatch","modern-name-header-mismatch","modern-unsupported-version-error","modern-missing-method-header-rejected","modern-header-names-case-insensitive","modern-undeclared-capability-error","modern-no-session-id","modern-removed-methods-not-found","modern-resource-not-found-invalid-params","modern-resource-read-no-empty-contents","modern-tool-output-schema-conformant","modern-logs-require-log-level","modern-subscription-ack-precedes-notifications","modern-subscription-filter-and-tagging","modern-subscription-graceful-close","wire-schema-valid"],jI={"2025-03-26":"legacy","2025-06-18":"legacy","2025-11-25":"legacy","2026-07-28":"modern"},$L=Object.keys(jI),PL={"server-initialize":["legacy"],ping:["legacy"],"capabilities-consistent":["legacy","modern"],"server-sse-polling-session":["legacy"],"server-accepts-multiple-post-streams":["legacy"],"server-sse-streams-functional":["legacy"],"notification-post-accepted":["legacy"],"get-stream-or-405":["legacy"],"session-id-visible-ascii":["legacy"],"post-response-content-type":["legacy","modern"],"localhost-host-rebinding-rejected":["legacy"],"localhost-host-valid-accepted":["legacy"],"tools-list":["legacy","modern"],"tools-input-schemas-valid":["legacy","modern"],"tools-x-mcp-header-declarations-valid":["modern"],"prompts-list":["legacy","modern"],"resources-list":["legacy","modern"],"logging-set-level":["legacy","modern"],"completion-complete":["legacy","modern"],"protocol-invalid-method-error":["legacy","modern"],"modern-client-handshake":["modern"],"modern-server-discover":["modern"],"modern-result-type-present":["modern"],"modern-cacheable-result-hints":["modern"],"modern-cache-hint-coverage":["modern"],"modern-cache-hint-values-valid":["modern"],"modern-cache-scope-stable-across-pages":["modern"],"modern-protocol-version-header-mismatch":["modern"],"modern-method-header-mismatch":["modern"],"modern-name-header-mismatch":["modern"],"modern-unsupported-version-error":["modern"],"modern-missing-method-header-rejected":["modern"],"modern-header-names-case-insensitive":["modern"],"modern-undeclared-capability-error":["modern"],"modern-no-session-id":["modern"],"modern-removed-methods-not-found":["modern"],"modern-resource-not-found-invalid-params":["modern"],"modern-resource-read-no-empty-contents":["modern"],"modern-tool-output-schema-conformant":["modern"],"modern-logs-require-log-level":["modern"],"modern-subscription-ack-precedes-notifications":["modern"],"modern-subscription-filter-and-tagging":["modern"],"modern-subscription-graceful-close":["modern"],"wire-schema-valid":["legacy","modern"]};function HI(){return"8.20.1"}var OL=HI();function ag(e,t){if(!t||t.pendingCheckIds.length===0)return{scored:[...e],pending:[]};const r=new Set(t.pendingCheckIds),n=[],i=[];for(const s of e)(r.has(s.id)?i:n).push(s);return{scored:n,pending:i}}var VI=95,cg=5,BI={should:2,may:1};function GI(e){const t=e.reduce((r,n)=>r+BI[n.tier],0);return Math.min(t,cg)}function fu(e,t,r,n){const i=e.passed+e.failed+e.couldNotRun,s=GI(t);let o=null;if(i>0){const a=VI*e.passed/i,c=cg-s;o=Math.round(a+c),r!=="passed"?o=Math.min(o,94):t.length>0&&(o=Math.min(o,99))}return{score:o,outcome:r,applicable:i,...e,pending:e.pending??0,advisories:t,advicePointsLost:s,...n!==void 0?{protocolVersion:n}:{}}}function vu(e,t=[],r,n){const{scored:i,pending:s}=ag(e,n),o={passed:i.filter(c=>c.status==="passed").length,failed:i.filter(c=>c.status==="failed").length,couldNotRun:i.filter(ef).length,notApplicable:i.filter(yy).length,pending:s.length},{outcome:a}=by(i);return fu(o,t,a,r)}function gu(e){const t={passed:fi(e,a=>a.passed),failed:fi(e,a=>a.failed),couldNotRun:fi(e,a=>a.couldNotRun),notApplicable:fi(e,a=>a.notApplicable),pending:fi(e,a=>a.pending??0)},r=e.flatMap(a=>a.advisories??[]),n=e.map(a=>a.outcome),i=n.includes("failed")?"failed":n.includes("incomplete")?"incomplete":"passed",s=e.filter(a=>a.applicable>0),o=new Set(s.map(a=>a.protocolVersion));return fu(t,r,i,s.length>0&&o.size===1?[...o][0]:void 0)}function fi(e,t){return e.reduce((r,n)=>r+t(n),0)}function xL(e){if(e.score===null)return`not scored — 0 applicable checks (${e.notApplicable} not applicable)`;const t=[`${e.passed}/${e.applicable} applicable checks passed`];e.failed>0&&t.push(`${e.failed} failed`),e.couldNotRun>0&&t.push(`${e.couldNotRun} could not run`),e.advisories.length>0&&t.push(`${e.advisories.length} advisor${e.advisories.length===1?"y":"ies"} (−${e.advicePointsLost})`),(e.pending??0)>0&&t.push(`${e.pending} pending (unscored by this profile)`);const r=e.protocolVersion?` [${e.protocolVersion}]`:"";return`${e.score}/100 — ${t.join(", ")}${r}`}function Zd(e){return vu(e.checks,(e.readiness??[]).filter(t=>t.informational!==!0).map(t=>({id:t.id,tier:t.specStrength==="MAY"?"may":"should"})),e.protocolVersion,e.profile)}function lg(e,t,r){const{scored:n}=ag(e,r);return vu(e,n.flatMap(i=>(i.warnings??[]).map((s,o)=>({id:`${i.id}-warning-${o+1}`,tier:"may"}))),t,r)}function Jd(e){return lg(e.checks,e.protocolVersion)}function WI(e){return lg(e.checks,e.discovery.protocolVersion,e.profile)}function Kd(e){return e.outcome==="not-applicable"?fu({passed:0,failed:0,couldNotRun:0,notApplicable:e.steps.length},[],"passed",e.protocolVersion):vu(e.steps.map(t=>({id:t.step,status:t.status,...t.skipReason?{skipReason:t.skipReason}:{},...t.error?.message?{error:{message:t.error.message}}:{}})),[],e.protocolVersion)}var ZI=8;function JI(e){return er(e,0,new WeakSet)}function er(e,t,r){if(e===null)return null;switch(typeof e){case"string":case"boolean":return e;case"number":return Number.isFinite(e)?e:String(e);case"bigint":return e.toString();case"undefined":case"function":case"symbol":return}const n=e;if(r.has(n))return"[circular]";if(t>=ZI)return"[max-depth]";if(n instanceof Date)return n.toISOString();if(n instanceof URL)return n.toString();r.add(n);try{if(Array.isArray(n))return n.map(s=>er(s,t+1,r)??null);if(n instanceof Map)return[...n.entries()].map(([s,o])=>[er(s,t+1,r)??null,er(o,t+1,r)??null]);if(n instanceof Set)return[...n].map(s=>er(s,t+1,r)??null);const i={};if(n instanceof Error){i.name=n.name,i.message=n.message;const s=n;s.code!==void 0&&(i.code=er(s.code,t+1,r)),s.statusCode!==void 0&&(i.statusCode=er(s.statusCode,t+1,r)),s.cause!==void 0&&(i.cause=er(s.cause,t+1,r))}for(const[s,o]of Object.entries(n)){const a=er(o,t+1,r);a!==void 0&&(i[s]=a)}return i}finally{r.delete(n)}}function ug(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function Un(e){const t=Object.entries(e).filter(([,r])=>r===void 0?!1:Array.isArray(r)?r.length>0:ug(r)?Object.keys(r).length>0:!0);if(t.length!==0)return JI(Object.fromEntries(t))}function KI(e){if(e.httpAttempts.length!==0)return e.httpAttempts.map(t=>`${`${t.request.method} ${t.request.url}`} → ${t.response?`${t.response.status} ${t.response.statusText}`:"No response"}`).join(`
|
|
94
94
|
`)}function YI(e,t){return{id:e.id,title:e.title,category:e.category,status:e.status,...t?.has(e.id)?{pending:!0}:{},...e.skipReason?{skipReason:e.skipReason}:{},durationMs:e.durationMs,description:e.description,...e.error?.message?{error:e.error.message}:{},...e.details!==void 0||e.error?.details!==void 0?{details:Un({details:e.details,errorDetails:e.error?.details})}:{}}}function XI(e,t){return{id:e.id,title:e.title,category:e.category,status:e.status,...t?.has(e.id)?{pending:!0}:{},...e.skipReason?{skipReason:e.skipReason}:{},durationMs:e.durationMs,description:e.description,...e.error?.message?{error:e.error.message}:{},...e.details!==void 0||e.error?.details!==void 0||e.warnings?.length?{details:Un({details:e.details,errorDetails:e.error?.details,warnings:e.warnings})}:{}}}function QI(e){const t=KI(e);return{id:e.step,title:e.title||e.step,category:"oauth",status:e.status,durationMs:e.durationMs,description:e.summary,...e.error?.message?{error:e.error.message}:{},...e.error?.details!==void 0||e.warnings?.length||e.teachableMoments?.length?{details:Un({errorDetails:e.error?.details,warnings:e.warnings,teachableMoments:e.teachableMoments})}:{},...t?{output:t}:{}}}function Jn(e){const t=e.outcome;return t!=="passed"&&t!=="failed"&&t!=="incomplete"?{}:{outcome:t,...e.incompleteReason?{incompleteReason:e.incompleteReason}:{}}}function mu(e){const t=e.map(r=>Jn(r).outcome??(r.outcome==="not-applicable"||r.passed?"passed":"failed"));if(t.includes("failed"))return{outcome:"failed"};if(t.includes("incomplete")){const r=e.find(n=>Jn(n).outcome==="incomplete");return{outcome:"incomplete",...r?.incompleteReason?{incompleteReason:r.incompleteReason}:{}}}return{outcome:"passed"}}function Yd(e,t,r){return{id:`mcp-${r+1}`,title:t,target:e.serverUrl,passed:e.passed,durationMs:e.durationMs,summary:e.summary,cases:(()=>{const n=new Set(e.profile?.pendingCheckIds??[]);return e.checks.map(i=>YI(i,n))})()}}function Wc(e,t,r,n="apps"){const i=new Set(e.profile?.pendingCheckIds??[]);return{id:`${n}-${r+1}`,title:t,target:e.target,passed:e.passed,durationMs:e.durationMs,summary:e.summary,cases:e.checks.map(s=>XI(s,i))}}function Xd(e,t,r){return{id:`oauth-${r+1}`,title:t,target:e.serverUrl,passed:e.passed,durationMs:e.durationMs,summary:e.summary,cases:e.steps.map(QI)}}function eT(e){return"checks"in e&&!("results"in e)&&"serverUrl"in e&&!("target"in e)}function tT(e){return"checks"in e&&!("results"in e)&&"target"in e}function rT(e){return"checks"in e&&!("results"in e)&&"discovery"in e&&ug(e.discovery)&&"wire"in e.discovery}function nT(e){return"steps"in e&&!("results"in e)}function iT(e){return"results"in e&&"serverUrl"in e&&!("target"in e)&&e.results.length>0&&"checks"in e.results[0]}function sT(e){return"results"in e&&"target"in e}function oT(e){return"results"in e&&"serverUrl"in e&&!("target"in e)&&e.results.length>0&&"steps"in e.results[0]}function aT(e){const t=e[0]?.profile;return t?e.every(r=>r.profile?.profileId===t.profileId&&r.profile?.profileVersion===t.profileVersion&&r.profile?.manifestDigest===t.manifestDigest)?{profile:t}:{}:{}}function cT(e){return"results"in e?{schemaVersion:1,kind:"protocol-conformance",name:e.name,passed:e.passed,...mu(e.results),score:gu(e.results.map(Zd)),...aT(e.results),durationMs:e.durationMs,groups:e.results.map((t,r)=>Yd(t,t.label,r))}:{schemaVersion:1,kind:"protocol-conformance",name:"MCP Protocol Conformance",passed:e.passed,...Jn(e),score:Zd(e),...e.profile?{profile:e.profile}:{},durationMs:e.durationMs,groups:[Yd(e,"MCP Protocol Conformance",0)]}}function lT(e){return"results"in e?{schemaVersion:1,kind:"apps-conformance",name:e.name,passed:e.passed,...mu(e.results),score:gu(e.results.map(Jd)),durationMs:e.durationMs,groups:e.results.map((t,r)=>Wc(t,t.label,r))}:{schemaVersion:1,kind:"apps-conformance",name:"MCP Apps Conformance",passed:e.passed,...Jn(e),score:Jd(e),durationMs:e.durationMs,groups:[Wc(e,"MCP Apps Conformance",0)]}}function uT(e){return"results"in e?{schemaVersion:1,kind:"oauth-conformance",name:e.name,passed:e.passed,...mu(e.results),score:gu(e.results.map(Kd)),durationMs:e.durationMs,groups:e.results.map((t,r)=>Xd(t,t.label,r))}:{schemaVersion:1,kind:"oauth-conformance",name:"OAuth Conformance",passed:e.passed,...Jn(e),score:Kd(e),durationMs:e.durationMs,groups:[Xd(e,`${e.protocolVersion}/${e.registrationStrategy}`,0)]}}function dT(e){return"lanes"in e&&"findings"in e&&"badges"in e&&!("readinessKind"in e)}var hT={kind:"claude-directory-readiness",providerName:"Claude Directory Readiness",isResult:dT,isDispositive:e=>Iy(e)};function pT(e){return e.status==="violated"?"failed":e.status==="satisfied"?"passed":"skipped"}function fT(e,t){const r=t.isDispositive,n=[],i=new Set,s=e.lanes.map(o=>{const a=e.findings.filter(c=>c.lane===o.lane);for(const c of a)i.add(c),!r(c)&&n.push({id:c.id,title:c.title,group:o.lane,kind:c.class,status:c.status,message:c.remediation??c.notEvaluatedReason,details:Un({provenance:c.provenance,source:c.source,derivedFrom:c.derivedFrom,observed:c.details})});return{id:o.lane,title:o.lane,target:e.context.target,passed:o.status==="ready",durationMs:0,summary:o.summary,cases:a.filter(r).map(c=>({id:c.id,title:c.title,category:c.class,status:pT(c),skipReason:c.status==="not-evaluated"?"could-not-run":c.status==="not-applicable"?"not-applicable":void 0,durationMs:0,description:c.remediation,error:c.status==="violated"?c.remediation??"Requirement not satisfied":c.status==="not-evaluated"?c.notEvaluatedReason:void 0,details:Un({provenance:c.provenance,intrusiveness:c.intrusiveness,source:c.source,requiresCapabilities:c.requiresCapabilities,derivedFrom:c.derivedFrom,observed:c.details})}))}});for(const o of e.findings)i.has(o)||n.push({id:o.id,title:o.title,group:o.lane,kind:o.class,status:o.status,message:o.remediation??o.notEvaluatedReason??"reported outside any lane in this result",details:Un({provenance:o.provenance,source:o.source,orphanedLane:o.lane})});return{schemaVersion:1,kind:t.kind,name:t.providerName,passed:e.status==="ready",outcome:e.status==="ready"?"passed":e.status==="not-ready"?"failed":"incomplete",incompleteReason:e.status==="incomplete"?e.summary:void 0,durationMs:e.durationMs,groups:s,advisories:n}}var vT={kind:"openai-directory-readiness",providerName:"OpenAI Plugin Directory Readiness",isResult:e=>xy(e),isDispositive:e=>tf(e)},gT=[vT,hT];function mT(e){return gT.find(t=>t.isResult(e))}function ML(e){const t=mT(e);if(t)return fT(e,t);if(eT(e)||iT(e))return cT(e);if(rT(e))return{schemaVersion:1,kind:"tasks-conformance",name:"MCP Tasks Conformance",passed:e.passed,...Jn(e),score:WI(e),...e.profile?{profile:e.profile}:{},durationMs:e.durationMs,groups:[Wc(e,"MCP Tasks Conformance",0,"tasks")]};if(tT(e)||sT(e))return lT(e);if(nT(e)||oT(e))return uT(e);throw new Error("Unsupported conformance result shape")}var LL=Object.freeze({chatgpt:!0,copilot:!0,mcpjam:!0,claude:!1,"claude-desktop":!1,cursor:!1,codex:!1,goose:!1,slack:!1,vscode:!1,notion:!1}),DL=new Set(Xl);function _T(e){const t=e.connectionRef,r=e.settings,n=r!==void 0&&(r.reasoningEffort!==void 0||r.temperature!==void 0);return{modelId:e.modelId,source:e.source,...t===void 0?{}:t.kind==="orgProvider"?{connectionRef:{kind:t.kind,id:t.id}}:{connectionRef:{kind:t.kind,providerKey:t.providerKey,...t.customProviderName!==void 0?{customProviderName:t.customProviderName}:{}}},...e.nativeModelId!==void 0?{nativeModelId:e.nativeModelId}:{},...n?{settings:{...r.reasoningEffort!==void 0?{reasoningEffort:r.reasoningEffort}:{},...r.temperature!==void 0?{temperature:r.temperature}:{}}}:{},fallback:{provider:e.fallback.provider,model:e.fallback.model}}}function NL(e){return JSON.stringify(_T(e))}var yT="=?base64?";function bT(e){const t=e.toLowerCase();if(t==="mcp-protocol-version")return"protocol-version";if(t==="mcp-method")return"method";if(t==="mcp-name")return"name";if(t==="mcp-session-id")return"session";if(t==="last-event-id")return"resumption";if(t.startsWith("mcp-param-"))return"param"}function wT(e){const t=globalThis;if(typeof t.atob=="function"){const r=t.atob(e),n=new Uint8Array(r.length);for(let i=0;i<r.length;i+=1)n[i]=r.charCodeAt(i);return new TextDecoder("utf-8",{fatal:!0}).decode(n)}if(t.Buffer)return t.Buffer.from(e,"base64").toString("utf8");throw new Error("no base64 decoder available")}function Bs(e){if(!e.startsWith("=?base64?")||!e.endsWith("?=")||e.length<11)return{raw:e,encoded:!1,value:e};const t=e.slice(9,e.length-2);try{return{raw:e,encoded:!0,value:wT(t)}}catch(r){return{raw:e,encoded:!0,value:e,decodeError:r instanceof Error?r.message:String(r)}}}var ST=new Set(["tools/call","resources/read","prompts/get"]),dg=new Set(["tasks/get","tasks/update","tasks/cancel"]);function ET(e){return e===void 0?!1:ST.has(e)||dg.has(e)}var Qd=["protocol-version","method","name","param","session","resumption"];function kT(e){return e!==void 0&&dg.has(e)?".params.taskId":e==="resources/read"?".params.uri":".params.name"}function RT(e){const t=e.declarations??[],r=DT(t,e.arguments);return t.map(n=>{const i=`${hg}${n.headerName}`,s=r[i];return{header:i.toLowerCase(),displayName:i,expected:s===void 0?void 0:Bs(s).value,bodyField:`.params.arguments${n.path.map(o=>`.${o}`).join("")}`}})}function zL(e,t,r){const n=new Map;for(const[d,p]of Object.entries(e))n.set(d.toLowerCase(),{name:d,value:p});const i=n.get("mcp-protocol-version")?.value??t?.protocolVersion,s=!!i&&yk(i)&&bk(i)&&!!t,o=[],a=new Set,c=s&&t?[{header:"mcp-protocol-version",family:"protocol-version",bodyValue:t.protocolVersion,bodyField:"._meta protocolVersion",required:!0},{header:"mcp-method",family:"method",bodyValue:t.method,bodyField:".method",required:!0},{header:"mcp-name",family:"name",bodyValue:t.name,bodyField:kT(t.method),required:ET(t.method)}]:[];for(const d of c){a.add(d.header);const p=n.get(d.header);if(!p){d.required&&d.bodyValue!==void 0?o.push({name:d.header,family:d.family,status:"missing",bodyValue:d.bodyValue,bodyField:d.bodyField}):!d.required&&t?.method!==void 0&&o.push({name:d.header,family:d.family,status:"not-required"});continue}const f=Bs(p.value),v={name:p.name,family:d.family,raw:p.value,decoded:f.encoded&&!f.decodeError?f.value:void 0};f.decodeError?o.push({...v,status:"undecodable"}):d.bodyValue===void 0?o.push({...v,status:"unchecked"}):f.value===d.bodyValue?o.push({...v,status:"match",bodyField:d.bodyField}):o.push({...v,status:"mismatch",bodyValue:d.bodyValue,bodyField:d.bodyField})}const l=r!==void 0&&"arguments"in r,u=s&&r?RT(r):[],h=s&&r?.declarations!==void 0;for(const d of u){a.add(d.header);const p=n.get(d.header);if(!p){if(!l){o.push({name:d.displayName,family:"param",status:"unchecked"});continue}o.push(d.expected===void 0?{name:d.displayName,family:"param",status:"not-required"}:{name:d.displayName,family:"param",status:"missing",bodyValue:d.expected,bodyField:d.bodyField});continue}const f=Bs(p.value),v={name:p.name,family:"param",raw:p.value,decoded:f.encoded&&!f.decodeError?f.value:void 0};f.decodeError?o.push({...v,status:"undecodable"}):l?d.expected===void 0?o.push({...v,status:"mismatch",bodyValue:"(absent from arguments)",bodyField:d.bodyField}):f.value===d.expected?o.push({...v,status:"match",bodyField:d.bodyField}):o.push({...v,status:"mismatch",bodyValue:d.expected,bodyField:d.bodyField}):o.push({...v,status:"unchecked"})}for(const[d,p]of n){if(a.has(d))continue;const f=bT(p.name);if(!f)continue;const v=Bs(p.value),m=s&&f==="param"&&!!v.decodeError,_=h&&f==="param"&&!m;o.push({name:p.name,family:f,raw:p.value,decoded:v.encoded&&!v.decodeError?v.value:void 0,status:m?"undecodable":_?"undeclared":"unchecked"})}return o.sort((d,p)=>Qd.indexOf(d.family)-Qd.indexOf(p.family)||d.name.localeCompare(p.name))}var eh="x-mcp-header",hg="Mcp-Param-",AT=/^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/,IT=new Set(["string","integer","boolean","number"]),TT=["items","prefixItems","contains","additionalProperties","unevaluatedProperties","unevaluatedItems","propertyNames","patternProperties","dependentSchemas","oneOf","anyOf","allOf","not","if","then","else","$defs","definitions"],CT=new Set(["patternProperties","dependentSchemas","$defs","definitions"]);function $T(e){return e.length===0?"<root>":e.join(".")}function UL(e){const t=[],r=new Map,n=(s,o,a)=>{if(s===null||typeof s!="object")return;const c=s;if(eh in c){const u=$T(o);if(!a||o.length===0)return`${u}: x-mcp-header is only permitted on properties statically reachable via a chain of 'properties' keys (not under items, additionalProperties, oneOf/anyOf/allOf/not, if/then/else, or $ref)`;const h=c[eh];if(typeof h!="string"||h.length===0)return`${u}: x-mcp-header MUST be a non-empty string`;if(!AT.test(h))return`${u}: x-mcp-header '${h}' is not a valid RFC 9110 token (no spaces, control characters or HTTP delimiters)`;const d=typeof c.type=="string"?c.type:void 0;if(d===void 0||!IT.has(d))return`${u}: x-mcp-header is only permitted on primitive-typed properties (string, integer, boolean); got ${d??"<none>"}`;const p=h.toLowerCase(),f=r.get(p);if(f!==void 0)return`x-mcp-header '${h}' is not case-insensitively unique (also declared as '${f}')`;r.set(p,h),t.push({path:o,headerName:h,type:d})}const l=c.properties;if(l!==null&&typeof l=="object")for(const[u,h]of Object.entries(l)){const d=n(h,[...o,u],a);if(d!==void 0)return d}for(const u of TT){const h=c[u];if(h===void 0)continue;const d=h!==null&&typeof h=="object"&&CT.has(u),p=Array.isArray(h)?h:d?Object.values(h):[h];for(const f of p){const v=n(f,[...o,`<${u}>`],!1);if(v!==void 0)return v}}},i=n(e,[],!0);return i===void 0?{valid:!0,declarations:t}:{valid:!1,reason:i}}function PT(e){const t=globalThis,r=new TextEncoder().encode(e);if(typeof t.btoa=="function"){let n="";for(const i of r)n+=String.fromCodePoint(i);return t.btoa(n)}if(t.Buffer)return t.Buffer.from(e,"utf8").toString("base64");throw new Error("no base64 encoder available")}function OT(e){if(e.length===0||e.startsWith("=?base64?")&&e.endsWith("?=")||e!==e.trim())return!0;for(let t=0;t<e.length;t+=1){const r=e.codePointAt(t);if(!(r===9||r>=32&&r<=126))return!0}return!1}function xT(e){if(!OT(e))return e;const t=PT(e);return`${yT}${t}?=`}function MT(e){if(typeof e=="string")return e;if(typeof e=="boolean")return e?"true":"false";if(typeof e=="number")return!Number.isFinite(e)||Number.isInteger(e)&&!Number.isSafeInteger(e)?void 0:String(e)}function LT(e,t){let r=e;for(const n of t){if(r===null||typeof r!="object")return;r=r[n]}return r}function DT(e,t){const r={};for(const n of e){const i=LT(t,n.path);if(i==null)continue;const s=MT(i);s!==void 0&&(r[`${hg}${n.headerName}`]=xT(s))}return r}var NT="tracestate",zT="baggage",UT=/^([0-9a-f]{2})-([0-9a-f]{32})-([0-9a-f]{16})-([0-9a-f]{2})$/,FT="0".repeat(32),qT="0".repeat(16);function jT(e){if(typeof e!="string")return;const t=UT.exec(e);if(!t)return;const[,r,n,i,s]=t;if(!(r==="ff"||r!=="00")&&!(n===FT||i===qT))return{version:r,traceId:n,spanId:i,flags:s,sampled:(Number.parseInt(s,16)&1)===1}}function HT(e){return jT(e)!==void 0}var VT=32,BT=/^(?:[a-z][a-z0-9_\-*/]{0,255}|[a-z0-9][a-z0-9_\-*/]{0,240}@[a-z][a-z0-9_\-*/]{0,13})$/,GT=/^[\x20-\x2b\x2d-\x3c\x3e-\x7e]{0,255}[\x21-\x2b\x2d-\x3c\x3e-\x7e]$/;function WT(e){if(typeof e!="string"||e.length===0)return!1;const t=e.split(",");if(t.length>VT)return!1;let r=0;for(const n of t){const i=n.trim();if(i.length===0)continue;r+=1;const s=i.indexOf("=");if(s<=0||!BT.test(i.slice(0,s))||!GT.test(i.slice(s+1)))return!1}return r>0}var ZT=180,JT=8192,KT=/^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/,th=/^[\x21\x23-\x2b\x2d-\x3a\x3c-\x5b\x5d-\x7e]*$/;function YT(e){if(typeof e!="string"||e.length===0||e.length>JT)return!1;const t=e.split(",");if(t.length>ZT)return!1;for(const r of t){const n=r.trim();if(n.length===0)return!1;const[i,...s]=n.split(";"),o=i.indexOf("=");if(o<=0||!KT.test(i.slice(0,o).trim())||!th.test(i.slice(o+1).trim()))return!1;for(const a of s)if(!th.test(a.replace(/=/g,"").trim()))return!1}return!0}function XT(e){if(!(!e||!HT(e.traceparent)))return{traceparent:e.traceparent,...WT(e.tracestate)?{tracestate:e.tracestate}:{},...YT(e.baggage)?{baggage:e.baggage}:{}}}function FL(e){if(!e||typeof e!="object")return;const t=r=>{const n=e[r];return typeof n=="string"?n:void 0};return XT({traceparent:t("traceparent")??"",tracestate:t(NT),baggage:t(zT)})}var qL=Rt.MissingRequiredClientCapability,A="u">typeof window?window:void 0,ut="u">typeof globalThis?globalThis:A,rt=ut?.navigator,N=ut?.document,je=ut?.location,Yi=ut?.fetch,_u=ut?.XMLHttpRequest&&"withCredentials"in new ut.XMLHttpRequest?ut.XMLHttpRequest:void 0,rh=ut?.AbortController,QT=ut?.CompressionStream,pt=rt?.userAgent;function pg(){return!(!A||A.navigator.onLine===!1)}var vi=typeof globalThis<"u"?globalThis:A;vi&&typeof self>"u"&&(vi.self=vi),vi&&typeof File>"u"&&(vi.File=function(){});var te=A??{},nh="0.9.0",ar={DEBUG:!1,LIB_VERSION:nh,LIB_NAME:"browser-common",JS_SDK_VERSION:nh},Ht=(function(e){return e.AnonymousId="anonymous_id",e.DistinctId="distinct_id",e.Props="props",e.EnablePersonProcessing="enable_person_processing",e.PersonMode="person_mode",e.FeatureFlagDetails="feature_flag_details",e.FeatureFlags="feature_flags",e.FeatureFlagPayloads="feature_flag_payloads",e.BootstrapFeatureFlagDetails="bootstrap_feature_flag_details",e.BootstrapFeatureFlags="bootstrap_feature_flags",e.BootstrapFeatureFlagPayloads="bootstrap_feature_flag_payloads",e.OverrideFeatureFlags="override_feature_flags",e.Queue="queue",e.AiQueue="ai_queue",e.AiCaptureQueue="ai_capture_queue",e.LogsQueue="logs_queue",e.OptedOut="opted_out",e.SessionId="session_id",e.SessionStartTimestamp="session_start_timestamp",e.SessionLastTimestamp="session_timestamp",e.PersonProperties="person_properties",e.GroupProperties="group_properties",e.InstalledAppBuild="installed_app_build",e.InstalledAppVersion="installed_app_version",e.SessionReplay="session_replay",e.PushRegistered="push_registered",e.SessionReplayEventTriggerActivatedSession="session_replay_event_trigger_activated_session",e.SurveyLastSeenDate="survey_last_seen_date",e.SurveysInProgress="surveys_in_progress",e.SurveysSeen="surveys_seen",e.Surveys="surveys",e.RemoteConfig="remote_config",e.FlagsEndpointWasHit="flags_endpoint_was_hit",e.DeviceId="device_id",e})({}),Zc=(function(e){return e.GZipJS="gzip-js",e.Base64="base64",e})({}),eC=["$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"],tC=["token"];function ue(e,t){return e.indexOf(t)!==-1}var pa=function(e){return e.trim()},Jc=function(e){return e.replace(/^\$/,"")};function fg(e){var t;const r=[];return(t=JSON.stringify(e,function(n,i){if(typeof i=="bigint")return i.toString();if(typeof i!="function"&&typeof i!="symbol"){if(i instanceof Error)return{name:i.name,message:i.message,stack:i.stack};if(i&&typeof i=="object"){for(;r.length>0&&r[r.length-1]!==this;)r.pop();if(r.includes(i))return"[Circular]";r.push(i)}return i}}))!==null&&t!==void 0?t:"null"}var vg=Object.prototype,yu=vg.hasOwnProperty,fa=vg.toString,ce=Array.isArray||function(e){return fa.call(e)==="[object Array]"},tt=e=>typeof e=="function",be=e=>e===Object(e)&&!ce(e),_t=e=>{if(be(e)){for(const t in e)if(yu.call(e,t))return!1;return!0}return!1},O=e=>e===void 0,ye=e=>fa.call(e)=="[object String]",Oi=e=>ye(e)&&e.trim().length===0,He=e=>e===null,ge=e=>O(e)||He(e),We=e=>fa.call(e)=="[object Number]"&&e==e,tr=e=>We(e)&&e>0,vt=e=>fa.call(e)==="[object Boolean]",rC=e=>ue(eC,e),nC=e=>ue(tC,e);function gg(e){return e===null||typeof e!="object"}function po(e,t){return{}.toString.call(e)===`[object ${t}]`}function ci(e){switch({}.toString.call(e)){case"[object Error]":case"[object Exception]":case"[object DOMException]":case"[object DOMError]":case"[object WebAssembly.Exception]":return!0;default:return mg(e,Error)}}function bu(e){return"u">typeof Event&&mg(e,Event)}function mg(e,t){try{return e instanceof t}catch{return!1}}var iC=[!0,"true",1,"1","yes"],Oa=e=>ue(iC,e),sC=[!1,"false",0,"0","no"];function ih(e,t,r,n,i,s,o){try{var a=e[s](o),c=a.value}catch(l){r(l);return}a.done?t(c):Promise.resolve(c).then(n,i)}function Ue(e){return function(){var t=this,r=arguments;return new Promise(function(n,i){var s=e.apply(t,r);function o(c){ih(s,n,i,o,a,"next",c)}function a(c){ih(s,n,i,o,a,"throw",c)}o(void 0)})}}var oC=["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","pinterestbot","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"],sh=function(e,t=[]){if(!e)return!1;const r=e.toLowerCase();return oC.concat(t).some(n=>{const i=n.toLowerCase();return r.indexOf(i)!==-1})};function Bt(e,t,r,n,i){return t>r&&(n.warn("min cannot be greater than max."),t=r),We(e)?e>r?(n.warn(" cannot be greater than max: "+r+". Using max value instead."),r):t>e?(n.warn(" cannot be less than min: "+t+". Using min value instead."),t):e:(n.warn(" must be a number. using max or fallback. max: "+r+", fallback: "+i),Bt(i??r,t,r,n))}var aC=class{constructor(e){this.C={},this.I=e.I,this.R=Bt(e.bucketSize,0,100,e.$),this.A=Bt(e.refillRate,0,this.R,e.$),this.O=Bt(e.refillInterval,0,864e5,e.$)}F(e,t){const r=Math.floor((t-e.lastAccess)/this.O);r>0&&(e.tokens=Math.min(e.tokens+r*this.A,this.R),e.lastAccess=e.lastAccess+r*this.O)}consumeRateLimit(e){var t;const r=Date.now(),n=String(e);let i=this.C[n];return i?this.F(i,r):(i={tokens:this.R,lastAccess:r},this.C[n]=i),i.tokens===0||(i.tokens--,i.tokens===0&&((t=this.I)===null||t===void 0||t.call(this,e)),i.tokens===0)}stop(){this.C={}}},Kn="Mobile",Xi="Android",fo="Tablet",_g="Android Tablet",yg="iPad",bg="Apple Watch",Gs="Safari",va="BlackBerry",wg="Samsung Internet",Ws="Chrome",Sg="Chrome iOS",Eg="Internet Explorer",kg="Internet Explorer Mobile",Rg="Opera",Ag="Microsoft Edge",Zs="Firefox",Ig="Firefox iOS",vo="Nintendo",go="PlayStation",ga="Xbox",Tg="Android Mobile",Cg="Mobile Safari",xa="Windows",$g="Windows Phone",oh="Nokia",Kc="Ouya",cC="Generic "+Kn.toLowerCase(),Pg="Generic "+fo.toLowerCase(),Yc="Konqueror",Og="Oculus Browser",xg="Vivaldi",Mg="Yandex",Lg="Whale",Dg="DuckDuckGo",Ng="Pale Moon",zg="Waterfox",Xc="Brave",Ug="Claude",Fg="Codex",qg="ChatGPT",jg="Google Search App",Ma=new RegExp("Version/(\\d+(\\.\\d+)?)"),La=new RegExp("(Claude|Codex|ChatGPT)\\/(\\d+(\\.\\d+)?)"),lC=new RegExp(ga,"i"),uC=new RegExp("PlayStation \\w+","i"),dC=new RegExp("Nintendo \\w+","i"),wu=new RegExp("BlackBerry|PlayBook|BB10","i"),hC={"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"},Hg=function(e,t,r,n){return t=t||"",(function(i){return i?.brave?Xc:null})(r)||(n?.detectGoogleSearchApp&&ue(e,"GSA/")?jg:ue(e," OPR/")&&ue(e,"Mini")?"Opera Mini":ue(e," OPR/")?Rg:wu.test(e)?va:ue(e,"IEMobile")||ue(e,"WPDesktop")?kg:ue(e,"OculusBrowser")?Og:ue(e,"SamsungBrowser")?wg:ue(e,"Edge")||ue(e,"Edg/")?Ag:ue(e,"Vivaldi/")?xg:ue(e,"YaBrowser/")?Mg:ue(e,"Whale/")?Lg:ue(e,"DuckDuckGo/")||ue(e,"Ddg/")?Dg:ue(e,"Claude/")?Ug:ue(e,"Codex/")?Fg:ue(e,"ChatGPT/")?qg:ue(e,"FBIOS")?"Facebook Mobile":ue(e,"UCWEB")||ue(e,"UCBrowser")?"UC Browser":ue(e,"CriOS")?Sg:ue(e,"CrMo")||ue(e,Ws)?Ws:ue(e,Xi)&&ue(e,Gs)?Tg:ue(e,"FxiOS")?Ig:ue(e.toLowerCase(),Yc.toLowerCase())?Yc:ue(e,"Brave/")?Xc:((i,s)=>s&&ue(s,"Apple")||(function(o){return ue(o,Gs)&&!ue(o,Ws)&&!ue(o,Xi)})(i))(e,t)?ue(e,Kn)?Cg:Gs:ue(e,"PaleMoon/")?Ng:ue(e,"Waterfox/")?zg:ue(e,Zs)?Zs:ue(e,"MSIE")||ue(e,"Trident/")?Eg:ue(e,"Gecko")?Zs:"")},pC={[kg]:[new RegExp("rv:(\\d+(\\.\\d+)?)")],[Ag]:[new RegExp("Edge?\\/(\\d+(\\.\\d+)?)")],[Ws]:[new RegExp("(Chrome|CrMo)\\/(\\d+(\\.\\d+)?)")],[Sg]:[new RegExp("CriOS\\/(\\d+(\\.\\d+)?)")],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/(\\d+(\\.\\d+)?)")],[Gs]:[Ma],[Cg]:[Ma],[Rg]:[new RegExp("(Opera|OPR)\\/(\\d+(\\.\\d+)?)")],[Zs]:[new RegExp("Firefox\\/(\\d+(\\.\\d+)?)")],[Ig]:[new RegExp("FxiOS\\/(\\d+(\\.\\d+)?)")],[Yc]:[new RegExp("Konqueror[:/]?(\\d+(\\.\\d+)?)","i")],[va]:[new RegExp("BlackBerry (\\d+(\\.\\d+)?)"),Ma],[Tg]:[new RegExp("android\\s(\\d+(\\.\\d+)?)","i")],[wg]:[new RegExp("SamsungBrowser\\/(\\d+(\\.\\d+)?)")],[Og]:[new RegExp("OculusBrowser\\/(\\d+(\\.\\d+)?)")],[xg]:[new RegExp("Vivaldi\\/(\\d+(\\.\\d+)?)")],[Mg]:[new RegExp("YaBrowser\\/(\\d+(\\.\\d+)?)")],[Lg]:[new RegExp("Whale\\/(\\d+(\\.\\d+)?)")],[Xc]:[new RegExp("Brave\\/(\\d+(\\.\\d+)?)")],[Ug]:[La],[Fg]:[La],[qg]:[La],[Dg]:[new RegExp("(DuckDuckGo|Ddg)\\/(\\d+(\\.\\d+)?)")],[Ng]:[new RegExp("PaleMoon\\/(\\d+(\\.\\d+)?)")],[zg]:[new RegExp("Waterfox\\/(\\d+(\\.\\d+)?)")],[jg]:[new RegExp("GSA\\/(\\d+(\\.\\d+)?)")],[Eg]:[new RegExp("(rv:|MSIE )(\\d+(\\.\\d+)?)")],Mozilla:[new RegExp("rv:(\\d+(\\.\\d+)?)")]},fC=function(e,t,r,n){const i=Hg(e,t,r,n),s=pC[i];if(O(s))return null;for(let o=0;s.length>o;o++){const a=e.match(s[o]);if(a)return parseFloat(a[a.length-2])}return null},ah=[[new RegExp("Xbox; Xbox (.*?)[);]","i"),e=>[ga,e&&e[1]||""]],[new RegExp(vo,"i"),[vo,""]],[new RegExp(go,"i"),[go,""]],[wu,[va,""]],[new RegExp(xa,"i"),(e,t)=>{if(/Phone/.test(t)||/WPDesktop/.test(t))return[$g,""];if(new RegExp(Kn).test(t)&&!/IEMobile\b/.test(t))return["Windows Mobile",""];const r=/Windows NT ([0-9.]+)/i.exec(t);if(r&&r[1]){let n=hC[r[1]]||"";return/arm/i.test(t)&&(n="RT"),[xa,n]}return[xa,""]}],[/((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=O(e[2])?e[3]:e[2]),["watchOS",t]}],[new RegExp("(Android (\\d+)\\.(\\d+)\\.?(\\d+)?|Android)","i"),e=>e&&e[2]?[Xi,[e[2],e[3],e[4]||"0"].join(".")]:[Xi,""]],[/Mac OS X (\d+)[_.](\d+)[_.]?(\d+)?/i,e=>{const t=["Mac OS X",""];return e&&e[1]&&(t[1]=[e[1],e[2],e[3]||"0"].join(".")),t}],[/Mac/i,["Mac OS X",""]],[/CrOS/,["Chrome OS",""]],[/Linux|debian/i,["Linux",""]]],Vg=function(e){for(let t=0;ah.length>t;t++){const[r,n]=ah[t],i=r.exec(e),s=i&&(tt(n)?n(i,e):n);if(s)return s}return["",""]},Bg=function(e){return dC.test(e)?vo:uC.test(e)?go:lC.test(e)?ga:new RegExp(Kc,"i").test(e)?Kc:new RegExp("(Windows Phone|WPDesktop)","i").test(e)?$g:/iPad/.test(e)?yg:/iPod/.test(e)?"iPod Touch":/iPhone/.test(e)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(e)?bg:wu.test(e)?va:/(kobo)\s(ereader|touch)/i.test(e)?"Kobo":new RegExp(oh,"i").test(e)?oh:/(kf[a-z]{2}wi|aeo[c-r]{2})( bui|\))/i.test(e)||/(kf[a-z]+)( bui|\)).+silk\//i.test(e)?"Kindle Fire":/(Android|ZTE)/i.test(e)?new RegExp(Kn).test(e)&&!/(9138B|TB782B|Nexus [97]|pixel c|HUAWEISHT|BTV|noble nook|smart ultra 6)/i.test(e)||/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)?Xi:_g:new RegExp("(pda|Mobile)","i").test(e)?cC:new RegExp(fo,"i").test(e)&&!new RegExp("Tablet pc","i").test(e)?Pg:""},vC=function(e,t){var r;const n=Bg(e);return n===yg||n===_g||n==="Kobo"||n==="Kindle Fire"||n===Pg?fo:n===vo||n===ga||n===go||n===Kc?"Console":n===bg?"Wearable":n?Kn:t?.userAgentDataPlatform==="Android"&&((r=t?.maxTouchPoints)!==null&&r!==void 0?r:0)>0?600>Math.min((i=t?.screenWidth)!==null&&i!==void 0?i:0,(s=t?.screenHeight)!==null&&s!==void 0?s:0)/((o=t?.devicePixelRatio)!==null&&o!==void 0?o:1)?Kn:fo:"Desktop";var i,s,o},Da=/\bFBAV\/(\d+(?:\.\d+)*)/i,ch=[[/\bInstagram(?:[ /](\d+(?:\.\d+)*))?\b/i,"Instagram"],[/\bBarcelona[ /](\d+(?:\.\d+)*)?/i,"Threads"],[/\b(?:MessengerForiOS|(?:FBAN|FB_IAB)\/Orca-Android)\b/i,"Messenger",Da],[/\bFBAN\/EMA\b/i,"Facebook Lite",Da],[/\b(?:FBIOS|(?:FBAN|FB_IAB)\/(?:FB4A|FBIOS))\b/i,"Facebook",Da],[/\bLinkedInApp(?:\]?\/(\d+(?:\.\d+)*))?\b/i,"LinkedIn"],[/\bTwitter(?:Android| for (?:iPhone|iPad|Android))(?:\/(\d+(?:\.\d+)*))?\b/i,"Twitter"],[/\b(?:musical_ly|trill)(?:[_/](\d+\.\d+(?:\.\d+)*))?(?=\b|_)/i,"TikTok",/\bapp_version\/(\d+(?:\.\d+)*)/i],[/\b(?:MicroMessenger|WeChat)\/(\d+(?:\.\d+)*)?/i,"WeChat"],[/\bLine\/(\d+(?:\.\d+)*)?/i,"Line"],[/\bGSA\/(\d+(?:\.\d+)*)?/i,"Google"],[/\[Pinterest\/(?:iOS|Android)\b|\bPinterest(?: for (?:Android(?: Tablet)?|iOS))?\/(\d+(?:\.\d+)*)/i,"Pinterest"],[/\b(?:WA4A|WAiOS)\/(\d+(?:\.\d+)*)?/i,"WhatsApp"],[/\bSnapchat[ /](\d+(?:\.\d+)*)?/i,"Snapchat"],[/\bBing(?:Web|Sapphire)\/(\d+(?:\.\d+)*)?/i,"Bing"],[/\bNAVER\(inapp; search;/i,"Naver",/\bNAVER\(inapp; search;[^;)]*; (\d+(?:\.\d+)*)/i],[/\bKAKAOTALK[ /](\d+\.\d+(?:\.\d+)*)?/i,"KakaoTalk"]],Qc="[Truncated]",us="[Unserializable]";function Fn(e){let t="";for(let r=0;e.length>r;r++){const n=e.charCodeAt(r);if(55296>n||n>56319)t+=56320>n||n>57343?e[r]:"�";else{const i=e.charCodeAt(r+1);56320>i||i>57343?t+="�":(t+=e[r]+e[r+1],r++)}}return t}function Gg(e,t){if(!t)return e;let r=[];try{r=Object.keys(t)}catch{r=[]}for(const n of r){let i;try{i=t[n]}catch{i=us}Object.defineProperty(e,n,{value:i,enumerable:!0,writable:!0,configurable:!0})}return e}var Js=3e5,Wg=class{record(e){if(e.kind==="too-large")return;if(e.kind!=="retry-later")return void this.reset();if(!e.retryAfterMs)return;const t=this.isOpen(),r=Date.now(),n=Math.min(e.retryAfterMs,Js);if(!t)return this.ts=r,void(this.es=r+n);this.es=Math.max(this.es,Math.min(r+n,this.ts+Js))}remainingMs(){const e=Date.now();if(this.ts-5e3>e)return this.reset(),0;const t=Math.min(Js,Math.max(0,this.es-e));return t===0&&this.reset(),t}isOpen(){return this.remainingMs()>0}reset(){this.es=0,this.ts=0}constructor(){this.es=0,this.ts=0}},gC=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function lh(e,t){return typeof(r=e)=="string"&&gC.test(r)?e:t();var r}function Zg(e,t){const r=new Error(t);try{Object.defineProperty(r,"name",{value:e,writable:!0,enumerable:!0,configurable:!0})}catch{}return r}function Ur(e){return e&&e.split("#")[0]}function uh(e){try{return e()}catch{return}}function Jg(e,t){const r=setTimeout(e,t);return r!=null&&r.unref&&r?.unref(),r}function dh(e,t,r){return Kg.apply(this,arguments)}function Kg(){return(Kg=Ue(function*(e,t,r){let n;try{return yield Promise.race([e,new Promise((i,s)=>{n=Jg(()=>{try{r?.(),i()}catch(o){s(o)}},t)})])}finally{clearTimeout(n)}})).apply(this,arguments)}var As,hh,Na;function mC(e){const t=globalThis._posthogChunkIds;if(!t)return;const r=Object.keys(t);return Na&&r.length===hh||(hh=r.length,Na=r.reduce((n,i)=>{As||(As={});const s=As[i];if(s)n[s[0]]=s[1];else{const o=e(i);for(let a=o.length-1;a>=0;a--){const c=o[a],l=c?.filename,u=t[i];if(l&&u){n[l]=u,As[i]=[l,u];break}}}return n},{})),Na}function xi(e){return xi=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},xi(e)}function _C(e,t,r){return(t=(function(n){var i=(function(s){if(xi(s)!="object"||!s)return s;var o=s[Symbol.toPrimitive];if(o!==void 0){var a=o.call(s,"string");if(xi(a)!="object")return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(s)})(n);return xi(i)=="symbol"?i:i+""})(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function ph(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),r.push.apply(r,n)}return r}function b(e){for(var t=1;arguments.length>t;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?ph(Object(r),!0).forEach(function(n){_C(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ph(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}var yC=class{constructor(e,t,r=[]){this.coercers=e,this.stackParser=t,this.modifiers=r}buildFromUnknown(e,t={}){const r=t&&t.mechanism||{handled:!0,type:"generic"},n=this.buildCoercingContext(r,t,0).apply(e),i=this.buildParsingContext(t),s=this.parseStacktrace(n,i);return{$exception_list:this.convertToExceptionList(s,r),$exception_level:"error"}}modifyFrames(e){var t=this;return Ue(function*(){for(const r of e)r.stacktrace&&r.stacktrace.frames&&ce(r.stacktrace.frames)&&(r.stacktrace.frames=yield t.applyModifiers(r.stacktrace.frames));return e})()}coerceFallback(e){var t;return{type:"Error",value:"Unknown error",stack:(t=e.syntheticException)===null||t===void 0?void 0:t.stack,synthetic:!0}}parseStacktrace(e,t){var r;let n,i;if(e.cause!=null&&(n=this.parseStacktrace(e.cause,t)),e.stack!=""&&e.stack!=null)try{i=this.applyChunkIds(this.stackParser(e.stack,e.synthetic?t.skipFirstLines:0),t.chunkIdMap)}catch{}return b(b({},e),{},{cause:n,stack:i,errors:(r=e.errors)===null||r===void 0?void 0:r.map(s=>this.parseStacktrace(s,t))})}applyChunkIds(e,t){return e.map(r=>(r.filename&&t&&(r.chunk_id=t[r.filename]),r))}applyCoercers(e,t){for(const r of this.coercers)if(r.match(e))return r.coerce(e,t);return this.coerceFallback(t)}applyModifiers(e){var t=this;return Ue(function*(){let r=e;for(const n of t.modifiers)r=yield n(r);return r})()}convertToExceptionList(e,t){const r=[],n=(i,s,o)=>{var a;const c=r.length,l=s===void 0?b(b({type:typeof t.type=="string"&&t.type.length>0?t.type:"generic"},typeof t.handled=="boolean"?{handled:t.handled}:t.handled===void 0?{handled:!0}:{}),{},{synthetic:typeof t.synthetic=="boolean"?t.synthetic:i.synthetic,exception_id:c}):{type:"chained",source:o,synthetic:i.synthetic,exception_id:c,parent_id:s},u={type:i.type,value:i.value,mechanism:l};i.stack&&(u.stacktrace={type:"raw",frames:i.stack}),r.push(u),i.cause&&n(i.cause,c,"cause");for(const h of(a=i.errors)!==null&&a!==void 0?a:[])n(h,c,"member")};return n(e),r}buildParsingContext(e){var t;return{chunkIdMap:mC(this.stackParser),skipFirstLines:(t=e.skipFirstLines)!==null&&t!==void 0?t:1}}getAggregateErrors(e){try{if(ci(e)){let r=Object.getPrototypeOf(e);for(let n=0;r&&100>n;n++){var t;const i=(t=Object.getOwnPropertyDescriptor(r,"constructor"))===null||t===void 0?void 0:t.value;if(typeof i=="function"&&i.name==="AggregateError"){const s=e.errors;return ce(s)?s:void 0}r=Object.getPrototypeOf(r)}}}catch{}}buildCoercingContext(e,t,r=0){let n=0,i=0,s=!1;const o=new Set,a=[],c={},l=(d,p,f=0)=>{const v=u(p,f),m=v.apply;if(v.apply=$=>{a.push(d);try{return m($)}finally{a.pop()}},f>4||f>0&&a.indexOf(d)!==-1)return this.coerceFallback(v);const _=typeof d=="object"&&d!==null||typeof d=="function";if(f===0&&n>=50||_&&o.has(d))return;_&&o.add(d),f===0&&n++;const w=this.getAggregateErrors(d);let S,T;s||(s=!!w);try{if(S=this.applyCoercers(d,v),!S)throw c}catch($){if($===c)return void(f===0&&n--);if(!s)throw $;S=this.coerceFallback(v)}if(!w||n>=50)return S;try{T=w.length}catch{return S}if(!Number.isInteger(T)||0>T||T>4294967295)return S;const C=[];for(let $=0;50>n&&1e3>i&&T>$;$++){let M;i++;try{M=v.next(w[$])}catch{n++,M=this.coerceFallback(u(p+1))}M&&C.push(M)}return b(b({},S),{},{errors:C})},u=(d,p=0)=>b(b({},t),{},{syntheticException:d==0?t.syntheticException:void 0,mechanism:d==0?e:{},apply(f){const v=l(f,d,p+1);if(!v)throw c;return v},next:f=>l(f,d+1)}),h=u(r);return b(b({},h),{},{apply:d=>{var p;return(p=l(d,r))!==null&&p!==void 0?p:this.coerceFallback(h)}})}},bC=/^([a-z][a-z0-9.+-]+):/i,wC=["http","https","file","blob","app","capacitor","ionic","webpack","webpack-internal","ng"];function SC(e){if(!e||e==="<anonymous>")return!1;const t=bC.exec(e);return!t||wC.includes(t[1].toLowerCase())}function el(e,t,r,n,i){const s={platform:e,filename:t,function:r==="<anonymous>"?"?":r,in_app:SC(t)};return O(n)||(s.lineno=n),O(i)||(s.colno=i),s}var Yg=(e,t)=>{const r=e.indexOf("safari-extension")!==-1,n=e.indexOf("safari-web-extension")!==-1;return r||n?[e.indexOf("@")!==-1?e.split("@")[0]:"?",r?`safari-extension:${t}`:`safari-web-extension:${t}`]:[e,t]},EC=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,kC=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,RC=/\((\S*)(?::(\d+))(?::(\d+))\)/,AC=(e,t)=>{const r=EC.exec(e);if(r){const[,i,s,o]=r;return el(t,i,"?",+s,+o)}const n=kC.exec(e);if(n){if(n[2]&&n[2].indexOf("eval")===0){const o=RC.exec(n[2]);o&&(n[2]=o[1],n[3]=o[2],n[4]=o[3])}const[i,s]=Yg(n[1]||"?",n[2]);return el(t,s,i,n[3]?+n[3]:void 0,n[4]?+n[4]:void 0)}},IC=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,TC=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,CC=(e,t)=>{const r=IC.exec(e);if(r){if(r[3]&&r[3].indexOf(" > eval")>-1){const s=TC.exec(r[3]);s&&(r[1]=r[1]||"eval",r[3]=s[1],r[4]=s[2],r[5]="")}let n=r[3],i=r[1]||"?";return[i,n]=Yg(i,n),el(t,n,i,r[4]?+r[4]:void 0,r[5]?+r[5]:void 0)}},fh=/\(error: (.*)\)/;function Su(e,t){return e.filename===t.filename&&e.function===t.function&&e.module===t.module&&e.lineno===t.lineno&&e.colno===t.colno}function $C(e){for(let t=1;10>=t;t++){const r=e.length-2*t;if(0>r)break;let n=!0;for(let i=0;t>i;i++)if(!Su(e[r+i],e[r+t+i])){n=!1;break}if(n){for(let i=0;t>i;i++)e[r+i]=e[r+t+i];return e.length=r+t,{start:r,length:t}}}}function PC(e,t){const r=t.start+t.length,n=Qg(e,t);n&&e.splice(r+n===e.length?r:t.start,n)}function Xg(e,t){let r=t.start;for(;r>0&&Su(e[r-1],e[r-1+t.length]);)r--;return t.start-r}function Qg(e,t){const r=t.start+t.length;let n=r;for(;e.length>n&&Su(e[n],e[n-t.length]);)n++;return n-r}function OC(e,t){const r=t[0];let n=e.length-(r?Xg(e,r):0);for(const i of t)n-=Qg(e,i);return n}function xC(e,t,r){for(let n=0;e.length>n;n++){const i=e[(t+n)%e.length],s=e[(r+n)%e.length];if(i!==s)return s>i}return!1}var MC=class{match(e){return this.isDOMException(e)||this.isDOMError(e)}coerce(e,t){const r=ye(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){const t=e.name||(this.isDOMError(e)?"DOMError":"DOMException");return e.message?`${t}: ${e.message}`:t}isDOMException(e){return po(e,"DOMException")}isDOMError(e){return po(e,"DOMError")}},LC=class{match(e){return ci(e)}coerce(e,t){var r;const n=this.getStack(e),i=n===void 0?(r=t.syntheticException)===null||r===void 0?void 0:r.stack:void 0,s=!!i;return{type:this.getType(e),value:this.getMessage(e,t),stack:n??i,cause:e.cause?t.next(e.cause):void 0,synthetic:s}}getType(e){return e.name||e.constructor.name}getMessage(e,t){const r=e.message;return String(r.error&&typeof r.error.message=="string"?r.error.message:r)}getStack(e){try{const t=e.stacktrace;if(typeof t=="string"&&t.length>0)return t;const r=e.stack;return typeof r=="string"&&r.length>0?r:void 0}catch{return}}},DC=class{match(e){return!!po(e,"ErrorEvent")&&(e.error!=null||this.ur(e))}coerce(e,t){var r;if(e.error!=null)return t.apply(e.error);const n=t.apply(e.message);return b(b({},n),{},{stack:(r=this.cr(e))!==null&&r!==void 0?r:n.stack,synthetic:!0})}ur(e){return ye(e.message)&&e.message.length>0}cr(e){var t,r;const n=e,i=(t=n.lineno)!==null&&t!==void 0?t:0,s=(r=n.colno)!==null&&r!==void 0?r:0;if(ye(n.filename)&&n.filename.length!==0&&i!==0)return`Error
|
|
95
95
|
at ${n.filename}:${i}:${s}`}},NC=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i,zC=class{match(e){return typeof e=="string"}coerce(e,t){var r;const[n,i]=this.getInfos(e);return{type:n??"Error",value:i??e,stack:(r=t.syntheticException)===null||r===void 0?void 0:r.stack,synthetic:!0}}getInfos(e){let t="Error",r=e;const n=e.match(NC);return n&&(t=n[1],r=n[2]),[t,r]}},UC=["fatal","error","warning","log","info","debug"];function em(e,t=40){const r=Object.keys(e);if(r.sort(),!r.length)return"[object has no keys]";for(let n=r.length;n>0;n--){const i=r.slice(0,n).join(", ");if(t>=i.length)return n===r.length?i:i.length>t?`${i.slice(0,t)}...`:i}return""}var FC=class{match(e){return typeof e=="object"&&e!==null}coerce(e,t){var r,n;const i=this.getErrorPropertyFromObject(e);return i?t.apply(i):{type:this.getType(e),value:this.getValue(e),stack:(r=this.getStack(e))!==null&&r!==void 0?r:(n=t.syntheticException)===null||n===void 0?void 0:n.stack,level:this.isSeverityLevel(e.level)?e.level:"error",synthetic:!0}}getType(e){if(bu(e))return e.constructor.name;const t="name"in e?e.name:void 0;return ye(t)&&!Oi(t)?t:"Error"}getValue(e){if("name"in e&&typeof e.name=="string"){let r=`'${e.name}' captured as exception`;return"message"in e&&typeof e.message=="string"&&(r+=` with message: '${e.message}'`),r}if("message"in e&&typeof e.message=="string")return e.message;const t=this.getObjectClassName(e);return`${t&&t!=="Object"?`'${t}'`:"Object"} captured as exception with keys: ${em(e)}`}isSeverityLevel(e){return ye(e)&&!Oi(e)&&UC.indexOf(e)>=0}getStack(e){try{return ye(e.stacktrace)&&e.stacktrace.length>0?e.stacktrace:ye(e.stack)&&e.stack.length>0?e.stack:void 0}catch{return}}getErrorPropertyFromObject(e){for(const t in e)if({}.hasOwnProperty.call(e,t)){const r=e[t];if(ci(r))return r}}getObjectClassName(e){try{const t=Object.getPrototypeOf(e);return t?t.constructor.name:void 0}catch{return}}},qC=class{match(e){return bu(e)}coerce(e,t){var r;const n=e.constructor.name;return{type:n,value:`${n} captured as exception with keys: ${em(e)}`,stack:(r=t.syntheticException)===null||r===void 0?void 0:r.stack,synthetic:!0}}},jC=class{match(e){return gg(e)}coerce(e,t){var r;return{type:"Error",value:`Primitive value captured as exception: ${String(e)}`,stack:(r=t.syntheticException)===null||r===void 0?void 0:r.stack,synthetic:!0}}},HC=class{match(e){return po(e,"PromiseRejectionEvent")||this.isCustomEventWrappingRejection(e)}isCustomEventWrappingRejection(e){if(!bu(e))return!1;try{const t=e.detail;return t!=null&&typeof t=="object"&&"reason"in t}catch{return!1}}coerce(e,t){var r;const n=this.getUnhandledRejectionReason(e);return gg(n)?{type:"UnhandledRejection",value:`Non-Error promise rejection captured with value: ${String(n)}`,stack:(r=t.syntheticException)===null||r===void 0?void 0:r.stack,synthetic:!0}:t.apply(n)}getUnhandledRejectionReason(e){try{if("reason"in e)return e.reason;if("detail"in e&&e.detail!=null&&typeof e.detail=="object"&&"reason"in e.detail)return e.detail.reason}catch{}return e}},mo="$message",_o="$timestamp",VC=new Set([mo,_o]),za={enabled:!0,max_bytes:32768};function yo(e){var t;return e?{enabled:(t=e.enabled)!==null&&t!==void 0?t:za.enabled,max_bytes:GC(e.max_bytes,za.max_bytes)}:b({},za)}var BC=class{constructor(e){this.ns=[],this.ss=0,this.Rr=yo(e)}setConfig(e){this.Rr=yo(e),this.rs()}add(e){const t=(function(n){let i;try{i=fg(n)}catch{return}try{const s=JSON.parse(i);if(!be(s))return;const o=s,a=o[mo],c=o[_o];return!ye(a)||a.trim().length===0||!ye(c)&&!We(c)?void 0:{step:o,json:i}}catch{return}})(e);if(!t)return;const r=(function(n){if("u">typeof TextEncoder)return new TextEncoder().encode(n).length;const i=encodeURIComponent(n);let s=0;for(let o=0;i.length>o;o++)i[o]==="%"?(s+=1,o+=2):s+=1;return s})(t.json);r>this.Rr.max_bytes||(this.ns.push({step:t.step,bytes:r}),this.ss+=r,this.rs())}getAttachable(){return this.ns.map(e=>e.step)}clear(){this.ns=[],this.ss=0}size(){return this.ns.length}rs(){for(;this.ss>this.Rr.max_bytes&&this.ns.length>0;){const e=this.ns.shift();e&&(this.ss-=e.bytes)}}};function GC(e,t){if(!We(e)||e===1/0||e===-1/0)return t;const r=Math.floor(e);return 0>r?t:r}var vh=e=>{if(typeof e!="string")return e;try{return JSON.parse(e)}catch{return e}};function gh(e){return typeof e=="string"||e}function mh(e){return typeof e=="string"?e:void 0}var WC=["$feature_flag","$feature_flag_response","$feature_flag_has_experiment","$feature_flag_id","$feature_flag_version","$feature_flag_reason","$feature_flag_request_id","$feature_flag_evaluated_at","$feature_flag_error","locally_evaluated","$groups","$process_person_profile","$geoip_disable","$current_url","$pathname","$referring_domain","utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid","gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx","$session_id","$window_id","$lib","$lib_version","$device_id","$is_server"],tm="NativeGzipValidationError",tl=e=>e.length>=2&&e[0]===31&&e[1]===139,_h=(e,t)=>e===Zc.GZipJS||t===Zc.GZipJS||t==="gzip",yh=e=>!(!e||typeof e!="object")&&("name"in e?String(e.name):"")==="NotReadableError",gi,Is=e=>{throw Zg(tm,`Native gzip produced invalid output: ${e}`)},ZC=(bh=Ue(function*(e,t){18>e.size&&Is("too-short");const r=new Uint8Array(yield e.slice(0,10).arrayBuffer());tl(r)&&r[2]===8||Is("invalid-header");const n=new DataView(yield e.slice(e.size-8).arrayBuffer());n.getUint32(0,!0)!==(s=>{const o=(()=>{if(gi)return gi;gi=[];for(let c=0;256>c;c++){let l=c;for(let u=0;8>u;u++)l=1&l?3988292384^l>>>1:l>>>1;gi[c]=l>>>0}return gi})();let a=4294967295;for(let c=0;s.length>c;c++)a=o[255&(a^s[c])]^a>>>8;return(4294967295^a)>>>0})(t)&&Is("invalid-crc");const i=t.length>>>0;n.getUint32(4,!0)!==i&&Is("invalid-size")}),function(e,t){return bh.apply(this,arguments)}),bh;function rl(){return rl=Ue(function*(e,t=!0,r){try{const i=new TextEncoder().encode(e),s=new globalThis.CompressionStream("gzip"),o=s.writable.getWriter(),a=o.write(i).then(()=>o.close()).catch((n=Ue(function*(u){try{yield o.abort(u)}catch{}throw u}),function(u){return n.apply(this,arguments)})),c=new Response(s.readable).blob(),[l]=yield Promise.all([c,a]);return yield ZC(l,i),l}catch(i){if(r?.rethrow)throw i;return t&&console.error("Failed to gzip compress data",i),null}var n}),rl.apply(this,arguments)}function rm(e,t){if(e==null)return{};var r,n,i=(function(o,a){if(o==null)return{};var c={};for(var l in o)if({}.hasOwnProperty.call(o,l)){if(a.includes(l))continue;c[l]=o[l]}return c})(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(n=0;s.length>n;n++)t.includes(r=s[n])||{}.propertyIsEnumerable.call(e,r)&&(i[r]=e[r])}return i}var JC={}.propertyIsEnumerable;function bo(e,t){try{return nm(e,t,{ancestors:new WeakSet,remainingNodes:1e4},0)}catch{return[]}}function Eu(e,t,r,n){if(0>=r.remainingNodes)return{stringValue:Qc};if(r.remainingNodes--,vt(e))return{boolValue:e};if(typeof e=="bigint")return(function(i,s){const o=i.toString(),a=BigInt("9223372036854775808");return i>=a||-a>i?(s?.debug(`Attribute ${o} is outside the int64 range; encoding it as a string`),{stringValue:o}):{intValue:o}})(e,t);if(typeof e=="number"){if(!Number.isFinite(e))return{stringValue:String(e)};if(Number.isInteger(e)){if(Number.isSafeInteger(e))return{intValue:String(e)};if(typeof BigInt>"u")return{stringValue:String(e)};const i=BigInt(e).toString();return e>=9223372036854776e3||-9223372036854776e3>e?(t?.debug(`Attribute ${i} is outside the int64 range; encoding it as a string`),{stringValue:i}):{intValue:i}}return{doubleValue:e}}if(typeof e=="string")return{stringValue:Fn(e)};if(typeof e=="function")return{stringValue:"[Function]"};if(typeof e=="symbol")return{stringValue:String(e)};if(typeof e=="object"&&e!==null){if(r.ancestors.has(e))return{stringValue:"[Circular]"};if(n>=20)return{stringValue:Qc};if(e instanceof Date){const i=e.getTime(),s=Number.isFinite(i)?e.toISOString():String(e);return{stringValue:typeof s=="string"?Fn(s):String(s)}}r.ancestors.add(e);try{try{const i=e.toJSON;if(typeof i=="function")return Eu(i.call(e),t,r,n+1)}catch{}return ce(e)?{arrayValue:{values:KC(e,t,r,n+1)}}:{kvlistValue:{values:nm(e,t,r,n+1)}}}finally{r.ancestors.delete(e)}}return{stringValue:Fn(String(e))}}function KC(e,t,r,n){const i=[],s=Math.min(e.length,1e3);let o=0;for(;s>o&&r.remainingNodes>0;o++)try{const a=o in e?e[o]:void 0;if(ge(a))continue;i.push(Eu(a,t,r,n))}catch{i.push({stringValue:us})}return e.length>o&&i.push({stringValue:Qc}),i}function nm(e,t,r,n){const i=[];for(const s in e)if(JC.call(e,s)){if(!s){t?.debug("Dropping an attribute with an empty key");continue}if(i.length>=1e3||0>=r.remainingNodes){t?.debug("Attributes truncated: the value exceeds the OTLP encoder budget");break}try{const o=e[s];if(He(o)||O(o))continue;i.push({key:Fn(s),value:Eu(o,t,r,n)})}catch{i.push({key:Fn(s),value:{stringValue:us}})}}return i}function im(e,t,r){return b(b(b(b({},Gg({},e.resourceAttributes)),{},{"service.name":e.serviceName||"unknown_service"},e.environment&&{"deployment.environment":e.environment}),e.serviceVersion&&{"service.version":e.serviceVersion}),{},{"telemetry.sdk.name":t,"telemetry.sdk.version":r})}var YC=["service.name","deployment.environment","service.version","telemetry.sdk.name","telemetry.sdk.version"];function sm(e,t){const r=Gg({},e),n={};for(const i of YC)({}).hasOwnProperty.call(r,i)&&(n[i]=r[i],delete r[i]);return[...bo(r,t),...bo(n,t)]}var wh={darwin:"macOS",win32:"Windows",cygwin:"Windows",linux:"Linux",android:"Android",freebsd:"FreeBSD",openbsd:"OpenBSD",netbsd:"NetBSD",sunos:"SunOS",aix:"AIX",haiku:"Haiku","Mac OS X":"macOS"},om={trace:{text:"TRACE",number:1},debug:{text:"DEBUG",number:5},info:{text:"INFO",number:9},warn:{text:"WARN",number:13},error:{text:"ERROR",number:17},fatal:{text:"FATAL",number:21}},XC=om.info;function QC(e){try{return Fn(String(e))}catch{return us}}function e$(e,t,r,n){const i=e.level||"info",{text:s,number:o}=om[i]||XC,a=(function(d=Date.now()){return String(d)+"000000"})(We(n)?n:void 0),c={};t.distinctId&&(c.posthogDistinctId=t.distinctId),t.sessionId&&(c.sessionId=t.sessionId),t.windowId&&(c["window.id"]=t.windowId),ge(t.sessionStartTimestamp)||(c.sessionStartTimestamp=String(t.sessionStartTimestamp)),ge(t.lastActivityTimestamp)||(c.lastActivityTimestamp=String(t.lastActivityTimestamp)),t.currentUrl&&(c["url.full"]=t.currentUrl),t.screenName&&(c["screen.name"]=t.screenName),t.appState&&(c["app.state"]=t.appState),t.activeFeatureFlags&&t.activeFeatureFlags.length>0&&(c.feature_flags=t.activeFeatureFlags);const l=b({},c),u=e.attributes;if(u){let d=[];try{d=Object.keys(u)}catch{d=[]}for(const p of d){let f;try{f=u[p]}catch{f=us}Object.defineProperty(l,p,{value:f,enumerable:!0,writable:!0,configurable:!0})}}const h={timeUnixNano:a,observedTimeUnixNano:a,severityNumber:o,severityText:s,body:{stringValue:QC(e.body)},attributes:bo(l,r)};return e.trace_id&&(h.traceId=e.trace_id),e.span_id&&(h.spanId=e.span_id),O(e.trace_flags)||(h.flags=e.trace_flags),h}function am(e,t,r){return im(e,t,r)}function cm(e,t,r,n){return{resourceLogs:[{resource:{attributes:sm(t)},scopeLogs:[{scope:{name:r,version:n},logRecords:e}]}]}}var lm=class{constructor(e){this.ls=e,this.us=0}get pending(){return!!this.hs}arm(e){this.clear(),this.us=Date.now()+e,this.hs=Jg(()=>{this.hs=void 0,this.ls()},e)}armNoEarlierThan(e){this.hs&&Date.now()+e<=this.us||this.arm(e)}clear(){this.hs&&(clearTimeout(this.hs),this.hs=void 0)}};function um(){return .75+.5*Math.random()}function dm(e,t,r,n){const i=Math.min(Math.max(0,t-1),6),s=e*Math.pow(2,i);return Math.round((n===void 0?s:Math.min(s,Math.max(n,e)))*r)}var t$=class{constructor(e,t,r,n,i,s=()=>Promise.resolve(),o){var a;this._instance=e,this.Rr=t,this.$=r,this.cs=n,this.ds=i,this.vs=s,this.fs=o,this.ps=new lm(()=>this.gs()),this.ys=null,this.bs=0,this._s=0,this.ws=new Wg,this.ks=0,this.Ss=1,this.xs=0,this.Cs=0,this.$s=!1,this.Ts=t.maxBufferSize,this.Is=Math.max((a=t.maxQueueSize)!==null&&a!==void 0?a:t.maxBufferSize,t.maxBufferSize),this.Ms=t.flushIntervalMs,this.Es=t.maxBatchRecordsPerPost,this.Ps=t.rateCapWindowMs,this.Rs=t.maxLogsPerInterval}clearQueue(){this._s++,this._instance.setPersistedProperty(Ht.LogsQueue,[])}reset(){this.ps.clear(),this.xs=0,this.Cs=0,this.$s=!1,this.ks=0,this.Ss=1,this.ws.reset(),this.Es=this.Rr.maxBatchRecordsPerPost}onReconnect(){this.ks=0,this.Ss=1,this.ws.isOpen()?this.As()&&this.Fs():this.gs()}captureLog(e,t){var r;if(this._instance.isDisabled||this._instance.optedOut||!e?.body)return;const n=this.Os(e);if(n===null)return;if(!n.body)return void this.$.info("Log was rejected in beforeSend function");if(!this.Ds())return;const i={record:e$(n,(r=t?.context)!==null&&r!==void 0?r:this.cs(),this.$,t?.occurredAtMs)};this.ds(()=>this.Ls(i))}Os(e){const t=this.Rr.beforeSend;if(!t)return e;const r=ce(t)?t:[t];let n=e;for(const i of r)try{const s=i(n);if(!s)return this.$.info("Log was rejected in beforeSend function"),null;n=s}catch(s){return this.$.error("Error in beforeSend function for log:",s),null}return n}Ds(){if(this.Rs===void 0)return!0;const e=Date.now(),t=e-this.xs;return this.Ps>t&&t>=0||(this.xs=e,this.Cs=0,this.$s=!1),this.Rs>this.Cs?(this.Cs++,!0):(this.$s||(this.$.warn(`captureLog dropping logs: exceeded ${this.Rs} logs per ${this.Ps}ms`),this.$s=!0),!1)}flush(){var e=this;return Ue(function*(){if(!e._instance.isDisabled)return e.ys||(e.ys=e.Ns().finally(()=>{e.ys=null})),e.ys})()}Ns(){var e=this;return Ue(function*(){var t;e.ps.clear();let r=(t=e._instance.getPersistedProperty(Ht.LogsQueue))!==null&&t!==void 0?t:[];if(r.length===0)return;const n=r.length;let i=0;for(;r.length>0&&n>i;){var s,o;const a=e._s;e.bs=0;const c=Math.min(r.length,e.Es),l=r.slice(0,c),u=cm(l.map(d=>d.record),e.qs(),(s=e.fs)!==null&&s!==void 0?s:e._instance.getLibraryId(),e._instance.getLibraryVersion()),h=yield e._instance.js(u);if(e._s!==a)return;if(h.kind==="too-large"&&l.length>1)e.Es=Math.max(1,Math.floor(l.length/2)),e.$.warn(`Logs batch of size ${l.length} was too large for the ingestion endpoint, reducing batch size to ${e.Es}`);else if(e.ws.record(h),e.ps.pending&&e.ps.arm(Math.max(e.Ms,e.ws.remainingMs())),h.kind==="retry-later"||(h.kind==="too-large"?e.$.warn("Dropping a single log record with batch size 1 — the record is larger than the server cap and cannot be split further."):h.kind==="ok"&&e.Rr.maxBatchRecordsPerPost>e.Es&&(e.Es=Math.min(e.Rr.maxBatchRecordsPerPost,e.Es+1)),yield e.Bs(l.length),r=(o=e._instance.getPersistedProperty(Ht.LogsQueue))!==null&&o!==void 0?o:[],i+=l.length,h.kind==="fatal"))throw h.error}})()}Bs(e){var t=this;return Ue(function*(){var r;const n=Math.max(0,e-t.bs),i=(r=t._instance.getPersistedProperty(Ht.LogsQueue))!==null&&r!==void 0?r:[];t._instance.setPersistedProperty(Ht.LogsQueue,i.slice(n)),yield t.vs()})()}qs(){return am(this.Rr,this._instance.getLibraryId(),this._instance.getLibraryVersion())}Ls(e){var t;if(this._instance.optedOut)return;const r=(t=this._instance.getPersistedProperty(Ht.LogsQueue))!==null&&t!==void 0?t:[];this.Is>r.length||(r.shift(),this.bs++,this.$.info("Logs queue is full, dropping oldest record.")),r.push(e),this._instance.setPersistedProperty(Ht.LogsQueue,r),this.Ts>r.length||this.ws.isOpen()?this.Fs():this.gs()}Fs(){this.ps.pending||this.ps.arm(Math.max(this.Ms,this.ws.remainingMs()))}Hs(){return Math.max(dm(this.Ms,this.ks,this.Ss,3e4),this.ws.remainingMs())}As(){const e=this._instance.getPersistedProperty(Ht.LogsQueue);return!!e&&e.length>0}shutdown(e){var t=this;return Ue(function*(){t.ps.clear();const r=t.flush().catch(()=>{});e!==void 0?yield dh(r,e):yield r})()}flushWithTimeout(e){var t=this;return Ue(function*(){const r=t.flush();yield dh(r,e,()=>{r.catch(()=>{})})})()}gs(){this.flush().then(()=>{this.ks=0,this.Ss=1},e=>{this.ks++,this.Ss=um(),this.$.error("PostHog logs flush failed:",e)}).finally(()=>{!this._instance.isDisabled&&this.As()&&this.ps.armNoEarlierThan(this.Hs())})}},Ua=[0,5,10,25,50,75,100,250,500,750,1e3,2500,5e3,7500,1e4];function Sh(e){return String(e)+"000000"}function Eh(e,t,r,n){let i="";return n&&(i=Object.keys(n).sort().map(s=>`${JSON.stringify(s)}:${JSON.stringify(n[s])}`).join(",")),`${e}\0${t}\0${r??""}\0${i}`}var r$=class{constructor(e,t,r){this._instance=e,this.Rr=t,this.$=r,this.zs=new Map,this.ps=new lm(()=>this.flush().catch(n=>{this.$.error("Metrics flush failed:",n)})),this.ys=null,this.Us=!1,this.Ws=new Map,this.Vs=new Set,this.ws=new Wg,this.ks=0,this.Ss=1,this.Gs=0}count(e,t=1,r){this.Zs({name:e,type:"count",value:t,unit:r?.unit,attributes:r?.attributes})}gauge(e,t,r){this.Zs({name:e,type:"gauge",value:t,unit:r?.unit,attributes:r?.attributes})}histogram(e,t,r){this.Zs({name:e,type:"histogram",value:t,unit:r?.unit,attributes:r?.attributes})}flush(){var e=this;const t=this.ys,r=(function(){var n=Ue(function*(){t&&(yield t.catch(()=>{})),yield e.Qs()});return function(){return n.apply(this,arguments)}})()().finally(()=>{this.ys===r&&(this.ys=null)});return this.ys=r,r}drainWindow(){if(this.zs.size===0)return null;const e=this.zs;return this.zs=new Map,this.Us=!1,this.Ws=new Map,this.Vs=new Set,this.Js(e)}reset(){this.Gs++,this.ws.reset(),this.ks=0,this.Ss=1,this.ps.clear(),this.zs=new Map,this.ys=null,this.Us=!1,this.Ws=new Map,this.Vs=new Set}Zs(e){if(this._instance.isDisabled||this._instance.optedOut)return;const t=this.Os(e);if(t===null)return;if(!t.name||typeof t.name!="string")return void this.$.warn("Dropping metric with empty name");if(typeof t.value!="number"||!Number.isFinite(t.value))return void this.$.warn(`Dropping metric '${t.name}': value must be a finite number`);if(t.type==="count"&&0>t.value)return void this.$.warn(`Dropping count '${t.name}': counters are monotonic, value must be >= 0`);let r,n;try{r=t.attributes?b({},t.attributes):void 0,n=Eh(t.type,t.name,t.unit,r)}catch(o){this.$.warn(`Dropping metric '${t.name}': attributes could not be serialized`,o);return}let i=this.zs.get(n);if(!i){if(!this.Ks())return;i={name:t.name,type:t.type,unit:t.unit,attributes:r,windowStartMs:Date.now()},this.zs.set(n,i)}const s=this.Ws.get(t.name);s===void 0?this.Ws.set(t.name,t.type):s===t.type||this.Vs.has(t.name)||(this.Vs.add(t.name),this.$.warn(`Metric name '${t.name}' is already used as a ${s}; recording it as a ${t.type} too will blend both series in charts. Use a distinct name.`)),this.Xs(i,t.value),this.Fs()}Ks(){return this.Rr.maxSeriesPerFlush>this.zs.size||(this.Us||(this.Us=!0,this.$.warn(`Metric series cap reached (${this.Rr.maxSeriesPerFlush} per flush window); dropping new series until the next flush. Reduce attribute cardinality.`)),!1)}Xs(e,t){switch(e.type){case"count":var r;e.total=((r=e.total)!==null&&r!==void 0?r:0)+t;break;case"gauge":e.last=t;break;case"histogram":{e.hist||(e.hist={count:0,sum:0,min:t,max:t,bucketCounts:new Array(Ua.length+1).fill(0)});const n=e.hist;n.count+=1,n.sum+=t,n.min=Math.min(n.min,t),n.max=Math.max(n.max,t),n.bucketCounts[(function(i,s){for(let o=0;s.length>o;o++)if(s[o]>=i)return o;return s.length})(t,Ua)]+=1;break}}}Os(e){const t=this.Rr.beforeSend;if(!t)return e;const r=ce(t)?t:[t];let n=e;for(const i of r)try{const s=i(n);if(!s)return this.$.info("Metric was rejected in beforeSend function"),null;n=s}catch(s){return this.$.error("Error in beforeSend function for metric:",s),null}return n}Fs(){this.ps.pending||this.ps.arm(this.Hs())}Hs(){return Math.max(dm(this.Rr.flushIntervalMs,this.ks,this.Ss,3e4),this.ws.remainingMs())}Qs(){var e=this;return Ue(function*(){if(e.ps.clear(),e.zs.size===0)return;const t=e.zs;e.zs=new Map,e.Us=!1,e.Ws=new Map,e.Vs=new Set;const r=e.Gs,n=yield e._instance.Ys(e.Js(t));if(r===e.Gs)switch(e.ws.record(n),n.kind==="retry-later"?(e.ks++,e.Ss=um()):(e.ks=0,e.Ss=1),e.ps.pending&&e.ps.arm(e.Hs()),n.kind){case"ok":return;case"retry-later":e.ho(t),e.ps.armNoEarlierThan(e.Hs());return;case"too-large":e.$.warn("Metrics batch exceeded the server size limit and was dropped");return;case"fatal":e.$.error("Failed to send metrics batch:",n.error);return}})()}Js(e){return t=this.vo(e),r=(function(s,o,a){return im(s,o,a)})(this.Rr,this._instance.getLibraryId(),this._instance.getLibraryVersion()),n=this._instance.getLibraryId(),i=this._instance.getLibraryVersion(),{resourceMetrics:[{resource:{attributes:sm(r)},scopeMetrics:[{scope:{name:n,version:i},metrics:t}]}]};var t,r,n,i}vo(e){const t=Sh(Date.now()),r=new Map;for(const o of e.values()){var n;const a=Eh(o.type,o.name,o.unit,void 0);let c=r.get(a);c||(c=b({name:o.name},o.unit&&{unit:o.unit}),o.type==="count"?c.sum={aggregationTemporality:1,isMonotonic:!0,dataPoints:[]}:o.type==="gauge"?c.gauge={dataPoints:[]}:c.histogram={aggregationTemporality:1,dataPoints:[]},r.set(a,c));const l=bo((n=o.attributes)!==null&&n!==void 0?n:{},this.$),u=Sh(o.windowStartMs);if(o.type==="count"){var i;const h={attributes:l,startTimeUnixNano:u,timeUnixNano:t,asDouble:(i=o.total)!==null&&i!==void 0?i:0};c.sum.dataPoints.push(h)}else if(o.type==="gauge"){var s;const h={attributes:l,timeUnixNano:t,asDouble:(s=o.last)!==null&&s!==void 0?s:0};c.gauge.dataPoints.push(h)}else o.hist&&c.histogram.dataPoints.push({attributes:l,startTimeUnixNano:u,timeUnixNano:t,count:o.hist.count,sum:o.hist.sum,min:o.hist.min,max:o.hist.max,bucketCounts:o.hist.bucketCounts,explicitBounds:Ua})}return Array.from(r.values())}ho(e){for(const[n,i]of e){const s=this.zs.get(n);if(s)switch(s.windowStartMs=Math.min(s.windowStartMs,i.windowStartMs),s.type){case"count":var t,r;s.total=((t=s.total)!==null&&t!==void 0?t:0)+((r=i.total)!==null&&r!==void 0?r:0);break;case"gauge":break;case"histogram":if(i.hist)if(s.hist){s.hist.count+=i.hist.count,s.hist.sum+=i.hist.sum,s.hist.min=Math.min(s.hist.min,i.hist.min),s.hist.max=Math.max(s.hist.max,i.hist.max);for(let o=0;s.hist.bucketCounts.length>o;o++)s.hist.bucketCounts[o]+=i.hist.bucketCounts[o]}else s.hist=i.hist}else this.Ks()&&this.zs.set(n,i)}}},hm=(e,{debugEnabled:t}={})=>{const r={N(n,...i){A&&(ar.DEBUG||A.POSTHOG_DEBUG||t)&&!O(A.console)&&A.console&&("__rrweb_original__"in A.console[n]?A.console[n].__rrweb_original__:A.console[n])(e,...i)},debug(...n){r.N("debug",...n)},info(...n){r.N("log",...n)},warn(...n){r.N("warn",...n)},error(...n){r.N("error",...n)},critical(...n){console.error(e,...n)},uninitializedWarning(n){r.error(`You must initialize PostHog before calling ${n}`)},createLogger:(n,i)=>hm(`${e} ${n}`,i)};return r},j=hm("[PostHog.js]"),Be=j.createLogger,n$=Be("[ExternalScriptsLoader]"),wo=e=>{const t=N?.querySelectorAll("script");if(t){for(let r=0;t.length>r;r++)if(t[r].src===e||t[r].getAttribute("src")===e)return t[r]}},Qr=(e,t,r)=>{if(e.config.disable_external_dependency_loading)return n$.warn(`${t} was requested but loading of external scripts is disabled.`),r("Loading of external scripts is disabled");const n=wo(t);if(n){if(n.__posthog_loading_callback_fired)return r();const s=n.__posthog_loading_error;return s?r(s):(n.addEventListener("load",o=>{n.__posthog_loading_callback_fired=!0,r(void 0,o)}),void n.addEventListener("error",o=>{n.__posthog_loading_error=o,r(o)}))}const i=()=>{if(!N)return r("document not found");if(wo(t))return Qr(e,t,r);let s=N.createElement("script");if(s.type="text/javascript",s.crossOrigin="anonymous",s.src=t,s.onload=a=>{s.__posthog_loading_callback_fired=!0,r(void 0,a)},s.onerror=a=>{s.__posthog_loading_error=a,r(a)},e.config.prepare_external_dependency_script&&(s=e.config.prepare_external_dependency_script(s)),!s)return r("prepare_external_dependency_script returned null");if(e.config.external_scripts_inject_target==="head")N.head.appendChild(s);else{const a=N.querySelectorAll("body > script");var o;a.length>0?(o=a[0].parentNode)===null||o===void 0||o.insertBefore(s,a[0]):N.body.appendChild(s)}};N?.body?i():N?.addEventListener("DOMContentLoaded",i)},Fa={},kh=(e,t)=>{let r=`/static/${t}.js?v=${e.version}`;return t==="toolbar"&&(r=`${r}&t=${Math.floor(Date.now()/3e5)*3e5}`),e.requestRouter.endpointFor("assets",r)};te.__PosthogExtensions__=te.__PosthogExtensions__||{},te.__PosthogExtensions__.loadExternalDependency=(e,t,r)=>{if(t==="remote-config"){const i=e.requestRouter.endpointFor("assets",`/array/${e.config.token}/config.js`);Qr(e,i,r);return}const n=e.config.strict_script_versioning;if(n){const i=e.requestRouter.endpointFor("assets",`/static/${e.version}/${t}.js`),s=Fa[i];if(n==="fallback"&&s){if(wo(s))return void Qr(e,s,r);delete Fa[i]}Qr(e,i,n==="fallback"?(o,a)=>{if(o)if(typeof o=="string")r(o);else{var c;const l=kh(e,t);Fa[i]=l;const u=wo(i);u==null||(c=u.parentNode)===null||c===void 0||c.removeChild(u),Qr(e,l,r)}else r(void 0,a)}:r);return}Qr(e,kh(e,t),r)},te.__PosthogExtensions__.loadSiteApp=(e,t,r)=>{const n=e.requestRouter.endpointFor("api",t);Qr(e,n,r)},ar.DEBUG=!1,ar.LIB_VERSION="1.434.12",ar.LIB_NAME="web";var et=ar,i$="$people_distinct_id",Pt="distinct_id",ku="$device_id",qa="$device_model",So="__alias",s$="__cmpns",Rh="$fbc",qn="$fbc_persistence",Ah="$fbp",Mi="$fbp_persistence",nl="__timers",pm="$autocapture_disabled_server_side",il="$heatmaps_enabled_server_side",sl="$exception_capture_enabled_server_side",fm="$error_tracking_suppression_rules",ol="$error_tracking_capture_extension_exceptions",al="$web_vitals_enabled_server_side",Ru="$dead_clicks_enabled_server_side",Au="$product_tours_enabled_server_side",vm="$logs_capture_enabled_server_side",gm="$web_vitals_allowed_metrics",Li="$session_recording_remote_config",o$="$session_recording_enabled_server_side",a$="$replay_sample_rate",c$="$replay_override_sampling",l$="$replay_override_linked_flag",u$="$replay_override_url_trigger",d$="$replay_override_event_trigger",Mn="$sesid",mm="$session_is_sampled",h$="$session_past_minimum_duration",p$="$session_recording_url_trigger_activated_session",f$="$session_recording_event_trigger_activated_session",v$="$debug_first_full_snapshot_timestamp",g$="$sess_rec_flush_size",Mt="$enabled_feature_flags",ir="$active_feature_flags",cl="$early_access_features",ln="$feature_flag_details",wr="$feature_flag_payloads",un="$feature_flag_request_id",Di="$minimal_flag_called_events",qt="$override_feature_flags",en="$override_feature_flag_payloads",Sr="$stored_person_properties",Er="$stored_group_properties",_m="$groups",ll="$surveys",Eo="$surveys_loaded_at",ym="$surveys_activated",bm="$surveys_activated_session",wm="$surveys_activated_timestamps",ul="ph_product_tours",m$="$product_tours_activated",_$="$product_tours_activated_session",y$="$conversations_widget_session_id",b$="$conversations_ticket_id",w$="$conversations_widget_state",S$="$conversations_user_traits",kr="$flag_call_reported",Ti="$flag_call_reported_session_id",Qi="$feature_flag_errors",Cr="$feature_flag_evaluated_at",ft="$user_state",dl="$client_session_props",E$="$capture_rate_limit",Sm="$initial_campaign_params",Em="$initial_referrer_info",Ln="$initial_person_info",Iu="$epp",ja="$posthog_cookieless",km="$cookieless_mode",Rm="$sdk_debug_extensions_init_method",Am="$sdk_debug_extensions_init_time_ms",Im="$sdk_debug_recording_script_not_loaded",Tm="$sdk_debug_replay_stale_config",k$="$sdk_debug_replay_event_trigger_status",R$="$sdk_debug_replay_linked_flag_trigger_status",A$="$sdk_debug_replay_matched_recording_trigger_groups",I$="$sdk_debug_replay_pending_trigger_conditions",T$="$sdk_debug_replay_remote_trigger_matching_config",C$="$sdk_debug_replay_trigger_groups_count",$$="$sdk_debug_replay_url_trigger_status",P$="$session_recording_start_reason",Tu="PostHog loadExternalDependency extension not found.",sr="anonymous",Ks="identified",Cm="identified_only",es="visibilitychange",ko="beforeunload",Cu="$pageview",Ih="$pageleave",$m="$identify",Th="$groupidentify";function Dn(e,t){ce(e)&&e.forEach(t)}function Ce(e,t){if(!ge(e))if(ce(e))e.forEach(t);else if((r=>r instanceof FormData)(e))e.forEach((r,n)=>t(r,n));else for(const r in e)yu.call(e,r)&&t(e[r],r)}var Le=function(e,...t){for(const r of t)for(const n in r)r[n]!==void 0&&(e[n]=r[n]);return e};function Ys(e){const t=Object.keys(e);let r=t.length;const n=new Array(r);for(;r--;)n[r]=[t[r],e[t[r]]];return n}var O$=function(e){return function(...t){try{return e.apply(this,t)}catch(r){j.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),j.critical(r)}}},$u=function(e){const t={};return Ce(e,function(r,n){(ye(r)&&r.length>0||We(r))&&(t[n]=r)}),t};function Pm(e){const t=b({},e);for(const r of["name","message","stack","cause","errors"])try{r in e&&(t[r]=e[r])}catch{}return t}var x$=["herokuapp.com","vercel.app","netlify.app"];function M$(e){const t=e?.hostname;if(!ye(t))return!1;const r=t.split(".").slice(-2).join(".");for(const n of x$)if(r===n)return!1;return!0}function Ie(e,t,r,n){const{capture:i=!1,passive:s=!0}=n??{};e?.addEventListener(t,r,{capture:i,passive:s})}function hl(e){return e.name==="ph_toolbar_internal"}var Ni=e=>{if(N){try{const t=e+"=",r=N.cookie.split(";").filter(n=>n.length);for(let n=0;r.length>n;n++){let i=r[n];for(;i.charAt(0)==" ";)i=i.substring(1,i.length);if(i.indexOf(t)===0)return decodeURIComponent(i.substring(t.length,i.length))}}catch{}return null}};Math.trunc||(Math.trunc=function(e){return 0>e?Math.ceil(e):Math.floor(e)}),Number.isInteger||(Number.isInteger=function(e){return We(e)&&isFinite(e)&&Math.floor(e)===e});var L$=class pl{constructor(t){if(this.bytes=t,t.length!==16)throw new TypeError("not 128-bit length")}static fromFieldsV7(t,r,n,i){if(!Number.isInteger(t)||!Number.isInteger(r)||!Number.isInteger(n)||!Number.isInteger(i)||0>t||0>r||0>n||0>i||t>0xffffffffffff||r>4095||n>1073741823||i>4294967295)throw new RangeError("invalid field value");const s=new Uint8Array(16);return s[0]=t/Math.pow(2,40),s[1]=t/Math.pow(2,32),s[2]=t/Math.pow(2,24),s[3]=t/Math.pow(2,16),s[4]=t/256,s[5]=t,s[6]=112|r>>>8,s[7]=r,s[8]=128|n>>>24,s[9]=n>>>16,s[10]=n>>>8,s[11]=n,s[12]=i>>>24,s[13]=i>>>16,s[14]=i>>>8,s[15]=i,new pl(s)}toString(){let t="";for(let r=0;this.bytes.length>r;r++)t=t+(this.bytes[r]>>>4).toString(16)+(15&this.bytes[r]).toString(16),r!==3&&r!==5&&r!==7&&r!==9||(t+="-");if(t.length!==36)throw new Error("Invalid UUIDv7 was generated");return t}clone(){return new pl(this.bytes.slice(0))}equals(t){return this.compareTo(t)===0}compareTo(t){for(let r=0;16>r;r++){const n=this.bytes[r]-t.bytes[r];if(n!==0)return Math.sign(n)}return 0}},D$=class{generate(){const e=this.generateOrAbort();if(!O(e))return e;{this.Ct=0;const t=this.generateOrAbort();if(O(t))throw new Error("Could not generate UUID after timestamp reset");return t}}generateOrAbort(){const e=(()=>{const t=Date.now();return We(t)&&isFinite(t)?Math.min(Math.max(Math.floor(t),0),0xffffffffffff):0})();if(e>this.Ct)this.Ct=e,this.Mt();else{if(this.Ct>=e+1e4)return;this.It++,this.It>4398046511103&&(this.Ct++,this.Mt())}return L$.fromFieldsV7(this.Ct,Math.trunc(this.It/Math.pow(2,30)),this.It&Math.pow(2,30)-1,this.Tt.nextUint32())}Mt(){this.It=1024*this.Tt.nextUint32()+(1023&this.Tt.nextUint32())}constructor(){this.Ct=0,this.It=0,this.Tt=new N$}},Om=e=>{if("u">typeof UUIDV7_DENY_WEAK_RNG&&UUIDV7_DENY_WEAK_RNG)throw new Error("no cryptographically strong RNG available");for(let t=0;e.length>t;t++)e[t]=65536*Math.trunc(65536*Math.random())+Math.trunc(65536*Math.random());return e};A&&!O(A.crypto)&&crypto.getRandomValues&&(Om=e=>crypto.getRandomValues(e));var N$=class{nextUint32(){return this.Rt.length>this.$t||(Om(this.Rt),this.$t=0),this.Rt[this.$t++]}constructor(){this.Rt=new Uint32Array(8),this.$t=1/0}},Ch,Lt=()=>z$().toString(),z$=()=>(Ch||(Ch=new D$)).generate(),mi="",U$=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i,yn=null,qe={Et(){if(!He(yn))return yn;if(yn=!1,N)try{const e=`__ph_cookie_support_${Lt()}`;qe.At(e,"xyz"),yn=Ni(e)==='"xyz"',qe.Lt(e)}catch{yn=!1}return yn},Pt(e){j.error("cookieStore error: "+e)},Ot:Ni,Dt(e){let t;try{t=JSON.parse(qe.Ot(e))||{}}catch{}return t},At(e,t,r,n,i){if(!N)return!1;try{let s="",o="";const a=(function(l,u){if(u){let h=(function(d,p=N){if(mi)return mi;if(!p||["localhost","127.0.0.1"].includes(d))return"";const f=d.split(".");let v=Math.min(f.length,8);const m="dmn_chk_"+Lt();for(;!mi&&v--;){const _=f.slice(v).join("."),w=m+"=1;domain=."+_+";path=/";p.cookie=w+";max-age=3",p.cookie.includes(m)&&(p.cookie=w+";max-age=0",mi=_)}return mi})(l);if(!h){const d=(p=>{const f=p.match(U$);return f?f[0]:""})(l);d!==h&&j.info("Warning: cookie subdomain discovery mismatch",d,h),h=d}return h?"; domain=."+h:""}return""})(N.location.hostname,n);if(r){const l=new Date;l.setTime(l.getTime()+864e5*r),s="; expires="+l.toUTCString()}i&&(o="; secure");const c=e+"="+encodeURIComponent(JSON.stringify(t))+s+"; SameSite=Lax; path=/"+a+o;return c.length>3686.4&&j.warn("cookieStore warning: large cookie, len="+c.length),N.cookie=c,!0}catch{return!1}},Lt(e,t){if(N?.cookie&&(!t||!He(Ni(e))))try{qe.At(e,"",-1,t)}catch{return}}},Ha=null,ke={Et(){if(!He(Ha))return Ha;let e=!0;if(O(A))e=!1;else try{const t="__mplssupport__";ke.At(t,"xyz"),ke.Ot(t)!=='"xyz"'&&(e=!1),ke.Lt(t)}catch{e=!1}return e||j.error("localStorage unsupported; falling back to cookie store"),Ha=e,e},Pt(e){j.error("localStorage error: "+e)},Ot(e){try{return A?.localStorage.getItem(e)}catch(t){ke.Pt(t)}return null},Dt(e){try{return JSON.parse(ke.Ot(e))||{}}catch{}return null},At(e,t){try{return A?.localStorage.setItem(e,JSON.stringify(t)),!0}catch(r){ke.Pt(r)}return!1},Lt(e){try{A?.localStorage.removeItem(e)}catch(t){ke.Pt(t)}}},Va=[Sr,ir,Mt,ln,wr,un,Cr,Qi,kr],tn=[ku,Pt,Mn,mm,Iu,Ln,qn,ft],Ro=e=>e+"_cpm",F$=["__proto__","constructor","prototype"],Ba=e=>{if(!be(e))return{};const t={};return Object.keys(e).forEach(r=>{F$.indexOf(r)===-1&&(t[r]=e[r])}),t},Ga=(e,t=[])=>{const r={};return[...tn,...t].forEach(n=>{const i=e[n];O(i)||He(i)||i===""||(r[n]=i)}),r},xm=e=>{let t=5381,r=2166136261;for(let n=0;e.length>n;n++){const i=e.charCodeAt(n);t=33*t^i,r=Math.imul(r^i,16777619)}return e.length.toString(36)+"."+(t>>>0).toString(36)+"."+(r>>>0).toString(36)},$h=(e,t)=>({p:t,f:xm(JSON.stringify(e))}),Ph=(e,t)=>{if(!t)return{properties:[],isValid:!1};try{const r=qe.Dt(Ro(e)),n=r?.f===xm(t)&&ce(r.p);return{properties:n?r.p:[],isValid:n}}catch{return{properties:[],isValid:!1}}},Wa=(e,t)=>t+"|"+(qe.Ot(Ro(e))||""),bn={},fl={Et:()=>!0,Pt(e){j.error("memoryStorage error: "+e)},Ot:e=>e in bn?bn[e]:null,Dt:e=>e in bn?bn[e]:null,At:(e,t)=>(bn[e]=t,!0),Lt(e){delete bn[e]}},Gr=null,xe={Et(){if(!He(Gr))return Gr;if(Gr=!0,O(A))Gr=!1;else try{const e="__support__";xe.At(e,"xyz"),xe.Ot(e)!=='"xyz"'&&(Gr=!1),xe.Lt(e)}catch{Gr=!1}return Gr},Pt(e){j.error("sessionStorage error: ",e)},Ot(e){try{return A?.sessionStorage.getItem(e)}catch(t){xe.Pt(t)}return null},Dt(e){try{return JSON.parse(xe.Ot(e))||null}catch{}return null},At(e,t){try{return A?.sessionStorage.setItem(e,JSON.stringify(t)),!0}catch(r){xe.Pt(r)}return!1},Lt(e){try{A?.sessionStorage.removeItem(e)}catch(t){xe.Pt(t)}}},q$=class{constructor(e){this._instance=e}get Rr(){return this._instance.config}get consent(){return this.Lo()?0:this.No}isOptedOut(){return this.Rr.cookieless_mode==="always"||this.isRejected()||this.consent===-1&&this.Rr.cookieless_mode==="on_reject"}isOptedIn(){return!this.isOptedOut()}isExplicitlyOptedOut(){return this.consent===0}isRejected(){return this.consent===0||this.consent===-1&&this.Rr.opt_out_capturing_by_default}optInOut(e){this.qo.At(this.jo,e?1:0,this.Rr.cookie_expiration,this.Rr.cross_subdomain_cookie,this.Rr.secure_cookie)}reset(){this.qo.Lt(this.jo,this.Rr.cross_subdomain_cookie)}get jo(){const{token:e,opt_out_capturing_cookie_prefix:t,consent_persistence_name:r}=this._instance.config;return r||(t?t+e:"__ph_opt_in_out_"+e)}get No(){const e=this.qo.Ot(this.jo);return Oa(e)?1:ue(sC,e)?0:-1}get qo(){const e=this.Rr.opt_out_capturing_persistence_type,t=e==="localStorage"?ke:qe,r=t.Et()?t:fl;if(!this.Bo||this.Bo!==r){this.Bo=r;const n=e==="localStorage"?qe:ke;n.Ot(this.jo)&&(this.Bo.Ot(this.jo)||this.optInOut(Oa(n.Ot(this.jo))),n.Lt(this.jo,this.Rr.cross_subdomain_cookie))}return this.Bo}Lo(){return!!this.Rr.respect_dnt&&[rt?.doNotTrack,rt?.msDoNotTrack,te.doNotTrack,rt?.globalPrivacyControl].some(e=>Oa(e))}};function Mm(e,t){var r;const n=e==null||(r=e.config)===null||r===void 0?void 0:r.get_current_url;if(!tt(n))return t;try{const i=n(t);return ye(i)&&i?i:t}catch(i){return j.error("Error in get_current_url, falling back to window.location.href",i),t}}function Oh(e){var t;return e instanceof Element&&(e.id==="__POSTHOG_TOOLBAR__"||!!(!((t=e.closest)===null||t===void 0)&&t.call(e,".toolbar-global-fade-container")))}function Zt(e){return!!e&&e.nodeType===1}function ct(e,t){return!!e&&!!e.tagName&&e.tagName.toLowerCase()===t.toLowerCase()}function Lm(e){return!!e&&e.nodeType===3}function Pu(e){return!!e&&e.nodeType===11&&Zt(e.host)}function Ou(e){return e?pa(e).split(/\s+/):[]}function xh(e,t){const r=(function(n){var i;const s=A==null||(i=A.location)===null||i===void 0?void 0:i.href;return O(s)?void 0:Mm(n,s)})(t);return!!(r&&e&&e.some(n=>r.match(n)))}function Yn(e){let t="";switch(typeof e.className){case"string":t=e.className;break;case"object":t=(e.className&&"baseVal"in e.className?e.className.baseVal:null)||e.getAttribute("class")||"";break;default:t=""}return Ou(t)}function Dm(e){return ge(e)?null:pa(e).split(/(\s+)/).filter(t=>Ui(t)).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function ts(e){let t="";return jn(e)&&!rs(e)&&e.childNodes&&e.childNodes.length&&Ce(e.childNodes,function(r){var n;Lm(r)&&r.textContent&&(t+=(n=Dm(r.textContent))!==null&&n!==void 0?n:"")}),pa(t)}function zi(e){var t;return O(e.target)?e.srcElement||null:!((t=e.target)===null||t===void 0)&&t.shadowRoot?e.composedPath()[0]||null:e.target||null}var xu=["a","button","form","input","select","textarea","label"];function vl(e,t){const r=e.matches||e.matchesSelector||e.msMatchesSelector||e.mozMatchesSelector||e.webkitMatchesSelector||e.oMatchesSelector;try{return!!r&&r.call(e,t)}catch{return!1}}function gl(e,t){if(O(t))return!0;for(const r of e)if(t.some(n=>vl(r,n)))return!0;return!1}function Nm(e){const t=e.parentNode;return!(!t||!Zt(t))&&t}var Za=[".ph-no-autocapture","[data-ph-no-autocapture]"],zm=["next","previous","prev",">","<"],j$=[...zm,"+","-","−","–"],Mh=(e,t)=>/[a-z0-9]/i.test(t)?e.includes(t):e===t,Lh=[".ph-no-rageclick",".ph-no-capture"],H$=["","text","search","email","password","url","tel","number"];function Um(e,t){if(!A||Mu(e))return!1;let r,n,i;var s,o;if(vt(t)?(r=!!t&&Lh,n=void 0,i=!1):(r=(s=t?.css_selector_ignorelist)!==null&&s!==void 0?s:Lh,n=t?.content_ignorelist,i=(o=t?.ignore_text_selection)!==null&&o!==void 0&&o),r===!1||i&&(function(c){return!(!c||!Zt(c))&&(!!ct(c,"textarea")||(ct(c,"input")?ue(H$,(c.getAttribute("type")||"").toLowerCase()):(function(l){var u;if(l.isContentEditable)return!0;const h=(u=l.getAttribute)===null||u===void 0?void 0:u.call(l,"contenteditable");return h==="true"||h===""})(c)))})(e))return!1;const{targetElementList:a}=Fm(e,!1);return!(function(c,l){if(c===!1||O(c))return!1;let u;if(c===!0)u=zm;else{if(!ce(c))return!1;if(c.length>10)return j.error("[PostHog] content_ignorelist array cannot exceed 10 items. Use css_selector_ignorelist for more complex matching."),!1;u=c.map(h=>h.toLowerCase())}return l.some(({safeText:h,ariaLabel:d})=>u.some(p=>Mh(h,p)||Mh(d,p)))})(n,a.map(c=>{var l;return{safeText:ts(c).toLowerCase(),ariaLabel:((l=c.getAttribute("aria-label"))===null||l===void 0?void 0:l.toLowerCase().trim())||""}}))&&!gl(a,r)}var Mu=e=>!e||ct(e,"html")||!Zt(e),Fm=(e,t)=>{if(!A||Mu(e))return{parentIsUsefulElement:!1,targetElementList:[]};let r=!1;const n=[e];let i=e;for(;i.parentNode&&!ct(i,"body");){if(Pu(i.parentNode)){n.push(i.parentNode.host),i=i.parentNode.host;continue}const s=Nm(i);if(!s)break;if(t||xu.indexOf(s.tagName.toLowerCase())>-1)r=!0;else try{const o=A.getComputedStyle(s);o&&o.getPropertyValue("cursor")==="pointer"&&(r=!0)}catch{}n.push(s),i=s}return{parentIsUsefulElement:r,targetElementList:n}};function jn(e){const t=new Set;let r=0;for(let s=e;s.parentNode&&!ct(s,"body");s=s.parentNode){if(r++>=1e3||t.has(s))return!1;t.add(s);const o=Yn(s);if(ue(o,"ph-sensitive")||ue(o,"ph-no-capture"))return!1}if(ue(Yn(e),"ph-include"))return!0;const n=e.type||"";if(ye(n))switch(n.toLowerCase()){case"hidden":case"password":return!1}const i=e.name||e.id||"";return!ye(i)||!/^cc|cardnum|ccnum|creditcard|csc|cvc|cvv|exp|pass|pwd|routing|seccode|securitycode|securitynum|socialsec|socsec|ssn/i.test(i.replace(/[^a-zA-Z0-9]/g,""))}function rs(e){return!!(ct(e,"input")&&!["button","checkbox","submit","reset"].includes(e.type)||ct(e,"select")||ct(e,"textarea")||e.getAttribute("contenteditable")==="true")}var Dh=new RegExp("^(?:(4[0-9]{12}(?:[0-9]{3})?)|(5[1-5][0-9]{14})|(6(?:011|5[0-9]{2})[0-9]{12})|(3[47][0-9]{13})|(3(?:0[0-5]|[68][0-9])[0-9]{11})|((?:2131|1800|35[0-9]{3})[0-9]{11}))$"),Nh=/(^|[^0-9A-Za-z_])([0-9][0-9 -]*[0-9])(?=$|[^0-9A-Za-z_])/g,V$=[16,15,14,13],B$=new RegExp("^(\\d{3}-?\\d{2}-?\\d{4})$"),zh=new RegExp("(^|[^0-9])((?!000|666)[0-9]{3}-?(?!00)[0-9]{2}-?(?!0000)[0-9]{4})(?=$|([^0-9]))","g"),Uh=/[0-9A-Za-z_]/;function G$(e){let t=0,r=!1;for(let n=e.length-1;n>=0;n--){let i=e.charCodeAt(n)-48;r&&(i*=2,i>9&&(i-=9)),t+=i,r=!r}return t%10==0}function Ui(e,t=!0){return!(ge(e)||ye(e)&&(e=pa(e),(t?Dh.test((e||"").replace(/[- ]/g,"")):(function(r){let n;for(Nh.lastIndex=0;n=Nh.exec(r);){const i=n[2];if(!i)continue;const s=i.replace(/[- ]/g,"");for(let o=0;s.length>o;o++)for(const a of V$){const c=o+a;if(s.length>=c){const l=s.slice(o,c);if(Dh.test(l)&&G$(l))return!0}}}return!1})(e))||(t?B$.test(e):(function(r){let n;for(zh.lastIndex=0;n=zh.exec(r);){const i=n[1],s=n[3];if(!(i&&s&&Uh.test(i)&&Uh.test(s)))return!0}return!1})(e))))}function Fh(e){let t=ts(e);return t=`${t} ${qm(e)}`.trim(),Ui(t)?t:""}function qm(e){let t="";return e&&e.childNodes&&e.childNodes.length&&Ce(e.childNodes,function(r){var n;if(r&&((n=r.tagName)===null||n===void 0?void 0:n.toLowerCase())==="span")try{const i=ts(r);t=`${t} ${i}`.trim(),r.childNodes&&r.childNodes.length&&(t=`${t} ${qm(r)}`.trim())}catch(i){j.error("[AutoCapture]",i)}}),t}function qh(e){return e.replace(/"|\\"/g,'\\"')}function W$(e){const t=e.attr__class;if(t)return ce(t)?t:Ou(t)}var Ts=Be("[Dead Clicks]"),Z$=()=>!0,J$=e=>{var t;const r=!!(!((t=e.instance.persistence)===null||t===void 0)&&t.get_property(Ru)),n=e.instance.config.capture_dead_clicks;return vt(n)?n:!!be(n)||r},jh=class{get lazyLoadedDeadClicksAutocapture(){return this.Ho}constructor(e,t,r){this.instance=e,this.isEnabled=t,this.onCapture=r,this.startIfEnabledOrStop()}onRemoteConfig(e){if(!e.ok)return;const t=e.config;"captureDeadClicks"in t&&(this.instance.persistence&&this.instance.persistence.register({[Ru]:t.captureDeadClicks}),this.startIfEnabledOrStop())}startIfEnabledOrStop(){this.isEnabled(this)?this.zo(()=>{this.Uo()}):this.stop()}zo(e){var t,r,n;!((t=te.__PosthogExtensions__)===null||t===void 0)&&t.initDeadClicksAutocapture?e():(r=te.__PosthogExtensions__)===null||r===void 0||(n=r.loadExternalDependency)===null||n===void 0||n.call(r,this.instance,"dead-clicks-autocapture",i=>{i?Ts.error("failed to load script",i):e()})}Uo(){var e;if(N){if(!this.Ho&&(!((e=te.__PosthogExtensions__)===null||e===void 0)&&e.initDeadClicksAutocapture)){const t=be(this.instance.config.capture_dead_clicks)?b({},this.instance.config.capture_dead_clicks):{};t.__onCapture=this.onCapture,this.onCapture&&(t.capture_dead_swipes=!1),this.Ho=te.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,t),this.Ho.start(N),Ts.info("starting...")}}else Ts.error("`document` not found. Cannot start.")}stop(){this.Ho&&(this.Ho.stop(),this.Ho=void 0,Ts.info("stopping..."))}},_i=Be("[SegmentIntegration]");function Hh(e,t,r=!0){const n=e.config.segment;if(!n)return t();const{analytics:i,filterProperties:s}=(a=>tt(a.register))(o=n)?{analytics:o}:o;var o;(function(a,c,l,u){const h=p=>{const f=()=>p.anonymousId()||Lt();a.config.get_device_id=f,u&&p.id()&&(a.register({distinct_id:p.id(),$device_id:f()}),a.persistence.set_property(ft,Ks)),l(u?void 0:p.anonymousId()||void 0)},d=c.user();"then"in d&&tt(d.then)?d.then(h):h(d)})(e,i,a=>{i.register(((c,l,{filterProperties:u}={})=>{typeof Promise<"u"&&Promise.resolve||_i.warn("This browser does not have Promise support, and can not use the segment integration");const h=(d,p)=>{if(!p)return d;const f=!!l&&d.event.anonymousId===l&&!d.event.userId;f||d.event.userId||d.event.anonymousId===c.get_distinct_id()||(_i.info("No userId set, resetting PostHog"),c.reset()),f||(l=void 0),d.event.userId&&d.event.userId!==c.get_distinct_id()&&(_i.info("UserId set, identifying with PostHog"),c.identify(d.event.userId));let v=c.calculateEventProperties(p,d.event.properties);if(!ge(u)){const m=d.event.properties||{},_={};for(const S of Object.keys(v))yu.call(m,S)||(_[S]=v[S]);const w=((S,T)=>{const C=ce(S)?S:[S];let $=b({},T);for(const M of C)try{if($=M($),ge($))return null}catch(L){return _i.error("Error in Segment filterProperties:",L),null}return $})(u,_);if(ge(w))return d;v=w}return d.event.properties=Object.assign({},v,d.event.properties),d};return{name:"PostHog JS",type:"enrichment",version:"1.0.0",isLoaded(){return!0},load(){return Promise.resolve()},track(d){return h(d,d.event.event)},page(d){return h(d,Cu)},identify(d){return h(d,$m)},screen(d){return h(d,"$screen")}}})(e,a,{filterProperties:s})).then(()=>{t()},c=>{_i.error("Failed to register the Segment integration",c),t()})},r)}var jm="posthog-js";function Hm(e,{organization:t,projectId:r,prefix:n,severityAllowList:i=["error"],sendExceptionsToPostHog:s=!0}={}){return o=>{var a,c,l,u,h;if(i!=="*"&&!i.includes(o.level)||!e.__loaded)return o;o.tags||(o.tags={});const d=e.requestRouter.endpointFor("ui",`/project/${e.config.token}/person/${e.get_distinct_id()}`);o.tags["PostHog Person URL"]=d,e.sessionRecordingStarted()&&(o.tags["PostHog Recording URL"]=e.get_session_replay_url({withTimestamp:!0}));const p=((a=o.exception)===null||a===void 0?void 0:a.values)||[],f=p.map(_=>b(b({},_),{},{stacktrace:_.stacktrace?b(b({},_.stacktrace),{},{type:"raw",frames:(_.stacktrace.frames||[]).map(w=>b(b({},w),{},{platform:"web:javascript"}))}):void 0})),v={$exception_message:((c=p[0])===null||c===void 0?void 0:c.value)||o.message,$exception_type:(l=p[0])===null||l===void 0?void 0:l.type,$exception_level:o.level,$exception_list:f,$sentry_event_id:o.event_id,$sentry_exception:o.exception,$sentry_exception_message:((u=p[0])===null||u===void 0?void 0:u.value)||o.message,$sentry_exception_type:(h=p[0])===null||h===void 0?void 0:h.type,$sentry_tags:o.tags};var m;return t&&r&&(v.$sentry_url=(n||"https://sentry.io/organizations/")+t+"/issues/?project="+r+"&query="+o.event_id),s&&((m=e.exceptions)===null||m===void 0||m.sendExceptionEvent(v)),o}}var K$=class{constructor(e,t,r,n,i,s){this.name=jm,this.setupOnce=function(o){o(Hm(e,{organization:t,projectId:r,prefix:n,severityAllowList:i,sendExceptionsToPostHog:s==null||s}))}}},Vh=class{constructor(e){this.Wo=(t,r,n)=>{n&&(n.noSessionId||n.activityTimeout||n.sessionPastMaximumLength||n.crossTabAdoption)&&(j.info("[PageViewManager] Session rotated, clearing pageview state",{sessionId:t,changeReason:n}),this.Vo=void 0,this._instance.scrollManager.resetContext())},this._instance=e,this.Go()}Go(){var e;this.Zo=(e=this._instance.sessionManager)===null||e===void 0?void 0:e.onSessionId(this.Wo)}destroy(){var e;(e=this.Zo)===null||e===void 0||e.call(this),this.Zo=void 0}doPageView(e,t){var r;const n=this.Qo(e,t);return this.Vo={pathname:(r=A?.location.pathname)!==null&&r!==void 0?r:"",pageViewId:t,timestamp:e},this._instance.scrollManager.resetContext(),n}doPageLeave(e){var t;return this.Qo(e,(t=this.Vo)===null||t===void 0?void 0:t.pageViewId)}doEvent(){var e;return{$pageview_id:(e=this.Vo)===null||e===void 0?void 0:e.pageViewId}}Qo(e,t){const r=this.Vo;if(!r)return{$pageview_id:t};let n={$pageview_id:t,$prev_pageview_id:r.pageViewId};const i=this._instance.scrollManager.getContext();if(i&&!this._instance.config.disable_scroll_properties){let{maxScrollHeight:s,lastScrollY:o,maxScrollY:a,maxContentHeight:c,lastContentY:l,maxContentY:u}=i;if(!(O(s)||O(o)||O(a)||O(c)||O(l)||O(u))){s=Math.ceil(s),o=Math.ceil(o),a=Math.ceil(a),c=Math.ceil(c),l=Math.ceil(l),u=Math.ceil(u);const h=s>1?Bt(o/s,0,1,j):1,d=s>1?Bt(a/s,0,1,j):1,p=c>1?Bt(l/c,0,1,j):1,f=c>1?Bt(u/c,0,1,j):1;n=Le(n,{$prev_pageview_last_scroll:o,$prev_pageview_last_scroll_percentage:h,$prev_pageview_max_scroll:a,$prev_pageview_max_scroll_percentage:d,$prev_pageview_last_content:l,$prev_pageview_last_content_percentage:p,$prev_pageview_max_content:u,$prev_pageview_max_content_percentage:f})}}return r.pathname&&(n.$prev_pageview_pathname=r.pathname),r.timestamp&&(n.$prev_pageview_duration=(e.getTime()-r.timestamp.getTime())/1e3),n}},yi=["flags","surveys"],Y$={[i$]:{exposure:"hidden"},[So]:{exposure:"hidden"},[s$]:{exposure:"hidden"},[nl]:{exposure:"hidden"},[qn]:{exposure:"hidden"},[Mi]:{exposure:"hidden"},[pm]:{exposure:"event"},[il]:{exposure:"hidden"},[vm]:{exposure:"hidden"},[sl]:{exposure:"event"},[fm]:{exposure:"hidden"},[ol]:{exposure:"event"},[al]:{exposure:"event"},[Ru]:{exposure:"event"},[Au]:{exposure:"hidden"},[gm]:{exposure:"event"},[Li]:{exposure:"hidden"},[o$]:{exposure:"hidden"},[Mn]:{exposure:"hidden"},[mm]:{exposure:"event"},[a$]:{exposure:"event",shouldSkipFromEventProperties:e=>He(e)},[h$]:{exposure:"event"},[p$]:{exposure:"event"},[f$]:{exposure:"event"},[v$]:{exposure:"event"},[g$]:{exposure:"hidden"},[Mt]:{exposure:"hidden",storageGroup:"flags"},[ir]:{exposure:"hidden",storageGroup:"flags"},[cl]:{exposure:"hidden"},[ln]:{exposure:"hidden",storageGroup:"flags"},[wr]:{exposure:"hidden",storageGroup:"flags"},[un]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[Di]:{exposure:"hidden",storageGroup:"flags"},[qt]:{exposure:"hidden"},[en]:{exposure:"hidden"},[Sr]:{exposure:"hidden"},[Er]:{exposure:"hidden"},[ll]:{exposure:"hidden",storageGroup:"surveys"},[Eo]:{exposure:"hidden",storageGroup:"surveys",volatile:!0},[ym]:{exposure:"event"},[bm]:{exposure:"hidden"},[wm]:{exposure:"hidden"},[ul]:{exposure:"hidden"},[m$]:{exposure:"hidden"},[_$]:{exposure:"hidden"},[y$]:{exposure:"event"},[b$]:{exposure:"event"},[w$]:{exposure:"event"},[S$]:{exposure:"event"},[kr]:{exposure:"hidden"},[Ti]:{exposure:"hidden"},[_m]:{exposure:"event"},[Qi]:{exposure:"hidden"},[Cr]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[ft]:{exposure:"hidden"},[dl]:{exposure:"hidden"},[E$]:{exposure:"hidden"},[Sm]:{exposure:"hidden"},[Em]:{exposure:"hidden"},[Ln]:{exposure:"hidden"},[Iu]:{exposure:"hidden"},[c$]:{exposure:"event"},[l$]:{exposure:"event"},[u$]:{exposure:"event"},[d$]:{exposure:"event"},[Rm]:{exposure:"event"},[Am]:{exposure:"event"},[Im]:{exposure:"event"},[Tm]:{exposure:"event"},[k$]:{exposure:"event"},[R$]:{exposure:"event"},[A$]:{exposure:"event"},[I$]:{exposure:"event"},[T$]:{exposure:"event"},[C$]:{exposure:"event"},[$$]:{exposure:"event"},[P$]:{exposure:"event"}},X$=[["$posthog_sr_group_event_trigger_",{exposure:"hidden"}],["$posthog_sr_group_url_trigger_",{exposure:"hidden"}],["$posthog_sr_group_sampling_",{exposure:"hidden"}]],ot=e=>{const t=Y$[e];if(t)return t;for(const[r,n]of X$)if(e.indexOf(r)===0)return n},Nn=(e,t)=>{try{let r;return JSON.stringify(e,(n,i)=>{var s;return ci(i)?((s=r)!==null&&s!==void 0||(r=new WeakMap),r.has(i)||r.set(i,Pm(i)),r.get(i)):typeof i=="bigint"?i.toString():i},t)}catch{return fg(e)}},Fr=e=>{const t=N?.createElement("a");return O(t)?null:(t.href=e,t)},Xn=function(e,t){const r=((e.split("#")[0]||"").split(/\?(.*)/)[1]||"").replace(/^\?+/g,"").split("&");let n;for(let i=0;r.length>i;i++){const s=r[i].split("=");if(s[0]===t){n=s;break}}if(!ce(n)||2>n.length)return"";{let i=n[1];try{i=decodeURIComponent(i)}catch{j.error("Skipping decoding for malformed query param: "+i)}return i.replace(/\+/g," ")}},ns=function(e,t,r){if(!e||!t||!t.length)return e;const n=e.split("#"),i=n[1],s=(n[0]||"").split("?"),o=s[1],a=s[0],c=(o||"").split("&"),l=[];for(let h=0;c.length>h;h++){const d=c[h].split("=");ce(d)&&(t.includes(d[0])?l.push(d[0]+"="+r):l.push(c[h]))}let u=a;return o!=null&&(u+="?"+l.join("&")),i!=null&&(u+="#"+i),u},Ao=function(e,t){const r=e.match(new RegExp(t+"=([^&]*)"));return r?r[1]:null},Vm=(e,t)=>e>=t&&pg(),Bm=(e,t,r,n)=>{if(e===0){if(pg()){const i=t+1;return i===r&&n(),i}return t}return 0},Qn=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],Q$=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid",...Qn],is="<masked>",eP=["li_fat_id"];function Gm(e,t,r){if(!N)return{};const n=t?[...Qn,...r||[]]:[],i=Wm(ns(N.URL,n,is),e),s=(function(){const o={};return Ce(eP,function(a){const c=Ni(a);o[a]=c||null}),o})();return Le(s,i)}function Wm(e,t){const r=Q$.concat(t||[]),n={};return Ce(r,function(i){const s=Xn(e,i);n[i]=s||null}),n}function Zm(e){const t=(function(i){return i?i.search("https?://(.*)google.([^/?]*)")===0?"google":i.search("https?://(.*)bing.com")===0?"bing":i.search("https?://(.*)yahoo.com")===0?"yahoo":i.search("https?://(.*)duckduckgo.com")===0?"duckduckgo":null:null})(e),r=t!="yahoo"?"q":"p",n={};if(!He(t)){n.$search_engine=t;const i=N?Xn(N.referrer,r):"";i.length&&(n.ph_keyword=i)}return n}function Jm(){return navigator.language||navigator.userLanguage}function tP(){const e=Jm();return typeof e=="string"?e.split("-")[0]:void 0}var Io="$direct";function Km(){return N?.referrer||Io}function Ym(e,t,r=!1){const n=e?[...Qn,...t||[]]:[],i=r?Ur(je?.href):je?.href,s=i?.substring(0,1e3);return{r:Km().substring(0,1e3),u:s?ns(s,n,is):void 0}}function Xm(e,t=!1){var r;const{r:n,u:i}=e,s=t?Ur(i):i,o={$referrer:n,$referring_domain:n==null?void 0:n==Io?Io:(r=Fr(n))===null||r===void 0?void 0:r.host};if(s){o.$current_url=s;const a=Fr(s);o.$host=a?.host,o.$pathname=a?.pathname;const c=Wm(s);Le(o,c)}if(n){const a=Zm(n);Le(o,a)}return o}function Qm(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch{return}}function rP(){try{return new Date().getTimezoneOffset()}catch{return}}var nP={flags:Cr,surveys:Eo},iP=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"],Cs=e=>`${e}_cookie_identity_change_pending`,$s=e=>{let t="",r=0;for(const n of e){const i=encodeURIComponent(JSON.stringify(n).slice(1,-1)).length;if(r+i>1e3)break;t+=n,r+=i}return t},Qe="main",rr=[Mt,ir,ln,wr,un,Cr,Di,Sr],Ja=e=>rr.indexOf(e)!==-1,e_=[qn,Mi],Bh=e=>e_.indexOf(e)!==-1,ur=(e,t)=>{try{return JSON.stringify(e)===JSON.stringify(t)}catch{return e===t}},wn=e=>{if(!e)return{};const t=JSON.parse(e);return be(t)?t:{}},Gh=(e,t)=>{Ce(e,(r,n)=>{const i=ot(n);i&&i.exposure!=="event"||{}.hasOwnProperty.call(t,n)||delete e[n]})},Ka=class{constructor(e,t,r=!0){if(this.Jo={},this.Ko=!1,this.Xo=!1,this.Yo=!1,this.ta=!1,this.ea=!1,this.ia=new Map,this.na=!1,this.sa=!1,this.ra=!1,this.oa=new Set,this.aa=new Set,this.Rr=e,this.la=r,this.props={},this.ua=void 0,this.ha=(n=>{let i="";return n.token&&(i=n.token.replace(/\+/g,"PL").replace(/\//g,"SL").replace(/=/g,"EQ")),n.persistence_name?"ph_"+n.persistence_name:"ph_"+i+"_posthog"})(e),this.qo=this.ca(e),this.Yo=this.da(e),this.load(),this.va(),e.debug&&j.info("Persistence loaded",e.persistence,b({},this.props)),this.update_config(e,e,t),this.save(),A){const n=()=>this.flush();Ie(A,"beforeunload",n,{capture:!1}),Ie(A,"pagehide",n,{capture:!1}),this.fa=i=>{if(this.Ko&&(!i.storageArea||i.storageArea===A?.localStorage)&&i.key)if(i.key!==this.ha){if(this.Yo){const s=yi.find(o=>i.key===this.pa(o));s&&this.ga(i.key,s)}}else this.ga(i.key,Qe)},Ie(A,"storage",this.fa)}}markCrossTabFeatureFlagChanges(e){Object.entries(e).forEach(([t,r])=>{const n=this.ia.get(t);if(!Ja(t)||n===!0)return;if(r===!0)return void this.ma(t,!0);const i=new Set(n||[]);r.forEach(s=>i.add(s)),i.size&&this.ma(t,i)})}onCrossTabFeatureFlagChange(e){return this.aa.add(e),()=>this.aa.delete(e)}destroy(){this.fa&&A&&(A.removeEventListener("storage",this.fa),this.fa=void 0),this.aa.clear()}ga(e,t,r=!0){if(this.mi)return!1;let n,i;try{if(i=ke.Ot(e),He(i)){const a=this.ya(t);return a.storageValue=null,t!==Qe&&(a.persisted=!1),!1}n=wn(i)}catch{return!1}const s=t===Qe?n:ke.Dt(this.ha);if(s&&this.ba(s))return!1;const o=this._a(n,t,r);return t===Qe&&this.Yo&&!ur(this.wa().main,n)||this.ka(n,t,!0,i),o}ba(e){const t=this.props[Pt],r=e[Pt];return!O(t)&&!O(r)&&t!==r}ka(e,t,r,n){const i=this.ya(t);i.storageValue=n,t!==Qe&&(i.persisted=r);try{i.fingerprint=this.Sa(e,t)}catch{i.fingerprint=void 0}}_a(e,t,r){let n=!1;return rr.forEach(i=>{var s;const o=(s=ot(i))===null||s===void 0?void 0:s.storageGroup;if(t===Qe&&this.Yo&&o||t!==Qe&&o!==t)return;const a=i in e,c=this.xa(i,a?e[i]:void 0),l=this.ia.has(i)?i in this.props:a;l===i in this.props&&ur(c,this.props[i])||(l?this.Ca(i,c,!1):this.$a(i,!1),n=!0)}),n&&r&&this.aa.forEach(i=>i()),n}Ta(){if(!this.Ko)return!1;try{this.ra=!1;const e=ke.Ot(this.ha),t=this.ya(Qe);let r,n=!1,i=!1;if(e!==t.storageValue)if(He(e))t.storageValue=null;else{if(r=wn(e),this.ra=!this.sa&&this.ba(r),this.ra)return!1;i=this._a(r,Qe,!1),!this.Yo||ur(this.wa().main,r)?this.ka(r,Qe,!0,e):t.storageValue=e,n=!0}return this.Yo&&yi.forEach(s=>{const o=ke.Ot(this.pa(s)),a=this.ya(s),c=r||{},l=n&&rr.some(h=>{var d;return((d=ot(h))===null||d===void 0?void 0:d.storageGroup)===s&&h in c});if(o===a.storageValue&&!l)return;if(He(o))return a.storageValue=null,a.persisted=!1,void(l&&(i=this._a(c,s,!1)||i));const u=wn(o);i=this._a(u,s,!1)||i,this.ka(u,s,!0,o)}),i}catch{return!1}}ma(e,t){this.ia.set(e,t);const r=ot(e);r!=null&&r.volatile||(this.ya((this.Yo?r?.storageGroup:void 0)||Qe).fingerprint=void 0,this.Ia(e))}Ma(){rr.forEach(e=>this.ia.set(e,!0))}va(){if(this.Ko)try{const e=ke.Ot(this.ha),t=wn(e);this.ya(Qe).storageValue=e,rr.forEach(r=>{var n;const i=this.Yo?(n=ot(r))===null||n===void 0?void 0:n.storageGroup:void 0,s=i?ke.Ot(this.pa(i)):null;if(i){const a=this.ya(i);a.storageValue=s,a.persisted=!He(s)}const o=i&&!He(s)?wn(s):t;r in this.props?this.Ea(r,o[r],this.props[r]):r in o&&this.ma(r,!0)})}catch{}}xa(e,t){const r=this.ia.get(e);if(!r)return t;if(r===!0)return this.props[e];if(e==="$active_feature_flags"){const s=new Set(ce(t)?t:[]),o=new Set(ce(this.props[e])?this.props[e]:[]);return r.forEach(a=>o.has(a)?s.add(a):s.delete(a)),Array.from(s)}const n=be(t)?b({},t):{},i=be(this.props[e])?this.props[e]:{};return r.forEach(s=>{s in i?n[s]=i[s]:delete n[s]}),n}Ea(e,t,r){if(!Ja(e))return;const n=this.ia.get(e);if(n===!0)return;let i=t;if(this.Ko)try{var s;const a=this.Yo?(s=ot(e))===null||s===void 0?void 0:s.storageGroup:void 0,c=a?this.pa(a):this.ha;i=wn(ke.Ot(c))[e]}catch{}const o=new Set(n||[]);if(e==="$active_feature_flags"){if(!O(t)&&!ce(t)||!O(i)&&!ce(i)||!ce(r))return void this.ma(e,!0);const a=new Set(t||[]),c=new Set(i||[]),l=new Set(r);new Set([...a,...l]).forEach(u=>{a.has(u)!==l.has(u)&&o.add(u)}),o.forEach(u=>{c.has(u)===l.has(u)&&o.delete(u)})}else{if(!be(r))return void(ur(i,r)?this.ia.delete(e):this.ma(e,!0));{if(!O(t)&&!be(t)||O(t)&&_t(r)&&O(i))return void this.ma(e,!0);const a=be(t)?t:{},c=be(i)?i:{};new Set([...Object.keys(a),...Object.keys(r)]).forEach(l=>{l in a==l in r&&ur(a[l],r[l])||o.add(l)}),o.forEach(l=>{l in c==l in r&&ur(c[l],r[l])&&o.delete(l)})}}o.size?this.ma(e,o):this.ia.delete(e)}Pa(){var e;const t=(e=this.Rr)===null||e===void 0?void 0:e.persistence_save_debounce_ms;return We(t)&&t>0?t:0}Ra(e){if(this.Rr.cookieWinsOnConflict&&this.Rr.persistence.toLowerCase()==="localstorage+cookie")if(e)try{const t=Ga(e,this.Rr.cookie_persisted_properties||[]),r=$h(t,this.Rr.cookie_persisted_properties||[]),n=JSON.stringify(t)+"|"+JSON.stringify(r),i=qe.Ot(this.ha)||void 0;i&&Wa(this.ha,i)===n&&(this.Aa=n,this.Fa=i)}catch{}else try{const t=qe.Ot(this.ha)||void 0;this.Aa=t?Wa(this.ha,t):void 0,this.Fa=t}catch{}}syncCookieProperties(){return this.Oa(this.Rr)}Oa(e,t=!1){if(this.mi&&!t||this.ea||!e.cookieWinsOnConflict||e.persistence.toLowerCase()!=="localstorage+cookie")return!1;let r;try{r=qe.Ot(this.ha)||void 0}catch{}if(!r||r===this.Fa)return!1;const n=Wa(this.ha,r);let i;try{i=Ba(JSON.parse(r))}catch{return!1}if((qe.Ot(this.ha)||void 0)!==r)return!1;this.Aa=n,this.Fa=r;const s=Ph(this.ha,r),o=[...tn,...s.properties],a={};if(Object.keys(i).forEach(v=>{const m=i[v];(O(m)||He(m)||m===""||v==="$user_state"&&m!=="anonymous"&&m!=="identified")&&(a[v]=!0,delete i[v])}),_t(i))return!1;const c="distinct_id"in i||i.$user_state==="anonymous"||i.$user_state==="identified",l=this.props,u=l[Pt],h=l[ft],d=Le({},l);[...tn,...e.cookie_persisted_properties||[]].forEach(v=>{if(o.indexOf(v)!==-1&&!(v in i)&&!a[v]&&(c||v!=="distinct_id"&&v!=="$user_state")){const m=d[v];(s.isValid||tn.indexOf(v)===-1||m!==!1&&m!==0)&&delete d[v]}}),this.props=Le(d,i),rr.forEach(v=>{const m=v in this.props;v in l===m&&ur(l[v],this.props[v])||(m?this.Ea(v,l[v],this.props[v]):this.ma(v,!0))}),!c||"$user_state"in i||"$user_state"in this.props||this.Ca(ft,sr);const p=this.props[Pt],f=this.props[ft];return!c||p===u&&f===h||(this.sa=!0,this.ta=!0,xe.At(Cs(this.ha),!0),this.$a(Sr),this.$a(ir),this.$a(Mt),this.$a(ln),this.$a(wr),this.$a(un),this.$a(Cr),this.$a(Qi),this.$a(kr),f!=="anonymous"||h!=="identified"&&i.$user_state!=="anonymous"&&(O(u)||p===u)||(Gh(this.props,i),this.$a(Er)),f==="identified"?this.props.$user_id=p:delete this.props.$user_id,this.$a(So)),!0}consumeCookieIdentityChange(){const e=Cs(this.ha),t=this.ta||!!xe.Ot(e);return this.ta=!1,t&&xe.Lt(e),t}Da(e=!1){return!(this.ea||this.mi&&!e||!this.Rr.cookieWinsOnConflict||this.Rr.persistence.toLowerCase()!=="localstorage+cookie"||(this.ea=!0,0))}La(){this.ea&&(O(this.Na)||(clearTimeout(this.Na),this.Na=void 0),delete this.Jo[Qe],this.qa(!0))}ja(e=!0){if(this.ea)try{e?this.La():O(this.Na)||(clearTimeout(this.Na),this.Na=void 0)}finally{this.ea=!1}}isDisabled(){return!!this.mi}ca(e){iP.indexOf(e.persistence.toLowerCase())===-1&&(j.critical("Unknown persistence type "+e.persistence+"; falling back to localStorage+cookie"),e.persistence="localStorage+cookie");const t=((o=[],a=!1)=>{const c=[...tn,...o];return b(b({},ke),{},{Dt(l){try{let h,d={};try{h=qe.Ot(l)||void 0,d=h?Ba(JSON.parse(h)):{}}catch{}const p=JSON.parse(ke.Ot(l)||"{}");let f;if(a){const v=Ph(l,h),m=[...tn,...v.properties],_={};Object.keys(d).forEach(S=>{const T=d[S];He(T)||T===""||S==="$user_state"&&T!=="anonymous"&&T!=="identified"||(_[S]=T)});const w="distinct_id"in _||_.$user_state==="anonymous"||_.$user_state==="identified";if(Object.keys(_).length>0){var u;const S=p[Pt],T=(u=p.$user_state)!==null&&u!==void 0?u:sr;c.forEach(C=>{if(m.indexOf(C)!==-1&&!(C in d)&&(w||C!=="distinct_id"&&C!=="$user_state")){const $=p[C];(v.isValid||tn.indexOf(C)===-1||$!==!1&&$!==0)&&delete p[C]}}),!w||"$user_state"in d||"$user_state"in p||(p[ft]=sr),!w||("distinct_id"in _?_[Pt]:p[Pt])===S&&("$user_state"in _?_[ft]:p[ft])===T||(Va.forEach(C=>delete p[C]),_.$user_state==="identified"&&"distinct_id"in _?p.$user_id=_[Pt]:delete p.$user_id,_.$user_state!=="identified"&&(delete p[_m],delete p[Er]),delete p.__alias)}f=Le(p,_)}else f=Le(d,p);return ke.At(l,f),f}catch{}return null},At(l,u,h,d,p,f){const v=ke.At(l,u,void 0,void 0,f);try{const m=Ga(u,o);if(Object.keys(m).length){if(a){const _=Ro(l),w=$h(m,o);if(qe.At(_,w,h,d,p,f),qe.Ot(_)!==JSON.stringify(w)){qe.Lt(_,d);const S=Ga(u);return qe.At(l,S,h,d,p,f),v}}qe.At(l,m,h,d,p,f)}}catch(m){ke.Pt(m)}return v},Lt(l,u){try{A?.localStorage.removeItem(l),qe.Lt(l,u),qe.Lt(Ro(l),u)}catch(h){ke.Pt(h)}}})})(e.cookie_persisted_properties||[],e.cookieWinsOnConflict);let r,n=!1,i=!1;const s=e.persistence.toLowerCase();return s==="localstorage"&&ke.Et()?(r=ke,i=!0):s==="localstorage+cookie"&&t.Et()?(r=t,i=!0,n=!0):s==="sessionstorage"&&xe.Et()?r=xe:s==="memory"?r=fl:s==="cookie"&&qe.Et()?(r=qe,n=!0):t.Et()?(r=t,i=!0,n=!0):qe.Et()?(r=qe,n=!0):r=fl,this.Ko=i,this.Xo=n,r}pa(e){return`${this.ha}__${e}`}da(e){return this.Ko&&!!e.split_storage}properties(){const e={};return Ce(this.props,(t,r)=>{const n=ot(r);if(!n||n.exposure==="event"){var i;if(!(n==null||(i=n.shouldSkipFromEventProperties)===null||i===void 0)&&i.call(n,t))return;e[r]=t}}),e}load(e=!1){if(this.mi&&!e)return;const t=this.Rr.cookieWinsOnConflict&&this.Rr.persistence.toLowerCase()==="localstorage+cookie",r=t?ke.Dt(this.ha):null;let n={};if(t)try{n=Ba(qe.Dt(this.ha)),Ce(n,(a,c)=>{(O(a)||He(a)||a==="")&&delete n[c]})}catch{}const i=this.qo.Dt(this.ha);if(i&&(this.props=Le({},i)),this.Yo&&this.Ba(),t&&i){var s,o;const a=r?.[Pt],c=(s=r?.$user_state)!==null&&s!==void 0?s:sr,l=i[Pt],u=(o=i.$user_state)!==null&&o!==void 0?o:sr;if(l!==a||u!==c){this.ta=!0,xe.At(Cs(this.ha),!0);const h=Le({},this.props);Va.forEach(p=>delete h[p]),u!=="anonymous"||c!=="identified"&&n.$user_state!=="anonymous"&&(O(a)||l===a)||(Gh(h,n),delete h[Er]),this.props=h;const d=new Set;Va.forEach(p=>{var f;const v=(f=ot(p))===null||f===void 0?void 0:f.storageGroup;v&&d.add(v)}),d.forEach(p=>{const f={};Ce(this.props,(v,m)=>{var _;((_=ot(m))===null||_===void 0?void 0:_.storageGroup)===p&&(f[m]=v)}),_t(f)?(ke.Lt(this.pa(p)),this.Jo[p]={}):ke.At(this.pa(p),f)&&(this.Jo[p]={persisted:!0,fingerprint:this.Sa(f,p)})})}}xe.Ot(Cs(this.ha))&&(this.ta=!0)}Ba(){for(const e of yi){const t=ke.Dt(this.pa(e));if(t&&!_t(t)){const r=this.ya(e);r.persisted=!0,this.Ha(e)||(r.fingerprint=this.Sa(t,e)),this.za(e,t)||Le(this.props,t)}}}Ha(e){return Object.keys(this.props).some(t=>{var r;return((r=ot(t))===null||r===void 0?void 0:r.storageGroup)===e})}za(e,t){const r=nP[e];if(!r)return!1;const n=t[r],i=this.props[r];return We(n)&&We(i)&&i>n}refreshKey(e){var t;if(this.mi||this.oa.has(e))return;const r=this.Yo?(t=ot(e))===null||t===void 0?void 0:t.storageGroup:void 0,n=r?ke.Dt(this.pa(r)):this.qo.Dt(this.ha);if(n&&e in n)this.Ca(e,n[e],!1);else{if(r){const i=this.qo.Dt(this.ha);if(i&&e in i)return void this.Ca(e,i[e],!1)}this.$a(e,!1)}}save(){if(this.mi)return;const e=this.Pa();e>0?O(this.Na)&&(this.Na=setTimeout(()=>{this.Na=void 0,this.qa()},e)):this.qa()}flush(){O(this.Na)||(clearTimeout(this.Na),this.Na=void 0,this.qa())}qa(e=!1){if(this.mi||this.ea&&!e)return;e||(this.syncCookieProperties(),this.Rr.cookieWinsOnConflict&&this.Rr.persistence.toLowerCase()==="localstorage+cookie"||e_.forEach(i=>this.refreshKey(i)));const t=!e&&!this.na;t||(this.ra=!1);const r=!!t&&this.Ta();if(this.ra)return void(this.Rr.debug&&j.warn("skipping persistence write because storage belongs to a different distinct ID"));if(this.Yo)return this.Ua(),void(r&&this.aa.forEach(i=>i()));const n=this.Wa(this.qo,this.ha,this.props,Qe);n==="written"&&this.Ra(this.props),n!=="failed"&&(this.ia.clear(),this.sa=!1,this.oa.clear()),r&&this.aa.forEach(i=>i())}Ua(){const{main:e,groups:t}=this.wa(),r=this.Wa(this.qo,this.ha,e,Qe);r==="written"&&this.Ra(e),r!=="failed"&&(this.sa=!1,this.oa.clear(),rr.forEach(i=>{var s;(s=ot(i))!==null&&s!==void 0&&s.storageGroup||this.ia.delete(i)}));for(const i of yi){var n;const s=t[i];if(_t(s)&&!(!((n=this.Jo[i])===null||n===void 0)&&n.persisted)){rr.forEach(a=>{var c;((c=ot(a))===null||c===void 0?void 0:c.storageGroup)===i&&this.ia.delete(a)});continue}const o=this.Wa(ke,this.pa(i),s,i);o!=="failed"&&rr.forEach(a=>{const c=ot(a);c?.storageGroup!==i||o!=="written"&&c.volatile||this.ia.delete(a)})}}wa(){const e={},t={flags:{},surveys:{}};return Ce(this.props,(r,n)=>{var i;const s=(i=ot(n))===null||i===void 0?void 0:i.storageGroup;s?t[s][n]=r:e[n]=r}),{main:e,groups:t}}Sa(e,t){if(t===Qe)return JSON.stringify(e)+"|"+this.Va+"|"+this.Ga+"|"+this.Za;const r={};return Ce(e,(n,i)=>{var s;r[i]=!((s=ot(i))===null||s===void 0)&&s.volatile?"__volatile__":n}),JSON.stringify(r)}Wa(e,t,r,n){const i=this.ya(n);if(n!==Qe&&!i.dirty&&!O(i.fingerprint))return"skipped";let s;try{if(s=this.Sa(r,n),s===i.fingerprint)return i.dirty=!1,"skipped"}catch{s=void 0}return e.At(t,r,this.Va,this.Ga,this.Za,this.Rr.debug)?(i.dirty=!1,n!==Qe&&(i.persisted=!0),O(s)||(i.fingerprint=s),this.Ko&&(i.storageValue=ke.Ot(t)),"written"):(this.Rr.debug&&j.warn(`failed to persist storage entry "${t}"; will retry on next save`),"failed")}remove({keepGroupEntries:e=!1}={}){if(this.Ma(),O(this.Na)||(clearTimeout(this.Na),this.Na=void 0),this.qo.Lt(this.ha,!1),this.qo.Lt(this.ha,!0),!e&&this.la)for(const t of yi)ke.Lt(this.pa(t));e?delete this.Jo[Qe]:this.Jo={},this.Aa=void 0,this.Fa=void 0}clear(){this.remove(),this.props={}}register_once(e,t,r){if(be(e)){this.syncCookieProperties(),O(t)&&(t="None"),this.Va=O(r)?this.Qa:r;let n=!1;if(Ce(e,(i,s)=>{this.props.hasOwnProperty(s)&&this.props[s]!==t||(this.Ca(s,i),n=!0)}),n)return this.save(),!0}return!1}register(e,t){if(be(e)){this.syncCookieProperties(),this.Va=O(t)?this.Qa:t;let r=!1;if(Ce(e,(n,i)=>{e.hasOwnProperty(i)&&(this.props[i]!==n||be(n)||ce(n))&&(this.Ca(i,n),r=!0)}),r)return this.save(),!0}return!1}unregister(e){this.syncCookieProperties();const t=typeof e=="string"?[e]:e;let r=!1;for(const n of t)n in this.props&&(this.$a(n),r=!0);r&&this.save()}update_campaign_params(){const e=N?.URL;if(e===this.ua)return;const t=Gm(this.Rr.custom_campaign_params,this.Rr.mask_personal_data_properties,this.Rr.custom_personal_data_properties),r=!_t($u(t));return r&&this.register(t),this.ua=e,r?t:void 0}update_search_keyword(){this.register((function(){const e=N?.referrer;return e?Zm(e):{}})())}update_referrer_info(){var e;this.register_once({$referrer:Km(),$referring_domain:N?.referrer&&((e=Fr(N.referrer))===null||e===void 0?void 0:e.host)||Io},void 0)}set_initial_person_info(){if(this.props.$initial_campaign_params||this.props.$initial_referrer_info)return;const e=Ym(this.Rr.mask_personal_data_properties,this.Rr.custom_personal_data_properties,this.Rr.disable_capture_url_hashes);this.register_once({[Ln]:this.Xo?{r:$s(e.r),u:e.u?$s(e.u):void 0}:e},void 0)}get_initial_props(){const e={};Ce([Em,Sm],r=>{const n=this.props[r];n&&Ce(n,function(i,s){e["$initial_"+Jc(s)]=i})});const t=this.props[Ln];if(t){const r=(function(n,i=!1){const s=Xm(n,i),o={};return Ce(s,function(a,c){o[`$initial_${Jc(c)}`]=a}),o})(t,this.Rr.disable_capture_url_hashes);Le(e,r)}return e}safe_merge(e){return Ce(this.props,function(t,r){r in e||(e[r]=t)}),e}update_config(e,t,r){const n=e.persistence!==t.persistence,i=!((p,f)=>{if(p.length!==f.length)return!1;const v=[...p].sort(),m=[...f].sort();return v.every((_,w)=>_===m[w])})(e.cookie_persisted_properties||[],t.cookie_persisted_properties||[]),s=n||i,o=e.cookieWinsOnConflict!==t.cookieWinsOnConflict,a=e.disable_persistence||!!r,c=!!this.mi&&!a;a||this.Oa(t,c),this.Rr=e,!a&&(n||i||o)&&(this.Aa=void 0,this.Fa=void 0,this.Oa(b(b({},e),{},{cookie_persisted_properties:t.cookie_persisted_properties}),c));const l=s||o?this.ca(e):this.qo;this.Ja();const u=this.da(e),h=s||u!==this.Yo,d=!a&&(h||e.cross_subdomain_cookie!==this.Ga||e.secure_cookie!==this.Za)&&this.Da(c);this.na=h;try{if(this.Qa=this.Va=e.cookie_expiration,this.set_disabled(a),this.set_cross_subdomain(e.cross_subdomain_cookie),this.set_secure(e.secure_cookie),h){const p=this.props;this.clear(),this.qo=l,this.Yo=u,this.props=p,this.save()}else o&&(this.qo=l,a||(delete this.Jo[Qe],this.qa()))}finally{this.na=!1,d&&this.ja()}}Ja(){const e=this.props[Ln];if(!this.Xo||!be(e)||typeof e.r!="string")return;const t=$s(e.r),r=typeof e.u=="string"?$s(e.u):e.u;t===e.r&&r===e.u||this.Ca(Ln,b(b({},e),{},{r:t,u:r}))}set_disabled(e){this.mi=e,this.mi?this.remove():this.save()}set_cross_subdomain(e){e!==this.Ga&&(this.Ga=e,this.remove({keepGroupEntries:!0}),this.save())}set_secure(e){e!==this.Za&&(this.Za=e,this.remove({keepGroupEntries:!0}),this.save())}set_event_timer(e,t){const r=this.props.__timers||{};r[e]=t,this.Ca(nl,r),this.save()}remove_event_timer(e){const t=this.props.__timers||{},r=t[e];return O(r)||(delete t[e],this.Ca(nl,t),this.save()),r}get_property(e){return this.props[e]}set_property(e,t){this.Ca(e,t),this.save()}Ca(e,t,r=!0){var n;const i=this.props[e];this.props[e]=t,r&&(e!=="distinct_id"&&e!=="$user_state"||i===t||(this.sa=!0),Bh(e)&&!ur(i,t)&&this.oa.add(e),this.Ea(e,i,t),(n=ot(e))!==null&&n!==void 0&&n.volatile||this.Ia(e))}$a(e,t=!0){delete this.props[e],t&&(Ja(e)&&this.ma(e,!0),Bh(e)&&this.oa.add(e),this.Ia(e))}Ia(e){var t;const r=(t=ot(e))===null||t===void 0?void 0:t.storageGroup;r&&(this.ya(r).dirty=!0)}ya(e){return this.Jo[e]||(this.Jo[e]={})}},St={GZipJS:"gzip-js",Base64:"base64"},bi={Activation:"events",Cancellation:"cancelEvents"},Ya={Popover:"popover",API:"api",Widget:"widget",ExternalSurvey:"external_survey"},or={SHOWN:"survey shown",DISMISSED:"survey dismissed",SENT:"survey sent",ABANDONED:"survey abandoned"},Xa={SURVEY_ID:"$survey_id",SURVEY_NAME:"$survey_name",SURVEY_RESPONSE:"$survey_response",SURVEY_ITERATION:"$survey_iteration",SURVEY_ITERATION_START_DATE:"$survey_iteration_start_date",SURVEY_PARTIALLY_COMPLETED:"$survey_partially_completed",SURVEY_SUBMISSION_ID:"$survey_submission_id",SURVEY_QUESTIONS:"$survey_questions",SURVEY_COMPLETED:"$survey_completed",PRODUCT_TOUR_ID:"$product_tour_id",SURVEY_LAST_SEEN_DATE:"$survey_last_seen_date",SURVEY_LANGUAGE:"$survey_language"},ml={Popover:"popover",Inline:"inline"};function Ps(e){let t=!0;return{dispose(){if(t){t=!1;const r=e();r&&tt(r.then)&&r.then(void 0,()=>{})}}}}var sP={SHOWN:"product tour shown",DISMISSED:"product tour dismissed",COMPLETED:"product tour completed",STEP_SHOWN:"product tour step shown",STEP_COMPLETED:"product tour step completed",BUTTON_CLICKED:"product tour button clicked",STEP_SELECTOR_FAILED:"product tour step selector failed",BANNER_CONTAINER_SELECTOR_FAILED:"product tour banner container selector failed",BANNER_ACTION_CLICKED:"product tour banner action clicked"},Wh={TOUR_ID:"$product_tour_id",TOUR_NAME:"$product_tour_name",TOUR_ITERATION:"$product_tour_iteration",TOUR_RENDER_REASON:"$product_tour_render_reason",TOUR_STEP_ID:"$product_tour_step_id",TOUR_STEP_ORDER:"$product_tour_step_order",TOUR_STEP_TYPE:"$product_tour_step_type",TOUR_DISMISS_REASON:"$product_tour_dismiss_reason",TOUR_BUTTON_TEXT:"$product_tour_button_text",TOUR_BUTTON_ACTION:"$product_tour_button_action",TOUR_BUTTON_LINK:"$product_tour_button_link",TOUR_BUTTON_TOUR_ID:"$product_tour_button_tour_id",TOUR_STEPS_COUNT:"$product_tour_steps_count",TOUR_STEP_SELECTOR:"$product_tour_step_selector",TOUR_STEP_SELECTOR_FOUND:"$product_tour_step_selector_found",TOUR_STEP_ELEMENT_TAG:"$product_tour_step_element_tag",TOUR_STEP_ELEMENT_ID:"$product_tour_step_element_id",TOUR_STEP_ELEMENT_CLASSES:"$product_tour_step_element_classes",TOUR_STEP_ELEMENT_TEXT:"$product_tour_step_element_text",TOUR_ERROR:"$product_tour_error",TOUR_MATCHES_COUNT:"$product_tour_matches_count",TOUR_FAILURE_PHASE:"$product_tour_failure_phase",TOUR_WAITED_FOR_ELEMENT:"$product_tour_waited_for_element",TOUR_WAIT_DURATION_MS:"$product_tour_wait_duration_ms",TOUR_BANNER_SELECTOR:"$product_tour_banner_selector",TOUR_LINKED_SURVEY_ID:"$product_tour_linked_survey_id",USE_MANUAL_SELECTOR:"$use_manual_selector",INFERENCE_DATA_PRESENT:"$inference_data_present",TOUR_LAST_SEEN_DATE:"$product_tour_last_seen_date",TOUR_TYPE:"$product_tour_type"},Zh=Be("[RateLimiter]"),oP=class{constructor(e){this.serverLimits={},this.lastEventRateLimited=!1,this.checkForLimiting=t=>{const r=t.text;if(r&&r.length)try{(JSON.parse(r).quota_limited||[]).forEach(n=>{Zh.info(`${n||"events"} is quota limited.`),this.serverLimits[n]=new Date().getTime()+6e4})}catch(n){Zh.warn(`could not rate limit - continuing. Error: "${n?.message}"`,{text:r});return}},this.instance=e,this.lastEventRateLimited=this.clientRateLimitContext(!0).isRateLimited}get captureEventsPerSecond(){var e;return((e=this.instance.config.rate_limiting)===null||e===void 0?void 0:e.events_per_second)||10}get captureEventsBurstLimit(){var e;return Math.max(((e=this.instance.config.rate_limiting)===null||e===void 0?void 0:e.events_burst_limit)||10*this.captureEventsPerSecond,this.captureEventsPerSecond)}clientRateLimitContext(e=!1){var t,r,n;const{captureEventsBurstLimit:i,captureEventsPerSecond:s}=this,o=new Date().getTime(),a=(t=(r=this.instance.persistence)===null||r===void 0?void 0:r.get_property("$capture_rate_limit"))!==null&&t!==void 0?t:{tokens:i,last:o};a.tokens+=(o-a.last)/1e3*s,a.last=o,a.tokens>i&&(a.tokens=i);const c=1>a.tokens;if(c||e||(a.tokens=Math.max(0,a.tokens-1)),c&&!e){const l=(We(a.dropped)?a.dropped:0)+1;a.dropped=l,!this.lastEventRateLimited&&this.Ka(l)&&(a.dropped=0)}return this.lastEventRateLimited=c,(n=this.instance.persistence)===null||n===void 0||n.set_property("$capture_rate_limit",a),{isRateLimited:c,remainingTokens:a.tokens}}Xa(e){const t=this.instance.config.property_denylist;return!ce(t)||!t.includes(e)}Ya(){var e;if(this.Xa("$current_url")&&this.Xa("$pathname")&&je?.pathname)return`${(e=je.origin)!==null&&e!==void 0?e:""}${je.pathname}`}Ka(e){var t,r;const{captureEventsBurstLimit:n,captureEventsPerSecond:i}=this,s=this.Ya(),o=this.Xa("$session_id")?(t=(r=this.instance).get_session_id)===null||t===void 0?void 0:t.call(r):void 0,a=[`${e} event(s) dropped since the last warning`,s?`triggered on ${s}`:void 0,o?`session ${o}`:void 0].filter(Boolean).join(", ");return!!this.instance.capture("$$client_ingestion_warning",{$$client_ingestion_warning_message:`posthog-js client rate limited: ${a}. Config is set to ${i} events per second and ${n} events burst limit.`},{skip_client_rate_limiting:!0})}isServerRateLimited(e){const t=this.serverLimits[e||"events"]||!1;return t!==!1&&new Date().getTime()<t}},dr=Be("[RemoteConfig]"),t_=class{constructor(e){this._instance=e}get remoteConfig(){var e;return(e=te._POSTHOG_REMOTE_CONFIG)===null||e===void 0||(e=e[this._instance.config.token])===null||e===void 0?void 0:e.config}tl(e){var t,r,n;!((t=te.__PosthogExtensions__)===null||t===void 0)&&t.loadExternalDependency?(r=te.__PosthogExtensions__)===null||r===void 0||(n=r.loadExternalDependency)===null||n===void 0||n.call(r,this._instance,"remote-config",()=>e(this.remoteConfig)):e()}el(e){this._instance._send_request({method:"GET",url:this._instance.requestRouter.endpointFor("assets",`/array/${this._instance.config.token}/config`),callback:e})}load(){try{if(this.remoteConfig)return dr.info("Using preloaded remote config",this.remoteConfig),void this.il(this.remoteConfig);if(this._instance.nl())return void dr.warn("Remote config is disabled. Falling back to local config.");this.tl(e=>{if(!e)return dr.info("No config found after loading remote JS config. Falling back to JSON."),void this.el(t=>{this.il(t.json,t)});this.il(e)})}catch(e){dr.error("Error loading remote config",e),this.il()}}il(e,t){!e&&t&&(t.statusCode===0?t.error||dr.warn("Failed to fetch remote config from PostHog."):dr.error("Failed to fetch remote config from PostHog."));try{this._instance.il(e?{ok:!0,config:e}:{ok:!1})}catch(n){dr.error("Error applying remote config",n)}if(e?.hasFeatureFlags!==!1&&!this._instance.config.advanced_disable_feature_flags_on_first_load)try{var r;(r=this._instance.featureFlags)===null||r===void 0||r.ensureFlagsLoaded()}catch(n){dr.error("Error loading feature flags",n)}}},Et=Uint8Array,gt=Uint16Array,ei=Uint32Array,Lu=new Et([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),Du=new Et([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),Jh=new Et([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),r_=function(e,t){for(var r=new gt(31),n=0;31>n;++n)r[n]=t+=1<<e[n-1];var i=new ei(r[30]);for(n=1;30>n;++n)for(var s=r[n];r[n+1]>s;++s)i[s]=s-r[n]<<5|n;return[r,i]},n_=r_(Lu,2),_l=n_[1];n_[0][28]=258,_l[258]=28;for(var Kh=r_(Du,0)[1],yl=new gt(32768),Ve=0;32768>Ve;++Ve){var Sn=(43690&Ve)>>>1|(21845&Ve)<<1;yl[Ve]=((65280&(Sn=(61680&(Sn=(52428&Sn)>>>2|(13107&Sn)<<2))>>>4|(3855&Sn)<<4))>>>8|(255&Sn)<<8)>>>1}var Fi=function(e,t,r){for(var n=e.length,i=0,s=new gt(t);n>i;++i)++s[e[i]-1];var o,a=new gt(t);for(i=0;t>i;++i)a[i]=a[i-1]+s[i-1]<<1;if(r){o=new gt(1<<t);var c=15-t;for(i=0;n>i;++i)if(e[i])for(var l=i<<4|e[i],u=t-e[i],h=a[e[i]-1]++<<u,d=h|(1<<u)-1;d>=h;++h)o[yl[h]>>>c]=l}else for(o=new gt(n),i=0;n>i;++i)o[i]=yl[a[e[i]-1]++]>>>15-e[i];return o},vn=new Et(288);for(Ve=0;144>Ve;++Ve)vn[Ve]=8;for(Ve=144;256>Ve;++Ve)vn[Ve]=9;for(Ve=256;280>Ve;++Ve)vn[Ve]=7;for(Ve=280;288>Ve;++Ve)vn[Ve]=8;var To=new Et(32);for(Ve=0;32>Ve;++Ve)To[Ve]=5;var aP=Fi(vn,9,0),cP=Fi(To,5,0),i_=function(e){return(e/8|0)+(7&e&&1)},s_=function(e,t,r){(t==null||0>t)&&(t=0),(r==null||r>e.length)&&(r=e.length);var n=new(e instanceof gt?gt:e instanceof ei?ei:Et)(r-t);return n.set(e.subarray(t,r)),n},Yt=function(e,t,r){var n=t/8|0;e[n]|=r<<=7&t,e[n+1]|=r>>>8},wi=function(e,t,r){var n=t/8|0;e[n]|=r<<=7&t,e[n+1]|=r>>>8,e[n+2]|=r>>>16},Qa=function(e,t){for(var r=[],n=0;e.length>n;++n)e[n]&&r.push({s:n,f:e[n]});var i=r.length,s=r.slice();if(!i)return[new Et(0),0];if(i==1){var o=new Et(r[0].s+1);return o[r[0].s]=1,[o,1]}r.sort(function(C,$){return C.f-$.f}),r.push({s:-1,f:25001});var a=r[0],c=r[1],l=0,u=1,h=2;for(r[0]={s:-1,f:a.f+c.f,l:a,r:c};u!=i-1;)a=r[r[h].f>r[l].f?l++:h++],c=r[l!=u&&r[h].f>r[l].f?l++:h++],r[u++]={s:-1,f:a.f+c.f,l:a,r:c};var d=s[0].s;for(n=1;i>n;++n)s[n].s>d&&(d=s[n].s);var p=new gt(d+1),f=bl(r[u-1],p,0);if(f>t){n=0;var v=0,m=f-t,_=1<<m;for(s.sort(function(C,$){return p[$.s]-p[C.s]||C.f-$.f});i>n;++n){var w=s[n].s;if(t>=p[w])break;v+=_-(1<<f-p[w]),p[w]=t}for(v>>>=m;v>0;){var S=s[n].s;t>p[S]?v-=1<<t-p[S]++-1:++n}for(;n>=0&&v;--n){var T=s[n].s;p[T]==t&&(--p[T],++v)}f=t}return[new Et(p),f]},bl=function(e,t,r){return e.s==-1?Math.max(bl(e.l,t,r+1),bl(e.r,t,r+1)):t[e.s]=r},Yh=function(e){for(var t=e.length;t&&!e[--t];);for(var r=new gt(++t),n=0,i=e[0],s=1,o=function(c){r[n++]=c},a=1;t>=a;++a)if(e[a]==i&&a!=t)++s;else{if(!i&&s>2){for(;s>138;s-=138)o(32754);s>2&&(o(s>10?s-11<<5|28690:s-3<<5|12305),s=0)}else if(s>3){for(o(i),--s;s>6;s-=6)o(8304);s>2&&(o(s-3<<5|8208),s=0)}for(;s--;)o(i);s=1,i=e[a]}return[r.subarray(0,n),t]},Si=function(e,t){for(var r=0,n=0;t.length>n;++n)r+=e[n]*t[n];return r},Xs=function(e,t,r){var n=r.length,i=i_(t+2);e[i]=255&n,e[i+1]=n>>>8,e[i+2]=255^e[i],e[i+3]=255^e[i+1];for(var s=0;n>s;++s)e[i+s+4]=r[s];return 8*(i+4+n)},Xh=function(e,t,r,n,i,s,o,a,c,l,u){Yt(t,u++,r),++i[256];for(var h=Qa(i,15),d=h[0],p=h[1],f=Qa(s,15),v=f[0],m=f[1],_=Yh(d),w=_[0],S=_[1],T=Yh(v),C=T[0],$=T[1],M=new gt(19),L=0;w.length>L;++L)M[31&w[L]]++;for(L=0;C.length>L;++L)M[31&C[L]]++;for(var q=Qa(M,7),X=q[0],ee=q[1],k=19;k>4&&!X[Jh[k-1]];--k);var ie,H,oe,I,Q=l+5<<3,y=Si(i,vn)+Si(s,To)+o,V=Si(i,d)+Si(s,v)+o+14+3*k+Si(M,X)+(2*M[16]+3*M[17]+7*M[18]);if(y>=Q&&V>=Q)return Xs(t,u,e.subarray(c,c+l));if(Yt(t,u,1+(y>V)),u+=2,y>V){ie=Fi(d,p,0),H=d,oe=Fi(v,m,0),I=v;var K=Fi(X,ee,0);for(Yt(t,u,S-257),Yt(t,u+5,$-1),Yt(t,u+10,k-4),u+=14,L=0;k>L;++L)Yt(t,u+3*L,X[Jh[L]]);u+=3*k;for(var le=[w,C],de=0;2>de;++de){var $e=le[de];for(L=0;$e.length>L;++L)Yt(t,u,K[Re=31&$e[L]]),u+=X[Re],Re>15&&(Yt(t,u,$e[L]>>>5&127),u+=$e[L]>>>12)}}else ie=aP,H=vn,oe=cP,I=To;for(L=0;a>L;++L)if(n[L]>255){var Re;wi(t,u,ie[257+(Re=n[L]>>>18&31)]),u+=H[Re+257],Re>7&&(Yt(t,u,n[L]>>>23&31),u+=Lu[Re]);var _e=31&n[L];wi(t,u,oe[_e]),u+=I[_e],_e>3&&(wi(t,u,n[L]>>>5&8191),u+=Du[_e])}else wi(t,u,ie[n[L]]),u+=H[n[L]];return wi(t,u,ie[256]),u+H[256]},lP=new ei([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),uP=new Et(0),dP=(function(){for(var e=new ei(256),t=0;256>t;++t){for(var r=t,n=9;--n;)r=(1&r&&3988292384)^r>>>1;e[t]=r}return e})(),ec=function(e,t,r){for(;r;++t)e[t]=r,r>>>=8};function hP(e,t){t===void 0&&(t={});var r=(function(){var d=4294967295;return{p(p){for(var f=d,v=0;p.length>v;++v)f=dP[255&f^p[v]]^f>>>8;d=f},d(){return 4294967295^d}}})(),n=e.length;r.p(e);var i,s,o,a,c,l,u=(a=10+((i=t).filename&&i.filename.length+1||0),c=8,(function(d,p,f,v,m,_){var w=d.length,S=new Et(v+w+5*(1+Math.floor(w/7e3))+m),T=S.subarray(v,S.length-m),C=0;if(!p||8>w)for(var $=0;w>=$;$+=65535){var M=$+65535;w>M?C=Xs(T,C,d.subarray($,M)):(T[$]=_,C=Xs(T,C,d.subarray($,w)))}else{for(var L=lP[p-1],q=L>>>13,X=8191&L,ee=(1<<f)-1,k=new gt(32768),ie=new gt(ee+1),H=Math.ceil(f/3),oe=2*H,I=function(g){return(d[g]^d[g+1]<<H^d[g+2]<<oe)&ee},Q=new ei(25e3),y=new gt(288),V=new gt(32),K=0,le=0,de=($=0,0),$e=0,Re=0;w>$;++$){var _e=I($),ve=32767&$,Je=ie[_e];if(k[ve]=Je,ie[_e]=ve,$>=$e){var Xe=w-$;if((K>7e3||de>24576)&&Xe>423){C=Xh(d,T,0,Q,y,V,le,de,Re,$-Re,C),de=K=le=0,Re=$;for(var Pe=0;286>Pe;++Pe)y[Pe]=0;for(Pe=0;30>Pe;++Pe)V[Pe]=0}var z=2,se=0,ae=X,he=ve-Je&32767;if(Xe>2&&_e==I($-he))for(var Oe=Math.min(q,Xe)-1,we=Math.min(32767,$),Se=Math.min(258,Xe);we>=he&&--ae&&ve!=Je;){if(d[$+z]==d[$+z-he]){for(var pe=0;Se>pe&&d[$+pe]==d[$+pe-he];++pe);if(pe>z){if(z=pe,se=he,pe>Oe)break;var me=Math.min(he,pe-2),Ee=0;for(Pe=0;me>Pe;++Pe){var Ge=$-he+Pe+32768&32767,U=Ge-k[Ge]+32768&32767;U>Ee&&(Ee=U,Je=Ge)}}}he+=(ve=Je)-(Je=k[ve])+32768&32767}if(se){Q[de++]=268435456|_l[z]<<18|Kh[se];var W=31&_l[z],Y=31&Kh[se];le+=Lu[W]+Du[Y],++y[257+W],++V[Y],$e=$+z,++K}else Q[de++]=d[$],++y[d[$]]}}C=Xh(d,T,_,Q,y,V,le,de,Re,$-Re,C),_||(C=Xs(T,C,uP))}return s_(S,0,v+i_(C)+m)})(s=e,(o=t).level==null?6:o.level,o.mem==null?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(s.length)))):12+o.mem,a,c,!l)),h=u.length;return(function(d,p){var f=p.filename;if(d[0]=31,d[1]=139,d[2]=8,d[8]=2>p.level?4:p.level==9?2:0,d[9]=3,p.mtime!=0&&ec(d,4,Math.floor(new Date(p.mtime||Date.now())/1e3)),f){d[3]=8;for(var v=0;f.length>=v;++v)d[v+10]=f.charCodeAt(v)}})(u,t),ec(u,h-8,r.d()),ec(u,h-4,n),u}var pP=!!_u||!!Yi,o_=new WeakMap,a_="text/plain",tc=0,Qs=!1,c_=(e,t)=>{const[r,n]=e.split("#"),[i,s]=r.split("?");if(!s)return e;const o=s.split("&").filter(a=>a.split("=")[0]!==t).join("&");return`${i}${o?`?${o}`:""}${n?`#${n}`:""}`},ds=(e,t,r=!0)=>{var n;const[i,s]=e.split("?"),o=b({},t),a=(n=s?.split("&").map(l=>{var u;const[h,d]=l.split("="),p=r&&(u=o[h])!==null&&u!==void 0?u:d;return delete o[h],`${h}=${p}`}))!==null&&n!==void 0?n:[],c=(function(l,u="&"){let h,d;const p=[];return Ce(l,function(f,v){O(f)||O(v)||v==="undefined"||(h=encodeURIComponent((m=>m instanceof File)(f)?f.name:f.toString()),d=encodeURIComponent(v),p[p.length]=d+"="+h)}),p.join(u)})(o);return c&&a.push(c),a.length>0?`${i}?${a.join("&")}`:i},rc=e=>{if(e.sl)return e.sl;const{data:t,compression:r}=e;if(!t)return;if(r===St.GZipJS){const i=hP((function(s){var o=s.length;if(typeof TextEncoder<"u")return new TextEncoder().encode(s);for(var a=new Et(s.length+(s.length>>>1)),c=0,l=function(p){a[c++]=p},u=0;o>u;++u){if(c+5>a.length){var h=new Et(c+8+(o-u<<1));h.set(a),a=h}var d=s.charCodeAt(u);128>d?l(d):2048>d?(l(192|d>>>6),l(128|63&d)):d>55295&&57344>d?(l(240|(d=65536+(1047552&d)|1023&s.charCodeAt(++u))>>>18),l(128|d>>>12&63),l(128|d>>>6&63),l(128|63&d)):(l(224|d>>>12),l(128|d>>>6&63),l(128|63&d))}return s_(a,0,c)})(Nn(t)),{mtime:0});return{contentType:a_,body:i.buffer.slice(i.byteOffset,i.byteOffset+i.byteLength),estimatedSize:i.byteLength}}if(r===St.Base64){const i=(s=>"data="+encodeURIComponent(typeof s=="string"?s:Nn(s)))((function(s){return s&&btoa(encodeURIComponent(s).replace(/%([0-9A-F]{2})/g,(o,a)=>String.fromCharCode(parseInt(a,16))))})(Nn(t)));return{contentType:"application/x-www-form-urlencoded",body:i,estimatedSize:new Blob([i]).size}}const n=Nn(t);return{contentType:"application/json",body:n,estimatedSize:new Blob([n]).size}},l_=e=>{const t=()=>e.transport==="sendBeacon"?{url:ds(e.url,{compression:St.Base64}),encodedBody:rc(b(b({},e),{},{compression:St.Base64,sl:void 0}))}:{url:c_(e.url,"compression"),encodedBody:rc(b(b({},e),{},{compression:void 0,sl:void 0}))};let r;try{r=rc(e)}catch(i){if(_h(e.compression,Xn(e.url,"compression")))return j.error("Failed to gzip request body, sending uncompressed payload",i),t();throw i}return r&&_h(e.compression,Xn(e.url,"compression"))&&!((n=r.body)instanceof ArrayBuffer?tl(new Uint8Array(n)):ArrayBuffer.isView(n)&&tl(new Uint8Array(n.buffer,n.byteOffset,n.byteLength)))?(Qs=!0,t()):{url:e.url,encodedBody:r};var n},u_=e=>{try{return l_(e)}catch(r){var t;j.error(r),(t=e.callback)===null||t===void 0||t.call(e,{statusCode:0,error:r});return}},fP=(function(){var e=Ue(function*(t){const r=yield(function(i){return rl.apply(this,arguments)})(Nn(t.data),et.DEBUG,{rethrow:!0});if(!r)return t;const n=yield r.arrayBuffer();return b(b({},t),{},{sl:{contentType:a_,body:n,estimatedSize:n.byteLength}})});return function(t){return e.apply(this,arguments)}})(),vP=/Failed to fetch|NetworkError|Load failed/i,d_=e=>e?.name==="TypeError"&&vP.test(e?.message||""),h_=e=>{try{const t=(function(r,n=Date.now()){if(typeof r!="string"||!r)return;const i=r.trim(),s=/^\d+\s*,/.test(i)?i.slice(0,i.indexOf(",")).trim():i;if(/^\d+$/.test(s)){const c=1e3*Math.min(Number(s),300);return c>0?c:void 0}if(!/^(Mon|Tue|Wed|Thu|Fri|Sat|Sun)[a-z]*[ ,]/.test(s))return;const o=/^\w{3} \w{3} /.test(s)?s+" GMT":s,a=Date.parse(o)-n;return Number.isFinite(a)&&a>0?Math.min(a,Js):void 0})(e());return O(t)?void 0:Math.min(t,3e4)}catch{return}},p_=e=>{const t=u_(e);if(!t)return;const r=new _u;o_.set(r,!0);const{url:n,encodedBody:i}=t;r.open(e.method||"GET",n,!0);const{contentType:s,body:o}=i??{};Ce(e.headers,function(a,c){r.setRequestHeader(c,a)}),s&&r.setRequestHeader("Content-Type",s),e.timeout&&(r.timeout=e.timeout),r.onreadystatechange=()=>{if(r.readyState===4){var a;const c={statusCode:r.status,text:r.responseText};if(r.status===200)try{c.json=JSON.parse(r.responseText)}catch{}(a=e.callback)===null||a===void 0||a.call(e,c,h_(()=>r.getResponseHeader("Retry-After")))}},r.send(o)},f_=e=>{const t=u_(e);if(!t)return;const{url:r,encodedBody:n}=t,{contentType:i,body:s,estimatedSize:o}=n??{},a=new Headers;Ce(e.headers,function(f,v){a.append(v,f)}),i&&a.append("Content-Type",i);let c=null,l=!1;if(rh){const f=new rh;c={signal:f.signal,timeout:setTimeout(()=>{l=!0;try{f.abort(Zg("AbortError","PostHog request timed out"+((v=e.timeout)?` after ${v}ms`:"")))}catch(m){h(m)}var v},e.timeout)}}let u=!1;const h=f=>{var v;u||(u=!0,l&&f?.name==="AbortError"||d_(f)?j.warn(f):j.error(f),(v=e.callback)===null||v===void 0||v.call(e,{statusCode:0,error:f}))};let d=0;const p=()=>{tc-=d,d=0,c&&clearTimeout(c.timeout)};try{const f=b({method:e?.method||"GET",headers:a,referrerPolicy:"strict-origin",body:s,signal:c?.signal},e.fetchOptions),v=o??(O(s)?0:void 0);f.keepalive=f.method==="POST"&&!e.rl&&f.keepalive!==!1&&f.body===s&&!O(v)&&v>=0&&52428.8>tc+v,f.keepalive&&(d=v,tc+=d),Yi(r,f).then(m=>m.text().then(_=>{var w;if(u)return;const S={statusCode:m.status,text:_};if(m.status===200)try{S.json=JSON.parse(_)}catch(T){j.error(T)}u=!0,p(),(w=e.callback)===null||w===void 0||w.call(e,S,h_(()=>m.headers.get("Retry-After")))})).catch(m=>{p(),h(m)}).finally(p)}catch(f){p(),h(f)}},wl=e=>{try{var t;const{url:r,encodedBody:n}=l_(e),{contentType:i,body:s,estimatedSize:o}=n??{};if(!s)return;const a=s instanceof Blob?s:new Blob([s],{type:i});if(rt.sendBeacon(r,a))return;const c=ce(e.data)?e.data:(t=e.data)===null||t===void 0?void 0:t.batch;if(ce(c)&&c.length>1&&(o??0)>16384){const l=Math.ceil(c.length/2),u=h=>ce(e.data)?h:b(b({},e.data),{},{batch:h});wl(b(b({},e),{},{data:u(c.slice(0,l))})),wl(b(b({},e),{},{data:u(c.slice(l))}));return}j.warn(`Beacon of ~${o??0} bytes was rejected by the browser, falling back to ${Yi?"fetch":"XHR"}`),Yi?f_(b(b({},e),{},{rl:!0})):p_(e)}catch(r){j.warn("Beacon send failed",r)}},Qh=(e,t,r,n)=>{const i=n==="query"?t==="POST"?"sent_at":"_":void 0;return ds(r===St.GZipJS?c_(e,"compression"):e,b(b({},i?{[i]:Date.now().toString()}:{}),r===St.GZipJS?{}:{compression:r}))},gP=(()=>{const e=[];return Yi&&e.push({transport:"fetch",method:f_}),_u&&e.push({transport:"XHR",method:p_}),rt!=null&&rt.sendBeacon&&e.push({transport:"sendBeacon",method:wl}),e})(),v_=!pP&&pt?.indexOf("MSIE")===-1&&pt?.indexOf("Mozilla")===-1;function g_(e,t,r){var n,i,s;r&&(t=b(b({},t),{},{callback:o=>r(o)})),e.__loaded?v_?e.__request_queue.push(t):e.rateLimiter.isServerRateLimited(t.batchKey)?t.fireCallbackOnDrop&&((i=t.callback)===null||i===void 0||i.call(t,{statusCode:429})):(t.transport=t.transport||e.config.api_transport,t.headers=b(b({},e.config.request_headers),t.headers),t.compression=t.compression==="best-available"?(n=e.compression)!==null&&n!==void 0?n:t.compressionFallback:t.compression,(O(e.config.disable_beacon)?e.config.__preview_disable_beacon:e.config.disable_beacon)&&(t.disableTransport=["sendBeacon"]),t.fetchOptions=t.fetchOptions||e.config.fetch_options,((o,a)=>{var c,l,u;const h=b(b({},o),{},{callback:a??(m=>{var _;return(_=o.callback)===null||_===void 0?void 0:_.call(o,m)})});h.timeout=h.timeout||6e4;const d=(c=h.transport)!==null&&c!==void 0?c:"fetch";d==="sendBeacon"&&O(h.compression)&&h.data&&(h.compression=St.Base64),h.method==="POST"&&h.data&&(h.timestampMode==="capture-body"?h.data=(m=>{var _,w;const S=(ce(m)?m:[m]).map(C=>b(b({},C),C.timestamp instanceof Date&&!isNaN(C.timestamp.getTime())?{timestamp:C.timestamp.toISOString()}:{})),T=S[0];return{api_key:(_=T==null||(w=T.properties)===null||w===void 0?void 0:w.token)!==null&&_!==void 0?_:T?.token,batch:S,sent_at:new Date().toISOString()}})(h.data):h.timestampMode==="body"&&(h.data=((m,_=new Date().toISOString())=>ce(m)?m.map(w=>b(b({},w),{},{sent_at:_})):b(b({},m),{},{sent_at:_}))(h.data))),h.url=Qh(h.url,h.method,h.compression,h.timestampMode);const p=gP.filter(m=>!h.disableTransport||!m.transport||!h.disableTransport.includes(m.transport)),f=(l=(u=(function(m,_){for(let w=0;m.length>w;w++)if(_(m[w]))return m[w]})(p,m=>m.transport===d))===null||u===void 0?void 0:u.method)!==null&&l!==void 0?l:p[0].method;if(!f)throw new Error("No available transport method");const v=m=>{try{f(m)}catch(w){var _;d_(w)?j.warn(w):j.error(w),(_=h.callback)===null||_===void 0||_.call(h,{statusCode:0,error:w})}};d!=="sendBeacon"&&!h.preferSyncCompression&&h.data&&h.compression===St.GZipJS&&QT&&typeof Promise<"u"&&!Qs?fP(h).then(m=>{v(m)}).catch(m=>{if(yh(m))return Qs=!0,void v(b(b({},h),{},{compression:void 0,url:Qh(o.url,o.method,void 0,o.timestampMode)}));(_=>{if(!_||typeof _!="object")return!1;const w="name"in _?String(_.name):"";return yh(_)||w===tm})(m)&&(Qs=!0),v(h)}):v(h)})(t,(o,a)=>{var c,l,u;e.rateLimiter.checkForLimiting(o),400>o.statusCode||(c=(l=e.config).on_request_error)===null||c===void 0||c.call(l,o),r?r(o,a):(u=t.callback)===null||u===void 0||u.call(t,o)})):t.fireCallbackOnDrop&&((s=t.callback)===null||s===void 0||s.call(t,{statusCode:0}))}var mP=class{constructor(e,t){this.ol=!0,this.al=[],this.ll=Bt(t?.flush_interval_ms||3e3,250,5e3,j.createLogger("flush interval"),3e3),this.ul=e}enqueue(e){this.al.push(e),this.hl||this.cl()}unload(){this.dl();const e=this.al.length>0?this.vl():{},t=Object.values(e);[...t.filter(r=>r.url.indexOf("/e")===0),...t.filter(r=>r.url.indexOf("/e")!==0)].map(r=>{this.fl(r,"sendBeacon")})}enable(){this.ol=!1,this.cl()}cl(){this.ol||(this.hl=setTimeout(()=>{if(this.dl(),this.al.length>0){const e=this.vl();for(const t in e)this.fl(e[t])}},this.ll))}fl(e,t){try{this.ul(e,t)}catch(r){j.error(r)}}dl(){clearTimeout(this.hl),this.hl=void 0}vl(){const e={};return Ce(this.al,t=>{var r;const n=t,i=((n?n.batchKey:null)||n.url)+(n.batchGroup?`:${n.batchGroup}`:"");O(e[i])&&(e[i]=b(b({},n),{},{data:[]})),(r=e[i].data)===null||r===void 0||r.push(n.data)}),this.al=[],e}},_P=["retriesPerformedSoFar"],yP=class{constructor(e){this._instance=e,this.pl=!1,this.gl=3e3,this.al=[],this.al=[],this.ml=!0,this.resume()}resume(){if(!O(A)&&"onLine"in A.navigator){if(this.ml=A.navigator.onLine,this.yl)return;this.yl=()=>{this.ml=!0,this.bl()},this._l=()=>{this.ml=!1},Ie(A,"online",this.yl),Ie(A,"offline",this._l)}}get length(){return this.al.length}retriableRequest(e,t){let{retriesPerformedSoFar:r}=e,n=rm(e,_P);tr(r)&&(n.url=ds(n.url,{retry_count:r})),g_(this._instance,t?b(b({},n),{},{transport:t}):n,(i,s)=>{var o;if(i.statusCode!==200&&(400>i.statusCode||i.statusCode>=500)){if((i.statusCode===0?3:10)>(r??0))return void this.Ls(b({retriesPerformedSoFar:r},n),s);i.statusCode===0&&j.warn(`Request failed before receiving an HTTP response; this can happen due to network issues, CORS, browser blocking, or ad blockers. Stopped retrying after ${r??0} retries.`)}(o=n.callback)===null||o===void 0||o.call(n,i)})}Ls(e,t){const r=e.retriesPerformedSoFar||0;e.retriesPerformedSoFar=r+1;const n=Math.max((function(o){const a=3e3*Math.pow(2,o),c=a/2,l=Math.min(18e5,a),u=(Math.random()-.5)*(l-c);return Math.ceil(l+u)})(r),t??0),i=Date.now()+n;this.al.push({retryAt:i,requestOptions:e});let s=`Enqueued failed request for retry in ${n}`;navigator.onLine||(s+=" (Browser is offline)"),j.warn(s),this.pl||(this.pl=!0,this.wl())}wl(){if(this.kl&&clearTimeout(this.kl),this.al.length===0)return this.pl=!1,void(this.kl=void 0);this.kl=setTimeout(()=>{this.ml&&this.al.length>0&&this.bl(),this.wl()},this.gl)}bl(){const e=Date.now(),t=[],r=this.al.filter(n=>e>n.retryAt||(t.push(n),!1));if(this.al=t,r.length>0)for(const{requestOptions:n}of r)this.retriableRequest(n)}unload(){this.kl&&(clearTimeout(this.kl),this.kl=void 0),this.pl=!1,O(A)||(this.yl&&(A.removeEventListener("online",this.yl),this.yl=void 0),this._l&&(A.removeEventListener("offline",this._l),this._l=void 0));for(const{requestOptions:e}of this.al)try{this._instance._send_request(b(b({},e),{},{transport:"sendBeacon"}))}catch(t){j.error(t)}this.al=[]}},bP=class{constructor(e){this._instance=e,this.Sl=()=>{var t,r,n,i;this.xl||(this.xl={});const s=this.scrollElement(),o=this.scrollY(),a=s?Math.max(0,s.scrollHeight-s.clientHeight):0,c=o+(s?.clientHeight||0),l=s?.scrollHeight||0;this.xl.lastScrollY=Math.ceil(o),this.xl.maxScrollY=Math.max(o,(t=this.xl.maxScrollY)!==null&&t!==void 0?t:0),this.xl.maxScrollHeight=Math.max(a,(r=this.xl.maxScrollHeight)!==null&&r!==void 0?r:0),this.xl.lastContentY=c,this.xl.maxContentY=Math.max(c,(n=this.xl.maxContentY)!==null&&n!==void 0?n:0),this.xl.maxContentHeight=Math.max(l,(i=this.xl.maxContentHeight)!==null&&i!==void 0?i:0)}}get Cl(){return this._instance.config.scroll_root_selector}getContext(){return this.xl}resetContext(){const e=this.xl;return this.xl=void 0,setTimeout(this.Sl,0),e}startMeasuringScrollPosition(){Ie(A,"scroll",this.Sl,{capture:!0}),Ie(A,"scrollend",this.Sl,{capture:!0}),Ie(A,"resize",this.Sl)}scrollElement(){if(this.Cl){const r=ce(this.Cl)?this.Cl:[this.Cl];for(const n of r){var e;const i=A==null||(e=A.document)===null||e===void 0?void 0:e.querySelector(n);if(i)return i}return}var t;return A==null||(t=A.document)===null||t===void 0?void 0:t.documentElement}$l(e){var t,r;const n=e==="y"?"scrollTop":"scrollLeft";if(this.Cl){const i=this.scrollElement();return i&&i[n]||0}return A?e==="y"?A.scrollY||A.pageYOffset||((t=A.document)===null||t===void 0||(t=t.documentElement)===null||t===void 0?void 0:t.scrollTop)||0:A.scrollX||A.pageXOffset||((r=A.document)===null||r===void 0||(r=r.documentElement)===null||r===void 0?void 0:r.scrollLeft)||0:0}scrollY(){return this.$l("y")}scrollX(){return this.$l("x")}},wP=e=>Ym(e?.config.mask_personal_data_properties,e?.config.custom_personal_data_properties,e?.config.disable_capture_url_hashes),ep=class{constructor(e,t,r,n){this.Be=i=>{const s=this.Tl();if(s&&s.sessionId===i)return;const o={sessionId:i,props:this.Il(this._instance)};this.Ml.register({[dl]:o})},this._instance=e,this.El=t,this.Ml=r,this.Il=n||wP,this.El.onSessionId(this.Be)}Tl(){return this.Ml.props[dl]}getSetOnceProps(){var e;const t=(e=this.Tl())===null||e===void 0?void 0:e.props;return t?"r"in t?Xm(t,this._instance.config.disable_capture_url_hashes):{$referring_domain:t.referringDomain,$pathname:t.initialPathName,utm_source:t.utm_source,utm_campaign:t.utm_campaign,utm_medium:t.utm_medium,utm_content:t.utm_content,utm_term:t.utm_term}:{}}getSessionProps(){const e={};return Ce($u(this.getSetOnceProps()),(t,r)=>{r==="$current_url"&&(r="url"),e[`$session_entry_${Jc(r)}`]=t}),e}},Co=class{on(e,t){return this.Pl[e]||(this.Pl[e]=[]),this.Pl[e].push(t),()=>{this.Pl[e]=this.Pl[e].filter(r=>r!==t)}}emit(e,t){for(const r of this.Pl[e]||[])r(t);for(const r of this.Pl["*"]||[])r(e,t)}constructor(){this.Pl={}}},En=Be("[SessionId]"),tp=864e5,rp=class{on(e,t){return this.Rl.on(e,t)}constructor(e,t,r){var n;if(this.Al=null,this.Fl=null,this.Ol=[],this.Dl=void 0,this.Ll=!1,this.Rl=new Co,this.Nl=(s,o)=>!(!tr(s)||!tr(o))&&Math.abs(s-o)>this.sessionTimeoutMs,!e.persistence)throw new Error("SessionIdManager requires a PostHogPersistence instance");if(e.config.cookieless_mode==="always")throw new Error('SessionIdManager cannot be used with cookieless_mode="always"');this.Rr=e.config,this.Ml=e.persistence,this.He=void 0,this.Xt=void 0,this._sessionStartTimestamp=null,this.ql=void 0,this._sessionActivityTimestamp=null,this.jl=t||Lt,this.Bl=r||Lt;const i=this.Rr.persistence_name||this.Rr.token;if(this._sessionTimeoutMs=1e3*Bt(this.Rr.session_idle_timeout_seconds||1800,60,36e3,En.createLogger("session_idle_timeout_seconds"),1800),e.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this.Hl(),this.zl="ph_"+i+"_window_id",this.Ul="ph_"+i+"_primary_window_exists",this.Wl()){const s=xe.Dt(this.zl),o=xe.Dt(this.Ul);s&&!o?this.He=s:xe.Lt(this.zl),xe.At(this.Ul,!0)}(n=this.Rr.bootstrap)!==null&&n!==void 0&&n.sessionID&&this.setBootstrapSessionId(this.Rr.bootstrap.sessionID),this.Vl()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(e){return O(this.Ol)&&(this.Ol=[]),this.Ol.push(e),this.Xt&&e(this.Xt,this.He),()=>{this.Ol=this.Ol.filter(t=>t!==e)}}Wl(){return this.Rr.persistence!=="memory"&&!this.Ml.mi&&xe.Et()}Gl(e){e!==this.He&&(this.He=e,this.Wl()&&xe.At(this.zl,e))}Zl(){return this.He?this.He:this.Wl()?xe.Dt(this.zl):null}Ql(e){const t=this.Al;return!He(t)&&!He(e)&&5e3>Math.abs(e-t)}Jl(e,t,r){const n=t!==this._sessionActivityTimestamp,i=!(e!==this.Xt||r!==this._sessionStartTimestamp);this._sessionStartTimestamp=r,this._sessionActivityTimestamp=t,this.Xt=e,i&&!n||i&&this.Ql(t)||(this.Al=t,this.Ml.register({[Mn]:[t,e,r]}))}Kl(){var e;const t=(e=this.Rr)===null||e===void 0?void 0:e.persistence_save_debounce_ms;return tr(t)&&t>0}Xl(){this.Kl()?this.Ml.refreshKey(Mn):(this.Ml.flush(),this.Ml.load())}Yl(){var e;if(He(this._sessionActivityTimestamp)||this._sessionActivityTimestamp===this.Al)return;this.Xl();const[,t,r]=this.tu();t===this.Xt&&r===this._sessionStartTimestamp&&(this.Al=this._sessionActivityTimestamp,this.Ml.register({[Mn]:[this._sessionActivityTimestamp,(e=this.Xt)!==null&&e!==void 0?e:null,this._sessionStartTimestamp]}),this.Ml.flush())}eu(){const[e]=this.tu(),t=tr(e)?e:0,r=tr(this._sessionActivityTimestamp)?this._sessionActivityTimestamp:0;return Math.max(t,r)}iu(e){return this.Xl(),this.Nl(e,this.eu())}tu(){const e=this.Ml.props[Mn];return ce(e)&&e.length===2&&e.push(e[0]),e||[0,null,0]}resetSessionId(){this.Al=null,this.ql=void 0,clearTimeout(this.nu),this.nu=void 0,this.Jl(null,null,null)}setBootstrapSessionId(e,t=!1){const r=((n,i=new Date().getTime())=>{try{const s=(o=>{const a=o.replace(/-/g,"");if(a.length!==32)throw new Error("Not a valid UUID");if(a[12]!=="7")throw new Error("Not a UUIDv7");return parseInt(a.substring(0,12),16)})(n);return s>i+6e4?void En.error("Bootstrap sessionID cannot be in the future"):s}catch(s){En.error("Invalid sessionID in bootstrap",s);return}})(e);return!O(r)&&(t?this.ql={sessionId:e,sessionStartTimestamp:r}:this.Jl(e,new Date().getTime(),r),!0)}destroy(){this.Ll=!0,this.Yl(),clearTimeout(this.nu),this.nu=void 0,this.Dl&&A&&(A.removeEventListener(ko,this.Dl,{capture:!1}),this.Dl=void 0),this.Ol=[]}Vl(){this.Dl=()=>{this.Yl(),this.Wl()&&xe.Lt(this.Ul)},Ie(A,ko,this.Dl,{capture:!1})}checkAndGetSessionAndWindowId(e=!1,t=null,r=!1){if(this.Rr.cookieless_mode==="always")throw new Error('checkAndGetSessionAndWindowId should not be called with cookieless_mode="always"');const n=t||new Date().getTime(),i=this.Xt;if(r)this.Fl=n;else if(He(this.Fl)||this.Fl>n||n-this.Fl>=1e3){var s,o;(s=(o=this.Ml).syncCookieProperties)===null||s===void 0||s.call(o),this.Fl=n}let[,a,c]=this.tu();const l=!O(i)&&a!==i,u=this.eu();let h=this.Zl();const d=this.ql,p=!!d&&(d.sessionStartTimestamp>n+6e4||n-d.sessionStartTimestamp>tp),f=d?p:tr(c)&&Math.abs(n-c)>tp;let v=!1,m=l,_=!a||!!d;const w=a;let S=!_&&!e&&this.Nl(n,u);if(S&&(S=this.iu(n),S||En.info("cross-tab refresh kept the session alive",{sessionId:a}),[,a,c]=this.tu(),S||(_=!a||!!d)),_||S||f){m=!1;const M=d&&!p;a=M?d.sessionId:this.jl(),h=this.Bl(),En.info("new session ID assigned",{sessionId:a,windowId:h,bootstrapped:!!M,changeReason:{noSessionId:_,activityTimeout:S,sessionPastMaximumLength:f}}),c=M?d.sessionStartTimestamp:n,this.ql=void 0,v=!0}else h||(h=this.Bl(),v=!0),m=m||a!==w,m&&(En.info("adopted cross-tab session id",{sessionId:a,windowId:h}),v=!0);const T=tr(u)&&e&&!f?u:n,C=tr(c)?c:new Date().getTime();this.Gl(h),this.Jl(a,T,C),e||this.Hl();const $={noSessionId:_,activityTimeout:S,sessionPastMaximumLength:f,crossTabAdoption:m};return v&&this.Ol.forEach(M=>M(a,h,$)),{sessionId:a,windowId:h,sessionStartTimestamp:C,changeReason:v?$:void 0,lastActivityTimestamp:u}}Hl(){this.Ll||(clearTimeout(this.nu),this.nu=setTimeout(()=>{if(!this.Ll)if(this.iu(new Date().getTime())){const e=this.Xt;this.resetSessionId(),this.Rl.emit("forcedIdleReset",{idleSessionId:e})}else this.Hl()},1.1*this.sessionTimeoutMs))}},m_=function(e,t){if(!e)return!1;const r=e.userAgent;if(r&&sh(r,t))return!0;try{const n=e?.userAgentData;if(n?.brands&&n.brands.some(i=>sh(i?.brand,t)))return!0}catch{}return!!e.webdriver};function __(){return(__=Ue(function*(){const e=rt?.userAgentData;if(e?.getHighEntropyValues)try{const t=yield e.getHighEntropyValues(["model"]),r=t?.model;return ye(r)&&r.length>0?r:void 0}catch(t){j.info("Unable to resolve $device_model from userAgentData.getHighEntropyValues",t);return}})).apply(this,arguments)}function SP(e,t){let r=`$survey_${t}/${e.id}`;return e.current_iteration&&e.current_iteration>0&&(r=`$survey_${t}/${e.id}/${e.current_iteration}`),r}function y_(e){var t;return!!(!((t=e.conditions)===null||t===void 0||(t=t.events)===null||t===void 0||(t=t.values)===null||t===void 0)&&t.length)}var $o=(e,t)=>{if(!(r=>{try{new RegExp(r)}catch{return!1}return!0})(t))return!1;try{return new RegExp(t).test(e)}catch{return!1}},Os=e=>e.toLowerCase(),b_={exact:(e,t)=>t.some(r=>e.some(n=>r===n)),is_not:(e,t)=>t.every(r=>e.every(n=>r!==n)),regex:(e,t)=>t.some(r=>e.some(n=>$o(r,n))),not_regex:(e,t)=>t.every(r=>e.every(n=>!$o(r,n))),icontains:(e,t)=>t.map(Os).some(r=>e.map(Os).some(n=>r.includes(n))),not_icontains:(e,t)=>t.map(Os).every(r=>e.map(Os).every(n=>!r.includes(n))),gt:(e,t)=>t.some(r=>{const n=parseFloat(r);return!isNaN(n)&&e.some(i=>n>parseFloat(i))}),lt:(e,t)=>t.some(r=>{const n=parseFloat(r);return!isNaN(n)&&e.some(i=>n<parseFloat(i))})};function w_(e,t){return!e||Object.entries(e).every(([r,n])=>{const i=t?.[r];if(i==null)return!1;const s=b_[n.operator];return!!s&&s(n.values.map(String),[String(i)])})}function nc(e,t,r){return Nn({distinct_id:e,userPropertiesToSet:t,userPropertiesToSetOnce:r})}var Sl="custom",np="i.posthog.com",EP=/^\/static\//,kP=["/s/","/e/","/i/"],RP=class{constructor(e){this.su={},this.instance=e}get apiHost(){const e=this.instance.config.api_host.trim().replace(/\/$/,"");return e==="https://app.posthog.com"?"https://us.i.posthog.com":e}get flagsApiHost(){const e=this.instance.config.flags_api_host;return e?e.trim().replace(/\/$/,""):this.apiHost}get uiHost(){var e;let t=(e=this.instance.config.ui_host)===null||e===void 0?void 0:e.replace(/\/$/,"");return t||(t=this.apiHost.replace(`.${np}`,".posthog.com")),t==="https://app.posthog.com"?"https://us.posthog.com":t}get region(){return this.su[this.apiHost]||(this.su[this.apiHost]=/https:\/\/(app|us|us-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?"us":/https:\/\/(eu|eu-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?"eu":Sl),this.su[this.apiHost]}ru(e){if(!EP.test(e))return;const t=this.instance.config.asset_host;return typeof t=="string"&&t.trim().replace(/\/$/,"")||void 0}ou(e){const t=Fr(e);return t?t.protocol+"//"+t.host+t.pathname:void 0}au(e,t,r){if(e==="ui")return r;let n=r;const i=this.instance.config.rewriteRequestPath;if(i){var s;const o=((s=Fr(r))===null||s===void 0?void 0:s.href)||r;n=i(new URL(o)).toString()}if(i&&e==="api"&&kP.some(o=>t.indexOf(o)===0)){const o=this.ou(n);if(o){const a=this.apiHost;let c=this.lu;c?.apiHost===a&&c.rewriteRequestPath===i||(c={apiHost:a,rewriteRequestPath:i,urls:new Set},this.lu=c),c.urls.add(o)}}return n}isIngestionEndpoint(e){const t=this.lu,r=this.ou(e);return t?.apiHost===this.apiHost&&t.rewriteRequestPath===this.instance.config.rewriteRequestPath&&!!r&&t.urls.has(r)}endpointFor(e,t=""){if(t&&(t=t[0]==="/"?t:`/${t}`),e==="ui")return this.au(e,t,this.uiHost+t);if(e==="flags")return this.au(e,t,this.flagsApiHost+t);if(e==="assets"){const n=this.ru(t);if(n)return this.au(e,t,`${n}${t}`)}if(this.region===Sl)return this.au(e,t,this.apiHost+t);const r=np+t;switch(e){case"assets":return this.au(e,t,`https://${this.region}-assets.${r}`);case"api":return this.au(e,t,`https://${this.region}.${r}`)}}},Te=Be("[Surveys]"),S_=e=>{try{const t=(r=>((n,i)=>`seenSurvey_${(function(s){return s.current_iteration&&s.current_iteration>0?`${s.id}_${s.current_iteration}`:s.id})(i)}`)(0,r))(e);if(localStorage.getItem(t))return;localStorage.setItem(t,"true")}catch(t){Te.error("Failed to persist survey seen state",t)}},AP=[Ya.Popover,Ya.Widget,Ya.API],IP={ignoreConditions:!1,ignoreDelay:!1,displayType:ml.Popover},TP=Be("[PostHog ExternalIntegrations]"),CP={intercom:"intercom-integration",crispChat:"crisp-chat-integration"},$P=class{constructor(e){this._instance=e}zo(e,t){var r,n;(r=te.__PosthogExtensions__)===null||r===void 0||(n=r.loadExternalDependency)===null||n===void 0||n.call(r,this._instance,e,i=>{if(i)return TP.error("failed to load script",i);t()})}startIfEnabledOrStop(){var e;for(const[i,s]of Object.entries((e=this._instance.config.integrations)!==null&&e!==void 0?e:{})){var t,r,n;s&&!((t=te.__PosthogExtensions__)!==null&&t!==void 0&&(t=t.integrations)!==null&&t!==void 0&&t[i])&&this.zo(CP[i],()=>{var o;(o=te.__PosthogExtensions__)===null||o===void 0||(o=o.integrations)===null||o===void 0||(o=o[i])===null||o===void 0||o.start(this._instance)}),!s&&(r=te.__PosthogExtensions__)!==null&&r!==void 0&&(r=r.integrations)!==null&&r!==void 0&&r[i]&&((n=te.__PosthogExtensions__)===null||n===void 0||(n=n.integrations)===null||n===void 0||(n=n[i])===null||n===void 0||n.stop())}}},PP=class{constructor(e,t){this.$=e,this.wo=t,this.uu=new Map,this.Io=!1}add(e){var t=this;return Ue(function*(){if(t.Io)throw new Error("Cannot add an extension to a disposed ExtensionRuntime");if(t.uu.has(e.name))throw new Error(`Browser extension "${e.name}" is already registered`);t.uu.set(e.name,e);try{const r=e.setup(t.wo);r&&(yield r)}catch(r){const n=t.uu.get(e.name)===e;n&&t.uu.delete(e.name),t.$.error(`Failed to set up browser extension "${e.name}"`,r),n&&t.hu(e)}})()}getExtension(e){return this.uu.get(e)}dispose(){if(this.Io)return;this.Io=!0;const e=Array.from(this.uu.values()).reverse();this.uu.clear();for(const t of e)this.hu(t)}hu(e){try{var t;const r=(t=e.dispose)===null||t===void 0?void 0:t.call(e);r&&tt(r.then)&&r.then(void 0,n=>{this.$.error(`Failed to dispose browser extension "${e.name}"`,n)})}catch(r){this.$.error(`Failed to dispose browser extension "${e.name}"`,r)}}},OP=class{constructor(e){this._instance=e}initialize(){}get(e){const t=this._instance.persistence;if(typeof e=="string")return t?.get_property(e);const r={};for(const n of e){const i=t?.get_property(n);O(i)||(r[n]=i)}return r}set(e,t){var r;(r=this._instance.persistence)===null||r===void 0||r.register(typeof e=="string"?{[e]:t}:e)}remove(e){var t;(t=this._instance.persistence)===null||t===void 0||t.unregister(e)}},ip="extensionsRemoteConfig",xP=class{constructor(e){this.instance=e,this.Io=!1,this.$=j,this.cu=e.du,this.kv=new OP(e),this.onEvent=t=>Ps(this.instance.on("eventCaptured",r=>{try{t({event:r.event,properties:r.properties})}catch(n){this.$.error("Browser extension event listener failed",n)}})),this.onRemoteConfig=t=>{if(this.Io)return Ps(()=>{});const r=i=>{try{t(i)}catch(s){this.$.error("Browser extension remote config listener failed",s)}},n=this.instance.vu.on(ip,r);return this.cu&&r(this.cu),Ps(n)},this.fu=new PP(j.createLogger("[BrowserExtensions]"),this)}get logger(){return this.$}get distinctId(){return this.instance.get_distinct_id()}get anonymousId(){var e;return(e=this.instance.get_property("$device_id"))!==null&&e!==void 0?e:this.distinctId}get deviceId(){const e=this.instance.get_property(ku);return typeof e=="string"?e:void 0}get library(){return{name:et.LIB_NAME,version:et.LIB_VERSION}}get initialPersonProperties(){var e,t;return(e=(t=this.instance.persistence)===null||t===void 0?void 0:t.get_initial_props())!==null&&e!==void 0?e:{}}get groups(){return this.instance.getGroups()}get session(){try{var e,t,r,n;const i=(e=this.instance.sessionManager)===null||e===void 0?void 0:e.checkAndGetSessionAndWindowId(!0);return{sessionId:(t=i?.sessionId)!==null&&t!==void 0?t:"",windowId:(r=i?.windowId)!==null&&r!==void 0?r:"",sessionStartTimestamp:(n=i?.sessionStartTimestamp)!==null&&n!==void 0?n:0}}catch{return{sessionId:"",windowId:"",sessionStartTimestamp:0}}}get canCapture(){return this.instance.is_capturing()}get projectToken(){return this.instance.config.token}add(e){return this.fu.add(e)}getExtension(e){return this.fu.getExtension(e)}capture(e,t,r){r?this.instance.capture(e,t,{timestamp:r.timestamp,uuid:r.uuid,$set:r.set,$set_once:r.setOnce}):this.instance.capture(e,t)}registerDynamicEventProperties(e){return Ps(this.instance.pu(e))}handleRemoteConfig(e){this.Io||(this.cu=e,this.instance.vu.emit(ip,e))}sendRequest(e){var t=this;return Ue(function*(r,n={}){var i;const s=t.instance.requestRouter.endpointFor((i=n.target)!==null&&i!==void 0?i:"api",r),o={method:n.method,url:n.query?ds(s,n.query):s,data:n.body,headers:n.headers,timeout:n.timeoutMs,fireCallbackOnDrop:!0,transport:n.transport,compression:n.compression,compressionFallback:n.target==="flags"&&n.compression==="best-available"?Zc.Base64:void 0,timestampMode:n.sentAt};return n.transport==="sendBeacon"?(t.instance._send_request(o),{statusCode:202}):new Promise(a=>{o.callback=a,t.instance._send_request(o)})}).apply(this,arguments)}dispose(){this.Io||(this.Io=!0,this.fu.dispose())}},qi={},ic=0,ji=()=>{},sp='Consent opt in/out is not valid with cookieless_mode="always" and will be ignored',Ei="Surveys module not available",op="sanitize_properties is deprecated. Use before_send instead",E_="Invalid value for property_denylist config: ",MP=/^[A-Za-z0-9_-]{1,400}$/,ap=/^fb\.[0-9]+\.[0-9]+\.[A-Za-z0-9_-]+(?:\.[A-Za-z0-9_-]+)?$/,cp=/^fb\.[0-9]+\.[0-9]+\.[0-9]+$/,LP=["token","distinct_id",km],Ci="posthog",DP=e=>{const t={};return e&&e!=="unset"&&("2025-11-30">e||(t.strictMinimumDuration=!0),"2026-05-30">e||(t.canvasCapture={resolutionScale:.6}),"2026-06-25">e||(t.streamNetworkBody=!0),"2026-08-30">e||(t.captureJsonLd=!0)),t},sc=e=>{var t;return b({api_host:"https://us.i.posthog.com",flags_api_host:null,ui_host:null,asset_host:null,token:"",autocapture:!0,cross_subdomain_cookie:M$(N?.location),persistence:"localStorage+cookie",persistence_name:"",cookie_persisted_properties:[],loaded:ji,save_campaign_params:!0,custom_campaign_params:[],custom_blocked_useragents:[],save_referrer:!0,capture_pageleave:"if_capture_pageview",defaults:e??"unset",__preview_deferred_init_extensions:!1,__preview_external_dependency_versioned_paths:!1,__preview_cookie_wins_on_conflict:!1,debug:je&&ye(je?.search)&&je.search.indexOf("__posthog_debug=true")!==-1||!1,cookie_expiration:365,upgrade:!1,disable_session_recording:!1,disable_persistence:!1,disable_web_experiments:!0,disable_surveys:!1,disable_surveys_automatic_display:!1,disable_conversations:!1,disable_product_tours:!1,disableDeviceModel:!1,reuseAnonymousId:!1,disable_external_dependency_loading:!1,strict_script_versioning:"fallback",enable_recording_console_log:void 0,secure_cookie:(A==null||(t=A.location)===null||t===void 0?void 0:t.protocol)==="https:",ip:!1,opt_out_capturing_by_default:!1,opt_out_persistence_by_default:!1,opt_out_useragent_filter:!1,opt_out_capturing_persistence_type:"localStorage",consent_persistence_name:null,opt_out_capturing_cookie_prefix:null,opt_in_site_apps:!1,property_denylist:[],respect_dnt:!1,sanitize_properties:null,request_headers:{},request_batching:!0,properties_string_max_length:65535,mask_all_element_attributes:!1,mask_all_text:!1,mask_personal_data_properties:!1,custom_personal_data_properties:[],advanced_disable_flags:!1,advanced_disable_decide:!1,advanced_disable_feature_flags:!1,advanced_disable_feature_flags_on_first_load:!1,advanced_only_evaluate_survey_feature_flags:!1,advanced_feature_flags_dedup_per_session:!1,advanced_enable_surveys:!1,advanced_disable_toolbar_metrics:!1,feature_flag_request_timeout_ms:3e3,feature_flag_request_max_retries:1,surveys_request_timeout_ms:1e4,on_request_error(r){j.error("Bad HTTP status: "+r.statusCode+" "+r.text)},get_device_id:r=>r,capture_performance:void 0,name:"posthog",bootstrap:{},disable_compression:!1,session_idle_timeout_seconds:1800,person_profiles:Cm,before_send:void 0,get_current_url:void 0,request_queue_config:{flush_interval_ms:3e3},error_tracking:{},_onCapture:ji},(r=>({rageclick:r&&r>="2026-05-30"?{content_ignorelist:j$,ignore_text_selection:!0}:!r||"2025-11-30">r||{content_ignorelist:!0},capture_pageview:!r||"2025-05-24">r||"history_change",session_recording:DP(r),external_scripts_inject_target:r&&r>="2026-01-30"?"head":"body",internal_or_test_user_hostname:r&&r>="2026-01-30"?/^(localhost|127\.0\.0\.1)$/:void 0,persistence_save_debounce_ms:r&&r>="2026-05-30"?250:0,split_storage:!(!r||"2026-05-30">r),detect_google_search_app:!(!r||"2026-05-30">r),disable_capture_url_hashes:!(!r||"2026-06-25">r),cookieWinsOnConflict:!(!r||r==="unset"||"2026-08-29">r)}))(e))},NP=[["process_person","person_profiles"],["xhr_headers","request_headers"],["cookie_name","persistence_name"],["disable_cookie","disable_persistence"],["__preview_disable_beacon","disable_beacon"],["store_google","save_campaign_params"],["verbose","debug"],["__preview_cookie_wins_on_conflict","cookieWinsOnConflict"]],lp=e=>{const t={};for(const[i,s]of NP)O(e[i])||(t[s]=e[i]);const r=Le({},t,e),n=e.__preview_external_dependency_versioned_paths;return O(n)||(O(e.strict_script_versioning)&&(r.strict_script_versioning=!!n),ye(n)&&O(e.asset_host)&&(r.asset_host=n)),ce(e.property_blacklist)&&(O(e.property_denylist)?r.property_denylist=e.property_blacklist:ce(e.property_denylist)?r.property_denylist=[...e.property_blacklist,...e.property_denylist]:j.error(E_+e.property_denylist)),r},zP=class{constructor(){this.__forceAllowLocalhost=!1}get gu(){return this.__forceAllowLocalhost}set gu(e){j.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=e}},Hi=class fr{mu(t){if(!t)return;const r=this.uu.indexOf(t);r!==-1&&this.uu.splice(r,1)}yu(t,r){var n;return this.mu(t),this.uu.push(r),(n=r.initialize)===null||n===void 0||n.call(r),r}bu(){return this.config.cookieless_mode==="always"||this.config.cookieless_mode==="on_reject"&&this.consent.isRejected()}_u(){if(this.wu||this.config.reuseAnonymousId||this.config.segment||this.bu())return;const t=this.config.persistence==="memory"||this.config.persistence==="sessionStorage";if(!t&&!this.config.disable_persistence||this.ku)return;let r,n,i;t?(r=`persistence is set to '${this.config.persistence}'`,n=this.config.persistence==="memory"?"on every page load":"for every new browser tab or window",i="Either set persistence to 'localStorage+cookie', keep this persistence and pass a stable ID through bootstrap.distinctID, or enable reuseAnonymousId."):(r="persistence is disabled (disable_persistence is true)",n="on every page load",i="Either set disable_persistence to false, keep persistence disabled and pass a stable ID through bootstrap.distinctID, or enable reuseAnonymousId."),this.wu=!0,console.warn("[PostHog.js]",`${r} but no bootstrap.distinctID was provided. PostHog will mint a new distinct ID ${n}, so calling identify() merges a new ID onto the person each time. A person can then pass the distinct-ID limit and its events stop appearing on person pages and the session tab. ${i}`)}Su(){if(this.bu()||this.get_distinct_id()!=="$posthog_cookieless")return;const t=this.persistence;if(!t)return;this.xu()||t.load(!0);const r=this.get_distinct_id();if(!r||r==="$posthog_cookieless"){const n=this.config.get_device_id(Lt());this.register({distinct_id:n,$device_id:n}),t.set_property(ft,sr)}this.Cu()}get decideEndpointWasHit(){var t,r;return(t=(r=this.featureFlags)===null||r===void 0?void 0:r.hasLoadedFlags)!==null&&t!==void 0&&t}get flagsEndpointWasHit(){var t,r;return(t=(r=this.featureFlags)===null||r===void 0?void 0:r.hasLoadedFlags)!==null&&t!==void 0&&t}constructor(){var t;this.$u=!1,this.Tu=!1,this.webPerformance=new zP,this.Iu=!1,this.version=et.LIB_VERSION,this.Mu=new Set,this.Eu="",this.vu=new Co,this.uu=[],this.Pu=[],this.ku=!1,this.wu=!1,this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=sc(),this.SentryIntegration=K$,this.sentryIntegration=n=>(function(i,s){const o=Hm(i,s);return{name:jm,processEvent:a=>o(a)}})(this,n),this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this.Ru=!1,this.Au=null,this.Fu=null,this.Ou=null,this.scrollManager=new bP(this),this.pageViewManager=new Vh(this),this.rateLimiter=new oP(this),this.requestRouter=new RP(this),this.consent=new q$(this),this.externalIntegrations=new $P(this);const r=(t=fr.__defaultExtensionClasses)!==null&&t!==void 0?t:{};this.featureFlags=r.featureFlags&&new r.featureFlags(this),this.toolbar=r.toolbar&&new r.toolbar(this),this.surveys=r.surveys&&new r.surveys(this),this.conversations=r.conversations&&new r.conversations(this),this.logs=r.logs&&new r.logs(this),this.metrics=r.metrics&&new r.metrics(this),this.experiments=r.experiments&&new r.experiments(this),this.exceptions=r.exceptions&&new r.exceptions(this),this.people={set:(n,i,s)=>{const o=ye(n)?{[n]:i}:n;this.setPersonProperties(o),s?.({})},set_once:(n,i,s)=>{const o=ye(n)?{[n]:i}:n;this.setPersonProperties(void 0,o),s?.({})}},this.on("eventCaptured",n=>j.info(`send "${n?.event}"`,n))}init(t,r,n){if(n&&n!==Ci){var i;const s=(i=qi[n])!==null&&i!==void 0?i:new fr;return s._init(t,r,n),qi[n]=s,qi[Ci][n]=s,s}return this._init(t,r,n)}_init(t,r={},n){var i,s,o;const a=ye(t)?t.trim():"";if(!a)return j.critical("PostHog was initialized without a token. This likely indicates a misconfiguration. Please check the first argument passed to posthog.init()"),this;var c;if(this.__loaded)return a!==((c=this.config)===null||c===void 0?void 0:c.token)?console.warn("[PostHog.js]",`You have already initialized PostHog with a different project token! Re-initializing is a no-op, so events will keep going to the project this instance was initialized with. To capture into a second project, load PostHog once, then initialize a named instance after the SDK has loaded, e.g. posthog.init('${a}', { ... }, 'project2')`):console.warn("[PostHog.js]","You have already initialized PostHog! Re-initializing is a no-op"),this;this.__loaded=!0,this.config=sc(r.defaults),r.debug=this.Du(r.debug),this.Lu=r,this.Nu=[],r.person_profiles?this.Fu=r.person_profiles:r.process_person&&(this.Fu=r.process_person);const l=sc(r.defaults),u=lp(r),h=Le({},l,u,{name:n,token:a});be(l.rageclick)&&be(u.rageclick)&&(h.rageclick=Le({},l.rageclick,u.rageclick)),be(l.session_recording)&&be(u.session_recording)&&(h.session_recording=Le({},l.session_recording,u.session_recording)),this.set_config(h),this.config.on_xhr_error&&j.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=r.disable_compression?void 0:St.GZipJS;const d=this.xu();if(this.persistence=new Ka(this.config,d),this.sessionPersistence=this.config.persistence==="sessionStorage"||this.config.persistence==="memory"?this.persistence:new Ka(b(b({},this.config),{},{persistence:"sessionStorage"}),d,!1),this.Eu="ph_"+(this.config.persistence_name||this.config.token)+"_session_registered_properties",this.config.persistence!=="memory"&&!d&&xe.Et()){const _=xe.Dt(this.Eu);ce(_)&&_.forEach(w=>{ye(w)&&this.Mu.add(w)})}else xe.Lt(this.Eu);const p=b({},this.persistence.props),f=b({},this.sessionPersistence.props);this.register({$initialization_time:new Date().toISOString()}),this.qu=new mP((_,w)=>this.ju(_,w),this.config.request_queue_config),this.Bu=new yP(this),this.__request_queue=[];const v=this.bu();v||(this.sessionManager=new rp(this),this.sessionPropsManager=new ep(this,this.sessionManager,this.persistence),this.sessionManager.onSessionId((_,w,S)=>{(S!=null&&S.activityTimeout||S!=null&&S.sessionPastMaximumLength||S!=null&&S.crossTabAdoption)&&this.Hu()})),this.zu(),this.config.__preview_deferred_init_extensions?(j.info("Deferring extension initialization to improve startup performance"),setTimeout(()=>{this.Uu(v)},0)):(j.info("Initializing extensions synchronously"),this.Uu(v)),et.DEBUG=et.DEBUG||this.config.debug,et.DEBUG&&j.info("Starting in debug mode",{this:this,config:r,thisC:b({},this.config),p,s:f}),this.config.identity_distinct_id&&!((i=r.bootstrap)!==null&&i!==void 0&&i.distinctID)&&(r.bootstrap=b(b({},r.bootstrap),{},{distinctID:this.config.identity_distinct_id,isIdentifiedID:!0}));const m=(s=r.bootstrap)===null||s===void 0?void 0:s.distinctID;if(this.ku=!!m&&!Oi(m),(o=r.bootstrap)===null||o===void 0?void 0:o.distinctID){const _=r.bootstrap.distinctID,w=this.get_distinct_id(),S=this.persistence.get_property(ft);if(r.bootstrap.isIdentifiedID&&w!=null&&w!==_&&S==="anonymous")this.identify(_);else if(r.bootstrap.isIdentifiedID&&w!=null&&w!==_&&S==="identified")j.warn("Bootstrap distinctID differs from an already-identified user. The existing identity is preserved. Call reset() before reinitializing if you intend to switch users.");else{const T=this.config.get_device_id(Lt()),C=r.bootstrap.isIdentifiedID?T:_;this.persistence.set_property(ft,r.bootstrap.isIdentifiedID?Ks:sr),this.register({distinct_id:_,$device_id:C})}}if(v)this.register_once({distinct_id:ja,$device_id:null},"");else if(!this.get_distinct_id()){const _=this.config.get_device_id(Lt());this.register_once({distinct_id:_,$device_id:_},""),this.persistence.set_property(ft,sr)}return Ie(A,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),Ie(A,"pageshow",()=>{var _;this.$u=!1,this.Tu||(_=this.Bu)===null||_===void 0||_.resume()}),r.segment?Hh(this,()=>this.Wu()):this.Wu(),tt(this.config._onCapture)&&this.config._onCapture!==ji&&(j.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",_=>this.config._onCapture(_.event,_))),this.config.ip&&j.warn('The `ip` config option has NO EFFECT AT ALL and has been deprecated. Use a custom transformation or "Discard IP data" project setting instead. See https://posthog.com/tutorials/web-redact-properties#hiding-customer-ip-address for more information.'),this.config.disableDeviceModel||(function(){return __.apply(this,arguments)})().then(_=>{_&&this.register({[qa]:_})}).catch(ji),this}Vu(t){const r=t;return ye(r.name)&&tt(r.setup)}Gu(t,r){this.Vu(t)?r.push(()=>{this.Zu().add(t).catch(()=>{var n;return(n=t.dispose)===null||n===void 0?void 0:n.call(t)}).catch(n=>{j.error(`Failed to dispose browser extension "${t.name}"`,n)})}):this.uu.push(t)}zu(){var t,r,n;const i=(t=(r=this.config.__extensionClasses)===null||r===void 0?void 0:r.featureFlags)!==null&&t!==void 0?t:(n=fr.__defaultExtensionClasses)===null||n===void 0?void 0:n.featureFlags;var s,o,a;i&&(this.featureFlags&&this.featureFlags instanceof i||((s=this.Qu)===null||s===void 0||s.call(this),this.Qu=void 0,this.featureFlags=new i(this)),tt(this.featureFlags.onReloading)&&tt(this.featureFlags.setup)?this.Qu||(this.Qu=this.featureFlags.onReloading(()=>{this.vu.emit("featureFlagsReloading",!0)}),this.Zu().add(this.featureFlags)):(o=(a=this.featureFlags).initialize)===null||o===void 0||o.call(a))}Uu(t){const r=performance.now(),n=b(b({},fr.__defaultExtensionClasses),this.config.__extensionClasses),i=[];var s,o,a,c,l,u,h;n.exceptions&&this.uu.push(this.exceptions=(s=this.exceptions)!==null&&s!==void 0?s:new n.exceptions(this)),n.historyAutocapture&&this.uu.push(this.historyAutocapture=new n.historyAutocapture(this)),n.tracingHeaders&&this.uu.push(this.tracingHeaders=new n.tracingHeaders(this)),n.siteApps&&this.uu.push(this.siteApps=new n.siteApps(this)),n.sessionRecording&&!t&&this.uu.push(this.sessionRecording=new n.sessionRecording(this)),this.config.disable_scroll_properties||i.push(()=>{this.scrollManager.startMeasuringScrollPosition()}),n.autocapture&&this.Gu(this.autocapture=new n.autocapture(this),i),n.surveys&&this.Gu(this.surveys=(o=this.surveys)!==null&&o!==void 0?o:new n.surveys(this),i),n.logs&&this.Gu(this.logs=(a=this.logs)!==null&&a!==void 0?a:new n.logs(this),i),n.metrics&&this.uu.push(this.metrics=(c=this.metrics)!==null&&c!==void 0?c:new n.metrics(this)),n.conversations&&this.uu.push(this.conversations=(l=this.conversations)!==null&&l!==void 0?l:new n.conversations(this)),n.productTours&&this.uu.push(this.productTours=new n.productTours(this)),n.heatmaps&&this.uu.push(this.heatmaps=new n.heatmaps(this)),n.webVitalsAutocapture&&this.uu.push(this.webVitalsAutocapture=new n.webVitalsAutocapture(this)),n.exceptionObserver&&this.uu.push(this.exceptionObserver=new n.exceptionObserver(this)),n.deadClicksAutocapture&&this.uu.push(this.deadClicksAutocapture=new n.deadClicksAutocapture(this,J$)),n.toolbar&&this.uu.push(this.toolbar=(u=this.toolbar)!==null&&u!==void 0?u:new n.toolbar(this)),n.experiments&&this.uu.push(this.experiments=(h=this.experiments)!==null&&h!==void 0?h:new n.experiments(this)),this.uu.forEach(d=>{d.initialize&&i.push(()=>{var p;(p=d.initialize)===null||p===void 0||p.call(d)})}),i.push(()=>{if(this.Ju){const d=this.Ju;this.Ju=void 0,this.uu.forEach(p=>{var f;return(f=p.onRemoteConfig)===null||f===void 0?void 0:f.call(p,d)})}}),this.Ku(i,r)}Ku(t,r){for(;t.length>0;){if(this.config.__preview_deferred_init_extensions&&performance.now()-r>=30&&t.length>0)return void setTimeout(()=>{this.Ku(t,r)},0);const i=t.shift();if(i)try{i()}catch(s){j.error("Error initializing extension:",s)}}const n=Math.round(performance.now()-r);this.register_for_session({[Rm]:this.config.__preview_deferred_init_extensions?"deferred":"synchronous",[Am]:n}),this.config.__preview_deferred_init_extensions&&j.info(`PostHog extensions initialized (${n}ms)`)}il(t){var r;if(!N||!N.body)return j.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout(()=>{this.il(t)},500);if(this.config.__preview_deferred_init_extensions&&(this.Ju=t),this.du=t,this.compression=void 0,t.ok){var n;const i=t.config;i.supportedCompression&&!this.config.disable_compression&&(this.compression=ue(i.supportedCompression,St.GZipJS)?St.GZipJS:ue(i.supportedCompression,St.Base64)?St.Base64:void 0),(n=i.analytics)!==null&&n!==void 0&&n.endpoint&&(this.analyticsDefaultEndpoint=i.analytics.endpoint)}this.set_config({person_profiles:this.Fu?this.Fu:Cm}),(r=this.Xu)===null||r===void 0||r.handleRemoteConfig(t),this.uu.forEach(i=>{var s;return(s=i.onRemoteConfig)===null||s===void 0?void 0:s.call(i,t)})}Wu(){try{this.config.loaded(this)}catch(t){j.critical("`loaded` function failed",t)}if(this.Yu(),this.config.internal_or_test_user_hostname&&je?.hostname){const t=je.hostname,r=this.config.internal_or_test_user_hostname;(typeof r=="string"?t===r:r.test(t))&&this.setInternalOrTestUser()}this.config.capture_pageview&&setTimeout(()=>{(this.consent.isOptedIn()||this.bu())&&this.th()},1),this.eh=new t_(this),this.eh.load()}Yu(){var t;this.is_capturing()&&this.config.request_batching&&((t=this.qu)===null||t===void 0||t.enable())}_dom_loaded(){this.is_capturing()&&Dn(this.__request_queue,t=>this.ju(t)),this.__request_queue=[],this.Yu()}_handle_unload(){var t,r,n,i,s,o;this.$u=!0,(t=this.surveys)===null||t===void 0||(r=t.handlePageUnload)===null||r===void 0||r.call(t),(n=this.metrics)===null||n===void 0||n.flush("sendBeacon"),this.config.request_batching?(this.ih()&&this.capture(Ih),(i=this.logs)===null||i===void 0||i.flushLogs("sendBeacon"),(s=this.qu)===null||s===void 0||s.unload(),(o=this.Bu)===null||o===void 0||o.unload()):this.ih()&&this.capture(Ih,null,{transport:"sendBeacon"})}_send_request(t){g_(this,t)}ju(t,r){this.Bu?this.Bu.retriableRequest(t,r):this._send_request(r?b(b({},t),{},{transport:r}):t)}_execute_array(t){ic++;try{let r;const n=[],i=[],s=[];Dn(t,a=>{if(a)if(r=a[0],ce(r))s.push(a);else if(tt(a))try{a.call(this)}catch(c){j.error("Error executing queued PostHog call",a,c)}else ce(a)&&r==="alias"?n.push(a):ce(a)&&r.indexOf("capture")!==-1&&tt(this[r])?s.push(a):i.push(a)});const o=function(a,c){Dn(a,function(l){try{if(ce(l[0])){let u=c;Ce(l,function(h){u=u[h[0]].apply(u,h.slice(1))})}else c[l[0]].apply(c,l.slice(1))}catch(u){j.error("Error executing queued PostHog call",l,u)}})};o(n,this),o(i,this),o(s,this)}finally{ic--}}push(t){if(ic>0&&ce(t)&&ye(t[0])){const r=fr.prototype[t[0]];tt(r)&&r.apply(this,t.slice(1));return}this._execute_array([t])}get nh(){return{property:Rh,persistenceKey:qn,cookieName:"_fbc",pattern:ap,register:(t,r)=>{var n;return(n=this.persistence)===null||n===void 0?void 0:n.register({[qn]:{value:t,delivered:r}})},unregister:()=>{var t;return(t=this.persistence)===null||t===void 0?void 0:t.unregister(qn)}}}get sh(){return{property:Ah,persistenceKey:Mi,cookieName:"_fbp",pattern:cp,register:(t,r)=>{var n;return(n=this.persistence)===null||n===void 0?void 0:n.register({[Mi]:{value:t,delivered:r}})},unregister:()=>{var t;return(t=this.persistence)===null||t===void 0?void 0:t.unregister(Mi)}}}rh(t){var r;const n=(r=this.persistence)===null||r===void 0?void 0:r.get_property(t.persistenceKey);return ye(n)&&t.pattern.test(n)?{value:n,delivered:!1}:be(n)&&ye(n.value)&&t.pattern.test(n.value)?{value:n.value,delivered:n.delivered===!0}:void 0}oh(t,r,n){return r===n?.value?{value:r,pending:!n.delivered}:(t.register(r,!1),{value:r,pending:!0})}ah(t){if(!this.config.save_campaign_params||this.bu())return;const r=Ni(t.cookieName);return ye(r)&&t.pattern.test(r)?r:void 0}uh(t,r,n,i){if(!this.persistence)return;const s=this.nh;this.persistence.refreshKey(s.persistenceKey);const o=this.rh(s);if(i)return void s.unregister();if(n)return ye(r)&&ap.test(r)?this.oh(s,r,o):void s.unregister();const a=ye(t)&&MP.test(t)?t:void 0,c=this.ah(s);return c&&((l,u,h)=>{const d=l.split(".");if(u)return d[3]===u;if(!h)return!0;const p=h.value.split(".");return d[3]===p[3]||Number(d[2])>Number(p[2])})(c,a,o)?this.oh(s,c,o):a?o?.value.split(".")[3]===a?{value:o.value,pending:!o.delivered}:this.oh(s,`fb.1.${Date.now()}.${a}`,o):o?{value:o.value,pending:!o.delivered}:void 0}hh(t,r,n){if(!this.persistence)return;const i=this.sh;this.persistence.refreshKey(i.persistenceKey);const s=this.rh(i);if(n)return void i.unregister();if(r)return ye(t)&&cp.test(t)?this.oh(i,t,s):void i.unregister();const o=this.ah(i);return o?this.oh(i,o,s):s?{value:s.value,pending:!s.delivered}:void 0}dh(t,r){if(!this.persistence)return;this.persistence.refreshKey(t.persistenceKey);const n=this.rh(t);n?.value!==r||n.delivered||t.register(r,!0)}capture(t,r,n){var i,s;if(!(this.__loaded&&this.persistence&&this.sessionPersistence&&this.qu))return void j.uninitializedWarning("posthog.capture");if(!this.is_capturing())return;if(O(t)||!ye(t))return void j.error("No event name provided to posthog.capture");this.Su();const o=!this.config.opt_out_useragent_filter&&this._is_bot();if(o&&!this.config.__preview_capture_bot_pageviews)return;const a=n?.skip_client_rate_limiting?void 0:this.rateLimiter.clientRateLimitContext();if(a?.isRateLimited)return void j.critical("This capture call is ignored due to client rate limiting.");let c;r!=null&&r.$current_url&&!ye(r?.$current_url)&&(j.error("Invalid `$current_url` property provided to `posthog.capture`. Input must be a string. Ignoring provided value."),r==null||delete r.$current_url),t!=="$exception"||n!=null&&n.fh||j.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.sessionPersistence.update_search_keyword(),this.config.save_campaign_params&&(c=this.sessionPersistence.update_campaign_params()),this.config.save_referrer&&this.sessionPersistence.update_referrer_info(),(this.config.save_campaign_params||this.config.save_referrer)&&this.persistence.set_initial_person_info();const l=new Date,u=n?.timestamp||l,h=lh(n?.uuid,Lt);let d={uuid:h,event:t,properties:this.calculateEventProperties(t,r||{},u,h)};t==="$pageview"&&this.config.__preview_capture_bot_pageviews&&o&&(d.event="$bot_pageview",d.properties.$browser_type="bot"),a&&(d.properties.$lib_rate_limit_remaining_tokens=a.remainingTokens);const p=t==="$feature_flag_called"&&d.properties.$feature_flag_has_experiment===!1&&this.get_property("$minimal_flag_called_events")===!0;n!=null&&n.$set&&!p&&(d.$set=n?.$set);const f=be(r?.$set)?r.$set:void 0,v=ce(r?.$unset)?r.$unset:[],m=n?.$unset||[],_=H=>{var oe;const I=!!n?.$set&&H in n.$set;return{hasProvided:I||!!f&&H in f,provided:I?n==null||(oe=n.$set)===null||oe===void 0?void 0:oe[H]:f?.[H],unset:v.indexOf(H)!==-1||m.indexOf(H)!==-1}},w=_(Rh),S=_(Ah),T=[{channel:this.nh,hasProvided:w.hasProvided,update:this.uh(c?.fbclid,w.provided,w.hasProvided,w.unset)},{channel:this.sh,hasProvided:S.hasProvided,update:this.hh(S.provided,S.hasProvided,S.unset)}];for(const{channel:H,hasProvided:oe,update:I}of T)I&&d.properties.$process_person_profile===!0&&I.pending&&!oe&&!p&&(d.$set=b({[H.property]:I.value},d.$set));const C=n?.$unset;C&&(d.$unset=C);const $=p?void 0:this.ph(n?.$set_once,t!==Th,t===$m);if($&&(d.$set_once=$),n!=null&&n._noTruncate||(M=this.config.properties_string_max_length,d=(function(H,oe){const I=new Set;return(function Q(y,V){if(y!==Object(y))return oe?oe(y):y;if(I.has(y))return;let K;if(I.add(y),ce(y))K=[],Dn(y,le=>{K.push(Q(le))});else{const le={};Ce(ci(y)?Pm(y):y,(de,$e)=>{I.has(de)||(le[$e]=Q(de,$e))}),K=le}return K})(H)})(d,H=>ye(H)?H.slice(0,M):H)),d.timestamp=u,O(n?.timestamp)||(d.properties.$event_time_override_provided=!0,d.properties.$event_time_override_system_time=l),p&&(d.properties=((H,oe=[])=>{const I={},Q=y=>{H[y]!==void 0&&(I[y]=H[y])};return WC.forEach(Q),oe.forEach(Q),I})(d.properties,LP)),t===or.DISMISSED||t===or.SENT){const H=r?.[Xa.SURVEY_ID],oe=r?.[Xa.SURVEY_ITERATION];S_({id:H,current_iteration:oe}),d.$set=b(b({},d.$set),{},{[SP({id:H,current_iteration:oe},t===or.SENT?"responded":"dismissed")]:!0})}else t===or.SHOWN&&(d.$set=b(b({},d.$set),{},{[Xa.SURVEY_LAST_SEEN_DATE]:new Date().toISOString()}));var M;if(t===sP.SHOWN){const H=r?.[Wh.TOUR_TYPE];H&&(d.$set=b(b({},d.$set),{},{[`${Wh.TOUR_LAST_SEEN_DATE}/${H}`]:new Date().toISOString()}))}const L=b(b({},d.properties.$set),d.$set);if(_t(L)||this.setPersonPropertiesForFlags(L),!ge(this.config.before_send)){const H=this.Os(d);if(!H)return;d=H,d.uuid=lh(d.uuid,Lt)}const q=T.filter(({channel:H,update:oe})=>{var I,Q,y;const V=(I=(Q=d.$set)===null||Q===void 0?void 0:Q[H.property])!==null&&I!==void 0?I:be((y=d.properties)===null||y===void 0?void 0:y.$set)?d.properties.$set[H.property]:void 0;return oe?.pending&&V===oe.value});this.vu.emit("eventCaptured",d);const X=(i=n?._url)!==null&&i!==void 0?i:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),ee=n?._batchKey==="recordings"||/\/s\/(?:\?|$)/.test(X),k=b(b(b({method:"POST",url:X,data:d,compression:"best-available",preferSyncCompression:n?.send_instantly,timestampMode:ee?"body":"capture-body",batchKey:n?._batchKey},ee&&(!((s=d.properties)===null||s===void 0)&&s.$session_id)?{batchGroup:d.properties.$session_id+(d.properties.$window_id?`-${d.properties.$window_id}`:"")}:{}),n?.transport?{transport:n.transport}:{}),q.length?{fireCallbackOnDrop:!0,callback:H=>{if(H.statusCode>=200&&300>H.statusCode)for(const{channel:oe,update:I}of q)this.dh(oe,I.value)}}:{});if(!this.config.request_batching||n&&!n?._batchKey||n?.send_instantly||q.length){var ie;let H;!k.transport&&!k.callback&&_t((ie=this.config.request_headers)!==null&&ie!==void 0?ie:{})&&this.$u&&(H="sendBeacon"),this.ju(k,H)}else this.qu.enqueue(k);return d}_addCaptureHook(t){return this.on("eventCaptured",r=>t(r.event,r))}getExtension(t){var r;return(r=this.Xu)===null||r===void 0?void 0:r.getExtension(t)}Zu(){var t;return(t=this.Xu)!==null&&t!==void 0?t:this.Xu=new xP(this)}pu(t){this.Pu.push(t);let r=!0;return()=>{if(!r)return;r=!1;const n=this.Pu.indexOf(t);n!==-1&&this.Pu.splice(n,1)}}gh(t=!0){var r,n,i;return!!(!((r=this.persistence)===null||r===void 0)&&r.consumeCookieIdentityChange())&&(this.Ou=null,this.persistence.get_property("$user_state")==="anonymous"&&((i=this.sessionPersistence)===null||i===void 0||i.clear(),this.Mu.clear(),this.mh()),(n=this.featureFlags)===null||n===void 0||n.reset(),t&&this.reloadFeatureFlags(),!0)}calculateEventProperties(t,r,n,i,s){if(n=n||new Date,!this.persistence||!this.sessionPersistence)return r;this.persistence.syncCookieProperties(),this.gh();const o=s?void 0:this.persistence.remove_event_timer(t);let a=b({},r);if(a.token=this.config.token,a.$config_defaults=this.config.defaults,this.bu()&&(a[km]=!0),t==="$snapshot"){const w=b(b({},this.persistence.properties()),this.sessionPersistence.properties());return a.distinct_id=w.distinct_id,(!ye(a.distinct_id)&&!We(a.distinct_id)||Oi(a.distinct_id))&&j.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),a}const c=(function(w,S,T,C=!1){var $,M,L,q;if(!pt)return{};const X=w?[...Qn,...S||[]]:[],[ee,k]=Vg(pt),[ie,H]=(function(Re){for(let _e=0;ch.length>_e;_e++){const[ve,Je,Xe]=ch[_e],Pe=Re.match(ve);if(Pe){const z=Xe&&Re.match(Xe)||Pe;return[Je,z?.[1]||""]}}return["",""]})(pt),oe=(function(){const Re="u">typeof navigator?navigator:void 0;return Re?.brave?{brave:!0}:{}})(),I={};O(T)||(I.detectGoogleSearchApp=T);const Q={},y=($=navigator)===null||$===void 0||($=$.userAgentData)===null||$===void 0?void 0:$.platform,V=(M=navigator)===null||M===void 0?void 0:M.maxTouchPoints,K=A==null||(L=A.screen)===null||L===void 0?void 0:L.width,le=A==null||(q=A.screen)===null||q===void 0?void 0:q.height,de=A?.devicePixelRatio;O(y)||(Q.userAgentDataPlatform=y),O(V)||(Q.maxTouchPoints=V),O(K)||(Q.screenWidth=K),O(le)||(Q.screenHeight=le),O(de)||(Q.devicePixelRatio=de);const $e=Le($u({$os:ee,$os_version:k,$browser:Hg(pt,navigator.vendor,oe,I),$webview_app:ie,$webview_app_version:H,$device:Bg(pt),$device_type:vC(pt,Q),$timezone:Qm(),$timezone_offset:rP()}),{$current_url:ns(C?Ur(je?.href):je?.href,X,is),$host:je?.host,$pathname:je?.pathname,$raw_user_agent:pt.length>1e3?pt.substring(0,997)+"...":pt,$browser_version:fC(pt,navigator.vendor,oe,I),$browser_language:Jm(),$browser_language_prefix:tP(),$screen_height:A?.screen.height,$screen_width:A?.screen.width,$viewport_height:A?.innerHeight,$viewport_width:A?.innerWidth,$lib:ar.LIB_NAME,$lib_version:ar.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3});return ar.SDK_DIST_CHANNEL&&($e.$sdk_dist_channel=ar.SDK_DIST_CHANNEL),$e})(this.config.mask_personal_data_properties,this.config.custom_personal_data_properties,this.config.detect_google_search_app,this.config.disable_capture_url_hashes);if(this.sessionManager){const{sessionId:w,windowId:S}=this.sessionManager.checkAndGetSessionAndWindowId(s,n.getTime(),!0);a.$session_id=w,a.$window_id=S}this.sessionPropsManager&&Le(a,this.sessionPropsManager.getSessionProps());try{var l;this.sessionRecording&&Le(a,this.sessionRecording.sdkDebugProperties),a.$sdk_debug_retry_queue_size=(l=this.Bu)===null||l===void 0?void 0:l.length}catch(w){a.$sdk_debug_error_capturing_properties=String(w)}let u;if(this.requestRouter.region===Sl&&(a.$lib_custom_api_host=this.config.api_host),u=t!=="$pageview"||s?t!=="$pageleave"||s?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(n):this.pageViewManager.doPageView(n,i),a=Le(a,u),t==="$pageview"&&N&&(a.title=N.title),!O(o)){const w=n.getTime()-o;a.$duration=parseFloat((w/1e3).toFixed(3))}pt&&this.config.opt_out_useragent_filter&&(a.$browser_type=this._is_bot()?"bot":"browser");const h=this.persistence.properties(),d=this.sessionPersistence.properties(),p=a.$groups,f=h.$groups;be(p)&&!_t(p)&&(a.$groups=b(b({},be(f)?f:{}),p)),Ce(["$referrer","$referring_domain"],w=>{w in h&&delete d[w]});const v={};if(this.Pu.length>0)for(const w of this.Pu.slice())try{Le(v,w())}catch(S){j.error("Failed to produce browser extension event properties",S)}a=Le({},c,h,d,b(b({},v),a)),a.$is_identified=this._isIdentified(),ce(this.config.property_denylist)?Ce(this.config.property_denylist,function(w){delete a[w]}):j.error(E_+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);const m=this.config.sanitize_properties;m&&(j.error(op),a=m(a,t));const _=this.yh();return a.$process_person_profile=_,_&&!s&&this.bh("_calculate_event_properties"),a}ph(t,r=!0,n=!1){var i;if(!this.persistence||!this.yh()||this.Iu&&!n)return t;const s=this.persistence.get_initial_props(),o=(i=this.sessionPropsManager)===null||i===void 0?void 0:i.getSetOnceProps();let a=Le({},s,o||{},t||{});const c=this.config.sanitize_properties;return c&&(j.error(op),a=c(a,"$set_once")),r&&(this.Iu=!0),_t(a)?void 0:a}register(t,r){var n;(n=this.persistence)===null||n===void 0||n.register(t,r)}register_once(t,r,n){var i;(i=this.persistence)===null||i===void 0||i.register_once(t,r,n)}register_for_session(t){var r,n;(r=this.persistence)===null||r===void 0||r.syncCookieProperties(),this.gh(),(n=this.sessionPersistence)===null||n===void 0||n.register(t),Object.keys(t).forEach(i=>this.Mu.add(i)),this.mh()}unregister(t){var r;(r=this.persistence)===null||r===void 0||r.unregister(t)}unregister_for_session(t){var r;(r=this.sessionPersistence)===null||r===void 0||r.unregister(t),this.Mu.delete(t),this.mh()}_h(t,r){this.register({[t]:r})}Hu(){this.Mu.forEach(t=>{var r;(r=this.sessionPersistence)===null||r===void 0||r.unregister(t)}),this.Mu.clear(),this.mh()}mh(){var t;if(!this.Eu)return;if(this.config.persistence==="memory"||!((t=this.sessionPersistence)===null||t===void 0)&&t.mi||!xe.Et())return void xe.Lt(this.Eu);const r=[];this.Mu.forEach(n=>r.push(n)),r.length>0?xe.At(this.Eu,r):xe.Lt(this.Eu)}getFeatureFlag(t,r){var n;return(n=this.featureFlags)===null||n===void 0?void 0:n.getFeatureFlag(t,r)}getFeatureFlagPayload(t){var r;return(r=this.featureFlags)===null||r===void 0?void 0:r.getFeatureFlagPayload(t)}getFeatureFlagResult(t,r){var n;return(n=this.featureFlags)===null||n===void 0?void 0:n.getFeatureFlagResult(t,r)}getAllFeatureFlags(){var t,r;return(t=(r=this.featureFlags)===null||r===void 0?void 0:r.getAllFeatureFlags())!==null&&t!==void 0?t:[]}isFeatureEnabled(t,r){var n,i;return(n=(i=this.featureFlags)===null||i===void 0?void 0:i.isFeatureEnabled(t,r))!==null&&n!==void 0?n:r?.defaultValue}reloadFeatureFlags(){var t;(t=this.featureFlags)===null||t===void 0||t.reloadFeatureFlags()}updateFlags(t,r,n){var i;(i=this.featureFlags)===null||i===void 0||i.updateFlags(t,r,n)}updateEarlyAccessFeatureEnrollment(t,r,n){var i;(i=this.featureFlags)===null||i===void 0||i.updateEarlyAccessFeatureEnrollment(t,r,n)}getEarlyAccessFeatures(t,r=!1,n){var i;return(i=this.featureFlags)===null||i===void 0?void 0:i.getEarlyAccessFeatures(t,r,n)}on(t,r){return this.vu.on(t,r)}onFeatureFlags(t){return this.featureFlags?this.featureFlags.onFeatureFlags(t):(t([],{},{errorsLoading:!0}),()=>{})}onSurveysLoaded(t){return this.surveys?this.surveys.onSurveysLoaded(t):(t([],{isLoaded:!1,error:Ei}),()=>{})}onSessionId(t){var r,n;return(r=(n=this.sessionManager)===null||n===void 0?void 0:n.onSessionId(t))!==null&&r!==void 0?r:()=>{}}getSurveys(t,r=!1){this.surveys?this.surveys.getSurveys(t,r):t([],{isLoaded:!1,error:Ei})}getActiveMatchingSurveys(t,r=!1){this.surveys?this.surveys.getActiveMatchingSurveys(t,r):t([],{isLoaded:!1,error:Ei})}renderSurvey(t,r){var n;(n=this.surveys)===null||n===void 0||n.renderSurvey(t,r)}displaySurvey(t,r=IP){var n;(n=this.surveys)===null||n===void 0||n.displaySurvey(t,r)}cancelPendingSurvey(t){var r;(r=this.surveys)===null||r===void 0||r.cancelPendingSurvey(t)}canRenderSurvey(t){var r,n;return(r=(n=this.surveys)===null||n===void 0?void 0:n.canRenderSurvey(t))!==null&&r!==void 0?r:{visible:!1,disabledReason:Ei}}canRenderSurveyAsync(t,r=!1){var n,i;return(n=(i=this.surveys)===null||i===void 0?void 0:i.canRenderSurveyAsync(t,r))!==null&&n!==void 0?n:Promise.resolve({visible:!1,disabledReason:Ei})}wh(t){return!t||Oi(t)?(j.critical("Unique user id has not been set in posthog.identify"),!1):t==="$posthog_cookieless"?(j.critical(`The string "${t}" was set in posthog.identify which indicates an error. This ID is only used as a sentinel value.`),!1):!["distinct_id","distinctid"].includes(t.toLowerCase())&&!["undefined","null"].includes(t.toLowerCase())||(j.critical(`The string "${t}" was set in posthog.identify which indicates an error. This ID should be unique to the user and not a hardcoded string.`),!1)}identify(t,r,n){if(!this.__loaded||!this.persistence)return j.uninitializedWarning("posthog.identify");if(We(t)&&(t=t.toString(),j.warn("The first argument to posthog.identify was a number, but it should be a string. It has been converted to a string.")),!this.wh(t)||!this.bh("posthog.identify"))return;this.Su();const i=this.get_distinct_id(),s=this.persistence.syncCookieProperties()&&this.get_distinct_id()!==i,o=this.gh(!1),a=this.persistence.Da();let c=!1;try{const u=this.get_distinct_id();this.register({$user_id:t}),this.get_property("$device_id")||this.register_once({$had_persisted_distinct_id:!0,$device_id:u},""),t!==u&&t!==this.get_property("__alias")&&(this.unregister(So),this.register({distinct_id:t}));const h=(this.persistence.get_property("$user_state")||"anonymous")===sr,d=t!==u,p=!d&&h;if(d&&h){var l;const f=this.config.reuseAnonymousId?{distinct_id:t}:{distinct_id:t,$anon_distinct_id:u};this.persistence.set_property(ft,Ks),this.setPersonPropertiesForFlags({$set:r||{},$set_once:n||{}},!1),this.config.cookieWinsOnConflict&&this.persistence.La(),this.capture("$identify",f,{$set:r||{},$set_once:n||{}})&&(this.Ou=nc(t,r,n)),(l=this.featureFlags)===null||l===void 0||l.setAnonymousDistinctId(this.config.reuseAnonymousId?void 0:u)}else if(p){this.persistence.set_property(ft,Ks);const f=r||{},v=n||{};this.setPersonPropertiesForFlags({$set:f,$set_once:v},!1),this.config.cookieWinsOnConflict&&this.persistence.La(),this.capture("$set",{$set:f,$set_once:v})&&(this.Ou=nc(t,r,n))}else(r||n)&&this.setPersonProperties(r,n);d||s||o?(this.reloadFeatureFlags(),this.featureFlags?this.featureFlags.resetFlagCallReported():this.unregister(kr)):p&&(r||n)&&this.reloadFeatureFlags(),c=!0}finally{a&&this.persistence.ja(c)}}setPersonProperties(t,r){if(!t&&!r||!this.bh("posthog.setPersonProperties"))return;const n=nc(this.get_distinct_id(),t,r);this.Ou!==n?(this.setPersonPropertiesForFlags({$set:t||{},$set_once:r||{}},!0),this.capture("$set",{$set:t||{},$set_once:r||{}})&&(this.Ou=n)):j.info("A duplicate setPersonProperties call was made with the same properties. It has been ignored.")}unsetPersonProperties(t){var r;const n=(ce(t)?t:[t]).filter(i=>ye(i)&&i.length>0);n.length!==0&&this.bh("posthog.unsetPersonProperties")&&((r=this.featureFlags)===null||r===void 0||r.unsetPersonPropertiesForFlags(n,!0),this.capture("$set",{$unset:n}),this.Ou=null)}group(t,r,n){var i;if(!t||!r)return void j.error("posthog.group requires a group type and group key");(i=this.persistence)===null||i===void 0||i.syncCookieProperties(),this.gh();const s=this.getGroups(),o=s[t]!==r;if(o&&this.resetGroupPropertiesForFlags(t),this.register({$groups:b(b({},s),{},{[t]:r})}),(o||n)&&this.yh()){const a={$group_type:t,$group_key:r};n&&(a.$group_set=n),this.capture(Th,a)}n&&this.setGroupPropertiesForFlags({[t]:n}),o&&!n&&this.reloadFeatureFlags()}resetGroups(){this.register({$groups:{}}),this.resetGroupPropertiesForFlags(),this.reloadFeatureFlags()}setPersonPropertiesForFlags(t,r=!0){var n;(n=this.featureFlags)===null||n===void 0||n.setPersonPropertiesForFlags(t,r)}resetPersonPropertiesForFlags(t=!0){var r;(r=this.featureFlags)===null||r===void 0||r.resetPersonPropertiesForFlags(t)}setGroupPropertiesForFlags(t,r=!0){var n;this.bh("posthog.setGroupPropertiesForFlags")&&((n=this.featureFlags)===null||n===void 0||n.setGroupPropertiesForFlags(t,r))}resetGroupPropertiesForFlags(t){var r;(r=this.featureFlags)===null||r===void 0||r.resetGroupPropertiesForFlags(t)}reset(t){const r=vt(t)?t:t?.resetDeviceID,n=vt(t)||t==null?void 0:t.bootstrap;this.kh(r,!1,n)}kh(t,r=!1,n){var i,s,o,a,c,l;if(j.info("reset"),!this.__loaded)return j.uninitializedWarning("posthog.reset");const u=n?.sessionID;this.config.bootstrap=n||((i=this.Lu)===null||i===void 0?void 0:i.bootstrap)||{},(s=this.featureFlags)===null||s===void 0||(o=s.updateConfig)===null||o===void 0||o.call(s,this.config,this.nl());const h=this.get_property(ku),d=this.get_property(qa),p=this.get_property(Li);(a=this.sessionRecording)===null||a===void 0||a.flushBeforeIdentityReset();const f=this.is_capturing();this.consent.reset(),r||!f||this.is_capturing()||console.warn("[PostHog.js]","reset() cleared the stored consent, and capturing is now off because of `opt_out_capturing_by_default`. Call opt_in_capturing() again, and prefer calling reset() before opting in rather than after.");const v=(c=this.persistence)===null||c===void 0||(l=c.Da)===null||l===void 0?void 0:l.call(c);let m=!1;try{var _,w,S,T,C,$,M,L,q,X,ee,k,ie;if((_=this.persistence)===null||_===void 0||_.clear(),(w=this.sessionPersistence)===null||w===void 0||w.clear(),this.Mu.clear(),this.mh(),O(p)||(X=this.persistence)===null||X===void 0||X.register({$session_recording_remote_config:p}),(S=this.surveys)===null||S===void 0||S.reset(),(T=this.featureFlags)===null||T===void 0||T.reset(),(C=this.conversations)===null||C===void 0||C.reset(),($=this.logs)===null||$===void 0||$.reset(),(M=this.metrics)===null||M===void 0||M.reset(),(L=this.persistence)===null||L===void 0||L.set_property("$user_state","anonymous"),(q=this.sessionManager)===null||q===void 0||q.resetSessionId(),this.Ou=null,this.config.cookieless_mode==="always")this.register_once({distinct_id:ja,$device_id:null},"");else{const I=this.config.get_device_id(Lt());this.register_once({distinct_id:I,$device_id:t?I:h},""),t||O(d)||this.register({[qa]:d})}if(this.register({$last_posthog_reset:new Date().toISOString()},1),n&&(n.distinctID&&!this.bu()&&((ie=this.persistence)===null||ie===void 0||ie.set_property("$user_state",n.isIdentifiedID?"identified":"anonymous"),this.register({distinct_id:n.distinctID})),(ee=this.featureFlags)===null||ee===void 0||ee.initialize(),!ge(u)&&!(!((k=this.sessionManager)===null||k===void 0)&&k.setBootstrapSessionId(u,!0)))){const I=b({},n);delete I.sessionID,this.config.bootstrap=I}delete this.config.identity_distinct_id,delete this.config.identity_hash,delete this.config.identity_claims,m=!0}finally{var H,oe;v&&((H=this.persistence)===null||H===void 0||(oe=H.ja)===null||oe===void 0||oe.call(H,m))}this.reloadFeatureFlags()}shutdown(t){var r=this;return Ue(function*(){var n,i,s,o,a,c,l,u;if(r.__loaded){r.Tu=!0,r.Zu().dispose(),(n=r.sessionRecording)===null||n===void 0||n.dispose(),(i=r.logs)===null||i===void 0||i.flushLogs("sendBeacon"),(s=r.metrics)===null||s===void 0||s.flush("sendBeacon"),(o=r.metrics)===null||o===void 0||o.dispose(),(a=r.qu)===null||a===void 0||a.unload(),(c=r.Bu)===null||c===void 0||c.unload();try{var h;(h=r.featureFlags)===null||h===void 0||h.destroy()}catch(d){j.error("Error while destroying feature flags",d)}(l=r.persistence)===null||l===void 0||l.destroy(),(u=r.sessionPersistence)===null||u===void 0||u.destroy()}else j.uninitializedWarning("posthog.shutdown")})()}setIdentity(t,r){var n;delete this.config.identity_claims,this.config.identity_distinct_id=t,this.config.identity_hash=r,this.alias(t),(n=this.conversations)===null||n===void 0||n.Sh()}clearIdentity(){var t;delete this.config.identity_distinct_id,delete this.config.identity_hash,delete this.config.identity_claims,(t=this.conversations)===null||t===void 0||t.xh()}get_distinct_id(){return this.get_property("distinct_id")}getGroups(){return this.get_property("$groups")||{}}get_session_id(){var t,r;return(t=(r=this.sessionManager)===null||r===void 0?void 0:r.checkAndGetSessionAndWindowId(!0).sessionId)!==null&&t!==void 0?t:""}get_session_replay_url(t){if(!this.sessionManager)return"";const{sessionId:r,sessionStartTimestamp:n}=this.sessionManager.checkAndGetSessionAndWindowId(!0);let i=this.requestRouter.endpointFor("ui",`/project/${this.config.token}/replay/${r}`);if(t?.withTimestamp&&n){var s;const o=(s=t.timestampLookBack)!==null&&s!==void 0?s:10;if(!n)return i;i+=`?t=${Math.max(Math.floor((new Date().getTime()-n)/1e3)-o,0)}`}return i}alias(t,r){return t===this.get_property("$people_distinct_id")?(j.critical("Attempting to create alias for existing People user - aborting."),-2):this.bh("posthog.alias")?(O(r)&&(r=this.get_distinct_id()),t!==r?(this._h(So,t),this.capture("$create_alias",{alias:t,distinct_id:r})):(j.warn("alias matches current distinct_id - skipping api call."),this.identify(t),-1)):void 0}set_config(t){const r=b({},this.config);if(be(t)){var n,i,s,o,a,c,l,u,h,d,p,f,v,m;Le(this.config,lp(t));const w=this.xu();(n=this.persistence)===null||n===void 0||n.update_config(this.config,r,w),this.sessionPersistence=this.config.persistence==="sessionStorage"||this.config.persistence==="memory"?this.persistence:new Ka(b(b({},this.config),{},{persistence:"sessionStorage"}),w,!1);const S=this.Du(this.config.debug);var _;vt(S)&&(this.config.debug=S),vt(this.config.debug)&&(this.config.debug?(et.DEBUG=!0,ke.Et()&&ke.At("ph_debug",!0),j.info("set_config",{config:t,oldConfig:r,newConfig:b({},this.config)})):(et.DEBUG=!1,ke.Et()&&ke.Lt("ph_debug"))),(i=this.featureFlags)===null||i===void 0||(s=i.updateConfig)===null||s===void 0||s.call(i,this.config,this.nl()),(o=this.exceptionObserver)===null||o===void 0||o.onConfigChange(),(a=this.exceptions)===null||a===void 0||a.onConfigChange(),(c=this.metrics)===null||c===void 0||c.onConfigChange(),(l=this.sessionRecording)===null||l===void 0||l.startIfEnabledOrStop(),(u=this.tracingHeaders)===null||u===void 0||u.startIfEnabledOrStop(),(h=this.autocapture)===null||h===void 0||h.startIfEnabled(),(d=this.heatmaps)===null||d===void 0||d.startIfEnabled(),("capture_pageview"in t||"disable_capture_url_hashes"in t)&&((_=this.historyAutocapture)===null||_===void 0||_.startIfEnabledOrStop()),(p=this.exceptionObserver)===null||p===void 0||p.startIfEnabledOrStop(),(f=this.deadClicksAutocapture)===null||f===void 0||f.startIfEnabledOrStop(),(v=this.surveys)===null||v===void 0||v.loadIfEnabled(),this.Cu(),(m=this.externalIntegrations)===null||m===void 0||m.startIfEnabledOrStop(),!r.segment&&this.config.segment&&this.persistence&&Hh(this,ji,!1)}}_overrideSDKInfo(t,r){et.LIB_NAME=t,et.LIB_VERSION=r}startSessionRecording(t){const r=t===!0,n={sampling:r||!!t?.sampling,linked_flag:r||!!t?.linked_flag,url_trigger:r||!!t?.url_trigger,event_trigger:r||!!t?.event_trigger};var i,s,o,a,c;Object.values(n).some(Boolean)&&((i=this.sessionManager)===null||i===void 0||i.checkAndGetSessionAndWindowId(),n.sampling&&((s=this.sessionRecording)===null||s===void 0||s.overrideSampling()),n.linked_flag&&((o=this.sessionRecording)===null||o===void 0||o.overrideLinkedFlag()),n.url_trigger&&((a=this.sessionRecording)===null||a===void 0||a.overrideTrigger("url")),n.event_trigger&&((c=this.sessionRecording)===null||c===void 0||c.overrideTrigger("event"))),this.set_config({disable_session_recording:!1})}stopSessionRecording(){this.set_config({disable_session_recording:!0})}sessionRecordingStarted(){var t;return!!(!((t=this.sessionRecording)===null||t===void 0)&&t.started)}captureException(t,r){try{if(!this.exceptions)return;const n=this.exceptions.buildProperties(t,{handled:!0,syntheticException:new Error("PostHog syntheticException")});return this.exceptions.sendExceptionEvent(b(b({},n),r))}catch{return}}addExceptionStep(t,r){var n;(n=this.exceptions)===null||n===void 0||n.addExceptionStep(t,r)}captureLog(t){var r;(r=this.logs)===null||r===void 0||r.captureLog(t)}get logger(){var t,r;return(t=(r=this.logs)===null||r===void 0?void 0:r.logger)!==null&&t!==void 0?t:fr.Ch}startExceptionAutocapture(t){this.set_config({capture_exceptions:t==null||t})}stopExceptionAutocapture(){this.set_config({capture_exceptions:!1})}loadToolbar(t){var r,n;return(r=(n=this.toolbar)===null||n===void 0?void 0:n.loadToolbar(t))!==null&&r!==void 0&&r}get_property(t){var r;return(r=this.persistence)===null||r===void 0?void 0:r.props[t]}getSessionProperty(t){var r;return(r=this.sessionPersistence)===null||r===void 0?void 0:r.props[t]}toString(){var t;let r=(t=this.config.name)!==null&&t!==void 0?t:Ci;return r!==Ci&&(r="posthog."+r),r}_isIdentified(){var t,r;return((t=this.persistence)===null||t===void 0?void 0:t.get_property("$user_state"))==="identified"||((r=this.sessionPersistence)===null||r===void 0?void 0:r.get_property("$user_state"))==="identified"}yh(){var t,r;return!(this.config.person_profiles==="never"||this.config.person_profiles==="identified_only"&&!this._isIdentified()&&_t(this.getGroups())&&!(!((t=this.persistence)===null||t===void 0||(t=t.props)===null||t===void 0)&&t.__alias)&&!(!((r=this.persistence)===null||r===void 0||(r=r.props)===null||r===void 0)&&r.$epp))}ih(){return this.config.capture_pageleave===!0||this.config.capture_pageleave==="if_capture_pageview"&&!!this.config.capture_pageview}createPersonProfile(){this.yh()||this.bh("posthog.createPersonProfile")&&this.setPersonProperties({},{})}setInternalOrTestUser(){this.bh("posthog.setInternalOrTestUser")&&this.setPersonProperties({$internal_or_test_user:!0})}bh(t){return this.config.person_profiles==="never"?(j.error(t+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this._u(),this._h(Iu,!0),!0)}xu(){if(this.config.cookieless_mode==="always")return!0;const t=this.consent.isOptedOut();return this.config.disable_persistence||t&&!(!this.config.opt_out_persistence_by_default&&this.config.cookieless_mode!=="on_reject")}Cu(){var t,r;const n=this.xu();var i,s,o;return this.is_capturing()||(i=this.logs)===null||i===void 0||i.$h(),((t=this.persistence)===null||t===void 0?void 0:t.mi)!==n&&((s=this.persistence)===null||s===void 0||s.set_disabled(n)),((r=this.sessionPersistence)===null||r===void 0?void 0:r.mi)!==n&&((o=this.sessionPersistence)===null||o===void 0||o.set_disabled(n)),n&&(this.Mu.clear(),this.mh()),n}opt_in_capturing(t){var r;if(this.config.cookieless_mode!=="always"){if(this.bu()){var n,i,s,o,a,c;(n=this.sessionRecording)===null||n===void 0||n.dispose({discardBufferedEvents:!0}),this.kh(!0,!0),(i=this.sessionManager)===null||i===void 0||i.destroy(),(s=this.pageViewManager)===null||s===void 0||s.destroy(),this.sessionManager=new rp(this),this.pageViewManager=new Vh(this),this.persistence&&(this.sessionPropsManager=new ep(this,this.sessionManager,this.persistence));const p=(o=(a=this.config.__extensionClasses)===null||a===void 0?void 0:a.sessionRecording)!==null&&o!==void 0?o:(c=fr.__defaultExtensionClasses)===null||c===void 0?void 0:c.sessionRecording;var l,u;p&&(this.sessionRecording=this.yu(this.sessionRecording,new p(this)),this.du&&((l=this.sessionRecording)===null||l===void 0||(u=l.onRemoteConfig)===null||u===void 0||u.call(l,this.du)))}var h,d;this.consent.optInOut(!0),this.Cu(),this.Yu(),(r=this.sessionRecording)===null||r===void 0||r.startIfEnabledOrStop(),this.config.cookieless_mode=="on_reject"&&((h=this.surveys)===null||h===void 0||h.loadIfEnabled()),(O(t?.captureEventName)||t!=null&&t.captureEventName)&&this.capture((d=t?.captureEventName)!==null&&d!==void 0?d:"$opt_in",t?.captureProperties,{send_instantly:!0}),this.config.capture_pageview&&this.th()}else j.warn(sp)}opt_out_capturing(){if(this.config.cookieless_mode==="always")return void j.warn(sp);const t=this.config.cookieless_mode==="on_reject"?this.sessionRecording:void 0;var r,n;t?.dispose({discardBufferedEvents:!0}),this.config.cookieless_mode==="on_reject"&&this.consent.isOptedIn()&&this.kh(!0,!0),this.consent.optInOut(!1),this.Cu(),this.config.cookieless_mode==="on_reject"&&(this.register({distinct_id:ja,$device_id:null}),this.mu(t),this.sessionRecording=void 0,(r=this.sessionManager)===null||r===void 0||r.destroy(),(n=this.pageViewManager)===null||n===void 0||n.destroy(),this.sessionManager=void 0,this.sessionPropsManager=void 0,this.config.capture_pageview&&this.th(),this.Yu())}has_opted_in_capturing(){return this.consent.isOptedIn()}has_opted_out_capturing(){return this.consent.isOptedOut()}get_explicit_consent_status(){const t=this.consent.consent;return t===1?"granted":t===0?"denied":"pending"}is_capturing(){return this.config.cookieless_mode==="always"||(this.config.cookieless_mode==="on_reject"?this.consent.isRejected()||this.consent.isOptedIn():!this.has_opted_out_capturing())}clear_opt_in_out_capturing(){this.consent.reset(),this.Cu()}_is_bot(){return rt?m_(rt,this.config.custom_blocked_useragents):void 0}th(){N&&(N.visibilityState==="visible"?this.Ru||(this.Ru=!0,this.capture(Cu,{title:N.title},{send_instantly:!0}),this.Au&&(N.removeEventListener(es,this.Au),this.Au=null)):this.Au||(this.Au=this.th.bind(this),Ie(N,es,this.Au)))}debug(t){t===!1?(A?.console.log("You've disabled debug mode."),this.set_config({debug:!1})):(A?.console.log("You're now in debug mode. All calls to PostHog will be logged in your console.\nYou can disable this with `posthog.debug(false)`."),this.set_config({debug:!0}))}nl(){const t=this.Lu||{};return"advanced_disable_flags"in t?!!t.advanced_disable_flags:this.config.advanced_disable_flags!==!1?!!this.config.advanced_disable_flags:this.config.advanced_disable_decide===!0?(j.warn("Config field 'advanced_disable_decide' is deprecated. Please use 'advanced_disable_flags' instead. The old field will be removed in a future major version."),!0):(function(r,n,i,s,o){const a=n in r&&!ge(r[n]),c=i in r&&!ge(r[i]);return a?r[n]:!!c&&(o&&o.warn(`Config field '${i}' is deprecated. Please use '${n}' instead. The old field will be removed in a future major version.`),r[i])})(t,"advanced_disable_flags","advanced_disable_decide",0,j)}Os(t){var r;if(ge(this.config.before_send))return t;const n=Object.keys((r=t.properties)!==null&&r!==void 0?r:{}).filter(nC),i=ce(this.config.before_send)?this.config.before_send:[this.config.before_send];let s=t;for(const o of i)try{if(s=o(s),ge(s)){const a=`Event '${t.event}' was rejected in beforeSend function`;return rC(t.event)?j.warn(`${a}. This can cause unexpected behavior.`):j.info(a),null}s.properties&&!_t(s.properties)||j.warn(`Event '${t.event}' has no properties after beforeSend function, this is likely an error.`)}catch(a){return j.error(`Error in beforeSend function for event '${t.event}':`,a),null}for(const o of n)if(s.properties&&ge(s.properties[o]))return j.warn(`Event '${t.event}' had its '${o}' property removed in a beforeSend function. This property is required for ingestion, so the event will be dropped.`),null;return s}getPageViewId(){var t;return(t=this.pageViewManager.Vo)===null||t===void 0?void 0:t.pageViewId}captureTraceFeedback(t,r){this.capture("$ai_feedback",{$ai_trace_id:String(t),$ai_feedback_text:r})}captureTraceMetric(t,r,n){this.capture("$ai_metric",{$ai_trace_id:String(t),$ai_metric_name:r,$ai_metric_value:String(n)})}Du(t){const r=vt(t)&&!t,n=ke.Et()&&ke.Ot("ph_debug")==="true";return!r&&(!!n||t)}};Hi.__defaultExtensionClasses={},Hi.Ch=(()=>{const e=()=>{};return{trace:e,debug:e,info:e,warn:e,error:e,fatal:e}})(),(function(e,t){for(let r=0;t.length>r;r++)e.prototype[t[r]]=O$(e.prototype[t[r]])})(Hi,["identify"]);var k_=class{constructor(e){this.disabled=e===!1;const t=be(e)?e:{};this.thresholdPx=t.threshold_px||30,this.timeoutMs=t.timeout_ms||1e3,this.clickCount=t.click_count||3,this.clicks=[]}isRageClick(e,t,r){if(this.disabled)return!1;const n=this.clicks[this.clicks.length-1];if(n&&Math.abs(e-n.x)+Math.abs(t-n.y)<this.thresholdPx&&this.timeoutMs>r-n.timestamp){if(this.clicks.push({x:e,y:t,timestamp:r}),this.clicks.length===this.clickCount)return!0}else this.clicks=[{x:e,y:t,timestamp:r}];return!1}},oc="$copy_autocapture",ac=Be("[AutoCapture]");function cc(e,t){return t.length>e?t.slice(0,e)+"...":t}function UP(e){if(e.previousElementSibling)return e.previousElementSibling;let t=e;do t=t.previousSibling;while(t&&!Zt(t));return t}function FP(e,{e:t,maskAllElementAttributes:r,maskAllText:n,elementAttributeIgnoreList:i,elementsChainAsString:s,disableCaptureUrlHashes:o}){var a,c;if(!Zt(e))return{props:{}};const l=[e],u=new Set([e]);let h=e;for(;h.parentNode&&!ct(h,"body")&&1e3>l.length;){if(Pu(h.parentNode)){const $=h.parentNode.host;if(u.has($))break;u.add($),l.push($),h=$;continue}if(!Zt(h.parentNode)||u.has(h.parentNode))break;u.add(h.parentNode),l.push(h.parentNode),h=h.parentNode}const d=t.type==="click"&&e.namespaceURI==="http://www.w3.org/2000/svg"?l.findIndex($=>ct($,"button")||ct($,"a")):-1;d>0&&(n=n||l.slice(0,d+1).some($=>!jn($)||rs($)));const p=[],f={};let v,m=!1,_=!1;if(Ce(l,$=>{const M=jn($);if(ct($,"a")&&!r&&!i?.includes("href")){const L=$.getAttribute("href");m=!!(M&&L&&Ui(L))&&(o?Ur(L):L)}ue(Yn($),"ph-no-capture")&&(_=!0),p.push((function(L,q,X,ee,k=!1){const ie=L.tagName.toLowerCase(),H={tag_name:ie};xu.indexOf(ie)>-1&&!X&&(H.$el_text=ie.toLowerCase()==="a"||ie.toLowerCase()==="button"?cc(1024,Fh(L)):cc(1024,ts(L)));const oe=Yn(L);q||ee!=null&&ee.includes("class")||0>=oe.length||(H.classes=oe.filter(function(V){return V!==""})),Ce(L.attributes,function(V){var K;if((!rs(L)||["name","id","class","aria-label"].indexOf(V.name)!==-1)&&!ee?.includes(V.name)&&!q&&Ui(V.value)&&(!ye(K=V.name)||K.substring(0,10)!=="_ngcontent"&&K.substring(0,7)!=="_nghost")){let le=V.value;V.name==="class"&&(le=Ou(le).join(" ")),H["attr__"+V.name]=cc(1024,V.name==="href"&&k?Ur(le):le)}});let I=1,Q=1,y=L;for(;y=UP(y);)I++,y.tagName===L.tagName&&Q++;return H.nth_child=I,H.nth_of_type=Q,H})($,r,n,i,o)),Ce((function(L){if(!jn(L))return{};const q={};return Ce(L.attributes,function(X){if(X.name&&X.name.indexOf("data-ph-capture-attribute")===0){const ee=X.name.replace("data-ph-capture-attribute-",""),k=X.value;ee&&k&&Ui(k)&&(q[ee]=k)}}),q})($),(L,q)=>{({}).hasOwnProperty.call(f,q)||(f[q]=L)})}),_)return{props:{},explicitNoCapture:_};if(d>0&&(e=l[d],p.splice(0,d)),n||(p[0].$el_text=ct(e,"a")||ct(e,"button")?Fh(e):ts(e)),m){var w,S;p[0].attr__href=m;const $=(w=Fr(m))===null||w===void 0?void 0:w.host,M=A==null||(S=A.location)===null||S===void 0?void 0:S.host;$&&M&&$!==M&&(v=m)}return{props:Le((C=t.type,{$event_type:C,$ce_version:1}),s?{}:{$elements:p},{$elements_chain:(T=p,ce(T)?(function($){return $.map(M=>{var L,q;let X="";if(M.tag_name&&(X+=M.tag_name),M.attr_class){M.attr_class.sort();for(const ie of M.attr_class)X+=`.${ie.replace(/"/g,"")}`}const ee=b(b(b(b({},M.text?{text:M.text}:{}),{},{"nth-child":(L=M.nth_child)!==null&&L!==void 0?L:0,"nth-of-type":(q=M.nth_of_type)!==null&&q!==void 0?q:0},M.href?{href:M.href}:{}),M.attr_id?{attr_id:M.attr_id}:{}),M.attributes),k={};return Ys(ee).sort(([ie],[H])=>(function(oe,I){return I>oe?-1:oe>I?1:0})(ie,H)).forEach(([ie,H])=>k[qh(ie.toString())]=qh(H.toString())),X+=":",X+=Ys(k).map(([ie,H])=>`${ie}="${H}"`).join(""),X}).join(";")})((function($){return $.map(M=>{var L,q;const X={text:(L=M.$el_text)===null||L===void 0?void 0:L.slice(0,400),tag_name:M.tag_name,href:(q=M.attr__href)===null||q===void 0?void 0:q.slice(0,2048),attr_class:W$(M),attr_id:M.attr__id,nth_child:M.nth_child,nth_of_type:M.nth_of_type,attributes:{}};return Ys(M).filter(([ee])=>ee.indexOf("attr__")===0).forEach(([ee,k])=>X.attributes[ee]=k),X})})(T)):"")},!((a=p[0])===null||a===void 0)&&a.$el_text?{$el_text:(c=p[0])===null||c===void 0?void 0:c.$el_text}:{},v&&t.type==="click"?{$external_click_url:v}:{},f),target:e};var T,C}var qP=class{fo(){this.po=void 0,clearTimeout(this.mo),this.mo=void 0}yo(e){var t;if(!jn(e))return!0;const r=(t=this.bo().css_selector_ignorelist)!==null&&t!==void 0?t:Za,n=new Set;let i=e;for(;i;){if(n.size>=1e3||n.has(i))return!0;n.add(i);const s=i,o=Yn(s);if(ue(o,"ph-no-capture")||ue(o,"ph-sensitive")||rs(s)||r.some(c=>vl(s,c)))return!0;const a=i.parentNode;i=Pu(a)?a.host:a&&Zt(a)?a:null}return!1}_o(e){if(!this.isEnabled||e.type==="pointercancel")return void this.fo();if(e.type==="pointerdown"){this.fo();const n=zi(e);var t;e.isPrimary&&e.button===0&&!e.ctrlKey&&n&&Zt(n)&&(this.po={target:n,excluded:this.yo(n),id:e.pointerId,x:e.clientX,y:e.clientY,released:!1,distinctId:(t=this.wo)===null||t===void 0?void 0:t.distinctId});return}const r=this.po;r&&(e.pointerId!==r.id||Math.abs(e.clientX-r.x)>5||Math.abs(e.clientY-r.y)>5?this.fo():e.type==="pointerup"&&(r.released=!0,this.mo=setTimeout(()=>this.fo(),0)))}ko(e){var t;const r=this.po;this.fo();const n=zi(e);if(r?.released&&r.target.isConnected&&r.distinctId===((t=this.wo)===null||t===void 0?void 0:t.distinctId)&&e.pointerId===r.id&&(e.detail>0||e.pointerType==="touch"||e.pointerType==="pen")&&e.button===0&&5>=Math.abs(e.clientX-r.x)&&5>=Math.abs(e.clientY-r.y)&&n&&(ct(n,"html")||ct(n,"body"))){var i;if(r.excluded)return null;const s=(i=this.bo().css_selector_ignorelist)!==null&&i!==void 0?i:Za;return[n,N?.documentElement,N?.body].some(o=>{if(!o)return!1;const a=Yn(o);return ue(a,"ph-no-capture")||ue(a,"ph-sensitive")||!jn(o)||rs(o)||s.some(c=>vl(o,c))})?null:r.target}}constructor(e){this.So=e,this.name="autocapture",this.xo=!1,this.Co=null,this.$o=!1,this.To=!1,this.Rr={enabled:!1,rageclick:!1,maskAllElementAttributes:!1,maskAllText:!1,disableCaptureUrlHashes:!1,remoteRequestsDisabled:!1},this.Io=!1,this.So.refresh(this.Rr),this.rageclicks=new k_(this.Rr.rageclick),this.Mo=null}setup(e){this.Eo(),this.wo=e;const t=e.onRemoteConfig(this.onRemoteConfig.bind(this));this.Io?t.dispose():(this.Po=t,this.startIfEnabled())}dispose(){var e;this.Io||(this.Io=!0,this.wo=void 0,(e=this.Po)===null||e===void 0||e.dispose(),this.Po=void 0,this.Ro())}bo(){return this.So.refresh(this.Rr),this.Rr}Eo(){var e,t;return this.bo(),this.Rr.url_allowlist=(e=this.Rr.url_allowlist)===null||e===void 0?void 0:e.map(r=>new RegExp(r)),this.Rr.url_ignorelist=(t=this.Rr.url_ignorelist)===null||t===void 0?void 0:t.map(r=>new RegExp(r)),this.Rr}Ao(){if(!this.isBrowserSupported())return void ac.info("Disabling Automatic Event Collection because this browser is not supported");if(!A||!N)return;const e=this.Fo=t=>{t=t||A?.event;try{if(t.type==="blur")return void this.fo();if(t.type.indexOf("pointer")===0)return void this._o(t);const r=t.type==="click"?this.ko(t):void 0;if(He(r))return;this.Oo(t,"$autocapture",r)}catch(r){ac.error("Failed to capture event",r)}};if(Ie(A,"blur",e),Ie(N,"submit",e,{capture:!0}),Ie(N,"change",e,{capture:!0}),Ie(N,"click",e,{capture:!0}),Ce(["pointerdown","pointermove","pointerup","pointercancel"],t=>{Ie(N,t,e,{capture:!0})}),this.bo().capture_copied_text){const t=this.Do=r=>{r=r||A?.event;try{this.Oo(r,oc)}catch(n){ac.error("Failed to capture clipboard event",n)}};Ie(N,"copy",t,{capture:!0}),Ie(N,"cut",t,{capture:!0}),Ie(N,"paste",t,{capture:!0})}}Ro(){this.fo(),this.Fo&&(A?.removeEventListener("blur",this.Fo),Ce(["pointerdown","pointermove","pointerup","pointercancel"],e=>{N?.removeEventListener(e,this.Fo,!0)}),N?.removeEventListener("submit",this.Fo,!0),N?.removeEventListener("change",this.Fo,!0),N?.removeEventListener("click",this.Fo,!0),this.Fo=void 0),this.Do&&(N?.removeEventListener("copy",this.Do,!0),N?.removeEventListener("cut",this.Do,!0),N?.removeEventListener("paste",this.Do,!0),this.Do=void 0),this.xo=!1}startIfEnabled(){this.isEnabled||this.fo(),!this.Io&&this.wo&&this.isEnabled&&!this.xo&&(this.Ao(),this.xo=!0)}onRemoteConfig(e){if(this.Io)return;if(this.$o=!0,!e.ok)return void this.startIfEnabled();const t=e.config;t.elementsChainAsString&&(this.To=t.elementsChainAsString);const r=t.autocapture_opt_out;var n;vt(r)&&((n=this.wo)===null||n===void 0||n.kv.set("$autocapture_disabled_server_side",r),this.Co=r),this.startIfEnabled()}setElementSelectors(e){this.Mo=e}getElementSelectors(e,t){var r;const n=[];return(r=this.Mo)===null||r===void 0||r.forEach(i=>{N?.querySelectorAll(i)?.forEach(s=>{e!==s&&t!==s||ue(n,i)||n.push(i)})}),n}get isEnabled(){var e,t;if(this.Io)return!1;const r=(e=this.wo)===null||e===void 0?void 0:e.kv.get(pm),n=this.Co,i=this.bo();if(!i.remoteRequestsDisabled&&!this.$o)return!1;const s=i.remoteRequestsDisabled&&!this.$o;if(He(n)&&!vt(r)&&!s)return!1;const o=(t=this.Co)!==null&&t!==void 0?t:!!r;return!!i.enabled&&!o}Oo(e,t="$autocapture",r){if(!this.isEnabled)return void this.fo();let n=r||zi(e);Lm(n)&&(n=n.parentNode||null);const i=this.Eo();var s;t==="$autocapture"&&e.type==="click"&&e instanceof MouseEvent&&i.rageclick&&(s=this.rageclicks)!==null&&s!==void 0&&s.isRageClick(e.clientX,e.clientY,e.timeStamp||new Date().getTime())&&Um(n,i.rageclick)&&this.Oo(e,"$rageclick",r);const o=t===oc,a=o?b(b({},i),{},{dom_event_allowlist:void 0}):i;if(n&&(function(h,d,p,f,v,m){var _;if(!A||Mu(h)||p?.url_allowlist&&!xh(p.url_allowlist,m)||p?.url_ignorelist&&xh(p.url_ignorelist,m))return!1;if(p?.dom_event_allowlist){const C=p.dom_event_allowlist;if(C&&!C.some($=>d.type===$))return!1}const{parentIsUsefulElement:w,targetElementList:S}=Fm(h,f);if(!(function(C,$){const M=$?.element_allowlist;if(O(M))return!0;for(const L of C)if(M.some(q=>L.tagName.toLowerCase()===q))return!0;return!1})(S,p)||!gl(S,p?.css_selector_allowlist)||gl(S,(_=p?.css_selector_ignorelist)!==null&&_!==void 0?_:Za))return!1;try{const C=A.getComputedStyle(h);if(C&&C.getPropertyValue("cursor")==="pointer"&&d.type==="click")return!0}catch{}const T=h.tagName.toLowerCase();switch(T){case"html":return!1;case"form":return(v||["submit"]).indexOf(d.type)>=0;case"input":case"select":case"textarea":return(v||["change","click"]).indexOf(d.type)>=0;default:return w?(v||["click"]).indexOf(d.type)>=0:(v||["click"]).indexOf(d.type)>=0&&(xu.indexOf(T)>-1||h.getAttribute("contenteditable")==="true")}})(n,e,a,o,o?["copy","cut","paste"]:void 0,{config:{get_current_url:i.getCurrentUrl}})){var c;const{props:h,explicitNoCapture:d,target:p}=FP(n,{e,maskAllElementAttributes:i.maskAllElementAttributes,maskAllText:i.maskAllText,elementAttributeIgnoreList:i.element_attribute_ignorelist,elementsChainAsString:this.To,disableCaptureUrlHashes:i.disableCaptureUrlHashes});if(d)return!1;const f=this.getElementSelectors(n,p);if(f&&f.length>0&&(h.$element_selectors=f),t===oc){const v=e.type||"clipboard";if(v!=="paste"){var l,u;const m=A==null||(l=A.getSelection())===null||l===void 0?void 0:l.toString(),_=Dm(m);if(!_)return!1;h.$selected_content=_,h.$clipboard_text_length=(u=m?.length)!==null&&u!==void 0?u:0}h.$copy_type=v}return(c=this.wo)===null||c===void 0||c.capture(t,h),!0}}isBrowserSupported(){return tt(N?.querySelectorAll)}},jP=class{constructor(e){this._instance=e}refresh(e){const t=this._instance.config,r=be(t.autocapture)?t.autocapture:void 0;e.enabled=!!t.autocapture,e.rageclick=t.rageclick,e.maskAllElementAttributes=t.mask_all_element_attributes,e.maskAllText=t.mask_all_text,e.disableCaptureUrlHashes=t.disable_capture_url_hashes,e.getCurrentUrl=t.get_current_url,e.remoteRequestsDisabled=this._instance.nl(),e.url_allowlist=r?.url_allowlist,e.url_ignorelist=r?.url_ignorelist,e.dom_event_allowlist=r?.dom_event_allowlist,e.element_allowlist=r?.element_allowlist,e.css_selector_allowlist=r?.css_selector_allowlist,e.css_selector_ignorelist=r?.css_selector_ignorelist,e.element_attribute_ignorelist=r?.element_attribute_ignorelist,e.capture_copied_text=r?.capture_copied_text}},ki=Be("[ExceptionAutocapture]"),up=()=>{},dp=e=>{var t;if(tt(e))return(t=e.__posthog_layer__)!==null&&t!==void 0?t:e.__rrweb_layer__};function ss(e,t,r){try{if(!(t in e))return up;const n={next:e[t]},i=r(function(...s){return n.next.apply(this,s)});return tt(i)&&(i.prototype=i.prototype||{},Object.defineProperties(i,{__posthog_wrapped__:{enumerable:!1,value:!0},__posthog_layer__:{enumerable:!1,value:n}})),e[t]=i,()=>{if(e[t]===i)return void(e[t]=n.next);let s=e[t],o=dp(s);for(;o;){if(o.next===i)return void(o.next=n.next);s=o.next,o=dp(s)}}}catch{return up}}var HP=Be("[TracingHeaders]"),Wr=Be("[Web Vitals]"),hp=9e5,pp=["CLS","FCP","INP","LCP"],VP=["INP","LCP"],BP=["interactionTarget","interactionType","inputDelay","processingDuration","presentationDelay","loadState","target","url","timeToFirstByte","resourceLoadDelay","resourceLoadDuration","elementRenderDelay","largestShiftTarget","largestShiftTime","largestShiftValue","firstByteToFCP"],lc="disabled",fp="lazy_loading",Xt=Be("[SessionRecording]"),GP=Be("[Heatmaps]");function uc(e){return be(e)&&"clientX"in e&&"clientY"in e&&We(e.clientX)&&We(e.clientY)}var xs=Be("[Product Tours]"),dc=e=>{var t;return!e.config.disable_product_tours&&!!(!((t=e.persistence)===null||t===void 0)&&t.get_property(Au))},WP=["$set_once","$set"],Ft=Be("[SiteApps]"),vp="Error while initializing PostHog app with config id ",R_=(e,t)=>e?.then?e.then(t):t(e),kn="SDK is not enabled or survey functionality is not yet loaded",gp="Disabled. Not loading surveys.",ZP=class{constructor(e,t){this.So=e,this.Th=t,this.name="surveys",this._surveyEventReceiver=null,this._surveyManager=null,this.Ih=!1,this.Mh=[],this.Eh=null,this.Ph=null,this.Io=!1,this.Rh=new Set,this.onRemoteConfig=r=>{if(this.Io||this.Rr.disableSurveys)return;if(!r.ok)return Te.warn("Remote config unavailable. Not loading surveys.");const n=r.config.surveys;if(ge(n))return Te.warn("Flags not loaded yet. Not loading surveys.");this.Ah=vt(n)?n:n.length>0,Te.info(`flags response received, isSurveysEnabled: ${this.Ah}`),this.loadIfEnabled()}}setup(e){if(!this.Io)return this.Fh=e,R_(e.kv.initialize(),()=>{if(this.Fh!==e||this.Io)return;this.Fh=void 0,this.wo=e;const t=e.onRemoteConfig(this.onRemoteConfig);this.Io?t.dispose():(this.Po=t,this.loadIfEnabled())})}dispose(){var e,t,r,n;this.Io||(this.Io=!0,this.Fh=void 0,this.wo=void 0,(e=this.Po)===null||e===void 0||e.dispose(),this.Po=void 0,(t=this._surveyEventReceiver)===null||t===void 0||t.dispose(),this._surveyEventReceiver=null,(r=this._surveyManager)===null||r===void 0||(n=r.dispose)===null||n===void 0||n.call(r),this._surveyManager=null,this.Mh=[],this.Eh=null,this.Rh.forEach(i=>clearTimeout(i)),this.Rh.clear())}get Rr(){return this.So.get()}initialize(){this.loadIfEnabled()}reset(){var e,t;(e=this._surveyManager)===null||e===void 0||(t=e.clearInMemoryInProgressSurveyState)===null||t===void 0||t.call(e);try{var r;(r=this._surveyEventReceiver)===null||r===void 0||r.reset(),localStorage.removeItem("lastSeenSurveyDate");const n=[];for(let i=0;i<localStorage.length;i++){const s=localStorage.key(i);(s!=null&&s.startsWith("seenSurvey_")||s!=null&&s.startsWith("inProgressSurvey_"))&&n.push(s)}n.forEach(i=>localStorage.removeItem(i))}catch{}}loadIfEnabled(){if(this.Io||!this.wo)return;const e=this.Rr;if(this._surveyManager)return;if(this.Ih)return void Te.info("Already initializing surveys, skipping...");if(e.disableSurveys)return void Te.info(gp);if(e.cookielessMode&&this.So.isOptedOut())return void Te.info("Not loading surveys in cookieless mode without consent.");const t=this.So.getExtensions();if(!t)return void Te.error("PostHog Extensions not found.");if(O(this.Ah)&&!e.advancedEnableSurveys)return;const r=this.Ah||e.advancedEnableSurveys;this.Ih=!0;try{const n=t.generateSurveys;if(n)return this.Oh(n,r),void(this.Ih=!1);const i=t.loadExternalDependency;if(!i)return this.Dh(Tu),void(this.Ih=!1);i(s=>{try{if(this.Io)return;const o=this.So.getExtensions();s||!o?.generateSurveys?this.Dh("Could not load surveys script",s):this.Oh(o.generateSurveys,r)}finally{this.Ih=!1}})}catch(n){throw this.Ih=!1,this.Dh("Error initializing surveys",n),n}}Oh(e,t){this.Io||(this._surveyManager=e(t),this._surveyEventReceiver=this.So.createEventReceiver(),Te.info("Surveys loaded successfully"),this.Lh({isLoaded:!0}))}Dh(e,t){Te.error(e,t),this.Lh({isLoaded:!1,error:e})}onSurveysLoaded(e){return this.Mh.push(e),this._surveyManager&&this.Lh({isLoaded:!0}),()=>{this.Mh=this.Mh.filter(t=>t!==e)}}getSurveys(e,t=!1){var r;const n=(r=this.wo)!==null&&r!==void 0?r:this.Th;if(!n||this.Io)return;if(this.Rr.disableSurveys)return Te.info(gp),e([]);const i=n.kv.get(ll);if(i&&!t)return e(i,{isLoaded:!0}),void(this.Nh()&&this.getSurveys(()=>{},!0));if(this.Eh)return void this.Eh.then(({surveys:a,context:c})=>{this.Io||e(a,c)}).catch(a=>Te.error("Error in survey callback",a));const s=this.qh("/api/surveys/",{method:"GET",query:{token:n.projectToken},sentAt:"query",timeoutMs:this.Rr.requestTimeoutMs}).then(a=>{try{return this.jh(n,a)}catch(c){return Te.error("Error processing surveys response",c),this.jh(n,{statusCode:0,error:c})}},a=>this.jh(n,{statusCode:0,error:a}));this.Eh=s;const o=()=>{this.Eh===s&&(this.Eh=null)};s.then(a=>{o(),this.Io||e(a.surveys,a.context)},o).catch(a=>Te.error("Error in survey callback",a))}qh(e,t){const r=this.wo;return r?r.sendRequest(e,t):new Promise(n=>n({statusCode:0,error:new Error(kn)}))}jh(e,t){if(this.Io)return{surveys:[],context:{isLoaded:!1,error:kn}};const r=t.statusCode;if(r!==200||!t.json){const o=`Surveys API could not be loaded, status: ${r}`;return r!==0?Te.error(o):t.error||Te.warn(o),this.Ph=Date.now(),{surveys:[],context:{isLoaded:!1,error:o}}}this.Ph=null;const n=t.json.surveys||[],i=n.filter(o=>(function(a){return!(!a.start_date||a.end_date)})(o)&&(y_(o)||(function(a){var c;return!!(!((c=a.conditions)===null||c===void 0||(c=c.actions)===null||c===void 0||(c=c.values)===null||c===void 0)&&c.length)})(o)));var s;return i.length>0&&((s=this._surveyEventReceiver)===null||s===void 0||s.register(i)),e.kv.set({[ll]:n,[Eo]:Date.now()}),{surveys:n,context:{isLoaded:!0}}}Nh(){return this.Bh()&&!this.Eh&&!this.Hh()}Bh(){var e,t;const r=(e=(t=this.wo)!==null&&t!==void 0?t:this.Th)===null||e===void 0?void 0:e.kv.get(Eo);return We(r)&&Date.now()-r>3e5}Hh(){return We(this.Ph)&&3e5>Date.now()-this.Ph}markSurveyAsSeen(e,t){var r;const n={id:e,current_iteration:(r=t?.iteration)!==null&&r!==void 0?r:null};S_(n);try{localStorage.setItem("lastSeenSurveyDate",new Date().toISOString())}catch{}}Lh(e){for(const t of this.Mh)try{if(!e.isLoaded)return t([],e);this.getSurveys(t)}catch(r){Te.error("Error in survey callback",r)}}getActiveMatchingSurveys(e,t=!1){if(!ge(this._surveyManager))return this._surveyManager.getActiveMatchingSurveys(e,t);Te.warn("init was not called")}zh(e){let t=null;return this.getSurveys(r=>{var n;t=(n=r.find(i=>i.id===e))!==null&&n!==void 0?n:null}),t}Uh(e){if(ge(this._surveyManager))return{eligible:!1,reason:kn};const t=typeof e=="string"?this.zh(e):e;return t?this._surveyManager.checkSurveyEligibility(t):{eligible:!1,reason:"Survey not found"}}Wh(e){if(!this.So.isCapturing())return{eligible:!1,reason:"PostHog is not capturing, so a survey response cannot be recorded"};if(ge(this._surveyManager))return{eligible:!1,reason:kn};const t=typeof e=="string"?this.zh(e):e;return t?this._surveyManager.checkSurveyRenderability(t):{eligible:!1,reason:"Survey not found"}}canRenderSurvey(e){if(ge(this._surveyManager))return Te.warn("init was not called"),{visible:!1,disabledReason:kn};const t=this.Wh(e);return{visible:t.eligible,disabledReason:t.reason}}canRenderSurveyAsync(e,t){return ge(this._surveyManager)?(Te.warn("init was not called"),Promise.resolve({visible:!1,disabledReason:kn})):new Promise(r=>{this.getSurveys(n=>{var i;const s=(i=n.find(o=>o.id===e))!==null&&i!==void 0?i:null;if(s){const o=this.Wh(s);r({visible:o.eligible,disabledReason:o.reason})}else r({visible:!1,disabledReason:"Survey not found"})},t)})}renderSurvey(e,t,r){var n;if(!this.So.isCapturing())return;if(ge(this._surveyManager))return void Te.warn("init was not called");const i=typeof e=="string"?this.zh(e):e;if(!i?.id)return void Te.warn("Survey not found");if(!AP.includes(i.type))return void Te.warn(`Surveys of type ${i.type} cannot be rendered in the app`);const s=N?.querySelector(t);if(s){if(!((n=i.appearance)===null||n===void 0)&&n.surveyPopupDelaySeconds){Te.info(`Rendering survey ${i.id} with delay of ${i.appearance.surveyPopupDelaySeconds} seconds`);const o=setTimeout(()=>{var a,c;this.Rh.delete(o),!this.Io&&this.So.isCapturing()&&(Te.info(`Rendering survey ${i.id} with delay of ${(a=i.appearance)===null||a===void 0?void 0:a.surveyPopupDelaySeconds} seconds`),(c=this._surveyManager)===null||c===void 0||c.renderSurvey(i,s,r),Te.info(`Survey ${i.id} rendered`))},1e3*i.appearance.surveyPopupDelaySeconds);this.Rh.add(o);return}this._surveyManager.renderSurvey(i,s,r)}else Te.warn("Survey element not found")}displaySurvey(e,t){var r;if(!this.So.isCapturing())return;if(ge(this._surveyManager))return void Te.warn("init was not called");const n=this.zh(e);if(!n)return void Te.warn("Survey not found");let i=n;if((r=n.appearance)!==null&&r!==void 0&&r.surveyPopupDelaySeconds&&t.ignoreDelay&&(i=b(b({},n),{},{appearance:b(b({},n.appearance),{},{surveyPopupDelaySeconds:0})})),t.displayType!==ml.Popover&&t.initialResponses&&Te.warn("initialResponses is only supported for popover surveys. prefill will not be applied."),t.ignoreConditions===!1){const s=this.Uh(n);if(!s.eligible)return void Te.warn("Survey is not eligible to be displayed: ",s.reason)}t.displayType!==ml.Inline?this._surveyManager.handlePopoverSurvey(i,t):this.renderSurvey(i,t.selector,t.properties)}cancelPendingSurvey(e){ge(this._surveyManager)?Te.warn("init was not called"):this._surveyManager.cancelSurvey(e)}handlePageUnload(){var e,t;(e=this._surveyManager)===null||e===void 0||(t=e.handlePageUnload)===null||t===void 0||t.call(e)}};function Rn(e,t,r){if(ge(e))return!1;switch(r){case"exact":return e===t;case"contains":{const n=t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/_/g,".").replace(/%/g,".*");return new RegExp(n,"i").test(e)}case"regex":try{return new RegExp(t).test(e)}catch{return!1}default:return!1}}var JP=class{constructor(e){this._instance=e,this.Vh=new Set,this.Gh=new Set,this.Zh=new Co,this.Qh=(t,r)=>this.Jh(t,r)&&this.Kh(t,r)&&this.Xh(t,r)&&this.Yh(t,r),this.Jh=(t,r)=>!r?.event||t?.event===r?.event}init(){var e,t;O((e=this._instance)===null||e===void 0?void 0:e._addCaptureHook)||(this.tc=(t=this._instance)===null||t===void 0?void 0:t._addCaptureHook((r,n)=>{this.on(r,n)}))}dispose(){var e;(e=this.tc)===null||e===void 0||e.call(this),this.tc=void 0,this.Zh=new Co}register(e){var t,r;if(!O((t=this._instance)===null||t===void 0?void 0:t._addCaptureHook)&&(e.forEach(n=>{var i;this.Vh.add(n),(i=n.steps)===null||i===void 0||i.forEach(s=>{this.Gh.add(s?.event||"")})}),(r=this._instance)===null||r===void 0?void 0:r.autocapture)){const n=new Set;this.Vh.forEach(i=>{var s;(s=i.steps)===null||s===void 0||s.forEach(o=>{o!=null&&o.selector&&n.add(o.selector)})}),this._instance.autocapture.setElementSelectors(n)}}replace(e){this.Vh.clear(),this.Gh.clear(),this.register(e)}on(e,t){t!=null&&e.length!=0&&(this.Gh.has(e)||this.Gh.has(t.event))&&this.Vh.forEach(r=>{this.ec(t,r)&&this.Zh.emit("actionCaptured",r.name)})}nc(e){this.onAction("actionCaptured",t=>e(t))}ec(e,t){if(t?.steps==null)return!1;for(const r of t.steps)if(this.Qh(e,r))return!0;return!1}onAction(e,t){return this.Zh.on(e,t)}Kh(e,t){if(t?.url){var r;const n=e==null||(r=e.properties)===null||r===void 0?void 0:r.$current_url;if(!n||typeof n!="string"||!Rn(n,t.url,t.url_matching||"contains"))return!1}return!0}Xh(e,t){return!!this.sc(e,t)&&!!this.rc(e,t)&&!!this.oc(e,t)}sc(e,t){var r;if(!t?.href)return!0;const n=this.ac(e);if(n.length>0)return n.some(s=>Rn(s.href,t.href,t.href_matching||"exact"));const i=(e==null||(r=e.properties)===null||r===void 0?void 0:r.$elements_chain)||"";return!!i&&Rn((function(s){const o=s.match(/(?::|")href="(.*?)"/);return o?o[1]:""})(i),t.href,t.href_matching||"exact")}rc(e,t){var r;if(!t?.text)return!0;const n=this.ac(e);if(n.length>0)return n.some(c=>Rn(c.text,t.text,t.text_matching||"exact")||Rn(c.$el_text,t.text,t.text_matching||"exact"));const i=(e==null||(r=e.properties)===null||r===void 0?void 0:r.$elements_chain)||"";return!!i&&(s=(function(c){const l=[],u=/(?::|")text="(.*?)"/g;let h;for(;!ge(h=u.exec(c));)l.includes(h[1])||l.push(h[1]);return l})(i),o=t.text,a=t.text_matching||"exact",s.some(c=>Rn(c,o,a)));var s,o,a}oc(e,t){var r,n;if(!t?.selector)return!0;const i=e==null||(r=e.properties)===null||r===void 0?void 0:r.$element_selectors;if(i?.includes(t.selector))return!0;const s=(e==null||(n=e.properties)===null||n===void 0?void 0:n.$elements_chain)||"";if(t.selector_regex&&s)try{return new RegExp(t.selector_regex).test(s)}catch{return!1}return!1}ac(e){var t;return(e==null||(t=e.properties)===null||t===void 0?void 0:t.$elements)==null?[]:e?.properties.$elements}Yh(e,t){return!t?.properties||t.properties.length===0||w_(t.properties.reduce((r,n)=>{const i=ce(n.value)?n.value.map(String):n.value!=null?[String(n.value)]:[];return r[n.key]={values:i,operator:n.operator||"exact"},r},{}),e?.properties)}},KP=class{constructor(e){var t,r;this.lc=[],this._instance=e,this.uc=new Map,this.hc=new Map,this.cc=new Map,this.dc=(t=this._instance)===null||t===void 0||(r=t.onSessionId)===null||r===void 0?void 0:r.call(t,n=>this.vc(n))}fc(e){return!1}gc(){return null}mc(e){}yc(){}bc(e,t){return!!e&&w_(e.propertyFilters,t?.properties)}_c(e,t){const r=new Map;return e.forEach(n=>{var i;(i=n.conditions)===null||i===void 0||(i=i[t])===null||i===void 0||(i=i.values)===null||i===void 0||i.forEach(s=>{if(s?.name){const o=r.get(s.name)||[];o.push(n.id),r.set(s.name,o)}})}),r}wc(e,t,r){const n=(r===bi.Activation?this.uc:this.hc).get(e);let i=[];return this.kc(s=>{i=s.filter(o=>n?.includes(o.id))}),i.filter(s=>{var o;const a=(o=s.conditions)===null||o===void 0||(o=o[r])===null||o===void 0||(o=o.values)===null||o===void 0?void 0:o.find(c=>c.name===e);return this.bc(a,t)})}register(e){this.Sc(e,!1)}replace(e){this.Sc(e,!0)}Sc(e,t){var r;O((r=this._instance)===null||r===void 0?void 0:r._addCaptureHook)||(this.xc(e,t),this.Cc(e,t))}Cc(e,t){const r=e.filter(s=>{var o;return(o=s.conditions)===null||o===void 0||(o=o.actions)===null||o===void 0||(o=o.values)===null||o===void 0?void 0:o.length});var n;if(t&&this.cc.clear(),r.length===0)return void(t&&((n=this.$c)===null||n===void 0||n.replace([])));this.$c||(this.$c=new JP(this._instance),this.$c.init(),this.$c.nc(s=>this.onAction(s)));const i=[];r.forEach(s=>{var o;(o=s.conditions)===null||o===void 0||(o=o.actions)===null||o===void 0||o.values.forEach(a=>{if(i.push(a),a.name){var c;const l=(c=this.cc.get(a.name))!==null&&c!==void 0?c:[];l.includes(s.id)||l.push(s.id),this.cc.set(a.name,l)}})}),t?this.$c.replace(i):this.$c.register(i)}Tc(e,t){t.forEach((r,n)=>{var i;const s=(i=e.get(n))!==null&&i!==void 0?i:[];r.forEach(o=>{s.includes(o)||s.push(o)}),e.set(n,s)})}xc(e,t){var r,n;const i=e.filter(c=>{var l,u;return((l=c.conditions)===null||l===void 0?void 0:l.events)&&((u=c.conditions)===null||u===void 0||(u=u.events)===null||u===void 0||(u=u.values)===null||u===void 0?void 0:u.length)>0}),s=e.filter(c=>{var l,u;return((l=c.conditions)===null||l===void 0?void 0:l.cancelEvents)&&((u=c.conditions)===null||u===void 0||(u=u.cancelEvents)===null||u===void 0||(u=u.values)===null||u===void 0?void 0:u.length)>0}),o=this._c(e,bi.Activation),a=this._c(e,bi.Cancellation);t?(this.uc=o,this.hc=a):(this.Tc(this.uc,o),this.Tc(this.hc,a)),(i.length!==0||s.length!==0)&&((r=this.tc)!==null&&r!==void 0||(this.tc=(n=this._instance)===null||n===void 0?void 0:n._addCaptureHook((c,l)=>{this.onEvent(c,l)})))}onEvent(e,t){var r,n;const i=this.Ic(),s=(t==null||(r=t.properties)===null||r===void 0?void 0:r.$survey_id)||(t==null||(n=t.properties)===null||n===void 0?void 0:n.$product_tour_id);if(s&&this.getActivatedIds().includes(s)){const a=this.Mc(e,s);if(a==="consume")return i.info("event consumed activated item, removing it",{event:e,itemId:s}),void this.Ec([s]);if(a==="persist")return i.info("shown item promoted to persisted activation",{event:e,itemId:s}),this.Pc(s),void this.Rc([s])}if(this.hc.has(e)){const a=this.wc(e,t,bi.Cancellation);a.length>0&&(i.info("cancel event matched, cancelling items",{event:e,itemsToCancel:a.map(c=>c.id)}),this.Ec(a.map(c=>c.id)),a.forEach(c=>this.Ac(c.id)))}if(!this.uc.has(e))return;i.info("event name matched",{event:e,eventPayload:t,items:this.uc.get(e)});const o=this.wc(e,t,bi.Activation);this.Fc(o.map(a=>a.id))}onAction(e){this.cc.has(e)&&this.Fc(this.cc.get(e)||[])}Fc(e){var t,r;if(e.length===0)return;const n=!!(!((t=this._instance)===null||t===void 0||(r=t.get_session_id)===null||r===void 0)&&r.call(t)),i=[];for(const s of e)n&&this.fc(s)?this.Pc(s)&&this.Oc(s):i.push(s);i.length>0&&(this.lc=[...new Set([...this.lc,...i])]),this.Ic().info("updating activated items",{activatedItems:this.getActivatedIds()})}Pc(e){this.lc=this.lc.filter(r=>r!==e);const t=this.Dc();return!t.includes(e)&&(this.Lc([...t,e]),this.Nc(),!0)}Ec(e){const t=new Set(e);this.lc=this.lc.filter(i=>!t.has(i));const r=this.qc(),n=r.filter(i=>!t.has(i));n.length!==r.length&&(this.Lc(n),n.length===0&&this.jc()),this.Rc(e)}Bc(){var e;const t=this.gc();if(!t)return{};const r=(e=this._instance)===null||e===void 0||(e=e.persistence)===null||e===void 0?void 0:e.props[t];return r&&typeof r=="object"?r:{}}Oc(e){if(!this.gc())return;const t=this.Bc();this.mc(b(b({},t),{},{[e]:Date.now()}))}Rc(e){if(!this.gc())return;const t=this.Bc(),r={};let n=!1;for(const[i,s]of Object.entries(t))e.includes(i)?n=!0:r[i]=s;n&&(_t(r)?this.yc():this.mc(r))}Hc(){this.gc()&&this.yc()}getActivationTimestamp(e){if(!this.Dc().includes(e))return;const t=this.Bc()[e];return We(t)?t:void 0}qc(){var e;const t=this.zc();return((e=this._instance)===null||e===void 0||(e=e.persistence)===null||e===void 0?void 0:e.props[t])||[]}Dc(){var e,t,r;const n=this.qc();if(n.length===0)return[];const i=(e=this._instance)===null||e===void 0||(e=e.persistence)===null||e===void 0?void 0:e.props[this.Uc()],s=(t=this._instance)===null||t===void 0||(r=t.get_session_id)===null||r===void 0?void 0:r.call(t);return s&&i===s?n:[]}Nc(){var e,t;const r=(e=this._instance)===null||e===void 0||(t=e.get_session_id)===null||t===void 0?void 0:t.call(e);r&&this.Wc(r)}jc(){this.Vc()}vc(e){var t;const r=(t=this._instance)===null||t===void 0||(t=t.persistence)===null||t===void 0?void 0:t.props[this.Uc()];if(r&&r!==e){const n=this.qc(),i=this.Bc();n.length>0&&(this.Lc([]),n.filter(s=>We(i[s])).forEach(s=>this.Ac(s))),this.jc(),this.Hc()}}getActivatedIds(){return[...new Set([...this.Dc(),...this.lc])].filter(e=>!this.Gc(e))}dispose(){var e,t,r;(e=this.dc)===null||e===void 0||e.call(this),this.dc=void 0,(t=this.tc)===null||t===void 0||t.call(this),this.tc=void 0,(r=this.$c)===null||r===void 0||r.dispose(),this.$c=void 0}reset(){this.lc=[],this.qc().length>0&&this.Lc([]),this.jc(),this.Hc()}getEventToItemsMap(){return this.uc}Zc(){return this.$c}},YP=class extends KP{constructor(e){super(e)}zc(){return ym}Uc(){return bm}gc(){return wm}mc(e){var t;(t=this._instance)===null||t===void 0||(t=t.persistence)===null||t===void 0||t.register({$surveys_activated_timestamps:e})}yc(){var e;(e=this._instance)===null||e===void 0||(e=e.persistence)===null||e===void 0||e.unregister("$surveys_activated_timestamps")}fc(e){var t;let r;this.kc(i=>{r=i.find(s=>s.id===e)});const n=r==null||(t=r.appearance)===null||t===void 0?void 0:t.surveyPopupDelaySeconds;return We(n)&&n>0}Qc(){return or.SHOWN}kc(e){var t;(t=this._instance)===null||t===void 0||t.getSurveys(e)}Ac(e){var t;(t=this._instance)===null||t===void 0||t.cancelPendingSurvey(e)}Ic(){return Te}Lc(e){var t;(t=this._instance)===null||t===void 0||(t=t.persistence)===null||t===void 0||t.register({$surveys_activated:e})}Wc(e){var t;(t=this._instance)===null||t===void 0||(t=t.persistence)===null||t===void 0||t.register({$surveys_activated_session:e})}Vc(){var e;(e=this._instance)===null||e===void 0||(e=e.persistence)===null||e===void 0||e.unregister("$surveys_activated_session")}Gc(){return!1}Mc(e,t){let r;return this.kc(n=>{r=n.find(i=>i.id===t)}),!r||(function(n){var i;return y_(n)&&!!(!((i=n.conditions)===null||i===void 0||(i=i.events)===null||i===void 0)&&i.repeatedActivation)||n.schedule==="always"})(r)?e===or.SHOWN?"consume":"ignore":e===or.SHOWN?"persist":e===or.DISMISSED||e===or.SENT?"consume":"ignore"}getSurveys(){return this.getActivatedIds()}getEventToSurveys(){return this.getEventToItemsMap()}},XP=class{constructor(e){this._instance=e}initialize(){}get(e){if(typeof e=="string")return this._instance.get_property(e);const t={};for(const r of e){const n=this._instance.get_property(r);O(n)||(t[r]=n)}return t}set(e,t){this._instance.register(typeof e=="string"?{[e]:t}:e)}remove(e){typeof e!="string"?e.forEach(t=>this._instance.unregister(t)):this._instance.unregister(e)}},QP=class{constructor(e){this._instance=e}get(){const e=this._instance.config;return{disableSurveys:e.disable_surveys,cookielessMode:!!e.cookieless_mode,advancedEnableSurveys:e.advanced_enable_surveys,requestTimeoutMs:e.surveys_request_timeout_ms}}isOptedOut(){return this._instance.consent.isOptedOut()}isCapturing(){return this._instance.is_capturing()}getExtensions(){const e=te?.__PosthogExtensions__;if(!e)return;const{generateSurveys:t,loadExternalDependency:r}=e;return{generateSurveys:t?n=>t(this._instance,n):void 0,loadExternalDependency:r?n=>r(this._instance,"surveys",n):void 0}}createEventReceiver(){return new YP(this._instance)}},eO=A?.location?Ao(A.location.hash,"__posthog")||Ao(location.hash,"state"):null,mp="_postHogToolbarParams",_p=Be("[Toolbar]"),yp=Be("[FeatureFlags]"),tO=class{constructor(e,t=!1){this.Jc=!1,this.update(e,t)}update(e,t){this.Kc=((r,n)=>{var i,s,o,a,c,l,u,h;return{bootstrap:{featureFlags:(i=(s=r.bootstrap)===null||s===void 0?void 0:s.featureFlags)!==null&&i!==void 0?i:void 0,featureFlagPayloads:(o=(a=r.bootstrap)===null||a===void 0?void 0:a.featureFlagPayloads)!==null&&o!==void 0?o:void 0},remoteRequestsDisabled:n,featureFlagsDisabled:!!r.advanced_disable_feature_flags,onlyEvaluateSurveyFeatureFlags:!!r.advanced_only_evaluate_survey_feature_flags,deduplicateCallsPerSession:!!r.advanced_feature_flags_dedup_per_session,cacheTtlMs:r.feature_flag_cache_ttl_ms,refreshIntervalMs:(c=r.remote_config_refresh_interval_ms)!==null&&c!==void 0?c:3e5,idleRefreshBackoff:O(r.remote_config_refresh_interval_ms),requestTimeoutMs:r.feature_flag_request_timeout_ms,requestMaxRetries:Math.max(0,(l=r.feature_flag_request_max_retries)!==null&&l!==void 0?l:1),compression:r.disable_compression?void 0:"best-available",evaluationContexts:(u=(h=r.evaluation_contexts)!==null&&h!==void 0?h:r.evaluation_environments)!==null&&u!==void 0?u:[],flagKeys:ce(r.flag_keys)?r.flag_keys:void 0}})(e,t),!e.evaluation_environments||e.evaluation_contexts||this.Jc||(yp.warn("evaluation_environments is deprecated. Use evaluation_contexts instead. evaluation_environments will be removed in a future version."),this.Jc=!0),O(e.flag_keys)||ce(e.flag_keys)||yp.error("Invalid flag_keys found:",e.flag_keys,"Expected array of non-empty strings")}get(){return this.Kc}},bp=Be("[FeatureFlags]"),Zr=Be("[FeatureFlags]",{debugEnabled:!0}),hc=`" failed. Feature flags didn't load in time.`,rO=[502,504],wp=["click","keydown","wheel","touchstart","pointerdown"],Sp="connection_error",Ep=e=>{const t={};for(let r=0;e.length>r;r++)t[e[r]]=!0;return t},kp=e=>{const t={};for(const[r,n]of Ys(e||{}))n&&(t[r]=n);return t},Rp=e=>ci(e)&&(e.name==="RangeError"&&e.message.indexOf("Maximum call stack size exceeded")===0||e.name==="InternalError"&&e.message==="too much recursion"),$t=Be("[Error tracking]"),El="webkit-masked-url:",nO=[{value:"isolatedAPI.contexts.topHostname",exact:!1},{value:"No response from target",exact:!0}],iO=["chrome-extension://","moz-extension://","safari-extension:","safari-web-extension:",El],sO=["__firefox__","__gCrWeb"],Ap="Refusing to render web experiment since the viewer is a likely bot",oO={icontains:(e,t)=>t.toLowerCase().indexOf(e.toLowerCase())>-1,not_icontains:(e,t)=>t.toLowerCase().indexOf(e.toLowerCase())===-1,regex:(e,t)=>$o(t,e),not_regex:(e,t)=>!$o(t,e),exact:(e,t)=>t===e,is_not:(e,t)=>t!==e},kt=Be("[Conversations]"),Jr="Conversations not available yet.";function Ip(e,t){var r,n,i,s,o,a,c;const l=(r=e?.flushIntervalMs)!==null&&r!==void 0?r:3e3,u=(n=e?.maxBufferSize)!==null&&n!==void 0?n:100,h=t?.consoleCapture?void 0:(i=e?.maxLogsPerInterval)!==null&&i!==void 0?i:1e3,d=O(h)?Math.max(u,2048):Math.max(u,h),p=b(b({},(function(){let f="",v="";try{const m=rt?.userAgent;m&&([f,v]=Vg(m))}catch{}return(function(m,_){const w=(function(S){if(S)return{}.hasOwnProperty.call(wh,S)?wh[S]:S})(m);return b(b({},w?{"os.name":w}:{}),_?{"os.version":_}:{})})(f,v)})()),e?.resourceAttributes);return{serviceName:(s=(o=p?.["service.name"])!==null&&o!==void 0?o:e?.serviceName)!==null&&s!==void 0?s:t?.serviceNameDefault,serviceVersion:(a=p?.["service.version"])!==null&&a!==void 0?a:e?.serviceVersion,environment:(c=p?.["deployment.environment"])!==null&&c!==void 0?c:e?.environment,resourceAttributes:p,beforeSend:e?.beforeSend,flushIntervalMs:l,maxBufferSize:u,maxQueueSize:d,maxBatchRecordsPerPost:100,rateCapWindowMs:l,maxLogsPerInterval:h,backgroundFlushBudgetMs:0,terminationFlushBudgetMs:0}}var aO=["debug","log","warn","error","info"],cO=e=>{for(;e?.__rrweb_original__;)e=e.__rrweb_original__;return e},Tp="console",A_="__posthogHandledLogsRequestError",pc=(e,t)=>{const r=e instanceof Error?e:new Error(t);return r[A_]=!0,r},Cp=e=>!!e&&typeof e=="object"&&e[A_]===!0,Po=Be("[NetworkMetrics]"),Nu=()=>{var e;return!(A==null||(e=A.performance)===null||e===void 0)&&e.now?A.performance.now():Date.now()},lO={"http:":80,"https:":443},uO=new Set(["CONNECT","DELETE","GET","HEAD","OPTIONS","PATCH","POST","PUT","TRACE"]),I_=(e,t)=>{var r;const n=String(t);return{method:String(e).toUpperCase(),url:((r=Fr(n))===null||r===void 0?void 0:r.href)||n}},kl=(e,t,r,n,i,s,o=!1)=>{try{var a,c;const l=i();if(!l)return;const u=r||void 0,h=Nu()-n,d=Fr(t.url);if(d&&d.protocol!=="http:"&&d.protocol!=="https:")return;const p={url:d?.href||t.url,method:t.method},f=tt(l.name)?l.name(p):ye(l.name)?l.name:"http.client.request.duration";if(!f)return;const v=o&&!u?void 0:((_,w)=>_?400>_?void 0:String(_):w?.name||"_OTHER")(u,s),m=b(b(b(b(b({},(_=>{const w=uO.has(_)?_:"_OTHER";return b({"http.request.method":w},w==="_OTHER"&&_!==w?{"http.request.method_original":_}:{})})(p.method)),d?(_=>{return{"server.address":_.hostname.startsWith("[")&&_.hostname.endsWith("]")?_.hostname.slice(1,-1):_.hostname,"server.port":Number(_.port)||lO[_.protocol],"url.scheme":_.protocol.slice(0,-1),"url.template":(w=_.pathname,w.split("/").map(S=>(T=>/^\d+$/.test(T)||T.length>=8&&/^[0-9a-f-]*\d[0-9a-f-]*$/i.test(T))(S)?":id":S).join("/"))};var w})(d):{}),u?{"http.response.status_code":u}:{}),v?{"error.type":v}:{}),(a=l.attributes)===null||a===void 0?void 0:a.call(l,p,{status:u,durationMs:h}));(c=e.metrics)===null||c===void 0||c.histogram(f,h,{unit:"ms",attributes:m})}catch(l){Po.error("Failed to record network metric",l)}},T_=()=>{},dO=(e,t)=>tt(A?.fetch)?ss(A,"fetch",r=>function(...n){const i=Nu(),s=r.apply(this,n);if(!t())return s;try{var o,a,c;const[l,u]=n,h=I_((o=(a=u?.method)!==null&&a!==void 0?a:l?.method)!==null&&o!==void 0?o:"GET",(c=l?.url)!==null&&c!==void 0?c:l);return s.then(d=>(kl(e,h,d?.status,i,t,void 0,!0),d),d=>{throw kl(e,h,void 0,i,t,d),d})}catch(l){return Po.error("Failed to observe fetch",l),s}}):T_,hO=(e,t)=>{var r;const n=A==null||(r=A.XMLHttpRequest)===null||r===void 0?void 0:r.prototype;if(!n)return T_;const i=new WeakMap,s=ss(n,"open",a=>function(...c){try{o_.has(this)||i.set(this,I_(c[0],c[1]))}catch(l){Po.error("Failed to observe XHR open",l)}return a.apply(this,c)}),o=ss(n,"send",a=>function(...c){let l;try{const u=i.get(this);if(u&&t()){const h=Nu();l=()=>{this.removeEventListener("loadend",l),kl(e,u,this.status,h,t)},Ie(this,"loadend",l)}}catch(u){Po.error("Failed to observe XHR send",u)}try{return a.apply(this,c)}catch(u){throw l&&this.removeEventListener("loadend",l),u}});return()=>{s(),o()}},ma={featureFlags:class{constructor(e){this.name="featureFlags",this.Xc=!1,this.featureFlagEventHandlers=[],this.$=bp,this.Yc={},this.td={},this.ed=[],this.nd=!1,this.sd=!1,this.rd=0,this.od=!1,this.ad=!1,this.ld=!1,this.ud=!1,this.hd=0,this.dd=!1,this.an=()=>{const t=this.vd();this.hd=0,t&&this.reloadFeatureFlags()},this.fd=()=>{var t,r;const n=this.pd,i=(t=this.gd)!==null&&t!==void 0?t:n;O(n)||O(i)||this.Rr.remoteRequestsDisabled||!N||N.visibilityState==="hidden"||Date.now()-((r=this.md)!==null&&r!==void 0?r:0)<i||(this.gd=this.dd||!this.Rr.idleRefreshBackoff?n:Math.min(2*i,36e5),this.dd=!1,this.reloadFeatureFlags(),this.yd())},this.bd=()=>{this.dd&&this.gd===this.pd||this._d()},this.ln=()=>{N?.visibilityState==="visible"&&this._d()},"get"in e?this.So=e:(this._instance=e,this.wd=new tO(e.config,e.nl()),this.So=this.wd)}updateConfig(e,t){var r;(r=this.wd)===null||r===void 0||r.update(e,t),this.wo&&this.kd()}setup(e){return this.Fh=e,this.$=e.logger.createLogger("[FeatureFlags]"),R_(e.kv.initialize(),()=>{this.Fh===e&&(this.Fh=void 0,this.wo=e,this.Sd(e))})}Sd(e){var t;if(this.wo===e)return A&&Ie(A,"online",this.an),this.kd(),this.xd=e.registerDynamicEventProperties(()=>this.Cd()?this.Yc:this.td),this.$d=(t=this._instance)===null||t===void 0||(t=t.persistence)===null||t===void 0?void 0:t.onCrossTabFeatureFlagChange(()=>{this.Td(),this.Id(),this.Md()}),this.Id(),this.initialize()}_d(){this.dd=!0,this.gd=this.pd,this.fd()}kd(){const e=this.Rr.refreshIntervalMs,t=!this.Rr.remoteRequestsDisabled&&N&&!O(e)&&e>0?e:void 0;this.Rr.idleRefreshBackoff||(this.gd=t),t!==this.pd&&(this.Ed(),O(t)||(this.pd=t,this.gd=t,this.yd(),N!=null&&N.addEventListener&&(Ie(N,es,this.ln),Dn(wp,r=>{Ie(N,r,this.bd,{capture:!0})}))))}yd(){O(this.pd)||(O(this.Pd)||clearInterval(this.Pd),this.md=Date.now(),this.Pd=setInterval(this.fd,this.pd))}Ed(){var e;O(this.Pd)||(clearInterval(this.Pd),this.Pd=void 0,N==null||(e=N.removeEventListener)===null||e===void 0||e.call(N,"visibilitychange",this.ln),Dn(wp,t=>{var r;N==null||(r=N.removeEventListener)===null||r===void 0||r.call(N,t,this.bd,{capture:!0})})),this.pd=void 0,this.gd=void 0,this.dd=!1,this.md=void 0}destroy(){this.Rd()}dispose(){this.Rd()}Rd(){var e,t;this.Ed(),this.rd++,this.ad=!1,this.Fh=void 0,this.wo&&(this.Ad(),(e=this.xd)===null||e===void 0||e.dispose(),this.xd=void 0,(t=this.$d)===null||t===void 0||t.call(this),this.$d=void 0,this.ed=[],A?.removeEventListener("online",this.an),this.wo=void 0)}get Rr(){return this.So.get()}Fd(e){var t;return this.Od&&e in this.Od?this.Od[e]:(t=this.wo)===null||t===void 0?void 0:t.kv.get(e)}Td(){return!!this.Od&&(this.Od=void 0,!0)}Dd(){var e;return!O((e=this.wo)===null||e===void 0?void 0:e.kv.get("$enabled_feature_flags"))&&this.Td()}At(e){this.Ld(()=>{var t;return(t=this.wo)===null||t===void 0?void 0:t.kv.set(e)})}Nd(e,t,r){var n;if(!(!((n=this._instance)===null||n===void 0)&&n.persistence)||!e.$enabled_feature_flags)return;const i=this.Fd("$enabled_feature_flags")||{},s=e.$enabled_feature_flags||{},o=t.flags||t.featureFlags,a=t.flags?Object.entries(t.flags).filter(([,_])=>!_?.failed).map(([_])=>_):[],c=!!t.errorsWhileComputingFlags&&!!t.flags,l=c?a:r&&!ce(o)?Object.keys(o||{}):Array.from(new Set([...Object.keys(i),...Object.keys(s)])),u=this.Fd("$feature_flag_payloads")||{},h=e.$feature_flag_payloads||{},d=c||r?l:Array.from(new Set([...Object.keys(u),...Object.keys(h)])),p=!c&&!r,f=!!p||l,v=!!p||d,m={[ir]:f,[Mt]:f,[wr]:v};e.$feature_flag_details&&(m[ln]=f);for(const _ of[un,Cr,Di])O(e[_])||(m[_]=!0);this._instance.persistence.markCrossTabFeatureFlagChanges(m)}Lt(e){this.Ld(()=>{var t;return(t=this.wo)===null||t===void 0?void 0:t.kv.remove(e)})}Ld(e){try{e()}catch(t){this.$.error("Failed to update feature flag persistence",t)}}Id(){const e={};for(const n of[ir,wr,un,qt]){const i=this.Fd(n);O(i)||(e[n]=i)}this.Yc=e;const t=b({},e),r=this.Fd(Mt);if(r)for(const[n,i]of Object.entries(r))t[`$feature/${n}`]=i;this.td=t}Cd(){const e=this.Rr.cacheTtlMs;if(!e||0>=e)return!1;const t=this.Fd(Cr);return typeof t!="number"||Date.now()-t>e}qd(){return!!this.Cd()&&(this.ud||this.sd||(this.ud=!0,this.$.warn("Feature flag cache is stale, triggering refresh..."),this.reloadFeatureFlags()),!0)}jd(){const e=this.Rr.evaluationContexts;return e?.length?e.filter(t=>{const r=t&&typeof t=="string"&&t.trim().length>0;return r||this.$.error("Invalid evaluation context found:",t,"Expected non-empty string"),r}):[]}Bd(){const e=this.Rr.flagKeys;if(!O(e))return e.filter(t=>{const r=t&&typeof t=="string"&&t.trim().length>0;return r||this.$.error("Invalid flag key found:",t,"Expected non-empty string"),r})}initialize(){var e,t;const r=this.Rr,n=(e=(t=r.bootstrap)===null||t===void 0?void 0:t.featureFlags)!==null&&e!==void 0?e:{};if(Object.keys(n).length){var i,s;const o=(i=(s=r.bootstrap)===null||s===void 0?void 0:s.featureFlagPayloads)!==null&&i!==void 0?i:{},a=Object.keys(n).filter(l=>!O(n[l])).reduce((l,u)=>(l[u]=n[u],l),{}),c=Object.keys(o).filter(l=>a[l]).reduce((l,u)=>(l[u]=o[u],l),{});return this.Hd({featureFlags:a,featureFlagPayloads:c},void 0,{persist:!1})}}updateFlags(e,t,r){var n,i;const s=r?.merge&&(n=this.Fd("$enabled_feature_flags"))!==null&&n!==void 0?n:{},o=r?.merge&&(i=this.Fd("$feature_flag_payloads"))!==null&&i!==void 0?i:{},a=b(b({},s),e),c=b(b({},o),t),l={};for(const[u,h]of Object.entries(a))l[u]={key:u,enabled:gh(h),variant:mh(h),reason:void 0,metadata:O(c?.[u])?void 0:{id:0,version:void 0,description:void 0,payload:c[u]}};this.Hd({flags:l})}get hasLoadedFlags(){return this.nd}getFlags(){return Object.keys(this.getFlagVariants())}getFlagsWithDetails(){const e=this.Fd(ln),t=this.Fd(qt),r=this.Fd(en);if(!r&&!t)return e||{};const n=Le({},e||{}),i=[...new Set([...Object.keys(r||{}),...Object.keys(t||{})])];for(const a of i){var s;const c=n[a],l=t?.[a],u=O(l)?(s=c?.enabled)!==null&&s!==void 0&&s:!!l,h=O(l)?c?.variant:typeof l=="string"?l:void 0,d=r?.[a],p=b(b({},c),{},{enabled:u,variant:u?h??c?.variant:void 0});var o;u!==c?.enabled&&(p.original_enabled=c?.enabled),h!==c?.variant&&(p.original_variant=c?.variant),d&&(p.metadata=b(b({},c?.metadata),{},{payload:d,original_payload:c==null||(o=c.metadata)===null||o===void 0?void 0:o.payload})),n[a]=p}return this.Xc||(this.$.warn(" Overriding feature flag details!",{flagDetails:e,overriddenPayloads:r,finalDetails:n}),this.Xc=!0),n}getAllFeatureFlags(){const e=this.getFlagVariants(),t=this.getFlagPayloads();return Object.keys(e).map(r=>{const n=e[r];return{key:r,enabled:gh(n),variant:mh(n),payload:vh(t[r])}})}getFlagVariants(){const e=this.Fd(Mt),t=this.Fd(qt);if(!t)return e||{};const r=Le({},e||{}),n=Object.keys(t);for(let i=0;n.length>i;i++)r[n[i]]=t[n[i]];return this.Xc||(this.$.warn(" Overriding feature flags!",{enabledFlags:e,overriddenFlags:t,finalFlags:r}),this.Xc=!0),r}getFlagPayloads(){const e=this.Fd(wr),t=this.Fd(en);if(!t)return e||{};const r=Le({},e||{}),n=Object.keys(t);for(let i=0;n.length>i;i++)r[n[i]]=t[n[i]];return this.Xc||(this.$.warn(" Overriding feature flag payloads!",{flagPayloads:e,overriddenPayloads:t,finalPayloads:r}),this.Xc=!0),r}reloadFeatureFlags(){this.od||this.Rr.featureFlagsDisabled||this.vd()||(this.sd&&(this.ad=!0),this.zd||(this.ed.slice().forEach(e=>{try{e()}catch(t){this.$.error("Error while running feature flags reloading callback",t)}}),this.zd=setTimeout(()=>{this.Ud()},5)))}Ad(){clearTimeout(this.zd),this.zd=void 0}onReloading(e){return this.ed.push(e),()=>{this.ed=this.ed.filter(t=>t!==e)}}ensureFlagsLoaded(){this.nd||this.sd||this.zd||this.reloadFeatureFlags()}setAnonymousDistinctId(e){this.$anon_distinct_id=e}setReloadingPaused(e){this.od=e}resetFlagCallReported(){this.Lt(kr)}Ud(e){this.Ad();const t=this.wo;if(!t||this.Rr.remoteRequestsDisabled||this.vd())return;if(this.sd)return void(this.ad=!0);const r={token:t.projectToken,distinct_id:t.distinctId,groups:t.groups,$anon_distinct_id:this.$anon_distinct_id,person_properties:b(b(b({},t.initialPersonProperties),this.Fd("$stored_person_properties")||{}),{},{$lib:t.library.name,$lib_version:t.library.version}),group_properties:this.Fd(Er),timezone:Qm()};O(t.deviceId)||(r.$device_id=t.deviceId),(e!=null&&e.disableFlags||this.Rr.featureFlagsDisabled)&&(r.disable_flags=!0);const n=this.jd();n.length&&(r.evaluation_contexts=n);const i=this.Bd();O(i)||(r.flag_keys=i);const s=this.Rr.onlyEvaluateSurveyFeatureFlags,o="/flags/?v=2"+(s?"&only_evaluate_survey_feature_flags=true":""),a=this.rd;this.sd=!0;const c=()=>{this.ad&&(this.ad=!1,this.Ud())},l=f=>{var v,m;const _=(v=f.json)!==null&&v!==void 0?v:{},w=f.statusCode!==200;if(this.sd=!1,a!==this.rd)return void c();if(this.Wd(f.statusCode),w||this.ad||(this.$anon_distinct_id=void 0),r.disable_flags&&!this.ad)return;this.ld=!w;const S=[];f.error?S.push(f.error instanceof Error&&f.error.name==="AbortError"?"timeout":f.error instanceof Error?Sp:"unknown_error"):f.statusCode!==200&&S.push(`api_error_${f.statusCode}`),_.errorsWhileComputingFlags&&S.push("errors_while_computing_flags");const T=!!(!((m=_.quotaLimited)===null||m===void 0)&&m.includes("feature_flags"));T&&S.push("quota_limited"),this.At({[Qi]:S}),T?this.$.warn("You have hit your feature flags quota limit, and will not be able to load feature flags until the quota is reset. Please visit https://posthog.com/docs/billing/limits-alerts to learn more."):r.disable_flags||this.Hd(_,w,{partialResponse:s}),c()},u=f=>{this.sd=!1,a===this.rd&&(this.At({[Qi]:[Sp]}),this.$.error("Feature flag request failed",f),this.Dd()&&this.Md(!0)),c()};let h=this.Rr.requestMaxRetries;const d=()=>h>0&&a===this.rd,p=()=>{if(a!==this.rd||!this.wo||this.Rr.remoteRequestsDisabled)return this.sd=!1,void c();try{t.sendRequest(o,{target:"flags",method:"POST",body:r,compression:this.Rr.compression,sentAt:"body",timeoutMs:this.Rr.requestTimeoutMs}).then(f=>{if((v=>rO.includes(v.statusCode)||(m=>m.statusCode===0&&m.error instanceof Error&&m.error.name==="AbortError")(v))(f)&&d())return h--,void setTimeout(p,500);l(f)}).catch(u)}catch(f){u(f)}};p()}vd(){return Vm(this.hd,3)}Wd(e){this.hd=Bm(e,this.hd,3,()=>this.$.warn("Feature flag requests are failing before receiving an HTTP response; this can happen due to network issues, CORS, browser blocking, or ad blockers. Stopped refreshing feature flags; will try again when connectivity changes."))}getFeatureFlag(e,t={}){var r;if(t.fresh&&!this.ld)return;if(!(this.nd||this.getFlags()&&this.getFlags().length>0))return void this.$.warn('getFeatureFlag for key "'+e+hc);if(this.qd())return;const n=this.getFeatureFlagResult(e,t);return(r=n?.variant)!==null&&r!==void 0?r:n?.enabled}getFeatureFlagDetails(e){return this.getFlagsWithDetails()[e]}getFeatureFlagPayload(e){const t=this.getFeatureFlagResult(e,{send_event:!1});return t?.payload}getFeatureFlagResult(e,t={}){if(t.fresh&&!this.ld)return;if(!(this.nd||this.getFlags()&&this.getFlags().length>0))return void this.$.warn('getFeatureFlagResult for key "'+e+hc);if(this.qd())return;const r=this.getFlagVariants(),n=e in r,i=r[e],s=this.getFlagPayloads()[e],o=String(i),a=this.Fd("$feature_flag_request_id")||void 0,c=this.Fd("$feature_flag_evaluated_at")||void 0;let l,u=this.Fd("$flag_call_reported")||{};if(this.Rr.deduplicateCallsPerSession){var h;const q=(h=this.wo)===null||h===void 0?void 0:h.session.sessionId,X=this.Fd(Ti);q&&q!==X&&(u={},l=q)}if(t.send_event||!("send_event"in t))if(e in u&&u[e].includes(o))l&&this.At({[kr]:u,[Ti]:l});else{var d,p,f,v,m,_,w,S,T,C,$,M;ce(u[e])?u[e].push(o):u[e]=[o],this.At(b({[kr]:u},l?{[Ti]:l}:{}));const q=this.getFeatureFlagDetails(e),X=[...(d=this.Fd("$feature_flag_errors"))!==null&&d!==void 0?d:[]];O(i)&&X.push("flag_missing");const ee={$feature_flag:e,$feature_flag_response:i,$feature_flag_payload:s??null,$feature_flag_request_id:a,$feature_flag_evaluated_at:c,$feature_flag_bootstrapped_response:(p=(f=this.Rr.bootstrap)===null||f===void 0||(f=f.featureFlags)===null||f===void 0?void 0:f[e])!==null&&p!==void 0?p:null,$feature_flag_bootstrapped_payload:(v=(m=this.Rr.bootstrap)===null||m===void 0||(m=m.featureFlagPayloads)===null||m===void 0?void 0:m[e])!==null&&v!==void 0?v:null,$used_bootstrap_value:!this.ld};O(q==null||(_=q.metadata)===null||_===void 0?void 0:_.has_experiment)||(ee.$feature_flag_has_experiment=q.metadata.has_experiment),O(q==null||(w=q.metadata)===null||w===void 0?void 0:w.version)||(ee.$feature_flag_version=q.metadata.version);const k=(S=q==null||(T=q.reason)===null||T===void 0?void 0:T.description)!==null&&S!==void 0?S:q==null||(C=q.reason)===null||C===void 0?void 0:C.code;var L;k&&(ee.$feature_flag_reason=k),q!=null&&($=q.metadata)!==null&&$!==void 0&&$.id&&(ee.$feature_flag_id=q.metadata.id),O(q?.original_variant)&&O(q?.original_enabled)||(ee.$feature_flag_original_response=O(q.original_variant)?q.original_enabled:q.original_variant),q!=null&&(M=q.metadata)!==null&&M!==void 0&&M.original_payload&&(ee.$feature_flag_original_payload=q==null||(L=q.metadata)===null||L===void 0?void 0:L.original_payload),X.length&&(ee.$feature_flag_error=X.join(",")),this.Vd(ee)}else l&&this.At({[kr]:u,[Ti]:l});return n?{key:e,enabled:!!i,variant:typeof i=="string"?i:void 0,payload:vh(s)}:void 0}Vd(e){try{var t;(t=this.wo)===null||t===void 0||t.capture("$feature_flag_called",e)}catch(r){this.$.error("Failed to capture feature flag call",r)}}getRemoteConfigPayload(e,t){this.Gd(e,t)}Gd(e,t){var r=this;return Ue(function*(){const n=r.wo;if(!n)return;const i={distinct_id:n.distinctId,token:n.projectToken,person_properties:{$lib:n.library.name,$lib_version:n.library.version}},s=r.jd();s.length&&(i.evaluation_contexts=s);const o=r.Bd();let a;O(o)||(i.flag_keys=o);try{var c;const l=(c=(yield n.sendRequest("/flags/?v=2",{target:"flags",method:"POST",body:i,compression:r.Rr.compression,sentAt:"body",timeoutMs:r.Rr.requestTimeoutMs})).json)===null||c===void 0?void 0:c.featureFlagPayloads;a=l?.[e]||void 0}catch(l){r.$.error("Remote config feature flag request failed",l);return}try{t(a)}catch(l){r.$.error("Remote config feature flag callback failed",l)}})()}isFeatureEnabled(e,t={}){if(t.fresh&&!this.ld)return t.defaultValue;if(!(this.nd||this.getFlags()&&this.getFlags().length>0))return this.$.warn('isFeatureEnabled for key "'+e+hc),t.defaultValue;const r=this.getFeatureFlag(e,t);return O(r)?t.defaultValue:!!r}addFeatureFlagsHandler(e){this.featureFlagEventHandlers.push(e)}removeFeatureFlagsHandler(e){this.featureFlagEventHandlers=this.featureFlagEventHandlers.filter(t=>t!==e)}receivedFeatureFlags(e,t,r){this.Hd(e,t,r)}Hd(e,t,r){if(!this.wo)return;this.nd=!0;const n=((i,s={},o={},a={},c,l=bp)=>{const u=((S,T)=>{const C=S.flags;if(C){const $=Object.fromEntries(Object.keys(C).map(L=>{var q;return[L,(q=C[L].variant)!==null&&q!==void 0?q:C[L].enabled]})),M=Object.fromEntries(Object.keys(C).filter(L=>C[L].enabled).filter(L=>{var q;return!O((q=C[L].metadata)===null||q===void 0?void 0:q.payload)}).map(L=>{var q;return[L,(q=C[L].metadata)===null||q===void 0?void 0:q.payload]}));return b(b({},S),{},{featureFlags:$,featureFlagPayloads:M})}return S.featureFlags&&T.warn("Using an older version of the feature flags endpoint. Please upgrade your PostHog server to the latest version"),S})(i,l),h=u.flags,d=u.featureFlags,p=u.featureFlagPayloads;if(!d)return;const f=i.requestId,v=i.evaluatedAt;if(ce(d)){l.warn("v1 of the feature flags endpoint is deprecated. Please use the latest version.");const S={};if(d)for(let T=0;d.length>T;T++)S[d[T]]=!0;return{[ir]:d,[Mt]:S,[Di]:!1}}let m=d,_=p,w=h;if(c?.partialResponse){const S=Object.keys(m),T=_||{};m=b(b({},s),m),_=b(b({},o),T),S.forEach(C=>{C in T||_==null||delete _[C]}),w=b(b({},a),w)}else if(i.errorsWhileComputingFlags)if(h){const S=new Set(Object.keys(h).filter(C=>{var $;return!(!(($=h[C])===null||$===void 0)&&$.failed)}));m=b(b({},s),Object.fromEntries(Object.entries(m).filter(([C])=>S.has(C))));const T=Object.fromEntries(Object.entries(_||{}).filter(([C])=>S.has(C)));_=b(b({},o),T),S.forEach(C=>{C in T||_==null||delete _[C]}),w=b(b({},a),Object.fromEntries(Object.entries(w||{}).filter(([C])=>S.has(C))))}else m=b(b({},s),m),_=b(b({},o),_),w=b(b({},a),w);return b(b({[ir]:Object.keys(kp(m)),[Mt]:m||{},[wr]:_||{},[ln]:w||{},[Di]:i.minimalFlagCalledEvents===!0},f?{[un]:f}:{}),v?{[Cr]:v}:{})})(e,this.getFlagVariants(),this.getFlagPayloads(),this.getFlagsWithDetails(),r,this.$);if(n)if(r?.persist===!1){const i=!O(this.wo.kv.get(Mt));this.Od=n,i||this.At(n)}else this.Td(),this.Nd(n,e,!!r?.partialResponse),this.At(n);else t&&this.Dd();t||(this.ud=!1),this.Md(t)}override(e,t=!1){this.$.warn("override is deprecated. Please use overrideFeatureFlags instead."),this.overrideFeatureFlags({flags:e,suppressWarning:t})}overrideFeatureFlags(e){this.Zd(e)}Zd(e){if(this.wo){if(e===!1)return this.Lt([qt,en]),this.Md(),void Zr.info("All overrides cleared");if(ce(e))return this.At({[qt]:Ep(e)}),this.Md(),void Zr.info("Flag overrides set",{flags:e});if(e&&typeof e=="object"&&("flags"in e||"payloads"in e)){var t;const r=e;this.Xc=!!((t=r.suppressWarning)!==null&&t!==void 0&&t);const n={},i=r.flags,s=r.payloads;i&&(n[qt]=ce(i)?Ep(i):i),s&&(n[en]=s),Object.keys(n).length&&this.At(n),i===!1&&s===!1?this.Lt([qt,en]):i===!1?this.Lt(qt):s===!1&&this.Lt(en),this.Md(),i===!1?Zr.info("Flag overrides cleared"):i&&Zr.info("Flag overrides set",{flags:i}),s===!1?Zr.info("Payload overrides cleared"):s&&Zr.info("Payload overrides set",{payloads:s});return}if(e&&typeof e=="object")return this.At({[qt]:e}),this.Md(),void Zr.info("Flag overrides set",{flags:e});this.$.warn("Invalid overrideOptions provided to overrideFeatureFlags",{overrideOptions:e})}else this.$.warn("posthog.featureFlags.overrideFeatureFlags called before feature flags were ready")}onFeatureFlags(e){if(this.addFeatureFlagsHandler(e),this.nd){const{flags:t,flagVariants:r}=this.Qd();try{e(t,r)}catch(n){this.$.error("Error while running feature flags callback",n)}}return()=>this.removeFeatureFlagsHandler(e)}updateEarlyAccessFeatureEnrollment(e,t,r){var n;const i=(this.Fd("$early_access_features")||[]).find(l=>l.flagKey===e),s={[`$feature_enrollment/${e}`]:t},o={$feature_flag:e,$feature_enrollment:t,$set:s};i&&(o.$early_access_feature_name=i.name),r&&(o.$feature_enrollment_stage=r);const a=b(b({},this.getFlagVariants()),{},{[e]:t});(n=this._instance)===null||n===void 0||(n=n.persistence)===null||n===void 0||n.markCrossTabFeatureFlagChanges({$active_feature_flags:[e],$enabled_feature_flags:[e],$stored_person_properties:Object.keys(s)}),this.At({[ir]:Object.keys(kp(a)),[Mt]:a,[Sr]:b(b({},this.Fd("$stored_person_properties")||{}),s)}),this.Md();try{var c;(c=this.wo)===null||c===void 0||c.capture("$feature_enrollment_update",o)}catch(l){this.$.error("Failed to capture early access feature enrollment",l)}}getEarlyAccessFeatures(e,t=!1,r){const n=this.Fd(cl);!n||t?this.Jd(e,r):e(n)}Jd(e,t){var r=this;return Ue(function*(){const n=r.wo;if(!n)return;const i=t?`&${t.map(o=>`stage=${o}`).join("&")}`:"";let s;try{const o=yield n.sendRequest(`/api/early_access_features/?token=${n.projectToken}${i}`,{target:"api",method:"GET",sentAt:"query"});if(!o.json)return;s=o.json.earlyAccessFeatures,r.At({[cl]:s})}catch(o){r.$.error("Early access feature request failed",o);return}try{e(s)}catch(o){r.$.error("Early access feature callback failed",o)}})()}Qd(){const e=this.getFlags(),t=this.getFlagVariants();return{flags:e.filter(r=>t[r]),flagVariants:Object.keys(t).filter(r=>t[r]).reduce((r,n)=>(r[n]=t[n],r),{})}}Md(e){this.Id();const{flags:t,flagVariants:r}=this.Qd();this.featureFlagEventHandlers.forEach(n=>{try{n(t,r,{errorsLoading:e})}catch(i){this.$.error("Error while running feature flags callback",i)}})}setPersonPropertiesForFlags(e,t=!0){this.Kd(e,t)}Kd(e,t=!0){const r=this.Fd("$stored_person_properties")||{},n=e?.$set||(e?.$set_once?{}:e),i=e?.$set_once,s={};if(i)for(const o in i)({}).hasOwnProperty.call(i,o)&&(o in r||(s[o]=i[o]));this.At({[Sr]:b(b(b({},r),s),n)}),t&&this.reloadFeatureFlags()}unsetPersonPropertiesForFlags(e,t=!0){const r=b({},this.Fd("$stored_person_properties")||{});e.forEach(n=>{delete r[n]}),this.At({[Sr]:r}),t&&this.reloadFeatureFlags()}resetPersonPropertiesForFlags(e=!0){this.Lt(Sr),e&&this.reloadFeatureFlags()}setGroupPropertiesForFlags(e,t=!0){const r=this.Fd("$stored_group_properties")||{},n=b({},r);for(const i of Object.keys(e))n[i]=b(b({},r[i]),e[i]);this.At({[Er]:n}),t&&this.reloadFeatureFlags()}resetGroupPropertiesForFlags(e){if(e){const t=this.Fd("$stored_group_properties")||{};this.At({[Er]:b(b({},t),{},{[e]:{}})})}else this.Lt(Er)}reset(){this.rd++,this.ad=!1,this.Yc={},this.td={},this.Od=void 0,this.nd=!1,this.od=!1,this.ld=!1,this.$anon_distinct_id=void 0,this.Ad(),this.Xc=!1,this.hd=0}}},pO={sessionRecording:class{get Rr(){return this._instance.config}get Ml(){return this._instance.persistence}get started(){var e;return!!(!((e=this.Xd)===null||e===void 0)&&e.isStarted)}get status(){var e,t;return this.Yd==="awaiting_config"||this.Yd==="missing_config"?this.Yd:(e=(t=this.Xd)===null||t===void 0?void 0:t.status)!==null&&e!==void 0?e:this.Yd}constructor(e){if(this._instance=e,this._forceAllowLocalhostNetworkCapture=!1,this.Yd=lc,this.tv=void 0,this.ev=!1,this.Xe=(()=>{var t,r;if(!N?.visibilityState||N.visibilityState==="visible")return!0;const n=A==null||(t=A.performance)===null||t===void 0||(r=t.getEntriesByType)===null||r===void 0?void 0:r.call(t,"visibility-state");return!n?.length||n.some(i=>i.name==="visible")})(),this.ln=()=>{var t,r;N?.visibilityState==="visible"&&(this.Xe=!0,(t=this.Xd)===null||t===void 0||(r=t.setDocumentWasEverVisible)===null||r===void 0||r.call(t,!0))},!this._instance.sessionManager)throw Xt.error("started without valid sessionManager"),new Error("[SessionRecording] started without valid sessionManager. This is a bug.");if(this.Rr.cookieless_mode==="always")throw new Error('[SessionRecording] cannot be used with cookieless_mode="always"');N!=null&&N.addEventListener&&Ie(N,"visibilitychange",this.ln)}initialize(){this.startIfEnabledOrStop()}dispose({discardBufferedEvents:e=!1}={}){var t;this.ev=!0,N==null||(t=N.removeEventListener)===null||t===void 0||t.call(N,"visibilitychange",this.ln),e?this.iv(!0):this.stopRecording()}get nv(){var e;const t=!!(!((e=this._instance.get_property("$session_recording_remote_config"))===null||e===void 0)&&e.enabled),r=!this.Rr.disable_session_recording,n=this.Rr.disable_session_recording||this._instance.consent.isOptedOut();return A&&t&&r&&!n}startIfEnabledOrStop(e){var t;if(this.ev||this.nv&&(!((t=this.Xd)===null||t===void 0)&&t.isStarted))return;const r=!O(Object.assign)&&!O(Array.from);this.nv&&r?(this.sv(e),Xt.info("starting")):(this.Yd=lc,this.stopRecording())}sv(e){var t,r;if(this.nv)if(this.Yd!=="awaiting_config"&&this.Yd!=="missing_config"&&(this.Yd=fp),(te==null||(t=te.__PosthogExtensions__)===null||t===void 0||(t=t.rrweb)===null||t===void 0?void 0:t.record)&&((r=te.__PosthogExtensions__)===null||r===void 0?void 0:r.initSessionRecording))this.rv(e);else{var n,i;const s=this._instance.sessionManager;(n=te.__PosthogExtensions__)===null||n===void 0||(i=n.loadExternalDependency)===null||i===void 0||i.call(n,this._instance,this.ov,o=>{if(!this.ev&&this.nv&&this._instance.sessionManager===s)return o?(this._instance.register_for_session({$sdk_debug_recording_script_not_loaded:!0}),Xt.error("could not load recorder",o)):void this.rv(e);this.Yd="disabled"})}}stopRecording(){var e,t;(e=this.tv)===null||e===void 0||e.call(this),this.tv=void 0,(t=this.Xd)===null||t===void 0||t.stop()}iv(e=!1){var t,r;(t=this.tv)===null||t===void 0||t.call(this),this.tv=void 0,(r=this.Xd)===null||r===void 0||r.discard({discardProducerEvents:e})}av(){var e,t;(e=this.Ml)===null||e===void 0||e.unregister("$session_is_sampled"),(t=this.Ml)===null||t===void 0||t.unregister("$replay_sample_rate")}lv(e,t){if(ge(e))return null;const r=We(e)?e:parseFloat(e);return typeof(n=r)!="number"||!Number.isFinite(n)||0>n||n>1?(Xt.warn(`${t} must be between 0 and 1. Ignoring invalid value:`,e),null):r;var n}uv(e){if(this.Ml){var t,r;const n=this.Ml,i=()=>{var s;const o=e.sessionRecording===!1?void 0:e.sessionRecording,a=this.lv((s=this.Rr.session_recording)===null||s===void 0?void 0:s.sampleRate,"session_recording.sampleRate"),c=this.lv(o?.sampleRate,"remote config sampleRate"),l=a??c;ge(l)&&this.av();const u=o?.minimumDurationMilliseconds;n.register({[Li]:b(b({cache_timestamp:Date.now(),enabled:!!o},o),{},{networkPayloadCapture:b({capturePerformance:e.capturePerformance},o?.networkPayloadCapture),canvasRecording:{enabled:o?.recordCanvas,fps:o?.canvasFps,quality:o?.canvasQuality},sampleRate:l,minimumDurationMilliseconds:O(u)?null:u,endpoint:o?.endpoint,triggerMatchType:o?.triggerMatchType,masking:o?.masking,urlTriggers:o?.urlTriggers,version:o?.version,triggerGroups:o?.triggerGroups})})};i(),(t=this.tv)===null||t===void 0||t.call(this),this.tv=(r=this._instance.sessionManager)===null||r===void 0?void 0:r.onSessionId(i)}}onRemoteConfig(e){const t=e.ok?e.config:void 0;t&&"sessionRecording"in t?t.sessionRecording===!1?(this.uv(t),this.iv()):(this.uv(t),this.startIfEnabledOrStop()):(this.Yd==="awaiting_config"&&(this.Yd="missing_config",this._instance.register_for_session({[Tm]:!0}),Xt.warn("config refresh failed, recording will not start until page reload")),this.startIfEnabledOrStop())}log(e,t="log"){var r;!((r=this.Xd)===null||r===void 0)&&r.log?this.Xd.log(e,t):Xt.warn("log called before recorder was ready")}get ov(){var e,t;const r=(e=this._instance)===null||e===void 0||(e=e.persistence)===null||e===void 0?void 0:e.get_property(Li);return(r==null||(t=r.scriptConfig)===null||t===void 0?void 0:t.script)||"lazy-recorder"}hv(){const e=this._instance.get_property(Li);if(!e)return!1;let t;try{t=typeof e=="object"?e:JSON.parse(e)}catch(r){return Xt.warn("persisted remote config for session recording is invalid and will be ignored",r),!1}return!ge(t.cache_timestamp)&&36e5>=Date.now()-t.cache_timestamp}rv(e){var t,r,n;if(!this.ev&&this.nv&&this._instance.sessionManager){if(!(!((t=te.__PosthogExtensions__)===null||t===void 0)&&t.initSessionRecording))return Xt.warn("Called on script loaded before session recording is available. This can be caused by adblockers."),void this._instance.register_for_session({[Im]:!0});var i;if(this.Xd||(this.Xd=(i=te.__PosthogExtensions__)===null||i===void 0?void 0:i.initSessionRecording(this._instance,this.Xe),this.Xd._forceAllowLocalhostNetworkCapture=this._forceAllowLocalhostNetworkCapture),!this.hv()){if(this.Yd==="missing_config"||this.Yd==="awaiting_config")return;this.Yd="awaiting_config",Xt.info("persisted remote config is stale, requesting fresh config before starting"),new t_(this._instance).load();return}this.Yd=fp,(r=(n=this.Xd).setDocumentWasEverVisible)===null||r===void 0||r.call(n,this.Xe),this.Xd.start(e)}else this.Yd=lc}onRRwebEmit(e){var t,r;(t=this.Xd)===null||t===void 0||(r=t.onRRwebEmit)===null||r===void 0||r.call(t,e)}overrideLinkedFlag(){var e,t;this.Xd||(t=this.Ml)===null||t===void 0||t.register({$replay_override_linked_flag:!0}),(e=this.Xd)===null||e===void 0||e.overrideLinkedFlag()}overrideSampling(){var e,t;this.Xd||(t=this.Ml)===null||t===void 0||t.register({$replay_override_sampling:!0}),(e=this.Xd)===null||e===void 0||e.overrideSampling()}overrideTrigger(e){var t,r;this.Xd||(r=this.Ml)===null||r===void 0||r.register({[e==="url"?"$replay_override_url_trigger":"$replay_override_event_trigger"]:!0}),(t=this.Xd)===null||t===void 0||t.overrideTrigger(e)}get sdkDebugProperties(){var e;return((e=this.Xd)===null||e===void 0?void 0:e.sdkDebugProperties)||{$recording_status:this.status}}tryAddCustomEvent(e,t){var r;return!!(!((r=this.Xd)===null||r===void 0)&&r.tryAddCustomEvent(e,t))}flushBeforeIdentityReset(){var e,t;(e=this.Xd)===null||e===void 0||(t=e.flushBeforeIdentityReset)===null||t===void 0||t.call(e)}}},fO={autocapture:class extends qP{constructor(e){super(new jP(e)),this.instance=e}},historyAutocapture:class{constructor(e){this._instance=e,this.dv=this.vv()}initialize(){this.startIfEnabled()}get isEnabled(){const e=this.fv();return!!(e.path||e.search||this.pv(e))}startIfEnabled(){this.isEnabled&&(j.info("History API monitoring enabled, starting..."),this.monitorHistoryChanges())}startIfEnabledOrStop(){this.stop(),this.dv=this.vv(),this.startIfEnabled()}stop(){this.gv&&this.gv(),this.gv=void 0,this.mv&&this.mv(),this.mv=void 0,j.info("History API monitoring stopped")}monitorHistoryChanges(){A&&A.history&&(this.yv("pushState"),this.yv("replaceState"),this.bv(),this.pv()&&this._v())}yv(e){var t;if(!A||!((t=A.history[e])===null||t===void 0)&&t.__posthog_wrapped__)return;const r=this;ss(A.history,e,n=>function(i,s,o){n.call(this,i,s,o),r.wv(e)})}vv(){const e=A?.location;if(e?.pathname)return{pathname:e.pathname,search:e.search,hash:e.hash}}fv(){const e=this._instance.config.capture_pageview;return e==="history_change"?{path:!0}:be(e)?e:{}}pv(e=this.fv()){return!!e.hash&&!this._instance.config.disable_capture_url_hashes}Sv(e){const t=this.fv(),r=this.dv;return!(!r||!(t.path&&e.pathname!==r.pathname||t.search&&e.search!==r.search||this.pv(t)&&e.hash!==r.hash))}wv(e){try{const t=this.vv();if(!t)return;this.Sv(t)&&this._instance.capture(Cu,{navigation_type:e}),this.dv=t}catch(t){j.error(`Error capturing ${e} pageview`,t)}}bv(){if(this.gv)return;const e=()=>{this.wv("popstate")};Ie(A,"popstate",e),this.gv=()=>{A&&A.removeEventListener("popstate",e)}}_v(){if(this.mv)return;const e=()=>{this.wv("hashchange")};Ie(A,"hashchange",e),this.mv=()=>{A&&A.removeEventListener("hashchange",e)}}},heatmaps:class{get Rr(){return this.instance.config}constructor(e){var t;this.xv=!1,this.xo=!1,this.Cv=null,this.instance=e,this.xv=!!(!((t=this.instance.persistence)===null||t===void 0)&&t.props[il]),this.rageclicks=new k_(e.config.rageclick)}initialize(){this.startIfEnabled()}get flushIntervalMilliseconds(){let e=5e3;return be(this.Rr.capture_heatmaps)&&this.Rr.capture_heatmaps.flush_interval_milliseconds&&(e=this.Rr.capture_heatmaps.flush_interval_milliseconds),e}get isEnabled(){return ge(this.Rr.capture_heatmaps)?ge(this.Rr.enable_heatmaps)?this.xv:this.Rr.enable_heatmaps:this.Rr.capture_heatmaps!==!1}startIfEnabled(){if(this.isEnabled){if(this.xo)return;GP.info("starting..."),this.$v(),this.ln()}else{var e;clearInterval((e=this.Cv)!==null&&e!==void 0?e:void 0),this.Tv(),this.getAndClearBuffer()}}onRemoteConfig(e){if(!e.ok)return;const t=e.config;if(!("heatmaps"in t))return;const r=!!t.heatmaps;this.instance.persistence&&this.instance.persistence.register({[il]:r}),this.xv=r,this.startIfEnabled()}getAndClearBuffer(){const e=this.Rt;return this.Rt=void 0,e}Iv(e){uc(e.originalEvent)&&this.Tr(e.originalEvent,"deadclick")}ln(){this.Cv&&clearInterval(this.Cv),this.Cv=N?.visibilityState==="visible"?setInterval(this.bl.bind(this),this.flushIntervalMilliseconds):null}$v(){A&&N&&(this.Mv=this.bl.bind(this),Ie(A,ko,this.Mv),this.Ev=e=>this.Tr(e||A?.event),Ie(N,"click",this.Ev,{capture:!0}),this.Pv=e=>this.Rv(e||A?.event),Ie(N,"mousemove",this.Pv,{capture:!0}),this.Av=new jh(this.instance,Z$,this.Iv.bind(this)),this.Av.startIfEnabledOrStop(),this.Fv=this.ln.bind(this),Ie(N,es,this.Fv),this.xo=!0)}Tv(){var e;A&&N&&(this.Mv&&A.removeEventListener(ko,this.Mv),this.Ev&&N.removeEventListener("click",this.Ev,{capture:!0}),this.Pv&&N.removeEventListener("mousemove",this.Pv,{capture:!0}),this.Fv&&N.removeEventListener(es,this.Fv),clearTimeout(this.Ov),(e=this.Av)===null||e===void 0||e.stop(),this.xo=!1)}Dv(e,t){const r=this.instance.scrollManager.scrollY(),n=this.instance.scrollManager.scrollX(),i=this.instance.scrollManager.scrollElement(),s=(function(o,a,c){let l=o;for(;l&&Zt(l)&&!ct(l,"body");){if(l===c)return!1;let p;try{var u,h,d;p=(u=(h=(d=l.ownerDocument)===null||d===void 0?void 0:d.defaultView)!==null&&h!==void 0?h:A)===null||u===void 0?void 0:u.getComputedStyle(l).position}catch{return!1}if(ue(a,p))return!0;l=Nm(l)}return!1})(zi(e),["fixed","sticky"],i);return{x:e.clientX+(s?0:n),y:e.clientY+(s?0:r),target_fixed:s,type:t}}Tr(e,t="click"){var r;if(Oh(e.target)||!uc(e))return;const n=this.Dv(e,t);(r=this.rageclicks)!==null&&r!==void 0&&r.isRageClick(e.clientX,e.clientY,new Date().getTime())&&Um(zi(e),this.instance.config.rageclick)&&this.Zs(b(b({},n),{},{type:"rageclick"})),this.Zs(n)}Rv(e){!Oh(e.target)&&uc(e)&&(clearTimeout(this.Ov),this.Ov=setTimeout(()=>{this.Zs(this.Dv(e,"mousemove"))},500))}Zs(e){if(!A)return;const t=this.Rr.disable_capture_url_hashes?Ur(A.location.href):A.location.href,r=this.Rr.custom_personal_data_properties,n=this.Rr.mask_personal_data_properties?[...Qn,...r||[]]:[],i=ns(t,n,is);this.Rt=this.Rt||{},this.Rt[i]||(this.Rt[i]=[]),this.Rt[i].push(e)}bl(){this.Rt&&!_t(this.Rt)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}},deadClicksAutocapture:jh,webVitalsAutocapture:class{constructor(e){var t;this._instance=e,this.xv=!1,this.xo=!1,this.Rt={navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0},this.Lv=()=>{clearTimeout(this.Nv),this.Nv=void 0,this.Rt.metrics.length!==0&&(this._instance.capture("$web_vitals",b({$current_url:this.Rt.url},this.Rt.metrics.reduce((r,n)=>b(b({},r),{},{[`$web_vitals_${n.name}_event`]:b({},n),[`$web_vitals_${n.name}_value`]:n.value}),{}))),this.Rt={navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0})},this.qv=r=>{var n;if(this.Rt=this.Rt||{navigationKey:void 0,url:void 0,metrics:[],firstMetricTimestamp:void 0},ge(r?.name)||ge(r?.value))return void Wr.error("Invalid metric received",r);const i=typeof r.navigationURL=="string"?r.navigationURL:void 0,s=this.jv(i);if(O(s))return;const o=We(r.navigationId)||typeof r.navigationId=="string"?`navigation:${r.navigationId}`:`url:${s}`;if(this.Bv&&r.value>=this.Bv)return void Wr.error("Ignoring metric with value >= "+this.Bv,r);this.Rt.navigationKey!==o&&(this.Lv(),this.Nv=setTimeout(this.Lv,this.flushToCaptureTimeoutMs)),O(this.Rt.navigationKey)&&(this.Rt.navigationKey=o,this.Rt.url=s),this.Rt.firstMetricTimestamp=O(this.Rt.firstMetricTimestamp)?Date.now():this.Rt.firstMetricTimestamp;const a=(n=this._instance.sessionManager)===null||n===void 0?void 0:n.checkAndGetSessionAndWindowId(!0),c=b(b(b({},r),i?{navigationURL:s}:{}),{},{$current_url:s,timestamp:Date.now()});if(delete c.entries,be(r.attribution)&&this.attributionMetrics.indexOf(r.name)>-1){const l={};for(const u of BP){const h=u==="url"&&typeof r.attribution[u]=="string"?this.jv(r.attribution[u]):r.attribution[u];O(h)||(l[u]=h)}c.attribution=l}else delete c.attribution;O(a)||(c.$session_id=a.sessionId,c.$window_id=a.windowId),this.Rt.metrics.push(c),this.Rt.metrics.length===this.allowedMetrics.length&&this.Lv()},this.Hv=()=>{if(this.xo)return;let r,n,i,s,o=!1;const a=te.__PosthogExtensions__,c=a?.postHogWebVitalsCallbacksByFlavor,l=c?.[this.zv]||(this.zv==="web-vitals"&&O(c)?a?.postHogWebVitalsCallbacks:void 0);if(!O(l)){const d=l.withoutAttribution,p=this.attributionMetrics;o=!O(d),r=p.indexOf("LCP")>-1?l.onLCP:d?.onLCP||l.onLCP,n=p.indexOf("CLS")>-1?l.onCLS:d?.onCLS||l.onCLS,i=p.indexOf("FCP")>-1?l.onFCP:d?.onFCP||l.onFCP,s=p.indexOf("INP")>-1?l.onINP:d?.onINP||l.onINP}if(!(r&&n&&i&&s))return void Wr.error("web vitals callbacks not loaded - not starting");const u={reportSoftNavs:this.useSoftNavs},h=o&&this.attributionMetrics.indexOf("INP")>-1?b(b({},u),{},{includeProcessedEventEntries:!1}):u;this.allowedMetrics.indexOf("LCP")>-1&&r(this.qv.bind(this),u),this.allowedMetrics.indexOf("CLS")>-1&&n(this.qv.bind(this),u),this.allowedMetrics.indexOf("FCP")>-1&&i(this.qv.bind(this),u),this.allowedMetrics.indexOf("INP")>-1&&s(this.qv.bind(this),h),this.xo=!0},this.xv=!!(!((t=this._instance.persistence)===null||t===void 0)&&t.props[al]),this.startIfEnabled()}get Uv(){return this._instance.config.capture_performance}get allowedMetrics(){var e,t;const r=be(this.Uv)?(e=this.Uv)===null||e===void 0?void 0:e.web_vitals_allowed_metrics:void 0;return ge(r)?((t=this._instance.persistence)===null||t===void 0?void 0:t.props.$web_vitals_allowed_metrics)||pp:r}get flushToCaptureTimeoutMs(){return(be(this.Uv)?this.Uv.web_vitals_delayed_flush_ms:void 0)||5e3}get attributionMetrics(){const e=be(this.Uv)?this.Uv.web_vitals_attribution:void 0;return vt(e)?e?pp:[]:ce(e)?e:VP}get useAttribution(){return this.attributionMetrics.length>0}get useSoftNavs(){const e=be(this.Uv)?this.Uv.__preview_web_vitals_soft_navs:void 0;return e!=null&&e}get Bv(){const e=be(this.Uv)&&We(this.Uv.__web_vitals_max_value)?this.Uv.__web_vitals_max_value:hp;return e>0&&6e4>=e?hp:e}get isEnabled(){const e=je?.protocol;if(e!=="http:"&&e!=="https:")return Wr.info("Web Vitals are disabled on non-http/https protocols"),!1;const t=be(this.Uv)?this.Uv.web_vitals:vt(this.Uv)?this.Uv:void 0;return vt(t)?t:this.xv}startIfEnabled(){this.isEnabled&&!this.xo&&(Wr.info("enabled, starting..."),this.zo(this.Hv))}onRemoteConfig(e){if(!e.ok)return;const t=e.config;if(!("capturePerformance"in t))return;const r=be(t.capturePerformance)&&!!t.capturePerformance.web_vitals,n=be(t.capturePerformance)?t.capturePerformance.web_vitals_allowed_metrics:void 0;this._instance.persistence&&(this._instance.persistence.register({[al]:r}),this._instance.persistence.register({[gm]:n})),this.xv=r,this.startIfEnabled()}get zv(){return this.useSoftNavs?this.useAttribution?"web-vitals-with-attribution-soft-navs":"web-vitals-soft-navs":this.useAttribution?"web-vitals-with-attribution":"web-vitals"}zo(e){var t;const r=te.__PosthogExtensions__,n=this.zv,i=r?.postHogWebVitalsCallbacksByFlavor;i?.[n]||n==="web-vitals"&&O(i)&&r?.postHogWebVitalsCallbacks?e():r==null||(t=r.loadExternalDependency)===null||t===void 0||t.call(r,this._instance,n,s=>{s?Wr.error("failed to load script",s):e()})}jv(e){const t=e||A?.location.href;if(!t)return void Wr.error("Could not determine current URL");const r=this._instance.config.disable_capture_url_hashes?Ur(t):t,n=this._instance.config.custom_personal_data_properties,i=this._instance.config.mask_personal_data_properties?[...Qn,...n||[]]:[];return ns(r,i,is)}}},vO={exceptionObserver:class{constructor(e){var t;this.Hv=()=>{var r;if(!A||!this.isEnabled||!(!((r=te.__PosthogExtensions__)===null||r===void 0)&&r.errorWrappingFunctions))return;const n=te.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,i=te.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,s=te.__PosthogExtensions__.errorWrappingFunctions.wrapConsoleError;try{!this.Wv&&this.Rr.capture_unhandled_errors&&(this.Wv=n(this.captureException.bind(this))),!this.Vv&&this.Rr.capture_unhandled_rejections&&(this.Vv=i(this.captureException.bind(this))),!this.Gv&&this.Rr.capture_console_errors&&(this.Gv=s(this.captureException.bind(this)))}catch(o){ki.error("failed to start",o),this.Zv()}},this._instance=e,this.Qv=!!(!((t=this._instance.persistence)===null||t===void 0)&&t.props[sl]),this.wt=new aC(b(b({},(function(r={}){var n,i,s,o;return{refillRate:(n=(i=r.exceptionRateLimiterRefillRate)!==null&&i!==void 0?i:r.__exceptionRateLimiterRefillRate)!==null&&n!==void 0?n:1,bucketSize:(s=(o=r.exceptionRateLimiterBucketSize)!==null&&o!==void 0?o:r.__exceptionRateLimiterBucketSize)!==null&&s!==void 0?s:10}})(this._instance.config.error_tracking)),{},{refillInterval:1e4,$:ki})),this.Rr=this.Jv(),this.startIfEnabledOrStop()}Jv(){const e=this._instance.config.capture_exceptions;let t={capture_unhandled_errors:!1,capture_unhandled_rejections:!1,capture_console_errors:!1};return be(e)?t=b(b({},t),e):(O(e)?this.Qv:e)&&(t=b(b({},t),{},{capture_unhandled_errors:!0,capture_unhandled_rejections:!0})),t}get isEnabled(){return this.Rr.capture_console_errors||this.Rr.capture_unhandled_errors||this.Rr.capture_unhandled_rejections}startIfEnabledOrStop(){this.isEnabled?(ki.info("enabled"),this.Zv(),this.zo(this.Hv)):this.Zv()}zo(e){var t,r,n;!((t=te.__PosthogExtensions__)===null||t===void 0)&&t.errorWrappingFunctions?e():(r=te.__PosthogExtensions__)===null||r===void 0||(n=r.loadExternalDependency)===null||n===void 0||n.call(r,this._instance,"exception-autocapture",i=>{if(i)return ki.error("failed to load script",i);e()})}Zv(){var e,t,r;(e=this.Wv)===null||e===void 0||e.call(this),this.Wv=void 0,(t=this.Vv)===null||t===void 0||t.call(this),this.Vv=void 0,(r=this.Gv)===null||r===void 0||r.call(this),this.Gv=void 0}onRemoteConfig(e){if(!e.ok)return;const t=e.config;"autocaptureExceptions"in t&&(this.Qv=!!t.autocaptureExceptions||!1,this._instance.persistence&&this._instance.persistence.register({[sl]:this.Qv}),this.Rr=this.Jv(),this.startIfEnabledOrStop())}onConfigChange(){this.Rr=this.Jv()}captureException(e){try{var t,r,n;const i=(t=e==null||(r=e.$exception_list)===null||r===void 0||(r=r[0])===null||r===void 0?void 0:r.type)!==null&&t!==void 0?t:"Exception";if(this.wt.consumeRateLimit(i))return void ki.info("Skipping exception capture because of client rate limiting.",{exception:i});(n=this._instance.exceptions)===null||n===void 0||n.sendExceptionEvent(e)}catch{}}},exceptions:class{constructor(e){var t,r;this.Kv=[],this.Xv=new yC([new MC,new HC,new DC,new LC,new qC,new FC,new zC,new jC],(function(n,...i){return(s,o=0)=>{const a=[],c=s.split(`
|
|
96
|
-
`),l=Math.min(c.length,o+1e3),u=[];for(let p=o;l>p;p++){const f=c[p];if(f.length>1024)continue;const v=fh.test(f)?f.replace(fh,"$1"):f;if(!v.match(/\S*Error: /)){for(const m of i){const _=m(v,n);if(_){a.push(_);const w=$C(a);if(w){for(let S=u.length-1;S>=0;S--){const T=u[S];if(w.start>=T.start+T.length)break;u.pop()}u.push(w)}break}}if(OC(a,u)>=50)break}}const h=[...u].sort((p,f)=>f.start-p.start),d=h[h.length-1];if(d){const p=Xg(a,d);a.splice(d.start-p,p);for(const f of h)f.start-=p}for(const p of h)PC(a,p);return u.some(p=>p.start===0&&a.length===p.length)&&(function(p){const f=p.map(m=>`${m.function}|${m.filename}|${m.lineno}|${m.colno}|${m.module}`);let v=0;for(let m=1;f.length>m;m++)xC(f,m,v)&&(v=m);p.push(...p.splice(0,v))})(a),(function(p){if(!p.length)return[];const f=Array.from(p);return f.reverse(),f.slice(0,50).map(v=>{return b(b({},v),{},{filename:v.filename||(m=f,m[m.length-1]||{}).filename,function:v.function||"?"});var m})})(a)}})("web:javascript",AC,CC)),this._instance=e,this.Kv=(t=(r=this._instance.persistence)===null||r===void 0?void 0:r.get_property("$error_tracking_suppression_rules"))!==null&&t!==void 0?t:[],this.Yv=yo(this.tf()),this.ef=new BC(this.Yv)}onConfigChange(){this.Yv=yo(this.tf()),this.ef.setConfig(this.Yv)}onRemoteConfig(e){var t,r,n;if(!e.ok)return;const i=e.config;if(!("errorTracking"in i))return;const s=(t=(r=i.errorTracking)===null||r===void 0?void 0:r.suppressionRules)!==null&&t!==void 0?t:[],o=(n=i.errorTracking)===null||n===void 0?void 0:n.captureExtensionExceptions;this.Kv=s,this._instance.persistence&&this._instance.persistence.register({[fm]:this.Kv,[ol]:o})}get if(){var e;const t=!!this._instance.get_property(ol),r=this._instance.config.error_tracking.captureExtensionExceptions;return(e=r??t)!==null&&e!==void 0&&e}buildProperties(e,t){return this.Xv.buildFromUnknown(e,{syntheticException:t?.syntheticException,mechanism:{handled:t?.handled}})}addExceptionStep(e,t){if(this.Yv.enabled)try{if(!ye(e)||e.trim().length===0)return void $t.warn("Ignoring exception step because message must be a non-empty string");const{sanitizedProperties:r,droppedKeys:n}=(function(i){if(!i)return{sanitizedProperties:{},droppedKeys:[]};const s=[];return{sanitizedProperties:Object.keys(i).reduce((o,a)=>VC.has(a)?(s.push(a),o):(o[a]=i[a],o),{}),droppedKeys:s}})(this.nf(t));n.length>0&&$t.warn("Ignoring reserved exception step fields",{droppedKeys:n}),this.ef.add(b({[mo]:e,[_o]:new Date().toISOString()},r))}catch(r){$t.error("Failed to add exception step. Ignoring breadcrumb.",r)}}sendExceptionEvent(e){try{const t=e.$exception_list;if(this.sf(t)){if(this.rf(t))return this.af("Exception dropped: matched a suppression rule"),void $t.info("Skipping exception capture because a suppression rule matched");if(!this.if&&this.lf(t))return this.af("Exception dropped: thrown by a browser extension"),void $t.info("Skipping exception capture because it was thrown by an extension");if(!this.if&&this.uf(t))return this.af("Exception dropped: thrown by an injected browser script"),void $t.info("Skipping exception capture because it was thrown by an injected browser script");if(!this._instance.config.error_tracking.__capturePostHogExceptions&&this.hf(t))return this.af("Exception dropped: thrown by the PostHog SDK"),void $t.info("Skipping exception capture because it was thrown by the PostHog SDK")}const r=this.Yv.enabled&&ge(e.$exception_steps)?this.cf(e):e,n=(function(){const i=globalThis._posthogReleaseId;return typeof i=="string"&&i.length>0?i:void 0})();n&&(r.$release_id=n);try{const i=this._instance.capture("$exception",r,{_noTruncate:!0,_batchKey:"exceptionEvent",fh:!0});return i&&this.ef.clear(),i}catch(i){Rp(i)||$t.error("Failed to capture exception event. Dropping this exception.",i),this.ef.clear();return}}catch(t){Rp(t)||$t.error("Failed to process exception event. Ignoring this exception.",t);return}}cf(e){try{const t=this.ef.getAttachable();return t.length===0?e:b(b({},e),{},{$exception_steps:t})}catch(t){return $t.error("Failed to read buffered exception steps. Capturing exception without steps.",t),e}}af(e){this.Yv.enabled&&this.ef.add({[mo]:e,[_o]:new Date().toISOString()})}nf(e){return be(e)?b({},e):{}}tf(){var e,t;return(e=(t=this._instance.config.error_tracking)===null||t===void 0?void 0:t.exception_steps)!==null&&e!==void 0?e:{}}rf(e){if(e.length===0)return!1;try{const t=e.reduce((r,{type:n,value:i})=>(ye(n)&&n.length>0&&r.$exception_types.push(n),ye(i)&&i.length>0&&r.$exception_values.push(i),r),{$exception_types:[],$exception_values:[]});return this.Kv.some(r=>{const n=r.values.map(i=>{const s=b_[i.operator],o=t[i.key];if(!s||!o)return!1;const a=ce(i.value)?i.value:[i.value];return a.length>0&&s(a,o)});return r.type==="OR"?n.some(Boolean):n.every(Boolean)})}catch(t){return $t.warn("Failed to evaluate suppression rules. Capturing the exception.",t),!1}}lf(e){const t=e.flatMap(n=>{var i,s;return(i=(s=n.stacktrace)===null||s===void 0?void 0:s.frames)!==null&&i!==void 0?i:[]}),r=t.filter(({filename:n})=>!!n&&iO.some(i=>n.startsWith(i)));return r.length!==0&&(!r.every(({filename:n})=>!!n&&n.startsWith(El))||e.some(({type:n,value:i})=>n==="NoResponse"||ye(i)&&nO.some(({value:s,exact:o})=>o?i===s:i.includes(s)))&&!t.some(({in_app:n,filename:i})=>n&&!i?.startsWith(El)))}uf(e){return e.some(({value:t})=>ye(t)&&sO.some(r=>t.includes(r)))}hf(e){if(e.length>0){var t,r,n,i;const s=(t=(r=e[0].stacktrace)===null||r===void 0?void 0:r.frames)!==null&&t!==void 0?t:[],o=s[s.length-1];return(n=o==null||(i=o.filename)===null||i===void 0?void 0:i.includes("posthog.com/static"))!==null&&n!==void 0&&n}return!1}sf(e){return!ge(e)&&ce(e)}}},gO=b({productTours:class{get Ml(){return this._instance.persistence}constructor(e){this.df=null,this.vf=null,this._instance=e}initialize(){this.loadIfEnabled()}onRemoteConfig(e){if(!e.ok)return;const t=e.config;if("productTours"in t){var r,n;if(this.Ml&&this.Ml.register({[Au]:!!t.productTours}),!dc(this._instance))return!this.df&&ge((r=this.Ml)===null||r===void 0?void 0:r.props.ph_product_tours)||xs.info("product tours disabled; stopping and clearing cached tours"),(n=this.df)===null||n===void 0||n.stop(),this.df=null,void this.clearCache();this.loadIfEnabled()}}loadIfEnabled(){!this.df&&dc(this._instance)&&this.zo(()=>this.ff())}zo(e){var t,r,n;!((t=te.__PosthogExtensions__)===null||t===void 0)&&t.generateProductTours?e():(r=te.__PosthogExtensions__)===null||r===void 0||(n=r.loadExternalDependency)===null||n===void 0||n.call(r,this._instance,"product-tours",i=>{i?xs.error("Could not load product tours script",i):e()})}ff(){var e;!this.df&&(e=te.__PosthogExtensions__)!==null&&e!==void 0&&e.generateProductTours&&(this.df=te.__PosthogExtensions__.generateProductTours(this._instance,!0))}getProductTours(e,t=!1){if(ce(this.vf)&&!t)return void e(this.vf,{isLoaded:!0});const r=this.Ml;if(r){const n=r.props[ul];if(ce(n)&&!t)return this.vf=n,void e(n,{isLoaded:!0})}this._instance._send_request({url:this._instance.requestRouter.endpointFor("api",`/api/product_tours/?token=${this._instance.config.token}`),method:"GET",timestampMode:"query",callback:n=>{if(!dc(this._instance))return void e([],{isLoaded:!0});const i=n.statusCode;if(i!==200||!n.json){const o=`Product Tours API could not be loaded, status: ${i}`;i===0?n.error||xs.warn(o):xs.error(o),e([],{isLoaded:!1,error:o});return}const s=ce(n.json.product_tours)?n.json.product_tours:[];this.vf=s,r&&r.register({[ul]:s}),e(s,{isLoaded:!0})}})}getActiveProductTours(e){ge(this.df)?e([],{isLoaded:!1,error:"Product tours not loaded"}):this.df.getActiveProductTours(e)}showProductTour(e){var t;(t=this.df)===null||t===void 0||t.showTourById(e)}previewTour(e){this.df?this.df.previewTour(e):this.zo(()=>{var t;this.ff(),(t=this.df)===null||t===void 0||t.previewTour(e)})}dismissProductTour(){var e;(e=this.df)===null||e===void 0||e.dismissTour("user_clicked_skip")}nextStep(){var e;(e=this.df)===null||e===void 0||e.nextStep()}previousStep(){var e;(e=this.df)===null||e===void 0||e.previousStep()}clearCache(){var e;this.vf=null,(e=this.Ml)===null||e===void 0||e.unregister("ph_product_tours")}resetTour(e){var t;(t=this.df)===null||t===void 0||t.resetTour(e)}resetAllTours(){var e;(e=this.df)===null||e===void 0||e.resetAllTours()}cancelPendingTour(e){var t;(t=this.df)===null||t===void 0||t.cancelPendingTour(e)}}},ma),mO={siteApps:class{constructor(e){this._instance=e,this.pf=0,this.gf=[],this.apps={}}get isEnabled(){return!!this._instance.config.opt_in_site_apps}mf(e,t){if(!t)return;const r=this.globalsForEvent(t);this.gf.push(r),this.gf.length>1e3&&(this.gf=this.gf.slice(10))}get siteAppLoaders(){var e;return(e=te._POSTHOG_REMOTE_CONFIG)===null||e===void 0||(e=e[this._instance.config.token])===null||e===void 0?void 0:e.siteApps}initialize(){if(this.isEnabled){const e=this._instance._addCaptureHook(this.mf.bind(this));this.yf=()=>{e(),this.gf=[],this.yf=void 0}}}globalsForEvent(e){var t,r,n,i,s,o,a;if(!e)throw new Error("Event payload is required");const c={},l=this._instance.get_property("$groups")||[],u=this._instance.get_property("$stored_group_properties")||{};for(const[p,f]of Object.entries(u))c[p]={id:l[p],type:p,properties:f};const{$set_once:h,$set:d}=e;return{event:b(b({},rm(e,WP)),{},{properties:b(b(b({},e.properties),d?{$set:b(b({},(t=(r=e.properties)===null||r===void 0?void 0:r.$set)!==null&&t!==void 0?t:{}),d)}:{}),h?{$set_once:b(b({},(n=(i=e.properties)===null||i===void 0?void 0:i.$set_once)!==null&&n!==void 0?n:{}),h)}:{}),elements_chain:(s=(o=e.properties)===null||o===void 0?void 0:o.$elements_chain)!==null&&s!==void 0?s:"",distinct_id:(a=e.properties)===null||a===void 0?void 0:a.distinct_id}),person:{properties:this._instance.get_property("$stored_person_properties")},groups:c}}bf(e){var t;const r=(t=e.tagName)===null||t===void 0?void 0:t.toLowerCase();return r==="style"&&this._instance.config.prepare_external_dependency_stylesheet?this._instance.config.prepare_external_dependency_stylesheet(e)||(Ft.error("prepare_external_dependency_stylesheet returned null"),null):r==="script"&&this._instance.config.prepare_external_dependency_script?this._instance.config.prepare_external_dependency_script(e)||(Ft.error("prepare_external_dependency_script returned null"),null):e}_f(){var e,t,r,n,i,s,o,a;if(!this._instance.config.prepare_external_dependency_stylesheet&&!this._instance.config.prepare_external_dependency_script)return()=>{};const c=N?.defaultView,l=c==null||(e=c.Node)===null||e===void 0?void 0:e.prototype;if(!c||!l)return()=>{};if(this.pf++,this.wf)return this.kf();const u=[],h=this,d=new WeakSet,p=(m,_,w)=>{if(!m?.[_])return;const S=m[_];m[_]=w(S),u.push(()=>{m[_]=S})},f=m=>{if(d.has(m))return m;const _=h.bf(m);return _&&d.add(_),_},v=m=>m.map(_=>typeof _=="string"?_:f(_)).filter(_=>!He(_));return p(l,"appendChild",m=>function(_){const w=f(_);return w?m.call(this,w):_}),p(l,"insertBefore",m=>function(_,w){const S=f(_);return S?m.call(this,S,w):_}),p(l,"replaceChild",m=>function(_,w){const S=f(_);return S?m.call(this,S,w):w}),[(t=c.Element)===null||t===void 0?void 0:t.prototype,(r=c.Document)===null||r===void 0?void 0:r.prototype,(n=c.DocumentFragment)===null||n===void 0?void 0:n.prototype].forEach(m=>{p(m,"append",_=>function(...w){return _.apply(this,v(w))}),p(m,"prepend",_=>function(...w){return _.apply(this,v(w))})}),[(i=c.Element)===null||i===void 0?void 0:i.prototype,(s=c.CharacterData)===null||s===void 0?void 0:s.prototype,(o=c.DocumentType)===null||o===void 0?void 0:o.prototype].forEach(m=>{p(m,"before",_=>function(...w){return _.apply(this,v(w))}),p(m,"after",_=>function(...w){return _.apply(this,v(w))}),p(m,"replaceWith",_=>function(...w){const S=v(w);return w.length&&!S.length?void 0:_.apply(this,S)})}),p((a=c.Element)===null||a===void 0?void 0:a.prototype,"insertAdjacentElement",m=>function(_,w){const S=f(w);return S?m.call(this,_,S):null}),this.wf=()=>{u.forEach(m=>m()),this.wf=void 0},this.kf()}kf(){let e=!1;return()=>{var t;e||(e=!0,this.pf--,this.pf===0&&((t=this.wf)===null||t===void 0||t.call(this)))}}Sf(e,t=!0){const r=this._f();try{const n=e(r);return t&&r(),n}catch(n){throw r(),n}}setupSiteApp(e){const t=this.apps[e.id],r=()=>{var s;!t.errored&&this.gf.length&&(Ft.info(`Processing ${this.gf.length} events for site app with id ${e.id}`),this.gf.forEach(o=>this.Sf(()=>{var a;return(a=t.processEvent)===null||a===void 0?void 0:a.call(t,o)})),t.processedBuffer=!0),Object.values(this.apps).every(o=>o.processedBuffer||o.errored)&&((s=this.yf)===null||s===void 0||s.call(this))};let n=!1;const i=s=>{t.errored=!s,t.loaded=!0,Ft.info(`Site app with id ${e.id} ${s?"loaded":"errored"}`),n&&r()};try{const{processEvent:s}=this.Sf(o=>e.init({posthog:this._instance,callback(a){o(),i(a)}}),!1);s&&(t.processEvent=s),n=!0}catch(s){Ft.error(vp+e.id,s),i(!1)}if(n&&t.loaded)try{r()}catch(s){Ft.error(`Error while processing buffered events PostHog app with config id ${e.id}`,s),t.errored=!0}}xf(){const e=this.siteAppLoaders||[];for(const t of e)this.apps[t.id]={id:t.id,loaded:!1,errored:!1,processedBuffer:!1};for(const t of e)this.setupSiteApp(t)}Cf(e){if(Object.keys(this.apps).length===0)return;const t=this.globalsForEvent(e);for(const r of Object.values(this.apps))try{this.Sf(()=>{var n;return(n=r.processEvent)===null||n===void 0?void 0:n.call(r,t)})}catch(n){Ft.error(`Error while processing event ${e.event} for site app ${r.id}`,n)}}onRemoteConfig(e){var t,r,n;if(!((t=this.siteAppLoaders)===null||t===void 0)&&t.length)return this.isEnabled?(this.xf(),void this._instance.on("eventCaptured",a=>this.Cf(a))):void Ft.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.');if((r=this.yf)===null||r===void 0||r.call(this),!e.ok)return;const i=e.config;if(!((n=i.siteApps)===null||n===void 0)&&n.length)if(this.isEnabled)for(const{id:a,url:c}of i.siteApps){var s,o;te[`__$$ph_site_app_${a}`]=this._instance,(s=te.__PosthogExtensions__)===null||s===void 0||(o=s.loadSiteApp)===null||o===void 0||o.call(s,this._instance,c,l=>{if(l)return Ft.error(vp+a,l)})}else Ft.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}}},_O={tracingHeaders:class{constructor(e){this._instance=e,this.$f=void 0,this.Tf=void 0,this.If=void 0,this.Hv=()=>{const t=this.Mf();var r,n;t?(O(this.$f)&&(this.$f=(r=te.__PosthogExtensions__)===null||r===void 0||(r=r.tracingHeadersPatchFns)===null||r===void 0?void 0:r._patchXHR(t,()=>this._instance.get_distinct_id(),this._instance.sessionManager)),O(this.Tf)&&(this.Tf=(n=te.__PosthogExtensions__)===null||n===void 0||(n=n.tracingHeadersPatchFns)===null||n===void 0?void 0:n._patchFetch(t,()=>this._instance.get_distinct_id(),this._instance.sessionManager))):this.Zv()}}initialize(){this.startIfEnabledOrStop()}zo(e){var t,r,n;!((t=te.__PosthogExtensions__)===null||t===void 0)&&t.tracingHeadersPatchFns?e():(r=te.__PosthogExtensions__)===null||r===void 0||(n=r.loadExternalDependency)===null||n===void 0||n.call(r,this._instance,"tracing-headers",i=>{if(i)return HP.error("failed to load script",i);e()})}Ef(){var e,t;return(e=(t=this._instance.config.tracing_headers)!==null&&t!==void 0?t:this._instance.config.addTracingHeaders)!==null&&e!==void 0?e:this._instance.config.__add_tracing_headers}Mf(){const e=this.Ef();return ce(e)?(ce(this.If)?this.If.splice(0,this.If.length,...e):this.If=[...e],e.length>0?this.If:void 0):(ce(this.If)&&this.If.splice(0),this.If=e||void 0,this.If)}Zv(){var e,t;(e=this.$f)===null||e===void 0||e.call(this),(t=this.Tf)===null||t===void 0||t.call(this),this.$f=void 0,this.Tf=void 0}startIfEnabledOrStop(){this.Mf()?this.zo(this.Hv):this.Zv()}}},yO=b({surveys:class extends ZP{constructor(e){var t;super(new QP(e),(t=e,{get projectToken(){return t.config.token},kv:new XP(t)})),this._instance=e}qh(e,t){const r=t.query?ds(e,t.query):e;return new Promise(n=>{var i;this._instance._send_request({method:t.method,url:this._instance.requestRouter.endpointFor((i=t.target)!==null&&i!==void 0?i:"api",r),data:t.body,headers:t.headers,timeout:t.timeoutMs,fireCallbackOnDrop:!0,transport:t.transport,compression:t.compression,timestampMode:t.sentAt,callback:n})})}}},ma),bO={toolbar:class{constructor(e){this.instance=e}Pf(e){te.ph_toolbar_state=e}Rf(){var e;return(e=te.ph_toolbar_state)!==null&&e!==void 0?e:0}initialize(){return this.maybeLoadToolbar()}maybeLoadToolbar(e=void 0,t=void 0,r=void 0){var n,i;if(hl(this.instance.config)||!A||!N)return!1;e=(n=e)!==null&&n!==void 0?n:A.location,r=(i=r)!==null&&i!==void 0?i:A.history;try{if(!t){try{A.localStorage.setItem("test","test"),A.localStorage.removeItem("test")}catch{return!1}t=A?.localStorage}const s=eO||Ao(e.hash,"__posthog")||Ao(e.hash,"state");let o;const a=s?uh(()=>JSON.parse(atob(decodeURIComponent(s))))||uh(()=>JSON.parse(decodeURIComponent(s))):null;return a&&a.action==="ph_authorize"?(o=a,o.source="url",o&&Object.keys(o).length>0&&(a.desiredHash?e.hash=a.desiredHash:r?r.replaceState(r.state,"",e.pathname+e.search):e.hash="")):(o=JSON.parse(t.getItem(mp)||"{}"),o.source="localstorage",delete o.userIntent),!(!o.token||this.instance.config.token!==o.token||(this.loadToolbar(o),0))}catch{return!1}}Af(e){const t=te.ph_load_toolbar||te.ph_load_editor;!ge(t)&&tt(t)?t(e,this.instance):_p.warn("No toolbar load function found")}loadToolbar(e){const t=!!N?.getElementById("__POSTHOG_TOOLBAR__");if(!A||t)return!1;const r=this.instance.requestRouter.region==="custom"&&this.instance.config.advanced_disable_toolbar_metrics,n=b(b({token:this.instance.config.token},e),{},{apiURL:this.instance.requestRouter.endpointFor("ui")},r?{instrument:!1}:{});if(A.localStorage.setItem(mp,JSON.stringify(b(b({},n),{},{source:void 0}))),this.Rf()===2)this.Af(n);else if(this.Rf()===0){var i,s;this.Pf(1),(i=te.__PosthogExtensions__)===null||i===void 0||(s=i.loadExternalDependency)===null||s===void 0||s.call(i,this.instance,"toolbar",o=>{if(o)return _p.error("[Toolbar] Failed to load",o),void this.Pf(0);this.Pf(2),this.Af(n)}),Ie(A,"turbolinks:load",()=>{this.Pf(0),this.loadToolbar(n)})}return!0}Ff(e){return this.loadToolbar(e)}maybeLoadEditor(e=void 0,t=void 0,r=void 0){return this.maybeLoadToolbar(e,t,r)}}},wO=b({experiments:class ht{get Rr(){return this._instance.config}constructor(t){this._instance=t,this.getWebExperimentsAndEvaluateDisplayLogic=(r=!1)=>{this.getWebExperiments(n=>{ht.Of("retrieved web experiments from the server"),this.Df=new Map,n.forEach(i=>{if(i.feature_flag_key){var s;this.Df&&(ht.Of("setting flag key ",i.feature_flag_key," to web experiment ",i),(s=this.Df)===null||s===void 0||s.set(i.feature_flag_key,i));const o=this._instance.getFeatureFlag(i.feature_flag_key);ye(o)&&i.variants[o]&&this.Lf(i.name,o,i.variants[o].transforms)}else if(i.variants)for(const o in i.variants){const a=i.variants[o];ht.Nf(a,this._instance)&&this.Lf(i.name,o,a.transforms)}})},r)},this._instance.onFeatureFlags(r=>{this.onFeatureFlags(r)})}initialize(){}onFeatureFlags(t){if(this._is_bot())ht.Of(Ap);else if(!this.Rr.disable_web_experiments){if(ge(this.Df))return this.Df=new Map,this.loadIfEnabled(),void this.previewWebExperiment();ht.Of("applying feature flags",t),t.forEach(r=>{var n;if(this.Df&&(!((n=this.Df)===null||n===void 0)&&n.has(r))){var i;const s=this._instance.getFeatureFlag(r),o=(i=this.Df)===null||i===void 0?void 0:i.get(r);s&&o!=null&&o.variants[s]&&this.Lf(o.name,s,o.variants[s].transforms)}})}}previewWebExperiment(){const t=ht.getWindowLocation();if(t?.search){const r=Xn(t?.search,"__experiment_id"),n=Xn(t?.search,"__experiment_variant");r&&n&&(ht.Of(`previewing web experiments ${r} && ${n}`),this.getWebExperiments(i=>{this.qf(parseInt(r),n,i)},!1,!0))}}loadIfEnabled(){this.Rr.disable_web_experiments||this.getWebExperimentsAndEvaluateDisplayLogic()}getWebExperiments(t,r,n){if(this.Rr.disable_web_experiments&&!n)return t([]);const i=this._instance.get_property("$web_experiments");if(i&&!r)return t(i);this._instance._send_request({url:this._instance.requestRouter.endpointFor("api",`/api/web_experiments/?token=${this.Rr.token}`),method:"GET",timestampMode:"query",callback:s=>t(s.statusCode===200&&s.json&&s.json.experiments||[])})}qf(t,r,n){const i=n.filter(s=>s.id===t);i&&i.length>0&&(ht.Of(`Previewing web experiment [${i[0].name}] with variant [${r}]`),this.Lf(i[0].name,r,i[0].variants[r].transforms))}static Nf(t,r){return!ge(t.conditions)&&ht.jf(t,r)&&ht.Bf(t)}static jf(t,r){var n;if(ge(t.conditions)||ge((n=t.conditions)===null||n===void 0?void 0:n.url))return!0;const i=ht.getWindowLocation();if(i){var s,o,a;const c=Mm(r,i.href);return!(!((s=t.conditions)===null||s===void 0)&&s.url)||oO[(o=(a=t.conditions)===null||a===void 0?void 0:a.urlMatchType)!==null&&o!==void 0?o:"icontains"](t.conditions.url,c)}return!1}static getWindowLocation(){return A?.location}static Bf(t){var r;if(ge(t.conditions)||ge((r=t.conditions)===null||r===void 0?void 0:r.utm))return!0;const n=Gm();if(n.utm_source){var i,s,o,a,c,l,u,h;const d=!(!((i=t.conditions)===null||i===void 0||(i=i.utm)===null||i===void 0)&&i.utm_campaign)||((s=t.conditions)===null||s===void 0||(s=s.utm)===null||s===void 0?void 0:s.utm_campaign)==n.utm_campaign,p=!(!((o=t.conditions)===null||o===void 0||(o=o.utm)===null||o===void 0)&&o.utm_source)||((a=t.conditions)===null||a===void 0||(a=a.utm)===null||a===void 0?void 0:a.utm_source)==n.utm_source,f=!(!((c=t.conditions)===null||c===void 0||(c=c.utm)===null||c===void 0)&&c.utm_medium)||((l=t.conditions)===null||l===void 0||(l=l.utm)===null||l===void 0?void 0:l.utm_medium)==n.utm_medium,v=!(!((u=t.conditions)===null||u===void 0||(u=u.utm)===null||u===void 0)&&u.utm_term)||((h=t.conditions)===null||h===void 0||(h=h.utm)===null||h===void 0?void 0:h.utm_term)==n.utm_term;return d&&f&&v&&p}return!1}static Of(t,...r){j.info(`[WebExperiments] ${t}`,r)}Lf(t,r,n){this._is_bot()?ht.Of(Ap):r!=="control"?n.forEach(i=>{if(i.selector){var s;ht.Of(`applying transform of variant ${r} for experiment ${t} `,i),((s=document)===null||s===void 0?void 0:s.querySelectorAll(i.selector))?.forEach(o=>{const a=o;i.html&&(a.innerHTML=i.html),i.css&&a.setAttribute("style",i.css)})}}):ht.Of("Control variants leave the page unmodified.")}_is_bot(){return rt&&this._instance?m_(rt,this.Rr.custom_blocked_useragents):void 0}}},ma),SO={conversations:class{constructor(e){this._instance=e,this.Hf=void 0,this._conversationsManager=null,this.zf=!1,this.ne=null,this.Uf=!1}initialize(){this.loadIfEnabled()}onRemoteConfig(e){if(this._instance.config.disable_conversations||(this.Wf=e.ok,!e.ok))return;const t=e.config.conversations;ge(t)||(vt(t)?this.Hf=t:(this.Hf=t.enabled,this.ne=t),this.loadIfEnabled())}reset(){var e;(e=this._conversationsManager)===null||e===void 0||e.reset(),this._conversationsManager=null,this.Hf=void 0,this.ne=null,this.Wf=void 0,this.Uf=!1}loadIfEnabled(){if(this._conversationsManager||this.zf||this._instance.config.disable_conversations||hl(this._instance.config)||this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())return;const e=te?.__PosthogExtensions__;if(e&&!O(this.Hf)&&this.Hf)if(this.ne&&this.ne.token){this.zf=!0;try{const t=e.initConversations;if(t)return this.Vf(t),void(this.zf=!1);const r=e.loadExternalDependency;if(!r)return void this.Gf(Tu);r(this._instance,"conversations",n=>{n||!e.initConversations?this.Gf("Could not load conversations script",n):this.Vf(e.initConversations),this.zf=!1})}catch(t){this.Gf("Error initializing conversations",t),this.zf=!1}}else kt.error("Conversations enabled but missing token in remote config.")}Vf(e){if(this.ne)try{this._conversationsManager=e(this.ne,this._instance),this.Uf=!1,kt.info("Conversations loaded successfully")}catch(t){this.Gf("Error completing conversations initialization",t)}else kt.error("Cannot complete initialization: remote config is null")}Gf(e,t){kt.error(e,t),this._conversationsManager=null,this.zf=!1,this.Uf=!0}show(){this._conversationsManager?this._conversationsManager.show():kt.warn("Conversations not loaded yet.")}hide(){this._conversationsManager&&this._conversationsManager.hide()}isAvailable(){return this.Hf===!0&&!He(this._conversationsManager)}getUnavailableReason(){return this.isAvailable()?null:this._instance.config.disable_conversations?"disabled_by_config":hl(this._instance.config)?"disabled_for_toolbar":this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut()?"consent_opted_out":this.Wf===!1?"remote_config_failed":O(this.Hf)?this.Wf?"disabled_in_project":"remote_config_pending":this.Hf?ge(this.ne)||!this.ne.token?"missing_token":te?.__PosthogExtensions__?this.zf?"initializing":this.Uf?"load_failed":"not_loaded":"extensions_unavailable":"disabled_in_project"}isVisible(){var e,t;return(e=(t=this._conversationsManager)===null||t===void 0?void 0:t.isVisible())!==null&&e!==void 0&&e}sendMessage(e,t,r){var n=this;return Ue(function*(){return n._conversationsManager?n._conversationsManager.sendMessage(e,t,r):(kt.warn(Jr),null)})()}getMessages(e,t){var r=this;return Ue(function*(){return r._conversationsManager?r._conversationsManager.getMessages(e,t):(kt.warn(Jr),null)})()}markAsRead(e){var t=this;return Ue(function*(){return t._conversationsManager?t._conversationsManager.markAsRead(e):(kt.warn(Jr),null)})()}getTickets(e){var t=this;return Ue(function*(){return t._conversationsManager?t._conversationsManager.getTickets(e):(kt.warn(Jr),null)})()}requestRestoreLink(e){var t=this;return Ue(function*(){return t._conversationsManager?t._conversationsManager.requestRestoreLink(e):(kt.warn(Jr),null)})()}restoreFromToken(e){var t=this;return Ue(function*(){return t._conversationsManager?t._conversationsManager.restoreFromToken(e):(kt.warn(Jr),null)})()}restoreFromUrlToken(){var e=this;return Ue(function*(){return e._conversationsManager?e._conversationsManager.restoreFromUrlToken():(kt.warn(Jr),null)})()}getCurrentTicketId(){var e,t;return(e=(t=this._conversationsManager)===null||t===void 0?void 0:t.getCurrentTicketId())!==null&&e!==void 0?e:null}getWidgetSessionId(){var e,t;return(e=(t=this._conversationsManager)===null||t===void 0?void 0:t.getWidgetSessionId())!==null&&e!==void 0?e:null}Sh(){var e;(e=this._conversationsManager)===null||e===void 0||e.setIdentity()}xh(){var e;(e=this._conversationsManager)===null||e===void 0||e.clearIdentity()}}},EO={logs:class{constructor(e){var t;this._instance=e,this.name="logs",this.Zf=!1,this.Qf=!1,this.Jf=!1,this.$=Be("[logs]"),this.Kf=b(b({},this.$),{},{error:(...r)=>{r.some(Cp)||this.$.error(...r)}}),this.al=[],this.Xf=[],this.hd=0,this.Io=!1,this.Yf=[],this.tp=[],this.ep=!1,this.np=!1,this.sp=()=>{var r,n;this.Io||(this.hd=0,(r=this.rp)===null||r===void 0||r.onReconnect(),(n=this.op)===null||n===void 0||n.onReconnect())},this._instance&&(t=this._instance.config.logs)!==null&&t!==void 0&&t.captureConsoleLogs&&(this.Zf=!0),A&&Ie(A,"online",this.sp)}ap(e,t,r,n){var i;const s=Ip((i=this._instance)===null||i===void 0||(i=i.config)===null||i===void 0?void 0:i.logs,r);return[new t$(this.lp(e,t),s,this.Kf,()=>this.up(),o=>o(),void 0,n),s]}hp(){var e;const t=(e=this._instance)===null||e===void 0||(e=e.config)===null||e===void 0?void 0:e.logs;var r;return this.rp&&this.cp===t||((r=this.rp)===null||r===void 0||r.reset(),this.cp=t,[this.rp,this.dp]=this.ap(()=>this.al,n=>{this.al=n})),this.rp}vp(){var e;const t=(e=this._instance)===null||e===void 0||(e=e.config)===null||e===void 0?void 0:e.logs;var r;return this.op&&this.fp===t||((r=this.op)===null||r===void 0||r.reset(),this.fp=t,[this.op,this.pp]=this.ap(()=>this.Xf,n=>{this.Xf=n},{serviceNameDefault:"posthog-browser-logs",consoleCapture:!0},Tp)),this.op}setup(e){var t;if(this.Io)return;this.wo=e,(t=this._instance)!==null&&t!==void 0&&(t=t.config)!==null&&t!==void 0&&(t=t.logs)!==null&&t!==void 0&&t.captureConsoleLogs&&(this.Zf=!0),(this.Zf||this.gp()&&this.mp())&&this.yp();let r=!1;const n=e.onRemoteConfig(i=>{var s;r=i.ok&&((s=i.config.logs)===null||s===void 0?void 0:s.captureConsoleLogs)===!0,this.onRemoteConfig(i)});this.Io?n.dispose():(this.Po=n,r||this.loadIfEnabled())}dispose(){var e,t,r,n;this.Io||(this.Io=!0,this.bp(),(e=this.Po)===null||e===void 0||e.dispose(),this.Po=void 0,this.wo=void 0,this.Jf=!1,A?.removeEventListener("online",this.sp),(t=this._p)===null||t===void 0||t.call(this),this._p=void 0,(r=this.rp)===null||r===void 0||r.reset(),(n=this.op)===null||n===void 0||n.reset())}onRemoteConfig(e){var t,r;if(this.Io)return;const n=e.ok?(t=e.config.logs)===null||t===void 0?void 0:t.captureConsoleLogs:void 0;ge(n)?this.wp():((r=this._instance)===null||r===void 0||(r=r.persistence)===null||r===void 0||r.register({$logs_capture_enabled_server_side:!!n}),n?(this.Zf=!0,this.Qf||this.yp(),this.loadIfEnabled()):this.wp())}reset(){var e,t,r,n;this.bp(),(e=this.rp)===null||e===void 0||e.clearQueue(),this.al=[],(t=this.rp)===null||t===void 0||t.reset(),(r=this.op)===null||r===void 0||r.clearQueue(),this.Xf=[],(n=this.op)===null||n===void 0||n.reset(),this.hd=0}captureLog(e){this.Io||this.hp().captureLog(e)}captureConsoleLog(e){this.Io||this.vp().captureLog(e)}captureBufferedConsoleLog(e,t,r){this.Io||this.vp().captureLog(e,{context:t,occurredAtMs:r})}mp(){var e;return!!(!((e=this._instance)===null||e===void 0||(e=e.persistence)===null||e===void 0||(e=e.props)===null||e===void 0)&&e[vm])}gp(){var e,t,r;return!(!((e=this._instance)===null||e===void 0||(t=e.nl)===null||t===void 0)&&t.call(e))||!!(!((r=te._POSTHOG_REMOTE_CONFIG)===null||r===void 0||(r=r[this._instance.config.token])===null||r===void 0)&&r.config)}$h(){var e;this.bp(),(e=this.op)===null||e===void 0||e.clearQueue(),this.Xf=[]}wp(){this.Zf||this.bp()}yp(){var e;if(this.ep||!te?.console)return;const t=Ip((e=this._instance)===null||e===void 0||(e=e.config)===null||e===void 0?void 0:e.logs).maxBufferSize;let r=!0;this.tp.push(()=>{r=!1});for(const n of aO){let i;try{i=cO(te.console[n])}catch{continue}i&&this.tp.push(ss(te.console,n,s=>{const o=(...a)=>{try{r&&this.kp(n,a,t)}catch{}return s.apply(te.console,a)};return o.__rrweb_original__=i,o}))}this.ep=!0,this.Sp=setTimeout(()=>{this.bp()},3e4)}kp(e,t,r){var n;if(this.ep&&!this.np&&t.length!==0)if(!((n=this._instance)===null||n===void 0)&&n.is_capturing()){if(r>this.Yf.length){this.np=!0;try{this.Yf.push({level:e,args:t,occurredAtMs:Date.now(),context:this.up()})}finally{this.np=!1}}}else this.bp()}bp(){if(this.Yf=[],this.ep){this.ep=!1,this.Sp&&(clearTimeout(this.Sp),this.Sp=void 0);for(const e of this.tp)e();this.tp=[]}}xp(){const e=this.Yf;return this.bp(),e}get logger(){return this.Cp||(this.Cp={trace:(e,t)=>this.captureLog({body:e,level:"trace",attributes:t}),debug:(e,t)=>this.captureLog({body:e,level:"debug",attributes:t}),info:(e,t)=>this.captureLog({body:e,level:"info",attributes:t}),warn:(e,t)=>this.captureLog({body:e,level:"warn",attributes:t}),error:(e,t)=>this.captureLog({body:e,level:"error",attributes:t}),fatal:(e,t)=>this.captureLog({body:e,level:"fatal",attributes:t})}),this.Cp}flushLogs(e){e?this.$p(e):(this.rp&&this.rp.flush().catch(t=>this.Tp(t)),this.op&&this.op.flush().catch(t=>this.Tp(t)))}Tp(e){Cp(e)||this.$.error("PostHog logs flush failed:",e)}loadIfEnabled(){if(this.Io||!this.Zf||this.Qf||this.Jf)return;const e=te?.__PosthogExtensions__;if(!e)return this.$.error("PostHog Extensions not found."),void this.bp();const t=e.loadExternalDependency;if(!t)return this.$.error(Tu),void this.bp();this.Jf=!0;try{t(this._instance,"logs",r=>{if(this.Jf=!1,this.Io||!this.Zf)return;const n=e.logs;if(r||!n?.initializeLogs)this.$.error("Could not load logs script",r),this.bp();else{var i;const a=this.xp();var s,o;this._p=n.initializeLogs((i=this.wo)!==null&&i!==void 0?i:this._instance),this.Qf=!0,a.length>0&&((s=n.replayConsoleBuffer)===null||s===void 0||s.call(n,(o=this.wo)!==null&&o!==void 0?o:this._instance,a))}})}catch(r){throw this.Jf=!1,r}}lp(e,t){const r=this._instance;return{get isDisabled(){return!1},get optedOut(){return!r.is_capturing()},getPersistedProperty:n=>n===Ht.LogsQueue?e():void 0,setPersistedProperty(n,i){var s;n===Ht.LogsQueue&&t((s=i)!==null&&s!==void 0?s:[])},js:n=>this.js(n),getLibraryId:()=>et.LIB_NAME,getLibraryVersion:()=>et.LIB_VERSION}}js(e){return new Promise(t=>{if(Vm(this.hd,3))return void t({kind:"fatal",error:pc(void 0,"logs endpoint is unreachable, dropping batch")});let r=!1;const n=s=>{r||(r=!0,clearTimeout(i),t(s))},i=setTimeout(()=>{this.$.warn("Logs request timed out before receiving a response"),n({kind:"retry-later",error:pc(void 0,"logs request timed out")})},9e4);this._instance._send_request({method:"POST",url:this.Ip(),data:e,compression:"best-available",batchKey:"logs",fireCallbackOnDrop:!0,callback:s=>{const o=s.statusCode;if(this.Mp(o),o>=200&&300>o)n({kind:"ok"});else if(o===413)n({kind:"too-large"});else if(o!==0&&o!==408&&o!==429&&500>o)n({kind:"fatal",error:new Error(`logs request failed with status ${o}`)});else{var a;o===0?(s.error||this.$.warn("Logs request failed before receiving an HTTP response"),n({kind:"retry-later",error:pc(s.error,"logs request failed before receiving an HTTP response")})):n({kind:"retry-later",error:(a=s.error)!==null&&a!==void 0?a:new Error(`logs request failed with status ${o}`)})}}})})}Mp(e){(e!==0||this._instance.__loaded)&&(this.hd=Bm(e,this.hd,3,()=>this.$.warn("Log requests are failing before receiving an HTTP response; this can happen due to network issues, CORS, browser blocking, or ad blockers. Stopped sending logs; will try again when connectivity changes.")))}$p(e){this.al.length>0&&this.Ep(e,this.al,this.dp,et.LIB_NAME,t=>{this.al=t}),this.Xf.length>0&&this.Ep(e,this.Xf,this.pp,Tp,t=>{this.Xf=t})}Ep(e,t,r,n,i){if(t.length===0)return;const s=t.map(a=>a.record);i([]);const o=cm(s,am(r,et.LIB_NAME,et.LIB_VERSION),n,et.LIB_VERSION);this._instance._send_request({method:"POST",url:this.Ip(),data:o,compression:"best-available",batchKey:"logs",transport:e})}Ip(){return this._instance.requestRouter.endpointFor("api","/i/v1/logs")+"?token="+encodeURIComponent(this._instance.config.token)}up(){var e;const t={};if(t.distinctId=this._instance.get_distinct_id(),this._instance.sessionManager){const{sessionId:r,windowId:n,sessionStartTimestamp:i,lastActivityTimestamp:s}=this._instance.sessionManager.checkAndGetSessionAndWindowId(!0);t.sessionId=r,t.windowId=n,ge(i)||(t.sessionStartTimestamp=i),ge(s)||(t.lastActivityTimestamp=s)}if(te!=null&&(e=te.location)!==null&&e!==void 0&&e.href&&(t.currentUrl=this._instance.config.disable_capture_url_hashes?Ur(te.location.href):te.location.href),this._instance.featureFlags){const r=this._instance.featureFlags.getFlags();r&&r.length>0&&(t.activeFeatureFlags=r)}return t}}},kO={metrics:class{constructor(e){this._instance=e,this.$=Be("[metrics]"),this.Io=!1}initialize(){this.onConfigChange()}onConfigChange(){var e;if(this.Io)return;const t=!!(!((e=this._instance.config.metrics)===null||e===void 0)&&e.network);t&&!this.Pp?this.Pp=(r=>{let n=!0;const i=()=>n?(a=>{var c;const l=(c=a.config.metrics)===null||c===void 0?void 0:c.network;return l===!0?{}:l||void 0})(r):void 0,s=dO(r,i),o=hO(r,i);return()=>{n=!1,s(),o()}})(this._instance):!t&&this.Pp&&(this.Pp(),this.Pp=void 0)}hp(){var e;const t=(e=this._instance)===null||e===void 0||(e=e.config)===null||e===void 0?void 0:e.metrics;var r;return this.rp&&this.cp===t||((r=this.rp)===null||r===void 0||r.reset(),this.cp=t,this.rp=new r$(this.lp(),(function(n){var i,s,o,a,c;const l=n?.resourceAttributes;return{serviceName:(i=l?.["service.name"])!==null&&i!==void 0?i:n?.serviceName,serviceVersion:(s=l?.["service.version"])!==null&&s!==void 0?s:n?.serviceVersion,environment:(o=l?.["deployment.environment"])!==null&&o!==void 0?o:n?.environment,resourceAttributes:l,beforeSend:n?.beforeSend,flushIntervalMs:(a=n?.flushIntervalMs)!==null&&a!==void 0?a:1e4,maxSeriesPerFlush:(c=n?.maxSeriesPerFlush)!==null&&c!==void 0?c:1e3}})(t),this.$)),this.rp}count(e,t=1,r){this.hp().count(e,t,r)}gauge(e,t,r){this.hp().gauge(e,t,r)}histogram(e,t,r){this.hp().histogram(e,t,r)}flush(e){if(!this.rp)return Promise.resolve();if(e){const t=this.rp.drainWindow();return t&&this.Ys(t,e),Promise.resolve()}return this.rp.flush().catch(t=>this.$.error("PostHog metrics flush failed:",t))}reset(){var e;(e=this.rp)===null||e===void 0||e.reset()}dispose(){var e,t;this.Io=!0,(e=this.Pp)===null||e===void 0||e.call(this),this.Pp=void 0,(t=this.rp)===null||t===void 0||t.reset()}lp(){const e=this._instance,t=this;return{get isDisabled(){return!1},get optedOut(){return!e.is_capturing()},Ys:r=>t.Ys(r),getLibraryId:()=>et.LIB_NAME,getLibraryVersion:()=>et.LIB_VERSION}}Ys(e,t){return new Promise(r=>{let n=!1;const i=o=>{n||(n=!0,clearTimeout(s),r(o))},s=setTimeout(()=>i({kind:"retry-later",error:new Error("metrics request timed out")}),9e4);this._instance._send_request(b(b({method:"POST",url:this.Rp(),data:e,compression:"best-available",batchKey:"metrics"},t&&{transport:t}),{},{fireCallbackOnDrop:!0,callback(o){const a=o.statusCode;if(a>=200&&300>a)i({kind:"ok"});else if(a===413)i({kind:"too-large"});else if(a!==0&&a!==408&&a!==429&&500>a)i({kind:"fatal",error:new Error(`metrics request failed with status ${a}`)});else{var c;i({kind:"retry-later",error:(c=o.error)!==null&&c!==void 0?c:new Error(`metrics request failed with status ${a}`)})}}}))})}Rp(){return this._instance.requestRouter.endpointFor("api","/i/v1/metrics")+"?token="+encodeURIComponent(this._instance.config.token)}}};Hi.__defaultExtensionClasses=b({},b(b(b(b(b(b(b(b(b(b(b(b(b({},ma),pO),fO),vO),gO),mO),yO),_O),bO),wO),SO),EO),kO));var RO=(function(){et.SDK_DIST_CHANNEL="npm";const e=qi[Ci]=new Hi;return(function(){function t(){t.done||(t.done=!0,v_=!1,Ce(qi,function(r){r._dom_loaded()}))}N?.addEventListener?N.readyState==="complete"?t():Ie(N,"DOMContentLoaded",t,{capture:!1}):A&&j.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")})(),e})(),AO=RO,IO=/\.[cm]?[jt]sx?$/,TO=/^(?:[a-z][a-z0-9+.-]*:\/\/|\/)/i;function CO(e,t){if(typeof e!="string"||!TO.test(e))return!1;let r;try{r=new URL(e,t)}catch{return!1}return r.origin!==t?!1:!IO.test(r.pathname)}function $O(e,t){return e.length===0?!1:e.every(r=>CO(r,t))}function PO(e,t){return e.length===0?!1:e.every(r=>$O(r,t))}var C_=new Set(["caniuse.dev","www.caniuse.dev"]),OO=new Set(["score.mcpjam.com","www.score.mcpjam.com"]),xO=new Set([...C_,...OO]),jL="https://app.mcpjam.com";function MO(e){return C_.has(e.toLowerCase())}function HL(e=typeof window>"u"?void 0:window.location.hostname){return!!e&&MO(e)}var LO="phc_dTOPniyUNU2kD8Jx8yHMXSqiZHM8I91uWopTMX6EBE9",DO="https://us.i.posthog.com";function NO(){return typeof window<"u"&&window.location?.origin?.startsWith("http")?`${window.location.origin}/tlm`:DO}function $_(e){const t=Sc()?.guestId,r=e&&Object.keys(e).length>0?e:void 0;return!t&&!r?{}:{bootstrap:{...t?{distinctID:t,isIdentifiedID:!1}:{},...r?{featureFlags:r}:{}}}}var zO={advanced_disable_feature_flags:!0,advanced_disable_feature_flags_on_first_load:!0},UO=["/results/","/conformance/shared/","/evals/shared/"];function P_(e){let t=e;for(const r of UO){const n=r.replace(/[/\-\\^$*+?.()|[\]{}]/g,"\\$&");t=t.replace(new RegExp(`(${n})[^/?#]+`,"g"),"$1[redacted]")}return t=t.replace(/(\/organizations\/)[^/?#]+/g,"$1[redacted]"),t}var FO=new Set(["Load failed","Failed to fetch","NetworkError when attempting to fetch resource."]),qO=/^'TypeError' captured as exception with message: '([\s\S]*)'$/;function jO(e){const t=qO.exec(e.value),r=t?t[1]:e.type==="TypeError"?e.value:void 0;return r===void 0?!1:FO.has(r)||r.startsWith("Failed to fetch (")&&r.endsWith(")")}var HO=1e4;function VO(e){const t=e.$exception_list;if(!(Array.isArray(t)&&t.some(i=>typeof i?.value=="string"&&jO(i))))return;const r=ty();if(!r)return;const n=Date.now()-r.at;n>HO||(e.failed_request=`${r.method} ${P_(r.target)}`,e.failed_request_age_ms=n)}function BO(e,t){for(const r of["$current_url","$referrer","$pathname","$session_entry_url","$session_entry_pathname","$session_entry_referrer","$initial_current_url","$initial_pathname","$initial_referrer"])typeof e[r]=="string"&&(e[r]=P_(e[r]));return t==="$exception"&&VO(e),e}function GO(e){if(e?.event!=="$exception"||typeof window>"u")return e;const t=e.properties?.$exception_list;if(!Array.isArray(t))return e;const r=t.map(n=>{const i=n?.stacktrace?.frames;return Array.isArray(i)?i.map(s=>s?.filename):[]});return PO(r,window.location.origin)?null:e}var WO=xO;function hs(){return ZO()}function ZO(){return typeof window<"u"&&window.isElectron===!0}var JO="data-ph-no-capture",KO={maskAllInputs:!0,maskInputOptions:{password:!0},maskTextSelector:`[${JO}]`};function zu(e=typeof window>"u"?void 0:window.location?.pathname){return!!e&&(e.startsWith("/results/")||e.startsWith("/conformance/shared/")||e.startsWith("/evals/shared/"))}function YO(){return hs()&&!zu()}var fc=!1;function VL(e,t){try{if(!hs())return;if(zu(t)){e.sessionRecordingStarted?.()&&(fc=!0),e.stopSessionRecording?.();return}fc&&(fc=!1,e.startSessionRecording?.())}catch{}}function XO(e=typeof window>"u"?void 0:window.location?.hostname){const t=!!e&&WO.has(e.toLowerCase());return{capture_pageview:t?"history_change":!1,capture_pageleave:t}}var $p={api_host:NO(),ui_host:"https://us.posthog.com",...$_(),...XO(),...zO,person_profiles:"always",sanitize_properties:BO,before_send:GO,capture_dead_clicks:!0,get capture_exceptions(){return hs()},get disable_session_recording(){return!YO()},session_recording:KO,loaded:e=>{e.register({environment:"production",platform:Rl(),version:"3.12.7",deployment:"self_hosted",source:"client"}),e.setPersonPropertiesForFlags?.({local_browser_security_version:"1",deployment:"self_hosted",platform:Rl()})}};function QO(e){const t=$_(e);return"bootstrap"in t?Object.defineProperties({},{...Object.getOwnPropertyDescriptors($p),bootstrap:{value:t.bootstrap,enumerable:!0,configurable:!0,writable:!0}}):$p}var BL=()=>LO,GL=e=>QO(e);function Rl(){if(window?.isElectron){const e=navigator.userAgent.toLowerCase();return e.includes("mac")||e.includes("darwin")?"mac":e.includes("win")?"win":"electron"}return"npm"}function e1(){return"production"}function WL(e){const t=e1();return{location:e,platform:Rl(),...t!==void 0?{environment:t}:{}}}var Vt=[],At=[],t1=Uint8Array,vc="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(var An=0,r1=vc.length;An<r1;++An)Vt[An]=vc[An],At[vc.charCodeAt(An)]=An;At[45]=62;At[95]=63;function n1(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=e.indexOf("=");r===-1&&(r=t);var n=r===t?0:4-r%4;return[r,n]}function i1(e,t,r){return(t+r)*3/4-r}function Oo(e){for(var t,r=n1(e),n=r[0],i=r[1],s=new t1(i1(e,n,i)),o=0,a=i>0?n-4:n,c=0;c<a;c+=4)t=At[e.charCodeAt(c)]<<18|At[e.charCodeAt(c+1)]<<12|At[e.charCodeAt(c+2)]<<6|At[e.charCodeAt(c+3)],s[o++]=t>>16&255,s[o++]=t>>8&255,s[o++]=t&255;return i===2&&(t=At[e.charCodeAt(c)]<<2|At[e.charCodeAt(c+1)]>>4,s[o++]=t&255),i===1&&(t=At[e.charCodeAt(c)]<<10|At[e.charCodeAt(c+1)]<<4|At[e.charCodeAt(c+2)]>>2,s[o++]=t>>8&255,s[o++]=t&255),s}function s1(e){return Vt[e>>18&63]+Vt[e>>12&63]+Vt[e>>6&63]+Vt[e&63]}function o1(e,t,r){for(var n,i=[],s=t;s<r;s+=3)n=(e[s]<<16&16711680)+(e[s+1]<<8&65280)+(e[s+2]&255),i.push(s1(n));return i.join("")}function xo(e){for(var t,r=e.length,n=r%3,i=[],s=16383,o=0,a=r-n;o<a;o+=s)i.push(o1(e,o,o+s>a?a:o+s));return n===1?(t=e[r-1],i.push(Vt[t>>2]+Vt[t<<4&63]+"==")):n===2&&(t=(e[r-2]<<8)+e[r-1],i.push(Vt[t>>10]+Vt[t>>4&63]+Vt[t<<2&63]+"=")),i.join("")}function ZL(e){if(e===void 0)return{};if(!O_(e))throw new Error(`The arguments to a Convex function must be an object. Received: ${e}`);return e}function JL(e){if(typeof e>"u")throw new Error("Client created with undefined deployment address. If you used an environment variable, check that it's set.");if(typeof e!="string")throw new Error(`Invalid deployment address: found ${e}".`);if(!(e.startsWith("http:")||e.startsWith("https:")))throw new Error(`Invalid deployment address: Must start with "https://" or "http://". Found "${e}".`);try{new URL(e)}catch{throw new Error(`Invalid deployment address: "${e}" is not a valid URL. If you believe this URL is correct, use the \`skipConvexDeploymentUrlCheck\` option to bypass this.`)}if(e.endsWith(".convex.site"))throw new Error(`Invalid deployment address: "${e}" ends with .convex.site, which is used for HTTP Actions. Convex deployment URLs typically end with .convex.cloud? If you believe this URL is correct, use the \`skipConvexDeploymentUrlCheck\` option to bypass this.`)}function O_(e){const t=typeof e=="object",r=Object.getPrototypeOf(e),n=r===null||r===Object.prototype||r?.constructor?.name==="Object";return t&&n}var x_=!0,ti=BigInt("-9223372036854775808"),Uu=BigInt("9223372036854775807"),Al=BigInt("0"),a1=BigInt("8"),c1=BigInt("256"),gc="This commit timestamp is unresolved: its value is assigned when the mutation commits. Read the document after the mutation completes to get its value.",M_=class{[Symbol.toPrimitive](e){if(e==="string")return this.toString();throw new Error(gc)}valueOf(){throw new Error(gc)}toJSON(){throw new Error(gc)}toString(){return"[unresolved commit timestamp]"}},l1=new M_;function L_(e){return Number.isNaN(e)||!Number.isFinite(e)||Object.is(e,-0)}function u1(e){e<Al&&(e-=ti+ti);let t=e.toString(16);t.length%2===1&&(t="0"+t);const r=new Uint8Array(new ArrayBuffer(8));let n=0;for(const i of t.match(/.{2}/g).reverse())r.set([parseInt(i,16)],n++),e>>=a1;return xo(r)}function d1(e){const t=Oo(e);if(t.byteLength!==8)throw new Error(`Received ${t.byteLength} bytes, expected 8 for $integer`);let r=Al,n=Al;for(const i of t)r+=BigInt(i)*c1**n,n++;return r>Uu&&(r+=ti+ti),r}function h1(e){if(e<ti||Uu<e)throw new Error(`BigInt ${e} does not fit into a 64-bit signed integer.`);const t=new ArrayBuffer(8);return new DataView(t).setBigInt64(0,e,!0),xo(new Uint8Array(t))}function p1(e){const t=Oo(e);if(t.byteLength!==8)throw new Error(`Received ${t.byteLength} bytes, expected 8 for $integer`);return new DataView(t.buffer).getBigInt64(0,!0)}var f1=DataView.prototype.setBigInt64?h1:u1,v1=DataView.prototype.getBigInt64?p1:d1,Pp=1024;function Il(e){if(e.length>Pp)throw new Error(`Field name ${e} exceeds maximum field name length ${Pp}.`);if(e.startsWith("$"))throw new Error(`Field name ${e} starts with a '$', which is reserved.`);for(let t=0;t<e.length;t+=1){const r=e.charCodeAt(t);if(r<32||r>=127)throw new Error(`Field name ${e} has invalid character '${e[t]}': Field names can only contain non-control ASCII characters`)}}function Op(e){if(e===null||typeof e=="boolean"||typeof e=="number"||typeof e=="string")return e;if(Array.isArray(e))return e.map(n=>Op(n));if(typeof e!="object")throw new Error(`Unexpected type of ${e}`);const t=Object.entries(e);if(t.length===1){const n=t[0][0];if(n==="$bytes"){if(typeof e.$bytes!="string")throw new Error(`Malformed $bytes field on ${e}`);return Oo(e.$bytes).buffer}if(n==="$integer"){if(typeof e.$integer!="string")throw new Error(`Malformed $integer field on ${e}`);return v1(e.$integer)}if(n==="$float"){if(typeof e.$float!="string")throw new Error(`Malformed $float field on ${e}`);const i=Oo(e.$float);if(i.byteLength!==8)throw new Error(`Received ${i.byteLength} bytes, expected 8 for $float`);const s=new DataView(i.buffer).getFloat64(0,x_);if(!L_(s))throw new Error(`Float ${s} should be encoded as a number`);return s}if(n==="$commitTs"){if(e.$commitTs!==null)throw new Error(`Malformed $commitTs field on ${e}`);return l1}if(n==="$set")throw new Error("Received a Set which is no longer supported as a Convex type.");if(n==="$map")throw new Error("Received a Map which is no longer supported as a Convex type.")}const r={};for(const[n,i]of Object.entries(e))Il(n),r[n]=Op(i);return r}var g1=16384;function Hn(e){const t=JSON.stringify(e,(r,n)=>n===void 0?"undefined":typeof n=="bigint"?`${n.toString()}n`:n);if(t.length>g1){const r="[...truncated]";let n=16370;const i=t.codePointAt(n-1);return i!==void 0&&i>65535&&(n-=1),t.substring(0,n)+r}return t}function Mo(e,t,r,n){if(e===void 0){const o=r&&` (present at path ${r} in original object ${Hn(t)})`;throw new Error(`undefined is not a valid Convex value${o}. To learn about Convex's supported types, see https://docs.convex.dev/using/types.`)}if(e===null)return e;if(typeof e=="bigint"){if(e<ti||Uu<e)throw new Error(`BigInt ${e} does not fit into a 64-bit signed integer.`);return{$integer:f1(e)}}if(typeof e=="number")if(L_(e)){const o=new ArrayBuffer(8);return new DataView(o).setFloat64(0,e,x_),{$float:xo(new Uint8Array(o))}}else return e;if(typeof e=="boolean"||typeof e=="string")return e;if(e instanceof ArrayBuffer)return{$bytes:xo(new Uint8Array(e))};if(e instanceof M_)return{$commitTs:null};if(Array.isArray(e))return e.map((o,a)=>Mo(o,t,r+`[${a}]`,!1));if(e instanceof Set)throw new Error(mc(r,"Set",[...e],t));if(e instanceof Map)throw new Error(mc(r,"Map",[...e],t));if(!O_(e)){const o=e?.constructor?.name,a=o?`${o} `:"";throw new Error(mc(r,a,e,t))}const i={},s=Object.entries(e);s.sort(([o,a],[c,l])=>o===c?0:o<c?-1:1);for(const[o,a]of s)a!==void 0?(Il(o),i[o]=Mo(a,t,r+`.${o}`,!1)):n&&(Il(o),i[o]=m1(a,t,r+`.${o}`));return i}function mc(e,t,r,n){return e?`${t}${Hn(r)} is not a supported Convex type (present at path ${e} in original object ${Hn(n)}). To learn about Convex's supported types, see https://docs.convex.dev/using/types.`:`${t}${Hn(r)} is not a supported Convex type.`}function m1(e,t,r){if(e===void 0)return{$undefined:null};if(t===void 0)throw new Error(`Programming error. Current value is ${Hn(e)} but original value is undefined`);return Mo(e,t,r,!1)}function KL(e){return Mo(e,e,"",!1)}var _1=Object.defineProperty,y1=(e,t,r)=>t in e?_1(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,_c=(e,t,r)=>y1(e,typeof t!="symbol"?t+"":t,r),xp,Mp,b1=Symbol.for("ConvexError"),D_=class extends(Mp=Error,xp=b1,Mp){constructor(e){super(typeof e=="string"?e:Hn(e)),_c(this,"name","ConvexError"),_c(this,"data"),_c(this,xp,!0),this.data=e}};function Fu(e){if(!(e instanceof D_))return!1;const t=e.data;return typeof t=="object"&&t!==null&&t.kind==="forbidden"}function qu(e){if(!(e instanceof D_))return!1;const t=e.data;return typeof t=="object"&&t!==null&&t.kind==="session_revoked"}var Lo;function YL(e){try{Lo=new URL(e).hostname}catch{Lo=void 0}}function Tl(e){try{const t=new URL(e);if(!/^https?:$/.test(t.protocol))return;const r=t.pathname.replace(/(\/(?:results|conformance\/shared|evals\/shared|organizations)\/)[^/]+/g,"$1[redacted]").replace(/(\/(?:user-testing|chatbox)\/[^/]+\/)[^/]+/g,"$1[redacted]");return`${t.origin}${r}`}catch{return}}function Vi(e){const t=/^\[CONVEX Q\(([\w/.-]+:[\w.-]+)\)\]/.exec(e);if(!t)return;const r=/\[Request ID: ([a-f\d]+)\]/i.exec(e)?.[1],n=`${t[0]}${r?` [Request ID: ${r}]`:""} ${/\bServer Error\b/.test(e)?"Server Error":"Query failed"}`;return{functionName:t[1],requestId:r,safeMessage:n}}function N_(e){const t=Vi(e);if(t)return{convex_function:t.functionName,...t.requestId?{request_id:t.requestId}:{},...Lo?{convex_backend:Lo}:{}}}function w1(e){const t=Vi(e.message);if(!t)return e;const r=new Error(t.safeMessage);if(r.name=e.name,e.stack){const n=e.stack.split(`
|
|
96
|
+
`),l=Math.min(c.length,o+1e3),u=[];for(let p=o;l>p;p++){const f=c[p];if(f.length>1024)continue;const v=fh.test(f)?f.replace(fh,"$1"):f;if(!v.match(/\S*Error: /)){for(const m of i){const _=m(v,n);if(_){a.push(_);const w=$C(a);if(w){for(let S=u.length-1;S>=0;S--){const T=u[S];if(w.start>=T.start+T.length)break;u.pop()}u.push(w)}break}}if(OC(a,u)>=50)break}}const h=[...u].sort((p,f)=>f.start-p.start),d=h[h.length-1];if(d){const p=Xg(a,d);a.splice(d.start-p,p);for(const f of h)f.start-=p}for(const p of h)PC(a,p);return u.some(p=>p.start===0&&a.length===p.length)&&(function(p){const f=p.map(m=>`${m.function}|${m.filename}|${m.lineno}|${m.colno}|${m.module}`);let v=0;for(let m=1;f.length>m;m++)xC(f,m,v)&&(v=m);p.push(...p.splice(0,v))})(a),(function(p){if(!p.length)return[];const f=Array.from(p);return f.reverse(),f.slice(0,50).map(v=>{return b(b({},v),{},{filename:v.filename||(m=f,m[m.length-1]||{}).filename,function:v.function||"?"});var m})})(a)}})("web:javascript",AC,CC)),this._instance=e,this.Kv=(t=(r=this._instance.persistence)===null||r===void 0?void 0:r.get_property("$error_tracking_suppression_rules"))!==null&&t!==void 0?t:[],this.Yv=yo(this.tf()),this.ef=new BC(this.Yv)}onConfigChange(){this.Yv=yo(this.tf()),this.ef.setConfig(this.Yv)}onRemoteConfig(e){var t,r,n;if(!e.ok)return;const i=e.config;if(!("errorTracking"in i))return;const s=(t=(r=i.errorTracking)===null||r===void 0?void 0:r.suppressionRules)!==null&&t!==void 0?t:[],o=(n=i.errorTracking)===null||n===void 0?void 0:n.captureExtensionExceptions;this.Kv=s,this._instance.persistence&&this._instance.persistence.register({[fm]:this.Kv,[ol]:o})}get if(){var e;const t=!!this._instance.get_property(ol),r=this._instance.config.error_tracking.captureExtensionExceptions;return(e=r??t)!==null&&e!==void 0&&e}buildProperties(e,t){return this.Xv.buildFromUnknown(e,{syntheticException:t?.syntheticException,mechanism:{handled:t?.handled}})}addExceptionStep(e,t){if(this.Yv.enabled)try{if(!ye(e)||e.trim().length===0)return void $t.warn("Ignoring exception step because message must be a non-empty string");const{sanitizedProperties:r,droppedKeys:n}=(function(i){if(!i)return{sanitizedProperties:{},droppedKeys:[]};const s=[];return{sanitizedProperties:Object.keys(i).reduce((o,a)=>VC.has(a)?(s.push(a),o):(o[a]=i[a],o),{}),droppedKeys:s}})(this.nf(t));n.length>0&&$t.warn("Ignoring reserved exception step fields",{droppedKeys:n}),this.ef.add(b({[mo]:e,[_o]:new Date().toISOString()},r))}catch(r){$t.error("Failed to add exception step. Ignoring breadcrumb.",r)}}sendExceptionEvent(e){try{const t=e.$exception_list;if(this.sf(t)){if(this.rf(t))return this.af("Exception dropped: matched a suppression rule"),void $t.info("Skipping exception capture because a suppression rule matched");if(!this.if&&this.lf(t))return this.af("Exception dropped: thrown by a browser extension"),void $t.info("Skipping exception capture because it was thrown by an extension");if(!this.if&&this.uf(t))return this.af("Exception dropped: thrown by an injected browser script"),void $t.info("Skipping exception capture because it was thrown by an injected browser script");if(!this._instance.config.error_tracking.__capturePostHogExceptions&&this.hf(t))return this.af("Exception dropped: thrown by the PostHog SDK"),void $t.info("Skipping exception capture because it was thrown by the PostHog SDK")}const r=this.Yv.enabled&&ge(e.$exception_steps)?this.cf(e):e,n=(function(){const i=globalThis._posthogReleaseId;return typeof i=="string"&&i.length>0?i:void 0})();n&&(r.$release_id=n);try{const i=this._instance.capture("$exception",r,{_noTruncate:!0,_batchKey:"exceptionEvent",fh:!0});return i&&this.ef.clear(),i}catch(i){Rp(i)||$t.error("Failed to capture exception event. Dropping this exception.",i),this.ef.clear();return}}catch(t){Rp(t)||$t.error("Failed to process exception event. Ignoring this exception.",t);return}}cf(e){try{const t=this.ef.getAttachable();return t.length===0?e:b(b({},e),{},{$exception_steps:t})}catch(t){return $t.error("Failed to read buffered exception steps. Capturing exception without steps.",t),e}}af(e){this.Yv.enabled&&this.ef.add({[mo]:e,[_o]:new Date().toISOString()})}nf(e){return be(e)?b({},e):{}}tf(){var e,t;return(e=(t=this._instance.config.error_tracking)===null||t===void 0?void 0:t.exception_steps)!==null&&e!==void 0?e:{}}rf(e){if(e.length===0)return!1;try{const t=e.reduce((r,{type:n,value:i})=>(ye(n)&&n.length>0&&r.$exception_types.push(n),ye(i)&&i.length>0&&r.$exception_values.push(i),r),{$exception_types:[],$exception_values:[]});return this.Kv.some(r=>{const n=r.values.map(i=>{const s=b_[i.operator],o=t[i.key];if(!s||!o)return!1;const a=ce(i.value)?i.value:[i.value];return a.length>0&&s(a,o)});return r.type==="OR"?n.some(Boolean):n.every(Boolean)})}catch(t){return $t.warn("Failed to evaluate suppression rules. Capturing the exception.",t),!1}}lf(e){const t=e.flatMap(n=>{var i,s;return(i=(s=n.stacktrace)===null||s===void 0?void 0:s.frames)!==null&&i!==void 0?i:[]}),r=t.filter(({filename:n})=>!!n&&iO.some(i=>n.startsWith(i)));return r.length!==0&&(!r.every(({filename:n})=>!!n&&n.startsWith(El))||e.some(({type:n,value:i})=>n==="NoResponse"||ye(i)&&nO.some(({value:s,exact:o})=>o?i===s:i.includes(s)))&&!t.some(({in_app:n,filename:i})=>n&&!i?.startsWith(El)))}uf(e){return e.some(({value:t})=>ye(t)&&sO.some(r=>t.includes(r)))}hf(e){if(e.length>0){var t,r,n,i;const s=(t=(r=e[0].stacktrace)===null||r===void 0?void 0:r.frames)!==null&&t!==void 0?t:[],o=s[s.length-1];return(n=o==null||(i=o.filename)===null||i===void 0?void 0:i.includes("posthog.com/static"))!==null&&n!==void 0&&n}return!1}sf(e){return!ge(e)&&ce(e)}}},gO=b({productTours:class{get Ml(){return this._instance.persistence}constructor(e){this.df=null,this.vf=null,this._instance=e}initialize(){this.loadIfEnabled()}onRemoteConfig(e){if(!e.ok)return;const t=e.config;if("productTours"in t){var r,n;if(this.Ml&&this.Ml.register({[Au]:!!t.productTours}),!dc(this._instance))return!this.df&&ge((r=this.Ml)===null||r===void 0?void 0:r.props.ph_product_tours)||xs.info("product tours disabled; stopping and clearing cached tours"),(n=this.df)===null||n===void 0||n.stop(),this.df=null,void this.clearCache();this.loadIfEnabled()}}loadIfEnabled(){!this.df&&dc(this._instance)&&this.zo(()=>this.ff())}zo(e){var t,r,n;!((t=te.__PosthogExtensions__)===null||t===void 0)&&t.generateProductTours?e():(r=te.__PosthogExtensions__)===null||r===void 0||(n=r.loadExternalDependency)===null||n===void 0||n.call(r,this._instance,"product-tours",i=>{i?xs.error("Could not load product tours script",i):e()})}ff(){var e;!this.df&&(e=te.__PosthogExtensions__)!==null&&e!==void 0&&e.generateProductTours&&(this.df=te.__PosthogExtensions__.generateProductTours(this._instance,!0))}getProductTours(e,t=!1){if(ce(this.vf)&&!t)return void e(this.vf,{isLoaded:!0});const r=this.Ml;if(r){const n=r.props[ul];if(ce(n)&&!t)return this.vf=n,void e(n,{isLoaded:!0})}this._instance._send_request({url:this._instance.requestRouter.endpointFor("api",`/api/product_tours/?token=${this._instance.config.token}`),method:"GET",timestampMode:"query",callback:n=>{if(!dc(this._instance))return void e([],{isLoaded:!0});const i=n.statusCode;if(i!==200||!n.json){const o=`Product Tours API could not be loaded, status: ${i}`;i===0?n.error||xs.warn(o):xs.error(o),e([],{isLoaded:!1,error:o});return}const s=ce(n.json.product_tours)?n.json.product_tours:[];this.vf=s,r&&r.register({[ul]:s}),e(s,{isLoaded:!0})}})}getActiveProductTours(e){ge(this.df)?e([],{isLoaded:!1,error:"Product tours not loaded"}):this.df.getActiveProductTours(e)}showProductTour(e){var t;(t=this.df)===null||t===void 0||t.showTourById(e)}previewTour(e){this.df?this.df.previewTour(e):this.zo(()=>{var t;this.ff(),(t=this.df)===null||t===void 0||t.previewTour(e)})}dismissProductTour(){var e;(e=this.df)===null||e===void 0||e.dismissTour("user_clicked_skip")}nextStep(){var e;(e=this.df)===null||e===void 0||e.nextStep()}previousStep(){var e;(e=this.df)===null||e===void 0||e.previousStep()}clearCache(){var e;this.vf=null,(e=this.Ml)===null||e===void 0||e.unregister("ph_product_tours")}resetTour(e){var t;(t=this.df)===null||t===void 0||t.resetTour(e)}resetAllTours(){var e;(e=this.df)===null||e===void 0||e.resetAllTours()}cancelPendingTour(e){var t;(t=this.df)===null||t===void 0||t.cancelPendingTour(e)}}},ma),mO={siteApps:class{constructor(e){this._instance=e,this.pf=0,this.gf=[],this.apps={}}get isEnabled(){return!!this._instance.config.opt_in_site_apps}mf(e,t){if(!t)return;const r=this.globalsForEvent(t);this.gf.push(r),this.gf.length>1e3&&(this.gf=this.gf.slice(10))}get siteAppLoaders(){var e;return(e=te._POSTHOG_REMOTE_CONFIG)===null||e===void 0||(e=e[this._instance.config.token])===null||e===void 0?void 0:e.siteApps}initialize(){if(this.isEnabled){const e=this._instance._addCaptureHook(this.mf.bind(this));this.yf=()=>{e(),this.gf=[],this.yf=void 0}}}globalsForEvent(e){var t,r,n,i,s,o,a;if(!e)throw new Error("Event payload is required");const c={},l=this._instance.get_property("$groups")||[],u=this._instance.get_property("$stored_group_properties")||{};for(const[p,f]of Object.entries(u))c[p]={id:l[p],type:p,properties:f};const{$set_once:h,$set:d}=e;return{event:b(b({},rm(e,WP)),{},{properties:b(b(b({},e.properties),d?{$set:b(b({},(t=(r=e.properties)===null||r===void 0?void 0:r.$set)!==null&&t!==void 0?t:{}),d)}:{}),h?{$set_once:b(b({},(n=(i=e.properties)===null||i===void 0?void 0:i.$set_once)!==null&&n!==void 0?n:{}),h)}:{}),elements_chain:(s=(o=e.properties)===null||o===void 0?void 0:o.$elements_chain)!==null&&s!==void 0?s:"",distinct_id:(a=e.properties)===null||a===void 0?void 0:a.distinct_id}),person:{properties:this._instance.get_property("$stored_person_properties")},groups:c}}bf(e){var t;const r=(t=e.tagName)===null||t===void 0?void 0:t.toLowerCase();return r==="style"&&this._instance.config.prepare_external_dependency_stylesheet?this._instance.config.prepare_external_dependency_stylesheet(e)||(Ft.error("prepare_external_dependency_stylesheet returned null"),null):r==="script"&&this._instance.config.prepare_external_dependency_script?this._instance.config.prepare_external_dependency_script(e)||(Ft.error("prepare_external_dependency_script returned null"),null):e}_f(){var e,t,r,n,i,s,o,a;if(!this._instance.config.prepare_external_dependency_stylesheet&&!this._instance.config.prepare_external_dependency_script)return()=>{};const c=N?.defaultView,l=c==null||(e=c.Node)===null||e===void 0?void 0:e.prototype;if(!c||!l)return()=>{};if(this.pf++,this.wf)return this.kf();const u=[],h=this,d=new WeakSet,p=(m,_,w)=>{if(!m?.[_])return;const S=m[_];m[_]=w(S),u.push(()=>{m[_]=S})},f=m=>{if(d.has(m))return m;const _=h.bf(m);return _&&d.add(_),_},v=m=>m.map(_=>typeof _=="string"?_:f(_)).filter(_=>!He(_));return p(l,"appendChild",m=>function(_){const w=f(_);return w?m.call(this,w):_}),p(l,"insertBefore",m=>function(_,w){const S=f(_);return S?m.call(this,S,w):_}),p(l,"replaceChild",m=>function(_,w){const S=f(_);return S?m.call(this,S,w):w}),[(t=c.Element)===null||t===void 0?void 0:t.prototype,(r=c.Document)===null||r===void 0?void 0:r.prototype,(n=c.DocumentFragment)===null||n===void 0?void 0:n.prototype].forEach(m=>{p(m,"append",_=>function(...w){return _.apply(this,v(w))}),p(m,"prepend",_=>function(...w){return _.apply(this,v(w))})}),[(i=c.Element)===null||i===void 0?void 0:i.prototype,(s=c.CharacterData)===null||s===void 0?void 0:s.prototype,(o=c.DocumentType)===null||o===void 0?void 0:o.prototype].forEach(m=>{p(m,"before",_=>function(...w){return _.apply(this,v(w))}),p(m,"after",_=>function(...w){return _.apply(this,v(w))}),p(m,"replaceWith",_=>function(...w){const S=v(w);return w.length&&!S.length?void 0:_.apply(this,S)})}),p((a=c.Element)===null||a===void 0?void 0:a.prototype,"insertAdjacentElement",m=>function(_,w){const S=f(w);return S?m.call(this,_,S):null}),this.wf=()=>{u.forEach(m=>m()),this.wf=void 0},this.kf()}kf(){let e=!1;return()=>{var t;e||(e=!0,this.pf--,this.pf===0&&((t=this.wf)===null||t===void 0||t.call(this)))}}Sf(e,t=!0){const r=this._f();try{const n=e(r);return t&&r(),n}catch(n){throw r(),n}}setupSiteApp(e){const t=this.apps[e.id],r=()=>{var s;!t.errored&&this.gf.length&&(Ft.info(`Processing ${this.gf.length} events for site app with id ${e.id}`),this.gf.forEach(o=>this.Sf(()=>{var a;return(a=t.processEvent)===null||a===void 0?void 0:a.call(t,o)})),t.processedBuffer=!0),Object.values(this.apps).every(o=>o.processedBuffer||o.errored)&&((s=this.yf)===null||s===void 0||s.call(this))};let n=!1;const i=s=>{t.errored=!s,t.loaded=!0,Ft.info(`Site app with id ${e.id} ${s?"loaded":"errored"}`),n&&r()};try{const{processEvent:s}=this.Sf(o=>e.init({posthog:this._instance,callback(a){o(),i(a)}}),!1);s&&(t.processEvent=s),n=!0}catch(s){Ft.error(vp+e.id,s),i(!1)}if(n&&t.loaded)try{r()}catch(s){Ft.error(`Error while processing buffered events PostHog app with config id ${e.id}`,s),t.errored=!0}}xf(){const e=this.siteAppLoaders||[];for(const t of e)this.apps[t.id]={id:t.id,loaded:!1,errored:!1,processedBuffer:!1};for(const t of e)this.setupSiteApp(t)}Cf(e){if(Object.keys(this.apps).length===0)return;const t=this.globalsForEvent(e);for(const r of Object.values(this.apps))try{this.Sf(()=>{var n;return(n=r.processEvent)===null||n===void 0?void 0:n.call(r,t)})}catch(n){Ft.error(`Error while processing event ${e.event} for site app ${r.id}`,n)}}onRemoteConfig(e){var t,r,n;if(!((t=this.siteAppLoaders)===null||t===void 0)&&t.length)return this.isEnabled?(this.xf(),void this._instance.on("eventCaptured",a=>this.Cf(a))):void Ft.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.');if((r=this.yf)===null||r===void 0||r.call(this),!e.ok)return;const i=e.config;if(!((n=i.siteApps)===null||n===void 0)&&n.length)if(this.isEnabled)for(const{id:a,url:c}of i.siteApps){var s,o;te[`__$$ph_site_app_${a}`]=this._instance,(s=te.__PosthogExtensions__)===null||s===void 0||(o=s.loadSiteApp)===null||o===void 0||o.call(s,this._instance,c,l=>{if(l)return Ft.error(vp+a,l)})}else Ft.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}}},_O={tracingHeaders:class{constructor(e){this._instance=e,this.$f=void 0,this.Tf=void 0,this.If=void 0,this.Hv=()=>{const t=this.Mf();var r,n;t?(O(this.$f)&&(this.$f=(r=te.__PosthogExtensions__)===null||r===void 0||(r=r.tracingHeadersPatchFns)===null||r===void 0?void 0:r._patchXHR(t,()=>this._instance.get_distinct_id(),this._instance.sessionManager)),O(this.Tf)&&(this.Tf=(n=te.__PosthogExtensions__)===null||n===void 0||(n=n.tracingHeadersPatchFns)===null||n===void 0?void 0:n._patchFetch(t,()=>this._instance.get_distinct_id(),this._instance.sessionManager))):this.Zv()}}initialize(){this.startIfEnabledOrStop()}zo(e){var t,r,n;!((t=te.__PosthogExtensions__)===null||t===void 0)&&t.tracingHeadersPatchFns?e():(r=te.__PosthogExtensions__)===null||r===void 0||(n=r.loadExternalDependency)===null||n===void 0||n.call(r,this._instance,"tracing-headers",i=>{if(i)return HP.error("failed to load script",i);e()})}Ef(){var e,t;return(e=(t=this._instance.config.tracing_headers)!==null&&t!==void 0?t:this._instance.config.addTracingHeaders)!==null&&e!==void 0?e:this._instance.config.__add_tracing_headers}Mf(){const e=this.Ef();return ce(e)?(ce(this.If)?this.If.splice(0,this.If.length,...e):this.If=[...e],e.length>0?this.If:void 0):(ce(this.If)&&this.If.splice(0),this.If=e||void 0,this.If)}Zv(){var e,t;(e=this.$f)===null||e===void 0||e.call(this),(t=this.Tf)===null||t===void 0||t.call(this),this.$f=void 0,this.Tf=void 0}startIfEnabledOrStop(){this.Mf()?this.zo(this.Hv):this.Zv()}}},yO=b({surveys:class extends ZP{constructor(e){var t;super(new QP(e),(t=e,{get projectToken(){return t.config.token},kv:new XP(t)})),this._instance=e}qh(e,t){const r=t.query?ds(e,t.query):e;return new Promise(n=>{var i;this._instance._send_request({method:t.method,url:this._instance.requestRouter.endpointFor((i=t.target)!==null&&i!==void 0?i:"api",r),data:t.body,headers:t.headers,timeout:t.timeoutMs,fireCallbackOnDrop:!0,transport:t.transport,compression:t.compression,timestampMode:t.sentAt,callback:n})})}}},ma),bO={toolbar:class{constructor(e){this.instance=e}Pf(e){te.ph_toolbar_state=e}Rf(){var e;return(e=te.ph_toolbar_state)!==null&&e!==void 0?e:0}initialize(){return this.maybeLoadToolbar()}maybeLoadToolbar(e=void 0,t=void 0,r=void 0){var n,i;if(hl(this.instance.config)||!A||!N)return!1;e=(n=e)!==null&&n!==void 0?n:A.location,r=(i=r)!==null&&i!==void 0?i:A.history;try{if(!t){try{A.localStorage.setItem("test","test"),A.localStorage.removeItem("test")}catch{return!1}t=A?.localStorage}const s=eO||Ao(e.hash,"__posthog")||Ao(e.hash,"state");let o;const a=s?uh(()=>JSON.parse(atob(decodeURIComponent(s))))||uh(()=>JSON.parse(decodeURIComponent(s))):null;return a&&a.action==="ph_authorize"?(o=a,o.source="url",o&&Object.keys(o).length>0&&(a.desiredHash?e.hash=a.desiredHash:r?r.replaceState(r.state,"",e.pathname+e.search):e.hash="")):(o=JSON.parse(t.getItem(mp)||"{}"),o.source="localstorage",delete o.userIntent),!(!o.token||this.instance.config.token!==o.token||(this.loadToolbar(o),0))}catch{return!1}}Af(e){const t=te.ph_load_toolbar||te.ph_load_editor;!ge(t)&&tt(t)?t(e,this.instance):_p.warn("No toolbar load function found")}loadToolbar(e){const t=!!N?.getElementById("__POSTHOG_TOOLBAR__");if(!A||t)return!1;const r=this.instance.requestRouter.region==="custom"&&this.instance.config.advanced_disable_toolbar_metrics,n=b(b({token:this.instance.config.token},e),{},{apiURL:this.instance.requestRouter.endpointFor("ui")},r?{instrument:!1}:{});if(A.localStorage.setItem(mp,JSON.stringify(b(b({},n),{},{source:void 0}))),this.Rf()===2)this.Af(n);else if(this.Rf()===0){var i,s;this.Pf(1),(i=te.__PosthogExtensions__)===null||i===void 0||(s=i.loadExternalDependency)===null||s===void 0||s.call(i,this.instance,"toolbar",o=>{if(o)return _p.error("[Toolbar] Failed to load",o),void this.Pf(0);this.Pf(2),this.Af(n)}),Ie(A,"turbolinks:load",()=>{this.Pf(0),this.loadToolbar(n)})}return!0}Ff(e){return this.loadToolbar(e)}maybeLoadEditor(e=void 0,t=void 0,r=void 0){return this.maybeLoadToolbar(e,t,r)}}},wO=b({experiments:class ht{get Rr(){return this._instance.config}constructor(t){this._instance=t,this.getWebExperimentsAndEvaluateDisplayLogic=(r=!1)=>{this.getWebExperiments(n=>{ht.Of("retrieved web experiments from the server"),this.Df=new Map,n.forEach(i=>{if(i.feature_flag_key){var s;this.Df&&(ht.Of("setting flag key ",i.feature_flag_key," to web experiment ",i),(s=this.Df)===null||s===void 0||s.set(i.feature_flag_key,i));const o=this._instance.getFeatureFlag(i.feature_flag_key);ye(o)&&i.variants[o]&&this.Lf(i.name,o,i.variants[o].transforms)}else if(i.variants)for(const o in i.variants){const a=i.variants[o];ht.Nf(a,this._instance)&&this.Lf(i.name,o,a.transforms)}})},r)},this._instance.onFeatureFlags(r=>{this.onFeatureFlags(r)})}initialize(){}onFeatureFlags(t){if(this._is_bot())ht.Of(Ap);else if(!this.Rr.disable_web_experiments){if(ge(this.Df))return this.Df=new Map,this.loadIfEnabled(),void this.previewWebExperiment();ht.Of("applying feature flags",t),t.forEach(r=>{var n;if(this.Df&&(!((n=this.Df)===null||n===void 0)&&n.has(r))){var i;const s=this._instance.getFeatureFlag(r),o=(i=this.Df)===null||i===void 0?void 0:i.get(r);s&&o!=null&&o.variants[s]&&this.Lf(o.name,s,o.variants[s].transforms)}})}}previewWebExperiment(){const t=ht.getWindowLocation();if(t?.search){const r=Xn(t?.search,"__experiment_id"),n=Xn(t?.search,"__experiment_variant");r&&n&&(ht.Of(`previewing web experiments ${r} && ${n}`),this.getWebExperiments(i=>{this.qf(parseInt(r),n,i)},!1,!0))}}loadIfEnabled(){this.Rr.disable_web_experiments||this.getWebExperimentsAndEvaluateDisplayLogic()}getWebExperiments(t,r,n){if(this.Rr.disable_web_experiments&&!n)return t([]);const i=this._instance.get_property("$web_experiments");if(i&&!r)return t(i);this._instance._send_request({url:this._instance.requestRouter.endpointFor("api",`/api/web_experiments/?token=${this.Rr.token}`),method:"GET",timestampMode:"query",callback:s=>t(s.statusCode===200&&s.json&&s.json.experiments||[])})}qf(t,r,n){const i=n.filter(s=>s.id===t);i&&i.length>0&&(ht.Of(`Previewing web experiment [${i[0].name}] with variant [${r}]`),this.Lf(i[0].name,r,i[0].variants[r].transforms))}static Nf(t,r){return!ge(t.conditions)&&ht.jf(t,r)&&ht.Bf(t)}static jf(t,r){var n;if(ge(t.conditions)||ge((n=t.conditions)===null||n===void 0?void 0:n.url))return!0;const i=ht.getWindowLocation();if(i){var s,o,a;const c=Mm(r,i.href);return!(!((s=t.conditions)===null||s===void 0)&&s.url)||oO[(o=(a=t.conditions)===null||a===void 0?void 0:a.urlMatchType)!==null&&o!==void 0?o:"icontains"](t.conditions.url,c)}return!1}static getWindowLocation(){return A?.location}static Bf(t){var r;if(ge(t.conditions)||ge((r=t.conditions)===null||r===void 0?void 0:r.utm))return!0;const n=Gm();if(n.utm_source){var i,s,o,a,c,l,u,h;const d=!(!((i=t.conditions)===null||i===void 0||(i=i.utm)===null||i===void 0)&&i.utm_campaign)||((s=t.conditions)===null||s===void 0||(s=s.utm)===null||s===void 0?void 0:s.utm_campaign)==n.utm_campaign,p=!(!((o=t.conditions)===null||o===void 0||(o=o.utm)===null||o===void 0)&&o.utm_source)||((a=t.conditions)===null||a===void 0||(a=a.utm)===null||a===void 0?void 0:a.utm_source)==n.utm_source,f=!(!((c=t.conditions)===null||c===void 0||(c=c.utm)===null||c===void 0)&&c.utm_medium)||((l=t.conditions)===null||l===void 0||(l=l.utm)===null||l===void 0?void 0:l.utm_medium)==n.utm_medium,v=!(!((u=t.conditions)===null||u===void 0||(u=u.utm)===null||u===void 0)&&u.utm_term)||((h=t.conditions)===null||h===void 0||(h=h.utm)===null||h===void 0?void 0:h.utm_term)==n.utm_term;return d&&f&&v&&p}return!1}static Of(t,...r){j.info(`[WebExperiments] ${t}`,r)}Lf(t,r,n){this._is_bot()?ht.Of(Ap):r!=="control"?n.forEach(i=>{if(i.selector){var s;ht.Of(`applying transform of variant ${r} for experiment ${t} `,i),((s=document)===null||s===void 0?void 0:s.querySelectorAll(i.selector))?.forEach(o=>{const a=o;i.html&&(a.innerHTML=i.html),i.css&&a.setAttribute("style",i.css)})}}):ht.Of("Control variants leave the page unmodified.")}_is_bot(){return rt&&this._instance?m_(rt,this.Rr.custom_blocked_useragents):void 0}}},ma),SO={conversations:class{constructor(e){this._instance=e,this.Hf=void 0,this._conversationsManager=null,this.zf=!1,this.ne=null,this.Uf=!1}initialize(){this.loadIfEnabled()}onRemoteConfig(e){if(this._instance.config.disable_conversations||(this.Wf=e.ok,!e.ok))return;const t=e.config.conversations;ge(t)||(vt(t)?this.Hf=t:(this.Hf=t.enabled,this.ne=t),this.loadIfEnabled())}reset(){var e;(e=this._conversationsManager)===null||e===void 0||e.reset(),this._conversationsManager=null,this.Hf=void 0,this.ne=null,this.Wf=void 0,this.Uf=!1}loadIfEnabled(){if(this._conversationsManager||this.zf||this._instance.config.disable_conversations||hl(this._instance.config)||this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())return;const e=te?.__PosthogExtensions__;if(e&&!O(this.Hf)&&this.Hf)if(this.ne&&this.ne.token){this.zf=!0;try{const t=e.initConversations;if(t)return this.Vf(t),void(this.zf=!1);const r=e.loadExternalDependency;if(!r)return void this.Gf(Tu);r(this._instance,"conversations",n=>{n||!e.initConversations?this.Gf("Could not load conversations script",n):this.Vf(e.initConversations),this.zf=!1})}catch(t){this.Gf("Error initializing conversations",t),this.zf=!1}}else kt.error("Conversations enabled but missing token in remote config.")}Vf(e){if(this.ne)try{this._conversationsManager=e(this.ne,this._instance),this.Uf=!1,kt.info("Conversations loaded successfully")}catch(t){this.Gf("Error completing conversations initialization",t)}else kt.error("Cannot complete initialization: remote config is null")}Gf(e,t){kt.error(e,t),this._conversationsManager=null,this.zf=!1,this.Uf=!0}show(){this._conversationsManager?this._conversationsManager.show():kt.warn("Conversations not loaded yet.")}hide(){this._conversationsManager&&this._conversationsManager.hide()}isAvailable(){return this.Hf===!0&&!He(this._conversationsManager)}getUnavailableReason(){return this.isAvailable()?null:this._instance.config.disable_conversations?"disabled_by_config":hl(this._instance.config)?"disabled_for_toolbar":this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut()?"consent_opted_out":this.Wf===!1?"remote_config_failed":O(this.Hf)?this.Wf?"disabled_in_project":"remote_config_pending":this.Hf?ge(this.ne)||!this.ne.token?"missing_token":te?.__PosthogExtensions__?this.zf?"initializing":this.Uf?"load_failed":"not_loaded":"extensions_unavailable":"disabled_in_project"}isVisible(){var e,t;return(e=(t=this._conversationsManager)===null||t===void 0?void 0:t.isVisible())!==null&&e!==void 0&&e}sendMessage(e,t,r){var n=this;return Ue(function*(){return n._conversationsManager?n._conversationsManager.sendMessage(e,t,r):(kt.warn(Jr),null)})()}getMessages(e,t){var r=this;return Ue(function*(){return r._conversationsManager?r._conversationsManager.getMessages(e,t):(kt.warn(Jr),null)})()}markAsRead(e){var t=this;return Ue(function*(){return t._conversationsManager?t._conversationsManager.markAsRead(e):(kt.warn(Jr),null)})()}getTickets(e){var t=this;return Ue(function*(){return t._conversationsManager?t._conversationsManager.getTickets(e):(kt.warn(Jr),null)})()}requestRestoreLink(e){var t=this;return Ue(function*(){return t._conversationsManager?t._conversationsManager.requestRestoreLink(e):(kt.warn(Jr),null)})()}restoreFromToken(e){var t=this;return Ue(function*(){return t._conversationsManager?t._conversationsManager.restoreFromToken(e):(kt.warn(Jr),null)})()}restoreFromUrlToken(){var e=this;return Ue(function*(){return e._conversationsManager?e._conversationsManager.restoreFromUrlToken():(kt.warn(Jr),null)})()}getCurrentTicketId(){var e,t;return(e=(t=this._conversationsManager)===null||t===void 0?void 0:t.getCurrentTicketId())!==null&&e!==void 0?e:null}getWidgetSessionId(){var e,t;return(e=(t=this._conversationsManager)===null||t===void 0?void 0:t.getWidgetSessionId())!==null&&e!==void 0?e:null}Sh(){var e;(e=this._conversationsManager)===null||e===void 0||e.setIdentity()}xh(){var e;(e=this._conversationsManager)===null||e===void 0||e.clearIdentity()}}},EO={logs:class{constructor(e){var t;this._instance=e,this.name="logs",this.Zf=!1,this.Qf=!1,this.Jf=!1,this.$=Be("[logs]"),this.Kf=b(b({},this.$),{},{error:(...r)=>{r.some(Cp)||this.$.error(...r)}}),this.al=[],this.Xf=[],this.hd=0,this.Io=!1,this.Yf=[],this.tp=[],this.ep=!1,this.np=!1,this.sp=()=>{var r,n;this.Io||(this.hd=0,(r=this.rp)===null||r===void 0||r.onReconnect(),(n=this.op)===null||n===void 0||n.onReconnect())},this._instance&&(t=this._instance.config.logs)!==null&&t!==void 0&&t.captureConsoleLogs&&(this.Zf=!0),A&&Ie(A,"online",this.sp)}ap(e,t,r,n){var i;const s=Ip((i=this._instance)===null||i===void 0||(i=i.config)===null||i===void 0?void 0:i.logs,r);return[new t$(this.lp(e,t),s,this.Kf,()=>this.up(),o=>o(),void 0,n),s]}hp(){var e;const t=(e=this._instance)===null||e===void 0||(e=e.config)===null||e===void 0?void 0:e.logs;var r;return this.rp&&this.cp===t||((r=this.rp)===null||r===void 0||r.reset(),this.cp=t,[this.rp,this.dp]=this.ap(()=>this.al,n=>{this.al=n})),this.rp}vp(){var e;const t=(e=this._instance)===null||e===void 0||(e=e.config)===null||e===void 0?void 0:e.logs;var r;return this.op&&this.fp===t||((r=this.op)===null||r===void 0||r.reset(),this.fp=t,[this.op,this.pp]=this.ap(()=>this.Xf,n=>{this.Xf=n},{serviceNameDefault:"posthog-browser-logs",consoleCapture:!0},Tp)),this.op}setup(e){var t;if(this.Io)return;this.wo=e,(t=this._instance)!==null&&t!==void 0&&(t=t.config)!==null&&t!==void 0&&(t=t.logs)!==null&&t!==void 0&&t.captureConsoleLogs&&(this.Zf=!0),(this.Zf||this.gp()&&this.mp())&&this.yp();let r=!1;const n=e.onRemoteConfig(i=>{var s;r=i.ok&&((s=i.config.logs)===null||s===void 0?void 0:s.captureConsoleLogs)===!0,this.onRemoteConfig(i)});this.Io?n.dispose():(this.Po=n,r||this.loadIfEnabled())}dispose(){var e,t,r,n;this.Io||(this.Io=!0,this.bp(),(e=this.Po)===null||e===void 0||e.dispose(),this.Po=void 0,this.wo=void 0,this.Jf=!1,A?.removeEventListener("online",this.sp),(t=this._p)===null||t===void 0||t.call(this),this._p=void 0,(r=this.rp)===null||r===void 0||r.reset(),(n=this.op)===null||n===void 0||n.reset())}onRemoteConfig(e){var t,r;if(this.Io)return;const n=e.ok?(t=e.config.logs)===null||t===void 0?void 0:t.captureConsoleLogs:void 0;ge(n)?this.wp():((r=this._instance)===null||r===void 0||(r=r.persistence)===null||r===void 0||r.register({$logs_capture_enabled_server_side:!!n}),n?(this.Zf=!0,this.Qf||this.yp(),this.loadIfEnabled()):this.wp())}reset(){var e,t,r,n;this.bp(),(e=this.rp)===null||e===void 0||e.clearQueue(),this.al=[],(t=this.rp)===null||t===void 0||t.reset(),(r=this.op)===null||r===void 0||r.clearQueue(),this.Xf=[],(n=this.op)===null||n===void 0||n.reset(),this.hd=0}captureLog(e){this.Io||this.hp().captureLog(e)}captureConsoleLog(e){this.Io||this.vp().captureLog(e)}captureBufferedConsoleLog(e,t,r){this.Io||this.vp().captureLog(e,{context:t,occurredAtMs:r})}mp(){var e;return!!(!((e=this._instance)===null||e===void 0||(e=e.persistence)===null||e===void 0||(e=e.props)===null||e===void 0)&&e[vm])}gp(){var e,t,r;return!(!((e=this._instance)===null||e===void 0||(t=e.nl)===null||t===void 0)&&t.call(e))||!!(!((r=te._POSTHOG_REMOTE_CONFIG)===null||r===void 0||(r=r[this._instance.config.token])===null||r===void 0)&&r.config)}$h(){var e;this.bp(),(e=this.op)===null||e===void 0||e.clearQueue(),this.Xf=[]}wp(){this.Zf||this.bp()}yp(){var e;if(this.ep||!te?.console)return;const t=Ip((e=this._instance)===null||e===void 0||(e=e.config)===null||e===void 0?void 0:e.logs).maxBufferSize;let r=!0;this.tp.push(()=>{r=!1});for(const n of aO){let i;try{i=cO(te.console[n])}catch{continue}i&&this.tp.push(ss(te.console,n,s=>{const o=(...a)=>{try{r&&this.kp(n,a,t)}catch{}return s.apply(te.console,a)};return o.__rrweb_original__=i,o}))}this.ep=!0,this.Sp=setTimeout(()=>{this.bp()},3e4)}kp(e,t,r){var n;if(this.ep&&!this.np&&t.length!==0)if(!((n=this._instance)===null||n===void 0)&&n.is_capturing()){if(r>this.Yf.length){this.np=!0;try{this.Yf.push({level:e,args:t,occurredAtMs:Date.now(),context:this.up()})}finally{this.np=!1}}}else this.bp()}bp(){if(this.Yf=[],this.ep){this.ep=!1,this.Sp&&(clearTimeout(this.Sp),this.Sp=void 0);for(const e of this.tp)e();this.tp=[]}}xp(){const e=this.Yf;return this.bp(),e}get logger(){return this.Cp||(this.Cp={trace:(e,t)=>this.captureLog({body:e,level:"trace",attributes:t}),debug:(e,t)=>this.captureLog({body:e,level:"debug",attributes:t}),info:(e,t)=>this.captureLog({body:e,level:"info",attributes:t}),warn:(e,t)=>this.captureLog({body:e,level:"warn",attributes:t}),error:(e,t)=>this.captureLog({body:e,level:"error",attributes:t}),fatal:(e,t)=>this.captureLog({body:e,level:"fatal",attributes:t})}),this.Cp}flushLogs(e){e?this.$p(e):(this.rp&&this.rp.flush().catch(t=>this.Tp(t)),this.op&&this.op.flush().catch(t=>this.Tp(t)))}Tp(e){Cp(e)||this.$.error("PostHog logs flush failed:",e)}loadIfEnabled(){if(this.Io||!this.Zf||this.Qf||this.Jf)return;const e=te?.__PosthogExtensions__;if(!e)return this.$.error("PostHog Extensions not found."),void this.bp();const t=e.loadExternalDependency;if(!t)return this.$.error(Tu),void this.bp();this.Jf=!0;try{t(this._instance,"logs",r=>{if(this.Jf=!1,this.Io||!this.Zf)return;const n=e.logs;if(r||!n?.initializeLogs)this.$.error("Could not load logs script",r),this.bp();else{var i;const a=this.xp();var s,o;this._p=n.initializeLogs((i=this.wo)!==null&&i!==void 0?i:this._instance),this.Qf=!0,a.length>0&&((s=n.replayConsoleBuffer)===null||s===void 0||s.call(n,(o=this.wo)!==null&&o!==void 0?o:this._instance,a))}})}catch(r){throw this.Jf=!1,r}}lp(e,t){const r=this._instance;return{get isDisabled(){return!1},get optedOut(){return!r.is_capturing()},getPersistedProperty:n=>n===Ht.LogsQueue?e():void 0,setPersistedProperty(n,i){var s;n===Ht.LogsQueue&&t((s=i)!==null&&s!==void 0?s:[])},js:n=>this.js(n),getLibraryId:()=>et.LIB_NAME,getLibraryVersion:()=>et.LIB_VERSION}}js(e){return new Promise(t=>{if(Vm(this.hd,3))return void t({kind:"fatal",error:pc(void 0,"logs endpoint is unreachable, dropping batch")});let r=!1;const n=s=>{r||(r=!0,clearTimeout(i),t(s))},i=setTimeout(()=>{this.$.warn("Logs request timed out before receiving a response"),n({kind:"retry-later",error:pc(void 0,"logs request timed out")})},9e4);this._instance._send_request({method:"POST",url:this.Ip(),data:e,compression:"best-available",batchKey:"logs",fireCallbackOnDrop:!0,callback:s=>{const o=s.statusCode;if(this.Mp(o),o>=200&&300>o)n({kind:"ok"});else if(o===413)n({kind:"too-large"});else if(o!==0&&o!==408&&o!==429&&500>o)n({kind:"fatal",error:new Error(`logs request failed with status ${o}`)});else{var a;o===0?(s.error||this.$.warn("Logs request failed before receiving an HTTP response"),n({kind:"retry-later",error:pc(s.error,"logs request failed before receiving an HTTP response")})):n({kind:"retry-later",error:(a=s.error)!==null&&a!==void 0?a:new Error(`logs request failed with status ${o}`)})}}})})}Mp(e){(e!==0||this._instance.__loaded)&&(this.hd=Bm(e,this.hd,3,()=>this.$.warn("Log requests are failing before receiving an HTTP response; this can happen due to network issues, CORS, browser blocking, or ad blockers. Stopped sending logs; will try again when connectivity changes.")))}$p(e){this.al.length>0&&this.Ep(e,this.al,this.dp,et.LIB_NAME,t=>{this.al=t}),this.Xf.length>0&&this.Ep(e,this.Xf,this.pp,Tp,t=>{this.Xf=t})}Ep(e,t,r,n,i){if(t.length===0)return;const s=t.map(a=>a.record);i([]);const o=cm(s,am(r,et.LIB_NAME,et.LIB_VERSION),n,et.LIB_VERSION);this._instance._send_request({method:"POST",url:this.Ip(),data:o,compression:"best-available",batchKey:"logs",transport:e})}Ip(){return this._instance.requestRouter.endpointFor("api","/i/v1/logs")+"?token="+encodeURIComponent(this._instance.config.token)}up(){var e;const t={};if(t.distinctId=this._instance.get_distinct_id(),this._instance.sessionManager){const{sessionId:r,windowId:n,sessionStartTimestamp:i,lastActivityTimestamp:s}=this._instance.sessionManager.checkAndGetSessionAndWindowId(!0);t.sessionId=r,t.windowId=n,ge(i)||(t.sessionStartTimestamp=i),ge(s)||(t.lastActivityTimestamp=s)}if(te!=null&&(e=te.location)!==null&&e!==void 0&&e.href&&(t.currentUrl=this._instance.config.disable_capture_url_hashes?Ur(te.location.href):te.location.href),this._instance.featureFlags){const r=this._instance.featureFlags.getFlags();r&&r.length>0&&(t.activeFeatureFlags=r)}return t}}},kO={metrics:class{constructor(e){this._instance=e,this.$=Be("[metrics]"),this.Io=!1}initialize(){this.onConfigChange()}onConfigChange(){var e;if(this.Io)return;const t=!!(!((e=this._instance.config.metrics)===null||e===void 0)&&e.network);t&&!this.Pp?this.Pp=(r=>{let n=!0;const i=()=>n?(a=>{var c;const l=(c=a.config.metrics)===null||c===void 0?void 0:c.network;return l===!0?{}:l||void 0})(r):void 0,s=dO(r,i),o=hO(r,i);return()=>{n=!1,s(),o()}})(this._instance):!t&&this.Pp&&(this.Pp(),this.Pp=void 0)}hp(){var e;const t=(e=this._instance)===null||e===void 0||(e=e.config)===null||e===void 0?void 0:e.metrics;var r;return this.rp&&this.cp===t||((r=this.rp)===null||r===void 0||r.reset(),this.cp=t,this.rp=new r$(this.lp(),(function(n){var i,s,o,a,c;const l=n?.resourceAttributes;return{serviceName:(i=l?.["service.name"])!==null&&i!==void 0?i:n?.serviceName,serviceVersion:(s=l?.["service.version"])!==null&&s!==void 0?s:n?.serviceVersion,environment:(o=l?.["deployment.environment"])!==null&&o!==void 0?o:n?.environment,resourceAttributes:l,beforeSend:n?.beforeSend,flushIntervalMs:(a=n?.flushIntervalMs)!==null&&a!==void 0?a:1e4,maxSeriesPerFlush:(c=n?.maxSeriesPerFlush)!==null&&c!==void 0?c:1e3}})(t),this.$)),this.rp}count(e,t=1,r){this.hp().count(e,t,r)}gauge(e,t,r){this.hp().gauge(e,t,r)}histogram(e,t,r){this.hp().histogram(e,t,r)}flush(e){if(!this.rp)return Promise.resolve();if(e){const t=this.rp.drainWindow();return t&&this.Ys(t,e),Promise.resolve()}return this.rp.flush().catch(t=>this.$.error("PostHog metrics flush failed:",t))}reset(){var e;(e=this.rp)===null||e===void 0||e.reset()}dispose(){var e,t;this.Io=!0,(e=this.Pp)===null||e===void 0||e.call(this),this.Pp=void 0,(t=this.rp)===null||t===void 0||t.reset()}lp(){const e=this._instance,t=this;return{get isDisabled(){return!1},get optedOut(){return!e.is_capturing()},Ys:r=>t.Ys(r),getLibraryId:()=>et.LIB_NAME,getLibraryVersion:()=>et.LIB_VERSION}}Ys(e,t){return new Promise(r=>{let n=!1;const i=o=>{n||(n=!0,clearTimeout(s),r(o))},s=setTimeout(()=>i({kind:"retry-later",error:new Error("metrics request timed out")}),9e4);this._instance._send_request(b(b({method:"POST",url:this.Rp(),data:e,compression:"best-available",batchKey:"metrics"},t&&{transport:t}),{},{fireCallbackOnDrop:!0,callback(o){const a=o.statusCode;if(a>=200&&300>a)i({kind:"ok"});else if(a===413)i({kind:"too-large"});else if(a!==0&&a!==408&&a!==429&&500>a)i({kind:"fatal",error:new Error(`metrics request failed with status ${a}`)});else{var c;i({kind:"retry-later",error:(c=o.error)!==null&&c!==void 0?c:new Error(`metrics request failed with status ${a}`)})}}}))})}Rp(){return this._instance.requestRouter.endpointFor("api","/i/v1/metrics")+"?token="+encodeURIComponent(this._instance.config.token)}}};Hi.__defaultExtensionClasses=b({},b(b(b(b(b(b(b(b(b(b(b(b(b({},ma),pO),fO),vO),gO),mO),yO),_O),bO),wO),SO),EO),kO));var RO=(function(){et.SDK_DIST_CHANNEL="npm";const e=qi[Ci]=new Hi;return(function(){function t(){t.done||(t.done=!0,v_=!1,Ce(qi,function(r){r._dom_loaded()}))}N?.addEventListener?N.readyState==="complete"?t():Ie(N,"DOMContentLoaded",t,{capture:!1}):A&&j.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")})(),e})(),AO=RO,IO=/\.[cm]?[jt]sx?$/,TO=/^(?:[a-z][a-z0-9+.-]*:\/\/|\/)/i;function CO(e,t){if(typeof e!="string"||!TO.test(e))return!1;let r;try{r=new URL(e,t)}catch{return!1}return r.origin!==t?!1:!IO.test(r.pathname)}function $O(e,t){return e.length===0?!1:e.every(r=>CO(r,t))}function PO(e,t){return e.length===0?!1:e.every(r=>$O(r,t))}var C_=new Set(["caniuse.dev","www.caniuse.dev"]),OO=new Set(["score.mcpjam.com","www.score.mcpjam.com"]),xO=new Set([...C_,...OO]),jL="https://app.mcpjam.com";function MO(e){return C_.has(e.toLowerCase())}function HL(e=typeof window>"u"?void 0:window.location.hostname){return!!e&&MO(e)}var LO="phc_dTOPniyUNU2kD8Jx8yHMXSqiZHM8I91uWopTMX6EBE9",DO="https://us.i.posthog.com";function NO(){return typeof window<"u"&&window.location?.origin?.startsWith("http")?`${window.location.origin}/tlm`:DO}function $_(e){const t=Sc()?.guestId,r=e&&Object.keys(e).length>0?e:void 0;return!t&&!r?{}:{bootstrap:{...t?{distinctID:t,isIdentifiedID:!1}:{},...r?{featureFlags:r}:{}}}}var zO={advanced_disable_feature_flags:!0,advanced_disable_feature_flags_on_first_load:!0},UO=["/results/","/conformance/shared/","/evals/shared/"];function P_(e){let t=e;for(const r of UO){const n=r.replace(/[/\-\\^$*+?.()|[\]{}]/g,"\\$&");t=t.replace(new RegExp(`(${n})[^/?#]+`,"g"),"$1[redacted]")}return t=t.replace(/(\/organizations\/)[^/?#]+/g,"$1[redacted]"),t}var FO=new Set(["Load failed","Failed to fetch","NetworkError when attempting to fetch resource."]),qO=/^'TypeError' captured as exception with message: '([\s\S]*)'$/;function jO(e){const t=qO.exec(e.value),r=t?t[1]:e.type==="TypeError"?e.value:void 0;return r===void 0?!1:FO.has(r)||r.startsWith("Failed to fetch (")&&r.endsWith(")")}var HO=1e4;function VO(e){const t=e.$exception_list;if(!(Array.isArray(t)&&t.some(i=>typeof i?.value=="string"&&jO(i))))return;const r=ty();if(!r)return;const n=Date.now()-r.at;n>HO||(e.failed_request=`${r.method} ${P_(r.target)}`,e.failed_request_age_ms=n)}function BO(e,t){for(const r of["$current_url","$referrer","$pathname","$session_entry_url","$session_entry_pathname","$session_entry_referrer","$initial_current_url","$initial_pathname","$initial_referrer"])typeof e[r]=="string"&&(e[r]=P_(e[r]));return t==="$exception"&&VO(e),e}function GO(e){if(e?.event!=="$exception"||typeof window>"u")return e;const t=e.properties?.$exception_list;if(!Array.isArray(t))return e;const r=t.map(n=>{const i=n?.stacktrace?.frames;return Array.isArray(i)?i.map(s=>s?.filename):[]});return PO(r,window.location.origin)?null:e}var WO=xO;function hs(){return ZO()}function ZO(){return typeof window<"u"&&window.isElectron===!0}var JO="data-ph-no-capture",KO={maskAllInputs:!0,maskInputOptions:{password:!0},maskTextSelector:`[${JO}]`};function zu(e=typeof window>"u"?void 0:window.location?.pathname){return!!e&&(e.startsWith("/results/")||e.startsWith("/conformance/shared/")||e.startsWith("/evals/shared/"))}function YO(){return hs()&&!zu()}var fc=!1;function VL(e,t){try{if(!hs())return;if(zu(t)){e.sessionRecordingStarted?.()&&(fc=!0),e.stopSessionRecording?.();return}fc&&(fc=!1,e.startSessionRecording?.())}catch{}}function XO(e=typeof window>"u"?void 0:window.location?.hostname){const t=!!e&&WO.has(e.toLowerCase());return{capture_pageview:t?"history_change":!1,capture_pageleave:t}}var $p={api_host:NO(),ui_host:"https://us.posthog.com",...$_(),...XO(),...zO,person_profiles:"always",sanitize_properties:BO,before_send:GO,capture_dead_clicks:!0,get capture_exceptions(){return hs()},get disable_session_recording(){return!YO()},session_recording:KO,loaded:e=>{e.register({environment:"production",platform:Rl(),version:"3.12.8",deployment:"self_hosted",source:"client"}),e.setPersonPropertiesForFlags?.({local_browser_security_version:"1",deployment:"self_hosted",platform:Rl()})}};function QO(e){const t=$_(e);return"bootstrap"in t?Object.defineProperties({},{...Object.getOwnPropertyDescriptors($p),bootstrap:{value:t.bootstrap,enumerable:!0,configurable:!0,writable:!0}}):$p}var BL=()=>LO,GL=e=>QO(e);function Rl(){if(window?.isElectron){const e=navigator.userAgent.toLowerCase();return e.includes("mac")||e.includes("darwin")?"mac":e.includes("win")?"win":"electron"}return"npm"}function e1(){return"production"}function WL(e){const t=e1();return{location:e,platform:Rl(),...t!==void 0?{environment:t}:{}}}var Vt=[],At=[],t1=Uint8Array,vc="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(var An=0,r1=vc.length;An<r1;++An)Vt[An]=vc[An],At[vc.charCodeAt(An)]=An;At[45]=62;At[95]=63;function n1(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=e.indexOf("=");r===-1&&(r=t);var n=r===t?0:4-r%4;return[r,n]}function i1(e,t,r){return(t+r)*3/4-r}function Oo(e){for(var t,r=n1(e),n=r[0],i=r[1],s=new t1(i1(e,n,i)),o=0,a=i>0?n-4:n,c=0;c<a;c+=4)t=At[e.charCodeAt(c)]<<18|At[e.charCodeAt(c+1)]<<12|At[e.charCodeAt(c+2)]<<6|At[e.charCodeAt(c+3)],s[o++]=t>>16&255,s[o++]=t>>8&255,s[o++]=t&255;return i===2&&(t=At[e.charCodeAt(c)]<<2|At[e.charCodeAt(c+1)]>>4,s[o++]=t&255),i===1&&(t=At[e.charCodeAt(c)]<<10|At[e.charCodeAt(c+1)]<<4|At[e.charCodeAt(c+2)]>>2,s[o++]=t>>8&255,s[o++]=t&255),s}function s1(e){return Vt[e>>18&63]+Vt[e>>12&63]+Vt[e>>6&63]+Vt[e&63]}function o1(e,t,r){for(var n,i=[],s=t;s<r;s+=3)n=(e[s]<<16&16711680)+(e[s+1]<<8&65280)+(e[s+2]&255),i.push(s1(n));return i.join("")}function xo(e){for(var t,r=e.length,n=r%3,i=[],s=16383,o=0,a=r-n;o<a;o+=s)i.push(o1(e,o,o+s>a?a:o+s));return n===1?(t=e[r-1],i.push(Vt[t>>2]+Vt[t<<4&63]+"==")):n===2&&(t=(e[r-2]<<8)+e[r-1],i.push(Vt[t>>10]+Vt[t>>4&63]+Vt[t<<2&63]+"=")),i.join("")}function ZL(e){if(e===void 0)return{};if(!O_(e))throw new Error(`The arguments to a Convex function must be an object. Received: ${e}`);return e}function JL(e){if(typeof e>"u")throw new Error("Client created with undefined deployment address. If you used an environment variable, check that it's set.");if(typeof e!="string")throw new Error(`Invalid deployment address: found ${e}".`);if(!(e.startsWith("http:")||e.startsWith("https:")))throw new Error(`Invalid deployment address: Must start with "https://" or "http://". Found "${e}".`);try{new URL(e)}catch{throw new Error(`Invalid deployment address: "${e}" is not a valid URL. If you believe this URL is correct, use the \`skipConvexDeploymentUrlCheck\` option to bypass this.`)}if(e.endsWith(".convex.site"))throw new Error(`Invalid deployment address: "${e}" ends with .convex.site, which is used for HTTP Actions. Convex deployment URLs typically end with .convex.cloud? If you believe this URL is correct, use the \`skipConvexDeploymentUrlCheck\` option to bypass this.`)}function O_(e){const t=typeof e=="object",r=Object.getPrototypeOf(e),n=r===null||r===Object.prototype||r?.constructor?.name==="Object";return t&&n}var x_=!0,ti=BigInt("-9223372036854775808"),Uu=BigInt("9223372036854775807"),Al=BigInt("0"),a1=BigInt("8"),c1=BigInt("256"),gc="This commit timestamp is unresolved: its value is assigned when the mutation commits. Read the document after the mutation completes to get its value.",M_=class{[Symbol.toPrimitive](e){if(e==="string")return this.toString();throw new Error(gc)}valueOf(){throw new Error(gc)}toJSON(){throw new Error(gc)}toString(){return"[unresolved commit timestamp]"}},l1=new M_;function L_(e){return Number.isNaN(e)||!Number.isFinite(e)||Object.is(e,-0)}function u1(e){e<Al&&(e-=ti+ti);let t=e.toString(16);t.length%2===1&&(t="0"+t);const r=new Uint8Array(new ArrayBuffer(8));let n=0;for(const i of t.match(/.{2}/g).reverse())r.set([parseInt(i,16)],n++),e>>=a1;return xo(r)}function d1(e){const t=Oo(e);if(t.byteLength!==8)throw new Error(`Received ${t.byteLength} bytes, expected 8 for $integer`);let r=Al,n=Al;for(const i of t)r+=BigInt(i)*c1**n,n++;return r>Uu&&(r+=ti+ti),r}function h1(e){if(e<ti||Uu<e)throw new Error(`BigInt ${e} does not fit into a 64-bit signed integer.`);const t=new ArrayBuffer(8);return new DataView(t).setBigInt64(0,e,!0),xo(new Uint8Array(t))}function p1(e){const t=Oo(e);if(t.byteLength!==8)throw new Error(`Received ${t.byteLength} bytes, expected 8 for $integer`);return new DataView(t.buffer).getBigInt64(0,!0)}var f1=DataView.prototype.setBigInt64?h1:u1,v1=DataView.prototype.getBigInt64?p1:d1,Pp=1024;function Il(e){if(e.length>Pp)throw new Error(`Field name ${e} exceeds maximum field name length ${Pp}.`);if(e.startsWith("$"))throw new Error(`Field name ${e} starts with a '$', which is reserved.`);for(let t=0;t<e.length;t+=1){const r=e.charCodeAt(t);if(r<32||r>=127)throw new Error(`Field name ${e} has invalid character '${e[t]}': Field names can only contain non-control ASCII characters`)}}function Op(e){if(e===null||typeof e=="boolean"||typeof e=="number"||typeof e=="string")return e;if(Array.isArray(e))return e.map(n=>Op(n));if(typeof e!="object")throw new Error(`Unexpected type of ${e}`);const t=Object.entries(e);if(t.length===1){const n=t[0][0];if(n==="$bytes"){if(typeof e.$bytes!="string")throw new Error(`Malformed $bytes field on ${e}`);return Oo(e.$bytes).buffer}if(n==="$integer"){if(typeof e.$integer!="string")throw new Error(`Malformed $integer field on ${e}`);return v1(e.$integer)}if(n==="$float"){if(typeof e.$float!="string")throw new Error(`Malformed $float field on ${e}`);const i=Oo(e.$float);if(i.byteLength!==8)throw new Error(`Received ${i.byteLength} bytes, expected 8 for $float`);const s=new DataView(i.buffer).getFloat64(0,x_);if(!L_(s))throw new Error(`Float ${s} should be encoded as a number`);return s}if(n==="$commitTs"){if(e.$commitTs!==null)throw new Error(`Malformed $commitTs field on ${e}`);return l1}if(n==="$set")throw new Error("Received a Set which is no longer supported as a Convex type.");if(n==="$map")throw new Error("Received a Map which is no longer supported as a Convex type.")}const r={};for(const[n,i]of Object.entries(e))Il(n),r[n]=Op(i);return r}var g1=16384;function Hn(e){const t=JSON.stringify(e,(r,n)=>n===void 0?"undefined":typeof n=="bigint"?`${n.toString()}n`:n);if(t.length>g1){const r="[...truncated]";let n=16370;const i=t.codePointAt(n-1);return i!==void 0&&i>65535&&(n-=1),t.substring(0,n)+r}return t}function Mo(e,t,r,n){if(e===void 0){const o=r&&` (present at path ${r} in original object ${Hn(t)})`;throw new Error(`undefined is not a valid Convex value${o}. To learn about Convex's supported types, see https://docs.convex.dev/using/types.`)}if(e===null)return e;if(typeof e=="bigint"){if(e<ti||Uu<e)throw new Error(`BigInt ${e} does not fit into a 64-bit signed integer.`);return{$integer:f1(e)}}if(typeof e=="number")if(L_(e)){const o=new ArrayBuffer(8);return new DataView(o).setFloat64(0,e,x_),{$float:xo(new Uint8Array(o))}}else return e;if(typeof e=="boolean"||typeof e=="string")return e;if(e instanceof ArrayBuffer)return{$bytes:xo(new Uint8Array(e))};if(e instanceof M_)return{$commitTs:null};if(Array.isArray(e))return e.map((o,a)=>Mo(o,t,r+`[${a}]`,!1));if(e instanceof Set)throw new Error(mc(r,"Set",[...e],t));if(e instanceof Map)throw new Error(mc(r,"Map",[...e],t));if(!O_(e)){const o=e?.constructor?.name,a=o?`${o} `:"";throw new Error(mc(r,a,e,t))}const i={},s=Object.entries(e);s.sort(([o,a],[c,l])=>o===c?0:o<c?-1:1);for(const[o,a]of s)a!==void 0?(Il(o),i[o]=Mo(a,t,r+`.${o}`,!1)):n&&(Il(o),i[o]=m1(a,t,r+`.${o}`));return i}function mc(e,t,r,n){return e?`${t}${Hn(r)} is not a supported Convex type (present at path ${e} in original object ${Hn(n)}). To learn about Convex's supported types, see https://docs.convex.dev/using/types.`:`${t}${Hn(r)} is not a supported Convex type.`}function m1(e,t,r){if(e===void 0)return{$undefined:null};if(t===void 0)throw new Error(`Programming error. Current value is ${Hn(e)} but original value is undefined`);return Mo(e,t,r,!1)}function KL(e){return Mo(e,e,"",!1)}var _1=Object.defineProperty,y1=(e,t,r)=>t in e?_1(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,_c=(e,t,r)=>y1(e,typeof t!="symbol"?t+"":t,r),xp,Mp,b1=Symbol.for("ConvexError"),D_=class extends(Mp=Error,xp=b1,Mp){constructor(e){super(typeof e=="string"?e:Hn(e)),_c(this,"name","ConvexError"),_c(this,"data"),_c(this,xp,!0),this.data=e}};function Fu(e){if(!(e instanceof D_))return!1;const t=e.data;return typeof t=="object"&&t!==null&&t.kind==="forbidden"}function qu(e){if(!(e instanceof D_))return!1;const t=e.data;return typeof t=="object"&&t!==null&&t.kind==="session_revoked"}var Lo;function YL(e){try{Lo=new URL(e).hostname}catch{Lo=void 0}}function Tl(e){try{const t=new URL(e);if(!/^https?:$/.test(t.protocol))return;const r=t.pathname.replace(/(\/(?:results|conformance\/shared|evals\/shared|organizations)\/)[^/]+/g,"$1[redacted]").replace(/(\/(?:user-testing|chatbox)\/[^/]+\/)[^/]+/g,"$1[redacted]");return`${t.origin}${r}`}catch{return}}function Vi(e){const t=/^\[CONVEX Q\(([\w/.-]+:[\w.-]+)\)\]/.exec(e);if(!t)return;const r=/\[Request ID: ([a-f\d]+)\]/i.exec(e)?.[1],n=`${t[0]}${r?` [Request ID: ${r}]`:""} ${/\bServer Error\b/.test(e)?"Server Error":"Query failed"}`;return{functionName:t[1],requestId:r,safeMessage:n}}function N_(e){const t=Vi(e);if(t)return{convex_function:t.functionName,...t.requestId?{request_id:t.requestId}:{},...Lo?{convex_backend:Lo}:{}}}function w1(e){const t=Vi(e.message);if(!t)return e;const r=new Error(t.safeMessage);if(r.name=e.name,e.stack){const n=e.stack.split(`
|
|
97
97
|
`).filter(i=>/^(\s+at |[^@]*@(?:https?|file|webpack|vite):)/.test(i));r.stack=`${r.name}: ${r.message}
|
|
98
98
|
${n.join(`
|
|
99
99
|
`)}`}return r}function z_(e=500){const t=new Set;return(r,n)=>{if(!r||!n)return!1;const i=`${r}:${n}`;return t.has(i)?!0:(t.add(i),t.size>e&&t.delete(t.values().next().value),!1)}}function XL(e=500){const t=z_(e);return(r,n={})=>{try{const i=r.exception?.values,s=i?.find(u=>Vi(u.value??"")),o=Vi(s?.value??"");if(!o)return r;if(Fu(n.originalException)||qu(n.originalException))return null;const a=N_(s.value),c=typeof r.tags?.convex_backend=="string"?r.tags.convex_backend:a.convex_backend;if(t(c,o.requestId))return null;s.value=o.safeMessage,r.message&&(r.message=o.safeMessage),r.tags={...r.tags,...a,...c?{convex_backend:c}:{}};const l=Tl((typeof r.extra?.page_location=="string"?r.extra.page_location:void 0)??r.request?.url??(typeof window<"u"?window.location.href:""));r.request=l?{url:l}:void 0,r.breadcrumbs=void 0,r.extra={...typeof r.extra?.boundary=="string"?{boundary:r.extra.boundary}:{},...typeof r.extra?.componentStack=="string"?{componentStack:r.extra.componentStack}:{},...l?{page_location:l}:{}};for(const u of i??[])if(u!==s&&u.value&&(u.value=Vi(u.value)?.safeMessage??"Query failure cause"),u.stacktrace)for(const h of u.stacktrace.frames??[])delete h.vars;return r.transaction?.includes("/")&&(r.transaction=Tl(`https://route.invalid${r.transaction}`)?.replace("https://route.invalid","")),r}catch{return null}}}var S1=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__,U_="8.55.1",Tt=globalThis;function _a(e,t,r){const n=r||Tt,i=n.__SENTRY__=n.__SENTRY__||{},s=i[U_]=i["8.55.1"]||{};return s[e]||(s[e]=t())}var ya=typeof __SENTRY_DEBUG__>"u"||__SENTRY_DEBUG__,E1="Sentry Logger ",Lp=["debug","info","warn","error","log","assert","trace"],Dp={};function F_(e){if(!("console"in Tt))return e();const t=Tt.console,r={},n=Object.keys(Dp);n.forEach(i=>{const s=Dp[i];r[i]=t[i],t[i]=s});try{return e()}finally{n.forEach(i=>{t[i]=r[i]})}}function k1(){let e=!1;const t={enable:()=>{e=!0},disable:()=>{e=!1},isEnabled:()=>e};return ya?Lp.forEach(r=>{t[r]=(...n)=>{e&&F_(()=>{Tt.console[r](`${E1}[${r}]:`,...n)})}}):Lp.forEach(r=>{t[r]=()=>{}}),t}var dn=_a("logger",k1),q_=50;var Np=/\(error: (.*)\)/,zp=/captureMessage|captureException/;function R1(...e){const t=e.sort((r,n)=>r[0]-n[0]).map(r=>r[1]);return(r,n=0,i=0)=>{const s=[],o=r.split(`
|
|
100
100
|
`);for(let a=n;a<o.length;a++){const c=o[a];if(c.length>1024)continue;const l=Np.test(c)?c.replace(Np,"$1"):c;if(!l.match(/\S*Error: /)){for(const u of t){const h=u(l);if(h){s.push(h);break}}if(s.length>=q_+i)break}}return A1(s.slice(i))}}function QL(e){return Array.isArray(e)?R1(...e):e}function A1(e){if(!e.length)return[];const t=Array.from(e);return/sentryWrapped/.test(Ms(t).function||"")&&t.pop(),t.reverse(),zp.test(Ms(t).function||"")&&(t.pop(),zp.test(Ms(t).function||"")&&t.pop()),t.slice(0,q_).map(r=>({...r,filename:r.filename||Ms(t).filename,function:r.function||"?"}))}function Ms(e){return e[e.length-1]||{}}var yc="<anonymous>";function I1(e){try{return!e||typeof e!="function"?yc:e.name||yc}catch{return yc}}function eD(e){const t=e.exception;if(t){const r=[];try{return t.values.forEach(n=>{n.stacktrace.frames&&r.push(...n.stacktrace.frames)}),r}catch{return}}}function ps(){return ju(Tt),Tt}function ju(e){const t=e.__SENTRY__=e.__SENTRY__||{};return t.version=t.version||"8.55.1",t[U_]=t["8.55.1"]||{}}var j_=Object.prototype.toString;function T1(e){switch(j_.call(e)){case"[object Error]":case"[object Exception]":case"[object DOMException]":case"[object WebAssembly.Exception]":return!0;default:return ba(e,Error)}}function li(e,t){return j_.call(e)===`[object ${t}]`}function tD(e){return li(e,"ErrorEvent")}function rD(e){return li(e,"DOMError")}function nD(e){return li(e,"DOMException")}function Do(e){return li(e,"String")}function C1(e){return typeof e=="object"&&e!==null&&"__sentry_template_string__"in e&&"__sentry_template_values__"in e}function iD(e){return e===null||C1(e)||typeof e!="object"&&typeof e!="function"}function Hu(e){return li(e,"Object")}function $1(e){return typeof Event<"u"&&ba(e,Event)}function P1(e){return typeof Element<"u"&&ba(e,Element)}function O1(e){return li(e,"RegExp")}function Vu(e){return!!(e&&e.then&&typeof e.then=="function")}function x1(e){return Hu(e)&&"nativeEvent"in e&&"preventDefault"in e&&"stopPropagation"in e}function ba(e,t){try{return e instanceof t}catch{return!1}}function H_(e){return!!(typeof e=="object"&&e!==null&&(e.__isVue||e._isVue))}var Vn=Tt,M1=80;function L1(e,t={}){if(!e)return"<unknown>";try{let r=e;const n=5,i=[];let s=0,o=0;const a=" > ",c=3;let l;const u=Array.isArray(t)?t:t.keyAttrs,h=!Array.isArray(t)&&t.maxStringLength||M1;for(;r&&s++<n&&(l=D1(r,u),!(l==="html"||s>1&&o+i.length*c+l.length>=h));)i.push(l),o+=l.length,r=r.parentNode;return i.reverse().join(a)}catch{return"<unknown>"}}function D1(e,t){const r=e,n=[];if(!r||!r.tagName)return"";if(Vn.HTMLElement&&r instanceof HTMLElement&&r.dataset){if(r.dataset.sentryComponent)return r.dataset.sentryComponent;if(r.dataset.sentryElement)return r.dataset.sentryElement}n.push(r.tagName.toLowerCase());const i=t&&t.length?t.filter(s=>r.getAttribute(s)).map(s=>[s,r.getAttribute(s)]):null;if(i&&i.length)i.forEach(s=>{n.push(`[${s[0]}="${s[1]}"]`)});else{r.id&&n.push(`#${r.id}`);const s=r.className;if(s&&Do(s)){const o=s.split(/\s+/);for(const a of o)n.push(`.${a}`)}}for(const s of["aria-label","type","name","title","alt"]){const o=r.getAttribute(s);o&&n.push(`[${s}="${o}"]`)}return n.join("")}function sD(){try{return Vn.document.location.href}catch{return""}}function oD(e){return Vn.document&&Vn.document.querySelector?Vn.document.querySelector(e):null}function aD(e){if(!Vn.HTMLElement)return null;let t=e;const r=5;for(let n=0;n<r;n++){if(!t)return null;if(t instanceof HTMLElement){if(t.dataset.sentryComponent)return t.dataset.sentryComponent;if(t.dataset.sentryElement)return t.dataset.sentryElement}t=t.parentNode}return null}function Bi(e,t=0){return typeof e!="string"||t===0||e.length<=t?e:`${e.slice(0,t)}...`}function cD(e,t){if(!Array.isArray(e))return"";const r=[];for(let n=0;n<e.length;n++){const i=e[n];try{H_(i)?r.push("[VueViewModel]"):r.push(String(i))}catch{r.push("[value cannot be serialized]")}}return r.join(t)}function N1(e,t,r=!1){return Do(e)?O1(t)?t.test(e):Do(t)?r?e===t:e.includes(t):!1:!1}function lD(e,t=[],r=!1){return t.some(n=>N1(e,n,r))}function uD(e,t,r){if(!(t in e))return;const n=e[t],i=r(n);typeof i=="function"&&z1(i,n);try{e[t]=i}catch{ya&&dn.log(`Failed to replace method "${t}" in object`,e)}}function ri(e,t,r){try{Object.defineProperty(e,t,{value:r,writable:!0,configurable:!0})}catch{ya&&dn.log(`Failed to add non-enumerable property "${t}" to object`,e)}}function z1(e,t){try{e.prototype=t.prototype=t.prototype||{},ri(e,"__sentry_original__",t)}catch{}}function dD(e){return e.__sentry_original__}function V_(e){if(T1(e))return{message:e.message,name:e.name,stack:e.stack,...Fp(e)};if($1(e)){const t={type:e.type,target:Up(e.target),currentTarget:Up(e.currentTarget),...Fp(e)};return typeof CustomEvent<"u"&&ba(e,CustomEvent)&&(t.detail=e.detail),t}else return e}function Up(e){try{return P1(e)?L1(e):Object.prototype.toString.call(e)}catch{return"<unknown>"}}function Fp(e){if(typeof e=="object"&&e!==null){const t={};for(const r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t}else return{}}function hD(e,t=40){const r=Object.keys(V_(e));r.sort();const n=r[0];if(!n)return"[object has no keys]";if(n.length>=t)return Bi(n,t);for(let i=r.length;i>0;i--){const s=r.slice(0,i).join(", ");if(!(s.length>t))return i===r.length?s:Bi(s,t)}return""}function Nt(e){return Cl(e,new Map)}function Cl(e,t){if(U1(e)){const r=t.get(e);if(r!==void 0)return r;const n={};t.set(e,n);for(const i of Object.getOwnPropertyNames(e))typeof e[i]<"u"&&(n[i]=Cl(e[i],t));return n}if(Array.isArray(e)){const r=t.get(e);if(r!==void 0)return r;const n=[];return t.set(e,n),e.forEach(i=>{n.push(Cl(i,t))}),n}return e}function U1(e){if(!Hu(e))return!1;try{const t=Object.getPrototypeOf(e).constructor.name;return!t||t==="Object"}catch{return!0}}var B_=1e3;function Bu(){return Date.now()/B_}function F1(){const{performance:e}=Tt;if(!e||!e.now)return Bu;const t=Date.now()-e.now(),r=e.timeOrigin==null?t:e.timeOrigin;return()=>(r+e.now())/B_}var Gu=F1(),Ls,pD=(()=>{const{performance:e}=Tt;if(!e||!e.now){Ls="none";return}const t=36e5,r=e.now(),n=Date.now(),i=e.timeOrigin?Math.abs(e.timeOrigin+r-n):t,s=i<t,o=e.timing&&e.timing.navigationStart,a=typeof o=="number"?Math.abs(o+r-n):t;return s||a<t?i<=a?(Ls="timeOrigin",e.timeOrigin):(Ls="navigationStart",o):(Ls="dateNow",n)})();function $r(){const e=Tt,t=e.crypto||e.msCrypto;let r=()=>Math.random()*16;try{if(t&&t.randomUUID)return t.randomUUID().replace(/-/g,"");t&&t.getRandomValues&&(r=()=>{const n=new Uint8Array(1);return t.getRandomValues(n),n[0]})}catch{}return"10000000100040008000100000000000".replace(/[018]/g,n=>(n^(r()&15)>>n/4).toString(16))}function G_(e){return e.exception&&e.exception.values?e.exception.values[0]:void 0}function fD(e){const{message:t,event_id:r}=e;if(t)return t;const n=G_(e);return n?n.type&&n.value?`${n.type}: ${n.value}`:n.type||n.value||r||"<unknown>":r||"<unknown>"}function vD(e,t,r){const n=e.exception=e.exception||{},i=n.values=n.values||[],s=i[0]=i[0]||{};s.value||(s.value=t||""),s.type||(s.type=r||"Error")}function q1(e,t){const r=G_(e);if(!r)return;const n={type:"generic",handled:!0},i=r.mechanism;if(r.mechanism={...n,...i,...t},t&&"data"in t){const s={...i&&i.data,...t.data};r.mechanism.data=s}}function gD(e){if(j1(e))return!0;try{ri(e,"__sentry_captured__",!0)}catch{}return!1}function j1(e){try{return e.__sentry_captured__}catch{}}var nr;(function(e){e[e.PENDING=0]="PENDING";const r=1;e[e.RESOLVED=r]="RESOLVED";const n=2;e[e.REJECTED=n]="REJECTED"})(nr||(nr={}));function mD(e){return new Wu(t=>{t(e)})}function _D(e){return new Wu((t,r)=>{r(e)})}var Wu=class rn{constructor(t){rn.prototype.__init.call(this),rn.prototype.__init2.call(this),rn.prototype.__init3.call(this),rn.prototype.__init4.call(this),this._state=nr.PENDING,this._handlers=[];try{t(this._resolve,this._reject)}catch(r){this._reject(r)}}then(t,r){return new rn((n,i)=>{this._handlers.push([!1,s=>{if(!t)n(s);else try{n(t(s))}catch(o){i(o)}},s=>{if(!r)i(s);else try{n(r(s))}catch(o){i(o)}}]),this._executeHandlers()})}catch(t){return this.then(r=>r,t)}finally(t){return new rn((r,n)=>{let i,s;return this.then(o=>{s=!1,i=o,t&&t()},o=>{s=!0,i=o,t&&t()}).then(()=>{if(s){n(i);return}r(i)})})}__init(){this._resolve=t=>{this._setResult(nr.RESOLVED,t)}}__init2(){this._reject=t=>{this._setResult(nr.REJECTED,t)}}__init3(){this._setResult=(t,r)=>{if(this._state===nr.PENDING){if(Vu(r)){r.then(this._resolve,this._reject);return}this._state=t,this._value=r,this._executeHandlers()}}}__init4(){this._executeHandlers=()=>{if(this._state===nr.PENDING)return;const t=this._handlers.slice();this._handlers=[],t.forEach(r=>{r[0]||(this._state===nr.RESOLVED&&r[1](this._value),this._state===nr.REJECTED&&r[2](this._value),r[0]=!0)})}}};function H1(e){const t=Gu(),r={sid:$r(),init:!0,timestamp:t,started:t,duration:0,status:"ok",errors:0,ignoreDuration:!1,toJSON:()=>B1(r)};return e&&wa(r,e),r}function wa(e,t={}){if(t.user&&(!e.ipAddress&&t.user.ip_address&&(e.ipAddress=t.user.ip_address),!e.did&&!t.did&&(e.did=t.user.id||t.user.email||t.user.username)),e.timestamp=t.timestamp||Gu(),t.abnormal_mechanism&&(e.abnormal_mechanism=t.abnormal_mechanism),t.ignoreDuration&&(e.ignoreDuration=t.ignoreDuration),t.sid&&(e.sid=t.sid.length===32?t.sid:$r()),t.init!==void 0&&(e.init=t.init),!e.did&&t.did&&(e.did=`${t.did}`),typeof t.started=="number"&&(e.started=t.started),e.ignoreDuration)e.duration=void 0;else if(typeof t.duration=="number")e.duration=t.duration;else{const r=e.timestamp-e.started;e.duration=r>=0?r:0}t.release&&(e.release=t.release),t.environment&&(e.environment=t.environment),!e.ipAddress&&t.ipAddress&&(e.ipAddress=t.ipAddress),!e.userAgent&&t.userAgent&&(e.userAgent=t.userAgent),typeof t.errors=="number"&&(e.errors=t.errors),t.status&&(e.status=t.status)}function V1(e,t){let r={};t?r={status:t}:e.status==="ok"&&(r={status:"exited"}),wa(e,r)}function B1(e){return Nt({sid:`${e.sid}`,init:e.init,started:new Date(e.started*1e3).toISOString(),timestamp:new Date(e.timestamp*1e3).toISOString(),status:e.status,errors:e.errors,did:typeof e.did=="number"||typeof e.did=="string"?`${e.did}`:void 0,duration:e.duration,abnormal_mechanism:e.abnormal_mechanism,attrs:{release:e.release,environment:e.environment,ip_address:e.ipAddress,user_agent:e.userAgent}})}function No(){return $r()}function ni(){return $r().substring(16)}function Sa(e,t,r=2){if(!t||typeof t!="object"||r<=0)return t;if(e&&t&&Object.keys(t).length===0)return e;const n={...e};for(const i in t)Object.prototype.hasOwnProperty.call(t,i)&&(n[i]=Sa(n[i],t[i],r-1));return n}var $l="_sentrySpan";function qp(e,t){t?ri(e,$l,t):delete e[$l]}function Pl(e){return e[$l]}var G1=100,W1=class W_{constructor(){this._notifyingListeners=!1,this._scopeListeners=[],this._eventProcessors=[],this._breadcrumbs=[],this._attachments=[],this._user={},this._tags={},this._extra={},this._contexts={},this._sdkProcessingMetadata={},this._propagationContext={traceId:No(),spanId:ni()}}clone(){const t=new W_;return t._breadcrumbs=[...this._breadcrumbs],t._tags={...this._tags},t._extra={...this._extra},t._contexts={...this._contexts},this._contexts.flags&&(t._contexts.flags={values:[...this._contexts.flags.values]}),t._user=this._user,t._level=this._level,t._session=this._session,t._transactionName=this._transactionName,t._fingerprint=this._fingerprint,t._eventProcessors=[...this._eventProcessors],t._requestSession=this._requestSession,t._attachments=[...this._attachments],t._sdkProcessingMetadata={...this._sdkProcessingMetadata},t._propagationContext={...this._propagationContext},t._client=this._client,t._lastEventId=this._lastEventId,qp(t,Pl(this)),t}setClient(t){this._client=t}setLastEventId(t){this._lastEventId=t}getClient(){return this._client}lastEventId(){return this._lastEventId}addScopeListener(t){this._scopeListeners.push(t)}addEventProcessor(t){return this._eventProcessors.push(t),this}setUser(t){return this._user=t||{email:void 0,id:void 0,ip_address:void 0,username:void 0},this._session&&wa(this._session,{user:t}),this._notifyScopeListeners(),this}getUser(){return this._user}getRequestSession(){return this._requestSession}setRequestSession(t){return this._requestSession=t,this}setTags(t){return this._tags={...this._tags,...t},this._notifyScopeListeners(),this}setTag(t,r){return this._tags={...this._tags,[t]:r},this._notifyScopeListeners(),this}setExtras(t){return this._extra={...this._extra,...t},this._notifyScopeListeners(),this}setExtra(t,r){return this._extra={...this._extra,[t]:r},this._notifyScopeListeners(),this}setFingerprint(t){return this._fingerprint=t,this._notifyScopeListeners(),this}setLevel(t){return this._level=t,this._notifyScopeListeners(),this}setTransactionName(t){return this._transactionName=t,this._notifyScopeListeners(),this}setContext(t,r){return r===null?delete this._contexts[t]:this._contexts[t]=r,this._notifyScopeListeners(),this}setSession(t){return t?this._session=t:delete this._session,this._notifyScopeListeners(),this}getSession(){return this._session}update(t){if(!t)return this;const r=typeof t=="function"?t(this):t,[n,i]=r instanceof qr?[r.getScopeData(),r.getRequestSession()]:Hu(r)?[t,t.requestSession]:[],{tags:s,extra:o,user:a,contexts:c,level:l,fingerprint:u=[],propagationContext:h}=n||{};return this._tags={...this._tags,...s},this._extra={...this._extra,...o},this._contexts={...this._contexts,...c},a&&Object.keys(a).length&&(this._user=a),l&&(this._level=l),u.length&&(this._fingerprint=u),h&&(this._propagationContext=h),i&&(this._requestSession=i),this}clear(){return this._breadcrumbs=[],this._tags={},this._extra={},this._user={},this._contexts={},this._level=void 0,this._transactionName=void 0,this._fingerprint=void 0,this._requestSession=void 0,this._session=void 0,qp(this,void 0),this._attachments=[],this.setPropagationContext({traceId:No()}),this._notifyScopeListeners(),this}addBreadcrumb(t,r){const n=typeof r=="number"?r:G1;if(n<=0)return this;const i={timestamp:Bu(),...t};return this._breadcrumbs.push(i),this._breadcrumbs.length>n&&(this._breadcrumbs=this._breadcrumbs.slice(-n),this._client&&this._client.recordDroppedEvent("buffer_overflow","log_item")),this._notifyScopeListeners(),this}getLastBreadcrumb(){return this._breadcrumbs[this._breadcrumbs.length-1]}clearBreadcrumbs(){return this._breadcrumbs=[],this._notifyScopeListeners(),this}addAttachment(t){return this._attachments.push(t),this}clearAttachments(){return this._attachments=[],this}getScopeData(){return{breadcrumbs:this._breadcrumbs,attachments:this._attachments,contexts:this._contexts,tags:this._tags,extra:this._extra,user:this._user,level:this._level,fingerprint:this._fingerprint||[],eventProcessors:this._eventProcessors,propagationContext:this._propagationContext,sdkProcessingMetadata:this._sdkProcessingMetadata,transactionName:this._transactionName,span:Pl(this)}}setSDKProcessingMetadata(t){return this._sdkProcessingMetadata=Sa(this._sdkProcessingMetadata,t,2),this}setPropagationContext(t){return this._propagationContext={spanId:ni(),...t},this}getPropagationContext(){return this._propagationContext}captureException(t,r){const n=r&&r.event_id?r.event_id:$r();if(!this._client)return dn.warn("No client configured on scope - will not capture exception!"),n;const i=new Error("Sentry syntheticException");return this._client.captureException(t,{originalException:t,syntheticException:i,...r,event_id:n},this),n}captureMessage(t,r,n){const i=n&&n.event_id?n.event_id:$r();if(!this._client)return dn.warn("No client configured on scope - will not capture message!"),i;const s=new Error(t);return this._client.captureMessage(t,r,{originalException:t,syntheticException:s,...n,event_id:i},this),i}captureEvent(t,r){const n=r&&r.event_id?r.event_id:$r();return this._client?(this._client.captureEvent(t,{...r,event_id:n},this),n):(dn.warn("No client configured on scope - will not capture event!"),n)}_notifyScopeListeners(){this._notifyingListeners||(this._notifyingListeners=!0,this._scopeListeners.forEach(t=>{t(this)}),this._notifyingListeners=!1)}},qr=W1;function Z1(){return _a("defaultCurrentScope",()=>new qr)}function J1(){return _a("defaultIsolationScope",()=>new qr)}var K1=class{constructor(e,t){let r;e?r=e:r=new qr;let n;t?n=t:n=new qr,this._stack=[{scope:r}],this._isolationScope=n}withScope(e){const t=this._pushScope();let r;try{r=e(t)}catch(n){throw this._popScope(),n}return Vu(r)?r.then(n=>(this._popScope(),n),n=>{throw this._popScope(),n}):(this._popScope(),r)}getClient(){return this.getStackTop().client}getScope(){return this.getStackTop().scope}getIsolationScope(){return this._isolationScope}getStackTop(){return this._stack[this._stack.length-1]}_pushScope(){const e=this.getScope().clone();return this._stack.push({client:this.getClient(),scope:e}),e}_popScope(){return this._stack.length<=1?!1:!!this._stack.pop()}};function ii(){const e=ps(),t=ju(e);return t.stack=t.stack||new K1(Z1(),J1())}function Y1(e){return ii().withScope(e)}function X1(e,t){const r=ii();return r.withScope(()=>(r.getStackTop().scope=e,t(e)))}function jp(e){return ii().withScope(()=>e(ii().getIsolationScope()))}function Q1(){return{withIsolationScope:jp,withScope:Y1,withSetScope:X1,withSetIsolationScope:(e,t)=>jp(t),getCurrentScope:()=>ii().getScope(),getIsolationScope:()=>ii().getIsolationScope()}}function Ea(e){const t=ju(e);return t.acs?t.acs:Q1()}function Hr(){const e=ps();return Ea(e).getCurrentScope()}function mn(){const e=ps();return Ea(e).getIsolationScope()}function ex(){return _a("globalScope",()=>new qr)}function yD(...e){const t=ps(),r=Ea(t);if(e.length===2){const[n,i]=e;return n?r.withSetScope(n,i):r.withScope(i)}return r.withScope(e[0])}function fs(){return Hr().getClient()}function bD(e){const{traceId:t,spanId:r,parentSpanId:n}=e.getPropagationContext();return Nt({trace_id:t,span_id:r,parent_span_id:n})}var tx="_sentryMetrics";function rx(e){const t=e[tx];if(!t)return;const r={};for(const[,[n,i]]of t)(r[n]||(r[n]=[])).push(Nt(i));return r}var nx="sentry.source",ix="sentry.sample_rate",sx="sentry.op",ox="sentry.origin",wD="sentry.idle_span_finish_reason",SD="sentry.measurement_unit",ED="sentry.measurement_value",kD="sentry.custom_span_name",RD="sentry.profile_id",AD="sentry.exclusive_time";function ax(e){if(e<400&&e>=100)return{code:1};if(e>=400&&e<500)switch(e){case 401:return{code:2,message:"unauthenticated"};case 403:return{code:2,message:"permission_denied"};case 404:return{code:2,message:"not_found"};case 409:return{code:2,message:"already_exists"};case 413:return{code:2,message:"failed_precondition"};case 429:return{code:2,message:"resource_exhausted"};case 499:return{code:2,message:"cancelled"};default:return{code:2,message:"invalid_argument"}}if(e>=500&&e<600)switch(e){case 501:return{code:2,message:"unimplemented"};case 503:return{code:2,message:"unavailable"};case 504:return{code:2,message:"deadline_exceeded"};default:return{code:2,message:"internal_error"}}return{code:2,message:"unknown_error"}}function ID(e,t){e.setAttribute("http.response.status_code",t);const r=ax(t);r.message!=="unknown_error"&&e.setStatus(r)}var cx="sentry-",lx=/^sentry-/;function Z_(e){const t=ux(e);if(!t)return;const r=Object.entries(t).reduce((n,[i,s])=>{if(i.match(lx)){const o=i.slice(7);n[o]=s}return n},{});if(Object.keys(r).length>0)return r}function TD(e){if(e)return dx(Object.entries(e).reduce((t,[r,n])=>(n&&(t[`${cx}${r}`]=n),t),{}))}function ux(e){if(!(!e||!Do(e)&&!Array.isArray(e)))return Array.isArray(e)?e.reduce((t,r)=>{const n=Hp(r);return Object.entries(n).forEach(([i,s])=>{t[i]=s}),t},{}):Hp(e)}function Hp(e){return e.split(",").map(t=>t.split("=").map(r=>decodeURIComponent(r.trim()))).reduce((t,[r,n])=>(r&&n&&(t[r]=n),t),{})}function dx(e){if(Object.keys(e).length!==0)return Object.entries(e).reduce((t,[r,n],i)=>{const s=`${encodeURIComponent(r)}=${encodeURIComponent(n)}`,o=i===0?s:`${t},${s}`;return o.length>8192?(ya&&dn.warn(`Not adding key: ${r} with val: ${n} to baggage header due to exceeding baggage size limits.`),t):o},"")}var hx=new RegExp("^[ \\t]*([0-9a-f]{32})?-?([0-9a-f]{16})?-?([01])?[ \\t]*$");function px(e){if(!e)return;const t=e.match(hx);if(!t)return;let r;return t[3]==="1"?r=!0:t[3]==="0"&&(r=!1),{traceId:t[1],parentSampled:r,parentSpanId:t[2]}}function CD(e,t){const r=px(e),n=Z_(t);if(!r||!r.traceId)return{traceId:No(),spanId:ni()};const{traceId:i,parentSpanId:s,parentSampled:o}=r;return{traceId:i,parentSpanId:s,spanId:ni(),sampled:o,dsc:n||{}}}function fx(e=No(),t=ni(),r){let n="";return r!==void 0&&(n=r?"-1":"-0"),`${e}-${t}${n}`}var Vp=!1;function $D(e){const{spanId:t,traceId:r}=e.spanContext(),{data:n,op:i,parent_span_id:s,status:o,origin:a}=ka(e);return Nt({parent_span_id:s,span_id:t,trace_id:r,data:n,op:i,status:o,origin:a})}function vx(e){const{spanId:t,traceId:r,isRemote:n}=e.spanContext(),i=n?t:ka(e).parent_span_id,s=n?ni():t;return Nt({parent_span_id:i,span_id:s,trace_id:r})}function PD(e){const{traceId:t,spanId:r}=e.spanContext(),n=Zu(e);return fx(t,r,n)}function Bp(e){return typeof e=="number"?Gp(e):Array.isArray(e)?e[0]+e[1]/1e9:e instanceof Date?Gp(e.getTime()):Gu()}function Gp(e){return e>9999999999?e/1e3:e}function ka(e){if(mx(e))return e.getSpanJSON();try{const{spanId:t,traceId:r}=e.spanContext();if(gx(e)){const{attributes:n,startTime:i,name:s,endTime:o,parentSpanId:a,status:c}=e;return Nt({span_id:t,trace_id:r,data:n,description:s,parent_span_id:a,start_timestamp:Bp(i),timestamp:Bp(o)||void 0,status:_x(c),op:n[sx],origin:n[ox],_metrics_summary:rx(e)})}return{span_id:t,trace_id:r}}catch{return{}}}function gx(e){const t=e;return!!t.attributes&&!!t.startTime&&!!t.name&&!!t.endTime&&!!t.status}function mx(e){return typeof e.getSpanJSON=="function"}function Zu(e){const{traceFlags:t}=e.spanContext();return t===1}function _x(e){if(!(!e||e.code===0))return e.code===1?"ok":e.message||"unknown_error"}var hn="_sentryChildSpans",Ol="_sentryRootSpan";function OD(e,t){const r=e[Ol]||e;ri(t,Ol,r),e[hn]?e[hn].add(t):ri(e,hn,new Set([t]))}function xD(e,t){e[hn]&&e[hn].delete(t)}function MD(e){const t=new Set;function r(n){if(!t.has(n)&&Zu(n)){t.add(n);const i=n[hn]?Array.from(n[hn]):[];for(const s of i)r(s)}}return r(e),Array.from(t)}function J_(e){return e[Ol]||e}function LD(){const e=ps(),t=Ea(e);return t.getActiveSpan?t.getActiveSpan():Pl(Hr())}function DD(){Vp||(F_(()=>{console.warn("[Sentry] Deprecation warning: Returning null from `beforeSendSpan` will be disallowed from SDK version 9.0.0 onwards. The callback will only support mutating spans. To drop certain spans, configure the respective integrations directly.")}),Vp=!0)}function yx(e){if(typeof __SENTRY_TRACING__=="boolean"&&!__SENTRY_TRACING__)return!1;const t=fs(),r=e||t&&t.getOptions();return!!r&&(r.enableTracing||"tracesSampleRate"in r||"tracesSampler"in r)}var bx="production",K_="_frozenDsc";function ND(e,t){ri(e,K_,t)}function Y_(e,t){const r=t.getOptions(),{publicKey:n}=t.getDsn()||{},i=Nt({environment:r.environment||"production",release:r.release,public_key:n,trace_id:e});return t.emit("createDsc",i),i}function zD(e,t){const r=t.getPropagationContext();return r.dsc||Y_(r.traceId,e)}function wx(e){const t=fs();if(!t)return{};const r=J_(e),n=r[K_];if(n)return n;const i=r.spanContext().traceState,s=i&&i.get("sentry.dsc"),o=s&&Z_(s);if(o)return o;const a=Y_(e.spanContext().traceId,t),c=ka(r),l=c.data||{},u=l[ix];u!=null&&(a.sample_rate=`${u}`);const h=l[nx],d=c.description;return h!=="url"&&d&&(a.transaction=d),yx()&&(a.sampled=String(Zu(r))),t.emit("createDsc",a,r),a}function Sx(){const e=typeof WeakSet=="function",t=e?new WeakSet:[];function r(i){if(e)return t.has(i)?!0:(t.add(i),!1);for(let s=0;s<t.length;s++)if(t[s]===i)return!0;return t.push(i),!1}function n(i){if(e)t.delete(i);else for(let s=0;s<t.length;s++)if(t[s]===i){t.splice(s,1);break}}return[r,n]}function vr(e,t=100,r=1/0){try{return xl("",e,t,r)}catch(n){return{ERROR:`**non-serializable** (${n})`}}}function Ex(e,t=3,r=102400){const n=vr(e,t);return Ix(n)>r?Ex(e,t-1,r):n}function xl(e,t,r=1/0,n=1/0,i=Sx()){const[s,o]=i;if(t==null||["boolean","string"].includes(typeof t)||typeof t=="number"&&Number.isFinite(t))return t;const a=kx(e,t);if(!a.startsWith("[object "))return a;if(t.__sentry_skip_normalization__)return t;const c=typeof t.__sentry_override_normalization_depth__=="number"?t.__sentry_override_normalization_depth__:r;if(c===0)return a.replace("object ","");if(s(t))return"[Circular ~]";const l=t;if(l&&typeof l.toJSON=="function")try{return xl("",l.toJSON(),c-1,n,i)}catch{}const u=Array.isArray(t)?[]:{};let h=0;const d=V_(t);for(const p in d){if(!Object.prototype.hasOwnProperty.call(d,p))continue;if(h>=n){u[p]="[MaxProperties ~]";break}const f=d[p];u[p]=xl(p,f,c-1,n,i),h++}return o(t),u}function kx(e,t){try{if(e==="domain"&&t&&typeof t=="object"&&t._events)return"[Domain]";if(e==="domainEmitter")return"[DomainEmitter]";if(typeof global<"u"&&t===global)return"[Global]";if(typeof window<"u"&&t===window)return"[Window]";if(typeof document<"u"&&t===document)return"[Document]";if(H_(t))return"[VueViewModel]";if(x1(t))return"[SyntheticEvent]";if(typeof t=="number"&&!Number.isFinite(t))return`[${t}]`;if(typeof t=="function")return`[Function: ${I1(t)}]`;if(typeof t=="symbol")return`[${String(t)}]`;if(typeof t=="bigint")return`[BigInt: ${String(t)}]`;const r=Rx(t);return/^HTML(\w*)Element$/.test(r)?`[HTMLElement: ${r}]`:`[object ${r}]`}catch(r){return`**non-serializable** (${r})`}}function Rx(e){const t=Object.getPrototypeOf(e);return t?t.constructor.name:"null prototype"}function Ax(e){return~-encodeURI(e).split(/%..|./).length}function Ix(e){return Ax(JSON.stringify(e))}function Ml(e,t,r,n=0){return new Wu((i,s)=>{const o=e[n];if(t===null||typeof o!="function")i(t);else{const a=o({...t},r);S1&&o.id&&a===null&&dn.log(`Event processor "${o.id}" dropped event`),Vu(a)?a.then(c=>Ml(e,c,r,n+1).then(i)).then(null,s):Ml(e,a,r,n+1).then(i).then(null,s)}})}var Ds,Wp,Ns;function Tx(e){const t=Tt._sentryDebugIds;if(!t)return{};const r=Object.keys(t);return Ns&&r.length===Wp||(Wp=r.length,Ns=r.reduce((n,i)=>{Ds||(Ds={});const s=Ds[i];if(s)n[s[0]]=s[1];else{const o=e(i);for(let a=o.length-1;a>=0;a--){const c=o[a],l=c&&c.filename,u=t[i];if(l&&u){n[l]=u,Ds[i]=[l,u];break}}}return n},{})),Ns}function Cx(e,t){const{fingerprint:r,span:n,breadcrumbs:i,sdkProcessingMetadata:s}=t;$x(e,t),n&&xx(e,n),Mx(e,r),Px(e,i),Ox(e,s)}function Zp(e,t){const{extra:r,tags:n,user:i,contexts:s,level:o,sdkProcessingMetadata:a,breadcrumbs:c,fingerprint:l,eventProcessors:u,attachments:h,propagationContext:d,transactionName:p,span:f}=t;zs(e,"extra",r),zs(e,"tags",n),zs(e,"user",i),zs(e,"contexts",s),e.sdkProcessingMetadata=Sa(e.sdkProcessingMetadata,a,2),o&&(e.level=o),p&&(e.transactionName=p),f&&(e.span=f),c.length&&(e.breadcrumbs=[...e.breadcrumbs,...c]),l.length&&(e.fingerprint=[...e.fingerprint,...l]),u.length&&(e.eventProcessors=[...e.eventProcessors,...u]),h.length&&(e.attachments=[...e.attachments,...h]),e.propagationContext={...e.propagationContext,...d}}function zs(e,t,r){e[t]=Sa(e[t],r,1)}function $x(e,t){const{extra:r,tags:n,user:i,contexts:s,level:o,transactionName:a}=t,c=Nt(r);c&&Object.keys(c).length&&(e.extra={...c,...e.extra});const l=Nt(n);l&&Object.keys(l).length&&(e.tags={...l,...e.tags});const u=Nt(i);u&&Object.keys(u).length&&(e.user={...u,...e.user});const h=Nt(s);h&&Object.keys(h).length&&(e.contexts={...h,...e.contexts}),o&&(e.level=o),a&&e.type!=="transaction"&&(e.transaction=a)}function Px(e,t){const r=[...e.breadcrumbs||[],...t];e.breadcrumbs=r.length?r:void 0}function Ox(e,t){e.sdkProcessingMetadata={...e.sdkProcessingMetadata,...t}}function xx(e,t){e.contexts={trace:vx(t),...e.contexts},e.sdkProcessingMetadata={dynamicSamplingContext:wx(t),...e.sdkProcessingMetadata};const r=J_(t),n=ka(r).description;n&&!e.transaction&&e.type==="transaction"&&(e.transaction=n)}function Mx(e,t){e.fingerprint=e.fingerprint?Array.isArray(e.fingerprint)?e.fingerprint:[e.fingerprint]:[],t&&(e.fingerprint=e.fingerprint.concat(t)),e.fingerprint&&!e.fingerprint.length&&delete e.fingerprint}function UD(e,t,r,n,i,s){const{normalizeDepth:o=3,normalizeMaxBreadth:a=1e3}=e,c={...t,event_id:t.event_id||r.event_id||$r(),timestamp:t.timestamp||Bu()},l=r.integrations||e.integrations.map(v=>v.name);Lx(c,e),zx(c,l),i&&i.emit("applyFrameMetadata",t),t.type===void 0&&Dx(c,e.stackParser);const u=Fx(n,r.captureContext);r.mechanism&&q1(c,r.mechanism);const h=i?i.getEventProcessors():[],d=ex().getScopeData();if(s){const v=s.getScopeData();Zp(d,v)}if(u){const v=u.getScopeData();Zp(d,v)}const p=[...r.attachments||[],...d.attachments];p.length&&(r.attachments=p),Cx(c,d);const f=[...h,...d.eventProcessors];return Ml(f,c,r).then(v=>(v&&Nx(v),typeof o=="number"&&o>0?Ux(v,o,a):v))}function Lx(e,t){const{environment:r,release:n,dist:i,maxValueLength:s=250}=t;e.environment=e.environment||r||"production",!e.release&&n&&(e.release=n),!e.dist&&i&&(e.dist=i),e.message&&(e.message=Bi(e.message,s));const o=e.exception&&e.exception.values&&e.exception.values[0];o&&o.value&&(o.value=Bi(o.value,s));const a=e.request;a&&a.url&&(a.url=Bi(a.url,s))}function Dx(e,t){const r=Tx(t);try{e.exception.values.forEach(n=>{n.stacktrace.frames.forEach(i=>{r&&i.filename&&(i.debug_id=r[i.filename])})})}catch{}}function Nx(e){const t={};try{e.exception.values.forEach(n=>{n.stacktrace.frames.forEach(i=>{i.debug_id&&(i.abs_path?t[i.abs_path]=i.debug_id:i.filename&&(t[i.filename]=i.debug_id),delete i.debug_id)})})}catch{}if(Object.keys(t).length===0)return;e.debug_meta=e.debug_meta||{},e.debug_meta.images=e.debug_meta.images||[];const r=e.debug_meta.images;Object.entries(t).forEach(([n,i])=>{r.push({type:"sourcemap",code_file:n,debug_id:i})})}function zx(e,t){t.length>0&&(e.sdk=e.sdk||{},e.sdk.integrations=[...e.sdk.integrations||[],...t])}function Ux(e,t,r){if(!e)return null;const n={...e,...e.breadcrumbs&&{breadcrumbs:e.breadcrumbs.map(i=>({...i,...i.data&&{data:vr(i.data,t,r)}}))},...e.user&&{user:vr(e.user,t,r)},...e.contexts&&{contexts:vr(e.contexts,t,r)},...e.extra&&{extra:vr(e.extra,t,r)}};return e.contexts&&e.contexts.trace&&n.contexts&&(n.contexts.trace=e.contexts.trace,e.contexts.trace.data&&(n.contexts.trace.data=vr(e.contexts.trace.data,t,r))),e.spans&&(n.spans=e.spans.map(i=>({...i,...i.data&&{data:vr(i.data,t,r)}}))),e.contexts&&e.contexts.flags&&n.contexts&&(n.contexts.flags=vr(e.contexts.flags,3,r)),n}function Fx(e,t){if(!t)return e;const r=e?e.clone():new qr;return r.update(t),r}function qx(e){if(e)return jx(e)?{captureContext:e}:Vx(e)?{captureContext:e}:e}function jx(e){return e instanceof qr||typeof e=="function"}var Hx=["user","level","extra","contexts","tags","fingerprint","requestSession","propagationContext"];function Vx(e){return Object.keys(e).some(t=>Hx.includes(t))}function Bx(e,t){return Hr().captureException(e,qx(t))}function FD(e,t){const r=typeof t=="string"?t:void 0,n=typeof t!="string"?{captureContext:t}:void 0;return Hr().captureMessage(e,r,n)}function qD(e,t){return Hr().captureEvent(e,t)}function jD(e,t){mn().setContext(e,t)}function HD(e,t){mn().setTag(e,t)}function VD(e){mn().setUser(e)}function BD(){const e=fs();return!!e&&e.getOptions().enabled!==!1&&!!e.getTransport()}function GD(e){mn().addEventProcessor(e)}function WD(e){const t=fs(),r=mn(),n=Hr(),{release:i,environment:s=bx}=t&&t.getOptions()||{},{userAgent:o}=Tt.navigator||{},a=H1({release:i,environment:s,user:n.getUser()||r.getUser(),...o&&{userAgent:o},...e}),c=r.getSession();return c&&c.status==="ok"&&wa(c,{status:"exited"}),X_(),r.setSession(a),n.setSession(a),a}function X_(){const e=mn(),t=Hr(),r=t.getSession()||e.getSession();r&&V1(r),Q_(),e.setSession(),t.setSession()}function Q_(){const e=mn(),t=Hr(),r=fs(),n=t.getSession()||e.getSession();n&&r&&r.captureSession(n)}function ZD(e=!1){if(e){X_();return}Q_()}function Gx(e){try{if(typeof e!="object"||e===null)return;const t=e.normalized;return OR(t)?t:void 0}catch{return}}function JD(e,t){try{if(!hs()||Fu(e)||qu(e))return!1;const r=Gx(e)??nA(e),n=tA(r);return n!=="mcpjam"?!1:(ey(e,{...t,extra:{...t.extra??{},slug:r.slug,origin:n}}),!0)}catch{return!1}}var Wx=z_();function Zx(e){if(e instanceof Error)return e;try{return new Error(typeof e=="string"?e:JSON.stringify(e))}catch{return new Error(String(e))}}function ey(e,t){if(Fu(e)||qu(e))return;const r=w1(Zx(e)),n=N_(r.message);if(n&&t.queryBackend&&(n.convex_backend=t.queryBackend),n&&Wx(n.convex_backend,n.request_id))return;const i=n&&typeof window<"u"?Tl(window.location.href):void 0;try{Bx(r,{level:t.level??"error",tags:{source:t.source,...n},...n?{extra:{boundary:t.extra?.boundary,componentStack:t.extra?.componentStack,page_location:i}}:t.extra?{extra:t.extra}:{}})}catch{}try{hs()&&!zu()&&AO.captureException(r,{source:t.source,level:t.level??"error",...n?{...n,page_location:i}:t.extra??{}})}catch{}}function KD(e,t,r){ey(e,{source:r?`react_boundary:${r}`:"react_boundary",extra:{componentStack:t?.componentStack??void 0,boundary:r??"unnamed"}})}export{bD as $,oy as $i,EL as $n,Xl as $r,U_ as $t,ka as A,Ac as Ai,bT as An,hL as Ar,L1 as At,RD as B,_y as Bi,WI as Bn,Yk as Br,Do as Bt,J_ as C,_d as Ci,jL as Cn,fL as Cr,z1 as Ct,DD as D,ze as Di,FL as Dn,OR as Dr,aD as Dt,xD as E,IM as Ei,AO as En,nA as Er,Bi as Et,CD as F,vM as Fi,xL as Fn,ru as Fr,$1 as Ft,sx as G,sM as Gi,TL as Gn,rL as Gr,I1 as Gt,wD as H,gy as Hi,PL as Hn,Xk as Hr,ps as Ht,cx as I,xy as Ii,gu as In,Ir,ba as It,nx as J,fy as Ji,_r as Jn,Vk as Jr,F_ as Jt,ox as K,cy as Ki,IL as Kn,nL as Kr,QL as Kt,TD as L,lM as Li,Jd as Ln,cL as Lr,C1 as Lt,$D as M,dS as Mi,UL as Mn,fR as Mr,nD as Mt,hx as N,SM as Ni,NL as Nn,Rd as Nr,T1 as Nt,Zu as O,$M as Oi,jT as On,sA as Or,oD as Ot,fx as P,n0 as Pi,ML as Pn,Wt as Pr,tD as Pt,mn as Q,Qx as Qi,RL as Qn,Hk as Qr,Tt as Qt,ID as R,my as Ri,Kd as Rn,lL as Rr,Hu as Rt,LD as S,on as Si,VL as Sn,vL as Sr,dD as St,_x as T,Ic as Ti,PO as Tn,pL as Tr,lD as Tt,SD as U,nM as Ui,CL as Un,oL as Ur,R1 as Ut,kD as V,Sc as Vi,HI as Vn,sL as Vr,Vu as Vt,ED as W,rM as Wi,jI as Wn,aL as Wr,eD as Wt,fs as X,eM as Xi,SI as Xn,eL as Xr,Dp as Xt,rx as Y,tM as Yi,Bd as Yn,tL as Yr,dn as Yt,Hr as Z,iM as Zi,kL as Zn,QM as Zr,ya as Zt,ND as _,OM as _i,zu as _n,_L as _r,Gu as _t,qD as a,bk as ai,qu as an,rg as ar,No as at,yx as b,rv as bi,YO as bn,mL as br,hD as bt,ZD as c,MM as ci,Op as cn,ca as cr,_D as ct,HD as d,AM as di,xo as dn,Lr as dr,vD as dt,Kx as ea,VM as ei,S1 as en,vI as er,yD as et,VD as f,Ot as fi,Oo as fn,RA as fr,gD as ft,Ex as g,sE as gi,GL as gn,wA as gr,Bu as gt,vr as h,CM as hi,BL as hn,Ko as hr,pD as ht,GD as i,yk as ii,Fu as in,wL as ir,ni as it,PD as j,wS as ji,zL as jn,Dv as jr,rD as jt,Bp as k,rE as ki,dg as kn,tA as kr,sD as kt,BD as l,RM as li,ZL as ln,ia as lr,mD as lt,UD as m,xM as mi,Rl as mn,yL as mr,$r as mt,ey as n,Xx as na,jM as ni,XL as nn,SL as nr,Pl as nt,Bx as o,Es as oi,D_ as on,sa as or,wa as ot,WD as p,Yr as pi,LO as pn,De as pr,fD as pt,ix as q,vy as qi,xI as qn,iL as qr,Lp as qt,JD as r,Mc as ri,w1 as rn,aI as rr,qp as rt,FD as s,br as si,KL as sn,oa as sr,Wu as st,KD as t,Yx as ta,HM as ti,YL as tn,dI as tr,Ea as tt,jD as u,kM as ui,JL as un,bL as ur,q1 as ut,zD as v,PM as vi,hs as vn,pA as vr,ri as vt,MD as w,LM as wi,HL as wn,gL as wr,cD as wt,OD as x,ao as xi,WL as xn,aA as xr,uD as xt,wx as y,TM as yi,P_ as yn,Hc as yr,Nt as yt,AD as z,oM as zi,Zd as zn,uL as zr,iD as zt};
|
|
101
101
|
|
|
102
|
-
//# sourceMappingURL=error-reporting-
|
|
102
|
+
//# sourceMappingURL=error-reporting-CpBaShLK.js.map
|