@tscircuit/runframe 0.0.640 → 0.0.642

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.
@@ -892,7 +892,7 @@ searched component ${d.getString()}, which has ports: ${d.children.filter(f=>f.c
892
892
  `);const Q=b.state[s];if(Q==null)return;JSON.stringify(r.getState())!==JSON.stringify(Q)&&m(Q);return}r.dispatchFromDevtools&&typeof r.dispatch=="function"&&r.dispatch(b)});case"DISPATCH":switch(x.payload.type){case"RESET":return m(y),s===void 0?d==null?void 0:d.init(r.getState()):d==null?void 0:d.init(hG(l.name));case"COMMIT":if(s===void 0){d==null||d.init(r.getState());return}return d==null?void 0:d.init(hG(l.name));case"ROLLBACK":return WW(x.state,b=>{if(s===void 0){m(b),d==null||d.init(r.getState());return}m(b[s]),d==null||d.init(hG(l.name))});case"JUMP_TO_STATE":case"JUMP_TO_ACTION":return WW(x.state,b=>{if(s===void 0){m(b);return}JSON.stringify(r.getState())!==JSON.stringify(b[s])&&m(b[s])});case"IMPORT_STATE":{const{nextLiftedState:b}=x.payload,Q=(E=b.computedStates.slice(-1)[0])==null?void 0:E.state;if(!Q)return;m(s===void 0?Q:Q[s]),d==null||d.send(null,b);return}case"PAUSE_RECORDING":return p=!p}return}}),y},WW=(i,e)=>{let t;try{t=JSON.parse(i)}catch(n){console.error("[zustand devtools middleware] Could not parse the received json",n)}t!==void 0&&e(t)},wQ=window.TSCIRCUIT_FILESERVER_API_BASE_URL??"/api",$W=SBe.extend("store");async function zBe(i,e){return(await(await fetch(`${wQ}/files/upsert`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({file_path:i,text_content:e})})).json()).file}async function e$(i){return(await(await fetch(`${wQ}/files/get?file_path=${encodeURIComponent(i)}`)).json()).file}async function Oxt(i){const e=i?`${wQ}/events/list?since=${encodeURIComponent(i)}`:`${wQ}/events/list`;return(await(await fetch(e)).json()).event_list}async function zxt(){const i=await fetch(`${wQ}/files/list`),{file_list:e}=await i.json(),t=new Map;for(const n of e){const r=await e$(n.file_path);t.set(n.file_path,r.text_content)}return t}const BB=FBe()(OBe((i,e)=>({fsMap:new Map,lastEventTime:new Date().toISOString(),isPolling:!1,error:null,circuitJson:null,lastManualEditsChangeSentAt:0,recentEvents:[],simulateScenarioOrder:void 0,loadInitialFiles:async()=>{const t=await zxt();$W("loaded initial files",{fsMap:t}),i({fsMap:t})},upsertFile:async(t,n)=>{try{const r=await zBe(t,n);i(a=>({fsMap:new Map(a.fsMap).set(r.file_path,r.text_content)}))}catch(r){i({error:r})}},getFile:async t=>{try{const n=await e$(t);i(r=>({fsMap:new Map(r.fsMap).set(n.file_path,n.text_content)}))}catch(n){i({error:n})}},setCircuitJson:t=>{t!==e().circuitJson&&i({circuitJson:t})},startPolling:()=>{const t=async()=>{const n=e();if(n.isPolling){try{const r=await Oxt(n.lastEventTime);if(r.length>0){i(s=>({recentEvents:[...s.recentEvents,...r].slice(0,100)}));const a=r[r.length-1].created_at,o=new Map(n.fsMap);for(const s of r)if(s.event_type==="FILE_UPDATED"){const l=await e$(s.file_path);if(s.file_path==="manual_edits.json"&&Date.now()-n.lastManualEditsChangeSentAt<1e3)continue;o.set(l.file_path,l.text_content)}i({fsMap:o,lastEventTime:a})}}catch(r){i({error:r})}setTimeout(t,1e3)}};i({isPolling:!0}),t()},stopPolling:()=>{i({isPolling:!1})},pushEvent:async t=>{await fetch(`${window.TSCIRCUIT_FILESERVER_API_BASE_URL??""}/api/events/create`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)})},applyEditEventsAndUpdateManualEditsJson:async t=>{$W("applyEditEventsAndUpdateManualEditsJson",{editEvents:t});const n=e();if(!n.circuitJson)return;const r=n.fsMap.get("manual-edits.json"),a=r?JSON.parse(r):{},o=bBe({circuitJson:n.circuitJson,editEvents:t,manualEditsFile:a});$W("updatedManualEditsFileContent",o),i(s=>({lastManualEditsChangeSentAt:Date.now(),fsMap:new Map(s.fsMap).set("manual-edits.json",JSON.stringify(o))})),await zBe("manual-edits.json",JSON.stringify(o,null,2))},setSimulateScenarioOrder:t=>i({simulateScenarioOrder:t})}),{name:"run-frame-store"})),Hxt=SBe.extend("useEditEventController"),Yxt=()=>{const i=BB(m=>m.applyEditEventsAndUpdateManualEditsJson),[e,t]=it.useState([]),[n,r]=it.useState(!1),a=e.filter(m=>!m._applied),o=e.filter(m=>m._applied),s=n?e:a,l=it.useCallback(m=>{t(y=>[...y,{...m,_applied:!1}])},[]),u=it.useCallback(m=>{t(y=>y.map(x=>x===m?{...x,_applied:!0}:x))},[]),d=it.useCallback(()=>{t(m=>m.map(y=>({...y,_applied:!0})))},[]),f=it.useCallback(()=>{r(!0),e.length!==0&&(Hxt("removing edit events that are applied"),t(m=>m.filter(y=>!y._applied)))},[e]),p=it.useCallback(()=>{r(!1)},[]);return it.useEffect(()=>{if(e.filter(y=>!y._applied).length===0)return;const m=setTimeout(()=>{d(),i(e)},1e3);return()=>clearTimeout(m)},[e]),{unappliedEditEvents:a,appliedEditEvents:o,editEventsForRender:s,pushEditEvent:l,markEditEventApplied:u,markRenderStarted:f,markRenderComplete:p,markAllEditEventsApplied:d}};function Pm(i,e,{checkForDefaultPrevented:t=!0}={}){return function(r){if(i==null||i(r),t===!1||!r.defaultPrevented)return e==null?void 0:e(r)}}function Vxt(i,e){const t=it.createContext(e),n=a=>{const{children:o,...s}=a,l=it.useMemo(()=>s,Object.values(s));return Ke.jsx(t.Provider,{value:l,children:o})};n.displayName=i+"Provider";function r(a){const o=it.useContext(t);if(o)return o;if(e!==void 0)return e;throw new Error(`\`${a}\` must be used within \`${i}\``)}return[n,r]}function QQ(i,e=[]){let t=[];function n(a,o){const s=it.createContext(o),l=t.length;t=[...t,o];const u=f=>{var b;const{scope:p,children:m,...y}=f,x=((b=p==null?void 0:p[i])==null?void 0:b[l])||s,E=it.useMemo(()=>y,Object.values(y));return Ke.jsx(x.Provider,{value:E,children:m})};u.displayName=a+"Provider";function d(f,p){var x;const m=((x=p==null?void 0:p[i])==null?void 0:x[l])||s,y=it.useContext(m);if(y)return y;if(o!==void 0)return o;throw new Error(`\`${f}\` must be used within \`${a}\``)}return[u,d]}const r=()=>{const a=t.map(o=>it.createContext(o));return function(s){const l=(s==null?void 0:s[i])||a;return it.useMemo(()=>({[`__scope${i}`]:{...s,[i]:l}}),[s,l])}};return r.scopeName=i,[n,Kxt(r,...e)]}function Kxt(...i){const e=i[0];if(i.length===1)return e;const t=()=>{const n=i.map(r=>({useScope:r(),scopeName:r.scopeName}));return function(a){const o=n.reduce((s,{useScope:l,scopeName:u})=>{const f=l(a)[`__scope${u}`];return{...s,...f}},{});return it.useMemo(()=>({[`__scope${e.scopeName}`]:o}),[o])}};return t.scopeName=e.scopeName,t}function HBe(i,e){if(typeof i=="function")return i(e);i!=null&&(i.current=e)}function pG(...i){return e=>{let t=!1;const n=i.map(r=>{const a=HBe(r,e);return!t&&typeof a=="function"&&(t=!0),a});if(t)return()=>{for(let r=0;r<n.length;r++){const a=n[r];typeof a=="function"?a():HBe(i[r],null)}}}}function W_(...i){return it.useCallback(pG(...i),i)}function d5(i){const e=Jxt(i),t=it.forwardRef((n,r)=>{const{children:a,...o}=n,s=it.Children.toArray(a),l=s.find(Zxt);if(l){const u=l.props.children,d=s.map(f=>f===l?it.Children.count(u)>1?it.Children.only(null):it.isValidElement(u)?u.props.children:null:f);return Ke.jsx(e,{...o,ref:r,children:it.isValidElement(u)?it.cloneElement(u,void 0,d):null})}return Ke.jsx(e,{...o,ref:r,children:a})});return t.displayName=`${i}.Slot`,t}var jxt=d5("Slot");function Jxt(i){const e=it.forwardRef((t,n)=>{const{children:r,...a}=t;if(it.isValidElement(r)){const o=Wxt(r),s=Xxt(a,r.props);return r.type!==it.Fragment&&(s.ref=n?pG(n,o):o),it.cloneElement(r,s)}return it.Children.count(r)>1?it.Children.only(null):null});return e.displayName=`${i}.SlotClone`,e}var YBe=Symbol("radix.slottable");function qxt(i){const e=({children:t})=>Ke.jsx(Ke.Fragment,{children:t});return e.displayName=`${i}.Slottable`,e.__radixId=YBe,e}function Zxt(i){return it.isValidElement(i)&&typeof i.type=="function"&&"__radixId"in i.type&&i.type.__radixId===YBe}function Xxt(i,e){const t={...e};for(const n in e){const r=i[n],a=e[n];/^on[A-Z]/.test(n)?r&&a?t[n]=(...s)=>{const l=a(...s);return r(...s),l}:r&&(t[n]=r):n==="style"?t[n]={...r,...a}:n==="className"&&(t[n]=[r,a].filter(Boolean).join(" "))}return{...i,...t}}function Wxt(i){var n,r;let e=(n=Object.getOwnPropertyDescriptor(i.props,"ref"))==null?void 0:n.get,t=e&&"isReactWarning"in e&&e.isReactWarning;return t?i.ref:(e=(r=Object.getOwnPropertyDescriptor(i,"ref"))==null?void 0:r.get,t=e&&"isReactWarning"in e&&e.isReactWarning,t?i.props.ref:i.props.ref||i.ref)}function VBe(i){const e=i+"CollectionProvider",[t,n]=QQ(e),[r,a]=t(e,{collectionRef:{current:null},itemMap:new Map}),o=x=>{const{scope:E,children:b}=x,Q=Mf.useRef(null),M=Mf.useRef(new Map).current;return Ke.jsx(r,{scope:E,itemMap:M,collectionRef:Q,children:b})};o.displayName=e;const s=i+"CollectionSlot",l=d5(s),u=Mf.forwardRef((x,E)=>{const{scope:b,children:Q}=x,M=a(s,b),L=W_(E,M.collectionRef);return Ke.jsx(l,{ref:L,children:Q})});u.displayName=s;const d=i+"CollectionItemSlot",f="data-radix-collection-item",p=d5(d),m=Mf.forwardRef((x,E)=>{const{scope:b,children:Q,...M}=x,L=Mf.useRef(null),V=W_(E,L),Y=a(d,b);return Mf.useEffect(()=>(Y.itemMap.set(L,{ref:L,...M}),()=>void Y.itemMap.delete(L))),Ke.jsx(p,{[f]:"",ref:V,children:Q})});m.displayName=d;function y(x){const E=a(i+"CollectionConsumer",x);return Mf.useCallback(()=>{const Q=E.collectionRef.current;if(!Q)return[];const M=Array.from(Q.querySelectorAll(`[${f}]`));return Array.from(E.itemMap.values()).sort((Y,q)=>M.indexOf(Y.ref.current)-M.indexOf(q.ref.current))},[E.collectionRef,E.itemMap])}return[{Provider:o,Slot:u,ItemSlot:m},y,n]}var aM=globalThis!=null&&globalThis.document?it.useLayoutEffect:()=>{},$xt=Oye[" useId ".trim().toString()]||(()=>{}),eBt=0;function MQ(i){const[e,t]=it.useState($xt());return aM(()=>{t(n=>n??String(eBt++))},[i]),e?`radix-${e}`:""}var t$=Uye();const KBe=g_(t$);var tBt=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],e1=tBt.reduce((i,e)=>{const t=d5(`Primitive.${e}`),n=it.forwardRef((r,a)=>{const{asChild:o,...s}=r,l=o?t:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),Ke.jsx(l,{...s,ref:a})});return n.displayName=`Primitive.${e}`,{...i,[e]:n}},{});function jBe(i,e){i&&t$.flushSync(()=>i.dispatchEvent(e))}function vw(i){const e=it.useRef(i);return it.useEffect(()=>{e.current=i}),it.useMemo(()=>(...t)=>{var n;return(n=e.current)==null?void 0:n.call(e,...t)},[])}var nBt=Oye[" useInsertionEffect ".trim().toString()]||aM;function f5({prop:i,defaultProp:e,onChange:t=()=>{},caller:n}){const[r,a,o]=iBt({defaultProp:e,onChange:t}),s=i!==void 0,l=s?i:r;{const d=it.useRef(i!==void 0);it.useEffect(()=>{const f=d.current;f!==s&&console.warn(`${n} is changing from ${f?"controlled":"uncontrolled"} to ${s?"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.`),d.current=s},[s,n])}const u=it.useCallback(d=>{var f;if(s){const p=rBt(d)?d(i):d;p!==i&&((f=o.current)==null||f.call(o,p))}else a(d)},[s,i,a,o]);return[l,u]}function iBt({defaultProp:i,onChange:e}){const[t,n]=it.useState(i),r=it.useRef(t),a=it.useRef(e);return nBt(()=>{a.current=e},[e]),it.useEffect(()=>{var o;r.current!==t&&((o=a.current)==null||o.call(a,t),r.current=t)},[t,r]),[t,n,a]}function rBt(i){return typeof i=="function"}var aBt=it.createContext(void 0);function n$(i){const e=it.useContext(aBt);return i||e||"ltr"}var i$="rovingFocusGroup.onEntryFocus",oBt={bubbles:!1,cancelable:!0},M4="RovingFocusGroup",[r$,JBe,sBt]=VBe(M4),[lBt,gG]=QQ(M4,[sBt]),[cBt,uBt]=lBt(M4),qBe=it.forwardRef((i,e)=>Ke.jsx(r$.Provider,{scope:i.__scopeRovingFocusGroup,children:Ke.jsx(r$.Slot,{scope:i.__scopeRovingFocusGroup,children:Ke.jsx(ABt,{...i,ref:e})})}));qBe.displayName=M4;var ABt=it.forwardRef((i,e)=>{const{__scopeRovingFocusGroup:t,orientation:n,loop:r=!1,dir:a,currentTabStopId:o,defaultCurrentTabStopId:s,onCurrentTabStopIdChange:l,onEntryFocus:u,preventScrollOnEntryFocus:d=!1,...f}=i,p=it.useRef(null),m=W_(e,p),y=n$(a),[x,E]=f5({prop:o,defaultProp:s??null,onChange:l,caller:M4}),[b,Q]=it.useState(!1),M=vw(u),L=JBe(t),V=it.useRef(!1),[Y,q]=it.useState(0);return it.useEffect(()=>{const K=p.current;if(K)return K.addEventListener(i$,M),()=>K.removeEventListener(i$,M)},[M]),Ke.jsx(cBt,{scope:t,orientation:n,dir:y,loop:r,currentTabStopId:x,onItemFocus:it.useCallback(K=>E(K),[E]),onItemShiftTab:it.useCallback(()=>Q(!0),[]),onFocusableItemAdd:it.useCallback(()=>q(K=>K+1),[]),onFocusableItemRemove:it.useCallback(()=>q(K=>K-1),[]),children:Ke.jsx(e1.div,{tabIndex:b||Y===0?-1:0,"data-orientation":n,...f,ref:m,style:{outline:"none",...i.style},onMouseDown:Pm(i.onMouseDown,()=>{V.current=!0}),onFocus:Pm(i.onFocus,K=>{const $=!V.current;if(K.target===K.currentTarget&&$&&!b){const j=new CustomEvent(i$,oBt);if(K.currentTarget.dispatchEvent(j),!j.defaultPrevented){const ue=L().filter(he=>he.focusable),ce=ue.find(he=>he.active),le=ue.find(he=>he.id===x),ye=[ce,le,...ue].filter(Boolean).map(he=>he.ref.current);WBe(ye,d)}}V.current=!1}),onBlur:Pm(i.onBlur,()=>Q(!1))})})}),ZBe="RovingFocusGroupItem",XBe=it.forwardRef((i,e)=>{const{__scopeRovingFocusGroup:t,focusable:n=!0,active:r=!1,tabStopId:a,children:o,...s}=i,l=MQ(),u=a||l,d=uBt(ZBe,t),f=d.currentTabStopId===u,p=JBe(t),{onFocusableItemAdd:m,onFocusableItemRemove:y,currentTabStopId:x}=d;return it.useEffect(()=>{if(n)return m(),()=>y()},[n,m,y]),Ke.jsx(r$.ItemSlot,{scope:t,id:u,focusable:n,active:r,children:Ke.jsx(e1.span,{tabIndex:f?0:-1,"data-orientation":d.orientation,...s,ref:e,onMouseDown:Pm(i.onMouseDown,E=>{n?d.onItemFocus(u):E.preventDefault()}),onFocus:Pm(i.onFocus,()=>d.onItemFocus(u)),onKeyDown:Pm(i.onKeyDown,E=>{if(E.key==="Tab"&&E.shiftKey){d.onItemShiftTab();return}if(E.target!==E.currentTarget)return;const b=hBt(E,d.orientation,d.dir);if(b!==void 0){if(E.metaKey||E.ctrlKey||E.altKey||E.shiftKey)return;E.preventDefault();let M=p().filter(L=>L.focusable).map(L=>L.ref.current);if(b==="last")M.reverse();else if(b==="prev"||b==="next"){b==="prev"&&M.reverse();const L=M.indexOf(E.currentTarget);M=d.loop?pBt(M,L+1):M.slice(L+1)}setTimeout(()=>WBe(M))}}),children:typeof o=="function"?o({isCurrentTabStop:f,hasTabStop:x!=null}):o})})});XBe.displayName=ZBe;var dBt={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function fBt(i,e){return e!=="rtl"?i:i==="ArrowLeft"?"ArrowRight":i==="ArrowRight"?"ArrowLeft":i}function hBt(i,e,t){const n=fBt(i.key,t);if(!(e==="vertical"&&["ArrowLeft","ArrowRight"].includes(n))&&!(e==="horizontal"&&["ArrowUp","ArrowDown"].includes(n)))return dBt[n]}function WBe(i,e=!1){const t=document.activeElement;for(const n of i)if(n===t||(n.focus({preventScroll:e}),document.activeElement!==t))return}function pBt(i,e){return i.map((t,n)=>i[(e+n)%i.length])}var $Be=qBe,eSe=XBe;function gBt(i,e){return it.useReducer((t,n)=>e[t][n]??t,i)}var Cw=i=>{const{present:e,children:t}=i,n=mBt(e),r=typeof t=="function"?t({present:n.isPresent}):it.Children.only(t),a=W_(n.ref,yBt(r));return typeof t=="function"||n.isPresent?it.cloneElement(r,{ref:a}):null};Cw.displayName="Presence";function mBt(i){const[e,t]=it.useState(),n=it.useRef(null),r=it.useRef(i),a=it.useRef("none"),o=i?"mounted":"unmounted",[s,l]=gBt(o,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return it.useEffect(()=>{const u=mG(n.current);a.current=s==="mounted"?u:"none"},[s]),aM(()=>{const u=n.current,d=r.current;if(d!==i){const p=a.current,m=mG(u);i?l("MOUNT"):m==="none"||(u==null?void 0:u.display)==="none"?l("UNMOUNT"):l(d&&p!==m?"ANIMATION_OUT":"UNMOUNT"),r.current=i}},[i,l]),aM(()=>{if(e){let u;const d=e.ownerDocument.defaultView??window,f=m=>{const x=mG(n.current).includes(m.animationName);if(m.target===e&&x&&(l("ANIMATION_END"),!r.current)){const E=e.style.animationFillMode;e.style.animationFillMode="forwards",u=d.setTimeout(()=>{e.style.animationFillMode==="forwards"&&(e.style.animationFillMode=E)})}},p=m=>{m.target===e&&(a.current=mG(n.current))};return e.addEventListener("animationstart",p),e.addEventListener("animationcancel",f),e.addEventListener("animationend",f),()=>{d.clearTimeout(u),e.removeEventListener("animationstart",p),e.removeEventListener("animationcancel",f),e.removeEventListener("animationend",f)}}else l("ANIMATION_END")},[e,l]),{isPresent:["mounted","unmountSuspended"].includes(s),ref:it.useCallback(u=>{n.current=u?getComputedStyle(u):null,t(u)},[])}}function mG(i){return(i==null?void 0:i.animationName)||"none"}function yBt(i){var n,r;let e=(n=Object.getOwnPropertyDescriptor(i.props,"ref"))==null?void 0:n.get,t=e&&"isReactWarning"in e&&e.isReactWarning;return t?i.ref:(e=(r=Object.getOwnPropertyDescriptor(i,"ref"))==null?void 0:r.get,t=e&&"isReactWarning"in e&&e.isReactWarning,t?i.props.ref:i.props.ref||i.ref)}var yG="Tabs",[vBt,j1n]=QQ(yG,[gG]),tSe=gG(),[CBt,a$]=vBt(yG),nSe=it.forwardRef((i,e)=>{const{__scopeTabs:t,value:n,onValueChange:r,defaultValue:a,orientation:o="horizontal",dir:s,activationMode:l="automatic",...u}=i,d=n$(s),[f,p]=f5({prop:n,onChange:r,defaultProp:a??"",caller:yG});return Ke.jsx(CBt,{scope:t,baseId:MQ(),value:f,onValueChange:p,orientation:o,dir:d,activationMode:l,children:Ke.jsx(e1.div,{dir:d,"data-orientation":o,...u,ref:e})})});nSe.displayName=yG;var iSe="TabsList",rSe=it.forwardRef((i,e)=>{const{__scopeTabs:t,loop:n=!0,...r}=i,a=a$(iSe,t),o=tSe(t);return Ke.jsx($Be,{asChild:!0,...o,orientation:a.orientation,dir:a.dir,loop:n,children:Ke.jsx(e1.div,{role:"tablist","aria-orientation":a.orientation,...r,ref:e})})});rSe.displayName=iSe;var aSe="TabsTrigger",oSe=it.forwardRef((i,e)=>{const{__scopeTabs:t,value:n,disabled:r=!1,...a}=i,o=a$(aSe,t),s=tSe(t),l=cSe(o.baseId,n),u=uSe(o.baseId,n),d=n===o.value;return Ke.jsx(eSe,{asChild:!0,...s,focusable:!r,active:d,children:Ke.jsx(e1.button,{type:"button",role:"tab","aria-selected":d,"aria-controls":u,"data-state":d?"active":"inactive","data-disabled":r?"":void 0,disabled:r,id:l,...a,ref:e,onMouseDown:Pm(i.onMouseDown,f=>{!r&&f.button===0&&f.ctrlKey===!1?o.onValueChange(n):f.preventDefault()}),onKeyDown:Pm(i.onKeyDown,f=>{[" ","Enter"].includes(f.key)&&o.onValueChange(n)}),onFocus:Pm(i.onFocus,()=>{const f=o.activationMode!=="manual";!d&&!r&&f&&o.onValueChange(n)})})})});oSe.displayName=aSe;var sSe="TabsContent",lSe=it.forwardRef((i,e)=>{const{__scopeTabs:t,value:n,forceMount:r,children:a,...o}=i,s=a$(sSe,t),l=cSe(s.baseId,n),u=uSe(s.baseId,n),d=n===s.value,f=it.useRef(d);return it.useEffect(()=>{const p=requestAnimationFrame(()=>f.current=!1);return()=>cancelAnimationFrame(p)},[]),Ke.jsx(Cw,{present:r||d,children:({present:p})=>Ke.jsx(e1.div,{"data-state":d?"active":"inactive","data-orientation":s.orientation,role:"tabpanel","aria-labelledby":l,hidden:!p,id:u,tabIndex:0,...o,ref:e,style:{...i.style,animationDuration:f.current?"0s":void 0},children:p&&a})})});lSe.displayName=sSe;function cSe(i,e){return`${i}-trigger-${e}`}function uSe(i,e){return`${i}-content-${e}`}var IBt=nSe,ASe=rSe,dSe=oSe,fSe=lSe;function hSe(i){var e,t,n="";if(typeof i=="string"||typeof i=="number")n+=i;else if(typeof i=="object")if(Array.isArray(i)){var r=i.length;for(e=0;e<r;e++)i[e]&&(t=hSe(i[e]))&&(n&&(n+=" "),n+=t)}else for(t in i)i[t]&&(n&&(n+=" "),n+=t);return n}function Iw(){for(var i,e,t=0,n="",r=arguments.length;t<r;t++)(i=arguments[t])&&(e=hSe(i))&&(n&&(n+=" "),n+=e);return n}const o$="-",_Bt=i=>{const e=bBt(i),{conflictingClassGroups:t,conflictingClassGroupModifiers:n}=i;return{getClassGroupId:o=>{const s=o.split(o$);return s[0]===""&&s.length!==1&&s.shift(),pSe(s,e)||EBt(o)},getConflictingClassGroupIds:(o,s)=>{const l=t[o]||[];return s&&n[o]?[...l,...n[o]]:l}}},pSe=(i,e)=>{var o;if(i.length===0)return e.classGroupId;const t=i[0],n=e.nextPart.get(t),r=n?pSe(i.slice(1),n):void 0;if(r)return r;if(e.validators.length===0)return;const a=i.join(o$);return(o=e.validators.find(({validator:s})=>s(a)))==null?void 0:o.classGroupId},gSe=/^\[(.+)\]$/,EBt=i=>{if(gSe.test(i)){const e=gSe.exec(i)[1],t=e==null?void 0:e.substring(0,e.indexOf(":"));if(t)return"arbitrary.."+t}},bBt=i=>{const{theme:e,prefix:t}=i,n={nextPart:new Map,validators:[]};return BBt(Object.entries(i.classGroups),t).forEach(([a,o])=>{s$(o,n,a,e)}),n},s$=(i,e,t,n)=>{i.forEach(r=>{if(typeof r=="string"){const a=r===""?e:mSe(e,r);a.classGroupId=t;return}if(typeof r=="function"){if(xBt(r)){s$(r(n),e,t,n);return}e.validators.push({validator:r,classGroupId:t});return}Object.entries(r).forEach(([a,o])=>{s$(o,mSe(e,a),t,n)})})},mSe=(i,e)=>{let t=i;return e.split(o$).forEach(n=>{t.nextPart.has(n)||t.nextPart.set(n,{nextPart:new Map,validators:[]}),t=t.nextPart.get(n)}),t},xBt=i=>i.isThemeGetter,BBt=(i,e)=>e?i.map(([t,n])=>{const r=n.map(a=>typeof a=="string"?e+a:typeof a=="object"?Object.fromEntries(Object.entries(a).map(([o,s])=>[e+o,s])):a);return[t,r]}):i,SBt=i=>{if(i<1)return{get:()=>{},set:()=>{}};let e=0,t=new Map,n=new Map;const r=(a,o)=>{t.set(a,o),e++,e>i&&(e=0,n=t,t=new Map)};return{get(a){let o=t.get(a);if(o!==void 0)return o;if((o=n.get(a))!==void 0)return r(a,o),o},set(a,o){t.has(a)?t.set(a,o):r(a,o)}}},ySe="!",wBt=i=>{const{separator:e,experimentalParseClassName:t}=i,n=e.length===1,r=e[0],a=e.length,o=s=>{const l=[];let u=0,d=0,f;for(let E=0;E<s.length;E++){let b=s[E];if(u===0){if(b===r&&(n||s.slice(E,E+a)===e)){l.push(s.slice(d,E)),d=E+a;continue}if(b==="/"){f=E;continue}}b==="["?u++:b==="]"&&u--}const p=l.length===0?s:s.substring(d),m=p.startsWith(ySe),y=m?p.substring(1):p,x=f&&f>d?f-d:void 0;return{modifiers:l,hasImportantModifier:m,baseClassName:y,maybePostfixModifierPosition:x}};return t?s=>t({className:s,parseClassName:o}):o},QBt=i=>{if(i.length<=1)return i;const e=[];let t=[];return i.forEach(n=>{n[0]==="["?(e.push(...t.sort(),n),t=[]):t.push(n)}),e.push(...t.sort()),e},MBt=i=>({cache:SBt(i.cacheSize),parseClassName:wBt(i),..._Bt(i)}),RBt=/\s+/,DBt=(i,e)=>{const{parseClassName:t,getClassGroupId:n,getConflictingClassGroupIds:r}=e,a=[],o=i.trim().split(RBt);let s="";for(let l=o.length-1;l>=0;l-=1){const u=o[l],{modifiers:d,hasImportantModifier:f,baseClassName:p,maybePostfixModifierPosition:m}=t(u);let y=!!m,x=n(y?p.substring(0,m):p);if(!x){if(!y){s=u+(s.length>0?" "+s:s);continue}if(x=n(p),!x){s=u+(s.length>0?" "+s:s);continue}y=!1}const E=QBt(d).join(":"),b=f?E+ySe:E,Q=b+x;if(a.includes(Q))continue;a.push(Q);const M=r(x,y);for(let L=0;L<M.length;++L){const V=M[L];a.push(b+V)}s=u+(s.length>0?" "+s:s)}return s};function NBt(){let i=0,e,t,n="";for(;i<arguments.length;)(e=arguments[i++])&&(t=vSe(e))&&(n&&(n+=" "),n+=t);return n}const vSe=i=>{if(typeof i=="string")return i;let e,t="";for(let n=0;n<i.length;n++)i[n]&&(e=vSe(i[n]))&&(t&&(t+=" "),t+=e);return t};function TBt(i,...e){let t,n,r,a=o;function o(l){const u=e.reduce((d,f)=>f(d),i());return t=MBt(u),n=t.cache.get,r=t.cache.set,a=s,s(l)}function s(l){const u=n(l);if(u)return u;const d=DBt(l,t);return r(l,d),d}return function(){return a(NBt.apply(null,arguments))}}const J1=i=>{const e=t=>t[i]||[];return e.isThemeGetter=!0,e},CSe=/^\[(?:([a-z-]+):)?(.+)\]$/i,UBt=/^\d+\/\d+$/,PBt=new Set(["px","full","screen"]),LBt=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,kBt=/\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$/,GBt=/^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/,FBt=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,OBt=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,RQ=i=>h5(i)||PBt.has(i)||UBt.test(i),oM=i=>p5(i,"length",qBt),h5=i=>!!i&&!Number.isNaN(Number(i)),l$=i=>p5(i,"number",h5),R4=i=>!!i&&Number.isInteger(Number(i)),zBt=i=>i.endsWith("%")&&h5(i.slice(0,-1)),L0=i=>CSe.test(i),sM=i=>LBt.test(i),HBt=new Set(["length","size","percentage"]),YBt=i=>p5(i,HBt,ISe),VBt=i=>p5(i,"position",ISe),KBt=new Set(["image","url"]),jBt=i=>p5(i,KBt,XBt),JBt=i=>p5(i,"",ZBt),D4=()=>!0,p5=(i,e,t)=>{const n=CSe.exec(i);return n?n[1]?typeof e=="string"?n[1]===e:e.has(n[1]):t(n[2]):!1},qBt=i=>kBt.test(i)&&!GBt.test(i),ISe=()=>!1,ZBt=i=>FBt.test(i),XBt=i=>OBt.test(i),WBt=TBt(()=>{const i=J1("colors"),e=J1("spacing"),t=J1("blur"),n=J1("brightness"),r=J1("borderColor"),a=J1("borderRadius"),o=J1("borderSpacing"),s=J1("borderWidth"),l=J1("contrast"),u=J1("grayscale"),d=J1("hueRotate"),f=J1("invert"),p=J1("gap"),m=J1("gradientColorStops"),y=J1("gradientColorStopPositions"),x=J1("inset"),E=J1("margin"),b=J1("opacity"),Q=J1("padding"),M=J1("saturate"),L=J1("scale"),V=J1("sepia"),Y=J1("skew"),q=J1("space"),K=J1("translate"),$=()=>["auto","contain","none"],j=()=>["auto","hidden","clip","visible","scroll"],ue=()=>["auto",L0,e],ce=()=>[L0,e],le=()=>["",RQ,oM],_e=()=>["auto",h5,L0],ye=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],he=()=>["solid","dashed","dotted","double","none"],xe=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],Ie=()=>["start","end","center","between","around","evenly","stretch"],Te=()=>["","0",L0],Qe=()=>["auto","avoid","all","avoid-page","page","left","right","column"],Le=()=>[h5,L0];return{cacheSize:500,separator:":",theme:{colors:[D4],spacing:[RQ,oM],blur:["none","",sM,L0],brightness:Le(),borderColor:[i],borderRadius:["none","","full",sM,L0],borderSpacing:ce(),borderWidth:le(),contrast:Le(),grayscale:Te(),hueRotate:Le(),invert:Te(),gap:ce(),gradientColorStops:[i],gradientColorStopPositions:[zBt,oM],inset:ue(),margin:ue(),opacity:Le(),padding:ce(),saturate:Le(),scale:Le(),sepia:Te(),skew:Le(),space:ce(),translate:ce()},classGroups:{aspect:[{aspect:["auto","square","video",L0]}],container:["container"],columns:[{columns:[sM]}],"break-after":[{"break-after":Qe()}],"break-before":[{"break-before":Qe()}],"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:[...ye(),L0]}],overflow:[{overflow:j()}],"overflow-x":[{"overflow-x":j()}],"overflow-y":[{"overflow-y":j()}],overscroll:[{overscroll:$()}],"overscroll-x":[{"overscroll-x":$()}],"overscroll-y":[{"overscroll-y":$()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[x]}],"inset-x":[{"inset-x":[x]}],"inset-y":[{"inset-y":[x]}],start:[{start:[x]}],end:[{end:[x]}],top:[{top:[x]}],right:[{right:[x]}],bottom:[{bottom:[x]}],left:[{left:[x]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",R4,L0]}],basis:[{basis:ue()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",L0]}],grow:[{grow:Te()}],shrink:[{shrink:Te()}],order:[{order:["first","last","none",R4,L0]}],"grid-cols":[{"grid-cols":[D4]}],"col-start-end":[{col:["auto",{span:["full",R4,L0]},L0]}],"col-start":[{"col-start":_e()}],"col-end":[{"col-end":_e()}],"grid-rows":[{"grid-rows":[D4]}],"row-start-end":[{row:["auto",{span:[R4,L0]},L0]}],"row-start":[{"row-start":_e()}],"row-end":[{"row-end":_e()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",L0]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",L0]}],gap:[{gap:[p]}],"gap-x":[{"gap-x":[p]}],"gap-y":[{"gap-y":[p]}],"justify-content":[{justify:["normal",...Ie()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...Ie(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...Ie(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[Q]}],px:[{px:[Q]}],py:[{py:[Q]}],ps:[{ps:[Q]}],pe:[{pe:[Q]}],pt:[{pt:[Q]}],pr:[{pr:[Q]}],pb:[{pb:[Q]}],pl:[{pl:[Q]}],m:[{m:[E]}],mx:[{mx:[E]}],my:[{my:[E]}],ms:[{ms:[E]}],me:[{me:[E]}],mt:[{mt:[E]}],mr:[{mr:[E]}],mb:[{mb:[E]}],ml:[{ml:[E]}],"space-x":[{"space-x":[q]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[q]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",L0,e]}],"min-w":[{"min-w":[L0,e,"min","max","fit"]}],"max-w":[{"max-w":[L0,e,"none","full","min","max","fit","prose",{screen:[sM]},sM]}],h:[{h:[L0,e,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[L0,e,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[L0,e,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[L0,e,"auto","min","max","fit"]}],"font-size":[{text:["base",sM,oM]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",l$]}],"font-family":[{font:[D4]}],"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",L0]}],"line-clamp":[{"line-clamp":["none",h5,l$]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",RQ,L0]}],"list-image":[{"list-image":["none",L0]}],"list-style-type":[{list:["none","disc","decimal",L0]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[i]}],"placeholder-opacity":[{"placeholder-opacity":[b]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[i]}],"text-opacity":[{"text-opacity":[b]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...he(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",RQ,oM]}],"underline-offset":[{"underline-offset":["auto",RQ,L0]}],"text-decoration-color":[{decoration:[i]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:ce()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",L0]}],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",L0]}],"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:[...ye(),VBt]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",YBt]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},jBt]}],"bg-color":[{bg:[i]}],"gradient-from-pos":[{from:[y]}],"gradient-via-pos":[{via:[y]}],"gradient-to-pos":[{to:[y]}],"gradient-from":[{from:[m]}],"gradient-via":[{via:[m]}],"gradient-to":[{to:[m]}],rounded:[{rounded:[a]}],"rounded-s":[{"rounded-s":[a]}],"rounded-e":[{"rounded-e":[a]}],"rounded-t":[{"rounded-t":[a]}],"rounded-r":[{"rounded-r":[a]}],"rounded-b":[{"rounded-b":[a]}],"rounded-l":[{"rounded-l":[a]}],"rounded-ss":[{"rounded-ss":[a]}],"rounded-se":[{"rounded-se":[a]}],"rounded-ee":[{"rounded-ee":[a]}],"rounded-es":[{"rounded-es":[a]}],"rounded-tl":[{"rounded-tl":[a]}],"rounded-tr":[{"rounded-tr":[a]}],"rounded-br":[{"rounded-br":[a]}],"rounded-bl":[{"rounded-bl":[a]}],"border-w":[{border:[s]}],"border-w-x":[{"border-x":[s]}],"border-w-y":[{"border-y":[s]}],"border-w-s":[{"border-s":[s]}],"border-w-e":[{"border-e":[s]}],"border-w-t":[{"border-t":[s]}],"border-w-r":[{"border-r":[s]}],"border-w-b":[{"border-b":[s]}],"border-w-l":[{"border-l":[s]}],"border-opacity":[{"border-opacity":[b]}],"border-style":[{border:[...he(),"hidden"]}],"divide-x":[{"divide-x":[s]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[s]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[b]}],"divide-style":[{divide:he()}],"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:["",...he()]}],"outline-offset":[{"outline-offset":[RQ,L0]}],"outline-w":[{outline:[RQ,oM]}],"outline-color":[{outline:[i]}],"ring-w":[{ring:le()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[i]}],"ring-opacity":[{"ring-opacity":[b]}],"ring-offset-w":[{"ring-offset":[RQ,oM]}],"ring-offset-color":[{"ring-offset":[i]}],shadow:[{shadow:["","inner","none",sM,JBt]}],"shadow-color":[{shadow:[D4]}],opacity:[{opacity:[b]}],"mix-blend":[{"mix-blend":[...xe(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":xe()}],filter:[{filter:["","none"]}],blur:[{blur:[t]}],brightness:[{brightness:[n]}],contrast:[{contrast:[l]}],"drop-shadow":[{"drop-shadow":["","none",sM,L0]}],grayscale:[{grayscale:[u]}],"hue-rotate":[{"hue-rotate":[d]}],invert:[{invert:[f]}],saturate:[{saturate:[M]}],sepia:[{sepia:[V]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[t]}],"backdrop-brightness":[{"backdrop-brightness":[n]}],"backdrop-contrast":[{"backdrop-contrast":[l]}],"backdrop-grayscale":[{"backdrop-grayscale":[u]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[d]}],"backdrop-invert":[{"backdrop-invert":[f]}],"backdrop-opacity":[{"backdrop-opacity":[b]}],"backdrop-saturate":[{"backdrop-saturate":[M]}],"backdrop-sepia":[{"backdrop-sepia":[V]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[o]}],"border-spacing-x":[{"border-spacing-x":[o]}],"border-spacing-y":[{"border-spacing-y":[o]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",L0]}],duration:[{duration:Le()}],ease:[{ease:["linear","in","out","in-out",L0]}],delay:[{delay:Le()}],animate:[{animate:["none","spin","ping","pulse","bounce",L0]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[L]}],"scale-x":[{"scale-x":[L]}],"scale-y":[{"scale-y":[L]}],rotate:[{rotate:[R4,L0]}],"translate-x":[{"translate-x":[K]}],"translate-y":[{"translate-y":[K]}],"skew-x":[{"skew-x":[Y]}],"skew-y":[{"skew-y":[Y]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",L0]}],accent:[{accent:["auto",i]}],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",L0]}],"caret-color":[{caret:[i]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":ce()}],"scroll-mx":[{"scroll-mx":ce()}],"scroll-my":[{"scroll-my":ce()}],"scroll-ms":[{"scroll-ms":ce()}],"scroll-me":[{"scroll-me":ce()}],"scroll-mt":[{"scroll-mt":ce()}],"scroll-mr":[{"scroll-mr":ce()}],"scroll-mb":[{"scroll-mb":ce()}],"scroll-ml":[{"scroll-ml":ce()}],"scroll-p":[{"scroll-p":ce()}],"scroll-px":[{"scroll-px":ce()}],"scroll-py":[{"scroll-py":ce()}],"scroll-ps":[{"scroll-ps":ce()}],"scroll-pe":[{"scroll-pe":ce()}],"scroll-pt":[{"scroll-pt":ce()}],"scroll-pr":[{"scroll-pr":ce()}],"scroll-pb":[{"scroll-pb":ce()}],"scroll-pl":[{"scroll-pl":ce()}],"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",L0]}],fill:[{fill:[i,"none"]}],"stroke-w":[{stroke:[RQ,oM,l$]}],stroke:[{stroke:[i,"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 Qo=typeof window<"u"?window:void 0,tB=typeof globalThis<"u"?globalThis:Qo,_Se=Array.prototype,ESe=_Se.forEach,bSe=_Se.indexOf,SB=tB==null?void 0:tB.navigator,Af=tB==null?void 0:tB.document,nB=tB==null?void 0:tB.location,c$=tB==null?void 0:tB.fetch,u$=tB!=null&&tB.XMLHttpRequest&&"withCredentials"in new tB.XMLHttpRequest?tB.XMLHttpRequest:void 0,xSe=tB==null?void 0:tB.AbortController,iB=SB==null?void 0:SB.userAgent,k0=Qo??{},DQ={DEBUG:!1,LIB_VERSION:"1.253.4"},A$="$copy_autocapture",$Bt=["$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"],NQ=function(i){return i.GZipJS="gzip-js",i.Base64="base64",i}({}),eSt=["fatal","error","warning","log","info","debug"];function My(i,e){return i.indexOf(e)!==-1}var vG=function(i){return i.trim()},d$=function(i){return i.replace(/^\$/,"")},tSt=Array.isArray,BSe=Object.prototype,SSe=BSe.hasOwnProperty,CG=BSe.toString,o_=tSt||function(i){return CG.call(i)==="[object Array]"},tS=i=>typeof i=="function",k_=i=>i===Object(i)&&!o_(i),g5=i=>{if(k_(i)){for(var e in i)if(SSe.call(i,e))return!1;return!0}return!1},ed=i=>i===void 0,G_=i=>CG.call(i)=="[object String]",f$=i=>G_(i)&&i.trim().length===0,lM=i=>i===null,BC=i=>ed(i)||lM(i),ox=i=>CG.call(i)=="[object Number]",_w=i=>CG.call(i)==="[object Boolean]",nSt=i=>i instanceof FormData,iSt=i=>My($Bt,i),wSe=i=>{var e={t:function(t){if(Qo&&(DQ.DEBUG||k0.POSTHOG_DEBUG)&&!ed(Qo.console)&&Qo.console){for(var n=("__rrweb_original__"in Qo.console[t])?Qo.console[t].__rrweb_original__:Qo.console[t],r=arguments.length,a=new Array(r>1?r-1:0),o=1;o<r;o++)a[o-1]=arguments[o];n(i,...a)}},info:function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];e.t("log",...n)},warn:function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];e.t("warn",...n)},error:function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];e.t("error",...n)},critical:function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];console.error(i,...n)},uninitializedWarning:t=>{e.error("You must initialize PostHog before calling "+t)},createLogger:t=>wSe(i+" "+t)};return e},Pf=wSe("[PostHog.js]"),Mb=Pf.createLogger,rSt=Mb("[ExternalScriptsLoader]"),QSe=(i,e,t)=>{if(i.config.disable_external_dependency_loading)return rSt.warn(e+" was requested but loading of external scripts is disabled."),t("Loading of external scripts is disabled");var n=Af==null?void 0:Af.querySelectorAll("script");if(n){for(var r=0;r<n.length;r++)if(n[r].src===e)return t()}var a=()=>{if(!Af)return t("document not found");var o=Af.createElement("script");if(o.type="text/javascript",o.crossOrigin="anonymous",o.src=e,o.onload=u=>t(void 0,u),o.onerror=u=>t(u),i.config.prepare_external_dependency_script&&(o=i.config.prepare_external_dependency_script(o)),!o)return t("prepare_external_dependency_script returned null");var s,l=Af.querySelectorAll("body > script");l.length>0?(s=l[0].parentNode)==null||s.insertBefore(o,l[0]):Af.body.appendChild(o)};Af!=null&&Af.body?a():Af==null||Af.addEventListener("DOMContentLoaded",a)};function Wd(){return Wd=Object.assign?Object.assign.bind():function(i){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var n in t)({}).hasOwnProperty.call(t,n)&&(i[n]=t[n])}return i},Wd.apply(null,arguments)}function MSe(i,e){if(i==null)return{};var t={};for(var n in i)if({}.hasOwnProperty.call(i,n)){if(e.indexOf(n)!==-1)continue;t[n]=i[n]}return t}k0.__PosthogExtensions__=k0.__PosthogExtensions__||{},k0.__PosthogExtensions__.loadExternalDependency=(i,e,t)=>{var n="/static/"+e+".js?v="+i.version;if(e==="remote-config"&&(n="/array/"+i.config.token+"/config.js"),e==="toolbar"){var r=3e5;n=n+"&t="+Math.floor(Date.now()/r)*r}var a=i.requestRouter.endpointFor("assets",n);QSe(i,a,t)},k0.__PosthogExtensions__.loadSiteApp=(i,e,t)=>{var n=i.requestRouter.endpointFor("api",e);QSe(i,n,t)};var IG={};function cM(i,e,t){if(o_(i)){if(ESe&&i.forEach===ESe)i.forEach(e,t);else if("length"in i&&i.length===+i.length){for(var n=0,r=i.length;n<r;n++)if(n in i&&e.call(t,i[n],n)===IG)return}}}function t1(i,e,t){if(!BC(i)){if(o_(i))return cM(i,e,t);if(nSt(i)){for(var n of i.entries())if(e.call(t,n[1],n[0])===IG)return}else for(var r in i)if(SSe.call(i,r)&&e.call(t,i[r],r)===IG)return}}var EE=function(i){for(var e=arguments.length,t=new Array(e>1?e-1:0),n=1;n<e;n++)t[n-1]=arguments[n];return cM(t,function(r){for(var a in r)r[a]!==void 0&&(i[a]=r[a])}),i},_G=function(i){for(var e=arguments.length,t=new Array(e>1?e-1:0),n=1;n<e;n++)t[n-1]=arguments[n];return cM(t,function(r){cM(r,function(a){i.push(a)})}),i};function EG(i){for(var e=Object.keys(i),t=e.length,n=new Array(t);t--;)n[t]=[e[t],i[e[t]]];return n}var RSe=function(i){try{return i()}catch{return}},aSt=function(i){return function(){try{for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return i.apply(this,t)}catch(r){Pf.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),Pf.critical(r)}}},h$=function(i){var e={};return t1(i,function(t,n){(G_(t)&&t.length>0||ox(t))&&(e[n]=t)}),e};function oSt(i,e){return t=i,n=a=>G_(a)&&!lM(e)?a.slice(0,e):a,r=new Set,function a(o,s){return o!==Object(o)?n?n(o,s):o:r.has(o)?void 0:(r.add(o),o_(o)?(l=[],cM(o,u=>{l.push(a(u))})):(l={},t1(o,(u,d)=>{r.has(u)||(l[d]=a(u,d))})),l);var l}(t);var t,n,r}var sSt=["herokuapp.com","vercel.app","netlify.app"];function lSt(i){var e=i==null?void 0:i.hostname;if(!G_(e))return!1;var t=e.split(".").slice(-2).join(".");for(var n of sSt)if(t===n)return!1;return!0}function DSe(i,e){for(var t=0;t<i.length;t++)if(e(i[t]))return i[t]}function v_(i,e,t,n){var{capture:r=!1,passive:a=!0}=n??{};i==null||i.addEventListener(e,t,{capture:r,passive:a})}var NSe="$people_distinct_id",N4="__alias",T4="__timers",TSe="$autocapture_disabled_server_side",p$="$heatmaps_enabled_server_side",USe="$exception_capture_enabled_server_side",g$="$error_tracking_suppression_rules",PSe="$web_vitals_enabled_server_side",LSe="$dead_clicks_enabled_server_side",kSe="$web_vitals_allowed_metrics",m$="$session_recording_enabled_server_side",GSe="$console_log_recording_enabled_server_side",FSe="$session_recording_network_payload_capture",OSe="$session_recording_masking",zSe="$session_recording_canvas_recording",HSe="$replay_sample_rate",YSe="$replay_minimum_duration",VSe="$replay_script_config",bG="$sesid",U4="$session_is_sampled",y$="$session_recording_url_trigger_activated_session",v$="$session_recording_event_trigger_activated_session",m5="$enabled_feature_flags",xG="$early_access_features",C$="$feature_flag_details",P4="$stored_person_properties",B3="$stored_group_properties",I$="$surveys",BG="$surveys_activated",SG="$flag_call_reported",TQ="$user_state",_$="$client_session_props",E$="$capture_rate_limit",b$="$initial_campaign_params",x$="$initial_referrer_info",wG="$initial_person_info",QG="$epp",KSe="__POSTHOG_TOOLBAR__",MG="$posthog_cookieless",cSt=[NSe,N4,"__cmpns",T4,m$,p$,bG,m5,g$,TQ,xG,C$,B3,P4,I$,SG,_$,E$,b$,x$,QG,wG];function jSe(i){return i instanceof Element&&(i.id===KSe||!(i.closest==null||!i.closest(".toolbar-global-fade-container")))}function RG(i){return!!i&&i.nodeType===1}function uM(i,e){return!!i&&!!i.tagName&&i.tagName.toLowerCase()===e.toLowerCase()}function JSe(i){return!!i&&i.nodeType===3}function qSe(i){return!!i&&i.nodeType===11}function B$(i){return i?vG(i).split(/\s+/):[]}function ZSe(i){var e=Qo==null?void 0:Qo.location.href;return!!(e&&i&&i.some(t=>e.match(t)))}function DG(i){var e="";switch(typeof i.className){case"string":e=i.className;break;case"object":e=(i.className&&"baseVal"in i.className?i.className.baseVal:null)||i.getAttribute("class")||"";break;default:e=""}return B$(e)}function XSe(i){return BC(i)?null:vG(i).split(/(\s+)/).filter(e=>y5(e)).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function NG(i){var e="";return w$(i)&&!ewe(i)&&i.childNodes&&i.childNodes.length&&t1(i.childNodes,function(t){var n;JSe(t)&&t.textContent&&(e+=(n=XSe(t.textContent))!==null&&n!==void 0?n:"")}),vG(e)}function WSe(i){return ed(i.target)?i.srcElement||null:(e=i.target)!=null&&e.shadowRoot?i.composedPath()[0]||null:i.target||null;var e}var S$=["a","button","form","input","select","textarea","label"];function $Se(i){var e=i.parentNode;return!(!e||!RG(e))&&e}function uSt(i,e,t,n,r){var a,o,s;if(t===void 0&&(t=void 0),!Qo||!i||uM(i,"html")||!RG(i)||(a=t)!=null&&a.url_allowlist&&!ZSe(t.url_allowlist)||(o=t)!=null&&o.url_ignorelist&&ZSe(t.url_ignorelist))return!1;if((s=t)!=null&&s.dom_event_allowlist){var l=t.dom_event_allowlist;if(l&&!l.some(E=>e.type===E))return!1}for(var u=!1,d=[i],f=!0,p=i;p.parentNode&&!uM(p,"body");)if(qSe(p.parentNode))d.push(p.parentNode.host),p=p.parentNode.host;else{if(!(f=$Se(p)))break;if(n||S$.indexOf(f.tagName.toLowerCase())>-1)u=!0;else{var m=Qo.getComputedStyle(f);m&&m.getPropertyValue("cursor")==="pointer"&&(u=!0)}d.push(f),p=f}if(!function(E,b){var Q=b==null?void 0:b.element_allowlist;if(ed(Q))return!0;var M,L=function(Y){if(Q.some(q=>Y.tagName.toLowerCase()===q))return{v:!0}};for(var V of E)if(M=L(V))return M.v;return!1}(d,t)||!function(E,b){var Q=b==null?void 0:b.css_selector_allowlist;if(ed(Q))return!0;var M,L=function(Y){if(Q.some(q=>Y.matches(q)))return{v:!0}};for(var V of E)if(M=L(V))return M.v;return!1}(d,t))return!1;var y=Qo.getComputedStyle(i);if(y&&y.getPropertyValue("cursor")==="pointer"&&e.type==="click")return!0;var x=i.tagName.toLowerCase();switch(x){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 u?(r||["click"]).indexOf(e.type)>=0:(r||["click"]).indexOf(e.type)>=0&&(S$.indexOf(x)>-1||i.getAttribute("contenteditable")==="true")}}function w$(i){for(var e=i;e.parentNode&&!uM(e,"body");e=e.parentNode){var t=DG(e);if(My(t,"ph-sensitive")||My(t,"ph-no-capture"))return!1}if(My(DG(i),"ph-include"))return!0;var n=i.type||"";if(G_(n))switch(n.toLowerCase()){case"hidden":case"password":return!1}var r=i.name||i.id||"";return!(G_(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 ewe(i){return!!(uM(i,"input")&&!["button","checkbox","submit","reset"].includes(i.type)||uM(i,"select")||uM(i,"textarea")||i.getAttribute("contenteditable")==="true")}var twe="(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})",ASt=new RegExp("^(?:"+twe+")$"),dSt=new RegExp(twe),nwe="\\d{3}-?\\d{2}-?\\d{4}",fSt=new RegExp("^("+nwe+")$"),hSt=new RegExp("("+nwe+")");function y5(i,e){return e===void 0&&(e=!0),!(BC(i)||G_(i)&&(i=vG(i),(e?ASt:dSt).test((i||"").replace(/[- ]/g,""))||(e?fSt:hSt).test(i)))}function iwe(i){var e=NG(i);return y5(e=(e+" "+rwe(i)).trim())?e:""}function rwe(i){var e="";return i&&i.childNodes&&i.childNodes.length&&t1(i.childNodes,function(t){var n;if(t&&((n=t.tagName)==null?void 0:n.toLowerCase())==="span")try{var r=NG(t);e=(e+" "+r).trim(),t.childNodes&&t.childNodes.length&&(e=(e+" "+rwe(t)).trim())}catch(a){Pf.error("[AutoCapture]",a)}}),e}function pSt(i){return function(e){var t=e.map(n=>{var r,a,o="";if(n.tag_name&&(o+=n.tag_name),n.attr_class)for(var s of(n.attr_class.sort(),n.attr_class))o+="."+s.replace(/"/g,"");var l=Wd({},n.text?{text:n.text}:{},{"nth-child":(r=n.nth_child)!==null&&r!==void 0?r:0,"nth-of-type":(a=n.nth_of_type)!==null&&a!==void 0?a:0},n.href?{href:n.href}:{},n.attr_id?{attr_id:n.attr_id}:{},n.attributes),u={};return EG(l).sort((d,f)=>{var[p]=d,[m]=f;return p.localeCompare(m)}).forEach(d=>{var[f,p]=d;return u[awe(f.toString())]=awe(p.toString())}),o+=":",o+=EG(u).map(d=>{var[f,p]=d;return f+'="'+p+'"'}).join("")});return t.join(";")}(function(e){return e.map(t=>{var n,r,a={text:(n=t.$el_text)==null?void 0:n.slice(0,400),tag_name:t.tag_name,href:(r=t.attr__href)==null?void 0:r.slice(0,2048),attr_class:gSt(t),attr_id:t.attr__id,nth_child:t.nth_child,nth_of_type:t.nth_of_type,attributes:{}};return EG(t).filter(o=>{var[s]=o;return s.indexOf("attr__")===0}).forEach(o=>{var[s,l]=o;return a.attributes[s]=l}),a})}(i))}function awe(i){return i.replace(/"|\\"/g,'\\"')}function gSt(i){var e=i.attr__class;return e?o_(e)?e:B$(e):void 0}class owe{constructor(){this.clicks=[]}isRageClick(e,t,n){var r=this.clicks[this.clicks.length-1];if(r&&Math.abs(e-r.x)+Math.abs(t-r.y)<30&&n-r.timestamp<1e3){if(this.clicks.push({x:e,y:t,timestamp:n}),this.clicks.length===3)return!0}else this.clicks=[{x:e,y:t,timestamp:n}];return!1}}var mSt=["localhost","127.0.0.1"],v5=i=>{var e=Af==null?void 0:Af.createElement("a");return ed(e)?null:(e.href=i,e)},ySt=function(i,e){var t,n;e===void 0&&(e="&");var r=[];return t1(i,function(a,o){ed(a)||ed(o)||o==="undefined"||(t=encodeURIComponent((s=>s instanceof File)(a)?a.name:a.toString()),n=encodeURIComponent(o),r[r.length]=n+"="+t)}),r.join(e)},TG=function(i,e){for(var t,n=((i.split("#")[0]||"").split(/\?(.*)/)[1]||"").replace(/^\?+/g,"").split("&"),r=0;r<n.length;r++){var a=n[r].split("=");if(a[0]===e){t=a;break}}if(!o_(t)||t.length<2)return"";var o=t[1];try{o=decodeURIComponent(o)}catch{Pf.error("Skipping decoding for malformed query param: "+o)}return o.replace(/\+/g," ")},Q$=function(i,e,t){if(!i||!e||!e.length)return i;for(var n=i.split("#"),r=n[0]||"",a=n[1],o=r.split("?"),s=o[1],l=o[0],u=(s||"").split("&"),d=[],f=0;f<u.length;f++){var p=u[f].split("=");o_(p)&&(e.includes(p[0])?d.push(p[0]+"="+t):d.push(u[f]))}var m=l;return s!=null&&(m+="?"+d.join("&")),a!=null&&(m+="#"+a),m},UG=function(i,e){var t=i.match(new RegExp(e+"=([^&]*)"));return t?t[1]:null},swe=Mb("[AutoCapture]");function M$(i,e){return e.length>i?e.slice(0,i)+"...":e}function vSt(i){if(i.previousElementSibling)return i.previousElementSibling;var e=i;do e=e.previousSibling;while(e&&!RG(e));return e}function CSt(i,e,t,n){var r=i.tagName.toLowerCase(),a={tag_name:r};S$.indexOf(r)>-1&&!t&&(r.toLowerCase()==="a"||r.toLowerCase()==="button"?a.$el_text=M$(1024,iwe(i)):a.$el_text=M$(1024,NG(i)));var o=DG(i);o.length>0&&(a.classes=o.filter(function(d){return d!==""})),t1(i.attributes,function(d){var f;if((!ewe(i)||["name","id","class","aria-label"].indexOf(d.name)!==-1)&&(n==null||!n.includes(d.name))&&!e&&y5(d.value)&&(f=d.name,!G_(f)||f.substring(0,10)!=="_ngcontent"&&f.substring(0,7)!=="_nghost")){var p=d.value;d.name==="class"&&(p=B$(p).join(" ")),a["attr__"+d.name]=M$(1024,p)}});for(var s=1,l=1,u=i;u=vSt(u);)s++,u.tagName===i.tagName&&l++;return a.nth_child=s,a.nth_of_type=l,a}function ISt(i,e){for(var t,n,{e:r,maskAllElementAttributes:a,maskAllText:o,elementAttributeIgnoreList:s,elementsChainAsString:l}=e,u=[i],d=i;d.parentNode&&!uM(d,"body");)qSe(d.parentNode)?(u.push(d.parentNode.host),d=d.parentNode.host):(u.push(d.parentNode),d=d.parentNode);var f,p=[],m={},y=!1,x=!1;if(t1(u,L=>{var V=w$(L);L.tagName.toLowerCase()==="a"&&(y=L.getAttribute("href"),y=V&&y&&y5(y)&&y),My(DG(L),"ph-no-capture")&&(x=!0),p.push(CSt(L,a,o,s));var Y=function(q){if(!w$(q))return{};var K={};return t1(q.attributes,function($){if($.name&&$.name.indexOf("data-ph-capture-attribute")===0){var j=$.name.replace("data-ph-capture-attribute-",""),ue=$.value;j&&ue&&y5(ue)&&(K[j]=ue)}}),K}(L);EE(m,Y)}),x)return{props:{},explicitNoCapture:x};if(o||(i.tagName.toLowerCase()==="a"||i.tagName.toLowerCase()==="button"?p[0].$el_text=iwe(i):p[0].$el_text=NG(i)),y){var E,b;p[0].attr__href=y;var Q=(E=v5(y))==null?void 0:E.host,M=Qo==null||(b=Qo.location)==null?void 0:b.host;Q&&M&&Q!==M&&(f=y)}return{props:EE({$event_type:r.type,$ce_version:1},l?{}:{$elements:p},{$elements_chain:pSt(p)},(t=p[0])!=null&&t.$el_text?{$el_text:(n=p[0])==null?void 0:n.$el_text}:{},f&&r.type==="click"?{$external_click_url:f}:{},m)}}class _St{constructor(e){this.i=!1,this.o=null,this.rageclicks=new owe,this.h=!1,this.instance=e,this.m=null}get S(){var e,t,n=k_(this.instance.config.autocapture)?this.instance.config.autocapture:{};return n.url_allowlist=(e=n.url_allowlist)==null?void 0:e.map(r=>new RegExp(r)),n.url_ignorelist=(t=n.url_ignorelist)==null?void 0:t.map(r=>new RegExp(r)),n}$(){if(this.isBrowserSupported()){if(Qo&&Af){var e=n=>{n=n||(Qo==null?void 0:Qo.event);try{this.k(n)}catch(r){swe.error("Failed to capture event",r)}};if(v_(Af,"submit",e,{capture:!0}),v_(Af,"change",e,{capture:!0}),v_(Af,"click",e,{capture:!0}),this.S.capture_copied_text){var t=n=>{n=n||(Qo==null?void 0:Qo.event),this.k(n,A$)};v_(Af,"copy",t,{capture:!0}),v_(Af,"cut",t,{capture:!0})}}}else swe.info("Disabling Automatic Event Collection because this browser is not supported")}startIfEnabled(){this.isEnabled&&!this.i&&(this.$(),this.i=!0)}onRemoteConfig(e){e.elementsChainAsString&&(this.h=e.elementsChainAsString),this.instance.persistence&&this.instance.persistence.register({[TSe]:!!e.autocapture_opt_out}),this.o=!!e.autocapture_opt_out,this.startIfEnabled()}setElementSelectors(e){this.m=e}getElementSelectors(e){var t,n=[];return(t=this.m)==null||t.forEach(r=>{var a=Af==null?void 0:Af.querySelectorAll(r);a==null||a.forEach(o=>{e===o&&n.push(r)})}),n}get isEnabled(){var e,t,n=(e=this.instance.persistence)==null?void 0:e.props[TSe],r=this.o;if(lM(r)&&!_w(n)&&!this.instance.I())return!1;var a=(t=this.o)!==null&&t!==void 0?t:!!n;return!!this.instance.config.autocapture&&!a}k(e,t){if(t===void 0&&(t="$autocapture"),this.isEnabled){var n,r=WSe(e);JSe(r)&&(r=r.parentNode||null),t==="$autocapture"&&e.type==="click"&&e instanceof MouseEvent&&this.instance.config.rageclick&&(n=this.rageclicks)!=null&&n.isRageClick(e.clientX,e.clientY,new Date().getTime())&&this.k(e,"$rageclick");var a=t===A$;if(r&&uSt(r,e,this.S,a,a?["copy","cut"]:void 0)){var{props:o,explicitNoCapture:s}=ISt(r,{e,maskAllElementAttributes:this.instance.config.mask_all_element_attributes,maskAllText:this.instance.config.mask_all_text,elementAttributeIgnoreList:this.S.element_attribute_ignorelist,elementsChainAsString:this.h});if(s)return!1;var l=this.getElementSelectors(r);if(l&&l.length>0&&(o.$element_selectors=l),t===A$){var u,d=XSe(Qo==null||(u=Qo.getSelection())==null?void 0:u.toString()),f=e.type||"clipboard";if(!d)return!1;o.$selected_content=d,o.$copy_type=f}return this.instance.capture(t,o),!0}}}isBrowserSupported(){return tS(Af==null?void 0:Af.querySelectorAll)}}Math.trunc||(Math.trunc=function(i){return i<0?Math.ceil(i):Math.floor(i)}),Number.isInteger||(Number.isInteger=function(i){return ox(i)&&isFinite(i)&&Math.floor(i)===i});var lwe="0123456789abcdef";class PG{constructor(e){if(this.bytes=e,e.length!==16)throw new TypeError("not 128-bit length")}static fromFieldsV7(e,t,n,r){if(!Number.isInteger(e)||!Number.isInteger(t)||!Number.isInteger(n)||!Number.isInteger(r)||e<0||t<0||n<0||r<0||e>0xffffffffffff||t>4095||n>1073741823||r>4294967295)throw new RangeError("invalid field value");var a=new Uint8Array(16);return a[0]=e/Math.pow(2,40),a[1]=e/Math.pow(2,32),a[2]=e/Math.pow(2,24),a[3]=e/Math.pow(2,16),a[4]=e/Math.pow(2,8),a[5]=e,a[6]=112|t>>>8,a[7]=t,a[8]=128|n>>>24,a[9]=n>>>16,a[10]=n>>>8,a[11]=n,a[12]=r>>>24,a[13]=r>>>16,a[14]=r>>>8,a[15]=r,new PG(a)}toString(){for(var e="",t=0;t<this.bytes.length;t++)e=e+lwe.charAt(this.bytes[t]>>>4)+lwe.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 PG(this.bytes.slice(0))}equals(e){return this.compareTo(e)===0}compareTo(e){for(var t=0;t<16;t++){var n=this.bytes[t]-e.bytes[t];if(n!==0)return Math.sign(n)}return 0}}class ESt{constructor(){this.P=0,this.R=0,this.T=new bSt}generate(){var e=this.generateOrAbort();if(ed(e)){this.P=0;var t=this.generateOrAbort();if(ed(t))throw new Error("Could not generate UUID after timestamp reset");return t}return e}generateOrAbort(){var e=Date.now();if(e>this.P)this.P=e,this.M();else{if(!(e+1e4>this.P))return;this.R++,this.R>4398046511103&&(this.P++,this.M())}return PG.fromFieldsV7(this.P,Math.trunc(this.R/Math.pow(2,30)),this.R&Math.pow(2,30)-1,this.T.nextUint32())}M(){this.R=1024*this.T.nextUint32()+(1023&this.T.nextUint32())}}var cwe,uwe=i=>{if(typeof UUIDV7_DENY_WEAK_RNG<"u"&&UUIDV7_DENY_WEAK_RNG)throw new Error("no cryptographically strong RNG available");for(var e=0;e<i.length;e++)i[e]=65536*Math.trunc(65536*Math.random())+Math.trunc(65536*Math.random());return i};Qo&&!ed(Qo.crypto)&&crypto.getRandomValues&&(uwe=i=>crypto.getRandomValues(i));class bSt{constructor(){this.C=new Uint32Array(8),this.F=1/0}nextUint32(){return this.F>=this.C.length&&(uwe(this.C),this.F=0),this.C[this.F++]}}var AM=()=>xSt().toString(),xSt=()=>(cwe||(cwe=new ESt)).generate(),L4="",BSt=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i;function SSt(i,e){if(e){var t=function(r,a){if(a===void 0&&(a=Af),L4)return L4;if(!a||["localhost","127.0.0.1"].includes(r))return"";for(var o=r.split("."),s=Math.min(o.length,8),l="dmn_chk_"+AM();!L4&&s--;){var u=o.slice(s).join("."),d=l+"=1;domain=."+u+";path=/";a.cookie=d+";max-age=3",a.cookie.includes(l)&&(a.cookie=d+";max-age=0",L4=u)}return L4}(i);if(!t){var n=(r=>{var a=r.match(BSt);return a?a[0]:""})(i);n!==t&&Pf.info("Warning: cookie subdomain discovery mismatch",n,t),t=n}return t?"; domain=."+t:""}return""}var UQ={O:()=>!!Af,A:function(i){Pf.error("cookieStore error: "+i)},D:function(i){if(Af){try{for(var e=i+"=",t=Af.cookie.split(";").filter(a=>a.length),n=0;n<t.length;n++){for(var r=t[n];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}},L:function(i){var e;try{e=JSON.parse(UQ.D(i))||{}}catch{}return e},j:function(i,e,t,n,r){if(Af)try{var a="",o="",s=SSt(Af.location.hostname,n);if(t){var l=new Date;l.setTime(l.getTime()+24*t*60*60*1e3),a="; expires="+l.toUTCString()}r&&(o="; secure");var u=i+"="+encodeURIComponent(JSON.stringify(e))+a+"; SameSite=Lax; path=/"+s+o;return u.length>3686.4&&Pf.warn("cookieStore warning: large cookie, len="+u.length),Af.cookie=u,u}catch{return}},N:function(i,e){try{UQ.j(i,"",-1,e)}catch{return}}},R$=null,KE={O:function(){if(!lM(R$))return R$;var i=!0;if(ed(Qo))i=!1;else try{var e="__mplssupport__";KE.j(e,"xyz"),KE.D(e)!=='"xyz"'&&(i=!1),KE.N(e)}catch{i=!1}return i||Pf.error("localStorage unsupported; falling back to cookie store"),R$=i,i},A:function(i){Pf.error("localStorage error: "+i)},D:function(i){try{return Qo==null?void 0:Qo.localStorage.getItem(i)}catch(e){KE.A(e)}return null},L:function(i){try{return JSON.parse(KE.D(i))||{}}catch{}return null},j:function(i,e){try{Qo==null||Qo.localStorage.setItem(i,JSON.stringify(e))}catch(t){KE.A(t)}},N:function(i){try{Qo==null||Qo.localStorage.removeItem(i)}catch(e){KE.A(e)}}},wSt=["distinct_id",bG,U4,QG,wG],LG=Wd({},KE,{L:function(i){try{var e={};try{e=UQ.L(i)||{}}catch{}var t=EE(e,JSON.parse(KE.D(i)||"{}"));return KE.j(i,t),t}catch{}return null},j:function(i,e,t,n,r,a){try{KE.j(i,e,void 0,void 0,a);var o={};wSt.forEach(s=>{e[s]&&(o[s]=e[s])}),Object.keys(o).length&&UQ.j(i,o,t,n,r,a)}catch(s){KE.A(s)}},N:function(i,e){try{Qo==null||Qo.localStorage.removeItem(i),UQ.N(i,e)}catch(t){KE.A(t)}}}),kG={},QSt={O:function(){return!0},A:function(i){Pf.error("memoryStorage error: "+i)},D:function(i){return kG[i]||null},L:function(i){return kG[i]||null},j:function(i,e){kG[i]=e},N:function(i){delete kG[i]}},S3=null,Rb={O:function(){if(!lM(S3))return S3;if(S3=!0,ed(Qo))S3=!1;else try{var i="__support__";Rb.j(i,"xyz"),Rb.D(i)!=='"xyz"'&&(S3=!1),Rb.N(i)}catch{S3=!1}return S3},A:function(i){Pf.error("sessionStorage error: ",i)},D:function(i){try{return Qo==null?void 0:Qo.sessionStorage.getItem(i)}catch(e){Rb.A(e)}return null},L:function(i){try{return JSON.parse(Rb.D(i))||null}catch{}return null},j:function(i,e){try{Qo==null||Qo.sessionStorage.setItem(i,JSON.stringify(e))}catch(t){Rb.A(t)}},N:function(i){try{Qo==null||Qo.sessionStorage.removeItem(i)}catch(e){Rb.A(e)}}},C5=function(i){return i[i.PENDING=-1]="PENDING",i[i.DENIED=0]="DENIED",i[i.GRANTED=1]="GRANTED",i}({});class MSt{constructor(e){this._instance=e}get S(){return this._instance.config}get consent(){return this.U()?C5.DENIED:this.q}isOptedOut(){return this.consent===C5.DENIED||this.consent===C5.PENDING&&this.S.opt_out_capturing_by_default}isOptedIn(){return!this.isOptedOut()}optInOut(e){this.B.j(this.H,e?1:0,this.S.cookie_expiration,this.S.cross_subdomain_cookie,this.S.secure_cookie)}reset(){this.B.N(this.H,this.S.cross_subdomain_cookie)}get H(){var{token:e,opt_out_capturing_cookie_prefix:t}=this._instance.config;return(t||"__ph_opt_in_out_")+e}get q(){var e=this.B.D(this.H);return e==="1"?C5.GRANTED:e==="0"?C5.DENIED:C5.PENDING}get B(){if(!this.W){var e=this.S.opt_out_capturing_persistence_type;this.W=e==="localStorage"?KE:UQ;var t=e==="localStorage"?UQ:KE;t.D(this.H)&&(this.W.D(this.H)||this.optInOut(t.D(this.H)==="1"),t.N(this.H,this.S.cross_subdomain_cookie))}return this.W}U(){return!!this.S.respect_dnt&&!!DSe([SB==null?void 0:SB.doNotTrack,SB==null?void 0:SB.msDoNotTrack,k0.doNotTrack],e=>My([!0,1,"1","yes"],e))}}var GG=Mb("[Dead Clicks]"),RSt=()=>!0,DSt=i=>{var e,t=!((e=i.instance.persistence)==null||!e.get_property(LSe)),n=i.instance.config.capture_dead_clicks;return _w(n)?n:t};let Awe=class{get lazyLoadedDeadClicksAutocapture(){return this.G}constructor(e,t,n){this.instance=e,this.isEnabled=t,this.onCapture=n,this.startIfEnabled()}onRemoteConfig(e){this.instance.persistence&&this.instance.persistence.register({[LSe]:e==null?void 0:e.captureDeadClicks}),this.startIfEnabled()}startIfEnabled(){this.isEnabled(this)&&this.J(()=>{this.V()})}J(e){var t,n;(t=k0.__PosthogExtensions__)!=null&&t.initDeadClicksAutocapture&&e(),(n=k0.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this.instance,"dead-clicks-autocapture",r=>{r?GG.error("failed to load script",r):e()})}V(){var e;if(Af){if(!this.G&&(e=k0.__PosthogExtensions__)!=null&&e.initDeadClicksAutocapture){var t=k_(this.instance.config.capture_dead_clicks)?this.instance.config.capture_dead_clicks:{};t.__onCapture=this.onCapture,this.G=k0.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,t),this.G.start(Af),GG.info("starting...")}}else GG.error("`document` not found. Cannot start.")}stop(){this.G&&(this.G.stop(),this.G=void 0,GG.info("stopping..."))}};function wB(i,e,t,n,r){return e>t&&(Pf.warn("min cannot be greater than max."),e=t),ox(i)?i>t?(n&&Pf.warn(n+" cannot be greater than max: "+t+". Using max value instead."),t):i<e?(n&&Pf.warn(n+" cannot be less than min: "+e+". Using min value instead."),e):i:(n&&Pf.warn(n+" must be a number. using max or fallback. max: "+t+", fallback: "+r),wB(r||t,e,t,n))}let dwe=class{constructor(e){this.K={},this.Y=()=>{Object.keys(this.K).forEach(t=>{var n=this.X(t)+this.Z;n>=this.tt?delete this.K[t]:this.it(t,n)})},this.X=t=>this.K[String(t)],this.it=(t,n)=>{this.K[String(t)]=n},this.consumeRateLimit=t=>{var n,r=(n=this.X(t))!==null&&n!==void 0?n:this.tt;if((r=Math.max(r-1,0))===0)return!0;this.it(t,r);var a,o=r===0;return o&&((a=this.et)==null||a.call(this,t)),o},this.rt=e,this.et=this.rt.et,this.tt=wB(this.rt.bucketSize,0,100,"rate limiter bucket size"),this.Z=wB(this.rt.refillRate,0,this.tt,"rate limiter refill rate"),this.st=wB(this.rt.refillInterval,0,864e5,"rate limiter refill interval"),setInterval(()=>{this.Y()},this.st)}};var FG=Mb("[ExceptionAutocapture]");class NSt{constructor(e){var t,n,r;this.nt=()=>{var a;if(Qo&&this.isEnabled&&(a=k0.__PosthogExtensions__)!=null&&a.errorWrappingFunctions){var o=k0.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,s=k0.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,l=k0.__PosthogExtensions__.errorWrappingFunctions.wrapConsoleError;try{!this.ot&&this.S.capture_unhandled_errors&&(this.ot=o(this.captureException.bind(this))),!this.lt&&this.S.capture_unhandled_rejections&&(this.lt=s(this.captureException.bind(this))),!this.ut&&this.S.capture_console_errors&&(this.ut=l(this.captureException.bind(this)))}catch(u){FG.error("failed to start",u),this.ht()}}},this._instance=e,this.dt=!((t=this._instance.persistence)==null||!t.props[USe]),this.S=this.vt(),this.ct=new dwe({refillRate:(n=this._instance.config.error_tracking.__exceptionRateLimiterRefillRate)!==null&&n!==void 0?n:1,bucketSize:(r=this._instance.config.error_tracking.__exceptionRateLimiterBucketSize)!==null&&r!==void 0?r:10,refillInterval:1e4}),this.startIfEnabled()}vt(){var e=this._instance.config.capture_exceptions,t={capture_unhandled_errors:!1,capture_unhandled_rejections:!1,capture_console_errors:!1};return k_(e)?t=Wd({},t,e):(ed(e)?this.dt:e)&&(t=Wd({},t,{capture_unhandled_errors:!0,capture_unhandled_rejections:!0})),t}get isEnabled(){return this.S.capture_console_errors||this.S.capture_unhandled_errors||this.S.capture_unhandled_rejections}startIfEnabled(){this.isEnabled&&(FG.info("enabled"),this.J(this.nt))}J(e){var t,n;(t=k0.__PosthogExtensions__)!=null&&t.errorWrappingFunctions&&e(),(n=k0.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this._instance,"exception-autocapture",r=>{if(r)return FG.error("failed to load script",r);e()})}ht(){var e,t,n;(e=this.ot)==null||e.call(this),this.ot=void 0,(t=this.lt)==null||t.call(this),this.lt=void 0,(n=this.ut)==null||n.call(this),this.ut=void 0}onRemoteConfig(e){var t=e.autocaptureExceptions;this.dt=!!t||!1,this.S=this.vt(),this._instance.persistence&&this._instance.persistence.register({[USe]:this.dt}),this.startIfEnabled()}captureException(e){var t,n=this._instance.requestRouter.endpointFor("ui");e.$exception_personURL=n+"/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.ct.consumeRateLimit(r)?FG.info("Skipping exception capture because of client rate limiting.",{exception:e.$exception_list[0].type}):this._instance.exceptions.sendExceptionEvent(e)}}function fwe(i){return!ed(Event)&&hwe(i,Event)}function hwe(i,e){try{return i instanceof e}catch{return!1}}function pwe(i){switch(Object.prototype.toString.call(i)){case"[object Error]":case"[object Exception]":case"[object DOMException]":case"[object DOMError]":return!0;default:return hwe(i,Error)}}function OG(i,e){return Object.prototype.toString.call(i)==="[object "+e+"]"}function D$(i){return OG(i,"DOMError")}var gwe=/\(error: (.*)\)/,mwe=50,I5="?";function N$(i,e,t,n){var r={platform:"web:javascript",filename:i,function:e==="<anonymous>"?I5:e,in_app:!0};return ed(t)||(r.lineno=t),ed(n)||(r.colno=n),r}var TSt=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,USt=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,PSt=/\((\S*)(?::(\d+))(?::(\d+))\)/,LSt=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,kSt=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,GSt=function(){for(var i=arguments.length,e=new Array(i),t=0;t<i;t++)e[t]=arguments[t];var n=e.sort((r,a)=>r[0]-a[0]).map(r=>r[1]);return function(r,a){a===void 0&&(a=0);for(var o=[],s=r.split(`
893
893
  `),l=a;l<s.length;l++){var u=s[l];if(!(u.length>1024)){var d=gwe.test(u)?u.replace(gwe,"$1"):u;if(!d.match(/\S*Error: /)){for(var f of n){var p=f(d);if(p){o.push(p);break}}if(o.length>=mwe)break}}}return function(m){if(!m.length)return[];var y=Array.from(m);return y.reverse(),y.slice(0,mwe).map(x=>Wd({},x,{filename:x.filename||FSt(y).filename,function:x.function||I5}))}(o)}}([30,i=>{var e=TSt.exec(i);if(e){var[,t,n,r]=e;return N$(t,I5,+n,+r)}var a=USt.exec(i);if(a){if(a[2]&&a[2].indexOf("eval")===0){var o=PSt.exec(a[2]);o&&(a[2]=o[1],a[3]=o[2],a[4]=o[3])}var[s,l]=vwe(a[1]||I5,a[2]);return N$(l,s,a[3]?+a[3]:void 0,a[4]?+a[4]:void 0)}}],[50,i=>{var e=LSt.exec(i);if(e){if(e[3]&&e[3].indexOf(" > eval")>-1){var t=kSt.exec(e[3]);t&&(e[1]=e[1]||"eval",e[3]=t[1],e[4]=t[2],e[5]="")}var n=e[3],r=e[1]||I5;return[r,n]=vwe(r,n),N$(n,r,e[4]?+e[4]:void 0,e[5]?+e[5]:void 0)}}]);function FSt(i){return i[i.length-1]||{}}var zG,ywe,T$,vwe=(i,e)=>{var t=i.indexOf("safari-extension")!==-1,n=i.indexOf("safari-web-extension")!==-1;return t||n?[i.indexOf("@")!==-1?i.split("@")[0]:I5,t?"safari-extension:"+e:"safari-web-extension:"+e]:[i,e]},OSt=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;function U$(i,e){e===void 0&&(e=0);var t=i.stacktrace||i.stack||"",n=function(o){return o&&zSt.test(o.message)?1:0}(i);try{var r=GSt,a=function(o,s){var l=function(u){var d=globalThis._posthogChunkIds;if(!d)return{};var f=Object.keys(d);return T$&&f.length===ywe||(ywe=f.length,T$=f.reduce((p,m)=>{zG||(zG={});var y=zG[m];if(y)p[y[0]]=y[1];else for(var x=u(m),E=x.length-1;E>=0;E--){var b=x[E],Q=b==null?void 0:b.filename,M=d[m];if(Q&&M){p[Q]=M,zG[m]=[Q,M];break}}return p},{})),T$}(s);return o.forEach(u=>{u.filename&&(u.chunk_id=l[u.filename])}),o}(r(t,n),r);return a.slice(0,a.length-e)}catch{}return[]}var zSt=/Minified React error #\d+;/i;function HSt(i,e){var t,n,r=U$(i),a=(t=e==null?void 0:e.handled)===null||t===void 0||t,o=(n=e==null?void 0:e.synthetic)!==null&&n!==void 0&&n;return{type:e!=null&&e.overrideExceptionType?e.overrideExceptionType:i.name,value:function(s){var l=s.message;return l.error&&typeof l.error.message=="string"?String(l.error.message):String(l)}(i),stacktrace:{frames:r,type:"raw"},mechanism:{handled:a,synthetic:o}}}function Cwe(i,e){var t=HSt(i,e);return i.cause&&pwe(i.cause)&&i.cause!==i?[t,...Cwe(i.cause,{handled:e==null?void 0:e.handled,synthetic:e==null?void 0:e.synthetic})]:[t]}function P$(i,e){return{$exception_list:Cwe(i,e),$exception_level:"error"}}function L$(i,e){var t,n,r,a=(t=e==null?void 0:e.handled)===null||t===void 0||t,o=(n=e==null?void 0:e.synthetic)===null||n===void 0||n,s={type:e!=null&&e.overrideExceptionType?e.overrideExceptionType:(r=e==null?void 0:e.defaultExceptionType)!==null&&r!==void 0?r:"Error",value:i||(e==null?void 0:e.defaultExceptionMessage),mechanism:{handled:a,synthetic:o}};if(e!=null&&e.syntheticException){var l=U$(e.syntheticException,1);l.length&&(s.stacktrace={frames:l,type:"raw"})}return{$exception_list:[s],$exception_level:"error"}}function YSt(i){return G_(i)&&!f$(i)&&eSt.indexOf(i)>=0}function VSt(i,e){var t,n,r=(t=e==null?void 0:e.handled)===null||t===void 0||t,a=(n=e==null?void 0:e.synthetic)===null||n===void 0||n,o=e!=null&&e.overrideExceptionType?e.overrideExceptionType:fwe(i)?i.constructor.name:"Error",s="Non-Error 'exception' captured with keys: "+function(d,f){f===void 0&&(f=40);var p=Object.keys(d);if(p.sort(),!p.length)return"[object has no keys]";for(var m=p.length;m>0;m--){var y=p.slice(0,m).join(", ");if(!(y.length>f))return m===p.length||y.length<=f?y:y.slice(0,f)+"..."}return""}(i),l={type:o,value:s,mechanism:{handled:r,synthetic:a}};if(e!=null&&e.syntheticException){var u=U$(e==null?void 0:e.syntheticException,1);u.length&&(l.stacktrace={frames:u,type:"raw"})}return{$exception_list:[l],$exception_level:YSt(i.level)?i.level:"error"}}function KSt(i,e){var{error:t,event:n}=i,r={$exception_list:[]},a=t||n;if(D$(a)||function(p){return OG(p,"DOMException")}(a)){var o=a;if(function(p){return"stack"in p}(a))r=P$(a,e);else{var s=o.name||(D$(o)?"DOMError":"DOMException"),l=o.message?s+": "+o.message:s;r=L$(l,Wd({},e,{overrideExceptionType:D$(o)?"DOMError":"DOMException",defaultExceptionMessage:l}))}return"code"in o&&(r.$exception_DOMException_code=""+o.code),r}if(function(p){return OG(p,"ErrorEvent")}(a)&&a.error)return P$(a.error,e);if(pwe(a))return P$(a,e);if(function(p){return OG(p,"Object")}(a)||fwe(a))return VSt(a,e);if(ed(t)&&G_(n)){var u="Error",d=n,f=n.match(OSt);return f&&(u=f[1],d=f[2]),L$(d,Wd({},e,{overrideExceptionType:u,defaultExceptionMessage:d}))}return L$(a,e)}function Iwe(i,e,t){try{if(!(e in i))return()=>{};var n=i[e],r=t(n);return tS(r)&&(r.prototype=r.prototype||{},Object.defineProperties(r,{__posthog_wrapped__:{enumerable:!1,value:!0}})),i[e]=r,()=>{i[e]=n}}catch{return()=>{}}}class jSt{constructor(e){var t;this._instance=e,this.ft=(Qo==null||(t=Qo.location)==null?void 0:t.pathname)||""}get isEnabled(){return this._instance.config.capture_pageview==="history_change"}startIfEnabled(){this.isEnabled&&(Pf.info("History API monitoring enabled, starting..."),this.monitorHistoryChanges())}stop(){this.gt&&this.gt(),this.gt=void 0,Pf.info("History API monitoring stopped")}monitorHistoryChanges(){var e,t;if(Qo&&Qo.history){var n=this;(e=Qo.history.pushState)!=null&&e.__posthog_wrapped__||Iwe(Qo.history,"pushState",r=>function(a,o,s){r.call(this,a,o,s),n._t("pushState")}),(t=Qo.history.replaceState)!=null&&t.__posthog_wrapped__||Iwe(Qo.history,"replaceState",r=>function(a,o,s){r.call(this,a,o,s),n._t("replaceState")}),this.bt()}}_t(e){try{var t,n=Qo==null||(t=Qo.location)==null?void 0:t.pathname;if(!n)return;n!==this.ft&&this.isEnabled&&this._instance.capture("$pageview",{navigation_type:e}),this.ft=n}catch(r){Pf.error("Error capturing "+e+" pageview",r)}}bt(){if(!this.gt){var e=()=>{this._t("popstate")};v_(Qo,"popstate",e),this.gt=()=>{Qo&&Qo.removeEventListener("popstate",e)}}}}function HG(i){var e,t;return((e=JSON.stringify(i,(t=[],function(n,r){if(k_(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 k$(i,e){if(e===void 0&&(e=66060288e-1),i.size>=e&&i.data.length>1){var t=Math.floor(i.data.length/2),n=i.data.slice(0,t),r=i.data.slice(t);return[k$({size:HG(n),data:n,sessionId:i.sessionId,windowId:i.windowId}),k$({size:HG(r),data:r,sessionId:i.sessionId,windowId:i.windowId})].flatMap(a=>a)}return[i]}var PQ=(i=>(i[i.DomContentLoaded=0]="DomContentLoaded",i[i.Load=1]="Load",i[i.FullSnapshot=2]="FullSnapshot",i[i.IncrementalSnapshot=3]="IncrementalSnapshot",i[i.Meta=4]="Meta",i[i.Custom=5]="Custom",i[i.Plugin=6]="Plugin",i))(PQ||{}),DS=(i=>(i[i.Mutation=0]="Mutation",i[i.MouseMove=1]="MouseMove",i[i.MouseInteraction=2]="MouseInteraction",i[i.Scroll=3]="Scroll",i[i.ViewportResize=4]="ViewportResize",i[i.Input=5]="Input",i[i.TouchMove=6]="TouchMove",i[i.MediaInteraction=7]="MediaInteraction",i[i.StyleSheetRule=8]="StyleSheetRule",i[i.CanvasMutation=9]="CanvasMutation",i[i.Font=10]="Font",i[i.Log=11]="Log",i[i.Drag=12]="Drag",i[i.StyleDeclaration=13]="StyleDeclaration",i[i.Selection=14]="Selection",i[i.AdoptedStyleSheet=15]="AdoptedStyleSheet",i[i.CustomElement=16]="CustomElement",i))(DS||{}),G$="[SessionRecording]",F$="redacted",YG={initiatorTypes:["audio","beacon","body","css","early-hint","embed","fetch","frame","iframe","icon","image","img","input","link","navigation","object","ping","script","track","video","xmlhttprequest"],maskRequestFn:i=>i,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"]},JSt=["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"],qSt=["password","secret","passwd","api_key","apikey","auth","credentials","mysql_pwd","privatekey","private_key","token"],ZSt=["/s/","/e/","/i/"];function _we(i,e,t,n){if(BC(i))return i;var r=(e==null?void 0:e["content-length"])||function(a){return new Blob([a]).size}(i);return G_(r)&&(r=parseInt(r)),r>t?G$+" "+n+" body too large to record ("+r+" bytes)":i}function Ewe(i,e){if(BC(i))return i;var t=i;return y5(t,!1)||(t=G$+" "+e+" body "+F$),t1(qSt,n=>{var r,a;(r=t)!=null&&r.length&&((a=t)==null?void 0:a.indexOf(n))!==-1&&(t=G$+" "+e+" body "+F$+" as might contain: "+n)}),t}var XSt=(i,e)=>{var t,n,r,a={payloadSizeLimitBytes:YG.payloadSizeLimitBytes,performanceEntryTypeToObserve:[...YG.performanceEntryTypeToObserve],payloadHostDenyList:[...e.payloadHostDenyList||[],...YG.payloadHostDenyList]},o=i.session_recording.recordHeaders!==!1&&e.recordHeaders,s=i.session_recording.recordBody!==!1&&e.recordBody,l=i.capture_performance!==!1&&e.recordPerformance,u=(t=a,r=Math.min(1e6,(n=t.payloadSizeLimitBytes)!==null&&n!==void 0?n:1e6),p=>(p!=null&&p.requestBody&&(p.requestBody=_we(p.requestBody,p.requestHeaders,r,"Request")),p!=null&&p.responseBody&&(p.responseBody=_we(p.responseBody,p.responseHeaders,r,"Response")),p)),d=p=>{return u(((x,E)=>{var b,Q=v5(x.name),M=E.indexOf("http")===0?(b=v5(E))==null?void 0:b.pathname:E;M==="/"&&(M="");var L=Q==null?void 0:Q.pathname.replace(M||"","");if(!(Q&&L&&ZSt.some(V=>L.indexOf(V)===0)))return x})((y=(m=p).requestHeaders,BC(y)||t1(Object.keys(y??{}),x=>{JSt.includes(x.toLowerCase())&&(y[x]=F$)}),m),i.api_host));var m,y},f=tS(i.session_recording.maskNetworkRequestFn);return f&&tS(i.session_recording.maskCapturedNetworkRequestFn)&&Pf.warn("Both `maskNetworkRequestFn` and `maskCapturedNetworkRequestFn` are defined. `maskNetworkRequestFn` will be ignored."),f&&(i.session_recording.maskCapturedNetworkRequestFn=p=>{var m=i.session_recording.maskNetworkRequestFn({url:p.name});return Wd({},p,{name:m==null?void 0:m.url})}),a.maskRequestFn=tS(i.session_recording.maskCapturedNetworkRequestFn)?p=>{var m,y=d(p);return y&&(m=i.session_recording.maskCapturedNetworkRequestFn==null?void 0:i.session_recording.maskCapturedNetworkRequestFn(y))!==null&&m!==void 0?m:void 0}:p=>function(m){if(!ed(m))return m.requestBody=Ewe(m.requestBody,"Request"),m.responseBody=Ewe(m.responseBody,"Response"),m}(d(p)),Wd({},YG,a,{recordHeaders:o,recordBody:s,recordPerformance:l,recordInitialRequests:l})};class WSt{constructor(e,t){var n,r;t===void 0&&(t={}),this.yt={},this.wt=a=>{if(!this.yt[a]){var o,s;this.yt[a]=!0;var l=this.St(a);(o=(s=this.rt).onBlockedNode)==null||o.call(s,a,l)}},this.$t=a=>{var o=this.St(a);if((o==null?void 0:o.nodeName)!=="svg"&&o instanceof Element){var s=o.closest("svg");if(s)return[this._rrweb.mirror.getId(s),s]}return[a,o]},this.St=a=>this._rrweb.mirror.getNode(a),this.kt=a=>{var o,s,l,u,d,f,p,m;return((o=(s=a.removes)==null?void 0:s.length)!==null&&o!==void 0?o:0)+((l=(u=a.attributes)==null?void 0:u.length)!==null&&l!==void 0?l:0)+((d=(f=a.texts)==null?void 0:f.length)!==null&&d!==void 0?d:0)+((p=(m=a.adds)==null?void 0:m.length)!==null&&p!==void 0?p:0)},this.throttleMutations=a=>{if(a.type!==3||a.data.source!==0)return a;var o=a.data,s=this.kt(o);o.attributes&&(o.attributes=o.attributes.filter(u=>{var[d]=this.$t(u.id);return!this.ct.consumeRateLimit(d)&&u}));var l=this.kt(o);return l!==0||s===l?a:void 0},this._rrweb=e,this.rt=t,this.ct=new dwe({bucketSize:(n=this.rt.bucketSize)!==null&&n!==void 0?n:100,refillRate:(r=this.rt.refillRate)!==null&&r!==void 0?r:10,refillInterval:1e3,et:this.wt})}}var nS=Uint8Array,rB=Uint16Array,_5=Uint32Array,O$=new nS([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]),z$=new nS([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]),bwe=new nS([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),xwe=function(i,e){for(var t=new rB(31),n=0;n<31;++n)t[n]=e+=1<<i[n-1];var r=new _5(t[30]);for(n=1;n<30;++n)for(var a=t[n];a<t[n+1];++a)r[a]=a-t[n]<<5|n;return[t,r]},Bwe=xwe(O$,2),$St=Bwe[0],H$=Bwe[1];$St[28]=258,H$[258]=28;for(var Swe=xwe(z$,0)[1],wwe=new rB(32768),q1=0;q1<32768;++q1){var w3=(43690&q1)>>>1|(21845&q1)<<1;w3=(61680&(w3=(52428&w3)>>>2|(13107&w3)<<2))>>>4|(3855&w3)<<4,wwe[q1]=((65280&w3)>>>8|(255&w3)<<8)>>>1}var k4=function(i,e,t){for(var n=i.length,r=0,a=new rB(e);r<n;++r)++a[i[r]-1];var o,s=new rB(e);for(r=0;r<e;++r)s[r]=s[r-1]+a[r-1]<<1;for(o=new rB(n),r=0;r<n;++r)o[r]=wwe[s[i[r]-1]++]>>>15-i[r];return o},Q3=new nS(288);for(q1=0;q1<144;++q1)Q3[q1]=8;for(q1=144;q1<256;++q1)Q3[q1]=9;for(q1=256;q1<280;++q1)Q3[q1]=7;for(q1=280;q1<288;++q1)Q3[q1]=8;var VG=new nS(32);for(q1=0;q1<32;++q1)VG[q1]=5;var ewt=k4(Q3,9),twt=k4(VG,5),Qwe=function(i){return(i/8>>0)+(7&i&&1)},Mwe=function(i,e,t){(t==null||t>i.length)&&(t=i.length);var n=new(i instanceof rB?rB:i instanceof _5?_5:nS)(t-e);return n.set(i.subarray(e,t)),n},LQ=function(i,e,t){t<<=7&e;var n=e/8>>0;i[n]|=t,i[n+1]|=t>>>8},G4=function(i,e,t){t<<=7&e;var n=e/8>>0;i[n]|=t,i[n+1]|=t>>>8,i[n+2]|=t>>>16},Y$=function(i,e){for(var t=[],n=0;n<i.length;++n)i[n]&&t.push({s:n,f:i[n]});var r=t.length,a=t.slice();if(!r)return[new nS(0),0];if(r==1){var o=new nS(t[0].s+1);return o[t[0].s]=1,[o,1]}t.sort(function(V,Y){return V.f-Y.f}),t.push({s:-1,f:25001});var s=t[0],l=t[1],u=0,d=1,f=2;for(t[0]={s:-1,f:s.f+l.f,l:s,r:l};d!=r-1;)s=t[t[u].f<t[f].f?u++:f++],l=t[u!=d&&t[u].f<t[f].f?u++:f++],t[d++]={s:-1,f:s.f+l.f,l:s,r:l};var p=a[0].s;for(n=1;n<r;++n)a[n].s>p&&(p=a[n].s);var m=new rB(p+1),y=V$(t[d-1],m,0);if(y>e){n=0;var x=0,E=y-e,b=1<<E;for(a.sort(function(V,Y){return m[Y.s]-m[V.s]||V.f-Y.f});n<r;++n){var Q=a[n].s;if(!(m[Q]>e))break;x+=b-(1<<y-m[Q]),m[Q]=e}for(x>>>=E;x>0;){var M=a[n].s;m[M]<e?x-=1<<e-m[M]++-1:++n}for(;n>=0&&x;--n){var L=a[n].s;m[L]==e&&(--m[L],++x)}y=e}return[new nS(m),y]},V$=function(i,e,t){return i.s==-1?Math.max(V$(i.l,e,t+1),V$(i.r,e,t+1)):e[i.s]=t},Rwe=function(i){for(var e=i.length;e&&!i[--e];);for(var t=new rB(++e),n=0,r=i[0],a=1,o=function(l){t[n++]=l},s=1;s<=e;++s)if(i[s]==r&&s!=e)++a;else{if(!r&&a>2){for(;a>138;a-=138)o(32754);a>2&&(o(a>10?a-11<<5|28690:a-3<<5|12305),a=0)}else if(a>3){for(o(r),--a;a>6;a-=6)o(8304);a>2&&(o(a-3<<5|8208),a=0)}for(;a--;)o(r);a=1,r=i[s]}return[t.subarray(0,n),e]},F4=function(i,e){for(var t=0,n=0;n<e.length;++n)t+=i[n]*e[n];return t},K$=function(i,e,t){var n=t.length,r=Qwe(e+2);i[r]=255&n,i[r+1]=n>>>8,i[r+2]=255^i[r],i[r+3]=255^i[r+1];for(var a=0;a<n;++a)i[r+a+4]=t[a];return 8*(r+4+n)},Dwe=function(i,e,t,n,r,a,o,s,l,u,d){LQ(e,d++,t),++r[256];for(var f=Y$(r,15),p=f[0],m=f[1],y=Y$(a,15),x=y[0],E=y[1],b=Rwe(p),Q=b[0],M=b[1],L=Rwe(x),V=L[0],Y=L[1],q=new rB(19),K=0;K<Q.length;++K)q[31&Q[K]]++;for(K=0;K<V.length;++K)q[31&V[K]]++;for(var $=Y$(q,7),j=$[0],ue=$[1],ce=19;ce>4&&!j[bwe[ce-1]];--ce);var le,_e,ye,he,xe=u+5<<3,Ie=F4(r,Q3)+F4(a,VG)+o,Te=F4(r,p)+F4(a,x)+o+14+3*ce+F4(q,j)+(2*q[16]+3*q[17]+7*q[18]);if(xe<=Ie&&xe<=Te)return K$(e,d,i.subarray(l,l+u));if(LQ(e,d,1+(Te<Ie)),d+=2,Te<Ie){le=k4(p,m),_e=p,ye=k4(x,E),he=x;var Qe=k4(j,ue);for(LQ(e,d,M-257),LQ(e,d+5,Y-1),LQ(e,d+10,ce-4),d+=14,K=0;K<ce;++K)LQ(e,d+3*K,j[bwe[K]]);d+=3*ce;for(var Le=[Q,V],De=0;De<2;++De){var je=Le[De];for(K=0;K<je.length;++K){var et=31&je[K];LQ(e,d,Qe[et]),d+=j[et],et>15&&(LQ(e,d,je[K]>>>5&127),d+=je[K]>>>12)}}}else le=ewt,_e=Q3,ye=twt,he=VG;for(K=0;K<s;++K)if(n[K]>255){et=n[K]>>>18&31,G4(e,d,le[et+257]),d+=_e[et+257],et>7&&(LQ(e,d,n[K]>>>23&31),d+=O$[et]);var lt=31&n[K];G4(e,d,ye[lt]),d+=he[lt],lt>3&&(G4(e,d,n[K]>>>5&8191),d+=z$[lt])}else G4(e,d,le[n[K]]),d+=_e[n[K]];return G4(e,d,le[256]),d+_e[256]},nwt=new _5([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),iwt=function(){for(var i=new _5(256),e=0;e<256;++e){for(var t=e,n=9;--n;)t=(1&t&&3988292384)^t>>>1;i[e]=t}return i}(),rwt=function(){var i=4294967295;return{p:function(e){for(var t=i,n=0;n<e.length;++n)t=iwt[255&t^e[n]]^t>>>8;i=t},d:function(){return 4294967295^i}}},awt=function(i,e,t,n,r){return function(a,o,s,l,u,d){var f=a.length,p=new nS(l+f+5*(1+Math.floor(f/7e3))+u),m=p.subarray(l,p.length-u),y=0;if(!o||f<8)for(var x=0;x<=f;x+=65535){var E=x+65535;E<f?y=K$(m,y,a.subarray(x,E)):(m[x]=d,y=K$(m,y,a.subarray(x,f)))}else{for(var b=nwt[o-1],Q=b>>>13,M=8191&b,L=(1<<s)-1,V=new rB(32768),Y=new rB(L+1),q=Math.ceil(s/3),K=2*q,$=function(Ut){return(a[Ut]^a[Ut+1]<<q^a[Ut+2]<<K)&L},j=new _5(25e3),ue=new rB(288),ce=new rB(32),le=0,_e=0,ye=(x=0,0),he=0,xe=0;x<f;++x){var Ie=$(x),Te=32767&x,Qe=Y[Ie];if(V[Te]=Qe,Y[Ie]=Te,he<=x){var Le=f-x;if((le>7e3||ye>24576)&&Le>423){y=Dwe(a,m,0,j,ue,ce,_e,ye,xe,x-xe,y),ye=le=_e=0,xe=x;for(var De=0;De<286;++De)ue[De]=0;for(De=0;De<30;++De)ce[De]=0}var je=2,et=0,lt=M,dt=Te-Qe&32767;if(Le>2&&Ie==$(x-dt))for(var zt=Math.min(Q,Le)-1,Ft=Math.min(32767,x),nt=Math.min(258,Le);dt<=Ft&&--lt&&Te!=Qe;){if(a[x+je]==a[x+je-dt]){for(var Qt=0;Qt<nt&&a[x+Qt]==a[x+Qt-dt];++Qt);if(Qt>je){if(je=Qt,et=dt,Qt>zt)break;var bt=Math.min(dt,Qt-2),St=0;for(De=0;De<bt;++De){var Zt=x-dt+De+32768&32767,kt=Zt-V[Zt]+32768&32767;kt>St&&(St=kt,Qe=Zt)}}}dt+=(Te=Qe)-(Qe=V[Te])+32768&32767}if(et){j[ye++]=268435456|H$[je]<<18|Swe[et];var rt=31&H$[je],rn=31&Swe[et];_e+=O$[rt]+z$[rn],++ue[257+rt],++ce[rn],he=x+je,++le}else j[ye++]=a[x],++ue[a[x]]}}y=Dwe(a,m,d,j,ue,ce,_e,ye,xe,x-xe,y)}return Mwe(p,0,l+Qwe(y)+u)}(i,e.level==null?6:e.level,e.mem==null?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(i.length)))):12+e.mem,t,n,!0)},j$=function(i,e,t){for(;t;++e)i[e]=t,t>>>=8},owt=function(i,e){var t=e.filename;if(i[0]=31,i[1]=139,i[2]=8,i[8]=e.level<2?4:e.level==9?2:0,i[9]=3,e.mtime!=0&&j$(i,4,Math.floor(new Date(e.mtime||Date.now())/1e3)),t){i[3]=8;for(var n=0;n<=t.length;++n)i[n+10]=t.charCodeAt(n)}},swt=function(i){return 10+(i.filename&&i.filename.length+1||0)};function Nwe(i,e){e===void 0&&(e={});var t=rwt(),n=i.length;t.p(i);var r=awt(i,e,swt(e),8),a=r.length;return owt(r,e),j$(r,a-8,t.d()),j$(r,a-4,n),r}function Twe(i,e){var t=i.length;if(typeof TextEncoder<"u")return new TextEncoder().encode(i);for(var n=new nS(i.length+(i.length>>>1)),r=0,a=function(u){n[r++]=u},o=0;o<t;++o){if(r+5>n.length){var s=new nS(r+8+(t-o<<1));s.set(n),n=s}var l=i.charCodeAt(o);l<128||e?a(l):l<2048?(a(192|l>>>6),a(128|63&l)):l>55295&&l<57344?(a(240|(l=65536+(1047552&l)|1023&i.charCodeAt(++o))>>>18),a(128|l>>>12&63),a(128|l>>>6&63),a(128|63&l)):(a(224|l>>>12),a(128|l>>>6&63),a(128|63&l))}return Mwe(n,0,r)}function lwt(i,e){return function(t){for(var n=0,r=0;r<t.length;r++)n=(n<<5)-n+t.charCodeAt(r),n|=0;return Math.abs(n)}(i)%100<wB(100*e,0,100)}var dM="disabled",J$="sampled",KG="active",M3="buffering",q$="paused",Z$="trigger",Ew=Z$+"_activated",sx=Z$+"_pending",bw=Z$+"_"+dM;function Uwe(i,e){return e.some(t=>t.matching==="regex"&&new RegExp(t.url).test(i))}class Pwe{constructor(e){this.xt=e}triggerStatus(e){var t=this.xt.map(n=>n.triggerStatus(e));return t.includes(Ew)?Ew:t.includes(sx)?sx:bw}stop(){this.xt.forEach(e=>e.stop())}}class Lwe{constructor(e){this.xt=e}triggerStatus(e){var t=new Set;for(var n of this.xt)t.add(n.triggerStatus(e));switch(t.delete(bw),t.size){case 0:return bw;case 1:return Array.from(t)[0];default:return sx}}stop(){this.xt.forEach(e=>e.stop())}}class cwt{triggerStatus(){return sx}stop(){}}class uwt{constructor(e){this.Et=[],this.It=[],this.urlBlocked=!1,this._instance=e}onRemoteConfig(e){var t,n;this.Et=((t=e.sessionRecording)==null?void 0:t.urlTriggers)||[],this.It=((n=e.sessionRecording)==null?void 0:n.urlBlocklist)||[]}Pt(e){var t;return this.Et.length===0?bw:((t=this._instance)==null?void 0:t.get_property(y$))===e?Ew:sx}triggerStatus(e){var t=this.Pt(e),n=t===Ew?Ew:t===sx?sx:bw;return this._instance.register_for_session({$sdk_debug_replay_url_trigger_status:n}),n}checkUrlTriggerConditions(e,t,n){if(Qo!==void 0&&Qo.location.href){var r=Qo.location.href,a=this.urlBlocked,o=Uwe(r,this.It);a&&o||(o&&!a?e():!o&&a&&t(),Uwe(r,this.Et)&&n("url"))}}stop(){}}class Awt{constructor(e){this.linkedFlag=null,this.linkedFlagSeen=!1,this.Rt=()=>{},this._instance=e}triggerStatus(){var e=sx;return BC(this.linkedFlag)&&(e=bw),this.linkedFlagSeen&&(e=Ew),this._instance.register_for_session({$sdk_debug_replay_linked_flag_trigger_status:e}),e}onRemoteConfig(e,t){var n;if(this.linkedFlag=((n=e.sessionRecording)==null?void 0:n.linkedFlag)||null,!BC(this.linkedFlag)&&!this.linkedFlagSeen){var r=G_(this.linkedFlag)?this.linkedFlag:this.linkedFlag.flag,a=G_(this.linkedFlag)?null:this.linkedFlag.variant;this.Rt=this._instance.onFeatureFlags((o,s)=>{var l=!1;if(k_(s)&&r in s){var u=s[r];l=_w(u)?u===!0:a?u===a:!!u}this.linkedFlagSeen=l,l&&t(r,a)})}}stop(){this.Rt()}}class dwt{constructor(e){this.Tt=[],this._instance=e}onRemoteConfig(e){var t;this.Tt=((t=e.sessionRecording)==null?void 0:t.eventTriggers)||[]}Mt(e){var t;return this.Tt.length===0?bw:((t=this._instance)==null?void 0:t.get_property(v$))===e?Ew:sx}triggerStatus(e){var t=this.Mt(e),n=t===Ew?Ew:t===sx?sx:bw;return this._instance.register_for_session({$sdk_debug_replay_event_trigger_status:n}),n}stop(){}}function fwt(i){return i.isRecordingEnabled?M3:dM}function hwt(i){if(!i.receivedFlags)return M3;if(!i.isRecordingEnabled)return dM;if(i.urlTriggerMatching.urlBlocked)return q$;var e=i.isSampled===!0,t=new Pwe([i.eventTriggerMatching,i.urlTriggerMatching,i.linkedFlagMatching]).triggerStatus(i.sessionId);return e?J$:t===Ew?KG:t===sx?M3:i.isSampled===!1?dM:KG}function pwt(i){if(!i.receivedFlags)return M3;if(!i.isRecordingEnabled)return dM;if(i.urlTriggerMatching.urlBlocked)return q$;var e=new Lwe([i.eventTriggerMatching,i.urlTriggerMatching,i.linkedFlagMatching]).triggerStatus(i.sessionId),t=e!==bw,n=_w(i.isSampled);return t&&e===sx?M3:t&&e===bw||n&&!i.isSampled?dM:i.isSampled===!0?J$:KG}var O4="[SessionRecording]",lx=Mb(O4);function jG(){var i;return k0==null||(i=k0.__PosthogExtensions__)==null||(i=i.rrweb)==null?void 0:i.record}var gwt=3e5,mwt=[DS.MouseMove,DS.MouseInteraction,DS.Scroll,DS.ViewportResize,DS.Input,DS.TouchMove,DS.MediaInteraction,DS.Drag],kwe=i=>({rrwebMethod:i,enqueuedAt:Date.now(),attempt:1});function R3(i){return function(e,t){for(var n="",r=0;r<e.length;){var a=e[r++];n+=String.fromCharCode(a)}return n}(Nwe(Twe(JSON.stringify(i))))}function Gwe(i){return i.type===PQ.Custom&&i.data.tag==="sessionIdle"}class ywt{get sessionId(){return this.Ct}get Ft(){return this._instance.config.session_recording.session_idle_threshold_ms||3e5}get started(){return this.Ot}get At(){if(!this._instance.sessionManager)throw new Error(O4+" must be started with a valid sessionManager.");return this._instance.sessionManager}get Dt(){var e,t;return this.Lt.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:gwt}get jt(){var e=this._instance.get_property(U4);return _w(e)?e:null}get Nt(){var e,t,n=(e=this.C)==null?void 0:e.data[((t=this.C)==null?void 0:t.data.length)-1],{sessionStartTimestamp:r}=this.At.checkAndGetSessionAndWindowId(!0);return n?n.timestamp-r:null}get zt(){var e=!!this._instance.get_property(m$),t=!this._instance.config.disable_session_recording;return Qo&&e&&t}get Ut(){var e=!!this._instance.get_property(GSe),t=this._instance.config.enable_recording_console_log;return t??e}get qt(){var e,t,n,r,a,o,s=this._instance.config.session_recording.captureCanvas,l=this._instance.get_property(zSe),u=(e=(t=s==null?void 0:s.recordCanvas)!==null&&t!==void 0?t:l==null?void 0:l.enabled)!==null&&e!==void 0&&e,d=(n=(r=s==null?void 0:s.canvasFps)!==null&&r!==void 0?r:l==null?void 0:l.fps)!==null&&n!==void 0?n:4,f=(a=(o=s==null?void 0:s.canvasQuality)!==null&&o!==void 0?o:l==null?void 0:l.quality)!==null&&a!==void 0?a:.4;if(typeof f=="string"){var p=parseFloat(f);f=isNaN(p)?.4:p}return{enabled:u,fps:wB(d,0,12,"canvas recording fps",4),quality:wB(f,0,1,"canvas recording quality",.4)}}get Bt(){var e,t,n=this._instance.get_property(FSe),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},a=(r==null?void 0:r.recordHeaders)||(n==null?void 0:n.recordHeaders),o=(r==null?void 0:r.recordBody)||(n==null?void 0:n.recordBody),s=k_(this._instance.config.capture_performance)?this._instance.config.capture_performance.network_timing:this._instance.config.capture_performance,l=!!(_w(s)?s:n!=null&&n.capturePerformance);return a||o||l?{recordHeaders:a,recordBody:o,recordPerformance:l}:void 0}get Ht(){var e,t,n,r,a,o,s=this._instance.get_property(OSe),l={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:(n=this._instance.config.session_recording)==null?void 0:n.blockSelector},u=(r=l==null?void 0:l.maskAllInputs)!==null&&r!==void 0?r:s==null?void 0:s.maskAllInputs,d=(a=l==null?void 0:l.maskTextSelector)!==null&&a!==void 0?a:s==null?void 0:s.maskTextSelector,f=(o=l==null?void 0:l.blockSelector)!==null&&o!==void 0?o:s==null?void 0:s.blockSelector;return ed(u)&&ed(d)&&ed(f)?void 0:{maskAllInputs:u==null||u,maskTextSelector:d,blockSelector:f}}get Wt(){var e=this._instance.get_property(HSe);return ox(e)?e:null}get Gt(){var e=this._instance.get_property(YSe);return ox(e)?e:null}get status(){return this.Jt?this.Vt({receivedFlags:this.Jt,isRecordingEnabled:this.zt,isSampled:this.jt,urlTriggerMatching:this.Kt,eventTriggerMatching:this.Yt,linkedFlagMatching:this.Xt,sessionId:this.sessionId}):M3}constructor(e){if(this.Vt=fwt,this.Jt=!1,this.Qt=[],this.Zt="unknown",this.ti=Date.now(),this.Lt=new cwt,this.ii=void 0,this.ei=void 0,this.ri=void 0,this.si=void 0,this.ni=void 0,this._forceAllowLocalhostNetworkCapture=!1,this.oi=()=>{this.ai()},this.li=()=>{this.ui("browser offline",{})},this.hi=()=>{this.ui("browser online",{})},this.di=()=>{if(Af!=null&&Af.visibilityState){var r="window "+Af.visibilityState;this.ui(r,{})}},this._instance=e,this.Ot=!1,this.vi="/s/",this.ci=void 0,this.Jt=!1,!this._instance.sessionManager)throw lx.error("started without valid sessionManager"),new Error(O4+" started without valid sessionManager. This is a bug.");if(this._instance.config.__preview_experimental_cookieless_mode)throw new Error(O4+" cannot be used with __preview_experimental_cookieless_mode.");this.Xt=new Awt(this._instance),this.Kt=new uwt(this._instance),this.Yt=new dwt(this._instance);var{sessionId:t,windowId:n}=this.At.checkAndGetSessionAndWindowId();this.Ct=t,this.fi=n,this.C=this.pi(),this.Ft>=this.At.sessionTimeoutMs&&lx.warn("session_idle_threshold_ms ("+this.Ft+") is greater than the session timeout ("+this.At.sessionTimeoutMs+"). Session will never be detected as idle")}startIfEnabledOrStop(e){this.zt?(this.gi(e),v_(Qo,"beforeunload",this.oi),v_(Qo,"offline",this.li),v_(Qo,"online",this.hi),v_(Qo,"visibilitychange",this.di),this.mi(),this.bi(),BC(this.ii)&&(this.ii=this._instance.on("eventCaptured",t=>{try{if(t.event==="$pageview"){var n=t!=null&&t.properties.$current_url?this.yi(t==null?void 0:t.properties.$current_url):"";if(!n)return;this.ui("$pageview",{href:n})}}catch(r){lx.error("Could not add $pageview to rrweb session",r)}})),this.ei||(this.ei=this.At.onSessionId((t,n,r)=>{var a,o;r&&(this.ui("$session_id_change",{sessionId:t,windowId:n,changeReason:r}),(a=this._instance)==null||(a=a.persistence)==null||a.unregister(v$),(o=this._instance)==null||(o=o.persistence)==null||o.unregister(y$))}))):this.stopRecording()}stopRecording(){var e,t,n,r;this.Ot&&this.ci&&(this.ci(),this.ci=void 0,this.Ot=!1,Qo==null||Qo.removeEventListener("beforeunload",this.oi),Qo==null||Qo.removeEventListener("offline",this.li),Qo==null||Qo.removeEventListener("online",this.hi),Qo==null||Qo.removeEventListener("visibilitychange",this.di),this.pi(),clearInterval(this.wi),(e=this.ii)==null||e.call(this),this.ii=void 0,(t=this.ni)==null||t.call(this),this.ni=void 0,(n=this.ei)==null||n.call(this),this.ei=void 0,(r=this.si)==null||r.call(this),this.si=void 0,this.Yt.stop(),this.Kt.stop(),this.Xt.stop(),lx.info("stopped"))}Si(){var e;(e=this._instance.persistence)==null||e.unregister(U4)}$i(e){var t,n=this.Ct!==e,r=this.Wt;if(ox(r)){var a=this.jt,o=n||!_w(a),s=o?lwt(e,r):a;o&&(s?this.ki(J$):lx.warn("Sample rate ("+r+") has determined that this sessionId ("+e+") will not be sent to the server."),this.ui("samplingDecisionMade",{sampleRate:r,isSampled:s})),(t=this._instance.persistence)==null||t.register({[U4]:s})}else this.Si()}onRemoteConfig(e){var t,n,r,a;this.ui("$remote_config_received",e),this.xi(e),(t=e.sessionRecording)!=null&&t.endpoint&&(this.vi=(a=e.sessionRecording)==null?void 0:a.endpoint),this.mi(),((n=e.sessionRecording)==null?void 0:n.triggerMatchType)==="any"?(this.Vt=hwt,this.Lt=new Pwe([this.Yt,this.Kt])):(this.Vt=pwt,this.Lt=new Lwe([this.Yt,this.Kt])),this._instance.register_for_session({$sdk_debug_replay_remote_trigger_matching_config:(r=e.sessionRecording)==null?void 0:r.triggerMatchType}),this.Kt.onRemoteConfig(e),this.Yt.onRemoteConfig(e),this.Xt.onRemoteConfig(e,(o,s)=>{this.ki("linked_flag_matched",{flag:o,variant:s})}),this.Jt=!0,this.startIfEnabledOrStop()}mi(){ox(this.Wt)&&BC(this.si)&&(this.si=this.At.onSessionId(e=>{this.$i(e)}))}xi(e){if(this._instance.persistence){var t,n=this._instance.persistence,r=()=>{var a,o,s,l,u,d,f,p,m,y=(a=e.sessionRecording)==null?void 0:a.sampleRate,x=BC(y)?null:parseFloat(y);BC(x)&&this.Si();var E=(o=e.sessionRecording)==null?void 0:o.minimumDurationMilliseconds;n.register({[m$]:!!e.sessionRecording,[GSe]:(s=e.sessionRecording)==null?void 0:s.consoleLogRecordingEnabled,[FSe]:Wd({capturePerformance:e.capturePerformance},(l=e.sessionRecording)==null?void 0:l.networkPayloadCapture),[OSe]:(u=e.sessionRecording)==null?void 0:u.masking,[zSe]:{enabled:(d=e.sessionRecording)==null?void 0:d.recordCanvas,fps:(f=e.sessionRecording)==null?void 0:f.canvasFps,quality:(p=e.sessionRecording)==null?void 0:p.canvasQuality},[HSe]:x,[YSe]:ed(E)?null:E,[VSe]:(m=e.sessionRecording)==null?void 0:m.scriptConfig})};r(),(t=this.ri)==null||t.call(this),this.ri=this.At.onSessionId(r)}}log(e,t){var n;t===void 0&&(t="log"),(n=this._instance.sessionRecording)==null||n.onRRwebEmit({type:6,data:{plugin:"rrweb/console@1",payload:{level:t,trace:[],payload:[JSON.stringify(e)]}},timestamp:Date.now()})}gi(e){if(!ed(Object.assign)&&!ed(Array.from)&&!(this.Ot||this._instance.config.disable_session_recording||this._instance.consent.isOptedOut())){var t;this.Ot=!0,this.At.checkAndGetSessionAndWindowId(),jG()?this.Ei():(t=k0.__PosthogExtensions__)==null||t.loadExternalDependency==null||t.loadExternalDependency(this._instance,this.Ii,n=>{if(n)return lx.error("could not load recorder",n);this.Ei()}),lx.info("starting"),this.status===KG&&this.ki(e||"recording_initialized")}}get Ii(){var e;return((e=this._instance)==null||(e=e.persistence)==null||(e=e.get_property(VSe))==null?void 0:e.script)||"recorder"}Pi(e){var t;return e.type===3&&mwt.indexOf((t=e.data)==null?void 0:t.source)!==-1}Ri(e){var t=this.Pi(e);t||this.Zt||e.timestamp-this.ti>this.Ft&&(this.Zt=!0,clearInterval(this.wi),this.ui("sessionIdle",{eventTimestamp:e.timestamp,lastActivityTimestamp:this.ti,threshold:this.Ft,bufferLength:this.C.data.length,bufferSize:this.C.size}),this.ai());var n=!1;if(t&&(this.ti=e.timestamp,this.Zt)){var r=this.Zt==="unknown";this.Zt=!1,r||(this.ui("sessionNoLongerIdle",{reason:"user activity",type:e.type}),n=!0)}if(!this.Zt){var{windowId:a,sessionId:o}=this.At.checkAndGetSessionAndWindowId(!t,e.timestamp),s=this.Ct!==o,l=this.fi!==a;this.fi=a,this.Ct=o,s||l?(this.stopRecording(),this.startIfEnabledOrStop("session_id_changed")):n&&this.Ti()}}Mi(e){try{return e.rrwebMethod(),!0}catch(t){return this.Qt.length<10?this.Qt.push({enqueuedAt:e.enqueuedAt||Date.now(),attempt:e.attempt++,rrwebMethod:e.rrwebMethod}):lx.warn("could not emit queued rrweb event.",t,e),!1}}ui(e,t){return this.Mi(kwe(()=>jG().addCustomEvent(e,t)))}Ci(){return this.Mi(kwe(()=>jG().takeFullSnapshot()))}Ei(){var e,t,n,r,a={blockClass:"ph-no-capture",blockSelector:void 0,ignoreClass:"ph-ignore-input",maskTextClass:"ph-mask",maskTextSelector:void 0,maskTextFn:void 0,maskAllInputs:!0,maskInputOptions:{password:!0},maskInputFn:void 0,slimDOMOptions:{},collectFonts:!1,inlineStylesheet:!0,recordCrossOriginIframes:!1},o=this._instance.config.session_recording;for(var[s,l]of Object.entries(o||{}))s in a&&(s==="maskInputOptions"?a.maskInputOptions=Wd({password:!0},l):a[s]=l);this.qt&&this.qt.enabled&&(a.recordCanvas=!0,a.sampling={canvas:this.qt.fps},a.dataURLOptions={type:"image/webp",quality:this.qt.quality}),this.Ht&&(a.maskAllInputs=(t=this.Ht.maskAllInputs)===null||t===void 0||t,a.maskTextSelector=(n=this.Ht.maskTextSelector)!==null&&n!==void 0?n:void 0,a.blockSelector=(r=this.Ht.blockSelector)!==null&&r!==void 0?r:void 0);var u=jG();if(u){this.Fi=(e=this.Fi)!==null&&e!==void 0?e:new WSt(u,{refillRate:this._instance.config.session_recording.__mutationThrottlerRefillRate,bucketSize:this._instance.config.session_recording.__mutationThrottlerBucketSize,onBlockedNode:(f,p)=>{var m="Too many mutations on node '"+f+"'. Rate limiting. This could be due to SVG animations or something similar";lx.info(m,{node:p}),this.log(O4+" "+m,"warn")}});var d=this.Oi();this.ci=u(Wd({emit:f=>{this.onRRwebEmit(f)},plugins:d},a)),this.ti=Date.now(),this.Zt=_w(this.Zt)?this.Zt:"unknown",this.ui("$session_options",{sessionRecordingOptions:a,activePlugins:d.map(f=>f==null?void 0:f.name)}),this.ui("$posthog_config",{config:this._instance.config})}else lx.error("onScriptLoaded was called but rrwebRecord is not available. This indicates something has gone wrong.")}Ti(){if(this.wi&&clearInterval(this.wi),this.Zt!==!0){var e=this.Dt;e&&(this.wi=setInterval(()=>{this.Ci()},e))}}Oi(){var e,t,n=[],r=(e=k0.__PosthogExtensions__)==null||(e=e.rrwebPlugins)==null?void 0:e.getRecordConsolePlugin;r&&this.Ut&&n.push(r());var a=(t=k0.__PosthogExtensions__)==null||(t=t.rrwebPlugins)==null?void 0:t.getRecordNetworkPlugin;return this.Bt&&tS(a)&&(!mSt.includes(location.hostname)||this._forceAllowLocalhostNetworkCapture?n.push(a(XSt(this._instance.config,this.Bt))):lx.info("NetworkCapture not started because we are on localhost.")),n}onRRwebEmit(e){var t;if(this.Ai(),e&&k_(e)){if(e.type===PQ.Meta){var n=this.yi(e.data.href);if(this.Di=n,!n)return;e.data.href=n}else this.Li();if(this.Kt.checkUrlTriggerConditions(()=>this.ji(),()=>this.Ni(),p=>this.zi(p)),!this.Kt.urlBlocked||(r=e).type===PQ.Custom&&r.data.tag==="recording paused"){var r;e.type===PQ.FullSnapshot&&this.Ti(),e.type===PQ.FullSnapshot&&this.Jt&&this.Lt.triggerStatus(this.sessionId)===sx&&this.pi();var a=this.Fi?this.Fi.throttleMutations(e):e;if(a){var o=function(p){var m=p;if(m&&k_(m)&&m.type===6&&k_(m.data)&&m.data.plugin==="rrweb/console@1"){m.data.payload.payload.length>10&&(m.data.payload.payload=m.data.payload.payload.slice(0,10),m.data.payload.payload.push("...[truncated]"));for(var y=[],x=0;x<m.data.payload.payload.length;x++)m.data.payload.payload[x]&&m.data.payload.payload[x].length>2e3?y.push(m.data.payload.payload[x].slice(0,2e3)+"...[truncated]"):y.push(m.data.payload.payload[x]);return m.data.payload.payload=y,p}return p}(a);if(this.Ri(o),this.Zt!==!0||Gwe(o)){if(Gwe(o)){var s=o.data.payload;if(s){var l=s.lastActivityTimestamp,u=s.threshold;o.timestamp=l+u}}var d=(t=this._instance.config.session_recording.compress_events)===null||t===void 0||t?function(p){if(HG(p)<1024)return p;try{if(p.type===PQ.FullSnapshot)return Wd({},p,{data:R3(p.data),cv:"2024-10"});if(p.type===PQ.IncrementalSnapshot&&p.data.source===DS.Mutation)return Wd({},p,{cv:"2024-10",data:Wd({},p.data,{texts:R3(p.data.texts),attributes:R3(p.data.attributes),removes:R3(p.data.removes),adds:R3(p.data.adds)})});if(p.type===PQ.IncrementalSnapshot&&p.data.source===DS.StyleSheetRule)return Wd({},p,{cv:"2024-10",data:Wd({},p.data,{adds:p.data.adds?R3(p.data.adds):void 0,removes:p.data.removes?R3(p.data.removes):void 0})})}catch(m){lx.error("could not compress event - will use uncompressed event",m)}return p}(o):o,f={$snapshot_bytes:HG(d),$snapshot_data:d,$session_id:this.Ct,$window_id:this.fi};this.status!==dM?this.Ui(f):this.pi()}}}}}Li(){if(!this._instance.config.capture_pageview&&Qo){var e=this.yi(Qo.location.href);this.Di!==e&&(this.ui("$url_changed",{href:e}),this.Di=e)}}Ai(){if(this.Qt.length){var e=[...this.Qt];this.Qt=[],e.forEach(t=>{Date.now()-t.enqueuedAt<=2e3&&this.Mi(t)})}}yi(e){var t=this._instance.config.session_recording;if(t.maskNetworkRequestFn){var n,r={url:e};return(n=r=t.maskNetworkRequestFn(r))==null?void 0:n.url}return e}pi(){return this.C={size:0,data:[],sessionId:this.Ct,windowId:this.fi},this.C}ai(){this.qi&&(clearTimeout(this.qi),this.qi=void 0);var e=this.Gt,t=this.Nt,n=ox(t)&&t>=0,r=ox(e)&&n&&t<e;return this.status===M3||this.status===q$||this.status===dM||r?(this.qi=setTimeout(()=>{this.ai()},2e3),this.C):(this.C.data.length>0&&k$(this.C).forEach(a=>{this.Bi({$snapshot_bytes:a.size,$snapshot_data:a.data,$session_id:a.sessionId,$window_id:a.windowId,$lib:"web",$lib_version:DQ.LIB_VERSION})}),this.pi())}Ui(e){var t,n=2+(((t=this.C)==null?void 0:t.data.length)||0);!this.Zt&&(this.C.size+e.$snapshot_bytes+n>943718.4||this.C.sessionId!==this.Ct)&&(this.C=this.ai()),this.C.size+=e.$snapshot_bytes,this.C.data.push(e.$snapshot_data),this.qi||this.Zt||(this.qi=setTimeout(()=>{this.ai()},2e3))}Bi(e){this._instance.capture("$snapshot",e,{_url:this._instance.requestRouter.endpointFor("api",this.vi),_noTruncate:!0,_batchKey:"recordings",skip_client_rate_limiting:!0})}zi(e){var t;this.Lt.triggerStatus(this.sessionId)===sx&&((t=this._instance)==null||(t=t.persistence)==null||t.register({[e==="url"?y$:v$]:this.Ct}),this.ai(),this.ki(e+"_trigger_matched"))}ji(){this.Kt.urlBlocked||(this.Kt.urlBlocked=!0,clearInterval(this.wi),lx.info("recording paused due to URL blocker"),this.ui("recording paused",{reason:"url blocker"}))}Ni(){this.Kt.urlBlocked&&(this.Kt.urlBlocked=!1,this.Ci(),this.Ti(),this.ui("recording resumed",{reason:"left blocked url"}),lx.info("recording resumed"))}bi(){this.Yt.Tt.length!==0&&BC(this.ni)&&(this.ni=this._instance.on("eventCaptured",e=>{try{this.Yt.Tt.includes(e.event)&&this.zi("event")}catch(t){lx.error("Could not activate event trigger",t)}}))}overrideLinkedFlag(){this.Xt.linkedFlagSeen=!0,this.Ci(),this.ki("linked_flag_overridden")}overrideSampling(){var e;(e=this._instance.persistence)==null||e.register({[U4]:!0}),this.Ci(),this.ki("sampling_overridden")}overrideTrigger(e){this.zi(e)}ki(e,t){this._instance.register_for_session({$session_recording_start_reason:e}),lx.info(e.replace("_"," "),t),My(["recording_initialized","session_id_changed"],e)||this.ui(e,t)}get sdkDebugProperties(){var{sessionStartTimestamp:e}=this.At.checkAndGetSessionAndWindowId(!0);return{$recording_status:this.status,$sdk_debug_replay_internal_buffer_length:this.C.data.length,$sdk_debug_replay_internal_buffer_size:this.C.size,$sdk_debug_current_session_duration:this.Nt,$sdk_debug_session_start:e}}}var X$=Mb("[SegmentIntegration]");function vwt(i,e){var t=i.config.segment;if(!t)return e();(function(n,r){var a=n.config.segment;if(!a)return r();var o=l=>{var u=()=>l.anonymousId()||AM();n.config.get_device_id=u,l.id()&&(n.register({distinct_id:l.id(),$device_id:u()}),n.persistence.set_property(TQ,"identified")),r()},s=a.user();"then"in s&&tS(s.then)?s.then(l=>o(l)):o(s)})(i,()=>{t.register((n=>{Promise&&Promise.resolve||X$.warn("This browser does not have Promise support, and can not use the segment integration");var r=(a,o)=>{if(!o)return a;a.event.userId||a.event.anonymousId===n.get_distinct_id()||(X$.info("No userId set, resetting PostHog"),n.reset()),a.event.userId&&a.event.userId!==n.get_distinct_id()&&(X$.info("UserId set, identifying with PostHog"),n.identify(a.event.userId));var s=n.calculateEventProperties(o,a.event.properties);return a.event.properties=Object.assign({},s,a.event.properties),a};return{name:"PostHog JS",type:"enrichment",version:"1.0.0",isLoaded:()=>!0,load:()=>Promise.resolve(),track:a=>r(a,a.event.event),page:a=>r(a,"$pageview"),identify:a=>r(a,"$identify"),screen:a=>r(a,"$screen")}})(i)).then(()=>{e()})})}var Fwe="posthog-js";function Owe(i,e){var{organization:t,projectId:n,prefix:r,severityAllowList:a=["error"]}=e===void 0?{}:e;return o=>{var s,l,u,d,f;if(!(a==="*"||a.includes(o.level))||!i.__loaded)return o;o.tags||(o.tags={});var p=i.requestRouter.endpointFor("ui","/project/"+i.config.token+"/person/"+i.get_distinct_id());o.tags["PostHog Person URL"]=p,i.sessionRecordingStarted()&&(o.tags["PostHog Recording URL"]=i.get_session_replay_url({withTimestamp:!0}));var m=((s=o.exception)==null?void 0:s.values)||[],y=m.map(E=>Wd({},E,{stacktrace:E.stacktrace?Wd({},E.stacktrace,{type:"raw",frames:(E.stacktrace.frames||[]).map(b=>Wd({},b,{platform:"web:javascript"}))}):void 0})),x={$exception_message:((l=m[0])==null?void 0:l.value)||o.message,$exception_type:(u=m[0])==null?void 0:u.type,$exception_personURL:p,$exception_level:o.level,$exception_list:y,$sentry_event_id:o.event_id,$sentry_exception:o.exception,$sentry_exception_message:((d=m[0])==null?void 0:d.value)||o.message,$sentry_exception_type:(f=m[0])==null?void 0:f.type,$sentry_tags:o.tags};return t&&n&&(x.$sentry_url=(r||"https://sentry.io/organizations/")+t+"/issues/?project="+n+"&query="+o.event_id),i.exceptions.sendExceptionEvent(x),o}}class Cwt{constructor(e,t,n,r,a){this.name=Fwe,this.setupOnce=function(o){o(Owe(e,{organization:t,projectId:n,prefix:r,severityAllowList:a}))}}}var Iwt=Qo!=null&&Qo.location?UG(Qo.location.hash,"__posthog")||UG(location.hash,"state"):null,zwe="_postHogToolbarParams",Hwe=Mb("[Toolbar]"),fM=function(i){return i[i.UNINITIALIZED=0]="UNINITIALIZED",i[i.LOADING=1]="LOADING",i[i.LOADED=2]="LOADED",i}(fM||{});class _wt{constructor(e){this.instance=e}Hi(e){k0.ph_toolbar_state=e}Wi(){var e;return(e=k0.ph_toolbar_state)!==null&&e!==void 0?e:fM.UNINITIALIZED}maybeLoadToolbar(e,t,n){if(e===void 0&&(e=void 0),t===void 0&&(t=void 0),n===void 0&&(n=void 0),!Qo||!Af)return!1;e=e??Qo.location,n=n??Qo.history;try{if(!t){try{Qo.localStorage.setItem("test","test"),Qo.localStorage.removeItem("test")}catch{return!1}t=Qo==null?void 0:Qo.localStorage}var r,a=Iwt||UG(e.hash,"__posthog")||UG(e.hash,"state"),o=a?RSe(()=>JSON.parse(atob(decodeURIComponent(a))))||RSe(()=>JSON.parse(decodeURIComponent(a))):null;return o&&o.action==="ph_authorize"?((r=o).source="url",r&&Object.keys(r).length>0&&(o.desiredHash?e.hash=o.desiredHash:n?n.replaceState(n.state,"",e.pathname+e.search):e.hash="")):((r=JSON.parse(t.getItem(zwe)||"{}")).source="localstorage",delete r.userIntent),!(!r.token||this.instance.config.token!==r.token)&&(this.loadToolbar(r),!0)}catch{return!1}}Gi(e){var t=k0.ph_load_toolbar||k0.ph_load_editor;!BC(t)&&tS(t)?t(e,this.instance):Hwe.warn("No toolbar load function found")}loadToolbar(e){var t=!(Af==null||!Af.getElementById(KSe));if(!Qo||t)return!1;var n=this.instance.requestRouter.region==="custom"&&this.instance.config.advanced_disable_toolbar_metrics,r=Wd({token:this.instance.config.token},e,{apiURL:this.instance.requestRouter.endpointFor("ui")},n?{instrument:!1}:{});if(Qo.localStorage.setItem(zwe,JSON.stringify(Wd({},r,{source:void 0}))),this.Wi()===fM.LOADED)this.Gi(r);else if(this.Wi()===fM.UNINITIALIZED){var a;this.Hi(fM.LOADING),(a=k0.__PosthogExtensions__)==null||a.loadExternalDependency==null||a.loadExternalDependency(this.instance,"toolbar",o=>{if(o)return Hwe.error("[Toolbar] Failed to load",o),void this.Hi(fM.UNINITIALIZED);this.Hi(fM.LOADED),this.Gi(r)}),v_(Qo,"turbolinks:load",()=>{this.Hi(fM.UNINITIALIZED),this.loadToolbar(r)})}return!0}Ji(e){return this.loadToolbar(e)}maybeLoadEditor(e,t,n){return e===void 0&&(e=void 0),t===void 0&&(t=void 0),n===void 0&&(n=void 0),this.maybeLoadToolbar(e,t,n)}}var Ewt=Mb("[TracingHeaders]");class bwt{constructor(e){this.Vi=void 0,this.Ki=void 0,this.nt=()=>{var t,n;ed(this.Vi)&&((t=k0.__PosthogExtensions__)==null||(t=t.tracingHeadersPatchFns)==null||t._patchXHR(this._instance.sessionManager)),ed(this.Ki)&&((n=k0.__PosthogExtensions__)==null||(n=n.tracingHeadersPatchFns)==null||n._patchFetch(this._instance.sessionManager))},this._instance=e}J(e){var t,n;(t=k0.__PosthogExtensions__)!=null&&t.tracingHeadersPatchFns&&e(),(n=k0.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this._instance,"tracing-headers",r=>{if(r)return Ewt.error("failed to load script",r);e()})}startIfEnabledOrStop(){var e,t;this._instance.config.__add_tracing_headers?this.J(this.nt):((e=this.Vi)==null||e.call(this),(t=this.Ki)==null||t.call(this),this.Vi=void 0,this.Ki=void 0)}}var hM=Mb("[Web Vitals]"),Ywe=9e5;class xwt{constructor(e){var t;this.Yi=!1,this.i=!1,this.C={url:void 0,metrics:[],firstMetricTimestamp:void 0},this.Xi=()=>{clearTimeout(this.Qi),this.C.metrics.length!==0&&(this._instance.capture("$web_vitals",this.C.metrics.reduce((n,r)=>Wd({},n,{["$web_vitals_"+r.name+"_event"]:Wd({},r),["$web_vitals_"+r.name+"_value"]:r.value}),{})),this.C={url:void 0,metrics:[],firstMetricTimestamp:void 0})},this.Zi=n=>{var r,a=(r=this._instance.sessionManager)==null?void 0:r.checkAndGetSessionAndWindowId(!0);if(ed(a))hM.error("Could not read session ID. Dropping metrics!");else{this.C=this.C||{url:void 0,metrics:[],firstMetricTimestamp:void 0};var o=this.te();ed(o)||(BC(n==null?void 0:n.name)||BC(n==null?void 0:n.value)?hM.error("Invalid metric received",n):this.ie&&n.value>=this.ie?hM.error("Ignoring metric with value >= "+this.ie,n):(this.C.url!==o&&(this.Xi(),this.Qi=setTimeout(this.Xi,this.flushToCaptureTimeoutMs)),ed(this.C.url)&&(this.C.url=o),this.C.firstMetricTimestamp=ed(this.C.firstMetricTimestamp)?Date.now():this.C.firstMetricTimestamp,n.attribution&&n.attribution.interactionTargetElement&&(n.attribution.interactionTargetElement=void 0),this.C.metrics.push(Wd({},n,{$current_url:o,$session_id:a.sessionId,$window_id:a.windowId,timestamp:Date.now()})),this.C.metrics.length===this.allowedMetrics.length&&this.Xi()))}},this.nt=()=>{var n,r,a,o,s=k0.__PosthogExtensions__;ed(s)||ed(s.postHogWebVitalsCallbacks)||({onLCP:n,onCLS:r,onFCP:a,onINP:o}=s.postHogWebVitalsCallbacks),n&&r&&a&&o?(this.allowedMetrics.indexOf("LCP")>-1&&n(this.Zi.bind(this)),this.allowedMetrics.indexOf("CLS")>-1&&r(this.Zi.bind(this)),this.allowedMetrics.indexOf("FCP")>-1&&a(this.Zi.bind(this)),this.allowedMetrics.indexOf("INP")>-1&&o(this.Zi.bind(this)),this.i=!0):hM.error("web vitals callbacks not loaded - not starting")},this._instance=e,this.Yi=!((t=this._instance.persistence)==null||!t.props[PSe]),this.startIfEnabled()}get allowedMetrics(){var e,t,n=k_(this._instance.config.capture_performance)?(e=this._instance.config.capture_performance)==null?void 0:e.web_vitals_allowed_metrics:void 0;return ed(n)?((t=this._instance.persistence)==null?void 0:t.props[kSe])||["CLS","FCP","INP","LCP"]:n}get flushToCaptureTimeoutMs(){return(k_(this._instance.config.capture_performance)?this._instance.config.capture_performance.web_vitals_delayed_flush_ms:void 0)||5e3}get ie(){var e=k_(this._instance.config.capture_performance)&&ox(this._instance.config.capture_performance.__web_vitals_max_value)?this._instance.config.capture_performance.__web_vitals_max_value:Ywe;return 0<e&&e<=6e4?Ywe:e}get isEnabled(){var e=nB==null?void 0:nB.protocol;if(e!=="http:"&&e!=="https:")return hM.info("Web Vitals are disabled on non-http/https protocols"),!1;var t=k_(this._instance.config.capture_performance)?this._instance.config.capture_performance.web_vitals:_w(this._instance.config.capture_performance)?this._instance.config.capture_performance:void 0;return _w(t)?t:this.Yi}startIfEnabled(){this.isEnabled&&!this.i&&(hM.info("enabled, starting..."),this.J(this.nt))}onRemoteConfig(e){var t=k_(e.capturePerformance)&&!!e.capturePerformance.web_vitals,n=k_(e.capturePerformance)?e.capturePerformance.web_vitals_allowed_metrics:void 0;this._instance.persistence&&(this._instance.persistence.register({[PSe]:t}),this._instance.persistence.register({[kSe]:n})),this.Yi=t,this.startIfEnabled()}J(e){var t,n;(t=k0.__PosthogExtensions__)!=null&&t.postHogWebVitalsCallbacks&&e(),(n=k0.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this._instance,"web-vitals",r=>{r?hM.error("failed to load script",r):e()})}te(){var e=Qo?Qo.location.href:void 0;return e||hM.error("Could not determine current URL"),e}}var Bwt=Mb("[Heatmaps]");function Vwe(i){return k_(i)&&"clientX"in i&&"clientY"in i&&ox(i.clientX)&&ox(i.clientY)}class Swt{constructor(e){var t;this.rageclicks=new owe,this.Yi=!1,this.i=!1,this.ee=null,this.instance=e,this.Yi=!((t=this.instance.persistence)==null||!t.props[p$])}get flushIntervalMilliseconds(){var e=5e3;return k_(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 ed(this.instance.config.capture_heatmaps)?ed(this.instance.config.enable_heatmaps)?this.Yi:this.instance.config.enable_heatmaps:this.instance.config.capture_heatmaps!==!1}startIfEnabled(){if(this.isEnabled){if(this.i)return;Bwt.info("starting..."),this.re(),this.ee=setInterval(this.se.bind(this),this.flushIntervalMilliseconds)}else{var e,t;clearInterval((e=this.ee)!==null&&e!==void 0?e:void 0),(t=this.ne)==null||t.stop(),this.getAndClearBuffer()}}onRemoteConfig(e){var t=!!e.heatmaps;this.instance.persistence&&this.instance.persistence.register({[p$]:t}),this.Yi=t,this.startIfEnabled()}getAndClearBuffer(){var e=this.C;return this.C=void 0,e}oe(e){this.ae(e.originalEvent,"deadclick")}re(){Qo&&Af&&(v_(Qo,"beforeunload",this.se.bind(this)),v_(Af,"click",e=>this.ae(e||(Qo==null?void 0:Qo.event)),{capture:!0}),v_(Af,"mousemove",e=>this.le(e||(Qo==null?void 0:Qo.event)),{capture:!0}),this.ne=new Awe(this.instance,RSt,this.oe.bind(this)),this.ne.startIfEnabled(),this.i=!0)}ue(e,t){var n=this.instance.scrollManager.scrollY(),r=this.instance.scrollManager.scrollX(),a=this.instance.scrollManager.scrollElement(),o=function(s,l,u){for(var d=s;d&&RG(d)&&!uM(d,"body");){if(d===u)return!1;if(My(l,Qo==null?void 0:Qo.getComputedStyle(d).position))return!0;d=$Se(d)}return!1}(WSe(e),["fixed","sticky"],a);return{x:e.clientX+(o?0:r),y:e.clientY+(o?0:n),target_fixed:o,type:t}}ae(e,t){var n;if(t===void 0&&(t="click"),!jSe(e.target)&&Vwe(e)){var r=this.ue(e,t);(n=this.rageclicks)!=null&&n.isRageClick(e.clientX,e.clientY,new Date().getTime())&&this.he(Wd({},r,{type:"rageclick"})),this.he(r)}}le(e){!jSe(e.target)&&Vwe(e)&&(clearTimeout(this.de),this.de=setTimeout(()=>{this.he(this.ue(e,"mousemove"))},500))}he(e){if(Qo){var t=Qo.location.href;this.C=this.C||{},this.C[t]||(this.C[t]=[]),this.C[t].push(e)}}se(){this.C&&!g5(this.C)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}}class wwt{constructor(e){this._instance=e}doPageView(e,t){var n,r=this.ve(e,t);return this.ce={pathname:(n=Qo==null?void 0:Qo.location.pathname)!==null&&n!==void 0?n:"",pageViewId:t,timestamp:e},this._instance.scrollManager.resetContext(),r}doPageLeave(e){var t;return this.ve(e,(t=this.ce)==null?void 0:t.pageViewId)}doEvent(){var e;return{$pageview_id:(e=this.ce)==null?void 0:e.pageViewId}}ve(e,t){var n=this.ce;if(!n)return{$pageview_id:t};var r={$pageview_id:t,$prev_pageview_id:n.pageViewId},a=this._instance.scrollManager.getContext();if(a&&!this._instance.config.disable_scroll_properties){var{maxScrollHeight:o,lastScrollY:s,maxScrollY:l,maxContentHeight:u,lastContentY:d,maxContentY:f}=a;if(!(ed(o)||ed(s)||ed(l)||ed(u)||ed(d)||ed(f))){o=Math.ceil(o),s=Math.ceil(s),l=Math.ceil(l),u=Math.ceil(u),d=Math.ceil(d),f=Math.ceil(f);var p=o<=1?1:wB(s/o,0,1),m=o<=1?1:wB(l/o,0,1),y=u<=1?1:wB(d/u,0,1),x=u<=1?1:wB(f/u,0,1);r=EE(r,{$prev_pageview_last_scroll:s,$prev_pageview_last_scroll_percentage:p,$prev_pageview_max_scroll:l,$prev_pageview_max_scroll_percentage:m,$prev_pageview_last_content:d,$prev_pageview_last_content_percentage:y,$prev_pageview_max_content:f,$prev_pageview_max_content_percentage:x})}}return n.pathname&&(r.$prev_pageview_pathname=n.pathname),n.timestamp&&(r.$prev_pageview_duration=(e.getTime()-n.timestamp.getTime())/1e3),r}}var Qwt=function(i){var e,t,n,r,a="";for(e=t=0,n=(i=(i+"").replace(/\r\n/g,`
894
894
  `).replace(/\r/g,`
895
- `)).length,r=0;r<n;r++){var o=i.charCodeAt(r),s=null;o<128?t++:s=o>127&&o<2048?String.fromCharCode(o>>6|192,63&o|128):String.fromCharCode(o>>12|224,o>>6&63|128,63&o|128),lM(s)||(t>e&&(a+=i.substring(e,t)),a+=s,e=t=r+1)}return t>e&&(a+=i.substring(e,i.length)),a},Mwt=!!u$||!!c$,Kwe="text/plain",JG=(i,e)=>{var[t,n]=i.split("?"),r=Wd({},e);n==null||n.split("&").forEach(o=>{var[s]=o.split("=");delete r[s]});var a=ySt(r);return t+"?"+(a=a?(n?n+"&":"")+a:n)},z4=(i,e)=>JSON.stringify(i,(t,n)=>typeof n=="bigint"?n.toString():n,e),W$=i=>{var{data:e,compression:t}=i;if(e){if(t===NQ.GZipJS){var n=Nwe(Twe(z4(e)),{mtime:0}),r=new Blob([n],{type:Kwe});return{contentType:Kwe,body:r,estimatedSize:r.size}}if(t===NQ.Base64){var a=function(l){var u,d,f,p,m,y="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",x=0,E=0,b="",Q=[];if(!l)return l;l=Qwt(l);do u=(m=l.charCodeAt(x++)<<16|l.charCodeAt(x++)<<8|l.charCodeAt(x++))>>18&63,d=m>>12&63,f=m>>6&63,p=63&m,Q[E++]=y.charAt(u)+y.charAt(d)+y.charAt(f)+y.charAt(p);while(x<l.length);switch(b=Q.join(""),l.length%3){case 1:b=b.slice(0,-2)+"==";break;case 2:b=b.slice(0,-1)+"="}return b}(z4(e)),o=(l=>"data="+encodeURIComponent(typeof l=="string"?l:z4(l)))(a);return{contentType:"application/x-www-form-urlencoded",body:o,estimatedSize:new Blob([o]).size}}var s=z4(e);return{contentType:"application/json",body:s,estimatedSize:new Blob([s]).size}}},H4=[];c$&&H4.push({transport:"fetch",method:i=>{var e,t,{contentType:n,body:r,estimatedSize:a}=(e=W$(i))!==null&&e!==void 0?e:{},o=new Headers;t1(i.headers,function(d,f){o.append(f,d)}),n&&o.append("Content-Type",n);var s=i.url,l=null;if(xSe){var u=new xSe;l={signal:u.signal,timeout:setTimeout(()=>u.abort(),i.timeout)}}c$(s,Wd({method:(i==null?void 0:i.method)||"GET",headers:o,keepalive:i.method==="POST"&&(a||0)<52428.8,body:r,signal:(t=l)==null?void 0:t.signal},i.fetchOptions)).then(d=>d.text().then(f=>{var p={statusCode:d.status,text:f};if(d.status===200)try{p.json=JSON.parse(f)}catch(m){Pf.error(m)}i.callback==null||i.callback(p)})).catch(d=>{Pf.error(d),i.callback==null||i.callback({statusCode:0,text:d})}).finally(()=>l?clearTimeout(l.timeout):null)}}),u$&&H4.push({transport:"XHR",method:i=>{var e,t=new u$;t.open(i.method||"GET",i.url,!0);var{contentType:n,body:r}=(e=W$(i))!==null&&e!==void 0?e:{};t1(i.headers,function(a,o){t.setRequestHeader(o,a)}),n&&t.setRequestHeader("Content-Type",n),i.timeout&&(t.timeout=i.timeout),t.withCredentials=!0,t.onreadystatechange=()=>{if(t.readyState===4){var a={statusCode:t.status,text:t.responseText};if(t.status===200)try{a.json=JSON.parse(t.responseText)}catch{}i.callback==null||i.callback(a)}},t.send(r)}}),SB!=null&&SB.sendBeacon&&H4.push({transport:"sendBeacon",method:i=>{var e=JG(i.url,{beacon:"1"});try{var t,{contentType:n,body:r}=(t=W$(i))!==null&&t!==void 0?t:{},a=typeof r=="string"?new Blob([r],{type:n}):r;SB.sendBeacon(e,a)}catch{}}});var E5=function(i,e){if(!function(t){try{new RegExp(t)}catch{return!1}return!0}(e))return!1;try{return new RegExp(e).test(i)}catch{return!1}};function jwe(i,e,t){return z4({distinct_id:i,userPropertiesToSet:e,userPropertiesToSetOnce:t})}var Rwt={exact:(i,e)=>e.some(t=>i.some(n=>t===n)),is_not:(i,e)=>e.every(t=>i.every(n=>t!==n)),regex:(i,e)=>e.some(t=>i.some(n=>E5(t,n))),not_regex:(i,e)=>e.every(t=>i.every(n=>!E5(t,n))),icontains:(i,e)=>e.map(qG).some(t=>i.map(qG).some(n=>t.includes(n))),not_icontains:(i,e)=>e.map(qG).every(t=>i.map(qG).every(n=>!t.includes(n)))},qG=i=>i.toLowerCase(),Dwt=Mb("[Error tracking]");class Nwt{constructor(e){var t,n;this.fe=[],this._instance=e,this.fe=(t=(n=this._instance.persistence)==null?void 0:n.get_property(g$))!==null&&t!==void 0?t:[]}onRemoteConfig(e){var t,n,r=(t=(n=e.errorTracking)==null?void 0:n.suppressionRules)!==null&&t!==void 0?t:[];this.fe=r,this._instance.persistence&&this._instance.persistence.register({[g$]:this.fe})}sendExceptionEvent(e){this.pe(e)?Dwt.info("Skipping exception capture because a suppression rule matched"):this._instance.capture("$exception",e,{_noTruncate:!0,_batchKey:"exceptionEvent"})}pe(e){var t=e.$exception_list;if(!t||!o_(t)||t.length===0)return!1;var n=t.reduce((r,a)=>{var{type:o,value:s}=a;return G_(o)&&o.length>0&&r.$exception_types.push(o),G_(s)&&s.length>0&&r.$exception_values.push(s),r},{$exception_types:[],$exception_values:[]});return this.fe.some(r=>{var a=r.values.map(o=>{var s,l=Rwt[o.operator],u=o_(o.value)?o.value:[o.value],d=(s=n[o.key])!==null&&s!==void 0?s:[];return u.length>0&&l(u,d)});return r.type==="OR"?a.some(Boolean):a.every(Boolean)})}}var iS="Mobile",ZG="iOS",xw="Android",Y4="Tablet",Jwe=xw+" "+Y4,qwe="iPad",Zwe="Apple",Xwe=Zwe+" Watch",V4="Safari",b5="BlackBerry",Wwe="Samsung",$we=Wwe+"Browser",eQe=Wwe+" Internet",D3="Chrome",Twt=D3+" OS",tQe=D3+" "+ZG,$$="Internet Explorer",nQe=$$+" "+iS,eee="Opera",Uwt=eee+" Mini",tee="Edge",iQe="Microsoft "+tee,x5="Firefox",rQe=x5+" "+ZG,K4="Nintendo",j4="PlayStation",B5="Xbox",aQe=xw+" "+iS,oQe=iS+" "+V4,J4="Windows",nee=J4+" Phone",sQe="Nokia",iee="Ouya",lQe="Generic",Pwt=lQe+" "+iS.toLowerCase(),cQe=lQe+" "+Y4.toLowerCase(),ree="Konqueror",Rx="(\\d+(\\.\\d+)?)",aee=new RegExp("Version/"+Rx),Lwt=new RegExp(B5,"i"),kwt=new RegExp(j4+" \\w+","i"),Gwt=new RegExp(K4+" \\w+","i"),oee=new RegExp(b5+"|PlayBook|BB10","i"),Fwt={"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"},Owt=(i,e)=>e&&My(e,Zwe)||function(t){return My(t,V4)&&!My(t,D3)&&!My(t,xw)}(i),uQe=function(i,e){return e=e||"",My(i," OPR/")&&My(i,"Mini")?Uwt:My(i," OPR/")?eee:oee.test(i)?b5:My(i,"IE"+iS)||My(i,"WPDesktop")?nQe:My(i,$we)?eQe:My(i,tee)||My(i,"Edg/")?iQe:My(i,"FBIOS")?"Facebook "+iS:My(i,"UCWEB")||My(i,"UCBrowser")?"UC Browser":My(i,"CriOS")?tQe:My(i,"CrMo")||My(i,D3)?D3:My(i,xw)&&My(i,V4)?aQe:My(i,"FxiOS")?rQe:My(i.toLowerCase(),ree.toLowerCase())?ree:Owt(i,e)?My(i,iS)?oQe:V4:My(i,x5)?x5:My(i,"MSIE")||My(i,"Trident/")?$$:My(i,"Gecko")?x5:""},zwt={[nQe]:[new RegExp("rv:"+Rx)],[iQe]:[new RegExp(tee+"?\\/"+Rx)],[D3]:[new RegExp("("+D3+"|CrMo)\\/"+Rx)],[tQe]:[new RegExp("CriOS\\/"+Rx)],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/"+Rx)],[V4]:[aee],[oQe]:[aee],[eee]:[new RegExp("(Opera|OPR)\\/"+Rx)],[x5]:[new RegExp(x5+"\\/"+Rx)],[rQe]:[new RegExp("FxiOS\\/"+Rx)],[ree]:[new RegExp("Konqueror[:/]?"+Rx,"i")],[b5]:[new RegExp(b5+" "+Rx),aee],[aQe]:[new RegExp("android\\s"+Rx,"i")],[eQe]:[new RegExp($we+"\\/"+Rx)],[$$]:[new RegExp("(rv:|MSIE )"+Rx)],Mozilla:[new RegExp("rv:"+Rx)]},Hwt=function(i,e){var t=uQe(i,e),n=zwt[t];if(ed(n))return null;for(var r=0;r<n.length;r++){var a=n[r],o=i.match(a);if(o)return parseFloat(o[o.length-2])}return null},AQe=[[new RegExp(B5+"; "+B5+" (.*?)[);]","i"),i=>[B5,i&&i[1]||""]],[new RegExp(K4,"i"),[K4,""]],[new RegExp(j4,"i"),[j4,""]],[oee,[b5,""]],[new RegExp(J4,"i"),(i,e)=>{if(/Phone/.test(e)||/WPDesktop/.test(e))return[nee,""];if(new RegExp(iS).test(e)&&!/IEMobile\b/.test(e))return[J4+" "+iS,""];var t=/Windows NT ([0-9.]+)/i.exec(e);if(t&&t[1]){var n=t[1],r=Fwt[n]||"";return/arm/i.test(e)&&(r="RT"),[J4,r]}return[J4,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,i=>{if(i&&i[3]){var e=[i[3],i[4],i[5]||"0"];return[ZG,e.join(".")]}return[ZG,""]}],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,i=>{var e="";return i&&i.length>=3&&(e=ed(i[2])?i[3]:i[2]),["watchOS",e]}],[new RegExp("("+xw+" (\\d+)\\.(\\d+)\\.?(\\d+)?|"+xw+")","i"),i=>{if(i&&i[2]){var e=[i[2],i[3],i[4]||"0"];return[xw,e.join(".")]}return[xw,""]}],[/Mac OS X (\d+)[_.](\d+)[_.]?(\d+)?/i,i=>{var e=["Mac OS X",""];if(i&&i[1]){var t=[i[1],i[2],i[3]||"0"];e[1]=t.join(".")}return e}],[/Mac/i,["Mac OS X",""]],[/CrOS/,[Twt,""]],[/Linux|debian/i,["Linux",""]]],dQe=function(i){return Gwt.test(i)?K4:kwt.test(i)?j4:Lwt.test(i)?B5:new RegExp(iee,"i").test(i)?iee:new RegExp("("+nee+"|WPDesktop)","i").test(i)?nee:/iPad/.test(i)?qwe:/iPod/.test(i)?"iPod Touch":/iPhone/.test(i)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(i)?Xwe:oee.test(i)?b5:/(kobo)\s(ereader|touch)/i.test(i)?"Kobo":new RegExp(sQe,"i").test(i)?sQe:/(kf[a-z]{2}wi|aeo[c-r]{2})( bui|\))/i.test(i)||/(kf[a-z]+)( bui|\)).+silk\//i.test(i)?"Kindle Fire":/(Android|ZTE)/i.test(i)?!new RegExp(iS).test(i)||/(9138B|TB782B|Nexus [97]|pixel c|HUAWEISHT|BTV|noble nook|smart ultra 6)/i.test(i)?/pixel[\daxl ]{1,6}/i.test(i)&&!/pixel c/i.test(i)||/(huaweimed-al00|tah-|APA|SM-G92|i980|zte|U304AA)/i.test(i)||/lmy47v/i.test(i)&&!/QTAQZ3/i.test(i)?xw:Jwe:xw:new RegExp("(pda|"+iS+")","i").test(i)?Pwt:new RegExp(Y4,"i").test(i)&&!new RegExp(Y4+" pc","i").test(i)?cQe:""},XG="https?://(.*)",WG=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],Ywt=_G(["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid"],WG),see="<masked>";function fQe(i,e,t){if(!Af)return{};var n=e?_G([],WG,t||[]):[];return hQe(Q$(Af.URL,n,see),i)}function hQe(i,e){var t=Ywt.concat(e||[]),n={};return t1(t,function(r){var a=TG(i,r);n[r]=a||null}),n}function pQe(i){var e=function(a){return a?a.search(XG+"google.([^/?]*)")===0?"google":a.search(XG+"bing.com")===0?"bing":a.search(XG+"yahoo.com")===0?"yahoo":a.search(XG+"duckduckgo.com")===0?"duckduckgo":null:null}(i),t=e!="yahoo"?"q":"p",n={};if(!lM(e)){n.$search_engine=e;var r=Af?TG(Af.referrer,t):"";r.length&&(n.ph_keyword=r)}return n}function gQe(){return navigator.language||navigator.userLanguage}function mQe(){return(Af==null?void 0:Af.referrer)||"$direct"}function yQe(i,e){var t=i?_G([],WG,e||[]):[],n=nB==null?void 0:nB.href.substring(0,1e3);return{r:mQe().substring(0,1e3),u:n?Q$(n,t,see):void 0}}function vQe(i){var e,{r:t,u:n}=i,r={$referrer:t,$referring_domain:t==null?void 0:t=="$direct"?"$direct":(e=v5(t))==null?void 0:e.host};if(n){r.$current_url=n;var a=v5(n);r.$host=a==null?void 0:a.host,r.$pathname=a==null?void 0:a.pathname;var o=hQe(n);EE(r,o)}if(t){var s=pQe(t);EE(r,s)}return r}function CQe(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch{return}}function Vwt(){try{return new Date().getTimezoneOffset()}catch{return}}function Kwt(i,e){if(!iB)return{};var t,n,r,a=i?_G([],WG,e||[]):[],[o,s]=function(l){for(var u=0;u<AQe.length;u++){var[d,f]=AQe[u],p=d.exec(l),m=p&&(tS(f)?f(p,l):f);if(m)return m}return["",""]}(iB);return EE(h$({$os:o,$os_version:s,$browser:uQe(iB,navigator.vendor),$device:dQe(iB),$device_type:(n=iB,r=dQe(n),r===qwe||r===Jwe||r==="Kobo"||r==="Kindle Fire"||r===cQe?Y4:r===K4||r===B5||r===j4||r===iee?"Console":r===Xwe?"Wearable":r?iS:"Desktop"),$timezone:CQe(),$timezone_offset:Vwt()}),{$current_url:Q$(nB==null?void 0:nB.href,a,see),$host:nB==null?void 0:nB.host,$pathname:nB==null?void 0:nB.pathname,$raw_user_agent:iB.length>1e3?iB.substring(0,997)+"...":iB,$browser_version:Hwt(iB,navigator.vendor),$browser_language:gQe(),$browser_language_prefix:(t=gQe(),typeof t=="string"?t.split("-")[0]:void 0),$screen_height:Qo==null?void 0:Qo.screen.height,$screen_width:Qo==null?void 0:Qo.screen.width,$viewport_height:Qo==null?void 0:Qo.innerHeight,$viewport_width:Qo==null?void 0:Qo.innerWidth,$lib:"web",$lib_version:DQ.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3})}var Bw=Mb("[FeatureFlags]"),lee="$active_feature_flags",S5="$override_feature_flags",IQe="$feature_flag_payloads",q4="$override_feature_flag_payloads",_Qe="$feature_flag_request_id",EQe=i=>{var e={};for(var[t,n]of EG(i||{}))n&&(e[t]=n);return e},jwt=i=>{var e=i.flags;return e?(i.featureFlags=Object.fromEntries(Object.keys(e).map(t=>{var n;return[t,(n=e[t].variant)!==null&&n!==void 0?n:e[t].enabled]})),i.featureFlagPayloads=Object.fromEntries(Object.keys(e).filter(t=>e[t].enabled).filter(t=>{var n;return(n=e[t].metadata)==null?void 0:n.payload}).map(t=>{var n;return[t,(n=e[t].metadata)==null?void 0:n.payload]}))):Bw.warn("Using an older version of the feature flags endpoint. Please upgrade your PostHog server to the latest version"),i},Jwt=function(i){return i.FeatureFlags="feature_flags",i.Recordings="recordings",i}({}),bQe=new Set(["7c6f7b45","66c1f69c","2727f65a","f3287528","8cc9a311","eb9f671b","c0e1c6f9","057989ec","723f4019","7b102104","563359d3","bad973ea","f6f2c4f4","59454a61","89ad1076","4edd0da1","26c52e72","a970bd2e","89cf4454","16e2b4e7","fba0e7b6","301c8488","bc65d69e","fe66a3c5","37926ca6","52a196df","d32a7577","42c4c9ef","6883bd5a","04809ff7","e59430a8","61be3dd8","7fa5500b","bf027177","8cfdba9b","96f6df5f","569798e9","0ebc61a5","1b5d7b92","17ebb0a4","f97ea965","85cc817b","3044dfc1","0c3fe5c3","b1f95fa3","8a6342e8","72365c68","12d34ad9","733853ec","3beeb69a","0645bb64","32de7f98","5dcbee21","3fe85053","ad960278","9466e5dd","7ca97b2d","2ee2a65c","28fde5f2","85c52f49","0ad823f4","f11b6cc9","aacf8af9","ab3e62b3","3a85ff15","8a67d3c4","f5e91ef1","4b873698","c5dae949","5b643d76","9599c892","34377448","2189e408","3be9ad53","1a14ce7c","2a164ded","8d53ea86","53bdb37d","bfc3f590","8df38ede","bdb81e49","38fde5c0","8d707e6d","73cbc496","f9d8a5ef","d3a9f8c4","a980d8cd","5bcfe086","e4818f68","4f11fb39","a13c6ae3","150c7fbb","98f3d658","f84f7377","1924dd9c","1f6b63b3","24748755","7c0f717c","8a87f11b","49f57f22","3c9e9234","3772f65b","dff631b6","cd609d40","f853c7f7","952db5ee","c5aa8a79","2d21b6fd","79b7164c","4110e26c","a7d3b43f","84e1b8f6","75cc0998","07f78e33","10ca9b1a","ce441b18","01eb8256","c0ac4b67","8e8e5216","db7943dd","fa133a95","498a4508","21bbda67","7dbfed69","be3ec24c","fc80b8e2"]);class qwt{constructor(e){this.ge=!1,this._e=!1,this.me=!1,this.be=!1,this.ye=!1,this.we=!1,this.Se=!1,this._instance=e,this.featureFlagEventHandlers=[]}flags(){if(this._instance.config.__preview_remote_config)this.we=!0;else{var e=!this.$e&&(this._instance.config.advanced_disable_feature_flags||this._instance.config.advanced_disable_feature_flags_on_first_load);this.ke({disableFlags:e})}}get hasLoadedFlags(){return this._e}getFlags(){return Object.keys(this.getFlagVariants())}getFlagsWithDetails(){var e=this._instance.get_property(C$),t=this._instance.get_property(S5),n=this._instance.get_property(q4);if(!n&&!t)return e||{};var r=EE({},e||{}),a=[...new Set([...Object.keys(n||{}),...Object.keys(t||{})])];for(var o of a){var s,l,u=r[o],d=t==null?void 0:t[o],f=ed(d)?(s=u==null?void 0:u.enabled)!==null&&s!==void 0&&s:!!d,p=ed(d)?u.variant:typeof d=="string"?d:void 0,m=n==null?void 0:n[o],y=Wd({},u,{enabled:f,variant:f?p??(u==null?void 0:u.variant):void 0});f!==(u==null?void 0:u.enabled)&&(y.original_enabled=u==null?void 0:u.enabled),p!==(u==null?void 0:u.variant)&&(y.original_variant=u==null?void 0:u.variant),m&&(y.metadata=Wd({},u==null?void 0:u.metadata,{payload:m,original_payload:u==null||(l=u.metadata)==null?void 0:l.payload})),r[o]=y}return this.ge||(Bw.warn(" Overriding feature flag details!",{flagDetails:e,overriddenPayloads:n,finalDetails:r}),this.ge=!0),r}getFlagVariants(){var e=this._instance.get_property(m5),t=this._instance.get_property(S5);if(!t)return e||{};for(var n=EE({},e),r=Object.keys(t),a=0;a<r.length;a++)n[r[a]]=t[r[a]];return this.ge||(Bw.warn(" Overriding feature flags!",{enabledFlags:e,overriddenFlags:t,finalFlags:n}),this.ge=!0),n}getFlagPayloads(){var e=this._instance.get_property(IQe),t=this._instance.get_property(q4);if(!t)return e||{};for(var n=EE({},e||{}),r=Object.keys(t),a=0;a<r.length;a++)n[r[a]]=t[r[a]];return this.ge||(Bw.warn(" Overriding feature flag payloads!",{flagPayloads:e,overriddenPayloads:t,finalPayloads:n}),this.ge=!0),n}reloadFeatureFlags(){this.be||this._instance.config.advanced_disable_feature_flags||this.$e||(this.$e=setTimeout(()=>{this.ke()},5))}xe(){clearTimeout(this.$e),this.$e=void 0}ensureFlagsLoaded(){this._e||this.me||this.$e||this.reloadFeatureFlags()}setAnonymousDistinctId(e){this.$anon_distinct_id=e}setReloadingPaused(e){this.be=e}ke(e){var t;if(this.xe(),!this._instance.I())if(this.me)this.ye=!0;else{var n={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:Wd({},((t=this._instance.persistence)==null?void 0:t.get_initial_props())||{},this._instance.get_property(P4)||{}),group_properties:this._instance.get_property(B3)};(e!=null&&e.disableFlags||this._instance.config.advanced_disable_feature_flags)&&(n.disable_flags=!0);var r=this._instance.config.__preview_flags_v2&&this._instance.config.__preview_remote_config,a=function(l){var u=function(d){for(var f=2166136261,p=0;p<d.length;p++)f^=d.charCodeAt(p),f+=(f<<1)+(f<<4)+(f<<7)+(f<<8)+(f<<24);return("00000000"+(f>>>0).toString(16)).slice(-8)}(l);return bQe==null?void 0:bQe.has(u)}(this._instance.config.token)?"/decide?v=4":r?"/flags/?v=2":"/flags/?v=2&config=true",o=this._instance.config.advanced_only_evaluate_survey_feature_flags?"&only_evaluate_survey_feature_flags=true":"",s=this._instance.requestRouter.endpointFor("api",a+o);r&&(n.timezone=CQe()),this.me=!0,this._instance.Ee({method:"POST",url:s,data:n,compression:this._instance.config.disable_compression?void 0:NQ.Base64,timeout:this._instance.config.feature_flag_request_timeout_ms,callback:l=>{var u,d,f=!0;if(l.statusCode===200&&(this.ye||(this.$anon_distinct_id=void 0),f=!1),this.me=!1,this.we||(this.we=!0,this._instance.Ie((d=l.json)!==null&&d!==void 0?d:{})),!n.disable_flags||this.ye)if(this.Se=!f,l.json&&(u=l.json.quotaLimited)!=null&&u.includes(Jwt.FeatureFlags))Bw.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 p;n.disable_flags||this.receivedFeatureFlags((p=l.json)!==null&&p!==void 0?p:{},f),this.ye&&(this.ye=!1,this.ke())}}})}}getFeatureFlag(e,t){if(t===void 0&&(t={}),this._e||this.getFlags()&&this.getFlags().length>0){var n=this.getFlagVariants()[e],r=""+n,a=this._instance.get_property(_Qe)||void 0,o=this._instance.get_property(SG)||{};if((t.send_event||!("send_event"in t))&&(!(e in o)||!o[e].includes(r))){var s,l,u,d,f,p,m,y,x;o_(o[e])?o[e].push(r):o[e]=[r],(s=this._instance.persistence)==null||s.register({[SG]:o});var E=this.getFeatureFlagDetails(e),b={$feature_flag:e,$feature_flag_response:n,$feature_flag_payload:this.getFeatureFlagPayload(e)||null,$feature_flag_request_id:a,$feature_flag_bootstrapped_response:((l=this._instance.config.bootstrap)==null||(l=l.featureFlags)==null?void 0:l[e])||null,$feature_flag_bootstrapped_payload:((u=this._instance.config.bootstrap)==null||(u=u.featureFlagPayloads)==null?void 0:u[e])||null,$used_bootstrap_value:!this.Se};ed(E==null||(d=E.metadata)==null?void 0:d.version)||(b.$feature_flag_version=E.metadata.version);var Q,M=(f=E==null||(p=E.reason)==null?void 0:p.description)!==null&&f!==void 0?f:E==null||(m=E.reason)==null?void 0:m.code;M&&(b.$feature_flag_reason=M),E!=null&&(y=E.metadata)!=null&&y.id&&(b.$feature_flag_id=E.metadata.id),ed(E==null?void 0:E.original_variant)&&ed(E==null?void 0:E.original_enabled)||(b.$feature_flag_original_response=ed(E.original_variant)?E.original_enabled:E.original_variant),E!=null&&(x=E.metadata)!=null&&x.original_payload&&(b.$feature_flag_original_payload=E==null||(Q=E.metadata)==null?void 0:Q.original_payload),this._instance.capture("$feature_flag_called",b)}return n}Bw.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 n=this._instance.config.token;this._instance.Ee({method:"POST",url:this._instance.requestRouter.endpointFor("api","/flags/?v=2&config=true"),data:{distinct_id:this._instance.get_distinct_id(),token:n},compression:this._instance.config.disable_compression?void 0:NQ.Base64,timeout:this._instance.config.feature_flag_request_timeout_ms,callback:r=>{var a,o=(a=r.json)==null?void 0:a.featureFlagPayloads;t((o==null?void 0:o[e])||void 0)}})}isFeatureEnabled(e,t){if(t===void 0&&(t={}),this._e||this.getFlags()&&this.getFlags().length>0)return!!this.getFeatureFlag(e,t);Bw.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._e=!0;var n=this.getFlagVariants(),r=this.getFlagPayloads(),a=this.getFlagsWithDetails();(function(o,s,l,u,d){l===void 0&&(l={}),u===void 0&&(u={}),d===void 0&&(d={});var f=jwt(o),p=f.flags,m=f.featureFlags,y=f.featureFlagPayloads;if(m){var x=o.requestId;if(o_(m)){Bw.warn("v1 of the feature flags endpoint is deprecated. Please use the latest version.");var E={};if(m)for(var b=0;b<m.length;b++)E[m[b]]=!0;s&&s.register({[lee]:m,[m5]:E})}else{var Q=m,M=y,L=p;o.errorsWhileComputingFlags&&(Q=Wd({},l,Q),M=Wd({},u,M),L=Wd({},d,L)),s&&s.register(Wd({[lee]:Object.keys(EQe(Q)),[m5]:Q||{},[IQe]:M||{},[C$]:L||{}},x?{[_Qe]:x}:{}))}}})(e,this._instance.persistence,n,r,a),this.Pe(t)}}override(e,t){t===void 0&&(t=!1),Bw.warn("override is deprecated. Please use overrideFeatureFlags instead."),this.overrideFeatureFlags({flags:e,suppressWarning:t})}overrideFeatureFlags(e){if(!this._instance.__loaded||!this._instance.persistence)return Bw.uninitializedWarning("posthog.featureFlags.overrideFeatureFlags");if(e===!1)return this._instance.persistence.unregister(S5),this._instance.persistence.unregister(q4),void this.Pe();if(e&&typeof e=="object"&&("flags"in e||"payloads"in e)){var t,n=e;if(this.ge=!!((t=n.suppressWarning)!==null&&t!==void 0&&t),"flags"in n){if(n.flags===!1)this._instance.persistence.unregister(S5);else if(n.flags)if(o_(n.flags)){for(var r={},a=0;a<n.flags.length;a++)r[n.flags[a]]=!0;this._instance.persistence.register({[S5]:r})}else this._instance.persistence.register({[S5]:n.flags})}return"payloads"in n&&(n.payloads===!1?this._instance.persistence.unregister(q4):n.payloads&&this._instance.persistence.register({[q4]:n.payloads})),void this.Pe()}this.Pe()}onFeatureFlags(e){if(this.addFeatureFlagsHandler(e),this._e){var{flags:t,flagVariants:n}=this.Re();e(t,n)}return()=>this.removeFeatureFlagsHandler(e)}updateEarlyAccessFeatureEnrollment(e,t){var n,r=(this._instance.get_property(xG)||[]).find(l=>l.flagKey===e),a={["$feature_enrollment/"+e]:t},o={$feature_flag:e,$feature_enrollment:t,$set:a};r&&(o.$early_access_feature_name=r.name),this._instance.capture("$feature_enrollment_update",o),this.setPersonPropertiesForFlags(a,!1);var s=Wd({},this.getFlagVariants(),{[e]:t});(n=this._instance.persistence)==null||n.register({[lee]:Object.keys(EQe(s)),[m5]:s}),this.Pe()}getEarlyAccessFeatures(e,t,n){t===void 0&&(t=!1);var r=this._instance.get_property(xG),a=n?"&"+n.map(o=>"stage="+o).join("&"):"";if(r&&!t)return e(r);this._instance.Ee({url:this._instance.requestRouter.endpointFor("api","/api/early_access_features/?token="+this._instance.config.token+a),method:"GET",callback:o=>{var s;if(o.json){var l=o.json.earlyAccessFeatures;return(s=this._instance.persistence)==null||s.register({[xG]:l}),e(l)}}})}Re(){var e=this.getFlags(),t=this.getFlagVariants();return{flags:e.filter(n=>t[n]),flagVariants:Object.keys(t).filter(n=>t[n]).reduce((n,r)=>(n[r]=t[r],n),{})}}Pe(e){var{flags:t,flagVariants:n}=this.Re();this.featureFlagEventHandlers.forEach(r=>r(t,n,{errorsLoading:e}))}setPersonPropertiesForFlags(e,t){t===void 0&&(t=!0);var n=this._instance.get_property(P4)||{};this._instance.register({[P4]:Wd({},n,e)}),t&&this._instance.reloadFeatureFlags()}resetPersonPropertiesForFlags(){this._instance.unregister(P4)}setGroupPropertiesForFlags(e,t){t===void 0&&(t=!0);var n=this._instance.get_property(B3)||{};Object.keys(n).length!==0&&Object.keys(n).forEach(r=>{n[r]=Wd({},n[r],e[r]),delete e[r]}),this._instance.register({[B3]:Wd({},n,e)}),t&&this._instance.reloadFeatureFlags()}resetGroupPropertiesForFlags(e){if(e){var t=this._instance.get_property(B3)||{};this._instance.register({[B3]:Wd({},t,{[e]:{}})})}else this._instance.unregister(B3)}}var Zwt=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"];class cee{constructor(e){this.S=e,this.props={},this.Te=!1,this.Me=(t=>{var n="";return t.token&&(n=t.token.replace(/\+/g,"PL").replace(/\//g,"SL").replace(/=/g,"EQ")),t.persistence_name?"ph_"+t.persistence_name:"ph_"+n+"_posthog"})(e),this.B=this.Ce(e),this.load(),e.debug&&Pf.info("Persistence loaded",e.persistence,Wd({},this.props)),this.update_config(e,e),this.save()}Ce(e){Zwt.indexOf(e.persistence.toLowerCase())===-1&&(Pf.critical("Unknown persistence type "+e.persistence+"; falling back to localStorage+cookie"),e.persistence="localStorage+cookie");var t=e.persistence.toLowerCase();return t==="localstorage"&&KE.O()?KE:t==="localstorage+cookie"&&LG.O()?LG:t==="sessionstorage"&&Rb.O()?Rb:t==="memory"?QSt:t==="cookie"?UQ:LG.O()?LG:UQ}properties(){var e={};return t1(this.props,function(t,n){if(n===m5&&k_(t))for(var r=Object.keys(t),a=0;a<r.length;a++)e["$feature/"+r[a]]=t[r[a]];else s=n,l=!1,(lM(o=cSt)?l:bSe&&o.indexOf===bSe?o.indexOf(s)!=-1:(t1(o,function(u){if(l||(l=u===s))return IG}),l))||(e[n]=t);var o,s,l}),e}load(){if(!this.Fe){var e=this.B.L(this.Me);e&&(this.props=EE({},e))}}save(){this.Fe||this.B.j(this.Me,this.props,this.Oe,this.Ae,this.De,this.S.debug)}remove(){this.B.N(this.Me,!1),this.B.N(this.Me,!0)}clear(){this.remove(),this.props={}}register_once(e,t,n){if(k_(e)){ed(t)&&(t="None"),this.Oe=ed(n)?this.Le:n;var r=!1;if(t1(e,(a,o)=>{this.props.hasOwnProperty(o)&&this.props[o]!==t||(this.props[o]=a,r=!0)}),r)return this.save(),!0}return!1}register(e,t){if(k_(e)){this.Oe=ed(t)?this.Le:t;var n=!1;if(t1(e,(r,a)=>{e.hasOwnProperty(a)&&this.props[a]!==r&&(this.props[a]=r,n=!0)}),n)return this.save(),!0}return!1}unregister(e){e in this.props&&(delete this.props[e],this.save())}update_campaign_params(){if(!this.Te){var e=fQe(this.S.custom_campaign_params,this.S.mask_personal_data_properties,this.S.custom_personal_data_properties);g5(h$(e))||this.register(e),this.Te=!0}}update_search_keyword(){var e;this.register((e=Af==null?void 0:Af.referrer)?pQe(e):{})}update_referrer_info(){var e;this.register_once({$referrer:mQe(),$referring_domain:Af!=null&&Af.referrer&&((e=v5(Af.referrer))==null?void 0:e.host)||"$direct"},void 0)}set_initial_person_info(){this.props[b$]||this.props[x$]||this.register_once({[wG]:yQe(this.S.mask_personal_data_properties,this.S.custom_personal_data_properties)},void 0)}get_initial_props(){var e={};t1([x$,b$],o=>{var s=this.props[o];s&&t1(s,function(l,u){e["$initial_"+d$(u)]=l})});var t,n,r=this.props[wG];if(r){var a=(t=vQe(r),n={},t1(t,function(o,s){n["$initial_"+d$(s)]=o}),n);EE(e,a)}return e}safe_merge(e){return t1(this.props,function(t,n){n in e||(e[n]=t)}),e}update_config(e,t){if(this.Le=this.Oe=e.cookie_expiration,this.set_disabled(e.disable_persistence),this.set_cross_subdomain(e.cross_subdomain_cookie),this.set_secure(e.secure_cookie),e.persistence!==t.persistence){var n=this.Ce(e),r=this.props;this.clear(),this.B=n,this.props=r,this.save()}}set_disabled(e){this.Fe=e,this.Fe?this.remove():this.save()}set_cross_subdomain(e){e!==this.Ae&&(this.Ae=e,this.remove(),this.save())}set_secure(e){e!==this.De&&(this.De=e,this.remove(),this.save())}set_event_timer(e,t){var n=this.props[T4]||{};n[e]=t,this.props[T4]=n,this.save()}remove_event_timer(e){var t=(this.props[T4]||{})[e];return ed(t)||(delete this.props[T4][e],this.save()),t}get_property(e){return this.props[e]}set_property(e,t){this.props[e]=t,this.save()}}class xQe{constructor(){this.je={},this.je={}}on(e,t){return this.je[e]||(this.je[e]=[]),this.je[e].push(t),()=>{this.je[e]=this.je[e].filter(n=>n!==t)}}emit(e,t){for(var n of this.je[e]||[])n(t);for(var r of this.je["*"]||[])r(e,t)}}class N3{constructor(e){this.Ne=new xQe,this.ze=(t,n)=>this.Ue(t,n)&&this.qe(t,n)&&this.Be(t,n),this.Ue=(t,n)=>n==null||!n.event||(t==null?void 0:t.event)===(n==null?void 0:n.event),this._instance=e,this.He=new Set,this.We=new Set}init(){var e;if(!ed((e=this._instance)==null?void 0:e.Ge)){var t;(t=this._instance)==null||t.Ge((n,r)=>{this.on(n,r)})}}register(e){var t,n;if(!ed((t=this._instance)==null?void 0:t.Ge)&&(e.forEach(o=>{var s,l;(s=this.We)==null||s.add(o),(l=o.steps)==null||l.forEach(u=>{var d;(d=this.He)==null||d.add((u==null?void 0:u.event)||"")})}),(n=this._instance)!=null&&n.autocapture)){var r,a=new Set;e.forEach(o=>{var s;(s=o.steps)==null||s.forEach(l=>{l!=null&&l.selector&&a.add(l==null?void 0:l.selector)})}),(r=this._instance)==null||r.autocapture.setElementSelectors(a)}}on(e,t){var n;t!=null&&e.length!=0&&(this.He.has(e)||this.He.has(t==null?void 0:t.event))&&this.We&&((n=this.We)==null?void 0:n.size)>0&&this.We.forEach(r=>{this.Je(t,r)&&this.Ne.emit("actionCaptured",r.name)})}Ve(e){this.onAction("actionCaptured",t=>e(t))}Je(e,t){if((t==null?void 0:t.steps)==null)return!1;for(var n of t.steps)if(this.ze(e,n))return!0;return!1}onAction(e,t){return this.Ne.on(e,t)}qe(e,t){if(t!=null&&t.url){var n,r=e==null||(n=e.properties)==null?void 0:n.$current_url;if(!r||typeof r!="string"||!N3.Ke(r,t==null?void 0:t.url,(t==null?void 0:t.url_matching)||"contains"))return!1}return!0}static Ke(e,t,n){switch(n){case"regex":return!!Qo&&E5(e,t);case"exact":return t===e;case"contains":var r=N3.Ye(t).replace(/_/g,".").replace(/%/g,".*");return E5(e,r);default:return!1}}static Ye(e){return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}Be(e,t){if((t!=null&&t.href||t!=null&&t.tag_name||t!=null&&t.text)&&!this.Xe(e).some(a=>!(t!=null&&t.href&&!N3.Ke(a.href||"",t==null?void 0:t.href,(t==null?void 0:t.href_matching)||"exact"))&&(t==null||!t.tag_name||a.tag_name===(t==null?void 0:t.tag_name))&&!(t!=null&&t.text&&!N3.Ke(a.text||"",t==null?void 0:t.text,(t==null?void 0:t.text_matching)||"exact")&&!N3.Ke(a.$el_text||"",t==null?void 0:t.text,(t==null?void 0:t.text_matching)||"exact"))))return!1;if(t!=null&&t.selector){var n,r=e==null||(n=e.properties)==null?void 0:n.$element_selectors;if(!r||!r.includes(t==null?void 0:t.selector))return!1}return!0}Xe(e){return(e==null?void 0:e.properties.$elements)==null?[]:e==null?void 0:e.properties.$elements}}var jE=Mb("[Surveys]"),uee="seenSurvey_",Xwt=(i,e)=>{var t="$survey_"+e+"/"+i.id;return i.current_iteration&&i.current_iteration>0&&(t="$survey_"+e+"/"+i.id+"/"+i.current_iteration),t};class Wwt{constructor(e){this._instance=e,this.Qe=new Map,this.Ze=new Map}register(e){var t;ed((t=this._instance)==null?void 0:t.Ge)||(this.tr(e),this.ir(e))}ir(e){var t=e.filter(n=>{var r,a;return((r=n.conditions)==null?void 0:r.actions)&&((a=n.conditions)==null||(a=a.actions)==null||(a=a.values)==null?void 0:a.length)>0});t.length!==0&&(this.er==null&&(this.er=new N3(this._instance),this.er.init(),this.er.Ve(n=>{this.onAction(n)})),t.forEach(n=>{var r,a,o,s,l;n.conditions&&(r=n.conditions)!=null&&r.actions&&(a=n.conditions)!=null&&(a=a.actions)!=null&&a.values&&((o=n.conditions)==null||(o=o.actions)==null||(o=o.values)==null?void 0:o.length)>0&&((s=this.er)==null||s.register(n.conditions.actions.values),(l=n.conditions)==null||(l=l.actions)==null||(l=l.values)==null||l.forEach(u=>{if(u&&u.name){var d=this.Ze.get(u.name);d&&d.push(n.id),this.Ze.set(u.name,d||[n.id])}}))}))}tr(e){var t;e.filter(n=>{var r,a;return((r=n.conditions)==null?void 0:r.events)&&((a=n.conditions)==null||(a=a.events)==null||(a=a.values)==null?void 0:a.length)>0}).length!==0&&((t=this._instance)==null||t.Ge((n,r)=>{this.onEvent(n,r)}),e.forEach(n=>{var r;(r=n.conditions)==null||(r=r.events)==null||(r=r.values)==null||r.forEach(a=>{if(a&&a.name){var o=this.Qe.get(a.name);o&&o.push(n.id),this.Qe.set(a.name,o||[n.id])}})}))}onEvent(e,t){var n,r=((n=this._instance)==null||(n=n.persistence)==null?void 0:n.props[BG])||[];if(e==="survey shown"&&t&&r.length>0){var a;jE.info("survey event matched, removing survey from activated surveys",{event:e,eventPayload:t,existingActivatedSurveys:r});var o=t==null||(a=t.properties)==null?void 0:a.$survey_id;if(o){var s=r.indexOf(o);s>=0&&(r.splice(s,1),this.rr(r))}}else this.Qe.has(e)&&(jE.info("survey event matched, updating activated surveys",{event:e,surveys:this.Qe.get(e)}),this.rr(r.concat(this.Qe.get(e)||[])))}onAction(e){var t,n=((t=this._instance)==null||(t=t.persistence)==null?void 0:t.props[BG])||[];this.Ze.has(e)&&this.rr(n.concat(this.Ze.get(e)||[]))}rr(e){var t;(t=this._instance)==null||(t=t.persistence)==null||t.register({[BG]:[...new Set(e)]})}getSurveys(){var e,t=(e=this._instance)==null||(e=e.persistence)==null?void 0:e.props[BG];return t||[]}getEventToSurveys(){return this.Qe}sr(){return this.er}}class $wt{constructor(e){this.nr=null,this.ar=!1,this.lr=!1,this.ur=[],this._instance=e,this._surveyEventReceiver=null}onRemoteConfig(e){var t=e.surveys;if(BC(t))return jE.warn("Flags not loaded yet. Not loading surveys.");var n=o_(t);this.hr=n?t.length>0:t,jE.info("flags response received, hasSurveys: "+this.hr),this.hr&&this.loadIfEnabled()}reset(){localStorage.removeItem("lastSeenSurveyDate");for(var e=[],t=0;t<localStorage.length;t++){var n=localStorage.key(t);(n!=null&&n.startsWith(uee)||n!=null&&n.startsWith("inProgressSurvey_"))&&e.push(n)}e.forEach(r=>localStorage.removeItem(r))}loadIfEnabled(){if(!this.nr)if(this.lr)jE.info("Already initializing surveys, skipping...");else if(this._instance.config.disable_surveys)jE.info("Disabled. Not loading surveys.");else if(this.hr){var e=k0==null?void 0:k0.__PosthogExtensions__;if(e){this.lr=!0;try{var t=e.generateSurveys;if(t)return void this.dr(t);var n=e.loadExternalDependency;if(!n)return void this.vr("PostHog loadExternalDependency extension not found.");n(this._instance,"surveys",r=>{r||!e.generateSurveys?this.vr("Could not load surveys script",r):this.dr(e.generateSurveys)})}catch(r){throw this.vr("Error initializing surveys",r),r}finally{this.lr=!1}}else jE.error("PostHog Extensions not found.")}else jE.info("No surveys to load.")}dr(e){this.nr=e(this._instance),this._surveyEventReceiver=new Wwt(this._instance),jE.info("Surveys loaded successfully"),this.cr({isLoaded:!0})}vr(e,t){jE.error(e,t),this.cr({isLoaded:!1,error:e})}onSurveysLoaded(e){return this.ur.push(e),this.nr&&this.cr({isLoaded:!0}),()=>{this.ur=this.ur.filter(t=>t!==e)}}getSurveys(e,t){if(t===void 0&&(t=!1),this._instance.config.disable_surveys)return jE.info("Disabled. Not loading surveys."),e([]);var n=this._instance.get_property(I$);if(n&&!t)return e(n,{isLoaded:!0});if(this.ar)return e([],{isLoaded:!1,error:"Surveys are already being loaded"});try{this.ar=!0,this._instance.Ee({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 a;this.ar=!1;var o=r.statusCode;if(o!==200||!r.json){var s="Surveys API could not be loaded, status: "+o;return jE.error(s),e([],{isLoaded:!1,error:s})}var l,u=r.json.surveys||[],d=u.filter(f=>function(p){return!(!p.start_date||p.end_date)}(f)&&(function(p){var m;return!((m=p.conditions)==null||(m=m.events)==null||(m=m.values)==null||!m.length)}(f)||function(p){var m;return!((m=p.conditions)==null||(m=m.actions)==null||(m=m.values)==null||!m.length)}(f)));return d.length>0&&((l=this._surveyEventReceiver)==null||l.register(d)),(a=this._instance.persistence)==null||a.register({[I$]:u}),e(u,{isLoaded:!0})}})}catch(r){throw this.ar=!1,r}}cr(e){for(var t of this.ur)try{e.isLoaded?this.getSurveys(t):t([],e)}catch(n){jE.error("Error in survey callback",n)}}getActiveMatchingSurveys(e,t){if(t===void 0&&(t=!1),!BC(this.nr))return this.nr.getActiveMatchingSurveys(e,t);jE.warn("init was not called")}pr(e){var t=null;return this.getSurveys(n=>{var r;t=(r=n.find(a=>a.id===e))!==null&&r!==void 0?r:null}),t}gr(e){if(BC(this.nr))return{eligible:!1,reason:"SDK is not enabled or survey functionality is not yet loaded"};var t=typeof e=="string"?this.pr(e):e;return t?this.nr.checkSurveyEligibility(t):{eligible:!1,reason:"Survey not found"}}canRenderSurvey(e){if(BC(this.nr))return jE.warn("init was not called"),{visible:!1,disabledReason:"SDK is not enabled or survey functionality is not yet loaded"};var t=this.gr(e);return{visible:t.eligible,disabledReason:t.reason}}canRenderSurveyAsync(e,t){return BC(this.nr)?(jE.warn("init was not called"),Promise.resolve({visible:!1,disabledReason:"SDK is not enabled or survey functionality is not yet loaded"})):new Promise(n=>{this.getSurveys(r=>{var a,o=(a=r.find(l=>l.id===e))!==null&&a!==void 0?a:null;if(o){var s=this.gr(o);n({visible:s.eligible,disabledReason:s.reason})}else n({visible:!1,disabledReason:"Survey not found"})},t)})}renderSurvey(e,t){if(BC(this.nr))jE.warn("init was not called");else{var n=this.pr(e),r=Af==null?void 0:Af.querySelector(t);n?r?this.nr.renderSurvey(n,r):jE.warn("Survey element not found"):jE.warn("Survey not found")}}}(function(i){return i.Button="button",i.Tab="tab",i.Selector="selector",i})({}),function(i){return i.TopLeft="top_left",i.TopRight="top_right",i.TopCenter="top_center",i.MiddleLeft="middle_left",i.MiddleRight="middle_right",i.MiddleCenter="middle_center",i.Left="left",i.Center="center",i.Right="right",i.NextToTrigger="next_to_trigger",i}({}),function(i){return i.Popover="popover",i.API="api",i.Widget="widget",i}({}),function(i){return i.Open="open",i.MultipleChoice="multiple_choice",i.SingleChoice="single_choice",i.Rating="rating",i.Link="link",i}({}),function(i){return i.NextQuestion="next_question",i.End="end",i.ResponseBased="response_based",i.SpecificQuestion="specific_question",i}({}),function(i){return i.Once="once",i.Recurring="recurring",i.Always="always",i}({});var Aee=function(i){return i.SHOWN="survey shown",i.DISMISSED="survey dismissed",i.SENT="survey sent",i}({}),BQe=function(i){return i.SURVEY_ID="$survey_id",i.SURVEY_NAME="$survey_name",i.SURVEY_RESPONSE="$survey_response",i.SURVEY_ITERATION="$survey_iteration",i.SURVEY_ITERATION_START_DATE="$survey_iteration_start_date",i.SURVEY_PARTIALLY_COMPLETED="$survey_partially_completed",i.SURVEY_SUBMISSION_ID="$survey_submission_id",i.SURVEY_QUESTIONS="$survey_questions",i.SURVEY_COMPLETED="$survey_completed",i}({}),SQe=Mb("[RateLimiter]");class eQt{constructor(e){var t,n;this.serverLimits={},this.lastEventRateLimited=!1,this.checkForLimiting=r=>{var a=r.text;if(a&&a.length)try{(JSON.parse(a).quota_limited||[]).forEach(o=>{SQe.info((o||"events")+" is quota limited."),this.serverLimits[o]=new Date().getTime()+6e4})}catch(o){return void SQe.warn('could not rate limit - continuing. Error: "'+(o==null?void 0:o.message)+'"',{text:a})}},this.instance=e,this.captureEventsPerSecond=((t=e.config.rate_limiting)==null?void 0:t.events_per_second)||10,this.captureEventsBurstLimit=Math.max(((n=e.config.rate_limiting)==null?void 0:n.events_burst_limit)||10*this.captureEventsPerSecond,this.captureEventsPerSecond),this.lastEventRateLimited=this.clientRateLimitContext(!0).isRateLimited}clientRateLimitContext(e){var t,n,r;e===void 0&&(e=!1);var a=new Date().getTime(),o=(t=(n=this.instance.persistence)==null?void 0:n.get_property(E$))!==null&&t!==void 0?t:{tokens:this.captureEventsBurstLimit,last:a};o.tokens+=(a-o.last)/1e3*this.captureEventsPerSecond,o.last=a,o.tokens>this.captureEventsBurstLimit&&(o.tokens=this.captureEventsBurstLimit);var s=o.tokens<1;return s||e||(o.tokens=Math.max(0,o.tokens-1)),!s||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=s,(r=this.instance.persistence)==null||r.set_property(E$,o),{isRateLimited:s,remainingTokens:o.tokens}}isServerRateLimited(e){var t=this.serverLimits[e||"events"]||!1;return t!==!1&&new Date().getTime()<t}}var T3=Mb("[RemoteConfig]");class tQt{constructor(e){this._instance=e}get remoteConfig(){var e;return(e=k0._POSTHOG_REMOTE_CONFIG)==null||(e=e[this._instance.config.token])==null?void 0:e.config}_r(e){var t,n;(t=k0.__PosthogExtensions__)!=null&&t.loadExternalDependency?(n=k0.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this._instance,"remote-config",()=>e(this.remoteConfig)):(T3.error("PostHog Extensions not found. Cannot load remote config."),e())}mr(e){this._instance.Ee({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 T3.info("Using preloaded remote config",this.remoteConfig),void this.Ie(this.remoteConfig);if(this._instance.I())return void T3.warn("Remote config is disabled. Falling back to local config.");this._r(e=>{if(!e)return T3.info("No config found after loading remote JS config. Falling back to JSON."),void this.mr(t=>{this.Ie(t)});this.Ie(e)})}catch(e){T3.error("Error loading remote config",e)}}Ie(e){e?this._instance.config.__preview_remote_config?(this._instance.Ie(e),e.hasFeatureFlags!==!1&&this._instance.featureFlags.ensureFlagsLoaded()):T3.info("__preview_remote_config is disabled. Logging config instead",e):T3.error("Failed to fetch remote config from PostHog.")}}var dee=3e3;class nQt{constructor(e,t){this.br=!0,this.yr=[],this.wr=wB((t==null?void 0:t.flush_interval_ms)||dee,250,5e3,"flush interval",dee),this.Sr=e}enqueue(e){this.yr.push(e),this.$r||this.kr()}unload(){this.Er();var e=this.yr.length>0?this.Ir():{},t=Object.values(e);[...t.filter(n=>n.url.indexOf("/e")===0),...t.filter(n=>n.url.indexOf("/e")!==0)].map(n=>{this.Sr(Wd({},n,{transport:"sendBeacon"}))})}enable(){this.br=!1,this.kr()}kr(){var e=this;this.br||(this.$r=setTimeout(()=>{if(this.Er(),this.yr.length>0){var t=this.Ir(),n=function(){var a=t[r],o=new Date().getTime();a.data&&o_(a.data)&&t1(a.data,s=>{s.offset=Math.abs(s.timestamp-o),delete s.timestamp}),e.Sr(a)};for(var r in t)n()}},this.wr))}Er(){clearTimeout(this.$r),this.$r=void 0}Ir(){var e={};return t1(this.yr,t=>{var n,r=t,a=(r?r.batchKey:null)||r.url;ed(e[a])&&(e[a]=Wd({},r,{data:[]})),(n=e[a].data)==null||n.push(r.data)}),this.yr=[],e}}var iQt=["retriesPerformedSoFar"];class rQt{constructor(e){this.Pr=!1,this.Rr=3e3,this.yr=[],this._instance=e,this.yr=[],this.Tr=!0,!ed(Qo)&&"onLine"in Qo.navigator&&(this.Tr=Qo.navigator.onLine,v_(Qo,"online",()=>{this.Tr=!0,this.se()}),v_(Qo,"offline",()=>{this.Tr=!1}))}get length(){return this.yr.length}retriableRequest(e){var{retriesPerformedSoFar:t}=e,n=MSe(e,iQt);ox(t)&&t>0&&(n.url=JG(n.url,{retry_count:t})),this._instance.Ee(Wd({},n,{callback:r=>{r.statusCode!==200&&(r.statusCode<400||r.statusCode>=500)&&(t??0)<10?this.Mr(Wd({retriesPerformedSoFar:t},n)):n.callback==null||n.callback(r)}}))}Mr(e){var t=e.retriesPerformedSoFar||0;e.retriesPerformedSoFar=t+1;var n=function(o){var s=3e3*Math.pow(2,o),l=s/2,u=Math.min(18e5,s),d=(Math.random()-.5)*(u-l);return Math.ceil(u+d)}(t),r=Date.now()+n;this.yr.push({retryAt:r,requestOptions:e});var a="Enqueued failed request for retry in "+n;navigator.onLine||(a+=" (Browser is offline)"),Pf.warn(a),this.Pr||(this.Pr=!0,this.Cr())}Cr(){this.Fr&&clearTimeout(this.Fr),this.Fr=setTimeout(()=>{this.Tr&&this.yr.length>0&&this.se(),this.Cr()},this.Rr)}se(){var e=Date.now(),t=[],n=this.yr.filter(a=>a.retryAt<e||(t.push(a),!1));if(this.yr=t,n.length>0)for(var{requestOptions:r}of n)this.retriableRequest(r)}unload(){for(var{requestOptions:e}of(this.Fr&&(clearTimeout(this.Fr),this.Fr=void 0),this.yr))try{this._instance.Ee(Wd({},e,{transport:"sendBeacon"}))}catch(t){Pf.error(t)}this.yr=[]}}class aQt{constructor(e){this.Or=()=>{var t,n,r,a;this.Ar||(this.Ar={});var o=this.scrollElement(),s=this.scrollY(),l=o?Math.max(0,o.scrollHeight-o.clientHeight):0,u=s+((o==null?void 0:o.clientHeight)||0),d=(o==null?void 0:o.scrollHeight)||0;this.Ar.lastScrollY=Math.ceil(s),this.Ar.maxScrollY=Math.max(s,(t=this.Ar.maxScrollY)!==null&&t!==void 0?t:0),this.Ar.maxScrollHeight=Math.max(l,(n=this.Ar.maxScrollHeight)!==null&&n!==void 0?n:0),this.Ar.lastContentY=u,this.Ar.maxContentY=Math.max(u,(r=this.Ar.maxContentY)!==null&&r!==void 0?r:0),this.Ar.maxContentHeight=Math.max(d,(a=this.Ar.maxContentHeight)!==null&&a!==void 0?a:0)},this._instance=e}getContext(){return this.Ar}resetContext(){var e=this.Ar;return setTimeout(this.Or,0),e}startMeasuringScrollPosition(){v_(Qo,"scroll",this.Or,{capture:!0}),v_(Qo,"scrollend",this.Or,{capture:!0}),v_(Qo,"resize",this.Or)}scrollElement(){if(!this._instance.config.scroll_root_selector)return Qo==null?void 0:Qo.document.documentElement;var e=o_(this._instance.config.scroll_root_selector)?this._instance.config.scroll_root_selector:[this._instance.config.scroll_root_selector];for(var t of e){var n=Qo==null?void 0:Qo.document.querySelector(t);if(n)return n}}scrollY(){if(this._instance.config.scroll_root_selector){var e=this.scrollElement();return e&&e.scrollTop||0}return Qo&&(Qo.scrollY||Qo.pageYOffset||Qo.document.documentElement.scrollTop)||0}scrollX(){if(this._instance.config.scroll_root_selector){var e=this.scrollElement();return e&&e.scrollLeft||0}return Qo&&(Qo.scrollX||Qo.pageXOffset||Qo.document.documentElement.scrollLeft)||0}}var oQt=i=>yQe(i==null?void 0:i.config.mask_personal_data_properties,i==null?void 0:i.config.custom_personal_data_properties);class sQt{constructor(e,t,n,r){this.Dr=a=>{var o=this.Lr();if(!o||o.sessionId!==a){var s={sessionId:a,props:this.jr(this._instance)};this.Nr.register({[_$]:s})}},this._instance=e,this.zr=t,this.Nr=n,this.jr=r||oQt,this.zr.onSessionId(this.Dr)}Lr(){return this.Nr.props[_$]}getSetOnceProps(){var e,t=(e=this.Lr())==null?void 0:e.props;return t?"r"in t?vQe(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 t1(h$(this.getSetOnceProps()),(t,n)=>{n==="$current_url"&&(n="url"),e["$session_entry_"+d$(n)]=t}),e}}var wQe=Mb("[SessionId]");class lQt{constructor(e,t,n){var r;if(this.Ur=[],!e.persistence)throw new Error("SessionIdManager requires a PostHogPersistence instance");if(e.config.__preview_experimental_cookieless_mode)throw new Error("SessionIdManager cannot be used with __preview_experimental_cookieless_mode");this.S=e.config,this.Nr=e.persistence,this.fi=void 0,this.Ct=void 0,this._sessionStartTimestamp=null,this._sessionActivityTimestamp=null,this.qr=t||AM,this.Br=n||AM;var a=this.S.persistence_name||this.S.token,o=this.S.session_idle_timeout_seconds||1800;if(this._sessionTimeoutMs=1e3*wB(o,60,36e3,"session_idle_timeout_seconds",1800),e.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this.Hr(),this.Wr="ph_"+a+"_window_id",this.Gr="ph_"+a+"_primary_window_exists",this.Jr()){var s=Rb.L(this.Wr),l=Rb.L(this.Gr);s&&!l?this.fi=s:Rb.N(this.Wr),Rb.j(this.Gr,!0)}if((r=this.S.bootstrap)!=null&&r.sessionID)try{var u=(d=>{var f=d.replace(/-/g,"");if(f.length!==32)throw new Error("Not a valid UUID");if(f[12]!=="7")throw new Error("Not a UUIDv7");return parseInt(f.substring(0,12),16)})(this.S.bootstrap.sessionID);this.Vr(this.S.bootstrap.sessionID,new Date().getTime(),u)}catch(d){wQe.error("Invalid sessionID in bootstrap",d)}this.Kr()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(e){return ed(this.Ur)&&(this.Ur=[]),this.Ur.push(e),this.Ct&&e(this.Ct,this.fi),()=>{this.Ur=this.Ur.filter(t=>t!==e)}}Jr(){return this.S.persistence!=="memory"&&!this.Nr.Fe&&Rb.O()}Yr(e){e!==this.fi&&(this.fi=e,this.Jr()&&Rb.j(this.Wr,e))}Xr(){return this.fi?this.fi:this.Jr()?Rb.L(this.Wr):null}Vr(e,t,n){e===this.Ct&&t===this._sessionActivityTimestamp&&n===this._sessionStartTimestamp||(this._sessionStartTimestamp=n,this._sessionActivityTimestamp=t,this.Ct=e,this.Nr.register({[bG]:[t,e,n]}))}Qr(){if(this.Ct&&this._sessionActivityTimestamp&&this._sessionStartTimestamp)return[this._sessionActivityTimestamp,this.Ct,this._sessionStartTimestamp];var e=this.Nr.props[bG];return o_(e)&&e.length===2&&e.push(e[0]),e||[0,null,0]}resetSessionId(){this.Vr(null,null,null)}Kr(){v_(Qo,"beforeunload",()=>{this.Jr()&&Rb.N(this.Gr)},{capture:!1})}checkAndGetSessionAndWindowId(e,t){if(e===void 0&&(e=!1),t===void 0&&(t=null),this.S.__preview_experimental_cookieless_mode)throw new Error("checkAndGetSessionAndWindowId should not be called in __preview_experimental_cookieless_mode");var n=t||new Date().getTime(),[r,a,o]=this.Qr(),s=this.Xr(),l=ox(o)&&o>0&&Math.abs(n-o)>864e5,u=!1,d=!a,f=!e&&Math.abs(n-r)>this.sessionTimeoutMs;d||f||l?(a=this.qr(),s=this.Br(),wQe.info("new session ID generated",{sessionId:a,windowId:s,changeReason:{noSessionId:d,activityTimeout:f,sessionPastMaximumLength:l}}),o=n,u=!0):s||(s=this.Br(),u=!0);var p=r===0||!e||l?n:r,m=o===0?new Date().getTime():o;return this.Yr(s),this.Vr(a,p,m),e||this.Hr(),u&&this.Ur.forEach(y=>y(a,s,u?{noSessionId:d,activityTimeout:f,sessionPastMaximumLength:l}:void 0)),{sessionId:a,windowId:s,sessionStartTimestamp:m,changeReason:u?{noSessionId:d,activityTimeout:f,sessionPastMaximumLength:l}:void 0,lastActivityTimestamp:r}}Hr(){clearTimeout(this.Zr),this.Zr=setTimeout(()=>{this.resetSessionId()},1.1*this.sessionTimeoutMs)}}var cQt=["$set_once","$set"],pM=Mb("[SiteApps]");class uQt{constructor(e){this._instance=e,this.ts=[],this.apps={}}get isEnabled(){return!!this._instance.config.opt_in_site_apps}es(e,t){if(t){var n=this.globalsForEvent(t);this.ts.push(n),this.ts.length>1e3&&(this.ts=this.ts.slice(10))}}get siteAppLoaders(){var e;return(e=k0._POSTHOG_REMOTE_CONFIG)==null||(e=e[this._instance.config.token])==null?void 0:e.siteApps}init(){if(this.isEnabled){var e=this._instance.Ge(this.es.bind(this));this.rs=()=>{e(),this.ts=[],this.rs=void 0}}}globalsForEvent(e){var t,n,r,a,o,s,l;if(!e)throw new Error("Event payload is required");var u={},d=this._instance.get_property("$groups")||[],f=this._instance.get_property("$stored_group_properties")||{};for(var[p,m]of Object.entries(f))u[p]={id:d[p],type:p,properties:m};var{$set_once:y,$set:x}=e;return{event:Wd({},MSe(e,cQt),{properties:Wd({},e.properties,x?{$set:Wd({},(t=(n=e.properties)==null?void 0:n.$set)!==null&&t!==void 0?t:{},x)}:{},y?{$set_once:Wd({},(r=(a=e.properties)==null?void 0:a.$set_once)!==null&&r!==void 0?r:{},y)}:{}),elements_chain:(o=(s=e.properties)==null?void 0:s.$elements_chain)!==null&&o!==void 0?o:"",distinct_id:(l=e.properties)==null?void 0:l.distinct_id}),person:{properties:this._instance.get_property("$stored_person_properties")},groups:u}}setupSiteApp(e){var t=this.apps[e.id],n=()=>{var s;!t.errored&&this.ts.length&&(pM.info("Processing "+this.ts.length+" events for site app with id "+e.id),this.ts.forEach(l=>t.processEvent==null?void 0:t.processEvent(l)),t.processedBuffer=!0),Object.values(this.apps).every(l=>l.processedBuffer||l.errored)&&((s=this.rs)==null||s.call(this))},r=!1,a=s=>{t.errored=!s,t.loaded=!0,pM.info("Site app with id "+e.id+" "+(s?"loaded":"errored")),r&&n()};try{var{processEvent:o}=e.init({posthog:this._instance,callback:s=>{a(s)}});o&&(t.processEvent=o),r=!0}catch(s){pM.error("Error while initializing PostHog app with config id "+e.id,s),a(!1)}if(r&&t.loaded)try{n()}catch(s){pM.error("Error while processing buffered events PostHog app with config id "+e.id,s),t.errored=!0}}ss(){var e=this.siteAppLoaders||[];for(var t of e)this.apps[t.id]={id:t.id,loaded:!1,errored:!1,processedBuffer:!1};for(var n of e)this.setupSiteApp(n)}ns(e){if(Object.keys(this.apps).length!==0){var t=this.globalsForEvent(e);for(var n of Object.values(this.apps))try{n.processEvent==null||n.processEvent(t)}catch(r){pM.error("Error while processing event "+e.event+" for site app "+n.id,r)}}}onRemoteConfig(e){var t,n,r,a=this;if((t=this.siteAppLoaders)!=null&&t.length)return this.isEnabled?(this.ss(),void this._instance.on("eventCaptured",u=>this.ns(u))):void pM.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.');if((n=this.rs)==null||n.call(this),(r=e.siteApps)!=null&&r.length)if(this.isEnabled){var o=function(u){var d;k0["__$$ph_site_app_"+u]=a._instance,(d=k0.__PosthogExtensions__)==null||d.loadSiteApp==null||d.loadSiteApp(a._instance,l,f=>{if(f)return pM.error("Error while initializing PostHog app with config id "+u,f)})};for(var{id:s,url:l}of e.siteApps)o(s)}else pM.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}}var AQt=["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","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"],QQe=function(i,e){if(!i)return!1;var t=i.toLowerCase();return AQt.concat(e||[]).some(n=>{var r=n.toLowerCase();return t.indexOf(r)!==-1})},MQe=function(i,e){if(!i)return!1;var t=i.userAgent;if(t&&QQe(t,e))return!0;try{var n=i==null?void 0:i.userAgentData;if(n!=null&&n.brands&&n.brands.some(r=>QQe(r==null?void 0:r.brand,e)))return!0}catch{}return!!i.webdriver},Z4=function(i){return i.US="us",i.EU="eu",i.CUSTOM="custom",i}({}),RQe="i.posthog.com";class dQt{constructor(e){this.os={},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("."+RQe,".posthog.com")),t==="https://app.posthog.com"?"https://us.posthog.com":t}get region(){return this.os[this.apiHost]||(/https:\/\/(app|us|us-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?this.os[this.apiHost]=Z4.US:/https:\/\/(eu|eu-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?this.os[this.apiHost]=Z4.EU:this.os[this.apiHost]=Z4.CUSTOM),this.os[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===Z4.CUSTOM)return this.apiHost+t;var n=RQe+t;switch(e){case"assets":return"https://"+this.region+"-assets."+n;case"api":return"https://"+this.region+"."+n}}}var fQt={icontains:(i,e)=>!!Qo&&e.href.toLowerCase().indexOf(i.toLowerCase())>-1,not_icontains:(i,e)=>!!Qo&&e.href.toLowerCase().indexOf(i.toLowerCase())===-1,regex:(i,e)=>!!Qo&&E5(e.href,i),not_regex:(i,e)=>!!Qo&&!E5(e.href,i),exact:(i,e)=>e.href===i,is_not:(i,e)=>e.href!==i};class cx{constructor(e){var t=this;this.getWebExperimentsAndEvaluateDisplayLogic=function(n){n===void 0&&(n=!1),t.getWebExperiments(r=>{cx.ls("retrieved web experiments from the server"),t.us=new Map,r.forEach(a=>{if(a.feature_flag_key){var o;t.us&&(cx.ls("setting flag key ",a.feature_flag_key," to web experiment ",a),(o=t.us)==null||o.set(a.feature_flag_key,a));var s=t._instance.getFeatureFlag(a.feature_flag_key);G_(s)&&a.variants[s]&&t.hs(a.name,s,a.variants[s].transforms)}else if(a.variants)for(var l in a.variants){var u=a.variants[l];cx.ds(u)&&t.hs(a.name,l,u.transforms)}})},n)},this._instance=e,this._instance.onFeatureFlags(n=>{this.onFeatureFlags(n)})}onFeatureFlags(e){if(this._is_bot())cx.ls("Refusing to render web experiment since the viewer is a likely bot");else if(!this._instance.config.disable_web_experiments){if(BC(this.us))return this.us=new Map,this.loadIfEnabled(),void this.previewWebExperiment();cx.ls("applying feature flags",e),e.forEach(t=>{var n;if(this.us&&(n=this.us)!=null&&n.has(t)){var r,a=this._instance.getFeatureFlag(t),o=(r=this.us)==null?void 0:r.get(t);a&&o!=null&&o.variants[a]&&this.hs(o.name,a,o.variants[a].transforms)}})}}previewWebExperiment(){var e=cx.getWindowLocation();if(e!=null&&e.search){var t=TG(e==null?void 0:e.search,"__experiment_id"),n=TG(e==null?void 0:e.search,"__experiment_variant");t&&n&&(cx.ls("previewing web experiments "+t+" && "+n),this.getWebExperiments(r=>{this.vs(parseInt(t),n,r)},!1,!0))}}loadIfEnabled(){this._instance.config.disable_web_experiments||this.getWebExperimentsAndEvaluateDisplayLogic()}getWebExperiments(e,t,n){if(this._instance.config.disable_web_experiments&&!n)return e([]);var r=this._instance.get_property("$web_experiments");if(r&&!t)return e(r);this._instance.Ee({url:this._instance.requestRouter.endpointFor("api","/api/web_experiments/?token="+this._instance.config.token),method:"GET",callback:a=>{if(a.statusCode!==200||!a.json)return e([]);var o=a.json.experiments||[];return e(o)}})}vs(e,t,n){var r=n.filter(a=>a.id===e);r&&r.length>0&&(cx.ls("Previewing web experiment ["+r[0].name+"] with variant ["+t+"]"),this.hs(r[0].name,t,r[0].variants[t].transforms))}static ds(e){return!BC(e.conditions)&&cx.cs(e)&&cx.fs(e)}static cs(e){var t;if(BC(e.conditions)||BC((t=e.conditions)==null?void 0:t.url))return!0;var n,r,a,o=cx.getWindowLocation();return!!o&&((n=e.conditions)==null||!n.url||fQt[(r=(a=e.conditions)==null?void 0:a.urlMatchType)!==null&&r!==void 0?r:"icontains"](e.conditions.url,o))}static getWindowLocation(){return Qo==null?void 0:Qo.location}static fs(e){var t;if(BC(e.conditions)||BC((t=e.conditions)==null?void 0:t.utm))return!0;var n=fQe();if(n.utm_source){var r,a,o,s,l,u,d,f,p=(r=e.conditions)==null||(r=r.utm)==null||!r.utm_campaign||((a=e.conditions)==null||(a=a.utm)==null?void 0:a.utm_campaign)==n.utm_campaign,m=(o=e.conditions)==null||(o=o.utm)==null||!o.utm_source||((s=e.conditions)==null||(s=s.utm)==null?void 0:s.utm_source)==n.utm_source,y=(l=e.conditions)==null||(l=l.utm)==null||!l.utm_medium||((u=e.conditions)==null||(u=u.utm)==null?void 0:u.utm_medium)==n.utm_medium,x=(d=e.conditions)==null||(d=d.utm)==null||!d.utm_term||((f=e.conditions)==null||(f=f.utm)==null?void 0:f.utm_term)==n.utm_term;return p&&y&&x&&m}return!1}static ls(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];Pf.info("[WebExperiments] "+e,n)}hs(e,t,n){this._is_bot()?cx.ls("Refusing to render web experiment since the viewer is a likely bot"):t!=="control"?n.forEach(r=>{if(r.selector){var a;cx.ls("applying transform of variant "+t+" for experiment "+e+" ",r);var o=(a=document)==null?void 0:a.querySelectorAll(r.selector);o==null||o.forEach(s=>{var l=s;r.html&&(l.innerHTML=r.html),r.css&&l.setAttribute("style",r.css)})}}):cx.ls("Control variants leave the page unmodified.")}_is_bot(){return SB&&this._instance?MQe(SB,this._instance.config.custom_blocked_useragents):void 0}}var X4={},fee=()=>{},w5="posthog",DQe=!Mwt&&(iB==null?void 0:iB.indexOf("MSIE"))===-1&&(iB==null?void 0:iB.indexOf("Mozilla"))===-1,NQe=i=>{var e;return{api_host:"https://us.i.posthog.com",ui_host:null,token:"",autocapture:!0,rageclick:!0,cross_subdomain_cookie:lSt(Af==null?void 0:Af.location),persistence:"localStorage+cookie",persistence_name:"",loaded:fee,save_campaign_params:!0,custom_campaign_params:[],custom_blocked_useragents:[],save_referrer:!0,capture_pageview:i!=="2025-05-24"||"history_change",capture_pageleave:"if_capture_pageview",defaults:i??"unset",debug:nB&&G_(nB==null?void 0:nB.search)&&nB.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_external_dependency_loading:!1,enable_recording_console_log:void 0,secure_cookie:(Qo==null||(e=Qo.location)==null?void 0:e.protocol)==="https:",ip:!0,opt_out_capturing_by_default:!1,opt_out_persistence_by_default:!1,opt_out_useragent_filter:!1,opt_out_capturing_persistence_type:"localStorage",opt_out_capturing_cookie_prefix:null,opt_in_site_apps:!1,property_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_disable_toolbar_metrics:!1,feature_flag_request_timeout_ms:3e3,surveys_request_timeout_ms:1e4,on_request_error:t=>{var n="Bad HTTP status: "+t.statusCode+" "+t.text;Pf.error(n)},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:dee},error_tracking:{},_onCapture:fee}},TQe=i=>{var e={};ed(i.process_person)||(e.person_profiles=i.process_person),ed(i.xhr_headers)||(e.request_headers=i.xhr_headers),ed(i.cookie_name)||(e.persistence_name=i.cookie_name),ed(i.disable_cookie)||(e.disable_persistence=i.disable_cookie),ed(i.store_google)||(e.save_campaign_params=i.store_google),ed(i.verbose)||(e.debug=i.verbose);var t=EE({},e,i);return o_(i.property_blacklist)&&(ed(i.property_denylist)?t.property_denylist=i.property_blacklist:o_(i.property_denylist)?t.property_denylist=[...i.property_blacklist,...i.property_denylist]:Pf.error("Invalid value for property_denylist config: "+i.property_denylist)),t};class hQt{constructor(){this.__forceAllowLocalhost=!1}get ps(){return this.__forceAllowLocalhost}set ps(e){Pf.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=e}}class $G{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 hQt,this.gs=!1,this.version=DQ.LIB_VERSION,this._s=new xQe,this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=NQe(),this.SentryIntegration=Cwt,this.sentryIntegration=e=>function(t,n){var r=Owe(t,n);return{name:Fwe,processEvent:a=>r(a)}}(this,e),this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this.bs=!1,this.ys=null,this.ws=null,this.Ss=null,this.featureFlags=new qwt(this),this.toolbar=new _wt(this),this.scrollManager=new aQt(this),this.pageViewManager=new wwt(this),this.surveys=new $wt(this),this.experiments=new cx(this),this.exceptions=new Nwt(this),this.rateLimiter=new eQt(this),this.requestRouter=new dQt(this),this.consent=new MSt(this),this.people={set:(e,t,n)=>{var r=G_(e)?{[e]:t}:e;this.setPersonProperties(r),n==null||n({})},set_once:(e,t,n)=>{var r=G_(e)?{[e]:t}:e;this.setPersonProperties(void 0,r),n==null||n({})}},this.on("eventCaptured",e=>Pf.info('send "'+(e==null?void 0:e.event)+'"',e))}init(e,t,n){if(n&&n!==w5){var r,a=(r=X4[n])!==null&&r!==void 0?r:new $G;return a._init(e,t,n),X4[n]=a,X4[w5][n]=a,a}return this._init(e,t,n)}_init(e,t,n){var r,a;if(t===void 0&&(t={}),ed(e)||f$(e))return Pf.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 Pf.warn("You have already initialized PostHog! Re-initializing is a no-op"),this;this.__loaded=!0,this.config={},this.$s=t,this.ks=[],t.person_profiles&&(this.ws=t.person_profiles),this.set_config(EE({},NQe(t.defaults),TQe(t),{name:n,token:e})),this.config.on_xhr_error&&Pf.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=t.disable_compression?void 0:NQ.GZipJS,this.persistence=new cee(this.config),this.sessionPersistence=this.config.persistence==="sessionStorage"||this.config.persistence==="memory"?this.persistence:new cee(Wd({},this.config,{persistence:"sessionStorage"}));var o=Wd({},this.persistence.props),s=Wd({},this.sessionPersistence.props);if(this.register({$initialization_time:new Date().toISOString()}),this.xs=new nQt(b=>this.Es(b),this.config.request_queue_config),this.Is=new rQt(this),this.__request_queue=[],this.config.__preview_experimental_cookieless_mode||(this.sessionManager=new lQt(this),this.sessionPropsManager=new sQt(this,this.sessionManager,this.persistence)),new bwt(this).startIfEnabledOrStop(),this.siteApps=new uQt(this),(r=this.siteApps)==null||r.init(),this.config.__preview_experimental_cookieless_mode||(this.sessionRecording=new ywt(this),this.sessionRecording.startIfEnabledOrStop()),this.config.disable_scroll_properties||this.scrollManager.startMeasuringScrollPosition(),this.autocapture=new _St(this),this.autocapture.startIfEnabled(),this.surveys.loadIfEnabled(),this.heatmaps=new Swt(this),this.heatmaps.startIfEnabled(),this.webVitalsAutocapture=new xwt(this),this.exceptionObserver=new NSt(this),this.exceptionObserver.startIfEnabled(),this.deadClicksAutocapture=new Awe(this,DSt),this.deadClicksAutocapture.startIfEnabled(),this.historyAutocapture=new jSt(this),this.historyAutocapture.startIfEnabled(),DQ.DEBUG=DQ.DEBUG||this.config.debug,DQ.DEBUG&&Pf.info("Starting in debug mode",{this:this,config:t,thisC:Wd({},this.config),p:o,s}),this.Ps(),((a=t.bootstrap)==null?void 0:a.distinctID)!==void 0){var l,u,d=this.config.get_device_id(AM()),f=(l=t.bootstrap)!=null&&l.isIdentifiedID?d:t.bootstrap.distinctID;this.persistence.set_property(TQ,(u=t.bootstrap)!=null&&u.isIdentifiedID?"identified":"anonymous"),this.register({distinct_id:t.bootstrap.distinctID,$device_id:f})}if(this.Rs()){var p,m,y=Object.keys(((p=t.bootstrap)==null?void 0:p.featureFlags)||{}).filter(b=>{var Q;return!((Q=t.bootstrap)==null||(Q=Q.featureFlags)==null||!Q[b])}).reduce((b,Q)=>{var M;return b[Q]=((M=t.bootstrap)==null||(M=M.featureFlags)==null?void 0:M[Q])||!1,b},{}),x=Object.keys(((m=t.bootstrap)==null?void 0:m.featureFlagPayloads)||{}).filter(b=>y[b]).reduce((b,Q)=>{var M,L;return(M=t.bootstrap)!=null&&(M=M.featureFlagPayloads)!=null&&M[Q]&&(b[Q]=(L=t.bootstrap)==null||(L=L.featureFlagPayloads)==null?void 0:L[Q]),b},{});this.featureFlags.receivedFeatureFlags({featureFlags:y,featureFlagPayloads:x})}if(this.config.__preview_experimental_cookieless_mode)this.register_once({distinct_id:MG,$device_id:null},"");else if(!this.get_distinct_id()){var E=this.config.get_device_id(AM());this.register_once({distinct_id:E,$device_id:E},""),this.persistence.set_property(TQ,"anonymous")}return v_(Qo,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),this.toolbar.maybeLoadToolbar(),t.segment?vwt(this,()=>this.Ts()):this.Ts(),tS(this.config._onCapture)&&this.config._onCapture!==fee&&(Pf.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",b=>this.config._onCapture(b.event,b))),this}Ie(e){var t,n,r,a,o,s,l,u;if(!Af||!Af.body)return Pf.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout(()=>{this.Ie(e)},500);this.compression=void 0,e.supportedCompression&&!this.config.disable_compression&&(this.compression=My(e.supportedCompression,NQ.GZipJS)?NQ.GZipJS:My(e.supportedCompression,NQ.Base64)?NQ.Base64:void 0),(t=e.analytics)!=null&&t.endpoint&&(this.analyticsDefaultEndpoint=e.analytics.endpoint),this.set_config({person_profiles:this.ws?this.ws:"identified_only"}),(n=this.siteApps)==null||n.onRemoteConfig(e),(r=this.sessionRecording)==null||r.onRemoteConfig(e),(a=this.autocapture)==null||a.onRemoteConfig(e),(o=this.heatmaps)==null||o.onRemoteConfig(e),this.surveys.onRemoteConfig(e),(s=this.webVitalsAutocapture)==null||s.onRemoteConfig(e),(l=this.exceptionObserver)==null||l.onRemoteConfig(e),this.exceptions.onRemoteConfig(e),(u=this.deadClicksAutocapture)==null||u.onRemoteConfig(e)}Ts(){try{this.config.loaded(this)}catch(e){Pf.critical("`loaded` function failed",e)}this.Ms(),this.config.capture_pageview&&setTimeout(()=>{this.consent.isOptedIn()&&this.Cs()},1),new tQt(this).load(),this.featureFlags.flags()}Ms(){var e;this.has_opted_out_capturing()||this.config.request_batching&&((e=this.xs)==null||e.enable())}_dom_loaded(){this.has_opted_out_capturing()||cM(this.__request_queue,e=>this.Es(e)),this.__request_queue=[],this.Ms()}_handle_unload(){var e,t;this.config.request_batching?(this.Fs()&&this.capture("$pageleave"),(e=this.xs)==null||e.unload(),(t=this.Is)==null||t.unload()):this.Fs()&&this.capture("$pageleave",null,{transport:"sendBeacon"})}Ee(e){this.__loaded&&(DQe?this.__request_queue.push(e):this.rateLimiter.isServerRateLimited(e.batchKey)||(e.transport=e.transport||this.config.api_transport,e.url=JG(e.url,{ip:this.config.ip?1:0}),e.headers=Wd({},this.config.request_headers),e.compression=e.compression==="best-available"?this.compression:e.compression,e.fetchOptions=e.fetchOptions||this.config.fetch_options,(t=>{var n,r,a,o=Wd({},t);o.timeout=o.timeout||6e4,o.url=JG(o.url,{_:new Date().getTime().toString(),ver:DQ.LIB_VERSION,compression:o.compression});var s=(n=o.transport)!==null&&n!==void 0?n:"fetch",l=(r=(a=DSe(H4,u=>u.transport===s))==null?void 0:a.method)!==null&&r!==void 0?r:H4[0].method;if(!l)throw new Error("No available transport method");l(o)})(Wd({},e,{callback:t=>{var n,r;this.rateLimiter.checkForLimiting(t),t.statusCode>=400&&((n=(r=this.config).on_request_error)==null||n.call(r,t)),e.callback==null||e.callback(t)}}))))}Es(e){this.Is?this.Is.retriableRequest(e):this.Ee(e)}_execute_array(e){var t,n=[],r=[],a=[];cM(e,s=>{s&&(t=s[0],o_(t)?a.push(s):tS(s)?s.call(this):o_(s)&&t==="alias"?n.push(s):o_(s)&&t.indexOf("capture")!==-1&&tS(this[t])?a.push(s):r.push(s))});var o=function(s,l){cM(s,function(u){if(o_(u[0])){var d=l;t1(u,function(f){d=d[f[0]].apply(d,f.slice(1))})}else this[u[0]].apply(this,u.slice(1))},l)};o(n,this),o(r,this),o(a,this)}Rs(){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,n){var r;if(this.__loaded&&this.persistence&&this.sessionPersistence&&this.xs){if(!this.consent.isOptedOut())if(!ed(e)&&G_(e)){if(this.config.opt_out_useragent_filter||!this._is_bot()){var a=n!=null&&n.skip_client_rate_limiting?void 0:this.rateLimiter.clientRateLimitContext();if(a==null||!a.isRateLimited){t!=null&&t.$current_url&&!G_(t==null?void 0:t.$current_url)&&(Pf.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 o=new Date,s=(n==null?void 0:n.timestamp)||o,l=AM(),u={uuid:l,event:e,properties:this.calculateEventProperties(e,t||{},s,l)};a&&(u.properties.$lib_rate_limit_remaining_tokens=a.remainingTokens),n!=null&&n.$set&&(u.$set=n==null?void 0:n.$set);var d,f,p=this.Os(n==null?void 0:n.$set_once);if(p&&(u.$set_once=p),(u=oSt(u,n!=null&&n._noTruncate?null:this.config.properties_string_max_length)).timestamp=s,ed(n==null?void 0:n.timestamp)||(u.properties.$event_time_override_provided=!0,u.properties.$event_time_override_system_time=o),e===Aee.DISMISSED||e===Aee.SENT){var m=t==null?void 0:t[BQe.SURVEY_ID],y=t==null?void 0:t[BQe.SURVEY_ITERATION];localStorage.setItem((f=""+uee+(d={id:m,current_iteration:y}).id,d.current_iteration&&d.current_iteration>0&&(f=""+uee+d.id+"_"+d.current_iteration),f),"true"),u.$set=Wd({},u.$set,{[Xwt({id:m,current_iteration:y},e===Aee.SENT?"responded":"dismissed")]:!0})}var x=Wd({},u.properties.$set,u.$set);if(g5(x)||this.setPersonPropertiesForFlags(x),!BC(this.config.before_send)){var E=this.As(u);if(!E)return;u=E}this._s.emit("eventCaptured",u);var b={method:"POST",url:(r=n==null?void 0:n._url)!==null&&r!==void 0?r:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),data:u,compression:"best-available",batchKey:n==null?void 0:n._batchKey};return!this.config.request_batching||n&&(n==null||!n._batchKey)||n!=null&&n.send_instantly?this.Es(b):this.xs.enqueue(b),u}Pf.critical("This capture call is ignored due to client rate limiting.")}}else Pf.error("No event name provided to posthog.capture")}else Pf.uninitializedWarning("posthog.capture")}Ge(e){return this.on("eventCaptured",t=>e(t.event,t))}calculateEventProperties(e,t,n,r,a){if(n=n||new Date,!this.persistence||!this.sessionPersistence)return t;var o=a?void 0:this.persistence.remove_event_timer(e),s=Wd({},t);if(s.token=this.config.token,s.$config_defaults=this.config.defaults,this.config.__preview_experimental_cookieless_mode&&(s.$cookieless_mode=!0),e==="$snapshot"){var l=Wd({},this.persistence.properties(),this.sessionPersistence.properties());return s.distinct_id=l.distinct_id,(!G_(s.distinct_id)&&!ox(s.distinct_id)||f$(s.distinct_id))&&Pf.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),s}var u,d=Kwt(this.config.mask_personal_data_properties,this.config.custom_personal_data_properties);if(this.sessionManager){var{sessionId:f,windowId:p}=this.sessionManager.checkAndGetSessionAndWindowId(a,n.getTime());s.$session_id=f,s.$window_id=p}this.sessionPropsManager&&EE(s,this.sessionPropsManager.getSessionProps());try{var m;this.sessionRecording&&EE(s,this.sessionRecording.sdkDebugProperties),s.$sdk_debug_retry_queue_size=(m=this.Is)==null?void 0:m.length}catch(b){s.$sdk_debug_error_capturing_properties=String(b)}if(this.requestRouter.region===Z4.CUSTOM&&(s.$lib_custom_api_host=this.config.api_host),u=e!=="$pageview"||a?e!=="$pageleave"||a?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(n):this.pageViewManager.doPageView(n,r),s=EE(s,u),e==="$pageview"&&Af&&(s.title=Af.title),!ed(o)){var y=n.getTime()-o;s.$duration=parseFloat((y/1e3).toFixed(3))}iB&&this.config.opt_out_useragent_filter&&(s.$browser_type=this._is_bot()?"bot":"browser"),(s=EE({},d,this.persistence.properties(),this.sessionPersistence.properties(),s)).$is_identified=this._isIdentified(),o_(this.config.property_denylist)?t1(this.config.property_denylist,function(b){delete s[b]}):Pf.error("Invalid value for property_denylist config: "+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);var x=this.config.sanitize_properties;x&&(Pf.error("sanitize_properties is deprecated. Use before_send instead"),s=x(s,e));var E=this.Ds();return s.$process_person_profile=E,E&&!a&&this.Ls("_calculate_event_properties"),s}Os(e){var t;if(!this.persistence||!this.Ds()||this.gs)return e;var n=this.persistence.get_initial_props(),r=(t=this.sessionPropsManager)==null?void 0:t.getSetOnceProps(),a=EE({},n,r||{},e||{}),o=this.config.sanitize_properties;return o&&(Pf.error("sanitize_properties is deprecated. Use before_send instead"),a=o(a,"$set_once")),this.gs=!0,g5(a)?void 0:a}register(e,t){var n;(n=this.persistence)==null||n.register(e,t)}register_once(e,t,n){var r;(r=this.persistence)==null||r.register_once(e,t,n)}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)}js(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){this.featureFlags.updateEarlyAccessFeatureEnrollment(e,t)}getEarlyAccessFeatures(e,t,n){return t===void 0&&(t=!1),this.featureFlags.getEarlyAccessFeatures(e,t,n)}on(e,t){return this._s.on(e,t)}onFeatureFlags(e){return this.featureFlags.onFeatureFlags(e)}onSurveysLoaded(e){return this.surveys.onSurveysLoaded(e)}onSessionId(e){var t,n;return(t=(n=this.sessionManager)==null?void 0:n.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,n){if(!this.__loaded||!this.persistence)return Pf.uninitializedWarning("posthog.identify");if(ox(e)&&(e=e.toString(),Pf.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()))Pf.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!==MG){if(this.Ls("posthog.identify")){var r=this.get_distinct_id();if(this.register({$user_id:e}),!this.get_property("$device_id")){var a=r;this.register_once({$had_persisted_distinct_id:!0,$device_id:a},"")}e!==r&&e!==this.get_property(N4)&&(this.unregister(N4),this.register({distinct_id:e}));var o=(this.persistence.get_property(TQ)||"anonymous")==="anonymous";e!==r&&o?(this.persistence.set_property(TQ,"identified"),this.setPersonPropertiesForFlags(Wd({},n||{},t||{}),!1),this.capture("$identify",{distinct_id:e,$anon_distinct_id:r},{$set:t||{},$set_once:n||{}}),this.Ss=jwe(e,t,n),this.featureFlags.setAnonymousDistinctId(r)):(t||n)&&this.setPersonProperties(t,n),e!==r&&(this.reloadFeatureFlags(),this.unregister(SG))}}else Pf.critical('The string "'+MG+'" was set in posthog.identify which indicates an error. This ID is only used as a sentinel value.');else Pf.error("Unique user id has not been set in posthog.identify")}setPersonProperties(e,t){if((e||t)&&this.Ls("posthog.setPersonProperties")){var n=jwe(this.get_distinct_id(),e,t);this.Ss!==n?(this.setPersonPropertiesForFlags(Wd({},t||{},e||{})),this.capture("$set",{$set:e||{},$set_once:t||{}}),this.Ss=n):Pf.info("A duplicate setPersonProperties call was made with the same properties. It has been ignored.")}}group(e,t,n){if(e&&t){if(this.Ls("posthog.group")){var r=this.getGroups();r[e]!==t&&this.resetGroupPropertiesForFlags(e),this.register({$groups:Wd({},r,{[e]:t})}),n&&(this.capture("$groupidentify",{$group_type:e,$group_key:t,$group_set:n}),this.setGroupPropertiesForFlags({[e]:n})),r[e]===t||n||this.reloadFeatureFlags()}}else Pf.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.Ls("posthog.setGroupPropertiesForFlags")&&this.featureFlags.setGroupPropertiesForFlags(e,t)}resetGroupPropertiesForFlags(e){this.featureFlags.resetGroupPropertiesForFlags(e)}reset(e){var t,n,r,a;if(Pf.info("reset"),!this.__loaded)return Pf.uninitializedWarning("posthog.reset");var o=this.get_property("$device_id");if(this.consent.reset(),(t=this.persistence)==null||t.clear(),(n=this.sessionPersistence)==null||n.clear(),this.surveys.reset(),(r=this.persistence)==null||r.set_property(TQ,"anonymous"),(a=this.sessionManager)==null||a.resetSessionId(),this.Ss=null,this.config.__preview_experimental_cookieless_mode)this.register_once({distinct_id:MG,$device_id:null},"");else{var s=this.config.get_device_id(AM());this.register_once({distinct_id:s,$device_id:e?s:o},"")}this.register({$last_posthog_reset:new Date().toISOString()},1)}get_distinct_id(){return this.get_property("distinct_id")}getGroups(){return this.get_property("$groups")||{}}get_session_id(){var e,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:n}=this.sessionManager.checkAndGetSessionAndWindowId(!0),r=this.requestRouter.endpointFor("ui","/project/"+this.config.token+"/replay/"+t);if(e!=null&&e.withTimestamp&&n){var a,o=(a=e.timestampLookBack)!==null&&a!==void 0?a:10;if(!n)return r;r+="?t="+Math.max(Math.floor((new Date().getTime()-n)/1e3)-o,0)}return r}alias(e,t){return e===this.get_property(NSe)?(Pf.critical("Attempting to create alias for existing People user - aborting."),-2):this.Ls("posthog.alias")?(ed(t)&&(t=this.get_distinct_id()),e!==t?(this.js(N4,e),this.capture("$create_alias",{alias:e,distinct_id:t})):(Pf.warn("alias matches current distinct_id - skipping api call."),this.identify(e),-1)):void 0}set_config(e){var t,n,r,a,o=Wd({},this.config);k_(e)&&(EE(this.config,TQe(e)),(t=this.persistence)==null||t.update_config(this.config,o),this.sessionPersistence=this.config.persistence==="sessionStorage"||this.config.persistence==="memory"?this.persistence:new cee(Wd({},this.config,{persistence:"sessionStorage"})),KE.O()&&KE.D("ph_debug")==="true"&&(this.config.debug=!0),this.config.debug&&(DQ.DEBUG=!0,Pf.info("set_config",{config:e,oldConfig:o,newConfig:Wd({},this.config)})),(n=this.sessionRecording)==null||n.startIfEnabledOrStop(),(r=this.autocapture)==null||r.startIfEnabled(),(a=this.heatmaps)==null||a.startIfEnabled(),this.surveys.loadIfEnabled(),this.Ps())}startSessionRecording(e){var t=e===!0,n={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(n).some(Boolean)){var r,a,o,s,l;(r=this.sessionManager)==null||r.checkAndGetSessionAndWindowId(),n.sampling&&((a=this.sessionRecording)==null||a.overrideSampling()),n.linked_flag&&((o=this.sessionRecording)==null||o.overrideLinkedFlag()),n.url_trigger&&((s=this.sessionRecording)==null||s.overrideTrigger("url")),n.event_trigger&&((l=this.sessionRecording)==null||l.overrideTrigger("event"))}this.set_config({disable_session_recording:!1})}stopSessionRecording(){this.set_config({disable_session_recording:!0})}sessionRecordingStarted(){var e;return!((e=this.sessionRecording)==null||!e.started)}captureException(e,t){var n=new Error("PostHog syntheticException");this.exceptions.sendExceptionEvent(Wd({},KSt((r=>r instanceof Error)(e)?{error:e,event:e.message}:{event:e},{syntheticException:n}),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:w5;return t!==w5&&(t=w5+"."+t),t}_isIdentified(){var e,t;return((e=this.persistence)==null?void 0:e.get_property(TQ))==="identified"||((t=this.sessionPersistence)==null?void 0:t.get_property(TQ))==="identified"}Ds(){var e,t;return!(this.config.person_profiles==="never"||this.config.person_profiles==="identified_only"&&!this._isIdentified()&&g5(this.getGroups())&&((e=this.persistence)==null||(e=e.props)==null||!e[N4])&&((t=this.persistence)==null||(t=t.props)==null||!t[QG]))}Fs(){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.Ds()||this.Ls("posthog.createPersonProfile")&&this.setPersonProperties({},{})}Ls(e){return this.config.person_profiles==="never"?(Pf.error(e+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this.js(QG,!0),!0)}Ps(){var e,t,n,r,a=this.consent.isOptedOut(),o=this.config.opt_out_persistence_by_default,s=this.config.disable_persistence||a&&!!o;((e=this.persistence)==null?void 0:e.Fe)!==s&&((n=this.persistence)==null||n.set_disabled(s)),((t=this.sessionPersistence)==null?void 0:t.Fe)!==s&&((r=this.sessionPersistence)==null||r.set_disabled(s))}opt_in_capturing(e){var t;this.consent.optInOut(!0),this.Ps(),(ed(e==null?void 0:e.captureEventName)||e!=null&&e.captureEventName)&&this.capture((t=e==null?void 0:e.captureEventName)!==null&&t!==void 0?t:"$opt_in",e==null?void 0:e.captureProperties,{send_instantly:!0}),this.config.capture_pageview&&this.Cs()}opt_out_capturing(){this.consent.optInOut(!1),this.Ps()}has_opted_in_capturing(){return this.consent.isOptedIn()}has_opted_out_capturing(){return this.consent.isOptedOut()}clear_opt_in_out_capturing(){this.consent.reset(),this.Ps()}_is_bot(){return SB?MQe(SB,this.config.custom_blocked_useragents):void 0}Cs(){Af&&(Af.visibilityState==="visible"?this.bs||(this.bs=!0,this.capture("$pageview",{title:Af.title},{send_instantly:!0}),this.ys&&(Af.removeEventListener("visibilitychange",this.ys),this.ys=null)):this.ys||(this.ys=this.Cs.bind(this),v_(Af,"visibilitychange",this.ys)))}debug(e){e===!1?(Qo==null||Qo.console.log("You've disabled debug mode."),localStorage&&localStorage.removeItem("ph_debug"),this.set_config({debug:!1})):(Qo==null||Qo.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}))}I(){var e,t,n,r,a,o,s,l=this.$s||{};return"advanced_disable_flags"in l?!!l.advanced_disable_flags:this.config.advanced_disable_flags!==!1?!!this.config.advanced_disable_flags:this.config.advanced_disable_decide===!0?(Pf.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):(n="advanced_disable_decide",r=!1,a=Pf,o=(t="advanced_disable_flags")in(e=l)&&!ed(e[t]),s=n in e&&!ed(e[n]),o?e[t]:s?(a&&a.warn("Config field '"+n+"' is deprecated. Please use '"+t+"' instead. The old field will be removed in a future major version."),e[n]):r)}As(e){if(BC(this.config.before_send))return e;var t=o_(this.config.before_send)?this.config.before_send:[this.config.before_send],n=e;for(var r of t){if(n=r(n),BC(n)){var a="Event '"+e.event+"' was rejected in beforeSend function";return iSt(e.event)?Pf.warn(a+". This can cause unexpected behavior."):Pf.info(a),null}n.properties&&!g5(n.properties)||Pf.warn("Event '"+e.event+"' has no properties after beforeSend function, this is likely an error.")}return n}getPageViewId(){var e;return(e=this.pageViewManager.ce)==null?void 0:e.pageViewId}captureTraceFeedback(e,t){this.capture("$ai_feedback",{$ai_trace_id:String(e),$ai_feedback_text:t})}captureTraceMetric(e,t,n){this.capture("$ai_metric",{$ai_trace_id:String(e),$ai_metric_name:t,$ai_metric_value:String(n)})}}(function(i,e){for(var t=0;t<e.length;t++)i.prototype[e[t]]=aSt(i.prototype[e[t]])})($G,["identify"]);var UQe,eF=(UQe=X4[w5]=new $G,function(){function i(){i.done||(i.done=!0,DQe=!1,t1(X4,function(e){e._dom_loaded()}))}Af!=null&&Af.addEventListener?Af.readyState==="complete"?i():v_(Af,"DOMContentLoaded",i,{capture:!1}):Qo&&Pf.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")}(),UQe);!window.location.hostname.includes("localhost")&&!window.location.hostname.includes("127.0.0.1")&&(eF.__loaded||eF.init("phc_htd8AQjSfVEsFCLQMAiUooG4Q0DKBCjqYuQglc9V3Wo",{api_host:"https://postpig.tscircuit.com",person_profiles:"always"}));function jm(...i){return WBt(Iw(i))}const PQe=i=>i.replace(/_/g," ").replace(/\b\w/g,e=>e.toUpperCase()),hee=IBt,tF=it.forwardRef(({className:i,...e},t)=>Ke.jsx(ASe,{ref:t,className:jm("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",i),...e}));tF.displayName=ASe.displayName;const Sw=it.forwardRef(({className:i,...e},t)=>Ke.jsx(dSe,{ref:t,className:jm("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",i),...e}));Sw.displayName=dSe.displayName;const rS=it.forwardRef(({className:i,...e},t)=>Ke.jsx(fSe,{ref:t,className:jm("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",i),...e}));rS.displayName=fSe.displayName;/**
895
+ `)).length,r=0;r<n;r++){var o=i.charCodeAt(r),s=null;o<128?t++:s=o>127&&o<2048?String.fromCharCode(o>>6|192,63&o|128):String.fromCharCode(o>>12|224,o>>6&63|128,63&o|128),lM(s)||(t>e&&(a+=i.substring(e,t)),a+=s,e=t=r+1)}return t>e&&(a+=i.substring(e,i.length)),a},Mwt=!!u$||!!c$,Kwe="text/plain",JG=(i,e)=>{var[t,n]=i.split("?"),r=Wd({},e);n==null||n.split("&").forEach(o=>{var[s]=o.split("=");delete r[s]});var a=ySt(r);return t+"?"+(a=a?(n?n+"&":"")+a:n)},z4=(i,e)=>JSON.stringify(i,(t,n)=>typeof n=="bigint"?n.toString():n,e),W$=i=>{var{data:e,compression:t}=i;if(e){if(t===NQ.GZipJS){var n=Nwe(Twe(z4(e)),{mtime:0}),r=new Blob([n],{type:Kwe});return{contentType:Kwe,body:r,estimatedSize:r.size}}if(t===NQ.Base64){var a=function(l){var u,d,f,p,m,y="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",x=0,E=0,b="",Q=[];if(!l)return l;l=Qwt(l);do u=(m=l.charCodeAt(x++)<<16|l.charCodeAt(x++)<<8|l.charCodeAt(x++))>>18&63,d=m>>12&63,f=m>>6&63,p=63&m,Q[E++]=y.charAt(u)+y.charAt(d)+y.charAt(f)+y.charAt(p);while(x<l.length);switch(b=Q.join(""),l.length%3){case 1:b=b.slice(0,-2)+"==";break;case 2:b=b.slice(0,-1)+"="}return b}(z4(e)),o=(l=>"data="+encodeURIComponent(typeof l=="string"?l:z4(l)))(a);return{contentType:"application/x-www-form-urlencoded",body:o,estimatedSize:new Blob([o]).size}}var s=z4(e);return{contentType:"application/json",body:s,estimatedSize:new Blob([s]).size}}},H4=[];c$&&H4.push({transport:"fetch",method:i=>{var e,t,{contentType:n,body:r,estimatedSize:a}=(e=W$(i))!==null&&e!==void 0?e:{},o=new Headers;t1(i.headers,function(d,f){o.append(f,d)}),n&&o.append("Content-Type",n);var s=i.url,l=null;if(xSe){var u=new xSe;l={signal:u.signal,timeout:setTimeout(()=>u.abort(),i.timeout)}}c$(s,Wd({method:(i==null?void 0:i.method)||"GET",headers:o,keepalive:i.method==="POST"&&(a||0)<52428.8,body:r,signal:(t=l)==null?void 0:t.signal},i.fetchOptions)).then(d=>d.text().then(f=>{var p={statusCode:d.status,text:f};if(d.status===200)try{p.json=JSON.parse(f)}catch(m){Pf.error(m)}i.callback==null||i.callback(p)})).catch(d=>{Pf.error(d),i.callback==null||i.callback({statusCode:0,text:d})}).finally(()=>l?clearTimeout(l.timeout):null)}}),u$&&H4.push({transport:"XHR",method:i=>{var e,t=new u$;t.open(i.method||"GET",i.url,!0);var{contentType:n,body:r}=(e=W$(i))!==null&&e!==void 0?e:{};t1(i.headers,function(a,o){t.setRequestHeader(o,a)}),n&&t.setRequestHeader("Content-Type",n),i.timeout&&(t.timeout=i.timeout),t.withCredentials=!0,t.onreadystatechange=()=>{if(t.readyState===4){var a={statusCode:t.status,text:t.responseText};if(t.status===200)try{a.json=JSON.parse(t.responseText)}catch{}i.callback==null||i.callback(a)}},t.send(r)}}),SB!=null&&SB.sendBeacon&&H4.push({transport:"sendBeacon",method:i=>{var e=JG(i.url,{beacon:"1"});try{var t,{contentType:n,body:r}=(t=W$(i))!==null&&t!==void 0?t:{},a=typeof r=="string"?new Blob([r],{type:n}):r;SB.sendBeacon(e,a)}catch{}}});var E5=function(i,e){if(!function(t){try{new RegExp(t)}catch{return!1}return!0}(e))return!1;try{return new RegExp(e).test(i)}catch{return!1}};function jwe(i,e,t){return z4({distinct_id:i,userPropertiesToSet:e,userPropertiesToSetOnce:t})}var Rwt={exact:(i,e)=>e.some(t=>i.some(n=>t===n)),is_not:(i,e)=>e.every(t=>i.every(n=>t!==n)),regex:(i,e)=>e.some(t=>i.some(n=>E5(t,n))),not_regex:(i,e)=>e.every(t=>i.every(n=>!E5(t,n))),icontains:(i,e)=>e.map(qG).some(t=>i.map(qG).some(n=>t.includes(n))),not_icontains:(i,e)=>e.map(qG).every(t=>i.map(qG).every(n=>!t.includes(n)))},qG=i=>i.toLowerCase(),Dwt=Mb("[Error tracking]");class Nwt{constructor(e){var t,n;this.fe=[],this._instance=e,this.fe=(t=(n=this._instance.persistence)==null?void 0:n.get_property(g$))!==null&&t!==void 0?t:[]}onRemoteConfig(e){var t,n,r=(t=(n=e.errorTracking)==null?void 0:n.suppressionRules)!==null&&t!==void 0?t:[];this.fe=r,this._instance.persistence&&this._instance.persistence.register({[g$]:this.fe})}sendExceptionEvent(e){this.pe(e)?Dwt.info("Skipping exception capture because a suppression rule matched"):this._instance.capture("$exception",e,{_noTruncate:!0,_batchKey:"exceptionEvent"})}pe(e){var t=e.$exception_list;if(!t||!o_(t)||t.length===0)return!1;var n=t.reduce((r,a)=>{var{type:o,value:s}=a;return G_(o)&&o.length>0&&r.$exception_types.push(o),G_(s)&&s.length>0&&r.$exception_values.push(s),r},{$exception_types:[],$exception_values:[]});return this.fe.some(r=>{var a=r.values.map(o=>{var s,l=Rwt[o.operator],u=o_(o.value)?o.value:[o.value],d=(s=n[o.key])!==null&&s!==void 0?s:[];return u.length>0&&l(u,d)});return r.type==="OR"?a.some(Boolean):a.every(Boolean)})}}var iS="Mobile",ZG="iOS",xw="Android",Y4="Tablet",Jwe=xw+" "+Y4,qwe="iPad",Zwe="Apple",Xwe=Zwe+" Watch",V4="Safari",b5="BlackBerry",Wwe="Samsung",$we=Wwe+"Browser",eQe=Wwe+" Internet",D3="Chrome",Twt=D3+" OS",tQe=D3+" "+ZG,$$="Internet Explorer",nQe=$$+" "+iS,eee="Opera",Uwt=eee+" Mini",tee="Edge",iQe="Microsoft "+tee,x5="Firefox",rQe=x5+" "+ZG,K4="Nintendo",j4="PlayStation",B5="Xbox",aQe=xw+" "+iS,oQe=iS+" "+V4,J4="Windows",nee=J4+" Phone",sQe="Nokia",iee="Ouya",lQe="Generic",Pwt=lQe+" "+iS.toLowerCase(),cQe=lQe+" "+Y4.toLowerCase(),ree="Konqueror",Rx="(\\d+(\\.\\d+)?)",aee=new RegExp("Version/"+Rx),Lwt=new RegExp(B5,"i"),kwt=new RegExp(j4+" \\w+","i"),Gwt=new RegExp(K4+" \\w+","i"),oee=new RegExp(b5+"|PlayBook|BB10","i"),Fwt={"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"},Owt=(i,e)=>e&&My(e,Zwe)||function(t){return My(t,V4)&&!My(t,D3)&&!My(t,xw)}(i),uQe=function(i,e){return e=e||"",My(i," OPR/")&&My(i,"Mini")?Uwt:My(i," OPR/")?eee:oee.test(i)?b5:My(i,"IE"+iS)||My(i,"WPDesktop")?nQe:My(i,$we)?eQe:My(i,tee)||My(i,"Edg/")?iQe:My(i,"FBIOS")?"Facebook "+iS:My(i,"UCWEB")||My(i,"UCBrowser")?"UC Browser":My(i,"CriOS")?tQe:My(i,"CrMo")||My(i,D3)?D3:My(i,xw)&&My(i,V4)?aQe:My(i,"FxiOS")?rQe:My(i.toLowerCase(),ree.toLowerCase())?ree:Owt(i,e)?My(i,iS)?oQe:V4:My(i,x5)?x5:My(i,"MSIE")||My(i,"Trident/")?$$:My(i,"Gecko")?x5:""},zwt={[nQe]:[new RegExp("rv:"+Rx)],[iQe]:[new RegExp(tee+"?\\/"+Rx)],[D3]:[new RegExp("("+D3+"|CrMo)\\/"+Rx)],[tQe]:[new RegExp("CriOS\\/"+Rx)],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/"+Rx)],[V4]:[aee],[oQe]:[aee],[eee]:[new RegExp("(Opera|OPR)\\/"+Rx)],[x5]:[new RegExp(x5+"\\/"+Rx)],[rQe]:[new RegExp("FxiOS\\/"+Rx)],[ree]:[new RegExp("Konqueror[:/]?"+Rx,"i")],[b5]:[new RegExp(b5+" "+Rx),aee],[aQe]:[new RegExp("android\\s"+Rx,"i")],[eQe]:[new RegExp($we+"\\/"+Rx)],[$$]:[new RegExp("(rv:|MSIE )"+Rx)],Mozilla:[new RegExp("rv:"+Rx)]},Hwt=function(i,e){var t=uQe(i,e),n=zwt[t];if(ed(n))return null;for(var r=0;r<n.length;r++){var a=n[r],o=i.match(a);if(o)return parseFloat(o[o.length-2])}return null},AQe=[[new RegExp(B5+"; "+B5+" (.*?)[);]","i"),i=>[B5,i&&i[1]||""]],[new RegExp(K4,"i"),[K4,""]],[new RegExp(j4,"i"),[j4,""]],[oee,[b5,""]],[new RegExp(J4,"i"),(i,e)=>{if(/Phone/.test(e)||/WPDesktop/.test(e))return[nee,""];if(new RegExp(iS).test(e)&&!/IEMobile\b/.test(e))return[J4+" "+iS,""];var t=/Windows NT ([0-9.]+)/i.exec(e);if(t&&t[1]){var n=t[1],r=Fwt[n]||"";return/arm/i.test(e)&&(r="RT"),[J4,r]}return[J4,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,i=>{if(i&&i[3]){var e=[i[3],i[4],i[5]||"0"];return[ZG,e.join(".")]}return[ZG,""]}],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,i=>{var e="";return i&&i.length>=3&&(e=ed(i[2])?i[3]:i[2]),["watchOS",e]}],[new RegExp("("+xw+" (\\d+)\\.(\\d+)\\.?(\\d+)?|"+xw+")","i"),i=>{if(i&&i[2]){var e=[i[2],i[3],i[4]||"0"];return[xw,e.join(".")]}return[xw,""]}],[/Mac OS X (\d+)[_.](\d+)[_.]?(\d+)?/i,i=>{var e=["Mac OS X",""];if(i&&i[1]){var t=[i[1],i[2],i[3]||"0"];e[1]=t.join(".")}return e}],[/Mac/i,["Mac OS X",""]],[/CrOS/,[Twt,""]],[/Linux|debian/i,["Linux",""]]],dQe=function(i){return Gwt.test(i)?K4:kwt.test(i)?j4:Lwt.test(i)?B5:new RegExp(iee,"i").test(i)?iee:new RegExp("("+nee+"|WPDesktop)","i").test(i)?nee:/iPad/.test(i)?qwe:/iPod/.test(i)?"iPod Touch":/iPhone/.test(i)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(i)?Xwe:oee.test(i)?b5:/(kobo)\s(ereader|touch)/i.test(i)?"Kobo":new RegExp(sQe,"i").test(i)?sQe:/(kf[a-z]{2}wi|aeo[c-r]{2})( bui|\))/i.test(i)||/(kf[a-z]+)( bui|\)).+silk\//i.test(i)?"Kindle Fire":/(Android|ZTE)/i.test(i)?!new RegExp(iS).test(i)||/(9138B|TB782B|Nexus [97]|pixel c|HUAWEISHT|BTV|noble nook|smart ultra 6)/i.test(i)?/pixel[\daxl ]{1,6}/i.test(i)&&!/pixel c/i.test(i)||/(huaweimed-al00|tah-|APA|SM-G92|i980|zte|U304AA)/i.test(i)||/lmy47v/i.test(i)&&!/QTAQZ3/i.test(i)?xw:Jwe:xw:new RegExp("(pda|"+iS+")","i").test(i)?Pwt:new RegExp(Y4,"i").test(i)&&!new RegExp(Y4+" pc","i").test(i)?cQe:""},XG="https?://(.*)",WG=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],Ywt=_G(["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid"],WG),see="<masked>";function fQe(i,e,t){if(!Af)return{};var n=e?_G([],WG,t||[]):[];return hQe(Q$(Af.URL,n,see),i)}function hQe(i,e){var t=Ywt.concat(e||[]),n={};return t1(t,function(r){var a=TG(i,r);n[r]=a||null}),n}function pQe(i){var e=function(a){return a?a.search(XG+"google.([^/?]*)")===0?"google":a.search(XG+"bing.com")===0?"bing":a.search(XG+"yahoo.com")===0?"yahoo":a.search(XG+"duckduckgo.com")===0?"duckduckgo":null:null}(i),t=e!="yahoo"?"q":"p",n={};if(!lM(e)){n.$search_engine=e;var r=Af?TG(Af.referrer,t):"";r.length&&(n.ph_keyword=r)}return n}function gQe(){return navigator.language||navigator.userLanguage}function mQe(){return(Af==null?void 0:Af.referrer)||"$direct"}function yQe(i,e){var t=i?_G([],WG,e||[]):[],n=nB==null?void 0:nB.href.substring(0,1e3);return{r:mQe().substring(0,1e3),u:n?Q$(n,t,see):void 0}}function vQe(i){var e,{r:t,u:n}=i,r={$referrer:t,$referring_domain:t==null?void 0:t=="$direct"?"$direct":(e=v5(t))==null?void 0:e.host};if(n){r.$current_url=n;var a=v5(n);r.$host=a==null?void 0:a.host,r.$pathname=a==null?void 0:a.pathname;var o=hQe(n);EE(r,o)}if(t){var s=pQe(t);EE(r,s)}return r}function CQe(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch{return}}function Vwt(){try{return new Date().getTimezoneOffset()}catch{return}}function Kwt(i,e){if(!iB)return{};var t,n,r,a=i?_G([],WG,e||[]):[],[o,s]=function(l){for(var u=0;u<AQe.length;u++){var[d,f]=AQe[u],p=d.exec(l),m=p&&(tS(f)?f(p,l):f);if(m)return m}return["",""]}(iB);return EE(h$({$os:o,$os_version:s,$browser:uQe(iB,navigator.vendor),$device:dQe(iB),$device_type:(n=iB,r=dQe(n),r===qwe||r===Jwe||r==="Kobo"||r==="Kindle Fire"||r===cQe?Y4:r===K4||r===B5||r===j4||r===iee?"Console":r===Xwe?"Wearable":r?iS:"Desktop"),$timezone:CQe(),$timezone_offset:Vwt()}),{$current_url:Q$(nB==null?void 0:nB.href,a,see),$host:nB==null?void 0:nB.host,$pathname:nB==null?void 0:nB.pathname,$raw_user_agent:iB.length>1e3?iB.substring(0,997)+"...":iB,$browser_version:Hwt(iB,navigator.vendor),$browser_language:gQe(),$browser_language_prefix:(t=gQe(),typeof t=="string"?t.split("-")[0]:void 0),$screen_height:Qo==null?void 0:Qo.screen.height,$screen_width:Qo==null?void 0:Qo.screen.width,$viewport_height:Qo==null?void 0:Qo.innerHeight,$viewport_width:Qo==null?void 0:Qo.innerWidth,$lib:"web",$lib_version:DQ.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3})}var Bw=Mb("[FeatureFlags]"),lee="$active_feature_flags",S5="$override_feature_flags",IQe="$feature_flag_payloads",q4="$override_feature_flag_payloads",_Qe="$feature_flag_request_id",EQe=i=>{var e={};for(var[t,n]of EG(i||{}))n&&(e[t]=n);return e},jwt=i=>{var e=i.flags;return e?(i.featureFlags=Object.fromEntries(Object.keys(e).map(t=>{var n;return[t,(n=e[t].variant)!==null&&n!==void 0?n:e[t].enabled]})),i.featureFlagPayloads=Object.fromEntries(Object.keys(e).filter(t=>e[t].enabled).filter(t=>{var n;return(n=e[t].metadata)==null?void 0:n.payload}).map(t=>{var n;return[t,(n=e[t].metadata)==null?void 0:n.payload]}))):Bw.warn("Using an older version of the feature flags endpoint. Please upgrade your PostHog server to the latest version"),i},Jwt=function(i){return i.FeatureFlags="feature_flags",i.Recordings="recordings",i}({}),bQe=new Set(["7c6f7b45","66c1f69c","2727f65a","f3287528","8cc9a311","eb9f671b","c0e1c6f9","057989ec","723f4019","7b102104","563359d3","bad973ea","f6f2c4f4","59454a61","89ad1076","4edd0da1","26c52e72","a970bd2e","89cf4454","16e2b4e7","fba0e7b6","301c8488","bc65d69e","fe66a3c5","37926ca6","52a196df","d32a7577","42c4c9ef","6883bd5a","04809ff7","e59430a8","61be3dd8","7fa5500b","bf027177","8cfdba9b","96f6df5f","569798e9","0ebc61a5","1b5d7b92","17ebb0a4","f97ea965","85cc817b","3044dfc1","0c3fe5c3","b1f95fa3","8a6342e8","72365c68","12d34ad9","733853ec","3beeb69a","0645bb64","32de7f98","5dcbee21","3fe85053","ad960278","9466e5dd","7ca97b2d","2ee2a65c","28fde5f2","85c52f49","0ad823f4","f11b6cc9","aacf8af9","ab3e62b3","3a85ff15","8a67d3c4","f5e91ef1","4b873698","c5dae949","5b643d76","9599c892","34377448","2189e408","3be9ad53","1a14ce7c","2a164ded","8d53ea86","53bdb37d","bfc3f590","8df38ede","bdb81e49","38fde5c0","8d707e6d","73cbc496","f9d8a5ef","d3a9f8c4","a980d8cd","5bcfe086","e4818f68","4f11fb39","a13c6ae3","150c7fbb","98f3d658","f84f7377","1924dd9c","1f6b63b3","24748755","7c0f717c","8a87f11b","49f57f22","3c9e9234","3772f65b","dff631b6","cd609d40","f853c7f7","952db5ee","c5aa8a79","2d21b6fd","79b7164c","4110e26c","a7d3b43f","84e1b8f6","75cc0998","07f78e33","10ca9b1a","ce441b18","01eb8256","c0ac4b67","8e8e5216","db7943dd","fa133a95","498a4508","21bbda67","7dbfed69","be3ec24c","fc80b8e2"]);class qwt{constructor(e){this.ge=!1,this._e=!1,this.me=!1,this.be=!1,this.ye=!1,this.we=!1,this.Se=!1,this._instance=e,this.featureFlagEventHandlers=[]}flags(){if(this._instance.config.__preview_remote_config)this.we=!0;else{var e=!this.$e&&(this._instance.config.advanced_disable_feature_flags||this._instance.config.advanced_disable_feature_flags_on_first_load);this.ke({disableFlags:e})}}get hasLoadedFlags(){return this._e}getFlags(){return Object.keys(this.getFlagVariants())}getFlagsWithDetails(){var e=this._instance.get_property(C$),t=this._instance.get_property(S5),n=this._instance.get_property(q4);if(!n&&!t)return e||{};var r=EE({},e||{}),a=[...new Set([...Object.keys(n||{}),...Object.keys(t||{})])];for(var o of a){var s,l,u=r[o],d=t==null?void 0:t[o],f=ed(d)?(s=u==null?void 0:u.enabled)!==null&&s!==void 0&&s:!!d,p=ed(d)?u.variant:typeof d=="string"?d:void 0,m=n==null?void 0:n[o],y=Wd({},u,{enabled:f,variant:f?p??(u==null?void 0:u.variant):void 0});f!==(u==null?void 0:u.enabled)&&(y.original_enabled=u==null?void 0:u.enabled),p!==(u==null?void 0:u.variant)&&(y.original_variant=u==null?void 0:u.variant),m&&(y.metadata=Wd({},u==null?void 0:u.metadata,{payload:m,original_payload:u==null||(l=u.metadata)==null?void 0:l.payload})),r[o]=y}return this.ge||(Bw.warn(" Overriding feature flag details!",{flagDetails:e,overriddenPayloads:n,finalDetails:r}),this.ge=!0),r}getFlagVariants(){var e=this._instance.get_property(m5),t=this._instance.get_property(S5);if(!t)return e||{};for(var n=EE({},e),r=Object.keys(t),a=0;a<r.length;a++)n[r[a]]=t[r[a]];return this.ge||(Bw.warn(" Overriding feature flags!",{enabledFlags:e,overriddenFlags:t,finalFlags:n}),this.ge=!0),n}getFlagPayloads(){var e=this._instance.get_property(IQe),t=this._instance.get_property(q4);if(!t)return e||{};for(var n=EE({},e||{}),r=Object.keys(t),a=0;a<r.length;a++)n[r[a]]=t[r[a]];return this.ge||(Bw.warn(" Overriding feature flag payloads!",{flagPayloads:e,overriddenPayloads:t,finalPayloads:n}),this.ge=!0),n}reloadFeatureFlags(){this.be||this._instance.config.advanced_disable_feature_flags||this.$e||(this.$e=setTimeout(()=>{this.ke()},5))}xe(){clearTimeout(this.$e),this.$e=void 0}ensureFlagsLoaded(){this._e||this.me||this.$e||this.reloadFeatureFlags()}setAnonymousDistinctId(e){this.$anon_distinct_id=e}setReloadingPaused(e){this.be=e}ke(e){var t;if(this.xe(),!this._instance.I())if(this.me)this.ye=!0;else{var n={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:Wd({},((t=this._instance.persistence)==null?void 0:t.get_initial_props())||{},this._instance.get_property(P4)||{}),group_properties:this._instance.get_property(B3)};(e!=null&&e.disableFlags||this._instance.config.advanced_disable_feature_flags)&&(n.disable_flags=!0);var r=this._instance.config.__preview_flags_v2&&this._instance.config.__preview_remote_config,a=function(l){var u=function(d){for(var f=2166136261,p=0;p<d.length;p++)f^=d.charCodeAt(p),f+=(f<<1)+(f<<4)+(f<<7)+(f<<8)+(f<<24);return("00000000"+(f>>>0).toString(16)).slice(-8)}(l);return bQe==null?void 0:bQe.has(u)}(this._instance.config.token)?"/decide?v=4":r?"/flags/?v=2":"/flags/?v=2&config=true",o=this._instance.config.advanced_only_evaluate_survey_feature_flags?"&only_evaluate_survey_feature_flags=true":"",s=this._instance.requestRouter.endpointFor("api",a+o);r&&(n.timezone=CQe()),this.me=!0,this._instance.Ee({method:"POST",url:s,data:n,compression:this._instance.config.disable_compression?void 0:NQ.Base64,timeout:this._instance.config.feature_flag_request_timeout_ms,callback:l=>{var u,d,f=!0;if(l.statusCode===200&&(this.ye||(this.$anon_distinct_id=void 0),f=!1),this.me=!1,this.we||(this.we=!0,this._instance.Ie((d=l.json)!==null&&d!==void 0?d:{})),!n.disable_flags||this.ye)if(this.Se=!f,l.json&&(u=l.json.quotaLimited)!=null&&u.includes(Jwt.FeatureFlags))Bw.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 p;n.disable_flags||this.receivedFeatureFlags((p=l.json)!==null&&p!==void 0?p:{},f),this.ye&&(this.ye=!1,this.ke())}}})}}getFeatureFlag(e,t){if(t===void 0&&(t={}),this._e||this.getFlags()&&this.getFlags().length>0){var n=this.getFlagVariants()[e],r=""+n,a=this._instance.get_property(_Qe)||void 0,o=this._instance.get_property(SG)||{};if((t.send_event||!("send_event"in t))&&(!(e in o)||!o[e].includes(r))){var s,l,u,d,f,p,m,y,x;o_(o[e])?o[e].push(r):o[e]=[r],(s=this._instance.persistence)==null||s.register({[SG]:o});var E=this.getFeatureFlagDetails(e),b={$feature_flag:e,$feature_flag_response:n,$feature_flag_payload:this.getFeatureFlagPayload(e)||null,$feature_flag_request_id:a,$feature_flag_bootstrapped_response:((l=this._instance.config.bootstrap)==null||(l=l.featureFlags)==null?void 0:l[e])||null,$feature_flag_bootstrapped_payload:((u=this._instance.config.bootstrap)==null||(u=u.featureFlagPayloads)==null?void 0:u[e])||null,$used_bootstrap_value:!this.Se};ed(E==null||(d=E.metadata)==null?void 0:d.version)||(b.$feature_flag_version=E.metadata.version);var Q,M=(f=E==null||(p=E.reason)==null?void 0:p.description)!==null&&f!==void 0?f:E==null||(m=E.reason)==null?void 0:m.code;M&&(b.$feature_flag_reason=M),E!=null&&(y=E.metadata)!=null&&y.id&&(b.$feature_flag_id=E.metadata.id),ed(E==null?void 0:E.original_variant)&&ed(E==null?void 0:E.original_enabled)||(b.$feature_flag_original_response=ed(E.original_variant)?E.original_enabled:E.original_variant),E!=null&&(x=E.metadata)!=null&&x.original_payload&&(b.$feature_flag_original_payload=E==null||(Q=E.metadata)==null?void 0:Q.original_payload),this._instance.capture("$feature_flag_called",b)}return n}Bw.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 n=this._instance.config.token;this._instance.Ee({method:"POST",url:this._instance.requestRouter.endpointFor("api","/flags/?v=2&config=true"),data:{distinct_id:this._instance.get_distinct_id(),token:n},compression:this._instance.config.disable_compression?void 0:NQ.Base64,timeout:this._instance.config.feature_flag_request_timeout_ms,callback:r=>{var a,o=(a=r.json)==null?void 0:a.featureFlagPayloads;t((o==null?void 0:o[e])||void 0)}})}isFeatureEnabled(e,t){if(t===void 0&&(t={}),this._e||this.getFlags()&&this.getFlags().length>0)return!!this.getFeatureFlag(e,t);Bw.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._e=!0;var n=this.getFlagVariants(),r=this.getFlagPayloads(),a=this.getFlagsWithDetails();(function(o,s,l,u,d){l===void 0&&(l={}),u===void 0&&(u={}),d===void 0&&(d={});var f=jwt(o),p=f.flags,m=f.featureFlags,y=f.featureFlagPayloads;if(m){var x=o.requestId;if(o_(m)){Bw.warn("v1 of the feature flags endpoint is deprecated. Please use the latest version.");var E={};if(m)for(var b=0;b<m.length;b++)E[m[b]]=!0;s&&s.register({[lee]:m,[m5]:E})}else{var Q=m,M=y,L=p;o.errorsWhileComputingFlags&&(Q=Wd({},l,Q),M=Wd({},u,M),L=Wd({},d,L)),s&&s.register(Wd({[lee]:Object.keys(EQe(Q)),[m5]:Q||{},[IQe]:M||{},[C$]:L||{}},x?{[_Qe]:x}:{}))}}})(e,this._instance.persistence,n,r,a),this.Pe(t)}}override(e,t){t===void 0&&(t=!1),Bw.warn("override is deprecated. Please use overrideFeatureFlags instead."),this.overrideFeatureFlags({flags:e,suppressWarning:t})}overrideFeatureFlags(e){if(!this._instance.__loaded||!this._instance.persistence)return Bw.uninitializedWarning("posthog.featureFlags.overrideFeatureFlags");if(e===!1)return this._instance.persistence.unregister(S5),this._instance.persistence.unregister(q4),void this.Pe();if(e&&typeof e=="object"&&("flags"in e||"payloads"in e)){var t,n=e;if(this.ge=!!((t=n.suppressWarning)!==null&&t!==void 0&&t),"flags"in n){if(n.flags===!1)this._instance.persistence.unregister(S5);else if(n.flags)if(o_(n.flags)){for(var r={},a=0;a<n.flags.length;a++)r[n.flags[a]]=!0;this._instance.persistence.register({[S5]:r})}else this._instance.persistence.register({[S5]:n.flags})}return"payloads"in n&&(n.payloads===!1?this._instance.persistence.unregister(q4):n.payloads&&this._instance.persistence.register({[q4]:n.payloads})),void this.Pe()}this.Pe()}onFeatureFlags(e){if(this.addFeatureFlagsHandler(e),this._e){var{flags:t,flagVariants:n}=this.Re();e(t,n)}return()=>this.removeFeatureFlagsHandler(e)}updateEarlyAccessFeatureEnrollment(e,t){var n,r=(this._instance.get_property(xG)||[]).find(l=>l.flagKey===e),a={["$feature_enrollment/"+e]:t},o={$feature_flag:e,$feature_enrollment:t,$set:a};r&&(o.$early_access_feature_name=r.name),this._instance.capture("$feature_enrollment_update",o),this.setPersonPropertiesForFlags(a,!1);var s=Wd({},this.getFlagVariants(),{[e]:t});(n=this._instance.persistence)==null||n.register({[lee]:Object.keys(EQe(s)),[m5]:s}),this.Pe()}getEarlyAccessFeatures(e,t,n){t===void 0&&(t=!1);var r=this._instance.get_property(xG),a=n?"&"+n.map(o=>"stage="+o).join("&"):"";if(r&&!t)return e(r);this._instance.Ee({url:this._instance.requestRouter.endpointFor("api","/api/early_access_features/?token="+this._instance.config.token+a),method:"GET",callback:o=>{var s;if(o.json){var l=o.json.earlyAccessFeatures;return(s=this._instance.persistence)==null||s.register({[xG]:l}),e(l)}}})}Re(){var e=this.getFlags(),t=this.getFlagVariants();return{flags:e.filter(n=>t[n]),flagVariants:Object.keys(t).filter(n=>t[n]).reduce((n,r)=>(n[r]=t[r],n),{})}}Pe(e){var{flags:t,flagVariants:n}=this.Re();this.featureFlagEventHandlers.forEach(r=>r(t,n,{errorsLoading:e}))}setPersonPropertiesForFlags(e,t){t===void 0&&(t=!0);var n=this._instance.get_property(P4)||{};this._instance.register({[P4]:Wd({},n,e)}),t&&this._instance.reloadFeatureFlags()}resetPersonPropertiesForFlags(){this._instance.unregister(P4)}setGroupPropertiesForFlags(e,t){t===void 0&&(t=!0);var n=this._instance.get_property(B3)||{};Object.keys(n).length!==0&&Object.keys(n).forEach(r=>{n[r]=Wd({},n[r],e[r]),delete e[r]}),this._instance.register({[B3]:Wd({},n,e)}),t&&this._instance.reloadFeatureFlags()}resetGroupPropertiesForFlags(e){if(e){var t=this._instance.get_property(B3)||{};this._instance.register({[B3]:Wd({},t,{[e]:{}})})}else this._instance.unregister(B3)}}var Zwt=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"];class cee{constructor(e){this.S=e,this.props={},this.Te=!1,this.Me=(t=>{var n="";return t.token&&(n=t.token.replace(/\+/g,"PL").replace(/\//g,"SL").replace(/=/g,"EQ")),t.persistence_name?"ph_"+t.persistence_name:"ph_"+n+"_posthog"})(e),this.B=this.Ce(e),this.load(),e.debug&&Pf.info("Persistence loaded",e.persistence,Wd({},this.props)),this.update_config(e,e),this.save()}Ce(e){Zwt.indexOf(e.persistence.toLowerCase())===-1&&(Pf.critical("Unknown persistence type "+e.persistence+"; falling back to localStorage+cookie"),e.persistence="localStorage+cookie");var t=e.persistence.toLowerCase();return t==="localstorage"&&KE.O()?KE:t==="localstorage+cookie"&&LG.O()?LG:t==="sessionstorage"&&Rb.O()?Rb:t==="memory"?QSt:t==="cookie"?UQ:LG.O()?LG:UQ}properties(){var e={};return t1(this.props,function(t,n){if(n===m5&&k_(t))for(var r=Object.keys(t),a=0;a<r.length;a++)e["$feature/"+r[a]]=t[r[a]];else s=n,l=!1,(lM(o=cSt)?l:bSe&&o.indexOf===bSe?o.indexOf(s)!=-1:(t1(o,function(u){if(l||(l=u===s))return IG}),l))||(e[n]=t);var o,s,l}),e}load(){if(!this.Fe){var e=this.B.L(this.Me);e&&(this.props=EE({},e))}}save(){this.Fe||this.B.j(this.Me,this.props,this.Oe,this.Ae,this.De,this.S.debug)}remove(){this.B.N(this.Me,!1),this.B.N(this.Me,!0)}clear(){this.remove(),this.props={}}register_once(e,t,n){if(k_(e)){ed(t)&&(t="None"),this.Oe=ed(n)?this.Le:n;var r=!1;if(t1(e,(a,o)=>{this.props.hasOwnProperty(o)&&this.props[o]!==t||(this.props[o]=a,r=!0)}),r)return this.save(),!0}return!1}register(e,t){if(k_(e)){this.Oe=ed(t)?this.Le:t;var n=!1;if(t1(e,(r,a)=>{e.hasOwnProperty(a)&&this.props[a]!==r&&(this.props[a]=r,n=!0)}),n)return this.save(),!0}return!1}unregister(e){e in this.props&&(delete this.props[e],this.save())}update_campaign_params(){if(!this.Te){var e=fQe(this.S.custom_campaign_params,this.S.mask_personal_data_properties,this.S.custom_personal_data_properties);g5(h$(e))||this.register(e),this.Te=!0}}update_search_keyword(){var e;this.register((e=Af==null?void 0:Af.referrer)?pQe(e):{})}update_referrer_info(){var e;this.register_once({$referrer:mQe(),$referring_domain:Af!=null&&Af.referrer&&((e=v5(Af.referrer))==null?void 0:e.host)||"$direct"},void 0)}set_initial_person_info(){this.props[b$]||this.props[x$]||this.register_once({[wG]:yQe(this.S.mask_personal_data_properties,this.S.custom_personal_data_properties)},void 0)}get_initial_props(){var e={};t1([x$,b$],o=>{var s=this.props[o];s&&t1(s,function(l,u){e["$initial_"+d$(u)]=l})});var t,n,r=this.props[wG];if(r){var a=(t=vQe(r),n={},t1(t,function(o,s){n["$initial_"+d$(s)]=o}),n);EE(e,a)}return e}safe_merge(e){return t1(this.props,function(t,n){n in e||(e[n]=t)}),e}update_config(e,t){if(this.Le=this.Oe=e.cookie_expiration,this.set_disabled(e.disable_persistence),this.set_cross_subdomain(e.cross_subdomain_cookie),this.set_secure(e.secure_cookie),e.persistence!==t.persistence){var n=this.Ce(e),r=this.props;this.clear(),this.B=n,this.props=r,this.save()}}set_disabled(e){this.Fe=e,this.Fe?this.remove():this.save()}set_cross_subdomain(e){e!==this.Ae&&(this.Ae=e,this.remove(),this.save())}set_secure(e){e!==this.De&&(this.De=e,this.remove(),this.save())}set_event_timer(e,t){var n=this.props[T4]||{};n[e]=t,this.props[T4]=n,this.save()}remove_event_timer(e){var t=(this.props[T4]||{})[e];return ed(t)||(delete this.props[T4][e],this.save()),t}get_property(e){return this.props[e]}set_property(e,t){this.props[e]=t,this.save()}}class xQe{constructor(){this.je={},this.je={}}on(e,t){return this.je[e]||(this.je[e]=[]),this.je[e].push(t),()=>{this.je[e]=this.je[e].filter(n=>n!==t)}}emit(e,t){for(var n of this.je[e]||[])n(t);for(var r of this.je["*"]||[])r(e,t)}}class N3{constructor(e){this.Ne=new xQe,this.ze=(t,n)=>this.Ue(t,n)&&this.qe(t,n)&&this.Be(t,n),this.Ue=(t,n)=>n==null||!n.event||(t==null?void 0:t.event)===(n==null?void 0:n.event),this._instance=e,this.He=new Set,this.We=new Set}init(){var e;if(!ed((e=this._instance)==null?void 0:e.Ge)){var t;(t=this._instance)==null||t.Ge((n,r)=>{this.on(n,r)})}}register(e){var t,n;if(!ed((t=this._instance)==null?void 0:t.Ge)&&(e.forEach(o=>{var s,l;(s=this.We)==null||s.add(o),(l=o.steps)==null||l.forEach(u=>{var d;(d=this.He)==null||d.add((u==null?void 0:u.event)||"")})}),(n=this._instance)!=null&&n.autocapture)){var r,a=new Set;e.forEach(o=>{var s;(s=o.steps)==null||s.forEach(l=>{l!=null&&l.selector&&a.add(l==null?void 0:l.selector)})}),(r=this._instance)==null||r.autocapture.setElementSelectors(a)}}on(e,t){var n;t!=null&&e.length!=0&&(this.He.has(e)||this.He.has(t==null?void 0:t.event))&&this.We&&((n=this.We)==null?void 0:n.size)>0&&this.We.forEach(r=>{this.Je(t,r)&&this.Ne.emit("actionCaptured",r.name)})}Ve(e){this.onAction("actionCaptured",t=>e(t))}Je(e,t){if((t==null?void 0:t.steps)==null)return!1;for(var n of t.steps)if(this.ze(e,n))return!0;return!1}onAction(e,t){return this.Ne.on(e,t)}qe(e,t){if(t!=null&&t.url){var n,r=e==null||(n=e.properties)==null?void 0:n.$current_url;if(!r||typeof r!="string"||!N3.Ke(r,t==null?void 0:t.url,(t==null?void 0:t.url_matching)||"contains"))return!1}return!0}static Ke(e,t,n){switch(n){case"regex":return!!Qo&&E5(e,t);case"exact":return t===e;case"contains":var r=N3.Ye(t).replace(/_/g,".").replace(/%/g,".*");return E5(e,r);default:return!1}}static Ye(e){return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}Be(e,t){if((t!=null&&t.href||t!=null&&t.tag_name||t!=null&&t.text)&&!this.Xe(e).some(a=>!(t!=null&&t.href&&!N3.Ke(a.href||"",t==null?void 0:t.href,(t==null?void 0:t.href_matching)||"exact"))&&(t==null||!t.tag_name||a.tag_name===(t==null?void 0:t.tag_name))&&!(t!=null&&t.text&&!N3.Ke(a.text||"",t==null?void 0:t.text,(t==null?void 0:t.text_matching)||"exact")&&!N3.Ke(a.$el_text||"",t==null?void 0:t.text,(t==null?void 0:t.text_matching)||"exact"))))return!1;if(t!=null&&t.selector){var n,r=e==null||(n=e.properties)==null?void 0:n.$element_selectors;if(!r||!r.includes(t==null?void 0:t.selector))return!1}return!0}Xe(e){return(e==null?void 0:e.properties.$elements)==null?[]:e==null?void 0:e.properties.$elements}}var jE=Mb("[Surveys]"),uee="seenSurvey_",Xwt=(i,e)=>{var t="$survey_"+e+"/"+i.id;return i.current_iteration&&i.current_iteration>0&&(t="$survey_"+e+"/"+i.id+"/"+i.current_iteration),t};class Wwt{constructor(e){this._instance=e,this.Qe=new Map,this.Ze=new Map}register(e){var t;ed((t=this._instance)==null?void 0:t.Ge)||(this.tr(e),this.ir(e))}ir(e){var t=e.filter(n=>{var r,a;return((r=n.conditions)==null?void 0:r.actions)&&((a=n.conditions)==null||(a=a.actions)==null||(a=a.values)==null?void 0:a.length)>0});t.length!==0&&(this.er==null&&(this.er=new N3(this._instance),this.er.init(),this.er.Ve(n=>{this.onAction(n)})),t.forEach(n=>{var r,a,o,s,l;n.conditions&&(r=n.conditions)!=null&&r.actions&&(a=n.conditions)!=null&&(a=a.actions)!=null&&a.values&&((o=n.conditions)==null||(o=o.actions)==null||(o=o.values)==null?void 0:o.length)>0&&((s=this.er)==null||s.register(n.conditions.actions.values),(l=n.conditions)==null||(l=l.actions)==null||(l=l.values)==null||l.forEach(u=>{if(u&&u.name){var d=this.Ze.get(u.name);d&&d.push(n.id),this.Ze.set(u.name,d||[n.id])}}))}))}tr(e){var t;e.filter(n=>{var r,a;return((r=n.conditions)==null?void 0:r.events)&&((a=n.conditions)==null||(a=a.events)==null||(a=a.values)==null?void 0:a.length)>0}).length!==0&&((t=this._instance)==null||t.Ge((n,r)=>{this.onEvent(n,r)}),e.forEach(n=>{var r;(r=n.conditions)==null||(r=r.events)==null||(r=r.values)==null||r.forEach(a=>{if(a&&a.name){var o=this.Qe.get(a.name);o&&o.push(n.id),this.Qe.set(a.name,o||[n.id])}})}))}onEvent(e,t){var n,r=((n=this._instance)==null||(n=n.persistence)==null?void 0:n.props[BG])||[];if(e==="survey shown"&&t&&r.length>0){var a;jE.info("survey event matched, removing survey from activated surveys",{event:e,eventPayload:t,existingActivatedSurveys:r});var o=t==null||(a=t.properties)==null?void 0:a.$survey_id;if(o){var s=r.indexOf(o);s>=0&&(r.splice(s,1),this.rr(r))}}else this.Qe.has(e)&&(jE.info("survey event matched, updating activated surveys",{event:e,surveys:this.Qe.get(e)}),this.rr(r.concat(this.Qe.get(e)||[])))}onAction(e){var t,n=((t=this._instance)==null||(t=t.persistence)==null?void 0:t.props[BG])||[];this.Ze.has(e)&&this.rr(n.concat(this.Ze.get(e)||[]))}rr(e){var t;(t=this._instance)==null||(t=t.persistence)==null||t.register({[BG]:[...new Set(e)]})}getSurveys(){var e,t=(e=this._instance)==null||(e=e.persistence)==null?void 0:e.props[BG];return t||[]}getEventToSurveys(){return this.Qe}sr(){return this.er}}class $wt{constructor(e){this.nr=null,this.ar=!1,this.lr=!1,this.ur=[],this._instance=e,this._surveyEventReceiver=null}onRemoteConfig(e){var t=e.surveys;if(BC(t))return jE.warn("Flags not loaded yet. Not loading surveys.");var n=o_(t);this.hr=n?t.length>0:t,jE.info("flags response received, hasSurveys: "+this.hr),this.hr&&this.loadIfEnabled()}reset(){localStorage.removeItem("lastSeenSurveyDate");for(var e=[],t=0;t<localStorage.length;t++){var n=localStorage.key(t);(n!=null&&n.startsWith(uee)||n!=null&&n.startsWith("inProgressSurvey_"))&&e.push(n)}e.forEach(r=>localStorage.removeItem(r))}loadIfEnabled(){if(!this.nr)if(this.lr)jE.info("Already initializing surveys, skipping...");else if(this._instance.config.disable_surveys)jE.info("Disabled. Not loading surveys.");else if(this.hr){var e=k0==null?void 0:k0.__PosthogExtensions__;if(e){this.lr=!0;try{var t=e.generateSurveys;if(t)return void this.dr(t);var n=e.loadExternalDependency;if(!n)return void this.vr("PostHog loadExternalDependency extension not found.");n(this._instance,"surveys",r=>{r||!e.generateSurveys?this.vr("Could not load surveys script",r):this.dr(e.generateSurveys)})}catch(r){throw this.vr("Error initializing surveys",r),r}finally{this.lr=!1}}else jE.error("PostHog Extensions not found.")}else jE.info("No surveys to load.")}dr(e){this.nr=e(this._instance),this._surveyEventReceiver=new Wwt(this._instance),jE.info("Surveys loaded successfully"),this.cr({isLoaded:!0})}vr(e,t){jE.error(e,t),this.cr({isLoaded:!1,error:e})}onSurveysLoaded(e){return this.ur.push(e),this.nr&&this.cr({isLoaded:!0}),()=>{this.ur=this.ur.filter(t=>t!==e)}}getSurveys(e,t){if(t===void 0&&(t=!1),this._instance.config.disable_surveys)return jE.info("Disabled. Not loading surveys."),e([]);var n=this._instance.get_property(I$);if(n&&!t)return e(n,{isLoaded:!0});if(this.ar)return e([],{isLoaded:!1,error:"Surveys are already being loaded"});try{this.ar=!0,this._instance.Ee({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 a;this.ar=!1;var o=r.statusCode;if(o!==200||!r.json){var s="Surveys API could not be loaded, status: "+o;return jE.error(s),e([],{isLoaded:!1,error:s})}var l,u=r.json.surveys||[],d=u.filter(f=>function(p){return!(!p.start_date||p.end_date)}(f)&&(function(p){var m;return!((m=p.conditions)==null||(m=m.events)==null||(m=m.values)==null||!m.length)}(f)||function(p){var m;return!((m=p.conditions)==null||(m=m.actions)==null||(m=m.values)==null||!m.length)}(f)));return d.length>0&&((l=this._surveyEventReceiver)==null||l.register(d)),(a=this._instance.persistence)==null||a.register({[I$]:u}),e(u,{isLoaded:!0})}})}catch(r){throw this.ar=!1,r}}cr(e){for(var t of this.ur)try{e.isLoaded?this.getSurveys(t):t([],e)}catch(n){jE.error("Error in survey callback",n)}}getActiveMatchingSurveys(e,t){if(t===void 0&&(t=!1),!BC(this.nr))return this.nr.getActiveMatchingSurveys(e,t);jE.warn("init was not called")}pr(e){var t=null;return this.getSurveys(n=>{var r;t=(r=n.find(a=>a.id===e))!==null&&r!==void 0?r:null}),t}gr(e){if(BC(this.nr))return{eligible:!1,reason:"SDK is not enabled or survey functionality is not yet loaded"};var t=typeof e=="string"?this.pr(e):e;return t?this.nr.checkSurveyEligibility(t):{eligible:!1,reason:"Survey not found"}}canRenderSurvey(e){if(BC(this.nr))return jE.warn("init was not called"),{visible:!1,disabledReason:"SDK is not enabled or survey functionality is not yet loaded"};var t=this.gr(e);return{visible:t.eligible,disabledReason:t.reason}}canRenderSurveyAsync(e,t){return BC(this.nr)?(jE.warn("init was not called"),Promise.resolve({visible:!1,disabledReason:"SDK is not enabled or survey functionality is not yet loaded"})):new Promise(n=>{this.getSurveys(r=>{var a,o=(a=r.find(l=>l.id===e))!==null&&a!==void 0?a:null;if(o){var s=this.gr(o);n({visible:s.eligible,disabledReason:s.reason})}else n({visible:!1,disabledReason:"Survey not found"})},t)})}renderSurvey(e,t){if(BC(this.nr))jE.warn("init was not called");else{var n=this.pr(e),r=Af==null?void 0:Af.querySelector(t);n?r?this.nr.renderSurvey(n,r):jE.warn("Survey element not found"):jE.warn("Survey not found")}}}(function(i){return i.Button="button",i.Tab="tab",i.Selector="selector",i})({}),function(i){return i.TopLeft="top_left",i.TopRight="top_right",i.TopCenter="top_center",i.MiddleLeft="middle_left",i.MiddleRight="middle_right",i.MiddleCenter="middle_center",i.Left="left",i.Center="center",i.Right="right",i.NextToTrigger="next_to_trigger",i}({}),function(i){return i.Popover="popover",i.API="api",i.Widget="widget",i}({}),function(i){return i.Open="open",i.MultipleChoice="multiple_choice",i.SingleChoice="single_choice",i.Rating="rating",i.Link="link",i}({}),function(i){return i.NextQuestion="next_question",i.End="end",i.ResponseBased="response_based",i.SpecificQuestion="specific_question",i}({}),function(i){return i.Once="once",i.Recurring="recurring",i.Always="always",i}({});var Aee=function(i){return i.SHOWN="survey shown",i.DISMISSED="survey dismissed",i.SENT="survey sent",i}({}),BQe=function(i){return i.SURVEY_ID="$survey_id",i.SURVEY_NAME="$survey_name",i.SURVEY_RESPONSE="$survey_response",i.SURVEY_ITERATION="$survey_iteration",i.SURVEY_ITERATION_START_DATE="$survey_iteration_start_date",i.SURVEY_PARTIALLY_COMPLETED="$survey_partially_completed",i.SURVEY_SUBMISSION_ID="$survey_submission_id",i.SURVEY_QUESTIONS="$survey_questions",i.SURVEY_COMPLETED="$survey_completed",i}({}),SQe=Mb("[RateLimiter]");class eQt{constructor(e){var t,n;this.serverLimits={},this.lastEventRateLimited=!1,this.checkForLimiting=r=>{var a=r.text;if(a&&a.length)try{(JSON.parse(a).quota_limited||[]).forEach(o=>{SQe.info((o||"events")+" is quota limited."),this.serverLimits[o]=new Date().getTime()+6e4})}catch(o){return void SQe.warn('could not rate limit - continuing. Error: "'+(o==null?void 0:o.message)+'"',{text:a})}},this.instance=e,this.captureEventsPerSecond=((t=e.config.rate_limiting)==null?void 0:t.events_per_second)||10,this.captureEventsBurstLimit=Math.max(((n=e.config.rate_limiting)==null?void 0:n.events_burst_limit)||10*this.captureEventsPerSecond,this.captureEventsPerSecond),this.lastEventRateLimited=this.clientRateLimitContext(!0).isRateLimited}clientRateLimitContext(e){var t,n,r;e===void 0&&(e=!1);var a=new Date().getTime(),o=(t=(n=this.instance.persistence)==null?void 0:n.get_property(E$))!==null&&t!==void 0?t:{tokens:this.captureEventsBurstLimit,last:a};o.tokens+=(a-o.last)/1e3*this.captureEventsPerSecond,o.last=a,o.tokens>this.captureEventsBurstLimit&&(o.tokens=this.captureEventsBurstLimit);var s=o.tokens<1;return s||e||(o.tokens=Math.max(0,o.tokens-1)),!s||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=s,(r=this.instance.persistence)==null||r.set_property(E$,o),{isRateLimited:s,remainingTokens:o.tokens}}isServerRateLimited(e){var t=this.serverLimits[e||"events"]||!1;return t!==!1&&new Date().getTime()<t}}var T3=Mb("[RemoteConfig]");class tQt{constructor(e){this._instance=e}get remoteConfig(){var e;return(e=k0._POSTHOG_REMOTE_CONFIG)==null||(e=e[this._instance.config.token])==null?void 0:e.config}_r(e){var t,n;(t=k0.__PosthogExtensions__)!=null&&t.loadExternalDependency?(n=k0.__PosthogExtensions__)==null||n.loadExternalDependency==null||n.loadExternalDependency(this._instance,"remote-config",()=>e(this.remoteConfig)):(T3.error("PostHog Extensions not found. Cannot load remote config."),e())}mr(e){this._instance.Ee({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 T3.info("Using preloaded remote config",this.remoteConfig),void this.Ie(this.remoteConfig);if(this._instance.I())return void T3.warn("Remote config is disabled. Falling back to local config.");this._r(e=>{if(!e)return T3.info("No config found after loading remote JS config. Falling back to JSON."),void this.mr(t=>{this.Ie(t)});this.Ie(e)})}catch(e){T3.error("Error loading remote config",e)}}Ie(e){e?this._instance.config.__preview_remote_config?(this._instance.Ie(e),e.hasFeatureFlags!==!1&&this._instance.featureFlags.ensureFlagsLoaded()):T3.info("__preview_remote_config is disabled. Logging config instead",e):T3.error("Failed to fetch remote config from PostHog.")}}var dee=3e3;class nQt{constructor(e,t){this.br=!0,this.yr=[],this.wr=wB((t==null?void 0:t.flush_interval_ms)||dee,250,5e3,"flush interval",dee),this.Sr=e}enqueue(e){this.yr.push(e),this.$r||this.kr()}unload(){this.Er();var e=this.yr.length>0?this.Ir():{},t=Object.values(e);[...t.filter(n=>n.url.indexOf("/e")===0),...t.filter(n=>n.url.indexOf("/e")!==0)].map(n=>{this.Sr(Wd({},n,{transport:"sendBeacon"}))})}enable(){this.br=!1,this.kr()}kr(){var e=this;this.br||(this.$r=setTimeout(()=>{if(this.Er(),this.yr.length>0){var t=this.Ir(),n=function(){var a=t[r],o=new Date().getTime();a.data&&o_(a.data)&&t1(a.data,s=>{s.offset=Math.abs(s.timestamp-o),delete s.timestamp}),e.Sr(a)};for(var r in t)n()}},this.wr))}Er(){clearTimeout(this.$r),this.$r=void 0}Ir(){var e={};return t1(this.yr,t=>{var n,r=t,a=(r?r.batchKey:null)||r.url;ed(e[a])&&(e[a]=Wd({},r,{data:[]})),(n=e[a].data)==null||n.push(r.data)}),this.yr=[],e}}var iQt=["retriesPerformedSoFar"];class rQt{constructor(e){this.Pr=!1,this.Rr=3e3,this.yr=[],this._instance=e,this.yr=[],this.Tr=!0,!ed(Qo)&&"onLine"in Qo.navigator&&(this.Tr=Qo.navigator.onLine,v_(Qo,"online",()=>{this.Tr=!0,this.se()}),v_(Qo,"offline",()=>{this.Tr=!1}))}get length(){return this.yr.length}retriableRequest(e){var{retriesPerformedSoFar:t}=e,n=MSe(e,iQt);ox(t)&&t>0&&(n.url=JG(n.url,{retry_count:t})),this._instance.Ee(Wd({},n,{callback:r=>{r.statusCode!==200&&(r.statusCode<400||r.statusCode>=500)&&(t??0)<10?this.Mr(Wd({retriesPerformedSoFar:t},n)):n.callback==null||n.callback(r)}}))}Mr(e){var t=e.retriesPerformedSoFar||0;e.retriesPerformedSoFar=t+1;var n=function(o){var s=3e3*Math.pow(2,o),l=s/2,u=Math.min(18e5,s),d=(Math.random()-.5)*(u-l);return Math.ceil(u+d)}(t),r=Date.now()+n;this.yr.push({retryAt:r,requestOptions:e});var a="Enqueued failed request for retry in "+n;navigator.onLine||(a+=" (Browser is offline)"),Pf.warn(a),this.Pr||(this.Pr=!0,this.Cr())}Cr(){this.Fr&&clearTimeout(this.Fr),this.Fr=setTimeout(()=>{this.Tr&&this.yr.length>0&&this.se(),this.Cr()},this.Rr)}se(){var e=Date.now(),t=[],n=this.yr.filter(a=>a.retryAt<e||(t.push(a),!1));if(this.yr=t,n.length>0)for(var{requestOptions:r}of n)this.retriableRequest(r)}unload(){for(var{requestOptions:e}of(this.Fr&&(clearTimeout(this.Fr),this.Fr=void 0),this.yr))try{this._instance.Ee(Wd({},e,{transport:"sendBeacon"}))}catch(t){Pf.error(t)}this.yr=[]}}class aQt{constructor(e){this.Or=()=>{var t,n,r,a;this.Ar||(this.Ar={});var o=this.scrollElement(),s=this.scrollY(),l=o?Math.max(0,o.scrollHeight-o.clientHeight):0,u=s+((o==null?void 0:o.clientHeight)||0),d=(o==null?void 0:o.scrollHeight)||0;this.Ar.lastScrollY=Math.ceil(s),this.Ar.maxScrollY=Math.max(s,(t=this.Ar.maxScrollY)!==null&&t!==void 0?t:0),this.Ar.maxScrollHeight=Math.max(l,(n=this.Ar.maxScrollHeight)!==null&&n!==void 0?n:0),this.Ar.lastContentY=u,this.Ar.maxContentY=Math.max(u,(r=this.Ar.maxContentY)!==null&&r!==void 0?r:0),this.Ar.maxContentHeight=Math.max(d,(a=this.Ar.maxContentHeight)!==null&&a!==void 0?a:0)},this._instance=e}getContext(){return this.Ar}resetContext(){var e=this.Ar;return setTimeout(this.Or,0),e}startMeasuringScrollPosition(){v_(Qo,"scroll",this.Or,{capture:!0}),v_(Qo,"scrollend",this.Or,{capture:!0}),v_(Qo,"resize",this.Or)}scrollElement(){if(!this._instance.config.scroll_root_selector)return Qo==null?void 0:Qo.document.documentElement;var e=o_(this._instance.config.scroll_root_selector)?this._instance.config.scroll_root_selector:[this._instance.config.scroll_root_selector];for(var t of e){var n=Qo==null?void 0:Qo.document.querySelector(t);if(n)return n}}scrollY(){if(this._instance.config.scroll_root_selector){var e=this.scrollElement();return e&&e.scrollTop||0}return Qo&&(Qo.scrollY||Qo.pageYOffset||Qo.document.documentElement.scrollTop)||0}scrollX(){if(this._instance.config.scroll_root_selector){var e=this.scrollElement();return e&&e.scrollLeft||0}return Qo&&(Qo.scrollX||Qo.pageXOffset||Qo.document.documentElement.scrollLeft)||0}}var oQt=i=>yQe(i==null?void 0:i.config.mask_personal_data_properties,i==null?void 0:i.config.custom_personal_data_properties);class sQt{constructor(e,t,n,r){this.Dr=a=>{var o=this.Lr();if(!o||o.sessionId!==a){var s={sessionId:a,props:this.jr(this._instance)};this.Nr.register({[_$]:s})}},this._instance=e,this.zr=t,this.Nr=n,this.jr=r||oQt,this.zr.onSessionId(this.Dr)}Lr(){return this.Nr.props[_$]}getSetOnceProps(){var e,t=(e=this.Lr())==null?void 0:e.props;return t?"r"in t?vQe(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 t1(h$(this.getSetOnceProps()),(t,n)=>{n==="$current_url"&&(n="url"),e["$session_entry_"+d$(n)]=t}),e}}var wQe=Mb("[SessionId]");class lQt{constructor(e,t,n){var r;if(this.Ur=[],!e.persistence)throw new Error("SessionIdManager requires a PostHogPersistence instance");if(e.config.__preview_experimental_cookieless_mode)throw new Error("SessionIdManager cannot be used with __preview_experimental_cookieless_mode");this.S=e.config,this.Nr=e.persistence,this.fi=void 0,this.Ct=void 0,this._sessionStartTimestamp=null,this._sessionActivityTimestamp=null,this.qr=t||AM,this.Br=n||AM;var a=this.S.persistence_name||this.S.token,o=this.S.session_idle_timeout_seconds||1800;if(this._sessionTimeoutMs=1e3*wB(o,60,36e3,"session_idle_timeout_seconds",1800),e.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this.Hr(),this.Wr="ph_"+a+"_window_id",this.Gr="ph_"+a+"_primary_window_exists",this.Jr()){var s=Rb.L(this.Wr),l=Rb.L(this.Gr);s&&!l?this.fi=s:Rb.N(this.Wr),Rb.j(this.Gr,!0)}if((r=this.S.bootstrap)!=null&&r.sessionID)try{var u=(d=>{var f=d.replace(/-/g,"");if(f.length!==32)throw new Error("Not a valid UUID");if(f[12]!=="7")throw new Error("Not a UUIDv7");return parseInt(f.substring(0,12),16)})(this.S.bootstrap.sessionID);this.Vr(this.S.bootstrap.sessionID,new Date().getTime(),u)}catch(d){wQe.error("Invalid sessionID in bootstrap",d)}this.Kr()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(e){return ed(this.Ur)&&(this.Ur=[]),this.Ur.push(e),this.Ct&&e(this.Ct,this.fi),()=>{this.Ur=this.Ur.filter(t=>t!==e)}}Jr(){return this.S.persistence!=="memory"&&!this.Nr.Fe&&Rb.O()}Yr(e){e!==this.fi&&(this.fi=e,this.Jr()&&Rb.j(this.Wr,e))}Xr(){return this.fi?this.fi:this.Jr()?Rb.L(this.Wr):null}Vr(e,t,n){e===this.Ct&&t===this._sessionActivityTimestamp&&n===this._sessionStartTimestamp||(this._sessionStartTimestamp=n,this._sessionActivityTimestamp=t,this.Ct=e,this.Nr.register({[bG]:[t,e,n]}))}Qr(){if(this.Ct&&this._sessionActivityTimestamp&&this._sessionStartTimestamp)return[this._sessionActivityTimestamp,this.Ct,this._sessionStartTimestamp];var e=this.Nr.props[bG];return o_(e)&&e.length===2&&e.push(e[0]),e||[0,null,0]}resetSessionId(){this.Vr(null,null,null)}Kr(){v_(Qo,"beforeunload",()=>{this.Jr()&&Rb.N(this.Gr)},{capture:!1})}checkAndGetSessionAndWindowId(e,t){if(e===void 0&&(e=!1),t===void 0&&(t=null),this.S.__preview_experimental_cookieless_mode)throw new Error("checkAndGetSessionAndWindowId should not be called in __preview_experimental_cookieless_mode");var n=t||new Date().getTime(),[r,a,o]=this.Qr(),s=this.Xr(),l=ox(o)&&o>0&&Math.abs(n-o)>864e5,u=!1,d=!a,f=!e&&Math.abs(n-r)>this.sessionTimeoutMs;d||f||l?(a=this.qr(),s=this.Br(),wQe.info("new session ID generated",{sessionId:a,windowId:s,changeReason:{noSessionId:d,activityTimeout:f,sessionPastMaximumLength:l}}),o=n,u=!0):s||(s=this.Br(),u=!0);var p=r===0||!e||l?n:r,m=o===0?new Date().getTime():o;return this.Yr(s),this.Vr(a,p,m),e||this.Hr(),u&&this.Ur.forEach(y=>y(a,s,u?{noSessionId:d,activityTimeout:f,sessionPastMaximumLength:l}:void 0)),{sessionId:a,windowId:s,sessionStartTimestamp:m,changeReason:u?{noSessionId:d,activityTimeout:f,sessionPastMaximumLength:l}:void 0,lastActivityTimestamp:r}}Hr(){clearTimeout(this.Zr),this.Zr=setTimeout(()=>{this.resetSessionId()},1.1*this.sessionTimeoutMs)}}var cQt=["$set_once","$set"],pM=Mb("[SiteApps]");class uQt{constructor(e){this._instance=e,this.ts=[],this.apps={}}get isEnabled(){return!!this._instance.config.opt_in_site_apps}es(e,t){if(t){var n=this.globalsForEvent(t);this.ts.push(n),this.ts.length>1e3&&(this.ts=this.ts.slice(10))}}get siteAppLoaders(){var e;return(e=k0._POSTHOG_REMOTE_CONFIG)==null||(e=e[this._instance.config.token])==null?void 0:e.siteApps}init(){if(this.isEnabled){var e=this._instance.Ge(this.es.bind(this));this.rs=()=>{e(),this.ts=[],this.rs=void 0}}}globalsForEvent(e){var t,n,r,a,o,s,l;if(!e)throw new Error("Event payload is required");var u={},d=this._instance.get_property("$groups")||[],f=this._instance.get_property("$stored_group_properties")||{};for(var[p,m]of Object.entries(f))u[p]={id:d[p],type:p,properties:m};var{$set_once:y,$set:x}=e;return{event:Wd({},MSe(e,cQt),{properties:Wd({},e.properties,x?{$set:Wd({},(t=(n=e.properties)==null?void 0:n.$set)!==null&&t!==void 0?t:{},x)}:{},y?{$set_once:Wd({},(r=(a=e.properties)==null?void 0:a.$set_once)!==null&&r!==void 0?r:{},y)}:{}),elements_chain:(o=(s=e.properties)==null?void 0:s.$elements_chain)!==null&&o!==void 0?o:"",distinct_id:(l=e.properties)==null?void 0:l.distinct_id}),person:{properties:this._instance.get_property("$stored_person_properties")},groups:u}}setupSiteApp(e){var t=this.apps[e.id],n=()=>{var s;!t.errored&&this.ts.length&&(pM.info("Processing "+this.ts.length+" events for site app with id "+e.id),this.ts.forEach(l=>t.processEvent==null?void 0:t.processEvent(l)),t.processedBuffer=!0),Object.values(this.apps).every(l=>l.processedBuffer||l.errored)&&((s=this.rs)==null||s.call(this))},r=!1,a=s=>{t.errored=!s,t.loaded=!0,pM.info("Site app with id "+e.id+" "+(s?"loaded":"errored")),r&&n()};try{var{processEvent:o}=e.init({posthog:this._instance,callback:s=>{a(s)}});o&&(t.processEvent=o),r=!0}catch(s){pM.error("Error while initializing PostHog app with config id "+e.id,s),a(!1)}if(r&&t.loaded)try{n()}catch(s){pM.error("Error while processing buffered events PostHog app with config id "+e.id,s),t.errored=!0}}ss(){var e=this.siteAppLoaders||[];for(var t of e)this.apps[t.id]={id:t.id,loaded:!1,errored:!1,processedBuffer:!1};for(var n of e)this.setupSiteApp(n)}ns(e){if(Object.keys(this.apps).length!==0){var t=this.globalsForEvent(e);for(var n of Object.values(this.apps))try{n.processEvent==null||n.processEvent(t)}catch(r){pM.error("Error while processing event "+e.event+" for site app "+n.id,r)}}}onRemoteConfig(e){var t,n,r,a=this;if((t=this.siteAppLoaders)!=null&&t.length)return this.isEnabled?(this.ss(),void this._instance.on("eventCaptured",u=>this.ns(u))):void pM.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.');if((n=this.rs)==null||n.call(this),(r=e.siteApps)!=null&&r.length)if(this.isEnabled){var o=function(u){var d;k0["__$$ph_site_app_"+u]=a._instance,(d=k0.__PosthogExtensions__)==null||d.loadSiteApp==null||d.loadSiteApp(a._instance,l,f=>{if(f)return pM.error("Error while initializing PostHog app with config id "+u,f)})};for(var{id:s,url:l}of e.siteApps)o(s)}else pM.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}}var AQt=["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","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"],QQe=function(i,e){if(!i)return!1;var t=i.toLowerCase();return AQt.concat(e||[]).some(n=>{var r=n.toLowerCase();return t.indexOf(r)!==-1})},MQe=function(i,e){if(!i)return!1;var t=i.userAgent;if(t&&QQe(t,e))return!0;try{var n=i==null?void 0:i.userAgentData;if(n!=null&&n.brands&&n.brands.some(r=>QQe(r==null?void 0:r.brand,e)))return!0}catch{}return!!i.webdriver},Z4=function(i){return i.US="us",i.EU="eu",i.CUSTOM="custom",i}({}),RQe="i.posthog.com";class dQt{constructor(e){this.os={},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("."+RQe,".posthog.com")),t==="https://app.posthog.com"?"https://us.posthog.com":t}get region(){return this.os[this.apiHost]||(/https:\/\/(app|us|us-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?this.os[this.apiHost]=Z4.US:/https:\/\/(eu|eu-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?this.os[this.apiHost]=Z4.EU:this.os[this.apiHost]=Z4.CUSTOM),this.os[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===Z4.CUSTOM)return this.apiHost+t;var n=RQe+t;switch(e){case"assets":return"https://"+this.region+"-assets."+n;case"api":return"https://"+this.region+"."+n}}}var fQt={icontains:(i,e)=>!!Qo&&e.href.toLowerCase().indexOf(i.toLowerCase())>-1,not_icontains:(i,e)=>!!Qo&&e.href.toLowerCase().indexOf(i.toLowerCase())===-1,regex:(i,e)=>!!Qo&&E5(e.href,i),not_regex:(i,e)=>!!Qo&&!E5(e.href,i),exact:(i,e)=>e.href===i,is_not:(i,e)=>e.href!==i};class cx{constructor(e){var t=this;this.getWebExperimentsAndEvaluateDisplayLogic=function(n){n===void 0&&(n=!1),t.getWebExperiments(r=>{cx.ls("retrieved web experiments from the server"),t.us=new Map,r.forEach(a=>{if(a.feature_flag_key){var o;t.us&&(cx.ls("setting flag key ",a.feature_flag_key," to web experiment ",a),(o=t.us)==null||o.set(a.feature_flag_key,a));var s=t._instance.getFeatureFlag(a.feature_flag_key);G_(s)&&a.variants[s]&&t.hs(a.name,s,a.variants[s].transforms)}else if(a.variants)for(var l in a.variants){var u=a.variants[l];cx.ds(u)&&t.hs(a.name,l,u.transforms)}})},n)},this._instance=e,this._instance.onFeatureFlags(n=>{this.onFeatureFlags(n)})}onFeatureFlags(e){if(this._is_bot())cx.ls("Refusing to render web experiment since the viewer is a likely bot");else if(!this._instance.config.disable_web_experiments){if(BC(this.us))return this.us=new Map,this.loadIfEnabled(),void this.previewWebExperiment();cx.ls("applying feature flags",e),e.forEach(t=>{var n;if(this.us&&(n=this.us)!=null&&n.has(t)){var r,a=this._instance.getFeatureFlag(t),o=(r=this.us)==null?void 0:r.get(t);a&&o!=null&&o.variants[a]&&this.hs(o.name,a,o.variants[a].transforms)}})}}previewWebExperiment(){var e=cx.getWindowLocation();if(e!=null&&e.search){var t=TG(e==null?void 0:e.search,"__experiment_id"),n=TG(e==null?void 0:e.search,"__experiment_variant");t&&n&&(cx.ls("previewing web experiments "+t+" && "+n),this.getWebExperiments(r=>{this.vs(parseInt(t),n,r)},!1,!0))}}loadIfEnabled(){this._instance.config.disable_web_experiments||this.getWebExperimentsAndEvaluateDisplayLogic()}getWebExperiments(e,t,n){if(this._instance.config.disable_web_experiments&&!n)return e([]);var r=this._instance.get_property("$web_experiments");if(r&&!t)return e(r);this._instance.Ee({url:this._instance.requestRouter.endpointFor("api","/api/web_experiments/?token="+this._instance.config.token),method:"GET",callback:a=>{if(a.statusCode!==200||!a.json)return e([]);var o=a.json.experiments||[];return e(o)}})}vs(e,t,n){var r=n.filter(a=>a.id===e);r&&r.length>0&&(cx.ls("Previewing web experiment ["+r[0].name+"] with variant ["+t+"]"),this.hs(r[0].name,t,r[0].variants[t].transforms))}static ds(e){return!BC(e.conditions)&&cx.cs(e)&&cx.fs(e)}static cs(e){var t;if(BC(e.conditions)||BC((t=e.conditions)==null?void 0:t.url))return!0;var n,r,a,o=cx.getWindowLocation();return!!o&&((n=e.conditions)==null||!n.url||fQt[(r=(a=e.conditions)==null?void 0:a.urlMatchType)!==null&&r!==void 0?r:"icontains"](e.conditions.url,o))}static getWindowLocation(){return Qo==null?void 0:Qo.location}static fs(e){var t;if(BC(e.conditions)||BC((t=e.conditions)==null?void 0:t.utm))return!0;var n=fQe();if(n.utm_source){var r,a,o,s,l,u,d,f,p=(r=e.conditions)==null||(r=r.utm)==null||!r.utm_campaign||((a=e.conditions)==null||(a=a.utm)==null?void 0:a.utm_campaign)==n.utm_campaign,m=(o=e.conditions)==null||(o=o.utm)==null||!o.utm_source||((s=e.conditions)==null||(s=s.utm)==null?void 0:s.utm_source)==n.utm_source,y=(l=e.conditions)==null||(l=l.utm)==null||!l.utm_medium||((u=e.conditions)==null||(u=u.utm)==null?void 0:u.utm_medium)==n.utm_medium,x=(d=e.conditions)==null||(d=d.utm)==null||!d.utm_term||((f=e.conditions)==null||(f=f.utm)==null?void 0:f.utm_term)==n.utm_term;return p&&y&&x&&m}return!1}static ls(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];Pf.info("[WebExperiments] "+e,n)}hs(e,t,n){this._is_bot()?cx.ls("Refusing to render web experiment since the viewer is a likely bot"):t!=="control"?n.forEach(r=>{if(r.selector){var a;cx.ls("applying transform of variant "+t+" for experiment "+e+" ",r);var o=(a=document)==null?void 0:a.querySelectorAll(r.selector);o==null||o.forEach(s=>{var l=s;r.html&&(l.innerHTML=r.html),r.css&&l.setAttribute("style",r.css)})}}):cx.ls("Control variants leave the page unmodified.")}_is_bot(){return SB&&this._instance?MQe(SB,this._instance.config.custom_blocked_useragents):void 0}}var X4={},fee=()=>{},w5="posthog",DQe=!Mwt&&(iB==null?void 0:iB.indexOf("MSIE"))===-1&&(iB==null?void 0:iB.indexOf("Mozilla"))===-1,NQe=i=>{var e;return{api_host:"https://us.i.posthog.com",ui_host:null,token:"",autocapture:!0,rageclick:!0,cross_subdomain_cookie:lSt(Af==null?void 0:Af.location),persistence:"localStorage+cookie",persistence_name:"",loaded:fee,save_campaign_params:!0,custom_campaign_params:[],custom_blocked_useragents:[],save_referrer:!0,capture_pageview:i!=="2025-05-24"||"history_change",capture_pageleave:"if_capture_pageview",defaults:i??"unset",debug:nB&&G_(nB==null?void 0:nB.search)&&nB.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_external_dependency_loading:!1,enable_recording_console_log:void 0,secure_cookie:(Qo==null||(e=Qo.location)==null?void 0:e.protocol)==="https:",ip:!0,opt_out_capturing_by_default:!1,opt_out_persistence_by_default:!1,opt_out_useragent_filter:!1,opt_out_capturing_persistence_type:"localStorage",opt_out_capturing_cookie_prefix:null,opt_in_site_apps:!1,property_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_disable_toolbar_metrics:!1,feature_flag_request_timeout_ms:3e3,surveys_request_timeout_ms:1e4,on_request_error:t=>{var n="Bad HTTP status: "+t.statusCode+" "+t.text;Pf.error(n)},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:dee},error_tracking:{},_onCapture:fee}},TQe=i=>{var e={};ed(i.process_person)||(e.person_profiles=i.process_person),ed(i.xhr_headers)||(e.request_headers=i.xhr_headers),ed(i.cookie_name)||(e.persistence_name=i.cookie_name),ed(i.disable_cookie)||(e.disable_persistence=i.disable_cookie),ed(i.store_google)||(e.save_campaign_params=i.store_google),ed(i.verbose)||(e.debug=i.verbose);var t=EE({},e,i);return o_(i.property_blacklist)&&(ed(i.property_denylist)?t.property_denylist=i.property_blacklist:o_(i.property_denylist)?t.property_denylist=[...i.property_blacklist,...i.property_denylist]:Pf.error("Invalid value for property_denylist config: "+i.property_denylist)),t};class hQt{constructor(){this.__forceAllowLocalhost=!1}get ps(){return this.__forceAllowLocalhost}set ps(e){Pf.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=e}}class $G{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 hQt,this.gs=!1,this.version=DQ.LIB_VERSION,this._s=new xQe,this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=NQe(),this.SentryIntegration=Cwt,this.sentryIntegration=e=>function(t,n){var r=Owe(t,n);return{name:Fwe,processEvent:a=>r(a)}}(this,e),this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this.bs=!1,this.ys=null,this.ws=null,this.Ss=null,this.featureFlags=new qwt(this),this.toolbar=new _wt(this),this.scrollManager=new aQt(this),this.pageViewManager=new wwt(this),this.surveys=new $wt(this),this.experiments=new cx(this),this.exceptions=new Nwt(this),this.rateLimiter=new eQt(this),this.requestRouter=new dQt(this),this.consent=new MSt(this),this.people={set:(e,t,n)=>{var r=G_(e)?{[e]:t}:e;this.setPersonProperties(r),n==null||n({})},set_once:(e,t,n)=>{var r=G_(e)?{[e]:t}:e;this.setPersonProperties(void 0,r),n==null||n({})}},this.on("eventCaptured",e=>Pf.info('send "'+(e==null?void 0:e.event)+'"',e))}init(e,t,n){if(n&&n!==w5){var r,a=(r=X4[n])!==null&&r!==void 0?r:new $G;return a._init(e,t,n),X4[n]=a,X4[w5][n]=a,a}return this._init(e,t,n)}_init(e,t,n){var r,a;if(t===void 0&&(t={}),ed(e)||f$(e))return Pf.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 Pf.warn("You have already initialized PostHog! Re-initializing is a no-op"),this;this.__loaded=!0,this.config={},this.$s=t,this.ks=[],t.person_profiles&&(this.ws=t.person_profiles),this.set_config(EE({},NQe(t.defaults),TQe(t),{name:n,token:e})),this.config.on_xhr_error&&Pf.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=t.disable_compression?void 0:NQ.GZipJS,this.persistence=new cee(this.config),this.sessionPersistence=this.config.persistence==="sessionStorage"||this.config.persistence==="memory"?this.persistence:new cee(Wd({},this.config,{persistence:"sessionStorage"}));var o=Wd({},this.persistence.props),s=Wd({},this.sessionPersistence.props);if(this.register({$initialization_time:new Date().toISOString()}),this.xs=new nQt(b=>this.Es(b),this.config.request_queue_config),this.Is=new rQt(this),this.__request_queue=[],this.config.__preview_experimental_cookieless_mode||(this.sessionManager=new lQt(this),this.sessionPropsManager=new sQt(this,this.sessionManager,this.persistence)),new bwt(this).startIfEnabledOrStop(),this.siteApps=new uQt(this),(r=this.siteApps)==null||r.init(),this.config.__preview_experimental_cookieless_mode||(this.sessionRecording=new ywt(this),this.sessionRecording.startIfEnabledOrStop()),this.config.disable_scroll_properties||this.scrollManager.startMeasuringScrollPosition(),this.autocapture=new _St(this),this.autocapture.startIfEnabled(),this.surveys.loadIfEnabled(),this.heatmaps=new Swt(this),this.heatmaps.startIfEnabled(),this.webVitalsAutocapture=new xwt(this),this.exceptionObserver=new NSt(this),this.exceptionObserver.startIfEnabled(),this.deadClicksAutocapture=new Awe(this,DSt),this.deadClicksAutocapture.startIfEnabled(),this.historyAutocapture=new jSt(this),this.historyAutocapture.startIfEnabled(),DQ.DEBUG=DQ.DEBUG||this.config.debug,DQ.DEBUG&&Pf.info("Starting in debug mode",{this:this,config:t,thisC:Wd({},this.config),p:o,s}),this.Ps(),((a=t.bootstrap)==null?void 0:a.distinctID)!==void 0){var l,u,d=this.config.get_device_id(AM()),f=(l=t.bootstrap)!=null&&l.isIdentifiedID?d:t.bootstrap.distinctID;this.persistence.set_property(TQ,(u=t.bootstrap)!=null&&u.isIdentifiedID?"identified":"anonymous"),this.register({distinct_id:t.bootstrap.distinctID,$device_id:f})}if(this.Rs()){var p,m,y=Object.keys(((p=t.bootstrap)==null?void 0:p.featureFlags)||{}).filter(b=>{var Q;return!((Q=t.bootstrap)==null||(Q=Q.featureFlags)==null||!Q[b])}).reduce((b,Q)=>{var M;return b[Q]=((M=t.bootstrap)==null||(M=M.featureFlags)==null?void 0:M[Q])||!1,b},{}),x=Object.keys(((m=t.bootstrap)==null?void 0:m.featureFlagPayloads)||{}).filter(b=>y[b]).reduce((b,Q)=>{var M,L;return(M=t.bootstrap)!=null&&(M=M.featureFlagPayloads)!=null&&M[Q]&&(b[Q]=(L=t.bootstrap)==null||(L=L.featureFlagPayloads)==null?void 0:L[Q]),b},{});this.featureFlags.receivedFeatureFlags({featureFlags:y,featureFlagPayloads:x})}if(this.config.__preview_experimental_cookieless_mode)this.register_once({distinct_id:MG,$device_id:null},"");else if(!this.get_distinct_id()){var E=this.config.get_device_id(AM());this.register_once({distinct_id:E,$device_id:E},""),this.persistence.set_property(TQ,"anonymous")}return v_(Qo,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),this.toolbar.maybeLoadToolbar(),t.segment?vwt(this,()=>this.Ts()):this.Ts(),tS(this.config._onCapture)&&this.config._onCapture!==fee&&(Pf.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",b=>this.config._onCapture(b.event,b))),this}Ie(e){var t,n,r,a,o,s,l,u;if(!Af||!Af.body)return Pf.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout(()=>{this.Ie(e)},500);this.compression=void 0,e.supportedCompression&&!this.config.disable_compression&&(this.compression=My(e.supportedCompression,NQ.GZipJS)?NQ.GZipJS:My(e.supportedCompression,NQ.Base64)?NQ.Base64:void 0),(t=e.analytics)!=null&&t.endpoint&&(this.analyticsDefaultEndpoint=e.analytics.endpoint),this.set_config({person_profiles:this.ws?this.ws:"identified_only"}),(n=this.siteApps)==null||n.onRemoteConfig(e),(r=this.sessionRecording)==null||r.onRemoteConfig(e),(a=this.autocapture)==null||a.onRemoteConfig(e),(o=this.heatmaps)==null||o.onRemoteConfig(e),this.surveys.onRemoteConfig(e),(s=this.webVitalsAutocapture)==null||s.onRemoteConfig(e),(l=this.exceptionObserver)==null||l.onRemoteConfig(e),this.exceptions.onRemoteConfig(e),(u=this.deadClicksAutocapture)==null||u.onRemoteConfig(e)}Ts(){try{this.config.loaded(this)}catch(e){Pf.critical("`loaded` function failed",e)}this.Ms(),this.config.capture_pageview&&setTimeout(()=>{this.consent.isOptedIn()&&this.Cs()},1),new tQt(this).load(),this.featureFlags.flags()}Ms(){var e;this.has_opted_out_capturing()||this.config.request_batching&&((e=this.xs)==null||e.enable())}_dom_loaded(){this.has_opted_out_capturing()||cM(this.__request_queue,e=>this.Es(e)),this.__request_queue=[],this.Ms()}_handle_unload(){var e,t;this.config.request_batching?(this.Fs()&&this.capture("$pageleave"),(e=this.xs)==null||e.unload(),(t=this.Is)==null||t.unload()):this.Fs()&&this.capture("$pageleave",null,{transport:"sendBeacon"})}Ee(e){this.__loaded&&(DQe?this.__request_queue.push(e):this.rateLimiter.isServerRateLimited(e.batchKey)||(e.transport=e.transport||this.config.api_transport,e.url=JG(e.url,{ip:this.config.ip?1:0}),e.headers=Wd({},this.config.request_headers),e.compression=e.compression==="best-available"?this.compression:e.compression,e.fetchOptions=e.fetchOptions||this.config.fetch_options,(t=>{var n,r,a,o=Wd({},t);o.timeout=o.timeout||6e4,o.url=JG(o.url,{_:new Date().getTime().toString(),ver:DQ.LIB_VERSION,compression:o.compression});var s=(n=o.transport)!==null&&n!==void 0?n:"fetch",l=(r=(a=DSe(H4,u=>u.transport===s))==null?void 0:a.method)!==null&&r!==void 0?r:H4[0].method;if(!l)throw new Error("No available transport method");l(o)})(Wd({},e,{callback:t=>{var n,r;this.rateLimiter.checkForLimiting(t),t.statusCode>=400&&((n=(r=this.config).on_request_error)==null||n.call(r,t)),e.callback==null||e.callback(t)}}))))}Es(e){this.Is?this.Is.retriableRequest(e):this.Ee(e)}_execute_array(e){var t,n=[],r=[],a=[];cM(e,s=>{s&&(t=s[0],o_(t)?a.push(s):tS(s)?s.call(this):o_(s)&&t==="alias"?n.push(s):o_(s)&&t.indexOf("capture")!==-1&&tS(this[t])?a.push(s):r.push(s))});var o=function(s,l){cM(s,function(u){if(o_(u[0])){var d=l;t1(u,function(f){d=d[f[0]].apply(d,f.slice(1))})}else this[u[0]].apply(this,u.slice(1))},l)};o(n,this),o(r,this),o(a,this)}Rs(){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,n){var r;if(this.__loaded&&this.persistence&&this.sessionPersistence&&this.xs){if(!this.consent.isOptedOut())if(!ed(e)&&G_(e)){if(this.config.opt_out_useragent_filter||!this._is_bot()){var a=n!=null&&n.skip_client_rate_limiting?void 0:this.rateLimiter.clientRateLimitContext();if(a==null||!a.isRateLimited){t!=null&&t.$current_url&&!G_(t==null?void 0:t.$current_url)&&(Pf.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 o=new Date,s=(n==null?void 0:n.timestamp)||o,l=AM(),u={uuid:l,event:e,properties:this.calculateEventProperties(e,t||{},s,l)};a&&(u.properties.$lib_rate_limit_remaining_tokens=a.remainingTokens),n!=null&&n.$set&&(u.$set=n==null?void 0:n.$set);var d,f,p=this.Os(n==null?void 0:n.$set_once);if(p&&(u.$set_once=p),(u=oSt(u,n!=null&&n._noTruncate?null:this.config.properties_string_max_length)).timestamp=s,ed(n==null?void 0:n.timestamp)||(u.properties.$event_time_override_provided=!0,u.properties.$event_time_override_system_time=o),e===Aee.DISMISSED||e===Aee.SENT){var m=t==null?void 0:t[BQe.SURVEY_ID],y=t==null?void 0:t[BQe.SURVEY_ITERATION];localStorage.setItem((f=""+uee+(d={id:m,current_iteration:y}).id,d.current_iteration&&d.current_iteration>0&&(f=""+uee+d.id+"_"+d.current_iteration),f),"true"),u.$set=Wd({},u.$set,{[Xwt({id:m,current_iteration:y},e===Aee.SENT?"responded":"dismissed")]:!0})}var x=Wd({},u.properties.$set,u.$set);if(g5(x)||this.setPersonPropertiesForFlags(x),!BC(this.config.before_send)){var E=this.As(u);if(!E)return;u=E}this._s.emit("eventCaptured",u);var b={method:"POST",url:(r=n==null?void 0:n._url)!==null&&r!==void 0?r:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),data:u,compression:"best-available",batchKey:n==null?void 0:n._batchKey};return!this.config.request_batching||n&&(n==null||!n._batchKey)||n!=null&&n.send_instantly?this.Es(b):this.xs.enqueue(b),u}Pf.critical("This capture call is ignored due to client rate limiting.")}}else Pf.error("No event name provided to posthog.capture")}else Pf.uninitializedWarning("posthog.capture")}Ge(e){return this.on("eventCaptured",t=>e(t.event,t))}calculateEventProperties(e,t,n,r,a){if(n=n||new Date,!this.persistence||!this.sessionPersistence)return t;var o=a?void 0:this.persistence.remove_event_timer(e),s=Wd({},t);if(s.token=this.config.token,s.$config_defaults=this.config.defaults,this.config.__preview_experimental_cookieless_mode&&(s.$cookieless_mode=!0),e==="$snapshot"){var l=Wd({},this.persistence.properties(),this.sessionPersistence.properties());return s.distinct_id=l.distinct_id,(!G_(s.distinct_id)&&!ox(s.distinct_id)||f$(s.distinct_id))&&Pf.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),s}var u,d=Kwt(this.config.mask_personal_data_properties,this.config.custom_personal_data_properties);if(this.sessionManager){var{sessionId:f,windowId:p}=this.sessionManager.checkAndGetSessionAndWindowId(a,n.getTime());s.$session_id=f,s.$window_id=p}this.sessionPropsManager&&EE(s,this.sessionPropsManager.getSessionProps());try{var m;this.sessionRecording&&EE(s,this.sessionRecording.sdkDebugProperties),s.$sdk_debug_retry_queue_size=(m=this.Is)==null?void 0:m.length}catch(b){s.$sdk_debug_error_capturing_properties=String(b)}if(this.requestRouter.region===Z4.CUSTOM&&(s.$lib_custom_api_host=this.config.api_host),u=e!=="$pageview"||a?e!=="$pageleave"||a?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(n):this.pageViewManager.doPageView(n,r),s=EE(s,u),e==="$pageview"&&Af&&(s.title=Af.title),!ed(o)){var y=n.getTime()-o;s.$duration=parseFloat((y/1e3).toFixed(3))}iB&&this.config.opt_out_useragent_filter&&(s.$browser_type=this._is_bot()?"bot":"browser"),(s=EE({},d,this.persistence.properties(),this.sessionPersistence.properties(),s)).$is_identified=this._isIdentified(),o_(this.config.property_denylist)?t1(this.config.property_denylist,function(b){delete s[b]}):Pf.error("Invalid value for property_denylist config: "+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);var x=this.config.sanitize_properties;x&&(Pf.error("sanitize_properties is deprecated. Use before_send instead"),s=x(s,e));var E=this.Ds();return s.$process_person_profile=E,E&&!a&&this.Ls("_calculate_event_properties"),s}Os(e){var t;if(!this.persistence||!this.Ds()||this.gs)return e;var n=this.persistence.get_initial_props(),r=(t=this.sessionPropsManager)==null?void 0:t.getSetOnceProps(),a=EE({},n,r||{},e||{}),o=this.config.sanitize_properties;return o&&(Pf.error("sanitize_properties is deprecated. Use before_send instead"),a=o(a,"$set_once")),this.gs=!0,g5(a)?void 0:a}register(e,t){var n;(n=this.persistence)==null||n.register(e,t)}register_once(e,t,n){var r;(r=this.persistence)==null||r.register_once(e,t,n)}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)}js(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){this.featureFlags.updateEarlyAccessFeatureEnrollment(e,t)}getEarlyAccessFeatures(e,t,n){return t===void 0&&(t=!1),this.featureFlags.getEarlyAccessFeatures(e,t,n)}on(e,t){return this._s.on(e,t)}onFeatureFlags(e){return this.featureFlags.onFeatureFlags(e)}onSurveysLoaded(e){return this.surveys.onSurveysLoaded(e)}onSessionId(e){var t,n;return(t=(n=this.sessionManager)==null?void 0:n.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,n){if(!this.__loaded||!this.persistence)return Pf.uninitializedWarning("posthog.identify");if(ox(e)&&(e=e.toString(),Pf.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()))Pf.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!==MG){if(this.Ls("posthog.identify")){var r=this.get_distinct_id();if(this.register({$user_id:e}),!this.get_property("$device_id")){var a=r;this.register_once({$had_persisted_distinct_id:!0,$device_id:a},"")}e!==r&&e!==this.get_property(N4)&&(this.unregister(N4),this.register({distinct_id:e}));var o=(this.persistence.get_property(TQ)||"anonymous")==="anonymous";e!==r&&o?(this.persistence.set_property(TQ,"identified"),this.setPersonPropertiesForFlags(Wd({},n||{},t||{}),!1),this.capture("$identify",{distinct_id:e,$anon_distinct_id:r},{$set:t||{},$set_once:n||{}}),this.Ss=jwe(e,t,n),this.featureFlags.setAnonymousDistinctId(r)):(t||n)&&this.setPersonProperties(t,n),e!==r&&(this.reloadFeatureFlags(),this.unregister(SG))}}else Pf.critical('The string "'+MG+'" was set in posthog.identify which indicates an error. This ID is only used as a sentinel value.');else Pf.error("Unique user id has not been set in posthog.identify")}setPersonProperties(e,t){if((e||t)&&this.Ls("posthog.setPersonProperties")){var n=jwe(this.get_distinct_id(),e,t);this.Ss!==n?(this.setPersonPropertiesForFlags(Wd({},t||{},e||{})),this.capture("$set",{$set:e||{},$set_once:t||{}}),this.Ss=n):Pf.info("A duplicate setPersonProperties call was made with the same properties. It has been ignored.")}}group(e,t,n){if(e&&t){if(this.Ls("posthog.group")){var r=this.getGroups();r[e]!==t&&this.resetGroupPropertiesForFlags(e),this.register({$groups:Wd({},r,{[e]:t})}),n&&(this.capture("$groupidentify",{$group_type:e,$group_key:t,$group_set:n}),this.setGroupPropertiesForFlags({[e]:n})),r[e]===t||n||this.reloadFeatureFlags()}}else Pf.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.Ls("posthog.setGroupPropertiesForFlags")&&this.featureFlags.setGroupPropertiesForFlags(e,t)}resetGroupPropertiesForFlags(e){this.featureFlags.resetGroupPropertiesForFlags(e)}reset(e){var t,n,r,a;if(Pf.info("reset"),!this.__loaded)return Pf.uninitializedWarning("posthog.reset");var o=this.get_property("$device_id");if(this.consent.reset(),(t=this.persistence)==null||t.clear(),(n=this.sessionPersistence)==null||n.clear(),this.surveys.reset(),(r=this.persistence)==null||r.set_property(TQ,"anonymous"),(a=this.sessionManager)==null||a.resetSessionId(),this.Ss=null,this.config.__preview_experimental_cookieless_mode)this.register_once({distinct_id:MG,$device_id:null},"");else{var s=this.config.get_device_id(AM());this.register_once({distinct_id:s,$device_id:e?s:o},"")}this.register({$last_posthog_reset:new Date().toISOString()},1)}get_distinct_id(){return this.get_property("distinct_id")}getGroups(){return this.get_property("$groups")||{}}get_session_id(){var e,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:n}=this.sessionManager.checkAndGetSessionAndWindowId(!0),r=this.requestRouter.endpointFor("ui","/project/"+this.config.token+"/replay/"+t);if(e!=null&&e.withTimestamp&&n){var a,o=(a=e.timestampLookBack)!==null&&a!==void 0?a:10;if(!n)return r;r+="?t="+Math.max(Math.floor((new Date().getTime()-n)/1e3)-o,0)}return r}alias(e,t){return e===this.get_property(NSe)?(Pf.critical("Attempting to create alias for existing People user - aborting."),-2):this.Ls("posthog.alias")?(ed(t)&&(t=this.get_distinct_id()),e!==t?(this.js(N4,e),this.capture("$create_alias",{alias:e,distinct_id:t})):(Pf.warn("alias matches current distinct_id - skipping api call."),this.identify(e),-1)):void 0}set_config(e){var t,n,r,a,o=Wd({},this.config);k_(e)&&(EE(this.config,TQe(e)),(t=this.persistence)==null||t.update_config(this.config,o),this.sessionPersistence=this.config.persistence==="sessionStorage"||this.config.persistence==="memory"?this.persistence:new cee(Wd({},this.config,{persistence:"sessionStorage"})),KE.O()&&KE.D("ph_debug")==="true"&&(this.config.debug=!0),this.config.debug&&(DQ.DEBUG=!0,Pf.info("set_config",{config:e,oldConfig:o,newConfig:Wd({},this.config)})),(n=this.sessionRecording)==null||n.startIfEnabledOrStop(),(r=this.autocapture)==null||r.startIfEnabled(),(a=this.heatmaps)==null||a.startIfEnabled(),this.surveys.loadIfEnabled(),this.Ps())}startSessionRecording(e){var t=e===!0,n={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(n).some(Boolean)){var r,a,o,s,l;(r=this.sessionManager)==null||r.checkAndGetSessionAndWindowId(),n.sampling&&((a=this.sessionRecording)==null||a.overrideSampling()),n.linked_flag&&((o=this.sessionRecording)==null||o.overrideLinkedFlag()),n.url_trigger&&((s=this.sessionRecording)==null||s.overrideTrigger("url")),n.event_trigger&&((l=this.sessionRecording)==null||l.overrideTrigger("event"))}this.set_config({disable_session_recording:!1})}stopSessionRecording(){this.set_config({disable_session_recording:!0})}sessionRecordingStarted(){var e;return!((e=this.sessionRecording)==null||!e.started)}captureException(e,t){var n=new Error("PostHog syntheticException");this.exceptions.sendExceptionEvent(Wd({},KSt((r=>r instanceof Error)(e)?{error:e,event:e.message}:{event:e},{syntheticException:n}),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:w5;return t!==w5&&(t=w5+"."+t),t}_isIdentified(){var e,t;return((e=this.persistence)==null?void 0:e.get_property(TQ))==="identified"||((t=this.sessionPersistence)==null?void 0:t.get_property(TQ))==="identified"}Ds(){var e,t;return!(this.config.person_profiles==="never"||this.config.person_profiles==="identified_only"&&!this._isIdentified()&&g5(this.getGroups())&&((e=this.persistence)==null||(e=e.props)==null||!e[N4])&&((t=this.persistence)==null||(t=t.props)==null||!t[QG]))}Fs(){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.Ds()||this.Ls("posthog.createPersonProfile")&&this.setPersonProperties({},{})}Ls(e){return this.config.person_profiles==="never"?(Pf.error(e+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this.js(QG,!0),!0)}Ps(){var e,t,n,r,a=this.consent.isOptedOut(),o=this.config.opt_out_persistence_by_default,s=this.config.disable_persistence||a&&!!o;((e=this.persistence)==null?void 0:e.Fe)!==s&&((n=this.persistence)==null||n.set_disabled(s)),((t=this.sessionPersistence)==null?void 0:t.Fe)!==s&&((r=this.sessionPersistence)==null||r.set_disabled(s))}opt_in_capturing(e){var t;this.consent.optInOut(!0),this.Ps(),(ed(e==null?void 0:e.captureEventName)||e!=null&&e.captureEventName)&&this.capture((t=e==null?void 0:e.captureEventName)!==null&&t!==void 0?t:"$opt_in",e==null?void 0:e.captureProperties,{send_instantly:!0}),this.config.capture_pageview&&this.Cs()}opt_out_capturing(){this.consent.optInOut(!1),this.Ps()}has_opted_in_capturing(){return this.consent.isOptedIn()}has_opted_out_capturing(){return this.consent.isOptedOut()}clear_opt_in_out_capturing(){this.consent.reset(),this.Ps()}_is_bot(){return SB?MQe(SB,this.config.custom_blocked_useragents):void 0}Cs(){Af&&(Af.visibilityState==="visible"?this.bs||(this.bs=!0,this.capture("$pageview",{title:Af.title},{send_instantly:!0}),this.ys&&(Af.removeEventListener("visibilitychange",this.ys),this.ys=null)):this.ys||(this.ys=this.Cs.bind(this),v_(Af,"visibilitychange",this.ys)))}debug(e){e===!1?(Qo==null||Qo.console.log("You've disabled debug mode."),localStorage&&localStorage.removeItem("ph_debug"),this.set_config({debug:!1})):(Qo==null||Qo.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}))}I(){var e,t,n,r,a,o,s,l=this.$s||{};return"advanced_disable_flags"in l?!!l.advanced_disable_flags:this.config.advanced_disable_flags!==!1?!!this.config.advanced_disable_flags:this.config.advanced_disable_decide===!0?(Pf.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):(n="advanced_disable_decide",r=!1,a=Pf,o=(t="advanced_disable_flags")in(e=l)&&!ed(e[t]),s=n in e&&!ed(e[n]),o?e[t]:s?(a&&a.warn("Config field '"+n+"' is deprecated. Please use '"+t+"' instead. The old field will be removed in a future major version."),e[n]):r)}As(e){if(BC(this.config.before_send))return e;var t=o_(this.config.before_send)?this.config.before_send:[this.config.before_send],n=e;for(var r of t){if(n=r(n),BC(n)){var a="Event '"+e.event+"' was rejected in beforeSend function";return iSt(e.event)?Pf.warn(a+". This can cause unexpected behavior."):Pf.info(a),null}n.properties&&!g5(n.properties)||Pf.warn("Event '"+e.event+"' has no properties after beforeSend function, this is likely an error.")}return n}getPageViewId(){var e;return(e=this.pageViewManager.ce)==null?void 0:e.pageViewId}captureTraceFeedback(e,t){this.capture("$ai_feedback",{$ai_trace_id:String(e),$ai_feedback_text:t})}captureTraceMetric(e,t,n){this.capture("$ai_metric",{$ai_trace_id:String(e),$ai_metric_name:t,$ai_metric_value:String(n)})}}(function(i,e){for(var t=0;t<e.length;t++)i.prototype[e[t]]=aSt(i.prototype[e[t]])})($G,["identify"]);var UQe,eF=(UQe=X4[w5]=new $G,function(){function i(){i.done||(i.done=!0,DQe=!1,t1(X4,function(e){e._dom_loaded()}))}Af!=null&&Af.addEventListener?Af.readyState==="complete"?i():v_(Af,"DOMContentLoaded",i,{capture:!1}):Qo&&Pf.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")}(),UQe);!window.location.hostname.includes("localhost")&&!window.location.hostname.includes("127.0.0.1")&&(eF.__loaded||eF.init("phc_htd8AQjSfVEsFCLQMAiUooG4Q0DKBCjqYuQglc9V3Wo",{api_host:"https://postpig.tscircuit.com",person_profiles:"always"}));function jm(...i){return WBt(Iw(i))}const PQe=i=>i.replace(/_/g," ").replace(/\b\w/g,e=>e.toUpperCase()),hee=IBt,tF=it.forwardRef(({className:i,...e},t)=>Ke.jsx(ASe,{ref:t,className:jm("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",i),...e}));tF.displayName=ASe.displayName;const Sw=it.forwardRef(({className:i,...e},t)=>Ke.jsx(dSe,{ref:t,className:jm("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",i),...e}));Sw.displayName=dSe.displayName;const rS=it.forwardRef(({className:i,...e},t)=>Ke.jsx(fSe,{ref:t,className:jm("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",i),...e}));rS.displayName=fSe.displayName;/**
896
896
  * @license
897
897
  * Copyright 2010-2024 Three.js Authors
898
898
  * SPDX-License-Identifier: MIT
@@ -13079,7 +13079,7 @@ ${l.join(`
13079
13079
  `)),i.indexOf(`\\
13080
13080
  `)!==-1&&(i=i.replace(/\\\n/g,""));const t=i.split(`
13081
13081
  `);let n="",r="",a=0,o=[];const s=typeof"".trimLeft=="function";for(let d=0,f=t.length;d<f;d++)if(n=t[d],n=s?n.trimLeft():n.trim(),a=n.length,a!==0&&(r=n.charAt(0),r!=="#"))if(r==="v"){const p=n.split(/\s+/);switch(p[0]){case"v":e.vertices.push(parseFloat(p[1]),parseFloat(p[2]),parseFloat(p[3])),p.length>=7?e.colors.push(parseFloat(p[4]),parseFloat(p[5]),parseFloat(p[6])):e.colors.push(void 0,void 0,void 0);break;case"vn":e.normals.push(parseFloat(p[1]),parseFloat(p[2]),parseFloat(p[3]));break;case"vt":e.uvs.push(parseFloat(p[1]),parseFloat(p[2]));break}}else if(r==="f"){const m=n.substr(1).trim().split(/\s+/),y=[];for(let E=0,b=m.length;E<b;E++){const Q=m[E];if(Q.length>0){const M=Q.split("/");y.push(M)}}const x=y[0];for(let E=1,b=y.length-1;E<b;E++){const Q=y[E],M=y[E+1];e.addFace(x[0],Q[0],M[0],x[1],Q[1],M[1],x[2],Q[2],M[2])}}else if(r==="l"){const p=n.substring(1).trim().split(" ");let m=[];const y=[];if(n.indexOf("/")===-1)m=p;else for(let x=0,E=p.length;x<E;x++){const b=p[x].split("/");b[0]!==""&&m.push(b[0]),b[1]!==""&&y.push(b[1])}e.addLineGeometry(m,y)}else if(r==="p"){const m=n.substr(1).trim().split(" ");e.addPointGeometry(m)}else if((o=sWt.exec(n))!==null){const p=(" "+o[0].substr(1).trim()).substr(1);e.startObject(p)}else if(cWt.test(n))e.object.startMaterial(n.substring(7).trim(),e.materialLibraries);else if(lWt.test(n))e.materialLibraries.push(n.substring(7).trim());else if(uWt.test(n))console.warn('THREE.OBJLoader: Rendering identifier "usemap" not supported. Textures must be defined in MTL files.');else if(r==="s"){if(o=n.split(" "),o.length>1){const m=o[1].trim().toLowerCase();e.object.smooth=m!=="0"&&m!=="off"}else e.object.smooth=!0;const p=e.object.currentMaterial();p&&(p.smooth=e.object.smooth)}else{if(n==="\0")continue;console.warn('THREE.OBJLoader: Unexpected line: "'+n+'"')}e.finalize();const l=new i2;if(l.materialLibraries=[].concat(e.materialLibraries),!(e.objects.length===1&&e.objects[0].geometry.vertices.length===0)===!0)for(let d=0,f=e.objects.length;d<f;d++){const p=e.objects[d],m=p.geometry,y=p.materials,x=m.type==="Line",E=m.type==="Points";let b=!1;if(m.vertices.length===0)continue;const Q=new Og;Q.setAttribute("position",new $d(m.vertices,3)),m.normals.length>0&&Q.setAttribute("normal",new $d(m.normals,3)),m.colors.length>0&&(b=!0,Q.setAttribute("color",new $d(m.colors,3))),m.hasUVIndices===!0&&Q.setAttribute("uv",new $d(m.uvs,2));const M=[];for(let V=0,Y=y.length;V<Y;V++){const q=y[V],K=q.name+"_"+q.smooth+"_"+b;let $=e.materials[K];if(this.materials!==null){if($=this.materials.create(q.name),x&&$&&!($ instanceof XE)){const j=new XE;_b.prototype.copy.call(j,$),j.color.copy($.color),$=j}else if(E&&$&&!($ instanceof c2)){const j=new c2({size:10,sizeAttenuation:!1});_b.prototype.copy.call(j,$),j.color.copy($.color),j.map=$.map,$=j}}$===void 0&&(x?$=new XE:E?$=new c2({size:1,sizeAttenuation:!1}):$=new sO,$.name=q.name,$.flatShading=!q.smooth,$.vertexColors=b,e.materials[K]=$),M.push($)}let L;if(M.length>1){for(let V=0,Y=y.length;V<Y;V++){const q=y[V];Q.addGroup(q.groupStart,q.groupCount,V)}x?L=new cS(Q,M):E?L=new UT(Q,M):L=new DI(Q,M)}else x?L=new cS(Q,M[0]):E?L=new UT(Q,M[0]):L=new DI(Q,M[0]);L.name=p.name,l.add(L)}else if(e.vertices.length>0){const d=new c2({size:1,sizeAttenuation:!1}),f=new Og;f.setAttribute("position",new $d(e.vertices,3)),e.colors.length>0&&e.colors[0]!==void 0&&(f.setAttribute("color",new $d(e.colors,3)),d.vertexColors=!0);const p=new UT(f,d);l.add(p)}return l}};typeof window<"u"&&!window.TSCIRCUIT_OBJ_LOADER_CACHE&&(window.TSCIRCUIT_OBJ_LOADER_CACHE=new Map);function fWt(i){const[e,t]=it.useState(null);return it.useEffect(()=>{if(!i)return;const n=window.TSCIRCUIT_OBJ_LOADER_CACHE;let r=!1;async function a(){var s;try{const u=await(await fetch(i)).text(),d=(s=u.match(/newmtl[\s\S]*?endmtl/g))==null?void 0:s.join(`
13082
- `).replace(/d 0\./g,"d 1."),f=u.replace(/newmtl[\s\S]*?endmtl/g,""),p=new aWt;p.setMaterialOptions({invertTrProperty:!0});const m=p.parse(d.replace(/Kd\s+([\d.]+)\s+([\d.]+)\s+([\d.]+)/g,"Kd $2 $2 $2"),"test.mtl"),y=new dWt;return y.setMaterials(m),y.parse(f)}catch(l){return l}}function o(){if(n.has(i)){const l=n.get(i);return l.result?Promise.resolve(l.result.clone()):l.promise.then(u=>u.clone())}const s=a().then(l=>(l instanceof Error||n.set(i,{...n.get(i),result:l}),l));return n.set(i,{promise:s,result:null}),s}return o().then(s=>{r||t(s)}).catch(s=>{console.error(s)}),()=>{r=!0}},[i]),e}function hWt({url:i,position:e,rotation:t,onHover:n,onUnhover:r,isHovered:a}){const o=fWt(i);return o?o instanceof Error?Ke.jsx(pU,{isHovered:a,onHover:n,onUnhover:r,children:Ke.jsxs("mesh",{position:e,children:[Ke.jsx("boxGeometry",{args:[.5,.5,.5]}),Ke.jsx("meshStandardMaterial",{transparent:!0,color:"red",opacity:.5}),Ke.jsx("meshBasicMaterial",{color:"red"})]})}):Ke.jsx(pU,{isHovered:a,onHover:n,onUnhover:r,children:Ke.jsx("primitive",{rotation:t,position:e,object:o})}):Ke.jsx(pU,{isHovered:a,onHover:n,onUnhover:r,children:Ke.jsxs("mesh",{position:e,children:[Ke.jsx("boxGeometry",{args:[.5,.5,.5]}),Ke.jsx("meshStandardMaterial",{transparent:!0,color:"red",opacity:.25})]})})}var pWt=s_(_He()),BHe=({jscadPlan:i,positionOffset:e,rotationOffset:t,onHover:n,onUnhover:r,isHovered:a})=>{const{threeGeom:o,material:s}=it.useMemo(()=>{const l=f2e.executeJscadOperations(pWt.default,i),u=A6t(l),d=new oD({vertexColors:!0,side:Ax});return{threeGeom:u,material:d}},[i]);return it.useMemo(()=>{if(a){const l=new Vu(s.color.getHex());s.emissive.copy(l),s.emissive.setRGB(0,0,1),s.emissiveIntensity=.2}else s.emissiveIntensity=0},[a,s]),o?Ke.jsx(pU,{isHovered:a,onHover:n,onUnhover:r,position:e,children:Ke.jsx("mesh",{geometry:o,material:s,position:e,rotation:t})}):null},{createJSCADRoot:gWt}=CNt(f2e.jscadPlanner),mWt=({positionOffset:i,footprint:e,rotationOffset:t,onHover:n,onUnhover:r,isHovered:a})=>{const o=it.useMemo(()=>{if(!e)return null;const s=[];return gWt(s).render(Ke.jsx(LYt,{footprint:e})),s},[e]);return o?Ke.jsx(Ke.Fragment,{children:o.map((s,l)=>Ke.jsx(BHe,{positionOffset:i,rotationOffset:t,jscadPlan:s,onHover:n,onUnhover:r,isHovered:a},l))}):null},yWt=(...i)=>i,SHe=({cad_component:i,circuitJson:e})=>{const[t,n]=it.useState(!1),[r,a]=it.useState(null),o=it.useCallback(p=>{p!=null&&p.mousePosition?(n(!0),a(p.mousePosition)):(n(!1),a(null))},[]),s=it.useCallback(()=>{n(!1),a(null)},[]),l=it.useMemo(()=>{var p;return(p=Qv(e).source_component.getUsing({source_component_id:i.source_component_id}))==null?void 0:p.name},[e,i.source_component_id]),u=i.model_obj_url??i.model_stl_url,d=i.rotation?yWt(i.rotation.x*Math.PI/180,i.rotation.y*Math.PI/180,i.rotation.z*Math.PI/180):void 0;let f=null;return u?f=Ke.jsx(hWt,{url:u,position:i.position?[i.position.x,i.position.y,i.position.z]:void 0,rotation:d,onHover:o,onUnhover:s,isHovered:t},i.cad_component_id):i.model_jscad?f=Ke.jsx(BHe,{jscadPlan:i.model_jscad,rotationOffset:d,onHover:o,onUnhover:s,isHovered:t},i.cad_component_id):i.footprinter_string&&(f=Ke.jsx(mWt,{positionOffset:i.position?[i.position.x,i.position.y,i.position.z]:void 0,rotationOffset:d,footprint:i.footprinter_string,onHover:o,onUnhover:s,isHovered:t})),Ke.jsxs(Ke.Fragment,{children:[f,t&&r?Ke.jsx(dOe,{position:r,style:{fontFamily:"sans-serif",transform:"translate3d(50%, 50%, 0)",backgroundColor:"white",padding:"5px",borderRadius:"3px",pointerEvents:"none",userSelect:"none",WebkitUserSelect:"none",MozUserSelect:"none",msUserSelect:"none"},children:l??"<unknown>"}):null]})},vWt={version:"0.0.287"};typeof window<"u"&&(window.TSCI_MAIN_CAMERA_ROTATION=new sB(0,0,0));function CWt(i,e){const t=new Nb().setFromEuler(new sB(i.x,i.y,i.z)),n=new _i(0,0,1);return n.applyQuaternion(t),n.multiplyScalar(e)}var IWt=({})=>{const i=it.useRef();return it.useRef({lastRotation:new sB}),$8((e,t)=>{if(!i.current)return;const n=window.TSCI_MAIN_CAMERA_ROTATION,r=CWt(n,2);e.camera.position.copy(r),e.camera.lookAt(0,0,0)}),Ke.jsxs("mesh",{ref:i,rotation:[Math.PI/2,0,0],children:[Ke.jsx("boxGeometry",{args:[1,1,1]}),Ke.jsx("meshStandardMaterial",{color:"white"}),Ke.jsx(P2,{position:[0,0,.51],fontSize:.25,color:"black",children:"Front"}),Ke.jsx(P2,{position:[0,0,-.51],fontSize:.25,color:"black",rotation:[0,Math.PI,0],children:"Back"}),Ke.jsx(P2,{position:[.51,0,0],fontSize:.25,color:"black",rotation:[0,Math.PI/2,0],children:"Right"}),Ke.jsx(P2,{position:[-.51,0,0],fontSize:.25,color:"black",rotation:[0,-Math.PI/2,0],children:"Left"}),Ke.jsx(P2,{position:[0,.51,0],fontSize:.25,color:"black",rotation:[-Math.PI/2,0,0],children:"Top"}),Ke.jsx(P2,{position:[0,-.51,0],fontSize:.25,color:"black",rotation:[Math.PI/2,0,0],children:"Bottom"}),Ke.jsx("lineSegments",{args:[new Gte(new bM(1,1,1))],material:new XE({color:0,linewidth:2})})]})},_Wt=()=>($8(({camera:i})=>{window.TSCI_MAIN_CAMERA_ROTATION=i.rotation}),Ke.jsx(Ke.Fragment,{})),wHe=it.forwardRef(({children:i,initialCameraPosition:e=[5,5,5],autoRotateDisabled:t,clickToInteractEnabled:n=!1,boardDimensions:r},a)=>{const[o,s]=it.useState(!n),l=it.useMemo(()=>{if(!r)return 10;const u=r.width??0,d=r.height??0,p=Math.max(u,d)*1.5;return p>10?p:10},[r]);return Ke.jsxs("div",{style:{position:"relative",width:"100%",height:"100%"},children:[Ke.jsx("div",{style:{position:"absolute",top:0,left:0,width:120,height:120},children:Ke.jsxs(cOe,{camera:{up:[0,0,1],position:[1,1,1]},style:{zIndex:10},children:[Ke.jsx("ambientLight",{intensity:Math.PI/2}),Ke.jsx(IWt,{})]})}),Ke.jsxs(cOe,{scene:{up:[0,0,1]},camera:{up:[0,0,1],position:e},children:[Ke.jsx(_Wt,{}),o&&Ke.jsx(JKt,{autoRotate:!t,autoRotateSpeed:1}),Ke.jsx("ambientLight",{intensity:Math.PI/2}),Ke.jsx("pointLight",{position:[-10,-10,10],decay:0,intensity:Math.PI/4}),Ke.jsx(ZKt,{rotation:[Math.PI/2,0,0],infiniteGrid:!0,cellSize:1,sectionSize:l,args:[l,l]}),Ke.jsx("object3D",{ref:a,children:i})]}),Ke.jsxs("div",{style:{position:"absolute",right:24,bottom:24,fontFamily:"sans-serif",color:"white",WebkitTextStroke:"0.5px rgba(0, 0, 0, 0.5)",fontSize:11},children:["@",vWt.version]}),n&&!o&&Ke.jsx("button",{type:"button",onClick:()=>s(!0),onKeyDown:u=>{(u.key==="Enter"||u.key===" ")&&s(!0)},style:{position:"absolute",inset:0,cursor:"pointer",zIndex:10,display:"flex",alignItems:"center",justifyContent:"center"},children:Ke.jsx("div",{style:{backgroundColor:"rgba(0, 0, 0, 0.8)",color:"white",padding:"12px 24px",borderRadius:"8px",fontSize:"16px",fontFamily:"sans-serif",pointerEvents:"none"},children:"Click to Interact"})})]})}),EWt=i=>it.useMemo(()=>{if(!i)return;const e=new Sxt;return e.add(i),e.render(),e.getCircuitJson()},[i]);function bWt(i){return new Promise((e,t)=>{const n=new FileReader;n.onload=()=>{e(n.result)},n.onerror=t,n.readAsDataURL(i)})}var xWt=i=>{const[e,t]=it.useState([]),[n,r]=it.useState(!0);return it.useEffect(()=>{if(!i)return;(async()=>{r(!0);const s=(Array.isArray(i)?i:[i]).map(async l=>{const u=cjt.serialize({binary:!0},[l]),d=new Blob(u);return{stlUrl:await bWt(d),color:l.color}});try{const l=await Promise.all(s);t(l)}catch(l){console.error("Error generating STLs:",l),t([])}finally{r(!1)}})()},[i]),{stls:e,loading:n}},BWt=s_(zD()),SWt=s_(lU()),cC=.01,ib={copper:[.9,.6,.2],fr4Green:[5/255,163/255,46/255],fr4GreenSolderWithMask:[0/255,152/255,19/255],fr1Copper:[.8,.4,.2],fr1CopperSolderWithMask:[.9,.6,.2]},o9=.001,Jw=32,wWt=.035,aH=50,ffe={fr1:ib.fr1Copper,fr4:ib.fr4Green},QHe={fr1:ib.fr1CopperSolderWithMask,fr4:ib.fr4GreenSolderWithMask},QWt=s_(tH()),MWt=s_(zD()),RWt=s_(rH()),MHe=i=>{let e=0;for(let n=0;n<i.length;n++){const r=(n+1)%i.length;e+=i[n][0]*i[r][1],e-=i[r][0]*i[n][1]}return e/2<=0},RHe=(i,e=1.2)=>{const{outline:t}=i;let n=t.map(o=>[o.x,o.y]);MHe(n)&&(n=n.reverse());const r=(0,MWt.polygon)({points:n});let a=(0,QWt.extrudeLinear)({height:e},r);return a=(0,RWt.translate)([0,0,-e/2],a),a},DWt=i=>{const e=Qv(i).pcb_board.list()[0];if(!e)return console.warn("No pcb_board found for simplified geometry"),[];let t;const n=1.2;e.outline&&e.outline.length>0?t=RHe({outline:e.outline},n):t=(0,BWt.cuboid)({size:[e.width,e.height,n],center:[e.center.x,e.center.y,0]});const r=ffe[e.material]??ib.fr4Green;return[(0,SWt.colorize)(r,t)]},F2=s_(rH()),yx=s_(zD()),HD=s_(lU()),O2=s_(sfe()),PI=s_(zD()),oH=s_(lU()),TB=s_(sfe()),H_=.05,DHe=(i,e)=>{if(i.shape||(i.shape="circle"),i.shape==="circle")return(0,oH.colorize)(ib.copper,(0,TB.subtract)((0,TB.union)((0,PI.cylinder)({center:[i.x,i.y,0],radius:i.hole_diameter/2,height:e.pcbThickness}),(0,PI.cylinder)({center:[i.x,i.y,e.pcbThickness/2+H_/2+cC],radius:i.outer_diameter/2,height:H_}),(0,PI.cylinder)({center:[i.x,i.y,-e.pcbThickness/2-H_/2-cC],radius:i.outer_diameter/2,height:H_})),(0,PI.cylinder)({center:[i.x,i.y,0],radius:i.hole_diameter/2-cC,height:1.5})));if(i.shape==="circular_hole_with_rect_pad"){const t=i.rect_pad_width||i.hole_diameter,n=i.rect_pad_height||i.hole_diameter;return(0,oH.colorize)(ib.copper,(0,TB.subtract)((0,TB.union)((0,PI.cuboid)({center:[i.x,i.y,1.2/2],size:[t,n,H_]}),(0,PI.cuboid)({center:[i.x,i.y,-1.2/2],size:[t,n,H_]}),(0,PI.cylinder)({center:[i.x,i.y,0],radius:i.hole_diameter/2,height:1.2})),(0,PI.cylinder)({center:[i.x,i.y,0],radius:Math.max(i.hole_diameter/2-cC,.01),height:1.5})))}if(i.shape==="pill"){const t=i.hole_height>i.hole_width,n=t?i.hole_height:i.hole_width,r=t?i.hole_width:i.hole_height,a=t?i.outer_height||r+.2:i.outer_width||n+.2,o=t?i.outer_width||n+.2:i.outer_height||r+.2,s=r/2,l=o/2,u=Math.abs(n-r),d=Math.abs(a-o),f=(0,PI.cuboid)({center:[i.x,i.y,0],size:t?[r,u,e.pcbThickness]:[u,r,e.pcbThickness]}),p=(0,PI.cylinder)({center:t?[i.x,i.y-u/2,0]:[i.x-u/2,i.y,0],radius:s,height:e.pcbThickness}),m=(0,PI.cylinder)({center:t?[i.x,i.y+u/2,0]:[i.x+u/2,i.y,0],radius:s,height:e.pcbThickness}),y=(0,TB.union)(f,p,m),x=e.pcbThickness/2+H_/2+cC,E=(0,PI.cuboid)({center:[i.x,i.y,x],size:t?[o,d,H_]:[d,o,H_]}),b=(0,PI.cylinder)({center:t?[i.x,i.y-d/2,x]:[i.x-d/2,i.y,x],radius:l,height:H_}),Q=(0,PI.cylinder)({center:t?[i.x,i.y+d/2,x]:[i.x+d/2,i.y,x],radius:l,height:H_}),M=(0,TB.union)(E,b,Q),L=-e.pcbThickness/2-H_/2-cC,V=(0,PI.cuboid)({center:[i.x,i.y,L],size:t?[o,d,H_]:[d,o,H_]}),Y=(0,PI.cylinder)({center:t?[i.x,i.y-d/2,L]:[i.x-d/2,i.y,L],radius:l,height:H_}),q=(0,PI.cylinder)({center:t?[i.x,i.y+d/2,L]:[i.x+d/2,i.y,L],radius:l,height:H_}),K=(0,TB.union)(V,Y,q),$=(0,PI.cuboid)({center:[i.x,i.y,0],size:t?[r-2*cC,u,e.pcbThickness+2*cC]:[u,r-2*cC,e.pcbThickness+2*cC]}),j=(0,PI.cylinder)({center:t?[i.x,i.y-u/2,0]:[i.x-u/2,i.y,0],radius:s-cC,height:e.pcbThickness+2*cC}),ue=(0,PI.cylinder)({center:t?[i.x,i.y+u/2,0]:[i.x+u/2,i.y,0],radius:s-cC,height:e.pcbThickness+2*cC}),ce=(0,TB.union)($,j,ue);return(0,oH.colorize)(ib.copper,(0,TB.subtract)((0,TB.union)(y,M,K),ce))}if(i.shape==="pill_hole_with_rect_pad"){const t=i.hole_height>i.hole_width,n=t?i.hole_height:i.hole_width,r=t?i.hole_width:i.hole_height,a=r/2,o=Math.abs(n-r),s=i.rect_pad_width||n+.2,l=i.rect_pad_height||r+.2,u=(0,PI.cuboid)({center:[i.x,i.y,0],size:t?[r,o,1.2]:[o,r,1.2]}),d=(0,PI.cylinder)({center:t?[i.x,i.y-o/2,0]:[i.x-o/2,i.y,0],radius:a,height:1.2}),f=(0,PI.cylinder)({center:t?[i.x,i.y+o/2,0]:[i.x+o/2,i.y,0],radius:a,height:1.2}),p=(0,PI.cuboid)({center:[i.x,i.y,1.2/2],size:[s,l,H_]}),m=(0,PI.cuboid)({center:[i.x,i.y,-1.2/2],size:[s,l,H_]}),y=(0,TB.union)((0,PI.cuboid)({center:[i.x,i.y,0],size:t?[r-H_,o,1.5]:[o,r-H_,1.5]}),(0,PI.cylinder)({center:t?[i.x,i.y-o/2,0]:[i.x-o/2,i.y,0],radius:a-H_,height:1.5}),(0,PI.cylinder)({center:t?[i.x,i.y+o/2,0]:[i.x+o/2,i.y,0],radius:a-H_,height:1.5}));return(0,oH.colorize)(ib.copper,(0,TB.subtract)((0,TB.union)(u,d,f,p,m),y))}else throw new Error(`Unsupported plated hole shape: ${i.shape}`)},sH=s_(tH()),NHe=s_(cfe()),NWt=s_(tfe());function THe(i,e){return Array.isArray(e)?[i.a*e[0]+i.c*e[1]+i.e,i.b*e[0]+i.d*e[1]+i.f]:{x:i.a*e.x+i.c*e.y+i.e,y:i.b*e.x+i.d*e.y+i.f}}function GM(i,e=0){return{a:1,c:0,e:i,b:0,d:1,f:e}}function UHe(...i){i=Array.isArray(i[0])?i[0]:i;const e=(t,n)=>({a:t.a*n.a+t.c*n.b,c:t.a*n.c+t.c*n.d,e:t.a*n.e+t.c*n.f+t.e,b:t.b*n.a+t.d*n.b,d:t.b*n.c+t.d*n.d,f:t.b*n.e+t.d*n.f+t.f});switch(i.length){case 0:throw new Error("no matrices provided");case 1:return i[0];case 2:return e(i[0],i[1]);default:{const[t,n,...r]=i,a=e(t,n);return UHe(a,...r)}}}function PHe(...i){return UHe(...i)}var{cos:TWt,sin:UWt}=Math;function LHe(i,e,t){const n=TWt(i),r=UWt(i);return{a:n,c:-r,e:0,b:r,d:n,f:0}}function PWt(i,e){function t(){this.constructor=i}t.prototype=e.prototype,i.prototype=new t}function lH(i,e,t,n){var r=Error.call(this,i);return Object.setPrototypeOf&&Object.setPrototypeOf(r,lH.prototype),r.expected=e,r.found=t,r.location=n,r.name="SyntaxError",r}PWt(lH,Error);function hfe(i,e,t){return t=t||" ",i.length>e?i:(e-=i.length,t+=t.repeat(e),i+t.slice(0,e))}lH.prototype.format=function(i){var e="Error: "+this.message;if(this.location){var t=null,n;for(n=0;n<i.length;n++)if(i[n].source===this.location.source){t=i[n].text.split(/\r\n|\n|\r/g);break}var r=this.location.start,a=this.location.source&&typeof this.location.source.offset=="function"?this.location.source.offset(r):r,o=this.location.source+":"+a.line+":"+a.column;if(t){var s=this.location.end,l=hfe("",a.line.toString().length," "),u=t[r.line-1],d=r.line===s.line?s.column:u.length+1,f=d-r.column||1;e+=`
13082
+ `).replace(/d 0\./g,"d 1."),f=u.replace(/newmtl[\s\S]*?endmtl/g,""),p=new aWt;p.setMaterialOptions({invertTrProperty:!0});const m=p.parse(d.replace(/Kd\s+([\d.]+)\s+([\d.]+)\s+([\d.]+)/g,"Kd $2 $2 $2"),"test.mtl"),y=new dWt;return y.setMaterials(m),y.parse(f)}catch(l){return l}}function o(){if(n.has(i)){const l=n.get(i);return l.result?Promise.resolve(l.result.clone()):l.promise.then(u=>u.clone())}const s=a().then(l=>(l instanceof Error||n.set(i,{...n.get(i),result:l}),l));return n.set(i,{promise:s,result:null}),s}return o().then(s=>{r||t(s)}).catch(s=>{console.error(s)}),()=>{r=!0}},[i]),e}function hWt({url:i,position:e,rotation:t,onHover:n,onUnhover:r,isHovered:a}){const o=fWt(i);return o?o instanceof Error?Ke.jsx(pU,{isHovered:a,onHover:n,onUnhover:r,children:Ke.jsxs("mesh",{position:e,children:[Ke.jsx("boxGeometry",{args:[.5,.5,.5]}),Ke.jsx("meshStandardMaterial",{transparent:!0,color:"red",opacity:.5}),Ke.jsx("meshBasicMaterial",{color:"red"})]})}):Ke.jsx(pU,{isHovered:a,onHover:n,onUnhover:r,children:Ke.jsx("primitive",{rotation:t,position:e,object:o})}):Ke.jsx(pU,{isHovered:a,onHover:n,onUnhover:r,children:Ke.jsxs("mesh",{position:e,children:[Ke.jsx("boxGeometry",{args:[.5,.5,.5]}),Ke.jsx("meshStandardMaterial",{transparent:!0,color:"red",opacity:.25})]})})}var pWt=s_(_He()),BHe=({jscadPlan:i,positionOffset:e,rotationOffset:t,onHover:n,onUnhover:r,isHovered:a})=>{const{threeGeom:o,material:s}=it.useMemo(()=>{const l=f2e.executeJscadOperations(pWt.default,i),u=A6t(l),d=new oD({vertexColors:!0,side:Ax});return{threeGeom:u,material:d}},[i]);return it.useMemo(()=>{if(a){const l=new Vu(s.color.getHex());s.emissive.copy(l),s.emissive.setRGB(0,0,1),s.emissiveIntensity=.2}else s.emissiveIntensity=0},[a,s]),o?Ke.jsx(pU,{isHovered:a,onHover:n,onUnhover:r,position:e,children:Ke.jsx("mesh",{geometry:o,material:s,position:e,rotation:t})}):null},{createJSCADRoot:gWt}=CNt(f2e.jscadPlanner),mWt=({positionOffset:i,footprint:e,rotationOffset:t,onHover:n,onUnhover:r,isHovered:a})=>{const o=it.useMemo(()=>{if(!e)return null;const s=[];return gWt(s).render(Ke.jsx(LYt,{footprint:e})),s},[e]);return o?Ke.jsx(Ke.Fragment,{children:o.map((s,l)=>Ke.jsx(BHe,{positionOffset:i,rotationOffset:t,jscadPlan:s,onHover:n,onUnhover:r,isHovered:a},l))}):null},yWt=(...i)=>i,SHe=({cad_component:i,circuitJson:e})=>{const[t,n]=it.useState(!1),[r,a]=it.useState(null),o=it.useCallback(p=>{p!=null&&p.mousePosition?(n(!0),a(p.mousePosition)):(n(!1),a(null))},[]),s=it.useCallback(()=>{n(!1),a(null)},[]),l=it.useMemo(()=>{var p;return(p=Qv(e).source_component.getUsing({source_component_id:i.source_component_id}))==null?void 0:p.name},[e,i.source_component_id]),u=i.model_obj_url??i.model_stl_url,d=i.rotation?yWt(i.rotation.x*Math.PI/180,i.rotation.y*Math.PI/180,i.rotation.z*Math.PI/180):void 0;let f=null;return u?f=Ke.jsx(hWt,{url:u,position:i.position?[i.position.x,i.position.y,i.position.z]:void 0,rotation:d,onHover:o,onUnhover:s,isHovered:t},i.cad_component_id):i.model_jscad?f=Ke.jsx(BHe,{jscadPlan:i.model_jscad,rotationOffset:d,onHover:o,onUnhover:s,isHovered:t},i.cad_component_id):i.footprinter_string&&(f=Ke.jsx(mWt,{positionOffset:i.position?[i.position.x,i.position.y,i.position.z]:void 0,rotationOffset:d,footprint:i.footprinter_string,onHover:o,onUnhover:s,isHovered:t})),Ke.jsxs(Ke.Fragment,{children:[f,t&&r?Ke.jsx(dOe,{position:r,style:{fontFamily:"sans-serif",transform:"translate3d(50%, 50%, 0)",backgroundColor:"white",padding:"5px",borderRadius:"3px",pointerEvents:"none",userSelect:"none",WebkitUserSelect:"none",MozUserSelect:"none",msUserSelect:"none"},children:l??"<unknown>"}):null]})},vWt={version:"0.0.288"};typeof window<"u"&&(window.TSCI_MAIN_CAMERA_ROTATION=new sB(0,0,0));function CWt(i,e){const t=new Nb().setFromEuler(new sB(i.x,i.y,i.z)),n=new _i(0,0,1);return n.applyQuaternion(t),n.multiplyScalar(e)}var IWt=({})=>{const i=it.useRef();return it.useRef({lastRotation:new sB}),$8((e,t)=>{if(!i.current)return;const n=window.TSCI_MAIN_CAMERA_ROTATION,r=CWt(n,2);e.camera.position.copy(r),e.camera.lookAt(0,0,0)}),Ke.jsxs("mesh",{ref:i,rotation:[Math.PI/2,0,0],children:[Ke.jsx("boxGeometry",{args:[1,1,1]}),Ke.jsx("meshStandardMaterial",{color:"white"}),Ke.jsx(P2,{position:[0,0,.51],fontSize:.25,color:"black",children:"Front"}),Ke.jsx(P2,{position:[0,0,-.51],fontSize:.25,color:"black",rotation:[0,Math.PI,0],children:"Back"}),Ke.jsx(P2,{position:[.51,0,0],fontSize:.25,color:"black",rotation:[0,Math.PI/2,0],children:"Right"}),Ke.jsx(P2,{position:[-.51,0,0],fontSize:.25,color:"black",rotation:[0,-Math.PI/2,0],children:"Left"}),Ke.jsx(P2,{position:[0,.51,0],fontSize:.25,color:"black",rotation:[-Math.PI/2,0,0],children:"Top"}),Ke.jsx(P2,{position:[0,-.51,0],fontSize:.25,color:"black",rotation:[Math.PI/2,0,0],children:"Bottom"}),Ke.jsx("lineSegments",{args:[new Gte(new bM(1,1,1))],material:new XE({color:0,linewidth:2})})]})},_Wt=()=>($8(({camera:i})=>{window.TSCI_MAIN_CAMERA_ROTATION=i.rotation}),Ke.jsx(Ke.Fragment,{})),wHe=it.forwardRef(({children:i,initialCameraPosition:e=[5,5,5],autoRotateDisabled:t,clickToInteractEnabled:n=!1,boardDimensions:r},a)=>{const[o,s]=it.useState(!n),l=it.useMemo(()=>{if(!r)return 10;const u=r.width??0,d=r.height??0,p=Math.max(u,d)*1.5;return p>10?p:10},[r]);return Ke.jsxs("div",{style:{position:"relative",width:"100%",height:"100%"},children:[Ke.jsx("div",{style:{position:"absolute",top:0,left:0,width:120,height:120},children:Ke.jsxs(cOe,{camera:{up:[0,0,1],position:[1,1,1]},style:{zIndex:10},children:[Ke.jsx("ambientLight",{intensity:Math.PI/2}),Ke.jsx(IWt,{})]})}),Ke.jsxs(cOe,{scene:{up:[0,0,1]},camera:{up:[0,0,1],position:e},children:[Ke.jsx(_Wt,{}),o&&Ke.jsx(JKt,{autoRotate:!t,autoRotateSpeed:1}),Ke.jsx("ambientLight",{intensity:Math.PI/2}),Ke.jsx("pointLight",{position:[-10,-10,10],decay:0,intensity:Math.PI/4}),Ke.jsx(ZKt,{rotation:[Math.PI/2,0,0],infiniteGrid:!0,cellSize:1,sectionSize:l,args:[l,l]}),Ke.jsx("object3D",{ref:a,children:i})]}),Ke.jsxs("div",{style:{position:"absolute",right:24,bottom:24,fontFamily:"sans-serif",color:"white",WebkitTextStroke:"0.5px rgba(0, 0, 0, 0.5)",fontSize:11},children:["@",vWt.version]}),n&&!o&&Ke.jsx("button",{type:"button",onClick:()=>s(!0),onKeyDown:u=>{(u.key==="Enter"||u.key===" ")&&s(!0)},style:{position:"absolute",inset:0,cursor:"pointer",zIndex:10,display:"flex",alignItems:"center",justifyContent:"center"},children:Ke.jsx("div",{style:{backgroundColor:"rgba(0, 0, 0, 0.8)",color:"white",padding:"12px 24px",borderRadius:"8px",fontSize:"16px",fontFamily:"sans-serif",pointerEvents:"none"},children:"Click to Interact"})})]})}),EWt=i=>it.useMemo(()=>{if(!i)return;const e=new Sxt;return e.add(i),e.render(),e.getCircuitJson()},[i]);function bWt(i){return new Promise((e,t)=>{const n=new FileReader;n.onload=()=>{e(n.result)},n.onerror=t,n.readAsDataURL(i)})}var xWt=i=>{const[e,t]=it.useState([]),[n,r]=it.useState(!0);return it.useEffect(()=>{if(!i)return;(async()=>{r(!0);const s=(Array.isArray(i)?i:[i]).map(async l=>{const u=cjt.serialize({binary:!0},[l]),d=new Blob(u);return{stlUrl:await bWt(d),color:l.color}});try{const l=await Promise.all(s);t(l)}catch(l){console.error("Error generating STLs:",l),t([])}finally{r(!1)}})()},[i]),{stls:e,loading:n}},BWt=s_(zD()),SWt=s_(lU()),cC=.01,ib={copper:[.9,.6,.2],fr4Green:[5/255,163/255,46/255],fr4GreenSolderWithMask:[0/255,152/255,19/255],fr1Copper:[.8,.4,.2],fr1CopperSolderWithMask:[.9,.6,.2]},o9=.001,Jw=32,wWt=.035,aH=50,ffe={fr1:ib.fr1Copper,fr4:ib.fr4Green},QHe={fr1:ib.fr1CopperSolderWithMask,fr4:ib.fr4GreenSolderWithMask},QWt=s_(tH()),MWt=s_(zD()),RWt=s_(rH()),MHe=i=>{let e=0;for(let n=0;n<i.length;n++){const r=(n+1)%i.length;e+=i[n][0]*i[r][1],e-=i[r][0]*i[n][1]}return e/2<=0},RHe=(i,e=1.2)=>{const{outline:t}=i;let n=t.map(o=>[o.x,o.y]);MHe(n)&&(n=n.reverse());const r=(0,MWt.polygon)({points:n});let a=(0,QWt.extrudeLinear)({height:e},r);return a=(0,RWt.translate)([0,0,-e/2],a),a},DWt=i=>{const e=Qv(i).pcb_board.list()[0];if(!e)return console.warn("No pcb_board found for simplified geometry"),[];let t;const n=1.2;e.outline&&e.outline.length>0?t=RHe({outline:e.outline},n):t=(0,BWt.cuboid)({size:[e.width,e.height,n],center:[e.center.x,e.center.y,0]});const r=ffe[e.material]??ib.fr4Green;return[(0,SWt.colorize)(r,t)]},F2=s_(rH()),yx=s_(zD()),HD=s_(lU()),O2=s_(sfe()),PI=s_(zD()),oH=s_(lU()),TB=s_(sfe()),H_=.05,DHe=(i,e)=>{if(i.shape||(i.shape="circle"),i.shape==="circle")return(0,oH.colorize)(ib.copper,(0,TB.subtract)((0,TB.union)((0,PI.cylinder)({center:[i.x,i.y,0],radius:i.hole_diameter/2,height:e.pcbThickness}),(0,PI.cylinder)({center:[i.x,i.y,e.pcbThickness/2+H_/2+cC],radius:i.outer_diameter/2,height:H_}),(0,PI.cylinder)({center:[i.x,i.y,-e.pcbThickness/2-H_/2-cC],radius:i.outer_diameter/2,height:H_})),(0,PI.cylinder)({center:[i.x,i.y,0],radius:i.hole_diameter/2-cC,height:1.5})));if(i.shape==="circular_hole_with_rect_pad"){const t=i.rect_pad_width||i.hole_diameter,n=i.rect_pad_height||i.hole_diameter;return(0,oH.colorize)(ib.copper,(0,TB.subtract)((0,TB.union)((0,PI.cuboid)({center:[i.x,i.y,1.2/2],size:[t,n,H_]}),(0,PI.cuboid)({center:[i.x,i.y,-1.2/2],size:[t,n,H_]}),(0,PI.cylinder)({center:[i.x,i.y,0],radius:i.hole_diameter/2,height:1.2})),(0,PI.cylinder)({center:[i.x,i.y,0],radius:Math.max(i.hole_diameter/2-cC,.01),height:1.5})))}if(i.shape==="pill"){const t=i.hole_height>i.hole_width,n=t?i.hole_height:i.hole_width,r=t?i.hole_width:i.hole_height,a=t?i.outer_height||r+.2:i.outer_width||n+.2,o=t?i.outer_width||n+.2:i.outer_height||r+.2,s=r/2,l=o/2,u=Math.abs(n-r),d=Math.abs(a-o),f=(0,PI.cuboid)({center:[i.x,i.y,0],size:t?[r,u,e.pcbThickness]:[u,r,e.pcbThickness]}),p=(0,PI.cylinder)({center:t?[i.x,i.y-u/2,0]:[i.x-u/2,i.y,0],radius:s,height:e.pcbThickness}),m=(0,PI.cylinder)({center:t?[i.x,i.y+u/2,0]:[i.x+u/2,i.y,0],radius:s,height:e.pcbThickness}),y=(0,TB.union)(f,p,m),x=e.pcbThickness/2+H_/2+cC,E=(0,PI.cuboid)({center:[i.x,i.y,x],size:t?[o,d,H_]:[d,o,H_]}),b=(0,PI.cylinder)({center:t?[i.x,i.y-d/2,x]:[i.x-d/2,i.y,x],radius:l,height:H_}),Q=(0,PI.cylinder)({center:t?[i.x,i.y+d/2,x]:[i.x+d/2,i.y,x],radius:l,height:H_}),M=(0,TB.union)(E,b,Q),L=-e.pcbThickness/2-H_/2-cC,V=(0,PI.cuboid)({center:[i.x,i.y,L],size:t?[o,d,H_]:[d,o,H_]}),Y=(0,PI.cylinder)({center:t?[i.x,i.y-d/2,L]:[i.x-d/2,i.y,L],radius:l,height:H_}),q=(0,PI.cylinder)({center:t?[i.x,i.y+d/2,L]:[i.x+d/2,i.y,L],radius:l,height:H_}),K=(0,TB.union)(V,Y,q),$=(0,PI.cuboid)({center:[i.x,i.y,0],size:t?[r-2*cC,u,e.pcbThickness+2*cC]:[u,r-2*cC,e.pcbThickness+2*cC]}),j=(0,PI.cylinder)({center:t?[i.x,i.y-u/2,0]:[i.x-u/2,i.y,0],radius:s-cC,height:e.pcbThickness+2*cC}),ue=(0,PI.cylinder)({center:t?[i.x,i.y+u/2,0]:[i.x+u/2,i.y,0],radius:s-cC,height:e.pcbThickness+2*cC}),ce=(0,TB.union)($,j,ue);return(0,oH.colorize)(ib.copper,(0,TB.subtract)((0,TB.union)(y,M,K),ce))}if(i.shape==="pill_hole_with_rect_pad"){const t=i.hole_height>i.hole_width,n=t?i.hole_height:i.hole_width,r=t?i.hole_width:i.hole_height,a=r/2,o=Math.abs(n-r),s=i.rect_pad_width||n+.2,l=i.rect_pad_height||r+.2,u=(0,PI.cuboid)({center:[i.x,i.y,0],size:t?[r,o,1.2]:[o,r,1.2]}),d=(0,PI.cylinder)({center:t?[i.x,i.y-o/2,0]:[i.x-o/2,i.y,0],radius:a,height:1.2}),f=(0,PI.cylinder)({center:t?[i.x,i.y+o/2,0]:[i.x+o/2,i.y,0],radius:a,height:1.2}),p=(0,PI.cuboid)({center:[i.x,i.y,1.2/2],size:[s,l,H_]}),m=(0,PI.cuboid)({center:[i.x,i.y,-1.2/2],size:[s,l,H_]}),y=(0,TB.union)((0,PI.cuboid)({center:[i.x,i.y,0],size:t?[r-H_,o,1.5]:[o,r-H_,1.5]}),(0,PI.cylinder)({center:t?[i.x,i.y-o/2,0]:[i.x-o/2,i.y,0],radius:a-H_,height:1.5}),(0,PI.cylinder)({center:t?[i.x,i.y+o/2,0]:[i.x+o/2,i.y,0],radius:a-H_,height:1.5}));return(0,oH.colorize)(ib.copper,(0,TB.subtract)((0,TB.union)(u,d,f,p,m),y))}else throw new Error(`Unsupported plated hole shape: ${i.shape}`)},sH=s_(tH()),NHe=s_(cfe()),NWt=s_(tfe());function THe(i,e){return Array.isArray(e)?[i.a*e[0]+i.c*e[1]+i.e,i.b*e[0]+i.d*e[1]+i.f]:{x:i.a*e.x+i.c*e.y+i.e,y:i.b*e.x+i.d*e.y+i.f}}function GM(i,e=0){return{a:1,c:0,e:i,b:0,d:1,f:e}}function UHe(...i){i=Array.isArray(i[0])?i[0]:i;const e=(t,n)=>({a:t.a*n.a+t.c*n.b,c:t.a*n.c+t.c*n.d,e:t.a*n.e+t.c*n.f+t.e,b:t.b*n.a+t.d*n.b,d:t.b*n.c+t.d*n.d,f:t.b*n.e+t.d*n.f+t.f});switch(i.length){case 0:throw new Error("no matrices provided");case 1:return i[0];case 2:return e(i[0],i[1]);default:{const[t,n,...r]=i,a=e(t,n);return UHe(a,...r)}}}function PHe(...i){return UHe(...i)}var{cos:TWt,sin:UWt}=Math;function LHe(i,e,t){const n=TWt(i),r=UWt(i);return{a:n,c:-r,e:0,b:r,d:n,f:0}}function PWt(i,e){function t(){this.constructor=i}t.prototype=e.prototype,i.prototype=new t}function lH(i,e,t,n){var r=Error.call(this,i);return Object.setPrototypeOf&&Object.setPrototypeOf(r,lH.prototype),r.expected=e,r.found=t,r.location=n,r.name="SyntaxError",r}PWt(lH,Error);function hfe(i,e,t){return t=t||" ",i.length>e?i:(e-=i.length,t+=t.repeat(e),i+t.slice(0,e))}lH.prototype.format=function(i){var e="Error: "+this.message;if(this.location){var t=null,n;for(n=0;n<i.length;n++)if(i[n].source===this.location.source){t=i[n].text.split(/\r\n|\n|\r/g);break}var r=this.location.start,a=this.location.source&&typeof this.location.source.offset=="function"?this.location.source.offset(r):r,o=this.location.source+":"+a.line+":"+a.column;if(t){var s=this.location.end,l=hfe("",a.line.toString().length," "),u=t[r.line-1],d=r.line===s.line?s.column:u.length+1,f=d-r.column||1;e+=`
13083
13083
  --> `+o+`
13084
13084
  `+l+` |
13085
13085
  `+a.line+" | "+u+`
@@ -13746,7 +13746,7 @@ $1`).replace(/>(\s*)(?=<!--\s*\/)/g,"> ")}return vpe}wsn();function oJe(i,e,t,n=
13746
13746
  &:hover {
13747
13747
  background-color: rgba(255, 255, 255, 0.1);
13748
13748
  }
13749
- `,onClick:n=>{n.stopPropagation(),t()},children:[Ke.jsx("input",{type:"checkbox",checked:e}),Ke.jsx("span",{style:{color:"#eee"},children:i})]}),tAn=({children:i,elements:e})=>{const[t,n]=ME(K=>[K.is_mouse_over_container,K.setIsMouseOverContainer]),[r,a]=it.useState(!1),[o,s]=it.useState(!1),[l,u]=it.useState(!1),[d,f]=ME(K=>[K.selected_layer,K.selectLayer]),[p,m,y,x,E,b]=ME(K=>[K.in_move_footprint_mode,K.in_draw_trace_mode,K.is_showing_rats_nest,K.is_showing_multiple_traces_length,K.is_showing_autorouting,K.is_showing_drc_errors]),Q=ME(K=>K.setEditMode),M=ME(K=>K.setIsShowingRatsNest),L=ME(K=>K.setIsShowingMultipleTracesLength),V=ME(K=>K.setIsShowingAutorouting),Y=ME(K=>K.setIsShowingDrcErrors);XM("1",()=>f("top")),XM("2",()=>f("bottom")),XM("3",()=>f("inner1")),XM("4",()=>f("inner2")),XM("5",()=>f("inner3")),XM("6",()=>f("inner4")),XM("7",()=>f("inner5")),XM("8",()=>f("inner6"));const q=(e==null?void 0:e.filter(K=>K.type.includes("error")).length)??0;return Ke.jsxs("div",{style:{position:"relative"},onMouseEnter:()=>{n(!0)},onMouseLeave:K=>{n(!1),s(!1)},children:[i,Ke.jsxs("div",{style:{position:"absolute",bottom:4,right:8,pointerEvents:"none",color:"white",fontSize:11,opacity:t?.5:0,transition:"opacity 1s",transitionDelay:"2s",fontFamily:"sans-serif"},children:["@tscircuit/pcb-viewer@",$un.version]}),Ke.jsxs("div",{style:{position:"absolute",opacity:t?1:0,top:16,left:16,transition:t?"opacity 100ms linear":"opacity 1s linear",zIndex:Ix.toolbarOverlay,color:"red",display:"flex",fontSize:12,height:100,fontFamily:"sans-serif"},children:[Ke.jsxs(hN,{onClick:()=>{s(!o)},onMouseLeave:()=>{o&&s(!1)},children:[Ke.jsxs("div",{children:["layer:"," ",Ke.jsx("span",{style:{marginLeft:2,fontWeight:500,color:fN[d]},children:d})]}),o&&Ke.jsx("div",{style:{marginTop:4,minWidth:120},children:ege.map(K=>K.replace(/-/g,"")).map(K=>Ke.jsx(eAn,{name:K,selected:K===d,onClick:()=>{f(K.replace(/-/,""))}},K))})]}),Ke.jsxs(hN,{style:q>0?{color:"red"}:{},onClick:()=>u(!l),onMouseLeave:()=>u(!1),children:[Ke.jsxs("div",{children:[q," errors"]}),l&&Ke.jsx("div",{style:{display:"grid",gridTemplateColumns:"100px 300px"},children:e==null?void 0:e.filter(K=>K.type.includes("error")).map((K,$)=>Ke.jsxs(it.Fragment,{children:[Ke.jsx("div",{children:K.error_type}),Ke.jsx("div",{children:K.message})]},$))})]}),Ke.jsx(hN,{style:{},onClick:()=>{Q(m?"off":"draw_trace")},children:Ke.jsxs("div",{children:[m?"✖ ":"","Edit Traces"]})}),Ke.jsx(hN,{style:{},onClick:()=>{Q(p?"off":"move_footprint")},children:Ke.jsxs("div",{children:[p?"✖ ":"","Move Components"]})}),Ke.jsx(hN,{style:{},onClick:()=>{M(!y)},children:Ke.jsxs("div",{children:[y?"✖ ":"","Rats Nest"]})}),Ke.jsx(hN,{onClick:()=>{a(!r)},children:Ke.jsxs("div",{children:[Ke.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"4px"},children:["View"," ",Ke.jsx("span",{style:{fontSize:"8px",transform:r?"rotate(180deg)":"rotate(0)",transition:"transform 0.1s ease",display:"inline-block"},children:"▼"})]}),r&&Ke.jsxs("div",{style:{marginTop:4,minWidth:120},children:[Ke.jsx(oge,{label:"Show All Trace Lengths",checked:x,onClick:()=>{L(!x)}}),Ke.jsx(oge,{label:"Show Autorouting Animation",checked:E,onClick:()=>{V(!E)}}),Ke.jsx(oge,{label:"Show DRC Errors",checked:b,onClick:()=>{Y(!b)}})]})]})})]})]})},nAn=i=>{const{transform:e,elements:t}=i,[n,r]=it.useMemo(()=>{const u=i.elements.flatMap(f=>fun(f,i.elements)),d=RS(i.elements);return[u,d]},[i.elements]),[a,o]=it.useState({drawingObjectIdsWithMouseOver:new Set,primitiveIdsInMousedOverNet:[]}),s=it.useMemo(()=>Aun({primitivesWithoutInteractionMetadata:n,drawingObjectIdsWithMouseOver:a.drawingObjectIdsWithMouseOver,primitiveIdsInMousedOverNet:a.primitiveIdsInMousedOverNet}),[n,a]),l=it.useCallback(u=>{var p,m;const d=[];for(const y of u)if(y._element){const x=r.getNetConnectedToId("pcb_port_id"in y._element?(p=y._element)==null?void 0:p.pcb_port_id:"pcb_trace_id"in y._element?(m=y._element)==null?void 0:m.pcb_trace_id:"");d.push(...r.getIdsConnectedToNet(x))}const f=new Set(u.map(y=>y._pcb_drawing_object_id));o({drawingObjectIdsWithMouseOver:f,primitiveIdsInMousedOverNet:d})},[r]);return Ke.jsx(Xun,{elements:t,transform:e,primitives:n,onMouseHoverOverPrimitives:l,children:Ke.jsx(Tun,{disabled:!i.allowEditing,transform:e,soup:t,cancelPanDrag:i.cancelPanDrag,onCreateEditEvent:i.onCreateEditEvent,onModifyEditEvent:i.onModifyEditEvent,children:Ke.jsx(kun,{disabled:!i.allowEditing,transform:e,soup:t,cancelPanDrag:i.cancelPanDrag,onCreateEditEvent:i.onCreateEditEvent,onModifyEditEvent:i.onModifyEditEvent,children:Ke.jsx(Dun,{transform:e,focusOnHover:i.focusOnHover,children:Ke.jsx(tAn,{elements:t,children:Ke.jsx(Oun,{transform:e,elements:t,children:Ke.jsx(Wun,{transform:e,soup:t,children:Ke.jsx(Mun,{transform:e,debugGraphics:i.debugGraphics,children:Ke.jsx(Run,{transform:e,elements:t,children:Ke.jsx(Qun,{transform:e,primitives:s,width:i.width,height:i.height,grid:i.grid})})})})})})})})})})},iAn=Ad(mh(400,300),CE(40,-40)),rAn=({circuitJson:i,debugGraphics:e,height:t=600,initialState:n,allowEditing:r=!0,editEvents:a,onEditEventsChanged:o,focusOnHover:s=!1,clickToInteractEnabled:l=!1})=>{const[u,d]=it.useState(!l),[f,p]=rge(),[m,y]=it.useState(iAn),{ref:x,setTransform:E,cancelDrag:b}=uun({transform:m,onSetTransform:y,enabled:u});let[Q,M]=it.useState([]);Q=a??Q;const L=it.useRef(!1),V=it.useRef(null),Y=`${(i==null?void 0:i.length)||0}_${(i==null?void 0:i.editCount)||0}`,q=()=>{const ce=(p==null?void 0:p.width)>0?p:{width:500,height:500},{center:le,width:_e,height:ye}=$.some(Ie=>Ie.type.startsWith("pcb_"))?eun($.filter(Ie=>Ie.type.startsWith("pcb_"))):{center:{x:0,y:0},width:.001,height:.001},he=Math.min((ce.width??0)/_e,(ce.height??0)/ye,100)*.75,xe=Ad(mh((ce.width??0)/2,(ce.height??0)/2),CE(he,-he,0,0),mh(-le.x,-le.y));E(xe)};it.useEffect(()=>{p!=null&&p.width&&i&&i.length!==0&&(L.current||(q(),L.current=!0))},[i,p]);const K=it.useMemo(()=>(i==null?void 0:i.filter(ce=>ce.type.startsWith("pcb_")||ce.type.startsWith("source_")))??[],[Y]),$=it.useMemo(()=>fon({circuitJson:K,editEvents:Q}),[K,Q]),j=ce=>{M([...Q,ce]),o==null||o([...Q,ce])},ue=ce=>{const le=Q.map(_e=>_e.edit_event_id===ce.edit_event_id?{..._e,...ce}:_e);M(le),o==null||o(le)};return Ke.jsxs("div",{ref:x,style:{position:"relative"},children:[Ke.jsx("div",{ref:f,children:Ke.jsxs(nun,{initialState:n,children:[Ke.jsx(nAn,{transform:m,height:t,width:p.width,allowEditing:r,focusOnHover:s,cancelPanDrag:b,onCreateEditEvent:j,onModifyEditEvent:ue,grid:{spacing:1,view_window:{left:0,right:p.width||500,top:t,bottom:0}},elements:$,debugGraphics:e},p.width),Ke.jsx(run,{})]})}),l&&!u&&Ke.jsx("div",{onClick:()=>{d(!0),q()},onTouchStart:ce=>{const le=ce.touches[0];V.current={x:le.clientX,y:le.clientY}},onTouchEnd:ce=>{const le=ce.changedTouches[0],_e=V.current;if(!_e)return;const ye=Math.abs(le.clientX-_e.x),he=Math.abs(le.clientY-_e.y);ye<10&&he<10&&(ce.preventDefault(),d(!0),q()),V.current=null},style:{position:"absolute",inset:0,cursor:"pointer",zIndex:Ix.clickToInteractOverlay,display:"flex",alignItems:"center",justifyContent:"center",touchAction:"pan-x pan-y pinch-zoom"},children:Ke.jsx("div",{style:{backgroundColor:"rgba(0, 0, 0, 0.8)",color:"white",padding:"12px 24px",borderRadius:"8px",fontSize:"16px",pointerEvents:"none"},children:typeof window<"u"&&("ontouchstart"in window||navigator.maxTouchPoints>0)?"Touch to Interact":"Click to Interact"})})]})};const aAn=({containerClassName:i,...e})=>{const t=it.useRef(null),[n,r]=it.useState(620);return it.useLayoutEffect(()=>{const a=()=>{if(t.current){const s=t.current.clientHeight,l=window.innerHeight;r(Math.min(Math.max(s,620),l))}};a();const o=new ResizeObserver(a);return t.current&&o.observe(t.current),window.addEventListener("resize",a),()=>{o.disconnect(),window.removeEventListener("resize",a)}},[]),Ke.jsx("div",{ref:t,className:i||"rf-w-full rf-h-full",children:Ke.jsx(rAn,{...e,height:n})})},oAn='*,:after,:before{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgba(59,130,246,.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }::backdrop{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgba(59,130,246,.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }/*! tailwindcss v3.4.17 | MIT License | https://tailwindcss.com*/*,:after,:before{border:0 solid #e5e7eb;box-sizing:border-box}:after,:before{--tw-content:""}:host,html{line-height:1.5;-webkit-text-size-adjust:100%;font-family:ui-sans-serif,system-ui,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;font-feature-settings:normal;font-variation-settings:normal;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-tap-highlight-color:transparent}body{line-height:inherit;margin:0}hr{border-top-width:1px;color:inherit;height:0}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,pre,samp{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-feature-settings:normal;font-size:1em;font-variation-settings:normal}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{border-collapse:collapse;border-color:inherit;text-indent:0}button,input,optgroup,select,textarea{color:inherit;font-family:inherit;font-feature-settings:inherit;font-size:100%;font-variation-settings:inherit;font-weight:inherit;letter-spacing:inherit;line-height:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([type=submit]){-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dd,dl,figure,h1,h2,h3,h4,h5,h6,hr,p,pre{margin:0}fieldset{margin:0}fieldset,legend{padding:0}menu,ol,ul{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{color:#9ca3af;opacity:1}input::placeholder,textarea::placeholder{color:#9ca3af;opacity:1}[role=button],button{cursor:pointer}:disabled{cursor:default}audio,canvas,embed,iframe,img,object,svg,video{display:block;vertical-align:middle}img,video{height:auto;max-width:100%}[hidden]:where(:not([hidden=until-found])){display:none}:root{--radius:0.5rem}.rf-pointer-events-none{pointer-events:none}.rf-invisible{visibility:hidden}.rf-fixed{position:fixed}.rf-absolute{position:absolute}.rf-relative{position:relative}.rf-inset-0{inset:0}.-rf-left-2{left:-.5rem}.-rf-right-10{right:-2.5rem}.-rf-right-2{right:-.5rem}.-rf-right-4{right:-1rem}.-rf-right-6{right:-1.5rem}.-rf-right-7{right:-1.75rem}.-rf-right-8{right:-2rem}.-rf-right-9{right:-2.25rem}.rf-bottom-full{bottom:100%}.rf-left-0{left:0}.rf-left-1{left:.25rem}.rf-left-1\\/2{left:50%}.rf-left-2{left:.5rem}.rf-left-\\[50\\%\\]{left:50%}.rf-right-0{right:0}.rf-right-4{right:1rem}.rf-right-\\[4px\\]{right:4px}.rf-top-0{top:0}.rf-top-1{top:.25rem}.rf-top-2{top:.5rem}.rf-top-2\\.5{top:.625rem}.rf-top-\\[50\\%\\]{top:50%}.rf-top-\\[6px\\]{top:6px}.\\!rf-z-\\[101\\]{z-index:101!important}.rf-z-50{z-index:50}.rf-z-\\[100\\]{z-index:100}.-rf-mx-1,.rf--mx-1{margin-left:-.25rem;margin-right:-.25rem}.rf-mx-1{margin-left:.25rem;margin-right:.25rem}.rf-mx-2{margin-left:.5rem;margin-right:.5rem}.rf-mx-auto{margin-left:auto;margin-right:auto}.rf-my-1{margin-bottom:.25rem;margin-top:.25rem}.rf-my-12{margin-bottom:3rem;margin-top:3rem}.rf-my-4{margin-bottom:1rem;margin-top:1rem}.rf-my-auto{margin-bottom:auto;margin-top:auto}.rf-mb-1{margin-bottom:.25rem}.rf-mb-12{margin-bottom:3rem}.rf-mb-2{margin-bottom:.5rem}.rf-mb-3{margin-bottom:.75rem}.rf-mb-4{margin-bottom:1rem}.rf-mb-6{margin-bottom:1.5rem}.rf-mb-8{margin-bottom:2rem}.rf-ml-1{margin-left:.25rem}.rf-ml-2{margin-left:.5rem}.rf-ml-auto{margin-left:auto}.rf-mr-1{margin-right:.25rem}.rf-mr-2{margin-right:.5rem}.rf-mt-0{margin-top:0}.rf-mt-0\\.5{margin-top:.125rem}.rf-mt-1{margin-top:.25rem}.rf-mt-2{margin-top:.5rem}.rf-mt-3{margin-top:.75rem}.rf-mt-4{margin-top:1rem}.rf-mt-5{margin-top:1.25rem}.rf-mt-auto{margin-top:auto}.rf-block{display:block}.rf-inline{display:inline}.rf-flex{display:flex}.rf-inline-flex{display:inline-flex}.rf-grid{display:grid}.rf-hidden{display:none}.rf-aspect-square{aspect-ratio:1/1}.rf-aspect-video{aspect-ratio:16/9}.rf-size-14{height:3.5rem;width:3.5rem}.rf-size-4{height:1rem;width:1rem}.\\!rf-h-2{height:.5rem!important}.\\!rf-h-2\\.5{height:.625rem!important}.\\!rf-h-3{height:.75rem!important}.\\!rf-h-full{height:100%!important}.rf-h-1{height:.25rem}.rf-h-10{height:2.5rem}.rf-h-12{height:3rem}.rf-h-2{height:.5rem}.rf-h-2\\.5{height:.625rem}.rf-h-3{height:.75rem}.rf-h-3\\.5{height:.875rem}.rf-h-4{height:1rem}.rf-h-5{height:1.25rem}.rf-h-6{height:1.5rem}.rf-h-60{height:15rem}.rf-h-64{height:16rem}.rf-h-8{height:2rem}.rf-h-9{height:2.25rem}.rf-h-\\[400px\\]{height:400px}.rf-h-\\[620px\\]{height:620px}.rf-h-\\[calc\\(100vh-52px\\)\\]{height:calc(100vh - 52px)}.rf-h-\\[calc\\(100vh-96px\\)\\]{height:calc(100vh - 96px)}.rf-h-\\[var\\(--radix-select-trigger-height\\)\\]{height:var(--radix-select-trigger-height)}.rf-h-fit{height:-moz-fit-content;height:fit-content}.rf-h-full{height:100%}.rf-h-px{height:1px}.\\!rf-max-h-\\[40vh\\]{max-height:40vh!important}.rf-max-h-32{max-height:8rem}.rf-max-h-96{max-height:24rem}.rf-max-h-\\[500px\\]{max-height:500px}.rf-max-h-\\[90vh\\]{max-height:90vh}.rf-max-h-full{max-height:100%}.rf-min-h-0{min-height:0}.rf-min-h-\\[200px\\]{min-height:200px}.rf-min-h-\\[620px\\]{min-height:620px}.rf-min-h-\\[calc\\(100vh-240px\\)\\]{min-height:calc(100vh - 240px)}.\\!rf-w-2{width:.5rem!important}.\\!rf-w-2\\.5{width:.625rem!important}.rf-w-1{width:.25rem}.rf-w-1\\/2{width:50%}.rf-w-11{width:2.75rem}.rf-w-11\\/12{width:91.666667%}.rf-w-12{width:3rem}.rf-w-16{width:4rem}.rf-w-2{width:.5rem}.rf-w-2\\.5{width:.625rem}.rf-w-3{width:.75rem}.rf-w-3\\.5{width:.875rem}.rf-w-32{width:8rem}.rf-w-4{width:1rem}.rf-w-48{width:12rem}.rf-w-5{width:1.25rem}.rf-w-6{width:1.5rem}.rf-w-64{width:16rem}.rf-w-72{width:18rem}.rf-w-8{width:2rem}.rf-w-9{width:2.25rem}.rf-w-96{width:24rem}.rf-w-\\[95\\%\\]{width:95%}.rf-w-fit{width:-moz-fit-content;width:fit-content}.rf-w-full{width:100%}.rf-min-w-0{min-width:0}.rf-min-w-10{min-width:2.5rem}.rf-min-w-16{min-width:4rem}.rf-min-w-\\[148px\\]{min-width:148px}.rf-min-w-\\[8rem\\]{min-width:8rem}.rf-min-w-\\[var\\(--radix-select-trigger-width\\)\\]{min-width:var(--radix-select-trigger-width)}.\\!rf-max-w-\\[660px\\]{max-width:660px!important}.rf-max-w-2xl{max-width:42rem}.rf-max-w-3xl{max-width:48rem}.rf-max-w-4xl{max-width:56rem}.rf-max-w-5xl{max-width:64rem}.rf-max-w-full{max-width:100%}.rf-max-w-lg{max-width:32rem}.rf-max-w-md{max-width:28rem}.rf-max-w-none{max-width:none}.rf-max-w-xl{max-width:36rem}.rf-flex-1{flex:1 1 0%}.rf-flex-shrink-0,.rf-shrink-0{flex-shrink:0}.rf-flex-grow{flex-grow:1}.rf-table-auto{table-layout:auto}.-rf-translate-x-1{--tw-translate-x:-0.25rem}.-rf-translate-x-1,.-rf-translate-x-1\\/2{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.-rf-translate-x-1\\/2{--tw-translate-x:-50%}.-rf-translate-y-1{--tw-translate-y:-0.25rem}.-rf-translate-y-1,.rf--translate-x-1{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.rf--translate-x-1{--tw-translate-x:-0.25rem}.rf-translate-x-\\[-50\\%\\]{--tw-translate-x:-50%}.rf-translate-x-\\[-50\\%\\],.rf-translate-y-\\[-50\\%\\]{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.rf-translate-y-\\[-50\\%\\]{--tw-translate-y:-50%}.rf-transform{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}@keyframes rf-pulse{50%{opacity:.5}}.rf-animate-pulse{animation:rf-pulse 2s cubic-bezier(.4,0,.6,1) infinite}@keyframes rf-spin{to{transform:rotate(1turn)}}.rf-animate-spin{animation:rf-spin 1s linear infinite}.rf-cursor-default{cursor:default}.rf-cursor-not-allowed{cursor:not-allowed}.rf-cursor-pointer{cursor:pointer}.rf-select-none{-webkit-user-select:none;-moz-user-select:none;user-select:none}.rf-grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))}.rf-grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.rf-flex-row{flex-direction:row}.rf-flex-col{flex-direction:column}.rf-flex-col-reverse{flex-direction:column-reverse}.rf-flex-wrap{flex-wrap:wrap}.rf-place-items-center{place-items:center}.rf-items-start{align-items:flex-start}.rf-items-end{align-items:flex-end}.rf-items-center{align-items:center}.rf-justify-end{justify-content:flex-end}.rf-justify-center{justify-content:center}.rf-justify-between{justify-content:space-between}.rf-gap-0{gap:0}.rf-gap-1{gap:.25rem}.rf-gap-2{gap:.5rem}.rf-gap-3{gap:.75rem}.rf-gap-4{gap:1rem}.rf-gap-5{gap:1.25rem}.rf-gap-6{gap:1.5rem}.rf-gap-8{gap:2rem}.rf-space-x-2>:not([hidden])~:not([hidden]){--tw-space-x-reverse:0;margin-left:calc(.5rem*(1 - var(--tw-space-x-reverse)));margin-right:calc(.5rem*var(--tw-space-x-reverse))}.rf-space-y-2>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-bottom:calc(.5rem*var(--tw-space-y-reverse));margin-top:calc(.5rem*(1 - var(--tw-space-y-reverse)))}.rf-space-y-3>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-bottom:calc(.75rem*var(--tw-space-y-reverse));margin-top:calc(.75rem*(1 - var(--tw-space-y-reverse)))}.rf-space-y-4>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-bottom:calc(1rem*var(--tw-space-y-reverse));margin-top:calc(1rem*(1 - var(--tw-space-y-reverse)))}.rf-space-y-6>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-bottom:calc(1.5rem*var(--tw-space-y-reverse));margin-top:calc(1.5rem*(1 - var(--tw-space-y-reverse)))}.rf-divide-y>:not([hidden])~:not([hidden]){--tw-divide-y-reverse:0;border-bottom-width:calc(1px*var(--tw-divide-y-reverse));border-top-width:calc(1px*(1 - var(--tw-divide-y-reverse)))}.rf-overflow-auto{overflow:auto}.rf-overflow-hidden{overflow:hidden}.rf-overflow-visible{overflow:visible}.rf-overflow-x-auto{overflow-x:auto}.\\!rf-overflow-y-auto{overflow-y:auto!important}.rf-overflow-y-auto{overflow-y:auto}.rf-overflow-x-hidden{overflow-x:hidden}.rf-overflow-x-clip{overflow-x:clip}.rf-truncate{overflow:hidden;text-overflow:ellipsis}.rf-truncate,.rf-whitespace-nowrap{white-space:nowrap}.rf-whitespace-pre-wrap{white-space:pre-wrap}.rf-break-words{overflow-wrap:break-word}.rf-rounded{border-radius:.25rem}.rf-rounded-2xl{border-radius:1rem}.rf-rounded-full{border-radius:9999px}.rf-rounded-lg{border-radius:var(--radius)}.rf-rounded-md{border-radius:calc(var(--radius) - 2px)}.rf-rounded-sm{border-radius:calc(var(--radius) - 4px)}.rf-rounded-xl{border-radius:.75rem}.rf-border{border-width:1px}.rf-border-b{border-bottom-width:1px}.rf-border-t{border-top-width:1px}.rf-border-blue-200{--tw-border-opacity:1;border-color:rgb(191 219 254/var(--tw-border-opacity,1))}.rf-border-blue-500{--tw-border-opacity:1;border-color:rgb(59 130 246/var(--tw-border-opacity,1))}.rf-border-blue-600{--tw-border-opacity:1;border-color:rgb(37 99 235/var(--tw-border-opacity,1))}.rf-border-gray-200{--tw-border-opacity:1;border-color:rgb(229 231 235/var(--tw-border-opacity,1))}.rf-border-gray-300{--tw-border-opacity:1;border-color:rgb(209 213 219/var(--tw-border-opacity,1))}.rf-border-green-200{--tw-border-opacity:1;border-color:rgb(187 247 208/var(--tw-border-opacity,1))}.rf-border-input{border-color:hsl(var(--input))}.rf-border-neutral-200{--tw-border-opacity:1;border-color:rgb(229 229 229/var(--tw-border-opacity,1))}.rf-border-orange-200{--tw-border-opacity:1;border-color:rgb(254 215 170/var(--tw-border-opacity,1))}.rf-border-primary{border-color:hsl(var(--primary))}.rf-border-red-200{--tw-border-opacity:1;border-color:rgb(254 202 202/var(--tw-border-opacity,1))}.rf-border-red-500{--tw-border-opacity:1;border-color:rgb(239 68 68/var(--tw-border-opacity,1))}.rf-border-zinc-200{--tw-border-opacity:1;border-color:rgb(228 228 231/var(--tw-border-opacity,1))}.rf-border-zinc-900{--tw-border-opacity:1;border-color:rgb(24 24 27/var(--tw-border-opacity,1))}.rf-bg-background{background-color:hsl(var(--background))}.rf-bg-black{--tw-bg-opacity:1;background-color:rgb(0 0 0/var(--tw-bg-opacity,1))}.rf-bg-black\\/80{background-color:rgba(0,0,0,.8)}.rf-bg-blue-100{--tw-bg-opacity:1;background-color:rgb(219 234 254/var(--tw-bg-opacity,1))}.rf-bg-blue-50{--tw-bg-opacity:1;background-color:rgb(239 246 255/var(--tw-bg-opacity,1))}.rf-bg-blue-500{--tw-bg-opacity:1;background-color:rgb(59 130 246/var(--tw-bg-opacity,1))}.rf-bg-blue-600{--tw-bg-opacity:1;background-color:rgb(37 99 235/var(--tw-bg-opacity,1))}.rf-bg-gray-100{--tw-bg-opacity:1;background-color:rgb(243 244 246/var(--tw-bg-opacity,1))}.rf-bg-gray-200{--tw-bg-opacity:1;background-color:rgb(229 231 235/var(--tw-bg-opacity,1))}.rf-bg-gray-300{--tw-bg-opacity:1;background-color:rgb(209 213 219/var(--tw-bg-opacity,1))}.rf-bg-gray-400{--tw-bg-opacity:1;background-color:rgb(156 163 175/var(--tw-bg-opacity,1))}.rf-bg-gray-50{--tw-bg-opacity:1;background-color:rgb(249 250 251/var(--tw-bg-opacity,1))}.rf-bg-gray-500{--tw-bg-opacity:1;background-color:rgb(107 114 128/var(--tw-bg-opacity,1))}.rf-bg-gray-700{--tw-bg-opacity:1;background-color:rgb(55 65 81/var(--tw-bg-opacity,1))}.rf-bg-gray-800{--tw-bg-opacity:1;background-color:rgb(31 41 55/var(--tw-bg-opacity,1))}.rf-bg-gray-900{--tw-bg-opacity:1;background-color:rgb(17 24 39/var(--tw-bg-opacity,1))}.rf-bg-green-100{--tw-bg-opacity:1;background-color:rgb(220 252 231/var(--tw-bg-opacity,1))}.rf-bg-green-50{--tw-bg-opacity:1;background-color:rgb(240 253 244/var(--tw-bg-opacity,1))}.rf-bg-muted{background-color:hsl(var(--muted))}.rf-bg-neutral-100{--tw-bg-opacity:1;background-color:rgb(245 245 245/var(--tw-bg-opacity,1))}.rf-bg-neutral-50{--tw-bg-opacity:1;background-color:rgb(250 250 250/var(--tw-bg-opacity,1))}.rf-bg-neutral-800{--tw-bg-opacity:1;background-color:rgb(38 38 38/var(--tw-bg-opacity,1))}.rf-bg-neutral-900{--tw-bg-opacity:1;background-color:rgb(23 23 23/var(--tw-bg-opacity,1))}.rf-bg-orange-400{--tw-bg-opacity:1;background-color:rgb(251 146 60/var(--tw-bg-opacity,1))}.rf-bg-orange-50{--tw-bg-opacity:1;background-color:rgb(255 247 237/var(--tw-bg-opacity,1))}.rf-bg-popover{background-color:hsl(var(--popover))}.rf-bg-red-100{--tw-bg-opacity:1;background-color:rgb(254 226 226/var(--tw-bg-opacity,1))}.rf-bg-red-50{--tw-bg-opacity:1;background-color:rgb(254 242 242/var(--tw-bg-opacity,1))}.rf-bg-red-500{--tw-bg-opacity:1;background-color:rgb(239 68 68/var(--tw-bg-opacity,1))}.rf-bg-red-900{--tw-bg-opacity:1;background-color:rgb(127 29 29/var(--tw-bg-opacity,1))}.rf-bg-white{--tw-bg-opacity:1;background-color:rgb(255 255 255/var(--tw-bg-opacity,1))}.rf-bg-yellow-100{--tw-bg-opacity:1;background-color:rgb(254 249 195/var(--tw-bg-opacity,1))}.rf-bg-zinc-100{--tw-bg-opacity:1;background-color:rgb(244 244 245/var(--tw-bg-opacity,1))}.rf-bg-zinc-200{--tw-bg-opacity:1;background-color:rgb(228 228 231/var(--tw-bg-opacity,1))}.rf-bg-zinc-50{--tw-bg-opacity:1;background-color:rgb(250 250 250/var(--tw-bg-opacity,1))}.rf-bg-zinc-800{--tw-bg-opacity:1;background-color:rgb(39 39 42/var(--tw-bg-opacity,1))}.rf-bg-zinc-900{--tw-bg-opacity:1;background-color:rgb(24 24 27/var(--tw-bg-opacity,1))}.rf-bg-opacity-50{--tw-bg-opacity:0.5}.rf-fill-current{fill:currentColor}.rf-object-contain{-o-object-fit:contain;object-fit:contain}.rf-object-cover{-o-object-fit:cover;object-fit:cover}.\\!rf-p-0{padding:0!important}.rf-p-0{padding:0}.rf-p-1{padding:.25rem}.rf-p-2{padding:.5rem}.rf-p-3{padding:.75rem}.rf-p-4{padding:1rem}.rf-p-5{padding:1.25rem}.rf-p-6{padding:1.5rem}.rf-p-8{padding:2rem}.rf-px-1{padding-left:.25rem;padding-right:.25rem}.rf-px-2{padding-left:.5rem;padding-right:.5rem}.rf-px-3{padding-left:.75rem;padding-right:.75rem}.rf-px-4{padding-left:1rem;padding-right:1rem}.rf-px-6{padding-left:1.5rem;padding-right:1.5rem}.rf-px-8{padding-left:2rem;padding-right:2rem}.rf-py-0{padding-bottom:0;padding-top:0}.rf-py-0\\.5{padding-bottom:.125rem;padding-top:.125rem}.rf-py-1{padding-bottom:.25rem;padding-top:.25rem}.rf-py-1\\.5{padding-bottom:.375rem;padding-top:.375rem}.rf-py-10{padding-bottom:2.5rem;padding-top:2.5rem}.rf-py-12{padding-bottom:3rem;padding-top:3rem}.rf-py-2{padding-bottom:.5rem;padding-top:.5rem}.rf-py-3{padding-bottom:.75rem;padding-top:.75rem}.rf-py-4{padding-bottom:1rem;padding-top:1rem}.rf-py-8{padding-bottom:2rem;padding-top:2rem}.rf-pb-0{padding-bottom:0}.rf-pb-2{padding-bottom:.5rem}.rf-pb-3{padding-bottom:.75rem}.rf-pb-4{padding-bottom:1rem}.rf-pl-2{padding-left:.5rem}.rf-pl-4{padding-left:1rem}.rf-pl-8{padding-left:2rem}.rf-pr-2{padding-right:.5rem}.rf-pt-2{padding-top:.5rem}.rf-pt-4{padding-top:1rem}.rf-text-left{text-align:left}.rf-text-center{text-align:center}.rf-text-right{text-align:right}.rf-font-mono{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace}.rf-text-2xl{font-size:1.5rem;line-height:2rem}.rf-text-3xl{font-size:1.875rem;line-height:2.25rem}.rf-text-\\[8px\\]{font-size:8px}.rf-text-base{font-size:1rem;line-height:1.5rem}.rf-text-lg{font-size:1.125rem;line-height:1.75rem}.rf-text-sm{font-size:.875rem;line-height:1.25rem}.rf-text-xl{font-size:1.25rem;line-height:1.75rem}.rf-text-xs{font-size:.75rem;line-height:1rem}.rf-font-bold{font-weight:700}.rf-font-medium{font-weight:500}.rf-font-semibold{font-weight:600}.rf-uppercase{text-transform:uppercase}.rf-capitalize{text-transform:capitalize}.rf-tabular-nums{--tw-numeric-spacing:tabular-nums;font-variant-numeric:var(--tw-ordinal) var(--tw-slashed-zero) var(--tw-numeric-figure) var(--tw-numeric-spacing) var(--tw-numeric-fraction)}.rf-leading-5{line-height:1.25rem}.rf-leading-none{line-height:1}.rf-leading-relaxed{line-height:1.625}.rf-leading-tight{line-height:1.25}.rf-tracking-wide{letter-spacing:.025em}.rf-tracking-widest{letter-spacing:.1em}.rf-text-black{--tw-text-opacity:1;color:rgb(0 0 0/var(--tw-text-opacity,1))}.rf-text-blue-500{--tw-text-opacity:1;color:rgb(59 130 246/var(--tw-text-opacity,1))}.rf-text-blue-600{--tw-text-opacity:1;color:rgb(37 99 235/var(--tw-text-opacity,1))}.rf-text-blue-700{--tw-text-opacity:1;color:rgb(29 78 216/var(--tw-text-opacity,1))}.rf-text-blue-800{--tw-text-opacity:1;color:rgb(30 64 175/var(--tw-text-opacity,1))}.rf-text-blue-900{--tw-text-opacity:1;color:rgb(30 58 138/var(--tw-text-opacity,1))}.rf-text-current{color:currentColor}.rf-text-gray-400{--tw-text-opacity:1;color:rgb(156 163 175/var(--tw-text-opacity,1))}.rf-text-gray-500{--tw-text-opacity:1;color:rgb(107 114 128/var(--tw-text-opacity,1))}.rf-text-gray-600{--tw-text-opacity:1;color:rgb(75 85 99/var(--tw-text-opacity,1))}.rf-text-gray-700{--tw-text-opacity:1;color:rgb(55 65 81/var(--tw-text-opacity,1))}.rf-text-gray-800{--tw-text-opacity:1;color:rgb(31 41 55/var(--tw-text-opacity,1))}.rf-text-gray-900{--tw-text-opacity:1;color:rgb(17 24 39/var(--tw-text-opacity,1))}.rf-text-green-500{--tw-text-opacity:1;color:rgb(34 197 94/var(--tw-text-opacity,1))}.rf-text-green-600{--tw-text-opacity:1;color:rgb(22 163 74/var(--tw-text-opacity,1))}.rf-text-green-700{--tw-text-opacity:1;color:rgb(21 128 61/var(--tw-text-opacity,1))}.rf-text-green-800{--tw-text-opacity:1;color:rgb(22 101 52/var(--tw-text-opacity,1))}.rf-text-green-900{--tw-text-opacity:1;color:rgb(20 83 45/var(--tw-text-opacity,1))}.rf-text-muted-foreground{color:hsl(var(--muted-foreground))}.rf-text-neutral-50{--tw-text-opacity:1;color:rgb(250 250 250/var(--tw-text-opacity,1))}.rf-text-neutral-500{--tw-text-opacity:1;color:rgb(115 115 115/var(--tw-text-opacity,1))}.rf-text-neutral-900{--tw-text-opacity:1;color:rgb(23 23 23/var(--tw-text-opacity,1))}.rf-text-neutral-950{--tw-text-opacity:1;color:rgb(10 10 10/var(--tw-text-opacity,1))}.rf-text-orange-500{--tw-text-opacity:1;color:rgb(249 115 22/var(--tw-text-opacity,1))}.rf-text-orange-600{--tw-text-opacity:1;color:rgb(234 88 12/var(--tw-text-opacity,1))}.rf-text-orange-800{--tw-text-opacity:1;color:rgb(154 52 18/var(--tw-text-opacity,1))}.rf-text-popover-foreground{color:hsl(var(--popover-foreground))}.rf-text-red-200{--tw-text-opacity:1;color:rgb(254 202 202/var(--tw-text-opacity,1))}.rf-text-red-300{--tw-text-opacity:1;color:rgb(252 165 165/var(--tw-text-opacity,1))}.rf-text-red-400{--tw-text-opacity:1;color:rgb(248 113 113/var(--tw-text-opacity,1))}.rf-text-red-500{--tw-text-opacity:1;color:rgb(239 68 68/var(--tw-text-opacity,1))}.rf-text-red-600{--tw-text-opacity:1;color:rgb(220 38 38/var(--tw-text-opacity,1))}.rf-text-red-700{--tw-text-opacity:1;color:rgb(185 28 28/var(--tw-text-opacity,1))}.rf-text-red-800{--tw-text-opacity:1;color:rgb(153 27 27/var(--tw-text-opacity,1))}.rf-text-red-900{--tw-text-opacity:1;color:rgb(127 29 29/var(--tw-text-opacity,1))}.rf-text-white{--tw-text-opacity:1;color:rgb(255 255 255/var(--tw-text-opacity,1))}.rf-text-yellow-400{--tw-text-opacity:1;color:rgb(250 204 21/var(--tw-text-opacity,1))}.rf-text-yellow-500{--tw-text-opacity:1;color:rgb(234 179 8/var(--tw-text-opacity,1))}.rf-text-yellow-900{--tw-text-opacity:1;color:rgb(113 63 18/var(--tw-text-opacity,1))}.rf-text-zinc-200{--tw-text-opacity:1;color:rgb(228 228 231/var(--tw-text-opacity,1))}.rf-text-zinc-300{--tw-text-opacity:1;color:rgb(212 212 216/var(--tw-text-opacity,1))}.rf-text-zinc-400{--tw-text-opacity:1;color:rgb(161 161 170/var(--tw-text-opacity,1))}.rf-text-zinc-50{--tw-text-opacity:1;color:rgb(250 250 250/var(--tw-text-opacity,1))}.rf-text-zinc-500{--tw-text-opacity:1;color:rgb(113 113 122/var(--tw-text-opacity,1))}.rf-text-zinc-900{--tw-text-opacity:1;color:rgb(24 24 27/var(--tw-text-opacity,1))}.rf-text-zinc-950{--tw-text-opacity:1;color:rgb(9 9 11/var(--tw-text-opacity,1))}.rf-underline{text-decoration-line:underline}.rf-line-through{text-decoration-line:line-through}.rf-underline-offset-4{text-underline-offset:4px}.rf-opacity-0{opacity:0}.rf-opacity-25{opacity:.25}.rf-opacity-30{opacity:.3}.rf-opacity-50{opacity:.5}.rf-opacity-60{opacity:.6}.rf-opacity-75{opacity:.75}.rf-shadow{--tw-shadow:0 1px 3px 0 rgba(0,0,0,.1),0 1px 2px -1px rgba(0,0,0,.1);--tw-shadow-colored:0 1px 3px 0 var(--tw-shadow-color),0 1px 2px -1px var(--tw-shadow-color)}.rf-shadow,.rf-shadow-lg{box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}.rf-shadow-lg{--tw-shadow:0 10px 15px -3px rgba(0,0,0,.1),0 4px 6px -4px rgba(0,0,0,.1);--tw-shadow-colored:0 10px 15px -3px var(--tw-shadow-color),0 4px 6px -4px var(--tw-shadow-color)}.rf-shadow-md{--tw-shadow:0 4px 6px -1px rgba(0,0,0,.1),0 2px 4px -2px rgba(0,0,0,.1);--tw-shadow-colored:0 4px 6px -1px var(--tw-shadow-color),0 2px 4px -2px var(--tw-shadow-color)}.rf-shadow-md,.rf-shadow-sm{box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}.rf-shadow-sm{--tw-shadow:0 1px 2px 0 rgba(0,0,0,.05);--tw-shadow-colored:0 1px 2px 0 var(--tw-shadow-color)}.rf-outline-none{outline:2px solid transparent;outline-offset:2px}.rf-ring-2{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000)}.rf-ring-blue-500{--tw-ring-opacity:1;--tw-ring-color:rgb(59 130 246/var(--tw-ring-opacity,1))}.rf-ring-primary{--tw-ring-color:hsl(var(--primary))}.rf-ring-offset-background{--tw-ring-offset-color:hsl(var(--background))}.rf-ring-offset-white{--tw-ring-offset-color:#fff}.rf-transition{transition-duration:.15s;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,-webkit-backdrop-filter;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter,-webkit-backdrop-filter;transition-timing-function:cubic-bezier(.4,0,.2,1)}.rf-transition-all{transition-duration:.15s;transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1)}.rf-transition-colors{transition-duration:.15s;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1)}.rf-transition-opacity{transition-duration:.15s;transition-property:opacity;transition-timing-function:cubic-bezier(.4,0,.2,1)}.rf-duration-200{transition-duration:.2s}.rf-ease-in-out{transition-timing-function:cubic-bezier(.4,0,.2,1)}@keyframes enter{0%{opacity:var(--tw-enter-opacity,1);transform:translate3d(var(--tw-enter-translate-x,0),var(--tw-enter-translate-y,0),0) scale3d(var(--tw-enter-scale,1),var(--tw-enter-scale,1),var(--tw-enter-scale,1)) rotate(var(--tw-enter-rotate,0))}}@keyframes exit{to{opacity:var(--tw-exit-opacity,1);transform:translate3d(var(--tw-exit-translate-x,0),var(--tw-exit-translate-y,0),0) scale3d(var(--tw-exit-scale,1),var(--tw-exit-scale,1),var(--tw-exit-scale,1)) rotate(var(--tw-exit-rotate,0))}}.rf-slide-in-from-left-1{--tw-enter-translate-x:-0.25rem}.rf-slide-out-to-left-1{--tw-exit-translate-x:-0.25rem}.rf-duration-200{animation-duration:.2s}.rf-ease-in-out{animation-timing-function:cubic-bezier(.4,0,.2,1)}.file\\:rf-border-0::file-selector-button{border-width:0}.file\\:rf-bg-transparent::file-selector-button{background-color:transparent}.file\\:rf-text-sm::file-selector-button{font-size:.875rem;line-height:1.25rem}.file\\:rf-font-medium::file-selector-button{font-weight:500}.placeholder\\:rf-text-zinc-500::-moz-placeholder{--tw-text-opacity:1;color:rgb(113 113 122/var(--tw-text-opacity,1))}.placeholder\\:rf-text-zinc-500::placeholder{--tw-text-opacity:1;color:rgb(113 113 122/var(--tw-text-opacity,1))}.hover\\:rf-border-blue-300:hover{--tw-border-opacity:1;border-color:rgb(147 197 253/var(--tw-border-opacity,1))}.hover\\:\\!rf-bg-transparent:hover{background-color:transparent!important}.hover\\:rf-bg-blue-700:hover{--tw-bg-opacity:1;background-color:rgb(29 78 216/var(--tw-bg-opacity,1))}.hover\\:rf-bg-red-500\\/90:hover{background-color:rgba(239,68,68,.9)}.hover\\:rf-bg-zinc-100:hover{--tw-bg-opacity:1;background-color:rgb(244 244 245/var(--tw-bg-opacity,1))}.hover\\:rf-bg-zinc-100\\/80:hover{background-color:hsla(240,5%,96%,.8)}.hover\\:rf-bg-zinc-900\\/90:hover{background-color:rgba(24,24,27,.9)}.hover\\:rf-text-red-400:hover{--tw-text-opacity:1;color:rgb(248 113 113/var(--tw-text-opacity,1))}.hover\\:rf-text-zinc-900:hover{--tw-text-opacity:1;color:rgb(24 24 27/var(--tw-text-opacity,1))}.hover\\:rf-underline:hover{text-decoration-line:underline}.focus\\:rf-bg-gray-100:focus{--tw-bg-opacity:1;background-color:rgb(243 244 246/var(--tw-bg-opacity,1))}.focus\\:rf-bg-zinc-100:focus{--tw-bg-opacity:1;background-color:rgb(244 244 245/var(--tw-bg-opacity,1))}.focus\\:rf-text-gray-900:focus{--tw-text-opacity:1;color:rgb(17 24 39/var(--tw-text-opacity,1))}.focus\\:rf-text-zinc-900:focus{--tw-text-opacity:1;color:rgb(24 24 27/var(--tw-text-opacity,1))}.focus\\:rf-outline-none:focus{outline:2px solid transparent;outline-offset:2px}.focus\\:rf-ring-2:focus{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000)}.focus\\:rf-ring-ring:focus{--tw-ring-color:hsl(var(--ring))}.focus\\:rf-ring-offset-2:focus{--tw-ring-offset-width:2px}.focus-visible\\:rf-outline-none:focus-visible{outline:2px solid transparent;outline-offset:2px}.focus-visible\\:rf-ring-1:focus-visible{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000)}.focus-visible\\:rf-ring-2:focus-visible{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000)}.focus-visible\\:rf-ring-zinc-950:focus-visible{--tw-ring-opacity:1;--tw-ring-color:rgb(9 9 11/var(--tw-ring-opacity,1))}.focus-visible\\:rf-ring-offset-2:focus-visible{--tw-ring-offset-width:2px}.disabled\\:rf-pointer-events-none:disabled{pointer-events:none}.disabled\\:rf-cursor-not-allowed:disabled{cursor:not-allowed}.disabled\\:rf-opacity-50:disabled{opacity:.5}.rf-group\\/bar:hover .group-hover\\/bar\\:rf-opacity-100{opacity:1}.data-\\[disabled\\]\\:rf-pointer-events-none[data-disabled]{pointer-events:none}.data-\\[side\\=bottom\\]\\:rf-translate-y-1[data-side=bottom]{--tw-translate-y:0.25rem}.data-\\[side\\=bottom\\]\\:rf-translate-y-1[data-side=bottom],.data-\\[side\\=left\\]\\:-rf-translate-x-1[data-side=left]{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\\[side\\=left\\]\\:-rf-translate-x-1[data-side=left]{--tw-translate-x:-0.25rem}.data-\\[side\\=right\\]\\:rf-translate-x-1[data-side=right]{--tw-translate-x:0.25rem}.data-\\[side\\=right\\]\\:rf-translate-x-1[data-side=right],.data-\\[side\\=top\\]\\:-rf-translate-y-1[data-side=top]{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\\[side\\=top\\]\\:-rf-translate-y-1[data-side=top]{--tw-translate-y:-0.25rem}.data-\\[state\\=active\\]\\:rf-bg-white[data-state=active]{--tw-bg-opacity:1;background-color:rgb(255 255 255/var(--tw-bg-opacity,1))}.data-\\[state\\=checked\\]\\:rf-bg-zinc-900[data-state=checked]{--tw-bg-opacity:1;background-color:rgb(24 24 27/var(--tw-bg-opacity,1))}.data-\\[state\\=open\\]\\:rf-bg-zinc-100[data-state=open]{--tw-bg-opacity:1;background-color:rgb(244 244 245/var(--tw-bg-opacity,1))}.data-\\[state\\=active\\]\\:rf-text-zinc-950[data-state=active]{--tw-text-opacity:1;color:rgb(9 9 11/var(--tw-text-opacity,1))}.data-\\[state\\=checked\\]\\:rf-text-zinc-50[data-state=checked]{--tw-text-opacity:1;color:rgb(250 250 250/var(--tw-text-opacity,1))}.data-\\[disabled\\]\\:rf-opacity-50[data-disabled]{opacity:.5}.data-\\[state\\=active\\]\\:rf-shadow[data-state=active]{--tw-shadow:0 1px 3px 0 rgba(0,0,0,.1),0 1px 2px -1px rgba(0,0,0,.1);--tw-shadow-colored:0 1px 3px 0 var(--tw-shadow-color),0 1px 2px -1px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}.data-\\[state\\=open\\]\\:rf-animate-in[data-state=open]{animation-duration:.15s;animation-name:enter;--tw-enter-opacity:initial;--tw-enter-scale:initial;--tw-enter-rotate:initial;--tw-enter-translate-x:initial;--tw-enter-translate-y:initial}.data-\\[state\\=closed\\]\\:rf-animate-out[data-state=closed]{animation-duration:.15s;animation-name:exit;--tw-exit-opacity:initial;--tw-exit-scale:initial;--tw-exit-rotate:initial;--tw-exit-translate-x:initial;--tw-exit-translate-y:initial}.data-\\[state\\=closed\\]\\:rf-fade-out-0[data-state=closed]{--tw-exit-opacity:0}.data-\\[state\\=open\\]\\:rf-fade-in-0[data-state=open]{--tw-enter-opacity:0}.data-\\[state\\=closed\\]\\:rf-zoom-out-95[data-state=closed]{--tw-exit-scale:.95}.data-\\[state\\=open\\]\\:rf-zoom-in-95[data-state=open]{--tw-enter-scale:.95}.data-\\[side\\=bottom\\]\\:rf-slide-in-from-top-2[data-side=bottom]{--tw-enter-translate-y:-0.5rem}.data-\\[side\\=left\\]\\:rf-slide-in-from-right-2[data-side=left]{--tw-enter-translate-x:0.5rem}.data-\\[side\\=right\\]\\:rf-slide-in-from-left-2[data-side=right]{--tw-enter-translate-x:-0.5rem}.data-\\[side\\=top\\]\\:rf-slide-in-from-bottom-2[data-side=top]{--tw-enter-translate-y:0.5rem}.data-\\[state\\=closed\\]\\:rf-slide-out-to-left-1\\/2[data-state=closed]{--tw-exit-translate-x:-50%}.data-\\[state\\=closed\\]\\:rf-slide-out-to-top-\\[48\\%\\][data-state=closed]{--tw-exit-translate-y:-48%}.data-\\[state\\=open\\]\\:rf-slide-in-from-left-1\\/2[data-state=open]{--tw-enter-translate-x:-50%}.data-\\[state\\=open\\]\\:rf-slide-in-from-top-\\[48\\%\\][data-state=open]{--tw-enter-translate-y:-48%}.dark\\:rf-border-zinc-50:is(.rf-dark *){--tw-border-opacity:1;border-color:rgb(250 250 250/var(--tw-border-opacity,1))}.dark\\:rf-border-zinc-800:is(.rf-dark *){--tw-border-opacity:1;border-color:rgb(39 39 42/var(--tw-border-opacity,1))}.dark\\:rf-bg-red-900:is(.rf-dark *){--tw-bg-opacity:1;background-color:rgb(127 29 29/var(--tw-bg-opacity,1))}.dark\\:rf-bg-zinc-50:is(.rf-dark *){--tw-bg-opacity:1;background-color:rgb(250 250 250/var(--tw-bg-opacity,1))}.dark\\:rf-bg-zinc-800:is(.rf-dark *){--tw-bg-opacity:1;background-color:rgb(39 39 42/var(--tw-bg-opacity,1))}.dark\\:rf-bg-zinc-950:is(.rf-dark *){--tw-bg-opacity:1;background-color:rgb(9 9 11/var(--tw-bg-opacity,1))}.dark\\:rf-text-zinc-400:is(.rf-dark *){--tw-text-opacity:1;color:rgb(161 161 170/var(--tw-text-opacity,1))}.dark\\:rf-text-zinc-50:is(.rf-dark *){--tw-text-opacity:1;color:rgb(250 250 250/var(--tw-text-opacity,1))}.dark\\:rf-text-zinc-900:is(.rf-dark *){--tw-text-opacity:1;color:rgb(24 24 27/var(--tw-text-opacity,1))}.dark\\:rf-placeholder-zinc-400:is(.rf-dark *)::-moz-placeholder{--tw-placeholder-opacity:1;color:rgb(161 161 170/var(--tw-placeholder-opacity,1))}.dark\\:rf-placeholder-zinc-400:is(.rf-dark *)::placeholder{--tw-placeholder-opacity:1;color:rgb(161 161 170/var(--tw-placeholder-opacity,1))}.dark\\:rf-ring-offset-zinc-950:is(.rf-dark *){--tw-ring-offset-color:#09090b}.dark\\:hover\\:rf-bg-red-900\\/90:hover:is(.rf-dark *){background-color:rgba(127,29,29,.9)}.dark\\:hover\\:rf-bg-zinc-50\\/90:hover:is(.rf-dark *){background-color:hsla(0,0%,98%,.9)}.dark\\:hover\\:rf-bg-zinc-800:hover:is(.rf-dark *){--tw-bg-opacity:1;background-color:rgb(39 39 42/var(--tw-bg-opacity,1))}.dark\\:hover\\:rf-bg-zinc-800\\/80:hover:is(.rf-dark *){background-color:rgba(39,39,42,.8)}.dark\\:hover\\:rf-text-zinc-50:hover:is(.rf-dark *){--tw-text-opacity:1;color:rgb(250 250 250/var(--tw-text-opacity,1))}.dark\\:focus\\:rf-bg-zinc-800:focus:is(.rf-dark *){--tw-bg-opacity:1;background-color:rgb(39 39 42/var(--tw-bg-opacity,1))}.dark\\:focus\\:rf-text-zinc-50:focus:is(.rf-dark *){--tw-text-opacity:1;color:rgb(250 250 250/var(--tw-text-opacity,1))}.dark\\:focus-visible\\:rf-ring-zinc-300:focus-visible:is(.rf-dark *){--tw-ring-opacity:1;--tw-ring-color:rgb(212 212 216/var(--tw-ring-opacity,1))}.dark\\:data-\\[state\\=active\\]\\:rf-bg-zinc-950[data-state=active]:is(.rf-dark *){--tw-bg-opacity:1;background-color:rgb(9 9 11/var(--tw-bg-opacity,1))}.dark\\:data-\\[state\\=checked\\]\\:rf-bg-zinc-50[data-state=checked]:is(.rf-dark *){--tw-bg-opacity:1;background-color:rgb(250 250 250/var(--tw-bg-opacity,1))}.dark\\:data-\\[state\\=open\\]\\:rf-bg-zinc-800[data-state=open]:is(.rf-dark *){--tw-bg-opacity:1;background-color:rgb(39 39 42/var(--tw-bg-opacity,1))}.dark\\:data-\\[state\\=active\\]\\:rf-text-zinc-50[data-state=active]:is(.rf-dark *){--tw-text-opacity:1;color:rgb(250 250 250/var(--tw-text-opacity,1))}.dark\\:data-\\[state\\=checked\\]\\:rf-text-zinc-900[data-state=checked]:is(.rf-dark *){--tw-text-opacity:1;color:rgb(24 24 27/var(--tw-text-opacity,1))}@media (min-width:640px){.sm\\:rf-mt-0{margin-top:0}.sm\\:rf-flex-row{flex-direction:row}.sm\\:rf-justify-end{justify-content:flex-end}.sm\\:rf-space-x-2>:not([hidden])~:not([hidden]){--tw-space-x-reverse:0;margin-left:calc(.5rem*(1 - var(--tw-space-x-reverse)));margin-right:calc(.5rem*var(--tw-space-x-reverse))}.sm\\:rf-rounded-lg{border-radius:var(--radius)}.sm\\:rf-text-left{text-align:left}}@media (min-width:768px){.md\\:rf-grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}}.\\[\\&\\>span\\]\\:rf-line-clamp-1>span{display:-webkit-box;overflow:hidden;-webkit-box-orient:vertical;-webkit-line-clamp:1}.\\[\\&\\>svg\\]\\:rf-size-4>svg{height:1rem;width:1rem}.\\[\\&\\>svg\\]\\:rf-shrink-0>svg{flex-shrink:0}.\\[\\&\\>svg\\]\\:rf-text-red-300>svg{--tw-text-opacity:1;color:rgb(252 165 165/var(--tw-text-opacity,1))}.\\[\\&\\>svg\\]\\:hover\\:rf-text-red-400:hover>svg{--tw-text-opacity:1;color:rgb(248 113 113/var(--tw-text-opacity,1))}.\\[\\&_svg\\]\\:rf-pointer-events-none svg{pointer-events:none}.\\[\\&_svg\\]\\:rf-size-4 svg{height:1rem;width:1rem}.\\[\\&_svg\\]\\:rf-shrink-0 svg{flex-shrink:0}',sAn=()=>{it.useEffect(()=>{if(document.querySelector('style[data-styles="tscircuit-runframe"]'))return;const e=document.createElement("style");e.setAttribute("data-styles","tscircuit-runframe"),e.textContent=oAn,document.head.appendChild(e)},[])},lAn=i=>{it.useEffect(()=>(i?document.body.style.overflow="hidden":document.body.style.overflow="",()=>{document.body.style.overflow=""}),[i])},IZe=i=>`hsl(${eB.indexOf(i)*137.5%360}, 70%, 50%)`,cAn=({phaseTimings:i})=>{if(!i)return null;const e=Object.values(i).reduce((t,n)=>t+n,0);return Ke.jsxs("div",{className:"rf-space-y-2 rf-w-full rf-px-4",children:[Ke.jsx("div",{className:"rf-relative rf-h-8 rf-flex rf-rounded-sm",children:eB.map(t=>{const n=i[t]||0,r=n/e*100;return Ke.jsx("div",{className:"rf-group/bar rf-relative rf-overflow-visible",style:{width:`${r}%`,backgroundColor:IZe(t)},children:Ke.jsxs("div",{className:"rf-opacity-0 group-hover/bar:rf-opacity-100 rf-transition-opacity rf-absolute rf-bottom-full rf-left-1/2 rf-transform -rf-translate-x-1/2 rf-mb-2 rf-px-2 rf-py-1 rf-text-xs rf-whitespace-nowrap rf-rounded rf-bg-gray-900 rf-text-white rf-pointer-events-none",children:[t,": ",n.toFixed(1),"ms"]})},t)})}),Ke.jsxs("div",{className:"rf-text-xs rf-text-gray-500",children:["Total: ",e.toFixed(2),"ms"]})]})},uAn=({renderLog:i})=>{const[e,t]=it.useState("chronological");if(!i)return Ke.jsx("div",{className:"rf-p-4 rf-bg-gray-100 rf-rounded-md",children:"No render log, make sure this tab is open when you render (TODO add a rerender button here)"});const n=Object.entries((i==null?void 0:i.phaseTimings)??{});e==="chronological"?n.sort((a,o)=>eB.indexOf(a[0])-eB.indexOf(o[0])):n.sort((a,o)=>o[1]-a[1]);const r=n.reduce((a,[o,s])=>a+s,0);return Ke.jsxs("div",{className:"rf-bg-white",children:[Ke.jsxs("div",{className:"rf-flex rf-justify-between rf-items-center",children:[Ke.jsx("div",{children:"Render Logs"}),Ke.jsxs("div",{className:"rf-mb-4 rf-pr-2 rf-flex rf-text-xs rf-items-center",children:[Ke.jsx("div",{className:"rf-mr-2",children:"Sort by:"}),Ke.jsxs("select",{value:e,onChange:a=>t(a.target.value),className:"rf-px-2 rf-py-1 rf-border rf-rounded rf-text-xs",children:[Ke.jsx("option",{value:"chronological",children:"Phase Order"}),Ke.jsx("option",{value:"longest",children:"Duration"})]})]})]}),Ke.jsx(cAn,{phaseTimings:i.phaseTimings}),Ke.jsxs("table",{className:"rf-w-full rf-text-xs",children:[Ke.jsx("thead",{children:Ke.jsxs("tr",{children:[Ke.jsx("th",{className:"rf-text-left rf-p-2",children:"Phase Order"}),Ke.jsx("th",{className:"rf-text-left rf-p-2",children:"Phase"}),Ke.jsx("th",{className:"rf-text-left rf-p-2",children:"Duration (ms)"})]})}),Ke.jsx("tbody",{children:n.map(([a,o])=>Ke.jsxs("tr",{children:[Ke.jsx("td",{className:"rf-p-2",children:eB.indexOf(a)}),Ke.jsx("td",{className:"rf-p-2",children:a}),Ke.jsx("td",{className:"rf-p-2",children:Ke.jsx("div",{className:"rf-w-8",children:Ke.jsx("div",{className:"rf-h-2 rf-rounded-sm",style:{backgroundColor:IZe(a),width:`${o/r*100}%`}})})}),Ke.jsx("td",{className:"rf-p-2",children:Ke.jsxs("div",{className:"rf-flex w-full",children:[Ke.jsxs("span",{className:"rf-flex-grow",children:[o,"ms"]}),Ke.jsxs("span",{className:"rf-text-gray-500 rf-pr-2",children:[(o/r*100).toFixed(1),"%"]})]})})]},a))})]})]})},_Ze=({errorMessage:i,errorStack:e,circuitJsonErrors:t})=>{it.useEffect(()=>{if(i){const n=new Error(i);e&&(n.stack=e);try{eF.captureException(n)}catch{}}},[i,e]),it.useEffect(()=>{if(t&&t.length>0)for(const n of t){const r=new Error(n.message||"Circuit JSON Error");n.stack&&(r.stack=n.stack);try{eF.captureException(r,{error_type:n.type})}catch{}}},[t])},AAn="0.0.639",sge=FBe()(OBe(i=>({lastRunEvalVersion:void 0,setLastRunEvalVersion:e=>{i({lastRunEvalVersion:e})}}),{name:"runframe-runner-store"})),dAn=["assembly","bom","circuit_json","errors","render_log"],fAn=({code:i,onRunClicked:e=void 0,errorMessage:t,errorStack:n,circuitJson:r,autoroutingGraphics:a,showRightHeaderContent:o=!0,showCodeTab:s=!1,codeTabContent:l,showJsonTab:u=!0,showRenderLogTab:d=!0,onActiveTabChange:f,renderLog:p,showImportAndFormatButtons:m=!0,className:y,headerClassName:x,leftHeaderContent:E,readOnly:b,isStreaming:Q,autoroutingLog:M,onReportAutoroutingLog:L,isRunningCode:V,hasCodeChangedSinceLastRun:Y,onEditEvent:q,editEvents:K,defaultActiveTab:$,autoRotate3dViewerDisabled:j,showSchematicDebugGrid:ue=!1,showToggleFullScreen:ce=!0,defaultToFullScreen:le=!1,activeEffectName:_e})=>{var lt;sAn();const ye=sge(dt=>dt.lastRunEvalVersion),he=it.useMemo(()=>r?r.filter(dt=>dt&&"error_type"in dt||dt.type.includes("error")):null,[r]),xe=it.useMemo(()=>r?r.filter(dt=>dt&&"warning_type"in dt||dt.type.includes("warning")):null,[r]);_Ze({errorMessage:t,errorStack:n,circuitJsonErrors:he});const[Ie,Te]=it.useState($??"pcb"),[Qe,Le]=it.useState(le);lAn(Qe);const De=it.useCallback(dt=>{Te(dt),f==null||f(dt)},[f]),je=()=>{Le(!Qe)};it.useEffect(()=>{t&&De("errors")},[t]),it.useEffect(()=>{(Ie==="code"||Ie==="errors")&&r&&!t&&De($??"pcb")},[r]);const et=it.useCallback(dt=>{window.TSCIRCUIT_3D_OBJECT_REF=dt===null?void 0:dt},[]);return Ke.jsx("div",{className:jm("flex flex-col relative rf-overflow-x-hidden",y),children:Ke.jsx("div",{className:jm("rf-md:sticky rf-md:top-2",Qe&&"rf-fixed rf-top-0 rf-left-0 rf-w-full rf-h-full rf-bg-white rf-overflow-hidden"),children:Ke.jsxs(hee,{value:Ie,onValueChange:De,className:"rf-flex-grow rf-flex rf-flex-col",children:[Ke.jsxs("div",{className:jm("rf-flex rf-items-center rf-gap-2 rf-p-2 rf-pb-0",x),children:[E,E&&Ke.jsx("div",{className:"rf-flex-grow"}),!E&&V&&Ke.jsx(z2,{className:"rf-w-4 rf-h-4 rf-animate-spin"}),!E&&Ke.jsx("div",{className:"rf-flex-grow"}),p&&p.progress!==1&&!t&&Ke.jsxs("div",{className:"rf-flex rf-items-center rf-gap-2",children:[_e?Ke.jsx("div",{className:"rf-text-xs rf-text-gray-500",children:_e}):p.lastRenderEvent&&Ke.jsx("div",{className:"rf-text-xs rf-text-gray-500",children:((lt=p.lastRenderEvent)==null?void 0:lt.phase)??""}),Ke.jsx("div",{className:"rf-w-4 rf-h-4 rf-bg-blue-500 rf-opacity-50 rf-rounded-full rf-text-white",children:Ke.jsx(z2,{className:"rf-w-4 rf-h-4 rf-animate-spin"})}),Ke.jsxs("div",{className:"rf-text-xs rf-font-bold rf-text-gray-700 rf-tabular-nums",children:[((p.progress??0)*100).toFixed(1),"%"]})]}),o&&Ke.jsxs(tF,{children:[s&&Ke.jsx(Sw,{value:"code",children:"Code"}),Ke.jsxs(Sw,{value:"pcb",className:"rf-whitespace-nowrap",children:[r&&Ke.jsx("span",{className:jm("rf-inline-flex rf-items-center rf-justify-center rf-w-2 rf-h-2 rf-mr-1 rf-text-xs rf-font-bold rf-text-white rf-rounded-full",Y?"rf-bg-gray-500":"rf-bg-blue-500")}),"PCB"]}),Ke.jsxs(Sw,{value:"schematic",className:"rf-whitespace-nowrap",children:[r&&Ke.jsx("span",{className:jm("rf-inline-flex rf-items-center rf-justify-center rf-w-2 rf-h-2 rf-mr-1 rf-text-xs rf-font-bold rf-text-white rf-rounded-full",Y?"rf-bg-gray-500":"rf-bg-blue-500")}),"Schematic"]}),Ke.jsxs(Sw,{value:"cad",children:[r&&Ke.jsx("span",{className:jm("inline-flex items-center justify-center w-2 h-2 mr-1 text-xs font-bold text-white rounded-full",Y?"rf-bg-gray-500":"rf-bg-blue-500")}),"3D"]}),!["pcb","cad","schematic"].includes(Ie)&&Ke.jsx(Sw,{value:Ie,children:PQe(Ie)}),Ke.jsxs(che,{children:[Ke.jsx(uhe,{asChild:!0,children:Ke.jsxs("div",{className:"rf-whitespace-nowrap rf-p-2 rf-mr-1 rf-cursor-pointer rf-relative",children:[Ke.jsx(M$t,{className:"rf-w-4 rf-h-4"}),(he&&he.length>0||t)&&Ke.jsx("span",{className:"rf-inline-flex rf-absolute rf-top-[6px] rf-right-[4px] rf-items-center rf-justify-center rf-w-1 rf-h-1 rf-ml-2 rf-text-[8px] rf-font-bold rf-text-white rf-bg-red-500 rf-rounded-full"})]})}),Ke.jsxs(MH,{className:"rf-*:text-xs",children:[dAn.map(dt=>Ke.jsxs(GB,{onSelect:()=>De(dt),children:[Ie!==dt&&Ke.jsx(ZHe,{className:"rf-w-3 rf-h-3 rf-opacity-30"}),Ie===dt&&Ke.jsx(gfe,{className:"rf-w-3 rf-h-3"}),Ke.jsx("div",{className:"rf-pr-2",children:PQe(dt)}),dt==="errors"&&(he&&he.length>0||t)&&Ke.jsx("span",{className:"rf-inline-flex rf-items-center rf-justify-center rf-w-3 rf-h-3 rf-ml-2 rf-text-[8px] rf-font-bold rf-text-white rf-bg-red-500 rf-rounded-full",children:t?1:he==null?void 0:he.length})]},dt)),Ke.jsx(GB,{disabled:!0,className:"rf-opacity-60 rf-cursor-default rf-select-none",children:Ke.jsxs("div",{className:"rf-pr-2 rf-text-xs rf-text-gray-500",children:["@tscircuit/runframe@",AAn.split(".").map((dt,zt)=>zt===2?parseInt(dt)+1:dt).join(".")]})}),ye&&Ke.jsx(GB,{disabled:!0,className:"rf-opacity-60 rf-cursor-default rf-select-none",children:Ke.jsxs("div",{className:"rf-pr-2 rf-text-xs rf-text-gray-500",children:["@tscircuit/eval@",ye]})})]})]})]}),ce&&Ke.jsx(tE,{onClick:je,variant:"ghost",children:Qe?Ke.jsx(T$t,{size:16}):Ke.jsx(D$t,{size:16})})]}),s&&Ke.jsx(rS,{value:"code",className:"rf-flex-grow rf-overflow-hidden",children:Ke.jsx("div",{className:"rf-h-full",children:l})}),Ke.jsx(rS,{value:"pcb",children:Ke.jsx("div",{className:jm("rf-overflow-hidden",Qe?"rf-h-[calc(100vh-52px)]":"rf-h-[620px]"),children:Ke.jsx(YD,{fallbackRender:({error:dt})=>Ke.jsx("div",{className:"rf-mt-4 rf-bg-red-50 rf-rounded-md rf-border rf-border-red-200",children:Ke.jsxs("div",{className:"rf-p-4",children:[Ke.jsx("h3",{className:"rf-text-lg rf-font-semibold rf-text-red-800 rf-mb-3",children:"Error loading PCB viewer"}),Ke.jsx("p",{className:"rf-text-xs rf-font-mono rf-whitespace-pre-wrap rf-text-red-600 rf-mt-2",children:(dt==null?void 0:dt.message)||"An unknown error occurred"})]})}),children:r?Ke.jsx(aAn,{focusOnHover:!1,circuitJson:r,debugGraphics:a,containerClassName:jm("rf-h-full rf-w-full",Qe?"rf-min-h-[calc(100vh-240px)]":"rf-min-h-[620px]"),onEditEventsChanged:dt=>{q&&dt.forEach(zt=>q(zt))}}):Ke.jsx(j2,{onRunClicked:e})})})}),Ke.jsx(rS,{value:"assembly",children:Ke.jsx("div",{className:jm("rf-overflow-auto",Qe?"rf-h-[calc(100vh-96px)]":"rf-h-[620px]"),children:Ke.jsx(YD,{fallback:Ke.jsx("div",{children:"Error loading Assembly"}),children:r?Ke.jsx(oan,{circuitJson:r,containerStyle:{height:"100%"},editingEnabled:!0,debugGrid:!0}):Ke.jsx(j2,{onRunClicked:e})})})}),Ke.jsx(rS,{value:"schematic",children:Ke.jsx("div",{className:jm("rf-overflow-auto rf-bg-white",Qe?"rf-h-[calc(100vh-96px)]":"rf-h-[620px]"),children:Ke.jsx(YD,{fallbackRender:({error:dt})=>Ke.jsx("div",{className:"rf-mt-4 rf-bg-red-50 rf-rounded-md rf-border rf-border-red-200",children:Ke.jsxs("div",{className:"rf-p-4",children:[Ke.jsx("h3",{className:"rf-text-lg rf-font-semibold rf-text-red-800 rf-mb-3",children:"Error loading Schematic"}),Ke.jsx("p",{className:"rf-text-xs rf-font-mono rf-whitespace-pre-wrap rf-text-red-600 rf-mt-2",children:(dt==null?void 0:dt.message)||"An unknown error occurred"})]})}),children:r?Ke.jsx(ian,{circuitJson:r,containerStyle:{height:"100%"},editingEnabled:!0,onEditEvent:dt=>{q==null||q(dt)},debugGrid:ue}):Ke.jsx(j2,{onRunClicked:e})})})}),Ke.jsx(rS,{value:"cad",children:Ke.jsx("div",{className:jm("rf-overflow-auto",Qe?"rf-h-[calc(100vh-96px)]":"rf-h-[620px]"),children:Ke.jsx(YD,{FallbackComponent:y$t,children:r?Ke.jsx(g$t,{ref:et,circuitJson:r,autoRotateDisabled:j}):Ke.jsx(j2,{onRunClicked:e})})})}),Ke.jsx(rS,{value:"bom",children:Ke.jsx("div",{className:jm("rf-overflow-auto",Qe?"rf-h-[calc(100vh-96px)]":"rf-h-[620px]"),children:Ke.jsx(YD,{fallbackRender:({error:dt})=>Ke.jsx("div",{className:"rf-mt-4 rf-bg-red-50 rf-rounded-md rf-border rf-border-red-200",children:Ke.jsxs("div",{className:"rf-p-4",children:[Ke.jsx("h3",{className:"rf-text-lg rf-font-semibold rf-text-red-800 rf-mb-3",children:"Error loading Bill of Materials"}),Ke.jsx("p",{className:"rf-text-xs rf-font-mono rf-whitespace-pre-wrap rf-text-red-600 rf-mt-2",children:(dt==null?void 0:dt.message)||"An unknown error occurred"})]})}),children:r?Ke.jsx(Aan,{circuitJson:r}):Ke.jsx(j2,{onRunClicked:e})})})}),Ke.jsx(rS,{value:"circuit_json",children:Ke.jsx("div",{className:jm("rf-overflow-auto",Qe?"rf-h-[calc(100vh-96px)]":"rf-h-[620px]"),children:Ke.jsx(YD,{fallback:Ke.jsx("div",{children:"Error loading JSON viewer"}),children:r?Ke.jsx(can,{elements:r}):Ke.jsx(j2,{onRunClicked:e})})})}),Ke.jsx(rS,{value:"errors",children:Ke.jsx("div",{className:jm("rf-overflow-auto",Qe?"rf-h-[calc(100vh-96px)]":"rf-h-[620px]"),children:t||he&&he.length>0||r?Ke.jsx(win,{code:i,circuitJsonErrors:he,circuitJsonWarnings:xe,errorMessage:t,errorStack:n,circuitJson:r,evalVersion:ye,autoroutingLog:M,onReportAutoroutingLog:L}):Ke.jsx(j2,{onRunClicked:e})})}),d&&Ke.jsx(rS,{value:"render_log",children:Ke.jsx(uAn,{renderLog:p})})]})})})};var QY="Dialog",[EZe,bZe]=QQ(QY),[hAn,JS]=EZe(QY),xZe=i=>{const{__scopeDialog:e,children:t,open:n,defaultOpen:r,onOpenChange:a,modal:o=!0}=i,s=it.useRef(null),l=it.useRef(null),[u,d]=f5({prop:n,defaultProp:r??!1,onChange:a,caller:QY});return Ke.jsx(hAn,{scope:e,triggerRef:s,contentRef:l,contentId:MQ(),titleId:MQ(),descriptionId:MQ(),open:u,onOpenChange:d,onOpenToggle:it.useCallback(()=>d(f=>!f),[d]),modal:o,children:t})};xZe.displayName=QY;var BZe="DialogTrigger",SZe=it.forwardRef((i,e)=>{const{__scopeDialog:t,...n}=i,r=JS(BZe,t),a=W_(e,r.triggerRef);return Ke.jsx(e1.button,{type:"button","aria-haspopup":"dialog","aria-expanded":r.open,"aria-controls":r.contentId,"data-state":uge(r.open),...n,ref:a,onClick:Pm(i.onClick,r.onOpenToggle)})});SZe.displayName=BZe;var lge="DialogPortal",[pAn,wZe]=EZe(lge,{forceMount:void 0}),QZe=i=>{const{__scopeDialog:e,forceMount:t,children:n,container:r}=i,a=JS(lge,e);return Ke.jsx(pAn,{scope:e,forceMount:t,children:it.Children.map(n,o=>Ke.jsx(Cw,{present:t||a.open,children:Ke.jsx(jfe,{asChild:!0,container:r,children:o})}))})};QZe.displayName=lge;var MY="DialogOverlay",MZe=it.forwardRef((i,e)=>{const t=wZe(MY,i.__scopeDialog),{forceMount:n=t.forceMount,...r}=i,a=JS(MY,i.__scopeDialog);return a.modal?Ke.jsx(Cw,{present:n||a.open,children:Ke.jsx(mAn,{...r,ref:e})}):null});MZe.displayName=MY;var gAn=d5("DialogOverlay.RemoveScroll"),mAn=it.forwardRef((i,e)=>{const{__scopeDialog:t,...n}=i,r=JS(MY,t);return Ke.jsx($fe,{as:gAn,allowPinchZoom:!0,shards:[r.contentRef],children:Ke.jsx(e1.div,{"data-state":uge(r.open),...n,ref:e,style:{pointerEvents:"auto",...n.style}})})}),nR="DialogContent",RZe=it.forwardRef((i,e)=>{const t=wZe(nR,i.__scopeDialog),{forceMount:n=t.forceMount,...r}=i,a=JS(nR,i.__scopeDialog);return Ke.jsx(Cw,{present:n||a.open,children:a.modal?Ke.jsx(yAn,{...r,ref:e}):Ke.jsx(vAn,{...r,ref:e})})});RZe.displayName=nR;var yAn=it.forwardRef((i,e)=>{const t=JS(nR,i.__scopeDialog),n=it.useRef(null),r=W_(e,t.contentRef,n);return it.useEffect(()=>{const a=n.current;if(a)return eVe(a)},[]),Ke.jsx(DZe,{...i,ref:r,trapFocus:t.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Pm(i.onCloseAutoFocus,a=>{var o;a.preventDefault(),(o=t.triggerRef.current)==null||o.focus()}),onPointerDownOutside:Pm(i.onPointerDownOutside,a=>{const o=a.detail.originalEvent,s=o.button===0&&o.ctrlKey===!0;(o.button===2||s)&&a.preventDefault()}),onFocusOutside:Pm(i.onFocusOutside,a=>a.preventDefault())})}),vAn=it.forwardRef((i,e)=>{const t=JS(nR,i.__scopeDialog),n=it.useRef(!1),r=it.useRef(!1);return Ke.jsx(DZe,{...i,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:a=>{var o,s;(o=i.onCloseAutoFocus)==null||o.call(i,a),a.defaultPrevented||(n.current||(s=t.triggerRef.current)==null||s.focus(),a.preventDefault()),n.current=!1,r.current=!1},onInteractOutside:a=>{var l,u;(l=i.onInteractOutside)==null||l.call(i,a),a.defaultPrevented||(n.current=!0,a.detail.originalEvent.type==="pointerdown"&&(r.current=!0));const o=a.target;((u=t.triggerRef.current)==null?void 0:u.contains(o))&&a.preventDefault(),a.detail.originalEvent.type==="focusin"&&r.current&&a.preventDefault()}})}),DZe=it.forwardRef((i,e)=>{const{__scopeDialog:t,trapFocus:n,onOpenAutoFocus:r,onCloseAutoFocus:a,...o}=i,s=JS(nR,t),l=it.useRef(null),u=W_(e,l);return pYe(),Ke.jsxs(Ke.Fragment,{children:[Ke.jsx(Dfe,{asChild:!0,loop:!0,trapped:n,onMountAutoFocus:r,onUnmountAutoFocus:a,children:Ke.jsx(wfe,{role:"dialog",id:s.contentId,"aria-describedby":s.descriptionId,"aria-labelledby":s.titleId,"data-state":uge(s.open),...o,ref:u,onDismiss:()=>s.onOpenChange(!1)})}),Ke.jsxs(Ke.Fragment,{children:[Ke.jsx(IAn,{titleId:s.titleId}),Ke.jsx(EAn,{contentRef:l,descriptionId:s.descriptionId})]})]})}),cge="DialogTitle",NZe=it.forwardRef((i,e)=>{const{__scopeDialog:t,...n}=i,r=JS(cge,t);return Ke.jsx(e1.h2,{id:r.titleId,...n,ref:e})});NZe.displayName=cge;var TZe="DialogDescription",UZe=it.forwardRef((i,e)=>{const{__scopeDialog:t,...n}=i,r=JS(TZe,t);return Ke.jsx(e1.p,{id:r.descriptionId,...n,ref:e})});UZe.displayName=TZe;var PZe="DialogClose",LZe=it.forwardRef((i,e)=>{const{__scopeDialog:t,...n}=i,r=JS(PZe,t);return Ke.jsx(e1.button,{type:"button",...n,ref:e,onClick:Pm(i.onClick,()=>r.onOpenChange(!1))})});LZe.displayName=PZe;function uge(i){return i?"open":"closed"}var kZe="DialogTitleWarning",[CAn,GZe]=Vxt(kZe,{contentName:nR,titleName:cge,docsSlug:"dialog"}),IAn=({titleId:i})=>{const e=GZe(kZe),t=`\`${e.contentName}\` requires a \`${e.titleName}\` for the component to be accessible for screen reader users.
13749
+ `,onClick:n=>{n.stopPropagation(),t()},children:[Ke.jsx("input",{type:"checkbox",checked:e}),Ke.jsx("span",{style:{color:"#eee"},children:i})]}),tAn=({children:i,elements:e})=>{const[t,n]=ME(K=>[K.is_mouse_over_container,K.setIsMouseOverContainer]),[r,a]=it.useState(!1),[o,s]=it.useState(!1),[l,u]=it.useState(!1),[d,f]=ME(K=>[K.selected_layer,K.selectLayer]),[p,m,y,x,E,b]=ME(K=>[K.in_move_footprint_mode,K.in_draw_trace_mode,K.is_showing_rats_nest,K.is_showing_multiple_traces_length,K.is_showing_autorouting,K.is_showing_drc_errors]),Q=ME(K=>K.setEditMode),M=ME(K=>K.setIsShowingRatsNest),L=ME(K=>K.setIsShowingMultipleTracesLength),V=ME(K=>K.setIsShowingAutorouting),Y=ME(K=>K.setIsShowingDrcErrors);XM("1",()=>f("top")),XM("2",()=>f("bottom")),XM("3",()=>f("inner1")),XM("4",()=>f("inner2")),XM("5",()=>f("inner3")),XM("6",()=>f("inner4")),XM("7",()=>f("inner5")),XM("8",()=>f("inner6"));const q=(e==null?void 0:e.filter(K=>K.type.includes("error")).length)??0;return Ke.jsxs("div",{style:{position:"relative"},onMouseEnter:()=>{n(!0)},onMouseLeave:K=>{n(!1),s(!1)},children:[i,Ke.jsxs("div",{style:{position:"absolute",bottom:4,right:8,pointerEvents:"none",color:"white",fontSize:11,opacity:t?.5:0,transition:"opacity 1s",transitionDelay:"2s",fontFamily:"sans-serif"},children:["@tscircuit/pcb-viewer@",$un.version]}),Ke.jsxs("div",{style:{position:"absolute",opacity:t?1:0,top:16,left:16,transition:t?"opacity 100ms linear":"opacity 1s linear",zIndex:Ix.toolbarOverlay,color:"red",display:"flex",fontSize:12,height:100,fontFamily:"sans-serif"},children:[Ke.jsxs(hN,{onClick:()=>{s(!o)},onMouseLeave:()=>{o&&s(!1)},children:[Ke.jsxs("div",{children:["layer:"," ",Ke.jsx("span",{style:{marginLeft:2,fontWeight:500,color:fN[d]},children:d})]}),o&&Ke.jsx("div",{style:{marginTop:4,minWidth:120},children:ege.map(K=>K.replace(/-/g,"")).map(K=>Ke.jsx(eAn,{name:K,selected:K===d,onClick:()=>{f(K.replace(/-/,""))}},K))})]}),Ke.jsxs(hN,{style:q>0?{color:"red"}:{},onClick:()=>u(!l),onMouseLeave:()=>u(!1),children:[Ke.jsxs("div",{children:[q," errors"]}),l&&Ke.jsx("div",{style:{display:"grid",gridTemplateColumns:"100px 300px"},children:e==null?void 0:e.filter(K=>K.type.includes("error")).map((K,$)=>Ke.jsxs(it.Fragment,{children:[Ke.jsx("div",{children:K.error_type}),Ke.jsx("div",{children:K.message})]},$))})]}),Ke.jsx(hN,{style:{},onClick:()=>{Q(m?"off":"draw_trace")},children:Ke.jsxs("div",{children:[m?"✖ ":"","Edit Traces"]})}),Ke.jsx(hN,{style:{},onClick:()=>{Q(p?"off":"move_footprint")},children:Ke.jsxs("div",{children:[p?"✖ ":"","Move Components"]})}),Ke.jsx(hN,{style:{},onClick:()=>{M(!y)},children:Ke.jsxs("div",{children:[y?"✖ ":"","Rats Nest"]})}),Ke.jsx(hN,{onClick:()=>{a(!r)},children:Ke.jsxs("div",{children:[Ke.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"4px"},children:["View"," ",Ke.jsx("span",{style:{fontSize:"8px",transform:r?"rotate(180deg)":"rotate(0)",transition:"transform 0.1s ease",display:"inline-block"},children:"▼"})]}),r&&Ke.jsxs("div",{style:{marginTop:4,minWidth:120},children:[Ke.jsx(oge,{label:"Show All Trace Lengths",checked:x,onClick:()=>{L(!x)}}),Ke.jsx(oge,{label:"Show Autorouting Animation",checked:E,onClick:()=>{V(!E)}}),Ke.jsx(oge,{label:"Show DRC Errors",checked:b,onClick:()=>{Y(!b)}})]})]})})]})]})},nAn=i=>{const{transform:e,elements:t}=i,[n,r]=it.useMemo(()=>{const u=i.elements.flatMap(f=>fun(f,i.elements)),d=RS(i.elements);return[u,d]},[i.elements]),[a,o]=it.useState({drawingObjectIdsWithMouseOver:new Set,primitiveIdsInMousedOverNet:[]}),s=it.useMemo(()=>Aun({primitivesWithoutInteractionMetadata:n,drawingObjectIdsWithMouseOver:a.drawingObjectIdsWithMouseOver,primitiveIdsInMousedOverNet:a.primitiveIdsInMousedOverNet}),[n,a]),l=it.useCallback(u=>{var p,m;const d=[];for(const y of u)if(y._element){const x=r.getNetConnectedToId("pcb_port_id"in y._element?(p=y._element)==null?void 0:p.pcb_port_id:"pcb_trace_id"in y._element?(m=y._element)==null?void 0:m.pcb_trace_id:"");d.push(...r.getIdsConnectedToNet(x))}const f=new Set(u.map(y=>y._pcb_drawing_object_id));o({drawingObjectIdsWithMouseOver:f,primitiveIdsInMousedOverNet:d})},[r]);return Ke.jsx(Xun,{elements:t,transform:e,primitives:n,onMouseHoverOverPrimitives:l,children:Ke.jsx(Tun,{disabled:!i.allowEditing,transform:e,soup:t,cancelPanDrag:i.cancelPanDrag,onCreateEditEvent:i.onCreateEditEvent,onModifyEditEvent:i.onModifyEditEvent,children:Ke.jsx(kun,{disabled:!i.allowEditing,transform:e,soup:t,cancelPanDrag:i.cancelPanDrag,onCreateEditEvent:i.onCreateEditEvent,onModifyEditEvent:i.onModifyEditEvent,children:Ke.jsx(Dun,{transform:e,focusOnHover:i.focusOnHover,children:Ke.jsx(tAn,{elements:t,children:Ke.jsx(Oun,{transform:e,elements:t,children:Ke.jsx(Wun,{transform:e,soup:t,children:Ke.jsx(Mun,{transform:e,debugGraphics:i.debugGraphics,children:Ke.jsx(Run,{transform:e,elements:t,children:Ke.jsx(Qun,{transform:e,primitives:s,width:i.width,height:i.height,grid:i.grid})})})})})})})})})})},iAn=Ad(mh(400,300),CE(40,-40)),rAn=({circuitJson:i,debugGraphics:e,height:t=600,initialState:n,allowEditing:r=!0,editEvents:a,onEditEventsChanged:o,focusOnHover:s=!1,clickToInteractEnabled:l=!1})=>{const[u,d]=it.useState(!l),[f,p]=rge(),[m,y]=it.useState(iAn),{ref:x,setTransform:E,cancelDrag:b}=uun({transform:m,onSetTransform:y,enabled:u});let[Q,M]=it.useState([]);Q=a??Q;const L=it.useRef(!1),V=it.useRef(null),Y=`${(i==null?void 0:i.length)||0}_${(i==null?void 0:i.editCount)||0}`,q=()=>{const ce=(p==null?void 0:p.width)>0?p:{width:500,height:500},{center:le,width:_e,height:ye}=$.some(Ie=>Ie.type.startsWith("pcb_"))?eun($.filter(Ie=>Ie.type.startsWith("pcb_"))):{center:{x:0,y:0},width:.001,height:.001},he=Math.min((ce.width??0)/_e,(ce.height??0)/ye,100)*.75,xe=Ad(mh((ce.width??0)/2,(ce.height??0)/2),CE(he,-he,0,0),mh(-le.x,-le.y));E(xe)};it.useEffect(()=>{p!=null&&p.width&&i&&i.length!==0&&(L.current||(q(),L.current=!0))},[i,p]);const K=it.useMemo(()=>(i==null?void 0:i.filter(ce=>ce.type.startsWith("pcb_")||ce.type.startsWith("source_")))??[],[Y]),$=it.useMemo(()=>fon({circuitJson:K,editEvents:Q}),[K,Q]),j=ce=>{M([...Q,ce]),o==null||o([...Q,ce])},ue=ce=>{const le=Q.map(_e=>_e.edit_event_id===ce.edit_event_id?{..._e,...ce}:_e);M(le),o==null||o(le)};return Ke.jsxs("div",{ref:x,style:{position:"relative"},children:[Ke.jsx("div",{ref:f,children:Ke.jsxs(nun,{initialState:n,children:[Ke.jsx(nAn,{transform:m,height:t,width:p.width,allowEditing:r,focusOnHover:s,cancelPanDrag:b,onCreateEditEvent:j,onModifyEditEvent:ue,grid:{spacing:1,view_window:{left:0,right:p.width||500,top:t,bottom:0}},elements:$,debugGraphics:e},p.width),Ke.jsx(run,{})]})}),l&&!u&&Ke.jsx("div",{onClick:()=>{d(!0),q()},onTouchStart:ce=>{const le=ce.touches[0];V.current={x:le.clientX,y:le.clientY}},onTouchEnd:ce=>{const le=ce.changedTouches[0],_e=V.current;if(!_e)return;const ye=Math.abs(le.clientX-_e.x),he=Math.abs(le.clientY-_e.y);ye<10&&he<10&&(ce.preventDefault(),d(!0),q()),V.current=null},style:{position:"absolute",inset:0,cursor:"pointer",zIndex:Ix.clickToInteractOverlay,display:"flex",alignItems:"center",justifyContent:"center",touchAction:"pan-x pan-y pinch-zoom"},children:Ke.jsx("div",{style:{backgroundColor:"rgba(0, 0, 0, 0.8)",color:"white",padding:"12px 24px",borderRadius:"8px",fontSize:"16px",pointerEvents:"none"},children:typeof window<"u"&&("ontouchstart"in window||navigator.maxTouchPoints>0)?"Touch to Interact":"Click to Interact"})})]})};const aAn=({containerClassName:i,...e})=>{const t=it.useRef(null),[n,r]=it.useState(620);return it.useLayoutEffect(()=>{const a=()=>{if(t.current){const s=t.current.clientHeight,l=window.innerHeight;r(Math.min(Math.max(s,620),l))}};a();const o=new ResizeObserver(a);return t.current&&o.observe(t.current),window.addEventListener("resize",a),()=>{o.disconnect(),window.removeEventListener("resize",a)}},[]),Ke.jsx("div",{ref:t,className:i||"rf-w-full rf-h-full",children:Ke.jsx(rAn,{...e,height:n})})},oAn='*,:after,:before{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgba(59,130,246,.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }::backdrop{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgba(59,130,246,.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }/*! tailwindcss v3.4.17 | MIT License | https://tailwindcss.com*/*,:after,:before{border:0 solid #e5e7eb;box-sizing:border-box}:after,:before{--tw-content:""}:host,html{line-height:1.5;-webkit-text-size-adjust:100%;font-family:ui-sans-serif,system-ui,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;font-feature-settings:normal;font-variation-settings:normal;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-tap-highlight-color:transparent}body{line-height:inherit;margin:0}hr{border-top-width:1px;color:inherit;height:0}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,pre,samp{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-feature-settings:normal;font-size:1em;font-variation-settings:normal}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{border-collapse:collapse;border-color:inherit;text-indent:0}button,input,optgroup,select,textarea{color:inherit;font-family:inherit;font-feature-settings:inherit;font-size:100%;font-variation-settings:inherit;font-weight:inherit;letter-spacing:inherit;line-height:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([type=submit]){-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dd,dl,figure,h1,h2,h3,h4,h5,h6,hr,p,pre{margin:0}fieldset{margin:0}fieldset,legend{padding:0}menu,ol,ul{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{color:#9ca3af;opacity:1}input::placeholder,textarea::placeholder{color:#9ca3af;opacity:1}[role=button],button{cursor:pointer}:disabled{cursor:default}audio,canvas,embed,iframe,img,object,svg,video{display:block;vertical-align:middle}img,video{height:auto;max-width:100%}[hidden]:where(:not([hidden=until-found])){display:none}:root{--radius:0.5rem}.rf-pointer-events-none{pointer-events:none}.rf-invisible{visibility:hidden}.rf-fixed{position:fixed}.rf-absolute{position:absolute}.rf-relative{position:relative}.rf-inset-0{inset:0}.-rf-left-2{left:-.5rem}.-rf-right-10{right:-2.5rem}.-rf-right-2{right:-.5rem}.-rf-right-4{right:-1rem}.-rf-right-6{right:-1.5rem}.-rf-right-7{right:-1.75rem}.-rf-right-8{right:-2rem}.-rf-right-9{right:-2.25rem}.rf-bottom-full{bottom:100%}.rf-left-0{left:0}.rf-left-1{left:.25rem}.rf-left-1\\/2{left:50%}.rf-left-2{left:.5rem}.rf-left-\\[50\\%\\]{left:50%}.rf-right-0{right:0}.rf-right-4{right:1rem}.rf-right-\\[4px\\]{right:4px}.rf-top-0{top:0}.rf-top-1{top:.25rem}.rf-top-2{top:.5rem}.rf-top-2\\.5{top:.625rem}.rf-top-\\[50\\%\\]{top:50%}.rf-top-\\[6px\\]{top:6px}.\\!rf-z-\\[101\\]{z-index:101!important}.rf-z-50{z-index:50}.rf-z-\\[100\\]{z-index:100}.-rf-mx-1,.rf--mx-1{margin-left:-.25rem;margin-right:-.25rem}.rf-mx-1{margin-left:.25rem;margin-right:.25rem}.rf-mx-2{margin-left:.5rem;margin-right:.5rem}.rf-mx-auto{margin-left:auto;margin-right:auto}.rf-my-1{margin-bottom:.25rem;margin-top:.25rem}.rf-my-12{margin-bottom:3rem;margin-top:3rem}.rf-my-4{margin-bottom:1rem;margin-top:1rem}.rf-my-auto{margin-bottom:auto;margin-top:auto}.rf-mb-1{margin-bottom:.25rem}.rf-mb-12{margin-bottom:3rem}.rf-mb-2{margin-bottom:.5rem}.rf-mb-3{margin-bottom:.75rem}.rf-mb-4{margin-bottom:1rem}.rf-mb-6{margin-bottom:1.5rem}.rf-mb-8{margin-bottom:2rem}.rf-ml-1{margin-left:.25rem}.rf-ml-2{margin-left:.5rem}.rf-ml-auto{margin-left:auto}.rf-mr-1{margin-right:.25rem}.rf-mr-2{margin-right:.5rem}.rf-mt-0{margin-top:0}.rf-mt-0\\.5{margin-top:.125rem}.rf-mt-1{margin-top:.25rem}.rf-mt-2{margin-top:.5rem}.rf-mt-3{margin-top:.75rem}.rf-mt-4{margin-top:1rem}.rf-mt-5{margin-top:1.25rem}.rf-mt-auto{margin-top:auto}.rf-block{display:block}.rf-inline{display:inline}.rf-flex{display:flex}.rf-inline-flex{display:inline-flex}.rf-grid{display:grid}.rf-hidden{display:none}.rf-aspect-square{aspect-ratio:1/1}.rf-aspect-video{aspect-ratio:16/9}.rf-size-14{height:3.5rem;width:3.5rem}.rf-size-4{height:1rem;width:1rem}.\\!rf-h-2{height:.5rem!important}.\\!rf-h-2\\.5{height:.625rem!important}.\\!rf-h-3{height:.75rem!important}.\\!rf-h-full{height:100%!important}.rf-h-1{height:.25rem}.rf-h-10{height:2.5rem}.rf-h-12{height:3rem}.rf-h-2{height:.5rem}.rf-h-2\\.5{height:.625rem}.rf-h-3{height:.75rem}.rf-h-3\\.5{height:.875rem}.rf-h-4{height:1rem}.rf-h-5{height:1.25rem}.rf-h-6{height:1.5rem}.rf-h-60{height:15rem}.rf-h-64{height:16rem}.rf-h-8{height:2rem}.rf-h-9{height:2.25rem}.rf-h-\\[400px\\]{height:400px}.rf-h-\\[calc\\(100vh-52px\\)\\]{height:calc(100vh - 52px)}.rf-h-\\[calc\\(100vh-96px\\)\\]{height:calc(100vh - 96px)}.rf-h-\\[var\\(--radix-select-trigger-height\\)\\]{height:var(--radix-select-trigger-height)}.rf-h-fit{height:-moz-fit-content;height:fit-content}.rf-h-full{height:100%}.rf-h-px{height:1px}.\\!rf-max-h-\\[40vh\\]{max-height:40vh!important}.rf-max-h-32{max-height:8rem}.rf-max-h-96{max-height:24rem}.rf-max-h-\\[500px\\]{max-height:500px}.rf-max-h-\\[90vh\\]{max-height:90vh}.rf-max-h-full{max-height:100%}.rf-min-h-0{min-height:0}.rf-min-h-\\[200px\\]{min-height:200px}.rf-min-h-\\[620px\\]{min-height:620px}.rf-min-h-\\[calc\\(100vh-240px\\)\\]{min-height:calc(100vh - 240px)}.\\!rf-w-2{width:.5rem!important}.\\!rf-w-2\\.5{width:.625rem!important}.rf-w-1{width:.25rem}.rf-w-1\\/2{width:50%}.rf-w-11{width:2.75rem}.rf-w-11\\/12{width:91.666667%}.rf-w-12{width:3rem}.rf-w-16{width:4rem}.rf-w-2{width:.5rem}.rf-w-2\\.5{width:.625rem}.rf-w-3{width:.75rem}.rf-w-3\\.5{width:.875rem}.rf-w-32{width:8rem}.rf-w-4{width:1rem}.rf-w-48{width:12rem}.rf-w-5{width:1.25rem}.rf-w-6{width:1.5rem}.rf-w-64{width:16rem}.rf-w-72{width:18rem}.rf-w-8{width:2rem}.rf-w-9{width:2.25rem}.rf-w-96{width:24rem}.rf-w-\\[95\\%\\]{width:95%}.rf-w-fit{width:-moz-fit-content;width:fit-content}.rf-w-full{width:100%}.rf-min-w-0{min-width:0}.rf-min-w-10{min-width:2.5rem}.rf-min-w-16{min-width:4rem}.rf-min-w-\\[148px\\]{min-width:148px}.rf-min-w-\\[8rem\\]{min-width:8rem}.rf-min-w-\\[var\\(--radix-select-trigger-width\\)\\]{min-width:var(--radix-select-trigger-width)}.\\!rf-max-w-\\[660px\\]{max-width:660px!important}.rf-max-w-2xl{max-width:42rem}.rf-max-w-3xl{max-width:48rem}.rf-max-w-4xl{max-width:56rem}.rf-max-w-5xl{max-width:64rem}.rf-max-w-full{max-width:100%}.rf-max-w-lg{max-width:32rem}.rf-max-w-md{max-width:28rem}.rf-max-w-none{max-width:none}.rf-max-w-xl{max-width:36rem}.rf-flex-1{flex:1 1 0%}.rf-flex-shrink-0,.rf-shrink-0{flex-shrink:0}.rf-flex-grow{flex-grow:1}.rf-table-auto{table-layout:auto}.-rf-translate-x-1{--tw-translate-x:-0.25rem}.-rf-translate-x-1,.-rf-translate-x-1\\/2{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.-rf-translate-x-1\\/2{--tw-translate-x:-50%}.-rf-translate-y-1{--tw-translate-y:-0.25rem}.-rf-translate-y-1,.rf--translate-x-1{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.rf--translate-x-1{--tw-translate-x:-0.25rem}.rf-translate-x-\\[-50\\%\\]{--tw-translate-x:-50%}.rf-translate-x-\\[-50\\%\\],.rf-translate-y-\\[-50\\%\\]{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.rf-translate-y-\\[-50\\%\\]{--tw-translate-y:-50%}.rf-transform{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}@keyframes rf-pulse{50%{opacity:.5}}.rf-animate-pulse{animation:rf-pulse 2s cubic-bezier(.4,0,.6,1) infinite}@keyframes rf-spin{to{transform:rotate(1turn)}}.rf-animate-spin{animation:rf-spin 1s linear infinite}.rf-cursor-default{cursor:default}.rf-cursor-not-allowed{cursor:not-allowed}.rf-cursor-pointer{cursor:pointer}.rf-select-none{-webkit-user-select:none;-moz-user-select:none;user-select:none}.rf-grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))}.rf-grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.rf-flex-row{flex-direction:row}.rf-flex-col{flex-direction:column}.rf-flex-col-reverse{flex-direction:column-reverse}.rf-flex-wrap{flex-wrap:wrap}.rf-place-items-center{place-items:center}.rf-items-start{align-items:flex-start}.rf-items-end{align-items:flex-end}.rf-items-center{align-items:center}.rf-justify-end{justify-content:flex-end}.rf-justify-center{justify-content:center}.rf-justify-between{justify-content:space-between}.rf-gap-0{gap:0}.rf-gap-1{gap:.25rem}.rf-gap-2{gap:.5rem}.rf-gap-3{gap:.75rem}.rf-gap-4{gap:1rem}.rf-gap-5{gap:1.25rem}.rf-gap-6{gap:1.5rem}.rf-gap-8{gap:2rem}.rf-space-x-2>:not([hidden])~:not([hidden]){--tw-space-x-reverse:0;margin-left:calc(.5rem*(1 - var(--tw-space-x-reverse)));margin-right:calc(.5rem*var(--tw-space-x-reverse))}.rf-space-y-2>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-bottom:calc(.5rem*var(--tw-space-y-reverse));margin-top:calc(.5rem*(1 - var(--tw-space-y-reverse)))}.rf-space-y-3>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-bottom:calc(.75rem*var(--tw-space-y-reverse));margin-top:calc(.75rem*(1 - var(--tw-space-y-reverse)))}.rf-space-y-4>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-bottom:calc(1rem*var(--tw-space-y-reverse));margin-top:calc(1rem*(1 - var(--tw-space-y-reverse)))}.rf-space-y-6>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-bottom:calc(1.5rem*var(--tw-space-y-reverse));margin-top:calc(1.5rem*(1 - var(--tw-space-y-reverse)))}.rf-divide-y>:not([hidden])~:not([hidden]){--tw-divide-y-reverse:0;border-bottom-width:calc(1px*var(--tw-divide-y-reverse));border-top-width:calc(1px*(1 - var(--tw-divide-y-reverse)))}.rf-overflow-auto{overflow:auto}.rf-overflow-hidden{overflow:hidden}.rf-overflow-visible{overflow:visible}.rf-overflow-x-auto{overflow-x:auto}.\\!rf-overflow-y-auto{overflow-y:auto!important}.rf-overflow-y-auto{overflow-y:auto}.rf-overflow-x-hidden{overflow-x:hidden}.rf-overflow-x-clip{overflow-x:clip}.rf-truncate{overflow:hidden;text-overflow:ellipsis}.rf-truncate,.rf-whitespace-nowrap{white-space:nowrap}.rf-whitespace-pre-wrap{white-space:pre-wrap}.rf-break-words{overflow-wrap:break-word}.rf-rounded{border-radius:.25rem}.rf-rounded-2xl{border-radius:1rem}.rf-rounded-full{border-radius:9999px}.rf-rounded-lg{border-radius:var(--radius)}.rf-rounded-md{border-radius:calc(var(--radius) - 2px)}.rf-rounded-sm{border-radius:calc(var(--radius) - 4px)}.rf-rounded-xl{border-radius:.75rem}.rf-border{border-width:1px}.rf-border-b{border-bottom-width:1px}.rf-border-t{border-top-width:1px}.rf-border-blue-200{--tw-border-opacity:1;border-color:rgb(191 219 254/var(--tw-border-opacity,1))}.rf-border-blue-500{--tw-border-opacity:1;border-color:rgb(59 130 246/var(--tw-border-opacity,1))}.rf-border-blue-600{--tw-border-opacity:1;border-color:rgb(37 99 235/var(--tw-border-opacity,1))}.rf-border-gray-200{--tw-border-opacity:1;border-color:rgb(229 231 235/var(--tw-border-opacity,1))}.rf-border-gray-300{--tw-border-opacity:1;border-color:rgb(209 213 219/var(--tw-border-opacity,1))}.rf-border-green-200{--tw-border-opacity:1;border-color:rgb(187 247 208/var(--tw-border-opacity,1))}.rf-border-input{border-color:hsl(var(--input))}.rf-border-neutral-200{--tw-border-opacity:1;border-color:rgb(229 229 229/var(--tw-border-opacity,1))}.rf-border-orange-200{--tw-border-opacity:1;border-color:rgb(254 215 170/var(--tw-border-opacity,1))}.rf-border-primary{border-color:hsl(var(--primary))}.rf-border-red-200{--tw-border-opacity:1;border-color:rgb(254 202 202/var(--tw-border-opacity,1))}.rf-border-red-500{--tw-border-opacity:1;border-color:rgb(239 68 68/var(--tw-border-opacity,1))}.rf-border-zinc-200{--tw-border-opacity:1;border-color:rgb(228 228 231/var(--tw-border-opacity,1))}.rf-border-zinc-900{--tw-border-opacity:1;border-color:rgb(24 24 27/var(--tw-border-opacity,1))}.rf-bg-background{background-color:hsl(var(--background))}.rf-bg-black{--tw-bg-opacity:1;background-color:rgb(0 0 0/var(--tw-bg-opacity,1))}.rf-bg-black\\/80{background-color:rgba(0,0,0,.8)}.rf-bg-blue-100{--tw-bg-opacity:1;background-color:rgb(219 234 254/var(--tw-bg-opacity,1))}.rf-bg-blue-50{--tw-bg-opacity:1;background-color:rgb(239 246 255/var(--tw-bg-opacity,1))}.rf-bg-blue-500{--tw-bg-opacity:1;background-color:rgb(59 130 246/var(--tw-bg-opacity,1))}.rf-bg-blue-600{--tw-bg-opacity:1;background-color:rgb(37 99 235/var(--tw-bg-opacity,1))}.rf-bg-gray-100{--tw-bg-opacity:1;background-color:rgb(243 244 246/var(--tw-bg-opacity,1))}.rf-bg-gray-200{--tw-bg-opacity:1;background-color:rgb(229 231 235/var(--tw-bg-opacity,1))}.rf-bg-gray-300{--tw-bg-opacity:1;background-color:rgb(209 213 219/var(--tw-bg-opacity,1))}.rf-bg-gray-400{--tw-bg-opacity:1;background-color:rgb(156 163 175/var(--tw-bg-opacity,1))}.rf-bg-gray-50{--tw-bg-opacity:1;background-color:rgb(249 250 251/var(--tw-bg-opacity,1))}.rf-bg-gray-500{--tw-bg-opacity:1;background-color:rgb(107 114 128/var(--tw-bg-opacity,1))}.rf-bg-gray-700{--tw-bg-opacity:1;background-color:rgb(55 65 81/var(--tw-bg-opacity,1))}.rf-bg-gray-800{--tw-bg-opacity:1;background-color:rgb(31 41 55/var(--tw-bg-opacity,1))}.rf-bg-gray-900{--tw-bg-opacity:1;background-color:rgb(17 24 39/var(--tw-bg-opacity,1))}.rf-bg-green-100{--tw-bg-opacity:1;background-color:rgb(220 252 231/var(--tw-bg-opacity,1))}.rf-bg-green-50{--tw-bg-opacity:1;background-color:rgb(240 253 244/var(--tw-bg-opacity,1))}.rf-bg-muted{background-color:hsl(var(--muted))}.rf-bg-neutral-100{--tw-bg-opacity:1;background-color:rgb(245 245 245/var(--tw-bg-opacity,1))}.rf-bg-neutral-50{--tw-bg-opacity:1;background-color:rgb(250 250 250/var(--tw-bg-opacity,1))}.rf-bg-neutral-800{--tw-bg-opacity:1;background-color:rgb(38 38 38/var(--tw-bg-opacity,1))}.rf-bg-neutral-900{--tw-bg-opacity:1;background-color:rgb(23 23 23/var(--tw-bg-opacity,1))}.rf-bg-orange-400{--tw-bg-opacity:1;background-color:rgb(251 146 60/var(--tw-bg-opacity,1))}.rf-bg-orange-50{--tw-bg-opacity:1;background-color:rgb(255 247 237/var(--tw-bg-opacity,1))}.rf-bg-popover{background-color:hsl(var(--popover))}.rf-bg-red-100{--tw-bg-opacity:1;background-color:rgb(254 226 226/var(--tw-bg-opacity,1))}.rf-bg-red-50{--tw-bg-opacity:1;background-color:rgb(254 242 242/var(--tw-bg-opacity,1))}.rf-bg-red-500{--tw-bg-opacity:1;background-color:rgb(239 68 68/var(--tw-bg-opacity,1))}.rf-bg-red-900{--tw-bg-opacity:1;background-color:rgb(127 29 29/var(--tw-bg-opacity,1))}.rf-bg-white{--tw-bg-opacity:1;background-color:rgb(255 255 255/var(--tw-bg-opacity,1))}.rf-bg-yellow-100{--tw-bg-opacity:1;background-color:rgb(254 249 195/var(--tw-bg-opacity,1))}.rf-bg-zinc-100{--tw-bg-opacity:1;background-color:rgb(244 244 245/var(--tw-bg-opacity,1))}.rf-bg-zinc-200{--tw-bg-opacity:1;background-color:rgb(228 228 231/var(--tw-bg-opacity,1))}.rf-bg-zinc-50{--tw-bg-opacity:1;background-color:rgb(250 250 250/var(--tw-bg-opacity,1))}.rf-bg-zinc-800{--tw-bg-opacity:1;background-color:rgb(39 39 42/var(--tw-bg-opacity,1))}.rf-bg-zinc-900{--tw-bg-opacity:1;background-color:rgb(24 24 27/var(--tw-bg-opacity,1))}.rf-bg-opacity-50{--tw-bg-opacity:0.5}.rf-fill-current{fill:currentColor}.rf-object-contain{-o-object-fit:contain;object-fit:contain}.rf-object-cover{-o-object-fit:cover;object-fit:cover}.\\!rf-p-0{padding:0!important}.rf-p-0{padding:0}.rf-p-1{padding:.25rem}.rf-p-2{padding:.5rem}.rf-p-3{padding:.75rem}.rf-p-4{padding:1rem}.rf-p-5{padding:1.25rem}.rf-p-6{padding:1.5rem}.rf-p-8{padding:2rem}.rf-px-1{padding-left:.25rem;padding-right:.25rem}.rf-px-2{padding-left:.5rem;padding-right:.5rem}.rf-px-3{padding-left:.75rem;padding-right:.75rem}.rf-px-4{padding-left:1rem;padding-right:1rem}.rf-px-6{padding-left:1.5rem;padding-right:1.5rem}.rf-px-8{padding-left:2rem;padding-right:2rem}.rf-py-0{padding-bottom:0;padding-top:0}.rf-py-0\\.5{padding-bottom:.125rem;padding-top:.125rem}.rf-py-1{padding-bottom:.25rem;padding-top:.25rem}.rf-py-1\\.5{padding-bottom:.375rem;padding-top:.375rem}.rf-py-10{padding-bottom:2.5rem;padding-top:2.5rem}.rf-py-12{padding-bottom:3rem;padding-top:3rem}.rf-py-2{padding-bottom:.5rem;padding-top:.5rem}.rf-py-3{padding-bottom:.75rem;padding-top:.75rem}.rf-py-4{padding-bottom:1rem;padding-top:1rem}.rf-py-8{padding-bottom:2rem;padding-top:2rem}.rf-pb-0{padding-bottom:0}.rf-pb-2{padding-bottom:.5rem}.rf-pb-3{padding-bottom:.75rem}.rf-pb-4{padding-bottom:1rem}.rf-pl-2{padding-left:.5rem}.rf-pl-4{padding-left:1rem}.rf-pl-8{padding-left:2rem}.rf-pr-2{padding-right:.5rem}.rf-pt-2{padding-top:.5rem}.rf-pt-4{padding-top:1rem}.rf-text-left{text-align:left}.rf-text-center{text-align:center}.rf-text-right{text-align:right}.rf-font-mono{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace}.rf-text-2xl{font-size:1.5rem;line-height:2rem}.rf-text-3xl{font-size:1.875rem;line-height:2.25rem}.rf-text-\\[8px\\]{font-size:8px}.rf-text-base{font-size:1rem;line-height:1.5rem}.rf-text-lg{font-size:1.125rem;line-height:1.75rem}.rf-text-sm{font-size:.875rem;line-height:1.25rem}.rf-text-xl{font-size:1.25rem;line-height:1.75rem}.rf-text-xs{font-size:.75rem;line-height:1rem}.rf-font-bold{font-weight:700}.rf-font-medium{font-weight:500}.rf-font-semibold{font-weight:600}.rf-uppercase{text-transform:uppercase}.rf-capitalize{text-transform:capitalize}.rf-tabular-nums{--tw-numeric-spacing:tabular-nums;font-variant-numeric:var(--tw-ordinal) var(--tw-slashed-zero) var(--tw-numeric-figure) var(--tw-numeric-spacing) var(--tw-numeric-fraction)}.rf-leading-5{line-height:1.25rem}.rf-leading-none{line-height:1}.rf-leading-relaxed{line-height:1.625}.rf-leading-tight{line-height:1.25}.rf-tracking-wide{letter-spacing:.025em}.rf-tracking-widest{letter-spacing:.1em}.rf-text-black{--tw-text-opacity:1;color:rgb(0 0 0/var(--tw-text-opacity,1))}.rf-text-blue-500{--tw-text-opacity:1;color:rgb(59 130 246/var(--tw-text-opacity,1))}.rf-text-blue-600{--tw-text-opacity:1;color:rgb(37 99 235/var(--tw-text-opacity,1))}.rf-text-blue-700{--tw-text-opacity:1;color:rgb(29 78 216/var(--tw-text-opacity,1))}.rf-text-blue-800{--tw-text-opacity:1;color:rgb(30 64 175/var(--tw-text-opacity,1))}.rf-text-blue-900{--tw-text-opacity:1;color:rgb(30 58 138/var(--tw-text-opacity,1))}.rf-text-current{color:currentColor}.rf-text-gray-400{--tw-text-opacity:1;color:rgb(156 163 175/var(--tw-text-opacity,1))}.rf-text-gray-500{--tw-text-opacity:1;color:rgb(107 114 128/var(--tw-text-opacity,1))}.rf-text-gray-600{--tw-text-opacity:1;color:rgb(75 85 99/var(--tw-text-opacity,1))}.rf-text-gray-700{--tw-text-opacity:1;color:rgb(55 65 81/var(--tw-text-opacity,1))}.rf-text-gray-800{--tw-text-opacity:1;color:rgb(31 41 55/var(--tw-text-opacity,1))}.rf-text-gray-900{--tw-text-opacity:1;color:rgb(17 24 39/var(--tw-text-opacity,1))}.rf-text-green-500{--tw-text-opacity:1;color:rgb(34 197 94/var(--tw-text-opacity,1))}.rf-text-green-600{--tw-text-opacity:1;color:rgb(22 163 74/var(--tw-text-opacity,1))}.rf-text-green-700{--tw-text-opacity:1;color:rgb(21 128 61/var(--tw-text-opacity,1))}.rf-text-green-800{--tw-text-opacity:1;color:rgb(22 101 52/var(--tw-text-opacity,1))}.rf-text-green-900{--tw-text-opacity:1;color:rgb(20 83 45/var(--tw-text-opacity,1))}.rf-text-muted-foreground{color:hsl(var(--muted-foreground))}.rf-text-neutral-50{--tw-text-opacity:1;color:rgb(250 250 250/var(--tw-text-opacity,1))}.rf-text-neutral-500{--tw-text-opacity:1;color:rgb(115 115 115/var(--tw-text-opacity,1))}.rf-text-neutral-900{--tw-text-opacity:1;color:rgb(23 23 23/var(--tw-text-opacity,1))}.rf-text-neutral-950{--tw-text-opacity:1;color:rgb(10 10 10/var(--tw-text-opacity,1))}.rf-text-orange-500{--tw-text-opacity:1;color:rgb(249 115 22/var(--tw-text-opacity,1))}.rf-text-orange-600{--tw-text-opacity:1;color:rgb(234 88 12/var(--tw-text-opacity,1))}.rf-text-orange-800{--tw-text-opacity:1;color:rgb(154 52 18/var(--tw-text-opacity,1))}.rf-text-popover-foreground{color:hsl(var(--popover-foreground))}.rf-text-red-200{--tw-text-opacity:1;color:rgb(254 202 202/var(--tw-text-opacity,1))}.rf-text-red-300{--tw-text-opacity:1;color:rgb(252 165 165/var(--tw-text-opacity,1))}.rf-text-red-400{--tw-text-opacity:1;color:rgb(248 113 113/var(--tw-text-opacity,1))}.rf-text-red-500{--tw-text-opacity:1;color:rgb(239 68 68/var(--tw-text-opacity,1))}.rf-text-red-600{--tw-text-opacity:1;color:rgb(220 38 38/var(--tw-text-opacity,1))}.rf-text-red-700{--tw-text-opacity:1;color:rgb(185 28 28/var(--tw-text-opacity,1))}.rf-text-red-800{--tw-text-opacity:1;color:rgb(153 27 27/var(--tw-text-opacity,1))}.rf-text-red-900{--tw-text-opacity:1;color:rgb(127 29 29/var(--tw-text-opacity,1))}.rf-text-white{--tw-text-opacity:1;color:rgb(255 255 255/var(--tw-text-opacity,1))}.rf-text-yellow-400{--tw-text-opacity:1;color:rgb(250 204 21/var(--tw-text-opacity,1))}.rf-text-yellow-500{--tw-text-opacity:1;color:rgb(234 179 8/var(--tw-text-opacity,1))}.rf-text-yellow-900{--tw-text-opacity:1;color:rgb(113 63 18/var(--tw-text-opacity,1))}.rf-text-zinc-200{--tw-text-opacity:1;color:rgb(228 228 231/var(--tw-text-opacity,1))}.rf-text-zinc-300{--tw-text-opacity:1;color:rgb(212 212 216/var(--tw-text-opacity,1))}.rf-text-zinc-400{--tw-text-opacity:1;color:rgb(161 161 170/var(--tw-text-opacity,1))}.rf-text-zinc-50{--tw-text-opacity:1;color:rgb(250 250 250/var(--tw-text-opacity,1))}.rf-text-zinc-500{--tw-text-opacity:1;color:rgb(113 113 122/var(--tw-text-opacity,1))}.rf-text-zinc-900{--tw-text-opacity:1;color:rgb(24 24 27/var(--tw-text-opacity,1))}.rf-text-zinc-950{--tw-text-opacity:1;color:rgb(9 9 11/var(--tw-text-opacity,1))}.rf-underline{text-decoration-line:underline}.rf-line-through{text-decoration-line:line-through}.rf-underline-offset-4{text-underline-offset:4px}.rf-opacity-0{opacity:0}.rf-opacity-25{opacity:.25}.rf-opacity-30{opacity:.3}.rf-opacity-50{opacity:.5}.rf-opacity-60{opacity:.6}.rf-opacity-75{opacity:.75}.rf-shadow{--tw-shadow:0 1px 3px 0 rgba(0,0,0,.1),0 1px 2px -1px rgba(0,0,0,.1);--tw-shadow-colored:0 1px 3px 0 var(--tw-shadow-color),0 1px 2px -1px var(--tw-shadow-color)}.rf-shadow,.rf-shadow-lg{box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}.rf-shadow-lg{--tw-shadow:0 10px 15px -3px rgba(0,0,0,.1),0 4px 6px -4px rgba(0,0,0,.1);--tw-shadow-colored:0 10px 15px -3px var(--tw-shadow-color),0 4px 6px -4px var(--tw-shadow-color)}.rf-shadow-md{--tw-shadow:0 4px 6px -1px rgba(0,0,0,.1),0 2px 4px -2px rgba(0,0,0,.1);--tw-shadow-colored:0 4px 6px -1px var(--tw-shadow-color),0 2px 4px -2px var(--tw-shadow-color)}.rf-shadow-md,.rf-shadow-sm{box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}.rf-shadow-sm{--tw-shadow:0 1px 2px 0 rgba(0,0,0,.05);--tw-shadow-colored:0 1px 2px 0 var(--tw-shadow-color)}.rf-outline-none{outline:2px solid transparent;outline-offset:2px}.rf-ring-2{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000)}.rf-ring-blue-500{--tw-ring-opacity:1;--tw-ring-color:rgb(59 130 246/var(--tw-ring-opacity,1))}.rf-ring-primary{--tw-ring-color:hsl(var(--primary))}.rf-ring-offset-background{--tw-ring-offset-color:hsl(var(--background))}.rf-ring-offset-white{--tw-ring-offset-color:#fff}.rf-transition{transition-duration:.15s;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,-webkit-backdrop-filter;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter,-webkit-backdrop-filter;transition-timing-function:cubic-bezier(.4,0,.2,1)}.rf-transition-all{transition-duration:.15s;transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1)}.rf-transition-colors{transition-duration:.15s;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1)}.rf-transition-opacity{transition-duration:.15s;transition-property:opacity;transition-timing-function:cubic-bezier(.4,0,.2,1)}.rf-duration-200{transition-duration:.2s}.rf-ease-in-out{transition-timing-function:cubic-bezier(.4,0,.2,1)}@keyframes enter{0%{opacity:var(--tw-enter-opacity,1);transform:translate3d(var(--tw-enter-translate-x,0),var(--tw-enter-translate-y,0),0) scale3d(var(--tw-enter-scale,1),var(--tw-enter-scale,1),var(--tw-enter-scale,1)) rotate(var(--tw-enter-rotate,0))}}@keyframes exit{to{opacity:var(--tw-exit-opacity,1);transform:translate3d(var(--tw-exit-translate-x,0),var(--tw-exit-translate-y,0),0) scale3d(var(--tw-exit-scale,1),var(--tw-exit-scale,1),var(--tw-exit-scale,1)) rotate(var(--tw-exit-rotate,0))}}.rf-slide-in-from-left-1{--tw-enter-translate-x:-0.25rem}.rf-slide-out-to-left-1{--tw-exit-translate-x:-0.25rem}.rf-duration-200{animation-duration:.2s}.rf-ease-in-out{animation-timing-function:cubic-bezier(.4,0,.2,1)}.file\\:rf-border-0::file-selector-button{border-width:0}.file\\:rf-bg-transparent::file-selector-button{background-color:transparent}.file\\:rf-text-sm::file-selector-button{font-size:.875rem;line-height:1.25rem}.file\\:rf-font-medium::file-selector-button{font-weight:500}.placeholder\\:rf-text-zinc-500::-moz-placeholder{--tw-text-opacity:1;color:rgb(113 113 122/var(--tw-text-opacity,1))}.placeholder\\:rf-text-zinc-500::placeholder{--tw-text-opacity:1;color:rgb(113 113 122/var(--tw-text-opacity,1))}.hover\\:rf-border-blue-300:hover{--tw-border-opacity:1;border-color:rgb(147 197 253/var(--tw-border-opacity,1))}.hover\\:\\!rf-bg-transparent:hover{background-color:transparent!important}.hover\\:rf-bg-blue-700:hover{--tw-bg-opacity:1;background-color:rgb(29 78 216/var(--tw-bg-opacity,1))}.hover\\:rf-bg-red-500\\/90:hover{background-color:rgba(239,68,68,.9)}.hover\\:rf-bg-zinc-100:hover{--tw-bg-opacity:1;background-color:rgb(244 244 245/var(--tw-bg-opacity,1))}.hover\\:rf-bg-zinc-100\\/80:hover{background-color:hsla(240,5%,96%,.8)}.hover\\:rf-bg-zinc-900\\/90:hover{background-color:rgba(24,24,27,.9)}.hover\\:rf-text-red-400:hover{--tw-text-opacity:1;color:rgb(248 113 113/var(--tw-text-opacity,1))}.hover\\:rf-text-zinc-900:hover{--tw-text-opacity:1;color:rgb(24 24 27/var(--tw-text-opacity,1))}.hover\\:rf-underline:hover{text-decoration-line:underline}.focus\\:rf-bg-gray-100:focus{--tw-bg-opacity:1;background-color:rgb(243 244 246/var(--tw-bg-opacity,1))}.focus\\:rf-bg-zinc-100:focus{--tw-bg-opacity:1;background-color:rgb(244 244 245/var(--tw-bg-opacity,1))}.focus\\:rf-text-gray-900:focus{--tw-text-opacity:1;color:rgb(17 24 39/var(--tw-text-opacity,1))}.focus\\:rf-text-zinc-900:focus{--tw-text-opacity:1;color:rgb(24 24 27/var(--tw-text-opacity,1))}.focus\\:rf-outline-none:focus{outline:2px solid transparent;outline-offset:2px}.focus\\:rf-ring-2:focus{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000)}.focus\\:rf-ring-ring:focus{--tw-ring-color:hsl(var(--ring))}.focus\\:rf-ring-offset-2:focus{--tw-ring-offset-width:2px}.focus-visible\\:rf-outline-none:focus-visible{outline:2px solid transparent;outline-offset:2px}.focus-visible\\:rf-ring-1:focus-visible{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000)}.focus-visible\\:rf-ring-2:focus-visible{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000)}.focus-visible\\:rf-ring-zinc-950:focus-visible{--tw-ring-opacity:1;--tw-ring-color:rgb(9 9 11/var(--tw-ring-opacity,1))}.focus-visible\\:rf-ring-offset-2:focus-visible{--tw-ring-offset-width:2px}.disabled\\:rf-pointer-events-none:disabled{pointer-events:none}.disabled\\:rf-cursor-not-allowed:disabled{cursor:not-allowed}.disabled\\:rf-opacity-50:disabled{opacity:.5}.rf-group\\/bar:hover .group-hover\\/bar\\:rf-opacity-100{opacity:1}.data-\\[disabled\\]\\:rf-pointer-events-none[data-disabled]{pointer-events:none}.data-\\[side\\=bottom\\]\\:rf-translate-y-1[data-side=bottom]{--tw-translate-y:0.25rem}.data-\\[side\\=bottom\\]\\:rf-translate-y-1[data-side=bottom],.data-\\[side\\=left\\]\\:-rf-translate-x-1[data-side=left]{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\\[side\\=left\\]\\:-rf-translate-x-1[data-side=left]{--tw-translate-x:-0.25rem}.data-\\[side\\=right\\]\\:rf-translate-x-1[data-side=right]{--tw-translate-x:0.25rem}.data-\\[side\\=right\\]\\:rf-translate-x-1[data-side=right],.data-\\[side\\=top\\]\\:-rf-translate-y-1[data-side=top]{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\\[side\\=top\\]\\:-rf-translate-y-1[data-side=top]{--tw-translate-y:-0.25rem}.data-\\[state\\=active\\]\\:rf-bg-white[data-state=active]{--tw-bg-opacity:1;background-color:rgb(255 255 255/var(--tw-bg-opacity,1))}.data-\\[state\\=checked\\]\\:rf-bg-zinc-900[data-state=checked]{--tw-bg-opacity:1;background-color:rgb(24 24 27/var(--tw-bg-opacity,1))}.data-\\[state\\=open\\]\\:rf-bg-zinc-100[data-state=open]{--tw-bg-opacity:1;background-color:rgb(244 244 245/var(--tw-bg-opacity,1))}.data-\\[state\\=active\\]\\:rf-text-zinc-950[data-state=active]{--tw-text-opacity:1;color:rgb(9 9 11/var(--tw-text-opacity,1))}.data-\\[state\\=checked\\]\\:rf-text-zinc-50[data-state=checked]{--tw-text-opacity:1;color:rgb(250 250 250/var(--tw-text-opacity,1))}.data-\\[disabled\\]\\:rf-opacity-50[data-disabled]{opacity:.5}.data-\\[state\\=active\\]\\:rf-shadow[data-state=active]{--tw-shadow:0 1px 3px 0 rgba(0,0,0,.1),0 1px 2px -1px rgba(0,0,0,.1);--tw-shadow-colored:0 1px 3px 0 var(--tw-shadow-color),0 1px 2px -1px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}.data-\\[state\\=open\\]\\:rf-animate-in[data-state=open]{animation-duration:.15s;animation-name:enter;--tw-enter-opacity:initial;--tw-enter-scale:initial;--tw-enter-rotate:initial;--tw-enter-translate-x:initial;--tw-enter-translate-y:initial}.data-\\[state\\=closed\\]\\:rf-animate-out[data-state=closed]{animation-duration:.15s;animation-name:exit;--tw-exit-opacity:initial;--tw-exit-scale:initial;--tw-exit-rotate:initial;--tw-exit-translate-x:initial;--tw-exit-translate-y:initial}.data-\\[state\\=closed\\]\\:rf-fade-out-0[data-state=closed]{--tw-exit-opacity:0}.data-\\[state\\=open\\]\\:rf-fade-in-0[data-state=open]{--tw-enter-opacity:0}.data-\\[state\\=closed\\]\\:rf-zoom-out-95[data-state=closed]{--tw-exit-scale:.95}.data-\\[state\\=open\\]\\:rf-zoom-in-95[data-state=open]{--tw-enter-scale:.95}.data-\\[side\\=bottom\\]\\:rf-slide-in-from-top-2[data-side=bottom]{--tw-enter-translate-y:-0.5rem}.data-\\[side\\=left\\]\\:rf-slide-in-from-right-2[data-side=left]{--tw-enter-translate-x:0.5rem}.data-\\[side\\=right\\]\\:rf-slide-in-from-left-2[data-side=right]{--tw-enter-translate-x:-0.5rem}.data-\\[side\\=top\\]\\:rf-slide-in-from-bottom-2[data-side=top]{--tw-enter-translate-y:0.5rem}.data-\\[state\\=closed\\]\\:rf-slide-out-to-left-1\\/2[data-state=closed]{--tw-exit-translate-x:-50%}.data-\\[state\\=closed\\]\\:rf-slide-out-to-top-\\[48\\%\\][data-state=closed]{--tw-exit-translate-y:-48%}.data-\\[state\\=open\\]\\:rf-slide-in-from-left-1\\/2[data-state=open]{--tw-enter-translate-x:-50%}.data-\\[state\\=open\\]\\:rf-slide-in-from-top-\\[48\\%\\][data-state=open]{--tw-enter-translate-y:-48%}.dark\\:rf-border-zinc-50:is(.rf-dark *){--tw-border-opacity:1;border-color:rgb(250 250 250/var(--tw-border-opacity,1))}.dark\\:rf-border-zinc-800:is(.rf-dark *){--tw-border-opacity:1;border-color:rgb(39 39 42/var(--tw-border-opacity,1))}.dark\\:rf-bg-red-900:is(.rf-dark *){--tw-bg-opacity:1;background-color:rgb(127 29 29/var(--tw-bg-opacity,1))}.dark\\:rf-bg-zinc-50:is(.rf-dark *){--tw-bg-opacity:1;background-color:rgb(250 250 250/var(--tw-bg-opacity,1))}.dark\\:rf-bg-zinc-800:is(.rf-dark *){--tw-bg-opacity:1;background-color:rgb(39 39 42/var(--tw-bg-opacity,1))}.dark\\:rf-bg-zinc-950:is(.rf-dark *){--tw-bg-opacity:1;background-color:rgb(9 9 11/var(--tw-bg-opacity,1))}.dark\\:rf-text-zinc-400:is(.rf-dark *){--tw-text-opacity:1;color:rgb(161 161 170/var(--tw-text-opacity,1))}.dark\\:rf-text-zinc-50:is(.rf-dark *){--tw-text-opacity:1;color:rgb(250 250 250/var(--tw-text-opacity,1))}.dark\\:rf-text-zinc-900:is(.rf-dark *){--tw-text-opacity:1;color:rgb(24 24 27/var(--tw-text-opacity,1))}.dark\\:rf-placeholder-zinc-400:is(.rf-dark *)::-moz-placeholder{--tw-placeholder-opacity:1;color:rgb(161 161 170/var(--tw-placeholder-opacity,1))}.dark\\:rf-placeholder-zinc-400:is(.rf-dark *)::placeholder{--tw-placeholder-opacity:1;color:rgb(161 161 170/var(--tw-placeholder-opacity,1))}.dark\\:rf-ring-offset-zinc-950:is(.rf-dark *){--tw-ring-offset-color:#09090b}.dark\\:hover\\:rf-bg-red-900\\/90:hover:is(.rf-dark *){background-color:rgba(127,29,29,.9)}.dark\\:hover\\:rf-bg-zinc-50\\/90:hover:is(.rf-dark *){background-color:hsla(0,0%,98%,.9)}.dark\\:hover\\:rf-bg-zinc-800:hover:is(.rf-dark *){--tw-bg-opacity:1;background-color:rgb(39 39 42/var(--tw-bg-opacity,1))}.dark\\:hover\\:rf-bg-zinc-800\\/80:hover:is(.rf-dark *){background-color:rgba(39,39,42,.8)}.dark\\:hover\\:rf-text-zinc-50:hover:is(.rf-dark *){--tw-text-opacity:1;color:rgb(250 250 250/var(--tw-text-opacity,1))}.dark\\:focus\\:rf-bg-zinc-800:focus:is(.rf-dark *){--tw-bg-opacity:1;background-color:rgb(39 39 42/var(--tw-bg-opacity,1))}.dark\\:focus\\:rf-text-zinc-50:focus:is(.rf-dark *){--tw-text-opacity:1;color:rgb(250 250 250/var(--tw-text-opacity,1))}.dark\\:focus-visible\\:rf-ring-zinc-300:focus-visible:is(.rf-dark *){--tw-ring-opacity:1;--tw-ring-color:rgb(212 212 216/var(--tw-ring-opacity,1))}.dark\\:data-\\[state\\=active\\]\\:rf-bg-zinc-950[data-state=active]:is(.rf-dark *){--tw-bg-opacity:1;background-color:rgb(9 9 11/var(--tw-bg-opacity,1))}.dark\\:data-\\[state\\=checked\\]\\:rf-bg-zinc-50[data-state=checked]:is(.rf-dark *){--tw-bg-opacity:1;background-color:rgb(250 250 250/var(--tw-bg-opacity,1))}.dark\\:data-\\[state\\=open\\]\\:rf-bg-zinc-800[data-state=open]:is(.rf-dark *){--tw-bg-opacity:1;background-color:rgb(39 39 42/var(--tw-bg-opacity,1))}.dark\\:data-\\[state\\=active\\]\\:rf-text-zinc-50[data-state=active]:is(.rf-dark *){--tw-text-opacity:1;color:rgb(250 250 250/var(--tw-text-opacity,1))}.dark\\:data-\\[state\\=checked\\]\\:rf-text-zinc-900[data-state=checked]:is(.rf-dark *){--tw-text-opacity:1;color:rgb(24 24 27/var(--tw-text-opacity,1))}@media (min-width:640px){.sm\\:rf-mt-0{margin-top:0}.sm\\:rf-flex-row{flex-direction:row}.sm\\:rf-justify-end{justify-content:flex-end}.sm\\:rf-space-x-2>:not([hidden])~:not([hidden]){--tw-space-x-reverse:0;margin-left:calc(.5rem*(1 - var(--tw-space-x-reverse)));margin-right:calc(.5rem*var(--tw-space-x-reverse))}.sm\\:rf-rounded-lg{border-radius:var(--radius)}.sm\\:rf-text-left{text-align:left}}@media (min-width:768px){.md\\:rf-grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}}.\\[\\&\\>span\\]\\:rf-line-clamp-1>span{display:-webkit-box;overflow:hidden;-webkit-box-orient:vertical;-webkit-line-clamp:1}.\\[\\&\\>svg\\]\\:rf-size-4>svg{height:1rem;width:1rem}.\\[\\&\\>svg\\]\\:rf-shrink-0>svg{flex-shrink:0}.\\[\\&\\>svg\\]\\:rf-text-red-300>svg{--tw-text-opacity:1;color:rgb(252 165 165/var(--tw-text-opacity,1))}.\\[\\&\\>svg\\]\\:hover\\:rf-text-red-400:hover>svg{--tw-text-opacity:1;color:rgb(248 113 113/var(--tw-text-opacity,1))}.\\[\\&_svg\\]\\:rf-pointer-events-none svg{pointer-events:none}.\\[\\&_svg\\]\\:rf-size-4 svg{height:1rem;width:1rem}.\\[\\&_svg\\]\\:rf-shrink-0 svg{flex-shrink:0}',sAn=()=>{it.useEffect(()=>{if(document.querySelector('style[data-styles="tscircuit-runframe"]'))return;const e=document.createElement("style");e.setAttribute("data-styles","tscircuit-runframe"),e.textContent=oAn,document.head.appendChild(e)},[])},lAn=i=>{it.useEffect(()=>(i?document.body.style.overflow="hidden":document.body.style.overflow="",()=>{document.body.style.overflow=""}),[i])},IZe=i=>`hsl(${eB.indexOf(i)*137.5%360}, 70%, 50%)`,cAn=({phaseTimings:i})=>{if(!i)return null;const e=Object.values(i).reduce((t,n)=>t+n,0);return Ke.jsxs("div",{className:"rf-space-y-2 rf-w-full rf-px-4",children:[Ke.jsx("div",{className:"rf-relative rf-h-8 rf-flex rf-rounded-sm",children:eB.map(t=>{const n=i[t]||0,r=n/e*100;return Ke.jsx("div",{className:"rf-group/bar rf-relative rf-overflow-visible",style:{width:`${r}%`,backgroundColor:IZe(t)},children:Ke.jsxs("div",{className:"rf-opacity-0 group-hover/bar:rf-opacity-100 rf-transition-opacity rf-absolute rf-bottom-full rf-left-1/2 rf-transform -rf-translate-x-1/2 rf-mb-2 rf-px-2 rf-py-1 rf-text-xs rf-whitespace-nowrap rf-rounded rf-bg-gray-900 rf-text-white rf-pointer-events-none",children:[t,": ",n.toFixed(1),"ms"]})},t)})}),Ke.jsxs("div",{className:"rf-text-xs rf-text-gray-500",children:["Total: ",e.toFixed(2),"ms"]})]})},uAn=({renderLog:i})=>{const[e,t]=it.useState("chronological");if(!i)return Ke.jsx("div",{className:"rf-p-4 rf-bg-gray-100 rf-rounded-md",children:"No render log, make sure this tab is open when you render (TODO add a rerender button here)"});const n=Object.entries((i==null?void 0:i.phaseTimings)??{});e==="chronological"?n.sort((a,o)=>eB.indexOf(a[0])-eB.indexOf(o[0])):n.sort((a,o)=>o[1]-a[1]);const r=n.reduce((a,[o,s])=>a+s,0);return Ke.jsxs("div",{className:"rf-bg-white",children:[Ke.jsxs("div",{className:"rf-flex rf-justify-between rf-items-center",children:[Ke.jsx("div",{children:"Render Logs"}),Ke.jsxs("div",{className:"rf-mb-4 rf-pr-2 rf-flex rf-text-xs rf-items-center",children:[Ke.jsx("div",{className:"rf-mr-2",children:"Sort by:"}),Ke.jsxs("select",{value:e,onChange:a=>t(a.target.value),className:"rf-px-2 rf-py-1 rf-border rf-rounded rf-text-xs",children:[Ke.jsx("option",{value:"chronological",children:"Phase Order"}),Ke.jsx("option",{value:"longest",children:"Duration"})]})]})]}),Ke.jsx(cAn,{phaseTimings:i.phaseTimings}),Ke.jsxs("table",{className:"rf-w-full rf-text-xs",children:[Ke.jsx("thead",{children:Ke.jsxs("tr",{children:[Ke.jsx("th",{className:"rf-text-left rf-p-2",children:"Phase Order"}),Ke.jsx("th",{className:"rf-text-left rf-p-2",children:"Phase"}),Ke.jsx("th",{className:"rf-text-left rf-p-2",children:"Duration (ms)"})]})}),Ke.jsx("tbody",{children:n.map(([a,o])=>Ke.jsxs("tr",{children:[Ke.jsx("td",{className:"rf-p-2",children:eB.indexOf(a)}),Ke.jsx("td",{className:"rf-p-2",children:a}),Ke.jsx("td",{className:"rf-p-2",children:Ke.jsx("div",{className:"rf-w-8",children:Ke.jsx("div",{className:"rf-h-2 rf-rounded-sm",style:{backgroundColor:IZe(a),width:`${o/r*100}%`}})})}),Ke.jsx("td",{className:"rf-p-2",children:Ke.jsxs("div",{className:"rf-flex w-full",children:[Ke.jsxs("span",{className:"rf-flex-grow",children:[o,"ms"]}),Ke.jsxs("span",{className:"rf-text-gray-500 rf-pr-2",children:[(o/r*100).toFixed(1),"%"]})]})})]},a))})]})]})},_Ze=({errorMessage:i,errorStack:e,circuitJsonErrors:t})=>{it.useEffect(()=>{if(i){const n=new Error(i);e&&(n.stack=e);try{eF.captureException(n)}catch{}}},[i,e]),it.useEffect(()=>{if(t&&t.length>0)for(const n of t){const r=new Error(n.message||"Circuit JSON Error");n.stack&&(r.stack=n.stack);try{eF.captureException(r,{error_type:n.type})}catch{}}},[t])},AAn="0.0.641",sge=FBe()(OBe(i=>({lastRunEvalVersion:void 0,setLastRunEvalVersion:e=>{i({lastRunEvalVersion:e})}}),{name:"runframe-runner-store"})),dAn=["assembly","bom","circuit_json","errors","render_log"],fAn=({code:i,onRunClicked:e=void 0,errorMessage:t,errorStack:n,circuitJson:r,autoroutingGraphics:a,showRightHeaderContent:o=!0,showCodeTab:s=!1,codeTabContent:l,showJsonTab:u=!0,showRenderLogTab:d=!0,onActiveTabChange:f,renderLog:p,showImportAndFormatButtons:m=!0,className:y,headerClassName:x,leftHeaderContent:E,readOnly:b,isStreaming:Q,autoroutingLog:M,onReportAutoroutingLog:L,isRunningCode:V,hasCodeChangedSinceLastRun:Y,onEditEvent:q,editEvents:K,defaultActiveTab:$,autoRotate3dViewerDisabled:j,showSchematicDebugGrid:ue=!1,showToggleFullScreen:ce=!0,defaultToFullScreen:le=!1,activeEffectName:_e})=>{var lt;sAn();const ye=sge(dt=>dt.lastRunEvalVersion),he=it.useMemo(()=>r?r.filter(dt=>dt&&"error_type"in dt||dt.type.includes("error")):null,[r]),xe=it.useMemo(()=>r?r.filter(dt=>dt&&"warning_type"in dt||dt.type.includes("warning")):null,[r]);_Ze({errorMessage:t,errorStack:n,circuitJsonErrors:he});const[Ie,Te]=it.useState($??"pcb"),[Qe,Le]=it.useState(le);lAn(Qe);const De=it.useCallback(dt=>{Te(dt),f==null||f(dt)},[f]),je=()=>{Le(!Qe)};it.useEffect(()=>{t&&De("errors")},[t]),it.useEffect(()=>{(Ie==="code"||Ie==="errors")&&r&&!t&&De($??"pcb")},[r]);const et=it.useCallback(dt=>{window.TSCIRCUIT_3D_OBJECT_REF=dt===null?void 0:dt},[]);return Ke.jsx("div",{className:jm("flex flex-col relative rf-overflow-x-hidden rf-h-full",y),children:Ke.jsx("div",{className:jm("rf-md:sticky rf-md:top-2 rf-h-full",Qe&&"rf-fixed rf-top-0 rf-left-0 rf-w-full rf-h-full rf-bg-white rf-overflow-hidden"),children:Ke.jsxs(hee,{value:Ie,onValueChange:De,className:"rf-flex-grow rf-flex rf-flex-col rf-h-full",children:[Ke.jsxs("div",{className:jm("rf-flex rf-items-center rf-gap-2 rf-p-2 rf-pb-0",x),children:[E,E&&Ke.jsx("div",{className:"rf-flex-grow"}),!E&&V&&Ke.jsx(z2,{className:"rf-w-4 rf-h-4 rf-animate-spin"}),!E&&Ke.jsx("div",{className:"rf-flex-grow"}),p&&p.progress!==1&&!t&&Ke.jsxs("div",{className:"rf-flex rf-items-center rf-gap-2",children:[_e?Ke.jsx("div",{className:"rf-text-xs rf-text-gray-500",children:_e}):p.lastRenderEvent&&Ke.jsx("div",{className:"rf-text-xs rf-text-gray-500",children:((lt=p.lastRenderEvent)==null?void 0:lt.phase)??""}),Ke.jsx("div",{className:"rf-w-4 rf-h-4 rf-bg-blue-500 rf-opacity-50 rf-rounded-full rf-text-white",children:Ke.jsx(z2,{className:"rf-w-4 rf-h-4 rf-animate-spin"})}),Ke.jsxs("div",{className:"rf-text-xs rf-font-bold rf-text-gray-700 rf-tabular-nums",children:[((p.progress??0)*100).toFixed(1),"%"]})]}),o&&Ke.jsxs(tF,{children:[s&&Ke.jsx(Sw,{value:"code",children:"Code"}),Ke.jsxs(Sw,{value:"pcb",className:"rf-whitespace-nowrap",children:[r&&Ke.jsx("span",{className:jm("rf-inline-flex rf-items-center rf-justify-center rf-w-2 rf-h-2 rf-mr-1 rf-text-xs rf-font-bold rf-text-white rf-rounded-full",Y?"rf-bg-gray-500":"rf-bg-blue-500")}),"PCB"]}),Ke.jsxs(Sw,{value:"schematic",className:"rf-whitespace-nowrap",children:[r&&Ke.jsx("span",{className:jm("rf-inline-flex rf-items-center rf-justify-center rf-w-2 rf-h-2 rf-mr-1 rf-text-xs rf-font-bold rf-text-white rf-rounded-full",Y?"rf-bg-gray-500":"rf-bg-blue-500")}),"Schematic"]}),Ke.jsxs(Sw,{value:"cad",children:[r&&Ke.jsx("span",{className:jm("inline-flex items-center justify-center w-2 h-2 mr-1 text-xs font-bold text-white rounded-full",Y?"rf-bg-gray-500":"rf-bg-blue-500")}),"3D"]}),!["pcb","cad","schematic"].includes(Ie)&&Ke.jsx(Sw,{value:Ie,children:PQe(Ie)}),Ke.jsxs(che,{children:[Ke.jsx(uhe,{asChild:!0,children:Ke.jsxs("div",{className:"rf-whitespace-nowrap rf-p-2 rf-mr-1 rf-cursor-pointer rf-relative",children:[Ke.jsx(M$t,{className:"rf-w-4 rf-h-4"}),(he&&he.length>0||t)&&Ke.jsx("span",{className:"rf-inline-flex rf-absolute rf-top-[6px] rf-right-[4px] rf-items-center rf-justify-center rf-w-1 rf-h-1 rf-ml-2 rf-text-[8px] rf-font-bold rf-text-white rf-bg-red-500 rf-rounded-full"})]})}),Ke.jsxs(MH,{className:"rf-*:text-xs",children:[dAn.map(dt=>Ke.jsxs(GB,{onSelect:()=>De(dt),children:[Ie!==dt&&Ke.jsx(ZHe,{className:"rf-w-3 rf-h-3 rf-opacity-30"}),Ie===dt&&Ke.jsx(gfe,{className:"rf-w-3 rf-h-3"}),Ke.jsx("div",{className:"rf-pr-2",children:PQe(dt)}),dt==="errors"&&(he&&he.length>0||t)&&Ke.jsx("span",{className:"rf-inline-flex rf-items-center rf-justify-center rf-w-3 rf-h-3 rf-ml-2 rf-text-[8px] rf-font-bold rf-text-white rf-bg-red-500 rf-rounded-full",children:t?1:he==null?void 0:he.length})]},dt)),Ke.jsx(GB,{disabled:!0,className:"rf-opacity-60 rf-cursor-default rf-select-none",children:Ke.jsxs("div",{className:"rf-pr-2 rf-text-xs rf-text-gray-500",children:["@tscircuit/runframe@",AAn.split(".").map((dt,zt)=>zt===2?parseInt(dt)+1:dt).join(".")]})}),ye&&Ke.jsx(GB,{disabled:!0,className:"rf-opacity-60 rf-cursor-default rf-select-none",children:Ke.jsxs("div",{className:"rf-pr-2 rf-text-xs rf-text-gray-500",children:["@tscircuit/eval@",ye]})})]})]})]}),ce&&Ke.jsx(tE,{onClick:je,variant:"ghost",children:Qe?Ke.jsx(T$t,{size:16}):Ke.jsx(D$t,{size:16})})]}),s&&Ke.jsx(rS,{value:"code",className:"rf-flex-grow rf-overflow-hidden",children:Ke.jsx("div",{className:"rf-h-full",children:l})}),Ke.jsx(rS,{value:"pcb",children:Ke.jsx("div",{className:jm("rf-overflow-hidden",Qe?"rf-h-[calc(100vh-52px)]":"rf-h-full"),children:Ke.jsx(YD,{fallbackRender:({error:dt})=>Ke.jsx("div",{className:"rf-mt-4 rf-bg-red-50 rf-rounded-md rf-border rf-border-red-200",children:Ke.jsxs("div",{className:"rf-p-4",children:[Ke.jsx("h3",{className:"rf-text-lg rf-font-semibold rf-text-red-800 rf-mb-3",children:"Error loading PCB viewer"}),Ke.jsx("p",{className:"rf-text-xs rf-font-mono rf-whitespace-pre-wrap rf-text-red-600 rf-mt-2",children:(dt==null?void 0:dt.message)||"An unknown error occurred"})]})}),children:r?Ke.jsx(aAn,{focusOnHover:!1,circuitJson:r,debugGraphics:a,containerClassName:jm("rf-h-full rf-w-full",Qe?"rf-min-h-[calc(100vh-240px)]":"rf-min-h-[620px]"),onEditEventsChanged:dt=>{q&&dt.forEach(zt=>q(zt))}}):Ke.jsx(j2,{onRunClicked:e})})})}),Ke.jsx(rS,{value:"assembly",children:Ke.jsx("div",{className:jm("rf-overflow-auto",Qe?"rf-h-[calc(100vh-96px)]":"rf-h-full"),children:Ke.jsx(YD,{fallback:Ke.jsx("div",{children:"Error loading Assembly"}),children:r?Ke.jsx(oan,{circuitJson:r,containerStyle:{height:"100%"},editingEnabled:!0,debugGrid:!0}):Ke.jsx(j2,{onRunClicked:e})})})}),Ke.jsx(rS,{value:"schematic",children:Ke.jsx("div",{className:jm("rf-overflow-auto rf-bg-white",Qe?"rf-h-[calc(100vh-96px)]":"rf-h-full"),children:Ke.jsx(YD,{fallbackRender:({error:dt})=>Ke.jsx("div",{className:"rf-mt-4 rf-bg-red-50 rf-rounded-md rf-border rf-border-red-200",children:Ke.jsxs("div",{className:"rf-p-4",children:[Ke.jsx("h3",{className:"rf-text-lg rf-font-semibold rf-text-red-800 rf-mb-3",children:"Error loading Schematic"}),Ke.jsx("p",{className:"rf-text-xs rf-font-mono rf-whitespace-pre-wrap rf-text-red-600 rf-mt-2",children:(dt==null?void 0:dt.message)||"An unknown error occurred"})]})}),children:r?Ke.jsx(ian,{circuitJson:r,containerStyle:{height:"100%"},editingEnabled:!0,onEditEvent:dt=>{q==null||q(dt)},debugGrid:ue}):Ke.jsx(j2,{onRunClicked:e})})})}),Ke.jsx(rS,{value:"cad",children:Ke.jsx("div",{className:jm("rf-overflow-auto",Qe?"rf-h-[calc(100vh-96px)]":"rf-h-full"),children:Ke.jsx(YD,{FallbackComponent:y$t,children:r?Ke.jsx(g$t,{ref:et,circuitJson:r,autoRotateDisabled:j}):Ke.jsx(j2,{onRunClicked:e})})})}),Ke.jsx(rS,{value:"bom",children:Ke.jsx("div",{className:jm("rf-overflow-auto",Qe?"rf-h-[calc(100vh-96px)]":"rf-h-full"),children:Ke.jsx(YD,{fallbackRender:({error:dt})=>Ke.jsx("div",{className:"rf-mt-4 rf-bg-red-50 rf-rounded-md rf-border rf-border-red-200",children:Ke.jsxs("div",{className:"rf-p-4",children:[Ke.jsx("h3",{className:"rf-text-lg rf-font-semibold rf-text-red-800 rf-mb-3",children:"Error loading Bill of Materials"}),Ke.jsx("p",{className:"rf-text-xs rf-font-mono rf-whitespace-pre-wrap rf-text-red-600 rf-mt-2",children:(dt==null?void 0:dt.message)||"An unknown error occurred"})]})}),children:r?Ke.jsx(Aan,{circuitJson:r}):Ke.jsx(j2,{onRunClicked:e})})})}),Ke.jsx(rS,{value:"circuit_json",children:Ke.jsx("div",{className:jm("rf-overflow-auto",Qe?"rf-h-[calc(100vh-96px)]":"rf-h-full"),children:Ke.jsx(YD,{fallback:Ke.jsx("div",{children:"Error loading JSON viewer"}),children:r?Ke.jsx(can,{elements:r}):Ke.jsx(j2,{onRunClicked:e})})})}),Ke.jsx(rS,{value:"errors",children:Ke.jsx("div",{className:jm("rf-overflow-auto",Qe?"rf-h-[calc(100vh-96px)]":"rf-h-full"),children:t||he&&he.length>0||r?Ke.jsx(win,{code:i,circuitJsonErrors:he,circuitJsonWarnings:xe,errorMessage:t,errorStack:n,circuitJson:r,evalVersion:ye,autoroutingLog:M,onReportAutoroutingLog:L}):Ke.jsx(j2,{onRunClicked:e})})}),d&&Ke.jsx(rS,{value:"render_log",children:Ke.jsx(uAn,{renderLog:p})})]})})})};var QY="Dialog",[EZe,bZe]=QQ(QY),[hAn,JS]=EZe(QY),xZe=i=>{const{__scopeDialog:e,children:t,open:n,defaultOpen:r,onOpenChange:a,modal:o=!0}=i,s=it.useRef(null),l=it.useRef(null),[u,d]=f5({prop:n,defaultProp:r??!1,onChange:a,caller:QY});return Ke.jsx(hAn,{scope:e,triggerRef:s,contentRef:l,contentId:MQ(),titleId:MQ(),descriptionId:MQ(),open:u,onOpenChange:d,onOpenToggle:it.useCallback(()=>d(f=>!f),[d]),modal:o,children:t})};xZe.displayName=QY;var BZe="DialogTrigger",SZe=it.forwardRef((i,e)=>{const{__scopeDialog:t,...n}=i,r=JS(BZe,t),a=W_(e,r.triggerRef);return Ke.jsx(e1.button,{type:"button","aria-haspopup":"dialog","aria-expanded":r.open,"aria-controls":r.contentId,"data-state":uge(r.open),...n,ref:a,onClick:Pm(i.onClick,r.onOpenToggle)})});SZe.displayName=BZe;var lge="DialogPortal",[pAn,wZe]=EZe(lge,{forceMount:void 0}),QZe=i=>{const{__scopeDialog:e,forceMount:t,children:n,container:r}=i,a=JS(lge,e);return Ke.jsx(pAn,{scope:e,forceMount:t,children:it.Children.map(n,o=>Ke.jsx(Cw,{present:t||a.open,children:Ke.jsx(jfe,{asChild:!0,container:r,children:o})}))})};QZe.displayName=lge;var MY="DialogOverlay",MZe=it.forwardRef((i,e)=>{const t=wZe(MY,i.__scopeDialog),{forceMount:n=t.forceMount,...r}=i,a=JS(MY,i.__scopeDialog);return a.modal?Ke.jsx(Cw,{present:n||a.open,children:Ke.jsx(mAn,{...r,ref:e})}):null});MZe.displayName=MY;var gAn=d5("DialogOverlay.RemoveScroll"),mAn=it.forwardRef((i,e)=>{const{__scopeDialog:t,...n}=i,r=JS(MY,t);return Ke.jsx($fe,{as:gAn,allowPinchZoom:!0,shards:[r.contentRef],children:Ke.jsx(e1.div,{"data-state":uge(r.open),...n,ref:e,style:{pointerEvents:"auto",...n.style}})})}),nR="DialogContent",RZe=it.forwardRef((i,e)=>{const t=wZe(nR,i.__scopeDialog),{forceMount:n=t.forceMount,...r}=i,a=JS(nR,i.__scopeDialog);return Ke.jsx(Cw,{present:n||a.open,children:a.modal?Ke.jsx(yAn,{...r,ref:e}):Ke.jsx(vAn,{...r,ref:e})})});RZe.displayName=nR;var yAn=it.forwardRef((i,e)=>{const t=JS(nR,i.__scopeDialog),n=it.useRef(null),r=W_(e,t.contentRef,n);return it.useEffect(()=>{const a=n.current;if(a)return eVe(a)},[]),Ke.jsx(DZe,{...i,ref:r,trapFocus:t.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Pm(i.onCloseAutoFocus,a=>{var o;a.preventDefault(),(o=t.triggerRef.current)==null||o.focus()}),onPointerDownOutside:Pm(i.onPointerDownOutside,a=>{const o=a.detail.originalEvent,s=o.button===0&&o.ctrlKey===!0;(o.button===2||s)&&a.preventDefault()}),onFocusOutside:Pm(i.onFocusOutside,a=>a.preventDefault())})}),vAn=it.forwardRef((i,e)=>{const t=JS(nR,i.__scopeDialog),n=it.useRef(!1),r=it.useRef(!1);return Ke.jsx(DZe,{...i,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:a=>{var o,s;(o=i.onCloseAutoFocus)==null||o.call(i,a),a.defaultPrevented||(n.current||(s=t.triggerRef.current)==null||s.focus(),a.preventDefault()),n.current=!1,r.current=!1},onInteractOutside:a=>{var l,u;(l=i.onInteractOutside)==null||l.call(i,a),a.defaultPrevented||(n.current=!0,a.detail.originalEvent.type==="pointerdown"&&(r.current=!0));const o=a.target;((u=t.triggerRef.current)==null?void 0:u.contains(o))&&a.preventDefault(),a.detail.originalEvent.type==="focusin"&&r.current&&a.preventDefault()}})}),DZe=it.forwardRef((i,e)=>{const{__scopeDialog:t,trapFocus:n,onOpenAutoFocus:r,onCloseAutoFocus:a,...o}=i,s=JS(nR,t),l=it.useRef(null),u=W_(e,l);return pYe(),Ke.jsxs(Ke.Fragment,{children:[Ke.jsx(Dfe,{asChild:!0,loop:!0,trapped:n,onMountAutoFocus:r,onUnmountAutoFocus:a,children:Ke.jsx(wfe,{role:"dialog",id:s.contentId,"aria-describedby":s.descriptionId,"aria-labelledby":s.titleId,"data-state":uge(s.open),...o,ref:u,onDismiss:()=>s.onOpenChange(!1)})}),Ke.jsxs(Ke.Fragment,{children:[Ke.jsx(IAn,{titleId:s.titleId}),Ke.jsx(EAn,{contentRef:l,descriptionId:s.descriptionId})]})]})}),cge="DialogTitle",NZe=it.forwardRef((i,e)=>{const{__scopeDialog:t,...n}=i,r=JS(cge,t);return Ke.jsx(e1.h2,{id:r.titleId,...n,ref:e})});NZe.displayName=cge;var TZe="DialogDescription",UZe=it.forwardRef((i,e)=>{const{__scopeDialog:t,...n}=i,r=JS(TZe,t);return Ke.jsx(e1.p,{id:r.descriptionId,...n,ref:e})});UZe.displayName=TZe;var PZe="DialogClose",LZe=it.forwardRef((i,e)=>{const{__scopeDialog:t,...n}=i,r=JS(PZe,t);return Ke.jsx(e1.button,{type:"button",...n,ref:e,onClick:Pm(i.onClick,()=>r.onOpenChange(!1))})});LZe.displayName=PZe;function uge(i){return i?"open":"closed"}var kZe="DialogTitleWarning",[CAn,GZe]=Vxt(kZe,{contentName:nR,titleName:cge,docsSlug:"dialog"}),IAn=({titleId:i})=>{const e=GZe(kZe),t=`\`${e.contentName}\` requires a \`${e.titleName}\` for the component to be accessible for screen reader users.
13750
13750
 
13751
13751
  If you want to hide the \`${e.titleName}\`, you can wrap it with our VisuallyHidden component.
13752
13752