@tscircuit/runframe 0.0.1014 → 0.0.1016
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.
|
@@ -319,7 +319,7 @@ You might need to use a local HTTP server (instead of file://): https://react.de
|
|
|
319
319
|
root.render(<App />);`),S.unstable_strictMode===!0&&(O=!0),S.identifierPrefix!==void 0&&(Y=S.identifierPrefix),S.onUncaughtError!==void 0&&(ne=S.onUncaughtError),S.onCaughtError!==void 0&&(le=S.onCaughtError),S.onRecoverableError!==void 0&&(je=S.onRecoverableError),S.unstable_transitionCallbacks!==void 0&&(tt=S.unstable_transitionCallbacks)),S=kt(x,1,!1,null,null,O,Y,ne,le,je,tt,null),x[Vs]=S.current,dx(x),new Ch(S)},tN.hydrateRoot=function(x,S,O){if(!b(x))throw Error("Target container is not a DOM element.");ol(x),S===void 0&&console.error("Must provide initial children as second argument to hydrateRoot. Example usage: hydrateRoot(domContainer, <App />)");var Y=!1,ne="",le=sx,je=bu,tt=Qm,Rt=null,Dt=null;return O!=null&&(O.unstable_strictMode===!0&&(Y=!0),O.identifierPrefix!==void 0&&(ne=O.identifierPrefix),O.onUncaughtError!==void 0&&(le=O.onUncaughtError),O.onCaughtError!==void 0&&(je=O.onCaughtError),O.onRecoverableError!==void 0&&(tt=O.onRecoverableError),O.unstable_transitionCallbacks!==void 0&&(Rt=O.unstable_transitionCallbacks),O.formState!==void 0&&(Dt=O.formState)),S=kt(x,1,!0,S,O??null,Y,ne,le,je,tt,Rt,Dt),S.context=Xt(null),O=S.current,Y=th(O),Y=Et(Y),ne=Oo(Y),ne.callback=null,_o(O,ne,Y),O=Y,S.current.lanes=O,qe(S,O),Pd(S),x[Vs]=S.current,dx(x),new Gu(S)},tN.version="19.1.0",typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())})(),tN}var vEe;function E_t(){if(vEe)return HL.exports;vEe=1;var n={env:{}};function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function")){if(n.env.NODE_ENV!=="production")throw new Error("^_^");try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}}return n.env.NODE_ENV==="production"?(e(),HL.exports=w_t()):HL.exports=S_t(),HL.exports}var T_t=E_t(),Te=gw();const ns=d2(Te),wEe=ZI({__proto__:null,default:ns},[Te]);function qa(n,e,{checkForDefaultPrevented:t=!0}={}){return function(r){if(n?.(r),t===!1||!r.defaultPrevented)return e?.(r)}}function M_t(n,e){const t=Te.createContext(e),i=o=>{const{children:s,...a}=o,c=Te.useMemo(()=>a,Object.values(a));return ye.jsx(t.Provider,{value:c,children:s})};i.displayName=n+"Provider";function r(o){const s=Te.useContext(t);if(s)return s;if(e!==void 0)return e;throw new Error(`\`${o}\` must be used within \`${n}\``)}return[i,r]}function b5(n,e=[]){let t=[];function i(o,s){const a=Te.createContext(s),c=t.length;t=[...t,s];const l=d=>{const{scope:h,children:f,...m}=d,y=h?.[n]?.[c]||a,g=Te.useMemo(()=>m,Object.values(m));return ye.jsx(y.Provider,{value:g,children:f})};l.displayName=o+"Provider";function u(d,h){const f=h?.[n]?.[c]||a,m=Te.useContext(f);if(m)return m;if(s!==void 0)return s;throw new Error(`\`${d}\` must be used within \`${o}\``)}return[l,u]}const r=()=>{const o=t.map(s=>Te.createContext(s));return function(a){const c=a?.[n]||o;return Te.useMemo(()=>({[`__scope${n}`]:{...a,[n]:c}}),[a,c])}};return r.scopeName=n,[i,A_t(r,...e)]}function A_t(...n){const e=n[0];if(n.length===1)return e;const t=()=>{const i=n.map(r=>({useScope:r(),scopeName:r.scopeName}));return function(o){const s=i.reduce((a,{useScope:c,scopeName:l})=>{const d=c(o)[`__scope${l}`];return{...a,...d}},{});return Te.useMemo(()=>({[`__scope${e.scopeName}`]:s}),[s])}};return t.scopeName=e.scopeName,t}function SEe(n,e){if(typeof n=="function")return n(e);n!=null&&(n.current=e)}function qL(...n){return e=>{let t=!1;const i=n.map(r=>{const o=SEe(r,e);return!t&&typeof o=="function"&&(t=!0),o});if(t)return()=>{for(let r=0;r<i.length;r++){const o=i[r];typeof o=="function"?o():SEe(n[r],null)}}}}function Yy(...n){return Te.useCallback(qL(...n),n)}function SC(n){const e=R_t(n),t=Te.forwardRef((i,r)=>{const{children:o,...s}=i,a=Te.Children.toArray(o),c=a.find(I_t);if(c){const l=c.props.children,u=a.map(d=>d===c?Te.Children.count(l)>1?Te.Children.only(null):Te.isValidElement(l)?l.props.children:null:d);return ye.jsx(e,{...s,ref:r,children:Te.isValidElement(l)?Te.cloneElement(l,void 0,u):null})}return ye.jsx(e,{...s,ref:r,children:o})});return t.displayName=`${n}.Slot`,t}var C_t=SC("Slot");function R_t(n){const e=Te.forwardRef((t,i)=>{const{children:r,...o}=t;if(Te.isValidElement(r)){const s=k_t(r),a=N_t(o,r.props);return r.type!==Te.Fragment&&(a.ref=i?qL(i,s):s),Te.cloneElement(r,a)}return Te.Children.count(r)>1?Te.Children.only(null):null});return e.displayName=`${n}.SlotClone`,e}var EEe=Symbol("radix.slottable");function P_t(n){const e=({children:t})=>ye.jsx(ye.Fragment,{children:t});return e.displayName=`${n}.Slottable`,e.__radixId=EEe,e}function I_t(n){return Te.isValidElement(n)&&typeof n.type=="function"&&"__radixId"in n.type&&n.type.__radixId===EEe}function N_t(n,e){const t={...e};for(const i in e){const r=n[i],o=e[i];/^on[A-Z]/.test(i)?r&&o?t[i]=(...a)=>{const c=o(...a);return r(...a),c}:r&&(t[i]=r):i==="style"?t[i]={...r,...o}:i==="className"&&(t[i]=[r,o].filter(Boolean).join(" "))}return{...n,...t}}function k_t(n){let e=Object.getOwnPropertyDescriptor(n.props,"ref")?.get,t=e&&"isReactWarning"in e&&e.isReactWarning;return t?n.ref:(e=Object.getOwnPropertyDescriptor(n,"ref")?.get,t=e&&"isReactWarning"in e&&e.isReactWarning,t?n.props.ref:n.props.ref||n.ref)}function TEe(n){const e=n+"CollectionProvider",[t,i]=b5(e),[r,o]=t(e,{collectionRef:{current:null},itemMap:new Map}),s=y=>{const{scope:g,children:b}=y,v=ns.useRef(null),w=ns.useRef(new Map).current;return ye.jsx(r,{scope:g,itemMap:w,collectionRef:v,children:b})};s.displayName=e;const a=n+"CollectionSlot",c=SC(a),l=ns.forwardRef((y,g)=>{const{scope:b,children:v}=y,w=o(a,b),T=Yy(g,w.collectionRef);return ye.jsx(c,{ref:T,children:v})});l.displayName=a;const u=n+"CollectionItemSlot",d="data-radix-collection-item",h=SC(u),f=ns.forwardRef((y,g)=>{const{scope:b,children:v,...w}=y,T=ns.useRef(null),N=Yy(g,T),R=o(u,b);return ns.useEffect(()=>(R.itemMap.set(T,{ref:T,...w}),()=>void R.itemMap.delete(T))),ye.jsx(h,{[d]:"",ref:N,children:v})});f.displayName=u;function m(y){const g=o(n+"CollectionConsumer",y);return ns.useCallback(()=>{const v=g.collectionRef.current;if(!v)return[];const w=Array.from(v.querySelectorAll(`[${d}]`));return Array.from(g.itemMap.values()).sort((R,P)=>w.indexOf(R.ref.current)-w.indexOf(P.ref.current))},[g.collectionRef,g.itemMap])}return[{Provider:s,Slot:l,ItemSlot:f},m,i]}var e3=globalThis?.document?Te.useLayoutEffect:()=>{},O_t=wEe[" useId ".trim().toString()]||(()=>{}),L_t=0;function x5(n){const[e,t]=Te.useState(O_t());return e3(()=>{t(i=>i??String(L_t++))},[n]),e?`radix-${e}`:""}var KW=ZW();const QW=d2(KW);var D_t=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],lm=D_t.reduce((n,e)=>{const t=SC(`Primitive.${e}`),i=Te.forwardRef((r,o)=>{const{asChild:s,...a}=r,c=s?t:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),ye.jsx(c,{...a,ref:o})});return i.displayName=`Primitive.${e}`,{...n,[e]:i}},{});function MEe(n,e){n&&KW.flushSync(()=>n.dispatchEvent(e))}function KS(n){const e=Te.useRef(n);return Te.useEffect(()=>{e.current=n}),Te.useMemo(()=>(...t)=>e.current?.(...t),[])}var z_t=wEe[" useInsertionEffect ".trim().toString()]||e3;function EC({prop:n,defaultProp:e,onChange:t=()=>{},caller:i}){const[r,o,s]=$_t({defaultProp:e,onChange:t}),a=n!==void 0,c=a?n:r;{const u=Te.useRef(n!==void 0);Te.useEffect(()=>{const d=u.current;d!==a&&console.warn(`${i} is changing from ${d?"controlled":"uncontrolled"} to ${a?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),u.current=a},[a,i])}const l=Te.useCallback(u=>{if(a){const d=F_t(u)?u(n):u;d!==n&&s.current?.(d)}else o(u)},[a,n,o,s]);return[c,l]}function $_t({defaultProp:n,onChange:e}){const[t,i]=Te.useState(n),r=Te.useRef(t),o=Te.useRef(e);return z_t(()=>{o.current=e},[e]),Te.useEffect(()=>{r.current!==t&&(o.current?.(t),r.current=t)},[t,r]),[t,i,o]}function F_t(n){return typeof n=="function"}var B_t=Te.createContext(void 0);function JW(n){const e=Te.useContext(B_t);return n||e||"ltr"}var eZ="rovingFocusGroup.onEntryFocus",U_t={bubbles:!1,cancelable:!0},nN="RovingFocusGroup",[tZ,AEe,j_t]=TEe(nN),[H_t,XL]=b5(nN,[j_t]),[V_t,G_t]=H_t(nN),CEe=Te.forwardRef((n,e)=>ye.jsx(tZ.Provider,{scope:n.__scopeRovingFocusGroup,children:ye.jsx(tZ.Slot,{scope:n.__scopeRovingFocusGroup,children:ye.jsx(Y_t,{...n,ref:e})})}));CEe.displayName=nN;var Y_t=Te.forwardRef((n,e)=>{const{__scopeRovingFocusGroup:t,orientation:i,loop:r=!1,dir:o,currentTabStopId:s,defaultCurrentTabStopId:a,onCurrentTabStopIdChange:c,onEntryFocus:l,preventScrollOnEntryFocus:u=!1,...d}=n,h=Te.useRef(null),f=Yy(e,h),m=JW(o),[y,g]=EC({prop:s,defaultProp:a??null,onChange:c,caller:nN}),[b,v]=Te.useState(!1),w=KS(l),T=AEe(t),N=Te.useRef(!1),[R,P]=Te.useState(0);return Te.useEffect(()=>{const M=h.current;if(M)return M.addEventListener(eZ,w),()=>M.removeEventListener(eZ,w)},[w]),ye.jsx(V_t,{scope:t,orientation:i,dir:m,loop:r,currentTabStopId:y,onItemFocus:Te.useCallback(M=>g(M),[g]),onItemShiftTab:Te.useCallback(()=>v(!0),[]),onFocusableItemAdd:Te.useCallback(()=>P(M=>M+1),[]),onFocusableItemRemove:Te.useCallback(()=>P(M=>M-1),[]),children:ye.jsx(lm.div,{tabIndex:b||R===0?-1:0,"data-orientation":i,...d,ref:f,style:{outline:"none",...n.style},onMouseDown:qa(n.onMouseDown,()=>{N.current=!0}),onFocus:qa(n.onFocus,M=>{const I=!N.current;if(M.target===M.currentTarget&&I&&!b){const A=new CustomEvent(eZ,U_t);if(M.currentTarget.dispatchEvent(A),!A.defaultPrevented){const U=T().filter(K=>K.focusable),k=U.find(K=>K.active),V=U.find(K=>K.id===y),W=[k,V,...U].filter(Boolean).map(K=>K.ref.current);IEe(W,u)}}N.current=!1}),onBlur:qa(n.onBlur,()=>v(!1))})})}),REe="RovingFocusGroupItem",PEe=Te.forwardRef((n,e)=>{const{__scopeRovingFocusGroup:t,focusable:i=!0,active:r=!1,tabStopId:o,children:s,...a}=n,c=x5(),l=o||c,u=G_t(REe,t),d=u.currentTabStopId===l,h=AEe(t),{onFocusableItemAdd:f,onFocusableItemRemove:m,currentTabStopId:y}=u;return Te.useEffect(()=>{if(i)return f(),()=>m()},[i,f,m]),ye.jsx(tZ.ItemSlot,{scope:t,id:l,focusable:i,active:r,children:ye.jsx(lm.span,{tabIndex:d?0:-1,"data-orientation":u.orientation,...a,ref:e,onMouseDown:qa(n.onMouseDown,g=>{i?u.onItemFocus(l):g.preventDefault()}),onFocus:qa(n.onFocus,()=>u.onItemFocus(l)),onKeyDown:qa(n.onKeyDown,g=>{if(g.key==="Tab"&&g.shiftKey){u.onItemShiftTab();return}if(g.target!==g.currentTarget)return;const b=W_t(g,u.orientation,u.dir);if(b!==void 0){if(g.metaKey||g.ctrlKey||g.altKey||g.shiftKey)return;g.preventDefault();let w=h().filter(T=>T.focusable).map(T=>T.ref.current);if(b==="last")w.reverse();else if(b==="prev"||b==="next"){b==="prev"&&w.reverse();const T=w.indexOf(g.currentTarget);w=u.loop?Z_t(w,T+1):w.slice(T+1)}setTimeout(()=>IEe(w))}}),children:typeof s=="function"?s({isCurrentTabStop:d,hasTabStop:y!=null}):s})})});PEe.displayName=REe;var q_t={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function X_t(n,e){return e!=="rtl"?n:n==="ArrowLeft"?"ArrowRight":n==="ArrowRight"?"ArrowLeft":n}function W_t(n,e,t){const i=X_t(n.key,t);if(!(e==="vertical"&&["ArrowLeft","ArrowRight"].includes(i))&&!(e==="horizontal"&&["ArrowUp","ArrowDown"].includes(i)))return q_t[i]}function IEe(n,e=!1){const t=document.activeElement;for(const i of n)if(i===t||(i.focus({preventScroll:e}),document.activeElement!==t))return}function Z_t(n,e){return n.map((t,i)=>n[(e+i)%n.length])}var NEe=CEe,kEe=PEe;function K_t(n,e){return Te.useReducer((t,i)=>e[t][i]??t,n)}var QS=n=>{const{present:e,children:t}=n,i=Q_t(e),r=typeof t=="function"?t({present:i.isPresent}):Te.Children.only(t),o=Yy(i.ref,J_t(r));return typeof t=="function"||i.isPresent?Te.cloneElement(r,{ref:o}):null};QS.displayName="Presence";function Q_t(n){const[e,t]=Te.useState(),i=Te.useRef(null),r=Te.useRef(n),o=Te.useRef("none"),s=n?"mounted":"unmounted",[a,c]=K_t(s,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return Te.useEffect(()=>{const l=WL(i.current);o.current=a==="mounted"?l:"none"},[a]),e3(()=>{const l=i.current,u=r.current;if(u!==n){const h=o.current,f=WL(l);n?c("MOUNT"):f==="none"||l?.display==="none"?c("UNMOUNT"):c(u&&h!==f?"ANIMATION_OUT":"UNMOUNT"),r.current=n}},[n,c]),e3(()=>{if(e){let l;const u=e.ownerDocument.defaultView??window,d=f=>{const y=WL(i.current).includes(CSS.escape(f.animationName));if(f.target===e&&y&&(c("ANIMATION_END"),!r.current)){const g=e.style.animationFillMode;e.style.animationFillMode="forwards",l=u.setTimeout(()=>{e.style.animationFillMode==="forwards"&&(e.style.animationFillMode=g)})}},h=f=>{f.target===e&&(o.current=WL(i.current))};return e.addEventListener("animationstart",h),e.addEventListener("animationcancel",d),e.addEventListener("animationend",d),()=>{u.clearTimeout(l),e.removeEventListener("animationstart",h),e.removeEventListener("animationcancel",d),e.removeEventListener("animationend",d)}}else c("ANIMATION_END")},[e,c]),{isPresent:["mounted","unmountSuspended"].includes(a),ref:Te.useCallback(l=>{i.current=l?getComputedStyle(l):null,t(l)},[])}}function WL(n){return n?.animationName||"none"}function J_t(n){let e=Object.getOwnPropertyDescriptor(n.props,"ref")?.get,t=e&&"isReactWarning"in e&&e.isReactWarning;return t?n.ref:(e=Object.getOwnPropertyDescriptor(n,"ref")?.get,t=e&&"isReactWarning"in e&&e.isReactWarning,t?n.props.ref:n.props.ref||n.ref)}var ZL="Tabs",[eyt,tni]=b5(ZL,[XL]),OEe=XL(),[tyt,nZ]=eyt(ZL),LEe=Te.forwardRef((n,e)=>{const{__scopeTabs:t,value:i,onValueChange:r,defaultValue:o,orientation:s="horizontal",dir:a,activationMode:c="automatic",...l}=n,u=JW(a),[d,h]=EC({prop:i,onChange:r,defaultProp:o??"",caller:ZL});return ye.jsx(tyt,{scope:t,baseId:x5(),value:d,onValueChange:h,orientation:s,dir:u,activationMode:c,children:ye.jsx(lm.div,{dir:u,"data-orientation":s,...l,ref:e})})});LEe.displayName=ZL;var DEe="TabsList",zEe=Te.forwardRef((n,e)=>{const{__scopeTabs:t,loop:i=!0,...r}=n,o=nZ(DEe,t),s=OEe(t);return ye.jsx(NEe,{asChild:!0,...s,orientation:o.orientation,dir:o.dir,loop:i,children:ye.jsx(lm.div,{role:"tablist","aria-orientation":o.orientation,...r,ref:e})})});zEe.displayName=DEe;var $Ee="TabsTrigger",FEe=Te.forwardRef((n,e)=>{const{__scopeTabs:t,value:i,disabled:r=!1,...o}=n,s=nZ($Ee,t),a=OEe(t),c=jEe(s.baseId,i),l=HEe(s.baseId,i),u=i===s.value;return ye.jsx(kEe,{asChild:!0,...a,focusable:!r,active:u,children:ye.jsx(lm.button,{type:"button",role:"tab","aria-selected":u,"aria-controls":l,"data-state":u?"active":"inactive","data-disabled":r?"":void 0,disabled:r,id:c,...o,ref:e,onMouseDown:qa(n.onMouseDown,d=>{!r&&d.button===0&&d.ctrlKey===!1?s.onValueChange(i):d.preventDefault()}),onKeyDown:qa(n.onKeyDown,d=>{[" ","Enter"].includes(d.key)&&s.onValueChange(i)}),onFocus:qa(n.onFocus,()=>{const d=s.activationMode!=="manual";!u&&!r&&d&&s.onValueChange(i)})})})});FEe.displayName=$Ee;var BEe="TabsContent",UEe=Te.forwardRef((n,e)=>{const{__scopeTabs:t,value:i,forceMount:r,children:o,...s}=n,a=nZ(BEe,t),c=jEe(a.baseId,i),l=HEe(a.baseId,i),u=i===a.value,d=Te.useRef(u);return Te.useEffect(()=>{const h=requestAnimationFrame(()=>d.current=!1);return()=>cancelAnimationFrame(h)},[]),ye.jsx(QS,{present:r||u,children:({present:h})=>ye.jsx(lm.div,{"data-state":u?"active":"inactive","data-orientation":a.orientation,role:"tabpanel","aria-labelledby":c,hidden:!h,id:l,tabIndex:0,...s,ref:e,style:{...n.style,animationDuration:d.current?"0s":void 0},children:h&&o})})});UEe.displayName=BEe;function jEe(n,e){return`${n}-trigger-${e}`}function HEe(n,e){return`${n}-content-${e}`}var nyt=LEe,VEe=zEe,GEe=FEe,YEe=UEe;function qEe(n){var e,t,i="";if(typeof n=="string"||typeof n=="number")i+=n;else if(typeof n=="object")if(Array.isArray(n)){var r=n.length;for(e=0;e<r;e++)n[e]&&(t=qEe(n[e]))&&(i&&(i+=" "),i+=t)}else for(t in n)n[t]&&(i&&(i+=" "),i+=t);return i}function JS(){for(var n,e,t=0,i="",r=arguments.length;t<r;t++)(n=arguments[t])&&(e=qEe(n))&&(i&&(i+=" "),i+=e);return i}const iZ="-",iyt=n=>{const e=oyt(n),{conflictingClassGroups:t,conflictingClassGroupModifiers:i}=n;return{getClassGroupId:s=>{const a=s.split(iZ);return a[0]===""&&a.length!==1&&a.shift(),XEe(a,e)||ryt(s)},getConflictingClassGroupIds:(s,a)=>{const c=t[s]||[];return a&&i[s]?[...c,...i[s]]:c}}},XEe=(n,e)=>{if(n.length===0)return e.classGroupId;const t=n[0],i=e.nextPart.get(t),r=i?XEe(n.slice(1),i):void 0;if(r)return r;if(e.validators.length===0)return;const o=n.join(iZ);return e.validators.find(({validator:s})=>s(o))?.classGroupId},WEe=/^\[(.+)\]$/,ryt=n=>{if(WEe.test(n)){const e=WEe.exec(n)[1],t=e?.substring(0,e.indexOf(":"));if(t)return"arbitrary.."+t}},oyt=n=>{const{theme:e,prefix:t}=n,i={nextPart:new Map,validators:[]};return ayt(Object.entries(n.classGroups),t).forEach(([o,s])=>{rZ(s,i,o,e)}),i},rZ=(n,e,t,i)=>{n.forEach(r=>{if(typeof r=="string"){const o=r===""?e:ZEe(e,r);o.classGroupId=t;return}if(typeof r=="function"){if(syt(r)){rZ(r(i),e,t,i);return}e.validators.push({validator:r,classGroupId:t});return}Object.entries(r).forEach(([o,s])=>{rZ(s,ZEe(e,o),t,i)})})},ZEe=(n,e)=>{let t=n;return e.split(iZ).forEach(i=>{t.nextPart.has(i)||t.nextPart.set(i,{nextPart:new Map,validators:[]}),t=t.nextPart.get(i)}),t},syt=n=>n.isThemeGetter,ayt=(n,e)=>e?n.map(([t,i])=>{const r=i.map(o=>typeof o=="string"?e+o:typeof o=="object"?Object.fromEntries(Object.entries(o).map(([s,a])=>[e+s,a])):o);return[t,r]}):n,cyt=n=>{if(n<1)return{get:()=>{},set:()=>{}};let e=0,t=new Map,i=new Map;const r=(o,s)=>{t.set(o,s),e++,e>n&&(e=0,i=t,t=new Map)};return{get(o){let s=t.get(o);if(s!==void 0)return s;if((s=i.get(o))!==void 0)return r(o,s),s},set(o,s){t.has(o)?t.set(o,s):r(o,s)}}},KEe="!",lyt=n=>{const{separator:e,experimentalParseClassName:t}=n,i=e.length===1,r=e[0],o=e.length,s=a=>{const c=[];let l=0,u=0,d;for(let g=0;g<a.length;g++){let b=a[g];if(l===0){if(b===r&&(i||a.slice(g,g+o)===e)){c.push(a.slice(u,g)),u=g+o;continue}if(b==="/"){d=g;continue}}b==="["?l++:b==="]"&&l--}const h=c.length===0?a:a.substring(u),f=h.startsWith(KEe),m=f?h.substring(1):h,y=d&&d>u?d-u:void 0;return{modifiers:c,hasImportantModifier:f,baseClassName:m,maybePostfixModifierPosition:y}};return t?a=>t({className:a,parseClassName:s}):s},uyt=n=>{if(n.length<=1)return n;const e=[];let t=[];return n.forEach(i=>{i[0]==="["?(e.push(...t.sort(),i),t=[]):t.push(i)}),e.push(...t.sort()),e},dyt=n=>({cache:cyt(n.cacheSize),parseClassName:lyt(n),...iyt(n)}),hyt=/\s+/,pyt=(n,e)=>{const{parseClassName:t,getClassGroupId:i,getConflictingClassGroupIds:r}=e,o=[],s=n.trim().split(hyt);let a="";for(let c=s.length-1;c>=0;c-=1){const l=s[c],{modifiers:u,hasImportantModifier:d,baseClassName:h,maybePostfixModifierPosition:f}=t(l);let m=!!f,y=i(m?h.substring(0,f):h);if(!y){if(!m){a=l+(a.length>0?" "+a:a);continue}if(y=i(h),!y){a=l+(a.length>0?" "+a:a);continue}m=!1}const g=uyt(u).join(":"),b=d?g+KEe:g,v=b+y;if(o.includes(v))continue;o.push(v);const w=r(y,m);for(let T=0;T<w.length;++T){const N=w[T];o.push(b+N)}a=l+(a.length>0?" "+a:a)}return a};function fyt(){let n=0,e,t,i="";for(;n<arguments.length;)(e=arguments[n++])&&(t=QEe(e))&&(i&&(i+=" "),i+=t);return i}const QEe=n=>{if(typeof n=="string")return n;let e,t="";for(let i=0;i<n.length;i++)n[i]&&(e=QEe(n[i]))&&(t&&(t+=" "),t+=e);return t};function myt(n,...e){let t,i,r,o=s;function s(c){const l=e.reduce((u,d)=>d(u),n());return t=dyt(l),i=t.cache.get,r=t.cache.set,o=a,a(c)}function a(c){const l=i(c);if(l)return l;const u=pyt(c,t);return r(c,u),u}return function(){return o(fyt.apply(null,arguments))}}const h0=n=>{const e=t=>t[n]||[];return e.isThemeGetter=!0,e},JEe=/^\[(?:([a-z-]+):)?(.+)\]$/i,_yt=/^\d+\/\d+$/,yyt=new Set(["px","full","screen"]),gyt=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,byt=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,xyt=/^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/,vyt=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,wyt=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,v5=n=>TC(n)||yyt.has(n)||_yt.test(n),t3=n=>MC(n,"length",Pyt),TC=n=>!!n&&!Number.isNaN(Number(n)),oZ=n=>MC(n,"number",TC),iN=n=>!!n&&Number.isInteger(Number(n)),Syt=n=>n.endsWith("%")&&TC(n.slice(0,-1)),Xc=n=>JEe.test(n),n3=n=>gyt.test(n),Eyt=new Set(["length","size","percentage"]),Tyt=n=>MC(n,Eyt,e5e),Myt=n=>MC(n,"position",e5e),Ayt=new Set(["image","url"]),Cyt=n=>MC(n,Ayt,Nyt),Ryt=n=>MC(n,"",Iyt),rN=()=>!0,MC=(n,e,t)=>{const i=JEe.exec(n);return i?i[1]?typeof e=="string"?i[1]===e:e.has(i[1]):t(i[2]):!1},Pyt=n=>byt.test(n)&&!xyt.test(n),e5e=()=>!1,Iyt=n=>vyt.test(n),Nyt=n=>wyt.test(n),kyt=myt(()=>{const n=h0("colors"),e=h0("spacing"),t=h0("blur"),i=h0("brightness"),r=h0("borderColor"),o=h0("borderRadius"),s=h0("borderSpacing"),a=h0("borderWidth"),c=h0("contrast"),l=h0("grayscale"),u=h0("hueRotate"),d=h0("invert"),h=h0("gap"),f=h0("gradientColorStops"),m=h0("gradientColorStopPositions"),y=h0("inset"),g=h0("margin"),b=h0("opacity"),v=h0("padding"),w=h0("saturate"),T=h0("scale"),N=h0("sepia"),R=h0("skew"),P=h0("space"),M=h0("translate"),I=()=>["auto","contain","none"],A=()=>["auto","hidden","clip","visible","scroll"],U=()=>["auto",Xc,e],k=()=>[Xc,e],V=()=>["",v5,t3],X=()=>["auto",TC,Xc],W=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],K=()=>["solid","dashed","dotted","double","none"],te=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],se=()=>["start","end","center","between","around","evenly","stretch"],de=()=>["","0",Xc],be=()=>["auto","avoid","all","avoid-page","page","left","right","column"],re=()=>[TC,Xc];return{cacheSize:500,separator:":",theme:{colors:[rN],spacing:[v5,t3],blur:["none","",n3,Xc],brightness:re(),borderColor:[n],borderRadius:["none","","full",n3,Xc],borderSpacing:k(),borderWidth:V(),contrast:re(),grayscale:de(),hueRotate:re(),invert:de(),gap:k(),gradientColorStops:[n],gradientColorStopPositions:[Syt,t3],inset:U(),margin:U(),opacity:re(),padding:k(),saturate:re(),scale:re(),sepia:de(),skew:re(),space:k(),translate:k()},classGroups:{aspect:[{aspect:["auto","square","video",Xc]}],container:["container"],columns:[{columns:[n3]}],"break-after":[{"break-after":be()}],"break-before":[{"break-before":be()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:[...W(),Xc]}],overflow:[{overflow:A()}],"overflow-x":[{"overflow-x":A()}],"overflow-y":[{"overflow-y":A()}],overscroll:[{overscroll:I()}],"overscroll-x":[{"overscroll-x":I()}],"overscroll-y":[{"overscroll-y":I()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[y]}],"inset-x":[{"inset-x":[y]}],"inset-y":[{"inset-y":[y]}],start:[{start:[y]}],end:[{end:[y]}],top:[{top:[y]}],right:[{right:[y]}],bottom:[{bottom:[y]}],left:[{left:[y]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",iN,Xc]}],basis:[{basis:U()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",Xc]}],grow:[{grow:de()}],shrink:[{shrink:de()}],order:[{order:["first","last","none",iN,Xc]}],"grid-cols":[{"grid-cols":[rN]}],"col-start-end":[{col:["auto",{span:["full",iN,Xc]},Xc]}],"col-start":[{"col-start":X()}],"col-end":[{"col-end":X()}],"grid-rows":[{"grid-rows":[rN]}],"row-start-end":[{row:["auto",{span:[iN,Xc]},Xc]}],"row-start":[{"row-start":X()}],"row-end":[{"row-end":X()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",Xc]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",Xc]}],gap:[{gap:[h]}],"gap-x":[{"gap-x":[h]}],"gap-y":[{"gap-y":[h]}],"justify-content":[{justify:["normal",...se()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...se(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...se(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[v]}],px:[{px:[v]}],py:[{py:[v]}],ps:[{ps:[v]}],pe:[{pe:[v]}],pt:[{pt:[v]}],pr:[{pr:[v]}],pb:[{pb:[v]}],pl:[{pl:[v]}],m:[{m:[g]}],mx:[{mx:[g]}],my:[{my:[g]}],ms:[{ms:[g]}],me:[{me:[g]}],mt:[{mt:[g]}],mr:[{mr:[g]}],mb:[{mb:[g]}],ml:[{ml:[g]}],"space-x":[{"space-x":[P]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[P]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",Xc,e]}],"min-w":[{"min-w":[Xc,e,"min","max","fit"]}],"max-w":[{"max-w":[Xc,e,"none","full","min","max","fit","prose",{screen:[n3]},n3]}],h:[{h:[Xc,e,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[Xc,e,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[Xc,e,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[Xc,e,"auto","min","max","fit"]}],"font-size":[{text:["base",n3,t3]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",oZ]}],"font-family":[{font:[rN]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:["tighter","tight","normal","wide","wider","widest",Xc]}],"line-clamp":[{"line-clamp":["none",TC,oZ]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",v5,Xc]}],"list-image":[{"list-image":["none",Xc]}],"list-style-type":[{list:["none","disc","decimal",Xc]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[n]}],"placeholder-opacity":[{"placeholder-opacity":[b]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[n]}],"text-opacity":[{"text-opacity":[b]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...K(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",v5,t3]}],"underline-offset":[{"underline-offset":["auto",v5,Xc]}],"text-decoration-color":[{decoration:[n]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:k()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",Xc]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",Xc]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[b]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...W(),Myt]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",Tyt]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},Cyt]}],"bg-color":[{bg:[n]}],"gradient-from-pos":[{from:[m]}],"gradient-via-pos":[{via:[m]}],"gradient-to-pos":[{to:[m]}],"gradient-from":[{from:[f]}],"gradient-via":[{via:[f]}],"gradient-to":[{to:[f]}],rounded:[{rounded:[o]}],"rounded-s":[{"rounded-s":[o]}],"rounded-e":[{"rounded-e":[o]}],"rounded-t":[{"rounded-t":[o]}],"rounded-r":[{"rounded-r":[o]}],"rounded-b":[{"rounded-b":[o]}],"rounded-l":[{"rounded-l":[o]}],"rounded-ss":[{"rounded-ss":[o]}],"rounded-se":[{"rounded-se":[o]}],"rounded-ee":[{"rounded-ee":[o]}],"rounded-es":[{"rounded-es":[o]}],"rounded-tl":[{"rounded-tl":[o]}],"rounded-tr":[{"rounded-tr":[o]}],"rounded-br":[{"rounded-br":[o]}],"rounded-bl":[{"rounded-bl":[o]}],"border-w":[{border:[a]}],"border-w-x":[{"border-x":[a]}],"border-w-y":[{"border-y":[a]}],"border-w-s":[{"border-s":[a]}],"border-w-e":[{"border-e":[a]}],"border-w-t":[{"border-t":[a]}],"border-w-r":[{"border-r":[a]}],"border-w-b":[{"border-b":[a]}],"border-w-l":[{"border-l":[a]}],"border-opacity":[{"border-opacity":[b]}],"border-style":[{border:[...K(),"hidden"]}],"divide-x":[{"divide-x":[a]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[a]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[b]}],"divide-style":[{divide:K()}],"border-color":[{border:[r]}],"border-color-x":[{"border-x":[r]}],"border-color-y":[{"border-y":[r]}],"border-color-s":[{"border-s":[r]}],"border-color-e":[{"border-e":[r]}],"border-color-t":[{"border-t":[r]}],"border-color-r":[{"border-r":[r]}],"border-color-b":[{"border-b":[r]}],"border-color-l":[{"border-l":[r]}],"divide-color":[{divide:[r]}],"outline-style":[{outline:["",...K()]}],"outline-offset":[{"outline-offset":[v5,Xc]}],"outline-w":[{outline:[v5,t3]}],"outline-color":[{outline:[n]}],"ring-w":[{ring:V()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[n]}],"ring-opacity":[{"ring-opacity":[b]}],"ring-offset-w":[{"ring-offset":[v5,t3]}],"ring-offset-color":[{"ring-offset":[n]}],shadow:[{shadow:["","inner","none",n3,Ryt]}],"shadow-color":[{shadow:[rN]}],opacity:[{opacity:[b]}],"mix-blend":[{"mix-blend":[...te(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":te()}],filter:[{filter:["","none"]}],blur:[{blur:[t]}],brightness:[{brightness:[i]}],contrast:[{contrast:[c]}],"drop-shadow":[{"drop-shadow":["","none",n3,Xc]}],grayscale:[{grayscale:[l]}],"hue-rotate":[{"hue-rotate":[u]}],invert:[{invert:[d]}],saturate:[{saturate:[w]}],sepia:[{sepia:[N]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[t]}],"backdrop-brightness":[{"backdrop-brightness":[i]}],"backdrop-contrast":[{"backdrop-contrast":[c]}],"backdrop-grayscale":[{"backdrop-grayscale":[l]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[u]}],"backdrop-invert":[{"backdrop-invert":[d]}],"backdrop-opacity":[{"backdrop-opacity":[b]}],"backdrop-saturate":[{"backdrop-saturate":[w]}],"backdrop-sepia":[{"backdrop-sepia":[N]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[s]}],"border-spacing-x":[{"border-spacing-x":[s]}],"border-spacing-y":[{"border-spacing-y":[s]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",Xc]}],duration:[{duration:re()}],ease:[{ease:["linear","in","out","in-out",Xc]}],delay:[{delay:re()}],animate:[{animate:["none","spin","ping","pulse","bounce",Xc]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[T]}],"scale-x":[{"scale-x":[T]}],"scale-y":[{"scale-y":[T]}],rotate:[{rotate:[iN,Xc]}],"translate-x":[{"translate-x":[M]}],"translate-y":[{"translate-y":[M]}],"skew-x":[{"skew-x":[R]}],"skew-y":[{"skew-y":[R]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",Xc]}],accent:[{accent:["auto",n]}],appearance:[{appearance:["none","auto"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",Xc]}],"caret-color":[{caret:[n]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":k()}],"scroll-mx":[{"scroll-mx":k()}],"scroll-my":[{"scroll-my":k()}],"scroll-ms":[{"scroll-ms":k()}],"scroll-me":[{"scroll-me":k()}],"scroll-mt":[{"scroll-mt":k()}],"scroll-mr":[{"scroll-mr":k()}],"scroll-mb":[{"scroll-mb":k()}],"scroll-ml":[{"scroll-ml":k()}],"scroll-p":[{"scroll-p":k()}],"scroll-px":[{"scroll-px":k()}],"scroll-py":[{"scroll-py":k()}],"scroll-ps":[{"scroll-ps":k()}],"scroll-pe":[{"scroll-pe":k()}],"scroll-pt":[{"scroll-pt":k()}],"scroll-pr":[{"scroll-pr":k()}],"scroll-pb":[{"scroll-pb":k()}],"scroll-pl":[{"scroll-pl":k()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",Xc]}],fill:[{fill:[n,"none"]}],"stroke-w":[{stroke:[v5,t3,oZ]}],stroke:[{stroke:[n,"none"]}],sr:["sr-only","not-sr-only"],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]}}});var qn=typeof window<"u"?window:void 0,Dv=typeof globalThis<"u"?globalThis:qn,t5e=Array.prototype,n5e=t5e.forEach,i5e=t5e.indexOf,bw=Dv?.navigator,Kr=Dv?.document,zv=Dv?.location,sZ=Dv?.fetch,aZ=Dv!=null&&Dv.XMLHttpRequest&&"withCredentials"in new Dv.XMLHttpRequest?Dv.XMLHttpRequest:void 0,r5e=Dv?.AbortController,$v=bw?.userAgent,Bs=qn??{},w5={DEBUG:!1,LIB_VERSION:"1.261.7"};function Qr(){return Qr=Object.assign?Object.assign.bind():function(n){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var i in t)({}).hasOwnProperty.call(t,i)&&(n[i]=t[i])}return n},Qr.apply(null,arguments)}function o5e(n,e){if(n==null)return{};var t={};for(var i in n)if({}.hasOwnProperty.call(n,i)){if(e.indexOf(i)!==-1)continue;t[i]=n[i]}return t}var Oyt=["$snapshot","$pageview","$pageleave","$set","survey dismissed","survey sent","survey shown","$identify","$groupidentify","$create_alias","$$client_ingestion_warning","$web_experiment_applied","$feature_enrollment_update","$feature_flag_called"];function Fl(n,e){return n.indexOf(e)!==-1}var KL=function(n){return n.trim()},cZ=function(n){return n.replace(/^\$/,"")},Lyt=Array.isArray,s5e=Object.prototype,a5e=s5e.hasOwnProperty,QL=s5e.toString,p0=Lyt||function(n){return QL.call(n)==="[object Array]"},h2=n=>typeof n=="function",cy=n=>n===Object(n)&&!p0(n),AC=n=>{if(cy(n)){for(var e in n)if(a5e.call(n,e))return!1;return!0}return!1},br=n=>n===void 0,ly=n=>QL.call(n)=="[object String]",lZ=n=>ly(n)&&n.trim().length===0,i3=n=>n===null,Oh=n=>br(n)||i3(n),wx=n=>QL.call(n)=="[object Number]",eE=n=>QL.call(n)==="[object Boolean]",Dyt=n=>n instanceof FormData,zyt=n=>Fl(Oyt,n),$yt=[!0,"true",1,"1","yes"],uZ=n=>Fl($yt,n),Fyt=[!1,"false",0,"0","no"];function xw(n,e,t,i,r){return e>t&&(i.warn("min cannot be greater than max."),e=t),wx(n)?n>t?(i.warn(" cannot be greater than max: "+t+". Using max value instead."),t):n<e?(i.warn(" cannot be less than min: "+e+". Using min value instead."),e):n:(i.warn(" must be a number. using max or fallback. max: "+t+", fallback: "+r),xw(r||t,e,t,i))}let c5e=class{stop(){this.t&&(clearInterval(this.t),this.t=void 0)}constructor(e){this.i=e,this.o={},this.h=()=>{Object.keys(this.o).forEach((t=>{var i=this.m(t)+this.S;i>=this.$?delete this.o[t]:this.k(t,i)}))},this.m=t=>this.o[String(t)],this.k=(t,i)=>{this.o[String(t)]=i},this.consumeRateLimit=t=>{var i,r=(i=this.m(t))!=null?i:this.$;if((r=Math.max(r-1,0))===0)return!0;this.k(t,r);var o,s=r===0;return s&&((o=this.I)==null||o.call(this,t)),s},this.I=this.i.I,this.$=xw(this.i.bucketSize,0,100,this.i.R),this.S=xw(this.i.refillRate,0,this.$,this.i.R),this.P=xw(this.i.refillInterval,0,864e5,this.i.R),this.t=setInterval((()=>{this.h()}),this.P)}};var l5e=n=>{var e={T:function(t){if(qn&&(w5.DEBUG||Bs.POSTHOG_DEBUG)&&!br(qn.console)&&qn.console){for(var i=("__rrweb_original__"in qn.console[t])?qn.console[t].__rrweb_original__:qn.console[t],r=arguments.length,o=new Array(r>1?r-1:0),s=1;s<r;s++)o[s-1]=arguments[s];i(n,...o)}},info:function(){for(var t=arguments.length,i=new Array(t),r=0;r<t;r++)i[r]=arguments[r];e.T("log",...i)},warn:function(){for(var t=arguments.length,i=new Array(t),r=0;r<t;r++)i[r]=arguments[r];e.T("warn",...i)},error:function(){for(var t=arguments.length,i=new Array(t),r=0;r<t;r++)i[r]=arguments[r];e.T("error",...i)},critical:function(){for(var t=arguments.length,i=new Array(t),r=0;r<t;r++)i[r]=arguments[r];console.error(n,...i)},uninitializedWarning:t=>{e.error("You must initialize PostHog before calling "+t)},createLogger:t=>l5e(n+" "+t)};return e},Yr=l5e("[PostHog.js]"),x1=Yr.createLogger,Byt=x1("[ExternalScriptsLoader]"),u5e=(n,e,t)=>{if(n.config.disable_external_dependency_loading)return Byt.warn(e+" was requested but loading of external scripts is disabled."),t("Loading of external scripts is disabled");var i=Kr?.querySelectorAll("script");if(i){for(var r,o=function(){if(i[s].src===e){var c=i[s];return c.__posthog_loading_callback_fired?{v:t()}:(c.addEventListener("load",(l=>{c.__posthog_loading_callback_fired=!0,t(void 0,l)})),c.onerror=l=>t(l),{v:void 0})}},s=0;s<i.length;s++)if(r=o())return r.v}var a=()=>{if(!Kr)return t("document not found");var c=Kr.createElement("script");if(c.type="text/javascript",c.crossOrigin="anonymous",c.src=e,c.onload=d=>{c.__posthog_loading_callback_fired=!0,t(void 0,d)},c.onerror=d=>t(d),n.config.prepare_external_dependency_script&&(c=n.config.prepare_external_dependency_script(c)),!c)return t("prepare_external_dependency_script returned null");var l,u=Kr.querySelectorAll("body > script");u.length>0?(l=u[0].parentNode)==null||l.insertBefore(c,u[0]):Kr.body.appendChild(c)};Kr!=null&&Kr.body?a():Kr?.addEventListener("DOMContentLoaded",a)};Bs.__PosthogExtensions__=Bs.__PosthogExtensions__||{},Bs.__PosthogExtensions__.loadExternalDependency=(n,e,t)=>{var i="/static/"+e+".js?v="+n.version;if(e==="remote-config"&&(i="/array/"+n.config.token+"/config.js"),e==="toolbar"){var r=3e5;i=i+"&t="+Math.floor(Date.now()/r)*r}var o=n.requestRouter.endpointFor("assets",i);u5e(n,o,t)},Bs.__PosthogExtensions__.loadSiteApp=(n,e,t)=>{var i=n.requestRouter.endpointFor("api",e);u5e(n,i,t)};var JL={};function r3(n,e,t){if(p0(n)){if(n5e&&n.forEach===n5e)n.forEach(e,t);else if("length"in n&&n.length===+n.length){for(var i=0,r=n.length;i<r;i++)if(i in n&&e.call(t,n[i],i)===JL)return}}}function vf(n,e,t){if(!Oh(n)){if(p0(n))return r3(n,e,t);if(Dyt(n)){for(var i of n.entries())if(e.call(t,i[1],i[0])===JL)return}else for(var r in n)if(a5e.call(n,r)&&e.call(t,n[r],r)===JL)return}}var qy=function(n){for(var e=arguments.length,t=new Array(e>1?e-1:0),i=1;i<e;i++)t[i-1]=arguments[i];return r3(t,(function(r){for(var o in r)r[o]!==void 0&&(n[o]=r[o])})),n},e7=function(n){for(var e=arguments.length,t=new Array(e>1?e-1:0),i=1;i<e;i++)t[i-1]=arguments[i];return r3(t,(function(r){r3(r,(function(o){n.push(o)}))})),n};function t7(n){for(var e=Object.keys(n),t=e.length,i=new Array(t);t--;)i[t]=[e[t],n[e[t]]];return i}var d5e=function(n){try{return n()}catch{return}},Uyt=function(n){return function(){try{for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];return n.apply(this,t)}catch(r){Yr.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),Yr.critical(r)}}},dZ=function(n){var e={};return vf(n,(function(t,i){(ly(t)&&t.length>0||wx(t))&&(e[i]=t)})),e};function jyt(n,e){return t=n,i=o=>ly(o)&&!i3(e)?o.slice(0,e):o,r=new Set,(function o(s,a){return s!==Object(s)?i?i(s,a):s:r.has(s)?void 0:(r.add(s),p0(s)?(c=[],r3(s,(l=>{c.push(o(l))}))):(c={},vf(s,((l,u)=>{r.has(l)||(c[u]=o(l,u))}))),c);var c})(t);var t,i,r}var Hyt=["herokuapp.com","vercel.app","netlify.app"];function Vyt(n){var e=n?.hostname;if(!ly(e))return!1;var t=e.split(".").slice(-2).join(".");for(var i of Hyt)if(t===i)return!1;return!0}function h5e(n,e){for(var t=0;t<n.length;t++)if(e(n[t]))return n[t]}function M_(n,e,t,i){var{capture:r=!1,passive:o=!0}=i??{};n?.addEventListener(e,t,{capture:r,passive:o})}var p5e="$people_distinct_id",oN="__alias",sN="__timers",f5e="$autocapture_disabled_server_side",hZ="$heatmaps_enabled_server_side",m5e="$exception_capture_enabled_server_side",pZ="$error_tracking_suppression_rules",_5e="$error_tracking_capture_extension_exceptions",y5e="$web_vitals_enabled_server_side",g5e="$dead_clicks_enabled_server_side",b5e="$web_vitals_allowed_metrics",aN="$session_recording_enabled_server_side",x5e="$console_log_recording_enabled_server_side",v5e="$session_recording_network_payload_capture",w5e="$session_recording_masking",S5e="$session_recording_canvas_recording",E5e="$replay_sample_rate",T5e="$replay_minimum_duration",n7="$replay_script_config",i7="$sesid",cN="$session_is_sampled",fZ="$session_recording_url_trigger_activated_session",mZ="$session_recording_event_trigger_activated_session",CC="$enabled_feature_flags",lN="$early_access_features",_Z="$feature_flag_details",uN="$stored_person_properties",cA="$stored_group_properties",yZ="$surveys",r7="$surveys_activated",o7="$flag_call_reported",S5="$user_state",gZ="$client_session_props",bZ="$capture_rate_limit",xZ="$initial_campaign_params",vZ="$initial_referrer_info",s7="$initial_person_info",a7="$epp",M5e="__POSTHOG_TOOLBAR__",dN="$posthog_cookieless",Gyt=[p5e,oN,"__cmpns",sN,aN,hZ,i7,CC,pZ,S5,lN,_Z,cA,uN,yZ,o7,gZ,bZ,xZ,vZ,a7,s7];function A5e(n){return n instanceof Element&&(n.id===M5e||!(n.closest==null||!n.closest(".toolbar-global-fade-container")))}function c7(n){return!!n&&n.nodeType===1}function o3(n,e){return!!n&&!!n.tagName&&n.tagName.toLowerCase()===e.toLowerCase()}function C5e(n){return!!n&&n.nodeType===3}function R5e(n){return!!n&&n.nodeType===11}function wZ(n){return n?KL(n).split(/\s+/):[]}function P5e(n){var e=qn?.location.href;return!!(e&&n&&n.some((t=>e.match(t))))}function l7(n){var e="";switch(typeof n.className){case"string":e=n.className;break;case"object":e=(n.className&&"baseVal"in n.className?n.className.baseVal:null)||n.getAttribute("class")||"";break;default:e=""}return wZ(e)}function I5e(n){return Oh(n)?null:KL(n).split(/(\s+)/).filter((e=>RC(e))).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function u7(n){var e="";return EZ(n)&&!O5e(n)&&n.childNodes&&n.childNodes.length&&vf(n.childNodes,(function(t){var i;C5e(t)&&t.textContent&&(e+=(i=I5e(t.textContent))!==null&&i!==void 0?i:"")})),KL(e)}function N5e(n){return br(n.target)?n.srcElement||null:(e=n.target)!=null&&e.shadowRoot?n.composedPath()[0]||null:n.target||null;var e}var SZ=["a","button","form","input","select","textarea","label"];function k5e(n){var e=n.parentNode;return!(!e||!c7(e))&&e}function Yyt(n,e,t,i,r){var o,s,a;if(t===void 0&&(t=void 0),!qn||!n||o3(n,"html")||!c7(n)||(o=t)!=null&&o.url_allowlist&&!P5e(t.url_allowlist)||(s=t)!=null&&s.url_ignorelist&&P5e(t.url_ignorelist))return!1;if((a=t)!=null&&a.dom_event_allowlist){var c=t.dom_event_allowlist;if(c&&!c.some((g=>e.type===g)))return!1}for(var l=!1,u=[n],d=!0,h=n;h.parentNode&&!o3(h,"body");)if(R5e(h.parentNode))u.push(h.parentNode.host),h=h.parentNode.host;else{if(!(d=k5e(h)))break;if(i||SZ.indexOf(d.tagName.toLowerCase())>-1)l=!0;else{var f=qn.getComputedStyle(d);f&&f.getPropertyValue("cursor")==="pointer"&&(l=!0)}u.push(d),h=d}if(!(function(g,b){var v=b?.element_allowlist;if(br(v))return!0;var w,T=function(R){if(v.some((P=>R.tagName.toLowerCase()===P)))return{v:!0}};for(var N of g)if(w=T(N))return w.v;return!1})(u,t)||!(function(g,b){var v=b?.css_selector_allowlist;if(br(v))return!0;var w,T=function(R){if(v.some((P=>R.matches(P))))return{v:!0}};for(var N of g)if(w=T(N))return w.v;return!1})(u,t))return!1;var m=qn.getComputedStyle(n);if(m&&m.getPropertyValue("cursor")==="pointer"&&e.type==="click")return!0;var y=n.tagName.toLowerCase();switch(y){case"html":return!1;case"form":return(r||["submit"]).indexOf(e.type)>=0;case"input":case"select":case"textarea":return(r||["change","click"]).indexOf(e.type)>=0;default:return l?(r||["click"]).indexOf(e.type)>=0:(r||["click"]).indexOf(e.type)>=0&&(SZ.indexOf(y)>-1||n.getAttribute("contenteditable")==="true")}}function EZ(n){for(var e=n;e.parentNode&&!o3(e,"body");e=e.parentNode){var t=l7(e);if(Fl(t,"ph-sensitive")||Fl(t,"ph-no-capture"))return!1}if(Fl(l7(n),"ph-include"))return!0;var i=n.type||"";if(ly(i))switch(i.toLowerCase()){case"hidden":case"password":return!1}var r=n.name||n.id||"";return!(ly(r)&&/^cc|cardnum|ccnum|creditcard|csc|cvc|cvv|exp|pass|pwd|routing|seccode|securitycode|securitynum|socialsec|socsec|ssn/i.test(r.replace(/[^a-zA-Z0-9]/g,"")))}function O5e(n){return!!(o3(n,"input")&&!["button","checkbox","submit","reset"].includes(n.type)||o3(n,"select")||o3(n,"textarea")||n.getAttribute("contenteditable")==="true")}var L5e="(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})",qyt=new RegExp("^(?:"+L5e+")$"),Xyt=new RegExp(L5e),D5e="\\d{3}-?\\d{2}-?\\d{4}",Wyt=new RegExp("^("+D5e+")$"),Zyt=new RegExp("("+D5e+")");function RC(n,e){return e===void 0&&(e=!0),!(Oh(n)||ly(n)&&(n=KL(n),(e?qyt:Xyt).test((n||"").replace(/[- ]/g,""))||(e?Wyt:Zyt).test(n)))}function z5e(n){var e=u7(n);return RC(e=(e+" "+$5e(n)).trim())?e:""}function $5e(n){var e="";return n&&n.childNodes&&n.childNodes.length&&vf(n.childNodes,(function(t){var i;if(t&&((i=t.tagName)==null?void 0:i.toLowerCase())==="span")try{var r=u7(t);e=(e+" "+r).trim(),t.childNodes&&t.childNodes.length&&(e=(e+" "+$5e(t)).trim())}catch(o){Yr.error("[AutoCapture]",o)}})),e}function Kyt(n){return(function(e){var t=e.map((i=>{var r,o,s="";if(i.tag_name&&(s+=i.tag_name),i.attr_class)for(var a of(i.attr_class.sort(),i.attr_class))s+="."+a.replace(/"/g,"");var c=Qr({},i.text?{text:i.text}:{},{"nth-child":(r=i.nth_child)!==null&&r!==void 0?r:0,"nth-of-type":(o=i.nth_of_type)!==null&&o!==void 0?o:0},i.href?{href:i.href}:{},i.attr_id?{attr_id:i.attr_id}:{},i.attributes),l={};return t7(c).sort(((u,d)=>{var[h]=u,[f]=d;return h.localeCompare(f)})).forEach((u=>{var[d,h]=u;return l[F5e(d.toString())]=F5e(h.toString())})),s+=":",s+=t7(l).map((u=>{var[d,h]=u;return d+'="'+h+'"'})).join("")}));return t.join(";")})((function(e){return e.map((t=>{var i,r,o={text:(i=t.$el_text)==null?void 0:i.slice(0,400),tag_name:t.tag_name,href:(r=t.attr__href)==null?void 0:r.slice(0,2048),attr_class:Qyt(t),attr_id:t.attr__id,nth_child:t.nth_child,nth_of_type:t.nth_of_type,attributes:{}};return t7(t).filter((s=>{var[a]=s;return a.indexOf("attr__")===0})).forEach((s=>{var[a,c]=s;return o.attributes[a]=c})),o}))})(n))}function F5e(n){return n.replace(/"|\\"/g,'\\"')}function Qyt(n){var e=n.attr__class;return e?p0(e)?e:wZ(e):void 0}let B5e=class{constructor(){this.clicks=[]}isRageClick(e,t,i){var r=this.clicks[this.clicks.length-1];if(r&&Math.abs(e-r.x)+Math.abs(t-r.y)<30&&i-r.timestamp<1e3){if(this.clicks.push({x:e,y:t,timestamp:i}),this.clicks.length===3)return!0}else this.clicks=[{x:e,y:t,timestamp:i}];return!1}};var TZ="$copy_autocapture",E5=(function(n){return n.GZipJS="gzip-js",n.Base64="base64",n})({}),Jyt=["fatal","error","warning","log","info","debug"],egt=["localhost","127.0.0.1"],PC=n=>{var e=Kr?.createElement("a");return br(e)?null:(e.href=n,e)},tgt=function(n,e){var t,i;e===void 0&&(e="&");var r=[];return vf(n,(function(o,s){br(o)||br(s)||s==="undefined"||(t=encodeURIComponent((a=>a instanceof File)(o)?o.name:o.toString()),i=encodeURIComponent(s),r[r.length]=i+"="+t)})),r.join(e)},d7=function(n,e){for(var t,i=((n.split("#")[0]||"").split(/\?(.*)/)[1]||"").replace(/^\?+/g,"").split("&"),r=0;r<i.length;r++){var o=i[r].split("=");if(o[0]===e){t=o;break}}if(!p0(t)||t.length<2)return"";var s=t[1];try{s=decodeURIComponent(s)}catch{Yr.error("Skipping decoding for malformed query param: "+s)}return s.replace(/\+/g," ")},MZ=function(n,e,t){if(!n||!e||!e.length)return n;for(var i=n.split("#"),r=i[0]||"",o=i[1],s=r.split("?"),a=s[1],c=s[0],l=(a||"").split("&"),u=[],d=0;d<l.length;d++){var h=l[d].split("=");p0(h)&&(e.includes(h[0])?u.push(h[0]+"="+t):u.push(l[d]))}var f=c;return a!=null&&(f+="?"+u.join("&")),o!=null&&(f+="#"+o),f},h7=function(n,e){var t=n.match(new RegExp(e+"=([^&]*)"));return t?t[1]:null},U5e=x1("[AutoCapture]");function AZ(n,e){return e.length>n?e.slice(0,n)+"...":e}function ngt(n){if(n.previousElementSibling)return n.previousElementSibling;var e=n;do e=e.previousSibling;while(e&&!c7(e));return e}function igt(n,e,t,i){var r=n.tagName.toLowerCase(),o={tag_name:r};SZ.indexOf(r)>-1&&!t&&(r.toLowerCase()==="a"||r.toLowerCase()==="button"?o.$el_text=AZ(1024,z5e(n)):o.$el_text=AZ(1024,u7(n)));var s=l7(n);s.length>0&&(o.classes=s.filter((function(u){return u!==""}))),vf(n.attributes,(function(u){var d;if((!O5e(n)||["name","id","class","aria-label"].indexOf(u.name)!==-1)&&(i==null||!i.includes(u.name))&&!e&&RC(u.value)&&(d=u.name,!ly(d)||d.substring(0,10)!=="_ngcontent"&&d.substring(0,7)!=="_nghost")){var h=u.value;u.name==="class"&&(h=wZ(h).join(" ")),o["attr__"+u.name]=AZ(1024,h)}}));for(var a=1,c=1,l=n;l=ngt(l);)a++,l.tagName===n.tagName&&c++;return o.nth_child=a,o.nth_of_type=c,o}function rgt(n,e){for(var t,i,{e:r,maskAllElementAttributes:o,maskAllText:s,elementAttributeIgnoreList:a,elementsChainAsString:c}=e,l=[n],u=n;u.parentNode&&!o3(u,"body");)R5e(u.parentNode)?(l.push(u.parentNode.host),u=u.parentNode.host):(l.push(u.parentNode),u=u.parentNode);var d,h=[],f={},m=!1,y=!1;if(vf(l,(T=>{var N=EZ(T);T.tagName.toLowerCase()==="a"&&(m=T.getAttribute("href"),m=N&&m&&RC(m)&&m),Fl(l7(T),"ph-no-capture")&&(y=!0),h.push(igt(T,o,s,a));var R=(function(P){if(!EZ(P))return{};var M={};return vf(P.attributes,(function(I){if(I.name&&I.name.indexOf("data-ph-capture-attribute")===0){var A=I.name.replace("data-ph-capture-attribute-",""),U=I.value;A&&U&&RC(U)&&(M[A]=U)}})),M})(T);qy(f,R)})),y)return{props:{},explicitNoCapture:y};if(s||(n.tagName.toLowerCase()==="a"||n.tagName.toLowerCase()==="button"?h[0].$el_text=z5e(n):h[0].$el_text=u7(n)),m){var g,b;h[0].attr__href=m;var v=(g=PC(m))==null?void 0:g.host,w=qn==null||(b=qn.location)==null?void 0:b.host;v&&w&&v!==w&&(d=m)}return{props:qy({$event_type:r.type,$ce_version:1},c?{}:{$elements:h},{$elements_chain:Kyt(h)},(t=h[0])!=null&&t.$el_text?{$el_text:(i=h[0])==null?void 0:i.$el_text}:{},d&&r.type==="click"?{$external_click_url:d}:{},f)}}let ogt=class{constructor(e){this.C=!1,this.M=null,this.rageclicks=new B5e,this.O=!1,this.instance=e,this.F=null}get A(){var e,t,i=cy(this.instance.config.autocapture)?this.instance.config.autocapture:{};return i.url_allowlist=(e=i.url_allowlist)==null?void 0:e.map((r=>new RegExp(r))),i.url_ignorelist=(t=i.url_ignorelist)==null?void 0:t.map((r=>new RegExp(r))),i}D(){if(this.isBrowserSupported()){if(qn&&Kr){var e=i=>{i=i||qn?.event;try{this.j(i)}catch(r){U5e.error("Failed to capture event",r)}};if(M_(Kr,"submit",e,{capture:!0}),M_(Kr,"change",e,{capture:!0}),M_(Kr,"click",e,{capture:!0}),this.A.capture_copied_text){var t=i=>{i=i||qn?.event,this.j(i,TZ)};M_(Kr,"copy",t,{capture:!0}),M_(Kr,"cut",t,{capture:!0})}}}else U5e.info("Disabling Automatic Event Collection because this browser is not supported")}startIfEnabled(){this.isEnabled&&!this.C&&(this.D(),this.C=!0)}onRemoteConfig(e){e.elementsChainAsString&&(this.O=e.elementsChainAsString),this.instance.persistence&&this.instance.persistence.register({[f5e]:!!e.autocapture_opt_out}),this.M=!!e.autocapture_opt_out,this.startIfEnabled()}setElementSelectors(e){this.F=e}getElementSelectors(e){var t,i=[];return(t=this.F)==null||t.forEach((r=>{var o=Kr?.querySelectorAll(r);o?.forEach((s=>{e===s&&i.push(r)}))})),i}get isEnabled(){var e,t,i=(e=this.instance.persistence)==null?void 0:e.props[f5e],r=this.M;if(i3(r)&&!eE(i)&&!this.instance.L())return!1;var o=(t=this.M)!==null&&t!==void 0?t:!!i;return!!this.instance.config.autocapture&&!o}j(e,t){if(t===void 0&&(t="$autocapture"),this.isEnabled){var i,r=N5e(e);C5e(r)&&(r=r.parentNode||null),t==="$autocapture"&&e.type==="click"&&e instanceof MouseEvent&&this.instance.config.rageclick&&(i=this.rageclicks)!=null&&i.isRageClick(e.clientX,e.clientY,new Date().getTime())&&this.j(e,"$rageclick");var o=t===TZ;if(r&&Yyt(r,e,this.A,o,o?["copy","cut"]:void 0)){var{props:s,explicitNoCapture:a}=rgt(r,{e,maskAllElementAttributes:this.instance.config.mask_all_element_attributes,maskAllText:this.instance.config.mask_all_text,elementAttributeIgnoreList:this.A.element_attribute_ignorelist,elementsChainAsString:this.O});if(a)return!1;var c=this.getElementSelectors(r);if(c&&c.length>0&&(s.$element_selectors=c),t===TZ){var l,u=I5e(qn==null||(l=qn.getSelection())==null?void 0:l.toString()),d=e.type||"clipboard";if(!u)return!1;s.$selected_content=u,s.$copy_type=d}return this.instance.capture(t,s),!0}}}isBrowserSupported(){return h2(Kr?.querySelectorAll)}};Math.trunc||(Math.trunc=function(n){return n<0?Math.ceil(n):Math.floor(n)}),Number.isInteger||(Number.isInteger=function(n){return wx(n)&&isFinite(n)&&Math.floor(n)===n});var j5e="0123456789abcdef";let sgt=class BSe{constructor(e){if(this.bytes=e,e.length!==16)throw new TypeError("not 128-bit length")}static fromFieldsV7(e,t,i,r){if(!Number.isInteger(e)||!Number.isInteger(t)||!Number.isInteger(i)||!Number.isInteger(r)||e<0||t<0||i<0||r<0||e>0xffffffffffff||t>4095||i>1073741823||r>4294967295)throw new RangeError("invalid field value");var o=new Uint8Array(16);return o[0]=e/Math.pow(2,40),o[1]=e/Math.pow(2,32),o[2]=e/Math.pow(2,24),o[3]=e/Math.pow(2,16),o[4]=e/Math.pow(2,8),o[5]=e,o[6]=112|t>>>8,o[7]=t,o[8]=128|i>>>24,o[9]=i>>>16,o[10]=i>>>8,o[11]=i,o[12]=r>>>24,o[13]=r>>>16,o[14]=r>>>8,o[15]=r,new BSe(o)}toString(){for(var e="",t=0;t<this.bytes.length;t++)e=e+j5e.charAt(this.bytes[t]>>>4)+j5e.charAt(15&this.bytes[t]),t!==3&&t!==5&&t!==7&&t!==9||(e+="-");if(e.length!==36)throw new Error("Invalid UUIDv7 was generated");return e}clone(){return new BSe(this.bytes.slice(0))}equals(e){return this.compareTo(e)===0}compareTo(e){for(var t=0;t<16;t++){var i=this.bytes[t]-e.bytes[t];if(i!==0)return Math.sign(i)}return 0}},agt=class{constructor(){this.N=0,this.U=0,this.q=new cgt}generate(){var e=this.generateOrAbort();if(br(e)){this.N=0;var t=this.generateOrAbort();if(br(t))throw new Error("Could not generate UUID after timestamp reset");return t}return e}generateOrAbort(){var e=Date.now();if(e>this.N)this.N=e,this.B();else{if(!(e+1e4>this.N))return;this.U++,this.U>4398046511103&&(this.N++,this.B())}return sgt.fromFieldsV7(this.N,Math.trunc(this.U/Math.pow(2,30)),this.U&Math.pow(2,30)-1,this.q.nextUint32())}B(){this.U=1024*this.q.nextUint32()+(1023&this.q.nextUint32())}};var H5e,V5e=n=>{if(typeof UUIDV7_DENY_WEAK_RNG<"u"&&UUIDV7_DENY_WEAK_RNG)throw new Error("no cryptographically strong RNG available");for(var e=0;e<n.length;e++)n[e]=65536*Math.trunc(65536*Math.random())+Math.trunc(65536*Math.random());return n};qn&&!br(qn.crypto)&&crypto.getRandomValues&&(V5e=n=>crypto.getRandomValues(n));let cgt=class{constructor(){this.H=new Uint32Array(8),this.W=1/0}nextUint32(){return this.W>=this.H.length&&(V5e(this.H),this.W=0),this.H[this.W++]}};var s3=()=>lgt().toString(),lgt=()=>(H5e||(H5e=new agt)).generate(),hN="",ugt=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i;function dgt(n,e){if(e){var t=(function(r,o){if(o===void 0&&(o=Kr),hN)return hN;if(!o||["localhost","127.0.0.1"].includes(r))return"";for(var s=r.split("."),a=Math.min(s.length,8),c="dmn_chk_"+s3();!hN&&a--;){var l=s.slice(a).join("."),u=c+"=1;domain=."+l+";path=/";o.cookie=u+";max-age=3",o.cookie.includes(c)&&(o.cookie=u+";max-age=0",hN=l)}return hN})(n);if(!t){var i=(r=>{var o=r.match(ugt);return o?o[0]:""})(n);i!==t&&Yr.info("Warning: cookie subdomain discovery mismatch",i,t),t=i}return t?"; domain=."+t:""}return""}var tE={G:()=>!!Kr,J:function(n){Yr.error("cookieStore error: "+n)},V:function(n){if(Kr){try{for(var e=n+"=",t=Kr.cookie.split(";").filter((o=>o.length)),i=0;i<t.length;i++){for(var r=t[i];r.charAt(0)==" ";)r=r.substring(1,r.length);if(r.indexOf(e)===0)return decodeURIComponent(r.substring(e.length,r.length))}}catch{}return null}},K:function(n){var e;try{e=JSON.parse(tE.V(n))||{}}catch{}return e},Y:function(n,e,t,i,r){if(Kr)try{var o="",s="",a=dgt(Kr.location.hostname,i);if(t){var c=new Date;c.setTime(c.getTime()+24*t*60*60*1e3),o="; expires="+c.toUTCString()}r&&(s="; secure");var l=n+"="+encodeURIComponent(JSON.stringify(e))+o+"; SameSite=Lax; path=/"+a+s;return l.length>3686.4&&Yr.warn("cookieStore warning: large cookie, len="+l.length),Kr.cookie=l,l}catch{return}},X:function(n,e){if(Kr!=null&&Kr.cookie)try{tE.Y(n,"",-1,e)}catch{return}}},CZ=null,v1={G:function(){if(!i3(CZ))return CZ;var n=!0;if(br(qn))n=!1;else try{var e="__mplssupport__";v1.Y(e,"xyz"),v1.V(e)!=='"xyz"'&&(n=!1),v1.X(e)}catch{n=!1}return n||Yr.error("localStorage unsupported; falling back to cookie store"),CZ=n,n},J:function(n){Yr.error("localStorage error: "+n)},V:function(n){try{return qn?.localStorage.getItem(n)}catch(e){v1.J(e)}return null},K:function(n){try{return JSON.parse(v1.V(n))||{}}catch{}return null},Y:function(n,e){try{qn?.localStorage.setItem(n,JSON.stringify(e))}catch(t){v1.J(t)}},X:function(n){try{qn?.localStorage.removeItem(n)}catch(e){v1.J(e)}}},hgt=["distinct_id",i7,cN,a7,s7],p7=Qr({},v1,{K:function(n){try{var e={};try{e=tE.K(n)||{}}catch{}var t=qy(e,JSON.parse(v1.V(n)||"{}"));return v1.Y(n,t),t}catch{}return null},Y:function(n,e,t,i,r,o){try{v1.Y(n,e,void 0,void 0,o);var s={};hgt.forEach((a=>{e[a]&&(s[a]=e[a])})),Object.keys(s).length&&tE.Y(n,s,t,i,r,o)}catch(a){v1.J(a)}},X:function(n,e){try{qn?.localStorage.removeItem(n),tE.X(n,e)}catch(t){v1.J(t)}}}),f7={},pgt={G:function(){return!0},J:function(n){Yr.error("memoryStorage error: "+n)},V:function(n){return f7[n]||null},K:function(n){return f7[n]||null},Y:function(n,e){f7[n]=e},X:function(n){delete f7[n]}},lA=null,Xb={G:function(){if(!i3(lA))return lA;if(lA=!0,br(qn))lA=!1;else try{var n="__support__";Xb.Y(n,"xyz"),Xb.V(n)!=='"xyz"'&&(lA=!1),Xb.X(n)}catch{lA=!1}return lA},J:function(n){Yr.error("sessionStorage error: ",n)},V:function(n){try{return qn?.sessionStorage.getItem(n)}catch(e){Xb.J(e)}return null},K:function(n){try{return JSON.parse(Xb.V(n))||null}catch{}return null},Y:function(n,e){try{qn?.sessionStorage.setItem(n,JSON.stringify(e))}catch(t){Xb.J(t)}},X:function(n){try{qn?.sessionStorage.removeItem(n)}catch(e){Xb.J(e)}}},T5=(function(n){return n[n.PENDING=-1]="PENDING",n[n.DENIED=0]="DENIED",n[n.GRANTED=1]="GRANTED",n})({});let fgt=class{constructor(e){this._instance=e}get A(){return this._instance.config}get consent(){return this.Z()?T5.DENIED:this.tt}isOptedOut(){return this.A.cookieless_mode==="always"||this.consent===T5.DENIED||this.consent===T5.PENDING&&(this.A.opt_out_capturing_by_default||this.A.cookieless_mode==="on_reject")}isOptedIn(){return!this.isOptedOut()}isExplicitlyOptedOut(){return this.consent===T5.DENIED}optInOut(e){this.it.Y(this.et,e?1:0,this.A.cookie_expiration,this.A.cross_subdomain_cookie,this.A.secure_cookie)}reset(){this.it.X(this.et,this.A.cross_subdomain_cookie)}get et(){var{token:e,opt_out_capturing_cookie_prefix:t,consent_persistence_name:i}=this._instance.config;return i||(t?t+e:"__ph_opt_in_out_"+e)}get tt(){var e=this.it.V(this.et);return uZ(e)?T5.GRANTED:Fl(Fyt,e)?T5.DENIED:T5.PENDING}get it(){if(!this.rt){var e=this.A.opt_out_capturing_persistence_type;this.rt=e==="localStorage"?v1:tE;var t=e==="localStorage"?tE:v1;t.V(this.et)&&(this.rt.V(this.et)||this.optInOut(uZ(t.V(this.et))),t.X(this.et,this.A.cross_subdomain_cookie))}return this.rt}Z(){return!!this.A.respect_dnt&&!!h5e([bw?.doNotTrack,bw?.msDoNotTrack,Bs.doNotTrack],(e=>uZ(e)))}};var m7=x1("[Dead Clicks]"),mgt=()=>!0,_gt=n=>{var e,t=!((e=n.instance.persistence)==null||!e.get_property(g5e)),i=n.instance.config.capture_dead_clicks;return eE(i)?i:t};let G5e=class{get lazyLoadedDeadClicksAutocapture(){return this.st}constructor(e,t,i){this.instance=e,this.isEnabled=t,this.onCapture=i,this.startIfEnabled()}onRemoteConfig(e){this.instance.persistence&&this.instance.persistence.register({[g5e]:e?.captureDeadClicks}),this.startIfEnabled()}startIfEnabled(){this.isEnabled(this)&&this.nt((()=>{this.ot()}))}nt(e){var t,i;(t=Bs.__PosthogExtensions__)!=null&&t.initDeadClicksAutocapture&&e(),(i=Bs.__PosthogExtensions__)==null||i.loadExternalDependency==null||i.loadExternalDependency(this.instance,"dead-clicks-autocapture",(r=>{r?m7.error("failed to load script",r):e()}))}ot(){var e;if(Kr){if(!this.st&&(e=Bs.__PosthogExtensions__)!=null&&e.initDeadClicksAutocapture){var t=cy(this.instance.config.capture_dead_clicks)?this.instance.config.capture_dead_clicks:{};t.__onCapture=this.onCapture,this.st=Bs.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,t),this.st.start(Kr),m7.info("starting...")}}else m7.error("`document` not found. Cannot start.")}stop(){this.st&&(this.st.stop(),this.st=void 0,m7.info("stopping..."))}};var pN=x1("[ExceptionAutocapture]");let ygt=class{constructor(e){var t,i,r;this.lt=()=>{var o;if(qn&&this.isEnabled&&(o=Bs.__PosthogExtensions__)!=null&&o.errorWrappingFunctions){var s=Bs.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,a=Bs.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,c=Bs.__PosthogExtensions__.errorWrappingFunctions.wrapConsoleError;try{!this.ht&&this.A.capture_unhandled_errors&&(this.ht=s(this.captureException.bind(this))),!this.ut&&this.A.capture_unhandled_rejections&&(this.ut=a(this.captureException.bind(this))),!this.dt&&this.A.capture_console_errors&&(this.dt=c(this.captureException.bind(this)))}catch(l){pN.error("failed to start",l),this.vt()}}},this._instance=e,this.ct=!((t=this._instance.persistence)==null||!t.props[m5e]),this.A=this.ft(),this.gt=new c5e({refillRate:(i=this._instance.config.error_tracking.__exceptionRateLimiterRefillRate)!==null&&i!==void 0?i:1,bucketSize:(r=this._instance.config.error_tracking.__exceptionRateLimiterBucketSize)!==null&&r!==void 0?r:10,refillInterval:1e4,R:pN}),this.startIfEnabled()}ft(){var e=this._instance.config.capture_exceptions,t={capture_unhandled_errors:!1,capture_unhandled_rejections:!1,capture_console_errors:!1};return cy(e)?t=Qr({},t,e):(br(e)?this.ct:e)&&(t=Qr({},t,{capture_unhandled_errors:!0,capture_unhandled_rejections:!0})),t}get isEnabled(){return this.A.capture_console_errors||this.A.capture_unhandled_errors||this.A.capture_unhandled_rejections}startIfEnabled(){this.isEnabled&&(pN.info("enabled"),this.nt(this.lt))}nt(e){var t,i;(t=Bs.__PosthogExtensions__)!=null&&t.errorWrappingFunctions&&e(),(i=Bs.__PosthogExtensions__)==null||i.loadExternalDependency==null||i.loadExternalDependency(this._instance,"exception-autocapture",(r=>{if(r)return pN.error("failed to load script",r);e()}))}vt(){var e,t,i;(e=this.ht)==null||e.call(this),this.ht=void 0,(t=this.ut)==null||t.call(this),this.ut=void 0,(i=this.dt)==null||i.call(this),this.dt=void 0}onRemoteConfig(e){var t=e.autocaptureExceptions;this.ct=!!t||!1,this.A=this.ft(),this._instance.persistence&&this._instance.persistence.register({[m5e]:this.ct}),this.startIfEnabled()}captureException(e){var t,i=this._instance.requestRouter.endpointFor("ui");e.$exception_personURL=i+"/project/"+this._instance.config.token+"/person/"+this._instance.get_distinct_id();var r=(t=e.$exception_list[0].type)!==null&&t!==void 0?t:"Exception";this.gt.consumeRateLimit(r)?pN.info("Skipping exception capture because of client rate limiting.",{exception:e.$exception_list[0].type}):this._instance.exceptions.sendExceptionEvent(e)}};function Y5e(n){return!br(Event)&&q5e(n,Event)}function q5e(n,e){try{return n instanceof e}catch{return!1}}function X5e(n){switch(Object.prototype.toString.call(n)){case"[object Error]":case"[object Exception]":case"[object DOMException]":case"[object DOMError]":return!0;default:return q5e(n,Error)}}function _7(n,e){return Object.prototype.toString.call(n)==="[object "+e+"]"}function RZ(n){return _7(n,"DOMError")}var W5e=/\(error: (.*)\)/,Z5e=50,IC="?";function PZ(n,e,t,i){var r={platform:"web:javascript",filename:n,function:e==="<anonymous>"?IC:e,in_app:!0};return br(t)||(r.lineno=t),br(i)||(r.colno=i),r}var ggt=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,bgt=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,xgt=/\((\S*)(?::(\d+))(?::(\d+))\)/,vgt=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,wgt=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,Sgt=(function(){for(var n=arguments.length,e=new Array(n),t=0;t<n;t++)e[t]=arguments[t];var i=e.sort(((r,o)=>r[0]-o[0])).map((r=>r[1]));return function(r,o){o===void 0&&(o=0);for(var s=[],a=r.split(`
|
|
320
320
|
`),c=o;c<a.length;c++){var l=a[c];if(!(l.length>1024)){var u=W5e.test(l)?l.replace(W5e,"$1"):l;if(!u.match(/\S*Error: /)){for(var d of i){var h=d(u);if(h){s.push(h);break}}if(s.length>=Z5e)break}}}return(function(f){if(!f.length)return[];var m=Array.from(f);return m.reverse(),m.slice(0,Z5e).map((y=>Qr({},y,{filename:y.filename||Egt(m).filename,function:y.function||IC})))})(s)}})([30,n=>{var e=ggt.exec(n);if(e){var[,t,i,r]=e;return PZ(t,IC,+i,+r)}var o=bgt.exec(n);if(o){if(o[2]&&o[2].indexOf("eval")===0){var s=xgt.exec(o[2]);s&&(o[2]=s[1],o[3]=s[2],o[4]=s[3])}var[a,c]=Q5e(o[1]||IC,o[2]);return PZ(c,a,o[3]?+o[3]:void 0,o[4]?+o[4]:void 0)}}],[50,n=>{var e=vgt.exec(n);if(e){if(e[3]&&e[3].indexOf(" > eval")>-1){var t=wgt.exec(e[3]);t&&(e[1]=e[1]||"eval",e[3]=t[1],e[4]=t[2],e[5]="")}var i=e[3],r=e[1]||IC;return[r,i]=Q5e(r,i),PZ(i,r,e[4]?+e[4]:void 0,e[5]?+e[5]:void 0)}}]);function Egt(n){return n[n.length-1]||{}}var y7,K5e,IZ,Q5e=(n,e)=>{var t=n.indexOf("safari-extension")!==-1,i=n.indexOf("safari-web-extension")!==-1;return t||i?[n.indexOf("@")!==-1?n.split("@")[0]:IC,t?"safari-extension:"+e:"safari-web-extension:"+e]:[n,e]},Tgt=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;function NZ(n,e){e===void 0&&(e=0);var t=n.stacktrace||n.stack||"",i=(function(s){return s&&Mgt.test(s.message)?1:0})(n);try{var r=Sgt,o=(function(s,a){var c=(function(l){var u=globalThis._posthogChunkIds;if(!u)return{};var d=Object.keys(u);return IZ&&d.length===K5e||(K5e=d.length,IZ=d.reduce(((h,f)=>{y7||(y7={});var m=y7[f];if(m)h[m[0]]=m[1];else for(var y=l(f),g=y.length-1;g>=0;g--){var b=y[g],v=b?.filename,w=u[f];if(v&&w){h[v]=w,y7[f]=[v,w];break}}return h}),{})),IZ})(a);return s.forEach((l=>{l.filename&&(l.chunk_id=c[l.filename])})),s})(r(t,i),r);return o.slice(0,o.length-e)}catch{}return[]}var Mgt=/Minified React error #\d+;/i;function Agt(n,e){var t,i,r=NZ(n),o=(t=e?.handled)===null||t===void 0||t,s=(i=e?.synthetic)!==null&&i!==void 0&&i;return{type:e!=null&&e.overrideExceptionType?e.overrideExceptionType:n.name,value:(function(a){var c=a.message;return c.error&&typeof c.error.message=="string"?String(c.error.message):String(c)})(n),stacktrace:{frames:r,type:"raw"},mechanism:{handled:o,synthetic:s}}}function J5e(n,e){var t=Agt(n,e);return n.cause&&X5e(n.cause)&&n.cause!==n?[t,...J5e(n.cause,{handled:e?.handled,synthetic:e?.synthetic})]:[t]}function kZ(n,e){return{$exception_list:J5e(n,e),$exception_level:"error"}}function OZ(n,e){var t,i,r,o=(t=e?.handled)===null||t===void 0||t,s=(i=e?.synthetic)===null||i===void 0||i,a={type:e!=null&&e.overrideExceptionType?e.overrideExceptionType:(r=e?.defaultExceptionType)!==null&&r!==void 0?r:"Error",value:n||e?.defaultExceptionMessage,mechanism:{handled:o,synthetic:s}};if(e!=null&&e.syntheticException){var c=NZ(e.syntheticException,1);c.length&&(a.stacktrace={frames:c,type:"raw"})}return{$exception_list:[a],$exception_level:"error"}}function Cgt(n){return ly(n)&&!lZ(n)&&Jyt.indexOf(n)>=0}function Rgt(n,e){var t,i,r=(t=e?.handled)===null||t===void 0||t,o=(i=e?.synthetic)===null||i===void 0||i,s=e!=null&&e.overrideExceptionType?e.overrideExceptionType:Y5e(n)?n.constructor.name:"Error",a="Non-Error 'exception' captured with keys: "+(function(u,d){d===void 0&&(d=40);var h=Object.keys(u);if(h.sort(),!h.length)return"[object has no keys]";for(var f=h.length;f>0;f--){var m=h.slice(0,f).join(", ");if(!(m.length>d))return f===h.length||m.length<=d?m:m.slice(0,d)+"..."}return""})(n),c={type:s,value:a,mechanism:{handled:r,synthetic:o}};if(e!=null&&e.syntheticException){var l=NZ(e?.syntheticException,1);l.length&&(c.stacktrace={frames:l,type:"raw"})}return{$exception_list:[c],$exception_level:Cgt(n.level)?n.level:"error"}}function Pgt(n,e){var{error:t,event:i}=n,r={$exception_list:[]},o=t||i;if(RZ(o)||(function(h){return _7(h,"DOMException")})(o)){var s=o;if((function(h){return"stack"in h})(o))r=kZ(o,e);else{var a=s.name||(RZ(s)?"DOMError":"DOMException"),c=s.message?a+": "+s.message:a;r=OZ(c,Qr({},e,{overrideExceptionType:RZ(s)?"DOMError":"DOMException",defaultExceptionMessage:c}))}return"code"in s&&(r.$exception_DOMException_code=""+s.code),r}if((function(h){return _7(h,"ErrorEvent")})(o)&&o.error)return kZ(o.error,e);if(X5e(o))return kZ(o,e);if((function(h){return _7(h,"Object")})(o)||Y5e(o))return Rgt(o,e);if(br(t)&&ly(i)){var l="Error",u=i,d=i.match(Tgt);return d&&(l=d[1],u=d[2]),OZ(u,Qr({},e,{overrideExceptionType:l,defaultExceptionMessage:u}))}return OZ(o,e)}function eTe(n,e,t){try{if(!(e in n))return()=>{};var i=n[e],r=t(i);return h2(r)&&(r.prototype=r.prototype||{},Object.defineProperties(r,{__posthog_wrapped__:{enumerable:!1,value:!0}})),n[e]=r,()=>{n[e]=i}}catch{return()=>{}}}let Igt=class{constructor(e){var t;this._instance=e,this._t=(qn==null||(t=qn.location)==null?void 0:t.pathname)||""}get isEnabled(){return this._instance.config.capture_pageview==="history_change"}startIfEnabled(){this.isEnabled&&(Yr.info("History API monitoring enabled, starting..."),this.monitorHistoryChanges())}stop(){this.bt&&this.bt(),this.bt=void 0,Yr.info("History API monitoring stopped")}monitorHistoryChanges(){var e,t;if(qn&&qn.history){var i=this;(e=qn.history.pushState)!=null&&e.__posthog_wrapped__||eTe(qn.history,"pushState",(r=>function(o,s,a){r.call(this,o,s,a),i.yt("pushState")})),(t=qn.history.replaceState)!=null&&t.__posthog_wrapped__||eTe(qn.history,"replaceState",(r=>function(o,s,a){r.call(this,o,s,a),i.yt("replaceState")})),this.wt()}}yt(e){try{var t,i=qn==null||(t=qn.location)==null?void 0:t.pathname;if(!i)return;i!==this._t&&this.isEnabled&&this._instance.capture("$pageview",{navigation_type:e}),this._t=i}catch(r){Yr.error("Error capturing "+e+" pageview",r)}}wt(){if(!this.bt){var e=()=>{this.yt("popstate")};M_(qn,"popstate",e),this.bt=()=>{qn&&qn.removeEventListener("popstate",e)}}}};function g7(n){var e,t;return((e=JSON.stringify(n,(t=[],function(i,r){if(cy(r)){for(;t.length>0&&t[t.length-1]!==this;)t.pop();return t.includes(r)?"[Circular]":(t.push(r),r)}return r})))==null?void 0:e.length)||0}function LZ(n,e){if(e===void 0&&(e=66060288e-1),n.size>=e&&n.data.length>1){var t=Math.floor(n.data.length/2),i=n.data.slice(0,t),r=n.data.slice(t);return[LZ({size:g7(i),data:i,sessionId:n.sessionId,windowId:n.windowId}),LZ({size:g7(r),data:r,sessionId:n.sessionId,windowId:n.windowId})].flatMap((o=>o))}return[n]}var M5=(n=>(n[n.DomContentLoaded=0]="DomContentLoaded",n[n.Load=1]="Load",n[n.FullSnapshot=2]="FullSnapshot",n[n.IncrementalSnapshot=3]="IncrementalSnapshot",n[n.Meta=4]="Meta",n[n.Custom=5]="Custom",n[n.Plugin=6]="Plugin",n))(M5||{}),tS=(n=>(n[n.Mutation=0]="Mutation",n[n.MouseMove=1]="MouseMove",n[n.MouseInteraction=2]="MouseInteraction",n[n.Scroll=3]="Scroll",n[n.ViewportResize=4]="ViewportResize",n[n.Input=5]="Input",n[n.TouchMove=6]="TouchMove",n[n.MediaInteraction=7]="MediaInteraction",n[n.StyleSheetRule=8]="StyleSheetRule",n[n.CanvasMutation=9]="CanvasMutation",n[n.Font=10]="Font",n[n.Log=11]="Log",n[n.Drag=12]="Drag",n[n.StyleDeclaration=13]="StyleDeclaration",n[n.Selection=14]="Selection",n[n.AdoptedStyleSheet=15]="AdoptedStyleSheet",n[n.CustomElement=16]="CustomElement",n))(tS||{}),DZ="[SessionRecording]",zZ="redacted",b7={initiatorTypes:["audio","beacon","body","css","early-hint","embed","fetch","frame","iframe","icon","image","img","input","link","navigation","object","ping","script","track","video","xmlhttprequest"],maskRequestFn:n=>n,recordHeaders:!1,recordBody:!1,recordInitialRequests:!1,recordPerformance:!1,performanceEntryTypeToObserve:["first-input","navigation","paint","resource"],payloadSizeLimitBytes:1e6,payloadHostDenyList:[".lr-ingest.io",".ingest.sentry.io",".clarity.ms","analytics.google.com","bam.nr-data.net"]},Ngt=["authorization","x-forwarded-for","authorization","cookie","set-cookie","x-api-key","x-real-ip","remote-addr","forwarded","proxy-authorization","x-csrf-token","x-csrftoken","x-xsrf-token"],kgt=["password","secret","passwd","api_key","apikey","auth","credentials","mysql_pwd","privatekey","private_key","token"],Ogt=["/s/","/e/","/i/"];function tTe(n,e,t,i){if(Oh(n))return n;var r=e?.["content-length"]||(function(o){return new Blob([o]).size})(n);return ly(r)&&(r=parseInt(r)),r>t?DZ+" "+i+" body too large to record ("+r+" bytes)":n}function nTe(n,e){if(Oh(n))return n;var t=n;return RC(t,!1)||(t=DZ+" "+e+" body "+zZ),vf(kgt,(i=>{var r,o;(r=t)!=null&&r.length&&((o=t)==null?void 0:o.indexOf(i))!==-1&&(t=DZ+" "+e+" body "+zZ+" as might contain: "+i)})),t}var Lgt=(n,e)=>{var t,i,r,o={payloadSizeLimitBytes:b7.payloadSizeLimitBytes,performanceEntryTypeToObserve:[...b7.performanceEntryTypeToObserve],payloadHostDenyList:[...e.payloadHostDenyList||[],...b7.payloadHostDenyList]},s=n.session_recording.recordHeaders!==!1&&e.recordHeaders,a=n.session_recording.recordBody!==!1&&e.recordBody,c=n.capture_performance!==!1&&e.recordPerformance,l=(t=o,r=Math.min(1e6,(i=t.payloadSizeLimitBytes)!==null&&i!==void 0?i:1e6),h=>(h!=null&&h.requestBody&&(h.requestBody=tTe(h.requestBody,h.requestHeaders,r,"Request")),h!=null&&h.responseBody&&(h.responseBody=tTe(h.responseBody,h.responseHeaders,r,"Response")),h)),u=h=>{return l(((y,g)=>{var b,v=PC(y.name),w=g.indexOf("http")===0?(b=PC(g))==null?void 0:b.pathname:g;w==="/"&&(w="");var T=v?.pathname.replace(w||"","");if(!(v&&T&&Ogt.some((N=>T.indexOf(N)===0))))return y})((m=(f=h).requestHeaders,Oh(m)||vf(Object.keys(m??{}),(y=>{Ngt.includes(y.toLowerCase())&&(m[y]=zZ)})),f),n.api_host));var f,m},d=h2(n.session_recording.maskNetworkRequestFn);return d&&h2(n.session_recording.maskCapturedNetworkRequestFn)&&Yr.warn("Both `maskNetworkRequestFn` and `maskCapturedNetworkRequestFn` are defined. `maskNetworkRequestFn` will be ignored."),d&&(n.session_recording.maskCapturedNetworkRequestFn=h=>{var f=n.session_recording.maskNetworkRequestFn({url:h.name});return Qr({},h,{name:f?.url})}),o.maskRequestFn=h2(n.session_recording.maskCapturedNetworkRequestFn)?h=>{var f,m=u(h);return m&&(f=n.session_recording.maskCapturedNetworkRequestFn==null?void 0:n.session_recording.maskCapturedNetworkRequestFn(m))!==null&&f!==void 0?f:void 0}:h=>(function(f){if(!br(f))return f.requestBody=nTe(f.requestBody,"Request"),f.responseBody=nTe(f.responseBody,"Response"),f})(u(h)),Qr({},b7,o,{recordHeaders:s,recordBody:a,recordPerformance:c,recordInitialRequests:c})};let Dgt=class{constructor(e,t){var i,r;t===void 0&&(t={}),this.St={},this.$t=o=>{if(!this.St[o]){var s,a;this.St[o]=!0;var c=this.kt(o);(s=(a=this.i).onBlockedNode)==null||s.call(a,o,c)}},this.xt=o=>{var s=this.kt(o);if(s?.nodeName!=="svg"&&s instanceof Element){var a=s.closest("svg");if(a)return[this._rrweb.mirror.getId(a),a]}return[o,s]},this.kt=o=>this._rrweb.mirror.getNode(o),this.Et=o=>{var s,a,c,l,u,d,h,f;return((s=(a=o.removes)==null?void 0:a.length)!==null&&s!==void 0?s:0)+((c=(l=o.attributes)==null?void 0:l.length)!==null&&c!==void 0?c:0)+((u=(d=o.texts)==null?void 0:d.length)!==null&&u!==void 0?u:0)+((h=(f=o.adds)==null?void 0:f.length)!==null&&h!==void 0?h:0)},this.throttleMutations=o=>{if(o.type!==3||o.data.source!==0)return o;var s=o.data,a=this.Et(s);s.attributes&&(s.attributes=s.attributes.filter((l=>{var[u]=this.xt(l.id);return!this.gt.consumeRateLimit(u)&&l})));var c=this.Et(s);return c!==0||a===c?o:void 0},this._rrweb=e,this.i=t,this.gt=new c5e({bucketSize:(i=this.i.bucketSize)!==null&&i!==void 0?i:100,refillRate:(r=this.i.refillRate)!==null&&r!==void 0?r:10,refillInterval:1e3,I:this.$t,R:Yr})}};var p2=Uint8Array,Fv=Uint16Array,NC=Uint32Array,$Z=new p2([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]),FZ=new p2([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]),iTe=new p2([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),rTe=function(n,e){for(var t=new Fv(31),i=0;i<31;++i)t[i]=e+=1<<n[i-1];var r=new NC(t[30]);for(i=1;i<30;++i)for(var o=t[i];o<t[i+1];++o)r[o]=o-t[i]<<5|i;return[t,r]},oTe=rTe($Z,2),zgt=oTe[0],BZ=oTe[1];zgt[28]=258,BZ[258]=28;for(var sTe=rTe(FZ,0)[1],aTe=new Fv(32768),f0=0;f0<32768;++f0){var uA=(43690&f0)>>>1|(21845&f0)<<1;uA=(61680&(uA=(52428&uA)>>>2|(13107&uA)<<2))>>>4|(3855&uA)<<4,aTe[f0]=((65280&uA)>>>8|(255&uA)<<8)>>>1}var fN=function(n,e,t){for(var i=n.length,r=0,o=new Fv(e);r<i;++r)++o[n[r]-1];var s,a=new Fv(e);for(r=0;r<e;++r)a[r]=a[r-1]+o[r-1]<<1;for(s=new Fv(i),r=0;r<i;++r)s[r]=aTe[a[n[r]-1]++]>>>15-n[r];return s},dA=new p2(288);for(f0=0;f0<144;++f0)dA[f0]=8;for(f0=144;f0<256;++f0)dA[f0]=9;for(f0=256;f0<280;++f0)dA[f0]=7;for(f0=280;f0<288;++f0)dA[f0]=8;var x7=new p2(32);for(f0=0;f0<32;++f0)x7[f0]=5;var $gt=fN(dA,9),Fgt=fN(x7,5),cTe=function(n){return(n/8>>0)+(7&n&&1)},lTe=function(n,e,t){(t==null||t>n.length)&&(t=n.length);var i=new(n instanceof Fv?Fv:n instanceof NC?NC:p2)(t-e);return i.set(n.subarray(e,t)),i},A5=function(n,e,t){t<<=7&e;var i=e/8>>0;n[i]|=t,n[i+1]|=t>>>8},mN=function(n,e,t){t<<=7&e;var i=e/8>>0;n[i]|=t,n[i+1]|=t>>>8,n[i+2]|=t>>>16},UZ=function(n,e){for(var t=[],i=0;i<n.length;++i)n[i]&&t.push({s:i,f:n[i]});var r=t.length,o=t.slice();if(!r)return[new p2(0),0];if(r==1){var s=new p2(t[0].s+1);return s[t[0].s]=1,[s,1]}t.sort((function(N,R){return N.f-R.f})),t.push({s:-1,f:25001});var a=t[0],c=t[1],l=0,u=1,d=2;for(t[0]={s:-1,f:a.f+c.f,l:a,r:c};u!=r-1;)a=t[t[l].f<t[d].f?l++:d++],c=t[l!=u&&t[l].f<t[d].f?l++:d++],t[u++]={s:-1,f:a.f+c.f,l:a,r:c};var h=o[0].s;for(i=1;i<r;++i)o[i].s>h&&(h=o[i].s);var f=new Fv(h+1),m=jZ(t[u-1],f,0);if(m>e){i=0;var y=0,g=m-e,b=1<<g;for(o.sort((function(N,R){return f[R.s]-f[N.s]||N.f-R.f}));i<r;++i){var v=o[i].s;if(!(f[v]>e))break;y+=b-(1<<m-f[v]),f[v]=e}for(y>>>=g;y>0;){var w=o[i].s;f[w]<e?y-=1<<e-f[w]++-1:++i}for(;i>=0&&y;--i){var T=o[i].s;f[T]==e&&(--f[T],++y)}m=e}return[new p2(f),m]},jZ=function(n,e,t){return n.s==-1?Math.max(jZ(n.l,e,t+1),jZ(n.r,e,t+1)):e[n.s]=t},uTe=function(n){for(var e=n.length;e&&!n[--e];);for(var t=new Fv(++e),i=0,r=n[0],o=1,s=function(c){t[i++]=c},a=1;a<=e;++a)if(n[a]==r&&a!=e)++o;else{if(!r&&o>2){for(;o>138;o-=138)s(32754);o>2&&(s(o>10?o-11<<5|28690:o-3<<5|12305),o=0)}else if(o>3){for(s(r),--o;o>6;o-=6)s(8304);o>2&&(s(o-3<<5|8208),o=0)}for(;o--;)s(r);o=1,r=n[a]}return[t.subarray(0,i),e]},_N=function(n,e){for(var t=0,i=0;i<e.length;++i)t+=n[i]*e[i];return t},HZ=function(n,e,t){var i=t.length,r=cTe(e+2);n[r]=255&i,n[r+1]=i>>>8,n[r+2]=255^n[r],n[r+3]=255^n[r+1];for(var o=0;o<i;++o)n[r+o+4]=t[o];return 8*(r+4+i)},dTe=function(n,e,t,i,r,o,s,a,c,l,u){A5(e,u++,t),++r[256];for(var d=UZ(r,15),h=d[0],f=d[1],m=UZ(o,15),y=m[0],g=m[1],b=uTe(h),v=b[0],w=b[1],T=uTe(y),N=T[0],R=T[1],P=new Fv(19),M=0;M<v.length;++M)P[31&v[M]]++;for(M=0;M<N.length;++M)P[31&N[M]]++;for(var I=UZ(P,7),A=I[0],U=I[1],k=19;k>4&&!A[iTe[k-1]];--k);var V,X,W,K,te=l+5<<3,se=_N(r,dA)+_N(o,x7)+s,de=_N(r,h)+_N(o,y)+s+14+3*k+_N(P,A)+(2*P[16]+3*P[17]+7*P[18]);if(te<=se&&te<=de)return HZ(e,u,n.subarray(c,c+l));if(A5(e,u,1+(de<se)),u+=2,de<se){V=fN(h,f),X=h,W=fN(y,g),K=y;var be=fN(A,U);for(A5(e,u,w-257),A5(e,u+5,R-1),A5(e,u+10,k-4),u+=14,M=0;M<k;++M)A5(e,u+3*M,A[iTe[M]]);u+=3*k;for(var re=[v,N],ue=0;ue<2;++ue){var he=re[ue];for(M=0;M<he.length;++M){var Ae=31&he[M];A5(e,u,be[Ae]),u+=A[Ae],Ae>15&&(A5(e,u,he[M]>>>5&127),u+=he[M]>>>12)}}}else V=$gt,X=dA,W=Fgt,K=x7;for(M=0;M<a;++M)if(i[M]>255){Ae=i[M]>>>18&31,mN(e,u,V[Ae+257]),u+=X[Ae+257],Ae>7&&(A5(e,u,i[M]>>>23&31),u+=$Z[Ae]);var Ne=31&i[M];mN(e,u,W[Ne]),u+=K[Ne],Ne>3&&(mN(e,u,i[M]>>>5&8191),u+=FZ[Ne])}else mN(e,u,V[i[M]]),u+=X[i[M]];return mN(e,u,V[256]),u+X[256]},Bgt=new NC([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),Ugt=(function(){for(var n=new NC(256),e=0;e<256;++e){for(var t=e,i=9;--i;)t=(1&t&&3988292384)^t>>>1;n[e]=t}return n})(),jgt=function(){var n=4294967295;return{p:function(e){for(var t=n,i=0;i<e.length;++i)t=Ugt[255&t^e[i]]^t>>>8;n=t},d:function(){return 4294967295^n}}},Hgt=function(n,e,t,i,r){return(function(o,s,a,c,l,u){var d=o.length,h=new p2(c+d+5*(1+Math.floor(d/7e3))+l),f=h.subarray(c,h.length-l),m=0;if(!s||d<8)for(var y=0;y<=d;y+=65535){var g=y+65535;g<d?m=HZ(f,m,o.subarray(y,g)):(f[y]=u,m=HZ(f,m,o.subarray(y,d)))}else{for(var b=Bgt[s-1],v=b>>>13,w=8191&b,T=(1<<a)-1,N=new Fv(32768),R=new Fv(T+1),P=Math.ceil(a/3),M=2*P,I=function(Ke){return(o[Ke]^o[Ke+1]<<P^o[Ke+2]<<M)&T},A=new NC(25e3),U=new Fv(288),k=new Fv(32),V=0,X=0,W=(y=0,0),K=0,te=0;y<d;++y){var se=I(y),de=32767&y,be=R[se];if(N[de]=be,R[se]=de,K<=y){var re=d-y;if((V>7e3||W>24576)&&re>423){m=dTe(o,f,0,A,U,k,X,W,te,y-te,m),W=V=X=0,te=y;for(var ue=0;ue<286;++ue)U[ue]=0;for(ue=0;ue<30;++ue)k[ue]=0}var he=2,Ae=0,Ne=w,De=de-be&32767;if(re>2&&se==I(y-De))for(var Ge=Math.min(v,re)-1,ke=Math.min(32767,y),ce=Math.min(258,re);De<=ke&&--Ne&&de!=be;){if(o[y+he]==o[y+he-De]){for(var we=0;we<ce&&o[y+we]==o[y+we-De];++we);if(we>he){if(he=we,Ae=De,we>Ge)break;var xe=Math.min(De,we-2),Ye=0;for(ue=0;ue<xe;++ue){var Je=y-De+ue+32768&32767,st=Je-N[Je]+32768&32767;st>Ye&&(Ye=st,be=Je)}}}De+=(de=be)-(be=N[de])+32768&32767}if(Ae){A[W++]=268435456|BZ[he]<<18|sTe[Ae];var Se=31&BZ[he],dt=31&sTe[Ae];X+=$Z[Se]+FZ[dt],++U[257+Se],++k[dt],K=y+he,++V}else A[W++]=o[y],++U[o[y]]}}m=dTe(o,f,u,A,U,k,X,W,te,y-te,m)}return lTe(h,0,c+cTe(m)+l)})(n,e.level==null?6:e.level,e.mem==null?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(n.length)))):12+e.mem,t,i,!0)},VZ=function(n,e,t){for(;t;++e)n[e]=t,t>>>=8},Vgt=function(n,e){var t=e.filename;if(n[0]=31,n[1]=139,n[2]=8,n[8]=e.level<2?4:e.level==9?2:0,n[9]=3,e.mtime!=0&&VZ(n,4,Math.floor(new Date(e.mtime||Date.now())/1e3)),t){n[3]=8;for(var i=0;i<=t.length;++i)n[i+10]=t.charCodeAt(i)}},Ggt=function(n){return 10+(n.filename&&n.filename.length+1||0)};function hTe(n,e){e===void 0&&(e={});var t=jgt(),i=n.length;t.p(n);var r=Hgt(n,e,Ggt(e),8),o=r.length;return Vgt(r,e),VZ(r,o-8,t.d()),VZ(r,o-4,i),r}function pTe(n,e){var t=n.length;if(typeof TextEncoder<"u")return new TextEncoder().encode(n);for(var i=new p2(n.length+(n.length>>>1)),r=0,o=function(l){i[r++]=l},s=0;s<t;++s){if(r+5>i.length){var a=new p2(r+8+(t-s<<1));a.set(i),i=a}var c=n.charCodeAt(s);c<128||e?o(c):c<2048?(o(192|c>>>6),o(128|63&c)):c>55295&&c<57344?(o(240|(c=65536+(1047552&c)|1023&n.charCodeAt(++s))>>>18),o(128|c>>>12&63),o(128|c>>>6&63),o(128|63&c)):(o(224|c>>>12),o(128|c>>>6&63),o(128|63&c))}return lTe(i,0,r)}function Ygt(n,e){return(function(t){for(var i=0,r=0;r<t.length;r++)i=(i<<5)-i+t.charCodeAt(r),i|=0;return Math.abs(i)})(n)%100<xw(100*e,0,100,Yr)}var C5="disabled",GZ="sampled",v7="active",hA="buffering",YZ="paused",qZ="trigger",nE=qZ+"_activated",Sx=qZ+"_pending",iE=qZ+"_"+C5;function fTe(n,e){return e.some((t=>t.matching==="regex"&&new RegExp(t.url).test(n)))}let mTe=class{constructor(e){this.It=e}triggerStatus(e){var t=this.It.map((i=>i.triggerStatus(e)));return t.includes(nE)?nE:t.includes(Sx)?Sx:iE}stop(){this.It.forEach((e=>e.stop()))}},_Te=class{constructor(e){this.It=e}triggerStatus(e){var t=new Set;for(var i of this.It)t.add(i.triggerStatus(e));switch(t.delete(iE),t.size){case 0:return iE;case 1:return Array.from(t)[0];default:return Sx}}stop(){this.It.forEach((e=>e.stop()))}},qgt=class{triggerStatus(){return Sx}stop(){}},Xgt=class{constructor(e){this.Rt=[],this.Pt=[],this.urlBlocked=!1,this._instance=e}onRemoteConfig(e){var t,i;this.Rt=((t=e.sessionRecording)==null?void 0:t.urlTriggers)||[],this.Pt=((i=e.sessionRecording)==null?void 0:i.urlBlocklist)||[]}Tt(e){var t;return this.Rt.length===0?iE:((t=this._instance)==null?void 0:t.get_property(fZ))===e?nE:Sx}triggerStatus(e){var t=this.Tt(e),i=t===nE?nE:t===Sx?Sx:iE;return this._instance.register_for_session({$sdk_debug_replay_url_trigger_status:i}),i}checkUrlTriggerConditions(e,t,i){if(qn!==void 0&&qn.location.href){var r=qn.location.href,o=this.urlBlocked,s=fTe(r,this.Pt);o&&s||(s&&!o?e():!s&&o&&t(),fTe(r,this.Rt)&&i("url"))}}stop(){}},Wgt=class{constructor(e){this.linkedFlag=null,this.linkedFlagSeen=!1,this.Ct=()=>{},this._instance=e}triggerStatus(){var e=Sx;return Oh(this.linkedFlag)&&(e=iE),this.linkedFlagSeen&&(e=nE),this._instance.register_for_session({$sdk_debug_replay_linked_flag_trigger_status:e}),e}onRemoteConfig(e,t){var i;if(this.linkedFlag=((i=e.sessionRecording)==null?void 0:i.linkedFlag)||null,!Oh(this.linkedFlag)&&!this.linkedFlagSeen){var r=ly(this.linkedFlag)?this.linkedFlag:this.linkedFlag.flag,o=ly(this.linkedFlag)?null:this.linkedFlag.variant;this.Ct=this._instance.onFeatureFlags(((s,a)=>{var c=!1;if(cy(a)&&r in a){var l=a[r];c=eE(l)?l===!0:o?l===o:!!l}this.linkedFlagSeen=c,c&&t(r,o)}))}}stop(){this.Ct()}},Zgt=class{constructor(e){this.Mt=[],this._instance=e}onRemoteConfig(e){var t;this.Mt=((t=e.sessionRecording)==null?void 0:t.eventTriggers)||[]}Ot(e){var t;return this.Mt.length===0?iE:((t=this._instance)==null?void 0:t.get_property(mZ))===e?nE:Sx}triggerStatus(e){var t=this.Ot(e),i=t===nE?nE:t===Sx?Sx:iE;return this._instance.register_for_session({$sdk_debug_replay_event_trigger_status:i}),i}stop(){}};function Kgt(n){return n.isRecordingEnabled?hA:C5}function Qgt(n){if(!n.receivedFlags)return hA;if(!n.isRecordingEnabled)return C5;if(n.urlTriggerMatching.urlBlocked)return YZ;var e=n.isSampled===!0,t=new mTe([n.eventTriggerMatching,n.urlTriggerMatching,n.linkedFlagMatching]).triggerStatus(n.sessionId);return e?GZ:t===nE?v7:t===Sx?hA:n.isSampled===!1?C5:v7}function Jgt(n){if(!n.receivedFlags)return hA;if(!n.isRecordingEnabled)return C5;if(n.urlTriggerMatching.urlBlocked)return YZ;var e=new _Te([n.eventTriggerMatching,n.urlTriggerMatching,n.linkedFlagMatching]).triggerStatus(n.sessionId),t=e!==iE,i=eE(n.isSampled);return t&&e===Sx?hA:t&&e===iE||i&&!n.isSampled?C5:n.isSampled===!0?GZ:v7}var yN="[SessionRecording]",sb=x1(yN);function w7(){var n;return Bs==null||(n=Bs.__PosthogExtensions__)==null||(n=n.rrweb)==null?void 0:n.record}var e1t=3e5,t1t=[tS.MouseMove,tS.MouseInteraction,tS.Scroll,tS.ViewportResize,tS.Input,tS.TouchMove,tS.MediaInteraction,tS.Drag],yTe=n=>({rrwebMethod:n,enqueuedAt:Date.now(),attempt:1});function pA(n){return(function(e,t){for(var i="",r=0;r<e.length;){var o=e[r++];i+=String.fromCharCode(o)}return i})(hTe(pTe(JSON.stringify(n))))}function gTe(n){return n.type===M5.Custom&&n.data.tag==="sessionIdle"}let bTe=class{get sessionId(){return this.Ft}get At(){return this._instance.config.session_recording.session_idle_threshold_ms||3e5}get started(){return this.Dt}get jt(){if(!this._instance.sessionManager)throw new Error(yN+" must be started with a valid sessionManager.");return this._instance.sessionManager}get Lt(){var e,t;return this.Nt.triggerStatus(this.sessionId)===Sx?6e4:(e=(t=this._instance.config.session_recording)==null?void 0:t.full_snapshot_interval_millis)!==null&&e!==void 0?e:e1t}get zt(){var e=this._instance.get_property(cN);return eE(e)?e:null}get Ut(){var e,t,i=(e=this.H)==null?void 0:e.data[((t=this.H)==null?void 0:t.data.length)-1],{sessionStartTimestamp:r}=this.jt.checkAndGetSessionAndWindowId(!0);return i?i.timestamp-r:null}get qt(){var e=!!this._instance.get_property(aN),t=!this._instance.config.disable_session_recording;return qn&&e&&t}get Bt(){var e=!!this._instance.get_property(x5e),t=this._instance.config.enable_recording_console_log;return t??e}get Ht(){var e,t,i,r,o,s,a=this._instance.config.session_recording.captureCanvas,c=this._instance.get_property(S5e),l=(e=(t=a?.recordCanvas)!==null&&t!==void 0?t:c?.enabled)!==null&&e!==void 0&&e,u=(i=(r=a?.canvasFps)!==null&&r!==void 0?r:c?.fps)!==null&&i!==void 0?i:4,d=(o=(s=a?.canvasQuality)!==null&&s!==void 0?s:c?.quality)!==null&&o!==void 0?o:.4;if(typeof d=="string"){var h=parseFloat(d);d=isNaN(h)?.4:h}return{enabled:l,fps:xw(u,0,12,sb.createLogger("canvas recording fps"),4),quality:xw(d,0,1,sb.createLogger("canvas recording quality"),.4)}}get Wt(){var e,t,i=this._instance.get_property(v5e),r={recordHeaders:(e=this._instance.config.session_recording)==null?void 0:e.recordHeaders,recordBody:(t=this._instance.config.session_recording)==null?void 0:t.recordBody},o=r?.recordHeaders||i?.recordHeaders,s=r?.recordBody||i?.recordBody,a=cy(this._instance.config.capture_performance)?this._instance.config.capture_performance.network_timing:this._instance.config.capture_performance,c=!!(eE(a)?a:i?.capturePerformance);return o||s||c?{recordHeaders:o,recordBody:s,recordPerformance:c}:void 0}get Gt(){var e,t,i,r,o,s,a=this._instance.get_property(w5e),c={maskAllInputs:(e=this._instance.config.session_recording)==null?void 0:e.maskAllInputs,maskTextSelector:(t=this._instance.config.session_recording)==null?void 0:t.maskTextSelector,blockSelector:(i=this._instance.config.session_recording)==null?void 0:i.blockSelector},l=(r=c?.maskAllInputs)!==null&&r!==void 0?r:a?.maskAllInputs,u=(o=c?.maskTextSelector)!==null&&o!==void 0?o:a?.maskTextSelector,d=(s=c?.blockSelector)!==null&&s!==void 0?s:a?.blockSelector;return br(l)&&br(u)&&br(d)?void 0:{maskAllInputs:l==null||l,maskTextSelector:u,blockSelector:d}}get Jt(){var e=this._instance.get_property(E5e);return wx(e)?e:null}get Vt(){var e=this._instance.get_property(T5e);return wx(e)?e:null}get status(){return this.Kt?this.Yt({receivedFlags:this.Kt,isRecordingEnabled:this.qt,isSampled:this.zt,urlTriggerMatching:this.Xt,eventTriggerMatching:this.Qt,linkedFlagMatching:this.Zt,sessionId:this.sessionId}):hA}constructor(e){if(this.Yt=Kgt,this.Kt=!1,this.ti=[],this.ii="unknown",this.ei=Date.now(),this.Nt=new qgt,this.ri=void 0,this.si=void 0,this.ni=void 0,this.oi=void 0,this.ai=void 0,this._forceAllowLocalhostNetworkCapture=!1,this.li=()=>{this.hi()},this.ui=()=>{this.di("browser offline",{})},this.vi=()=>{this.di("browser online",{})},this.ci=()=>{if(Kr!=null&&Kr.visibilityState){var r="window "+Kr.visibilityState;this.di(r,{})}},this._instance=e,this.Dt=!1,this.fi="/s/",this.pi=void 0,this.Kt=!1,!this._instance.sessionManager)throw sb.error("started without valid sessionManager"),new Error(yN+" started without valid sessionManager. This is a bug.");if(this._instance.config.cookieless_mode==="always")throw new Error(yN+' cannot be used with cookieless_mode="always"');this.Zt=new Wgt(this._instance),this.Xt=new Xgt(this._instance),this.Qt=new Zgt(this._instance);var{sessionId:t,windowId:i}=this.jt.checkAndGetSessionAndWindowId();this.Ft=t,this.gi=i,this.H=this.mi(),this.At>=this.jt.sessionTimeoutMs&&sb.warn("session_idle_threshold_ms ("+this.At+") is greater than the session timeout ("+this.jt.sessionTimeoutMs+"). Session will never be detected as idle")}startIfEnabledOrStop(e){this.qt?(this.bi(e),M_(qn,"beforeunload",this.li),M_(qn,"offline",this.ui),M_(qn,"online",this.vi),M_(qn,"visibilitychange",this.ci),this.yi(),this.wi(),Oh(this.ri)&&(this.ri=this._instance.on("eventCaptured",(t=>{try{if(t.event==="$pageview"){var i=t!=null&&t.properties.$current_url?this.Si(t?.properties.$current_url):"";if(!i)return;this.di("$pageview",{href:i})}}catch(r){sb.error("Could not add $pageview to rrweb session",r)}}))),this.si||(this.si=this.jt.onSessionId(((t,i,r)=>{var o,s;r&&(this.di("$session_id_change",{sessionId:t,windowId:i,changeReason:r}),(o=this._instance)==null||(o=o.persistence)==null||o.unregister(mZ),(s=this._instance)==null||(s=s.persistence)==null||s.unregister(fZ))})))):this.stopRecording()}stopRecording(){var e,t,i,r;this.Dt&&this.pi&&(this.pi(),this.pi=void 0,this.Dt=!1,qn?.removeEventListener("beforeunload",this.li),qn?.removeEventListener("offline",this.ui),qn?.removeEventListener("online",this.vi),qn?.removeEventListener("visibilitychange",this.ci),this.mi(),clearInterval(this.$i),(e=this.ri)==null||e.call(this),this.ri=void 0,(t=this.ai)==null||t.call(this),this.ai=void 0,(i=this.si)==null||i.call(this),this.si=void 0,(r=this.oi)==null||r.call(this),this.oi=void 0,this.Qt.stop(),this.Xt.stop(),this.Zt.stop(),sb.info("stopped"))}ki(){var e;(e=this._instance.persistence)==null||e.unregister(cN)}xi(e){var t,i=this.Ft!==e,r=this.Jt;if(wx(r)){var o=this.zt,s=i||!eE(o),a=s?Ygt(e,r):o;s&&(a?this.Ei(GZ):sb.warn("Sample rate ("+r+") has determined that this sessionId ("+e+") will not be sent to the server."),this.di("samplingDecisionMade",{sampleRate:r,isSampled:a})),(t=this._instance.persistence)==null||t.register({[cN]:a})}else this.ki()}onRemoteConfig(e){var t,i,r,o;this.di("$remote_config_received",e),this.Ii(e),(t=e.sessionRecording)!=null&&t.endpoint&&(this.fi=(o=e.sessionRecording)==null?void 0:o.endpoint),this.yi(),((i=e.sessionRecording)==null?void 0:i.triggerMatchType)==="any"?(this.Yt=Qgt,this.Nt=new mTe([this.Qt,this.Xt])):(this.Yt=Jgt,this.Nt=new _Te([this.Qt,this.Xt])),this._instance.register_for_session({$sdk_debug_replay_remote_trigger_matching_config:(r=e.sessionRecording)==null?void 0:r.triggerMatchType}),this.Xt.onRemoteConfig(e),this.Qt.onRemoteConfig(e),this.Zt.onRemoteConfig(e,((s,a)=>{this.Ei("linked_flag_matched",{flag:s,variant:a})})),this.Kt=!0,this.startIfEnabledOrStop()}yi(){wx(this.Jt)&&Oh(this.oi)&&(this.oi=this.jt.onSessionId((e=>{this.xi(e)})))}Ii(e){if(this._instance.persistence){var t,i=this._instance.persistence,r=()=>{var o,s,a,c,l,u,d,h,f,m=(o=e.sessionRecording)==null?void 0:o.sampleRate,y=Oh(m)?null:parseFloat(m);Oh(y)&&this.ki();var g=(s=e.sessionRecording)==null?void 0:s.minimumDurationMilliseconds;i.register({[aN]:!!e.sessionRecording,[x5e]:(a=e.sessionRecording)==null?void 0:a.consoleLogRecordingEnabled,[v5e]:Qr({capturePerformance:e.capturePerformance},(c=e.sessionRecording)==null?void 0:c.networkPayloadCapture),[w5e]:(l=e.sessionRecording)==null?void 0:l.masking,[S5e]:{enabled:(u=e.sessionRecording)==null?void 0:u.recordCanvas,fps:(d=e.sessionRecording)==null?void 0:d.canvasFps,quality:(h=e.sessionRecording)==null?void 0:h.canvasQuality},[E5e]:y,[T5e]:br(g)?null:g,[n7]:(f=e.sessionRecording)==null?void 0:f.scriptConfig})};r(),(t=this.ni)==null||t.call(this),this.ni=this.jt.onSessionId(r)}}log(e,t){var i;t===void 0&&(t="log"),(i=this._instance.sessionRecording)==null||i.onRRwebEmit({type:6,data:{plugin:"rrweb/console@1",payload:{level:t,trace:[],payload:[JSON.stringify(e)]}},timestamp:Date.now()})}bi(e){if(!br(Object.assign)&&!br(Array.from)&&!(this.Dt||this._instance.config.disable_session_recording||this._instance.consent.isOptedOut())){var t;this.Dt=!0,this.jt.checkAndGetSessionAndWindowId(),w7()?this.Ri():(t=Bs.__PosthogExtensions__)==null||t.loadExternalDependency==null||t.loadExternalDependency(this._instance,this.Pi,(i=>{if(i)return sb.error("could not load recorder",i);this.Ri()})),sb.info("starting"),this.status===v7&&this.Ei(e||"recording_initialized")}}get Pi(){var e;return((e=this._instance)==null||(e=e.persistence)==null||(e=e.get_property(n7))==null?void 0:e.script)||"recorder"}Ti(e){var t;return e.type===3&&t1t.indexOf((t=e.data)==null?void 0:t.source)!==-1}Ci(e){var t=this.Ti(e);t||this.ii||e.timestamp-this.ei>this.At&&(this.ii=!0,clearInterval(this.$i),this.di("sessionIdle",{eventTimestamp:e.timestamp,lastActivityTimestamp:this.ei,threshold:this.At,bufferLength:this.H.data.length,bufferSize:this.H.size}),this.hi());var i=!1;if(t&&(this.ei=e.timestamp,this.ii)){var r=this.ii==="unknown";this.ii=!1,r||(this.di("sessionNoLongerIdle",{reason:"user activity",type:e.type}),i=!0)}if(!this.ii){var{windowId:o,sessionId:s}=this.jt.checkAndGetSessionAndWindowId(!t,e.timestamp),a=this.Ft!==s,c=this.gi!==o;this.gi=o,this.Ft=s,a||c?(this.stopRecording(),this.startIfEnabledOrStop("session_id_changed")):i&&this.Mi()}}Oi(e){try{return e.rrwebMethod(),!0}catch(t){return this.ti.length<10?this.ti.push({enqueuedAt:e.enqueuedAt||Date.now(),attempt:e.attempt++,rrwebMethod:e.rrwebMethod}):sb.warn("could not emit queued rrweb event.",t,e),!1}}di(e,t){return this.Oi(yTe((()=>w7().addCustomEvent(e,t))))}Fi(){return this.Oi(yTe((()=>w7().takeFullSnapshot())))}Ri(){var e,t,i,r,o={blockClass:"ph-no-capture",blockSelector:void 0,ignoreClass:"ph-ignore-input",maskTextClass:"ph-mask",maskTextSelector:void 0,maskTextFn:void 0,maskAllInputs:!0,maskInputOptions:{password:!0},maskInputFn:void 0,slimDOMOptions:{},collectFonts:!1,inlineStylesheet:!0,recordCrossOriginIframes:!1},s=this._instance.config.session_recording;for(var[a,c]of Object.entries(s||{}))a in o&&(a==="maskInputOptions"?o.maskInputOptions=Qr({password:!0},c):o[a]=c);this.Ht&&this.Ht.enabled&&(o.recordCanvas=!0,o.sampling={canvas:this.Ht.fps},o.dataURLOptions={type:"image/webp",quality:this.Ht.quality}),this.Gt&&(o.maskAllInputs=(t=this.Gt.maskAllInputs)===null||t===void 0||t,o.maskTextSelector=(i=this.Gt.maskTextSelector)!==null&&i!==void 0?i:void 0,o.blockSelector=(r=this.Gt.blockSelector)!==null&&r!==void 0?r:void 0);var l=w7();if(l){this.Ai=(e=this.Ai)!==null&&e!==void 0?e:new Dgt(l,{refillRate:this._instance.config.session_recording.__mutationThrottlerRefillRate,bucketSize:this._instance.config.session_recording.__mutationThrottlerBucketSize,onBlockedNode:(d,h)=>{var f="Too many mutations on node '"+d+"'. Rate limiting. This could be due to SVG animations or something similar";sb.info(f,{node:h}),this.log(yN+" "+f,"warn")}});var u=this.Di();this.pi=l(Qr({emit:d=>{this.onRRwebEmit(d)},plugins:u},o)),this.ei=Date.now(),this.ii=eE(this.ii)?this.ii:"unknown",this.di("$session_options",{sessionRecordingOptions:o,activePlugins:u.map((d=>d?.name))}),this.di("$posthog_config",{config:this._instance.config})}else sb.error("onScriptLoaded was called but rrwebRecord is not available. This indicates something has gone wrong.")}Mi(){if(this.$i&&clearInterval(this.$i),this.ii!==!0){var e=this.Lt;e&&(this.$i=setInterval((()=>{this.Fi()}),e))}}Di(){var e,t,i=[],r=(e=Bs.__PosthogExtensions__)==null||(e=e.rrwebPlugins)==null?void 0:e.getRecordConsolePlugin;r&&this.Bt&&i.push(r());var o=(t=Bs.__PosthogExtensions__)==null||(t=t.rrwebPlugins)==null?void 0:t.getRecordNetworkPlugin;return this.Wt&&h2(o)&&(!egt.includes(location.hostname)||this._forceAllowLocalhostNetworkCapture?i.push(o(Lgt(this._instance.config,this.Wt))):sb.info("NetworkCapture not started because we are on localhost.")),i}onRRwebEmit(e){var t;if(this.ji(),e&&cy(e)){if(e.type===M5.Meta){var i=this.Si(e.data.href);if(this.Li=i,!i)return;e.data.href=i}else this.Ni();if(this.Xt.checkUrlTriggerConditions((()=>this.zi()),(()=>this.Ui()),(h=>this.qi(h))),!this.Xt.urlBlocked||(r=e).type===M5.Custom&&r.data.tag==="recording paused"){var r;e.type===M5.FullSnapshot&&this.Mi(),e.type===M5.FullSnapshot&&this.Kt&&this.Nt.triggerStatus(this.sessionId)===Sx&&this.mi();var o=this.Ai?this.Ai.throttleMutations(e):e;if(o){var s=(function(h){var f=h;if(f&&cy(f)&&f.type===6&&cy(f.data)&&f.data.plugin==="rrweb/console@1"){f.data.payload.payload.length>10&&(f.data.payload.payload=f.data.payload.payload.slice(0,10),f.data.payload.payload.push("...[truncated]"));for(var m=[],y=0;y<f.data.payload.payload.length;y++)f.data.payload.payload[y]&&f.data.payload.payload[y].length>2e3?m.push(f.data.payload.payload[y].slice(0,2e3)+"...[truncated]"):m.push(f.data.payload.payload[y]);return f.data.payload.payload=m,h}return h})(o);if(this.Ci(s),this.ii!==!0||gTe(s)){if(gTe(s)){var a=s.data.payload;if(a){var c=a.lastActivityTimestamp,l=a.threshold;s.timestamp=c+l}}var u=(t=this._instance.config.session_recording.compress_events)===null||t===void 0||t?(function(h){if(g7(h)<1024)return h;try{if(h.type===M5.FullSnapshot)return Qr({},h,{data:pA(h.data),cv:"2024-10"});if(h.type===M5.IncrementalSnapshot&&h.data.source===tS.Mutation)return Qr({},h,{cv:"2024-10",data:Qr({},h.data,{texts:pA(h.data.texts),attributes:pA(h.data.attributes),removes:pA(h.data.removes),adds:pA(h.data.adds)})});if(h.type===M5.IncrementalSnapshot&&h.data.source===tS.StyleSheetRule)return Qr({},h,{cv:"2024-10",data:Qr({},h.data,{adds:h.data.adds?pA(h.data.adds):void 0,removes:h.data.removes?pA(h.data.removes):void 0})})}catch(f){sb.error("could not compress event - will use uncompressed event",f)}return h})(s):s,d={$snapshot_bytes:g7(u),$snapshot_data:u,$session_id:this.Ft,$window_id:this.gi};this.status!==C5?this.Bi(d):this.mi()}}}}}Ni(){if(!this._instance.config.capture_pageview&&qn){var e=this.Si(qn.location.href);this.Li!==e&&(this.di("$url_changed",{href:e}),this.Li=e)}}ji(){if(this.ti.length){var e=[...this.ti];this.ti=[],e.forEach((t=>{Date.now()-t.enqueuedAt<=2e3&&this.Oi(t)}))}}Si(e){var t=this._instance.config.session_recording;if(t.maskNetworkRequestFn){var i,r={url:e};return(i=r=t.maskNetworkRequestFn(r))==null?void 0:i.url}return e}mi(){return this.H={size:0,data:[],sessionId:this.Ft,windowId:this.gi},this.H}hi(){this.Hi&&(clearTimeout(this.Hi),this.Hi=void 0);var e=this.Vt,t=this.Ut,i=wx(t)&&t>=0,r=wx(e)&&i&&t<e;return this.status===hA||this.status===YZ||this.status===C5||r?(this.Hi=setTimeout((()=>{this.hi()}),2e3),this.H):(this.H.data.length>0&&LZ(this.H).forEach((o=>{this.Wi({$snapshot_bytes:o.size,$snapshot_data:o.data,$session_id:o.sessionId,$window_id:o.windowId,$lib:"web",$lib_version:w5.LIB_VERSION})})),this.mi())}Bi(e){var t,i=2+(((t=this.H)==null?void 0:t.data.length)||0);!this.ii&&(this.H.size+e.$snapshot_bytes+i>943718.4||this.H.sessionId!==this.Ft)&&(this.H=this.hi()),this.H.size+=e.$snapshot_bytes,this.H.data.push(e.$snapshot_data),this.Hi||this.ii||(this.Hi=setTimeout((()=>{this.hi()}),2e3))}Wi(e){this._instance.capture("$snapshot",e,{_url:this._instance.requestRouter.endpointFor("api",this.fi),_noTruncate:!0,_batchKey:"recordings",skip_client_rate_limiting:!0})}qi(e){var t;this.Nt.triggerStatus(this.sessionId)===Sx&&((t=this._instance)==null||(t=t.persistence)==null||t.register({[e==="url"?fZ:mZ]:this.Ft}),this.hi(),this.Ei(e+"_trigger_matched"))}zi(){this.Xt.urlBlocked||(this.Xt.urlBlocked=!0,clearInterval(this.$i),sb.info("recording paused due to URL blocker"),this.di("recording paused",{reason:"url blocker"}))}Ui(){this.Xt.urlBlocked&&(this.Xt.urlBlocked=!1,this.Fi(),this.Mi(),this.di("recording resumed",{reason:"left blocked url"}),sb.info("recording resumed"))}wi(){this.Qt.Mt.length!==0&&Oh(this.ai)&&(this.ai=this._instance.on("eventCaptured",(e=>{try{this.Qt.Mt.includes(e.event)&&this.qi("event")}catch(t){sb.error("Could not activate event trigger",t)}})))}overrideLinkedFlag(){this.Zt.linkedFlagSeen=!0,this.Fi(),this.Ei("linked_flag_overridden")}overrideSampling(){var e;(e=this._instance.persistence)==null||e.register({[cN]:!0}),this.Fi(),this.Ei("sampling_overridden")}overrideTrigger(e){this.qi(e)}Ei(e,t){this._instance.register_for_session({$session_recording_start_reason:e}),sb.info(e.replace("_"," "),t),Fl(["recording_initialized","session_id_changed"],e)||this.di(e,t)}get sdkDebugProperties(){var{sessionStartTimestamp:e}=this.jt.checkAndGetSessionAndWindowId(!0);return{$recording_status:this.status,$sdk_debug_replay_internal_buffer_length:this.H.data.length,$sdk_debug_replay_internal_buffer_size:this.H.size,$sdk_debug_current_session_duration:this.Ut,$sdk_debug_session_start:e}}};var XZ=x1("[SegmentIntegration]");function n1t(n,e){var t=n.config.segment;if(!t)return e();(function(i,r){var o=i.config.segment;if(!o)return r();var s=c=>{var l=()=>c.anonymousId()||s3();i.config.get_device_id=l,c.id()&&(i.register({distinct_id:c.id(),$device_id:l()}),i.persistence.set_property(S5,"identified")),r()},a=o.user();"then"in a&&h2(a.then)?a.then((c=>s(c))):s(a)})(n,(()=>{t.register((i=>{Promise&&Promise.resolve||XZ.warn("This browser does not have Promise support, and can not use the segment integration");var r=(o,s)=>{if(!s)return o;o.event.userId||o.event.anonymousId===i.get_distinct_id()||(XZ.info("No userId set, resetting PostHog"),i.reset()),o.event.userId&&o.event.userId!==i.get_distinct_id()&&(XZ.info("UserId set, identifying with PostHog"),i.identify(o.event.userId));var a=i.calculateEventProperties(s,o.event.properties);return o.event.properties=Object.assign({},a,o.event.properties),o};return{name:"PostHog JS",type:"enrichment",version:"1.0.0",isLoaded:()=>!0,load:()=>Promise.resolve(),track:o=>r(o,o.event.event),page:o=>r(o,"$pageview"),identify:o=>r(o,"$identify"),screen:o=>r(o,"$screen")}})(n)).then((()=>{e()}))}))}var xTe="posthog-js";function vTe(n,e){var{organization:t,projectId:i,prefix:r,severityAllowList:o=["error"]}=e===void 0?{}:e;return s=>{var a,c,l,u,d;if(!(o==="*"||o.includes(s.level))||!n.__loaded)return s;s.tags||(s.tags={});var h=n.requestRouter.endpointFor("ui","/project/"+n.config.token+"/person/"+n.get_distinct_id());s.tags["PostHog Person URL"]=h,n.sessionRecordingStarted()&&(s.tags["PostHog Recording URL"]=n.get_session_replay_url({withTimestamp:!0}));var f=((a=s.exception)==null?void 0:a.values)||[],m=f.map((g=>Qr({},g,{stacktrace:g.stacktrace?Qr({},g.stacktrace,{type:"raw",frames:(g.stacktrace.frames||[]).map((b=>Qr({},b,{platform:"web:javascript"})))}):void 0}))),y={$exception_message:((c=f[0])==null?void 0:c.value)||s.message,$exception_type:(l=f[0])==null?void 0:l.type,$exception_personURL:h,$exception_level:s.level,$exception_list:m,$sentry_event_id:s.event_id,$sentry_exception:s.exception,$sentry_exception_message:((u=f[0])==null?void 0:u.value)||s.message,$sentry_exception_type:(d=f[0])==null?void 0:d.type,$sentry_tags:s.tags};return t&&i&&(y.$sentry_url=(r||"https://sentry.io/organizations/")+t+"/issues/?project="+i+"&query="+s.event_id),n.exceptions.sendExceptionEvent(y),s}}let i1t=class{constructor(e,t,i,r,o){this.name=xTe,this.setupOnce=function(s){s(vTe(e,{organization:t,projectId:i,prefix:r,severityAllowList:o}))}}};var r1t=qn!=null&&qn.location?h7(qn.location.hash,"__posthog")||h7(location.hash,"state"):null,wTe="_postHogToolbarParams",STe=x1("[Toolbar]"),a3=(function(n){return n[n.UNINITIALIZED=0]="UNINITIALIZED",n[n.LOADING=1]="LOADING",n[n.LOADED=2]="LOADED",n})(a3||{});let o1t=class{constructor(e){this.instance=e}Gi(e){Bs.ph_toolbar_state=e}Ji(){var e;return(e=Bs.ph_toolbar_state)!==null&&e!==void 0?e:a3.UNINITIALIZED}maybeLoadToolbar(e,t,i){if(e===void 0&&(e=void 0),t===void 0&&(t=void 0),i===void 0&&(i=void 0),!qn||!Kr)return!1;e=e??qn.location,i=i??qn.history;try{if(!t){try{qn.localStorage.setItem("test","test"),qn.localStorage.removeItem("test")}catch{return!1}t=qn?.localStorage}var r,o=r1t||h7(e.hash,"__posthog")||h7(e.hash,"state"),s=o?d5e((()=>JSON.parse(atob(decodeURIComponent(o)))))||d5e((()=>JSON.parse(decodeURIComponent(o)))):null;return s&&s.action==="ph_authorize"?((r=s).source="url",r&&Object.keys(r).length>0&&(s.desiredHash?e.hash=s.desiredHash:i?i.replaceState(i.state,"",e.pathname+e.search):e.hash="")):((r=JSON.parse(t.getItem(wTe)||"{}")).source="localstorage",delete r.userIntent),!(!r.token||this.instance.config.token!==r.token)&&(this.loadToolbar(r),!0)}catch{return!1}}Vi(e){var t=Bs.ph_load_toolbar||Bs.ph_load_editor;!Oh(t)&&h2(t)?t(e,this.instance):STe.warn("No toolbar load function found")}loadToolbar(e){var t=!(Kr==null||!Kr.getElementById(M5e));if(!qn||t)return!1;var i=this.instance.requestRouter.region==="custom"&&this.instance.config.advanced_disable_toolbar_metrics,r=Qr({token:this.instance.config.token},e,{apiURL:this.instance.requestRouter.endpointFor("ui")},i?{instrument:!1}:{});if(qn.localStorage.setItem(wTe,JSON.stringify(Qr({},r,{source:void 0}))),this.Ji()===a3.LOADED)this.Vi(r);else if(this.Ji()===a3.UNINITIALIZED){var o;this.Gi(a3.LOADING),(o=Bs.__PosthogExtensions__)==null||o.loadExternalDependency==null||o.loadExternalDependency(this.instance,"toolbar",(s=>{if(s)return STe.error("[Toolbar] Failed to load",s),void this.Gi(a3.UNINITIALIZED);this.Gi(a3.LOADED),this.Vi(r)})),M_(qn,"turbolinks:load",(()=>{this.Gi(a3.UNINITIALIZED),this.loadToolbar(r)}))}return!0}Ki(e){return this.loadToolbar(e)}maybeLoadEditor(e,t,i){return e===void 0&&(e=void 0),t===void 0&&(t=void 0),i===void 0&&(i=void 0),this.maybeLoadToolbar(e,t,i)}};var s1t=x1("[TracingHeaders]");let a1t=class{constructor(e){this.Yi=void 0,this.Xi=void 0,this.lt=()=>{var t,i;br(this.Yi)&&((t=Bs.__PosthogExtensions__)==null||(t=t.tracingHeadersPatchFns)==null||t._patchXHR(this._instance.config.__add_tracing_headers||[],this._instance.get_distinct_id(),this._instance.sessionManager)),br(this.Xi)&&((i=Bs.__PosthogExtensions__)==null||(i=i.tracingHeadersPatchFns)==null||i._patchFetch(this._instance.config.__add_tracing_headers||[],this._instance.get_distinct_id(),this._instance.sessionManager))},this._instance=e}nt(e){var t,i;(t=Bs.__PosthogExtensions__)!=null&&t.tracingHeadersPatchFns&&e(),(i=Bs.__PosthogExtensions__)==null||i.loadExternalDependency==null||i.loadExternalDependency(this._instance,"tracing-headers",(r=>{if(r)return s1t.error("failed to load script",r);e()}))}startIfEnabledOrStop(){var e,t;this._instance.config.__add_tracing_headers?this.nt(this.lt):((e=this.Yi)==null||e.call(this),(t=this.Xi)==null||t.call(this),this.Yi=void 0,this.Xi=void 0)}};var c3=x1("[Web Vitals]"),ETe=9e5;let c1t=class{constructor(e){var t;this.Qi=!1,this.C=!1,this.H={url:void 0,metrics:[],firstMetricTimestamp:void 0},this.Zi=()=>{clearTimeout(this.te),this.H.metrics.length!==0&&(this._instance.capture("$web_vitals",this.H.metrics.reduce(((i,r)=>Qr({},i,{["$web_vitals_"+r.name+"_event"]:Qr({},r),["$web_vitals_"+r.name+"_value"]:r.value})),{})),this.H={url:void 0,metrics:[],firstMetricTimestamp:void 0})},this.ie=i=>{var r,o=(r=this._instance.sessionManager)==null?void 0:r.checkAndGetSessionAndWindowId(!0);if(br(o))c3.error("Could not read session ID. Dropping metrics!");else{this.H=this.H||{url:void 0,metrics:[],firstMetricTimestamp:void 0};var s=this.ee();br(s)||(Oh(i?.name)||Oh(i?.value)?c3.error("Invalid metric received",i):this.re&&i.value>=this.re?c3.error("Ignoring metric with value >= "+this.re,i):(this.H.url!==s&&(this.Zi(),this.te=setTimeout(this.Zi,this.flushToCaptureTimeoutMs)),br(this.H.url)&&(this.H.url=s),this.H.firstMetricTimestamp=br(this.H.firstMetricTimestamp)?Date.now():this.H.firstMetricTimestamp,i.attribution&&i.attribution.interactionTargetElement&&(i.attribution.interactionTargetElement=void 0),this.H.metrics.push(Qr({},i,{$current_url:s,$session_id:o.sessionId,$window_id:o.windowId,timestamp:Date.now()})),this.H.metrics.length===this.allowedMetrics.length&&this.Zi()))}},this.lt=()=>{var i,r,o,s,a=Bs.__PosthogExtensions__;br(a)||br(a.postHogWebVitalsCallbacks)||({onLCP:i,onCLS:r,onFCP:o,onINP:s}=a.postHogWebVitalsCallbacks),i&&r&&o&&s?(this.allowedMetrics.indexOf("LCP")>-1&&i(this.ie.bind(this)),this.allowedMetrics.indexOf("CLS")>-1&&r(this.ie.bind(this)),this.allowedMetrics.indexOf("FCP")>-1&&o(this.ie.bind(this)),this.allowedMetrics.indexOf("INP")>-1&&s(this.ie.bind(this)),this.C=!0):c3.error("web vitals callbacks not loaded - not starting")},this._instance=e,this.Qi=!((t=this._instance.persistence)==null||!t.props[y5e]),this.startIfEnabled()}get allowedMetrics(){var e,t,i=cy(this._instance.config.capture_performance)?(e=this._instance.config.capture_performance)==null?void 0:e.web_vitals_allowed_metrics:void 0;return br(i)?((t=this._instance.persistence)==null?void 0:t.props[b5e])||["CLS","FCP","INP","LCP"]:i}get flushToCaptureTimeoutMs(){return(cy(this._instance.config.capture_performance)?this._instance.config.capture_performance.web_vitals_delayed_flush_ms:void 0)||5e3}get re(){var e=cy(this._instance.config.capture_performance)&&wx(this._instance.config.capture_performance.__web_vitals_max_value)?this._instance.config.capture_performance.__web_vitals_max_value:ETe;return 0<e&&e<=6e4?ETe:e}get isEnabled(){var e=zv?.protocol;if(e!=="http:"&&e!=="https:")return c3.info("Web Vitals are disabled on non-http/https protocols"),!1;var t=cy(this._instance.config.capture_performance)?this._instance.config.capture_performance.web_vitals:eE(this._instance.config.capture_performance)?this._instance.config.capture_performance:void 0;return eE(t)?t:this.Qi}startIfEnabled(){this.isEnabled&&!this.C&&(c3.info("enabled, starting..."),this.nt(this.lt))}onRemoteConfig(e){var t=cy(e.capturePerformance)&&!!e.capturePerformance.web_vitals,i=cy(e.capturePerformance)?e.capturePerformance.web_vitals_allowed_metrics:void 0;this._instance.persistence&&(this._instance.persistence.register({[y5e]:t}),this._instance.persistence.register({[b5e]:i})),this.Qi=t,this.startIfEnabled()}nt(e){var t,i;(t=Bs.__PosthogExtensions__)!=null&&t.postHogWebVitalsCallbacks&&e(),(i=Bs.__PosthogExtensions__)==null||i.loadExternalDependency==null||i.loadExternalDependency(this._instance,"web-vitals",(r=>{r?c3.error("failed to load script",r):e()}))}ee(){var e=qn?qn.location.href:void 0;return e||c3.error("Could not determine current URL"),e}};var l1t=x1("[Heatmaps]");function TTe(n){return cy(n)&&"clientX"in n&&"clientY"in n&&wx(n.clientX)&&wx(n.clientY)}let u1t=class{constructor(e){var t;this.rageclicks=new B5e,this.Qi=!1,this.C=!1,this.se=null,this.instance=e,this.Qi=!((t=this.instance.persistence)==null||!t.props[hZ])}get flushIntervalMilliseconds(){var e=5e3;return cy(this.instance.config.capture_heatmaps)&&this.instance.config.capture_heatmaps.flush_interval_milliseconds&&(e=this.instance.config.capture_heatmaps.flush_interval_milliseconds),e}get isEnabled(){return br(this.instance.config.capture_heatmaps)?br(this.instance.config.enable_heatmaps)?this.Qi:this.instance.config.enable_heatmaps:this.instance.config.capture_heatmaps!==!1}startIfEnabled(){if(this.isEnabled){if(this.C)return;l1t.info("starting..."),this.ne(),this.se=setInterval(this.oe.bind(this),this.flushIntervalMilliseconds)}else{var e,t;clearInterval((e=this.se)!==null&&e!==void 0?e:void 0),(t=this.ae)==null||t.stop(),this.getAndClearBuffer()}}onRemoteConfig(e){var t=!!e.heatmaps;this.instance.persistence&&this.instance.persistence.register({[hZ]:t}),this.Qi=t,this.startIfEnabled()}getAndClearBuffer(){var e=this.H;return this.H=void 0,e}le(e){this.he(e.originalEvent,"deadclick")}ne(){qn&&Kr&&(M_(qn,"beforeunload",this.oe.bind(this)),M_(Kr,"click",(e=>this.he(e||qn?.event)),{capture:!0}),M_(Kr,"mousemove",(e=>this.ue(e||qn?.event)),{capture:!0}),this.ae=new G5e(this.instance,mgt,this.le.bind(this)),this.ae.startIfEnabled(),this.C=!0)}de(e,t){var i=this.instance.scrollManager.scrollY(),r=this.instance.scrollManager.scrollX(),o=this.instance.scrollManager.scrollElement(),s=(function(a,c,l){for(var u=a;u&&c7(u)&&!o3(u,"body");){if(u===l)return!1;if(Fl(c,qn?.getComputedStyle(u).position))return!0;u=k5e(u)}return!1})(N5e(e),["fixed","sticky"],o);return{x:e.clientX+(s?0:r),y:e.clientY+(s?0:i),target_fixed:s,type:t}}he(e,t){var i;if(t===void 0&&(t="click"),!A5e(e.target)&&TTe(e)){var r=this.de(e,t);(i=this.rageclicks)!=null&&i.isRageClick(e.clientX,e.clientY,new Date().getTime())&&this.ve(Qr({},r,{type:"rageclick"})),this.ve(r)}}ue(e){!A5e(e.target)&&TTe(e)&&(clearTimeout(this.ce),this.ce=setTimeout((()=>{this.ve(this.de(e,"mousemove"))}),500))}ve(e){if(qn){var t=qn.location.href;this.H=this.H||{},this.H[t]||(this.H[t]=[]),this.H[t].push(e)}}oe(){this.H&&!AC(this.H)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}},d1t=class{constructor(e){this._instance=e}doPageView(e,t){var i,r=this.fe(e,t);return this.pe={pathname:(i=qn?.location.pathname)!==null&&i!==void 0?i:"",pageViewId:t,timestamp:e},this._instance.scrollManager.resetContext(),r}doPageLeave(e){var t;return this.fe(e,(t=this.pe)==null?void 0:t.pageViewId)}doEvent(){var e;return{$pageview_id:(e=this.pe)==null?void 0:e.pageViewId}}fe(e,t){var i=this.pe;if(!i)return{$pageview_id:t};var r={$pageview_id:t,$prev_pageview_id:i.pageViewId},o=this._instance.scrollManager.getContext();if(o&&!this._instance.config.disable_scroll_properties){var{maxScrollHeight:s,lastScrollY:a,maxScrollY:c,maxContentHeight:l,lastContentY:u,maxContentY:d}=o;if(!(br(s)||br(a)||br(c)||br(l)||br(u)||br(d))){s=Math.ceil(s),a=Math.ceil(a),c=Math.ceil(c),l=Math.ceil(l),u=Math.ceil(u),d=Math.ceil(d);var h=s<=1?1:xw(a/s,0,1,Yr),f=s<=1?1:xw(c/s,0,1,Yr),m=l<=1?1:xw(u/l,0,1,Yr),y=l<=1?1:xw(d/l,0,1,Yr);r=qy(r,{$prev_pageview_last_scroll:a,$prev_pageview_last_scroll_percentage:h,$prev_pageview_max_scroll:c,$prev_pageview_max_scroll_percentage:f,$prev_pageview_last_content:u,$prev_pageview_last_content_percentage:m,$prev_pageview_max_content:d,$prev_pageview_max_content_percentage:y})}}return i.pathname&&(r.$prev_pageview_pathname=i.pathname),i.timestamp&&(r.$prev_pageview_duration=(e.getTime()-i.timestamp.getTime())/1e3),r}};var h1t=function(n){var e,t,i,r,o="";for(e=t=0,i=(n=(n+"").replace(/\r\n/g,`
|
|
321
321
|
`).replace(/\r/g,`
|
|
322
|
-
`)).length,r=0;r<i;r++){var s=n.charCodeAt(r),a=null;s<128?t++:a=s>127&&s<2048?String.fromCharCode(s>>6|192,63&s|128):String.fromCharCode(s>>12|224,s>>6&63|128,63&s|128),i3(a)||(t>e&&(o+=n.substring(e,t)),o+=a,e=t=r+1)}return t>e&&(o+=n.substring(e,n.length)),o},p1t=!!aZ||!!sZ,MTe="text/plain",S7=(n,e)=>{var[t,i]=n.split("?"),r=Qr({},e);i?.split("&").forEach((s=>{var[a]=s.split("=");delete r[a]}));var o=tgt(r);return t+"?"+(o=o?(i?i+"&":"")+o:i)},gN=(n,e)=>JSON.stringify(n,((t,i)=>typeof i=="bigint"?i.toString():i),e),WZ=n=>{var{data:e,compression:t}=n;if(e){if(t===E5.GZipJS){var i=hTe(pTe(gN(e)),{mtime:0}),r=new Blob([i],{type:MTe});return{contentType:MTe,body:r,estimatedSize:r.size}}if(t===E5.Base64){var o=(function(c){var l,u,d,h,f,m="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",y=0,g=0,b="",v=[];if(!c)return c;c=h1t(c);do l=(f=c.charCodeAt(y++)<<16|c.charCodeAt(y++)<<8|c.charCodeAt(y++))>>18&63,u=f>>12&63,d=f>>6&63,h=63&f,v[g++]=m.charAt(l)+m.charAt(u)+m.charAt(d)+m.charAt(h);while(y<c.length);switch(b=v.join(""),c.length%3){case 1:b=b.slice(0,-2)+"==";break;case 2:b=b.slice(0,-1)+"="}return b})(gN(e)),s=(c=>"data="+encodeURIComponent(typeof c=="string"?c:gN(c)))(o);return{contentType:"application/x-www-form-urlencoded",body:s,estimatedSize:new Blob([s]).size}}var a=gN(e);return{contentType:"application/json",body:a,estimatedSize:new Blob([a]).size}}},bN=[];sZ&&bN.push({transport:"fetch",method:n=>{var e,t,{contentType:i,body:r,estimatedSize:o}=(e=WZ(n))!==null&&e!==void 0?e:{},s=new Headers;vf(n.headers,(function(u,d){s.append(d,u)})),i&&s.append("Content-Type",i);var a=n.url,c=null;if(r5e){var l=new r5e;c={signal:l.signal,timeout:setTimeout((()=>l.abort()),n.timeout)}}sZ(a,Qr({method:n?.method||"GET",headers:s,keepalive:n.method==="POST"&&(o||0)<52428.8,body:r,signal:(t=c)==null?void 0:t.signal},n.fetchOptions)).then((u=>u.text().then((d=>{var h={statusCode:u.status,text:d};if(u.status===200)try{h.json=JSON.parse(d)}catch(f){Yr.error(f)}n.callback==null||n.callback(h)})))).catch((u=>{Yr.error(u),n.callback==null||n.callback({statusCode:0,text:u})})).finally((()=>c?clearTimeout(c.timeout):null))}}),aZ&&bN.push({transport:"XHR",method:n=>{var e,t=new aZ;t.open(n.method||"GET",n.url,!0);var{contentType:i,body:r}=(e=WZ(n))!==null&&e!==void 0?e:{};vf(n.headers,(function(o,s){t.setRequestHeader(s,o)})),i&&t.setRequestHeader("Content-Type",i),n.timeout&&(t.timeout=n.timeout),t.withCredentials=!0,t.onreadystatechange=()=>{if(t.readyState===4){var o={statusCode:t.status,text:t.responseText};if(t.status===200)try{o.json=JSON.parse(t.responseText)}catch{}n.callback==null||n.callback(o)}},t.send(r)}}),bw!=null&&bw.sendBeacon&&bN.push({transport:"sendBeacon",method:n=>{var e=S7(n.url,{beacon:"1"});try{var t,{contentType:i,body:r}=(t=WZ(n))!==null&&t!==void 0?t:{},o=typeof r=="string"?new Blob([r],{type:i}):r;bw.sendBeacon(e,o)}catch{}}});var kC=function(n,e){if(!(function(t){try{new RegExp(t)}catch{return!1}return!0})(e))return!1;try{return new RegExp(e).test(n)}catch{return!1}};function ATe(n,e,t){return gN({distinct_id:n,userPropertiesToSet:e,userPropertiesToSetOnce:t})}var f1t={exact:(n,e)=>e.some((t=>n.some((i=>t===i)))),is_not:(n,e)=>e.every((t=>n.every((i=>t!==i)))),regex:(n,e)=>e.some((t=>n.some((i=>kC(t,i))))),not_regex:(n,e)=>e.every((t=>n.every((i=>!kC(t,i))))),icontains:(n,e)=>e.map(E7).some((t=>n.map(E7).some((i=>t.includes(i))))),not_icontains:(n,e)=>e.map(E7).every((t=>n.map(E7).every((i=>!t.includes(i)))))},E7=n=>n.toLowerCase(),CTe=x1("[Error tracking]");let m1t=class{constructor(e){var t,i;this.ge=[],this._instance=e,this.ge=(t=(i=this._instance.persistence)==null?void 0:i.get_property(pZ))!==null&&t!==void 0?t:[]}onRemoteConfig(e){var t,i,r,o=(t=(i=e.errorTracking)==null?void 0:i.suppressionRules)!==null&&t!==void 0?t:[],s=(r=e.errorTracking)==null?void 0:r.captureExtensionExceptions;this.ge=o,this._instance.persistence&&this._instance.persistence.register({[pZ]:this.ge,[_5e]:s})}get _e(){var e,t=!!this._instance.get_property(_5e),i=this._instance.config.error_tracking.captureExtensionExceptions;return(e=i??t)!==null&&e!==void 0&&e}sendExceptionEvent(e){if(this.me(e))CTe.info("Skipping exception capture because a suppression rule matched");else{if(this._e||!this.be(e))return this._instance.capture("$exception",e,{_noTruncate:!0,_batchKey:"exceptionEvent"});CTe.info("Skipping exception capture because it was thrown by an extension")}}me(e){var t=e.$exception_list;if(!t||!p0(t)||t.length===0)return!1;var i=t.reduce(((r,o)=>{var{type:s,value:a}=o;return ly(s)&&s.length>0&&r.$exception_types.push(s),ly(a)&&a.length>0&&r.$exception_values.push(a),r}),{$exception_types:[],$exception_values:[]});return this.ge.some((r=>{var o=r.values.map((s=>{var a,c=f1t[s.operator],l=p0(s.value)?s.value:[s.value],u=(a=i[s.key])!==null&&a!==void 0?a:[];return l.length>0&&c(l,u)}));return r.type==="OR"?o.some(Boolean):o.every(Boolean)}))}be(e){var t=e.$exception_list;return!(!t||!p0(t))&&t.flatMap((i=>{var r,o;return(r=(o=i.stacktrace)==null?void 0:o.frames)!==null&&r!==void 0?r:[]})).some((i=>i.filename&&i.filename.startsWith("chrome-extension://")))}};var f2="Mobile",T7="iOS",rE="Android",xN="Tablet",RTe=rE+" "+xN,PTe="iPad",ITe="Apple",NTe=ITe+" Watch",vN="Safari",OC="BlackBerry",kTe="Samsung",OTe=kTe+"Browser",LTe=kTe+" Internet",fA="Chrome",_1t=fA+" OS",DTe=fA+" "+T7,ZZ="Internet Explorer",zTe=ZZ+" "+f2,KZ="Opera",y1t=KZ+" Mini",QZ="Edge",$Te="Microsoft "+QZ,LC="Firefox",FTe=LC+" "+T7,wN="Nintendo",SN="PlayStation",DC="Xbox",BTe=rE+" "+f2,UTe=f2+" "+vN,EN="Windows",JZ=EN+" Phone",jTe="Nokia",eK="Ouya",HTe="Generic",g1t=HTe+" "+f2.toLowerCase(),VTe=HTe+" "+xN.toLowerCase(),tK="Konqueror",rv="(\\d+(\\.\\d+)?)",nK=new RegExp("Version/"+rv),b1t=new RegExp(DC,"i"),x1t=new RegExp(SN+" \\w+","i"),v1t=new RegExp(wN+" \\w+","i"),iK=new RegExp(OC+"|PlayBook|BB10","i"),w1t={"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"},S1t=(n,e)=>e&&Fl(e,ITe)||(function(t){return Fl(t,vN)&&!Fl(t,fA)&&!Fl(t,rE)})(n),GTe=function(n,e){return e=e||"",Fl(n," OPR/")&&Fl(n,"Mini")?y1t:Fl(n," OPR/")?KZ:iK.test(n)?OC:Fl(n,"IE"+f2)||Fl(n,"WPDesktop")?zTe:Fl(n,OTe)?LTe:Fl(n,QZ)||Fl(n,"Edg/")?$Te:Fl(n,"FBIOS")?"Facebook "+f2:Fl(n,"UCWEB")||Fl(n,"UCBrowser")?"UC Browser":Fl(n,"CriOS")?DTe:Fl(n,"CrMo")||Fl(n,fA)?fA:Fl(n,rE)&&Fl(n,vN)?BTe:Fl(n,"FxiOS")?FTe:Fl(n.toLowerCase(),tK.toLowerCase())?tK:S1t(n,e)?Fl(n,f2)?UTe:vN:Fl(n,LC)?LC:Fl(n,"MSIE")||Fl(n,"Trident/")?ZZ:Fl(n,"Gecko")?LC:""},E1t={[zTe]:[new RegExp("rv:"+rv)],[$Te]:[new RegExp(QZ+"?\\/"+rv)],[fA]:[new RegExp("("+fA+"|CrMo)\\/"+rv)],[DTe]:[new RegExp("CriOS\\/"+rv)],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/"+rv)],[vN]:[nK],[UTe]:[nK],[KZ]:[new RegExp("(Opera|OPR)\\/"+rv)],[LC]:[new RegExp(LC+"\\/"+rv)],[FTe]:[new RegExp("FxiOS\\/"+rv)],[tK]:[new RegExp("Konqueror[:/]?"+rv,"i")],[OC]:[new RegExp(OC+" "+rv),nK],[BTe]:[new RegExp("android\\s"+rv,"i")],[LTe]:[new RegExp(OTe+"\\/"+rv)],[ZZ]:[new RegExp("(rv:|MSIE )"+rv)],Mozilla:[new RegExp("rv:"+rv)]},T1t=function(n,e){var t=GTe(n,e),i=E1t[t];if(br(i))return null;for(var r=0;r<i.length;r++){var o=i[r],s=n.match(o);if(s)return parseFloat(s[s.length-2])}return null},YTe=[[new RegExp(DC+"; "+DC+" (.*?)[);]","i"),n=>[DC,n&&n[1]||""]],[new RegExp(wN,"i"),[wN,""]],[new RegExp(SN,"i"),[SN,""]],[iK,[OC,""]],[new RegExp(EN,"i"),(n,e)=>{if(/Phone/.test(e)||/WPDesktop/.test(e))return[JZ,""];if(new RegExp(f2).test(e)&&!/IEMobile\b/.test(e))return[EN+" "+f2,""];var t=/Windows NT ([0-9.]+)/i.exec(e);if(t&&t[1]){var i=t[1],r=w1t[i]||"";return/arm/i.test(e)&&(r="RT"),[EN,r]}return[EN,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,n=>{if(n&&n[3]){var e=[n[3],n[4],n[5]||"0"];return[T7,e.join(".")]}return[T7,""]}],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,n=>{var e="";return n&&n.length>=3&&(e=br(n[2])?n[3]:n[2]),["watchOS",e]}],[new RegExp("("+rE+" (\\d+)\\.(\\d+)\\.?(\\d+)?|"+rE+")","i"),n=>{if(n&&n[2]){var e=[n[2],n[3],n[4]||"0"];return[rE,e.join(".")]}return[rE,""]}],[/Mac OS X (\d+)[_.](\d+)[_.]?(\d+)?/i,n=>{var e=["Mac OS X",""];if(n&&n[1]){var t=[n[1],n[2],n[3]||"0"];e[1]=t.join(".")}return e}],[/Mac/i,["Mac OS X",""]],[/CrOS/,[_1t,""]],[/Linux|debian/i,["Linux",""]]],qTe=function(n){return v1t.test(n)?wN:x1t.test(n)?SN:b1t.test(n)?DC:new RegExp(eK,"i").test(n)?eK:new RegExp("("+JZ+"|WPDesktop)","i").test(n)?JZ:/iPad/.test(n)?PTe:/iPod/.test(n)?"iPod Touch":/iPhone/.test(n)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(n)?NTe:iK.test(n)?OC:/(kobo)\s(ereader|touch)/i.test(n)?"Kobo":new RegExp(jTe,"i").test(n)?jTe:/(kf[a-z]{2}wi|aeo[c-r]{2})( bui|\))/i.test(n)||/(kf[a-z]+)( bui|\)).+silk\//i.test(n)?"Kindle Fire":/(Android|ZTE)/i.test(n)?!new RegExp(f2).test(n)||/(9138B|TB782B|Nexus [97]|pixel c|HUAWEISHT|BTV|noble nook|smart ultra 6)/i.test(n)?/pixel[\daxl ]{1,6}/i.test(n)&&!/pixel c/i.test(n)||/(huaweimed-al00|tah-|APA|SM-G92|i980|zte|U304AA)/i.test(n)||/lmy47v/i.test(n)&&!/QTAQZ3/i.test(n)?rE:RTe:rE:new RegExp("(pda|"+f2+")","i").test(n)?g1t:new RegExp(xN,"i").test(n)&&!new RegExp(xN+" pc","i").test(n)?VTe:""},M7="https?://(.*)",A7=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],M1t=e7(["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid"],A7),rK="<masked>",A1t=["li_fat_id"];function XTe(n,e,t){if(!Kr)return{};var i,r=e?e7([],A7,t||[]):[],o=WTe(MZ(Kr.URL,r,rK),n),s=(i={},vf(A1t,(function(a){var c=tE.V(a);i[a]=c||null})),i);return qy(s,o)}function WTe(n,e){var t=M1t.concat(e||[]),i={};return vf(t,(function(r){var o=d7(n,r);i[r]=o||null})),i}function ZTe(n){var e=(function(o){return o?o.search(M7+"google.([^/?]*)")===0?"google":o.search(M7+"bing.com")===0?"bing":o.search(M7+"yahoo.com")===0?"yahoo":o.search(M7+"duckduckgo.com")===0?"duckduckgo":null:null})(n),t=e!="yahoo"?"q":"p",i={};if(!i3(e)){i.$search_engine=e;var r=Kr?d7(Kr.referrer,t):"";r.length&&(i.ph_keyword=r)}return i}function KTe(){return navigator.language||navigator.userLanguage}function QTe(){return Kr?.referrer||"$direct"}function JTe(n,e){var t=n?e7([],A7,e||[]):[],i=zv?.href.substring(0,1e3);return{r:QTe().substring(0,1e3),u:i?MZ(i,t,rK):void 0}}function e3e(n){var e,{r:t,u:i}=n,r={$referrer:t,$referring_domain:t==null?void 0:t=="$direct"?"$direct":(e=PC(t))==null?void 0:e.host};if(i){r.$current_url=i;var o=PC(i);r.$host=o?.host,r.$pathname=o?.pathname;var s=WTe(i);qy(r,s)}if(t){var a=ZTe(t);qy(r,a)}return r}function t3e(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch{return}}function C1t(){try{return new Date().getTimezoneOffset()}catch{return}}function R1t(n,e){if(!$v)return{};var t,i,r,o=n?e7([],A7,e||[]):[],[s,a]=(function(c){for(var l=0;l<YTe.length;l++){var[u,d]=YTe[l],h=u.exec(c),f=h&&(h2(d)?d(h,c):d);if(f)return f}return["",""]})($v);return qy(dZ({$os:s,$os_version:a,$browser:GTe($v,navigator.vendor),$device:qTe($v),$device_type:(i=$v,r=qTe(i),r===PTe||r===RTe||r==="Kobo"||r==="Kindle Fire"||r===VTe?xN:r===wN||r===DC||r===SN||r===eK?"Console":r===NTe?"Wearable":r?f2:"Desktop"),$timezone:t3e(),$timezone_offset:C1t()}),{$current_url:MZ(zv?.href,o,rK),$host:zv?.host,$pathname:zv?.pathname,$raw_user_agent:$v.length>1e3?$v.substring(0,997)+"...":$v,$browser_version:T1t($v,navigator.vendor),$browser_language:KTe(),$browser_language_prefix:(t=KTe(),typeof t=="string"?t.split("-")[0]:void 0),$screen_height:qn?.screen.height,$screen_width:qn?.screen.width,$viewport_height:qn?.innerHeight,$viewport_width:qn?.innerWidth,$lib:"web",$lib_version:w5.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3})}var oE=x1("[FeatureFlags]"),oK="$active_feature_flags",zC="$override_feature_flags",n3e="$feature_flag_payloads",TN="$override_feature_flag_payloads",i3e="$feature_flag_request_id",r3e=n=>{var e={};for(var[t,i]of t7(n||{}))i&&(e[t]=i);return e},P1t=n=>{var e=n.flags;return e?(n.featureFlags=Object.fromEntries(Object.keys(e).map((t=>{var i;return[t,(i=e[t].variant)!==null&&i!==void 0?i:e[t].enabled]}))),n.featureFlagPayloads=Object.fromEntries(Object.keys(e).filter((t=>e[t].enabled)).filter((t=>{var i;return(i=e[t].metadata)==null?void 0:i.payload})).map((t=>{var i;return[t,(i=e[t].metadata)==null?void 0:i.payload]})))):oE.warn("Using an older version of the feature flags endpoint. Please upgrade your PostHog server to the latest version"),n},I1t=(function(n){return n.FeatureFlags="feature_flags",n.Recordings="recordings",n})({});let N1t=class{constructor(e){this.ye=!1,this.we=!1,this.Se=!1,this.$e=!1,this.ke=!1,this.xe=!1,this.Ee=!1,this._instance=e,this.featureFlagEventHandlers=[]}flags(){if(this._instance.config.__preview_remote_config)this.xe=!0;else{var e=!this.Ie&&(this._instance.config.advanced_disable_feature_flags||this._instance.config.advanced_disable_feature_flags_on_first_load);this.Re({disableFlags:e})}}get hasLoadedFlags(){return this.we}getFlags(){return Object.keys(this.getFlagVariants())}getFlagsWithDetails(){var e=this._instance.get_property(_Z),t=this._instance.get_property(zC),i=this._instance.get_property(TN);if(!i&&!t)return e||{};var r=qy({},e||{}),o=[...new Set([...Object.keys(i||{}),...Object.keys(t||{})])];for(var s of o){var a,c,l=r[s],u=t?.[s],d=br(u)?(a=l?.enabled)!==null&&a!==void 0&&a:!!u,h=br(u)?l.variant:typeof u=="string"?u:void 0,f=i?.[s],m=Qr({},l,{enabled:d,variant:d?h??l?.variant:void 0});d!==l?.enabled&&(m.original_enabled=l?.enabled),h!==l?.variant&&(m.original_variant=l?.variant),f&&(m.metadata=Qr({},l?.metadata,{payload:f,original_payload:l==null||(c=l.metadata)==null?void 0:c.payload})),r[s]=m}return this.ye||(oE.warn(" Overriding feature flag details!",{flagDetails:e,overriddenPayloads:i,finalDetails:r}),this.ye=!0),r}getFlagVariants(){var e=this._instance.get_property(CC),t=this._instance.get_property(zC);if(!t)return e||{};for(var i=qy({},e),r=Object.keys(t),o=0;o<r.length;o++)i[r[o]]=t[r[o]];return this.ye||(oE.warn(" Overriding feature flags!",{enabledFlags:e,overriddenFlags:t,finalFlags:i}),this.ye=!0),i}getFlagPayloads(){var e=this._instance.get_property(n3e),t=this._instance.get_property(TN);if(!t)return e||{};for(var i=qy({},e||{}),r=Object.keys(t),o=0;o<r.length;o++)i[r[o]]=t[r[o]];return this.ye||(oE.warn(" Overriding feature flag payloads!",{flagPayloads:e,overriddenPayloads:t,finalPayloads:i}),this.ye=!0),i}reloadFeatureFlags(){this.$e||this._instance.config.advanced_disable_feature_flags||this.Ie||(this.Ie=setTimeout((()=>{this.Re()}),5))}Pe(){clearTimeout(this.Ie),this.Ie=void 0}ensureFlagsLoaded(){this.we||this.Se||this.Ie||this.reloadFeatureFlags()}setAnonymousDistinctId(e){this.$anon_distinct_id=e}setReloadingPaused(e){this.$e=e}Re(e){var t;if(this.Pe(),!this._instance.L())if(this.Se)this.ke=!0;else{var i={token:this._instance.config.token,distinct_id:this._instance.get_distinct_id(),groups:this._instance.getGroups(),$anon_distinct_id:this.$anon_distinct_id,person_properties:Qr({},((t=this._instance.persistence)==null?void 0:t.get_initial_props())||{},this._instance.get_property(uN)||{}),group_properties:this._instance.get_property(cA)};(e!=null&&e.disableFlags||this._instance.config.advanced_disable_feature_flags)&&(i.disable_flags=!0);var r=this._instance.config.__preview_remote_config,o=r?"/flags/?v=2":"/flags/?v=2&config=true",s=this._instance.config.advanced_only_evaluate_survey_feature_flags?"&only_evaluate_survey_feature_flags=true":"",a=this._instance.requestRouter.endpointFor("api",o+s);r&&(i.timezone=t3e()),this.Se=!0,this._instance.Te({method:"POST",url:a,data:i,compression:this._instance.config.disable_compression?void 0:E5.Base64,timeout:this._instance.config.feature_flag_request_timeout_ms,callback:c=>{var l,u,d=!0;if(c.statusCode===200&&(this.ke||(this.$anon_distinct_id=void 0),d=!1),this.Se=!1,this.xe||(this.xe=!0,this._instance.Ce((u=c.json)!==null&&u!==void 0?u:{})),!i.disable_flags||this.ke)if(this.Ee=!d,c.json&&(l=c.json.quotaLimited)!=null&&l.includes(I1t.FeatureFlags))oE.warn("You have hit your feature flags quota limit, and will not be able to load feature flags until the quota is reset. Please visit https://posthog.com/docs/billing/limits-alerts to learn more.");else{var h;i.disable_flags||this.receivedFeatureFlags((h=c.json)!==null&&h!==void 0?h:{},d),this.ke&&(this.ke=!1,this.Re())}}})}}getFeatureFlag(e,t){if(t===void 0&&(t={}),this.we||this.getFlags()&&this.getFlags().length>0){var i=this.getFlagVariants()[e],r=""+i,o=this._instance.get_property(i3e)||void 0,s=this._instance.get_property(o7)||{};if((t.send_event||!("send_event"in t))&&(!(e in s)||!s[e].includes(r))){var a,c,l,u,d,h,f,m,y;p0(s[e])?s[e].push(r):s[e]=[r],(a=this._instance.persistence)==null||a.register({[o7]:s});var g=this.getFeatureFlagDetails(e),b={$feature_flag:e,$feature_flag_response:i,$feature_flag_payload:this.getFeatureFlagPayload(e)||null,$feature_flag_request_id:o,$feature_flag_bootstrapped_response:((c=this._instance.config.bootstrap)==null||(c=c.featureFlags)==null?void 0:c[e])||null,$feature_flag_bootstrapped_payload:((l=this._instance.config.bootstrap)==null||(l=l.featureFlagPayloads)==null?void 0:l[e])||null,$used_bootstrap_value:!this.Ee};br(g==null||(u=g.metadata)==null?void 0:u.version)||(b.$feature_flag_version=g.metadata.version);var v,w=(d=g==null||(h=g.reason)==null?void 0:h.description)!==null&&d!==void 0?d:g==null||(f=g.reason)==null?void 0:f.code;w&&(b.$feature_flag_reason=w),g!=null&&(m=g.metadata)!=null&&m.id&&(b.$feature_flag_id=g.metadata.id),br(g?.original_variant)&&br(g?.original_enabled)||(b.$feature_flag_original_response=br(g.original_variant)?g.original_enabled:g.original_variant),g!=null&&(y=g.metadata)!=null&&y.original_payload&&(b.$feature_flag_original_payload=g==null||(v=g.metadata)==null?void 0:v.original_payload),this._instance.capture("$feature_flag_called",b)}return i}oE.warn('getFeatureFlag for key "'+e+`" failed. Feature flags didn't load in time.`)}getFeatureFlagDetails(e){return this.getFlagsWithDetails()[e]}getFeatureFlagPayload(e){return this.getFlagPayloads()[e]}getRemoteConfigPayload(e,t){var i=this._instance.config.token;this._instance.Te({method:"POST",url:this._instance.requestRouter.endpointFor("api","/flags/?v=2&config=true"),data:{distinct_id:this._instance.get_distinct_id(),token:i},compression:this._instance.config.disable_compression?void 0:E5.Base64,timeout:this._instance.config.feature_flag_request_timeout_ms,callback:r=>{var o,s=(o=r.json)==null?void 0:o.featureFlagPayloads;t(s?.[e]||void 0)}})}isFeatureEnabled(e,t){if(t===void 0&&(t={}),this.we||this.getFlags()&&this.getFlags().length>0)return!!this.getFeatureFlag(e,t);oE.warn('isFeatureEnabled for key "'+e+`" failed. Feature flags didn't load in time.`)}addFeatureFlagsHandler(e){this.featureFlagEventHandlers.push(e)}removeFeatureFlagsHandler(e){this.featureFlagEventHandlers=this.featureFlagEventHandlers.filter((t=>t!==e))}receivedFeatureFlags(e,t){if(this._instance.persistence){this.we=!0;var i=this.getFlagVariants(),r=this.getFlagPayloads(),o=this.getFlagsWithDetails();(function(s,a,c,l,u){c===void 0&&(c={}),l===void 0&&(l={}),u===void 0&&(u={});var d=P1t(s),h=d.flags,f=d.featureFlags,m=d.featureFlagPayloads;if(f){var y=s.requestId;if(p0(f)){oE.warn("v1 of the feature flags endpoint is deprecated. Please use the latest version.");var g={};if(f)for(var b=0;b<f.length;b++)g[f[b]]=!0;a&&a.register({[oK]:f,[CC]:g})}else{var v=f,w=m,T=h;s.errorsWhileComputingFlags&&(v=Qr({},c,v),w=Qr({},l,w),T=Qr({},u,T)),a&&a.register(Qr({[oK]:Object.keys(r3e(v)),[CC]:v||{},[n3e]:w||{},[_Z]:T||{}},y?{[i3e]:y}:{}))}}})(e,this._instance.persistence,i,r,o),this.Me(t)}}override(e,t){t===void 0&&(t=!1),oE.warn("override is deprecated. Please use overrideFeatureFlags instead."),this.overrideFeatureFlags({flags:e,suppressWarning:t})}overrideFeatureFlags(e){if(!this._instance.__loaded||!this._instance.persistence)return oE.uninitializedWarning("posthog.featureFlags.overrideFeatureFlags");if(e===!1)return this._instance.persistence.unregister(zC),this._instance.persistence.unregister(TN),void this.Me();if(e&&typeof e=="object"&&("flags"in e||"payloads"in e)){var t,i=e;if(this.ye=!!((t=i.suppressWarning)!==null&&t!==void 0&&t),"flags"in i){if(i.flags===!1)this._instance.persistence.unregister(zC);else if(i.flags)if(p0(i.flags)){for(var r={},o=0;o<i.flags.length;o++)r[i.flags[o]]=!0;this._instance.persistence.register({[zC]:r})}else this._instance.persistence.register({[zC]:i.flags})}return"payloads"in i&&(i.payloads===!1?this._instance.persistence.unregister(TN):i.payloads&&this._instance.persistence.register({[TN]:i.payloads})),void this.Me()}this.Me()}onFeatureFlags(e){if(this.addFeatureFlagsHandler(e),this.we){var{flags:t,flagVariants:i}=this.Oe();e(t,i)}return()=>this.removeFeatureFlagsHandler(e)}updateEarlyAccessFeatureEnrollment(e,t,i){var r,o=(this._instance.get_property(lN)||[]).find((l=>l.flagKey===e)),s={["$feature_enrollment/"+e]:t},a={$feature_flag:e,$feature_enrollment:t,$set:s};o&&(a.$early_access_feature_name=o.name),i&&(a.$feature_enrollment_stage=i),this._instance.capture("$feature_enrollment_update",a),this.setPersonPropertiesForFlags(s,!1);var c=Qr({},this.getFlagVariants(),{[e]:t});(r=this._instance.persistence)==null||r.register({[oK]:Object.keys(r3e(c)),[CC]:c}),this.Me()}getEarlyAccessFeatures(e,t,i){t===void 0&&(t=!1);var r=this._instance.get_property(lN),o=i?"&"+i.map((s=>"stage="+s)).join("&"):"";if(r&&!t)return e(r);this._instance.Te({url:this._instance.requestRouter.endpointFor("api","/api/early_access_features/?token="+this._instance.config.token+o),method:"GET",callback:s=>{var a,c;if(s.json){var l=s.json.earlyAccessFeatures;return(a=this._instance.persistence)==null||a.unregister(lN),(c=this._instance.persistence)==null||c.register({[lN]:l}),e(l)}}})}Oe(){var e=this.getFlags(),t=this.getFlagVariants();return{flags:e.filter((i=>t[i])),flagVariants:Object.keys(t).filter((i=>t[i])).reduce(((i,r)=>(i[r]=t[r],i)),{})}}Me(e){var{flags:t,flagVariants:i}=this.Oe();this.featureFlagEventHandlers.forEach((r=>r(t,i,{errorsLoading:e})))}setPersonPropertiesForFlags(e,t){t===void 0&&(t=!0);var i=this._instance.get_property(uN)||{};this._instance.register({[uN]:Qr({},i,e)}),t&&this._instance.reloadFeatureFlags()}resetPersonPropertiesForFlags(){this._instance.unregister(uN)}setGroupPropertiesForFlags(e,t){t===void 0&&(t=!0);var i=this._instance.get_property(cA)||{};Object.keys(i).length!==0&&Object.keys(i).forEach((r=>{i[r]=Qr({},i[r],e[r]),delete e[r]})),this._instance.register({[cA]:Qr({},i,e)}),t&&this._instance.reloadFeatureFlags()}resetGroupPropertiesForFlags(e){if(e){var t=this._instance.get_property(cA)||{};this._instance.register({[cA]:Qr({},t,{[e]:{}})})}else this._instance.unregister(cA)}reset(){this.we=!1,this.Se=!1,this.$e=!1,this.ke=!1,this.xe=!1,this.Ee=!1,this.$anon_distinct_id=void 0,this.Pe(),this.ye=!1}};var k1t=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"];let sK=class{constructor(e,t){this.A=e,this.props={},this.Fe=!1,this.Ae=(i=>{var r="";return i.token&&(r=i.token.replace(/\+/g,"PL").replace(/\//g,"SL").replace(/=/g,"EQ")),i.persistence_name?"ph_"+i.persistence_name:"ph_"+r+"_posthog"})(e),this.it=this.De(e),this.load(),e.debug&&Yr.info("Persistence loaded",e.persistence,Qr({},this.props)),this.update_config(e,e,t),this.save()}isDisabled(){return!!this.je}De(e){k1t.indexOf(e.persistence.toLowerCase())===-1&&(Yr.critical("Unknown persistence type "+e.persistence+"; falling back to localStorage+cookie"),e.persistence="localStorage+cookie");var t=e.persistence.toLowerCase();return t==="localstorage"&&v1.G()?v1:t==="localstorage+cookie"&&p7.G()?p7:t==="sessionstorage"&&Xb.G()?Xb:t==="memory"?pgt:t==="cookie"?tE:p7.G()?p7:tE}properties(){var e={};return vf(this.props,(function(t,i){if(i===CC&&cy(t))for(var r=Object.keys(t),o=0;o<r.length;o++)e["$feature/"+r[o]]=t[r[o]];else a=i,c=!1,(i3(s=Gyt)?c:i5e&&s.indexOf===i5e?s.indexOf(a)!=-1:(vf(s,(function(l){if(c||(c=l===a))return JL})),c))||(e[i]=t);var s,a,c})),e}load(){if(!this.je){var e=this.it.K(this.Ae);e&&(this.props=qy({},e))}}save(){this.je||this.it.Y(this.Ae,this.props,this.Le,this.Ne,this.ze,this.A.debug)}remove(){this.it.X(this.Ae,!1),this.it.X(this.Ae,!0)}clear(){this.remove(),this.props={}}register_once(e,t,i){if(cy(e)){br(t)&&(t="None"),this.Le=br(i)?this.Ue:i;var r=!1;if(vf(e,((o,s)=>{this.props.hasOwnProperty(s)&&this.props[s]!==t||(this.props[s]=o,r=!0)})),r)return this.save(),!0}return!1}register(e,t){if(cy(e)){this.Le=br(t)?this.Ue:t;var i=!1;if(vf(e,((r,o)=>{e.hasOwnProperty(o)&&this.props[o]!==r&&(this.props[o]=r,i=!0)})),i)return this.save(),!0}return!1}unregister(e){e in this.props&&(delete this.props[e],this.save())}update_campaign_params(){if(!this.Fe){var e=XTe(this.A.custom_campaign_params,this.A.mask_personal_data_properties,this.A.custom_personal_data_properties);AC(dZ(e))||this.register(e),this.Fe=!0}}update_search_keyword(){var e;this.register((e=Kr?.referrer)?ZTe(e):{})}update_referrer_info(){var e;this.register_once({$referrer:QTe(),$referring_domain:Kr!=null&&Kr.referrer&&((e=PC(Kr.referrer))==null?void 0:e.host)||"$direct"},void 0)}set_initial_person_info(){this.props[xZ]||this.props[vZ]||this.register_once({[s7]:JTe(this.A.mask_personal_data_properties,this.A.custom_personal_data_properties)},void 0)}get_initial_props(){var e={};vf([vZ,xZ],(s=>{var a=this.props[s];a&&vf(a,(function(c,l){e["$initial_"+cZ(l)]=c}))}));var t,i,r=this.props[s7];if(r){var o=(t=e3e(r),i={},vf(t,(function(s,a){i["$initial_"+cZ(a)]=s})),i);qy(e,o)}return e}safe_merge(e){return vf(this.props,(function(t,i){i in e||(e[i]=t)})),e}update_config(e,t,i){if(this.Ue=this.Le=e.cookie_expiration,this.set_disabled(e.disable_persistence||!!i),this.set_cross_subdomain(e.cross_subdomain_cookie),this.set_secure(e.secure_cookie),e.persistence!==t.persistence){var r=this.De(e),o=this.props;this.clear(),this.it=r,this.props=o,this.save()}}set_disabled(e){this.je=e,this.je?this.remove():this.save()}set_cross_subdomain(e){e!==this.Ne&&(this.Ne=e,this.remove(),this.save())}set_secure(e){e!==this.ze&&(this.ze=e,this.remove(),this.save())}set_event_timer(e,t){var i=this.props[sN]||{};i[e]=t,this.props[sN]=i,this.save()}remove_event_timer(e){var t=(this.props[sN]||{})[e];return br(t)||(delete this.props[sN][e],this.save()),t}get_property(e){return this.props[e]}set_property(e,t){this.props[e]=t,this.save()}},o3e=class{constructor(){this.qe={},this.qe={}}on(e,t){return this.qe[e]||(this.qe[e]=[]),this.qe[e].push(t),()=>{this.qe[e]=this.qe[e].filter((i=>i!==t))}}emit(e,t){for(var i of this.qe[e]||[])i(t);for(var r of this.qe["*"]||[])r(e,t)}},O1t=class jI{constructor(e){this.Be=new o3e,this.He=(t,i)=>this.We(t,i)&&this.Ge(t,i)&&this.Je(t,i),this.We=(t,i)=>i==null||!i.event||t?.event===i?.event,this._instance=e,this.Ve=new Set,this.Ke=new Set}init(){var e;if(!br((e=this._instance)==null?void 0:e.Ye)){var t;(t=this._instance)==null||t.Ye(((i,r)=>{this.on(i,r)}))}}register(e){var t,i;if(!br((t=this._instance)==null?void 0:t.Ye)&&(e.forEach((s=>{var a,c;(a=this.Ke)==null||a.add(s),(c=s.steps)==null||c.forEach((l=>{var u;(u=this.Ve)==null||u.add(l?.event||"")}))})),(i=this._instance)!=null&&i.autocapture)){var r,o=new Set;e.forEach((s=>{var a;(a=s.steps)==null||a.forEach((c=>{c!=null&&c.selector&&o.add(c?.selector)}))})),(r=this._instance)==null||r.autocapture.setElementSelectors(o)}}on(e,t){var i;t!=null&&e.length!=0&&(this.Ve.has(e)||this.Ve.has(t?.event))&&this.Ke&&((i=this.Ke)==null?void 0:i.size)>0&&this.Ke.forEach((r=>{this.Xe(t,r)&&this.Be.emit("actionCaptured",r.name)}))}Qe(e){this.onAction("actionCaptured",(t=>e(t)))}Xe(e,t){if(t?.steps==null)return!1;for(var i of t.steps)if(this.He(e,i))return!0;return!1}onAction(e,t){return this.Be.on(e,t)}Ge(e,t){if(t!=null&&t.url){var i,r=e==null||(i=e.properties)==null?void 0:i.$current_url;if(!r||typeof r!="string"||!jI.Ze(r,t?.url,t?.url_matching||"contains"))return!1}return!0}static Ze(e,t,i){switch(i){case"regex":return!!qn&&kC(e,t);case"exact":return t===e;case"contains":var r=jI.tr(t).replace(/_/g,".").replace(/%/g,".*");return kC(e,r);default:return!1}}static tr(e){return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}Je(e,t){if((t!=null&&t.href||t!=null&&t.tag_name||t!=null&&t.text)&&!this.ir(e).some((o=>!(t!=null&&t.href&&!jI.Ze(o.href||"",t?.href,t?.href_matching||"exact"))&&(t==null||!t.tag_name||o.tag_name===t?.tag_name)&&!(t!=null&&t.text&&!jI.Ze(o.text||"",t?.text,t?.text_matching||"exact")&&!jI.Ze(o.$el_text||"",t?.text,t?.text_matching||"exact")))))return!1;if(t!=null&&t.selector){var i,r=e==null||(i=e.properties)==null?void 0:i.$element_selectors;if(!r||!r.includes(t?.selector))return!1}return!0}ir(e){return e?.properties.$elements==null?[]:e?.properties.$elements}};(function(n){return n.Button="button",n.Tab="tab",n.Selector="selector",n})({}),(function(n){return n.TopLeft="top_left",n.TopRight="top_right",n.TopCenter="top_center",n.MiddleLeft="middle_left",n.MiddleRight="middle_right",n.MiddleCenter="middle_center",n.Left="left",n.Center="center",n.Right="right",n.NextToTrigger="next_to_trigger",n})({});var aK=(function(n){return n.Popover="popover",n.API="api",n.Widget="widget",n.ExternalSurvey="external_survey",n})({});(function(n){return n.Open="open",n.MultipleChoice="multiple_choice",n.SingleChoice="single_choice",n.Rating="rating",n.Link="link",n})({}),(function(n){return n.NextQuestion="next_question",n.End="end",n.ResponseBased="response_based",n.SpecificQuestion="specific_question",n})({}),(function(n){return n.Once="once",n.Recurring="recurring",n.Always="always",n})({});var cK=(function(n){return n.SHOWN="survey shown",n.DISMISSED="survey dismissed",n.SENT="survey sent",n})({}),s3e=(function(n){return n.SURVEY_ID="$survey_id",n.SURVEY_NAME="$survey_name",n.SURVEY_RESPONSE="$survey_response",n.SURVEY_ITERATION="$survey_iteration",n.SURVEY_ITERATION_START_DATE="$survey_iteration_start_date",n.SURVEY_PARTIALLY_COMPLETED="$survey_partially_completed",n.SURVEY_SUBMISSION_ID="$survey_submission_id",n.SURVEY_QUESTIONS="$survey_questions",n.SURVEY_COMPLETED="$survey_completed",n})({}),Ng=x1("[Surveys]"),lK="seenSurvey_",L1t=(n,e)=>{var t="$survey_"+e+"/"+n.id;return n.current_iteration&&n.current_iteration>0&&(t="$survey_"+e+"/"+n.id+"/"+n.current_iteration),t},a3e=n=>{var e=""+lK+n.id;return n.current_iteration&&n.current_iteration>0&&(e=""+lK+n.id+"_"+n.current_iteration),e},D1t=[aK.Popover,aK.Widget,aK.API];let z1t=class{constructor(e){this._instance=e,this.er=new Map,this.rr=new Map}register(e){var t;br((t=this._instance)==null?void 0:t.Ye)||(this.sr(e),this.nr(e))}nr(e){var t=e.filter((i=>{var r,o;return((r=i.conditions)==null?void 0:r.actions)&&((o=i.conditions)==null||(o=o.actions)==null||(o=o.values)==null?void 0:o.length)>0}));t.length!==0&&(this.ar==null&&(this.ar=new O1t(this._instance),this.ar.init(),this.ar.Qe((i=>{this.onAction(i)}))),t.forEach((i=>{var r,o,s,a,c;i.conditions&&(r=i.conditions)!=null&&r.actions&&(o=i.conditions)!=null&&(o=o.actions)!=null&&o.values&&((s=i.conditions)==null||(s=s.actions)==null||(s=s.values)==null?void 0:s.length)>0&&((a=this.ar)==null||a.register(i.conditions.actions.values),(c=i.conditions)==null||(c=c.actions)==null||(c=c.values)==null||c.forEach((l=>{if(l&&l.name){var u=this.rr.get(l.name);u&&u.push(i.id),this.rr.set(l.name,u||[i.id])}})))})))}sr(e){var t;e.filter((i=>{var r,o;return((r=i.conditions)==null?void 0:r.events)&&((o=i.conditions)==null||(o=o.events)==null||(o=o.values)==null?void 0:o.length)>0})).length!==0&&((t=this._instance)==null||t.Ye(((i,r)=>{this.onEvent(i,r)})),e.forEach((i=>{var r;(r=i.conditions)==null||(r=r.events)==null||(r=r.values)==null||r.forEach((o=>{if(o&&o.name){var s=this.er.get(o.name);s&&s.push(i.id),this.er.set(o.name,s||[i.id])}}))})))}onEvent(e,t){var i,r=((i=this._instance)==null||(i=i.persistence)==null?void 0:i.props[r7])||[];if(e==="survey shown"&&t&&r.length>0){var o;Ng.info("survey event matched, removing survey from activated surveys",{event:e,eventPayload:t,existingActivatedSurveys:r});var s=t==null||(o=t.properties)==null?void 0:o.$survey_id;if(s){var a=r.indexOf(s);a>=0&&(r.splice(a,1),this.lr(r))}}else this.er.has(e)&&(Ng.info("survey event matched, updating activated surveys",{event:e,surveys:this.er.get(e)}),this.lr(r.concat(this.er.get(e)||[])))}onAction(e){var t,i=((t=this._instance)==null||(t=t.persistence)==null?void 0:t.props[r7])||[];this.rr.has(e)&&this.lr(i.concat(this.rr.get(e)||[]))}lr(e){var t;(t=this._instance)==null||(t=t.persistence)==null||t.register({[r7]:[...new Set(e)]})}getSurveys(){var e,t=(e=this._instance)==null||(e=e.persistence)==null?void 0:e.props[r7];return t||[]}getEventToSurveys(){return this.er}hr(){return this.ar}},$1t=class{constructor(e){this.ur=void 0,this._surveyManager=null,this.dr=!1,this.vr=!1,this.cr=[],this._instance=e,this._surveyEventReceiver=null}onRemoteConfig(e){if(!this._instance.config.disable_surveys){var t=e.surveys;if(Oh(t))return Ng.warn("Flags not loaded yet. Not loading surveys.");var i=p0(t);this.ur=i?t.length>0:t,Ng.info("flags response received, isSurveysEnabled: "+this.ur),this.loadIfEnabled()}}reset(){localStorage.removeItem("lastSeenSurveyDate");for(var e=[],t=0;t<localStorage.length;t++){var i=localStorage.key(t);(i!=null&&i.startsWith(lK)||i!=null&&i.startsWith("inProgressSurvey_"))&&e.push(i)}e.forEach((r=>localStorage.removeItem(r)))}loadIfEnabled(){if(!this._surveyManager)if(this.vr)Ng.info("Already initializing surveys, skipping...");else if(this._instance.config.disable_surveys)Ng.info("Disabled. Not loading surveys.");else if(this._instance.config.cookieless_mode)Ng.info("Not loading surveys in cookieless mode.");else{var e=Bs?.__PosthogExtensions__;if(e){if(!br(this.ur)||this._instance.config.advanced_enable_surveys){var t=this.ur||this._instance.config.advanced_enable_surveys;this.vr=!0;try{var i=e.generateSurveys;if(i)return void this.pr(i,t);var r=e.loadExternalDependency;if(!r)return void this.gr("PostHog loadExternalDependency extension not found.");r(this._instance,"surveys",(o=>{o||!e.generateSurveys?this.gr("Could not load surveys script",o):this.pr(e.generateSurveys,t)}))}catch(o){throw this.gr("Error initializing surveys",o),o}finally{this.vr=!1}}}else Ng.error("PostHog Extensions not found.")}}pr(e,t){this._surveyManager=e(this._instance,t),this._surveyEventReceiver=new z1t(this._instance),Ng.info("Surveys loaded successfully"),this._r({isLoaded:!0})}gr(e,t){Ng.error(e,t),this._r({isLoaded:!1,error:e})}onSurveysLoaded(e){return this.cr.push(e),this._surveyManager&&this._r({isLoaded:!0}),()=>{this.cr=this.cr.filter((t=>t!==e))}}getSurveys(e,t){if(t===void 0&&(t=!1),this._instance.config.disable_surveys)return Ng.info("Disabled. Not loading surveys."),e([]);var i=this._instance.get_property(yZ);if(i&&!t)return e(i,{isLoaded:!0});if(this.dr)return e([],{isLoaded:!1,error:"Surveys are already being loaded"});try{this.dr=!0,this._instance.Te({url:this._instance.requestRouter.endpointFor("api","/api/surveys/?token="+this._instance.config.token),method:"GET",timeout:this._instance.config.surveys_request_timeout_ms,callback:r=>{var o;this.dr=!1;var s=r.statusCode;if(s!==200||!r.json){var a="Surveys API could not be loaded, status: "+s;return Ng.error(a),e([],{isLoaded:!1,error:a})}var c,l=r.json.surveys||[],u=l.filter((d=>(function(h){return!(!h.start_date||h.end_date)})(d)&&((function(h){var f;return!((f=h.conditions)==null||(f=f.events)==null||(f=f.values)==null||!f.length)})(d)||(function(h){var f;return!((f=h.conditions)==null||(f=f.actions)==null||(f=f.values)==null||!f.length)})(d))));return u.length>0&&((c=this._surveyEventReceiver)==null||c.register(u)),(o=this._instance.persistence)==null||o.register({[yZ]:l}),e(l,{isLoaded:!0})}})}catch(r){throw this.dr=!1,r}}_r(e){for(var t of this.cr)try{if(!e.isLoaded)return t([],e);this.getSurveys(t)}catch(i){Ng.error("Error in survey callback",i)}}getActiveMatchingSurveys(e,t){if(t===void 0&&(t=!1),!Oh(this._surveyManager))return this._surveyManager.getActiveMatchingSurveys(e,t);Ng.warn("init was not called")}mr(e){var t=null;return this.getSurveys((i=>{var r;t=(r=i.find((o=>o.id===e)))!==null&&r!==void 0?r:null})),t}br(e){if(Oh(this._surveyManager))return{eligible:!1,reason:"SDK is not enabled or survey functionality is not yet loaded"};var t=typeof e=="string"?this.mr(e):e;return t?this._surveyManager.checkSurveyEligibility(t):{eligible:!1,reason:"Survey not found"}}canRenderSurvey(e){if(Oh(this._surveyManager))return Ng.warn("init was not called"),{visible:!1,disabledReason:"SDK is not enabled or survey functionality is not yet loaded"};var t=this.br(e);return{visible:t.eligible,disabledReason:t.reason}}canRenderSurveyAsync(e,t){return Oh(this._surveyManager)?(Ng.warn("init was not called"),Promise.resolve({visible:!1,disabledReason:"SDK is not enabled or survey functionality is not yet loaded"})):new Promise((i=>{this.getSurveys((r=>{var o,s=(o=r.find((c=>c.id===e)))!==null&&o!==void 0?o:null;if(s){var a=this.br(s);i({visible:a.eligible,disabledReason:a.reason})}else i({visible:!1,disabledReason:"Survey not found"})}),t)}))}renderSurvey(e,t){if(Oh(this._surveyManager))Ng.warn("init was not called");else{var i=this.mr(e);if(i)if(D1t.includes(i.type)){var r=Kr?.querySelector(t);r?this._surveyManager.renderSurvey(i,r):Ng.warn("Survey element not found")}else Ng.warn("Surveys of type "+i.type+" cannot be rendered in the app");else Ng.warn("Survey not found")}}};var c3e=x1("[RateLimiter]");let F1t=class{constructor(e){var t,i;this.serverLimits={},this.lastEventRateLimited=!1,this.checkForLimiting=r=>{var o=r.text;if(o&&o.length)try{(JSON.parse(o).quota_limited||[]).forEach((s=>{c3e.info((s||"events")+" is quota limited."),this.serverLimits[s]=new Date().getTime()+6e4}))}catch(s){return void c3e.warn('could not rate limit - continuing. Error: "'+s?.message+'"',{text:o})}},this.instance=e,this.captureEventsPerSecond=((t=e.config.rate_limiting)==null?void 0:t.events_per_second)||10,this.captureEventsBurstLimit=Math.max(((i=e.config.rate_limiting)==null?void 0:i.events_burst_limit)||10*this.captureEventsPerSecond,this.captureEventsPerSecond),this.lastEventRateLimited=this.clientRateLimitContext(!0).isRateLimited}clientRateLimitContext(e){var t,i,r;e===void 0&&(e=!1);var o=new Date().getTime(),s=(t=(i=this.instance.persistence)==null?void 0:i.get_property(bZ))!==null&&t!==void 0?t:{tokens:this.captureEventsBurstLimit,last:o};s.tokens+=(o-s.last)/1e3*this.captureEventsPerSecond,s.last=o,s.tokens>this.captureEventsBurstLimit&&(s.tokens=this.captureEventsBurstLimit);var a=s.tokens<1;return a||e||(s.tokens=Math.max(0,s.tokens-1)),!a||this.lastEventRateLimited||e||this.instance.capture("$$client_ingestion_warning",{$$client_ingestion_warning_message:"posthog-js client rate limited. Config is set to "+this.captureEventsPerSecond+" events per second and "+this.captureEventsBurstLimit+" events burst limit."},{skip_client_rate_limiting:!0}),this.lastEventRateLimited=a,(r=this.instance.persistence)==null||r.set_property(bZ,s),{isRateLimited:a,remainingTokens:s.tokens}}isServerRateLimited(e){var t=this.serverLimits[e||"events"]||!1;return t!==!1&&new Date().getTime()<t}};var mA=x1("[RemoteConfig]");let B1t=class{constructor(e){this._instance=e}get remoteConfig(){var e;return(e=Bs._POSTHOG_REMOTE_CONFIG)==null||(e=e[this._instance.config.token])==null?void 0:e.config}yr(e){var t,i;(t=Bs.__PosthogExtensions__)!=null&&t.loadExternalDependency?(i=Bs.__PosthogExtensions__)==null||i.loadExternalDependency==null||i.loadExternalDependency(this._instance,"remote-config",(()=>e(this.remoteConfig))):(mA.error("PostHog Extensions not found. Cannot load remote config."),e())}wr(e){this._instance.Te({method:"GET",url:this._instance.requestRouter.endpointFor("assets","/array/"+this._instance.config.token+"/config"),callback:t=>{e(t.json)}})}load(){try{if(this.remoteConfig)return mA.info("Using preloaded remote config",this.remoteConfig),void this.Ce(this.remoteConfig);if(this._instance.L())return void mA.warn("Remote config is disabled. Falling back to local config.");this.yr((e=>{if(!e)return mA.info("No config found after loading remote JS config. Falling back to JSON."),void this.wr((t=>{this.Ce(t)}));this.Ce(e)}))}catch(e){mA.error("Error loading remote config",e)}}Ce(e){e?this._instance.config.__preview_remote_config?(this._instance.Ce(e),e.hasFeatureFlags!==!1&&this._instance.featureFlags.ensureFlagsLoaded()):mA.info("__preview_remote_config is disabled. Logging config instead",e):mA.error("Failed to fetch remote config from PostHog.")}};var uK=3e3;let U1t=class{constructor(e,t){this.Sr=!0,this.$r=[],this.kr=xw(t?.flush_interval_ms||uK,250,5e3,Yr.createLogger("flush interval"),uK),this.Er=e}enqueue(e){this.$r.push(e),this.Ir||this.Rr()}unload(){this.Pr();var e=this.$r.length>0?this.Tr():{},t=Object.values(e);[...t.filter((i=>i.url.indexOf("/e")===0)),...t.filter((i=>i.url.indexOf("/e")!==0))].map((i=>{this.Er(Qr({},i,{transport:"sendBeacon"}))}))}enable(){this.Sr=!1,this.Rr()}Rr(){var e=this;this.Sr||(this.Ir=setTimeout((()=>{if(this.Pr(),this.$r.length>0){var t=this.Tr(),i=function(){var o=t[r],s=new Date().getTime();o.data&&p0(o.data)&&vf(o.data,(a=>{a.offset=Math.abs(a.timestamp-s),delete a.timestamp})),e.Er(o)};for(var r in t)i()}}),this.kr))}Pr(){clearTimeout(this.Ir),this.Ir=void 0}Tr(){var e={};return vf(this.$r,(t=>{var i,r=t,o=(r?r.batchKey:null)||r.url;br(e[o])&&(e[o]=Qr({},r,{data:[]})),(i=e[o].data)==null||i.push(r.data)})),this.$r=[],e}};var j1t=["retriesPerformedSoFar"];let H1t=class{constructor(e){this.Cr=!1,this.Mr=3e3,this.$r=[],this._instance=e,this.$r=[],this.Or=!0,!br(qn)&&"onLine"in qn.navigator&&(this.Or=qn.navigator.onLine,M_(qn,"online",(()=>{this.Or=!0,this.oe()})),M_(qn,"offline",(()=>{this.Or=!1})))}get length(){return this.$r.length}retriableRequest(e){var{retriesPerformedSoFar:t}=e,i=o5e(e,j1t);wx(t)&&t>0&&(i.url=S7(i.url,{retry_count:t})),this._instance.Te(Qr({},i,{callback:r=>{r.statusCode!==200&&(r.statusCode<400||r.statusCode>=500)&&(t??0)<10?this.Fr(Qr({retriesPerformedSoFar:t},i)):i.callback==null||i.callback(r)}}))}Fr(e){var t=e.retriesPerformedSoFar||0;e.retriesPerformedSoFar=t+1;var i=(function(s){var a=3e3*Math.pow(2,s),c=a/2,l=Math.min(18e5,a),u=(Math.random()-.5)*(l-c);return Math.ceil(l+u)})(t),r=Date.now()+i;this.$r.push({retryAt:r,requestOptions:e});var o="Enqueued failed request for retry in "+i;navigator.onLine||(o+=" (Browser is offline)"),Yr.warn(o),this.Cr||(this.Cr=!0,this.Ar())}Ar(){this.Dr&&clearTimeout(this.Dr),this.Dr=setTimeout((()=>{this.Or&&this.$r.length>0&&this.oe(),this.Ar()}),this.Mr)}oe(){var e=Date.now(),t=[],i=this.$r.filter((o=>o.retryAt<e||(t.push(o),!1)));if(this.$r=t,i.length>0)for(var{requestOptions:r}of i)this.retriableRequest(r)}unload(){for(var{requestOptions:e}of(this.Dr&&(clearTimeout(this.Dr),this.Dr=void 0),this.$r))try{this._instance.Te(Qr({},e,{transport:"sendBeacon"}))}catch(t){Yr.error(t)}this.$r=[]}},V1t=class{constructor(e){this.jr=()=>{var t,i,r,o;this.Lr||(this.Lr={});var s=this.scrollElement(),a=this.scrollY(),c=s?Math.max(0,s.scrollHeight-s.clientHeight):0,l=a+(s?.clientHeight||0),u=s?.scrollHeight||0;this.Lr.lastScrollY=Math.ceil(a),this.Lr.maxScrollY=Math.max(a,(t=this.Lr.maxScrollY)!==null&&t!==void 0?t:0),this.Lr.maxScrollHeight=Math.max(c,(i=this.Lr.maxScrollHeight)!==null&&i!==void 0?i:0),this.Lr.lastContentY=l,this.Lr.maxContentY=Math.max(l,(r=this.Lr.maxContentY)!==null&&r!==void 0?r:0),this.Lr.maxContentHeight=Math.max(u,(o=this.Lr.maxContentHeight)!==null&&o!==void 0?o:0)},this._instance=e}getContext(){return this.Lr}resetContext(){var e=this.Lr;return setTimeout(this.jr,0),e}startMeasuringScrollPosition(){M_(qn,"scroll",this.jr,{capture:!0}),M_(qn,"scrollend",this.jr,{capture:!0}),M_(qn,"resize",this.jr)}scrollElement(){if(!this._instance.config.scroll_root_selector)return qn?.document.documentElement;var e=p0(this._instance.config.scroll_root_selector)?this._instance.config.scroll_root_selector:[this._instance.config.scroll_root_selector];for(var t of e){var i=qn?.document.querySelector(t);if(i)return i}}scrollY(){if(this._instance.config.scroll_root_selector){var e=this.scrollElement();return e&&e.scrollTop||0}return qn&&(qn.scrollY||qn.pageYOffset||qn.document.documentElement.scrollTop)||0}scrollX(){if(this._instance.config.scroll_root_selector){var e=this.scrollElement();return e&&e.scrollLeft||0}return qn&&(qn.scrollX||qn.pageXOffset||qn.document.documentElement.scrollLeft)||0}};var G1t=n=>JTe(n?.config.mask_personal_data_properties,n?.config.custom_personal_data_properties);let l3e=class{constructor(e,t,i,r){this.Nr=o=>{var s=this.zr();if(!s||s.sessionId!==o){var a={sessionId:o,props:this.Ur(this._instance)};this.qr.register({[gZ]:a})}},this._instance=e,this.Br=t,this.qr=i,this.Ur=r||G1t,this.Br.onSessionId(this.Nr)}zr(){return this.qr.props[gZ]}getSetOnceProps(){var e,t=(e=this.zr())==null?void 0:e.props;return t?"r"in t?e3e(t):{$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(){var e={};return vf(dZ(this.getSetOnceProps()),((t,i)=>{i==="$current_url"&&(i="url"),e["$session_entry_"+cZ(i)]=t})),e}};var dK=x1("[SessionId]");let u3e=class{constructor(e,t,i){var r;if(this.Hr=[],this.Wr=(u,d)=>Math.abs(u-d)>this.sessionTimeoutMs,!e.persistence)throw new Error("SessionIdManager requires a PostHogPersistence instance");if(e.config.cookieless_mode==="always")throw new Error('SessionIdManager cannot be used with cookieless_mode="always"');this.A=e.config,this.qr=e.persistence,this.gi=void 0,this.Ft=void 0,this._sessionStartTimestamp=null,this._sessionActivityTimestamp=null,this.Gr=t||s3,this.Jr=i||s3;var o=this.A.persistence_name||this.A.token,s=this.A.session_idle_timeout_seconds||1800;if(this._sessionTimeoutMs=1e3*xw(s,60,36e3,dK.createLogger("session_idle_timeout_seconds"),1800),e.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this.Vr(),this.Kr="ph_"+o+"_window_id",this.Yr="ph_"+o+"_primary_window_exists",this.Xr()){var a=Xb.K(this.Kr),c=Xb.K(this.Yr);a&&!c?this.gi=a:Xb.X(this.Kr),Xb.Y(this.Yr,!0)}if((r=this.A.bootstrap)!=null&&r.sessionID)try{var l=(u=>{var d=u.replace(/-/g,"");if(d.length!==32)throw new Error("Not a valid UUID");if(d[12]!=="7")throw new Error("Not a UUIDv7");return parseInt(d.substring(0,12),16)})(this.A.bootstrap.sessionID);this.Qr(this.A.bootstrap.sessionID,new Date().getTime(),l)}catch(u){dK.error("Invalid sessionID in bootstrap",u)}this.Zr()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(e){return br(this.Hr)&&(this.Hr=[]),this.Hr.push(e),this.Ft&&e(this.Ft,this.gi),()=>{this.Hr=this.Hr.filter((t=>t!==e))}}Xr(){return this.A.persistence!=="memory"&&!this.qr.je&&Xb.G()}ts(e){e!==this.gi&&(this.gi=e,this.Xr()&&Xb.Y(this.Kr,e))}es(){return this.gi?this.gi:this.Xr()?Xb.K(this.Kr):null}Qr(e,t,i){e===this.Ft&&t===this._sessionActivityTimestamp&&i===this._sessionStartTimestamp||(this._sessionStartTimestamp=i,this._sessionActivityTimestamp=t,this.Ft=e,this.qr.register({[i7]:[t,e,i]}))}rs(){if(this.Ft&&this._sessionActivityTimestamp&&this._sessionStartTimestamp)return[this._sessionActivityTimestamp,this.Ft,this._sessionStartTimestamp];var e=this.qr.props[i7];return p0(e)&&e.length===2&&e.push(e[0]),e||[0,null,0]}resetSessionId(){this.Qr(null,null,null)}Zr(){M_(qn,"beforeunload",(()=>{this.Xr()&&Xb.X(this.Yr)}),{capture:!1})}checkAndGetSessionAndWindowId(e,t){if(e===void 0&&(e=!1),t===void 0&&(t=null),this.A.cookieless_mode==="always")throw new Error('checkAndGetSessionAndWindowId should not be called with cookieless_mode="always"');var i=t||new Date().getTime(),[r,o,s]=this.rs(),a=this.es(),c=wx(s)&&s>0&&Math.abs(i-s)>864e5,l=!1,u=!o,d=!e&&this.Wr(i,r);u||d||c?(o=this.Gr(),a=this.Jr(),dK.info("new session ID generated",{sessionId:o,windowId:a,changeReason:{noSessionId:u,activityTimeout:d,sessionPastMaximumLength:c}}),s=i,l=!0):a||(a=this.Jr(),l=!0);var h=r===0||!e||c?i:r,f=s===0?new Date().getTime():s;return this.ts(a),this.Qr(o,h,f),e||this.Vr(),l&&this.Hr.forEach((m=>m(o,a,l?{noSessionId:u,activityTimeout:d,sessionPastMaximumLength:c}:void 0))),{sessionId:o,windowId:a,sessionStartTimestamp:f,changeReason:l?{noSessionId:u,activityTimeout:d,sessionPastMaximumLength:c}:void 0,lastActivityTimestamp:r}}Vr(){clearTimeout(this.ss),this.ss=setTimeout((()=>{var[e]=this.rs();this.Wr(new Date().getTime(),e)&&this.resetSessionId()}),1.1*this.sessionTimeoutMs)}};var Y1t=["$set_once","$set"],l3=x1("[SiteApps]");let q1t=class{constructor(e){this._instance=e,this.ns=[],this.apps={}}get isEnabled(){return!!this._instance.config.opt_in_site_apps}os(e,t){if(t){var i=this.globalsForEvent(t);this.ns.push(i),this.ns.length>1e3&&(this.ns=this.ns.slice(10))}}get siteAppLoaders(){var e;return(e=Bs._POSTHOG_REMOTE_CONFIG)==null||(e=e[this._instance.config.token])==null?void 0:e.siteApps}init(){if(this.isEnabled){var e=this._instance.Ye(this.os.bind(this));this.ls=()=>{e(),this.ns=[],this.ls=void 0}}}globalsForEvent(e){var t,i,r,o,s,a,c;if(!e)throw new Error("Event payload is required");var l={},u=this._instance.get_property("$groups")||[],d=this._instance.get_property("$stored_group_properties")||{};for(var[h,f]of Object.entries(d))l[h]={id:u[h],type:h,properties:f};var{$set_once:m,$set:y}=e;return{event:Qr({},o5e(e,Y1t),{properties:Qr({},e.properties,y?{$set:Qr({},(t=(i=e.properties)==null?void 0:i.$set)!==null&&t!==void 0?t:{},y)}:{},m?{$set_once:Qr({},(r=(o=e.properties)==null?void 0:o.$set_once)!==null&&r!==void 0?r:{},m)}:{}),elements_chain:(s=(a=e.properties)==null?void 0:a.$elements_chain)!==null&&s!==void 0?s:"",distinct_id:(c=e.properties)==null?void 0:c.distinct_id}),person:{properties:this._instance.get_property("$stored_person_properties")},groups:l}}setupSiteApp(e){var t=this.apps[e.id],i=()=>{var a;!t.errored&&this.ns.length&&(l3.info("Processing "+this.ns.length+" events for site app with id "+e.id),this.ns.forEach((c=>t.processEvent==null?void 0:t.processEvent(c))),t.processedBuffer=!0),Object.values(this.apps).every((c=>c.processedBuffer||c.errored))&&((a=this.ls)==null||a.call(this))},r=!1,o=a=>{t.errored=!a,t.loaded=!0,l3.info("Site app with id "+e.id+" "+(a?"loaded":"errored")),r&&i()};try{var{processEvent:s}=e.init({posthog:this._instance,callback:a=>{o(a)}});s&&(t.processEvent=s),r=!0}catch(a){l3.error("Error while initializing PostHog app with config id "+e.id,a),o(!1)}if(r&&t.loaded)try{i()}catch(a){l3.error("Error while processing buffered events PostHog app with config id "+e.id,a),t.errored=!0}}hs(){var e=this.siteAppLoaders||[];for(var t of e)this.apps[t.id]={id:t.id,loaded:!1,errored:!1,processedBuffer:!1};for(var i of e)this.setupSiteApp(i)}us(e){if(Object.keys(this.apps).length!==0){var t=this.globalsForEvent(e);for(var i of Object.values(this.apps))try{i.processEvent==null||i.processEvent(t)}catch(r){l3.error("Error while processing event "+e.event+" for site app "+i.id,r)}}}onRemoteConfig(e){var t,i,r,o=this;if((t=this.siteAppLoaders)!=null&&t.length)return this.isEnabled?(this.hs(),void this._instance.on("eventCaptured",(l=>this.us(l)))):void l3.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.');if((i=this.ls)==null||i.call(this),(r=e.siteApps)!=null&&r.length)if(this.isEnabled){var s=function(l){var u;Bs["__$$ph_site_app_"+l]=o._instance,(u=Bs.__PosthogExtensions__)==null||u.loadSiteApp==null||u.loadSiteApp(o._instance,c,(d=>{if(d)return l3.error("Error while initializing PostHog app with config id "+l,d)}))};for(var{id:a,url:c}of e.siteApps)s(a)}else l3.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}};var X1t=["amazonbot","amazonproductbot","app.hypefactors.com","applebot","archive.org_bot","awariobot","backlinksextendedbot","baiduspider","bingbot","bingpreview","chrome-lighthouse","dataforseobot","deepscan","duckduckbot","facebookexternal","facebookcatalog","http://yandex.com/bots","hubspot","ia_archiver","leikibot","linkedinbot","meta-externalagent","mj12bot","msnbot","nessus","petalbot","pinterest","prerender","rogerbot","screaming frog","sebot-wa","sitebulb","slackbot","slurp","trendictionbot","turnitin","twitterbot","vercel-screenshot","vercelbot","yahoo! slurp","yandexbot","zoombot","bot.htm","bot.php","(bot;","bot/","crawler","ahrefsbot","ahrefssiteaudit","semrushbot","siteauditbot","splitsignalbot","gptbot","oai-searchbot","chatgpt-user","perplexitybot","better uptime bot","sentryuptimebot","uptimerobot","headlesschrome","cypress","google-hoteladsverifier","adsbot-google","apis-google","duplexweb-google","feedfetcher-google","google favicon","google web preview","google-read-aloud","googlebot","googleother","google-cloudvertexbot","googleweblight","mediapartners-google","storebot-google","google-inspectiontool","bytespider"],d3e=function(n,e){if(!n)return!1;var t=n.toLowerCase();return X1t.concat(e||[]).some((i=>{var r=i.toLowerCase();return t.indexOf(r)!==-1}))},h3e=function(n,e){if(!n)return!1;var t=n.userAgent;if(t&&d3e(t,e))return!0;try{var i=n?.userAgentData;if(i!=null&&i.brands&&i.brands.some((r=>d3e(r?.brand,e))))return!0}catch{}return!!n.webdriver},MN=(function(n){return n.US="us",n.EU="eu",n.CUSTOM="custom",n})({}),p3e="i.posthog.com";let W1t=class{constructor(e){this.ds={},this.instance=e}get apiHost(){var e=this.instance.config.api_host.trim().replace(/\/$/,"");return e==="https://app.posthog.com"?"https://us.i.posthog.com":e}get uiHost(){var e,t=(e=this.instance.config.ui_host)==null?void 0:e.replace(/\/$/,"");return t||(t=this.apiHost.replace("."+p3e,".posthog.com")),t==="https://app.posthog.com"?"https://us.posthog.com":t}get region(){return this.ds[this.apiHost]||(/https:\/\/(app|us|us-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?this.ds[this.apiHost]=MN.US:/https:\/\/(eu|eu-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?this.ds[this.apiHost]=MN.EU:this.ds[this.apiHost]=MN.CUSTOM),this.ds[this.apiHost]}endpointFor(e,t){if(t===void 0&&(t=""),t&&(t=t[0]==="/"?t:"/"+t),e==="ui")return this.uiHost+t;if(this.region===MN.CUSTOM)return this.apiHost+t;var i=p3e+t;switch(e){case"assets":return"https://"+this.region+"-assets."+i;case"api":return"https://"+this.region+"."+i}}};var Z1t={icontains:(n,e)=>!!qn&&e.href.toLowerCase().indexOf(n.toLowerCase())>-1,not_icontains:(n,e)=>!!qn&&e.href.toLowerCase().indexOf(n.toLowerCase())===-1,regex:(n,e)=>!!qn&&kC(e.href,n),not_regex:(n,e)=>!!qn&&!kC(e.href,n),exact:(n,e)=>e.href===n,is_not:(n,e)=>e.href!==n};let K1t=class Lv{constructor(e){var t=this;this.getWebExperimentsAndEvaluateDisplayLogic=function(i){i===void 0&&(i=!1),t.getWebExperiments((r=>{Lv.vs("retrieved web experiments from the server"),t.cs=new Map,r.forEach((o=>{if(o.feature_flag_key){var s;t.cs&&(Lv.vs("setting flag key ",o.feature_flag_key," to web experiment ",o),(s=t.cs)==null||s.set(o.feature_flag_key,o));var a=t._instance.getFeatureFlag(o.feature_flag_key);ly(a)&&o.variants[a]&&t.fs(o.name,a,o.variants[a].transforms)}else if(o.variants)for(var c in o.variants){var l=o.variants[c];Lv.ps(l)&&t.fs(o.name,c,l.transforms)}}))}),i)},this._instance=e,this._instance.onFeatureFlags((i=>{this.onFeatureFlags(i)}))}onFeatureFlags(e){if(this._is_bot())Lv.vs("Refusing to render web experiment since the viewer is a likely bot");else if(!this._instance.config.disable_web_experiments){if(Oh(this.cs))return this.cs=new Map,this.loadIfEnabled(),void this.previewWebExperiment();Lv.vs("applying feature flags",e),e.forEach((t=>{var i;if(this.cs&&(i=this.cs)!=null&&i.has(t)){var r,o=this._instance.getFeatureFlag(t),s=(r=this.cs)==null?void 0:r.get(t);o&&s!=null&&s.variants[o]&&this.fs(s.name,o,s.variants[o].transforms)}}))}}previewWebExperiment(){var e=Lv.getWindowLocation();if(e!=null&&e.search){var t=d7(e?.search,"__experiment_id"),i=d7(e?.search,"__experiment_variant");t&&i&&(Lv.vs("previewing web experiments "+t+" && "+i),this.getWebExperiments((r=>{this.gs(parseInt(t),i,r)}),!1,!0))}}loadIfEnabled(){this._instance.config.disable_web_experiments||this.getWebExperimentsAndEvaluateDisplayLogic()}getWebExperiments(e,t,i){if(this._instance.config.disable_web_experiments&&!i)return e([]);var r=this._instance.get_property("$web_experiments");if(r&&!t)return e(r);this._instance.Te({url:this._instance.requestRouter.endpointFor("api","/api/web_experiments/?token="+this._instance.config.token),method:"GET",callback:o=>{if(o.statusCode!==200||!o.json)return e([]);var s=o.json.experiments||[];return e(s)}})}gs(e,t,i){var r=i.filter((o=>o.id===e));r&&r.length>0&&(Lv.vs("Previewing web experiment ["+r[0].name+"] with variant ["+t+"]"),this.fs(r[0].name,t,r[0].variants[t].transforms))}static ps(e){return!Oh(e.conditions)&&Lv._s(e)&&Lv.bs(e)}static _s(e){var t;if(Oh(e.conditions)||Oh((t=e.conditions)==null?void 0:t.url))return!0;var i,r,o,s=Lv.getWindowLocation();return!!s&&((i=e.conditions)==null||!i.url||Z1t[(r=(o=e.conditions)==null?void 0:o.urlMatchType)!==null&&r!==void 0?r:"icontains"](e.conditions.url,s))}static getWindowLocation(){return qn?.location}static bs(e){var t;if(Oh(e.conditions)||Oh((t=e.conditions)==null?void 0:t.utm))return!0;var i=XTe();if(i.utm_source){var r,o,s,a,c,l,u,d,h=(r=e.conditions)==null||(r=r.utm)==null||!r.utm_campaign||((o=e.conditions)==null||(o=o.utm)==null?void 0:o.utm_campaign)==i.utm_campaign,f=(s=e.conditions)==null||(s=s.utm)==null||!s.utm_source||((a=e.conditions)==null||(a=a.utm)==null?void 0:a.utm_source)==i.utm_source,m=(c=e.conditions)==null||(c=c.utm)==null||!c.utm_medium||((l=e.conditions)==null||(l=l.utm)==null?void 0:l.utm_medium)==i.utm_medium,y=(u=e.conditions)==null||(u=u.utm)==null||!u.utm_term||((d=e.conditions)==null||(d=d.utm)==null?void 0:d.utm_term)==i.utm_term;return h&&m&&y&&f}return!1}static vs(e){for(var t=arguments.length,i=new Array(t>1?t-1:0),r=1;r<t;r++)i[r-1]=arguments[r];Yr.info("[WebExperiments] "+e,i)}fs(e,t,i){this._is_bot()?Lv.vs("Refusing to render web experiment since the viewer is a likely bot"):t!=="control"?i.forEach((r=>{if(r.selector){var o;Lv.vs("applying transform of variant "+t+" for experiment "+e+" ",r);var s=(o=document)==null?void 0:o.querySelectorAll(r.selector);s?.forEach((a=>{var c=a;r.html&&(c.innerHTML=r.html),r.css&&c.setAttribute("style",r.css)}))}})):Lv.vs("Control variants leave the page unmodified.")}_is_bot(){return bw&&this._instance?h3e(bw,this._instance.config.custom_blocked_useragents):void 0}};var Q1t=x1("[PostHog ExternalIntegrations]"),J1t={intercom:"intercom-integration",crispChat:"crisp-chat-integration"};let ebt=class{constructor(e){this._instance=e}nt(e,t){var i;(i=Bs.__PosthogExtensions__)==null||i.loadExternalDependency==null||i.loadExternalDependency(this._instance,e,(r=>{if(r)return Q1t.error("failed to load script",r);t()}))}startIfEnabledOrStop(){var e=this,t=function(s){var a,c,l;!r||(a=Bs.__PosthogExtensions__)!=null&&(a=a.integrations)!=null&&a[s]||e.nt(J1t[s],(()=>{var u;(u=Bs.__PosthogExtensions__)==null||(u=u.integrations)==null||(u=u[s])==null||u.start(e._instance)})),!r&&(c=Bs.__PosthogExtensions__)!=null&&(c=c.integrations)!=null&&c[s]&&((l=Bs.__PosthogExtensions__)==null||(l=l.integrations)==null||(l=l[s])==null||l.stop())};for(var[i,r]of Object.entries((o=this._instance.config.integrations)!==null&&o!==void 0?o:{})){var o;t(i)}}};var hK="[SessionRecording]",C7=x1(hK);let tbt=class{get started(){var e;return!((e=this.ys)==null||!e.isStarted)}get status(){var e;return this.qt?((e=this.ys)==null?void 0:e.status)||"lazy_loading":C5}constructor(e){if(this._forceAllowLocalhostNetworkCapture=!1,this._instance=e,!this._instance.sessionManager)throw C7.error("started without valid sessionManager"),new Error(hK+" started without valid sessionManager. This is a bug.");if(this._instance.config.cookieless_mode==="always")throw new Error(hK+' cannot be used with cookieless_mode="always"')}get qt(){var e=!!this._instance.get_property(aN),t=!this._instance.config.disable_session_recording,i=this._instance.config.disable_session_recording||this._instance.consent.isOptedOut();return qn&&e&&t&&!i}startIfEnabledOrStop(e){var t;if(!this.qt||(t=this.ys)==null||!t.isStarted){var i=!br(Object.assign)&&!br(Array.from);this.qt&&i?(this.ws(e),C7.info("starting")):this.stopRecording()}}ws(e){var t,i,r;this.qt&&(Bs!=null&&(t=Bs.__PosthogExtensions__)!=null&&(t=t.rrweb)!=null&&t.record&&(i=Bs.__PosthogExtensions__)!=null&&i.initSessionRecording?this.Ri(e):(r=Bs.__PosthogExtensions__)==null||r.loadExternalDependency==null||r.loadExternalDependency(this._instance,this.Pi,(o=>{if(o)return C7.error("could not load recorder",o);this.Ri(e)})))}stopRecording(){var e;(e=this.ys)==null||e.stop()}onRemoteConfig(e){this.Ss=e;var t,i=this._instance.persistence;i&&i.register({[aN]:!!e.sessionRecording,[n7]:(t=e.sessionRecording)==null?void 0:t.scriptConfig}),this.ys?(this.ys.onRemoteConfig(e),this.Ss=void 0):this.ws(),this.startIfEnabledOrStop()}log(e,t){var i;t===void 0&&(t="log"),(i=this.ys)!=null&&i.log?this.ys.log(e,t):C7.warn("log called before recorder was ready")}get Pi(){var e;return((e=this._instance)==null||(e=e.persistence)==null||(e=e.get_property(n7))==null?void 0:e.script)||"lazy-recorder"}Ri(e){var t,i;if((t=Bs.__PosthogExtensions__)==null||!t.initSessionRecording)throw Error("Called on script loaded before session recording is available");this.ys||(this.ys=(i=Bs.__PosthogExtensions__)==null?void 0:i.initSessionRecording(this._instance),this.ys._forceAllowLocalhostNetworkCapture=this._forceAllowLocalhostNetworkCapture,this.Ss&&(this.ys.onRemoteConfig(this.Ss),this.Ss=void 0)),this.ys.start(e)}onRRwebEmit(e){var t;(t=this.ys)==null||t.onRRwebEmit==null||t.onRRwebEmit(e)}overrideLinkedFlag(){var e;(e=this.ys)==null||e.overrideLinkedFlag()}overrideSampling(){var e;(e=this.ys)==null||e.overrideSampling()}overrideTrigger(e){var t;(t=this.ys)==null||t.overrideTrigger(e)}get sdkDebugProperties(){var e;return((e=this.ys)==null?void 0:e.sdkDebugProperties)||{$recording_status:this.status}}};var AN={},pK=()=>{},$C="posthog",f3e=!p1t&&$v?.indexOf("MSIE")===-1&&$v?.indexOf("Mozilla")===-1,m3e=n=>{var e;return{api_host:"https://us.i.posthog.com",ui_host:null,token:"",autocapture:!0,rageclick:!0,cross_subdomain_cookie:Vyt(Kr?.location),persistence:"localStorage+cookie",persistence_name:"",loaded:pK,save_campaign_params:!0,custom_campaign_params:[],custom_blocked_useragents:[],save_referrer:!0,capture_pageview:n!=="2025-05-24"||"history_change",capture_pageleave:"if_capture_pageview",defaults:n??"unset",debug:zv&&ly(zv?.search)&&zv.search.indexOf("__posthog_debug=true")!==-1||!1,cookie_expiration:365,upgrade:!1,disable_session_recording:!1,disable_persistence:!1,disable_web_experiments:!0,disable_surveys:!1,disable_surveys_automatic_display:!1,disable_external_dependency_loading:!1,enable_recording_console_log:void 0,secure_cookie:(qn==null||(e=qn.location)==null?void 0:e.protocol)==="https:",ip:!1,opt_out_capturing_by_default:!1,opt_out_persistence_by_default:!1,opt_out_useragent_filter:!1,opt_out_capturing_persistence_type:"localStorage",consent_persistence_name:null,opt_out_capturing_cookie_prefix:null,opt_in_site_apps:!1,property_denylist:[],respect_dnt:!1,sanitize_properties:null,request_headers:{},request_batching:!0,properties_string_max_length:65535,session_recording:{},mask_all_element_attributes:!1,mask_all_text:!1,mask_personal_data_properties:!1,custom_personal_data_properties:[],advanced_disable_flags:!1,advanced_disable_decide:!1,advanced_disable_feature_flags:!1,advanced_disable_feature_flags_on_first_load:!1,advanced_only_evaluate_survey_feature_flags:!1,advanced_enable_surveys:!1,advanced_disable_toolbar_metrics:!1,feature_flag_request_timeout_ms:3e3,surveys_request_timeout_ms:1e4,on_request_error:t=>{var i="Bad HTTP status: "+t.statusCode+" "+t.text;Yr.error(i)},get_device_id:t=>t,capture_performance:void 0,name:"posthog",bootstrap:{},disable_compression:!1,session_idle_timeout_seconds:1800,person_profiles:"identified_only",before_send:void 0,request_queue_config:{flush_interval_ms:uK},error_tracking:{},_onCapture:pK}},_3e=n=>{var e={};br(n.process_person)||(e.person_profiles=n.process_person),br(n.xhr_headers)||(e.request_headers=n.xhr_headers),br(n.cookie_name)||(e.persistence_name=n.cookie_name),br(n.disable_cookie)||(e.disable_persistence=n.disable_cookie),br(n.store_google)||(e.save_campaign_params=n.store_google),br(n.verbose)||(e.debug=n.verbose);var t=qy({},e,n);return p0(n.property_blacklist)&&(br(n.property_denylist)?t.property_denylist=n.property_blacklist:p0(n.property_denylist)?t.property_denylist=[...n.property_blacklist,...n.property_denylist]:Yr.error("Invalid value for property_denylist config: "+n.property_denylist)),t};let nbt=class{constructor(){this.__forceAllowLocalhost=!1}get $s(){return this.__forceAllowLocalhost}set $s(e){Yr.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=e}},y3e=class O0t{get decideEndpointWasHit(){var e,t;return(e=(t=this.featureFlags)==null?void 0:t.hasLoadedFlags)!==null&&e!==void 0&&e}get flagsEndpointWasHit(){var e,t;return(e=(t=this.featureFlags)==null?void 0:t.hasLoadedFlags)!==null&&e!==void 0&&e}constructor(){this.webPerformance=new nbt,this.ks=!1,this.version=w5.LIB_VERSION,this.xs=new o3e,this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=m3e(),this.SentryIntegration=i1t,this.sentryIntegration=e=>(function(t,i){var r=vTe(t,i);return{name:xTe,processEvent:o=>r(o)}})(this,e),this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this.Es=!1,this.Is=null,this.Rs=null,this.Ps=null,this.featureFlags=new N1t(this),this.toolbar=new o1t(this),this.scrollManager=new V1t(this),this.pageViewManager=new d1t(this),this.surveys=new $1t(this),this.experiments=new K1t(this),this.exceptions=new m1t(this),this.rateLimiter=new F1t(this),this.requestRouter=new W1t(this),this.consent=new fgt(this),this.externalIntegrations=new ebt(this),this.people={set:(e,t,i)=>{var r=ly(e)?{[e]:t}:e;this.setPersonProperties(r),i?.({})},set_once:(e,t,i)=>{var r=ly(e)?{[e]:t}:e;this.setPersonProperties(void 0,r),i?.({})}},this.on("eventCaptured",(e=>Yr.info('send "'+e?.event+'"',e)))}init(e,t,i){if(i&&i!==$C){var r,o=(r=AN[i])!==null&&r!==void 0?r:new O0t;return o._init(e,t,i),AN[i]=o,AN[$C][i]=o,o}return this._init(e,t,i)}_init(e,t,i){var r,o;if(t===void 0&&(t={}),br(e)||lZ(e))return Yr.critical("PostHog was initialized without a token. This likely indicates a misconfiguration. Please check the first argument passed to posthog.init()"),this;if(this.__loaded)return Yr.warn("You have already initialized PostHog! Re-initializing is a no-op"),this;this.__loaded=!0,this.config={},this.Ts=t,this.Cs=[],t.person_profiles&&(this.Rs=t.person_profiles),this.set_config(qy({},m3e(t.defaults),_3e(t),{name:i,token:e})),this.config.on_xhr_error&&Yr.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=t.disable_compression?void 0:E5.GZipJS;var s=this.Ms();this.persistence=new sK(this.config,s),this.sessionPersistence=this.config.persistence==="sessionStorage"||this.config.persistence==="memory"?this.persistence:new sK(Qr({},this.config,{persistence:"sessionStorage"}),s);var a=Qr({},this.persistence.props),c=Qr({},this.sessionPersistence.props);this.register({$initialization_time:new Date().toISOString()}),this.Os=new U1t((w=>this.Fs(w)),this.config.request_queue_config),this.As=new H1t(this),this.__request_queue=[];var l=this.config.cookieless_mode==="always"||this.config.cookieless_mode==="on_reject"&&this.consent.isExplicitlyOptedOut();if(l||(this.sessionManager=new u3e(this),this.sessionPropsManager=new l3e(this,this.sessionManager,this.persistence)),new a1t(this).startIfEnabledOrStop(),this.siteApps=new q1t(this),(r=this.siteApps)==null||r.init(),l||(this.config.__preview_lazy_load_replay?this.sessionRecording=new tbt(this):this.sessionRecording=new bTe(this),this.sessionRecording.startIfEnabledOrStop()),this.config.disable_scroll_properties||this.scrollManager.startMeasuringScrollPosition(),this.autocapture=new ogt(this),this.autocapture.startIfEnabled(),this.surveys.loadIfEnabled(),this.heatmaps=new u1t(this),this.heatmaps.startIfEnabled(),this.webVitalsAutocapture=new c1t(this),this.exceptionObserver=new ygt(this),this.exceptionObserver.startIfEnabled(),this.deadClicksAutocapture=new G5e(this,_gt),this.deadClicksAutocapture.startIfEnabled(),this.historyAutocapture=new Igt(this),this.historyAutocapture.startIfEnabled(),w5.DEBUG=w5.DEBUG||this.config.debug,w5.DEBUG&&Yr.info("Starting in debug mode",{this:this,config:t,thisC:Qr({},this.config),p:a,s:c}),((o=t.bootstrap)==null?void 0:o.distinctID)!==void 0){var u,d,h=this.config.get_device_id(s3()),f=(u=t.bootstrap)!=null&&u.isIdentifiedID?h:t.bootstrap.distinctID;this.persistence.set_property(S5,(d=t.bootstrap)!=null&&d.isIdentifiedID?"identified":"anonymous"),this.register({distinct_id:t.bootstrap.distinctID,$device_id:f})}if(this.Ds()){var m,y,g=Object.keys(((m=t.bootstrap)==null?void 0:m.featureFlags)||{}).filter((w=>{var T;return!((T=t.bootstrap)==null||(T=T.featureFlags)==null||!T[w])})).reduce(((w,T)=>{var N;return w[T]=((N=t.bootstrap)==null||(N=N.featureFlags)==null?void 0:N[T])||!1,w}),{}),b=Object.keys(((y=t.bootstrap)==null?void 0:y.featureFlagPayloads)||{}).filter((w=>g[w])).reduce(((w,T)=>{var N,R;return(N=t.bootstrap)!=null&&(N=N.featureFlagPayloads)!=null&&N[T]&&(w[T]=(R=t.bootstrap)==null||(R=R.featureFlagPayloads)==null?void 0:R[T]),w}),{});this.featureFlags.receivedFeatureFlags({featureFlags:g,featureFlagPayloads:b})}if(l)this.register_once({distinct_id:dN,$device_id:null},"");else if(!this.get_distinct_id()){var v=this.config.get_device_id(s3());this.register_once({distinct_id:v,$device_id:v},""),this.persistence.set_property(S5,"anonymous")}return M_(qn,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),this.toolbar.maybeLoadToolbar(),t.segment?n1t(this,(()=>this.js())):this.js(),h2(this.config._onCapture)&&this.config._onCapture!==pK&&(Yr.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",(w=>this.config._onCapture(w.event,w)))),this.config.ip&&Yr.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}Ce(e){var t,i,r,o,s,a,c,l;if(!Kr||!Kr.body)return Yr.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout((()=>{this.Ce(e)}),500);this.compression=void 0,e.supportedCompression&&!this.config.disable_compression&&(this.compression=Fl(e.supportedCompression,E5.GZipJS)?E5.GZipJS:Fl(e.supportedCompression,E5.Base64)?E5.Base64:void 0),(t=e.analytics)!=null&&t.endpoint&&(this.analyticsDefaultEndpoint=e.analytics.endpoint),this.set_config({person_profiles:this.Rs?this.Rs:"identified_only"}),(i=this.siteApps)==null||i.onRemoteConfig(e),(r=this.sessionRecording)==null||r.onRemoteConfig(e),(o=this.autocapture)==null||o.onRemoteConfig(e),(s=this.heatmaps)==null||s.onRemoteConfig(e),this.surveys.onRemoteConfig(e),(a=this.webVitalsAutocapture)==null||a.onRemoteConfig(e),(c=this.exceptionObserver)==null||c.onRemoteConfig(e),this.exceptions.onRemoteConfig(e),(l=this.deadClicksAutocapture)==null||l.onRemoteConfig(e)}js(){try{this.config.loaded(this)}catch(e){Yr.critical("`loaded` function failed",e)}this.Ls(),this.config.capture_pageview&&setTimeout((()=>{(this.consent.isOptedIn()||this.config.cookieless_mode==="always")&&this.Ns()}),1),new B1t(this).load(),this.featureFlags.flags()}Ls(){var e;this.is_capturing()&&this.config.request_batching&&((e=this.Os)==null||e.enable())}_dom_loaded(){this.is_capturing()&&r3(this.__request_queue,(e=>this.Fs(e))),this.__request_queue=[],this.Ls()}_handle_unload(){var e,t;this.config.request_batching?(this.zs()&&this.capture("$pageleave"),(e=this.Os)==null||e.unload(),(t=this.As)==null||t.unload()):this.zs()&&this.capture("$pageleave",null,{transport:"sendBeacon"})}Te(e){this.__loaded&&(f3e?this.__request_queue.push(e):this.rateLimiter.isServerRateLimited(e.batchKey)||(e.transport=e.transport||this.config.api_transport,e.url=S7(e.url,{ip:this.config.ip?1:0}),e.headers=Qr({},this.config.request_headers),e.compression=e.compression==="best-available"?this.compression:e.compression,e.fetchOptions=e.fetchOptions||this.config.fetch_options,(t=>{var i,r,o,s=Qr({},t);s.timeout=s.timeout||6e4,s.url=S7(s.url,{_:new Date().getTime().toString(),ver:w5.LIB_VERSION,compression:s.compression});var a=(i=s.transport)!==null&&i!==void 0?i:"fetch",c=(r=(o=h5e(bN,(l=>l.transport===a)))==null?void 0:o.method)!==null&&r!==void 0?r:bN[0].method;if(!c)throw new Error("No available transport method");c(s)})(Qr({},e,{callback:t=>{var i,r;this.rateLimiter.checkForLimiting(t),t.statusCode>=400&&((i=(r=this.config).on_request_error)==null||i.call(r,t)),e.callback==null||e.callback(t)}}))))}Fs(e){this.As?this.As.retriableRequest(e):this.Te(e)}_execute_array(e){var t,i=[],r=[],o=[];r3(e,(a=>{a&&(t=a[0],p0(t)?o.push(a):h2(a)?a.call(this):p0(a)&&t==="alias"?i.push(a):p0(a)&&t.indexOf("capture")!==-1&&h2(this[t])?o.push(a):r.push(a))}));var s=function(a,c){r3(a,(function(l){if(p0(l[0])){var u=c;vf(l,(function(d){u=u[d[0]].apply(u,d.slice(1))}))}else this[l[0]].apply(this,l.slice(1))}),c)};s(i,this),s(r,this),s(o,this)}Ds(){var e,t;return((e=this.config.bootstrap)==null?void 0:e.featureFlags)&&Object.keys((t=this.config.bootstrap)==null?void 0:t.featureFlags).length>0||!1}push(e){this._execute_array([e])}capture(e,t,i){var r;if(this.__loaded&&this.persistence&&this.sessionPersistence&&this.Os){if(this.is_capturing())if(!br(e)&&ly(e)){if(this.config.opt_out_useragent_filter||!this._is_bot()){var o=i!=null&&i.skip_client_rate_limiting?void 0:this.rateLimiter.clientRateLimitContext();if(o==null||!o.isRateLimited){t!=null&&t.$current_url&&!ly(t?.$current_url)&&(Yr.error("Invalid `$current_url` property provided to `posthog.capture`. Input must be a string. Ignoring provided value."),t==null||delete t.$current_url),this.sessionPersistence.update_search_keyword(),this.config.save_campaign_params&&this.sessionPersistence.update_campaign_params(),this.config.save_referrer&&this.sessionPersistence.update_referrer_info(),(this.config.save_campaign_params||this.config.save_referrer)&&this.persistence.set_initial_person_info();var s=new Date,a=i?.timestamp||s,c=s3(),l={uuid:c,event:e,properties:this.calculateEventProperties(e,t||{},a,c)};o&&(l.properties.$lib_rate_limit_remaining_tokens=o.remainingTokens),i?.$set&&(l.$set=i?.$set);var u,d=this.Us(i?.$set_once);if(d&&(l.$set_once=d),(l=jyt(l,i!=null&&i._noTruncate?null:this.config.properties_string_max_length)).timestamp=a,br(i?.timestamp)||(l.properties.$event_time_override_provided=!0,l.properties.$event_time_override_system_time=s),e===cK.DISMISSED||e===cK.SENT){var h=t?.[s3e.SURVEY_ID],f=t?.[s3e.SURVEY_ITERATION];u={id:h,current_iteration:f},localStorage.getItem(a3e(u))||localStorage.setItem(a3e(u),"true"),l.$set=Qr({},l.$set,{[L1t({id:h,current_iteration:f},e===cK.SENT?"responded":"dismissed")]:!0})}var m=Qr({},l.properties.$set,l.$set);if(AC(m)||this.setPersonPropertiesForFlags(m),!Oh(this.config.before_send)){var y=this.qs(l);if(!y)return;l=y}this.xs.emit("eventCaptured",l);var g={method:"POST",url:(r=i?._url)!==null&&r!==void 0?r:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),data:l,compression:"best-available",batchKey:i?._batchKey};return!this.config.request_batching||i&&(i==null||!i._batchKey)||i!=null&&i.send_instantly?this.Fs(g):this.Os.enqueue(g),l}Yr.critical("This capture call is ignored due to client rate limiting.")}}else Yr.error("No event name provided to posthog.capture")}else Yr.uninitializedWarning("posthog.capture")}Ye(e){return this.on("eventCaptured",(t=>e(t.event,t)))}calculateEventProperties(e,t,i,r,o){if(i=i||new Date,!this.persistence||!this.sessionPersistence)return t;var s=o?void 0:this.persistence.remove_event_timer(e),a=Qr({},t);if(a.token=this.config.token,a.$config_defaults=this.config.defaults,(this.config.cookieless_mode=="always"||this.config.cookieless_mode=="on_reject"&&this.consent.isExplicitlyOptedOut())&&(a.$cookieless_mode=!0),e==="$snapshot"){var c=Qr({},this.persistence.properties(),this.sessionPersistence.properties());return a.distinct_id=c.distinct_id,(!ly(a.distinct_id)&&!wx(a.distinct_id)||lZ(a.distinct_id))&&Yr.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),a}var l,u=R1t(this.config.mask_personal_data_properties,this.config.custom_personal_data_properties);if(this.sessionManager){var{sessionId:d,windowId:h}=this.sessionManager.checkAndGetSessionAndWindowId(o,i.getTime());a.$session_id=d,a.$window_id=h}this.sessionPropsManager&&qy(a,this.sessionPropsManager.getSessionProps());try{var f;this.sessionRecording&&qy(a,this.sessionRecording.sdkDebugProperties),a.$sdk_debug_retry_queue_size=(f=this.As)==null?void 0:f.length}catch(b){a.$sdk_debug_error_capturing_properties=String(b)}if(this.requestRouter.region===MN.CUSTOM&&(a.$lib_custom_api_host=this.config.api_host),l=e!=="$pageview"||o?e!=="$pageleave"||o?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(i):this.pageViewManager.doPageView(i,r),a=qy(a,l),e==="$pageview"&&Kr&&(a.title=Kr.title),!br(s)){var m=i.getTime()-s;a.$duration=parseFloat((m/1e3).toFixed(3))}$v&&this.config.opt_out_useragent_filter&&(a.$browser_type=this._is_bot()?"bot":"browser"),(a=qy({},u,this.persistence.properties(),this.sessionPersistence.properties(),a)).$is_identified=this._isIdentified(),p0(this.config.property_denylist)?vf(this.config.property_denylist,(function(b){delete a[b]})):Yr.error("Invalid value for property_denylist config: "+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);var y=this.config.sanitize_properties;y&&(Yr.error("sanitize_properties is deprecated. Use before_send instead"),a=y(a,e));var g=this.Bs();return a.$process_person_profile=g,g&&!o&&this.Hs("_calculate_event_properties"),a}Us(e){var t;if(!this.persistence||!this.Bs()||this.ks)return e;var i=this.persistence.get_initial_props(),r=(t=this.sessionPropsManager)==null?void 0:t.getSetOnceProps(),o=qy({},i,r||{},e||{}),s=this.config.sanitize_properties;return s&&(Yr.error("sanitize_properties is deprecated. Use before_send instead"),o=s(o,"$set_once")),this.ks=!0,AC(o)?void 0:o}register(e,t){var i;(i=this.persistence)==null||i.register(e,t)}register_once(e,t,i){var r;(r=this.persistence)==null||r.register_once(e,t,i)}register_for_session(e){var t;(t=this.sessionPersistence)==null||t.register(e)}unregister(e){var t;(t=this.persistence)==null||t.unregister(e)}unregister_for_session(e){var t;(t=this.sessionPersistence)==null||t.unregister(e)}Ws(e,t){this.register({[e]:t})}getFeatureFlag(e,t){return this.featureFlags.getFeatureFlag(e,t)}getFeatureFlagPayload(e){var t=this.featureFlags.getFeatureFlagPayload(e);try{return JSON.parse(t)}catch{return t}}isFeatureEnabled(e,t){return this.featureFlags.isFeatureEnabled(e,t)}reloadFeatureFlags(){this.featureFlags.reloadFeatureFlags()}updateEarlyAccessFeatureEnrollment(e,t,i){this.featureFlags.updateEarlyAccessFeatureEnrollment(e,t,i)}getEarlyAccessFeatures(e,t,i){return t===void 0&&(t=!1),this.featureFlags.getEarlyAccessFeatures(e,t,i)}on(e,t){return this.xs.on(e,t)}onFeatureFlags(e){return this.featureFlags.onFeatureFlags(e)}onSurveysLoaded(e){return this.surveys.onSurveysLoaded(e)}onSessionId(e){var t,i;return(t=(i=this.sessionManager)==null?void 0:i.onSessionId(e))!==null&&t!==void 0?t:()=>{}}getSurveys(e,t){t===void 0&&(t=!1),this.surveys.getSurveys(e,t)}getActiveMatchingSurveys(e,t){t===void 0&&(t=!1),this.surveys.getActiveMatchingSurveys(e,t)}renderSurvey(e,t){this.surveys.renderSurvey(e,t)}canRenderSurvey(e){return this.surveys.canRenderSurvey(e)}canRenderSurveyAsync(e,t){return t===void 0&&(t=!1),this.surveys.canRenderSurveyAsync(e,t)}identify(e,t,i){if(!this.__loaded||!this.persistence)return Yr.uninitializedWarning("posthog.identify");if(wx(e)&&(e=e.toString(),Yr.warn("The first argument to posthog.identify was a number, but it should be a string. It has been converted to a string.")),e)if(["distinct_id","distinctid"].includes(e.toLowerCase()))Yr.critical('The string "'+e+'" was set in posthog.identify which indicates an error. This ID should be unique to the user and not a hardcoded string.');else if(e!==dN){if(this.Hs("posthog.identify")){var r=this.get_distinct_id();if(this.register({$user_id:e}),!this.get_property("$device_id")){var o=r;this.register_once({$had_persisted_distinct_id:!0,$device_id:o},"")}e!==r&&e!==this.get_property(oN)&&(this.unregister(oN),this.register({distinct_id:e}));var s=(this.persistence.get_property(S5)||"anonymous")==="anonymous";e!==r&&s?(this.persistence.set_property(S5,"identified"),this.setPersonPropertiesForFlags(Qr({},i||{},t||{}),!1),this.capture("$identify",{distinct_id:e,$anon_distinct_id:r},{$set:t||{},$set_once:i||{}}),this.Ps=ATe(e,t,i),this.featureFlags.setAnonymousDistinctId(r)):(t||i)&&this.setPersonProperties(t,i),e!==r&&(this.reloadFeatureFlags(),this.unregister(o7))}}else Yr.critical('The string "'+dN+'" was set in posthog.identify which indicates an error. This ID is only used as a sentinel value.');else Yr.error("Unique user id has not been set in posthog.identify")}setPersonProperties(e,t){if((e||t)&&this.Hs("posthog.setPersonProperties")){var i=ATe(this.get_distinct_id(),e,t);this.Ps!==i?(this.setPersonPropertiesForFlags(Qr({},t||{},e||{})),this.capture("$set",{$set:e||{},$set_once:t||{}}),this.Ps=i):Yr.info("A duplicate setPersonProperties call was made with the same properties. It has been ignored.")}}group(e,t,i){if(e&&t){if(this.Hs("posthog.group")){var r=this.getGroups();r[e]!==t&&this.resetGroupPropertiesForFlags(e),this.register({$groups:Qr({},r,{[e]:t})}),i&&(this.capture("$groupidentify",{$group_type:e,$group_key:t,$group_set:i}),this.setGroupPropertiesForFlags({[e]:i})),r[e]===t||i||this.reloadFeatureFlags()}}else Yr.error("posthog.group requires a group type and group key")}resetGroups(){this.register({$groups:{}}),this.resetGroupPropertiesForFlags(),this.reloadFeatureFlags()}setPersonPropertiesForFlags(e,t){t===void 0&&(t=!0),this.featureFlags.setPersonPropertiesForFlags(e,t)}resetPersonPropertiesForFlags(){this.featureFlags.resetPersonPropertiesForFlags()}setGroupPropertiesForFlags(e,t){t===void 0&&(t=!0),this.Hs("posthog.setGroupPropertiesForFlags")&&this.featureFlags.setGroupPropertiesForFlags(e,t)}resetGroupPropertiesForFlags(e){this.featureFlags.resetGroupPropertiesForFlags(e)}reset(e){var t,i,r,o;if(Yr.info("reset"),!this.__loaded)return Yr.uninitializedWarning("posthog.reset");var s=this.get_property("$device_id");if(this.consent.reset(),(t=this.persistence)==null||t.clear(),(i=this.sessionPersistence)==null||i.clear(),this.surveys.reset(),this.featureFlags.reset(),(r=this.persistence)==null||r.set_property(S5,"anonymous"),(o=this.sessionManager)==null||o.resetSessionId(),this.Ps=null,this.config.cookieless_mode==="always")this.register_once({distinct_id:dN,$device_id:null},"");else{var a=this.config.get_device_id(s3());this.register_once({distinct_id:a,$device_id:e?a:s},"")}this.register({$last_posthog_reset:new Date().toISOString()},1)}get_distinct_id(){return this.get_property("distinct_id")}getGroups(){return this.get_property("$groups")||{}}get_session_id(){var e,t;return(e=(t=this.sessionManager)==null?void 0:t.checkAndGetSessionAndWindowId(!0).sessionId)!==null&&e!==void 0?e:""}get_session_replay_url(e){if(!this.sessionManager)return"";var{sessionId:t,sessionStartTimestamp:i}=this.sessionManager.checkAndGetSessionAndWindowId(!0),r=this.requestRouter.endpointFor("ui","/project/"+this.config.token+"/replay/"+t);if(e!=null&&e.withTimestamp&&i){var o,s=(o=e.timestampLookBack)!==null&&o!==void 0?o:10;if(!i)return r;r+="?t="+Math.max(Math.floor((new Date().getTime()-i)/1e3)-s,0)}return r}alias(e,t){return e===this.get_property(p5e)?(Yr.critical("Attempting to create alias for existing People user - aborting."),-2):this.Hs("posthog.alias")?(br(t)&&(t=this.get_distinct_id()),e!==t?(this.Ws(oN,e),this.capture("$create_alias",{alias:e,distinct_id:t})):(Yr.warn("alias matches current distinct_id - skipping api call."),this.identify(e),-1)):void 0}set_config(e){var t=Qr({},this.config);if(cy(e)){var i,r,o,s,a;qy(this.config,_3e(e));var c=this.Ms();(i=this.persistence)==null||i.update_config(this.config,t,c),this.sessionPersistence=this.config.persistence==="sessionStorage"||this.config.persistence==="memory"?this.persistence:new sK(Qr({},this.config,{persistence:"sessionStorage"}),c),v1.G()&&v1.V("ph_debug")==="true"&&(this.config.debug=!0),this.config.debug&&(w5.DEBUG=!0,Yr.info("set_config",{config:e,oldConfig:t,newConfig:Qr({},this.config)})),(r=this.sessionRecording)==null||r.startIfEnabledOrStop(),(o=this.autocapture)==null||o.startIfEnabled(),(s=this.heatmaps)==null||s.startIfEnabled(),this.surveys.loadIfEnabled(),this.Gs(),(a=this.externalIntegrations)==null||a.startIfEnabledOrStop()}}startSessionRecording(e){var t=e===!0,i={sampling:t||!(e==null||!e.sampling),linked_flag:t||!(e==null||!e.linked_flag),url_trigger:t||!(e==null||!e.url_trigger),event_trigger:t||!(e==null||!e.event_trigger)};if(Object.values(i).some(Boolean)){var r,o,s,a,c;(r=this.sessionManager)==null||r.checkAndGetSessionAndWindowId(),i.sampling&&((o=this.sessionRecording)==null||o.overrideSampling()),i.linked_flag&&((s=this.sessionRecording)==null||s.overrideLinkedFlag()),i.url_trigger&&((a=this.sessionRecording)==null||a.overrideTrigger("url")),i.event_trigger&&((c=this.sessionRecording)==null||c.overrideTrigger("event"))}this.set_config({disable_session_recording:!1})}stopSessionRecording(){this.set_config({disable_session_recording:!0})}sessionRecordingStarted(){var e;return!((e=this.sessionRecording)==null||!e.started)}captureException(e,t){var i=new Error("PostHog syntheticException");return this.exceptions.sendExceptionEvent(Qr({},Pgt((r=>r instanceof Error)(e)?{error:e,event:e.message}:{event:e},{syntheticException:i}),t))}loadToolbar(e){return this.toolbar.loadToolbar(e)}get_property(e){var t;return(t=this.persistence)==null?void 0:t.props[e]}getSessionProperty(e){var t;return(t=this.sessionPersistence)==null?void 0:t.props[e]}toString(){var e,t=(e=this.config.name)!==null&&e!==void 0?e:$C;return t!==$C&&(t=$C+"."+t),t}_isIdentified(){var e,t;return((e=this.persistence)==null?void 0:e.get_property(S5))==="identified"||((t=this.sessionPersistence)==null?void 0:t.get_property(S5))==="identified"}Bs(){var e,t;return!(this.config.person_profiles==="never"||this.config.person_profiles==="identified_only"&&!this._isIdentified()&&AC(this.getGroups())&&((e=this.persistence)==null||(e=e.props)==null||!e[oN])&&((t=this.persistence)==null||(t=t.props)==null||!t[a7]))}zs(){return this.config.capture_pageleave===!0||this.config.capture_pageleave==="if_capture_pageview"&&(this.config.capture_pageview===!0||this.config.capture_pageview==="history_change")}createPersonProfile(){this.Bs()||this.Hs("posthog.createPersonProfile")&&this.setPersonProperties({},{})}Hs(e){return this.config.person_profiles==="never"?(Yr.error(e+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this.Ws(a7,!0),!0)}Ms(){if(this.config.cookieless_mode==="always")return!0;var e=this.consent.isOptedOut(),t=this.config.opt_out_persistence_by_default||this.config.cookieless_mode==="on_reject";return this.config.disable_persistence||e&&!!t}Gs(){var e,t,i,r,o=this.Ms();return((e=this.persistence)==null?void 0:e.je)!==o&&((i=this.persistence)==null||i.set_disabled(o)),((t=this.sessionPersistence)==null?void 0:t.je)!==o&&((r=this.sessionPersistence)==null||r.set_disabled(o)),o}opt_in_capturing(e){if(this.config.cookieless_mode!=="always"){var t;this.config.cookieless_mode==="on_reject"&&this.consent.isExplicitlyOptedOut()&&(this.reset(!0),this.sessionManager=new u3e(this),this.persistence&&(this.sessionPropsManager=new l3e(this,this.sessionManager,this.persistence)),this.sessionRecording=new bTe(this),this.sessionRecording.startIfEnabledOrStop()),this.consent.optInOut(!0),this.Gs(),(br(e?.captureEventName)||e!=null&&e.captureEventName)&&this.capture((t=e?.captureEventName)!==null&&t!==void 0?t:"$opt_in",e?.captureProperties,{send_instantly:!0}),this.config.capture_pageview&&this.Ns()}else Yr.warn('Consent opt in/out is not valid with cookieless_mode="always" and will be ignored')}opt_out_capturing(){var e;this.config.cookieless_mode!=="always"?(this.config.cookieless_mode==="on_reject"&&this.consent.isOptedIn()&&this.reset(!0),this.consent.optInOut(!1),this.Gs(),this.config.cookieless_mode==="on_reject"&&(this.register({distinct_id:dN,$device_id:null}),this.sessionManager=void 0,this.sessionPropsManager=void 0,(e=this.sessionRecording)==null||e.stopRecording(),this.sessionRecording=void 0,this.Ns())):Yr.warn('Consent opt in/out is not valid with cookieless_mode="always" and will be ignored')}has_opted_in_capturing(){return this.consent.isOptedIn()}has_opted_out_capturing(){return this.consent.isOptedOut()}get_explicit_consent_status(){var e=this.consent.consent;return e===T5.GRANTED?"granted":e===T5.DENIED?"denied":"pending"}is_capturing(){return this.config.cookieless_mode==="always"||(this.config.cookieless_mode==="on_reject"?this.consent.isExplicitlyOptedOut()||this.consent.isOptedIn():!this.has_opted_out_capturing())}clear_opt_in_out_capturing(){this.consent.reset(),this.Gs()}_is_bot(){return bw?h3e(bw,this.config.custom_blocked_useragents):void 0}Ns(){Kr&&(Kr.visibilityState==="visible"?this.Es||(this.Es=!0,this.capture("$pageview",{title:Kr.title},{send_instantly:!0}),this.Is&&(Kr.removeEventListener("visibilitychange",this.Is),this.Is=null)):this.Is||(this.Is=this.Ns.bind(this),M_(Kr,"visibilitychange",this.Is)))}debug(e){e===!1?(qn?.console.log("You've disabled debug mode."),localStorage&&localStorage.removeItem("ph_debug"),this.set_config({debug:!1})):(qn?.console.log("You're now in debug mode. All calls to PostHog will be logged in your console.\nYou can disable this with `posthog.debug(false)`."),localStorage&&localStorage.setItem("ph_debug","true"),this.set_config({debug:!0}))}L(){var e,t,i,r,o,s,a,c=this.Ts||{};return"advanced_disable_flags"in c?!!c.advanced_disable_flags:this.config.advanced_disable_flags!==!1?!!this.config.advanced_disable_flags:this.config.advanced_disable_decide===!0?(Yr.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):(i="advanced_disable_decide",r=!1,o=Yr,s=(t="advanced_disable_flags")in(e=c)&&!br(e[t]),a=i in e&&!br(e[i]),s?e[t]:a?(o&&o.warn("Config field '"+i+"' is deprecated. Please use '"+t+"' instead. The old field will be removed in a future major version."),e[i]):r)}qs(e){if(Oh(this.config.before_send))return e;var t=p0(this.config.before_send)?this.config.before_send:[this.config.before_send],i=e;for(var r of t){if(i=r(i),Oh(i)){var o="Event '"+e.event+"' was rejected in beforeSend function";return zyt(e.event)?Yr.warn(o+". This can cause unexpected behavior."):Yr.info(o),null}i.properties&&!AC(i.properties)||Yr.warn("Event '"+e.event+"' has no properties after beforeSend function, this is likely an error.")}return i}getPageViewId(){var e;return(e=this.pageViewManager.pe)==null?void 0:e.pageViewId}captureTraceFeedback(e,t){this.capture("$ai_feedback",{$ai_trace_id:String(e),$ai_feedback_text:t})}captureTraceMetric(e,t,i){this.capture("$ai_metric",{$ai_trace_id:String(e),$ai_metric_name:t,$ai_metric_value:String(i)})}};(function(n,e){for(var t=0;t<e.length;t++)n.prototype[e[t]]=Uyt(n.prototype[e[t]])})(y3e,["identify"]);var g3e,R7=(g3e=AN[$C]=new y3e,(function(){function n(){n.done||(n.done=!0,f3e=!1,vf(AN,(function(e){e._dom_loaded()})))}Kr!=null&&Kr.addEventListener?Kr.readyState==="complete"?n():M_(Kr,"DOMContentLoaded",n,{capture:!1}):qn&&Yr.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")})(),g3e);!window.location.hostname.includes("localhost")&&!window.location.hostname.includes("127.0.0.1")&&(R7.__loaded||R7.init("phc_htd8AQjSfVEsFCLQMAiUooG4Q0DKBCjqYuQglc9V3Wo",{api_host:"https://postpig.tscircuit.com",person_profiles:"always"}));function ibt(n){const e=String.fromCodePoint(...n);return btoa(e)}var vw=Uint8Array,ww=Uint16Array,fK=Int32Array,mK=new vw([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]),_K=new vw([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]),b3e=new vw([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),x3e=function(n,e){for(var t=new ww(31),i=0;i<31;++i)t[i]=e+=1<<n[i-1];for(var r=new fK(t[30]),i=1;i<30;++i)for(var o=t[i];o<t[i+1];++o)r[o]=o-t[i]<<5|i;return{b:t,r}},v3e=x3e(mK,2),rbt=v3e.b,yK=v3e.r;rbt[28]=258,yK[258]=28;for(var obt=x3e(_K,0),w3e=obt.r,gK=new ww(32768),m0=0;m0<32768;++m0){var u3=(m0&43690)>>1|(m0&21845)<<1;u3=(u3&52428)>>2|(u3&13107)<<2,u3=(u3&61680)>>4|(u3&3855)<<4,gK[m0]=((u3&65280)>>8|(u3&255)<<8)>>1}for(var CN=(function(n,e,t){for(var i=n.length,r=0,o=new ww(e);r<i;++r)n[r]&&++o[n[r]-1];var s=new ww(e);for(r=1;r<e;++r)s[r]=s[r-1]+o[r-1]<<1;var a;if(t){a=new ww(1<<e);var c=15-e;for(r=0;r<i;++r)if(n[r])for(var l=r<<4|n[r],u=e-n[r],d=s[n[r]-1]++<<u,h=d|(1<<u)-1;d<=h;++d)a[gK[d]>>c]=l}else for(a=new ww(i),r=0;r<i;++r)n[r]&&(a[r]=gK[s[n[r]-1]++]>>15-n[r]);return a}),_A=new vw(288),m0=0;m0<144;++m0)_A[m0]=8;for(var m0=144;m0<256;++m0)_A[m0]=9;for(var m0=256;m0<280;++m0)_A[m0]=7;for(var m0=280;m0<288;++m0)_A[m0]=8;for(var P7=new vw(32),m0=0;m0<32;++m0)P7[m0]=5;var sbt=CN(_A,9,0),abt=CN(P7,5,0),S3e=function(n){return(n+7)/8|0},E3e=function(n,e,t){return(t==null||t>n.length)&&(t=n.length),new vw(n.subarray(e,t))},R5=function(n,e,t){t<<=e&7;var i=e/8|0;n[i]|=t,n[i+1]|=t>>8},RN=function(n,e,t){t<<=e&7;var i=e/8|0;n[i]|=t,n[i+1]|=t>>8,n[i+2]|=t>>16},bK=function(n,e){for(var t=[],i=0;i<n.length;++i)n[i]&&t.push({s:i,f:n[i]});var r=t.length,o=t.slice();if(!r)return{t:C3e,l:0};if(r==1){var s=new vw(t[0].s+1);return s[t[0].s]=1,{t:s,l:1}}t.sort(function(N,R){return N.f-R.f}),t.push({s:-1,f:25001});var a=t[0],c=t[1],l=0,u=1,d=2;for(t[0]={s:-1,f:a.f+c.f,l:a,r:c};u!=r-1;)a=t[t[l].f<t[d].f?l++:d++],c=t[l!=u&&t[l].f<t[d].f?l++:d++],t[u++]={s:-1,f:a.f+c.f,l:a,r:c};for(var h=o[0].s,i=1;i<r;++i)o[i].s>h&&(h=o[i].s);var f=new ww(h+1),m=xK(t[u-1],f,0);if(m>e){var i=0,y=0,g=m-e,b=1<<g;for(o.sort(function(R,P){return f[P.s]-f[R.s]||R.f-P.f});i<r;++i){var v=o[i].s;if(f[v]>e)y+=b-(1<<m-f[v]),f[v]=e;else break}for(y>>=g;y>0;){var w=o[i].s;f[w]<e?y-=1<<e-f[w]++-1:++i}for(;i>=0&&y;--i){var T=o[i].s;f[T]==e&&(--f[T],++y)}m=e}return{t:new vw(f),l:m}},xK=function(n,e,t){return n.s==-1?Math.max(xK(n.l,e,t+1),xK(n.r,e,t+1)):e[n.s]=t},T3e=function(n){for(var e=n.length;e&&!n[--e];);for(var t=new ww(++e),i=0,r=n[0],o=1,s=function(c){t[i++]=c},a=1;a<=e;++a)if(n[a]==r&&a!=e)++o;else{if(!r&&o>2){for(;o>138;o-=138)s(32754);o>2&&(s(o>10?o-11<<5|28690:o-3<<5|12305),o=0)}else if(o>3){for(s(r),--o;o>6;o-=6)s(8304);o>2&&(s(o-3<<5|8208),o=0)}for(;o--;)s(r);o=1,r=n[a]}return{c:t.subarray(0,i),n:e}},PN=function(n,e){for(var t=0,i=0;i<e.length;++i)t+=n[i]*e[i];return t},M3e=function(n,e,t){var i=t.length,r=S3e(e+2);n[r]=i&255,n[r+1]=i>>8,n[r+2]=n[r]^255,n[r+3]=n[r+1]^255;for(var o=0;o<i;++o)n[r+o+4]=t[o];return(r+4+i)*8},A3e=function(n,e,t,i,r,o,s,a,c,l,u){R5(e,u++,t),++r[256];for(var d=bK(r,15),h=d.t,f=d.l,m=bK(o,15),y=m.t,g=m.l,b=T3e(h),v=b.c,w=b.n,T=T3e(y),N=T.c,R=T.n,P=new ww(19),M=0;M<v.length;++M)++P[v[M]&31];for(var M=0;M<N.length;++M)++P[N[M]&31];for(var I=bK(P,7),A=I.t,U=I.l,k=19;k>4&&!A[b3e[k-1]];--k);var V=l+5<<3,X=PN(r,_A)+PN(o,P7)+s,W=PN(r,h)+PN(o,y)+s+14+3*k+PN(P,A)+2*P[16]+3*P[17]+7*P[18];if(c>=0&&V<=X&&V<=W)return M3e(e,u,n.subarray(c,c+l));var K,te,se,de;if(R5(e,u,1+(W<X)),u+=2,W<X){K=CN(h,f,0),te=h,se=CN(y,g,0),de=y;var be=CN(A,U,0);R5(e,u,w-257),R5(e,u+5,R-1),R5(e,u+10,k-4),u+=14;for(var M=0;M<k;++M)R5(e,u+3*M,A[b3e[M]]);u+=3*k;for(var re=[v,N],ue=0;ue<2;++ue)for(var he=re[ue],M=0;M<he.length;++M){var Ae=he[M]&31;R5(e,u,be[Ae]),u+=A[Ae],Ae>15&&(R5(e,u,he[M]>>5&127),u+=he[M]>>12)}}else K=sbt,te=_A,se=abt,de=P7;for(var M=0;M<a;++M){var Ne=i[M];if(Ne>255){var Ae=Ne>>18&31;RN(e,u,K[Ae+257]),u+=te[Ae+257],Ae>7&&(R5(e,u,Ne>>23&31),u+=mK[Ae]);var De=Ne&31;RN(e,u,se[De]),u+=de[De],De>3&&(RN(e,u,Ne>>5&8191),u+=_K[De])}else RN(e,u,K[Ne]),u+=te[Ne]}return RN(e,u,K[256]),u+te[256]},cbt=new fK([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),C3e=new vw(0),lbt=function(n,e,t,i,r,o){var s=o.z||n.length,a=new vw(i+s+5*(1+Math.ceil(s/7e3))+r),c=a.subarray(i,a.length-r),l=o.l,u=(o.r||0)&7;if(e){u&&(c[0]=o.r>>3);for(var d=cbt[e-1],h=d>>13,f=d&8191,m=(1<<t)-1,y=o.p||new ww(32768),g=o.h||new ww(m+1),b=Math.ceil(t/3),v=2*b,w=function(st){return(n[st]^n[st+1]<<b^n[st+2]<<v)&m},T=new fK(25e3),N=new ww(288),R=new ww(32),P=0,M=0,I=o.i||0,A=0,U=o.w||0,k=0;I+2<s;++I){var V=w(I),X=I&32767,W=g[V];if(y[X]=W,g[V]=X,U<=I){var K=s-I;if((P>7e3||A>24576)&&(K>423||!l)){u=A3e(n,c,0,T,N,R,M,A,k,I-k,u),A=P=M=0,k=I;for(var te=0;te<286;++te)N[te]=0;for(var te=0;te<30;++te)R[te]=0}var se=2,de=0,be=f,re=X-W&32767;if(K>2&&V==w(I-re))for(var ue=Math.min(h,K)-1,he=Math.min(32767,I),Ae=Math.min(258,K);re<=he&&--be&&X!=W;){if(n[I+se]==n[I+se-re]){for(var Ne=0;Ne<Ae&&n[I+Ne]==n[I+Ne-re];++Ne);if(Ne>se){if(se=Ne,de=re,Ne>ue)break;for(var De=Math.min(re,Ne-2),Ge=0,te=0;te<De;++te){var ke=I-re+te&32767,ce=y[ke],we=ke-ce&32767;we>Ge&&(Ge=we,W=ke)}}}X=W,W=y[X],re+=X-W&32767}if(de){T[A++]=268435456|yK[se]<<18|w3e[de];var xe=yK[se]&31,Ye=w3e[de]&31;M+=mK[xe]+_K[Ye],++N[257+xe],++R[Ye],U=I+se,++P}else T[A++]=n[I],++N[n[I]]}}for(I=Math.max(I,U);I<s;++I)T[A++]=n[I],++N[n[I]];u=A3e(n,c,l,T,N,R,M,A,k,I-k,u),l||(o.r=u&7|c[u/8|0]<<3,u-=7,o.h=g,o.p=y,o.i=I,o.w=U)}else{for(var I=o.w||0;I<s+l;I+=65535){var Je=I+65535;Je>=s&&(c[u/8|0]=l,Je=s),u=M3e(c,u+1,n.subarray(I,Je))}o.i=s}return E3e(a,0,i+S3e(u)+r)},ubt=(function(){for(var n=new Int32Array(256),e=0;e<256;++e){for(var t=e,i=9;--i;)t=(t&1&&-306674912)^t>>>1;n[e]=t}return n})(),dbt=function(){var n=-1;return{p:function(e){for(var t=n,i=0;i<e.length;++i)t=ubt[t&255^e[i]]^t>>>8;n=t},d:function(){return~n}}},hbt=function(n,e,t,i,r){if(!r&&(r={l:1},e.dictionary)){var o=e.dictionary.subarray(-32768),s=new vw(o.length+n.length);s.set(o),s.set(n,o.length),n=s,r.w=o.length}return lbt(n,e.level==null?6:e.level,e.mem==null?r.l?Math.ceil(Math.max(8,Math.min(13,Math.log(n.length)))*1.5):20:12+e.mem,t,i,r)},vK=function(n,e,t){for(;t;++e)n[e]=t,t>>>=8},pbt=function(n,e){var t=e.filename;if(n[0]=31,n[1]=139,n[2]=8,n[8]=e.level<2?4:e.level==9?2:0,n[9]=3,e.mtime!=0&&vK(n,4,Math.floor(new Date(e.mtime||Date.now())/1e3)),t){n[3]=8;for(var i=0;i<=t.length;++i)n[i+10]=t.charCodeAt(i)}},fbt=function(n){return 10+(n.filename?n.filename.length+1:0)};function R3e(n,e){e||(e={});var t=dbt(),i=n.length;t.p(n);var r=hbt(n,e,fbt(e),8),o=r.length;return pbt(r,e),vK(r,o-8,t.d()),vK(r,o-4,i),r}var P3e=typeof TextEncoder<"u"&&new TextEncoder,mbt=typeof TextDecoder<"u"&&new TextDecoder,_bt=0;try{mbt.decode(C3e,{stream:!0}),_bt=1}catch{}function I3e(n,e){var t;if(P3e)return P3e.encode(n);for(var i=n.length,r=new vw(n.length+(n.length>>1)),o=0,s=function(l){r[o++]=l},t=0;t<i;++t){if(o+5>r.length){var a=new vw(o+8+(i-t<<1));a.set(r),r=a}var c=n.charCodeAt(t);c<128||e?s(c):c<2048?(s(192|c>>6),s(128|c&63)):c>55295&&c<57344?(c=65536+(c&1047552)|n.charCodeAt(++t)&1023,s(240|c>>18),s(128|c>>12&63),s(128|c>>6&63),s(128|c&63)):(s(224|c>>12),s(128|c>>6&63),s(128|c&63))}return E3e(r,0,o)}function ybt(n,e){const t=JSON.stringify(n),i=R3e(I3e(t));return`https://tscircuit.com/editor?#data:application/gzip;base64,${ibt(i)}`}function $a(...n){return kyt(JS(n))}const N3e=n=>n.replace(/_/g," ").replace(/\b\w/g,e=>e.toUpperCase()),wK=nyt,I7=Te.forwardRef(({className:n,...e},t)=>ye.jsx(VEe,{ref:t,className:$a("rf-inline-flex rf-h-9 rf-items-center rf-justify-center rf-rounded-lg rf-bg-zinc-100 rf-p-1 rf-text-zinc-500 dark:rf-bg-zinc-800 dark:rf-text-zinc-400",n),...e}));I7.displayName=VEe.displayName;const P5=Te.forwardRef(({className:n,...e},t)=>ye.jsx(GEe,{ref:t,className:$a("rf-inline-flex rf-items-center rf-justify-center rf-whitespace-nowrap rf-rounded-md rf-px-3 rf-py-1 rf-text-sm rf-font-medium rf-ring-offset-white rf-transition-all focus-visible:rf-outline-none focus-visible:rf-ring-2 focus-visible:rf-ring-zinc-950 focus-visible:rf-ring-offset-2 disabled:rf-pointer-events-none disabled:rf-opacity-50 data-[state=active]:rf-bg-white data-[state=active]:rf-text-zinc-950 data-[state=active]:rf-shadow dark:rf-ring-offset-zinc-950 dark:focus-visible:rf-ring-zinc-300 dark:data-[state=active]:rf-bg-zinc-950 dark:data-[state=active]:rf-text-zinc-50",n),...e}));P5.displayName=GEe.displayName;const Sw=Te.forwardRef(({className:n,...e},t)=>ye.jsx(YEe,{ref:t,className:$a("rf-h-full rf-mt-2 rf-ring-offset-white focus-visible:rf-outline-none focus-visible:rf-ring-2 focus-visible:rf-ring-zinc-950 focus-visible:rf-ring-offset-2 dark:rf-ring-offset-zinc-950 dark:focus-visible:rf-ring-zinc-300",n),...e}));Sw.displayName=YEe.displayName;var jd;(function(n){n.assertEqual=r=>{};function e(r){}n.assertIs=e;function t(r){throw new Error}n.assertNever=t,n.arrayToEnum=r=>{const o={};for(const s of r)o[s]=s;return o},n.getValidEnumValues=r=>{const o=n.objectKeys(r).filter(a=>typeof r[r[a]]!="number"),s={};for(const a of o)s[a]=r[a];return n.objectValues(s)},n.objectValues=r=>n.objectKeys(r).map(function(o){return r[o]}),n.objectKeys=typeof Object.keys=="function"?r=>Object.keys(r):r=>{const o=[];for(const s in r)Object.prototype.hasOwnProperty.call(r,s)&&o.push(s);return o},n.find=(r,o)=>{for(const s of r)if(o(s))return s},n.isInteger=typeof Number.isInteger=="function"?r=>Number.isInteger(r):r=>typeof r=="number"&&Number.isFinite(r)&&Math.floor(r)===r;function i(r,o=" | "){return r.map(s=>typeof s=="string"?`'${s}'`:s).join(o)}n.joinValues=i,n.jsonStringifyReplacer=(r,o)=>typeof o=="bigint"?o.toString():o})(jd||(jd={}));var k3e;(function(n){n.mergeShapes=(e,t)=>({...e,...t})})(k3e||(k3e={}));const co=jd.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),d3=n=>{switch(typeof n){case"undefined":return co.undefined;case"string":return co.string;case"number":return Number.isNaN(n)?co.nan:co.number;case"boolean":return co.boolean;case"function":return co.function;case"bigint":return co.bigint;case"symbol":return co.symbol;case"object":return Array.isArray(n)?co.array:n===null?co.null:n.then&&typeof n.then=="function"&&n.catch&&typeof n.catch=="function"?co.promise:typeof Map<"u"&&n instanceof Map?co.map:typeof Set<"u"&&n instanceof Set?co.set:typeof Date<"u"&&n instanceof Date?co.date:co.object;default:return co.unknown}},zi=jd.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);let sE=class L0t extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=i=>{this.issues=[...this.issues,i]},this.addIssues=(i=[])=>{this.issues=[...this.issues,...i]};const t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}format(e){const t=e||function(o){return o.message},i={_errors:[]},r=o=>{for(const s of o.issues)if(s.code==="invalid_union")s.unionErrors.map(r);else if(s.code==="invalid_return_type")r(s.returnTypeError);else if(s.code==="invalid_arguments")r(s.argumentsError);else if(s.path.length===0)i._errors.push(t(s));else{let a=i,c=0;for(;c<s.path.length;){const l=s.path[c];c===s.path.length-1?(a[l]=a[l]||{_errors:[]},a[l]._errors.push(t(s))):a[l]=a[l]||{_errors:[]},a=a[l],c++}}};return r(this),i}static assert(e){if(!(e instanceof L0t))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,jd.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=t=>t.message){const t={},i=[];for(const r of this.issues)if(r.path.length>0){const o=r.path[0];t[o]=t[o]||[],t[o].push(e(r))}else i.push(e(r));return{formErrors:i,fieldErrors:t}}get formErrors(){return this.flatten()}};sE.create=n=>new sE(n);const IN=(n,e)=>{let t;switch(n.code){case zi.invalid_type:n.received===co.undefined?t="Required":t=`Expected ${n.expected}, received ${n.received}`;break;case zi.invalid_literal:t=`Invalid literal value, expected ${JSON.stringify(n.expected,jd.jsonStringifyReplacer)}`;break;case zi.unrecognized_keys:t=`Unrecognized key(s) in object: ${jd.joinValues(n.keys,", ")}`;break;case zi.invalid_union:t="Invalid input";break;case zi.invalid_union_discriminator:t=`Invalid discriminator value. Expected ${jd.joinValues(n.options)}`;break;case zi.invalid_enum_value:t=`Invalid enum value. Expected ${jd.joinValues(n.options)}, received '${n.received}'`;break;case zi.invalid_arguments:t="Invalid function arguments";break;case zi.invalid_return_type:t="Invalid function return type";break;case zi.invalid_date:t="Invalid date";break;case zi.invalid_string:typeof n.validation=="object"?"includes"in n.validation?(t=`Invalid input: must include "${n.validation.includes}"`,typeof n.validation.position=="number"&&(t=`${t} at one or more positions greater than or equal to ${n.validation.position}`)):"startsWith"in n.validation?t=`Invalid input: must start with "${n.validation.startsWith}"`:"endsWith"in n.validation?t=`Invalid input: must end with "${n.validation.endsWith}"`:jd.assertNever(n.validation):n.validation!=="regex"?t=`Invalid ${n.validation}`:t="Invalid";break;case zi.too_small:n.type==="array"?t=`Array must contain ${n.exact?"exactly":n.inclusive?"at least":"more than"} ${n.minimum} element(s)`:n.type==="string"?t=`String must contain ${n.exact?"exactly":n.inclusive?"at least":"over"} ${n.minimum} character(s)`:n.type==="number"?t=`Number must be ${n.exact?"exactly equal to ":n.inclusive?"greater than or equal to ":"greater than "}${n.minimum}`:n.type==="bigint"?t=`Number must be ${n.exact?"exactly equal to ":n.inclusive?"greater than or equal to ":"greater than "}${n.minimum}`:n.type==="date"?t=`Date must be ${n.exact?"exactly equal to ":n.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(n.minimum))}`:t="Invalid input";break;case zi.too_big:n.type==="array"?t=`Array must contain ${n.exact?"exactly":n.inclusive?"at most":"less than"} ${n.maximum} element(s)`:n.type==="string"?t=`String must contain ${n.exact?"exactly":n.inclusive?"at most":"under"} ${n.maximum} character(s)`:n.type==="number"?t=`Number must be ${n.exact?"exactly":n.inclusive?"less than or equal to":"less than"} ${n.maximum}`:n.type==="bigint"?t=`BigInt must be ${n.exact?"exactly":n.inclusive?"less than or equal to":"less than"} ${n.maximum}`:n.type==="date"?t=`Date must be ${n.exact?"exactly":n.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(n.maximum))}`:t="Invalid input";break;case zi.custom:t="Invalid input";break;case zi.invalid_intersection_types:t="Intersection results could not be merged";break;case zi.not_multiple_of:t=`Number must be a multiple of ${n.multipleOf}`;break;case zi.not_finite:t="Number must be finite";break;default:t=e.defaultError,jd.assertNever(n)}return{message:t}};let gbt=IN;function SK(){return gbt}const EK=n=>{const{data:e,path:t,errorMaps:i,issueData:r}=n,o=[...t,...r.path||[]],s={...r,path:o};if(r.message!==void 0)return{...r,path:o,message:r.message};let a="";const c=i.filter(l=>!!l).slice().reverse();for(const l of c)a=l(s,{data:e,defaultError:a}).message;return{...r,path:o,message:a}};function Or(n,e){const t=SK(),i=EK({issueData:e,data:n.data,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,t,t===IN?void 0:IN].filter(r=>!!r)});n.common.issues.push(i)}let Ew=class D0t{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,t){const i=[];for(const r of t){if(r.status==="aborted")return Js;r.status==="dirty"&&e.dirty(),i.push(r.value)}return{status:e.value,value:i}}static async mergeObjectAsync(e,t){const i=[];for(const r of t){const o=await r.key,s=await r.value;i.push({key:o,value:s})}return D0t.mergeObjectSync(e,i)}static mergeObjectSync(e,t){const i={};for(const r of t){const{key:o,value:s}=r;if(o.status==="aborted"||s.status==="aborted")return Js;o.status==="dirty"&&e.dirty(),s.status==="dirty"&&e.dirty(),o.value!=="__proto__"&&(typeof s.value<"u"||r.alwaysSet)&&(i[o.value]=s.value)}return{status:e.value,value:i}}};const Js=Object.freeze({status:"aborted"}),NN=n=>({status:"dirty",value:n}),Bv=n=>({status:"valid",value:n}),O3e=n=>n.status==="aborted",L3e=n=>n.status==="dirty",FC=n=>n.status==="valid",N7=n=>typeof Promise<"u"&&n instanceof Promise;var Wo;(function(n){n.errToObj=e=>typeof e=="string"?{message:e}:e||{},n.toString=e=>typeof e=="string"?e:e?.message})(Wo||(Wo={}));let aE=class{constructor(e,t,i,r){this._cachedPath=[],this.parent=e,this.data=t,this._path=i,this._key=r}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}};const D3e=(n,e)=>{if(FC(e))return{success:!0,data:e.value};if(!n.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const t=new sE(n.common.issues);return this._error=t,this._error}}};function Oc(n){if(!n)return{};const{errorMap:e,invalid_type_error:t,required_error:i,description:r}=n;if(e&&(t||i))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:r}:{errorMap:(s,a)=>{const{message:c}=n;return s.code==="invalid_enum_value"?{message:c??a.defaultError}:typeof a.data>"u"?{message:c??i??a.defaultError}:s.code!=="invalid_type"?{message:a.defaultError}:{message:c??t??a.defaultError}},description:r}}let ru=class{get description(){return this._def.description}_getType(e){return d3(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:d3(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new Ew,ctx:{common:e.parent.common,data:e.data,parsedType:d3(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const t=this._parse(e);if(N7(t))throw new Error("Synchronous parse encountered promise.");return t}_parseAsync(e){const t=this._parse(e);return Promise.resolve(t)}parse(e,t){const i=this.safeParse(e,t);if(i.success)return i.data;throw i.error}safeParse(e,t){const i={common:{issues:[],async:t?.async??!1,contextualErrorMap:t?.errorMap},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:d3(e)},r=this._parseSync({data:e,path:i.path,parent:i});return D3e(i,r)}"~validate"(e){const t={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:d3(e)};if(!this["~standard"].async)try{const i=this._parseSync({data:e,path:[],parent:t});return FC(i)?{value:i.value}:{issues:t.common.issues}}catch(i){i?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),t.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:t}).then(i=>FC(i)?{value:i.value}:{issues:t.common.issues})}async parseAsync(e,t){const i=await this.safeParseAsync(e,t);if(i.success)return i.data;throw i.error}async safeParseAsync(e,t){const i={common:{issues:[],contextualErrorMap:t?.errorMap,async:!0},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:d3(e)},r=this._parse({data:e,path:i.path,parent:i}),o=await(N7(r)?r:Promise.resolve(r));return D3e(i,o)}refine(e,t){const i=r=>typeof t=="string"||typeof t>"u"?{message:t}:typeof t=="function"?t(r):t;return this._refinement((r,o)=>{const s=e(r),a=()=>o.addIssue({code:zi.custom,...i(r)});return typeof Promise<"u"&&s instanceof Promise?s.then(c=>c?!0:(a(),!1)):s?!0:(a(),!1)})}refinement(e,t){return this._refinement((i,r)=>e(i)?!0:(r.addIssue(typeof t=="function"?t(i,r):t),!1))}_refinement(e){return new p3({schema:this,typeName:va.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:t=>this["~validate"](t)}}optional(){return k5.create(this,this._def)}nullable(){return gA.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return UC.create(this)}promise(){return LN.create(this,this._def)}or(e){return $7.create([this,e],this._def)}and(e){return F7.create(this,e,this._def)}transform(e){return new p3({...Oc(this._def),schema:this,typeName:va.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const t=typeof e=="function"?e:()=>e;return new j7({...Oc(this._def),innerType:this,defaultValue:t,typeName:va.ZodDefault})}brand(){return new G3e({typeName:va.ZodBranded,type:this,...Oc(this._def)})}catch(e){const t=typeof e=="function"?e:()=>e;return new H7({...Oc(this._def),innerType:this,catchValue:t,typeName:va.ZodCatch})}describe(e){const t=this.constructor;return new t({...this._def,description:e})}pipe(e){return Vbt.create(this,e)}readonly(){return V7.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}};const bbt=/^c[^\s-]{8,}$/i,xbt=/^[0-9a-z]+$/,vbt=/^[0-9A-HJKMNP-TV-Z]{26}$/i,wbt=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,Sbt=/^[a-z0-9_-]{21}$/i,Ebt=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,Tbt=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,Mbt=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Abt="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let TK;const Cbt=/^(?:(?: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])$/,Rbt=/^(?:(?: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])\/(3[0-2]|[12]?[0-9])$/,Pbt=/^(([0-9a-fA-F]{1,4}:){7,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}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,Ibt=/^(([0-9a-fA-F]{1,4}:){7,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}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Nbt=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,kbt=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,z3e="((\\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])))",Obt=new RegExp(`^${z3e}$`);function $3e(n){let e="[0-5]\\d";n.precision?e=`${e}\\.\\d{${n.precision}}`:n.precision==null&&(e=`${e}(\\.\\d+)?`);const t=n.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${t}`}function Lbt(n){return new RegExp(`^${$3e(n)}$`)}function Dbt(n){let e=`${z3e}T${$3e(n)}`;const t=[];return t.push(n.local?"Z?":"Z"),n.offset&&t.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${t.join("|")})`,new RegExp(`^${e}$`)}function zbt(n,e){return!!((e==="v4"||!e)&&Cbt.test(n)||(e==="v6"||!e)&&Pbt.test(n))}function $bt(n,e){if(!Ebt.test(n))return!1;try{const[t]=n.split(".");if(!t)return!1;const i=t.replace(/-/g,"+").replace(/_/g,"/").padEnd(t.length+(4-t.length%4)%4,"="),r=JSON.parse(atob(i));return!(typeof r!="object"||r===null||"typ"in r&&r?.typ!=="JWT"||!r.alg||e&&r.alg!==e)}catch{return!1}}function Fbt(n,e){return!!((e==="v4"||!e)&&Rbt.test(n)||(e==="v6"||!e)&&Ibt.test(n))}let kN=class NL extends ru{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==co.string){const o=this._getOrReturnCtx(e);return Or(o,{code:zi.invalid_type,expected:co.string,received:o.parsedType}),Js}const i=new Ew;let r;for(const o of this._def.checks)if(o.kind==="min")e.data.length<o.value&&(r=this._getOrReturnCtx(e,r),Or(r,{code:zi.too_small,minimum:o.value,type:"string",inclusive:!0,exact:!1,message:o.message}),i.dirty());else if(o.kind==="max")e.data.length>o.value&&(r=this._getOrReturnCtx(e,r),Or(r,{code:zi.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!1,message:o.message}),i.dirty());else if(o.kind==="length"){const s=e.data.length>o.value,a=e.data.length<o.value;(s||a)&&(r=this._getOrReturnCtx(e,r),s?Or(r,{code:zi.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!0,message:o.message}):a&&Or(r,{code:zi.too_small,minimum:o.value,type:"string",inclusive:!0,exact:!0,message:o.message}),i.dirty())}else if(o.kind==="email")Mbt.test(e.data)||(r=this._getOrReturnCtx(e,r),Or(r,{validation:"email",code:zi.invalid_string,message:o.message}),i.dirty());else if(o.kind==="emoji")TK||(TK=new RegExp(Abt,"u")),TK.test(e.data)||(r=this._getOrReturnCtx(e,r),Or(r,{validation:"emoji",code:zi.invalid_string,message:o.message}),i.dirty());else if(o.kind==="uuid")wbt.test(e.data)||(r=this._getOrReturnCtx(e,r),Or(r,{validation:"uuid",code:zi.invalid_string,message:o.message}),i.dirty());else if(o.kind==="nanoid")Sbt.test(e.data)||(r=this._getOrReturnCtx(e,r),Or(r,{validation:"nanoid",code:zi.invalid_string,message:o.message}),i.dirty());else if(o.kind==="cuid")bbt.test(e.data)||(r=this._getOrReturnCtx(e,r),Or(r,{validation:"cuid",code:zi.invalid_string,message:o.message}),i.dirty());else if(o.kind==="cuid2")xbt.test(e.data)||(r=this._getOrReturnCtx(e,r),Or(r,{validation:"cuid2",code:zi.invalid_string,message:o.message}),i.dirty());else if(o.kind==="ulid")vbt.test(e.data)||(r=this._getOrReturnCtx(e,r),Or(r,{validation:"ulid",code:zi.invalid_string,message:o.message}),i.dirty());else if(o.kind==="url")try{new URL(e.data)}catch{r=this._getOrReturnCtx(e,r),Or(r,{validation:"url",code:zi.invalid_string,message:o.message}),i.dirty()}else o.kind==="regex"?(o.regex.lastIndex=0,o.regex.test(e.data)||(r=this._getOrReturnCtx(e,r),Or(r,{validation:"regex",code:zi.invalid_string,message:o.message}),i.dirty())):o.kind==="trim"?e.data=e.data.trim():o.kind==="includes"?e.data.includes(o.value,o.position)||(r=this._getOrReturnCtx(e,r),Or(r,{code:zi.invalid_string,validation:{includes:o.value,position:o.position},message:o.message}),i.dirty()):o.kind==="toLowerCase"?e.data=e.data.toLowerCase():o.kind==="toUpperCase"?e.data=e.data.toUpperCase():o.kind==="startsWith"?e.data.startsWith(o.value)||(r=this._getOrReturnCtx(e,r),Or(r,{code:zi.invalid_string,validation:{startsWith:o.value},message:o.message}),i.dirty()):o.kind==="endsWith"?e.data.endsWith(o.value)||(r=this._getOrReturnCtx(e,r),Or(r,{code:zi.invalid_string,validation:{endsWith:o.value},message:o.message}),i.dirty()):o.kind==="datetime"?Dbt(o).test(e.data)||(r=this._getOrReturnCtx(e,r),Or(r,{code:zi.invalid_string,validation:"datetime",message:o.message}),i.dirty()):o.kind==="date"?Obt.test(e.data)||(r=this._getOrReturnCtx(e,r),Or(r,{code:zi.invalid_string,validation:"date",message:o.message}),i.dirty()):o.kind==="time"?Lbt(o).test(e.data)||(r=this._getOrReturnCtx(e,r),Or(r,{code:zi.invalid_string,validation:"time",message:o.message}),i.dirty()):o.kind==="duration"?Tbt.test(e.data)||(r=this._getOrReturnCtx(e,r),Or(r,{validation:"duration",code:zi.invalid_string,message:o.message}),i.dirty()):o.kind==="ip"?zbt(e.data,o.version)||(r=this._getOrReturnCtx(e,r),Or(r,{validation:"ip",code:zi.invalid_string,message:o.message}),i.dirty()):o.kind==="jwt"?$bt(e.data,o.alg)||(r=this._getOrReturnCtx(e,r),Or(r,{validation:"jwt",code:zi.invalid_string,message:o.message}),i.dirty()):o.kind==="cidr"?Fbt(e.data,o.version)||(r=this._getOrReturnCtx(e,r),Or(r,{validation:"cidr",code:zi.invalid_string,message:o.message}),i.dirty()):o.kind==="base64"?Nbt.test(e.data)||(r=this._getOrReturnCtx(e,r),Or(r,{validation:"base64",code:zi.invalid_string,message:o.message}),i.dirty()):o.kind==="base64url"?kbt.test(e.data)||(r=this._getOrReturnCtx(e,r),Or(r,{validation:"base64url",code:zi.invalid_string,message:o.message}),i.dirty()):jd.assertNever(o);return{status:i.value,value:e.data}}_regex(e,t,i){return this.refinement(r=>e.test(r),{validation:t,code:zi.invalid_string,...Wo.errToObj(i)})}_addCheck(e){return new NL({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...Wo.errToObj(e)})}url(e){return this._addCheck({kind:"url",...Wo.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...Wo.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...Wo.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...Wo.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...Wo.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...Wo.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...Wo.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...Wo.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...Wo.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...Wo.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...Wo.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...Wo.errToObj(e)})}datetime(e){return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...Wo.errToObj(e?.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof e?.precision>"u"?null:e?.precision,...Wo.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...Wo.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...Wo.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t?.position,...Wo.errToObj(t?.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...Wo.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...Wo.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...Wo.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...Wo.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...Wo.errToObj(t)})}nonempty(e){return this.min(1,Wo.errToObj(e))}trim(){return new NL({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new NL({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new NL({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}};kN.create=n=>new kN({checks:[],typeName:va.ZodString,coerce:n?.coerce??!1,...Oc(n)});function Bbt(n,e){const t=(n.toString().split(".")[1]||"").length,i=(e.toString().split(".")[1]||"").length,r=t>i?t:i,o=Number.parseInt(n.toFixed(r).replace(".","")),s=Number.parseInt(e.toFixed(r).replace(".",""));return o%s/10**r}let k7=class USe extends ru{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==co.number){const o=this._getOrReturnCtx(e);return Or(o,{code:zi.invalid_type,expected:co.number,received:o.parsedType}),Js}let i;const r=new Ew;for(const o of this._def.checks)o.kind==="int"?jd.isInteger(e.data)||(i=this._getOrReturnCtx(e,i),Or(i,{code:zi.invalid_type,expected:"integer",received:"float",message:o.message}),r.dirty()):o.kind==="min"?(o.inclusive?e.data<o.value:e.data<=o.value)&&(i=this._getOrReturnCtx(e,i),Or(i,{code:zi.too_small,minimum:o.value,type:"number",inclusive:o.inclusive,exact:!1,message:o.message}),r.dirty()):o.kind==="max"?(o.inclusive?e.data>o.value:e.data>=o.value)&&(i=this._getOrReturnCtx(e,i),Or(i,{code:zi.too_big,maximum:o.value,type:"number",inclusive:o.inclusive,exact:!1,message:o.message}),r.dirty()):o.kind==="multipleOf"?Bbt(e.data,o.value)!==0&&(i=this._getOrReturnCtx(e,i),Or(i,{code:zi.not_multiple_of,multipleOf:o.value,message:o.message}),r.dirty()):o.kind==="finite"?Number.isFinite(e.data)||(i=this._getOrReturnCtx(e,i),Or(i,{code:zi.not_finite,message:o.message}),r.dirty()):jd.assertNever(o);return{status:r.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,Wo.toString(t))}gt(e,t){return this.setLimit("min",e,!1,Wo.toString(t))}lte(e,t){return this.setLimit("max",e,!0,Wo.toString(t))}lt(e,t){return this.setLimit("max",e,!1,Wo.toString(t))}setLimit(e,t,i,r){return new USe({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:i,message:Wo.toString(r)}]})}_addCheck(e){return new USe({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:Wo.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:Wo.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:Wo.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:Wo.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:Wo.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:Wo.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:Wo.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:Wo.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:Wo.toString(e)})}get minValue(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&jd.isInteger(e.value))}get isFinite(){let e=null,t=null;for(const i of this._def.checks){if(i.kind==="finite"||i.kind==="int"||i.kind==="multipleOf")return!0;i.kind==="min"?(t===null||i.value>t)&&(t=i.value):i.kind==="max"&&(e===null||i.value<e)&&(e=i.value)}return Number.isFinite(t)&&Number.isFinite(e)}};k7.create=n=>new k7({checks:[],typeName:va.ZodNumber,coerce:n?.coerce||!1,...Oc(n)});let O7=class jSe extends ru{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==co.bigint)return this._getInvalidInput(e);let i;const r=new Ew;for(const o of this._def.checks)o.kind==="min"?(o.inclusive?e.data<o.value:e.data<=o.value)&&(i=this._getOrReturnCtx(e,i),Or(i,{code:zi.too_small,type:"bigint",minimum:o.value,inclusive:o.inclusive,message:o.message}),r.dirty()):o.kind==="max"?(o.inclusive?e.data>o.value:e.data>=o.value)&&(i=this._getOrReturnCtx(e,i),Or(i,{code:zi.too_big,type:"bigint",maximum:o.value,inclusive:o.inclusive,message:o.message}),r.dirty()):o.kind==="multipleOf"?e.data%o.value!==BigInt(0)&&(i=this._getOrReturnCtx(e,i),Or(i,{code:zi.not_multiple_of,multipleOf:o.value,message:o.message}),r.dirty()):jd.assertNever(o);return{status:r.value,value:e.data}}_getInvalidInput(e){const t=this._getOrReturnCtx(e);return Or(t,{code:zi.invalid_type,expected:co.bigint,received:t.parsedType}),Js}gte(e,t){return this.setLimit("min",e,!0,Wo.toString(t))}gt(e,t){return this.setLimit("min",e,!1,Wo.toString(t))}lte(e,t){return this.setLimit("max",e,!0,Wo.toString(t))}lt(e,t){return this.setLimit("max",e,!1,Wo.toString(t))}setLimit(e,t,i,r){return new jSe({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:i,message:Wo.toString(r)}]})}_addCheck(e){return new jSe({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:Wo.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:Wo.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:Wo.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:Wo.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:Wo.toString(t)})}get minValue(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}};O7.create=n=>new O7({checks:[],typeName:va.ZodBigInt,coerce:n?.coerce??!1,...Oc(n)});let L7=class extends ru{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==co.boolean){const i=this._getOrReturnCtx(e);return Or(i,{code:zi.invalid_type,expected:co.boolean,received:i.parsedType}),Js}return Bv(e.data)}};L7.create=n=>new L7({typeName:va.ZodBoolean,coerce:n?.coerce||!1,...Oc(n)});let D7=class z0t extends ru{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==co.date){const o=this._getOrReturnCtx(e);return Or(o,{code:zi.invalid_type,expected:co.date,received:o.parsedType}),Js}if(Number.isNaN(e.data.getTime())){const o=this._getOrReturnCtx(e);return Or(o,{code:zi.invalid_date}),Js}const i=new Ew;let r;for(const o of this._def.checks)o.kind==="min"?e.data.getTime()<o.value&&(r=this._getOrReturnCtx(e,r),Or(r,{code:zi.too_small,message:o.message,inclusive:!0,exact:!1,minimum:o.value,type:"date"}),i.dirty()):o.kind==="max"?e.data.getTime()>o.value&&(r=this._getOrReturnCtx(e,r),Or(r,{code:zi.too_big,message:o.message,inclusive:!0,exact:!1,maximum:o.value,type:"date"}),i.dirty()):jd.assertNever(o);return{status:i.value,value:new Date(e.data.getTime())}}_addCheck(e){return new z0t({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:Wo.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:Wo.toString(t)})}get minDate(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e!=null?new Date(e):null}};D7.create=n=>new D7({checks:[],coerce:n?.coerce||!1,typeName:va.ZodDate,...Oc(n)});let F3e=class extends ru{_parse(e){if(this._getType(e)!==co.symbol){const i=this._getOrReturnCtx(e);return Or(i,{code:zi.invalid_type,expected:co.symbol,received:i.parsedType}),Js}return Bv(e.data)}};F3e.create=n=>new F3e({typeName:va.ZodSymbol,...Oc(n)});let MK=class extends ru{_parse(e){if(this._getType(e)!==co.undefined){const i=this._getOrReturnCtx(e);return Or(i,{code:zi.invalid_type,expected:co.undefined,received:i.parsedType}),Js}return Bv(e.data)}};MK.create=n=>new MK({typeName:va.ZodUndefined,...Oc(n)});let z7=class extends ru{_parse(e){if(this._getType(e)!==co.null){const i=this._getOrReturnCtx(e);return Or(i,{code:zi.invalid_type,expected:co.null,received:i.parsedType}),Js}return Bv(e.data)}};z7.create=n=>new z7({typeName:va.ZodNull,...Oc(n)});let ON=class extends ru{constructor(){super(...arguments),this._any=!0}_parse(e){return Bv(e.data)}};ON.create=n=>new ON({typeName:va.ZodAny,...Oc(n)});let BC=class extends ru{constructor(){super(...arguments),this._unknown=!0}_parse(e){return Bv(e.data)}};BC.create=n=>new BC({typeName:va.ZodUnknown,...Oc(n)});let h3=class extends ru{_parse(e){const t=this._getOrReturnCtx(e);return Or(t,{code:zi.invalid_type,expected:co.never,received:t.parsedType}),Js}};h3.create=n=>new h3({typeName:va.ZodNever,...Oc(n)});let B3e=class extends ru{_parse(e){if(this._getType(e)!==co.undefined){const i=this._getOrReturnCtx(e);return Or(i,{code:zi.invalid_type,expected:co.void,received:i.parsedType}),Js}return Bv(e.data)}};B3e.create=n=>new B3e({typeName:va.ZodVoid,...Oc(n)});let UC=class BW extends ru{_parse(e){const{ctx:t,status:i}=this._processInputParams(e),r=this._def;if(t.parsedType!==co.array)return Or(t,{code:zi.invalid_type,expected:co.array,received:t.parsedType}),Js;if(r.exactLength!==null){const s=t.data.length>r.exactLength.value,a=t.data.length<r.exactLength.value;(s||a)&&(Or(t,{code:s?zi.too_big:zi.too_small,minimum:a?r.exactLength.value:void 0,maximum:s?r.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:r.exactLength.message}),i.dirty())}if(r.minLength!==null&&t.data.length<r.minLength.value&&(Or(t,{code:zi.too_small,minimum:r.minLength.value,type:"array",inclusive:!0,exact:!1,message:r.minLength.message}),i.dirty()),r.maxLength!==null&&t.data.length>r.maxLength.value&&(Or(t,{code:zi.too_big,maximum:r.maxLength.value,type:"array",inclusive:!0,exact:!1,message:r.maxLength.message}),i.dirty()),t.common.async)return Promise.all([...t.data].map((s,a)=>r.type._parseAsync(new aE(t,s,t.path,a)))).then(s=>Ew.mergeArray(i,s));const o=[...t.data].map((s,a)=>r.type._parseSync(new aE(t,s,t.path,a)));return Ew.mergeArray(i,o)}get element(){return this._def.type}min(e,t){return new BW({...this._def,minLength:{value:e,message:Wo.toString(t)}})}max(e,t){return new BW({...this._def,maxLength:{value:e,message:Wo.toString(t)}})}length(e,t){return new BW({...this._def,exactLength:{value:e,message:Wo.toString(t)}})}nonempty(e){return this.min(1,e)}};UC.create=(n,e)=>new UC({type:n,minLength:null,maxLength:null,exactLength:null,typeName:va.ZodArray,...Oc(e)});function jC(n){if(n instanceof I5){const e={};for(const t in n.shape){const i=n.shape[t];e[t]=k5.create(jC(i))}return new I5({...n._def,shape:()=>e})}else return n instanceof UC?new UC({...n._def,type:jC(n.element)}):n instanceof k5?k5.create(jC(n.unwrap())):n instanceof gA?gA.create(jC(n.unwrap())):n instanceof yA?yA.create(n.items.map(e=>jC(e))):n}let I5=class WS extends ru{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const e=this._def.shape(),t=jd.objectKeys(e);return this._cached={shape:e,keys:t},this._cached}_parse(e){if(this._getType(e)!==co.object){const l=this._getOrReturnCtx(e);return Or(l,{code:zi.invalid_type,expected:co.object,received:l.parsedType}),Js}const{status:i,ctx:r}=this._processInputParams(e),{shape:o,keys:s}=this._getCached(),a=[];if(!(this._def.catchall instanceof h3&&this._def.unknownKeys==="strip"))for(const l in r.data)s.includes(l)||a.push(l);const c=[];for(const l of s){const u=o[l],d=r.data[l];c.push({key:{status:"valid",value:l},value:u._parse(new aE(r,d,r.path,l)),alwaysSet:l in r.data})}if(this._def.catchall instanceof h3){const l=this._def.unknownKeys;if(l==="passthrough")for(const u of a)c.push({key:{status:"valid",value:u},value:{status:"valid",value:r.data[u]}});else if(l==="strict")a.length>0&&(Or(r,{code:zi.unrecognized_keys,keys:a}),i.dirty());else if(l!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const l=this._def.catchall;for(const u of a){const d=r.data[u];c.push({key:{status:"valid",value:u},value:l._parse(new aE(r,d,r.path,u)),alwaysSet:u in r.data})}}return r.common.async?Promise.resolve().then(async()=>{const l=[];for(const u of c){const d=await u.key,h=await u.value;l.push({key:d,value:h,alwaysSet:u.alwaysSet})}return l}).then(l=>Ew.mergeObjectSync(i,l)):Ew.mergeObjectSync(i,c)}get shape(){return this._def.shape()}strict(e){return Wo.errToObj,new WS({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(t,i)=>{const r=this._def.errorMap?.(t,i).message??i.defaultError;return t.code==="unrecognized_keys"?{message:Wo.errToObj(e).message??r}:{message:r}}}:{}})}strip(){return new WS({...this._def,unknownKeys:"strip"})}passthrough(){return new WS({...this._def,unknownKeys:"passthrough"})}extend(e){return new WS({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new WS({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:va.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new WS({...this._def,catchall:e})}pick(e){const t={};for(const i of jd.objectKeys(e))e[i]&&this.shape[i]&&(t[i]=this.shape[i]);return new WS({...this._def,shape:()=>t})}omit(e){const t={};for(const i of jd.objectKeys(this.shape))e[i]||(t[i]=this.shape[i]);return new WS({...this._def,shape:()=>t})}deepPartial(){return jC(this)}partial(e){const t={};for(const i of jd.objectKeys(this.shape)){const r=this.shape[i];e&&!e[i]?t[i]=r:t[i]=r.optional()}return new WS({...this._def,shape:()=>t})}required(e){const t={};for(const i of jd.objectKeys(this.shape))if(e&&!e[i])t[i]=this.shape[i];else{let o=this.shape[i];for(;o instanceof k5;)o=o._def.innerType;t[i]=o}return new WS({...this._def,shape:()=>t})}keyof(){return H3e(jd.objectKeys(this.shape))}};I5.create=(n,e)=>new I5({shape:()=>n,unknownKeys:"strip",catchall:h3.create(),typeName:va.ZodObject,...Oc(e)}),I5.strictCreate=(n,e)=>new I5({shape:()=>n,unknownKeys:"strict",catchall:h3.create(),typeName:va.ZodObject,...Oc(e)}),I5.lazycreate=(n,e)=>new I5({shape:n,unknownKeys:"strip",catchall:h3.create(),typeName:va.ZodObject,...Oc(e)});let $7=class extends ru{_parse(e){const{ctx:t}=this._processInputParams(e),i=this._def.options;function r(o){for(const a of o)if(a.result.status==="valid")return a.result;for(const a of o)if(a.result.status==="dirty")return t.common.issues.push(...a.ctx.common.issues),a.result;const s=o.map(a=>new sE(a.ctx.common.issues));return Or(t,{code:zi.invalid_union,unionErrors:s}),Js}if(t.common.async)return Promise.all(i.map(async o=>{const s={...t,common:{...t.common,issues:[]},parent:null};return{result:await o._parseAsync({data:t.data,path:t.path,parent:s}),ctx:s}})).then(r);{let o;const s=[];for(const c of i){const l={...t,common:{...t.common,issues:[]},parent:null},u=c._parseSync({data:t.data,path:t.path,parent:l});if(u.status==="valid")return u;u.status==="dirty"&&!o&&(o={result:u,ctx:l}),l.common.issues.length&&s.push(l.common.issues)}if(o)return t.common.issues.push(...o.ctx.common.issues),o.result;const a=s.map(c=>new sE(c));return Or(t,{code:zi.invalid_union,unionErrors:a}),Js}}get options(){return this._def.options}};$7.create=(n,e)=>new $7({options:n,typeName:va.ZodUnion,...Oc(e)});const N5=n=>n instanceof CK?N5(n.schema):n instanceof p3?N5(n.innerType()):n instanceof B7?[n.value]:n instanceof U7?n.options:n instanceof RK?jd.objectValues(n.enum):n instanceof j7?N5(n._def.innerType):n instanceof MK?[void 0]:n instanceof z7?[null]:n instanceof k5?[void 0,...N5(n.unwrap())]:n instanceof gA?[null,...N5(n.unwrap())]:n instanceof G3e||n instanceof V7?N5(n.unwrap()):n instanceof H7?N5(n._def.innerType):[];let Ubt=class $0t extends ru{_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==co.object)return Or(t,{code:zi.invalid_type,expected:co.object,received:t.parsedType}),Js;const i=this.discriminator,r=t.data[i],o=this.optionsMap.get(r);return o?t.common.async?o._parseAsync({data:t.data,path:t.path,parent:t}):o._parseSync({data:t.data,path:t.path,parent:t}):(Or(t,{code:zi.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[i]}),Js)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,i){const r=new Map;for(const o of t){const s=N5(o.shape[e]);if(!s.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(const a of s){if(r.has(a))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(a)}`);r.set(a,o)}}return new $0t({typeName:va.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:r,...Oc(i)})}};function AK(n,e){const t=d3(n),i=d3(e);if(n===e)return{valid:!0,data:n};if(t===co.object&&i===co.object){const r=jd.objectKeys(e),o=jd.objectKeys(n).filter(a=>r.indexOf(a)!==-1),s={...n,...e};for(const a of o){const c=AK(n[a],e[a]);if(!c.valid)return{valid:!1};s[a]=c.data}return{valid:!0,data:s}}else if(t===co.array&&i===co.array){if(n.length!==e.length)return{valid:!1};const r=[];for(let o=0;o<n.length;o++){const s=n[o],a=e[o],c=AK(s,a);if(!c.valid)return{valid:!1};r.push(c.data)}return{valid:!0,data:r}}else return t===co.date&&i===co.date&&+n==+e?{valid:!0,data:n}:{valid:!1}}let F7=class extends ru{_parse(e){const{status:t,ctx:i}=this._processInputParams(e),r=(o,s)=>{if(O3e(o)||O3e(s))return Js;const a=AK(o.value,s.value);return a.valid?((L3e(o)||L3e(s))&&t.dirty(),{status:t.value,value:a.data}):(Or(i,{code:zi.invalid_intersection_types}),Js)};return i.common.async?Promise.all([this._def.left._parseAsync({data:i.data,path:i.path,parent:i}),this._def.right._parseAsync({data:i.data,path:i.path,parent:i})]).then(([o,s])=>r(o,s)):r(this._def.left._parseSync({data:i.data,path:i.path,parent:i}),this._def.right._parseSync({data:i.data,path:i.path,parent:i}))}};F7.create=(n,e,t)=>new F7({left:n,right:e,typeName:va.ZodIntersection,...Oc(t)});let yA=class F0t extends ru{_parse(e){const{status:t,ctx:i}=this._processInputParams(e);if(i.parsedType!==co.array)return Or(i,{code:zi.invalid_type,expected:co.array,received:i.parsedType}),Js;if(i.data.length<this._def.items.length)return Or(i,{code:zi.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),Js;!this._def.rest&&i.data.length>this._def.items.length&&(Or(i,{code:zi.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());const o=[...i.data].map((s,a)=>{const c=this._def.items[a]||this._def.rest;return c?c._parse(new aE(i,s,i.path,a)):null}).filter(s=>!!s);return i.common.async?Promise.all(o).then(s=>Ew.mergeArray(t,s)):Ew.mergeArray(t,o)}get items(){return this._def.items}rest(e){return new F0t({...this._def,rest:e})}};yA.create=(n,e)=>{if(!Array.isArray(n))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new yA({items:n,typeName:va.ZodTuple,rest:null,...Oc(e)})};let jbt=class HSe extends ru{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:i}=this._processInputParams(e);if(i.parsedType!==co.object)return Or(i,{code:zi.invalid_type,expected:co.object,received:i.parsedType}),Js;const r=[],o=this._def.keyType,s=this._def.valueType;for(const a in i.data)r.push({key:o._parse(new aE(i,a,i.path,a)),value:s._parse(new aE(i,i.data[a],i.path,a)),alwaysSet:a in i.data});return i.common.async?Ew.mergeObjectAsync(t,r):Ew.mergeObjectSync(t,r)}get element(){return this._def.valueType}static create(e,t,i){return t instanceof ru?new HSe({keyType:e,valueType:t,typeName:va.ZodRecord,...Oc(i)}):new HSe({keyType:kN.create(),valueType:e,typeName:va.ZodRecord,...Oc(t)})}},U3e=class extends ru{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:i}=this._processInputParams(e);if(i.parsedType!==co.map)return Or(i,{code:zi.invalid_type,expected:co.map,received:i.parsedType}),Js;const r=this._def.keyType,o=this._def.valueType,s=[...i.data.entries()].map(([a,c],l)=>({key:r._parse(new aE(i,a,i.path,[l,"key"])),value:o._parse(new aE(i,c,i.path,[l,"value"]))}));if(i.common.async){const a=new Map;return Promise.resolve().then(async()=>{for(const c of s){const l=await c.key,u=await c.value;if(l.status==="aborted"||u.status==="aborted")return Js;(l.status==="dirty"||u.status==="dirty")&&t.dirty(),a.set(l.value,u.value)}return{status:t.value,value:a}})}else{const a=new Map;for(const c of s){const l=c.key,u=c.value;if(l.status==="aborted"||u.status==="aborted")return Js;(l.status==="dirty"||u.status==="dirty")&&t.dirty(),a.set(l.value,u.value)}return{status:t.value,value:a}}}};U3e.create=(n,e,t)=>new U3e({valueType:e,keyType:n,typeName:va.ZodMap,...Oc(t)});let j3e=class VSe extends ru{_parse(e){const{status:t,ctx:i}=this._processInputParams(e);if(i.parsedType!==co.set)return Or(i,{code:zi.invalid_type,expected:co.set,received:i.parsedType}),Js;const r=this._def;r.minSize!==null&&i.data.size<r.minSize.value&&(Or(i,{code:zi.too_small,minimum:r.minSize.value,type:"set",inclusive:!0,exact:!1,message:r.minSize.message}),t.dirty()),r.maxSize!==null&&i.data.size>r.maxSize.value&&(Or(i,{code:zi.too_big,maximum:r.maxSize.value,type:"set",inclusive:!0,exact:!1,message:r.maxSize.message}),t.dirty());const o=this._def.valueType;function s(c){const l=new Set;for(const u of c){if(u.status==="aborted")return Js;u.status==="dirty"&&t.dirty(),l.add(u.value)}return{status:t.value,value:l}}const a=[...i.data.values()].map((c,l)=>o._parse(new aE(i,c,i.path,l)));return i.common.async?Promise.all(a).then(c=>s(c)):s(a)}min(e,t){return new VSe({...this._def,minSize:{value:e,message:Wo.toString(t)}})}max(e,t){return new VSe({...this._def,maxSize:{value:e,message:Wo.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}};j3e.create=(n,e)=>new j3e({valueType:n,minSize:null,maxSize:null,typeName:va.ZodSet,...Oc(e)});let Hbt=class UW extends ru{constructor(){super(...arguments),this.validate=this.implement}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==co.function)return Or(t,{code:zi.invalid_type,expected:co.function,received:t.parsedType}),Js;function i(a,c){return EK({data:a,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,SK(),IN].filter(l=>!!l),issueData:{code:zi.invalid_arguments,argumentsError:c}})}function r(a,c){return EK({data:a,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,SK(),IN].filter(l=>!!l),issueData:{code:zi.invalid_return_type,returnTypeError:c}})}const o={errorMap:t.common.contextualErrorMap},s=t.data;if(this._def.returns instanceof LN){const a=this;return Bv(async function(...c){const l=new sE([]),u=await a._def.args.parseAsync(c,o).catch(f=>{throw l.addIssue(i(c,f)),l}),d=await Reflect.apply(s,this,u);return await a._def.returns._def.type.parseAsync(d,o).catch(f=>{throw l.addIssue(r(d,f)),l})})}else{const a=this;return Bv(function(...c){const l=a._def.args.safeParse(c,o);if(!l.success)throw new sE([i(c,l.error)]);const u=Reflect.apply(s,this,l.data),d=a._def.returns.safeParse(u,o);if(!d.success)throw new sE([r(u,d.error)]);return d.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new UW({...this._def,args:yA.create(e).rest(BC.create())})}returns(e){return new UW({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,i){return new UW({args:e||yA.create([]).rest(BC.create()),returns:t||BC.create(),typeName:va.ZodFunction,...Oc(i)})}},CK=class extends ru{get schema(){return this._def.getter()}_parse(e){const{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}};CK.create=(n,e)=>new CK({getter:n,typeName:va.ZodLazy,...Oc(e)});let B7=class extends ru{_parse(e){if(e.data!==this._def.value){const t=this._getOrReturnCtx(e);return Or(t,{received:t.data,code:zi.invalid_literal,expected:this._def.value}),Js}return{status:"valid",value:e.data}}get value(){return this._def.value}};B7.create=(n,e)=>new B7({value:n,typeName:va.ZodLiteral,...Oc(e)});function H3e(n,e){return new U7({values:n,typeName:va.ZodEnum,...Oc(e)})}let U7=class GSe extends ru{_parse(e){if(typeof e.data!="string"){const t=this._getOrReturnCtx(e),i=this._def.values;return Or(t,{expected:jd.joinValues(i),received:t.parsedType,code:zi.invalid_type}),Js}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){const t=this._getOrReturnCtx(e),i=this._def.values;return Or(t,{received:t.data,code:zi.invalid_enum_value,options:i}),Js}return Bv(e.data)}get options(){return this._def.values}get enum(){const e={};for(const t of this._def.values)e[t]=t;return e}get Values(){const e={};for(const t of this._def.values)e[t]=t;return e}get Enum(){const e={};for(const t of this._def.values)e[t]=t;return e}extract(e,t=this._def){return GSe.create(e,{...this._def,...t})}exclude(e,t=this._def){return GSe.create(this.options.filter(i=>!e.includes(i)),{...this._def,...t})}};U7.create=H3e;let RK=class extends ru{_parse(e){const t=jd.getValidEnumValues(this._def.values),i=this._getOrReturnCtx(e);if(i.parsedType!==co.string&&i.parsedType!==co.number){const r=jd.objectValues(t);return Or(i,{expected:jd.joinValues(r),received:i.parsedType,code:zi.invalid_type}),Js}if(this._cache||(this._cache=new Set(jd.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){const r=jd.objectValues(t);return Or(i,{received:i.data,code:zi.invalid_enum_value,options:r}),Js}return Bv(e.data)}get enum(){return this._def.values}};RK.create=(n,e)=>new RK({values:n,typeName:va.ZodNativeEnum,...Oc(e)});let LN=class extends ru{unwrap(){return this._def.type}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==co.promise&&t.common.async===!1)return Or(t,{code:zi.invalid_type,expected:co.promise,received:t.parsedType}),Js;const i=t.parsedType===co.promise?t.data:Promise.resolve(t.data);return Bv(i.then(r=>this._def.type.parseAsync(r,{path:t.path,errorMap:t.common.contextualErrorMap})))}};LN.create=(n,e)=>new LN({type:n,typeName:va.ZodPromise,...Oc(e)});let p3=class extends ru{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===va.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:t,ctx:i}=this._processInputParams(e),r=this._def.effect||null,o={addIssue:s=>{Or(i,s),s.fatal?t.abort():t.dirty()},get path(){return i.path}};if(o.addIssue=o.addIssue.bind(o),r.type==="preprocess"){const s=r.transform(i.data,o);if(i.common.async)return Promise.resolve(s).then(async a=>{if(t.value==="aborted")return Js;const c=await this._def.schema._parseAsync({data:a,path:i.path,parent:i});return c.status==="aborted"?Js:c.status==="dirty"||t.value==="dirty"?NN(c.value):c});{if(t.value==="aborted")return Js;const a=this._def.schema._parseSync({data:s,path:i.path,parent:i});return a.status==="aborted"?Js:a.status==="dirty"||t.value==="dirty"?NN(a.value):a}}if(r.type==="refinement"){const s=a=>{const c=r.refinement(a,o);if(i.common.async)return Promise.resolve(c);if(c instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return a};if(i.common.async===!1){const a=this._def.schema._parseSync({data:i.data,path:i.path,parent:i});return a.status==="aborted"?Js:(a.status==="dirty"&&t.dirty(),s(a.value),{status:t.value,value:a.value})}else return this._def.schema._parseAsync({data:i.data,path:i.path,parent:i}).then(a=>a.status==="aborted"?Js:(a.status==="dirty"&&t.dirty(),s(a.value).then(()=>({status:t.value,value:a.value}))))}if(r.type==="transform")if(i.common.async===!1){const s=this._def.schema._parseSync({data:i.data,path:i.path,parent:i});if(!FC(s))return Js;const a=r.transform(s.value,o);if(a instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:a}}else return this._def.schema._parseAsync({data:i.data,path:i.path,parent:i}).then(s=>FC(s)?Promise.resolve(r.transform(s.value,o)).then(a=>({status:t.value,value:a})):Js);jd.assertNever(r)}};p3.create=(n,e,t)=>new p3({schema:n,typeName:va.ZodEffects,effect:e,...Oc(t)}),p3.createWithPreprocess=(n,e,t)=>new p3({schema:e,effect:{type:"preprocess",transform:n},typeName:va.ZodEffects,...Oc(t)});let k5=class extends ru{_parse(e){return this._getType(e)===co.undefined?Bv(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};k5.create=(n,e)=>new k5({innerType:n,typeName:va.ZodOptional,...Oc(e)});let gA=class extends ru{_parse(e){return this._getType(e)===co.null?Bv(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};gA.create=(n,e)=>new gA({innerType:n,typeName:va.ZodNullable,...Oc(e)});let j7=class extends ru{_parse(e){const{ctx:t}=this._processInputParams(e);let i=t.data;return t.parsedType===co.undefined&&(i=this._def.defaultValue()),this._def.innerType._parse({data:i,path:t.path,parent:t})}removeDefault(){return this._def.innerType}};j7.create=(n,e)=>new j7({innerType:n,typeName:va.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...Oc(e)});let H7=class extends ru{_parse(e){const{ctx:t}=this._processInputParams(e),i={...t,common:{...t.common,issues:[]}},r=this._def.innerType._parse({data:i.data,path:i.path,parent:{...i}});return N7(r)?r.then(o=>({status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new sE(i.common.issues)},input:i.data})})):{status:"valid",value:r.status==="valid"?r.value:this._def.catchValue({get error(){return new sE(i.common.issues)},input:i.data})}}removeCatch(){return this._def.innerType}};H7.create=(n,e)=>new H7({innerType:n,typeName:va.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...Oc(e)});let V3e=class extends ru{_parse(e){if(this._getType(e)!==co.nan){const i=this._getOrReturnCtx(e);return Or(i,{code:zi.invalid_type,expected:co.nan,received:i.parsedType}),Js}return{status:"valid",value:e.data}}};V3e.create=n=>new V3e({typeName:va.ZodNaN,...Oc(n)});let G3e=class extends ru{_parse(e){const{ctx:t}=this._processInputParams(e),i=t.data;return this._def.type._parse({data:i,path:t.path,parent:t})}unwrap(){return this._def.type}},Vbt=class B0t extends ru{_parse(e){const{status:t,ctx:i}=this._processInputParams(e);if(i.common.async)return(async()=>{const o=await this._def.in._parseAsync({data:i.data,path:i.path,parent:i});return o.status==="aborted"?Js:o.status==="dirty"?(t.dirty(),NN(o.value)):this._def.out._parseAsync({data:o.value,path:i.path,parent:i})})();{const r=this._def.in._parseSync({data:i.data,path:i.path,parent:i});return r.status==="aborted"?Js:r.status==="dirty"?(t.dirty(),{status:"dirty",value:r.value}):this._def.out._parseSync({data:r.value,path:i.path,parent:i})}}static create(e,t){return new B0t({in:e,out:t,typeName:va.ZodPipeline})}},V7=class extends ru{_parse(e){const t=this._def.innerType._parse(e),i=r=>(FC(r)&&(r.value=Object.freeze(r.value)),r);return N7(t)?t.then(r=>i(r)):i(t)}unwrap(){return this._def.innerType}};V7.create=(n,e)=>new V7({innerType:n,typeName:va.ZodReadonly,...Oc(e)});function Y3e(n,e){const t=typeof n=="function"?n(e):typeof n=="string"?{message:n}:n;return typeof t=="string"?{message:t}:t}function uy(n,e={},t){return n?ON.create().superRefine((i,r)=>{const o=n(i);if(o instanceof Promise)return o.then(s=>{if(!s){const a=Y3e(e,i),c=a.fatal??t??!0;r.addIssue({code:"custom",...a,fatal:c})}});if(!o){const s=Y3e(e,i),a=s.fatal??t??!0;r.addIssue({code:"custom",...s,fatal:a})}}):ON.create()}var va;(function(n){n.ZodString="ZodString",n.ZodNumber="ZodNumber",n.ZodNaN="ZodNaN",n.ZodBigInt="ZodBigInt",n.ZodBoolean="ZodBoolean",n.ZodDate="ZodDate",n.ZodSymbol="ZodSymbol",n.ZodUndefined="ZodUndefined",n.ZodNull="ZodNull",n.ZodAny="ZodAny",n.ZodUnknown="ZodUnknown",n.ZodNever="ZodNever",n.ZodVoid="ZodVoid",n.ZodArray="ZodArray",n.ZodObject="ZodObject",n.ZodUnion="ZodUnion",n.ZodDiscriminatedUnion="ZodDiscriminatedUnion",n.ZodIntersection="ZodIntersection",n.ZodTuple="ZodTuple",n.ZodRecord="ZodRecord",n.ZodMap="ZodMap",n.ZodSet="ZodSet",n.ZodFunction="ZodFunction",n.ZodLazy="ZodLazy",n.ZodLiteral="ZodLiteral",n.ZodEnum="ZodEnum",n.ZodEffects="ZodEffects",n.ZodNativeEnum="ZodNativeEnum",n.ZodOptional="ZodOptional",n.ZodNullable="ZodNullable",n.ZodDefault="ZodDefault",n.ZodCatch="ZodCatch",n.ZodPromise="ZodPromise",n.ZodBranded="ZodBranded",n.ZodPipeline="ZodPipeline",n.ZodReadonly="ZodReadonly"})(va||(va={}));const $=kN.create,$e=k7.create;O7.create;const mt=L7.create;D7.create;const PK=z7.create,hd=ON.create,q3e=BC.create;h3.create;const At=UC.create,Ie=I5.create,Jn=$7.create,A_=Ubt.create;F7.create,yA.create;const Os=jbt.create,IK=Hbt.create,Ee=B7.create,dn=U7.create,NK=LN.create;k5.create,gA.create;const X3e=p3.createWithPreprocess,W3e={string:(n=>kN.create({...n,coerce:!0})),number:(n=>k7.create({...n,coerce:!0})),boolean:(n=>L7.create({...n,coerce:!0})),bigint:(n=>O7.create({...n,coerce:!0})),date:(n=>D7.create({...n,coerce:!0}))};var Z3e={Hz:{baseUnit:"Hz",variants:{MHz:1e6,kHz:1e3,Hz:1}},g:{baseUnit:"g",variants:{kg:1e3,g:1}},Ω:{baseUnit:"Ω",variants:{mΩ:.001,Ω:1,kΩ:1e3,KΩ:1e3,kohm:1e3,MΩ:1e6,GΩ:1e9,TΩ:1e12}},V:{baseUnit:"V",variants:{mV:.001,V:1,kV:1e3,KV:1e3,MV:1e6,GV:1e9,TV:1e12}},A:{baseUnit:"A",variants:{µA:1e-6,mA:.001,ma:.001,A:1,kA:1e3,MA:1e6}},F:{baseUnit:"F",variants:{pF:1e-12,nF:1e-9,µF:1e-6,uF:1e-6,mF:.001,F:1}},ml:{baseUnit:"ml",variants:{ml:1,mL:1,l:1e3,L:1e3}},deg:{baseUnit:"deg",variants:{rad:180/Math.PI}},ms:{baseUnit:"ms",variants:{s:1e3}},mm:{baseUnit:"mm",variants:{nm:1e-6,µm:.001,um:.001,mm:1,cm:10,dm:100,m:1e3,km:1e6,in:25.4,ft:304.8,IN:25.4,FT:304.8,yd:914.4,mi:1609344,mil:.0254}}},kK=new Set;for(const[n,e]of Object.entries(Z3e)){kK.add(n);for(const t of Object.keys(e.variants))kK.add(t)}function Gbt(n){for(const[e,t]of Object.entries(Z3e))if(n in t.variants)return{baseUnit:t.baseUnit,conversionFactor:t.variants[n]};return{baseUnit:n,conversionFactor:1}}var K3e={tera:1e12,T:1e12,giga:1e9,G:1e9,mega:1e6,M:1e6,kilo:1e3,k:1e3,deci:.1,d:.1,centi:.01,c:.01,milli:.001,m:.001,micro:1e-6,u:1e-6,µ:1e-6,nano:1e-9,n:1e-9,pico:1e-12,p:1e-12},nS=n=>{if(typeof n>"u")return{parsedUnit:null,unitOfValue:null,value:null};if(typeof n=="string"&&n.match(/^-?[\d\.]+$/))return{value:Number.parseFloat(n),parsedUnit:null,unitOfValue:null};if(typeof n=="number")return{value:n,parsedUnit:null,unitOfValue:null};if(typeof n=="object"&&"x"in n&&"y"in n){const{parsedUnit:a,unitOfValue:c}=nS(n.x);return{parsedUnit:a,unitOfValue:c,value:{x:nS(n.x).value,y:nS(n.y).value}}}const t=n.toString().split("").reverse().join("").match(/[^\d\s]+/)?.[0];if(!t)throw new Error(`Could not determine unit: "${n}"`);const i=t.split("").reverse().join(""),r=n.slice(0,-i.length);if(i in K3e&&!kK.has(i)){const a=K3e[i];return{parsedUnit:null,unitOfValue:null,value:Number.parseFloat(r)*a}}const{baseUnit:o,conversionFactor:s}=Gbt(i);return{parsedUnit:i,unitOfValue:o,value:s*Number.parseFloat(r)}},HC=$().or($e()).transform(n=>nS(n).value),VC=$().or($e()).transform(n=>nS(n).value).transform(n=>Number.parseFloat(n.toPrecision(12))),OK=$().or($e()).transform(n=>nS(n).value),Uv=$().or($e()).transform(n=>nS(n).value),at=$().or($e()).transform(n=>nS(n).value),bA=$().or($e()).transform(n=>nS(n).value),$t=at,Ybt=$().or($e()).transform(n=>nS(n).value),qbt=$().or($e()).transform(n=>nS(n).value),um=$().or($e()).transform(n=>typeof n=="number"?n:n.endsWith("deg")?Number.parseFloat(n.split("deg")[0]):n.endsWith("rad")?Number.parseFloat(n.split("rad")[0])*180/Math.PI:Number.parseFloat(n)),Q3e=$e().or($().endsWith("mAh")).transform(n=>{if(typeof n=="string"){const e=n.replace("mAh",""),t=Number.parseFloat(e);if(Number.isNaN(t))throw new Error("Invalid capacity");return t}return n}).describe("Battery capacity in mAh"),wa=Ie({x:$t,y:$t}),Xbt=wa,GC=Ie({x:$t,y:$t,z:$t}),Wbt=GC,LK=Ie({width:$e(),height:$e()}),Zbt=n=>{const e="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";return Array.from({length:n},()=>e[Math.floor(Math.random()*e.length)]).join("")},qr=n=>$().optional().default(()=>`${n}_${Zbt(10)}`),G7=dn(["top_left","top_center","top_right","center_left","center","center_right","bottom_left","bottom_center","bottom_right"]),Y7=dn(["jlcpcb","macrofab","pcbway","digikey","mouser","lcsc"]),kg=Ie({type:Ee("source_component"),ftype:$().optional(),source_component_id:$(),name:$(),manufacturer_part_number:$().optional(),supplier_part_numbers:Os(Y7,At($())).optional(),display_value:$().optional(),are_pins_interchangeable:mt().optional(),internally_connected_source_port_ids:At(At($())).optional(),source_group_id:$().optional(),subcircuit_id:$().optional()}),DK=kg.extend({ftype:Ee("simple_capacitor"),capacitance:VC,max_voltage_rating:Uv.optional(),display_capacitance:$().optional(),max_decoupling_trace_length:$t.optional()}),zK=kg.extend({ftype:Ee("simple_resistor"),resistance:HC,display_resistance:$().optional()}),q7=kg.extend({ftype:Ee("simple_diode")}),$K=q7.extend({ftype:Ee("simple_led"),color:$().optional(),wavelength:$().optional()}),J3e=kg.extend({ftype:Ee("simple_ground")}),FK=kg.extend({ftype:Ee("simple_chip")}),BK=kg.extend({ftype:Ee("simple_power_source"),voltage:Uv}),Kbt=kg.extend({ftype:Ee("simple_fuse"),current_rating_amps:$e().describe("Nominal current in amps the fuse is rated for"),voltage_rating_volts:$e().describe("Voltage rating in volts, e.g. ±5V would be 5")}),UK=kg.extend({ftype:Ee("simple_battery"),capacity:Q3e}),jK=kg.extend({ftype:Ee("simple_inductor"),inductance:OK,max_current_rating:$e().optional()}),HK=kg.extend({ftype:Ee("simple_push_button")}),VK=kg.extend({ftype:Ee("simple_potentiometer"),max_resistance:HC}),eMe=kg.extend({ftype:Ee("simple_crystal"),frequency:$e().describe("Frequency in Hz"),load_capacitance:$e().optional().describe("Load capacitance in pF")}),GK=kg.extend({ftype:Ee("simple_pin_header"),pin_count:$e(),gender:dn(["male","female"]).optional().default("male")}),YK=kg.extend({ftype:Ee("simple_pinout")}),qK=kg.extend({ftype:Ee("simple_resonator"),load_capacitance:VC,equivalent_series_resistance:HC.optional(),frequency:bA}),XK=kg.extend({ftype:Ee("simple_transistor"),transistor_type:dn(["npn","pnp"])}),WK=kg.extend({ftype:Ee("simple_test_point"),footprint_variant:dn(["pad","through_hole"]).optional(),pad_shape:dn(["rect","circle"]).optional(),pad_diameter:Jn([$e(),$()]).optional(),hole_diameter:Jn([$e(),$()]).optional(),width:Jn([$e(),$()]).optional(),height:Jn([$e(),$()]).optional()}),ZK=kg.extend({ftype:Ee("simple_mosfet"),channel_type:dn(["n","p"]),mosfet_mode:dn(["enhancement","depletion"])}),KK=kg.extend({ftype:Ee("simple_switch")}),QK=Ie({type:Ee("source_project_metadata"),name:$().optional(),software_used_string:$().optional(),project_url:$().optional(),created_at:$().datetime().optional()}),tMe=Ie({type:Ee("source_missing_property_error"),source_missing_property_error_id:qr("source_missing_property_error"),source_component_id:$(),property_name:$(),subcircuit_id:$().optional(),error_type:Ee("source_missing_property_error").default("source_missing_property_error"),message:$()}).describe("The source code is missing a property"),nMe=Ie({type:Ee("source_failed_to_create_component_error"),source_failed_to_create_component_error_id:qr("source_failed_to_create_component_error"),error_type:Ee("source_failed_to_create_component_error").default("source_failed_to_create_component_error"),component_name:$().optional(),subcircuit_id:$().optional(),parent_source_component_id:$().optional(),message:$(),pcb_center:Ie({x:$e().optional(),y:$e().optional()}).optional(),schematic_center:Ie({x:$e().optional(),y:$e().optional()}).optional()}).describe("Error emitted when a component fails to be constructed"),JK=Ie({type:Ee("source_trace_not_connected_error"),source_trace_not_connected_error_id:qr("source_trace_not_connected_error"),error_type:Ee("source_trace_not_connected_error").default("source_trace_not_connected_error"),message:$(),subcircuit_id:$().optional(),source_group_id:$().optional(),source_trace_id:$().optional(),connected_source_port_ids:At($()).optional(),selectors_not_found:At($()).optional()}).describe("Occurs when a source trace selector does not match any ports"),iMe=Ie({type:Ee("source_property_ignored_warning"),source_property_ignored_warning_id:qr("source_property_ignored_warning"),source_component_id:$(),property_name:$(),subcircuit_id:$().optional(),error_type:Ee("source_property_ignored_warning").default("source_property_ignored_warning"),message:$()}).describe("The source property was ignored"),eQ=Ie({type:Ee("source_pin_missing_trace_warning"),source_pin_missing_trace_warning_id:qr("source_pin_missing_trace_warning"),warning_type:Ee("source_pin_missing_trace_warning").default("source_pin_missing_trace_warning"),message:$(),source_component_id:$(),source_port_id:$(),subcircuit_id:$().optional()}).describe("Warning emitted when a source component pin is missing a trace connection"),rMe=Jn([zK,DK,q7,$K,J3e,FK,BK,UK,jK,HK,VK,eMe,GK,YK,qK,KK,XK,WK,ZK,Kbt,QK,tMe,nMe,JK,iMe,eQ]),oMe=Ie({type:Ee("source_port"),pin_number:$e().optional(),port_hints:At($()).optional(),name:$(),source_port_id:$(),source_component_id:$(),subcircuit_id:$().optional(),subcircuit_connectivity_map_key:$().optional()}),sMe=Ie({type:Ee("source_trace"),source_trace_id:$(),connected_source_port_ids:At($()),connected_source_net_ids:At($()),subcircuit_id:$().optional(),subcircuit_connectivity_map_key:$().optional(),max_length:$e().optional(),min_trace_thickness:$e().optional(),display_name:$().optional()}),aMe=Ie({type:Ee("source_group"),source_group_id:$(),subcircuit_id:$().optional(),parent_subcircuit_id:$().optional(),parent_source_group_id:$().optional(),is_subcircuit:mt().optional(),show_as_schematic_box:mt().optional(),name:$().optional()}),cMe=Ie({type:Ee("source_net"),source_net_id:$(),name:$(),member_source_group_ids:At($()),is_power:mt().optional(),is_ground:mt().optional(),is_digital_signal:mt().optional(),is_analog_signal:mt().optional(),is_positive_voltage_source:mt().optional(),trace_width:$e().optional(),subcircuit_id:$().optional(),subcircuit_connectivity_map_key:$().optional()}),lMe=Ie({type:Ee("source_pcb_ground_plane"),source_pcb_ground_plane_id:$(),source_group_id:$(),source_net_id:$(),subcircuit_id:$().optional()}).describe("Defines a ground plane in the source domain"),DN=["top","bottom","inner1","inner2","inner3","inner4","inner5","inner6"],tQ=dn(DN),Wc=tQ.or(Ie({name:tQ})).transform(n=>typeof n=="string"?n:n.name),YC=dn(["top","bottom"]),uMe=Ie({type:Ee("source_manually_placed_via"),source_manually_placed_via_id:$(),source_group_id:$(),source_net_id:$(),subcircuit_id:$().optional(),source_trace_id:$().optional()}).describe("Defines a via that is manually placed in the source domain"),dMe=Ie({type:Ee("schematic_box"),schematic_component_id:$().optional(),width:$t,height:$t,is_dashed:mt().default(!1),x:$t,y:$t,subcircuit_id:$().optional()}).describe("Draws a box on the schematic"),hMe=Ie({type:Ee("schematic_path"),schematic_component_id:$(),fill_color:dn(["red","blue"]).optional(),is_filled:mt().optional(),points:At(wa),subcircuit_id:$().optional()}),pMe=Os(Ie({left_margin:at.optional(),right_margin:at.optional(),top_margin:at.optional(),bottom_margin:at.optional()})),fMe=Ie({left_size:$e(),right_size:$e(),top_size:$e().optional(),bottom_size:$e().optional()}),mMe=Ie({left_side:Ie({pins:At($e()),direction:dn(["top-to-bottom","bottom-to-top"]).optional()}).optional(),right_side:Ie({pins:At($e()),direction:dn(["top-to-bottom","bottom-to-top"]).optional()}).optional(),top_side:Ie({pins:At($e()),direction:dn(["left-to-right","right-to-left"]).optional()}).optional(),bottom_side:Ie({pins:At($e()),direction:dn(["left-to-right","right-to-left"]).optional()}).optional()}),_Me=Jn([fMe,mMe]),yMe=Ie({type:Ee("schematic_component"),size:LK,center:wa,source_component_id:$().optional(),schematic_component_id:$(),pin_spacing:at.optional(),pin_styles:pMe.optional(),box_width:at.optional(),symbol_name:$().optional(),port_arrangement:_Me.optional(),port_labels:Os($()).optional(),symbol_display_value:$().optional(),subcircuit_id:$().optional(),schematic_group_id:$().optional(),is_schematic_group:mt().optional(),source_group_id:$().optional(),is_box_with_pins:mt().optional().default(!0)}),gMe=Ie({type:Ee("schematic_line"),schematic_line_id:qr("schematic_line"),schematic_component_id:$(),x1:$t,y1:$t,x2:$t,y2:$t,stroke_width:$t.nullable().optional(),color:$().default("#000000"),is_dashed:mt().default(!1),subcircuit_id:$().optional()}).describe("Draws a styled line on the schematic"),bMe=Ie({type:Ee("schematic_rect"),schematic_rect_id:qr("schematic_rect"),schematic_component_id:$(),center:wa,width:$t,height:$t,rotation:um.default(0),stroke_width:$t.nullable().optional(),color:$().default("#000000"),is_filled:mt().default(!1),fill_color:$().optional(),is_dashed:mt().default(!1),subcircuit_id:$().optional()}).describe("Draws a styled rectangle on the schematic"),xMe=Ie({type:Ee("schematic_circle"),schematic_circle_id:qr("schematic_circle"),schematic_component_id:$(),center:wa,radius:$t,stroke_width:$t.nullable().optional(),color:$().default("#000000"),is_filled:mt().default(!1),fill_color:$().optional(),is_dashed:mt().default(!1),subcircuit_id:$().optional()}).describe("Draws a styled circle on the schematic"),vMe=Ie({type:Ee("schematic_arc"),schematic_arc_id:qr("schematic_arc"),schematic_component_id:$(),center:wa,radius:$t,start_angle_degrees:um,end_angle_degrees:um,direction:dn(["clockwise","counterclockwise"]).default("counterclockwise"),stroke_width:$t.nullable().optional(),color:$().default("#000000"),is_dashed:mt().default(!1),subcircuit_id:$().optional()}).describe("Draws a styled arc on the schematic"),wMe=Ie({type:Ee("schematic_trace"),schematic_trace_id:$(),source_trace_id:$().optional(),junctions:At(Ie({x:$e(),y:$e()})),edges:At(Ie({from:Ie({x:$e(),y:$e()}),to:Ie({x:$e(),y:$e()}),is_crossing:mt().optional(),from_schematic_port_id:$().optional(),to_schematic_port_id:$().optional()})),subcircuit_id:$().optional(),subcircuit_connectivity_map_key:$().optional()}),Qbt=dn(["center","left","right","top","bottom"]),SMe=Ie({type:Ee("schematic_text"),schematic_component_id:$().optional(),schematic_text_id:$(),text:$(),font_size:$e().default(.18),position:Ie({x:$t,y:$t}),rotation:$e().default(0),anchor:Jn([Qbt.describe("legacy"),G7]).default("center"),color:$().default("#000000"),subcircuit_id:$().optional()}),EMe=Ie({type:Ee("schematic_port"),schematic_port_id:$(),source_port_id:$(),schematic_component_id:$().optional(),center:wa,facing_direction:dn(["up","down","left","right"]).optional(),distance_from_component_edge:$e().optional(),side_of_component:dn(["top","bottom","left","right"]).optional(),true_ccw_index:$e().optional(),pin_number:$e().optional(),display_pin_label:$().optional(),subcircuit_id:$().optional(),is_connected:mt().optional(),has_input_arrow:mt().optional(),has_output_arrow:mt().optional()}).describe("Defines a port on a schematic component"),TMe=Ie({type:Ee("schematic_net_label"),schematic_net_label_id:qr("schematic_net_label"),schematic_trace_id:$().optional(),source_trace_id:$().optional(),source_net_id:$(),center:wa,anchor_position:wa.optional(),anchor_side:dn(["top","bottom","left","right"]),text:$(),symbol_name:$().optional(),is_movable:mt().optional(),subcircuit_id:$().optional()}),MMe=Ie({type:Ee("schematic_error"),schematic_error_id:$(),error_type:Ee("schematic_port_not_found").default("schematic_port_not_found"),message:$(),subcircuit_id:$().optional()}).describe("Defines a schematic error on the schematic"),AMe=Ie({type:Ee("schematic_layout_error"),schematic_layout_error_id:qr("schematic_layout_error"),error_type:Ee("schematic_layout_error").default("schematic_layout_error"),message:$(),source_group_id:$(),schematic_group_id:$(),subcircuit_id:$().optional()}).describe("Error emitted when schematic layout fails for a group"),X7=Ie({type:Ee("schematic_debug_object"),label:$().optional(),subcircuit_id:$().optional()}),CMe=X7.extend({shape:Ee("rect"),center:wa,size:LK}),RMe=X7.extend({shape:Ee("line"),start:wa,end:wa}),PMe=X7.extend({shape:Ee("point"),center:wa}),IMe=A_("shape",[CMe,RMe,PMe]),NMe=Ie({type:Ee("schematic_voltage_probe"),schematic_voltage_probe_id:$(),position:wa,schematic_trace_id:$(),voltage:Uv.optional(),subcircuit_id:$().optional()}).describe("Defines a voltage probe measurement point on a schematic trace"),nQ=Ie({type:Ee("schematic_manual_edit_conflict_warning"),schematic_manual_edit_conflict_warning_id:qr("schematic_manual_edit_conflict_warning"),warning_type:Ee("schematic_manual_edit_conflict_warning").default("schematic_manual_edit_conflict_warning"),message:$(),schematic_component_id:$(),schematic_group_id:$().optional(),subcircuit_id:$().optional(),source_component_id:$()}).describe("Warning emitted when a component has both manual placement and explicit schX/schY coordinates"),kMe=Ie({type:Ee("schematic_group"),schematic_group_id:qr("schematic_group"),source_group_id:$(),is_subcircuit:mt().optional(),subcircuit_id:$().optional(),width:at,height:at,center:wa,schematic_component_ids:At($()),show_as_schematic_box:mt().optional(),name:$().optional(),description:$().optional()}).describe("Defines a group of components on the schematic"),OMe=Ie({type:Ee("schematic_table"),schematic_table_id:qr("schematic_table"),anchor_position:wa,column_widths:At($t),row_heights:At($t),cell_padding:$t.optional(),border_width:$t.optional(),subcircuit_id:$().optional(),schematic_component_id:$().optional(),anchor:G7.optional()}).describe("Defines a table on the schematic"),LMe=Ie({type:Ee("schematic_table_cell"),schematic_table_cell_id:qr("schematic_table_cell"),schematic_table_id:$(),start_row_index:$e(),end_row_index:$e(),start_column_index:$e(),end_column_index:$e(),text:$().optional(),center:wa,width:$t,height:$t,horizontal_align:dn(["left","center","right"]).optional(),vertical_align:dn(["top","middle","bottom"]).optional(),font_size:$t.optional(),subcircuit_id:$().optional()}).describe("Defines a cell within a schematic_table"),DMe=Ie({x:$t,y:$t,bulge:$e().optional()}),iQ=Ie({vertices:At(DMe)}),zMe=Ie({outer_ring:iQ,inner_rings:At(iQ).default([])}),$Me=Ie({x:$t,y:$t,via:mt().optional(),via_to_layer:Wc.optional()}),Jbt=At($Me),O5=Ie({x:$t,y:$t,via:mt().optional(),to_layer:Wc.optional(),trace_width:$t.optional()}),FMe=Ie({type:Ee("pcb_component"),pcb_component_id:qr("pcb_component"),source_component_id:$(),center:wa,layer:Wc,rotation:um,width:at,height:at,do_not_place:mt().optional(),subcircuit_id:$().optional(),pcb_group_id:$().optional()}).describe("Defines a component on the PCB"),BMe=Ie({type:Ee("pcb_hole"),pcb_hole_id:qr("pcb_hole"),pcb_group_id:$().optional(),subcircuit_id:$().optional(),hole_shape:dn(["circle","square"]),hole_diameter:$e(),x:$t,y:$t}),ext=BMe.describe("Defines a circular or square hole on the PCB"),UMe=Ie({type:Ee("pcb_hole"),pcb_hole_id:qr("pcb_hole"),pcb_group_id:$().optional(),subcircuit_id:$().optional(),hole_shape:Ee("oval"),hole_width:$e(),hole_height:$e(),x:$t,y:$t}),txt=UMe.describe("Defines an oval hole on the PCB"),jMe=BMe.or(UMe),nxt=Ie({type:Ee("pcb_plated_hole"),shape:Ee("circle"),pcb_group_id:$().optional(),subcircuit_id:$().optional(),outer_diameter:$e(),hole_diameter:$e(),x:$t,y:$t,layers:At(Wc),port_hints:At($()).optional(),pcb_component_id:$().optional(),pcb_port_id:$().optional(),pcb_plated_hole_id:qr("pcb_plated_hole")}),ixt=Ie({type:Ee("pcb_plated_hole"),shape:dn(["oval","pill"]),pcb_group_id:$().optional(),subcircuit_id:$().optional(),outer_width:$e(),outer_height:$e(),hole_width:$e(),hole_height:$e(),x:$t,y:$t,ccw_rotation:um,layers:At(Wc),port_hints:At($()).optional(),pcb_component_id:$().optional(),pcb_port_id:$().optional(),pcb_plated_hole_id:qr("pcb_plated_hole")}),rxt=Ie({type:Ee("pcb_plated_hole"),shape:Ee("circular_hole_with_rect_pad"),pcb_group_id:$().optional(),subcircuit_id:$().optional(),hole_shape:Ee("circle"),pad_shape:Ee("rect"),hole_diameter:$e(),rect_pad_width:$e(),rect_pad_height:$e(),rect_border_radius:$e().optional(),hole_offset_x:$t.default(0),hole_offset_y:$t.default(0),x:$t,y:$t,layers:At(Wc),port_hints:At($()).optional(),pcb_component_id:$().optional(),pcb_port_id:$().optional(),pcb_plated_hole_id:qr("pcb_plated_hole")}),oxt=Ie({type:Ee("pcb_plated_hole"),shape:Ee("pill_hole_with_rect_pad"),pcb_group_id:$().optional(),subcircuit_id:$().optional(),hole_shape:Ee("pill"),pad_shape:Ee("rect"),hole_width:$e(),hole_height:$e(),rect_pad_width:$e(),rect_pad_height:$e(),rect_border_radius:$e().optional(),hole_offset_x:$t.default(0),hole_offset_y:$t.default(0),x:$t,y:$t,layers:At(Wc),port_hints:At($()).optional(),pcb_component_id:$().optional(),pcb_port_id:$().optional(),pcb_plated_hole_id:qr("pcb_plated_hole")}),sxt=Ie({type:Ee("pcb_plated_hole"),shape:Ee("rotated_pill_hole_with_rect_pad"),pcb_group_id:$().optional(),subcircuit_id:$().optional(),hole_shape:Ee("rotated_pill"),pad_shape:Ee("rect"),hole_width:$e(),hole_height:$e(),hole_ccw_rotation:um,rect_pad_width:$e(),rect_pad_height:$e(),rect_border_radius:$e().optional(),rect_ccw_rotation:um,hole_offset_x:$t.default(0),hole_offset_y:$t.default(0),x:$t,y:$t,layers:At(Wc),port_hints:At($()).optional(),pcb_component_id:$().optional(),pcb_port_id:$().optional(),pcb_plated_hole_id:qr("pcb_plated_hole")}),HMe=Jn([nxt,ixt,rxt,oxt,sxt]),VMe=Ie({type:Ee("pcb_port"),pcb_port_id:qr("pcb_port"),pcb_group_id:$().optional(),subcircuit_id:$().optional(),source_port_id:$(),pcb_component_id:$(),x:$t,y:$t,layers:At(Wc),is_board_pinout:mt().optional()}).describe("Defines a port on the PCB"),axt=Ie({type:Ee("pcb_smtpad"),shape:Ee("circle"),pcb_smtpad_id:qr("pcb_smtpad"),pcb_group_id:$().optional(),subcircuit_id:$().optional(),x:$t,y:$t,radius:$e(),layer:Wc,port_hints:At($()).optional(),pcb_component_id:$().optional(),pcb_port_id:$().optional(),is_covered_with_solder_mask:mt().optional()}),cxt=Ie({type:Ee("pcb_smtpad"),shape:Ee("rect"),pcb_smtpad_id:qr("pcb_smtpad"),pcb_group_id:$().optional(),subcircuit_id:$().optional(),x:$t,y:$t,width:$e(),height:$e(),rect_border_radius:$e().optional(),layer:Wc,port_hints:At($()).optional(),pcb_component_id:$().optional(),pcb_port_id:$().optional(),is_covered_with_solder_mask:mt().optional()}),lxt=Ie({type:Ee("pcb_smtpad"),shape:Ee("rotated_rect"),pcb_smtpad_id:qr("pcb_smtpad"),pcb_group_id:$().optional(),subcircuit_id:$().optional(),x:$t,y:$t,width:$e(),height:$e(),rect_border_radius:$e().optional(),ccw_rotation:um,layer:Wc,port_hints:At($()).optional(),pcb_component_id:$().optional(),pcb_port_id:$().optional(),is_covered_with_solder_mask:mt().optional()}),GMe=Ie({type:Ee("pcb_smtpad"),shape:Ee("pill"),pcb_smtpad_id:qr("pcb_smtpad"),pcb_group_id:$().optional(),subcircuit_id:$().optional(),x:$t,y:$t,width:$e(),height:$e(),radius:$e(),layer:Wc,port_hints:At($()).optional(),pcb_component_id:$().optional(),pcb_port_id:$().optional(),is_covered_with_solder_mask:mt().optional()}),uxt=Ie({type:Ee("pcb_smtpad"),shape:Ee("rotated_pill"),pcb_smtpad_id:qr("pcb_smtpad"),pcb_group_id:$().optional(),subcircuit_id:$().optional(),x:$t,y:$t,width:$e(),height:$e(),radius:$e(),ccw_rotation:um,layer:Wc,port_hints:At($()).optional(),pcb_component_id:$().optional(),pcb_port_id:$().optional(),is_covered_with_solder_mask:mt().optional()}),dxt=Ie({type:Ee("pcb_smtpad"),shape:Ee("polygon"),pcb_smtpad_id:qr("pcb_smtpad"),pcb_group_id:$().optional(),subcircuit_id:$().optional(),points:At(wa),layer:Wc,port_hints:At($()).optional(),pcb_component_id:$().optional(),pcb_port_id:$().optional(),is_covered_with_solder_mask:mt().optional()}),YMe=A_("shape",[axt,cxt,lxt,uxt,GMe,dxt]).describe("Defines an SMT pad on the PCB"),hxt=Ie({type:Ee("pcb_solder_paste"),shape:Ee("circle"),pcb_solder_paste_id:qr("pcb_solder_paste"),pcb_group_id:$().optional(),subcircuit_id:$().optional(),x:$t,y:$t,radius:$e(),layer:Wc,pcb_component_id:$().optional(),pcb_smtpad_id:$().optional()}),pxt=Ie({type:Ee("pcb_solder_paste"),shape:Ee("rect"),pcb_solder_paste_id:qr("pcb_solder_paste"),pcb_group_id:$().optional(),subcircuit_id:$().optional(),x:$t,y:$t,width:$e(),height:$e(),layer:Wc,pcb_component_id:$().optional(),pcb_smtpad_id:$().optional()}),fxt=Ie({type:Ee("pcb_solder_paste"),shape:Ee("pill"),pcb_solder_paste_id:qr("pcb_solder_paste"),pcb_group_id:$().optional(),subcircuit_id:$().optional(),x:$t,y:$t,width:$e(),height:$e(),radius:$e(),layer:Wc,pcb_component_id:$().optional(),pcb_smtpad_id:$().optional()}),mxt=Ie({type:Ee("pcb_solder_paste"),shape:Ee("rotated_rect"),pcb_solder_paste_id:qr("pcb_solder_paste"),pcb_group_id:$().optional(),subcircuit_id:$().optional(),x:$t,y:$t,width:$e(),height:$e(),ccw_rotation:$t,layer:Wc,pcb_component_id:$().optional(),pcb_smtpad_id:$().optional()}),_xt=Ie({type:Ee("pcb_solder_paste"),shape:Ee("oval"),pcb_solder_paste_id:qr("pcb_solder_paste"),pcb_group_id:$().optional(),subcircuit_id:$().optional(),x:$t,y:$t,width:$e(),height:$e(),layer:Wc,pcb_component_id:$().optional(),pcb_smtpad_id:$().optional()}),qMe=Jn([hxt,pxt,fxt,mxt,_xt]).describe("Defines solderpaste on the PCB"),XMe=Ie({type:Ee("pcb_text"),pcb_text_id:qr("pcb_text"),pcb_group_id:$().optional(),subcircuit_id:$().optional(),text:$(),center:wa,layer:Wc,width:at,height:at,lines:$e(),align:dn(["bottom-left"])}).describe("Defines text on the PCB"),WMe=Ie({route_type:Ee("wire"),x:$t,y:$t,width:$t,start_pcb_port_id:$().optional(),end_pcb_port_id:$().optional(),layer:Wc}),ZMe=Ie({route_type:Ee("via"),x:$t,y:$t,hole_diameter:$t.optional(),outer_diameter:$t.optional(),from_layer:$(),to_layer:$()}),rQ=Jn([WMe,ZMe]),KMe=Ie({type:Ee("pcb_trace"),source_trace_id:$().optional(),pcb_component_id:$().optional(),pcb_trace_id:qr("pcb_trace"),pcb_group_id:$().optional(),subcircuit_id:$().optional(),route_thickness_mode:dn(["constant","interpolated"]).default("constant").optional(),route_order_index:$e().optional(),should_round_corners:mt().optional(),trace_length:$e().optional(),highlight_color:$().optional(),route:At(rQ)}).describe("Defines a trace on the PCB"),QMe=Ie({type:Ee("pcb_trace_error"),pcb_trace_error_id:qr("pcb_trace_error"),error_type:Ee("pcb_trace_error").default("pcb_trace_error"),message:$(),center:wa.optional(),pcb_trace_id:$(),source_trace_id:$(),pcb_component_ids:At($()),pcb_port_ids:At($()),subcircuit_id:$().optional()}).describe("Defines a trace error on the PCB"),JMe=Ie({type:Ee("pcb_trace_missing_error"),pcb_trace_missing_error_id:qr("pcb_trace_missing_error"),error_type:Ee("pcb_trace_missing_error").default("pcb_trace_missing_error"),message:$(),center:wa.optional(),source_trace_id:$(),pcb_component_ids:At($()),pcb_port_ids:At($()),subcircuit_id:$().optional()}).describe("Defines an error when a source trace has no corresponding PCB trace"),eAe=Ie({type:Ee("pcb_port_not_matched_error"),pcb_error_id:qr("pcb_error"),error_type:Ee("pcb_port_not_matched_error").default("pcb_port_not_matched_error"),message:$(),pcb_component_ids:At($()),subcircuit_id:$().optional()}).describe("Defines a trace error on the PCB where a port is not matched"),tAe=Ie({type:Ee("pcb_port_not_connected_error"),pcb_port_not_connected_error_id:qr("pcb_port_not_connected_error"),error_type:Ee("pcb_port_not_connected_error").default("pcb_port_not_connected_error"),message:$(),pcb_port_ids:At($()),pcb_component_ids:At($()),subcircuit_id:$().optional()}).describe("Defines an error when a pcb port is not connected to any trace"),nAe=Ie({type:Ee("pcb_net"),pcb_net_id:qr("pcb_net"),source_net_id:$().optional(),highlight_color:$().optional()}).describe("Defines a net on the PCB"),iAe=Ie({type:Ee("pcb_via"),pcb_via_id:qr("pcb_via"),pcb_group_id:$().optional(),subcircuit_id:$().optional(),x:$t,y:$t,outer_diameter:$t.default("0.6mm"),hole_diameter:$t.default("0.25mm"),from_layer:Wc.optional(),to_layer:Wc.optional(),layers:At(Wc),pcb_trace_id:$().optional()}).describe("Defines a via on the PCB"),rAe=Ie({type:Ee("pcb_board"),pcb_board_id:qr("pcb_board"),is_subcircuit:mt().optional(),subcircuit_id:$().optional(),width:at,height:at,center:wa,thickness:at.optional().default(1.4),num_layers:$e().optional().default(4),outline:At(wa).optional(),material:dn(["fr4","fr1"]).default("fr4")}).describe("Defines the board outline of the PCB"),oAe=Ie({type:Ee("pcb_placement_error"),pcb_placement_error_id:qr("pcb_placement_error"),error_type:Ee("pcb_placement_error").default("pcb_placement_error"),message:$(),subcircuit_id:$().optional()}).describe("Defines a placement error on the PCB"),sAe=Ie({type:Ee("pcb_trace_hint"),pcb_trace_hint_id:qr("pcb_trace_hint"),pcb_port_id:$(),pcb_component_id:$(),route:At(O5),subcircuit_id:$().optional()}).describe("A hint that can be used during generation of a PCB trace"),aAe=Ie({type:Ee("pcb_silkscreen_line"),pcb_silkscreen_line_id:qr("pcb_silkscreen_line"),pcb_component_id:$(),pcb_group_id:$().optional(),subcircuit_id:$().optional(),stroke_width:$t.default("0.1mm"),x1:$t,y1:$t,x2:$t,y2:$t,layer:YC}).describe("Defines a silkscreen line on the PCB"),cAe=Ie({type:Ee("pcb_silkscreen_path"),pcb_silkscreen_path_id:qr("pcb_silkscreen_path"),pcb_component_id:$(),pcb_group_id:$().optional(),subcircuit_id:$().optional(),layer:YC,route:At(wa),stroke_width:at}).describe("Defines a silkscreen path on the PCB"),lAe=Ie({type:Ee("pcb_silkscreen_text"),pcb_silkscreen_text_id:qr("pcb_silkscreen_text"),pcb_group_id:$().optional(),subcircuit_id:$().optional(),font:Ee("tscircuit2024").default("tscircuit2024"),font_size:$t.default("0.2mm"),pcb_component_id:$(),text:$(),is_knockout:mt().default(!1).optional(),knockout_padding:Ie({left:at,top:at,bottom:at,right:at}).default({left:"0.2mm",top:"0.2mm",bottom:"0.2mm",right:"0.2mm"}).optional(),ccw_rotation:$e().optional(),layer:Wc,is_mirrored:mt().default(!1).optional(),anchor_position:wa.default({x:0,y:0}),anchor_alignment:G7.default("center")}).describe("Defines silkscreen text on the PCB"),uAe=Ie({type:Ee("pcb_silkscreen_rect"),pcb_silkscreen_rect_id:qr("pcb_silkscreen_rect"),pcb_component_id:$(),pcb_group_id:$().optional(),subcircuit_id:$().optional(),center:wa,width:at,height:at,layer:Wc,stroke_width:at.default("1mm"),is_filled:mt().default(!0).optional(),has_stroke:mt().optional(),is_stroke_dashed:mt().optional()}).describe("Defines a silkscreen rect on the PCB"),dAe=Ie({type:Ee("pcb_silkscreen_circle"),pcb_silkscreen_circle_id:qr("pcb_silkscreen_circle"),pcb_component_id:$(),pcb_group_id:$().optional(),subcircuit_id:$().optional(),center:wa,radius:at,layer:YC,stroke_width:at.default("1mm")}).describe("Defines a silkscreen circle on the PCB"),hAe=Ie({type:Ee("pcb_silkscreen_oval"),pcb_silkscreen_oval_id:qr("pcb_silkscreen_oval"),pcb_component_id:$(),pcb_group_id:$().optional(),subcircuit_id:$().optional(),center:wa,radius_x:$t,radius_y:$t,layer:YC}).describe("Defines a silkscreen oval on the PCB"),pAe=Ie({type:Ee("pcb_fabrication_note_text"),pcb_fabrication_note_text_id:qr("pcb_fabrication_note_text"),subcircuit_id:$().optional(),pcb_group_id:$().optional(),font:Ee("tscircuit2024").default("tscircuit2024"),font_size:$t.default("1mm"),pcb_component_id:$(),text:$(),layer:YC,anchor_position:wa.default({x:0,y:0}),anchor_alignment:dn(["center","top_left","top_right","bottom_left","bottom_right"]).default("center"),color:$().optional()}).describe("Defines a fabrication note in text on the PCB, useful for leaving notes for assemblers or fabricators"),fAe=Ie({type:Ee("pcb_fabrication_note_path"),pcb_fabrication_note_path_id:qr("pcb_fabrication_note_path"),pcb_component_id:$(),subcircuit_id:$().optional(),layer:Wc,route:At(wa),stroke_width:at,color:$().optional()}).describe("Defines a fabrication path on the PCB for fabricators or assemblers"),mAe=Ie({type:Ee("pcb_footprint_overlap_error"),pcb_error_id:qr("pcb_error"),error_type:Ee("pcb_footprint_overlap_error").default("pcb_footprint_overlap_error"),message:$(),pcb_smtpad_ids:At($()).optional(),pcb_plated_hole_ids:At($()).optional(),pcb_hole_ids:At($()).optional(),pcb_keepout_ids:At($()).optional()}).describe("Error emitted when a pcb footprint overlaps with another element"),_Ae=Ie({type:Ee("pcb_keepout"),shape:Ee("rect"),pcb_group_id:$().optional(),subcircuit_id:$().optional(),center:wa,width:$t,height:$t,pcb_keepout_id:$(),layers:At($()),description:$().optional()}).or(Ie({type:Ee("pcb_keepout"),shape:Ee("circle"),pcb_group_id:$().optional(),subcircuit_id:$().optional(),center:wa,radius:$t,pcb_keepout_id:$(),layers:At($()),description:$().optional()})),oQ=Ie({type:Ee("pcb_cutout"),pcb_cutout_id:qr("pcb_cutout"),pcb_group_id:$().optional(),subcircuit_id:$().optional()}),yAe=oQ.extend({shape:Ee("rect"),center:wa,width:at,height:at,rotation:um.optional()}),gAe=oQ.extend({shape:Ee("circle"),center:wa,radius:at}),bAe=oQ.extend({shape:Ee("polygon"),points:At(wa)}),xAe=A_("shape",[yAe,gAe,bAe]).describe("Defines a cutout on the PCB, removing board material."),vAe=Ie({type:Ee("pcb_missing_footprint_error"),pcb_missing_footprint_error_id:qr("pcb_missing_footprint_error"),pcb_group_id:$().optional(),subcircuit_id:$().optional(),error_type:Ee("pcb_missing_footprint_error").default("pcb_missing_footprint_error"),source_component_id:$(),message:$()}).describe("Defines a missing footprint error on the PCB"),W7=Ie({type:Ee("external_footprint_load_error"),external_footprint_load_error_id:qr("external_footprint_load_error"),pcb_component_id:$(),source_component_id:$(),pcb_group_id:$().optional(),subcircuit_id:$().optional(),footprinter_string:$().optional(),error_type:Ee("external_footprint_load_error").default("external_footprint_load_error"),message:$()}).describe("Defines an error when an external footprint fails to load"),sQ=Ie({type:Ee("circuit_json_footprint_load_error"),circuit_json_footprint_load_error_id:qr("circuit_json_footprint_load_error"),pcb_component_id:$(),source_component_id:$(),pcb_group_id:$().optional(),subcircuit_id:$().optional(),error_type:Ee("circuit_json_footprint_load_error").default("circuit_json_footprint_load_error"),message:$(),circuit_json:At(hd()).optional()}).describe("Defines an error when a circuit JSON footprint fails to load"),wAe=Ie({type:Ee("pcb_group"),pcb_group_id:qr("pcb_group"),source_group_id:$(),is_subcircuit:mt().optional(),subcircuit_id:$().optional(),width:at,height:at,center:wa,pcb_component_ids:At($()),name:$().optional(),description:$().optional(),layout_mode:$().optional(),autorouter_configuration:Ie({trace_clearance:at}).optional(),autorouter_used_string:$().optional()}).describe("Defines a group of components on the PCB"),SAe=Ie({type:Ee("pcb_autorouting_error"),pcb_error_id:qr("pcb_autorouting_error"),error_type:Ee("pcb_autorouting_error").default("pcb_autorouting_error"),message:$(),subcircuit_id:$().optional()}).describe("The autorouting has failed to route a portion of the board"),aQ=Ie({type:Ee("pcb_manual_edit_conflict_warning"),pcb_manual_edit_conflict_warning_id:qr("pcb_manual_edit_conflict_warning"),warning_type:Ee("pcb_manual_edit_conflict_warning").default("pcb_manual_edit_conflict_warning"),message:$(),pcb_component_id:$(),pcb_group_id:$().optional(),subcircuit_id:$().optional(),source_component_id:$()}).describe("Warning emitted when a component has both manual placement and explicit pcbX/pcbY coordinates"),EAe=Ie({type:Ee("pcb_breakout_point"),pcb_breakout_point_id:qr("pcb_breakout_point"),pcb_group_id:$(),subcircuit_id:$().optional(),source_trace_id:$().optional(),source_port_id:$().optional(),source_net_id:$().optional(),x:$t,y:$t}).describe("Defines a routing target within a pcb_group for a source_trace or source_net"),TAe=Ie({type:Ee("pcb_ground_plane"),pcb_ground_plane_id:qr("pcb_ground_plane"),source_pcb_ground_plane_id:$(),source_net_id:$(),pcb_group_id:$().optional(),subcircuit_id:$().optional()}).describe("Defines a ground plane on the PCB"),MAe=Ie({type:Ee("pcb_ground_plane_region"),pcb_ground_plane_region_id:qr("pcb_ground_plane_region"),pcb_ground_plane_id:$(),pcb_group_id:$().optional(),subcircuit_id:$().optional(),layer:Wc,points:At(wa)}).describe("Defines a polygon region of a ground plane"),AAe=Ie({type:Ee("pcb_thermal_spoke"),pcb_thermal_spoke_id:qr("pcb_thermal_spoke"),pcb_ground_plane_id:$(),shape:$(),spoke_count:$e(),spoke_thickness:$t,spoke_inner_diameter:$t,spoke_outer_diameter:$t,pcb_plated_hole_id:$().optional(),subcircuit_id:$().optional()}).describe("Pattern for connecting a ground plane to a plated hole"),cQ=Ie({type:Ee("pcb_copper_pour"),pcb_copper_pour_id:qr("pcb_copper_pour"),pcb_group_id:$().optional(),subcircuit_id:$().optional(),layer:Wc,source_net_id:$().optional()}),CAe=cQ.extend({shape:Ee("rect"),center:wa,width:at,height:at,rotation:um.optional()}),RAe=cQ.extend({shape:Ee("brep"),brep_shape:zMe}),PAe=cQ.extend({shape:Ee("polygon"),points:At(wa)}),IAe=A_("shape",[CAe,RAe,PAe]).describe("Defines a copper pour on the PCB."),NAe=Ie({type:Ee("pcb_component_outside_board_error"),pcb_component_outside_board_error_id:qr("pcb_component_outside_board_error"),error_type:Ee("pcb_component_outside_board_error").default("pcb_component_outside_board_error"),message:$(),pcb_component_id:$(),pcb_board_id:$(),component_center:wa,component_bounds:Ie({min_x:$e(),max_x:$e(),min_y:$e(),max_y:$e()}),subcircuit_id:$().optional(),source_component_id:$().optional()}).describe("Error emitted when a PCB component is placed outside the board boundaries"),kAe=Ie({type:Ee("cad_component"),cad_component_id:$(),pcb_component_id:$(),source_component_id:$(),position:GC,rotation:GC.optional(),size:GC.optional(),layer:Wc.optional(),subcircuit_id:$().optional(),footprinter_string:$().optional(),model_obj_url:$().optional(),model_stl_url:$().optional(),model_3mf_url:$().optional(),model_gltf_url:$().optional(),model_glb_url:$().optional(),model_step_url:$().optional(),model_wrl_url:$().optional(),model_unit_to_mm_scale_factor:$e().optional(),model_jscad:hd().optional()}).describe("Defines a component on the PCB"),OAe=dn(["sinewave","square","triangle","sawtooth"]),yxt=Jn([$(),$e()]).transform(n=>typeof n=="string"?n.endsWith("%")?parseFloat(n.slice(0,-1))/100:parseFloat(n):n).pipe($e().min(0,"Duty cycle must be non-negative").max(1,"Duty cycle cannot be greater than 100%")),LAe=Ie({type:Ee("simulation_voltage_source"),simulation_voltage_source_id:qr("simulation_voltage_source"),is_dc_source:Ee(!0).optional().default(!0),positive_source_port_id:$().optional(),negative_source_port_id:$().optional(),positive_source_net_id:$().optional(),negative_source_net_id:$().optional(),voltage:Uv}).describe("Defines a DC voltage source for simulation"),DAe=Ie({type:Ee("simulation_voltage_source"),simulation_voltage_source_id:qr("simulation_voltage_source"),is_dc_source:Ee(!1),terminal1_source_port_id:$().optional(),terminal2_source_port_id:$().optional(),terminal1_source_net_id:$().optional(),terminal2_source_net_id:$().optional(),voltage:Uv.optional(),frequency:bA.optional(),peak_to_peak_voltage:Uv.optional(),wave_shape:OAe.optional(),phase:um.optional(),duty_cycle:yxt.optional()}).describe("Defines an AC voltage source for simulation"),zAe=Jn([LAe,DAe]).describe("Defines a voltage source for simulation"),$Ae=Jn([sMe,oMe,rMe,cMe,aMe,FK,DK,q7,$K,zK,BK,UK,jK,GK,YK,qK,KK,XK,WK,ZK,VK,HK,lMe,uMe,QK,JK,eQ,FMe,jMe,vAe,W7,sQ,aQ,HMe,_Ae,VMe,nAe,XMe,KMe,iAe,YMe,qMe,rAe,wAe,sAe,aAe,cAe,lAe,uAe,dAe,hAe,QMe,JMe,oAe,eAe,tAe,fAe,pAe,SAe,mAe,EAe,xAe,TAe,MAe,AAe,IAe,NAe,dMe,SMe,gMe,bMe,xMe,vMe,yMe,EMe,wMe,hMe,MMe,AMe,TMe,IMe,NMe,nQ,kMe,OMe,LMe,kAe,zAe]),Z7=$Ae;const lQ=Object.freeze(Object.defineProperty({__proto__:null,all_layers:DN,any_circuit_element:$Ae,any_soup_element:Z7,any_source_component:rMe,battery_capacity:Q3e,brep_shape:zMe,cad_component:kAe,capacitance:VC,circuit_json_footprint_load_error:sQ,current:Ybt,distance:$t,external_footprint_load_error:W7,frequency:bA,getZodPrefixedIdWithDefault:qr,inductance:OK,layer_ref:Wc,layer_string:tQ,length:at,ninePointAnchor:G7,pcb_autorouting_error:SAe,pcb_board:rAe,pcb_breakout_point:EAe,pcb_component:FMe,pcb_component_outside_board_error:NAe,pcb_copper_pour:IAe,pcb_copper_pour_brep:RAe,pcb_copper_pour_polygon:PAe,pcb_copper_pour_rect:CAe,pcb_cutout:xAe,pcb_cutout_circle:gAe,pcb_cutout_polygon:bAe,pcb_cutout_rect:yAe,pcb_fabrication_note_path:fAe,pcb_fabrication_note_text:pAe,pcb_footprint_overlap_error:mAe,pcb_ground_plane:TAe,pcb_ground_plane_region:MAe,pcb_group:wAe,pcb_hole:jMe,pcb_hole_circle_or_square_shape:ext,pcb_hole_oval_shape:txt,pcb_keepout:_Ae,pcb_manual_edit_conflict_warning:aQ,pcb_missing_footprint_error:vAe,pcb_net:nAe,pcb_placement_error:oAe,pcb_plated_hole:HMe,pcb_port:VMe,pcb_port_not_connected_error:tAe,pcb_port_not_matched_error:eAe,pcb_route_hint:$Me,pcb_route_hints:Jbt,pcb_silkscreen_circle:dAe,pcb_silkscreen_line:aAe,pcb_silkscreen_oval:hAe,pcb_silkscreen_path:cAe,pcb_silkscreen_rect:uAe,pcb_silkscreen_text:lAe,pcb_smtpad:YMe,pcb_smtpad_pill:GMe,pcb_solder_paste:qMe,pcb_text:XMe,pcb_thermal_spoke:AAe,pcb_trace:KMe,pcb_trace_error:QMe,pcb_trace_hint:sAe,pcb_trace_missing_error:JMe,pcb_trace_route_point:rQ,pcb_trace_route_point_via:ZMe,pcb_trace_route_point_wire:WMe,pcb_via:iAe,point:wa,point3:GC,point_with_bulge:DMe,port_arrangement:_Me,position:Xbt,position3:Wbt,resistance:HC,ring:iQ,rotation:um,route_hint_point:O5,schematic_arc:vMe,schematic_box:dMe,schematic_circle:xMe,schematic_component:yMe,schematic_component_port_arrangement_by_sides:mMe,schematic_component_port_arrangement_by_size:fMe,schematic_debug_line:RMe,schematic_debug_object:IMe,schematic_debug_object_base:X7,schematic_debug_point:PMe,schematic_debug_rect:CMe,schematic_error:MMe,schematic_group:kMe,schematic_layout_error:AMe,schematic_line:gMe,schematic_manual_edit_conflict_warning:nQ,schematic_net_label:TMe,schematic_path:hMe,schematic_pin_styles:pMe,schematic_port:EMe,schematic_rect:bMe,schematic_table:OMe,schematic_table_cell:LMe,schematic_text:SMe,schematic_trace:wMe,schematic_voltage_probe:NMe,simulation_ac_voltage_source:DAe,simulation_dc_voltage_source:LAe,simulation_voltage_source:zAe,size:LK,source_component_base:kg,source_failed_to_create_component_error:nMe,source_group:aMe,source_manually_placed_via:uMe,source_missing_property_error:tMe,source_net:cMe,source_pcb_ground_plane:lMe,source_pin_missing_trace_warning:eQ,source_port:oMe,source_project_metadata:QK,source_property_ignored_warning:iMe,source_simple_battery:UK,source_simple_capacitor:DK,source_simple_chip:FK,source_simple_crystal:eMe,source_simple_diode:q7,source_simple_ground:J3e,source_simple_inductor:jK,source_simple_led:$K,source_simple_mosfet:ZK,source_simple_pin_header:GK,source_simple_pinout:YK,source_simple_potentiometer:VK,source_simple_power_source:BK,source_simple_push_button:HK,source_simple_resistor:zK,source_simple_resonator:qK,source_simple_switch:KK,source_simple_test_point:WK,source_simple_transistor:XK,source_trace:sMe,source_trace_not_connected_error:JK,supplier_name:Y7,time:qbt,visible_layer:YC,voltage:Uv,wave_shape:OAe},Symbol.toStringTag,{value:"Module"}));function qt(n,e){return Array.isArray(e)?[n.a*e[0]+n.c*e[1]+n.e,n.b*e[0]+n.d*e[1]+n.f]:{x:n.a*e.x+n.c*e.y+n.e,y:n.b*e.x+n.d*e.y+n.f}}function gxt(n,e){return e.map(t=>qt(n,t))}function FAe(n){return{a:parseFloat(n.a),b:parseFloat(n.b),c:parseFloat(n.c),d:parseFloat(n.d),e:parseFloat(n.e),f:parseFloat(n.f)}}const bxt=/^matrix\(\s*([0-9_+-.e]+)\s*,\s*([0-9_+-.e]+)\s*,\s*([0-9_+-.e]+)\s*,\s*([0-9_+-.e]+)\s*,\s*([0-9_+-.e]+)\s*,\s*([0-9_+-.e]+)\s*\)$/i;function K7(n){const e=n.match(bxt);if(e===null||e.length<7)throw new Error(`'${n}' is not a matrix`);return{a:parseFloat(e[1]),b:parseFloat(e[2]),c:parseFloat(e[3]),d:parseFloat(e[4]),e:parseFloat(e[5]),f:parseFloat(e[6])}}function dm(){return{a:1,c:0,e:0,b:0,d:1,f:0}}function iS(n){const{a:e,b:t,c:i,d:r,e:o,f:s}=n,a=e*r-t*i;return{a:r/a,b:t/-a,c:i/-a,d:e/a,e:(r*o-i*s)/-a,f:(t*o-e*s)/a}}function zN(n){return typeof n>"u"}function qC(n){return typeof n=="number"&&!Number.isNaN(n)&&Number.isFinite(n)}function xxt(n){return typeof n=="object"&&n!==null&&!Array.isArray(n)}function vxt(n){return xxt(n)&&"a"in n&&qC(n.a)&&"b"in n&&qC(n.b)&&"c"in n&&qC(n.c)&&"d"in n&&qC(n.d)&&"e"in n&&qC(n.e)&&"f"in n&&qC(n.f)}function Cs(n,e=0){return{a:1,c:0,e:n,b:0,d:1,f:e}}function XC(...n){n=Array.isArray(n[0])?n[0]:n;const e=(t,i)=>({a:t.a*i.a+t.c*i.b,c:t.a*i.c+t.c*i.d,e:t.a*i.e+t.c*i.f+t.e,b:t.b*i.a+t.d*i.b,d:t.b*i.c+t.d*i.d,f:t.b*i.e+t.d*i.f+t.f});switch(n.length){case 0:throw new Error("no matrices provided");case 1:return n[0];case 2:return e(n[0],n[1]);default:{const[t,i,...r]=n,o=e(t,i);return XC(o,...r)}}}function ls(...n){return XC(...n)}const{cos:wxt,sin:Sxt,PI:Ext}=Math;function ov(n,e,t){const i=wxt(n),r=Sxt(n),o={a:i,c:-r,e:0,b:r,d:i,f:0};return zN(e)||zN(t)?o:XC([Cs(e,t),o,Cs(-e,-t)])}function $N(n,e=void 0,t=void 0){return ov(n*Ext/180,e,t)}function Og(n,e=void 0,t=void 0,i=void 0){zN(e)&&(e=n);const r={a:n,c:0,e:0,b:0,d:e,f:0};return zN(t)||zN(i)?r:XC([Cs(t,i),r,Cs(-t,-i)])}function BAe(n,e){return{a:1,c:n,e:0,b:e,d:1,f:0}}const{tan:UAe}=Math;function jAe(n,e){return{a:1,c:UAe(n),e:0,b:UAe(e),d:1,f:0}}function uQ(n,e){return jAe(n*Math.PI/180,e*Math.PI/180)}function Txt(n){return cE(n)}function HAe(n){return cE(n)}function cE(n){return`matrix(${n.a},${n.b},${n.c},${n.d},${n.e},${n.f})`}function VAe(n,e=1e10){return{a:Math.round(n.a*e)/e,b:Math.round(n.b*e)/e,c:Math.round(n.c*e)/e,d:Math.round(n.d*e)/e,e:Math.round(n.e*e)/e,f:Math.round(n.f*e)/e}}function GAe(n,e){const t=n[0].x!=null?n[0].x:n[0][0],i=n[0].y!=null?n[0].y:n[0][1],r=e[0].x!=null?e[0].x:e[0][0],o=e[0].y!=null?e[0].y:e[0][1],s=n[1].x!=null?n[1].x:n[1][0],a=n[1].y!=null?n[1].y:n[1][1],c=e[1].x!=null?e[1].x:e[1][0],l=e[1].y!=null?e[1].y:e[1][1],u=n[2].x!=null?n[2].x:n[2][0],d=n[2].y!=null?n[2].y:n[2][1],h=e[2].x!=null?e[2].x:e[2][0],f=e[2].y!=null?e[2].y:e[2][1],m={a:t-u,b:i-d,c:s-u,d:a-d,e:u,f:d},y={a:r-h,b:o-f,c:c-h,d:l-f,e:h,f},g=iS(m),b=XC([y,g]);return VAe(b)}function Mxt(n){return Array.isArray(n)?n.map(e):e(n);function e(t){switch(t.type){case"matrix":if("a"in t&&"b"in t&&"c"in t&&"d"in t&&"e"in t&&"f"in t)return FAe(t);throw new Error("MISSING_MANDATORY_PARAM");case"translate":if(!("tx"in t))throw new Error("MISSING_MANDATORY_PARAM");return"ty"in t?Cs(t.tx,t.ty):Cs(t.tx);case"scale":if(!("sx"in t))throw new Error("MISSING_MANDATORY_PARAM");return"sy"in t?Og(t.sx,t.sy):Og(t.sx);case"rotate":if(!("angle"in t))throw new Error("MISSING_MANDATORY_PARAM");return"cx"in t&&"cy"in t?$N(t.angle,t.cx,t.cy):$N(t.angle);case"skewX":if(!("angle"in t))throw new Error("MISSING_MANDATORY_PARAM");return uQ(t.angle,0);case"skewY":if(!("angle"in t))throw new Error("MISSING_MANDATORY_PARAM");return uQ(0,t.angle);case"shear":if(!("shx"in t&&"shy"in t))throw new Error("MISSING_MANDATORY_PARAM");return BAe(t.shx,t.shy);default:throw new Error("UNSUPPORTED_DESCRIPTOR")}}}function Axt(n,e){function t(){this.constructor=n}t.prototype=e.prototype,n.prototype=new t}function WC(n,e,t,i){var r=Error.call(this,n);return Object.setPrototypeOf&&Object.setPrototypeOf(r,WC.prototype),r.expected=e,r.found=t,r.location=i,r.name="SyntaxError",r}Axt(WC,Error);function dQ(n,e,t){return t=t||" ",n.length>e?n:(e-=n.length,t+=t.repeat(e),n+t.slice(0,e))}WC.prototype.format=function(n){var e="Error: "+this.message;if(this.location){var t=null,i;for(i=0;i<n.length;i++)if(n[i].source===this.location.source){t=n[i].text.split(/\r\n|\n|\r/g);break}var r=this.location.start,o=this.location.source&&typeof this.location.source.offset=="function"?this.location.source.offset(r):r,s=this.location.source+":"+o.line+":"+o.column;if(t){var a=this.location.end,c=dQ("",o.line.toString().length," "),l=t[r.line-1],u=r.line===a.line?a.column:l.length+1,d=u-r.column||1;e+=`
|
|
322
|
+
`)).length,r=0;r<i;r++){var s=n.charCodeAt(r),a=null;s<128?t++:a=s>127&&s<2048?String.fromCharCode(s>>6|192,63&s|128):String.fromCharCode(s>>12|224,s>>6&63|128,63&s|128),i3(a)||(t>e&&(o+=n.substring(e,t)),o+=a,e=t=r+1)}return t>e&&(o+=n.substring(e,n.length)),o},p1t=!!aZ||!!sZ,MTe="text/plain",S7=(n,e)=>{var[t,i]=n.split("?"),r=Qr({},e);i?.split("&").forEach((s=>{var[a]=s.split("=");delete r[a]}));var o=tgt(r);return t+"?"+(o=o?(i?i+"&":"")+o:i)},gN=(n,e)=>JSON.stringify(n,((t,i)=>typeof i=="bigint"?i.toString():i),e),WZ=n=>{var{data:e,compression:t}=n;if(e){if(t===E5.GZipJS){var i=hTe(pTe(gN(e)),{mtime:0}),r=new Blob([i],{type:MTe});return{contentType:MTe,body:r,estimatedSize:r.size}}if(t===E5.Base64){var o=(function(c){var l,u,d,h,f,m="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",y=0,g=0,b="",v=[];if(!c)return c;c=h1t(c);do l=(f=c.charCodeAt(y++)<<16|c.charCodeAt(y++)<<8|c.charCodeAt(y++))>>18&63,u=f>>12&63,d=f>>6&63,h=63&f,v[g++]=m.charAt(l)+m.charAt(u)+m.charAt(d)+m.charAt(h);while(y<c.length);switch(b=v.join(""),c.length%3){case 1:b=b.slice(0,-2)+"==";break;case 2:b=b.slice(0,-1)+"="}return b})(gN(e)),s=(c=>"data="+encodeURIComponent(typeof c=="string"?c:gN(c)))(o);return{contentType:"application/x-www-form-urlencoded",body:s,estimatedSize:new Blob([s]).size}}var a=gN(e);return{contentType:"application/json",body:a,estimatedSize:new Blob([a]).size}}},bN=[];sZ&&bN.push({transport:"fetch",method:n=>{var e,t,{contentType:i,body:r,estimatedSize:o}=(e=WZ(n))!==null&&e!==void 0?e:{},s=new Headers;vf(n.headers,(function(u,d){s.append(d,u)})),i&&s.append("Content-Type",i);var a=n.url,c=null;if(r5e){var l=new r5e;c={signal:l.signal,timeout:setTimeout((()=>l.abort()),n.timeout)}}sZ(a,Qr({method:n?.method||"GET",headers:s,keepalive:n.method==="POST"&&(o||0)<52428.8,body:r,signal:(t=c)==null?void 0:t.signal},n.fetchOptions)).then((u=>u.text().then((d=>{var h={statusCode:u.status,text:d};if(u.status===200)try{h.json=JSON.parse(d)}catch(f){Yr.error(f)}n.callback==null||n.callback(h)})))).catch((u=>{Yr.error(u),n.callback==null||n.callback({statusCode:0,text:u})})).finally((()=>c?clearTimeout(c.timeout):null))}}),aZ&&bN.push({transport:"XHR",method:n=>{var e,t=new aZ;t.open(n.method||"GET",n.url,!0);var{contentType:i,body:r}=(e=WZ(n))!==null&&e!==void 0?e:{};vf(n.headers,(function(o,s){t.setRequestHeader(s,o)})),i&&t.setRequestHeader("Content-Type",i),n.timeout&&(t.timeout=n.timeout),t.withCredentials=!0,t.onreadystatechange=()=>{if(t.readyState===4){var o={statusCode:t.status,text:t.responseText};if(t.status===200)try{o.json=JSON.parse(t.responseText)}catch{}n.callback==null||n.callback(o)}},t.send(r)}}),bw!=null&&bw.sendBeacon&&bN.push({transport:"sendBeacon",method:n=>{var e=S7(n.url,{beacon:"1"});try{var t,{contentType:i,body:r}=(t=WZ(n))!==null&&t!==void 0?t:{},o=typeof r=="string"?new Blob([r],{type:i}):r;bw.sendBeacon(e,o)}catch{}}});var kC=function(n,e){if(!(function(t){try{new RegExp(t)}catch{return!1}return!0})(e))return!1;try{return new RegExp(e).test(n)}catch{return!1}};function ATe(n,e,t){return gN({distinct_id:n,userPropertiesToSet:e,userPropertiesToSetOnce:t})}var f1t={exact:(n,e)=>e.some((t=>n.some((i=>t===i)))),is_not:(n,e)=>e.every((t=>n.every((i=>t!==i)))),regex:(n,e)=>e.some((t=>n.some((i=>kC(t,i))))),not_regex:(n,e)=>e.every((t=>n.every((i=>!kC(t,i))))),icontains:(n,e)=>e.map(E7).some((t=>n.map(E7).some((i=>t.includes(i))))),not_icontains:(n,e)=>e.map(E7).every((t=>n.map(E7).every((i=>!t.includes(i)))))},E7=n=>n.toLowerCase(),CTe=x1("[Error tracking]");let m1t=class{constructor(e){var t,i;this.ge=[],this._instance=e,this.ge=(t=(i=this._instance.persistence)==null?void 0:i.get_property(pZ))!==null&&t!==void 0?t:[]}onRemoteConfig(e){var t,i,r,o=(t=(i=e.errorTracking)==null?void 0:i.suppressionRules)!==null&&t!==void 0?t:[],s=(r=e.errorTracking)==null?void 0:r.captureExtensionExceptions;this.ge=o,this._instance.persistence&&this._instance.persistence.register({[pZ]:this.ge,[_5e]:s})}get _e(){var e,t=!!this._instance.get_property(_5e),i=this._instance.config.error_tracking.captureExtensionExceptions;return(e=i??t)!==null&&e!==void 0&&e}sendExceptionEvent(e){if(this.me(e))CTe.info("Skipping exception capture because a suppression rule matched");else{if(this._e||!this.be(e))return this._instance.capture("$exception",e,{_noTruncate:!0,_batchKey:"exceptionEvent"});CTe.info("Skipping exception capture because it was thrown by an extension")}}me(e){var t=e.$exception_list;if(!t||!p0(t)||t.length===0)return!1;var i=t.reduce(((r,o)=>{var{type:s,value:a}=o;return ly(s)&&s.length>0&&r.$exception_types.push(s),ly(a)&&a.length>0&&r.$exception_values.push(a),r}),{$exception_types:[],$exception_values:[]});return this.ge.some((r=>{var o=r.values.map((s=>{var a,c=f1t[s.operator],l=p0(s.value)?s.value:[s.value],u=(a=i[s.key])!==null&&a!==void 0?a:[];return l.length>0&&c(l,u)}));return r.type==="OR"?o.some(Boolean):o.every(Boolean)}))}be(e){var t=e.$exception_list;return!(!t||!p0(t))&&t.flatMap((i=>{var r,o;return(r=(o=i.stacktrace)==null?void 0:o.frames)!==null&&r!==void 0?r:[]})).some((i=>i.filename&&i.filename.startsWith("chrome-extension://")))}};var f2="Mobile",T7="iOS",rE="Android",xN="Tablet",RTe=rE+" "+xN,PTe="iPad",ITe="Apple",NTe=ITe+" Watch",vN="Safari",OC="BlackBerry",kTe="Samsung",OTe=kTe+"Browser",LTe=kTe+" Internet",fA="Chrome",_1t=fA+" OS",DTe=fA+" "+T7,ZZ="Internet Explorer",zTe=ZZ+" "+f2,KZ="Opera",y1t=KZ+" Mini",QZ="Edge",$Te="Microsoft "+QZ,LC="Firefox",FTe=LC+" "+T7,wN="Nintendo",SN="PlayStation",DC="Xbox",BTe=rE+" "+f2,UTe=f2+" "+vN,EN="Windows",JZ=EN+" Phone",jTe="Nokia",eK="Ouya",HTe="Generic",g1t=HTe+" "+f2.toLowerCase(),VTe=HTe+" "+xN.toLowerCase(),tK="Konqueror",rv="(\\d+(\\.\\d+)?)",nK=new RegExp("Version/"+rv),b1t=new RegExp(DC,"i"),x1t=new RegExp(SN+" \\w+","i"),v1t=new RegExp(wN+" \\w+","i"),iK=new RegExp(OC+"|PlayBook|BB10","i"),w1t={"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"},S1t=(n,e)=>e&&Fl(e,ITe)||(function(t){return Fl(t,vN)&&!Fl(t,fA)&&!Fl(t,rE)})(n),GTe=function(n,e){return e=e||"",Fl(n," OPR/")&&Fl(n,"Mini")?y1t:Fl(n," OPR/")?KZ:iK.test(n)?OC:Fl(n,"IE"+f2)||Fl(n,"WPDesktop")?zTe:Fl(n,OTe)?LTe:Fl(n,QZ)||Fl(n,"Edg/")?$Te:Fl(n,"FBIOS")?"Facebook "+f2:Fl(n,"UCWEB")||Fl(n,"UCBrowser")?"UC Browser":Fl(n,"CriOS")?DTe:Fl(n,"CrMo")||Fl(n,fA)?fA:Fl(n,rE)&&Fl(n,vN)?BTe:Fl(n,"FxiOS")?FTe:Fl(n.toLowerCase(),tK.toLowerCase())?tK:S1t(n,e)?Fl(n,f2)?UTe:vN:Fl(n,LC)?LC:Fl(n,"MSIE")||Fl(n,"Trident/")?ZZ:Fl(n,"Gecko")?LC:""},E1t={[zTe]:[new RegExp("rv:"+rv)],[$Te]:[new RegExp(QZ+"?\\/"+rv)],[fA]:[new RegExp("("+fA+"|CrMo)\\/"+rv)],[DTe]:[new RegExp("CriOS\\/"+rv)],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/"+rv)],[vN]:[nK],[UTe]:[nK],[KZ]:[new RegExp("(Opera|OPR)\\/"+rv)],[LC]:[new RegExp(LC+"\\/"+rv)],[FTe]:[new RegExp("FxiOS\\/"+rv)],[tK]:[new RegExp("Konqueror[:/]?"+rv,"i")],[OC]:[new RegExp(OC+" "+rv),nK],[BTe]:[new RegExp("android\\s"+rv,"i")],[LTe]:[new RegExp(OTe+"\\/"+rv)],[ZZ]:[new RegExp("(rv:|MSIE )"+rv)],Mozilla:[new RegExp("rv:"+rv)]},T1t=function(n,e){var t=GTe(n,e),i=E1t[t];if(br(i))return null;for(var r=0;r<i.length;r++){var o=i[r],s=n.match(o);if(s)return parseFloat(s[s.length-2])}return null},YTe=[[new RegExp(DC+"; "+DC+" (.*?)[);]","i"),n=>[DC,n&&n[1]||""]],[new RegExp(wN,"i"),[wN,""]],[new RegExp(SN,"i"),[SN,""]],[iK,[OC,""]],[new RegExp(EN,"i"),(n,e)=>{if(/Phone/.test(e)||/WPDesktop/.test(e))return[JZ,""];if(new RegExp(f2).test(e)&&!/IEMobile\b/.test(e))return[EN+" "+f2,""];var t=/Windows NT ([0-9.]+)/i.exec(e);if(t&&t[1]){var i=t[1],r=w1t[i]||"";return/arm/i.test(e)&&(r="RT"),[EN,r]}return[EN,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,n=>{if(n&&n[3]){var e=[n[3],n[4],n[5]||"0"];return[T7,e.join(".")]}return[T7,""]}],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,n=>{var e="";return n&&n.length>=3&&(e=br(n[2])?n[3]:n[2]),["watchOS",e]}],[new RegExp("("+rE+" (\\d+)\\.(\\d+)\\.?(\\d+)?|"+rE+")","i"),n=>{if(n&&n[2]){var e=[n[2],n[3],n[4]||"0"];return[rE,e.join(".")]}return[rE,""]}],[/Mac OS X (\d+)[_.](\d+)[_.]?(\d+)?/i,n=>{var e=["Mac OS X",""];if(n&&n[1]){var t=[n[1],n[2],n[3]||"0"];e[1]=t.join(".")}return e}],[/Mac/i,["Mac OS X",""]],[/CrOS/,[_1t,""]],[/Linux|debian/i,["Linux",""]]],qTe=function(n){return v1t.test(n)?wN:x1t.test(n)?SN:b1t.test(n)?DC:new RegExp(eK,"i").test(n)?eK:new RegExp("("+JZ+"|WPDesktop)","i").test(n)?JZ:/iPad/.test(n)?PTe:/iPod/.test(n)?"iPod Touch":/iPhone/.test(n)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(n)?NTe:iK.test(n)?OC:/(kobo)\s(ereader|touch)/i.test(n)?"Kobo":new RegExp(jTe,"i").test(n)?jTe:/(kf[a-z]{2}wi|aeo[c-r]{2})( bui|\))/i.test(n)||/(kf[a-z]+)( bui|\)).+silk\//i.test(n)?"Kindle Fire":/(Android|ZTE)/i.test(n)?!new RegExp(f2).test(n)||/(9138B|TB782B|Nexus [97]|pixel c|HUAWEISHT|BTV|noble nook|smart ultra 6)/i.test(n)?/pixel[\daxl ]{1,6}/i.test(n)&&!/pixel c/i.test(n)||/(huaweimed-al00|tah-|APA|SM-G92|i980|zte|U304AA)/i.test(n)||/lmy47v/i.test(n)&&!/QTAQZ3/i.test(n)?rE:RTe:rE:new RegExp("(pda|"+f2+")","i").test(n)?g1t:new RegExp(xN,"i").test(n)&&!new RegExp(xN+" pc","i").test(n)?VTe:""},M7="https?://(.*)",A7=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],M1t=e7(["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid"],A7),rK="<masked>",A1t=["li_fat_id"];function XTe(n,e,t){if(!Kr)return{};var i,r=e?e7([],A7,t||[]):[],o=WTe(MZ(Kr.URL,r,rK),n),s=(i={},vf(A1t,(function(a){var c=tE.V(a);i[a]=c||null})),i);return qy(s,o)}function WTe(n,e){var t=M1t.concat(e||[]),i={};return vf(t,(function(r){var o=d7(n,r);i[r]=o||null})),i}function ZTe(n){var e=(function(o){return o?o.search(M7+"google.([^/?]*)")===0?"google":o.search(M7+"bing.com")===0?"bing":o.search(M7+"yahoo.com")===0?"yahoo":o.search(M7+"duckduckgo.com")===0?"duckduckgo":null:null})(n),t=e!="yahoo"?"q":"p",i={};if(!i3(e)){i.$search_engine=e;var r=Kr?d7(Kr.referrer,t):"";r.length&&(i.ph_keyword=r)}return i}function KTe(){return navigator.language||navigator.userLanguage}function QTe(){return Kr?.referrer||"$direct"}function JTe(n,e){var t=n?e7([],A7,e||[]):[],i=zv?.href.substring(0,1e3);return{r:QTe().substring(0,1e3),u:i?MZ(i,t,rK):void 0}}function e3e(n){var e,{r:t,u:i}=n,r={$referrer:t,$referring_domain:t==null?void 0:t=="$direct"?"$direct":(e=PC(t))==null?void 0:e.host};if(i){r.$current_url=i;var o=PC(i);r.$host=o?.host,r.$pathname=o?.pathname;var s=WTe(i);qy(r,s)}if(t){var a=ZTe(t);qy(r,a)}return r}function t3e(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch{return}}function C1t(){try{return new Date().getTimezoneOffset()}catch{return}}function R1t(n,e){if(!$v)return{};var t,i,r,o=n?e7([],A7,e||[]):[],[s,a]=(function(c){for(var l=0;l<YTe.length;l++){var[u,d]=YTe[l],h=u.exec(c),f=h&&(h2(d)?d(h,c):d);if(f)return f}return["",""]})($v);return qy(dZ({$os:s,$os_version:a,$browser:GTe($v,navigator.vendor),$device:qTe($v),$device_type:(i=$v,r=qTe(i),r===PTe||r===RTe||r==="Kobo"||r==="Kindle Fire"||r===VTe?xN:r===wN||r===DC||r===SN||r===eK?"Console":r===NTe?"Wearable":r?f2:"Desktop"),$timezone:t3e(),$timezone_offset:C1t()}),{$current_url:MZ(zv?.href,o,rK),$host:zv?.host,$pathname:zv?.pathname,$raw_user_agent:$v.length>1e3?$v.substring(0,997)+"...":$v,$browser_version:T1t($v,navigator.vendor),$browser_language:KTe(),$browser_language_prefix:(t=KTe(),typeof t=="string"?t.split("-")[0]:void 0),$screen_height:qn?.screen.height,$screen_width:qn?.screen.width,$viewport_height:qn?.innerHeight,$viewport_width:qn?.innerWidth,$lib:"web",$lib_version:w5.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3})}var oE=x1("[FeatureFlags]"),oK="$active_feature_flags",zC="$override_feature_flags",n3e="$feature_flag_payloads",TN="$override_feature_flag_payloads",i3e="$feature_flag_request_id",r3e=n=>{var e={};for(var[t,i]of t7(n||{}))i&&(e[t]=i);return e},P1t=n=>{var e=n.flags;return e?(n.featureFlags=Object.fromEntries(Object.keys(e).map((t=>{var i;return[t,(i=e[t].variant)!==null&&i!==void 0?i:e[t].enabled]}))),n.featureFlagPayloads=Object.fromEntries(Object.keys(e).filter((t=>e[t].enabled)).filter((t=>{var i;return(i=e[t].metadata)==null?void 0:i.payload})).map((t=>{var i;return[t,(i=e[t].metadata)==null?void 0:i.payload]})))):oE.warn("Using an older version of the feature flags endpoint. Please upgrade your PostHog server to the latest version"),n},I1t=(function(n){return n.FeatureFlags="feature_flags",n.Recordings="recordings",n})({});let N1t=class{constructor(e){this.ye=!1,this.we=!1,this.Se=!1,this.$e=!1,this.ke=!1,this.xe=!1,this.Ee=!1,this._instance=e,this.featureFlagEventHandlers=[]}flags(){if(this._instance.config.__preview_remote_config)this.xe=!0;else{var e=!this.Ie&&(this._instance.config.advanced_disable_feature_flags||this._instance.config.advanced_disable_feature_flags_on_first_load);this.Re({disableFlags:e})}}get hasLoadedFlags(){return this.we}getFlags(){return Object.keys(this.getFlagVariants())}getFlagsWithDetails(){var e=this._instance.get_property(_Z),t=this._instance.get_property(zC),i=this._instance.get_property(TN);if(!i&&!t)return e||{};var r=qy({},e||{}),o=[...new Set([...Object.keys(i||{}),...Object.keys(t||{})])];for(var s of o){var a,c,l=r[s],u=t?.[s],d=br(u)?(a=l?.enabled)!==null&&a!==void 0&&a:!!u,h=br(u)?l.variant:typeof u=="string"?u:void 0,f=i?.[s],m=Qr({},l,{enabled:d,variant:d?h??l?.variant:void 0});d!==l?.enabled&&(m.original_enabled=l?.enabled),h!==l?.variant&&(m.original_variant=l?.variant),f&&(m.metadata=Qr({},l?.metadata,{payload:f,original_payload:l==null||(c=l.metadata)==null?void 0:c.payload})),r[s]=m}return this.ye||(oE.warn(" Overriding feature flag details!",{flagDetails:e,overriddenPayloads:i,finalDetails:r}),this.ye=!0),r}getFlagVariants(){var e=this._instance.get_property(CC),t=this._instance.get_property(zC);if(!t)return e||{};for(var i=qy({},e),r=Object.keys(t),o=0;o<r.length;o++)i[r[o]]=t[r[o]];return this.ye||(oE.warn(" Overriding feature flags!",{enabledFlags:e,overriddenFlags:t,finalFlags:i}),this.ye=!0),i}getFlagPayloads(){var e=this._instance.get_property(n3e),t=this._instance.get_property(TN);if(!t)return e||{};for(var i=qy({},e||{}),r=Object.keys(t),o=0;o<r.length;o++)i[r[o]]=t[r[o]];return this.ye||(oE.warn(" Overriding feature flag payloads!",{flagPayloads:e,overriddenPayloads:t,finalPayloads:i}),this.ye=!0),i}reloadFeatureFlags(){this.$e||this._instance.config.advanced_disable_feature_flags||this.Ie||(this.Ie=setTimeout((()=>{this.Re()}),5))}Pe(){clearTimeout(this.Ie),this.Ie=void 0}ensureFlagsLoaded(){this.we||this.Se||this.Ie||this.reloadFeatureFlags()}setAnonymousDistinctId(e){this.$anon_distinct_id=e}setReloadingPaused(e){this.$e=e}Re(e){var t;if(this.Pe(),!this._instance.L())if(this.Se)this.ke=!0;else{var i={token:this._instance.config.token,distinct_id:this._instance.get_distinct_id(),groups:this._instance.getGroups(),$anon_distinct_id:this.$anon_distinct_id,person_properties:Qr({},((t=this._instance.persistence)==null?void 0:t.get_initial_props())||{},this._instance.get_property(uN)||{}),group_properties:this._instance.get_property(cA)};(e!=null&&e.disableFlags||this._instance.config.advanced_disable_feature_flags)&&(i.disable_flags=!0);var r=this._instance.config.__preview_remote_config,o=r?"/flags/?v=2":"/flags/?v=2&config=true",s=this._instance.config.advanced_only_evaluate_survey_feature_flags?"&only_evaluate_survey_feature_flags=true":"",a=this._instance.requestRouter.endpointFor("api",o+s);r&&(i.timezone=t3e()),this.Se=!0,this._instance.Te({method:"POST",url:a,data:i,compression:this._instance.config.disable_compression?void 0:E5.Base64,timeout:this._instance.config.feature_flag_request_timeout_ms,callback:c=>{var l,u,d=!0;if(c.statusCode===200&&(this.ke||(this.$anon_distinct_id=void 0),d=!1),this.Se=!1,this.xe||(this.xe=!0,this._instance.Ce((u=c.json)!==null&&u!==void 0?u:{})),!i.disable_flags||this.ke)if(this.Ee=!d,c.json&&(l=c.json.quotaLimited)!=null&&l.includes(I1t.FeatureFlags))oE.warn("You have hit your feature flags quota limit, and will not be able to load feature flags until the quota is reset. Please visit https://posthog.com/docs/billing/limits-alerts to learn more.");else{var h;i.disable_flags||this.receivedFeatureFlags((h=c.json)!==null&&h!==void 0?h:{},d),this.ke&&(this.ke=!1,this.Re())}}})}}getFeatureFlag(e,t){if(t===void 0&&(t={}),this.we||this.getFlags()&&this.getFlags().length>0){var i=this.getFlagVariants()[e],r=""+i,o=this._instance.get_property(i3e)||void 0,s=this._instance.get_property(o7)||{};if((t.send_event||!("send_event"in t))&&(!(e in s)||!s[e].includes(r))){var a,c,l,u,d,h,f,m,y;p0(s[e])?s[e].push(r):s[e]=[r],(a=this._instance.persistence)==null||a.register({[o7]:s});var g=this.getFeatureFlagDetails(e),b={$feature_flag:e,$feature_flag_response:i,$feature_flag_payload:this.getFeatureFlagPayload(e)||null,$feature_flag_request_id:o,$feature_flag_bootstrapped_response:((c=this._instance.config.bootstrap)==null||(c=c.featureFlags)==null?void 0:c[e])||null,$feature_flag_bootstrapped_payload:((l=this._instance.config.bootstrap)==null||(l=l.featureFlagPayloads)==null?void 0:l[e])||null,$used_bootstrap_value:!this.Ee};br(g==null||(u=g.metadata)==null?void 0:u.version)||(b.$feature_flag_version=g.metadata.version);var v,w=(d=g==null||(h=g.reason)==null?void 0:h.description)!==null&&d!==void 0?d:g==null||(f=g.reason)==null?void 0:f.code;w&&(b.$feature_flag_reason=w),g!=null&&(m=g.metadata)!=null&&m.id&&(b.$feature_flag_id=g.metadata.id),br(g?.original_variant)&&br(g?.original_enabled)||(b.$feature_flag_original_response=br(g.original_variant)?g.original_enabled:g.original_variant),g!=null&&(y=g.metadata)!=null&&y.original_payload&&(b.$feature_flag_original_payload=g==null||(v=g.metadata)==null?void 0:v.original_payload),this._instance.capture("$feature_flag_called",b)}return i}oE.warn('getFeatureFlag for key "'+e+`" failed. Feature flags didn't load in time.`)}getFeatureFlagDetails(e){return this.getFlagsWithDetails()[e]}getFeatureFlagPayload(e){return this.getFlagPayloads()[e]}getRemoteConfigPayload(e,t){var i=this._instance.config.token;this._instance.Te({method:"POST",url:this._instance.requestRouter.endpointFor("api","/flags/?v=2&config=true"),data:{distinct_id:this._instance.get_distinct_id(),token:i},compression:this._instance.config.disable_compression?void 0:E5.Base64,timeout:this._instance.config.feature_flag_request_timeout_ms,callback:r=>{var o,s=(o=r.json)==null?void 0:o.featureFlagPayloads;t(s?.[e]||void 0)}})}isFeatureEnabled(e,t){if(t===void 0&&(t={}),this.we||this.getFlags()&&this.getFlags().length>0)return!!this.getFeatureFlag(e,t);oE.warn('isFeatureEnabled for key "'+e+`" failed. Feature flags didn't load in time.`)}addFeatureFlagsHandler(e){this.featureFlagEventHandlers.push(e)}removeFeatureFlagsHandler(e){this.featureFlagEventHandlers=this.featureFlagEventHandlers.filter((t=>t!==e))}receivedFeatureFlags(e,t){if(this._instance.persistence){this.we=!0;var i=this.getFlagVariants(),r=this.getFlagPayloads(),o=this.getFlagsWithDetails();(function(s,a,c,l,u){c===void 0&&(c={}),l===void 0&&(l={}),u===void 0&&(u={});var d=P1t(s),h=d.flags,f=d.featureFlags,m=d.featureFlagPayloads;if(f){var y=s.requestId;if(p0(f)){oE.warn("v1 of the feature flags endpoint is deprecated. Please use the latest version.");var g={};if(f)for(var b=0;b<f.length;b++)g[f[b]]=!0;a&&a.register({[oK]:f,[CC]:g})}else{var v=f,w=m,T=h;s.errorsWhileComputingFlags&&(v=Qr({},c,v),w=Qr({},l,w),T=Qr({},u,T)),a&&a.register(Qr({[oK]:Object.keys(r3e(v)),[CC]:v||{},[n3e]:w||{},[_Z]:T||{}},y?{[i3e]:y}:{}))}}})(e,this._instance.persistence,i,r,o),this.Me(t)}}override(e,t){t===void 0&&(t=!1),oE.warn("override is deprecated. Please use overrideFeatureFlags instead."),this.overrideFeatureFlags({flags:e,suppressWarning:t})}overrideFeatureFlags(e){if(!this._instance.__loaded||!this._instance.persistence)return oE.uninitializedWarning("posthog.featureFlags.overrideFeatureFlags");if(e===!1)return this._instance.persistence.unregister(zC),this._instance.persistence.unregister(TN),void this.Me();if(e&&typeof e=="object"&&("flags"in e||"payloads"in e)){var t,i=e;if(this.ye=!!((t=i.suppressWarning)!==null&&t!==void 0&&t),"flags"in i){if(i.flags===!1)this._instance.persistence.unregister(zC);else if(i.flags)if(p0(i.flags)){for(var r={},o=0;o<i.flags.length;o++)r[i.flags[o]]=!0;this._instance.persistence.register({[zC]:r})}else this._instance.persistence.register({[zC]:i.flags})}return"payloads"in i&&(i.payloads===!1?this._instance.persistence.unregister(TN):i.payloads&&this._instance.persistence.register({[TN]:i.payloads})),void this.Me()}this.Me()}onFeatureFlags(e){if(this.addFeatureFlagsHandler(e),this.we){var{flags:t,flagVariants:i}=this.Oe();e(t,i)}return()=>this.removeFeatureFlagsHandler(e)}updateEarlyAccessFeatureEnrollment(e,t,i){var r,o=(this._instance.get_property(lN)||[]).find((l=>l.flagKey===e)),s={["$feature_enrollment/"+e]:t},a={$feature_flag:e,$feature_enrollment:t,$set:s};o&&(a.$early_access_feature_name=o.name),i&&(a.$feature_enrollment_stage=i),this._instance.capture("$feature_enrollment_update",a),this.setPersonPropertiesForFlags(s,!1);var c=Qr({},this.getFlagVariants(),{[e]:t});(r=this._instance.persistence)==null||r.register({[oK]:Object.keys(r3e(c)),[CC]:c}),this.Me()}getEarlyAccessFeatures(e,t,i){t===void 0&&(t=!1);var r=this._instance.get_property(lN),o=i?"&"+i.map((s=>"stage="+s)).join("&"):"";if(r&&!t)return e(r);this._instance.Te({url:this._instance.requestRouter.endpointFor("api","/api/early_access_features/?token="+this._instance.config.token+o),method:"GET",callback:s=>{var a,c;if(s.json){var l=s.json.earlyAccessFeatures;return(a=this._instance.persistence)==null||a.unregister(lN),(c=this._instance.persistence)==null||c.register({[lN]:l}),e(l)}}})}Oe(){var e=this.getFlags(),t=this.getFlagVariants();return{flags:e.filter((i=>t[i])),flagVariants:Object.keys(t).filter((i=>t[i])).reduce(((i,r)=>(i[r]=t[r],i)),{})}}Me(e){var{flags:t,flagVariants:i}=this.Oe();this.featureFlagEventHandlers.forEach((r=>r(t,i,{errorsLoading:e})))}setPersonPropertiesForFlags(e,t){t===void 0&&(t=!0);var i=this._instance.get_property(uN)||{};this._instance.register({[uN]:Qr({},i,e)}),t&&this._instance.reloadFeatureFlags()}resetPersonPropertiesForFlags(){this._instance.unregister(uN)}setGroupPropertiesForFlags(e,t){t===void 0&&(t=!0);var i=this._instance.get_property(cA)||{};Object.keys(i).length!==0&&Object.keys(i).forEach((r=>{i[r]=Qr({},i[r],e[r]),delete e[r]})),this._instance.register({[cA]:Qr({},i,e)}),t&&this._instance.reloadFeatureFlags()}resetGroupPropertiesForFlags(e){if(e){var t=this._instance.get_property(cA)||{};this._instance.register({[cA]:Qr({},t,{[e]:{}})})}else this._instance.unregister(cA)}reset(){this.we=!1,this.Se=!1,this.$e=!1,this.ke=!1,this.xe=!1,this.Ee=!1,this.$anon_distinct_id=void 0,this.Pe(),this.ye=!1}};var k1t=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"];let sK=class{constructor(e,t){this.A=e,this.props={},this.Fe=!1,this.Ae=(i=>{var r="";return i.token&&(r=i.token.replace(/\+/g,"PL").replace(/\//g,"SL").replace(/=/g,"EQ")),i.persistence_name?"ph_"+i.persistence_name:"ph_"+r+"_posthog"})(e),this.it=this.De(e),this.load(),e.debug&&Yr.info("Persistence loaded",e.persistence,Qr({},this.props)),this.update_config(e,e,t),this.save()}isDisabled(){return!!this.je}De(e){k1t.indexOf(e.persistence.toLowerCase())===-1&&(Yr.critical("Unknown persistence type "+e.persistence+"; falling back to localStorage+cookie"),e.persistence="localStorage+cookie");var t=e.persistence.toLowerCase();return t==="localstorage"&&v1.G()?v1:t==="localstorage+cookie"&&p7.G()?p7:t==="sessionstorage"&&Xb.G()?Xb:t==="memory"?pgt:t==="cookie"?tE:p7.G()?p7:tE}properties(){var e={};return vf(this.props,(function(t,i){if(i===CC&&cy(t))for(var r=Object.keys(t),o=0;o<r.length;o++)e["$feature/"+r[o]]=t[r[o]];else a=i,c=!1,(i3(s=Gyt)?c:i5e&&s.indexOf===i5e?s.indexOf(a)!=-1:(vf(s,(function(l){if(c||(c=l===a))return JL})),c))||(e[i]=t);var s,a,c})),e}load(){if(!this.je){var e=this.it.K(this.Ae);e&&(this.props=qy({},e))}}save(){this.je||this.it.Y(this.Ae,this.props,this.Le,this.Ne,this.ze,this.A.debug)}remove(){this.it.X(this.Ae,!1),this.it.X(this.Ae,!0)}clear(){this.remove(),this.props={}}register_once(e,t,i){if(cy(e)){br(t)&&(t="None"),this.Le=br(i)?this.Ue:i;var r=!1;if(vf(e,((o,s)=>{this.props.hasOwnProperty(s)&&this.props[s]!==t||(this.props[s]=o,r=!0)})),r)return this.save(),!0}return!1}register(e,t){if(cy(e)){this.Le=br(t)?this.Ue:t;var i=!1;if(vf(e,((r,o)=>{e.hasOwnProperty(o)&&this.props[o]!==r&&(this.props[o]=r,i=!0)})),i)return this.save(),!0}return!1}unregister(e){e in this.props&&(delete this.props[e],this.save())}update_campaign_params(){if(!this.Fe){var e=XTe(this.A.custom_campaign_params,this.A.mask_personal_data_properties,this.A.custom_personal_data_properties);AC(dZ(e))||this.register(e),this.Fe=!0}}update_search_keyword(){var e;this.register((e=Kr?.referrer)?ZTe(e):{})}update_referrer_info(){var e;this.register_once({$referrer:QTe(),$referring_domain:Kr!=null&&Kr.referrer&&((e=PC(Kr.referrer))==null?void 0:e.host)||"$direct"},void 0)}set_initial_person_info(){this.props[xZ]||this.props[vZ]||this.register_once({[s7]:JTe(this.A.mask_personal_data_properties,this.A.custom_personal_data_properties)},void 0)}get_initial_props(){var e={};vf([vZ,xZ],(s=>{var a=this.props[s];a&&vf(a,(function(c,l){e["$initial_"+cZ(l)]=c}))}));var t,i,r=this.props[s7];if(r){var o=(t=e3e(r),i={},vf(t,(function(s,a){i["$initial_"+cZ(a)]=s})),i);qy(e,o)}return e}safe_merge(e){return vf(this.props,(function(t,i){i in e||(e[i]=t)})),e}update_config(e,t,i){if(this.Ue=this.Le=e.cookie_expiration,this.set_disabled(e.disable_persistence||!!i),this.set_cross_subdomain(e.cross_subdomain_cookie),this.set_secure(e.secure_cookie),e.persistence!==t.persistence){var r=this.De(e),o=this.props;this.clear(),this.it=r,this.props=o,this.save()}}set_disabled(e){this.je=e,this.je?this.remove():this.save()}set_cross_subdomain(e){e!==this.Ne&&(this.Ne=e,this.remove(),this.save())}set_secure(e){e!==this.ze&&(this.ze=e,this.remove(),this.save())}set_event_timer(e,t){var i=this.props[sN]||{};i[e]=t,this.props[sN]=i,this.save()}remove_event_timer(e){var t=(this.props[sN]||{})[e];return br(t)||(delete this.props[sN][e],this.save()),t}get_property(e){return this.props[e]}set_property(e,t){this.props[e]=t,this.save()}},o3e=class{constructor(){this.qe={},this.qe={}}on(e,t){return this.qe[e]||(this.qe[e]=[]),this.qe[e].push(t),()=>{this.qe[e]=this.qe[e].filter((i=>i!==t))}}emit(e,t){for(var i of this.qe[e]||[])i(t);for(var r of this.qe["*"]||[])r(e,t)}},O1t=class jI{constructor(e){this.Be=new o3e,this.He=(t,i)=>this.We(t,i)&&this.Ge(t,i)&&this.Je(t,i),this.We=(t,i)=>i==null||!i.event||t?.event===i?.event,this._instance=e,this.Ve=new Set,this.Ke=new Set}init(){var e;if(!br((e=this._instance)==null?void 0:e.Ye)){var t;(t=this._instance)==null||t.Ye(((i,r)=>{this.on(i,r)}))}}register(e){var t,i;if(!br((t=this._instance)==null?void 0:t.Ye)&&(e.forEach((s=>{var a,c;(a=this.Ke)==null||a.add(s),(c=s.steps)==null||c.forEach((l=>{var u;(u=this.Ve)==null||u.add(l?.event||"")}))})),(i=this._instance)!=null&&i.autocapture)){var r,o=new Set;e.forEach((s=>{var a;(a=s.steps)==null||a.forEach((c=>{c!=null&&c.selector&&o.add(c?.selector)}))})),(r=this._instance)==null||r.autocapture.setElementSelectors(o)}}on(e,t){var i;t!=null&&e.length!=0&&(this.Ve.has(e)||this.Ve.has(t?.event))&&this.Ke&&((i=this.Ke)==null?void 0:i.size)>0&&this.Ke.forEach((r=>{this.Xe(t,r)&&this.Be.emit("actionCaptured",r.name)}))}Qe(e){this.onAction("actionCaptured",(t=>e(t)))}Xe(e,t){if(t?.steps==null)return!1;for(var i of t.steps)if(this.He(e,i))return!0;return!1}onAction(e,t){return this.Be.on(e,t)}Ge(e,t){if(t!=null&&t.url){var i,r=e==null||(i=e.properties)==null?void 0:i.$current_url;if(!r||typeof r!="string"||!jI.Ze(r,t?.url,t?.url_matching||"contains"))return!1}return!0}static Ze(e,t,i){switch(i){case"regex":return!!qn&&kC(e,t);case"exact":return t===e;case"contains":var r=jI.tr(t).replace(/_/g,".").replace(/%/g,".*");return kC(e,r);default:return!1}}static tr(e){return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}Je(e,t){if((t!=null&&t.href||t!=null&&t.tag_name||t!=null&&t.text)&&!this.ir(e).some((o=>!(t!=null&&t.href&&!jI.Ze(o.href||"",t?.href,t?.href_matching||"exact"))&&(t==null||!t.tag_name||o.tag_name===t?.tag_name)&&!(t!=null&&t.text&&!jI.Ze(o.text||"",t?.text,t?.text_matching||"exact")&&!jI.Ze(o.$el_text||"",t?.text,t?.text_matching||"exact")))))return!1;if(t!=null&&t.selector){var i,r=e==null||(i=e.properties)==null?void 0:i.$element_selectors;if(!r||!r.includes(t?.selector))return!1}return!0}ir(e){return e?.properties.$elements==null?[]:e?.properties.$elements}};(function(n){return n.Button="button",n.Tab="tab",n.Selector="selector",n})({}),(function(n){return n.TopLeft="top_left",n.TopRight="top_right",n.TopCenter="top_center",n.MiddleLeft="middle_left",n.MiddleRight="middle_right",n.MiddleCenter="middle_center",n.Left="left",n.Center="center",n.Right="right",n.NextToTrigger="next_to_trigger",n})({});var aK=(function(n){return n.Popover="popover",n.API="api",n.Widget="widget",n.ExternalSurvey="external_survey",n})({});(function(n){return n.Open="open",n.MultipleChoice="multiple_choice",n.SingleChoice="single_choice",n.Rating="rating",n.Link="link",n})({}),(function(n){return n.NextQuestion="next_question",n.End="end",n.ResponseBased="response_based",n.SpecificQuestion="specific_question",n})({}),(function(n){return n.Once="once",n.Recurring="recurring",n.Always="always",n})({});var cK=(function(n){return n.SHOWN="survey shown",n.DISMISSED="survey dismissed",n.SENT="survey sent",n})({}),s3e=(function(n){return n.SURVEY_ID="$survey_id",n.SURVEY_NAME="$survey_name",n.SURVEY_RESPONSE="$survey_response",n.SURVEY_ITERATION="$survey_iteration",n.SURVEY_ITERATION_START_DATE="$survey_iteration_start_date",n.SURVEY_PARTIALLY_COMPLETED="$survey_partially_completed",n.SURVEY_SUBMISSION_ID="$survey_submission_id",n.SURVEY_QUESTIONS="$survey_questions",n.SURVEY_COMPLETED="$survey_completed",n})({}),Ng=x1("[Surveys]"),lK="seenSurvey_",L1t=(n,e)=>{var t="$survey_"+e+"/"+n.id;return n.current_iteration&&n.current_iteration>0&&(t="$survey_"+e+"/"+n.id+"/"+n.current_iteration),t},a3e=n=>{var e=""+lK+n.id;return n.current_iteration&&n.current_iteration>0&&(e=""+lK+n.id+"_"+n.current_iteration),e},D1t=[aK.Popover,aK.Widget,aK.API];let z1t=class{constructor(e){this._instance=e,this.er=new Map,this.rr=new Map}register(e){var t;br((t=this._instance)==null?void 0:t.Ye)||(this.sr(e),this.nr(e))}nr(e){var t=e.filter((i=>{var r,o;return((r=i.conditions)==null?void 0:r.actions)&&((o=i.conditions)==null||(o=o.actions)==null||(o=o.values)==null?void 0:o.length)>0}));t.length!==0&&(this.ar==null&&(this.ar=new O1t(this._instance),this.ar.init(),this.ar.Qe((i=>{this.onAction(i)}))),t.forEach((i=>{var r,o,s,a,c;i.conditions&&(r=i.conditions)!=null&&r.actions&&(o=i.conditions)!=null&&(o=o.actions)!=null&&o.values&&((s=i.conditions)==null||(s=s.actions)==null||(s=s.values)==null?void 0:s.length)>0&&((a=this.ar)==null||a.register(i.conditions.actions.values),(c=i.conditions)==null||(c=c.actions)==null||(c=c.values)==null||c.forEach((l=>{if(l&&l.name){var u=this.rr.get(l.name);u&&u.push(i.id),this.rr.set(l.name,u||[i.id])}})))})))}sr(e){var t;e.filter((i=>{var r,o;return((r=i.conditions)==null?void 0:r.events)&&((o=i.conditions)==null||(o=o.events)==null||(o=o.values)==null?void 0:o.length)>0})).length!==0&&((t=this._instance)==null||t.Ye(((i,r)=>{this.onEvent(i,r)})),e.forEach((i=>{var r;(r=i.conditions)==null||(r=r.events)==null||(r=r.values)==null||r.forEach((o=>{if(o&&o.name){var s=this.er.get(o.name);s&&s.push(i.id),this.er.set(o.name,s||[i.id])}}))})))}onEvent(e,t){var i,r=((i=this._instance)==null||(i=i.persistence)==null?void 0:i.props[r7])||[];if(e==="survey shown"&&t&&r.length>0){var o;Ng.info("survey event matched, removing survey from activated surveys",{event:e,eventPayload:t,existingActivatedSurveys:r});var s=t==null||(o=t.properties)==null?void 0:o.$survey_id;if(s){var a=r.indexOf(s);a>=0&&(r.splice(a,1),this.lr(r))}}else this.er.has(e)&&(Ng.info("survey event matched, updating activated surveys",{event:e,surveys:this.er.get(e)}),this.lr(r.concat(this.er.get(e)||[])))}onAction(e){var t,i=((t=this._instance)==null||(t=t.persistence)==null?void 0:t.props[r7])||[];this.rr.has(e)&&this.lr(i.concat(this.rr.get(e)||[]))}lr(e){var t;(t=this._instance)==null||(t=t.persistence)==null||t.register({[r7]:[...new Set(e)]})}getSurveys(){var e,t=(e=this._instance)==null||(e=e.persistence)==null?void 0:e.props[r7];return t||[]}getEventToSurveys(){return this.er}hr(){return this.ar}},$1t=class{constructor(e){this.ur=void 0,this._surveyManager=null,this.dr=!1,this.vr=!1,this.cr=[],this._instance=e,this._surveyEventReceiver=null}onRemoteConfig(e){if(!this._instance.config.disable_surveys){var t=e.surveys;if(Oh(t))return Ng.warn("Flags not loaded yet. Not loading surveys.");var i=p0(t);this.ur=i?t.length>0:t,Ng.info("flags response received, isSurveysEnabled: "+this.ur),this.loadIfEnabled()}}reset(){localStorage.removeItem("lastSeenSurveyDate");for(var e=[],t=0;t<localStorage.length;t++){var i=localStorage.key(t);(i!=null&&i.startsWith(lK)||i!=null&&i.startsWith("inProgressSurvey_"))&&e.push(i)}e.forEach((r=>localStorage.removeItem(r)))}loadIfEnabled(){if(!this._surveyManager)if(this.vr)Ng.info("Already initializing surveys, skipping...");else if(this._instance.config.disable_surveys)Ng.info("Disabled. Not loading surveys.");else if(this._instance.config.cookieless_mode)Ng.info("Not loading surveys in cookieless mode.");else{var e=Bs?.__PosthogExtensions__;if(e){if(!br(this.ur)||this._instance.config.advanced_enable_surveys){var t=this.ur||this._instance.config.advanced_enable_surveys;this.vr=!0;try{var i=e.generateSurveys;if(i)return void this.pr(i,t);var r=e.loadExternalDependency;if(!r)return void this.gr("PostHog loadExternalDependency extension not found.");r(this._instance,"surveys",(o=>{o||!e.generateSurveys?this.gr("Could not load surveys script",o):this.pr(e.generateSurveys,t)}))}catch(o){throw this.gr("Error initializing surveys",o),o}finally{this.vr=!1}}}else Ng.error("PostHog Extensions not found.")}}pr(e,t){this._surveyManager=e(this._instance,t),this._surveyEventReceiver=new z1t(this._instance),Ng.info("Surveys loaded successfully"),this._r({isLoaded:!0})}gr(e,t){Ng.error(e,t),this._r({isLoaded:!1,error:e})}onSurveysLoaded(e){return this.cr.push(e),this._surveyManager&&this._r({isLoaded:!0}),()=>{this.cr=this.cr.filter((t=>t!==e))}}getSurveys(e,t){if(t===void 0&&(t=!1),this._instance.config.disable_surveys)return Ng.info("Disabled. Not loading surveys."),e([]);var i=this._instance.get_property(yZ);if(i&&!t)return e(i,{isLoaded:!0});if(this.dr)return e([],{isLoaded:!1,error:"Surveys are already being loaded"});try{this.dr=!0,this._instance.Te({url:this._instance.requestRouter.endpointFor("api","/api/surveys/?token="+this._instance.config.token),method:"GET",timeout:this._instance.config.surveys_request_timeout_ms,callback:r=>{var o;this.dr=!1;var s=r.statusCode;if(s!==200||!r.json){var a="Surveys API could not be loaded, status: "+s;return Ng.error(a),e([],{isLoaded:!1,error:a})}var c,l=r.json.surveys||[],u=l.filter((d=>(function(h){return!(!h.start_date||h.end_date)})(d)&&((function(h){var f;return!((f=h.conditions)==null||(f=f.events)==null||(f=f.values)==null||!f.length)})(d)||(function(h){var f;return!((f=h.conditions)==null||(f=f.actions)==null||(f=f.values)==null||!f.length)})(d))));return u.length>0&&((c=this._surveyEventReceiver)==null||c.register(u)),(o=this._instance.persistence)==null||o.register({[yZ]:l}),e(l,{isLoaded:!0})}})}catch(r){throw this.dr=!1,r}}_r(e){for(var t of this.cr)try{if(!e.isLoaded)return t([],e);this.getSurveys(t)}catch(i){Ng.error("Error in survey callback",i)}}getActiveMatchingSurveys(e,t){if(t===void 0&&(t=!1),!Oh(this._surveyManager))return this._surveyManager.getActiveMatchingSurveys(e,t);Ng.warn("init was not called")}mr(e){var t=null;return this.getSurveys((i=>{var r;t=(r=i.find((o=>o.id===e)))!==null&&r!==void 0?r:null})),t}br(e){if(Oh(this._surveyManager))return{eligible:!1,reason:"SDK is not enabled or survey functionality is not yet loaded"};var t=typeof e=="string"?this.mr(e):e;return t?this._surveyManager.checkSurveyEligibility(t):{eligible:!1,reason:"Survey not found"}}canRenderSurvey(e){if(Oh(this._surveyManager))return Ng.warn("init was not called"),{visible:!1,disabledReason:"SDK is not enabled or survey functionality is not yet loaded"};var t=this.br(e);return{visible:t.eligible,disabledReason:t.reason}}canRenderSurveyAsync(e,t){return Oh(this._surveyManager)?(Ng.warn("init was not called"),Promise.resolve({visible:!1,disabledReason:"SDK is not enabled or survey functionality is not yet loaded"})):new Promise((i=>{this.getSurveys((r=>{var o,s=(o=r.find((c=>c.id===e)))!==null&&o!==void 0?o:null;if(s){var a=this.br(s);i({visible:a.eligible,disabledReason:a.reason})}else i({visible:!1,disabledReason:"Survey not found"})}),t)}))}renderSurvey(e,t){if(Oh(this._surveyManager))Ng.warn("init was not called");else{var i=this.mr(e);if(i)if(D1t.includes(i.type)){var r=Kr?.querySelector(t);r?this._surveyManager.renderSurvey(i,r):Ng.warn("Survey element not found")}else Ng.warn("Surveys of type "+i.type+" cannot be rendered in the app");else Ng.warn("Survey not found")}}};var c3e=x1("[RateLimiter]");let F1t=class{constructor(e){var t,i;this.serverLimits={},this.lastEventRateLimited=!1,this.checkForLimiting=r=>{var o=r.text;if(o&&o.length)try{(JSON.parse(o).quota_limited||[]).forEach((s=>{c3e.info((s||"events")+" is quota limited."),this.serverLimits[s]=new Date().getTime()+6e4}))}catch(s){return void c3e.warn('could not rate limit - continuing. Error: "'+s?.message+'"',{text:o})}},this.instance=e,this.captureEventsPerSecond=((t=e.config.rate_limiting)==null?void 0:t.events_per_second)||10,this.captureEventsBurstLimit=Math.max(((i=e.config.rate_limiting)==null?void 0:i.events_burst_limit)||10*this.captureEventsPerSecond,this.captureEventsPerSecond),this.lastEventRateLimited=this.clientRateLimitContext(!0).isRateLimited}clientRateLimitContext(e){var t,i,r;e===void 0&&(e=!1);var o=new Date().getTime(),s=(t=(i=this.instance.persistence)==null?void 0:i.get_property(bZ))!==null&&t!==void 0?t:{tokens:this.captureEventsBurstLimit,last:o};s.tokens+=(o-s.last)/1e3*this.captureEventsPerSecond,s.last=o,s.tokens>this.captureEventsBurstLimit&&(s.tokens=this.captureEventsBurstLimit);var a=s.tokens<1;return a||e||(s.tokens=Math.max(0,s.tokens-1)),!a||this.lastEventRateLimited||e||this.instance.capture("$$client_ingestion_warning",{$$client_ingestion_warning_message:"posthog-js client rate limited. Config is set to "+this.captureEventsPerSecond+" events per second and "+this.captureEventsBurstLimit+" events burst limit."},{skip_client_rate_limiting:!0}),this.lastEventRateLimited=a,(r=this.instance.persistence)==null||r.set_property(bZ,s),{isRateLimited:a,remainingTokens:s.tokens}}isServerRateLimited(e){var t=this.serverLimits[e||"events"]||!1;return t!==!1&&new Date().getTime()<t}};var mA=x1("[RemoteConfig]");let B1t=class{constructor(e){this._instance=e}get remoteConfig(){var e;return(e=Bs._POSTHOG_REMOTE_CONFIG)==null||(e=e[this._instance.config.token])==null?void 0:e.config}yr(e){var t,i;(t=Bs.__PosthogExtensions__)!=null&&t.loadExternalDependency?(i=Bs.__PosthogExtensions__)==null||i.loadExternalDependency==null||i.loadExternalDependency(this._instance,"remote-config",(()=>e(this.remoteConfig))):(mA.error("PostHog Extensions not found. Cannot load remote config."),e())}wr(e){this._instance.Te({method:"GET",url:this._instance.requestRouter.endpointFor("assets","/array/"+this._instance.config.token+"/config"),callback:t=>{e(t.json)}})}load(){try{if(this.remoteConfig)return mA.info("Using preloaded remote config",this.remoteConfig),void this.Ce(this.remoteConfig);if(this._instance.L())return void mA.warn("Remote config is disabled. Falling back to local config.");this.yr((e=>{if(!e)return mA.info("No config found after loading remote JS config. Falling back to JSON."),void this.wr((t=>{this.Ce(t)}));this.Ce(e)}))}catch(e){mA.error("Error loading remote config",e)}}Ce(e){e?this._instance.config.__preview_remote_config?(this._instance.Ce(e),e.hasFeatureFlags!==!1&&this._instance.featureFlags.ensureFlagsLoaded()):mA.info("__preview_remote_config is disabled. Logging config instead",e):mA.error("Failed to fetch remote config from PostHog.")}};var uK=3e3;let U1t=class{constructor(e,t){this.Sr=!0,this.$r=[],this.kr=xw(t?.flush_interval_ms||uK,250,5e3,Yr.createLogger("flush interval"),uK),this.Er=e}enqueue(e){this.$r.push(e),this.Ir||this.Rr()}unload(){this.Pr();var e=this.$r.length>0?this.Tr():{},t=Object.values(e);[...t.filter((i=>i.url.indexOf("/e")===0)),...t.filter((i=>i.url.indexOf("/e")!==0))].map((i=>{this.Er(Qr({},i,{transport:"sendBeacon"}))}))}enable(){this.Sr=!1,this.Rr()}Rr(){var e=this;this.Sr||(this.Ir=setTimeout((()=>{if(this.Pr(),this.$r.length>0){var t=this.Tr(),i=function(){var o=t[r],s=new Date().getTime();o.data&&p0(o.data)&&vf(o.data,(a=>{a.offset=Math.abs(a.timestamp-s),delete a.timestamp})),e.Er(o)};for(var r in t)i()}}),this.kr))}Pr(){clearTimeout(this.Ir),this.Ir=void 0}Tr(){var e={};return vf(this.$r,(t=>{var i,r=t,o=(r?r.batchKey:null)||r.url;br(e[o])&&(e[o]=Qr({},r,{data:[]})),(i=e[o].data)==null||i.push(r.data)})),this.$r=[],e}};var j1t=["retriesPerformedSoFar"];let H1t=class{constructor(e){this.Cr=!1,this.Mr=3e3,this.$r=[],this._instance=e,this.$r=[],this.Or=!0,!br(qn)&&"onLine"in qn.navigator&&(this.Or=qn.navigator.onLine,M_(qn,"online",(()=>{this.Or=!0,this.oe()})),M_(qn,"offline",(()=>{this.Or=!1})))}get length(){return this.$r.length}retriableRequest(e){var{retriesPerformedSoFar:t}=e,i=o5e(e,j1t);wx(t)&&t>0&&(i.url=S7(i.url,{retry_count:t})),this._instance.Te(Qr({},i,{callback:r=>{r.statusCode!==200&&(r.statusCode<400||r.statusCode>=500)&&(t??0)<10?this.Fr(Qr({retriesPerformedSoFar:t},i)):i.callback==null||i.callback(r)}}))}Fr(e){var t=e.retriesPerformedSoFar||0;e.retriesPerformedSoFar=t+1;var i=(function(s){var a=3e3*Math.pow(2,s),c=a/2,l=Math.min(18e5,a),u=(Math.random()-.5)*(l-c);return Math.ceil(l+u)})(t),r=Date.now()+i;this.$r.push({retryAt:r,requestOptions:e});var o="Enqueued failed request for retry in "+i;navigator.onLine||(o+=" (Browser is offline)"),Yr.warn(o),this.Cr||(this.Cr=!0,this.Ar())}Ar(){this.Dr&&clearTimeout(this.Dr),this.Dr=setTimeout((()=>{this.Or&&this.$r.length>0&&this.oe(),this.Ar()}),this.Mr)}oe(){var e=Date.now(),t=[],i=this.$r.filter((o=>o.retryAt<e||(t.push(o),!1)));if(this.$r=t,i.length>0)for(var{requestOptions:r}of i)this.retriableRequest(r)}unload(){for(var{requestOptions:e}of(this.Dr&&(clearTimeout(this.Dr),this.Dr=void 0),this.$r))try{this._instance.Te(Qr({},e,{transport:"sendBeacon"}))}catch(t){Yr.error(t)}this.$r=[]}},V1t=class{constructor(e){this.jr=()=>{var t,i,r,o;this.Lr||(this.Lr={});var s=this.scrollElement(),a=this.scrollY(),c=s?Math.max(0,s.scrollHeight-s.clientHeight):0,l=a+(s?.clientHeight||0),u=s?.scrollHeight||0;this.Lr.lastScrollY=Math.ceil(a),this.Lr.maxScrollY=Math.max(a,(t=this.Lr.maxScrollY)!==null&&t!==void 0?t:0),this.Lr.maxScrollHeight=Math.max(c,(i=this.Lr.maxScrollHeight)!==null&&i!==void 0?i:0),this.Lr.lastContentY=l,this.Lr.maxContentY=Math.max(l,(r=this.Lr.maxContentY)!==null&&r!==void 0?r:0),this.Lr.maxContentHeight=Math.max(u,(o=this.Lr.maxContentHeight)!==null&&o!==void 0?o:0)},this._instance=e}getContext(){return this.Lr}resetContext(){var e=this.Lr;return setTimeout(this.jr,0),e}startMeasuringScrollPosition(){M_(qn,"scroll",this.jr,{capture:!0}),M_(qn,"scrollend",this.jr,{capture:!0}),M_(qn,"resize",this.jr)}scrollElement(){if(!this._instance.config.scroll_root_selector)return qn?.document.documentElement;var e=p0(this._instance.config.scroll_root_selector)?this._instance.config.scroll_root_selector:[this._instance.config.scroll_root_selector];for(var t of e){var i=qn?.document.querySelector(t);if(i)return i}}scrollY(){if(this._instance.config.scroll_root_selector){var e=this.scrollElement();return e&&e.scrollTop||0}return qn&&(qn.scrollY||qn.pageYOffset||qn.document.documentElement.scrollTop)||0}scrollX(){if(this._instance.config.scroll_root_selector){var e=this.scrollElement();return e&&e.scrollLeft||0}return qn&&(qn.scrollX||qn.pageXOffset||qn.document.documentElement.scrollLeft)||0}};var G1t=n=>JTe(n?.config.mask_personal_data_properties,n?.config.custom_personal_data_properties);let l3e=class{constructor(e,t,i,r){this.Nr=o=>{var s=this.zr();if(!s||s.sessionId!==o){var a={sessionId:o,props:this.Ur(this._instance)};this.qr.register({[gZ]:a})}},this._instance=e,this.Br=t,this.qr=i,this.Ur=r||G1t,this.Br.onSessionId(this.Nr)}zr(){return this.qr.props[gZ]}getSetOnceProps(){var e,t=(e=this.zr())==null?void 0:e.props;return t?"r"in t?e3e(t):{$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(){var e={};return vf(dZ(this.getSetOnceProps()),((t,i)=>{i==="$current_url"&&(i="url"),e["$session_entry_"+cZ(i)]=t})),e}};var dK=x1("[SessionId]");let u3e=class{constructor(e,t,i){var r;if(this.Hr=[],this.Wr=(u,d)=>Math.abs(u-d)>this.sessionTimeoutMs,!e.persistence)throw new Error("SessionIdManager requires a PostHogPersistence instance");if(e.config.cookieless_mode==="always")throw new Error('SessionIdManager cannot be used with cookieless_mode="always"');this.A=e.config,this.qr=e.persistence,this.gi=void 0,this.Ft=void 0,this._sessionStartTimestamp=null,this._sessionActivityTimestamp=null,this.Gr=t||s3,this.Jr=i||s3;var o=this.A.persistence_name||this.A.token,s=this.A.session_idle_timeout_seconds||1800;if(this._sessionTimeoutMs=1e3*xw(s,60,36e3,dK.createLogger("session_idle_timeout_seconds"),1800),e.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this.Vr(),this.Kr="ph_"+o+"_window_id",this.Yr="ph_"+o+"_primary_window_exists",this.Xr()){var a=Xb.K(this.Kr),c=Xb.K(this.Yr);a&&!c?this.gi=a:Xb.X(this.Kr),Xb.Y(this.Yr,!0)}if((r=this.A.bootstrap)!=null&&r.sessionID)try{var l=(u=>{var d=u.replace(/-/g,"");if(d.length!==32)throw new Error("Not a valid UUID");if(d[12]!=="7")throw new Error("Not a UUIDv7");return parseInt(d.substring(0,12),16)})(this.A.bootstrap.sessionID);this.Qr(this.A.bootstrap.sessionID,new Date().getTime(),l)}catch(u){dK.error("Invalid sessionID in bootstrap",u)}this.Zr()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(e){return br(this.Hr)&&(this.Hr=[]),this.Hr.push(e),this.Ft&&e(this.Ft,this.gi),()=>{this.Hr=this.Hr.filter((t=>t!==e))}}Xr(){return this.A.persistence!=="memory"&&!this.qr.je&&Xb.G()}ts(e){e!==this.gi&&(this.gi=e,this.Xr()&&Xb.Y(this.Kr,e))}es(){return this.gi?this.gi:this.Xr()?Xb.K(this.Kr):null}Qr(e,t,i){e===this.Ft&&t===this._sessionActivityTimestamp&&i===this._sessionStartTimestamp||(this._sessionStartTimestamp=i,this._sessionActivityTimestamp=t,this.Ft=e,this.qr.register({[i7]:[t,e,i]}))}rs(){if(this.Ft&&this._sessionActivityTimestamp&&this._sessionStartTimestamp)return[this._sessionActivityTimestamp,this.Ft,this._sessionStartTimestamp];var e=this.qr.props[i7];return p0(e)&&e.length===2&&e.push(e[0]),e||[0,null,0]}resetSessionId(){this.Qr(null,null,null)}Zr(){M_(qn,"beforeunload",(()=>{this.Xr()&&Xb.X(this.Yr)}),{capture:!1})}checkAndGetSessionAndWindowId(e,t){if(e===void 0&&(e=!1),t===void 0&&(t=null),this.A.cookieless_mode==="always")throw new Error('checkAndGetSessionAndWindowId should not be called with cookieless_mode="always"');var i=t||new Date().getTime(),[r,o,s]=this.rs(),a=this.es(),c=wx(s)&&s>0&&Math.abs(i-s)>864e5,l=!1,u=!o,d=!e&&this.Wr(i,r);u||d||c?(o=this.Gr(),a=this.Jr(),dK.info("new session ID generated",{sessionId:o,windowId:a,changeReason:{noSessionId:u,activityTimeout:d,sessionPastMaximumLength:c}}),s=i,l=!0):a||(a=this.Jr(),l=!0);var h=r===0||!e||c?i:r,f=s===0?new Date().getTime():s;return this.ts(a),this.Qr(o,h,f),e||this.Vr(),l&&this.Hr.forEach((m=>m(o,a,l?{noSessionId:u,activityTimeout:d,sessionPastMaximumLength:c}:void 0))),{sessionId:o,windowId:a,sessionStartTimestamp:f,changeReason:l?{noSessionId:u,activityTimeout:d,sessionPastMaximumLength:c}:void 0,lastActivityTimestamp:r}}Vr(){clearTimeout(this.ss),this.ss=setTimeout((()=>{var[e]=this.rs();this.Wr(new Date().getTime(),e)&&this.resetSessionId()}),1.1*this.sessionTimeoutMs)}};var Y1t=["$set_once","$set"],l3=x1("[SiteApps]");let q1t=class{constructor(e){this._instance=e,this.ns=[],this.apps={}}get isEnabled(){return!!this._instance.config.opt_in_site_apps}os(e,t){if(t){var i=this.globalsForEvent(t);this.ns.push(i),this.ns.length>1e3&&(this.ns=this.ns.slice(10))}}get siteAppLoaders(){var e;return(e=Bs._POSTHOG_REMOTE_CONFIG)==null||(e=e[this._instance.config.token])==null?void 0:e.siteApps}init(){if(this.isEnabled){var e=this._instance.Ye(this.os.bind(this));this.ls=()=>{e(),this.ns=[],this.ls=void 0}}}globalsForEvent(e){var t,i,r,o,s,a,c;if(!e)throw new Error("Event payload is required");var l={},u=this._instance.get_property("$groups")||[],d=this._instance.get_property("$stored_group_properties")||{};for(var[h,f]of Object.entries(d))l[h]={id:u[h],type:h,properties:f};var{$set_once:m,$set:y}=e;return{event:Qr({},o5e(e,Y1t),{properties:Qr({},e.properties,y?{$set:Qr({},(t=(i=e.properties)==null?void 0:i.$set)!==null&&t!==void 0?t:{},y)}:{},m?{$set_once:Qr({},(r=(o=e.properties)==null?void 0:o.$set_once)!==null&&r!==void 0?r:{},m)}:{}),elements_chain:(s=(a=e.properties)==null?void 0:a.$elements_chain)!==null&&s!==void 0?s:"",distinct_id:(c=e.properties)==null?void 0:c.distinct_id}),person:{properties:this._instance.get_property("$stored_person_properties")},groups:l}}setupSiteApp(e){var t=this.apps[e.id],i=()=>{var a;!t.errored&&this.ns.length&&(l3.info("Processing "+this.ns.length+" events for site app with id "+e.id),this.ns.forEach((c=>t.processEvent==null?void 0:t.processEvent(c))),t.processedBuffer=!0),Object.values(this.apps).every((c=>c.processedBuffer||c.errored))&&((a=this.ls)==null||a.call(this))},r=!1,o=a=>{t.errored=!a,t.loaded=!0,l3.info("Site app with id "+e.id+" "+(a?"loaded":"errored")),r&&i()};try{var{processEvent:s}=e.init({posthog:this._instance,callback:a=>{o(a)}});s&&(t.processEvent=s),r=!0}catch(a){l3.error("Error while initializing PostHog app with config id "+e.id,a),o(!1)}if(r&&t.loaded)try{i()}catch(a){l3.error("Error while processing buffered events PostHog app with config id "+e.id,a),t.errored=!0}}hs(){var e=this.siteAppLoaders||[];for(var t of e)this.apps[t.id]={id:t.id,loaded:!1,errored:!1,processedBuffer:!1};for(var i of e)this.setupSiteApp(i)}us(e){if(Object.keys(this.apps).length!==0){var t=this.globalsForEvent(e);for(var i of Object.values(this.apps))try{i.processEvent==null||i.processEvent(t)}catch(r){l3.error("Error while processing event "+e.event+" for site app "+i.id,r)}}}onRemoteConfig(e){var t,i,r,o=this;if((t=this.siteAppLoaders)!=null&&t.length)return this.isEnabled?(this.hs(),void this._instance.on("eventCaptured",(l=>this.us(l)))):void l3.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.');if((i=this.ls)==null||i.call(this),(r=e.siteApps)!=null&&r.length)if(this.isEnabled){var s=function(l){var u;Bs["__$$ph_site_app_"+l]=o._instance,(u=Bs.__PosthogExtensions__)==null||u.loadSiteApp==null||u.loadSiteApp(o._instance,c,(d=>{if(d)return l3.error("Error while initializing PostHog app with config id "+l,d)}))};for(var{id:a,url:c}of e.siteApps)s(a)}else l3.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}};var X1t=["amazonbot","amazonproductbot","app.hypefactors.com","applebot","archive.org_bot","awariobot","backlinksextendedbot","baiduspider","bingbot","bingpreview","chrome-lighthouse","dataforseobot","deepscan","duckduckbot","facebookexternal","facebookcatalog","http://yandex.com/bots","hubspot","ia_archiver","leikibot","linkedinbot","meta-externalagent","mj12bot","msnbot","nessus","petalbot","pinterest","prerender","rogerbot","screaming frog","sebot-wa","sitebulb","slackbot","slurp","trendictionbot","turnitin","twitterbot","vercel-screenshot","vercelbot","yahoo! slurp","yandexbot","zoombot","bot.htm","bot.php","(bot;","bot/","crawler","ahrefsbot","ahrefssiteaudit","semrushbot","siteauditbot","splitsignalbot","gptbot","oai-searchbot","chatgpt-user","perplexitybot","better uptime bot","sentryuptimebot","uptimerobot","headlesschrome","cypress","google-hoteladsverifier","adsbot-google","apis-google","duplexweb-google","feedfetcher-google","google favicon","google web preview","google-read-aloud","googlebot","googleother","google-cloudvertexbot","googleweblight","mediapartners-google","storebot-google","google-inspectiontool","bytespider"],d3e=function(n,e){if(!n)return!1;var t=n.toLowerCase();return X1t.concat(e||[]).some((i=>{var r=i.toLowerCase();return t.indexOf(r)!==-1}))},h3e=function(n,e){if(!n)return!1;var t=n.userAgent;if(t&&d3e(t,e))return!0;try{var i=n?.userAgentData;if(i!=null&&i.brands&&i.brands.some((r=>d3e(r?.brand,e))))return!0}catch{}return!!n.webdriver},MN=(function(n){return n.US="us",n.EU="eu",n.CUSTOM="custom",n})({}),p3e="i.posthog.com";let W1t=class{constructor(e){this.ds={},this.instance=e}get apiHost(){var e=this.instance.config.api_host.trim().replace(/\/$/,"");return e==="https://app.posthog.com"?"https://us.i.posthog.com":e}get uiHost(){var e,t=(e=this.instance.config.ui_host)==null?void 0:e.replace(/\/$/,"");return t||(t=this.apiHost.replace("."+p3e,".posthog.com")),t==="https://app.posthog.com"?"https://us.posthog.com":t}get region(){return this.ds[this.apiHost]||(/https:\/\/(app|us|us-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?this.ds[this.apiHost]=MN.US:/https:\/\/(eu|eu-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?this.ds[this.apiHost]=MN.EU:this.ds[this.apiHost]=MN.CUSTOM),this.ds[this.apiHost]}endpointFor(e,t){if(t===void 0&&(t=""),t&&(t=t[0]==="/"?t:"/"+t),e==="ui")return this.uiHost+t;if(this.region===MN.CUSTOM)return this.apiHost+t;var i=p3e+t;switch(e){case"assets":return"https://"+this.region+"-assets."+i;case"api":return"https://"+this.region+"."+i}}};var Z1t={icontains:(n,e)=>!!qn&&e.href.toLowerCase().indexOf(n.toLowerCase())>-1,not_icontains:(n,e)=>!!qn&&e.href.toLowerCase().indexOf(n.toLowerCase())===-1,regex:(n,e)=>!!qn&&kC(e.href,n),not_regex:(n,e)=>!!qn&&!kC(e.href,n),exact:(n,e)=>e.href===n,is_not:(n,e)=>e.href!==n};let K1t=class Lv{constructor(e){var t=this;this.getWebExperimentsAndEvaluateDisplayLogic=function(i){i===void 0&&(i=!1),t.getWebExperiments((r=>{Lv.vs("retrieved web experiments from the server"),t.cs=new Map,r.forEach((o=>{if(o.feature_flag_key){var s;t.cs&&(Lv.vs("setting flag key ",o.feature_flag_key," to web experiment ",o),(s=t.cs)==null||s.set(o.feature_flag_key,o));var a=t._instance.getFeatureFlag(o.feature_flag_key);ly(a)&&o.variants[a]&&t.fs(o.name,a,o.variants[a].transforms)}else if(o.variants)for(var c in o.variants){var l=o.variants[c];Lv.ps(l)&&t.fs(o.name,c,l.transforms)}}))}),i)},this._instance=e,this._instance.onFeatureFlags((i=>{this.onFeatureFlags(i)}))}onFeatureFlags(e){if(this._is_bot())Lv.vs("Refusing to render web experiment since the viewer is a likely bot");else if(!this._instance.config.disable_web_experiments){if(Oh(this.cs))return this.cs=new Map,this.loadIfEnabled(),void this.previewWebExperiment();Lv.vs("applying feature flags",e),e.forEach((t=>{var i;if(this.cs&&(i=this.cs)!=null&&i.has(t)){var r,o=this._instance.getFeatureFlag(t),s=(r=this.cs)==null?void 0:r.get(t);o&&s!=null&&s.variants[o]&&this.fs(s.name,o,s.variants[o].transforms)}}))}}previewWebExperiment(){var e=Lv.getWindowLocation();if(e!=null&&e.search){var t=d7(e?.search,"__experiment_id"),i=d7(e?.search,"__experiment_variant");t&&i&&(Lv.vs("previewing web experiments "+t+" && "+i),this.getWebExperiments((r=>{this.gs(parseInt(t),i,r)}),!1,!0))}}loadIfEnabled(){this._instance.config.disable_web_experiments||this.getWebExperimentsAndEvaluateDisplayLogic()}getWebExperiments(e,t,i){if(this._instance.config.disable_web_experiments&&!i)return e([]);var r=this._instance.get_property("$web_experiments");if(r&&!t)return e(r);this._instance.Te({url:this._instance.requestRouter.endpointFor("api","/api/web_experiments/?token="+this._instance.config.token),method:"GET",callback:o=>{if(o.statusCode!==200||!o.json)return e([]);var s=o.json.experiments||[];return e(s)}})}gs(e,t,i){var r=i.filter((o=>o.id===e));r&&r.length>0&&(Lv.vs("Previewing web experiment ["+r[0].name+"] with variant ["+t+"]"),this.fs(r[0].name,t,r[0].variants[t].transforms))}static ps(e){return!Oh(e.conditions)&&Lv._s(e)&&Lv.bs(e)}static _s(e){var t;if(Oh(e.conditions)||Oh((t=e.conditions)==null?void 0:t.url))return!0;var i,r,o,s=Lv.getWindowLocation();return!!s&&((i=e.conditions)==null||!i.url||Z1t[(r=(o=e.conditions)==null?void 0:o.urlMatchType)!==null&&r!==void 0?r:"icontains"](e.conditions.url,s))}static getWindowLocation(){return qn?.location}static bs(e){var t;if(Oh(e.conditions)||Oh((t=e.conditions)==null?void 0:t.utm))return!0;var i=XTe();if(i.utm_source){var r,o,s,a,c,l,u,d,h=(r=e.conditions)==null||(r=r.utm)==null||!r.utm_campaign||((o=e.conditions)==null||(o=o.utm)==null?void 0:o.utm_campaign)==i.utm_campaign,f=(s=e.conditions)==null||(s=s.utm)==null||!s.utm_source||((a=e.conditions)==null||(a=a.utm)==null?void 0:a.utm_source)==i.utm_source,m=(c=e.conditions)==null||(c=c.utm)==null||!c.utm_medium||((l=e.conditions)==null||(l=l.utm)==null?void 0:l.utm_medium)==i.utm_medium,y=(u=e.conditions)==null||(u=u.utm)==null||!u.utm_term||((d=e.conditions)==null||(d=d.utm)==null?void 0:d.utm_term)==i.utm_term;return h&&m&&y&&f}return!1}static vs(e){for(var t=arguments.length,i=new Array(t>1?t-1:0),r=1;r<t;r++)i[r-1]=arguments[r];Yr.info("[WebExperiments] "+e,i)}fs(e,t,i){this._is_bot()?Lv.vs("Refusing to render web experiment since the viewer is a likely bot"):t!=="control"?i.forEach((r=>{if(r.selector){var o;Lv.vs("applying transform of variant "+t+" for experiment "+e+" ",r);var s=(o=document)==null?void 0:o.querySelectorAll(r.selector);s?.forEach((a=>{var c=a;r.html&&(c.innerHTML=r.html),r.css&&c.setAttribute("style",r.css)}))}})):Lv.vs("Control variants leave the page unmodified.")}_is_bot(){return bw&&this._instance?h3e(bw,this._instance.config.custom_blocked_useragents):void 0}};var Q1t=x1("[PostHog ExternalIntegrations]"),J1t={intercom:"intercom-integration",crispChat:"crisp-chat-integration"};let ebt=class{constructor(e){this._instance=e}nt(e,t){var i;(i=Bs.__PosthogExtensions__)==null||i.loadExternalDependency==null||i.loadExternalDependency(this._instance,e,(r=>{if(r)return Q1t.error("failed to load script",r);t()}))}startIfEnabledOrStop(){var e=this,t=function(s){var a,c,l;!r||(a=Bs.__PosthogExtensions__)!=null&&(a=a.integrations)!=null&&a[s]||e.nt(J1t[s],(()=>{var u;(u=Bs.__PosthogExtensions__)==null||(u=u.integrations)==null||(u=u[s])==null||u.start(e._instance)})),!r&&(c=Bs.__PosthogExtensions__)!=null&&(c=c.integrations)!=null&&c[s]&&((l=Bs.__PosthogExtensions__)==null||(l=l.integrations)==null||(l=l[s])==null||l.stop())};for(var[i,r]of Object.entries((o=this._instance.config.integrations)!==null&&o!==void 0?o:{})){var o;t(i)}}};var hK="[SessionRecording]",C7=x1(hK);let tbt=class{get started(){var e;return!((e=this.ys)==null||!e.isStarted)}get status(){var e;return this.qt?((e=this.ys)==null?void 0:e.status)||"lazy_loading":C5}constructor(e){if(this._forceAllowLocalhostNetworkCapture=!1,this._instance=e,!this._instance.sessionManager)throw C7.error("started without valid sessionManager"),new Error(hK+" started without valid sessionManager. This is a bug.");if(this._instance.config.cookieless_mode==="always")throw new Error(hK+' cannot be used with cookieless_mode="always"')}get qt(){var e=!!this._instance.get_property(aN),t=!this._instance.config.disable_session_recording,i=this._instance.config.disable_session_recording||this._instance.consent.isOptedOut();return qn&&e&&t&&!i}startIfEnabledOrStop(e){var t;if(!this.qt||(t=this.ys)==null||!t.isStarted){var i=!br(Object.assign)&&!br(Array.from);this.qt&&i?(this.ws(e),C7.info("starting")):this.stopRecording()}}ws(e){var t,i,r;this.qt&&(Bs!=null&&(t=Bs.__PosthogExtensions__)!=null&&(t=t.rrweb)!=null&&t.record&&(i=Bs.__PosthogExtensions__)!=null&&i.initSessionRecording?this.Ri(e):(r=Bs.__PosthogExtensions__)==null||r.loadExternalDependency==null||r.loadExternalDependency(this._instance,this.Pi,(o=>{if(o)return C7.error("could not load recorder",o);this.Ri(e)})))}stopRecording(){var e;(e=this.ys)==null||e.stop()}onRemoteConfig(e){this.Ss=e;var t,i=this._instance.persistence;i&&i.register({[aN]:!!e.sessionRecording,[n7]:(t=e.sessionRecording)==null?void 0:t.scriptConfig}),this.ys?(this.ys.onRemoteConfig(e),this.Ss=void 0):this.ws(),this.startIfEnabledOrStop()}log(e,t){var i;t===void 0&&(t="log"),(i=this.ys)!=null&&i.log?this.ys.log(e,t):C7.warn("log called before recorder was ready")}get Pi(){var e;return((e=this._instance)==null||(e=e.persistence)==null||(e=e.get_property(n7))==null?void 0:e.script)||"lazy-recorder"}Ri(e){var t,i;if((t=Bs.__PosthogExtensions__)==null||!t.initSessionRecording)throw Error("Called on script loaded before session recording is available");this.ys||(this.ys=(i=Bs.__PosthogExtensions__)==null?void 0:i.initSessionRecording(this._instance),this.ys._forceAllowLocalhostNetworkCapture=this._forceAllowLocalhostNetworkCapture,this.Ss&&(this.ys.onRemoteConfig(this.Ss),this.Ss=void 0)),this.ys.start(e)}onRRwebEmit(e){var t;(t=this.ys)==null||t.onRRwebEmit==null||t.onRRwebEmit(e)}overrideLinkedFlag(){var e;(e=this.ys)==null||e.overrideLinkedFlag()}overrideSampling(){var e;(e=this.ys)==null||e.overrideSampling()}overrideTrigger(e){var t;(t=this.ys)==null||t.overrideTrigger(e)}get sdkDebugProperties(){var e;return((e=this.ys)==null?void 0:e.sdkDebugProperties)||{$recording_status:this.status}}};var AN={},pK=()=>{},$C="posthog",f3e=!p1t&&$v?.indexOf("MSIE")===-1&&$v?.indexOf("Mozilla")===-1,m3e=n=>{var e;return{api_host:"https://us.i.posthog.com",ui_host:null,token:"",autocapture:!0,rageclick:!0,cross_subdomain_cookie:Vyt(Kr?.location),persistence:"localStorage+cookie",persistence_name:"",loaded:pK,save_campaign_params:!0,custom_campaign_params:[],custom_blocked_useragents:[],save_referrer:!0,capture_pageview:n!=="2025-05-24"||"history_change",capture_pageleave:"if_capture_pageview",defaults:n??"unset",debug:zv&&ly(zv?.search)&&zv.search.indexOf("__posthog_debug=true")!==-1||!1,cookie_expiration:365,upgrade:!1,disable_session_recording:!1,disable_persistence:!1,disable_web_experiments:!0,disable_surveys:!1,disable_surveys_automatic_display:!1,disable_external_dependency_loading:!1,enable_recording_console_log:void 0,secure_cookie:(qn==null||(e=qn.location)==null?void 0:e.protocol)==="https:",ip:!1,opt_out_capturing_by_default:!1,opt_out_persistence_by_default:!1,opt_out_useragent_filter:!1,opt_out_capturing_persistence_type:"localStorage",consent_persistence_name:null,opt_out_capturing_cookie_prefix:null,opt_in_site_apps:!1,property_denylist:[],respect_dnt:!1,sanitize_properties:null,request_headers:{},request_batching:!0,properties_string_max_length:65535,session_recording:{},mask_all_element_attributes:!1,mask_all_text:!1,mask_personal_data_properties:!1,custom_personal_data_properties:[],advanced_disable_flags:!1,advanced_disable_decide:!1,advanced_disable_feature_flags:!1,advanced_disable_feature_flags_on_first_load:!1,advanced_only_evaluate_survey_feature_flags:!1,advanced_enable_surveys:!1,advanced_disable_toolbar_metrics:!1,feature_flag_request_timeout_ms:3e3,surveys_request_timeout_ms:1e4,on_request_error:t=>{var i="Bad HTTP status: "+t.statusCode+" "+t.text;Yr.error(i)},get_device_id:t=>t,capture_performance:void 0,name:"posthog",bootstrap:{},disable_compression:!1,session_idle_timeout_seconds:1800,person_profiles:"identified_only",before_send:void 0,request_queue_config:{flush_interval_ms:uK},error_tracking:{},_onCapture:pK}},_3e=n=>{var e={};br(n.process_person)||(e.person_profiles=n.process_person),br(n.xhr_headers)||(e.request_headers=n.xhr_headers),br(n.cookie_name)||(e.persistence_name=n.cookie_name),br(n.disable_cookie)||(e.disable_persistence=n.disable_cookie),br(n.store_google)||(e.save_campaign_params=n.store_google),br(n.verbose)||(e.debug=n.verbose);var t=qy({},e,n);return p0(n.property_blacklist)&&(br(n.property_denylist)?t.property_denylist=n.property_blacklist:p0(n.property_denylist)?t.property_denylist=[...n.property_blacklist,...n.property_denylist]:Yr.error("Invalid value for property_denylist config: "+n.property_denylist)),t};let nbt=class{constructor(){this.__forceAllowLocalhost=!1}get $s(){return this.__forceAllowLocalhost}set $s(e){Yr.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=e}},y3e=class O0t{get decideEndpointWasHit(){var e,t;return(e=(t=this.featureFlags)==null?void 0:t.hasLoadedFlags)!==null&&e!==void 0&&e}get flagsEndpointWasHit(){var e,t;return(e=(t=this.featureFlags)==null?void 0:t.hasLoadedFlags)!==null&&e!==void 0&&e}constructor(){this.webPerformance=new nbt,this.ks=!1,this.version=w5.LIB_VERSION,this.xs=new o3e,this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=m3e(),this.SentryIntegration=i1t,this.sentryIntegration=e=>(function(t,i){var r=vTe(t,i);return{name:xTe,processEvent:o=>r(o)}})(this,e),this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this.Es=!1,this.Is=null,this.Rs=null,this.Ps=null,this.featureFlags=new N1t(this),this.toolbar=new o1t(this),this.scrollManager=new V1t(this),this.pageViewManager=new d1t(this),this.surveys=new $1t(this),this.experiments=new K1t(this),this.exceptions=new m1t(this),this.rateLimiter=new F1t(this),this.requestRouter=new W1t(this),this.consent=new fgt(this),this.externalIntegrations=new ebt(this),this.people={set:(e,t,i)=>{var r=ly(e)?{[e]:t}:e;this.setPersonProperties(r),i?.({})},set_once:(e,t,i)=>{var r=ly(e)?{[e]:t}:e;this.setPersonProperties(void 0,r),i?.({})}},this.on("eventCaptured",(e=>Yr.info('send "'+e?.event+'"',e)))}init(e,t,i){if(i&&i!==$C){var r,o=(r=AN[i])!==null&&r!==void 0?r:new O0t;return o._init(e,t,i),AN[i]=o,AN[$C][i]=o,o}return this._init(e,t,i)}_init(e,t,i){var r,o;if(t===void 0&&(t={}),br(e)||lZ(e))return Yr.critical("PostHog was initialized without a token. This likely indicates a misconfiguration. Please check the first argument passed to posthog.init()"),this;if(this.__loaded)return Yr.warn("You have already initialized PostHog! Re-initializing is a no-op"),this;this.__loaded=!0,this.config={},this.Ts=t,this.Cs=[],t.person_profiles&&(this.Rs=t.person_profiles),this.set_config(qy({},m3e(t.defaults),_3e(t),{name:i,token:e})),this.config.on_xhr_error&&Yr.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=t.disable_compression?void 0:E5.GZipJS;var s=this.Ms();this.persistence=new sK(this.config,s),this.sessionPersistence=this.config.persistence==="sessionStorage"||this.config.persistence==="memory"?this.persistence:new sK(Qr({},this.config,{persistence:"sessionStorage"}),s);var a=Qr({},this.persistence.props),c=Qr({},this.sessionPersistence.props);this.register({$initialization_time:new Date().toISOString()}),this.Os=new U1t((w=>this.Fs(w)),this.config.request_queue_config),this.As=new H1t(this),this.__request_queue=[];var l=this.config.cookieless_mode==="always"||this.config.cookieless_mode==="on_reject"&&this.consent.isExplicitlyOptedOut();if(l||(this.sessionManager=new u3e(this),this.sessionPropsManager=new l3e(this,this.sessionManager,this.persistence)),new a1t(this).startIfEnabledOrStop(),this.siteApps=new q1t(this),(r=this.siteApps)==null||r.init(),l||(this.config.__preview_lazy_load_replay?this.sessionRecording=new tbt(this):this.sessionRecording=new bTe(this),this.sessionRecording.startIfEnabledOrStop()),this.config.disable_scroll_properties||this.scrollManager.startMeasuringScrollPosition(),this.autocapture=new ogt(this),this.autocapture.startIfEnabled(),this.surveys.loadIfEnabled(),this.heatmaps=new u1t(this),this.heatmaps.startIfEnabled(),this.webVitalsAutocapture=new c1t(this),this.exceptionObserver=new ygt(this),this.exceptionObserver.startIfEnabled(),this.deadClicksAutocapture=new G5e(this,_gt),this.deadClicksAutocapture.startIfEnabled(),this.historyAutocapture=new Igt(this),this.historyAutocapture.startIfEnabled(),w5.DEBUG=w5.DEBUG||this.config.debug,w5.DEBUG&&Yr.info("Starting in debug mode",{this:this,config:t,thisC:Qr({},this.config),p:a,s:c}),((o=t.bootstrap)==null?void 0:o.distinctID)!==void 0){var u,d,h=this.config.get_device_id(s3()),f=(u=t.bootstrap)!=null&&u.isIdentifiedID?h:t.bootstrap.distinctID;this.persistence.set_property(S5,(d=t.bootstrap)!=null&&d.isIdentifiedID?"identified":"anonymous"),this.register({distinct_id:t.bootstrap.distinctID,$device_id:f})}if(this.Ds()){var m,y,g=Object.keys(((m=t.bootstrap)==null?void 0:m.featureFlags)||{}).filter((w=>{var T;return!((T=t.bootstrap)==null||(T=T.featureFlags)==null||!T[w])})).reduce(((w,T)=>{var N;return w[T]=((N=t.bootstrap)==null||(N=N.featureFlags)==null?void 0:N[T])||!1,w}),{}),b=Object.keys(((y=t.bootstrap)==null?void 0:y.featureFlagPayloads)||{}).filter((w=>g[w])).reduce(((w,T)=>{var N,R;return(N=t.bootstrap)!=null&&(N=N.featureFlagPayloads)!=null&&N[T]&&(w[T]=(R=t.bootstrap)==null||(R=R.featureFlagPayloads)==null?void 0:R[T]),w}),{});this.featureFlags.receivedFeatureFlags({featureFlags:g,featureFlagPayloads:b})}if(l)this.register_once({distinct_id:dN,$device_id:null},"");else if(!this.get_distinct_id()){var v=this.config.get_device_id(s3());this.register_once({distinct_id:v,$device_id:v},""),this.persistence.set_property(S5,"anonymous")}return M_(qn,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),this.toolbar.maybeLoadToolbar(),t.segment?n1t(this,(()=>this.js())):this.js(),h2(this.config._onCapture)&&this.config._onCapture!==pK&&(Yr.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",(w=>this.config._onCapture(w.event,w)))),this.config.ip&&Yr.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}Ce(e){var t,i,r,o,s,a,c,l;if(!Kr||!Kr.body)return Yr.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout((()=>{this.Ce(e)}),500);this.compression=void 0,e.supportedCompression&&!this.config.disable_compression&&(this.compression=Fl(e.supportedCompression,E5.GZipJS)?E5.GZipJS:Fl(e.supportedCompression,E5.Base64)?E5.Base64:void 0),(t=e.analytics)!=null&&t.endpoint&&(this.analyticsDefaultEndpoint=e.analytics.endpoint),this.set_config({person_profiles:this.Rs?this.Rs:"identified_only"}),(i=this.siteApps)==null||i.onRemoteConfig(e),(r=this.sessionRecording)==null||r.onRemoteConfig(e),(o=this.autocapture)==null||o.onRemoteConfig(e),(s=this.heatmaps)==null||s.onRemoteConfig(e),this.surveys.onRemoteConfig(e),(a=this.webVitalsAutocapture)==null||a.onRemoteConfig(e),(c=this.exceptionObserver)==null||c.onRemoteConfig(e),this.exceptions.onRemoteConfig(e),(l=this.deadClicksAutocapture)==null||l.onRemoteConfig(e)}js(){try{this.config.loaded(this)}catch(e){Yr.critical("`loaded` function failed",e)}this.Ls(),this.config.capture_pageview&&setTimeout((()=>{(this.consent.isOptedIn()||this.config.cookieless_mode==="always")&&this.Ns()}),1),new B1t(this).load(),this.featureFlags.flags()}Ls(){var e;this.is_capturing()&&this.config.request_batching&&((e=this.Os)==null||e.enable())}_dom_loaded(){this.is_capturing()&&r3(this.__request_queue,(e=>this.Fs(e))),this.__request_queue=[],this.Ls()}_handle_unload(){var e,t;this.config.request_batching?(this.zs()&&this.capture("$pageleave"),(e=this.Os)==null||e.unload(),(t=this.As)==null||t.unload()):this.zs()&&this.capture("$pageleave",null,{transport:"sendBeacon"})}Te(e){this.__loaded&&(f3e?this.__request_queue.push(e):this.rateLimiter.isServerRateLimited(e.batchKey)||(e.transport=e.transport||this.config.api_transport,e.url=S7(e.url,{ip:this.config.ip?1:0}),e.headers=Qr({},this.config.request_headers),e.compression=e.compression==="best-available"?this.compression:e.compression,e.fetchOptions=e.fetchOptions||this.config.fetch_options,(t=>{var i,r,o,s=Qr({},t);s.timeout=s.timeout||6e4,s.url=S7(s.url,{_:new Date().getTime().toString(),ver:w5.LIB_VERSION,compression:s.compression});var a=(i=s.transport)!==null&&i!==void 0?i:"fetch",c=(r=(o=h5e(bN,(l=>l.transport===a)))==null?void 0:o.method)!==null&&r!==void 0?r:bN[0].method;if(!c)throw new Error("No available transport method");c(s)})(Qr({},e,{callback:t=>{var i,r;this.rateLimiter.checkForLimiting(t),t.statusCode>=400&&((i=(r=this.config).on_request_error)==null||i.call(r,t)),e.callback==null||e.callback(t)}}))))}Fs(e){this.As?this.As.retriableRequest(e):this.Te(e)}_execute_array(e){var t,i=[],r=[],o=[];r3(e,(a=>{a&&(t=a[0],p0(t)?o.push(a):h2(a)?a.call(this):p0(a)&&t==="alias"?i.push(a):p0(a)&&t.indexOf("capture")!==-1&&h2(this[t])?o.push(a):r.push(a))}));var s=function(a,c){r3(a,(function(l){if(p0(l[0])){var u=c;vf(l,(function(d){u=u[d[0]].apply(u,d.slice(1))}))}else this[l[0]].apply(this,l.slice(1))}),c)};s(i,this),s(r,this),s(o,this)}Ds(){var e,t;return((e=this.config.bootstrap)==null?void 0:e.featureFlags)&&Object.keys((t=this.config.bootstrap)==null?void 0:t.featureFlags).length>0||!1}push(e){this._execute_array([e])}capture(e,t,i){var r;if(this.__loaded&&this.persistence&&this.sessionPersistence&&this.Os){if(this.is_capturing())if(!br(e)&&ly(e)){if(this.config.opt_out_useragent_filter||!this._is_bot()){var o=i!=null&&i.skip_client_rate_limiting?void 0:this.rateLimiter.clientRateLimitContext();if(o==null||!o.isRateLimited){t!=null&&t.$current_url&&!ly(t?.$current_url)&&(Yr.error("Invalid `$current_url` property provided to `posthog.capture`. Input must be a string. Ignoring provided value."),t==null||delete t.$current_url),this.sessionPersistence.update_search_keyword(),this.config.save_campaign_params&&this.sessionPersistence.update_campaign_params(),this.config.save_referrer&&this.sessionPersistence.update_referrer_info(),(this.config.save_campaign_params||this.config.save_referrer)&&this.persistence.set_initial_person_info();var s=new Date,a=i?.timestamp||s,c=s3(),l={uuid:c,event:e,properties:this.calculateEventProperties(e,t||{},a,c)};o&&(l.properties.$lib_rate_limit_remaining_tokens=o.remainingTokens),i?.$set&&(l.$set=i?.$set);var u,d=this.Us(i?.$set_once);if(d&&(l.$set_once=d),(l=jyt(l,i!=null&&i._noTruncate?null:this.config.properties_string_max_length)).timestamp=a,br(i?.timestamp)||(l.properties.$event_time_override_provided=!0,l.properties.$event_time_override_system_time=s),e===cK.DISMISSED||e===cK.SENT){var h=t?.[s3e.SURVEY_ID],f=t?.[s3e.SURVEY_ITERATION];u={id:h,current_iteration:f},localStorage.getItem(a3e(u))||localStorage.setItem(a3e(u),"true"),l.$set=Qr({},l.$set,{[L1t({id:h,current_iteration:f},e===cK.SENT?"responded":"dismissed")]:!0})}var m=Qr({},l.properties.$set,l.$set);if(AC(m)||this.setPersonPropertiesForFlags(m),!Oh(this.config.before_send)){var y=this.qs(l);if(!y)return;l=y}this.xs.emit("eventCaptured",l);var g={method:"POST",url:(r=i?._url)!==null&&r!==void 0?r:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),data:l,compression:"best-available",batchKey:i?._batchKey};return!this.config.request_batching||i&&(i==null||!i._batchKey)||i!=null&&i.send_instantly?this.Fs(g):this.Os.enqueue(g),l}Yr.critical("This capture call is ignored due to client rate limiting.")}}else Yr.error("No event name provided to posthog.capture")}else Yr.uninitializedWarning("posthog.capture")}Ye(e){return this.on("eventCaptured",(t=>e(t.event,t)))}calculateEventProperties(e,t,i,r,o){if(i=i||new Date,!this.persistence||!this.sessionPersistence)return t;var s=o?void 0:this.persistence.remove_event_timer(e),a=Qr({},t);if(a.token=this.config.token,a.$config_defaults=this.config.defaults,(this.config.cookieless_mode=="always"||this.config.cookieless_mode=="on_reject"&&this.consent.isExplicitlyOptedOut())&&(a.$cookieless_mode=!0),e==="$snapshot"){var c=Qr({},this.persistence.properties(),this.sessionPersistence.properties());return a.distinct_id=c.distinct_id,(!ly(a.distinct_id)&&!wx(a.distinct_id)||lZ(a.distinct_id))&&Yr.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),a}var l,u=R1t(this.config.mask_personal_data_properties,this.config.custom_personal_data_properties);if(this.sessionManager){var{sessionId:d,windowId:h}=this.sessionManager.checkAndGetSessionAndWindowId(o,i.getTime());a.$session_id=d,a.$window_id=h}this.sessionPropsManager&&qy(a,this.sessionPropsManager.getSessionProps());try{var f;this.sessionRecording&&qy(a,this.sessionRecording.sdkDebugProperties),a.$sdk_debug_retry_queue_size=(f=this.As)==null?void 0:f.length}catch(b){a.$sdk_debug_error_capturing_properties=String(b)}if(this.requestRouter.region===MN.CUSTOM&&(a.$lib_custom_api_host=this.config.api_host),l=e!=="$pageview"||o?e!=="$pageleave"||o?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(i):this.pageViewManager.doPageView(i,r),a=qy(a,l),e==="$pageview"&&Kr&&(a.title=Kr.title),!br(s)){var m=i.getTime()-s;a.$duration=parseFloat((m/1e3).toFixed(3))}$v&&this.config.opt_out_useragent_filter&&(a.$browser_type=this._is_bot()?"bot":"browser"),(a=qy({},u,this.persistence.properties(),this.sessionPersistence.properties(),a)).$is_identified=this._isIdentified(),p0(this.config.property_denylist)?vf(this.config.property_denylist,(function(b){delete a[b]})):Yr.error("Invalid value for property_denylist config: "+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);var y=this.config.sanitize_properties;y&&(Yr.error("sanitize_properties is deprecated. Use before_send instead"),a=y(a,e));var g=this.Bs();return a.$process_person_profile=g,g&&!o&&this.Hs("_calculate_event_properties"),a}Us(e){var t;if(!this.persistence||!this.Bs()||this.ks)return e;var i=this.persistence.get_initial_props(),r=(t=this.sessionPropsManager)==null?void 0:t.getSetOnceProps(),o=qy({},i,r||{},e||{}),s=this.config.sanitize_properties;return s&&(Yr.error("sanitize_properties is deprecated. Use before_send instead"),o=s(o,"$set_once")),this.ks=!0,AC(o)?void 0:o}register(e,t){var i;(i=this.persistence)==null||i.register(e,t)}register_once(e,t,i){var r;(r=this.persistence)==null||r.register_once(e,t,i)}register_for_session(e){var t;(t=this.sessionPersistence)==null||t.register(e)}unregister(e){var t;(t=this.persistence)==null||t.unregister(e)}unregister_for_session(e){var t;(t=this.sessionPersistence)==null||t.unregister(e)}Ws(e,t){this.register({[e]:t})}getFeatureFlag(e,t){return this.featureFlags.getFeatureFlag(e,t)}getFeatureFlagPayload(e){var t=this.featureFlags.getFeatureFlagPayload(e);try{return JSON.parse(t)}catch{return t}}isFeatureEnabled(e,t){return this.featureFlags.isFeatureEnabled(e,t)}reloadFeatureFlags(){this.featureFlags.reloadFeatureFlags()}updateEarlyAccessFeatureEnrollment(e,t,i){this.featureFlags.updateEarlyAccessFeatureEnrollment(e,t,i)}getEarlyAccessFeatures(e,t,i){return t===void 0&&(t=!1),this.featureFlags.getEarlyAccessFeatures(e,t,i)}on(e,t){return this.xs.on(e,t)}onFeatureFlags(e){return this.featureFlags.onFeatureFlags(e)}onSurveysLoaded(e){return this.surveys.onSurveysLoaded(e)}onSessionId(e){var t,i;return(t=(i=this.sessionManager)==null?void 0:i.onSessionId(e))!==null&&t!==void 0?t:()=>{}}getSurveys(e,t){t===void 0&&(t=!1),this.surveys.getSurveys(e,t)}getActiveMatchingSurveys(e,t){t===void 0&&(t=!1),this.surveys.getActiveMatchingSurveys(e,t)}renderSurvey(e,t){this.surveys.renderSurvey(e,t)}canRenderSurvey(e){return this.surveys.canRenderSurvey(e)}canRenderSurveyAsync(e,t){return t===void 0&&(t=!1),this.surveys.canRenderSurveyAsync(e,t)}identify(e,t,i){if(!this.__loaded||!this.persistence)return Yr.uninitializedWarning("posthog.identify");if(wx(e)&&(e=e.toString(),Yr.warn("The first argument to posthog.identify was a number, but it should be a string. It has been converted to a string.")),e)if(["distinct_id","distinctid"].includes(e.toLowerCase()))Yr.critical('The string "'+e+'" was set in posthog.identify which indicates an error. This ID should be unique to the user and not a hardcoded string.');else if(e!==dN){if(this.Hs("posthog.identify")){var r=this.get_distinct_id();if(this.register({$user_id:e}),!this.get_property("$device_id")){var o=r;this.register_once({$had_persisted_distinct_id:!0,$device_id:o},"")}e!==r&&e!==this.get_property(oN)&&(this.unregister(oN),this.register({distinct_id:e}));var s=(this.persistence.get_property(S5)||"anonymous")==="anonymous";e!==r&&s?(this.persistence.set_property(S5,"identified"),this.setPersonPropertiesForFlags(Qr({},i||{},t||{}),!1),this.capture("$identify",{distinct_id:e,$anon_distinct_id:r},{$set:t||{},$set_once:i||{}}),this.Ps=ATe(e,t,i),this.featureFlags.setAnonymousDistinctId(r)):(t||i)&&this.setPersonProperties(t,i),e!==r&&(this.reloadFeatureFlags(),this.unregister(o7))}}else Yr.critical('The string "'+dN+'" was set in posthog.identify which indicates an error. This ID is only used as a sentinel value.');else Yr.error("Unique user id has not been set in posthog.identify")}setPersonProperties(e,t){if((e||t)&&this.Hs("posthog.setPersonProperties")){var i=ATe(this.get_distinct_id(),e,t);this.Ps!==i?(this.setPersonPropertiesForFlags(Qr({},t||{},e||{})),this.capture("$set",{$set:e||{},$set_once:t||{}}),this.Ps=i):Yr.info("A duplicate setPersonProperties call was made with the same properties. It has been ignored.")}}group(e,t,i){if(e&&t){if(this.Hs("posthog.group")){var r=this.getGroups();r[e]!==t&&this.resetGroupPropertiesForFlags(e),this.register({$groups:Qr({},r,{[e]:t})}),i&&(this.capture("$groupidentify",{$group_type:e,$group_key:t,$group_set:i}),this.setGroupPropertiesForFlags({[e]:i})),r[e]===t||i||this.reloadFeatureFlags()}}else Yr.error("posthog.group requires a group type and group key")}resetGroups(){this.register({$groups:{}}),this.resetGroupPropertiesForFlags(),this.reloadFeatureFlags()}setPersonPropertiesForFlags(e,t){t===void 0&&(t=!0),this.featureFlags.setPersonPropertiesForFlags(e,t)}resetPersonPropertiesForFlags(){this.featureFlags.resetPersonPropertiesForFlags()}setGroupPropertiesForFlags(e,t){t===void 0&&(t=!0),this.Hs("posthog.setGroupPropertiesForFlags")&&this.featureFlags.setGroupPropertiesForFlags(e,t)}resetGroupPropertiesForFlags(e){this.featureFlags.resetGroupPropertiesForFlags(e)}reset(e){var t,i,r,o;if(Yr.info("reset"),!this.__loaded)return Yr.uninitializedWarning("posthog.reset");var s=this.get_property("$device_id");if(this.consent.reset(),(t=this.persistence)==null||t.clear(),(i=this.sessionPersistence)==null||i.clear(),this.surveys.reset(),this.featureFlags.reset(),(r=this.persistence)==null||r.set_property(S5,"anonymous"),(o=this.sessionManager)==null||o.resetSessionId(),this.Ps=null,this.config.cookieless_mode==="always")this.register_once({distinct_id:dN,$device_id:null},"");else{var a=this.config.get_device_id(s3());this.register_once({distinct_id:a,$device_id:e?a:s},"")}this.register({$last_posthog_reset:new Date().toISOString()},1)}get_distinct_id(){return this.get_property("distinct_id")}getGroups(){return this.get_property("$groups")||{}}get_session_id(){var e,t;return(e=(t=this.sessionManager)==null?void 0:t.checkAndGetSessionAndWindowId(!0).sessionId)!==null&&e!==void 0?e:""}get_session_replay_url(e){if(!this.sessionManager)return"";var{sessionId:t,sessionStartTimestamp:i}=this.sessionManager.checkAndGetSessionAndWindowId(!0),r=this.requestRouter.endpointFor("ui","/project/"+this.config.token+"/replay/"+t);if(e!=null&&e.withTimestamp&&i){var o,s=(o=e.timestampLookBack)!==null&&o!==void 0?o:10;if(!i)return r;r+="?t="+Math.max(Math.floor((new Date().getTime()-i)/1e3)-s,0)}return r}alias(e,t){return e===this.get_property(p5e)?(Yr.critical("Attempting to create alias for existing People user - aborting."),-2):this.Hs("posthog.alias")?(br(t)&&(t=this.get_distinct_id()),e!==t?(this.Ws(oN,e),this.capture("$create_alias",{alias:e,distinct_id:t})):(Yr.warn("alias matches current distinct_id - skipping api call."),this.identify(e),-1)):void 0}set_config(e){var t=Qr({},this.config);if(cy(e)){var i,r,o,s,a;qy(this.config,_3e(e));var c=this.Ms();(i=this.persistence)==null||i.update_config(this.config,t,c),this.sessionPersistence=this.config.persistence==="sessionStorage"||this.config.persistence==="memory"?this.persistence:new sK(Qr({},this.config,{persistence:"sessionStorage"}),c),v1.G()&&v1.V("ph_debug")==="true"&&(this.config.debug=!0),this.config.debug&&(w5.DEBUG=!0,Yr.info("set_config",{config:e,oldConfig:t,newConfig:Qr({},this.config)})),(r=this.sessionRecording)==null||r.startIfEnabledOrStop(),(o=this.autocapture)==null||o.startIfEnabled(),(s=this.heatmaps)==null||s.startIfEnabled(),this.surveys.loadIfEnabled(),this.Gs(),(a=this.externalIntegrations)==null||a.startIfEnabledOrStop()}}startSessionRecording(e){var t=e===!0,i={sampling:t||!(e==null||!e.sampling),linked_flag:t||!(e==null||!e.linked_flag),url_trigger:t||!(e==null||!e.url_trigger),event_trigger:t||!(e==null||!e.event_trigger)};if(Object.values(i).some(Boolean)){var r,o,s,a,c;(r=this.sessionManager)==null||r.checkAndGetSessionAndWindowId(),i.sampling&&((o=this.sessionRecording)==null||o.overrideSampling()),i.linked_flag&&((s=this.sessionRecording)==null||s.overrideLinkedFlag()),i.url_trigger&&((a=this.sessionRecording)==null||a.overrideTrigger("url")),i.event_trigger&&((c=this.sessionRecording)==null||c.overrideTrigger("event"))}this.set_config({disable_session_recording:!1})}stopSessionRecording(){this.set_config({disable_session_recording:!0})}sessionRecordingStarted(){var e;return!((e=this.sessionRecording)==null||!e.started)}captureException(e,t){var i=new Error("PostHog syntheticException");return this.exceptions.sendExceptionEvent(Qr({},Pgt((r=>r instanceof Error)(e)?{error:e,event:e.message}:{event:e},{syntheticException:i}),t))}loadToolbar(e){return this.toolbar.loadToolbar(e)}get_property(e){var t;return(t=this.persistence)==null?void 0:t.props[e]}getSessionProperty(e){var t;return(t=this.sessionPersistence)==null?void 0:t.props[e]}toString(){var e,t=(e=this.config.name)!==null&&e!==void 0?e:$C;return t!==$C&&(t=$C+"."+t),t}_isIdentified(){var e,t;return((e=this.persistence)==null?void 0:e.get_property(S5))==="identified"||((t=this.sessionPersistence)==null?void 0:t.get_property(S5))==="identified"}Bs(){var e,t;return!(this.config.person_profiles==="never"||this.config.person_profiles==="identified_only"&&!this._isIdentified()&&AC(this.getGroups())&&((e=this.persistence)==null||(e=e.props)==null||!e[oN])&&((t=this.persistence)==null||(t=t.props)==null||!t[a7]))}zs(){return this.config.capture_pageleave===!0||this.config.capture_pageleave==="if_capture_pageview"&&(this.config.capture_pageview===!0||this.config.capture_pageview==="history_change")}createPersonProfile(){this.Bs()||this.Hs("posthog.createPersonProfile")&&this.setPersonProperties({},{})}Hs(e){return this.config.person_profiles==="never"?(Yr.error(e+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this.Ws(a7,!0),!0)}Ms(){if(this.config.cookieless_mode==="always")return!0;var e=this.consent.isOptedOut(),t=this.config.opt_out_persistence_by_default||this.config.cookieless_mode==="on_reject";return this.config.disable_persistence||e&&!!t}Gs(){var e,t,i,r,o=this.Ms();return((e=this.persistence)==null?void 0:e.je)!==o&&((i=this.persistence)==null||i.set_disabled(o)),((t=this.sessionPersistence)==null?void 0:t.je)!==o&&((r=this.sessionPersistence)==null||r.set_disabled(o)),o}opt_in_capturing(e){if(this.config.cookieless_mode!=="always"){var t;this.config.cookieless_mode==="on_reject"&&this.consent.isExplicitlyOptedOut()&&(this.reset(!0),this.sessionManager=new u3e(this),this.persistence&&(this.sessionPropsManager=new l3e(this,this.sessionManager,this.persistence)),this.sessionRecording=new bTe(this),this.sessionRecording.startIfEnabledOrStop()),this.consent.optInOut(!0),this.Gs(),(br(e?.captureEventName)||e!=null&&e.captureEventName)&&this.capture((t=e?.captureEventName)!==null&&t!==void 0?t:"$opt_in",e?.captureProperties,{send_instantly:!0}),this.config.capture_pageview&&this.Ns()}else Yr.warn('Consent opt in/out is not valid with cookieless_mode="always" and will be ignored')}opt_out_capturing(){var e;this.config.cookieless_mode!=="always"?(this.config.cookieless_mode==="on_reject"&&this.consent.isOptedIn()&&this.reset(!0),this.consent.optInOut(!1),this.Gs(),this.config.cookieless_mode==="on_reject"&&(this.register({distinct_id:dN,$device_id:null}),this.sessionManager=void 0,this.sessionPropsManager=void 0,(e=this.sessionRecording)==null||e.stopRecording(),this.sessionRecording=void 0,this.Ns())):Yr.warn('Consent opt in/out is not valid with cookieless_mode="always" and will be ignored')}has_opted_in_capturing(){return this.consent.isOptedIn()}has_opted_out_capturing(){return this.consent.isOptedOut()}get_explicit_consent_status(){var e=this.consent.consent;return e===T5.GRANTED?"granted":e===T5.DENIED?"denied":"pending"}is_capturing(){return this.config.cookieless_mode==="always"||(this.config.cookieless_mode==="on_reject"?this.consent.isExplicitlyOptedOut()||this.consent.isOptedIn():!this.has_opted_out_capturing())}clear_opt_in_out_capturing(){this.consent.reset(),this.Gs()}_is_bot(){return bw?h3e(bw,this.config.custom_blocked_useragents):void 0}Ns(){Kr&&(Kr.visibilityState==="visible"?this.Es||(this.Es=!0,this.capture("$pageview",{title:Kr.title},{send_instantly:!0}),this.Is&&(Kr.removeEventListener("visibilitychange",this.Is),this.Is=null)):this.Is||(this.Is=this.Ns.bind(this),M_(Kr,"visibilitychange",this.Is)))}debug(e){e===!1?(qn?.console.log("You've disabled debug mode."),localStorage&&localStorage.removeItem("ph_debug"),this.set_config({debug:!1})):(qn?.console.log("You're now in debug mode. All calls to PostHog will be logged in your console.\nYou can disable this with `posthog.debug(false)`."),localStorage&&localStorage.setItem("ph_debug","true"),this.set_config({debug:!0}))}L(){var e,t,i,r,o,s,a,c=this.Ts||{};return"advanced_disable_flags"in c?!!c.advanced_disable_flags:this.config.advanced_disable_flags!==!1?!!this.config.advanced_disable_flags:this.config.advanced_disable_decide===!0?(Yr.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):(i="advanced_disable_decide",r=!1,o=Yr,s=(t="advanced_disable_flags")in(e=c)&&!br(e[t]),a=i in e&&!br(e[i]),s?e[t]:a?(o&&o.warn("Config field '"+i+"' is deprecated. Please use '"+t+"' instead. The old field will be removed in a future major version."),e[i]):r)}qs(e){if(Oh(this.config.before_send))return e;var t=p0(this.config.before_send)?this.config.before_send:[this.config.before_send],i=e;for(var r of t){if(i=r(i),Oh(i)){var o="Event '"+e.event+"' was rejected in beforeSend function";return zyt(e.event)?Yr.warn(o+". This can cause unexpected behavior."):Yr.info(o),null}i.properties&&!AC(i.properties)||Yr.warn("Event '"+e.event+"' has no properties after beforeSend function, this is likely an error.")}return i}getPageViewId(){var e;return(e=this.pageViewManager.pe)==null?void 0:e.pageViewId}captureTraceFeedback(e,t){this.capture("$ai_feedback",{$ai_trace_id:String(e),$ai_feedback_text:t})}captureTraceMetric(e,t,i){this.capture("$ai_metric",{$ai_trace_id:String(e),$ai_metric_name:t,$ai_metric_value:String(i)})}};(function(n,e){for(var t=0;t<e.length;t++)n.prototype[e[t]]=Uyt(n.prototype[e[t]])})(y3e,["identify"]);var g3e,R7=(g3e=AN[$C]=new y3e,(function(){function n(){n.done||(n.done=!0,f3e=!1,vf(AN,(function(e){e._dom_loaded()})))}Kr!=null&&Kr.addEventListener?Kr.readyState==="complete"?n():M_(Kr,"DOMContentLoaded",n,{capture:!1}):qn&&Yr.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")})(),g3e);!window.location.hostname.includes("localhost")&&!window.location.hostname.includes("127.0.0.1")&&(R7.__loaded||R7.init("phc_htd8AQjSfVEsFCLQMAiUooG4Q0DKBCjqYuQglc9V3Wo",{api_host:"https://postpig.tscircuit.com",person_profiles:"always"}));function ibt(n){const e=String.fromCodePoint(...n);return btoa(e)}var vw=Uint8Array,ww=Uint16Array,fK=Int32Array,mK=new vw([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]),_K=new vw([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]),b3e=new vw([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),x3e=function(n,e){for(var t=new ww(31),i=0;i<31;++i)t[i]=e+=1<<n[i-1];for(var r=new fK(t[30]),i=1;i<30;++i)for(var o=t[i];o<t[i+1];++o)r[o]=o-t[i]<<5|i;return{b:t,r}},v3e=x3e(mK,2),rbt=v3e.b,yK=v3e.r;rbt[28]=258,yK[258]=28;for(var obt=x3e(_K,0),w3e=obt.r,gK=new ww(32768),m0=0;m0<32768;++m0){var u3=(m0&43690)>>1|(m0&21845)<<1;u3=(u3&52428)>>2|(u3&13107)<<2,u3=(u3&61680)>>4|(u3&3855)<<4,gK[m0]=((u3&65280)>>8|(u3&255)<<8)>>1}for(var CN=(function(n,e,t){for(var i=n.length,r=0,o=new ww(e);r<i;++r)n[r]&&++o[n[r]-1];var s=new ww(e);for(r=1;r<e;++r)s[r]=s[r-1]+o[r-1]<<1;var a;if(t){a=new ww(1<<e);var c=15-e;for(r=0;r<i;++r)if(n[r])for(var l=r<<4|n[r],u=e-n[r],d=s[n[r]-1]++<<u,h=d|(1<<u)-1;d<=h;++d)a[gK[d]>>c]=l}else for(a=new ww(i),r=0;r<i;++r)n[r]&&(a[r]=gK[s[n[r]-1]++]>>15-n[r]);return a}),_A=new vw(288),m0=0;m0<144;++m0)_A[m0]=8;for(var m0=144;m0<256;++m0)_A[m0]=9;for(var m0=256;m0<280;++m0)_A[m0]=7;for(var m0=280;m0<288;++m0)_A[m0]=8;for(var P7=new vw(32),m0=0;m0<32;++m0)P7[m0]=5;var sbt=CN(_A,9,0),abt=CN(P7,5,0),S3e=function(n){return(n+7)/8|0},E3e=function(n,e,t){return(t==null||t>n.length)&&(t=n.length),new vw(n.subarray(e,t))},R5=function(n,e,t){t<<=e&7;var i=e/8|0;n[i]|=t,n[i+1]|=t>>8},RN=function(n,e,t){t<<=e&7;var i=e/8|0;n[i]|=t,n[i+1]|=t>>8,n[i+2]|=t>>16},bK=function(n,e){for(var t=[],i=0;i<n.length;++i)n[i]&&t.push({s:i,f:n[i]});var r=t.length,o=t.slice();if(!r)return{t:C3e,l:0};if(r==1){var s=new vw(t[0].s+1);return s[t[0].s]=1,{t:s,l:1}}t.sort(function(N,R){return N.f-R.f}),t.push({s:-1,f:25001});var a=t[0],c=t[1],l=0,u=1,d=2;for(t[0]={s:-1,f:a.f+c.f,l:a,r:c};u!=r-1;)a=t[t[l].f<t[d].f?l++:d++],c=t[l!=u&&t[l].f<t[d].f?l++:d++],t[u++]={s:-1,f:a.f+c.f,l:a,r:c};for(var h=o[0].s,i=1;i<r;++i)o[i].s>h&&(h=o[i].s);var f=new ww(h+1),m=xK(t[u-1],f,0);if(m>e){var i=0,y=0,g=m-e,b=1<<g;for(o.sort(function(R,P){return f[P.s]-f[R.s]||R.f-P.f});i<r;++i){var v=o[i].s;if(f[v]>e)y+=b-(1<<m-f[v]),f[v]=e;else break}for(y>>=g;y>0;){var w=o[i].s;f[w]<e?y-=1<<e-f[w]++-1:++i}for(;i>=0&&y;--i){var T=o[i].s;f[T]==e&&(--f[T],++y)}m=e}return{t:new vw(f),l:m}},xK=function(n,e,t){return n.s==-1?Math.max(xK(n.l,e,t+1),xK(n.r,e,t+1)):e[n.s]=t},T3e=function(n){for(var e=n.length;e&&!n[--e];);for(var t=new ww(++e),i=0,r=n[0],o=1,s=function(c){t[i++]=c},a=1;a<=e;++a)if(n[a]==r&&a!=e)++o;else{if(!r&&o>2){for(;o>138;o-=138)s(32754);o>2&&(s(o>10?o-11<<5|28690:o-3<<5|12305),o=0)}else if(o>3){for(s(r),--o;o>6;o-=6)s(8304);o>2&&(s(o-3<<5|8208),o=0)}for(;o--;)s(r);o=1,r=n[a]}return{c:t.subarray(0,i),n:e}},PN=function(n,e){for(var t=0,i=0;i<e.length;++i)t+=n[i]*e[i];return t},M3e=function(n,e,t){var i=t.length,r=S3e(e+2);n[r]=i&255,n[r+1]=i>>8,n[r+2]=n[r]^255,n[r+3]=n[r+1]^255;for(var o=0;o<i;++o)n[r+o+4]=t[o];return(r+4+i)*8},A3e=function(n,e,t,i,r,o,s,a,c,l,u){R5(e,u++,t),++r[256];for(var d=bK(r,15),h=d.t,f=d.l,m=bK(o,15),y=m.t,g=m.l,b=T3e(h),v=b.c,w=b.n,T=T3e(y),N=T.c,R=T.n,P=new ww(19),M=0;M<v.length;++M)++P[v[M]&31];for(var M=0;M<N.length;++M)++P[N[M]&31];for(var I=bK(P,7),A=I.t,U=I.l,k=19;k>4&&!A[b3e[k-1]];--k);var V=l+5<<3,X=PN(r,_A)+PN(o,P7)+s,W=PN(r,h)+PN(o,y)+s+14+3*k+PN(P,A)+2*P[16]+3*P[17]+7*P[18];if(c>=0&&V<=X&&V<=W)return M3e(e,u,n.subarray(c,c+l));var K,te,se,de;if(R5(e,u,1+(W<X)),u+=2,W<X){K=CN(h,f,0),te=h,se=CN(y,g,0),de=y;var be=CN(A,U,0);R5(e,u,w-257),R5(e,u+5,R-1),R5(e,u+10,k-4),u+=14;for(var M=0;M<k;++M)R5(e,u+3*M,A[b3e[M]]);u+=3*k;for(var re=[v,N],ue=0;ue<2;++ue)for(var he=re[ue],M=0;M<he.length;++M){var Ae=he[M]&31;R5(e,u,be[Ae]),u+=A[Ae],Ae>15&&(R5(e,u,he[M]>>5&127),u+=he[M]>>12)}}else K=sbt,te=_A,se=abt,de=P7;for(var M=0;M<a;++M){var Ne=i[M];if(Ne>255){var Ae=Ne>>18&31;RN(e,u,K[Ae+257]),u+=te[Ae+257],Ae>7&&(R5(e,u,Ne>>23&31),u+=mK[Ae]);var De=Ne&31;RN(e,u,se[De]),u+=de[De],De>3&&(RN(e,u,Ne>>5&8191),u+=_K[De])}else RN(e,u,K[Ne]),u+=te[Ne]}return RN(e,u,K[256]),u+te[256]},cbt=new fK([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),C3e=new vw(0),lbt=function(n,e,t,i,r,o){var s=o.z||n.length,a=new vw(i+s+5*(1+Math.ceil(s/7e3))+r),c=a.subarray(i,a.length-r),l=o.l,u=(o.r||0)&7;if(e){u&&(c[0]=o.r>>3);for(var d=cbt[e-1],h=d>>13,f=d&8191,m=(1<<t)-1,y=o.p||new ww(32768),g=o.h||new ww(m+1),b=Math.ceil(t/3),v=2*b,w=function(st){return(n[st]^n[st+1]<<b^n[st+2]<<v)&m},T=new fK(25e3),N=new ww(288),R=new ww(32),P=0,M=0,I=o.i||0,A=0,U=o.w||0,k=0;I+2<s;++I){var V=w(I),X=I&32767,W=g[V];if(y[X]=W,g[V]=X,U<=I){var K=s-I;if((P>7e3||A>24576)&&(K>423||!l)){u=A3e(n,c,0,T,N,R,M,A,k,I-k,u),A=P=M=0,k=I;for(var te=0;te<286;++te)N[te]=0;for(var te=0;te<30;++te)R[te]=0}var se=2,de=0,be=f,re=X-W&32767;if(K>2&&V==w(I-re))for(var ue=Math.min(h,K)-1,he=Math.min(32767,I),Ae=Math.min(258,K);re<=he&&--be&&X!=W;){if(n[I+se]==n[I+se-re]){for(var Ne=0;Ne<Ae&&n[I+Ne]==n[I+Ne-re];++Ne);if(Ne>se){if(se=Ne,de=re,Ne>ue)break;for(var De=Math.min(re,Ne-2),Ge=0,te=0;te<De;++te){var ke=I-re+te&32767,ce=y[ke],we=ke-ce&32767;we>Ge&&(Ge=we,W=ke)}}}X=W,W=y[X],re+=X-W&32767}if(de){T[A++]=268435456|yK[se]<<18|w3e[de];var xe=yK[se]&31,Ye=w3e[de]&31;M+=mK[xe]+_K[Ye],++N[257+xe],++R[Ye],U=I+se,++P}else T[A++]=n[I],++N[n[I]]}}for(I=Math.max(I,U);I<s;++I)T[A++]=n[I],++N[n[I]];u=A3e(n,c,l,T,N,R,M,A,k,I-k,u),l||(o.r=u&7|c[u/8|0]<<3,u-=7,o.h=g,o.p=y,o.i=I,o.w=U)}else{for(var I=o.w||0;I<s+l;I+=65535){var Je=I+65535;Je>=s&&(c[u/8|0]=l,Je=s),u=M3e(c,u+1,n.subarray(I,Je))}o.i=s}return E3e(a,0,i+S3e(u)+r)},ubt=(function(){for(var n=new Int32Array(256),e=0;e<256;++e){for(var t=e,i=9;--i;)t=(t&1&&-306674912)^t>>>1;n[e]=t}return n})(),dbt=function(){var n=-1;return{p:function(e){for(var t=n,i=0;i<e.length;++i)t=ubt[t&255^e[i]]^t>>>8;n=t},d:function(){return~n}}},hbt=function(n,e,t,i,r){if(!r&&(r={l:1},e.dictionary)){var o=e.dictionary.subarray(-32768),s=new vw(o.length+n.length);s.set(o),s.set(n,o.length),n=s,r.w=o.length}return lbt(n,e.level==null?6:e.level,e.mem==null?r.l?Math.ceil(Math.max(8,Math.min(13,Math.log(n.length)))*1.5):20:12+e.mem,t,i,r)},vK=function(n,e,t){for(;t;++e)n[e]=t,t>>>=8},pbt=function(n,e){var t=e.filename;if(n[0]=31,n[1]=139,n[2]=8,n[8]=e.level<2?4:e.level==9?2:0,n[9]=3,e.mtime!=0&&vK(n,4,Math.floor(new Date(e.mtime||Date.now())/1e3)),t){n[3]=8;for(var i=0;i<=t.length;++i)n[i+10]=t.charCodeAt(i)}},fbt=function(n){return 10+(n.filename?n.filename.length+1:0)};function R3e(n,e){e||(e={});var t=dbt(),i=n.length;t.p(n);var r=hbt(n,e,fbt(e),8),o=r.length;return pbt(r,e),vK(r,o-8,t.d()),vK(r,o-4,i),r}var P3e=typeof TextEncoder<"u"&&new TextEncoder,mbt=typeof TextDecoder<"u"&&new TextDecoder,_bt=0;try{mbt.decode(C3e,{stream:!0}),_bt=1}catch{}function I3e(n,e){var t;if(P3e)return P3e.encode(n);for(var i=n.length,r=new vw(n.length+(n.length>>1)),o=0,s=function(l){r[o++]=l},t=0;t<i;++t){if(o+5>r.length){var a=new vw(o+8+(i-t<<1));a.set(r),r=a}var c=n.charCodeAt(t);c<128||e?s(c):c<2048?(s(192|c>>6),s(128|c&63)):c>55295&&c<57344?(c=65536+(c&1047552)|n.charCodeAt(++t)&1023,s(240|c>>18),s(128|c>>12&63),s(128|c>>6&63),s(128|c&63)):(s(224|c>>12),s(128|c>>6&63),s(128|c&63))}return E3e(r,0,o)}function ybt(n,e){const t=JSON.stringify(n),i=R3e(I3e(t));return`https://tscircuit.com/editor?#data:application/gzip;base64,${ibt(i)}`}function $a(...n){return kyt(JS(n))}const N3e=n=>n.replace(/_/g," ").replace(/\b\w/g,e=>e.toUpperCase()),wK=nyt,I7=Te.forwardRef(({className:n,...e},t)=>ye.jsx(VEe,{ref:t,className:$a("rf-inline-flex rf-h-9 rf-items-center rf-justify-center rf-rounded-lg rf-bg-zinc-100 rf-p-1 rf-text-zinc-500 dark:rf-bg-zinc-800 dark:rf-text-zinc-400",n),...e}));I7.displayName=VEe.displayName;const P5=Te.forwardRef(({className:n,...e},t)=>ye.jsx(GEe,{ref:t,className:$a("rf-inline-flex rf-items-center rf-justify-center rf-whitespace-nowrap rf-rounded-md rf-px-3 rf-py-1 rf-text-sm rf-font-medium rf-ring-offset-white rf-transition-all focus-visible:rf-outline-none focus-visible:rf-ring-2 focus-visible:rf-ring-zinc-950 focus-visible:rf-ring-offset-2 disabled:rf-pointer-events-none disabled:rf-opacity-50 data-[state=active]:rf-bg-white data-[state=active]:rf-text-zinc-950 data-[state=active]:rf-shadow dark:rf-ring-offset-zinc-950 dark:focus-visible:rf-ring-zinc-300 dark:data-[state=active]:rf-bg-zinc-950 dark:data-[state=active]:rf-text-zinc-50",n),...e}));P5.displayName=GEe.displayName;const Sw=Te.forwardRef(({className:n,...e},t)=>ye.jsx(YEe,{ref:t,className:$a("rf-h-full rf-mt-2 rf-ring-offset-white focus-visible:rf-outline-none focus-visible:rf-ring-2 focus-visible:rf-ring-zinc-950 focus-visible:rf-ring-offset-2 dark:rf-ring-offset-zinc-950 dark:focus-visible:rf-ring-zinc-300",n),...e}));Sw.displayName=YEe.displayName;var jd;(function(n){n.assertEqual=r=>{};function e(r){}n.assertIs=e;function t(r){throw new Error}n.assertNever=t,n.arrayToEnum=r=>{const o={};for(const s of r)o[s]=s;return o},n.getValidEnumValues=r=>{const o=n.objectKeys(r).filter(a=>typeof r[r[a]]!="number"),s={};for(const a of o)s[a]=r[a];return n.objectValues(s)},n.objectValues=r=>n.objectKeys(r).map(function(o){return r[o]}),n.objectKeys=typeof Object.keys=="function"?r=>Object.keys(r):r=>{const o=[];for(const s in r)Object.prototype.hasOwnProperty.call(r,s)&&o.push(s);return o},n.find=(r,o)=>{for(const s of r)if(o(s))return s},n.isInteger=typeof Number.isInteger=="function"?r=>Number.isInteger(r):r=>typeof r=="number"&&Number.isFinite(r)&&Math.floor(r)===r;function i(r,o=" | "){return r.map(s=>typeof s=="string"?`'${s}'`:s).join(o)}n.joinValues=i,n.jsonStringifyReplacer=(r,o)=>typeof o=="bigint"?o.toString():o})(jd||(jd={}));var k3e;(function(n){n.mergeShapes=(e,t)=>({...e,...t})})(k3e||(k3e={}));const co=jd.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),d3=n=>{switch(typeof n){case"undefined":return co.undefined;case"string":return co.string;case"number":return Number.isNaN(n)?co.nan:co.number;case"boolean":return co.boolean;case"function":return co.function;case"bigint":return co.bigint;case"symbol":return co.symbol;case"object":return Array.isArray(n)?co.array:n===null?co.null:n.then&&typeof n.then=="function"&&n.catch&&typeof n.catch=="function"?co.promise:typeof Map<"u"&&n instanceof Map?co.map:typeof Set<"u"&&n instanceof Set?co.set:typeof Date<"u"&&n instanceof Date?co.date:co.object;default:return co.unknown}},zi=jd.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);let sE=class L0t extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=i=>{this.issues=[...this.issues,i]},this.addIssues=(i=[])=>{this.issues=[...this.issues,...i]};const t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}format(e){const t=e||function(o){return o.message},i={_errors:[]},r=o=>{for(const s of o.issues)if(s.code==="invalid_union")s.unionErrors.map(r);else if(s.code==="invalid_return_type")r(s.returnTypeError);else if(s.code==="invalid_arguments")r(s.argumentsError);else if(s.path.length===0)i._errors.push(t(s));else{let a=i,c=0;for(;c<s.path.length;){const l=s.path[c];c===s.path.length-1?(a[l]=a[l]||{_errors:[]},a[l]._errors.push(t(s))):a[l]=a[l]||{_errors:[]},a=a[l],c++}}};return r(this),i}static assert(e){if(!(e instanceof L0t))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,jd.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=t=>t.message){const t={},i=[];for(const r of this.issues)if(r.path.length>0){const o=r.path[0];t[o]=t[o]||[],t[o].push(e(r))}else i.push(e(r));return{formErrors:i,fieldErrors:t}}get formErrors(){return this.flatten()}};sE.create=n=>new sE(n);const IN=(n,e)=>{let t;switch(n.code){case zi.invalid_type:n.received===co.undefined?t="Required":t=`Expected ${n.expected}, received ${n.received}`;break;case zi.invalid_literal:t=`Invalid literal value, expected ${JSON.stringify(n.expected,jd.jsonStringifyReplacer)}`;break;case zi.unrecognized_keys:t=`Unrecognized key(s) in object: ${jd.joinValues(n.keys,", ")}`;break;case zi.invalid_union:t="Invalid input";break;case zi.invalid_union_discriminator:t=`Invalid discriminator value. Expected ${jd.joinValues(n.options)}`;break;case zi.invalid_enum_value:t=`Invalid enum value. Expected ${jd.joinValues(n.options)}, received '${n.received}'`;break;case zi.invalid_arguments:t="Invalid function arguments";break;case zi.invalid_return_type:t="Invalid function return type";break;case zi.invalid_date:t="Invalid date";break;case zi.invalid_string:typeof n.validation=="object"?"includes"in n.validation?(t=`Invalid input: must include "${n.validation.includes}"`,typeof n.validation.position=="number"&&(t=`${t} at one or more positions greater than or equal to ${n.validation.position}`)):"startsWith"in n.validation?t=`Invalid input: must start with "${n.validation.startsWith}"`:"endsWith"in n.validation?t=`Invalid input: must end with "${n.validation.endsWith}"`:jd.assertNever(n.validation):n.validation!=="regex"?t=`Invalid ${n.validation}`:t="Invalid";break;case zi.too_small:n.type==="array"?t=`Array must contain ${n.exact?"exactly":n.inclusive?"at least":"more than"} ${n.minimum} element(s)`:n.type==="string"?t=`String must contain ${n.exact?"exactly":n.inclusive?"at least":"over"} ${n.minimum} character(s)`:n.type==="number"?t=`Number must be ${n.exact?"exactly equal to ":n.inclusive?"greater than or equal to ":"greater than "}${n.minimum}`:n.type==="bigint"?t=`Number must be ${n.exact?"exactly equal to ":n.inclusive?"greater than or equal to ":"greater than "}${n.minimum}`:n.type==="date"?t=`Date must be ${n.exact?"exactly equal to ":n.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(n.minimum))}`:t="Invalid input";break;case zi.too_big:n.type==="array"?t=`Array must contain ${n.exact?"exactly":n.inclusive?"at most":"less than"} ${n.maximum} element(s)`:n.type==="string"?t=`String must contain ${n.exact?"exactly":n.inclusive?"at most":"under"} ${n.maximum} character(s)`:n.type==="number"?t=`Number must be ${n.exact?"exactly":n.inclusive?"less than or equal to":"less than"} ${n.maximum}`:n.type==="bigint"?t=`BigInt must be ${n.exact?"exactly":n.inclusive?"less than or equal to":"less than"} ${n.maximum}`:n.type==="date"?t=`Date must be ${n.exact?"exactly":n.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(n.maximum))}`:t="Invalid input";break;case zi.custom:t="Invalid input";break;case zi.invalid_intersection_types:t="Intersection results could not be merged";break;case zi.not_multiple_of:t=`Number must be a multiple of ${n.multipleOf}`;break;case zi.not_finite:t="Number must be finite";break;default:t=e.defaultError,jd.assertNever(n)}return{message:t}};let gbt=IN;function SK(){return gbt}const EK=n=>{const{data:e,path:t,errorMaps:i,issueData:r}=n,o=[...t,...r.path||[]],s={...r,path:o};if(r.message!==void 0)return{...r,path:o,message:r.message};let a="";const c=i.filter(l=>!!l).slice().reverse();for(const l of c)a=l(s,{data:e,defaultError:a}).message;return{...r,path:o,message:a}};function Or(n,e){const t=SK(),i=EK({issueData:e,data:n.data,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,t,t===IN?void 0:IN].filter(r=>!!r)});n.common.issues.push(i)}let Ew=class D0t{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,t){const i=[];for(const r of t){if(r.status==="aborted")return Js;r.status==="dirty"&&e.dirty(),i.push(r.value)}return{status:e.value,value:i}}static async mergeObjectAsync(e,t){const i=[];for(const r of t){const o=await r.key,s=await r.value;i.push({key:o,value:s})}return D0t.mergeObjectSync(e,i)}static mergeObjectSync(e,t){const i={};for(const r of t){const{key:o,value:s}=r;if(o.status==="aborted"||s.status==="aborted")return Js;o.status==="dirty"&&e.dirty(),s.status==="dirty"&&e.dirty(),o.value!=="__proto__"&&(typeof s.value<"u"||r.alwaysSet)&&(i[o.value]=s.value)}return{status:e.value,value:i}}};const Js=Object.freeze({status:"aborted"}),NN=n=>({status:"dirty",value:n}),Bv=n=>({status:"valid",value:n}),O3e=n=>n.status==="aborted",L3e=n=>n.status==="dirty",FC=n=>n.status==="valid",N7=n=>typeof Promise<"u"&&n instanceof Promise;var Wo;(function(n){n.errToObj=e=>typeof e=="string"?{message:e}:e||{},n.toString=e=>typeof e=="string"?e:e?.message})(Wo||(Wo={}));let aE=class{constructor(e,t,i,r){this._cachedPath=[],this.parent=e,this.data=t,this._path=i,this._key=r}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}};const D3e=(n,e)=>{if(FC(e))return{success:!0,data:e.value};if(!n.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const t=new sE(n.common.issues);return this._error=t,this._error}}};function Oc(n){if(!n)return{};const{errorMap:e,invalid_type_error:t,required_error:i,description:r}=n;if(e&&(t||i))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:r}:{errorMap:(s,a)=>{const{message:c}=n;return s.code==="invalid_enum_value"?{message:c??a.defaultError}:typeof a.data>"u"?{message:c??i??a.defaultError}:s.code!=="invalid_type"?{message:a.defaultError}:{message:c??t??a.defaultError}},description:r}}let ru=class{get description(){return this._def.description}_getType(e){return d3(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:d3(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new Ew,ctx:{common:e.parent.common,data:e.data,parsedType:d3(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const t=this._parse(e);if(N7(t))throw new Error("Synchronous parse encountered promise.");return t}_parseAsync(e){const t=this._parse(e);return Promise.resolve(t)}parse(e,t){const i=this.safeParse(e,t);if(i.success)return i.data;throw i.error}safeParse(e,t){const i={common:{issues:[],async:t?.async??!1,contextualErrorMap:t?.errorMap},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:d3(e)},r=this._parseSync({data:e,path:i.path,parent:i});return D3e(i,r)}"~validate"(e){const t={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:d3(e)};if(!this["~standard"].async)try{const i=this._parseSync({data:e,path:[],parent:t});return FC(i)?{value:i.value}:{issues:t.common.issues}}catch(i){i?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),t.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:t}).then(i=>FC(i)?{value:i.value}:{issues:t.common.issues})}async parseAsync(e,t){const i=await this.safeParseAsync(e,t);if(i.success)return i.data;throw i.error}async safeParseAsync(e,t){const i={common:{issues:[],contextualErrorMap:t?.errorMap,async:!0},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:d3(e)},r=this._parse({data:e,path:i.path,parent:i}),o=await(N7(r)?r:Promise.resolve(r));return D3e(i,o)}refine(e,t){const i=r=>typeof t=="string"||typeof t>"u"?{message:t}:typeof t=="function"?t(r):t;return this._refinement((r,o)=>{const s=e(r),a=()=>o.addIssue({code:zi.custom,...i(r)});return typeof Promise<"u"&&s instanceof Promise?s.then(c=>c?!0:(a(),!1)):s?!0:(a(),!1)})}refinement(e,t){return this._refinement((i,r)=>e(i)?!0:(r.addIssue(typeof t=="function"?t(i,r):t),!1))}_refinement(e){return new p3({schema:this,typeName:va.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:t=>this["~validate"](t)}}optional(){return k5.create(this,this._def)}nullable(){return gA.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return UC.create(this)}promise(){return LN.create(this,this._def)}or(e){return $7.create([this,e],this._def)}and(e){return F7.create(this,e,this._def)}transform(e){return new p3({...Oc(this._def),schema:this,typeName:va.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const t=typeof e=="function"?e:()=>e;return new j7({...Oc(this._def),innerType:this,defaultValue:t,typeName:va.ZodDefault})}brand(){return new G3e({typeName:va.ZodBranded,type:this,...Oc(this._def)})}catch(e){const t=typeof e=="function"?e:()=>e;return new H7({...Oc(this._def),innerType:this,catchValue:t,typeName:va.ZodCatch})}describe(e){const t=this.constructor;return new t({...this._def,description:e})}pipe(e){return Vbt.create(this,e)}readonly(){return V7.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}};const bbt=/^c[^\s-]{8,}$/i,xbt=/^[0-9a-z]+$/,vbt=/^[0-9A-HJKMNP-TV-Z]{26}$/i,wbt=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,Sbt=/^[a-z0-9_-]{21}$/i,Ebt=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,Tbt=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,Mbt=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Abt="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let TK;const Cbt=/^(?:(?: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])$/,Rbt=/^(?:(?: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])\/(3[0-2]|[12]?[0-9])$/,Pbt=/^(([0-9a-fA-F]{1,4}:){7,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}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,Ibt=/^(([0-9a-fA-F]{1,4}:){7,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}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Nbt=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,kbt=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,z3e="((\\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])))",Obt=new RegExp(`^${z3e}$`);function $3e(n){let e="[0-5]\\d";n.precision?e=`${e}\\.\\d{${n.precision}}`:n.precision==null&&(e=`${e}(\\.\\d+)?`);const t=n.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${t}`}function Lbt(n){return new RegExp(`^${$3e(n)}$`)}function Dbt(n){let e=`${z3e}T${$3e(n)}`;const t=[];return t.push(n.local?"Z?":"Z"),n.offset&&t.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${t.join("|")})`,new RegExp(`^${e}$`)}function zbt(n,e){return!!((e==="v4"||!e)&&Cbt.test(n)||(e==="v6"||!e)&&Pbt.test(n))}function $bt(n,e){if(!Ebt.test(n))return!1;try{const[t]=n.split(".");if(!t)return!1;const i=t.replace(/-/g,"+").replace(/_/g,"/").padEnd(t.length+(4-t.length%4)%4,"="),r=JSON.parse(atob(i));return!(typeof r!="object"||r===null||"typ"in r&&r?.typ!=="JWT"||!r.alg||e&&r.alg!==e)}catch{return!1}}function Fbt(n,e){return!!((e==="v4"||!e)&&Rbt.test(n)||(e==="v6"||!e)&&Ibt.test(n))}let kN=class NL extends ru{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==co.string){const o=this._getOrReturnCtx(e);return Or(o,{code:zi.invalid_type,expected:co.string,received:o.parsedType}),Js}const i=new Ew;let r;for(const o of this._def.checks)if(o.kind==="min")e.data.length<o.value&&(r=this._getOrReturnCtx(e,r),Or(r,{code:zi.too_small,minimum:o.value,type:"string",inclusive:!0,exact:!1,message:o.message}),i.dirty());else if(o.kind==="max")e.data.length>o.value&&(r=this._getOrReturnCtx(e,r),Or(r,{code:zi.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!1,message:o.message}),i.dirty());else if(o.kind==="length"){const s=e.data.length>o.value,a=e.data.length<o.value;(s||a)&&(r=this._getOrReturnCtx(e,r),s?Or(r,{code:zi.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!0,message:o.message}):a&&Or(r,{code:zi.too_small,minimum:o.value,type:"string",inclusive:!0,exact:!0,message:o.message}),i.dirty())}else if(o.kind==="email")Mbt.test(e.data)||(r=this._getOrReturnCtx(e,r),Or(r,{validation:"email",code:zi.invalid_string,message:o.message}),i.dirty());else if(o.kind==="emoji")TK||(TK=new RegExp(Abt,"u")),TK.test(e.data)||(r=this._getOrReturnCtx(e,r),Or(r,{validation:"emoji",code:zi.invalid_string,message:o.message}),i.dirty());else if(o.kind==="uuid")wbt.test(e.data)||(r=this._getOrReturnCtx(e,r),Or(r,{validation:"uuid",code:zi.invalid_string,message:o.message}),i.dirty());else if(o.kind==="nanoid")Sbt.test(e.data)||(r=this._getOrReturnCtx(e,r),Or(r,{validation:"nanoid",code:zi.invalid_string,message:o.message}),i.dirty());else if(o.kind==="cuid")bbt.test(e.data)||(r=this._getOrReturnCtx(e,r),Or(r,{validation:"cuid",code:zi.invalid_string,message:o.message}),i.dirty());else if(o.kind==="cuid2")xbt.test(e.data)||(r=this._getOrReturnCtx(e,r),Or(r,{validation:"cuid2",code:zi.invalid_string,message:o.message}),i.dirty());else if(o.kind==="ulid")vbt.test(e.data)||(r=this._getOrReturnCtx(e,r),Or(r,{validation:"ulid",code:zi.invalid_string,message:o.message}),i.dirty());else if(o.kind==="url")try{new URL(e.data)}catch{r=this._getOrReturnCtx(e,r),Or(r,{validation:"url",code:zi.invalid_string,message:o.message}),i.dirty()}else o.kind==="regex"?(o.regex.lastIndex=0,o.regex.test(e.data)||(r=this._getOrReturnCtx(e,r),Or(r,{validation:"regex",code:zi.invalid_string,message:o.message}),i.dirty())):o.kind==="trim"?e.data=e.data.trim():o.kind==="includes"?e.data.includes(o.value,o.position)||(r=this._getOrReturnCtx(e,r),Or(r,{code:zi.invalid_string,validation:{includes:o.value,position:o.position},message:o.message}),i.dirty()):o.kind==="toLowerCase"?e.data=e.data.toLowerCase():o.kind==="toUpperCase"?e.data=e.data.toUpperCase():o.kind==="startsWith"?e.data.startsWith(o.value)||(r=this._getOrReturnCtx(e,r),Or(r,{code:zi.invalid_string,validation:{startsWith:o.value},message:o.message}),i.dirty()):o.kind==="endsWith"?e.data.endsWith(o.value)||(r=this._getOrReturnCtx(e,r),Or(r,{code:zi.invalid_string,validation:{endsWith:o.value},message:o.message}),i.dirty()):o.kind==="datetime"?Dbt(o).test(e.data)||(r=this._getOrReturnCtx(e,r),Or(r,{code:zi.invalid_string,validation:"datetime",message:o.message}),i.dirty()):o.kind==="date"?Obt.test(e.data)||(r=this._getOrReturnCtx(e,r),Or(r,{code:zi.invalid_string,validation:"date",message:o.message}),i.dirty()):o.kind==="time"?Lbt(o).test(e.data)||(r=this._getOrReturnCtx(e,r),Or(r,{code:zi.invalid_string,validation:"time",message:o.message}),i.dirty()):o.kind==="duration"?Tbt.test(e.data)||(r=this._getOrReturnCtx(e,r),Or(r,{validation:"duration",code:zi.invalid_string,message:o.message}),i.dirty()):o.kind==="ip"?zbt(e.data,o.version)||(r=this._getOrReturnCtx(e,r),Or(r,{validation:"ip",code:zi.invalid_string,message:o.message}),i.dirty()):o.kind==="jwt"?$bt(e.data,o.alg)||(r=this._getOrReturnCtx(e,r),Or(r,{validation:"jwt",code:zi.invalid_string,message:o.message}),i.dirty()):o.kind==="cidr"?Fbt(e.data,o.version)||(r=this._getOrReturnCtx(e,r),Or(r,{validation:"cidr",code:zi.invalid_string,message:o.message}),i.dirty()):o.kind==="base64"?Nbt.test(e.data)||(r=this._getOrReturnCtx(e,r),Or(r,{validation:"base64",code:zi.invalid_string,message:o.message}),i.dirty()):o.kind==="base64url"?kbt.test(e.data)||(r=this._getOrReturnCtx(e,r),Or(r,{validation:"base64url",code:zi.invalid_string,message:o.message}),i.dirty()):jd.assertNever(o);return{status:i.value,value:e.data}}_regex(e,t,i){return this.refinement(r=>e.test(r),{validation:t,code:zi.invalid_string,...Wo.errToObj(i)})}_addCheck(e){return new NL({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...Wo.errToObj(e)})}url(e){return this._addCheck({kind:"url",...Wo.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...Wo.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...Wo.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...Wo.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...Wo.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...Wo.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...Wo.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...Wo.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...Wo.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...Wo.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...Wo.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...Wo.errToObj(e)})}datetime(e){return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...Wo.errToObj(e?.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof e?.precision>"u"?null:e?.precision,...Wo.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...Wo.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...Wo.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t?.position,...Wo.errToObj(t?.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...Wo.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...Wo.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...Wo.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...Wo.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...Wo.errToObj(t)})}nonempty(e){return this.min(1,Wo.errToObj(e))}trim(){return new NL({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new NL({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new NL({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}};kN.create=n=>new kN({checks:[],typeName:va.ZodString,coerce:n?.coerce??!1,...Oc(n)});function Bbt(n,e){const t=(n.toString().split(".")[1]||"").length,i=(e.toString().split(".")[1]||"").length,r=t>i?t:i,o=Number.parseInt(n.toFixed(r).replace(".","")),s=Number.parseInt(e.toFixed(r).replace(".",""));return o%s/10**r}let k7=class USe extends ru{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==co.number){const o=this._getOrReturnCtx(e);return Or(o,{code:zi.invalid_type,expected:co.number,received:o.parsedType}),Js}let i;const r=new Ew;for(const o of this._def.checks)o.kind==="int"?jd.isInteger(e.data)||(i=this._getOrReturnCtx(e,i),Or(i,{code:zi.invalid_type,expected:"integer",received:"float",message:o.message}),r.dirty()):o.kind==="min"?(o.inclusive?e.data<o.value:e.data<=o.value)&&(i=this._getOrReturnCtx(e,i),Or(i,{code:zi.too_small,minimum:o.value,type:"number",inclusive:o.inclusive,exact:!1,message:o.message}),r.dirty()):o.kind==="max"?(o.inclusive?e.data>o.value:e.data>=o.value)&&(i=this._getOrReturnCtx(e,i),Or(i,{code:zi.too_big,maximum:o.value,type:"number",inclusive:o.inclusive,exact:!1,message:o.message}),r.dirty()):o.kind==="multipleOf"?Bbt(e.data,o.value)!==0&&(i=this._getOrReturnCtx(e,i),Or(i,{code:zi.not_multiple_of,multipleOf:o.value,message:o.message}),r.dirty()):o.kind==="finite"?Number.isFinite(e.data)||(i=this._getOrReturnCtx(e,i),Or(i,{code:zi.not_finite,message:o.message}),r.dirty()):jd.assertNever(o);return{status:r.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,Wo.toString(t))}gt(e,t){return this.setLimit("min",e,!1,Wo.toString(t))}lte(e,t){return this.setLimit("max",e,!0,Wo.toString(t))}lt(e,t){return this.setLimit("max",e,!1,Wo.toString(t))}setLimit(e,t,i,r){return new USe({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:i,message:Wo.toString(r)}]})}_addCheck(e){return new USe({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:Wo.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:Wo.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:Wo.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:Wo.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:Wo.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:Wo.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:Wo.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:Wo.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:Wo.toString(e)})}get minValue(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&jd.isInteger(e.value))}get isFinite(){let e=null,t=null;for(const i of this._def.checks){if(i.kind==="finite"||i.kind==="int"||i.kind==="multipleOf")return!0;i.kind==="min"?(t===null||i.value>t)&&(t=i.value):i.kind==="max"&&(e===null||i.value<e)&&(e=i.value)}return Number.isFinite(t)&&Number.isFinite(e)}};k7.create=n=>new k7({checks:[],typeName:va.ZodNumber,coerce:n?.coerce||!1,...Oc(n)});let O7=class jSe extends ru{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==co.bigint)return this._getInvalidInput(e);let i;const r=new Ew;for(const o of this._def.checks)o.kind==="min"?(o.inclusive?e.data<o.value:e.data<=o.value)&&(i=this._getOrReturnCtx(e,i),Or(i,{code:zi.too_small,type:"bigint",minimum:o.value,inclusive:o.inclusive,message:o.message}),r.dirty()):o.kind==="max"?(o.inclusive?e.data>o.value:e.data>=o.value)&&(i=this._getOrReturnCtx(e,i),Or(i,{code:zi.too_big,type:"bigint",maximum:o.value,inclusive:o.inclusive,message:o.message}),r.dirty()):o.kind==="multipleOf"?e.data%o.value!==BigInt(0)&&(i=this._getOrReturnCtx(e,i),Or(i,{code:zi.not_multiple_of,multipleOf:o.value,message:o.message}),r.dirty()):jd.assertNever(o);return{status:r.value,value:e.data}}_getInvalidInput(e){const t=this._getOrReturnCtx(e);return Or(t,{code:zi.invalid_type,expected:co.bigint,received:t.parsedType}),Js}gte(e,t){return this.setLimit("min",e,!0,Wo.toString(t))}gt(e,t){return this.setLimit("min",e,!1,Wo.toString(t))}lte(e,t){return this.setLimit("max",e,!0,Wo.toString(t))}lt(e,t){return this.setLimit("max",e,!1,Wo.toString(t))}setLimit(e,t,i,r){return new jSe({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:i,message:Wo.toString(r)}]})}_addCheck(e){return new jSe({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:Wo.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:Wo.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:Wo.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:Wo.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:Wo.toString(t)})}get minValue(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}};O7.create=n=>new O7({checks:[],typeName:va.ZodBigInt,coerce:n?.coerce??!1,...Oc(n)});let L7=class extends ru{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==co.boolean){const i=this._getOrReturnCtx(e);return Or(i,{code:zi.invalid_type,expected:co.boolean,received:i.parsedType}),Js}return Bv(e.data)}};L7.create=n=>new L7({typeName:va.ZodBoolean,coerce:n?.coerce||!1,...Oc(n)});let D7=class z0t extends ru{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==co.date){const o=this._getOrReturnCtx(e);return Or(o,{code:zi.invalid_type,expected:co.date,received:o.parsedType}),Js}if(Number.isNaN(e.data.getTime())){const o=this._getOrReturnCtx(e);return Or(o,{code:zi.invalid_date}),Js}const i=new Ew;let r;for(const o of this._def.checks)o.kind==="min"?e.data.getTime()<o.value&&(r=this._getOrReturnCtx(e,r),Or(r,{code:zi.too_small,message:o.message,inclusive:!0,exact:!1,minimum:o.value,type:"date"}),i.dirty()):o.kind==="max"?e.data.getTime()>o.value&&(r=this._getOrReturnCtx(e,r),Or(r,{code:zi.too_big,message:o.message,inclusive:!0,exact:!1,maximum:o.value,type:"date"}),i.dirty()):jd.assertNever(o);return{status:i.value,value:new Date(e.data.getTime())}}_addCheck(e){return new z0t({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:Wo.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:Wo.toString(t)})}get minDate(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e!=null?new Date(e):null}};D7.create=n=>new D7({checks:[],coerce:n?.coerce||!1,typeName:va.ZodDate,...Oc(n)});let F3e=class extends ru{_parse(e){if(this._getType(e)!==co.symbol){const i=this._getOrReturnCtx(e);return Or(i,{code:zi.invalid_type,expected:co.symbol,received:i.parsedType}),Js}return Bv(e.data)}};F3e.create=n=>new F3e({typeName:va.ZodSymbol,...Oc(n)});let MK=class extends ru{_parse(e){if(this._getType(e)!==co.undefined){const i=this._getOrReturnCtx(e);return Or(i,{code:zi.invalid_type,expected:co.undefined,received:i.parsedType}),Js}return Bv(e.data)}};MK.create=n=>new MK({typeName:va.ZodUndefined,...Oc(n)});let z7=class extends ru{_parse(e){if(this._getType(e)!==co.null){const i=this._getOrReturnCtx(e);return Or(i,{code:zi.invalid_type,expected:co.null,received:i.parsedType}),Js}return Bv(e.data)}};z7.create=n=>new z7({typeName:va.ZodNull,...Oc(n)});let ON=class extends ru{constructor(){super(...arguments),this._any=!0}_parse(e){return Bv(e.data)}};ON.create=n=>new ON({typeName:va.ZodAny,...Oc(n)});let BC=class extends ru{constructor(){super(...arguments),this._unknown=!0}_parse(e){return Bv(e.data)}};BC.create=n=>new BC({typeName:va.ZodUnknown,...Oc(n)});let h3=class extends ru{_parse(e){const t=this._getOrReturnCtx(e);return Or(t,{code:zi.invalid_type,expected:co.never,received:t.parsedType}),Js}};h3.create=n=>new h3({typeName:va.ZodNever,...Oc(n)});let B3e=class extends ru{_parse(e){if(this._getType(e)!==co.undefined){const i=this._getOrReturnCtx(e);return Or(i,{code:zi.invalid_type,expected:co.void,received:i.parsedType}),Js}return Bv(e.data)}};B3e.create=n=>new B3e({typeName:va.ZodVoid,...Oc(n)});let UC=class BW extends ru{_parse(e){const{ctx:t,status:i}=this._processInputParams(e),r=this._def;if(t.parsedType!==co.array)return Or(t,{code:zi.invalid_type,expected:co.array,received:t.parsedType}),Js;if(r.exactLength!==null){const s=t.data.length>r.exactLength.value,a=t.data.length<r.exactLength.value;(s||a)&&(Or(t,{code:s?zi.too_big:zi.too_small,minimum:a?r.exactLength.value:void 0,maximum:s?r.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:r.exactLength.message}),i.dirty())}if(r.minLength!==null&&t.data.length<r.minLength.value&&(Or(t,{code:zi.too_small,minimum:r.minLength.value,type:"array",inclusive:!0,exact:!1,message:r.minLength.message}),i.dirty()),r.maxLength!==null&&t.data.length>r.maxLength.value&&(Or(t,{code:zi.too_big,maximum:r.maxLength.value,type:"array",inclusive:!0,exact:!1,message:r.maxLength.message}),i.dirty()),t.common.async)return Promise.all([...t.data].map((s,a)=>r.type._parseAsync(new aE(t,s,t.path,a)))).then(s=>Ew.mergeArray(i,s));const o=[...t.data].map((s,a)=>r.type._parseSync(new aE(t,s,t.path,a)));return Ew.mergeArray(i,o)}get element(){return this._def.type}min(e,t){return new BW({...this._def,minLength:{value:e,message:Wo.toString(t)}})}max(e,t){return new BW({...this._def,maxLength:{value:e,message:Wo.toString(t)}})}length(e,t){return new BW({...this._def,exactLength:{value:e,message:Wo.toString(t)}})}nonempty(e){return this.min(1,e)}};UC.create=(n,e)=>new UC({type:n,minLength:null,maxLength:null,exactLength:null,typeName:va.ZodArray,...Oc(e)});function jC(n){if(n instanceof I5){const e={};for(const t in n.shape){const i=n.shape[t];e[t]=k5.create(jC(i))}return new I5({...n._def,shape:()=>e})}else return n instanceof UC?new UC({...n._def,type:jC(n.element)}):n instanceof k5?k5.create(jC(n.unwrap())):n instanceof gA?gA.create(jC(n.unwrap())):n instanceof yA?yA.create(n.items.map(e=>jC(e))):n}let I5=class WS extends ru{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const e=this._def.shape(),t=jd.objectKeys(e);return this._cached={shape:e,keys:t},this._cached}_parse(e){if(this._getType(e)!==co.object){const l=this._getOrReturnCtx(e);return Or(l,{code:zi.invalid_type,expected:co.object,received:l.parsedType}),Js}const{status:i,ctx:r}=this._processInputParams(e),{shape:o,keys:s}=this._getCached(),a=[];if(!(this._def.catchall instanceof h3&&this._def.unknownKeys==="strip"))for(const l in r.data)s.includes(l)||a.push(l);const c=[];for(const l of s){const u=o[l],d=r.data[l];c.push({key:{status:"valid",value:l},value:u._parse(new aE(r,d,r.path,l)),alwaysSet:l in r.data})}if(this._def.catchall instanceof h3){const l=this._def.unknownKeys;if(l==="passthrough")for(const u of a)c.push({key:{status:"valid",value:u},value:{status:"valid",value:r.data[u]}});else if(l==="strict")a.length>0&&(Or(r,{code:zi.unrecognized_keys,keys:a}),i.dirty());else if(l!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const l=this._def.catchall;for(const u of a){const d=r.data[u];c.push({key:{status:"valid",value:u},value:l._parse(new aE(r,d,r.path,u)),alwaysSet:u in r.data})}}return r.common.async?Promise.resolve().then(async()=>{const l=[];for(const u of c){const d=await u.key,h=await u.value;l.push({key:d,value:h,alwaysSet:u.alwaysSet})}return l}).then(l=>Ew.mergeObjectSync(i,l)):Ew.mergeObjectSync(i,c)}get shape(){return this._def.shape()}strict(e){return Wo.errToObj,new WS({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(t,i)=>{const r=this._def.errorMap?.(t,i).message??i.defaultError;return t.code==="unrecognized_keys"?{message:Wo.errToObj(e).message??r}:{message:r}}}:{}})}strip(){return new WS({...this._def,unknownKeys:"strip"})}passthrough(){return new WS({...this._def,unknownKeys:"passthrough"})}extend(e){return new WS({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new WS({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:va.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new WS({...this._def,catchall:e})}pick(e){const t={};for(const i of jd.objectKeys(e))e[i]&&this.shape[i]&&(t[i]=this.shape[i]);return new WS({...this._def,shape:()=>t})}omit(e){const t={};for(const i of jd.objectKeys(this.shape))e[i]||(t[i]=this.shape[i]);return new WS({...this._def,shape:()=>t})}deepPartial(){return jC(this)}partial(e){const t={};for(const i of jd.objectKeys(this.shape)){const r=this.shape[i];e&&!e[i]?t[i]=r:t[i]=r.optional()}return new WS({...this._def,shape:()=>t})}required(e){const t={};for(const i of jd.objectKeys(this.shape))if(e&&!e[i])t[i]=this.shape[i];else{let o=this.shape[i];for(;o instanceof k5;)o=o._def.innerType;t[i]=o}return new WS({...this._def,shape:()=>t})}keyof(){return H3e(jd.objectKeys(this.shape))}};I5.create=(n,e)=>new I5({shape:()=>n,unknownKeys:"strip",catchall:h3.create(),typeName:va.ZodObject,...Oc(e)}),I5.strictCreate=(n,e)=>new I5({shape:()=>n,unknownKeys:"strict",catchall:h3.create(),typeName:va.ZodObject,...Oc(e)}),I5.lazycreate=(n,e)=>new I5({shape:n,unknownKeys:"strip",catchall:h3.create(),typeName:va.ZodObject,...Oc(e)});let $7=class extends ru{_parse(e){const{ctx:t}=this._processInputParams(e),i=this._def.options;function r(o){for(const a of o)if(a.result.status==="valid")return a.result;for(const a of o)if(a.result.status==="dirty")return t.common.issues.push(...a.ctx.common.issues),a.result;const s=o.map(a=>new sE(a.ctx.common.issues));return Or(t,{code:zi.invalid_union,unionErrors:s}),Js}if(t.common.async)return Promise.all(i.map(async o=>{const s={...t,common:{...t.common,issues:[]},parent:null};return{result:await o._parseAsync({data:t.data,path:t.path,parent:s}),ctx:s}})).then(r);{let o;const s=[];for(const c of i){const l={...t,common:{...t.common,issues:[]},parent:null},u=c._parseSync({data:t.data,path:t.path,parent:l});if(u.status==="valid")return u;u.status==="dirty"&&!o&&(o={result:u,ctx:l}),l.common.issues.length&&s.push(l.common.issues)}if(o)return t.common.issues.push(...o.ctx.common.issues),o.result;const a=s.map(c=>new sE(c));return Or(t,{code:zi.invalid_union,unionErrors:a}),Js}}get options(){return this._def.options}};$7.create=(n,e)=>new $7({options:n,typeName:va.ZodUnion,...Oc(e)});const N5=n=>n instanceof CK?N5(n.schema):n instanceof p3?N5(n.innerType()):n instanceof B7?[n.value]:n instanceof U7?n.options:n instanceof RK?jd.objectValues(n.enum):n instanceof j7?N5(n._def.innerType):n instanceof MK?[void 0]:n instanceof z7?[null]:n instanceof k5?[void 0,...N5(n.unwrap())]:n instanceof gA?[null,...N5(n.unwrap())]:n instanceof G3e||n instanceof V7?N5(n.unwrap()):n instanceof H7?N5(n._def.innerType):[];let Ubt=class $0t extends ru{_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==co.object)return Or(t,{code:zi.invalid_type,expected:co.object,received:t.parsedType}),Js;const i=this.discriminator,r=t.data[i],o=this.optionsMap.get(r);return o?t.common.async?o._parseAsync({data:t.data,path:t.path,parent:t}):o._parseSync({data:t.data,path:t.path,parent:t}):(Or(t,{code:zi.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[i]}),Js)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,i){const r=new Map;for(const o of t){const s=N5(o.shape[e]);if(!s.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(const a of s){if(r.has(a))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(a)}`);r.set(a,o)}}return new $0t({typeName:va.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:r,...Oc(i)})}};function AK(n,e){const t=d3(n),i=d3(e);if(n===e)return{valid:!0,data:n};if(t===co.object&&i===co.object){const r=jd.objectKeys(e),o=jd.objectKeys(n).filter(a=>r.indexOf(a)!==-1),s={...n,...e};for(const a of o){const c=AK(n[a],e[a]);if(!c.valid)return{valid:!1};s[a]=c.data}return{valid:!0,data:s}}else if(t===co.array&&i===co.array){if(n.length!==e.length)return{valid:!1};const r=[];for(let o=0;o<n.length;o++){const s=n[o],a=e[o],c=AK(s,a);if(!c.valid)return{valid:!1};r.push(c.data)}return{valid:!0,data:r}}else return t===co.date&&i===co.date&&+n==+e?{valid:!0,data:n}:{valid:!1}}let F7=class extends ru{_parse(e){const{status:t,ctx:i}=this._processInputParams(e),r=(o,s)=>{if(O3e(o)||O3e(s))return Js;const a=AK(o.value,s.value);return a.valid?((L3e(o)||L3e(s))&&t.dirty(),{status:t.value,value:a.data}):(Or(i,{code:zi.invalid_intersection_types}),Js)};return i.common.async?Promise.all([this._def.left._parseAsync({data:i.data,path:i.path,parent:i}),this._def.right._parseAsync({data:i.data,path:i.path,parent:i})]).then(([o,s])=>r(o,s)):r(this._def.left._parseSync({data:i.data,path:i.path,parent:i}),this._def.right._parseSync({data:i.data,path:i.path,parent:i}))}};F7.create=(n,e,t)=>new F7({left:n,right:e,typeName:va.ZodIntersection,...Oc(t)});let yA=class F0t extends ru{_parse(e){const{status:t,ctx:i}=this._processInputParams(e);if(i.parsedType!==co.array)return Or(i,{code:zi.invalid_type,expected:co.array,received:i.parsedType}),Js;if(i.data.length<this._def.items.length)return Or(i,{code:zi.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),Js;!this._def.rest&&i.data.length>this._def.items.length&&(Or(i,{code:zi.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());const o=[...i.data].map((s,a)=>{const c=this._def.items[a]||this._def.rest;return c?c._parse(new aE(i,s,i.path,a)):null}).filter(s=>!!s);return i.common.async?Promise.all(o).then(s=>Ew.mergeArray(t,s)):Ew.mergeArray(t,o)}get items(){return this._def.items}rest(e){return new F0t({...this._def,rest:e})}};yA.create=(n,e)=>{if(!Array.isArray(n))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new yA({items:n,typeName:va.ZodTuple,rest:null,...Oc(e)})};let jbt=class HSe extends ru{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:i}=this._processInputParams(e);if(i.parsedType!==co.object)return Or(i,{code:zi.invalid_type,expected:co.object,received:i.parsedType}),Js;const r=[],o=this._def.keyType,s=this._def.valueType;for(const a in i.data)r.push({key:o._parse(new aE(i,a,i.path,a)),value:s._parse(new aE(i,i.data[a],i.path,a)),alwaysSet:a in i.data});return i.common.async?Ew.mergeObjectAsync(t,r):Ew.mergeObjectSync(t,r)}get element(){return this._def.valueType}static create(e,t,i){return t instanceof ru?new HSe({keyType:e,valueType:t,typeName:va.ZodRecord,...Oc(i)}):new HSe({keyType:kN.create(),valueType:e,typeName:va.ZodRecord,...Oc(t)})}},U3e=class extends ru{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:i}=this._processInputParams(e);if(i.parsedType!==co.map)return Or(i,{code:zi.invalid_type,expected:co.map,received:i.parsedType}),Js;const r=this._def.keyType,o=this._def.valueType,s=[...i.data.entries()].map(([a,c],l)=>({key:r._parse(new aE(i,a,i.path,[l,"key"])),value:o._parse(new aE(i,c,i.path,[l,"value"]))}));if(i.common.async){const a=new Map;return Promise.resolve().then(async()=>{for(const c of s){const l=await c.key,u=await c.value;if(l.status==="aborted"||u.status==="aborted")return Js;(l.status==="dirty"||u.status==="dirty")&&t.dirty(),a.set(l.value,u.value)}return{status:t.value,value:a}})}else{const a=new Map;for(const c of s){const l=c.key,u=c.value;if(l.status==="aborted"||u.status==="aborted")return Js;(l.status==="dirty"||u.status==="dirty")&&t.dirty(),a.set(l.value,u.value)}return{status:t.value,value:a}}}};U3e.create=(n,e,t)=>new U3e({valueType:e,keyType:n,typeName:va.ZodMap,...Oc(t)});let j3e=class VSe extends ru{_parse(e){const{status:t,ctx:i}=this._processInputParams(e);if(i.parsedType!==co.set)return Or(i,{code:zi.invalid_type,expected:co.set,received:i.parsedType}),Js;const r=this._def;r.minSize!==null&&i.data.size<r.minSize.value&&(Or(i,{code:zi.too_small,minimum:r.minSize.value,type:"set",inclusive:!0,exact:!1,message:r.minSize.message}),t.dirty()),r.maxSize!==null&&i.data.size>r.maxSize.value&&(Or(i,{code:zi.too_big,maximum:r.maxSize.value,type:"set",inclusive:!0,exact:!1,message:r.maxSize.message}),t.dirty());const o=this._def.valueType;function s(c){const l=new Set;for(const u of c){if(u.status==="aborted")return Js;u.status==="dirty"&&t.dirty(),l.add(u.value)}return{status:t.value,value:l}}const a=[...i.data.values()].map((c,l)=>o._parse(new aE(i,c,i.path,l)));return i.common.async?Promise.all(a).then(c=>s(c)):s(a)}min(e,t){return new VSe({...this._def,minSize:{value:e,message:Wo.toString(t)}})}max(e,t){return new VSe({...this._def,maxSize:{value:e,message:Wo.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}};j3e.create=(n,e)=>new j3e({valueType:n,minSize:null,maxSize:null,typeName:va.ZodSet,...Oc(e)});let Hbt=class UW extends ru{constructor(){super(...arguments),this.validate=this.implement}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==co.function)return Or(t,{code:zi.invalid_type,expected:co.function,received:t.parsedType}),Js;function i(a,c){return EK({data:a,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,SK(),IN].filter(l=>!!l),issueData:{code:zi.invalid_arguments,argumentsError:c}})}function r(a,c){return EK({data:a,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,SK(),IN].filter(l=>!!l),issueData:{code:zi.invalid_return_type,returnTypeError:c}})}const o={errorMap:t.common.contextualErrorMap},s=t.data;if(this._def.returns instanceof LN){const a=this;return Bv(async function(...c){const l=new sE([]),u=await a._def.args.parseAsync(c,o).catch(f=>{throw l.addIssue(i(c,f)),l}),d=await Reflect.apply(s,this,u);return await a._def.returns._def.type.parseAsync(d,o).catch(f=>{throw l.addIssue(r(d,f)),l})})}else{const a=this;return Bv(function(...c){const l=a._def.args.safeParse(c,o);if(!l.success)throw new sE([i(c,l.error)]);const u=Reflect.apply(s,this,l.data),d=a._def.returns.safeParse(u,o);if(!d.success)throw new sE([r(u,d.error)]);return d.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new UW({...this._def,args:yA.create(e).rest(BC.create())})}returns(e){return new UW({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,i){return new UW({args:e||yA.create([]).rest(BC.create()),returns:t||BC.create(),typeName:va.ZodFunction,...Oc(i)})}},CK=class extends ru{get schema(){return this._def.getter()}_parse(e){const{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}};CK.create=(n,e)=>new CK({getter:n,typeName:va.ZodLazy,...Oc(e)});let B7=class extends ru{_parse(e){if(e.data!==this._def.value){const t=this._getOrReturnCtx(e);return Or(t,{received:t.data,code:zi.invalid_literal,expected:this._def.value}),Js}return{status:"valid",value:e.data}}get value(){return this._def.value}};B7.create=(n,e)=>new B7({value:n,typeName:va.ZodLiteral,...Oc(e)});function H3e(n,e){return new U7({values:n,typeName:va.ZodEnum,...Oc(e)})}let U7=class GSe extends ru{_parse(e){if(typeof e.data!="string"){const t=this._getOrReturnCtx(e),i=this._def.values;return Or(t,{expected:jd.joinValues(i),received:t.parsedType,code:zi.invalid_type}),Js}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){const t=this._getOrReturnCtx(e),i=this._def.values;return Or(t,{received:t.data,code:zi.invalid_enum_value,options:i}),Js}return Bv(e.data)}get options(){return this._def.values}get enum(){const e={};for(const t of this._def.values)e[t]=t;return e}get Values(){const e={};for(const t of this._def.values)e[t]=t;return e}get Enum(){const e={};for(const t of this._def.values)e[t]=t;return e}extract(e,t=this._def){return GSe.create(e,{...this._def,...t})}exclude(e,t=this._def){return GSe.create(this.options.filter(i=>!e.includes(i)),{...this._def,...t})}};U7.create=H3e;let RK=class extends ru{_parse(e){const t=jd.getValidEnumValues(this._def.values),i=this._getOrReturnCtx(e);if(i.parsedType!==co.string&&i.parsedType!==co.number){const r=jd.objectValues(t);return Or(i,{expected:jd.joinValues(r),received:i.parsedType,code:zi.invalid_type}),Js}if(this._cache||(this._cache=new Set(jd.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){const r=jd.objectValues(t);return Or(i,{received:i.data,code:zi.invalid_enum_value,options:r}),Js}return Bv(e.data)}get enum(){return this._def.values}};RK.create=(n,e)=>new RK({values:n,typeName:va.ZodNativeEnum,...Oc(e)});let LN=class extends ru{unwrap(){return this._def.type}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==co.promise&&t.common.async===!1)return Or(t,{code:zi.invalid_type,expected:co.promise,received:t.parsedType}),Js;const i=t.parsedType===co.promise?t.data:Promise.resolve(t.data);return Bv(i.then(r=>this._def.type.parseAsync(r,{path:t.path,errorMap:t.common.contextualErrorMap})))}};LN.create=(n,e)=>new LN({type:n,typeName:va.ZodPromise,...Oc(e)});let p3=class extends ru{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===va.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:t,ctx:i}=this._processInputParams(e),r=this._def.effect||null,o={addIssue:s=>{Or(i,s),s.fatal?t.abort():t.dirty()},get path(){return i.path}};if(o.addIssue=o.addIssue.bind(o),r.type==="preprocess"){const s=r.transform(i.data,o);if(i.common.async)return Promise.resolve(s).then(async a=>{if(t.value==="aborted")return Js;const c=await this._def.schema._parseAsync({data:a,path:i.path,parent:i});return c.status==="aborted"?Js:c.status==="dirty"||t.value==="dirty"?NN(c.value):c});{if(t.value==="aborted")return Js;const a=this._def.schema._parseSync({data:s,path:i.path,parent:i});return a.status==="aborted"?Js:a.status==="dirty"||t.value==="dirty"?NN(a.value):a}}if(r.type==="refinement"){const s=a=>{const c=r.refinement(a,o);if(i.common.async)return Promise.resolve(c);if(c instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return a};if(i.common.async===!1){const a=this._def.schema._parseSync({data:i.data,path:i.path,parent:i});return a.status==="aborted"?Js:(a.status==="dirty"&&t.dirty(),s(a.value),{status:t.value,value:a.value})}else return this._def.schema._parseAsync({data:i.data,path:i.path,parent:i}).then(a=>a.status==="aborted"?Js:(a.status==="dirty"&&t.dirty(),s(a.value).then(()=>({status:t.value,value:a.value}))))}if(r.type==="transform")if(i.common.async===!1){const s=this._def.schema._parseSync({data:i.data,path:i.path,parent:i});if(!FC(s))return Js;const a=r.transform(s.value,o);if(a instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:a}}else return this._def.schema._parseAsync({data:i.data,path:i.path,parent:i}).then(s=>FC(s)?Promise.resolve(r.transform(s.value,o)).then(a=>({status:t.value,value:a})):Js);jd.assertNever(r)}};p3.create=(n,e,t)=>new p3({schema:n,typeName:va.ZodEffects,effect:e,...Oc(t)}),p3.createWithPreprocess=(n,e,t)=>new p3({schema:e,effect:{type:"preprocess",transform:n},typeName:va.ZodEffects,...Oc(t)});let k5=class extends ru{_parse(e){return this._getType(e)===co.undefined?Bv(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};k5.create=(n,e)=>new k5({innerType:n,typeName:va.ZodOptional,...Oc(e)});let gA=class extends ru{_parse(e){return this._getType(e)===co.null?Bv(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};gA.create=(n,e)=>new gA({innerType:n,typeName:va.ZodNullable,...Oc(e)});let j7=class extends ru{_parse(e){const{ctx:t}=this._processInputParams(e);let i=t.data;return t.parsedType===co.undefined&&(i=this._def.defaultValue()),this._def.innerType._parse({data:i,path:t.path,parent:t})}removeDefault(){return this._def.innerType}};j7.create=(n,e)=>new j7({innerType:n,typeName:va.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...Oc(e)});let H7=class extends ru{_parse(e){const{ctx:t}=this._processInputParams(e),i={...t,common:{...t.common,issues:[]}},r=this._def.innerType._parse({data:i.data,path:i.path,parent:{...i}});return N7(r)?r.then(o=>({status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new sE(i.common.issues)},input:i.data})})):{status:"valid",value:r.status==="valid"?r.value:this._def.catchValue({get error(){return new sE(i.common.issues)},input:i.data})}}removeCatch(){return this._def.innerType}};H7.create=(n,e)=>new H7({innerType:n,typeName:va.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...Oc(e)});let V3e=class extends ru{_parse(e){if(this._getType(e)!==co.nan){const i=this._getOrReturnCtx(e);return Or(i,{code:zi.invalid_type,expected:co.nan,received:i.parsedType}),Js}return{status:"valid",value:e.data}}};V3e.create=n=>new V3e({typeName:va.ZodNaN,...Oc(n)});let G3e=class extends ru{_parse(e){const{ctx:t}=this._processInputParams(e),i=t.data;return this._def.type._parse({data:i,path:t.path,parent:t})}unwrap(){return this._def.type}},Vbt=class B0t extends ru{_parse(e){const{status:t,ctx:i}=this._processInputParams(e);if(i.common.async)return(async()=>{const o=await this._def.in._parseAsync({data:i.data,path:i.path,parent:i});return o.status==="aborted"?Js:o.status==="dirty"?(t.dirty(),NN(o.value)):this._def.out._parseAsync({data:o.value,path:i.path,parent:i})})();{const r=this._def.in._parseSync({data:i.data,path:i.path,parent:i});return r.status==="aborted"?Js:r.status==="dirty"?(t.dirty(),{status:"dirty",value:r.value}):this._def.out._parseSync({data:r.value,path:i.path,parent:i})}}static create(e,t){return new B0t({in:e,out:t,typeName:va.ZodPipeline})}},V7=class extends ru{_parse(e){const t=this._def.innerType._parse(e),i=r=>(FC(r)&&(r.value=Object.freeze(r.value)),r);return N7(t)?t.then(r=>i(r)):i(t)}unwrap(){return this._def.innerType}};V7.create=(n,e)=>new V7({innerType:n,typeName:va.ZodReadonly,...Oc(e)});function Y3e(n,e){const t=typeof n=="function"?n(e):typeof n=="string"?{message:n}:n;return typeof t=="string"?{message:t}:t}function uy(n,e={},t){return n?ON.create().superRefine((i,r)=>{const o=n(i);if(o instanceof Promise)return o.then(s=>{if(!s){const a=Y3e(e,i),c=a.fatal??t??!0;r.addIssue({code:"custom",...a,fatal:c})}});if(!o){const s=Y3e(e,i),a=s.fatal??t??!0;r.addIssue({code:"custom",...s,fatal:a})}}):ON.create()}var va;(function(n){n.ZodString="ZodString",n.ZodNumber="ZodNumber",n.ZodNaN="ZodNaN",n.ZodBigInt="ZodBigInt",n.ZodBoolean="ZodBoolean",n.ZodDate="ZodDate",n.ZodSymbol="ZodSymbol",n.ZodUndefined="ZodUndefined",n.ZodNull="ZodNull",n.ZodAny="ZodAny",n.ZodUnknown="ZodUnknown",n.ZodNever="ZodNever",n.ZodVoid="ZodVoid",n.ZodArray="ZodArray",n.ZodObject="ZodObject",n.ZodUnion="ZodUnion",n.ZodDiscriminatedUnion="ZodDiscriminatedUnion",n.ZodIntersection="ZodIntersection",n.ZodTuple="ZodTuple",n.ZodRecord="ZodRecord",n.ZodMap="ZodMap",n.ZodSet="ZodSet",n.ZodFunction="ZodFunction",n.ZodLazy="ZodLazy",n.ZodLiteral="ZodLiteral",n.ZodEnum="ZodEnum",n.ZodEffects="ZodEffects",n.ZodNativeEnum="ZodNativeEnum",n.ZodOptional="ZodOptional",n.ZodNullable="ZodNullable",n.ZodDefault="ZodDefault",n.ZodCatch="ZodCatch",n.ZodPromise="ZodPromise",n.ZodBranded="ZodBranded",n.ZodPipeline="ZodPipeline",n.ZodReadonly="ZodReadonly"})(va||(va={}));const $=kN.create,$e=k7.create;O7.create;const mt=L7.create;D7.create;const PK=z7.create,hd=ON.create,q3e=BC.create;h3.create;const At=UC.create,Ie=I5.create,Jn=$7.create,A_=Ubt.create;F7.create,yA.create;const Os=jbt.create,IK=Hbt.create,Ee=B7.create,dn=U7.create,NK=LN.create;k5.create,gA.create;const X3e=p3.createWithPreprocess,W3e={string:(n=>kN.create({...n,coerce:!0})),number:(n=>k7.create({...n,coerce:!0})),boolean:(n=>L7.create({...n,coerce:!0})),bigint:(n=>O7.create({...n,coerce:!0})),date:(n=>D7.create({...n,coerce:!0}))};var Z3e={Hz:{baseUnit:"Hz",variants:{MHz:1e6,kHz:1e3,Hz:1}},g:{baseUnit:"g",variants:{kg:1e3,g:1}},Ω:{baseUnit:"Ω",variants:{mΩ:.001,Ω:1,kΩ:1e3,KΩ:1e3,kohm:1e3,MΩ:1e6,GΩ:1e9,TΩ:1e12}},V:{baseUnit:"V",variants:{mV:.001,V:1,kV:1e3,KV:1e3,MV:1e6,GV:1e9,TV:1e12}},A:{baseUnit:"A",variants:{µA:1e-6,mA:.001,ma:.001,A:1,kA:1e3,MA:1e6}},F:{baseUnit:"F",variants:{pF:1e-12,nF:1e-9,µF:1e-6,uF:1e-6,mF:.001,F:1}},ml:{baseUnit:"ml",variants:{ml:1,mL:1,l:1e3,L:1e3}},deg:{baseUnit:"deg",variants:{rad:180/Math.PI}},ms:{baseUnit:"ms",variants:{s:1e3}},mm:{baseUnit:"mm",variants:{nm:1e-6,µm:.001,um:.001,mm:1,cm:10,dm:100,m:1e3,km:1e6,in:25.4,ft:304.8,IN:25.4,FT:304.8,yd:914.4,mi:1609344,mil:.0254}}},kK=new Set;for(const[n,e]of Object.entries(Z3e)){kK.add(n);for(const t of Object.keys(e.variants))kK.add(t)}function Gbt(n){for(const[e,t]of Object.entries(Z3e))if(n in t.variants)return{baseUnit:t.baseUnit,conversionFactor:t.variants[n]};return{baseUnit:n,conversionFactor:1}}var K3e={tera:1e12,T:1e12,giga:1e9,G:1e9,mega:1e6,M:1e6,kilo:1e3,k:1e3,deci:.1,d:.1,centi:.01,c:.01,milli:.001,m:.001,micro:1e-6,u:1e-6,µ:1e-6,nano:1e-9,n:1e-9,pico:1e-12,p:1e-12},nS=n=>{if(typeof n>"u")return{parsedUnit:null,unitOfValue:null,value:null};if(typeof n=="string"&&n.match(/^-?[\d\.]+$/))return{value:Number.parseFloat(n),parsedUnit:null,unitOfValue:null};if(typeof n=="number")return{value:n,parsedUnit:null,unitOfValue:null};if(typeof n=="object"&&"x"in n&&"y"in n){const{parsedUnit:a,unitOfValue:c}=nS(n.x);return{parsedUnit:a,unitOfValue:c,value:{x:nS(n.x).value,y:nS(n.y).value}}}const t=n.toString().split("").reverse().join("").match(/[^\d\s]+/)?.[0];if(!t)throw new Error(`Could not determine unit: "${n}"`);const i=t.split("").reverse().join(""),r=n.slice(0,-i.length);if(i in K3e&&!kK.has(i)){const a=K3e[i];return{parsedUnit:null,unitOfValue:null,value:Number.parseFloat(r)*a}}const{baseUnit:o,conversionFactor:s}=Gbt(i);return{parsedUnit:i,unitOfValue:o,value:s*Number.parseFloat(r)}},HC=$().or($e()).transform(n=>nS(n).value),VC=$().or($e()).transform(n=>nS(n).value).transform(n=>Number.parseFloat(n.toPrecision(12))),OK=$().or($e()).transform(n=>nS(n).value),Uv=$().or($e()).transform(n=>nS(n).value),at=$().or($e()).transform(n=>nS(n).value),bA=$().or($e()).transform(n=>nS(n).value),$t=at,Ybt=$().or($e()).transform(n=>nS(n).value),qbt=$().or($e()).transform(n=>nS(n).value),um=$().or($e()).transform(n=>typeof n=="number"?n:n.endsWith("deg")?Number.parseFloat(n.split("deg")[0]):n.endsWith("rad")?Number.parseFloat(n.split("rad")[0])*180/Math.PI:Number.parseFloat(n)),Q3e=$e().or($().endsWith("mAh")).transform(n=>{if(typeof n=="string"){const e=n.replace("mAh",""),t=Number.parseFloat(e);if(Number.isNaN(t))throw new Error("Invalid capacity");return t}return n}).describe("Battery capacity in mAh"),wa=Ie({x:$t,y:$t}),Xbt=wa,GC=Ie({x:$t,y:$t,z:$t}),Wbt=GC,LK=Ie({width:$e(),height:$e()}),Zbt=n=>{const e="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";return Array.from({length:n},()=>e[Math.floor(Math.random()*e.length)]).join("")},qr=n=>$().optional().default(()=>`${n}_${Zbt(10)}`),G7=dn(["top_left","top_center","top_right","center_left","center","center_right","bottom_left","bottom_center","bottom_right"]),Y7=dn(["jlcpcb","macrofab","pcbway","digikey","mouser","lcsc"]),kg=Ie({type:Ee("source_component"),ftype:$().optional(),source_component_id:$(),name:$(),manufacturer_part_number:$().optional(),supplier_part_numbers:Os(Y7,At($())).optional(),display_value:$().optional(),are_pins_interchangeable:mt().optional(),internally_connected_source_port_ids:At(At($())).optional(),source_group_id:$().optional(),subcircuit_id:$().optional()}),DK=kg.extend({ftype:Ee("simple_capacitor"),capacitance:VC,max_voltage_rating:Uv.optional(),display_capacitance:$().optional(),max_decoupling_trace_length:$t.optional()}),zK=kg.extend({ftype:Ee("simple_resistor"),resistance:HC,display_resistance:$().optional()}),q7=kg.extend({ftype:Ee("simple_diode")}),$K=q7.extend({ftype:Ee("simple_led"),color:$().optional(),wavelength:$().optional()}),J3e=kg.extend({ftype:Ee("simple_ground")}),FK=kg.extend({ftype:Ee("simple_chip")}),BK=kg.extend({ftype:Ee("simple_power_source"),voltage:Uv}),Kbt=kg.extend({ftype:Ee("simple_fuse"),current_rating_amps:$e().describe("Nominal current in amps the fuse is rated for"),voltage_rating_volts:$e().describe("Voltage rating in volts, e.g. ±5V would be 5")}),UK=kg.extend({ftype:Ee("simple_battery"),capacity:Q3e}),jK=kg.extend({ftype:Ee("simple_inductor"),inductance:OK,max_current_rating:$e().optional()}),HK=kg.extend({ftype:Ee("simple_push_button")}),VK=kg.extend({ftype:Ee("simple_potentiometer"),max_resistance:HC}),eMe=kg.extend({ftype:Ee("simple_crystal"),frequency:$e().describe("Frequency in Hz"),load_capacitance:$e().optional().describe("Load capacitance in pF")}),GK=kg.extend({ftype:Ee("simple_pin_header"),pin_count:$e(),gender:dn(["male","female"]).optional().default("male")}),YK=kg.extend({ftype:Ee("simple_pinout")}),qK=kg.extend({ftype:Ee("simple_resonator"),load_capacitance:VC,equivalent_series_resistance:HC.optional(),frequency:bA}),XK=kg.extend({ftype:Ee("simple_transistor"),transistor_type:dn(["npn","pnp"])}),WK=kg.extend({ftype:Ee("simple_test_point"),footprint_variant:dn(["pad","through_hole"]).optional(),pad_shape:dn(["rect","circle"]).optional(),pad_diameter:Jn([$e(),$()]).optional(),hole_diameter:Jn([$e(),$()]).optional(),width:Jn([$e(),$()]).optional(),height:Jn([$e(),$()]).optional()}),ZK=kg.extend({ftype:Ee("simple_mosfet"),channel_type:dn(["n","p"]),mosfet_mode:dn(["enhancement","depletion"])}),KK=kg.extend({ftype:Ee("simple_switch")}),QK=Ie({type:Ee("source_project_metadata"),name:$().optional(),software_used_string:$().optional(),project_url:$().optional(),created_at:$().datetime().optional()}),tMe=Ie({type:Ee("source_missing_property_error"),source_missing_property_error_id:qr("source_missing_property_error"),source_component_id:$(),property_name:$(),subcircuit_id:$().optional(),error_type:Ee("source_missing_property_error").default("source_missing_property_error"),message:$()}).describe("The source code is missing a property"),nMe=Ie({type:Ee("source_failed_to_create_component_error"),source_failed_to_create_component_error_id:qr("source_failed_to_create_component_error"),error_type:Ee("source_failed_to_create_component_error").default("source_failed_to_create_component_error"),component_name:$().optional(),subcircuit_id:$().optional(),parent_source_component_id:$().optional(),message:$(),pcb_center:Ie({x:$e().optional(),y:$e().optional()}).optional(),schematic_center:Ie({x:$e().optional(),y:$e().optional()}).optional()}).describe("Error emitted when a component fails to be constructed"),JK=Ie({type:Ee("source_trace_not_connected_error"),source_trace_not_connected_error_id:qr("source_trace_not_connected_error"),error_type:Ee("source_trace_not_connected_error").default("source_trace_not_connected_error"),message:$(),subcircuit_id:$().optional(),source_group_id:$().optional(),source_trace_id:$().optional(),connected_source_port_ids:At($()).optional(),selectors_not_found:At($()).optional()}).describe("Occurs when a source trace selector does not match any ports"),iMe=Ie({type:Ee("source_property_ignored_warning"),source_property_ignored_warning_id:qr("source_property_ignored_warning"),source_component_id:$(),property_name:$(),subcircuit_id:$().optional(),error_type:Ee("source_property_ignored_warning").default("source_property_ignored_warning"),message:$()}).describe("The source property was ignored"),eQ=Ie({type:Ee("source_pin_missing_trace_warning"),source_pin_missing_trace_warning_id:qr("source_pin_missing_trace_warning"),warning_type:Ee("source_pin_missing_trace_warning").default("source_pin_missing_trace_warning"),message:$(),source_component_id:$(),source_port_id:$(),subcircuit_id:$().optional()}).describe("Warning emitted when a source component pin is missing a trace connection"),rMe=Jn([zK,DK,q7,$K,J3e,FK,BK,UK,jK,HK,VK,eMe,GK,YK,qK,KK,XK,WK,ZK,Kbt,QK,tMe,nMe,JK,iMe,eQ]),oMe=Ie({type:Ee("source_port"),pin_number:$e().optional(),port_hints:At($()).optional(),name:$(),source_port_id:$(),source_component_id:$(),subcircuit_id:$().optional(),subcircuit_connectivity_map_key:$().optional()}),sMe=Ie({type:Ee("source_trace"),source_trace_id:$(),connected_source_port_ids:At($()),connected_source_net_ids:At($()),subcircuit_id:$().optional(),subcircuit_connectivity_map_key:$().optional(),max_length:$e().optional(),min_trace_thickness:$e().optional(),display_name:$().optional()}),aMe=Ie({type:Ee("source_group"),source_group_id:$(),subcircuit_id:$().optional(),parent_subcircuit_id:$().optional(),parent_source_group_id:$().optional(),is_subcircuit:mt().optional(),show_as_schematic_box:mt().optional(),name:$().optional()}),cMe=Ie({type:Ee("source_net"),source_net_id:$(),name:$(),member_source_group_ids:At($()),is_power:mt().optional(),is_ground:mt().optional(),is_digital_signal:mt().optional(),is_analog_signal:mt().optional(),is_positive_voltage_source:mt().optional(),trace_width:$e().optional(),subcircuit_id:$().optional(),subcircuit_connectivity_map_key:$().optional()}),lMe=Ie({type:Ee("source_pcb_ground_plane"),source_pcb_ground_plane_id:$(),source_group_id:$(),source_net_id:$(),subcircuit_id:$().optional()}).describe("Defines a ground plane in the source domain"),DN=["top","bottom","inner1","inner2","inner3","inner4","inner5","inner6"],tQ=dn(DN),Wc=tQ.or(Ie({name:tQ})).transform(n=>typeof n=="string"?n:n.name),YC=dn(["top","bottom"]),uMe=Ie({type:Ee("source_manually_placed_via"),source_manually_placed_via_id:$(),source_group_id:$(),source_net_id:$(),subcircuit_id:$().optional(),source_trace_id:$().optional()}).describe("Defines a via that is manually placed in the source domain"),dMe=Ie({type:Ee("schematic_box"),schematic_component_id:$().optional(),width:$t,height:$t,is_dashed:mt().default(!1),x:$t,y:$t,subcircuit_id:$().optional()}).describe("Draws a box on the schematic"),hMe=Ie({type:Ee("schematic_path"),schematic_component_id:$(),fill_color:dn(["red","blue"]).optional(),is_filled:mt().optional(),points:At(wa),subcircuit_id:$().optional()}),pMe=Os(Ie({left_margin:at.optional(),right_margin:at.optional(),top_margin:at.optional(),bottom_margin:at.optional()})),fMe=Ie({left_size:$e(),right_size:$e(),top_size:$e().optional(),bottom_size:$e().optional()}),mMe=Ie({left_side:Ie({pins:At($e()),direction:dn(["top-to-bottom","bottom-to-top"]).optional()}).optional(),right_side:Ie({pins:At($e()),direction:dn(["top-to-bottom","bottom-to-top"]).optional()}).optional(),top_side:Ie({pins:At($e()),direction:dn(["left-to-right","right-to-left"]).optional()}).optional(),bottom_side:Ie({pins:At($e()),direction:dn(["left-to-right","right-to-left"]).optional()}).optional()}),_Me=Jn([fMe,mMe]),yMe=Ie({type:Ee("schematic_component"),size:LK,center:wa,source_component_id:$().optional(),schematic_component_id:$(),pin_spacing:at.optional(),pin_styles:pMe.optional(),box_width:at.optional(),symbol_name:$().optional(),port_arrangement:_Me.optional(),port_labels:Os($()).optional(),symbol_display_value:$().optional(),subcircuit_id:$().optional(),schematic_group_id:$().optional(),is_schematic_group:mt().optional(),source_group_id:$().optional(),is_box_with_pins:mt().optional().default(!0)}),gMe=Ie({type:Ee("schematic_line"),schematic_line_id:qr("schematic_line"),schematic_component_id:$(),x1:$t,y1:$t,x2:$t,y2:$t,stroke_width:$t.nullable().optional(),color:$().default("#000000"),is_dashed:mt().default(!1),subcircuit_id:$().optional()}).describe("Draws a styled line on the schematic"),bMe=Ie({type:Ee("schematic_rect"),schematic_rect_id:qr("schematic_rect"),schematic_component_id:$(),center:wa,width:$t,height:$t,rotation:um.default(0),stroke_width:$t.nullable().optional(),color:$().default("#000000"),is_filled:mt().default(!1),fill_color:$().optional(),is_dashed:mt().default(!1),subcircuit_id:$().optional()}).describe("Draws a styled rectangle on the schematic"),xMe=Ie({type:Ee("schematic_circle"),schematic_circle_id:qr("schematic_circle"),schematic_component_id:$(),center:wa,radius:$t,stroke_width:$t.nullable().optional(),color:$().default("#000000"),is_filled:mt().default(!1),fill_color:$().optional(),is_dashed:mt().default(!1),subcircuit_id:$().optional()}).describe("Draws a styled circle on the schematic"),vMe=Ie({type:Ee("schematic_arc"),schematic_arc_id:qr("schematic_arc"),schematic_component_id:$(),center:wa,radius:$t,start_angle_degrees:um,end_angle_degrees:um,direction:dn(["clockwise","counterclockwise"]).default("counterclockwise"),stroke_width:$t.nullable().optional(),color:$().default("#000000"),is_dashed:mt().default(!1),subcircuit_id:$().optional()}).describe("Draws a styled arc on the schematic"),wMe=Ie({type:Ee("schematic_trace"),schematic_trace_id:$(),source_trace_id:$().optional(),junctions:At(Ie({x:$e(),y:$e()})),edges:At(Ie({from:Ie({x:$e(),y:$e()}),to:Ie({x:$e(),y:$e()}),is_crossing:mt().optional(),from_schematic_port_id:$().optional(),to_schematic_port_id:$().optional()})),subcircuit_id:$().optional(),subcircuit_connectivity_map_key:$().optional()}),Qbt=dn(["center","left","right","top","bottom"]),SMe=Ie({type:Ee("schematic_text"),schematic_component_id:$().optional(),schematic_text_id:$(),text:$(),font_size:$e().default(.18),position:Ie({x:$t,y:$t}),rotation:$e().default(0),anchor:Jn([Qbt.describe("legacy"),G7]).default("center"),color:$().default("#000000"),subcircuit_id:$().optional()}),EMe=Ie({type:Ee("schematic_port"),schematic_port_id:$(),source_port_id:$(),schematic_component_id:$().optional(),center:wa,facing_direction:dn(["up","down","left","right"]).optional(),distance_from_component_edge:$e().optional(),side_of_component:dn(["top","bottom","left","right"]).optional(),true_ccw_index:$e().optional(),pin_number:$e().optional(),display_pin_label:$().optional(),subcircuit_id:$().optional(),is_connected:mt().optional(),has_input_arrow:mt().optional(),has_output_arrow:mt().optional()}).describe("Defines a port on a schematic component"),TMe=Ie({type:Ee("schematic_net_label"),schematic_net_label_id:qr("schematic_net_label"),schematic_trace_id:$().optional(),source_trace_id:$().optional(),source_net_id:$(),center:wa,anchor_position:wa.optional(),anchor_side:dn(["top","bottom","left","right"]),text:$(),symbol_name:$().optional(),is_movable:mt().optional(),subcircuit_id:$().optional()}),MMe=Ie({type:Ee("schematic_error"),schematic_error_id:$(),error_type:Ee("schematic_port_not_found").default("schematic_port_not_found"),message:$(),subcircuit_id:$().optional()}).describe("Defines a schematic error on the schematic"),AMe=Ie({type:Ee("schematic_layout_error"),schematic_layout_error_id:qr("schematic_layout_error"),error_type:Ee("schematic_layout_error").default("schematic_layout_error"),message:$(),source_group_id:$(),schematic_group_id:$(),subcircuit_id:$().optional()}).describe("Error emitted when schematic layout fails for a group"),X7=Ie({type:Ee("schematic_debug_object"),label:$().optional(),subcircuit_id:$().optional()}),CMe=X7.extend({shape:Ee("rect"),center:wa,size:LK}),RMe=X7.extend({shape:Ee("line"),start:wa,end:wa}),PMe=X7.extend({shape:Ee("point"),center:wa}),IMe=A_("shape",[CMe,RMe,PMe]),NMe=Ie({type:Ee("schematic_voltage_probe"),schematic_voltage_probe_id:$(),position:wa,schematic_trace_id:$(),voltage:Uv.optional(),subcircuit_id:$().optional()}).describe("Defines a voltage probe measurement point on a schematic trace"),nQ=Ie({type:Ee("schematic_manual_edit_conflict_warning"),schematic_manual_edit_conflict_warning_id:qr("schematic_manual_edit_conflict_warning"),warning_type:Ee("schematic_manual_edit_conflict_warning").default("schematic_manual_edit_conflict_warning"),message:$(),schematic_component_id:$(),schematic_group_id:$().optional(),subcircuit_id:$().optional(),source_component_id:$()}).describe("Warning emitted when a component has both manual placement and explicit schX/schY coordinates"),kMe=Ie({type:Ee("schematic_group"),schematic_group_id:qr("schematic_group"),source_group_id:$(),is_subcircuit:mt().optional(),subcircuit_id:$().optional(),width:at,height:at,center:wa,schematic_component_ids:At($()),show_as_schematic_box:mt().optional(),name:$().optional(),description:$().optional()}).describe("Defines a group of components on the schematic"),OMe=Ie({type:Ee("schematic_table"),schematic_table_id:qr("schematic_table"),anchor_position:wa,column_widths:At($t),row_heights:At($t),cell_padding:$t.optional(),border_width:$t.optional(),subcircuit_id:$().optional(),schematic_component_id:$().optional(),anchor:G7.optional()}).describe("Defines a table on the schematic"),LMe=Ie({type:Ee("schematic_table_cell"),schematic_table_cell_id:qr("schematic_table_cell"),schematic_table_id:$(),start_row_index:$e(),end_row_index:$e(),start_column_index:$e(),end_column_index:$e(),text:$().optional(),center:wa,width:$t,height:$t,horizontal_align:dn(["left","center","right"]).optional(),vertical_align:dn(["top","middle","bottom"]).optional(),font_size:$t.optional(),subcircuit_id:$().optional()}).describe("Defines a cell within a schematic_table"),DMe=Ie({x:$t,y:$t,bulge:$e().optional()}),iQ=Ie({vertices:At(DMe)}),zMe=Ie({outer_ring:iQ,inner_rings:At(iQ).default([])}),$Me=Ie({x:$t,y:$t,via:mt().optional(),via_to_layer:Wc.optional()}),Jbt=At($Me),O5=Ie({x:$t,y:$t,via:mt().optional(),to_layer:Wc.optional(),trace_width:$t.optional()}),FMe=Ie({type:Ee("pcb_component"),pcb_component_id:qr("pcb_component"),source_component_id:$(),center:wa,layer:Wc,rotation:um,width:at,height:at,do_not_place:mt().optional(),subcircuit_id:$().optional(),pcb_group_id:$().optional(),obstructs_within_bounds:mt().default(!0).describe("Does this component take up all the space within its bounds on a layer. This is generally true except for when separated pin headers are being represented by a single component (in which case, chips can be placed between the pin headers) or for tall modules where chips fit underneath")}).describe("Defines a component on the PCB"),BMe=Ie({type:Ee("pcb_hole"),pcb_hole_id:qr("pcb_hole"),pcb_group_id:$().optional(),subcircuit_id:$().optional(),hole_shape:dn(["circle","square"]),hole_diameter:$e(),x:$t,y:$t}),ext=BMe.describe("Defines a circular or square hole on the PCB"),UMe=Ie({type:Ee("pcb_hole"),pcb_hole_id:qr("pcb_hole"),pcb_group_id:$().optional(),subcircuit_id:$().optional(),hole_shape:Ee("oval"),hole_width:$e(),hole_height:$e(),x:$t,y:$t}),txt=UMe.describe("Defines an oval hole on the PCB"),jMe=BMe.or(UMe),nxt=Ie({type:Ee("pcb_plated_hole"),shape:Ee("circle"),pcb_group_id:$().optional(),subcircuit_id:$().optional(),outer_diameter:$e(),hole_diameter:$e(),x:$t,y:$t,layers:At(Wc),port_hints:At($()).optional(),pcb_component_id:$().optional(),pcb_port_id:$().optional(),pcb_plated_hole_id:qr("pcb_plated_hole")}),ixt=Ie({type:Ee("pcb_plated_hole"),shape:dn(["oval","pill"]),pcb_group_id:$().optional(),subcircuit_id:$().optional(),outer_width:$e(),outer_height:$e(),hole_width:$e(),hole_height:$e(),x:$t,y:$t,ccw_rotation:um,layers:At(Wc),port_hints:At($()).optional(),pcb_component_id:$().optional(),pcb_port_id:$().optional(),pcb_plated_hole_id:qr("pcb_plated_hole")}),rxt=Ie({type:Ee("pcb_plated_hole"),shape:Ee("circular_hole_with_rect_pad"),pcb_group_id:$().optional(),subcircuit_id:$().optional(),hole_shape:Ee("circle"),pad_shape:Ee("rect"),hole_diameter:$e(),rect_pad_width:$e(),rect_pad_height:$e(),rect_border_radius:$e().optional(),hole_offset_x:$t.default(0),hole_offset_y:$t.default(0),x:$t,y:$t,layers:At(Wc),port_hints:At($()).optional(),pcb_component_id:$().optional(),pcb_port_id:$().optional(),pcb_plated_hole_id:qr("pcb_plated_hole")}),oxt=Ie({type:Ee("pcb_plated_hole"),shape:Ee("pill_hole_with_rect_pad"),pcb_group_id:$().optional(),subcircuit_id:$().optional(),hole_shape:Ee("pill"),pad_shape:Ee("rect"),hole_width:$e(),hole_height:$e(),rect_pad_width:$e(),rect_pad_height:$e(),rect_border_radius:$e().optional(),hole_offset_x:$t.default(0),hole_offset_y:$t.default(0),x:$t,y:$t,layers:At(Wc),port_hints:At($()).optional(),pcb_component_id:$().optional(),pcb_port_id:$().optional(),pcb_plated_hole_id:qr("pcb_plated_hole")}),sxt=Ie({type:Ee("pcb_plated_hole"),shape:Ee("rotated_pill_hole_with_rect_pad"),pcb_group_id:$().optional(),subcircuit_id:$().optional(),hole_shape:Ee("rotated_pill"),pad_shape:Ee("rect"),hole_width:$e(),hole_height:$e(),hole_ccw_rotation:um,rect_pad_width:$e(),rect_pad_height:$e(),rect_border_radius:$e().optional(),rect_ccw_rotation:um,hole_offset_x:$t.default(0),hole_offset_y:$t.default(0),x:$t,y:$t,layers:At(Wc),port_hints:At($()).optional(),pcb_component_id:$().optional(),pcb_port_id:$().optional(),pcb_plated_hole_id:qr("pcb_plated_hole")}),HMe=Jn([nxt,ixt,rxt,oxt,sxt]),VMe=Ie({type:Ee("pcb_port"),pcb_port_id:qr("pcb_port"),pcb_group_id:$().optional(),subcircuit_id:$().optional(),source_port_id:$(),pcb_component_id:$(),x:$t,y:$t,layers:At(Wc),is_board_pinout:mt().optional()}).describe("Defines a port on the PCB"),axt=Ie({type:Ee("pcb_smtpad"),shape:Ee("circle"),pcb_smtpad_id:qr("pcb_smtpad"),pcb_group_id:$().optional(),subcircuit_id:$().optional(),x:$t,y:$t,radius:$e(),layer:Wc,port_hints:At($()).optional(),pcb_component_id:$().optional(),pcb_port_id:$().optional(),is_covered_with_solder_mask:mt().optional()}),cxt=Ie({type:Ee("pcb_smtpad"),shape:Ee("rect"),pcb_smtpad_id:qr("pcb_smtpad"),pcb_group_id:$().optional(),subcircuit_id:$().optional(),x:$t,y:$t,width:$e(),height:$e(),rect_border_radius:$e().optional(),layer:Wc,port_hints:At($()).optional(),pcb_component_id:$().optional(),pcb_port_id:$().optional(),is_covered_with_solder_mask:mt().optional()}),lxt=Ie({type:Ee("pcb_smtpad"),shape:Ee("rotated_rect"),pcb_smtpad_id:qr("pcb_smtpad"),pcb_group_id:$().optional(),subcircuit_id:$().optional(),x:$t,y:$t,width:$e(),height:$e(),rect_border_radius:$e().optional(),ccw_rotation:um,layer:Wc,port_hints:At($()).optional(),pcb_component_id:$().optional(),pcb_port_id:$().optional(),is_covered_with_solder_mask:mt().optional()}),GMe=Ie({type:Ee("pcb_smtpad"),shape:Ee("pill"),pcb_smtpad_id:qr("pcb_smtpad"),pcb_group_id:$().optional(),subcircuit_id:$().optional(),x:$t,y:$t,width:$e(),height:$e(),radius:$e(),layer:Wc,port_hints:At($()).optional(),pcb_component_id:$().optional(),pcb_port_id:$().optional(),is_covered_with_solder_mask:mt().optional()}),uxt=Ie({type:Ee("pcb_smtpad"),shape:Ee("rotated_pill"),pcb_smtpad_id:qr("pcb_smtpad"),pcb_group_id:$().optional(),subcircuit_id:$().optional(),x:$t,y:$t,width:$e(),height:$e(),radius:$e(),ccw_rotation:um,layer:Wc,port_hints:At($()).optional(),pcb_component_id:$().optional(),pcb_port_id:$().optional(),is_covered_with_solder_mask:mt().optional()}),dxt=Ie({type:Ee("pcb_smtpad"),shape:Ee("polygon"),pcb_smtpad_id:qr("pcb_smtpad"),pcb_group_id:$().optional(),subcircuit_id:$().optional(),points:At(wa),layer:Wc,port_hints:At($()).optional(),pcb_component_id:$().optional(),pcb_port_id:$().optional(),is_covered_with_solder_mask:mt().optional()}),YMe=A_("shape",[axt,cxt,lxt,uxt,GMe,dxt]).describe("Defines an SMT pad on the PCB"),hxt=Ie({type:Ee("pcb_solder_paste"),shape:Ee("circle"),pcb_solder_paste_id:qr("pcb_solder_paste"),pcb_group_id:$().optional(),subcircuit_id:$().optional(),x:$t,y:$t,radius:$e(),layer:Wc,pcb_component_id:$().optional(),pcb_smtpad_id:$().optional()}),pxt=Ie({type:Ee("pcb_solder_paste"),shape:Ee("rect"),pcb_solder_paste_id:qr("pcb_solder_paste"),pcb_group_id:$().optional(),subcircuit_id:$().optional(),x:$t,y:$t,width:$e(),height:$e(),layer:Wc,pcb_component_id:$().optional(),pcb_smtpad_id:$().optional()}),fxt=Ie({type:Ee("pcb_solder_paste"),shape:Ee("pill"),pcb_solder_paste_id:qr("pcb_solder_paste"),pcb_group_id:$().optional(),subcircuit_id:$().optional(),x:$t,y:$t,width:$e(),height:$e(),radius:$e(),layer:Wc,pcb_component_id:$().optional(),pcb_smtpad_id:$().optional()}),mxt=Ie({type:Ee("pcb_solder_paste"),shape:Ee("rotated_rect"),pcb_solder_paste_id:qr("pcb_solder_paste"),pcb_group_id:$().optional(),subcircuit_id:$().optional(),x:$t,y:$t,width:$e(),height:$e(),ccw_rotation:$t,layer:Wc,pcb_component_id:$().optional(),pcb_smtpad_id:$().optional()}),_xt=Ie({type:Ee("pcb_solder_paste"),shape:Ee("oval"),pcb_solder_paste_id:qr("pcb_solder_paste"),pcb_group_id:$().optional(),subcircuit_id:$().optional(),x:$t,y:$t,width:$e(),height:$e(),layer:Wc,pcb_component_id:$().optional(),pcb_smtpad_id:$().optional()}),qMe=Jn([hxt,pxt,fxt,mxt,_xt]).describe("Defines solderpaste on the PCB"),XMe=Ie({type:Ee("pcb_text"),pcb_text_id:qr("pcb_text"),pcb_group_id:$().optional(),subcircuit_id:$().optional(),text:$(),center:wa,layer:Wc,width:at,height:at,lines:$e(),align:dn(["bottom-left"])}).describe("Defines text on the PCB"),WMe=Ie({route_type:Ee("wire"),x:$t,y:$t,width:$t,start_pcb_port_id:$().optional(),end_pcb_port_id:$().optional(),layer:Wc}),ZMe=Ie({route_type:Ee("via"),x:$t,y:$t,hole_diameter:$t.optional(),outer_diameter:$t.optional(),from_layer:$(),to_layer:$()}),rQ=Jn([WMe,ZMe]),KMe=Ie({type:Ee("pcb_trace"),source_trace_id:$().optional(),pcb_component_id:$().optional(),pcb_trace_id:qr("pcb_trace"),pcb_group_id:$().optional(),subcircuit_id:$().optional(),route_thickness_mode:dn(["constant","interpolated"]).default("constant").optional(),route_order_index:$e().optional(),should_round_corners:mt().optional(),trace_length:$e().optional(),highlight_color:$().optional(),route:At(rQ)}).describe("Defines a trace on the PCB"),QMe=Ie({type:Ee("pcb_trace_error"),pcb_trace_error_id:qr("pcb_trace_error"),error_type:Ee("pcb_trace_error").default("pcb_trace_error"),message:$(),center:wa.optional(),pcb_trace_id:$(),source_trace_id:$(),pcb_component_ids:At($()),pcb_port_ids:At($()),subcircuit_id:$().optional()}).describe("Defines a trace error on the PCB"),JMe=Ie({type:Ee("pcb_trace_missing_error"),pcb_trace_missing_error_id:qr("pcb_trace_missing_error"),error_type:Ee("pcb_trace_missing_error").default("pcb_trace_missing_error"),message:$(),center:wa.optional(),source_trace_id:$(),pcb_component_ids:At($()),pcb_port_ids:At($()),subcircuit_id:$().optional()}).describe("Defines an error when a source trace has no corresponding PCB trace"),eAe=Ie({type:Ee("pcb_port_not_matched_error"),pcb_error_id:qr("pcb_error"),error_type:Ee("pcb_port_not_matched_error").default("pcb_port_not_matched_error"),message:$(),pcb_component_ids:At($()),subcircuit_id:$().optional()}).describe("Defines a trace error on the PCB where a port is not matched"),tAe=Ie({type:Ee("pcb_port_not_connected_error"),pcb_port_not_connected_error_id:qr("pcb_port_not_connected_error"),error_type:Ee("pcb_port_not_connected_error").default("pcb_port_not_connected_error"),message:$(),pcb_port_ids:At($()),pcb_component_ids:At($()),subcircuit_id:$().optional()}).describe("Defines an error when a pcb port is not connected to any trace"),nAe=Ie({type:Ee("pcb_net"),pcb_net_id:qr("pcb_net"),source_net_id:$().optional(),highlight_color:$().optional()}).describe("Defines a net on the PCB"),iAe=Ie({type:Ee("pcb_via"),pcb_via_id:qr("pcb_via"),pcb_group_id:$().optional(),subcircuit_id:$().optional(),x:$t,y:$t,outer_diameter:$t.default("0.6mm"),hole_diameter:$t.default("0.25mm"),from_layer:Wc.optional(),to_layer:Wc.optional(),layers:At(Wc),pcb_trace_id:$().optional()}).describe("Defines a via on the PCB"),rAe=Ie({type:Ee("pcb_board"),pcb_board_id:qr("pcb_board"),is_subcircuit:mt().optional(),subcircuit_id:$().optional(),width:at,height:at,center:wa,thickness:at.optional().default(1.4),num_layers:$e().optional().default(4),outline:At(wa).optional(),material:dn(["fr4","fr1"]).default("fr4")}).describe("Defines the board outline of the PCB"),oAe=Ie({type:Ee("pcb_placement_error"),pcb_placement_error_id:qr("pcb_placement_error"),error_type:Ee("pcb_placement_error").default("pcb_placement_error"),message:$(),subcircuit_id:$().optional()}).describe("Defines a placement error on the PCB"),sAe=Ie({type:Ee("pcb_trace_hint"),pcb_trace_hint_id:qr("pcb_trace_hint"),pcb_port_id:$(),pcb_component_id:$(),route:At(O5),subcircuit_id:$().optional()}).describe("A hint that can be used during generation of a PCB trace"),aAe=Ie({type:Ee("pcb_silkscreen_line"),pcb_silkscreen_line_id:qr("pcb_silkscreen_line"),pcb_component_id:$(),pcb_group_id:$().optional(),subcircuit_id:$().optional(),stroke_width:$t.default("0.1mm"),x1:$t,y1:$t,x2:$t,y2:$t,layer:YC}).describe("Defines a silkscreen line on the PCB"),cAe=Ie({type:Ee("pcb_silkscreen_path"),pcb_silkscreen_path_id:qr("pcb_silkscreen_path"),pcb_component_id:$(),pcb_group_id:$().optional(),subcircuit_id:$().optional(),layer:YC,route:At(wa),stroke_width:at}).describe("Defines a silkscreen path on the PCB"),lAe=Ie({type:Ee("pcb_silkscreen_text"),pcb_silkscreen_text_id:qr("pcb_silkscreen_text"),pcb_group_id:$().optional(),subcircuit_id:$().optional(),font:Ee("tscircuit2024").default("tscircuit2024"),font_size:$t.default("0.2mm"),pcb_component_id:$(),text:$(),is_knockout:mt().default(!1).optional(),knockout_padding:Ie({left:at,top:at,bottom:at,right:at}).default({left:"0.2mm",top:"0.2mm",bottom:"0.2mm",right:"0.2mm"}).optional(),ccw_rotation:$e().optional(),layer:Wc,is_mirrored:mt().default(!1).optional(),anchor_position:wa.default({x:0,y:0}),anchor_alignment:G7.default("center")}).describe("Defines silkscreen text on the PCB"),uAe=Ie({type:Ee("pcb_silkscreen_rect"),pcb_silkscreen_rect_id:qr("pcb_silkscreen_rect"),pcb_component_id:$(),pcb_group_id:$().optional(),subcircuit_id:$().optional(),center:wa,width:at,height:at,layer:Wc,stroke_width:at.default("1mm"),is_filled:mt().default(!0).optional(),has_stroke:mt().optional(),is_stroke_dashed:mt().optional()}).describe("Defines a silkscreen rect on the PCB"),dAe=Ie({type:Ee("pcb_silkscreen_circle"),pcb_silkscreen_circle_id:qr("pcb_silkscreen_circle"),pcb_component_id:$(),pcb_group_id:$().optional(),subcircuit_id:$().optional(),center:wa,radius:at,layer:YC,stroke_width:at.default("1mm")}).describe("Defines a silkscreen circle on the PCB"),hAe=Ie({type:Ee("pcb_silkscreen_oval"),pcb_silkscreen_oval_id:qr("pcb_silkscreen_oval"),pcb_component_id:$(),pcb_group_id:$().optional(),subcircuit_id:$().optional(),center:wa,radius_x:$t,radius_y:$t,layer:YC}).describe("Defines a silkscreen oval on the PCB"),pAe=Ie({type:Ee("pcb_fabrication_note_text"),pcb_fabrication_note_text_id:qr("pcb_fabrication_note_text"),subcircuit_id:$().optional(),pcb_group_id:$().optional(),font:Ee("tscircuit2024").default("tscircuit2024"),font_size:$t.default("1mm"),pcb_component_id:$(),text:$(),layer:YC,anchor_position:wa.default({x:0,y:0}),anchor_alignment:dn(["center","top_left","top_right","bottom_left","bottom_right"]).default("center"),color:$().optional()}).describe("Defines a fabrication note in text on the PCB, useful for leaving notes for assemblers or fabricators"),fAe=Ie({type:Ee("pcb_fabrication_note_path"),pcb_fabrication_note_path_id:qr("pcb_fabrication_note_path"),pcb_component_id:$(),subcircuit_id:$().optional(),layer:Wc,route:At(wa),stroke_width:at,color:$().optional()}).describe("Defines a fabrication path on the PCB for fabricators or assemblers"),mAe=Ie({type:Ee("pcb_footprint_overlap_error"),pcb_error_id:qr("pcb_error"),error_type:Ee("pcb_footprint_overlap_error").default("pcb_footprint_overlap_error"),message:$(),pcb_smtpad_ids:At($()).optional(),pcb_plated_hole_ids:At($()).optional(),pcb_hole_ids:At($()).optional(),pcb_keepout_ids:At($()).optional()}).describe("Error emitted when a pcb footprint overlaps with another element"),_Ae=Ie({type:Ee("pcb_keepout"),shape:Ee("rect"),pcb_group_id:$().optional(),subcircuit_id:$().optional(),center:wa,width:$t,height:$t,pcb_keepout_id:$(),layers:At($()),description:$().optional()}).or(Ie({type:Ee("pcb_keepout"),shape:Ee("circle"),pcb_group_id:$().optional(),subcircuit_id:$().optional(),center:wa,radius:$t,pcb_keepout_id:$(),layers:At($()),description:$().optional()})),oQ=Ie({type:Ee("pcb_cutout"),pcb_cutout_id:qr("pcb_cutout"),pcb_group_id:$().optional(),subcircuit_id:$().optional()}),yAe=oQ.extend({shape:Ee("rect"),center:wa,width:at,height:at,rotation:um.optional()}),gAe=oQ.extend({shape:Ee("circle"),center:wa,radius:at}),bAe=oQ.extend({shape:Ee("polygon"),points:At(wa)}),xAe=A_("shape",[yAe,gAe,bAe]).describe("Defines a cutout on the PCB, removing board material."),vAe=Ie({type:Ee("pcb_missing_footprint_error"),pcb_missing_footprint_error_id:qr("pcb_missing_footprint_error"),pcb_group_id:$().optional(),subcircuit_id:$().optional(),error_type:Ee("pcb_missing_footprint_error").default("pcb_missing_footprint_error"),source_component_id:$(),message:$()}).describe("Defines a missing footprint error on the PCB"),W7=Ie({type:Ee("external_footprint_load_error"),external_footprint_load_error_id:qr("external_footprint_load_error"),pcb_component_id:$(),source_component_id:$(),pcb_group_id:$().optional(),subcircuit_id:$().optional(),footprinter_string:$().optional(),error_type:Ee("external_footprint_load_error").default("external_footprint_load_error"),message:$()}).describe("Defines an error when an external footprint fails to load"),sQ=Ie({type:Ee("circuit_json_footprint_load_error"),circuit_json_footprint_load_error_id:qr("circuit_json_footprint_load_error"),pcb_component_id:$(),source_component_id:$(),pcb_group_id:$().optional(),subcircuit_id:$().optional(),error_type:Ee("circuit_json_footprint_load_error").default("circuit_json_footprint_load_error"),message:$(),circuit_json:At(hd()).optional()}).describe("Defines an error when a circuit JSON footprint fails to load"),wAe=Ie({type:Ee("pcb_group"),pcb_group_id:qr("pcb_group"),source_group_id:$(),is_subcircuit:mt().optional(),subcircuit_id:$().optional(),width:at,height:at,center:wa,pcb_component_ids:At($()),name:$().optional(),description:$().optional(),layout_mode:$().optional(),autorouter_configuration:Ie({trace_clearance:at}).optional(),autorouter_used_string:$().optional()}).describe("Defines a group of components on the PCB"),SAe=Ie({type:Ee("pcb_autorouting_error"),pcb_error_id:qr("pcb_autorouting_error"),error_type:Ee("pcb_autorouting_error").default("pcb_autorouting_error"),message:$(),subcircuit_id:$().optional()}).describe("The autorouting has failed to route a portion of the board"),aQ=Ie({type:Ee("pcb_manual_edit_conflict_warning"),pcb_manual_edit_conflict_warning_id:qr("pcb_manual_edit_conflict_warning"),warning_type:Ee("pcb_manual_edit_conflict_warning").default("pcb_manual_edit_conflict_warning"),message:$(),pcb_component_id:$(),pcb_group_id:$().optional(),subcircuit_id:$().optional(),source_component_id:$()}).describe("Warning emitted when a component has both manual placement and explicit pcbX/pcbY coordinates"),EAe=Ie({type:Ee("pcb_breakout_point"),pcb_breakout_point_id:qr("pcb_breakout_point"),pcb_group_id:$(),subcircuit_id:$().optional(),source_trace_id:$().optional(),source_port_id:$().optional(),source_net_id:$().optional(),x:$t,y:$t}).describe("Defines a routing target within a pcb_group for a source_trace or source_net"),TAe=Ie({type:Ee("pcb_ground_plane"),pcb_ground_plane_id:qr("pcb_ground_plane"),source_pcb_ground_plane_id:$(),source_net_id:$(),pcb_group_id:$().optional(),subcircuit_id:$().optional()}).describe("Defines a ground plane on the PCB"),MAe=Ie({type:Ee("pcb_ground_plane_region"),pcb_ground_plane_region_id:qr("pcb_ground_plane_region"),pcb_ground_plane_id:$(),pcb_group_id:$().optional(),subcircuit_id:$().optional(),layer:Wc,points:At(wa)}).describe("Defines a polygon region of a ground plane"),AAe=Ie({type:Ee("pcb_thermal_spoke"),pcb_thermal_spoke_id:qr("pcb_thermal_spoke"),pcb_ground_plane_id:$(),shape:$(),spoke_count:$e(),spoke_thickness:$t,spoke_inner_diameter:$t,spoke_outer_diameter:$t,pcb_plated_hole_id:$().optional(),subcircuit_id:$().optional()}).describe("Pattern for connecting a ground plane to a plated hole"),cQ=Ie({type:Ee("pcb_copper_pour"),pcb_copper_pour_id:qr("pcb_copper_pour"),pcb_group_id:$().optional(),subcircuit_id:$().optional(),layer:Wc,source_net_id:$().optional()}),CAe=cQ.extend({shape:Ee("rect"),center:wa,width:at,height:at,rotation:um.optional()}),RAe=cQ.extend({shape:Ee("brep"),brep_shape:zMe}),PAe=cQ.extend({shape:Ee("polygon"),points:At(wa)}),IAe=A_("shape",[CAe,RAe,PAe]).describe("Defines a copper pour on the PCB."),NAe=Ie({type:Ee("pcb_component_outside_board_error"),pcb_component_outside_board_error_id:qr("pcb_component_outside_board_error"),error_type:Ee("pcb_component_outside_board_error").default("pcb_component_outside_board_error"),message:$(),pcb_component_id:$(),pcb_board_id:$(),component_center:wa,component_bounds:Ie({min_x:$e(),max_x:$e(),min_y:$e(),max_y:$e()}),subcircuit_id:$().optional(),source_component_id:$().optional()}).describe("Error emitted when a PCB component is placed outside the board boundaries"),kAe=Ie({type:Ee("cad_component"),cad_component_id:$(),pcb_component_id:$(),source_component_id:$(),position:GC,rotation:GC.optional(),size:GC.optional(),layer:Wc.optional(),subcircuit_id:$().optional(),footprinter_string:$().optional(),model_obj_url:$().optional(),model_stl_url:$().optional(),model_3mf_url:$().optional(),model_gltf_url:$().optional(),model_glb_url:$().optional(),model_step_url:$().optional(),model_wrl_url:$().optional(),model_unit_to_mm_scale_factor:$e().optional(),model_jscad:hd().optional()}).describe("Defines a component on the PCB"),OAe=dn(["sinewave","square","triangle","sawtooth"]),yxt=Jn([$(),$e()]).transform(n=>typeof n=="string"?n.endsWith("%")?parseFloat(n.slice(0,-1))/100:parseFloat(n):n).pipe($e().min(0,"Duty cycle must be non-negative").max(1,"Duty cycle cannot be greater than 100%")),LAe=Ie({type:Ee("simulation_voltage_source"),simulation_voltage_source_id:qr("simulation_voltage_source"),is_dc_source:Ee(!0).optional().default(!0),positive_source_port_id:$().optional(),negative_source_port_id:$().optional(),positive_source_net_id:$().optional(),negative_source_net_id:$().optional(),voltage:Uv}).describe("Defines a DC voltage source for simulation"),DAe=Ie({type:Ee("simulation_voltage_source"),simulation_voltage_source_id:qr("simulation_voltage_source"),is_dc_source:Ee(!1),terminal1_source_port_id:$().optional(),terminal2_source_port_id:$().optional(),terminal1_source_net_id:$().optional(),terminal2_source_net_id:$().optional(),voltage:Uv.optional(),frequency:bA.optional(),peak_to_peak_voltage:Uv.optional(),wave_shape:OAe.optional(),phase:um.optional(),duty_cycle:yxt.optional()}).describe("Defines an AC voltage source for simulation"),zAe=Jn([LAe,DAe]).describe("Defines a voltage source for simulation"),$Ae=Jn([sMe,oMe,rMe,cMe,aMe,FK,DK,q7,$K,zK,BK,UK,jK,GK,YK,qK,KK,XK,WK,ZK,VK,HK,lMe,uMe,QK,JK,eQ,FMe,jMe,vAe,W7,sQ,aQ,HMe,_Ae,VMe,nAe,XMe,KMe,iAe,YMe,qMe,rAe,wAe,sAe,aAe,cAe,lAe,uAe,dAe,hAe,QMe,JMe,oAe,eAe,tAe,fAe,pAe,SAe,mAe,EAe,xAe,TAe,MAe,AAe,IAe,NAe,dMe,SMe,gMe,bMe,xMe,vMe,yMe,EMe,wMe,hMe,MMe,AMe,TMe,IMe,NMe,nQ,kMe,OMe,LMe,kAe,zAe]),Z7=$Ae;const lQ=Object.freeze(Object.defineProperty({__proto__:null,all_layers:DN,any_circuit_element:$Ae,any_soup_element:Z7,any_source_component:rMe,battery_capacity:Q3e,brep_shape:zMe,cad_component:kAe,capacitance:VC,circuit_json_footprint_load_error:sQ,current:Ybt,distance:$t,external_footprint_load_error:W7,frequency:bA,getZodPrefixedIdWithDefault:qr,inductance:OK,layer_ref:Wc,layer_string:tQ,length:at,ninePointAnchor:G7,pcb_autorouting_error:SAe,pcb_board:rAe,pcb_breakout_point:EAe,pcb_component:FMe,pcb_component_outside_board_error:NAe,pcb_copper_pour:IAe,pcb_copper_pour_brep:RAe,pcb_copper_pour_polygon:PAe,pcb_copper_pour_rect:CAe,pcb_cutout:xAe,pcb_cutout_circle:gAe,pcb_cutout_polygon:bAe,pcb_cutout_rect:yAe,pcb_fabrication_note_path:fAe,pcb_fabrication_note_text:pAe,pcb_footprint_overlap_error:mAe,pcb_ground_plane:TAe,pcb_ground_plane_region:MAe,pcb_group:wAe,pcb_hole:jMe,pcb_hole_circle_or_square_shape:ext,pcb_hole_oval_shape:txt,pcb_keepout:_Ae,pcb_manual_edit_conflict_warning:aQ,pcb_missing_footprint_error:vAe,pcb_net:nAe,pcb_placement_error:oAe,pcb_plated_hole:HMe,pcb_port:VMe,pcb_port_not_connected_error:tAe,pcb_port_not_matched_error:eAe,pcb_route_hint:$Me,pcb_route_hints:Jbt,pcb_silkscreen_circle:dAe,pcb_silkscreen_line:aAe,pcb_silkscreen_oval:hAe,pcb_silkscreen_path:cAe,pcb_silkscreen_rect:uAe,pcb_silkscreen_text:lAe,pcb_smtpad:YMe,pcb_smtpad_pill:GMe,pcb_solder_paste:qMe,pcb_text:XMe,pcb_thermal_spoke:AAe,pcb_trace:KMe,pcb_trace_error:QMe,pcb_trace_hint:sAe,pcb_trace_missing_error:JMe,pcb_trace_route_point:rQ,pcb_trace_route_point_via:ZMe,pcb_trace_route_point_wire:WMe,pcb_via:iAe,point:wa,point3:GC,point_with_bulge:DMe,port_arrangement:_Me,position:Xbt,position3:Wbt,resistance:HC,ring:iQ,rotation:um,route_hint_point:O5,schematic_arc:vMe,schematic_box:dMe,schematic_circle:xMe,schematic_component:yMe,schematic_component_port_arrangement_by_sides:mMe,schematic_component_port_arrangement_by_size:fMe,schematic_debug_line:RMe,schematic_debug_object:IMe,schematic_debug_object_base:X7,schematic_debug_point:PMe,schematic_debug_rect:CMe,schematic_error:MMe,schematic_group:kMe,schematic_layout_error:AMe,schematic_line:gMe,schematic_manual_edit_conflict_warning:nQ,schematic_net_label:TMe,schematic_path:hMe,schematic_pin_styles:pMe,schematic_port:EMe,schematic_rect:bMe,schematic_table:OMe,schematic_table_cell:LMe,schematic_text:SMe,schematic_trace:wMe,schematic_voltage_probe:NMe,simulation_ac_voltage_source:DAe,simulation_dc_voltage_source:LAe,simulation_voltage_source:zAe,size:LK,source_component_base:kg,source_failed_to_create_component_error:nMe,source_group:aMe,source_manually_placed_via:uMe,source_missing_property_error:tMe,source_net:cMe,source_pcb_ground_plane:lMe,source_pin_missing_trace_warning:eQ,source_port:oMe,source_project_metadata:QK,source_property_ignored_warning:iMe,source_simple_battery:UK,source_simple_capacitor:DK,source_simple_chip:FK,source_simple_crystal:eMe,source_simple_diode:q7,source_simple_ground:J3e,source_simple_inductor:jK,source_simple_led:$K,source_simple_mosfet:ZK,source_simple_pin_header:GK,source_simple_pinout:YK,source_simple_potentiometer:VK,source_simple_power_source:BK,source_simple_push_button:HK,source_simple_resistor:zK,source_simple_resonator:qK,source_simple_switch:KK,source_simple_test_point:WK,source_simple_transistor:XK,source_trace:sMe,source_trace_not_connected_error:JK,supplier_name:Y7,time:qbt,visible_layer:YC,voltage:Uv,wave_shape:OAe},Symbol.toStringTag,{value:"Module"}));function qt(n,e){return Array.isArray(e)?[n.a*e[0]+n.c*e[1]+n.e,n.b*e[0]+n.d*e[1]+n.f]:{x:n.a*e.x+n.c*e.y+n.e,y:n.b*e.x+n.d*e.y+n.f}}function gxt(n,e){return e.map(t=>qt(n,t))}function FAe(n){return{a:parseFloat(n.a),b:parseFloat(n.b),c:parseFloat(n.c),d:parseFloat(n.d),e:parseFloat(n.e),f:parseFloat(n.f)}}const bxt=/^matrix\(\s*([0-9_+-.e]+)\s*,\s*([0-9_+-.e]+)\s*,\s*([0-9_+-.e]+)\s*,\s*([0-9_+-.e]+)\s*,\s*([0-9_+-.e]+)\s*,\s*([0-9_+-.e]+)\s*\)$/i;function K7(n){const e=n.match(bxt);if(e===null||e.length<7)throw new Error(`'${n}' is not a matrix`);return{a:parseFloat(e[1]),b:parseFloat(e[2]),c:parseFloat(e[3]),d:parseFloat(e[4]),e:parseFloat(e[5]),f:parseFloat(e[6])}}function dm(){return{a:1,c:0,e:0,b:0,d:1,f:0}}function iS(n){const{a:e,b:t,c:i,d:r,e:o,f:s}=n,a=e*r-t*i;return{a:r/a,b:t/-a,c:i/-a,d:e/a,e:(r*o-i*s)/-a,f:(t*o-e*s)/a}}function zN(n){return typeof n>"u"}function qC(n){return typeof n=="number"&&!Number.isNaN(n)&&Number.isFinite(n)}function xxt(n){return typeof n=="object"&&n!==null&&!Array.isArray(n)}function vxt(n){return xxt(n)&&"a"in n&&qC(n.a)&&"b"in n&&qC(n.b)&&"c"in n&&qC(n.c)&&"d"in n&&qC(n.d)&&"e"in n&&qC(n.e)&&"f"in n&&qC(n.f)}function Cs(n,e=0){return{a:1,c:0,e:n,b:0,d:1,f:e}}function XC(...n){n=Array.isArray(n[0])?n[0]:n;const e=(t,i)=>({a:t.a*i.a+t.c*i.b,c:t.a*i.c+t.c*i.d,e:t.a*i.e+t.c*i.f+t.e,b:t.b*i.a+t.d*i.b,d:t.b*i.c+t.d*i.d,f:t.b*i.e+t.d*i.f+t.f});switch(n.length){case 0:throw new Error("no matrices provided");case 1:return n[0];case 2:return e(n[0],n[1]);default:{const[t,i,...r]=n,o=e(t,i);return XC(o,...r)}}}function ls(...n){return XC(...n)}const{cos:wxt,sin:Sxt,PI:Ext}=Math;function ov(n,e,t){const i=wxt(n),r=Sxt(n),o={a:i,c:-r,e:0,b:r,d:i,f:0};return zN(e)||zN(t)?o:XC([Cs(e,t),o,Cs(-e,-t)])}function $N(n,e=void 0,t=void 0){return ov(n*Ext/180,e,t)}function Og(n,e=void 0,t=void 0,i=void 0){zN(e)&&(e=n);const r={a:n,c:0,e:0,b:0,d:e,f:0};return zN(t)||zN(i)?r:XC([Cs(t,i),r,Cs(-t,-i)])}function BAe(n,e){return{a:1,c:n,e:0,b:e,d:1,f:0}}const{tan:UAe}=Math;function jAe(n,e){return{a:1,c:UAe(n),e:0,b:UAe(e),d:1,f:0}}function uQ(n,e){return jAe(n*Math.PI/180,e*Math.PI/180)}function Txt(n){return cE(n)}function HAe(n){return cE(n)}function cE(n){return`matrix(${n.a},${n.b},${n.c},${n.d},${n.e},${n.f})`}function VAe(n,e=1e10){return{a:Math.round(n.a*e)/e,b:Math.round(n.b*e)/e,c:Math.round(n.c*e)/e,d:Math.round(n.d*e)/e,e:Math.round(n.e*e)/e,f:Math.round(n.f*e)/e}}function GAe(n,e){const t=n[0].x!=null?n[0].x:n[0][0],i=n[0].y!=null?n[0].y:n[0][1],r=e[0].x!=null?e[0].x:e[0][0],o=e[0].y!=null?e[0].y:e[0][1],s=n[1].x!=null?n[1].x:n[1][0],a=n[1].y!=null?n[1].y:n[1][1],c=e[1].x!=null?e[1].x:e[1][0],l=e[1].y!=null?e[1].y:e[1][1],u=n[2].x!=null?n[2].x:n[2][0],d=n[2].y!=null?n[2].y:n[2][1],h=e[2].x!=null?e[2].x:e[2][0],f=e[2].y!=null?e[2].y:e[2][1],m={a:t-u,b:i-d,c:s-u,d:a-d,e:u,f:d},y={a:r-h,b:o-f,c:c-h,d:l-f,e:h,f},g=iS(m),b=XC([y,g]);return VAe(b)}function Mxt(n){return Array.isArray(n)?n.map(e):e(n);function e(t){switch(t.type){case"matrix":if("a"in t&&"b"in t&&"c"in t&&"d"in t&&"e"in t&&"f"in t)return FAe(t);throw new Error("MISSING_MANDATORY_PARAM");case"translate":if(!("tx"in t))throw new Error("MISSING_MANDATORY_PARAM");return"ty"in t?Cs(t.tx,t.ty):Cs(t.tx);case"scale":if(!("sx"in t))throw new Error("MISSING_MANDATORY_PARAM");return"sy"in t?Og(t.sx,t.sy):Og(t.sx);case"rotate":if(!("angle"in t))throw new Error("MISSING_MANDATORY_PARAM");return"cx"in t&&"cy"in t?$N(t.angle,t.cx,t.cy):$N(t.angle);case"skewX":if(!("angle"in t))throw new Error("MISSING_MANDATORY_PARAM");return uQ(t.angle,0);case"skewY":if(!("angle"in t))throw new Error("MISSING_MANDATORY_PARAM");return uQ(0,t.angle);case"shear":if(!("shx"in t&&"shy"in t))throw new Error("MISSING_MANDATORY_PARAM");return BAe(t.shx,t.shy);default:throw new Error("UNSUPPORTED_DESCRIPTOR")}}}function Axt(n,e){function t(){this.constructor=n}t.prototype=e.prototype,n.prototype=new t}function WC(n,e,t,i){var r=Error.call(this,n);return Object.setPrototypeOf&&Object.setPrototypeOf(r,WC.prototype),r.expected=e,r.found=t,r.location=i,r.name="SyntaxError",r}Axt(WC,Error);function dQ(n,e,t){return t=t||" ",n.length>e?n:(e-=n.length,t+=t.repeat(e),n+t.slice(0,e))}WC.prototype.format=function(n){var e="Error: "+this.message;if(this.location){var t=null,i;for(i=0;i<n.length;i++)if(n[i].source===this.location.source){t=n[i].text.split(/\r\n|\n|\r/g);break}var r=this.location.start,o=this.location.source&&typeof this.location.source.offset=="function"?this.location.source.offset(r):r,s=this.location.source+":"+o.line+":"+o.column;if(t){var a=this.location.end,c=dQ("",o.line.toString().length," "),l=t[r.line-1],u=r.line===a.line?a.column:l.length+1,d=u-r.column||1;e+=`
|
|
323
323
|
--> `+s+`
|
|
324
324
|
`+c+` |
|
|
325
325
|
`+o.line+" | "+l+`
|